diff --git a/src/lib/aframe-loader-3dtiles-component.min.js b/src/lib/aframe-loader-3dtiles-component.min.js index b483d8202..286ca52d1 100644 --- a/src/lib/aframe-loader-3dtiles-component.min.js +++ b/src/lib/aframe-loader-3dtiles-component.min.js @@ -1,5 +1,5 @@ /*! For license information please see aframe-loader-3dtiles-component.min.js.LICENSE.txt */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("THREE"));else if("function"==typeof define&&define.amd)define(["THREE"],e);else{var n="object"==typeof exports?e(require("THREE")):e(t.THREE);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(t=>(()=>{var e={384:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("textarea",{schema:{transparentBG:{type:"boolean",default:!1},cols:{type:"int",default:40},rows:{type:"int",default:20},color:{type:"color",default:"black"},backgroundColor:{type:"color",default:"white"},disabledBackgroundColor:{type:"color",default:"lightgrey"},disabled:{type:"boolean",default:!1},text:{type:"string",default:""}},init:function(){this.text=null,this.lines=[],this.lastBlink=0,this.blinkEnabled=!this.data.disabled,this.charWidth=this.charHeight=null,this.selectionStart=this.selectionEnd=0,this.endIndexInfo=this.startIndexInfo=null,this.origin={x:0,y:0},this.background=document.createElement("a-plane"),this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor),this.el.appendChild(this.background),this.data.transparentBG&&this.background.setAttribute("material",{opacity:0,transparent:!0}),this.textAnchor=document.createElement("a-entity"),this.el.appendChild(this.textAnchor),this.textAnchor.setAttribute("text",{mode:"pre",baseline:"top",anchor:"center",font:"dejavu",wrapCount:this.data.cols,height:this.data.rows,color:this.data.color}),this._initTextarea(),this.el.addEventListener("textfontset",this._updateCharMetrics.bind(this)),this.el.addEventListener("char-metrics-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("text-changed",this._updateLines.bind(this)),this.el.addEventListener("text-changed",this._updateDisplayText.bind(this)),this.el.addEventListener("selection-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("selection-changed",this._updateHorizontalOrigin.bind(this)),this.el.addEventListener("lines-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("index-info-changed",this._updateOrigin.bind(this)),this.el.addEventListener("index-info-changed",this._updateHorizontalOrigin.bind(this)),this.el.addEventListener("origin-changed",this._updateDisplayText.bind(this)),this.el.addEventListener("click",this.focus.bind(this))},update:function(t){this.data.text!==t.text&&this._updateTextarea(),this.data.backgroundColor===t.backgroundColor&&this.data.disabledBackgroundColor===t.disabledBackgroundColor||this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor),this.data.disabled!==t.disabled&&(this.blinkEnabled=!this.data.disabled,this.textarea.disabled=this.data.disabled,this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor))},focus:function(){this.textarea.focus()},_initTextarea:function(){this.textarea=document.createElement("textarea"),document.body.appendChild(this.textarea),this._updateTextarea()},_updateTextarea:function(){this.textarea.style.whiteSpace="pre",this.textarea.style.overflow="hidden",this.textarea.style.opacity="0",this.textarea.cols=this.data.cols,this.textarea.rows=this.data.rows,this.textarea.value=this.data.text,this.textarea.selectionStart=0,this.textarea.selectionEnd=0,this._updateIndexInfo()},_emit:function(t,e){this.el.emit(t,e)},_updateCharMetrics:function(t){const e=this.textAnchor.components.text.geometry.layout,n=t.detail.fontObj.widthFactor;this.charWidth=n*this.textAnchor.object3DMap.text.scale.x,this.charHeight=this.charWidth*e.lineHeight/n,this.textAnchor.setAttribute("position",{x:0,y:this.charHeight*this.data.rows/2,z:0}),this.data.transparentBG||(this.background.setAttribute("scale",{x:1.05,y:this.charHeight*this.data.rows*1.05,z:1}),this.background.setAttribute("position",{x:0,y:0,z:0})),this._emit("char-metrics-changed")},_checkAndUpdateSelection:function(){if(this.selectionStart===this.textarea.selectionStart&&this.selectionEnd===this.textarea.selectionEnd)return;const t=this.selectionStart,e=this.selectionEnd;this.selectionStart=this.textarea.selectionStart,this.selectionEnd=this.textarea.selectionEnd,this._emit("selection-changed",{start:{old:t,new:this.selectionStart,changed:this.selectionStart!==t},end:{old:e,new:this.selectionEnd,changed:this.selectionEnd!==e}})},tick:function(t){t-this.lastBlink>500&&this.blinkEnabled&&(this.lastBlink=t),this._checkAndUpdateSelection(),this._checkAndUpdateText()},_getIndexInfo:function(t,e){const n=Math.max(0,t),r=this.lines[n];return{line:r,x:(e-r.start)*this.charWidth,y:-this.charHeight*n+-this.charHeight/2}},_updateIndexInfo:function(){if(!this.lines.length)return;const t=this.startIndexInfo&&this.startIndexInfo.line.index,e=this.endIndexInfo&&this.endIndexInfo.line.index;let n;this.startIndexInfo=null,this.endIndexInfo=null;let r=!1,i=!1;for(n=0;n<=this.lines.length;n++){const s=this.lines[n-1],o=n===this.lines.length?s.start+s.length+1:this.lines[n].start;if(o>this.selectionStart&&!this.startIndexInfo&&(this.startIndexInfo=this._getIndexInfo(n-1,this.selectionStart),this.startIndexInfo.line.index!==t&&(r=!0)),o>this.selectionEnd){this.endIndexInfo=this._getIndexInfo(n-1,this.selectionEnd),this.endIndexInfo.line.index!==e&&(i=!0);break}}(r||i)&&this._emit("index-info-changed",{start:{changed:r},end:{changed:i}})},_updateOrigin:function(t){let e=!1;if(t.detail.end.changed){const t=this.origin.y+this.data.rows-1;this.endIndexInfo.line.index>t?(this.origin.y=this.endIndexInfo.line.index+1-this.data.rows,e=!0):this.endIndexInfo.line.indexthis.origin.x+this.data.cols?(this.origin.x=t-this.data.cols,e=!0):tthis.origin.x+this.data.cols?(this.origin.x=n-this.data.cols,e=!0):n{"use strict";e.exports=t}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var s=n[t]={exports:{}};return e[t](s,s.exports,r),s.exports}r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i);var t=r(824),e=Object.defineProperty,n=(t,n,r)=>(((t,n,r)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r})(t,"symbol"!=typeof n?n+"":n,r),r);async function s(t,e,n,r){return r._parse(t,e,n,r)}function o(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const a=!("object"==typeof process&&"[object process]"===String(process)&&!process.browser),c=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);function h(t,e){return l(t||{},e)}function l(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(n>3)return e;const r={...t};for(const[t,i]of Object.entries(e))i&&"object"==typeof i&&!Array.isArray(i)?r[t]=l(r[t]||{},e[t],n+1):r[t]=e[t];return r}c&&parseFloat(c[1]);const u="latest",d=(null!==(f=globalThis._loadersgl_)&&void 0!==f&&f.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.1"),globalThis._loadersgl_.version);var f;function m(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const p="object"!=typeof process||"[object process]"!==String(process)||process.browser,g="function"==typeof importScripts,A=typeof window<"u"&&typeof window.orientation<"u",y=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);y&&parseFloat(y[1]);class B{constructor(t,e){this.name=void 0,this.workerThread=void 0,this.isRunning=!0,this.result=void 0,this._resolve=()=>{},this._reject=()=>{},this.name=t,this.workerThread=e,this.result=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){m(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){m(this.isRunning),this.isRunning=!1,this._reject(t)}}class b{terminate(){}}const C=new Map;function w(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function E(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0;const r=n||new Set;if(t)if(v(t))r.add(t);else if(v(t.buffer))r.add(t.buffer);else if(!ArrayBuffer.isView(t)&&e&&"object"==typeof t)for(const n in t)E(t[n],e,r);return void 0===n?Array.from(r):[]}function v(t){return!!t&&(t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)}const T=()=>{};class _{static isSupported(){return typeof Worker<"u"&&p||typeof b<"u"&&!p}constructor(t){this.name=void 0,this.source=void 0,this.url=void 0,this.terminated=!1,this.worker=void 0,this.onMessage=void 0,this.onError=void 0,this._loadableURL="";const{name:e,source:n,url:r}=t;m(n||r),this.name=e,this.source=n,this.url=r,this.onMessage=T,this.onError=t=>console.log(t),this.worker=p?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=T,this.onError=T,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(t,e){e=e||E(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name} from ${this.url}. `,t.message&&(e+=`${t.message} in `),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=function(t){m(t.source&&!t.url||!t.source&&t.url);let e=C.get(t.source||t.url);return e||(t.url&&(e=function(t){return t.startsWith("http")?w(function(t){return`try {\n importScripts('${t}');\n} catch (error) {\n console.error(error);\n throw error;\n}`}(t)):t}(t.url),C.set(t.url,e)),t.source&&(e=w(t.source),C.set(t.source,e))),m(e),e}({source:this.source,url:this.url});const t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},t.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},t.onmessageerror=t=>console.error(t),t}_createNodeWorker(){let t;if(this.url){const e=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new b(e,{eval:!1})}else{if(!this.source)throw new Error("no worker");t=new b(this.source,{eval:!0})}return t.on("message",(t=>{this.onMessage(t)})),t.on("error",(t=>{this.onError(t)})),t.on("exit",(t=>{})),t}}class x{static isSupported(){return _.isSupported()}constructor(t){this.name="unnamed",this.source=void 0,this.url=void 0,this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1,this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach((t=>t.destroy())),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},void 0!==t.name&&(this.name=t.name),void 0!==t.maxConcurrency&&(this.maxConcurrency=t.maxConcurrency),void 0!==t.maxMobileConcurrency&&(this.maxMobileConcurrency=t.maxMobileConcurrency),void 0!==t.reuseWorkers&&(this.reuseWorkers=t.reuseWorkers),void 0!==t.onDebug&&(this.onDebug=t.onDebug)}async startJob(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(t,e,n)=>t.done(n),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(t,e)=>t.error(e);const r=new Promise((r=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:r}),this)));return this._startQueuedJob(),await r}async _startQueuedJob(){if(!this.jobQueue.length)return;const t=this._getAvailableWorker();if(!t)return;const e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});const n=new B(e.name,t);t.onMessage=t=>e.onMessage(n,t.type,t.payload),t.onError=t=>e.onError(n,t),e.onStart(n);try{await n.result}catch(t){console.error(`Worker exception: ${t}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!p||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}};class I{static isSupported(){return _.isSupported()}static getWorkerFarm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return I._workerFarm=I._workerFarm||new I({}),I._workerFarm.setProps(t),I._workerFarm}constructor(t){this.props=void 0,this.workerPools=new Map,this.props={...M},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:n,url:r}=t;let i=this.workerPools.get(e);return i||(i=new x({name:e,source:n,url:r}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}I._workerFarm=void 0;const S=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})),R={};async function O(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return e&&(t=F(t,e,n,r)),R[t]=R[t]||D(t),await R[t]}function F(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!n.useLocalLibraries&&t.startsWith("http"))return t;r=r||t;const i=n.modules||{};return i[r]?i[r]:p?n.CDN?(m(n.CDN.startsWith("http")),`${n.CDN}/${e}@${d}/dist/libs/${r}`):g?`../src/libs/${r}`:`modules/${e}/src/libs/${r}`:`modules/${e}/dist/libs/${r}`}async function D(t){if(t.endsWith("wasm"))return await async function(t){return await(await fetch(t)).arrayBuffer()}(t);if(!p)try{return S&&void 0}catch(t){return console.error(t),null}if(g)return importScripts(t);const e=await async function(t){return await(await fetch(t)).text()}(t);return function(t,e){if(!p)return;if(g)return eval.call(globalThis,t),null;const n=document.createElement("script");n.id=e;try{n.appendChild(document.createTextNode(t))}catch{n.text=t}return document.body.appendChild(n),null}(e,t)}async function G(t,e,n,r,i){const s=t.id,o=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e[t.id]||{},r=p?`${t.id}-worker.js`:`${t.id}-worker-node.js`;let i=n.workerUrl;if(!i&&"compression"===t.id&&(i=e.workerUrl),"test"===e._workerType&&(i=p?`modules/${t.module}/dist/${r}`:`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!i){let e=t.version;"latest"===e&&(e=u);const n=e?`@${e}`:"";i=`https://unpkg.com/@loaders.gl/${t.module}${n}/dist/${r}`}return m(i),i}(t,n),a=I.getWorkerFarm(n).getWorkerPool({name:s,url:o});n=JSON.parse(JSON.stringify(n)),r=JSON.parse(JSON.stringify(r||{}));const c=await a.startJob("process-on-worker",L.bind(null,i));return c.postMessage("process",{input:e,options:n,context:r}),await(await c.result).result}async function L(t,e,n,r){switch(n){case"done":e.done(r);break;case"error":e.error(new Error(r.error));break;case"process":const{id:i,input:s,options:o}=r;try{const n=await t(s,o);e.postMessage("done",{id:i,result:n})}catch(t){const n=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:i,error:n})}break;default:console.warn(`parse-with-worker unknown message ${n}`)}}function U(t,e,n){if(t.byteLength<=e+n)return"";const r=new DataView(t);let i="";for(let t=0;tt instanceof ArrayBuffer?new Uint8Array(t):t)),n=e.reduce(((t,e)=>t+e.byteLength),0),r=new Uint8Array(n);let i=0;for(const t of e)r.set(t,i),i+=t.byteLength;return r.buffer}function P(t,e,n){const r=void 0!==n?new Uint8Array(t).subarray(e,e+n):new Uint8Array(t).subarray(e);return new Uint8Array(r).buffer}function H(t,e){return o(t>=0),o(e>0),t+(e-1)&~(e-1)}function J(t,e,n){let r;if(t instanceof ArrayBuffer)r=new Uint8Array(t);else{const e=t.byteOffset,n=t.byteLength;r=new Uint8Array(t.buffer||t.arrayBuffer,e,n)}return e.set(r,n),n+H(r.byteLength,4)}function j(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){const e=process.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}class k{constructor(t,e){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=j(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(j()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class V{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t of Object.values(this.stats))t.reset();return this}forEach(t){for(const e of Object.values(this.stats))t(e)}getTable(){const t={};return this.forEach((e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}})),t}_initializeStats(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((t=>this._getOrCreate(t)))}_getOrCreate(t){const{name:e,type:n}=t;let r=this.stats[e];return r||(r=t instanceof k?t:new k(e,n),this.stats[e]=r),r}}const K={};function Q(t){if(function(t){return t&&"object"==typeof t&&t.isBuffer}(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return 0===t.byteOffset&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if("string"==typeof t){const e=t;return(new TextEncoder).encode(e).buffer}if(t&&"object"==typeof t&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}function z(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();const e=null===(t=window.location)||void 0===t?void 0:t.pathname;return(null==e?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function q(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function W(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}const Y=47;function X(t,e){let n,r="",i=-1,s=0,o=!1;for(let a=0;a<=t.length;++a){if(a2){const t=r.length-1;let e=t;for(;e>=0&&r.charCodeAt(e)!==Y;--e);if(e!==t){r=-1===e?"":r.slice(0,e),i=a,s=0,o=!1;continue}}else if(2===r.length||1===r.length){r="",i=a,s=0,o=!1;continue}e&&(r.length>0?r+="/..":r="..",o=!0)}else{const e=t.slice(i+1,a);r.length>0?r+=`/${e}`:r=e,o=!1}i=a,s=0}else 46===n&&-1!==s?++s:s=-1}return r}const Z=t=>"function"==typeof t,$=t=>null!==t&&"object"==typeof t,tt=t=>$(t)&&t.constructor==={}.constructor,et=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,nt=t=>typeof Blob<"u"&&t instanceof Blob,rt=t=>(t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||$(t)&&Z(t.tee)&&Z(t.cancel)&&Z(t.getReader))(t)||(t=>$(t)&&Z(t.read)&&Z(t.pipe)&&(t=>"boolean"==typeof t)(t.readable))(t),it=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,st=/^([-\w.]+\/[-\w.+]+)/;function ot(t){const e=it.exec(t);return e?e[1]:""}const at=/\?.*/;function ct(t){return t.replace(at,"")}function ht(t){return et(t)?t.url:nt(t)?t.name||"":"string"==typeof t?t:""}function lt(t){if(et(t)){const e=t,n=e.headers.get("content-type")||"",r=ct(e.url);return function(t){const e=st.exec(t);return e?e[1]:t}(n)||ot(r)}return nt(t)?t.type||"":"string"==typeof t?ot(t):""}async function ut(t){if(et(t))return t;const e={},n=function(t){return et(t)?t.headers["content-length"]||-1:nt(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}(t);n>=0&&(e["content-length"]=String(n));const r=ht(t),i=lt(t);i&&(e["content-type"]=i);const s=await async function(t){if("string"==typeof t)return`data:,${t.slice(0,5)}`;if(t instanceof Blob){const e=t.slice(0,5);return await new Promise((t=>{const n=new FileReader;n.onload=e=>{var n;return t(null==e||null===(n=e.target)||void 0===n?void 0:n.result)},n.readAsDataURL(e)}))}return t instanceof ArrayBuffer?`data:base64,${function(t){let e="";const n=new Uint8Array(t);for(let t=0;t=0)}()}const mt=globalThis.window||globalThis.self||globalThis.global,pt=globalThis.process||{},gt=typeof __VERSION__<"u"?__VERSION__:"untranspiled source";ft();class At{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=function(t){try{const e=window[t],n="__storage_test__";return e.setItem(n,n),e.removeItem(n),e}catch{return null}}(n),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let t={};if(this.storage){const e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}function yt(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>r&&(n=Math.min(n,r/t.width));const s=t.width*n,o=t.height*n,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(s/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(s,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}let Bt;function bt(t){return"string"!=typeof t?t:(t=t.toUpperCase(),Bt[t]||Bt.WHITE)}function Ct(t,e){if(!t)throw new Error(e||"Assertion failed")}function wt(){let t;var e,n;if(ft()&&mt.performance)t=null==mt||null===(e=mt.performance)||void 0===e||null===(n=e.now)||void 0===n?void 0:n.call(e);else if("hrtime"in pt){var r;const e=null==pt||null===(r=pt.hrtime)||void 0===r?void 0:r.call(pt);t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}!function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(Bt||(Bt={}));const Et={debug:ft()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},vt={enabled:!0,level:0};function Tt(){}const _t={},xt={once:!0};class Mt{constructor(){let{id:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};this.id=void 0,this.VERSION=gt,this._startTs=wt(),this._deltaTs=wt(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new At("__probe-".concat(this.id,"__"),vt),this.timeStamp("".concat(this.id," started")),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const n=Object.getPrototypeOf(t),r=Object.getOwnPropertyNames(n),i=t;for(const n of r){const r=i[n];"function"==typeof r&&(e.find((t=>n===t))||(i[n]=r.bind(t)))}}(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((wt()-this._startTs).toPrecision(10))}getDelta(){return Number((wt()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){Ct(t,e)}warn(t){return this._getLogFunction(0,t,Et.warn,arguments,xt)}error(t){return this._getLogFunction(0,t,Et.error,arguments)}deprecated(t,e){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(e,"` instead"))}removed(t,e){return this.error("`".concat(t,"` has been removed. Use `").concat(e,"` instead"))}probe(t,e){return this._getLogFunction(t,e,Et.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,Et.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,Et.debug||Et.info,arguments,xt)}table(t,e,n){return e?this._getLogFunction(t,e,console.table||Tt,n&&[n],{tag:Rt(e)}):Tt}image(t){let{logLevel:e,priority:n,image:r,message:i="",scale:s=1}=t;return this._shouldLog(e||n)?ft()?function(t){let{image:e,message:n="",scale:r=1}=t;if("string"==typeof e){const t=new Image;return t.onload=()=>{const e=yt(t,n,r);console.log(...e)},t.src=e,Tt}const i=e.nodeName||"";if("img"===i.toLowerCase())return console.log(...yt(e,n,r)),Tt;if("canvas"===i.toLowerCase()){const t=new Image;return t.onload=()=>console.log(...yt(t,n,r)),t.src=e.toDataURL(),Tt}return Tt}({image:r,message:i,scale:s}):(console.warn("removed"),Tt):Tt}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||Tt)}group(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const r=St({logLevel:t,message:e,opts:n}),{collapsed:i}=n;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Tt)}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=It(t)}_getLogFunction(t,e,n,r,i){if(this._shouldLog(t)){i=St({logLevel:t,message:e,args:r,opts:i}),Ct(n=n||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=wt();const s=i.tag||i.message;if(i.once&&s){if(_t[s])return Tt;_t[s]=wt()}return e=function(t,e,n){if("string"==typeof e){const r=n.time?function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const n=Math.max(e-t.length,0);return"".concat(" ".repeat(n)).concat(t)}(function(t){let e;return e=t<10?"".concat(t.toFixed(2),"ms"):t<100?"".concat(t.toFixed(1),"ms"):t<1e3?"".concat(t.toFixed(0),"ms"):"".concat((t/1e3).toFixed(2),"s"),e}(n.total)):"";e=n.time?"".concat(t,": ").concat(r," ").concat(e):"".concat(t,": ").concat(e),e=function(t,e,n){if(!ft&&"string"==typeof t){if(e){const n=bt(e);t="[".concat(n,"m").concat(t,"")}if(n){const e=bt(n);t="[".concat(e+10,"m").concat(t,"")}}return t}(e,n.color,n.background)}return e}(this.id,i.message,i),n.bind(console,e,...i.args)}return Tt}}function It(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return Ct(Number.isFinite(e)&&e>=0),e}function St(t){const{logLevel:e,message:n}=t;t.logLevel=It(e);const r=t.args?Array.from(t.args):[];for(;r.length&&r.shift()!==n;);switch(typeof e){case"string":case"function":void 0!==n&&r.unshift(n),t.message=e;break;case"object":Object.assign(t,e)}"function"==typeof t.message&&(t.message=t.message());const i=typeof t.message;return Ct("string"===i||"object"===i),Object.assign(t,{args:r},t.opts)}function Rt(t){for(const e in t)for(const n in t[e])return n||"untitled";return"empty"}Mt.VERSION=gt;const Ot=new Mt({id:"@probe.gl/log"}),Ft=new Mt({id:"loaders.gl"});class Dt{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const Gt={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){this.console=void 0,this.console=console}log(){for(var t=arguments.length,e=new Array(t),n=0;n{const t=Ut();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry})()}const Kt=new Mt({id:"loaders.gl"}),Qt=/\.([^.]+)$/;function zt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!Wt(t))return null;if(e&&!Array.isArray(e))return kt(e);let i=[];e&&(i=i.concat(e)),null!=n&&n.ignoreRegisteredLoaders||i.push(...Vt()),Xt(i);const s=qt(t,i,n,r);if(!(s||null!=n&&n.nothrow))throw new Error(Yt(t));return s}function qt(t,e,n,r){const i=ht(t),s=lt(t),o=ct(i)||(null==r?void 0:r.url);let a=null,c="";var h;return null!=n&&n.mimeType&&(a=Zt(e,null==n?void 0:n.mimeType),c=`match forced by supplied MIME type ${null==n?void 0:n.mimeType}`),a=a||function(t,e){const n=e&&Qt.exec(e),r=n&&n[1];return r?function(t,e){e=e.toLowerCase();for(const n of t)for(const t of n.extensions)if(t.toLowerCase()===e)return n;return null}(t,r):null}(e,o),c=c||(a?`matched url ${o}`:""),a=a||Zt(e,s),c=c||(a?`matched MIME type ${s}`:""),a=a||function(t,e){if(!e)return null;for(const n of t)if("string"==typeof e){if($t(e,n))return n}else if(ArrayBuffer.isView(e)){if(te(e.buffer,e.byteOffset,n))return n}else if(e instanceof ArrayBuffer&&te(e,0,n))return n;return null}(e,t),c=c||(a?`matched initial data ${ee(t)}`:""),null!=n&&n.fallbackMimeType&&(a=a||Zt(e,null==n?void 0:n.fallbackMimeType),c=c||(a?`matched fallback MIME type ${s}`:"")),c&&Kt.log(1,`selectLoader selected ${null===(h=a)||void 0===h?void 0:h.name}: ${c}.`),a}function Wt(t){return!(t instanceof Response&&204===t.status)}function Yt(t){const e=ht(t),n=lt(t);let r="No valid loader found (";r+=e?`${q(e)}, `:"no url provided, ",r+=`MIME type: ${n?`"${n}"`:"not provided"}, `;const i=t?ee(t):"";return r+=i?` first bytes: "${i}"`:"first bytes: not available",r+=")",r}function Xt(t){for(const e of t)kt(e)}function Zt(t,e){for(const n of t)if(n.mimeTypes&&n.mimeTypes.includes(e)||e===`application/x.${n.id}`)return n;return null}function $t(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some((e=>t.startsWith(e)))}function te(t,e,n){return(Array.isArray(n.tests)?n.tests:[n.tests]).some((n=>function(t,e,n,r){if(r instanceof ArrayBuffer)return function(t,e,n){if(n=n||t.byteLength,t.byteLength1&&void 0!==arguments[1]?arguments[1]:5;return"string"==typeof t?t.slice(0,e):ArrayBuffer.isView(t)?ne(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?ne(t,0,e):""}function ne(t,e,n){if(t.byteLengtht&&"object"==typeof t&&t.isBuffer)(t)&&(t=t.buffer),t instanceof ArrayBuffer){const n=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let n=t.buffer;const r=t.byteLength||t.length;return(0!==t.byteOffset||r!==n.byteLength)&&(n=n.slice(t.byteOffset,t.byteOffset+r)),n}throw new Error(se)}(t,e);if(nt(t)&&(t=await ut(t)),et(t)){const n=t;return await async function(t){if(!t.ok){const e=await async function(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{const n=t.headers.get("Content-Type");let r=t.statusText;null!=n&&n.includes("application/json")&&(r+=` ${await t.text()}`),e+=r,e=e.length>60?`${e.slice(0,60)}...`:e}catch{}return e}(t);throw new Error(e)}}(n),e.binary?await n.arrayBuffer():await n.text()}if(rt(t)&&(t=function(t,e){if("string"==typeof t)return function*(t,e){const n=(null==e?void 0:e.chunkSize)||262144;let r=0;const i=new TextEncoder;for(;r1&&void 0!==arguments[1]?arguments[1]:{};return function*(){const{chunkSize:n=re}=e;let r=0;for(;r!!t&&"function"==typeof t[Symbol.iterator])(t)||(t=>t&&"function"==typeof t[Symbol.asyncIterator])(t))return async function(t){const e=[];for await(const n of t)e.push(n);return function(){for(var t=arguments.length,e=new Array(t),n=0;ndt(t,r.fetch):null!=e&&e.fetch?null==e?void 0:e.fetch:dt}async function ce(t,e,n,r){e&&!Array.isArray(e)&&!jt(e)&&(r=void 0,n=e,e=void 0),n=n||{};const i=ht(t=await t),s=function(t,e){if(t&&!Array.isArray(t))return t;let n;if(t&&(n=Array.isArray(t)?t:[t]),e&&e.loaders){const t=Array.isArray(e.loaders)?e.loaders:[e.loaders];n=n?[...n,...t]:t}return n&&n.length?n:void 0}(e,r),o=await async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!Wt(t))return null;let i=zt(t,e,{...n,nothrow:!0},r);if(i)return i;if(nt(t)&&(i=zt(t=await t.slice(0,10).arrayBuffer(),e,n,r)),!(i||null!=n&&n.nothrow))throw new Error(Yt(t));return i}(t,s,n);return o?(r=function(t,e,n){if(n)return n;const r={fetch:ae(e,t),...t};if(r.url){const t=ct(r.url);r.baseUrl=t,r.queryString=function(t){const e=t.match(at);return e&&e[0]}(r.url),r.filename=q(t),r.baseUrl=W(t)}return Array.isArray(r.loaders)||(r.loaders=null),r}({url:i,_parse:ce,loaders:s},n=function(t,e,n,r){return n=n||[],function(t,e){Pt(t,null,Gt,Lt,e);for(const n of e){const r=t&&t[n.id]||{},i=n.options&&n.options[n.id]||{},s=n.deprecatedOptions&&n.deprecatedOptions[n.id]||{};Pt(r,n.id,i,s,e)}}(t,n=Array.isArray(n)?n:[n]),function(t,e,n){const r={...t.options||{}};return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(r,n),null===r.log&&(r.log=new Dt),Jt(r,Nt()),Jt(r,e),r}(e,t,r)}(n,o,s,i),r||null),await async function(t,e,n,r){if(function(t){m(t,"no worker provided");t.version}(t),n=h(t.options,n),et(e)){const t=e,{ok:n,redirected:i,status:s,statusText:o,type:a,url:c}=t,h=Object.fromEntries(t.headers.entries());r.response={headers:h,ok:n,redirected:i,status:s,statusText:o,type:a,url:c}}e=await oe(e,t,n);const i=t;if(i.parseTextSync&&"string"==typeof e)return i.parseTextSync(e,n,r);if(function(t,e){return!(!I.isSupported()||!(p||null!=e&&e._nodeWorkers))&&t.worker&&(null==e?void 0:e.worker)}(t,n))return await G(t,e,n,r,ce);if(i.parseText&&"string"==typeof e)return await i.parseText(e,n,r);if(i.parse)return await i.parse(e,n,r);throw m(!i.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}(o,t,n,r)):null}async function he(t,e,n,r){let i,s;Array.isArray(e)||jt(e)?(i=e,s=n):(i=[],s=e);const o=ae(s);let a=t;return"string"==typeof t&&(a=await o(t)),nt(t)&&(a=await o(t)),Array.isArray(i),await ce(a,i,s)}const le=1/Math.PI*180,ue=1/180*Math.PI;globalThis.mathgl=globalThis.mathgl||{config:{EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1}};const de=globalThis.mathgl.config;function fe(t,{precision:e=de.precision}={}){return t=function(t){return Math.round(t/de.EPSILON)*de.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function me(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function pe(t){return function(t,e){return be(t,(t=>t*ue),void 0)}(t)}function ge(t){return Ae(t)}function Ae(t,e){return be(t,(t=>t*le),e)}function ye(t,e,n){return be(t,(t=>Math.max(e,Math.min(n,t))))}function Be(t,e,n){const r=de.EPSILON;n&&(de.EPSILON=n);try{if(t===e)return!0;if(me(t)&&me(e)){if(t.length!==e.length)return!1;for(let n=0;n0?", ":"")+fe(this[n],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e=0&&t=0&&t0?this.copy([t,...e]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(Ze)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n+n,a=r+r,c=i+i,h=n*o,l=r*o,u=r*a,d=i*o,f=i*a,m=i*c,p=s*o,g=s*a,A=s*c;t[0]=1-u-m,t[3]=l-A,t[6]=d+g,t[1]=l+A,t[4]=1-h-m,t[7]=f-p,t[2]=d-g,t[5]=f+p,t[8]=1-h-u}(this,t),this.check()}set(t,e,n,r,i,s,o,a,c){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=a,this[8]=c,this.check()}setRowMajor(t,e,n,r,i,s,o,a,c){return this[0]=t,this[1]=r,this[2]=o,this[3]=e,this[4]=i,this[5]=a,this[6]=n,this[7]=s,this[8]=c,this.check()}determinant(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],h=t[8];return e*(h*s-o*c)+n*(-h*i+o*a)+r*(c*i-s*a)}(this)}transpose(){return function(t,e){if(t===e){const n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],h=e[7],l=e[8],u=l*o-a*h,d=-l*s+a*c,f=h*s-o*c;let m=n*u+r*d+i*f;m&&(m=1/m,t[0]=u*m,t[1]=(-l*r+i*h)*m,t[2]=(a*r-i*o)*m,t[3]=d*m,t[4]=(l*n-i*c)*m,t[5]=(-a*n+i*s)*m,t[6]=f*m,t[7]=(-h*n+r*c)*m,t[8]=(o*n-r*s)*m)}(this,this),this.check()}multiplyLeft(t){return We(this,t,this),this.check()}multiplyRight(t){return We(this,this,t),this.check()}rotate(t){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=Math.sin(n),f=Math.cos(n);t[0]=f*r+d*o,t[1]=f*i+d*a,t[2]=f*s+d*c,t[3]=f*o-d*r,t[4]=f*a-d*i,t[5]=f*c-d*s,t[6]=h,t[7]=l,t[8]=u}(this,this,t),this.check()}scale(t){return Array.isArray(t)?Ye(this,this,t):Ye(this,this,[t,t]),this.check()}translate(t){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=n[0],f=n[1];t[0]=r,t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=c,t[6]=d*r+f*o+h,t[7]=d*i+f*a+l,t[8]=d*s+f*c+u}(this,this,t),this.check()}transform(t,e){let n;switch(t.length){case 2:n=Me(e||[-0,-0],t,this);break;case 3:n=He(e||[-0,-0,-0],t,this);break;case 4:n=Oe(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(n,t.length),n}transformVector(t,e){return this.transform(t,e)}transformVector2(t,e){return this.transform(t,e)}transformVector3(t,e){return this.transform(t,e)}}let tn,en=null;function nn(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=e[9],f=e[10],m=e[11],p=e[12],g=e[13],A=e[14],y=e[15];let B=n[0],b=n[1],C=n[2],w=n[3];return t[0]=B*r+b*a+C*u+w*p,t[1]=B*i+b*c+C*d+w*g,t[2]=B*s+b*h+C*f+w*A,t[3]=B*o+b*l+C*m+w*y,B=n[4],b=n[5],C=n[6],w=n[7],t[4]=B*r+b*a+C*u+w*p,t[5]=B*i+b*c+C*d+w*g,t[6]=B*s+b*h+C*f+w*A,t[7]=B*o+b*l+C*m+w*y,B=n[8],b=n[9],C=n[10],w=n[11],t[8]=B*r+b*a+C*u+w*p,t[9]=B*i+b*c+C*d+w*g,t[10]=B*s+b*h+C*f+w*A,t[11]=B*o+b*l+C*m+w*y,B=n[12],b=n[13],C=n[14],w=n[15],t[12]=B*r+b*a+C*u+w*p,t[13]=B*i+b*c+C*d+w*g,t[14]=B*s+b*h+C*f+w*A,t[15]=B*o+b*l+C*m+w*y,t}var rn;!function(){const t=new xe(4);xe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"}(rn||(rn={}));const sn=45*Math.PI/180,on=1,an=.1,cn=500,hn=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class ln extends qe{static get IDENTITY(){return dn||(dn=new ln,Object.freeze(dn)),dn}static get ZERO(){return un||(un=new ln([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(un)),un}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return rn}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,n,r,i,s,o,a,c,h,l,u,d,f,m,p){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=a,this[8]=c,this[9]=h,this[10]=l,this[11]=u,this[12]=d,this[13]=f,this[14]=m,this[15]=p,this.check()}setRowMajor(t,e,n,r,i,s,o,a,c,h,l,u,d,f,m,p){return this[0]=t,this[1]=i,this[2]=c,this[3]=d,this[4]=e,this[5]=s,this[6]=h,this[7]=f,this[8]=n,this[9]=o,this[10]=l,this[11]=m,this[12]=r,this[13]=a,this[14]=u,this[15]=p,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(hn)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n+n,a=r+r,c=i+i,h=n*o,l=r*o,u=r*a,d=i*o,f=i*a,m=i*c,p=s*o,g=s*a,A=s*c;t[0]=1-u-m,t[1]=l+A,t[2]=d-g,t[3]=0,t[4]=l-A,t[5]=1-h-m,t[6]=f+p,t[7]=0,t[8]=d+g,t[9]=f-p,t[10]=1-h-u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum(t){const{left:e,right:n,bottom:r,top:i,near:s=an,far:o=cn}=t;return o===1/0?function(t,e,n,r,i,s){const o=2*s/(n-e),a=2*s/(i-r),c=(n+e)/(n-e),h=(i+r)/(i-r),l=-2*s;t[0]=o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=h,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=l,t[15]=0}(this,e,n,r,i,s):function(t,e,n,r,i,s,o){const a=1/(n-e),c=1/(i-r),h=1/(s-o);t[0]=2*s*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*c,t[6]=0,t[7]=0,t[8]=(n+e)*a,t[9]=(i+r)*c,t[10]=(o+s)*h,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*s*2*h,t[15]=0}(this,e,n,r,i,s,o),this.check()}lookAt(t){const{eye:e,center:n=[0,0,0],up:r=[0,1,0]}=t;return function(t,e,n,r){let i,s,o,a,c,h,l,u,d,f;const m=e[0],p=e[1],g=e[2],A=r[0],y=r[1],B=r[2],b=n[0],C=n[1],w=n[2];Math.abs(m-b)<_e&&Math.abs(p-C)<_e&&Math.abs(g-w)<_e?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(u=m-b,d=p-C,f=g-w,i=1/Math.sqrt(u*u+d*d+f*f),u*=i,d*=i,f*=i,s=y*f-B*d,o=B*u-A*f,a=A*d-y*u,i=Math.sqrt(s*s+o*o+a*a),i?(i=1/i,s*=i,o*=i,a*=i):(s=0,o=0,a=0),c=d*a-f*o,h=f*s-u*a,l=u*o-d*s,i=Math.sqrt(c*c+h*h+l*l),i?(i=1/i,c*=i,h*=i,l*=i):(c=0,h=0,l=0),t[0]=s,t[1]=c,t[2]=u,t[3]=0,t[4]=o,t[5]=h,t[6]=d,t[7]=0,t[8]=a,t[9]=l,t[10]=f,t[11]=0,t[12]=-(s*m+o*p+a*g),t[13]=-(c*m+h*p+l*g),t[14]=-(u*m+d*p+f*g),t[15]=1)}(this,e,n,r),this.check()}ortho(t){const{left:e,right:n,bottom:r,top:i,near:s=an,far:o=cn}=t;return function(t,e,n,r,i,s,o){const a=1/(e-n),c=1/(r-i),h=1/(s-o);t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+n)*a,t[13]=(i+r)*c,t[14]=(o+s)*h,t[15]=1}(this,e,n,r,i,s,o),this.check()}orthographic(t){const{fovy:e=sn,aspect:n=on,focalDistance:r=1,near:i=an,far:s=cn}=t;fn(e);const o=e/2,a=r*Math.tan(o),c=a*n;return this.ortho({left:-c,right:c,bottom:-a,top:a,near:i,far:s})}perspective(t){const{fovy:e=45*Math.PI/180,aspect:n=1,near:r=.1,far:i=500}=t;return fn(e),function(t,e,n,r,i){const s=1/Math.tan(e/2);if(t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0){const e=1/(r-i);t[10]=(i+r)*e,t[14]=2*i*r*e}else t[10]=-1,t[14]=-2*r}(this,e,n,r,i),this.check()}determinant(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],h=t[8],l=t[9],u=t[10],d=t[11],f=t[12],m=t[13],p=t[14],g=e*o-n*s,A=e*a-r*s,y=n*a-r*o,B=h*m-l*f,b=h*p-u*f,C=l*p-u*m;return c*(e*C-n*b+r*B)-i*(s*C-o*b+a*B)+t[15]*(h*y-l*A+u*g)-d*(f*y-m*A+p*g)}(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),r=1/n[0],i=1/n[1],s=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*i,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*r,t[9]=this[9]*i,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),r=1/n[0],i=1/n[1],s=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=this[4]*r,t[4]=this[5]*i,t[5]=this[6]*s,t[6]=this[8]*r,t[7]=this[9]*i,t[8]=this[10]*s,t}transpose(){return function(t,e){if(t===e){const n=e[1],r=e[2],i=e[3],s=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=s,t[11]=e[14],t[12]=i,t[13]=o,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],h=e[7],l=e[8],u=e[9],d=e[10],f=e[11],m=e[12],p=e[13],g=e[14],A=e[15],y=n*a-r*o,B=n*c-i*o,b=n*h-s*o,C=r*c-i*a,w=r*h-s*a,E=i*h-s*c,v=l*p-u*m,T=l*g-d*m,_=l*A-f*m,x=u*g-d*p,M=u*A-f*p,I=d*A-f*g;let S=y*I-B*M+b*x+C*_-w*T+E*v;S&&(S=1/S,t[0]=(a*I-c*M+h*x)*S,t[1]=(i*M-r*I-s*x)*S,t[2]=(p*E-g*w+A*C)*S,t[3]=(d*w-u*E-f*C)*S,t[4]=(c*_-o*I-h*T)*S,t[5]=(n*I-i*_+s*T)*S,t[6]=(g*b-m*E-A*B)*S,t[7]=(l*E-d*b+f*B)*S,t[8]=(o*M-a*_+h*v)*S,t[9]=(r*_-n*M-s*v)*S,t[10]=(m*w-p*b+A*y)*S,t[11]=(u*b-l*w-f*y)*S,t[12]=(a*T-o*x-c*v)*S,t[13]=(n*x-r*T+i*v)*S,t[14]=(p*B-m*C-g*y)*S,t[15]=(l*C-u*B+d*y)*S)}(this,this),this.check()}multiplyLeft(t){return nn(this,t,this),this.check()}multiplyRight(t){return nn(this,this,t),this.check()}rotateX(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[4],o=e[5],a=e[6],c=e[7],h=e[8],l=e[9],u=e[10],d=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*i+h*r,t[5]=o*i+l*r,t[6]=a*i+u*r,t[7]=c*i+d*r,t[8]=h*i-s*r,t[9]=l*i-o*r,t[10]=u*i-a*r,t[11]=d*i-c*r}(this,this,t),this.check()}rotateY(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[0],o=e[1],a=e[2],c=e[3],h=e[8],l=e[9],u=e[10],d=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i-h*r,t[1]=o*i-l*r,t[2]=a*i-u*r,t[3]=c*i-d*r,t[8]=s*r+h*i,t[9]=o*r+l*i,t[10]=a*r+u*i,t[11]=c*r+d*i}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[0],o=e[1],a=e[2],c=e[3],h=e[4],l=e[5],u=e[6],d=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i+h*r,t[1]=o*i+l*r,t[2]=a*i+u*r,t[3]=c*i+d*r,t[4]=h*i-s*r,t[5]=l*i-o*r,t[6]=u*i-a*r,t[7]=d*i-c*r}(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return function(t,e,n,r){let i,s,o,a,c,h,l,u,d,f,m,p,g,A,y,B,b,C,w,E,v,T,_,x,M=r[0],I=r[1],S=r[2],R=Math.sqrt(M*M+I*I+S*S);R<_e||(R=1/R,M*=R,I*=R,S*=R,s=Math.sin(n),i=Math.cos(n),o=1-i,a=e[0],c=e[1],h=e[2],l=e[3],u=e[4],d=e[5],f=e[6],m=e[7],p=e[8],g=e[9],A=e[10],y=e[11],B=M*M*o+i,b=I*M*o+S*s,C=S*M*o-I*s,w=M*I*o-S*s,E=I*I*o+i,v=S*I*o+M*s,T=M*S*o+I*s,_=I*S*o-M*s,x=S*S*o+i,t[0]=a*B+u*b+p*C,t[1]=c*B+d*b+g*C,t[2]=h*B+f*b+A*C,t[3]=l*B+m*b+y*C,t[4]=a*w+u*E+p*v,t[5]=c*w+d*E+g*v,t[6]=h*w+f*E+A*v,t[7]=l*w+m*E+y*v,t[8]=a*T+u*_+p*x,t[9]=c*T+d*_+g*x,t[10]=h*T+f*_+A*x,t[11]=l*T+m*_+y*x,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return function(t,e,n){const r=n[0],i=n[1],s=n[2];t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return function(t,e,n){const r=n[0],i=n[1],s=n[2];let o,a,c,h,l,u,d,f,m,p,g,A;e===t?(t[12]=e[0]*r+e[4]*i+e[8]*s+e[12],t[13]=e[1]*r+e[5]*i+e[9]*s+e[13],t[14]=e[2]*r+e[6]*i+e[10]*s+e[14],t[15]=e[3]*r+e[7]*i+e[11]*s+e[15]):(o=e[0],a=e[1],c=e[2],h=e[3],l=e[4],u=e[5],d=e[6],f=e[7],m=e[8],p=e[9],g=e[10],A=e[11],t[0]=o,t[1]=a,t[2]=c,t[3]=h,t[4]=l,t[5]=u,t[6]=d,t[7]=f,t[8]=m,t[9]=p,t[10]=g,t[11]=A,t[12]=o*r+l*i+m*s+e[12],t[13]=a*r+u*i+p*s+e[13],t[14]=c*r+d*i+g*s+e[14],t[15]=h*r+f*i+A*s+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*s+n[12]*o,t[1]=n[1]*r+n[5]*i+n[9]*s+n[13]*o,t[2]=n[2]*r+n[6]*i+n[10]*s+n[14]*o,t[3]=n[3]*r+n[7]*i+n[11]*s+n[15]*o,t}(e||[-0,-0,-0,-0],t,this),Ee(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:n}=t;let r;switch(n){case 2:r=Ie(e||[-0,-0],t,this);break;case 3:r=Pe(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(r,t.length),r}transformAsVector(t,e){let n;switch(t.length){case 2:n=Se(e||[-0,-0],t,this);break;case 3:n=Re(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(n,t.length),n}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,n){return this.identity().translate([t,e,n])}}let un,dn;function fn(t){if(t>2*Math.PI)throw Error("expected radians")}function mn(){const t=new xe(4);return xe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function pn(t,e,n){n*=.5;const r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function gn(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=n[0],c=n[1],h=n[2],l=n[3];return t[0]=r*l+o*a+i*h-s*c,t[1]=i*l+o*c+s*a-r*h,t[2]=s*l+o*h+r*c-i*a,t[3]=o*l-r*a-i*c-s*h,t}const An=function(){const t=De(),e=Le(1,0,0),n=Le(0,1,0);return function(r,i,s){const o=Ue(i,s);return o<-.999999?(Ne(t,e,i),je(t)<1e-6&&Ne(t,n,i),function(t,e){const n=e[0],r=e[1],i=e[2];let s=n*n+r*r+i*i;s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s}(t,t),pn(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Ne(t,i,s),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3];let o=n*n+r*r+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=s*o,t}(r,r))}}();mn(),mn(),function(){const t=new xe(9);xe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1}();const yn=[0,0,0,1];class Bn extends Ce{constructor(t=0,e=0,n=0,r=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,n,r)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,n,r){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return function(t,e){const n=e[0]+e[4]+e[8];let r;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{let n=0;e[4]>e[0]&&(n=1),e[8]>e[3*n+n]&&(n=2);const i=(n+1)%3,s=(n+2)%3;r=Math.sqrt(e[3*n+n]-e[3*i+i]-e[3*s+s]+1),t[n]=.5*r,r=.5/r,t[3]=(e[3*i+s]-e[3*s+i])*r,t[i]=(e[3*i+n]+e[3*n+i])*r,t[s]=(e[3*s+n]+e[3*n+s])*r}}(this,t),this.check()}fromAxisRotation(t,e){return pn(this,t,e),this.check()}identity(){return function(t){t[0]=0,t[1]=0,t[2]=0,t[3]=1}(this),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=we(t)}get y(){return this[1]}set y(t){this[1]=we(t)}get z(){return this[2]}set z(t){this[2]=we(t)}get w(){return this[3]}set w(t){this[3]=we(t)}len(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)}(this)}lengthSquared(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}(this)}dot(t){return function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}(this,t)}rotationTo(t,e){return An(this,t,e),this.check()}add(t){return function(t,e,n){t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3]}(this,this,t),this.check()}calculateW(){return function(t,e){const n=e[0],r=e[1],i=e[2];t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i))}(this,this),this.check()}conjugate(){return function(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n*n+r*r+i*i+s*s,a=o?1/o:0;t[0]=-n*a,t[1]=-r*a,t[2]=-i*a,t[3]=s*a}(this,this),this.check()}lerp(t,e,n){return void 0===n?this.lerp(this,t,e):(function(t,e,n,r){const i=e[0],s=e[1],o=e[2],a=e[3];t[0]=i+r*(n[0]-i),t[1]=s+r*(n[1]-s),t[2]=o+r*(n[2]-o),t[3]=a+r*(n[3]-a)}(this,t,e,n),this.check())}multiplyRight(t){return gn(this,this,t),this.check()}multiplyLeft(t){return gn(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c+o*a,t[1]=i*c+s*a,t[2]=s*c-i*a,t[3]=o*c-r*a}(this,this,t),this.check()}rotateY(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c-s*a,t[1]=i*c+o*a,t[2]=s*c+r*a,t[3]=o*c-i*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c+i*a,t[1]=i*c-r*a,t[2]=s*c+o*a,t[3]=o*c-s*a}(this,this,t),this.check()}scale(t){return function(t,e,n){t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n}(this,this,t),this.check()}slerp(t,e,n){let r,i,s;switch(arguments.length){case 1:({start:r=yn,target:i,ratio:s}=t);break;case 2:r=this,i=t,s=e;break;default:r=t,i=e,s=n}return function(t,e,n,r){const i=e[0],s=e[1],o=e[2],a=e[3];let c,h,l,u,d,f=n[0],m=n[1],p=n[2],g=n[3];c=i*f+s*m+o*p+a*g,c<0&&(c=-c,f=-f,m=-m,p=-p,g=-g),1-c>_e?(h=Math.acos(c),d=Math.sin(h),l=Math.sin((1-r)*h)/d,u=Math.sin(r*h)/d):(l=1-r,u=r),t[0]=l*i+u*f,t[1]=l*s+u*m,t[2]=l*o+u*p,t[3]=l*a+u*g}(this,r,i,s),this.check()}transformVector4(t,e=new ze){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=n[0],a=n[1],c=n[2],h=n[3],l=h*r+a*s-c*i,u=h*i+c*r-o*s,d=h*s+o*i-a*r,f=-o*r-a*i-c*s;t[0]=l*h+f*-o+u*-c-d*-a,t[1]=u*h+f*-a+d*-o-l*-c,t[2]=d*h+f*-c+l*-a-u*-o,t[3]=e[3]}(e,t,this),Ee(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}function bn(t){return(bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Cn(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=bn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=bn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==bn(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wn(t){return t}new Qe;const En=new Qe,vn={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Tn={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_n={east:new Qe,north:new Qe,up:new Qe,west:new Qe,south:new Qe,down:new Qe},xn=new Qe,Mn=new Qe,In=new Qe;function Sn(t,e,n,r,i,s){const o=vn[e]&&vn[e][n];let a,c,h;ve(o&&(!r||r===o));const l=En.copy(i);if(Be(l.x,0,1e-14)&&Be(l.y,0,1e-14)){const t=Math.sign(l.z);a=xn.fromArray(Tn[e]),"east"!==e&&"west"!==e&&a.scale(t),c=Mn.fromArray(Tn[n]),"east"!==n&&"west"!==n&&c.scale(t),h=In.fromArray(Tn[r]),"east"!==r&&"west"!==r&&h.scale(t)}else{const{up:i,east:s,north:o}=_n;s.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,i),o.copy(i).cross(s);const{down:u,west:d,south:f}=_n;u.copy(i).scale(-1),d.copy(s).scale(-1),f.copy(o).scale(-1),a=_n[e],c=_n[n],h=_n[r]}return s[0]=a.x,s[1]=a.y,s[2]=a.z,s[3]=0,s[4]=c.x,s[5]=c.y,s[6]=c.z,s[7]=0,s[8]=h.x,s[9]=h.y,s[10]=h.z,s[11]=0,s[12]=l.x,s[13]=l.y,s[14]=l.z,s[15]=1,s}const Rn=new Qe,On=new Qe,Fn=new Qe,Dn=new Qe,Gn=new Qe,Ln=new Qe,Un=new Qe,Nn=new Qe,Pn=new Qe;class Hn{constructor(t=0,e=0,n=0){Cn(this,"radii",void 0),Cn(this,"radiiSquared",void 0),Cn(this,"radiiToTheFourth",void 0),Cn(this,"oneOverRadii",void 0),Cn(this,"oneOverRadiiSquared",void 0),Cn(this,"minimumRadius",void 0),Cn(this,"maximumRadius",void 0),Cn(this,"centerToleranceSquared",.1),Cn(this,"squaredXOverSquaredZ",void 0),ve(t>=0),ve(e>=0),ve(n>=0),this.radii=new Qe(t,e,n),this.radiiSquared=new Qe(t*t,e*e,n*n),this.radiiToTheFourth=new Qe(t*t*t*t,e*e*e*e,n*n*n*n),this.oneOverRadii=new Qe(0===t?0:1/t,0===e?0:1/e,0===n?0:1/n),this.oneOverRadiiSquared=new Qe(0===t?0:1/(t*t),0===e?0:1/(e*e),0===n?0:1/(n*n)),this.minimumRadius=Math.min(t,e,n),this.maximumRadius=Math.max(t,e,n),0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||!(!t||!this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const n=Gn,r=Ln,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,n),r.copy(this.radiiSquared).scale(n);const s=Math.sqrt(n.dot(r));return r.scale(1/s),n.scale(i),r.add(n),r.to(e)}cartesianToCartographic(t,e=[0,0,0]){Pn.from(t);const n=this.scaleToGeodeticSurface(Pn,Un);if(!n)return;const r=this.geodeticSurfaceNormal(n,Gn),i=Nn;return i.copy(Pn).subtract(n),function(t,e){return function(t,e,n=wn){return"longitude"in e?(e.longitude=n(t[0]),e.latitude=n(t[1]),e.height=t[2]):"x"in e?(e.x=n(t[0]),e.y=n(t[1]),e.z=t[2]):(e[0]=n(t[0]),e[1]=n(t[1]),e[2]=t[2]),e}(t,e,de._cartographicRadians?wn:ge)}([Math.atan2(r.y,r.x),Math.asin(r.z),Math.sign(Ue(i,Pn))*Ge(i)],e)}eastNorthUpToFixedFrame(t,e=new ln){return Sn(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,n,r,i=new ln){return Sn(this,t,e,n,r,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return Dn.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const n=function(t,e=[]){return function(t,e=[],n=wn){return"longitude"in t?(e[0]=n(t.longitude),e[1]=n(t.latitude),e[2]=t.height):"x"in t?(e[0]=n(t.x),e[1]=n(t.y),e[2]=t.z):(e[0]=n(t[0]),e[1]=n(t[1]),e[2]=t[2]),e}(t,e,de._cartographicRadians?wn:pe)}(t),r=n[0],i=n[1],s=Math.cos(i);return Dn.set(s*Math.cos(r),s*Math.sin(r),Math.sin(i)).normalize(),Dn.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return Dn.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,n=[]){const{oneOverRadii:r,oneOverRadiiSquared:i,centerToleranceSquared:s}=e;Rn.from(t);const o=Rn.x,a=Rn.y,c=Rn.z,h=r.x,l=r.y,u=r.z,d=o*o*h*h,f=a*a*l*l,m=c*c*u*u,p=d+f+m,g=Math.sqrt(1/p);if(!Number.isFinite(g))return;const A=On;if(A.copy(t).scale(g),p1e-12);return Rn.scale([w,E,v]).to(n)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){Un.from(t);const n=Un.x,r=Un.y,i=Un.z,s=this.oneOverRadiiSquared,o=1/Math.sqrt(n*n*s.x+r*r*s.y+i*i*s.z);return Un.multiplyScalar(o).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return Un.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return Un.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,n=[0,0,0]){ve(Be(this.radii.x,this.radii.y,1e-15)),ve(this.radii.z>0),Un.from(t);const r=Un.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(r)>=this.radii.z-e))return Un.set(0,0,r).to(n)}}Cn(Hn,"WGS84",new Hn(6378137,6378137,6356752.314245179));new Qe,new Qe;const Jn=new Qe,jn=new Qe;class kn{constructor(t=[0,0,0],e=0){Cn(this,"center",void 0),Cn(this,"radius",void 0),this.radius=-0,this.center=new Qe,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=Jn.from(e),this.center=(new Qe).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new kn(this.center,this.radius)}union(t){const e=this.center,n=this.radius,r=t.center,i=t.radius,s=Jn.copy(r).subtract(e),o=s.magnitude();if(n>=o+i)return this.clone();if(i>=o+n)return t.clone();const a=.5*(n+o+i);return jn.copy(s).scale((-n+a)/o).add(e),this.center.copy(jn),this.radius=a,this}expand(t){const e=Jn.from(t).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=function(t,e){const n=e[0],r=e[1],i=e[2],s=e[4],o=e[5],a=e[6],c=e[8],h=e[9],l=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(s*s+o*o+a*a),t[2]=Math.sqrt(c*c+h*h+l*l),t}(Jn,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){const e=this.distanceTo(t);return e*e}distanceTo(t){const e=Jn.from(t).subtract(this.center);return Math.max(0,e.len()-this.radius)}intersectPlane(t){const e=this.center,n=this.radius,r=t.normal.dot(e)+t.distance;return r<-n?-1:r=a?1:0}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=Kn.from(t).subtract(this.center),n=this.halfAxes,r=n.getColumn(0,Qn),i=n.getColumn(1,zn),s=n.getColumn(2,qn),o=r.magnitude(),a=i.magnitude(),c=s.magnitude();r.normalize(),i.normalize(),s.normalize();let h,l=0;return h=Math.abs(e.dot(r))-o,h>0&&(l+=h*h),h=Math.abs(e.dot(i))-a,h>0&&(l+=h*h),h=Math.abs(e.dot(s))-c,h>0&&(l+=h*h),l}computePlaneDistances(t,e,n=[-0,-0]){let r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const s=this.center,o=this.halfAxes,a=o.getColumn(0,Qn),c=o.getColumn(1,zn),h=o.getColumn(2,qn),l=Wn.copy(a).add(c).add(h).add(s),u=Yn.copy(l).subtract(t);let d=e.dot(u);return r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).add(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).subtract(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).subtract(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).add(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).add(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).subtract(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).subtract(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),n[0]=r,n[1]=i,n}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,Qn);e.transformAsPoint(t);const n=this.halfAxes.getColumn(1,zn);n.transformAsPoint(t);const r=this.halfAxes.getColumn(2,qn);return r.transformAsPoint(t),this.halfAxes=new $e([...e,...n,...r]),this}getTransform(){throw new Error("not implemented")}}const Zn=new Qe,$n=new Qe;class tr{constructor(t=[0,0,1],e=0){Cn(this,"normal",void 0),Cn(this,"distance",void 0),this.normal=new Qe,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return ve(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=Zn.from(t),this.normal.from(e).normalize();const n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,e,n,r){return this.normal.set(t,e,n),ve(Be(this.normal.len(),1)),this.distance=r,this}clone(){return new tr(this.normal,this.distance)}equals(t){return Be(this.distance,t.distance)&&Be(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=$n.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,e)}projectPointOntoPlane(t,e=[0,0,0]){const n=Zn.from(t),r=this.getPointDistance(n),i=$n.copy(this.normal).scale(r);return n.subtract(i).to(e)}}const er=[new Qe([1,0,0]),new Qe([0,1,0]),new Qe([0,0,1])],nr=new Qe,rr=new Qe;class ir{constructor(t=[]){Cn(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*er.length;const e=t.center,n=t.radius;let r=0;for(const t of er){let i=this.planes[r],s=this.planes[r+1];i||(i=this.planes[r]=new tr),s||(s=this.planes[r+1]=new tr);const o=nr.copy(t).scale(-n).add(e);i.fromPointNormal(o,t);const a=nr.copy(t).scale(n).add(e),c=rr.copy(t).negate();s.fromPointNormal(a,c),r+=2}return this}computeVisibility(t){let e=1;for(const n of this.planes)switch(t.intersectPlane(n)){case-1:return-1;case 0:e=0}return e}computeVisibilityWithPlaneMask(t,e){if(ve(Number.isFinite(e),"parentPlaneMask is required."),e===ir.MASK_OUTSIDE||e===ir.MASK_INSIDE)return e;let n=ir.MASK_INSIDE;const r=this.planes;for(let i=0;i0),ve(e>0),ve(n>0),ve(r);const i=1/this.near;let s=this.top*i;const o=2*n*s/e;s=this.right*i;const a=2*n*s/t;return r.x=a,r.y=o,r}_update(){ve(Number.isFinite(this.right)&&Number.isFinite(this.left)&&Number.isFinite(this.top)&&Number.isFinite(this.bottom)&&Number.isFinite(this.near)&&Number.isFinite(this.far));const{top:t,bottom:e,right:n,left:r,near:i,far:s}=this;(t!==this._top||e!==this._bottom||r!==this._left||n!==this._right||i!==this._near||s!==this._far)&&(ve(this.near>0&&this.nearnull!==t&&typeof t<"u")(t)&&t instanceof ur)&&(this._update(),t._update(),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this.near===t.near&&this.far===t.far&&this._offCenterFrustum.equals(t._offCenterFrustum))}get projectionMatrix(){return this._update(),this._offCenterFrustum.projectionMatrix}get infiniteProjectionMatrix(){return this._update(),this._offCenterFrustum.infiniteProjectionMatrix}get fovy(){return this._update(),this._fovy}get sseDenominator(){return this._update(),this._sseDenominator}computeCullingVolume(t,e,n){return this._update(),this._offCenterFrustum.computeCullingVolume(t,e,n)}getPixelDimensions(t,e,n,r){return this._update(),this._offCenterFrustum.getPixelDimensions(t,e,n,r||new Fe)}_update(){ve(Number.isFinite(this.fov)&&Number.isFinite(this.aspectRatio)&&Number.isFinite(this.near)&&Number.isFinite(this.far));const t=this._offCenterFrustum;(this.fov!==this._fov||this.aspectRatio!==this._aspectRatio||this.near!==this._near||this.far!==this._far||this.xOffset!==this._xOffset||this.yOffset!==this._yOffset)&&(ve(this.fov>=0&&this.fov0),ve(this.near>=0&&this.nearn&&(r=e,n=i)}const i=Ar[r],s=yr[r];let o=1,a=0;if(Math.abs(t[dr.getElementIndex(s,i)])>1e-15){const e=(t[dr.getElementIndex(s,s)]-t[dr.getElementIndex(i,i)])/2/t[dr.getElementIndex(s,i)];let n;n=e<0?-1/(-e+Math.sqrt(1+e*e)):1/(e+Math.sqrt(1+e*e)),o=1/Math.sqrt(1+n*n),a=n*o}return $e.IDENTITY.to(e),e[dr.getElementIndex(i,i)]=e[dr.getElementIndex(s,s)]=o,e[dr.getElementIndex(s,i)]=a,e[dr.getElementIndex(i,s)]=-a,e}const Cr=new Qe,wr=new Qe,Er=new Qe,vr=new Qe,Tr=new Qe,_r=new $e,xr={diagonal:new $e,unitary:new $e};let Mr=function(t){return t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE",t}({}),Ir=function(t){return t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh",t}({}),Sr=function(t){return t.I3S="I3S",t.TILES3D="TILES3D",t}({}),Rr=function(t){return t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold",t}({});const Or="4.1.1",Fr="cmpt",Dr="pnts",Gr="b3dm",Lr="i3dm",Ur="glTF";function Nr(t,e,n){o(t instanceof ArrayBuffer);const r=new TextDecoder("utf8"),i=new Uint8Array(t,e,n);return r.decode(i)}function Pr(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=new DataView(t);return`${String.fromCharCode(n.getUint8(e+0))}${String.fromCharCode(n.getUint8(e+1))}${String.fromCharCode(n.getUint8(e+2))}${String.fromCharCode(n.getUint8(e+3))}`}const Hr={name:"Draco",id:"draco",module:"draco",version:"4.1.1",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Jr(t,e,n){return function(t,e,n){const r=function(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}(e.value),i=n||function(t){const e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:r}]},nullable:!1,metadata:i}}(t,e,n?jr(n.metadata):void 0)}function jr(t){Object.entries(t);const e={};for(const n in t)e[`${n}.string`]=JSON.stringify(t[n]);return e}const kr={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Vr={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Kr{constructor(t){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new this.draco.DecoderBuffer;n.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);const r=this.decoder.GetEncodedGeometryType(n),i=r===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let t;switch(r){case this.draco.TRIANGULAR_MESH:t=this.decoder.DecodeBufferToMesh(n,i);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(n,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!i.ptr){const e=`DRACO decompression failed: ${t.error_msg()}`;throw new Error(e)}const s=this._getDracoLoaderData(i,r,e),o=this._getMeshData(i,s,e),a=function(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;const a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let t=0;ti?c:i,s=h>s?h:s,o=l>o?l:o}return[[e,n,r],[i,s,o]]}(o.attributes),c=function(t,e,n){const r=jr(e.metadata),i=[],s=function(t){const e={};for(const n in t){const r=t[n];e[r.name||"undefined"]=r}return e}(e.attributes);for(const e in t){const n=Jr(e,t[e],s[e]);i.push(n)}if(n){const t=Jr("indices",n);i.push(t)}return{fields:i,metadata:r}}(o.attributes,s,o.indices);return{loader:"draco",loaderData:s,header:{vertexCount:i.num_points(),boundingBox:a},...o,schema:c}}finally{this.draco.destroy(n),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,e,n){const r=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,n);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:r,attributes:i}}_getDracoAttributes(t,e){const n={};for(let r=0;rthis.decoder[t])).includes(r)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits(),range:e.range(),min_values:new Float32Array([1,2,3]).map((t=>e.min_value(t)))}}finally{this.draco.destroy(e)}}return null}_getOctahedronTransform(t,e){const{octahedronAttributes:n=[]}=e,r=t.attribute_type();if(n.map((t=>this.decoder[t])).includes(r)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits()}}finally{this.draco.destroy(e)}}return null}}const Qr="https://www.gstatic.com/draco/versioned/decoders/1.5.6",zr="draco_wasm_wrapper.js",qr="draco_decoder.wasm",Wr="draco_decoder.js",Yr="draco_encoder.js",Xr={[zr]:`${Qr}/${zr}`,[qr]:`${Qr}/draco_decoder.wasm`,[Wr]:`${Qr}/draco_decoder.js`,[Yr]:`https://raw.githubusercontent.com/google/draco/1.4.1/javascript/${Yr}`};let Zr;const $r={...Hr,parse:async function(t,e){const{draco:n}=await async function(t){const e=t.modules||{};return Zr=e.draco3d?Zr||e.draco3d.createDecoderModule({}).then((t=>({draco:t}))):Zr||async function(t){let e,n;return"js"===(t.draco&&t.draco.decoderType)?e=await O(Xr["draco_decoder.js"],"draco",t,Wr):[e,n]=await Promise.all([await O(Xr[zr],"draco",t,zr),await O(Xr[qr],"draco",t,qr)]),e=e||globalThis.DracoDecoderModule,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t({...n,onModuleLoaded:t=>e({draco:t})})}))}(e,n)}(t),await Zr}(e),r=new Kr(n);try{return r.parseSync(t,null==e?void 0:e.draco)}finally{r.destroy()}}},ti={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},ei={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...ti},ni={[ti.DOUBLE]:Float64Array,[ti.FLOAT]:Float32Array,[ti.UNSIGNED_SHORT]:Uint16Array,[ti.UNSIGNED_INT]:Uint32Array,[ti.UNSIGNED_BYTE]:Uint8Array,[ti.BYTE]:Int8Array,[ti.SHORT]:Int16Array,[ti.INT]:Int32Array},ri={DOUBLE:ti.DOUBLE,FLOAT:ti.FLOAT,UNSIGNED_SHORT:ti.UNSIGNED_SHORT,UNSIGNED_INT:ti.UNSIGNED_INT,UNSIGNED_BYTE:ti.UNSIGNED_BYTE,BYTE:ti.BYTE,SHORT:ti.SHORT,INT:ti.INT},ii="Failed to convert GL type";class si{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(const e in ni)if(ni[e]===t)return e;throw new Error(ii)}static fromName(t){const e=ri[t];if(!e)throw new Error(ii);return e}static getArrayType(t){switch(t){case ti.UNSIGNED_SHORT_5_6_5:case ti.UNSIGNED_SHORT_4_4_4_4:case ti.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const e=ni[t];if(!e)throw new Error(ii);return e}}static getByteSize(t){return si.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return!!si.getArrayType(t)}static createTypedArray(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;return void 0===r&&(r=(e.byteLength-n)/si.getByteSize(t)),new(si.getArrayType(t))(e,n,r)}}function oi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];const n=t>>11&31,r=t>>5&63,i=31&t;return e[0]=n<<3,e[1]=r<<2,e[2]=i<<3,e}function ai(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:255;return ye(t,0,e)/e*2-1}function ci(t){return t<0?-1:1}function hi(t,e,n){return function(t,e,n,r){if(function(t,e){if(!t)throw new Error("math.gl assertion failed. undefined")}(r),t<0||t>n||e<0||e>n)throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);if(r.x=ai(t,n),r.y=ai(e,n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){const t=r.x;r.x=(1-Math.abs(r.y))*ci(t),r.y=(1-Math.abs(t))*ci(r.y)}return r.normalize()}(t,e,255,n)}new Fe,new Qe,new Fe,new Fe;class li{constructor(t,e){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=t,this.buffer=e}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return!!this.json[t]}getGlobalProperty(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ei.UNSIGNED_INT,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const r=this.json[t];return r&&Number.isFinite(r.byteOffset)?this._getTypedArrayFromBinary(t,e,n,1,r.byteOffset):r}getPropertyArray(t,e,n){const r=this.json[t];return r&&Number.isFinite(r.byteOffset)?("componentType"in r&&(e=si.fromName(r.componentType)),this._getTypedArrayFromBinary(t,e,n,this.featuresLength,r.byteOffset)):this._getTypedArrayFromArray(t,e,r)}getProperty(t,e,n,r,i){const s=this.json[t];if(!s)return s;const o=this.getPropertyArray(t,e,n);if(1===n)return o[r];for(let t=0;tt[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},fi={SCALAR:(t,e,n)=>{e[n]=t},VEC2:(t,e,n)=>{e[2*n+0]=t[0],e[2*n+1]=t[1]},VEC3:(t,e,n)=>{e[3*n+0]=t[0],e[3*n+1]=t[1],e[3*n+2]=t[2]},VEC4:(t,e,n)=>{e[4*n+0]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]},MAT2:(t,e,n)=>{e[4*n+0]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]},MAT3:(t,e,n)=>{e[9*n+0]=t[0],e[9*n+1]=t[1],e[9*n+2]=t[2],e[9*n+3]=t[3],e[9*n+4]=t[4],e[9*n+5]=t[5],e[9*n+6]=t[6],e[9*n+7]=t[7],e[9*n+8]=t[8],e[9*n+9]=t[9]},MAT4:(t,e,n)=>{e[16*n+0]=t[0],e[16*n+1]=t[1],e[16*n+2]=t[2],e[16*n+3]=t[3],e[16*n+4]=t[4],e[16*n+5]=t[5],e[16*n+6]=t[6],e[16*n+7]=t[7],e[16*n+8]=t[8],e[16*n+9]=t[9],e[16*n+10]=t[10],e[16*n+11]=t[11],e[16*n+12]=t[12],e[16*n+13]=t[13],e[16*n+14]=t[14],e[16*n+15]=t[15]}},mi=t=>void 0!==t;function pi(t,e,n){if(!t)return;const r=t.parentCounts;return t.parentIds?n(t,e):r>0?function(t,e,n){const r=t.classIds,i=t.parentCounts,s=t.parentIds,o=t.parentIndexes,a=r.length,c=scratchVisited;c.length=Math.max(c.length,a);const h=++marker,l=scratchStack;for(l.length=0,l.push(e);l.length>0;){if(c[e=l.pop()]===h)continue;c[e]=h;const r=n(t,e);if(mi(r))return r;const a=i[e],u=o[e];for(let t=0;tt,Bi={HIERARCHY:!0,extensions:!0,extras:!0};class bi{constructor(t,e,n){var r;let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,o(n>=0),this.json=t||{},this.binary=e,this.featureCount=n,this._extensions=(null===(r=this.json)||void 0===r?void 0:r.extensions)||{},this._properties={};for(const t in this.json)Bi[t]||(this._properties[t]=this.json[t]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=function(t,e,n){if(!e)return null;let r=t.getExtension("3DTILES_batch_table_hierarchy");const i=e.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=i,r=i),r?function(t,e){let n,r,i;const s=t.instancesLength,o=t.classes;let a,c=t.classIds,h=t.parentCounts,l=t.parentIds,u=s;if(mi(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,s)),mi(h))for(mi(h.byteOffset)&&(h.componentType=defaultValue(h.componentType,GL.UNSIGNED_SHORT),h.type=AttributeType.SCALAR,i=getBinaryAccessor(h),h=i.createArrayBufferView(e.buffer,e.byteOffset+h.byteOffset,s)),a=new Uint16Array(s),u=0,n=0;n{const r=t.classIds[n];return t.classes[r].name===e})))}isExactClass(t,e){return o("string"==typeof e,e),this.getExactClassName(t)===e}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){const e=this._hierarchy.classIds[t];return this._hierarchy.classes[e].name}}hasProperty(t,e){return this._checkBatchId(t),o("string"==typeof e,e),Ai(this._properties[e])||this._hasPropertyInHierarchy(t,e)}getPropertyNames(t,e){this._checkBatchId(t),(e=Ai(e)?e:[]).length=0;const n=Object.keys(this._properties);return e.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(t,e),e}getProperty(t,e){if(this._checkBatchId(t),o("string"==typeof e,e),this._binaryProperties){const n=this._binaryProperties[e];if(Ai(n))return this._getBinaryProperty(n,t)}const n=this._properties[e];if(Ai(n))return yi(n[t]);if(this._hierarchy){const n=this._getHierarchyProperty(t,e);if(Ai(n))return n}}setProperty(t,e,n){const r=this.featureCount;if(this._checkBatchId(t),o("string"==typeof e,e),this._binaryProperties){const r=this._binaryProperties[e];if(r)return void this._setBinaryProperty(r,t,n)}if(this._hierarchy&&this._setHierarchyProperty(this,t,e,n))return;let i=this._properties[e];Ai(i)||(this._properties[e]=new Array(r),i=this._properties[e]),i[t]=yi(n)}_checkBatchId(t){if(!(t>=0&&t{const r=t.classIds[n];return Ai(t.classes[r].instances[e])}));return Ai(n)}_getPropertyNamesInHierarchy(t,e){pi(this._hierarchy,t,((t,n)=>{const r=t.classIds[n],i=t.classes[r].instances;for(const t in i)i.hasOwnProperty(t)&&-1===e.indexOf(t)&&e.push(t)}))}_getHierarchyProperty(t,e){return pi(this._hierarchy,t,((t,n)=>{const r=t.classIds[n],i=t.classes[r],s=t.classIndexes[n],o=i.instances[e];return Ai(o)?Ai(o.typedArray)?this._getBinaryProperty(o,s):yi(o[s]):null}))}_setHierarchyProperty(t,e,n,r){const i=pi(this._hierarchy,e,((t,i)=>{const s=t.classIds[i],a=t.classes[s],c=t.classIndexes[i],h=a.instances[n];return!!Ai(h)&&(o(i===e,`Inherited property "${n}" is read-only.`),Ai(h.typedArray)?this._setBinaryProperty(h,c,r):h[c]=yi(r),!0)}));return Ai(i)}}function Ci(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=new DataView(e);if(t.magic=r.getUint32(n,!0),n+=4,t.version=r.getUint32(n,!0),n+=4,t.byteLength=r.getUint32(n,!0),n+=4,1!==t.version)throw new Error(`3D Tile Version ${t.version} not supported`);return n}const wi="b3dm tile in legacy format.";function Ei(t,e,n){const r=new DataView(e);let i;t.header=t.header||{};let s=r.getUint32(n,!0);n+=4;let o=r.getUint32(n,!0);n+=4;let a=r.getUint32(n,!0);n+=4;let c=r.getUint32(n,!0);return n+=4,a>=570425344?(n-=8,i=s,a=o,c=0,s=0,o=0,console.warn(wi)):c>=570425344&&(n-=4,i=a,a=s,c=o,s=0,o=0,console.warn(wi)),t.header.featureTableJsonByteLength=s,t.header.featureTableBinaryByteLength=o,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=i,n}function vi(t,e,n,r){return n=function(t,e,n,r){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:s,batchLength:o}=t.header||{};if(t.featureTableJson={BATCH_LENGTH:o||0},i&&i>0){const r=Nr(e,n,i);t.featureTableJson=JSON.parse(r)}return n+=i||0,t.featureTableBinary=new Uint8Array(e,n,s),n+(s||0)}(t,e,n),n=function(t,e,n,r){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:s}=t.header||{};if(i&&i>0){const r=Nr(e,n,i);t.batchTableJson=JSON.parse(r),n+=i,s&&s>0&&(t.batchTableBinary=new Uint8Array(e,n,s),t.batchTableBinary=new Uint8Array(t.batchTableBinary),n+=s)}return n}(t,e,n),n}function Ti(t,e,n){if(!(e||t&&t.batchIds&&n))return null;const{batchIds:r,isRGB565:i,pointCount:s=0}=t;if(r&&n){const t=new Uint8ClampedArray(3*s);for(let e=0;e255*t));t[3*e]=s[0],t[3*e+1]=s[1],t[3*e+2]=s[2]}return{type:ei.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}if(e&&i){const t=new Uint8ClampedArray(3*s);for(let n=0;n{try{n.onload=()=>t(n),n.onerror=t=>{const n=t instanceof Error?t.message:"error";e(new Error(n))}}catch(t){e(t)}}))}(s||r,e)}finally{s&&i.revokeObjectURL(s)}}const Pi={};let Hi=!0;function Ji(t){for(const e in t||Pi)return!1;return!0}function ji(t){return[...t].map((t=>t.charCodeAt(0)))}const ki=!1,Vi=!0;function Ki(t){const e=Qi(t);return function(t){const e=Qi(t);return e.byteLength>=24&&2303741511===e.getUint32(0,ki)?{mimeType:"image/png",width:e.getUint32(16,ki),height:e.getUint32(20,ki)}:null}(e)||function(t){const e=Qi(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,ki)&&255===e.getUint8(2)))return null;const{tableMarkers:n,sofMarkers:r}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)t.add(e);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}();let i=2;for(;i+9=10&&1195984440===e.getUint32(0,ki)?{mimeType:"image/gif",width:e.getUint16(6,Vi),height:e.getUint16(8,Vi)}:null}(e)||function(t){const e=Qi(t);return e.byteLength>=14&&16973===e.getUint16(0,ki)&&e.getUint32(2,Vi)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Vi),height:e.getUint32(22,Vi)}:null}(e)||function(t){const e=function(t){return function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=ji(e);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:null;if((Ji(e)||!Hi)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),Hi=!1}return await createImageBitmap(t)}(r,i)}(t,e,i);break;case"image":a=await Ni(t,e,i);break;case"data":a=await async function(t,e){var n;const{mimeType:r}=Ki(t)||{},i=null===(n=globalThis.loaders)||void 0===n?void 0:n.parseImageNode;return o(i),await i(t,r)}(t);break;default:o(!1)}return"data"===r&&(a=Fi(a)),a},tests:[t=>!!Ki(new DataView(t))],options:{image:{type:"auto",decode:!0}}},qi={};function Wi(t,e){if(!t)throw new Error(e||"assert failed: gltf")}const Yi={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Xi={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Zi=["SCALAR","VEC2","VEC3","VEC4"],$i=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],ts=new Map($i),es={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ns={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},rs={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function is(t){return Zi[t-1]||Zi[0]}function ss(t){const e=ts.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function os(t,e){const n=rs[t.componentType],r=es[t.type],i=ns[t.componentType],s=t.count*r,o=t.count*r*i;return Wi(o>=0&&o<=e.byteLength),{ArrayType:n,length:s,byteLength:o,componentByteSize:Xi[t.componentType],numberOfComponentsInElement:Yi[t.type]}}function as(t){let{images:e,bufferViews:n}=t;e=e||[],n=n||[];const r=e.map((t=>t.bufferView));n=n.filter((t=>!r.includes(t)));const i=n.reduce(((t,e)=>t+e.byteLength),0),s=e.reduce(((t,e)=>{const{width:n,height:r}=e.image;return t+n*r}),0);return i+Math.ceil(4*s*1.33)}class cs{constructor(t){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:(null==t?void 0:t.json)||{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]},buffers:(null==t?void 0:t.buffers)||[],images:(null==t?void 0:t.images)||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){const e=this.getUsedExtensions().find((e=>e===t)),n=this.getRequiredExtensions().find((e=>e===t));return"string"==typeof e||"string"==typeof n}getExtension(t){const e=this.getUsedExtensions().find((e=>e===t)),n=this.json.extensions||{};return e?n[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find((e=>e===t))?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,e){return(t.extensions||{})[e]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,e){if("object"==typeof e)return e;const n=this.json[t]&&this.json[t][e];if(!n)throw new Error(`glTF file error: Could not find ${t}[${e}]`);return n}getTypedArrayForBufferView(t){const e=(t=this.getBufferView(t)).buffer,n=this.gltf.buffers[e];Wi(n);const r=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,r,t.byteLength)}getTypedArrayForAccessor(t){const e=this.getAccessor(t);return function(t,e,n){var r,i;const s="number"==typeof n?null===(r=t.accessors)||void 0===r?void 0:r[n]:n;if(!s)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);const o=null===(i=t.bufferViews)||void 0===i?void 0:i[s.bufferView||0];if(!o)throw new Error(`No gltf buffer view for accessor ${o}`);const{arrayBuffer:a,byteOffset:c}=e[o.buffer],h=(c||0)+(s.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:u,componentByteSize:d,numberOfComponentsInElement:f}=os(s,o),m=d*f,p=o.byteStride||m;if(typeof o.byteStride>"u"||o.byteStride===m)return new l(a,h,u);const g=new l(u);for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:{};return Wi(e),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=e,this.registerUsedExtension(t),e}addRequiredExtension(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Wi(e),this.addExtension(t,e),this.registerRequiredExtension(t),e}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((e=>e===t))||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((e=>e===t))||this.json.extensionsRequired.push(t)}removeExtension(t){var e;if(null!==(e=this.json.extensions)&&void 0!==e&&e[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];const e=this.json.extensionsRemoved;e.includes(t)||e.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){const{nodeIndices:e}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:e}),this.json.scenes.length-1}addNode(t){const{meshIndex:e,matrix:n}=t;this.json.nodes=this.json.nodes||[];const r={mesh:e};return n&&(r.matrix=n),this.json.nodes.push(r),this.json.nodes.length-1}addMesh(t){const{attributes:e,indices:n,material:r,mode:i=4}=t,s={primitives:[{attributes:this._addAttributes(e),mode:i}]};if(n){const t=this._addIndices(n);s.primitives[0].indices=t}return Number.isFinite(r)&&(s.primitives[0].material=r),this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(t){const e={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(e),this.json.meshes.length-1}addImage(t,e){const n=Ki(t),r=e||(null==n?void 0:n.mimeType),i={bufferView:this.addBufferView(t),mimeType:r};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.byteLength;const r=t.byteLength;Wi(Number.isFinite(r)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);const i={buffer:e,byteOffset:n,byteLength:r};return this.byteLength+=H(r,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,e){const n={bufferView:t,type:is(e.size),componentType:e.componentType,count:e.count,max:e.max,min:e.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{size:3};const n=this.addBufferView(t);let r={min:e.min,max:e.max};(!r.min||!r.max)&&(r=this._getAccessorMinMax(t,e.size));const i={size:e.size,componentType:ss(t),count:Math.round(t.length/e.size),min:r.min,max:r.max};return this.addAccessor(n,Object.assign(i,e))}addTexture(t){const{imageIndex:e}=t,n={source:e};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,e;this.gltf.buffers=[];const n=this.byteLength,r=new ArrayBuffer(n),i=new Uint8Array(r);let s=0;for(const t of this.sourceBuffers||[])s=J(t,i,s);null!==(t=this.json)&&void 0!==t&&null!==(e=t.buffers)&&void 0!==e&&e[0]?this.json.buffers[0].byteLength=n:this.json.buffers=[{byteLength:n}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(t,e){let n=!0;for(;n;){const r=t.indexOf(e);r>-1?t.splice(r,1):n=!1}}_addAttributes(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={};for(const n in t){const r=t[n],i=this._getGltfAttributeName(n),s=this.addBinaryBuffer(r.value,r);e[i]=s}return e}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,e){const n={min:null,max:null};if(t.length3&&void 0!==arguments[3]?arguments[3]:1;const i=ls[e],s=us[n],o=ds[n],a=r*i,c=a*o;let h=t.buffer,l=t.byteOffset;return l%o!=0&&(h=new Uint8Array(h).slice(l,l+c).buffer,l=0),new s(h,l,a)}function gs(t,e,n){var r,i;const s=`TEXCOORD_${e.texCoord||0}`,o=n.attributes[s],a=t.getTypedArrayForAccessor(o),c=t.gltf.json,h=e.index,l=null===(r=c.textures)||void 0===r||null===(i=r[h])||void 0===i?void 0:i.source;if(typeof l<"u"){var u,d,f;const n=null===(u=c.images)||void 0===u||null===(d=u[l])||void 0===d?void 0:d.mimeType,r=null===(f=t.gltf.images)||void 0===f?void 0:f[l];if(r&&typeof r.width<"u"){const t=[];for(let i=0;ie===t));-1===e&&(e=r.push(t)-1),s.push(e)}const o=new Uint32Array(s),a=t.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,c=t.addBufferView(o,a,0),h=t.addAccessor(c,{size:1,componentType:ss(o),count:o.length});i.attributes[e]=h}function ys(t,e,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[0];const s={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],a=n[r+1];let c=1;e&&(-1!==e.indexOf("image/jpeg")||-1!==e.indexOf("image/png"))&&(c=4);const h=Bs(o,a,t,c);let l=0;for(const e of i){const n="number"==typeof e?Object.values(s)[e]:s[e],r=h+n.offset,i=Fi(t);if(i.data.length<=r)throw new Error(`${i.data.length} <= ${r}`);l|=i.data[r]<3&&void 0!==arguments[3]?arguments[3]:1;const i=n.width,s=hs(t)*(i-1),o=Math.round(s),a=n.height,c=hs(e)*(a-1),h=Math.round(c),l=n.components?n.components:r;return(h*i+o)*l}function bs(t,e,n,r,i){const s=[];for(let o=0;or)break;const c=e/i,h=a/i;s.push(t.slice(c,c+h))}return s}function Cs(t,e,n){const r=[];for(let i=0;i"u"&&typeof n.arrayOffsets<"u"?ms(t,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}(t,n,i,r),h=function(t,e,n){return typeof e.stringOffsets<"u"?ms(t,e.stringOffsets,e.stringOffsetType||"UINT32",n):null}(t,i,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":s=function(t,e,n,r){const i=t.array,s=t.count,o=fs(t.type,t.componentType),a=n.byteLength/o;let c;return c=t.componentType?ps(n,t.type,t.componentType,a):n,i?r?bs(c,e,r,n.length,o):s?Cs(c,e,s):[]:c}(n,r,a,c);break;case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":s=ws(r,a,c,h);break;case"ENUM":s=function(t,e,n,r,i){var s;const o=e.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");const a=null===(s=t.enums)||void 0===s?void 0:s[o];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);const c=a.valueType||"UINT16",h=fs(e.type,c),l=r.byteLength/h;let u=ps(r,e.type,c,l);if(u||(u=r),e.array){if(i)return function(t){const{valuesData:e,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:i,elementSize:s,enumEntry:o}=t,a=[];for(let t=0;ti)break;const h=Rs(e,n/s,c/s,o);a.push(h)}return a}({valuesData:u,numberOfElements:n,arrayOffsets:i,valuesDataBytesLength:r.length,elementSize:h,enumEntry:a});const t=e.count;return t?function(t,e,n,r){const i=[];for(let s=0;s"u"&&typeof n.arrayOffsetBufferView<"u"?ms(t,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}(t,n,i,r),h=function(t,e,n,r){return typeof n.stringOffsetBufferView<"u"?ms(t,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}(t,0,i,r);return"STRING"===n.type||"STRING"===n.componentType?s=ws(r,a,c,h):function(t){const e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(t.type)||typeof t.componentType<"u"&&e.includes(t.componentType)}(n)&&(s=function(t,e,n,r){const i="ARRAY"===t.type,s=t.componentCount,o="SCALAR",a=t.componentType||t.type,c=fs(o,a),h=ps(n,o,a,n.byteLength/c);return i?r?bs(h,e,r,n.length,c):s?Cs(h,e,s):[]:h}(n,r,a,c)),s}function Ps(t,e,n){const r=t.gltf.json;if(!r.meshes)return[];const i=[];for(const s of r.meshes)for(const r of s.primitives)Hs(t,n,e,i,r);return i}function Hs(t,e,n,r,i){const s=gs(t,{channels:n.channels,...n.texture},i);s&&As(t,e,s,r,i)}const Js=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e){!function(t,e){var n,r;if(null===(n=e.gltf)||void 0===n||!n.loadBuffers)return;const i=t.getExtension("EXT_feature_metadata");i&&(null!==(r=e.gltf)&&void 0!==r&&r.loadImages&&function(t,e){const n=e.schema;if(!n)return;const r=n.classes,{featureTextures:i}=e;if(r&&i)for(const e in r){const n=r[e],s=Gs(i,e);s&&Us(t,s,n)}}(t,i),function(t,e){const n=e.schema;if(!n)return;const r=n.classes,i=e.featureTables;if(r&&i)for(const e in r){const r=Ds(i,e);r&&Ls(t,n,r)}}(t,i))}(new cs(t),e)},name:"EXT_feature_metadata"},Symbol.toStringTag,{value:"Module"}));let js,ks;async function Vs(t){const e=t.modules||{};return e.basis?e.basis:(js=js||async function(t){let e=null,n=null;return[e,n]=await Promise.all([await O("basis_transcoder.js","textures",t),await O("basis_transcoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t(n).then((t=>{const{BasisFile:n,initializeBasis:r}=t;r(),e({BasisFile:n})}))}))}(e,n)}(t),await js)}async function Ks(t){const e=t.modules||{};return e.basisEncoder?e.basisEncoder:(ks=ks||async function(t){let e=null,n=null;return[e,n]=await Promise.all([await O("basis_encoder.js","textures",t),await O("basis_encoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t(n).then((t=>{const{BasisFile:n,KTX2File:r,initializeBasis:i,BasisEncoder:s}=t;i(),e({BasisFile:n,KTX2File:r,BasisEncoder:s})}))}))}(e,n)}(t),await ks)}const Qs=["","WEBKIT_","MOZ_"],zs={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"};let qs=null;var Ws,Ys,Xs,Zs,$s,to,eo,no;(function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB"})(Ws||(Ws={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(Ys||(Ys={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(Xs||(Xs={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(Zs||(Zs={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}($s||($s={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(to||(to={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(eo||(eo={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(no||(no={}));const ro=[171,75,84,88,32,50,48,187,13,10,26,10],io={etc1:{basisFormat:0,compressed:!0,format:36196},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:33776},bc3:{basisFormat:3,compressed:!0,format:33779},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:35840},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:35842},"astc-4x4":{basisFormat:10,compressed:!0,format:37808},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};function so(t,e,n){const r=new t(new Uint8Array(e));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");const t=r.getNumImages(),e=[];for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}function go(t,e,n){o(t.header.byteLength>20);const r=e.getUint32(n+0,fo),i=e.getUint32(n+4,fo);return n+=8,o(0===i),yo(t,e,n,r),(n+=r)+Bo(t,e,n,t.header.byteLength)}function Ao(t,e,n,r){return o(t.header.byteLength>20),function(t,e,n,r){for(;n+8<=t.header.byteLength;){const i=e.getUint32(n+0,fo),s=e.getUint32(n+4,fo);switch(n+=8,s){case 1313821514:yo(t,e,n,i);break;case 5130562:Bo(t,e,n,i);break;case 0:r.strict||yo(t,e,n,i);break;case 1:r.strict||Bo(t,e,n,i)}n+=H(i,4)}}(t,e,n,r),n+t.header.byteLength}function yo(t,e,n,r){const i=new Uint8Array(e.buffer,n,r),s=new TextDecoder("utf8").decode(i);return t.json=JSON.parse(s),H(r,4)}function Bo(t,e,n,r){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:e.buffer}),H(r,4)}function bo(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;const n=e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return n.substr(0,n.lastIndexOf("/")+1)+t}const Co=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),wo=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),Eo={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},vo={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};let To;async function _o(){return To||(To=async function(){let t="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYA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ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support"));const e=await WebAssembly.instantiate(function(t){const e=new Uint8Array(t.length);for(let n=0;n96?r-71:r>64?r-65:r>47?r+4:r>46?63:62}let n=0;for(let r=0;r5&&void 0!==arguments[5]?arguments[5]:"NONE";const o=await _o();xo(o,o.exports[vo[i]],t,e,n,r,o.exports[Eo[s||"NONE"]])}(d,o,s,u,a,c),t.removeObjectExtension(e,Mo)}}const So=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e){var n,r;const i=new cs(t);if(null==e||null===(n=e.gltf)||void 0===n||!n.decompressMeshes||null===(r=e.gltf)||void 0===r||!r.loadBuffers)return;const s=[];for(const e of t.json.bufferViews||[])s.push(Io(i,e));await Promise.all(s),i.removeExtension(Mo)},name:"EXT_meshopt_compression"},Symbol.toStringTag,{value:"Module"})),Ro="EXT_texture_webp",Oo=Object.freeze(Object.defineProperty({__proto__:null,name:"EXT_texture_webp",preprocess:function(t,e){const n=new cs(t);if(!function(t){if(void 0===qi[t]){const e=a?function(t){switch(t){case"image/avif":case"image/webp":return function(t){try{return 0===document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)}catch{return!1}}(t);default:return!0}}(t):function(t){var e,n;const r=(null===(e=globalThis.loaders)||void 0===e?void 0:e.imageFormatsNode)||["image/png","image/jpeg","image/gif"];return!!(null===(n=globalThis.loaders)||void 0===n?void 0:n.parseImageNode)&&r.includes(t)}(t);qi[t]=e}return qi[t]}("image/webp")){if(n.getRequiredExtensions().includes(Ro))throw new Error(`gltf: Required extension ${Ro} not supported by browser`);return}const{json:r}=n;for(const t of r.textures||[]){const e=n.getObjectExtension(t,Ro);e&&(t.source=e.source),n.removeObjectExtension(t,Ro)}n.removeExtension(Ro)}},Symbol.toStringTag,{value:"Module"})),Fo="KHR_texture_basisu",Do=Object.freeze(Object.defineProperty({__proto__:null,name:"KHR_texture_basisu",preprocess:function(t,e){const n=new cs(t),{json:r}=n;for(const t of r.textures||[]){const e=n.getObjectExtension(t,Fo);e&&(t.source=e.source,n.removeObjectExtension(t,Fo))}n.removeExtension(Fo)}},Symbol.toStringTag,{value:"Module"}));function Go(t){const{buffer:e,size:n,count:r}=function(t){let e=t,n=1,r=0;return t&&t.value&&(e=t.value,n=t.size||1),e&&(ArrayBuffer.isView(e)||(e=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t?Array.isArray(t)?new e(t):!n||t instanceof e?t:new e(t):null}(e,Float32Array)),r=e.length/n),{buffer:e,size:n,count:r}}(t);return{value:e,size:n,byteOffset:0,count:r,type:is(n),componentType:ss(e)}}const Lo="KHR_draco_mesh_compression";async function Uo(t,e,n,r){const i=t.getObjectExtension(e,Lo);if(!i)return;const o=t.getTypedArrayForBufferView(i.bufferView),a=P(o.buffer,o.byteOffset),c={...n};delete c["3d-tiles"];const h=await s(a,$r,c,r),l=function(t){const e={};for(const n in t){const r=t[n];if("indices"!==n){const t=Go(r);e[n]=t}}return e}(h.attributes);for(const[n,r]of Object.entries(l))if(n in e.attributes){const i=e.attributes[n],s=t.getAccessor(i);null!=s&&s.min&&null!=s&&s.max&&(r.min=s.min,r.max=s.max)}e.attributes=l,h.indices&&(e.indices=Go(h.indices)),t.removeObjectExtension(e,Lo),function(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(e)}function No(t,e){var n;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,i=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(!i.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=i.DracoWriter.encodeSync({attributes:t}),a=null==s||null===(n=s.parseSync)||void 0===n?void 0:n.call(s,{attributes:t}),c=i._addFauxAttributes(a.attributes),h=i.addBufferView(o);return{primitives:[{attributes:c,mode:r,extensions:{[Lo]:{bufferView:h,attributes:c}}}]}}function*Po(t){for(const e of t.json.meshes||[])for(const t of e.primitives)yield t}const Ho=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e,n){var r;if(null==e||null===(r=e.gltf)||void 0===r||!r.decompressMeshes)return;const i=new cs(t),s=[];for(const t of Po(i))i.getObjectExtension(t,Lo)&&s.push(Uo(i,t,e,n));await Promise.all(s),i.removeExtension(Lo)},encode:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new cs(t);for(const t of n.json.meshes||[])No(t,e),n.addRequiredExtension(Lo)},name:"KHR_draco_mesh_compression",preprocess:function(t,e,n){const r=new cs(t);for(const t of Po(r))r.getObjectExtension(t,Lo)}},Symbol.toStringTag,{value:"Module"})),Jo="KHR_texture_transform",jo=new Qe,ko=new $e,Vo=new $e;function Ko(t,e){var n,r,i;const s=[],o=null===(n=e.json.materials)||void 0===n?void 0:n[t],a=null==o||null===(r=o.pbrMetallicRoughness)||void 0===r?void 0:r.baseColorTexture;a&&Qo(e,t,a,s);const c=null==o?void 0:o.emissiveTexture;c&&Qo(e,t,c,s);const h=null==o?void 0:o.normalTexture;h&&Qo(e,t,h,s);const l=null==o?void 0:o.occlusionTexture;l&&Qo(e,t,l,s);const u=null==o||null===(i=o.pbrMetallicRoughness)||void 0===i?void 0:i.metallicRoughnessTexture;u&&Qo(e,t,u,s)}function Qo(t,e,n,r){const i=function(t,e){var n;const r=null===(n=t.extensions)||void 0===n?void 0:n[Jo],{texCoord:i=0}=t,{texCoord:s=i}=r;if(-1===e.findIndex((t=>{let[e,n]=t;return e===i&&n===s}))){const n=function(t){const{offset:e=[0,0],rotation:n=0,scale:r=[1,1]}=t,i=(new $e).set(1,0,0,0,1,0,e[0],e[1],1),s=ko.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=Vo.set(r[0],0,0,0,r[1],0,0,0,1);return i.multiplyRight(s).multiplyRight(o)}(r);return i!==s&&(t.texCoord=s),e.push([i,s]),{originalTexCoord:i,texCoord:s,matrix:n}}return null}(n,r);if(!i)return;const s=t.json.meshes||[];for(const n of s)for(const r of n.primitives){const n=r.material;Number.isFinite(n)&&e===n&&zo(t,r,i)}}function zo(t,e,n){const{originalTexCoord:r,texCoord:i,matrix:s}=n,o=e.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){var a;const n=null===(a=t.json.accessors)||void 0===a?void 0:a[o];if(n&&n.bufferView){var c;const o=null===(c=t.json.bufferViews)||void 0===c?void 0:c[n.bufferView];if(o){const{arrayBuffer:a,byteOffset:c}=t.buffers[o.buffer],h=(c||0)+(n.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:u}=os(n,o),d=Xi[n.componentType],f=Yi[n.type],m=o.byteStride||d*f,p=new Float32Array(u);for(let t=0;t{t.uniforms[e].value&&!(e in n)&&(n[e]=t.uniforms[e].value)})),Object.keys(n).forEach((t=>{"object"==typeof n[t]&&void 0!==n[t].index&&(n[t].texture=e.getTexture(n[t].index))})),n}const ea=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t){const e=new cs(t),{json:n}=e,r=e.getExtension($o);if(r){const t=function(t,e){const{programs:n=[],shaders:r=[],techniques:i=[]}=t,s=new TextDecoder;return r.forEach((t=>{if(!Number.isFinite(t.bufferView))throw new Error("KHR_techniques_webgl: no shader code");t.code=s.decode(e.getTypedArrayForBufferView(t.bufferView))})),n.forEach((t=>{t.fragmentShader=r[t.fragmentShader],t.vertexShader=r[t.vertexShader]})),i.forEach((t=>{t.program=n[t.program]})),i}(r,e);for(const r of n.materials||[]){const n=e.getObjectExtension(r,$o);n&&(r.technique=Object.assign({},n,t[n.technique]),r.technique.values=ta(r.technique,e)),e.removeObjectExtension(r,$o)}e.removeExtension($o)}},encode:async function(t,e){},name:"KHR_techniques_webgl"},Symbol.toStringTag,{value:"Module"})),na=[Fs,vs,So,Oo,Do,Ho,Yo,Zo,ea,qo,Js];function ra(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=na.filter((t=>sa(t.name,e)));for(const s of r){var i;null===(i=s.preprocess)||void 0===i||i.call(s,t,e,n)}}async function ia(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=na.filter((t=>sa(t.name,e)));for(const s of r){var i;await(null===(i=s.decode)||void 0===i?void 0:i.call(s,t,e,n))}}function sa(t,e){var n;const r=(null==e||null===(n=e.gltf)||void 0===n?void 0:n.excludeExtensions)||{};return!(t in r&&!r[t])}const oa="KHR_binary_glTF",aa={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},ca={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class ha{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(t,e){this.json=t.json;const n=t.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn(`glTF: Unknown version ${n.asset.version}`)}if(!e.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),function(t){const e=new cs(t),{json:n}=e;for(const t of n.images||[]){const n=e.getObjectExtension(t,oa);n&&Object.assign(t,n),e.removeObjectExtension(t,oa)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,e.removeExtension(oa)}(t),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(const e in aa)this._convertTopLevelObjectToArray(t,e)}_convertTopLevelObjectToArray(t,e){const n=t[e];if(n&&!Array.isArray(n)){t[e]=[];for(const r in n){const i=n[r];i.id=i.id||r;const s=t[e].length;t[e].push(i),this.idToIndexMap[e][r]=s}}}_convertObjectIdsToArrayIndices(t){for(const e in aa)this._convertIdsToIndices(t,e);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(const e of t.textures)this._convertTextureIds(e);for(const e of t.meshes)this._convertMeshIds(e);for(const e of t.nodes)this._convertNodeIds(e);for(const e of t.scenes)this._convertSceneIds(e)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(const e of t.primitives){const{attributes:t,indices:n,material:r}=e;for(const e in t)t[e]=this._convertIdToIndex(t[e],"accessor");n&&(e.indices=this._convertIdToIndex(n,"accessor")),r&&(e.material=this._convertIdToIndex(r,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map((t=>this._convertIdToIndex(t,"node")))),t.meshes&&(t.meshes=t.meshes.map((t=>this._convertIdToIndex(t,"mesh"))))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map((t=>this._convertIdToIndex(t,"node"))))}_convertIdsToIndices(t,e){t[e]||(console.warn(`gltf v1: json doesn't contain attribute ${e}`),t[e]=[]);for(const n of t[e])for(const t in n){const e=n[t],r=this._convertIdToIndex(e,t);n[t]=r}}_convertIdToIndex(t,e){const n=ca[e];if(n in this.idToIndexMap){const r=this.idToIndexMap[n][t];if(!Number.isFinite(r))throw new Error(`gltf v1: failed to resolve ${e} with id ${t}`);return r}return t}_updateObjects(t){for(const t of this.json.buffers)delete t.type}_updateMaterial(t){for(const i of t.materials){var e,n,r;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const s=(null===(e=i.values)||void 0===e?void 0:e.tex)||(null===(n=i.values)||void 0===n?void 0:n.texture2d_0)||(null===(r=i.values)||void 0===r?void 0:r.diffuseTex),o=t.textures.findIndex((t=>t.id===s));-1!==o&&(i.pbrMetallicRoughness.baseColorTexture={index:o})}}}function la(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(new ha).normalize(t,e)}async function ua(t,e){var n,r,i;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return da(t,e,s,o),la(t,{normalize:null==o||null===(n=o.gltf)||void 0===n?void 0:n.normalize}),ra(t,o,a),null!=o&&null!==(r=o.gltf)&&void 0!==r&&r.loadBuffers&&t.json.buffers&&await fa(t,o,a),null!=o&&null!==(i=o.gltf)&&void 0!==i&&i.loadImages&&await ma(t,o,a),await ia(t,o,a),t}function da(t,e,n,r){if(r.uri&&(t.baseUri=r.uri),e instanceof ArrayBuffer&&!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new DataView(t),{magic:i=mo}=n,s=r.getUint32(e,!1);return s===i||s===mo}(e,n,r)&&(e=(new TextDecoder).decode(e)),"string"==typeof e)t.json=function(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;return"string"==typeof t?t.slice(0,e):ArrayBuffer.isView(t)?U(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?U(t,0,e):""}(t)}"`)}}(e);else if(e instanceof ArrayBuffer){const i={};n=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=new DataView(e),i=po(r,n+0),s=r.getUint32(n+4,fo),o=r.getUint32(n+8,fo);switch(Object.assign(t,{header:{byteOffset:n,byteLength:o,hasBinChunk:!1},type:i,version:s,json:{},binChunks:[]}),n+=12,t.version){case 1:return go(t,r,n);case 2:return Ao(t,r,n,{});default:throw new Error(`Invalid GLB version ${t.version}. Only supports version 1 and 2.`)}}(i,e,n,r.glb),Wi("glTF"===i.type,`Invalid GLB magic string ${i.type}`),t._glb=i,t.json=i.json}else Wi(!1,"GLTF: must be ArrayBuffer or string");const i=t.json.buffers||[];if(t.buffers=new Array(i.length).fill(null),t._glb&&t._glb.header.hasBinChunk){const{binChunks:e}=t._glb;t.buffers[0]={arrayBuffer:e[0].arrayBuffer,byteOffset:e[0].byteOffset,byteLength:e[0].byteLength}}const s=t.json.images||[];t.images=new Array(s.length).fill({})}async function fa(t,e,n){const r=t.json.buffers||[];for(let o=0;o1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;e={...ga.options,...e},e.gltf={...ga.options.gltf,...e.gltf};const{byteOffset:r=0}=e;return await ua({},t,r,e,n)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}},Aa={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ya={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ba={magFilter:10240,minFilter:10241,wrapS:10242,wrapT:10243},ba={10240:9729,10241:9986,10242:10497,10243:10497};class Ca{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{json:n,buffers:r=[],images:i=[]}=t,{baseUri:s=""}=t;return Wi(n),this.baseUri=s,this.buffers=r,this.images=i,this.jsonUnprocessed=n,this.json=this._resolveTree(t.json,e),this.json}_resolveTree(t){const e={...t};return this.json=e,t.bufferViews&&(e.bufferViews=t.bufferViews.map(((t,e)=>this._resolveBufferView(t,e)))),t.images&&(e.images=t.images.map(((t,e)=>this._resolveImage(t,e)))),t.samplers&&(e.samplers=t.samplers.map(((t,e)=>this._resolveSampler(t,e)))),t.textures&&(e.textures=t.textures.map(((t,e)=>this._resolveTexture(t,e)))),t.accessors&&(e.accessors=t.accessors.map(((t,e)=>this._resolveAccessor(t,e)))),t.materials&&(e.materials=t.materials.map(((t,e)=>this._resolveMaterial(t,e)))),t.meshes&&(e.meshes=t.meshes.map(((t,e)=>this._resolveMesh(t,e)))),t.nodes&&(e.nodes=t.nodes.map(((t,e)=>this._resolveNode(t,e))),e.nodes=e.nodes.map(((t,e)=>this._resolveNodeChildren(t)))),t.skins&&(e.skins=t.skins.map(((t,e)=>this._resolveSkin(t,e)))),t.scenes&&(e.scenes=t.scenes.map(((t,e)=>this._resolveScene(t,e)))),"number"==typeof this.json.scene&&e.scenes&&(e.scene=e.scenes[this.json.scene]),e}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,e){if("object"==typeof e)return e;const n=t&&t[e];return n||console.warn(`glTF file error: Could not find ${t}[${e}]`),n}_resolveScene(t,e){return{...t,id:t.id||`scene-${e}`,nodes:(t.nodes||[]).map((t=>this.getNode(t)))}}_resolveNode(t,e){const n={...t,id:(null==t?void 0:t.id)||`node-${e}`};return void 0!==t.mesh&&(n.mesh=this.getMesh(t.mesh)),void 0!==t.camera&&(n.camera=this.getCamera(t.camera)),void 0!==t.skin&&(n.skin=this.getSkin(t.skin)),void 0!==t.meshes&&t.meshes.length&&(n.mesh=t.meshes.reduce(((t,e)=>{const n=this.getMesh(e);return t.id=n.id,t.primitives=t.primitives.concat(n.primitives),t}),{primitives:[]})),n}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map((t=>this.getNode(t)))),t}_resolveSkin(t,e){const n="number"==typeof t.inverseBindMatrices?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${e}`,inverseBindMatrices:n}}_resolveMesh(t,e){const n={...t,id:t.id||`mesh-${e}`,primitives:[]};return t.primitives&&(n.primitives=t.primitives.map((t=>{const e={...t,attributes:{},indices:void 0,material:void 0},n=t.attributes;for(const t in n)e.attributes[t]=this.getAccessor(n[t]);return void 0!==t.indices&&(e.indices=this.getAccessor(t.indices)),void 0!==t.material&&(e.material=this.getMaterial(t.material)),e}))),n}_resolveMaterial(t,e){const n={...t,id:t.id||`material-${e}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};const t=n.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,e){const n=function(t){return ya[t]}(t.componentType),r=function(t){return Aa[t]}(t.type),i=n*r,s={...t,id:t.id||`accessor-${e}`,bytesPerComponent:n,components:r,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(void 0!==t.bufferView&&(s.bufferView=this.getBufferView(t.bufferView)),s.bufferView){const t=s.bufferView.buffer,{ArrayType:e,byteLength:n}=os(s,s.bufferView),r=(s.bufferView.byteOffset||0)+(s.byteOffset||0)+t.byteOffset;let i=t.arrayBuffer.slice(r,r+n);s.bufferView.byteStride&&(i=this._getValueFromInterleavedBuffer(t,r,s.bufferView.byteStride,s.bytesPerElement,s.count)),s.value=new e(i)}return s}_getValueFromInterleavedBuffer(t,e,n,r,i){const s=new Uint8Array(i*r);for(let o=0;o12;){const o={shape:"tile3d"};t.tiles.push(o),n=await s(e,n,r,i,o)}return n}async function Ma(t,e,n,r){var i,o;if(t.rotateYtoZ=!0,t.gltfUpAxis=null!=n&&null!==(i=n["3d-tiles"])&&void 0!==i&&i.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",null!=n&&null!==(o=n["3d-tiles"])&&void 0!==o&&o.loadGLTF){if(!r)return e.byteLength;const i=await s(e,ga,n,r);t.gltf=wa(i),t.gpuMemoryUsageInBytes=as(t.gltf)}else t.gltfArrayBuffer=e;return e.byteLength}async function Ia(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{shape:"tile3d"};switch(i.byteOffset=e,i.type=Pr(t,e),i.type){case Fr:return await xa(i,t,e,n,r,Ia);case Gr:return await Ta(i,t,e,n,r);case Ur:return await Ma(i,t,n,r);case Lr:return await _a(i,t,e,n,r);case Dr:return await xi(i,t,e,n,r);default:throw new Error(`3DTileLoader: unknown type ${i.type}`)}}async function Sa(t,e,n,r){const i=Number.isFinite(e.bitstream)?e.bitstream:e.bufferView;if("number"!=typeof i)return;const s=t.bufferViews[i],o=t.buffers[s.buffer];if(null==r||!r.baseUrl)throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){const t=`${(null==r?void 0:r.baseUrl)||""}/${o.uri}`,n=await(await r.fetch(t)).arrayBuffer();return void(e.explicitBitstream=new Uint8Array(n,s.byteOffset,s.byteLength))}const a=t.buffers.slice(0,s.buffer).reduce(((t,e)=>t+e.byteLength),0);e.explicitBitstream=new Uint8Array(n.slice(a,a+o.byteLength),s.byteOffset,s.byteLength)}function Ra(t){const e=new DataView(t);return e.getUint32(0,!0)+2**32*e.getUint32(4,!0)}const Oa={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Or,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:async function(t,e,n){if(1952609651!==new Uint32Array(t.slice(0,4))[0])throw new Error("Wrong subtree file magic number");if(1!==new Uint32Array(t.slice(4,8))[0])throw new Error("Wrong subtree file verson, must be 1");const r=Ra(t.slice(8,16)),i=new Uint8Array(t,24,r),s=new TextDecoder("utf8").decode(i),o=JSON.parse(s),a=Ra(t.slice(16,24));let c=new ArrayBuffer(0);if(a&&(c=t.slice(24+r)),await Sa(o,o.tileAvailability,c,n),Array.isArray(o.contentAvailability))for(const t of o.contentAvailability)await Sa(o,t,c,n);else await Sa(o,o.contentAvailability,c,n);return await Sa(o,o.childSubtreeAvailability,c,n),o},options:{}};var Fa=null;try{Fa=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Da(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function Ga(t){return!0===(t&&t.__isLong__)}function La(t){var e=Math.clz32(t&-t);return t?31-e:e}Da.prototype.__isLong__,Object.defineProperty(Da.prototype,"__isLong__",{value:!0}),Da.isLong=Ga;var Ua={},Na={};function Pa(t,e){var n,r,i;return e?(i=0<=(t>>>=0)&&t<256)&&(r=Na[t])?r:(n=Ja(t,0,!0),i&&(Na[t]=n),n):(i=-128<=(t|=0)&&t<128)&&(r=Ua[t])?r:(n=Ja(t,t<0?-1:0,!1),i&&(Ua[t]=n),n)}function Ha(t,e){if(isNaN(t))return e?Ya:Wa;if(e){if(t<0)return Ya;if(t>=Qa)return ec}else{if(t<=-za)return nc;if(t+1>=za)return tc}return t<0?Ha(-t,e).neg():Ja(t%Ka|0,t/Ka|0,e)}function Ja(t,e,n){return new Da(t,e,n)}Da.fromInt=Pa,Da.fromNumber=Ha,Da.fromBits=Ja;var ja=Math.pow;function ka(t,e,n){if(0===t.length)throw Error("empty string");if("number"==typeof e?(n=e,e=!1):e=!!e,"NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return e?Ya:Wa;if((n=n||10)<2||360)throw Error("interior hyphen");if(0===r)return ka(t.substring(1),e,n).neg();for(var i=Ha(ja(n,8)),s=Wa,o=0;o>>0:this.low},rc.toNumber=function(){return this.unsigned?(this.high>>>0)*Ka+(this.low>>>0):this.high*Ka+(this.low>>>0)},rc.toString=function(t){if((t=t||10)<2||36>>0).toString(t);if((s=a).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},rc.getHighBits=function(){return this.high},rc.getHighBitsUnsigned=function(){return this.high>>>0},rc.getLowBits=function(){return this.low},rc.getLowBitsUnsigned=function(){return this.low>>>0},rc.getNumBitsAbs=function(){if(this.isNegative())return this.eq(nc)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&!(t&1<=0},rc.isOdd=function(){return 1==(1&this.low)},rc.isEven=function(){return 0==(1&this.low)},rc.equals=function(t){return Ga(t)||(t=Va(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&this.high===t.high&&this.low===t.low},rc.eq=rc.equals,rc.notEquals=function(t){return!this.eq(t)},rc.neq=rc.notEquals,rc.ne=rc.notEquals,rc.lessThan=function(t){return this.comp(t)<0},rc.lt=rc.lessThan,rc.lessThanOrEqual=function(t){return this.comp(t)<=0},rc.lte=rc.lessThanOrEqual,rc.le=rc.lessThanOrEqual,rc.greaterThan=function(t){return this.comp(t)>0},rc.gt=rc.greaterThan,rc.greaterThanOrEqual=function(t){return this.comp(t)>=0},rc.gte=rc.greaterThanOrEqual,rc.ge=rc.greaterThanOrEqual,rc.compare=function(t){if(Ga(t)||(t=Va(t)),this.eq(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},rc.comp=rc.compare,rc.negate=function(){return!this.unsigned&&this.eq(nc)?nc:this.not().add(Xa)},rc.neg=rc.negate,rc.add=function(t){Ga(t)||(t=Va(t));var e=this.high>>>16,n=65535&this.high,r=this.low>>>16,i=65535&this.low,s=t.high>>>16,o=65535&t.high,a=t.low>>>16,c=0,h=0,l=0,u=0;return l+=(u+=i+(65535&t.low))>>>16,h+=(l+=r+a)>>>16,c+=(h+=n+o)>>>16,c+=e+s,Ja((l&=65535)<<16|(u&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},rc.subtract=function(t){return Ga(t)||(t=Va(t)),this.add(t.neg())},rc.sub=rc.subtract,rc.multiply=function(t){if(this.isZero())return this;if(Ga(t)||(t=Va(t)),Fa)return Ja(Fa.mul(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned);if(t.isZero())return this.unsigned?Ya:Wa;if(this.eq(nc))return t.isOdd()?nc:Wa;if(t.eq(nc))return this.isOdd()?nc:Wa;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(qa)&&t.lt(qa))return Ha(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,n=65535&this.high,r=this.low>>>16,i=65535&this.low,s=t.high>>>16,o=65535&t.high,a=t.low>>>16,c=65535&t.low,h=0,l=0,u=0,d=0;return u+=(d+=i*c)>>>16,l+=(u+=r*c)>>>16,u&=65535,l+=(u+=i*a)>>>16,h+=(l+=n*c)>>>16,l&=65535,h+=(l+=r*a)>>>16,l&=65535,h+=(l+=i*o)>>>16,h+=e*c+n*a+r*o+i*s,Ja((u&=65535)<<16|(d&=65535),(h&=65535)<<16|(l&=65535),this.unsigned)},rc.mul=rc.multiply,rc.divide=function(t){if(Ga(t)||(t=Va(t)),t.isZero())throw Error("division by zero");var e,n,r;if(Fa)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?Ja((this.unsigned?Fa.div_u:Fa.div_s)(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Ya:Wa;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ya;if(t.gt(this.shru(1)))return Za;r=Ya}else{if(this.eq(nc))return t.eq(Xa)||t.eq($a)?nc:t.eq(nc)?Xa:(e=this.shr(1).div(t).shl(1)).eq(Wa)?t.isNegative()?Xa:$a:(n=this.sub(t.mul(e)),r=e.add(n.div(t)));if(t.eq(nc))return this.unsigned?Ya:Wa;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=Wa}for(n=this;n.gte(t);){e=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var i=Math.ceil(Math.log(e)/Math.LN2),s=i<=48?1:ja(2,i-48),o=Ha(e),a=o.mul(t);a.isNegative()||a.gt(n);)a=(o=Ha(e-=s,this.unsigned)).mul(t);o.isZero()&&(o=Xa),r=r.add(o),n=n.sub(a)}return r},rc.div=rc.divide,rc.modulo=function(t){return Ga(t)||(t=Va(t)),Fa?Ja((this.unsigned?Fa.rem_u:Fa.rem_s)(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},rc.mod=rc.modulo,rc.rem=rc.modulo,rc.not=function(){return Ja(~this.low,~this.high,this.unsigned)},rc.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},rc.clz=rc.countLeadingZeros,rc.countTrailingZeros=function(){return this.low?La(this.low):La(this.high)+32},rc.ctz=rc.countTrailingZeros,rc.and=function(t){return Ga(t)||(t=Va(t)),Ja(this.low&t.low,this.high&t.high,this.unsigned)},rc.or=function(t){return Ga(t)||(t=Va(t)),Ja(this.low|t.low,this.high|t.high,this.unsigned)},rc.xor=function(t){return Ga(t)||(t=Va(t)),Ja(this.low^t.low,this.high^t.high,this.unsigned)},rc.shiftLeft=function(t){return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?Ja(this.low<>>32-t,this.unsigned):Ja(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):Ja(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},rc.shr=rc.shiftRight,rc.shiftRightUnsigned=function(t){return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?Ja(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):Ja(32===t?this.high:this.high>>>t-32,0,this.unsigned)},rc.shru=rc.shiftRightUnsigned,rc.shr_u=rc.shiftRightUnsigned,rc.rotateLeft=function(t){var e;return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:32===t?Ja(this.high,this.low,this.unsigned):t<32?(e=32-t,Ja(this.low<>>e,this.high<>>e,this.unsigned)):(e=32-(t-=32),Ja(this.high<>>e,this.low<>>e,this.unsigned))},rc.rotl=rc.rotateLeft,rc.rotateRight=function(t){var e;return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:32===t?Ja(this.high,this.low,this.unsigned):t<32?(e=32-t,Ja(this.high<>>t,this.low<>>t,this.unsigned)):(e=32-(t-=32),Ja(this.low<>>t,this.high<>>t,this.unsigned))},rc.rotr=rc.rotateRight,rc.toSigned=function(){return this.unsigned?Ja(this.low,this.high,!1):this},rc.toUnsigned=function(){return this.unsigned?this:Ja(this.low,this.high,!0)},rc.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},rc.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},rc.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},Da.fromBytes=function(t,e,n){return n?Da.fromBytesLE(t,e):Da.fromBytesBE(t,e)},Da.fromBytesLE=function(t,e){return new Da(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},Da.fromBytesBE=function(t,e){return new Da(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)};const sc=180/Math.PI;function oc(t,e,n){const r=1<=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function cc(t){return[ac(t[0]),ac(t[1])]}function hc(t,e){let[n,r]=e;switch(t){case 0:return[1,n,r];case 1:return[-n,1,r];case 2:return[-n,-r,1];case 3:return[-1,-r,-n];case 4:return[r,-1,-n];case 5:return[r,n,-1];default:throw new Error("Invalid face")}}function lc(t){let[e,n,r]=t;const i=Math.atan2(r,Math.sqrt(e*e+n*n));return[Math.atan2(n,e)*sc,i*sc]}function uc(t,e,n,r){if(0===r){1===n&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const r=e[0];e[0]=e[1],e[1]=r}}function dc(t){const{face:e,ij:n,level:r}=t,i=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(100*Math.pow(2,-r))),o=new Float64Array(4*s*2+2);let a=0,c=0;for(let t=0;t<4;t++){const h=i[t].slice(0),l=i[t+1],u=(l[0]-h[0])/s,d=(l[1]-h[1])/s;for(let t=0;t89.999&&(t[0]=c);const i=t[0]-c;t[0]+=i>180?-360:i<-180?360:0,o[a++]=t[0],o[a++]=t[1],c=t[0]}}return o[a++]=o[0],o[a++]=o[1],o}function fc(t){const e=function(t){return t.indexOf("/")>0?t:function(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<64;)e="0"+e;const n=e.lastIndexOf("1"),r=e.substring(0,3),i=e.substring(3,n),s=i.length/2,o=Da.fromString(r,!0,2).toString(10);let a="";if(0!==s)for(a=Da.fromString(i,!0,2).toString(4);a.length=0;t--){s=i-t;const e=r[t];let n=0,a=0;"1"===e?a=1:"2"===e?(n=1,a=1):"3"===e&&(n=1);const c=Math.pow(2,s-1);uc(c,o,n,a),o[0]+=c*n,o[1]+=c*a}if(n%2==1){const t=o[0];o[0]=o[1],o[1]=t}return{face:n,ij:o,level:s}}(e)}function mc(t){if(t.length%2!=0)throw new Error("Invalid corners");const e=[],n=[];for(let r=0;rt-e)),n.sort(((t,e)=>t-e)),{west:e[0],east:e[e.length-1],north:n[n.length-1],south:n[0]}}function pc(t){const e=t.token,n={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},r=function(t,e){const n=(null==e?void 0:e.minimumHeight)||0,r=(null==e?void 0:e.maximumHeight)||0,i=function(t){let e;if(2===t.face||5===t.face){let n=null,r=0;for(let e=0;e<4;e++){const i=dc(fc(`${t.face}/${e}`));(typeof n>"u"||null===n)&&(n=new Float64Array(4*i.length)),n.set(i,r),r+=i.length}e=mc(n)}else e=mc(dc(t));return e}(fc(t)),s=i.west,o=i.south,a=i.east,c=i.north,h=[];return h.push(new Qe(s,c,n)),h.push(new Qe(a,c,n)),h.push(new Qe(a,o,n)),h.push(new Qe(s,o,n)),h.push(new Qe(s,c,r)),h.push(new Qe(a,c,r)),h.push(new Qe(a,o,r)),h.push(new Qe(s,o,r)),h}(e,n),i=function(t){return function(t){const e=cc(oc(t.ij,t.level,[.5,.5]));return lc(hc(t.face,e))}(fc(t))}(e),s=i[0],o=i[1],a=Hn.WGS84.cartographicToCartesian([s,o,n.maximumHeight]),c=new Qe(a[0],a[1],a[2]);r.push(c);const h=function(t,e=new Xn){if(!t||0===t.length)return e.halfAxes=new $e([0,0,0,0,0,0,0,0,0]),e.center=new Qe,e;const n=t.length,r=new Qe(0,0,0);for(const e of t)r.add(e);const i=1/n;r.multiplyByScalar(i);let s=0,o=0,a=0,c=0,h=0,l=0;for(const e of t){const t=Cr.copy(e).subtract(r);s+=t.x*t.x,o+=t.x*t.y,a+=t.x*t.z,c+=t.y*t.y,h+=t.y*t.z,l+=t.z*t.z}s*=i,o*=i,a*=i,c*=i,h*=i,l*=i;const u=_r;u[0]=s,u[1]=o,u[2]=a,u[3]=o,u[4]=c,u[5]=h,u[6]=a,u[7]=h,u[8]=l;const{unitary:d}=function(t,e={}){let n=0,r=0;const i=fr,s=mr;i.identity(),s.copy(t);const o=1e-20*function(t){let e=0;for(let n=0;n<9;++n){const r=t[n];e+=r*r}return Math.sqrt(e)}(s);for(;r<10&&Br(s)>o;)br(s,pr),gr.copy(pr).transpose(),s.multiplyRight(pr),s.multiplyLeft(gr),i.multiplyRight(pr),++n>2&&(++r,n=0);return e.unitary=i.toTarget(e.unitary),e.diagonal=s.toTarget(e.diagonal),e}(u,xr),f=e.halfAxes.copy(d);let m=f.getColumn(0,Er),p=f.getColumn(1,vr),g=f.getColumn(2,Tr),A=-Number.MAX_VALUE,y=-Number.MAX_VALUE,B=-Number.MAX_VALUE,b=Number.MAX_VALUE,C=Number.MAX_VALUE,w=Number.MAX_VALUE;for(const e of t)Cr.copy(e),A=Math.max(Cr.dot(m),A),y=Math.max(Cr.dot(p),y),B=Math.max(Cr.dot(g),B),b=Math.min(Cr.dot(m),b),C=Math.min(Cr.dot(p),C),w=Math.min(Cr.dot(g),w);m=m.multiplyByScalar(.5*(b+A)),p=p.multiplyByScalar(.5*(C+y)),g=g.multiplyByScalar(.5*(w+B)),e.center.copy(m).add(p).add(g);const E=wr.set(A-b,y-C,B-w).multiplyByScalar(.5),v=new $e([E[0],0,0,0,E[1],0,0,0,E[2]]);return e.halfAxes.multiplyRight(v),e}(r);return[...h.center,...h.halfAxes]}const gc={QUADTREE:4,OCTREE:8};function Ac(t,e,n){if(null!=t&&t.box){const r=function(t,e){const n=function(t){return t.and(t.not().add(1))}(t).shiftRightUnsigned(2);return t.add(Da.fromNumber(2*e+1-4).multiply(n))}(ic(t.s2VolumeInfo.token),e),i=function(t){if(t.isZero())return"X";let e=t.countTrailingZeros();e=(e-e%4)/4;const n=e;e*=4;const r=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-n-r.length).join("0")+r}(r),s={...t.s2VolumeInfo};if("OCTREE"===(s.token=i,n)){const e=t.s2VolumeInfo,n=e.maximumHeight-e.minimumHeight,r=n/2,i=e.minimumHeight+n/2;e.minimumHeight=i-r,e.maximumHeight=i+r}return{box:pc(s),s2VolumeInfo:s}}}async function yc(t){const{implicitOptions:e,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:i,loaderOptions:s}=t;let{subtree:o,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=t;const{subdivisionScheme:h,subtreeLevels:l,maximumLevel:u,contentUrlTemplate:d,subtreesUriTemplate:f,basePath:m}=e,p={children:[],lodMetricValue:0,contentUrl:""};if(!u)return Ot.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${d} won't be loaded...`),p;const g=a+c.level;if(g>u)return p;const A=gc[h],y=Math.log2(A),B=1&r,b=r>>1&1,C=r>>2&1,w=(A**a-1)/(A-1);let E=Cc(n.mortonIndex,r,y),v=w+E,T=Cc(n.x,B,1),_=Cc(n.y,b,1),x=Cc(n.z,C,1),M=!1;a>=l&&(M=Bc(o.childSubtreeAvailability,E));const I=Cc(c.x,T,a),S=Cc(c.y,_,a),R=Cc(c.z,x,a);if(M){const t=wc(`${m}/${f}`,g,I,S,R);o=await he(t,Oa,s),c={mortonIndex:E,x:T,y:_,z:x,level:a},E=0,v=0,T=0,_=0,x=0,a=0}if(!Bc(o.tileAvailability,v))return p;Bc(o.contentAvailability,v)&&(p.contentUrl=wc(d,g,I,S,R));const O=a+1,F={mortonIndex:E,x:T,y:_,z:x};for(let t=0;t1&&Ot.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=t,"constant"in n?!!n.constant:!!n.explicitBitstream&&function(t,e){const n=t%8;return 1==(e[Math.floor(t/8)]>>n&1)}(e,n.explicitBitstream)}function bc(t,e,n,r,i){const{basePath:s,refine:o,getRefine:a,lodMetricType:c,getTileType:h,rootLodMetricValue:l,rootBoundingVolume:u}=r,d=t.contentUrl&&t.contentUrl.replace(`${s}/`,""),f=l/2**e,m=function(t,e,n){if(e.region){const{childTileX:r,childTileY:i,childTileZ:s}=n,[o,a,c,h,l,u]=e.region,d=2**t,f=(c-o)/d,m=(h-a)/d,p=(u-l)/d,[g,A]=[o+f*r,o+f*(r+1)],[y,B]=[a+m*i,a+m*(i+1)],[b,C]=[l+p*s,l+p*(s+1)];return{region:[g,y,A,B,b,C]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${e}`)}(e,null!=i&&i.box?{box:i.box}:u,n);return{children:t.children,contentUrl:t.contentUrl,content:{uri:d},id:t.contentUrl,refine:a(o),type:h(t),lodMetricType:c,lodMetricValue:f,geometricError:f,transform:t.transform,boundingVolume:m}}function Cc(t,e,n){return(t<s[t]))}function Ec(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!e)return Ir.EMPTY;const n=e.split("?")[0].split(".").pop();switch(n){case"pnts":return Ir.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Ir.SCENEGRAPH;default:return n||Ir.EMPTY}}function vc(t){switch(t){case"REPLACE":case"replace":return Mr.REPLACE;case"ADD":case"add":return Mr.ADD;default:return t}}function Tc(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){const n=new URL(t,`${e}/`);return decodeURI(n.toString())}return t.startsWith("/")?t:function(){const t=[];for(let e=0;e=-1&&!r;i--){let s;i>=0?s=t[i]:(void 0===e&&(e=z()),s=e),0!==s.length&&(n=`${s}/${n}`,r=s.charCodeAt(0)===Y)}return n=X(n,!r),r?`/${n}`:n.length>0?n:"."}(e,t)}function _c(t,e){if(!t)return null;let n;if(t.content){var r;const i=t.content.uri||(null===(r=t.content)||void 0===r?void 0:r.url);typeof i<"u"&&(n=Tc(i,e))}return{...t,id:n,contentUrl:n,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:Ec(t,n),refine:vc(t.refine)}}async function xc(t,e,n,r,i){var s,o,a;const{subdivisionScheme:c,maximumLevel:h,availableLevels:l,subtreeLevels:u,subtrees:{uri:d}}=r,f=Tc(wc(d,0,0,0,0),n),m=await he(f,Oa,i),p=null===(s=t.content)||void 0===s?void 0:s.uri,g=p?Tc(p,n):"",A=null==e||null===(o=e.root)||void 0===o?void 0:o.refine,y=t.geometricError,B=null===(a=t.boundingVolume.extensions)||void 0===a?void 0:a["3DTILES_bounding_volume_S2"];if(B){const e={box:pc(B),s2VolumeInfo:B};t.boundingVolume=e}const b=t.boundingVolume,C={contentUrlTemplate:g,subtreesUriTemplate:d,subdivisionScheme:c,subtreeLevels:u,maximumLevel:Number.isFinite(l)?l-1:h,refine:A,basePath:n,lodMetricType:Rr.GEOMETRIC_ERROR,rootLodMetricValue:y,rootBoundingVolume:b,getTileType:Ec,getRefine:vc};return await async function(t,e,n,r,i){if(!t)return null;const{children:s,contentUrl:o}=await yc({subtree:n,implicitOptions:r,loaderOptions:i});let a,c=null;return o&&(a=o,c={uri:o.replace(`${e}/`,"")}),{...t,id:a,contentUrl:a,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:Ec(t,a),refine:vc(t.refine),content:c||t.content,children:s}}(t,n,m,C,i)}function Mc(t){var e;return(null==t||null===(e=t.extensions)||void 0===e?void 0:e["3DTILES_implicit_tiling"])||(null==t?void 0:t.implicitTiling)}const Ic={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Or,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=e["3d-tiles"]||{};let i;return i="auto"===r.isTileset?(null==n?void 0:n.url)&&-1!==n.url.indexOf(".json"):r.isTileset,i?Sc(t,e,n):Rc(t,e,n)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function Sc(t,e,n){var r;const i=JSON.parse((new TextDecoder).decode(t)),s=(null==n?void 0:n.url)||"",o=function(t){return W(t)}(s),a=await async function(t,e,n){let r=null;const i=Mc(t.root);r=i&&t.root?await xc(t.root,t,e,i,n):_c(t.root,e);const s=[];for(s.push(r);s.length>0;){const r=s.pop()||{},i=r.children||[],o=[];for(const r of i){const i=Mc(r);let a;a=i?await xc(r,t,e,i,n):_c(r,e),a&&(o.push(a),s.push(a))}r.children=o}return r}(i,o,e||{});return{...i,shape:"tileset3d",loader:Ic,url:s,queryString:(null==n?void 0:n.queryString)||"",basePath:o,root:a||i.root,type:Sr.TILES3D,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:(null===(r=i.root)||void 0===r?void 0:r.geometricError)||0}}async function Rc(t,e,n){const r={content:{shape:"tile3d",featureIds:null}};return await Ia(t,0,e,n,r.content),r.content}const Oc="https://api.cesium.com/v1/assets";async function Fc(t,e){if(!e){const n=await async function(t){o(t);const e={Authorization:`Bearer ${t}`},n=await dt("https://api.cesium.com/v1/assets",{headers:e});if(!n.ok)throw new Error(n.statusText);return await n.json()}(t);for(const t of n.items)"3DTILES"===t.type&&(e=t.id)}const n=await async function(t,e){o(t,e);const n={Authorization:`Bearer ${t}`},r=`${Oc}/${e}`;let i=await dt(`${r}`,{headers:n});if(!i.ok)throw new Error(i.statusText);let s=await i.json();if(i=await dt(`${r}/endpoint`,{headers:n}),!i.ok)throw new Error(i.statusText);const a=await i.json();return s={...s,...a},s}(t,e),{type:r,url:i}=n;return o("3DTILES"===r&&i),n.headers={Authorization:`Bearer ${n.accessToken}`},n}const Dc={...Ic,id:"cesium-ion",name:"Cesium Ion",preload:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e["cesium-ion"]||{};const{accessToken:n}=e;let r=e.assetId;if(!Number.isFinite(r)){const e=t.match(/\/([0-9]+)\/tileset.json/);r=e&&e[1]}return Fc(n,r)},parse:async(t,e,n)=>((e={...e})["3d-tiles"]=e["cesium-ion"],e.loader=Dc,Ic.parse(t,e,n)),options:{"cesium-ion":{...Ic.options["3d-tiles"],accessToken:null}}};class Gc{constructor(t,e){if(this.schema=void 0,this.options=void 0,this.shape=void 0,this.length=0,this.rows=null,this.cursor=0,this._headers=[],this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;return t?(t=t.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}}class Lc{constructor(t,e){if(this.schema=void 0,this.options=void 0,this.length=0,this.objectRows=null,this.arrayRows=null,this.cursor=0,this._headers=null,this.options=e,this.schema=t,t){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||(this._headers=function(t){const e=[];for(let n=0;n0?this.allocated*=2:100,this.columns={};for(const t in this.schema){const e=this.schema[t],n=e.type||Float32Array,r=this.columns[e.index];if(r&&ArrayBuffer.isView(r)){const t=new n(this.allocated);t.set(r),this.columns[e.index]=t}else r?(r.length=this.allocated,this.columns[e.index]=r):this.columns[e.index]=new n(this.allocated)}}}_pruneColumns(){for(const[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}}const Nc={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0};class Pc{constructor(t,e){this.schema=void 0,this.options=void 0,this.aggregator=null,this.batchCount=0,this.bytesUsed=0,this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),this.totalLength=0,this.totalBytes=0,this.rowBytes=0,this.schema=t,this.options={...Nc,...e}}limitReached(){var t,e;return!!(null!==(t=this.options)&&void 0!==t&&t.limit&&this.totalLength>=this.options.limit||null!==(e=this.options)&&void 0!==e&&e._limitMB&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),"string"==typeof t&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?8*t.length:8*Object.keys(t).length}_isFull(){if(!this.aggregator||0===this.aggregator.rowCount())return!1;if("auto"===this.options.batchSize){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return!(this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs||(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),0))}_getBatch(t){if(!this.aggregator)return null;null!=t&&t.bytesUsed&&(this.bytesUsed=t.bytesUsed);const e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return Lc;case"columnar-table":return Uc;case"arrow-table":if(!Pc.ArrowBatch)throw new Error("TableBatchBuilder");return Pc.ArrowBatch;default:return Gc}}}Pc.ArrowBatch=void 0;const Hc=Number.MAX_SAFE_INTEGER;var Jc=function(t){return t[t.BEGIN=0]="BEGIN",t[t.VALUE=1]="VALUE",t[t.OPEN_OBJECT=2]="OPEN_OBJECT",t[t.CLOSE_OBJECT=3]="CLOSE_OBJECT",t[t.OPEN_ARRAY=4]="OPEN_ARRAY",t[t.CLOSE_ARRAY=5]="CLOSE_ARRAY",t[t.TEXT_ESCAPE=6]="TEXT_ESCAPE",t[t.STRING=7]="STRING",t[t.BACKSLASH=8]="BACKSLASH",t[t.END=9]="END",t[t.OPEN_KEY=10]="OPEN_KEY",t[t.CLOSE_KEY=11]="CLOSE_KEY",t[t.TRUE=12]="TRUE",t[t.TRUE2=13]="TRUE2",t[t.TRUE3=14]="TRUE3",t[t.FALSE=15]="FALSE",t[t.FALSE2=16]="FALSE2",t[t.FALSE3=17]="FALSE3",t[t.FALSE4=18]="FALSE4",t[t.NULL=19]="NULL",t[t.NULL2=20]="NULL2",t[t.NULL3=21]="NULL3",t[t.NUMBER_DECIMAL_POINT=22]="NUMBER_DECIMAL_POINT",t[t.NUMBER_DIGIT=23]="NUMBER_DIGIT",t}(Jc||{});const jc=101,kc=/[\\"\n]/g,Vc={onready:()=>{},onopenobject:()=>{},onkey:()=>{},oncloseobject:()=>{},onopenarray:()=>{},onclosearray:()=>{},onvalue:()=>{},onerror:()=>{},onend:()=>{},onchunkparsed:()=>{}};class Kc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=Vc,this.bufferCheckPosition=Hc,this.q="",this.c="",this.p="",this.closed=!1,this.closedRoot=!1,this.sawRoot=!1,this.error=null,this.state=Jc.BEGIN,this.stack=[],this.position=0,this.column=0,this.line=1,this.slashed=!1,this.unicodeI=0,this.unicodeS=null,this.depth=0,this.textNode=void 0,this.numberNode=void 0,this.options={...Vc,...t},this.textNode=void 0,this.numberNode="",this.emit("onready")}end(){return(this.state!==Jc.VALUE||0!==this.depth)&&this._error("Unexpected end"),this._closeValue(),this.c="",this.closed=!0,this.emit("onend"),this}resume(){return this.error=null,this}close(){return this.write(null)}emit(t,e){var n,r;null===(n=(r=this.options)[t])||void 0===n||n.call(r,e,this)}emitNode(t,e){this._closeValue(),this.emit(t,e)}write(t){if(this.error)throw this.error;if(this.closed)return this._error("Cannot write after close. Assign an onready handler.");if(null===t)return this.end();let e=0,n=t.charCodeAt(0),r=this.p;for(;n&&(r=n,this.c=n=t.charCodeAt(e++),r!==n?this.p=r:r=this.p,n);)switch(this.position++,10===n?(this.line++,this.column=0):this.column++,this.state){case Jc.BEGIN:123===n?this.state=Jc.OPEN_OBJECT:91===n?this.state=Jc.OPEN_ARRAY:Qc(n)||this._error("Non-whitespace before {[.");continue;case Jc.OPEN_KEY:case Jc.OPEN_OBJECT:if(Qc(n))continue;if(this.state===Jc.OPEN_KEY)this.stack.push(Jc.CLOSE_KEY);else{if(125===n){this.emit("onopenobject"),this.depth++,this.emit("oncloseobject"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;continue}this.stack.push(Jc.CLOSE_OBJECT)}34===n?this.state=Jc.STRING:this._error('Malformed object key should start with "');continue;case Jc.CLOSE_KEY:case Jc.CLOSE_OBJECT:if(Qc(n))continue;58===n?(this.state===Jc.CLOSE_OBJECT?(this.stack.push(Jc.CLOSE_OBJECT),this._closeValue("onopenobject"),this.depth++):this._closeValue("onkey"),this.state=Jc.VALUE):125===n?(this.emitNode("oncloseobject"),this.depth--,this.state=this.stack.pop()||Jc.VALUE):44===n?(this.state===Jc.CLOSE_OBJECT&&this.stack.push(Jc.CLOSE_OBJECT),this._closeValue(),this.state=Jc.OPEN_KEY):this._error("Bad object");continue;case Jc.OPEN_ARRAY:case Jc.VALUE:if(Qc(n))continue;if(this.state===Jc.OPEN_ARRAY){if(this.emit("onopenarray"),this.depth++,this.state=Jc.VALUE,93===n){this.emit("onclosearray"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;continue}this.stack.push(Jc.CLOSE_ARRAY)}34===n?this.state=Jc.STRING:123===n?this.state=Jc.OPEN_OBJECT:91===n?this.state=Jc.OPEN_ARRAY:116===n?this.state=Jc.TRUE:102===n?this.state=Jc.FALSE:110===n?this.state=Jc.NULL:45===n?this.numberNode+="-":48<=n&&n<=57?(this.numberNode+=String.fromCharCode(n),this.state=Jc.NUMBER_DIGIT):this._error("Bad value");continue;case Jc.CLOSE_ARRAY:if(44===n)this.stack.push(Jc.CLOSE_ARRAY),this._closeValue("onvalue"),this.state=Jc.VALUE;else if(93===n)this.emitNode("onclosearray"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;else{if(Qc(n))continue;this._error("Bad array")}continue;case Jc.STRING:void 0===this.textNode&&(this.textNode="");let i=e-1,s=this.slashed,o=this.unicodeI;t:for(;;){for(;o>0;)if(this.unicodeS+=String.fromCharCode(n),n=t.charCodeAt(e++),this.position++,4===o?(this.textNode+=String.fromCharCode(parseInt(this.unicodeS,16)),o=0,i=e-1):o++,!n)break t;if(34===n&&!s){this.state=this.stack.pop()||Jc.VALUE,this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}if(92===n&&!s&&(s=!0,this.textNode+=t.substring(i,e-1),this.position+=e-1-i,n=t.charCodeAt(e++),this.position++,!n))break;if(s){if(s=!1,110===n?this.textNode+="\n":114===n?this.textNode+="\r":116===n?this.textNode+="\t":102===n?this.textNode+="\f":98===n?this.textNode+="\b":117===n?(o=1,this.unicodeS=""):this.textNode+=String.fromCharCode(n),n=t.charCodeAt(e++),this.position++,i=e-1,n)continue;break}kc.lastIndex=e;const r=kc.exec(t);if(null===r){e=t.length+1,this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}if(e=r.index+1,n=t.charCodeAt(r.index),!n){this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}}this.slashed=s,this.unicodeI=o;continue;case Jc.TRUE:114===n?this.state=Jc.TRUE2:this._error(`Invalid true started with t${n}`);continue;case Jc.TRUE2:117===n?this.state=Jc.TRUE3:this._error(`Invalid true started with tr${n}`);continue;case Jc.TRUE3:n===jc?(this.emit("onvalue",!0),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid true started with tru${n}`);continue;case Jc.FALSE:97===n?this.state=Jc.FALSE2:this._error(`Invalid false started with f${n}`);continue;case Jc.FALSE2:108===n?this.state=Jc.FALSE3:this._error(`Invalid false started with fa${n}`);continue;case Jc.FALSE3:115===n?this.state=Jc.FALSE4:this._error(`Invalid false started with fal${n}`);continue;case Jc.FALSE4:n===jc?(this.emit("onvalue",!1),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid false started with fals${n}`);continue;case Jc.NULL:117===n?this.state=Jc.NULL2:this._error(`Invalid null started with n${n}`);continue;case Jc.NULL2:108===n?this.state=Jc.NULL3:this._error(`Invalid null started with nu${n}`);continue;case Jc.NULL3:108===n?(this.emit("onvalue",null),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid null started with nul${n}`);continue;case Jc.NUMBER_DECIMAL_POINT:46===n?(this.numberNode+=".",this.state=Jc.NUMBER_DIGIT):this._error("Leading zero not followed by .");continue;case Jc.NUMBER_DIGIT:48<=n&&n<=57?this.numberNode+=String.fromCharCode(n):46===n?(-1!==this.numberNode.indexOf(".")&&this._error("Invalid number has two dots"),this.numberNode+="."):n===jc||69===n?((-1!==this.numberNode.indexOf("e")||-1!==this.numberNode.indexOf("E"))&&this._error("Invalid number has two exponential"),this.numberNode+="e"):43===n||45===n?(r===jc||69===r||this._error("Invalid symbol in number"),this.numberNode+=String.fromCharCode(n)):(this._closeNumber(),e--,this.state=this.stack.pop()||Jc.VALUE);continue;default:this._error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&function(t){const e=Math.max(Hc,10);let n=0;for(const r of["textNode","numberNode"]){const i=void 0===t[r]?0:t[r].length;i>e&&("text"===r||t._error(`Max buffer length exceeded: ${r}`)),n=Math.max(n,i)}t.bufferCheckPosition=Hc-n+t.position}(this),this.emit("onchunkparsed"),this}_closeValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"onvalue";void 0!==this.textNode&&this.emit(t,this.textNode),this.textNode=void 0}_closeNumber(){this.numberNode&&this.emit("onvalue",parseFloat(this.numberNode)),this.numberNode=""}_error(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this._closeValue(),t+=`\nLine: ${this.line}\nColumn: ${this.column}\nChar: ${this.c}`;const e=new Error(t);this.error=e,this.emit("onerror",e)}}function Qc(t){return 13===t||10===t||32===t||9===t}class zc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.path=void 0,this.path=["$"],t instanceof zc)this.path=[...t.path];else if(Array.isArray(t))this.path.push(...t);else if("string"==typeof t&&(this.path=t.split("."),"$"!==this.path[0]))throw new Error("JSONPaths must start with $")}clone(){return new zc(this)}toString(){return this.path.join(".")}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let e=0;e{this.jsonpath=new zc,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:t=>{this._openObject({}),typeof t<"u"&&this.parser.emit("onkey",t)},onkey:t=>{this.jsonpath.set(t),this.currentState.key=t},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:t=>{this._pushOrSet(t)},onerror:t=>{throw t},onend:()=>{this.result=this.currentState.container.pop()},...t})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new zc}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){const{container:e,key:n}=this.currentState;null!==n?(e[n]=t,this.currentState.key=null):e.push(t)}_openArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}}{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath())return this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],void this._openArray(this.streamingArray);this._openArray()},onopenobject:t=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof t<"u"&&this.parser.emit("onkey",t)}}),this.jsonPaths=void 0,this.streamingJsonPath=null,this.streamingArray=null,this.topLevelObject=null;const e=t.jsonpaths||[];this.jsonPaths=e.map((t=>new zc(t)))}write(t){super.write(t);let e=[];return this.streamingArray&&(e=[...this.streamingArray],this.streamingArray.length=0),e}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){const t=this.getJsonPath();if(0===this.jsonPaths.length)return!0;for(const e of this.jsonPaths)if(e.equals(t))return!0;return!1}}const Wc={x:0,y:1,z:2};function Yc(t,e={}){const{start:n=0,end:r=t.length,plane:i="xy"}=e,s=e.size||2;let o=0;const a=Wc[i[0]],c=Wc[i[1]];for(let e=n,i=r-s;e=e;a-=r)c=yh(a,t[a+h],t[a+l],c);return c&&dh(c,c.next)&&(Bh(c),c=c.next),c}function Zc(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!dh(r,r.next)&&0!==uh(r.prev,r,r.next))r=r.next;else{if(Bh(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function $c(t,e,n,r,i,s,o){if(!t)return;!o&&s&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=ah(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n,r,i,s,o,a,c,h=1;do{for(i=t,t=null,c=null,r=0;i;){for(r++,o=i,s=0,n=0;n0||a>0&&o;)0!==s&&(0===a||!o||i.z<=o.z)?(e=i,i=i.nextZ,s--):(e=o,o=o.nextZ,a--),c?c.nextZ=e:t=e,e.prevZ=c,c=e;i=o}c.nextZ=null,h*=2}while(r>1)}(i)}(t,r,i,s);let a,c,h=t;for(;t.prev!==t.next;)if(a=t.prev,c=t.next,s?eh(t,r,i,s):th(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Bh(t),t=c.next,h=c.next;else if((t=c)===h){o?1===o?$c(t=nh(Zc(t),e,n),e,n,r,i,s,2):2===o&&rh(t,e,n,r,i,s):$c(Zc(t),e,n,r,i,s,1);break}}function th(t){const e=t.prev,n=t,r=t.next;if(uh(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,c=n.y,h=r.y,l=is?i>o?i:o:s>o?s:o,f=a>c?a>h?a:h:c>h?c:h;let m=r.next;for(;m!==e;){if(m.x>=l&&m.x<=d&&m.y>=u&&m.y<=f&&hh(i,a,s,c,o,h,m.x,m.y)&&uh(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function eh(t,e,n,r){const i=t.prev,s=t,o=t.next;if(uh(i,s,o)>=0)return!1;const a=i.x,c=s.x,h=o.x,l=i.y,u=s.y,d=o.y,f=ac?a>h?a:h:c>h?c:h,g=l>u?l>d?l:d:u>d?u:d,A=ah(f,m,e,n,r),y=ah(p,g,e,n,r);let B=t.prevZ,b=t.nextZ;for(;B&&B.z>=A&&b&&b.z<=y;){if(B.x>=f&&B.x<=p&&B.y>=m&&B.y<=g&&B!==i&&B!==o&&hh(a,l,c,u,h,d,B.x,B.y)&&uh(B.prev,B,B.next)>=0||(B=B.prevZ,b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&hh(a,l,c,u,h,d,b.x,b.y)&&uh(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;B&&B.z>=A;){if(B.x>=f&&B.x<=p&&B.y>=m&&B.y<=g&&B!==i&&B!==o&&hh(a,l,c,u,h,d,B.x,B.y)&&uh(B.prev,B,B.next)>=0)return!1;B=B.prevZ}for(;b&&b.z<=y;){if(b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&hh(a,l,c,u,h,d,b.x,b.y)&&uh(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function nh(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!dh(i,s)&&fh(i,r,r.next,s)&&gh(i,s)&&gh(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Bh(r),Bh(r.next),r=t=s),r=r.next}while(r!==t);return Zc(r)}function rh(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&lh(o,t)){let a=Ah(o,t);return o=Zc(o,o.next),a=Zc(a,a.next),$c(o,e,n,r,i,s,0),void $c(a,e,n,r,i,s,0)}t=t.next}o=o.next}while(o!==t)}function ih(t,e){return t.x-e.x}function sh(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let s,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o&&(o=t,s=n.x=n.x&&n.x>=c&&r!==n.x&&hh(is.x||n.x===s.x&&oh(s,n)))&&(s=n,u=l)),n=n.next}while(n!==a);return s}(t,e);if(!n)return e;const r=Ah(n,t);return Zc(r,r.next),Zc(n,n.next)}function oh(t,e){return uh(t.prev,t,e.prev)<0&&uh(e.next,t,t.next)<0}function ah(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ch(t){let e=t,n=t;do{(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function lh(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&fh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(gh(t,e)&&gh(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(uh(t.prev,t,e.prev)||uh(t,e.prev,e))||dh(t,e)&&uh(t.prev,t,t.next)>0&&uh(e.prev,e,e.next)>0)}function uh(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function dh(t,e){return t.x===e.x&&t.y===e.y}function fh(t,e,n,r){const i=ph(uh(t,e,n)),s=ph(uh(t,e,r)),o=ph(uh(n,r,t)),a=ph(uh(n,r,e));return!!(i!==s&&o!==a||0===i&&mh(t,n,e)||0===s&&mh(t,r,e)||0===o&&mh(n,t,r)||0===a&&mh(n,e,r))}function mh(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ph(t){return t>0?1:t<0?-1:0}function gh(t,e){return uh(t.prev,t,t.next)<0?uh(t,e,t.next)>=0&&uh(t,t.prev,e)>=0:uh(t,e,t.prev)<0||uh(t,t.next,e)<0}function Ah(t,e){const n=new bh(t.i,t.x,t.y),r=new bh(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function yh(t,e,n,r){const i=new bh(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Bh(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}class bh{constructor(t,e,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=n}}function Ch(t,e,n){const r=function(t){const e={};for(const n of t)if(n.properties)for(const t in n.properties){const r=n.properties[t];e[t]=Ih(r,e[t])}return e}(t),i=Object.keys(r).filter((t=>r[t]!==Array));return function(t,e,n){const{pointPositionsCount:r,pointFeaturesCount:i,linePositionsCount:s,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:h,polygonRingsCount:l,polygonFeaturesCount:u,propArrayTypes:d,coordLength:f}=e,{numericPropKeys:m=[],PositionDataType:p=Float32Array,triangulate:g=!0}=n,A=t[0]&&"id"in t[0],y=t.length>65535?Uint32Array:Uint16Array,B={type:"Point",positions:new p(r*f),globalFeatureIds:new y(r),featureIds:i>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},b={type:"LineString",pathIndices:s>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new p(s*f),globalFeatureIds:new y(s),featureIds:a>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},C={type:"Polygon",polygonIndices:c>65535?new Uint32Array(h+1):new Uint16Array(h+1),primitivePolygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new p(c*f),globalFeatureIds:new y(c),featureIds:u>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};g&&(C.triangles=[]);for(const t of[B,b,C])for(const e of m){const n=d[e];t.numericProps[e]=new n(t.positions.length/f)}b.pathIndices[o]=s,C.polygonIndices[h]=c,C.primitivePolygonIndices[l]=c;const w={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(const e of t){const t=e.geometry,n=e.properties||{};switch(t.type){case"Point":wh(t,B,w,f,n),B.properties.push(Mh(n,m)),A&&B.fields.push({id:e.id}),w.pointFeature++;break;case"LineString":Eh(t,b,w,f,n),b.properties.push(Mh(n,m)),A&&b.fields.push({id:e.id}),w.lineFeature++;break;case"Polygon":vh(t,C,w,f,n),C.properties.push(Mh(n,m)),A&&C.fields.push({id:e.id}),w.polygonFeature++;break;default:throw new Error("Invalid geometry type")}w.feature++}return function(t,e,n,r){const i={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:r},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:_h(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:r},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:_h(e.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:_h(n.numericProps,1)}};return i.polygons&&n.triangles&&(i.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),i}(B,b,C,f)}(t,{propArrayTypes:r,...e},{numericPropKeys:n&&n.numericPropKeys||i,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:!n||n.triangulate})}function wh(t,e,n,r,i){e.positions.set(t.data,n.pointPosition*r);const s=t.data.length/r;xh(e,i,n.pointPosition,s),e.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+s),e.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+s),n.pointPosition+=s}function Eh(t,e,n,r,i){e.positions.set(t.data,n.linePosition*r);const s=t.data.length/r;xh(e,i,n.linePosition,s),e.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+s),e.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+s);for(let i=0,s=t.indices.length;i80*n){d=l=t[0],f=u=t[1];for(let e=n;el&&(l=m),p>u&&(u=p);h=Math.max(l-d,u-f),h=0!==h?32767/h:0}return $c(a,c,n,d,f,h,0),c}(h,n.slice(1).map((t=>(t-l)/o)),o,e);for(let e=0,n=u.length;e0?Math.max(...l):2,pointPositionsCount:e,pointFeaturesCount:n,linePositionsCount:r,linePathsCount:i,lineFeaturesCount:s,polygonPositionsCount:o,polygonObjectsCount:a,polygonRingsCount:c,polygonFeaturesCount:h}}function Rh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{coordLength:2,fixRingWinding:!0};return t.map((t=>Gh(t,e)))}function Oh(t,e,n,r){n.push(e.length),e.push(...t);for(let n=t.length;nt.slice(0,2))).flat());const r=t<0;i.fixRingWinding&&(0===s&&!r||s>0&&r)&&(n.reverse(),t=-t),o.push(t),Fh(n,e,a,i),s++}s>0&&(r.push(o),n.push(a))}function Gh(t,e){const{geometry:n}=t;if("GeometryCollection"===n.type)throw new Error("GeometryCollection type not supported");const r=[],i=[];let s,o;switch(n.type){case"Point":o="Point",Oh(n.coordinates,r,i,e);break;case"MultiPoint":o="Point",n.coordinates.map((t=>Oh(t,r,i,e)));break;case"LineString":o="LineString",Fh(n.coordinates,r,i,e);break;case"MultiLineString":o="LineString",n.coordinates.map((t=>Fh(t,r,i,e)));break;case"Polygon":o="Polygon",s=[],Dh(n.coordinates,r,i,s,e);break;case"MultiPolygon":o="Polygon",s=[],n.coordinates.map((t=>Dh(t,r,i,s,e)));break;default:throw new Error(`Unknown type: ${o}`)}return{...t,geometry:{type:o,indices:i,data:r,areas:s}}}function Lh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fixRingWinding:!0,triangulate:!0};const n=Sh(t),r=n.coordLength,{fixRingWinding:i}=e,s=Rh(t,{coordLength:r,fixRingWinding:i});return Ch(s,n,{numericPropKeys:e.numericPropKeys,PositionDataType:e.PositionDataType||Float32Array,triangulate:e.triangulate})}const Uh={name:"GeoJSON",id:"geojson",module:"geojson",version:"4.1.4",worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"object-row-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}},parse:async function(t,e){return Nh((new TextDecoder).decode(t),e)},parseTextSync:Nh,parseInBatches:function(t,e){(e={...Uh.options,...e}).json={...Uh.options.geojson,...e.geojson};const n=async function*(t,e){const n=function(t){try{let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){const n=new TextDecoder(void 0,e);for await(const e of t)yield"string"==typeof e?e:n.decode(e,{stream:!0})}()}catch(t){return Promise.reject(t)}}(t),{metadata:r}=e,{jsonpaths:i}=e.json||{};let s=!0;const o=new Pc(null,e),a=new qc({jsonpaths:i});for await(const t of n){const n=a.write(t),i=n.length>0&&a.getStreamingJsonPathAsString();var c;n.length>0&&s&&(r&&(yield{shape:(null==e||null===(c=e.json)||void 0===c?void 0:c.shape)||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:a.getPartialResult(),jsonpath:i}),s=!1);for(const t of n){o.addRow(t);const e=o.getFullBatch({jsonpath:i});e&&(yield e)}o.chunkComplete(t);const h=o.getFullBatch({jsonpath:i});h&&(yield h)}const h=a.getStreamingJsonPathAsString(),l=o.getFinalBatch({jsonpath:h});l&&(yield l),r&&(yield{shape:"json",batchType:"final-result",container:a.getPartialResult(),jsonpath:a.getStreamingJsonPathAsString(),data:[],length:0})}(t,e);return"binary"===e.gis.format?async function*(t){for await(const e of t)e.data=Lh(e.data),yield e}(n):n}};function Nh(t,e){var n;let r;(e={...Uh.options,...e}).geojson={...Uh.options.geojson,...e.geojson},e.gis=e.gis||{};try{r=JSON.parse(t)}catch{r={}}const i={shape:"geojson-table",type:"FeatureCollection",features:(null===(n=r)||void 0===n?void 0:n.features)||[]};return"binary"===e.gis.format?Lh(i.features):i}function Ph(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const Hh={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class Jh{constructor(t={}){n(this,"props"),n(this,"stats"),n(this,"activeRequestCount",0),n(this,"requestQueue",[]),n(this,"requestMap",new Map),n(this,"updateTimer",null),this.props={...Hh,...t},this.stats=new V({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(t,e=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const n={handle:t,priority:0,getPriority:e},r=new Promise((t=>(n.resolve=t,n)));return this.requestQueue.push(n),this.requestMap.set(t,r),this._issueNewRequests(),r}_issueRequest(t){const{handle:e,resolve:n}=t;let r=!1;const i=()=>{r||(r=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:i}):Promise.resolve({done:i})}_issueNewRequests(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout((()=>this._issueNewRequestsAsync()),this.props.debounceTime)}_issueNewRequestsAsync(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=null;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let e=0;et.priority-e.priority))}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0&&(t.resolve(null),1))}}class jh{constructor(t,e,r){n(this,"item"),n(this,"previous"),n(this,"next"),this.item=t,this.previous=e,this.next=r}}class kh{constructor(){n(this,"head",null),n(this,"tail",null),n(this,"_length",0)}get length(){return this._length}add(t){const e=new jh(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),++this._length,e}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,e){t!==e&&(this.remove(e),this._insert(t,e))}_insert(t,e){const n=t.next;t.next=e,this.tail===t?this.tail=e:n.previous=e,e.next=n,e.previous=t,++this._length}}class Vh{constructor(){n(this,"_list"),n(this,"_sentinel"),n(this,"_trimTiles"),this._list=new kh,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){const e=t._cacheNode;e&&this._list.splice(this._sentinel,e)}add(t,e,n){e._cacheNode||(e._cacheNode=this._list.add(e),n&&n(t,e))}unloadTile(t,e,n){const r=e._cacheNode;r&&(this._list.remove(r),e._cacheNode=null,n&&n(t,e))}unloadTiles(t,e){const n=this._trimTiles;this._trimTiles=!1;const r=this._list,i=1024*t.maximumMemoryUsage*1024,s=this._sentinel;let o=r.head;for(;o!==s&&(t.gpuMemoryUsageInBytes>i||n);){const n=o.item;o=o.next,this.unloadTile(t,n,e)}}trim(){this._trimTiles=!0}}const Kh=new Qe,Qh=new Qe,zh=new ir([new tr,new tr,new tr,new tr,new tr,new tr]);function qh(t,e){const{cameraDirection:n,cameraUp:r,height:i}=t,{metersPerUnit:s}=t.distanceScales,o=Yh(t,t.center),a=Hn.WGS84.eastNorthUpToFixedFrame(o),c=t.unprojectPosition(t.cameraPosition),h=Hn.WGS84.cartographicToCartesian(c,new Qe),l=new Qe(a.transformAsVector(new Qe(n).scale(s))).normalize(),u=new Qe(a.transformAsVector(new Qe(r).scale(s))).normalize();!function(t){const e=t.getFrustumPlanes(),n=Wh(e.near,t.cameraPosition),r=Yh(t,n),i=Yh(t,t.cameraPosition,Qh);let s=0;zh.planes[s++].fromPointNormal(r,Kh.copy(r).subtract(i));for(const i in e){if("near"===i)continue;const o=Yh(t,Wh(e[i],n,Qh),Qh);zh.planes[s++].fromPointNormal(o,Kh.copy(r).subtract(o))}}(t);const d=t.constructor,{longitude:f,latitude:m,width:p,bearing:g,zoom:A}=t;return{camera:{position:h,direction:l,up:u},viewport:t,topDownViewport:new d({longitude:f,latitude:m,height:i,width:p,bearing:g,zoom:A,pitch:0}),height:i,cullingVolume:zh,frameNumber:e,sseDenominator:1.15}}function Wh(t,e,n=new Qe){const r=t.normal.dot(e);return n.copy(t.normal).scale(t.distance-r).add(e),n}function Yh(t,e,n=new Qe){const r=t.unprojectPosition(e);return Hn.WGS84.cartographicToCartesian(r,n)}const Xh=6356752.314245179,Zh=new Qe;function $h(t,e,n){Hn.WGS84.cartographicToCartesian([t.xmax,t.ymax,t.zmax],Zh);const r=Math.sqrt(Math.pow(Zh[0]-n[0],2)+Math.pow(Zh[1]-n[1],2)+Math.pow(Zh[2]-n[2],2));return Math.log2(Xh/(r+e[2]))}var tl,el,nl,rl;!function(t){t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE"}(tl||(tl={})),function(t){t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh"}(el||(el={})),function(t){t.I3S="I3S",t.TILES3D="TILES3D"}(nl||(nl={})),function(t){t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold"}(rl||(rl={}));function il(t){return null!=t}const sl=new Qe,ol=new Qe,al=new Qe,cl=new Qe,hl=new Qe,ll=new Qe,ul=new Qe,dl=new Qe;function fl(t,e,n){if(Ph(t,"3D Tile: boundingVolume must be defined"),t.box)return ml(t.box,e,n);if(t.region)return function(t){const[e,n,r,i,s,o]=t,a=Hn.WGS84.cartographicToCartesian([Ae(e),Ae(i),s],al),c=Hn.WGS84.cartographicToCartesian([Ae(r),Ae(n),o],cl),h=(new Qe).addVectors(a,c).multiplyByScalar(.5);return Hn.WGS84.cartesianToCartographic(h,hl),Hn.WGS84.cartographicToCartesian([Ae(r),hl[1],hl[2]],ll),Hn.WGS84.cartographicToCartesian([hl[0],Ae(i),hl[2]],ul),Hn.WGS84.cartographicToCartesian([hl[0],hl[1],o],dl),ml([...h,...ll.subtract(h),...ul.subtract(h),...dl.subtract(h)],new ln)}(t.region);if(t.sphere)return function(t,e,n){const r=new Qe(t[0],t[1],t[2]);e.transform(r,r);const i=e.getScale(ol),s=Math.max(Math.max(i[0],i[1]),i[2]),o=t[3]*s;return il(n)?(n.center=r,n.radius=o,n):new kn(r,o)}(t.sphere,e,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function ml(t,e,n){const r=new Qe(t[0],t[1],t[2]);e.transform(r,r);let i=[];if(10===t.length){const e=t.slice(3,6),n=new Bn;n.fromArray(t,6);const r=new Qe([1,0,0]),s=new Qe([0,1,0]),o=new Qe([0,0,1]);r.transformByQuaternion(n),r.scale(e[0]),s.transformByQuaternion(n),s.scale(e[1]),o.transformByQuaternion(n),o.scale(e[2]),i=[...r.toArray(),...s.toArray(),...o.toArray()]}else i=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];const s=e.transformAsVector(i.slice(0,3)),o=e.transformAsVector(i.slice(3,6)),a=e.transformAsVector(i.slice(6,9)),c=new $e([s[0],s[1],s[2],o[0],o[1],o[2],a[0],a[1],a[2]]);return il(n)?(n.center=r,n.halfAxes=c,n):new Xn(r,c)}function pl(t,e){Hn.WGS84.cartesianToCartographic(e,sl),t[0][0]=Math.min(t[0][0],sl[0]),t[0][1]=Math.min(t[0][1],sl[1]),t[0][2]=Math.min(t[0][2],sl[2]),t[1][0]=Math.max(t[1][0],sl[0]),t[1][1]=Math.max(t[1][1],sl[1]),t[1][2]=Math.max(t[1][2],sl[2])}new Qe,new Qe,new ln,new Qe,new Qe,new Qe;const gl=new Qe,Al=new Qe,yl=new Qe,Bl=new Qe,bl=new Qe,Cl=new ln,wl=new ln;function El(t,e){const{topDownViewport:n}=e,r=t.header.mbs[1],i=t.header.mbs[0],s=t.header.mbs[2],o=t.header.mbs[3],a=[...t.boundingVolume.center],c=n.unprojectPosition(n.cameraPosition);Hn.WGS84.cartographicToCartesian(c,gl),Al.copy(gl).subtract(a).normalize(),Hn.WGS84.eastNorthUpToFixedFrame(a,Cl),wl.copy(Cl).invert(),yl.copy(gl).transform(wl);const h=Math.sqrt(yl[0]*yl[0]+yl[1]*yl[1]),l=h*h/yl[2];Bl.copy([yl[0],yl[1],l]);const u=Bl.transform(Cl).subtract(a).normalize(),d=Al.cross(u).normalize().scale(o).add(a),f=Hn.WGS84.cartesianToCartographic(d),m=n.project([i,r,s]),p=n.project(f);return bl.copy(m).subtract(p).magnitude()}class vl{constructor(t=0){n(this,"_map",new Map),n(this,"_array"),n(this,"_length"),this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return Ph(t=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=e,this._map.set(e,t)}delete(t){const e=this._map.get(t);e>=0&&(this._array.splice(e,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){const e=this.length++;this._array[e]=t,this._map.set(t,e)}}pop(){const t=this._array[--this.length];return this._map.delete(t),t}reserve(t){Ph(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){Ph(t>=0),this.length=t}trim(t){null==t&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}}const Tl={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class _l{constructor(t){n(this,"options"),n(this,"root",null),n(this,"selectedTiles",{}),n(this,"requestedTiles",{}),n(this,"emptyTiles",{}),n(this,"lastUpdate",(new Date).getTime()),n(this,"updateDebounceTime",1e3),n(this,"_traversalStack",new vl),n(this,"_emptyTraversalStack",new vl),n(this,"_frameNumber",null),this.options={...Tl,...t}}traversalFinished(t){return!0}traverse(t,e,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,e),this._frameNumber=e.frameNumber,this.executeTraversal(t,e)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,e){const n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){const t=n.pop();let r=!1;this.canTraverse(t,e)&&(this.updateChildTiles(t,e),r=this.updateAndPushChildren(t,e,n,t.hasRenderContent?t._selectionDepth+1:t._selectionDepth));const i=t.parent,s=!(i&&!i._shouldRefine),o=!r;t.hasRenderContent?t.refine===tl.ADD?(this.loadTile(t,e),this.selectTile(t,e)):t.refine===tl.REPLACE&&(this.loadTile(t,e),o&&this.selectTile(t,e)):(this.emptyTiles[t.id]=t,this.loadTile(t,e),o&&this.selectTile(t,e)),this.touchTile(t,e),t._shouldRefine=r&&s}const r=(new Date).getTime();(this.traversalFinished(e)||r-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=r,this.options.onTraversalEnd(e))}updateChildTiles(t,e){const n=t.children;for(const t of n)this.updateTile(t,e)}updateAndPushChildren(t,e,n,r){const{loadSiblings:i,skipLevelOfDetail:s}=this.options,o=t.children;o.sort(this.compareDistanceToCamera.bind(this));const a=t.refine===tl.REPLACE&&t.hasRenderContent&&!s;let c=!1,h=!0;for(const t of o)if(t._selectionDepth=r,t.isVisibleAndInRequestVolume?(n.find(t)&&n.delete(t),n.push(t),c=!0):(a||i)&&(this.loadTile(t,e),this.touchTile(t,e)),a){let n;if(n=!!t._inRequestVolume&&(t.hasRenderContent?t.contentAvailable:this.executeEmptyTraversal(t,e)),h=h&&n,!h)return!1}return c||(h=!1),h}updateTile(t,e){this.updateTileVisibility(t,e)}selectTile(t,e){this.shouldSelectTile(t)&&(t._selectedFrame=e.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,e){this.shouldLoadTile(t)&&(t._requestedFrame=e.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,e){t.tileset._cache.touch(t),t._touchedFrame=e.frameNumber}canTraverse(t,e){return!!t.hasChildren&&(t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,e))}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,e,n=!1){let r=t._screenSpaceError;return n&&(r=t.getScreenSpaceError(e,!0)),r>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,e){const n=[];if(this.options.viewportTraversersMap)for(const t in this.options.viewportTraversersMap)this.options.viewportTraversersMap[t]===e.viewport.id&&n.push(t);else n.push(e.viewport.id);t.updateVisibility(e,n)}compareDistanceToCamera(t,e){return t._distanceToCamera-e._distanceToCamera}anyChildrenVisible(t,e){let n=!1;for(const r of t.children)r.updateVisibility(e),n=n||r.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,e){let n=!0;const r=this._emptyTraversalStack;for(r.push(t);r.length>0;){const t=r.pop(),i=!t.hasRenderContent&&this.canTraverse(t,e),s=!t.hasRenderContent&&0===t.children.length;if(!i&&!t.contentAvailable&&!s&&(n=!1),this.updateTile(t,e),t.isVisibleAndInRequestVolume||(this.loadTile(t,e),this.touchTile(t,e)),i){const e=t.children;for(const t of e)r.push(t)}}return n}}const xl=new Qe;class Ml{constructor(t,e,r,i=""){n(this,"tileset"),n(this,"header"),n(this,"id"),n(this,"url"),n(this,"parent"),n(this,"refine"),n(this,"type"),n(this,"contentUrl"),n(this,"lodMetricType","geometricError"),n(this,"lodMetricValue",0),n(this,"boundingVolume",null),n(this,"content",null),n(this,"contentState",0),n(this,"gpuMemoryUsageInBytes",0),n(this,"children",[]),n(this,"depth",0),n(this,"viewportIds",[]),n(this,"transform",new ln),n(this,"extensions",null),n(this,"implicitTiling",null),n(this,"userData",{}),n(this,"computedTransform"),n(this,"hasEmptyContent",!1),n(this,"hasTilesetContent",!1),n(this,"traverser",new _l({})),n(this,"_cacheNode",null),n(this,"_frameNumber",null),n(this,"_expireDate",null),n(this,"_expiredContent",null),n(this,"_boundingBox"),n(this,"_distanceToCamera",0),n(this,"_screenSpaceError",0),n(this,"_visibilityPlaneMask"),n(this,"_visible"),n(this,"_contentBoundingVolume"),n(this,"_viewerRequestVolume"),n(this,"_initialTransform",new ln),n(this,"_priority",0),n(this,"_selectedFrame",0),n(this,"_requestedFrame",0),n(this,"_selectionDepth",0),n(this,"_touchedFrame",0),n(this,"_centerZDepth",0),n(this,"_shouldRefine",!1),n(this,"_stackLength",0),n(this,"_visitedFrame",0),n(this,"_inRequestVolume",!1),n(this,"_lodJudge",null),this.header=e,this.tileset=t,this.id=i||e.id,this.url=e.url,this.parent=r,this.refine=this._getRefine(e.refine),this.type=e.type,this.contentUrl=e.contentUrl,this._initializeLodMetric(e),this._initializeTransforms(e),this._initializeBoundingVolumes(e),this._initializeContent(e),this._initializeRenderingState(e),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return 3===this.contentState||this.hasEmptyContent}get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return 0===this.contentState}get contentExpired(){return 4===this.contentState}get contentFailed(){return 5===this.contentState}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=function(t,e){if(t.box)return function(t){const e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],{halfAxes:n}=t,r=new Qe(n.getColumn(0)),i=new Qe(n.getColumn(1)),s=new Qe(n.getColumn(2));for(let n=0;n<2;n++){for(let n=0;n<2;n++){for(let n=0;n<2;n++)sl.copy(t.center),sl.add(r),sl.add(i),sl.add(s),pl(e,sl),s.negate();i.negate()}r.negate()}return e}(e);if(t.region){const[e,n,r,i,s,o]=t.region;return[[Ae(e),Ae(n),s],[Ae(r),Ae(i),o]]}if(t.sphere)return function(t){const e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],{center:n,radius:r}=t,i=Hn.WGS84.scaleToGeodeticSurface(n,sl);let s;s=i?Hn.WGS84.geodeticSurfaceNormal(i):new Qe(0,0,1);let o=new Qe(s[2],-s[1],0);o.len()>0?o.normalize():o=new Qe(0,1,0);const a=o.clone().cross(s);for(const t of[o,a,s]){ol.copy(t).scale(r);for(let t=0;t<2;t++)sl.copy(n),sl.add(ol),pl(e,sl),ol.negate()}return e}(e);throw new Error("Unkown boundingVolume type")}(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,e){switch(this.tileset.type){case nl.I3S:return El(this,t);case nl.TILES3D:return function(t,e,n){const r=t.tileset,i=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,s=n?i:t.lodMetricValue;if(0===s)return 0;const o=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:c}=e,{viewDistanceScale:h}=r.options;let l=s*a*(h||1)/(o*c);return l-=function(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){const n=t.dynamicScreenSpaceErrorComputedDensity,r=t.dynamicScreenSpaceErrorFactor;return function(t,e){const n=t*e;return 1-Math.exp(-n*n)}(e,n)*r}return 0}(r,o),l}(this,t,e);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){const t=this.tileset._traverser,{skipLevelOfDetail:e}=t.options,n=this.refine===tl.ADD||e;if(n&&!this.isVisible&&void 0!==this._visible||this.tileset._frameNumber-this._touchedFrame>=1||0===this.contentState)return-1;const r=this.parent,i=!r||n&&0!==this._screenSpaceError&&!r.hasTilesetContent?this._screenSpaceError:r._screenSpaceError,s=t.root?t.root._screenSpaceError:0;return Math.max(s-i,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=1;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=0,!1;try{const e=this.tileset.getTileUrl(this.contentUrl),n=this.tileset.loader,r={...this.tileset.loadOptions,[n.id]:{...this.tileset.loadOptions[n.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(n.id)}};return this.content=await he(e,n,r),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=3,this._onContentLoaded(),!0}catch(t){throw this.contentState=5,t}finally{t.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=0,!0}updateVisibility(t,e){if(this._frameNumber===t.frameNumber)return;const n=this.parent,r=n?n._visibilityPlaneMask:ir.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const t=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(t)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,r),this._visible=this._visibilityPlaneMask!==ir.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=e}visibility(t,e){const{cullingVolume:n}=t,{boundingVolume:r}=this;return n.computeVisibilityWithPlaneMask(r,e)}contentVisibility(){return!0}distanceToTile(t){const e=this.boundingVolume;return Math.sqrt(Math.max(e.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){const e=this.boundingVolume;return xl.subVectors(e.center,t.position),t.direction.dot(xl)}insideViewerRequestVolume(t){const e=this._viewerRequestVolume;return!e||e.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(function(t){return null!=t}(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){const t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=4,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new ln(t.transform):new ln;const e=this.parent,n=this.tileset,r=e&&e.computedTransform?e.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new ln(r).multiplyRight(this.transform);const i=e&&e._initialTransform?e._initialTransform.clone():new ln;this._initialTransform=new ln(i).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=0,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ir.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||tl.REPLACE}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=fl(t.boundingVolume,this.computedTransform,this.boundingVolume);const e=t.content;e&&(e.boundingVolume&&(this._contentBoundingVolume=fl(e.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=fl(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new ln){const e=t.clone().multiplyRight(this.transform);e.equals(this.computedTransform)||(this.computedTransform=e,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){return"i3s"===t?{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1}:function(t){return{assetGltfUpAxis:t.asset&&t.asset.gltfUpAxis||"Y"}}(this.tileset.tileset)}}class Il extends _l{compareDistanceToCamera(t,e){return 0===e._distanceToCamera&&0===t._distanceToCamera?e._centerZDepth-t._centerZDepth:e._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,e){if(super.updateTileVisibility(t,e),!t.isVisibleAndInRequestVolume)return;const n=t.children.length>0;if(t.hasTilesetContent&&n){const n=t.children[0];return this.updateTileVisibility(n,e),void(t._visible=n._visible)}if(this.meetsScreenSpaceErrorEarly(t,e))return void(t._visible=!1);const r=t.refine===tl.REPLACE,i=1===t._optimChildrenWithinParent;r&&i&&n&&!this.anyChildrenVisible(t,e)&&(t._visible=!1)}meetsScreenSpaceErrorEarly(t,e){const{parent:n}=t;return!(!n||n.hasTilesetContent||n.refine!==tl.ADD||this.shouldRefine(t,e,!0))}}class Sl{constructor(){n(this,"frameNumberMap",new Map)}register(t,e){const n=this.frameNumberMap.get(t)||new Map,r=n.get(e)||0;n.set(e,r+1),this.frameNumberMap.set(t,n)}deregister(t,e){const n=this.frameNumberMap.get(t);if(!n)return;const r=n.get(e)||1;n.set(e,r-1)}isZero(t,e){var n;return 0===((null==(n=this.frameNumberMap.get(t))?void 0:n.get(e))||0)}}class Rl{constructor(){n(this,"_statusMap"),n(this,"pendingTilesRegister",new Sl),this._statusMap={}}add(t,e,n,r){if(!this._statusMap[e]){const{frameNumber:i,viewport:{id:s}}=r;this._statusMap[e]={request:t,callback:n,key:e,frameState:r,status:"REQUESTED"},this.pendingTilesRegister.register(s,i),t().then((t=>{this._statusMap[e].status="COMPLETED";const{frameNumber:n,viewport:{id:i}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(i,n),this._statusMap[e].callback(t,r)})).catch((t=>{this._statusMap[e].status="ERROR";const{frameNumber:r,viewport:{id:i}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(i,r),n(t)}))}}update(t,e){if(this._statusMap[t]){const{frameNumber:n,viewport:{id:r}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(r,n);const{frameNumber:i,viewport:{id:s}}=e;this.pendingTilesRegister.register(s,i),this._statusMap[t].frameState=e}}find(t){return this._statusMap[t]}hasPendingTiles(t,e){return!this.pendingTilesRegister.isZero(t,e)}}class Ol extends _l{constructor(t){super(t),n(this,"_tileManager"),this._tileManager=new Rl}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,e){return t._lodJudge=function(t,e){if(0===t.lodMetricValue||isNaN(t.lodMetricValue))return"DIG";const n=2*El(t,e);return n<2?"OUT":!t.header.children||n<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}(t,e),"DIG"===t._lodJudge}updateChildTiles(t,e){const n=t.header.children||[],r=t.children,i=t.tileset;for(const s of n){const n=`${s.id}-${e.viewport.id}`,o=r&&r.find((t=>t.id===n));if(o)o&&this.updateTile(o,e);else{let r=()=>this._loadTile(s.id,i);this._tileManager.find(n)?this._tileManager.update(n,e):(i.tileset.nodePages&&(r=()=>i.tileset.nodePagesTile.formTileFromNodePages(s.id)),this._tileManager.add(r,n,(e=>this._onTileLoad(e,t,n)),e))}}return!1}async _loadTile(t,e){const{loader:n}=e,r=e.getTileUrl(`${e.url}/nodes/${t}`),i={...e.loadOptions,i3s:{...e.loadOptions.i3s,isTileHeader:!0}};return await he(r,n,i)}_onTileLoad(t,e,n){const r=new Ml(e.tileset,t,e,n);e.children.push(r);const i=this._tileManager.find(r.id).frameState;this.updateTile(r,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||(new Date).getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(r,i)}}const Fl={description:"",ellipsoid:Hn.WGS84,modelMatrix:new ln,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Dl="Tiles In Tileset(s)",Gl="Tiles In Memory",Ll="Tiles In View",Ul="Tiles To Render",Nl="Tiles Loaded",Pl="Tiles Loading",Hl="Tiles Unloaded",Jl="Failed Tile Loads",jl="Points/Vertices",kl="Tile Memory Use",Vl="Maximum Screen Space Error";class Kl{constructor(t,e){n(this,"options"),n(this,"loadOptions"),n(this,"type"),n(this,"tileset"),n(this,"loader"),n(this,"url"),n(this,"basePath"),n(this,"modelMatrix"),n(this,"ellipsoid"),n(this,"lodMetricType"),n(this,"lodMetricValue"),n(this,"refine"),n(this,"root",null),n(this,"roots",{}),n(this,"asset",{}),n(this,"description",""),n(this,"properties"),n(this,"extras",null),n(this,"attributions",{}),n(this,"credits",{}),n(this,"stats"),n(this,"contentFormats",{draco:!1,meshopt:!1,dds:!1,ktx2:!1}),n(this,"cartographicCenter",null),n(this,"cartesianCenter",null),n(this,"zoom",1),n(this,"boundingVolume",null),n(this,"dynamicScreenSpaceErrorComputedDensity",0),n(this,"maximumMemoryUsage",32),n(this,"gpuMemoryUsageInBytes",0),n(this,"memoryAdjustedScreenSpaceError",0),n(this,"_cacheBytes",0),n(this,"_cacheOverflowBytes",0),n(this,"_frameNumber",0),n(this,"_queryParams",{}),n(this,"_extensionsUsed",[]),n(this,"_tiles",{}),n(this,"_pendingCount",0),n(this,"selectedTiles",[]),n(this,"traverseCounter",0),n(this,"geometricError",0),n(this,"lastUpdatedVieports",null),n(this,"_requestedTiles",[]),n(this,"_emptyTiles",[]),n(this,"frameStateData",{}),n(this,"_traverser"),n(this,"_cache",new Vh),n(this,"_requestScheduler"),n(this,"updatePromise",null),n(this,"tilesetInitializationPromise"),this.options={...Fl,...e},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||function(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new Jh({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=1024*this.options.maximumMemoryUsage*1024,this._cacheOverflowBytes=1024*this.options.memoryCacheOverflow*1024,this.stats=new V({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber&&0===this._requestedTiles.length}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let e=t;return this.queryParams.length&&(e=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),e}hasExtension(t){return this._extensionsUsed.indexOf(t)>-1}update(t=null){this.tilesetInitializationPromise.then((()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)}))}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise((t=>{setTimeout((()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),t(this._frameNumber),this.updatePromise=null}),this.options.debounceTime)}))),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytesthis._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;const e=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=e.length;const n=[];for(const t of e){const e=t.id;this._needTraverse(e)?n.push(e):this.traverseCounter--}for(const t of e){const e=t.id;if(this.roots[e]||(this.roots[e]=this._initializeTileHeaders(this.tileset,null)),!n.includes(e))continue;const r=qh(t,this._frameNumber);this._traverser.traverse(this.roots[e],r,this.options)}}_needTraverse(t){let e=t;return this.options.viewportTraversersMap&&(e=this.options.viewportTraversersMap[t]),e===t}_onTraversalEnd(t){const e=t.viewport.id;this.frameStateData[e]||(this.frameStateData[e]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const n=this.frameStateData[e],r=Object.values(this._traverser.selectedTiles),[i,s]=function(t,e,n){if(0===n||t.length<=n)return[t,[]];const r=[],{longitude:i,latitude:s}=e.viewport;for(const[e,n]of t.entries()){const[t,o]=n.header.mbs,a=Math.abs(i-t),c=Math.abs(s-o),h=Math.sqrt(c*c+a*a);r.push([e,h])}const o=r.sort(((t,e)=>t[1]-e[1])),a=[];for(let e=0;e0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const t in this.frameStateData){const e=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(e.selectedTiles),this._requestedTiles=this._requestedTiles.concat(e._requestedTiles),this._emptyTiles=this._emptyTiles.concat(e._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,e){if(t.length!==e.length)return!0;const n=new Set(t.map((t=>t.id))),r=new Set(e.map((t=>t.id)));let i=t.filter((t=>!r.has(t.id))).length>0;return i=i||e.filter((t=>!n.has(t.id))).length>0,i}_loadTiles(){for(const t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,((t,e)=>t._unloadTile(e)))}_updateStats(){let t=0,e=0;for(const n of this.selectedTiles)n.contentAvailable&&n.content&&(t++,n.content.pointCount?e+=n.content.pointCount:e+=n.content.vertexCount);this.stats.get(Ll).count=this.selectedTiles.length,this.stats.get(Ul).count=t,this.stats.get(jl).count=e,this.stats.get(Vl).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===nl.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===nl.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===nl.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var t;const e=this.tileset.fullExtent;if(e){const{xmin:t,xmax:n,ymin:r,ymax:i,zmin:s,zmax:o}=e;return this.cartographicCenter=new Qe(t+(n-t)/2,r+(i-r)/2,s+(o-s)/2),this.cartesianCenter=new Qe,Hn.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),void(this.zoom=$h(e,this.cartographicCenter,this.cartesianCenter))}const n=null==(t=this.tileset.store)?void 0:t.extent;if(n){const[t,e,r,i]=n;return this.cartographicCenter=new Qe(t+(r-t)/2,e+(i-e)/2,0),this.cartesianCenter=new Qe,Hn.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),void(this.zoom=function(t,e,n){const[r,i,s,o]=t;return $h({xmin:r,xmax:s,ymin:i,ymax:o,zmin:0,zmax:0},e,n)}(n,this.cartographicCenter,this.cartesianCenter))}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new Qe,this.zoom=1}calculateViewPropsTiles3D(){const t=this.root,{center:e}=t.boundingVolume;if(!e)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Qe,void(this.zoom=1);0!==e[0]||0!==e[1]||0!==e[2]?(this.cartographicCenter=new Qe,Hn.WGS84.cartesianToCartographic(e,this.cartographicCenter)):this.cartographicCenter=new Qe(0,0,-Hn.WGS84.radii[0]),this.cartesianCenter=e,this.zoom=function(t,e){if(t instanceof Xn){const{halfAxes:n}=t,r=function(t){t.getColumn(0,Zh);const e=t.getColumn(1),n=t.getColumn(2);return Zh.add(e).add(n).len()}(n);return Math.log2(Xh/(r+e[2]))}if(t instanceof kn){const{radius:n}=t;return Math.log2(Xh/(n+e[2]))}if(t.width&&t.height){const{width:e,height:n}=t;return(Math.log2(6378137/e)+Math.log2(6378137/n))/2}return 1}(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Dl),this.stats.get(Pl),this.stats.get(Gl),this.stats.get(Ll),this.stats.get(Ul),this.stats.get(Nl),this.stats.get(Hl),this.stats.get(Jl),this.stats.get(jl),this.stats.get(kl,"memory"),this.stats.get(Vl)}_initializeTileHeaders(t,e){var n;const r=new Ml(this,t.root,e);if(e&&(e.children.push(r),r.depth=e.depth+1),this.type===nl.TILES3D){const t=[];for(t.push(r);t.length>0;){const e=t.pop();this.stats.get(Dl).incrementCount();const r=e.header.children||[];for(const i of r){const r=new Ml(this,i,e);if(null!=(n=r.contentUrl)&&n.includes("?session=")){const t=new URL(r.contentUrl).searchParams.get("session");t&&(this._queryParams.session=t)}e.children.push(r),r.depth=e.depth+1,t.push(r)}}}return r}_initializeTraverser(){let t;switch(this.type){case nl.TILES3D:t=Il;break;case nl.I3S:t=Ol;break;default:t=_l}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let e;try{this._onStartTileLoading(),e=await t.loadContent()}catch(e){this._onTileLoadError(t,e instanceof Error?e:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,e)}}_onTileLoadError(t,e){this.stats.get(Jl).incrementCount();const n=e.message||e.toString(),r=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,r)}_onTileLoad(t,e){var n,r;if(e){if(this.type===nl.I3S){const t=(null==(r=null==(n=this.tileset)?void 0:n.nodePagesTile)?void 0:r.nodesInNodePages)||0;this.stats.get(Dl).reset(),this.stats.get(Dl).addCount(t)}t&&t.content&&function(t,e){Ph(t),Ph(e);const{rtcCenter:n,gltfUpAxis:r}=e,{computedTransform:i,boundingVolume:{center:s}}=t;let o=new ln(i);switch(n&&o.translate(n),r){case"Z":break;case"Y":const t=(new ln).rotateX(Math.PI/2);o=o.multiplyRight(t);break;case"X":const e=(new ln).rotateY(-Math.PI/2);o=o.multiplyRight(e)}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const a=new Qe(s);e.cartesianModelMatrix=o,e.cartesianOrigin=a;const c=Hn.WGS84.cartesianToCartographic(a,new Qe),h=Hn.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=h.multiplyRight(o),e.cartographicOrigin=c,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){var e;if(this.type===nl.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0}else if(this.type===nl.TILES3D){const{extensionsRemoved:n=[]}=(null==(e=t.content)?void 0:e.gltf)||{};n.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),n.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),n.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Pl).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Pl).decrementCount()}_addTileToCache(t){this._cache.add(this,t,(e=>e._updateCacheStats(t)))}_updateCacheStats(t){this.stats.get(Nl).incrementCount(),this.stats.get(Gl).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(kl).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Gl).decrementCount(),this.stats.get(Hl).incrementCount(),this.stats.get(kl).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){const t=[];for(this.root&&t.push(this.root);t.length>0;){const e=t.pop();for(const n of e.children)t.push(n);this._destroyTile(e)}this.root=null}_destroySubtree(t){const e=t,n=[];for(n.push(e);n.length>0;){t=n.pop();for(const e of t.children)n.push(e);t!==e&&this._destroyTile(t)}e.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){const e=new URLSearchParams(t.queryString),n=Object.fromEntries(e.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version&&"1.1"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}function Ql(e){const n=document.createElement("canvas");n.width=64,n.height=64;const r=n.getContext("2d");r.rect(0,0,64,64);const i=r.createLinearGradient(0,0,64,64);for(let t=0;tt.toString(),ru=new t.ShaderMaterial({vertexShader:nu` +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("THREE"));else if("function"==typeof define&&define.amd)define(["THREE"],e);else{var n="object"==typeof exports?e(require("THREE")):e(t.THREE);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(t=>(()=>{var e={384:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("textarea",{schema:{transparentBG:{type:"boolean",default:!1},cols:{type:"int",default:40},rows:{type:"int",default:20},color:{type:"color",default:"black"},backgroundColor:{type:"color",default:"white"},disabledBackgroundColor:{type:"color",default:"lightgrey"},disabled:{type:"boolean",default:!1},text:{type:"string",default:""}},init:function(){this.text=null,this.lines=[],this.lastBlink=0,this.blinkEnabled=!this.data.disabled,this.charWidth=this.charHeight=null,this.selectionStart=this.selectionEnd=0,this.endIndexInfo=this.startIndexInfo=null,this.origin={x:0,y:0},this.background=document.createElement("a-plane"),this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor),this.el.appendChild(this.background),this.data.transparentBG&&this.background.setAttribute("material",{opacity:0,transparent:!0}),this.textAnchor=document.createElement("a-entity"),this.el.appendChild(this.textAnchor),this.textAnchor.setAttribute("text",{mode:"pre",baseline:"top",anchor:"center",font:"dejavu",wrapCount:this.data.cols,height:this.data.rows,color:this.data.color}),this._initTextarea(),this.el.addEventListener("textfontset",this._updateCharMetrics.bind(this)),this.el.addEventListener("char-metrics-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("text-changed",this._updateLines.bind(this)),this.el.addEventListener("text-changed",this._updateDisplayText.bind(this)),this.el.addEventListener("selection-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("selection-changed",this._updateHorizontalOrigin.bind(this)),this.el.addEventListener("lines-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("index-info-changed",this._updateOrigin.bind(this)),this.el.addEventListener("index-info-changed",this._updateHorizontalOrigin.bind(this)),this.el.addEventListener("origin-changed",this._updateDisplayText.bind(this)),this.el.addEventListener("click",this.focus.bind(this))},update:function(t){this.data.text!==t.text&&this._updateTextarea(),this.data.backgroundColor===t.backgroundColor&&this.data.disabledBackgroundColor===t.disabledBackgroundColor||this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor),this.data.disabled!==t.disabled&&(this.blinkEnabled=!this.data.disabled,this.textarea.disabled=this.data.disabled,this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor))},focus:function(){this.textarea.focus()},_initTextarea:function(){this.textarea=document.createElement("textarea"),document.body.appendChild(this.textarea),this._updateTextarea()},_updateTextarea:function(){this.textarea.style.whiteSpace="pre",this.textarea.style.overflow="hidden",this.textarea.style.opacity="0",this.textarea.cols=this.data.cols,this.textarea.rows=this.data.rows,this.textarea.value=this.data.text,this.textarea.selectionStart=0,this.textarea.selectionEnd=0,this._updateIndexInfo()},_emit:function(t,e){this.el.emit(t,e)},_updateCharMetrics:function(t){const e=this.textAnchor.components.text.geometry.layout,n=t.detail.fontObj.widthFactor;this.charWidth=n*this.textAnchor.object3DMap.text.scale.x,this.charHeight=this.charWidth*e.lineHeight/n,this.textAnchor.setAttribute("position",{x:0,y:this.charHeight*this.data.rows/2,z:0}),this.data.transparentBG||(this.background.setAttribute("scale",{x:1.05,y:this.charHeight*this.data.rows*1.05,z:1}),this.background.setAttribute("position",{x:0,y:0,z:0})),this._emit("char-metrics-changed")},_checkAndUpdateSelection:function(){if(this.selectionStart===this.textarea.selectionStart&&this.selectionEnd===this.textarea.selectionEnd)return;const t=this.selectionStart,e=this.selectionEnd;this.selectionStart=this.textarea.selectionStart,this.selectionEnd=this.textarea.selectionEnd,this._emit("selection-changed",{start:{old:t,new:this.selectionStart,changed:this.selectionStart!==t},end:{old:e,new:this.selectionEnd,changed:this.selectionEnd!==e}})},tick:function(t){t-this.lastBlink>500&&this.blinkEnabled&&(this.lastBlink=t),this._checkAndUpdateSelection(),this._checkAndUpdateText()},_getIndexInfo:function(t,e){const n=Math.max(0,t),r=this.lines[n];return{line:r,x:(e-r.start)*this.charWidth,y:-this.charHeight*n+-this.charHeight/2}},_updateIndexInfo:function(){if(!this.lines.length)return;const t=this.startIndexInfo&&this.startIndexInfo.line.index,e=this.endIndexInfo&&this.endIndexInfo.line.index;let n;this.startIndexInfo=null,this.endIndexInfo=null;let r=!1,i=!1;for(n=0;n<=this.lines.length;n++){const s=this.lines[n-1],o=n===this.lines.length?s.start+s.length+1:this.lines[n].start;if(o>this.selectionStart&&!this.startIndexInfo&&(this.startIndexInfo=this._getIndexInfo(n-1,this.selectionStart),this.startIndexInfo.line.index!==t&&(r=!0)),o>this.selectionEnd){this.endIndexInfo=this._getIndexInfo(n-1,this.selectionEnd),this.endIndexInfo.line.index!==e&&(i=!0);break}}(r||i)&&this._emit("index-info-changed",{start:{changed:r},end:{changed:i}})},_updateOrigin:function(t){let e=!1;if(t.detail.end.changed){const t=this.origin.y+this.data.rows-1;this.endIndexInfo.line.index>t?(this.origin.y=this.endIndexInfo.line.index+1-this.data.rows,e=!0):this.endIndexInfo.line.indexthis.origin.x+this.data.cols?(this.origin.x=t-this.data.cols,e=!0):tthis.origin.x+this.data.cols?(this.origin.x=n-this.data.cols,e=!0):n{"use strict";e.exports=t}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var s=n[t]={exports:{}};return e[t](s,s.exports,r),s.exports}r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i);var t=r(824),e=Object.defineProperty,n=(t,n,r)=>(((t,n,r)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r})(t,"symbol"!=typeof n?n+"":n,r),r);async function s(t,e,n,r){return r._parse(t,e,n,r)}function o(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const a=!("object"==typeof process&&"[object process]"===String(process)&&!process.browser),c=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);function h(t,e){return l(t||{},e)}function l(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(n>3)return e;const r={...t};for(const[t,i]of Object.entries(e))i&&"object"==typeof i&&!Array.isArray(i)?r[t]=l(r[t]||{},e[t],n+1):r[t]=e[t];return r}c&&parseFloat(c[1]);const u="latest",d=(null!==(f=globalThis._loadersgl_)&&void 0!==f&&f.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.1"),globalThis._loadersgl_.version);var f;function m(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const p="object"!=typeof process||"[object process]"!==String(process)||process.browser,g="function"==typeof importScripts,A=typeof window<"u"&&typeof window.orientation<"u",y=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);y&&parseFloat(y[1]);class B{constructor(t,e){this.name=void 0,this.workerThread=void 0,this.isRunning=!0,this.result=void 0,this._resolve=()=>{},this._reject=()=>{},this.name=t,this.workerThread=e,this.result=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){m(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){m(this.isRunning),this.isRunning=!1,this._reject(t)}}class b{terminate(){}}const C=new Map;function w(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function v(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0;const r=n||new Set;if(t)if(E(t))r.add(t);else if(E(t.buffer))r.add(t.buffer);else if(!ArrayBuffer.isView(t)&&e&&"object"==typeof t)for(const n in t)v(t[n],e,r);return void 0===n?Array.from(r):[]}function E(t){return!!t&&(t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)}const T=()=>{};class _{static isSupported(){return typeof Worker<"u"&&p||typeof b<"u"&&!p}constructor(t){this.name=void 0,this.source=void 0,this.url=void 0,this.terminated=!1,this.worker=void 0,this.onMessage=void 0,this.onError=void 0,this._loadableURL="";const{name:e,source:n,url:r}=t;m(n||r),this.name=e,this.source=n,this.url=r,this.onMessage=T,this.onError=t=>console.log(t),this.worker=p?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=T,this.onError=T,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(t,e){e=e||v(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name} from ${this.url}. `,t.message&&(e+=`${t.message} in `),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=function(t){m(t.source&&!t.url||!t.source&&t.url);let e=C.get(t.source||t.url);return e||(t.url&&(e=function(t){return t.startsWith("http")?w(function(t){return`try {\n importScripts('${t}');\n} catch (error) {\n console.error(error);\n throw error;\n}`}(t)):t}(t.url),C.set(t.url,e)),t.source&&(e=w(t.source),C.set(t.source,e))),m(e),e}({source:this.source,url:this.url});const t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},t.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},t.onmessageerror=t=>console.error(t),t}_createNodeWorker(){let t;if(this.url){const e=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new b(e,{eval:!1})}else{if(!this.source)throw new Error("no worker");t=new b(this.source,{eval:!0})}return t.on("message",(t=>{this.onMessage(t)})),t.on("error",(t=>{this.onError(t)})),t.on("exit",(t=>{})),t}}class x{static isSupported(){return _.isSupported()}constructor(t){this.name="unnamed",this.source=void 0,this.url=void 0,this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1,this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach((t=>t.destroy())),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},void 0!==t.name&&(this.name=t.name),void 0!==t.maxConcurrency&&(this.maxConcurrency=t.maxConcurrency),void 0!==t.maxMobileConcurrency&&(this.maxMobileConcurrency=t.maxMobileConcurrency),void 0!==t.reuseWorkers&&(this.reuseWorkers=t.reuseWorkers),void 0!==t.onDebug&&(this.onDebug=t.onDebug)}async startJob(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(t,e,n)=>t.done(n),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(t,e)=>t.error(e);const r=new Promise((r=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:r}),this)));return this._startQueuedJob(),await r}async _startQueuedJob(){if(!this.jobQueue.length)return;const t=this._getAvailableWorker();if(!t)return;const e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});const n=new B(e.name,t);t.onMessage=t=>e.onMessage(n,t.type,t.payload),t.onError=t=>e.onError(n,t),e.onStart(n);try{await n.result}catch(t){console.error(`Worker exception: ${t}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!p||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}};class I{static isSupported(){return _.isSupported()}static getWorkerFarm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return I._workerFarm=I._workerFarm||new I({}),I._workerFarm.setProps(t),I._workerFarm}constructor(t){this.props=void 0,this.workerPools=new Map,this.props={...M},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:n,url:r}=t;let i=this.workerPools.get(e);return i||(i=new x({name:e,source:n,url:r}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}I._workerFarm=void 0;const S=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})),R={};async function O(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return e&&(t=F(t,e,n,r)),R[t]=R[t]||D(t),await R[t]}function F(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!n.useLocalLibraries&&t.startsWith("http"))return t;r=r||t;const i=n.modules||{};return i[r]?i[r]:p?n.CDN?(m(n.CDN.startsWith("http")),`${n.CDN}/${e}@${d}/dist/libs/${r}`):g?`../src/libs/${r}`:`modules/${e}/src/libs/${r}`:`modules/${e}/dist/libs/${r}`}async function D(t){if(t.endsWith("wasm"))return await async function(t){return await(await fetch(t)).arrayBuffer()}(t);if(!p)try{return S&&void 0}catch(t){return console.error(t),null}if(g)return importScripts(t);const e=await async function(t){return await(await fetch(t)).text()}(t);return function(t,e){if(!p)return;if(g)return eval.call(globalThis,t),null;const n=document.createElement("script");n.id=e;try{n.appendChild(document.createTextNode(t))}catch{n.text=t}return document.body.appendChild(n),null}(e,t)}async function G(t,e,n,r,i){const s=t.id,o=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e[t.id]||{},r=p?`${t.id}-worker.js`:`${t.id}-worker-node.js`;let i=n.workerUrl;if(!i&&"compression"===t.id&&(i=e.workerUrl),"test"===e._workerType&&(i=p?`modules/${t.module}/dist/${r}`:`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!i){let e=t.version;"latest"===e&&(e=u);const n=e?`@${e}`:"";i=`https://unpkg.com/@loaders.gl/${t.module}${n}/dist/${r}`}return m(i),i}(t,n),a=I.getWorkerFarm(n).getWorkerPool({name:s,url:o});n=JSON.parse(JSON.stringify(n)),r=JSON.parse(JSON.stringify(r||{}));const c=await a.startJob("process-on-worker",L.bind(null,i));return c.postMessage("process",{input:e,options:n,context:r}),await(await c.result).result}async function L(t,e,n,r){switch(n){case"done":e.done(r);break;case"error":e.error(new Error(r.error));break;case"process":const{id:i,input:s,options:o}=r;try{const n=await t(s,o);e.postMessage("done",{id:i,result:n})}catch(t){const n=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:i,error:n})}break;default:console.warn(`parse-with-worker unknown message ${n}`)}}function U(t,e,n){if(t.byteLength<=e+n)return"";const r=new DataView(t);let i="";for(let t=0;tt instanceof ArrayBuffer?new Uint8Array(t):t)),n=e.reduce(((t,e)=>t+e.byteLength),0),r=new Uint8Array(n);let i=0;for(const t of e)r.set(t,i),i+=t.byteLength;return r.buffer}function P(t,e,n){const r=void 0!==n?new Uint8Array(t).subarray(e,e+n):new Uint8Array(t).subarray(e);return new Uint8Array(r).buffer}function H(t,e){return o(t>=0),o(e>0),t+(e-1)&~(e-1)}function J(t,e,n){let r;if(t instanceof ArrayBuffer)r=new Uint8Array(t);else{const e=t.byteOffset,n=t.byteLength;r=new Uint8Array(t.buffer||t.arrayBuffer,e,n)}return e.set(r,n),n+H(r.byteLength,4)}function j(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){const e=process.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}class k{constructor(t,e){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=j(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(j()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class V{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t of Object.values(this.stats))t.reset();return this}forEach(t){for(const e of Object.values(this.stats))t(e)}getTable(){const t={};return this.forEach((e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}})),t}_initializeStats(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((t=>this._getOrCreate(t)))}_getOrCreate(t){const{name:e,type:n}=t;let r=this.stats[e];return r||(r=t instanceof k?t:new k(e,n),this.stats[e]=r),r}}const K={};function Q(t){if(function(t){return t&&"object"==typeof t&&t.isBuffer}(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return 0===t.byteOffset&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if("string"==typeof t){const e=t;return(new TextEncoder).encode(e).buffer}if(t&&"object"==typeof t&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}function z(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();const e=null===(t=window.location)||void 0===t?void 0:t.pathname;return(null==e?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function q(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function W(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}const Y=47;function X(t,e){let n,r="",i=-1,s=0,o=!1;for(let a=0;a<=t.length;++a){if(a2){const t=r.length-1;let e=t;for(;e>=0&&r.charCodeAt(e)!==Y;--e);if(e!==t){r=-1===e?"":r.slice(0,e),i=a,s=0,o=!1;continue}}else if(2===r.length||1===r.length){r="",i=a,s=0,o=!1;continue}e&&(r.length>0?r+="/..":r="..",o=!0)}else{const e=t.slice(i+1,a);r.length>0?r+=`/${e}`:r=e,o=!1}i=a,s=0}else 46===n&&-1!==s?++s:s=-1}return r}const Z=t=>"function"==typeof t,$=t=>null!==t&&"object"==typeof t,tt=t=>$(t)&&t.constructor==={}.constructor,et=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,nt=t=>typeof Blob<"u"&&t instanceof Blob,rt=t=>(t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||$(t)&&Z(t.tee)&&Z(t.cancel)&&Z(t.getReader))(t)||(t=>$(t)&&Z(t.read)&&Z(t.pipe)&&(t=>"boolean"==typeof t)(t.readable))(t),it=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,st=/^([-\w.]+\/[-\w.+]+)/;function ot(t){const e=it.exec(t);return e?e[1]:""}const at=/\?.*/;function ct(t){return t.replace(at,"")}function ht(t){return et(t)?t.url:nt(t)?t.name||"":"string"==typeof t?t:""}function lt(t){if(et(t)){const e=t,n=e.headers.get("content-type")||"",r=ct(e.url);return function(t){const e=st.exec(t);return e?e[1]:t}(n)||ot(r)}return nt(t)?t.type||"":"string"==typeof t?ot(t):""}async function ut(t){if(et(t))return t;const e={},n=function(t){return et(t)?t.headers["content-length"]||-1:nt(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}(t);n>=0&&(e["content-length"]=String(n));const r=ht(t),i=lt(t);i&&(e["content-type"]=i);const s=await async function(t){if("string"==typeof t)return`data:,${t.slice(0,5)}`;if(t instanceof Blob){const e=t.slice(0,5);return await new Promise((t=>{const n=new FileReader;n.onload=e=>{var n;return t(null==e||null===(n=e.target)||void 0===n?void 0:n.result)},n.readAsDataURL(e)}))}return t instanceof ArrayBuffer?`data:base64,${function(t){let e="";const n=new Uint8Array(t);for(let t=0;t=0)}()}const mt=globalThis.window||globalThis.self||globalThis.global,pt=globalThis.process||{},gt=typeof __VERSION__<"u"?__VERSION__:"untranspiled source";ft();class At{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=function(t){try{const e=window[t],n="__storage_test__";return e.setItem(n,n),e.removeItem(n),e}catch{return null}}(n),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let t={};if(this.storage){const e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}function yt(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>r&&(n=Math.min(n,r/t.width));const s=t.width*n,o=t.height*n,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(s/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(s,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}let Bt;function bt(t){return"string"!=typeof t?t:(t=t.toUpperCase(),Bt[t]||Bt.WHITE)}function Ct(t,e){if(!t)throw new Error(e||"Assertion failed")}function wt(){let t;var e,n;if(ft()&&mt.performance)t=null==mt||null===(e=mt.performance)||void 0===e||null===(n=e.now)||void 0===n?void 0:n.call(e);else if("hrtime"in pt){var r;const e=null==pt||null===(r=pt.hrtime)||void 0===r?void 0:r.call(pt);t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}!function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(Bt||(Bt={}));const vt={debug:ft()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Et={enabled:!0,level:0};function Tt(){}const _t={},xt={once:!0};class Mt{constructor(){let{id:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};this.id=void 0,this.VERSION=gt,this._startTs=wt(),this._deltaTs=wt(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new At("__probe-".concat(this.id,"__"),Et),this.timeStamp("".concat(this.id," started")),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const n=Object.getPrototypeOf(t),r=Object.getOwnPropertyNames(n),i=t;for(const n of r){const r=i[n];"function"==typeof r&&(e.find((t=>n===t))||(i[n]=r.bind(t)))}}(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((wt()-this._startTs).toPrecision(10))}getDelta(){return Number((wt()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){Ct(t,e)}warn(t){return this._getLogFunction(0,t,vt.warn,arguments,xt)}error(t){return this._getLogFunction(0,t,vt.error,arguments)}deprecated(t,e){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(e,"` instead"))}removed(t,e){return this.error("`".concat(t,"` has been removed. Use `").concat(e,"` instead"))}probe(t,e){return this._getLogFunction(t,e,vt.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,vt.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,vt.debug||vt.info,arguments,xt)}table(t,e,n){return e?this._getLogFunction(t,e,console.table||Tt,n&&[n],{tag:Rt(e)}):Tt}image(t){let{logLevel:e,priority:n,image:r,message:i="",scale:s=1}=t;return this._shouldLog(e||n)?ft()?function(t){let{image:e,message:n="",scale:r=1}=t;if("string"==typeof e){const t=new Image;return t.onload=()=>{const e=yt(t,n,r);console.log(...e)},t.src=e,Tt}const i=e.nodeName||"";if("img"===i.toLowerCase())return console.log(...yt(e,n,r)),Tt;if("canvas"===i.toLowerCase()){const t=new Image;return t.onload=()=>console.log(...yt(t,n,r)),t.src=e.toDataURL(),Tt}return Tt}({image:r,message:i,scale:s}):(console.warn("removed"),Tt):Tt}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||Tt)}group(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const r=St({logLevel:t,message:e,opts:n}),{collapsed:i}=n;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Tt)}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=It(t)}_getLogFunction(t,e,n,r,i){if(this._shouldLog(t)){i=St({logLevel:t,message:e,args:r,opts:i}),Ct(n=n||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=wt();const s=i.tag||i.message;if(i.once&&s){if(_t[s])return Tt;_t[s]=wt()}return e=function(t,e,n){if("string"==typeof e){const r=n.time?function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const n=Math.max(e-t.length,0);return"".concat(" ".repeat(n)).concat(t)}(function(t){let e;return e=t<10?"".concat(t.toFixed(2),"ms"):t<100?"".concat(t.toFixed(1),"ms"):t<1e3?"".concat(t.toFixed(0),"ms"):"".concat((t/1e3).toFixed(2),"s"),e}(n.total)):"";e=n.time?"".concat(t,": ").concat(r," ").concat(e):"".concat(t,": ").concat(e),e=function(t,e,n){if(!ft&&"string"==typeof t){if(e){const n=bt(e);t="[".concat(n,"m").concat(t,"")}if(n){const e=bt(n);t="[".concat(e+10,"m").concat(t,"")}}return t}(e,n.color,n.background)}return e}(this.id,i.message,i),n.bind(console,e,...i.args)}return Tt}}function It(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return Ct(Number.isFinite(e)&&e>=0),e}function St(t){const{logLevel:e,message:n}=t;t.logLevel=It(e);const r=t.args?Array.from(t.args):[];for(;r.length&&r.shift()!==n;);switch(typeof e){case"string":case"function":void 0!==n&&r.unshift(n),t.message=e;break;case"object":Object.assign(t,e)}"function"==typeof t.message&&(t.message=t.message());const i=typeof t.message;return Ct("string"===i||"object"===i),Object.assign(t,{args:r},t.opts)}function Rt(t){for(const e in t)for(const n in t[e])return n||"untitled";return"empty"}Mt.VERSION=gt;const Ot=new Mt({id:"@probe.gl/log"}),Ft=new Mt({id:"loaders.gl"});class Dt{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const Gt={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){this.console=void 0,this.console=console}log(){for(var t=arguments.length,e=new Array(t),n=0;n{const t=Ut();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry})()}const Kt=new Mt({id:"loaders.gl"}),Qt=/\.([^.]+)$/;function zt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!Wt(t))return null;if(e&&!Array.isArray(e))return kt(e);let i=[];e&&(i=i.concat(e)),null!=n&&n.ignoreRegisteredLoaders||i.push(...Vt()),Xt(i);const s=qt(t,i,n,r);if(!(s||null!=n&&n.nothrow))throw new Error(Yt(t));return s}function qt(t,e,n,r){const i=ht(t),s=lt(t),o=ct(i)||(null==r?void 0:r.url);let a=null,c="";var h;return null!=n&&n.mimeType&&(a=Zt(e,null==n?void 0:n.mimeType),c=`match forced by supplied MIME type ${null==n?void 0:n.mimeType}`),a=a||function(t,e){const n=e&&Qt.exec(e),r=n&&n[1];return r?function(t,e){e=e.toLowerCase();for(const n of t)for(const t of n.extensions)if(t.toLowerCase()===e)return n;return null}(t,r):null}(e,o),c=c||(a?`matched url ${o}`:""),a=a||Zt(e,s),c=c||(a?`matched MIME type ${s}`:""),a=a||function(t,e){if(!e)return null;for(const n of t)if("string"==typeof e){if($t(e,n))return n}else if(ArrayBuffer.isView(e)){if(te(e.buffer,e.byteOffset,n))return n}else if(e instanceof ArrayBuffer&&te(e,0,n))return n;return null}(e,t),c=c||(a?`matched initial data ${ee(t)}`:""),null!=n&&n.fallbackMimeType&&(a=a||Zt(e,null==n?void 0:n.fallbackMimeType),c=c||(a?`matched fallback MIME type ${s}`:"")),c&&Kt.log(1,`selectLoader selected ${null===(h=a)||void 0===h?void 0:h.name}: ${c}.`),a}function Wt(t){return!(t instanceof Response&&204===t.status)}function Yt(t){const e=ht(t),n=lt(t);let r="No valid loader found (";r+=e?`${q(e)}, `:"no url provided, ",r+=`MIME type: ${n?`"${n}"`:"not provided"}, `;const i=t?ee(t):"";return r+=i?` first bytes: "${i}"`:"first bytes: not available",r+=")",r}function Xt(t){for(const e of t)kt(e)}function Zt(t,e){for(const n of t)if(n.mimeTypes&&n.mimeTypes.includes(e)||e===`application/x.${n.id}`)return n;return null}function $t(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some((e=>t.startsWith(e)))}function te(t,e,n){return(Array.isArray(n.tests)?n.tests:[n.tests]).some((n=>function(t,e,n,r){if(r instanceof ArrayBuffer)return function(t,e,n){if(n=n||t.byteLength,t.byteLength1&&void 0!==arguments[1]?arguments[1]:5;return"string"==typeof t?t.slice(0,e):ArrayBuffer.isView(t)?ne(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?ne(t,0,e):""}function ne(t,e,n){if(t.byteLengtht&&"object"==typeof t&&t.isBuffer)(t)&&(t=t.buffer),t instanceof ArrayBuffer){const n=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let n=t.buffer;const r=t.byteLength||t.length;return(0!==t.byteOffset||r!==n.byteLength)&&(n=n.slice(t.byteOffset,t.byteOffset+r)),n}throw new Error(se)}(t,e);if(nt(t)&&(t=await ut(t)),et(t)){const n=t;return await async function(t){if(!t.ok){const e=await async function(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{const n=t.headers.get("Content-Type");let r=t.statusText;null!=n&&n.includes("application/json")&&(r+=` ${await t.text()}`),e+=r,e=e.length>60?`${e.slice(0,60)}...`:e}catch{}return e}(t);throw new Error(e)}}(n),e.binary?await n.arrayBuffer():await n.text()}if(rt(t)&&(t=function(t,e){if("string"==typeof t)return function*(t,e){const n=(null==e?void 0:e.chunkSize)||262144;let r=0;const i=new TextEncoder;for(;r1&&void 0!==arguments[1]?arguments[1]:{};return function*(){const{chunkSize:n=re}=e;let r=0;for(;r!!t&&"function"==typeof t[Symbol.iterator])(t)||(t=>t&&"function"==typeof t[Symbol.asyncIterator])(t))return async function(t){const e=[];for await(const n of t)e.push(n);return function(){for(var t=arguments.length,e=new Array(t),n=0;ndt(t,r.fetch):null!=e&&e.fetch?null==e?void 0:e.fetch:dt}async function ce(t,e,n,r){e&&!Array.isArray(e)&&!jt(e)&&(r=void 0,n=e,e=void 0),n=n||{};const i=ht(t=await t),s=function(t,e){if(t&&!Array.isArray(t))return t;let n;if(t&&(n=Array.isArray(t)?t:[t]),e&&e.loaders){const t=Array.isArray(e.loaders)?e.loaders:[e.loaders];n=n?[...n,...t]:t}return n&&n.length?n:void 0}(e,r),o=await async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!Wt(t))return null;let i=zt(t,e,{...n,nothrow:!0},r);if(i)return i;if(nt(t)&&(i=zt(t=await t.slice(0,10).arrayBuffer(),e,n,r)),!(i||null!=n&&n.nothrow))throw new Error(Yt(t));return i}(t,s,n);return o?(r=function(t,e,n){if(n)return n;const r={fetch:ae(e,t),...t};if(r.url){const t=ct(r.url);r.baseUrl=t,r.queryString=function(t){const e=t.match(at);return e&&e[0]}(r.url),r.filename=q(t),r.baseUrl=W(t)}return Array.isArray(r.loaders)||(r.loaders=null),r}({url:i,_parse:ce,loaders:s},n=function(t,e,n,r){return n=n||[],function(t,e){Pt(t,null,Gt,Lt,e);for(const n of e){const r=t&&t[n.id]||{},i=n.options&&n.options[n.id]||{},s=n.deprecatedOptions&&n.deprecatedOptions[n.id]||{};Pt(r,n.id,i,s,e)}}(t,n=Array.isArray(n)?n:[n]),function(t,e,n){const r={...t.options||{}};return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(r,n),null===r.log&&(r.log=new Dt),Jt(r,Nt()),Jt(r,e),r}(e,t,r)}(n,o,s,i),r||null),await async function(t,e,n,r){if(function(t){m(t,"no worker provided");t.version}(t),n=h(t.options,n),et(e)){const t=e,{ok:n,redirected:i,status:s,statusText:o,type:a,url:c}=t,h=Object.fromEntries(t.headers.entries());r.response={headers:h,ok:n,redirected:i,status:s,statusText:o,type:a,url:c}}e=await oe(e,t,n);const i=t;if(i.parseTextSync&&"string"==typeof e)return i.parseTextSync(e,n,r);if(function(t,e){return!(!I.isSupported()||!(p||null!=e&&e._nodeWorkers))&&t.worker&&(null==e?void 0:e.worker)}(t,n))return await G(t,e,n,r,ce);if(i.parseText&&"string"==typeof e)return await i.parseText(e,n,r);if(i.parse)return await i.parse(e,n,r);throw m(!i.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}(o,t,n,r)):null}async function he(t,e,n,r){let i,s;Array.isArray(e)||jt(e)?(i=e,s=n):(i=[],s=e);const o=ae(s);let a=t;return"string"==typeof t&&(a=await o(t)),nt(t)&&(a=await o(t)),Array.isArray(i),await ce(a,i,s)}const le=1/Math.PI*180,ue=1/180*Math.PI;globalThis.mathgl=globalThis.mathgl||{config:{EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1}};const de=globalThis.mathgl.config;function fe(t,{precision:e=de.precision}={}){return t=function(t){return Math.round(t/de.EPSILON)*de.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function me(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function pe(t){return function(t,e){return be(t,(t=>t*ue),void 0)}(t)}function ge(t){return Ae(t)}function Ae(t,e){return be(t,(t=>t*le),e)}function ye(t,e,n){return be(t,(t=>Math.max(e,Math.min(n,t))))}function Be(t,e,n){const r=de.EPSILON;n&&(de.EPSILON=n);try{if(t===e)return!0;if(me(t)&&me(e)){if(t.length!==e.length)return!1;for(let n=0;n0?", ":"")+fe(this[n],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e=0&&t=0&&t0?this.copy([t,...e]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(Ze)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n+n,a=r+r,c=i+i,h=n*o,l=r*o,u=r*a,d=i*o,f=i*a,m=i*c,p=s*o,g=s*a,A=s*c;t[0]=1-u-m,t[3]=l-A,t[6]=d+g,t[1]=l+A,t[4]=1-h-m,t[7]=f-p,t[2]=d-g,t[5]=f+p,t[8]=1-h-u}(this,t),this.check()}set(t,e,n,r,i,s,o,a,c){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=a,this[8]=c,this.check()}setRowMajor(t,e,n,r,i,s,o,a,c){return this[0]=t,this[1]=r,this[2]=o,this[3]=e,this[4]=i,this[5]=a,this[6]=n,this[7]=s,this[8]=c,this.check()}determinant(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],h=t[8];return e*(h*s-o*c)+n*(-h*i+o*a)+r*(c*i-s*a)}(this)}transpose(){return function(t,e){if(t===e){const n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],h=e[7],l=e[8],u=l*o-a*h,d=-l*s+a*c,f=h*s-o*c;let m=n*u+r*d+i*f;m&&(m=1/m,t[0]=u*m,t[1]=(-l*r+i*h)*m,t[2]=(a*r-i*o)*m,t[3]=d*m,t[4]=(l*n-i*c)*m,t[5]=(-a*n+i*s)*m,t[6]=f*m,t[7]=(-h*n+r*c)*m,t[8]=(o*n-r*s)*m)}(this,this),this.check()}multiplyLeft(t){return We(this,t,this),this.check()}multiplyRight(t){return We(this,this,t),this.check()}rotate(t){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=Math.sin(n),f=Math.cos(n);t[0]=f*r+d*o,t[1]=f*i+d*a,t[2]=f*s+d*c,t[3]=f*o-d*r,t[4]=f*a-d*i,t[5]=f*c-d*s,t[6]=h,t[7]=l,t[8]=u}(this,this,t),this.check()}scale(t){return Array.isArray(t)?Ye(this,this,t):Ye(this,this,[t,t]),this.check()}translate(t){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=n[0],f=n[1];t[0]=r,t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=c,t[6]=d*r+f*o+h,t[7]=d*i+f*a+l,t[8]=d*s+f*c+u}(this,this,t),this.check()}transform(t,e){let n;switch(t.length){case 2:n=Me(e||[-0,-0],t,this);break;case 3:n=He(e||[-0,-0,-0],t,this);break;case 4:n=Oe(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ve(n,t.length),n}transformVector(t,e){return this.transform(t,e)}transformVector2(t,e){return this.transform(t,e)}transformVector3(t,e){return this.transform(t,e)}}let tn,en=null;function nn(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=e[9],f=e[10],m=e[11],p=e[12],g=e[13],A=e[14],y=e[15];let B=n[0],b=n[1],C=n[2],w=n[3];return t[0]=B*r+b*a+C*u+w*p,t[1]=B*i+b*c+C*d+w*g,t[2]=B*s+b*h+C*f+w*A,t[3]=B*o+b*l+C*m+w*y,B=n[4],b=n[5],C=n[6],w=n[7],t[4]=B*r+b*a+C*u+w*p,t[5]=B*i+b*c+C*d+w*g,t[6]=B*s+b*h+C*f+w*A,t[7]=B*o+b*l+C*m+w*y,B=n[8],b=n[9],C=n[10],w=n[11],t[8]=B*r+b*a+C*u+w*p,t[9]=B*i+b*c+C*d+w*g,t[10]=B*s+b*h+C*f+w*A,t[11]=B*o+b*l+C*m+w*y,B=n[12],b=n[13],C=n[14],w=n[15],t[12]=B*r+b*a+C*u+w*p,t[13]=B*i+b*c+C*d+w*g,t[14]=B*s+b*h+C*f+w*A,t[15]=B*o+b*l+C*m+w*y,t}var rn;!function(){const t=new xe(4);xe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"}(rn||(rn={}));const sn=45*Math.PI/180,on=1,an=.1,cn=500,hn=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class ln extends qe{static get IDENTITY(){return dn||(dn=new ln,Object.freeze(dn)),dn}static get ZERO(){return un||(un=new ln([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(un)),un}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return rn}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,n,r,i,s,o,a,c,h,l,u,d,f,m,p){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=a,this[8]=c,this[9]=h,this[10]=l,this[11]=u,this[12]=d,this[13]=f,this[14]=m,this[15]=p,this.check()}setRowMajor(t,e,n,r,i,s,o,a,c,h,l,u,d,f,m,p){return this[0]=t,this[1]=i,this[2]=c,this[3]=d,this[4]=e,this[5]=s,this[6]=h,this[7]=f,this[8]=n,this[9]=o,this[10]=l,this[11]=m,this[12]=r,this[13]=a,this[14]=u,this[15]=p,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(hn)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n+n,a=r+r,c=i+i,h=n*o,l=r*o,u=r*a,d=i*o,f=i*a,m=i*c,p=s*o,g=s*a,A=s*c;t[0]=1-u-m,t[1]=l+A,t[2]=d-g,t[3]=0,t[4]=l-A,t[5]=1-h-m,t[6]=f+p,t[7]=0,t[8]=d+g,t[9]=f-p,t[10]=1-h-u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum(t){const{left:e,right:n,bottom:r,top:i,near:s=an,far:o=cn}=t;return o===1/0?function(t,e,n,r,i,s){const o=2*s/(n-e),a=2*s/(i-r),c=(n+e)/(n-e),h=(i+r)/(i-r),l=-2*s;t[0]=o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=h,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=l,t[15]=0}(this,e,n,r,i,s):function(t,e,n,r,i,s,o){const a=1/(n-e),c=1/(i-r),h=1/(s-o);t[0]=2*s*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*c,t[6]=0,t[7]=0,t[8]=(n+e)*a,t[9]=(i+r)*c,t[10]=(o+s)*h,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*s*2*h,t[15]=0}(this,e,n,r,i,s,o),this.check()}lookAt(t){const{eye:e,center:n=[0,0,0],up:r=[0,1,0]}=t;return function(t,e,n,r){let i,s,o,a,c,h,l,u,d,f;const m=e[0],p=e[1],g=e[2],A=r[0],y=r[1],B=r[2],b=n[0],C=n[1],w=n[2];Math.abs(m-b)<_e&&Math.abs(p-C)<_e&&Math.abs(g-w)<_e?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(u=m-b,d=p-C,f=g-w,i=1/Math.sqrt(u*u+d*d+f*f),u*=i,d*=i,f*=i,s=y*f-B*d,o=B*u-A*f,a=A*d-y*u,i=Math.sqrt(s*s+o*o+a*a),i?(i=1/i,s*=i,o*=i,a*=i):(s=0,o=0,a=0),c=d*a-f*o,h=f*s-u*a,l=u*o-d*s,i=Math.sqrt(c*c+h*h+l*l),i?(i=1/i,c*=i,h*=i,l*=i):(c=0,h=0,l=0),t[0]=s,t[1]=c,t[2]=u,t[3]=0,t[4]=o,t[5]=h,t[6]=d,t[7]=0,t[8]=a,t[9]=l,t[10]=f,t[11]=0,t[12]=-(s*m+o*p+a*g),t[13]=-(c*m+h*p+l*g),t[14]=-(u*m+d*p+f*g),t[15]=1)}(this,e,n,r),this.check()}ortho(t){const{left:e,right:n,bottom:r,top:i,near:s=an,far:o=cn}=t;return function(t,e,n,r,i,s,o){const a=1/(e-n),c=1/(r-i),h=1/(s-o);t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+n)*a,t[13]=(i+r)*c,t[14]=(o+s)*h,t[15]=1}(this,e,n,r,i,s,o),this.check()}orthographic(t){const{fovy:e=sn,aspect:n=on,focalDistance:r=1,near:i=an,far:s=cn}=t;fn(e);const o=e/2,a=r*Math.tan(o),c=a*n;return this.ortho({left:-c,right:c,bottom:-a,top:a,near:i,far:s})}perspective(t){const{fovy:e=45*Math.PI/180,aspect:n=1,near:r=.1,far:i=500}=t;return fn(e),function(t,e,n,r,i){const s=1/Math.tan(e/2);if(t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0){const e=1/(r-i);t[10]=(i+r)*e,t[14]=2*i*r*e}else t[10]=-1,t[14]=-2*r}(this,e,n,r,i),this.check()}determinant(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],h=t[8],l=t[9],u=t[10],d=t[11],f=t[12],m=t[13],p=t[14],g=e*o-n*s,A=e*a-r*s,y=n*a-r*o,B=h*m-l*f,b=h*p-u*f,C=l*p-u*m;return c*(e*C-n*b+r*B)-i*(s*C-o*b+a*B)+t[15]*(h*y-l*A+u*g)-d*(f*y-m*A+p*g)}(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),r=1/n[0],i=1/n[1],s=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*i,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*r,t[9]=this[9]*i,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),r=1/n[0],i=1/n[1],s=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=this[4]*r,t[4]=this[5]*i,t[5]=this[6]*s,t[6]=this[8]*r,t[7]=this[9]*i,t[8]=this[10]*s,t}transpose(){return function(t,e){if(t===e){const n=e[1],r=e[2],i=e[3],s=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=s,t[11]=e[14],t[12]=i,t[13]=o,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],h=e[7],l=e[8],u=e[9],d=e[10],f=e[11],m=e[12],p=e[13],g=e[14],A=e[15],y=n*a-r*o,B=n*c-i*o,b=n*h-s*o,C=r*c-i*a,w=r*h-s*a,v=i*h-s*c,E=l*p-u*m,T=l*g-d*m,_=l*A-f*m,x=u*g-d*p,M=u*A-f*p,I=d*A-f*g;let S=y*I-B*M+b*x+C*_-w*T+v*E;S&&(S=1/S,t[0]=(a*I-c*M+h*x)*S,t[1]=(i*M-r*I-s*x)*S,t[2]=(p*v-g*w+A*C)*S,t[3]=(d*w-u*v-f*C)*S,t[4]=(c*_-o*I-h*T)*S,t[5]=(n*I-i*_+s*T)*S,t[6]=(g*b-m*v-A*B)*S,t[7]=(l*v-d*b+f*B)*S,t[8]=(o*M-a*_+h*E)*S,t[9]=(r*_-n*M-s*E)*S,t[10]=(m*w-p*b+A*y)*S,t[11]=(u*b-l*w-f*y)*S,t[12]=(a*T-o*x-c*E)*S,t[13]=(n*x-r*T+i*E)*S,t[14]=(p*B-m*C-g*y)*S,t[15]=(l*C-u*B+d*y)*S)}(this,this),this.check()}multiplyLeft(t){return nn(this,t,this),this.check()}multiplyRight(t){return nn(this,this,t),this.check()}rotateX(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[4],o=e[5],a=e[6],c=e[7],h=e[8],l=e[9],u=e[10],d=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*i+h*r,t[5]=o*i+l*r,t[6]=a*i+u*r,t[7]=c*i+d*r,t[8]=h*i-s*r,t[9]=l*i-o*r,t[10]=u*i-a*r,t[11]=d*i-c*r}(this,this,t),this.check()}rotateY(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[0],o=e[1],a=e[2],c=e[3],h=e[8],l=e[9],u=e[10],d=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i-h*r,t[1]=o*i-l*r,t[2]=a*i-u*r,t[3]=c*i-d*r,t[8]=s*r+h*i,t[9]=o*r+l*i,t[10]=a*r+u*i,t[11]=c*r+d*i}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[0],o=e[1],a=e[2],c=e[3],h=e[4],l=e[5],u=e[6],d=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i+h*r,t[1]=o*i+l*r,t[2]=a*i+u*r,t[3]=c*i+d*r,t[4]=h*i-s*r,t[5]=l*i-o*r,t[6]=u*i-a*r,t[7]=d*i-c*r}(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return function(t,e,n,r){let i,s,o,a,c,h,l,u,d,f,m,p,g,A,y,B,b,C,w,v,E,T,_,x,M=r[0],I=r[1],S=r[2],R=Math.sqrt(M*M+I*I+S*S);R<_e||(R=1/R,M*=R,I*=R,S*=R,s=Math.sin(n),i=Math.cos(n),o=1-i,a=e[0],c=e[1],h=e[2],l=e[3],u=e[4],d=e[5],f=e[6],m=e[7],p=e[8],g=e[9],A=e[10],y=e[11],B=M*M*o+i,b=I*M*o+S*s,C=S*M*o-I*s,w=M*I*o-S*s,v=I*I*o+i,E=S*I*o+M*s,T=M*S*o+I*s,_=I*S*o-M*s,x=S*S*o+i,t[0]=a*B+u*b+p*C,t[1]=c*B+d*b+g*C,t[2]=h*B+f*b+A*C,t[3]=l*B+m*b+y*C,t[4]=a*w+u*v+p*E,t[5]=c*w+d*v+g*E,t[6]=h*w+f*v+A*E,t[7]=l*w+m*v+y*E,t[8]=a*T+u*_+p*x,t[9]=c*T+d*_+g*x,t[10]=h*T+f*_+A*x,t[11]=l*T+m*_+y*x,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return function(t,e,n){const r=n[0],i=n[1],s=n[2];t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return function(t,e,n){const r=n[0],i=n[1],s=n[2];let o,a,c,h,l,u,d,f,m,p,g,A;e===t?(t[12]=e[0]*r+e[4]*i+e[8]*s+e[12],t[13]=e[1]*r+e[5]*i+e[9]*s+e[13],t[14]=e[2]*r+e[6]*i+e[10]*s+e[14],t[15]=e[3]*r+e[7]*i+e[11]*s+e[15]):(o=e[0],a=e[1],c=e[2],h=e[3],l=e[4],u=e[5],d=e[6],f=e[7],m=e[8],p=e[9],g=e[10],A=e[11],t[0]=o,t[1]=a,t[2]=c,t[3]=h,t[4]=l,t[5]=u,t[6]=d,t[7]=f,t[8]=m,t[9]=p,t[10]=g,t[11]=A,t[12]=o*r+l*i+m*s+e[12],t[13]=a*r+u*i+p*s+e[13],t[14]=c*r+d*i+g*s+e[14],t[15]=h*r+f*i+A*s+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*s+n[12]*o,t[1]=n[1]*r+n[5]*i+n[9]*s+n[13]*o,t[2]=n[2]*r+n[6]*i+n[10]*s+n[14]*o,t[3]=n[3]*r+n[7]*i+n[11]*s+n[15]*o,t}(e||[-0,-0,-0,-0],t,this),ve(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:n}=t;let r;switch(n){case 2:r=Ie(e||[-0,-0],t,this);break;case 3:r=Pe(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ve(r,t.length),r}transformAsVector(t,e){let n;switch(t.length){case 2:n=Se(e||[-0,-0],t,this);break;case 3:n=Re(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ve(n,t.length),n}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,n){return this.identity().translate([t,e,n])}}let un,dn;function fn(t){if(t>2*Math.PI)throw Error("expected radians")}function mn(){const t=new xe(4);return xe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function pn(t,e,n){n*=.5;const r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function gn(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=n[0],c=n[1],h=n[2],l=n[3];return t[0]=r*l+o*a+i*h-s*c,t[1]=i*l+o*c+s*a-r*h,t[2]=s*l+o*h+r*c-i*a,t[3]=o*l-r*a-i*c-s*h,t}const An=function(){const t=De(),e=Le(1,0,0),n=Le(0,1,0);return function(r,i,s){const o=Ue(i,s);return o<-.999999?(Ne(t,e,i),je(t)<1e-6&&Ne(t,n,i),function(t,e){const n=e[0],r=e[1],i=e[2];let s=n*n+r*r+i*i;s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s}(t,t),pn(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Ne(t,i,s),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3];let o=n*n+r*r+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=s*o,t}(r,r))}}();mn(),mn(),function(){const t=new xe(9);xe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1}();const yn=[0,0,0,1];class Bn extends Ce{constructor(t=0,e=0,n=0,r=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,n,r)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,n,r){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return function(t,e){const n=e[0]+e[4]+e[8];let r;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{let n=0;e[4]>e[0]&&(n=1),e[8]>e[3*n+n]&&(n=2);const i=(n+1)%3,s=(n+2)%3;r=Math.sqrt(e[3*n+n]-e[3*i+i]-e[3*s+s]+1),t[n]=.5*r,r=.5/r,t[3]=(e[3*i+s]-e[3*s+i])*r,t[i]=(e[3*i+n]+e[3*n+i])*r,t[s]=(e[3*s+n]+e[3*n+s])*r}}(this,t),this.check()}fromAxisRotation(t,e){return pn(this,t,e),this.check()}identity(){return function(t){t[0]=0,t[1]=0,t[2]=0,t[3]=1}(this),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=we(t)}get y(){return this[1]}set y(t){this[1]=we(t)}get z(){return this[2]}set z(t){this[2]=we(t)}get w(){return this[3]}set w(t){this[3]=we(t)}len(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)}(this)}lengthSquared(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}(this)}dot(t){return function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}(this,t)}rotationTo(t,e){return An(this,t,e),this.check()}add(t){return function(t,e,n){t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3]}(this,this,t),this.check()}calculateW(){return function(t,e){const n=e[0],r=e[1],i=e[2];t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i))}(this,this),this.check()}conjugate(){return function(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n*n+r*r+i*i+s*s,a=o?1/o:0;t[0]=-n*a,t[1]=-r*a,t[2]=-i*a,t[3]=s*a}(this,this),this.check()}lerp(t,e,n){return void 0===n?this.lerp(this,t,e):(function(t,e,n,r){const i=e[0],s=e[1],o=e[2],a=e[3];t[0]=i+r*(n[0]-i),t[1]=s+r*(n[1]-s),t[2]=o+r*(n[2]-o),t[3]=a+r*(n[3]-a)}(this,t,e,n),this.check())}multiplyRight(t){return gn(this,this,t),this.check()}multiplyLeft(t){return gn(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c+o*a,t[1]=i*c+s*a,t[2]=s*c-i*a,t[3]=o*c-r*a}(this,this,t),this.check()}rotateY(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c-s*a,t[1]=i*c+o*a,t[2]=s*c+r*a,t[3]=o*c-i*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c+i*a,t[1]=i*c-r*a,t[2]=s*c+o*a,t[3]=o*c-s*a}(this,this,t),this.check()}scale(t){return function(t,e,n){t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n}(this,this,t),this.check()}slerp(t,e,n){let r,i,s;switch(arguments.length){case 1:({start:r=yn,target:i,ratio:s}=t);break;case 2:r=this,i=t,s=e;break;default:r=t,i=e,s=n}return function(t,e,n,r){const i=e[0],s=e[1],o=e[2],a=e[3];let c,h,l,u,d,f=n[0],m=n[1],p=n[2],g=n[3];c=i*f+s*m+o*p+a*g,c<0&&(c=-c,f=-f,m=-m,p=-p,g=-g),1-c>_e?(h=Math.acos(c),d=Math.sin(h),l=Math.sin((1-r)*h)/d,u=Math.sin(r*h)/d):(l=1-r,u=r),t[0]=l*i+u*f,t[1]=l*s+u*m,t[2]=l*o+u*p,t[3]=l*a+u*g}(this,r,i,s),this.check()}transformVector4(t,e=new ze){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=n[0],a=n[1],c=n[2],h=n[3],l=h*r+a*s-c*i,u=h*i+c*r-o*s,d=h*s+o*i-a*r,f=-o*r-a*i-c*s;t[0]=l*h+f*-o+u*-c-d*-a,t[1]=u*h+f*-a+d*-o-l*-c,t[2]=d*h+f*-c+l*-a-u*-o,t[3]=e[3]}(e,t,this),ve(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}function bn(t){return(bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Cn(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=bn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=bn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==bn(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wn(t){return t}new Qe;const vn=new Qe,En={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Tn={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_n={east:new Qe,north:new Qe,up:new Qe,west:new Qe,south:new Qe,down:new Qe},xn=new Qe,Mn=new Qe,In=new Qe;function Sn(t,e,n,r,i,s){const o=En[e]&&En[e][n];let a,c,h;Ee(o&&(!r||r===o));const l=vn.copy(i);if(Be(l.x,0,1e-14)&&Be(l.y,0,1e-14)){const t=Math.sign(l.z);a=xn.fromArray(Tn[e]),"east"!==e&&"west"!==e&&a.scale(t),c=Mn.fromArray(Tn[n]),"east"!==n&&"west"!==n&&c.scale(t),h=In.fromArray(Tn[r]),"east"!==r&&"west"!==r&&h.scale(t)}else{const{up:i,east:s,north:o}=_n;s.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,i),o.copy(i).cross(s);const{down:u,west:d,south:f}=_n;u.copy(i).scale(-1),d.copy(s).scale(-1),f.copy(o).scale(-1),a=_n[e],c=_n[n],h=_n[r]}return s[0]=a.x,s[1]=a.y,s[2]=a.z,s[3]=0,s[4]=c.x,s[5]=c.y,s[6]=c.z,s[7]=0,s[8]=h.x,s[9]=h.y,s[10]=h.z,s[11]=0,s[12]=l.x,s[13]=l.y,s[14]=l.z,s[15]=1,s}const Rn=new Qe,On=new Qe,Fn=new Qe,Dn=new Qe,Gn=new Qe,Ln=new Qe,Un=new Qe,Nn=new Qe,Pn=new Qe;class Hn{constructor(t=0,e=0,n=0){Cn(this,"radii",void 0),Cn(this,"radiiSquared",void 0),Cn(this,"radiiToTheFourth",void 0),Cn(this,"oneOverRadii",void 0),Cn(this,"oneOverRadiiSquared",void 0),Cn(this,"minimumRadius",void 0),Cn(this,"maximumRadius",void 0),Cn(this,"centerToleranceSquared",.1),Cn(this,"squaredXOverSquaredZ",void 0),Ee(t>=0),Ee(e>=0),Ee(n>=0),this.radii=new Qe(t,e,n),this.radiiSquared=new Qe(t*t,e*e,n*n),this.radiiToTheFourth=new Qe(t*t*t*t,e*e*e*e,n*n*n*n),this.oneOverRadii=new Qe(0===t?0:1/t,0===e?0:1/e,0===n?0:1/n),this.oneOverRadiiSquared=new Qe(0===t?0:1/(t*t),0===e?0:1/(e*e),0===n?0:1/(n*n)),this.minimumRadius=Math.min(t,e,n),this.maximumRadius=Math.max(t,e,n),0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||!(!t||!this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const n=Gn,r=Ln,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,n),r.copy(this.radiiSquared).scale(n);const s=Math.sqrt(n.dot(r));return r.scale(1/s),n.scale(i),r.add(n),r.to(e)}cartesianToCartographic(t,e=[0,0,0]){Pn.from(t);const n=this.scaleToGeodeticSurface(Pn,Un);if(!n)return;const r=this.geodeticSurfaceNormal(n,Gn),i=Nn;return i.copy(Pn).subtract(n),function(t,e){return function(t,e,n=wn){return"longitude"in e?(e.longitude=n(t[0]),e.latitude=n(t[1]),e.height=t[2]):"x"in e?(e.x=n(t[0]),e.y=n(t[1]),e.z=t[2]):(e[0]=n(t[0]),e[1]=n(t[1]),e[2]=t[2]),e}(t,e,de._cartographicRadians?wn:ge)}([Math.atan2(r.y,r.x),Math.asin(r.z),Math.sign(Ue(i,Pn))*Ge(i)],e)}eastNorthUpToFixedFrame(t,e=new ln){return Sn(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,n,r,i=new ln){return Sn(this,t,e,n,r,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return Dn.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const n=function(t,e=[]){return function(t,e=[],n=wn){return"longitude"in t?(e[0]=n(t.longitude),e[1]=n(t.latitude),e[2]=t.height):"x"in t?(e[0]=n(t.x),e[1]=n(t.y),e[2]=t.z):(e[0]=n(t[0]),e[1]=n(t[1]),e[2]=t[2]),e}(t,e,de._cartographicRadians?wn:pe)}(t),r=n[0],i=n[1],s=Math.cos(i);return Dn.set(s*Math.cos(r),s*Math.sin(r),Math.sin(i)).normalize(),Dn.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return Dn.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,n=[]){const{oneOverRadii:r,oneOverRadiiSquared:i,centerToleranceSquared:s}=e;Rn.from(t);const o=Rn.x,a=Rn.y,c=Rn.z,h=r.x,l=r.y,u=r.z,d=o*o*h*h,f=a*a*l*l,m=c*c*u*u,p=d+f+m,g=Math.sqrt(1/p);if(!Number.isFinite(g))return;const A=On;if(A.copy(t).scale(g),p1e-12);return Rn.scale([w,v,E]).to(n)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){Un.from(t);const n=Un.x,r=Un.y,i=Un.z,s=this.oneOverRadiiSquared,o=1/Math.sqrt(n*n*s.x+r*r*s.y+i*i*s.z);return Un.multiplyScalar(o).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return Un.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return Un.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,n=[0,0,0]){Ee(Be(this.radii.x,this.radii.y,1e-15)),Ee(this.radii.z>0),Un.from(t);const r=Un.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(r)>=this.radii.z-e))return Un.set(0,0,r).to(n)}}Cn(Hn,"WGS84",new Hn(6378137,6378137,6356752.314245179));new Qe,new Qe;const Jn=new Qe,jn=new Qe;class kn{constructor(t=[0,0,0],e=0){Cn(this,"center",void 0),Cn(this,"radius",void 0),this.radius=-0,this.center=new Qe,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=Jn.from(e),this.center=(new Qe).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new kn(this.center,this.radius)}union(t){const e=this.center,n=this.radius,r=t.center,i=t.radius,s=Jn.copy(r).subtract(e),o=s.magnitude();if(n>=o+i)return this.clone();if(i>=o+n)return t.clone();const a=.5*(n+o+i);return jn.copy(s).scale((-n+a)/o).add(e),this.center.copy(jn),this.radius=a,this}expand(t){const e=Jn.from(t).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=function(t,e){const n=e[0],r=e[1],i=e[2],s=e[4],o=e[5],a=e[6],c=e[8],h=e[9],l=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(s*s+o*o+a*a),t[2]=Math.sqrt(c*c+h*h+l*l),t}(Jn,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){const e=this.distanceTo(t);return e*e}distanceTo(t){const e=Jn.from(t).subtract(this.center);return Math.max(0,e.len()-this.radius)}intersectPlane(t){const e=this.center,n=this.radius,r=t.normal.dot(e)+t.distance;return r<-n?-1:r=a?1:0}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=Kn.from(t).subtract(this.center),n=this.halfAxes,r=n.getColumn(0,Qn),i=n.getColumn(1,zn),s=n.getColumn(2,qn),o=r.magnitude(),a=i.magnitude(),c=s.magnitude();r.normalize(),i.normalize(),s.normalize();let h,l=0;return h=Math.abs(e.dot(r))-o,h>0&&(l+=h*h),h=Math.abs(e.dot(i))-a,h>0&&(l+=h*h),h=Math.abs(e.dot(s))-c,h>0&&(l+=h*h),l}computePlaneDistances(t,e,n=[-0,-0]){let r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const s=this.center,o=this.halfAxes,a=o.getColumn(0,Qn),c=o.getColumn(1,zn),h=o.getColumn(2,qn),l=Wn.copy(a).add(c).add(h).add(s),u=Yn.copy(l).subtract(t);let d=e.dot(u);return r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).add(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).subtract(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).subtract(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).add(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).add(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).subtract(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).subtract(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),n[0]=r,n[1]=i,n}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,Qn);e.transformAsPoint(t);const n=this.halfAxes.getColumn(1,zn);n.transformAsPoint(t);const r=this.halfAxes.getColumn(2,qn);return r.transformAsPoint(t),this.halfAxes=new $e([...e,...n,...r]),this}getTransform(){throw new Error("not implemented")}}const Zn=new Qe,$n=new Qe;class tr{constructor(t=[0,0,1],e=0){Cn(this,"normal",void 0),Cn(this,"distance",void 0),this.normal=new Qe,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return Ee(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=Zn.from(t),this.normal.from(e).normalize();const n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,e,n,r){return this.normal.set(t,e,n),Ee(Be(this.normal.len(),1)),this.distance=r,this}clone(){return new tr(this.normal,this.distance)}equals(t){return Be(this.distance,t.distance)&&Be(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=$n.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,e)}projectPointOntoPlane(t,e=[0,0,0]){const n=Zn.from(t),r=this.getPointDistance(n),i=$n.copy(this.normal).scale(r);return n.subtract(i).to(e)}}const er=[new Qe([1,0,0]),new Qe([0,1,0]),new Qe([0,0,1])],nr=new Qe,rr=new Qe;class ir{constructor(t=[]){Cn(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*er.length;const e=t.center,n=t.radius;let r=0;for(const t of er){let i=this.planes[r],s=this.planes[r+1];i||(i=this.planes[r]=new tr),s||(s=this.planes[r+1]=new tr);const o=nr.copy(t).scale(-n).add(e);i.fromPointNormal(o,t);const a=nr.copy(t).scale(n).add(e),c=rr.copy(t).negate();s.fromPointNormal(a,c),r+=2}return this}computeVisibility(t){let e=1;for(const n of this.planes)switch(t.intersectPlane(n)){case-1:return-1;case 0:e=0}return e}computeVisibilityWithPlaneMask(t,e){if(Ee(Number.isFinite(e),"parentPlaneMask is required."),e===ir.MASK_OUTSIDE||e===ir.MASK_INSIDE)return e;let n=ir.MASK_INSIDE;const r=this.planes;for(let i=0;i0),Ee(e>0),Ee(n>0),Ee(r);const i=1/this.near;let s=this.top*i;const o=2*n*s/e;s=this.right*i;const a=2*n*s/t;return r.x=a,r.y=o,r}_update(){Ee(Number.isFinite(this.right)&&Number.isFinite(this.left)&&Number.isFinite(this.top)&&Number.isFinite(this.bottom)&&Number.isFinite(this.near)&&Number.isFinite(this.far));const{top:t,bottom:e,right:n,left:r,near:i,far:s}=this;(t!==this._top||e!==this._bottom||r!==this._left||n!==this._right||i!==this._near||s!==this._far)&&(Ee(this.near>0&&this.nearnull!==t&&typeof t<"u")(t)&&t instanceof ur)&&(this._update(),t._update(),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this.near===t.near&&this.far===t.far&&this._offCenterFrustum.equals(t._offCenterFrustum))}get projectionMatrix(){return this._update(),this._offCenterFrustum.projectionMatrix}get infiniteProjectionMatrix(){return this._update(),this._offCenterFrustum.infiniteProjectionMatrix}get fovy(){return this._update(),this._fovy}get sseDenominator(){return this._update(),this._sseDenominator}computeCullingVolume(t,e,n){return this._update(),this._offCenterFrustum.computeCullingVolume(t,e,n)}getPixelDimensions(t,e,n,r){return this._update(),this._offCenterFrustum.getPixelDimensions(t,e,n,r||new Fe)}_update(){Ee(Number.isFinite(this.fov)&&Number.isFinite(this.aspectRatio)&&Number.isFinite(this.near)&&Number.isFinite(this.far));const t=this._offCenterFrustum;(this.fov!==this._fov||this.aspectRatio!==this._aspectRatio||this.near!==this._near||this.far!==this._far||this.xOffset!==this._xOffset||this.yOffset!==this._yOffset)&&(Ee(this.fov>=0&&this.fov0),Ee(this.near>=0&&this.nearn&&(r=e,n=i)}const i=Ar[r],s=yr[r];let o=1,a=0;if(Math.abs(t[dr.getElementIndex(s,i)])>1e-15){const e=(t[dr.getElementIndex(s,s)]-t[dr.getElementIndex(i,i)])/2/t[dr.getElementIndex(s,i)];let n;n=e<0?-1/(-e+Math.sqrt(1+e*e)):1/(e+Math.sqrt(1+e*e)),o=1/Math.sqrt(1+n*n),a=n*o}return $e.IDENTITY.to(e),e[dr.getElementIndex(i,i)]=e[dr.getElementIndex(s,s)]=o,e[dr.getElementIndex(s,i)]=a,e[dr.getElementIndex(i,s)]=-a,e}const Cr=new Qe,wr=new Qe,vr=new Qe,Er=new Qe,Tr=new Qe,_r=new $e,xr={diagonal:new $e,unitary:new $e};let Mr=function(t){return t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE",t}({}),Ir=function(t){return t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh",t}({}),Sr=function(t){return t.I3S="I3S",t.TILES3D="TILES3D",t}({}),Rr=function(t){return t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold",t}({});const Or="4.1.1",Fr="cmpt",Dr="pnts",Gr="b3dm",Lr="i3dm",Ur="glTF";function Nr(t,e,n){o(t instanceof ArrayBuffer);const r=new TextDecoder("utf8"),i=new Uint8Array(t,e,n);return r.decode(i)}function Pr(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=new DataView(t);return`${String.fromCharCode(n.getUint8(e+0))}${String.fromCharCode(n.getUint8(e+1))}${String.fromCharCode(n.getUint8(e+2))}${String.fromCharCode(n.getUint8(e+3))}`}const Hr={name:"Draco",id:"draco",module:"draco",version:"4.1.1",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Jr(t,e,n){return function(t,e,n){const r=function(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}(e.value),i=n||function(t){const e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:r}]},nullable:!1,metadata:i}}(t,e,n?jr(n.metadata):void 0)}function jr(t){Object.entries(t);const e={};for(const n in t)e[`${n}.string`]=JSON.stringify(t[n]);return e}const kr={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Vr={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Kr{constructor(t){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new this.draco.DecoderBuffer;n.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);const r=this.decoder.GetEncodedGeometryType(n),i=r===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let t;switch(r){case this.draco.TRIANGULAR_MESH:t=this.decoder.DecodeBufferToMesh(n,i);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(n,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!i.ptr){const e=`DRACO decompression failed: ${t.error_msg()}`;throw new Error(e)}const s=this._getDracoLoaderData(i,r,e),o=this._getMeshData(i,s,e),a=function(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;const a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let t=0;ti?c:i,s=h>s?h:s,o=l>o?l:o}return[[e,n,r],[i,s,o]]}(o.attributes),c=function(t,e,n){const r=jr(e.metadata),i=[],s=function(t){const e={};for(const n in t){const r=t[n];e[r.name||"undefined"]=r}return e}(e.attributes);for(const e in t){const n=Jr(e,t[e],s[e]);i.push(n)}if(n){const t=Jr("indices",n);i.push(t)}return{fields:i,metadata:r}}(o.attributes,s,o.indices);return{loader:"draco",loaderData:s,header:{vertexCount:i.num_points(),boundingBox:a},...o,schema:c}}finally{this.draco.destroy(n),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,e,n){const r=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,n);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:r,attributes:i}}_getDracoAttributes(t,e){const n={};for(let r=0;rthis.decoder[t])).includes(r)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits(),range:e.range(),min_values:new Float32Array([1,2,3]).map((t=>e.min_value(t)))}}finally{this.draco.destroy(e)}}return null}_getOctahedronTransform(t,e){const{octahedronAttributes:n=[]}=e,r=t.attribute_type();if(n.map((t=>this.decoder[t])).includes(r)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits()}}finally{this.draco.destroy(e)}}return null}}const Qr="https://www.gstatic.com/draco/versioned/decoders/1.5.6",zr="draco_wasm_wrapper.js",qr="draco_decoder.wasm",Wr="draco_decoder.js",Yr="draco_encoder.js",Xr={[zr]:`${Qr}/${zr}`,[qr]:`${Qr}/draco_decoder.wasm`,[Wr]:`${Qr}/draco_decoder.js`,[Yr]:`https://raw.githubusercontent.com/google/draco/1.4.1/javascript/${Yr}`};let Zr;const $r={...Hr,parse:async function(t,e){const{draco:n}=await async function(t){const e=t.modules||{};return Zr=e.draco3d?Zr||e.draco3d.createDecoderModule({}).then((t=>({draco:t}))):Zr||async function(t){let e,n;return"js"===(t.draco&&t.draco.decoderType)?e=await O(Xr["draco_decoder.js"],"draco",t,Wr):[e,n]=await Promise.all([await O(Xr[zr],"draco",t,zr),await O(Xr[qr],"draco",t,qr)]),e=e||globalThis.DracoDecoderModule,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t({...n,onModuleLoaded:t=>e({draco:t})})}))}(e,n)}(t),await Zr}(e),r=new Kr(n);try{return r.parseSync(t,null==e?void 0:e.draco)}finally{r.destroy()}}},ti={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},ei={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...ti},ni={[ti.DOUBLE]:Float64Array,[ti.FLOAT]:Float32Array,[ti.UNSIGNED_SHORT]:Uint16Array,[ti.UNSIGNED_INT]:Uint32Array,[ti.UNSIGNED_BYTE]:Uint8Array,[ti.BYTE]:Int8Array,[ti.SHORT]:Int16Array,[ti.INT]:Int32Array},ri={DOUBLE:ti.DOUBLE,FLOAT:ti.FLOAT,UNSIGNED_SHORT:ti.UNSIGNED_SHORT,UNSIGNED_INT:ti.UNSIGNED_INT,UNSIGNED_BYTE:ti.UNSIGNED_BYTE,BYTE:ti.BYTE,SHORT:ti.SHORT,INT:ti.INT},ii="Failed to convert GL type";class si{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(const e in ni)if(ni[e]===t)return e;throw new Error(ii)}static fromName(t){const e=ri[t];if(!e)throw new Error(ii);return e}static getArrayType(t){switch(t){case ti.UNSIGNED_SHORT_5_6_5:case ti.UNSIGNED_SHORT_4_4_4_4:case ti.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const e=ni[t];if(!e)throw new Error(ii);return e}}static getByteSize(t){return si.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return!!si.getArrayType(t)}static createTypedArray(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;return void 0===r&&(r=(e.byteLength-n)/si.getByteSize(t)),new(si.getArrayType(t))(e,n,r)}}function oi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];const n=t>>11&31,r=t>>5&63,i=31&t;return e[0]=n<<3,e[1]=r<<2,e[2]=i<<3,e}function ai(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:255;return ye(t,0,e)/e*2-1}function ci(t){return t<0?-1:1}function hi(t,e,n){return function(t,e,n,r){if(function(t,e){if(!t)throw new Error("math.gl assertion failed. undefined")}(r),t<0||t>n||e<0||e>n)throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);if(r.x=ai(t,n),r.y=ai(e,n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){const t=r.x;r.x=(1-Math.abs(r.y))*ci(t),r.y=(1-Math.abs(t))*ci(r.y)}return r.normalize()}(t,e,255,n)}new Fe,new Qe,new Fe,new Fe;class li{constructor(t,e){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=t,this.buffer=e}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return!!this.json[t]}getGlobalProperty(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ei.UNSIGNED_INT,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const r=this.json[t];return r&&Number.isFinite(r.byteOffset)?this._getTypedArrayFromBinary(t,e,n,1,r.byteOffset):r}getPropertyArray(t,e,n){const r=this.json[t];return r&&Number.isFinite(r.byteOffset)?("componentType"in r&&(e=si.fromName(r.componentType)),this._getTypedArrayFromBinary(t,e,n,this.featuresLength,r.byteOffset)):this._getTypedArrayFromArray(t,e,r)}getProperty(t,e,n,r,i){const s=this.json[t];if(!s)return s;const o=this.getPropertyArray(t,e,n);if(1===n)return o[r];for(let t=0;tt[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},fi={SCALAR:(t,e,n)=>{e[n]=t},VEC2:(t,e,n)=>{e[2*n+0]=t[0],e[2*n+1]=t[1]},VEC3:(t,e,n)=>{e[3*n+0]=t[0],e[3*n+1]=t[1],e[3*n+2]=t[2]},VEC4:(t,e,n)=>{e[4*n+0]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]},MAT2:(t,e,n)=>{e[4*n+0]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]},MAT3:(t,e,n)=>{e[9*n+0]=t[0],e[9*n+1]=t[1],e[9*n+2]=t[2],e[9*n+3]=t[3],e[9*n+4]=t[4],e[9*n+5]=t[5],e[9*n+6]=t[6],e[9*n+7]=t[7],e[9*n+8]=t[8],e[9*n+9]=t[9]},MAT4:(t,e,n)=>{e[16*n+0]=t[0],e[16*n+1]=t[1],e[16*n+2]=t[2],e[16*n+3]=t[3],e[16*n+4]=t[4],e[16*n+5]=t[5],e[16*n+6]=t[6],e[16*n+7]=t[7],e[16*n+8]=t[8],e[16*n+9]=t[9],e[16*n+10]=t[10],e[16*n+11]=t[11],e[16*n+12]=t[12],e[16*n+13]=t[13],e[16*n+14]=t[14],e[16*n+15]=t[15]}},mi=t=>void 0!==t;function pi(t,e,n){if(!t)return;const r=t.parentCounts;return t.parentIds?n(t,e):r>0?function(t,e,n){const r=t.classIds,i=t.parentCounts,s=t.parentIds,o=t.parentIndexes,a=r.length,c=scratchVisited;c.length=Math.max(c.length,a);const h=++marker,l=scratchStack;for(l.length=0,l.push(e);l.length>0;){if(c[e=l.pop()]===h)continue;c[e]=h;const r=n(t,e);if(mi(r))return r;const a=i[e],u=o[e];for(let t=0;tt,Bi={HIERARCHY:!0,extensions:!0,extras:!0};class bi{constructor(t,e,n){var r;let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,o(n>=0),this.json=t||{},this.binary=e,this.featureCount=n,this._extensions=(null===(r=this.json)||void 0===r?void 0:r.extensions)||{},this._properties={};for(const t in this.json)Bi[t]||(this._properties[t]=this.json[t]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=function(t,e,n){if(!e)return null;let r=t.getExtension("3DTILES_batch_table_hierarchy");const i=e.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=i,r=i),r?function(t,e){let n,r,i;const s=t.instancesLength,o=t.classes;let a,c=t.classIds,h=t.parentCounts,l=t.parentIds,u=s;if(mi(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,s)),mi(h))for(mi(h.byteOffset)&&(h.componentType=defaultValue(h.componentType,GL.UNSIGNED_SHORT),h.type=AttributeType.SCALAR,i=getBinaryAccessor(h),h=i.createArrayBufferView(e.buffer,e.byteOffset+h.byteOffset,s)),a=new Uint16Array(s),u=0,n=0;n{const r=t.classIds[n];return t.classes[r].name===e})))}isExactClass(t,e){return o("string"==typeof e,e),this.getExactClassName(t)===e}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){const e=this._hierarchy.classIds[t];return this._hierarchy.classes[e].name}}hasProperty(t,e){return this._checkBatchId(t),o("string"==typeof e,e),Ai(this._properties[e])||this._hasPropertyInHierarchy(t,e)}getPropertyNames(t,e){this._checkBatchId(t),(e=Ai(e)?e:[]).length=0;const n=Object.keys(this._properties);return e.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(t,e),e}getProperty(t,e){if(this._checkBatchId(t),o("string"==typeof e,e),this._binaryProperties){const n=this._binaryProperties[e];if(Ai(n))return this._getBinaryProperty(n,t)}const n=this._properties[e];if(Ai(n))return yi(n[t]);if(this._hierarchy){const n=this._getHierarchyProperty(t,e);if(Ai(n))return n}}setProperty(t,e,n){const r=this.featureCount;if(this._checkBatchId(t),o("string"==typeof e,e),this._binaryProperties){const r=this._binaryProperties[e];if(r)return void this._setBinaryProperty(r,t,n)}if(this._hierarchy&&this._setHierarchyProperty(this,t,e,n))return;let i=this._properties[e];Ai(i)||(this._properties[e]=new Array(r),i=this._properties[e]),i[t]=yi(n)}_checkBatchId(t){if(!(t>=0&&t{const r=t.classIds[n];return Ai(t.classes[r].instances[e])}));return Ai(n)}_getPropertyNamesInHierarchy(t,e){pi(this._hierarchy,t,((t,n)=>{const r=t.classIds[n],i=t.classes[r].instances;for(const t in i)i.hasOwnProperty(t)&&-1===e.indexOf(t)&&e.push(t)}))}_getHierarchyProperty(t,e){return pi(this._hierarchy,t,((t,n)=>{const r=t.classIds[n],i=t.classes[r],s=t.classIndexes[n],o=i.instances[e];return Ai(o)?Ai(o.typedArray)?this._getBinaryProperty(o,s):yi(o[s]):null}))}_setHierarchyProperty(t,e,n,r){const i=pi(this._hierarchy,e,((t,i)=>{const s=t.classIds[i],a=t.classes[s],c=t.classIndexes[i],h=a.instances[n];return!!Ai(h)&&(o(i===e,`Inherited property "${n}" is read-only.`),Ai(h.typedArray)?this._setBinaryProperty(h,c,r):h[c]=yi(r),!0)}));return Ai(i)}}function Ci(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=new DataView(e);if(t.magic=r.getUint32(n,!0),n+=4,t.version=r.getUint32(n,!0),n+=4,t.byteLength=r.getUint32(n,!0),n+=4,1!==t.version)throw new Error(`3D Tile Version ${t.version} not supported`);return n}const wi="b3dm tile in legacy format.";function vi(t,e,n){const r=new DataView(e);let i;t.header=t.header||{};let s=r.getUint32(n,!0);n+=4;let o=r.getUint32(n,!0);n+=4;let a=r.getUint32(n,!0);n+=4;let c=r.getUint32(n,!0);return n+=4,a>=570425344?(n-=8,i=s,a=o,c=0,s=0,o=0,console.warn(wi)):c>=570425344&&(n-=4,i=a,a=s,c=o,s=0,o=0,console.warn(wi)),t.header.featureTableJsonByteLength=s,t.header.featureTableBinaryByteLength=o,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=i,n}function Ei(t,e,n,r){return n=function(t,e,n,r){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:s,batchLength:o}=t.header||{};if(t.featureTableJson={BATCH_LENGTH:o||0},i&&i>0){const r=Nr(e,n,i);t.featureTableJson=JSON.parse(r)}return n+=i||0,t.featureTableBinary=new Uint8Array(e,n,s),n+(s||0)}(t,e,n),n=function(t,e,n,r){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:s}=t.header||{};if(i&&i>0){const r=Nr(e,n,i);t.batchTableJson=JSON.parse(r),n+=i,s&&s>0&&(t.batchTableBinary=new Uint8Array(e,n,s),t.batchTableBinary=new Uint8Array(t.batchTableBinary),n+=s)}return n}(t,e,n),n}function Ti(t,e,n){if(!(e||t&&t.batchIds&&n))return null;const{batchIds:r,isRGB565:i,pointCount:s=0}=t;if(r&&n){const t=new Uint8ClampedArray(3*s);for(let e=0;e255*t));t[3*e]=s[0],t[3*e+1]=s[1],t[3*e+2]=s[2]}return{type:ei.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}if(e&&i){const t=new Uint8ClampedArray(3*s);for(let n=0;n{try{n.onload=()=>t(n),n.onerror=t=>{const n=t instanceof Error?t.message:"error";e(new Error(n))}}catch(t){e(t)}}))}(s||r,e)}finally{s&&i.revokeObjectURL(s)}}const Pi={};let Hi=!0;function Ji(t){for(const e in t||Pi)return!1;return!0}function ji(t){return[...t].map((t=>t.charCodeAt(0)))}const ki=!1,Vi=!0;function Ki(t){const e=Qi(t);return function(t){const e=Qi(t);return e.byteLength>=24&&2303741511===e.getUint32(0,ki)?{mimeType:"image/png",width:e.getUint32(16,ki),height:e.getUint32(20,ki)}:null}(e)||function(t){const e=Qi(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,ki)&&255===e.getUint8(2)))return null;const{tableMarkers:n,sofMarkers:r}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)t.add(e);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}();let i=2;for(;i+9=10&&1195984440===e.getUint32(0,ki)?{mimeType:"image/gif",width:e.getUint16(6,Vi),height:e.getUint16(8,Vi)}:null}(e)||function(t){const e=Qi(t);return e.byteLength>=14&&16973===e.getUint16(0,ki)&&e.getUint32(2,Vi)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Vi),height:e.getUint32(22,Vi)}:null}(e)||function(t){const e=function(t){return function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=ji(e);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:null;if((Ji(e)||!Hi)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),Hi=!1}return await createImageBitmap(t)}(r,i)}(t,e,i);break;case"image":a=await Ni(t,e,i);break;case"data":a=await async function(t,e){var n;const{mimeType:r}=Ki(t)||{},i=null===(n=globalThis.loaders)||void 0===n?void 0:n.parseImageNode;return o(i),await i(t,r)}(t);break;default:o(!1)}return"data"===r&&(a=Fi(a)),a},tests:[t=>!!Ki(new DataView(t))],options:{image:{type:"auto",decode:!0}}},qi={};function Wi(t,e){if(!t)throw new Error(e||"assert failed: gltf")}const Yi={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Xi={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Zi=["SCALAR","VEC2","VEC3","VEC4"],$i=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],ts=new Map($i),es={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ns={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},rs={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function is(t){return Zi[t-1]||Zi[0]}function ss(t){const e=ts.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function os(t,e){const n=rs[t.componentType],r=es[t.type],i=ns[t.componentType],s=t.count*r,o=t.count*r*i;return Wi(o>=0&&o<=e.byteLength),{ArrayType:n,length:s,byteLength:o,componentByteSize:Xi[t.componentType],numberOfComponentsInElement:Yi[t.type]}}function as(t){let{images:e,bufferViews:n}=t;e=e||[],n=n||[];const r=e.map((t=>t.bufferView));n=n.filter((t=>!r.includes(t)));const i=n.reduce(((t,e)=>t+e.byteLength),0),s=e.reduce(((t,e)=>{const{width:n,height:r}=e.image;return t+n*r}),0);return i+Math.ceil(4*s*1.33)}class cs{constructor(t){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:(null==t?void 0:t.json)||{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]},buffers:(null==t?void 0:t.buffers)||[],images:(null==t?void 0:t.images)||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){const e=this.getUsedExtensions().find((e=>e===t)),n=this.getRequiredExtensions().find((e=>e===t));return"string"==typeof e||"string"==typeof n}getExtension(t){const e=this.getUsedExtensions().find((e=>e===t)),n=this.json.extensions||{};return e?n[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find((e=>e===t))?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,e){return(t.extensions||{})[e]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,e){if("object"==typeof e)return e;const n=this.json[t]&&this.json[t][e];if(!n)throw new Error(`glTF file error: Could not find ${t}[${e}]`);return n}getTypedArrayForBufferView(t){const e=(t=this.getBufferView(t)).buffer,n=this.gltf.buffers[e];Wi(n);const r=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,r,t.byteLength)}getTypedArrayForAccessor(t){const e=this.getAccessor(t);return function(t,e,n){var r,i;const s="number"==typeof n?null===(r=t.accessors)||void 0===r?void 0:r[n]:n;if(!s)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);const o=null===(i=t.bufferViews)||void 0===i?void 0:i[s.bufferView||0];if(!o)throw new Error(`No gltf buffer view for accessor ${o}`);const{arrayBuffer:a,byteOffset:c}=e[o.buffer],h=(c||0)+(s.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:u,componentByteSize:d,numberOfComponentsInElement:f}=os(s,o),m=d*f,p=o.byteStride||m;if(typeof o.byteStride>"u"||o.byteStride===m)return new l(a,h,u);const g=new l(u);for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:{};return Wi(e),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=e,this.registerUsedExtension(t),e}addRequiredExtension(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Wi(e),this.addExtension(t,e),this.registerRequiredExtension(t),e}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((e=>e===t))||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((e=>e===t))||this.json.extensionsRequired.push(t)}removeExtension(t){var e;if(null!==(e=this.json.extensions)&&void 0!==e&&e[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];const e=this.json.extensionsRemoved;e.includes(t)||e.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){const{nodeIndices:e}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:e}),this.json.scenes.length-1}addNode(t){const{meshIndex:e,matrix:n}=t;this.json.nodes=this.json.nodes||[];const r={mesh:e};return n&&(r.matrix=n),this.json.nodes.push(r),this.json.nodes.length-1}addMesh(t){const{attributes:e,indices:n,material:r,mode:i=4}=t,s={primitives:[{attributes:this._addAttributes(e),mode:i}]};if(n){const t=this._addIndices(n);s.primitives[0].indices=t}return Number.isFinite(r)&&(s.primitives[0].material=r),this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(t){const e={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(e),this.json.meshes.length-1}addImage(t,e){const n=Ki(t),r=e||(null==n?void 0:n.mimeType),i={bufferView:this.addBufferView(t),mimeType:r};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.byteLength;const r=t.byteLength;Wi(Number.isFinite(r)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);const i={buffer:e,byteOffset:n,byteLength:r};return this.byteLength+=H(r,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,e){const n={bufferView:t,type:is(e.size),componentType:e.componentType,count:e.count,max:e.max,min:e.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{size:3};const n=this.addBufferView(t);let r={min:e.min,max:e.max};(!r.min||!r.max)&&(r=this._getAccessorMinMax(t,e.size));const i={size:e.size,componentType:ss(t),count:Math.round(t.length/e.size),min:r.min,max:r.max};return this.addAccessor(n,Object.assign(i,e))}addTexture(t){const{imageIndex:e}=t,n={source:e};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,e;this.gltf.buffers=[];const n=this.byteLength,r=new ArrayBuffer(n),i=new Uint8Array(r);let s=0;for(const t of this.sourceBuffers||[])s=J(t,i,s);null!==(t=this.json)&&void 0!==t&&null!==(e=t.buffers)&&void 0!==e&&e[0]?this.json.buffers[0].byteLength=n:this.json.buffers=[{byteLength:n}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(t,e){let n=!0;for(;n;){const r=t.indexOf(e);r>-1?t.splice(r,1):n=!1}}_addAttributes(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={};for(const n in t){const r=t[n],i=this._getGltfAttributeName(n),s=this.addBinaryBuffer(r.value,r);e[i]=s}return e}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,e){const n={min:null,max:null};if(t.length3&&void 0!==arguments[3]?arguments[3]:1;const i=ls[e],s=us[n],o=ds[n],a=r*i,c=a*o;let h=t.buffer,l=t.byteOffset;return l%o!=0&&(h=new Uint8Array(h).slice(l,l+c).buffer,l=0),new s(h,l,a)}function gs(t,e,n){var r,i;const s=`TEXCOORD_${e.texCoord||0}`,o=n.attributes[s],a=t.getTypedArrayForAccessor(o),c=t.gltf.json,h=e.index,l=null===(r=c.textures)||void 0===r||null===(i=r[h])||void 0===i?void 0:i.source;if(typeof l<"u"){var u,d,f;const n=null===(u=c.images)||void 0===u||null===(d=u[l])||void 0===d?void 0:d.mimeType,r=null===(f=t.gltf.images)||void 0===f?void 0:f[l];if(r&&typeof r.width<"u"){const t=[];for(let i=0;ie===t));-1===e&&(e=r.push(t)-1),s.push(e)}const o=new Uint32Array(s),a=t.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,c=t.addBufferView(o,a,0),h=t.addAccessor(c,{size:1,componentType:ss(o),count:o.length});i.attributes[e]=h}function ys(t,e,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[0];const s={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],a=n[r+1];let c=1;e&&(-1!==e.indexOf("image/jpeg")||-1!==e.indexOf("image/png"))&&(c=4);const h=Bs(o,a,t,c);let l=0;for(const e of i){const n="number"==typeof e?Object.values(s)[e]:s[e],r=h+n.offset,i=Fi(t);if(i.data.length<=r)throw new Error(`${i.data.length} <= ${r}`);l|=i.data[r]<3&&void 0!==arguments[3]?arguments[3]:1;const i=n.width,s=hs(t)*(i-1),o=Math.round(s),a=n.height,c=hs(e)*(a-1),h=Math.round(c),l=n.components?n.components:r;return(h*i+o)*l}function bs(t,e,n,r,i){const s=[];for(let o=0;or)break;const c=e/i,h=a/i;s.push(t.slice(c,c+h))}return s}function Cs(t,e,n){const r=[];for(let i=0;i"u"&&typeof n.arrayOffsets<"u"?ms(t,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}(t,n,i,r),h=function(t,e,n){return typeof e.stringOffsets<"u"?ms(t,e.stringOffsets,e.stringOffsetType||"UINT32",n):null}(t,i,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":s=function(t,e,n,r){const i=t.array,s=t.count,o=fs(t.type,t.componentType),a=n.byteLength/o;let c;return c=t.componentType?ps(n,t.type,t.componentType,a):n,i?r?bs(c,e,r,n.length,o):s?Cs(c,e,s):[]:c}(n,r,a,c);break;case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":s=ws(r,a,c,h);break;case"ENUM":s=function(t,e,n,r,i){var s;const o=e.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");const a=null===(s=t.enums)||void 0===s?void 0:s[o];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);const c=a.valueType||"UINT16",h=fs(e.type,c),l=r.byteLength/h;let u=ps(r,e.type,c,l);if(u||(u=r),e.array){if(i)return function(t){const{valuesData:e,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:i,elementSize:s,enumEntry:o}=t,a=[];for(let t=0;ti)break;const h=Rs(e,n/s,c/s,o);a.push(h)}return a}({valuesData:u,numberOfElements:n,arrayOffsets:i,valuesDataBytesLength:r.length,elementSize:h,enumEntry:a});const t=e.count;return t?function(t,e,n,r){const i=[];for(let s=0;s"u"&&typeof n.arrayOffsetBufferView<"u"?ms(t,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}(t,n,i,r),h=function(t,e,n,r){return typeof n.stringOffsetBufferView<"u"?ms(t,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}(t,0,i,r);return"STRING"===n.type||"STRING"===n.componentType?s=ws(r,a,c,h):function(t){const e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(t.type)||typeof t.componentType<"u"&&e.includes(t.componentType)}(n)&&(s=function(t,e,n,r){const i="ARRAY"===t.type,s=t.componentCount,o="SCALAR",a=t.componentType||t.type,c=fs(o,a),h=ps(n,o,a,n.byteLength/c);return i?r?bs(h,e,r,n.length,c):s?Cs(h,e,s):[]:h}(n,r,a,c)),s}function Ps(t,e,n){const r=t.gltf.json;if(!r.meshes)return[];const i=[];for(const s of r.meshes)for(const r of s.primitives)Hs(t,n,e,i,r);return i}function Hs(t,e,n,r,i){const s=gs(t,{channels:n.channels,...n.texture},i);s&&As(t,e,s,r,i)}const Js=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e){!function(t,e){var n,r;if(null===(n=e.gltf)||void 0===n||!n.loadBuffers)return;const i=t.getExtension("EXT_feature_metadata");i&&(null!==(r=e.gltf)&&void 0!==r&&r.loadImages&&function(t,e){const n=e.schema;if(!n)return;const r=n.classes,{featureTextures:i}=e;if(r&&i)for(const e in r){const n=r[e],s=Gs(i,e);s&&Us(t,s,n)}}(t,i),function(t,e){const n=e.schema;if(!n)return;const r=n.classes,i=e.featureTables;if(r&&i)for(const e in r){const r=Ds(i,e);r&&Ls(t,n,r)}}(t,i))}(new cs(t),e)},name:"EXT_feature_metadata"},Symbol.toStringTag,{value:"Module"}));let js,ks;async function Vs(t){const e=t.modules||{};return e.basis?e.basis:(js=js||async function(t){let e=null,n=null;return[e,n]=await Promise.all([await O("basis_transcoder.js","textures",t),await O("basis_transcoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t(n).then((t=>{const{BasisFile:n,initializeBasis:r}=t;r(),e({BasisFile:n})}))}))}(e,n)}(t),await js)}async function Ks(t){const e=t.modules||{};return e.basisEncoder?e.basisEncoder:(ks=ks||async function(t){let e=null,n=null;return[e,n]=await Promise.all([await O("basis_encoder.js","textures",t),await O("basis_encoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t(n).then((t=>{const{BasisFile:n,KTX2File:r,initializeBasis:i,BasisEncoder:s}=t;i(),e({BasisFile:n,KTX2File:r,BasisEncoder:s})}))}))}(e,n)}(t),await ks)}const Qs=["","WEBKIT_","MOZ_"],zs={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"};let qs=null;var Ws,Ys,Xs,Zs,$s,to,eo,no;(function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB"})(Ws||(Ws={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(Ys||(Ys={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(Xs||(Xs={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(Zs||(Zs={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}($s||($s={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(to||(to={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(eo||(eo={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(no||(no={}));const ro=[171,75,84,88,32,50,48,187,13,10,26,10],io={etc1:{basisFormat:0,compressed:!0,format:36196},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:33776},bc3:{basisFormat:3,compressed:!0,format:33779},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:35840},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:35842},"astc-4x4":{basisFormat:10,compressed:!0,format:37808},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};function so(t,e,n){const r=new t(new Uint8Array(e));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");const t=r.getNumImages(),e=[];for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}function go(t,e,n){o(t.header.byteLength>20);const r=e.getUint32(n+0,fo),i=e.getUint32(n+4,fo);return n+=8,o(0===i),yo(t,e,n,r),(n+=r)+Bo(t,e,n,t.header.byteLength)}function Ao(t,e,n,r){return o(t.header.byteLength>20),function(t,e,n,r){for(;n+8<=t.header.byteLength;){const i=e.getUint32(n+0,fo),s=e.getUint32(n+4,fo);switch(n+=8,s){case 1313821514:yo(t,e,n,i);break;case 5130562:Bo(t,e,n,i);break;case 0:r.strict||yo(t,e,n,i);break;case 1:r.strict||Bo(t,e,n,i)}n+=H(i,4)}}(t,e,n,r),n+t.header.byteLength}function yo(t,e,n,r){const i=new Uint8Array(e.buffer,n,r),s=new TextDecoder("utf8").decode(i);return t.json=JSON.parse(s),H(r,4)}function Bo(t,e,n,r){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:e.buffer}),H(r,4)}function bo(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;const n=e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return n.substr(0,n.lastIndexOf("/")+1)+t}const Co=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),wo=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),vo={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Eo={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};let To;async function _o(){return To||(To=async function(){let t="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9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AOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support"));const e=await WebAssembly.instantiate(function(t){const e=new Uint8Array(t.length);for(let n=0;n96?r-71:r>64?r-65:r>47?r+4:r>46?63:62}let n=0;for(let r=0;r5&&void 0!==arguments[5]?arguments[5]:"NONE";const o=await _o();xo(o,o.exports[Eo[i]],t,e,n,r,o.exports[vo[s||"NONE"]])}(d,o,s,u,a,c),t.removeObjectExtension(e,Mo)}}const So=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e){var n,r;const i=new cs(t);if(null==e||null===(n=e.gltf)||void 0===n||!n.decompressMeshes||null===(r=e.gltf)||void 0===r||!r.loadBuffers)return;const s=[];for(const e of t.json.bufferViews||[])s.push(Io(i,e));await Promise.all(s),i.removeExtension(Mo)},name:"EXT_meshopt_compression"},Symbol.toStringTag,{value:"Module"})),Ro="EXT_texture_webp",Oo=Object.freeze(Object.defineProperty({__proto__:null,name:"EXT_texture_webp",preprocess:function(t,e){const n=new cs(t);if(!function(t){if(void 0===qi[t]){const e=a?function(t){switch(t){case"image/avif":case"image/webp":return function(t){try{return 0===document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)}catch{return!1}}(t);default:return!0}}(t):function(t){var e,n;const r=(null===(e=globalThis.loaders)||void 0===e?void 0:e.imageFormatsNode)||["image/png","image/jpeg","image/gif"];return!!(null===(n=globalThis.loaders)||void 0===n?void 0:n.parseImageNode)&&r.includes(t)}(t);qi[t]=e}return qi[t]}("image/webp")){if(n.getRequiredExtensions().includes(Ro))throw new Error(`gltf: Required extension ${Ro} not supported by browser`);return}const{json:r}=n;for(const t of r.textures||[]){const e=n.getObjectExtension(t,Ro);e&&(t.source=e.source),n.removeObjectExtension(t,Ro)}n.removeExtension(Ro)}},Symbol.toStringTag,{value:"Module"})),Fo="KHR_texture_basisu",Do=Object.freeze(Object.defineProperty({__proto__:null,name:"KHR_texture_basisu",preprocess:function(t,e){const n=new cs(t),{json:r}=n;for(const t of r.textures||[]){const e=n.getObjectExtension(t,Fo);e&&(t.source=e.source,n.removeObjectExtension(t,Fo))}n.removeExtension(Fo)}},Symbol.toStringTag,{value:"Module"}));function Go(t){const{buffer:e,size:n,count:r}=function(t){let e=t,n=1,r=0;return t&&t.value&&(e=t.value,n=t.size||1),e&&(ArrayBuffer.isView(e)||(e=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t?Array.isArray(t)?new e(t):!n||t instanceof e?t:new e(t):null}(e,Float32Array)),r=e.length/n),{buffer:e,size:n,count:r}}(t);return{value:e,size:n,byteOffset:0,count:r,type:is(n),componentType:ss(e)}}const Lo="KHR_draco_mesh_compression";async function Uo(t,e,n,r){const i=t.getObjectExtension(e,Lo);if(!i)return;const o=t.getTypedArrayForBufferView(i.bufferView),a=P(o.buffer,o.byteOffset),c={...n};delete c["3d-tiles"];const h=await s(a,$r,c,r),l=function(t){const e={};for(const n in t){const r=t[n];if("indices"!==n){const t=Go(r);e[n]=t}}return e}(h.attributes);for(const[n,r]of Object.entries(l))if(n in e.attributes){const i=e.attributes[n],s=t.getAccessor(i);null!=s&&s.min&&null!=s&&s.max&&(r.min=s.min,r.max=s.max)}e.attributes=l,h.indices&&(e.indices=Go(h.indices)),t.removeObjectExtension(e,Lo),function(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(e)}function No(t,e){var n;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,i=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(!i.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=i.DracoWriter.encodeSync({attributes:t}),a=null==s||null===(n=s.parseSync)||void 0===n?void 0:n.call(s,{attributes:t}),c=i._addFauxAttributes(a.attributes),h=i.addBufferView(o);return{primitives:[{attributes:c,mode:r,extensions:{[Lo]:{bufferView:h,attributes:c}}}]}}function*Po(t){for(const e of t.json.meshes||[])for(const t of e.primitives)yield t}const Ho=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e,n){var r;if(null==e||null===(r=e.gltf)||void 0===r||!r.decompressMeshes)return;const i=new cs(t),s=[];for(const t of Po(i))i.getObjectExtension(t,Lo)&&s.push(Uo(i,t,e,n));await Promise.all(s),i.removeExtension(Lo)},encode:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new cs(t);for(const t of n.json.meshes||[])No(t,e),n.addRequiredExtension(Lo)},name:"KHR_draco_mesh_compression",preprocess:function(t,e,n){const r=new cs(t);for(const t of Po(r))r.getObjectExtension(t,Lo)}},Symbol.toStringTag,{value:"Module"})),Jo="KHR_texture_transform",jo=new Qe,ko=new $e,Vo=new $e;function Ko(t,e){var n,r,i;const s=[],o=null===(n=e.json.materials)||void 0===n?void 0:n[t],a=null==o||null===(r=o.pbrMetallicRoughness)||void 0===r?void 0:r.baseColorTexture;a&&Qo(e,t,a,s);const c=null==o?void 0:o.emissiveTexture;c&&Qo(e,t,c,s);const h=null==o?void 0:o.normalTexture;h&&Qo(e,t,h,s);const l=null==o?void 0:o.occlusionTexture;l&&Qo(e,t,l,s);const u=null==o||null===(i=o.pbrMetallicRoughness)||void 0===i?void 0:i.metallicRoughnessTexture;u&&Qo(e,t,u,s)}function Qo(t,e,n,r){const i=function(t,e){var n;const r=null===(n=t.extensions)||void 0===n?void 0:n[Jo],{texCoord:i=0}=t,{texCoord:s=i}=r;if(-1===e.findIndex((t=>{let[e,n]=t;return e===i&&n===s}))){const n=function(t){const{offset:e=[0,0],rotation:n=0,scale:r=[1,1]}=t,i=(new $e).set(1,0,0,0,1,0,e[0],e[1],1),s=ko.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=Vo.set(r[0],0,0,0,r[1],0,0,0,1);return i.multiplyRight(s).multiplyRight(o)}(r);return i!==s&&(t.texCoord=s),e.push([i,s]),{originalTexCoord:i,texCoord:s,matrix:n}}return null}(n,r);if(!i)return;const s=t.json.meshes||[];for(const n of s)for(const r of n.primitives){const n=r.material;Number.isFinite(n)&&e===n&&zo(t,r,i)}}function zo(t,e,n){const{originalTexCoord:r,texCoord:i,matrix:s}=n,o=e.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){var a;const n=null===(a=t.json.accessors)||void 0===a?void 0:a[o];if(n&&n.bufferView){var c;const o=null===(c=t.json.bufferViews)||void 0===c?void 0:c[n.bufferView];if(o){const{arrayBuffer:a,byteOffset:c}=t.buffers[o.buffer],h=(c||0)+(n.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:u}=os(n,o),d=Xi[n.componentType],f=Yi[n.type],m=o.byteStride||d*f,p=new Float32Array(u);for(let t=0;t{t.uniforms[e].value&&!(e in n)&&(n[e]=t.uniforms[e].value)})),Object.keys(n).forEach((t=>{"object"==typeof n[t]&&void 0!==n[t].index&&(n[t].texture=e.getTexture(n[t].index))})),n}const ea=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t){const e=new cs(t),{json:n}=e,r=e.getExtension($o);if(r){const t=function(t,e){const{programs:n=[],shaders:r=[],techniques:i=[]}=t,s=new TextDecoder;return r.forEach((t=>{if(!Number.isFinite(t.bufferView))throw new Error("KHR_techniques_webgl: no shader code");t.code=s.decode(e.getTypedArrayForBufferView(t.bufferView))})),n.forEach((t=>{t.fragmentShader=r[t.fragmentShader],t.vertexShader=r[t.vertexShader]})),i.forEach((t=>{t.program=n[t.program]})),i}(r,e);for(const r of n.materials||[]){const n=e.getObjectExtension(r,$o);n&&(r.technique=Object.assign({},n,t[n.technique]),r.technique.values=ta(r.technique,e)),e.removeObjectExtension(r,$o)}e.removeExtension($o)}},encode:async function(t,e){},name:"KHR_techniques_webgl"},Symbol.toStringTag,{value:"Module"})),na=[Fs,Es,So,Oo,Do,Ho,Yo,Zo,ea,qo,Js];function ra(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=na.filter((t=>sa(t.name,e)));for(const s of r){var i;null===(i=s.preprocess)||void 0===i||i.call(s,t,e,n)}}async function ia(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=na.filter((t=>sa(t.name,e)));for(const s of r){var i;await(null===(i=s.decode)||void 0===i?void 0:i.call(s,t,e,n))}}function sa(t,e){var n;const r=(null==e||null===(n=e.gltf)||void 0===n?void 0:n.excludeExtensions)||{};return!(t in r&&!r[t])}const oa="KHR_binary_glTF",aa={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},ca={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class ha{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(t,e){this.json=t.json;const n=t.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn(`glTF: Unknown version ${n.asset.version}`)}if(!e.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),function(t){const e=new cs(t),{json:n}=e;for(const t of n.images||[]){const n=e.getObjectExtension(t,oa);n&&Object.assign(t,n),e.removeObjectExtension(t,oa)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,e.removeExtension(oa)}(t),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(const e in aa)this._convertTopLevelObjectToArray(t,e)}_convertTopLevelObjectToArray(t,e){const n=t[e];if(n&&!Array.isArray(n)){t[e]=[];for(const r in n){const i=n[r];i.id=i.id||r;const s=t[e].length;t[e].push(i),this.idToIndexMap[e][r]=s}}}_convertObjectIdsToArrayIndices(t){for(const e in aa)this._convertIdsToIndices(t,e);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(const e of t.textures)this._convertTextureIds(e);for(const e of t.meshes)this._convertMeshIds(e);for(const e of t.nodes)this._convertNodeIds(e);for(const e of t.scenes)this._convertSceneIds(e)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(const e of t.primitives){const{attributes:t,indices:n,material:r}=e;for(const e in t)t[e]=this._convertIdToIndex(t[e],"accessor");n&&(e.indices=this._convertIdToIndex(n,"accessor")),r&&(e.material=this._convertIdToIndex(r,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map((t=>this._convertIdToIndex(t,"node")))),t.meshes&&(t.meshes=t.meshes.map((t=>this._convertIdToIndex(t,"mesh"))))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map((t=>this._convertIdToIndex(t,"node"))))}_convertIdsToIndices(t,e){t[e]||(console.warn(`gltf v1: json doesn't contain attribute ${e}`),t[e]=[]);for(const n of t[e])for(const t in n){const e=n[t],r=this._convertIdToIndex(e,t);n[t]=r}}_convertIdToIndex(t,e){const n=ca[e];if(n in this.idToIndexMap){const r=this.idToIndexMap[n][t];if(!Number.isFinite(r))throw new Error(`gltf v1: failed to resolve ${e} with id ${t}`);return r}return t}_updateObjects(t){for(const t of this.json.buffers)delete t.type}_updateMaterial(t){for(const i of t.materials){var e,n,r;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const s=(null===(e=i.values)||void 0===e?void 0:e.tex)||(null===(n=i.values)||void 0===n?void 0:n.texture2d_0)||(null===(r=i.values)||void 0===r?void 0:r.diffuseTex),o=t.textures.findIndex((t=>t.id===s));-1!==o&&(i.pbrMetallicRoughness.baseColorTexture={index:o})}}}function la(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(new ha).normalize(t,e)}async function ua(t,e){var n,r,i;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return da(t,e,s,o),la(t,{normalize:null==o||null===(n=o.gltf)||void 0===n?void 0:n.normalize}),ra(t,o,a),null!=o&&null!==(r=o.gltf)&&void 0!==r&&r.loadBuffers&&t.json.buffers&&await fa(t,o,a),null!=o&&null!==(i=o.gltf)&&void 0!==i&&i.loadImages&&await ma(t,o,a),await ia(t,o,a),t}function da(t,e,n,r){if(r.uri&&(t.baseUri=r.uri),e instanceof ArrayBuffer&&!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new DataView(t),{magic:i=mo}=n,s=r.getUint32(e,!1);return s===i||s===mo}(e,n,r)&&(e=(new TextDecoder).decode(e)),"string"==typeof e)t.json=function(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;return"string"==typeof t?t.slice(0,e):ArrayBuffer.isView(t)?U(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?U(t,0,e):""}(t)}"`)}}(e);else if(e instanceof ArrayBuffer){const i={};n=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=new DataView(e),i=po(r,n+0),s=r.getUint32(n+4,fo),o=r.getUint32(n+8,fo);switch(Object.assign(t,{header:{byteOffset:n,byteLength:o,hasBinChunk:!1},type:i,version:s,json:{},binChunks:[]}),n+=12,t.version){case 1:return go(t,r,n);case 2:return Ao(t,r,n,{});default:throw new Error(`Invalid GLB version ${t.version}. Only supports version 1 and 2.`)}}(i,e,n,r.glb),Wi("glTF"===i.type,`Invalid GLB magic string ${i.type}`),t._glb=i,t.json=i.json}else Wi(!1,"GLTF: must be ArrayBuffer or string");const i=t.json.buffers||[];if(t.buffers=new Array(i.length).fill(null),t._glb&&t._glb.header.hasBinChunk){const{binChunks:e}=t._glb;t.buffers[0]={arrayBuffer:e[0].arrayBuffer,byteOffset:e[0].byteOffset,byteLength:e[0].byteLength}}const s=t.json.images||[];t.images=new Array(s.length).fill({})}async function fa(t,e,n){const r=t.json.buffers||[];for(let o=0;o1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;e={...ga.options,...e},e.gltf={...ga.options.gltf,...e.gltf};const{byteOffset:r=0}=e;return await ua({},t,r,e,n)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}},Aa={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ya={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ba={magFilter:10240,minFilter:10241,wrapS:10242,wrapT:10243},ba={10240:9729,10241:9986,10242:10497,10243:10497};class Ca{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{json:n,buffers:r=[],images:i=[]}=t,{baseUri:s=""}=t;return Wi(n),this.baseUri=s,this.buffers=r,this.images=i,this.jsonUnprocessed=n,this.json=this._resolveTree(t.json,e),this.json}_resolveTree(t){const e={...t};return this.json=e,t.bufferViews&&(e.bufferViews=t.bufferViews.map(((t,e)=>this._resolveBufferView(t,e)))),t.images&&(e.images=t.images.map(((t,e)=>this._resolveImage(t,e)))),t.samplers&&(e.samplers=t.samplers.map(((t,e)=>this._resolveSampler(t,e)))),t.textures&&(e.textures=t.textures.map(((t,e)=>this._resolveTexture(t,e)))),t.accessors&&(e.accessors=t.accessors.map(((t,e)=>this._resolveAccessor(t,e)))),t.materials&&(e.materials=t.materials.map(((t,e)=>this._resolveMaterial(t,e)))),t.meshes&&(e.meshes=t.meshes.map(((t,e)=>this._resolveMesh(t,e)))),t.nodes&&(e.nodes=t.nodes.map(((t,e)=>this._resolveNode(t,e))),e.nodes=e.nodes.map(((t,e)=>this._resolveNodeChildren(t)))),t.skins&&(e.skins=t.skins.map(((t,e)=>this._resolveSkin(t,e)))),t.scenes&&(e.scenes=t.scenes.map(((t,e)=>this._resolveScene(t,e)))),"number"==typeof this.json.scene&&e.scenes&&(e.scene=e.scenes[this.json.scene]),e}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,e){if("object"==typeof e)return e;const n=t&&t[e];return n||console.warn(`glTF file error: Could not find ${t}[${e}]`),n}_resolveScene(t,e){return{...t,id:t.id||`scene-${e}`,nodes:(t.nodes||[]).map((t=>this.getNode(t)))}}_resolveNode(t,e){const n={...t,id:(null==t?void 0:t.id)||`node-${e}`};return void 0!==t.mesh&&(n.mesh=this.getMesh(t.mesh)),void 0!==t.camera&&(n.camera=this.getCamera(t.camera)),void 0!==t.skin&&(n.skin=this.getSkin(t.skin)),void 0!==t.meshes&&t.meshes.length&&(n.mesh=t.meshes.reduce(((t,e)=>{const n=this.getMesh(e);return t.id=n.id,t.primitives=t.primitives.concat(n.primitives),t}),{primitives:[]})),n}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map((t=>this.getNode(t)))),t}_resolveSkin(t,e){const n="number"==typeof t.inverseBindMatrices?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${e}`,inverseBindMatrices:n}}_resolveMesh(t,e){const n={...t,id:t.id||`mesh-${e}`,primitives:[]};return t.primitives&&(n.primitives=t.primitives.map((t=>{const e={...t,attributes:{},indices:void 0,material:void 0},n=t.attributes;for(const t in n)e.attributes[t]=this.getAccessor(n[t]);return void 0!==t.indices&&(e.indices=this.getAccessor(t.indices)),void 0!==t.material&&(e.material=this.getMaterial(t.material)),e}))),n}_resolveMaterial(t,e){const n={...t,id:t.id||`material-${e}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};const t=n.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,e){const n=function(t){return ya[t]}(t.componentType),r=function(t){return Aa[t]}(t.type),i=n*r,s={...t,id:t.id||`accessor-${e}`,bytesPerComponent:n,components:r,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(void 0!==t.bufferView&&(s.bufferView=this.getBufferView(t.bufferView)),s.bufferView){const t=s.bufferView.buffer,{ArrayType:e,byteLength:n}=os(s,s.bufferView),r=(s.bufferView.byteOffset||0)+(s.byteOffset||0)+t.byteOffset;let i=t.arrayBuffer.slice(r,r+n);s.bufferView.byteStride&&(i=this._getValueFromInterleavedBuffer(t,r,s.bufferView.byteStride,s.bytesPerElement,s.count)),s.value=new e(i)}return s}_getValueFromInterleavedBuffer(t,e,n,r,i){const s=new Uint8Array(i*r);for(let o=0;o12;){const o={shape:"tile3d"};t.tiles.push(o),n=await s(e,n,r,i,o)}return n}async function Ma(t,e,n,r){var i,o;if(t.rotateYtoZ=!0,t.gltfUpAxis=null!=n&&null!==(i=n["3d-tiles"])&&void 0!==i&&i.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",null!=n&&null!==(o=n["3d-tiles"])&&void 0!==o&&o.loadGLTF){if(!r)return e.byteLength;const i=await s(e,ga,n,r);t.gltf=wa(i),t.gpuMemoryUsageInBytes=as(t.gltf)}else t.gltfArrayBuffer=e;return e.byteLength}async function Ia(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{shape:"tile3d"};switch(i.byteOffset=e,i.type=Pr(t,e),i.type){case Fr:return await xa(i,t,e,n,r,Ia);case Gr:return await Ta(i,t,e,n,r);case Ur:return await Ma(i,t,n,r);case Lr:return await _a(i,t,e,n,r);case Dr:return await xi(i,t,e,n,r);default:throw new Error(`3DTileLoader: unknown type ${i.type}`)}}async function Sa(t,e,n,r){const i=Number.isFinite(e.bitstream)?e.bitstream:e.bufferView;if("number"!=typeof i)return;const s=t.bufferViews[i],o=t.buffers[s.buffer];if(null==r||!r.baseUrl)throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){const t=`${(null==r?void 0:r.baseUrl)||""}/${o.uri}`,n=await(await r.fetch(t)).arrayBuffer();return void(e.explicitBitstream=new Uint8Array(n,s.byteOffset,s.byteLength))}const a=t.buffers.slice(0,s.buffer).reduce(((t,e)=>t+e.byteLength),0);e.explicitBitstream=new Uint8Array(n.slice(a,a+o.byteLength),s.byteOffset,s.byteLength)}function Ra(t){const e=new DataView(t);return e.getUint32(0,!0)+2**32*e.getUint32(4,!0)}const Oa={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Or,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:async function(t,e,n){if(1952609651!==new Uint32Array(t.slice(0,4))[0])throw new Error("Wrong subtree file magic number");if(1!==new Uint32Array(t.slice(4,8))[0])throw new Error("Wrong subtree file verson, must be 1");const r=Ra(t.slice(8,16)),i=new Uint8Array(t,24,r),s=new TextDecoder("utf8").decode(i),o=JSON.parse(s),a=Ra(t.slice(16,24));let c=new ArrayBuffer(0);if(a&&(c=t.slice(24+r)),await Sa(o,o.tileAvailability,c,n),Array.isArray(o.contentAvailability))for(const t of o.contentAvailability)await Sa(o,t,c,n);else await Sa(o,o.contentAvailability,c,n);return await Sa(o,o.childSubtreeAvailability,c,n),o},options:{}};var Fa=null;try{Fa=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Da(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function Ga(t){return!0===(t&&t.__isLong__)}function La(t){var e=Math.clz32(t&-t);return t?31-e:e}Da.prototype.__isLong__,Object.defineProperty(Da.prototype,"__isLong__",{value:!0}),Da.isLong=Ga;var Ua={},Na={};function Pa(t,e){var n,r,i;return e?(i=0<=(t>>>=0)&&t<256)&&(r=Na[t])?r:(n=Ja(t,0,!0),i&&(Na[t]=n),n):(i=-128<=(t|=0)&&t<128)&&(r=Ua[t])?r:(n=Ja(t,t<0?-1:0,!1),i&&(Ua[t]=n),n)}function Ha(t,e){if(isNaN(t))return e?Ya:Wa;if(e){if(t<0)return Ya;if(t>=Qa)return ec}else{if(t<=-za)return nc;if(t+1>=za)return tc}return t<0?Ha(-t,e).neg():Ja(t%Ka|0,t/Ka|0,e)}function Ja(t,e,n){return new Da(t,e,n)}Da.fromInt=Pa,Da.fromNumber=Ha,Da.fromBits=Ja;var ja=Math.pow;function ka(t,e,n){if(0===t.length)throw Error("empty string");if("number"==typeof e?(n=e,e=!1):e=!!e,"NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return e?Ya:Wa;if((n=n||10)<2||360)throw Error("interior hyphen");if(0===r)return ka(t.substring(1),e,n).neg();for(var i=Ha(ja(n,8)),s=Wa,o=0;o>>0:this.low},rc.toNumber=function(){return this.unsigned?(this.high>>>0)*Ka+(this.low>>>0):this.high*Ka+(this.low>>>0)},rc.toString=function(t){if((t=t||10)<2||36>>0).toString(t);if((s=a).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},rc.getHighBits=function(){return this.high},rc.getHighBitsUnsigned=function(){return this.high>>>0},rc.getLowBits=function(){return this.low},rc.getLowBitsUnsigned=function(){return this.low>>>0},rc.getNumBitsAbs=function(){if(this.isNegative())return this.eq(nc)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&!(t&1<=0},rc.isOdd=function(){return 1==(1&this.low)},rc.isEven=function(){return 0==(1&this.low)},rc.equals=function(t){return Ga(t)||(t=Va(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&this.high===t.high&&this.low===t.low},rc.eq=rc.equals,rc.notEquals=function(t){return!this.eq(t)},rc.neq=rc.notEquals,rc.ne=rc.notEquals,rc.lessThan=function(t){return this.comp(t)<0},rc.lt=rc.lessThan,rc.lessThanOrEqual=function(t){return this.comp(t)<=0},rc.lte=rc.lessThanOrEqual,rc.le=rc.lessThanOrEqual,rc.greaterThan=function(t){return this.comp(t)>0},rc.gt=rc.greaterThan,rc.greaterThanOrEqual=function(t){return this.comp(t)>=0},rc.gte=rc.greaterThanOrEqual,rc.ge=rc.greaterThanOrEqual,rc.compare=function(t){if(Ga(t)||(t=Va(t)),this.eq(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},rc.comp=rc.compare,rc.negate=function(){return!this.unsigned&&this.eq(nc)?nc:this.not().add(Xa)},rc.neg=rc.negate,rc.add=function(t){Ga(t)||(t=Va(t));var e=this.high>>>16,n=65535&this.high,r=this.low>>>16,i=65535&this.low,s=t.high>>>16,o=65535&t.high,a=t.low>>>16,c=0,h=0,l=0,u=0;return l+=(u+=i+(65535&t.low))>>>16,h+=(l+=r+a)>>>16,c+=(h+=n+o)>>>16,c+=e+s,Ja((l&=65535)<<16|(u&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},rc.subtract=function(t){return Ga(t)||(t=Va(t)),this.add(t.neg())},rc.sub=rc.subtract,rc.multiply=function(t){if(this.isZero())return this;if(Ga(t)||(t=Va(t)),Fa)return Ja(Fa.mul(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned);if(t.isZero())return this.unsigned?Ya:Wa;if(this.eq(nc))return t.isOdd()?nc:Wa;if(t.eq(nc))return this.isOdd()?nc:Wa;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(qa)&&t.lt(qa))return Ha(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,n=65535&this.high,r=this.low>>>16,i=65535&this.low,s=t.high>>>16,o=65535&t.high,a=t.low>>>16,c=65535&t.low,h=0,l=0,u=0,d=0;return u+=(d+=i*c)>>>16,l+=(u+=r*c)>>>16,u&=65535,l+=(u+=i*a)>>>16,h+=(l+=n*c)>>>16,l&=65535,h+=(l+=r*a)>>>16,l&=65535,h+=(l+=i*o)>>>16,h+=e*c+n*a+r*o+i*s,Ja((u&=65535)<<16|(d&=65535),(h&=65535)<<16|(l&=65535),this.unsigned)},rc.mul=rc.multiply,rc.divide=function(t){if(Ga(t)||(t=Va(t)),t.isZero())throw Error("division by zero");var e,n,r;if(Fa)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?Ja((this.unsigned?Fa.div_u:Fa.div_s)(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Ya:Wa;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ya;if(t.gt(this.shru(1)))return Za;r=Ya}else{if(this.eq(nc))return t.eq(Xa)||t.eq($a)?nc:t.eq(nc)?Xa:(e=this.shr(1).div(t).shl(1)).eq(Wa)?t.isNegative()?Xa:$a:(n=this.sub(t.mul(e)),r=e.add(n.div(t)));if(t.eq(nc))return this.unsigned?Ya:Wa;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=Wa}for(n=this;n.gte(t);){e=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var i=Math.ceil(Math.log(e)/Math.LN2),s=i<=48?1:ja(2,i-48),o=Ha(e),a=o.mul(t);a.isNegative()||a.gt(n);)a=(o=Ha(e-=s,this.unsigned)).mul(t);o.isZero()&&(o=Xa),r=r.add(o),n=n.sub(a)}return r},rc.div=rc.divide,rc.modulo=function(t){return Ga(t)||(t=Va(t)),Fa?Ja((this.unsigned?Fa.rem_u:Fa.rem_s)(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},rc.mod=rc.modulo,rc.rem=rc.modulo,rc.not=function(){return Ja(~this.low,~this.high,this.unsigned)},rc.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},rc.clz=rc.countLeadingZeros,rc.countTrailingZeros=function(){return this.low?La(this.low):La(this.high)+32},rc.ctz=rc.countTrailingZeros,rc.and=function(t){return Ga(t)||(t=Va(t)),Ja(this.low&t.low,this.high&t.high,this.unsigned)},rc.or=function(t){return Ga(t)||(t=Va(t)),Ja(this.low|t.low,this.high|t.high,this.unsigned)},rc.xor=function(t){return Ga(t)||(t=Va(t)),Ja(this.low^t.low,this.high^t.high,this.unsigned)},rc.shiftLeft=function(t){return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?Ja(this.low<>>32-t,this.unsigned):Ja(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):Ja(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},rc.shr=rc.shiftRight,rc.shiftRightUnsigned=function(t){return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?Ja(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):Ja(32===t?this.high:this.high>>>t-32,0,this.unsigned)},rc.shru=rc.shiftRightUnsigned,rc.shr_u=rc.shiftRightUnsigned,rc.rotateLeft=function(t){var e;return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:32===t?Ja(this.high,this.low,this.unsigned):t<32?(e=32-t,Ja(this.low<>>e,this.high<>>e,this.unsigned)):(e=32-(t-=32),Ja(this.high<>>e,this.low<>>e,this.unsigned))},rc.rotl=rc.rotateLeft,rc.rotateRight=function(t){var e;return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:32===t?Ja(this.high,this.low,this.unsigned):t<32?(e=32-t,Ja(this.high<>>t,this.low<>>t,this.unsigned)):(e=32-(t-=32),Ja(this.low<>>t,this.high<>>t,this.unsigned))},rc.rotr=rc.rotateRight,rc.toSigned=function(){return this.unsigned?Ja(this.low,this.high,!1):this},rc.toUnsigned=function(){return this.unsigned?this:Ja(this.low,this.high,!0)},rc.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},rc.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},rc.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},Da.fromBytes=function(t,e,n){return n?Da.fromBytesLE(t,e):Da.fromBytesBE(t,e)},Da.fromBytesLE=function(t,e){return new Da(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},Da.fromBytesBE=function(t,e){return new Da(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)};const sc=180/Math.PI;function oc(t,e,n){const r=1<=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function cc(t){return[ac(t[0]),ac(t[1])]}function hc(t,e){let[n,r]=e;switch(t){case 0:return[1,n,r];case 1:return[-n,1,r];case 2:return[-n,-r,1];case 3:return[-1,-r,-n];case 4:return[r,-1,-n];case 5:return[r,n,-1];default:throw new Error("Invalid face")}}function lc(t){let[e,n,r]=t;const i=Math.atan2(r,Math.sqrt(e*e+n*n));return[Math.atan2(n,e)*sc,i*sc]}function uc(t,e,n,r){if(0===r){1===n&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const r=e[0];e[0]=e[1],e[1]=r}}function dc(t){const{face:e,ij:n,level:r}=t,i=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(100*Math.pow(2,-r))),o=new Float64Array(4*s*2+2);let a=0,c=0;for(let t=0;t<4;t++){const h=i[t].slice(0),l=i[t+1],u=(l[0]-h[0])/s,d=(l[1]-h[1])/s;for(let t=0;t89.999&&(t[0]=c);const i=t[0]-c;t[0]+=i>180?-360:i<-180?360:0,o[a++]=t[0],o[a++]=t[1],c=t[0]}}return o[a++]=o[0],o[a++]=o[1],o}function fc(t){const e=function(t){return t.indexOf("/")>0?t:function(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<64;)e="0"+e;const n=e.lastIndexOf("1"),r=e.substring(0,3),i=e.substring(3,n),s=i.length/2,o=Da.fromString(r,!0,2).toString(10);let a="";if(0!==s)for(a=Da.fromString(i,!0,2).toString(4);a.length=0;t--){s=i-t;const e=r[t];let n=0,a=0;"1"===e?a=1:"2"===e?(n=1,a=1):"3"===e&&(n=1);const c=Math.pow(2,s-1);uc(c,o,n,a),o[0]+=c*n,o[1]+=c*a}if(n%2==1){const t=o[0];o[0]=o[1],o[1]=t}return{face:n,ij:o,level:s}}(e)}function mc(t){if(t.length%2!=0)throw new Error("Invalid corners");const e=[],n=[];for(let r=0;rt-e)),n.sort(((t,e)=>t-e)),{west:e[0],east:e[e.length-1],north:n[n.length-1],south:n[0]}}function pc(t){const e=t.token,n={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},r=function(t,e){const n=(null==e?void 0:e.minimumHeight)||0,r=(null==e?void 0:e.maximumHeight)||0,i=function(t){let e;if(2===t.face||5===t.face){let n=null,r=0;for(let e=0;e<4;e++){const i=dc(fc(`${t.face}/${e}`));(typeof n>"u"||null===n)&&(n=new Float64Array(4*i.length)),n.set(i,r),r+=i.length}e=mc(n)}else e=mc(dc(t));return e}(fc(t)),s=i.west,o=i.south,a=i.east,c=i.north,h=[];return h.push(new Qe(s,c,n)),h.push(new Qe(a,c,n)),h.push(new Qe(a,o,n)),h.push(new Qe(s,o,n)),h.push(new Qe(s,c,r)),h.push(new Qe(a,c,r)),h.push(new Qe(a,o,r)),h.push(new Qe(s,o,r)),h}(e,n),i=function(t){return function(t){const e=cc(oc(t.ij,t.level,[.5,.5]));return lc(hc(t.face,e))}(fc(t))}(e),s=i[0],o=i[1],a=Hn.WGS84.cartographicToCartesian([s,o,n.maximumHeight]),c=new Qe(a[0],a[1],a[2]);r.push(c);const h=function(t,e=new Xn){if(!t||0===t.length)return e.halfAxes=new $e([0,0,0,0,0,0,0,0,0]),e.center=new Qe,e;const n=t.length,r=new Qe(0,0,0);for(const e of t)r.add(e);const i=1/n;r.multiplyByScalar(i);let s=0,o=0,a=0,c=0,h=0,l=0;for(const e of t){const t=Cr.copy(e).subtract(r);s+=t.x*t.x,o+=t.x*t.y,a+=t.x*t.z,c+=t.y*t.y,h+=t.y*t.z,l+=t.z*t.z}s*=i,o*=i,a*=i,c*=i,h*=i,l*=i;const u=_r;u[0]=s,u[1]=o,u[2]=a,u[3]=o,u[4]=c,u[5]=h,u[6]=a,u[7]=h,u[8]=l;const{unitary:d}=function(t,e={}){let n=0,r=0;const i=fr,s=mr;i.identity(),s.copy(t);const o=1e-20*function(t){let e=0;for(let n=0;n<9;++n){const r=t[n];e+=r*r}return Math.sqrt(e)}(s);for(;r<10&&Br(s)>o;)br(s,pr),gr.copy(pr).transpose(),s.multiplyRight(pr),s.multiplyLeft(gr),i.multiplyRight(pr),++n>2&&(++r,n=0);return e.unitary=i.toTarget(e.unitary),e.diagonal=s.toTarget(e.diagonal),e}(u,xr),f=e.halfAxes.copy(d);let m=f.getColumn(0,vr),p=f.getColumn(1,Er),g=f.getColumn(2,Tr),A=-Number.MAX_VALUE,y=-Number.MAX_VALUE,B=-Number.MAX_VALUE,b=Number.MAX_VALUE,C=Number.MAX_VALUE,w=Number.MAX_VALUE;for(const e of t)Cr.copy(e),A=Math.max(Cr.dot(m),A),y=Math.max(Cr.dot(p),y),B=Math.max(Cr.dot(g),B),b=Math.min(Cr.dot(m),b),C=Math.min(Cr.dot(p),C),w=Math.min(Cr.dot(g),w);m=m.multiplyByScalar(.5*(b+A)),p=p.multiplyByScalar(.5*(C+y)),g=g.multiplyByScalar(.5*(w+B)),e.center.copy(m).add(p).add(g);const v=wr.set(A-b,y-C,B-w).multiplyByScalar(.5),E=new $e([v[0],0,0,0,v[1],0,0,0,v[2]]);return e.halfAxes.multiplyRight(E),e}(r);return[...h.center,...h.halfAxes]}const gc={QUADTREE:4,OCTREE:8};function Ac(t,e,n){if(null!=t&&t.box){const r=function(t,e){const n=function(t){return t.and(t.not().add(1))}(t).shiftRightUnsigned(2);return t.add(Da.fromNumber(2*e+1-4).multiply(n))}(ic(t.s2VolumeInfo.token),e),i=function(t){if(t.isZero())return"X";let e=t.countTrailingZeros();e=(e-e%4)/4;const n=e;e*=4;const r=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-n-r.length).join("0")+r}(r),s={...t.s2VolumeInfo};if("OCTREE"===(s.token=i,n)){const e=t.s2VolumeInfo,n=e.maximumHeight-e.minimumHeight,r=n/2,i=e.minimumHeight+n/2;e.minimumHeight=i-r,e.maximumHeight=i+r}return{box:pc(s),s2VolumeInfo:s}}}async function yc(t){const{implicitOptions:e,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:i,loaderOptions:s}=t;let{subtree:o,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=t;const{subdivisionScheme:h,subtreeLevels:l,maximumLevel:u,contentUrlTemplate:d,subtreesUriTemplate:f,basePath:m}=e,p={children:[],lodMetricValue:0,contentUrl:""};if(!u)return Ot.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${d} won't be loaded...`),p;const g=a+c.level;if(g>u)return p;const A=gc[h],y=Math.log2(A),B=1&r,b=r>>1&1,C=r>>2&1,w=(A**a-1)/(A-1);let v=Cc(n.mortonIndex,r,y),E=w+v,T=Cc(n.x,B,1),_=Cc(n.y,b,1),x=Cc(n.z,C,1),M=!1;a>=l&&(M=Bc(o.childSubtreeAvailability,v));const I=Cc(c.x,T,a),S=Cc(c.y,_,a),R=Cc(c.z,x,a);if(M){const t=wc(`${m}/${f}`,g,I,S,R);o=await he(t,Oa,s),c={mortonIndex:v,x:T,y:_,z:x,level:a},v=0,E=0,T=0,_=0,x=0,a=0}if(!Bc(o.tileAvailability,E))return p;Bc(o.contentAvailability,E)&&(p.contentUrl=wc(d,g,I,S,R));const O=a+1,F={mortonIndex:v,x:T,y:_,z:x};for(let t=0;t1&&Ot.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=t,"constant"in n?!!n.constant:!!n.explicitBitstream&&function(t,e){const n=t%8;return 1==(e[Math.floor(t/8)]>>n&1)}(e,n.explicitBitstream)}function bc(t,e,n,r,i){const{basePath:s,refine:o,getRefine:a,lodMetricType:c,getTileType:h,rootLodMetricValue:l,rootBoundingVolume:u}=r,d=t.contentUrl&&t.contentUrl.replace(`${s}/`,""),f=l/2**e,m=function(t,e,n){if(e.region){const{childTileX:r,childTileY:i,childTileZ:s}=n,[o,a,c,h,l,u]=e.region,d=2**t,f=(c-o)/d,m=(h-a)/d,p=(u-l)/d,[g,A]=[o+f*r,o+f*(r+1)],[y,B]=[a+m*i,a+m*(i+1)],[b,C]=[l+p*s,l+p*(s+1)];return{region:[g,y,A,B,b,C]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${e}`)}(e,null!=i&&i.box?{box:i.box}:u,n);return{children:t.children,contentUrl:t.contentUrl,content:{uri:d},id:t.contentUrl,refine:a(o),type:h(t),lodMetricType:c,lodMetricValue:f,geometricError:f,transform:t.transform,boundingVolume:m}}function Cc(t,e,n){return(t<s[t]))}function vc(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!e)return Ir.EMPTY;const n=e.split("?")[0].split(".").pop();switch(n){case"pnts":return Ir.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Ir.SCENEGRAPH;default:return n||Ir.EMPTY}}function Ec(t){switch(t){case"REPLACE":case"replace":return Mr.REPLACE;case"ADD":case"add":return Mr.ADD;default:return t}}function Tc(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){const n=new URL(t,`${e}/`);return decodeURI(n.toString())}return t.startsWith("/")?t:function(){const t=[];for(let e=0;e=-1&&!r;i--){let s;i>=0?s=t[i]:(void 0===e&&(e=z()),s=e),0!==s.length&&(n=`${s}/${n}`,r=s.charCodeAt(0)===Y)}return n=X(n,!r),r?`/${n}`:n.length>0?n:"."}(e,t)}function _c(t,e){if(!t)return null;let n;if(t.content){var r;const i=t.content.uri||(null===(r=t.content)||void 0===r?void 0:r.url);typeof i<"u"&&(n=Tc(i,e))}return{...t,id:n,contentUrl:n,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:vc(t,n),refine:Ec(t.refine)}}async function xc(t,e,n,r,i){var s,o,a;const{subdivisionScheme:c,maximumLevel:h,availableLevels:l,subtreeLevels:u,subtrees:{uri:d}}=r,f=Tc(wc(d,0,0,0,0),n),m=await he(f,Oa,i),p=null===(s=t.content)||void 0===s?void 0:s.uri,g=p?Tc(p,n):"",A=null==e||null===(o=e.root)||void 0===o?void 0:o.refine,y=t.geometricError,B=null===(a=t.boundingVolume.extensions)||void 0===a?void 0:a["3DTILES_bounding_volume_S2"];if(B){const e={box:pc(B),s2VolumeInfo:B};t.boundingVolume=e}const b=t.boundingVolume,C={contentUrlTemplate:g,subtreesUriTemplate:d,subdivisionScheme:c,subtreeLevels:u,maximumLevel:Number.isFinite(l)?l-1:h,refine:A,basePath:n,lodMetricType:Rr.GEOMETRIC_ERROR,rootLodMetricValue:y,rootBoundingVolume:b,getTileType:vc,getRefine:Ec};return await async function(t,e,n,r,i){if(!t)return null;const{children:s,contentUrl:o}=await yc({subtree:n,implicitOptions:r,loaderOptions:i});let a,c=null;return o&&(a=o,c={uri:o.replace(`${e}/`,"")}),{...t,id:a,contentUrl:a,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:vc(t,a),refine:Ec(t.refine),content:c||t.content,children:s}}(t,n,m,C,i)}function Mc(t){var e;return(null==t||null===(e=t.extensions)||void 0===e?void 0:e["3DTILES_implicit_tiling"])||(null==t?void 0:t.implicitTiling)}const Ic={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Or,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=e["3d-tiles"]||{};let i;return i="auto"===r.isTileset?(null==n?void 0:n.url)&&-1!==n.url.indexOf(".json"):r.isTileset,i?Sc(t,e,n):Rc(t,e,n)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function Sc(t,e,n){var r;const i=JSON.parse((new TextDecoder).decode(t)),s=(null==n?void 0:n.url)||"",o=function(t){return W(t)}(s),a=await async function(t,e,n){let r=null;const i=Mc(t.root);r=i&&t.root?await xc(t.root,t,e,i,n):_c(t.root,e);const s=[];for(s.push(r);s.length>0;){const r=s.pop()||{},i=r.children||[],o=[];for(const r of i){const i=Mc(r);let a;a=i?await xc(r,t,e,i,n):_c(r,e),a&&(o.push(a),s.push(a))}r.children=o}return r}(i,o,e||{});return{...i,shape:"tileset3d",loader:Ic,url:s,queryString:(null==n?void 0:n.queryString)||"",basePath:o,root:a||i.root,type:Sr.TILES3D,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:(null===(r=i.root)||void 0===r?void 0:r.geometricError)||0}}async function Rc(t,e,n){const r={content:{shape:"tile3d",featureIds:null}};return await Ia(t,0,e,n,r.content),r.content}const Oc="https://api.cesium.com/v1/assets";async function Fc(t,e){if(!e){const n=await async function(t){o(t);const e={Authorization:`Bearer ${t}`},n=await dt("https://api.cesium.com/v1/assets",{headers:e});if(!n.ok)throw new Error(n.statusText);return await n.json()}(t);for(const t of n.items)"3DTILES"===t.type&&(e=t.id)}const n=await async function(t,e){o(t,e);const n={Authorization:`Bearer ${t}`},r=`${Oc}/${e}`;let i=await dt(`${r}`,{headers:n});if(!i.ok)throw new Error(i.statusText);let s=await i.json();if(i=await dt(`${r}/endpoint`,{headers:n}),!i.ok)throw new Error(i.statusText);const a=await i.json();return s={...s,...a},s}(t,e),{type:r,url:i}=n;return o("3DTILES"===r&&i),n.headers={Authorization:`Bearer ${n.accessToken}`},n}const Dc={...Ic,id:"cesium-ion",name:"Cesium Ion",preload:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e["cesium-ion"]||{};const{accessToken:n}=e;let r=e.assetId;if(!Number.isFinite(r)){const e=t.match(/\/([0-9]+)\/tileset.json/);r=e&&e[1]}return Fc(n,r)},parse:async(t,e,n)=>((e={...e})["3d-tiles"]=e["cesium-ion"],e.loader=Dc,Ic.parse(t,e,n)),options:{"cesium-ion":{...Ic.options["3d-tiles"],accessToken:null}}};class Gc{constructor(t,e){if(this.schema=void 0,this.options=void 0,this.shape=void 0,this.length=0,this.rows=null,this.cursor=0,this._headers=[],this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;return t?(t=t.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}}class Lc{constructor(t,e){if(this.schema=void 0,this.options=void 0,this.length=0,this.objectRows=null,this.arrayRows=null,this.cursor=0,this._headers=null,this.options=e,this.schema=t,t){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||(this._headers=function(t){const e=[];for(let n=0;n0?this.allocated*=2:100,this.columns={};for(const t in this.schema){const e=this.schema[t],n=e.type||Float32Array,r=this.columns[e.index];if(r&&ArrayBuffer.isView(r)){const t=new n(this.allocated);t.set(r),this.columns[e.index]=t}else r?(r.length=this.allocated,this.columns[e.index]=r):this.columns[e.index]=new n(this.allocated)}}}_pruneColumns(){for(const[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}}const Nc={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0};class Pc{constructor(t,e){this.schema=void 0,this.options=void 0,this.aggregator=null,this.batchCount=0,this.bytesUsed=0,this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),this.totalLength=0,this.totalBytes=0,this.rowBytes=0,this.schema=t,this.options={...Nc,...e}}limitReached(){var t,e;return!!(null!==(t=this.options)&&void 0!==t&&t.limit&&this.totalLength>=this.options.limit||null!==(e=this.options)&&void 0!==e&&e._limitMB&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),"string"==typeof t&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?8*t.length:8*Object.keys(t).length}_isFull(){if(!this.aggregator||0===this.aggregator.rowCount())return!1;if("auto"===this.options.batchSize){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return!(this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs||(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),0))}_getBatch(t){if(!this.aggregator)return null;null!=t&&t.bytesUsed&&(this.bytesUsed=t.bytesUsed);const e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return Lc;case"columnar-table":return Uc;case"arrow-table":if(!Pc.ArrowBatch)throw new Error("TableBatchBuilder");return Pc.ArrowBatch;default:return Gc}}}Pc.ArrowBatch=void 0;const Hc=Number.MAX_SAFE_INTEGER;var Jc=function(t){return t[t.BEGIN=0]="BEGIN",t[t.VALUE=1]="VALUE",t[t.OPEN_OBJECT=2]="OPEN_OBJECT",t[t.CLOSE_OBJECT=3]="CLOSE_OBJECT",t[t.OPEN_ARRAY=4]="OPEN_ARRAY",t[t.CLOSE_ARRAY=5]="CLOSE_ARRAY",t[t.TEXT_ESCAPE=6]="TEXT_ESCAPE",t[t.STRING=7]="STRING",t[t.BACKSLASH=8]="BACKSLASH",t[t.END=9]="END",t[t.OPEN_KEY=10]="OPEN_KEY",t[t.CLOSE_KEY=11]="CLOSE_KEY",t[t.TRUE=12]="TRUE",t[t.TRUE2=13]="TRUE2",t[t.TRUE3=14]="TRUE3",t[t.FALSE=15]="FALSE",t[t.FALSE2=16]="FALSE2",t[t.FALSE3=17]="FALSE3",t[t.FALSE4=18]="FALSE4",t[t.NULL=19]="NULL",t[t.NULL2=20]="NULL2",t[t.NULL3=21]="NULL3",t[t.NUMBER_DECIMAL_POINT=22]="NUMBER_DECIMAL_POINT",t[t.NUMBER_DIGIT=23]="NUMBER_DIGIT",t}(Jc||{});const jc=101,kc=/[\\"\n]/g,Vc={onready:()=>{},onopenobject:()=>{},onkey:()=>{},oncloseobject:()=>{},onopenarray:()=>{},onclosearray:()=>{},onvalue:()=>{},onerror:()=>{},onend:()=>{},onchunkparsed:()=>{}};class Kc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=Vc,this.bufferCheckPosition=Hc,this.q="",this.c="",this.p="",this.closed=!1,this.closedRoot=!1,this.sawRoot=!1,this.error=null,this.state=Jc.BEGIN,this.stack=[],this.position=0,this.column=0,this.line=1,this.slashed=!1,this.unicodeI=0,this.unicodeS=null,this.depth=0,this.textNode=void 0,this.numberNode=void 0,this.options={...Vc,...t},this.textNode=void 0,this.numberNode="",this.emit("onready")}end(){return(this.state!==Jc.VALUE||0!==this.depth)&&this._error("Unexpected end"),this._closeValue(),this.c="",this.closed=!0,this.emit("onend"),this}resume(){return this.error=null,this}close(){return this.write(null)}emit(t,e){var n,r;null===(n=(r=this.options)[t])||void 0===n||n.call(r,e,this)}emitNode(t,e){this._closeValue(),this.emit(t,e)}write(t){if(this.error)throw this.error;if(this.closed)return this._error("Cannot write after close. Assign an onready handler.");if(null===t)return this.end();let e=0,n=t.charCodeAt(0),r=this.p;for(;n&&(r=n,this.c=n=t.charCodeAt(e++),r!==n?this.p=r:r=this.p,n);)switch(this.position++,10===n?(this.line++,this.column=0):this.column++,this.state){case Jc.BEGIN:123===n?this.state=Jc.OPEN_OBJECT:91===n?this.state=Jc.OPEN_ARRAY:Qc(n)||this._error("Non-whitespace before {[.");continue;case Jc.OPEN_KEY:case Jc.OPEN_OBJECT:if(Qc(n))continue;if(this.state===Jc.OPEN_KEY)this.stack.push(Jc.CLOSE_KEY);else{if(125===n){this.emit("onopenobject"),this.depth++,this.emit("oncloseobject"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;continue}this.stack.push(Jc.CLOSE_OBJECT)}34===n?this.state=Jc.STRING:this._error('Malformed object key should start with "');continue;case Jc.CLOSE_KEY:case Jc.CLOSE_OBJECT:if(Qc(n))continue;58===n?(this.state===Jc.CLOSE_OBJECT?(this.stack.push(Jc.CLOSE_OBJECT),this._closeValue("onopenobject"),this.depth++):this._closeValue("onkey"),this.state=Jc.VALUE):125===n?(this.emitNode("oncloseobject"),this.depth--,this.state=this.stack.pop()||Jc.VALUE):44===n?(this.state===Jc.CLOSE_OBJECT&&this.stack.push(Jc.CLOSE_OBJECT),this._closeValue(),this.state=Jc.OPEN_KEY):this._error("Bad object");continue;case Jc.OPEN_ARRAY:case Jc.VALUE:if(Qc(n))continue;if(this.state===Jc.OPEN_ARRAY){if(this.emit("onopenarray"),this.depth++,this.state=Jc.VALUE,93===n){this.emit("onclosearray"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;continue}this.stack.push(Jc.CLOSE_ARRAY)}34===n?this.state=Jc.STRING:123===n?this.state=Jc.OPEN_OBJECT:91===n?this.state=Jc.OPEN_ARRAY:116===n?this.state=Jc.TRUE:102===n?this.state=Jc.FALSE:110===n?this.state=Jc.NULL:45===n?this.numberNode+="-":48<=n&&n<=57?(this.numberNode+=String.fromCharCode(n),this.state=Jc.NUMBER_DIGIT):this._error("Bad value");continue;case Jc.CLOSE_ARRAY:if(44===n)this.stack.push(Jc.CLOSE_ARRAY),this._closeValue("onvalue"),this.state=Jc.VALUE;else if(93===n)this.emitNode("onclosearray"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;else{if(Qc(n))continue;this._error("Bad array")}continue;case Jc.STRING:void 0===this.textNode&&(this.textNode="");let i=e-1,s=this.slashed,o=this.unicodeI;t:for(;;){for(;o>0;)if(this.unicodeS+=String.fromCharCode(n),n=t.charCodeAt(e++),this.position++,4===o?(this.textNode+=String.fromCharCode(parseInt(this.unicodeS,16)),o=0,i=e-1):o++,!n)break t;if(34===n&&!s){this.state=this.stack.pop()||Jc.VALUE,this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}if(92===n&&!s&&(s=!0,this.textNode+=t.substring(i,e-1),this.position+=e-1-i,n=t.charCodeAt(e++),this.position++,!n))break;if(s){if(s=!1,110===n?this.textNode+="\n":114===n?this.textNode+="\r":116===n?this.textNode+="\t":102===n?this.textNode+="\f":98===n?this.textNode+="\b":117===n?(o=1,this.unicodeS=""):this.textNode+=String.fromCharCode(n),n=t.charCodeAt(e++),this.position++,i=e-1,n)continue;break}kc.lastIndex=e;const r=kc.exec(t);if(null===r){e=t.length+1,this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}if(e=r.index+1,n=t.charCodeAt(r.index),!n){this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}}this.slashed=s,this.unicodeI=o;continue;case Jc.TRUE:114===n?this.state=Jc.TRUE2:this._error(`Invalid true started with t${n}`);continue;case Jc.TRUE2:117===n?this.state=Jc.TRUE3:this._error(`Invalid true started with tr${n}`);continue;case Jc.TRUE3:n===jc?(this.emit("onvalue",!0),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid true started with tru${n}`);continue;case Jc.FALSE:97===n?this.state=Jc.FALSE2:this._error(`Invalid false started with f${n}`);continue;case Jc.FALSE2:108===n?this.state=Jc.FALSE3:this._error(`Invalid false started with fa${n}`);continue;case Jc.FALSE3:115===n?this.state=Jc.FALSE4:this._error(`Invalid false started with fal${n}`);continue;case Jc.FALSE4:n===jc?(this.emit("onvalue",!1),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid false started with fals${n}`);continue;case Jc.NULL:117===n?this.state=Jc.NULL2:this._error(`Invalid null started with n${n}`);continue;case Jc.NULL2:108===n?this.state=Jc.NULL3:this._error(`Invalid null started with nu${n}`);continue;case Jc.NULL3:108===n?(this.emit("onvalue",null),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid null started with nul${n}`);continue;case Jc.NUMBER_DECIMAL_POINT:46===n?(this.numberNode+=".",this.state=Jc.NUMBER_DIGIT):this._error("Leading zero not followed by .");continue;case Jc.NUMBER_DIGIT:48<=n&&n<=57?this.numberNode+=String.fromCharCode(n):46===n?(-1!==this.numberNode.indexOf(".")&&this._error("Invalid number has two dots"),this.numberNode+="."):n===jc||69===n?((-1!==this.numberNode.indexOf("e")||-1!==this.numberNode.indexOf("E"))&&this._error("Invalid number has two exponential"),this.numberNode+="e"):43===n||45===n?(r===jc||69===r||this._error("Invalid symbol in number"),this.numberNode+=String.fromCharCode(n)):(this._closeNumber(),e--,this.state=this.stack.pop()||Jc.VALUE);continue;default:this._error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&function(t){const e=Math.max(Hc,10);let n=0;for(const r of["textNode","numberNode"]){const i=void 0===t[r]?0:t[r].length;i>e&&("text"===r||t._error(`Max buffer length exceeded: ${r}`)),n=Math.max(n,i)}t.bufferCheckPosition=Hc-n+t.position}(this),this.emit("onchunkparsed"),this}_closeValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"onvalue";void 0!==this.textNode&&this.emit(t,this.textNode),this.textNode=void 0}_closeNumber(){this.numberNode&&this.emit("onvalue",parseFloat(this.numberNode)),this.numberNode=""}_error(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this._closeValue(),t+=`\nLine: ${this.line}\nColumn: ${this.column}\nChar: ${this.c}`;const e=new Error(t);this.error=e,this.emit("onerror",e)}}function Qc(t){return 13===t||10===t||32===t||9===t}class zc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.path=void 0,this.path=["$"],t instanceof zc)this.path=[...t.path];else if(Array.isArray(t))this.path.push(...t);else if("string"==typeof t&&(this.path=t.split("."),"$"!==this.path[0]))throw new Error("JSONPaths must start with $")}clone(){return new zc(this)}toString(){return this.path.join(".")}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let e=0;e{this.jsonpath=new zc,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:t=>{this._openObject({}),typeof t<"u"&&this.parser.emit("onkey",t)},onkey:t=>{this.jsonpath.set(t),this.currentState.key=t},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:t=>{this._pushOrSet(t)},onerror:t=>{throw t},onend:()=>{this.result=this.currentState.container.pop()},...t})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new zc}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){const{container:e,key:n}=this.currentState;null!==n?(e[n]=t,this.currentState.key=null):e.push(t)}_openArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}}{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath())return this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],void this._openArray(this.streamingArray);this._openArray()},onopenobject:t=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof t<"u"&&this.parser.emit("onkey",t)}}),this.jsonPaths=void 0,this.streamingJsonPath=null,this.streamingArray=null,this.topLevelObject=null;const e=t.jsonpaths||[];this.jsonPaths=e.map((t=>new zc(t)))}write(t){super.write(t);let e=[];return this.streamingArray&&(e=[...this.streamingArray],this.streamingArray.length=0),e}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){const t=this.getJsonPath();if(0===this.jsonPaths.length)return!0;for(const e of this.jsonPaths)if(e.equals(t))return!0;return!1}}const Wc={x:0,y:1,z:2};function Yc(t,e={}){const{start:n=0,end:r=t.length,plane:i="xy"}=e,s=e.size||2;let o=0;const a=Wc[i[0]],c=Wc[i[1]];for(let e=n,i=r-s;e=e;a-=r)c=yh(a,t[a+h],t[a+l],c);return c&&dh(c,c.next)&&(Bh(c),c=c.next),c}function Zc(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!dh(r,r.next)&&0!==uh(r.prev,r,r.next))r=r.next;else{if(Bh(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function $c(t,e,n,r,i,s,o){if(!t)return;!o&&s&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=ah(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n,r,i,s,o,a,c,h=1;do{for(i=t,t=null,c=null,r=0;i;){for(r++,o=i,s=0,n=0;n0||a>0&&o;)0!==s&&(0===a||!o||i.z<=o.z)?(e=i,i=i.nextZ,s--):(e=o,o=o.nextZ,a--),c?c.nextZ=e:t=e,e.prevZ=c,c=e;i=o}c.nextZ=null,h*=2}while(r>1)}(i)}(t,r,i,s);let a,c,h=t;for(;t.prev!==t.next;)if(a=t.prev,c=t.next,s?eh(t,r,i,s):th(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Bh(t),t=c.next,h=c.next;else if((t=c)===h){o?1===o?$c(t=nh(Zc(t),e,n),e,n,r,i,s,2):2===o&&rh(t,e,n,r,i,s):$c(Zc(t),e,n,r,i,s,1);break}}function th(t){const e=t.prev,n=t,r=t.next;if(uh(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,c=n.y,h=r.y,l=is?i>o?i:o:s>o?s:o,f=a>c?a>h?a:h:c>h?c:h;let m=r.next;for(;m!==e;){if(m.x>=l&&m.x<=d&&m.y>=u&&m.y<=f&&hh(i,a,s,c,o,h,m.x,m.y)&&uh(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function eh(t,e,n,r){const i=t.prev,s=t,o=t.next;if(uh(i,s,o)>=0)return!1;const a=i.x,c=s.x,h=o.x,l=i.y,u=s.y,d=o.y,f=ac?a>h?a:h:c>h?c:h,g=l>u?l>d?l:d:u>d?u:d,A=ah(f,m,e,n,r),y=ah(p,g,e,n,r);let B=t.prevZ,b=t.nextZ;for(;B&&B.z>=A&&b&&b.z<=y;){if(B.x>=f&&B.x<=p&&B.y>=m&&B.y<=g&&B!==i&&B!==o&&hh(a,l,c,u,h,d,B.x,B.y)&&uh(B.prev,B,B.next)>=0||(B=B.prevZ,b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&hh(a,l,c,u,h,d,b.x,b.y)&&uh(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;B&&B.z>=A;){if(B.x>=f&&B.x<=p&&B.y>=m&&B.y<=g&&B!==i&&B!==o&&hh(a,l,c,u,h,d,B.x,B.y)&&uh(B.prev,B,B.next)>=0)return!1;B=B.prevZ}for(;b&&b.z<=y;){if(b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&hh(a,l,c,u,h,d,b.x,b.y)&&uh(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function nh(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!dh(i,s)&&fh(i,r,r.next,s)&&gh(i,s)&&gh(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Bh(r),Bh(r.next),r=t=s),r=r.next}while(r!==t);return Zc(r)}function rh(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&lh(o,t)){let a=Ah(o,t);return o=Zc(o,o.next),a=Zc(a,a.next),$c(o,e,n,r,i,s,0),void $c(a,e,n,r,i,s,0)}t=t.next}o=o.next}while(o!==t)}function ih(t,e){return t.x-e.x}function sh(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let s,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o&&(o=t,s=n.x=n.x&&n.x>=c&&r!==n.x&&hh(is.x||n.x===s.x&&oh(s,n)))&&(s=n,u=l)),n=n.next}while(n!==a);return s}(t,e);if(!n)return e;const r=Ah(n,t);return Zc(r,r.next),Zc(n,n.next)}function oh(t,e){return uh(t.prev,t,e.prev)<0&&uh(e.next,t,t.next)<0}function ah(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ch(t){let e=t,n=t;do{(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function lh(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&fh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(gh(t,e)&&gh(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(uh(t.prev,t,e.prev)||uh(t,e.prev,e))||dh(t,e)&&uh(t.prev,t,t.next)>0&&uh(e.prev,e,e.next)>0)}function uh(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function dh(t,e){return t.x===e.x&&t.y===e.y}function fh(t,e,n,r){const i=ph(uh(t,e,n)),s=ph(uh(t,e,r)),o=ph(uh(n,r,t)),a=ph(uh(n,r,e));return!!(i!==s&&o!==a||0===i&&mh(t,n,e)||0===s&&mh(t,r,e)||0===o&&mh(n,t,r)||0===a&&mh(n,e,r))}function mh(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ph(t){return t>0?1:t<0?-1:0}function gh(t,e){return uh(t.prev,t,t.next)<0?uh(t,e,t.next)>=0&&uh(t,t.prev,e)>=0:uh(t,e,t.prev)<0||uh(t,t.next,e)<0}function Ah(t,e){const n=new bh(t.i,t.x,t.y),r=new bh(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function yh(t,e,n,r){const i=new bh(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Bh(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}class bh{constructor(t,e,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=n}}function Ch(t,e,n){const r=function(t){const e={};for(const n of t)if(n.properties)for(const t in n.properties){const r=n.properties[t];e[t]=Ih(r,e[t])}return e}(t),i=Object.keys(r).filter((t=>r[t]!==Array));return function(t,e,n){const{pointPositionsCount:r,pointFeaturesCount:i,linePositionsCount:s,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:h,polygonRingsCount:l,polygonFeaturesCount:u,propArrayTypes:d,coordLength:f}=e,{numericPropKeys:m=[],PositionDataType:p=Float32Array,triangulate:g=!0}=n,A=t[0]&&"id"in t[0],y=t.length>65535?Uint32Array:Uint16Array,B={type:"Point",positions:new p(r*f),globalFeatureIds:new y(r),featureIds:i>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},b={type:"LineString",pathIndices:s>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new p(s*f),globalFeatureIds:new y(s),featureIds:a>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},C={type:"Polygon",polygonIndices:c>65535?new Uint32Array(h+1):new Uint16Array(h+1),primitivePolygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new p(c*f),globalFeatureIds:new y(c),featureIds:u>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};g&&(C.triangles=[]);for(const t of[B,b,C])for(const e of m){const n=d[e];t.numericProps[e]=new n(t.positions.length/f)}b.pathIndices[o]=s,C.polygonIndices[h]=c,C.primitivePolygonIndices[l]=c;const w={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(const e of t){const t=e.geometry,n=e.properties||{};switch(t.type){case"Point":wh(t,B,w,f,n),B.properties.push(Mh(n,m)),A&&B.fields.push({id:e.id}),w.pointFeature++;break;case"LineString":vh(t,b,w,f,n),b.properties.push(Mh(n,m)),A&&b.fields.push({id:e.id}),w.lineFeature++;break;case"Polygon":Eh(t,C,w,f,n),C.properties.push(Mh(n,m)),A&&C.fields.push({id:e.id}),w.polygonFeature++;break;default:throw new Error("Invalid geometry type")}w.feature++}return function(t,e,n,r){const i={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:r},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:_h(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:r},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:_h(e.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:_h(n.numericProps,1)}};return i.polygons&&n.triangles&&(i.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),i}(B,b,C,f)}(t,{propArrayTypes:r,...e},{numericPropKeys:n&&n.numericPropKeys||i,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:!n||n.triangulate})}function wh(t,e,n,r,i){e.positions.set(t.data,n.pointPosition*r);const s=t.data.length/r;xh(e,i,n.pointPosition,s),e.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+s),e.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+s),n.pointPosition+=s}function vh(t,e,n,r,i){e.positions.set(t.data,n.linePosition*r);const s=t.data.length/r;xh(e,i,n.linePosition,s),e.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+s),e.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+s);for(let i=0,s=t.indices.length;i80*n){d=l=t[0],f=u=t[1];for(let e=n;el&&(l=m),p>u&&(u=p);h=Math.max(l-d,u-f),h=0!==h?32767/h:0}return $c(a,c,n,d,f,h,0),c}(h,n.slice(1).map((t=>(t-l)/o)),o,e);for(let e=0,n=u.length;e0?Math.max(...l):2,pointPositionsCount:e,pointFeaturesCount:n,linePositionsCount:r,linePathsCount:i,lineFeaturesCount:s,polygonPositionsCount:o,polygonObjectsCount:a,polygonRingsCount:c,polygonFeaturesCount:h}}function Rh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{coordLength:2,fixRingWinding:!0};return t.map((t=>Gh(t,e)))}function Oh(t,e,n,r){n.push(e.length),e.push(...t);for(let n=t.length;nt.slice(0,2))).flat());const r=t<0;i.fixRingWinding&&(0===s&&!r||s>0&&r)&&(n.reverse(),t=-t),o.push(t),Fh(n,e,a,i),s++}s>0&&(r.push(o),n.push(a))}function Gh(t,e){const{geometry:n}=t;if("GeometryCollection"===n.type)throw new Error("GeometryCollection type not supported");const r=[],i=[];let s,o;switch(n.type){case"Point":o="Point",Oh(n.coordinates,r,i,e);break;case"MultiPoint":o="Point",n.coordinates.map((t=>Oh(t,r,i,e)));break;case"LineString":o="LineString",Fh(n.coordinates,r,i,e);break;case"MultiLineString":o="LineString",n.coordinates.map((t=>Fh(t,r,i,e)));break;case"Polygon":o="Polygon",s=[],Dh(n.coordinates,r,i,s,e);break;case"MultiPolygon":o="Polygon",s=[],n.coordinates.map((t=>Dh(t,r,i,s,e)));break;default:throw new Error(`Unknown type: ${o}`)}return{...t,geometry:{type:o,indices:i,data:r,areas:s}}}function Lh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fixRingWinding:!0,triangulate:!0};const n=Sh(t),r=n.coordLength,{fixRingWinding:i}=e,s=Rh(t,{coordLength:r,fixRingWinding:i});return Ch(s,n,{numericPropKeys:e.numericPropKeys,PositionDataType:e.PositionDataType||Float32Array,triangulate:e.triangulate})}const Uh={name:"GeoJSON",id:"geojson",module:"geojson",version:"4.1.4",worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"object-row-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}},parse:async function(t,e){return Nh((new TextDecoder).decode(t),e)},parseTextSync:Nh,parseInBatches:function(t,e){(e={...Uh.options,...e}).json={...Uh.options.geojson,...e.geojson};const n=async function*(t,e){const n=function(t){try{let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){const n=new TextDecoder(void 0,e);for await(const e of t)yield"string"==typeof e?e:n.decode(e,{stream:!0})}()}catch(t){return Promise.reject(t)}}(t),{metadata:r}=e,{jsonpaths:i}=e.json||{};let s=!0;const o=new Pc(null,e),a=new qc({jsonpaths:i});for await(const t of n){const n=a.write(t),i=n.length>0&&a.getStreamingJsonPathAsString();var c;n.length>0&&s&&(r&&(yield{shape:(null==e||null===(c=e.json)||void 0===c?void 0:c.shape)||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:a.getPartialResult(),jsonpath:i}),s=!1);for(const t of n){o.addRow(t);const e=o.getFullBatch({jsonpath:i});e&&(yield e)}o.chunkComplete(t);const h=o.getFullBatch({jsonpath:i});h&&(yield h)}const h=a.getStreamingJsonPathAsString(),l=o.getFinalBatch({jsonpath:h});l&&(yield l),r&&(yield{shape:"json",batchType:"final-result",container:a.getPartialResult(),jsonpath:a.getStreamingJsonPathAsString(),data:[],length:0})}(t,e);return"binary"===e.gis.format?async function*(t){for await(const e of t)e.data=Lh(e.data),yield e}(n):n}};function Nh(t,e){var n;let r;(e={...Uh.options,...e}).geojson={...Uh.options.geojson,...e.geojson},e.gis=e.gis||{};try{r=JSON.parse(t)}catch{r={}}const i={shape:"geojson-table",type:"FeatureCollection",features:(null===(n=r)||void 0===n?void 0:n.features)||[]};return"binary"===e.gis.format?Lh(i.features):i}function Ph(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const Hh={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class Jh{constructor(t={}){n(this,"props"),n(this,"stats"),n(this,"activeRequestCount",0),n(this,"requestQueue",[]),n(this,"requestMap",new Map),n(this,"updateTimer",null),this.props={...Hh,...t},this.stats=new V({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(t,e=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const n={handle:t,priority:0,getPriority:e},r=new Promise((t=>(n.resolve=t,n)));return this.requestQueue.push(n),this.requestMap.set(t,r),this._issueNewRequests(),r}_issueRequest(t){const{handle:e,resolve:n}=t;let r=!1;const i=()=>{r||(r=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:i}):Promise.resolve({done:i})}_issueNewRequests(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout((()=>this._issueNewRequestsAsync()),this.props.debounceTime)}_issueNewRequestsAsync(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=null;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let e=0;et.priority-e.priority))}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0&&(t.resolve(null),1))}}class jh{constructor(t,e,r){n(this,"item"),n(this,"previous"),n(this,"next"),this.item=t,this.previous=e,this.next=r}}class kh{constructor(){n(this,"head",null),n(this,"tail",null),n(this,"_length",0)}get length(){return this._length}add(t){const e=new jh(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),++this._length,e}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,e){t!==e&&(this.remove(e),this._insert(t,e))}_insert(t,e){const n=t.next;t.next=e,this.tail===t?this.tail=e:n.previous=e,e.next=n,e.previous=t,++this._length}}class Vh{constructor(){n(this,"_list"),n(this,"_sentinel"),n(this,"_trimTiles"),this._list=new kh,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){const e=t._cacheNode;e&&this._list.splice(this._sentinel,e)}add(t,e,n){e._cacheNode||(e._cacheNode=this._list.add(e),n&&n(t,e))}unloadTile(t,e,n){const r=e._cacheNode;r&&(this._list.remove(r),e._cacheNode=null,n&&n(t,e))}unloadTiles(t,e){const n=this._trimTiles;this._trimTiles=!1;const r=this._list,i=1024*t.maximumMemoryUsage*1024,s=this._sentinel;let o=r.head;for(;o!==s&&(t.gpuMemoryUsageInBytes>i||n);){const n=o.item;o=o.next,this.unloadTile(t,n,e)}}trim(){this._trimTiles=!0}}const Kh=new Qe,Qh=new Qe,zh=new ir([new tr,new tr,new tr,new tr,new tr,new tr]);function qh(t,e){const{cameraDirection:n,cameraUp:r,height:i}=t,{metersPerUnit:s}=t.distanceScales,o=Yh(t,t.center),a=Hn.WGS84.eastNorthUpToFixedFrame(o),c=t.unprojectPosition(t.cameraPosition),h=Hn.WGS84.cartographicToCartesian(c,new Qe),l=new Qe(a.transformAsVector(new Qe(n).scale(s))).normalize(),u=new Qe(a.transformAsVector(new Qe(r).scale(s))).normalize();!function(t){const e=t.getFrustumPlanes(),n=Wh(e.near,t.cameraPosition),r=Yh(t,n),i=Yh(t,t.cameraPosition,Qh);let s=0;zh.planes[s++].fromPointNormal(r,Kh.copy(r).subtract(i));for(const i in e){if("near"===i)continue;const o=Yh(t,Wh(e[i],n,Qh),Qh);zh.planes[s++].fromPointNormal(o,Kh.copy(r).subtract(o))}}(t);const d=t.constructor,{longitude:f,latitude:m,width:p,bearing:g,zoom:A}=t;return{camera:{position:h,direction:l,up:u},viewport:t,topDownViewport:new d({longitude:f,latitude:m,height:i,width:p,bearing:g,zoom:A,pitch:0}),height:i,cullingVolume:zh,frameNumber:e,sseDenominator:1.15}}function Wh(t,e,n=new Qe){const r=t.normal.dot(e);return n.copy(t.normal).scale(t.distance-r).add(e),n}function Yh(t,e,n=new Qe){const r=t.unprojectPosition(e);return Hn.WGS84.cartographicToCartesian(r,n)}const Xh=6356752.314245179,Zh=new Qe;function $h(t,e,n){Hn.WGS84.cartographicToCartesian([t.xmax,t.ymax,t.zmax],Zh);const r=Math.sqrt(Math.pow(Zh[0]-n[0],2)+Math.pow(Zh[1]-n[1],2)+Math.pow(Zh[2]-n[2],2));return Math.log2(Xh/(r+e[2]))}var tl,el,nl,rl;!function(t){t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE"}(tl||(tl={})),function(t){t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh"}(el||(el={})),function(t){t.I3S="I3S",t.TILES3D="TILES3D"}(nl||(nl={})),function(t){t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold"}(rl||(rl={}));function il(t){return null!=t}const sl=new Qe,ol=new Qe,al=new Qe,cl=new Qe,hl=new Qe,ll=new Qe,ul=new Qe,dl=new Qe;function fl(t,e,n){if(Ph(t,"3D Tile: boundingVolume must be defined"),t.box)return ml(t.box,e,n);if(t.region)return function(t){const[e,n,r,i,s,o]=t,a=Hn.WGS84.cartographicToCartesian([Ae(e),Ae(i),s],al),c=Hn.WGS84.cartographicToCartesian([Ae(r),Ae(n),o],cl),h=(new Qe).addVectors(a,c).multiplyByScalar(.5);return Hn.WGS84.cartesianToCartographic(h,hl),Hn.WGS84.cartographicToCartesian([Ae(r),hl[1],hl[2]],ll),Hn.WGS84.cartographicToCartesian([hl[0],Ae(i),hl[2]],ul),Hn.WGS84.cartographicToCartesian([hl[0],hl[1],o],dl),ml([...h,...ll.subtract(h),...ul.subtract(h),...dl.subtract(h)],new ln)}(t.region);if(t.sphere)return function(t,e,n){const r=new Qe(t[0],t[1],t[2]);e.transform(r,r);const i=e.getScale(ol),s=Math.max(Math.max(i[0],i[1]),i[2]),o=t[3]*s;return il(n)?(n.center=r,n.radius=o,n):new kn(r,o)}(t.sphere,e,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function ml(t,e,n){const r=new Qe(t[0],t[1],t[2]);e.transform(r,r);let i=[];if(10===t.length){const e=t.slice(3,6),n=new Bn;n.fromArray(t,6);const r=new Qe([1,0,0]),s=new Qe([0,1,0]),o=new Qe([0,0,1]);r.transformByQuaternion(n),r.scale(e[0]),s.transformByQuaternion(n),s.scale(e[1]),o.transformByQuaternion(n),o.scale(e[2]),i=[...r.toArray(),...s.toArray(),...o.toArray()]}else i=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];const s=e.transformAsVector(i.slice(0,3)),o=e.transformAsVector(i.slice(3,6)),a=e.transformAsVector(i.slice(6,9)),c=new $e([s[0],s[1],s[2],o[0],o[1],o[2],a[0],a[1],a[2]]);return il(n)?(n.center=r,n.halfAxes=c,n):new Xn(r,c)}function pl(t,e){Hn.WGS84.cartesianToCartographic(e,sl),t[0][0]=Math.min(t[0][0],sl[0]),t[0][1]=Math.min(t[0][1],sl[1]),t[0][2]=Math.min(t[0][2],sl[2]),t[1][0]=Math.max(t[1][0],sl[0]),t[1][1]=Math.max(t[1][1],sl[1]),t[1][2]=Math.max(t[1][2],sl[2])}new Qe,new Qe,new ln,new Qe,new Qe,new Qe;const gl=new Qe,Al=new Qe,yl=new Qe,Bl=new Qe,bl=new Qe,Cl=new ln,wl=new ln;function vl(t,e){const{topDownViewport:n}=e,r=t.header.mbs[1],i=t.header.mbs[0],s=t.header.mbs[2],o=t.header.mbs[3],a=[...t.boundingVolume.center],c=n.unprojectPosition(n.cameraPosition);Hn.WGS84.cartographicToCartesian(c,gl),Al.copy(gl).subtract(a).normalize(),Hn.WGS84.eastNorthUpToFixedFrame(a,Cl),wl.copy(Cl).invert(),yl.copy(gl).transform(wl);const h=Math.sqrt(yl[0]*yl[0]+yl[1]*yl[1]),l=h*h/yl[2];Bl.copy([yl[0],yl[1],l]);const u=Bl.transform(Cl).subtract(a).normalize(),d=Al.cross(u).normalize().scale(o).add(a),f=Hn.WGS84.cartesianToCartographic(d),m=n.project([i,r,s]),p=n.project(f);return bl.copy(m).subtract(p).magnitude()}class El{constructor(t=0){n(this,"_map",new Map),n(this,"_array"),n(this,"_length"),this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return Ph(t=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=e,this._map.set(e,t)}delete(t){const e=this._map.get(t);e>=0&&(this._array.splice(e,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){const e=this.length++;this._array[e]=t,this._map.set(t,e)}}pop(){const t=this._array[--this.length];return this._map.delete(t),t}reserve(t){Ph(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){Ph(t>=0),this.length=t}trim(t){null==t&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}}const Tl={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class _l{constructor(t){n(this,"options"),n(this,"root",null),n(this,"selectedTiles",{}),n(this,"requestedTiles",{}),n(this,"emptyTiles",{}),n(this,"lastUpdate",(new Date).getTime()),n(this,"updateDebounceTime",1e3),n(this,"_traversalStack",new El),n(this,"_emptyTraversalStack",new El),n(this,"_frameNumber",null),this.options={...Tl,...t}}traversalFinished(t){return!0}traverse(t,e,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,e),this._frameNumber=e.frameNumber,this.executeTraversal(t,e)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,e){const n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){const t=n.pop();let r=!1;this.canTraverse(t,e)&&(this.updateChildTiles(t,e),r=this.updateAndPushChildren(t,e,n,t.hasRenderContent?t._selectionDepth+1:t._selectionDepth));const i=t.parent,s=!(i&&!i._shouldRefine),o=!r;t.hasRenderContent?t.refine===tl.ADD?(this.loadTile(t,e),this.selectTile(t,e)):t.refine===tl.REPLACE&&(this.loadTile(t,e),o&&this.selectTile(t,e)):(this.emptyTiles[t.id]=t,this.loadTile(t,e),o&&this.selectTile(t,e)),this.touchTile(t,e),t._shouldRefine=r&&s}const r=(new Date).getTime();(this.traversalFinished(e)||r-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=r,this.options.onTraversalEnd(e))}updateChildTiles(t,e){const n=t.children;for(const t of n)this.updateTile(t,e)}updateAndPushChildren(t,e,n,r){const{loadSiblings:i,skipLevelOfDetail:s}=this.options,o=t.children;o.sort(this.compareDistanceToCamera.bind(this));const a=t.refine===tl.REPLACE&&t.hasRenderContent&&!s;let c=!1,h=!0;for(const t of o)if(t._selectionDepth=r,t.isVisibleAndInRequestVolume?(n.find(t)&&n.delete(t),n.push(t),c=!0):(a||i)&&(this.loadTile(t,e),this.touchTile(t,e)),a){let n;if(n=!!t._inRequestVolume&&(t.hasRenderContent?t.contentAvailable:this.executeEmptyTraversal(t,e)),h=h&&n,!h)return!1}return c||(h=!1),h}updateTile(t,e){this.updateTileVisibility(t,e)}selectTile(t,e){this.shouldSelectTile(t)&&(t._selectedFrame=e.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,e){this.shouldLoadTile(t)&&(t._requestedFrame=e.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,e){t.tileset._cache.touch(t),t._touchedFrame=e.frameNumber}canTraverse(t,e){return!!t.hasChildren&&(t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,e))}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,e,n=!1){let r=t._screenSpaceError;return n&&(r=t.getScreenSpaceError(e,!0)),r>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,e){const n=[];if(this.options.viewportTraversersMap)for(const t in this.options.viewportTraversersMap)this.options.viewportTraversersMap[t]===e.viewport.id&&n.push(t);else n.push(e.viewport.id);t.updateVisibility(e,n)}compareDistanceToCamera(t,e){return t._distanceToCamera-e._distanceToCamera}anyChildrenVisible(t,e){let n=!1;for(const r of t.children)r.updateVisibility(e),n=n||r.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,e){let n=!0;const r=this._emptyTraversalStack;for(r.push(t);r.length>0;){const t=r.pop(),i=!t.hasRenderContent&&this.canTraverse(t,e),s=!t.hasRenderContent&&0===t.children.length;if(!i&&!t.contentAvailable&&!s&&(n=!1),this.updateTile(t,e),t.isVisibleAndInRequestVolume||(this.loadTile(t,e),this.touchTile(t,e)),i){const e=t.children;for(const t of e)r.push(t)}}return n}}const xl=new Qe;class Ml{constructor(t,e,r,i=""){n(this,"tileset"),n(this,"header"),n(this,"id"),n(this,"url"),n(this,"parent"),n(this,"refine"),n(this,"type"),n(this,"contentUrl"),n(this,"lodMetricType","geometricError"),n(this,"lodMetricValue",0),n(this,"boundingVolume",null),n(this,"content",null),n(this,"contentState",0),n(this,"gpuMemoryUsageInBytes",0),n(this,"children",[]),n(this,"depth",0),n(this,"viewportIds",[]),n(this,"transform",new ln),n(this,"extensions",null),n(this,"implicitTiling",null),n(this,"userData",{}),n(this,"computedTransform"),n(this,"hasEmptyContent",!1),n(this,"hasTilesetContent",!1),n(this,"traverser",new _l({})),n(this,"_cacheNode",null),n(this,"_frameNumber",null),n(this,"_expireDate",null),n(this,"_expiredContent",null),n(this,"_boundingBox"),n(this,"_distanceToCamera",0),n(this,"_screenSpaceError",0),n(this,"_visibilityPlaneMask"),n(this,"_visible"),n(this,"_contentBoundingVolume"),n(this,"_viewerRequestVolume"),n(this,"_initialTransform",new ln),n(this,"_priority",0),n(this,"_selectedFrame",0),n(this,"_requestedFrame",0),n(this,"_selectionDepth",0),n(this,"_touchedFrame",0),n(this,"_centerZDepth",0),n(this,"_shouldRefine",!1),n(this,"_stackLength",0),n(this,"_visitedFrame",0),n(this,"_inRequestVolume",!1),n(this,"_lodJudge",null),this.header=e,this.tileset=t,this.id=i||e.id,this.url=e.url,this.parent=r,this.refine=this._getRefine(e.refine),this.type=e.type,this.contentUrl=e.contentUrl,this._initializeLodMetric(e),this._initializeTransforms(e),this._initializeBoundingVolumes(e),this._initializeContent(e),this._initializeRenderingState(e),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return 3===this.contentState||this.hasEmptyContent}get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return 0===this.contentState}get contentExpired(){return 4===this.contentState}get contentFailed(){return 5===this.contentState}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=function(t,e){if(t.box)return function(t){const e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],{halfAxes:n}=t,r=new Qe(n.getColumn(0)),i=new Qe(n.getColumn(1)),s=new Qe(n.getColumn(2));for(let n=0;n<2;n++){for(let n=0;n<2;n++){for(let n=0;n<2;n++)sl.copy(t.center),sl.add(r),sl.add(i),sl.add(s),pl(e,sl),s.negate();i.negate()}r.negate()}return e}(e);if(t.region){const[e,n,r,i,s,o]=t.region;return[[Ae(e),Ae(n),s],[Ae(r),Ae(i),o]]}if(t.sphere)return function(t){const e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],{center:n,radius:r}=t,i=Hn.WGS84.scaleToGeodeticSurface(n,sl);let s;s=i?Hn.WGS84.geodeticSurfaceNormal(i):new Qe(0,0,1);let o=new Qe(s[2],-s[1],0);o.len()>0?o.normalize():o=new Qe(0,1,0);const a=o.clone().cross(s);for(const t of[o,a,s]){ol.copy(t).scale(r);for(let t=0;t<2;t++)sl.copy(n),sl.add(ol),pl(e,sl),ol.negate()}return e}(e);throw new Error("Unkown boundingVolume type")}(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,e){switch(this.tileset.type){case nl.I3S:return vl(this,t);case nl.TILES3D:return function(t,e,n){const r=t.tileset,i=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,s=n?i:t.lodMetricValue;if(0===s)return 0;const o=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:c}=e,{viewDistanceScale:h}=r.options;let l=s*a*(h||1)/(o*c);return l-=function(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){const n=t.dynamicScreenSpaceErrorComputedDensity,r=t.dynamicScreenSpaceErrorFactor;return function(t,e){const n=t*e;return 1-Math.exp(-n*n)}(e,n)*r}return 0}(r,o),l}(this,t,e);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){const t=this.tileset._traverser,{skipLevelOfDetail:e}=t.options,n=this.refine===tl.ADD||e;if(n&&!this.isVisible&&void 0!==this._visible||this.tileset._frameNumber-this._touchedFrame>=1||0===this.contentState)return-1;const r=this.parent,i=!r||n&&0!==this._screenSpaceError&&!r.hasTilesetContent?this._screenSpaceError:r._screenSpaceError,s=t.root?t.root._screenSpaceError:0;return Math.max(s-i,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=1;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=0,!1;try{const e=this.tileset.getTileUrl(this.contentUrl),n=this.tileset.loader,r={...this.tileset.loadOptions,[n.id]:{...this.tileset.loadOptions[n.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(n.id)}};return this.content=await he(e,n,r),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=3,this._onContentLoaded(),!0}catch(t){throw this.contentState=5,t}finally{t.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=0,!0}updateVisibility(t,e){if(this._frameNumber===t.frameNumber)return;const n=this.parent,r=n?n._visibilityPlaneMask:ir.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const t=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(t)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,r),this._visible=this._visibilityPlaneMask!==ir.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=e}visibility(t,e){const{cullingVolume:n}=t,{boundingVolume:r}=this;return n.computeVisibilityWithPlaneMask(r,e)}contentVisibility(){return!0}distanceToTile(t){const e=this.boundingVolume;return Math.sqrt(Math.max(e.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){const e=this.boundingVolume;return xl.subVectors(e.center,t.position),t.direction.dot(xl)}insideViewerRequestVolume(t){const e=this._viewerRequestVolume;return!e||e.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(function(t){return null!=t}(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){const t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=4,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new ln(t.transform):new ln;const e=this.parent,n=this.tileset,r=e&&e.computedTransform?e.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new ln(r).multiplyRight(this.transform);const i=e&&e._initialTransform?e._initialTransform.clone():new ln;this._initialTransform=new ln(i).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=0,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ir.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||tl.REPLACE}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=fl(t.boundingVolume,this.computedTransform,this.boundingVolume);const e=t.content;e&&(e.boundingVolume&&(this._contentBoundingVolume=fl(e.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=fl(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new ln){const e=t.clone().multiplyRight(this.transform);e.equals(this.computedTransform)||(this.computedTransform=e,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){return"i3s"===t?{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1}:function(t){return{assetGltfUpAxis:t.asset&&t.asset.gltfUpAxis||"Y"}}(this.tileset.tileset)}}class Il extends _l{compareDistanceToCamera(t,e){return 0===e._distanceToCamera&&0===t._distanceToCamera?e._centerZDepth-t._centerZDepth:e._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,e){if(super.updateTileVisibility(t,e),!t.isVisibleAndInRequestVolume)return;const n=t.children.length>0;if(t.hasTilesetContent&&n){const n=t.children[0];return this.updateTileVisibility(n,e),void(t._visible=n._visible)}if(this.meetsScreenSpaceErrorEarly(t,e))return void(t._visible=!1);const r=t.refine===tl.REPLACE,i=1===t._optimChildrenWithinParent;r&&i&&n&&!this.anyChildrenVisible(t,e)&&(t._visible=!1)}meetsScreenSpaceErrorEarly(t,e){const{parent:n}=t;return!(!n||n.hasTilesetContent||n.refine!==tl.ADD||this.shouldRefine(t,e,!0))}}class Sl{constructor(){n(this,"frameNumberMap",new Map)}register(t,e){const n=this.frameNumberMap.get(t)||new Map,r=n.get(e)||0;n.set(e,r+1),this.frameNumberMap.set(t,n)}deregister(t,e){const n=this.frameNumberMap.get(t);if(!n)return;const r=n.get(e)||1;n.set(e,r-1)}isZero(t,e){var n;return 0===((null==(n=this.frameNumberMap.get(t))?void 0:n.get(e))||0)}}class Rl{constructor(){n(this,"_statusMap"),n(this,"pendingTilesRegister",new Sl),this._statusMap={}}add(t,e,n,r){if(!this._statusMap[e]){const{frameNumber:i,viewport:{id:s}}=r;this._statusMap[e]={request:t,callback:n,key:e,frameState:r,status:"REQUESTED"},this.pendingTilesRegister.register(s,i),t().then((t=>{this._statusMap[e].status="COMPLETED";const{frameNumber:n,viewport:{id:i}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(i,n),this._statusMap[e].callback(t,r)})).catch((t=>{this._statusMap[e].status="ERROR";const{frameNumber:r,viewport:{id:i}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(i,r),n(t)}))}}update(t,e){if(this._statusMap[t]){const{frameNumber:n,viewport:{id:r}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(r,n);const{frameNumber:i,viewport:{id:s}}=e;this.pendingTilesRegister.register(s,i),this._statusMap[t].frameState=e}}find(t){return this._statusMap[t]}hasPendingTiles(t,e){return!this.pendingTilesRegister.isZero(t,e)}}class Ol extends _l{constructor(t){super(t),n(this,"_tileManager"),this._tileManager=new Rl}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,e){return t._lodJudge=function(t,e){if(0===t.lodMetricValue||isNaN(t.lodMetricValue))return"DIG";const n=2*vl(t,e);return n<2?"OUT":!t.header.children||n<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}(t,e),"DIG"===t._lodJudge}updateChildTiles(t,e){const n=t.header.children||[],r=t.children,i=t.tileset;for(const s of n){const n=`${s.id}-${e.viewport.id}`,o=r&&r.find((t=>t.id===n));if(o)o&&this.updateTile(o,e);else{let r=()=>this._loadTile(s.id,i);this._tileManager.find(n)?this._tileManager.update(n,e):(i.tileset.nodePages&&(r=()=>i.tileset.nodePagesTile.formTileFromNodePages(s.id)),this._tileManager.add(r,n,(e=>this._onTileLoad(e,t,n)),e))}}return!1}async _loadTile(t,e){const{loader:n}=e,r=e.getTileUrl(`${e.url}/nodes/${t}`),i={...e.loadOptions,i3s:{...e.loadOptions.i3s,isTileHeader:!0}};return await he(r,n,i)}_onTileLoad(t,e,n){const r=new Ml(e.tileset,t,e,n);e.children.push(r);const i=this._tileManager.find(r.id).frameState;this.updateTile(r,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||(new Date).getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(r,i)}}const Fl={description:"",ellipsoid:Hn.WGS84,modelMatrix:new ln,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Dl="Tiles In Tileset(s)",Gl="Tiles In Memory",Ll="Tiles In View",Ul="Tiles To Render",Nl="Tiles Loaded",Pl="Tiles Loading",Hl="Tiles Unloaded",Jl="Failed Tile Loads",jl="Points/Vertices",kl="Tile Memory Use",Vl="Maximum Screen Space Error";class Kl{constructor(t,e){n(this,"options"),n(this,"loadOptions"),n(this,"type"),n(this,"tileset"),n(this,"loader"),n(this,"url"),n(this,"basePath"),n(this,"modelMatrix"),n(this,"ellipsoid"),n(this,"lodMetricType"),n(this,"lodMetricValue"),n(this,"refine"),n(this,"root",null),n(this,"roots",{}),n(this,"asset",{}),n(this,"description",""),n(this,"properties"),n(this,"extras",null),n(this,"attributions",{}),n(this,"credits",{}),n(this,"stats"),n(this,"contentFormats",{draco:!1,meshopt:!1,dds:!1,ktx2:!1}),n(this,"cartographicCenter",null),n(this,"cartesianCenter",null),n(this,"zoom",1),n(this,"boundingVolume",null),n(this,"dynamicScreenSpaceErrorComputedDensity",0),n(this,"maximumMemoryUsage",32),n(this,"gpuMemoryUsageInBytes",0),n(this,"memoryAdjustedScreenSpaceError",0),n(this,"_cacheBytes",0),n(this,"_cacheOverflowBytes",0),n(this,"_frameNumber",0),n(this,"_queryParams",{}),n(this,"_extensionsUsed",[]),n(this,"_tiles",{}),n(this,"_pendingCount",0),n(this,"selectedTiles",[]),n(this,"traverseCounter",0),n(this,"geometricError",0),n(this,"lastUpdatedVieports",null),n(this,"_requestedTiles",[]),n(this,"_emptyTiles",[]),n(this,"frameStateData",{}),n(this,"_traverser"),n(this,"_cache",new Vh),n(this,"_requestScheduler"),n(this,"updatePromise",null),n(this,"tilesetInitializationPromise"),this.options={...Fl,...e},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||function(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new Jh({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=1024*this.options.maximumMemoryUsage*1024,this._cacheOverflowBytes=1024*this.options.memoryCacheOverflow*1024,this.stats=new V({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber&&0===this._requestedTiles.length}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let e=t;return this.queryParams.length&&(e=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),e}hasExtension(t){return this._extensionsUsed.indexOf(t)>-1}update(t=null){this.tilesetInitializationPromise.then((()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)}))}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise((t=>{setTimeout((()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),t(this._frameNumber),this.updatePromise=null}),this.options.debounceTime)}))),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytesthis._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;const e=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=e.length;const n=[];for(const t of e){const e=t.id;this._needTraverse(e)?n.push(e):this.traverseCounter--}for(const t of e){const e=t.id;if(this.roots[e]||(this.roots[e]=this._initializeTileHeaders(this.tileset,null)),!n.includes(e))continue;const r=qh(t,this._frameNumber);this._traverser.traverse(this.roots[e],r,this.options)}}_needTraverse(t){let e=t;return this.options.viewportTraversersMap&&(e=this.options.viewportTraversersMap[t]),e===t}_onTraversalEnd(t){const e=t.viewport.id;this.frameStateData[e]||(this.frameStateData[e]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const n=this.frameStateData[e],r=Object.values(this._traverser.selectedTiles),[i,s]=function(t,e,n){if(0===n||t.length<=n)return[t,[]];const r=[],{longitude:i,latitude:s}=e.viewport;for(const[e,n]of t.entries()){const[t,o]=n.header.mbs,a=Math.abs(i-t),c=Math.abs(s-o),h=Math.sqrt(c*c+a*a);r.push([e,h])}const o=r.sort(((t,e)=>t[1]-e[1])),a=[];for(let e=0;e0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const t in this.frameStateData){const e=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(e.selectedTiles),this._requestedTiles=this._requestedTiles.concat(e._requestedTiles),this._emptyTiles=this._emptyTiles.concat(e._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,e){if(t.length!==e.length)return!0;const n=new Set(t.map((t=>t.id))),r=new Set(e.map((t=>t.id)));let i=t.filter((t=>!r.has(t.id))).length>0;return i=i||e.filter((t=>!n.has(t.id))).length>0,i}_loadTiles(){for(const t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,((t,e)=>t._unloadTile(e)))}_updateStats(){let t=0,e=0;for(const n of this.selectedTiles)n.contentAvailable&&n.content&&(t++,n.content.pointCount?e+=n.content.pointCount:e+=n.content.vertexCount);this.stats.get(Ll).count=this.selectedTiles.length,this.stats.get(Ul).count=t,this.stats.get(jl).count=e,this.stats.get(Vl).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===nl.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===nl.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===nl.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var t;const e=this.tileset.fullExtent;if(e){const{xmin:t,xmax:n,ymin:r,ymax:i,zmin:s,zmax:o}=e;return this.cartographicCenter=new Qe(t+(n-t)/2,r+(i-r)/2,s+(o-s)/2),this.cartesianCenter=new Qe,Hn.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),void(this.zoom=$h(e,this.cartographicCenter,this.cartesianCenter))}const n=null==(t=this.tileset.store)?void 0:t.extent;if(n){const[t,e,r,i]=n;return this.cartographicCenter=new Qe(t+(r-t)/2,e+(i-e)/2,0),this.cartesianCenter=new Qe,Hn.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),void(this.zoom=function(t,e,n){const[r,i,s,o]=t;return $h({xmin:r,xmax:s,ymin:i,ymax:o,zmin:0,zmax:0},e,n)}(n,this.cartographicCenter,this.cartesianCenter))}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new Qe,this.zoom=1}calculateViewPropsTiles3D(){const t=this.root,{center:e}=t.boundingVolume;if(!e)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Qe,void(this.zoom=1);0!==e[0]||0!==e[1]||0!==e[2]?(this.cartographicCenter=new Qe,Hn.WGS84.cartesianToCartographic(e,this.cartographicCenter)):this.cartographicCenter=new Qe(0,0,-Hn.WGS84.radii[0]),this.cartesianCenter=e,this.zoom=function(t,e){if(t instanceof Xn){const{halfAxes:n}=t,r=function(t){t.getColumn(0,Zh);const e=t.getColumn(1),n=t.getColumn(2);return Zh.add(e).add(n).len()}(n);return Math.log2(Xh/(r+e[2]))}if(t instanceof kn){const{radius:n}=t;return Math.log2(Xh/(n+e[2]))}if(t.width&&t.height){const{width:e,height:n}=t;return(Math.log2(6378137/e)+Math.log2(6378137/n))/2}return 1}(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Dl),this.stats.get(Pl),this.stats.get(Gl),this.stats.get(Ll),this.stats.get(Ul),this.stats.get(Nl),this.stats.get(Hl),this.stats.get(Jl),this.stats.get(jl),this.stats.get(kl,"memory"),this.stats.get(Vl)}_initializeTileHeaders(t,e){var n;const r=new Ml(this,t.root,e);if(e&&(e.children.push(r),r.depth=e.depth+1),this.type===nl.TILES3D){const t=[];for(t.push(r);t.length>0;){const e=t.pop();this.stats.get(Dl).incrementCount();const r=e.header.children||[];for(const i of r){const r=new Ml(this,i,e);if(null!=(n=r.contentUrl)&&n.includes("?session=")){const t=new URL(r.contentUrl).searchParams.get("session");t&&(this._queryParams.session=t)}e.children.push(r),r.depth=e.depth+1,t.push(r)}}}return r}_initializeTraverser(){let t;switch(this.type){case nl.TILES3D:t=Il;break;case nl.I3S:t=Ol;break;default:t=_l}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let e;try{this._onStartTileLoading(),e=await t.loadContent()}catch(e){this._onTileLoadError(t,e instanceof Error?e:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,e)}}_onTileLoadError(t,e){this.stats.get(Jl).incrementCount();const n=e.message||e.toString(),r=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,r)}_onTileLoad(t,e){var n,r;if(e){if(this.type===nl.I3S){const t=(null==(r=null==(n=this.tileset)?void 0:n.nodePagesTile)?void 0:r.nodesInNodePages)||0;this.stats.get(Dl).reset(),this.stats.get(Dl).addCount(t)}t&&t.content&&function(t,e){Ph(t),Ph(e);const{rtcCenter:n,gltfUpAxis:r}=e,{computedTransform:i,boundingVolume:{center:s}}=t;let o=new ln(i);switch(n&&o.translate(n),r){case"Z":break;case"Y":const t=(new ln).rotateX(Math.PI/2);o=o.multiplyRight(t);break;case"X":const e=(new ln).rotateY(-Math.PI/2);o=o.multiplyRight(e)}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const a=new Qe(s);e.cartesianModelMatrix=o,e.cartesianOrigin=a;const c=Hn.WGS84.cartesianToCartographic(a,new Qe),h=Hn.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=h.multiplyRight(o),e.cartographicOrigin=c,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){var e;if(this.type===nl.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0}else if(this.type===nl.TILES3D){const{extensionsRemoved:n=[]}=(null==(e=t.content)?void 0:e.gltf)||{};n.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),n.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),n.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Pl).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Pl).decrementCount()}_addTileToCache(t){this._cache.add(this,t,(e=>e._updateCacheStats(t)))}_updateCacheStats(t){this.stats.get(Nl).incrementCount(),this.stats.get(Gl).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(kl).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Gl).decrementCount(),this.stats.get(Hl).incrementCount(),this.stats.get(kl).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){const t=[];for(this.root&&t.push(this.root);t.length>0;){const e=t.pop();for(const n of e.children)t.push(n);this._destroyTile(e)}this.root=null}_destroySubtree(t){const e=t,n=[];for(n.push(e);n.length>0;){t=n.pop();for(const e of t.children)n.push(e);t!==e&&this._destroyTile(t)}e.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){const e=new URLSearchParams(t.queryString),n=Object.fromEntries(e.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version&&"1.1"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}function Ql(e){const n=document.createElement("canvas");n.width=64,n.height=64;const r=n.getContext("2d");r.rect(0,0,64,64);const i=r.createLinearGradient(0,0,64,64);for(let t=0;tt.toString(),ru=new t.ShaderMaterial({vertexShader:nu` varying vec3 vPosition; void main() { vPosition = (modelMatrix * vec4(position, 1.0)).xyz; @@ -90,4 +90,4 @@ void main() { gl_FragColor = vec4(vColor, opacity); } -`,ou=new t.ShaderMaterial({vertexShader:iu,fragmentShader:su,uniforms:{tPosition:{value:null},minHeight:{value:0},maxHeight:{value:300},opacity:{value:.5},samples:{value:4},sampleStep:{value:4}},vertexColors:!0,transparent:!0,depthTest:!1,blending:t.NormalBlending}),au={SPECTRAL:[[0,new t.Color(.3686,.3098,.6353)],[.1,new t.Color(.1961,.5333,.7412)],[.2,new t.Color(.4,.7608,.6471)],[.3,new t.Color(.6706,.8667,.6431)],[.4,new t.Color(.902,.9608,.5961)],[.5,new t.Color(1,1,.749)],[.6,new t.Color(.9961,.8784,.5451)],[.7,new t.Color(.9922,.6824,.3804)],[.8,new t.Color(.9569,.4275,.2627)],[.9,new t.Color(.8353,.2431,.3098)],[1,new t.Color(.6196,.0039,.2588)]],PLASMA:[[0,new t.Color(.241,.015,.61)],[.1,new t.Color(.387,.001,.654)],[.2,new t.Color(.524,.025,.653)],[.3,new t.Color(.651,.125,.596)],[.4,new t.Color(.752,.227,.513)],[.5,new t.Color(.837,.329,.431)],[.6,new t.Color(.907,.435,.353)],[.7,new t.Color(.963,.554,.272)],[.8,new t.Color(.992,.681,.195)],[.9,new t.Color(.987,.822,.144)],[1,new t.Color(.94,.975,.131)]],YELLOW_GREEN:[[0,new t.Color(.1647,.2824,.3451)],[.1,new t.Color(.1338,.3555,.4227)],[.2,new t.Color(.061,.4319,.4864)],[.3,new t.Color(0,.5099,.5319)],[.4,new t.Color(0,.5881,.5569)],[.5,new t.Color(.137,.665,.5614)],[.6,new t.Color(.2906,.7395,.5477)],[.7,new t.Color(.4453,.8099,.5201)],[.8,new t.Color(.6102,.8748,.485)],[.9,new t.Color(.7883,.9323,.4514)],[1,new t.Color(.9804,.9804,.4314)]],VIRIDIS:[[0,new t.Color(.267,.005,.329)],[.1,new t.Color(.283,.141,.458)],[.2,new t.Color(.254,.265,.53)],[.3,new t.Color(.207,.372,.553)],[.4,new t.Color(.164,.471,.558)],[.5,new t.Color(.128,.567,.551)],[.6,new t.Color(.135,.659,.518)],[.7,new t.Color(.267,.749,.441)],[.8,new t.Color(.478,.821,.318)],[.9,new t.Color(.741,.873,.15)],[1,new t.Color(.993,.906,.144)]],INFERNO:[[0,new t.Color(.077,.042,.206)],[.1,new t.Color(.225,.036,.388)],[.2,new t.Color(.373,.074,.432)],[.3,new t.Color(.522,.128,.42)],[.4,new t.Color(.665,.182,.37)],[.5,new t.Color(.797,.255,.287)],[.6,new t.Color(.902,.364,.184)],[.7,new t.Color(.969,.516,.063)],[.8,new t.Color(.988,.683,.072)],[.9,new t.Color(.961,.859,.298)],[1,new t.Color(.988,.998,.645)]],GRAYSCALE:[[0,new t.Color(0,0,0)],[1,new t.Color(1,1,1)]],TURBO:[[0,new t.Color(.18995,.07176,.23217)],[.07,new t.Color(.25107,.25237,.63374)],[.13,new t.Color(.27628,.42118,.89123)],[.2,new t.Color(.25862,.57958,.99876)],[.27,new t.Color(.15844,.73551,.92305)],[.33,new t.Color(.09267,.86554,.7623)],[.4,new t.Color(.19659,.94901,.59466)],[.47,new t.Color(.42778,.99419,.38575)],[.53,new t.Color(.64362,.98999,.23356)],[.6,new t.Color(.80473,.92452,.20459)],[.67,new t.Color(.93301,.81236,.22667)],[.73,new t.Color(.99314,.67408,.20348)],[.8,new t.Color(.9836,.49291,.12849)],[.87,new t.Color(.92105,.31489,.05475)],[.93,new t.Color(.81608,.18462,.01809)],[1,new t.Color(.66449,.08436,.00424)]],RAINBOW:[[0,new t.Color(.278,0,.714)],[1/6,new t.Color(0,0,1)],[2/6,new t.Color(0,1,1)],[.5,new t.Color(0,1,0)],[4/6,new t.Color(1,1,0)],[5/6,new t.Color(1,.64,0)],[1,new t.Color(1,0,0)]],CONTOUR:[[0,new t.Color(0,0,0)],[.03,new t.Color(0,0,0)],[.04,new t.Color(1,1,1)],[1,new t.Color(1,1,1)]]};var cu=(t=>(t[t.Intensity=1]="Intensity",t[t.Classification=2]="Classification",t[t.Elevation=3]="Elevation",t[t.RGB=4]="RGB",t[t.White=5]="White",t))(cu||{}),hu=(t=>(t[t.FlatTexture=1]="FlatTexture",t[t.ShadedTexture=2]="ShadedTexture",t[t.ShadedNoTexture=3]="ShadedNoTexture",t))(hu||{});const lu=typeof document<"u"?Ql(au.RAINBOW):null,uu=typeof document<"u"?Ql(au.GRAYSCALE):null,du={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxConcurrency:1,maximumScreenSpaceError:16,memoryAdjustedScreenSpaceError:!0,maximumMemoryUsage:400,memoryCacheOverflow:128,viewDistanceScale:1,skipLevelOfDetail:!1,resetTransform:!1,updateTransforms:!0,shading:hu.FlatTexture,transparent:!1,pointCloudColoring:cu.White,pointSize:1,worker:!0,wireframe:!1,debug:!1,gltfLoader:null,basisTranscoderPath:null,dracoDecoderPath:null,material:null,contentPostProcess:void 0,preloadTilesCount:null,collectAttributions:!1};function fu(t){var e,n,r,i;null!=(e=null==t?void 0:t.uniforms)&&e.map?null==(r=null==(n=null==t?void 0:t.uniforms)?void 0:n.map.value)||r.dispose():t.map&&(null==(i=t.map)||i.dispose()),t.dispose()}function mu(t){t.traverse((t=>{if(t.isMesh)if(t.geometry.dispose(),t.material.isMaterial)fu(t.material);else for(const e of t.material)fu(e)}));for(let e=t.children.length-1;e>=0;e--){const n=t.children[e];t.remove(n)}}if(r(384),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const pu={white:cu.White,intensity:cu.Intensity,classification:cu.Classification,elevation:cu.Elevation,rgb:cu.RGB};AFRAME.registerComponent("loader-3dtiles",{schema:{url:{type:"string"},cameraEl:{type:"selector"},maximumSSE:{type:"int",default:16},maximumMem:{type:"int",default:32},distanceScale:{type:"number",default:1},pointcloudColoring:{type:"string",default:"white"},pointcloudElevationRange:{type:"array",default:["0","400"]},wireframe:{type:"boolean",default:!1},showStats:{type:"boolean",default:!1},cesiumIONToken:{type:"string"},googleApiKey:{type:"string"},lat:{type:"number"},long:{type:"number"},height:{type:"number",default:0},copyrightEl:{type:"selector"}},init:async function(){const t=this.el.sceneEl,e=this.data;if(this.camera=e.cameraEl?.object3D.children[0]??document.querySelector("a-scene").camera,!this.camera)throw new Error("3D Tiles: Please add an active camera or specify the target camera via the cameraEl property");this.viewport={width:t.clientWidth,height:t.clientHeight,devicePixelRatio:window.devicePixelRatio};const{model:n,runtime:r}=await this._initTileset();this.el.setObject3D("tileset",n),this.runtime=r,this.originalCamera=this.camera,t.addEventListener("camera-set-active",(t=>{this.camera=t.detail.cameraEl.object3D.children[0]??this.originalCamera})),this.el.addEventListener("cameraChange",(t=>{this.camera=t.detail,"OrthographicCamera"===this.camera.type&&(this.camera.rotation.x<-1?this.camera.position.y=100:this.camera.position.y=10),this.runtime.setViewport(this.viewport)})),t.addEventListener("enter-vr",(e=>{this.originalCamera=this.camera;try{this.camera=t.renderer.xr.getCamera(this.camera),t.renderer.xr.getSession().requestAnimationFrame(((e,n)=>{const r=t.renderer.xr.getReferenceSpace(),i=n.getViewerPose(r);if(i){const t=i.views[0].projectionMatrix[5];this.camera.fov=2*Math.atan2(1,t)*180/Math.PI}}))}catch(e){console.warn("Could not get VR camera")}})),t.addEventListener("exit-vr",(t=>{this.camera=this.originalCamera})),e.showStats&&(this.stats=this._initStats()),THREE.Cache.enabled&&(console.warn("3D Tiles loader cannot work with THREE.Cache, disabling."),THREE.Cache.enabled=!1),await this._nextFrame(),this.runtime=r,this.runtime.setElevationRange(e.pointcloudElevationRange.map((t=>Number(t)))),window.addEventListener("resize",this.onWindowResize.bind(this)),AFRAME.INSPECTOR&&AFRAME.INSPECTOR.opened&&(this.camera=AFRAME.INSPECTOR.camera,this.play())},onWindowResize:function(){const t=this.el.sceneEl;this.camera.aspect=t.clientWidth/t.clientHeight,this.camera.updateProjectionMatrix(),this.viewport={width:t.clientWidth,height:t.clientHeight,devicePixelRatio:window.devicePixelRatio},this.runtime.setViewport(this.viewport)},update:async function(t){if(t.url!==this.data.url){this.runtime&&(this.runtime.dispose(),this.runtime=null);const{model:t,runtime:e}=await this._initTileset();this.el.setObject3D("tileset",t),await this._nextFrame(),this.runtime=e}else this.runtime&&(this.runtime.setPointCloudColoring(this._resolvePointcloudColoring(this.data.pointCloudColoring)),this.runtime.setWireframe(this.data.wireframe),this.runtime.setViewDistanceScale(this.data.distanceScale),this.runtime.setElevationRange(this.data.pointcloudElevationRange.map((t=>Number(t)))));this.data.showStats&&!this.stats&&(this.stats=this._initStats()),!this.data.showStats&&this.stats&&(this.el.sceneEl.removeChild(this.stats),this.stats=null),(this.data.lat&&this.data.long||this.data.height)&&this.runtime.orientToGeocoord({lat:Number(this.data.lat),long:Number(this.data.long),height:Number(this.data.height)})},tick:function(e,n){if(this.runtime){if(this.runtime.update(n,this.camera),this.stats){const e=new t.Vector3;this.camera.getWorldPosition(e);const n=this.runtime.getStats();this.stats.setAttribute("textarea","text",Object.values(n.stats).map((t=>`${t.name}: ${t.count}`)).join("\n"));const r=new t.Vector3;r.copy(e),r.z-=2,this.stats.setAttribute("position",r)}this.data.copyrightEl&&(this.data.copyrightEl.innerHTML=this.runtime.getDataAttributions()??"")}},remove:function(){this.runtime&&this.runtime.dispose()},_resolvePointcloudColoring(){return pu[this.data.pointcloudColoring]||(console.warn("Invalid value for point cloud coloring"),cu.White)},_initTileset:async function(){const e=this._resolvePointcloudColoring(this.data.pointcloudColoring);return class{static async load(e){const n={...du,...e.options},{url:r}=e;let{viewport:i,renderer:s}=e;const o=n.updateInterval,a={};if(n.cesiumIONToken){a["cesium-ion"]={accessToken:n.cesiumIONToken};const t=await Dc.preload(r,a);a.fetch={headers:t.headers}}n.googleApiKey&&(a.fetch={headers:{"X-GOOG-API-KEY":n.googleApiKey}},e.options.hasOwnProperty("collectAttributions")||(n.collectAttributions=!0)),e.loadingManager&&e.loadingManager.itemStart(r);const c=await he(r,Ic,{...a}),h={},l={},u=[],d=new t.Group,f=new t.Group;n.debug||(f.visible=!1);const m={pointSize:{type:"f",value:n.pointSize},gradient:{type:"t",value:lu},grayscale:{type:"t",value:uu},rootCenter:{type:"vec3",value:new t.Vector3},rootNormal:{type:"vec3",value:new t.Vector3},coloring:{type:"i",value:n.pointCloudColoring},hideGround:{type:"b",value:!0},elevationRange:{type:"vec2",value:new t.Vector2(0,400)},maxIntensity:{type:"f",value:1},intensityContrast:{type:"f",value:1},alpha:{type:"f",value:1}},p=new t.ShaderMaterial({uniforms:m,vertexShader:"\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:"\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n",transparent:n.transparent,vertexColors:!0});let g,A,y;n.gltfLoader?g=n.gltfLoader:(g=new t.GLTFLoader,n.basisTranscoderPath&&(A=new t.KTX2Loader,A.detectSupport(s??new t.WebGLRenderer),A.setTranscoderPath(n.basisTranscoderPath+"/"),A.setWorkerLimit(1),g.setKTX2Loader(A)),n.dracoDecoderPath&&(y=new t.DRACOLoader,y.setDecoderPath(n.dracoDecoderPath+"/"),y.setWorkerLimit(n.maxConcurrency),g.setDRACOLoader(y)));const B=new t.MeshBasicMaterial({transparent:n.transparent}),b={maximumMemoryUsage:n.maximumMemoryUsage,maximumScreenSpaceError:n.maximumScreenSpaceError,memoryAdjustedScreenSpaceError:n.memoryAdjustedScreenSpaceError,memoryCacheOverflow:n.memoryCacheOverflow,viewDistanceScale:n.viewDistanceScale,skipLevelOfDetail:n.skipLevelOfDetail,updateTransforms:n.updateTransforms,throttleRequests:n.throttleRequests,maxRequests:n.maxRequests,contentLoader:async e=>{let r=null;switch(e.type){case el.POINTCLOUD:r=function(e,n,r,i){const s={rtc_center:e.content.rtcCenter,points:e.content.attributes.positions,intensities:e.content.attributes.intensity,classifications:e.content.attributes.classification,rgb:null,rgba:null},{colors:o}=e.content.attributes;o&&3===o.size&&(s.rgb=o.value),o&&4===o.size&&(s.rgba=o.value);const a=new t.BufferGeometry;a.setAttribute("position",new t.Float32BufferAttribute(s.points,3));const c=(new t.Matrix4).fromArray(e.computedTransform).premultiply(i);s.rgba?a.setAttribute("color",new t.Float32BufferAttribute(s.rgba,4)):s.rgb&&a.setAttribute("color",new t.Uint8BufferAttribute(s.rgb,3,!0)),s.intensities&&a.setAttribute("intensity",new t.BufferAttribute(s.intensities,1,!0)),s.classifications&&a.setAttribute("classification",new t.Uint8BufferAttribute(s.classifications,1,!1)),e.content.geometriesByteLength=Yl(a),e.content.gpuMemoryUsageInBytes=e.content.geometriesByteLength;const h=new t.Points(a,r.material||n);if(s.rtc_center){const e=s.rtc_center;c.multiply((new t.Matrix4).makeTranslation(e[0],e[1],e[2]))}return h.applyMatrix4(c),r.contentPostProcess&&r.contentPostProcess(h),h}(e,p,n,L);break;case el.SCENEGRAPH:case el.MESH:r=await async function(e,n,r,i,s){return new Promise(((o,a)=>{const c=(new t.Matrix4).makeRotationAxis(new t.Vector3(1,0,0),Math.PI/2),h="Z"!==n.content.gltfUpAxis,l=(new t.Matrix4).fromArray(n.computedTransform).premultiply(s);h&&l.multiply(c),n.content.byteLength||(n.content.byteLength=n.content.gltfArrayBuffer.byteLength),e.parse(n.content.gltfArrayBuffer,n.contentUrl?n.contentUrl.substr(0,n.contentUrl.lastIndexOf("/")+1):null,(t=>{n.userData.asset=t.asset;const e=t.scenes[0];e.applyMatrix4(l),n.content.texturesByteLength=0,n.content.geometriesByteLength=0,e.traverse((t=>{if("Mesh"==t.type){const e=t;n.content.geometriesByteLength+=Yl(e.geometry);const s=e.material,o=s.map;if(o){const t=function(t){let e=0;if("image/ktx2"==(null==t?void 0:t.userData.mimeType)&&t.mipmaps){for(let n=0;n1||i[1]>1;)e+=i[0]*i[1]*r,i[0]=Math.max(Math.floor(i[0]/2),1),i[1]=Math.max(Math.floor(i[1]/2),1);return e+=1*r,e}}(o);t&&(n.content.texturesByteLength+=t)}i.material?(e.material=i.material.clone(),s.dispose()):i.shading==hu.FlatTexture&&"MeshBasicMaterial"!==e.material.type&&(e.material=r.clone(),s.dispose()),i.shading!=hu.ShadedNoTexture?"ShaderMaterial"==e.material.type?e.material.uniforms.map={value:o}:e.material.map=o:(o&&o.dispose(),e.material.map=null),e.material.wireframe=i.wireframe,i.contentPostProcess&&i.contentPostProcess(e)}})),n.content.gpuMemoryUsageInBytes=n.content.texturesByteLength+n.content.geometriesByteLength,o(e)}),(t=>{a(new Error(`error parsing gltf in tile ${n.id}: ${t}`))}))}))}(g,e,B,n,L)}if(r&&(r.visible=!1,h[e.id]=r,d.add(h[e.id]),n.debug)){const t=ql(e);f.add(t),l[e.id]=t}},onTileLoad:async t=>{C&&(n.resetTransform&&!T&&(null==t?void 0:t.depth)<=5&&U(t),R=!0)},onTileUnload:t=>{u.push(t)},onTileError:(t,e)=>{console.warn("Tile error",t.id,e)},onTraversalComplete:t=>(n.collectAttributions&&(_=function(t){const e=new Map;return t.forEach((t=>{var n,r;const i=null==(r=null==(n=null==t?void 0:t.userData)?void 0:n.asset)?void 0:r.copyright;i&&i.split(/;/g).map((t=>t.trim())).forEach((t=>{t&&e.set(t,(e.get(t)||0)+1)}))})),Array.from(e).sort(((t,e)=>e[1]-t[1])).map((([t])=>t)).join("; ")}(t)),t)},C=new Kl(c,{...b,loadOptions:{...a,maxConcurrency:n.maxConcurrency,worker:n.worker,gltf:{loadImages:!1},"3d-tiles":{loadGLTF:!1}}}),w=new t.Matrix4,E=new t.Matrix4,v=new t.Vector3;let T=!1,_="";if(C.root.boundingVolume?(C.root.header.boundingVolume.region&&console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."),E.setPosition(C.root.boundingVolume.center[0],C.root.boundingVolume.center[1],C.root.boundingVolume.center[2])):console.warn("Bounding volume not found, no transformations applied"),n.debug){const t=ql(C.root);f.add(t),l[C.root.id]=t}let x=!1,M=!1;m.rootCenter.value.copy(v),m.rootNormal.value.copy(new t.Vector3(0,0,1).normalize()),C.stats.get("Loader concurrency").count=n.maxConcurrency,C.stats.get("Maximum mem usage").count=n.maximumMemoryUsage;let I=0,S=null,R=!0,O=null;const F=new t.Vector3(1/0,1/0,1/0);let D=null;d.updateMatrixWorld(!0);const G=(new t.Matrix4).copy(d.matrixWorld),L=(new t.Matrix4).copy(G).invert();function U(e){if(!e.boundingVolume.halfAxes)return;const n=e.boundingVolume.halfAxes,r=(new t.Matrix4).extractRotation(Wl(n)).premultiply((new t.Matrix4).extractRotation(L));if(!(new t.Euler).setFromRotationMatrix(r).equals(new t.Euler)){T=!0;const e=new t.Vector3(E.elements[12],E.elements[13],E.elements[14]);E.extractRotation(r),E.setPosition(e)}N()}function N(){w.copy(G),n.resetTransform&&w.multiply((new t.Matrix4).copy(E).invert()),C.modelMatrix=new ln(w.toArray())}function P(t,r,i,s){if(x||!s)return;D||(D=new ur({fov:s.fov/180*Math.PI,aspectRatio:s.aspect,near:s.near,far:s.far}).sseDenominator,n.debug&&console.log("Updated sse denonimator:",D));const o=zl(s).planes.map((t=>new tr(t.normal.toArray(),t.constant))),a=new ir(o),c={camera:{position:F.toArray()},height:i.height*i.devicePixelRatio,frameNumber:t._frameNumber,sseDenominator:D,cullingVolume:a,viewport:{id:0}};t._cache.reset(),t._traverser.traverse(t.root,c,t.options);for(const e of t.tiles)e.selected?r[e.id]?r[e.id].visible=!0:console.error("TILE SELECTED BUT NOT LOADED!!",e.id):r[e.id]&&(r[e.id].visible=!1);for(;u.length>0;){const t=u.pop();r[t.id]&&0==t.contentState&&(d.remove(r[t.id]),mu(r[t.id]),delete r[t.id]),l[t.id]&&(mu(l[t.id]),f.remove(l[t.id]),delete l[t.id])}const h=t.stats.get("Tiles Loaded").count,m=t.stats.get("Tiles Loading").count;return e.onProgress&&e.onProgress(h,h+m),e.loadingManager&&!M&&0==m&&(null==n.preloadTilesCount||h>=n.preloadTilesCount)&&(M=!0,e.loadingManager.itemEnd(e.url)),c}return n.resetTransform&&U(C.root),n.debug&&(l[C.root.id].applyMatrix4(w),f.matrixWorld.copy(d.matrixWorld)),{model:d,runtime:{getTileset:()=>C,getStats:()=>C.stats,getDataAttributions:()=>_,showTiles:t=>{f.visible=t},setWireframe:e=>{n.wireframe=e,d.traverse((n=>{n instanceof t.Mesh&&(n.material.wireframe=e)}))},setDebug:t=>{n.debug=t,f.visible=t},setShading:t=>{n.shading=t},getTileBoxes:()=>f,setViewDistanceScale:t=>{C.options.viewDistanceScale=t,C._frameNumber++,P(C,h,i,O)},setMaximumScreenSpaceError:t=>{C.options.maximumScreenSpaceError=t,C._frameNumber++,P(C,h,i,O)},setHideGround:t=>{m.hideGround.value=t},setPointCloudColoring:t=>{m.coloring.value=t},setElevationRange:t=>{m.elevationRange.value.set(t[0],t[1])},setMaxIntensity:t=>{m.maxIntensity.value=t},setIntensityContrast:t=>{m.intensityContrast.value=t},setPointAlpha:t=>{m.alpha.value=t},getLatLongHeightFromPosition:e=>{const n=C.ellipsoid.cartesianToCartographic((new t.Vector3).copy(e).applyMatrix4((new t.Matrix4).copy(w).invert()).toArray());return{lat:n[1],long:n[0],height:n[2]}},getPositionFromLatLongHeight:e=>{const n=C.ellipsoid.cartographicToCartesian([e.long,e.lat,e.height]);return new t.Vector3(...n).applyMatrix4(w)},orientToGeocoord:e=>{const n=[e.long,e.lat,e.height],r=C.ellipsoid.cartographicToCartesian(n),i=(new t.Matrix4).fromArray(C.ellipsoid.eastNorthUpToFixedFrame(r)),s=(new t.Matrix4).makeRotationFromEuler(new t.Euler(Math.PI/2,Math.PI/2,0));!function(e){const n=new t.Vector3,r=new t.Quaternion,i=new t.Vector3;e.decompose(n,r,i),d.position.copy(n),d.quaternion.copy(r),d.scale.copy(i),d.updateMatrix(),d.updateMatrixWorld(!0),G.copy(d.matrixWorld),L.copy(G).invert(),N()}((new t.Matrix4).copy(i).multiply(s).invert())},getWebMercatorCoord:e=>function(e,n){const r=2*Math.PI*6378137/2,i=n*r/180;let s=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return s=s*r/180,new t.Vector2(i,s)}(e.lat,e.long),getCameraFrustum:e=>{const n=zl(e).planes.map((t=>new tr(t.normal.toArray(),t.constant))).map((e=>function(e){const n=new t.Group,r=new t.PlaneGeometry(10,5),i=new t.Vector3(...e.projectPointOntoPlane([0,0,0])),s=new t.Vector3(e.normal.x,e.normal.y,e.normal.z),o=(new t.Vector3).copy(i).add(s);r.lookAt(o),r.translate(i.x,i.y,i.z);const a=new t.MeshBasicMaterial({color:65535,side:t.DoubleSide}),c=new t.Mesh(r,a),h=new t.ArrowHelper(s,i,5,16776960);return n.add(h),n.add(c),n}(e))),r=new t.Group;for(const t of n)r.add(t);return r},overlayGeoJSON:(e,n)=>{if(e.applyMatrix4(w),e.updateMatrixWorld(),!s)throw new Error("GeoJSON draping requires a renderer reference via LoaderProps");return function(e,n,r,i=eu){Xl&&Xl.dispose(),Zl||(Zl=r);const s={...eu,...i};Xl=new t.WebGLRenderTarget(e.width*e.devicePixelRatio,e.height*e.devicePixelRatio),Xl.texture.minFilter=t.NearestFilter,Xl.texture.magFilter=t.NearestFilter,Xl.stencilBuffer=!1,Xl.texture.format=t.RGBAFormat,Xl.texture.type=t.FloatType,Zl.setPixelRatio(devicePixelRatio),Zl.setSize(e.width,e.height),Zl.setRenderTarget(Xl),$l=new t.Scene,$l.overrideMaterial=ru,tu=n,ou.uniforms.tPosition.value=Xl.texture,ou.uniforms.minHeight.value=s.minHeight,ou.uniforms.maxHeight.value=s.maxHeight,ou.uniforms.samples.value=s.samples,ou.uniforms.sampleStep.value=s.sampleStep,ou.uniforms.opacity.value=s.opacity,ou.blending=s.blendingType}(i,d,s,n),e.material.dispose(),e.material=ou,e},setViewport:t=>{i=t,D=null,R=!0,Xl&&function(t){Xl.setSize(t.width*t.devicePixelRatio,t.height*t.devicePixelRatio),Zl.setPixelRatio(devicePixelRatio),Zl.setSize(t.width,t.height)}(i)},setRenderer:t=>{s=t},update:function(e,r){if(O=r,I+=e,Xl&&function(t){if(Zl){const e=tu.parent;$l.add(tu),Zl.setRenderTarget(Xl),Zl.render($l,t),e&&e.add(tu),Zl.setRenderTarget(null)}}(r),C&&I>=o){if(!G.equals(d.matrixWorld)){I=0,G.copy(d.matrixWorld),n.updateTransforms&&N();const e=(new t.Vector3).setFromMatrixPosition(G);m.rootCenter.value.copy(e),m.rootNormal.value.copy(new t.Vector3(0,0,1).applyMatrix4(G).normalize()),L.copy(G).invert(),n.debug&&(l[C.root.id].matrixWorld.copy(w),l[C.root.id].applyMatrix4(G))}null==S?S=(new t.Matrix4).copy(r.matrixWorld):(R||function(t,e){return!t.matrixWorld.equals(e)}(r,S))&&(I=0,R=!1,C._frameNumber++,r.getWorldPosition(F),S.copy(r.matrixWorld),P(C,h,i,r))}},dispose:function(){for(x=!0,C._destroy();d.children.length>0;){const t=d.children[0];mu(t),d.remove(t)}for(;f.children.length>0;){const t=f.children[0];f.remove(t),t.geometry.dispose(),t.material.dispose()}A&&A.dispose(),y&&y.dispose()}}}}static async loadGeoJSON(e){const{url:n,height:r,featureToColor:i}=e;return he(n,Uh,{worker:!1,gis:{format:"binary"}}).then((e=>{const n=e,s=new t.BufferGeometry,o=n.polygons.positions.value.reduce(((t,e,n,i)=>{if(n%2==0){const s=[e,i[n+1],r??0],o=Hn.WGS84.cartographicToCartesian(s);t.push(...o)}return t}),[]);if(s.setAttribute("position",new t.Float32BufferAttribute(o,3)),i){const e=n.polygons.numericProps[i.feature].value.reduce(((t,e,n,r)=>{const s=i.colorMap(e);return t[3*n]=s.r,t[3*n+1]=s.g,t[3*n+2]=s.b,t}),[]);s.setAttribute("color",new t.Float32BufferAttribute(e,3))}s.setIndex(new t.BufferAttribute(n.polygons.triangles.value,1));const a=new t.MeshBasicMaterial({transparent:!0,vertexColors:!0,opacity:.5,blending:t.NormalBlending});return new t.Mesh(s,a)}))}}.load({url:this.data.url,renderer:this.el.sceneEl.renderer,options:{googleApiKey:this.data.googleApiKey,cesiumIONToken:this.data.cesiumIONToken,dracoDecoderPath:"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/draco",basisTranscoderPath:"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/basis",maximumScreenSpaceError:this.data.maximumSSE,maximumMemoryUsage:this.data.maximumMem,memoryCacheOverflow:128,pointCloudColoring:e,viewDistanceScale:this.data.distanceScale,wireframe:this.data.wireframe,updateTransforms:!0},viewport:this.viewport})},_initStats:function(){const t=document.createElement("a-entity");return this.el.sceneEl.appendChild(t),t.setAttribute("position","-0.5 0 -1"),t.setAttribute("textarea",{cols:30,rows:15,text:"",color:"white",disabledBackgroundColor:"#0c1e2c",disabled:!0}),t},_nextFrame:async function(){return new Promise(((t,e)=>{setTimeout((()=>{t()}),0)}))}})})(),i})())); \ No newline at end of file +`,ou=new t.ShaderMaterial({vertexShader:iu,fragmentShader:su,uniforms:{tPosition:{value:null},minHeight:{value:0},maxHeight:{value:300},opacity:{value:.5},samples:{value:4},sampleStep:{value:4}},vertexColors:!0,transparent:!0,depthTest:!1,blending:t.NormalBlending}),au={SPECTRAL:[[0,new t.Color(.3686,.3098,.6353)],[.1,new t.Color(.1961,.5333,.7412)],[.2,new t.Color(.4,.7608,.6471)],[.3,new t.Color(.6706,.8667,.6431)],[.4,new t.Color(.902,.9608,.5961)],[.5,new t.Color(1,1,.749)],[.6,new t.Color(.9961,.8784,.5451)],[.7,new t.Color(.9922,.6824,.3804)],[.8,new t.Color(.9569,.4275,.2627)],[.9,new t.Color(.8353,.2431,.3098)],[1,new t.Color(.6196,.0039,.2588)]],PLASMA:[[0,new t.Color(.241,.015,.61)],[.1,new t.Color(.387,.001,.654)],[.2,new t.Color(.524,.025,.653)],[.3,new t.Color(.651,.125,.596)],[.4,new t.Color(.752,.227,.513)],[.5,new t.Color(.837,.329,.431)],[.6,new t.Color(.907,.435,.353)],[.7,new t.Color(.963,.554,.272)],[.8,new t.Color(.992,.681,.195)],[.9,new t.Color(.987,.822,.144)],[1,new t.Color(.94,.975,.131)]],YELLOW_GREEN:[[0,new t.Color(.1647,.2824,.3451)],[.1,new t.Color(.1338,.3555,.4227)],[.2,new t.Color(.061,.4319,.4864)],[.3,new t.Color(0,.5099,.5319)],[.4,new t.Color(0,.5881,.5569)],[.5,new t.Color(.137,.665,.5614)],[.6,new t.Color(.2906,.7395,.5477)],[.7,new t.Color(.4453,.8099,.5201)],[.8,new t.Color(.6102,.8748,.485)],[.9,new t.Color(.7883,.9323,.4514)],[1,new t.Color(.9804,.9804,.4314)]],VIRIDIS:[[0,new t.Color(.267,.005,.329)],[.1,new t.Color(.283,.141,.458)],[.2,new t.Color(.254,.265,.53)],[.3,new t.Color(.207,.372,.553)],[.4,new t.Color(.164,.471,.558)],[.5,new t.Color(.128,.567,.551)],[.6,new t.Color(.135,.659,.518)],[.7,new t.Color(.267,.749,.441)],[.8,new t.Color(.478,.821,.318)],[.9,new t.Color(.741,.873,.15)],[1,new t.Color(.993,.906,.144)]],INFERNO:[[0,new t.Color(.077,.042,.206)],[.1,new t.Color(.225,.036,.388)],[.2,new t.Color(.373,.074,.432)],[.3,new t.Color(.522,.128,.42)],[.4,new t.Color(.665,.182,.37)],[.5,new t.Color(.797,.255,.287)],[.6,new t.Color(.902,.364,.184)],[.7,new t.Color(.969,.516,.063)],[.8,new t.Color(.988,.683,.072)],[.9,new t.Color(.961,.859,.298)],[1,new t.Color(.988,.998,.645)]],GRAYSCALE:[[0,new t.Color(0,0,0)],[1,new t.Color(1,1,1)]],TURBO:[[0,new t.Color(.18995,.07176,.23217)],[.07,new t.Color(.25107,.25237,.63374)],[.13,new t.Color(.27628,.42118,.89123)],[.2,new t.Color(.25862,.57958,.99876)],[.27,new t.Color(.15844,.73551,.92305)],[.33,new t.Color(.09267,.86554,.7623)],[.4,new t.Color(.19659,.94901,.59466)],[.47,new t.Color(.42778,.99419,.38575)],[.53,new t.Color(.64362,.98999,.23356)],[.6,new t.Color(.80473,.92452,.20459)],[.67,new t.Color(.93301,.81236,.22667)],[.73,new t.Color(.99314,.67408,.20348)],[.8,new t.Color(.9836,.49291,.12849)],[.87,new t.Color(.92105,.31489,.05475)],[.93,new t.Color(.81608,.18462,.01809)],[1,new t.Color(.66449,.08436,.00424)]],RAINBOW:[[0,new t.Color(.278,0,.714)],[1/6,new t.Color(0,0,1)],[2/6,new t.Color(0,1,1)],[.5,new t.Color(0,1,0)],[4/6,new t.Color(1,1,0)],[5/6,new t.Color(1,.64,0)],[1,new t.Color(1,0,0)]],CONTOUR:[[0,new t.Color(0,0,0)],[.03,new t.Color(0,0,0)],[.04,new t.Color(1,1,1)],[1,new t.Color(1,1,1)]]};var cu=(t=>(t[t.Intensity=1]="Intensity",t[t.Classification=2]="Classification",t[t.Elevation=3]="Elevation",t[t.RGB=4]="RGB",t[t.White=5]="White",t))(cu||{}),hu=(t=>(t[t.FlatTexture=1]="FlatTexture",t[t.ShadedTexture=2]="ShadedTexture",t[t.ShadedNoTexture=3]="ShadedNoTexture",t))(hu||{});const lu=typeof document<"u"?Ql(au.RAINBOW):null,uu=typeof document<"u"?Ql(au.GRAYSCALE):null,du={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxConcurrency:1,maximumScreenSpaceError:16,memoryAdjustedScreenSpaceError:!0,maximumMemoryUsage:400,memoryCacheOverflow:128,viewDistanceScale:1,skipLevelOfDetail:!1,resetTransform:!1,updateTransforms:!0,shading:hu.FlatTexture,transparent:!1,pointCloudColoring:cu.White,pointSize:1,worker:!0,wireframe:!1,debug:!1,gltfLoader:null,basisTranscoderPath:null,dracoDecoderPath:null,material:null,contentPostProcess:void 0,preloadTilesCount:null,collectAttributions:!1};function fu(t){var e,n,r,i;null!=(e=null==t?void 0:t.uniforms)&&e.map?null==(r=null==(n=null==t?void 0:t.uniforms)?void 0:n.map.value)||r.dispose():t.map&&(null==(i=t.map)||i.dispose()),t.dispose()}function mu(t){t.traverse((t=>{if(t.isMesh)if(t.geometry.dispose(),t.material.isMaterial)fu(t.material);else for(const e of t.material)fu(e)}));for(let e=t.children.length-1;e>=0;e--){const n=t.children[e];t.remove(n)}}if(r(384),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const pu={white:cu.White,intensity:cu.Intensity,classification:cu.Classification,elevation:cu.Elevation,rgb:cu.RGB};AFRAME.registerComponent("loader-3dtiles",{schema:{url:{type:"string"},cameraEl:{type:"selector"},maximumSSE:{type:"int",default:16},maximumMem:{type:"int",default:32},distanceScale:{type:"number",default:1},pointcloudColoring:{type:"string",default:"white"},pointcloudElevationRange:{type:"array",default:["0","400"]},wireframe:{type:"boolean",default:!1},showStats:{type:"boolean",default:!1},cesiumIONToken:{type:"string"},googleApiKey:{type:"string"},lat:{type:"number"},long:{type:"number"},height:{type:"number",default:0},copyrightEl:{type:"selector"}},init:async function(){const t=this.el.sceneEl,e=this.data;if(this.camera=e.cameraEl?.object3D.children[0]??document.querySelector("a-scene").camera,!this.camera)throw new Error("3D Tiles: Please add an active camera or specify the target camera via the cameraEl property");this.viewport={width:t.clientWidth,height:t.clientHeight,devicePixelRatio:window.devicePixelRatio};const{model:n,runtime:r}=await this._initTileset();this.el.setObject3D("tileset",n),this.runtime=r,this.originalCamera=this.camera,t.addEventListener("camera-set-active",(t=>{this.camera=t.detail.cameraEl.object3D.children[0]??this.originalCamera})),this.el.addEventListener("cameraChange",(t=>{this.camera=t.detail,"OrthographicCamera"===this.camera.type&&(this.camera.rotation.x<-1?this.camera.position.y=100:this.camera.position.y=10),this.runtime.setViewport(this.viewport)})),t.addEventListener("enter-vr",(e=>{this.originalCamera=this.camera;try{this.camera=t.renderer.xr.getCamera(this.camera),t.renderer.xr.getSession().requestAnimationFrame(((e,n)=>{const r=t.renderer.xr.getReferenceSpace(),i=n.getViewerPose(r);if(i){const t=i.views[0].projectionMatrix[5];this.camera.fov=2*Math.atan2(1,t)*180/Math.PI}}))}catch(e){console.warn("Could not get VR camera")}})),t.addEventListener("exit-vr",(t=>{this.camera=this.originalCamera})),e.showStats&&(this.stats=this._initStats()),THREE.Cache.enabled&&(console.warn("3D Tiles loader cannot work with THREE.Cache, disabling."),THREE.Cache.enabled=!1),await this._nextFrame(),this.runtime=r,this.runtime.setElevationRange(e.pointcloudElevationRange.map((t=>Number(t)))),window.addEventListener("resize",this.onWindowResize.bind(this)),AFRAME.INSPECTOR&&AFRAME.INSPECTOR.opened&&(this.camera=AFRAME.INSPECTOR.camera,this.play())},onWindowResize:function(){const t=this.el.sceneEl;this.camera.aspect=t.clientWidth/t.clientHeight,this.camera.updateProjectionMatrix(),this.viewport={width:t.clientWidth,height:t.clientHeight,devicePixelRatio:window.devicePixelRatio},this.runtime.setViewport(this.viewport)},update:async function(t){if(t.url!==this.data.url){this.runtime&&(this.runtime.dispose(),this.runtime=null);const{model:t,runtime:e}=await this._initTileset();this.el.setObject3D("tileset",t),await this._nextFrame(),this.runtime=e}else this.runtime&&(this.runtime.setPointCloudColoring(this._resolvePointcloudColoring(this.data.pointCloudColoring)),this.runtime.setWireframe(this.data.wireframe),this.runtime.setViewDistanceScale(this.data.distanceScale),this.runtime.setElevationRange(this.data.pointcloudElevationRange.map((t=>Number(t)))));this.data.showStats&&!this.stats&&(this.stats=this._initStats()),!this.data.showStats&&this.stats&&(this.el.sceneEl.removeChild(this.stats),this.stats=null),(this.data.lat&&this.data.long||this.data.height)&&this.runtime.orientToGeocoord({lat:Number(this.data.lat),long:Number(this.data.long),height:Number(this.data.height)})},tick:function(e,n){if(this.runtime){if(this.runtime.update(n,this.camera),this.stats){const e=new t.Vector3;this.camera.getWorldPosition(e);const n=this.runtime.getStats();this.stats.setAttribute("textarea","text",Object.values(n.stats).map((t=>`${t.name}: ${t.count}`)).join("\n"));const r=new t.Vector3;r.copy(e),r.z-=2,this.stats.setAttribute("position",r)}this.data.copyrightEl&&(this.data.copyrightEl.innerHTML=this.runtime.getDataAttributions()??"")}},remove:function(){this.runtime&&this.runtime.dispose()},_resolvePointcloudColoring(){return pu[this.data.pointcloudColoring]||(console.warn("Invalid value for point cloud coloring"),cu.White)},_initTileset:async function(){const e=this._resolvePointcloudColoring(this.data.pointcloudColoring);return class{static async load(e){const n={...du,...e.options},{url:r}=e;let{viewport:i,renderer:s}=e;const o=n.updateInterval,a={};if(n.cesiumIONToken){a["cesium-ion"]={accessToken:n.cesiumIONToken};const t=await Dc.preload(r,a);a.fetch={headers:t.headers}}n.googleApiKey&&(a.fetch={headers:{"X-GOOG-API-KEY":n.googleApiKey}},e.options.hasOwnProperty("collectAttributions")||(n.collectAttributions=!0)),e.loadingManager&&e.loadingManager.itemStart(r);const c=await he(r,Ic,{...a}),h={},l={},u=[],d=new t.Group,f=new t.Group;n.debug||(f.visible=!1);const m={pointSize:{type:"f",value:n.pointSize},gradient:{type:"t",value:lu},grayscale:{type:"t",value:uu},rootCenter:{type:"vec3",value:new t.Vector3},rootNormal:{type:"vec3",value:new t.Vector3},coloring:{type:"i",value:n.pointCloudColoring},hideGround:{type:"b",value:!0},elevationRange:{type:"vec2",value:new t.Vector2(0,400)},maxIntensity:{type:"f",value:1},intensityContrast:{type:"f",value:1},alpha:{type:"f",value:1}},p=new t.ShaderMaterial({uniforms:m,vertexShader:"\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:"\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n",transparent:n.transparent,vertexColors:!0});let g,A,y;n.gltfLoader?g=n.gltfLoader:(g=new t.GLTFLoader,n.basisTranscoderPath&&(A=new t.KTX2Loader,A.detectSupport(s??new t.WebGLRenderer),A.setTranscoderPath(n.basisTranscoderPath+"/"),A.setWorkerLimit(1),g.setKTX2Loader(A)),n.dracoDecoderPath&&(y=new t.DRACOLoader,y.setDecoderPath(n.dracoDecoderPath+"/"),y.setWorkerLimit(n.maxConcurrency),g.setDRACOLoader(y)));const B=new t.MeshBasicMaterial({transparent:n.transparent}),b={maximumMemoryUsage:n.maximumMemoryUsage,maximumScreenSpaceError:n.maximumScreenSpaceError,memoryAdjustedScreenSpaceError:n.memoryAdjustedScreenSpaceError,memoryCacheOverflow:n.memoryCacheOverflow,viewDistanceScale:n.viewDistanceScale,skipLevelOfDetail:n.skipLevelOfDetail,updateTransforms:n.updateTransforms,throttleRequests:n.throttleRequests,maxRequests:n.maxRequests,contentLoader:async e=>{let r=null;switch(e.type){case el.POINTCLOUD:r=function(e,n,r,i){const s={rtc_center:e.content.rtcCenter,points:e.content.attributes.positions,intensities:e.content.attributes.intensity,classifications:e.content.attributes.classification,rgb:null,rgba:null},{colors:o}=e.content.attributes;o&&3===o.size&&(s.rgb=o.value),o&&4===o.size&&(s.rgba=o.value);const a=new t.BufferGeometry;a.setAttribute("position",new t.Float32BufferAttribute(s.points,3));const c=(new t.Matrix4).fromArray(e.computedTransform).premultiply(i);s.rgba?a.setAttribute("color",new t.Float32BufferAttribute(s.rgba,4)):s.rgb&&a.setAttribute("color",new t.Uint8BufferAttribute(s.rgb,3,!0)),s.intensities&&a.setAttribute("intensity",new t.BufferAttribute(s.intensities,1,!0)),s.classifications&&a.setAttribute("classification",new t.Uint8BufferAttribute(s.classifications,1,!1)),e.content.geometriesByteLength=Yl(a),e.content.gpuMemoryUsageInBytes=e.content.geometriesByteLength;const h=new t.Points(a,r.material||n);if(s.rtc_center){const e=s.rtc_center;c.multiply((new t.Matrix4).makeTranslation(e[0],e[1],e[2]))}return h.applyMatrix4(c),r.contentPostProcess&&r.contentPostProcess(h),h}(e,p,n,L);break;case el.SCENEGRAPH:case el.MESH:r=await async function(e,n,r,i,s){return new Promise(((o,a)=>{const c=(new t.Matrix4).makeRotationAxis(new t.Vector3(1,0,0),Math.PI/2),h="Z"!==n.content.gltfUpAxis,l=(new t.Matrix4).fromArray(n.computedTransform).premultiply(s);h&&l.multiply(c),n.content.byteLength||(n.content.byteLength=n.content.gltfArrayBuffer.byteLength),e.parse(n.content.gltfArrayBuffer,n.contentUrl?n.contentUrl.substr(0,n.contentUrl.lastIndexOf("/")+1):null,(t=>{n.userData.asset=t.asset;const e=t.scenes[0];e.applyMatrix4(l),n.content.texturesByteLength=0,n.content.geometriesByteLength=0,e.traverse((t=>{if("Mesh"==t.type){const e=t;n.content.geometriesByteLength+=Yl(e.geometry);const s=e.material,o=s.map;if(o){const t=function(t){let e=0;if("image/ktx2"==(null==t?void 0:t.userData.mimeType)&&t.mipmaps){for(let n=0;n1||i[1]>1;)e+=i[0]*i[1]*r,i[0]=Math.max(Math.floor(i[0]/2),1),i[1]=Math.max(Math.floor(i[1]/2),1);return e+=1*r,e}}(o);t&&(n.content.texturesByteLength+=t)}i.material?(e.material=i.material.clone(),s.dispose()):i.shading==hu.FlatTexture&&"MeshBasicMaterial"!==e.material.type&&(e.material=r.clone(),s.dispose()),i.shading!=hu.ShadedNoTexture?"ShaderMaterial"==e.material.type?e.material.uniforms.map={value:o}:e.material.map=o:(o&&o.dispose(),e.material.map=null),e.material.wireframe=i.wireframe,i.contentPostProcess&&i.contentPostProcess(e)}})),n.content.gpuMemoryUsageInBytes=n.content.texturesByteLength+n.content.geometriesByteLength,o(e)}),(t=>{a(new Error(`error parsing gltf in tile ${n.id}: ${t}`))}))}))}(g,e,B,n,L)}if(r&&(r.visible=!1,h[e.id]=r,d.add(h[e.id]),n.debug)){const t=ql(e);f.add(t),l[e.id]=t}},onTileLoad:async t=>{C&&(n.resetTransform&&!T&&(null==t?void 0:t.depth)<=5&&U(t),R=!0)},onTileUnload:t=>{u.push(t)},onTileError:(t,e)=>{console.warn("Tile error",t.id,e)},onTraversalComplete:t=>(n.collectAttributions&&(_=function(t){const e=new Map;return t.forEach((t=>{var n,r;const i=null==(r=null==(n=null==t?void 0:t.userData)?void 0:n.asset)?void 0:r.copyright;i&&i.split(/;/g).map((t=>t.trim())).forEach((t=>{t&&e.set(t,(e.get(t)||0)+1)}))})),Array.from(e).sort(((t,e)=>e[1]-t[1])).map((([t])=>t)).join("; ")}(t)),t)},C=new Kl(c,{...b,loadOptions:{...a,maxConcurrency:n.maxConcurrency,worker:n.worker,gltf:{loadImages:!1},"3d-tiles":{loadGLTF:!1}}}),w=new t.Matrix4,v=new t.Matrix4,E=new t.Vector3;let T=!1,_="";if(C.root.boundingVolume?(C.root.header.boundingVolume.region&&console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."),v.setPosition(C.root.boundingVolume.center[0],C.root.boundingVolume.center[1],C.root.boundingVolume.center[2])):console.warn("Bounding volume not found, no transformations applied"),n.debug){const t=ql(C.root);f.add(t),l[C.root.id]=t}let x=!1,M=!1;m.rootCenter.value.copy(E),m.rootNormal.value.copy(new t.Vector3(0,0,1).normalize()),C.stats.get("Loader concurrency").count=n.maxConcurrency,C.stats.get("Maximum mem usage").count=n.maximumMemoryUsage;let I=0,S=null,R=!0,O=null;const F=new t.Vector3(1/0,1/0,1/0);let D=null;d.updateMatrixWorld(!0);const G=(new t.Matrix4).copy(d.matrixWorld),L=(new t.Matrix4).copy(G).invert();function U(e){if(!e.boundingVolume.halfAxes)return;const n=e.boundingVolume.halfAxes,r=(new t.Matrix4).extractRotation(Wl(n)).premultiply((new t.Matrix4).extractRotation(L));if(!(new t.Euler).setFromRotationMatrix(r).equals(new t.Euler)){T=!0;const e=new t.Vector3(v.elements[12],v.elements[13],v.elements[14]);v.extractRotation(r),v.setPosition(e)}N()}function N(){w.copy(G),n.resetTransform&&w.multiply((new t.Matrix4).copy(v).invert()),C.modelMatrix=new ln(w.toArray())}function P(r,i,s,o){if(x||!o)return;if(!D){if(o instanceof t.PerspectiveCamera)D=new ur({fov:o.fov/180*Math.PI,aspectRatio:o.aspect,near:o.near,far:o.far}).sseDenominator;else if(o instanceof t.OrthographicCamera){const t=o.right-o.left,e=o.top-o.bottom,n=t/e;D=Math.max(e/s.height,t/(s.height*n))}n.debug&&console.log("Updated sse denonimator:",D)}const a=zl(o).planes.map((t=>new tr(t.normal.toArray(),t.constant))),c=new ir(a),h={camera:{position:F.toArray()},height:s.height*s.devicePixelRatio,frameNumber:r._frameNumber,sseDenominator:D,cullingVolume:c,viewport:{id:0}};r._cache.reset(),r._traverser.traverse(r.root,h,r.options);for(const t of r.tiles)t.selected?i[t.id]?i[t.id].visible=!0:console.error("TILE SELECTED BUT NOT LOADED!!",t.id):i[t.id]&&(i[t.id].visible=!1);for(;u.length>0;){const t=u.pop();i[t.id]&&0==t.contentState&&(d.remove(i[t.id]),mu(i[t.id]),delete i[t.id]),l[t.id]&&(mu(l[t.id]),f.remove(l[t.id]),delete l[t.id])}const m=r.stats.get("Tiles Loaded").count,p=r.stats.get("Tiles Loading").count;return e.onProgress&&e.onProgress(m,m+p),e.loadingManager&&!M&&0==p&&(null==n.preloadTilesCount||m>=n.preloadTilesCount)&&(M=!0,e.loadingManager.itemEnd(e.url)),h}return n.resetTransform&&U(C.root),n.debug&&(l[C.root.id].applyMatrix4(w),f.matrixWorld.copy(d.matrixWorld)),{model:d,runtime:{getTileset:()=>C,getStats:()=>C.stats,getDataAttributions:()=>_,showTiles:t=>{f.visible=t},setWireframe:e=>{n.wireframe=e,d.traverse((n=>{n instanceof t.Mesh&&(n.material.wireframe=e)}))},setDebug:t=>{n.debug=t,f.visible=t},setShading:t=>{n.shading=t},getTileBoxes:()=>f,setViewDistanceScale:t=>{C.options.viewDistanceScale=t,C._frameNumber++,P(C,h,i,O)},setMaximumScreenSpaceError:t=>{C.options.maximumScreenSpaceError=t,C._frameNumber++,P(C,h,i,O)},setHideGround:t=>{m.hideGround.value=t},setPointCloudColoring:t=>{m.coloring.value=t},setElevationRange:t=>{m.elevationRange.value.set(t[0],t[1])},setMaxIntensity:t=>{m.maxIntensity.value=t},setIntensityContrast:t=>{m.intensityContrast.value=t},setPointAlpha:t=>{m.alpha.value=t},getLatLongHeightFromPosition:e=>{const n=C.ellipsoid.cartesianToCartographic((new t.Vector3).copy(e).applyMatrix4((new t.Matrix4).copy(w).invert()).toArray());return{lat:n[1],long:n[0],height:n[2]}},getPositionFromLatLongHeight:e=>{const n=C.ellipsoid.cartographicToCartesian([e.long,e.lat,e.height]);return new t.Vector3(...n).applyMatrix4(w)},orientToGeocoord:e=>{const n=[e.long,e.lat,e.height],r=C.ellipsoid.cartographicToCartesian(n),i=(new t.Matrix4).fromArray(C.ellipsoid.eastNorthUpToFixedFrame(r)),s=(new t.Matrix4).makeRotationFromEuler(new t.Euler(Math.PI/2,Math.PI/2,0));!function(e){const n=new t.Vector3,r=new t.Quaternion,i=new t.Vector3;e.decompose(n,r,i),d.position.copy(n),d.quaternion.copy(r),d.scale.copy(i),d.updateMatrix(),d.updateMatrixWorld(!0),G.copy(d.matrixWorld),L.copy(G).invert(),N()}((new t.Matrix4).copy(i).multiply(s).invert())},getWebMercatorCoord:e=>function(e,n){const r=2*Math.PI*6378137/2,i=n*r/180;let s=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return s=s*r/180,new t.Vector2(i,s)}(e.lat,e.long),getCameraFrustum:e=>{const n=zl(e).planes.map((t=>new tr(t.normal.toArray(),t.constant))).map((e=>function(e){const n=new t.Group,r=new t.PlaneGeometry(10,5),i=new t.Vector3(...e.projectPointOntoPlane([0,0,0])),s=new t.Vector3(e.normal.x,e.normal.y,e.normal.z),o=(new t.Vector3).copy(i).add(s);r.lookAt(o),r.translate(i.x,i.y,i.z);const a=new t.MeshBasicMaterial({color:65535,side:t.DoubleSide}),c=new t.Mesh(r,a),h=new t.ArrowHelper(s,i,5,16776960);return n.add(h),n.add(c),n}(e))),r=new t.Group;for(const t of n)r.add(t);return r},overlayGeoJSON:(e,n)=>{if(e.applyMatrix4(w),e.updateMatrixWorld(),!s)throw new Error("GeoJSON draping requires a renderer reference via LoaderProps");return function(e,n,r,i=eu){Xl&&Xl.dispose(),Zl||(Zl=r);const s={...eu,...i};Xl=new t.WebGLRenderTarget(e.width*e.devicePixelRatio,e.height*e.devicePixelRatio),Xl.texture.minFilter=t.NearestFilter,Xl.texture.magFilter=t.NearestFilter,Xl.stencilBuffer=!1,Xl.texture.format=t.RGBAFormat,Xl.texture.type=t.FloatType,Zl.setPixelRatio(devicePixelRatio),Zl.setSize(e.width,e.height),Zl.setRenderTarget(Xl),$l=new t.Scene,$l.overrideMaterial=ru,tu=n,ou.uniforms.tPosition.value=Xl.texture,ou.uniforms.minHeight.value=s.minHeight,ou.uniforms.maxHeight.value=s.maxHeight,ou.uniforms.samples.value=s.samples,ou.uniforms.sampleStep.value=s.sampleStep,ou.uniforms.opacity.value=s.opacity,ou.blending=s.blendingType}(i,d,s,n),e.material.dispose(),e.material=ou,e},setViewport:t=>{i=t,D=null,R=!0,Xl&&function(t){Xl.setSize(t.width*t.devicePixelRatio,t.height*t.devicePixelRatio),Zl.setPixelRatio(devicePixelRatio),Zl.setSize(t.width,t.height)}(i)},setRenderer:t=>{s=t},update:function(e,r){if(O=r,I+=e,Xl&&function(t){if(Zl){const e=tu.parent;$l.add(tu),Zl.setRenderTarget(Xl),Zl.render($l,t),e&&e.add(tu),Zl.setRenderTarget(null)}}(r),C&&I>=o){if(!G.equals(d.matrixWorld)){I=0,G.copy(d.matrixWorld),n.updateTransforms&&N();const e=(new t.Vector3).setFromMatrixPosition(G);m.rootCenter.value.copy(e),m.rootNormal.value.copy(new t.Vector3(0,0,1).applyMatrix4(G).normalize()),L.copy(G).invert(),n.debug&&(l[C.root.id].matrixWorld.copy(w),l[C.root.id].applyMatrix4(G))}null==S?S=(new t.Matrix4).copy(r.matrixWorld):(R||function(e,n,r){const i=!e.matrixWorld.equals(n);return e instanceof t.PerspectiveCamera?i||void 0!==e.aspect:i}(r,S))&&(I=0,R=!1,C._frameNumber++,r.getWorldPosition(F),S.copy(r.matrixWorld),P(C,h,i,r))}},dispose:function(){for(x=!0,C._destroy();d.children.length>0;){const t=d.children[0];mu(t),d.remove(t)}for(;f.children.length>0;){const t=f.children[0];f.remove(t),t.geometry.dispose(),t.material.dispose()}A&&A.dispose(),y&&y.dispose()}}}}static async loadGeoJSON(e){const{url:n,height:r,featureToColor:i}=e;return he(n,Uh,{worker:!1,gis:{format:"binary"}}).then((e=>{const n=e,s=new t.BufferGeometry,o=n.polygons.positions.value.reduce(((t,e,n,i)=>{if(n%2==0){const s=[e,i[n+1],r??0],o=Hn.WGS84.cartographicToCartesian(s);t.push(...o)}return t}),[]);if(s.setAttribute("position",new t.Float32BufferAttribute(o,3)),i){const e=n.polygons.numericProps[i.feature].value.reduce(((t,e,n,r)=>{const s=i.colorMap(e);return t[3*n]=s.r,t[3*n+1]=s.g,t[3*n+2]=s.b,t}),[]);s.setAttribute("color",new t.Float32BufferAttribute(e,3))}s.setIndex(new t.BufferAttribute(n.polygons.triangles.value,1));const a=new t.MeshBasicMaterial({transparent:!0,vertexColors:!0,opacity:.5,blending:t.NormalBlending});return new t.Mesh(s,a)}))}}.load({url:this.data.url,renderer:this.el.sceneEl.renderer,options:{googleApiKey:this.data.googleApiKey,cesiumIONToken:this.data.cesiumIONToken,dracoDecoderPath:"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/draco",basisTranscoderPath:"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/basis",maximumScreenSpaceError:this.data.maximumSSE,maximumMemoryUsage:this.data.maximumMem,memoryCacheOverflow:128,pointCloudColoring:e,viewDistanceScale:this.data.distanceScale,wireframe:this.data.wireframe,updateTransforms:!0},viewport:this.viewport})},_initStats:function(){const t=document.createElement("a-entity");return this.el.sceneEl.appendChild(t),t.setAttribute("position","-0.5 0 -1"),t.setAttribute("textarea",{cols:30,rows:15,text:"",color:"white",disabledBackgroundColor:"#0c1e2c",disabled:!0}),t},_nextFrame:async function(){return new Promise(((t,e)=>{setTimeout((()=>{t()}),0)}))}})})(),i})())); \ No newline at end of file