@quick-threejs/reactive 0.1.35 → 0.1.36

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/dist/main.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var re=Object.defineProperty;var ie=(o,e,t)=>e in o?re(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var E=(o,e,t)=>ie(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./app.module-x3kmydmS.js"),h=require("three");function oe(){return function(o){m.injectable()(o),m.instance.registerSingleton(o)}}class G{constructor(){E(this,"location");E(this,"initOnConstruct");E(this,"canvas");E(this,"fullScreen");E(this,"defaultCamera");E(this,"startTimer");E(this,"loaderDataSources",[]);E(this,"loadResourcesOnInit");E(this,"enableDebug");E(this,"enableControls");E(this,"axesSizes");E(this,"gridSizes");E(this,"withMiniCamera");E(this,"onReady")}}class ae{constructor(){E(this,"onReady")}}function Q(o,e){if(e===h.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(e===h.TriangleFanDrawMode||e===h.TriangleStripDrawMode){let t=o.getIndex();if(t===null){const r=[],a=o.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)r.push(c);o.setIndex(r),t=o.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),o}const n=t.count-2,s=[];if(e===h.TriangleFanDrawMode)for(let r=1;r<=n;r++)s.push(t.getX(0)),s.push(t.getX(r)),s.push(t.getX(r+1));else for(let r=0;r<n;r++)r%2===0?(s.push(t.getX(r)),s.push(t.getX(r+1)),s.push(t.getX(r+2))):(s.push(t.getX(r+2)),s.push(t.getX(r+1)),s.push(t.getX(r)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=o.clone();return i.setIndex(s),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),o}const j=new WeakMap;class ce extends h.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,n,s){const i=new h.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,r=>{this.parse(r,t,s)},n,s)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,h.SRGBColorSpace,n).catch(n)}decodeDracoFile(e,t,n,s,i=h.LinearSRGBColorSpace,r=()=>{}){const a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:i};return this.decodeGeometry(e,a).then(t).catch(r)}decodeGeometry(e,t){const n=JSON.stringify(t);if(j.has(e)){const c=j.get(e);if(c.key===n)return c.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const i=this.workerNextTaskID++,r=e.byteLength,a=this._getWorker(i,r).then(c=>(s=c,new Promise((l,d)=>{s._callbacks[i]={resolve:l,reject:d},s.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return a.catch(()=>!0).then(()=>{s&&i&&this._releaseTask(s,i)}),j.set(e,{key:n,promise:a}),a}_createGeometry(e){const t=new h.BufferGeometry;e.index&&t.setIndex(new h.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n],i=s.name,r=s.array,a=s.itemSize,c=new h.BufferAttribute(r,a);i==="color"&&(this._assignVertexColorSpace(c,s.vertexColorSpace),c.normalized=!(r instanceof Float32Array)),t.setAttribute(i,c)}return t}_assignVertexColorSpace(e,t){if(t!==h.SRGBColorSpace)return;const n=new h.Color;for(let s=0,i=e.count;s<i;s++)n.fromBufferAttribute(e,s),h.ColorManagement.toWorkingColorSpace(n,h.SRGBColorSpace),e.setXYZ(s,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new h.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((s,i)=>{n.load(e,s,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const s=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const i=le.toString(),r=["/* draco decoder */",s,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join(`
2
- `);this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(i){const r=i.data;switch(r.type){case"decode":s._callbacks[r.id].resolve(r);break;case"error":s._callbacks[r.id].reject(r);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,i){return s._taskLoad>i._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function le(){let o,e;onmessage=function(r){const a=r.data;switch(a.type){case"init":o=a.decoderConfig,e=new Promise(function(d){o.onModuleLoaded=function(u){d({draco:u})},DracoDecoderModule(o)});break;case"decode":const c=a.buffer,l=a.taskConfig;e.then(d=>{const u=d.draco,f=new u.Decoder;try{const p=t(u,f,new Int8Array(c),l),g=p.attributes.map(_=>_.array.buffer);p.index&&g.push(p.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:p},g)}catch(p){console.error(p),self.postMessage({type:"error",id:a.id,error:p.message})}finally{u.destroy(f)}});break}};function t(r,a,c,l){const d=l.attributeIDs,u=l.attributeTypes;let f,p;const g=a.GetEncodedGeometryType(c);if(g===r.TRIANGULAR_MESH)f=new r.Mesh,p=a.DecodeArrayToMesh(c,c.byteLength,f);else if(g===r.POINT_CLOUD)f=new r.PointCloud,p=a.DecodeArrayToPointCloud(c,c.byteLength,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const _={index:null,attributes:[]};for(const A in d){const T=self[u[A]];let y,L;if(l.useUniqueIDs)L=d[A],y=a.GetAttributeByUniqueId(f,L);else{if(L=a.GetAttributeId(f,r[d[A]]),L===-1)continue;y=a.GetAttribute(f,L)}const w=s(r,a,f,A,T,y);A==="color"&&(w.vertexColorSpace=l.vertexColorSpace),_.attributes.push(w)}return g===r.TRIANGULAR_MESH&&(_.index=n(r,a,f)),r.destroy(f),_}function n(r,a,c){const d=c.num_faces()*3,u=d*4,f=r._malloc(u);a.GetTrianglesUInt32Array(c,u,f);const p=new Uint32Array(r.HEAPF32.buffer,f,d).slice();return r._free(f),{array:p,itemSize:1}}function s(r,a,c,l,d,u){const f=u.num_components(),g=c.num_points()*f,_=g*d.BYTES_PER_ELEMENT,A=i(r,d),T=r._malloc(_);a.GetAttributeDataArrayForAllPoints(c,u,A,_,T);const y=new d(r.HEAPF32.buffer,T,g).slice();return r._free(T),{name:l,array:y,itemSize:f}}function i(r,a){switch(a){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32}}}class ue extends h.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new me(t)}),this.register(function(t){return new ge(t)}),this.register(function(t){return new Se(t)}),this.register(function(t){return new xe(t)}),this.register(function(t){return new be(t)}),this.register(function(t){return new Te(t)}),this.register(function(t){return new _e(t)}),this.register(function(t){return new Re(t)}),this.register(function(t){return new Ee(t)}),this.register(function(t){return new pe(t)}),this.register(function(t){return new ye(t)}),this.register(function(t){return new Ae(t)}),this.register(function(t){return new Le(t)}),this.register(function(t){return new we(t)}),this.register(function(t){return new de(t)}),this.register(function(t){return new ve(t)}),this.register(function(t){return new Me(t)})}load(e,t,n,s){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const l=h.LoaderUtils.extractUrlBase(e);r=h.LoaderUtils.resolveURL(l,this.path)}else r=h.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(l){s?s(l):console.error(l),i.manager.itemError(e),i.manager.itemEnd(e)},c=new h.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{i.parse(l,r,function(d){t(d),i.manager.itemEnd(e)},a)}catch(d){a(d)}},n,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,s){let i;const r={},a={},c=new TextDecoder;if(typeof e=="string")i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===se){try{r[R.KHR_BINARY_GLTF]=new Ce(e)}catch(u){s&&s(u);return}i=JSON.parse(r[R.KHR_BINARY_GLTF].content)}else i=JSON.parse(c.decode(e));else i=e;if(i.asset===void 0||i.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new Ke(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const u=this.pluginCallbacks[d](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,r[u.name]=!0}if(i.extensionsUsed)for(let d=0;d<i.extensionsUsed.length;++d){const u=i.extensionsUsed[d],f=i.extensionsRequired||[];switch(u){case R.KHR_MATERIALS_UNLIT:r[u]=new fe;break;case R.KHR_DRACO_MESH_COMPRESSION:r[u]=new Oe(i,this.dracoLoader);break;case R.KHR_TEXTURE_TRANSFORM:r[u]=new Ie;break;case R.KHR_MESH_QUANTIZATION:r[u]=new Ne;break;default:f.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(r),l.setPlugins(a),l.parse(n,s)}parseAsync(e,t){const n=this;return new Promise(function(s,i){n.parse(e,t,s,i)})}}function he(){let o={};return{get:function(e){return o[e]},add:function(e,t){o[e]=t},remove:function(e){delete o[e]},removeAll:function(){o={}}}}const R={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 de{constructor(e){this.parser=e,this.name=R.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,s=t.length;n<s;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let s=t.cache.get(n);if(s)return s;const i=t.json,c=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let l;const d=new h.Color(16777215);c.color!==void 0&&d.setRGB(c.color[0],c.color[1],c.color[2],h.LinearSRGBColorSpace);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new h.DirectionalLight(d),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new h.PointLight(d),l.distance=u;break;case"spot":l=new h.SpotLight(d),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),l.decay=2,v(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),s=Promise.resolve(l),t.cache.add(n,s),s}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(c){return n._getNodeRef(t.cache,a,c)})}}class fe{constructor(){this.name=R.KHR_MATERIALS_UNLIT}getMaterialType(){return h.MeshBasicMaterial}extendParams(e,t,n){const s=[];e.color=new h.Color(1,1,1),e.opacity=1;const i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const r=i.baseColorFactor;e.color.setRGB(r[0],r[1],r[2],h.LinearSRGBColorSpace),e.opacity=r[3]}i.baseColorTexture!==void 0&&s.push(n.assignTexture(e,"map",i.baseColorTexture,h.SRGBColorSpace))}return Promise.all(s)}}class pe{constructor(e){this.parser=e,this.name=R.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name].emissiveStrength;return i!==void 0&&(t.emissiveIntensity=i),Promise.resolve()}}class me{constructor(e){this.parser=e,this.name=R.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];if(r.clearcoatFactor!==void 0&&(t.clearcoat=r.clearcoatFactor),r.clearcoatTexture!==void 0&&i.push(n.assignTexture(t,"clearcoatMap",r.clearcoatTexture)),r.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=r.clearcoatRoughnessFactor),r.clearcoatRoughnessTexture!==void 0&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),r.clearcoatNormalTexture!==void 0&&(i.push(n.assignTexture(t,"clearcoatNormalMap",r.clearcoatNormalTexture)),r.clearcoatNormalTexture.scale!==void 0)){const a=r.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new h.Vector2(a,a)}return Promise.all(i)}}class ge{constructor(e){this.parser=e,this.name=R.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name];return t.dispersion=i.dispersion!==void 0?i.dispersion:0,Promise.resolve()}}class Ae{constructor(e){this.parser=e,this.name=R.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return r.iridescenceFactor!==void 0&&(t.iridescence=r.iridescenceFactor),r.iridescenceTexture!==void 0&&i.push(n.assignTexture(t,"iridescenceMap",r.iridescenceTexture)),r.iridescenceIor!==void 0&&(t.iridescenceIOR=r.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),r.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=r.iridescenceThicknessMinimum),r.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=r.iridescenceThicknessMaximum),r.iridescenceThicknessTexture!==void 0&&i.push(n.assignTexture(t,"iridescenceThicknessMap",r.iridescenceThicknessTexture)),Promise.all(i)}}class Te{constructor(e){this.parser=e,this.name=R.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[];t.sheenColor=new h.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const r=s.extensions[this.name];if(r.sheenColorFactor!==void 0){const a=r.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace)}return r.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=r.sheenRoughnessFactor),r.sheenColorTexture!==void 0&&i.push(n.assignTexture(t,"sheenColorMap",r.sheenColorTexture,h.SRGBColorSpace)),r.sheenRoughnessTexture!==void 0&&i.push(n.assignTexture(t,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(i)}}class _e{constructor(e){this.parser=e,this.name=R.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return r.transmissionFactor!==void 0&&(t.transmission=r.transmissionFactor),r.transmissionTexture!==void 0&&i.push(n.assignTexture(t,"transmissionMap",r.transmissionTexture)),Promise.all(i)}}class Re{constructor(e){this.parser=e,this.name=R.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];t.thickness=r.thicknessFactor!==void 0?r.thicknessFactor:0,r.thicknessTexture!==void 0&&i.push(n.assignTexture(t,"thicknessMap",r.thicknessTexture)),t.attenuationDistance=r.attenuationDistance||1/0;const a=r.attenuationColor||[1,1,1];return t.attenuationColor=new h.Color().setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace),Promise.all(i)}}class Ee{constructor(e){this.parser=e,this.name=R.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name];return t.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}}class ye{constructor(e){this.parser=e,this.name=R.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];t.specularIntensity=r.specularFactor!==void 0?r.specularFactor:1,r.specularTexture!==void 0&&i.push(n.assignTexture(t,"specularIntensityMap",r.specularTexture));const a=r.specularColorFactor||[1,1,1];return t.specularColor=new h.Color().setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace),r.specularColorTexture!==void 0&&i.push(n.assignTexture(t,"specularColorMap",r.specularColorTexture,h.SRGBColorSpace)),Promise.all(i)}}class we{constructor(e){this.parser=e,this.name=R.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return t.bumpScale=r.bumpFactor!==void 0?r.bumpFactor:1,r.bumpTexture!==void 0&&i.push(n.assignTexture(t,"bumpMap",r.bumpTexture)),Promise.all(i)}}class Le{constructor(e){this.parser=e,this.name=R.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return r.anisotropyStrength!==void 0&&(t.anisotropy=r.anisotropyStrength),r.anisotropyRotation!==void 0&&(t.anisotropyRotation=r.anisotropyRotation),r.anisotropyTexture!==void 0&&i.push(n.assignTexture(t,"anisotropyMap",r.anisotropyTexture)),Promise.all(i)}}class Se{constructor(e){this.parser=e,this.name=R.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,s=n.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const i=s.extensions[this.name],r=t.options.ktx2Loader;if(!r){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,r)}}class xe{constructor(e){this.parser=e,this.name=R.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,i=s.textures[e];if(!i.extensions||!i.extensions[t])return null;const r=i.extensions[t],a=s.images[r.source];let c=n.textureLoader;if(a.uri){const l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(e,r.source,c);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class be{constructor(e){this.parser=e,this.name=R.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,i=s.textures[e];if(!i.extensions||!i.extensions[t])return null;const r=i.extensions[t],a=s.images[r.source];let c=n.textureLoader;if(a.uri){const l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(e,r.source,c);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class ve{constructor(e){this.name=R.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const s=n.extensions[this.name],i=this.parser.getDependency("buffer",s.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const c=s.byteOffset||0,l=s.byteLength||0,d=s.count,u=s.byteStride,f=new Uint8Array(a,c,l);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(d,u,f,s.mode,s.filter).then(function(p){return p.buffer}):r.ready.then(function(){const p=new ArrayBuffer(d*u);return r.decodeGltfBuffer(new Uint8Array(p),d,u,f,s.mode,s.filter),p})})}else return null}}class Me{constructor(e){this.name=R.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const s=t.meshes[n.mesh];for(const l of s.primitives)if(l.mode!==S.TRIANGLES&&l.mode!==S.TRIANGLE_STRIP&&l.mode!==S.TRIANGLE_FAN&&l.mode!==void 0)return null;const r=n.extensions[this.name].attributes,a=[],c={};for(const l in r)a.push(this.parser.getDependency("accessor",r[l]).then(d=>(c[l]=d,c[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(l=>{const d=l.pop(),u=d.isGroup?d.children:[d],f=l[0].count,p=[];for(const g of u){const _=new h.Matrix4,A=new h.Vector3,T=new h.Quaternion,y=new h.Vector3(1,1,1),L=new h.InstancedMesh(g.geometry,g.material,f);for(let w=0;w<f;w++)c.TRANSLATION&&A.fromBufferAttribute(c.TRANSLATION,w),c.ROTATION&&T.fromBufferAttribute(c.ROTATION,w),c.SCALE&&y.fromBufferAttribute(c.SCALE,w),L.setMatrixAt(w,_.compose(A,T,y));for(const w in c)if(w==="_COLOR_0"){const b=c[w];L.instanceColor=new h.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else w!=="TRANSLATION"&&w!=="ROTATION"&&w!=="SCALE"&&g.geometry.setAttribute(w,c[w]);h.Object3D.prototype.copy.call(L,g),this.parser.assignFinalMaterial(L),p.push(L)}return d.isGroup?(d.clear(),d.add(...p),d):p[0]}))}}const se="glTF",k=12,J={JSON:1313821514,BIN:5130562};class Ce{constructor(e){this.name=R.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,k),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==se)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-k,i=new DataView(e,k);let r=0;for(;r<s;){const a=i.getUint32(r,!0);r+=4;const c=i.getUint32(r,!0);if(r+=4,c===J.JSON){const l=new Uint8Array(e,k+r,a);this.content=n.decode(l)}else if(c===J.BIN){const l=k+r;this.body=e.slice(l,l+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Oe{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=R.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,s=this.dracoLoader,i=e.extensions[this.name].bufferView,r=e.extensions[this.name].attributes,a={},c={},l={};for(const d in r){const u=W[d]||d.toLowerCase();a[u]=r[d]}for(const d in e.attributes){const u=W[d]||d.toLowerCase();if(r[d]!==void 0){const f=n.accessors[e.attributes[d]],p=P[f.componentType];l[u]=p.name,c[u]=f.normalized===!0}}return t.getDependency("bufferView",i).then(function(d){return new Promise(function(u,f){s.decodeDracoFile(d,function(p){for(const g in p.attributes){const _=p.attributes[g],A=c[g];A!==void 0&&(_.normalized=A)}u(p)},a,l,h.LinearSRGBColorSpace,f)})})}}class Ie{constructor(){this.name=R.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Ne{constructor(){this.name=R.KHR_MESH_QUANTIZATION}}class ne extends h.Interpolant{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,i=e*s*3+s;for(let r=0;r!==s;r++)t[r]=n[i+r];return t}interpolate_(e,t,n,s){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,c=a*2,l=a*3,d=s-t,u=(n-t)/d,f=u*u,p=f*u,g=e*l,_=g-l,A=-2*p+3*f,T=p-f,y=1-A,L=T-f+u;for(let w=0;w!==a;w++){const b=r[_+w+a],M=r[_+w+c]*d,x=r[g+w+a],D=r[g+w]*d;i[w]=y*b+L*M+A*x+T*D}return i}}const Pe=new h.Quaternion;class De extends ne{interpolate_(e,t,n,s){const i=super.interpolate_(e,t,n,s);return Pe.fromArray(i).normalize().toArray(i),i}}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},P={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Z={9728:h.NearestFilter,9729:h.LinearFilter,9984:h.NearestMipmapNearestFilter,9985:h.LinearMipmapNearestFilter,9986:h.NearestMipmapLinearFilter,9987:h.LinearMipmapLinearFilter},ee={33071:h.ClampToEdgeWrapping,33648:h.MirroredRepeatWrapping,10497:h.RepeatWrapping},K={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},W={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"},ke={CUBICSPLINE:void 0,LINEAR:h.InterpolateLinear,STEP:h.InterpolateDiscrete},V={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Fe(o){return o.DefaultMaterial===void 0&&(o.DefaultMaterial=new h.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:h.FrontSide})),o.DefaultMaterial}function I(o,e,t){for(const n in t.extensions)o[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function v(o,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(o.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Be(o,e,t){let n=!1,s=!1,i=!1;for(let l=0,d=e.length;l<d;l++){const u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(s=!0),u.COLOR_0!==void 0&&(i=!0),n&&s&&i)break}if(!n&&!s&&!i)return Promise.resolve(o);const r=[],a=[],c=[];for(let l=0,d=e.length;l<d;l++){const u=e[l];if(n){const f=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):o.attributes.position;r.push(f)}if(s){const f=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):o.attributes.normal;a.push(f)}if(i){const f=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):o.attributes.color;c.push(f)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(c)]).then(function(l){const d=l[0],u=l[1],f=l[2];return n&&(o.morphAttributes.position=d),s&&(o.morphAttributes.normal=u),i&&(o.morphAttributes.color=f),o.morphTargetsRelative=!0,o})}function He(o,e){if(o.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)o.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(o.morphTargetInfluences.length===t.length){o.morphTargetDictionary={};for(let n=0,s=t.length;n<s;n++)o.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Ge(o){let e;const t=o.extensions&&o.extensions[R.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+z(t.attributes):e=o.indices+":"+z(o.attributes)+":"+o.mode,o.targets!==void 0)for(let n=0,s=o.targets.length;n<s;n++)e+=":"+z(o.targets[n]);return e}function z(o){let e="";const t=Object.keys(o).sort();for(let n=0,s=t.length;n<s;n++)e+=t[n]+":"+o[t[n]]+";";return e}function $(o){switch(o){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 Ue(o){return o.search(/\.jpe?g($|\?)/i)>0||o.search(/^data\:image\/jpeg/)===0?"image/jpeg":o.search(/\.webp($|\?)/i)>0||o.search(/^data\:image\/webp/)===0?"image/webp":o.search(/\.ktx2($|\?)/i)>0||o.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const je=new h.Matrix4;class Ke{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new he,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 n=!1,s=-1,i=!1,r=-1;if(typeof navigator<"u"){const a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;const c=a.match(/Version\/(\d+)/);s=n&&c?parseInt(c[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&s<17||i&&r<98?this.textureLoader=new h.TextureLoader(this.options.manager):this.textureLoader=new h.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new h.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,s=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(r){const a={scene:r[0][s.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:s.asset,parser:n,userData:{}};return I(i,a,s),v(a,s),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(a)})).then(function(){for(const c of a.scenes)c.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,i=t.length;s<i;s++){const r=t[s].joints;for(let a=0,c=r.length;a<c;a++)e[r[a]].isBone=!0}for(let s=0,i=e.length;s<i;s++){const r=e[s];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const s=n.clone(),i=(r,a)=>{const c=this.associations.get(r);c!=null&&this.associations.set(a,c);for(const[l,d]of r.children.entries())i(d,a.children[l])};return i(n,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const s=e(t[n]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let s=0;s<t.length;s++){const i=e(t[s]);i&&n.push(i)}return n}getDependency(e,t){const n=e+":"+t;let s=this.cache.get(n);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(i){return i.loadNode&&i.loadNode(t)});break;case"mesh":s=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e);break}this.cache.add(n,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,s=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(s.map(function(i,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[R.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(i,r){n.load(h.LoaderUtils.resolveURL(t.uri,s.path),i,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const s=t.byteLength||0,i=t.byteOffset||0;return n.slice(i,i+s)})}loadAccessor(e){const t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){const r=K[s.type],a=P[s.componentType],c=s.normalized===!0,l=new a(s.count*r);return Promise.resolve(new h.BufferAttribute(l,r,c))}const i=[];return s.bufferView!==void 0?i.push(this.getDependency("bufferView",s.bufferView)):i.push(null),s.sparse!==void 0&&(i.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],c=K[s.type],l=P[s.componentType],d=l.BYTES_PER_ELEMENT,u=d*c,f=s.byteOffset||0,p=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,g=s.normalized===!0;let _,A;if(p&&p!==u){const T=Math.floor(f/p),y="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+T+":"+s.count;let L=t.cache.get(y);L||(_=new l(a,T*p,s.count*p/d),L=new h.InterleavedBuffer(_,p/d),t.cache.add(y,L)),A=new h.InterleavedBufferAttribute(L,c,f%p/d,g)}else a===null?_=new l(s.count*c):_=new l(a,f,s.count*c),A=new h.BufferAttribute(_,c,g);if(s.sparse!==void 0){const T=K.SCALAR,y=P[s.sparse.indices.componentType],L=s.sparse.indices.byteOffset||0,w=s.sparse.values.byteOffset||0,b=new y(r[1],L,s.sparse.count*T),M=new l(r[2],w,s.sparse.count*c);a!==null&&(A=new h.BufferAttribute(A.array.slice(),A.itemSize,A.normalized)),A.normalized=!1;for(let x=0,D=b.length;x<D;x++){const C=b[x];if(A.setX(C,M[x*c]),c>=2&&A.setY(C,M[x*c+1]),c>=3&&A.setZ(C,M[x*c+2]),c>=4&&A.setW(C,M[x*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}A.normalized=g}return A})}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let a=this.textureLoader;if(r.uri){const c=n.manager.getHandler(r.uri);c!==null&&(a=c)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){const s=this,i=this.json,r=i.textures[e],a=i.images[t],c=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(t,n).then(function(d){d.flipY=!1,d.name=r.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const f=(i.samplers||{})[r.sampler]||{};return d.magFilter=Z[f.magFilter]||h.LinearFilter,d.minFilter=Z[f.minFilter]||h.LinearMipmapLinearFilter,d.wrapS=ee[f.wrapS]||h.RepeatWrapping,d.wrapT=ee[f.wrapT]||h.RepeatWrapping,d.generateMipmaps=!d.isCompressedTexture&&d.minFilter!==h.NearestFilter&&d.minFilter!==h.LinearFilter,s.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){const n=this,s=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const r=s.images[e],a=self.URL||self.webkitURL;let c=r.uri||"",l=!1;if(r.bufferView!==void 0)c=n.getDependency("bufferView",r.bufferView).then(function(u){l=!0;const f=new Blob([u],{type:r.mimeType});return c=a.createObjectURL(f),c});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(c).then(function(u){return new Promise(function(f,p){let g=f;t.isImageBitmapLoader===!0&&(g=function(_){const A=new h.Texture(_);A.needsUpdate=!0,f(A)}),t.load(h.LoaderUtils.resolveURL(u,i.path),g,void 0,p)})}).then(function(u){return l===!0&&a.revokeObjectURL(c),v(u,r),u.userData.mimeType=r.mimeType||Ue(r.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=d,d}assignTexture(e,t,n,s){const i=this;return this.getDependency("texture",n.index).then(function(r){if(!r)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(r=r.clone(),r.channel=n.texCoord),i.extensions[R.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[R.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const c=i.associations.get(r);r=i.extensions[R.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),i.associations.set(r,c)}}return s!==void 0&&(r.colorSpace=s),e[t]=r,r})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const s=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,r=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new h.PointsMaterial,h.Material.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(a,c)),n=c}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new h.LineBasicMaterial,h.Material.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(a,c)),n=c}if(s||i||r){let a="ClonedMaterial:"+n.uuid+":";s&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let c=this.cache.get(a);c||(c=n.clone(),i&&(c.vertexColors=!0),r&&(c.flatShading=!0),s&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(a,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return h.MeshStandardMaterial}loadMaterial(e){const t=this,n=this.json,s=this.extensions,i=n.materials[e];let r;const a={},c=i.extensions||{},l=[];if(c[R.KHR_MATERIALS_UNLIT]){const u=s[R.KHR_MATERIALS_UNLIT];r=u.getMaterialType(),l.push(u.extendParams(a,i,t))}else{const u=i.pbrMetallicRoughness||{};if(a.color=new h.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],h.LinearSRGBColorSpace),a.opacity=f[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(a,"map",u.baseColorTexture,h.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),r=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}i.doubleSided===!0&&(a.side=h.DoubleSide);const d=i.alphaMode||V.OPAQUE;if(d===V.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===V.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==h.MeshBasicMaterial&&(l.push(t.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new h.Vector2(1,1),i.normalTexture.scale!==void 0)){const u=i.normalTexture.scale;a.normalScale.set(u,u)}if(i.occlusionTexture!==void 0&&r!==h.MeshBasicMaterial&&(l.push(t.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==h.MeshBasicMaterial){const u=i.emissiveFactor;a.emissive=new h.Color().setRGB(u[0],u[1],u[2],h.LinearSRGBColorSpace)}return i.emissiveTexture!==void 0&&r!==h.MeshBasicMaterial&&l.push(t.assignTexture(a,"emissiveMap",i.emissiveTexture,h.SRGBColorSpace)),Promise.all(l).then(function(){const u=new r(a);return i.name&&(u.name=i.name),v(u,i),t.associations.set(u,{materials:e}),i.extensions&&I(s,u,i),u})}createUniqueName(e){const t=h.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,s=this.primitiveCache;function i(a){return n[R.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(c){return te(c,a,t)})}const r=[];for(let a=0,c=e.length;a<c;a++){const l=e[a],d=Ge(l),u=s[d];if(u)r.push(u.promise);else{let f;l.extensions&&l.extensions[R.KHR_DRACO_MESH_COMPRESSION]?f=i(l):f=te(new h.BufferGeometry,l,t),s[d]={primitive:l,promise:f},r.push(f)}}return Promise.all(r)}loadMesh(e){const t=this,n=this.json,s=this.extensions,i=n.meshes[e],r=i.primitives,a=[];for(let c=0,l=r.length;c<l;c++){const d=r[c].material===void 0?Fe(this.cache):this.getDependency("material",r[c].material);a.push(d)}return a.push(t.loadGeometries(r)),Promise.all(a).then(function(c){const l=c.slice(0,c.length-1),d=c[c.length-1],u=[];for(let p=0,g=d.length;p<g;p++){const _=d[p],A=r[p];let T;const y=l[p];if(A.mode===S.TRIANGLES||A.mode===S.TRIANGLE_STRIP||A.mode===S.TRIANGLE_FAN||A.mode===void 0)T=i.isSkinnedMesh===!0?new h.SkinnedMesh(_,y):new h.Mesh(_,y),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),A.mode===S.TRIANGLE_STRIP?T.geometry=Q(T.geometry,h.TriangleStripDrawMode):A.mode===S.TRIANGLE_FAN&&(T.geometry=Q(T.geometry,h.TriangleFanDrawMode));else if(A.mode===S.LINES)T=new h.LineSegments(_,y);else if(A.mode===S.LINE_STRIP)T=new h.Line(_,y);else if(A.mode===S.LINE_LOOP)T=new h.LineLoop(_,y);else if(A.mode===S.POINTS)T=new h.Points(_,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);Object.keys(T.geometry.morphAttributes).length>0&&He(T,i),T.name=t.createUniqueName(i.name||"mesh_"+e),v(T,i),A.extensions&&I(s,T,A),t.assignFinalMaterial(T),u.push(T)}for(let p=0,g=u.length;p<g;p++)t.associations.set(u[p],{meshes:e,primitives:p});if(u.length===1)return i.extensions&&I(s,u[0],i),u[0];const f=new h.Group;i.extensions&&I(s,f,i),t.associations.set(f,{meshes:e});for(let p=0,g=u.length;p<g;p++)f.add(u[p]);return f})}loadCamera(e){let t;const n=this.json.cameras[e],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new h.PerspectiveCamera(h.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new h.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),v(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let s=0,i=t.joints.length;s<i;s++)n.push(this._loadNodeShallow(t.joints[s]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){const i=s.pop(),r=s,a=[],c=[];for(let l=0,d=r.length;l<d;l++){const u=r[l];if(u){a.push(u);const f=new h.Matrix4;i!==null&&f.fromArray(i.array,l*16),c.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new h.Skeleton(a,c)})}loadAnimation(e){const t=this.json,n=this,s=t.animations[e],i=s.name?s.name:"animation_"+e,r=[],a=[],c=[],l=[],d=[];for(let u=0,f=s.channels.length;u<f;u++){const p=s.channels[u],g=s.samplers[p.sampler],_=p.target,A=_.node,T=s.parameters!==void 0?s.parameters[g.input]:g.input,y=s.parameters!==void 0?s.parameters[g.output]:g.output;_.node!==void 0&&(r.push(this.getDependency("node",A)),a.push(this.getDependency("accessor",T)),c.push(this.getDependency("accessor",y)),l.push(g),d.push(_))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(c),Promise.all(l),Promise.all(d)]).then(function(u){const f=u[0],p=u[1],g=u[2],_=u[3],A=u[4],T=[];for(let y=0,L=f.length;y<L;y++){const w=f[y],b=p[y],M=g[y],x=_[y],D=A[y];if(w===void 0)continue;w.updateMatrix&&w.updateMatrix();const C=n._createAnimationTracks(w,b,M,x,D);if(C)for(let U=0;U<C.length;U++)T.push(C[U])}return new h.AnimationClip(i,void 0,T)})}createNodeMesh(e){const t=this.json,n=this,s=t.nodes[e];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(i){const r=n._getNodeRef(n.meshCache,s.mesh,i);return s.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let c=0,l=s.weights.length;c<l;c++)a.morphTargetInfluences[c]=s.weights[c]}),r})}loadNode(e){const t=this.json,n=this,s=t.nodes[e],i=n._loadNodeShallow(e),r=[],a=s.children||[];for(let l=0,d=a.length;l<d;l++)r.push(n.getDependency("node",a[l]));const c=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([i,Promise.all(r),c]).then(function(l){const d=l[0],u=l[1],f=l[2];f!==null&&d.traverse(function(p){p.isSkinnedMesh&&p.bind(f,je)});for(let p=0,g=u.length;p<g;p++)d.add(u[p]);return d})}_loadNodeShallow(e){const t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const i=t.nodes[e],r=i.name?s.createUniqueName(i.name):"",a=[],c=s._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&a.push(c),i.camera!==void 0&&a.push(s.getDependency("camera",i.camera).then(function(l){return s._getNodeRef(s.cameraCache,i.camera,l)})),s._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){a.push(l)}),this.nodeCache[e]=Promise.all(a).then(function(l){let d;if(i.isBone===!0?d=new h.Bone:l.length>1?d=new h.Group:l.length===1?d=l[0]:d=new h.Object3D,d!==l[0])for(let u=0,f=l.length;u<f;u++)d.add(l[u]);if(i.name&&(d.userData.name=i.name,d.name=r),v(d,i),i.extensions&&I(n,d,i),i.matrix!==void 0){const u=new h.Matrix4;u.fromArray(i.matrix),d.applyMatrix4(u)}else i.translation!==void 0&&d.position.fromArray(i.translation),i.rotation!==void 0&&d.quaternion.fromArray(i.rotation),i.scale!==void 0&&d.scale.fromArray(i.scale);return s.associations.has(d)||s.associations.set(d,{}),s.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],s=this,i=new h.Group;n.name&&(i.name=s.createUniqueName(n.name)),v(i,n),n.extensions&&I(t,i,n);const r=n.nodes||[],a=[];for(let c=0,l=r.length;c<l;c++)a.push(s.getDependency("node",r[c]));return Promise.all(a).then(function(c){for(let d=0,u=c.length;d<u;d++)i.add(c[d]);const l=d=>{const u=new Map;for(const[f,p]of s.associations)(f instanceof h.Material||f instanceof h.Texture)&&u.set(f,p);return d.traverse(f=>{const p=s.associations.get(f);p!=null&&u.set(f,p)}),u};return s.associations=l(i),i})}_createAnimationTracks(e,t,n,s,i){const r=[],a=e.name?e.name:e.uuid,c=[];O[i.path]===O.weights?e.traverse(function(f){f.morphTargetInfluences&&c.push(f.name?f.name:f.uuid)}):c.push(a);let l;switch(O[i.path]){case O.weights:l=h.NumberKeyframeTrack;break;case O.rotation:l=h.QuaternionKeyframeTrack;break;case O.position:case O.scale:l=h.VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:l=h.NumberKeyframeTrack;break;case 2:case 3:default:l=h.VectorKeyframeTrack;break}break}const d=s.interpolation!==void 0?ke[s.interpolation]:h.InterpolateLinear,u=this._getArrayFromAccessor(n);for(let f=0,p=c.length;f<p;f++){const g=new l(c[f]+"."+O[i.path],t.array,u,d);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),r.push(g)}return r}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=$(t.constructor),s=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)s[i]=t[i]*n;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const s=this instanceof h.QuaternionKeyframeTrack?De:ne;return new s(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ve(o,e,t){const n=e.attributes,s=new h.Box3;if(n.POSITION!==void 0){const a=t.json.accessors[n.POSITION],c=a.min,l=a.max;if(c!==void 0&&l!==void 0){if(s.set(new h.Vector3(c[0],c[1],c[2]),new h.Vector3(l[0],l[1],l[2])),a.normalized){const d=$(P[a.componentType]);s.min.multiplyScalar(d),s.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=e.targets;if(i!==void 0){const a=new h.Vector3,c=new h.Vector3;for(let l=0,d=i.length;l<d;l++){const u=i[l];if(u.POSITION!==void 0){const f=t.json.accessors[u.POSITION],p=f.min,g=f.max;if(p!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(p[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(g[2]))),f.normalized){const _=$(P[f.componentType]);c.multiplyScalar(_)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(a)}o.boundingBox=s;const r=new h.Sphere;s.getCenter(r.center),r.radius=s.min.distanceTo(s.max)/2,o.boundingSphere=r}function te(o,e,t){const n=e.attributes,s=[];function i(r,a){return t.getDependency("accessor",r).then(function(c){o.setAttribute(a,c)})}for(const r in n){const a=W[r]||r.toLowerCase();a in o.attributes||s.push(i(n[r],a))}if(e.indices!==void 0&&!o.index){const r=t.getDependency("accessor",e.indices).then(function(a){o.setIndex(a)});s.push(r)}return h.ColorManagement.workingColorSpace!==h.LinearSRGBColorSpace&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${h.ColorManagement.workingColorSpace}" not supported.`),v(o,e),Ve(o,e,t),Promise.all(s).then(function(){return e.targets!==void 0?Be(o,e.targets,t):o})}var ze=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,We=(o,e,t,n)=>{for(var s=n>1?void 0:n?Xe(e,t):e,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(e,t,s):r(s))||s);return n&&s&&ze(e,t,s),s};let F=class{constructor(){E(this,"workerPool",m.C(void 0,!0));E(this,"canvas");E(this,"offscreenCanvas");E(this,"worker");E(this,"thread")}init(o){this.worker=o.worker,this.thread=o.thread}preventDefaultHandler(o){return o.preventDefault(),{type:o.type}}getScreenSizes(){var o,e;return{width:(o=this.canvas)==null?void 0:o.width,height:(e=this.canvas)==null?void 0:e.height,windowWidth:(window==null?void 0:window.innerWidth)??0,windowHeight:(window==null?void 0:window.innerHeight)??0}}uiEventHandler(o){var t;const e=(t=this.canvas)==null?void 0:t.getBoundingClientRect();return console.log("uiEventHandler",this.getScreenSizes(),o.type,e==null?void 0:e.top,e==null?void 0:e.left),{...this.getScreenSizes(),type:o.type,top:e==null?void 0:e.top,left:e==null?void 0:e.left}}mouseEventHandler(o){return{...this.getScreenSizes(),...m.J(o,["ctrlKey","metaKey","shiftKey","button","pointerType","clientX","clientY","pageX","pageY"])}}touchEventHandler(o){const e=[],t={type:o.type,touches:e};for(let n=0;n<o.touches.length;++n){const s=o.touches[n];e.push({pageX:(s==null?void 0:s.pageX)??0,pageY:(s==null?void 0:s.pageY)??0})}return{...this.getScreenSizes(),...t}}wheelEventHandler(o){return o.preventDefault(),{...this.getScreenSizes(),...m.J(o,["deltaX","deltaY"])}}keyEventHandler(o){if(m.KEYBOARD_EVENT_CODES.includes(o.code))return o.preventDefault(),{...this.getScreenSizes(),...m.J(o,["ctrlKey","metaKey","shiftKey","keyCode"])}}};F=We([m.scoped(m.Lifecycle.ContainerScoped)],F);var $e=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Ye=(o,e,t,n)=>{for(var s=n>1?void 0:n?qe(e,t):e,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(e,t,s):r(s))||s);return n&&s&&$e(e,t,s),s},Qe=(o,e)=>(t,n)=>e(t,n,o);let q=class extends m.ProxyEventHandlersBlueprint{constructor(o){super(),this._service=o}init(){for(const o of m.PROXY_EVENT_LISTENERS){const e=o.startsWith("mouse")||o.startsWith("pointer")||o.startsWith("touch")?this._service.mouseEventHandler.bind(this._service):o.startsWith("key")?this._service.keyEventHandler.bind(this._service):o==="resize"?this._service.uiEventHandler.bind(this._service):o==="wheel"?this._service.wheelEventHandler.bind(this._service):this._service.preventDefaultHandler.bind(this._service);this[`${o}$`]=m.fromEvent(o==="resize"?window:this._service.canvas,o).pipe(m.map(e.bind(this)),m.filter(t=>!(o==="keydown"&&!t))),this[`${o}$`].subscribe(t=>{var n,s;(s=(n=this._service.thread)==null?void 0:n[o])==null||s.call(n,t)})}}};q=Ye([oe(),Qe(0,m.inject(F))],q);var Je=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,et=(o,e,t,n)=>{for(var s=n>1?void 0:n?Ze(e,t):e,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(e,t,s):r(s))||s);return n&&s&&Je(e,t,s),s};let B=class{constructor(){E(this,"loadingManager",new h.LoadingManager);E(this,"loaders",{});E(this,"sources",[]);E(this,"loadedResources",{});E(this,"toLoadCount",0);E(this,"loadedCount",0)}get videoLoader(){return{load:(o,e)=>{const t=document.createElement("video");t.muted=!0,t.loop=!0,t.crossOrigin="anonymous",t.controls=!1,t.playsInline=!0,t.src=o,t.autoplay=!0;const n=async()=>{e(t),t.removeEventListener("canplaythrough",n)};t.addEventListener("canplaythrough",n)}}}_initLoaders(){this.loaders.dracoLoader=new ce(this.loadingManager),this.loaders.audioLoader=new h.AudioLoader(this.loadingManager),this.loaders.fontLoader=new m.FontLoader(this.loadingManager),this.loaders.gltfLoader=new ue(this.loadingManager),this.loaders.imageLoader=new h.ImageBitmapLoader(this.loadingManager),this.loaders.videoLoader=this.videoLoader}_initSources(o){this.sources=o,this.toLoadCount=this.sources.length,this.loadedCount=0}init(o=[]){this._initLoaders(),this._initSources(o)}setDracoDecoder(o){var e;this.loaders.dracoLoader&&(this.loaders.dracoLoader.setDecoderPath(o??"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),(e=this.loaders.gltfLoader)==null||e.setDRACOLoader(this.loaders.dracoLoader))}handleLoad({source:o,resource:e,toLoadCount:t,loadedCount:n}){e&&(this.loadedResources[o.name]=e,this.loadedCount=n,this.toLoadCount=t)}launchLoad(o){var t,n,s,i,r;const e=this.sources[0];if(e){o==null||o(e);for(const a of this.sources){if(this.loadedResources[a.name]||typeof a.path!="string")return;a.type==="gltf"&&((t=this.loaders.gltfLoader)==null||t.load(a.path,c=>o==null?void 0:o(a,c))),a.type==="audio"&&((n=this.loaders.audioLoader)==null||n.load(a.path,c=>o==null?void 0:o(a,c))),a.type==="image"&&((s=this.loaders.imageLoader)==null||s.load(a.path,c=>o==null?void 0:o(a,c))),a.type==="video"&&((i=this.loaders.videoLoader)==null||i.load(a.path,c=>o==null?void 0:o(a,c))),a.type==="font"&&((r=this.loaders.fontLoader)==null||r.load(a.path,c=>o==null?void 0:o(a,c)))}}}};B=et([m.scoped(m.Lifecycle.ContainerScoped)],B);var tt=Object.defineProperty,st=Object.getOwnPropertyDescriptor,nt=(o,e,t,n)=>{for(var s=n>1?void 0:n?st(e,t):e,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(e,t,s):r(s))||s);return n&&s&&tt(e,t,s),s},rt=(o,e)=>(t,n)=>e(t,n,o);let H=class{constructor(o){E(this,"load$$",new m.Subject);E(this,"load$",this.load$$.pipe(m.map(o=>({...o,loadedCount:o.resource?this._service.loadedCount+1:this._service.loadedCount,toLoadCount:this._service.toLoadCount})),m.share()));E(this,"serializedLoad$",this.load$.pipe(m.map(o=>{var t,n,s;let e=o.resource;if((t=o==null?void 0:o.resource)!=null&&t.parser){const i=o.resource,r=i.scenes.map(a=>m.W(a));e={animations:(o==null?void 0:o.resource).animations.map(a=>a.toJSON()),cameras:i.cameras.map(a=>m.W(a)),parser:{json:i.parser.json},scene:r==null?void 0:r[0],scenes:r,userData:i.userData}}return((n=o==null?void 0:o.source)==null?void 0:n.type)==="audio"&&o.resource instanceof AudioBuffer&&(e={arrayBuffer:o.resource.getChannelData(0),length:o.resource.length,sampleRate:o.resource.sampleRate,duration:o.resource.duration}),((s=o==null?void 0:o.source)==null?void 0:s.type)==="video"&&o.resource instanceof HTMLVideoElement&&(e={...m.J(o.resource,["autoplay","baseURI","controls","crossOrigin","currentTime","defaultMuted","disablePictureInPicture","draggable","duration","ended","height","hidden","loop","muted","nodeName","nodeType","paused","playbackRate","playsInline","poster","preload","readyState","seeking","spellcheck","src","tabIndex","translate","videoHeight","videoWidth","volume","width"]),buffered:o.resource.buffered.length,error:o.resource.error?m.U(o.resource.error,[]):{},played:o.resource.played.length,seekable:o.resource.seekable.length,textTracks:o.resource.textTracks.length}),{...o,resource:e}}),m.share()));E(this,"loadCompleted$",this.load$.pipe(m.filter(o=>o.toLoadCount===o.loadedCount),m.map(()=>m.J(this._service,["loadedCount","loadedResources","toLoadCount"])),m.share()));this._service=o}};H=nt([m.scoped(m.Lifecycle.ContainerScoped),rt(0,m.inject(B))],H);var it=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,at=(o,e,t,n)=>{for(var s=n>1?void 0:n?ot(e,t):e,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(e,t,s):r(s))||s);return n&&s&&it(e,t,s),s},X=(o,e)=>(t,n)=>e(t,n,o);let Y=class{constructor(o,e,t){E(this,"_subscriptions",[]);this._controller=o,this._service=e,this._props=t,this._subscriptions.push(this._controller.load$.subscribe(this._service.handleLoad.bind(this._service)))}init(o=[]){this._service.init(o),this._service.setDracoDecoder(),[void 0,!0].includes(this._props.loadResourcesOnInit)&&this.load()}load(){this._service.launchLoad((o,e)=>this._controller.load$$.next({source:o,resource:e}))}getLoadedResources(){return this._service.loadedResources}getLoaders(){return this._service.loaders}getSources(){return this._service.sources}getLoadedCount(){return this._service.loadedCount}getToLoadCount(){return this._service.toLoadCount}getLoad$(){return this._controller.load$}getLoadCompleted$(){return this._controller.loadCompleted$}setDracoDecoder(o){this._service.setDracoDecoder(o)}dispose(){this._subscriptions.forEach(o=>o.unsubscribe()),this._controller.load$$.complete()}};Y=at([m.scoped(m.Lifecycle.ContainerScoped),X(0,m.inject(H)),X(1,m.inject(B)),X(2,m.inject(G))],Y);var ct=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,ut=(o,e,t,n)=>{for(var s=n>1?void 0:n?lt(e,t):e,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(e,t,s):r(s))||s);return n&&s&&ct(e,t,s),s},N=(o,e)=>(t,n)=>e(t,n,o);exports.RegisterModule=class extends m.RegisterProxyEventHandlersBlueprint{constructor(t,n,s,i,r,a){super();E(this,"_subscriptions",[]);E(this,"_initialized",!1);this._service=t,this._controller=n,this._loaderController=s,this.container=i,this.props=r,this.loader=a,this.props.initOnConstruct&&this.init()}async _initCanvas(){try{if(this.props.canvas instanceof HTMLCanvasElement&&(this._service.canvas=this.props.canvas),typeof this.props.canvas=="string"){const t=document.querySelector(this.props.canvas);t instanceof HTMLCanvasElement&&(this._service.canvas=t)}this._service.canvas||(this._service.canvas=document.createElement("canvas"),this._service.canvas.dataset.reactive="true",document.body.appendChild(this._service.canvas))}catch(t){console.error(`🛑 Unable to initialize the canvas:
3
- ${t instanceof Error?t.message:"Something went wrong"}`)}}async _initService(){this._service.init({worker:this._service.worker,thread:this._service.thread})}async _initEvents(){var t,n;if(!this._service.canvas)throw new Error("Canvas element is not initialized.");if(!this._service.thread||!this._service.worker)throw new Error("Worker-thread is not initialized.");this._controller.init(),this.props.fullScreen&&((n=(t=this._service.thread)==null?void 0:t.resize)==null||n.call(t,{...this._service.uiEventHandler({type:"resize"})}))}async _initWorkerThread(){if(!this._service.canvas)throw new Error("Canvas element is not initialized.");this._service.offscreenCanvas=this._service.canvas.transferControlToOffscreen(),this._service.offscreenCanvas.width=this._service.canvas.clientWidth,this._service.offscreenCanvas.height=this._service.canvas.clientHeight;const[t,n]=await this._service.workerPool.run({payload:{path:this.props.location,subject:{...m.U(this.props,["canvas","location","onReady","loaderDataSources"]),canvas:this._service.offscreenCanvas},transferSubject:[this._service.offscreenCanvas]}});if(!t||n)throw new Error("Unable to retrieve the worker-thread info.");this._service.worker=t.worker,this._service.thread=t.thread}async _initObservableProxyEvents(){m.PROXY_EVENT_LISTENERS.forEach(t=>this[`${t}$`]=()=>{var n;return(n=this._controller)==null?void 0:n[`${t}$`]})}async _initLoader(){this.loader.init(this.props.loaderDataSources),this._subscriptions.push(this._loaderController.serializedLoad$.subscribe(t=>{var n,s;if(t.resource instanceof ArrayBuffer)return(n=this._service.worker)==null?void 0:n.postMessage(t.resource,[t.resource]);(s=this._service.worker)==null||s.postMessage({token:m.LOADER_SERIALIZED_LOAD_TOKEN,payload:t})}))}async init(){var t,n;this._initialized||(this._initialized=!0,await this._initCanvas(),await this._initWorkerThread(),await this._initService(),await this._initObservableProxyEvents(),await this._initLoader(),await this._initEvents(),(n=(t=this.props).onReady)==null||n.call(t,{module:this,container:this.container}))}getCanvas(){return this._service.canvas}getOffscreenCanvas(){return this._service.offscreenCanvas}getThread(){return this._service.thread}getWorker(){return this._service.worker}getWorkerPool(){return this._service.workerPool}isInitialized(){return this._initialized}async dispose(){var t;this._subscriptions.map(n=>n.unsubscribe()),await this._service.workerPool.terminateAll(),((t=this._service.canvas)==null?void 0:t.dataset.reactive)==="true"&&(document.body.removeChild(this._service.canvas),this._service.canvas.remove(),this._service.canvas=void 0),this._initialized=!1}};exports.RegisterModule=ut([m.scoped(m.Lifecycle.ResolutionScoped),N(0,m.inject(F)),N(1,m.inject(q)),N(2,m.inject(H)),N(3,m.inject(m.CONTAINER_TOKEN)),N(4,m.inject(G)),N(5,m.inject(Y))],exports.RegisterModule);const ht=o=>{if(typeof(o==null?void 0:o.location)!="string"&&!((o==null?void 0:o.location)instanceof URL))throw new Error("Invalid register props detected. location path is required");const e=m.instance.createChildContainer();o.initOnConstruct=m.A(o.initOnConstruct)||!m.D(o.initOnConstruct)?!0:o.initOnConstruct,o.defaultCamera=o!=null&&o.defaultCamera&&o.defaultCamera in m.DefaultCameraType?o.defaultCamera:m.DefaultCameraType.PERSPECTIVE,o.withMiniCamera=m.A(o.withMiniCamera)||!m.D(o.withMiniCamera)?!1:o.withMiniCamera,o.startTimer=m.A(o.startTimer)||!m.D(o.startTimer)?!0:o.startTimer,o.fullScreen=m.A(o.fullScreen)||!m.D(o.fullScreen)?!0:o.fullScreen,o.onReady=m.Q(o.onReady)?o.onReady:void 0,e.register(m.CONTAINER_TOKEN,{useValue:e}),e.register(G,{useValue:o});const t=e.resolve(exports.RegisterModule);return{container:e,module:t}};Object.defineProperty(exports,"AppModule",{enumerable:!0,get:()=>m.AppModule});exports.AppProxyEventHandlersBlueprint=m.AppProxyEventHandlersBlueprint;exports.CONTAINER_TOKEN=m.CONTAINER_TOKEN;exports.DefaultCameraType=m.DefaultCameraType;exports.KEYBOARD_EVENT_CODES=m.KEYBOARD_EVENT_CODES;exports.LOADER_SERIALIZED_LOAD_TOKEN=m.LOADER_SERIALIZED_LOAD_TOKEN;exports.PROXY_EVENT_LISTENERS=m.PROXY_EVENT_LISTENERS;exports.ProxyEventHandlersBlueprint=m.ProxyEventHandlersBlueprint;exports.ProxyEventObservablesBlueprint=m.ProxyEventObservablesBlueprint;exports.ProxyEventSubjectsBlueprint=m.ProxyEventSubjectsBlueprint;exports.RegisterProxyEventHandlersBlueprint=m.RegisterProxyEventHandlersBlueprint;exports.LaunchAppProps=ae;exports.RegisterPropsBlueprint=G;exports.register=ht;
1
+ "use strict";var re=Object.defineProperty;var ie=(o,t,e)=>t in o?re(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var E=(o,t,e)=>ie(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./app.module-x3kmydmS.js"),h=require("three");function oe(){return function(o){m.injectable()(o),m.instance.registerSingleton(o)}}class G{constructor(){E(this,"location");E(this,"initOnConstruct");E(this,"canvas");E(this,"fullScreen");E(this,"defaultCamera");E(this,"startTimer");E(this,"loaderDataSources",[]);E(this,"loadResourcesOnInit");E(this,"enableDebug");E(this,"enableControls");E(this,"axesSizes");E(this,"gridSizes");E(this,"withMiniCamera");E(this,"onReady")}}class ae{constructor(){E(this,"onReady")}}function Q(o,t){if(t===h.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(t===h.TriangleFanDrawMode||t===h.TriangleStripDrawMode){let e=o.getIndex();if(e===null){const r=[],a=o.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)r.push(c);o.setIndex(r),e=o.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),o}const n=e.count-2,s=[];if(t===h.TriangleFanDrawMode)for(let r=1;r<=n;r++)s.push(e.getX(0)),s.push(e.getX(r)),s.push(e.getX(r+1));else for(let r=0;r<n;r++)r%2===0?(s.push(e.getX(r)),s.push(e.getX(r+1)),s.push(e.getX(r+2))):(s.push(e.getX(r+2)),s.push(e.getX(r+1)),s.push(e.getX(r)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=o.clone();return i.setIndex(s),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),o}const j=new WeakMap;class ce extends h.Loader{constructor(t){super(t),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(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,n,s){const i=new h.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(t,r=>{this.parse(r,e,s)},n,s)}parse(t,e,n=()=>{}){this.decodeDracoFile(t,e,null,null,h.SRGBColorSpace,n).catch(n)}decodeDracoFile(t,e,n,s,i=h.LinearSRGBColorSpace,r=()=>{}){const a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:i};return this.decodeGeometry(t,a).then(e).catch(r)}decodeGeometry(t,e){const n=JSON.stringify(e);if(j.has(t)){const c=j.get(t);if(c.key===n)return c.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const i=this.workerNextTaskID++,r=t.byteLength,a=this._getWorker(i,r).then(c=>(s=c,new Promise((l,d)=>{s._callbacks[i]={resolve:l,reject:d},s.postMessage({type:"decode",id:i,taskConfig:e,buffer:t},[t])}))).then(c=>this._createGeometry(c.geometry));return a.catch(()=>!0).then(()=>{s&&i&&this._releaseTask(s,i)}),j.set(t,{key:n,promise:a}),a}_createGeometry(t){const e=new h.BufferGeometry;t.index&&e.setIndex(new h.BufferAttribute(t.index.array,1));for(let n=0;n<t.attributes.length;n++){const s=t.attributes[n],i=s.name,r=s.array,a=s.itemSize,c=new h.BufferAttribute(r,a);i==="color"&&(this._assignVertexColorSpace(c,s.vertexColorSpace),c.normalized=!(r instanceof Float32Array)),e.setAttribute(i,c)}return e}_assignVertexColorSpace(t,e){if(e!==h.SRGBColorSpace)return;const n=new h.Color;for(let s=0,i=t.count;s<i;s++)n.fromBufferAttribute(t,s),h.ColorManagement.toWorkingColorSpace(n,h.SRGBColorSpace),t.setXYZ(s,n.r,n.g,n.b)}_loadLibrary(t,e){const n=new h.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise((s,i)=>{n.load(t,s,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then(n=>{const s=n[0];t||(this.decoderConfig.wasmBinary=n[1]);const i=le.toString(),r=["/* draco decoder */",s,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join(`
2
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(i){const r=i.data;switch(r.type){case"decode":s._callbacks[r.id].resolve(r);break;case"error":s._callbacks[r.id].reject(r);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,i){return s._taskLoad>i._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[t]=e,n._taskLoad+=e,n})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function le(){let o,t;onmessage=function(r){const a=r.data;switch(a.type){case"init":o=a.decoderConfig,t=new Promise(function(d){o.onModuleLoaded=function(u){d({draco:u})},DracoDecoderModule(o)});break;case"decode":const c=a.buffer,l=a.taskConfig;t.then(d=>{const u=d.draco,f=new u.Decoder;try{const p=e(u,f,new Int8Array(c),l),g=p.attributes.map(_=>_.array.buffer);p.index&&g.push(p.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:p},g)}catch(p){console.error(p),self.postMessage({type:"error",id:a.id,error:p.message})}finally{u.destroy(f)}});break}};function e(r,a,c,l){const d=l.attributeIDs,u=l.attributeTypes;let f,p;const g=a.GetEncodedGeometryType(c);if(g===r.TRIANGULAR_MESH)f=new r.Mesh,p=a.DecodeArrayToMesh(c,c.byteLength,f);else if(g===r.POINT_CLOUD)f=new r.PointCloud,p=a.DecodeArrayToPointCloud(c,c.byteLength,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const _={index:null,attributes:[]};for(const A in d){const T=self[u[A]];let y,L;if(l.useUniqueIDs)L=d[A],y=a.GetAttributeByUniqueId(f,L);else{if(L=a.GetAttributeId(f,r[d[A]]),L===-1)continue;y=a.GetAttribute(f,L)}const w=s(r,a,f,A,T,y);A==="color"&&(w.vertexColorSpace=l.vertexColorSpace),_.attributes.push(w)}return g===r.TRIANGULAR_MESH&&(_.index=n(r,a,f)),r.destroy(f),_}function n(r,a,c){const d=c.num_faces()*3,u=d*4,f=r._malloc(u);a.GetTrianglesUInt32Array(c,u,f);const p=new Uint32Array(r.HEAPF32.buffer,f,d).slice();return r._free(f),{array:p,itemSize:1}}function s(r,a,c,l,d,u){const f=u.num_components(),g=c.num_points()*f,_=g*d.BYTES_PER_ELEMENT,A=i(r,d),T=r._malloc(_);a.GetAttributeDataArrayForAllPoints(c,u,A,_,T);const y=new d(r.HEAPF32.buffer,T,g).slice();return r._free(T),{name:l,array:y,itemSize:f}}function i(r,a){switch(a){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32}}}class ue extends h.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new me(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new Se(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new be(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new _e(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new pe(e)}),this.register(function(e){return new ye(e)}),this.register(function(e){return new Ae(e)}),this.register(function(e){return new Le(e)}),this.register(function(e){return new we(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new ve(e)}),this.register(function(e){return new Me(e)})}load(t,e,n,s){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const l=h.LoaderUtils.extractUrlBase(t);r=h.LoaderUtils.resolveURL(l,this.path)}else r=h.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(l){s?s(l):console.error(l),i.manager.itemError(t),i.manager.itemEnd(t)},c=new h.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(t,function(l){try{i.parse(l,r,function(d){e(d),i.manager.itemEnd(t)},a)}catch(d){a(d)}},n,a)}setDRACOLoader(t){return this.dracoLoader=t,this}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,n,s){let i;const r={},a={},c=new TextDecoder;if(typeof t=="string")i=JSON.parse(t);else if(t instanceof ArrayBuffer)if(c.decode(new Uint8Array(t,0,4))===se){try{r[R.KHR_BINARY_GLTF]=new Ce(t)}catch(u){s&&s(u);return}i=JSON.parse(r[R.KHR_BINARY_GLTF].content)}else i=JSON.parse(c.decode(t));else i=t;if(i.asset===void 0||i.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new Ke(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const u=this.pluginCallbacks[d](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,r[u.name]=!0}if(i.extensionsUsed)for(let d=0;d<i.extensionsUsed.length;++d){const u=i.extensionsUsed[d],f=i.extensionsRequired||[];switch(u){case R.KHR_MATERIALS_UNLIT:r[u]=new fe;break;case R.KHR_DRACO_MESH_COMPRESSION:r[u]=new Oe(i,this.dracoLoader);break;case R.KHR_TEXTURE_TRANSFORM:r[u]=new Ie;break;case R.KHR_MESH_QUANTIZATION:r[u]=new Ne;break;default:f.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(r),l.setPlugins(a),l.parse(n,s)}parseAsync(t,e){const n=this;return new Promise(function(s,i){n.parse(t,e,s,i)})}}function he(){let o={};return{get:function(t){return o[t]},add:function(t,e){o[t]=e},remove:function(t){delete o[t]},removeAll:function(){o={}}}}const R={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 de{constructor(t){this.parser=t,this.name=R.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,s=e.length;n<s;n++){const i=e[n];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let s=e.cache.get(n);if(s)return s;const i=e.json,c=((i.extensions&&i.extensions[this.name]||{}).lights||[])[t];let l;const d=new h.Color(16777215);c.color!==void 0&&d.setRGB(c.color[0],c.color[1],c.color[2],h.LinearSRGBColorSpace);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new h.DirectionalLight(d),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new h.PointLight(d),l.distance=u;break;case"spot":l=new h.SpotLight(d),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),l.decay=2,v(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=e.createUniqueName(c.name||"light_"+t),s=Promise.resolve(l),e.cache.add(n,s),s}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,n=this.parser,i=n.json.nodes[t],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(c){return n._getNodeRef(e.cache,a,c)})}}class fe{constructor(){this.name=R.KHR_MATERIALS_UNLIT}getMaterialType(){return h.MeshBasicMaterial}extendParams(t,e,n){const s=[];t.color=new h.Color(1,1,1),t.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const r=i.baseColorFactor;t.color.setRGB(r[0],r[1],r[2],h.LinearSRGBColorSpace),t.opacity=r[3]}i.baseColorTexture!==void 0&&s.push(n.assignTexture(t,"map",i.baseColorTexture,h.SRGBColorSpace))}return Promise.all(s)}}class pe{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name].emissiveStrength;return i!==void 0&&(e.emissiveIntensity=i),Promise.resolve()}}class me{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];if(r.clearcoatFactor!==void 0&&(e.clearcoat=r.clearcoatFactor),r.clearcoatTexture!==void 0&&i.push(n.assignTexture(e,"clearcoatMap",r.clearcoatTexture)),r.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=r.clearcoatRoughnessFactor),r.clearcoatRoughnessTexture!==void 0&&i.push(n.assignTexture(e,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),r.clearcoatNormalTexture!==void 0&&(i.push(n.assignTexture(e,"clearcoatNormalMap",r.clearcoatNormalTexture)),r.clearcoatNormalTexture.scale!==void 0)){const a=r.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new h.Vector2(a,a)}return Promise.all(i)}}class ge{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_DISPERSION}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name];return e.dispersion=i.dispersion!==void 0?i.dispersion:0,Promise.resolve()}}class Ae{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return r.iridescenceFactor!==void 0&&(e.iridescence=r.iridescenceFactor),r.iridescenceTexture!==void 0&&i.push(n.assignTexture(e,"iridescenceMap",r.iridescenceTexture)),r.iridescenceIor!==void 0&&(e.iridescenceIOR=r.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),r.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=r.iridescenceThicknessMinimum),r.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=r.iridescenceThicknessMaximum),r.iridescenceThicknessTexture!==void 0&&i.push(n.assignTexture(e,"iridescenceThicknessMap",r.iridescenceThicknessTexture)),Promise.all(i)}}class Te{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_SHEEN}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[];e.sheenColor=new h.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const r=s.extensions[this.name];if(r.sheenColorFactor!==void 0){const a=r.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace)}return r.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=r.sheenRoughnessFactor),r.sheenColorTexture!==void 0&&i.push(n.assignTexture(e,"sheenColorMap",r.sheenColorTexture,h.SRGBColorSpace)),r.sheenRoughnessTexture!==void 0&&i.push(n.assignTexture(e,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(i)}}class _e{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return r.transmissionFactor!==void 0&&(e.transmission=r.transmissionFactor),r.transmissionTexture!==void 0&&i.push(n.assignTexture(e,"transmissionMap",r.transmissionTexture)),Promise.all(i)}}class Re{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_VOLUME}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];e.thickness=r.thicknessFactor!==void 0?r.thicknessFactor:0,r.thicknessTexture!==void 0&&i.push(n.assignTexture(e,"thicknessMap",r.thicknessTexture)),e.attenuationDistance=r.attenuationDistance||1/0;const a=r.attenuationColor||[1,1,1];return e.attenuationColor=new h.Color().setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace),Promise.all(i)}}class Ee{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_IOR}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name];return e.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}}class ye{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_SPECULAR}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];e.specularIntensity=r.specularFactor!==void 0?r.specularFactor:1,r.specularTexture!==void 0&&i.push(n.assignTexture(e,"specularIntensityMap",r.specularTexture));const a=r.specularColorFactor||[1,1,1];return e.specularColor=new h.Color().setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace),r.specularColorTexture!==void 0&&i.push(n.assignTexture(e,"specularColorMap",r.specularColorTexture,h.SRGBColorSpace)),Promise.all(i)}}class we{constructor(t){this.parser=t,this.name=R.EXT_MATERIALS_BUMP}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return e.bumpScale=r.bumpFactor!==void 0?r.bumpFactor:1,r.bumpTexture!==void 0&&i.push(n.assignTexture(e,"bumpMap",r.bumpTexture)),Promise.all(i)}}class Le{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return r.anisotropyStrength!==void 0&&(e.anisotropy=r.anisotropyStrength),r.anisotropyRotation!==void 0&&(e.anisotropyRotation=r.anisotropyRotation),r.anisotropyTexture!==void 0&&i.push(n.assignTexture(e,"anisotropyMap",r.anisotropyTexture)),Promise.all(i)}}class Se{constructor(t){this.parser=t,this.name=R.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,n=e.json,s=n.textures[t];if(!s.extensions||!s.extensions[this.name])return null;const i=s.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,i.source,r)}}class xe{constructor(t){this.parser=t,this.name=R.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,s=n.json,i=s.textures[t];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=s.images[r.source];let c=n.textureLoader;if(a.uri){const l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(t,r.source,c);if(s.extensionsRequired&&s.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.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 be{constructor(t){this.parser=t,this.name=R.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,s=n.json,i=s.textures[t];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=s.images[r.source];let c=n.textureLoader;if(a.uri){const l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(t,r.source,c);if(s.extensionsRequired&&s.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.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 ve{constructor(t){this.name=R.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const s=n.extensions[this.name],i=this.parser.getDependency("buffer",s.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.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 i.then(function(a){const c=s.byteOffset||0,l=s.byteLength||0,d=s.count,u=s.byteStride,f=new Uint8Array(a,c,l);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(d,u,f,s.mode,s.filter).then(function(p){return p.buffer}):r.ready.then(function(){const p=new ArrayBuffer(d*u);return r.decodeGltfBuffer(new Uint8Array(p),d,u,f,s.mode,s.filter),p})})}else return null}}class Me{constructor(t){this.name=R.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const s=e.meshes[n.mesh];for(const l of s.primitives)if(l.mode!==S.TRIANGLES&&l.mode!==S.TRIANGLE_STRIP&&l.mode!==S.TRIANGLE_FAN&&l.mode!==void 0)return null;const r=n.extensions[this.name].attributes,a=[],c={};for(const l in r)a.push(this.parser.getDependency("accessor",r[l]).then(d=>(c[l]=d,c[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(l=>{const d=l.pop(),u=d.isGroup?d.children:[d],f=l[0].count,p=[];for(const g of u){const _=new h.Matrix4,A=new h.Vector3,T=new h.Quaternion,y=new h.Vector3(1,1,1),L=new h.InstancedMesh(g.geometry,g.material,f);for(let w=0;w<f;w++)c.TRANSLATION&&A.fromBufferAttribute(c.TRANSLATION,w),c.ROTATION&&T.fromBufferAttribute(c.ROTATION,w),c.SCALE&&y.fromBufferAttribute(c.SCALE,w),L.setMatrixAt(w,_.compose(A,T,y));for(const w in c)if(w==="_COLOR_0"){const b=c[w];L.instanceColor=new h.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else w!=="TRANSLATION"&&w!=="ROTATION"&&w!=="SCALE"&&g.geometry.setAttribute(w,c[w]);h.Object3D.prototype.copy.call(L,g),this.parser.assignFinalMaterial(L),p.push(L)}return d.isGroup?(d.clear(),d.add(...p),d):p[0]}))}}const se="glTF",k=12,J={JSON:1313821514,BIN:5130562};class Ce{constructor(t){this.name=R.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,k),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==se)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-k,i=new DataView(t,k);let r=0;for(;r<s;){const a=i.getUint32(r,!0);r+=4;const c=i.getUint32(r,!0);if(r+=4,c===J.JSON){const l=new Uint8Array(t,k+r,a);this.content=n.decode(l)}else if(c===J.BIN){const l=k+r;this.body=t.slice(l,l+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Oe{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=R.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,s=this.dracoLoader,i=t.extensions[this.name].bufferView,r=t.extensions[this.name].attributes,a={},c={},l={};for(const d in r){const u=W[d]||d.toLowerCase();a[u]=r[d]}for(const d in t.attributes){const u=W[d]||d.toLowerCase();if(r[d]!==void 0){const f=n.accessors[t.attributes[d]],p=P[f.componentType];l[u]=p.name,c[u]=f.normalized===!0}}return e.getDependency("bufferView",i).then(function(d){return new Promise(function(u,f){s.decodeDracoFile(d,function(p){for(const g in p.attributes){const _=p.attributes[g],A=c[g];A!==void 0&&(_.normalized=A)}u(p)},a,l,h.LinearSRGBColorSpace,f)})})}}class Ie{constructor(){this.name=R.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 Ne{constructor(){this.name=R.KHR_MESH_QUANTIZATION}}class ne extends h.Interpolant{constructor(t,e,n,s){super(t,e,n,s)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,s=this.valueSize,i=t*s*3+s;for(let r=0;r!==s;r++)e[r]=n[i+r];return e}interpolate_(t,e,n,s){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,c=a*2,l=a*3,d=s-e,u=(n-e)/d,f=u*u,p=f*u,g=t*l,_=g-l,A=-2*p+3*f,T=p-f,y=1-A,L=T-f+u;for(let w=0;w!==a;w++){const b=r[_+w+a],M=r[_+w+c]*d,x=r[g+w+a],D=r[g+w]*d;i[w]=y*b+L*M+A*x+T*D}return i}}const Pe=new h.Quaternion;class De extends ne{interpolate_(t,e,n,s){const i=super.interpolate_(t,e,n,s);return Pe.fromArray(i).normalize().toArray(i),i}}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},P={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Z={9728:h.NearestFilter,9729:h.LinearFilter,9984:h.NearestMipmapNearestFilter,9985:h.LinearMipmapNearestFilter,9986:h.NearestMipmapLinearFilter,9987:h.LinearMipmapLinearFilter},ee={33071:h.ClampToEdgeWrapping,33648:h.MirroredRepeatWrapping,10497:h.RepeatWrapping},K={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},W={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"},ke={CUBICSPLINE:void 0,LINEAR:h.InterpolateLinear,STEP:h.InterpolateDiscrete},V={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Fe(o){return o.DefaultMaterial===void 0&&(o.DefaultMaterial=new h.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:h.FrontSide})),o.DefaultMaterial}function I(o,t,e){for(const n in e.extensions)o[n]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=e.extensions[n])}function v(o,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(o.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Be(o,t,e){let n=!1,s=!1,i=!1;for(let l=0,d=t.length;l<d;l++){const u=t[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(s=!0),u.COLOR_0!==void 0&&(i=!0),n&&s&&i)break}if(!n&&!s&&!i)return Promise.resolve(o);const r=[],a=[],c=[];for(let l=0,d=t.length;l<d;l++){const u=t[l];if(n){const f=u.POSITION!==void 0?e.getDependency("accessor",u.POSITION):o.attributes.position;r.push(f)}if(s){const f=u.NORMAL!==void 0?e.getDependency("accessor",u.NORMAL):o.attributes.normal;a.push(f)}if(i){const f=u.COLOR_0!==void 0?e.getDependency("accessor",u.COLOR_0):o.attributes.color;c.push(f)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(c)]).then(function(l){const d=l[0],u=l[1],f=l[2];return n&&(o.morphAttributes.position=d),s&&(o.morphAttributes.normal=u),i&&(o.morphAttributes.color=f),o.morphTargetsRelative=!0,o})}function He(o,t){if(o.updateMorphTargets(),t.weights!==void 0)for(let e=0,n=t.weights.length;e<n;e++)o.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(o.morphTargetInfluences.length===e.length){o.morphTargetDictionary={};for(let n=0,s=e.length;n<s;n++)o.morphTargetDictionary[e[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Ge(o){let t;const e=o.extensions&&o.extensions[R.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+z(e.attributes):t=o.indices+":"+z(o.attributes)+":"+o.mode,o.targets!==void 0)for(let n=0,s=o.targets.length;n<s;n++)t+=":"+z(o.targets[n]);return t}function z(o){let t="";const e=Object.keys(o).sort();for(let n=0,s=e.length;n<s;n++)t+=e[n]+":"+o[e[n]]+";";return t}function $(o){switch(o){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 Ue(o){return o.search(/\.jpe?g($|\?)/i)>0||o.search(/^data\:image\/jpeg/)===0?"image/jpeg":o.search(/\.webp($|\?)/i)>0||o.search(/^data\:image\/webp/)===0?"image/webp":o.search(/\.ktx2($|\?)/i)>0||o.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const je=new h.Matrix4;class Ke{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new he,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 n=!1,s=-1,i=!1,r=-1;if(typeof navigator<"u"){const a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;const c=a.match(/Version\/(\d+)/);s=n&&c?parseInt(c[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&s<17||i&&r<98?this.textureLoader=new h.TextureLoader(this.options.manager):this.textureLoader=new h.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new h.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 n=this,s=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(r){const a={scene:r[0][s.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:s.asset,parser:n,userData:{}};return I(i,a,s),v(a,s),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(a)})).then(function(){for(const c of a.scenes)c.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let s=0,i=e.length;s<i;s++){const r=e[s].joints;for(let a=0,c=r.length;a<c;a++)t[r[a]].isBone=!0}for(let s=0,i=t.length;s<i;s++){const r=t[s];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.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,n){if(t.refs[e]<=1)return n;const s=n.clone(),i=(r,a)=>{const c=this.associations.get(r);c!=null&&this.associations.set(a,c);for(const[l,d]of r.children.entries())i(d,a.children[l])};return i(n,s),s.name+="_instance_"+t.uses[e]++,s}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const s=t(e[n]);if(s)return s}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let s=0;s<e.length;s++){const i=t(e[s]);i&&n.push(i)}return n}getDependency(t,e){const n=t+":"+e;let s=this.cache.get(n);if(!s){switch(t){case"scene":s=this.loadScene(e);break;case"node":s=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":s=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":s=this.loadAccessor(e);break;case"bufferView":s=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":s=this.loadBuffer(e);break;case"material":s=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":s=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":s=this.loadSkin(e);break;case"animation":s=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":s=this.loadCamera(e);break;default:if(s=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(t,e)}),!s)throw new Error("Unknown type: "+t);break}this.cache.add(n,s)}return s}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,s=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(s.map(function(i,r){return n.getDependency(t,r)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=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[R.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(i,r){n.load(h.LoaderUtils.resolveURL(e.uri,s.path),i,void 0,function(){r(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(n){const s=e.byteLength||0,i=e.byteOffset||0;return n.slice(i,i+s)})}loadAccessor(t){const e=this,n=this.json,s=this.json.accessors[t];if(s.bufferView===void 0&&s.sparse===void 0){const r=K[s.type],a=P[s.componentType],c=s.normalized===!0,l=new a(s.count*r);return Promise.resolve(new h.BufferAttribute(l,r,c))}const i=[];return s.bufferView!==void 0?i.push(this.getDependency("bufferView",s.bufferView)):i.push(null),s.sparse!==void 0&&(i.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],c=K[s.type],l=P[s.componentType],d=l.BYTES_PER_ELEMENT,u=d*c,f=s.byteOffset||0,p=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,g=s.normalized===!0;let _,A;if(p&&p!==u){const T=Math.floor(f/p),y="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+T+":"+s.count;let L=e.cache.get(y);L||(_=new l(a,T*p,s.count*p/d),L=new h.InterleavedBuffer(_,p/d),e.cache.add(y,L)),A=new h.InterleavedBufferAttribute(L,c,f%p/d,g)}else a===null?_=new l(s.count*c):_=new l(a,f,s.count*c),A=new h.BufferAttribute(_,c,g);if(s.sparse!==void 0){const T=K.SCALAR,y=P[s.sparse.indices.componentType],L=s.sparse.indices.byteOffset||0,w=s.sparse.values.byteOffset||0,b=new y(r[1],L,s.sparse.count*T),M=new l(r[2],w,s.sparse.count*c);a!==null&&(A=new h.BufferAttribute(A.array.slice(),A.itemSize,A.normalized)),A.normalized=!1;for(let x=0,D=b.length;x<D;x++){const C=b[x];if(A.setX(C,M[x*c]),c>=2&&A.setY(C,M[x*c+1]),c>=3&&A.setZ(C,M[x*c+2]),c>=4&&A.setW(C,M[x*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}A.normalized=g}return A})}loadTexture(t){const e=this.json,n=this.options,i=e.textures[t].source,r=e.images[i];let a=this.textureLoader;if(r.uri){const c=n.manager.getHandler(r.uri);c!==null&&(a=c)}return this.loadTextureImage(t,i,a)}loadTextureImage(t,e,n){const s=this,i=this.json,r=i.textures[t],a=i.images[e],c=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(e,n).then(function(d){d.flipY=!1,d.name=r.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const f=(i.samplers||{})[r.sampler]||{};return d.magFilter=Z[f.magFilter]||h.LinearFilter,d.minFilter=Z[f.minFilter]||h.LinearMipmapLinearFilter,d.wrapS=ee[f.wrapS]||h.RepeatWrapping,d.wrapT=ee[f.wrapT]||h.RepeatWrapping,d.generateMipmaps=!d.isCompressedTexture&&d.minFilter!==h.NearestFilter&&d.minFilter!==h.LinearFilter,s.associations.set(d,{textures:t}),d}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(t,e){const n=this,s=this.json,i=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(u=>u.clone());const r=s.images[t],a=self.URL||self.webkitURL;let c=r.uri||"",l=!1;if(r.bufferView!==void 0)c=n.getDependency("bufferView",r.bufferView).then(function(u){l=!0;const f=new Blob([u],{type:r.mimeType});return c=a.createObjectURL(f),c});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const d=Promise.resolve(c).then(function(u){return new Promise(function(f,p){let g=f;e.isImageBitmapLoader===!0&&(g=function(_){const A=new h.Texture(_);A.needsUpdate=!0,f(A)}),e.load(h.LoaderUtils.resolveURL(u,i.path),g,void 0,p)})}).then(function(u){return l===!0&&a.revokeObjectURL(c),v(u,r),u.userData.mimeType=r.mimeType||Ue(r.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[t]=d,d}assignTexture(t,e,n,s){const i=this;return this.getDependency("texture",n.index).then(function(r){if(!r)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(r=r.clone(),r.channel=n.texCoord),i.extensions[R.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[R.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const c=i.associations.get(r);r=i.extensions[R.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),i.associations.set(r,c)}}return s!==void 0&&(r.colorSpace=s),t[e]=r,r})}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const s=e.attributes.tangent===void 0,i=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new h.PointsMaterial,h.Material.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(a,c)),n=c}else if(t.isLine){const a="LineBasicMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new h.LineBasicMaterial,h.Material.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(a,c)),n=c}if(s||i||r){let a="ClonedMaterial:"+n.uuid+":";s&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let c=this.cache.get(a);c||(c=n.clone(),i&&(c.vertexColors=!0),r&&(c.flatShading=!0),s&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(a,c),this.associations.set(c,this.associations.get(n))),n=c}t.material=n}getMaterialType(){return h.MeshStandardMaterial}loadMaterial(t){const e=this,n=this.json,s=this.extensions,i=n.materials[t];let r;const a={},c=i.extensions||{},l=[];if(c[R.KHR_MATERIALS_UNLIT]){const u=s[R.KHR_MATERIALS_UNLIT];r=u.getMaterialType(),l.push(u.extendParams(a,i,e))}else{const u=i.pbrMetallicRoughness||{};if(a.color=new h.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],h.LinearSRGBColorSpace),a.opacity=f[3]}u.baseColorTexture!==void 0&&l.push(e.assignTexture(a,"map",u.baseColorTexture,h.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(e.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),l.push(e.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),r=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(t)}),l.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(t,a)})))}i.doubleSided===!0&&(a.side=h.DoubleSide);const d=i.alphaMode||V.OPAQUE;if(d===V.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===V.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==h.MeshBasicMaterial&&(l.push(e.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new h.Vector2(1,1),i.normalTexture.scale!==void 0)){const u=i.normalTexture.scale;a.normalScale.set(u,u)}if(i.occlusionTexture!==void 0&&r!==h.MeshBasicMaterial&&(l.push(e.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==h.MeshBasicMaterial){const u=i.emissiveFactor;a.emissive=new h.Color().setRGB(u[0],u[1],u[2],h.LinearSRGBColorSpace)}return i.emissiveTexture!==void 0&&r!==h.MeshBasicMaterial&&l.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,h.SRGBColorSpace)),Promise.all(l).then(function(){const u=new r(a);return i.name&&(u.name=i.name),v(u,i),e.associations.set(u,{materials:t}),i.extensions&&I(s,u,i),u})}createUniqueName(t){const e=h.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,s=this.primitiveCache;function i(a){return n[R.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(c){return te(c,a,e)})}const r=[];for(let a=0,c=t.length;a<c;a++){const l=t[a],d=Ge(l),u=s[d];if(u)r.push(u.promise);else{let f;l.extensions&&l.extensions[R.KHR_DRACO_MESH_COMPRESSION]?f=i(l):f=te(new h.BufferGeometry,l,e),s[d]={primitive:l,promise:f},r.push(f)}}return Promise.all(r)}loadMesh(t){const e=this,n=this.json,s=this.extensions,i=n.meshes[t],r=i.primitives,a=[];for(let c=0,l=r.length;c<l;c++){const d=r[c].material===void 0?Fe(this.cache):this.getDependency("material",r[c].material);a.push(d)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(c){const l=c.slice(0,c.length-1),d=c[c.length-1],u=[];for(let p=0,g=d.length;p<g;p++){const _=d[p],A=r[p];let T;const y=l[p];if(A.mode===S.TRIANGLES||A.mode===S.TRIANGLE_STRIP||A.mode===S.TRIANGLE_FAN||A.mode===void 0)T=i.isSkinnedMesh===!0?new h.SkinnedMesh(_,y):new h.Mesh(_,y),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),A.mode===S.TRIANGLE_STRIP?T.geometry=Q(T.geometry,h.TriangleStripDrawMode):A.mode===S.TRIANGLE_FAN&&(T.geometry=Q(T.geometry,h.TriangleFanDrawMode));else if(A.mode===S.LINES)T=new h.LineSegments(_,y);else if(A.mode===S.LINE_STRIP)T=new h.Line(_,y);else if(A.mode===S.LINE_LOOP)T=new h.LineLoop(_,y);else if(A.mode===S.POINTS)T=new h.Points(_,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);Object.keys(T.geometry.morphAttributes).length>0&&He(T,i),T.name=e.createUniqueName(i.name||"mesh_"+t),v(T,i),A.extensions&&I(s,T,A),e.assignFinalMaterial(T),u.push(T)}for(let p=0,g=u.length;p<g;p++)e.associations.set(u[p],{meshes:t,primitives:p});if(u.length===1)return i.extensions&&I(s,u[0],i),u[0];const f=new h.Group;i.extensions&&I(s,f,i),e.associations.set(f,{meshes:t});for(let p=0,g=u.length;p<g;p++)f.add(u[p]);return f})}loadCamera(t){let e;const n=this.json.cameras[t],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?e=new h.PerspectiveCamera(h.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(e=new h.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),v(e,n),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],n=[];for(let s=0,i=e.joints.length;s<i;s++)n.push(this._loadNodeShallow(e.joints[s]));return e.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){const i=s.pop(),r=s,a=[],c=[];for(let l=0,d=r.length;l<d;l++){const u=r[l];if(u){a.push(u);const f=new h.Matrix4;i!==null&&f.fromArray(i.array,l*16),c.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[l])}return new h.Skeleton(a,c)})}loadAnimation(t){const e=this.json,n=this,s=e.animations[t],i=s.name?s.name:"animation_"+t,r=[],a=[],c=[],l=[],d=[];for(let u=0,f=s.channels.length;u<f;u++){const p=s.channels[u],g=s.samplers[p.sampler],_=p.target,A=_.node,T=s.parameters!==void 0?s.parameters[g.input]:g.input,y=s.parameters!==void 0?s.parameters[g.output]:g.output;_.node!==void 0&&(r.push(this.getDependency("node",A)),a.push(this.getDependency("accessor",T)),c.push(this.getDependency("accessor",y)),l.push(g),d.push(_))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(c),Promise.all(l),Promise.all(d)]).then(function(u){const f=u[0],p=u[1],g=u[2],_=u[3],A=u[4],T=[];for(let y=0,L=f.length;y<L;y++){const w=f[y],b=p[y],M=g[y],x=_[y],D=A[y];if(w===void 0)continue;w.updateMatrix&&w.updateMatrix();const C=n._createAnimationTracks(w,b,M,x,D);if(C)for(let U=0;U<C.length;U++)T.push(C[U])}return new h.AnimationClip(i,void 0,T)})}createNodeMesh(t){const e=this.json,n=this,s=e.nodes[t];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(i){const r=n._getNodeRef(n.meshCache,s.mesh,i);return s.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let c=0,l=s.weights.length;c<l;c++)a.morphTargetInfluences[c]=s.weights[c]}),r})}loadNode(t){const e=this.json,n=this,s=e.nodes[t],i=n._loadNodeShallow(t),r=[],a=s.children||[];for(let l=0,d=a.length;l<d;l++)r.push(n.getDependency("node",a[l]));const c=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([i,Promise.all(r),c]).then(function(l){const d=l[0],u=l[1],f=l[2];f!==null&&d.traverse(function(p){p.isSkinnedMesh&&p.bind(f,je)});for(let p=0,g=u.length;p<g;p++)d.add(u[p]);return d})}_loadNodeShallow(t){const e=this.json,n=this.extensions,s=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const i=e.nodes[t],r=i.name?s.createUniqueName(i.name):"",a=[],c=s._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(t)});return c&&a.push(c),i.camera!==void 0&&a.push(s.getDependency("camera",i.camera).then(function(l){return s._getNodeRef(s.cameraCache,i.camera,l)})),s._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(t)}).forEach(function(l){a.push(l)}),this.nodeCache[t]=Promise.all(a).then(function(l){let d;if(i.isBone===!0?d=new h.Bone:l.length>1?d=new h.Group:l.length===1?d=l[0]:d=new h.Object3D,d!==l[0])for(let u=0,f=l.length;u<f;u++)d.add(l[u]);if(i.name&&(d.userData.name=i.name,d.name=r),v(d,i),i.extensions&&I(n,d,i),i.matrix!==void 0){const u=new h.Matrix4;u.fromArray(i.matrix),d.applyMatrix4(u)}else i.translation!==void 0&&d.position.fromArray(i.translation),i.rotation!==void 0&&d.quaternion.fromArray(i.rotation),i.scale!==void 0&&d.scale.fromArray(i.scale);return s.associations.has(d)||s.associations.set(d,{}),s.associations.get(d).nodes=t,d}),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],s=this,i=new h.Group;n.name&&(i.name=s.createUniqueName(n.name)),v(i,n),n.extensions&&I(e,i,n);const r=n.nodes||[],a=[];for(let c=0,l=r.length;c<l;c++)a.push(s.getDependency("node",r[c]));return Promise.all(a).then(function(c){for(let d=0,u=c.length;d<u;d++)i.add(c[d]);const l=d=>{const u=new Map;for(const[f,p]of s.associations)(f instanceof h.Material||f instanceof h.Texture)&&u.set(f,p);return d.traverse(f=>{const p=s.associations.get(f);p!=null&&u.set(f,p)}),u};return s.associations=l(i),i})}_createAnimationTracks(t,e,n,s,i){const r=[],a=t.name?t.name:t.uuid,c=[];O[i.path]===O.weights?t.traverse(function(f){f.morphTargetInfluences&&c.push(f.name?f.name:f.uuid)}):c.push(a);let l;switch(O[i.path]){case O.weights:l=h.NumberKeyframeTrack;break;case O.rotation:l=h.QuaternionKeyframeTrack;break;case O.position:case O.scale:l=h.VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:l=h.NumberKeyframeTrack;break;case 2:case 3:default:l=h.VectorKeyframeTrack;break}break}const d=s.interpolation!==void 0?ke[s.interpolation]:h.InterpolateLinear,u=this._getArrayFromAccessor(n);for(let f=0,p=c.length;f<p;f++){const g=new l(c[f]+"."+O[i.path],e.array,u,d);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),r.push(g)}return r}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const n=$(e.constructor),s=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)s[i]=e[i]*n;e=s}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(n){const s=this instanceof h.QuaternionKeyframeTrack?De:ne;return new s(this.times,this.values,this.getValueSize()/3,n)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ve(o,t,e){const n=t.attributes,s=new h.Box3;if(n.POSITION!==void 0){const a=e.json.accessors[n.POSITION],c=a.min,l=a.max;if(c!==void 0&&l!==void 0){if(s.set(new h.Vector3(c[0],c[1],c[2]),new h.Vector3(l[0],l[1],l[2])),a.normalized){const d=$(P[a.componentType]);s.min.multiplyScalar(d),s.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=t.targets;if(i!==void 0){const a=new h.Vector3,c=new h.Vector3;for(let l=0,d=i.length;l<d;l++){const u=i[l];if(u.POSITION!==void 0){const f=e.json.accessors[u.POSITION],p=f.min,g=f.max;if(p!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(p[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(g[2]))),f.normalized){const _=$(P[f.componentType]);c.multiplyScalar(_)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(a)}o.boundingBox=s;const r=new h.Sphere;s.getCenter(r.center),r.radius=s.min.distanceTo(s.max)/2,o.boundingSphere=r}function te(o,t,e){const n=t.attributes,s=[];function i(r,a){return e.getDependency("accessor",r).then(function(c){o.setAttribute(a,c)})}for(const r in n){const a=W[r]||r.toLowerCase();a in o.attributes||s.push(i(n[r],a))}if(t.indices!==void 0&&!o.index){const r=e.getDependency("accessor",t.indices).then(function(a){o.setIndex(a)});s.push(r)}return h.ColorManagement.workingColorSpace!==h.LinearSRGBColorSpace&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${h.ColorManagement.workingColorSpace}" not supported.`),v(o,t),Ve(o,t,e),Promise.all(s).then(function(){return t.targets!==void 0?Be(o,t.targets,e):o})}var ze=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,We=(o,t,e,n)=>{for(var s=n>1?void 0:n?Xe(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&ze(t,e,s),s};let F=class{constructor(){E(this,"workerPool",m.C(void 0,!0));E(this,"canvas");E(this,"offscreenCanvas");E(this,"worker");E(this,"thread")}init(o){this.worker=o.worker,this.thread=o.thread}preventDefaultHandler(o){return o.preventDefault(),{type:o.type}}getScreenSizes(){var o,t;return{width:(o=this.canvas)==null?void 0:o.width,height:(t=this.canvas)==null?void 0:t.height,windowWidth:(window==null?void 0:window.innerWidth)??0,windowHeight:(window==null?void 0:window.innerHeight)??0}}uiEventHandler(o){var e;const t=(e=this.canvas)==null?void 0:e.getBoundingClientRect();return{...this.getScreenSizes(),type:o.type,top:t==null?void 0:t.top,left:t==null?void 0:t.left}}mouseEventHandler(o){return{...this.getScreenSizes(),...m.J(o,["ctrlKey","metaKey","shiftKey","button","pointerType","clientX","clientY","pageX","pageY"])}}touchEventHandler(o){const t=[],e={type:o.type,touches:t};for(let n=0;n<o.touches.length;++n){const s=o.touches[n];t.push({pageX:(s==null?void 0:s.pageX)??0,pageY:(s==null?void 0:s.pageY)??0})}return{...this.getScreenSizes(),...e}}wheelEventHandler(o){return o.preventDefault(),{...this.getScreenSizes(),...m.J(o,["deltaX","deltaY"])}}keyEventHandler(o){if(m.KEYBOARD_EVENT_CODES.includes(o.code))return o.preventDefault(),{...this.getScreenSizes(),...m.J(o,["ctrlKey","metaKey","shiftKey","keyCode"])}}};F=We([m.scoped(m.Lifecycle.ContainerScoped)],F);var $e=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Ye=(o,t,e,n)=>{for(var s=n>1?void 0:n?qe(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&$e(t,e,s),s},Qe=(o,t)=>(e,n)=>t(e,n,o);let q=class extends m.ProxyEventHandlersBlueprint{constructor(o){super(),this._service=o}init(){for(const o of m.PROXY_EVENT_LISTENERS){const t=o.startsWith("mouse")||o.startsWith("pointer")||o.startsWith("touch")?this._service.mouseEventHandler.bind(this._service):o.startsWith("key")?this._service.keyEventHandler.bind(this._service):o==="resize"?this._service.uiEventHandler.bind(this._service):o==="wheel"?this._service.wheelEventHandler.bind(this._service):this._service.preventDefaultHandler.bind(this._service);this[`${o}$`]=m.fromEvent(o==="resize"?window:this._service.canvas,o).pipe(m.map(t.bind(this)),m.filter(e=>!(o==="keydown"&&!e))),this[`${o}$`].subscribe(e=>{var n,s;(s=(n=this._service.thread)==null?void 0:n[o])==null||s.call(n,e)})}}};q=Ye([oe(),Qe(0,m.inject(F))],q);var Je=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,et=(o,t,e,n)=>{for(var s=n>1?void 0:n?Ze(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&Je(t,e,s),s};let B=class{constructor(){E(this,"loadingManager",new h.LoadingManager);E(this,"loaders",{});E(this,"sources",[]);E(this,"loadedResources",{});E(this,"toLoadCount",0);E(this,"loadedCount",0)}get videoLoader(){return{load:(o,t)=>{const e=document.createElement("video");e.muted=!0,e.loop=!0,e.crossOrigin="anonymous",e.controls=!1,e.playsInline=!0,e.src=o,e.autoplay=!0;const n=async()=>{t(e),e.removeEventListener("canplaythrough",n)};e.addEventListener("canplaythrough",n)}}}_initLoaders(){this.loaders.dracoLoader=new ce(this.loadingManager),this.loaders.audioLoader=new h.AudioLoader(this.loadingManager),this.loaders.fontLoader=new m.FontLoader(this.loadingManager),this.loaders.gltfLoader=new ue(this.loadingManager),this.loaders.imageLoader=new h.ImageBitmapLoader(this.loadingManager),this.loaders.videoLoader=this.videoLoader}_initSources(o){this.sources=o,this.toLoadCount=this.sources.length,this.loadedCount=0}init(o=[]){this._initLoaders(),this._initSources(o)}setDracoDecoder(o){var t;this.loaders.dracoLoader&&(this.loaders.dracoLoader.setDecoderPath(o??"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),(t=this.loaders.gltfLoader)==null||t.setDRACOLoader(this.loaders.dracoLoader))}handleLoad({source:o,resource:t,toLoadCount:e,loadedCount:n}){t&&(this.loadedResources[o.name]=t,this.loadedCount=n,this.toLoadCount=e)}launchLoad(o){var e,n,s,i,r;const t=this.sources[0];if(t){o==null||o(t);for(const a of this.sources){if(this.loadedResources[a.name]||typeof a.path!="string")return;a.type==="gltf"&&((e=this.loaders.gltfLoader)==null||e.load(a.path,c=>o==null?void 0:o(a,c))),a.type==="audio"&&((n=this.loaders.audioLoader)==null||n.load(a.path,c=>o==null?void 0:o(a,c))),a.type==="image"&&((s=this.loaders.imageLoader)==null||s.load(a.path,c=>o==null?void 0:o(a,c))),a.type==="video"&&((i=this.loaders.videoLoader)==null||i.load(a.path,c=>o==null?void 0:o(a,c))),a.type==="font"&&((r=this.loaders.fontLoader)==null||r.load(a.path,c=>o==null?void 0:o(a,c)))}}}};B=et([m.scoped(m.Lifecycle.ContainerScoped)],B);var tt=Object.defineProperty,st=Object.getOwnPropertyDescriptor,nt=(o,t,e,n)=>{for(var s=n>1?void 0:n?st(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&tt(t,e,s),s},rt=(o,t)=>(e,n)=>t(e,n,o);let H=class{constructor(o){E(this,"load$$",new m.Subject);E(this,"load$",this.load$$.pipe(m.map(o=>({...o,loadedCount:o.resource?this._service.loadedCount+1:this._service.loadedCount,toLoadCount:this._service.toLoadCount})),m.share()));E(this,"serializedLoad$",this.load$.pipe(m.map(o=>{var e,n,s;let t=o.resource;if((e=o==null?void 0:o.resource)!=null&&e.parser){const i=o.resource,r=i.scenes.map(a=>m.W(a));t={animations:(o==null?void 0:o.resource).animations.map(a=>a.toJSON()),cameras:i.cameras.map(a=>m.W(a)),parser:{json:i.parser.json},scene:r==null?void 0:r[0],scenes:r,userData:i.userData}}return((n=o==null?void 0:o.source)==null?void 0:n.type)==="audio"&&o.resource instanceof AudioBuffer&&(t={arrayBuffer:o.resource.getChannelData(0),length:o.resource.length,sampleRate:o.resource.sampleRate,duration:o.resource.duration}),((s=o==null?void 0:o.source)==null?void 0:s.type)==="video"&&o.resource instanceof HTMLVideoElement&&(t={...m.J(o.resource,["autoplay","baseURI","controls","crossOrigin","currentTime","defaultMuted","disablePictureInPicture","draggable","duration","ended","height","hidden","loop","muted","nodeName","nodeType","paused","playbackRate","playsInline","poster","preload","readyState","seeking","spellcheck","src","tabIndex","translate","videoHeight","videoWidth","volume","width"]),buffered:o.resource.buffered.length,error:o.resource.error?m.U(o.resource.error,[]):{},played:o.resource.played.length,seekable:o.resource.seekable.length,textTracks:o.resource.textTracks.length}),{...o,resource:t}}),m.share()));E(this,"loadCompleted$",this.load$.pipe(m.filter(o=>o.toLoadCount===o.loadedCount),m.map(()=>m.J(this._service,["loadedCount","loadedResources","toLoadCount"])),m.share()));this._service=o}};H=nt([m.scoped(m.Lifecycle.ContainerScoped),rt(0,m.inject(B))],H);var it=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,at=(o,t,e,n)=>{for(var s=n>1?void 0:n?ot(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&it(t,e,s),s},X=(o,t)=>(e,n)=>t(e,n,o);let Y=class{constructor(o,t,e){E(this,"_subscriptions",[]);this._controller=o,this._service=t,this._props=e,this._subscriptions.push(this._controller.load$.subscribe(this._service.handleLoad.bind(this._service)))}init(o=[]){this._service.init(o),this._service.setDracoDecoder(),[void 0,!0].includes(this._props.loadResourcesOnInit)&&this.load()}load(){this._service.launchLoad((o,t)=>this._controller.load$$.next({source:o,resource:t}))}getLoadedResources(){return this._service.loadedResources}getLoaders(){return this._service.loaders}getSources(){return this._service.sources}getLoadedCount(){return this._service.loadedCount}getToLoadCount(){return this._service.toLoadCount}getLoad$(){return this._controller.load$}getLoadCompleted$(){return this._controller.loadCompleted$}setDracoDecoder(o){this._service.setDracoDecoder(o)}dispose(){this._subscriptions.forEach(o=>o.unsubscribe()),this._controller.load$$.complete()}};Y=at([m.scoped(m.Lifecycle.ContainerScoped),X(0,m.inject(H)),X(1,m.inject(B)),X(2,m.inject(G))],Y);var ct=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,ut=(o,t,e,n)=>{for(var s=n>1?void 0:n?lt(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&ct(t,e,s),s},N=(o,t)=>(e,n)=>t(e,n,o);exports.RegisterModule=class extends m.RegisterProxyEventHandlersBlueprint{constructor(e,n,s,i,r,a){super();E(this,"_subscriptions",[]);E(this,"_initialized",!1);this._service=e,this._controller=n,this._loaderController=s,this.container=i,this.props=r,this.loader=a,this.props.initOnConstruct&&this.init()}async _initCanvas(){try{if(this.props.canvas instanceof HTMLCanvasElement&&(this._service.canvas=this.props.canvas),typeof this.props.canvas=="string"){const e=document.querySelector(this.props.canvas);e instanceof HTMLCanvasElement&&(this._service.canvas=e)}this._service.canvas||(this._service.canvas=document.createElement("canvas"),this._service.canvas.dataset.reactive="true",document.body.appendChild(this._service.canvas))}catch(e){console.error(`🛑 Unable to initialize the canvas:
3
+ ${e instanceof Error?e.message:"Something went wrong"}`)}}async _initService(){this._service.init({worker:this._service.worker,thread:this._service.thread})}async _initEvents(){var e,n;if(!this._service.canvas)throw new Error("Canvas element is not initialized.");if(!this._service.thread||!this._service.worker)throw new Error("Worker-thread is not initialized.");this._controller.init(),this.props.fullScreen&&((n=(e=this._service.thread)==null?void 0:e.resize)==null||n.call(e,{...this._service.uiEventHandler({type:"resize"})}))}async _initWorkerThread(){if(!this._service.canvas)throw new Error("Canvas element is not initialized.");this._service.offscreenCanvas=this._service.canvas.transferControlToOffscreen(),this._service.offscreenCanvas.width=this._service.canvas.clientWidth,this._service.offscreenCanvas.height=this._service.canvas.clientHeight;const[e,n]=await this._service.workerPool.run({payload:{path:this.props.location,subject:{...m.U(this.props,["canvas","location","onReady","loaderDataSources"]),canvas:this._service.offscreenCanvas},transferSubject:[this._service.offscreenCanvas]}});if(!e||n)throw new Error("Unable to retrieve the worker-thread info.");this._service.worker=e.worker,this._service.thread=e.thread}async _initObservableProxyEvents(){m.PROXY_EVENT_LISTENERS.forEach(e=>this[`${e}$`]=()=>{var n;return(n=this._controller)==null?void 0:n[`${e}$`]})}async _initLoader(){this.loader.init(this.props.loaderDataSources),this._subscriptions.push(this._loaderController.serializedLoad$.subscribe(e=>{var n,s;if(e.resource instanceof ArrayBuffer)return(n=this._service.worker)==null?void 0:n.postMessage(e.resource,[e.resource]);(s=this._service.worker)==null||s.postMessage({token:m.LOADER_SERIALIZED_LOAD_TOKEN,payload:e})}))}async init(){var e,n;this._initialized||(this._initialized=!0,await this._initCanvas(),await this._initWorkerThread(),await this._initService(),await this._initObservableProxyEvents(),await this._initLoader(),await this._initEvents(),(n=(e=this.props).onReady)==null||n.call(e,{module:this,container:this.container}))}getCanvas(){return this._service.canvas}getOffscreenCanvas(){return this._service.offscreenCanvas}getThread(){return this._service.thread}getWorker(){return this._service.worker}getWorkerPool(){return this._service.workerPool}isInitialized(){return this._initialized}async dispose(){var e;this._subscriptions.map(n=>n.unsubscribe()),await this._service.workerPool.terminateAll(),((e=this._service.canvas)==null?void 0:e.dataset.reactive)==="true"&&(document.body.removeChild(this._service.canvas),this._service.canvas.remove(),this._service.canvas=void 0),this._initialized=!1}};exports.RegisterModule=ut([m.scoped(m.Lifecycle.ResolutionScoped),N(0,m.inject(F)),N(1,m.inject(q)),N(2,m.inject(H)),N(3,m.inject(m.CONTAINER_TOKEN)),N(4,m.inject(G)),N(5,m.inject(Y))],exports.RegisterModule);const ht=o=>{if(typeof(o==null?void 0:o.location)!="string"&&!((o==null?void 0:o.location)instanceof URL))throw new Error("Invalid register props detected. location path is required");const t=m.instance.createChildContainer();o.initOnConstruct=m.A(o.initOnConstruct)||!m.D(o.initOnConstruct)?!0:o.initOnConstruct,o.defaultCamera=o!=null&&o.defaultCamera&&o.defaultCamera in m.DefaultCameraType?o.defaultCamera:m.DefaultCameraType.PERSPECTIVE,o.withMiniCamera=m.A(o.withMiniCamera)||!m.D(o.withMiniCamera)?!1:o.withMiniCamera,o.startTimer=m.A(o.startTimer)||!m.D(o.startTimer)?!0:o.startTimer,o.fullScreen=m.A(o.fullScreen)||!m.D(o.fullScreen)?!0:o.fullScreen,o.onReady=m.Q(o.onReady)?o.onReady:void 0,t.register(m.CONTAINER_TOKEN,{useValue:t}),t.register(G,{useValue:o});const e=t.resolve(exports.RegisterModule);return{container:t,module:e}};Object.defineProperty(exports,"AppModule",{enumerable:!0,get:()=>m.AppModule});exports.AppProxyEventHandlersBlueprint=m.AppProxyEventHandlersBlueprint;exports.CONTAINER_TOKEN=m.CONTAINER_TOKEN;exports.DefaultCameraType=m.DefaultCameraType;exports.KEYBOARD_EVENT_CODES=m.KEYBOARD_EVENT_CODES;exports.LOADER_SERIALIZED_LOAD_TOKEN=m.LOADER_SERIALIZED_LOAD_TOKEN;exports.PROXY_EVENT_LISTENERS=m.PROXY_EVENT_LISTENERS;exports.ProxyEventHandlersBlueprint=m.ProxyEventHandlersBlueprint;exports.ProxyEventObservablesBlueprint=m.ProxyEventObservablesBlueprint;exports.ProxyEventSubjectsBlueprint=m.ProxyEventSubjectsBlueprint;exports.RegisterProxyEventHandlersBlueprint=m.RegisterProxyEventHandlersBlueprint;exports.LaunchAppProps=ae;exports.RegisterPropsBlueprint=G;exports.register=ht;
package/dist/main.mjs CHANGED
@@ -2029,13 +2029,7 @@ let J = class {
2029
2029
  uiEventHandler(o) {
2030
2030
  var t;
2031
2031
  const e = (t = this.canvas) == null ? void 0 : t.getBoundingClientRect();
2032
- return console.log(
2033
- "uiEventHandler",
2034
- this.getScreenSizes(),
2035
- o.type,
2036
- e == null ? void 0 : e.top,
2037
- e == null ? void 0 : e.left
2038
- ), {
2032
+ return {
2039
2033
  ...this.getScreenSizes(),
2040
2034
  type: o.type,
2041
2035
  top: e == null ? void 0 : e.top,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quick-threejs/reactive",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Reactively quick start a three.js app ⚡️",
5
5
  "repository": {
6
6
  "type": "git",