!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).THREE_ADDONS={},e.THREE)}(this,(function(e,t){"use strict";function s(e,s){if(s===t.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(s===t.TriangleFanDrawMode||s===t.TriangleStripDrawMode){let r=e.getIndex();if(null===r){const t=[],s=e.getAttribute("position");if(void 0===s)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported.")));const u=new Q(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===c[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}u.setExtensions(i),u.setPlugins(c),u.parse(s,r)}parseAsync(e,t){const s=this;return new Promise((function(r,n){s.parse(e,t,r,n)}))}}function n(){let e={};return{get:function(t){return e[t]},add:function(t,s){e[t]=s},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const o={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_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_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class i{constructor(e){this.parser=e,this.name=o.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,r=t.length;s=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,n.source,o)}}class g{constructor(e){this.parser=e,this.name=o.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,r=s.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;const o=n.extensions[t],i=r.images[o.source];let a=s.textureLoader;if(i.uri){const e=s.options.manager.getHandler(i.uri);null!==e&&(a=e)}return this.detectSupport().then((function(n){if(n)return s.loadTextureImage(e,o.source,a);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.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 T{constructor(e){this.parser=e,this.name=o.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,r=s.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;const o=n.extensions[t],i=r.images[o.source];let a=s.textureLoader;if(i.uri){const e=s.options.manager.getHandler(i.uri);null!==e&&(a=e)}return this.detectSupport().then((function(n){if(n)return s.loadTextureImage(e,o.source,a);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.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 x{constructor(e){this.name=o.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const e=s.extensions[this.name],r=this.parser.getDependency("buffer",e.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 r.then((function(t){const s=e.byteOffset||0,r=e.byteLength||0,o=e.count,i=e.byteStride,a=new Uint8Array(t,s,r);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(o,i,a,e.mode,e.filter).then((function(e){return e.buffer})):n.ready.then((function(){const t=new ArrayBuffer(o*i);return n.decodeGltfBuffer(new Uint8Array(t),o,i,a,e.mode,e.filter),t}))}))}return null}}class R{constructor(e){this.name=o.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const s=this.parser.json,r=s.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;const n=s.meshes[r.mesh];for(const e of n.primitives)if(e.mode!==C.TRIANGLES&&e.mode!==C.TRIANGLE_STRIP&&e.mode!==C.TRIANGLE_FAN&&void 0!==e.mode)return null;const o=r.extensions[this.name].attributes,i=[],a={};for(const e in o)i.push(this.parser.getDependency("accessor",o[e]).then((t=>(a[e]=t,a[e]))));return i.length<1?null:(i.push(this.parser.createNodeMesh(e)),Promise.all(i).then((e=>{const s=e.pop(),r=s.isGroup?s.children:[s],n=e[0].count,o=[];for(const e of r){const s=new t.Matrix4,r=new t.Vector3,i=new t.Quaternion,c=new t.Vector3(1,1,1),l=new t.InstancedMesh(e.geometry,e.material,n);for(let e=0;e-1,i=o?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||o&&i<98?this.textureLoader=new t.TextureLoader(this.options.manager):this.textureLoader=new t.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new t.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 s=this,r=this.json,n=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([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])})).then((function(t){const o={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:s,userData:{}};j(n,o,r),K(o,r),Promise.all(s._invokeAll((function(e){return e.afterRoot&&e.afterRoot(o)}))).then((function(){e(o)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let s=0,r=t.length;s{const s=this.associations.get(e);null!=s&&this.associations.set(t,s);for(const[s,r]of e.children.entries())n(r,t.children[s])};return n(s,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s=2&&m.setY(t,h[e*i+1]),i>=3&&m.setZ(t,h[e*i+2]),i>=4&&m.setW(t,h[e*i+3]),i>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m}))}loadTexture(e){const t=this.json,s=this.options,r=t.textures[e].source,n=t.images[r];let o=this.textureLoader;if(n.uri){const e=s.manager.getHandler(n.uri);null!==e&&(o=e)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,s,r){const n=this,o=this.json,i=o.textures[e],a=o.images[s],c=(a.uri||a.bufferView)+":"+i.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(s,r).then((function(s){s.flipY=!1,s.name=i.name||a.name||"",""===s.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(s.name=a.uri);const r=(o.samplers||{})[i.sampler]||{};return s.magFilter=N[r.magFilter]||t.LinearFilter,s.minFilter=N[r.minFilter]||t.LinearMipmapLinearFilter,s.wrapS=O[r.wrapS]||t.RepeatWrapping,s.wrapT=O[r.wrapT]||t.RepeatWrapping,n.associations.set(s,{textures:e}),s})).catch((function(){return null}));return this.textureCache[c]=l,l}loadImageSource(e,s){const r=this,n=this.json,o=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const i=n.images[e],a=self.URL||self.webkitURL;let c=i.uri||"",l=!1;if(void 0!==i.bufferView)c=r.getDependency("bufferView",i.bufferView).then((function(e){l=!0;const t=new Blob([e],{type:i.mimeType});return c=a.createObjectURL(t),c}));else if(void 0===i.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(c).then((function(e){return new Promise((function(r,n){let i=r;!0===s.isImageBitmapLoader&&(i=function(e){const s=new t.Texture(e);s.needsUpdate=!0,r(s)}),s.load(t.LoaderUtils.resolveURL(e,o.path),i,void 0,n)}))})).then((function(e){var t;return!0===l&&a.revokeObjectURL(c),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),e}));return this.sourceCache[e]=u,u}assignTexture(e,t,s,r){const n=this;return this.getDependency("texture",s.index).then((function(i){if(!i)return null;if(void 0!==s.texCoord&&s.texCoord>0&&((i=i.clone()).channel=s.texCoord),n.extensions[o.KHR_TEXTURE_TRANSFORM]){const e=void 0!==s.extensions?s.extensions[o.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=n.associations.get(i);i=n.extensions[o.KHR_TEXTURE_TRANSFORM].extendTexture(i,e),n.associations.set(i,t)}}return void 0!==r&&(i.colorSpace=r),e[t]=i,i}))}assignFinalMaterial(e){const s=e.geometry;let r=e.material;const n=void 0===s.attributes.tangent,o=void 0!==s.attributes.color,i=void 0===s.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+r.uuid;let s=this.cache.get(e);s||(s=new t.PointsMaterial,t.Material.prototype.copy.call(s,r),s.color.copy(r.color),s.map=r.map,s.sizeAttenuation=!1,this.cache.add(e,s)),r=s}else if(e.isLine){const e="LineBasicMaterial:"+r.uuid;let s=this.cache.get(e);s||(s=new t.LineBasicMaterial,t.Material.prototype.copy.call(s,r),s.color.copy(r.color),s.map=r.map,this.cache.add(e,s)),r=s}if(n||o||i){let e="ClonedMaterial:"+r.uuid+":";n&&(e+="derivative-tangents:"),o&&(e+="vertex-colors:"),i&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),o&&(t.vertexColors=!0),i&&(t.flatShading=!0),n&&(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 t.MeshStandardMaterial}loadMaterial(e){const s=this,r=this.json,n=this.extensions,i=r.materials[e];let a;const c={},l=[];if((i.extensions||{})[o.KHR_MATERIALS_UNLIT]){const e=n[o.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),l.push(e.extendParams(c,i,s))}else{const r=i.pbrMetallicRoughness||{};if(c.color=new t.Color(1,1,1),c.opacity=1,Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;c.color.fromArray(e),c.opacity=e[3]}void 0!==r.baseColorTexture&&l.push(s.assignTexture(c,"map",r.baseColorTexture,t.SRGBColorSpace)),c.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,c.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(l.push(s.assignTexture(c,"metalnessMap",r.metallicRoughnessTexture)),l.push(s.assignTexture(c,"roughnessMap",r.metallicRoughnessTexture))),a=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),l.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,c)}))))}!0===i.doubleSided&&(c.side=t.DoubleSide);const u=i.alphaMode||U;if(u===G?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,u===B&&(c.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&a!==t.MeshBasicMaterial&&(l.push(s.assignTexture(c,"normalMap",i.normalTexture)),c.normalScale=new t.Vector2(1,1),void 0!==i.normalTexture.scale)){const e=i.normalTexture.scale;c.normalScale.set(e,e)}return void 0!==i.occlusionTexture&&a!==t.MeshBasicMaterial&&(l.push(s.assignTexture(c,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(c.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&a!==t.MeshBasicMaterial&&(c.emissive=(new t.Color).fromArray(i.emissiveFactor)),void 0!==i.emissiveTexture&&a!==t.MeshBasicMaterial&&l.push(s.assignTexture(c,"emissiveMap",i.emissiveTexture,t.SRGBColorSpace)),Promise.all(l).then((function(){const t=new a(c);return i.name&&(t.name=i.name),K(t,i),s.associations.set(t,{materials:e}),i.extensions&&j(n,t,i),t}))}createUniqueName(e){const s=t.PropertyBinding.sanitizeNodeName(e||"");let r=s;for(let e=1;this.nodeNamesUsed[r];++e)r=s+"_"+e;return this.nodeNamesUsed[r]=!0,r}loadGeometries(e){const s=this,r=this.extensions,n=this.primitiveCache;function i(e){return r[o.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,s).then((function(t){return Y(t,e,s)}))}const a=[];for(let r=0,c=e.length;r0&&V(p,i),p.name=r.createUniqueName(i.name||"mesh_"+e),K(p,i),d.extensions&&j(o,p,d),r.assignFinalMaterial(p),u.push(p)}for(let t=0,s=u.length;t1?new t.Group:1===s.length?s[0]:new t.Object3D,a!==s[0])for(let e=0,t=s.length;e{const s=new Map;for(const[e,r]of n.associations)(e instanceof t.Material||e instanceof t.Texture)&&s.set(e,r);return e.traverse((e=>{const t=n.associations.get(e);null!=t&&s.set(e,t)})),s})(o),o}))}}function Y(e,s,r){const n=s.attributes,o=[];function i(t,s){return r.getDependency("accessor",t).then((function(t){e.setAttribute(s,t)}))}for(const t in n){const s=D[t]||t.toLowerCase();s in e.attributes||o.push(i(n[t],s))}if(void 0!==s.indices&&!e.index){const t=r.getDependency("accessor",s.indices).then((function(t){e.setIndex(t)}));o.push(t)}return K(e,s),function(e,s,r){const n=s.attributes,o=new t.Box3;if(void 0===n.POSITION)return;{const e=r.json.accessors[n.POSITION],s=e.min,i=e.max;if(void 0===s||void 0===i)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(o.set(new t.Vector3(s[0],s[1],s[2]),new t.Vector3(i[0],i[1],i[2])),e.normalized){const t=q(P[e.componentType]);o.min.multiplyScalar(t),o.max.multiplyScalar(t)}}const i=s.targets;if(void 0!==i){const e=new t.Vector3,s=new t.Vector3;for(let t=0,n=i.length;t{this.parse(e,s,n)}),r,n)}parse(e,s,r){this.decodeDracoFile(e,s,null,null,t.SRGBColorSpace).catch(r)}decodeDracoFile(e,s,r,n,o=t.LinearSRGBColorSpace){const i={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:o};return this.decodeGeometry(e,i).then(s)}decodeGeometry(e,t){const s=JSON.stringify(t);if(Z.has(e)){const t=Z.get(e);if(t.key===s)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 r;const n=this.workerNextTaskID++,o=e.byteLength,i=this._getWorker(n,o).then((s=>(r=s,new Promise(((s,o)=>{r._callbacks[n]={resolve:s,reject:o},r.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return i.catch((()=>!0)).then((()=>{r&&n&&this._releaseTask(r,n)})),Z.set(e,{key:s,promise:i}),i}_createGeometry(e){const s=new t.BufferGeometry;e.index&&s.setIndex(new t.BufferAttribute(e.index.array,1));for(let r=0;r{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 s=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const r=$.toString(),n=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.lengtht._taskLoad?-1:1}));const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s}))}_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 t=e.draco,i=new t.Decoder;try{const e=function(e,t,r,n){const o=n.attributeIDs,i=n.attributeTypes;let a,c;const l=t.GetEncodedGeometryType(r);if(l===e.TRIANGULAR_MESH)a=new e.Mesh,c=t.DecodeArrayToMesh(r,r.byteLength,a);else{if(l!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,c=t.DecodeArrayToPointCloud(r,r.byteLength,a)}if(!c.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+c.error_msg());const u={index:null,attributes:[]};for(const r in o){const c=self[i[r]];let l,h;if(n.useUniqueIDs)h=o[r],l=t.GetAttributeByUniqueId(a,h);else{if(h=t.GetAttributeId(a,e[o[r]]),-1===h)continue;l=t.GetAttribute(a,h)}const d=s(e,t,a,r,c,l);"color"===r&&(d.vertexColorSpace=n.vertexColorSpace),u.attributes.push(d)}l===e.TRIANGULAR_MESH&&(u.index=function(e,t,s){const r=s.num_faces(),n=3*r,o=4*n,i=e._malloc(o);t.GetTrianglesUInt32Array(s,o,i);const a=new Uint32Array(e.HEAPF32.buffer,i,n).slice();return e._free(i),{array:a,itemSize:1}}(e,t,a));return e.destroy(a),u}(t,i,new Int8Array(r),o),a=e.attributes.map((e=>e.array.buffer));e.index&&a.push(e.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:e},a)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(i)}}))}}}function ee(e,s,r={}){const n=new t.Vector3,o=new t.Quaternion,i=new t.Vector3,a=new t.Matrix4,c=new t.Matrix4,l=new t.Matrix4;r.preserveMatrix=void 0===r.preserveMatrix||r.preserveMatrix,r.preservePosition=void 0===r.preservePosition||r.preservePosition,r.preserveHipPosition=void 0!==r.preserveHipPosition&&r.preserveHipPosition,r.useTargetMatrix=void 0!==r.useTargetMatrix&&r.useTargetMatrix,r.hip=void 0!==r.hip?r.hip:"hip",r.names=r.names||{};const u=s.isObject3D?s.skeleton.bones:se(s),h=e.isObject3D?e.skeleton.bones:se(e);let d,p,m,f,A;if(e.isObject3D?e.skeleton.pose():(r.useTargetMatrix=!0,r.preserveMatrix=!1),r.preservePosition){A=[];for(let e=0;e