@quick-threejs/reactive 0.1.38 → 0.1.40

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,4 @@
1
- "use strict";var ie=Object.defineProperty;var oe=(o,t,e)=>t in o?ie(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var R=(o,t,e)=>oe(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./app.module-BHIYNoTs.js"),d=require("three");class F{constructor(){R(this,"location");R(this,"initOnConstruct");R(this,"canvas");R(this,"fullScreen");R(this,"defaultCamera");R(this,"startTimer");R(this,"loaderDataSources",[]);R(this,"loadResourcesOnInit");R(this,"enableDebug");R(this,"enableControls");R(this,"axesSizes");R(this,"gridSizes");R(this,"withMiniCamera");R(this,"onReady")}}class ae{constructor(){R(this,"onReady")}}function Q(o,t){if(t===d.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(t===d.TriangleFanDrawMode||t===d.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===d.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 se extends d.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 d.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,d.SRGBColorSpace,n).catch(n)}decodeDracoFile(t,e,n,s,i=d.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,h)=>{s._callbacks[i]={resolve:l,reject:h},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 d.BufferGeometry;t.index&&e.setIndex(new d.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 d.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!==d.SRGBColorSpace)return;const n=new d.Color;for(let s=0,i=t.count;s<i;s++)n.fromBufferAttribute(t,s),d.ColorManagement.toWorkingColorSpace(n,d.SRGBColorSpace),t.setXYZ(s,n.r,n.g,n.b)}_loadLibrary(t,e){const n=new d.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=ce.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 ce(){let o,t;onmessage=function(r){const a=r.data;switch(a.type){case"init":o=a.decoderConfig,t=new Promise(function(h){o.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(o)});break;case"decode":const c=a.buffer,l=a.taskConfig;t.then(h=>{const u=h.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 h=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 h){const T=self[u[A]];let y,L;if(l.useUniqueIDs)L=h[A],y=a.GetAttributeByUniqueId(f,L);else{if(L=a.GetAttributeId(f,r[h[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 h=c.num_faces()*3,u=h*4,f=r._malloc(u);a.GetTrianglesUInt32Array(c,u,f);const p=new Uint32Array(r.HEAPF32.buffer,f,h).slice();return r._free(f),{array:p,itemSize:1}}function s(r,a,c,l,h,u){const f=u.num_components(),g=c.num_points()*f,_=g*h.BYTES_PER_ELEMENT,A=i(r,h),T=r._malloc(_);a.GetAttributeDataArrayForAllPoints(c,u,A,_,T);const y=new h(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 le extends d.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new pe(e)}),this.register(function(e){return new me(e)}),this.register(function(e){return new Le(e)}),this.register(function(e){return new Se(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new Ae(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new _e(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new we(e)}),this.register(function(e){return new ye(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new be(e)}),this.register(function(e){return new ve(e)})}load(t,e,n,s){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const l=d.LoaderUtils.extractUrlBase(t);r=d.LoaderUtils.resolveURL(l,this.path)}else r=d.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 d.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(h){e(h),i.manager.itemEnd(t)},a)}catch(h){a(h)}},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))===ne){try{r[E.KHR_BINARY_GLTF]=new Ce(t)}catch(u){s&&s(u);return}i=JSON.parse(r[E.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 je(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 h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](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 h=0;h<i.extensionsUsed.length;++h){const u=i.extensionsUsed[h],f=i.extensionsRequired||[];switch(u){case E.KHR_MATERIALS_UNLIT:r[u]=new he;break;case E.KHR_DRACO_MESH_COMPRESSION:r[u]=new Me(i,this.dracoLoader);break;case E.KHR_TEXTURE_TRANSFORM:r[u]=new Oe;break;case E.KHR_MESH_QUANTIZATION:r[u]=new Ie;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 ue(){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 E={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=E.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 h=new d.Color(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],d.LinearSRGBColorSpace);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new d.DirectionalLight(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new d.PointLight(h),l.distance=u;break;case"spot":l=new d.SpotLight(h),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 he{constructor(){this.name=E.KHR_MATERIALS_UNLIT}getMaterialType(){return d.MeshBasicMaterial}extendParams(t,e,n){const s=[];t.color=new d.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],d.LinearSRGBColorSpace),t.opacity=r[3]}i.baseColorTexture!==void 0&&s.push(n.assignTexture(t,"map",i.baseColorTexture,d.SRGBColorSpace))}return Promise.all(s)}}class fe{constructor(t){this.parser=t,this.name=E.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 pe{constructor(t){this.parser=t,this.name=E.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.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 d.Vector2(a,a)}return Promise.all(i)}}class me{constructor(t){this.parser=t,this.name=E.KHR_MATERIALS_DISPERSION}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.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 ge{constructor(t){this.parser=t,this.name=E.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.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 Ae{constructor(t){this.parser=t,this.name=E.KHR_MATERIALS_SHEEN}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.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 d.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],d.LinearSRGBColorSpace)}return r.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=r.sheenRoughnessFactor),r.sheenColorTexture!==void 0&&i.push(n.assignTexture(e,"sheenColorMap",r.sheenColorTexture,d.SRGBColorSpace)),r.sheenRoughnessTexture!==void 0&&i.push(n.assignTexture(e,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(i)}}class Te{constructor(t){this.parser=t,this.name=E.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.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 _e{constructor(t){this.parser=t,this.name=E.KHR_MATERIALS_VOLUME}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.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 d.Color().setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace),Promise.all(i)}}class Ee{constructor(t){this.parser=t,this.name=E.KHR_MATERIALS_IOR}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.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 Re{constructor(t){this.parser=t,this.name=E.KHR_MATERIALS_SPECULAR}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.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 d.Color().setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace),r.specularColorTexture!==void 0&&i.push(n.assignTexture(e,"specularColorMap",r.specularColorTexture,d.SRGBColorSpace)),Promise.all(i)}}class ye{constructor(t){this.parser=t,this.name=E.EXT_MATERIALS_BUMP}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.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 we{constructor(t){this.parser=t,this.name=E.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.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 Le{constructor(t){this.parser=t,this.name=E.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 Se{constructor(t){this.parser=t,this.name=E.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 xe{constructor(t){this.parser=t,this.name=E.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 be{constructor(t){this.name=E.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,h=s.count,u=s.byteStride,f=new Uint8Array(a,c,l);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(h,u,f,s.mode,s.filter).then(function(p){return p.buffer}):r.ready.then(function(){const p=new ArrayBuffer(h*u);return r.decodeGltfBuffer(new Uint8Array(p),h,u,f,s.mode,s.filter),p})})}else return null}}class ve{constructor(t){this.name=E.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(h=>(c[l]=h,c[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(l=>{const h=l.pop(),u=h.isGroup?h.children:[h],f=l[0].count,p=[];for(const g of u){const _=new d.Matrix4,A=new d.Vector3,T=new d.Quaternion,y=new d.Vector3(1,1,1),L=new d.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 d.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else w!=="TRANSLATION"&&w!=="ROTATION"&&w!=="SCALE"&&g.geometry.setAttribute(w,c[w]);d.Object3D.prototype.copy.call(L,g),this.parser.assignFinalMaterial(L),p.push(L)}return h.isGroup?(h.clear(),h.add(...p),h):p[0]}))}}const ne="glTF",k=12,J={JSON:1313821514,BIN:5130562};class Ce{constructor(t){this.name=E.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!==ne)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const 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 Me{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=E.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 h in r){const u=W[h]||h.toLowerCase();a[u]=r[h]}for(const h in t.attributes){const u=W[h]||h.toLowerCase();if(r[h]!==void 0){const f=n.accessors[t.attributes[h]],p=P[f.componentType];l[u]=p.name,c[u]=f.normalized===!0}}return e.getDependency("bufferView",i).then(function(h){return new Promise(function(u,f){s.decodeDracoFile(h,function(p){for(const g in p.attributes){const _=p.attributes[g],A=c[g];A!==void 0&&(_.normalized=A)}u(p)},a,l,d.LinearSRGBColorSpace,f)})})}}class Oe{constructor(){this.name=E.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 Ie{constructor(){this.name=E.KHR_MESH_QUANTIZATION}}class re extends d.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,h=s-e,u=(n-e)/h,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],C=r[_+w+c]*h,x=r[g+w+a],D=r[g+w]*h;i[w]=y*b+L*C+A*x+T*D}return i}}const Ne=new d.Quaternion;class Pe extends re{interpolate_(t,e,n,s){const i=super.interpolate_(t,e,n,s);return Ne.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:d.NearestFilter,9729:d.LinearFilter,9984:d.NearestMipmapNearestFilter,9985:d.LinearMipmapNearestFilter,9986:d.NearestMipmapLinearFilter,9987:d.LinearMipmapLinearFilter},ee={33071:d.ClampToEdgeWrapping,33648:d.MirroredRepeatWrapping,10497:d.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"},De={CUBICSPLINE:void 0,LINEAR:d.InterpolateLinear,STEP:d.InterpolateDiscrete},V={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function ke(o){return o.DefaultMaterial===void 0&&(o.DefaultMaterial=new d.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:d.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 Fe(o,t,e){let n=!1,s=!1,i=!1;for(let l=0,h=t.length;l<h;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,h=t.length;l<h;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 h=l[0],u=l[1],f=l[2];return n&&(o.morphAttributes.position=h),s&&(o.morphAttributes.normal=u),i&&(o.morphAttributes.color=f),o.morphTargetsRelative=!0,o})}function Be(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 He(o){let t;const e=o.extensions&&o.extensions[E.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 Ge(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 Ue=new d.Matrix4;class je{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new ue,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 d.TextureLoader(this.options.manager):this.textureLoader=new d.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new d.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,h]of r.children.entries())i(h,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[E.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(i,r){n.load(d.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 d.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],h=l.BYTES_PER_ELEMENT,u=h*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/h),L=new d.InterleavedBuffer(_,p/h),e.cache.add(y,L)),A=new d.InterleavedBufferAttribute(L,c,f%p/h,g)}else a===null?_=new l(s.count*c):_=new l(a,f,s.count*c),A=new d.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),C=new l(r[2],w,s.sparse.count*c);a!==null&&(A=new d.BufferAttribute(A.array.slice(),A.itemSize,A.normalized)),A.normalized=!1;for(let x=0,D=b.length;x<D;x++){const M=b[x];if(A.setX(M,C[x*c]),c>=2&&A.setY(M,C[x*c+1]),c>=3&&A.setZ(M,C[x*c+2]),c>=4&&A.setW(M,C[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(h){h.flipY=!1,h.name=r.name||a.name||"",h.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(h.name=a.uri);const f=(i.samplers||{})[r.sampler]||{};return h.magFilter=Z[f.magFilter]||d.LinearFilter,h.minFilter=Z[f.minFilter]||d.LinearMipmapLinearFilter,h.wrapS=ee[f.wrapS]||d.RepeatWrapping,h.wrapT=ee[f.wrapT]||d.RepeatWrapping,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==d.NearestFilter&&h.minFilter!==d.LinearFilter,s.associations.set(h,{textures:t}),h}).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 h=Promise.resolve(c).then(function(u){return new Promise(function(f,p){let g=f;e.isImageBitmapLoader===!0&&(g=function(_){const A=new d.Texture(_);A.needsUpdate=!0,f(A)}),e.load(d.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||Ge(r.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[t]=h,h}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[E.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[E.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const c=i.associations.get(r);r=i.extensions[E.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 d.PointsMaterial,d.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 d.LineBasicMaterial,d.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 d.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[E.KHR_MATERIALS_UNLIT]){const u=s[E.KHR_MATERIALS_UNLIT];r=u.getMaterialType(),l.push(u.extendParams(a,i,e))}else{const u=i.pbrMetallicRoughness||{};if(a.color=new d.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],d.LinearSRGBColorSpace),a.opacity=f[3]}u.baseColorTexture!==void 0&&l.push(e.assignTexture(a,"map",u.baseColorTexture,d.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=d.DoubleSide);const h=i.alphaMode||V.OPAQUE;if(h===V.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===V.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==d.MeshBasicMaterial&&(l.push(e.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new d.Vector2(1,1),i.normalTexture.scale!==void 0)){const u=i.normalTexture.scale;a.normalScale.set(u,u)}if(i.occlusionTexture!==void 0&&r!==d.MeshBasicMaterial&&(l.push(e.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==d.MeshBasicMaterial){const u=i.emissiveFactor;a.emissive=new d.Color().setRGB(u[0],u[1],u[2],d.LinearSRGBColorSpace)}return i.emissiveTexture!==void 0&&r!==d.MeshBasicMaterial&&l.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,d.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=d.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[E.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],h=He(l),u=s[h];if(u)r.push(u.promise);else{let f;l.extensions&&l.extensions[E.KHR_DRACO_MESH_COMPRESSION]?f=i(l):f=te(new d.BufferGeometry,l,e),s[h]={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 h=r[c].material===void 0?ke(this.cache):this.getDependency("material",r[c].material);a.push(h)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(c){const l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let p=0,g=h.length;p<g;p++){const _=h[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 d.SkinnedMesh(_,y):new d.Mesh(_,y),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),A.mode===S.TRIANGLE_STRIP?T.geometry=Q(T.geometry,d.TriangleStripDrawMode):A.mode===S.TRIANGLE_FAN&&(T.geometry=Q(T.geometry,d.TriangleFanDrawMode));else if(A.mode===S.LINES)T=new d.LineSegments(_,y);else if(A.mode===S.LINE_STRIP)T=new d.Line(_,y);else if(A.mode===S.LINE_LOOP)T=new d.LineLoop(_,y);else if(A.mode===S.POINTS)T=new d.Points(_,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);Object.keys(T.geometry.morphAttributes).length>0&&Be(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 d.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 d.PerspectiveCamera(d.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(e=new d.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,h=r.length;l<h;l++){const u=r[l];if(u){a.push(u);const f=new d.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 d.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=[],h=[];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),h.push(_))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(c),Promise.all(l),Promise.all(h)]).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],C=g[y],x=_[y],D=A[y];if(w===void 0)continue;w.updateMatrix&&w.updateMatrix();const M=n._createAnimationTracks(w,b,C,x,D);if(M)for(let U=0;U<M.length;U++)T.push(M[U])}return new d.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,h=a.length;l<h;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 h=l[0],u=l[1],f=l[2];f!==null&&h.traverse(function(p){p.isSkinnedMesh&&p.bind(f,Ue)});for(let p=0,g=u.length;p<g;p++)h.add(u[p]);return h})}_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 h;if(i.isBone===!0?h=new d.Bone:l.length>1?h=new d.Group:l.length===1?h=l[0]:h=new d.Object3D,h!==l[0])for(let u=0,f=l.length;u<f;u++)h.add(l[u]);if(i.name&&(h.userData.name=i.name,h.name=r),v(h,i),i.extensions&&I(n,h,i),i.matrix!==void 0){const u=new d.Matrix4;u.fromArray(i.matrix),h.applyMatrix4(u)}else i.translation!==void 0&&h.position.fromArray(i.translation),i.rotation!==void 0&&h.quaternion.fromArray(i.rotation),i.scale!==void 0&&h.scale.fromArray(i.scale);return s.associations.has(h)||s.associations.set(h,{}),s.associations.get(h).nodes=t,h}),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],s=this,i=new d.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 h=0,u=c.length;h<u;h++)i.add(c[h]);const l=h=>{const u=new Map;for(const[f,p]of s.associations)(f instanceof d.Material||f instanceof d.Texture)&&u.set(f,p);return h.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=d.NumberKeyframeTrack;break;case O.rotation:l=d.QuaternionKeyframeTrack;break;case O.position:case O.scale:l=d.VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:l=d.NumberKeyframeTrack;break;case 2:case 3:default:l=d.VectorKeyframeTrack;break}break}const h=s.interpolation!==void 0?De[s.interpolation]:d.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,h);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 d.QuaternionKeyframeTrack?Pe:re;return new s(this.times,this.values,this.getValueSize()/3,n)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ke(o,t,e){const n=t.attributes,s=new d.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 d.Vector3(c[0],c[1],c[2]),new d.Vector3(l[0],l[1],l[2])),a.normalized){const h=$(P[a.componentType]);s.min.multiplyScalar(h),s.max.multiplyScalar(h)}}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 d.Vector3,c=new d.Vector3;for(let l=0,h=i.length;l<h;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 d.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 d.ColorManagement.workingColorSpace!==d.LinearSRGBColorSpace&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${d.ColorManagement.workingColorSpace}" not supported.`),v(o,t),Ke(o,t,e),Promise.all(s).then(function(){return t.targets!==void 0?Fe(o,t.targets,e):o})}var Ve=Object.defineProperty,ze=Object.getOwnPropertyDescriptor,Xe=(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&&Ve(t,e,s),s},We=(o,t)=>(e,n)=>t(e,n,o);let B=class{constructor(o){R(this,"workerPool");R(this,"canvas");R(this,"offscreenCanvas");R(this,"worker");R(this,"thread");this._props=o,this.workerPool=m.C(void 0,this._props.enableDebug)}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"])}}};B=Xe([m.scoped(m.Lifecycle.ContainerScoped),We(0,m.inject(F))],B);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([m.scoped(m.Lifecycle.ContainerScoped),Qe(0,m.inject(B))],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 H=class{constructor(){R(this,"loadingManager",new d.LoadingManager);R(this,"loaders",{});R(this,"sources",[]);R(this,"loadedResources",{});R(this,"toLoadCount",0);R(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 se(this.loadingManager),this.loaders.audioLoader=new d.AudioLoader(this.loadingManager),this.loaders.fontLoader=new m.FontLoader(this.loadingManager),this.loaders.gltfLoader=new le(this.loadingManager),this.loaders.imageLoader=new d.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)))}}}};H=et([m.scoped(m.Lifecycle.ContainerScoped)],H);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 G=class{constructor(o){R(this,"load$$",new m.Subject);R(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()));R(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()));R(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}};G=nt([m.scoped(m.Lifecycle.ContainerScoped),rt(0,m.inject(H))],G);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){R(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()),Object.keys(this._service.loaders).forEach(o=>{const t=this._service.loaders[o];t instanceof se&&t.dispose(),this._service.loaders[o]=void 0}),this._controller.load$$.complete()}};Y=at([m.scoped(m.Lifecycle.ContainerScoped),X(0,m.inject(G)),X(1,m.inject(H)),X(2,m.inject(F))],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();R(this,"_subscriptions",[]);R(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.ContainerScoped),N(0,m.inject(B)),N(1,m.inject(q)),N(2,m.inject(G)),N(3,m.inject(m.CONTAINER_TOKEN)),N(4,m.inject(F)),N(5,m.inject(Y))],exports.RegisterModule);const dt=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(F,{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=F;exports.register=dt;
1
+ "use strict";var ft=Object.defineProperty;var ht=(s,e,t)=>e in s?ft(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var L=(s,e,t)=>ht(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./FontLoader-DvGzwRip.js"),h=require("three");class se{constructor(){L(this,"location");L(this,"initOnConstruct");L(this,"canvas");L(this,"fullScreen");L(this,"defaultCamera");L(this,"startTimer");L(this,"loaderDataSources",[]);L(this,"loaderDracoDecoderPath");L(this,"loadResourcesOnInit");L(this,"enableDebug");L(this,"enableControls");L(this,"axesSizes");L(this,"gridSizes");L(this,"withMiniCamera");L(this,"onReady")}}class pt{constructor(){L(this,"onReady")}}var K={},ge={},N={},z={},Ne;function mt(){if(Ne)return z;Ne=1,Object.defineProperty(z,"__esModule",{value:!0}),z.getBundleURL=z.getBaseURL=void 0;let s;function e(){return s||(s=t()),s}z.getBundleURL=e;function t(){try{throw new Error}catch(r){const o=(""+r.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);if(o)return n(o[0])}return"/"}function n(r){return(""+r).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)?\/[^/]+(?:\?.*)?$/,"$1")+"/"}return z.getBaseURL=n,z}var De;function nt(){if(De)return N;De=1,Object.defineProperty(N,"__esModule",{value:!0}),N.isWorkerRuntime=N.getWorkerImplementation=N.defaultPoolSize=void 0;const s=mt();N.defaultPoolSize=typeof navigator<"u"&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;const e=a=>/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(a);function t(a){const c=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(c)}function n(){if(typeof Worker>"u")return class{constructor(){throw Error("No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.")}};class a extends Worker{constructor(u,l){var f,p;typeof u=="string"&&l&&l._baseURL?u=new URL(u,l._baseURL):typeof u=="string"&&!e(u)&&s.getBundleURL().match(/^file:\/\//i)&&(u=new URL(u,s.getBundleURL().replace(/\/[^\/]+$/,"/")),(!((f=l==null?void 0:l.CORSWorkaround)!==null&&f!==void 0)||f)&&(u=t(`importScripts(${JSON.stringify(u)});`))),typeof u=="string"&&e(u)&&(!((p=l==null?void 0:l.CORSWorkaround)!==null&&p!==void 0)||p)&&(u=t(`importScripts(${JSON.stringify(u)});`)),super(u,l)}}class c extends a{constructor(u,l){const f=window.URL.createObjectURL(u);super(f,l)}static fromText(u,l){const f=new window.Blob([u],{type:"text/javascript"});return new c(f,l)}}return{blob:c,default:a}}let r;function o(){return r||(r=n()),r}N.getWorkerImplementation=o;function i(){const a=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!a)}return N.isWorkerRuntime=i,N}var q={},oe={exports:{}},_e,Fe;function gt(){if(Fe)return _e;Fe=1;var s=1e3,e=s*60,t=e*60,n=t*24,r=n*7,o=n*365.25;_e=function(u,l){l=l||{};var f=typeof u;if(f==="string"&&u.length>0)return i(u);if(f==="number"&&isFinite(u))return l.long?c(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var l=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(l){var f=parseFloat(l[1]),p=(l[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return f*o;case"weeks":case"week":case"w":return f*r;case"days":case"day":case"d":return f*n;case"hours":case"hour":case"hrs":case"hr":case"h":return f*t;case"minutes":case"minute":case"mins":case"min":case"m":return f*e;case"seconds":case"second":case"secs":case"sec":case"s":return f*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(u){var l=Math.abs(u);return l>=n?Math.round(u/n)+"d":l>=t?Math.round(u/t)+"h":l>=e?Math.round(u/e)+"m":l>=s?Math.round(u/s)+"s":u+"ms"}function c(u){var l=Math.abs(u);return l>=n?d(u,l,n,"day"):l>=t?d(u,l,t,"hour"):l>=e?d(u,l,e,"minute"):l>=s?d(u,l,s,"second"):u+" ms"}function d(u,l,f,p){var A=l>=f*1.5;return Math.round(u/f)+" "+p+(A?"s":"")}return _e}var ye,je;function _t(){if(je)return ye;je=1;function s(e){n.debug=n,n.default=n,n.coerce=d,n.disable=i,n.enable=o,n.enabled=a,n.humanize=gt(),n.destroy=u,Object.keys(e).forEach(l=>{n[l]=e[l]}),n.names=[],n.skips=[],n.formatters={};function t(l){let f=0;for(let p=0;p<l.length;p++)f=(f<<5)-f+l.charCodeAt(p),f|=0;return n.colors[Math.abs(f)%n.colors.length]}n.selectColor=t;function n(l){let f,p=null,A,R;function v(...m){if(!v.enabled)return;const g=v,_=Number(new Date),b=_-(f||_);g.diff=b,g.prev=f,g.curr=_,f=_,m[0]=n.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let T=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(E,x)=>{if(E==="%%")return"%";T++;const C=n.formatters[x];if(typeof C=="function"){const M=m[T];E=C.call(g,M),m.splice(T,1),T--}return E}),n.formatArgs.call(g,m),(g.log||n.log).apply(g,m)}return v.namespace=l,v.useColors=n.useColors(),v.color=n.selectColor(l),v.extend=r,v.destroy=n.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(A!==n.namespaces&&(A=n.namespaces,R=n.enabled(l)),R),set:m=>{p=m}}),typeof n.init=="function"&&n.init(v),v}function r(l,f){const p=n(this.namespace+(typeof f>"u"?":":f)+l);return p.log=this.log,p}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];let f;const p=(typeof l=="string"?l:"").split(/[\s,]+/),A=p.length;for(f=0;f<A;f++)p[f]&&(l=p[f].replace(/\*/g,".*?"),l[0]==="-"?n.skips.push(new RegExp("^"+l.slice(1)+"$")):n.names.push(new RegExp("^"+l+"$")))}function i(){const l=[...n.names.map(c),...n.skips.map(c).map(f=>"-"+f)].join(",");return n.enable(""),l}function a(l){if(l[l.length-1]==="*")return!0;let f,p;for(f=0,p=n.skips.length;f<p;f++)if(n.skips[f].test(l))return!1;for(f=0,p=n.names.length;f<p;f++)if(n.names[f].test(l))return!0;return!1}function c(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function d(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return ye=s,ye}var Be;function Oe(){return Be||(Be=1,function(s,e){e.formatArgs=n,e.save=r,e.load=o,e.useColors=t,e.storage=i(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+s.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;c.splice(1,0,d,"color: inherit");let u=0,l=0;c[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&(u++,f==="%c"&&(l=u))}),c.splice(l,0,d)}e.log=console.debug||console.log||(()=>{});function r(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function o(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function i(){try{return localStorage}catch{}}s.exports=_t()(e);const{formatters:a}=s.exports;a.j=function(c){try{return JSON.stringify(c)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}}(oe,oe.exports)),oe.exports}var yt=function(s,e,t,n){function r(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{d(n.next(u))}catch(l){i(l)}}function c(u){try{d(n.throw(u))}catch(l){i(l)}}function d(u){u.done?o(u.value):r(u.value).then(a,c)}d((n=n.apply(s,e||[])).next())})};class fe{constructor(e){this._baseObserver=e,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch(e=>this._baseObserver.error(e))}error(e){this._baseObserver.error(e)}schedule(e){const t=Promise.all(this._pendingPromises),n=[],r=i=>n.push(i),o=Promise.resolve().then(()=>yt(this,void 0,void 0,function*(){yield t,yield e(r),this._pendingPromises.delete(o);for(const i of n)this._baseObserver.next(i)})).catch(i=>{this._pendingPromises.delete(o),this._baseObserver.error(i)});this._pendingPromises.add(o)}}const rt=()=>typeof Symbol=="function",ie=s=>rt()&&!!Symbol[s],Ie=s=>ie(s)?Symbol[s]:"@@"+s;ie("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const bt=Ie("iterator"),Se=Ie("observable"),st=Ie("species");function ce(s,e){const t=s[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function J(s){let e=s.constructor;return e!==void 0&&(e=e[st],e===null&&(e=void 0)),e!==void 0?e:P}function Tt(s){return s instanceof P}function Y(s){Y.log?Y.log(s):setTimeout(()=>{throw s},0)}function ae(s){Promise.resolve().then(()=>{try{s()}catch(e){Y(e)}})}function it(s){const e=s._cleanup;if(e!==void 0&&(s._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{const t=ce(e,"unsubscribe");t&&t.call(e)}}catch(t){Y(t)}}function xe(s){s._observer=void 0,s._queue=void 0,s._state="closed"}function wt(s){const e=s._queue;if(e){s._queue=void 0,s._state="ready";for(const t of e)if(ot(s,t.type,t.value),s._state==="closed")break}}function ot(s,e,t){s._state="running";const n=s._observer;try{const r=n?ce(n,e):void 0;switch(e){case"next":r&&r.call(n,t);break;case"error":if(xe(s),r)r.call(n,t);else throw t;break;case"complete":xe(s),r&&r.call(n);break}}catch(r){Y(r)}s._state==="closed"?it(s):s._state==="running"&&(s._state="ready")}function be(s,e,t){if(s._state!=="closed"){if(s._state==="buffering"){s._queue=s._queue||[],s._queue.push({type:e,value:t});return}if(s._state!=="ready"){s._state="buffering",s._queue=[{type:e,value:t}],ae(()=>wt(s));return}ot(s,e,t)}}class vt{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const n=new At(this);try{this._cleanup=t.call(void 0,n)}catch(r){n.error(r)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(xe(this),it(this))}}class At{constructor(e){this._subscription=e}get closed(){return this._subscription._state==="closed"}next(e){be(this._subscription,"next",e)}error(e){be(this._subscription,"error",e)}complete(){be(this._subscription,"complete")}}class P{constructor(e){if(!(this instanceof P))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,t,n){return(typeof e!="object"||e===null)&&(e={next:e,error:t,complete:n}),new vt(e,this._subscriber)}pipe(e,...t){let n=this;for(const r of[e,...t])n=r(n);return n}tap(e,t,n){const r=typeof e!="object"||e===null?{next:e,error:t,complete:n}:e;return new P(o=>this.subscribe({next(i){r.next&&r.next(i),o.next(i)},error(i){r.error&&r.error(i),o.error(i)},complete(){r.complete&&r.complete(),o.complete()},start(i){r.start&&r.start(i)}}))}forEach(e){return new Promise((t,n)=>{if(typeof e!="function"){n(new TypeError(e+" is not a function"));return}function r(){o.unsubscribe(),t(void 0)}const o=this.subscribe({next(i){try{e(i,r)}catch(a){n(a),o.unsubscribe()}},error(i){n(i)},complete(){t(void 0)}})})}map(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const t=J(this);return new t(n=>this.subscribe({next(r){let o=r;try{o=e(r)}catch(i){return n.error(i)}n.next(o)},error(r){n.error(r)},complete(){n.complete()}}))}filter(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const t=J(this);return new t(n=>this.subscribe({next(r){try{if(!e(r))return}catch(o){return n.error(o)}n.next(r)},error(r){n.error(r)},complete(){n.complete()}}))}reduce(e,t){if(typeof e!="function")throw new TypeError(e+" is not a function");const n=J(this),r=arguments.length>1;let o=!1,i=t;return new n(a=>this.subscribe({next(c){const d=!o;if(o=!0,!d||r)try{i=e(i,c)}catch(u){return a.error(u)}else i=c},error(c){a.error(c)},complete(){if(!o&&!r)return a.error(new TypeError("Cannot reduce an empty sequence"));a.next(i),a.complete()}}))}concat(...e){const t=J(this);return new t(n=>{let r,o=0;function i(a){r=a.subscribe({next(c){n.next(c)},error(c){n.error(c)},complete(){o===e.length?(r=void 0,n.complete()):i(t.from(e[o++]))}})}return i(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const t=J(this);return new t(n=>{const r=[],o=this.subscribe({next(a){let c;if(e)try{c=e(a)}catch(u){return n.error(u)}else c=a;const d=t.from(c).subscribe({next(u){n.next(u)},error(u){n.error(u)},complete(){const u=r.indexOf(d);u>=0&&r.splice(u,1),i()}});r.push(d)},error(a){n.error(a)},complete(){i()}});function i(){o.closed&&r.length===0&&n.complete()}return()=>{r.forEach(a=>a.unsubscribe()),o.unsubscribe()}})}[Se](){return this}static from(e){const t=typeof this=="function"?this:P;if(e==null)throw new TypeError(e+" is not an object");const n=ce(e,Se);if(n){const r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return Tt(r)&&r.constructor===t?r:new t(o=>r.subscribe(o))}if(ie("iterator")){const r=ce(e,bt);if(r)return new t(o=>{ae(()=>{if(!o.closed){for(const i of r.call(e))if(o.next(i),o.closed)return;o.complete()}})})}if(Array.isArray(e))return new t(r=>{ae(()=>{if(!r.closed){for(const o of e)if(r.next(o),r.closed)return;r.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){const t=typeof this=="function"?this:P;return new t(n=>{ae(()=>{if(!n.closed){for(const r of e)if(n.next(r),n.closed)return;n.complete()}})})}static get[st](){return this}}rt()&&Object.defineProperty(P,Symbol("extensions"),{value:{symbol:Se,hostReportError:Y},configurable:!0});function $(s){typeof s=="function"?s():s&&typeof s.unsubscribe=="function"&&s.unsubscribe()}var Et=function(s,e,t,n){function r(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{d(n.next(u))}catch(l){i(l)}}function c(u){try{d(n.throw(u))}catch(l){i(l)}}function d(u){u.done?o(u.value):r(u.value).then(a,c)}d((n=n.apply(s,e||[])).next())})};function Rt(s){return e=>new P(t=>{const n=new fe(t),r=e.subscribe({complete(){n.complete()},error(o){n.error(o)},next(o){n.schedule(i=>Et(this,void 0,void 0,function*(){(yield s(o))&&i(o)}))}});return()=>$(r)})}function Ct(s){return s&&ie("asyncIterator")&&s[Symbol.asyncIterator]}function St(s){return s&&ie("iterator")&&s[Symbol.iterator]}var xt=function(s,e,t,n){function r(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{d(n.next(u))}catch(l){i(l)}}function c(u){try{d(n.throw(u))}catch(l){i(l)}}function d(u){u.done?o(u.value):r(u.value).then(a,c)}d((n=n.apply(s,e||[])).next())})},Lt=function(s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=s[Symbol.asyncIterator],t;return e?e.call(s):(s=typeof __values=="function"?__values(s):s[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(o){t[o]=s[o]&&function(i){return new Promise(function(a,c){i=s[o](i),r(a,c,i.done,i.value)})}}function r(o,i,a,c){Promise.resolve(c).then(function(d){o({value:d,done:a})},i)}};function Mt(s){return e=>new P(t=>{const n=new fe(t),r=e.subscribe({complete(){n.complete()},error(o){n.error(o)},next(o){n.schedule(i=>xt(this,void 0,void 0,function*(){var a,c;const d=yield s(o);if(St(d)||Ct(d))try{for(var u=Lt(d),l;l=yield u.next(),!l.done;){const f=l.value;i(f)}}catch(f){a={error:f}}finally{try{l&&!l.done&&(c=u.return)&&(yield c.call(u))}finally{if(a)throw a.error}}else d.map(f=>i(f))}))}});return()=>$(r)})}function kt(s){return new P(e=>{let t=0;const n=setInterval(()=>{e.next(t++)},s);return()=>clearInterval(n)})}var Pt=function(s,e,t,n){function r(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{d(n.next(u))}catch(l){i(l)}}function c(u){try{d(n.throw(u))}catch(l){i(l)}}function d(u){u.done?o(u.value):r(u.value).then(a,c)}d((n=n.apply(s,e||[])).next())})};function Ot(s){return e=>new P(t=>{const n=new fe(t),r=e.subscribe({complete(){n.complete()},error(o){n.error(o)},next(o){n.schedule(i=>Pt(this,void 0,void 0,function*(){const a=yield s(o);i(a)}))}});return()=>$(r)})}function It(...s){return s.length===0?P.from([]):new P(e=>{let t=0;const n=s.map(o=>o.subscribe({error(i){e.error(i),r()},next(i){e.next(i)},complete(){++t===s.length&&(e.complete(),r())}})),r=()=>{n.forEach(o=>$(o))};return r})}class at extends P{constructor(){super(e=>(this._observers.add(e),()=>this._observers.delete(e))),this._observers=new Set}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){for(const e of this._observers)e.complete()}}function Nt(s){const e=new at;let t,n=0;return new P(r=>{t||(t=s.subscribe(e));const o=e.subscribe(r);return n++,()=>{n--,o.unsubscribe(),n===0&&($(t),t=void 0)}})}var Dt=function(s,e,t,n){function r(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{d(n.next(u))}catch(l){i(l)}}function c(u){try{d(n.throw(u))}catch(l){i(l)}}function d(u){u.done?o(u.value):r(u.value).then(a,c)}d((n=n.apply(s,e||[])).next())})};function Ft(s,e){return t=>new P(n=>{let r,o=0;const i=new fe(n),a=t.subscribe({complete(){i.complete()},error(c){i.error(c)},next(c){i.schedule(d=>Dt(this,void 0,void 0,function*(){r=yield s(o===0?typeof e>"u"?c:e:r,c,o++),d(r)}))}});return()=>$(a)})}const jt=Object.freeze(Object.defineProperty({__proto__:null,Observable:P,Subject:at,filter:Rt,flatMap:Mt,interval:kt,map:Ot,merge:It,multicast:Nt,scan:Ft,unsubscribe:$},Symbol.toStringTag,{value:"Module"})),he=y.getAugmentedNamespace(jt);var Z={},He;function Bt(){if(He)return Z;He=1,Object.defineProperty(Z,"__esModule",{value:!0}),Z.allSettled=void 0;function s(e){return Promise.all(e.map(t=>{const n=i=>({status:"fulfilled",value:i}),r=i=>({status:"rejected",reason:i}),o=Promise.resolve(t);try{return o.then(n,r)}catch(i){return Promise.reject(i)}}))}return Z.allSettled=s,Z}var Te={},Ue;function Ht(){return Ue||(Ue=1,function(s){Object.defineProperty(s,"__esModule",{value:!0}),s.PoolEventType=void 0,function(e){e.initialized="initialized",e.taskCanceled="taskCanceled",e.taskCompleted="taskCompleted",e.taskFailed="taskFailed",e.taskQueued="taskQueued",e.taskQueueDrained="taskQueueDrained",e.taskStart="taskStart",e.terminated="terminated"}(s.PoolEventType||(s.PoolEventType={}))}(Te)),Te}var ee={},Ge;function ct(){if(Ge)return ee;Ge=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.Thread=void 0;const s=y.requireSymbols();function e(t){throw Error(t)}return ee.Thread={errors(t){return t[s.$errors]||e("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},events(t){return t[s.$events]||e("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},terminate(t){return t[s.$terminate]()}},ee}var We;function Ut(){return We||(We=1,function(s){var e=q&&q.__awaiter||function(m,g,_,b){function T(w){return w instanceof _?w:new _(function(E){E(w)})}return new(_||(_=Promise))(function(w,E){function x(k){try{M(b.next(k))}catch(I){E(I)}}function C(k){try{M(b.throw(k))}catch(I){E(I)}}function M(k){k.done?w(k.value):T(k.value).then(x,C)}M((b=b.apply(m,g||[])).next())})},t=q&&q.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(s,"__esModule",{value:!0}),s.Pool=s.Thread=s.PoolEventType=void 0;const n=t(Oe()),r=he,o=Bt(),i=nt(),a=Ht();Object.defineProperty(s,"PoolEventType",{enumerable:!0,get:function(){return a.PoolEventType}});const c=ct();Object.defineProperty(s,"Thread",{enumerable:!0,get:function(){return c.Thread}});let d=1;function u(m){const g=[];for(let _=0;_<m;_++)g.push(_);return g}function l(m){return new Promise(g=>setTimeout(g,m))}function f(m,g){return m.reduce((_,b)=>[..._,...g(b)],[])}function p(m){return m.replace(/\W/g," ").trim().replace(/\s+/g,"-")}function A(m,g){return u(g).map(()=>({init:m(),runningTasks:[]}))}class R{constructor(g,_){this.eventSubject=new r.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];const b=typeof _=="number"?{size:_}:_||{},{size:T=i.defaultPoolSize}=b;this.debug=n.default(`threads:pool:${p(b.name||String(d++))}`),this.options=b,this.workers=A(g,T),this.eventObservable=r.multicast(r.Observable.from(this.eventSubject)),Promise.all(this.workers.map(w=>w.init)).then(()=>this.eventSubject.next({type:a.PoolEventType.initialized,size:this.workers.length}),w=>{this.debug("Error while initializing pool worker:",w),this.eventSubject.error(w),this.initErrors.push(w)})}findIdlingWorker(){const{concurrency:g=1}=this.options;return this.workers.find(_=>_.runningTasks.length<g)}runPoolTask(g,_){return e(this,void 0,void 0,function*(){const b=this.workers.indexOf(g)+1;this.debug(`Running task #${_.id} on worker #${b}...`),this.eventSubject.next({type:a.PoolEventType.taskStart,taskID:_.id,workerID:b});try{const T=yield _.run(yield g.init);this.debug(`Task #${_.id} completed successfully`),this.eventSubject.next({type:a.PoolEventType.taskCompleted,returnValue:T,taskID:_.id,workerID:b})}catch(T){this.debug(`Task #${_.id} failed`),this.eventSubject.next({type:a.PoolEventType.taskFailed,taskID:_.id,error:T,workerID:b})}})}run(g,_){return e(this,void 0,void 0,function*(){const b=e(this,void 0,void 0,function*(){const T=()=>{g.runningTasks=g.runningTasks.filter(w=>w!==b)};yield l(0);try{yield this.runPoolTask(g,_)}finally{T(),this.isClosing||this.scheduleWork()}});g.runningTasks.push(b)})}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const g=this.findIdlingWorker();if(!g)return;const _=this.taskQueue.shift();if(!_){this.debug("Task queue is empty"),this.eventSubject.next({type:a.PoolEventType.taskQueueDrained});return}this.run(g,_)}taskCompletion(g){return new Promise((_,b)=>{const T=this.events().subscribe(w=>{w.type===a.PoolEventType.taskCompleted&&w.taskID===g?(T.unsubscribe(),_(w.returnValue)):w.type===a.PoolEventType.taskFailed&&w.taskID===g?(T.unsubscribe(),b(w.error)):w.type===a.PoolEventType.terminated&&(T.unsubscribe(),b(Error("Pool has been terminated before task was run.")))})})}settled(g=!1){return e(this,void 0,void 0,function*(){const _=()=>f(this.workers,w=>w.runningTasks),b=[],T=this.eventObservable.subscribe(w=>{w.type===a.PoolEventType.taskFailed&&b.push(w.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):g&&this.taskQueue.length===0?(yield o.allSettled(_()),b):(yield new Promise((w,E)=>{const x=this.eventObservable.subscribe({next(C){C.type===a.PoolEventType.taskQueueDrained&&(x.unsubscribe(),w(void 0))},error:E})}),yield o.allSettled(_()),T.unsubscribe(),b)})}completed(g=!1){return e(this,void 0,void 0,function*(){const _=this.settled(g),b=new Promise((w,E)=>{const x=this.eventObservable.subscribe({next(C){C.type===a.PoolEventType.taskQueueDrained?(x.unsubscribe(),w(_)):C.type===a.PoolEventType.taskFailed&&(x.unsubscribe(),E(C.error))},error:E})}),T=yield Promise.race([_,b]);if(T.length>0)throw T[0]})}events(){return this.eventObservable}queue(g){const{maxQueuedJobs:_=1/0}=this.options;if(this.isClosing)throw Error("Cannot schedule pool tasks after terminate() has been called.");if(this.initErrors.length>0)throw this.initErrors[0];const b=this.nextTaskID++,T=this.taskCompletion(b);T.catch(E=>{this.debug(`Task #${b} errored:`,E)});const w={id:b,run:g,cancel:()=>{this.taskQueue.indexOf(w)!==-1&&(this.taskQueue=this.taskQueue.filter(E=>E!==w),this.eventSubject.next({type:a.PoolEventType.taskCanceled,taskID:w.id}))},then:T.then.bind(T)};if(this.taskQueue.length>=_)throw Error(`Maximum number of pool tasks queued. Refusing to queue another one.
2
+ This usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.`);return this.debug(`Queueing task #${w.id}...`),this.taskQueue.push(w),this.eventSubject.next({type:a.PoolEventType.taskQueued,taskID:w.id}),this.scheduleWork(),w}terminate(g){return e(this,void 0,void 0,function*(){this.isClosing=!0,g||(yield this.completed(!0)),this.eventSubject.next({type:a.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(_=>e(this,void 0,void 0,function*(){return c.Thread.terminate(yield _.init)})))})}}R.EventType=a.PoolEventType;function v(m,g){return new R(m,g)}v.EventType=a.PoolEventType,s.Pool=v}(q)),q}var D={},te={},Ke;function Gt(){if(Ke)return te;Ke=1,Object.defineProperty(te,"__esModule",{value:!0}),te.createPromiseWithResolver=void 0;const s=()=>{};function e(){let t=!1,n,r=s;return[new Promise(a=>{t?a(n):r=a}),a=>{t=!0,n=a,r(n)}]}return te.createPromiseWithResolver=e,te}var we={},ze;function Wt(){return ze||(ze=1,function(s){Object.defineProperty(s,"__esModule",{value:!0}),s.WorkerEventType=void 0,function(e){e.internalError="internalError",e.message="message",e.termination="termination"}(s.WorkerEventType||(s.WorkerEventType={}))}(we)),we}var F={},ne={},qe;function Kt(){if(qe)return ne;qe=1,Object.defineProperty(ne,"__esModule",{value:!0}),ne.ObservablePromise=void 0;const s=he,e=()=>{},t=a=>a,n=a=>Promise.resolve().then(a);function r(a){throw a}function o(a){return a&&typeof a.then=="function"}class i extends s.Observable{constructor(c){super(d=>{const u=this,l=Object.assign(Object.assign({},d),{complete(){d.complete(),u.onCompletion()},error(f){d.error(f),u.onError(f)},next(f){d.next(f),u.onNext(f)}});try{return this.initHasRun=!0,c(l)}catch(f){l.error(f)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state="pending"}onNext(c){this.firstValueSet||(this.firstValue=c,this.firstValueSet=!0)}onError(c){this.state="rejected",this.rejection=c;for(const d of this.rejectionCallbacks)n(()=>d(c))}onCompletion(){this.state="fulfilled";for(const c of this.fulfillmentCallbacks)n(()=>c(this.firstValue))}then(c,d){const u=c||t,l=d||r;let f=!1;return new Promise((p,A)=>{const R=m=>{if(!f){f=!0;try{p(l(m))}catch(g){A(g)}}},v=m=>{try{p(u(m))}catch(g){R(g)}};if(this.initHasRun||this.subscribe({error:R}),this.state==="fulfilled")return p(u(this.firstValue));if(this.state==="rejected")return f=!0,p(l(this.rejection));this.fulfillmentCallbacks.push(v),this.rejectionCallbacks.push(R)})}catch(c){return this.then(void 0,c)}finally(c){const d=c||e;return this.then(u=>(d(),u),()=>d())}static from(c){return o(c)?new i(d=>{const u=f=>{d.next(f),d.complete()},l=f=>{d.error(f)};c.then(u,l)}):super.from(c)}}return ne.ObservablePromise=i,ne}var Ve;function zt(){if(Ve)return F;Ve=1;var s=F&&F.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(F,"__esModule",{value:!0}),F.createProxyModule=F.createProxyFunction=void 0;const e=s(Oe()),t=he,n=y.requireCommon(),r=Kt(),o=y.requireTransferable(),i=y.requireMessages(),a=e.default("threads:master:messages");let c=1;const d=m=>Array.from(new Set(m)),u=m=>m&&m.type===i.WorkerMessageType.error,l=m=>m&&m.type===i.WorkerMessageType.result,f=m=>m&&m.type===i.WorkerMessageType.running;function p(m,g){return new t.Observable(_=>{let b;const T=w=>{if(a("Message from worker:",w.data),!(!w.data||w.data.uid!==g)){if(f(w.data))b=w.data.resultType;else if(l(w.data))b==="promise"?(typeof w.data.payload<"u"&&_.next(n.deserialize(w.data.payload)),_.complete(),m.removeEventListener("message",T)):(w.data.payload&&_.next(n.deserialize(w.data.payload)),w.data.complete&&(_.complete(),m.removeEventListener("message",T)));else if(u(w.data)){const E=n.deserialize(w.data.error);_.error(E),m.removeEventListener("message",T)}}};return m.addEventListener("message",T),()=>{if(b==="observable"||!b){const w={type:i.MasterMessageType.cancel,uid:g};m.postMessage(w)}m.removeEventListener("message",T)}})}function A(m){if(m.length===0)return{args:[],transferables:[]};const g=[],_=[];for(const b of m)o.isTransferDescriptor(b)?(g.push(n.serialize(b.send)),_.push(...b.transferables)):g.push(n.serialize(b));return{args:g,transferables:_.length===0?_:d(_)}}function R(m,g){return(..._)=>{const b=c++,{args:T,transferables:w}=A(_),E={type:i.MasterMessageType.run,uid:b,method:g,args:T};a("Sending command to run function to worker:",E);try{m.postMessage(E,w)}catch(x){return r.ObservablePromise.from(Promise.reject(x))}return r.ObservablePromise.from(t.multicast(p(m,b)))}}F.createProxyFunction=R;function v(m,g){const _={};for(const b of g)_[b]=R(m,b);return _}return F.createProxyModule=v,F}var $e;function qt(){if($e)return D;$e=1;var s=D&&D.__awaiter||function(T,w,E,x){function C(M){return M instanceof E?M:new E(function(k){k(M)})}return new(E||(E=Promise))(function(M,k){function I(W){try{pe(x.next(W))}catch(me){k(me)}}function G(W){try{pe(x.throw(W))}catch(me){k(me)}}function pe(W){W.done?M(W.value):C(W.value).then(I,G)}pe((x=x.apply(T,w||[])).next())})},e=D&&D.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(D,"__esModule",{value:!0}),D.spawn=void 0;const t=e(Oe()),n=he,r=y.requireCommon(),o=Gt(),i=y.requireSymbols(),a=Wt(),c=zt(),d=t.default("threads:master:messages"),u=t.default("threads:master:spawn"),l=t.default("threads:master:thread-utils"),f=T=>T&&T.type==="init",p=T=>T&&T.type==="uncaughtError",A=typeof process<"u"&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function R(T,w,E){return s(this,void 0,void 0,function*(){let x;const C=new Promise((k,I)=>{x=setTimeout(()=>I(Error(E)),w)}),M=yield Promise.race([T,C]);return clearTimeout(x),M})}function v(T){return new Promise((w,E)=>{const x=C=>{d("Message from worker before finishing initialization:",C.data),f(C.data)?(T.removeEventListener("message",x),w(C.data)):p(C.data)&&(T.removeEventListener("message",x),E(r.deserialize(C.data.error)))};T.addEventListener("message",x)})}function m(T,w){return new n.Observable(E=>{const x=M=>{const k={type:a.WorkerEventType.message,data:M.data};E.next(k)},C=M=>{l("Unhandled promise rejection event in thread:",M);const k={type:a.WorkerEventType.internalError,error:Error(M.reason)};E.next(k)};T.addEventListener("message",x),T.addEventListener("unhandledrejection",C),w.then(()=>{const M={type:a.WorkerEventType.termination};T.removeEventListener("message",x),T.removeEventListener("unhandledrejection",C),E.next(M),E.complete()})})}function g(T){const[w,E]=o.createPromiseWithResolver();return{terminate:()=>s(this,void 0,void 0,function*(){l("Terminating worker"),yield T.terminate(),E()}),termination:w}}function _(T,w,E,x){const C=E.filter(M=>M.type===a.WorkerEventType.internalError).map(M=>M.error);return Object.assign(T,{[i.$errors]:C,[i.$events]:E,[i.$terminate]:x,[i.$worker]:w})}function b(T,w){return s(this,void 0,void 0,function*(){u("Initializing new thread");const E=w&&w.timeout?w.timeout:A,C=(yield R(v(T),E,`Timeout: Did not receive an init message from worker after ${E}ms. Make sure the worker calls expose().`)).exposed,{termination:M,terminate:k}=g(T),I=m(T,M);if(C.type==="function"){const G=c.createProxyFunction(T);return _(G,T,I,k)}else if(C.type==="module"){const G=c.createProxyModule(T,C.methods);return _(G,T,I,k)}else{const G=C.type;throw Error(`Worker init message states unexpected type of expose(): ${G}`)}})}return D.spawn=b,D}var Xe;function Vt(){return Xe||(Xe=1,function(s){Object.defineProperty(s,"__esModule",{value:!0}),s.Worker=s.BlobWorker=s.isWorkerRuntime=s.Thread=s.spawn=s.Pool=void 0;const e=nt();Object.defineProperty(s,"isWorkerRuntime",{enumerable:!0,get:function(){return e.isWorkerRuntime}});var t=Ut();Object.defineProperty(s,"Pool",{enumerable:!0,get:function(){return t.Pool}});var n=qt();Object.defineProperty(s,"spawn",{enumerable:!0,get:function(){return n.spawn}});var r=ct();Object.defineProperty(s,"Thread",{enumerable:!0,get:function(){return r.Thread}}),s.BlobWorker=e.getWorkerImplementation().blob,s.Worker=e.getWorkerImplementation().default}(ge)),ge}var Qe;function $t(){return Qe||(Qe=1,function(s){var e=K&&K.__createBinding||(Object.create?function(a,c,d,u){u===void 0&&(u=d),Object.defineProperty(a,u,{enumerable:!0,get:function(){return c[d]}})}:function(a,c,d,u){u===void 0&&(u=d),a[u]=c[d]}),t=K&&K.__exportStar||function(a,c){for(var d in a)d!=="default"&&!Object.prototype.hasOwnProperty.call(c,d)&&e(c,a,d)};Object.defineProperty(s,"__esModule",{value:!0}),s.Transfer=s.DefaultSerializer=s.expose=s.registerSerializer=void 0;var n=y.requireCommon();Object.defineProperty(s,"registerSerializer",{enumerable:!0,get:function(){return n.registerSerializer}}),t(Vt(),s);var r=y.requireWorker();Object.defineProperty(s,"expose",{enumerable:!0,get:function(){return r.expose}});var o=y.requireSerializers();Object.defineProperty(s,"DefaultSerializer",{enumerable:!0,get:function(){return o.DefaultSerializer}});var i=y.requireTransferable();Object.defineProperty(s,"Transfer",{enumerable:!0,get:function(){return i.Transfer}})}(K)),K}var Xt=$t();const U=y.getDefaultExportFromCjs(Xt);U.registerSerializer;const Qt=U.spawn;U.BlobWorker;U.DefaultSerializer;U.Pool;const Yt=U.Thread;U.Transfer;const Jt=U.Worker;var Zt=Object.defineProperty,en=(s,e,t)=>e in s?Zt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,j=(s,e,t)=>en(s,typeof e!="symbol"?e+"":e,t);const tn=()=>{try{if(window){if(navigator!=null&&navigator.hardwareConcurrency)return navigator.hardwareConcurrency;throw new Error("Unable to determine the number of cores")}else return require("os").cpus().length}catch(s){return console.error("🛑 Unable to detect available cores",s),2}},nn=()=>tn()-1,rn="TERMINATE_THREAD_FROM_WORKER";let sn=-1;class on{constructor(e){j(this,"_handleTerminate"),j(this,"_handleError"),j(this,"_task"),j(this,"id",sn+=1),j(this,"idle",!0),j(this,"worker"),j(this,"thread"),this._handleTerminate=e==null?void 0:e.onTerminate,this._handleError=e==null?void 0:e.onError}_handleMessages(e){var t;e instanceof MessageEvent&&((t=e.data)==null?void 0:t.token)===rn&&this.terminate()}async run(e){var t;try{const{payload:n,options:r}=e;return this.idle=!1,this.worker=new Jt(n.path,{type:"module",...r==null?void 0:r.worker}),this.thread=await Qt(this.worker,{timeout:1e4,...r==null?void 0:r.spawn}),this._task=e,this.worker.postMessage(n.subject,n.transferSubject),this.worker.addEventListener("message",this._handleMessages.bind(this)),this}catch(n){(t=this._handleError)==null||t.call(this,n);return}}get task(){return this._task}async terminate(){var e,t,n;(e=this.worker)==null||e.removeEventListener("message",this._handleMessages.bind(this)),this.thread&&await Yt.terminate(this.thread),await((t=this.worker)==null?void 0:t.terminate()),this.worker=void 0,this.thread=void 0,this._task=void 0,this.idle=!0,(n=this._handleTerminate)==null||n.call(this)}}class an{constructor(e,t,n){j(this,"_workerThreads",[]),j(this,"_tasksQueue",[]),this.maxWorkersCount=e,this.debugMode=t,this.onWorkerThreadRun=n;for(let r=0;r<this.maxWorkersCount;r++)this._workerThreads.push(this._createWorkerThread())}_handleWorkerThreadTerminate(e){this.debugMode&&console.log(`WorkerThread #${e.id} freed`),this.runNext()}_handleWorkerThreadError(e,t){console.error(`Error from worker #${t.id}:`,e),this.runNext()}_createWorkerThread(){const e=new on({onTerminate:()=>this._handleWorkerThreadTerminate(e),onError:t=>this._handleWorkerThreadError(t,e)});return e}get workerThreads(){return this._workerThreads}get tasksQueue(){return this._tasksQueue}get nextAvailableWorkerThread(){return this._workerThreads.find(e=>e.idle)}getAvailableWorkerThreads(e=!1){return this._workerThreads.filter(t=>e?!t.idle:t.idle)}async runNext(){if(!this.nextAvailableWorkerThread||this._tasksQueue.length===0)return;const e=this._tasksQueue.shift();e&&await this.run(e)}async run(e,t=!1){var n;if(t){const i=this._createWorkerThread();return this.debugMode&&console.log(`Running On Untracked Thread #${i==null?void 0:i.id}. Task:`,e),[await i.run(e),!0]}const r=this.nextAvailableWorkerThread;if(!r)return this._tasksQueue.push(e),this.debugMode&&console.log("Queued Thread Task:",e),[void 0,!0];this.debugMode&&console.log(`Running On Thread #${r==null?void 0:r.id}. Task:`,e);const o=await r.run(e);if(o)return(n=this.onWorkerThreadRun)==null||n.call(this,o),[o,!1]}async terminateAll(){this._tasksQueue=[],await Promise.all(this._workerThreads.map(e=>e.terminate()))}}const cn=(s,e)=>new an(nn(),!!e);var un=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,dn=(s,e,t,n)=>{for(var r=n>1?void 0:n?ln(e,t):e,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&un(e,t,r),r},fn=(s,e)=>(t,n)=>e(t,n,s);let ue=class{constructor(s){L(this,"workerPool");L(this,"canvas");L(this,"offscreenCanvas");L(this,"worker");L(this,"thread");this._props=s,this.workerPool=cn(void 0,this._props.enableDebug)}init(s){this.worker=s.worker,this.thread=s.thread}preventDefaultHandler(s){return s.preventDefault(),{type:s.type}}getScreenSizes(){var s,e;return{width:(s=this.canvas)==null?void 0:s.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(s){var t;const e=(t=this.canvas)==null?void 0:t.getBoundingClientRect();return{...this.getScreenSizes(),type:s.type,top:e==null?void 0:e.top,left:e==null?void 0:e.left}}mouseEventHandler(s){return{...this.getScreenSizes(),...y.R(s,["ctrlKey","metaKey","shiftKey","button","pointerType","clientX","clientY","pageX","pageY"])}}touchEventHandler(s){const e=[],t={type:s.type,touches:e};for(let n=0;n<s.touches.length;++n){const r=s.touches[n];e.push({pageX:(r==null?void 0:r.pageX)??0,pageY:(r==null?void 0:r.pageY)??0})}return{...this.getScreenSizes(),...t}}wheelEventHandler(s){return s.preventDefault(),{...this.getScreenSizes(),...y.R(s,["deltaX","deltaY"])}}keyEventHandler(s){if(y.KEYBOARD_EVENT_CODES.includes(s.code))return s.preventDefault(),{...this.getScreenSizes(),...y.R(s,["ctrlKey","metaKey","shiftKey","keyCode"])}}};ue=dn([y.scoped(y.Lifecycle.ContainerScoped),fn(0,y.inject(se))],ue);var hn=Object.defineProperty,pn=Object.getOwnPropertyDescriptor,mn=(s,e,t,n)=>{for(var r=n>1?void 0:n?pn(e,t):e,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&hn(e,t,r),r},gn=(s,e)=>(t,n)=>e(t,n,s);let Le=class extends y.ProxyEventHandlersBlueprint{constructor(s){super(),this._service=s}init(){for(const s of y.PROXY_EVENT_LISTENERS){const e=s.startsWith("mouse")||s.startsWith("pointer")||s.startsWith("touch")?this._service.mouseEventHandler.bind(this._service):s.startsWith("key")?this._service.keyEventHandler.bind(this._service):s==="resize"?this._service.uiEventHandler.bind(this._service):s==="wheel"?this._service.wheelEventHandler.bind(this._service):this._service.preventDefaultHandler.bind(this._service);this[`${s}$`]=y.fromEvent(s==="resize"?window:this._service.canvas,s).pipe(y.map(e.bind(this)),y.filter(t=>!(s==="keydown"&&!t))),this[`${s}$`].subscribe(t=>{var n,r;(r=(n=this._service.thread)==null?void 0:n[s])==null||r.call(n,t)})}}};Le=mn([y.scoped(y.Lifecycle.ContainerScoped),gn(0,y.inject(ue))],Le);function Ye(s,e){if(e===h.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===h.TriangleFanDrawMode||e===h.TriangleStripDrawMode){let t=s.getIndex();if(t===null){const i=[],a=s.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)i.push(c);s.setIndex(i),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,r=[];if(e===h.TriangleFanDrawMode)for(let i=1;i<=n;i++)r.push(t.getX(0)),r.push(t.getX(i)),r.push(t.getX(i+1));else for(let i=0;i<n;i++)i%2===0?(r.push(t.getX(i)),r.push(t.getX(i+1)),r.push(t.getX(i+2))):(r.push(t.getX(i+2)),r.push(t.getX(i+1)),r.push(t.getX(i)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=s.clone();return o.setIndex(r),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}const ve=new WeakMap;class ut 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,r){const o=new h.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,i=>{this.parse(i,t,r)},n,r)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,h.SRGBColorSpace,n).catch(n)}decodeDracoFile(e,t,n,r,o=h.LinearSRGBColorSpace,i=()=>{}){const a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:o};return this.decodeGeometry(e,a).then(t).catch(i)}decodeGeometry(e,t){const n=JSON.stringify(t);if(ve.has(e)){const c=ve.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 r;const o=this.workerNextTaskID++,i=e.byteLength,a=this._getWorker(o,i).then(c=>(r=c,new Promise((d,u)=>{r._callbacks[o]={resolve:d,reject:u},r.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return a.catch(()=>!0).then(()=>{r&&o&&this._releaseTask(r,o)}),ve.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 r=e.attributes[n],o=r.name,i=r.array,a=r.itemSize,c=new h.BufferAttribute(i,a);o==="color"&&(this._assignVertexColorSpace(c,r.vertexColorSpace),c.normalized=!(i instanceof Float32Array)),t.setAttribute(o,c)}return t}_assignVertexColorSpace(e,t){if(t!==h.SRGBColorSpace)return;const n=new h.Color;for(let r=0,o=e.count;r<o;r++)n.fromBufferAttribute(e,r),h.ColorManagement.toWorkingColorSpace(n,h.SRGBColorSpace),e.setXYZ(r,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((r,o)=>{n.load(e,r,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const r=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const o=_n.toString(),i=["/* draco decoder */",r,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
3
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(o){const i=o.data;switch(i.type){case"decode":r._callbacks[i.id].resolve(i);break;case"error":r._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,o){return r._taskLoad>o._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 _n(){let s,e;onmessage=function(i){const a=i.data;switch(a.type){case"init":s=a.decoderConfig,e=new Promise(function(u){s.onModuleLoaded=function(l){u({draco:l})},DracoDecoderModule(s)});break;case"decode":const c=a.buffer,d=a.taskConfig;e.then(u=>{const l=u.draco,f=new l.Decoder;try{const p=t(l,f,new Int8Array(c),d),A=p.attributes.map(R=>R.array.buffer);p.index&&A.push(p.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:p},A)}catch(p){console.error(p),self.postMessage({type:"error",id:a.id,error:p.message})}finally{l.destroy(f)}});break}};function t(i,a,c,d){const u=d.attributeIDs,l=d.attributeTypes;let f,p;const A=a.GetEncodedGeometryType(c);if(A===i.TRIANGULAR_MESH)f=new i.Mesh,p=a.DecodeArrayToMesh(c,c.byteLength,f);else if(A===i.POINT_CLOUD)f=new i.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 R={index:null,attributes:[]};for(const v in u){const m=self[l[v]];let g,_;if(d.useUniqueIDs)_=u[v],g=a.GetAttributeByUniqueId(f,_);else{if(_=a.GetAttributeId(f,i[u[v]]),_===-1)continue;g=a.GetAttribute(f,_)}const b=r(i,a,f,v,m,g);v==="color"&&(b.vertexColorSpace=d.vertexColorSpace),R.attributes.push(b)}return A===i.TRIANGULAR_MESH&&(R.index=n(i,a,f)),i.destroy(f),R}function n(i,a,c){const u=c.num_faces()*3,l=u*4,f=i._malloc(l);a.GetTrianglesUInt32Array(c,l,f);const p=new Uint32Array(i.HEAPF32.buffer,f,u).slice();return i._free(f),{array:p,itemSize:1}}function r(i,a,c,d,u,l){const f=l.num_components(),A=c.num_points()*f,R=A*u.BYTES_PER_ELEMENT,v=o(i,u),m=i._malloc(R);a.GetAttributeDataArrayForAllPoints(c,l,v,R,m);const g=new u(i.HEAPF32.buffer,m,A).slice();return i._free(m),{name:d,array:g,itemSize:f}}function o(i,a){switch(a){case Float32Array:return i.DT_FLOAT32;case Int8Array:return i.DT_INT8;case Int16Array:return i.DT_INT16;case Int32Array:return i.DT_INT32;case Uint8Array:return i.DT_UINT8;case Uint16Array:return i.DT_UINT16;case Uint32Array:return i.DT_UINT32}}}class yn extends h.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new An(t)}),this.register(function(t){return new En(t)}),this.register(function(t){return new On(t)}),this.register(function(t){return new In(t)}),this.register(function(t){return new Nn(t)}),this.register(function(t){return new Cn(t)}),this.register(function(t){return new Sn(t)}),this.register(function(t){return new xn(t)}),this.register(function(t){return new Ln(t)}),this.register(function(t){return new vn(t)}),this.register(function(t){return new Mn(t)}),this.register(function(t){return new Rn(t)}),this.register(function(t){return new Pn(t)}),this.register(function(t){return new kn(t)}),this.register(function(t){return new Tn(t)}),this.register(function(t){return new Dn(t)}),this.register(function(t){return new Fn(t)})}load(e,t,n,r){const o=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const d=h.LoaderUtils.extractUrlBase(e);i=h.LoaderUtils.resolveURL(d,this.path)}else i=h.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(d){r?r(d):console.error(d),o.manager.itemError(e),o.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(d){try{o.parse(d,i,function(u){t(u),o.manager.itemEnd(e)},a)}catch(u){a(u)}},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,r){let o;const i={},a={},c=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===lt){try{i[S.KHR_BINARY_GLTF]=new jn(e)}catch(l){r&&r(l);return}o=JSON.parse(i[S.KHR_BINARY_GLTF].content)}else o=JSON.parse(c.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const d=new Yn(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](d);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,i[l.name]=!0}if(o.extensionsUsed)for(let u=0;u<o.extensionsUsed.length;++u){const l=o.extensionsUsed[u],f=o.extensionsRequired||[];switch(l){case S.KHR_MATERIALS_UNLIT:i[l]=new wn;break;case S.KHR_DRACO_MESH_COMPRESSION:i[l]=new Bn(o,this.dracoLoader);break;case S.KHR_TEXTURE_TRANSFORM:i[l]=new Hn;break;case S.KHR_MESH_QUANTIZATION:i[l]=new Un;break;default:f.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}d.setExtensions(i),d.setPlugins(a),d.parse(n,r)}parseAsync(e,t){const n=this;return new Promise(function(r,o){n.parse(e,t,r,o)})}}function bn(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}const S={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 Tn{constructor(e){this.parser=e,this.name=S.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){const o=t[n];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let r=t.cache.get(n);if(r)return r;const o=t.json,c=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let d;const u=new h.Color(16777215);c.color!==void 0&&u.setRGB(c.color[0],c.color[1],c.color[2],h.LinearSRGBColorSpace);const l=c.range!==void 0?c.range:0;switch(c.type){case"directional":d=new h.DirectionalLight(u),d.target.position.set(0,0,-1),d.add(d.target);break;case"point":d=new h.PointLight(u),d.distance=l;break;case"spot":d=new h.SpotLight(u),d.distance=l,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,d.angle=c.spot.outerConeAngle,d.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,d.target.position.set(0,0,-1),d.add(d.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return d.position.set(0,0,0),d.decay=2,B(d,c),c.intensity!==void 0&&(d.intensity=c.intensity),d.name=t.createUniqueName(c.name||"light_"+e),r=Promise.resolve(d),t.cache.add(n,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,o=n.json.nodes[e],a=(o.extensions&&o.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(c){return n._getNodeRef(t.cache,a,c)})}}class wn{constructor(){this.name=S.KHR_MATERIALS_UNLIT}getMaterialType(){return h.MeshBasicMaterial}extendParams(e,t,n){const r=[];e.color=new h.Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const i=o.baseColorFactor;e.color.setRGB(i[0],i[1],i[2],h.LinearSRGBColorSpace),e.opacity=i[3]}o.baseColorTexture!==void 0&&r.push(n.assignTexture(e,"map",o.baseColorTexture,h.SRGBColorSpace))}return Promise.all(r)}}class vn{constructor(e){this.parser=e,this.name=S.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=r.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class An{constructor(e){this.parser=e,this.name=S.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,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],i=r.extensions[this.name];if(i.clearcoatFactor!==void 0&&(t.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(o.push(n.assignTexture(t,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){const a=i.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new h.Vector2(a,a)}return Promise.all(o)}}class En{constructor(e){this.parser=e,this.name=S.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 r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=r.extensions[this.name];return t.dispersion=o.dispersion!==void 0?o.dispersion:0,Promise.resolve()}}class Rn{constructor(e){this.parser=e,this.name=S.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,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],i=r.extensions[this.name];return i.iridescenceFactor!==void 0&&(t.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(t.iridescenceIOR=i.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(o)}}class Cn{constructor(e){this.parser=e,this.name=S.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,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new h.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const i=r.extensions[this.name];if(i.sheenColorFactor!==void 0){const a=i.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace)}return i.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&o.push(n.assignTexture(t,"sheenColorMap",i.sheenColorTexture,h.SRGBColorSpace)),i.sheenRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(o)}}class Sn{constructor(e){this.parser=e,this.name=S.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,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],i=r.extensions[this.name];return i.transmissionFactor!==void 0&&(t.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&o.push(n.assignTexture(t,"transmissionMap",i.transmissionTexture)),Promise.all(o)}}class xn{constructor(e){this.parser=e,this.name=S.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,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],i=r.extensions[this.name];t.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&o.push(n.assignTexture(t,"thicknessMap",i.thicknessTexture)),t.attenuationDistance=i.attenuationDistance||1/0;const a=i.attenuationColor||[1,1,1];return t.attenuationColor=new h.Color().setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace),Promise.all(o)}}class Ln{constructor(e){this.parser=e,this.name=S.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 r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=r.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class Mn{constructor(e){this.parser=e,this.name=S.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,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],i=r.extensions[this.name];t.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&o.push(n.assignTexture(t,"specularIntensityMap",i.specularTexture));const a=i.specularColorFactor||[1,1,1];return t.specularColor=new h.Color().setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace),i.specularColorTexture!==void 0&&o.push(n.assignTexture(t,"specularColorMap",i.specularColorTexture,h.SRGBColorSpace)),Promise.all(o)}}class kn{constructor(e){this.parser=e,this.name=S.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,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],i=r.extensions[this.name];return t.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&o.push(n.assignTexture(t,"bumpMap",i.bumpTexture)),Promise.all(o)}}class Pn{constructor(e){this.parser=e,this.name=S.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,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],i=r.extensions[this.name];return i.anisotropyStrength!==void 0&&(t.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(t.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&o.push(n.assignTexture(t,"anisotropyMap",i.anisotropyTexture)),Promise.all(o)}}class On{constructor(e){this.parser=e,this.name=S.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const o=r.extensions[this.name],i=t.options.ktx2Loader;if(!i){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,o.source,i)}}class In{constructor(e){this.parser=e,this.name=S.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,r=n.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const i=o.extensions[t],a=r.images[i.source];let c=n.textureLoader;if(a.uri){const d=n.options.manager.getHandler(a.uri);d!==null&&(c=d)}return this.detectSupport().then(function(d){if(d)return n.loadTextureImage(e,i.source,c);if(r.extensionsRequired&&r.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 Nn{constructor(e){this.parser=e,this.name=S.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,r=n.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const i=o.extensions[t],a=r.images[i.source];let c=n.textureLoader;if(a.uri){const d=n.options.manager.getHandler(a.uri);d!==null&&(c=d)}return this.detectSupport().then(function(d){if(d)return n.loadTextureImage(e,i.source,c);if(r.extensionsRequired&&r.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 Dn{constructor(e){this.name=S.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 r=n.extensions[this.name],o=this.parser.getDependency("buffer",r.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.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 o.then(function(a){const c=r.byteOffset||0,d=r.byteLength||0,u=r.count,l=r.byteStride,f=new Uint8Array(a,c,d);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(u,l,f,r.mode,r.filter).then(function(p){return p.buffer}):i.ready.then(function(){const p=new ArrayBuffer(u*l);return i.decodeGltfBuffer(new Uint8Array(p),u,l,f,r.mode,r.filter),p})})}else return null}}class Fn{constructor(e){this.name=S.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 r=t.meshes[n.mesh];for(const d of r.primitives)if(d.mode!==O.TRIANGLES&&d.mode!==O.TRIANGLE_STRIP&&d.mode!==O.TRIANGLE_FAN&&d.mode!==void 0)return null;const i=n.extensions[this.name].attributes,a=[],c={};for(const d in i)a.push(this.parser.getDependency("accessor",i[d]).then(u=>(c[d]=u,c[d])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(d=>{const u=d.pop(),l=u.isGroup?u.children:[u],f=d[0].count,p=[];for(const A of l){const R=new h.Matrix4,v=new h.Vector3,m=new h.Quaternion,g=new h.Vector3(1,1,1),_=new h.InstancedMesh(A.geometry,A.material,f);for(let b=0;b<f;b++)c.TRANSLATION&&v.fromBufferAttribute(c.TRANSLATION,b),c.ROTATION&&m.fromBufferAttribute(c.ROTATION,b),c.SCALE&&g.fromBufferAttribute(c.SCALE,b),_.setMatrixAt(b,R.compose(v,m,g));for(const b in c)if(b==="_COLOR_0"){const T=c[b];_.instanceColor=new h.InstancedBufferAttribute(T.array,T.itemSize,T.normalized)}else b!=="TRANSLATION"&&b!=="ROTATION"&&b!=="SCALE"&&A.geometry.setAttribute(b,c[b]);h.Object3D.prototype.copy.call(_,A),this.parser.assignFinalMaterial(_),p.push(_)}return u.isGroup?(u.clear(),u.add(...p),u):p[0]}))}}const lt="glTF",re=12,Je={JSON:1313821514,BIN:5130562};class jn{constructor(e){this.name=S.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,re),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!==lt)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-re,o=new DataView(e,re);let i=0;for(;i<r;){const a=o.getUint32(i,!0);i+=4;const c=o.getUint32(i,!0);if(i+=4,c===Je.JSON){const d=new Uint8Array(e,re+i,a);this.content=n.decode(d)}else if(c===Je.BIN){const d=re+i;this.body=e.slice(d,d+a)}i+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Bn{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=S.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,r=this.dracoLoader,o=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,a={},c={},d={};for(const u in i){const l=Me[u]||u.toLowerCase();a[l]=i[u]}for(const u in e.attributes){const l=Me[u]||u.toLowerCase();if(i[u]!==void 0){const f=n.accessors[e.attributes[u]],p=Q[f.componentType];d[l]=p.name,c[l]=f.normalized===!0}}return t.getDependency("bufferView",o).then(function(u){return new Promise(function(l,f){r.decodeDracoFile(u,function(p){for(const A in p.attributes){const R=p.attributes[A],v=c[A];v!==void 0&&(R.normalized=v)}l(p)},a,d,h.LinearSRGBColorSpace,f)})})}}class Hn{constructor(){this.name=S.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 Un{constructor(){this.name=S.KHR_MESH_QUANTIZATION}}class dt extends h.Interpolant{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,o=e*r*3+r;for(let i=0;i!==r;i++)t[i]=n[o+i];return t}interpolate_(e,t,n,r){const o=this.resultBuffer,i=this.sampleValues,a=this.valueSize,c=a*2,d=a*3,u=r-t,l=(n-t)/u,f=l*l,p=f*l,A=e*d,R=A-d,v=-2*p+3*f,m=p-f,g=1-v,_=m-f+l;for(let b=0;b!==a;b++){const T=i[R+b+a],w=i[R+b+c]*u,E=i[A+b+a],x=i[A+b]*u;o[b]=g*T+_*w+v*E+m*x}return o}}const Gn=new h.Quaternion;class Wn extends dt{interpolate_(e,t,n,r){const o=super.interpolate_(e,t,n,r);return Gn.fromArray(o).normalize().toArray(o),o}}const O={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},Q={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ze={9728:h.NearestFilter,9729:h.LinearFilter,9984:h.NearestMipmapNearestFilter,9985:h.LinearMipmapNearestFilter,9986:h.NearestMipmapLinearFilter,9987:h.LinearMipmapLinearFilter},et={33071:h.ClampToEdgeWrapping,33648:h.MirroredRepeatWrapping,10497:h.RepeatWrapping},Ae={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Me={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"},H={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Kn={CUBICSPLINE:void 0,LINEAR:h.InterpolateLinear,STEP:h.InterpolateDiscrete},Ee={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function zn(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new h.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:h.FrontSide})),s.DefaultMaterial}function V(s,e,t){for(const n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function B(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function qn(s,e,t){let n=!1,r=!1,o=!1;for(let d=0,u=e.length;d<u;d++){const l=e[d];if(l.POSITION!==void 0&&(n=!0),l.NORMAL!==void 0&&(r=!0),l.COLOR_0!==void 0&&(o=!0),n&&r&&o)break}if(!n&&!r&&!o)return Promise.resolve(s);const i=[],a=[],c=[];for(let d=0,u=e.length;d<u;d++){const l=e[d];if(n){const f=l.POSITION!==void 0?t.getDependency("accessor",l.POSITION):s.attributes.position;i.push(f)}if(r){const f=l.NORMAL!==void 0?t.getDependency("accessor",l.NORMAL):s.attributes.normal;a.push(f)}if(o){const f=l.COLOR_0!==void 0?t.getDependency("accessor",l.COLOR_0):s.attributes.color;c.push(f)}}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(c)]).then(function(d){const u=d[0],l=d[1],f=d[2];return n&&(s.morphAttributes.position=u),r&&(s.morphAttributes.normal=l),o&&(s.morphAttributes.color=f),s.morphTargetsRelative=!0,s})}function Vn(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,r=t.length;n<r;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function $n(s){let e;const t=s.extensions&&s.extensions[S.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Re(t.attributes):e=s.indices+":"+Re(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,r=s.targets.length;n<r;n++)e+=":"+Re(s.targets[n]);return e}function Re(s){let e="";const t=Object.keys(s).sort();for(let n=0,r=t.length;n<r;n++)e+=t[n]+":"+s[t[n]]+";";return e}function ke(s){switch(s){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 Xn(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":s.search(/\.ktx2($|\?)/i)>0||s.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Qn=new h.Matrix4;class Yn{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new bn,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,r=-1,o=!1,i=-1;if(typeof navigator<"u"){const a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;const c=a.match(/Version\/(\d+)/);r=n&&c?parseInt(c[1],10):-1,o=a.indexOf("Firefox")>-1,i=o?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&r<17||o&&i<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,r=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(i){const a={scene:i[0][r.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:r.asset,parser:n,userData:{}};return V(o,a,r),B(a,r),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 r=0,o=t.length;r<o;r++){const i=t[r].joints;for(let a=0,c=i.length;a<c;a++)e[i[a]].isBone=!0}for(let r=0,o=e.length;r<o;r++){const i=e[r];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(n[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.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 r=n.clone(),o=(i,a)=>{const c=this.associations.get(i);c!=null&&this.associations.set(a,c);for(const[d,u]of i.children.entries())o(u,a.children[d])};return o(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const r=e(t[n]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let r=0;r<t.length;r++){const o=e(t[r]);o&&n.push(o)}return n}getDependency(e,t){const n=e+":"+t;let r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":r=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(o,i){return n.getDependency(e,i)})),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[S.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(o,i){n.load(h.LoaderUtils.resolveURL(t.uri,r.path),o,void 0,function(){i(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 r=t.byteLength||0,o=t.byteOffset||0;return n.slice(o,o+r)})}loadAccessor(e){const t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const i=Ae[r.type],a=Q[r.componentType],c=r.normalized===!0,d=new a(r.count*i);return Promise.resolve(new h.BufferAttribute(d,i,c))}const o=[];return r.bufferView!==void 0?o.push(this.getDependency("bufferView",r.bufferView)):o.push(null),r.sparse!==void 0&&(o.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(o).then(function(i){const a=i[0],c=Ae[r.type],d=Q[r.componentType],u=d.BYTES_PER_ELEMENT,l=u*c,f=r.byteOffset||0,p=r.bufferView!==void 0?n.bufferViews[r.bufferView].byteStride:void 0,A=r.normalized===!0;let R,v;if(p&&p!==l){const m=Math.floor(f/p),g="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+m+":"+r.count;let _=t.cache.get(g);_||(R=new d(a,m*p,r.count*p/u),_=new h.InterleavedBuffer(R,p/u),t.cache.add(g,_)),v=new h.InterleavedBufferAttribute(_,c,f%p/u,A)}else a===null?R=new d(r.count*c):R=new d(a,f,r.count*c),v=new h.BufferAttribute(R,c,A);if(r.sparse!==void 0){const m=Ae.SCALAR,g=Q[r.sparse.indices.componentType],_=r.sparse.indices.byteOffset||0,b=r.sparse.values.byteOffset||0,T=new g(i[1],_,r.sparse.count*m),w=new d(i[2],b,r.sparse.count*c);a!==null&&(v=new h.BufferAttribute(v.array.slice(),v.itemSize,v.normalized)),v.normalized=!1;for(let E=0,x=T.length;E<x;E++){const C=T[E];if(v.setX(C,w[E*c]),c>=2&&v.setY(C,w[E*c+1]),c>=3&&v.setZ(C,w[E*c+2]),c>=4&&v.setW(C,w[E*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}v.normalized=A}return v})}loadTexture(e){const t=this.json,n=this.options,o=t.textures[e].source,i=t.images[o];let a=this.textureLoader;if(i.uri){const c=n.manager.getHandler(i.uri);c!==null&&(a=c)}return this.loadTextureImage(e,o,a)}loadTextureImage(e,t,n){const r=this,o=this.json,i=o.textures[e],a=o.images[t],c=(a.uri||a.bufferView)+":"+i.sampler;if(this.textureCache[c])return this.textureCache[c];const d=this.loadImageSource(t,n).then(function(u){u.flipY=!1,u.name=i.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const f=(o.samplers||{})[i.sampler]||{};return u.magFilter=Ze[f.magFilter]||h.LinearFilter,u.minFilter=Ze[f.minFilter]||h.LinearMipmapLinearFilter,u.wrapS=et[f.wrapS]||h.RepeatWrapping,u.wrapT=et[f.wrapT]||h.RepeatWrapping,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==h.NearestFilter&&u.minFilter!==h.LinearFilter,r.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[c]=d,d}loadImageSource(e,t){const n=this,r=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(l=>l.clone());const i=r.images[e],a=self.URL||self.webkitURL;let c=i.uri||"",d=!1;if(i.bufferView!==void 0)c=n.getDependency("bufferView",i.bufferView).then(function(l){d=!0;const f=new Blob([l],{type:i.mimeType});return c=a.createObjectURL(f),c});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(c).then(function(l){return new Promise(function(f,p){let A=f;t.isImageBitmapLoader===!0&&(A=function(R){const v=new h.Texture(R);v.needsUpdate=!0,f(v)}),t.load(h.LoaderUtils.resolveURL(l,o.path),A,void 0,p)})}).then(function(l){return d===!0&&a.revokeObjectURL(c),B(l,i),l.userData.mimeType=i.mimeType||Xn(i.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),l});return this.sourceCache[e]=u,u}assignTexture(e,t,n,r){const o=this;return this.getDependency("texture",n.index).then(function(i){if(!i)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(i=i.clone(),i.channel=n.texCoord),o.extensions[S.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[S.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const c=o.associations.get(i);i=o.extensions[S.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),o.associations.set(i,c)}}return r!==void 0&&(i.colorSpace=r),e[t]=i,i})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const r=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,i=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(r||o||i){let a="ClonedMaterial:"+n.uuid+":";r&&(a+="derivative-tangents:"),o&&(a+="vertex-colors:"),i&&(a+="flat-shading:");let c=this.cache.get(a);c||(c=n.clone(),o&&(c.vertexColors=!0),i&&(c.flatShading=!0),r&&(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,r=this.extensions,o=n.materials[e];let i;const a={},c=o.extensions||{},d=[];if(c[S.KHR_MATERIALS_UNLIT]){const l=r[S.KHR_MATERIALS_UNLIT];i=l.getMaterialType(),d.push(l.extendParams(a,o,t))}else{const l=o.pbrMetallicRoughness||{};if(a.color=new h.Color(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const f=l.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],h.LinearSRGBColorSpace),a.opacity=f[3]}l.baseColorTexture!==void 0&&d.push(t.assignTexture(a,"map",l.baseColorTexture,h.SRGBColorSpace)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(d.push(t.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),d.push(t.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),i=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}o.doubleSided===!0&&(a.side=h.DoubleSide);const u=o.alphaMode||Ee.OPAQUE;if(u===Ee.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===Ee.MASK&&(a.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&i!==h.MeshBasicMaterial&&(d.push(t.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new h.Vector2(1,1),o.normalTexture.scale!==void 0)){const l=o.normalTexture.scale;a.normalScale.set(l,l)}if(o.occlusionTexture!==void 0&&i!==h.MeshBasicMaterial&&(d.push(t.assignTexture(a,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&i!==h.MeshBasicMaterial){const l=o.emissiveFactor;a.emissive=new h.Color().setRGB(l[0],l[1],l[2],h.LinearSRGBColorSpace)}return o.emissiveTexture!==void 0&&i!==h.MeshBasicMaterial&&d.push(t.assignTexture(a,"emissiveMap",o.emissiveTexture,h.SRGBColorSpace)),Promise.all(d).then(function(){const l=new i(a);return o.name&&(l.name=o.name),B(l,o),t.associations.set(l,{materials:e}),o.extensions&&V(r,l,o),l})}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,r=this.primitiveCache;function o(a){return n[S.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(c){return tt(c,a,t)})}const i=[];for(let a=0,c=e.length;a<c;a++){const d=e[a],u=$n(d),l=r[u];if(l)i.push(l.promise);else{let f;d.extensions&&d.extensions[S.KHR_DRACO_MESH_COMPRESSION]?f=o(d):f=tt(new h.BufferGeometry,d,t),r[u]={primitive:d,promise:f},i.push(f)}}return Promise.all(i)}loadMesh(e){const t=this,n=this.json,r=this.extensions,o=n.meshes[e],i=o.primitives,a=[];for(let c=0,d=i.length;c<d;c++){const u=i[c].material===void 0?zn(this.cache):this.getDependency("material",i[c].material);a.push(u)}return a.push(t.loadGeometries(i)),Promise.all(a).then(function(c){const d=c.slice(0,c.length-1),u=c[c.length-1],l=[];for(let p=0,A=u.length;p<A;p++){const R=u[p],v=i[p];let m;const g=d[p];if(v.mode===O.TRIANGLES||v.mode===O.TRIANGLE_STRIP||v.mode===O.TRIANGLE_FAN||v.mode===void 0)m=o.isSkinnedMesh===!0?new h.SkinnedMesh(R,g):new h.Mesh(R,g),m.isSkinnedMesh===!0&&m.normalizeSkinWeights(),v.mode===O.TRIANGLE_STRIP?m.geometry=Ye(m.geometry,h.TriangleStripDrawMode):v.mode===O.TRIANGLE_FAN&&(m.geometry=Ye(m.geometry,h.TriangleFanDrawMode));else if(v.mode===O.LINES)m=new h.LineSegments(R,g);else if(v.mode===O.LINE_STRIP)m=new h.Line(R,g);else if(v.mode===O.LINE_LOOP)m=new h.LineLoop(R,g);else if(v.mode===O.POINTS)m=new h.Points(R,g);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+v.mode);Object.keys(m.geometry.morphAttributes).length>0&&Vn(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),B(m,o),v.extensions&&V(r,m,v),t.assignFinalMaterial(m),l.push(m)}for(let p=0,A=l.length;p<A;p++)t.associations.set(l[p],{meshes:e,primitives:p});if(l.length===1)return o.extensions&&V(r,l[0],o),l[0];const f=new h.Group;o.extensions&&V(r,f,o),t.associations.set(f,{meshes:e});for(let p=0,A=l.length;p<A;p++)f.add(l[p]);return f})}loadCamera(e){let t;const n=this.json.cameras[e],r=n[n.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new h.PerspectiveCamera(h.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type==="orthographic"&&(t=new h.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),B(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let r=0,o=t.joints.length;r<o;r++)n.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(r){const o=r.pop(),i=r,a=[],c=[];for(let d=0,u=i.length;d<u;d++){const l=i[d];if(l){a.push(l);const f=new h.Matrix4;o!==null&&f.fromArray(o.array,d*16),c.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[d])}return new h.Skeleton(a,c)})}loadAnimation(e){const t=this.json,n=this,r=t.animations[e],o=r.name?r.name:"animation_"+e,i=[],a=[],c=[],d=[],u=[];for(let l=0,f=r.channels.length;l<f;l++){const p=r.channels[l],A=r.samplers[p.sampler],R=p.target,v=R.node,m=r.parameters!==void 0?r.parameters[A.input]:A.input,g=r.parameters!==void 0?r.parameters[A.output]:A.output;R.node!==void 0&&(i.push(this.getDependency("node",v)),a.push(this.getDependency("accessor",m)),c.push(this.getDependency("accessor",g)),d.push(A),u.push(R))}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(c),Promise.all(d),Promise.all(u)]).then(function(l){const f=l[0],p=l[1],A=l[2],R=l[3],v=l[4],m=[];for(let g=0,_=f.length;g<_;g++){const b=f[g],T=p[g],w=A[g],E=R[g],x=v[g];if(b===void 0)continue;b.updateMatrix&&b.updateMatrix();const C=n._createAnimationTracks(b,T,w,E,x);if(C)for(let M=0;M<C.length;M++)m.push(C[M])}return new h.AnimationClip(o,void 0,m)})}createNodeMesh(e){const t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency("mesh",r.mesh).then(function(o){const i=n._getNodeRef(n.meshCache,r.mesh,o);return r.weights!==void 0&&i.traverse(function(a){if(a.isMesh)for(let c=0,d=r.weights.length;c<d;c++)a.morphTargetInfluences[c]=r.weights[c]}),i})}loadNode(e){const t=this.json,n=this,r=t.nodes[e],o=n._loadNodeShallow(e),i=[],a=r.children||[];for(let d=0,u=a.length;d<u;d++)i.push(n.getDependency("node",a[d]));const c=r.skin===void 0?Promise.resolve(null):n.getDependency("skin",r.skin);return Promise.all([o,Promise.all(i),c]).then(function(d){const u=d[0],l=d[1],f=d[2];f!==null&&u.traverse(function(p){p.isSkinnedMesh&&p.bind(f,Qn)});for(let p=0,A=l.length;p<A;p++)u.add(l[p]);return u})}_loadNodeShallow(e){const t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],i=o.name?r.createUniqueName(o.name):"",a=[],c=r._invokeOne(function(d){return d.createNodeMesh&&d.createNodeMesh(e)});return c&&a.push(c),o.camera!==void 0&&a.push(r.getDependency("camera",o.camera).then(function(d){return r._getNodeRef(r.cameraCache,o.camera,d)})),r._invokeAll(function(d){return d.createNodeAttachment&&d.createNodeAttachment(e)}).forEach(function(d){a.push(d)}),this.nodeCache[e]=Promise.all(a).then(function(d){let u;if(o.isBone===!0?u=new h.Bone:d.length>1?u=new h.Group:d.length===1?u=d[0]:u=new h.Object3D,u!==d[0])for(let l=0,f=d.length;l<f;l++)u.add(d[l]);if(o.name&&(u.userData.name=o.name,u.name=i),B(u,o),o.extensions&&V(n,u,o),o.matrix!==void 0){const l=new h.Matrix4;l.fromArray(o.matrix),u.applyMatrix4(l)}else o.translation!==void 0&&u.position.fromArray(o.translation),o.rotation!==void 0&&u.quaternion.fromArray(o.rotation),o.scale!==void 0&&u.scale.fromArray(o.scale);return r.associations.has(u)||r.associations.set(u,{}),r.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],r=this,o=new h.Group;n.name&&(o.name=r.createUniqueName(n.name)),B(o,n),n.extensions&&V(t,o,n);const i=n.nodes||[],a=[];for(let c=0,d=i.length;c<d;c++)a.push(r.getDependency("node",i[c]));return Promise.all(a).then(function(c){for(let u=0,l=c.length;u<l;u++)o.add(c[u]);const d=u=>{const l=new Map;for(const[f,p]of r.associations)(f instanceof h.Material||f instanceof h.Texture)&&l.set(f,p);return u.traverse(f=>{const p=r.associations.get(f);p!=null&&l.set(f,p)}),l};return r.associations=d(o),o})}_createAnimationTracks(e,t,n,r,o){const i=[],a=e.name?e.name:e.uuid,c=[];H[o.path]===H.weights?e.traverse(function(f){f.morphTargetInfluences&&c.push(f.name?f.name:f.uuid)}):c.push(a);let d;switch(H[o.path]){case H.weights:d=h.NumberKeyframeTrack;break;case H.rotation:d=h.QuaternionKeyframeTrack;break;case H.position:case H.scale:d=h.VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:d=h.NumberKeyframeTrack;break;case 2:case 3:default:d=h.VectorKeyframeTrack;break}break}const u=r.interpolation!==void 0?Kn[r.interpolation]:h.InterpolateLinear,l=this._getArrayFromAccessor(n);for(let f=0,p=c.length;f<p;f++){const A=new d(c[f]+"."+H[o.path],t.array,l,u);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(A),i.push(A)}return i}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=ke(t.constructor),r=new Float32Array(t.length);for(let o=0,i=t.length;o<i;o++)r[o]=t[o]*n;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const r=this instanceof h.QuaternionKeyframeTrack?Wn:dt;return new r(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Jn(s,e,t){const n=e.attributes,r=new h.Box3;if(n.POSITION!==void 0){const a=t.json.accessors[n.POSITION],c=a.min,d=a.max;if(c!==void 0&&d!==void 0){if(r.set(new h.Vector3(c[0],c[1],c[2]),new h.Vector3(d[0],d[1],d[2])),a.normalized){const u=ke(Q[a.componentType]);r.min.multiplyScalar(u),r.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const a=new h.Vector3,c=new h.Vector3;for(let d=0,u=o.length;d<u;d++){const l=o[d];if(l.POSITION!==void 0){const f=t.json.accessors[l.POSITION],p=f.min,A=f.max;if(p!==void 0&&A!==void 0){if(c.setX(Math.max(Math.abs(p[0]),Math.abs(A[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(A[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(A[2]))),f.normalized){const R=ke(Q[f.componentType]);c.multiplyScalar(R)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(a)}s.boundingBox=r;const i=new h.Sphere;r.getCenter(i.center),i.radius=r.min.distanceTo(r.max)/2,s.boundingSphere=i}function tt(s,e,t){const n=e.attributes,r=[];function o(i,a){return t.getDependency("accessor",i).then(function(c){s.setAttribute(a,c)})}for(const i in n){const a=Me[i]||i.toLowerCase();a in s.attributes||r.push(o(n[i],a))}if(e.indices!==void 0&&!s.index){const i=t.getDependency("accessor",e.indices).then(function(a){s.setIndex(a)});r.push(i)}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.`),B(s,e),Jn(s,e,t),Promise.all(r).then(function(){return e.targets!==void 0?qn(s,e.targets,t):s})}var Zn=Object.defineProperty,er=Object.getOwnPropertyDescriptor,tr=(s,e,t,n)=>{for(var r=n>1?void 0:n?er(e,t):e,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Zn(e,t,r),r};let le=class{constructor(){L(this,"loadingManager",new h.LoadingManager);L(this,"loaders",{});L(this,"sources",[]);L(this,"loadedResources",{});L(this,"toLoadCount",0);L(this,"loadedCount",0)}get videoLoader(){return{load:(s,e)=>{const t=document.createElement("video");t.muted=!0,t.loop=!0,t.crossOrigin="anonymous",t.controls=!1,t.playsInline=!0,t.src=s,t.autoplay=!0;const n=async()=>{e(t),t.removeEventListener("canplaythrough",n)};t.addEventListener("canplaythrough",n)}}}_initLoaders(){this.loaders.dracoLoader=new ut(this.loadingManager),this.loaders.audioLoader=new h.AudioLoader(this.loadingManager),this.loaders.fontLoader=new y.FontLoader(this.loadingManager),this.loaders.gltfLoader=new yn(this.loadingManager),this.loaders.imageLoader=new h.ImageBitmapLoader(this.loadingManager),this.loaders.videoLoader=this.videoLoader}_initSources(s){this.sources=s,this.toLoadCount=this.sources.length,this.loadedCount=0}init(s=[]){this._initLoaders(),this._initSources(s)}setDracoDecoder(s){var e;this.loaders.dracoLoader&&(this.loaders.dracoLoader.setDecoderPath(s??"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),(e=this.loaders.gltfLoader)==null||e.setDRACOLoader(this.loaders.dracoLoader))}handleLoad({source:s,resource:e,toLoadCount:t,loadedCount:n}){e&&(this.loadedResources[s.name]=e,this.loadedCount=n,this.toLoadCount=t)}launchLoad(s){var t,n,r,o,i;const e=this.sources[0];if(e){s==null||s(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=>s==null?void 0:s(a,c))),a.type==="audio"&&((n=this.loaders.audioLoader)==null||n.load(a.path,c=>s==null?void 0:s(a,c))),a.type==="image"&&((r=this.loaders.imageLoader)==null||r.load(a.path,c=>s==null?void 0:s(a,c))),a.type==="video"&&((o=this.loaders.videoLoader)==null||o.load(a.path,c=>s==null?void 0:s(a,c))),a.type==="font"&&((i=this.loaders.fontLoader)==null||i.load(a.path,c=>s==null?void 0:s(a,c)))}}}};le=tr([y.scoped(y.Lifecycle.ContainerScoped)],le);var nr=Object.defineProperty,rr=Object.getOwnPropertyDescriptor,sr=(s,e,t,n)=>{for(var r=n>1?void 0:n?rr(e,t):e,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&nr(e,t,r),r},ir=(s,e)=>(t,n)=>e(t,n,s);let de=class{constructor(s){L(this,"load$$",new y.Subject);L(this,"load$",this.load$$.pipe(y.map(s=>({...s,loadedCount:s.resource?this._service.loadedCount+1:this._service.loadedCount,toLoadCount:this._service.toLoadCount})),y.share()));L(this,"serializedLoad$",this.load$.pipe(y.map(s=>{var t,n,r;let e=s.resource;if((t=s==null?void 0:s.resource)!=null&&t.parser){const o=s.resource,i=o.scenes.map(a=>y.g(a));e={animations:(s==null?void 0:s.resource).animations.map(a=>a.toJSON()),cameras:o.cameras.map(a=>y.g(a)),parser:{json:o.parser.json},scene:i==null?void 0:i[0],scenes:i,userData:o.userData}}return((n=s==null?void 0:s.source)==null?void 0:n.type)==="audio"&&s.resource instanceof AudioBuffer&&(e={arrayBuffer:s.resource.getChannelData(0),length:s.resource.length,sampleRate:s.resource.sampleRate,duration:s.resource.duration}),((r=s==null?void 0:s.source)==null?void 0:r.type)==="video"&&s.resource instanceof HTMLVideoElement&&(e={...y.R(s.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:s.resource.buffered.length,error:s.resource.error?y.E(s.resource.error,[]):{},played:s.resource.played.length,seekable:s.resource.seekable.length,textTracks:s.resource.textTracks.length}),{...s,resource:e}}),y.share()));L(this,"loadCompleted$",this.load$.pipe(y.filter(s=>s.toLoadCount===s.loadedCount),y.map(()=>y.R(this._service,["loadedCount","loadedResources","toLoadCount"])),y.share()));this._service=s}};de=sr([y.scoped(y.Lifecycle.ContainerScoped),ir(0,y.inject(le))],de);var or=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,cr=(s,e,t,n)=>{for(var r=n>1?void 0:n?ar(e,t):e,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&or(e,t,r),r},Ce=(s,e)=>(t,n)=>e(t,n,s);let Pe=class{constructor(s,e,t){L(this,"_subscriptions",[]);this._controller=s,this._service=e,this._props=t,this._subscriptions.push(this._controller.load$.subscribe(this._service.handleLoad.bind(this._service)))}init(s){this._service.init(s.sources||[]),this._service.setDracoDecoder(s.dracoDecoderPath),[void 0,!0].includes(this._props.loadResourcesOnInit)&&this.load()}load(){this._service.launchLoad((s,e)=>this._controller.load$$.next({source:s,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(s){this._service.setDracoDecoder(s)}dispose(){this._subscriptions.forEach(s=>s.unsubscribe()),Object.keys(this._service.loaders).forEach(s=>{const e=this._service.loaders[s];e instanceof ut&&e.dispose(),this._service.loaders[s]=void 0}),this._controller.load$$.complete()}};Pe=cr([y.scoped(y.Lifecycle.ContainerScoped),Ce(0,y.inject(de)),Ce(1,y.inject(le)),Ce(2,y.inject(se))],Pe);var ur=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,dr=(s,e,t,n)=>{for(var r=n>1?void 0:n?lr(e,t):e,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&ur(e,t,r),r},X=(s,e)=>(t,n)=>e(t,n,s);exports.RegisterModule=class extends y.RegisterProxyEventHandlersBlueprint{constructor(t,n,r,o,i,a){super();L(this,"_subscriptions",[]);L(this,"_initialized",!1);this._service=t,this._controller=n,this._loaderController=r,this.container=o,this.props=i,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:
4
+ ${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:{...y.E(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(){y.PROXY_EVENT_LISTENERS.forEach(t=>this[`${t}$`]=()=>{var n;return(n=this._controller)==null?void 0:n[`${t}$`]})}async _initLoader(){this.loader.init({sources:this.props.loaderDataSources,dracoDecoderPath:this.props.loaderDracoDecoderPath}),this._subscriptions.push(this._loaderController.serializedLoad$.subscribe(t=>{var n,r;if(t.resource instanceof ArrayBuffer)return(n=this._service.worker)==null?void 0:n.postMessage(t.resource,[t.resource]);(r=this._service.worker)==null||r.postMessage({token:y.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=dr([y.scoped(y.Lifecycle.ContainerScoped),X(0,y.inject(ue)),X(1,y.inject(Le)),X(2,y.inject(de)),X(3,y.inject(y.CONTAINER_TOKEN)),X(4,y.inject(se)),X(5,y.inject(Pe))],exports.RegisterModule);const fr=s=>{if(!(s!=null&&s.location)||!URL.canParse(s.location))throw new Error("Invalid register props detected. location path is required");const e=y.instance.createChildContainer();s.initOnConstruct=y.x(s.initOnConstruct)||!y.N(s.initOnConstruct)?!0:s.initOnConstruct,s.defaultCamera=s!=null&&s.defaultCamera&&s.defaultCamera in y.DefaultCameraType?s.defaultCamera:y.DefaultCameraType.PERSPECTIVE,s.withMiniCamera=y.x(s.withMiniCamera)||!y.N(s.withMiniCamera)?!1:s.withMiniCamera,s.startTimer=y.x(s.startTimer)||!y.N(s.startTimer)?!0:s.startTimer,s.fullScreen=y.x(s.fullScreen)||!y.N(s.fullScreen)?!0:s.fullScreen,s.onReady=y.P(s.onReady)?s.onReady:void 0,e.register(y.CONTAINER_TOKEN,{useValue:e}),e.register(se,{useValue:s});const t=e.resolve(exports.RegisterModule);return{container:e,module:t}};exports.AppProxyEventHandlersBlueprint=y.AppProxyEventHandlersBlueprint;exports.CONTAINER_TOKEN=y.CONTAINER_TOKEN;exports.DefaultCameraType=y.DefaultCameraType;exports.KEYBOARD_EVENT_CODES=y.KEYBOARD_EVENT_CODES;exports.LOADER_SERIALIZED_LOAD_TOKEN=y.LOADER_SERIALIZED_LOAD_TOKEN;exports.PROXY_EVENT_LISTENERS=y.PROXY_EVENT_LISTENERS;exports.ProxyEventHandlersBlueprint=y.ProxyEventHandlersBlueprint;exports.ProxyEventObservablesBlueprint=y.ProxyEventObservablesBlueprint;exports.ProxyEventSubjectsBlueprint=y.ProxyEventSubjectsBlueprint;exports.RegisterProxyEventHandlersBlueprint=y.RegisterProxyEventHandlersBlueprint;exports.LaunchAppProps=pt;exports.RegisterPropsBlueprint=se;exports.register=fr;