import{aB as ve,y as Ie,a1 as Ne,a2 as pe,a3 as I,a4 as X,ab as R,ak as Ce,ai as Oe,al as Pe,d as G,ac as N,aC as D,h as fe,aD as Fe,a5 as De,aE as ke,aF as Ue,f as z,aG as me,aH as ge,a6 as J,aI as He,aJ as q,b as Ge,aK as te,D as Be,af as je,g as Te,am as Ke,M as Ve,aL as Xe,K as ze,aM as qe,aN as We,G as W,ah as Ye,aj as Qe,ag as Je,aO as Ae,as as $e,ae as ye,O as Ze,a as _e,an as et,aP as Ee,aw as tt,ax as ne,ay as st,az as nt,aQ as ot,aR as rt,aS as it,aT as at,a7 as ct,aU as lt,aV as ut,F as ht,aW as dt,a8 as oe,aX as pt,at as ft,au as re,av as mt,V,aY as gt,B as Tt,S as At,Q as yt}from"./model.vue.8f6f7b03.js";import"./entry.a42f0781.js";class _t extends pe{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new xt(t)}),this.register(function(t){return new Nt(t)}),this.register(function(t){return new Ct(t)}),this.register(function(t){return new St(t)}),this.register(function(t){return new bt(t)}),this.register(function(t){return new wt(t)}),this.register(function(t){return new vt(t)}),this.register(function(t){return new Lt(t)}),this.register(function(t){return new It(t)}),this.register(function(t){return new Rt(t)}),this.register(function(t){return new Ot(t)})}load(e,t,r,s){const o=this;let n;this.resourcePath!==""?n=this.resourcePath:this.path!==""?n=this.path:n=I.extractUrlBase(e),this.manager.itemStart(e);const a=function(c){s?s(c):console.error(c),o.manager.itemError(e),o.manager.itemEnd(e)},i=new X(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,function(c){try{o.parse(c,n,function(u){t(u),o.manager.itemEnd(e)},a)}catch(u){a(u)}},r,a)}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 this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){let o;const n={},a={};if(typeof e=="string")o=e;else if(I.decodeText(new Uint8Array(e,0,4))===Re){try{n[A.KHR_BINARY_GLTF]=new Pt(e)}catch(l){s&&s(l);return}o=n[A.KHR_BINARY_GLTF].content}else o=I.decodeText(new Uint8Array(e));const i=JSON.parse(o);if(i.asset===void 0||i.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new qt(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(n),c.setPlugins(a),c.parse(r,s)}parseAsync(e,t){const r=this;return new Promise(function(s,o){r.parse(e,t,s,o)})}}function Et(){let h={};return{get:function(e){return h[e]},add:function(e,t){h[e]=t},remove:function(e){delete h[e]},removeAll:function(){h={}}}}const A={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_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",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_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class Rt{constructor(e){this.parser=e,this.name=A.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=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,n)}}class Ct{constructor(e){this.parser=e,this.name=A.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 n=o.extensions[t],a=s.images[n.source];let i=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(i=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,n.source,i);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(t.height===1)}})),this.isSupported}}class Ot{constructor(e){this.name=A.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 s=r.extensions[this.name],o=this.parser.getDependency("buffer",s.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.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 Promise.all([o,n.ready]).then(function(a){const i=s.byteOffset||0,c=s.byteLength||0,u=s.count,l=s.byteStride,d=new ArrayBuffer(u*l),p=new Uint8Array(a[0],i,c);return n.decodeGltfBuffer(new Uint8Array(d),u,l,p,s.mode,s.filter),d})}else return null}}const Re="glTF",U=12,ie={JSON:1313821514,BIN:5130562};class Pt{constructor(e){this.name=A.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,U);if(this.header={magic:I.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Re)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-U,s=new DataView(e,U);let o=0;for(;o",t).replace("#include ",r).replace("#include ",s).replace("#include ",o).replace("#include ",n)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(i){a.specular.value=i}},specularMap:{get:function(){return a.specularMap.value},set:function(i){a.specularMap.value=i,i?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return a.glossiness.value},set:function(i){a.glossiness.value=i}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(i){a.glossinessMap.value=i,i?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class kt{constructor(){this.name=A.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity"]}getMaterialType(){return $}extendParams(e,t,r){const s=t.extensions[this.name];e.color=new R(1,1,1),e.opacity=1;const o=[];if(Array.isArray(s.diffuseFactor)){const n=s.diffuseFactor;e.color.fromArray(n),e.opacity=n[3]}if(s.diffuseTexture!==void 0&&o.push(r.assignTexture(e,"map",s.diffuseTexture,N)),e.emissive=new R(0,0,0),e.glossiness=s.glossinessFactor!==void 0?s.glossinessFactor:1,e.specular=new R(1,1,1),Array.isArray(s.specularFactor)&&e.specular.fromArray(s.specularFactor),s.specularGlossinessTexture!==void 0){const n=s.specularGlossinessTexture;o.push(r.assignTexture(e,"glossinessMap",n)),o.push(r.assignTexture(e,"specularMap",n,N))}return Promise.all(o)}createMaterial(e){const t=new $(e);return t.fog=!0,t.color=e.color,t.map=e.map===void 0?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=e.aoMap===void 0?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=e.emissiveIntensity===void 0?1:e.emissiveIntensity,t.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,t.bumpMap=e.bumpMap===void 0?null:e.bumpMap,t.bumpScale=1,t.normalMap=e.normalMap===void 0?null:e.normalMap,t.normalMapType=Fe,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=e.specularMap===void 0?null:e.specularMap,t.specular=e.specular,t.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=e.envMap===void 0?null:e.envMap,t.envMapIntensity=1,t}}class Ut{constructor(){this.name=A.KHR_MESH_QUANTIZATION}}class C extends gt{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 n=0;n!==s;n++)t[n]=r[o+n];return t}}C.prototype.beforeStart_=C.prototype.copySampleValue_;C.prototype.afterEnd_=C.prototype.copySampleValue_;C.prototype.interpolate_=function(h,e,t,r){const s=this.resultBuffer,o=this.sampleValues,n=this.valueSize,a=n*2,i=n*3,c=r-e,u=(t-e)/c,l=u*u,d=l*u,p=h*i,m=p-i,T=-2*d+3*l,f=d-l,g=1-T,_=f-l+u;for(let y=0;y!==n;y++){const k=o[m+y+n],w=o[m+y+a]*c,M=o[p+y+n],E=o[p+y]*c;s[y]=g*k+_*w+T*M+f*E}return s};const Ht=new yt;class Gt extends C{interpolate_(e,t,r,s){const o=super.interpolate_(e,t,r,s);return Ht.fromArray(o).normalize().toArray(o),o}}const x={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},B={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ae={9728:ot,9729:me,9984:rt,9985:it,9986:at,9987:ge},ce={33071:ct,33648:lt,10497:J},le={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Z={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},b={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Bt={CUBICSPLINE:void 0,LINEAR:Ae,STEP:ut},Y={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function jt(h){return h.DefaultMaterial===void 0&&(h.DefaultMaterial=new te({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ht})),h.DefaultMaterial}function H(h,e,t){for(const r in t.extensions)h[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=t.extensions[r])}function v(h,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(h.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Kt(h,e,t){let r=!1,s=!1,o=!1;for(let c=0,u=e.length;c0||h.search(/^data\:image\/jpeg/)===0?"image/jpeg":h.search(/\.webp($|\?)/i)>0||h.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}class qt{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Et,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};const r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,o=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1;typeof createImageBitmap>"u"||r||s&&o<98?this.textureLoader=new De(this.options.manager):this.textureLoader=new ke(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new X(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&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._invokeAll(function(n){return n._markDefs&&n._markDefs()}),Promise.all(this._invokeAll(function(n){return n.beforeRoot&&n.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(n){const a={scene:n[0][s.scene||0],scenes:n[0],animations:n[1],cameras:n[2],asset:s.asset,parser:r,userData:{}};H(o,a,s),v(a,s),Promise.all(r._invokeAll(function(i){return i.afterRoot&&i.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let s=0,o=t.length;s{const i=this.associations.get(n);i!=null&&this.associations.set(a,i);for(const[c,u]of n.children.entries())o(u,a.children[c])};return o(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=2&&f.setY(P,M[E*i+1]),i>=3&&f.setZ(P,M[E*i+2]),i>=4&&f.setW(P,M[E*i+3]),i>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f})}loadTexture(e){const t=this.json,r=this.options,o=t.textures[e].source,n=t.images[o];let a=this.textureLoader;if(n.uri){const i=r.manager.getHandler(n.uri);i!==null&&(a=i)}return this.loadTextureImage(e,o,a)}loadTextureImage(e,t,r){const s=this,o=this.json,n=o.textures[e],a=o.images[t],i=(a.uri||a.bufferView)+":"+n.sampler;if(this.textureCache[i])return this.textureCache[i];const c=this.loadImageSource(t,r).then(function(u){u.flipY=!1,n.name&&(u.name=n.name);const d=(o.samplers||{})[n.sampler]||{};return u.magFilter=ae[d.magFilter]||me,u.minFilter=ae[d.minFilter]||ge,u.wrapS=ce[d.wrapS]||J,u.wrapT=ce[d.wrapT]||J,s.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[i]=c,c}loadImageSource(e,t){const r=this,s=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(l=>l.clone());const n=s.images[e],a=self.URL||self.webkitURL;let i=n.uri||"",c=!1;if(n.bufferView!==void 0)i=r.getDependency("bufferView",n.bufferView).then(function(l){c=!0;const d=new Blob([l],{type:n.mimeType});return i=a.createObjectURL(d),i});else if(n.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(i).then(function(l){return new Promise(function(d,p){let m=d;t.isImageBitmapLoader===!0&&(m=function(T){const f=new oe(T);f.needsUpdate=!0,d(f)}),t.load(I.resolveURL(l,o.path),m,void 0,p)})}).then(function(l){return c===!0&&a.revokeObjectURL(i),l.userData.mimeType=n.mimeType||zt(n.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",i),l});return this.sourceCache[e]=u,u}assignTexture(e,t,r,s){const o=this;return this.getDependency("texture",r.index).then(function(n){if(r.texCoord!==void 0&&r.texCoord!=0&&!(t==="aoMap"&&r.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),o.extensions[A.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[A.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const i=o.associations.get(n);n=o.extensions[A.KHR_TEXTURE_TRANSFORM].extendTexture(n,a),o.associations.set(n,i)}}return s!==void 0&&(n.encoding=s),e[t]=n,n})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const s=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,n=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let i=this.cache.get(a);i||(i=new He,q.prototype.copy.call(i,r),i.color.copy(r.color),i.map=r.map,i.sizeAttenuation=!1,this.cache.add(a,i)),r=i}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let i=this.cache.get(a);i||(i=new Ge,q.prototype.copy.call(i,r),i.color.copy(r.color),this.cache.add(a,i)),r=i}if(s||o||n){let a="ClonedMaterial:"+r.uuid+":";r.isGLTFSpecularGlossinessMaterial&&(a+="specular-glossiness:"),s&&(a+="derivative-tangents:"),o&&(a+="vertex-colors:"),n&&(a+="flat-shading:");let i=this.cache.get(a);i||(i=r.clone(),o&&(i.vertexColors=!0),n&&(i.flatShading=!0),s&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),this.cache.add(a,i),this.associations.set(i,this.associations.get(r))),r=i}r.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=r}getMaterialType(){return te}loadMaterial(e){const t=this,r=this.json,s=this.extensions,o=r.materials[e];let n;const a={},i=o.extensions||{},c=[];if(i[A.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const l=s[A.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];n=l.getMaterialType(),c.push(l.extendParams(a,o,t))}else if(i[A.KHR_MATERIALS_UNLIT]){const l=s[A.KHR_MATERIALS_UNLIT];n=l.getMaterialType(),c.push(l.extendParams(a,o,t))}else{const l=o.pbrMetallicRoughness||{};if(a.color=new R(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const d=l.baseColorFactor;a.color.fromArray(d),a.opacity=d[3]}l.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",l.baseColorTexture,N)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),n=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}o.doubleSided===!0&&(a.side=Be);const u=o.alphaMode||Y.OPAQUE;if(u===Y.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===Y.MASK&&(a.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&n!==G&&(c.push(t.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new fe(1,1),o.normalTexture.scale!==void 0)){const l=o.normalTexture.scale;a.normalScale.set(l,l)}return o.occlusionTexture!==void 0&&n!==G&&(c.push(t.assignTexture(a,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&n!==G&&(a.emissive=new R().fromArray(o.emissiveFactor)),o.emissiveTexture!==void 0&&n!==G&&c.push(t.assignTexture(a,"emissiveMap",o.emissiveTexture,N)),Promise.all(c).then(function(){let l;return n===$?l=s[A.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):l=new n(a),o.name&&(l.name=o.name),v(l,o),t.associations.set(l,{materials:e}),o.extensions&&H(s,l,o),l})}createUniqueName(e){const t=je.sanitizeNodeName(e||"");let r=t;for(let s=1;this.nodeNamesUsed[r];++s)r=t+"_"+s;return this.nodeNamesUsed[r]=!0,r}loadGeometries(e){const t=this,r=this.extensions,s=this.primitiveCache;function o(a){return r[A.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(i){return he(i,a,t)})}const n=[];for(let a=0,i=e.length;a0&&Vt(g,o),g.name=t.createUniqueName(o.name||"mesh_"+e),v(g,o),f.extensions&&H(s,g,f),t.assignFinalMaterial(g),l.push(g)}for(let p=0,m=l.length;p1?i=new W:a.length===1?i=a[0]:i=new Ze,i!==a[0])for(let c=0,u=a.length;c{const l=new Map;for(const[d,p]of o.associations)(d instanceof q||d instanceof oe)&&l.set(d,p);return u.traverse(d=>{const p=o.associations.get(d);p!=null&&l.set(d,p)}),l};return o.associations=c(n),n})}}function Me(h,e,t,r){const s=t.nodes[h];return r.getDependency("node",h).then(function(o){if(s.skin===void 0)return o;let n;return r.getDependency("skin",s.skin).then(function(a){n=a;const i=[];for(let c=0,u=n.joints.length;c{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(n,a).then(t).catch(s)},r,s)}decodeDracoFile(e,t,r,s){const o={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,o).then(t)}decodeGeometry(e,t){for(const i in t.attributeTypes){const c=t.attributeTypes[i];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[i]=c.name)}const r=JSON.stringify(t);if(Q.has(e)){const i=Q.get(e);if(i.key===r)return i.promise;if(e.byteLength===0)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++,n=e.byteLength,a=this._getWorker(o,n).then(i=>(s=i,new Promise((c,u)=>{s._callbacks[o]={resolve:c,reject:u},s.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))).then(i=>this._createGeometry(i.geometry));return a.catch(()=>!0).then(()=>{s&&o&&this._releaseTask(s,o)}),Q.set(e,{key:r,promise:a}),a}_createGeometry(e){const t=new Te;e.index&&t.setIndex(new z(e.index.array,1));for(let r=0;r{r.load(e,s,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",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(r=>{const s=r[0];e||(this.decoderConfig.wasmBinary=r[1]);const o=Qt.toString(),n=["/* draco decoder */",s,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(` `);this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengtho._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(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const l=u.draco,d=new l.Decoder,p=new l.DecoderBuffer;p.Init(new Int8Array(i),i.byteLength);try{const m=t(l,d,p,c),T=m.attributes.map(f=>f.array.buffer);m.index&&T.push(m.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:m},T)}catch(m){console.error(m),self.postMessage({type:"error",id:a.id,error:m.message})}finally{l.destroy(p),l.destroy(d)}});break}};function t(n,a,i,c){const u=c.attributeIDs,l=c.attributeTypes;let d,p;const m=a.GetEncodedGeometryType(i);if(m===n.TRIANGULAR_MESH)d=new n.Mesh,p=a.DecodeBufferToMesh(i,d);else if(m===n.POINT_CLOUD)d=new n.PointCloud,p=a.DecodeBufferToPointCloud(i,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const T={index:null,attributes:[]};for(const f in u){const g=self[l[f]];let _,y;if(c.useUniqueIDs)y=u[f],_=a.GetAttributeByUniqueId(d,y);else{if(y=a.GetAttributeId(d,n[u[f]]),y===-1)continue;_=a.GetAttribute(d,y)}T.attributes.push(s(n,a,d,f,g,_))}return m===n.TRIANGULAR_MESH&&(T.index=r(n,a,d)),n.destroy(d),T}function r(n,a,i){const u=i.num_faces()*3,l=u*4,d=n._malloc(l);a.GetTrianglesUInt32Array(i,l,d);const p=new Uint32Array(n.HEAPF32.buffer,d,u).slice();return n._free(d),{array:p,itemSize:1}}function s(n,a,i,c,u,l){const d=l.num_components(),m=i.num_points()*d,T=m*u.BYTES_PER_ELEMENT,f=o(n,u),g=n._malloc(T);a.GetAttributeDataArrayForAllPoints(i,l,f,T,g);const _=new u(n.HEAPF32.buffer,g,m).slice();return n._free(g),{name:c,array:_,itemSize:d}}function o(n,a){switch(a){case Float32Array:return n.DT_FLOAT32;case Int8Array:return n.DT_INT8;case Int16Array:return n.DT_INT16;case Int32Array:return n.DT_INT32;case Uint8Array:return n.DT_UINT8;case Uint16Array:return n.DT_UINT16;case Uint32Array:return n.DT_UINT32}}}const Jt=new Map,Le=new _t,xe=new Yt;xe.setDecoderPath(ve.wasmPath);Le.setDRACOLoader(xe);var es=async(h,e)=>{const[t,r]=await Ie(Jt,h,()=>new Promise((s,o)=>{tt(),Le.load(h,n=>{ne();let a=!0;for(const i of n.scenes)i.traverse(c=>{var u;a&&c instanceof ye&&(a=!1),!((u=c.material)===null||u===void 0)&&u.map&&(c.material.map.encoding=st)});s([n,a])},nt,()=>{ne(),o()})}));return e?Ne(t.scene,r,t.animations):t.scene};export{es as default};