aptechka 0.7.2 → 0.7.3
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.
- package/lib/accordion/AccordionElement.d.ts +0 -3
- package/lib/accordion/index.cjs +1 -1
- package/lib/accordion/index.js +60 -71
- package/lib/en3/core/En3Raycaster.d.ts +1 -0
- package/lib/en3/helpers/{En3Controls.d.ts → En3Helpers.d.ts} +1 -1
- package/lib/en3/helpers/En3Object3dManager.d.ts +2 -0
- package/lib/en3/helpers/En3ParametersManager.d.ts +5 -0
- package/lib/en3/helpers/index.cjs +1 -1
- package/lib/en3/helpers/index.d.ts +1 -1
- package/lib/en3/helpers/index.js +1203 -669
- package/lib/en3/index.cjs +1 -1
- package/lib/en3/index.js +1 -1
- package/lib/en3/loaders/index.cjs +1 -1
- package/lib/en3/loaders/index.js +1 -1
- package/lib/en3/utils/index.cjs +1 -1
- package/lib/en3/utils/index.js +15 -38
- package/lib/en3-BQMd-J6t.cjs +8 -0
- package/lib/{en3-hbkN1OPu.js → en3-CsNHRA0v.js} +22 -22
- package/lib/events-BGwqaxVW.cjs +1 -0
- package/lib/{events-_C2CztxR.js → events-C_coq1Mk.js} +9 -0
- package/lib/{index-BAH_fO2N.js → index-CoOTQk9H.js} +40 -40
- package/lib/{index-D1LQUR-R.cjs → index-DVUk3T-y.cjs} +2 -2
- package/lib/select/index.cjs +1 -1
- package/lib/select/index.js +1 -1
- package/lib/traverseMaterials-B87RMkV0.js +29 -0
- package/lib/traverseMaterials-Crv7f9BJ.cjs +1 -0
- package/lib/tweaker/index.cjs +3 -3
- package/lib/tweaker/index.js +314 -296
- package/lib/tweaker/tweakerStorage.d.ts +2 -0
- package/lib/utils/events.d.ts +2 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +65 -64
- package/package.json +1 -1
- package/lib/en3-C4mzaF6q.cjs +0 -8
- package/lib/events-Crwi8fz6.cjs +0 -1
package/lib/en3/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../en3-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../en3-BQMd-J6t.cjs");exports.En3View=e.En3View;exports.en3=e.en3;exports.en3Cache=e.en3Cache;
|
package/lib/en3/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Y=(h,t,e)=>{if(!t.has(h))throw TypeError("Cannot "+e)};var y=(h,t,e)=>(Y(h,t,"read from private field"),e?e.call(h):t.get(h)),B=(h,t,e)=>{if(t.has(h))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(h):t.set(h,e)},K=(h,t,e,r)=>(Y(h,t,"write to private field"),r?r.call(h,e):t.set(h,e),e);var Q=(h,t,e)=>new Promise((r,n)=>{var s=o=>{try{a(e.next(o))}catch(c){n(c)}},i=o=>{try{a(e.throw(o))}catch(c){n(c)}},a=o=>o.done?r(o.value):Promise.resolve(o.value).then(s,i);a((e=e.apply(h,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("three"),L=require("../../en3-C4mzaF6q.cjs");function Z(h,t){if(t===u.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),h;if(t===u.TriangleFanDrawMode||t===u.TriangleStripDrawMode){let e=h.getIndex();if(e===null){const i=[],a=h.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)i.push(o);h.setIndex(i),e=h.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),h}const r=e.count-2,n=[];if(t===u.TriangleFanDrawMode)for(let i=1;i<=r;i++)n.push(e.getX(0)),n.push(e.getX(i)),n.push(e.getX(i+1));else for(let i=0;i<r;i++)i%2===0?(n.push(e.getX(i)),n.push(e.getX(i+1)),n.push(e.getX(i+2))):(n.push(e.getX(i+2)),n.push(e.getX(i+1)),n.push(e.getX(i)));n.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=h.clone();return s.setIndex(n),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),h}class re extends u.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new le(e)}),this.register(function(e){return new ue(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new he(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new pe(e)}),this.register(function(e){return new me(e)}),this.register(function(e){return new ce(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new Ae(e)}),this.register(function(e){return new oe(e)}),this.register(function(e){return new Le(e)}),this.register(function(e){return new Me(e)})}load(t,e,r,n){const s=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const c=u.LoaderUtils.extractUrlBase(t);i=u.LoaderUtils.resolveURL(c,this.path)}else i=u.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(c){n?n(c):console.error(c),s.manager.itemError(t),s.manager.itemEnd(t)},o=new u.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(c){try{s.parse(c,i,function(d){e(d),s.manager.itemEnd(t)},a)}catch(d){a(d)}},r,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,r,n){let s;const i={},a={},o=new TextDecoder;if(typeof t=="string")s=JSON.parse(t);else if(t instanceof ArrayBuffer)if(o.decode(new Uint8Array(t,0,4))===ne){try{i[A.KHR_BINARY_GLTF]=new Se(t)}catch(l){n&&n(l);return}s=JSON.parse(i[A.KHR_BINARY_GLTF].content)}else s=JSON.parse(o.decode(t));else s=t;if(s.asset===void 0||s.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new ke(s,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const l=this.pluginCallbacks[d](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,i[l.name]=!0}if(s.extensionsUsed)for(let d=0;d<s.extensionsUsed.length;++d){const l=s.extensionsUsed[d],f=s.extensionsRequired||[];switch(l){case A.KHR_MATERIALS_UNLIT:i[l]=new ae;break;case A.KHR_DRACO_MESH_COMPRESSION:i[l]=new _e(s,this.dracoLoader);break;case A.KHR_TEXTURE_TRANSFORM:i[l]=new ye;break;case A.KHR_MESH_QUANTIZATION:i[l]=new we;break;default:f.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(i),c.setPlugins(a),c.parse(r,n)}parseAsync(t,e){const r=this;return new Promise(function(n,s){r.parse(t,e,n,s)})}}function ie(){let h={};return{get:function(t){return h[t]},add:function(t,e){h[t]=e},remove:function(t){delete h[t]},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_DISPERSION:"KHR_materials_dispersion",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 oe{constructor(t){this.parser=t,this.name=A.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let r=0,n=e.length;r<n;r++){const s=e[r];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(t){const e=this.parser,r="light:"+t;let n=e.cache.get(r);if(n)return n;const s=e.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[t];let c;const d=new u.Color(16777215);o.color!==void 0&&d.setRGB(o.color[0],o.color[1],o.color[2],u.LinearSRGBColorSpace);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new u.DirectionalLight(d),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new u.PointLight(d),c.distance=l;break;case"spot":c=new u.SpotLight(d),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),c.decay=2,N(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+t),n=Promise.resolve(c),e.cache.add(r,n),n}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,r=this.parser,s=r.json.nodes[t],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return r._getNodeRef(e.cache,a,o)})}}class ae{constructor(){this.name=A.KHR_MATERIALS_UNLIT}getMaterialType(){return u.MeshBasicMaterial}extendParams(t,e,r){const n=[];t.color=new u.Color(1,1,1),t.opacity=1;const s=e.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const i=s.baseColorFactor;t.color.setRGB(i[0],i[1],i[2],u.LinearSRGBColorSpace),t.opacity=i[3]}s.baseColorTexture!==void 0&&n.push(r.assignTexture(t,"map",s.baseColorTexture,u.SRGBColorSpace))}return Promise.all(n)}}class ce{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name].emissiveStrength;return s!==void 0&&(e.emissiveIntensity=s),Promise.resolve()}}class le{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];if(i.clearcoatFactor!==void 0&&(e.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&s.push(r.assignTexture(e,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&s.push(r.assignTexture(e,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(s.push(r.assignTexture(e,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){const a=i.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new u.Vector2(a,a)}return Promise.all(s)}}class ue{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_DISPERSION}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return e.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class de{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return i.iridescenceFactor!==void 0&&(e.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&s.push(r.assignTexture(e,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(e.iridescenceIOR=i.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&s.push(r.assignTexture(e,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(s)}}class he{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_SHEEN}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[];e.sheenColor=new u.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const i=n.extensions[this.name];if(i.sheenColorFactor!==void 0){const a=i.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace)}return i.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&s.push(r.assignTexture(e,"sheenColorMap",i.sheenColorTexture,u.SRGBColorSpace)),i.sheenRoughnessTexture!==void 0&&s.push(r.assignTexture(e,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(s)}}class fe{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return i.transmissionFactor!==void 0&&(e.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&s.push(r.assignTexture(e,"transmissionMap",i.transmissionTexture)),Promise.all(s)}}class pe{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_VOLUME}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];e.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&s.push(r.assignTexture(e,"thicknessMap",i.thicknessTexture)),e.attenuationDistance=i.attenuationDistance||1/0;const a=i.attenuationColor||[1,1,1];return e.attenuationColor=new u.Color().setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace),Promise.all(s)}}class me{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_IOR}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return e.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class ge{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_SPECULAR}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];e.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&s.push(r.assignTexture(e,"specularIntensityMap",i.specularTexture));const a=i.specularColorFactor||[1,1,1];return e.specularColor=new u.Color().setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace),i.specularColorTexture!==void 0&&s.push(r.assignTexture(e,"specularColorMap",i.specularColorTexture,u.SRGBColorSpace)),Promise.all(s)}}class Ae{constructor(t){this.parser=t,this.name=A.EXT_MATERIALS_BUMP}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return e.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&s.push(r.assignTexture(e,"bumpMap",i.bumpTexture)),Promise.all(s)}}class Te{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return i.anisotropyStrength!==void 0&&(e.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(e.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&s.push(r.assignTexture(e,"anisotropyMap",i.anisotropyTexture)),Promise.all(s)}}class Re{constructor(t){this.parser=t,this.name=A.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,r=e.json,n=r.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const s=n.extensions[this.name],i=e.options.ktx2Loader;if(!i){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 e.loadTextureImage(t,s.source,i)}}class xe{constructor(t){this.parser=t,this.name=A.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,r=this.parser,n=r.json,s=n.textures[t];if(!s.extensions||!s.extensions[e])return null;const i=s.extensions[e],a=n.images[i.source];let o=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(t,i.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Ee{constructor(t){this.parser=t,this.name=A.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,r=this.parser,n=r.json,s=n.textures[t];if(!s.extensions||!s.extensions[e])return null;const i=s.extensions[e],a=n.images[i.source];let o=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(t,i.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Le{constructor(t){this.name=A.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,r=e.bufferViews[t];if(r.extensions&&r.extensions[this.name]){const n=r.extensions[this.name],s=this.parser.getDependency("buffer",n.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,d=n.count,l=n.byteStride,f=new Uint8Array(a,o,c);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(d,l,f,n.mode,n.filter).then(function(p){return p.buffer}):i.ready.then(function(){const p=new ArrayBuffer(d*l);return i.decodeGltfBuffer(new Uint8Array(p),d,l,f,n.mode,n.filter),p})})}else return null}}class Me{constructor(t){this.name=A.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,r=e.nodes[t];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const n=e.meshes[r.mesh];for(const c of n.primitives)if(c.mode!==S.TRIANGLES&&c.mode!==S.TRIANGLE_STRIP&&c.mode!==S.TRIANGLE_FAN&&c.mode!==void 0)return null;const i=r.extensions[this.name].attributes,a=[],o={};for(const c in i)a.push(this.parser.getDependency("accessor",i[c]).then(d=>(o[c]=d,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const d=c.pop(),l=d.isGroup?d.children:[d],f=c[0].count,p=[];for(const m of l){const R=new u.Matrix4,g=new u.Vector3,T=new u.Quaternion,E=new u.Vector3(1,1,1),M=new u.InstancedMesh(m.geometry,m.material,f);for(let x=0;x<f;x++)o.TRANSLATION&&g.fromBufferAttribute(o.TRANSLATION,x),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,x),o.SCALE&&E.fromBufferAttribute(o.SCALE,x),M.setMatrixAt(x,R.compose(g,T,E));for(const x in o)if(x==="_COLOR_0"){const w=o[x];M.instanceColor=new u.InstancedBufferAttribute(w.array,w.itemSize,w.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&m.geometry.setAttribute(x,o[x]);u.Object3D.prototype.copy.call(M,m),this.parser.assignFinalMaterial(M),p.push(M)}return d.isGroup?(d.clear(),d.add(...p),d):p[0]}))}}const ne="glTF",H=12,J={JSON:1313821514,BIN:5130562};class Se{constructor(t){this.name=A.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,H),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==ne)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-H,s=new DataView(t,H);let i=0;for(;i<n;){const a=s.getUint32(i,!0);i+=4;const o=s.getUint32(i,!0);if(i+=4,o===J.JSON){const c=new Uint8Array(t,H+i,a);this.content=r.decode(c)}else if(o===J.BIN){const c=H+i;this.body=t.slice(c,c+a)}i+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class _e{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=A.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const r=this.json,n=this.dracoLoader,s=t.extensions[this.name].bufferView,i=t.extensions[this.name].attributes,a={},o={},c={};for(const d in i){const l=q[d]||d.toLowerCase();a[l]=i[d]}for(const d in t.attributes){const l=q[d]||d.toLowerCase();if(i[d]!==void 0){const f=r.accessors[t.attributes[d]],p=G[f.componentType];c[l]=p.name,o[l]=f.normalized===!0}}return e.getDependency("bufferView",s).then(function(d){return new Promise(function(l,f){n.decodeDracoFile(d,function(p){for(const m in p.attributes){const R=p.attributes[m],g=o[m];g!==void 0&&(R.normalized=g)}l(p)},a,c,u.LinearSRGBColorSpace,f)})})}}class ye{constructor(){this.name=A.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class we{constructor(){this.name=A.KHR_MESH_QUANTIZATION}}class se extends u.Interpolant{constructor(t,e,r,n){super(t,e,r,n)}copySampleValue_(t){const e=this.resultBuffer,r=this.sampleValues,n=this.valueSize,s=t*n*3+n;for(let i=0;i!==n;i++)e[i]=r[s+i];return e}interpolate_(t,e,r,n){const s=this.resultBuffer,i=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,d=n-e,l=(r-e)/d,f=l*l,p=f*l,m=t*c,R=m-c,g=-2*p+3*f,T=p-f,E=1-g,M=T-f+l;for(let x=0;x!==a;x++){const w=i[R+x+a],I=i[R+x+o]*d,_=i[m+x+a],k=i[m+x]*d;s[x]=E*w+M*I+g*_+T*k}return s}}const be=new u.Quaternion;class Ne extends se{interpolate_(t,e,r,n){const s=super.interpolate_(t,e,r,n);return be.fromArray(s).normalize().toArray(s),s}}const S={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},G={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$={9728:u.NearestFilter,9729:u.LinearFilter,9984:u.NearestMipmapNearestFilter,9985:u.LinearMipmapNearestFilter,9986:u.NearestMipmapLinearFilter,9987:u.LinearMipmapLinearFilter},ee={33071:u.ClampToEdgeWrapping,33648:u.MirroredRepeatWrapping,10497:u.RepeatWrapping},V={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},q={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"},O={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ie={CUBICSPLINE:void 0,LINEAR:u.InterpolateLinear,STEP:u.InterpolateDiscrete},X={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ce(h){return h.DefaultMaterial===void 0&&(h.DefaultMaterial=new u.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:u.FrontSide})),h.DefaultMaterial}function D(h,t,e){for(const r in e.extensions)h[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=e.extensions[r])}function N(h,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(h.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Oe(h,t,e){let r=!1,n=!1,s=!1;for(let c=0,d=t.length;c<d;c++){const l=t[c];if(l.POSITION!==void 0&&(r=!0),l.NORMAL!==void 0&&(n=!0),l.COLOR_0!==void 0&&(s=!0),r&&n&&s)break}if(!r&&!n&&!s)return Promise.resolve(h);const i=[],a=[],o=[];for(let c=0,d=t.length;c<d;c++){const l=t[c];if(r){const f=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):h.attributes.position;i.push(f)}if(n){const f=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):h.attributes.normal;a.push(f)}if(s){const f=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):h.attributes.color;o.push(f)}}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(o)]).then(function(c){const d=c[0],l=c[1],f=c[2];return r&&(h.morphAttributes.position=d),n&&(h.morphAttributes.normal=l),s&&(h.morphAttributes.color=f),h.morphTargetsRelative=!0,h})}function De(h,t){if(h.updateMorphTargets(),t.weights!==void 0)for(let e=0,r=t.weights.length;e<r;e++)h.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(h.morphTargetInfluences.length===e.length){h.morphTargetDictionary={};for(let r=0,n=e.length;r<n;r++)h.morphTargetDictionary[e[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Fe(h){let t;const e=h.extensions&&h.extensions[A.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+z(e.attributes):t=h.indices+":"+z(h.attributes)+":"+h.mode,h.targets!==void 0)for(let r=0,n=h.targets.length;r<n;r++)t+=":"+z(h.targets[r]);return t}function z(h){let t="";const e=Object.keys(h).sort();for(let r=0,n=e.length;r<n;r++)t+=e[r]+":"+h[e[r]]+";";return t}function W(h){switch(h){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.")}}function Pe(h){return h.search(/\.jpe?g($|\?)/i)>0||h.search(/^data\:image\/jpeg/)===0?"image/jpeg":h.search(/\.webp($|\?)/i)>0||h.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ge=new u.Matrix4;class ke{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new ie,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,n=-1,s=!1,i=-1;if(typeof navigator!="undefined"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);n=r&&o?parseInt(o[1],10):-1,s=a.indexOf("Firefox")>-1,i=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap=="undefined"||r&&n<17||s&&i<98?this.textureLoader=new u.TextureLoader(this.options.manager):this.textureLoader=new u.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new u.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const r=this,n=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(i){const a={scene:i[0][n.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:n.asset,parser:r,userData:{}};return D(s,a,n),N(a,n),Promise.all(r._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[];for(let n=0,s=e.length;n<s;n++){const i=e[n].joints;for(let a=0,o=i.length;a<o;a++)t[i[a]].isBone=!0}for(let n=0,s=t.length;n<s;n++){const i=t[n];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(r[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,r){if(t.refs[e]<=1)return r;const n=r.clone(),s=(i,a)=>{const o=this.associations.get(i);o!=null&&this.associations.set(a,o);for(const[c,d]of i.children.entries())s(d,a.children[c])};return s(r,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let r=0;r<e.length;r++){const n=t(e[r]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const r=[];for(let n=0;n<e.length;n++){const s=t(e[n]);s&&r.push(s)}return r}getDependency(t,e){const r=t+":"+e;let n=this.cache.get(r);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(s){return s.loadNode&&s.loadNode(e)});break;case"mesh":n=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t);break}this.cache.add(r,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const r=this,n=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(n.map(function(s,i){return r.getDependency(t,i)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],r=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[A.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(s,i){r.load(u.LoaderUtils.resolveURL(e.uri,n.path),s,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(r){const n=e.byteLength||0,s=e.byteOffset||0;return r.slice(s,s+n)})}loadAccessor(t){const e=this,r=this.json,n=this.json.accessors[t];if(n.bufferView===void 0&&n.sparse===void 0){const i=V[n.type],a=G[n.componentType],o=n.normalized===!0,c=new a(n.count*i);return Promise.resolve(new u.BufferAttribute(c,i,o))}const s=[];return n.bufferView!==void 0?s.push(this.getDependency("bufferView",n.bufferView)):s.push(null),n.sparse!==void 0&&(s.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(s).then(function(i){const a=i[0],o=V[n.type],c=G[n.componentType],d=c.BYTES_PER_ELEMENT,l=d*o,f=n.byteOffset||0,p=n.bufferView!==void 0?r.bufferViews[n.bufferView].byteStride:void 0,m=n.normalized===!0;let R,g;if(p&&p!==l){const T=Math.floor(f/p),E="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+T+":"+n.count;let M=e.cache.get(E);M||(R=new c(a,T*p,n.count*p/d),M=new u.InterleavedBuffer(R,p/d),e.cache.add(E,M)),g=new u.InterleavedBufferAttribute(M,o,f%p/d,m)}else a===null?R=new c(n.count*o):R=new c(a,f,n.count*o),g=new u.BufferAttribute(R,o,m);if(n.sparse!==void 0){const T=V.SCALAR,E=G[n.sparse.indices.componentType],M=n.sparse.indices.byteOffset||0,x=n.sparse.values.byteOffset||0,w=new E(i[1],M,n.sparse.count*T),I=new c(i[2],x,n.sparse.count*o);a!==null&&(g=new u.BufferAttribute(g.array.slice(),g.itemSize,g.normalized));for(let _=0,k=w.length;_<k;_++){const C=w[_];if(g.setX(C,I[_*o]),o>=2&&g.setY(C,I[_*o+1]),o>=3&&g.setZ(C,I[_*o+2]),o>=4&&g.setW(C,I[_*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}loadTexture(t){const e=this.json,r=this.options,s=e.textures[t].source,i=e.images[s];let a=this.textureLoader;if(i.uri){const o=r.manager.getHandler(i.uri);o!==null&&(a=o)}return this.loadTextureImage(t,s,a)}loadTextureImage(t,e,r){const n=this,s=this.json,i=s.textures[t],a=s.images[e],o=(a.uri||a.bufferView)+":"+i.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,r).then(function(d){d.flipY=!1,d.name=i.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const f=(s.samplers||{})[i.sampler]||{};return d.magFilter=$[f.magFilter]||u.LinearFilter,d.minFilter=$[f.minFilter]||u.LinearMipmapLinearFilter,d.wrapS=ee[f.wrapS]||u.RepeatWrapping,d.wrapT=ee[f.wrapT]||u.RepeatWrapping,n.associations.set(d,{textures:t}),d}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){const r=this,n=this.json,s=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(l=>l.clone());const i=n.images[t],a=self.URL||self.webkitURL;let o=i.uri||"",c=!1;if(i.bufferView!==void 0)o=r.getDependency("bufferView",i.bufferView).then(function(l){c=!0;const f=new Blob([l],{type:i.mimeType});return o=a.createObjectURL(f),o});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const d=Promise.resolve(o).then(function(l){return new Promise(function(f,p){let m=f;e.isImageBitmapLoader===!0&&(m=function(R){const g=new u.Texture(R);g.needsUpdate=!0,f(g)}),e.load(u.LoaderUtils.resolveURL(l,s.path),m,void 0,p)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),N(l,i),l.userData.mimeType=i.mimeType||Pe(i.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[t]=d,d}assignTexture(t,e,r,n){const s=this;return this.getDependency("texture",r.index).then(function(i){if(!i)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(i=i.clone(),i.channel=r.texCoord),s.extensions[A.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[A.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=s.associations.get(i);i=s.extensions[A.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),s.associations.set(i,o)}}return n!==void 0&&(i.colorSpace=n),t[e]=i,i})}assignFinalMaterial(t){const e=t.geometry;let r=t.material;const n=e.attributes.tangent===void 0,s=e.attributes.color!==void 0,i=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+r.uuid;let o=this.cache.get(a);o||(o=new u.PointsMaterial,u.Material.prototype.copy.call(o,r),o.color.copy(r.color),o.map=r.map,o.sizeAttenuation=!1,this.cache.add(a,o)),r=o}else if(t.isLine){const a="LineBasicMaterial:"+r.uuid;let o=this.cache.get(a);o||(o=new u.LineBasicMaterial,u.Material.prototype.copy.call(o,r),o.color.copy(r.color),o.map=r.map,this.cache.add(a,o)),r=o}if(n||s||i){let a="ClonedMaterial:"+r.uuid+":";n&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),i&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=r.clone(),s&&(o.vertexColors=!0),i&&(o.flatShading=!0),n&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(r))),r=o}t.material=r}getMaterialType(){return u.MeshStandardMaterial}loadMaterial(t){const e=this,r=this.json,n=this.extensions,s=r.materials[t];let i;const a={},o=s.extensions||{},c=[];if(o[A.KHR_MATERIALS_UNLIT]){const l=n[A.KHR_MATERIALS_UNLIT];i=l.getMaterialType(),c.push(l.extendParams(a,s,e))}else{const l=s.pbrMetallicRoughness||{};if(a.color=new u.Color(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const f=l.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],u.LinearSRGBColorSpace),a.opacity=f[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,u.SRGBColorSpace)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),i=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(t,a)})))}s.doubleSided===!0&&(a.side=u.DoubleSide);const d=s.alphaMode||X.OPAQUE;if(d===X.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===X.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&i!==u.MeshBasicMaterial&&(c.push(e.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new u.Vector2(1,1),s.normalTexture.scale!==void 0)){const l=s.normalTexture.scale;a.normalScale.set(l,l)}if(s.occlusionTexture!==void 0&&i!==u.MeshBasicMaterial&&(c.push(e.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&i!==u.MeshBasicMaterial){const l=s.emissiveFactor;a.emissive=new u.Color().setRGB(l[0],l[1],l[2],u.LinearSRGBColorSpace)}return s.emissiveTexture!==void 0&&i!==u.MeshBasicMaterial&&c.push(e.assignTexture(a,"emissiveMap",s.emissiveTexture,u.SRGBColorSpace)),Promise.all(c).then(function(){const l=new i(a);return s.name&&(l.name=s.name),N(l,s),e.associations.set(l,{materials:t}),s.extensions&&D(n,l,s),l})}createUniqueName(t){const e=u.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,r=this.extensions,n=this.primitiveCache;function s(a){return r[A.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return te(o,a,e)})}const i=[];for(let a=0,o=t.length;a<o;a++){const c=t[a],d=Fe(c),l=n[d];if(l)i.push(l.promise);else{let f;c.extensions&&c.extensions[A.KHR_DRACO_MESH_COMPRESSION]?f=s(c):f=te(new u.BufferGeometry,c,e),n[d]={primitive:c,promise:f},i.push(f)}}return Promise.all(i)}loadMesh(t){const e=this,r=this.json,n=this.extensions,s=r.meshes[t],i=s.primitives,a=[];for(let o=0,c=i.length;o<c;o++){const d=i[o].material===void 0?Ce(this.cache):this.getDependency("material",i[o].material);a.push(d)}return a.push(e.loadGeometries(i)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),d=o[o.length-1],l=[];for(let p=0,m=d.length;p<m;p++){const R=d[p],g=i[p];let T;const E=c[p];if(g.mode===S.TRIANGLES||g.mode===S.TRIANGLE_STRIP||g.mode===S.TRIANGLE_FAN||g.mode===void 0)T=s.isSkinnedMesh===!0?new u.SkinnedMesh(R,E):new u.Mesh(R,E),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),g.mode===S.TRIANGLE_STRIP?T.geometry=Z(T.geometry,u.TriangleStripDrawMode):g.mode===S.TRIANGLE_FAN&&(T.geometry=Z(T.geometry,u.TriangleFanDrawMode));else if(g.mode===S.LINES)T=new u.LineSegments(R,E);else if(g.mode===S.LINE_STRIP)T=new u.Line(R,E);else if(g.mode===S.LINE_LOOP)T=new u.LineLoop(R,E);else if(g.mode===S.POINTS)T=new u.Points(R,E);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);Object.keys(T.geometry.morphAttributes).length>0&&De(T,s),T.name=e.createUniqueName(s.name||"mesh_"+t),N(T,s),g.extensions&&D(n,T,g),e.assignFinalMaterial(T),l.push(T)}for(let p=0,m=l.length;p<m;p++)e.associations.set(l[p],{meshes:t,primitives:p});if(l.length===1)return s.extensions&&D(n,l[0],s),l[0];const f=new u.Group;s.extensions&&D(n,f,s),e.associations.set(f,{meshes:t});for(let p=0,m=l.length;p<m;p++)f.add(l[p]);return f})}loadCamera(t){let e;const r=this.json.cameras[t],n=r[r.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?e=new u.PerspectiveCamera(u.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):r.type==="orthographic"&&(e=new u.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(e.name=this.createUniqueName(r.name)),N(e,r),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],r=[];for(let n=0,s=e.joints.length;n<s;n++)r.push(this._loadNodeShallow(e.joints[n]));return e.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",e.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(n){const s=n.pop(),i=n,a=[],o=[];for(let c=0,d=i.length;c<d;c++){const l=i[c];if(l){a.push(l);const f=new u.Matrix4;s!==null&&f.fromArray(s.array,c*16),o.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new u.Skeleton(a,o)})}loadAnimation(t){const e=this.json,r=this,n=e.animations[t],s=n.name?n.name:"animation_"+t,i=[],a=[],o=[],c=[],d=[];for(let l=0,f=n.channels.length;l<f;l++){const p=n.channels[l],m=n.samplers[p.sampler],R=p.target,g=R.node,T=n.parameters!==void 0?n.parameters[m.input]:m.input,E=n.parameters!==void 0?n.parameters[m.output]:m.output;R.node!==void 0&&(i.push(this.getDependency("node",g)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",E)),c.push(m),d.push(R))}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(d)]).then(function(l){const f=l[0],p=l[1],m=l[2],R=l[3],g=l[4],T=[];for(let E=0,M=f.length;E<M;E++){const x=f[E],w=p[E],I=m[E],_=R[E],k=g[E];if(x===void 0)continue;x.updateMatrix&&x.updateMatrix();const C=r._createAnimationTracks(x,w,I,_,k);if(C)for(let j=0;j<C.length;j++)T.push(C[j])}return new u.AnimationClip(s,void 0,T)})}createNodeMesh(t){const e=this.json,r=this,n=e.nodes[t];return n.mesh===void 0?null:r.getDependency("mesh",n.mesh).then(function(s){const i=r._getNodeRef(r.meshCache,n.mesh,s);return n.weights!==void 0&&i.traverse(function(a){if(a.isMesh)for(let o=0,c=n.weights.length;o<c;o++)a.morphTargetInfluences[o]=n.weights[o]}),i})}loadNode(t){const e=this.json,r=this,n=e.nodes[t],s=r._loadNodeShallow(t),i=[],a=n.children||[];for(let c=0,d=a.length;c<d;c++)i.push(r.getDependency("node",a[c]));const o=n.skin===void 0?Promise.resolve(null):r.getDependency("skin",n.skin);return Promise.all([s,Promise.all(i),o]).then(function(c){const d=c[0],l=c[1],f=c[2];f!==null&&d.traverse(function(p){p.isSkinnedMesh&&p.bind(f,Ge)});for(let p=0,m=l.length;p<m;p++)d.add(l[p]);return d})}_loadNodeShallow(t){const e=this.json,r=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const s=e.nodes[t],i=s.name?n.createUniqueName(s.name):"",a=[],o=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return o&&a.push(o),s.camera!==void 0&&a.push(n.getDependency("camera",s.camera).then(function(c){return n._getNodeRef(n.cameraCache,s.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let d;if(s.isBone===!0?d=new u.Bone:c.length>1?d=new u.Group:c.length===1?d=c[0]:d=new u.Object3D,d!==c[0])for(let l=0,f=c.length;l<f;l++)d.add(c[l]);if(s.name&&(d.userData.name=s.name,d.name=i),N(d,s),s.extensions&&D(r,d,s),s.matrix!==void 0){const l=new u.Matrix4;l.fromArray(s.matrix),d.applyMatrix4(l)}else s.translation!==void 0&&d.position.fromArray(s.translation),s.rotation!==void 0&&d.quaternion.fromArray(s.rotation),s.scale!==void 0&&d.scale.fromArray(s.scale);return n.associations.has(d)||n.associations.set(d,{}),n.associations.get(d).nodes=t,d}),this.nodeCache[t]}loadScene(t){const e=this.extensions,r=this.json.scenes[t],n=this,s=new u.Group;r.name&&(s.name=n.createUniqueName(r.name)),N(s,r),r.extensions&&D(e,s,r);const i=r.nodes||[],a=[];for(let o=0,c=i.length;o<c;o++)a.push(n.getDependency("node",i[o]));return Promise.all(a).then(function(o){for(let d=0,l=o.length;d<l;d++)s.add(o[d]);const c=d=>{const l=new Map;for(const[f,p]of n.associations)(f instanceof u.Material||f instanceof u.Texture)&&l.set(f,p);return d.traverse(f=>{const p=n.associations.get(f);p!=null&&l.set(f,p)}),l};return n.associations=c(s),s})}_createAnimationTracks(t,e,r,n,s){const i=[],a=t.name?t.name:t.uuid,o=[];O[s.path]===O.weights?t.traverse(function(f){f.morphTargetInfluences&&o.push(f.name?f.name:f.uuid)}):o.push(a);let c;switch(O[s.path]){case O.weights:c=u.NumberKeyframeTrack;break;case O.rotation:c=u.QuaternionKeyframeTrack;break;case O.position:case O.scale:c=u.VectorKeyframeTrack;break;default:switch(r.itemSize){case 1:c=u.NumberKeyframeTrack;break;case 2:case 3:default:c=u.VectorKeyframeTrack;break}break}const d=n.interpolation!==void 0?Ie[n.interpolation]:u.InterpolateLinear,l=this._getArrayFromAccessor(r);for(let f=0,p=o.length;f<p;f++){const m=new c(o[f]+"."+O[s.path],e.array,l,d);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),i.push(m)}return i}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const r=W(e.constructor),n=new Float32Array(e.length);for(let s=0,i=e.length;s<i;s++)n[s]=e[s]*r;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(r){const n=this instanceof u.QuaternionKeyframeTrack?Ne:se;return new n(this.times,this.values,this.getValueSize()/3,r)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Be(h,t,e){const r=t.attributes,n=new u.Box3;if(r.POSITION!==void 0){const a=e.json.accessors[r.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(n.set(new u.Vector3(o[0],o[1],o[2]),new u.Vector3(c[0],c[1],c[2])),a.normalized){const d=W(G[a.componentType]);n.min.multiplyScalar(d),n.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=t.targets;if(s!==void 0){const a=new u.Vector3,o=new u.Vector3;for(let c=0,d=s.length;c<d;c++){const l=s[c];if(l.POSITION!==void 0){const f=e.json.accessors[l.POSITION],p=f.min,m=f.max;if(p!==void 0&&m!==void 0){if(o.setX(Math.max(Math.abs(p[0]),Math.abs(m[0]))),o.setY(Math.max(Math.abs(p[1]),Math.abs(m[1]))),o.setZ(Math.max(Math.abs(p[2]),Math.abs(m[2]))),f.normalized){const R=W(G[f.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}h.boundingBox=n;const i=new u.Sphere;n.getCenter(i.center),i.radius=n.min.distanceTo(n.max)/2,h.boundingSphere=i}function te(h,t,e){const r=t.attributes,n=[];function s(i,a){return e.getDependency("accessor",i).then(function(o){h.setAttribute(a,o)})}for(const i in r){const a=q[i]||i.toLowerCase();a in h.attributes||n.push(s(r[i],a))}if(t.indices!==void 0&&!h.index){const i=e.getDependency("accessor",t.indices).then(function(a){h.setIndex(a)});n.push(i)}return u.ColorManagement.workingColorSpace!==u.LinearSRGBColorSpace&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${u.ColorManagement.workingColorSpace}" not supported.`),N(h,t),Be(h,t,e),Promise.all(n).then(function(){return t.targets!==void 0?Oe(h,t.targets,e):h})}var F;class He{constructor(){B(this,F,new re)}get gltfLoader(){return y(this,F)}setLoaders(t){if(t!=null&&t.draco&&b.dracoLoader){const e=typeof t.draco=="boolean"?`${L.en3.CDNVersion}/examples/jsm/libs/draco/gltf/`:t.draco;b.dracoLoader.setDecoderPath(e),y(this,F).setDRACOLoader(b.dracoLoader)}if(t!=null&&t.ktx2&&b.ktx2Loader){const e=typeof t.ktx2=="boolean"?`${L.en3.CDNVersion}/examples/jsm/libs/basis/`:t.ktx2;b.ktx2Loader.setTranscoderPath(e),y(this,F).setKTX2Loader(b.ktx2Loader.detectSupport(L.en3.webglRenderer))}t!=null&&t.meshopt&&b.meshoptDecoder&&y(this,F).setMeshoptDecoder(b.meshoptDecoder)}load(...t){const[e,r,...n]=t;if(L.en3.cacheAssets&&L.en3Cache.has(e)){const s=L.en3Cache.get(e).data;r(s)}else this.gltfLoader.load(e,s=>{L.en3.cacheAssets&&L.en3Cache.set(e,{data:s,dispose:()=>{s.cameras.forEach(i=>L.dispose(i)),s.scenes.forEach(i=>{L.dispose(i)})}}),r(s)},...n)}}F=new WeakMap;var P,U,v;class Ue{constructor(){B(this,P,new u.TextureLoader);B(this,U,void 0);B(this,v,void 0);K(this,U,y(this,P).load.bind(y(this,P))),K(this,v,y(this,P).loadAsync.bind(y(this,P)))}load(...t){const[e,r,...n]=t;if(L.en3.cacheAssets&&L.en3Cache.has(e)){const s=L.en3Cache.get(e);return r==null||r(s.data),s.data}return y(this,U).call(this,e,s=>{L.en3.cacheAssets&&L.en3Cache.set(e,{data:s,dispose:()=>s.dispose()}),r==null||r(s)},...n)}loadSync(...t){return Q(this,null,function*(){const[e,...r]=t;if(L.en3.cacheAssets&&L.en3Cache.has(e))return L.en3Cache.get(e).data;const n=yield y(this,v).call(this,e,...r);return L.en3.cacheAssets&&L.en3Cache.set(e,{data:n,dispose:()=>n.dispose()}),n})}}P=new WeakMap,U=new WeakMap,v=new WeakMap;const b={gltfLoader:null,textureLoader:null,dracoLoader:null,ktx2Loader:null,meshoptDecoder:null};exports.En3GLTFLoader=He;exports.En3TextureLoader=Ue;exports.loaders=b;
|
|
1
|
+
"use strict";var Y=(h,t,e)=>{if(!t.has(h))throw TypeError("Cannot "+e)};var y=(h,t,e)=>(Y(h,t,"read from private field"),e?e.call(h):t.get(h)),B=(h,t,e)=>{if(t.has(h))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(h):t.set(h,e)},K=(h,t,e,r)=>(Y(h,t,"write to private field"),r?r.call(h,e):t.set(h,e),e);var Q=(h,t,e)=>new Promise((r,n)=>{var s=o=>{try{a(e.next(o))}catch(c){n(c)}},i=o=>{try{a(e.throw(o))}catch(c){n(c)}},a=o=>o.done?r(o.value):Promise.resolve(o.value).then(s,i);a((e=e.apply(h,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("three"),L=require("../../en3-BQMd-J6t.cjs");function Z(h,t){if(t===u.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),h;if(t===u.TriangleFanDrawMode||t===u.TriangleStripDrawMode){let e=h.getIndex();if(e===null){const i=[],a=h.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)i.push(o);h.setIndex(i),e=h.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),h}const r=e.count-2,n=[];if(t===u.TriangleFanDrawMode)for(let i=1;i<=r;i++)n.push(e.getX(0)),n.push(e.getX(i)),n.push(e.getX(i+1));else for(let i=0;i<r;i++)i%2===0?(n.push(e.getX(i)),n.push(e.getX(i+1)),n.push(e.getX(i+2))):(n.push(e.getX(i+2)),n.push(e.getX(i+1)),n.push(e.getX(i)));n.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=h.clone();return s.setIndex(n),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),h}class re extends u.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new le(e)}),this.register(function(e){return new ue(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new he(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new pe(e)}),this.register(function(e){return new me(e)}),this.register(function(e){return new ce(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new Ae(e)}),this.register(function(e){return new oe(e)}),this.register(function(e){return new Le(e)}),this.register(function(e){return new Me(e)})}load(t,e,r,n){const s=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const c=u.LoaderUtils.extractUrlBase(t);i=u.LoaderUtils.resolveURL(c,this.path)}else i=u.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(c){n?n(c):console.error(c),s.manager.itemError(t),s.manager.itemEnd(t)},o=new u.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(c){try{s.parse(c,i,function(d){e(d),s.manager.itemEnd(t)},a)}catch(d){a(d)}},r,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,r,n){let s;const i={},a={},o=new TextDecoder;if(typeof t=="string")s=JSON.parse(t);else if(t instanceof ArrayBuffer)if(o.decode(new Uint8Array(t,0,4))===ne){try{i[A.KHR_BINARY_GLTF]=new Se(t)}catch(l){n&&n(l);return}s=JSON.parse(i[A.KHR_BINARY_GLTF].content)}else s=JSON.parse(o.decode(t));else s=t;if(s.asset===void 0||s.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new ke(s,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const l=this.pluginCallbacks[d](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,i[l.name]=!0}if(s.extensionsUsed)for(let d=0;d<s.extensionsUsed.length;++d){const l=s.extensionsUsed[d],f=s.extensionsRequired||[];switch(l){case A.KHR_MATERIALS_UNLIT:i[l]=new ae;break;case A.KHR_DRACO_MESH_COMPRESSION:i[l]=new _e(s,this.dracoLoader);break;case A.KHR_TEXTURE_TRANSFORM:i[l]=new ye;break;case A.KHR_MESH_QUANTIZATION:i[l]=new we;break;default:f.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(i),c.setPlugins(a),c.parse(r,n)}parseAsync(t,e){const r=this;return new Promise(function(n,s){r.parse(t,e,n,s)})}}function ie(){let h={};return{get:function(t){return h[t]},add:function(t,e){h[t]=e},remove:function(t){delete h[t]},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_DISPERSION:"KHR_materials_dispersion",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 oe{constructor(t){this.parser=t,this.name=A.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let r=0,n=e.length;r<n;r++){const s=e[r];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(t){const e=this.parser,r="light:"+t;let n=e.cache.get(r);if(n)return n;const s=e.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[t];let c;const d=new u.Color(16777215);o.color!==void 0&&d.setRGB(o.color[0],o.color[1],o.color[2],u.LinearSRGBColorSpace);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new u.DirectionalLight(d),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new u.PointLight(d),c.distance=l;break;case"spot":c=new u.SpotLight(d),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),c.decay=2,N(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+t),n=Promise.resolve(c),e.cache.add(r,n),n}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,r=this.parser,s=r.json.nodes[t],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return r._getNodeRef(e.cache,a,o)})}}class ae{constructor(){this.name=A.KHR_MATERIALS_UNLIT}getMaterialType(){return u.MeshBasicMaterial}extendParams(t,e,r){const n=[];t.color=new u.Color(1,1,1),t.opacity=1;const s=e.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const i=s.baseColorFactor;t.color.setRGB(i[0],i[1],i[2],u.LinearSRGBColorSpace),t.opacity=i[3]}s.baseColorTexture!==void 0&&n.push(r.assignTexture(t,"map",s.baseColorTexture,u.SRGBColorSpace))}return Promise.all(n)}}class ce{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name].emissiveStrength;return s!==void 0&&(e.emissiveIntensity=s),Promise.resolve()}}class le{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];if(i.clearcoatFactor!==void 0&&(e.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&s.push(r.assignTexture(e,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&s.push(r.assignTexture(e,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(s.push(r.assignTexture(e,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){const a=i.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new u.Vector2(a,a)}return Promise.all(s)}}class ue{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_DISPERSION}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return e.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class de{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return i.iridescenceFactor!==void 0&&(e.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&s.push(r.assignTexture(e,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(e.iridescenceIOR=i.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&s.push(r.assignTexture(e,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(s)}}class he{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_SHEEN}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[];e.sheenColor=new u.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const i=n.extensions[this.name];if(i.sheenColorFactor!==void 0){const a=i.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace)}return i.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&s.push(r.assignTexture(e,"sheenColorMap",i.sheenColorTexture,u.SRGBColorSpace)),i.sheenRoughnessTexture!==void 0&&s.push(r.assignTexture(e,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(s)}}class fe{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return i.transmissionFactor!==void 0&&(e.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&s.push(r.assignTexture(e,"transmissionMap",i.transmissionTexture)),Promise.all(s)}}class pe{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_VOLUME}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];e.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&s.push(r.assignTexture(e,"thicknessMap",i.thicknessTexture)),e.attenuationDistance=i.attenuationDistance||1/0;const a=i.attenuationColor||[1,1,1];return e.attenuationColor=new u.Color().setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace),Promise.all(s)}}class me{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_IOR}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return e.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class ge{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_SPECULAR}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];e.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&s.push(r.assignTexture(e,"specularIntensityMap",i.specularTexture));const a=i.specularColorFactor||[1,1,1];return e.specularColor=new u.Color().setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace),i.specularColorTexture!==void 0&&s.push(r.assignTexture(e,"specularColorMap",i.specularColorTexture,u.SRGBColorSpace)),Promise.all(s)}}class Ae{constructor(t){this.parser=t,this.name=A.EXT_MATERIALS_BUMP}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return e.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&s.push(r.assignTexture(e,"bumpMap",i.bumpTexture)),Promise.all(s)}}class Te{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return i.anisotropyStrength!==void 0&&(e.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(e.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&s.push(r.assignTexture(e,"anisotropyMap",i.anisotropyTexture)),Promise.all(s)}}class Re{constructor(t){this.parser=t,this.name=A.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,r=e.json,n=r.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const s=n.extensions[this.name],i=e.options.ktx2Loader;if(!i){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 e.loadTextureImage(t,s.source,i)}}class xe{constructor(t){this.parser=t,this.name=A.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,r=this.parser,n=r.json,s=n.textures[t];if(!s.extensions||!s.extensions[e])return null;const i=s.extensions[e],a=n.images[i.source];let o=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(t,i.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Ee{constructor(t){this.parser=t,this.name=A.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,r=this.parser,n=r.json,s=n.textures[t];if(!s.extensions||!s.extensions[e])return null;const i=s.extensions[e],a=n.images[i.source];let o=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(t,i.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Le{constructor(t){this.name=A.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,r=e.bufferViews[t];if(r.extensions&&r.extensions[this.name]){const n=r.extensions[this.name],s=this.parser.getDependency("buffer",n.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,d=n.count,l=n.byteStride,f=new Uint8Array(a,o,c);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(d,l,f,n.mode,n.filter).then(function(p){return p.buffer}):i.ready.then(function(){const p=new ArrayBuffer(d*l);return i.decodeGltfBuffer(new Uint8Array(p),d,l,f,n.mode,n.filter),p})})}else return null}}class Me{constructor(t){this.name=A.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,r=e.nodes[t];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const n=e.meshes[r.mesh];for(const c of n.primitives)if(c.mode!==S.TRIANGLES&&c.mode!==S.TRIANGLE_STRIP&&c.mode!==S.TRIANGLE_FAN&&c.mode!==void 0)return null;const i=r.extensions[this.name].attributes,a=[],o={};for(const c in i)a.push(this.parser.getDependency("accessor",i[c]).then(d=>(o[c]=d,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const d=c.pop(),l=d.isGroup?d.children:[d],f=c[0].count,p=[];for(const m of l){const R=new u.Matrix4,g=new u.Vector3,T=new u.Quaternion,E=new u.Vector3(1,1,1),M=new u.InstancedMesh(m.geometry,m.material,f);for(let x=0;x<f;x++)o.TRANSLATION&&g.fromBufferAttribute(o.TRANSLATION,x),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,x),o.SCALE&&E.fromBufferAttribute(o.SCALE,x),M.setMatrixAt(x,R.compose(g,T,E));for(const x in o)if(x==="_COLOR_0"){const w=o[x];M.instanceColor=new u.InstancedBufferAttribute(w.array,w.itemSize,w.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&m.geometry.setAttribute(x,o[x]);u.Object3D.prototype.copy.call(M,m),this.parser.assignFinalMaterial(M),p.push(M)}return d.isGroup?(d.clear(),d.add(...p),d):p[0]}))}}const ne="glTF",H=12,J={JSON:1313821514,BIN:5130562};class Se{constructor(t){this.name=A.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,H),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==ne)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-H,s=new DataView(t,H);let i=0;for(;i<n;){const a=s.getUint32(i,!0);i+=4;const o=s.getUint32(i,!0);if(i+=4,o===J.JSON){const c=new Uint8Array(t,H+i,a);this.content=r.decode(c)}else if(o===J.BIN){const c=H+i;this.body=t.slice(c,c+a)}i+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class _e{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=A.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const r=this.json,n=this.dracoLoader,s=t.extensions[this.name].bufferView,i=t.extensions[this.name].attributes,a={},o={},c={};for(const d in i){const l=q[d]||d.toLowerCase();a[l]=i[d]}for(const d in t.attributes){const l=q[d]||d.toLowerCase();if(i[d]!==void 0){const f=r.accessors[t.attributes[d]],p=G[f.componentType];c[l]=p.name,o[l]=f.normalized===!0}}return e.getDependency("bufferView",s).then(function(d){return new Promise(function(l,f){n.decodeDracoFile(d,function(p){for(const m in p.attributes){const R=p.attributes[m],g=o[m];g!==void 0&&(R.normalized=g)}l(p)},a,c,u.LinearSRGBColorSpace,f)})})}}class ye{constructor(){this.name=A.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class we{constructor(){this.name=A.KHR_MESH_QUANTIZATION}}class se extends u.Interpolant{constructor(t,e,r,n){super(t,e,r,n)}copySampleValue_(t){const e=this.resultBuffer,r=this.sampleValues,n=this.valueSize,s=t*n*3+n;for(let i=0;i!==n;i++)e[i]=r[s+i];return e}interpolate_(t,e,r,n){const s=this.resultBuffer,i=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,d=n-e,l=(r-e)/d,f=l*l,p=f*l,m=t*c,R=m-c,g=-2*p+3*f,T=p-f,E=1-g,M=T-f+l;for(let x=0;x!==a;x++){const w=i[R+x+a],I=i[R+x+o]*d,_=i[m+x+a],k=i[m+x]*d;s[x]=E*w+M*I+g*_+T*k}return s}}const be=new u.Quaternion;class Ne extends se{interpolate_(t,e,r,n){const s=super.interpolate_(t,e,r,n);return be.fromArray(s).normalize().toArray(s),s}}const S={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},G={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$={9728:u.NearestFilter,9729:u.LinearFilter,9984:u.NearestMipmapNearestFilter,9985:u.LinearMipmapNearestFilter,9986:u.NearestMipmapLinearFilter,9987:u.LinearMipmapLinearFilter},ee={33071:u.ClampToEdgeWrapping,33648:u.MirroredRepeatWrapping,10497:u.RepeatWrapping},V={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},q={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"},O={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ie={CUBICSPLINE:void 0,LINEAR:u.InterpolateLinear,STEP:u.InterpolateDiscrete},X={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ce(h){return h.DefaultMaterial===void 0&&(h.DefaultMaterial=new u.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:u.FrontSide})),h.DefaultMaterial}function D(h,t,e){for(const r in e.extensions)h[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=e.extensions[r])}function N(h,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(h.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Oe(h,t,e){let r=!1,n=!1,s=!1;for(let c=0,d=t.length;c<d;c++){const l=t[c];if(l.POSITION!==void 0&&(r=!0),l.NORMAL!==void 0&&(n=!0),l.COLOR_0!==void 0&&(s=!0),r&&n&&s)break}if(!r&&!n&&!s)return Promise.resolve(h);const i=[],a=[],o=[];for(let c=0,d=t.length;c<d;c++){const l=t[c];if(r){const f=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):h.attributes.position;i.push(f)}if(n){const f=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):h.attributes.normal;a.push(f)}if(s){const f=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):h.attributes.color;o.push(f)}}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(o)]).then(function(c){const d=c[0],l=c[1],f=c[2];return r&&(h.morphAttributes.position=d),n&&(h.morphAttributes.normal=l),s&&(h.morphAttributes.color=f),h.morphTargetsRelative=!0,h})}function De(h,t){if(h.updateMorphTargets(),t.weights!==void 0)for(let e=0,r=t.weights.length;e<r;e++)h.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(h.morphTargetInfluences.length===e.length){h.morphTargetDictionary={};for(let r=0,n=e.length;r<n;r++)h.morphTargetDictionary[e[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Fe(h){let t;const e=h.extensions&&h.extensions[A.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+z(e.attributes):t=h.indices+":"+z(h.attributes)+":"+h.mode,h.targets!==void 0)for(let r=0,n=h.targets.length;r<n;r++)t+=":"+z(h.targets[r]);return t}function z(h){let t="";const e=Object.keys(h).sort();for(let r=0,n=e.length;r<n;r++)t+=e[r]+":"+h[e[r]]+";";return t}function W(h){switch(h){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.")}}function Pe(h){return h.search(/\.jpe?g($|\?)/i)>0||h.search(/^data\:image\/jpeg/)===0?"image/jpeg":h.search(/\.webp($|\?)/i)>0||h.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ge=new u.Matrix4;class ke{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new ie,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,n=-1,s=!1,i=-1;if(typeof navigator!="undefined"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);n=r&&o?parseInt(o[1],10):-1,s=a.indexOf("Firefox")>-1,i=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap=="undefined"||r&&n<17||s&&i<98?this.textureLoader=new u.TextureLoader(this.options.manager):this.textureLoader=new u.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new u.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const r=this,n=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(i){const a={scene:i[0][n.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:n.asset,parser:r,userData:{}};return D(s,a,n),N(a,n),Promise.all(r._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[];for(let n=0,s=e.length;n<s;n++){const i=e[n].joints;for(let a=0,o=i.length;a<o;a++)t[i[a]].isBone=!0}for(let n=0,s=t.length;n<s;n++){const i=t[n];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(r[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,r){if(t.refs[e]<=1)return r;const n=r.clone(),s=(i,a)=>{const o=this.associations.get(i);o!=null&&this.associations.set(a,o);for(const[c,d]of i.children.entries())s(d,a.children[c])};return s(r,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let r=0;r<e.length;r++){const n=t(e[r]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const r=[];for(let n=0;n<e.length;n++){const s=t(e[n]);s&&r.push(s)}return r}getDependency(t,e){const r=t+":"+e;let n=this.cache.get(r);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(s){return s.loadNode&&s.loadNode(e)});break;case"mesh":n=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t);break}this.cache.add(r,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const r=this,n=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(n.map(function(s,i){return r.getDependency(t,i)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],r=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[A.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(s,i){r.load(u.LoaderUtils.resolveURL(e.uri,n.path),s,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(r){const n=e.byteLength||0,s=e.byteOffset||0;return r.slice(s,s+n)})}loadAccessor(t){const e=this,r=this.json,n=this.json.accessors[t];if(n.bufferView===void 0&&n.sparse===void 0){const i=V[n.type],a=G[n.componentType],o=n.normalized===!0,c=new a(n.count*i);return Promise.resolve(new u.BufferAttribute(c,i,o))}const s=[];return n.bufferView!==void 0?s.push(this.getDependency("bufferView",n.bufferView)):s.push(null),n.sparse!==void 0&&(s.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(s).then(function(i){const a=i[0],o=V[n.type],c=G[n.componentType],d=c.BYTES_PER_ELEMENT,l=d*o,f=n.byteOffset||0,p=n.bufferView!==void 0?r.bufferViews[n.bufferView].byteStride:void 0,m=n.normalized===!0;let R,g;if(p&&p!==l){const T=Math.floor(f/p),E="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+T+":"+n.count;let M=e.cache.get(E);M||(R=new c(a,T*p,n.count*p/d),M=new u.InterleavedBuffer(R,p/d),e.cache.add(E,M)),g=new u.InterleavedBufferAttribute(M,o,f%p/d,m)}else a===null?R=new c(n.count*o):R=new c(a,f,n.count*o),g=new u.BufferAttribute(R,o,m);if(n.sparse!==void 0){const T=V.SCALAR,E=G[n.sparse.indices.componentType],M=n.sparse.indices.byteOffset||0,x=n.sparse.values.byteOffset||0,w=new E(i[1],M,n.sparse.count*T),I=new c(i[2],x,n.sparse.count*o);a!==null&&(g=new u.BufferAttribute(g.array.slice(),g.itemSize,g.normalized));for(let _=0,k=w.length;_<k;_++){const C=w[_];if(g.setX(C,I[_*o]),o>=2&&g.setY(C,I[_*o+1]),o>=3&&g.setZ(C,I[_*o+2]),o>=4&&g.setW(C,I[_*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}loadTexture(t){const e=this.json,r=this.options,s=e.textures[t].source,i=e.images[s];let a=this.textureLoader;if(i.uri){const o=r.manager.getHandler(i.uri);o!==null&&(a=o)}return this.loadTextureImage(t,s,a)}loadTextureImage(t,e,r){const n=this,s=this.json,i=s.textures[t],a=s.images[e],o=(a.uri||a.bufferView)+":"+i.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,r).then(function(d){d.flipY=!1,d.name=i.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const f=(s.samplers||{})[i.sampler]||{};return d.magFilter=$[f.magFilter]||u.LinearFilter,d.minFilter=$[f.minFilter]||u.LinearMipmapLinearFilter,d.wrapS=ee[f.wrapS]||u.RepeatWrapping,d.wrapT=ee[f.wrapT]||u.RepeatWrapping,n.associations.set(d,{textures:t}),d}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){const r=this,n=this.json,s=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(l=>l.clone());const i=n.images[t],a=self.URL||self.webkitURL;let o=i.uri||"",c=!1;if(i.bufferView!==void 0)o=r.getDependency("bufferView",i.bufferView).then(function(l){c=!0;const f=new Blob([l],{type:i.mimeType});return o=a.createObjectURL(f),o});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const d=Promise.resolve(o).then(function(l){return new Promise(function(f,p){let m=f;e.isImageBitmapLoader===!0&&(m=function(R){const g=new u.Texture(R);g.needsUpdate=!0,f(g)}),e.load(u.LoaderUtils.resolveURL(l,s.path),m,void 0,p)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),N(l,i),l.userData.mimeType=i.mimeType||Pe(i.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[t]=d,d}assignTexture(t,e,r,n){const s=this;return this.getDependency("texture",r.index).then(function(i){if(!i)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(i=i.clone(),i.channel=r.texCoord),s.extensions[A.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[A.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=s.associations.get(i);i=s.extensions[A.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),s.associations.set(i,o)}}return n!==void 0&&(i.colorSpace=n),t[e]=i,i})}assignFinalMaterial(t){const e=t.geometry;let r=t.material;const n=e.attributes.tangent===void 0,s=e.attributes.color!==void 0,i=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+r.uuid;let o=this.cache.get(a);o||(o=new u.PointsMaterial,u.Material.prototype.copy.call(o,r),o.color.copy(r.color),o.map=r.map,o.sizeAttenuation=!1,this.cache.add(a,o)),r=o}else if(t.isLine){const a="LineBasicMaterial:"+r.uuid;let o=this.cache.get(a);o||(o=new u.LineBasicMaterial,u.Material.prototype.copy.call(o,r),o.color.copy(r.color),o.map=r.map,this.cache.add(a,o)),r=o}if(n||s||i){let a="ClonedMaterial:"+r.uuid+":";n&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),i&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=r.clone(),s&&(o.vertexColors=!0),i&&(o.flatShading=!0),n&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(r))),r=o}t.material=r}getMaterialType(){return u.MeshStandardMaterial}loadMaterial(t){const e=this,r=this.json,n=this.extensions,s=r.materials[t];let i;const a={},o=s.extensions||{},c=[];if(o[A.KHR_MATERIALS_UNLIT]){const l=n[A.KHR_MATERIALS_UNLIT];i=l.getMaterialType(),c.push(l.extendParams(a,s,e))}else{const l=s.pbrMetallicRoughness||{};if(a.color=new u.Color(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const f=l.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],u.LinearSRGBColorSpace),a.opacity=f[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,u.SRGBColorSpace)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),i=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(t,a)})))}s.doubleSided===!0&&(a.side=u.DoubleSide);const d=s.alphaMode||X.OPAQUE;if(d===X.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===X.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&i!==u.MeshBasicMaterial&&(c.push(e.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new u.Vector2(1,1),s.normalTexture.scale!==void 0)){const l=s.normalTexture.scale;a.normalScale.set(l,l)}if(s.occlusionTexture!==void 0&&i!==u.MeshBasicMaterial&&(c.push(e.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&i!==u.MeshBasicMaterial){const l=s.emissiveFactor;a.emissive=new u.Color().setRGB(l[0],l[1],l[2],u.LinearSRGBColorSpace)}return s.emissiveTexture!==void 0&&i!==u.MeshBasicMaterial&&c.push(e.assignTexture(a,"emissiveMap",s.emissiveTexture,u.SRGBColorSpace)),Promise.all(c).then(function(){const l=new i(a);return s.name&&(l.name=s.name),N(l,s),e.associations.set(l,{materials:t}),s.extensions&&D(n,l,s),l})}createUniqueName(t){const e=u.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,r=this.extensions,n=this.primitiveCache;function s(a){return r[A.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return te(o,a,e)})}const i=[];for(let a=0,o=t.length;a<o;a++){const c=t[a],d=Fe(c),l=n[d];if(l)i.push(l.promise);else{let f;c.extensions&&c.extensions[A.KHR_DRACO_MESH_COMPRESSION]?f=s(c):f=te(new u.BufferGeometry,c,e),n[d]={primitive:c,promise:f},i.push(f)}}return Promise.all(i)}loadMesh(t){const e=this,r=this.json,n=this.extensions,s=r.meshes[t],i=s.primitives,a=[];for(let o=0,c=i.length;o<c;o++){const d=i[o].material===void 0?Ce(this.cache):this.getDependency("material",i[o].material);a.push(d)}return a.push(e.loadGeometries(i)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),d=o[o.length-1],l=[];for(let p=0,m=d.length;p<m;p++){const R=d[p],g=i[p];let T;const E=c[p];if(g.mode===S.TRIANGLES||g.mode===S.TRIANGLE_STRIP||g.mode===S.TRIANGLE_FAN||g.mode===void 0)T=s.isSkinnedMesh===!0?new u.SkinnedMesh(R,E):new u.Mesh(R,E),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),g.mode===S.TRIANGLE_STRIP?T.geometry=Z(T.geometry,u.TriangleStripDrawMode):g.mode===S.TRIANGLE_FAN&&(T.geometry=Z(T.geometry,u.TriangleFanDrawMode));else if(g.mode===S.LINES)T=new u.LineSegments(R,E);else if(g.mode===S.LINE_STRIP)T=new u.Line(R,E);else if(g.mode===S.LINE_LOOP)T=new u.LineLoop(R,E);else if(g.mode===S.POINTS)T=new u.Points(R,E);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);Object.keys(T.geometry.morphAttributes).length>0&&De(T,s),T.name=e.createUniqueName(s.name||"mesh_"+t),N(T,s),g.extensions&&D(n,T,g),e.assignFinalMaterial(T),l.push(T)}for(let p=0,m=l.length;p<m;p++)e.associations.set(l[p],{meshes:t,primitives:p});if(l.length===1)return s.extensions&&D(n,l[0],s),l[0];const f=new u.Group;s.extensions&&D(n,f,s),e.associations.set(f,{meshes:t});for(let p=0,m=l.length;p<m;p++)f.add(l[p]);return f})}loadCamera(t){let e;const r=this.json.cameras[t],n=r[r.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?e=new u.PerspectiveCamera(u.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):r.type==="orthographic"&&(e=new u.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(e.name=this.createUniqueName(r.name)),N(e,r),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],r=[];for(let n=0,s=e.joints.length;n<s;n++)r.push(this._loadNodeShallow(e.joints[n]));return e.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",e.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(n){const s=n.pop(),i=n,a=[],o=[];for(let c=0,d=i.length;c<d;c++){const l=i[c];if(l){a.push(l);const f=new u.Matrix4;s!==null&&f.fromArray(s.array,c*16),o.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new u.Skeleton(a,o)})}loadAnimation(t){const e=this.json,r=this,n=e.animations[t],s=n.name?n.name:"animation_"+t,i=[],a=[],o=[],c=[],d=[];for(let l=0,f=n.channels.length;l<f;l++){const p=n.channels[l],m=n.samplers[p.sampler],R=p.target,g=R.node,T=n.parameters!==void 0?n.parameters[m.input]:m.input,E=n.parameters!==void 0?n.parameters[m.output]:m.output;R.node!==void 0&&(i.push(this.getDependency("node",g)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",E)),c.push(m),d.push(R))}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(d)]).then(function(l){const f=l[0],p=l[1],m=l[2],R=l[3],g=l[4],T=[];for(let E=0,M=f.length;E<M;E++){const x=f[E],w=p[E],I=m[E],_=R[E],k=g[E];if(x===void 0)continue;x.updateMatrix&&x.updateMatrix();const C=r._createAnimationTracks(x,w,I,_,k);if(C)for(let j=0;j<C.length;j++)T.push(C[j])}return new u.AnimationClip(s,void 0,T)})}createNodeMesh(t){const e=this.json,r=this,n=e.nodes[t];return n.mesh===void 0?null:r.getDependency("mesh",n.mesh).then(function(s){const i=r._getNodeRef(r.meshCache,n.mesh,s);return n.weights!==void 0&&i.traverse(function(a){if(a.isMesh)for(let o=0,c=n.weights.length;o<c;o++)a.morphTargetInfluences[o]=n.weights[o]}),i})}loadNode(t){const e=this.json,r=this,n=e.nodes[t],s=r._loadNodeShallow(t),i=[],a=n.children||[];for(let c=0,d=a.length;c<d;c++)i.push(r.getDependency("node",a[c]));const o=n.skin===void 0?Promise.resolve(null):r.getDependency("skin",n.skin);return Promise.all([s,Promise.all(i),o]).then(function(c){const d=c[0],l=c[1],f=c[2];f!==null&&d.traverse(function(p){p.isSkinnedMesh&&p.bind(f,Ge)});for(let p=0,m=l.length;p<m;p++)d.add(l[p]);return d})}_loadNodeShallow(t){const e=this.json,r=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const s=e.nodes[t],i=s.name?n.createUniqueName(s.name):"",a=[],o=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return o&&a.push(o),s.camera!==void 0&&a.push(n.getDependency("camera",s.camera).then(function(c){return n._getNodeRef(n.cameraCache,s.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let d;if(s.isBone===!0?d=new u.Bone:c.length>1?d=new u.Group:c.length===1?d=c[0]:d=new u.Object3D,d!==c[0])for(let l=0,f=c.length;l<f;l++)d.add(c[l]);if(s.name&&(d.userData.name=s.name,d.name=i),N(d,s),s.extensions&&D(r,d,s),s.matrix!==void 0){const l=new u.Matrix4;l.fromArray(s.matrix),d.applyMatrix4(l)}else s.translation!==void 0&&d.position.fromArray(s.translation),s.rotation!==void 0&&d.quaternion.fromArray(s.rotation),s.scale!==void 0&&d.scale.fromArray(s.scale);return n.associations.has(d)||n.associations.set(d,{}),n.associations.get(d).nodes=t,d}),this.nodeCache[t]}loadScene(t){const e=this.extensions,r=this.json.scenes[t],n=this,s=new u.Group;r.name&&(s.name=n.createUniqueName(r.name)),N(s,r),r.extensions&&D(e,s,r);const i=r.nodes||[],a=[];for(let o=0,c=i.length;o<c;o++)a.push(n.getDependency("node",i[o]));return Promise.all(a).then(function(o){for(let d=0,l=o.length;d<l;d++)s.add(o[d]);const c=d=>{const l=new Map;for(const[f,p]of n.associations)(f instanceof u.Material||f instanceof u.Texture)&&l.set(f,p);return d.traverse(f=>{const p=n.associations.get(f);p!=null&&l.set(f,p)}),l};return n.associations=c(s),s})}_createAnimationTracks(t,e,r,n,s){const i=[],a=t.name?t.name:t.uuid,o=[];O[s.path]===O.weights?t.traverse(function(f){f.morphTargetInfluences&&o.push(f.name?f.name:f.uuid)}):o.push(a);let c;switch(O[s.path]){case O.weights:c=u.NumberKeyframeTrack;break;case O.rotation:c=u.QuaternionKeyframeTrack;break;case O.position:case O.scale:c=u.VectorKeyframeTrack;break;default:switch(r.itemSize){case 1:c=u.NumberKeyframeTrack;break;case 2:case 3:default:c=u.VectorKeyframeTrack;break}break}const d=n.interpolation!==void 0?Ie[n.interpolation]:u.InterpolateLinear,l=this._getArrayFromAccessor(r);for(let f=0,p=o.length;f<p;f++){const m=new c(o[f]+"."+O[s.path],e.array,l,d);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),i.push(m)}return i}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const r=W(e.constructor),n=new Float32Array(e.length);for(let s=0,i=e.length;s<i;s++)n[s]=e[s]*r;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(r){const n=this instanceof u.QuaternionKeyframeTrack?Ne:se;return new n(this.times,this.values,this.getValueSize()/3,r)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Be(h,t,e){const r=t.attributes,n=new u.Box3;if(r.POSITION!==void 0){const a=e.json.accessors[r.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(n.set(new u.Vector3(o[0],o[1],o[2]),new u.Vector3(c[0],c[1],c[2])),a.normalized){const d=W(G[a.componentType]);n.min.multiplyScalar(d),n.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=t.targets;if(s!==void 0){const a=new u.Vector3,o=new u.Vector3;for(let c=0,d=s.length;c<d;c++){const l=s[c];if(l.POSITION!==void 0){const f=e.json.accessors[l.POSITION],p=f.min,m=f.max;if(p!==void 0&&m!==void 0){if(o.setX(Math.max(Math.abs(p[0]),Math.abs(m[0]))),o.setY(Math.max(Math.abs(p[1]),Math.abs(m[1]))),o.setZ(Math.max(Math.abs(p[2]),Math.abs(m[2]))),f.normalized){const R=W(G[f.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}h.boundingBox=n;const i=new u.Sphere;n.getCenter(i.center),i.radius=n.min.distanceTo(n.max)/2,h.boundingSphere=i}function te(h,t,e){const r=t.attributes,n=[];function s(i,a){return e.getDependency("accessor",i).then(function(o){h.setAttribute(a,o)})}for(const i in r){const a=q[i]||i.toLowerCase();a in h.attributes||n.push(s(r[i],a))}if(t.indices!==void 0&&!h.index){const i=e.getDependency("accessor",t.indices).then(function(a){h.setIndex(a)});n.push(i)}return u.ColorManagement.workingColorSpace!==u.LinearSRGBColorSpace&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${u.ColorManagement.workingColorSpace}" not supported.`),N(h,t),Be(h,t,e),Promise.all(n).then(function(){return t.targets!==void 0?Oe(h,t.targets,e):h})}var F;class He{constructor(){B(this,F,new re)}get gltfLoader(){return y(this,F)}setLoaders(t){if(t!=null&&t.draco&&b.dracoLoader){const e=typeof t.draco=="boolean"?`${L.en3.CDNVersion}/examples/jsm/libs/draco/gltf/`:t.draco;b.dracoLoader.setDecoderPath(e),y(this,F).setDRACOLoader(b.dracoLoader)}if(t!=null&&t.ktx2&&b.ktx2Loader){const e=typeof t.ktx2=="boolean"?`${L.en3.CDNVersion}/examples/jsm/libs/basis/`:t.ktx2;b.ktx2Loader.setTranscoderPath(e),y(this,F).setKTX2Loader(b.ktx2Loader.detectSupport(L.en3.webglRenderer))}t!=null&&t.meshopt&&b.meshoptDecoder&&y(this,F).setMeshoptDecoder(b.meshoptDecoder)}load(...t){const[e,r,...n]=t;if(L.en3.cacheAssets&&L.en3Cache.has(e)){const s=L.en3Cache.get(e).data;r(s)}else this.gltfLoader.load(e,s=>{L.en3.cacheAssets&&L.en3Cache.set(e,{data:s,dispose:()=>{s.cameras.forEach(i=>L.dispose(i)),s.scenes.forEach(i=>{L.dispose(i)})}}),r(s)},...n)}}F=new WeakMap;var P,U,v;class Ue{constructor(){B(this,P,new u.TextureLoader);B(this,U,void 0);B(this,v,void 0);K(this,U,y(this,P).load.bind(y(this,P))),K(this,v,y(this,P).loadAsync.bind(y(this,P)))}load(...t){const[e,r,...n]=t;if(L.en3.cacheAssets&&L.en3Cache.has(e)){const s=L.en3Cache.get(e);return r==null||r(s.data),s.data}return y(this,U).call(this,e,s=>{L.en3.cacheAssets&&L.en3Cache.set(e,{data:s,dispose:()=>s.dispose()}),r==null||r(s)},...n)}loadSync(...t){return Q(this,null,function*(){const[e,...r]=t;if(L.en3.cacheAssets&&L.en3Cache.has(e))return L.en3Cache.get(e).data;const n=yield y(this,v).call(this,e,...r);return L.en3.cacheAssets&&L.en3Cache.set(e,{data:n,dispose:()=>n.dispose()}),n})}}P=new WeakMap,U=new WeakMap,v=new WeakMap;const b={gltfLoader:null,textureLoader:null,dracoLoader:null,ktx2Loader:null,meshoptDecoder:null};exports.En3GLTFLoader=He;exports.En3TextureLoader=Ue;exports.loaders=b;
|
package/lib/en3/loaders/index.js
CHANGED
|
@@ -24,7 +24,7 @@ var ue = (d, t, e) => new Promise((r, n) => {
|
|
|
24
24
|
a((e = e.apply(d, t)).next());
|
|
25
25
|
});
|
|
26
26
|
import { TrianglesDrawMode as De, TriangleFanDrawMode as re, TriangleStripDrawMode as Ee, Loader as Fe, LoaderUtils as X, FileLoader as Le, Color as G, LinearSRGBColorSpace as I, SpotLight as Pe, PointLight as ke, DirectionalLight as He, MeshBasicMaterial as V, SRGBColorSpace as z, MeshPhysicalMaterial as y, Vector2 as _e, Matrix4 as Y, Vector3 as B, Quaternion as Se, InstancedMesh as Ge, InstancedBufferAttribute as Be, Object3D as Me, TextureLoader as ye, ImageBitmapLoader as Ue, BufferAttribute as J, InterleavedBuffer as ve, InterleavedBufferAttribute as je, LinearFilter as we, LinearMipmapLinearFilter as be, RepeatWrapping as ie, PointsMaterial as Ke, Material as $, LineBasicMaterial as Ve, MeshStandardMaterial as Ne, DoubleSide as Xe, PropertyBinding as ze, BufferGeometry as qe, SkinnedMesh as We, Mesh as Ye, LineSegments as Qe, Line as Ze, LineLoop as Je, Points as $e, Group as ee, PerspectiveCamera as et, MathUtils as tt, OrthographicCamera as nt, Skeleton as st, AnimationClip as rt, Bone as it, InterpolateLinear as Ie, ColorManagement as le, NearestFilter as ot, NearestMipmapNearestFilter as at, LinearMipmapNearestFilter as ct, NearestMipmapLinearFilter as ut, ClampToEdgeWrapping as lt, MirroredRepeatWrapping as dt, InterpolateDiscrete as ft, FrontSide as ht, Texture as de, VectorKeyframeTrack as fe, NumberKeyframeTrack as he, QuaternionKeyframeTrack as pe, Box3 as pt, Sphere as mt, Interpolant as At } from "three";
|
|
27
|
-
import { e as N, a as b, d as me } from "../../en3-
|
|
27
|
+
import { e as N, a as b, d as me } from "../../en3-CsNHRA0v.js";
|
|
28
28
|
function Ae(d, t) {
|
|
29
29
|
if (t === De)
|
|
30
30
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
|
package/lib/en3/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../../en3-BQMd-J6t.cjs"),c=require("../../traverseMaterials-Crv7f9BJ.cjs"),M=require("three");function d(e,t,r){const s=t.x,i=t.y,o=r||e.image.width/e.image.height;let a=0,n=0,l=e.offset.x,f=e.offset.y,v=e.rotation,h=e.center.x,g=e.center.y;s/i>o?(a=1,n=i/s*o):(n=1,a=s/i/o),e.matrix.setUvTransform(l,f,a,n,v,h,g)}function m(e,t){e.traverse(r=>{r instanceof M.Mesh&&t(r)})}exports.dispose=y.dispose;exports.getCurrentViewport=c.getCurrentViewport;exports.traverseMaterials=c.traverseMaterials;exports.coverTexture=d;exports.traverseMeshes=m;
|
package/lib/en3/utils/index.js
CHANGED
|
@@ -1,43 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
let
|
|
7
|
-
|
|
1
|
+
import { d as w } from "../../en3-CsNHRA0v.js";
|
|
2
|
+
import { g as T, t as C } from "../../traverseMaterials-B87RMkV0.js";
|
|
3
|
+
import { Mesh as g } from "three";
|
|
4
|
+
function y(t, e, s) {
|
|
5
|
+
const o = e.x, r = e.y, i = s || t.image.width / t.image.height;
|
|
6
|
+
let a = 0, f = 0, c = t.offset.x, n = t.offset.y, h = t.rotation, l = t.center.x, m = t.center.y;
|
|
7
|
+
o / r > i ? (a = 1, f = r / o * i) : (f = 1, a = o / r / i), t.matrix.setUvTransform(c, n, a, f, h, l, m);
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
t instanceof h ? m.copy(t) : m.set(...t);
|
|
13
|
-
const i = e.camera.getWorldPosition(d).distanceTo(m);
|
|
14
|
-
if (e.camera instanceof y)
|
|
15
|
-
return {
|
|
16
|
-
width: a / e.camera.zoom,
|
|
17
|
-
height: s / e.camera.zoom,
|
|
18
|
-
factor: 1,
|
|
19
|
-
distance: i,
|
|
20
|
-
aspect: r
|
|
21
|
-
};
|
|
22
|
-
{
|
|
23
|
-
const c = e.camera.fov * Math.PI / 180, n = 2 * Math.tan(c / 2) * i, f = n * (a / s);
|
|
24
|
-
return { width: f, height: n, factor: a / f, distance: i, aspect: r };
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function u(t, o) {
|
|
28
|
-
t.traverse((e) => {
|
|
29
|
-
e instanceof p && e.material && (Array.isArray(e.material) ? e.material : [e.material]).forEach(o);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
function A(t, o) {
|
|
33
|
-
t.traverse((e) => {
|
|
34
|
-
e instanceof p && o(e);
|
|
9
|
+
function v(t, e) {
|
|
10
|
+
t.traverse((s) => {
|
|
11
|
+
s instanceof g && e(s);
|
|
35
12
|
});
|
|
36
13
|
}
|
|
37
14
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
15
|
+
y as coverTexture,
|
|
16
|
+
w as dispose,
|
|
17
|
+
T as getCurrentViewport,
|
|
18
|
+
C as traverseMaterials,
|
|
19
|
+
v as traverseMeshes
|
|
43
20
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";var he=Object.defineProperty,ae=Object.defineProperties;var ce=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var le=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var Z=(n,e,i)=>e in n?he(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,O=(n,e)=>{for(var i in e||(e={}))le.call(e,i)&&Z(n,i,e[i]);if(X)for(var i of X(e))de.call(e,i)&&Z(n,i,e[i]);return n},J=(n,e)=>ae(n,ce(e));var Q=(n,e,i)=>{if(!e.has(n))throw TypeError("Cannot "+i)};var t=(n,e,i)=>(Q(n,e,"read from private field"),i?i.call(n):e.get(n)),s=(n,e,i)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,i)},r=(n,e,i,a)=>(Q(n,e,"write to private field"),a?a.call(n,i):e.set(n,i),i);const ee=require("./order/index.cjs"),te=require("./window-resizer/index.cjs"),ie=require("./ticker/index.cjs"),re=require("./dom-JBOkFLTh.cjs"),E=require("three"),se=require("./layout-box/index.cjs");function ne(n){const e=i=>{i.dispose();for(const a of Object.keys(i)){const l=i[a];l&&typeof l=="object"&&"minFilter"in l&&l.dispose()}};n.traverse(i=>{if(i instanceof E.Mesh){if(i.geometry.dispose(),!Array.isArray(i.material)&&i.material.isMaterial)e(i.material);else if(Array.isArray(i.material))for(const a of i.material)e(a)}})}var L,c,p,y,x,C,w,D;class G{constructor(e,i){s(this,L,void 0);s(this,c,void 0);s(this,p,void 0);s(this,y,void 0);s(this,x,void 0);s(this,C,void 0);s(this,w,void 0);s(this,D,void 0);r(this,L,e),r(this,c,(i==null?void 0:i.cameraType)==="orthographic"?new E.OrthographicCamera:new E.PerspectiveCamera),r(this,p,new E.Scene),r(this,y,[]),r(this,x,(i==null?void 0:i.cameraDistance)||1e3),t(this,c).near=(i==null?void 0:i.cameraNear)||1,t(this,c).far=(i==null?void 0:i.cameraFar)||11e3,r(this,C,(i==null?void 0:i.cameraFov)||"auto"),t(this,c).position.z=t(this,x),t(this,c).name=`Cameras.${t(this,L)}`,r(this,w,re.getElement(i==null?void 0:i.sizeElement)||document.documentElement),this.beforeRenderCallback=i==null?void 0:i.beforeRender,r(this,D,new se.LayoutBox(t(this,w))),t(this,D).onResize(()=>{this.resize()})}get name(){return t(this,L)}get camera(){return t(this,c)}get scene(){return t(this,p)}get box(){return t(this,D)}get cameraDistance(){return t(this,x)}set cameraDistance(e){r(this,x,e),this.resize()}get sizeElement(){return t(this,w)}get isClipped(){return t(this,w)!==m.containerElement}resize(){const{width:e,height:i}=t(this,D);t(this,c).userData.controlled||(t(this,c).position.z=t(this,x)),t(this,c)instanceof E.PerspectiveCamera?(t(this,c).aspect=e/i,t(this,c).fov=t(this,C)==="auto"?2*Math.atan(i/2/t(this,x))*(180/Math.PI):t(this,c).userData.controlled?t(this,c).fov:t(this,C)):t(this,c)instanceof E.OrthographicCamera&&(t(this,c).left=e/-2,t(this,c).right=e/2,t(this,c).top=i/2,t(this,c).bottom=i/-2),t(this,c).updateProjectionMatrix()}destroy(){t(this,y).forEach(e=>{e.userData.box.destroy()}),t(this,p).clear(),ne(t(this,p)),m.destroyView(this.name),t(this,D).destroy()}attachToHTMLElement(e,i,a){const l=new se.LayoutBox(e,J(O({},a),{containerElement:t(this,w),cartesian:!0,scrollStep:!this.isClipped}));return l.bindObject(i),i.userData.box=l,t(this,y).push(i),i}detachFromHTMLElement(e){r(this,y,t(this,y).filter(i=>i===e?(e.userData.box.destroy(),!1):!0))}add(...e){const i=e[0],a=e[1],l=e[2];return a&&this.attachToHTMLElement(a,i,l),this.scene.add(i),i}remove(e,i){this.scene.remove(e),i&&this.detachFromHTMLElement(e)}}L=new WeakMap,c=new WeakMap,p=new WeakMap,y=new WeakMap,x=new WeakMap,C=new WeakMap,w=new WeakMap,D=new WeakMap;const W=new Map;var v,P,k,R,j;class oe{constructor(e){s(this,v,void 0);s(this,P,void 0);s(this,k,void 0);s(this,R,void 0);s(this,j,void 0);r(this,v,e.targetName||void 0),r(this,P,e.eventDispatcher||e.object3D),r(this,k,e.propagation||!1),r(this,R,e.object3D),r(this,j,t(this,v)?()=>t(this,R).getObjectByName(t(this,v))||t(this,R):()=>t(this,R))}get object3D(){return t(this,R)}get eventDispatcher(){return t(this,P)}get propagation(){return t(this,k)}get target(){return t(this,j).call(this)}dispatch(e,i){this.eventDispatcher.dispatchEvent(O({originalEvent:i,type:e},this.intersection))}}v=new WeakMap,P=new WeakMap,k=new WeakMap,R=new WeakMap,j=new WeakMap;var f,o,T,A,F,N,q;class ue{constructor(){s(this,f,[]);s(this,o,[]);s(this,T,new E.Vector2);s(this,A,new E.Raycaster);s(this,F,e=>{for(let i=0;i<t(this,o).length;i++)t(this,o)[i].dispatch("pointerDown",e)});s(this,N,e=>{for(let i=0;i<t(this,o).length;i++)t(this,o)[i].dispatch("pointerUp",e)});s(this,q,e=>{if(!t(this,f).length)return;t(this,T).x=e.clientX/m.width*2-1,t(this,T).y=-(e.clientY/m.height)*2+1,m.camera&&t(this,A).setFromCamera(t(this,T),m.camera);const i=[];for(const h of t(this,f)){const b=t(this,A).intersectObject(h.target);b.length&&(h.intersection=b[0],i.push(h))}let a=!1;const l=t(this,o).filter(h=>!i.find(b=>b.object3D.uuid===h.object3D.uuid)),K=i.sort((h,b)=>b.object3D.position.z-h.object3D.position.z).filter((h,b)=>a?(l.push(h),!1):(a=!h.propagation,!0)),U=K.filter(h=>!t(this,o).find(b=>b.object3D.uuid===h.object3D.uuid));for(let h=0;h<l.length;h++)l[h].dispatch("pointerLeave",e);for(let h=0;h<U.length;h++)U[h].dispatch("pointerEnter",e);r(this,o,K);for(let h=0;h<t(this,o).length;h++)t(this,o)[h].dispatch("pointerMove",e)});m.containerElement.addEventListener("pointerdown",t(this,F)),m.containerElement.addEventListener("pointerup",t(this,N)),m.containerElement.addEventListener("pointermove",t(this,q))}destroy(){m.containerElement.removeEventListener("pointerdown",t(this,F)),m.containerElement.removeEventListener("pointerup",t(this,N)),m.containerElement.removeEventListener("pointermove",t(this,q)),r(this,f,[]),r(this,o,[])}add(e,i){if(t(this,f).find(l=>l.object3D.uuid===e.uuid))return;const a=new oe(O({object3D:e},i));t(this,f).push(a)}remove(e){r(this,f,t(this,f).filter(i=>i.object3D.uuid!==e.uuid)),r(this,o,t(this,o).filter(i=>i.object3D.uuid!==e.uuid))}}f=new WeakMap,o=new WeakMap,T=new WeakMap,A=new WeakMap,F=new WeakMap,N=new WeakMap,q=new WeakMap;var $,g,d,V,u,M,S,H,I,z,_,B,Y;class me{constructor(){s(this,$,`https://unpkg.com/three@0.${E.REVISION}.x`);s(this,g,null);s(this,d,null);s(this,V,null);s(this,u,new Map);s(this,M,0);s(this,S,0);s(this,H,0);s(this,I,2);s(this,z,!1);s(this,_,!1);s(this,B,()=>{r(this,M,t(this,g).clientWidth),r(this,S,t(this,g).clientHeight),r(this,H,Math.min(t(this,I),devicePixelRatio||1)),t(this,d).setPixelRatio(t(this,H)),t(this,d).setSize(t(this,M),t(this,S))});s(this,Y,()=>{t(this,d).setRenderTarget(null),t(this,u).forEach(e=>{this.render(e)})})}get CDNVersion(){return t(this,$)}get containerElement(){return t(this,g)}get webglRenderer(){return t(this,d)}get raycaster(){return t(this,V)}get views(){return t(this,u)}get view(){return this.getView("default")}get camera(){return this.getView("default").camera}get scene(){return this.getView("default").scene}get width(){return t(this,M)}get height(){return t(this,S)}get pixelRatio(){return t(this,H)}get cacheAssets(){return t(this,_)}setup(e){if(t(this,z)){console.warn("[en3.setup]: You are trying to setup en3 again.");return}r(this,g,re.getElement(e==null?void 0:e.containerElement)||document.body),r(this,I,(e==null?void 0:e.maxPixelRatio)||2),r(this,d,new E.WebGLRenderer(e==null?void 0:e.webGLRendererParameters)),t(this,d).domElement.style.cssText=`
|
|
2
|
+
position: fixed;
|
|
3
|
+
left: 0;
|
|
4
|
+
top: 0;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
z-index: ${(e==null?void 0:e.zIndex)||0};
|
|
8
|
+
`,(t(this,g).shadowRoot||t(this,g)).append(t(this,d).domElement),t(this,u).set("default",new G("default",O({sizeElement:t(this,g)},e==null?void 0:e.view))),r(this,V,new ue),r(this,_,(e==null?void 0:e.cacheAssets)||!1),r(this,z,!0),te.windowResizer.subscribe(t(this,B),ee.RESIZE_ORDER.EN3),ie.ticker.subscribe(t(this,Y),{order:ee.TICK_ORDER.EN3})}destroy(){if(!t(this,z)){console.warn("[en3.setup]: You are trying to destory en3 but it has not been initialized.");return}te.windowResizer.unsubscribe(t(this,B)),ie.ticker.unsubscribe(t(this,Y)),t(this,V).destroy(),t(this,u).forEach(e=>{e.destroy()}),t(this,d).dispose(),t(this,d).domElement.remove(),r(this,d,null),r(this,z,!1),W.forEach(e=>{e.dispose()}),W.clear()}createView(e,i){const a=t(this,u).size,l=new G(e,i);return t(this,u).set(e,l),a===1&&t(this,d).setScissorTest(!0),l}getView(e){return t(this,u).get(e)}destroyView(e){const i=t(this,u).get(e);i&&(t(this,u).delete(e),i.destroy(),t(this,u).size<=1&&t(this,d).setScissorTest(!1))}render(e){var i;if(t(this,u).size>1||this.view.isClipped){const a=e.box.left+e.box.CSSTranslation.x+e.box.scrollValue.x,l=m.height-e.box.height-e.box.top+e.box.CSSTranslation.y+e.box.scrollValue.y*-1;t(this,d).setScissor(a,l,e.box.width,e.box.height),t(this,d).setViewport(a,l,e.box.width,e.box.height)}(i=e.beforeRenderCallback)==null||i.call(e),t(this,d).render(e.scene,e.camera)}}$=new WeakMap,g=new WeakMap,d=new WeakMap,V=new WeakMap,u=new WeakMap,M=new WeakMap,S=new WeakMap,H=new WeakMap,I=new WeakMap,z=new WeakMap,_=new WeakMap,B=new WeakMap,Y=new WeakMap;const m=new me;exports.En3View=G;exports.dispose=ne;exports.en3=m;exports.en3Cache=W;
|
|
@@ -29,8 +29,8 @@ function xe(h) {
|
|
|
29
29
|
const e = (i) => {
|
|
30
30
|
i.dispose();
|
|
31
31
|
for (const n of Object.keys(i)) {
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const l = i[n];
|
|
33
|
+
l && typeof l == "object" && "minFilter" in l && l.dispose();
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
h.traverse((i) => {
|
|
@@ -43,18 +43,18 @@ function xe(h) {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
var z,
|
|
46
|
+
var z, c, D, x, b, L, y, w;
|
|
47
47
|
class ie {
|
|
48
48
|
constructor(e, i) {
|
|
49
49
|
s(this, z, void 0);
|
|
50
|
-
s(this,
|
|
50
|
+
s(this, c, void 0);
|
|
51
51
|
s(this, D, void 0);
|
|
52
52
|
s(this, x, void 0);
|
|
53
53
|
s(this, b, void 0);
|
|
54
54
|
s(this, L, void 0);
|
|
55
55
|
s(this, y, void 0);
|
|
56
56
|
s(this, w, void 0);
|
|
57
|
-
r(this, z, e), r(this,
|
|
57
|
+
r(this, z, e), r(this, c, (i == null ? void 0 : i.cameraType) === "orthographic" ? new Q() : new ee()), r(this, D, new me()), r(this, x, []), r(this, b, (i == null ? void 0 : i.cameraDistance) || 1e3), t(this, c).near = (i == null ? void 0 : i.cameraNear) || 1, t(this, c).far = (i == null ? void 0 : i.cameraFar) || 11e3, r(this, L, (i == null ? void 0 : i.cameraFov) || "auto"), t(this, c).position.z = t(this, b), t(this, c).name = `Cameras.${t(this, z)}`, r(this, y, re(i == null ? void 0 : i.sizeElement) || document.documentElement), this.beforeRenderCallback = i == null ? void 0 : i.beforeRender, r(this, w, new te(t(this, y))), t(this, w).onResize(() => {
|
|
58
58
|
this.resize();
|
|
59
59
|
});
|
|
60
60
|
}
|
|
@@ -62,7 +62,7 @@ class ie {
|
|
|
62
62
|
return t(this, z);
|
|
63
63
|
}
|
|
64
64
|
get camera() {
|
|
65
|
-
return t(this,
|
|
65
|
+
return t(this, c);
|
|
66
66
|
}
|
|
67
67
|
get scene() {
|
|
68
68
|
return t(this, D);
|
|
@@ -84,7 +84,7 @@ class ie {
|
|
|
84
84
|
}
|
|
85
85
|
resize() {
|
|
86
86
|
const { width: e, height: i } = t(this, w);
|
|
87
|
-
t(this,
|
|
87
|
+
t(this, c).userData.controlled || (t(this, c).position.z = t(this, b)), t(this, c) instanceof ee ? (t(this, c).aspect = e / i, t(this, c).fov = t(this, L) === "auto" ? 2 * Math.atan(i / 2 / t(this, b)) * (180 / Math.PI) : t(this, c).userData.controlled ? t(this, c).fov : t(this, L)) : t(this, c) instanceof Q && (t(this, c).left = e / -2, t(this, c).right = e / 2, t(this, c).top = i / 2, t(this, c).bottom = i / -2), t(this, c).updateProjectionMatrix();
|
|
88
88
|
}
|
|
89
89
|
destroy() {
|
|
90
90
|
t(this, x).forEach((e) => {
|
|
@@ -92,25 +92,25 @@ class ie {
|
|
|
92
92
|
}), t(this, D).clear(), xe(t(this, D)), m.destroyView(this.name), t(this, w).destroy();
|
|
93
93
|
}
|
|
94
94
|
attachToHTMLElement(e, i, n) {
|
|
95
|
-
const
|
|
95
|
+
const l = new te(e, X(H({}, n), {
|
|
96
96
|
containerElement: t(this, y),
|
|
97
97
|
cartesian: !0,
|
|
98
98
|
scrollStep: !this.isClipped
|
|
99
99
|
}));
|
|
100
|
-
return
|
|
100
|
+
return l.bindObject(i), i.userData.box = l, t(this, x).push(i), i;
|
|
101
101
|
}
|
|
102
102
|
detachFromHTMLElement(e) {
|
|
103
103
|
r(this, x, t(this, x).filter((i) => i === e ? (e.userData.box.destroy(), !1) : !0));
|
|
104
104
|
}
|
|
105
105
|
add(...e) {
|
|
106
|
-
const i = e[0], n = e[1],
|
|
107
|
-
return n && this.attachToHTMLElement(n, i,
|
|
106
|
+
const i = e[0], n = e[1], l = e[2];
|
|
107
|
+
return n && this.attachToHTMLElement(n, i, l), this.scene.add(i), i;
|
|
108
108
|
}
|
|
109
109
|
remove(e, i) {
|
|
110
110
|
this.scene.remove(e), i && this.detachFromHTMLElement(e);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
z = new WeakMap(),
|
|
113
|
+
z = new WeakMap(), c = new WeakMap(), D = new WeakMap(), x = new WeakMap(), b = new WeakMap(), L = new WeakMap(), y = new WeakMap(), w = new WeakMap();
|
|
114
114
|
const se = /* @__PURE__ */ new Map();
|
|
115
115
|
var v, O, P, p, j;
|
|
116
116
|
class ye {
|
|
@@ -167,15 +167,15 @@ class we {
|
|
|
167
167
|
E.length && (a.intersection = E[0], i.push(a));
|
|
168
168
|
}
|
|
169
169
|
let n = !1;
|
|
170
|
-
const
|
|
170
|
+
const l = t(this, d).filter(
|
|
171
171
|
(a) => !i.find((E) => E.object3D.uuid === a.object3D.uuid)
|
|
172
172
|
), W = i.sort(
|
|
173
173
|
(a, E) => E.object3D.position.z - a.object3D.position.z
|
|
174
|
-
).filter((a, E) => n ? (
|
|
174
|
+
).filter((a, E) => n ? (l.push(a), !1) : (n = !a.propagation, !0)), _ = W.filter(
|
|
175
175
|
(a) => !t(this, d).find((E) => E.object3D.uuid === a.object3D.uuid)
|
|
176
176
|
);
|
|
177
|
-
for (let a = 0; a <
|
|
178
|
-
|
|
177
|
+
for (let a = 0; a < l.length; a++)
|
|
178
|
+
l[a].dispatch("pointerLeave", e);
|
|
179
179
|
for (let a = 0; a < _.length; a++)
|
|
180
180
|
_[a].dispatch("pointerEnter", e);
|
|
181
181
|
r(this, d, W);
|
|
@@ -203,7 +203,7 @@ class we {
|
|
|
203
203
|
), r(this, f, []), r(this, d, []);
|
|
204
204
|
}
|
|
205
205
|
add(e, i) {
|
|
206
|
-
if (t(this, f).find((
|
|
206
|
+
if (t(this, f).find((l) => l.object3D.uuid === e.uuid))
|
|
207
207
|
return;
|
|
208
208
|
const n = new ye(H({
|
|
209
209
|
object3D: e
|
|
@@ -309,8 +309,8 @@ class pe {
|
|
|
309
309
|
}), se.clear();
|
|
310
310
|
}
|
|
311
311
|
createView(e, i) {
|
|
312
|
-
const n = t(this, u).size,
|
|
313
|
-
return t(this, u).set(e,
|
|
312
|
+
const n = t(this, u).size, l = new ie(e, i);
|
|
313
|
+
return t(this, u).set(e, l), n === 1 && t(this, o).setScissorTest(!0), l;
|
|
314
314
|
}
|
|
315
315
|
getView(e) {
|
|
316
316
|
return t(this, u).get(e);
|
|
@@ -322,10 +322,10 @@ class pe {
|
|
|
322
322
|
render(e) {
|
|
323
323
|
var i;
|
|
324
324
|
if (t(this, u).size > 1 || this.view.isClipped) {
|
|
325
|
-
const n = e.box.left + e.box.CSSTranslation.x + e.box.scrollValue.x,
|
|
326
|
-
t(this, o).setScissor(n,
|
|
325
|
+
const n = e.box.left + e.box.CSSTranslation.x + e.box.scrollValue.x, l = m.height - e.box.height - e.box.top + e.box.CSSTranslation.y + e.box.scrollValue.y * -1;
|
|
326
|
+
t(this, o).setScissor(n, l, e.box.width, e.box.height), t(this, o).setViewport(
|
|
327
327
|
n,
|
|
328
|
-
|
|
328
|
+
l,
|
|
329
329
|
e.box.width,
|
|
330
330
|
e.box.height
|
|
331
331
|
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function t(e){e.dispatchEvent(new CustomEvent("sizeChange",{bubbles:!0,composed:!0}))}function n(e){e.dispatchEvent(new CustomEvent("beforeSizeChange",{bubbles:!0,composed:!0}))}exports.dispatchBeforeSizeChangeEvent=n;exports.dispatchSizeChangeEvent=t;
|