ocearo-ui
Version:
Ocean Robot UI: 3D visualization dashboard for signalk
1 lines • 74.9 kB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},31497,e=>{"use strict";let t=parseInt(e.i(90072).REVISION.replace(/\D+/g,""));e.s(["version",()=>t])},99143,e=>{"use strict";var t=e.i(40859);e.s(["useLoader",()=>t.G])},68911,e=>{"use strict";var t=e.i(90072);function r(e,r){if(r===t.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(r!==t.TriangleFanDrawMode&&r!==t.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",r),e;{let s=e.getIndex();if(null===s){let t=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),s=e.getIndex()}let n=s.count-2,i=[];if(s)if(r===t.TriangleFanDrawMode)for(let e=1;e<=n;e++)i.push(s.getX(0)),i.push(s.getX(e)),i.push(s.getX(e+1));else for(let e=0;e<n;e++)e%2==0?(i.push(s.getX(e)),i.push(s.getX(e+1)),i.push(s.getX(e+2))):(i.push(s.getX(e+2)),i.push(s.getX(e+1)),i.push(s.getX(e)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let o=e.clone();return o.setIndex(i),o.clearGroups(),o}}e.s(["toTrianglesDrawMode",()=>r],68911)},46457,27543,21359,e=>{"use strict";let t;var r=e.i(90072),s=e.i(68911),n=e.i(31497);function i(e){if("u">typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let r=0,s=e.length;r<s;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}}let o="srgb",a="srgb-linear";class A extends r.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new h(e)}),this.register(function(e){return new d(e)}),this.register(function(e){return new R(e)}),this.register(function(e){return new D(e)}),this.register(function(e){return new H(e)}),this.register(function(e){return new G(e)}),this.register(function(e){return new F(e)}),this.register(function(e){return new M(e)}),this.register(function(e){return new f(e)}),this.register(function(e){return new u(e)}),this.register(function(e){return new E(e)}),this.register(function(e){return new m(e)}),this.register(function(e){return new p(e)}),this.register(function(e){return new I(e)}),this.register(function(e){return new C(e)}),this.register(function(e){return new g(e)}),this.register(function(e){return new T(e)})}load(e,t,s,n){let i,o=this;if(""!==this.resourcePath)i=this.resourcePath;else if(""!==this.path){let t=r.LoaderUtils.extractUrlBase(e);i=r.LoaderUtils.resolveURL(t,this.path)}else i=r.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);let a=function(t){n?n(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},A=new r.FileLoader(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,function(r){try{o.parse(r,i,function(r){t(r),o.manager.itemEnd(e)},a)}catch(e){a(e)}},s,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){let n,o={},a={};if("string"==typeof e)n=JSON.parse(e);else if(e instanceof ArrayBuffer)if(i(new Uint8Array(e.slice(0,4)))===J){try{o[l.KHR_BINARY_GLTF]=new b(e)}catch(e){s&&s(e);return}n=JSON.parse(o[l.KHR_BINARY_GLTF].content)}else n=JSON.parse(i(new Uint8Array(e)));else n=e;if(void 0===n.asset||n.asset.version[0]<2){s&&s(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let A=new V(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});A.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](A);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[t.name]=t,o[t.name]=!0}if(n.extensionsUsed)for(let e=0;e<n.extensionsUsed.length;++e){let t=n.extensionsUsed[e],r=n.extensionsRequired||[];switch(t){case l.KHR_MATERIALS_UNLIT:o[t]=new c;break;case l.KHR_DRACO_MESH_COMPRESSION:o[t]=new L(n,this.dracoLoader);break;case l.KHR_TEXTURE_TRANSFORM:o[t]=new O;break;case l.KHR_MESH_QUANTIZATION:o[t]=new x;break;default:r.indexOf(t)>=0&&void 0===a[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}A.setExtensions(o),A.setPlugins(a),A.parse(r,s)}parseAsync(e,t){let r=this;return new Promise(function(s,n){r.parse(e,t,s,n)})}}function B(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let l={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 C{constructor(e){this.parser=e,this.name=l.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let r=0,s=t.length;r<s;r++){let s=t[r];s.extensions&&s.extensions[this.name]&&void 0!==s.extensions[this.name].light&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){let t,s=this.parser,n="light:"+e,i=s.cache.get(n);if(i)return i;let o=s.json,A=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e],B=new r.Color(0xffffff);void 0!==A.color&&B.setRGB(A.color[0],A.color[1],A.color[2],a);let l=void 0!==A.range?A.range:0;switch(A.type){case"directional":(t=new r.DirectionalLight(B)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new r.PointLight(B)).distance=l;break;case"spot":(t=new r.SpotLight(B)).distance=l,A.spot=A.spot||{},A.spot.innerConeAngle=void 0!==A.spot.innerConeAngle?A.spot.innerConeAngle:0,A.spot.outerConeAngle=void 0!==A.spot.outerConeAngle?A.spot.outerConeAngle:Math.PI/4,t.angle=A.spot.outerConeAngle,t.penumbra=1-A.spot.innerConeAngle/A.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+A.type)}return t.position.set(0,0,0),t.decay=2,Y(t,A),void 0!==A.intensity&&(t.intensity=A.intensity),t.name=s.createUniqueName(A.name||"light_"+e),i=Promise.resolve(t),s.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,r=this.parser,s=r.json.nodes[e],n=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then(function(e){return r._getNodeRef(t.cache,n,e)})}}class c{constructor(){this.name=l.KHR_MATERIALS_UNLIT}getMaterialType(){return r.MeshBasicMaterial}extendParams(e,t,s){let n=[];e.color=new r.Color(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],a),e.opacity=t[3]}void 0!==i.baseColorTexture&&n.push(s.assignTexture(e,"map",i.baseColorTexture,o))}return Promise.all(n)}}class u{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let s=r.extensions[this.name].emissiveStrength;return void 0!==s&&(t.emissiveIntensity=s),Promise.resolve()}}class h{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],o=n.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(s.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(s.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(s.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){let e=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new r.Vector2(e,e)}return Promise.all(i)}}class d{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_DISPERSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let s=r.extensions[this.name];return t.dispersion=void 0!==s.dispersion?s.dispersion:0,Promise.resolve()}}class m{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let n=[],i=s.extensions[this.name];return void 0!==i.iridescenceFactor&&(t.iridescence=i.iridescenceFactor),void 0!==i.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",i.iridescenceTexture)),void 0!==i.iridescenceIor&&(t.iridescenceIOR=i.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==i.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),void 0!==i.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),void 0!==i.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(n)}}class G{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_SHEEN}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[];t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;let A=n.extensions[this.name];if(void 0!==A.sheenColorFactor){let e=A.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],a)}return void 0!==A.sheenRoughnessFactor&&(t.sheenRoughness=A.sheenRoughnessFactor),void 0!==A.sheenColorTexture&&i.push(s.assignTexture(t,"sheenColorMap",A.sheenColorTexture,o)),void 0!==A.sheenRoughnessTexture&&i.push(s.assignTexture(t,"sheenRoughnessMap",A.sheenRoughnessTexture)),Promise.all(i)}}class F{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let n=[],i=s.extensions[this.name];return void 0!==i.transmissionFactor&&(t.transmission=i.transmissionFactor),void 0!==i.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",i.transmissionTexture)),Promise.all(n)}}class M{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_VOLUME}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],o=n.extensions[this.name];t.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&i.push(s.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;let A=o.attenuationColor||[1,1,1];return t.attenuationColor=new r.Color().setRGB(A[0],A[1],A[2],a),Promise.all(i)}}class f{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_IOR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let s=r.extensions[this.name];return t.ior=void 0!==s.ior?s.ior:1.5,Promise.resolve()}}class E{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_SPECULAR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],A=n.extensions[this.name];t.specularIntensity=void 0!==A.specularFactor?A.specularFactor:1,void 0!==A.specularTexture&&i.push(s.assignTexture(t,"specularIntensityMap",A.specularTexture));let B=A.specularColorFactor||[1,1,1];return t.specularColor=new r.Color().setRGB(B[0],B[1],B[2],a),void 0!==A.specularColorTexture&&i.push(s.assignTexture(t,"specularColorMap",A.specularColorTexture,o)),Promise.all(i)}}class I{constructor(e){this.parser=e,this.name=l.EXT_MATERIALS_BUMP}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let n=[],i=s.extensions[this.name];return t.bumpScale=void 0!==i.bumpFactor?i.bumpFactor:1,void 0!==i.bumpTexture&&n.push(r.assignTexture(t,"bumpMap",i.bumpTexture)),Promise.all(n)}}class p{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();let n=[],i=s.extensions[this.name];return void 0!==i.anisotropyStrength&&(t.anisotropy=i.anisotropyStrength),void 0!==i.anisotropyRotation&&(t.anisotropyRotation=i.anisotropyRotation),void 0!==i.anisotropyTexture&&n.push(r.assignTexture(t,"anisotropyMap",i.anisotropyTexture)),Promise.all(n)}}class R{constructor(e){this.parser=e,this.name=l.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;let n=s.extensions[this.name],i=t.options.ktx2Loader;if(!i)if(!(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,n.source,i)}}class D{constructor(e){this.parser=e,this.name=l.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,s=r.json,n=s.textures[e];if(!n.extensions||!n.extensions[t])return null;let i=n.extensions[t],o=s.images[i.source],a=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,i.source,a);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class H{constructor(e){this.parser=e,this.name=l.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,s=r.json,n=s.textures[e];if(!n.extensions||!n.extensions[t])return null;let i=n.extensions[t],o=s.images[i.source],a=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,i.source,a);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class g{constructor(e){this.name=l.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,r=t.bufferViews[e];if(!r.extensions||!r.extensions[this.name])return null;{let e=r.extensions[this.name],s=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return s.then(function(t){let r=e.byteOffset||0,s=e.byteLength||0,i=e.count,o=e.byteStride,a=new Uint8Array(t,r,s);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,o,a,e.mode,e.filter).then(function(e){return e.buffer}):n.ready.then(function(){let t=new ArrayBuffer(i*o);return n.decodeGltfBuffer(new Uint8Array(t),i,o,a,e.mode,e.filter),t})})}}}class T{constructor(e){this.name=l.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||void 0===s.mesh)return null;for(let e of t.meshes[s.mesh].primitives)if(e.mode!==P.TRIANGLES&&e.mode!==P.TRIANGLE_STRIP&&e.mode!==P.TRIANGLE_FAN&&void 0!==e.mode)return null;let n=s.extensions[this.name].attributes,i=[],o={};for(let e in n)i.push(this.parser.getDependency("accessor",n[e]).then(t=>(o[e]=t,o[e])));return i.length<1?null:(i.push(this.parser.createNodeMesh(e)),Promise.all(i).then(e=>{let t=e.pop(),s=t.isGroup?t.children:[t],n=e[0].count,i=[];for(let e of s){let t=new r.Matrix4,s=new r.Vector3,a=new r.Quaternion,A=new r.Vector3(1,1,1),B=new r.InstancedMesh(e.geometry,e.material,n);for(let e=0;e<n;e++)o.TRANSLATION&&s.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&A.fromBufferAttribute(o.SCALE,e),B.setMatrixAt(e,t.compose(s,a,A));for(let t in o)if("_COLOR_0"===t){let e=o[t];B.instanceColor=new r.InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,o[t]);r.Object3D.prototype.copy.call(B,e),this.parser.assignFinalMaterial(B),i.push(B)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}}let J="glTF";class b{constructor(e){this.name=l.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12);if(this.header={magic:i(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==J)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,s=new DataView(e,12);let n=0;for(;n<r;){const t=s.getUint32(n,!0);n+=4;const r=s.getUint32(n,!0);if(n+=4,0x4e4f534a===r){const r=new Uint8Array(e,12+n,t);this.content=i(r)}else if(5130562===r){const r=12+n;this.body=e.slice(r,r+t)}n+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}}class L{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=l.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let r=this.json,s=this.dracoLoader,n=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,o={},A={},B={};for(let e in i)o[w[e]||e.toLowerCase()]=i[e];for(let t in e.attributes){let s=w[t]||t.toLowerCase();if(void 0!==i[t]){let n=r.accessors[e.attributes[t]],i=S[n.componentType];B[s]=i.name,A[s]=!0===n.normalized}}return t.getDependency("bufferView",n).then(function(e){return new Promise(function(t,r){s.decodeDracoFile(e,function(e){for(let t in e.attributes){let r=e.attributes[t],s=A[t];void 0!==s&&(r.normalized=s)}t(e)},o,B,a,r)})})}}class O{constructor(){this.name=l.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(void 0===t.texCoord||t.texCoord===e.channel)&&void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class x{constructor(){this.name=l.KHR_MESH_QUANTIZATION}}class y extends r.Interpolant{constructor(e,t,r,s){super(e,t,r,s)}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,n=e*s*3+s;for(let e=0;e!==s;e++)t[e]=r[n+e];return t}interpolate_(e,t,r,s){let n=this.resultBuffer,i=this.sampleValues,o=this.valueSize,a=2*o,A=3*o,B=s-t,l=(r-t)/B,C=l*l,c=C*l,u=e*A,h=u-A,d=-2*c+3*C,m=c-C,G=1-d,F=m-C+l;for(let e=0;e!==o;e++){let t=i[h+e+o],r=i[h+e+a]*B,s=i[u+e+o],A=i[u+e]*B;n[e]=G*t+F*r+d*s+m*A}return n}}let K=new r.Quaternion;class U extends y{interpolate_(e,t,r,s){let n=super.interpolate_(e,t,r,s);return K.fromArray(n).normalize().toArray(n),n}}let P={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},S={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Q={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},N={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},v={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},w={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...n.version>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},_={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},k={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function X(e,t,r){for(let s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function Y(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function j(e){let t="",r=Object.keys(e).sort();for(let s=0,n=r.length;s<n;s++)t+=r[s]+":"+e[r[s]]+";";return t}function Z(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let W=new r.Matrix4;class V{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new B,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 s=!1,n=!1,i=-1;"u">typeof navigator&&void 0!==navigator.userAgent&&(s=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=(n=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"u"<typeof createImageBitmap||s||n&&i<98?this.textureLoader=new r.TextureLoader(this.options.manager):this.textureLoader=new r.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let r=this,s=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(t){let i={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:r,userData:{}};return X(n,i,s),Y(i,s),Promise.all(r._invokeAll(function(e){return e.afterRoot&&e.afterRoot(i)})).then(function(){for(let e of i.scenes)e.updateMatrixWorld();e(i)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){let s=t[r].joints;for(let t=0,r=s.length;t<r;t++)e[s[t]].isBone=!0}for(let t=0,s=e.length;t<s;t++){let s=e[t];void 0!==s.mesh&&(this._addNodeRef(this.meshCache,s.mesh),void 0!==s.skin&&(r[s.mesh].isSkinnedMesh=!0)),void 0!==s.camera&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;let s=r.clone(),n=(e,t)=>{let r=this.associations.get(e);for(let[s,i]of(null!=r&&this.associations.set(t,r),e.children.entries()))n(i,t.children[s])};return n(r,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){let s=e(t[r]);if(s)return s}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let r=[];for(let s=0;s<t.length;s++){let n=e(t[s]);n&&r.push(n)}return r}getDependency(e,t){let r=e+":"+t,s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":s=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(!(s=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(r,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){let r=this;t=Promise.all((this.json[e+("mesh"===e?"es":"s")]||[]).map(function(t,s){return r.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],s=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[l.KHR_BINARY_GLTF].body);let n=this.options;return new Promise(function(e,i){s.load(r.LoaderUtils.resolveURL(t.uri,n.path),e,void 0,function(){i(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let r=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+r)})}loadAccessor(e){let t=this,s=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse){let e=v[n.type],t=S[n.componentType],s=!0===n.normalized,i=new t(n.count*e);return Promise.resolve(new r.BufferAttribute(i,e,s))}let i=[];return void 0!==n.bufferView?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),void 0!==n.sparse&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(e){let i,o,a=e[0],A=v[n.type],B=S[n.componentType],l=B.BYTES_PER_ELEMENT,C=l*A,c=n.byteOffset||0,u=void 0!==n.bufferView?s.bufferViews[n.bufferView].byteStride:void 0,h=!0===n.normalized;if(u&&u!==C){let e=Math.floor(c/u),s="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+e+":"+n.count,C=t.cache.get(s);C||(i=new B(a,e*u,n.count*u/l),C=new r.InterleavedBuffer(i,u/l),t.cache.add(s,C)),o=new r.InterleavedBufferAttribute(C,A,c%u/l,h)}else i=null===a?new B(n.count*A):new B(a,c,n.count*A),o=new r.BufferAttribute(i,A,h);if(void 0!==n.sparse){let t=v.SCALAR,s=S[n.sparse.indices.componentType],i=n.sparse.indices.byteOffset||0,l=n.sparse.values.byteOffset||0,C=new s(e[1],i,n.sparse.count*t),c=new B(e[2],l,n.sparse.count*A);null!==a&&(o=new r.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(let e=0,t=C.length;e<t;e++){let t=C[e];if(o.setX(t,c[e*A]),A>=2&&o.setY(t,c[e*A+1]),A>=3&&o.setZ(t,c[e*A+2]),A>=4&&o.setW(t,c[e*A+3]),A>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o})}loadTexture(e){let t=this.json,r=this.options,s=t.textures[e].source,n=t.images[s],i=this.textureLoader;if(n.uri){let e=r.manager.getHandler(n.uri);null!==e&&(i=e)}return this.loadTextureImage(e,s,i)}loadTextureImage(e,t,s){let n=this,i=this.json,o=i.textures[e],a=i.images[t],A=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[A])return this.textureCache[A];let B=this.loadImageSource(t,s).then(function(t){t.flipY=!1,t.name=o.name||a.name||"",""===t.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(t.name=a.uri);let s=(i.samplers||{})[o.sampler]||{};return t.magFilter=Q[s.magFilter]||r.LinearFilter,t.minFilter=Q[s.minFilter]||r.LinearMipmapLinearFilter,t.wrapS=N[s.wrapS]||r.RepeatWrapping,t.wrapT=N[s.wrapT]||r.RepeatWrapping,n.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[A]=B,B}loadImageSource(e,t){let s=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let i=s.images[e],o=self.URL||self.webkitURL,a=i.uri||"",A=!1;if(void 0!==i.bufferView)a=this.getDependency("bufferView",i.bufferView).then(function(e){A=!0;let t=new Blob([e],{type:i.mimeType});return a=o.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let B=Promise.resolve(a).then(function(e){return new Promise(function(s,i){let o=s;!0===t.isImageBitmapLoader&&(o=function(e){let t=new r.Texture(e);t.needsUpdate=!0,s(t)}),t.load(r.LoaderUtils.resolveURL(e,n.path),o,void 0,i)})}).then(function(e){var t;return!0===A&&o.revokeObjectURL(a),Y(e,i),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),e});return this.sourceCache[e]=B,B}assignTexture(e,t,r,s){let n=this;return this.getDependency("texture",r.index).then(function(i){if(!i)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((i=i.clone()).channel=r.texCoord),n.extensions[l.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[l.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=n.associations.get(i);i=n.extensions[l.KHR_TEXTURE_TRANSFORM].extendTexture(i,e),n.associations.set(i,t)}}return void 0!==s&&("number"==typeof s&&(s=3001===s?o:a),"colorSpace"in i?i.colorSpace=s:i.encoding=s===o?3001:3e3),e[t]=i,i})}assignFinalMaterial(e){let t=e.geometry,s=e.material,n=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,o=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+s.uuid,t=this.cache.get(e);t||(t=new r.PointsMaterial,r.Material.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,t.sizeAttenuation=!1,this.cache.add(e,t)),s=t}else if(e.isLine){let e="LineBasicMaterial:"+s.uuid,t=this.cache.get(e);t||(t=new r.LineBasicMaterial,r.Material.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,this.cache.add(e,t)),s=t}if(n||i||o){let e="ClonedMaterial:"+s.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),o&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=s.clone(),i&&(t.vertexColors=!0),o&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(s))),s=t}e.material=s}getMaterialType(){return r.MeshStandardMaterial}loadMaterial(e){let t,s=this,n=this.json,i=this.extensions,A=n.materials[e],B={},C=A.extensions||{},c=[];if(C[l.KHR_MATERIALS_UNLIT]){let e=i[l.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),c.push(e.extendParams(B,A,s))}else{let n=A.pbrMetallicRoughness||{};if(B.color=new r.Color(1,1,1),B.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;B.color.setRGB(e[0],e[1],e[2],a),B.opacity=e[3]}void 0!==n.baseColorTexture&&c.push(s.assignTexture(B,"map",n.baseColorTexture,o)),B.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,B.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(c.push(s.assignTexture(B,"metalnessMap",n.metallicRoughnessTexture)),c.push(s.assignTexture(B,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,B)})))}!0===A.doubleSided&&(B.side=r.DoubleSide);let u=A.alphaMode||"OPAQUE";if("BLEND"===u?(B.transparent=!0,B.depthWrite=!1):(B.transparent=!1,"MASK"===u&&(B.alphaTest=void 0!==A.alphaCutoff?A.alphaCutoff:.5)),void 0!==A.normalTexture&&t!==r.MeshBasicMaterial&&(c.push(s.assignTexture(B,"normalMap",A.normalTexture)),B.normalScale=new r.Vector2(1,1),void 0!==A.normalTexture.scale)){let e=A.normalTexture.scale;B.normalScale.set(e,e)}if(void 0!==A.occlusionTexture&&t!==r.MeshBasicMaterial&&(c.push(s.assignTexture(B,"aoMap",A.occlusionTexture)),void 0!==A.occlusionTexture.strength&&(B.aoMapIntensity=A.occlusionTexture.strength)),void 0!==A.emissiveFactor&&t!==r.MeshBasicMaterial){let e=A.emissiveFactor;B.emissive=new r.Color().setRGB(e[0],e[1],e[2],a)}return void 0!==A.emissiveTexture&&t!==r.MeshBasicMaterial&&c.push(s.assignTexture(B,"emissiveMap",A.emissiveTexture,o)),Promise.all(c).then(function(){let r=new t(B);return A.name&&(r.name=A.name),Y(r,A),s.associations.set(r,{materials:e}),A.extensions&&X(i,r,A),r})}createUniqueName(e){let t=r.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,s=this.extensions,n=this.primitiveCache,i=[];for(let o=0,a=e.length;o<a;o++){let a=e[o],A=function(e){let t,r=e.extensions&&e.extensions[l.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+j(r.attributes):e.indices+":"+j(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,s=e.targets.length;r<s;r++)t+=":"+j(e.targets[r]);return t}(a),B=n[A];if(B)i.push(B.promise);else{let e;e=a.extensions&&a.extensions[l.KHR_DRACO_MESH_COMPRESSION]?function(e){return s[l.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(r){return q(r,e,t)})}(a):q(new r.BufferGeometry,a,t),n[A]={primitive:a,promise:e},i.push(e)}}return Promise.all(i)}loadMesh(e){let t=this,n=this.json,i=this.extensions,o=n.meshes[e],a=o.primitives,A=[];for(let e=0,t=a.length;e<t;e++){var B;let t=void 0===a[e].material?(void 0===(B=this.cache).DefaultMaterial&&(B.DefaultMaterial=new r.MeshStandardMaterial({color:0xffffff,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),B.DefaultMaterial):this.getDependency("material",a[e].material);A.push(t)}return A.push(t.loadGeometries(a)),Promise.all(A).then(function(n){let A=n.slice(0,n.length-1),B=n[n.length-1],l=[];for(let n=0,C=B.length;n<C;n++){let C,c=B[n],u=a[n],h=A[n];if(u.mode===P.TRIANGLES||u.mode===P.TRIANGLE_STRIP||u.mode===P.TRIANGLE_FAN||void 0===u.mode)!0===(C=!0===o.isSkinnedMesh?new r.SkinnedMesh(c,h):new r.Mesh(c,h)).isSkinnedMesh&&C.normalizeSkinWeights(),u.mode===P.TRIANGLE_STRIP?C.geometry=(0,s.toTrianglesDrawMode)(C.geometry,r.TriangleStripDrawMode):u.mode===P.TRIANGLE_FAN&&(C.geometry=(0,s.toTrianglesDrawMode)(C.geometry,r.TriangleFanDrawMode));else if(u.mode===P.LINES)C=new r.LineSegments(c,h);else if(u.mode===P.LINE_STRIP)C=new r.Line(c,h);else if(u.mode===P.LINE_LOOP)C=new r.LineLoop(c,h);else if(u.mode===P.POINTS)C=new r.Points(c,h);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+u.mode);Object.keys(C.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,s=t.weights.length;r<s;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){let r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,s=r.length;t<s;t++)e.morphTargetDictionary[r[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(C,o),C.name=t.createUniqueName(o.name||"mesh_"+e),Y(C,o),u.extensions&&X(i,C,u),t.assignFinalMaterial(C),l.push(C)}for(let r=0,s=l.length;r<s;r++)t.associations.set(l[r],{meshes:e,primitives:r});if(1===l.length)return o.extensions&&X(i,l[0],o),l[0];let C=new r.Group;o.extensions&&X(i,C,o),t.associations.set(C,{meshes:e});for(let e=0,t=l.length;e<t;e++)C.add(l[e]);return C})}loadCamera(e){let t,s=this.json.cameras[e],n=s[s.type];return n?("perspective"===s.type?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===s.type&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),Y(t,s),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){let t=this.json.skins[e],s=[];for(let e=0,r=t.joints.length;e<r;e++)s.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(e){let s=e.pop(),n=[],i=[];for(let o=0,a=e.length;o<a;o++){let a=e[o];if(a){n.push(a);let e=new r.Matrix4;null!==s&&e.fromArray(s.array,16*o),i.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new r.Skeleton(n,i)})}loadAnimation(e){let t=this.json,s=this,n=t.animations[e],i=n.name?n.name:"animation_"+e,o=[],a=[],A=[],B=[],l=[];for(let e=0,t=n.channels.length;e<t;e++){let t=n.channels[e],r=n.samplers[t.sampler],s=t.target,i=s.node,C=void 0!==n.parameters?n.parameters[r.input]:r.input,c=void 0!==n.parameters?n.parameters[r.output]:r.output;void 0!==s.node&&(o.push(this.getDependency("node",i)),a.push(this.getDependency("accessor",C)),A.push(this.getDependency("accessor",c)),B.push(r),l.push(s))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(A),Promise.all(B),Promise.all(l)]).then(function(e){let t=e[0],n=e[1],o=e[2],a=e[3],A=e[4],B=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],i=n[e],l=o[e],C=a[e],c=A[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();let u=s._createAnimationTracks(r,i,l,C,c);if(u)for(let e=0;e<u.length;e++)B.push(u[e])}return new r.AnimationClip(i,void 0,B)})}createNodeMesh(e){let t=this.json,r=this,s=t.nodes[e];return void 0===s.mesh?null:r.getDependency("mesh",s.mesh).then(function(e){let t=r._getNodeRef(r.meshCache,s.mesh,e);return void 0!==s.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,r=s.weights.length;t<r;t++)e.morphTargetInfluences[t]=s.weights[t]}),t})}loadNode(e){let t=this.json.nodes[e],r=this._loadNodeShallow(e),s=[],n=t.children||[];for(let e=0,t=n.length;e<t;e++)s.push(this.getDependency("node",n[e]));let i=void 0===t.skin?Promise.resolve(null):this.getDependency("skin",t.skin);return Promise.all([r,Promise.all(s),i]).then(function(e){let t=e[0],r=e[1],s=e[2];null!==s&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(s,W)});for(let e=0,s=r.length;e<s;e++)t.add(r[e]);return t})}_loadNodeShallow(e){let t=this.json,s=this.extensions,n=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let i=t.nodes[e],o=i.name?n.createUniqueName(i.name):"",a=[],A=n._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return A&&a.push(A),void 0!==i.camera&&a.push(n.getDependency("camera",i.camera).then(function(e){return n._getNodeRef(n.cameraCache,i.camera,e)})),n._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){a.push(e)}),this.nodeCache[e]=Promise.all(a).then(function(t){let a;if((a=!0===i.isBone?new r.Bone:t.length>1?new r.Group:1===t.length?t[0]:new r.Object3D)!==t[0])for(let e=0,r=t.length;e<r;e++)a.add(t[e]);if(i.name&&(a.userData.name=i.name,a.name=o),Y(a,i),i.extensions&&X(s,a,i),void 0!==i.matrix){let e=new r.Matrix4;e.fromArray(i.matrix),a.applyMatrix4(e)}else void 0!==i.translation&&a.position.fromArray(i.translation),void 0!==i.rotation&&a.quaternion.fromArray(i.rotation),void 0!==i.scale&&a.scale.fromArray(i.scale);return n.associations.has(a)||n.associations.set(a,{}),n.associations.get(a).nodes=e,a}),this.nodeCache[e]}loadScene(e){let t=this.extensions,s=this.json.scenes[e],n=this,i=new r.Group;s.name&&(i.name=n.createUniqueName(s.name)),Y(i,s),s.extensions&&X(t,i,s);let o=s.nodes||[],a=[];for(let e=0,t=o.length;e<t;e++)a.push(n.getDependency("node",o[e]));return Promise.all(a).then(function(e){for(let t=0,r=e.length;t<r;t++)i.add(e[t]);return n.associations=(e=>{let t=new Map;for(let[e,s]of n.associations)(e instanceof r.Material||e instanceof r.Texture)&&t.set(e,s);return e.traverse(e=>{let r=n.associations.get(e);null!=r&&t.set(e,r)}),t})(i),i})}_createAnimationTracks(e,t,s,n,i){let o,a=[],A=e.name?e.name:e.uuid,B=[];switch(_[i.path]===_.weights?e.traverse(function(e){e.morphTargetInfluences&&B.push(e.name?e.name:e.uuid)}):B.push(A),_[i.path]){case _.weights:o=r.NumberKeyframeTrack;break;case _.rotation:o=r.QuaternionKeyframeTrack;break;case _.position:case _.scale:o=r.VectorKeyframeTrack;break;default:o=1===s.itemSize?r.NumberKeyframeTrack:r.VectorKeyframeTrack}let l=void 0!==n.interpolation?k[n.interpolation]:r.InterpolateLinear,C=this._getArrayFromAccessor(s);for(let e=0,r=B.length;e<r;e++){let r=new o(B[e]+"."+_[i.path],t.array,C,l);"CUBICSPLINE"===n.interpolation&&this._createCubicSplineTrackInterpolant(r),a.push(r)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=Z(t.constructor),r=new Float32Array(t.length);for(let s=0,n=t.length;s<n;s++)r[s]=t[s]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?U:y)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function q(e,t,s){let n=t.attributes,i=[];for(let t in n){let r=w[t]||t.toLowerCase();r in e.attributes||i.push(function(t,r){return s.getDependency("accessor",t).then(function(t){e.setAttribute(r,t)})}(n[t],r))}if(void 0!==t.indices&&!e.index){let r=s.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});i.push(r)}return Y(e,t),!function(e,t,s){let n=t.attributes,i=new r.Box3;if(void 0===n.POSITION)return;{let e=s.json.accessors[n.POSITION],t=e.min,o=e.max;if(void 0===t||void 0===o)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new r.Vector3(t[0],t[1],t[2]),new r.Vector3(o[0],o[1],o[2])),e.normalized){let t=Z(S[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}let o=t.targets;if(void 0!==o){let e=new r.Vector3,t=new r.Vector3;for(let r=0,n=o.length;r<n;r++){let n=o[r];if(void 0!==n.POSITION){let r=s.json.accessors[n.POSITION],i=r.min,o=r.max;if(void 0!==i&&void 0!==o){if(t.setX(Math.max(Math.abs(i[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(i[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(i[2]),Math.abs(o[2]))),r.normalized){let e=Z(S[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(e)}e.boundingBox=i;let a=new r.Sphere;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=a}(e,t,s),Promise.all(i).then(function(){return void 0!==t.targets?function(e,t,r){let s=!1,n=!1,i=!1;for(let e=0,r=t.length;e<r;e++){let r=t[e];if(void 0!==r.POSITION&&(s=!0),void 0!==r.NORMAL&&(n=!0),void 0!==r.COLOR_0&&(i=!0),s&&n&&i)break}if(!s&&!n&&!i)return Promise.resolve(e);let o=[],a=[],A=[];for(let B=0,l=t.length;B<l;B++){let l=t[B];if(s){let t=void 0!==l.POSITION?r.getDependency("accessor",l.POSITION):e.attributes.position;o.push(t)}if(n){let t=void 0!==l.NORMAL?r.getDependency("accessor",l.NORMAL):e.attributes.normal;a.push(t)}if(i){let t=void 0!==l.COLOR_0?r.getDependency("accessor",l.COLOR_0):e.attributes.color;A.push(t)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(A)]).then(function(t){let r=t[0],o=t[1],a=t[2];return s&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=o),i&&(e.morphAttributes.color=a),e.morphTargetsRelative=!0,e})}(e,t.targets,s):e})}e.s(["GLTFLoader",()=>A],46457);var z=r;let $=new WeakMap;class ee extends z.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,s){let n=new z.FileLoader(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,e=>{let r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(s)},r,s)}decodeDracoFile(e,t,r,s){let n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,n).then(t)}decodeGeometry(e,t){let r;for(let e in t.attributeTypes){let r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}let s=JSON.stringify(t);if($.has(e)){let t=$.get(e);if(t.key===s)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n=this.workerNextTaskID++,i=e.byteLength,o=this._getWorker(n,i).then(s=>(r=s,new Promise((s,i)=>{r._callbacks[n]={resolve:s,reject:i},r.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{r&&n&&this._releaseTask(r,n)}),$.set(e,{key:s,promise:o}),o}_createGeometry(e){let t=new z.BufferGeometry;e.index&&t.setIndex(new z.BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let s=e.attributes[r],n=s.name,i=s.array,o=s.itemSize;t.setAttribute(n,new z.BufferAttribute(i,o))}return t}_loadLibrary(e,t){let r=new z.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((t,s)=>{r.load(e,t,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let s=et.toString(),n=["/* draco decoder */",r,"\n/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.po