@crystaldesign/diva-web-planner-react 24.9.0-beta.8 → 24.9.0-beta.9
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.
|
@@ -405,4 +405,4 @@ canvas {
|
|
|
405
405
|
</div>
|
|
406
406
|
<div class="screen-reader-only" role="region" aria-label="Live announcements">
|
|
407
407
|
<span id="status" role="status"></span>
|
|
408
|
-
</div>`;var Ea=r(93e3);const ya=new WeakMap;function DRACOWorker(){let e,t;function decodeAttribute(e,t,r,s,o,l){const c=l.num_components(),h=r.num_points()*c,d=h*o.BYTES_PER_ELEMENT,p=function getDracoDataType(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,o),A=e._malloc(d);t.GetAttributeDataArrayForAllPoints(r,l,p,d,A);const m=new o(e.HEAPF32.buffer,A,h).slice();return e._free(A),{name:s,array:m,itemSize:c}}onmessage=function(r){const s=r.data;switch(s.type){case"init":e=s.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const r=s.buffer,o=s.taskConfig;t.then((e=>{const t=e.draco,l=new t.Decoder;try{const e=function decodeGeometry(e,t,r,s){const o=s.attributeIDs,l=s.attributeTypes;let c,h;const d=t.GetEncodedGeometryType(r);if(d===e.TRIANGULAR_MESH)c=new e.Mesh,h=t.DecodeArrayToMesh(r,r.byteLength,c);else{if(d!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");c=new e.PointCloud,h=t.DecodeArrayToPointCloud(r,r.byteLength,c)}if(!h.ok()||0===c.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const p={index:null,attributes:[]};for(const r in o){const h=self[l[r]];let d,A;if(s.useUniqueIDs)A=o[r],d=t.GetAttributeByUniqueId(c,A);else{if(A=t.GetAttributeId(c,e[o[r]]),-1===A)continue;d=t.GetAttribute(c,A)}const m=decodeAttribute(e,t,c,r,h,d);"color"===r&&(m.vertexColorSpace=s.vertexColorSpace),p.attributes.push(m)}d===e.TRIANGULAR_MESH&&(p.index=function decodeIndex(e,t,r){const s=r.num_faces(),o=3*s,l=4*o,c=e._malloc(l);t.GetTrianglesUInt32Array(r,l,c);const h=new Uint32Array(e.HEAPF32.buffer,c,o).slice();return e._free(c),{array:h,itemSize:1}}(e,t,c));return e.destroy(c),p}(t,l,new Int8Array(r),o),c=e.attributes.map((e=>e.array.buffer));e.index&&c.push(e.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:e},c)}catch(e){Ea.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(l)}}))}}}var xa=r(93e3);function toTrianglesDrawMode(e,t){if(0===t)return xa.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let r=e.getIndex();if(null===r){const t=[],s=e.getAttribute("position");if(void 0===s)return xa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<s.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}const s=r.count-2,o=[];if(2===t)for(let e=1;e<=s;e++)o.push(r.getX(0)),o.push(r.getX(e)),o.push(r.getX(e+1));else for(let e=0;e<s;e++)e%2==0?(o.push(r.getX(e)),o.push(r.getX(e+1)),o.push(r.getX(e+2))):(o.push(r.getX(e+2)),o.push(r.getX(e+1)),o.push(r.getX(e)));o.length/3!==s&&xa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const l=e.clone();return l.setIndex(o),l.clearGroups(),l}return xa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var Sa=r(93e3);class GLTFLoader extends Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFTextureBasisUExtension(e)})),this.register((function(e){return new GLTFTextureWebPExtension(e)})),this.register((function(e){return new GLTFTextureAVIFExtension(e)})),this.register((function(e){return new GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFLightsExtension(e)})),this.register((function(e){return new GLTFMeshoptCompression(e)})),this.register((function(e){return new GLTFMeshGpuInstancing(e)}))}load(e,t,r,s){const o=this;let l;if(""!==this.resourcePath)l=this.resourcePath;else if(""!==this.path){const t=LoaderUtils.extractUrlBase(e);l=LoaderUtils.resolveURL(t,this.path)}else l=LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const _onError=function(t){s?s(t):Sa.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},c=new three_module_FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,(function(r){try{o.parse(r,l,(function(r){t(r),o.manager.itemEnd(e)}),_onError)}catch(e){_onError(e)}}),r,_onError)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){let o;const l={},c={},h=new TextDecoder;if("string"==typeof e)o=JSON.parse(e);else if(e instanceof ArrayBuffer){if(h.decode(new Uint8Array(e,0,4))===Ca){try{l[Ma.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){return void(s&&s(e))}o=JSON.parse(l[Ma.KHR_BINARY_GLTF].content)}else o=JSON.parse(h.decode(e))}else o=e;if(void 0===o.asset||o.asset.version[0]<2)return void(s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const d=new GLTFParser(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](d);t.name||Sa.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[t.name]=t,l[t.name]=!0}if(o.extensionsUsed)for(let e=0;e<o.extensionsUsed.length;++e){const t=o.extensionsUsed[e],r=o.extensionsRequired||[];switch(t){case Ma.KHR_MATERIALS_UNLIT:l[t]=new GLTFMaterialsUnlitExtension;break;case Ma.KHR_DRACO_MESH_COMPRESSION:l[t]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case Ma.KHR_TEXTURE_TRANSFORM:l[t]=new GLTFTextureTransformExtension;break;case Ma.KHR_MESH_QUANTIZATION:l[t]=new GLTFMeshQuantizationExtension;break;default:r.indexOf(t)>=0&&void 0===c[t]&&Sa.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}d.setExtensions(l),d.setPlugins(c),d.parse(r,s)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,t,s,o)}))}}function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const Ma={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class GLTFLightsExtension{constructor(e){this.parser=e,this.name=Ma.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r];s.extensions&&s.extensions[this.name]&&void 0!==s.extensions[this.name].light&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let s=t.cache.get(r);if(s)return s;const o=t.json,l=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let c;const h=new Color(16777215);void 0!==l.color&&h.setRGB(l.color[0],l.color[1],l.color[2],tt);const d=void 0!==l.range?l.range:0;switch(l.type){case"directional":c=new DirectionalLight(h),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new PointLight(h),c.distance=d;break;case"spot":c=new SpotLight(h),c.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=void 0!==l.spot.innerConeAngle?l.spot.innerConeAngle:0,l.spot.outerConeAngle=void 0!==l.spot.outerConeAngle?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,assignExtrasToUserData(c,l),void 0!==l.intensity&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),s=Promise.resolve(c),t.cache.add(r,s),s}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,s=r.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(e){return r._getNodeRef(t.cache,o,e)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=Ma.KHR_MATERIALS_UNLIT}getMaterialType(){return MeshBasicMaterial}extendParams(e,t,r){const s=[];e.color=new Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const t=o.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],tt),e.opacity=t[3]}void 0!==o.baseColorTexture&&s.push(r.assignTexture(e,"map",o.baseColorTexture,et))}return Promise.all(s)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return void 0!==s&&(t.emissiveIntensity=s),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];if(void 0!==l.clearcoatFactor&&(t.clearcoat=l.clearcoatFactor),void 0!==l.clearcoatTexture&&o.push(r.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),void 0!==l.clearcoatRoughnessFactor&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),void 0!==l.clearcoatRoughnessTexture&&o.push(r.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),void 0!==l.clearcoatNormalTexture&&(o.push(r.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),void 0!==l.clearcoatNormalTexture.scale)){const e=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Vector2(e,e)}return Promise.all(o)}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.iridescenceFactor&&(t.iridescence=l.iridescenceFactor),void 0!==l.iridescenceTexture&&o.push(r.assignTexture(t,"iridescenceMap",l.iridescenceTexture)),void 0!==l.iridescenceIor&&(t.iridescenceIOR=l.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==l.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),void 0!==l.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),void 0!==l.iridescenceThicknessTexture&&o.push(r.assignTexture(t,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=s.extensions[this.name];if(void 0!==l.sheenColorFactor){const e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],tt)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&o.push(r.assignTexture(t,"sheenColorMap",l.sheenColorTexture,et)),void 0!==l.sheenRoughnessTexture&&o.push(r.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(o)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.transmissionFactor&&(t.transmission=l.transmissionFactor),void 0!==l.transmissionTexture&&o.push(r.assignTexture(t,"transmissionMap",l.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];t.thickness=void 0!==l.thicknessFactor?l.thicknessFactor:0,void 0!==l.thicknessTexture&&o.push(r.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const c=l.attenuationColor||[1,1,1];return t.attenuationColor=(new Color).setRGB(c[0],c[1],c[2],tt),Promise.all(o)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=void 0!==s.ior?s.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&o.push(r.assignTexture(t,"specularIntensityMap",l.specularTexture));const c=l.specularColorFactor||[1,1,1];return t.specularColor=(new Color).setRGB(c[0],c[1],c[2],tt),void 0!==l.specularColorTexture&&o.push(r.assignTexture(t,"specularColorMap",l.specularColorTexture,et)),Promise.all(o)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=Ma.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return t.bumpScale=void 0!==l.bumpFactor?l.bumpFactor:1,void 0!==l.bumpTexture&&o.push(r.assignTexture(t,"bumpMap",l.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.anisotropyStrength&&(t.anisotropy=l.anisotropyStrength),void 0!==l.anisotropyRotation&&(t.anisotropyRotation=l.anisotropyRotation),void 0!==l.anisotropyTexture&&o.push(r.assignTexture(t,"anisotropyMap",l.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=Ma.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const o=s.extensions[this.name],l=t.options.ktx2Loader;if(!l){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,l)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=Ma.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let h=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return r.loadTextureImage(e,l.source,h);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=Ma.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let h=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return r.loadTextureImage(e,l.source,h);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFMeshoptCompression{constructor(e){this.name=Ma.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const e=r.extensions[this.name],s=this.parser.getDependency("buffer",e.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then((function(t){const r=e.byteOffset||0,s=e.byteLength||0,l=e.count,c=e.byteStride,h=new Uint8Array(t,r,s);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(l,c,h,e.mode,e.filter).then((function(e){return e.buffer})):o.ready.then((function(){const t=new ArrayBuffer(l*c);return o.decodeGltfBuffer(new Uint8Array(t),l,c,h,e.mode,e.filter),t}))}))}return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=Ma.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;const s=t.meshes[r.mesh];for(const e of s.primitives)if(e.mode!==Ta.TRIANGLES&&e.mode!==Ta.TRIANGLE_STRIP&&e.mode!==Ta.TRIANGLE_FAN&&void 0!==e.mode)return null;const o=r.extensions[this.name].attributes,l=[],c={};for(const e in o)l.push(this.parser.getDependency("accessor",o[e]).then((t=>(c[e]=t,c[e]))));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((e=>{const t=e.pop(),r=t.isGroup?t.children:[t],s=e[0].count,o=[];for(const e of r){const t=new three_module_Matrix4,r=new three_module_Vector3,l=new three_module_Quaternion,h=new three_module_Vector3(1,1,1),d=new InstancedMesh(e.geometry,e.material,s);for(let e=0;e<s;e++)c.TRANSLATION&&r.fromBufferAttribute(c.TRANSLATION,e),c.ROTATION&&l.fromBufferAttribute(c.ROTATION,e),c.SCALE&&h.fromBufferAttribute(c.SCALE,e),d.setMatrixAt(e,t.compose(r,l,h));for(const t in c)if("_COLOR_0"===t){const e=c[t];d.instanceColor=new three_module_InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,c[t]);Object3D.prototype.copy.call(d,e),this.parser.assignFinalMaterial(d),o.push(d)}return t.isGroup?(t.clear(),t.add(...o),t):o[0]})))}}const Ca="glTF",ba=1313821514,Ia=5130562;class GLTFBinaryExtension{constructor(e){this.name=Ma.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ca)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-12,o=new DataView(e,12);let l=0;for(;l<s;){const t=o.getUint32(l,!0);l+=4;const s=o.getUint32(l,!0);if(l+=4,s===ba){const s=new Uint8Array(e,12+l,t);this.content=r.decode(s)}else if(s===Ia){const r=12+l;this.body=e.slice(r,r+t)}l+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class GLTFDracoMeshCompressionExtension{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ma.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,s=this.dracoLoader,o=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,c={},h={},d={};for(const e in l){const t=Ua[e]||e.toLowerCase();c[t]=l[e]}for(const t in e.attributes){const s=Ua[t]||t.toLowerCase();if(void 0!==l[t]){const o=r.accessors[e.attributes[t]],l=Ba[o.componentType];d[s]=l.name,h[s]=!0===o.normalized}}return t.getDependency("bufferView",o).then((function(e){return new Promise((function(t,r){s.decodeDracoFile(e,(function(e){for(const t in e.attributes){const r=e.attributes[t],s=h[t];void 0!==s&&(r.normalized=s)}t(e)}),c,d,tt,r)}))}))}}class GLTFTextureTransformExtension{constructor(){this.name=Ma.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class GLTFMeshQuantizationExtension{constructor(){this.name=Ma.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends Interpolant{constructor(e,t,r,s){super(e,t,r,s)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,o=e*s*3+s;for(let e=0;e!==s;e++)t[e]=r[o+e];return t}interpolate_(e,t,r,s){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=2*c,d=3*c,p=s-t,A=(r-t)/p,m=A*A,g=m*A,f=e*d,_=f-d,E=-2*g+3*m,y=g-m,x=1-E,S=y-m+A;for(let e=0;e!==c;e++){const t=l[_+e+c],r=l[_+e+h]*p,s=l[f+e+c],d=l[f+e]*p;o[e]=x*t+S*r+E*s+y*d}return o}}const wa=new three_module_Quaternion;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,r,s){const o=super.interpolate_(e,t,r,s);return wa.fromArray(o).normalize().toArray(o),o}}const Ta={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Ba={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ra={9728:pe,9729:ge,9984:Ae,9985:fe,9986:me,9987:_e},La={33071:ue,33648:de,10497:he},Da={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ua={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Pa={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fa={CUBICSPLINE:void 0,LINEAR:qe,STEP:We},Na="OPAQUE",Qa="MASK",Oa="BLEND";function createDefaultMaterial(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:p})),e.DefaultMaterial}function addUnknownExtensionsToUserData(e,t,r){for(const s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function assignExtrasToUserData(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):Sa.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function updateMorphTargets(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,s=t.weights.length;r<s;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){const r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,s=r.length;t<s;t++)e.morphTargetDictionary[r[t]]=t}else Sa.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(e){let t;const r=e.extensions&&e.extensions[Ma.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+createAttributesKey(r.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,s=e.targets.length;r<s;r++)t+=":"+createAttributesKey(e.targets[r]);return t}function createAttributesKey(e){let t="";const r=Object.keys(e).sort();for(let s=0,o=r.length;s<o;s++)t+=r[s]+":"+e[r[s]]+";";return t}function getNormalizedComponentScale(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const Ga=new three_module_Matrix4;class GLTFParser{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GLTFRegistry,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,s=!1,o=-1;"undefined"!=typeof navigator&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),s=navigator.userAgent.indexOf("Firefox")>-1,o=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||s&&o<98?this.textureLoader=new TextureLoader(this.options.manager):this.textureLoader=new ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new three_module_FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,s=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){const l={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:r,userData:{}};return addUnknownExtensionsToUserData(o,l,s),assignExtrasToUserData(l,s),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(l)}))).then((function(){e(l)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r].joints;for(let t=0,r=s.length;t<r;t++)e[s[t]].isBone=!0}for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0!==s.mesh&&(this._addNodeRef(this.meshCache,s.mesh),void 0!==s.skin&&(r[s.mesh].isSkinnedMesh=!0)),void 0!==s.camera&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const s=r.clone(),updateMappings=(e,t)=>{const r=this.associations.get(e);null!=r&&this.associations.set(t,r);for(const[r,s]of e.children.entries())updateMappings(s,t.children[r])};return updateMappings(r,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const s=e(t[r]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let s=0;s<t.length;s++){const o=e(t[s]);o&&r.push(o)}return r}getDependency(e,t){const r=e+":"+t;let s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":s=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":s=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})),!s)throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map((function(t,s){return r.getDependency(e,s)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[Ma.KHR_BINARY_GLTF].body);const s=this.options;return new Promise((function(e,o){r.load(LoaderUtils.resolveURL(t.uri,s.path),e,void 0,(function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const r=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+r)}))}loadAccessor(e){const t=this,r=this.json,s=this.json.accessors[e];if(void 0===s.bufferView&&void 0===s.sparse){const e=Da[s.type],t=Ba[s.componentType],r=!0===s.normalized,o=new t(s.count*e);return Promise.resolve(new three_module_BufferAttribute(o,e,r))}const o=[];return void 0!==s.bufferView?o.push(this.getDependency("bufferView",s.bufferView)):o.push(null),void 0!==s.sparse&&(o.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(o).then((function(e){const o=e[0],l=Da[s.type],c=Ba[s.componentType],h=c.BYTES_PER_ELEMENT,d=h*l,p=s.byteOffset||0,A=void 0!==s.bufferView?r.bufferViews[s.bufferView].byteStride:void 0,m=!0===s.normalized;let g,f;if(A&&A!==d){const e=Math.floor(p/A),r="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+e+":"+s.count;let d=t.cache.get(r);d||(g=new c(o,e*A,s.count*A/h),d=new three_module_InterleavedBuffer(g,A/h),t.cache.add(r,d)),f=new three_module_InterleavedBufferAttribute(d,l,p%A/h,m)}else g=null===o?new c(s.count*l):new c(o,p,s.count*l),f=new three_module_BufferAttribute(g,l,m);if(void 0!==s.sparse){const t=Da.SCALAR,r=Ba[s.sparse.indices.componentType],h=s.sparse.indices.byteOffset||0,d=s.sparse.values.byteOffset||0,p=new r(e[1],h,s.sparse.count*t),A=new c(e[2],d,s.sparse.count*l);null!==o&&(f=new three_module_BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let e=0,t=p.length;e<t;e++){const t=p[e];if(f.setX(t,A[e*l]),l>=2&&f.setY(t,A[e*l+1]),l>=3&&f.setZ(t,A[e*l+2]),l>=4&&f.setW(t,A[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f}))}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let l=this.textureLoader;if(o.uri){const e=r.manager.getHandler(o.uri);null!==e&&(l=e)}return this.loadTextureImage(e,s,l)}loadTextureImage(e,t,r){const s=this,o=this.json,l=o.textures[e],c=o.images[t],h=(c.uri||c.bufferView)+":"+l.sampler;if(this.textureCache[h])return this.textureCache[h];const d=this.loadImageSource(t,r).then((function(t){t.flipY=!1,t.name=l.name||c.name||"",""===t.name&&"string"==typeof c.uri&&!1===c.uri.startsWith("data:image/")&&(t.name=c.uri);const r=(o.samplers||{})[l.sampler]||{};return t.magFilter=Ra[r.magFilter]||ge,t.minFilter=Ra[r.minFilter]||_e,t.wrapS=La[r.wrapS]||he,t.wrapT=La[r.wrapT]||he,s.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[h]=d,d}loadImageSource(e,t){const r=this,s=this.json,o=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=s.images[e],c=self.URL||self.webkitURL;let h=l.uri||"",d=!1;if(void 0!==l.bufferView)h=r.getDependency("bufferView",l.bufferView).then((function(e){d=!0;const t=new Blob([e],{type:l.mimeType});return h=c.createObjectURL(t),h}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(h).then((function(e){return new Promise((function(r,s){let l=r;!0===t.isImageBitmapLoader&&(l=function(e){const t=new Texture(e);t.needsUpdate=!0,r(t)}),t.load(LoaderUtils.resolveURL(e,o.path),l,void 0,s)}))})).then((function(e){return!0===d&&c.revokeObjectURL(h),e.userData.mimeType=l.mimeType||function getImageURIMimeType(e){return e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"}(l.uri),e})).catch((function(e){throw Sa.error("THREE.GLTFLoader: Couldn't load texture",h),e}));return this.sourceCache[e]=p,p}assignTexture(e,t,r,s){const o=this;return this.getDependency("texture",r.index).then((function(l){if(!l)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((l=l.clone()).channel=r.texCoord),o.extensions[Ma.KHR_TEXTURE_TRANSFORM]){const e=void 0!==r.extensions?r.extensions[Ma.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=o.associations.get(l);l=o.extensions[Ma.KHR_TEXTURE_TRANSFORM].extendTexture(l,e),o.associations.set(l,t)}}return void 0!==s&&(l.colorSpace=s),e[t]=l,l}))}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const s=void 0===t.attributes.tangent,o=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new PointsMaterial,Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){const e="LineBasicMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new LineBasicMaterial,Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(s||o||l){let e="ClonedMaterial:"+r.uuid+":";s&&(e+="derivative-tangents:"),o&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),o&&(t.vertexColors=!0),l&&(t.flatShading=!0),s&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return MeshStandardMaterial}loadMaterial(e){const t=this,r=this.json,s=this.extensions,o=r.materials[e];let l;const c={},h=[];if((o.extensions||{})[Ma.KHR_MATERIALS_UNLIT]){const e=s[Ma.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),h.push(e.extendParams(c,o,t))}else{const r=o.pbrMetallicRoughness||{};if(c.color=new Color(1,1,1),c.opacity=1,Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;c.color.setRGB(e[0],e[1],e[2],tt),c.opacity=e[3]}void 0!==r.baseColorTexture&&h.push(t.assignTexture(c,"map",r.baseColorTexture,et)),c.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,c.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(h.push(t.assignTexture(c,"metalnessMap",r.metallicRoughnessTexture)),h.push(t.assignTexture(c,"roughnessMap",r.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),h.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,c)}))))}!0===o.doubleSided&&(c.side=m);const d=o.alphaMode||Na;if(d===Oa?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,d===Qa&&(c.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&l!==MeshBasicMaterial&&(h.push(t.assignTexture(c,"normalMap",o.normalTexture)),c.normalScale=new Vector2(1,1),void 0!==o.normalTexture.scale)){const e=o.normalTexture.scale;c.normalScale.set(e,e)}if(void 0!==o.occlusionTexture&&l!==MeshBasicMaterial&&(h.push(t.assignTexture(c,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(c.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&l!==MeshBasicMaterial){const e=o.emissiveFactor;c.emissive=(new Color).setRGB(e[0],e[1],e[2],tt)}return void 0!==o.emissiveTexture&&l!==MeshBasicMaterial&&h.push(t.assignTexture(c,"emissiveMap",o.emissiveTexture,et)),Promise.all(h).then((function(){const r=new l(c);return o.name&&(r.name=o.name),assignExtrasToUserData(r,o),t.associations.set(r,{materials:e}),o.extensions&&addUnknownExtensionsToUserData(s,r,o),r}))}createUniqueName(e){const t=PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,s=this.primitiveCache;function createDracoPrimitive(e){return r[Ma.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return addPrimitiveAttributes(r,e,t)}))}const o=[];for(let r=0,l=e.length;r<l;r++){const l=e[r],c=createPrimitiveKey(l),h=s[c];if(h)o.push(h.promise);else{let e;e=l.extensions&&l.extensions[Ma.KHR_DRACO_MESH_COMPRESSION]?createDracoPrimitive(l):addPrimitiveAttributes(new three_module_BufferGeometry,l,t),s[c]={primitive:l,promise:e},o.push(e)}}return Promise.all(o)}loadMesh(e){const t=this,r=this.json,s=this.extensions,o=r.meshes[e],l=o.primitives,c=[];for(let e=0,t=l.length;e<t;e++){const t=void 0===l[e].material?createDefaultMaterial(this.cache):this.getDependency("material",l[e].material);c.push(t)}return c.push(t.loadGeometries(l)),Promise.all(c).then((function(r){const c=r.slice(0,r.length-1),h=r[r.length-1],d=[];for(let r=0,p=h.length;r<p;r++){const p=h[r],A=l[r];let m;const g=c[r];if(A.mode===Ta.TRIANGLES||A.mode===Ta.TRIANGLE_STRIP||A.mode===Ta.TRIANGLE_FAN||void 0===A.mode)m=!0===o.isSkinnedMesh?new SkinnedMesh(p,g):new three_module_Mesh(p,g),!0===m.isSkinnedMesh&&m.normalizeSkinWeights(),A.mode===Ta.TRIANGLE_STRIP?m.geometry=toTrianglesDrawMode(m.geometry,1):A.mode===Ta.TRIANGLE_FAN&&(m.geometry=toTrianglesDrawMode(m.geometry,2));else if(A.mode===Ta.LINES)m=new LineSegments(p,g);else if(A.mode===Ta.LINE_STRIP)m=new Line(p,g);else if(A.mode===Ta.LINE_LOOP)m=new LineLoop(p,g);else{if(A.mode!==Ta.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);m=new Points(p,g)}Object.keys(m.geometry.morphAttributes).length>0&&updateMorphTargets(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),assignExtrasToUserData(m,o),A.extensions&&addUnknownExtensionsToUserData(s,m,A),t.assignFinalMaterial(m),d.push(m)}for(let r=0,s=d.length;r<s;r++)t.associations.set(d[r],{meshes:e,primitives:r});if(1===d.length)return o.extensions&&addUnknownExtensionsToUserData(s,d[0],o),d[0];const p=new three_module_Group;o.extensions&&addUnknownExtensionsToUserData(s,p,o),t.associations.set(p,{meshes:e});for(let e=0,t=d.length;e<t;e++)p.add(d[e]);return p}))}loadCamera(e){let t;const r=this.json.cameras[e],s=r[r.type];if(s)return"perspective"===r.type?t=new PerspectiveCamera(bt.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):"orthographic"===r.type&&(t=new OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),assignExtrasToUserData(t,r),Promise.resolve(t);Sa.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],r=[];for(let e=0,s=t.joints.length;e<s;e++)r.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){const r=e.pop(),s=e,o=[],l=[];for(let e=0,c=s.length;e<c;e++){const c=s[e];if(c){o.push(c);const t=new three_module_Matrix4;null!==r&&t.fromArray(r.array,16*e),l.push(t)}else Sa.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new Skeleton(o,l)}))}loadAnimation(e){const t=this.json,r=this,s=t.animations[e],o=s.name?s.name:"animation_"+e,l=[],c=[],h=[],d=[],p=[];for(let e=0,t=s.channels.length;e<t;e++){const t=s.channels[e],r=s.samplers[t.sampler],o=t.target,A=o.node,m=void 0!==s.parameters?s.parameters[r.input]:r.input,g=void 0!==s.parameters?s.parameters[r.output]:r.output;void 0!==o.node&&(l.push(this.getDependency("node",A)),c.push(this.getDependency("accessor",m)),h.push(this.getDependency("accessor",g)),d.push(r),p.push(o))}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(h),Promise.all(d),Promise.all(p)]).then((function(e){const t=e[0],s=e[1],l=e[2],c=e[3],h=e[4],d=[];for(let e=0,o=t.length;e<o;e++){const o=t[e],p=s[e],A=l[e],m=c[e],g=h[e];if(void 0===o)continue;o.updateMatrix&&o.updateMatrix();const f=r._createAnimationTracks(o,p,A,m,g);if(f)for(let e=0;e<f.length;e++)d.push(f[e])}return new three_module_AnimationClip(o,void 0,d)}))}createNodeMesh(e){const t=this.json,r=this,s=t.nodes[e];return void 0===s.mesh?null:r.getDependency("mesh",s.mesh).then((function(e){const t=r._getNodeRef(r.meshCache,s.mesh,e);return void 0!==s.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,r=s.weights.length;t<r;t++)e.morphTargetInfluences[t]=s.weights[t]})),t}))}loadNode(e){const t=this,r=this.json.nodes[e],s=t._loadNodeShallow(e),o=[],l=r.children||[];for(let e=0,r=l.length;e<r;e++)o.push(t.getDependency("node",l[e]));const c=void 0===r.skin?Promise.resolve(null):t.getDependency("skin",r.skin);return Promise.all([s,Promise.all(o),c]).then((function(e){const t=e[0],r=e[1],s=e[2];null!==s&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(s,Ga)}));for(let e=0,s=r.length;e<s;e++)t.add(r[e]);return t}))}_loadNodeShallow(e){const t=this.json,r=this.extensions,s=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const o=t.nodes[e],l=o.name?s.createUniqueName(o.name):"",c=[],h=s._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return h&&c.push(h),void 0!==o.camera&&c.push(s.getDependency("camera",o.camera).then((function(e){return s._getNodeRef(s.cameraCache,o.camera,e)}))),s._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){c.push(e)})),this.nodeCache[e]=Promise.all(c).then((function(t){let c;if(c=!0===o.isBone?new Bone:t.length>1?new three_module_Group:1===t.length?t[0]:new Object3D,c!==t[0])for(let e=0,r=t.length;e<r;e++)c.add(t[e]);if(o.name&&(c.userData.name=o.name,c.name=l),assignExtrasToUserData(c,o),o.extensions&&addUnknownExtensionsToUserData(r,c,o),void 0!==o.matrix){const e=new three_module_Matrix4;e.fromArray(o.matrix),c.applyMatrix4(e)}else void 0!==o.translation&&c.position.fromArray(o.translation),void 0!==o.rotation&&c.quaternion.fromArray(o.rotation),void 0!==o.scale&&c.scale.fromArray(o.scale);return s.associations.has(c)||s.associations.set(c,{}),s.associations.get(c).nodes=e,c})),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],s=this,o=new three_module_Group;r.name&&(o.name=s.createUniqueName(r.name)),assignExtrasToUserData(o,r),r.extensions&&addUnknownExtensionsToUserData(t,o,r);const l=r.nodes||[],c=[];for(let e=0,t=l.length;e<t;e++)c.push(s.getDependency("node",l[e]));return Promise.all(c).then((function(e){for(let t=0,r=e.length;t<r;t++)o.add(e[t]);return s.associations=(e=>{const t=new Map;for(const[e,r]of s.associations)(e instanceof Material||e instanceof Texture)&&t.set(e,r);return e.traverse((e=>{const r=s.associations.get(e);null!=r&&t.set(e,r)})),t})(o),o}))}_createAnimationTracks(e,t,r,s,o){const l=[],c=e.name?e.name:e.uuid,h=[];let d;switch(Pa[o.path]===Pa.weights?e.traverse((function(e){e.morphTargetInfluences&&h.push(e.name?e.name:e.uuid)})):h.push(c),Pa[o.path]){case Pa.weights:d=NumberKeyframeTrack;break;case Pa.rotation:d=three_module_QuaternionKeyframeTrack;break;case Pa.position:case Pa.scale:d=three_module_VectorKeyframeTrack;break;default:if(1===r.itemSize)d=NumberKeyframeTrack;else d=three_module_VectorKeyframeTrack}const p=void 0!==s.interpolation?Fa[s.interpolation]:qe,A=this._getArrayFromAccessor(r);for(let e=0,r=h.length;e<r;e++){const r=new d(h[e]+"."+Pa[o.path],t.array,A,p);"CUBICSPLINE"===s.interpolation&&this._createCubicSplineTrackInterpolant(r),l.push(r)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=getNormalizedComponentScale(t.constructor),r=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)r[s]=t[s]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function InterpolantFactoryMethodGLTFCubicSpline(e){return new(this instanceof three_module_QuaternionKeyframeTrack?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function addPrimitiveAttributes(e,t,r){const s=t.attributes,o=[];function assignAttributeAccessor(t,s){return r.getDependency("accessor",t).then((function(t){e.setAttribute(s,t)}))}for(const t in s){const r=Ua[t]||t.toLowerCase();r in e.attributes||o.push(assignAttributeAccessor(s[t],r))}if(void 0!==t.indices&&!e.index){const s=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));o.push(s)}return Dt.workingColorSpace!==tt&&"COLOR_0"in s&&Sa.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Dt.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),function computeBounds(e,t,r){const s=t.attributes,o=new Box3;if(void 0===s.POSITION)return;{const e=r.json.accessors[s.POSITION],t=e.min,l=e.max;if(void 0===t||void 0===l)return void Sa.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(o.set(new three_module_Vector3(t[0],t[1],t[2]),new three_module_Vector3(l[0],l[1],l[2])),e.normalized){const t=getNormalizedComponentScale(Ba[e.componentType]);o.min.multiplyScalar(t),o.max.multiplyScalar(t)}}const l=t.targets;if(void 0!==l){const e=new three_module_Vector3,t=new three_module_Vector3;for(let s=0,o=l.length;s<o;s++){const o=l[s];if(void 0!==o.POSITION){const s=r.json.accessors[o.POSITION],l=s.min,c=s.max;if(void 0!==l&&void 0!==c){if(t.setX(Math.max(Math.abs(l[0]),Math.abs(c[0]))),t.setY(Math.max(Math.abs(l[1]),Math.abs(c[1]))),t.setZ(Math.max(Math.abs(l[2]),Math.abs(c[2]))),s.normalized){const e=getNormalizedComponentScale(Ba[s.componentType]);t.multiplyScalar(e)}e.max(t)}else Sa.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}o.expandByVector(e)}e.boundingBox=o;const c=new Sphere;o.getCenter(c.center),c.radius=o.min.distanceTo(o.max)/2,e.boundingSphere=c}(e,t,r),Promise.all(o).then((function(){return void 0!==t.targets?function addMorphTargets(e,t,r){let s=!1,o=!1,l=!1;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(void 0!==r.POSITION&&(s=!0),void 0!==r.NORMAL&&(o=!0),void 0!==r.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(e);const c=[],h=[],d=[];for(let p=0,A=t.length;p<A;p++){const A=t[p];if(s){const t=void 0!==A.POSITION?r.getDependency("accessor",A.POSITION):e.attributes.position;c.push(t)}if(o){const t=void 0!==A.NORMAL?r.getDependency("accessor",A.NORMAL):e.attributes.normal;h.push(t)}if(l){const t=void 0!==A.COLOR_0?r.getDependency("accessor",A.COLOR_0):e.attributes.color;d.push(t)}}return Promise.all([Promise.all(c),Promise.all(h),Promise.all(d)]).then((function(t){const r=t[0],c=t[1],h=t[2];return s&&(e.morphAttributes.position=r),o&&(e.morphAttributes.normal=c),l&&(e.morphAttributes.color=h),e.morphTargetsRelative=!0,e}))}(e,t.targets,r):e}))}class WorkerPool{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const r=this.workersResolve[e];if(r&&r(t),this.queue.length){const{resolve:t,msg:r,transfer:s}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(r,s)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((r=>{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=r,this.workers[s].postMessage(e,t)):this.queue.push({resolve:r,msg:e,transfer:t})}))}dispose(){this.workers.forEach((e=>e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}var ka=r(27538).hp;const Va=2,Ha=0,za=1,Wa=10,qa=9,Xa=15,ja=16,Ya=22,Ka=37,Ja=43,$a=76,Za=83,eo=97,to=100,io=103,no=109,ro=165,so=166;class Si{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Ii{constructor(e,t,r,s){this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,s)}}new Uint8Array([0]);const ao=[171,75,84,88,32,50,48,187,13,10,26,10];function Ei(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):ka.from(e).toString("utf8")}var oo=r(27538).hp;let lo,co,ho;const uo={env:{emscripten_notify_memory_growth:function(e){ho=new Uint8Array(co.exports.memory.buffer)}}};class zstddec_module_Q{init(){return lo||(lo="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+po).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,uo))).then(this._init):WebAssembly.instantiate(oo.from(po,"base64"),uo).then(this._init),lo)}_init(e){co=e.instance,uo.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!co)throw new Error("ZSTDDecoder: Await .init() before decoding.");const r=e.byteLength,s=co.exports.malloc(r);ho.set(e,s),t=t||Number(co.exports.ZSTD_findDecompressedSize(s,r));const o=co.exports.malloc(t),l=co.exports.ZSTD_decompress(o,t,s,r),c=ho.slice(o,o+l);return co.exports.free(s),co.exports.free(o),c}}const po="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5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gJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQ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VBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACA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AAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";var Ao=r(93e3);const mo=new WeakMap;let go,fo=0;class KTX2Loader extends Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new WorkerPool,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&Ao.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:!1,etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:!1,pvrtcSupported:!1}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},e.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1)),this}init(){if(!this.transcoderPending){const e=new three_module_FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),r=new three_module_FileLoader(this.manager);r.setPath(this.transcoderPath),r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);const s=r.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,s]).then((([e,t])=>{const r=KTX2Loader.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),fo>0&&Ao.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),fo++}return this.transcoderPending}load(e,t,r,s){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const o=new three_module_FileLoader(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(e,(e=>{if(mo.has(e)){return mo.get(e).promise.then(t).catch(s)}this._createTexture(e).then((e=>t?t(e):null)).catch(s)}),r,s)}_createTextureFrom(e,t){const{faces:r,width:s,height:o,format:l,type:c,error:h,dfdFlags:d}=e;if("error"===c)return Promise.reject(h);let p;if(6===t.faceCount)p=new CompressedCubeTexture(r,l,ve);else{const e=r[0].mipmaps;p=t.layerCount>1?new CompressedArrayTexture(e,s,o,t.layerCount,l,ve):new CompressedTexture(e,s,o,l,ve)}return p.minFilter=1===r[0].mipmaps.length?ge:_e,p.magFilter=ge,p.generateMipmaps=!1,p.needsUpdate=!0,p.colorSpace=parseColorSpace(t),p.premultiplyAlpha=!!(1&d),p}async _createTexture(e,t={}){const r=function Pi(e){const t=new Uint8Array(e.buffer,e.byteOffset,ao.length);if(t[0]!==ao[0]||t[1]!==ao[1]||t[2]!==ao[2]||t[3]!==ao[3]||t[4]!==ao[4]||t[5]!==ao[5]||t[6]!==ao[6]||t[7]!==ao[7]||t[8]!==ao[8]||t[9]!==ao[9]||t[10]!==ao[10]||t[11]!==ao[11])throw new Error("Missing KTX 2.0 identifier.");const r=new Si,s=17*Uint32Array.BYTES_PER_ELEMENT,o=new Ii(e,ao.length,s,!0);r.vkFormat=o._nextUint32(),r.typeSize=o._nextUint32(),r.pixelWidth=o._nextUint32(),r.pixelHeight=o._nextUint32(),r.pixelDepth=o._nextUint32(),r.layerCount=o._nextUint32(),r.faceCount=o._nextUint32();const l=o._nextUint32();r.supercompressionScheme=o._nextUint32();const c=o._nextUint32(),h=o._nextUint32(),d=o._nextUint32(),p=o._nextUint32(),A=o._nextUint64(),m=o._nextUint64(),g=new Ii(e,ao.length+s,3*l*8,!0);for(let t=0;t<l;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+g._nextUint64(),g._nextUint64()),uncompressedByteLength:g._nextUint64()});const f=new Ii(e,c,h,!0),_={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},E=(_.descriptorBlockSize/4-6)/4;for(let e=0;e<E;e++){const t={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=f._nextInt32(),t.sampleUpper=f._nextInt32()):(t.sampleLower=f._nextUint32(),t.sampleUpper=f._nextUint32()),_.samples[e]=t}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(_);const y=new Ii(e,d,p,!0);for(;y._offset<p;){const e=y._nextUint32(),t=y._scan(e),s=Ei(t),o=y._scan(e-t.byteLength);r.keyValue[s]=s.match(/^ktx/i)?Ei(o):o,y._offset%4&&y._skip(4-y._offset%4)}if(m<=0)return r;const x=new Ii(e,A,m,!0),S=x._nextUint16(),C=x._nextUint16(),b=x._nextUint32(),I=x._nextUint32(),T=x._nextUint32(),B=x._nextUint32(),U=[];for(let e=0;e<l;e++)U.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});const F=A+x._offset,Q=F+b,O=Q+I,G=O+T,W=new Uint8Array(e.buffer,e.byteOffset+F,b),q=new Uint8Array(e.buffer,e.byteOffset+Q,I),X=new Uint8Array(e.buffer,e.byteOffset+O,T),j=new Uint8Array(e.buffer,e.byteOffset+G,B);return r.globalData={endpointCount:S,selectorCount:C,imageDescs:U,endpointsData:W,selectorsData:q,tablesData:X,extendedData:j},r}(new Uint8Array(e));if(0!==r.vkFormat)return async function createRawTexture(e){const{vkFormat:t}=e;if(void 0===vo[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let r;2===e.supercompressionScheme&&(go||(go=new Promise((async e=>{const t=new zstddec_module_Q;await t.init(),e(t)}))),r=await go);const s=[];for(let o=0;o<e.levels.length;o++){const l=Math.max(1,e.pixelWidth>>o),c=Math.max(1,e.pixelHeight>>o),h=e.pixelDepth?Math.max(1,e.pixelDepth>>o):0,d=e.levels[o];let p,A;if(0===e.supercompressionScheme)p=d.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");p=r.decode(d.levelData,d.uncompressedByteLength)}A=Eo[t]===Se?new Float32Array(p.buffer,p.byteOffset,p.byteLength/Float32Array.BYTES_PER_ELEMENT):Eo[t]===Me?new Uint16Array(p.buffer,p.byteOffset,p.byteLength/Uint16Array.BYTES_PER_ELEMENT):p,s.push({data:A,width:l,height:c,depth:h})}let o;if(_o.has(vo[t]))o=0===e.pixelDepth?new DataTexture(s[0].data,e.pixelWidth,e.pixelHeight):new Data3DTexture(s[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");o=new CompressedTexture(s,e.pixelWidth,e.pixelHeight)}return o.mipmaps=s,o.type=Eo[t],o.format=vo[t],o.colorSpace=parseColorSpace(e),o.needsUpdate=!0,Promise.resolve(o)}(r);const s=t,o=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:s},[e]))).then((e=>this._createTextureFrom(e.data,r)));return mo.set(e,{promise:o}),o}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),fo--,this}}KTX2Loader.BasisFormat={ETC1S:0,UASTC_4x4:1},KTX2Loader.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},KTX2Loader.EngineFormat={RGBAFormat:be,RGBA_ASTC_4x4_Format:Ge,RGBA_BPTC_Format:Ve,RGBA_ETC2_EAC_Format:Oe,RGBA_PVRTC_4BPPV1_Format:Fe,RGBA_S3TC_DXT5_Format:Ue,RGB_ETC1_Format:Ne,RGB_ETC2_Format:Qe,RGB_PVRTC_4BPPV1_Format:Pe,RGB_S3TC_DXT1_Format:Re},KTX2Loader.BasisWorker=function(){let e,t,r;const s=_EngineFormat,o=_TranscoderFormat,l=_BasisFormat;self.addEventListener("message",(function(c){const p=c.data;switch(p.type){case"init":e=p.config,function init(e){t=new Promise((t=>{r={wasmBinary:e,onRuntimeInitialized:t},BASIS(r)})).then((()=>{r.initializeBasis(),void 0===r.KTX2File&&Ao.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}))}(p.transcoderBinary);break;case"transcode":t.then((()=>{try{const{faces:t,buffers:c,width:A,height:m,hasAlpha:g,format:f,dfdFlags:_}=function transcode(t){const c=new r.KTX2File(new Uint8Array(t));function cleanup(){c.close(),c.delete()}if(!c.isValid())throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const p=c.isUASTC()?l.UASTC_4x4:l.ETC1S,A=c.getWidth(),m=c.getHeight(),g=c.getLayers()||1,f=c.getLevels(),_=c.getFaces(),E=c.getHasAlpha(),y=c.getDFDFlags(),{transcoderFormat:x,engineFormat:S}=function getTranscoderFormat(t,r,c,p){let A,m;const g=t===l.ETC1S?h:d;for(let s=0;s<g.length;s++){const o=g[s];if(e[o.if]&&(o.basisFormat.includes(t)&&!(p&&o.transcoderFormat.length<2)&&(!o.needsPowerOfTwo||isPowerOfTwo(r)&&isPowerOfTwo(c))))return A=o.transcoderFormat[p?1:0],m=o.engineFormat[p?1:0],{transcoderFormat:A,engineFormat:m}}return Ao.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),A=o.RGBA32,m=s.RGBAFormat,{transcoderFormat:A,engineFormat:m}}(p,A,m,E);if(!A||!m||!f)throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!c.startTranscoding())throw cleanup(),new Error("THREE.KTX2Loader: .startTranscoding failed");const C=[],b=[];for(let e=0;e<_;e++){const t=[];for(let r=0;r<f;r++){const s=[];let o,l;for(let t=0;t<g;t++){const h=c.getImageLevelInfo(r,t,e);0!==e||0!==r||0!==t||h.origWidth%4==0&&h.origHeight%4==0||Ao.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(o=h.origWidth,l=h.origHeight):(o=h.width,l=h.height);const d=new Uint8Array(c.getImageTranscodedSizeInBytes(r,t,0,x));if(!c.transcodeImage(d,r,t,e,x,0,-1,-1))throw cleanup(),new Error("THREE.KTX2Loader: .transcodeImage failed.");s.push(d)}const h=concat(s);t.push({data:h,width:o,height:l}),b.push(h.buffer)}C.push({mipmaps:t,width:A,height:m,format:S})}return cleanup(),{faces:C,buffers:b,width:A,height:m,hasAlpha:E,format:S,dfdFlags:y}}(p.buffer);self.postMessage({type:"transcode",id:p.id,faces:t,width:A,height:m,hasAlpha:g,format:f,dfdFlags:_},c)}catch(e){Ao.error(e),self.postMessage({type:"error",id:p.id,error:e.message})}}))}}));const c=[{if:"astcSupported",basisFormat:[l.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[s.RGB_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[s.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=c.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),d=c.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function isPowerOfTwo(e){return e<=2||!(e&e-1)&&0!==e}function concat(e){if(1===e.length)return e[0];let t=0;for(let r=0;r<e.length;r++){t+=e[r].byteLength}const r=new Uint8Array(t);let s=0;for(let t=0;t<e.length;t++){const o=e[t];r.set(o,s),s+=o.byteLength}return r}};const _o=new Set([be,Be,Te]),vo={[no]:be,[eo]:be,[Ka]:be,[Ja]:be,[io]:Be,[Za]:Be,[ja]:Be,[Ya]:Be,[to]:Te,[$a]:Te,[Xa]:Te,[qa]:Te,[so]:ke,[ro]:ke},Eo={[no]:Se,[eo]:Me,[Ka]:ve,[Ja]:ve,[io]:Se,[Za]:Me,[ja]:ve,[Ya]:ve,[to]:Se,[$a]:Me,[Xa]:ve,[qa]:ve,[so]:ve,[ro]:ve};function parseColorSpace(e){const t=e.dataFormatDescriptor[0];return t.colorPrimaries===za?t.transferFunction===Va?et:tt:t.colorPrimaries===Wa?t.transferFunction===Va?it:nt:(t.colorPrimaries===Ha||Ao.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),Ze)}var yo,xo;const So=Symbol("retainerCount"),Mo=Symbol("recentlyUsed"),Co=Symbol("evict"),bo=Symbol("evictionThreshold"),Io=Symbol("cache");class CacheEvictionPolicy{constructor(e,t=5){this[yo]=new Map,this[xo]=[],this[Io]=e,this[bo]=t}set evictionThreshold(e){this[bo]=e,this[Co]()}get evictionThreshold(){return this[bo]}get cache(){return this[Io]}retainerCount(e){return this[So].get(e)||0}reset(){this[So].clear(),this[Mo]=[]}retain(e){this[So].has(e)||this[So].set(e,0),this[So].set(e,this[So].get(e)+1);const t=this[Mo].indexOf(e);-1!==t&&this[Mo].splice(t,1),this[Mo].unshift(e),this[Co]()}release(e){this[So].has(e)&&this[So].set(e,Math.max(this[So].get(e)-1,0)),this[Co]()}[(yo=So,xo=Mo,Co)](){if(!(this[Mo].length<this[bo]))for(let e=this[Mo].length-1;e>=this[bo];--e){const t=this[Mo][e];0===this[So].get(t)&&(this[Io].delete(t),this[Mo].splice(e,1))}}}const mappingsArrayToTable=e=>{const t=new Map;for(const r of e.mappings)for(const e of r.variants)t.set(e,{material:null,gltfMaterialIndex:r.material});return t};class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,r=t.json;if(void 0===r.extensions||void 0===r.extensions[this.name])return null;const s=(e=>{const t=[],r=new Set;for(const s of e){let e=s,o=0;for(;r.has(e);)e=s+"."+ ++o;r.add(e),t.push(e)}return t})((r.extensions[this.name].variants||[]).map((e=>e.name)));for(const s of e.scenes)s.traverse((e=>{const s=e;if(!s.material)return;const o=t.associations.get(s);if(null==o||null==o.meshes||null==o.primitives)return;const l=r.meshes[o.meshes].primitives[o.primitives].extensions;l&&l[this.name]&&(s.userData.variantMaterials=mappingsArrayToTable(l[this.name]))}));return e.userData.variants=s,Promise.resolve()}}var wo,To,Bo=r(93e3);Texture.DEFAULT_ANISOTROPY=4;const Ro=new Map,Lo=new Map;let Do;const Uo=new class DRACOLoader extends Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,s){const o=new three_module_FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(e=>{this.parse(e,t,s)}),r,s)}parse(e,t,r=(()=>{})){this.decodeDracoFile(e,t,null,null,et).catch(r)}decodeDracoFile(e,t,r,s,o=tt,l=(()=>{})){const c={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:o};return this.decodeGeometry(e,c).then(t).catch(l)}decodeGeometry(e,t){const r=JSON.stringify(t);if(ya.has(e)){const t=ya.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const o=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(o,l).then((r=>(s=r,new Promise(((r,l)=>{s._callbacks[o]={resolve:r,reject:l},s.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return c.catch((()=>!0)).then((()=>{s&&o&&this._releaseTask(s,o)})),ya.set(e,{key:r,promise:c}),c}_createGeometry(e){const t=new three_module_BufferGeometry;e.index&&t.setIndex(new three_module_BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r],o=s.name,l=s.array,c=s.itemSize,h=new three_module_BufferAttribute(l,c);"color"===o&&(this._assignVertexColorSpace(h,s.vertexColorSpace),h.normalized=l instanceof Float32Array==!1),t.setAttribute(o,h)}return t}_assignVertexColorSpace(e,t){if(t!==et)return;const r=new Color;for(let t=0,s=e.count;t<s;t++)r.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,r.r,r.g,r.b)}_loadLibrary(e,t){const r=new three_module_FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise(((t,s)=>{r.load(e,t,void 0,s)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const s=DRACOWorker.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:Ea.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){Ea.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}};let Po;const Fo=new KTX2Loader;let No,Qo;const Oo=Symbol("loader"),Go=Symbol("evictionPolicy"),ko=Symbol("GLTFInstance");class CachingGLTFLoader extends EventDispatcher{constructor(e){super(),this[To]=(new GLTFLoader).register((e=>new GLTFMaterialsVariantsExtension(e))),this[ko]=e,this[Oo].setDRACOLoader(Uo),this[Oo].setKTX2Loader(Fo)}static setDRACODecoderLocation(e){Do=e,Uo.setDecoderPath(e)}static getDRACODecoderLocation(){return Do}static setKTX2TranscoderLocation(e){Po=e,Fo.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return Po}static setMeshoptDecoderLocation(e){var t;No!==e&&(No=e,Qo=(t=e,new Promise(((e,r)=>{const s=document.createElement("script");document.body.appendChild(s),s.onload=e,s.onerror=r,s.async=!0,s.src=t}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return No}static initializeKTX2Loader(e){Fo.detectSupport(e)}static get cache(){return Ro}static clearCache(){Ro.forEach(((e,t)=>{this.delete(t)})),this[Go].reset()}static has(e){return Ro.has(e)}static async delete(e){if(!this.has(e))return;const t=Ro.get(e);Lo.delete(e),Ro.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!Lo.get(e)}get[(wo=Go,To=Oo,Go)](){return this.constructor[Go]}async preload(e,t,r=(()=>{})){if(this[Oo].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!Ro.has(e)){null!=Qo&&this[Oo].setMeshoptDecoder(await Qo);const t=((e,t,r=(()=>{}))=>{const onProgress=e=>{const t=e.loaded/e.total;r(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise(((r,s)=>{t.load(e,r,onProgress,s)}))})(e,this[Oo],(e=>{r(.8*e)})),s=this[ko],o=t.then((e=>s.prepare(e))).then((e=>(r(.9),new s(e)))).catch((e=>(Bo.error(e),new s)));Ro.set(e,o)}await Ro.get(e),Lo.set(e,!0),r&&r(1)}async load(e,t,r=(()=>{})){await this.preload(e,t,r);const s=await Ro.get(e),o=await s.clone();return this[Go].retain(e),o.dispose=()=>{this[Go].release(e)},o}}CachingGLTFLoader[wo]=new CacheEvictionPolicy(CachingGLTFLoader);class CSS2DObject extends Object3D{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Vector2(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const Vo=new three_module_Vector3,Ho=new three_module_Matrix4,zo=new three_module_Matrix4,Wo=new three_module_Vector3,qo=new three_module_Vector3;class CSS2DRenderer{constructor(e={}){const t=this;let r,s,o,l;const c={objects:new WeakMap},h=void 0!==e.element?e.element:document.createElement("div");function renderObject(e,r,s){if(e.isCSS2DObject){Vo.setFromMatrixPosition(e.matrixWorld),Vo.applyMatrix4(zo);const d=!0===e.visible&&Vo.z>=-1&&Vo.z<=1&&!0===e.layers.test(s.layers);if(e.element.style.display=!0===d?"":"none",!0===d){e.onBeforeRender(t,r,s);const c=e.element;c.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(Vo.x*o+o)+"px,"+(-Vo.y*l+l)+"px)",c.parentNode!==h&&h.appendChild(c),e.onAfterRender(t,r,s)}const p={distanceToCameraSquared:getDistanceToSquared(s,e)};c.objects.set(e,p)}for(let t=0,o=e.children.length;t<o;t++)renderObject(e.children[t],r,s)}function getDistanceToSquared(e,t){return Wo.setFromMatrixPosition(e.matrixWorld),qo.setFromMatrixPosition(t.matrixWorld),Wo.distanceToSquared(qo)}h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:r,height:s}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),Ho.copy(t.matrixWorldInverse),zo.multiplyMatrices(t.projectionMatrix,Ho),renderObject(e,e,t),function zOrder(e){const t=function filterAndFlatten(e){const t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return c.objects.get(e).distanceToCameraSquared-c.objects.get(t).distanceToCameraSquared})),r=t.length;for(let e=0,s=t.length;e<s;e++)t[e].element.style.zIndex=r-e}(e)},this.setSize=function(e,t){r=e,s=t,o=r/2,l=s/2,h.style.width=e+"px",h.style.height=t+"px"}}}r(93e3);function reduceVertices(e,t,r){let s=r;const o=new three_module_Vector3;return e.updateWorldMatrix(!0,!0),e.traverseVisible((e=>{const{geometry:r}=e;if(void 0!==r){const{position:l}=r.attributes;if(void 0!==l)for(let r=0,c=l.count;r<c;r++)e.isMesh?e.getVertexPosition(r,o):o.fromBufferAttribute(l,r),e.isSkinnedMesh||o.applyMatrix4(e.matrixWorld),s=t(s,o)}})),s}let Xo,jo,Yo,Ko;function decompress(e,t=1/0,r=null){jo||(jo=new PlaneGeometry(2,2,1,1)),Yo||(Yo=new ShaderMaterial({uniforms:{blitTexture:new Uniform(e)},vertexShader:"\n\t\t\tvarying vec2 vUv;\n\t\t\tvoid main(){\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = vec4(position.xy * 1.0,0.,.999999);\n\t\t\t}",fragmentShader:"\n\t\t\tuniform sampler2D blitTexture; \n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main(){ \n\t\t\t\tgl_FragColor = vec4(vUv.xy, 0, 1);\n\t\t\t\t\n\t\t\t\t#ifdef IS_SRGB\n\t\t\t\tgl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n\t\t\t\t#else\n\t\t\t\tgl_FragColor = texture2D( blitTexture, vUv);\n\t\t\t\t#endif\n\t\t\t}"})),Yo.uniforms.blitTexture.value=e,Yo.defines.IS_SRGB=e.colorSpace==et,Yo.needsUpdate=!0,Ko||(Ko=new three_module_Mesh(jo,Yo),Ko.frustrumCulled=!1);const s=new PerspectiveCamera,o=new Scene;o.add(Ko),null===r&&(r=Xo=new WebGLRenderer({antialias:!1}));const l=Math.min(e.image.width,t),c=Math.min(e.image.height,t);r.setSize(l,c),r.clear(),r.render(o,s);const h=document.createElement("canvas"),d=h.getContext("2d");h.width=l,h.height=c,d.drawImage(r.domElement,0,0,l,c);const p=new CanvasTexture(h);return p.minFilter=e.minFilter,p.magFilter=e.magFilter,p.wrapS=e.wrapS,p.wrapT=e.wrapT,p.name=e.name,Xo&&(Xo.forceContextLoss(),Xo.dispose(),Xo=null),p}var Jo=r(93e3);const $o={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class GLTFExporter{constructor(){this.pluginCallbacks=[],this.register((function(e){return new GLTFLightExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsUnlitExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMeshGpuInstancing(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){const o=new GLTFWriter,l=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)l.push(this.pluginCallbacks[e](o));o.setPlugins(l),o.write(e,t,s).catch(r)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,s,o,t)}))}}const Zo=0,el=1,tl=2,il=3,nl=4,rl=5120,sl=5121,al=5122,ol=5123,ll=5124,cl=5125,hl=5126,ul=34962,dl=34963,pl=9728,Al=9729,ml=9984,gl=9985,fl=9986,_l=9987,vl=33071,El=33648,yl=10497,xl="KHR_mesh_quantization",Sl={};Sl[pe]=pl,Sl[1004]=ml,Sl[1005]=fl,Sl[1006]=Al,Sl[1007]=gl,Sl[1008]=_l,Sl[1001]=vl,Sl[1e3]=yl,Sl[1002]=El;const Ml={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},Cl=new Color;function equalArray(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){const r=getPaddedBufferSize(e.byteLength);if(r!==e.byteLength){const s=new Uint8Array(r);if(s.set(new Uint8Array(e)),0!==t)for(let o=e.byteLength;o<r;o++)s[o]=t;return s.buffer}return e}function getCanvas(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function getToBlobPromise(e,t){if(void 0!==e.toBlob)return new Promise((r=>e.toBlob(r,t)));let r;return"image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r})}class GLTFWriter{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const s=this,o=s.buffers,l=s.json;r=s.options;const c=s.extensionsUsed,h=s.extensionsRequired,d=new Blob(o,{type:"application/octet-stream"}),p=Object.keys(c),A=Object.keys(h);if(p.length>0&&(l.extensionsUsed=p),A.length>0&&(l.extensionsRequired=A),l.buffers&&l.buffers.length>0&&(l.buffers[0].byteLength=d.size),!0===r.binary){const e=new FileReader;e.readAsArrayBuffer(d),e.onloadend=function(){const r=getPaddedArrayBuffer(e.result),s=new DataView(new ArrayBuffer(8));s.setUint32(0,r.byteLength,!0),s.setUint32(4,5130562,!0);const o=getPaddedArrayBuffer(function stringToArrayBuffer(e){return(new TextEncoder).encode(e).buffer}(JSON.stringify(l)),32),c=new DataView(new ArrayBuffer(8));c.setUint32(0,o.byteLength,!0),c.setUint32(4,1313821514,!0);const h=new ArrayBuffer(12),d=new DataView(h);d.setUint32(0,1179937895,!0),d.setUint32(4,2,!0);const p=12+c.byteLength+o.byteLength+s.byteLength+r.byteLength;d.setUint32(8,p,!0);const A=new Blob([h,c,o,s,r],{type:"application/octet-stream"}),m=new FileReader;m.readAsArrayBuffer(A),m.onloadend=function(){t(m.result)}}}else if(l.buffers&&l.buffers.length>0){const e=new FileReader;e.readAsDataURL(d),e.onloadend=function(){const r=e.result;l.buffers[0].uri=r,t(l)}}else t(l)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const r=this.options,s=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&o.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in o.gltfExtensions)t.extensions[e]=o.gltfExtensions[e],s[e]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(t){Jo.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){const t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new three_module_Vector3;for(let r=0,s=e.count;r<s;r++)if(Math.abs(t.fromBufferAttribute(e,r).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),s=new three_module_Vector3;for(let e=0,t=r.count;e<t;e++)s.fromBufferAttribute(r,e),0===s.x&&0===s.y&&0===s.z?s.setX(1):s.normalize(),r.setXYZ(e,s.x,s.y,s.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){let r=!1;const s={};0===t.offset.x&&0===t.offset.y||(s.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(s.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(s.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===et?function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function LinearToLinear(e){return e}}Jo.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof CompressedTexture&&(e=decompress(e)),t instanceof CompressedTexture&&(t=decompress(t));const r=e?e.image:null,s=t?t.image:null,o=Math.max(r?r.width:0,s?s.width:0),l=Math.max(r?r.height:0,s?s.height:0),c=getCanvas();c.width=o,c.height=l;const h=c.getContext("2d");h.fillStyle="#00ffff",h.fillRect(0,0,o,l);const d=h.getImageData(0,0,o,l);if(r){h.drawImage(r,0,0,o,l);const t=getEncodingConversion(e),s=h.getImageData(0,0,o,l).data;for(let e=2;e<s.length;e+=4)d.data[e]=256*t(s[e]/256)}if(s){h.drawImage(s,0,0,o,l);const e=getEncodingConversion(t),r=h.getImageData(0,0,o,l).data;for(let t=1;t<r.length;t+=4)d.data[t]=256*e(r[t]/256)}h.putImageData(d,0,0);const p=(e||t).clone();return p.source=new Source(c),p.colorSpace=Ze,p.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&Jo.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),p}processBuffer(e){const t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,s,o){const l=this.json;let c;switch(l.bufferViews||(l.bufferViews=[]),t){case rl:case sl:c=1;break;case al:case ol:c=2;break;default:c=4}const h=getPaddedBufferSize(s*e.itemSize*c),d=new DataView(new ArrayBuffer(h));let p=0;for(let o=r;o<r+s;o++)for(let r=0;r<e.itemSize;r++){let s;e.itemSize>4?s=e.array[o*e.itemSize+r]:(0===r?s=e.getX(o):1===r?s=e.getY(o):2===r?s=e.getZ(o):3===r&&(s=e.getW(o)),!0===e.normalized&&(s=bt.normalize(s,e.array))),t===hl?d.setFloat32(p,s,!0):t===ll?d.setInt32(p,s,!0):t===cl?d.setUint32(p,s,!0):t===al?d.setInt16(p,s,!0):t===ol?d.setUint16(p,s,!0):t===rl?d.setInt8(p,s):t===sl&&d.setUint8(p,s),p+=c}const A={buffer:this.processBuffer(d.buffer),byteOffset:this.byteOffset,byteLength:h};void 0!==o&&(A.target=o),o===ul&&(A.byteStride=e.itemSize*c),this.byteOffset+=h,l.bufferViews.push(A);return{id:l.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(s){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const e=getPaddedArrayBuffer(o.result),l={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,s(r.bufferViews.push(l)-1)}}))}processAccessor(e,t,r,s){const o=this.json;let l;if(e.array.constructor===Float32Array)l=hl;else if(e.array.constructor===Int32Array)l=ll;else if(e.array.constructor===Uint32Array)l=cl;else if(e.array.constructor===Int16Array)l=al;else if(e.array.constructor===Uint16Array)l=ol;else if(e.array.constructor===Int8Array)l=rl;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);l=sl}if(void 0===r&&(r=0),void 0!==s&&s!==1/0||(s=e.count),0===s)return null;const c=function getMinMax(e,t,r){const s={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let o=t;o<t+r;o++)for(let t=0;t<e.itemSize;t++){let r;e.itemSize>4?r=e.array[o*e.itemSize+t]:(0===t?r=e.getX(o):1===t?r=e.getY(o):2===t?r=e.getZ(o):3===t&&(r=e.getW(o)),!0===e.normalized&&(r=bt.normalize(r,e.array))),s.min[t]=Math.min(s.min[t],r),s.max[t]=Math.max(s.max[t],r)}return s}(e,r,s);let h;void 0!==t&&(h=e===t.index?dl:ul);const d=this.processBufferView(e,l,r,s,h),p={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:s,max:c.max,min:c.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(p.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(p)-1}processImage(e,t,r,s="image/png"){if(null!==e){const o=this,l=o.cache,c=o.json,h=o.options,d=o.pending;l.images.has(e)||l.images.set(e,{});const p=l.images.get(e),A=s+":flipY/"+r.toString();if(void 0!==p[A])return p[A];c.images||(c.images=[]);const m={mimeType:s},g=getCanvas();g.width=Math.min(e.width,h.maxTextureSize),g.height=Math.min(e.height,h.maxTextureSize);const f=g.getContext("2d");if(!0===r&&(f.translate(0,g.height),f.scale(1,-1)),void 0!==e.data){t!==be&&Jo.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>h.maxTextureSize||e.height>h.maxTextureSize)&&Jo.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const r=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<r.length;t+=4)r[t+0]=e.data[t+0],r[t+1]=e.data[t+1],r[t+2]=e.data[t+2],r[t+3]=e.data[t+3];f.putImageData(new ImageData(r,e.width,e.height),0,0)}else f.drawImage(e,0,0,g.width,g.height);!0===h.binary?d.push(getToBlobPromise(g,s).then((e=>o.processBufferViewImage(e))).then((e=>{m.bufferView=e}))):void 0!==g.toDataURL?m.uri=g.toDataURL(s):d.push(getToBlobPromise(g,s).then((e=>(new FileReader).readAsDataURL(e))).then((e=>{m.uri=e})));const _=c.images.push(m)-1;return p[A]=_,_}throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:Sl[e.magFilter],minFilter:Sl[e.minFilter],wrapS:Sl[e.wrapS],wrapT:Sl[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const t=this.options,r=this.cache,s=this.json;if(r.textures.has(e))return r.textures.get(e);s.textures||(s.textures=[]),e instanceof CompressedTexture&&(e=decompress(e,t.maxTextureSize));let o=e.userData.mimeType;"image/webp"===o&&(o="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(l.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,l)}));const c=s.textures.push(l)-1;return r.textures.set(e,c),c}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return Jo.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const s={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&Jo.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(equalArray(o,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=.5,s.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),r={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(r,t),s.pbrMetallicRoughness.metallicRoughnessTexture=r}if(e.map){const t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),s.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),s.emissiveTexture=t}}if(e.normalMap){const t={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),s.normalTexture=t}if(e.aoMap){const t={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),s.occlusionTexture=t}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),e.side===m&&(s.doubleSided=!0),""!==e.name&&(s.name=e.name),this.serializeUserData(e,s),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,s)}));const l=r.materials.push(s)-1;return t.materials.set(e,l),l}processMesh(e){const t=this.cache,r=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,r=e.material.length;t<r;t++)s.push(e.material[t].uuid);else s.push(e.material.uuid);const o=s.join(":");if(t.meshes.has(o))return t.meshes.get(o);const l=e.geometry;let c;c=e.isLineSegments?el:e.isLineLoop?tl:e.isLine?il:e.isPoints?Zo:e.material.wireframe?el:nl;const h={},d={},p=[],A=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},g=l.getAttribute("normal");void 0===g||this.isNormalizedNormalAttribute(g)||(Jo.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(g)));let f=null;for(let e in l.attributes){if("morph"===e.slice(0,5))continue;const r=l.attributes[e];e=m[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),t.attributes.has(this.getUID(r))){d[e]=t.attributes.get(this.getUID(r));continue}f=null;const s=r.array;"JOINTS_0"!==e||s instanceof Uint16Array||s instanceof Uint8Array||(Jo.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),f=new three_module_BufferAttribute(new Uint16Array(s),r.itemSize,r.normalized));const o=this.processAccessor(f||r,l);null!==o&&(e.startsWith("_")||this.detectMeshQuantization(e,r),d[e]=o,t.attributes.set(this.getUID(r),o))}if(void 0!==g&&l.setAttribute("normal",g),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const r=[],s=[],o={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)o[e.morphTargetDictionary[t]]=t;for(let c=0;c<e.morphTargetInfluences.length;++c){const h={};let d=!1;for(const e in l.morphAttributes){if("position"!==e&&"normal"!==e){d||(Jo.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),d=!0);continue}const r=l.morphAttributes[e][c],s=e.toUpperCase(),o=l.attributes[e];if(t.attributes.has(this.getUID(r,!0))){h[s]=t.attributes.get(this.getUID(r,!0));continue}const p=r.clone();if(!l.morphTargetsRelative)for(let e=0,t=r.count;e<t;e++)for(let t=0;t<r.itemSize;t++)0===t&&p.setX(e,r.getX(e)-o.getX(e)),1===t&&p.setY(e,r.getY(e)-o.getY(e)),2===t&&p.setZ(e,r.getZ(e)-o.getZ(e)),3===t&&p.setW(e,r.getW(e)-o.getW(e));h[s]=this.processAccessor(p,l),t.attributes.set(this.getUID(o,!0),h[s])}A.push(h),r.push(e.morphTargetInfluences[c]),void 0!==e.morphTargetDictionary&&s.push(o[c])}h.weights=r,s.length>0&&(h.extras={},h.extras.targetNames=s)}const _=Array.isArray(e.material);if(_&&0===l.groups.length)return null;let E=!1;if(_&&null===l.index){const e=[];for(let t=0,r=l.attributes.position.count;t<r;t++)e[t]=t;l.setIndex(e),E=!0}const y=_?e.material:[e.material],x=_?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,r=x.length;e<r;e++){const r={mode:c,attributes:d};if(this.serializeUserData(l,r),A.length>0&&(r.targets=A),null!==l.index){let s=this.getUID(l.index);void 0===x[e].start&&void 0===x[e].count||(s+=":"+x[e].start+":"+x[e].count),t.attributes.has(s)?r.indices=t.attributes.get(s):(r.indices=this.processAccessor(l.index,l,x[e].start,x[e].count),t.attributes.set(s,r.indices)),null===r.indices&&delete r.indices}const s=this.processMaterial(y[x[e].materialIndex]);null!==s&&(r.material=s),p.push(r)}!0===E&&l.setIndex(null),h.primitives=p,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,h)}));const S=r.meshes.push(h)-1;return t.meshes.set(o,S),S}detectMeshQuantization(e,t){if(this.extensionsUsed[xl])return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const s=e.split("_",1)[0];$o[s]&&$o[s].includes(r)&&(this.extensionsUsed[xl]=!0,this.extensionsRequired[xl]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,s={type:r?"orthographic":"perspective"};return r?s.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:s.perspective={aspectRatio:e.aspect,yfov:bt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(s.name=e.type),t.cameras.push(s)-1}processAnimation(e,t){const r=this.json,s=this.nodeMap;r.animations||(r.animations=[]);const o=(e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,l=[],c=[];for(let e=0;e<o.length;++e){const r=o[e],h=PropertyBinding.parseTrackName(r.name);let d=PropertyBinding.findNode(t,h.nodeName);const p=Ml[h.propertyName];if("bones"===h.objectName&&(d=!0===d.isSkinnedMesh?d.skeleton.getBoneByName(h.objectIndex):void 0),!d||!p)return Jo.warn('THREE.GLTFExporter: Could not export animation track "%s".',r.name),null;const A=1;let m,g=r.values.length/r.times.length;p===Ml.morphTargetInfluences&&(g/=d.morphTargetInfluences.length),!0===r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(m="CUBICSPLINE",g/=3):m=r.getInterpolation()===We?"STEP":"LINEAR",c.push({input:this.processAccessor(new three_module_BufferAttribute(r.times,A)),output:this.processAccessor(new three_module_BufferAttribute(r.values,g)),interpolation:m}),l.push({sampler:c.length-1,target:{node:s.get(d),path:p}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:c,channels:l}),r.animations.length-1}processSkin(e){const t=this.json,r=this.nodeMap,s=t.nodes[r.get(e)],o=e.skeleton;if(void 0===o)return null;const l=e.skeleton.bones[0];if(void 0===l)return null;const c=[],h=new Float32Array(16*o.bones.length),d=new three_module_Matrix4;for(let t=0;t<o.bones.length;++t)c.push(r.get(o.bones[t])),d.copy(o.boneInverses[t]),d.multiply(e.bindMatrix).toArray(h,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new three_module_BufferAttribute(h,16)),joints:c,skeleton:r.get(l)});return s.skin=t.skins.length-1}processNode(e){const t=this.json,r=this.options,s=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(r.trs){const t=e.quaternion.toArray(),r=e.position.toArray(),s=e.scale.toArray();equalArray(t,[0,0,0,1])||(o.rotation=t),equalArray(r,[0,0,0])||(o.translation=r),equalArray(s,[1,1,1])||(o.scale=s)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===function isIdentityMatrix(e){return equalArray(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}(e.matrix)&&(o.matrix=e.matrix.elements);if(""!==e.name&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints){const t=this.processMesh(e);null!==t&&(o.mesh=t)}else e.isCamera&&(o.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const t=[];for(let s=0,o=e.children.length;s<o;s++){const o=e.children[s];if(o.visible||!1===r.onlyVisible){const e=this.processNode(o);null!==e&&t.push(e)}}t.length>0&&(o.children=t)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,o)}));const l=t.nodes.push(o)-1;return s.set(e,l),l}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};""!==e.name&&(s.name=e.name),t.scenes.push(s);const o=[];for(let t=0,s=e.children.length;t<s;t++){const s=e.children[t];if(s.visible||!1===r.onlyVisible){const e=this.processNode(s);null!==e&&o.push(e)}}o.length>0&&(s.nodes=o),this.serializeUserData(e,s)}processObjects(e){const t=new Scene;t.name="AuxScene";for(let r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)}));const r=[];for(let t=0;t<e.length;t++)e[t]instanceof Scene?this.processScene(e[t]):r.push(e[t]);r.length>0&&this.processObjects(r);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let r=0;r<t.animations.length;++r)this.processAnimation(t.animations[r],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(let t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}class GLTFLightExtension{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void Jo.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const r=this.writer,s=r.json,o=r.extensionsUsed,l={};e.name&&(l.name=e.name),l.color=e.color.toArray(),l.intensity=e.intensity,e.isDirectionalLight?l.type="directional":e.isPointLight?(l.type="point",e.distance>0&&(l.range=e.distance)):e.isSpotLight&&(l.type="spot",e.distance>0&&(l.range=e.distance),l.spot={},l.spot.innerConeAngle=(1-e.penumbra)*e.angle,l.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&Jo.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||Jo.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},o[this.name]=!0);const c=s.extensions[this.name].lights;c.push(l),t.extensions=t.extensions||{},t.extensions[this.name]={light:c.length-1}}}class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class GLTFExporter_GLTFMaterialsClearcoatExtension{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(t,e.clearcoatMap),o.clearcoatTexture=t}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(t,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};r.applyTextureTransform(t,e.clearcoatNormalMap),o.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIridescenceExtension{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(t,e.iridescenceMap),o.iridescenceTexture=t}if(o.iridescenceIor=e.iridescenceIOR,o.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],o.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const t={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(t,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsTransmissionExtension{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const t={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(t,e.transmissionMap),o.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsVolumeExtension{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const t={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(t,e.thicknessMap),o.thicknessTexture=t}o.attenuationDistance=e.attenuationDistance,o.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIorExtension{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;const r=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsSpecularExtension{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(Cl)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.specularIntensityMap){const t={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(t,e.specularIntensityMap),o.specularTexture=t}if(e.specularColorMap){const t={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(t,e.specularColorMap),o.specularColorTexture=t}o.specularFactor=e.specularIntensity,o.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsSheenExtension{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.sheenRoughnessMap){const t={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(t,e.sheenRoughnessMap),o.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(t,e.sheenColorMap),o.sheenColorTexture=t}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsAnisotropyExtension{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.anisotropyMap){const t={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(t,e.anisotropyMap),o.anisotropyTexture=t}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;const r=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsBumpExtension{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.bumpMap){const t={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(t,e.bumpMap),o.bumpTexture=t}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMeshGpuInstancing{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,s=e,o=new Float32Array(3*s.count),l=new Float32Array(4*s.count),c=new Float32Array(3*s.count),h=new three_module_Matrix4,d=new three_module_Vector3,p=new three_module_Quaternion,A=new three_module_Vector3;for(let e=0;e<s.count;e++)s.getMatrixAt(e,h),h.decompose(d,p,A),d.toArray(o,3*e),p.toArray(l,4*e),A.toArray(c,3*e);const m={TRANSLATION:r.processAccessor(new three_module_BufferAttribute(o,3)),ROTATION:r.processAccessor(new three_module_BufferAttribute(l,4)),SCALE:r.processAccessor(new three_module_BufferAttribute(c,3))};s.instanceColor&&(m._COLOR_0=r.processAccessor(s.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:m},r.extensionsUsed[this.name]=!0,r.extensionsRequired[this.name]=!0}}GLTFExporter.Utils={insertKeyframe:function(e,t){const r=.001,s=e.getValueSize(),o=new e.TimeBufferType(e.times.length+1),l=new e.ValueBufferType(e.values.length+s),c=e.createInterpolant(new e.ValueBufferType(s));let h;if(0===e.times.length){o[0]=t;for(let e=0;e<s;e++)l[e]=0;h=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<r)return 0;o[0]=t,o.set(e.times,1),l.set(c.evaluate(t),0),l.set(e.values,s),h=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<r)return e.times.length-1;o[o.length-1]=t,o.set(e.times,0),l.set(e.values,0),l.set(c.evaluate(t),e.values.length),h=o.length-1}else for(let d=0;d<e.times.length;d++){if(Math.abs(e.times[d]-t)<r)return d;if(e.times[d]<t&&e.times[d+1]>t){o.set(e.times.slice(0,d+1),0),o[d+1]=t,o.set(e.times.slice(d+1),d+2),l.set(e.values.slice(0,(d+1)*s),0),l.set(c.evaluate(t),(d+1)*s),l.set(e.values.slice((d+1)*s),(d+2)*s),h=d+1;break}}return e.times=o,e.values=l,h},mergeMorphTargetTracks:function(e,t){const r=[],s={},o=e.tracks;for(let e=0;e<o.length;++e){let l=o[e];const c=PropertyBinding.parseTrackName(l.name),h=PropertyBinding.findNode(t,c.nodeName);if("morphTargetInfluences"!==c.propertyName||void 0===c.propertyIndex){r.push(l);continue}if(l.createInterpolant!==l.InterpolantFactoryMethodDiscrete&&l.createInterpolant!==l.InterpolantFactoryMethodLinear){if(l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");Jo.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),l=l.clone(),l.setInterpolation(qe)}const d=h.morphTargetInfluences.length,p=h.morphTargetDictionary[c.propertyIndex];if(void 0===p)throw new Error("THREE.GLTFExporter: Morph target name not found: "+c.propertyIndex);let A;if(void 0===s[h.uuid]){A=l.clone();const e=new A.ValueBufferType(d*A.times.length);for(let t=0;t<A.times.length;t++)e[t*d+p]=A.values[t];A.name=(c.nodeName||"")+".morphTargetInfluences",A.values=e,s[h.uuid]=A,r.push(A);continue}const m=l.createInterpolant(new l.ValueBufferType(1));A=s[h.uuid];for(let e=0;e<A.times.length;e++)A.values[e*d+p]=m.evaluate(A.times[e]);for(let e=0;e<l.times.length;e++){const t=this.insertKeyframe(A,l.times[e]);A.values[t*d+p]=l.values[e]}}return e.tracks=r,e}};const compatibleObject=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter((e=>compatibleMaterial(e.material))),compatibleMaterial=e=>e&&e.isMaterial&&!Array.isArray(e);class GLTFExporterMaterialsVariantsExtension{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set;for(const r of e)r.traverse((e=>{if(!compatibleObject(e))return;const r=e.userData.variantMaterials,s=e.userData.variantData;for(const[e,o]of s){const s=r.get(o.index);s&&compatibleMaterial(s.material)&&t.add(e)}}));t.forEach((e=>this.variantNames.push(e)))}writeMesh(e,t){if(!compatibleObject(e))return;const r=e.userData,s=r.variantMaterials,o=r.variantData,l=new Map,c=new Map,h=Array.from(o.values()).sort(((e,t)=>e.index-t.index));for(const[e,t]of h.entries())c.set(t.index,e);for(const e of o.values()){const t=s.get(e.index);if(!t||!compatibleMaterial(t.material))continue;const r=this.writer.processMaterial(t.material);l.has(r)||l.set(r,{material:r,variants:[]}),l.get(r).variants.push(c.get(e.index))}const d=Array.from(l.values()).map((e=>e.variants.sort(((e,t)=>e-t))&&e)).sort(((e,t)=>e.material-t.material));if(0===d.length)return;const p=compatibleMaterial(r.originalMaterial)?this.writer.processMaterial(r.originalMaterial):-1;for(const e of t.primitives)p>=0&&(e.material=p),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:d}}afterParse(){if(0===this.variantNames.length)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map((e=>({name:e})));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class SessionLightProbe{constructor(e,t,r,s,o){this.xrLight=e,this.renderer=t,this.lightProbe=r,this.xrWebGLBinding=null,this.estimationStartCallback=o,this.frameCallback=this.onXRFrame.bind(this);const l=t.xr.getSession();if(s&&"XRWebGLBinding"in window){const r=new WebGLCubeRenderTarget(16);e.environment=r.texture;const s=t.getContext();switch(l.preferredReflectionFormat){case"srgba8":s.getExtension("EXT_sRGB");break;case"rgba16f":s.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(l,s),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}l.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const r=t.getLightEstimate(this.lightProbe);if(r){this.xrLight.lightProbe.sh.fromArray(r.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(r.primaryLightIntensity.x,Math.max(r.primaryLightIntensity.y,r.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(r.primaryLightIntensity.x/e,r.primaryLightIntensity.y/e,r.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(r.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class XREstimatedLight extends three_module_Group{constructor(e,t=!0){super(),this.lightProbe=new LightProbe,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new DirectionalLight,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let r=null,s=!1;e.xr.addEventListener("sessionstart",(()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then((o=>{r=new SessionLightProbe(this,e,o,t,(()=>{s=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),e.xr.addEventListener("sessionend",(()=>{r&&(r.dispose(),r=null),s&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{r&&(r.dispose(),r=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class Damper{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,r,s){const o=2e-4*this.naturalFrequency;if(null==e||0===s)return t;if(e===t&&0===this.velocity)return t;if(r<0)return e;const l=e-t,c=this.velocity+this.naturalFrequency*l,h=l+r*c,d=Math.exp(-this.naturalFrequency*r),p=(c-this.naturalFrequency*h)*d,A=-this.naturalFrequency*(p+c*d);return Math.abs(p)<o*Math.abs(s)&&A*l>=0?(this.velocity=0,t):(this.velocity=p,t+h*d)}}const bl=.2,Il=Math.PI/24,wl=new Vector2,addCorner=(e,t,r)=>{let s=t>0?r>0?0:-Math.PI/2:r>0?Math.PI/2:Math.PI;for(let o=0;o<=12;++o)e.push(t+.17*Math.cos(s),r+.17*Math.sin(s),0,t+bl*Math.cos(s),r+bl*Math.sin(s),0),s+=Il};class PlacementBox extends three_module_Mesh{constructor(e,t){const r=new three_module_BufferGeometry,s=[],o=[],{size:l,boundingBox:c}=e,h=l.x/2,d=("back"===t?l.y:l.z)/2;addCorner(o,h,d),addCorner(o,-h,d),addCorner(o,-h,-d),addCorner(o,h,-d);const p=o.length/3;for(let e=0;e<p-2;e+=2)s.push(e,e+1,e+3,e,e+3,e+2);const A=p-2;s.push(A,A+1,1,A,1,0),r.setAttribute("position",new three_module_Float32BufferAttribute(o,3)),r.setIndex(s),super(r),this.side=t;const g=this.material;switch(g.side=m,g.transparent=!0,g.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new three_module_Mesh(new PlaneGeometry(2*(h+bl),2*(d+bl))),this.hitPlane.visible=!1,this.hitPlane.material.side=m,this.add(this.hitPlane),c.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=c.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=c.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,r){wl.set(t,-r),this.hitPlane.visible=!0;const s=e.positionAndNormalFromPoint(wl,this.hitPlane);return this.hitPlane.visible=!1,null==s?null:s.position}getExpandedHit(e,t,r){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const s=this.getHit(e,t,r);return this.hitPlane.scale.set(1,1,1),s}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?.75:0}updateOpacity(e){const t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){var e;const{geometry:t,material:r}=this.hitPlane;t.dispose(),r.dispose(),this.geometry.dispose(),this.material.dispose(),null===(e=this.parent)||void 0===e||e.remove(this)}}const numberNode=(e,t)=>({type:"number",number:e,unit:t}),Tl=(()=>{const e={};return t=>{const r=t;if(r in e)return e[r];const s=[];let o=0;for(;t;){if(++o>1e3){t="";break}const e=Bl(t),r=e.nodes[0];if(null==r||0===r.terms.length)break;s.push(r),t=e.remainingInput}return e[r]=s}})(),Bl=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,r=/^[\),]/;return s=>{const o=[];for(;s.length&&(s=s.trim(),!r.test(s));)if("("===s[0]){const{nodes:e,remainingInput:t}=parseFunctionArguments(s);s=t,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(s)){const e=Rl(s),t=e.nodes[0];if("("===(s=e.remainingInput)[0]){const{nodes:e,remainingInput:r}=parseFunctionArguments(s);o.push({type:"function",name:t,arguments:e}),s=r}else o.push(t)}else if(t.test(s))o.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:e,remainingInput:t}="#"===s[0]?Dl(s):Ll(s);if(0===e.length)break;o.push(e[0]),s=t}return{nodes:[{type:"expression",terms:o}],remainingInput:s}}})(),Rl=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const r=t.match(e);return{nodes:[{type:"ident",value:null==r?t:t.substr(0,r.index)}],remainingInput:null==r?"":t.substr(r.index)}}})(),Ll=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,r=/^(m|mm|cm|rad|deg|[%])$/;return s=>{const o=s.match(e),l=null==o?"0":o[0],c=(s=null==l?s:s.slice(l.length)).match(t);let h=null!=c&&""!==c[0]?c[0]:null;const d=null==c?s:s.slice(h.length);return null==h||r.test(h)||(h=null),{nodes:[{type:"number",number:parseFloat(l)||0,unit:h}],remainingInput:d}}})(),Dl=(()=>{const e=/^[a-f0-9]*/i;return t=>{const r=(t=t.slice(1).trim()).match(e);return{nodes:null==r?[]:[{type:"hex",value:r[0]}],remainingInput:null==r?t:t.slice(r[0].length)}}})(),parseFunctionArguments=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const r=Bl(e);if(t.push(r.nodes[0]),","===(e=r.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},Ul=Symbol("visitedTypes");class ASTWalker{constructor(e){this[Ul]=e}walk(e,t){const r=e.slice();for(;r.length;){const e=r.shift();switch(this[Ul].indexOf(e.type)>-1&&t(e),e.type){case"expression":r.unshift(...e.terms);break;case"function":r.unshift(e.name,...e.arguments)}}}}const Pl=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:r,unit:s}=e;if(isFinite(r)){if("rad"===e.unit||null==e.unit)return e}else r=t,s="rad";return{type:"number",number:("deg"===s&&null!=r?r:0)*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let r,{number:s,unit:o}=e;if(isFinite(s)){if("m"===e.unit)return e}else s=t,o="m";switch(o){default:r=1;break;case"cm":r=.01;break;case"mm":r=.001}return{type:"number",number:r*s,unit:"m"}},Fl=(()=>{const identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,r=Pl)=>{isFinite(t.number)||(t.number=r.number,t.unit=r.unit);const{unit:s}=t;if(null==s)return t;const o=e[s];return null==o?r:o(t)}})();var Nl,Ql,Ol;const Gl=Symbol("evaluate"),kl=Symbol("lastValue");class Evaluator{constructor(){this[Nl]=null}static evaluatableFor(e,t=Pl){if(e instanceof Evaluator)return e;if("number"===e.type)return"%"===e.unit?new PercentageEvaluator(e,t):e;switch(e.name.value){case"calc":return new CalcEvaluator(e,t);case"env":return new EnvEvaluator(e)}return Pl}static evaluate(e){return e instanceof Evaluator?e.evaluate():e}static isConstant(e){return!(e instanceof Evaluator)||e.isConstant}static applyIntrinsics(e,t){const{basis:r,keywords:s}=t,{auto:o}=s;return r.map(((t,r)=>{const l=null==o[r]?t:o[r];let c=e[r]?e[r]:l;if("ident"===c.type){const e=c.value;e in s&&(c=s[e][r])}return null!=c&&"ident"!==c.type||(c=l),"%"===c.unit?numberNode(c.number/100*t.number,t.unit):(c=Fl(c,t),c.unit!==t.unit?t:c)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[kl]||(this[kl]=this[Gl]()),this[kl]}}Nl=kl;const Vl=Symbol("percentage"),Hl=Symbol("basis");class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[Vl]=e,this[Hl]=t}get isConstant(){return!0}[Gl](){return numberNode(this[Vl].number/100*this[Hl].number,this[Hl].unit)}}const zl=Symbol("identNode");class EnvEvaluator extends Evaluator{constructor(e){super(),this[Ql]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[zl]=t)}get isConstant(){return!1}[(Ql=zl,Gl)](){if(null!=this[zl]&&"window-scroll-y"===this[zl].value){return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Pl}}const Wl=/[\*\/]/,ql=Symbol("evaluator");class CalcEvaluator extends Evaluator{constructor(e,t=Pl){if(super(),this[Ol]=null,1!==e.arguments.length)return;const r=e.arguments[0].terms.slice(),s=[];for(;r.length;){const e=r.shift();if(s.length>0){const r=s[s.length-1];if("operator"===r.type&&Wl.test(r.value)){const r=s.pop(),o=s.pop();if(null==o)return;s.push(new OperatorEvaluator(r,Evaluator.evaluatableFor(o,t),Evaluator.evaluatableFor(e,t)));continue}}s.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;s.length>2;){const[e,r,o]=s.splice(0,3);if("operator"!==r.type)return;s.unshift(new OperatorEvaluator(r,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(o,t)))}1===s.length&&(this[ql]=s[0])}get isConstant(){return null==this[ql]||Evaluator.isConstant(this[ql])}[(Ol=ql,Gl)](){return null!=this[ql]?Evaluator.evaluate(this[ql]):Pl}}const Xl=Symbol("operator"),jl=Symbol("left"),Yl=Symbol("right");class OperatorEvaluator extends Evaluator{constructor(e,t,r){super(),this[Xl]=e,this[jl]=t,this[Yl]=r}get isConstant(){return Evaluator.isConstant(this[jl])&&Evaluator.isConstant(this[Yl])}[Gl](){const e=Fl(Evaluator.evaluate(this[jl])),t=Fl(Evaluator.evaluate(this[Yl])),{number:r,unit:s}=e,{number:o,unit:l}=t;if(null!=l&&null!=s&&l!=s)return Pl;const c=s||l;let h;switch(this[Xl].value){case"+":h=r+o;break;case"-":h=r-o;break;case"/":h=r/o;break;case"*":h=r*o;break;default:return Pl}return{type:"number",number:h,unit:c}}}const Kl=Symbol("evaluatables"),Jl=Symbol("intrinsics");class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[Jl]=t;const r=e[0],s=null!=r?r.terms:[];this[Kl]=t.basis.map(((e,t)=>{const r=s[t];return null==r?{type:"ident",value:"auto"}:"ident"===r.type?r:Evaluator.evaluatableFor(r,e)}))}get isConstant(){for(const e of this[Kl])if(!Evaluator.isConstant(e))return!1;return!0}[Gl](){const e=this[Kl].map((e=>Evaluator.evaluate(e)));return Evaluator.applyIntrinsics(e,this[Jl]).map((e=>e.number))}}var $l,Zl,ec,tc;const ic=Symbol("instances"),nc=Symbol("activateListener"),rc=Symbol("deactivateListener"),sc=Symbol("notifyInstances"),ac=Symbol("notify"),oc=Symbol("callback");class ScrollObserver{constructor(e){this[oc]=e}static[sc](){for(const e of ScrollObserver[ic])e[ac]()}static[($l=ic,nc)](){window.addEventListener("scroll",this[sc],{passive:!0})}static[rc](){window.removeEventListener("scroll",this[sc])}observe(){0===ScrollObserver[ic].size&&ScrollObserver[nc](),ScrollObserver[ic].add(this)}disconnect(){ScrollObserver[ic].delete(this),0===ScrollObserver[ic].size&&ScrollObserver[rc]()}[ac](){this[oc]()}}ScrollObserver[$l]=new Set;const cc=Symbol("computeStyleCallback"),hc=Symbol("astWalker"),uc=Symbol("dependencies"),dc=Symbol("onScroll");class StyleEffector{constructor(e){this[Zl]={},this[ec]=new ASTWalker(["function"]),this[tc]=()=>{this[cc]({relatedState:"window-scroll"})},this[cc]=e}observeEffectsFor(e){const t={},r=this[uc];this[hc].walk(e,(e=>{const{name:s}=e,o=e.arguments[0].terms[0];if("env"===s.value&&null!=o&&"ident"===o.type&&"window-scroll-y"===o.value)if(null==t["window-scroll"]){const e="window-scroll"in r?r["window-scroll"]:new ScrollObserver(this[dc]);e.observe(),delete r["window-scroll"],t["window-scroll"]=e}}));for(const e in r){r[e].disconnect()}this[uc]=t}dispose(){for(const e in this[uc]){this[uc][e].disconnect()}}}Zl=uc,ec=hc,tc=dc;const style=e=>{const t=e.observeEffects||!1,r=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(s,o)=>{const l=s.updated,c=s.connectedCallback,h=s.disconnectedCallback,d=Symbol(`${o}StyleEffector`),p=Symbol(`${o}StyleEvaluator`),A=Symbol(`${o}UpdateEvaluator`),m=Symbol(`${o}EvaluateAndSync`);Object.defineProperties(s,{[d]:{value:null,writable:!0},[p]:{value:null,writable:!0},[A]:{value:function(){const e=Tl(this[o]);this[p]=new StyleEvaluator(e,r(this)),null==this[d]&&t&&(this[d]=new StyleEffector((()=>this[m]()))),null!=this[d]&&this[d].observeEffectsFor(e)}},[m]:{value:function(){if(null==this[p])return;const t=this[p].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(o)&&(this[A](),this[m]()),l.call(this,e)}},connectedCallback:{value:function(){c.call(this),this.requestUpdate(o,this[o])}},disconnectedCallback:{value:function(){h.call(this),null!=this[d]&&(this[d].dispose(),this[d]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:(4-2*e)*e-1,interpolate=(e,t,r=easeInOutQuad)=>s=>e+(t-e)*r(s),timeline=e=>{const t=[],r=[];let s=e.initialValue;for(let o=0;o<e.keyframes.length;++o){const l=e.keyframes[o],{value:c,frames:h}=l,d=l.ease||easeInOutQuad,p=interpolate(s,c,d);t.push(p),r.push(h),s=c}return((e,t)=>{const r=t.map((s=0,e=>s+=e));var s;return t=>{t=utilities_clamp(t,0,1),t*=r[r.length-1];const s=r.findIndex((e=>e>=t)),o=s<1?0:r[s-1],l=r[s];return e[s]((t-o)/(l-o))}})(t,r)};var pc=r(93e3),controls_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Ac=timeline({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),mc=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),gc="0deg 75deg 105%",fc=["front","right","back","left"],_c=["upper-","","lower-"],vc="auto",Ec="basic",yc="wiggle",xc="none",fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),Sc=(()=>{const e=Tl(gc)[0].terms,t=Fl(e[0]),r=Fl(e[1]);return e=>{const s=e[mp].idealCameraDistance();return{basis:[t,r,numberNode(s,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{const t=2.2*e[mp].boundingSphere.radius;return{basis:[numberNode(-1/0,"rad"),numberNode(Math.PI/8,"rad"),numberNode(t,"m")],keywords:{auto:[null,null,null]}}},maxCameraOrbitIntrinsics=e=>{const t=Sc(e),r=new StyleEvaluator([],t).evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(r,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{const t=e[mp].boundingBox.getCenter(new three_module_Vector3);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},Mc=Math.PI/2,Cc=Math.PI/3,bc=Mc/2,Ic=2*Math.PI,wc=Symbol("controls"),Tc=Symbol("panElement"),Bc=Symbol("promptElement"),Rc=Symbol("promptAnimatedContainer"),Lc=Symbol("fingerAnimatedContainers"),Dc=Symbol("deferInteractionPrompt"),Uc=Symbol("updateAria"),Pc=Symbol("updateCameraForRadius"),Fc=Symbol("cancelPrompts"),Nc=Symbol("onChange"),Qc=Symbol("onPointerChange"),Oc=Symbol("waitingToPromptUser"),Gc=Symbol("userHasInteracted"),kc=Symbol("promptElementVisibleTime"),Vc=Symbol("lastPromptOffset"),Hc=Symbol("cancellationSource"),zc=Symbol("lastSpherical"),Wc=Symbol("jumpCamera"),qc=Symbol("initialized"),Xc=Symbol("maintainThetaPhi"),jc=Symbol("syncCameraOrbit"),Yc=Symbol("syncFieldOfView"),Kc=Symbol("syncCameraTarget"),Jc=Symbol("syncMinCameraOrbit"),$c=Symbol("syncMaxCameraOrbit"),Zc=Symbol("syncMinFieldOfView"),eh=Symbol("syncMaxFieldOfView"),th=new Vector2,ih=new three_module_Vector3,nh=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),rh=Math.PI/8,sh=.04,ah={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class SmoothControls extends EventDispatcher{constructor(e,t,r){super(),this.camera=e,this.element=t,this.scene=r,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=ah.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new Matrix3,this.panPerPixel=0,this.spherical=new Spherical,this.goalSpherical=new Spherical,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(nh.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Damper,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){const e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=sh*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{const{touchAction:r}=this._options;if(!this.touchDecided&&"none"!==r){this.touchDecided=!0;const s=Math.abs(e),o=Math.abs(t);if(this.changeSource===ah.USER_INTERACTION&&("pan-y"===r&&o>s||"pan-x"===r&&s>o))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?ah.AUTOMATIC:ah.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=ah.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===ah.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{const t=this.pointers.find((t=>t.id===e.pointerId));if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const r=this.pointers.length,s=(e.clientX-t.clientX)/r,o=(e.clientY-t.clientY)/r;0===s&&0===o||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?ah.AUTOMATIC:ah.USER_INTERACTION,null!==this.touchMode&&this.touchMode(s,o)):(this.changeSource=ah.USER_INTERACTION,this.panPerPixel>0?this.movePan(s,o):this.handleSinglePointerMove(s,o)))},this.onPointerUp=e=>{const{element:t}=this,r=this.pointers.findIndex((t=>t.id===e.pointerId));-1!==r&&this.pointers.splice(r,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[Tc].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=ah.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*sh*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=ah.USER_INTERACTION;(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},nh),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",(()=>{}),{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new Spherical){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,r=this.goalSpherical.radius){const{minimumAzimuthalAngle:s,maximumAzimuthalAngle:o,minimumPolarAngle:l,maximumPolarAngle:c,minimumRadius:h,maximumRadius:d}=this._options,{theta:p,phi:A,radius:m}=this.goalSpherical,g=utilities_clamp(e,s,o);isFinite(s)||isFinite(o)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-g)+g);const f=utilities_clamp(t,l,c),_=utilities_clamp(r,h,d);return(g!==p||f!==A||_!==m)&&(!!(isFinite(g)&&isFinite(f)&&isFinite(_))&&(this.goalSpherical.theta=g,this.goalSpherical.phi=f,this.goalSpherical.radius=_,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:r}=this._options;e=utilities_clamp(e,t,r),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,r){const{theta:s,phi:o,radius:l}=this.goalSpherical,{minimumRadius:c,maximumRadius:h,minimumFieldOfView:d,maximumFieldOfView:p}=this._options,A=this.spherical.theta-s,m=Math.PI-.001,g=s-utilities_clamp(e,-m-A,m-A),f=o-t,_=0===r?0:((r>0?h:c)-l)/(Math.log(r>0?p:d)-this.goalLogFov),E=l+r*(isFinite(_)?_:2*(h-c));if(this.setOrbit(g,f,E),0!==r){const e=this.goalLogFov+r;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:r,maximumRadius:s}=this._options,o=this.spherical.theta-this.goalSpherical.theta;return Math.abs(o)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(o)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,r),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,s),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new Euler(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(e,t,r){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,r*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:r,clientY:s}=e,{clientX:o,clientY:l}=t,c=o-r,h=l-s;return Math.sqrt(c*c+h*h)}handleSinglePointerMove(e,t){const r=this.pixelLengthToSphericalAngle(e),s=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(r,s,0)}initializePan(){const{theta:e,phi:t}=this.spherical,r=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(r),-Math.cos(t)*Math.sin(r),0,0,Math.sin(t),0,Math.sin(r),-Math.cos(t)*Math.cos(r),0)}movePan(e,t){const{scene:r}=this,s=ih.set(e,t,0).multiplyScalar(this.inputSensitivity),o=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;s.multiplyScalar(o);const l=r.getTarget();l.add(s.applyMatrix3(this.panProjection)),r.boundingSphere.clampPoint(l,l),r.setTarget(l.x,l.y,l.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;const{scene:t}=this,r=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==r){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(r.position),t.setTarget(r.position.x,r.position.y,r.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(th.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const r=e.getTarget(),{theta:s,phi:o}=this.spherical,l=s-e.yaw,c=ih.set(Math.sin(o)*Math.sin(l),Math.cos(o),Math.sin(o)*Math.cos(l)),h=c.dot(t.position.sub(r));r.add(c.multiplyScalar(h)),e.setTarget(r.x,r.y,r.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-h)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[Tc].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[Tc].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,sh*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-rh,0);break;case"ArrowDown":this.userAdjustOrbit(0,rh,0);break;case"ArrowLeft":this.userAdjustOrbit(-rh,0,0);break;case"ArrowRight":this.userAdjustOrbit(rh,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}}var oh=r(93e3);const lh=1/1.3,ch="not-presenting",hh="session-started",uh="object-placed",dh="failed",ph="tracking",Ah="not-tracking",mh=new three_module_Vector3,gh=new three_module_Matrix4,fh=new three_module_Vector3,_h=new PerspectiveCamera(45,1,.1,100);class ARRenderer extends EventDispatcher{constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new three_module_Vector3,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new three_module_Vector3,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new three_module_Vector3,this.goalYaw=0,this.goalScale=1,this.xDamper=new Damper,this.yDamper=new Damper,this.zDamper=new Damper,this.yawDamper=new Damper,this.scaleDamper=new Damper,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new PlacementBox(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=e=>{const t=this.transientHitTestSource;if(null==t)return;const r=this.frame.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=this.placementBox;if(1===r.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,r=o.getHit(this.presentedScene,t[0],t[1]);o.show=!0,null!=r?(this.isTranslating=!0,this.lastDragPosition.copy(r)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===r.length){o.show=!0,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/s.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){assertIsArCandidate();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return assertIsArCandidate(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return oh.warn("Request to present in WebXR denied:"),oh.warn(e),oh.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&oh.warn("Cannot present while a model is already presenting");let r=new Promise(((e,t)=>{requestAnimationFrame((()=>e()))}));e.setHotspotsVisibility(!1),e.queueRender(),await r,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new XREstimatedLight(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment})));const s=await this.resolveARSession();s.addEventListener("end",(()=>{this.postSessionCleanup()}),{once:!0});const o=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");o.classList.add("enabled"),o.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=o;const l=await s.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const c=20*Math.PI/180,h=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(c),z:-Math.cos(c)});s.requestHitTestSource({space:l,offsetRay:h}).then((e=>{this.initialHitSource=e})),this.currentSession=s,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:hh})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise((e=>{this.resolveCleanup=e}));try{await this.currentSession.end(),await e}catch(e){oh.warn("Error while trying to end WebXR AR session"),oh.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(null!=e){const t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}postSessionCleanup(){const e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,null!=t){const{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),t.position.set(0,0,0),t.scale.set(1,1,1),t.setShadowOffset(0);const r=this.turntableRotation;null!=r&&(t.yaw=r);const s=this.oldShadowIntensity;null!=s&&t.setShadowIntensity(s),t.setEnvironmentAndSkybox(e[ma],e[ga]);const o=this.oldTarget;t.setTarget(o.x,o.y,o.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),e.requestUpdate("cameraTarget"),e.requestUpdate("maxCameraOrbit"),e[vp](e.getBoundingClientRect()),requestAnimationFrame((()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:ah.NONE}}))}))}this.renderer.height=0;const r=this.exitWebXRButtonContainer;null!=r&&(r.classList.remove("enabled"),r.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const s=this.transientHitTestSource;null!=s&&(s.cancel(),this.transientHitTestSource=null);const o=this.initialHitSource;null!=o&&(o.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:ch})}updateView(e){const t=this.presentedScene,r=this.threeRenderer.xr;r.updateCamera(_h),t.xrCamera=r.getCamera();const{elements:s}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(s[1],s[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const o=r.getBaseLayer();if(null!=o){const t=o instanceof XRWebGLLayer?o.getViewport(e):r.getBinding().getViewSubImage(o,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:r}=e,s=e.getCamera(),{width:o,height:l}=this.overlay.getBoundingClientRect();e.setSize(o,l),s.projectionMatrixInverse.copy(s.projectionMatrix).invert();const{theta:c,radius:h}=r.getCameraOrbit(),d=s.getWorldDirection(mh);e.yaw=Math.atan2(-d.x,-d.z)-c,this.goalYaw=e.yaw,t.copy(s.position).add(d.multiplyScalar(h)),this.updateTarget();const p=e.getTarget();t.add(p).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:A}=this.frame;A.addEventListener("selectstart",this.onSelectStart),A.addEventListener("selectend",this.onSelectEnd),A.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e}))}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(mh.copy(t).sub(this.presentedScene.getCamera().position),mh.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),r=e.getPose(t);if(null==r)return null;const s=gh.fromArray(r.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(s.elements[4],s.elements[6])),s.elements[5]>.75!==this.placeOnWall?fh.setFromMatrixPosition(s):null}moveToFloor(e){const t=this.initialHitSource;if(null==t)return;const r=e.getHitTestResults(t);if(0==r.length)return;const s=r[0],o=this.getHitPoint(s);null!=o&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(o):this.goalPosition.y=o.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:uh}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,r=e[1].inputSource.gamepad.axes,s=r[0]-t[0],o=r[1]-t[1],l=Math.atan2(o,s);let c=this.lastAngle-l;return c>Math.PI?c-=2*Math.PI:c<-Math.PI&&(c+=2*Math.PI),this.lastAngle=l,{separation:Math.sqrt(s*s+o*o),deltaYaw:c}}processInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const r=e.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=s.scale.x;if(this.isTwoFingering)if(r.length<2)this.isTwoFingering=!1;else{const{separation:e,deltaYaw:t}=this.fingerPolar(r);if(!1===this.placeOnWall&&(this.goalYaw+=t),s.canScale){const t=e/this.firstRatio;this.goalScale=t<1.3&&t>lh?1:t}}else if(2!==r.length)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&r.forEach((e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/o,this.presentedScene.setShadowOffset(e);const r=mh.copy(s.getCamera().position),l=-e/(r.y-t.y);r.multiplyScalar(l),t.multiplyScalar(1-l).add(r)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/o}}moveScene(e){const t=this.presentedScene,{position:r,yaw:s}=t,o=t.boundingSphere.radius,l=this.goalPosition,c=t.scale.x,h=this.placementBox;let d=ah.NONE;if(!l.equals(r)||this.goalScale!==c){d=ah.USER_INTERACTION;let{x:s,y:p,z:A}=r;s=this.xDamper.update(s,l.x,e,o),p=this.yDamper.update(p,l.y,e,o),A=this.zDamper.update(A,l.z,e,o),r.set(s,p,A);const m=this.scaleDamper.update(c,this.goalScale,e,1);if(t.scale.set(m,m,m),!this.isTranslating){const e=l.y-p;this.placementComplete&&!1===this.placeOnWall?(h.offsetHeight=e/m,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,h.show=!1,t.setShadowIntensity(.8))}}h.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(s,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:d}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const r=this.threeRenderer.xr.getReferenceSpace(),s=t.getViewerPose(r);null==s&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Ah}));const o=this.presentedScene;if(null==s||null==o||!o.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:ph}));let l=!0;for(const r of s.views){if(this.updateView(r),l){this.moveToFloor(t),this.processInput(t);const r=e-this.lastTick;this.moveScene(r),this.renderer.preRender(o,e,r),this.lastTick=e,o.renderShadow(this.threeRenderer)}this.threeRenderer.render(o,o.getCamera()),l=!1}}}function clone(e){const t=new Map,r=new Map,s=e.clone();return parallelTraverse(e,s,(function(e,s){t.set(s,e),r.set(e,s)})),s.traverse((function(e){if(!e.isSkinnedMesh)return;const s=e,o=t.get(e),l=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=l.map((function(e){return r.get(e)})),s.bind(s.skeleton,s.bindMatrix)})),s}function parallelTraverse(e,t,r){r(e,t);for(let s=0;s<e.children.length;s++)parallelTraverse(e.children[s],t.children[s],r)}const vh=Symbol("prepared"),Eh=Symbol("prepare"),yh=Symbol("preparedGLTF"),xh=Symbol("clone");class GLTFInstance{constructor(e){this[yh]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[vh])return e;const t=this[Eh](e);return t[vh]=!0,t}static[Eh](e){const{scene:t}=e,r=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:r})}get parser(){return this[yh].parser}get animations(){return this[yh].animations}get scene(){return this[yh].scene}get scenes(){return this[yh].scenes}get cameras(){return this[yh].cameras}get asset(){return this[yh].asset}get userData(){return this[yh].userData}clone(){return new(0,this.constructor)(this[xh]())}dispose(){this.scenes.forEach((e=>{e.traverse((e=>{const t=e;if(!t.material)return;(Array.isArray(t.material)?t.material:[t.material]).forEach((e=>{for(const t in e){const r=e[t];if(r instanceof Texture){const e=r.source.data;null!=e.close&&e.close(),r.dispose()}}e.dispose()})),t.geometry.dispose()}))}))}[xh](){const e=this[yh],t=clone(this.scene);cloneVariantMaterials(t,this.scene);const r=[t],s=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:r,userData:s})}}const cloneVariantMaterials=(e,t)=>{traversePair(e,t,((e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)}))},traversePair=(e,t,r)=>{r(e,t);for(let s=0;s<e.children.length;s++)traversePair(e.children[s],t.children[s],r)},Sh=Symbol("threeGLTF"),Mh=Symbol("gltf"),Ch=Symbol("gltfElementMap"),bh=Symbol("threeObjectMap"),Ih=Symbol("parallelTraverseThreeScene"),wh=Symbol("correlateOriginalThreeGLTF"),Th=Symbol("correlateCloneThreeGLTF");class CorrelatedSceneGraph{constructor(e,t,r,s){this[Sh]=e,this[Mh]=t,this[Ch]=s,this[bh]=r}static from(e,t){return null!=t?this[Th](e,t):this[wh](e)}static[wh](e){const t=e.parser.json,r=e.parser.associations,s=new Map,o={name:"Default"},l={type:"materials",index:-1};for(const e of r.keys())e instanceof Material&&null==r.get(e)&&(l.index<0&&(null==t.materials&&(t.materials=[]),l.index=t.materials.length,t.materials.push(o)),e.name=o.name,r.set(e,{materials:l.index}));for(const[e,o]of r){o&&(e.userData=e.userData||{},e.userData.associations=o);for(const r in o)if(null!=r&&"primitives"!==r){const l=r,c=(t[l]||[])[o[l]];if(null==c)continue;let h=s.get(c);null==h&&(h=new Set,s.set(c,h)),h.add(e)}}return new CorrelatedSceneGraph(e,t,r,s)}static[Th](e,t){const r=t.threeGLTF,s=t.gltf,o=JSON.parse(JSON.stringify(s)),l=new Map,c=new Map;for(let s=0;s<r.scenes.length;s++)this[Ih](r.scenes[s],e.scenes[s],((e,r)=>{const s=t.threeObjectMap.get(e);if(null!=s)for(const e in s)if(null!=e&&"primitives"!==e){const t=e,h=s[t],d=o[t][h],p=l.get(r)||{};p[t]=h,l.set(r,p);const A=c.get(d)||new Set;A.add(r),c.set(d,A)}}));return new CorrelatedSceneGraph(e,o,l,c)}static[Ih](e,t,r){const traverse=(e,t)=>{if(r(e,t),e.isObject3D){const s=e,o=t;if(s.material)if(Array.isArray(s.material))for(let e=0;e<s.material.length;++e)r(s.material[e],o.material[e]);else r(s.material,o.material);for(let r=0;r<e.children.length;++r)traverse(e.children[r],t.children[r])}};traverse(e,t)}get threeGLTF(){return this[Sh]}get gltf(){return this[Mh]}get gltfElementMap(){return this[Ch]}get threeObjectMap(){return this[bh]}}const Bh=Symbol("correlatedSceneGraph");class ModelViewerGLTFInstance extends GLTFInstance{static[Eh](e){const t=super[Eh](e);null==t[Bh]&&(t[Bh]=CorrelatedSceneGraph.from(t));const{scene:r}=t,s=new Sphere(void 0,1/0);return r.traverse((e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const r=e;if(r.material){const{geometry:e}=r;r.castShadow=!0,r.isSkinnedMesh&&(e.boundingSphere=s,e.boundingBox=null);const o=r.material;if(!0===o.isMeshBasicMaterial&&(o.toneMapped=!1),o.shadowSide=p,o.aoMap){const{gltf:r,threeObjectMap:s}=t[Bh],l=s.get(o);if(null!=r.materials&&null!=l&&null!=l.materials){const t=r.materials[l.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}})),t}get correlatedSceneGraph(){return this[yh][Bh]}[xh](){const e=super[xh](),t=new Map;return e.scene.traverse((e=>{const r=e;if(r.material){const e=r.material;if(null!=e){if(t.has(e.uuid))return void(r.material=t.get(e.uuid));r.material=e.clone(),t.set(e.uuid,r.material)}}const s=e;void 0!==s.target&&s.add(s.target)})),e[Bh]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}}var Rh=r(93e3);const getBufferForType=(e,t,r)=>{let s;switch(e){case ve:s=new Uint8ClampedArray(t*r*4);break;case Me:s=new Uint16Array(t*r*4);break;case xe:s=new Uint32Array(t*r*4);break;case 1010:s=new Int8Array(t*r*4);break;case 1011:s=new Int16Array(t*r*4);break;case ye:s=new Int32Array(t*r*4);break;case Se:s=new Float32Array(t*r*4);break;default:throw new Error("Unsupported data type")}return s};let Lh;class QuadRenderer_vDmOC3x_QuadRenderer{constructor(e){var t,r,s,o,l,c,h,d,p,A,m,g,f,_,E,y;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const x={format:be,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==(null===(t=e.renderTargetOptions)||void 0===t?void 0:t.anisotropy)?null===(r=e.renderTargetOptions)||void 0===r?void 0:r.anisotropy:1,generateMipmaps:void 0!==(null===(s=e.renderTargetOptions)||void 0===s?void 0:s.generateMipmaps)&&(null===(o=e.renderTargetOptions)||void 0===o?void 0:o.generateMipmaps),magFilter:void 0!==(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.magFilter)?null===(c=e.renderTargetOptions)||void 0===c?void 0:c.magFilter:ge,minFilter:void 0!==(null===(h=e.renderTargetOptions)||void 0===h?void 0:h.minFilter)?null===(d=e.renderTargetOptions)||void 0===d?void 0:d.minFilter:ge,samples:void 0!==(null===(p=e.renderTargetOptions)||void 0===p?void 0:p.samples)?null===(A=e.renderTargetOptions)||void 0===A?void 0:A.samples:void 0,wrapS:void 0!==(null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapS)?null===(g=e.renderTargetOptions)||void 0===g?void 0:g.wrapS:ue,wrapT:void 0!==(null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapT)?null===(_=e.renderTargetOptions)||void 0===_?void 0:_.wrapT:ue};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_vDmOC3x_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new Scene,this._camera=new OrthographicCamera,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,t,r,s)=>{if(void 0!==Lh)return Lh;const o=new WebGLRenderTarget(1,1,s);t.setRenderTarget(o);const l=new three_module_Mesh(new PlaneGeometry,new MeshBasicMaterial({color:16777215}));t.render(l,r),t.setRenderTarget(null);const c=getBufferForType(e,o.width,o.height);return t.readRenderTargetPixels(o,0,0,o.width,o.height,c),o.dispose(),l.geometry.dispose(),l.material.dispose(),Lh=0!==c[0],Lh})(this._type,this._renderer,this._camera,x)){let e;if(this._type===Me)e=this._renderer.extensions.has("EXT_color_buffer_float")?Se:void 0;void 0!==e?(Rh.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to 1015`),this._type=e):(this._supportsReadPixels=!1,Rh.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new three_module_Mesh(new PlaneGeometry,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new WebGLRenderTarget(this.width,this.height,x),this._renderTarget.texture.mapping=void 0!==(null===(E=e.renderTargetOptions)||void 0===E?void 0:E.mapping)?null===(y=e.renderTargetOptions)||void 0===y?void 0:y.mapping:re}static instantiateRenderer(){const e=new WebGLRenderer;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=getBufferForType(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new DataTexture(this.toArray(),this.width,this.height,be,this._type,(null==e?void 0:e.mapping)||re,(null==e?void 0:e.wrapS)||ue,(null==e?void 0:e.wrapT)||ue,(null==e?void 0:e.magFilter)||ge,(null==e?void 0:e.minFilter)||ge,(null==e?void 0:e.anisotropy)||1,tt);return t.generateMipmaps=void 0!==(null==e?void 0:e.generateMipmaps)&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof ShaderMaterial&&Object.values(this.material.uniforms).forEach((e=>{e.value instanceof Texture&&e.value.dispose()})),Object.values(this.material).forEach((e=>{e instanceof Texture&&e.dispose()})),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}var Dh=r(93e3);class GainMapDecoderMaterial extends ShaderMaterial{constructor({gamma:e,offsetHdr:t,offsetSdr:r,gainMapMin:s,gainMapMax:o,maxDisplayBoost:l,hdrCapacityMin:c,hdrCapacityMax:h,sdr:d,gainMap:p}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:d},gainMap:{value:p},gamma:{value:new three_module_Vector3(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new three_module_Vector3).fromArray(t)},offsetSdr:{value:(new three_module_Vector3).fromArray(r)},gainMapMin:{value:(new three_module_Vector3).fromArray(s)},gainMapMax:{value:(new three_module_Vector3).fromArray(o)},weightFactor:{value:(Math.log2(l)-c)/(h-c)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=c,this._hdrCapacityMax=h,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class GainMapNotFoundError extends Error{}class XMPMetadataNotFoundError extends Error{}const getAttribute=(e,t,r)=>{var s;let o;const l=null===(s=e.attributes.getNamedItem(t))||void 0===s?void 0:s.nodeValue;if(l)o=l;else{const s=e.getElementsByTagName(t)[0];if(!s){if(r)return r;throw new Error(`Can't find ${t} in gainmap metadata`)}{const e=s.getElementsByTagName("rdf:li");if(3!==e.length)throw new Error(`Gainmap metadata contains an array of items for ${t} but its length is not 3`);o=Array.from(e).map((e=>e.innerHTML))}}return o};class MPFExtractor{constructor(e){this.options={debug:!(!e||void 0===e.debug)&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise(((t,r)=>{const s=this.options.debug,o=new DataView(e.buffer);if(65496!==o.getUint16(0))return void r(new Error("Not a valid jpeg"));const l=o.byteLength;let c,h=2,d=0;for(;h<l;){if(++d>250)return void r(new Error(`Found no marker after ${d} loops 😵`));if(255!==o.getUint8(h))return void r(new Error(`Not a valid marker at offset 0x${h.toString(16)}, found: 0x${o.getUint8(h).toString(16)}`));if(c=o.getUint8(h+1),s&&Dh.log(`Marker: ${c.toString(16)}`),226===c){s&&Dh.log("Found APP2 marker (0xffe2)");const e=h+4;if(1297106432===o.getUint32(e)){const s=e+4;let l;if(18761===o.getUint16(s))l=!1;else{if(19789!==o.getUint16(s))return void r(new Error("No valid endianness marker found in TIFF header"));l=!0}if(42!==o.getUint16(s+2,!l))return void r(new Error("Not valid TIFF data! (no 0x002A marker)"));const c=o.getUint32(s+4,!l);if(c<8)return void r(new Error("Not valid TIFF data! (First offset less than 8)"));const h=s+c,d=o.getUint16(h,!l),p=h+2;let A=0;for(let e=p;e<p+12*d;e+=12)45057===o.getUint16(e,!l)&&(A=o.getUint32(e+8,!l));const m=h+2+12*d+4,g=[];for(let e=m;e<m+16*A;e+=16){const t={MPType:o.getUint32(e,!l),size:o.getUint32(e+4,!l),dataOffset:o.getUint32(e+8,!l),dependantImages:o.getUint32(e+12,!l),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=s+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,g.push(t)}if(this.options.extractNonFII&&g.length){const e=new Blob([o]),r=[];for(const t of g){if(t.isFII&&!this.options.extractFII)continue;const s=e.slice(t.start,t.end+1,"image/jpeg");r.push(s)}t(r)}}}h+=2+o.getUint16(h+2)}}))}}const extractGainmapFromJPEG=async e=>{const t=(e=>{var t,r;let s;s="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let o=s.indexOf("<x:xmpmeta");const l=new DOMParser;for(;-1!==o;){const e=s.indexOf("x:xmpmeta>",o);s.slice(o,e+10);const c=s.slice(o,e+10);try{const e=l.parseFromString(c,"text/xml").getElementsByTagName("rdf:Description")[0],s=getAttribute(e,"hdrgm:GainMapMin","0"),o=getAttribute(e,"hdrgm:GainMapMax"),h=getAttribute(e,"hdrgm:Gamma","1"),d=getAttribute(e,"hdrgm:OffsetSDR","0.015625"),p=getAttribute(e,"hdrgm:OffsetHDR","0.015625");let A=null===(t=e.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;A||(A="0");const m=null===(r=e.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===r?void 0:r.nodeValue;if(!m)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(s)?s.map((e=>parseFloat(e))):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(o)?o.map((e=>parseFloat(e))):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(h)?h.map((e=>parseFloat(e))):[parseFloat(h),parseFloat(h),parseFloat(h)],offsetSdr:Array.isArray(d)?d.map((e=>parseFloat(e))):[parseFloat(d),parseFloat(d),parseFloat(d)],offsetHdr:Array.isArray(p)?p.map((e=>parseFloat(e))):[parseFloat(p),parseFloat(p),parseFloat(p)],hdrCapacityMin:parseFloat(A),hdrCapacityMax:parseFloat(m)}}catch(e){}o=s.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");const r=new MPFExtractor({extractFII:!0,extractNonFII:!0}),s=await r.extract(e);if(2!==s.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await s[0].arrayBuffer()),gainMap:new Uint8Array(await s[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise(((t,r)=>{const s=document.createElement("img");s.onload=()=>{t(s)},s.onerror=e=>{r(e)},s.src=URL.createObjectURL(e)}));class LoaderBase extends Loader{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new LoadingManager}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){const e=new GainMapDecoderMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new Texture,sdr:new Texture});return new QuadRenderer_vDmOC3x_QuadRenderer({width:16,height:16,type:Me,colorSpace:tt,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,r,s){const o=s?new Blob([s],{type:"image/jpeg"}):void 0,l=new Blob([r],{type:"image/jpeg"});let c,h,d=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([o?getHTMLImageFromBlob(o):Promise.resolve(void 0),getHTMLImageFromBlob(l)]);h=e[0],c=e[1],d=!0}else{const e=await Promise.all([o?createImageBitmap(o,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(l,{imageOrientation:"flipY"})]);h=e[0],c=e[1]}const p=new Texture(h||new ImageData(2,2),re,ue,ue,ge,1008,be,ve,1,tt);p.flipY=d,p.needsUpdate=!0;const A=new Texture(c,re,ue,ue,ge,1008,be,ve,1,et);A.flipY=d,A.needsUpdate=!0,e.width=c.width,e.height=c.height,e.material.gainMap=p,e.material.sdr=A,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}}class HDRJPGLoader extends LoaderBase{load(e,t,r,s){const o=this.prepareQuadRenderer(),l=new three_module_FileLoader(this._internalLoadingManager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(this.withCredentials),this.manager.itemStart(e),l.load(e,(async r=>{if("string"==typeof r)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const l=new Uint8Array(r);let c,h,d;try{const e=await extractGainmapFromJPEG(l);c=e.sdr,h=e.gainMap,d=e.metadata}catch(t){if(!(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError))throw t;Dh.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),d={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},c=l}try{await this.render(o,d,c,h)}catch(t){return this.manager.itemError(e),"function"==typeof s&&s(t),void o.disposeOnDemandRenderer()}"function"==typeof t&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()}),r,(t=>{this.manager.itemError(e),"function"==typeof s&&s(t)})),o}}class RGBELoader extends DataTextureLoader{constructor(e){super(e),this.type=Me}parse(e){const rgbe_error=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},fgets=function(e,t,r){t=t||1024;let s=e.pos,o=-1,l=0,c="",h=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));for(;0>(o=h.indexOf("\n"))&&l<t&&s<e.byteLength;)c+=h,l+=h.length,s+=128,h+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));return-1<o&&(!1!==r&&(e.pos+=l+o+1),c+h.slice(0,o))},RGBEByteToRGBFloat=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=e[t+0]*l,r[s+1]=e[t+1]*l,r[s+2]=e[t+2]*l,r[s+3]=1},RGBEByteToRGBHalf=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=Ji.toHalfFloat(Math.min(e[t+0]*l,65504)),r[s+1]=Ji.toHalfFloat(Math.min(e[t+1]*l,65504)),r[s+2]=Ji.toHalfFloat(Math.min(e[t+2]*l,65504)),r[s+3]=Ji.toHalfFloat(1)},t=new Uint8Array(e);t.pos=0;const r=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,l={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let c,h;for((e.pos>=e.byteLength||!(c=fgets(e)))&&rgbe_error(1,"no header found"),(h=c.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),l.valid|=1,l.programtype=h[1],l.string+=c+"\n";c=fgets(e),!1!==c;)if(l.string+=c+"\n","#"!==c.charAt(0)){if((h=c.match(t))&&(l.gamma=parseFloat(h[1])),(h=c.match(r))&&(l.exposure=parseFloat(h[1])),(h=c.match(s))&&(l.valid|=2,l.format=h[1]),(h=c.match(o))&&(l.valid|=4,l.height=parseInt(h[1],10),l.width=parseInt(h[2],10)),2&l.valid&&4&l.valid)break}else l.comments+=c+"\n";return 2&l.valid||rgbe_error(3,"missing format specifier"),4&l.valid||rgbe_error(3,"missing image size specifier"),l}(t),s=r.width,o=r.height,l=function(e,t,r){const s=t;if(s<8||s>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);s!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");const o=new Uint8Array(4*t*r);o.length||rgbe_error(4,"unable to allocate buffer space");let l=0,c=0;const h=4*s,d=new Uint8Array(4),p=new Uint8Array(h);let A=r;for(;A>0&&c<e.byteLength;){c+4>e.byteLength&&rgbe_error(1),d[0]=e[c++],d[1]=e[c++],d[2]=e[c++],d[3]=e[c++],2==d[0]&&2==d[1]&&(d[2]<<8|d[3])==s||rgbe_error(3,"bad rgbe scanline format");let t,r=0;for(;r<h&&c<e.byteLength;){t=e[c++];const s=t>128;if(s&&(t-=128),(0===t||r+t>h)&&rgbe_error(3,"bad scanline data"),s){const s=e[c++];for(let e=0;e<t;e++)p[r++]=s}else p.set(e.subarray(c,c+t),r),r+=t,c+=t}const m=s;for(let e=0;e<m;e++){let t=0;o[l]=p[e+t],t+=s,o[l+1]=p[e+t],t+=s,o[l+2]=p[e+t],t+=s,o[l+3]=p[e+t],l+=4}A--}return o}(t.subarray(t.pos),s,o);let c,h,d;switch(this.type){case Se:d=l.length/4;const e=new Float32Array(4*d);for(let t=0;t<d;t++)RGBEByteToRGBFloat(l,4*t,e,4*t);c=e,h=Se;break;case Me:d=l.length/4;const t=new Uint16Array(4*d);for(let e=0;e<d;e++)RGBEByteToRGBHalf(l,4*e,t,4*e);c=t,h=Me;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:s,height:o,data:c,header:r.string,gamma:r.gamma,exposure:r.exposure,type:h}}setDataType(e){return this.type=e,this}load(e,t,r,s){return super.load(e,(function onLoadCallback(e,r){switch(e.type){case Se:case Me:e.colorSpace=tt,e.minFilter=ge,e.magFilter=ge,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}const Uh={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},Ph={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class EnvironmentScene extends Scene{constructor(e){super(),this.position.y=-3.5;const t=new BoxGeometry;t.deleteAttribute("uv");const r=new MeshStandardMaterial({metalness:0,side:A}),s=new MeshStandardMaterial({metalness:0}),o="legacy"==e?Uh:Ph,l=new PointLight(16777215,o.topLight.intensity,28,2);l.position.set(...o.topLight.position),this.add(l);const c=new three_module_Mesh(t,r);c.position.set(...o.room.position),c.scale.set(...o.room.scale),this.add(c);for(const e of o.boxes){const r=new three_module_Mesh(t,s);r.position.set(...e.position),r.rotation.set(0,e.rotation,0),r.scale.set(...e.scale),this.add(r)}for(const e of o.lights){const r=new three_module_Mesh(t,this.createAreaLightMaterial(e.intensity));r.position.set(...e.position),r.scale.set(...e.scale),this.add(r)}}createAreaLightMaterial(e){const t=new MeshBasicMaterial;return t.color.setScalar(e),t}}var Fh=r(93e3);const Nh=20,Qh=/\.hdr(\.js)?$/;class TextureUtils{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this.withCredentials=!1,this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}get ldrLoader(){return null==this._ldrLoader&&(this._ldrLoader=new TextureLoader),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new HDRJPGLoader(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new RGBELoader,this._hdrLoader.setDataType(Me)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){const{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(e){const t=await new Promise(((t,r)=>this.ldrLoader.load(e,t,(()=>{}),r)));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const r=await this.getLottieLoader();r.setQuality(t);const s=await new Promise(((t,s)=>r.load(e,t,(()=>{}),s)));return s.name=e,s}async loadEquirect(e,t=(()=>{})){try{const r=Qh.test(e),s=r?this.hdrLoader:this.imageLoader,o=await new Promise(((r,o)=>s.load(e,(e=>{const{renderTarget:t}=e;if(null!=t){const{texture:s}=t;e.dispose(!1),r(s)}else r(e)}),(e=>{t(e.loaded/e.total*.9)}),o)));return t(1),o.name=e,o.mapping=oe,r||(o.colorSpace=et),o}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,r=(()=>{})){const s="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=deserializeUrl(t);let o,l=Promise.resolve(null);e&&(l=this.loadEquirectFromUrl(e,r)),o=t?this.loadEquirectFromUrl(t,r):e?this.loadEquirectFromUrl(e,r):s?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[c,h]=await Promise.all([o,l]);if(null==c)throw new Error("Failed to load environment map.");return{environmentMap:c,skybox:h}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const r=this.loadEquirect(e,t);this.skyboxCache.set(e,r)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise((t=>setTimeout(t,e))))();const r=this.threeRenderer,s=new WebGLCubeRenderTarget(256,{generateMipmaps:!1,type:Me,format:be,colorSpace:tt,depthBuffer:!0}),o=new CubeCamera(.1,100,s),l=o.renderTarget.texture;l.name=t;const c=r.outputColorSpace,h=r.toneMapping;return r.toneMapping=Y,r.outputColorSpace=tt,o.update(r,e),this.blurCubemap(s,.04),r.toneMapping=h,r.outputColorSpace=c,l}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new EnvironmentScene("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new EnvironmentScene("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(Nh);const e=new BoxGeometry,t=new three_module_Mesh(e,this.blurMaterial);this.blurScene=new Scene,this.blurScene.add(t)}const r=e.clone();this.halfblur(e,r,t,"latitudinal"),this.halfblur(r,e,t,"longitudinal")}halfblur(e,t,r,s){const o=e.width,l=isFinite(r)?Math.PI/(2*o):2*Math.PI/39,c=r/l,h=isFinite(r)?1+Math.floor(3*c):Nh;h>Nh&&Fh.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${h} samples when the maximum is set to 20`);const d=[];let p=0;for(let e=0;e<Nh;++e){const t=e/c,r=Math.exp(-t*t/2);d.push(r),0==e?p+=r:e<h&&(p+=2*r)}for(let e=0;e<d.length;e++)d[e]=d[e]/p;const A=this.blurMaterial.uniforms;A.envMap.value=e.texture,A.samples.value=h,A.weights.value=d,A.latitudinal.value="latitudinal"===s,A.dTheta.value=l;new CubeCamera(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),r=new three_module_Vector3(0,1,0);return new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:r}},vertexShader:"\n \n varying vec3 vOutputDirection;\n \n void main() {\n \n vOutputDirection = vec3( position );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n ",fragmentShader:"\n varying vec3 vOutputDirection;\n \n uniform samplerCube envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform vec3 poleAxis;\n \n vec3 getSample( float theta, vec3 axis ) {\n \n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n \n return vec3( textureCube( envMap, sampleDirection ) );\n \n }\n \n void main() {\n \n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n \n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n \n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n \n }\n \n axis = normalize( axis );\n \n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n \n for ( int i = 1; i < n; i++ ) {\n \n if ( i >= samples ) {\n \n break;\n \n }\n \n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n \n }\n }\n ",blending:0,depthTest:!1,depthWrite:!1,side:A})}async dispose(){for(const[,e]of this.skyboxCache){(await e).dispose()}null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}var Oh=r(93e3);const Gh=[1,.79,.62,.5,.4,.31,.25],kh="high-performance";class Renderer extends EventDispatcher{constructor(e){super(),this.loader=new CachingGLTFLoader(ModelViewerGLTFInstance),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;null===(e=this.textureUtils)||void 0===e||e.dispose(),this.textureUtils=new TextureUtils(this.threeRenderer);for(const e of this.scenes)e.element[fa]()},this.dpr=pa(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show"),Ln.tonemapping_pars_fragment=Ln.tonemapping_pars_fragment.replace("vec3 CustomToneMapping( vec3 color ) { return color; }","\n float startCompression = 0.8 - 0.04;\n float desaturation = 0.15;\n vec3 CustomToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n\n float x = min(color.r, min(color.g, color.b));\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n\n float peak = max(color.r, max(color.g, color.b));\n if (peak < startCompression) return color;\n\n float d = 1. - startCompression;\n float newPeak = 1. - d * d / (peak + d - startCompression);\n color *= newPeak / peak;\n\n float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n return mix(color, vec3(1, 1, 1), g);\n }");try{this.threeRenderer=new WebGLRenderer({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=ee}catch(e){Oh.warn(e)}this.arRenderer=new ARRenderer(this),this.textureUtils=this.canRender?new TextureUtils(this.threeRenderer):null,CachingGLTFLoader.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||kh,debug:Aa()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return Gh[this.scaleStep]}set minScale(e){let t=1;for(;t<Gh.length&&!(Gh[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new Vector2;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((e,t)=>this.render(e,t)))}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return this.multipleScenesVisible?e.element[Ap]:this.canvas3D}countVisibleScenes(){const{canvas3D:e}=this;let t=0,r=null;for(const s of this.scenes){const{element:o}=s;o.modelIsVisible&&null==s.externalRenderer&&++t,e.parentElement===s.canvas.parentElement&&(r=s)}const s=t>1;if(null!=r){const t=s&&!this.multipleScenesVisible,o=!r.element.modelIsVisible;if(t||o){const{width:t,height:s}=this.sceneSize(r);this.copyPixels(r,t,s),e.parentElement.removeChild(e)}}this.multipleScenesVisible=s}updateRendererSize(){var e;const t=pa();if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[tp](t.getBoundingClientRect())}let r=0,s=0;for(const e of this.scenes)r=Math.max(r,e.width),s=Math.max(s,e.height);if(r!==this.width||s!==this.height||t!==this.dpr){this.width=r,this.height=s,this.dpr=t,r=Math.ceil(r*t),s=Math.ceil(s*t),this.canRender&&this.threeRenderer.setSize(r,s,!1);for(const t of this.scenes){const{canvas:o}=t;o.width=r,o.height=s,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(r,s)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=utilities_clamp(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){const t=Gh[e.scaleStep],r=Math.ceil(this.width/t),s=Math.ceil(this.height/t),{style:o}=e.canvas;o.width=`${r}px`,o.height=`${s}px`,this.canvas3D.style.width=`${r}px`,this.canvas3D.style.height=`${s}px`;const l=this.dpr*t,c=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:l,minimumDpr:this.dpr*Gh[this.lastStep],pixelWidth:Math.ceil(e.width*l),pixelHeight:Math.ceil(e.height*l),reason:c}}))}sceneSize(e){const{dpr:t}=this,r=Gh[e.scaleStep];return{width:Math.min(Math.ceil(e.width*r*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*r*t),this.canvas3D.height)}}copyPixels(e,t,r){const s=e.context;null!=s?(s.clearRect(0,0,t,r),s.drawImage(this.canvas3D,0,0,t,r,0,0,t,r),e.canvas.classList.add("show")):Oh.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const r of this.scenes)r.element.modelIsVisible===t&&e.push(r);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,r){const{element:s,exposure:o,toneMapping:l}=e;s[fp](t,r);const c="number"==typeof o&&!Number.isNaN(o),h=s.environmentImage,d=s.skyboxImage,p=l===te&&("neutral"===h||"legacy"===h||!h&&!d);this.threeRenderer.toneMappingExposure=(c?o:1)*(p?1.3:1)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);const r=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(r),this.renderedLastFrame=!1);const{canvas3D:s}=this;for(const t of this.orderedScenes()){const{element:o}=t;if(!o.loaded||!o.modelIsVisible&&t.renderCount>0)continue;if(this.preRender(t,e,r),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:r,projectionMatrix:s}=e,o=r.elements.slice(),l=t.getTarget();o[12]+=l.x,o[13]+=l.y,o[14]+=l.z,t.externalRenderer.render({viewMatrix:o,projectionMatrix:s.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:l,height:c}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-c,l,c),null!=t.effectRenderer?t.effectRenderer.render(r):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,l,c):s.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(s),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}Renderer._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||kh,debug:Aa()});const Vh=Symbol("correlatedObjects"),Hh=Symbol("onUpdate");class ThreeDOMElement{constructor(e,t=null){this[Hh]=e,this[Vh]=t}}const zh=new MeshBasicMaterial,Wh=new PlaneGeometry(2,2);let qh=0;const Xh=Symbol("threeTexture"),jh=Symbol("threeTextures");Symbol("applyTexture");class image_Image extends ThreeDOMElement{get[Xh](){var e;return null===(e=this[Vh])||void 0===e?void 0:e.values().next().value}get[jh](){return this[Vh]}constructor(e,t){super(e,new Set(t?[t]:[])),this[Xh].image.src||(this[Xh].image.src=t.name?t.name:"adhoc_image"+qh++),this[Xh].image.name||(this[Xh].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[Xh].image.name||""}get uri(){return this[Xh].image.src}get bufferView(){return this[Xh].image.bufferView}get element(){const e=this[Xh];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[Xh];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(const t of this[jh])t.image.name=e}update(){const e=this[Xh];e&&e.isCanvasTexture&&!e.animation&&(this[Xh].needsUpdate=!0,this[Hh]())}async createThumbnail(e,t){const r=new Scene;zh.map=this[Xh];const s=new three_module_Mesh(Wh,zh);r.add(s);const o=new OrthographicCamera(-1,1,1,-1,0,1),{threeRenderer:l}=Renderer.singleton,c=new WebGLRenderTarget(e,t);l.setRenderTarget(c),l.render(r,o),l.setRenderTarget(null);const h=new Uint8Array(e*t*4);l.readRenderTargetPixels(c,0,0,e,t,h),Wd.width=e,Wd.height=t;const d=Wd.getContext("2d"),p=d.createImageData(e,t);return p.data.set(h),d.putImageData(p,0,0),new Promise((async(e,t)=>{Wd.toBlob((r=>{if(!r)return t("Failed to capture thumbnail.");e(URL.createObjectURL(r))}),"image/png")}))}}var Yh,Kh;!function(e){e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.NearestMipmapNearest=9984]="NearestMipmapNearest",e[e.LinearMipmapNearest=9985]="LinearMipmapNearest",e[e.NearestMipmapLinear=9986]="NearestMipmapLinear",e[e.LinearMipmapLinear=9987]="LinearMipmapLinear"}(Yh||(Yh={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(Kh||(Kh={}));const Jh=new Map([[Kh.Repeat,he],[Kh.ClampToEdge,ue],[Kh.MirroredRepeat,de]]),$h=new Map([[he,Kh.Repeat],[ue,Kh.ClampToEdge],[de,Kh.MirroredRepeat]]),Zh=new Map([[Yh.Nearest,pe],[Yh.Linear,ge],[Yh.NearestMipmapNearest,Ae],[Yh.LinearMipmapNearest,fe],[Yh.NearestMipmapLinear,me],[Yh.LinearMipmapLinear,_e]]),eu=new Map([[pe,Yh.Nearest],[ge,Yh.Linear],[Ae,Yh.NearestMipmapNearest],[fe,Yh.LinearMipmapNearest],[me,Yh.NearestMipmapLinear],[_e,Yh.LinearMipmapLinear]]),tu=new Map([[Yh.Nearest,pe],[Yh.Linear,ge]]),iu=new Map([[pe,Yh.Nearest],[ge,Yh.Linear]]),isMinFilter=e=>eu.has(e),isMagFilter=e=>iu.has(e),isWrapping=e=>$h.has(e),nu=Symbol("threeTexture"),ru=Symbol("threeTextures"),su=Symbol("setProperty");class Sampler extends ThreeDOMElement{get[nu](){var e;return null===(e=this[Vh])||void 0===e?void 0:e.values().next().value}get[ru](){return this[Vh]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[nu].name||""}get minFilter(){return eu.get(this[nu].minFilter)}get magFilter(){return iu.get(this[nu].magFilter)}get wrapS(){return $h.get(this[nu].wrapS)}get wrapT(){return $h.get(this[nu].wrapT)}get rotation(){return this[nu].rotation}get scale(){return toVector2D(this[nu].repeat)}get offset(){return toVector2D(this[nu].offset)}setMinFilter(e){this[su]("minFilter",Zh.get(e))}setMagFilter(e){this[su]("magFilter",tu.get(e))}setWrapS(e){this[su]("wrapS",Jh.get(e))}setWrapT(e){this[su]("wrapT",Jh.get(e))}setRotation(e){null==e&&(e=0),this[su]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[su]("repeat",new Vector2(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[su]("offset",new Vector2(e.u,e.v))}[su](e,t){if(((e,t)=>{switch(e){case"minFilter":return isMinFilter(t);case"magFilter":return isMagFilter(t);case"wrapS":case"wrapT":return isWrapping(t);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(const r of this[ru])r[e]=t,r.needsUpdate=!0;this[Hh]()}}const au=Symbol("image"),ou=Symbol("sampler"),lu=Symbol("threeTexture");class texture_Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[ou]=new Sampler(e,t),this[au]=new image_Image(e,t)}get[lu](){var e;return null===(e=this[Vh])||void 0===e?void 0:e.values().next().value}get name(){return this[lu].name||""}set name(e){for(const t of this[Vh])t.name=e}get sampler(){return this[ou]}get source(){return this[au]}}var cu,hu,uu;const du=Symbol("texture"),pu=Symbol("transform"),Au=Symbol("materials"),mu=Symbol("usage"),gu=Symbol("onUpdate"),fu=Symbol("activeVideo");var _u;!function(e){e[e.Base=0]="Base",e[e.MetallicRoughness=1]="MetallicRoughness",e[e.Normal=2]="Normal",e[e.Occlusion=3]="Occlusion",e[e.Emissive=4]="Emissive",e[e.Clearcoat=5]="Clearcoat",e[e.ClearcoatRoughness=6]="ClearcoatRoughness",e[e.ClearcoatNormal=7]="ClearcoatNormal",e[e.SheenColor=8]="SheenColor",e[e.SheenRoughness=9]="SheenRoughness",e[e.Transmission=10]="Transmission",e[e.Thickness=11]="Thickness",e[e.Specular=12]="Specular",e[e.SpecularColor=13]="SpecularColor",e[e.Iridescence=14]="Iridescence",e[e.IridescenceThickness=15]="IridescenceThickness",e[e.Anisotropy=16]="Anisotropy"}(_u||(_u={}));class TextureInfo{constructor(e,t,r,s){this[cu]=null,this[hu]={rotation:0,scale:new Vector2(1,1),offset:new Vector2(0,0)},this[uu]=!1,r&&(this[pu].rotation=r.rotation,this[pu].scale.copy(r.repeat),this[pu].offset.copy(r.offset),this[du]=new texture_Texture(e,r)),this[gu]=e,this[Au]=s,this[mu]=t}get texture(){return this[du]}setTexture(e){var t,r;const s=null!=e?e.source[Xh]:null,o=null===(t=this[du])||void 0===t?void 0:t.source[Xh];if(null!=o&&o.isVideoTexture?this[fu]=!1:(null===(r=this[du])||void 0===r?void 0:r.source.animation)&&this[du].source.animation.removeEventListener("enterFrame",this[gu]),this[du]=e,null!=s&&s.isVideoTexture){const e=s.image;if(this[fu]=!0,null!=e.requestVideoFrameCallback){const update=()=>{this[fu]&&(this[gu](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{const update=()=>{this[fu]&&(this[gu](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[gu]);let l=et;if(this[Au])for(const e of this[Au]){switch(this[mu]){case _u.Base:e.map=s;break;case _u.MetallicRoughness:l=tt,e.metalnessMap=s,e.roughnessMap=s;break;case _u.Normal:l=tt,e.normalMap=s;break;case _u.Occlusion:l=tt,e.aoMap=s;break;case _u.Emissive:e.emissiveMap=s;break;case _u.Clearcoat:e.clearcoatMap=s;break;case _u.ClearcoatRoughness:e.clearcoatRoughnessMap=s;break;case _u.ClearcoatNormal:e.clearcoatNormalMap=s;break;case _u.SheenColor:e.sheenColorMap=s;break;case _u.SheenRoughness:e.sheenRoughnessMap=s;break;case _u.Transmission:e.transmissionMap=s;break;case _u.Thickness:e.thicknessMap=s;break;case _u.Specular:e.specularIntensityMap=s;break;case _u.SpecularColor:e.specularColorMap=s;break;case _u.Iridescence:e.iridescenceMap=s;break;case _u.IridescenceThickness:e.iridescenceThicknessMap=s;break;case _u.Anisotropy:e.anisotropyMap=s}e.needsUpdate=!0}s&&(s.colorSpace=l,s.rotation=this[pu].rotation,s.repeat=this[pu].scale,s.offset=this[pu].offset),this[gu]()}}cu=du,hu=pu,uu=fu;const vu=Symbol("threeMaterial"),Eu=Symbol("threeMaterials"),yu=Symbol("baseColorTexture"),xu=Symbol("metallicRoughnessTexture");class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);const{map:r,metalnessMap:s}=t.values().next().value;this[yu]=new TextureInfo(e,_u.Base,r,t),this[xu]=new TextureInfo(e,_u.MetallicRoughness,s,t)}get[Eu](){return this[Vh]}get[vu](){var e;return null===(e=this[Vh])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[vu].opacity];return this[vu].color.toArray(e),e}get metallicFactor(){return this[vu].metalness}get roughnessFactor(){return this[vu].roughness}get baseColorTexture(){return this[yu]}get metallicRoughnessTexture(){return this[xu]}setBaseColorFactor(e){const t=new Color;e instanceof Array?t.fromArray(e):t.set(e);for(const r of this[Eu])r.color.set(t),e instanceof Array?r.opacity=e[3]:(e=[0,0,0,r.opacity],t.toArray(e));this[Hh]()}setMetallicFactor(e){for(const t of this[Eu])t.metalness=e;this[Hh]()}setRoughnessFactor(e){for(const t of this[Eu])t.roughness=e;this[Hh]()}}var Su,Mu;const Cu=Symbol("pbrMetallicRoughness"),bu=Symbol("normalTexture"),Iu=Symbol("occlusionTexture"),wu=Symbol("emissiveTexture"),Tu=Symbol("backingThreeMaterial"),Bu=Symbol("applyAlphaCutoff"),Ru=Symbol("getAlphaMode"),Lu=Symbol("lazyLoadGLTFInfo"),Du=Symbol("initialize"),Uu=Symbol("getLoadedMaterial"),Pu=Symbol("ensureMaterialIsLoaded"),Fu=Symbol("gltfIndex"),Nu=Symbol("setActive"),Qu=Symbol("variantIndices"),Ou=Symbol("isActive"),Gu=Symbol("variantSet"),ku=Symbol("modelVariants"),Vu=Symbol("name"),Hu=Symbol("pbrTextures");class material_Material extends ThreeDOMElement{constructor(e,t,r,s,o,l,c=void 0){super(e,o),this[Su]=new Set,this[Mu]=new Map,this[Fu]=t,this[Ou]=r,this[ku]=s,this[Vu]=l,null==c?this[Du]():this[Lu]=c}get[(Su=Gu,Mu=Hu,Tu)](){return this[Vh].values().next().value}[Du](){const e=this[Hh],t=this[Vh];this[Cu]=new PBRMetallicRoughness(e,t);const{normalMap:r,aoMap:s,emissiveMap:o}=t.values().next().value;this[bu]=new TextureInfo(e,_u.Normal,r,t),this[Iu]=new TextureInfo(e,_u.Occlusion,s,t),this[wu]=new TextureInfo(e,_u.Emissive,o,t);const createTextureInfo=r=>{this[Hu].set(r,new TextureInfo(e,r,null,t))};createTextureInfo(_u.Clearcoat),createTextureInfo(_u.ClearcoatRoughness),createTextureInfo(_u.ClearcoatNormal),createTextureInfo(_u.SheenColor),createTextureInfo(_u.SheenRoughness),createTextureInfo(_u.Transmission),createTextureInfo(_u.Thickness),createTextureInfo(_u.Specular),createTextureInfo(_u.SpecularColor),createTextureInfo(_u.Iridescence),createTextureInfo(_u.IridescenceThickness),createTextureInfo(_u.Anisotropy)}async[Uu](){if(null!=this[Lu]){const{set:e,material:t}=await this[Lu].doLazyLoad();return this[Vh]=e,this[Du](),this[Lu]=void 0,this.ensureLoaded=async()=>{},t}return this[Vh].values().next().value}colorFromRgb(e){const t=new Color;return e instanceof Array?t.fromArray(e):t.set(e),t}[Pu](){if(null!=this[Lu])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[Uu]()}get isLoaded(){return null==this[Lu]}get isActive(){return this[Ou]}[Nu](e){this[Ou]=e}get name(){return this[Vu]||""}set name(e){if(this[Vu]=e,null!=this[Vh])for(const t of this[Vh])t.name=e}get pbrMetallicRoughness(){return this[Pu](),this[Cu]}get normalTexture(){return this[Pu](),this[bu]}get occlusionTexture(){return this[Pu](),this[Iu]}get emissiveTexture(){return this[Pu](),this[wu]}get emissiveFactor(){return this[Pu](),this[Tu].emissive.toArray()}get index(){return this[Fu]}[Qu](){return this[Gu]}hasVariant(e){const t=this[ku].get(e);return null!=t&&this[Gu].has(t.index)}setEmissiveFactor(e){this[Pu]();const t=this.colorFromRgb(e);for(const e of this[Vh])e.emissive.set(t);this[Hh]()}[Ru](){return this[Tu].transparent?"BLEND":this[Tu].alphaTest>0?"MASK":"OPAQUE"}[Bu](){this[Pu]();for(const e of this[Vh])"MASK"===this[Ru]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[Pu]();for(const t of this[Vh])t.alphaTest=e,t.needsUpdate=!0;this[Bu](),this[Hh]()}getAlphaCutoff(){return this[Pu](),this[Tu].alphaTest}setDoubleSided(e){this[Pu]();for(const t of this[Vh])t.side=e?m:p,t.needsUpdate=!0;this[Hh]()}getDoubleSided(){return this[Pu](),this[Tu].side==m}setAlphaMode(e){this[Pu]();const enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const t of this[Vh])enableTransparency(t,"BLEND"===e),t.alphaTest="MASK"===e?.5:void 0,t.needsUpdate=!0;this[Hh]()}getAlphaMode(){return this[Pu](),this[Ru]()}get emissiveStrength(){return this[Pu](),this[Tu].emissiveIntensity}setEmissiveStrength(e){this[Pu]();for(const t of this[Vh])t.emissiveIntensity=e;this[Hh]()}get clearcoatFactor(){return this[Pu](),this[Tu].clearcoat}get clearcoatRoughnessFactor(){return this[Pu](),this[Tu].clearcoatRoughness}get clearcoatTexture(){return this[Pu](),this[Hu].get(_u.Clearcoat)}get clearcoatRoughnessTexture(){return this[Pu](),this[Hu].get(_u.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[Pu](),this[Hu].get(_u.ClearcoatNormal)}get clearcoatNormalScale(){return this[Pu](),this[Tu].clearcoatNormalScale.x}setClearcoatFactor(e){this[Pu]();for(const t of this[Vh])t.clearcoat=e;this[Hh]()}setClearcoatRoughnessFactor(e){this[Pu]();for(const t of this[Vh])t.clearcoatRoughness=e;this[Hh]()}setClearcoatNormalScale(e){this[Pu]();for(const t of this[Vh])t.clearcoatNormalScale=new Vector2(e,e);this[Hh]()}get ior(){return this[Pu](),this[Tu].ior}setIor(e){this[Pu]();for(const t of this[Vh])t.ior=e;this[Hh]()}get sheenColorFactor(){return this[Pu](),this[Tu].sheenColor.toArray()}get sheenColorTexture(){return this[Pu](),this[Hu].get(_u.SheenColor)}get sheenRoughnessFactor(){return this[Pu](),this[Tu].sheenRoughness}get sheenRoughnessTexture(){return this[Pu](),this[Hu].get(_u.SheenRoughness)}setSheenColorFactor(e){this[Pu]();const t=this.colorFromRgb(e);for(const e of this[Vh])e.sheenColor.set(t),e.sheen=1;this[Hh]()}setSheenRoughnessFactor(e){this[Pu]();for(const t of this[Vh])t.sheenRoughness=e,t.sheen=1;this[Hh]()}get transmissionFactor(){return this[Pu](),this[Tu].transmission}get transmissionTexture(){return this[Pu](),this[Hu].get(_u.Transmission)}setTransmissionFactor(e){this[Pu]();for(const t of this[Vh])t.transmission=e;this[Hh]()}get thicknessFactor(){return this[Pu](),this[Tu].thickness}get thicknessTexture(){return this[Pu](),this[Hu].get(_u.Thickness)}get attenuationDistance(){return this[Pu](),this[Tu].attenuationDistance}get attenuationColor(){return this[Pu](),this[Tu].attenuationColor.toArray()}setThicknessFactor(e){this[Pu]();for(const t of this[Vh])t.thickness=e;this[Hh]()}setAttenuationDistance(e){this[Pu]();for(const t of this[Vh])t.attenuationDistance=e;this[Hh]()}setAttenuationColor(e){this[Pu]();const t=this.colorFromRgb(e);for(const e of this[Vh])e.attenuationColor.set(t);this[Hh]()}get specularFactor(){return this[Pu](),this[Tu].specularIntensity}get specularTexture(){return this[Pu](),this[Hu].get(_u.Specular)}get specularColorFactor(){return this[Pu](),this[Tu].specularColor.toArray()}get specularColorTexture(){return this[Pu](),this[Hu].get(_u.SheenColor)}setSpecularFactor(e){this[Pu]();for(const t of this[Vh])t.specularIntensity=e;this[Hh]()}setSpecularColorFactor(e){this[Pu]();const t=this.colorFromRgb(e);for(const e of this[Vh])e.specularColor.set(t);this[Hh]()}get iridescenceFactor(){return this[Pu](),this[Tu].iridescence}get iridescenceTexture(){return this[Pu](),this[Hu].get(_u.Iridescence)}get iridescenceIor(){return this[Pu](),this[Tu].iridescenceIOR}get iridescenceThicknessMinimum(){return this[Pu](),this[Tu].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[Pu](),this[Tu].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[Pu](),this[Hu].get(_u.IridescenceThickness)}setIridescenceFactor(e){this[Pu]();for(const t of this[Vh])t.iridescence=e;this[Hh]()}setIridescenceIor(e){this[Pu]();for(const t of this[Vh])t.iridescenceIOR=e;this[Hh]()}setIridescenceThicknessMinimum(e){this[Pu]();for(const t of this[Vh])t.iridescenceThicknessRange[0]=e;this[Hh]()}setIridescenceThicknessMaximum(e){this[Pu]();for(const t of this[Vh])t.iridescenceThicknessRange[1]=e;this[Hh]()}get anisotropyStrength(){return this[Pu](),this[Tu].anisotropy}get anisotropyRotation(){return this[Pu](),this[Tu].anisotropyRotation}get anisotropyTexture(){return this[Pu](),this[Hu].get(_u.Anisotropy)}setAnisotropyStrength(e){this[Pu]();for(const t of this[Vh])t.anisotropy=e;this[Hh]()}setAnisotropyRotation(e){this[Pu]();for(const t of this[Vh])t.anisotropyRotation=e;this[Hh]()}}var zu=r(93e3);class primitive_node_Node{constructor(e){this.name="",this.children=new Array,this.name=e}}class PrimitiveNode extends primitive_node_Node{constructor(e,t,r,s){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:o,threeGLTF:l,threeObjectMap:c}=s;this.parser=l.parser,this.modelVariants=r,this.mesh.userData.variantData=r;const h=c.get(e.material);null!=h.materials?this.initialMaterialIdx=this.activeMaterialIdx=h.materials:zu.error(`Primitive (${e.name}) missing initial material reference.`);const d=e.userData.associations||{};if(null==d.meshes)return void zu.error("Mesh is missing primitive index association");const p=((o.meshes||[])[d.meshes].primitives||[])[d.primitives];if(null!=p){if(null!=p.material)this.materials.set(p.material,t[p.material]);else{const e=t.findIndex((e=>"Default"===e.name));e>=0?this.materials.set(e,t[e]):zu.warn("gltfPrimitive has no material!")}if(p.extensions&&p.extensions.KHR_materials_variants){const e=p.extensions.KHR_materials_variants,s=l.parser.json.extensions.KHR_materials_variants.variants;for(const o of e.mappings){const e=t[o.material];this.materials.set(o.material,e);for(const t of o.variants){const{name:o}=s[t];this.variantToMaterialMap.set(t,e),e[Qu]().add(t),r.has(o)||r.set(o,{name:o,index:t})}}}}else zu.error("Mesh primitive definition is missing.")}async setActiveMaterial(e){const t=this.materials.get(e);if(null!=t&&e!==this.activeMaterialIdx){this.mesh.material=await t[Uu]();const{normalScale:r}=this.mesh.material;null!=r&&r.y*r.x<0!=(null==this.mesh.geometry.attributes.tangent)&&this.parser.assignFinalMaterial(this.mesh),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){const t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;const r=await this.enableVariantHelper(e);null!=r&&(t.material=r)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});const r=this.modelVariants.get(t).index;return e[Qu]().add(r),this.variantToMaterialMap.set(r,e),this.materials.set(e.index,e),this.updateVariantUserData(r,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[Qu]().add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map;this.mesh.userData.variantMaterials.set(e,{material:t[Vh].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(zu.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}var Wu,qu,Xu,ju,Yu,Ku,Ju=r(93e3);const $u=Symbol("materials"),Zu=Symbol("hierarchy"),ed=Symbol("roots"),td=Symbol("primitives"),id=(Symbol("loadVariant"),Symbol("prepareVariantsForExport")),nd=Symbol("switchVariant"),rd=Symbol("materialFromPoint"),sd=Symbol("nodeFromPoint"),ad=Symbol("nodeFromIndex"),od=Symbol("variantData"),ld=Symbol("availableVariants"),cd=Symbol("modelOnUpdate"),hd=Symbol("cloneMaterial");class LazyLoader{constructor(e,t,r,s){this.gltf=e,this.gltfElementMap=t,this.mapKey=r,this.doLazyLoad=s}}class Model{constructor(e,t=(()=>{})){this[Wu]=new Array,this[qu]=new Array,this[Xu]=new Array,this[ju]=new Array,this[Yu]=()=>{},this[Ku]=new Map,this[cd]=t;const{gltf:r,threeGLTF:s,gltfElementMap:o}=e;for(const[e,l]of r.materials.entries()){const c=o.get(l);if(null!=c)this[$u].push(new material_Material(t,e,!0,this[od],c,l.name));else{const h=(r.materials||[])[e],d=e,materialLoadCallback=async()=>{const e=await s.parser.getDependency("material",d),t=new Set;return o.set(h,t),t.add(e),{set:t,material:e}};this[$u].push(new material_Material(t,e,!1,this[od],c,l.name,new LazyLoader(r,o,h,materialLoadCallback)))}}const l=new Map,c=new Array;for(const e of s.scene.children)c.push(e);for(;c.length>0;){const t=c.pop();let r=null;t instanceof three_module_Mesh?(r=new PrimitiveNode(t,this.materials,this[od],e),this[td].push(r)):r=new primitive_node_Node(t.name);const s=l.get(t);null!=s?s.children.push(r):this[ed].push(r),this[Zu].push(r);for(const e of t.children)c.push(e),l.set(t,r)}}get materials(){return this[$u]}[(Wu=$u,qu=Zu,Xu=ed,ju=td,Yu=cd,Ku=od,ld)](){const e=Array.from(this[od].values());return e.sort(((e,t)=>e.index-t.index)),e.map((e=>e.name))}getMaterialByName(e){const t=this[$u].filter((t=>t.name===e));return t.length>0?t[0]:null}[ad](e,t){const r=this[Zu].find((r=>{if(r instanceof PrimitiveNode){const{meshes:s,primitives:o}=r.mesh.userData.associations;if(s==e&&o==t)return!0}return!1}));return null==r?null:r}[sd](e){return this[Zu].find((t=>{if(t instanceof PrimitiveNode){if(t.mesh===e.object)return!0}return!1}))}[rd](e){return this[sd](e).getActiveMaterial()}async[nd](e){for(const t of this[td])await t.enableVariant(e);for(const e of this.materials)e[Nu](!1);for(const e of this[td])this.materials[e.getActiveMaterial().index][Nu](!0)}async[id](){const e=new Array;for(const t of this[td])e.push(t.instantiateVariants());await Promise.all(e)}[hd](e,t){const r=this.materials[e];r.isLoaded||Ju.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const s=r[Vh],o=new Set;for(const[e,r]of s.entries()){const l=r.clone();l.name=t+(s.size>1?"_inst"+e:""),o.add(l)}const l=new material_Material(this[cd],this[$u].length,!1,this[od],o,t);return this[$u].push(l),l}createMaterialInstanceForVariant(e,t,r,s=!0){let o=null;for(const s of this[td]){const l=this[od].get(r);null!=l&&s.variantInfo.has(l.index)||null!=s.getMaterial(e)&&(this.hasVariant(r)||this.createVariant(r),null==o&&(o=this[hd](e,t)),s.addVariant(o,r))}if(s&&null!=o){o[Nu](!0),this.materials[e][Nu](!1);for(const e of this[td])e.enableVariant(r)}return o}createVariant(e){this[od].has(e)?Ju.warn(`Variant '${e}'' already exists`):this[od].set(e,{name:e,index:this[od].size})}hasVariant(e){return this[od].has(e)}setMaterialToVariant(e,t){if(null!=this[ld]().find((e=>e===t)))if(e<0||e>=this.materials.length)Ju.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const r of this[td]){const s=r.getMaterial(e);null!=s&&r.addVariant(s,t)}else Ju.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const r=this[od].get(e);null!=r&&(r.name=t,this[od].set(t,r),this[od].delete(e))}deleteVariant(e){const t=this[od].get(e);if(null!=t){for(const r of this.materials)r.hasVariant(e)&&r[Gu].delete(t.index);for(const e of this[td])e.deleteVariant(t.index);this[od].delete(e)}}}var scene_graph_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const ud=Symbol("currentGLTF"),dd=Symbol("originalGltfJson"),pd=Symbol("model"),Ad=Symbol("getOnUpdateMethod"),md=Symbol("buildTexture");class GroundedSkybox extends three_module_Mesh{constructor(){super(void 0,new MeshBasicMaterial({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,t=this.radius,r=128){e==this.height&&t==this.radius&&r==this.resolution||(this.height=e,this.radius=t,this.resolution=r,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function makeGeometry(e,t,r){const s=new SphereGeometry(t,2*r,r);s.scale(1,1,-1);const o=s.getAttribute("position"),l=new three_module_Vector3;for(let t=0;t<o.count;++t)if(l.fromBufferAttribute(o,t),l.y<0){const r=3*-e/2,s=l.y<r?-e/l.y:1-l.y*l.y/(3*r*r);l.multiplyScalar(s),l.toArray(o.array,3*t)}return o.needsUpdate=!0,s}(e,t,r)))}}const gd=new three_module_Vector3,fd=new three_module_Vector3,_d=new three_module_Vector3,vd=new Matrix3,Ed=new Triangle,yd=new three_module_Quaternion;class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new three_module_Vector3(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;const t=Tl(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,Fl(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=Tl(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(e){if(!e&&this.initialized)return;const{mesh:t,tri:r,bary:s}=this;if(null==t||null==r||null==s)return;t.getVertexPosition(r.x,gd),t.getVertexPosition(r.y,fd),t.getVertexPosition(r.z,_d),gd.toArray(vd.elements,0),fd.toArray(vd.elements,3),_d.toArray(vd.elements,6),this.position.copy(s).applyMatrix3(vd);const o=this.parent;o.worldToLocal(t.localToWorld(this.position)),Ed.set(gd,fd,_d),Ed.getNormal(this.normal).transformDirection(t.matrixWorld);const l=o.parent;yd.setFromAxisAngle(gd.set(0,1,0),-l.yaw),this.normal.applyQuaternion(yd)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach((t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const r=t,s=r.dataset.visibilityAttribute;if(null!=s){const t=`data-${s}`;r.toggleAttribute(t,e)}r.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))})),this.initialized=!0}}const xd={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},Sd={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};r(93e3);Math.PI,Math.PI;function MathUtils_lerp(e,t,r){return(1-r)*e+r*t}class Shadow extends Object3D{constructor(e,t,r){super(),this.camera=new OrthographicCamera,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new MeshDepthMaterial,this.horizontalBlurMaterial=new ShaderMaterial(xd),this.verticalBlurMaterial=new ShaderMaterial(Sd),this.intensity=0,this.softness=1,this.boundingBox=new Box3,this.size=new three_module_Vector3,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:s}=this;s.rotation.x=Math.PI/2,s.left=-.5,s.right=.5,s.bottom=-.5,s.top=.5,this.add(s);const o=new PlaneGeometry,l=new MeshBasicMaterial({opacity:1,transparent:!0,side:A});this.floor=new three_module_Mesh(o,l),this.floor.userData.noHit=!0,s.add(this.floor),this.blurPlane=new three_module_Mesh(o),this.blurPlane.visible=!1,s.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,r)}setScene(e,t,r){const{boundingBox:s,size:o,rotation:l,position:c}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(o.x,o.y,o.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(c),"back"===r){const{min:e,max:t}=s;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[o.y,o.z]=[o.z,o.y],l.x=Math.PI/2,l.y=Math.PI}else l.x=0,l.y=0;if(this.isAnimated){const e=s.min.y,t=s.max.y;o.y=this.maxDimension,s.expandByVector(o.subScalar(this.maxDimension).multiplyScalar(-.5)),s.min.y=e,s.max.y=t,o.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===r?c.y=s.min.y:c.z=s.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:r}=this,s=this.isAnimated?2:1,o=s*Math.pow(2,9-3*e);this.setMapSize(o);const l=t.y/2,c=t.y*s;r.near=0,r.far=MathUtils_lerp(c,l,e),this.depthMaterial.opacity=1/e,r.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const r=Math.floor(t.x>t.z?e:e*t.x/t.z),s=Math.floor(t.x>t.z?e*t.z/t.x:e),o=10+r,l=10+s;if(null==this.renderTarget||this.renderTarget.width===o&&this.renderTarget.height===l||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:be};this.renderTarget=new WebGLRenderTarget(o,l,e),this.renderTargetBlur=new WebGLRenderTarget(o,l,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/r),t.z*(1+10/s),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*MathUtils_lerp(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return.001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;const r=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const s=e.xr.enabled;e.xr.enabled=!1;const o=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=s,e.setRenderTarget(o),e.setClearAlpha(r)}blurShadow(e){const{camera:t,horizontalBlurMaterial:r,verticalBlurMaterial:s,renderTarget:o,renderTargetBlur:l,blurPlane:c}=this;c.visible=!0,c.material=r,r.uniforms.h.value=1/this.renderTarget.width,r.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(l),e.render(c,t),c.material=s,s.uniforms.v.value=1/this.renderTarget.height,s.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(o),e.render(c,t),c.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}var Md=r(93e3);const Cd=new three_module_Vector3,bd=new three_module_Vector3,Id=new three_module_Vector3,wd=new class Raycaster{constructor(e,t,r=0,s=1/0){this.ray=new Ray(e,t),this.near=r,this.far=s,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):o.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,r=[]){return intersectObject(e,this,r,t),r.sort(ascSort),r}intersectObjects(e,t=!0,r=[]){for(let s=0,o=e.length;s<o;s++)intersectObject(e[s],this,r,t);return r.sort(ascSort),r}},Td=new three_module_Vector3,Bd=new Vector2;class ModelScene extends Scene{constructor({canvas:e,element:t,width:r,height:s}){super(),this.annotationRenderer=new CSS2DRenderer,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.camera=new PerspectiveCamera(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new Object3D,this.animationNames=[],this.boundingBox=new Box3,this.boundingSphere=new Sphere,this.size=new three_module_Vector3,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=ee,this.canScale=!0,this.isDirty=!1,this.goalTarget=new three_module_Vector3,this.targetDamperX=new Damper,this.targetDamperY=new Damper,this.targetDamperZ=new Damper,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new GroundedSkybox,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new PerspectiveCamera(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(r,s),this.target.name="Target",this.mixer=new three_module_AnimationMixer(this.target);const{domElement:o}=this.annotationRenderer,{style:l}=o;l.display="none",l.pointerEvents="none",l.position="absolute",l.top="0",this.element.shadowRoot.querySelector(".default").appendChild(o),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=(()=>{})){if(!e||e===this.url)return void t(1);if(this.reset(),this.url=e,null!=this.externalRenderer){const e=await this.externalRenderer.load(t);return this.boundingSphere.radius=e.framedRadius,void(this.idealAspect=e.fieldOfViewAspect)}let r;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{r=await new Promise((async(r,s)=>{this.cancelPendingSourceChange=()=>s();try{r(await this.element[Ep].loader.load(e,this.element,t))}catch(e){s(e)}}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=r,null!=r&&(this._model=r.scene,this.target.add(r.scene));const{animations:s}=r,o=new Map,l=[];for(const e of s)o.set(e.name,e),l.push(e.name);this.animations=s,this.animationsByName=o,this.animationNames=l,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);const t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[ud]=null,this.element[dd]=null,this.element[pd]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){const r=pa();this.externalRenderer.resize(e*r,t*r)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){const t=new Box3;e.traverse((e=>{const r=e;if(!r.material)return;if(!r.material.transparent)return;t.setFromObject(r);const s=t.getSize(Td),o=Math.min(s.x,s.y,s.z);Math.max(s.x,s.y,s.z)<100*o||this.markBakedShadow(r)}))}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,r=new Box3;this.boundingBox.getSize(this.size);for(const s of this.bakedShadows)r.setFromObject(s),r.min.y<e.y+this.size.y/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.z<=e.z&&r.max.z>=t.z||r.min.z<e.z+this.size.z/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.y<=e.y&&r.max.y>=t.y||this.unmarkBakedShadow(s)}applyTransform(){const{model:e}=this;if(null==e)return;const t=Tl(this.element.orientation)[0].terms,r=Fl(t[0]).number,s=Fl(t[1]).number,o=Fl(t[2]).number;e.quaternion.setFromEuler(new Euler(s,o,r,"YXZ"));const l=Tl(this.element.scale)[0].terms;e.scale.set(l[0].number,l[1].number,l[2].number)}updateBoundingBox(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);const bound=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=reduceVertices(e,bound,new Box3),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((e=>this.unmarkBakedShadow(e))),this.boundingBox=reduceVertices(e,bound,new Box3)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());this.boundingSphere.radius=Math.sqrt(reduceVertices(e,((e,r)=>Math.max(e,t.distanceToSquared(r))),0));this.idealAspect=reduceVertices(e,((e,r)=>{r.sub(t);const s=Math.sqrt(r.x*r.x+r.z*r.z);return Math.max(e,s/(this.idealCameraDistance()-Math.abs(r.y)))}),0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(const t of this.bakedShadows)t.visible=e}idealCameraDistance(){const e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){const t=Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(t)*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)Bd.set(e/window.screen.width,t/window.screen.height);else{const r=this.element.getBoundingClientRect();Bd.set((e-r.x)/this.width,(t-r.y)/this.height)}return Bd.multiplyScalar(2).subScalar(1),Bd.y*=-1,Bd}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[Ep].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){const e=Tl(this.element.skyboxHeight)[0].terms[0],t=Fl(e).number,r=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,r),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,r){this.goalTarget.set(-e,-t,-r)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,r=this.target.position;if(t.equals(r))return!1;{const s=this.boundingSphere.radius/10;let{x:o,y:l,z:c}=r;return o=this.targetDamperX.update(o,t.x,e,s),l=this.targetDamperY.update(l,t.y,e,s),c=this.targetDamperZ.update(c,t.z,e,s),this.target.position.set(o,l,c),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:r,z:s}=this.position;this.yaw=Math.atan2(e-r,t-s)}get model(){return this._model}set yaw(e){this.rotation.y=e,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){const e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop!==ze||1&~e?this.currentAnimationAction.time:this.duration-this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,r=2201,s=1/0){if(null==this._currentGLTF)return;const{animations:o}=this;if(null==o||0===o.length)return;let l=null;if(null!=e&&(l=this.animationsByName.get(e),null==l)){const t=parseInt(e);!isNaN(t)&&t>=0&&t<o.length&&(l=o[t])}null==l&&(l=o[0]);try{const{currentAnimationAction:e}=this,o=this.mixer.clipAction(l,this);this.currentAnimationAction=o,this.element.paused?this.mixer.stopAllAction():(o.paused=!1,null!=e&&o!==e?o.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),o.setLoop(r,s),o.enabled=!0,o.clampWhenFinished=!0,o.play()}catch(e){Md.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){const e=this.shadow;if(null!=e){const t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){const t=this.shadow;null!=t&&1==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,null!=this._currentGLTF&&(this.setBakedShadowVisibility(),!(e<=0&&null==this.shadow))){if(null==this.shadow){const e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new Shadow(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){const t=this.shadow;null!=t&&t.setOffset(e)}hitFromPoint(e,t=this){wd.setFromCamera(e,this.getCamera());return wd.intersectObject(t,!0).find((e=>e.object.visible&&!e.object.userData.noHit))}positionAndNormalFromPoint(e,t=this){var r;const s=this.hitFromPoint(e,t);if(null==s)return null;return{position:s.point,normal:null!=s.face?s.face.normal.clone().applyNormalMatrix((new Matrix3).getNormalMatrix(s.object.matrixWorld)):wd.ray.direction.clone().multiplyScalar(-1),uv:null!==(r=s.uv)&&void 0!==r?r:null}}surfaceFromPoint(e,t=this){const r=this.element.model;if(null==r)return null;const s=this.hitFromPoint(e,t);if(null==s||null==s.face)return null;const o=r[sd](s),{meshes:l,primitives:c}=o.mesh.userData.associations,h=new three_module_Vector3,d=new three_module_Vector3,p=new three_module_Vector3,{a:A,b:m,c:g}=s.face,f=s.object;f.getVertexPosition(A,h),f.getVertexPosition(m,d),f.getVertexPosition(g,p);const _=new Triangle(h,d,p),E=new three_module_Vector3;return _.getBarycoord(f.worldToLocal(s.point),E),`${l} ${c} ${A} ${m} ${g} ${E.x.toFixed(3)} ${E.y.toFixed(3)} ${E.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element)}removeHotspot(e){this.target.remove(e)}forHotspots(e){const{children:t}=this.target;for(let r=0,s=t.length;r<s;r++){const s=t[r];s instanceof Hotspot&&e(s)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){const t=Tl(e.surface)[0].terms;if(8!=t.length)return void Md.warn(e.surface+" does not have exactly 8 numbers.");const r=this.element.model[ad](t[0].number,t[1].number),s=new three_module_Vector3(t[2].number,t[3].number,t[4].number);if(null==r)return void Md.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const o=r.mesh.geometry.attributes.position.count;if(s.x>=o||s.y>=o||s.z>=o)return void Md.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const l=new three_module_Vector3(t[5].number,t[6].number,t[7].number);e.mesh=r.mesh,e.tri=s,e.bary=l}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots((t=>{this.initializeSurface(t),t.updateSurface(e)}))}updateHotspotsVisibility(e){this.forHotspots((t=>{Cd.copy(e),bd.setFromMatrixPosition(t.matrixWorld),Cd.sub(bd),Id.copy(t.normal).transformDirection(this.target.matrixWorld),Cd.dot(Id)<0?t.hide():t.show()}))}orientHotspots(e){this.forHotspots((t=>{t.orient(e)}))}setHotspotsVisibility(e){this.forHotspots((t=>{t.visible=e}))}updateSchema(e){var t;const{schemaElement:r,element:s}=this,{alt:o,poster:l,iosSrc:c}=s;if(null!=e){const s=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];c&&s.push({"@type":"MediaObject",contentUrl:c,encodingFormat:"model/vnd.usdz+zip"});const h={"@context":"http://schema.org/","@type":"3DModel",image:null!=l?l:void 0,name:null!=o?o:void 0,encoding:s};r.textContent=JSON.stringify(h),document.head.appendChild(r)}else null!=r.parentElement&&r.parentElement.removeChild(r)}}class ProgressTracker extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),r=>{let s;return s=Math.max(utilities_clamp(r,0,1),t.progress),s!==t.progress&&this.announceTotalProgress(t,s,e),t.progress}}announceTotalProgress(e,t,r){let s=0,o=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;s+=1-t,e.completed&&o++}const l=e.progress;e.progress=t,this.totalProgress+=(t-l)*(1-this.totalProgress)/s;const c=o===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:c,reason:r}})),o===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var Rd,Ld,Dd,Ud,Pd,Fd,Nd,Qd,Od,Gd,kd,Vd,Hd,zd=r(93e3),model_viewer_base_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Wd=document.createElement("canvas"),qd=Symbol("fallbackResizeHandler"),Xd=Symbol("defaultAriaLabel"),jd=Symbol("resizeObserver"),Yd=Symbol("clearModelTimeout"),Kd=Symbol("onContextLost"),Jd=Symbol("loaded"),$d=Symbol("status"),Zd=Symbol("onFocus"),ep=Symbol("onBlur"),tp=Symbol("updateSize"),ip=Symbol("intersectionObserver"),np=Symbol("isElementInViewport"),rp=Symbol("announceModelVisibility"),sp=Symbol("ariaLabel"),ap=Symbol("altDefaulted"),op=Symbol("statusElement"),lp=Symbol("updateStatus"),cp=Symbol("loadedTime"),hp=Symbol("updateSource"),up=Symbol("markLoaded"),dp=Symbol("container"),pp=Symbol("input"),Ap=Symbol("canvas"),mp=Symbol("scene"),gp=Symbol("needsRender"),fp=Symbol("tick"),_p=Symbol("onModelLoad"),vp=Symbol("onResize"),Ep=Symbol("renderer"),yp=Symbol("progressTracker"),xp=Symbol("getLoaded"),Sp=Symbol("getModelIsVisible"),Mp=Symbol("shouldAttemptPreload"),toVector3D=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),toVector2D=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class ModelViewerElementBase extends reactive_element_a{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[Rd]=!1,this[Ld]=!1,this[Dd]=0,this[Ud]="",this[Pd]=null,this[Fd]=debounce((()=>{const e=this.getBoundingClientRect();this[tp](e)}),50),this[Nd]=debounce((e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))}),0),this[Qd]=null,this[Od]=null,this[Gd]=new ProgressTracker,this[kd]=()=>{this[op].textContent=this[$d]},this[Vd]=()=>{this[op].textContent=""},this[Hd]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,r;if((e=>{D(va,e)})(e),this[dp]=e.querySelector(".container"),this[pp]=e.querySelector(".userInput"),this[Ap]=e.querySelector("canvas"),this[op]=e.querySelector("#status"),this[Xd]=this[pp].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,r=e.height}else t=300,r=150;this[mp]=new ModelScene({canvas:this[Ap],element:this,width:t,height:r}),Promise.resolve().then((()=>{this[tp](this.getBoundingClientRect())})),ia&&(this[jd]=new ResizeObserver((e=>{if(!this[Ep].isPresenting)for(let t of e)t.target===this&&this[tp](t.contentRect)}))),na?this[ip]=new IntersectionObserver((e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[np]=t.isIntersecting,this[rp](e),this[np]&&!this.loaded&&this[hp]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[np]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[Go].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[Go].evictionThreshold}static set minimumRenderScale(e){e>1&&zd.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&zd.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Renderer.singleton.minScale=e}static get minimumRenderScale(){return Renderer.singleton.minScale}get loaded(){return this[xp]()}get[(Rd=np,Ld=Jd,Dd=cp,Ud=$d,Pd=Yd,Fd=qd,Nd=rp,Qd=jd,Od=ip,Gd=yp,Ep)](){return Renderer.singleton}get modelIsVisible(){return this[Sp]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),ia?this[jd].observe(this):self.addEventListener("resize",this[qd]),na&&this[ip].observe(this),this.addEventListener("focus",this[Zd]),this.addEventListener("blur",this[ep]);const e=this[Ep];e.addEventListener("contextlost",this[Kd]),e.registerScene(this[mp]),null!=this[Yd]&&(self.clearTimeout(this[Yd]),this[Yd]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),ia?this[jd].unobserve(this):self.removeEventListener("resize",this[qd]),na&&this[ip].unobserve(this),this.removeEventListener("focus",this[Zd]),this.removeEventListener("blur",this[ep]);const e=this[Ep];e.removeEventListener("contextlost",this[Kd]),e.unregisterScene(this[mp]),this[Yd]=self.setTimeout((()=>{this[mp].dispose(),this[Yd]=null}),10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[Jd]=!1,this[cp]=0,this[mp].reset()):this.src!==this[mp].url&&(this[Jd]=!1,this[cp]=0,this[hp]())),e.has("alt")&&this[pp].setAttribute("aria-label",this[sp]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[Ep].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[mp].updateSchema(this.src):this[mp].updateSchema(null))}toDataURL(e,t){return this[Ep].displayCanvas(this[mp]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,r=e?e.qualityArgument:void 0,s=e?e.idealAspect:void 0,{width:o,height:l,idealAspect:c,aspect:h}=this[mp],{dpr:d,scaleFactor:p}=this[Ep];let A=o*p*d,m=l*p*d,g=0,f=0;if(!0===s)if(c>h){const e=m;m=Math.round(A/c),f=(e-m)/2}else{const e=A;A=Math.round(m*c),g=(e-A)/2}Wd.width=A,Wd.height=m;try{return new Promise((async(e,s)=>{Wd.getContext("2d").drawImage(this[Ep].displayCanvas(this[mp]),g,f,A,m,0,0,A,m),Wd.toBlob((t=>{if(!t)return s(new Error("Unable to retrieve canvas blob"));e(t)}),t,r)}))}finally{this[tp]({width:o,height:l})}}registerEffectComposer(e){e.setRenderer(this[Ep].threeRenderer),e.setMainCamera(this[mp].getCamera()),e.setMainScene(this[mp]),this[mp].effectRenderer=e}unregisterEffectComposer(){this[mp].effectRenderer=null}registerRenderer(e){this[mp].externalRenderer=e}unregisterRenderer(){this[mp].externalRenderer=null}get[sp](){return this[ap]}get[ap](){return null==this.alt||"null"===this.alt?this[Xd]:this.alt}[xp](){return this[Jd]}[Sp](){return this.loaded&&this[np]}[Mp](){return!!this.src&&this[np]}[tp]({width:e,height:t}){0!==e&&0!==t&&(this[dp].style.width=`${e}px`,this[dp].style.height=`${t}px`,this[vp]({width:e,height:t}))}[fp](e,t){var r;null===(r=this[mp].effectRenderer)||void 0===r||r.beforeRender(e,t)}[up](){this[Jd]||(this[Jd]=!0,this[cp]=performance.now())}[gp](){this[mp].queueRender()}[_p](){}[lp](e){this[$d]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[op].textContent!=e&&(this[op].textContent=e)}[(kd=Zd,Vd=ep,vp)](e){this[mp].setSize(e.width,e.height)}async[(Hd=Kd,hp)](){const e=this[mp];if(this.loaded||!this[Mp]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[lp]("Loading"),e.stopAnimation();const t=this[yp].beginActivity("model-load"),r=this.src;try{const s=e.setSource(r,(e=>t(.95*utilities_clamp(e,0,1)))),o=this[fa]();await Promise.all([s,o]),this[up](),this[_p](),this.updateComplete.then((()=>{this.dispatchEvent(new CustomEvent("before-render"))})),await new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:r}})),e()}))}))}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}}model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"alt",void 0),model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"src",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"with-credentials"})],ModelViewerElementBase.prototype,"withCredentials",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"generate-schema"})],ModelViewerElementBase.prototype,"generateSchema",void 0);var animation_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Cp=Symbol("changeAnimation"),bp=Symbol("paused"),Ip={repetitions:1/0,pingpong:!1},wp=Symbol("hotspotMap"),Tp=Symbol("mutationCallback"),Bp=Symbol("observer"),Rp=Symbol("addHotspot"),Lp=Symbol("removeHotspot"),Dp=new three_module_Matrix4;var durl=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(durl(""))}catch(e){durl=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},function(e){return new Worker(e,{type:"module"})}}var Up=Uint8Array,Pp=Uint16Array,Fp=Uint32Array,Np=new Up([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Qp=new Up([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Op=new Up([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(e,t){for(var r=new Pp(31),s=0;s<31;++s)r[s]=t+=1<<e[s-1];var o=new Fp(r[30]);for(s=1;s<30;++s)for(var l=r[s];l<r[s+1];++l)o[l]=l-r[s]<<5|s;return[r,o]},Gp=freb(Np,2),kp=Gp[0],Vp=Gp[1];kp[28]=258,Vp[258]=28;for(var Hp=freb(Qp,0),zp=(Hp[0],Hp[1]),Wp=new Pp(32768),qp=0;qp<32768;++qp){var Xp=(43690&qp)>>>1|(21845&qp)<<1;Xp=(61680&(Xp=(52428&Xp)>>>2|(13107&Xp)<<2))>>>4|(3855&Xp)<<4,Wp[qp]=((65280&Xp)>>>8|(255&Xp)<<8)>>>1}var hMap=function(e,t,r){for(var s=e.length,o=0,l=new Pp(t);o<s;++o)++l[e[o]-1];var c,h=new Pp(t);for(o=0;o<t;++o)h[o]=h[o-1]+l[o-1]<<1;if(r){c=new Pp(1<<t);var d=15-t;for(o=0;o<s;++o)if(e[o])for(var p=o<<4|e[o],A=t-e[o],m=h[e[o]-1]++<<A,g=m|(1<<A)-1;m<=g;++m)c[Wp[m]>>>d]=p}else for(c=new Pp(s),o=0;o<s;++o)e[o]&&(c[o]=Wp[h[e[o]-1]++]>>>15-e[o]);return c},jp=new Up(288);for(qp=0;qp<144;++qp)jp[qp]=8;for(qp=144;qp<256;++qp)jp[qp]=9;for(qp=256;qp<280;++qp)jp[qp]=7;for(qp=280;qp<288;++qp)jp[qp]=8;var Yp=new Up(32);for(qp=0;qp<32;++qp)Yp[qp]=5;var Kp=hMap(jp,9,0),Jp=hMap(Yp,5,0),shft=function(e){return(e/8|0)+(7&e&&1)},slc=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var s=new(e instanceof Pp?Pp:e instanceof Fp?Fp:Up)(r-t);return s.set(e.subarray(t,r)),s},wbits=function(e,t,r){r<<=7&t;var s=t/8|0;e[s]|=r,e[s+1]|=r>>>8},wbits16=function(e,t,r){r<<=7&t;var s=t/8|0;e[s]|=r,e[s+1]|=r>>>8,e[s+2]|=r>>>16},hTree=function(e,t){for(var r=[],s=0;s<e.length;++s)e[s]&&r.push({s,f:e[s]});var o=r.length,l=r.slice();if(!o)return[Zp,0];if(1==o){var c=new Up(r[0].s+1);return c[r[0].s]=1,[c,1]}r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var h=r[0],d=r[1],p=0,A=1,m=2;for(r[0]={s:-1,f:h.f+d.f,l:h,r:d};A!=o-1;)h=r[r[p].f<r[m].f?p++:m++],d=r[p!=A&&r[p].f<r[m].f?p++:m++],r[A++]={s:-1,f:h.f+d.f,l:h,r:d};var g=l[0].s;for(s=1;s<o;++s)l[s].s>g&&(g=l[s].s);var f=new Pp(g+1),_=fflate_module_ln(r[A-1],f,0);if(_>t){s=0;var E=0,y=_-t,x=1<<y;for(l.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));s<o;++s){var S=l[s].s;if(!(f[S]>t))break;E+=x-(1<<_-f[S]),f[S]=t}for(E>>>=y;E>0;){var C=l[s].s;f[C]<t?E-=1<<t-f[C]++-1:++s}for(;s>=0&&E;--s){var b=l[s].s;f[b]==t&&(--f[b],++E)}_=t}return[new Up(f),_]},fflate_module_ln=function(e,t,r){return-1==e.s?Math.max(fflate_module_ln(e.l,t,r+1),fflate_module_ln(e.r,t,r+1)):t[e.s]=r},lc=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Pp(++t),s=0,o=e[0],l=1,w=function(e){r[s++]=e},c=1;c<=t;++c)if(e[c]==o&&c!=t)++l;else{if(!o&&l>2){for(;l>138;l-=138)w(32754);l>2&&(w(l>10?l-11<<5|28690:l-3<<5|12305),l=0)}else if(l>3){for(w(o),--l;l>6;l-=6)w(8304);l>2&&(w(l-3<<5|8208),l=0)}for(;l--;)w(o);l=1,o=e[c]}return[r.subarray(0,s),t]},clen=function(e,t){for(var r=0,s=0;s<t.length;++s)r+=e[s]*t[s];return r},wfblk=function(e,t,r){var s=r.length,o=shft(t+2);e[o]=255&s,e[o+1]=s>>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var l=0;l<s;++l)e[o+l+4]=r[l];return 8*(o+4+s)},wblk=function(e,t,r,s,o,l,c,h,d,p,A){wbits(t,A++,r),++o[256];for(var m=hTree(o,15),g=m[0],f=m[1],_=hTree(l,15),E=_[0],y=_[1],x=lc(g),S=x[0],C=x[1],b=lc(E),I=b[0],T=b[1],B=new Pp(19),U=0;U<S.length;++U)B[31&S[U]]++;for(U=0;U<I.length;++U)B[31&I[U]]++;for(var F=hTree(B,7),Q=F[0],O=F[1],G=19;G>4&&!Q[Op[G-1]];--G);var W,q,X,j,Y=p+5<<3,K=clen(o,jp)+clen(l,Yp)+c,J=clen(o,g)+clen(l,E)+c+14+3*G+clen(B,Q)+(2*B[16]+3*B[17]+7*B[18]);if(Y<=K&&Y<=J)return wfblk(t,A,e.subarray(d,d+p));if(wbits(t,A,1+(J<K)),A+=2,J<K){W=hMap(g,f,0),q=g,X=hMap(E,y,0),j=E;var $=hMap(Q,O,0);wbits(t,A,C-257),wbits(t,A+5,T-1),wbits(t,A+10,G-4),A+=14;for(U=0;U<G;++U)wbits(t,A+3*U,Q[Op[U]]);A+=3*G;for(var ee=[S,I],te=0;te<2;++te){var ie=ee[te];for(U=0;U<ie.length;++U){var ne=31&ie[U];wbits(t,A,$[ne]),A+=Q[ne],ne>15&&(wbits(t,A,ie[U]>>>5&127),A+=ie[U]>>>12)}}}else W=Kp,q=jp,X=Jp,j=Yp;for(U=0;U<h;++U)if(s[U]>255){ne=s[U]>>>18&31;wbits16(t,A,W[ne+257]),A+=q[ne+257],ne>7&&(wbits(t,A,s[U]>>>23&31),A+=Np[ne]);var re=31&s[U];wbits16(t,A,X[re]),A+=j[re],re>3&&(wbits16(t,A,s[U]>>>5&8191),A+=Qp[re])}else wbits16(t,A,W[s[U]]),A+=q[s[U]];return wbits16(t,A,W[256]),A+q[256]},$p=new Fp([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Zp=new Up(0),dflt=function(e,t,r,s,o,l){var c=e.length,h=new Up(s+c+5*(1+Math.ceil(c/7e3))+o),d=h.subarray(s,h.length-o),p=0;if(!t||c<8)for(var A=0;A<=c;A+=65535){var m=A+65535;m<c?p=wfblk(d,p,e.subarray(A,m)):(d[A]=l,p=wfblk(d,p,e.subarray(A,c)))}else{for(var g=$p[t-1],f=g>>>13,_=8191&g,E=(1<<r)-1,y=new Pp(32768),x=new Pp(E+1),S=Math.ceil(r/3),C=2*S,hsh=function(t){return(e[t]^e[t+1]<<S^e[t+2]<<C)&E},b=new Fp(25e3),I=new Pp(288),T=new Pp(32),B=0,U=0,F=(A=0,0),Q=0,O=0;A<c;++A){var G=hsh(A),W=32767&A,q=x[G];if(y[W]=q,x[G]=W,Q<=A){var X=c-A;if((B>7e3||F>24576)&&X>423){p=wblk(e,d,0,b,I,T,U,F,O,A-O,p),F=B=U=0,O=A;for(var j=0;j<286;++j)I[j]=0;for(j=0;j<30;++j)T[j]=0}var Y=2,K=0,J=_,$=W-q&32767;if(X>2&&G==hsh(A-$))for(var ee=Math.min(f,X)-1,te=Math.min(32767,A),ie=Math.min(258,X);$<=te&&--J&&W!=q;){if(e[A+Y]==e[A+Y-$]){for(var ne=0;ne<ie&&e[A+ne]==e[A+ne-$];++ne);if(ne>Y){if(Y=ne,K=$,ne>ee)break;var re=Math.min($,ne-2),se=0;for(j=0;j<re;++j){var ae=A-$+j+32768&32767,oe=ae-y[ae]+32768&32767;oe>se&&(se=oe,q=ae)}}}$+=(W=q)-(q=y[W])+32768&32767}if(K){b[F++]=268435456|Vp[Y]<<18|zp[K];var le=31&Vp[Y],ce=31&zp[K];U+=Np[le]+Qp[ce],++I[257+le],++T[ce],Q=A+Y,++B}else b[F++]=e[A],++I[e[A]]}}p=wblk(e,d,l,b,I,T,U,F,O,A-O,p),!l&&7&p&&(p=wfblk(d,p+1,Zp))}return slc(h,0,s+shft(p)+o)},eA=function(){for(var e=new Fp(256),t=0;t<256;++t){for(var r=t,s=9;--s;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),crc=function(){var e=-1;return{p:function(t){for(var r=e,s=0;s<t.length;++s)r=eA[255&r^t[s]]^r>>>8;e=r},d:function(){return~e}}},dopt=function(e,t,r,s,o){return dflt(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,s,!o)},mrg=function(e,t){var r={};for(var s in e)r[s]=e[s];for(var s in t)r[s]=t[s];return r},wbytes=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function deflateSync(e,t){return dopt(e,t||{},0,0)}var fltn=function(e,t,r,s){for(var o in e){var l=e[o],c=t+o;l instanceof Up?r[c]=[l,s]:Array.isArray(l)?r[c]=[l[0],mrg(s,l[1])]:fltn(l,c+"/",r,s)}},tA="undefined"!=typeof TextEncoder&&new TextEncoder,iA="undefined"!=typeof TextDecoder&&new TextDecoder;try{iA.decode(Zp,{stream:!0}),1}catch(e){}function strToU8(e,t){if(t){for(var r=new Up(e.length),s=0;s<e.length;++s)r[s]=e.charCodeAt(s);return r}if(tA)return tA.encode(e);var o=e.length,l=new Up(e.length+(e.length>>1)),c=0,w=function(e){l[c++]=e};for(s=0;s<o;++s){if(c+5>l.length){var h=new Up(c+8+(o-s<<1));h.set(l),l=h}var d=e.charCodeAt(s);d<128||t?w(d):d<2048?(w(192|d>>6),w(128|63&d)):d>55295&&d<57344?(w(240|(d=65536+(1047552&d)|1023&e.charCodeAt(++s))>>18),w(128|d>>12&63),w(128|d>>6&63),w(128|63&d)):(w(224|d>>12),w(128|d>>6&63),w(128|63&d))}return slc(l,0,c)}var exfl=function(e){var t=0;if(e)for(var r in e){var s=e[r].length;if(s>65535)throw"extra field too long";t+=s+4}return t},wzh=function(e,t,r,s,o,l,c,h){var d=s.length,p=r.extra,A=h&&h.length,m=exfl(p);wbytes(e,t,null!=c?33639248:67324752),t+=4,null!=c&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(null==l&&8),e[t++]=o&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8;var g=new Date(null==r.mtime?Date.now():r.mtime),f=g.getFullYear()-1980;if(f<0||f>119)throw"date not in range 1980-2099";if(wbytes(e,t,f<<25|g.getMonth()+1<<21|g.getDate()<<16|g.getHours()<<11|g.getMinutes()<<5|g.getSeconds()>>>1),t+=4,null!=l&&(wbytes(e,t,r.crc),wbytes(e,t+4,l),wbytes(e,t+8,r.size)),wbytes(e,t+12,d),wbytes(e,t+14,m),t+=16,null!=c&&(wbytes(e,t,A),wbytes(e,t+6,r.attrs),wbytes(e,t+10,c),t+=14),e.set(s,t),t+=d,m)for(var _ in p){var E=p[_],y=E.length;wbytes(e,t,+_),wbytes(e,t+2,y),e.set(E,t+4),t+=4+y}return A&&(e.set(h,t),t+=A),t},wzf=function(e,t,r,s,o){wbytes(e,t,101010256),wbytes(e,t+8,r),wbytes(e,t+10,r),wbytes(e,t+12,s),wbytes(e,t+16,o)};var nA=r(93e3);class USDZExporter{async parse(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1},t);const r={},s="model.usda";r[s]=null;let o=buildHeader();o+=function buildSceneStart(e){return`def Xform "Root"\n{\n\tdef Scope "Scenes" (\n\t\tkind = "sceneLibrary"\n\t)\n\t{\n\t\tdef Xform "Scene" (\n\t\t\tcustomData = {\n\t\t\t\tbool preliminary_collidesWithEnvironment = 0\n\t\t\t\tstring sceneName = "Scene"\n\t\t\t}\n\t\t\tsceneName = "Scene"\n\t\t)\n\t\t{\n\t\ttoken preliminary:anchoring:type = "${e.ar.anchoring.type}"\n\t\ttoken preliminary:planeAnchoring:alignment = "${e.ar.planeAnchoring.alignment}"\n\n`}(t);const l={},c={};e.traverseVisible((e=>{if(e.isMesh){const t=e.geometry,s=e.material;if(s.isMeshStandardMaterial){const c="geometries/Geometry_"+t.id+".usda";if(!(c in r)){const e=function buildMeshObject(e){const t=function buildMesh(e){const t="Geometry",r=e.attributes,s=r.position.count;return`\n\tdef Mesh "${t}"\n\t{\n\t\tint[] faceVertexCounts = [${function buildMeshVertexCount(e){const t=null!==e.index?e.index.count:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}(e)}]\n\t\tint[] faceVertexIndices = [${function buildMeshVertexIndices(e){const t=e.index,r=[];if(null!==t)for(let e=0;e<t.count;e++)r.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)r.push(e)}return r.join(", ")}(e)}]\n\t\tnormal3f[] normals = [${buildVector3Array(r.normal,s)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)\n\t\tpoint3f[] points = [${buildVector3Array(r.position,s)}]\n${function buildPrimvars(e){let t="";for(let r=0;r<4;r++){const s=r>0?r:"",o=e["uv"+s];void 0!==o&&(t+=`\n\t\ttexCoord2f[] primvars:st${s} = [${buildVector2Array(o)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)`)}return t}(r)}\n\t\tuniform token subdivisionScheme = "none"\n\t}\n`}(e);return`\ndef "Geometry"\n{\n${t}\n}\n`}(t);r[c]=function buildUSDFileAsString(e){let t=buildHeader();return t+=e,strToU8(t)}(e)}s.uuid in l||(l[s.uuid]=s),o+=function buildXform(e,t,r){const s="Object_"+e.id,o=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&nA.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return`def Xform "${s}" (\n\tprepend references = @./geometries/Geometry_${t.id}.usda@</Geometry>\n\tprepend apiSchemas = ["MaterialBindingAPI"]\n)\n{\n\tmatrix4d xformOp:transform = ${o}\n\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\trel material:binding = </Materials/Material_${r.id}>\n}\n\n`}(e,t,s)}else nA.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",e)}else e.isCamera&&(o+=function buildCamera(e){const t=e.name?e.name:"Camera_"+e.id,r=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&nA.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return e.isOrthographicCamera?`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${r}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(rA)}, ${e.far.toPrecision(rA)})\n\t\t\tfloat horizontalAperture = ${(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(rA)}\n\t\t\tfloat verticalAperture = ${(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(rA)}\n\t\t\ttoken projection = "orthographic"\n\t\t}\n\t\n\t`:`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${r}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(rA)}, ${e.far.toPrecision(rA)})\n\t\t\tfloat focalLength = ${e.getFocalLength().toPrecision(rA)}\n\t\t\tfloat focusDistance = ${e.focus.toPrecision(rA)}\n\t\t\tfloat horizontalAperture = ${e.getFilmWidth().toPrecision(rA)}\n\t\t\ttoken projection = "perspective"\n\t\t\tfloat verticalAperture = ${e.getFilmHeight().toPrecision(rA)}\n\t\t}\n\t\n\t`}(e))})),o+="\n\t\t}\n\t}\n}\n\n",o+=function buildMaterials(e,t,r=!1){const s=[];for(const o in e){const l=e[o];s.push(buildMaterial(l,t,r))}return`def "Materials"\n{\n${s.join("")}\n}\n\n`}(l,c,t.quickLookCompatible),r[s]=strToU8(o),o=null;for(const e in c){let t=c[e];!0===t.isCompressedTexture&&(t=decompress(t));const s=imageToCanvas(t.image,t.flipY),o=await new Promise((e=>s.toBlob(e,"image/png",1)));r[`textures/Texture_${e}.png`]=new Uint8Array(await o.arrayBuffer())}let h=0;for(const e in r){const t=r[e];h+=34+e.length;const s=63&h;if(4!==s){const o=new Uint8Array(64-s);r[e]=[t,{extra:{12345:o}}]}h=t.length}return function zipSync(e,t){t||(t={});var r={},s=[];fltn(e,"",r,t);var o=0,l=0;for(var c in r){var h=r[c],d=h[0],p=h[1],A=0==p.level?0:8,m=(B=strToU8(c)).length,g=p.comment,f=g&&strToU8(g),_=f&&f.length,E=exfl(p.extra);if(m>65535)throw"filename too long";var y=A?deflateSync(d,p):d,x=y.length,S=crc();S.p(d),s.push(mrg(p,{size:d.length,crc:S.d(),c:y,f:B,m:f,u:m!=c.length||f&&g.length!=_,o,compression:A})),o+=30+m+E+x,l+=76+2*(m+E)+(_||0)+x}for(var C=new Up(l+22),b=o,I=l-o,T=0;T<s.length;++T){var B=s[T];wzh(C,B.o,B,B.f,B.u,B.c.length);var U=30+B.f.length+exfl(B.extra);C.set(B.c,B.o+U),wzh(C,o,B,B.f,B.u,B.c.length,B.o,B.m),o+=16+U+(B.m?B.m.length:0)}return wzf(C,o,s.length,I,b),C}(r,{level:0})}}function imageToCanvas(e,t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=1024/Math.max(e.width,e.height),s=document.createElement("canvas");s.width=e.width*Math.min(1,r),s.height=e.height*Math.min(1,r);const o=s.getContext("2d");return!0===t&&(o.translate(0,s.height),o.scale(1,-1)),o.drawImage(e,0,0,s.width,s.height),s}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const rA=7;function buildHeader(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n\n'}function buildMatrix(e){const t=e.elements;return`( ${buildMatrixRow(t,0)}, ${buildMatrixRow(t,4)}, ${buildMatrixRow(t,8)}, ${buildMatrixRow(t,12)} )`}function buildMatrixRow(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function buildVector3Array(e,t){if(void 0===e)return nA.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const r=[];for(let t=0;t<e.count;t++){const s=e.getX(t),o=e.getY(t),l=e.getZ(t);r.push(`(${s.toPrecision(rA)}, ${o.toPrecision(rA)}, ${l.toPrecision(rA)})`)}return r.join(", ")}function buildVector2Array(e){const t=[];for(let r=0;r<e.count;r++){const s=e.getX(r),o=e.getY(r);t.push(`(${s.toPrecision(rA)}, ${1-o.toPrecision(rA)})`)}return t.join(", ")}function buildMaterial(e,t,r=!1){const s="\t\t\t",o=[],l=[];function buildTexture(s,o,l){const c=s.source.id+"_"+s.flipY;t[c]=s;const h=s.channel>0?"st"+s.channel:"st",d={1e3:"repeat",1001:"clamp",1002:"mirror"},p=s.repeat.clone(),A=s.offset.clone(),m=s.rotation,g=Math.sin(m),f=Math.cos(m);return A.y=1-A.y-p.y,r?(A.x=A.x/p.x,A.y=A.y/p.y,A.x+=g/p.x,A.y+=f-1):(A.x+=g*p.x,A.y+=(1-f)*p.y),`\n\t\tdef Shader "PrimvarReader_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdPrimvarReader_float2"\n\t\t\tfloat2 inputs:fallback = (0.0, 0.0)\n\t\t\ttoken inputs:varname = "${h}"\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Transform2d_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdTransform2d"\n\t\t\ttoken inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${o}.outputs:result>\n\t\t\tfloat inputs:rotation = ${(m*(180/Math.PI)).toFixed(rA)}\n\t\t\tfloat2 inputs:scale = ${buildVector2(p)}\n\t\t\tfloat2 inputs:translation = ${buildVector2(A)}\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Texture_${s.id}_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdUVTexture"\n\t\t\tasset inputs:file = @textures/Texture_${c}.png@\n\t\t\tfloat2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${o}.outputs:result>\n\t\t\t${void 0!==l?"float4 inputs:scale = "+function buildColor4(e){return`(${e.r}, ${e.g}, ${e.b}, 1.0)`}(l):""}\n\t\t\ttoken inputs:sourceColorSpace = "${s.colorSpace===Ze?"raw":"sRGB"}"\n\t\t\ttoken inputs:wrapS = "${d[s.wrapS]}"\n\t\t\ttoken inputs:wrapT = "${d[s.wrapT]}"\n\t\t\tfloat outputs:r\n\t\t\tfloat outputs:g\n\t\t\tfloat outputs:b\n\t\t\tfloat3 outputs:rgb\n\t\t\t${e.transparent||e.alphaTest>0?"float outputs:a":""}\n\t\t}`}return e.side===m&&nA.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(o.push(`${s}color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),o.push(`${s}float inputs:opacityThreshold = ${e.alphaTest}`)),l.push(buildTexture(e.map,"diffuse",e.color))):o.push(`${s}color3f inputs:diffuseColor = ${buildColor(e.color)}`),null!==e.emissiveMap?(o.push(`${s}color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`),l.push(buildTexture(e.emissiveMap,"emissive"))):e.emissive.getHex()>0&&o.push(`${s}color3f inputs:emissiveColor = ${buildColor(e.emissive)}`),null!==e.normalMap&&(o.push(`${s}normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),l.push(buildTexture(e.normalMap,"normal"))),null!==e.aoMap&&(o.push(`${s}float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`),l.push(buildTexture(e.aoMap,"occlusion"))),null!==e.roughnessMap&&1===e.roughness?(o.push(`${s}float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`),l.push(buildTexture(e.roughnessMap,"roughness"))):o.push(`${s}float inputs:roughness = ${e.roughness}`),null!==e.metalnessMap&&1===e.metalness?(o.push(`${s}float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`),l.push(buildTexture(e.metalnessMap,"metallic"))):o.push(`${s}float inputs:metallic = ${e.metalness}`),null!==e.alphaMap?(o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),o.push(`${s}float inputs:opacityThreshold = 0.0001`),l.push(buildTexture(e.alphaMap,"opacity"))):o.push(`${s}float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial&&(o.push(`${s}float inputs:clearcoat = ${e.clearcoat}`),o.push(`${s}float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`),o.push(`${s}float inputs:ior = ${e.ior}`)),`\n\tdef Material "Material_${e.id}"\n\t{\n\t\tdef Shader "PreviewSurface"\n\t\t{\n\t\t\tuniform token info:id = "UsdPreviewSurface"\n${o.join("\n")}\n\t\t\tint inputs:useSpecularWorkflow = 0\n\t\t\ttoken outputs:surface\n\t\t}\n\n\t\ttoken outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>\n\n${l.join("\n")}\n\n\t}\n`}function buildColor(e){return`(${e.r}, ${e.g}, ${e.b})`}function buildVector2(e){return`(${e.x}, ${e.y})`}var sA=r(93e3),ar_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};let aA=!1,oA=!1;const lA="#model-viewer-no-ar-fallback",cA=(hA=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=Tl(e),r=(t.length?t[0].terms:[]).filter((e=>e&&"ident"===e.type)).map((e=>e.value)).filter((e=>hA.indexOf(e)>-1));return new Set(r)}catch(e){}return new Set});var hA;const uA="quick-look",dA="scene-viewer",pA="webxr",AA="none",mA=Symbol("arButtonContainer"),gA=Symbol("enterARWithWebXR"),fA=Symbol("openSceneViewer"),_A=Symbol("openIOSARQuickLook"),vA=Symbol("canActivateAR"),EA=Symbol("arMode"),yA=Symbol("arModes"),xA=Symbol("arAnchor"),SA=Symbol("preload"),MA=Symbol("onARButtonContainerClick"),CA=Symbol("onARStatus"),bA=Symbol("onARTracking"),IA=Symbol("onARTap"),wA=Symbol("selectARMode"),TA=Symbol("triggerLoad");var loading_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const BA="auto",RA="auto",LA="eager",DA=Symbol("defaultProgressBarElement"),UA=Symbol("posterContainerElement"),PA=Symbol("defaultPosterElement"),FA=Symbol("shouldDismissPoster"),NA=Symbol("hidePoster"),QA=Symbol("modelIsRevealed"),OA=Symbol("updateProgressBar"),GA=Symbol("ariaLabelCallToAction"),kA=Symbol("onProgress");var staging_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const VA=Math.PI/32,HA={basis:[degreesToRadians(numberNode(VA,"rad"))],keywords:{auto:[null]}},zA=Symbol("autoRotateStartTime"),WA=Symbol("radiansPerSecond"),qA=Symbol("syncRotationRate"),XA=Symbol("onCameraChange"),jA=(e=>{var t,r,s;class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[r]=e=>{e.forEach((e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach((e=>{this[Rp](e)})),e.removedNodes.forEach((e=>{this[Lp](e)})),this[gp]())}))},this[s]=new MutationObserver(this[Tp])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[Rp](this.children[e]);const{ShadyDOM:e}=self;null==e?this[Bp].observe(this,{childList:!0}):this[Bp]=e.observeChildren(this,this[Tp])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[Bp].disconnect():e.unobserveChildren(this[Bp])}[(t=wp,r=Tp,s=Bp,fp)](e,t){super[fp](e,t);const r=this[mp],{annotationRenderer:s}=r,o=r.getCamera();r.shouldRender()&&(r.updateSurfaceHotspots(),r.updateHotspotsVisibility(o.position),s.domElement.style.display="",s.render(r,o))}updateHotspot(e){const t=this[wp].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[gp]())}queryHotspot(e){const t=this[wp].get(e);if(null==t)return null;const r=toVector3D(t.position),s=toVector3D(t.normal),o=t.facingCamera,l=this[mp],c=l.getCamera(),h=new three_module_Vector3;h.setFromMatrixPosition(t.matrixWorld),h.project(c);const d=l.width/2,p=l.height/2;h.x=h.x*d+d,h.y=-h.y*p+p;const A=toVector3D(new three_module_Vector3(h.x,h.y,h.z));return Number.isFinite(A.x)&&Number.isFinite(A.y)?{position:r,normal:s,canvasPosition:A,facingCamera:o}:null}positionAndNormalFromPoint(e,t){const r=this[mp],s=r.getNDC(e,t),o=r.positionAndNormalFromPoint(s);if(null==o)return null;Dp.copy(r.target.matrixWorld).invert();const l=toVector3D(o.position.applyMatrix4(Dp)),c=toVector3D(o.normal.transformDirection(Dp));let h=null;return null!=o.uv&&(h=toVector2D(o.uv)),{position:l,normal:c,uv:h}}surfaceFromPoint(e,t){const r=this[mp],s=r.getNDC(e,t);return r.surfaceFromPoint(s)}[Rp](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[wp].get(e.slot);null!=t?t.increment():(t=new Hotspot({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[wp].set(e.slot,t),this[mp].addHotspot(t)),this[mp].queueRender()}[Lp](e){if(!(e instanceof HTMLElement))return;const t=this[wp].get(e.slot);t&&(t.decrement()&&(this[mp].removeHotspot(t),this[wp].delete(e.slot)),this[mp].queueRender())}}return AnnotationModelViewerElement})((e=>{var t,r,s;class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[r]=null,this[s]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[pd]}get availableVariants(){return this.model?this.model[ld]():[]}get originalGltfJson(){return this[dd]}[(t=pd,r=ud,s=dd,Ad)](){return()=>{this[gp]()}}[md](e){return e.colorSpace=et,e.wrapS=he,e.wrapT=he,new texture_Texture(this[Ad](),e)}async createTexture(e,t="image/png"){const{textureUtils:r}=this[Ep],s=await r.loadImage(e);return s.userData.mimeType=t,this[md](s)}async createLottieTexture(e,t=1){const{textureUtils:r}=this[Ep],s=await r.loadLottie(e,t);return this[md](s)}createVideoTexture(e){const t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();const r=new VideoTexture(t);return this[md](r)}createCanvasTexture(){const e=document.createElement("canvas"),t=new CanvasTexture(e);return this[md](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[yp].beginActivity("variant-update");e(.1);const t=this[pd],{variantName:r}=this;null!=t&&(await t[nd](r),this[gp](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[mp];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[Ep].arRenderer.onUpdateScene(),this[gp]()}}[_p](){super[_p]();const{currentGLTF:e}=this[mp];if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[ud]&&(this[pd]=new Model(t,this[Ad]()),this[dd]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[ud]=e}async exportScene(e){const t=this[mp];return new Promise((async(r,s)=>{const o={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(o,e),o.animations=t.animations,o.truncateDrawRange=!0;const l=t.shadow;let c=!1;null!=l&&(c=l.visible,l.visible=!1),await this[pd][id]();(new GLTFExporter).register((e=>new GLTFExporterMaterialsVariantsExtension(e))).parse(t.model,(e=>r(new Blob([o.binary?e:JSON.stringify(e)],{type:o.binary?"application/octet-stream":"application/json"}))),(()=>s("glTF export failed")),o),null!=l&&(l.visible=c)}))}materialFromPoint(e,t){const r=this[pd];if(null==r)return null;const s=this[mp],o=s.getNDC(e,t),l=s.hitFromPoint(o);return null==l||null==l.face?null:r[rd](l)}}return scene_graph_decorate([n({type:String,attribute:"variant-name"})],SceneGraphModelViewerElement.prototype,"variantName",void 0),scene_graph_decorate([n({type:String,attribute:"orientation"})],SceneGraphModelViewerElement.prototype,"orientation",void 0),scene_graph_decorate([n({type:String,attribute:"scale"})],SceneGraphModelViewerElement.prototype,"scale",void 0),SceneGraphModelViewerElement})((e=>{var t,r,s;class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[r]=0,this[s]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[zA]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[XA]),this[zA]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[XA]),this[zA]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[zA]=performance.now())}[(t=zA,r=WA,qA)](e){this[WA]=e[0]}[fp](e,t){if(super[fp](e,t),!this.autoRotate||!this[Sp]()||this[Ep].isPresenting)return;const r=Math.min(t,e-this[zA]-this.autoRotateDelay);r>0&&(this[mp].yaw=this.turntableRotation+this[WA]*r*.001)}get turntableRotation(){return this[mp].yaw}resetTurntableRotation(e=0){this[mp].yaw=e}}return s=XA,staging_decorate([n({type:Boolean,attribute:"auto-rotate"})],StagingModelViewerElement.prototype,"autoRotate",void 0),staging_decorate([n({type:Number,attribute:"auto-rotate-delay"})],StagingModelViewerElement.prototype,"autoRotateDelay",void 0),staging_decorate([style({intrinsics:HA,updateHandler:qA}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,r,s;class EnvironmentModelViewerElement extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[t]=null,this[r]=null,this[s]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[mp].setShadowIntensity(.5*this.shadowIntensity),this[gp]()),e.has("shadowSoftness")&&(this[mp].setShadowSoftness(this.shadowSoftness),this[gp]()),e.has("exposure")&&(this[mp].exposure=this.exposure,this[gp]()),e.has("toneMapping")&&(this[mp].toneMapping="commerce"===this.toneMapping?te:"agx"===this.toneMapping?ie:ee,this[gp]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[Mp]()&&this[fa](),e.has("skyboxHeight")&&(this[mp].setGroundedSkybox(),this[gp]())}hasBakedShadow(){return this[mp].bakedShadows.size>0}async[(t=ma,r=ga,s=_a,fa)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[_a]&&(this[_a](),this[_a]=null);const{textureUtils:r}=this[Ep];if(null==r)return;const s=this[yp].beginActivity("environment-update");try{const{environmentMap:o,skybox:l}=await r.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,(e=>s(utilities_clamp(e,0,1))));this[ma]!==o&&(this[ma]=o,this.dispatchEvent(new CustomEvent("environment-change"))),this[ga]=null!=l?l.name===o.name?o:l:null,this[mp].setEnvironmentAndSkybox(this[ma],this[ga])}catch(e){if(e instanceof Error)throw this[mp].setEnvironmentAndSkybox(null,null),e}finally{s(1)}}}return __decorate([n({type:String,attribute:"environment-image"})],EnvironmentModelViewerElement.prototype,"environmentImage",void 0),__decorate([n({type:String,attribute:"skybox-image"})],EnvironmentModelViewerElement.prototype,"skyboxImage",void 0),__decorate([n({type:Number,attribute:"shadow-intensity"})],EnvironmentModelViewerElement.prototype,"shadowIntensity",void 0),__decorate([n({type:Number,attribute:"shadow-softness"})],EnvironmentModelViewerElement.prototype,"shadowSoftness",void 0),__decorate([n({type:Number})],EnvironmentModelViewerElement.prototype,"exposure",void 0),__decorate([n({type:String,attribute:"tone-mapping"})],EnvironmentModelViewerElement.prototype,"toneMapping",void 0),__decorate([n({type:String,attribute:"skybox-height"})],EnvironmentModelViewerElement.prototype,"skyboxHeight",void 0),EnvironmentModelViewerElement})((e=>{var t,r,s,o,l,c,h,d,p,A,m,g,f,_,E,y,x;class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=gc,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=vc,this.interactionPromptStyle=yc,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=xc,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[r]=this.shadowRoot.querySelector("#prompt"),this[s]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[o]=this.shadowRoot.querySelector(".pan-target"),this[l]=0,this[c]=1/0,this[h]=!1,this[d]=!1,this[p]=ah.AUTOMATIC,this[A]=new SmoothControls(this[mp].camera,this[pp],this[mp]),this[m]=new Spherical,this[g]=!1,this[f]=!1,this[_]=!1,this[E]=()=>{const e=this[wc].changeSource;this[Hc]=e,e===ah.USER_INTERACTION&&(this[Gc]=!0,this[Dc]())},this[y]=()=>{this[Uc](),this[gp]();const e=this[wc].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[x]=e=>{this[dp].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[wc].inputSensitivity}set inputSensitivity(e){this[wc].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:r}=this[zc];return{theta:e,phi:t,radius:r,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[Ep].isPresenting?this[Ep].arRenderer.target:this[mp].getTarget())}getFieldOfView(){return this[wc].getFieldOfView()}getMinimumFieldOfView(){return this[wc].options.minimumFieldOfView}getMaximumFieldOfView(){return this[wc].options.maximumFieldOfView}getIdealAspect(){return this[mp].idealAspect}jumpCameraToGoal(){this[Wc]=!0,this.requestUpdate(Wc,!1)}resetInteractionPrompt(){this[Vc]=0,this[kc]=1/0,this[Gc]=!1,this[Oc]=this.interactionPrompt===vc&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[pp].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[wc].addEventListener("user-interaction",this[Fc]),this[wc].addEventListener("pointer-change-start",this[Qc]),this[wc].addEventListener("pointer-change-end",this[Qc])}disconnectedCallback(){super.disconnectedCallback(),this[wc].removeEventListener("user-interaction",this[Fc]),this[wc].removeEventListener("pointer-change-start",this[Qc]),this[wc].removeEventListener("pointer-change-end",this[Qc])}updated(e){super.updated(e);const t=this[wc],r=this[mp];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===vc&&(this[Oc]=!0)):(t.disableInteraction(),this[Dc]()),this[pp].setAttribute("aria-label",this[sp])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===vc&&this.cameraControls&&!this[Gc]?this[Oc]=!0:this[Dc]()),e.has("interactionPromptStyle")&&(this[Rc].style.opacity=this.interactionPromptStyle==Ec?"1":"0"),e.has("touchAction")){const e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),r.setTargetDamperDecayTime(this.interpolationDecay)),!0===this[Wc]&&Promise.resolve().then((()=>{t.jumpToGoal(),r.jumpToGoal(),this[Nc](),this[Wc]=!1}))}async updateFraming(){const e=this[mp],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const r=e.adjustedFoV(e.framedFoVDeg),s=this[wc].getFieldOfView()/t;this[wc].setFieldOfView(r*s),this[Xc]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,r){const s=this[pp],o=this[Lc];if("1"===o[0].style.opacity)return void pc.warn("interact() failed because an existing interaction is running.");const l=new Array;l.push({x:timeline(t.x),y:timeline(t.y)});const c=[{x:l[0].x(0),y:l[0].y(0)}];null!=r&&(l.push({x:timeline(r.x),y:timeline(r.y)}),c.push({x:l[1].x(0),y:l[1].y(0)}));let h=performance.now();const{width:d,height:p}=this[mp],A=this.getBoundingClientRect(),dispatchTouches=e=>{for(const[t,r]of c.entries()){const{style:l}=o[t];l.transform=`translateX(${d*r.x}px) translateY(${p*r.y}px)`,"pointerdown"===e?l.opacity="1":"pointerup"===e&&(l.opacity="0");const c={pointerId:t-5678,pointerType:"touch",target:s,clientX:d*r.x+A.x,clientY:p*r.y+A.y,altKey:!0};s.dispatchEvent(new PointerEvent(e,c))}},moveTouches=()=>{const t=this[Hc];if(t!==ah.AUTOMATIC||!s.isConnected){for(const e of this[Lc])e.style.opacity="0";return dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",onVisibilityChange)}const r=Math.min(1,(performance.now()-h)/e);for(const[e,t]of c.entries())t.x=l[e].x(r),t.y=l[e].y(r);dispatchTouches("pointermove"),r<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:ah.AUTOMATIC}})),document.removeEventListener("visibilitychange",onVisibilityChange))},onVisibilityChange=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-h:h=performance.now()-e};document.addEventListener("visibilitychange",onVisibilityChange),dispatchTouches("pointerdown"),this[Hc]=ah.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=Bc,r=Rc,s=Lc,o=Tc,l=Vc,c=kc,h=Gc,d=Oc,p=Hc,A=wc,m=zc,g=Wc,f=qc,_=Xc,Yc)](e){const t=this[wc],r=this[mp];r.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=ah.NONE,t.setFieldOfView(r.adjustedFoV(r.framedFoVDeg)),this[Fc]()}[jc](e){const t=this[wc];if(this[Xc]){const{theta:t,phi:r}=this.getCameraOrbit();e[0]=t,e[1]=r,this[Xc]=!1}t.changeSource=ah.NONE,t.setOrbit(e[0],e[1],e[2]),this[Fc]()}[Jc](e){this[wc].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[$c](e){this[wc].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[Pc](e[2]),this.jumpCameraToGoal()}[Zc](e){this[wc].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[eh](e){const t=this[mp].adjustedFoV(180*e[0]/Math.PI);this[wc].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[Kc](e){const[t,r,s]=e;this[Ep].arRenderer.isPresenting||this[mp].setTarget(t,r,s),this[wc].changeSource=ah.NONE,this[Ep].arRenderer.updateTarget(),this[Fc]()}[fp](e,t){if(super[fp](e,t),this[Ep].isPresenting||!this[Sp]())return;const r=this[wc],s=this[mp],o=performance.now();if(this[Oc]&&this.loaded&&o>this[cp]+this.interactionPromptThreshold&&(this[Oc]=!1,this[kc]=o,this[Bc].classList.add("visible")),isFinite(this[kc])&&this.interactionPromptStyle===yc){const e=(o-this[kc])/5e3%1,t=Ac(e),l=mc(e);if(this[Rc].style.opacity=`${l}`,t!==this[Vc]){const e=t*s.width*.05,o=(t-this[Vc])*Math.PI/16;this[Rc].style.transform=`translateX(${e}px)`,r.changeSource=ah.AUTOMATIC,r.adjustOrbit(o,0,0),this[Vc]=t}}const l=r.update(e,t),c=s.updateTarget(t);(l||c)&&this[Nc]()}[Dc](){this[Oc]=!1,this[Bc].classList.remove("visible"),this[kc]=1/0}[Pc](e){const t=Math.max(this[mp].farRadius(),e),r=Math.abs(2*t);this[wc].updateNearFar(0,r)}[Uc](){const{theta:e,phi:t}=this[wc].getCameraSpherical(this[zc]),r=(4+Math.floor((e%Ic+bc)/Mc))%4,s=Math.floor(t/Cc),o=fc[r],l=_c[s];this[lp](`View from stage ${l}${o}`)}get[sp](){return super[sp].replace(/\.$/,"")+(this.cameraControls?". Use mouse, touch or arrow keys to move.":"")}async[vp](e){const t=this[wc],r=this[mp],s=r.adjustedFoV(r.framedFoVDeg);super[vp](e);const o=r.adjustedFoV(r.framedFoVDeg)/s,l=t.getFieldOfView()*(isFinite(o)?o:1);t.updateAspect(this[mp].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[wc].setFieldOfView(l),this.jumpCameraToGoal()}[_p](){super[_p](),this[qc]?this[Xc]=!0:this[qc]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}}return E=Fc,y=Nc,x=Qc,controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:Sc,observeEffects:!0,updateHandler:jc}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:Kc}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:Yc}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:Jc}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:$c}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:Zc}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:eh}),n({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxFieldOfView",void 0),controls_decorate([n({type:Number,attribute:"interaction-prompt-threshold"})],ControlsModelViewerElement.prototype,"interactionPromptThreshold",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt"})],ControlsModelViewerElement.prototype,"interactionPrompt",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt-style"})],ControlsModelViewerElement.prototype,"interactionPromptStyle",void 0),controls_decorate([n({type:Number,attribute:"orbit-sensitivity"})],ControlsModelViewerElement.prototype,"orbitSensitivity",void 0),controls_decorate([n({type:Number,attribute:"zoom-sensitivity"})],ControlsModelViewerElement.prototype,"zoomSensitivity",void 0),controls_decorate([n({type:Number,attribute:"pan-sensitivity"})],ControlsModelViewerElement.prototype,"panSensitivity",void 0),controls_decorate([n({type:String,attribute:"touch-action"})],ControlsModelViewerElement.prototype,"touchAction",void 0),controls_decorate([n({type:Boolean,attribute:"disable-zoom"})],ControlsModelViewerElement.prototype,"disableZoom",void 0),controls_decorate([n({type:Boolean,attribute:"disable-pan"})],ControlsModelViewerElement.prototype,"disablePan",void 0),controls_decorate([n({type:Boolean,attribute:"disable-tap"})],ControlsModelViewerElement.prototype,"disableTap",void 0),controls_decorate([n({type:Number,attribute:"interpolation-decay"})],ControlsModelViewerElement.prototype,"interpolationDecay",void 0),ControlsModelViewerElement})((e=>{var t,r,s,o,l,c,h,d,p,A;class ARModelViewerElement extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[r]=this.shadowRoot.querySelector(".ar-button"),this[s]=document.createElement("a"),this[o]=new Set,this[l]=AA,this[c]=!1,this[h]=e=>{e.preventDefault(),this.activateAR()},this[d]=({status:e})=>{e!==ch&&this[Ep].arRenderer.presentedScene!==this[mp]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===ch?this.removeAttribute("ar-tracking"):e===hh&&this.setAttribute("ar-tracking",ph))},this[p]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[A]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[EA]!==AA}connectedCallback(){super.connectedCallback(),this[Ep].arRenderer.addEventListener("status",this[CA]),this.setAttribute("ar-status",ch),this[Ep].arRenderer.addEventListener("tracking",this[bA]),this[xA].addEventListener("message",this[IA])}disconnectedCallback(){super.disconnectedCallback(),this[Ep].arRenderer.removeEventListener("status",this[CA]),this[Ep].arRenderer.removeEventListener("tracking",this[bA]),this[xA].removeEventListener("message",this[IA])}update(e){super.update(e),e.has("arScale")&&(this[mp].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[mp].updateShadow(),this[gp]()),e.has("arModes")&&(this[yA]=cA(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[wA]()}async activateAR(){switch(this[EA]){case uA:await this[_A]();break;case pA:await this[gA]();break;case dA:this[fA]();break;default:sA.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=vA,r=mA,s=xA,o=yA,l=EA,c=SA,h=MA,d=CA,p=bA,A=IA,wA)](){let e=AA;if(this.ar){if(null!=this.src)for(const t of this[yA]){if("webxr"===t&&ra&&!aA&&await this[Ep].arRenderer.supportsPresentation()){e=pA;break}if("scene-viewer"===t&&ca&&!oA){e=dA;break}if("quick-look"===t&&ua){e=uA;break}}e===AA&&null!=this.iosSrc&&ua&&(e=uA)}if(e!==AA)this[mA].classList.add("enabled"),this[mA].addEventListener("click",this[MA]);else if(this[mA].classList.contains("enabled")){this[mA].removeEventListener("click",this[MA]),this[mA].classList.remove("enabled");const e=dh;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[EA]=e}async[gA](){sA.log("Attempting to present in AR with WebXR..."),await this[TA]();try{this[mA].removeEventListener("click",this[MA]);const{arRenderer:e}=this[Ep];e.placeOnWall="wall"===this.arPlacement,await e.present(this[mp],this.xrEnvironment)}catch(e){sA.warn("Error while trying to present in AR with WebXR"),sA.error(e),await this[Ep].arRenderer.stopPresenting(),aA=!0,sA.warn("Falling back to next ar-mode"),await this[wA](),this.activateAR()}finally{this[wA]()}}async[TA](){this.loaded||(this[SA]=!0,this[hp](),await((e,t,r=null)=>new Promise((s=>{e.addEventListener(t,(function handler(o){r&&!r(o)||(s(o),e.removeEventListener(t,handler))}))})))(this,"load"),this[SA]=!1)}[Mp](){return super[Mp]()||this[SA]}[fA](){const e=self.location.toString(),t=new URL(e),r=new URL(this.src,e);r.hash&&(r.hash="");const s=new URLSearchParams(r.search);if(t.hash=lA,s.set("mode","ar_preferred"),s.has("disable_occlusion")||s.set("disable_occlusion","true"),"fixed"===this.arScale&&s.set("resizable","false"),"wall"===this.arPlacement&&s.set("enable_vertical_placement","true"),s.has("sound")){const t=new URL(s.get("sound"),e);s.set("sound",t.toString())}if(s.has("link")){const t=new URL(s.get("link"),e);s.set("link",t.toString())}const o=`intent://arvr.google.com/scene-viewer/1.0?${s.toString()+"&file="+encodeURIComponent(r.toString())}#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`;self.addEventListener("hashchange",(()=>{self.location.hash===lA&&(oA=!0,self.history.back(),sA.warn("Error while trying to present in AR with Scene Viewer"),sA.warn("Falling back to next ar-mode"),this[wA]())}),{once:!0}),this[xA].setAttribute("href",o),sA.log("Attempting to present in AR with Scene Viewer..."),this[xA].click()}async[_A](){const e=!this.iosSrc;this[mA].classList.remove("enabled");const t=e?await this.prepareUSDZ():this.iosSrc,r=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),s=new URL(this.src,t);s.hash&&(r.hash=s.hash)}"fixed"===this.arScale&&(r.hash&&(r.hash+="&"),r.hash+="allowsContentScaling=0");const s=this[xA];s.setAttribute("rel","ar");const o=document.createElement("img");s.appendChild(o),s.setAttribute("href",r.toString()),e&&s.setAttribute("download","model.usdz"),s.style.display="none",s.isConnected||this.shadowRoot.appendChild(s),sA.log("Attempting to present in AR with Quick Look..."),s.click(),s.removeChild(o),e&&URL.revokeObjectURL(t),this[mA].classList.add("enabled")}async prepareUSDZ(){const e=this[yp].beginActivity("usdz-conversion");await this[TA]();const{model:t,shadow:r}=this[mp];if(null==t)return"";let s=!1;null!=r&&(s=r.visible,r.visible=!1),e(.2);const o=new USDZExporter,l=await o.parse(t),c=new Blob([l],{type:"model/vnd.usdz+zip"}),h=URL.createObjectURL(c);return e(1),null!=r&&(r.visible=s),h}}return ar_decorate([n({type:Boolean,attribute:"ar"})],ARModelViewerElement.prototype,"ar",void 0),ar_decorate([n({type:String,attribute:"ar-scale"})],ARModelViewerElement.prototype,"arScale",void 0),ar_decorate([n({type:String,attribute:"ar-placement"})],ARModelViewerElement.prototype,"arPlacement",void 0),ar_decorate([n({type:String,attribute:"ar-modes"})],ARModelViewerElement.prototype,"arModes",void 0),ar_decorate([n({type:String,attribute:"ios-src"})],ARModelViewerElement.prototype,"iosSrc",void 0),ar_decorate([n({type:Boolean,attribute:"xr-environment"})],ARModelViewerElement.prototype,"xrEnvironment",void 0),ARModelViewerElement})((e=>{var t,r,s,o,l,c,h,d;class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=BA,this.loading=RA,this[t]=!1,this[r]=!1,this[s]=this.shadowRoot.querySelector(".slot.poster"),this[o]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[c]=this[PA].getAttribute("aria-label"),this[h]=((e,t)=>{let r=null;const throttled=(...s)=>{null==r&&(e(...s),r=self.setTimeout((()=>r=null),t))};return throttled.flush=()=>{null!=r&&(self.clearTimeout(r),r=null)},throttled})((e=>{const t=this[DA].parentNode;requestAnimationFrame((()=>{this[DA].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[DA]),t.appendChild(this[DA])),this[DA].classList.toggle("hide",1===e)}))}),100),this[d]=e=>{const t=e.detail.totalProgress;1===t&&(this[OA].flush(),this.loaded&&(this[FA]||this.reveal===BA)&&this[NA]()),this[OA](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t}}))};const p=self.ModelViewerElement||{},A=p.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(A);const m=p.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(m),p.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(p.meshoptDecoderLocation);const g=p.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=g}static set dracoDecoderLocation(e){CachingGLTFLoader.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return CachingGLTFLoader.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){CachingGLTFLoader.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return CachingGLTFLoader.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){CachingGLTFLoader.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return CachingGLTFLoader.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){Renderer.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return Renderer.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){Renderer.singleton.loader[Oo].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[NA]():(this[FA]=!0,this[hp]())}showPoster(){const e=this[UA];if(e.classList.contains("show"))return;e.classList.add("show"),this[pp].classList.remove("show");const t=this[PA];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const r=this.modelIsVisible;this[QA]=!1,this[rp](r)}getDimensions(){return toVector3D(this[mp].size)}getBoundingBoxCenter(){return toVector3D(this[mp].boundingBox.getCenter(new three_module_Vector3))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[yp].addEventListener("progress",this[kA])}disconnectedCallback(){super.disconnectedCallback(),this[yp].removeEventListener("progress",this[kA])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[PA].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[PA].setAttribute("aria-label",this[ap]),(e.has("reveal")||e.has("loading"))&&this[hp]()}[(t=QA,r=FA,s=UA,o=PA,l=DA,c=GA,h=OA,d=kA,Mp)](){return!!this.src&&(this[FA]||this.loading===LA||this.reveal===BA&&this[np])}[NA](){this[FA]=!1;const e=this[UA];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[pp].classList.add("show");const t=this.modelIsVisible;this[QA]=!0,this[rp](t);const r=this.getRootNode();r&&r.activeElement===this&&this[pp].focus();const s=this[PA];s.setAttribute("aria-hidden","true"),s.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[Sp](){return super[Sp]()&&this[QA]}}return loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"poster",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"reveal",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"loading",void 0),LoadingModelViewerElement})((e=>{var t;class AnimationModelViewerElement extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[mp].subscribeMixerEvent("loop",(e=>{const t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))})),this[mp].subscribeMixerEvent("finished",(()=>{this[bp]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[mp].animationNames:[]}get duration(){return this[mp].duration}get paused(){return this[bp]}get currentTime(){return this[mp].animationTime}set currentTime(e){this[mp].animationTime=e,this[gp]()}get timeScale(){return this[mp].animationTimeScale}set timeScale(e){this[mp].animationTimeScale=e}pause(){this[bp]||(this[bp]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[bp]=!1,this[Cp](e),this.dispatchEvent(new CustomEvent("play")))}[(t=bp,_p)](){super[_p](),this[bp]=!0,null!=this.animationName&&this[Cp](),this.autoplay&&this.play()}[fp](e,t){super[fp](e,t),this[bp]||!this[Sp]()&&!this[Ep].isPresenting||(this[mp].updateAnimation(t/1e3),this[gp]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[Cp]()}[Cp](e=Ip){var t;const r=null!==(t=e.repetitions)&&void 0!==t?t:1/0,s=e.pingpong?ze:1===r?2200:He;this[mp].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,s,r),this[bp]&&(this[mp].updateAnimation(0),this[gp]())}}return animation_decorate([n({type:Boolean})],AnimationModelViewerElement.prototype,"autoplay",void 0),animation_decorate([n({type:String,attribute:"animation-name"})],AnimationModelViewerElement.prototype,"animationName",void 0),animation_decorate([n({type:Number,attribute:"animation-crossfade-duration"})],AnimationModelViewerElement.prototype,"animationCrossfadeDuration",void 0),AnimationModelViewerElement})(ModelViewerElementBase))))))));customElements.define("model-viewer",jA)}}]);
|
|
408
|
+
</div>`;var Ea=r(93e3);const ya=new WeakMap;function DRACOWorker(){let e,t;function decodeAttribute(e,t,r,s,o,l){const c=l.num_components(),h=r.num_points()*c,d=h*o.BYTES_PER_ELEMENT,p=function getDracoDataType(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,o),A=e._malloc(d);t.GetAttributeDataArrayForAllPoints(r,l,p,d,A);const m=new o(e.HEAPF32.buffer,A,h).slice();return e._free(A),{name:s,array:m,itemSize:c}}onmessage=function(r){const s=r.data;switch(s.type){case"init":e=s.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const r=s.buffer,o=s.taskConfig;t.then((e=>{const t=e.draco,l=new t.Decoder;try{const e=function decodeGeometry(e,t,r,s){const o=s.attributeIDs,l=s.attributeTypes;let c,h;const d=t.GetEncodedGeometryType(r);if(d===e.TRIANGULAR_MESH)c=new e.Mesh,h=t.DecodeArrayToMesh(r,r.byteLength,c);else{if(d!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");c=new e.PointCloud,h=t.DecodeArrayToPointCloud(r,r.byteLength,c)}if(!h.ok()||0===c.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const p={index:null,attributes:[]};for(const r in o){const h=self[l[r]];let d,A;if(s.useUniqueIDs)A=o[r],d=t.GetAttributeByUniqueId(c,A);else{if(A=t.GetAttributeId(c,e[o[r]]),-1===A)continue;d=t.GetAttribute(c,A)}const m=decodeAttribute(e,t,c,r,h,d);"color"===r&&(m.vertexColorSpace=s.vertexColorSpace),p.attributes.push(m)}d===e.TRIANGULAR_MESH&&(p.index=function decodeIndex(e,t,r){const s=r.num_faces(),o=3*s,l=4*o,c=e._malloc(l);t.GetTrianglesUInt32Array(r,l,c);const h=new Uint32Array(e.HEAPF32.buffer,c,o).slice();return e._free(c),{array:h,itemSize:1}}(e,t,c));return e.destroy(c),p}(t,l,new Int8Array(r),o),c=e.attributes.map((e=>e.array.buffer));e.index&&c.push(e.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:e},c)}catch(e){Ea.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(l)}}))}}}var xa=r(93e3);function toTrianglesDrawMode(e,t){if(0===t)return xa.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let r=e.getIndex();if(null===r){const t=[],s=e.getAttribute("position");if(void 0===s)return xa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<s.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}const s=r.count-2,o=[];if(2===t)for(let e=1;e<=s;e++)o.push(r.getX(0)),o.push(r.getX(e)),o.push(r.getX(e+1));else for(let e=0;e<s;e++)e%2==0?(o.push(r.getX(e)),o.push(r.getX(e+1)),o.push(r.getX(e+2))):(o.push(r.getX(e+2)),o.push(r.getX(e+1)),o.push(r.getX(e)));o.length/3!==s&&xa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const l=e.clone();return l.setIndex(o),l.clearGroups(),l}return xa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var Sa=r(93e3);class GLTFLoader extends Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFTextureBasisUExtension(e)})),this.register((function(e){return new GLTFTextureWebPExtension(e)})),this.register((function(e){return new GLTFTextureAVIFExtension(e)})),this.register((function(e){return new GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFLightsExtension(e)})),this.register((function(e){return new GLTFMeshoptCompression(e)})),this.register((function(e){return new GLTFMeshGpuInstancing(e)}))}load(e,t,r,s){const o=this;let l;if(""!==this.resourcePath)l=this.resourcePath;else if(""!==this.path){const t=LoaderUtils.extractUrlBase(e);l=LoaderUtils.resolveURL(t,this.path)}else l=LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const _onError=function(t){s?s(t):Sa.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},c=new three_module_FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,(function(r){try{o.parse(r,l,(function(r){t(r),o.manager.itemEnd(e)}),_onError)}catch(e){_onError(e)}}),r,_onError)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){let o;const l={},c={},h=new TextDecoder;if("string"==typeof e)o=JSON.parse(e);else if(e instanceof ArrayBuffer){if(h.decode(new Uint8Array(e,0,4))===Ca){try{l[Ma.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){return void(s&&s(e))}o=JSON.parse(l[Ma.KHR_BINARY_GLTF].content)}else o=JSON.parse(h.decode(e))}else o=e;if(void 0===o.asset||o.asset.version[0]<2)return void(s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const d=new GLTFParser(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](d);t.name||Sa.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[t.name]=t,l[t.name]=!0}if(o.extensionsUsed)for(let e=0;e<o.extensionsUsed.length;++e){const t=o.extensionsUsed[e],r=o.extensionsRequired||[];switch(t){case Ma.KHR_MATERIALS_UNLIT:l[t]=new GLTFMaterialsUnlitExtension;break;case Ma.KHR_DRACO_MESH_COMPRESSION:l[t]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case Ma.KHR_TEXTURE_TRANSFORM:l[t]=new GLTFTextureTransformExtension;break;case Ma.KHR_MESH_QUANTIZATION:l[t]=new GLTFMeshQuantizationExtension;break;default:r.indexOf(t)>=0&&void 0===c[t]&&Sa.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}d.setExtensions(l),d.setPlugins(c),d.parse(r,s)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,t,s,o)}))}}function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const Ma={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class GLTFLightsExtension{constructor(e){this.parser=e,this.name=Ma.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r];s.extensions&&s.extensions[this.name]&&void 0!==s.extensions[this.name].light&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let s=t.cache.get(r);if(s)return s;const o=t.json,l=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let c;const h=new Color(16777215);void 0!==l.color&&h.setRGB(l.color[0],l.color[1],l.color[2],tt);const d=void 0!==l.range?l.range:0;switch(l.type){case"directional":c=new DirectionalLight(h),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new PointLight(h),c.distance=d;break;case"spot":c=new SpotLight(h),c.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=void 0!==l.spot.innerConeAngle?l.spot.innerConeAngle:0,l.spot.outerConeAngle=void 0!==l.spot.outerConeAngle?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,assignExtrasToUserData(c,l),void 0!==l.intensity&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),s=Promise.resolve(c),t.cache.add(r,s),s}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,s=r.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(e){return r._getNodeRef(t.cache,o,e)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=Ma.KHR_MATERIALS_UNLIT}getMaterialType(){return MeshBasicMaterial}extendParams(e,t,r){const s=[];e.color=new Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const t=o.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],tt),e.opacity=t[3]}void 0!==o.baseColorTexture&&s.push(r.assignTexture(e,"map",o.baseColorTexture,et))}return Promise.all(s)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return void 0!==s&&(t.emissiveIntensity=s),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];if(void 0!==l.clearcoatFactor&&(t.clearcoat=l.clearcoatFactor),void 0!==l.clearcoatTexture&&o.push(r.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),void 0!==l.clearcoatRoughnessFactor&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),void 0!==l.clearcoatRoughnessTexture&&o.push(r.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),void 0!==l.clearcoatNormalTexture&&(o.push(r.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),void 0!==l.clearcoatNormalTexture.scale)){const e=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Vector2(e,e)}return Promise.all(o)}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.iridescenceFactor&&(t.iridescence=l.iridescenceFactor),void 0!==l.iridescenceTexture&&o.push(r.assignTexture(t,"iridescenceMap",l.iridescenceTexture)),void 0!==l.iridescenceIor&&(t.iridescenceIOR=l.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==l.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),void 0!==l.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),void 0!==l.iridescenceThicknessTexture&&o.push(r.assignTexture(t,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=s.extensions[this.name];if(void 0!==l.sheenColorFactor){const e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],tt)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&o.push(r.assignTexture(t,"sheenColorMap",l.sheenColorTexture,et)),void 0!==l.sheenRoughnessTexture&&o.push(r.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(o)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.transmissionFactor&&(t.transmission=l.transmissionFactor),void 0!==l.transmissionTexture&&o.push(r.assignTexture(t,"transmissionMap",l.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];t.thickness=void 0!==l.thicknessFactor?l.thicknessFactor:0,void 0!==l.thicknessTexture&&o.push(r.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const c=l.attenuationColor||[1,1,1];return t.attenuationColor=(new Color).setRGB(c[0],c[1],c[2],tt),Promise.all(o)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=void 0!==s.ior?s.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&o.push(r.assignTexture(t,"specularIntensityMap",l.specularTexture));const c=l.specularColorFactor||[1,1,1];return t.specularColor=(new Color).setRGB(c[0],c[1],c[2],tt),void 0!==l.specularColorTexture&&o.push(r.assignTexture(t,"specularColorMap",l.specularColorTexture,et)),Promise.all(o)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=Ma.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return t.bumpScale=void 0!==l.bumpFactor?l.bumpFactor:1,void 0!==l.bumpTexture&&o.push(r.assignTexture(t,"bumpMap",l.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=Ma.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.anisotropyStrength&&(t.anisotropy=l.anisotropyStrength),void 0!==l.anisotropyRotation&&(t.anisotropyRotation=l.anisotropyRotation),void 0!==l.anisotropyTexture&&o.push(r.assignTexture(t,"anisotropyMap",l.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=Ma.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const o=s.extensions[this.name],l=t.options.ktx2Loader;if(!l){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,l)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=Ma.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let h=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return r.loadTextureImage(e,l.source,h);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=Ma.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let h=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return r.loadTextureImage(e,l.source,h);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFMeshoptCompression{constructor(e){this.name=Ma.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const e=r.extensions[this.name],s=this.parser.getDependency("buffer",e.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then((function(t){const r=e.byteOffset||0,s=e.byteLength||0,l=e.count,c=e.byteStride,h=new Uint8Array(t,r,s);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(l,c,h,e.mode,e.filter).then((function(e){return e.buffer})):o.ready.then((function(){const t=new ArrayBuffer(l*c);return o.decodeGltfBuffer(new Uint8Array(t),l,c,h,e.mode,e.filter),t}))}))}return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=Ma.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;const s=t.meshes[r.mesh];for(const e of s.primitives)if(e.mode!==Ta.TRIANGLES&&e.mode!==Ta.TRIANGLE_STRIP&&e.mode!==Ta.TRIANGLE_FAN&&void 0!==e.mode)return null;const o=r.extensions[this.name].attributes,l=[],c={};for(const e in o)l.push(this.parser.getDependency("accessor",o[e]).then((t=>(c[e]=t,c[e]))));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((e=>{const t=e.pop(),r=t.isGroup?t.children:[t],s=e[0].count,o=[];for(const e of r){const t=new three_module_Matrix4,r=new three_module_Vector3,l=new three_module_Quaternion,h=new three_module_Vector3(1,1,1),d=new InstancedMesh(e.geometry,e.material,s);for(let e=0;e<s;e++)c.TRANSLATION&&r.fromBufferAttribute(c.TRANSLATION,e),c.ROTATION&&l.fromBufferAttribute(c.ROTATION,e),c.SCALE&&h.fromBufferAttribute(c.SCALE,e),d.setMatrixAt(e,t.compose(r,l,h));for(const t in c)if("_COLOR_0"===t){const e=c[t];d.instanceColor=new three_module_InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,c[t]);Object3D.prototype.copy.call(d,e),this.parser.assignFinalMaterial(d),o.push(d)}return t.isGroup?(t.clear(),t.add(...o),t):o[0]})))}}const Ca="glTF",ba=1313821514,Ia=5130562;class GLTFBinaryExtension{constructor(e){this.name=Ma.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ca)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-12,o=new DataView(e,12);let l=0;for(;l<s;){const t=o.getUint32(l,!0);l+=4;const s=o.getUint32(l,!0);if(l+=4,s===ba){const s=new Uint8Array(e,12+l,t);this.content=r.decode(s)}else if(s===Ia){const r=12+l;this.body=e.slice(r,r+t)}l+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class GLTFDracoMeshCompressionExtension{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ma.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,s=this.dracoLoader,o=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,c={},h={},d={};for(const e in l){const t=Ua[e]||e.toLowerCase();c[t]=l[e]}for(const t in e.attributes){const s=Ua[t]||t.toLowerCase();if(void 0!==l[t]){const o=r.accessors[e.attributes[t]],l=Ba[o.componentType];d[s]=l.name,h[s]=!0===o.normalized}}return t.getDependency("bufferView",o).then((function(e){return new Promise((function(t,r){s.decodeDracoFile(e,(function(e){for(const t in e.attributes){const r=e.attributes[t],s=h[t];void 0!==s&&(r.normalized=s)}t(e)}),c,d,tt,r)}))}))}}class GLTFTextureTransformExtension{constructor(){this.name=Ma.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class GLTFMeshQuantizationExtension{constructor(){this.name=Ma.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends Interpolant{constructor(e,t,r,s){super(e,t,r,s)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,o=e*s*3+s;for(let e=0;e!==s;e++)t[e]=r[o+e];return t}interpolate_(e,t,r,s){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=2*c,d=3*c,p=s-t,A=(r-t)/p,m=A*A,g=m*A,f=e*d,_=f-d,E=-2*g+3*m,y=g-m,x=1-E,S=y-m+A;for(let e=0;e!==c;e++){const t=l[_+e+c],r=l[_+e+h]*p,s=l[f+e+c],d=l[f+e]*p;o[e]=x*t+S*r+E*s+y*d}return o}}const wa=new three_module_Quaternion;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,r,s){const o=super.interpolate_(e,t,r,s);return wa.fromArray(o).normalize().toArray(o),o}}const Ta={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Ba={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ra={9728:pe,9729:ge,9984:Ae,9985:fe,9986:me,9987:_e},La={33071:ue,33648:de,10497:he},Da={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ua={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Pa={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fa={CUBICSPLINE:void 0,LINEAR:qe,STEP:We},Na="OPAQUE",Qa="MASK",Oa="BLEND";function createDefaultMaterial(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:p})),e.DefaultMaterial}function addUnknownExtensionsToUserData(e,t,r){for(const s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function assignExtrasToUserData(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):Sa.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function updateMorphTargets(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,s=t.weights.length;r<s;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){const r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,s=r.length;t<s;t++)e.morphTargetDictionary[r[t]]=t}else Sa.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(e){let t;const r=e.extensions&&e.extensions[Ma.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+createAttributesKey(r.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,s=e.targets.length;r<s;r++)t+=":"+createAttributesKey(e.targets[r]);return t}function createAttributesKey(e){let t="";const r=Object.keys(e).sort();for(let s=0,o=r.length;s<o;s++)t+=r[s]+":"+e[r[s]]+";";return t}function getNormalizedComponentScale(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const Ga=new three_module_Matrix4;class GLTFParser{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GLTFRegistry,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,s=!1,o=-1;"undefined"!=typeof navigator&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),s=navigator.userAgent.indexOf("Firefox")>-1,o=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||s&&o<98?this.textureLoader=new TextureLoader(this.options.manager):this.textureLoader=new ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new three_module_FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,s=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){const l={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:r,userData:{}};return addUnknownExtensionsToUserData(o,l,s),assignExtrasToUserData(l,s),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(l)}))).then((function(){e(l)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r].joints;for(let t=0,r=s.length;t<r;t++)e[s[t]].isBone=!0}for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0!==s.mesh&&(this._addNodeRef(this.meshCache,s.mesh),void 0!==s.skin&&(r[s.mesh].isSkinnedMesh=!0)),void 0!==s.camera&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const s=r.clone(),updateMappings=(e,t)=>{const r=this.associations.get(e);null!=r&&this.associations.set(t,r);for(const[r,s]of e.children.entries())updateMappings(s,t.children[r])};return updateMappings(r,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const s=e(t[r]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let s=0;s<t.length;s++){const o=e(t[s]);o&&r.push(o)}return r}getDependency(e,t){const r=e+":"+t;let s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":s=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":s=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})),!s)throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map((function(t,s){return r.getDependency(e,s)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[Ma.KHR_BINARY_GLTF].body);const s=this.options;return new Promise((function(e,o){r.load(LoaderUtils.resolveURL(t.uri,s.path),e,void 0,(function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const r=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+r)}))}loadAccessor(e){const t=this,r=this.json,s=this.json.accessors[e];if(void 0===s.bufferView&&void 0===s.sparse){const e=Da[s.type],t=Ba[s.componentType],r=!0===s.normalized,o=new t(s.count*e);return Promise.resolve(new three_module_BufferAttribute(o,e,r))}const o=[];return void 0!==s.bufferView?o.push(this.getDependency("bufferView",s.bufferView)):o.push(null),void 0!==s.sparse&&(o.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(o).then((function(e){const o=e[0],l=Da[s.type],c=Ba[s.componentType],h=c.BYTES_PER_ELEMENT,d=h*l,p=s.byteOffset||0,A=void 0!==s.bufferView?r.bufferViews[s.bufferView].byteStride:void 0,m=!0===s.normalized;let g,f;if(A&&A!==d){const e=Math.floor(p/A),r="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+e+":"+s.count;let d=t.cache.get(r);d||(g=new c(o,e*A,s.count*A/h),d=new three_module_InterleavedBuffer(g,A/h),t.cache.add(r,d)),f=new three_module_InterleavedBufferAttribute(d,l,p%A/h,m)}else g=null===o?new c(s.count*l):new c(o,p,s.count*l),f=new three_module_BufferAttribute(g,l,m);if(void 0!==s.sparse){const t=Da.SCALAR,r=Ba[s.sparse.indices.componentType],h=s.sparse.indices.byteOffset||0,d=s.sparse.values.byteOffset||0,p=new r(e[1],h,s.sparse.count*t),A=new c(e[2],d,s.sparse.count*l);null!==o&&(f=new three_module_BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let e=0,t=p.length;e<t;e++){const t=p[e];if(f.setX(t,A[e*l]),l>=2&&f.setY(t,A[e*l+1]),l>=3&&f.setZ(t,A[e*l+2]),l>=4&&f.setW(t,A[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f}))}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let l=this.textureLoader;if(o.uri){const e=r.manager.getHandler(o.uri);null!==e&&(l=e)}return this.loadTextureImage(e,s,l)}loadTextureImage(e,t,r){const s=this,o=this.json,l=o.textures[e],c=o.images[t],h=(c.uri||c.bufferView)+":"+l.sampler;if(this.textureCache[h])return this.textureCache[h];const d=this.loadImageSource(t,r).then((function(t){t.flipY=!1,t.name=l.name||c.name||"",""===t.name&&"string"==typeof c.uri&&!1===c.uri.startsWith("data:image/")&&(t.name=c.uri);const r=(o.samplers||{})[l.sampler]||{};return t.magFilter=Ra[r.magFilter]||ge,t.minFilter=Ra[r.minFilter]||_e,t.wrapS=La[r.wrapS]||he,t.wrapT=La[r.wrapT]||he,s.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[h]=d,d}loadImageSource(e,t){const r=this,s=this.json,o=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=s.images[e],c=self.URL||self.webkitURL;let h=l.uri||"",d=!1;if(void 0!==l.bufferView)h=r.getDependency("bufferView",l.bufferView).then((function(e){d=!0;const t=new Blob([e],{type:l.mimeType});return h=c.createObjectURL(t),h}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(h).then((function(e){return new Promise((function(r,s){let l=r;!0===t.isImageBitmapLoader&&(l=function(e){const t=new Texture(e);t.needsUpdate=!0,r(t)}),t.load(LoaderUtils.resolveURL(e,o.path),l,void 0,s)}))})).then((function(e){return!0===d&&c.revokeObjectURL(h),e.userData.mimeType=l.mimeType||function getImageURIMimeType(e){return e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"}(l.uri),e})).catch((function(e){throw Sa.error("THREE.GLTFLoader: Couldn't load texture",h),e}));return this.sourceCache[e]=p,p}assignTexture(e,t,r,s){const o=this;return this.getDependency("texture",r.index).then((function(l){if(!l)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((l=l.clone()).channel=r.texCoord),o.extensions[Ma.KHR_TEXTURE_TRANSFORM]){const e=void 0!==r.extensions?r.extensions[Ma.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=o.associations.get(l);l=o.extensions[Ma.KHR_TEXTURE_TRANSFORM].extendTexture(l,e),o.associations.set(l,t)}}return void 0!==s&&(l.colorSpace=s),e[t]=l,l}))}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const s=void 0===t.attributes.tangent,o=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new PointsMaterial,Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){const e="LineBasicMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new LineBasicMaterial,Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(s||o||l){let e="ClonedMaterial:"+r.uuid+":";s&&(e+="derivative-tangents:"),o&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),o&&(t.vertexColors=!0),l&&(t.flatShading=!0),s&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return MeshStandardMaterial}loadMaterial(e){const t=this,r=this.json,s=this.extensions,o=r.materials[e];let l;const c={},h=[];if((o.extensions||{})[Ma.KHR_MATERIALS_UNLIT]){const e=s[Ma.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),h.push(e.extendParams(c,o,t))}else{const r=o.pbrMetallicRoughness||{};if(c.color=new Color(1,1,1),c.opacity=1,Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;c.color.setRGB(e[0],e[1],e[2],tt),c.opacity=e[3]}void 0!==r.baseColorTexture&&h.push(t.assignTexture(c,"map",r.baseColorTexture,et)),c.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,c.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(h.push(t.assignTexture(c,"metalnessMap",r.metallicRoughnessTexture)),h.push(t.assignTexture(c,"roughnessMap",r.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),h.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,c)}))))}!0===o.doubleSided&&(c.side=m);const d=o.alphaMode||Na;if(d===Oa?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,d===Qa&&(c.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&l!==MeshBasicMaterial&&(h.push(t.assignTexture(c,"normalMap",o.normalTexture)),c.normalScale=new Vector2(1,1),void 0!==o.normalTexture.scale)){const e=o.normalTexture.scale;c.normalScale.set(e,e)}if(void 0!==o.occlusionTexture&&l!==MeshBasicMaterial&&(h.push(t.assignTexture(c,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(c.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&l!==MeshBasicMaterial){const e=o.emissiveFactor;c.emissive=(new Color).setRGB(e[0],e[1],e[2],tt)}return void 0!==o.emissiveTexture&&l!==MeshBasicMaterial&&h.push(t.assignTexture(c,"emissiveMap",o.emissiveTexture,et)),Promise.all(h).then((function(){const r=new l(c);return o.name&&(r.name=o.name),assignExtrasToUserData(r,o),t.associations.set(r,{materials:e}),o.extensions&&addUnknownExtensionsToUserData(s,r,o),r}))}createUniqueName(e){const t=PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,s=this.primitiveCache;function createDracoPrimitive(e){return r[Ma.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return addPrimitiveAttributes(r,e,t)}))}const o=[];for(let r=0,l=e.length;r<l;r++){const l=e[r],c=createPrimitiveKey(l),h=s[c];if(h)o.push(h.promise);else{let e;e=l.extensions&&l.extensions[Ma.KHR_DRACO_MESH_COMPRESSION]?createDracoPrimitive(l):addPrimitiveAttributes(new three_module_BufferGeometry,l,t),s[c]={primitive:l,promise:e},o.push(e)}}return Promise.all(o)}loadMesh(e){const t=this,r=this.json,s=this.extensions,o=r.meshes[e],l=o.primitives,c=[];for(let e=0,t=l.length;e<t;e++){const t=void 0===l[e].material?createDefaultMaterial(this.cache):this.getDependency("material",l[e].material);c.push(t)}return c.push(t.loadGeometries(l)),Promise.all(c).then((function(r){const c=r.slice(0,r.length-1),h=r[r.length-1],d=[];for(let r=0,p=h.length;r<p;r++){const p=h[r],A=l[r];let m;const g=c[r];if(A.mode===Ta.TRIANGLES||A.mode===Ta.TRIANGLE_STRIP||A.mode===Ta.TRIANGLE_FAN||void 0===A.mode)m=!0===o.isSkinnedMesh?new SkinnedMesh(p,g):new three_module_Mesh(p,g),!0===m.isSkinnedMesh&&m.normalizeSkinWeights(),A.mode===Ta.TRIANGLE_STRIP?m.geometry=toTrianglesDrawMode(m.geometry,1):A.mode===Ta.TRIANGLE_FAN&&(m.geometry=toTrianglesDrawMode(m.geometry,2));else if(A.mode===Ta.LINES)m=new LineSegments(p,g);else if(A.mode===Ta.LINE_STRIP)m=new Line(p,g);else if(A.mode===Ta.LINE_LOOP)m=new LineLoop(p,g);else{if(A.mode!==Ta.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);m=new Points(p,g)}Object.keys(m.geometry.morphAttributes).length>0&&updateMorphTargets(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),assignExtrasToUserData(m,o),A.extensions&&addUnknownExtensionsToUserData(s,m,A),t.assignFinalMaterial(m),d.push(m)}for(let r=0,s=d.length;r<s;r++)t.associations.set(d[r],{meshes:e,primitives:r});if(1===d.length)return o.extensions&&addUnknownExtensionsToUserData(s,d[0],o),d[0];const p=new three_module_Group;o.extensions&&addUnknownExtensionsToUserData(s,p,o),t.associations.set(p,{meshes:e});for(let e=0,t=d.length;e<t;e++)p.add(d[e]);return p}))}loadCamera(e){let t;const r=this.json.cameras[e],s=r[r.type];if(s)return"perspective"===r.type?t=new PerspectiveCamera(bt.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):"orthographic"===r.type&&(t=new OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),assignExtrasToUserData(t,r),Promise.resolve(t);Sa.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],r=[];for(let e=0,s=t.joints.length;e<s;e++)r.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){const r=e.pop(),s=e,o=[],l=[];for(let e=0,c=s.length;e<c;e++){const c=s[e];if(c){o.push(c);const t=new three_module_Matrix4;null!==r&&t.fromArray(r.array,16*e),l.push(t)}else Sa.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new Skeleton(o,l)}))}loadAnimation(e){const t=this.json,r=this,s=t.animations[e],o=s.name?s.name:"animation_"+e,l=[],c=[],h=[],d=[],p=[];for(let e=0,t=s.channels.length;e<t;e++){const t=s.channels[e],r=s.samplers[t.sampler],o=t.target,A=o.node,m=void 0!==s.parameters?s.parameters[r.input]:r.input,g=void 0!==s.parameters?s.parameters[r.output]:r.output;void 0!==o.node&&(l.push(this.getDependency("node",A)),c.push(this.getDependency("accessor",m)),h.push(this.getDependency("accessor",g)),d.push(r),p.push(o))}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(h),Promise.all(d),Promise.all(p)]).then((function(e){const t=e[0],s=e[1],l=e[2],c=e[3],h=e[4],d=[];for(let e=0,o=t.length;e<o;e++){const o=t[e],p=s[e],A=l[e],m=c[e],g=h[e];if(void 0===o)continue;o.updateMatrix&&o.updateMatrix();const f=r._createAnimationTracks(o,p,A,m,g);if(f)for(let e=0;e<f.length;e++)d.push(f[e])}return new three_module_AnimationClip(o,void 0,d)}))}createNodeMesh(e){const t=this.json,r=this,s=t.nodes[e];return void 0===s.mesh?null:r.getDependency("mesh",s.mesh).then((function(e){const t=r._getNodeRef(r.meshCache,s.mesh,e);return void 0!==s.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,r=s.weights.length;t<r;t++)e.morphTargetInfluences[t]=s.weights[t]})),t}))}loadNode(e){const t=this,r=this.json.nodes[e],s=t._loadNodeShallow(e),o=[],l=r.children||[];for(let e=0,r=l.length;e<r;e++)o.push(t.getDependency("node",l[e]));const c=void 0===r.skin?Promise.resolve(null):t.getDependency("skin",r.skin);return Promise.all([s,Promise.all(o),c]).then((function(e){const t=e[0],r=e[1],s=e[2];null!==s&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(s,Ga)}));for(let e=0,s=r.length;e<s;e++)t.add(r[e]);return t}))}_loadNodeShallow(e){const t=this.json,r=this.extensions,s=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const o=t.nodes[e],l=o.name?s.createUniqueName(o.name):"",c=[],h=s._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return h&&c.push(h),void 0!==o.camera&&c.push(s.getDependency("camera",o.camera).then((function(e){return s._getNodeRef(s.cameraCache,o.camera,e)}))),s._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){c.push(e)})),this.nodeCache[e]=Promise.all(c).then((function(t){let c;if(c=!0===o.isBone?new Bone:t.length>1?new three_module_Group:1===t.length?t[0]:new Object3D,c!==t[0])for(let e=0,r=t.length;e<r;e++)c.add(t[e]);if(o.name&&(c.userData.name=o.name,c.name=l),assignExtrasToUserData(c,o),o.extensions&&addUnknownExtensionsToUserData(r,c,o),void 0!==o.matrix){const e=new three_module_Matrix4;e.fromArray(o.matrix),c.applyMatrix4(e)}else void 0!==o.translation&&c.position.fromArray(o.translation),void 0!==o.rotation&&c.quaternion.fromArray(o.rotation),void 0!==o.scale&&c.scale.fromArray(o.scale);return s.associations.has(c)||s.associations.set(c,{}),s.associations.get(c).nodes=e,c})),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],s=this,o=new three_module_Group;r.name&&(o.name=s.createUniqueName(r.name)),assignExtrasToUserData(o,r),r.extensions&&addUnknownExtensionsToUserData(t,o,r);const l=r.nodes||[],c=[];for(let e=0,t=l.length;e<t;e++)c.push(s.getDependency("node",l[e]));return Promise.all(c).then((function(e){for(let t=0,r=e.length;t<r;t++)o.add(e[t]);return s.associations=(e=>{const t=new Map;for(const[e,r]of s.associations)(e instanceof Material||e instanceof Texture)&&t.set(e,r);return e.traverse((e=>{const r=s.associations.get(e);null!=r&&t.set(e,r)})),t})(o),o}))}_createAnimationTracks(e,t,r,s,o){const l=[],c=e.name?e.name:e.uuid,h=[];let d;switch(Pa[o.path]===Pa.weights?e.traverse((function(e){e.morphTargetInfluences&&h.push(e.name?e.name:e.uuid)})):h.push(c),Pa[o.path]){case Pa.weights:d=NumberKeyframeTrack;break;case Pa.rotation:d=three_module_QuaternionKeyframeTrack;break;case Pa.position:case Pa.scale:d=three_module_VectorKeyframeTrack;break;default:if(1===r.itemSize)d=NumberKeyframeTrack;else d=three_module_VectorKeyframeTrack}const p=void 0!==s.interpolation?Fa[s.interpolation]:qe,A=this._getArrayFromAccessor(r);for(let e=0,r=h.length;e<r;e++){const r=new d(h[e]+"."+Pa[o.path],t.array,A,p);"CUBICSPLINE"===s.interpolation&&this._createCubicSplineTrackInterpolant(r),l.push(r)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=getNormalizedComponentScale(t.constructor),r=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)r[s]=t[s]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function InterpolantFactoryMethodGLTFCubicSpline(e){return new(this instanceof three_module_QuaternionKeyframeTrack?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function addPrimitiveAttributes(e,t,r){const s=t.attributes,o=[];function assignAttributeAccessor(t,s){return r.getDependency("accessor",t).then((function(t){e.setAttribute(s,t)}))}for(const t in s){const r=Ua[t]||t.toLowerCase();r in e.attributes||o.push(assignAttributeAccessor(s[t],r))}if(void 0!==t.indices&&!e.index){const s=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));o.push(s)}return Dt.workingColorSpace!==tt&&"COLOR_0"in s&&Sa.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Dt.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),function computeBounds(e,t,r){const s=t.attributes,o=new Box3;if(void 0===s.POSITION)return;{const e=r.json.accessors[s.POSITION],t=e.min,l=e.max;if(void 0===t||void 0===l)return void Sa.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(o.set(new three_module_Vector3(t[0],t[1],t[2]),new three_module_Vector3(l[0],l[1],l[2])),e.normalized){const t=getNormalizedComponentScale(Ba[e.componentType]);o.min.multiplyScalar(t),o.max.multiplyScalar(t)}}const l=t.targets;if(void 0!==l){const e=new three_module_Vector3,t=new three_module_Vector3;for(let s=0,o=l.length;s<o;s++){const o=l[s];if(void 0!==o.POSITION){const s=r.json.accessors[o.POSITION],l=s.min,c=s.max;if(void 0!==l&&void 0!==c){if(t.setX(Math.max(Math.abs(l[0]),Math.abs(c[0]))),t.setY(Math.max(Math.abs(l[1]),Math.abs(c[1]))),t.setZ(Math.max(Math.abs(l[2]),Math.abs(c[2]))),s.normalized){const e=getNormalizedComponentScale(Ba[s.componentType]);t.multiplyScalar(e)}e.max(t)}else Sa.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}o.expandByVector(e)}e.boundingBox=o;const c=new Sphere;o.getCenter(c.center),c.radius=o.min.distanceTo(o.max)/2,e.boundingSphere=c}(e,t,r),Promise.all(o).then((function(){return void 0!==t.targets?function addMorphTargets(e,t,r){let s=!1,o=!1,l=!1;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(void 0!==r.POSITION&&(s=!0),void 0!==r.NORMAL&&(o=!0),void 0!==r.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(e);const c=[],h=[],d=[];for(let p=0,A=t.length;p<A;p++){const A=t[p];if(s){const t=void 0!==A.POSITION?r.getDependency("accessor",A.POSITION):e.attributes.position;c.push(t)}if(o){const t=void 0!==A.NORMAL?r.getDependency("accessor",A.NORMAL):e.attributes.normal;h.push(t)}if(l){const t=void 0!==A.COLOR_0?r.getDependency("accessor",A.COLOR_0):e.attributes.color;d.push(t)}}return Promise.all([Promise.all(c),Promise.all(h),Promise.all(d)]).then((function(t){const r=t[0],c=t[1],h=t[2];return s&&(e.morphAttributes.position=r),o&&(e.morphAttributes.normal=c),l&&(e.morphAttributes.color=h),e.morphTargetsRelative=!0,e}))}(e,t.targets,r):e}))}class WorkerPool{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const r=this.workersResolve[e];if(r&&r(t),this.queue.length){const{resolve:t,msg:r,transfer:s}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(r,s)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((r=>{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=r,this.workers[s].postMessage(e,t)):this.queue.push({resolve:r,msg:e,transfer:t})}))}dispose(){this.workers.forEach((e=>e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}var ka=r(27538).hp;const Va=2,Ha=0,za=1,Wa=10,qa=9,Xa=15,ja=16,Ya=22,Ka=37,Ja=43,$a=76,Za=83,eo=97,to=100,io=103,no=109,ro=165,so=166;class Si{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Ii{constructor(e,t,r,s){this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,s)}}new Uint8Array([0]);const ao=[171,75,84,88,32,50,48,187,13,10,26,10];function Ei(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):ka.from(e).toString("utf8")}var oo=r(27538).hp;let lo,co,ho;const uo={env:{emscripten_notify_memory_growth:function(e){ho=new Uint8Array(co.exports.memory.buffer)}}};class zstddec_module_Q{init(){return lo||(lo="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+po).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,uo))).then(this._init):WebAssembly.instantiate(oo.from(po,"base64"),uo).then(this._init),lo)}_init(e){co=e.instance,uo.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!co)throw new Error("ZSTDDecoder: Await .init() before decoding.");const r=e.byteLength,s=co.exports.malloc(r);ho.set(e,s),t=t||Number(co.exports.ZSTD_findDecompressedSize(s,r));const o=co.exports.malloc(t),l=co.exports.ZSTD_decompress(o,t,s,r),c=ho.slice(o,o+l);return co.exports.free(s),co.exports.free(o),c}}const po="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgB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w0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQM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EEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAV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BEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5AB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AyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCEC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AAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";var Ao=r(93e3);const mo=new WeakMap;let go,fo=0;class KTX2Loader extends Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new WorkerPool,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&Ao.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:!1,etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:!1,pvrtcSupported:!1}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},e.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1)),this}init(){if(!this.transcoderPending){const e=new three_module_FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),r=new three_module_FileLoader(this.manager);r.setPath(this.transcoderPath),r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);const s=r.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,s]).then((([e,t])=>{const r=KTX2Loader.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),fo>0&&Ao.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),fo++}return this.transcoderPending}load(e,t,r,s){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const o=new three_module_FileLoader(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(e,(e=>{if(mo.has(e)){return mo.get(e).promise.then(t).catch(s)}this._createTexture(e).then((e=>t?t(e):null)).catch(s)}),r,s)}_createTextureFrom(e,t){const{faces:r,width:s,height:o,format:l,type:c,error:h,dfdFlags:d}=e;if("error"===c)return Promise.reject(h);let p;if(6===t.faceCount)p=new CompressedCubeTexture(r,l,ve);else{const e=r[0].mipmaps;p=t.layerCount>1?new CompressedArrayTexture(e,s,o,t.layerCount,l,ve):new CompressedTexture(e,s,o,l,ve)}return p.minFilter=1===r[0].mipmaps.length?ge:_e,p.magFilter=ge,p.generateMipmaps=!1,p.needsUpdate=!0,p.colorSpace=parseColorSpace(t),p.premultiplyAlpha=!!(1&d),p}async _createTexture(e,t={}){const r=function Pi(e){const t=new Uint8Array(e.buffer,e.byteOffset,ao.length);if(t[0]!==ao[0]||t[1]!==ao[1]||t[2]!==ao[2]||t[3]!==ao[3]||t[4]!==ao[4]||t[5]!==ao[5]||t[6]!==ao[6]||t[7]!==ao[7]||t[8]!==ao[8]||t[9]!==ao[9]||t[10]!==ao[10]||t[11]!==ao[11])throw new Error("Missing KTX 2.0 identifier.");const r=new Si,s=17*Uint32Array.BYTES_PER_ELEMENT,o=new Ii(e,ao.length,s,!0);r.vkFormat=o._nextUint32(),r.typeSize=o._nextUint32(),r.pixelWidth=o._nextUint32(),r.pixelHeight=o._nextUint32(),r.pixelDepth=o._nextUint32(),r.layerCount=o._nextUint32(),r.faceCount=o._nextUint32();const l=o._nextUint32();r.supercompressionScheme=o._nextUint32();const c=o._nextUint32(),h=o._nextUint32(),d=o._nextUint32(),p=o._nextUint32(),A=o._nextUint64(),m=o._nextUint64(),g=new Ii(e,ao.length+s,3*l*8,!0);for(let t=0;t<l;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+g._nextUint64(),g._nextUint64()),uncompressedByteLength:g._nextUint64()});const f=new Ii(e,c,h,!0),_={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},E=(_.descriptorBlockSize/4-6)/4;for(let e=0;e<E;e++){const t={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=f._nextInt32(),t.sampleUpper=f._nextInt32()):(t.sampleLower=f._nextUint32(),t.sampleUpper=f._nextUint32()),_.samples[e]=t}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(_);const y=new Ii(e,d,p,!0);for(;y._offset<p;){const e=y._nextUint32(),t=y._scan(e),s=Ei(t),o=y._scan(e-t.byteLength);r.keyValue[s]=s.match(/^ktx/i)?Ei(o):o,y._offset%4&&y._skip(4-y._offset%4)}if(m<=0)return r;const x=new Ii(e,A,m,!0),S=x._nextUint16(),C=x._nextUint16(),b=x._nextUint32(),I=x._nextUint32(),T=x._nextUint32(),B=x._nextUint32(),U=[];for(let e=0;e<l;e++)U.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});const F=A+x._offset,Q=F+b,O=Q+I,G=O+T,W=new Uint8Array(e.buffer,e.byteOffset+F,b),q=new Uint8Array(e.buffer,e.byteOffset+Q,I),X=new Uint8Array(e.buffer,e.byteOffset+O,T),j=new Uint8Array(e.buffer,e.byteOffset+G,B);return r.globalData={endpointCount:S,selectorCount:C,imageDescs:U,endpointsData:W,selectorsData:q,tablesData:X,extendedData:j},r}(new Uint8Array(e));if(0!==r.vkFormat)return async function createRawTexture(e){const{vkFormat:t}=e;if(void 0===vo[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let r;2===e.supercompressionScheme&&(go||(go=new Promise((async e=>{const t=new zstddec_module_Q;await t.init(),e(t)}))),r=await go);const s=[];for(let o=0;o<e.levels.length;o++){const l=Math.max(1,e.pixelWidth>>o),c=Math.max(1,e.pixelHeight>>o),h=e.pixelDepth?Math.max(1,e.pixelDepth>>o):0,d=e.levels[o];let p,A;if(0===e.supercompressionScheme)p=d.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");p=r.decode(d.levelData,d.uncompressedByteLength)}A=Eo[t]===Se?new Float32Array(p.buffer,p.byteOffset,p.byteLength/Float32Array.BYTES_PER_ELEMENT):Eo[t]===Me?new Uint16Array(p.buffer,p.byteOffset,p.byteLength/Uint16Array.BYTES_PER_ELEMENT):p,s.push({data:A,width:l,height:c,depth:h})}let o;if(_o.has(vo[t]))o=0===e.pixelDepth?new DataTexture(s[0].data,e.pixelWidth,e.pixelHeight):new Data3DTexture(s[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");o=new CompressedTexture(s,e.pixelWidth,e.pixelHeight)}return o.mipmaps=s,o.type=Eo[t],o.format=vo[t],o.colorSpace=parseColorSpace(e),o.needsUpdate=!0,Promise.resolve(o)}(r);const s=t,o=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:s},[e]))).then((e=>this._createTextureFrom(e.data,r)));return mo.set(e,{promise:o}),o}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),fo--,this}}KTX2Loader.BasisFormat={ETC1S:0,UASTC_4x4:1},KTX2Loader.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},KTX2Loader.EngineFormat={RGBAFormat:be,RGBA_ASTC_4x4_Format:Ge,RGBA_BPTC_Format:Ve,RGBA_ETC2_EAC_Format:Oe,RGBA_PVRTC_4BPPV1_Format:Fe,RGBA_S3TC_DXT5_Format:Ue,RGB_ETC1_Format:Ne,RGB_ETC2_Format:Qe,RGB_PVRTC_4BPPV1_Format:Pe,RGB_S3TC_DXT1_Format:Re},KTX2Loader.BasisWorker=function(){let e,t,r;const s=_EngineFormat,o=_TranscoderFormat,l=_BasisFormat;self.addEventListener("message",(function(c){const p=c.data;switch(p.type){case"init":e=p.config,function init(e){t=new Promise((t=>{r={wasmBinary:e,onRuntimeInitialized:t},BASIS(r)})).then((()=>{r.initializeBasis(),void 0===r.KTX2File&&Ao.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}))}(p.transcoderBinary);break;case"transcode":t.then((()=>{try{const{faces:t,buffers:c,width:A,height:m,hasAlpha:g,format:f,dfdFlags:_}=function transcode(t){const c=new r.KTX2File(new Uint8Array(t));function cleanup(){c.close(),c.delete()}if(!c.isValid())throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const p=c.isUASTC()?l.UASTC_4x4:l.ETC1S,A=c.getWidth(),m=c.getHeight(),g=c.getLayers()||1,f=c.getLevels(),_=c.getFaces(),E=c.getHasAlpha(),y=c.getDFDFlags(),{transcoderFormat:x,engineFormat:S}=function getTranscoderFormat(t,r,c,p){let A,m;const g=t===l.ETC1S?h:d;for(let s=0;s<g.length;s++){const o=g[s];if(e[o.if]&&(o.basisFormat.includes(t)&&!(p&&o.transcoderFormat.length<2)&&(!o.needsPowerOfTwo||isPowerOfTwo(r)&&isPowerOfTwo(c))))return A=o.transcoderFormat[p?1:0],m=o.engineFormat[p?1:0],{transcoderFormat:A,engineFormat:m}}return Ao.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),A=o.RGBA32,m=s.RGBAFormat,{transcoderFormat:A,engineFormat:m}}(p,A,m,E);if(!A||!m||!f)throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!c.startTranscoding())throw cleanup(),new Error("THREE.KTX2Loader: .startTranscoding failed");const C=[],b=[];for(let e=0;e<_;e++){const t=[];for(let r=0;r<f;r++){const s=[];let o,l;for(let t=0;t<g;t++){const h=c.getImageLevelInfo(r,t,e);0!==e||0!==r||0!==t||h.origWidth%4==0&&h.origHeight%4==0||Ao.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(o=h.origWidth,l=h.origHeight):(o=h.width,l=h.height);const d=new Uint8Array(c.getImageTranscodedSizeInBytes(r,t,0,x));if(!c.transcodeImage(d,r,t,e,x,0,-1,-1))throw cleanup(),new Error("THREE.KTX2Loader: .transcodeImage failed.");s.push(d)}const h=concat(s);t.push({data:h,width:o,height:l}),b.push(h.buffer)}C.push({mipmaps:t,width:A,height:m,format:S})}return cleanup(),{faces:C,buffers:b,width:A,height:m,hasAlpha:E,format:S,dfdFlags:y}}(p.buffer);self.postMessage({type:"transcode",id:p.id,faces:t,width:A,height:m,hasAlpha:g,format:f,dfdFlags:_},c)}catch(e){Ao.error(e),self.postMessage({type:"error",id:p.id,error:e.message})}}))}}));const c=[{if:"astcSupported",basisFormat:[l.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[s.RGB_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[s.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=c.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),d=c.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function isPowerOfTwo(e){return e<=2||!(e&e-1)&&0!==e}function concat(e){if(1===e.length)return e[0];let t=0;for(let r=0;r<e.length;r++){t+=e[r].byteLength}const r=new Uint8Array(t);let s=0;for(let t=0;t<e.length;t++){const o=e[t];r.set(o,s),s+=o.byteLength}return r}};const _o=new Set([be,Be,Te]),vo={[no]:be,[eo]:be,[Ka]:be,[Ja]:be,[io]:Be,[Za]:Be,[ja]:Be,[Ya]:Be,[to]:Te,[$a]:Te,[Xa]:Te,[qa]:Te,[so]:ke,[ro]:ke},Eo={[no]:Se,[eo]:Me,[Ka]:ve,[Ja]:ve,[io]:Se,[Za]:Me,[ja]:ve,[Ya]:ve,[to]:Se,[$a]:Me,[Xa]:ve,[qa]:ve,[so]:ve,[ro]:ve};function parseColorSpace(e){const t=e.dataFormatDescriptor[0];return t.colorPrimaries===za?t.transferFunction===Va?et:tt:t.colorPrimaries===Wa?t.transferFunction===Va?it:nt:(t.colorPrimaries===Ha||Ao.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),Ze)}var yo,xo;const So=Symbol("retainerCount"),Mo=Symbol("recentlyUsed"),Co=Symbol("evict"),bo=Symbol("evictionThreshold"),Io=Symbol("cache");class CacheEvictionPolicy{constructor(e,t=5){this[yo]=new Map,this[xo]=[],this[Io]=e,this[bo]=t}set evictionThreshold(e){this[bo]=e,this[Co]()}get evictionThreshold(){return this[bo]}get cache(){return this[Io]}retainerCount(e){return this[So].get(e)||0}reset(){this[So].clear(),this[Mo]=[]}retain(e){this[So].has(e)||this[So].set(e,0),this[So].set(e,this[So].get(e)+1);const t=this[Mo].indexOf(e);-1!==t&&this[Mo].splice(t,1),this[Mo].unshift(e),this[Co]()}release(e){this[So].has(e)&&this[So].set(e,Math.max(this[So].get(e)-1,0)),this[Co]()}[(yo=So,xo=Mo,Co)](){if(!(this[Mo].length<this[bo]))for(let e=this[Mo].length-1;e>=this[bo];--e){const t=this[Mo][e];0===this[So].get(t)&&(this[Io].delete(t),this[Mo].splice(e,1))}}}const mappingsArrayToTable=e=>{const t=new Map;for(const r of e.mappings)for(const e of r.variants)t.set(e,{material:null,gltfMaterialIndex:r.material});return t};class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,r=t.json;if(void 0===r.extensions||void 0===r.extensions[this.name])return null;const s=(e=>{const t=[],r=new Set;for(const s of e){let e=s,o=0;for(;r.has(e);)e=s+"."+ ++o;r.add(e),t.push(e)}return t})((r.extensions[this.name].variants||[]).map((e=>e.name)));for(const s of e.scenes)s.traverse((e=>{const s=e;if(!s.material)return;const o=t.associations.get(s);if(null==o||null==o.meshes||null==o.primitives)return;const l=r.meshes[o.meshes].primitives[o.primitives].extensions;l&&l[this.name]&&(s.userData.variantMaterials=mappingsArrayToTable(l[this.name]))}));return e.userData.variants=s,Promise.resolve()}}var wo,To,Bo=r(93e3);Texture.DEFAULT_ANISOTROPY=4;const Ro=new Map,Lo=new Map;let Do;const Uo=new class DRACOLoader extends Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,s){const o=new three_module_FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(e=>{this.parse(e,t,s)}),r,s)}parse(e,t,r=()=>{}){this.decodeDracoFile(e,t,null,null,et).catch(r)}decodeDracoFile(e,t,r,s,o=tt,l=()=>{}){const c={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:o};return this.decodeGeometry(e,c).then(t).catch(l)}decodeGeometry(e,t){const r=JSON.stringify(t);if(ya.has(e)){const t=ya.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const o=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(o,l).then((r=>(s=r,new Promise(((r,l)=>{s._callbacks[o]={resolve:r,reject:l},s.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return c.catch((()=>!0)).then((()=>{s&&o&&this._releaseTask(s,o)})),ya.set(e,{key:r,promise:c}),c}_createGeometry(e){const t=new three_module_BufferGeometry;e.index&&t.setIndex(new three_module_BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r],o=s.name,l=s.array,c=s.itemSize,h=new three_module_BufferAttribute(l,c);"color"===o&&(this._assignVertexColorSpace(h,s.vertexColorSpace),h.normalized=l instanceof Float32Array==!1),t.setAttribute(o,h)}return t}_assignVertexColorSpace(e,t){if(t!==et)return;const r=new Color;for(let t=0,s=e.count;t<s;t++)r.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,r.r,r.g,r.b)}_loadLibrary(e,t){const r=new three_module_FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise(((t,s)=>{r.load(e,t,void 0,s)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const s=DRACOWorker.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:Ea.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){Ea.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}};let Po;const Fo=new KTX2Loader;let No,Qo;const Oo=Symbol("loader"),Go=Symbol("evictionPolicy"),ko=Symbol("GLTFInstance");class CachingGLTFLoader extends EventDispatcher{constructor(e){super(),this[To]=(new GLTFLoader).register((e=>new GLTFMaterialsVariantsExtension(e))),this[ko]=e,this[Oo].setDRACOLoader(Uo),this[Oo].setKTX2Loader(Fo)}static setDRACODecoderLocation(e){Do=e,Uo.setDecoderPath(e)}static getDRACODecoderLocation(){return Do}static setKTX2TranscoderLocation(e){Po=e,Fo.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return Po}static setMeshoptDecoderLocation(e){var t;No!==e&&(No=e,Qo=(t=e,new Promise(((e,r)=>{const s=document.createElement("script");document.body.appendChild(s),s.onload=e,s.onerror=r,s.async=!0,s.src=t}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return No}static initializeKTX2Loader(e){Fo.detectSupport(e)}static get cache(){return Ro}static clearCache(){Ro.forEach(((e,t)=>{this.delete(t)})),this[Go].reset()}static has(e){return Ro.has(e)}static async delete(e){if(!this.has(e))return;const t=Ro.get(e);Lo.delete(e),Ro.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!Lo.get(e)}get[(wo=Go,To=Oo,Go)](){return this.constructor[Go]}async preload(e,t,r=()=>{}){if(this[Oo].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!Ro.has(e)){null!=Qo&&this[Oo].setMeshoptDecoder(await Qo);const t=((e,t,r=()=>{})=>{const onProgress=e=>{const t=e.loaded/e.total;r(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise(((r,s)=>{t.load(e,r,onProgress,s)}))})(e,this[Oo],(e=>{r(.8*e)})),s=this[ko],o=t.then((e=>s.prepare(e))).then((e=>(r(.9),new s(e)))).catch((e=>(Bo.error(e),new s)));Ro.set(e,o)}await Ro.get(e),Lo.set(e,!0),r&&r(1)}async load(e,t,r=()=>{}){await this.preload(e,t,r);const s=await Ro.get(e),o=await s.clone();return this[Go].retain(e),o.dispose=()=>{this[Go].release(e)},o}}CachingGLTFLoader[wo]=new CacheEvictionPolicy(CachingGLTFLoader);class CSS2DObject extends Object3D{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Vector2(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const Vo=new three_module_Vector3,Ho=new three_module_Matrix4,zo=new three_module_Matrix4,Wo=new three_module_Vector3,qo=new three_module_Vector3;class CSS2DRenderer{constructor(e={}){const t=this;let r,s,o,l;const c={objects:new WeakMap},h=void 0!==e.element?e.element:document.createElement("div");function renderObject(e,r,s){if(e.isCSS2DObject){Vo.setFromMatrixPosition(e.matrixWorld),Vo.applyMatrix4(zo);const d=!0===e.visible&&Vo.z>=-1&&Vo.z<=1&&!0===e.layers.test(s.layers);if(e.element.style.display=!0===d?"":"none",!0===d){e.onBeforeRender(t,r,s);const c=e.element;c.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(Vo.x*o+o)+"px,"+(-Vo.y*l+l)+"px)",c.parentNode!==h&&h.appendChild(c),e.onAfterRender(t,r,s)}const p={distanceToCameraSquared:getDistanceToSquared(s,e)};c.objects.set(e,p)}for(let t=0,o=e.children.length;t<o;t++)renderObject(e.children[t],r,s)}function getDistanceToSquared(e,t){return Wo.setFromMatrixPosition(e.matrixWorld),qo.setFromMatrixPosition(t.matrixWorld),Wo.distanceToSquared(qo)}h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:r,height:s}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),Ho.copy(t.matrixWorldInverse),zo.multiplyMatrices(t.projectionMatrix,Ho),renderObject(e,e,t),function zOrder(e){const t=function filterAndFlatten(e){const t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return c.objects.get(e).distanceToCameraSquared-c.objects.get(t).distanceToCameraSquared})),r=t.length;for(let e=0,s=t.length;e<s;e++)t[e].element.style.zIndex=r-e}(e)},this.setSize=function(e,t){r=e,s=t,o=r/2,l=s/2,h.style.width=e+"px",h.style.height=t+"px"}}}r(93e3);function reduceVertices(e,t,r){let s=r;const o=new three_module_Vector3;return e.updateWorldMatrix(!0,!0),e.traverseVisible((e=>{const{geometry:r}=e;if(void 0!==r){const{position:l}=r.attributes;if(void 0!==l)for(let r=0,c=l.count;r<c;r++)e.isMesh?e.getVertexPosition(r,o):o.fromBufferAttribute(l,r),e.isSkinnedMesh||o.applyMatrix4(e.matrixWorld),s=t(s,o)}})),s}let Xo,jo,Yo,Ko;function decompress(e,t=1/0,r=null){jo||(jo=new PlaneGeometry(2,2,1,1)),Yo||(Yo=new ShaderMaterial({uniforms:{blitTexture:new Uniform(e)},vertexShader:"\n\t\t\tvarying vec2 vUv;\n\t\t\tvoid main(){\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = vec4(position.xy * 1.0,0.,.999999);\n\t\t\t}",fragmentShader:"\n\t\t\tuniform sampler2D blitTexture; \n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main(){ \n\t\t\t\tgl_FragColor = vec4(vUv.xy, 0, 1);\n\t\t\t\t\n\t\t\t\t#ifdef IS_SRGB\n\t\t\t\tgl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n\t\t\t\t#else\n\t\t\t\tgl_FragColor = texture2D( blitTexture, vUv);\n\t\t\t\t#endif\n\t\t\t}"})),Yo.uniforms.blitTexture.value=e,Yo.defines.IS_SRGB=e.colorSpace==et,Yo.needsUpdate=!0,Ko||(Ko=new three_module_Mesh(jo,Yo),Ko.frustrumCulled=!1);const s=new PerspectiveCamera,o=new Scene;o.add(Ko),null===r&&(r=Xo=new WebGLRenderer({antialias:!1}));const l=Math.min(e.image.width,t),c=Math.min(e.image.height,t);r.setSize(l,c),r.clear(),r.render(o,s);const h=document.createElement("canvas"),d=h.getContext("2d");h.width=l,h.height=c,d.drawImage(r.domElement,0,0,l,c);const p=new CanvasTexture(h);return p.minFilter=e.minFilter,p.magFilter=e.magFilter,p.wrapS=e.wrapS,p.wrapT=e.wrapT,p.name=e.name,Xo&&(Xo.forceContextLoss(),Xo.dispose(),Xo=null),p}var Jo=r(93e3);const $o={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class GLTFExporter{constructor(){this.pluginCallbacks=[],this.register((function(e){return new GLTFLightExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsUnlitExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMeshGpuInstancing(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){const o=new GLTFWriter,l=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)l.push(this.pluginCallbacks[e](o));o.setPlugins(l),o.write(e,t,s).catch(r)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,s,o,t)}))}}const Zo=0,el=1,tl=2,il=3,nl=4,rl=5120,sl=5121,al=5122,ol=5123,ll=5124,cl=5125,hl=5126,ul=34962,dl=34963,pl=9728,Al=9729,ml=9984,gl=9985,fl=9986,_l=9987,vl=33071,El=33648,yl=10497,xl="KHR_mesh_quantization",Sl={};Sl[pe]=pl,Sl[1004]=ml,Sl[1005]=fl,Sl[1006]=Al,Sl[1007]=gl,Sl[1008]=_l,Sl[1001]=vl,Sl[1e3]=yl,Sl[1002]=El;const Ml={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},Cl=new Color;function equalArray(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){const r=getPaddedBufferSize(e.byteLength);if(r!==e.byteLength){const s=new Uint8Array(r);if(s.set(new Uint8Array(e)),0!==t)for(let o=e.byteLength;o<r;o++)s[o]=t;return s.buffer}return e}function getCanvas(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function getToBlobPromise(e,t){if(void 0!==e.toBlob)return new Promise((r=>e.toBlob(r,t)));let r;return"image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r})}class GLTFWriter{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const s=this,o=s.buffers,l=s.json;r=s.options;const c=s.extensionsUsed,h=s.extensionsRequired,d=new Blob(o,{type:"application/octet-stream"}),p=Object.keys(c),A=Object.keys(h);if(p.length>0&&(l.extensionsUsed=p),A.length>0&&(l.extensionsRequired=A),l.buffers&&l.buffers.length>0&&(l.buffers[0].byteLength=d.size),!0===r.binary){const e=new FileReader;e.readAsArrayBuffer(d),e.onloadend=function(){const r=getPaddedArrayBuffer(e.result),s=new DataView(new ArrayBuffer(8));s.setUint32(0,r.byteLength,!0),s.setUint32(4,5130562,!0);const o=getPaddedArrayBuffer(function stringToArrayBuffer(e){return(new TextEncoder).encode(e).buffer}(JSON.stringify(l)),32),c=new DataView(new ArrayBuffer(8));c.setUint32(0,o.byteLength,!0),c.setUint32(4,1313821514,!0);const h=new ArrayBuffer(12),d=new DataView(h);d.setUint32(0,1179937895,!0),d.setUint32(4,2,!0);const p=12+c.byteLength+o.byteLength+s.byteLength+r.byteLength;d.setUint32(8,p,!0);const A=new Blob([h,c,o,s,r],{type:"application/octet-stream"}),m=new FileReader;m.readAsArrayBuffer(A),m.onloadend=function(){t(m.result)}}}else if(l.buffers&&l.buffers.length>0){const e=new FileReader;e.readAsDataURL(d),e.onloadend=function(){const r=e.result;l.buffers[0].uri=r,t(l)}}else t(l)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const r=this.options,s=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&o.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in o.gltfExtensions)t.extensions[e]=o.gltfExtensions[e],s[e]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(t){Jo.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){const t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new three_module_Vector3;for(let r=0,s=e.count;r<s;r++)if(Math.abs(t.fromBufferAttribute(e,r).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),s=new three_module_Vector3;for(let e=0,t=r.count;e<t;e++)s.fromBufferAttribute(r,e),0===s.x&&0===s.y&&0===s.z?s.setX(1):s.normalize(),r.setXYZ(e,s.x,s.y,s.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){let r=!1;const s={};0===t.offset.x&&0===t.offset.y||(s.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(s.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(s.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===et?function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function LinearToLinear(e){return e}}Jo.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof CompressedTexture&&(e=decompress(e)),t instanceof CompressedTexture&&(t=decompress(t));const r=e?e.image:null,s=t?t.image:null,o=Math.max(r?r.width:0,s?s.width:0),l=Math.max(r?r.height:0,s?s.height:0),c=getCanvas();c.width=o,c.height=l;const h=c.getContext("2d");h.fillStyle="#00ffff",h.fillRect(0,0,o,l);const d=h.getImageData(0,0,o,l);if(r){h.drawImage(r,0,0,o,l);const t=getEncodingConversion(e),s=h.getImageData(0,0,o,l).data;for(let e=2;e<s.length;e+=4)d.data[e]=256*t(s[e]/256)}if(s){h.drawImage(s,0,0,o,l);const e=getEncodingConversion(t),r=h.getImageData(0,0,o,l).data;for(let t=1;t<r.length;t+=4)d.data[t]=256*e(r[t]/256)}h.putImageData(d,0,0);const p=(e||t).clone();return p.source=new Source(c),p.colorSpace=Ze,p.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&Jo.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),p}processBuffer(e){const t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,s,o){const l=this.json;let c;switch(l.bufferViews||(l.bufferViews=[]),t){case rl:case sl:c=1;break;case al:case ol:c=2;break;default:c=4}const h=getPaddedBufferSize(s*e.itemSize*c),d=new DataView(new ArrayBuffer(h));let p=0;for(let o=r;o<r+s;o++)for(let r=0;r<e.itemSize;r++){let s;e.itemSize>4?s=e.array[o*e.itemSize+r]:(0===r?s=e.getX(o):1===r?s=e.getY(o):2===r?s=e.getZ(o):3===r&&(s=e.getW(o)),!0===e.normalized&&(s=bt.normalize(s,e.array))),t===hl?d.setFloat32(p,s,!0):t===ll?d.setInt32(p,s,!0):t===cl?d.setUint32(p,s,!0):t===al?d.setInt16(p,s,!0):t===ol?d.setUint16(p,s,!0):t===rl?d.setInt8(p,s):t===sl&&d.setUint8(p,s),p+=c}const A={buffer:this.processBuffer(d.buffer),byteOffset:this.byteOffset,byteLength:h};void 0!==o&&(A.target=o),o===ul&&(A.byteStride=e.itemSize*c),this.byteOffset+=h,l.bufferViews.push(A);return{id:l.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(s){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const e=getPaddedArrayBuffer(o.result),l={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,s(r.bufferViews.push(l)-1)}}))}processAccessor(e,t,r,s){const o=this.json;let l;if(e.array.constructor===Float32Array)l=hl;else if(e.array.constructor===Int32Array)l=ll;else if(e.array.constructor===Uint32Array)l=cl;else if(e.array.constructor===Int16Array)l=al;else if(e.array.constructor===Uint16Array)l=ol;else if(e.array.constructor===Int8Array)l=rl;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);l=sl}if(void 0===r&&(r=0),void 0!==s&&s!==1/0||(s=e.count),0===s)return null;const c=function getMinMax(e,t,r){const s={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let o=t;o<t+r;o++)for(let t=0;t<e.itemSize;t++){let r;e.itemSize>4?r=e.array[o*e.itemSize+t]:(0===t?r=e.getX(o):1===t?r=e.getY(o):2===t?r=e.getZ(o):3===t&&(r=e.getW(o)),!0===e.normalized&&(r=bt.normalize(r,e.array))),s.min[t]=Math.min(s.min[t],r),s.max[t]=Math.max(s.max[t],r)}return s}(e,r,s);let h;void 0!==t&&(h=e===t.index?dl:ul);const d=this.processBufferView(e,l,r,s,h),p={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:s,max:c.max,min:c.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(p.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(p)-1}processImage(e,t,r,s="image/png"){if(null!==e){const o=this,l=o.cache,c=o.json,h=o.options,d=o.pending;l.images.has(e)||l.images.set(e,{});const p=l.images.get(e),A=s+":flipY/"+r.toString();if(void 0!==p[A])return p[A];c.images||(c.images=[]);const m={mimeType:s},g=getCanvas();g.width=Math.min(e.width,h.maxTextureSize),g.height=Math.min(e.height,h.maxTextureSize);const f=g.getContext("2d");if(!0===r&&(f.translate(0,g.height),f.scale(1,-1)),void 0!==e.data){t!==be&&Jo.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>h.maxTextureSize||e.height>h.maxTextureSize)&&Jo.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const r=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<r.length;t+=4)r[t+0]=e.data[t+0],r[t+1]=e.data[t+1],r[t+2]=e.data[t+2],r[t+3]=e.data[t+3];f.putImageData(new ImageData(r,e.width,e.height),0,0)}else f.drawImage(e,0,0,g.width,g.height);!0===h.binary?d.push(getToBlobPromise(g,s).then((e=>o.processBufferViewImage(e))).then((e=>{m.bufferView=e}))):void 0!==g.toDataURL?m.uri=g.toDataURL(s):d.push(getToBlobPromise(g,s).then((e=>(new FileReader).readAsDataURL(e))).then((e=>{m.uri=e})));const _=c.images.push(m)-1;return p[A]=_,_}throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:Sl[e.magFilter],minFilter:Sl[e.minFilter],wrapS:Sl[e.wrapS],wrapT:Sl[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const t=this.options,r=this.cache,s=this.json;if(r.textures.has(e))return r.textures.get(e);s.textures||(s.textures=[]),e instanceof CompressedTexture&&(e=decompress(e,t.maxTextureSize));let o=e.userData.mimeType;"image/webp"===o&&(o="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(l.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,l)}));const c=s.textures.push(l)-1;return r.textures.set(e,c),c}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return Jo.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const s={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&Jo.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(equalArray(o,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=.5,s.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),r={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(r,t),s.pbrMetallicRoughness.metallicRoughnessTexture=r}if(e.map){const t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),s.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),s.emissiveTexture=t}}if(e.normalMap){const t={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),s.normalTexture=t}if(e.aoMap){const t={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),s.occlusionTexture=t}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),e.side===m&&(s.doubleSided=!0),""!==e.name&&(s.name=e.name),this.serializeUserData(e,s),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,s)}));const l=r.materials.push(s)-1;return t.materials.set(e,l),l}processMesh(e){const t=this.cache,r=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,r=e.material.length;t<r;t++)s.push(e.material[t].uuid);else s.push(e.material.uuid);const o=s.join(":");if(t.meshes.has(o))return t.meshes.get(o);const l=e.geometry;let c;c=e.isLineSegments?el:e.isLineLoop?tl:e.isLine?il:e.isPoints?Zo:e.material.wireframe?el:nl;const h={},d={},p=[],A=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},g=l.getAttribute("normal");void 0===g||this.isNormalizedNormalAttribute(g)||(Jo.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(g)));let f=null;for(let e in l.attributes){if("morph"===e.slice(0,5))continue;const r=l.attributes[e];e=m[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),t.attributes.has(this.getUID(r))){d[e]=t.attributes.get(this.getUID(r));continue}f=null;const s=r.array;"JOINTS_0"!==e||s instanceof Uint16Array||s instanceof Uint8Array||(Jo.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),f=new three_module_BufferAttribute(new Uint16Array(s),r.itemSize,r.normalized));const o=this.processAccessor(f||r,l);null!==o&&(e.startsWith("_")||this.detectMeshQuantization(e,r),d[e]=o,t.attributes.set(this.getUID(r),o))}if(void 0!==g&&l.setAttribute("normal",g),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const r=[],s=[],o={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)o[e.morphTargetDictionary[t]]=t;for(let c=0;c<e.morphTargetInfluences.length;++c){const h={};let d=!1;for(const e in l.morphAttributes){if("position"!==e&&"normal"!==e){d||(Jo.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),d=!0);continue}const r=l.morphAttributes[e][c],s=e.toUpperCase(),o=l.attributes[e];if(t.attributes.has(this.getUID(r,!0))){h[s]=t.attributes.get(this.getUID(r,!0));continue}const p=r.clone();if(!l.morphTargetsRelative)for(let e=0,t=r.count;e<t;e++)for(let t=0;t<r.itemSize;t++)0===t&&p.setX(e,r.getX(e)-o.getX(e)),1===t&&p.setY(e,r.getY(e)-o.getY(e)),2===t&&p.setZ(e,r.getZ(e)-o.getZ(e)),3===t&&p.setW(e,r.getW(e)-o.getW(e));h[s]=this.processAccessor(p,l),t.attributes.set(this.getUID(o,!0),h[s])}A.push(h),r.push(e.morphTargetInfluences[c]),void 0!==e.morphTargetDictionary&&s.push(o[c])}h.weights=r,s.length>0&&(h.extras={},h.extras.targetNames=s)}const _=Array.isArray(e.material);if(_&&0===l.groups.length)return null;let E=!1;if(_&&null===l.index){const e=[];for(let t=0,r=l.attributes.position.count;t<r;t++)e[t]=t;l.setIndex(e),E=!0}const y=_?e.material:[e.material],x=_?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,r=x.length;e<r;e++){const r={mode:c,attributes:d};if(this.serializeUserData(l,r),A.length>0&&(r.targets=A),null!==l.index){let s=this.getUID(l.index);void 0===x[e].start&&void 0===x[e].count||(s+=":"+x[e].start+":"+x[e].count),t.attributes.has(s)?r.indices=t.attributes.get(s):(r.indices=this.processAccessor(l.index,l,x[e].start,x[e].count),t.attributes.set(s,r.indices)),null===r.indices&&delete r.indices}const s=this.processMaterial(y[x[e].materialIndex]);null!==s&&(r.material=s),p.push(r)}!0===E&&l.setIndex(null),h.primitives=p,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,h)}));const S=r.meshes.push(h)-1;return t.meshes.set(o,S),S}detectMeshQuantization(e,t){if(this.extensionsUsed[xl])return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const s=e.split("_",1)[0];$o[s]&&$o[s].includes(r)&&(this.extensionsUsed[xl]=!0,this.extensionsRequired[xl]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,s={type:r?"orthographic":"perspective"};return r?s.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:s.perspective={aspectRatio:e.aspect,yfov:bt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(s.name=e.type),t.cameras.push(s)-1}processAnimation(e,t){const r=this.json,s=this.nodeMap;r.animations||(r.animations=[]);const o=(e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,l=[],c=[];for(let e=0;e<o.length;++e){const r=o[e],h=PropertyBinding.parseTrackName(r.name);let d=PropertyBinding.findNode(t,h.nodeName);const p=Ml[h.propertyName];if("bones"===h.objectName&&(d=!0===d.isSkinnedMesh?d.skeleton.getBoneByName(h.objectIndex):void 0),!d||!p)return Jo.warn('THREE.GLTFExporter: Could not export animation track "%s".',r.name),null;const A=1;let m,g=r.values.length/r.times.length;p===Ml.morphTargetInfluences&&(g/=d.morphTargetInfluences.length),!0===r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(m="CUBICSPLINE",g/=3):m=r.getInterpolation()===We?"STEP":"LINEAR",c.push({input:this.processAccessor(new three_module_BufferAttribute(r.times,A)),output:this.processAccessor(new three_module_BufferAttribute(r.values,g)),interpolation:m}),l.push({sampler:c.length-1,target:{node:s.get(d),path:p}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:c,channels:l}),r.animations.length-1}processSkin(e){const t=this.json,r=this.nodeMap,s=t.nodes[r.get(e)],o=e.skeleton;if(void 0===o)return null;const l=e.skeleton.bones[0];if(void 0===l)return null;const c=[],h=new Float32Array(16*o.bones.length),d=new three_module_Matrix4;for(let t=0;t<o.bones.length;++t)c.push(r.get(o.bones[t])),d.copy(o.boneInverses[t]),d.multiply(e.bindMatrix).toArray(h,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new three_module_BufferAttribute(h,16)),joints:c,skeleton:r.get(l)});return s.skin=t.skins.length-1}processNode(e){const t=this.json,r=this.options,s=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(r.trs){const t=e.quaternion.toArray(),r=e.position.toArray(),s=e.scale.toArray();equalArray(t,[0,0,0,1])||(o.rotation=t),equalArray(r,[0,0,0])||(o.translation=r),equalArray(s,[1,1,1])||(o.scale=s)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===function isIdentityMatrix(e){return equalArray(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}(e.matrix)&&(o.matrix=e.matrix.elements);if(""!==e.name&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints){const t=this.processMesh(e);null!==t&&(o.mesh=t)}else e.isCamera&&(o.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const t=[];for(let s=0,o=e.children.length;s<o;s++){const o=e.children[s];if(o.visible||!1===r.onlyVisible){const e=this.processNode(o);null!==e&&t.push(e)}}t.length>0&&(o.children=t)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,o)}));const l=t.nodes.push(o)-1;return s.set(e,l),l}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};""!==e.name&&(s.name=e.name),t.scenes.push(s);const o=[];for(let t=0,s=e.children.length;t<s;t++){const s=e.children[t];if(s.visible||!1===r.onlyVisible){const e=this.processNode(s);null!==e&&o.push(e)}}o.length>0&&(s.nodes=o),this.serializeUserData(e,s)}processObjects(e){const t=new Scene;t.name="AuxScene";for(let r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)}));const r=[];for(let t=0;t<e.length;t++)e[t]instanceof Scene?this.processScene(e[t]):r.push(e[t]);r.length>0&&this.processObjects(r);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let r=0;r<t.animations.length;++r)this.processAnimation(t.animations[r],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(let t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}class GLTFLightExtension{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void Jo.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const r=this.writer,s=r.json,o=r.extensionsUsed,l={};e.name&&(l.name=e.name),l.color=e.color.toArray(),l.intensity=e.intensity,e.isDirectionalLight?l.type="directional":e.isPointLight?(l.type="point",e.distance>0&&(l.range=e.distance)):e.isSpotLight&&(l.type="spot",e.distance>0&&(l.range=e.distance),l.spot={},l.spot.innerConeAngle=(1-e.penumbra)*e.angle,l.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&Jo.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||Jo.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},o[this.name]=!0);const c=s.extensions[this.name].lights;c.push(l),t.extensions=t.extensions||{},t.extensions[this.name]={light:c.length-1}}}class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class GLTFExporter_GLTFMaterialsClearcoatExtension{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(t,e.clearcoatMap),o.clearcoatTexture=t}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(t,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};r.applyTextureTransform(t,e.clearcoatNormalMap),o.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIridescenceExtension{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(t,e.iridescenceMap),o.iridescenceTexture=t}if(o.iridescenceIor=e.iridescenceIOR,o.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],o.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const t={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(t,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsTransmissionExtension{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const t={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(t,e.transmissionMap),o.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsVolumeExtension{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const t={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(t,e.thicknessMap),o.thicknessTexture=t}o.attenuationDistance=e.attenuationDistance,o.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIorExtension{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;const r=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsSpecularExtension{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(Cl)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.specularIntensityMap){const t={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(t,e.specularIntensityMap),o.specularTexture=t}if(e.specularColorMap){const t={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(t,e.specularColorMap),o.specularColorTexture=t}o.specularFactor=e.specularIntensity,o.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsSheenExtension{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.sheenRoughnessMap){const t={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(t,e.sheenRoughnessMap),o.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(t,e.sheenColorMap),o.sheenColorTexture=t}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsAnisotropyExtension{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.anisotropyMap){const t={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(t,e.anisotropyMap),o.anisotropyTexture=t}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;const r=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsBumpExtension{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.bumpMap){const t={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(t,e.bumpMap),o.bumpTexture=t}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMeshGpuInstancing{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,s=e,o=new Float32Array(3*s.count),l=new Float32Array(4*s.count),c=new Float32Array(3*s.count),h=new three_module_Matrix4,d=new three_module_Vector3,p=new three_module_Quaternion,A=new three_module_Vector3;for(let e=0;e<s.count;e++)s.getMatrixAt(e,h),h.decompose(d,p,A),d.toArray(o,3*e),p.toArray(l,4*e),A.toArray(c,3*e);const m={TRANSLATION:r.processAccessor(new three_module_BufferAttribute(o,3)),ROTATION:r.processAccessor(new three_module_BufferAttribute(l,4)),SCALE:r.processAccessor(new three_module_BufferAttribute(c,3))};s.instanceColor&&(m._COLOR_0=r.processAccessor(s.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:m},r.extensionsUsed[this.name]=!0,r.extensionsRequired[this.name]=!0}}GLTFExporter.Utils={insertKeyframe:function(e,t){const r=.001,s=e.getValueSize(),o=new e.TimeBufferType(e.times.length+1),l=new e.ValueBufferType(e.values.length+s),c=e.createInterpolant(new e.ValueBufferType(s));let h;if(0===e.times.length){o[0]=t;for(let e=0;e<s;e++)l[e]=0;h=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<r)return 0;o[0]=t,o.set(e.times,1),l.set(c.evaluate(t),0),l.set(e.values,s),h=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<r)return e.times.length-1;o[o.length-1]=t,o.set(e.times,0),l.set(e.values,0),l.set(c.evaluate(t),e.values.length),h=o.length-1}else for(let d=0;d<e.times.length;d++){if(Math.abs(e.times[d]-t)<r)return d;if(e.times[d]<t&&e.times[d+1]>t){o.set(e.times.slice(0,d+1),0),o[d+1]=t,o.set(e.times.slice(d+1),d+2),l.set(e.values.slice(0,(d+1)*s),0),l.set(c.evaluate(t),(d+1)*s),l.set(e.values.slice((d+1)*s),(d+2)*s),h=d+1;break}}return e.times=o,e.values=l,h},mergeMorphTargetTracks:function(e,t){const r=[],s={},o=e.tracks;for(let e=0;e<o.length;++e){let l=o[e];const c=PropertyBinding.parseTrackName(l.name),h=PropertyBinding.findNode(t,c.nodeName);if("morphTargetInfluences"!==c.propertyName||void 0===c.propertyIndex){r.push(l);continue}if(l.createInterpolant!==l.InterpolantFactoryMethodDiscrete&&l.createInterpolant!==l.InterpolantFactoryMethodLinear){if(l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");Jo.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),l=l.clone(),l.setInterpolation(qe)}const d=h.morphTargetInfluences.length,p=h.morphTargetDictionary[c.propertyIndex];if(void 0===p)throw new Error("THREE.GLTFExporter: Morph target name not found: "+c.propertyIndex);let A;if(void 0===s[h.uuid]){A=l.clone();const e=new A.ValueBufferType(d*A.times.length);for(let t=0;t<A.times.length;t++)e[t*d+p]=A.values[t];A.name=(c.nodeName||"")+".morphTargetInfluences",A.values=e,s[h.uuid]=A,r.push(A);continue}const m=l.createInterpolant(new l.ValueBufferType(1));A=s[h.uuid];for(let e=0;e<A.times.length;e++)A.values[e*d+p]=m.evaluate(A.times[e]);for(let e=0;e<l.times.length;e++){const t=this.insertKeyframe(A,l.times[e]);A.values[t*d+p]=l.values[e]}}return e.tracks=r,e}};const compatibleObject=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter((e=>compatibleMaterial(e.material))),compatibleMaterial=e=>e&&e.isMaterial&&!Array.isArray(e);class GLTFExporterMaterialsVariantsExtension{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set;for(const r of e)r.traverse((e=>{if(!compatibleObject(e))return;const r=e.userData.variantMaterials,s=e.userData.variantData;for(const[e,o]of s){const s=r.get(o.index);s&&compatibleMaterial(s.material)&&t.add(e)}}));t.forEach((e=>this.variantNames.push(e)))}writeMesh(e,t){if(!compatibleObject(e))return;const r=e.userData,s=r.variantMaterials,o=r.variantData,l=new Map,c=new Map,h=Array.from(o.values()).sort(((e,t)=>e.index-t.index));for(const[e,t]of h.entries())c.set(t.index,e);for(const e of o.values()){const t=s.get(e.index);if(!t||!compatibleMaterial(t.material))continue;const r=this.writer.processMaterial(t.material);l.has(r)||l.set(r,{material:r,variants:[]}),l.get(r).variants.push(c.get(e.index))}const d=Array.from(l.values()).map((e=>e.variants.sort(((e,t)=>e-t))&&e)).sort(((e,t)=>e.material-t.material));if(0===d.length)return;const p=compatibleMaterial(r.originalMaterial)?this.writer.processMaterial(r.originalMaterial):-1;for(const e of t.primitives)p>=0&&(e.material=p),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:d}}afterParse(){if(0===this.variantNames.length)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map((e=>({name:e})));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class SessionLightProbe{constructor(e,t,r,s,o){this.xrLight=e,this.renderer=t,this.lightProbe=r,this.xrWebGLBinding=null,this.estimationStartCallback=o,this.frameCallback=this.onXRFrame.bind(this);const l=t.xr.getSession();if(s&&"XRWebGLBinding"in window){const r=new WebGLCubeRenderTarget(16);e.environment=r.texture;const s=t.getContext();switch(l.preferredReflectionFormat){case"srgba8":s.getExtension("EXT_sRGB");break;case"rgba16f":s.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(l,s),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}l.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const r=t.getLightEstimate(this.lightProbe);if(r){this.xrLight.lightProbe.sh.fromArray(r.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(r.primaryLightIntensity.x,Math.max(r.primaryLightIntensity.y,r.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(r.primaryLightIntensity.x/e,r.primaryLightIntensity.y/e,r.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(r.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class XREstimatedLight extends three_module_Group{constructor(e,t=!0){super(),this.lightProbe=new LightProbe,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new DirectionalLight,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let r=null,s=!1;e.xr.addEventListener("sessionstart",(()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then((o=>{r=new SessionLightProbe(this,e,o,t,(()=>{s=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),e.xr.addEventListener("sessionend",(()=>{r&&(r.dispose(),r=null),s&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{r&&(r.dispose(),r=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class Damper{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,r,s){const o=2e-4*this.naturalFrequency;if(null==e||0===s)return t;if(e===t&&0===this.velocity)return t;if(r<0)return e;const l=e-t,c=this.velocity+this.naturalFrequency*l,h=l+r*c,d=Math.exp(-this.naturalFrequency*r),p=(c-this.naturalFrequency*h)*d,A=-this.naturalFrequency*(p+c*d);return Math.abs(p)<o*Math.abs(s)&&A*l>=0?(this.velocity=0,t):(this.velocity=p,t+h*d)}}const bl=.2,Il=Math.PI/24,wl=new Vector2,addCorner=(e,t,r)=>{let s=t>0?r>0?0:-Math.PI/2:r>0?Math.PI/2:Math.PI;for(let o=0;o<=12;++o)e.push(t+.17*Math.cos(s),r+.17*Math.sin(s),0,t+bl*Math.cos(s),r+bl*Math.sin(s),0),s+=Il};class PlacementBox extends three_module_Mesh{constructor(e,t){const r=new three_module_BufferGeometry,s=[],o=[],{size:l,boundingBox:c}=e,h=l.x/2,d=("back"===t?l.y:l.z)/2;addCorner(o,h,d),addCorner(o,-h,d),addCorner(o,-h,-d),addCorner(o,h,-d);const p=o.length/3;for(let e=0;e<p-2;e+=2)s.push(e,e+1,e+3,e,e+3,e+2);const A=p-2;s.push(A,A+1,1,A,1,0),r.setAttribute("position",new three_module_Float32BufferAttribute(o,3)),r.setIndex(s),super(r),this.side=t;const g=this.material;switch(g.side=m,g.transparent=!0,g.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new three_module_Mesh(new PlaneGeometry(2*(h+bl),2*(d+bl))),this.hitPlane.visible=!1,this.hitPlane.material.side=m,this.add(this.hitPlane),c.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=c.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=c.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,r){wl.set(t,-r),this.hitPlane.visible=!0;const s=e.positionAndNormalFromPoint(wl,this.hitPlane);return this.hitPlane.visible=!1,null==s?null:s.position}getExpandedHit(e,t,r){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const s=this.getHit(e,t,r);return this.hitPlane.scale.set(1,1,1),s}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?.75:0}updateOpacity(e){const t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){var e;const{geometry:t,material:r}=this.hitPlane;t.dispose(),r.dispose(),this.geometry.dispose(),this.material.dispose(),null===(e=this.parent)||void 0===e||e.remove(this)}}const numberNode=(e,t)=>({type:"number",number:e,unit:t}),Tl=(()=>{const e={};return t=>{const r=t;if(r in e)return e[r];const s=[];let o=0;for(;t;){if(++o>1e3){t="";break}const e=Bl(t),r=e.nodes[0];if(null==r||0===r.terms.length)break;s.push(r),t=e.remainingInput}return e[r]=s}})(),Bl=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,r=/^[\),]/;return s=>{const o=[];for(;s.length&&(s=s.trim(),!r.test(s));)if("("===s[0]){const{nodes:e,remainingInput:t}=parseFunctionArguments(s);s=t,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(s)){const e=Rl(s),t=e.nodes[0];if("("===(s=e.remainingInput)[0]){const{nodes:e,remainingInput:r}=parseFunctionArguments(s);o.push({type:"function",name:t,arguments:e}),s=r}else o.push(t)}else if(t.test(s))o.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:e,remainingInput:t}="#"===s[0]?Dl(s):Ll(s);if(0===e.length)break;o.push(e[0]),s=t}return{nodes:[{type:"expression",terms:o}],remainingInput:s}}})(),Rl=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const r=t.match(e);return{nodes:[{type:"ident",value:null==r?t:t.substr(0,r.index)}],remainingInput:null==r?"":t.substr(r.index)}}})(),Ll=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,r=/^(m|mm|cm|rad|deg|[%])$/;return s=>{const o=s.match(e),l=null==o?"0":o[0],c=(s=null==l?s:s.slice(l.length)).match(t);let h=null!=c&&""!==c[0]?c[0]:null;const d=null==c?s:s.slice(h.length);return null==h||r.test(h)||(h=null),{nodes:[{type:"number",number:parseFloat(l)||0,unit:h}],remainingInput:d}}})(),Dl=(()=>{const e=/^[a-f0-9]*/i;return t=>{const r=(t=t.slice(1).trim()).match(e);return{nodes:null==r?[]:[{type:"hex",value:r[0]}],remainingInput:null==r?t:t.slice(r[0].length)}}})(),parseFunctionArguments=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const r=Bl(e);if(t.push(r.nodes[0]),","===(e=r.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},Ul=Symbol("visitedTypes");class ASTWalker{constructor(e){this[Ul]=e}walk(e,t){const r=e.slice();for(;r.length;){const e=r.shift();switch(this[Ul].indexOf(e.type)>-1&&t(e),e.type){case"expression":r.unshift(...e.terms);break;case"function":r.unshift(e.name,...e.arguments)}}}}const Pl=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:r,unit:s}=e;if(isFinite(r)){if("rad"===e.unit||null==e.unit)return e}else r=t,s="rad";return{type:"number",number:("deg"===s&&null!=r?r:0)*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let r,{number:s,unit:o}=e;if(isFinite(s)){if("m"===e.unit)return e}else s=t,o="m";switch(o){default:r=1;break;case"cm":r=.01;break;case"mm":r=.001}return{type:"number",number:r*s,unit:"m"}},Fl=(()=>{const identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,r=Pl)=>{isFinite(t.number)||(t.number=r.number,t.unit=r.unit);const{unit:s}=t;if(null==s)return t;const o=e[s];return null==o?r:o(t)}})();var Nl,Ql,Ol;const Gl=Symbol("evaluate"),kl=Symbol("lastValue");class Evaluator{constructor(){this[Nl]=null}static evaluatableFor(e,t=Pl){if(e instanceof Evaluator)return e;if("number"===e.type)return"%"===e.unit?new PercentageEvaluator(e,t):e;switch(e.name.value){case"calc":return new CalcEvaluator(e,t);case"env":return new EnvEvaluator(e)}return Pl}static evaluate(e){return e instanceof Evaluator?e.evaluate():e}static isConstant(e){return!(e instanceof Evaluator)||e.isConstant}static applyIntrinsics(e,t){const{basis:r,keywords:s}=t,{auto:o}=s;return r.map(((t,r)=>{const l=null==o[r]?t:o[r];let c=e[r]?e[r]:l;if("ident"===c.type){const e=c.value;e in s&&(c=s[e][r])}return null!=c&&"ident"!==c.type||(c=l),"%"===c.unit?numberNode(c.number/100*t.number,t.unit):(c=Fl(c,t),c.unit!==t.unit?t:c)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[kl]||(this[kl]=this[Gl]()),this[kl]}}Nl=kl;const Vl=Symbol("percentage"),Hl=Symbol("basis");class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[Vl]=e,this[Hl]=t}get isConstant(){return!0}[Gl](){return numberNode(this[Vl].number/100*this[Hl].number,this[Hl].unit)}}const zl=Symbol("identNode");class EnvEvaluator extends Evaluator{constructor(e){super(),this[Ql]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[zl]=t)}get isConstant(){return!1}[(Ql=zl,Gl)](){if(null!=this[zl]&&"window-scroll-y"===this[zl].value){return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Pl}}const Wl=/[\*\/]/,ql=Symbol("evaluator");class CalcEvaluator extends Evaluator{constructor(e,t=Pl){if(super(),this[Ol]=null,1!==e.arguments.length)return;const r=e.arguments[0].terms.slice(),s=[];for(;r.length;){const e=r.shift();if(s.length>0){const r=s[s.length-1];if("operator"===r.type&&Wl.test(r.value)){const r=s.pop(),o=s.pop();if(null==o)return;s.push(new OperatorEvaluator(r,Evaluator.evaluatableFor(o,t),Evaluator.evaluatableFor(e,t)));continue}}s.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;s.length>2;){const[e,r,o]=s.splice(0,3);if("operator"!==r.type)return;s.unshift(new OperatorEvaluator(r,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(o,t)))}1===s.length&&(this[ql]=s[0])}get isConstant(){return null==this[ql]||Evaluator.isConstant(this[ql])}[(Ol=ql,Gl)](){return null!=this[ql]?Evaluator.evaluate(this[ql]):Pl}}const Xl=Symbol("operator"),jl=Symbol("left"),Yl=Symbol("right");class OperatorEvaluator extends Evaluator{constructor(e,t,r){super(),this[Xl]=e,this[jl]=t,this[Yl]=r}get isConstant(){return Evaluator.isConstant(this[jl])&&Evaluator.isConstant(this[Yl])}[Gl](){const e=Fl(Evaluator.evaluate(this[jl])),t=Fl(Evaluator.evaluate(this[Yl])),{number:r,unit:s}=e,{number:o,unit:l}=t;if(null!=l&&null!=s&&l!=s)return Pl;const c=s||l;let h;switch(this[Xl].value){case"+":h=r+o;break;case"-":h=r-o;break;case"/":h=r/o;break;case"*":h=r*o;break;default:return Pl}return{type:"number",number:h,unit:c}}}const Kl=Symbol("evaluatables"),Jl=Symbol("intrinsics");class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[Jl]=t;const r=e[0],s=null!=r?r.terms:[];this[Kl]=t.basis.map(((e,t)=>{const r=s[t];return null==r?{type:"ident",value:"auto"}:"ident"===r.type?r:Evaluator.evaluatableFor(r,e)}))}get isConstant(){for(const e of this[Kl])if(!Evaluator.isConstant(e))return!1;return!0}[Gl](){const e=this[Kl].map((e=>Evaluator.evaluate(e)));return Evaluator.applyIntrinsics(e,this[Jl]).map((e=>e.number))}}var $l,Zl,ec,tc;const ic=Symbol("instances"),nc=Symbol("activateListener"),rc=Symbol("deactivateListener"),sc=Symbol("notifyInstances"),ac=Symbol("notify"),oc=Symbol("callback");class ScrollObserver{constructor(e){this[oc]=e}static[sc](){for(const e of ScrollObserver[ic])e[ac]()}static[($l=ic,nc)](){window.addEventListener("scroll",this[sc],{passive:!0})}static[rc](){window.removeEventListener("scroll",this[sc])}observe(){0===ScrollObserver[ic].size&&ScrollObserver[nc](),ScrollObserver[ic].add(this)}disconnect(){ScrollObserver[ic].delete(this),0===ScrollObserver[ic].size&&ScrollObserver[rc]()}[ac](){this[oc]()}}ScrollObserver[$l]=new Set;const cc=Symbol("computeStyleCallback"),hc=Symbol("astWalker"),uc=Symbol("dependencies"),dc=Symbol("onScroll");class StyleEffector{constructor(e){this[Zl]={},this[ec]=new ASTWalker(["function"]),this[tc]=()=>{this[cc]({relatedState:"window-scroll"})},this[cc]=e}observeEffectsFor(e){const t={},r=this[uc];this[hc].walk(e,(e=>{const{name:s}=e,o=e.arguments[0].terms[0];if("env"===s.value&&null!=o&&"ident"===o.type&&"window-scroll-y"===o.value)if(null==t["window-scroll"]){const e="window-scroll"in r?r["window-scroll"]:new ScrollObserver(this[dc]);e.observe(),delete r["window-scroll"],t["window-scroll"]=e}}));for(const e in r){r[e].disconnect()}this[uc]=t}dispose(){for(const e in this[uc]){this[uc][e].disconnect()}}}Zl=uc,ec=hc,tc=dc;const style=e=>{const t=e.observeEffects||!1,r=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(s,o)=>{const l=s.updated,c=s.connectedCallback,h=s.disconnectedCallback,d=Symbol(`${o}StyleEffector`),p=Symbol(`${o}StyleEvaluator`),A=Symbol(`${o}UpdateEvaluator`),m=Symbol(`${o}EvaluateAndSync`);Object.defineProperties(s,{[d]:{value:null,writable:!0},[p]:{value:null,writable:!0},[A]:{value:function(){const e=Tl(this[o]);this[p]=new StyleEvaluator(e,r(this)),null==this[d]&&t&&(this[d]=new StyleEffector((()=>this[m]()))),null!=this[d]&&this[d].observeEffectsFor(e)}},[m]:{value:function(){if(null==this[p])return;const t=this[p].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(o)&&(this[A](),this[m]()),l.call(this,e)}},connectedCallback:{value:function(){c.call(this),this.requestUpdate(o,this[o])}},disconnectedCallback:{value:function(){h.call(this),null!=this[d]&&(this[d].dispose(),this[d]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:(4-2*e)*e-1,interpolate=(e,t,r=easeInOutQuad)=>s=>e+(t-e)*r(s),timeline=e=>{const t=[],r=[];let s=e.initialValue;for(let o=0;o<e.keyframes.length;++o){const l=e.keyframes[o],{value:c,frames:h}=l,d=l.ease||easeInOutQuad,p=interpolate(s,c,d);t.push(p),r.push(h),s=c}return((e,t)=>{const r=t.map((s=0,e=>s+=e));var s;return t=>{t=utilities_clamp(t,0,1),t*=r[r.length-1];const s=r.findIndex((e=>e>=t)),o=s<1?0:r[s-1],l=r[s];return e[s]((t-o)/(l-o))}})(t,r)};var pc=r(93e3),controls_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Ac=timeline({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),mc=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),gc="0deg 75deg 105%",fc=["front","right","back","left"],_c=["upper-","","lower-"],vc="auto",Ec="basic",yc="wiggle",xc="none",fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),Sc=(()=>{const e=Tl(gc)[0].terms,t=Fl(e[0]),r=Fl(e[1]);return e=>{const s=e[mp].idealCameraDistance();return{basis:[t,r,numberNode(s,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{const t=2.2*e[mp].boundingSphere.radius;return{basis:[numberNode(-1/0,"rad"),numberNode(Math.PI/8,"rad"),numberNode(t,"m")],keywords:{auto:[null,null,null]}}},maxCameraOrbitIntrinsics=e=>{const t=Sc(e),r=new StyleEvaluator([],t).evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(r,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{const t=e[mp].boundingBox.getCenter(new three_module_Vector3);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},Mc=Math.PI/2,Cc=Math.PI/3,bc=Mc/2,Ic=2*Math.PI,wc=Symbol("controls"),Tc=Symbol("panElement"),Bc=Symbol("promptElement"),Rc=Symbol("promptAnimatedContainer"),Lc=Symbol("fingerAnimatedContainers"),Dc=Symbol("deferInteractionPrompt"),Uc=Symbol("updateAria"),Pc=Symbol("updateCameraForRadius"),Fc=Symbol("cancelPrompts"),Nc=Symbol("onChange"),Qc=Symbol("onPointerChange"),Oc=Symbol("waitingToPromptUser"),Gc=Symbol("userHasInteracted"),kc=Symbol("promptElementVisibleTime"),Vc=Symbol("lastPromptOffset"),Hc=Symbol("cancellationSource"),zc=Symbol("lastSpherical"),Wc=Symbol("jumpCamera"),qc=Symbol("initialized"),Xc=Symbol("maintainThetaPhi"),jc=Symbol("syncCameraOrbit"),Yc=Symbol("syncFieldOfView"),Kc=Symbol("syncCameraTarget"),Jc=Symbol("syncMinCameraOrbit"),$c=Symbol("syncMaxCameraOrbit"),Zc=Symbol("syncMinFieldOfView"),eh=Symbol("syncMaxFieldOfView"),th=new Vector2,ih=new three_module_Vector3,nh=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),rh=Math.PI/8,sh=.04,ah={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class SmoothControls extends EventDispatcher{constructor(e,t,r){super(),this.camera=e,this.element=t,this.scene=r,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=ah.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new Matrix3,this.panPerPixel=0,this.spherical=new Spherical,this.goalSpherical=new Spherical,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(nh.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Damper,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){const e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=sh*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{const{touchAction:r}=this._options;if(!this.touchDecided&&"none"!==r){this.touchDecided=!0;const s=Math.abs(e),o=Math.abs(t);if(this.changeSource===ah.USER_INTERACTION&&("pan-y"===r&&o>s||"pan-x"===r&&s>o))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?ah.AUTOMATIC:ah.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=ah.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===ah.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{const t=this.pointers.find((t=>t.id===e.pointerId));if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const r=this.pointers.length,s=(e.clientX-t.clientX)/r,o=(e.clientY-t.clientY)/r;0===s&&0===o||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?ah.AUTOMATIC:ah.USER_INTERACTION,null!==this.touchMode&&this.touchMode(s,o)):(this.changeSource=ah.USER_INTERACTION,this.panPerPixel>0?this.movePan(s,o):this.handleSinglePointerMove(s,o)))},this.onPointerUp=e=>{const{element:t}=this,r=this.pointers.findIndex((t=>t.id===e.pointerId));-1!==r&&this.pointers.splice(r,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[Tc].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=ah.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*sh*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=ah.USER_INTERACTION;(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},nh),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",(()=>{}),{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new Spherical){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,r=this.goalSpherical.radius){const{minimumAzimuthalAngle:s,maximumAzimuthalAngle:o,minimumPolarAngle:l,maximumPolarAngle:c,minimumRadius:h,maximumRadius:d}=this._options,{theta:p,phi:A,radius:m}=this.goalSpherical,g=utilities_clamp(e,s,o);isFinite(s)||isFinite(o)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-g)+g);const f=utilities_clamp(t,l,c),_=utilities_clamp(r,h,d);return(g!==p||f!==A||_!==m)&&(!!(isFinite(g)&&isFinite(f)&&isFinite(_))&&(this.goalSpherical.theta=g,this.goalSpherical.phi=f,this.goalSpherical.radius=_,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:r}=this._options;e=utilities_clamp(e,t,r),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,r){const{theta:s,phi:o,radius:l}=this.goalSpherical,{minimumRadius:c,maximumRadius:h,minimumFieldOfView:d,maximumFieldOfView:p}=this._options,A=this.spherical.theta-s,m=Math.PI-.001,g=s-utilities_clamp(e,-m-A,m-A),f=o-t,_=0===r?0:((r>0?h:c)-l)/(Math.log(r>0?p:d)-this.goalLogFov),E=l+r*(isFinite(_)?_:2*(h-c));if(this.setOrbit(g,f,E),0!==r){const e=this.goalLogFov+r;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:r,maximumRadius:s}=this._options,o=this.spherical.theta-this.goalSpherical.theta;return Math.abs(o)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(o)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,r),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,s),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new Euler(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(e,t,r){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,r*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:r,clientY:s}=e,{clientX:o,clientY:l}=t,c=o-r,h=l-s;return Math.sqrt(c*c+h*h)}handleSinglePointerMove(e,t){const r=this.pixelLengthToSphericalAngle(e),s=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(r,s,0)}initializePan(){const{theta:e,phi:t}=this.spherical,r=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(r),-Math.cos(t)*Math.sin(r),0,0,Math.sin(t),0,Math.sin(r),-Math.cos(t)*Math.cos(r),0)}movePan(e,t){const{scene:r}=this,s=ih.set(e,t,0).multiplyScalar(this.inputSensitivity),o=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;s.multiplyScalar(o);const l=r.getTarget();l.add(s.applyMatrix3(this.panProjection)),r.boundingSphere.clampPoint(l,l),r.setTarget(l.x,l.y,l.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;const{scene:t}=this,r=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==r){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(r.position),t.setTarget(r.position.x,r.position.y,r.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(th.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const r=e.getTarget(),{theta:s,phi:o}=this.spherical,l=s-e.yaw,c=ih.set(Math.sin(o)*Math.sin(l),Math.cos(o),Math.sin(o)*Math.cos(l)),h=c.dot(t.position.sub(r));r.add(c.multiplyScalar(h)),e.setTarget(r.x,r.y,r.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-h)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[Tc].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[Tc].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,sh*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-rh,0);break;case"ArrowDown":this.userAdjustOrbit(0,rh,0);break;case"ArrowLeft":this.userAdjustOrbit(-rh,0,0);break;case"ArrowRight":this.userAdjustOrbit(rh,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}}var oh=r(93e3);const lh=1/1.3,ch="not-presenting",hh="session-started",uh="object-placed",dh="failed",ph="tracking",Ah="not-tracking",mh=new three_module_Vector3,gh=new three_module_Matrix4,fh=new three_module_Vector3,_h=new PerspectiveCamera(45,1,.1,100);class ARRenderer extends EventDispatcher{constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new three_module_Vector3,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new three_module_Vector3,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new three_module_Vector3,this.goalYaw=0,this.goalScale=1,this.xDamper=new Damper,this.yDamper=new Damper,this.zDamper=new Damper,this.yawDamper=new Damper,this.scaleDamper=new Damper,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new PlacementBox(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=e=>{const t=this.transientHitTestSource;if(null==t)return;const r=this.frame.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=this.placementBox;if(1===r.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,r=o.getHit(this.presentedScene,t[0],t[1]);o.show=!0,null!=r?(this.isTranslating=!0,this.lastDragPosition.copy(r)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===r.length){o.show=!0,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/s.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){assertIsArCandidate();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return assertIsArCandidate(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return oh.warn("Request to present in WebXR denied:"),oh.warn(e),oh.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&oh.warn("Cannot present while a model is already presenting");let r=new Promise(((e,t)=>{requestAnimationFrame((()=>e()))}));e.setHotspotsVisibility(!1),e.queueRender(),await r,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new XREstimatedLight(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment})));const s=await this.resolveARSession();s.addEventListener("end",(()=>{this.postSessionCleanup()}),{once:!0});const o=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");o.classList.add("enabled"),o.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=o;const l=await s.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const c=20*Math.PI/180,h=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(c),z:-Math.cos(c)});s.requestHitTestSource({space:l,offsetRay:h}).then((e=>{this.initialHitSource=e})),this.currentSession=s,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:hh})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise((e=>{this.resolveCleanup=e}));try{await this.currentSession.end(),await e}catch(e){oh.warn("Error while trying to end WebXR AR session"),oh.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(null!=e){const t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}postSessionCleanup(){const e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,null!=t){const{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),t.position.set(0,0,0),t.scale.set(1,1,1),t.setShadowOffset(0);const r=this.turntableRotation;null!=r&&(t.yaw=r);const s=this.oldShadowIntensity;null!=s&&t.setShadowIntensity(s),t.setEnvironmentAndSkybox(e[ma],e[ga]);const o=this.oldTarget;t.setTarget(o.x,o.y,o.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),e.requestUpdate("cameraTarget"),e.requestUpdate("maxCameraOrbit"),e[vp](e.getBoundingClientRect()),requestAnimationFrame((()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:ah.NONE}}))}))}this.renderer.height=0;const r=this.exitWebXRButtonContainer;null!=r&&(r.classList.remove("enabled"),r.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const s=this.transientHitTestSource;null!=s&&(s.cancel(),this.transientHitTestSource=null);const o=this.initialHitSource;null!=o&&(o.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:ch})}updateView(e){const t=this.presentedScene,r=this.threeRenderer.xr;r.updateCamera(_h),t.xrCamera=r.getCamera();const{elements:s}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(s[1],s[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const o=r.getBaseLayer();if(null!=o){const t=o instanceof XRWebGLLayer?o.getViewport(e):r.getBinding().getViewSubImage(o,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:r}=e,s=e.getCamera(),{width:o,height:l}=this.overlay.getBoundingClientRect();e.setSize(o,l),s.projectionMatrixInverse.copy(s.projectionMatrix).invert();const{theta:c,radius:h}=r.getCameraOrbit(),d=s.getWorldDirection(mh);e.yaw=Math.atan2(-d.x,-d.z)-c,this.goalYaw=e.yaw,t.copy(s.position).add(d.multiplyScalar(h)),this.updateTarget();const p=e.getTarget();t.add(p).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:A}=this.frame;A.addEventListener("selectstart",this.onSelectStart),A.addEventListener("selectend",this.onSelectEnd),A.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e}))}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(mh.copy(t).sub(this.presentedScene.getCamera().position),mh.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),r=e.getPose(t);if(null==r)return null;const s=gh.fromArray(r.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(s.elements[4],s.elements[6])),s.elements[5]>.75!==this.placeOnWall?fh.setFromMatrixPosition(s):null}moveToFloor(e){const t=this.initialHitSource;if(null==t)return;const r=e.getHitTestResults(t);if(0==r.length)return;const s=r[0],o=this.getHitPoint(s);null!=o&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(o):this.goalPosition.y=o.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:uh}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,r=e[1].inputSource.gamepad.axes,s=r[0]-t[0],o=r[1]-t[1],l=Math.atan2(o,s);let c=this.lastAngle-l;return c>Math.PI?c-=2*Math.PI:c<-Math.PI&&(c+=2*Math.PI),this.lastAngle=l,{separation:Math.sqrt(s*s+o*o),deltaYaw:c}}processInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const r=e.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=s.scale.x;if(this.isTwoFingering)if(r.length<2)this.isTwoFingering=!1;else{const{separation:e,deltaYaw:t}=this.fingerPolar(r);if(!1===this.placeOnWall&&(this.goalYaw+=t),s.canScale){const t=e/this.firstRatio;this.goalScale=t<1.3&&t>lh?1:t}}else if(2!==r.length)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&r.forEach((e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/o,this.presentedScene.setShadowOffset(e);const r=mh.copy(s.getCamera().position),l=-e/(r.y-t.y);r.multiplyScalar(l),t.multiplyScalar(1-l).add(r)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/o}}moveScene(e){const t=this.presentedScene,{position:r,yaw:s}=t,o=t.boundingSphere.radius,l=this.goalPosition,c=t.scale.x,h=this.placementBox;let d=ah.NONE;if(!l.equals(r)||this.goalScale!==c){d=ah.USER_INTERACTION;let{x:s,y:p,z:A}=r;s=this.xDamper.update(s,l.x,e,o),p=this.yDamper.update(p,l.y,e,o),A=this.zDamper.update(A,l.z,e,o),r.set(s,p,A);const m=this.scaleDamper.update(c,this.goalScale,e,1);if(t.scale.set(m,m,m),!this.isTranslating){const e=l.y-p;this.placementComplete&&!1===this.placeOnWall?(h.offsetHeight=e/m,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,h.show=!1,t.setShadowIntensity(.8))}}h.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(s,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:d}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const r=this.threeRenderer.xr.getReferenceSpace(),s=t.getViewerPose(r);null==s&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Ah}));const o=this.presentedScene;if(null==s||null==o||!o.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:ph}));let l=!0;for(const r of s.views){if(this.updateView(r),l){this.moveToFloor(t),this.processInput(t);const r=e-this.lastTick;this.moveScene(r),this.renderer.preRender(o,e,r),this.lastTick=e,o.renderShadow(this.threeRenderer)}this.threeRenderer.render(o,o.getCamera()),l=!1}}}function clone(e){const t=new Map,r=new Map,s=e.clone();return parallelTraverse(e,s,(function(e,s){t.set(s,e),r.set(e,s)})),s.traverse((function(e){if(!e.isSkinnedMesh)return;const s=e,o=t.get(e),l=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=l.map((function(e){return r.get(e)})),s.bind(s.skeleton,s.bindMatrix)})),s}function parallelTraverse(e,t,r){r(e,t);for(let s=0;s<e.children.length;s++)parallelTraverse(e.children[s],t.children[s],r)}const vh=Symbol("prepared"),Eh=Symbol("prepare"),yh=Symbol("preparedGLTF"),xh=Symbol("clone");class GLTFInstance{constructor(e){this[yh]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[vh])return e;const t=this[Eh](e);return t[vh]=!0,t}static[Eh](e){const{scene:t}=e,r=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:r})}get parser(){return this[yh].parser}get animations(){return this[yh].animations}get scene(){return this[yh].scene}get scenes(){return this[yh].scenes}get cameras(){return this[yh].cameras}get asset(){return this[yh].asset}get userData(){return this[yh].userData}clone(){return new(0,this.constructor)(this[xh]())}dispose(){this.scenes.forEach((e=>{e.traverse((e=>{const t=e;if(!t.material)return;(Array.isArray(t.material)?t.material:[t.material]).forEach((e=>{for(const t in e){const r=e[t];if(r instanceof Texture){const e=r.source.data;null!=e.close&&e.close(),r.dispose()}}e.dispose()})),t.geometry.dispose()}))}))}[xh](){const e=this[yh],t=clone(this.scene);cloneVariantMaterials(t,this.scene);const r=[t],s=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:r,userData:s})}}const cloneVariantMaterials=(e,t)=>{traversePair(e,t,((e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)}))},traversePair=(e,t,r)=>{r(e,t);for(let s=0;s<e.children.length;s++)traversePair(e.children[s],t.children[s],r)},Sh=Symbol("threeGLTF"),Mh=Symbol("gltf"),Ch=Symbol("gltfElementMap"),bh=Symbol("threeObjectMap"),Ih=Symbol("parallelTraverseThreeScene"),wh=Symbol("correlateOriginalThreeGLTF"),Th=Symbol("correlateCloneThreeGLTF");class CorrelatedSceneGraph{constructor(e,t,r,s){this[Sh]=e,this[Mh]=t,this[Ch]=s,this[bh]=r}static from(e,t){return null!=t?this[Th](e,t):this[wh](e)}static[wh](e){const t=e.parser.json,r=e.parser.associations,s=new Map,o={name:"Default"},l={type:"materials",index:-1};for(const e of r.keys())e instanceof Material&&null==r.get(e)&&(l.index<0&&(null==t.materials&&(t.materials=[]),l.index=t.materials.length,t.materials.push(o)),e.name=o.name,r.set(e,{materials:l.index}));for(const[e,o]of r){o&&(e.userData=e.userData||{},e.userData.associations=o);for(const r in o)if(null!=r&&"primitives"!==r){const l=r,c=(t[l]||[])[o[l]];if(null==c)continue;let h=s.get(c);null==h&&(h=new Set,s.set(c,h)),h.add(e)}}return new CorrelatedSceneGraph(e,t,r,s)}static[Th](e,t){const r=t.threeGLTF,s=t.gltf,o=JSON.parse(JSON.stringify(s)),l=new Map,c=new Map;for(let s=0;s<r.scenes.length;s++)this[Ih](r.scenes[s],e.scenes[s],((e,r)=>{const s=t.threeObjectMap.get(e);if(null!=s)for(const e in s)if(null!=e&&"primitives"!==e){const t=e,h=s[t],d=o[t][h],p=l.get(r)||{};p[t]=h,l.set(r,p);const A=c.get(d)||new Set;A.add(r),c.set(d,A)}}));return new CorrelatedSceneGraph(e,o,l,c)}static[Ih](e,t,r){const traverse=(e,t)=>{if(r(e,t),e.isObject3D){const s=e,o=t;if(s.material)if(Array.isArray(s.material))for(let e=0;e<s.material.length;++e)r(s.material[e],o.material[e]);else r(s.material,o.material);for(let r=0;r<e.children.length;++r)traverse(e.children[r],t.children[r])}};traverse(e,t)}get threeGLTF(){return this[Sh]}get gltf(){return this[Mh]}get gltfElementMap(){return this[Ch]}get threeObjectMap(){return this[bh]}}const Bh=Symbol("correlatedSceneGraph");class ModelViewerGLTFInstance extends GLTFInstance{static[Eh](e){const t=super[Eh](e);null==t[Bh]&&(t[Bh]=CorrelatedSceneGraph.from(t));const{scene:r}=t,s=new Sphere(void 0,1/0);return r.traverse((e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const r=e;if(r.material){const{geometry:e}=r;r.castShadow=!0,r.isSkinnedMesh&&(e.boundingSphere=s,e.boundingBox=null);const o=r.material;if(!0===o.isMeshBasicMaterial&&(o.toneMapped=!1),o.shadowSide=p,o.aoMap){const{gltf:r,threeObjectMap:s}=t[Bh],l=s.get(o);if(null!=r.materials&&null!=l&&null!=l.materials){const t=r.materials[l.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}})),t}get correlatedSceneGraph(){return this[yh][Bh]}[xh](){const e=super[xh](),t=new Map;return e.scene.traverse((e=>{const r=e;if(r.material){const e=r.material;if(null!=e){if(t.has(e.uuid))return void(r.material=t.get(e.uuid));r.material=e.clone(),t.set(e.uuid,r.material)}}const s=e;void 0!==s.target&&s.add(s.target)})),e[Bh]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}}var Rh=r(93e3);const getBufferForType=(e,t,r)=>{let s;switch(e){case ve:s=new Uint8ClampedArray(t*r*4);break;case Me:s=new Uint16Array(t*r*4);break;case xe:s=new Uint32Array(t*r*4);break;case 1010:s=new Int8Array(t*r*4);break;case 1011:s=new Int16Array(t*r*4);break;case ye:s=new Int32Array(t*r*4);break;case Se:s=new Float32Array(t*r*4);break;default:throw new Error("Unsupported data type")}return s};let Lh;class QuadRenderer_vDmOC3x_QuadRenderer{constructor(e){var t,r,s,o,l,c,h,d,p,A,m,g,f,_,E,y;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const x={format:be,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==(null===(t=e.renderTargetOptions)||void 0===t?void 0:t.anisotropy)?null===(r=e.renderTargetOptions)||void 0===r?void 0:r.anisotropy:1,generateMipmaps:void 0!==(null===(s=e.renderTargetOptions)||void 0===s?void 0:s.generateMipmaps)&&(null===(o=e.renderTargetOptions)||void 0===o?void 0:o.generateMipmaps),magFilter:void 0!==(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.magFilter)?null===(c=e.renderTargetOptions)||void 0===c?void 0:c.magFilter:ge,minFilter:void 0!==(null===(h=e.renderTargetOptions)||void 0===h?void 0:h.minFilter)?null===(d=e.renderTargetOptions)||void 0===d?void 0:d.minFilter:ge,samples:void 0!==(null===(p=e.renderTargetOptions)||void 0===p?void 0:p.samples)?null===(A=e.renderTargetOptions)||void 0===A?void 0:A.samples:void 0,wrapS:void 0!==(null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapS)?null===(g=e.renderTargetOptions)||void 0===g?void 0:g.wrapS:ue,wrapT:void 0!==(null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapT)?null===(_=e.renderTargetOptions)||void 0===_?void 0:_.wrapT:ue};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_vDmOC3x_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new Scene,this._camera=new OrthographicCamera,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,t,r,s)=>{if(void 0!==Lh)return Lh;const o=new WebGLRenderTarget(1,1,s);t.setRenderTarget(o);const l=new three_module_Mesh(new PlaneGeometry,new MeshBasicMaterial({color:16777215}));t.render(l,r),t.setRenderTarget(null);const c=getBufferForType(e,o.width,o.height);return t.readRenderTargetPixels(o,0,0,o.width,o.height,c),o.dispose(),l.geometry.dispose(),l.material.dispose(),Lh=0!==c[0],Lh})(this._type,this._renderer,this._camera,x)){let e;if(this._type===Me)e=this._renderer.extensions.has("EXT_color_buffer_float")?Se:void 0;void 0!==e?(Rh.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to 1015`),this._type=e):(this._supportsReadPixels=!1,Rh.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new three_module_Mesh(new PlaneGeometry,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new WebGLRenderTarget(this.width,this.height,x),this._renderTarget.texture.mapping=void 0!==(null===(E=e.renderTargetOptions)||void 0===E?void 0:E.mapping)?null===(y=e.renderTargetOptions)||void 0===y?void 0:y.mapping:re}static instantiateRenderer(){const e=new WebGLRenderer;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=getBufferForType(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new DataTexture(this.toArray(),this.width,this.height,be,this._type,(null==e?void 0:e.mapping)||re,(null==e?void 0:e.wrapS)||ue,(null==e?void 0:e.wrapT)||ue,(null==e?void 0:e.magFilter)||ge,(null==e?void 0:e.minFilter)||ge,(null==e?void 0:e.anisotropy)||1,tt);return t.generateMipmaps=void 0!==(null==e?void 0:e.generateMipmaps)&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof ShaderMaterial&&Object.values(this.material.uniforms).forEach((e=>{e.value instanceof Texture&&e.value.dispose()})),Object.values(this.material).forEach((e=>{e instanceof Texture&&e.dispose()})),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}var Dh=r(93e3);class GainMapDecoderMaterial extends ShaderMaterial{constructor({gamma:e,offsetHdr:t,offsetSdr:r,gainMapMin:s,gainMapMax:o,maxDisplayBoost:l,hdrCapacityMin:c,hdrCapacityMax:h,sdr:d,gainMap:p}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:d},gainMap:{value:p},gamma:{value:new three_module_Vector3(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new three_module_Vector3).fromArray(t)},offsetSdr:{value:(new three_module_Vector3).fromArray(r)},gainMapMin:{value:(new three_module_Vector3).fromArray(s)},gainMapMax:{value:(new three_module_Vector3).fromArray(o)},weightFactor:{value:(Math.log2(l)-c)/(h-c)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=c,this._hdrCapacityMax=h,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class GainMapNotFoundError extends Error{}class XMPMetadataNotFoundError extends Error{}const getAttribute=(e,t,r)=>{var s;let o;const l=null===(s=e.attributes.getNamedItem(t))||void 0===s?void 0:s.nodeValue;if(l)o=l;else{const s=e.getElementsByTagName(t)[0];if(!s){if(r)return r;throw new Error(`Can't find ${t} in gainmap metadata`)}{const e=s.getElementsByTagName("rdf:li");if(3!==e.length)throw new Error(`Gainmap metadata contains an array of items for ${t} but its length is not 3`);o=Array.from(e).map((e=>e.innerHTML))}}return o};class MPFExtractor{constructor(e){this.options={debug:!(!e||void 0===e.debug)&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise(((t,r)=>{const s=this.options.debug,o=new DataView(e.buffer);if(65496!==o.getUint16(0))return void r(new Error("Not a valid jpeg"));const l=o.byteLength;let c,h=2,d=0;for(;h<l;){if(++d>250)return void r(new Error(`Found no marker after ${d} loops 😵`));if(255!==o.getUint8(h))return void r(new Error(`Not a valid marker at offset 0x${h.toString(16)}, found: 0x${o.getUint8(h).toString(16)}`));if(c=o.getUint8(h+1),s&&Dh.log(`Marker: ${c.toString(16)}`),226===c){s&&Dh.log("Found APP2 marker (0xffe2)");const e=h+4;if(1297106432===o.getUint32(e)){const s=e+4;let l;if(18761===o.getUint16(s))l=!1;else{if(19789!==o.getUint16(s))return void r(new Error("No valid endianness marker found in TIFF header"));l=!0}if(42!==o.getUint16(s+2,!l))return void r(new Error("Not valid TIFF data! (no 0x002A marker)"));const c=o.getUint32(s+4,!l);if(c<8)return void r(new Error("Not valid TIFF data! (First offset less than 8)"));const h=s+c,d=o.getUint16(h,!l),p=h+2;let A=0;for(let e=p;e<p+12*d;e+=12)45057===o.getUint16(e,!l)&&(A=o.getUint32(e+8,!l));const m=h+2+12*d+4,g=[];for(let e=m;e<m+16*A;e+=16){const t={MPType:o.getUint32(e,!l),size:o.getUint32(e+4,!l),dataOffset:o.getUint32(e+8,!l),dependantImages:o.getUint32(e+12,!l),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=s+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,g.push(t)}if(this.options.extractNonFII&&g.length){const e=new Blob([o]),r=[];for(const t of g){if(t.isFII&&!this.options.extractFII)continue;const s=e.slice(t.start,t.end+1,"image/jpeg");r.push(s)}t(r)}}}h+=2+o.getUint16(h+2)}}))}}const extractGainmapFromJPEG=async e=>{const t=(e=>{var t,r;let s;s="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let o=s.indexOf("<x:xmpmeta");const l=new DOMParser;for(;-1!==o;){const e=s.indexOf("x:xmpmeta>",o);s.slice(o,e+10);const c=s.slice(o,e+10);try{const e=l.parseFromString(c,"text/xml").getElementsByTagName("rdf:Description")[0],s=getAttribute(e,"hdrgm:GainMapMin","0"),o=getAttribute(e,"hdrgm:GainMapMax"),h=getAttribute(e,"hdrgm:Gamma","1"),d=getAttribute(e,"hdrgm:OffsetSDR","0.015625"),p=getAttribute(e,"hdrgm:OffsetHDR","0.015625");let A=null===(t=e.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;A||(A="0");const m=null===(r=e.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===r?void 0:r.nodeValue;if(!m)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(s)?s.map((e=>parseFloat(e))):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(o)?o.map((e=>parseFloat(e))):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(h)?h.map((e=>parseFloat(e))):[parseFloat(h),parseFloat(h),parseFloat(h)],offsetSdr:Array.isArray(d)?d.map((e=>parseFloat(e))):[parseFloat(d),parseFloat(d),parseFloat(d)],offsetHdr:Array.isArray(p)?p.map((e=>parseFloat(e))):[parseFloat(p),parseFloat(p),parseFloat(p)],hdrCapacityMin:parseFloat(A),hdrCapacityMax:parseFloat(m)}}catch(e){}o=s.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");const r=new MPFExtractor({extractFII:!0,extractNonFII:!0}),s=await r.extract(e);if(2!==s.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await s[0].arrayBuffer()),gainMap:new Uint8Array(await s[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise(((t,r)=>{const s=document.createElement("img");s.onload=()=>{t(s)},s.onerror=e=>{r(e)},s.src=URL.createObjectURL(e)}));class LoaderBase extends Loader{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new LoadingManager}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){const e=new GainMapDecoderMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new Texture,sdr:new Texture});return new QuadRenderer_vDmOC3x_QuadRenderer({width:16,height:16,type:Me,colorSpace:tt,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,r,s){const o=s?new Blob([s],{type:"image/jpeg"}):void 0,l=new Blob([r],{type:"image/jpeg"});let c,h,d=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([o?getHTMLImageFromBlob(o):Promise.resolve(void 0),getHTMLImageFromBlob(l)]);h=e[0],c=e[1],d=!0}else{const e=await Promise.all([o?createImageBitmap(o,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(l,{imageOrientation:"flipY"})]);h=e[0],c=e[1]}const p=new Texture(h||new ImageData(2,2),re,ue,ue,ge,1008,be,ve,1,tt);p.flipY=d,p.needsUpdate=!0;const A=new Texture(c,re,ue,ue,ge,1008,be,ve,1,et);A.flipY=d,A.needsUpdate=!0,e.width=c.width,e.height=c.height,e.material.gainMap=p,e.material.sdr=A,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}}class HDRJPGLoader extends LoaderBase{load(e,t,r,s){const o=this.prepareQuadRenderer(),l=new three_module_FileLoader(this._internalLoadingManager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(this.withCredentials),this.manager.itemStart(e),l.load(e,(async r=>{if("string"==typeof r)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const l=new Uint8Array(r);let c,h,d;try{const e=await extractGainmapFromJPEG(l);c=e.sdr,h=e.gainMap,d=e.metadata}catch(t){if(!(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError))throw t;Dh.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),d={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},c=l}try{await this.render(o,d,c,h)}catch(t){return this.manager.itemError(e),"function"==typeof s&&s(t),void o.disposeOnDemandRenderer()}"function"==typeof t&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()}),r,(t=>{this.manager.itemError(e),"function"==typeof s&&s(t)})),o}}class RGBELoader extends DataTextureLoader{constructor(e){super(e),this.type=Me}parse(e){const rgbe_error=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},fgets=function(e,t,r){t=t||1024;let s=e.pos,o=-1,l=0,c="",h=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));for(;0>(o=h.indexOf("\n"))&&l<t&&s<e.byteLength;)c+=h,l+=h.length,s+=128,h+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));return-1<o&&(!1!==r&&(e.pos+=l+o+1),c+h.slice(0,o))},RGBEByteToRGBFloat=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=e[t+0]*l,r[s+1]=e[t+1]*l,r[s+2]=e[t+2]*l,r[s+3]=1},RGBEByteToRGBHalf=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=Ji.toHalfFloat(Math.min(e[t+0]*l,65504)),r[s+1]=Ji.toHalfFloat(Math.min(e[t+1]*l,65504)),r[s+2]=Ji.toHalfFloat(Math.min(e[t+2]*l,65504)),r[s+3]=Ji.toHalfFloat(1)},t=new Uint8Array(e);t.pos=0;const r=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,l={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let c,h;for((e.pos>=e.byteLength||!(c=fgets(e)))&&rgbe_error(1,"no header found"),(h=c.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),l.valid|=1,l.programtype=h[1],l.string+=c+"\n";c=fgets(e),!1!==c;)if(l.string+=c+"\n","#"!==c.charAt(0)){if((h=c.match(t))&&(l.gamma=parseFloat(h[1])),(h=c.match(r))&&(l.exposure=parseFloat(h[1])),(h=c.match(s))&&(l.valid|=2,l.format=h[1]),(h=c.match(o))&&(l.valid|=4,l.height=parseInt(h[1],10),l.width=parseInt(h[2],10)),2&l.valid&&4&l.valid)break}else l.comments+=c+"\n";return 2&l.valid||rgbe_error(3,"missing format specifier"),4&l.valid||rgbe_error(3,"missing image size specifier"),l}(t),s=r.width,o=r.height,l=function(e,t,r){const s=t;if(s<8||s>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);s!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");const o=new Uint8Array(4*t*r);o.length||rgbe_error(4,"unable to allocate buffer space");let l=0,c=0;const h=4*s,d=new Uint8Array(4),p=new Uint8Array(h);let A=r;for(;A>0&&c<e.byteLength;){c+4>e.byteLength&&rgbe_error(1),d[0]=e[c++],d[1]=e[c++],d[2]=e[c++],d[3]=e[c++],2==d[0]&&2==d[1]&&(d[2]<<8|d[3])==s||rgbe_error(3,"bad rgbe scanline format");let t,r=0;for(;r<h&&c<e.byteLength;){t=e[c++];const s=t>128;if(s&&(t-=128),(0===t||r+t>h)&&rgbe_error(3,"bad scanline data"),s){const s=e[c++];for(let e=0;e<t;e++)p[r++]=s}else p.set(e.subarray(c,c+t),r),r+=t,c+=t}const m=s;for(let e=0;e<m;e++){let t=0;o[l]=p[e+t],t+=s,o[l+1]=p[e+t],t+=s,o[l+2]=p[e+t],t+=s,o[l+3]=p[e+t],l+=4}A--}return o}(t.subarray(t.pos),s,o);let c,h,d;switch(this.type){case Se:d=l.length/4;const e=new Float32Array(4*d);for(let t=0;t<d;t++)RGBEByteToRGBFloat(l,4*t,e,4*t);c=e,h=Se;break;case Me:d=l.length/4;const t=new Uint16Array(4*d);for(let e=0;e<d;e++)RGBEByteToRGBHalf(l,4*e,t,4*e);c=t,h=Me;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:s,height:o,data:c,header:r.string,gamma:r.gamma,exposure:r.exposure,type:h}}setDataType(e){return this.type=e,this}load(e,t,r,s){return super.load(e,(function onLoadCallback(e,r){switch(e.type){case Se:case Me:e.colorSpace=tt,e.minFilter=ge,e.magFilter=ge,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}const Uh={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},Ph={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class EnvironmentScene extends Scene{constructor(e){super(),this.position.y=-3.5;const t=new BoxGeometry;t.deleteAttribute("uv");const r=new MeshStandardMaterial({metalness:0,side:A}),s=new MeshStandardMaterial({metalness:0}),o="legacy"==e?Uh:Ph,l=new PointLight(16777215,o.topLight.intensity,28,2);l.position.set(...o.topLight.position),this.add(l);const c=new three_module_Mesh(t,r);c.position.set(...o.room.position),c.scale.set(...o.room.scale),this.add(c);for(const e of o.boxes){const r=new three_module_Mesh(t,s);r.position.set(...e.position),r.rotation.set(0,e.rotation,0),r.scale.set(...e.scale),this.add(r)}for(const e of o.lights){const r=new three_module_Mesh(t,this.createAreaLightMaterial(e.intensity));r.position.set(...e.position),r.scale.set(...e.scale),this.add(r)}}createAreaLightMaterial(e){const t=new MeshBasicMaterial;return t.color.setScalar(e),t}}var Fh=r(93e3);const Nh=20,Qh=/\.hdr(\.js)?$/;class TextureUtils{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this.withCredentials=!1,this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}get ldrLoader(){return null==this._ldrLoader&&(this._ldrLoader=new TextureLoader),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new HDRJPGLoader(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new RGBELoader,this._hdrLoader.setDataType(Me)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){const{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(e){const t=await new Promise(((t,r)=>this.ldrLoader.load(e,t,(()=>{}),r)));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const r=await this.getLottieLoader();r.setQuality(t);const s=await new Promise(((t,s)=>r.load(e,t,(()=>{}),s)));return s.name=e,s}async loadEquirect(e,t=()=>{}){try{const r=Qh.test(e),s=r?this.hdrLoader:this.imageLoader,o=await new Promise(((r,o)=>s.load(e,(e=>{const{renderTarget:t}=e;if(null!=t){const{texture:s}=t;e.dispose(!1),r(s)}else r(e)}),(e=>{t(e.loaded/e.total*.9)}),o)));return t(1),o.name=e,o.mapping=oe,r||(o.colorSpace=et),o}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,r=()=>{}){const s="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=deserializeUrl(t);let o,l=Promise.resolve(null);e&&(l=this.loadEquirectFromUrl(e,r)),o=t?this.loadEquirectFromUrl(t,r):e?this.loadEquirectFromUrl(e,r):s?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[c,h]=await Promise.all([o,l]);if(null==c)throw new Error("Failed to load environment map.");return{environmentMap:c,skybox:h}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const r=this.loadEquirect(e,t);this.skyboxCache.set(e,r)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise((t=>setTimeout(t,e))))();const r=this.threeRenderer,s=new WebGLCubeRenderTarget(256,{generateMipmaps:!1,type:Me,format:be,colorSpace:tt,depthBuffer:!0}),o=new CubeCamera(.1,100,s),l=o.renderTarget.texture;l.name=t;const c=r.outputColorSpace,h=r.toneMapping;return r.toneMapping=Y,r.outputColorSpace=tt,o.update(r,e),this.blurCubemap(s,.04),r.toneMapping=h,r.outputColorSpace=c,l}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new EnvironmentScene("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new EnvironmentScene("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(Nh);const e=new BoxGeometry,t=new three_module_Mesh(e,this.blurMaterial);this.blurScene=new Scene,this.blurScene.add(t)}const r=e.clone();this.halfblur(e,r,t,"latitudinal"),this.halfblur(r,e,t,"longitudinal")}halfblur(e,t,r,s){const o=e.width,l=isFinite(r)?Math.PI/(2*o):2*Math.PI/39,c=r/l,h=isFinite(r)?1+Math.floor(3*c):Nh;h>Nh&&Fh.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${h} samples when the maximum is set to 20`);const d=[];let p=0;for(let e=0;e<Nh;++e){const t=e/c,r=Math.exp(-t*t/2);d.push(r),0==e?p+=r:e<h&&(p+=2*r)}for(let e=0;e<d.length;e++)d[e]=d[e]/p;const A=this.blurMaterial.uniforms;A.envMap.value=e.texture,A.samples.value=h,A.weights.value=d,A.latitudinal.value="latitudinal"===s,A.dTheta.value=l;new CubeCamera(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),r=new three_module_Vector3(0,1,0);return new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:r}},vertexShader:"\n \n varying vec3 vOutputDirection;\n \n void main() {\n \n vOutputDirection = vec3( position );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n ",fragmentShader:"\n varying vec3 vOutputDirection;\n \n uniform samplerCube envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform vec3 poleAxis;\n \n vec3 getSample( float theta, vec3 axis ) {\n \n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n \n return vec3( textureCube( envMap, sampleDirection ) );\n \n }\n \n void main() {\n \n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n \n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n \n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n \n }\n \n axis = normalize( axis );\n \n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n \n for ( int i = 1; i < n; i++ ) {\n \n if ( i >= samples ) {\n \n break;\n \n }\n \n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n \n }\n }\n ",blending:0,depthTest:!1,depthWrite:!1,side:A})}async dispose(){for(const[,e]of this.skyboxCache){(await e).dispose()}null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}var Oh=r(93e3);const Gh=[1,.79,.62,.5,.4,.31,.25],kh="high-performance";class Renderer extends EventDispatcher{constructor(e){super(),this.loader=new CachingGLTFLoader(ModelViewerGLTFInstance),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;null===(e=this.textureUtils)||void 0===e||e.dispose(),this.textureUtils=new TextureUtils(this.threeRenderer);for(const e of this.scenes)e.element[fa]()},this.dpr=pa(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show"),Ln.tonemapping_pars_fragment=Ln.tonemapping_pars_fragment.replace("vec3 CustomToneMapping( vec3 color ) { return color; }","\n float startCompression = 0.8 - 0.04;\n float desaturation = 0.15;\n vec3 CustomToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n\n float x = min(color.r, min(color.g, color.b));\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n\n float peak = max(color.r, max(color.g, color.b));\n if (peak < startCompression) return color;\n\n float d = 1. - startCompression;\n float newPeak = 1. - d * d / (peak + d - startCompression);\n color *= newPeak / peak;\n\n float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n return mix(color, vec3(1, 1, 1), g);\n }");try{this.threeRenderer=new WebGLRenderer({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=ee}catch(e){Oh.warn(e)}this.arRenderer=new ARRenderer(this),this.textureUtils=this.canRender?new TextureUtils(this.threeRenderer):null,CachingGLTFLoader.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||kh,debug:Aa()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return Gh[this.scaleStep]}set minScale(e){let t=1;for(;t<Gh.length&&!(Gh[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new Vector2;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((e,t)=>this.render(e,t)))}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return this.multipleScenesVisible?e.element[Ap]:this.canvas3D}countVisibleScenes(){const{canvas3D:e}=this;let t=0,r=null;for(const s of this.scenes){const{element:o}=s;o.modelIsVisible&&null==s.externalRenderer&&++t,e.parentElement===s.canvas.parentElement&&(r=s)}const s=t>1;if(null!=r){const t=s&&!this.multipleScenesVisible,o=!r.element.modelIsVisible;if(t||o){const{width:t,height:s}=this.sceneSize(r);this.copyPixels(r,t,s),e.parentElement.removeChild(e)}}this.multipleScenesVisible=s}updateRendererSize(){var e;const t=pa();if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[tp](t.getBoundingClientRect())}let r=0,s=0;for(const e of this.scenes)r=Math.max(r,e.width),s=Math.max(s,e.height);if(r!==this.width||s!==this.height||t!==this.dpr){this.width=r,this.height=s,this.dpr=t,r=Math.ceil(r*t),s=Math.ceil(s*t),this.canRender&&this.threeRenderer.setSize(r,s,!1);for(const t of this.scenes){const{canvas:o}=t;o.width=r,o.height=s,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(r,s)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=utilities_clamp(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){const t=Gh[e.scaleStep],r=Math.ceil(this.width/t),s=Math.ceil(this.height/t),{style:o}=e.canvas;o.width=`${r}px`,o.height=`${s}px`,this.canvas3D.style.width=`${r}px`,this.canvas3D.style.height=`${s}px`;const l=this.dpr*t,c=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:l,minimumDpr:this.dpr*Gh[this.lastStep],pixelWidth:Math.ceil(e.width*l),pixelHeight:Math.ceil(e.height*l),reason:c}}))}sceneSize(e){const{dpr:t}=this,r=Gh[e.scaleStep];return{width:Math.min(Math.ceil(e.width*r*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*r*t),this.canvas3D.height)}}copyPixels(e,t,r){const s=e.context;null!=s?(s.clearRect(0,0,t,r),s.drawImage(this.canvas3D,0,0,t,r,0,0,t,r),e.canvas.classList.add("show")):Oh.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const r of this.scenes)r.element.modelIsVisible===t&&e.push(r);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,r){const{element:s,exposure:o,toneMapping:l}=e;s[fp](t,r);const c="number"==typeof o&&!Number.isNaN(o),h=s.environmentImage,d=s.skyboxImage,p=l===te&&("neutral"===h||"legacy"===h||!h&&!d);this.threeRenderer.toneMappingExposure=(c?o:1)*(p?1.3:1)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);const r=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(r),this.renderedLastFrame=!1);const{canvas3D:s}=this;for(const t of this.orderedScenes()){const{element:o}=t;if(!o.loaded||!o.modelIsVisible&&t.renderCount>0)continue;if(this.preRender(t,e,r),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:r,projectionMatrix:s}=e,o=r.elements.slice(),l=t.getTarget();o[12]+=l.x,o[13]+=l.y,o[14]+=l.z,t.externalRenderer.render({viewMatrix:o,projectionMatrix:s.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:l,height:c}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-c,l,c),null!=t.effectRenderer?t.effectRenderer.render(r):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,l,c):s.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(s),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}Renderer._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||kh,debug:Aa()});const Vh=Symbol("correlatedObjects"),Hh=Symbol("onUpdate");class ThreeDOMElement{constructor(e,t=null){this[Hh]=e,this[Vh]=t}}const zh=new MeshBasicMaterial,Wh=new PlaneGeometry(2,2);let qh=0;const Xh=Symbol("threeTexture"),jh=Symbol("threeTextures");Symbol("applyTexture");class image_Image extends ThreeDOMElement{get[Xh](){var e;return null===(e=this[Vh])||void 0===e?void 0:e.values().next().value}get[jh](){return this[Vh]}constructor(e,t){super(e,new Set(t?[t]:[])),this[Xh].image.src||(this[Xh].image.src=t.name?t.name:"adhoc_image"+qh++),this[Xh].image.name||(this[Xh].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[Xh].image.name||""}get uri(){return this[Xh].image.src}get bufferView(){return this[Xh].image.bufferView}get element(){const e=this[Xh];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[Xh];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(const t of this[jh])t.image.name=e}update(){const e=this[Xh];e&&e.isCanvasTexture&&!e.animation&&(this[Xh].needsUpdate=!0,this[Hh]())}async createThumbnail(e,t){const r=new Scene;zh.map=this[Xh];const s=new three_module_Mesh(Wh,zh);r.add(s);const o=new OrthographicCamera(-1,1,1,-1,0,1),{threeRenderer:l}=Renderer.singleton,c=new WebGLRenderTarget(e,t);l.setRenderTarget(c),l.render(r,o),l.setRenderTarget(null);const h=new Uint8Array(e*t*4);l.readRenderTargetPixels(c,0,0,e,t,h),Wd.width=e,Wd.height=t;const d=Wd.getContext("2d"),p=d.createImageData(e,t);return p.data.set(h),d.putImageData(p,0,0),new Promise((async(e,t)=>{Wd.toBlob((r=>{if(!r)return t("Failed to capture thumbnail.");e(URL.createObjectURL(r))}),"image/png")}))}}var Yh,Kh;!function(e){e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.NearestMipmapNearest=9984]="NearestMipmapNearest",e[e.LinearMipmapNearest=9985]="LinearMipmapNearest",e[e.NearestMipmapLinear=9986]="NearestMipmapLinear",e[e.LinearMipmapLinear=9987]="LinearMipmapLinear"}(Yh||(Yh={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(Kh||(Kh={}));const Jh=new Map([[Kh.Repeat,he],[Kh.ClampToEdge,ue],[Kh.MirroredRepeat,de]]),$h=new Map([[he,Kh.Repeat],[ue,Kh.ClampToEdge],[de,Kh.MirroredRepeat]]),Zh=new Map([[Yh.Nearest,pe],[Yh.Linear,ge],[Yh.NearestMipmapNearest,Ae],[Yh.LinearMipmapNearest,fe],[Yh.NearestMipmapLinear,me],[Yh.LinearMipmapLinear,_e]]),eu=new Map([[pe,Yh.Nearest],[ge,Yh.Linear],[Ae,Yh.NearestMipmapNearest],[fe,Yh.LinearMipmapNearest],[me,Yh.NearestMipmapLinear],[_e,Yh.LinearMipmapLinear]]),tu=new Map([[Yh.Nearest,pe],[Yh.Linear,ge]]),iu=new Map([[pe,Yh.Nearest],[ge,Yh.Linear]]),isMinFilter=e=>eu.has(e),isMagFilter=e=>iu.has(e),isWrapping=e=>$h.has(e),nu=Symbol("threeTexture"),ru=Symbol("threeTextures"),su=Symbol("setProperty");class Sampler extends ThreeDOMElement{get[nu](){var e;return null===(e=this[Vh])||void 0===e?void 0:e.values().next().value}get[ru](){return this[Vh]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[nu].name||""}get minFilter(){return eu.get(this[nu].minFilter)}get magFilter(){return iu.get(this[nu].magFilter)}get wrapS(){return $h.get(this[nu].wrapS)}get wrapT(){return $h.get(this[nu].wrapT)}get rotation(){return this[nu].rotation}get scale(){return toVector2D(this[nu].repeat)}get offset(){return toVector2D(this[nu].offset)}setMinFilter(e){this[su]("minFilter",Zh.get(e))}setMagFilter(e){this[su]("magFilter",tu.get(e))}setWrapS(e){this[su]("wrapS",Jh.get(e))}setWrapT(e){this[su]("wrapT",Jh.get(e))}setRotation(e){null==e&&(e=0),this[su]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[su]("repeat",new Vector2(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[su]("offset",new Vector2(e.u,e.v))}[su](e,t){if(((e,t)=>{switch(e){case"minFilter":return isMinFilter(t);case"magFilter":return isMagFilter(t);case"wrapS":case"wrapT":return isWrapping(t);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(const r of this[ru])r[e]=t,r.needsUpdate=!0;this[Hh]()}}const au=Symbol("image"),ou=Symbol("sampler"),lu=Symbol("threeTexture");class texture_Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[ou]=new Sampler(e,t),this[au]=new image_Image(e,t)}get[lu](){var e;return null===(e=this[Vh])||void 0===e?void 0:e.values().next().value}get name(){return this[lu].name||""}set name(e){for(const t of this[Vh])t.name=e}get sampler(){return this[ou]}get source(){return this[au]}}var cu,hu,uu;const du=Symbol("texture"),pu=Symbol("transform"),Au=Symbol("materials"),mu=Symbol("usage"),gu=Symbol("onUpdate"),fu=Symbol("activeVideo");var _u;!function(e){e[e.Base=0]="Base",e[e.MetallicRoughness=1]="MetallicRoughness",e[e.Normal=2]="Normal",e[e.Occlusion=3]="Occlusion",e[e.Emissive=4]="Emissive",e[e.Clearcoat=5]="Clearcoat",e[e.ClearcoatRoughness=6]="ClearcoatRoughness",e[e.ClearcoatNormal=7]="ClearcoatNormal",e[e.SheenColor=8]="SheenColor",e[e.SheenRoughness=9]="SheenRoughness",e[e.Transmission=10]="Transmission",e[e.Thickness=11]="Thickness",e[e.Specular=12]="Specular",e[e.SpecularColor=13]="SpecularColor",e[e.Iridescence=14]="Iridescence",e[e.IridescenceThickness=15]="IridescenceThickness",e[e.Anisotropy=16]="Anisotropy"}(_u||(_u={}));class TextureInfo{constructor(e,t,r,s){this[cu]=null,this[hu]={rotation:0,scale:new Vector2(1,1),offset:new Vector2(0,0)},this[uu]=!1,r&&(this[pu].rotation=r.rotation,this[pu].scale.copy(r.repeat),this[pu].offset.copy(r.offset),this[du]=new texture_Texture(e,r)),this[gu]=e,this[Au]=s,this[mu]=t}get texture(){return this[du]}setTexture(e){var t,r;const s=null!=e?e.source[Xh]:null,o=null===(t=this[du])||void 0===t?void 0:t.source[Xh];if(null!=o&&o.isVideoTexture?this[fu]=!1:(null===(r=this[du])||void 0===r?void 0:r.source.animation)&&this[du].source.animation.removeEventListener("enterFrame",this[gu]),this[du]=e,null!=s&&s.isVideoTexture){const e=s.image;if(this[fu]=!0,null!=e.requestVideoFrameCallback){const update=()=>{this[fu]&&(this[gu](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{const update=()=>{this[fu]&&(this[gu](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[gu]);let l=et;if(this[Au])for(const e of this[Au]){switch(this[mu]){case _u.Base:e.map=s;break;case _u.MetallicRoughness:l=tt,e.metalnessMap=s,e.roughnessMap=s;break;case _u.Normal:l=tt,e.normalMap=s;break;case _u.Occlusion:l=tt,e.aoMap=s;break;case _u.Emissive:e.emissiveMap=s;break;case _u.Clearcoat:e.clearcoatMap=s;break;case _u.ClearcoatRoughness:e.clearcoatRoughnessMap=s;break;case _u.ClearcoatNormal:e.clearcoatNormalMap=s;break;case _u.SheenColor:e.sheenColorMap=s;break;case _u.SheenRoughness:e.sheenRoughnessMap=s;break;case _u.Transmission:e.transmissionMap=s;break;case _u.Thickness:e.thicknessMap=s;break;case _u.Specular:e.specularIntensityMap=s;break;case _u.SpecularColor:e.specularColorMap=s;break;case _u.Iridescence:e.iridescenceMap=s;break;case _u.IridescenceThickness:e.iridescenceThicknessMap=s;break;case _u.Anisotropy:e.anisotropyMap=s}e.needsUpdate=!0}s&&(s.colorSpace=l,s.rotation=this[pu].rotation,s.repeat=this[pu].scale,s.offset=this[pu].offset),this[gu]()}}cu=du,hu=pu,uu=fu;const vu=Symbol("threeMaterial"),Eu=Symbol("threeMaterials"),yu=Symbol("baseColorTexture"),xu=Symbol("metallicRoughnessTexture");class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);const{map:r,metalnessMap:s}=t.values().next().value;this[yu]=new TextureInfo(e,_u.Base,r,t),this[xu]=new TextureInfo(e,_u.MetallicRoughness,s,t)}get[Eu](){return this[Vh]}get[vu](){var e;return null===(e=this[Vh])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[vu].opacity];return this[vu].color.toArray(e),e}get metallicFactor(){return this[vu].metalness}get roughnessFactor(){return this[vu].roughness}get baseColorTexture(){return this[yu]}get metallicRoughnessTexture(){return this[xu]}setBaseColorFactor(e){const t=new Color;e instanceof Array?t.fromArray(e):t.set(e);for(const r of this[Eu])r.color.set(t),e instanceof Array?r.opacity=e[3]:(e=[0,0,0,r.opacity],t.toArray(e));this[Hh]()}setMetallicFactor(e){for(const t of this[Eu])t.metalness=e;this[Hh]()}setRoughnessFactor(e){for(const t of this[Eu])t.roughness=e;this[Hh]()}}var Su,Mu;const Cu=Symbol("pbrMetallicRoughness"),bu=Symbol("normalTexture"),Iu=Symbol("occlusionTexture"),wu=Symbol("emissiveTexture"),Tu=Symbol("backingThreeMaterial"),Bu=Symbol("applyAlphaCutoff"),Ru=Symbol("getAlphaMode"),Lu=Symbol("lazyLoadGLTFInfo"),Du=Symbol("initialize"),Uu=Symbol("getLoadedMaterial"),Pu=Symbol("ensureMaterialIsLoaded"),Fu=Symbol("gltfIndex"),Nu=Symbol("setActive"),Qu=Symbol("variantIndices"),Ou=Symbol("isActive"),Gu=Symbol("variantSet"),ku=Symbol("modelVariants"),Vu=Symbol("name"),Hu=Symbol("pbrTextures");class material_Material extends ThreeDOMElement{constructor(e,t,r,s,o,l,c=void 0){super(e,o),this[Su]=new Set,this[Mu]=new Map,this[Fu]=t,this[Ou]=r,this[ku]=s,this[Vu]=l,null==c?this[Du]():this[Lu]=c}get[(Su=Gu,Mu=Hu,Tu)](){return this[Vh].values().next().value}[Du](){const e=this[Hh],t=this[Vh];this[Cu]=new PBRMetallicRoughness(e,t);const{normalMap:r,aoMap:s,emissiveMap:o}=t.values().next().value;this[bu]=new TextureInfo(e,_u.Normal,r,t),this[Iu]=new TextureInfo(e,_u.Occlusion,s,t),this[wu]=new TextureInfo(e,_u.Emissive,o,t);const createTextureInfo=r=>{this[Hu].set(r,new TextureInfo(e,r,null,t))};createTextureInfo(_u.Clearcoat),createTextureInfo(_u.ClearcoatRoughness),createTextureInfo(_u.ClearcoatNormal),createTextureInfo(_u.SheenColor),createTextureInfo(_u.SheenRoughness),createTextureInfo(_u.Transmission),createTextureInfo(_u.Thickness),createTextureInfo(_u.Specular),createTextureInfo(_u.SpecularColor),createTextureInfo(_u.Iridescence),createTextureInfo(_u.IridescenceThickness),createTextureInfo(_u.Anisotropy)}async[Uu](){if(null!=this[Lu]){const{set:e,material:t}=await this[Lu].doLazyLoad();return this[Vh]=e,this[Du](),this[Lu]=void 0,this.ensureLoaded=async()=>{},t}return this[Vh].values().next().value}colorFromRgb(e){const t=new Color;return e instanceof Array?t.fromArray(e):t.set(e),t}[Pu](){if(null!=this[Lu])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[Uu]()}get isLoaded(){return null==this[Lu]}get isActive(){return this[Ou]}[Nu](e){this[Ou]=e}get name(){return this[Vu]||""}set name(e){if(this[Vu]=e,null!=this[Vh])for(const t of this[Vh])t.name=e}get pbrMetallicRoughness(){return this[Pu](),this[Cu]}get normalTexture(){return this[Pu](),this[bu]}get occlusionTexture(){return this[Pu](),this[Iu]}get emissiveTexture(){return this[Pu](),this[wu]}get emissiveFactor(){return this[Pu](),this[Tu].emissive.toArray()}get index(){return this[Fu]}[Qu](){return this[Gu]}hasVariant(e){const t=this[ku].get(e);return null!=t&&this[Gu].has(t.index)}setEmissiveFactor(e){this[Pu]();const t=this.colorFromRgb(e);for(const e of this[Vh])e.emissive.set(t);this[Hh]()}[Ru](){return this[Tu].transparent?"BLEND":this[Tu].alphaTest>0?"MASK":"OPAQUE"}[Bu](){this[Pu]();for(const e of this[Vh])"MASK"===this[Ru]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[Pu]();for(const t of this[Vh])t.alphaTest=e,t.needsUpdate=!0;this[Bu](),this[Hh]()}getAlphaCutoff(){return this[Pu](),this[Tu].alphaTest}setDoubleSided(e){this[Pu]();for(const t of this[Vh])t.side=e?m:p,t.needsUpdate=!0;this[Hh]()}getDoubleSided(){return this[Pu](),this[Tu].side==m}setAlphaMode(e){this[Pu]();const enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const t of this[Vh])enableTransparency(t,"BLEND"===e),t.alphaTest="MASK"===e?.5:void 0,t.needsUpdate=!0;this[Hh]()}getAlphaMode(){return this[Pu](),this[Ru]()}get emissiveStrength(){return this[Pu](),this[Tu].emissiveIntensity}setEmissiveStrength(e){this[Pu]();for(const t of this[Vh])t.emissiveIntensity=e;this[Hh]()}get clearcoatFactor(){return this[Pu](),this[Tu].clearcoat}get clearcoatRoughnessFactor(){return this[Pu](),this[Tu].clearcoatRoughness}get clearcoatTexture(){return this[Pu](),this[Hu].get(_u.Clearcoat)}get clearcoatRoughnessTexture(){return this[Pu](),this[Hu].get(_u.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[Pu](),this[Hu].get(_u.ClearcoatNormal)}get clearcoatNormalScale(){return this[Pu](),this[Tu].clearcoatNormalScale.x}setClearcoatFactor(e){this[Pu]();for(const t of this[Vh])t.clearcoat=e;this[Hh]()}setClearcoatRoughnessFactor(e){this[Pu]();for(const t of this[Vh])t.clearcoatRoughness=e;this[Hh]()}setClearcoatNormalScale(e){this[Pu]();for(const t of this[Vh])t.clearcoatNormalScale=new Vector2(e,e);this[Hh]()}get ior(){return this[Pu](),this[Tu].ior}setIor(e){this[Pu]();for(const t of this[Vh])t.ior=e;this[Hh]()}get sheenColorFactor(){return this[Pu](),this[Tu].sheenColor.toArray()}get sheenColorTexture(){return this[Pu](),this[Hu].get(_u.SheenColor)}get sheenRoughnessFactor(){return this[Pu](),this[Tu].sheenRoughness}get sheenRoughnessTexture(){return this[Pu](),this[Hu].get(_u.SheenRoughness)}setSheenColorFactor(e){this[Pu]();const t=this.colorFromRgb(e);for(const e of this[Vh])e.sheenColor.set(t),e.sheen=1;this[Hh]()}setSheenRoughnessFactor(e){this[Pu]();for(const t of this[Vh])t.sheenRoughness=e,t.sheen=1;this[Hh]()}get transmissionFactor(){return this[Pu](),this[Tu].transmission}get transmissionTexture(){return this[Pu](),this[Hu].get(_u.Transmission)}setTransmissionFactor(e){this[Pu]();for(const t of this[Vh])t.transmission=e;this[Hh]()}get thicknessFactor(){return this[Pu](),this[Tu].thickness}get thicknessTexture(){return this[Pu](),this[Hu].get(_u.Thickness)}get attenuationDistance(){return this[Pu](),this[Tu].attenuationDistance}get attenuationColor(){return this[Pu](),this[Tu].attenuationColor.toArray()}setThicknessFactor(e){this[Pu]();for(const t of this[Vh])t.thickness=e;this[Hh]()}setAttenuationDistance(e){this[Pu]();for(const t of this[Vh])t.attenuationDistance=e;this[Hh]()}setAttenuationColor(e){this[Pu]();const t=this.colorFromRgb(e);for(const e of this[Vh])e.attenuationColor.set(t);this[Hh]()}get specularFactor(){return this[Pu](),this[Tu].specularIntensity}get specularTexture(){return this[Pu](),this[Hu].get(_u.Specular)}get specularColorFactor(){return this[Pu](),this[Tu].specularColor.toArray()}get specularColorTexture(){return this[Pu](),this[Hu].get(_u.SheenColor)}setSpecularFactor(e){this[Pu]();for(const t of this[Vh])t.specularIntensity=e;this[Hh]()}setSpecularColorFactor(e){this[Pu]();const t=this.colorFromRgb(e);for(const e of this[Vh])e.specularColor.set(t);this[Hh]()}get iridescenceFactor(){return this[Pu](),this[Tu].iridescence}get iridescenceTexture(){return this[Pu](),this[Hu].get(_u.Iridescence)}get iridescenceIor(){return this[Pu](),this[Tu].iridescenceIOR}get iridescenceThicknessMinimum(){return this[Pu](),this[Tu].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[Pu](),this[Tu].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[Pu](),this[Hu].get(_u.IridescenceThickness)}setIridescenceFactor(e){this[Pu]();for(const t of this[Vh])t.iridescence=e;this[Hh]()}setIridescenceIor(e){this[Pu]();for(const t of this[Vh])t.iridescenceIOR=e;this[Hh]()}setIridescenceThicknessMinimum(e){this[Pu]();for(const t of this[Vh])t.iridescenceThicknessRange[0]=e;this[Hh]()}setIridescenceThicknessMaximum(e){this[Pu]();for(const t of this[Vh])t.iridescenceThicknessRange[1]=e;this[Hh]()}get anisotropyStrength(){return this[Pu](),this[Tu].anisotropy}get anisotropyRotation(){return this[Pu](),this[Tu].anisotropyRotation}get anisotropyTexture(){return this[Pu](),this[Hu].get(_u.Anisotropy)}setAnisotropyStrength(e){this[Pu]();for(const t of this[Vh])t.anisotropy=e;this[Hh]()}setAnisotropyRotation(e){this[Pu]();for(const t of this[Vh])t.anisotropyRotation=e;this[Hh]()}}var zu=r(93e3);class primitive_node_Node{constructor(e){this.name="",this.children=new Array,this.name=e}}class PrimitiveNode extends primitive_node_Node{constructor(e,t,r,s){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:o,threeGLTF:l,threeObjectMap:c}=s;this.parser=l.parser,this.modelVariants=r,this.mesh.userData.variantData=r;const h=c.get(e.material);null!=h.materials?this.initialMaterialIdx=this.activeMaterialIdx=h.materials:zu.error(`Primitive (${e.name}) missing initial material reference.`);const d=e.userData.associations||{};if(null==d.meshes)return void zu.error("Mesh is missing primitive index association");const p=((o.meshes||[])[d.meshes].primitives||[])[d.primitives];if(null!=p){if(null!=p.material)this.materials.set(p.material,t[p.material]);else{const e=t.findIndex((e=>"Default"===e.name));e>=0?this.materials.set(e,t[e]):zu.warn("gltfPrimitive has no material!")}if(p.extensions&&p.extensions.KHR_materials_variants){const e=p.extensions.KHR_materials_variants,s=l.parser.json.extensions.KHR_materials_variants.variants;for(const o of e.mappings){const e=t[o.material];this.materials.set(o.material,e);for(const t of o.variants){const{name:o}=s[t];this.variantToMaterialMap.set(t,e),e[Qu]().add(t),r.has(o)||r.set(o,{name:o,index:t})}}}}else zu.error("Mesh primitive definition is missing.")}async setActiveMaterial(e){const t=this.materials.get(e);if(null!=t&&e!==this.activeMaterialIdx){this.mesh.material=await t[Uu]();const{normalScale:r}=this.mesh.material;null!=r&&r.y*r.x<0!=(null==this.mesh.geometry.attributes.tangent)&&this.parser.assignFinalMaterial(this.mesh),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){const t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;const r=await this.enableVariantHelper(e);null!=r&&(t.material=r)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});const r=this.modelVariants.get(t).index;return e[Qu]().add(r),this.variantToMaterialMap.set(r,e),this.materials.set(e.index,e),this.updateVariantUserData(r,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[Qu]().add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map;this.mesh.userData.variantMaterials.set(e,{material:t[Vh].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(zu.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}var Wu,qu,Xu,ju,Yu,Ku,Ju=r(93e3);const $u=Symbol("materials"),Zu=Symbol("hierarchy"),ed=Symbol("roots"),td=Symbol("primitives"),id=(Symbol("loadVariant"),Symbol("prepareVariantsForExport")),nd=Symbol("switchVariant"),rd=Symbol("materialFromPoint"),sd=Symbol("nodeFromPoint"),ad=Symbol("nodeFromIndex"),od=Symbol("variantData"),ld=Symbol("availableVariants"),cd=Symbol("modelOnUpdate"),hd=Symbol("cloneMaterial");class LazyLoader{constructor(e,t,r,s){this.gltf=e,this.gltfElementMap=t,this.mapKey=r,this.doLazyLoad=s}}class Model{constructor(e,t=()=>{}){this[Wu]=new Array,this[qu]=new Array,this[Xu]=new Array,this[ju]=new Array,this[Yu]=()=>{},this[Ku]=new Map,this[cd]=t;const{gltf:r,threeGLTF:s,gltfElementMap:o}=e;for(const[e,l]of r.materials.entries()){const c=o.get(l);if(null!=c)this[$u].push(new material_Material(t,e,!0,this[od],c,l.name));else{const h=(r.materials||[])[e],d=e,materialLoadCallback=async()=>{const e=await s.parser.getDependency("material",d),t=new Set;return o.set(h,t),t.add(e),{set:t,material:e}};this[$u].push(new material_Material(t,e,!1,this[od],c,l.name,new LazyLoader(r,o,h,materialLoadCallback)))}}const l=new Map,c=new Array;for(const e of s.scene.children)c.push(e);for(;c.length>0;){const t=c.pop();let r=null;t instanceof three_module_Mesh?(r=new PrimitiveNode(t,this.materials,this[od],e),this[td].push(r)):r=new primitive_node_Node(t.name);const s=l.get(t);null!=s?s.children.push(r):this[ed].push(r),this[Zu].push(r);for(const e of t.children)c.push(e),l.set(t,r)}}get materials(){return this[$u]}[(Wu=$u,qu=Zu,Xu=ed,ju=td,Yu=cd,Ku=od,ld)](){const e=Array.from(this[od].values());return e.sort(((e,t)=>e.index-t.index)),e.map((e=>e.name))}getMaterialByName(e){const t=this[$u].filter((t=>t.name===e));return t.length>0?t[0]:null}[ad](e,t){const r=this[Zu].find((r=>{if(r instanceof PrimitiveNode){const{meshes:s,primitives:o}=r.mesh.userData.associations;if(s==e&&o==t)return!0}return!1}));return null==r?null:r}[sd](e){return this[Zu].find((t=>{if(t instanceof PrimitiveNode){if(t.mesh===e.object)return!0}return!1}))}[rd](e){return this[sd](e).getActiveMaterial()}async[nd](e){for(const t of this[td])await t.enableVariant(e);for(const e of this.materials)e[Nu](!1);for(const e of this[td])this.materials[e.getActiveMaterial().index][Nu](!0)}async[id](){const e=new Array;for(const t of this[td])e.push(t.instantiateVariants());await Promise.all(e)}[hd](e,t){const r=this.materials[e];r.isLoaded||Ju.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const s=r[Vh],o=new Set;for(const[e,r]of s.entries()){const l=r.clone();l.name=t+(s.size>1?"_inst"+e:""),o.add(l)}const l=new material_Material(this[cd],this[$u].length,!1,this[od],o,t);return this[$u].push(l),l}createMaterialInstanceForVariant(e,t,r,s=!0){let o=null;for(const s of this[td]){const l=this[od].get(r);null!=l&&s.variantInfo.has(l.index)||null!=s.getMaterial(e)&&(this.hasVariant(r)||this.createVariant(r),null==o&&(o=this[hd](e,t)),s.addVariant(o,r))}if(s&&null!=o){o[Nu](!0),this.materials[e][Nu](!1);for(const e of this[td])e.enableVariant(r)}return o}createVariant(e){this[od].has(e)?Ju.warn(`Variant '${e}'' already exists`):this[od].set(e,{name:e,index:this[od].size})}hasVariant(e){return this[od].has(e)}setMaterialToVariant(e,t){if(null!=this[ld]().find((e=>e===t)))if(e<0||e>=this.materials.length)Ju.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const r of this[td]){const s=r.getMaterial(e);null!=s&&r.addVariant(s,t)}else Ju.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const r=this[od].get(e);null!=r&&(r.name=t,this[od].set(t,r),this[od].delete(e))}deleteVariant(e){const t=this[od].get(e);if(null!=t){for(const r of this.materials)r.hasVariant(e)&&r[Gu].delete(t.index);for(const e of this[td])e.deleteVariant(t.index);this[od].delete(e)}}}var scene_graph_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const ud=Symbol("currentGLTF"),dd=Symbol("originalGltfJson"),pd=Symbol("model"),Ad=Symbol("getOnUpdateMethod"),md=Symbol("buildTexture");class GroundedSkybox extends three_module_Mesh{constructor(){super(void 0,new MeshBasicMaterial({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,t=this.radius,r=128){e==this.height&&t==this.radius&&r==this.resolution||(this.height=e,this.radius=t,this.resolution=r,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function makeGeometry(e,t,r){const s=new SphereGeometry(t,2*r,r);s.scale(1,1,-1);const o=s.getAttribute("position"),l=new three_module_Vector3;for(let t=0;t<o.count;++t)if(l.fromBufferAttribute(o,t),l.y<0){const r=3*-e/2,s=l.y<r?-e/l.y:1-l.y*l.y/(3*r*r);l.multiplyScalar(s),l.toArray(o.array,3*t)}return o.needsUpdate=!0,s}(e,t,r)))}}const gd=new three_module_Vector3,fd=new three_module_Vector3,_d=new three_module_Vector3,vd=new Matrix3,Ed=new Triangle,yd=new three_module_Quaternion;class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new three_module_Vector3(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;const t=Tl(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,Fl(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=Tl(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(e){if(!e&&this.initialized)return;const{mesh:t,tri:r,bary:s}=this;if(null==t||null==r||null==s)return;t.getVertexPosition(r.x,gd),t.getVertexPosition(r.y,fd),t.getVertexPosition(r.z,_d),gd.toArray(vd.elements,0),fd.toArray(vd.elements,3),_d.toArray(vd.elements,6),this.position.copy(s).applyMatrix3(vd);const o=this.parent;o.worldToLocal(t.localToWorld(this.position)),Ed.set(gd,fd,_d),Ed.getNormal(this.normal).transformDirection(t.matrixWorld);const l=o.parent;yd.setFromAxisAngle(gd.set(0,1,0),-l.yaw),this.normal.applyQuaternion(yd)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach((t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const r=t,s=r.dataset.visibilityAttribute;if(null!=s){const t=`data-${s}`;r.toggleAttribute(t,e)}r.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))})),this.initialized=!0}}const xd={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},Sd={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};r(93e3);Math.PI,Math.PI;function MathUtils_lerp(e,t,r){return(1-r)*e+r*t}class Shadow extends Object3D{constructor(e,t,r){super(),this.camera=new OrthographicCamera,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new MeshDepthMaterial,this.horizontalBlurMaterial=new ShaderMaterial(xd),this.verticalBlurMaterial=new ShaderMaterial(Sd),this.intensity=0,this.softness=1,this.boundingBox=new Box3,this.size=new three_module_Vector3,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:s}=this;s.rotation.x=Math.PI/2,s.left=-.5,s.right=.5,s.bottom=-.5,s.top=.5,this.add(s);const o=new PlaneGeometry,l=new MeshBasicMaterial({opacity:1,transparent:!0,side:A});this.floor=new three_module_Mesh(o,l),this.floor.userData.noHit=!0,s.add(this.floor),this.blurPlane=new three_module_Mesh(o),this.blurPlane.visible=!1,s.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,r)}setScene(e,t,r){const{boundingBox:s,size:o,rotation:l,position:c}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(o.x,o.y,o.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(c),"back"===r){const{min:e,max:t}=s;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[o.y,o.z]=[o.z,o.y],l.x=Math.PI/2,l.y=Math.PI}else l.x=0,l.y=0;if(this.isAnimated){const e=s.min.y,t=s.max.y;o.y=this.maxDimension,s.expandByVector(o.subScalar(this.maxDimension).multiplyScalar(-.5)),s.min.y=e,s.max.y=t,o.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===r?c.y=s.min.y:c.z=s.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:r}=this,s=this.isAnimated?2:1,o=s*Math.pow(2,9-3*e);this.setMapSize(o);const l=t.y/2,c=t.y*s;r.near=0,r.far=MathUtils_lerp(c,l,e),this.depthMaterial.opacity=1/e,r.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const r=Math.floor(t.x>t.z?e:e*t.x/t.z),s=Math.floor(t.x>t.z?e*t.z/t.x:e),o=10+r,l=10+s;if(null==this.renderTarget||this.renderTarget.width===o&&this.renderTarget.height===l||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:be};this.renderTarget=new WebGLRenderTarget(o,l,e),this.renderTargetBlur=new WebGLRenderTarget(o,l,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/r),t.z*(1+10/s),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*MathUtils_lerp(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return.001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;const r=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const s=e.xr.enabled;e.xr.enabled=!1;const o=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=s,e.setRenderTarget(o),e.setClearAlpha(r)}blurShadow(e){const{camera:t,horizontalBlurMaterial:r,verticalBlurMaterial:s,renderTarget:o,renderTargetBlur:l,blurPlane:c}=this;c.visible=!0,c.material=r,r.uniforms.h.value=1/this.renderTarget.width,r.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(l),e.render(c,t),c.material=s,s.uniforms.v.value=1/this.renderTarget.height,s.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(o),e.render(c,t),c.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}var Md=r(93e3);const Cd=new three_module_Vector3,bd=new three_module_Vector3,Id=new three_module_Vector3,wd=new class Raycaster{constructor(e,t,r=0,s=1/0){this.ray=new Ray(e,t),this.near=r,this.far=s,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):o.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,r=[]){return intersectObject(e,this,r,t),r.sort(ascSort),r}intersectObjects(e,t=!0,r=[]){for(let s=0,o=e.length;s<o;s++)intersectObject(e[s],this,r,t);return r.sort(ascSort),r}},Td=new three_module_Vector3,Bd=new Vector2;class ModelScene extends Scene{constructor({canvas:e,element:t,width:r,height:s}){super(),this.annotationRenderer=new CSS2DRenderer,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.camera=new PerspectiveCamera(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new Object3D,this.animationNames=[],this.boundingBox=new Box3,this.boundingSphere=new Sphere,this.size=new three_module_Vector3,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=ee,this.canScale=!0,this.isDirty=!1,this.goalTarget=new three_module_Vector3,this.targetDamperX=new Damper,this.targetDamperY=new Damper,this.targetDamperZ=new Damper,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new GroundedSkybox,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new PerspectiveCamera(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(r,s),this.target.name="Target",this.mixer=new three_module_AnimationMixer(this.target);const{domElement:o}=this.annotationRenderer,{style:l}=o;l.display="none",l.pointerEvents="none",l.position="absolute",l.top="0",this.element.shadowRoot.querySelector(".default").appendChild(o),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=()=>{}){if(!e||e===this.url)return void t(1);if(this.reset(),this.url=e,null!=this.externalRenderer){const e=await this.externalRenderer.load(t);return this.boundingSphere.radius=e.framedRadius,void(this.idealAspect=e.fieldOfViewAspect)}let r;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{r=await new Promise((async(r,s)=>{this.cancelPendingSourceChange=()=>s();try{r(await this.element[Ep].loader.load(e,this.element,t))}catch(e){s(e)}}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=r,null!=r&&(this._model=r.scene,this.target.add(r.scene));const{animations:s}=r,o=new Map,l=[];for(const e of s)o.set(e.name,e),l.push(e.name);this.animations=s,this.animationsByName=o,this.animationNames=l,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);const t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[ud]=null,this.element[dd]=null,this.element[pd]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){const r=pa();this.externalRenderer.resize(e*r,t*r)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){const t=new Box3;e.traverse((e=>{const r=e;if(!r.material)return;if(!r.material.transparent)return;t.setFromObject(r);const s=t.getSize(Td),o=Math.min(s.x,s.y,s.z);Math.max(s.x,s.y,s.z)<100*o||this.markBakedShadow(r)}))}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,r=new Box3;this.boundingBox.getSize(this.size);for(const s of this.bakedShadows)r.setFromObject(s),r.min.y<e.y+this.size.y/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.z<=e.z&&r.max.z>=t.z||r.min.z<e.z+this.size.z/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.y<=e.y&&r.max.y>=t.y||this.unmarkBakedShadow(s)}applyTransform(){const{model:e}=this;if(null==e)return;const t=Tl(this.element.orientation)[0].terms,r=Fl(t[0]).number,s=Fl(t[1]).number,o=Fl(t[2]).number;e.quaternion.setFromEuler(new Euler(s,o,r,"YXZ"));const l=Tl(this.element.scale)[0].terms;e.scale.set(l[0].number,l[1].number,l[2].number)}updateBoundingBox(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);const bound=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=reduceVertices(e,bound,new Box3),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((e=>this.unmarkBakedShadow(e))),this.boundingBox=reduceVertices(e,bound,new Box3)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());this.boundingSphere.radius=Math.sqrt(reduceVertices(e,((e,r)=>Math.max(e,t.distanceToSquared(r))),0));this.idealAspect=reduceVertices(e,((e,r)=>{r.sub(t);const s=Math.sqrt(r.x*r.x+r.z*r.z);return Math.max(e,s/(this.idealCameraDistance()-Math.abs(r.y)))}),0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(const t of this.bakedShadows)t.visible=e}idealCameraDistance(){const e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){const t=Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(t)*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)Bd.set(e/window.screen.width,t/window.screen.height);else{const r=this.element.getBoundingClientRect();Bd.set((e-r.x)/this.width,(t-r.y)/this.height)}return Bd.multiplyScalar(2).subScalar(1),Bd.y*=-1,Bd}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[Ep].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){const e=Tl(this.element.skyboxHeight)[0].terms[0],t=Fl(e).number,r=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,r),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,r){this.goalTarget.set(-e,-t,-r)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,r=this.target.position;if(t.equals(r))return!1;{const s=this.boundingSphere.radius/10;let{x:o,y:l,z:c}=r;return o=this.targetDamperX.update(o,t.x,e,s),l=this.targetDamperY.update(l,t.y,e,s),c=this.targetDamperZ.update(c,t.z,e,s),this.target.position.set(o,l,c),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:r,z:s}=this.position;this.yaw=Math.atan2(e-r,t-s)}get model(){return this._model}set yaw(e){this.rotation.y=e,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){const e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop!==ze||1&~e?this.currentAnimationAction.time:this.duration-this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,r=2201,s=1/0){if(null==this._currentGLTF)return;const{animations:o}=this;if(null==o||0===o.length)return;let l=null;if(null!=e&&(l=this.animationsByName.get(e),null==l)){const t=parseInt(e);!isNaN(t)&&t>=0&&t<o.length&&(l=o[t])}null==l&&(l=o[0]);try{const{currentAnimationAction:e}=this,o=this.mixer.clipAction(l,this);this.currentAnimationAction=o,this.element.paused?this.mixer.stopAllAction():(o.paused=!1,null!=e&&o!==e?o.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),o.setLoop(r,s),o.enabled=!0,o.clampWhenFinished=!0,o.play()}catch(e){Md.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){const e=this.shadow;if(null!=e){const t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){const t=this.shadow;null!=t&&1==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,null!=this._currentGLTF&&(this.setBakedShadowVisibility(),!(e<=0&&null==this.shadow))){if(null==this.shadow){const e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new Shadow(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){const t=this.shadow;null!=t&&t.setOffset(e)}hitFromPoint(e,t=this){wd.setFromCamera(e,this.getCamera());return wd.intersectObject(t,!0).find((e=>e.object.visible&&!e.object.userData.noHit))}positionAndNormalFromPoint(e,t=this){var r;const s=this.hitFromPoint(e,t);if(null==s)return null;return{position:s.point,normal:null!=s.face?s.face.normal.clone().applyNormalMatrix((new Matrix3).getNormalMatrix(s.object.matrixWorld)):wd.ray.direction.clone().multiplyScalar(-1),uv:null!==(r=s.uv)&&void 0!==r?r:null}}surfaceFromPoint(e,t=this){const r=this.element.model;if(null==r)return null;const s=this.hitFromPoint(e,t);if(null==s||null==s.face)return null;const o=r[sd](s),{meshes:l,primitives:c}=o.mesh.userData.associations,h=new three_module_Vector3,d=new three_module_Vector3,p=new three_module_Vector3,{a:A,b:m,c:g}=s.face,f=s.object;f.getVertexPosition(A,h),f.getVertexPosition(m,d),f.getVertexPosition(g,p);const _=new Triangle(h,d,p),E=new three_module_Vector3;return _.getBarycoord(f.worldToLocal(s.point),E),`${l} ${c} ${A} ${m} ${g} ${E.x.toFixed(3)} ${E.y.toFixed(3)} ${E.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element)}removeHotspot(e){this.target.remove(e)}forHotspots(e){const{children:t}=this.target;for(let r=0,s=t.length;r<s;r++){const s=t[r];s instanceof Hotspot&&e(s)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){const t=Tl(e.surface)[0].terms;if(8!=t.length)return void Md.warn(e.surface+" does not have exactly 8 numbers.");const r=this.element.model[ad](t[0].number,t[1].number),s=new three_module_Vector3(t[2].number,t[3].number,t[4].number);if(null==r)return void Md.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const o=r.mesh.geometry.attributes.position.count;if(s.x>=o||s.y>=o||s.z>=o)return void Md.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const l=new three_module_Vector3(t[5].number,t[6].number,t[7].number);e.mesh=r.mesh,e.tri=s,e.bary=l}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots((t=>{this.initializeSurface(t),t.updateSurface(e)}))}updateHotspotsVisibility(e){this.forHotspots((t=>{Cd.copy(e),bd.setFromMatrixPosition(t.matrixWorld),Cd.sub(bd),Id.copy(t.normal).transformDirection(this.target.matrixWorld),Cd.dot(Id)<0?t.hide():t.show()}))}orientHotspots(e){this.forHotspots((t=>{t.orient(e)}))}setHotspotsVisibility(e){this.forHotspots((t=>{t.visible=e}))}updateSchema(e){var t;const{schemaElement:r,element:s}=this,{alt:o,poster:l,iosSrc:c}=s;if(null!=e){const s=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];c&&s.push({"@type":"MediaObject",contentUrl:c,encodingFormat:"model/vnd.usdz+zip"});const h={"@context":"http://schema.org/","@type":"3DModel",image:null!=l?l:void 0,name:null!=o?o:void 0,encoding:s};r.textContent=JSON.stringify(h),document.head.appendChild(r)}else null!=r.parentElement&&r.parentElement.removeChild(r)}}class ProgressTracker extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),r=>{let s;return s=Math.max(utilities_clamp(r,0,1),t.progress),s!==t.progress&&this.announceTotalProgress(t,s,e),t.progress}}announceTotalProgress(e,t,r){let s=0,o=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;s+=1-t,e.completed&&o++}const l=e.progress;e.progress=t,this.totalProgress+=(t-l)*(1-this.totalProgress)/s;const c=o===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:c,reason:r}})),o===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var Rd,Ld,Dd,Ud,Pd,Fd,Nd,Qd,Od,Gd,kd,Vd,Hd,zd=r(93e3),model_viewer_base_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Wd=document.createElement("canvas"),qd=Symbol("fallbackResizeHandler"),Xd=Symbol("defaultAriaLabel"),jd=Symbol("resizeObserver"),Yd=Symbol("clearModelTimeout"),Kd=Symbol("onContextLost"),Jd=Symbol("loaded"),$d=Symbol("status"),Zd=Symbol("onFocus"),ep=Symbol("onBlur"),tp=Symbol("updateSize"),ip=Symbol("intersectionObserver"),np=Symbol("isElementInViewport"),rp=Symbol("announceModelVisibility"),sp=Symbol("ariaLabel"),ap=Symbol("altDefaulted"),op=Symbol("statusElement"),lp=Symbol("updateStatus"),cp=Symbol("loadedTime"),hp=Symbol("updateSource"),up=Symbol("markLoaded"),dp=Symbol("container"),pp=Symbol("input"),Ap=Symbol("canvas"),mp=Symbol("scene"),gp=Symbol("needsRender"),fp=Symbol("tick"),_p=Symbol("onModelLoad"),vp=Symbol("onResize"),Ep=Symbol("renderer"),yp=Symbol("progressTracker"),xp=Symbol("getLoaded"),Sp=Symbol("getModelIsVisible"),Mp=Symbol("shouldAttemptPreload"),toVector3D=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),toVector2D=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class ModelViewerElementBase extends reactive_element_a{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[Rd]=!1,this[Ld]=!1,this[Dd]=0,this[Ud]="",this[Pd]=null,this[Fd]=debounce((()=>{const e=this.getBoundingClientRect();this[tp](e)}),50),this[Nd]=debounce((e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))}),0),this[Qd]=null,this[Od]=null,this[Gd]=new ProgressTracker,this[kd]=()=>{this[op].textContent=this[$d]},this[Vd]=()=>{this[op].textContent=""},this[Hd]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,r;if((e=>{D(va,e)})(e),this[dp]=e.querySelector(".container"),this[pp]=e.querySelector(".userInput"),this[Ap]=e.querySelector("canvas"),this[op]=e.querySelector("#status"),this[Xd]=this[pp].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,r=e.height}else t=300,r=150;this[mp]=new ModelScene({canvas:this[Ap],element:this,width:t,height:r}),Promise.resolve().then((()=>{this[tp](this.getBoundingClientRect())})),ia&&(this[jd]=new ResizeObserver((e=>{if(!this[Ep].isPresenting)for(let t of e)t.target===this&&this[tp](t.contentRect)}))),na?this[ip]=new IntersectionObserver((e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[np]=t.isIntersecting,this[rp](e),this[np]&&!this.loaded&&this[hp]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[np]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[Go].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[Go].evictionThreshold}static set minimumRenderScale(e){e>1&&zd.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&zd.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Renderer.singleton.minScale=e}static get minimumRenderScale(){return Renderer.singleton.minScale}get loaded(){return this[xp]()}get[(Rd=np,Ld=Jd,Dd=cp,Ud=$d,Pd=Yd,Fd=qd,Nd=rp,Qd=jd,Od=ip,Gd=yp,Ep)](){return Renderer.singleton}get modelIsVisible(){return this[Sp]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),ia?this[jd].observe(this):self.addEventListener("resize",this[qd]),na&&this[ip].observe(this),this.addEventListener("focus",this[Zd]),this.addEventListener("blur",this[ep]);const e=this[Ep];e.addEventListener("contextlost",this[Kd]),e.registerScene(this[mp]),null!=this[Yd]&&(self.clearTimeout(this[Yd]),this[Yd]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),ia?this[jd].unobserve(this):self.removeEventListener("resize",this[qd]),na&&this[ip].unobserve(this),this.removeEventListener("focus",this[Zd]),this.removeEventListener("blur",this[ep]);const e=this[Ep];e.removeEventListener("contextlost",this[Kd]),e.unregisterScene(this[mp]),this[Yd]=self.setTimeout((()=>{this[mp].dispose(),this[Yd]=null}),10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[Jd]=!1,this[cp]=0,this[mp].reset()):this.src!==this[mp].url&&(this[Jd]=!1,this[cp]=0,this[hp]())),e.has("alt")&&this[pp].setAttribute("aria-label",this[sp]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[Ep].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[mp].updateSchema(this.src):this[mp].updateSchema(null))}toDataURL(e,t){return this[Ep].displayCanvas(this[mp]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,r=e?e.qualityArgument:void 0,s=e?e.idealAspect:void 0,{width:o,height:l,idealAspect:c,aspect:h}=this[mp],{dpr:d,scaleFactor:p}=this[Ep];let A=o*p*d,m=l*p*d,g=0,f=0;if(!0===s)if(c>h){const e=m;m=Math.round(A/c),f=(e-m)/2}else{const e=A;A=Math.round(m*c),g=(e-A)/2}Wd.width=A,Wd.height=m;try{return new Promise((async(e,s)=>{Wd.getContext("2d").drawImage(this[Ep].displayCanvas(this[mp]),g,f,A,m,0,0,A,m),Wd.toBlob((t=>{if(!t)return s(new Error("Unable to retrieve canvas blob"));e(t)}),t,r)}))}finally{this[tp]({width:o,height:l})}}registerEffectComposer(e){e.setRenderer(this[Ep].threeRenderer),e.setMainCamera(this[mp].getCamera()),e.setMainScene(this[mp]),this[mp].effectRenderer=e}unregisterEffectComposer(){this[mp].effectRenderer=null}registerRenderer(e){this[mp].externalRenderer=e}unregisterRenderer(){this[mp].externalRenderer=null}get[sp](){return this[ap]}get[ap](){return null==this.alt||"null"===this.alt?this[Xd]:this.alt}[xp](){return this[Jd]}[Sp](){return this.loaded&&this[np]}[Mp](){return!!this.src&&this[np]}[tp]({width:e,height:t}){0!==e&&0!==t&&(this[dp].style.width=`${e}px`,this[dp].style.height=`${t}px`,this[vp]({width:e,height:t}))}[fp](e,t){var r;null===(r=this[mp].effectRenderer)||void 0===r||r.beforeRender(e,t)}[up](){this[Jd]||(this[Jd]=!0,this[cp]=performance.now())}[gp](){this[mp].queueRender()}[_p](){}[lp](e){this[$d]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[op].textContent!=e&&(this[op].textContent=e)}[(kd=Zd,Vd=ep,vp)](e){this[mp].setSize(e.width,e.height)}async[(Hd=Kd,hp)](){const e=this[mp];if(this.loaded||!this[Mp]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[lp]("Loading"),e.stopAnimation();const t=this[yp].beginActivity("model-load"),r=this.src;try{const s=e.setSource(r,(e=>t(.95*utilities_clamp(e,0,1)))),o=this[fa]();await Promise.all([s,o]),this[up](),this[_p](),this.updateComplete.then((()=>{this.dispatchEvent(new CustomEvent("before-render"))})),await new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:r}})),e()}))}))}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}}model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"alt",void 0),model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"src",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"with-credentials"})],ModelViewerElementBase.prototype,"withCredentials",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"generate-schema"})],ModelViewerElementBase.prototype,"generateSchema",void 0);var animation_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Cp=Symbol("changeAnimation"),bp=Symbol("paused"),Ip={repetitions:1/0,pingpong:!1},wp=Symbol("hotspotMap"),Tp=Symbol("mutationCallback"),Bp=Symbol("observer"),Rp=Symbol("addHotspot"),Lp=Symbol("removeHotspot"),Dp=new three_module_Matrix4;var durl=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(durl(""))}catch(e){durl=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},function(e){return new Worker(e,{type:"module"})}}var Up=Uint8Array,Pp=Uint16Array,Fp=Uint32Array,Np=new Up([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Qp=new Up([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Op=new Up([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(e,t){for(var r=new Pp(31),s=0;s<31;++s)r[s]=t+=1<<e[s-1];var o=new Fp(r[30]);for(s=1;s<30;++s)for(var l=r[s];l<r[s+1];++l)o[l]=l-r[s]<<5|s;return[r,o]},Gp=freb(Np,2),kp=Gp[0],Vp=Gp[1];kp[28]=258,Vp[258]=28;for(var Hp=freb(Qp,0),zp=(Hp[0],Hp[1]),Wp=new Pp(32768),qp=0;qp<32768;++qp){var Xp=(43690&qp)>>>1|(21845&qp)<<1;Xp=(61680&(Xp=(52428&Xp)>>>2|(13107&Xp)<<2))>>>4|(3855&Xp)<<4,Wp[qp]=((65280&Xp)>>>8|(255&Xp)<<8)>>>1}var hMap=function(e,t,r){for(var s=e.length,o=0,l=new Pp(t);o<s;++o)++l[e[o]-1];var c,h=new Pp(t);for(o=0;o<t;++o)h[o]=h[o-1]+l[o-1]<<1;if(r){c=new Pp(1<<t);var d=15-t;for(o=0;o<s;++o)if(e[o])for(var p=o<<4|e[o],A=t-e[o],m=h[e[o]-1]++<<A,g=m|(1<<A)-1;m<=g;++m)c[Wp[m]>>>d]=p}else for(c=new Pp(s),o=0;o<s;++o)e[o]&&(c[o]=Wp[h[e[o]-1]++]>>>15-e[o]);return c},jp=new Up(288);for(qp=0;qp<144;++qp)jp[qp]=8;for(qp=144;qp<256;++qp)jp[qp]=9;for(qp=256;qp<280;++qp)jp[qp]=7;for(qp=280;qp<288;++qp)jp[qp]=8;var Yp=new Up(32);for(qp=0;qp<32;++qp)Yp[qp]=5;var Kp=hMap(jp,9,0),Jp=hMap(Yp,5,0),shft=function(e){return(e/8|0)+(7&e&&1)},slc=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var s=new(e instanceof Pp?Pp:e instanceof Fp?Fp:Up)(r-t);return s.set(e.subarray(t,r)),s},wbits=function(e,t,r){r<<=7&t;var s=t/8|0;e[s]|=r,e[s+1]|=r>>>8},wbits16=function(e,t,r){r<<=7&t;var s=t/8|0;e[s]|=r,e[s+1]|=r>>>8,e[s+2]|=r>>>16},hTree=function(e,t){for(var r=[],s=0;s<e.length;++s)e[s]&&r.push({s,f:e[s]});var o=r.length,l=r.slice();if(!o)return[Zp,0];if(1==o){var c=new Up(r[0].s+1);return c[r[0].s]=1,[c,1]}r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var h=r[0],d=r[1],p=0,A=1,m=2;for(r[0]={s:-1,f:h.f+d.f,l:h,r:d};A!=o-1;)h=r[r[p].f<r[m].f?p++:m++],d=r[p!=A&&r[p].f<r[m].f?p++:m++],r[A++]={s:-1,f:h.f+d.f,l:h,r:d};var g=l[0].s;for(s=1;s<o;++s)l[s].s>g&&(g=l[s].s);var f=new Pp(g+1),_=fflate_module_ln(r[A-1],f,0);if(_>t){s=0;var E=0,y=_-t,x=1<<y;for(l.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));s<o;++s){var S=l[s].s;if(!(f[S]>t))break;E+=x-(1<<_-f[S]),f[S]=t}for(E>>>=y;E>0;){var C=l[s].s;f[C]<t?E-=1<<t-f[C]++-1:++s}for(;s>=0&&E;--s){var b=l[s].s;f[b]==t&&(--f[b],++E)}_=t}return[new Up(f),_]},fflate_module_ln=function(e,t,r){return-1==e.s?Math.max(fflate_module_ln(e.l,t,r+1),fflate_module_ln(e.r,t,r+1)):t[e.s]=r},lc=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Pp(++t),s=0,o=e[0],l=1,w=function(e){r[s++]=e},c=1;c<=t;++c)if(e[c]==o&&c!=t)++l;else{if(!o&&l>2){for(;l>138;l-=138)w(32754);l>2&&(w(l>10?l-11<<5|28690:l-3<<5|12305),l=0)}else if(l>3){for(w(o),--l;l>6;l-=6)w(8304);l>2&&(w(l-3<<5|8208),l=0)}for(;l--;)w(o);l=1,o=e[c]}return[r.subarray(0,s),t]},clen=function(e,t){for(var r=0,s=0;s<t.length;++s)r+=e[s]*t[s];return r},wfblk=function(e,t,r){var s=r.length,o=shft(t+2);e[o]=255&s,e[o+1]=s>>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var l=0;l<s;++l)e[o+l+4]=r[l];return 8*(o+4+s)},wblk=function(e,t,r,s,o,l,c,h,d,p,A){wbits(t,A++,r),++o[256];for(var m=hTree(o,15),g=m[0],f=m[1],_=hTree(l,15),E=_[0],y=_[1],x=lc(g),S=x[0],C=x[1],b=lc(E),I=b[0],T=b[1],B=new Pp(19),U=0;U<S.length;++U)B[31&S[U]]++;for(U=0;U<I.length;++U)B[31&I[U]]++;for(var F=hTree(B,7),Q=F[0],O=F[1],G=19;G>4&&!Q[Op[G-1]];--G);var W,q,X,j,Y=p+5<<3,K=clen(o,jp)+clen(l,Yp)+c,J=clen(o,g)+clen(l,E)+c+14+3*G+clen(B,Q)+(2*B[16]+3*B[17]+7*B[18]);if(Y<=K&&Y<=J)return wfblk(t,A,e.subarray(d,d+p));if(wbits(t,A,1+(J<K)),A+=2,J<K){W=hMap(g,f,0),q=g,X=hMap(E,y,0),j=E;var $=hMap(Q,O,0);wbits(t,A,C-257),wbits(t,A+5,T-1),wbits(t,A+10,G-4),A+=14;for(U=0;U<G;++U)wbits(t,A+3*U,Q[Op[U]]);A+=3*G;for(var ee=[S,I],te=0;te<2;++te){var ie=ee[te];for(U=0;U<ie.length;++U){var ne=31&ie[U];wbits(t,A,$[ne]),A+=Q[ne],ne>15&&(wbits(t,A,ie[U]>>>5&127),A+=ie[U]>>>12)}}}else W=Kp,q=jp,X=Jp,j=Yp;for(U=0;U<h;++U)if(s[U]>255){ne=s[U]>>>18&31;wbits16(t,A,W[ne+257]),A+=q[ne+257],ne>7&&(wbits(t,A,s[U]>>>23&31),A+=Np[ne]);var re=31&s[U];wbits16(t,A,X[re]),A+=j[re],re>3&&(wbits16(t,A,s[U]>>>5&8191),A+=Qp[re])}else wbits16(t,A,W[s[U]]),A+=q[s[U]];return wbits16(t,A,W[256]),A+q[256]},$p=new Fp([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Zp=new Up(0),dflt=function(e,t,r,s,o,l){var c=e.length,h=new Up(s+c+5*(1+Math.ceil(c/7e3))+o),d=h.subarray(s,h.length-o),p=0;if(!t||c<8)for(var A=0;A<=c;A+=65535){var m=A+65535;m<c?p=wfblk(d,p,e.subarray(A,m)):(d[A]=l,p=wfblk(d,p,e.subarray(A,c)))}else{for(var g=$p[t-1],f=g>>>13,_=8191&g,E=(1<<r)-1,y=new Pp(32768),x=new Pp(E+1),S=Math.ceil(r/3),C=2*S,hsh=function(t){return(e[t]^e[t+1]<<S^e[t+2]<<C)&E},b=new Fp(25e3),I=new Pp(288),T=new Pp(32),B=0,U=0,F=(A=0,0),Q=0,O=0;A<c;++A){var G=hsh(A),W=32767&A,q=x[G];if(y[W]=q,x[G]=W,Q<=A){var X=c-A;if((B>7e3||F>24576)&&X>423){p=wblk(e,d,0,b,I,T,U,F,O,A-O,p),F=B=U=0,O=A;for(var j=0;j<286;++j)I[j]=0;for(j=0;j<30;++j)T[j]=0}var Y=2,K=0,J=_,$=W-q&32767;if(X>2&&G==hsh(A-$))for(var ee=Math.min(f,X)-1,te=Math.min(32767,A),ie=Math.min(258,X);$<=te&&--J&&W!=q;){if(e[A+Y]==e[A+Y-$]){for(var ne=0;ne<ie&&e[A+ne]==e[A+ne-$];++ne);if(ne>Y){if(Y=ne,K=$,ne>ee)break;var re=Math.min($,ne-2),se=0;for(j=0;j<re;++j){var ae=A-$+j+32768&32767,oe=ae-y[ae]+32768&32767;oe>se&&(se=oe,q=ae)}}}$+=(W=q)-(q=y[W])+32768&32767}if(K){b[F++]=268435456|Vp[Y]<<18|zp[K];var le=31&Vp[Y],ce=31&zp[K];U+=Np[le]+Qp[ce],++I[257+le],++T[ce],Q=A+Y,++B}else b[F++]=e[A],++I[e[A]]}}p=wblk(e,d,l,b,I,T,U,F,O,A-O,p),!l&&7&p&&(p=wfblk(d,p+1,Zp))}return slc(h,0,s+shft(p)+o)},eA=function(){for(var e=new Fp(256),t=0;t<256;++t){for(var r=t,s=9;--s;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),crc=function(){var e=-1;return{p:function(t){for(var r=e,s=0;s<t.length;++s)r=eA[255&r^t[s]]^r>>>8;e=r},d:function(){return~e}}},dopt=function(e,t,r,s,o){return dflt(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,s,!o)},mrg=function(e,t){var r={};for(var s in e)r[s]=e[s];for(var s in t)r[s]=t[s];return r},wbytes=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function deflateSync(e,t){return dopt(e,t||{},0,0)}var fltn=function(e,t,r,s){for(var o in e){var l=e[o],c=t+o;l instanceof Up?r[c]=[l,s]:Array.isArray(l)?r[c]=[l[0],mrg(s,l[1])]:fltn(l,c+"/",r,s)}},tA="undefined"!=typeof TextEncoder&&new TextEncoder,iA="undefined"!=typeof TextDecoder&&new TextDecoder;try{iA.decode(Zp,{stream:!0}),1}catch(e){}function strToU8(e,t){if(t){for(var r=new Up(e.length),s=0;s<e.length;++s)r[s]=e.charCodeAt(s);return r}if(tA)return tA.encode(e);var o=e.length,l=new Up(e.length+(e.length>>1)),c=0,w=function(e){l[c++]=e};for(s=0;s<o;++s){if(c+5>l.length){var h=new Up(c+8+(o-s<<1));h.set(l),l=h}var d=e.charCodeAt(s);d<128||t?w(d):d<2048?(w(192|d>>6),w(128|63&d)):d>55295&&d<57344?(w(240|(d=65536+(1047552&d)|1023&e.charCodeAt(++s))>>18),w(128|d>>12&63),w(128|d>>6&63),w(128|63&d)):(w(224|d>>12),w(128|d>>6&63),w(128|63&d))}return slc(l,0,c)}var exfl=function(e){var t=0;if(e)for(var r in e){var s=e[r].length;if(s>65535)throw"extra field too long";t+=s+4}return t},wzh=function(e,t,r,s,o,l,c,h){var d=s.length,p=r.extra,A=h&&h.length,m=exfl(p);wbytes(e,t,null!=c?33639248:67324752),t+=4,null!=c&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(null==l&&8),e[t++]=o&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8;var g=new Date(null==r.mtime?Date.now():r.mtime),f=g.getFullYear()-1980;if(f<0||f>119)throw"date not in range 1980-2099";if(wbytes(e,t,f<<25|g.getMonth()+1<<21|g.getDate()<<16|g.getHours()<<11|g.getMinutes()<<5|g.getSeconds()>>>1),t+=4,null!=l&&(wbytes(e,t,r.crc),wbytes(e,t+4,l),wbytes(e,t+8,r.size)),wbytes(e,t+12,d),wbytes(e,t+14,m),t+=16,null!=c&&(wbytes(e,t,A),wbytes(e,t+6,r.attrs),wbytes(e,t+10,c),t+=14),e.set(s,t),t+=d,m)for(var _ in p){var E=p[_],y=E.length;wbytes(e,t,+_),wbytes(e,t+2,y),e.set(E,t+4),t+=4+y}return A&&(e.set(h,t),t+=A),t},wzf=function(e,t,r,s,o){wbytes(e,t,101010256),wbytes(e,t+8,r),wbytes(e,t+10,r),wbytes(e,t+12,s),wbytes(e,t+16,o)};var nA=r(93e3);class USDZExporter{async parse(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1},t);const r={},s="model.usda";r[s]=null;let o=buildHeader();o+=function buildSceneStart(e){return`def Xform "Root"\n{\n\tdef Scope "Scenes" (\n\t\tkind = "sceneLibrary"\n\t)\n\t{\n\t\tdef Xform "Scene" (\n\t\t\tcustomData = {\n\t\t\t\tbool preliminary_collidesWithEnvironment = 0\n\t\t\t\tstring sceneName = "Scene"\n\t\t\t}\n\t\t\tsceneName = "Scene"\n\t\t)\n\t\t{\n\t\ttoken preliminary:anchoring:type = "${e.ar.anchoring.type}"\n\t\ttoken preliminary:planeAnchoring:alignment = "${e.ar.planeAnchoring.alignment}"\n\n`}(t);const l={},c={};e.traverseVisible((e=>{if(e.isMesh){const t=e.geometry,s=e.material;if(s.isMeshStandardMaterial){const c="geometries/Geometry_"+t.id+".usda";if(!(c in r)){const e=function buildMeshObject(e){const t=function buildMesh(e){const t="Geometry",r=e.attributes,s=r.position.count;return`\n\tdef Mesh "${t}"\n\t{\n\t\tint[] faceVertexCounts = [${function buildMeshVertexCount(e){const t=null!==e.index?e.index.count:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}(e)}]\n\t\tint[] faceVertexIndices = [${function buildMeshVertexIndices(e){const t=e.index,r=[];if(null!==t)for(let e=0;e<t.count;e++)r.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)r.push(e)}return r.join(", ")}(e)}]\n\t\tnormal3f[] normals = [${buildVector3Array(r.normal,s)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)\n\t\tpoint3f[] points = [${buildVector3Array(r.position,s)}]\n${function buildPrimvars(e){let t="";for(let r=0;r<4;r++){const s=r>0?r:"",o=e["uv"+s];void 0!==o&&(t+=`\n\t\ttexCoord2f[] primvars:st${s} = [${buildVector2Array(o)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)`)}return t}(r)}\n\t\tuniform token subdivisionScheme = "none"\n\t}\n`}(e);return`\ndef "Geometry"\n{\n${t}\n}\n`}(t);r[c]=function buildUSDFileAsString(e){let t=buildHeader();return t+=e,strToU8(t)}(e)}s.uuid in l||(l[s.uuid]=s),o+=function buildXform(e,t,r){const s="Object_"+e.id,o=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&nA.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return`def Xform "${s}" (\n\tprepend references = @./geometries/Geometry_${t.id}.usda@</Geometry>\n\tprepend apiSchemas = ["MaterialBindingAPI"]\n)\n{\n\tmatrix4d xformOp:transform = ${o}\n\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\trel material:binding = </Materials/Material_${r.id}>\n}\n\n`}(e,t,s)}else nA.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",e)}else e.isCamera&&(o+=function buildCamera(e){const t=e.name?e.name:"Camera_"+e.id,r=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&nA.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return e.isOrthographicCamera?`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${r}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(rA)}, ${e.far.toPrecision(rA)})\n\t\t\tfloat horizontalAperture = ${(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(rA)}\n\t\t\tfloat verticalAperture = ${(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(rA)}\n\t\t\ttoken projection = "orthographic"\n\t\t}\n\t\n\t`:`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${r}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(rA)}, ${e.far.toPrecision(rA)})\n\t\t\tfloat focalLength = ${e.getFocalLength().toPrecision(rA)}\n\t\t\tfloat focusDistance = ${e.focus.toPrecision(rA)}\n\t\t\tfloat horizontalAperture = ${e.getFilmWidth().toPrecision(rA)}\n\t\t\ttoken projection = "perspective"\n\t\t\tfloat verticalAperture = ${e.getFilmHeight().toPrecision(rA)}\n\t\t}\n\t\n\t`}(e))})),o+="\n\t\t}\n\t}\n}\n\n",o+=function buildMaterials(e,t,r=!1){const s=[];for(const o in e){const l=e[o];s.push(buildMaterial(l,t,r))}return`def "Materials"\n{\n${s.join("")}\n}\n\n`}(l,c,t.quickLookCompatible),r[s]=strToU8(o),o=null;for(const e in c){let t=c[e];!0===t.isCompressedTexture&&(t=decompress(t));const s=imageToCanvas(t.image,t.flipY),o=await new Promise((e=>s.toBlob(e,"image/png",1)));r[`textures/Texture_${e}.png`]=new Uint8Array(await o.arrayBuffer())}let h=0;for(const e in r){const t=r[e];h+=34+e.length;const s=63&h;if(4!==s){const o=new Uint8Array(64-s);r[e]=[t,{extra:{12345:o}}]}h=t.length}return function zipSync(e,t){t||(t={});var r={},s=[];fltn(e,"",r,t);var o=0,l=0;for(var c in r){var h=r[c],d=h[0],p=h[1],A=0==p.level?0:8,m=(B=strToU8(c)).length,g=p.comment,f=g&&strToU8(g),_=f&&f.length,E=exfl(p.extra);if(m>65535)throw"filename too long";var y=A?deflateSync(d,p):d,x=y.length,S=crc();S.p(d),s.push(mrg(p,{size:d.length,crc:S.d(),c:y,f:B,m:f,u:m!=c.length||f&&g.length!=_,o,compression:A})),o+=30+m+E+x,l+=76+2*(m+E)+(_||0)+x}for(var C=new Up(l+22),b=o,I=l-o,T=0;T<s.length;++T){var B=s[T];wzh(C,B.o,B,B.f,B.u,B.c.length);var U=30+B.f.length+exfl(B.extra);C.set(B.c,B.o+U),wzh(C,o,B,B.f,B.u,B.c.length,B.o,B.m),o+=16+U+(B.m?B.m.length:0)}return wzf(C,o,s.length,I,b),C}(r,{level:0})}}function imageToCanvas(e,t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=1024/Math.max(e.width,e.height),s=document.createElement("canvas");s.width=e.width*Math.min(1,r),s.height=e.height*Math.min(1,r);const o=s.getContext("2d");return!0===t&&(o.translate(0,s.height),o.scale(1,-1)),o.drawImage(e,0,0,s.width,s.height),s}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const rA=7;function buildHeader(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n\n'}function buildMatrix(e){const t=e.elements;return`( ${buildMatrixRow(t,0)}, ${buildMatrixRow(t,4)}, ${buildMatrixRow(t,8)}, ${buildMatrixRow(t,12)} )`}function buildMatrixRow(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function buildVector3Array(e,t){if(void 0===e)return nA.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const r=[];for(let t=0;t<e.count;t++){const s=e.getX(t),o=e.getY(t),l=e.getZ(t);r.push(`(${s.toPrecision(rA)}, ${o.toPrecision(rA)}, ${l.toPrecision(rA)})`)}return r.join(", ")}function buildVector2Array(e){const t=[];for(let r=0;r<e.count;r++){const s=e.getX(r),o=e.getY(r);t.push(`(${s.toPrecision(rA)}, ${1-o.toPrecision(rA)})`)}return t.join(", ")}function buildMaterial(e,t,r=!1){const s="\t\t\t",o=[],l=[];function buildTexture(s,o,l){const c=s.source.id+"_"+s.flipY;t[c]=s;const h=s.channel>0?"st"+s.channel:"st",d={1e3:"repeat",1001:"clamp",1002:"mirror"},p=s.repeat.clone(),A=s.offset.clone(),m=s.rotation,g=Math.sin(m),f=Math.cos(m);return A.y=1-A.y-p.y,r?(A.x=A.x/p.x,A.y=A.y/p.y,A.x+=g/p.x,A.y+=f-1):(A.x+=g*p.x,A.y+=(1-f)*p.y),`\n\t\tdef Shader "PrimvarReader_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdPrimvarReader_float2"\n\t\t\tfloat2 inputs:fallback = (0.0, 0.0)\n\t\t\ttoken inputs:varname = "${h}"\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Transform2d_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdTransform2d"\n\t\t\ttoken inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${o}.outputs:result>\n\t\t\tfloat inputs:rotation = ${(m*(180/Math.PI)).toFixed(rA)}\n\t\t\tfloat2 inputs:scale = ${buildVector2(p)}\n\t\t\tfloat2 inputs:translation = ${buildVector2(A)}\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Texture_${s.id}_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdUVTexture"\n\t\t\tasset inputs:file = @textures/Texture_${c}.png@\n\t\t\tfloat2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${o}.outputs:result>\n\t\t\t${void 0!==l?"float4 inputs:scale = "+function buildColor4(e){return`(${e.r}, ${e.g}, ${e.b}, 1.0)`}(l):""}\n\t\t\ttoken inputs:sourceColorSpace = "${s.colorSpace===Ze?"raw":"sRGB"}"\n\t\t\ttoken inputs:wrapS = "${d[s.wrapS]}"\n\t\t\ttoken inputs:wrapT = "${d[s.wrapT]}"\n\t\t\tfloat outputs:r\n\t\t\tfloat outputs:g\n\t\t\tfloat outputs:b\n\t\t\tfloat3 outputs:rgb\n\t\t\t${e.transparent||e.alphaTest>0?"float outputs:a":""}\n\t\t}`}return e.side===m&&nA.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(o.push(`${s}color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),o.push(`${s}float inputs:opacityThreshold = ${e.alphaTest}`)),l.push(buildTexture(e.map,"diffuse",e.color))):o.push(`${s}color3f inputs:diffuseColor = ${buildColor(e.color)}`),null!==e.emissiveMap?(o.push(`${s}color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`),l.push(buildTexture(e.emissiveMap,"emissive"))):e.emissive.getHex()>0&&o.push(`${s}color3f inputs:emissiveColor = ${buildColor(e.emissive)}`),null!==e.normalMap&&(o.push(`${s}normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),l.push(buildTexture(e.normalMap,"normal"))),null!==e.aoMap&&(o.push(`${s}float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`),l.push(buildTexture(e.aoMap,"occlusion"))),null!==e.roughnessMap&&1===e.roughness?(o.push(`${s}float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`),l.push(buildTexture(e.roughnessMap,"roughness"))):o.push(`${s}float inputs:roughness = ${e.roughness}`),null!==e.metalnessMap&&1===e.metalness?(o.push(`${s}float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`),l.push(buildTexture(e.metalnessMap,"metallic"))):o.push(`${s}float inputs:metallic = ${e.metalness}`),null!==e.alphaMap?(o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),o.push(`${s}float inputs:opacityThreshold = 0.0001`),l.push(buildTexture(e.alphaMap,"opacity"))):o.push(`${s}float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial&&(o.push(`${s}float inputs:clearcoat = ${e.clearcoat}`),o.push(`${s}float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`),o.push(`${s}float inputs:ior = ${e.ior}`)),`\n\tdef Material "Material_${e.id}"\n\t{\n\t\tdef Shader "PreviewSurface"\n\t\t{\n\t\t\tuniform token info:id = "UsdPreviewSurface"\n${o.join("\n")}\n\t\t\tint inputs:useSpecularWorkflow = 0\n\t\t\ttoken outputs:surface\n\t\t}\n\n\t\ttoken outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>\n\n${l.join("\n")}\n\n\t}\n`}function buildColor(e){return`(${e.r}, ${e.g}, ${e.b})`}function buildVector2(e){return`(${e.x}, ${e.y})`}var sA=r(93e3),ar_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};let aA=!1,oA=!1;const lA="#model-viewer-no-ar-fallback",cA=(hA=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=Tl(e),r=(t.length?t[0].terms:[]).filter((e=>e&&"ident"===e.type)).map((e=>e.value)).filter((e=>hA.indexOf(e)>-1));return new Set(r)}catch(e){}return new Set});var hA;const uA="quick-look",dA="scene-viewer",pA="webxr",AA="none",mA=Symbol("arButtonContainer"),gA=Symbol("enterARWithWebXR"),fA=Symbol("openSceneViewer"),_A=Symbol("openIOSARQuickLook"),vA=Symbol("canActivateAR"),EA=Symbol("arMode"),yA=Symbol("arModes"),xA=Symbol("arAnchor"),SA=Symbol("preload"),MA=Symbol("onARButtonContainerClick"),CA=Symbol("onARStatus"),bA=Symbol("onARTracking"),IA=Symbol("onARTap"),wA=Symbol("selectARMode"),TA=Symbol("triggerLoad");var loading_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const BA="auto",RA="auto",LA="eager",DA=Symbol("defaultProgressBarElement"),UA=Symbol("posterContainerElement"),PA=Symbol("defaultPosterElement"),FA=Symbol("shouldDismissPoster"),NA=Symbol("hidePoster"),QA=Symbol("modelIsRevealed"),OA=Symbol("updateProgressBar"),GA=Symbol("ariaLabelCallToAction"),kA=Symbol("onProgress");var staging_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const VA=Math.PI/32,HA={basis:[degreesToRadians(numberNode(VA,"rad"))],keywords:{auto:[null]}},zA=Symbol("autoRotateStartTime"),WA=Symbol("radiansPerSecond"),qA=Symbol("syncRotationRate"),XA=Symbol("onCameraChange"),jA=(e=>{var t,r,s;class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[r]=e=>{e.forEach((e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach((e=>{this[Rp](e)})),e.removedNodes.forEach((e=>{this[Lp](e)})),this[gp]())}))},this[s]=new MutationObserver(this[Tp])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[Rp](this.children[e]);const{ShadyDOM:e}=self;null==e?this[Bp].observe(this,{childList:!0}):this[Bp]=e.observeChildren(this,this[Tp])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[Bp].disconnect():e.unobserveChildren(this[Bp])}[(t=wp,r=Tp,s=Bp,fp)](e,t){super[fp](e,t);const r=this[mp],{annotationRenderer:s}=r,o=r.getCamera();r.shouldRender()&&(r.updateSurfaceHotspots(),r.updateHotspotsVisibility(o.position),s.domElement.style.display="",s.render(r,o))}updateHotspot(e){const t=this[wp].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[gp]())}queryHotspot(e){const t=this[wp].get(e);if(null==t)return null;const r=toVector3D(t.position),s=toVector3D(t.normal),o=t.facingCamera,l=this[mp],c=l.getCamera(),h=new three_module_Vector3;h.setFromMatrixPosition(t.matrixWorld),h.project(c);const d=l.width/2,p=l.height/2;h.x=h.x*d+d,h.y=-h.y*p+p;const A=toVector3D(new three_module_Vector3(h.x,h.y,h.z));return Number.isFinite(A.x)&&Number.isFinite(A.y)?{position:r,normal:s,canvasPosition:A,facingCamera:o}:null}positionAndNormalFromPoint(e,t){const r=this[mp],s=r.getNDC(e,t),o=r.positionAndNormalFromPoint(s);if(null==o)return null;Dp.copy(r.target.matrixWorld).invert();const l=toVector3D(o.position.applyMatrix4(Dp)),c=toVector3D(o.normal.transformDirection(Dp));let h=null;return null!=o.uv&&(h=toVector2D(o.uv)),{position:l,normal:c,uv:h}}surfaceFromPoint(e,t){const r=this[mp],s=r.getNDC(e,t);return r.surfaceFromPoint(s)}[Rp](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[wp].get(e.slot);null!=t?t.increment():(t=new Hotspot({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[wp].set(e.slot,t),this[mp].addHotspot(t)),this[mp].queueRender()}[Lp](e){if(!(e instanceof HTMLElement))return;const t=this[wp].get(e.slot);t&&(t.decrement()&&(this[mp].removeHotspot(t),this[wp].delete(e.slot)),this[mp].queueRender())}}return AnnotationModelViewerElement})((e=>{var t,r,s;class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[r]=null,this[s]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[pd]}get availableVariants(){return this.model?this.model[ld]():[]}get originalGltfJson(){return this[dd]}[(t=pd,r=ud,s=dd,Ad)](){return()=>{this[gp]()}}[md](e){return e.colorSpace=et,e.wrapS=he,e.wrapT=he,new texture_Texture(this[Ad](),e)}async createTexture(e,t="image/png"){const{textureUtils:r}=this[Ep],s=await r.loadImage(e);return s.userData.mimeType=t,this[md](s)}async createLottieTexture(e,t=1){const{textureUtils:r}=this[Ep],s=await r.loadLottie(e,t);return this[md](s)}createVideoTexture(e){const t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();const r=new VideoTexture(t);return this[md](r)}createCanvasTexture(){const e=document.createElement("canvas"),t=new CanvasTexture(e);return this[md](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[yp].beginActivity("variant-update");e(.1);const t=this[pd],{variantName:r}=this;null!=t&&(await t[nd](r),this[gp](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[mp];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[Ep].arRenderer.onUpdateScene(),this[gp]()}}[_p](){super[_p]();const{currentGLTF:e}=this[mp];if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[ud]&&(this[pd]=new Model(t,this[Ad]()),this[dd]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[ud]=e}async exportScene(e){const t=this[mp];return new Promise((async(r,s)=>{const o={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(o,e),o.animations=t.animations,o.truncateDrawRange=!0;const l=t.shadow;let c=!1;null!=l&&(c=l.visible,l.visible=!1),await this[pd][id]();(new GLTFExporter).register((e=>new GLTFExporterMaterialsVariantsExtension(e))).parse(t.model,(e=>r(new Blob([o.binary?e:JSON.stringify(e)],{type:o.binary?"application/octet-stream":"application/json"}))),(()=>s("glTF export failed")),o),null!=l&&(l.visible=c)}))}materialFromPoint(e,t){const r=this[pd];if(null==r)return null;const s=this[mp],o=s.getNDC(e,t),l=s.hitFromPoint(o);return null==l||null==l.face?null:r[rd](l)}}return scene_graph_decorate([n({type:String,attribute:"variant-name"})],SceneGraphModelViewerElement.prototype,"variantName",void 0),scene_graph_decorate([n({type:String,attribute:"orientation"})],SceneGraphModelViewerElement.prototype,"orientation",void 0),scene_graph_decorate([n({type:String,attribute:"scale"})],SceneGraphModelViewerElement.prototype,"scale",void 0),SceneGraphModelViewerElement})((e=>{var t,r,s;class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[r]=0,this[s]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[zA]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[XA]),this[zA]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[XA]),this[zA]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[zA]=performance.now())}[(t=zA,r=WA,qA)](e){this[WA]=e[0]}[fp](e,t){if(super[fp](e,t),!this.autoRotate||!this[Sp]()||this[Ep].isPresenting)return;const r=Math.min(t,e-this[zA]-this.autoRotateDelay);r>0&&(this[mp].yaw=this.turntableRotation+this[WA]*r*.001)}get turntableRotation(){return this[mp].yaw}resetTurntableRotation(e=0){this[mp].yaw=e}}return s=XA,staging_decorate([n({type:Boolean,attribute:"auto-rotate"})],StagingModelViewerElement.prototype,"autoRotate",void 0),staging_decorate([n({type:Number,attribute:"auto-rotate-delay"})],StagingModelViewerElement.prototype,"autoRotateDelay",void 0),staging_decorate([style({intrinsics:HA,updateHandler:qA}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,r,s;class EnvironmentModelViewerElement extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[t]=null,this[r]=null,this[s]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[mp].setShadowIntensity(.5*this.shadowIntensity),this[gp]()),e.has("shadowSoftness")&&(this[mp].setShadowSoftness(this.shadowSoftness),this[gp]()),e.has("exposure")&&(this[mp].exposure=this.exposure,this[gp]()),e.has("toneMapping")&&(this[mp].toneMapping="commerce"===this.toneMapping?te:"agx"===this.toneMapping?ie:ee,this[gp]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[Mp]()&&this[fa](),e.has("skyboxHeight")&&(this[mp].setGroundedSkybox(),this[gp]())}hasBakedShadow(){return this[mp].bakedShadows.size>0}async[(t=ma,r=ga,s=_a,fa)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[_a]&&(this[_a](),this[_a]=null);const{textureUtils:r}=this[Ep];if(null==r)return;const s=this[yp].beginActivity("environment-update");try{const{environmentMap:o,skybox:l}=await r.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,(e=>s(utilities_clamp(e,0,1))));this[ma]!==o&&(this[ma]=o,this.dispatchEvent(new CustomEvent("environment-change"))),this[ga]=null!=l?l.name===o.name?o:l:null,this[mp].setEnvironmentAndSkybox(this[ma],this[ga])}catch(e){if(e instanceof Error)throw this[mp].setEnvironmentAndSkybox(null,null),e}finally{s(1)}}}return __decorate([n({type:String,attribute:"environment-image"})],EnvironmentModelViewerElement.prototype,"environmentImage",void 0),__decorate([n({type:String,attribute:"skybox-image"})],EnvironmentModelViewerElement.prototype,"skyboxImage",void 0),__decorate([n({type:Number,attribute:"shadow-intensity"})],EnvironmentModelViewerElement.prototype,"shadowIntensity",void 0),__decorate([n({type:Number,attribute:"shadow-softness"})],EnvironmentModelViewerElement.prototype,"shadowSoftness",void 0),__decorate([n({type:Number})],EnvironmentModelViewerElement.prototype,"exposure",void 0),__decorate([n({type:String,attribute:"tone-mapping"})],EnvironmentModelViewerElement.prototype,"toneMapping",void 0),__decorate([n({type:String,attribute:"skybox-height"})],EnvironmentModelViewerElement.prototype,"skyboxHeight",void 0),EnvironmentModelViewerElement})((e=>{var t,r,s,o,l,c,h,d,p,A,m,g,f,_,E,y,x;class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=gc,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=vc,this.interactionPromptStyle=yc,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=xc,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[r]=this.shadowRoot.querySelector("#prompt"),this[s]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[o]=this.shadowRoot.querySelector(".pan-target"),this[l]=0,this[c]=1/0,this[h]=!1,this[d]=!1,this[p]=ah.AUTOMATIC,this[A]=new SmoothControls(this[mp].camera,this[pp],this[mp]),this[m]=new Spherical,this[g]=!1,this[f]=!1,this[_]=!1,this[E]=()=>{const e=this[wc].changeSource;this[Hc]=e,e===ah.USER_INTERACTION&&(this[Gc]=!0,this[Dc]())},this[y]=()=>{this[Uc](),this[gp]();const e=this[wc].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[x]=e=>{this[dp].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[wc].inputSensitivity}set inputSensitivity(e){this[wc].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:r}=this[zc];return{theta:e,phi:t,radius:r,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[Ep].isPresenting?this[Ep].arRenderer.target:this[mp].getTarget())}getFieldOfView(){return this[wc].getFieldOfView()}getMinimumFieldOfView(){return this[wc].options.minimumFieldOfView}getMaximumFieldOfView(){return this[wc].options.maximumFieldOfView}getIdealAspect(){return this[mp].idealAspect}jumpCameraToGoal(){this[Wc]=!0,this.requestUpdate(Wc,!1)}resetInteractionPrompt(){this[Vc]=0,this[kc]=1/0,this[Gc]=!1,this[Oc]=this.interactionPrompt===vc&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[pp].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[wc].addEventListener("user-interaction",this[Fc]),this[wc].addEventListener("pointer-change-start",this[Qc]),this[wc].addEventListener("pointer-change-end",this[Qc])}disconnectedCallback(){super.disconnectedCallback(),this[wc].removeEventListener("user-interaction",this[Fc]),this[wc].removeEventListener("pointer-change-start",this[Qc]),this[wc].removeEventListener("pointer-change-end",this[Qc])}updated(e){super.updated(e);const t=this[wc],r=this[mp];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===vc&&(this[Oc]=!0)):(t.disableInteraction(),this[Dc]()),this[pp].setAttribute("aria-label",this[sp])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===vc&&this.cameraControls&&!this[Gc]?this[Oc]=!0:this[Dc]()),e.has("interactionPromptStyle")&&(this[Rc].style.opacity=this.interactionPromptStyle==Ec?"1":"0"),e.has("touchAction")){const e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),r.setTargetDamperDecayTime(this.interpolationDecay)),!0===this[Wc]&&Promise.resolve().then((()=>{t.jumpToGoal(),r.jumpToGoal(),this[Nc](),this[Wc]=!1}))}async updateFraming(){const e=this[mp],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const r=e.adjustedFoV(e.framedFoVDeg),s=this[wc].getFieldOfView()/t;this[wc].setFieldOfView(r*s),this[Xc]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,r){const s=this[pp],o=this[Lc];if("1"===o[0].style.opacity)return void pc.warn("interact() failed because an existing interaction is running.");const l=new Array;l.push({x:timeline(t.x),y:timeline(t.y)});const c=[{x:l[0].x(0),y:l[0].y(0)}];null!=r&&(l.push({x:timeline(r.x),y:timeline(r.y)}),c.push({x:l[1].x(0),y:l[1].y(0)}));let h=performance.now();const{width:d,height:p}=this[mp],A=this.getBoundingClientRect(),dispatchTouches=e=>{for(const[t,r]of c.entries()){const{style:l}=o[t];l.transform=`translateX(${d*r.x}px) translateY(${p*r.y}px)`,"pointerdown"===e?l.opacity="1":"pointerup"===e&&(l.opacity="0");const c={pointerId:t-5678,pointerType:"touch",target:s,clientX:d*r.x+A.x,clientY:p*r.y+A.y,altKey:!0};s.dispatchEvent(new PointerEvent(e,c))}},moveTouches=()=>{const t=this[Hc];if(t!==ah.AUTOMATIC||!s.isConnected){for(const e of this[Lc])e.style.opacity="0";return dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",onVisibilityChange)}const r=Math.min(1,(performance.now()-h)/e);for(const[e,t]of c.entries())t.x=l[e].x(r),t.y=l[e].y(r);dispatchTouches("pointermove"),r<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:ah.AUTOMATIC}})),document.removeEventListener("visibilitychange",onVisibilityChange))},onVisibilityChange=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-h:h=performance.now()-e};document.addEventListener("visibilitychange",onVisibilityChange),dispatchTouches("pointerdown"),this[Hc]=ah.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=Bc,r=Rc,s=Lc,o=Tc,l=Vc,c=kc,h=Gc,d=Oc,p=Hc,A=wc,m=zc,g=Wc,f=qc,_=Xc,Yc)](e){const t=this[wc],r=this[mp];r.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=ah.NONE,t.setFieldOfView(r.adjustedFoV(r.framedFoVDeg)),this[Fc]()}[jc](e){const t=this[wc];if(this[Xc]){const{theta:t,phi:r}=this.getCameraOrbit();e[0]=t,e[1]=r,this[Xc]=!1}t.changeSource=ah.NONE,t.setOrbit(e[0],e[1],e[2]),this[Fc]()}[Jc](e){this[wc].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[$c](e){this[wc].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[Pc](e[2]),this.jumpCameraToGoal()}[Zc](e){this[wc].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[eh](e){const t=this[mp].adjustedFoV(180*e[0]/Math.PI);this[wc].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[Kc](e){const[t,r,s]=e;this[Ep].arRenderer.isPresenting||this[mp].setTarget(t,r,s),this[wc].changeSource=ah.NONE,this[Ep].arRenderer.updateTarget(),this[Fc]()}[fp](e,t){if(super[fp](e,t),this[Ep].isPresenting||!this[Sp]())return;const r=this[wc],s=this[mp],o=performance.now();if(this[Oc]&&this.loaded&&o>this[cp]+this.interactionPromptThreshold&&(this[Oc]=!1,this[kc]=o,this[Bc].classList.add("visible")),isFinite(this[kc])&&this.interactionPromptStyle===yc){const e=(o-this[kc])/5e3%1,t=Ac(e),l=mc(e);if(this[Rc].style.opacity=`${l}`,t!==this[Vc]){const e=t*s.width*.05,o=(t-this[Vc])*Math.PI/16;this[Rc].style.transform=`translateX(${e}px)`,r.changeSource=ah.AUTOMATIC,r.adjustOrbit(o,0,0),this[Vc]=t}}const l=r.update(e,t),c=s.updateTarget(t);(l||c)&&this[Nc]()}[Dc](){this[Oc]=!1,this[Bc].classList.remove("visible"),this[kc]=1/0}[Pc](e){const t=Math.max(this[mp].farRadius(),e),r=Math.abs(2*t);this[wc].updateNearFar(0,r)}[Uc](){const{theta:e,phi:t}=this[wc].getCameraSpherical(this[zc]),r=(4+Math.floor((e%Ic+bc)/Mc))%4,s=Math.floor(t/Cc),o=fc[r],l=_c[s];this[lp](`View from stage ${l}${o}`)}get[sp](){return super[sp].replace(/\.$/,"")+(this.cameraControls?". Use mouse, touch or arrow keys to move.":"")}async[vp](e){const t=this[wc],r=this[mp],s=r.adjustedFoV(r.framedFoVDeg);super[vp](e);const o=r.adjustedFoV(r.framedFoVDeg)/s,l=t.getFieldOfView()*(isFinite(o)?o:1);t.updateAspect(this[mp].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[wc].setFieldOfView(l),this.jumpCameraToGoal()}[_p](){super[_p](),this[qc]?this[Xc]=!0:this[qc]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}}return E=Fc,y=Nc,x=Qc,controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:Sc,observeEffects:!0,updateHandler:jc}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:Kc}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:Yc}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:Jc}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:$c}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:Zc}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:eh}),n({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxFieldOfView",void 0),controls_decorate([n({type:Number,attribute:"interaction-prompt-threshold"})],ControlsModelViewerElement.prototype,"interactionPromptThreshold",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt"})],ControlsModelViewerElement.prototype,"interactionPrompt",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt-style"})],ControlsModelViewerElement.prototype,"interactionPromptStyle",void 0),controls_decorate([n({type:Number,attribute:"orbit-sensitivity"})],ControlsModelViewerElement.prototype,"orbitSensitivity",void 0),controls_decorate([n({type:Number,attribute:"zoom-sensitivity"})],ControlsModelViewerElement.prototype,"zoomSensitivity",void 0),controls_decorate([n({type:Number,attribute:"pan-sensitivity"})],ControlsModelViewerElement.prototype,"panSensitivity",void 0),controls_decorate([n({type:String,attribute:"touch-action"})],ControlsModelViewerElement.prototype,"touchAction",void 0),controls_decorate([n({type:Boolean,attribute:"disable-zoom"})],ControlsModelViewerElement.prototype,"disableZoom",void 0),controls_decorate([n({type:Boolean,attribute:"disable-pan"})],ControlsModelViewerElement.prototype,"disablePan",void 0),controls_decorate([n({type:Boolean,attribute:"disable-tap"})],ControlsModelViewerElement.prototype,"disableTap",void 0),controls_decorate([n({type:Number,attribute:"interpolation-decay"})],ControlsModelViewerElement.prototype,"interpolationDecay",void 0),ControlsModelViewerElement})((e=>{var t,r,s,o,l,c,h,d,p,A;class ARModelViewerElement extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[r]=this.shadowRoot.querySelector(".ar-button"),this[s]=document.createElement("a"),this[o]=new Set,this[l]=AA,this[c]=!1,this[h]=e=>{e.preventDefault(),this.activateAR()},this[d]=({status:e})=>{e!==ch&&this[Ep].arRenderer.presentedScene!==this[mp]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===ch?this.removeAttribute("ar-tracking"):e===hh&&this.setAttribute("ar-tracking",ph))},this[p]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[A]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[EA]!==AA}connectedCallback(){super.connectedCallback(),this[Ep].arRenderer.addEventListener("status",this[CA]),this.setAttribute("ar-status",ch),this[Ep].arRenderer.addEventListener("tracking",this[bA]),this[xA].addEventListener("message",this[IA])}disconnectedCallback(){super.disconnectedCallback(),this[Ep].arRenderer.removeEventListener("status",this[CA]),this[Ep].arRenderer.removeEventListener("tracking",this[bA]),this[xA].removeEventListener("message",this[IA])}update(e){super.update(e),e.has("arScale")&&(this[mp].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[mp].updateShadow(),this[gp]()),e.has("arModes")&&(this[yA]=cA(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[wA]()}async activateAR(){switch(this[EA]){case uA:await this[_A]();break;case pA:await this[gA]();break;case dA:this[fA]();break;default:sA.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=vA,r=mA,s=xA,o=yA,l=EA,c=SA,h=MA,d=CA,p=bA,A=IA,wA)](){let e=AA;if(this.ar){if(null!=this.src)for(const t of this[yA]){if("webxr"===t&&ra&&!aA&&await this[Ep].arRenderer.supportsPresentation()){e=pA;break}if("scene-viewer"===t&&ca&&!oA){e=dA;break}if("quick-look"===t&&ua){e=uA;break}}e===AA&&null!=this.iosSrc&&ua&&(e=uA)}if(e!==AA)this[mA].classList.add("enabled"),this[mA].addEventListener("click",this[MA]);else if(this[mA].classList.contains("enabled")){this[mA].removeEventListener("click",this[MA]),this[mA].classList.remove("enabled");const e=dh;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[EA]=e}async[gA](){sA.log("Attempting to present in AR with WebXR..."),await this[TA]();try{this[mA].removeEventListener("click",this[MA]);const{arRenderer:e}=this[Ep];e.placeOnWall="wall"===this.arPlacement,await e.present(this[mp],this.xrEnvironment)}catch(e){sA.warn("Error while trying to present in AR with WebXR"),sA.error(e),await this[Ep].arRenderer.stopPresenting(),aA=!0,sA.warn("Falling back to next ar-mode"),await this[wA](),this.activateAR()}finally{this[wA]()}}async[TA](){this.loaded||(this[SA]=!0,this[hp](),await((e,t,r=null)=>new Promise((s=>{e.addEventListener(t,(function handler(o){r&&!r(o)||(s(o),e.removeEventListener(t,handler))}))})))(this,"load"),this[SA]=!1)}[Mp](){return super[Mp]()||this[SA]}[fA](){const e=self.location.toString(),t=new URL(e),r=new URL(this.src,e);r.hash&&(r.hash="");const s=new URLSearchParams(r.search);if(t.hash=lA,s.set("mode","ar_preferred"),s.has("disable_occlusion")||s.set("disable_occlusion","true"),"fixed"===this.arScale&&s.set("resizable","false"),"wall"===this.arPlacement&&s.set("enable_vertical_placement","true"),s.has("sound")){const t=new URL(s.get("sound"),e);s.set("sound",t.toString())}if(s.has("link")){const t=new URL(s.get("link"),e);s.set("link",t.toString())}const o=`intent://arvr.google.com/scene-viewer/1.0?${s.toString()+"&file="+encodeURIComponent(r.toString())}#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`;self.addEventListener("hashchange",(()=>{self.location.hash===lA&&(oA=!0,self.history.back(),sA.warn("Error while trying to present in AR with Scene Viewer"),sA.warn("Falling back to next ar-mode"),this[wA]())}),{once:!0}),this[xA].setAttribute("href",o),sA.log("Attempting to present in AR with Scene Viewer..."),this[xA].click()}async[_A](){const e=!this.iosSrc;this[mA].classList.remove("enabled");const t=e?await this.prepareUSDZ():this.iosSrc,r=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),s=new URL(this.src,t);s.hash&&(r.hash=s.hash)}"fixed"===this.arScale&&(r.hash&&(r.hash+="&"),r.hash+="allowsContentScaling=0");const s=this[xA];s.setAttribute("rel","ar");const o=document.createElement("img");s.appendChild(o),s.setAttribute("href",r.toString()),e&&s.setAttribute("download","model.usdz"),s.style.display="none",s.isConnected||this.shadowRoot.appendChild(s),sA.log("Attempting to present in AR with Quick Look..."),s.click(),s.removeChild(o),e&&URL.revokeObjectURL(t),this[mA].classList.add("enabled")}async prepareUSDZ(){const e=this[yp].beginActivity("usdz-conversion");await this[TA]();const{model:t,shadow:r}=this[mp];if(null==t)return"";let s=!1;null!=r&&(s=r.visible,r.visible=!1),e(.2);const o=new USDZExporter,l=await o.parse(t),c=new Blob([l],{type:"model/vnd.usdz+zip"}),h=URL.createObjectURL(c);return e(1),null!=r&&(r.visible=s),h}}return ar_decorate([n({type:Boolean,attribute:"ar"})],ARModelViewerElement.prototype,"ar",void 0),ar_decorate([n({type:String,attribute:"ar-scale"})],ARModelViewerElement.prototype,"arScale",void 0),ar_decorate([n({type:String,attribute:"ar-placement"})],ARModelViewerElement.prototype,"arPlacement",void 0),ar_decorate([n({type:String,attribute:"ar-modes"})],ARModelViewerElement.prototype,"arModes",void 0),ar_decorate([n({type:String,attribute:"ios-src"})],ARModelViewerElement.prototype,"iosSrc",void 0),ar_decorate([n({type:Boolean,attribute:"xr-environment"})],ARModelViewerElement.prototype,"xrEnvironment",void 0),ARModelViewerElement})((e=>{var t,r,s,o,l,c,h,d;class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=BA,this.loading=RA,this[t]=!1,this[r]=!1,this[s]=this.shadowRoot.querySelector(".slot.poster"),this[o]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[c]=this[PA].getAttribute("aria-label"),this[h]=((e,t)=>{let r=null;const throttled=(...s)=>{null==r&&(e(...s),r=self.setTimeout((()=>r=null),t))};return throttled.flush=()=>{null!=r&&(self.clearTimeout(r),r=null)},throttled})((e=>{const t=this[DA].parentNode;requestAnimationFrame((()=>{this[DA].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[DA]),t.appendChild(this[DA])),this[DA].classList.toggle("hide",1===e)}))}),100),this[d]=e=>{const t=e.detail.totalProgress;1===t&&(this[OA].flush(),this.loaded&&(this[FA]||this.reveal===BA)&&this[NA]()),this[OA](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t}}))};const p=self.ModelViewerElement||{},A=p.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(A);const m=p.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(m),p.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(p.meshoptDecoderLocation);const g=p.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=g}static set dracoDecoderLocation(e){CachingGLTFLoader.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return CachingGLTFLoader.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){CachingGLTFLoader.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return CachingGLTFLoader.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){CachingGLTFLoader.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return CachingGLTFLoader.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){Renderer.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return Renderer.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){Renderer.singleton.loader[Oo].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[NA]():(this[FA]=!0,this[hp]())}showPoster(){const e=this[UA];if(e.classList.contains("show"))return;e.classList.add("show"),this[pp].classList.remove("show");const t=this[PA];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const r=this.modelIsVisible;this[QA]=!1,this[rp](r)}getDimensions(){return toVector3D(this[mp].size)}getBoundingBoxCenter(){return toVector3D(this[mp].boundingBox.getCenter(new three_module_Vector3))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[yp].addEventListener("progress",this[kA])}disconnectedCallback(){super.disconnectedCallback(),this[yp].removeEventListener("progress",this[kA])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[PA].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[PA].setAttribute("aria-label",this[ap]),(e.has("reveal")||e.has("loading"))&&this[hp]()}[(t=QA,r=FA,s=UA,o=PA,l=DA,c=GA,h=OA,d=kA,Mp)](){return!!this.src&&(this[FA]||this.loading===LA||this.reveal===BA&&this[np])}[NA](){this[FA]=!1;const e=this[UA];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[pp].classList.add("show");const t=this.modelIsVisible;this[QA]=!0,this[rp](t);const r=this.getRootNode();r&&r.activeElement===this&&this[pp].focus();const s=this[PA];s.setAttribute("aria-hidden","true"),s.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[Sp](){return super[Sp]()&&this[QA]}}return loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"poster",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"reveal",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"loading",void 0),LoadingModelViewerElement})((e=>{var t;class AnimationModelViewerElement extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[mp].subscribeMixerEvent("loop",(e=>{const t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))})),this[mp].subscribeMixerEvent("finished",(()=>{this[bp]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[mp].animationNames:[]}get duration(){return this[mp].duration}get paused(){return this[bp]}get currentTime(){return this[mp].animationTime}set currentTime(e){this[mp].animationTime=e,this[gp]()}get timeScale(){return this[mp].animationTimeScale}set timeScale(e){this[mp].animationTimeScale=e}pause(){this[bp]||(this[bp]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[bp]=!1,this[Cp](e),this.dispatchEvent(new CustomEvent("play")))}[(t=bp,_p)](){super[_p](),this[bp]=!0,null!=this.animationName&&this[Cp](),this.autoplay&&this.play()}[fp](e,t){super[fp](e,t),this[bp]||!this[Sp]()&&!this[Ep].isPresenting||(this[mp].updateAnimation(t/1e3),this[gp]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[Cp]()}[Cp](e=Ip){var t;const r=null!==(t=e.repetitions)&&void 0!==t?t:1/0,s=e.pingpong?ze:1===r?2200:He;this[mp].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,s,r),this[bp]&&(this[mp].updateAnimation(0),this[gp]())}}return animation_decorate([n({type:Boolean})],AnimationModelViewerElement.prototype,"autoplay",void 0),animation_decorate([n({type:String,attribute:"animation-name"})],AnimationModelViewerElement.prototype,"animationName",void 0),animation_decorate([n({type:Number,attribute:"animation-crossfade-duration"})],AnimationModelViewerElement.prototype,"animationCrossfadeDuration",void 0),AnimationModelViewerElement})(ModelViewerElementBase))))))));customElements.define("model-viewer",jA)}}]);
|