!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three"),require("three/examples/jsm/loaders/GLTFLoader.js"),require("three/examples/jsm/loaders/DRACOLoader.js"),require("three/examples/jsm/loaders/KTX2Loader.js")):"function"==typeof define&&define.amd?define(["exports","three","three/examples/jsm/loaders/GLTFLoader.js","three/examples/jsm/loaders/DRACOLoader.js","three/examples/jsm/loaders/KTX2Loader.js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ThreeLoader3DTiles={},t.THREE,t.THREE,t.THREE,t.THREE)}(this,(function(t,e,r,n,s){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function i(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const a=Boolean("object"!=typeof process||"[object process]"!==String(process)||process.browser),c="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);c&&parseFloat(c[1]);function u(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const l={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},h=l.global||l.self||l.window||{},d="object"!=typeof process||"[object process]"!==String(process)||process.browser,f="function"==typeof importScripts,A="undefined"!=typeof window&&void 0!==window.orientation,m="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);function p(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}m&&parseFloat(m[1]);class B{constructor(t,e){p(this,"name",void 0),p(this,"workerThread",void 0),p(this,"isRunning",void 0),p(this,"result",void 0),p(this,"_resolve",void 0),p(this,"_reject",void 0),this.name=t,this.workerThread=e,this.isRunning=!0,this._resolve=()=>{},this._reject=()=>{},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){u(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){u(this.isRunning),this.isRunning=!1,this._reject(t)}}const g=new Map;function y(t){u(t.source&&!t.url||!t.source&&t.url);let e=g.get(t.source||t.url);return e||(t.url&&(e=function(t){if(!t.startsWith("http"))return t;return C((e=t,"try {\n importScripts('".concat(e,"');\n} catch (error) {\n console.error(error);\n throw error;\n}")));var e}(t.url),g.set(t.url,e)),t.source&&(e=C(t.source),g.set(t.source,e))),u(e),e}function C(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function b(t,e=!0,r){const n=r||new Set;if(t){if(w(t))n.add(t);else if(w(t.buffer))n.add(t.buffer);else if(ArrayBuffer.isView(t));else if(e&&"object"==typeof t)for(const r in t)b(t[r],e,n)}else;return void 0===r?Array.from(n):[]}function w(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&t instanceof MessagePort||("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}const T=()=>{};class E{static isSupported(){return"undefined"!=typeof Worker}constructor(t){p(this,"name",void 0),p(this,"source",void 0),p(this,"url",void 0),p(this,"terminated",!1),p(this,"worker",void 0),p(this,"onMessage",void 0),p(this,"onError",void 0),p(this,"_loadableURL","");const{name:e,source:r,url:n}=t;u(r||n),this.name=e,this.source=r,this.url=n,this.onMessage=T,this.onError=t=>console.log(t),this.worker=this._createBrowserWorker()}destroy(){this.onMessage=T,this.onError=T,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||b(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+="worker ".concat(this.name," from ").concat(this.url,". "),t.message&&(e+="".concat(t.message," in ")),t.lineno&&(e+=":".concat(t.lineno,":").concat(t.colno)),new Error(e)}_createBrowserWorker(){this._loadableURL=y({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}}class M{constructor(t){p(this,"name","unnamed"),p(this,"source",void 0),p(this,"url",void 0),p(this,"maxConcurrency",1),p(this,"maxMobileConcurrency",1),p(this,"onDebug",(()=>{})),p(this,"reuseWorkers",!0),p(this,"props",{}),p(this,"jobQueue",[]),p(this,"idleQueue",[]),p(this,"count",0),p(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,e=((t,e,r)=>t.done(r)),r=((t,e)=>t.error(e))){const n=new Promise((n=>(this.jobQueue.push({name:t,onMessage:e,onError:r,onStart:n}),this)));return this._startQueuedJob(),await n}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 r=new B(e.name,t);t.onMessage=t=>e.onMessage(r,t.type,t.payload),t.onError=t=>e.onError(r,t),e.onStart(r);try{await r.result}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){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{},reuseWorkers:!0};class I{static isSupported(){return E.isSupported()}static getWorkerFarm(t={}){return I._workerFarm=I._workerFarm||new I({}),I._workerFarm.setProps(t),I._workerFarm}constructor(t){p(this,"props",void 0),p(this,"workerPools",new Map),this.props={...v},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy()}setProps(t){this.props={...this.props,...t};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:r,url:n}=t;let s=this.workerPools.get(e);return s||(s=new M({name:e,source:r,url:n}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}p(I,"_workerFarm",void 0);var _={},F=Object.freeze(Object.assign(Object.create(null),_,{default:_}));const D="3.1.4",G={};async function R(t,e=null,r={}){return e&&(t=function(t,e,r){if(t.startsWith("http"))return t;const n=r.modules||{};if(n[t])return n[t];if(!d)return"modules/".concat(e,"/dist/libs/").concat(t);if(r.CDN)return u(r.CDN.startsWith("http")),"".concat(r.CDN,"/").concat(e,"@").concat(D,"/dist/libs/").concat(t);if(f)return"../src/libs/".concat(t);return"modules/".concat(e,"/src/libs/").concat(t)}(t,e,r)),G[t]=G[t]||async function(t){if(t.endsWith("wasm")){const e=await fetch(t);return await e.arrayBuffer()}if(!d)try{return F&&_.requireFromFile&&await _.requireFromFile(t)}catch{return null}if(f)return importScripts(t);const e=await fetch(t);return function(t,e){if(!d)return _.requireFromString&&_.requireFromString(t,e);if(f)return eval.call(h,t),null;const r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch(e){r.text=t}return document.body.appendChild(r),null}(await e.text(),t)}(t),await G[t]}async function S(t,e,r,n,s){const i=t.id,o=function(t,e={}){const r=e[t.id]||{},n="".concat(t.id,"-worker.js");let s=r.workerUrl;if(s||"compression"!==t.id||(s=e.workerUrl),"test"===e._workerType&&(s="modules/".concat(t.module,"/dist/").concat(n)),!s){let e=t.version;"latest"===e&&(e="latest");const r=e?"@".concat(e):"";s="https://unpkg.com/@loaders.gl/".concat(t.module).concat(r,"/dist/").concat(n)}return u(s),s}(t,r),a=I.getWorkerFarm(r).getWorkerPool({name:i,url:o});r=JSON.parse(JSON.stringify(r));const c=await a.startJob("process-on-worker",O.bind(null,s));c.postMessage("process",{input:e,options:r});const l=await c.result;return await l.result}async function O(t,e,r,n){switch(r){case"done":e.done(n);break;case"error":e.error(new Error(n.error));break;case"process":const{id:s,input:i,options:o}=n;try{const r=await t(i,o);e.postMessage("done",{id:s,result:r})}catch(t){const r=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:s,error:r})}break;default:console.warn("parse-with-worker unknown message ".concat(r))}}function x(t,e,r){if(t.byteLength<=e+r)return"";const n=new DataView(t);let s="";for(let t=0;t=0),o(e>0),t+(e-1)&~(e-1)}function P(t,e,r){let n;if(t instanceof ArrayBuffer)n=new Uint8Array(t);else{const e=t.byteOffset,r=t.byteLength;n=new Uint8Array(t.buffer||t.arrayBuffer,e,r)}return e.set(n,r),r+J(n.byteLength,4)}async function j(t){const e=[];for await(const r of t)e.push(r);return function(...t){const e=t.map((t=>t instanceof ArrayBuffer?new Uint8Array(t):t)),r=e.reduce(((t,e)=>t+e.byteLength),0),n=new Uint8Array(r);let s=0;for(const t of e)n.set(t,s),s+=t.byteLength;return n.buffer}(...e)}function k(){let t;if("undefined"!=typeof window&&window.performance)t=window.performance.now();else if("undefined"!=typeof process&&process.hrtime){const e=process.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}class V{constructor(t,e){p(this,"name",void 0),p(this,"type",void 0),p(this,"sampleSize",1),p(this,"time",void 0),p(this,"count",void 0),p(this,"samples",void 0),p(this,"lastTiming",void 0),p(this,"lastSampleTime",void 0),p(this,"lastSampleCount",void 0),p(this,"_count",0),p(this,"_time",0),p(this,"_samples",0),p(this,"_startTime",0),p(this,"_timerPending",!1),this.name=t,this.type=e,this.reset()}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=k(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(k()-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}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}_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 K{constructor(t){p(this,"id",void 0),p(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 in this.stats)this.stats[t].reset();return this}forEach(t){for(const e in this.stats)t(this.stats[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){if(!t||!t.name)return null;const{name:e,type:r}=t;return this.stats[e]||(this.stats[e]=t instanceof V?t:new V(e,r)),this.stats[e]}}const Q={id:"request-scheduler",throttleRequests:!0,maxRequests:6};class q{constructor(t={}){p(this,"props",void 0),p(this,"stats",void 0),p(this,"activeRequestCount",0),p(this,"requestQueue",[]),p(this,"requestMap",new Map),p(this,"deferredUpdate",null),this.props={...Q,...t},this.stats=new K({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 r={handle:t,priority:0,getPriority:e},n=new Promise((t=>(r.resolve=t,r)));return this.requestQueue.push(r),this.requestMap.set(t,n),this._issueNewRequests(),n}_issueRequest(t){const{handle:e,resolve:r}=t;let n=!1;const s=()=>{n||(n=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:s}):Promise.resolve({done:s})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout((()=>this._issueNewRequestsAsync()),0))}_issueNewRequestsAsync(){this.deferredUpdate=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)}}const z={};function W(t){const e=t&&t.lastIndexOf("/");return e>=0?t.substr(0,e):""}const Y=t=>"function"==typeof t,X=t=>null!==t&&"object"==typeof t,Z=t=>X(t)&&t.constructor==={}.constructor,$=t=>"undefined"!=typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,tt=t=>"undefined"!=typeof Blob&&t instanceof Blob,et=t=>(t=>"undefined"!=typeof ReadableStream&&t instanceof ReadableStream||X(t)&&Y(t.tee)&&Y(t.cancel)&&Y(t.getReader))(t)||(t=>X(t)&&Y(t.read)&&Y(t.pipe)&&(t=>"boolean"==typeof t)(t.readable))(t),rt=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,nt=/^([-\w.]+\/[-\w.+]+)/;function st(t){const e=nt.exec(t);return e?e[1]:t}function it(t){const e=rt.exec(t);return e?e[1]:""}const ot=/\?.*/;function at(t){if($(t)){const e=ct(t.url||"");return{url:e,type:st(t.headers.get("content-type")||"")||it(e)}}return tt(t)?{url:ct(t.name||""),type:t.type||""}:"string"==typeof t?{url:ct(t),type:it(t)}:{url:"",type:""}}function ct(t){return t.replace(ot,"")}async function ut(t){if($(t))return t;const e={},r=function(t){return $(t)?t.headers["content-length"]||-1:tt(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}(t);r>=0&&(e["content-length"]=String(r));const{url:n,type:s}=at(t);s&&(e["content-type"]=s);const i=await async function(t){const e=5;if("string"==typeof t)return"data:,".concat(t.slice(0,e));if(t instanceof Blob){const e=t.slice(0,5);return await new Promise((t=>{const r=new FileReader;r.onload=e=>{var r;return t(null==e||null===(r=e.target)||void 0===r?void 0:r.result)},r.readAsDataURL(e)}))}if(t instanceof ArrayBuffer){const r=function(t){let e="";const r=new Uint8Array(t);for(let t=0;t=0)}()}const dt={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},ft=dt.window||dt.self||dt.global,At=dt.process||{},mt="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";ht();class pt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";p(this,"storage",void 0),p(this,"id",void 0),p(this,"config",{}),this.storage=function(t){try{const e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch(t){return null}}(r),this.id=t,this.config={},Object.assign(this.config,e),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){return this.config={},this.updateConfiguration(t)}updateConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}_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 Bt(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const s=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));const i=t.width*r,o=t.height*r,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(s,");"),"background-size:".concat(i,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}let gt;function yt(t){return"string"==typeof t?gt[t.toUpperCase()]||gt.WHITE:t}function Ct(t,e){if(!t)throw new Error(e||"Assertion failed")}function bt(){let t;var e,r;if(ht&&"performance"in ft)t=null==ft||null===(e=ft.performance)||void 0===e||null===(r=e.now)||void 0===r?void 0:r.call(e);else if("hrtime"in At){var n;const e=null==At||null===(n=At.hrtime)||void 0===n?void 0:n.call(At);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"}(gt||(gt={}));const wt={debug:ht&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Tt={enabled:!0,level:0};function Et(){}const Mt={},vt={once:!0};class It{constructor(){let{id:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};p(this,"id",void 0),p(this,"VERSION",mt),p(this,"_startTs",bt()),p(this,"_deltaTs",bt()),p(this,"_storage",void 0),p(this,"userData",{}),p(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this._storage=new pt("__probe-".concat(this.id,"__"),Tt),this.userData={},this.timeStamp("".concat(this.id," started")),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof t[r]&&(e.find((t=>r===t))||(t[r]=t[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((bt()-this._startTs).toPrecision(10))}getDelta(){return Number((bt()-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.updateConfiguration({enabled:t}),this}setLevel(t){return this._storage.updateConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.updateConfiguration({[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,wt.warn,arguments,vt)}error(t){return this._getLogFunction(0,t,wt.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,wt.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,wt.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s{const e=Bt(t,r,n);console.log(...e)},t.src=e,Et}const s=e.nodeName||"";if("img"===s.toLowerCase())return console.log(...Bt(e,r,n)),Et;if("canvas"===s.toLowerCase()){const t=new Image;return t.onload=()=>console.log(...Bt(t,r,n)),t.src=e.toDataURL(),Et}return Et}({image:n,message:s,scale:i}):function(t){let{image:e,message:r="",scale:n=1}=t,s=null;try{s=module.require("asciify-image")}catch(t){}if(s)return()=>s(e,{fit:"box",width:"".concat(Math.round(80*n),"%")}).then((t=>console.log(t)));return Et}({image:n,message:s,scale:i}):Et}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||Et)}group(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const n=Ft({logLevel:t,message:e,opts:r}),{collapsed:s}=r;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(t,e,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Et)}withGroup(t,e,r){this.group(t,e)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=_t(t)}_getLogFunction(t,e,r,n,s){if(this._shouldLog(t)){s=Ft({logLevel:t,message:e,args:n,opts:s}),Ct(r=r||s.method),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=bt();const i=s.tag||s.message;if(s.once){if(Mt[i])return Et;Mt[i]=bt()}return e=function(t,e,r){if("string"==typeof e){const o=r.time?function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const r=Math.max(e-t.length,0);return"".concat(" ".repeat(r)).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}(r.total)):"";e=r.time?"".concat(t,": ").concat(o," ").concat(e):"".concat(t,": ").concat(e),n=e,s=r.color,i=r.background,ht||"string"!=typeof n||(s&&(s=yt(s),n="[".concat(s,"m").concat(n,"")),i&&(s=yt(i),n="[".concat(i+10,"m").concat(n,""))),e=n}var n,s,i;return e}(this.id,s.message,s),r.bind(console,e,...s.args)}return Et}}function _t(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 Ft(t){const{logLevel:e,message:r}=t;t.logLevel=_t(e);const n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":void 0!==r&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e)}"function"==typeof t.message&&(t.message=t.message());const s=typeof t.message;return Ct("string"===s||"object"===s),Object.assign(t,{args:n},t.opts)}function Dt(t){for(const e in t)for(const r in t[e])return r||"untitled";return"empty"}p(It,"VERSION",mt);const Gt=new It({id:"loaders.gl"});class Rt{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const St={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){p(this,"console",void 0),this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},Ot={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function xt(){globalThis.loaders=globalThis.loaders||{};const{loaders:t}=globalThis;return t._state=t._state||{},t._state}const Ut=()=>{const t=xt();return t.globalOptions=t.globalOptions||{...St},t.globalOptions};function Lt(t,e,r,n){return r=r||[],function(t,e){Ht(t,null,St,Ot,e);for(const r of e){const n=t&&t[r.id]||{},s=r.options&&r.options[r.id]||{},i=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};Ht(n,r.id,s,i,e)}}(t,r=Array.isArray(r)?r:[r]),function(t,e,r){const n={...t.options||{}};(function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)})(n,r),null===n.log&&(n.log=new Rt);return Pt(n,Ut()),Pt(n,e),n}(e,t,n)}function Nt(t,e){const r=Ut(),n=t||r;return"function"==typeof n.fetch?n.fetch:X(n.fetch)?t=>lt(t,n):null!=e&&e.fetch?null==e?void 0:e.fetch:lt}function Ht(t,e,r,n,s){const i=e||"Top level",o=e?"".concat(e,"."):"";for(const a in t){const c=!e&&X(t[a]),u="baseUri"===a&&!e,l="workerUrl"===a&&e;if(!(a in r)&&!u&&!l)if(a in n)Gt.warn("".concat(i," loader option '").concat(o).concat(a,"' no longer supported, use '").concat(n[a],"'"))();else if(!c){const t=Jt(a,s);Gt.warn("".concat(i," loader option '").concat(o).concat(a,"' not recognized. ").concat(t))()}}}function Jt(t,e){const r=t.toLowerCase();let n="";for(const s of e)for(const e in s.options){if(t===e)return"Did you mean '".concat(s.id,".").concat(e,"'?");const i=e.toLowerCase();(r.startsWith(i)||i.startsWith(r))&&(n=n||"Did you mean '".concat(s.id,".").concat(e,"'?"))}return n}function Pt(t,e){for(const r in e)if(r in e){const n=e[r];Z(n)&&Z(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function jt(t){var e;if(!t)return!1;Array.isArray(t)&&(t=t[0]);return Array.isArray(null===(e=t)||void 0===e?void 0:e.extensions)}function kt(t){var e,r;let n;return o(t,"null loader"),o(jt(t),"invalid loader"),Array.isArray(t)&&(n=t[1],t=t[0],t={...t,options:{...t.options,...n}}),(null!==(e=t)&&void 0!==e&&e.parseTextSync||null!==(r=t)&&void 0!==r&&r.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}function Vt(){return(()=>{const t=xt();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry})()}const Kt=/\.([^.]+)$/;function Qt(t,e=[],r,n){if(!qt(t))return null;if(e&&!Array.isArray(e))return kt(e);let s=[];e&&(s=s.concat(e)),null!=r&&r.ignoreRegisteredLoaders||s.push(...Vt()),function(t){for(const e of t)kt(e)}(s);const i=function(t,e,r,n){const{url:s,type:i}=at(t),o=s||(null==n?void 0:n.url);let a=null;null!=r&&r.mimeType&&(a=Wt(e,null==r?void 0:r.mimeType));return a=a||function(t,e){const r=e&&Kt.exec(e),n=r&&r[1];return n?function(t,e){e=e.toLowerCase();for(const r of t)for(const t of r.extensions)if(t.toLowerCase()===e)return r;return null}(t,n):null}(e,o),a=a||Wt(e,i),a=a||function(t,e){if(!e)return null;for(const r of t)if("string"==typeof e){if(Yt(e,r))return r}else if(ArrayBuffer.isView(e)){if(Xt(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer){if(Xt(e,0,r))return r}return null}(e,t),a=a||Wt(e,null==r?void 0:r.fallbackMimeType),a}(t,s,r,n);if(!(i||null!=r&&r.nothrow))throw new Error(zt(t));return i}function qt(t){return!(t instanceof Response&&204===t.status)}function zt(t){const{url:e,type:r}=at(t);let n="No valid loader found (";n+=e?"".concat(function(t){const e=t&&t.lastIndexOf("/");return e>=0?t.substr(e+1):""}(e),", "):"no url provided, ",n+="MIME type: ".concat(r?'"'.concat(r,'"'):"not provided",", ");const s=t?function(t,e=5){if("string"==typeof t)return t.slice(0,e);if(ArrayBuffer.isView(t))return Zt(t.buffer,t.byteOffset,e);if(t instanceof ArrayBuffer){return Zt(t,0,e)}return""}(t):"";return n+=s?' first bytes: "'.concat(s,'"'):"first bytes: not available",n+=")",n}function Wt(t,e){for(const r of t){if(r.mimeTypes&&r.mimeTypes.includes(e))return r;if(e==="application/x.".concat(r.id))return r}return null}function Yt(t,e){if(e.testText)return e.testText(t);return(Array.isArray(e.tests)?e.tests:[e.tests]).some((e=>t.startsWith(e)))}function Xt(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some((n=>function(t,e,r,n){if(n instanceof ArrayBuffer)return function(t,e,r){if(r=r||t.byteLength,t.byteLength60?"".concat(e.slice(60),"..."):e}catch(t){}return e}(t);throw new Error(e)}}(r),e.binary?await r.arrayBuffer():await r.text()}if(et(t)&&(t=ee(t,r)),(s=t)&&"function"==typeof s[Symbol.iterator]||(t=>t&&"function"==typeof t[Symbol.asyncIterator])(t))return j(t);var s;throw new Error(re)}async function se(t,e,r,n){u(!n||"object"==typeof n),!e||Array.isArray(e)||jt(e)||(n=void 0,r=e,e=void 0),t=await t,r=r||{};const{url:s}=at(t),i=function(t,e){if(!e&&t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){const t=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...t]:t}return r&&r.length?r:null}(e,n),o=await async function(t,e=[],r,n){if(!qt(t))return null;let s=Qt(t,e,{...r,nothrow:!0},n);if(s)return s;if(tt(t)&&(s=Qt(t=await t.slice(0,10).arrayBuffer(),e,r,n)),!(s||null!=r&&r.nothrow))throw new Error(zt(t));return s}(t,i,r);return o?(n=function(t,e,r=null){if(r)return r;const n={fetch:Nt(e,t),...t};return Array.isArray(n.loaders)||(n.loaders=null),n}({url:s,parse:se,loaders:i},r=Lt(r,o,i,s),n),await async function(t,e,r,n){if(function(t,e="3.1.4"){u(t,"no worker provided");const r=t.version}(t),e=await ne(e,t,r),t.parseTextSync&&"string"==typeof e)return r.dataType="text",t.parseTextSync(e,r,n,t);if(function(t,e){return!!I.isSupported()&&t.worker&&(null==e?void 0:e.worker)}(t,r))return await S(t,e,r,0,se);if(t.parseText&&"string"==typeof e)return await t.parseText(e,r,n,t);if(t.parse)return await t.parse(e,r,n,t);throw u(!t.parseSync),new Error("".concat(t.id," loader - no parser found and worker is disabled"))}(o,t,r,n)):null}async function ie(t,e,r,n){Array.isArray(e)||jt(e)||(r=e,e=void 0);const s=Nt(r);let i=t;return"string"==typeof t&&(i=await s(t)),tt(t)&&(i=await s(t)),await se(i,e,r)}function oe(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const ae=1/Math.PI*180,ce=1/180*Math.PI,ue={};function le(t,{precision:e=ue.precision||4}={}){return t=function(t){return Math.round(t/ue.EPSILON)*ue.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function he(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function de(t,e,r){if(he(t)){r=r||((n=t).clone?n.clone():new Array(n.length));for(let n=0;nt*ce),e)}(t)}function Ae(t){return me(t)}function me(t,e){return de(t,(t=>t*ae),e)}function pe(t,e,r){const n=ue.EPSILON;r&&(ue.EPSILON=r);try{if(t===e)return!0;if(he(t)&&he(e)){if(t.length!==e.length)return!1;for(let r=0;r0?", ":"")+le(this[r],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&&t2*Math.PI)throw Error("radians");const i=t/2,o=r*Math.tan(i),a=o*e;return(new rr).ortho({left:-a,right:a,bottom:-o,top:o,near:n,far:s})}perspective({fovy:t,fov:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:s=500}={}){if((t=t||e)>2*Math.PI)throw Error("radians");return function(t,e,r,n,s){var i,o=1/Math.tan(e/2);t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,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!=s&&s!==1/0?(i=1/(n-s),t[10]=(s+n)*i,t[14]=2*s*n*i):(t[10]=-1,t[14]=-2*n)}(this,t,r,n,s),this.check()}determinant(){return function(t){var e=t[0],r=t[1],n=t[2],s=t[3],i=t[4],o=t[5],a=t[6],c=t[7],u=t[8],l=t[9],h=t[10],d=t[11],f=t[12],A=t[13],m=t[14],p=t[15];return(e*o-r*i)*(h*p-d*m)-(e*a-n*i)*(l*p-d*A)+(e*c-s*i)*(l*m-h*A)+(r*a-n*o)*(u*p-d*f)-(r*c-s*o)*(u*m-h*f)+(n*c-s*a)*(u*A-l*f)}(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=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const r=this.getScale(e||[-0,-0,-0]),n=1/r[0],s=1/r[1],i=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*s,t[2]=this[2]*i,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*s,t[6]=this[6]*i,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*s,t[10]=this[10]*i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t=[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const r=this.getScale(e||[-0,-0,-0]),n=1/r[0],s=1/r[1],i=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*s,t[2]=this[2]*i,t[3]=this[4]*n,t[4]=this[5]*s,t[5]=this[6]*i,t[6]=this[8]*n,t[7]=this[9]*s,t[8]=this[10]*i,t}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],s=e[3],i=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[11]=e[14],t[12]=s,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){var r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],l=e[8],h=e[9],d=e[10],f=e[11],A=e[12],m=e[13],p=e[14],B=e[15],g=r*a-n*o,y=r*c-s*o,C=r*u-i*o,b=n*c-s*a,w=n*u-i*a,T=s*u-i*c,E=l*m-h*A,M=l*p-d*A,v=l*B-f*A,I=h*p-d*m,_=h*B-f*m,F=d*B-f*p,D=g*F-y*_+C*I+b*v-w*M+T*E;D&&(D=1/D,t[0]=(a*F-c*_+u*I)*D,t[1]=(s*_-n*F-i*I)*D,t[2]=(m*T-p*w+B*b)*D,t[3]=(d*w-h*T-f*b)*D,t[4]=(c*v-o*F-u*M)*D,t[5]=(r*F-s*v+i*M)*D,t[6]=(p*C-A*T-B*y)*D,t[7]=(l*T-d*C+f*y)*D,t[8]=(o*_-a*v+u*E)*D,t[9]=(n*v-r*_-i*E)*D,t[10]=(A*w-m*C+B*g)*D,t[11]=(h*C-l*w-f*g)*D,t[12]=(a*M-o*I-c*E)*D,t[13]=(r*I-n*M+s*E)*D,t[14]=(m*y-A*b-p*g)*D,t[15]=(l*b-h*y+d*g)*D)}(this,this),this.check()}multiplyLeft(t){return Ye(this,t,this),this.check()}multiplyRight(t){return Ye(this,this,t),this.check()}rotateX(t){return function(t,e,r){var n=Math.sin(r),s=Math.cos(r),i=e[4],o=e[5],a=e[6],c=e[7],u=e[8],l=e[9],h=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]=i*s+u*n,t[5]=o*s+l*n,t[6]=a*s+h*n,t[7]=c*s+d*n,t[8]=u*s-i*n,t[9]=l*s-o*n,t[10]=h*s-a*n,t[11]=d*s-c*n}(this,this,t),this.check()}rotateY(t){return function(t,e,r){var n=Math.sin(r),s=Math.cos(r),i=e[0],o=e[1],a=e[2],c=e[3],u=e[8],l=e[9],h=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]=i*s-u*n,t[1]=o*s-l*n,t[2]=a*s-h*n,t[3]=c*s-d*n,t[8]=i*n+u*s,t[9]=o*n+l*s,t[10]=a*n+h*s,t[11]=c*n+d*s}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){var n=Math.sin(r),s=Math.cos(r),i=e[0],o=e[1],a=e[2],c=e[3],u=e[4],l=e[5],h=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]=i*s+u*n,t[1]=o*s+l*n,t[2]=a*s+h*n,t[3]=c*s+d*n,t[4]=u*s-i*n,t[5]=l*s-o*n,t[6]=h*s-a*n,t[7]=d*s-c*n}(this,this,t),this.check()}rotateXYZ([t,e,r]){return this.rotateX(t).rotateY(e).rotateZ(r)}rotateAxis(t,e){return function(t,e,r,n){var s,i,o,a,c,u,l,h,d,f,A,m,p,B,g,y,C,b,w,T,E,M,v,I,_=n[0],F=n[1],D=n[2],G=Math.hypot(_,F,D);GEe?(s=Math.acos(i),o=Math.sin(s),a=Math.sin((1-n)*s)/o,c=Math.sin(n*s)/o):(a=1-n,c=n),t[0]=a*u+c*f,t[1]=a*l+c*A,t[2]=a*h+c*m,t[3]=a*d+c*p,t}function ar(t,e){var r,n=e[0]+e[4]+e[8];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{var s=0;e[4]>e[0]&&(s=1),e[8]>e[3*s+s]&&(s=2);var i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(e[3*s+s]-e[3*i+i]-e[3*o+o]+1),t[s]=.5*r,r=.5/r,t[3]=(e[3*i+o]-e[3*o+i])*r,t[i]=(e[3*i+s]+e[3*s+i])*r,t[o]=(e[3*o+s]+e[3*s+o])*r}return t}var cr,ur,lr,hr=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},dr=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},fr=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},Ar=function(t,e,r,n){var s=e[0],i=e[1],o=e[2],a=e[3];return t[0]=s+n*(r[0]-s),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t[3]=a+n*(r[3]-a),t},mr=function(t){var e=t[0],r=t[1],n=t[2],s=t[3];return Math.hypot(e,r,n,s)},pr=function(t){var e=t[0],r=t[1],n=t[2],s=t[3];return e*e+r*r+n*n+s*s},Br=function(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=r*r+n*n+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=n*o,t[2]=s*o,t[3]=i*o,t},gr=(cr=Ge(),ur=Se(1,0,0),lr=Se(0,1,0),function(t,e,r){var n=Oe(e,r);return n<-.999999?(xe(cr,ur,e),Ne(cr)<1e-6&&xe(cr,lr,e),function(t,e){var r=e[0],n=e[1],s=e[2],i=r*r+n*n+s*s;i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i}(cr,cr),sr(t,cr,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(xe(cr,e,r),t[0]=cr[0],t[1]=cr[1],t[2]=cr[2],t[3]=1+n,Br(t,t))});nr(),nr(),function(){var t=new Me(9);Me!=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 yr=[0,0,0,1];class Cr extends Be{constructor(t=0,e=0,r=0,n=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,r,n)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,r,n){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this.check()}fromMatrix3(t){return ar(this,t),this.check()}identity(){return function(t){t[0]=0,t[1]=0,t[2]=0,t[3]=1}(this),this.check()}fromAxisRotation(t,e){return sr(this,t,e),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=ge(t)}get y(){return this[1]}set y(t){this[1]=ge(t)}get z(){return this[2]}set z(t){this[2]=ge(t)}get w(){return this[3]}set w(t){this[3]=ge(t)}len(){return mr(this)}lengthSquared(){return pr(this)}dot(t,e){if(void 0!==e)throw new Error("Quaternion.dot only takes one argument");return fr(this,t)}rotationTo(t,e){return gr(this,t,e),this.check()}add(t,e){if(void 0!==e)throw new Error("Quaternion.add only takes one argument");return hr(this,this,t),this.check()}calculateW(){return function(t,e){var r=e[0],n=e[1],s=e[2];t[0]=r,t[1]=n,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s))}(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){var r=e[0],n=e[1],s=e[2],i=e[3],o=r*r+n*n+s*s+i*i,a=o?1/o:0;t[0]=-r*a,t[1]=-n*a,t[2]=-s*a,t[3]=i*a}(this,this),this.check()}lerp(t,e,r){return Ar(this,t,e,r),this.check()}multiplyRight(t,e){return oe(!e),ir(this,this,t),this.check()}multiplyLeft(t,e){return oe(!e),ir(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,r){r*=.5;var n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+o*a,t[1]=s*c+i*a,t[2]=i*c-s*a,t[3]=o*c-n*a}(this,this,t),this.check()}rotateY(t){return function(t,e,r){r*=.5;var n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c-i*a,t[1]=s*c+o*a,t[2]=i*c+n*a,t[3]=o*c-s*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){r*=.5;var n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+s*a,t[1]=s*c-n*a,t[2]=i*c+o*a,t[3]=o*c-i*a}(this,this,t),this.check()}scale(t){return dr(this,this,t),this.check()}slerp(t,e,r){switch(arguments.length){case 1:({start:t=yr,target:e,ratio:r}=arguments[0]);break;case 2:[e,r]=arguments,t=this}return or(this,t,e,r),this.check()}transformVector4(t,e=t){return function(t,e,r){var n=e[0],s=e[1],i=e[2],o=r[0],a=r[1],c=r[2],u=r[3],l=u*n+a*i-c*s,h=u*s+c*n-o*i,d=u*i+o*s-a*n,f=-o*n-a*s-c*i;t[0]=l*u+f*-o+h*-c-d*-a,t[1]=h*u+f*-a+d*-o-l*-c,t[2]=d*u+f*-c+l*-a-h*-o,t[3]=e[3]}(e,t,this),ye(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t,e){return this.multiplyLeft(t,e)}multiply(t,e){return this.multiplyRight(t,e)}}var br=.1,wr=1e-12,Tr=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;const Er=t=>t,Mr=new Pe;function vr(t,e=Mr){return function(t,e,r=Er){return he(t)?(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]):"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z),e}(t,e,ue._cartographicRadians?Er:fe)}function Ir(t,e){return function(t,e,r=Er){return he(e)?(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]):"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]),e}(t,e,ue._cartographicRadians?Er:Ae)}const _r=new Pe,Fr=new Pe,Dr=new Pe;const Gr=new Pe,Rr={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"}},Sr={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Or={east:new Pe,north:new Pe,up:new Pe,west:new Pe,south:new Pe,down:new Pe},xr=new Pe,Ur=new Pe,Lr=new Pe;function Nr(t,e,r,n,s,i){const o=Rr[e]&&Rr[e][r];let a,c,u;oe(o&&(!n||n===o));const l=Gr.copy(s);if(pe(l.x,0,1e-14)&&pe(l.y,0,1e-14)){const t=Math.sign(l.z);a=xr.fromArray(Sr[e]),"east"!==e&&"west"!==e&&a.scale(t),c=Ur.fromArray(Sr[r]),"east"!==r&&"west"!==r&&c.scale(t),u=Lr.fromArray(Sr[n]),"east"!==n&&"west"!==n&&u.scale(t)}else{const{up:s,east:i,north:o}=Or;i.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,s),o.copy(s).cross(i);const{down:h,west:d,south:f}=Or;h.copy(s).scale(-1),d.copy(i).scale(-1),f.copy(o).scale(-1),a=Or[e],c=Or[r],u=Or[n]}return i[0]=a.x,i[1]=a.y,i[2]=a.z,i[3]=0,i[4]=c.x,i[5]=c.y,i[6]=c.z,i[7]=0,i[8]=u.x,i[9]=u.y,i[10]=u.z,i[11]=0,i[12]=l.x,i[13]=l.y,i[14]=l.z,i[15]=1,i}const Hr=new Pe,Jr=new Pe,Pr=new Pe,jr=new Pe,kr=new Pe,Vr=new Pe;let Kr;class Qr{static get WGS84(){return Kr=Kr||new Qr(6378137,6378137,6356752.314245179),Kr}constructor(t=0,e=0,r=0){oe(t>=0),oe(e>=0),oe(r>=0),this.radii=new Pe(t,e,r),this.radiiSquared=new Pe(t*t,e*e,r*r),this.radiiToTheFourth=new Pe(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new Pe(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new Pe(0===t?0:1/(t*t),0===e?0:1/(e*e),0===r?0:1/(r*r)),this.minimumRadius=Math.min(t,e,r),this.maximumRadius=Math.max(t,e,r),this.centerToleranceSquared=br,0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const r=Jr,n=Pr,[,,s]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const i=Math.sqrt(r.dot(n));return n.scale(1/i),r.scale(s),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){Vr.from(t);const r=this.scaleToGeodeticSurface(Vr,jr);if(!r)return;const n=this.geodeticSurfaceNormal(r,Jr),s=kr;s.copy(Vr).subtract(r);return Ir([Math.atan2(n.y,n.x),Math.asin(n.z),Math.sign(Oe(s,Vr))*Re(s)],e)}eastNorthUpToFixedFrame(t,e=new rr){return Nr(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,s=new rr){return Nr(this,t,e,r,n,s)}geocentricSurfaceNormal(t,e=[0,0,0]){return Hr.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=vr(t),n=r[0],s=r[1],i=Math.cos(s);return Hr.set(i*Math.cos(n),i*Math.sin(n),Math.sin(s)).normalize(),Hr.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return Hr.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=new Pe){const{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:i}=e;_r.from(t);const o=t.x,a=t.y,c=t.z,u=n.x,l=n.y,h=n.z,d=o*o*u*u,f=a*a*l*l,A=c*c*h*h,m=d+f+A,p=Math.sqrt(1/m);if(!Number.isFinite(p))return;const B=Fr;if(B.copy(t).scale(p),mwr);return _r.scale([w,T,E]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){jr.from(t);const r=jr.x,n=jr.y,s=jr.z,i=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*i.x+n*n*i.y+s*s*i.z);return jr.multiplyScalar(o).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return jr.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return jr.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){oe(pe(this.radii.x,this.radii.y,Tr)),oe(this.radii.z>0),jr.from(t);const n=jr.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return jr.set(0,0,n).to(r)}}class qr{constructor(t,e,r){p(this,"item",void 0),p(this,"previous",void 0),p(this,"next",void 0),this.item=t,this.previous=e,this.next=r}}class zr{constructor(){p(this,"head",null),p(this,"tail",null),p(this,"_length",0)}get length(){return this._length}add(t){const e=new qr(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 r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,++this._length}}function Wr(t){return null!=t}class Yr{constructor(){p(this,"_list",void 0),p(this,"_sentinel",void 0),p(this,"_trimTiles",void 0),this._list=new zr,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){const e=t._cacheNode;Wr(e)&&this._list.splice(this._sentinel,e)}add(t,e,r){Wr(e._cacheNode)||(e._cacheNode=this._list.add(e),r&&r(t,e))}unloadTile(t,e,r){const n=e._cacheNode;Wr(n)&&(this._list.remove(n),e._cacheNode=void 0,r&&r(t,e))}unloadTiles(t,e){const r=this._trimTiles;this._trimTiles=!1;const n=this._list,s=1024*t.maximumMemoryUsage*1024,i=this._sentinel;let o=n.head;for(;o!==i&&(t.gpuMemoryUsageInBytes>s||r);){const r=o.item;o=o.next,this.unloadTile(t,r,e)}}trim(){this._trimTiles=!0}}const Xr=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new Pe,new Pe;const Zr=new Pe,$r=new Pe;class tn{constructor(t=[0,0,0],e=0){this.radius=-0,this.center=new Pe,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=Zr.from(e),this.center=(new Pe).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new tn(this.center,this.radius)}union(t){const e=this.center,r=this.radius,n=t.center,s=t.radius,i=Zr.copy(n).subtract(e),o=i.magnitude();if(r>=o+s)return this.clone();if(s>=o+r)return t.clone();const a=.5*(r+o+s);return $r.copy(i).scale((-r+a)/o).add(e),this.center.copy($r),this.radius=a,this}expand(t){const e=(t=Zr.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){var r=e[0],n=e[1],s=e[2],i=e[4],o=e[5],a=e[6],c=e[8],u=e[9],l=e[10];return t[0]=Math.hypot(r,n,s),t[1]=Math.hypot(i,o,a),t[2]=Math.hypot(c,u,l),t}(Zr,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=(t=Zr.from(t)).subtract(this.center);return Math.max(0,e.len()-this.radius)}intersectPlane(t){const e=this.center,r=this.radius,n=t.normal.dot(e)+t.distance;return n<-r?Xr.OUTSIDE:n=a?Xr.INSIDE:Xr.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=rn.from(t).subtract(this.center),r=this.halfAxes,n=r.getColumn(0,nn),s=r.getColumn(1,sn),i=r.getColumn(2,on),o=n.magnitude(),a=s.magnitude(),c=i.magnitude();n.normalize(),s.normalize(),i.normalize();let u,l=0;return u=Math.abs(e.dot(n))-o,u>0&&(l+=u*u),u=Math.abs(e.dot(s))-a,u>0&&(l+=u*u),u=Math.abs(e.dot(i))-c,u>0&&(l+=u*u),l}computePlaneDistances(t,e,r=[-0,-0]){let n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;const i=this.center,o=this.halfAxes,a=o.getColumn(0,nn),c=o.getColumn(1,sn),u=o.getColumn(2,on),l=an.copy(a).add(c).add(u).add(i),h=cn.copy(l).subtract(t);let d=e.dot(h);return n=Math.min(d,n),s=Math.max(d,s),l.copy(i).add(a).add(c).subtract(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),l.copy(i).add(a).subtract(c).add(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),l.copy(i).add(a).subtract(c).subtract(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),i.copy(l).subtract(a).add(c).add(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),i.copy(l).subtract(a).add(c).subtract(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),i.copy(l).subtract(a).subtract(c).add(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),i.copy(l).subtract(a).subtract(c).subtract(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),r[0]=n,r[1]=s,r}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,nn);e.transformAsPoint(t);const r=this.halfAxes.getColumn(1,sn);r.transformAsPoint(t);const n=this.halfAxes.getColumn(2,on);return n.transformAsPoint(t),this.halfAxes=new We([...e,...r,...n]),this}getTransform(){throw new Error("not implemented")}}const yn=new Pe,Cn=new Pe;class bn{constructor(t=[0,0,1],e=0){this.normal=new Pe,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return oe(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=yn.from(t),this.normal.from(e).normalize();const r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,e,r,n){return this.normal.set(t,e,r),oe(pe(this.normal.len(),1)),this.distance=n,this}clone(t){return new bn(this.normal,this.distance)}equals(t){return pe(this.distance,t.distance)&&pe(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=Cn.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,e)}projectPointOntoPlane(t,e=[0,0,0]){t=yn.from(t);const r=this.getPointDistance(t),n=Cn.copy(this.normal).scale(r);return t.subtract(n).to(e)}}const wn=[new Pe([1,0,0]),new Pe([0,1,0]),new Pe([0,0,1])],Tn=new Pe,En=new Pe;new bn(new Pe(1,0,0),0);class Mn{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(t=[]){this.planes=t,oe(this.planes.every((t=>t instanceof bn)))}fromBoundingSphere(t){this.planes.length=2*wn.length;const e=t.center,r=t.radius;let n=0;for(const t of wn){let s=this.planes[n],i=this.planes[n+1];s||(s=this.planes[n]=new bn),i||(i=this.planes[n+1]=new bn);const o=Tn.copy(t).scale(-r).add(e);t.dot(o),s.fromPointNormal(o,t);const a=Tn.copy(t).scale(r).add(e),c=En.copy(t).negate();c.dot(a),i.fromPointNormal(a,c),n+=2}return this}computeVisibility(t){oe(t);let e=Xr.INSIDE;for(const r of this.planes){switch(t.intersectPlane(r)){case Xr.OUTSIDE:return Xr.OUTSIDE;case Xr.INTERSECTING:e=Xr.INTERSECTING}}return e}computeVisibilityWithPlaneMask(t,e){if(oe(t,"boundingVolume is required."),oe(Number.isFinite(e),"parentPlaneMask is required."),e===Mn.MASK_OUTSIDE||e===Mn.MASK_INSIDE)return e;let r=Mn.MASK_INSIDE;const n=this.planes;for(let s=0;s0),oe(e>0),oe(r>0),oe(n);const s=1/this.near;let i=this.top*s;const o=2*r*i/e;i=this.right*s;const a=2*r*i/t;return n.x=a,n.y=o,n}}function Rn(t){oe(Number.isFinite(t.right)&&Number.isFinite(t.left)&&Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.near)&&Number.isFinite(t.far));const{top:e,bottom:r,right:n,left:s,near:i,far:o}=t;e===t._top&&r===t._bottom&&s===t._left&&n===t._right&&i===t._near&&o===t._far||(oe(t.near>0&&t.near=0&&t.fov0),oe(t.near>=0&&t.nearthis._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return o(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){o(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){o(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 ds={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class fs{constructor(t){p(this,"options",void 0),p(this,"root",void 0),p(this,"requestedTiles",void 0),p(this,"selectedTiles",void 0),p(this,"emptyTiles",void 0),p(this,"_traversalStack",void 0),p(this,"_emptyTraversalStack",void 0),p(this,"_frameNumber",void 0),this.options={...ds,...t},this._traversalStack=new hs,this._emptyTraversalStack=new hs,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}traverse(t,e,r){this.root=t,this.options={...this.options,...r},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 r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){const t=r.pop();let n=!1;this.canTraverse(t,e)&&(this.updateChildTiles(t,e),n=this.updateAndPushChildren(t,e,r,t.hasRenderContent?t._selectionDepth+1:t._selectionDepth));const s=t.parent,i=Boolean(!s||s._shouldRefine),o=!n;t.hasRenderContent?t.refine===qn?(this.loadTile(t,e),this.selectTile(t,e)):t.refine===zn&&(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=n&&i}this.options.onTraversalEnd(e)}updateChildTiles(t,e){const r=t.children;for(const t of r)this.updateTile(t,e);return!0}updateAndPushChildren(t,e,r,n){const{loadSiblings:s,skipLevelOfDetail:i}=this.options,o=t.children;o.sort(this.compareDistanceToCamera.bind(this));const a=t.refine===zn&&t.hasRenderContent&&!i;let c=!1,u=!0;for(const t of o)if(t._selectionDepth=n,t.isVisibleAndInRequestVolume?(r.find(t)&&r.delete(t),r.push(t),c=!0):(a||s)&&(this.loadTile(t,e),this.touchTile(t,e)),a){let r;if(r=!!t._inRequestVolume&&(t.hasRenderContent?t.contentAvailable:this.executeEmptyTraversal(t,e)),u=u&&r,!u)return!1}return c||(u=!1),u}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,r=!1,n=!1){return!!t.hasChildren&&(t.hasTilesetContent?!t.contentExpired:!(!n&&!t.isVisibleAndInRequestVolume)&&this.shouldRefine(t,e,r))}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,e,r){let n=t._screenSpaceError;return r&&(n=t.getScreenSpaceError(e,!0)),n>this.options.maximumScreenSpaceError}updateTileVisibility(t,e){const r=[];if(this.options.viewportTraversersMap)for(const t in this.options.viewportTraversersMap){this.options.viewportTraversersMap[t]===e.viewport.id&&r.push(t)}else r.push(e.viewport.id);t.updateVisibility(e,r)}compareDistanceToCamera(t,e){return t._distanceToCamera-e._distanceToCamera}anyChildrenVisible(t,e){let r=!1;for(const n of t.children)n.updateVisibility(e),r=r||n.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,e){let r=!0;const n=this._emptyTraversalStack;for(n.push(t);n.length>0&&r;){const t=n.pop();this.updateTile(t,e),t.isVisibleAndInRequestVolume||this.loadTile(t,e),this.touchTile(t,e);if(!t.hasRenderContent&&this.canTraverse(t,e,!1,!0)){const e=t.children;for(const t of e)n.find(t)&&n.delete(t),n.push(t)}else t.contentAvailable||(r=!1)}return r}}const As=new Pe;class ms{constructor(t,e,r,n=""){p(this,"tileset",void 0),p(this,"header",void 0),p(this,"id",void 0),p(this,"url",void 0),p(this,"parent",void 0),p(this,"refine",void 0),p(this,"type",void 0),p(this,"contentUrl",void 0),p(this,"lodMetricType",void 0),p(this,"lodMetricValue",void 0),p(this,"boundingVolume",void 0),p(this,"content",void 0),p(this,"contentState",void 0),p(this,"gpuMemoryUsageInBytes",void 0),p(this,"children",void 0),p(this,"depth",void 0),p(this,"viewportIds",void 0),p(this,"transform",void 0),p(this,"extensions",void 0),p(this,"userData",void 0),p(this,"computedTransform",void 0),p(this,"hasEmptyContent",void 0),p(this,"hasTilesetContent",void 0),p(this,"traverser",void 0),p(this,"_cacheNode",void 0),p(this,"_frameNumber",void 0),p(this,"_lodJudge",void 0),p(this,"_expireDate",void 0),p(this,"_expiredContent",void 0),p(this,"_shouldRefine",void 0),p(this,"_distanceToCamera",void 0),p(this,"_centerZDepth",void 0),p(this,"_screenSpaceError",void 0),p(this,"_visibilityPlaneMask",void 0),p(this,"_visible",void 0),p(this,"_inRequestVolume",void 0),p(this,"_stackLength",void 0),p(this,"_selectionDepth",void 0),p(this,"_touchedFrame",void 0),p(this,"_visitedFrame",void 0),p(this,"_selectedFrame",void 0),p(this,"_requestedFrame",void 0),p(this,"_priority",void 0),p(this,"_contentBoundingVolume",void 0),p(this,"_viewerRequestVolume",void 0),p(this,"_initialTransform",void 0),this.header=e,this.tileset=t,this.id=n||e.id,this.url=e.url,this.parent=r,this.refine=this._getRefine(e.refine),this.type=e.type,this.contentUrl=e.contentUrl,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=jn,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this.extensions=null,this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new fs({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new rr,this.transform=new rr,this._initializeLodMetric(e),this._initializeTransforms(e),this._initializeBoundingVolumes(e),this._initializeContent(e),this._initializeRenderingState(e),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,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 this.contentState===Vn||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===jn}get contentExpired(){return this.contentState===Kn}get contentFailed(){return this.contentState===Qn}getScreenSpaceError(t,e){switch(this.tileset.type){case $n:return ls(this,t);case ts:return function(t,e,r){const n=t.tileset,s=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,i=r?s:t.lodMetricValue;if(0===i)return 0;const o=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:c}=e,{viewDistanceScale:u}=n.options;let l=i*a*(u||1)/(o*c);return l-=us(n,o),l}(this,t,e);default:throw new Error("Unsupported tileset type")}}_getPriority(){const t=this.tileset._traverser,{skipLevelOfDetail:e}=t.options,r=this.refine===qn||e;if(r&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===jn)return-1;const n=this.parent,s=n&&(!r||0===this._screenSpaceError||n.hasTilesetContent)?n._screenSpaceError:this._screenSpaceError,i=t.root?t.root._screenSpaceError:0;return Math.max(i-s,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=kn;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=jn,!1;try{const e=this.tileset.getTileUrl(this.contentUrl),r=this.tileset.loader,n={...this.tileset.loadOptions,[r.id]:{...this.tileset.loadOptions[r.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(r.id)}};return this.content=await ie(e,r,n),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Vn,this._onContentLoaded(),!0}catch(t){throw this.contentState=Qn,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=jn,!0}updateVisibility(t,e){if(this._frameNumber===t.frameNumber)return;const r=this.parent,n=r?r._visibilityPlaneMask:Mn.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const t=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(t)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,n),this._visible=this._visibilityPlaneMask!==Mn.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=e}visibility(t,e){const{cullingVolume:r}=t,{boundingVolume:n}=this;return r.computeVisibilityWithPlaneMask(n,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 As.subVectors(e.center,t.position),t.direction.dot(As)}insideViewerRequestVolume(t){const e=this._viewerRequestVolume;return!e||e.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(null!=this._expireDate&&this.contentReady&&!this.hasEmptyContent){const t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=Kn,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 rr(t.transform):new rr;const e=this.parent,r=this.tileset,n=e&&e.computedTransform?e.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new rr(n).multiplyRight(this.transform);const s=e&&e._initialTransform?e._initialTransform.clone():new rr;this._initialTransform=new rr(s).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=jn,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=Mn.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||zn}_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)}_updateBoundingVolume(t){this.boundingVolume=as(t.boundingVolume,this.computedTransform,this.boundingVolume);const e=t.content;e&&(e.boundingVolume&&(this._contentBoundingVolume=as(e.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=as(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new rr){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,tile:this.header,tileset:this.tileset.tileset,isTileHeader:!1}:{assetGltfUpAxis:(e=this.tileset.tileset).asset&&e.asset.gltfUpAxis||"Y"};var e}}class ps extends fs{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 r=t.children.length>0;if(t.hasTilesetContent&&r){const r=t.children[0];return this.updateTileVisibility(r,e),void(t._visible=r._visible)}if(this.meetsScreenSpaceErrorEarly(t,e))return void(t._visible=!1);const n=t.refine===zn,s=t._optimChildrenWithinParent===rs;n&&s&&r&&!this.anyChildrenVisible(t,e)&&(t._visible=!1)}meetsScreenSpaceErrorEarly(t,e){const{parent:r}=t;return!(!r||r.hasTilesetContent||r.refine!==qn)&&!this.shouldRefine(t,e,!0)}}const Bs="REQUESTED",gs="COMPLETED",ys="ERROR";class Cs{constructor(){p(this,"_statusMap",void 0),this._statusMap={}}add(t,e,r,n){this._statusMap[e]||(this._statusMap[e]={request:t,callback:r,key:e,frameState:n,status:Bs},t().then((t=>{this._statusMap[e].status=gs,this._statusMap[e].callback(t,n)})).catch((t=>{this._statusMap[e].status=ys,r(t)})))}update(t,e){this._statusMap[t]&&(this._statusMap[t].frameState=e)}find(t){return this._statusMap[t]}}class bs extends fs{constructor(t){super(t),p(this,"_tileManager",void 0),this._tileManager=new Cs}shouldRefine(t,e){return t._lodJudge=function(t,e){if(0===t.lodMetricValue||isNaN(t.lodMetricValue))return"DIG";const r=2*ls(t,e);return r<2?"OUT":!t.header.children||r<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}(t,e),"DIG"===t._lodJudge}updateChildTiles(t,e){const r=t.header.children||[],n=t.children,s=t.tileset;for(const i of r){const r="".concat(i.id,"-").concat(e.viewport.id),o=n&&n.find((t=>t.id===r));if(o)o&&this.updateTile(o,e);else{let n=()=>this._loadTile(i.id,s);this._tileManager.find(r)?this._tileManager.update(r,e):(s.tileset.nodePages&&(n=()=>s.tileset.nodePagesTile.formTileFromNodePages(i.id)),this._tileManager.add(n,r,(e=>this._onTileLoad(e,t,r)),e))}}return!1}async _loadTile(t,e){const{loader:r}=e,n=e.getTileUrl("".concat(e.url,"/nodes/").concat(t)),s={...e.loadOptions,i3s:{...e.loadOptions.i3s,isTileHeader:!0,loadContent:!1}};return await ie(n,r,s)}_onTileLoad(t,e,r){const n=new ms(e.tileset,t,e,r);e.children.push(n);const s=this._tileManager.find(n.id).frameState;this.updateTile(n,s),this._frameNumber===s.frameNumber&&this.executeTraversal(n,s)}}const ws={description:"",ellipsoid:Qr.WGS84,modelMatrix:new rr,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Ts="Tiles In Tileset(s)",Es="Tiles In Memory",Ms="Tiles In View",vs="Tiles To Render",Is="Tiles Loaded",_s="Tiles Loading",Fs="Tiles Unloaded",Ds="Failed Tile Loads",Gs="Points",Rs="Tile Memory Use";class Ss{constructor(t,e){p(this,"options",void 0),p(this,"loadOptions",void 0),p(this,"type",void 0),p(this,"tileset",void 0),p(this,"loader",void 0),p(this,"url",void 0),p(this,"basePath",void 0),p(this,"modelMatrix",void 0),p(this,"ellipsoid",void 0),p(this,"lodMetricType",void 0),p(this,"lodMetricValue",void 0),p(this,"refine",void 0),p(this,"root",void 0),p(this,"roots",void 0),p(this,"asset",void 0),p(this,"description",void 0),p(this,"properties",void 0),p(this,"extras",void 0),p(this,"attributions",void 0),p(this,"credits",void 0),p(this,"stats",void 0),p(this,"traverseCounter",void 0),p(this,"geometricError",void 0),p(this,"selectedTiles",void 0),p(this,"cartographicCenter",void 0),p(this,"cartesianCenter",void 0),p(this,"zoom",void 0),p(this,"boundingVolume",void 0),p(this,"gpuMemoryUsageInBytes",void 0),p(this,"dynamicScreenSpaceErrorComputedDensity",void 0),p(this,"_traverser",void 0),p(this,"_cache",void 0),p(this,"_requestScheduler",void 0),p(this,"_frameNumber",void 0),p(this,"_queryParamsString",void 0),p(this,"_queryParams",void 0),p(this,"_extensionsUsed",void 0),p(this,"_tiles",void 0),p(this,"_pendingCount",void 0),p(this,"lastUpdatedVieports",void 0),p(this,"_requestedTiles",void 0),p(this,"_emptyTiles",void 0),p(this,"frameStateData",void 0),p(this,"maximumMemoryUsage",void 0),o(t),this.options={...ws,...e},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||W(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.root=null,this.roots={},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.traverseCounter=0,this.geometricError=0,this._traverser=this._initializeTraverser(),this._cache=new Yr,this._requestScheduler=new q({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this._frameNumber=0,this._pendingCount=0,this._tiles={},this.selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this.frameStateData={},this.lastUpdatedVieports=null,this._queryParams={},this._queryParamsString="",this.maximumMemoryUsage=this.options.maximumMemoryUsage||32,this.gpuMemoryUsageInBytes=0,this.stats=new K({id:this.url}),this._initializeStats(),this._extensionsUsed=void 0,this.dynamicScreenSpaceErrorComputedDensity=0,this.extras=null,this.asset={},this.credits={},this.description=this.options.description||"",this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return this._queryParamsString||(this._queryParamsString=function(t){const e=[];for(const r of Object.keys(t))e.push("".concat(r,"=").concat(t[r]));switch(e.length){case 0:return"";case 1:return"?".concat(e[0]);default:return"?".concat(e.join("&"))}}(this._queryParams)),this._queryParamsString}setProps(t){this.options={...this.options,...t}}setOptions(t){this.options={...this.options,...t}}getTileUrl(t){return t.startsWith("data:")?t:"".concat(t).concat(this.queryParams)}hasExtension(t){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(t)>-1)}update(t){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t instanceof Array||(t=[t]),this._cache.reset(),this._frameNumber++,this.traverseCounter=t.length;const e=[];for(const r of t){const t=r.id;this._needTraverse(t)?e.push(t):this.traverseCounter--}for(const r of t){const t=r.id;if(this.roots[t]||(this.roots[t]=this._initializeTileHeaders(this.tileset,null)),!e.includes(t))continue;const n=Nn(r,this._frameNumber);this._traverser.traverse(this.roots[t],n,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 r=this.frameStateData[e],n=Object.values(this._traverser.selectedTiles);r.selectedTiles=n,r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||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 r=new Set(t.map((t=>t.id))),n=new Set(e.map((t=>t.id)));let s=t.filter((t=>!n.has(t.id))).length>0;return s=s||e.filter((t=>!r.has(t.id))).length>0,s}_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 r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount&&(e+=r.content.pointCount));this.stats.get(Ms).count=this.selectedTiles.length,this.stats.get(vs).count=t,this.stats.get(Gs).count=e}_initializeTileSet(t){this.root=this._initializeTileHeaders(t,null),this.type===ts&&this._initializeCesiumTileset(t),this.type===$n&&this._initializeI3STileset(),this._calculateViewProps()}_calculateViewProps(){const t=this.root;o(t);const{center:e}=t.boundingVolume;if(!e)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Pe,void(this.zoom=1);this.cartographicCenter=Qr.WGS84.cartesianToCartographic(e,new Pe),this.cartesianCenter=e,this.zoom=Pn(t.boundingVolume)}_initializeStats(){this.stats.get(Ts),this.stats.get(_s),this.stats.get(Es),this.stats.get(Ms),this.stats.get(vs),this.stats.get(Is),this.stats.get(Fs),this.stats.get(Ds),this.stats.get(Gs,"memory"),this.stats.get(Rs,"memory")}_initializeTileHeaders(t,e){const r=new ms(this,t.root,e);if(e&&(e.children.push(r),r.depth=e.depth+1),this.type===ts){const t=[];for(t.push(r);t.length>0;){const e=t.pop();this.stats.get(Ts).incrementCount();const r=e.header.children||[];for(const n of r){const r=new ms(this,n,e);e.children.push(r),r.depth=e.depth+1,t.push(r)}}}return r}_initializeTraverser(){let t;switch(this.type){case ts:t=ps;break;case $n:t=bs;break;default:t=fs}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)}finally{this._onEndTileLoading(),this._onTileLoad(t,e)}}_onTileLoadError(t,e){this.stats.get(Ds).incrementCount();const r=e.message||e.toString(),n=t.url;console.error("A 3D tile failed to load: ".concat(t.url," ").concat(r)),this.options.onTileError(t,r,n)}_onTileLoad(t,e){e&&(t&&t.content&&function(t,e){o(t),o(e);const{rtcCenter:r,gltfUpAxis:n}=e,{computedTransform:s,boundingVolume:{center:i}}=t;let a=new rr(s);switch(r&&a.translate(r),n){case"Z":break;case"Y":const t=(new rr).rotateX(Math.PI/2);a=a.multiplyRight(t);break;case"X":const e=(new rr).rotateY(-Math.PI/2);a=a.multiplyRight(e)}e.isQuantized&&a.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const c=new Pe(i);e.cartesianModelMatrix=a,e.cartesianOrigin=c;const u=Qr.WGS84.cartesianToCartographic(c,new Pe),l=Qr.WGS84.eastNorthUpToFixedFrame(c).invert();e.cartographicModelMatrix=l.multiplyRight(a),e.cartographicOrigin=u,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}(t,t.content),this._addTileToCache(t),this.options.onTileLoad(t))}_onStartTileLoading(){this._pendingCount++,this.stats.get(_s).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(_s).decrementCount()}_addTileToCache(t){this._cache.add(this,t,(e=>e._updateCacheStats(t)))}_updateCacheStats(t){this.stats.get(Is).incrementCount(),this.stats.get(Es).incrementCount(),this.gpuMemoryUsageInBytes+=t.content.byteLength||0,this.stats.get(Rs).count=this.gpuMemoryUsageInBytes}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.content&&t.content.byteLength||0,this.stats.get(Es).decrementCount(),this.stats.get(Fs).incrementCount(),this.stats.get(Rs).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 r of e.children)t.push(r);this._destroyTile(e)}this.root=null}_destroySubtree(t){const e=t,r=[];for(r.push(e);r.length>0;){t=r.pop();for(const e of t.children)r.push(e);t!==e&&this._destroyTile(t)}e.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeCesiumTileset(t){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)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"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)}}const Os="3.1.4",xs="cmpt",Us="pnts",Ls="b3dm",Ns="i3dm",Hs="glTF";function Js(t,e,r){o(t instanceof ArrayBuffer);const n=new TextDecoder("utf8"),s=new Uint8Array(t,e,r);return n.decode(s)}const Ps={name:"Draco",id:"draco",module:"draco",shapes:["mesh"],version:"3.1.4",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}}};class js{constructor(t,e){p(this,"fields",void 0),p(this,"metadata",void 0),function(t,e){if(!t)throw new Error(e||"loader assertion failed.")}(Array.isArray(t)),function(t){const e={};for(const r of t)e[r.name]&&console.warn("Schema: duplicated field name",r.name,r),e[r.name]=!0}(t),this.fields=t,this.metadata=e||new Map}compareTo(t){if(this.metadata!==t.metadata)return!1;if(this.fields.length!==t.fields.length)return!1;for(let e=0;ee[t.name]));return new js(r,this.metadata)}selectAt(...t){const e=t.map((t=>this.fields[t])).filter(Boolean);return new js(e,this.metadata)}assign(t){let e,r=this.metadata;if(t instanceof js){const n=t;e=n.fields,r=ks(ks(new Map,this.metadata),n.metadata)}else e=t;const n=Object.create(null);for(const t of this.fields)n[t.name]=t;for(const t of e)n[t.name]=t;const s=Object.values(n);return new js(s,r)}}function ks(t,e){return new Map([...t||new Map,...e||new Map])}class Vs{constructor(t,e,r=!1,n=new Map){p(this,"name",void 0),p(this,"type",void 0),p(this,"nullable",void 0),p(this,"metadata",void 0),this.name=t,this.type=e,this.nullable=r,this.metadata=n}get typeId(){return this.type&&this.type.typeId}clone(){return new Vs(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}let Ks,Qs,qs,zs;!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(Ks||(Ks={}));class Ws{static isNull(t){return t&&t.typeId===Ks.Null}static isInt(t){return t&&t.typeId===Ks.Int}static isFloat(t){return t&&t.typeId===Ks.Float}static isBinary(t){return t&&t.typeId===Ks.Binary}static isUtf8(t){return t&&t.typeId===Ks.Utf8}static isBool(t){return t&&t.typeId===Ks.Bool}static isDecimal(t){return t&&t.typeId===Ks.Decimal}static isDate(t){return t&&t.typeId===Ks.Date}static isTime(t){return t&&t.typeId===Ks.Time}static isTimestamp(t){return t&&t.typeId===Ks.Timestamp}static isInterval(t){return t&&t.typeId===Ks.Interval}static isList(t){return t&&t.typeId===Ks.List}static isStruct(t){return t&&t.typeId===Ks.Struct}static isUnion(t){return t&&t.typeId===Ks.Union}static isFixedSizeBinary(t){return t&&t.typeId===Ks.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===Ks.FixedSizeList}static isMap(t){return t&&t.typeId===Ks.Map}static isDictionary(t){return t&&t.typeId===Ks.Dictionary}get typeId(){return Ks.NONE}compareTo(t){return this===t}}Qs=Symbol.toStringTag;class Ys extends Ws{constructor(t,e){super(),p(this,"isSigned",void 0),p(this,"bitWidth",void 0),this.isSigned=t,this.bitWidth=e}get typeId(){return Ks.Int}get[Qs](){return"Int"}toString(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}class Xs extends Ys{constructor(){super(!0,8)}}class Zs extends Ys{constructor(){super(!0,16)}}class $s extends Ys{constructor(){super(!0,32)}}class ti extends Ys{constructor(){super(!1,8)}}class ei extends Ys{constructor(){super(!1,16)}}class ri extends Ys{constructor(){super(!1,32)}}const ni=32,si=64;qs=Symbol.toStringTag;class ii extends Ws{constructor(t){super(),p(this,"precision",void 0),this.precision=t}get typeId(){return Ks.Float}get[qs](){return"Float"}toString(){return"Float".concat(this.precision)}}class oi extends ii{constructor(){super(ni)}}class ai extends ii{constructor(){super(si)}}zs=Symbol.toStringTag;class ci extends Ws{constructor(t,e){super(),p(this,"listSize",void 0),p(this,"children",void 0),this.listSize=t,this.children=[e]}get typeId(){return Ks.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[zs](){return"FixedSizeList"}toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}function ui(t,e,r){const n=function(t){switch(t.constructor){case Int8Array:return new Xs;case Uint8Array:return new ti;case Int16Array:return new Zs;case Uint16Array:return new ei;case Int32Array:return new $s;case Uint32Array:return new ri;case Float32Array:return new oi;case Float64Array:return new ai;default:throw new Error("array type not supported")}}(e.value),s=r||function(t){const e=new Map;"byteOffset"in t&&e.set("byteOffset",t.byteOffset.toString(10));"byteStride"in t&&e.set("byteStride",t.byteStride.toString(10));"normalized"in t&&e.set("normalized",t.normalized.toString());return e}(e);return new Vs(t,new ci(e.size,new Vs("value",n)),!1,s)}function li(t,e,r){return ui(t,e,r?hi(r.metadata):void 0)}function hi(t){const e=new Map;for(const r in t)e.set("".concat(r,".string"),JSON.stringify(t[r]));return e}const di={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},fi={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Ai{constructor(t){p(this,"draco",void 0),p(this,"decoder",void 0),p(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,e={}){const r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);const n=this.decoder.GetEncodedGeometryType(r),s=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let t;switch(n){case this.draco.TRIANGULAR_MESH:t=this.decoder.DecodeBufferToMesh(r,s);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(r,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!s.ptr){const e="DRACO decompression failed: ".concat(t.error_msg());throw new Error(e)}const i=this._getDracoLoaderData(s,n,e),o=this._getMeshData(s,i,e),a=function(t){let e=1/0,r=1/0,n=1/0,s=-1/0,i=-1/0,o=-1/0;const a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let t=0;ts?c:s,i=u>i?u:i,o=l>o?l:o}return[[e,r,n],[s,i,o]]}(o.attributes),c=function(t,e,r){const n=hi(e.metadata),s=[],i=function(t){const e={};for(const r in t){const n=t[r];e[n.name||"undefined"]=n}return e}(e.attributes);for(const e in t){const r=li(e,t[e],i[e]);s.push(r)}if(r){const t=li("indices",r);s.push(t)}return new js(s,n)}(o.attributes,i,o.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:a},...o,schema:c}}finally{this.draco.destroy(r),s&&this.draco.destroy(s)}}_getDracoLoaderData(t,e,r){const n=this._getTopLevelMetadata(t),s=this._getDracoAttributes(t,r);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:n,attributes:s}}_getDracoAttributes(t,e){const r={};for(let n=0;nthis.decoder[t])).includes(n)){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:r=[]}=e,n=t.attribute_type();if(r.map((t=>this.decoder[t])).includes(n)){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 mi="1.4.1",pi="https://www.gstatic.com/draco/versioned/decoders/".concat(mi,"/draco_decoder.js"),Bi="https://www.gstatic.com/draco/versioned/decoders/".concat(mi,"/draco_wasm_wrapper.js"),gi="https://www.gstatic.com/draco/versioned/decoders/".concat(mi,"/draco_decoder.wasm");let yi;async function Ci(t){const e=t.modules||{};return yi=e.draco3d?yi||e.draco3d.createDecoderModule({}).then((t=>({draco:t}))):yi||async function(t){let e,r;if("js"===(t.draco&&t.draco.decoderType))e=await R(pi,"draco",t);else[e,r]=await Promise.all([await R(Bi,"draco",t),await R(gi,"draco",t)]);return e=e||globalThis.DracoDecoderModule,await function(t,e){const r={};e&&(r.wasmBinary=e);return new Promise((e=>{t({...r,onModuleLoaded:t=>e({draco:t})})}))}(e,r)}(t),await yi}const bi={...Ps,parse:async function(t,e){const{draco:r}=await Ci(e),n=new Ai(r);try{return n.parseSync(t,null==e?void 0:e.draco)}finally{n.destroy()}}};const wi={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Ti={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...wi},Ei={[wi.DOUBLE]:Float64Array,[wi.FLOAT]:Float32Array,[wi.UNSIGNED_SHORT]:Uint16Array,[wi.UNSIGNED_INT]:Uint32Array,[wi.UNSIGNED_BYTE]:Uint8Array,[wi.BYTE]:Int8Array,[wi.SHORT]:Int16Array,[wi.INT]:Int32Array},Mi={DOUBLE:wi.DOUBLE,FLOAT:wi.FLOAT,UNSIGNED_SHORT:wi.UNSIGNED_SHORT,UNSIGNED_INT:wi.UNSIGNED_INT,UNSIGNED_BYTE:wi.UNSIGNED_BYTE,BYTE:wi.BYTE,SHORT:wi.SHORT,INT:wi.INT},vi="Failed to convert GL type";class Ii{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(const e in Ei){if(Ei[e]===t)return e}throw new Error(vi)}static fromName(t){const e=Mi[t];if(!e)throw new Error(vi);return e}static getArrayType(t){switch(t){case wi.UNSIGNED_SHORT_5_6_5:case wi.UNSIGNED_SHORT_4_4_4_4:case wi.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const e=Ei[t];if(!e)throw new Error(vi);return e}}static getByteSize(t){return Ii.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(Ii.getArrayType(t))}static createTypedArray(t,e,r=0,n){void 0===n&&(n=(e.byteLength-r)/Ii.getByteSize(t));return new(Ii.getArrayType(t))(e,r,n)}}function _i(t,e=[0,0,0]){const r=t>>11&31,n=t>>5&63,s=31&t;return e[0]=r<<3,e[1]=n<<2,e[2]=s<<3,e}function Fi(t,e=255){return function(t,e,r){return de(t,(t=>Math.max(e,Math.min(r,t))))}(t,0,e)/e*2-1}function Di(t){return t<0?-1:1}function Gi(t,e,r,n){if(function(t,e){if(!t)throw new Error("math.gl assertion failed. ".concat(e))}(n),t<0||t>r||e<0||e>r)throw new Error("x and y must be unsigned normalized integers between 0 and ".concat(r));if(n.x=Fi(t,r),n.y=Fi(e,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){const t=n.x;n.x=(1-Math.abs(n.y))*Di(t),n.y=(1-Math.abs(t))*Di(n.y)}return n.normalize()}new De,new Pe,new De,new De;class Ri{constructor(t,e){p(this,"json",void 0),p(this,"buffer",void 0),p(this,"featuresLength",0),p(this,"_cachedTypedArrays",{}),this.json=t,this.buffer=e}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,e=Ti.UNSIGNED_INT,r=1){const n=this.json[t];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(t,e,r,1,n.byteOffset):n}getPropertyArray(t,e,r){const n=this.json[t];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(e=Ii.fromName(n.componentType)),this._getTypedArrayFromBinary(t,e,r,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(t,e,n)}getProperty(t,e,r,n,s){const i=this.json[t];if(!i)return i;const o=this.getPropertyArray(t,e,r);if(1===r)return o[n];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]]},xi={SCALAR:(t,e,r)=>{e[r]=t},VEC2:(t,e,r)=>{e[2*r+0]=t[0],e[2*r+1]=t[1]},VEC3:(t,e,r)=>{e[3*r+0]=t[0],e[3*r+1]=t[1],e[3*r+2]=t[2]},VEC4:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT2:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT3:(t,e,r)=>{e[9*r+0]=t[0],e[9*r+1]=t[1],e[9*r+2]=t[2],e[9*r+3]=t[3],e[9*r+4]=t[4],e[9*r+5]=t[5],e[9*r+6]=t[6],e[9*r+7]=t[7],e[9*r+8]=t[8],e[9*r+9]=t[9]},MAT4:(t,e,r)=>{e[16*r+0]=t[0],e[16*r+1]=t[1],e[16*r+2]=t[2],e[16*r+3]=t[3],e[16*r+4]=t[4],e[16*r+5]=t[5],e[16*r+6]=t[6],e[16*r+7]=t[7],e[16*r+8]=t[8],e[16*r+9]=t[9],e[16*r+10]=t[10],e[16*r+11]=t[11],e[16*r+12]=t[12],e[16*r+13]=t[13],e[16*r+14]=t[14],e[16*r+15]=t[15]}};const Ui=t=>void 0!==t;function Li(t,e,r){if(!e)return null;let n=t.getExtension("3DTILES_batch_table_hierarchy");const s=e.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=s,n=s),n?function(t,e){let r,n,s;const i=t.instancesLength,o=t.classes;let a,c=t.classIds,u=t.parentCounts,l=t.parentIds,h=i;Ui(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,i));if(Ui(u))for(Ui(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,s=getBinaryAccessor(u),u=s.createArrayBufferView(e.buffer,e.byteOffset+u.byteOffset,i)),a=new Uint16Array(i),h=0,r=0;r0?function(t,e,r){const n=t.classIds,s=t.parentCounts,i=t.parentIds,o=t.parentIndexes,a=n.length,c=scratchVisited;c.length=Math.max(c.length,a);const u=++marker,l=scratchStack;l.length=0,l.push(e);for(;l.length>0;){if(c[e=l.pop()]===u)continue;c[e]=u;const n=r(t,e);if(Ui(n))return n;const a=s[e],h=o[e];for(let t=0;tt,ji={HIERARCHY:!0,extensions:!0,extras:!0};class ki{constructor(t,e,r,n={}){var s;p(this,"json",void 0),p(this,"binary",void 0),p(this,"featureCount",void 0),p(this,"_extensions",void 0),p(this,"_properties",void 0),p(this,"_binaryProperties",void 0),p(this,"_hierarchy",void 0),o(r>=0),this.json=t||{},this.binary=e,this.featureCount=r,this._extensions=(null===(s=this.json)||void 0===s?void 0:s.extensions)||{},this._properties={};for(const t in this.json)ji[t]||(this._properties[t]=this.json[t]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Li(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,e){if(this._checkBatchId(t),o("string"==typeof e,e),this._hierarchy){return Ji(Ni(this._hierarchy,t,((t,r)=>{const n=t.classIds[r];return t.classes[n].name===e})))}return!1}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),Ji(this._properties[e])||this._hasPropertyInHierarchy(t,e)}getPropertyNames(t,e){this._checkBatchId(t),(e=Ji(e)?e:[]).length=0;const r=Object.keys(this._properties);return e.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(t,e),e}getProperty(t,e){if(this._checkBatchId(t),o("string"==typeof e,e),this._binaryProperties){const r=this._binaryProperties[e];if(Ji(r))return this._getBinaryProperty(r,t)}const r=this._properties[e];if(Ji(r))return Pi(r[t]);if(this._hierarchy){const r=this._getHierarchyProperty(t,e);if(Ji(r))return r}}setProperty(t,e,r){const n=this.featureCount;if(this._checkBatchId(t),o("string"==typeof e,e),this._binaryProperties){const n=this._binaryProperties[e];if(n)return void this._setBinaryProperty(n,t,r)}if(this._hierarchy&&this._setHierarchyProperty(this,t,e,r))return;let s=this._properties[e];Ji(s)||(this._properties[e]=new Array(n),s=this._properties[e]),s[t]=Pi(r)}_checkBatchId(t){if(!(t>=0&&t{const n=t.classIds[r];return Ji(t.classes[n].instances[e])}));return Ji(r)}_getPropertyNamesInHierarchy(t,e){Ni(this._hierarchy,t,((t,r)=>{const n=t.classIds[r],s=t.classes[n].instances;for(const t in s)s.hasOwnProperty(t)&&-1===e.indexOf(t)&&e.push(t)}))}_getHierarchyProperty(t,e){return Ni(this._hierarchy,t,((t,r)=>{const n=t.classIds[r],s=t.classes[n],i=t.classIndexes[r],o=s.instances[e];return Ji(o)?Ji(o.typedArray)?this._getBinaryProperty(o,i):Pi(o[i]):null}))}_setHierarchyProperty(t,e,r,n){const s=Ni(this._hierarchy,e,((t,s)=>{const i=t.classIds[s],a=t.classes[i],c=t.classIndexes[s],u=a.instances[r];return!!Ji(u)&&(o(s===e,'Inherited property "'.concat(r,'" is read-only.')),Ji(u.typedArray)?this._setBinaryProperty(u,c,n):u[c]=Pi(n),!0)}));return Ji(s)}}function Vi(t,e,r=0){const n=new DataView(e);if(t.magic=n.getUint32(r,!0),r+=4,t.version=n.getUint32(r,!0),r+=4,t.byteLength=n.getUint32(r,!0),r+=4,1!==t.version)throw new Error("3D Tile Version ".concat(t.version," not supported"));return r}const Ki="b3dm tile in legacy format.";function Qi(t,e,r){const n=new DataView(e);let s;t.header=t.header||{};let i=n.getUint32(r,!0);r+=4;let o=n.getUint32(r,!0);r+=4;let a=n.getUint32(r,!0);r+=4;let c=n.getUint32(r,!0);return r+=4,a>=570425344?(r-=8,s=i,a=o,c=0,i=0,o=0,console.warn(Ki)):c>=570425344&&(r-=4,s=a,a=i,c=o,i=0,o=0,console.warn(Ki)),t.header.featureTableJsonByteLength=i,t.header.featureTableBinaryByteLength=o,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=s,r}function qi(t,e,r,n){return r=function(t,e,r,n){const{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=t.header;if(t.featureTableJson={BATCH_LENGTH:o||0},s>0){const n=Js(e,r,s);t.featureTableJson=JSON.parse(n)}return r+=s,t.featureTableBinary=new Uint8Array(e,r,i),r+=i}(t,e,r),r=function(t,e,r,n){const{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=t.header;if(s>0){const n=Js(e,r,s);t.batchTableJson=JSON.parse(n),r+=s,i>0&&(t.batchTableBinary=new Uint8Array(e,r,i),t.batchTableBinary=new Uint8Array(t.batchTableBinary),r+=i)}return r}(t,e,r),r}function zi(t,e,r){if(!(e||t&&t.batchIds&&r))return null;const{batchIds:n,isRGB565:s,pointCount:i}=t;if(n&&r){const t=new Uint8ClampedArray(3*i);for(let e=0;e255*t));t[3*e]=i[0],t[3*e+1]=i[1],t[3*e+2]=i[2]}return{type:Ti.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}if(s){const t=new Uint8ClampedArray(3*i);for(let r=0;r{t(r).then((t=>{const{BasisFile:r,initializeBasis:n}=t;n(),e({BasisFile:r})}))}))}(e,r)}(t),await eo)}async function so(t){const e=t.modules||{};return e.basisEncoder?e.basisEncoder:(ro=ro||async function(t){let e=null,r=null;return[e,r]=await Promise.all([await R(to,"textures",t),await R($i,"textures",t)]),e=e||globalThis.BASIS,await function(t,e){const r={};e&&(r.wasmBinary=e);return new Promise((e=>{t(r).then((t=>{const{BasisFile:r,KTX2File:n,initializeBasis:s,BasisEncoder:i}=t;s(),e({BasisFile:r,KTX2File:n,BasisEncoder:i})}))}))}(e,r)}(t),await ro)}const io=33776,oo=33779,ao=35840,co=35842,uo=36196,lo=37808,ho=["","WEBKIT_","MOZ_"],fo={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 Ao=null;function mo(t){if(!Ao){t=t||function(){try{return document.createElement("canvas").getContext("webgl")}catch(t){return null}}()||void 0,Ao=new Set;for(const e of ho)for(const r in fo)if(t&&t.getExtension("".concat(e).concat(r))){const t=fo[r];Ao.add(t)}}return Ao}var po,Bo,go,yo,Co,bo,wo,To,Eo;(Eo=po||(po={}))[Eo.NONE=0]="NONE",Eo[Eo.BASISLZ=1]="BASISLZ",Eo[Eo.ZSTD=2]="ZSTD",Eo[Eo.ZLIB=3]="ZLIB",function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(Bo||(Bo={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(go||(go={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(yo||(yo={})),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"}(Co||(Co={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(bo||(bo={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(wo||(wo={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(To||(To={}));const Mo=[171,75,84,88,32,50,48,187,13,10,26,10];const vo={etc1:{basisFormat:0,compressed:!0,format:uo},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:io},bc3:{basisFormat:3,compressed:!0,format:oo},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:ao},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:co},"astc-4x4":{basisFormat:10,compressed:!0,format:lo},"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 Io(t,e,r){const n=new t(new Uint8Array(e));try{if(!n.startTranscoding())return null;const t=n.getNumImages(),e=[];for(let s=0;s{try{r.onload=()=>e(r),r.onerror=e=>n(new Error("Could not load image ".concat(t,": ").concat(e)))}catch(t){n(t)}}))}(i||n,e)}finally{i&&s.revokeObjectURL(i)}}const Ko={};let Qo=!0;async function qo(t,e,r){let n;if(jo(r)){n=await Vo(t,e,r)}else n=ko(t,r);const s=e&&e.imagebitmap;return await async function(t,e=null){!function(t){for(const e in t||Ko)return!1;return!0}(e)&&Qo||(e=null);if(e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),Qo=!1}return await createImageBitmap(t)}(n,s)}const zo=!1,Wo=!0;function Yo(t){const e=Xo(t);return function(t){const e=Xo(t);if(!(e.byteLength>=24&&2303741511===e.getUint32(0,zo)))return null;return{mimeType:"image/png",width:e.getUint32(16,zo),height:e.getUint32(20,zo)}}(e)||function(t){const e=Xo(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,zo)&&255===e.getUint8(2)))return null;const{tableMarkers:r,sofMarkers:n}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)t.add(e);const e=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:t,sofMarkers:e}}();let s=2;for(;s+9=10&&1195984440===e.getUint32(0,zo)))return null;return{mimeType:"image/gif",width:e.getUint16(6,Wo),height:e.getUint16(8,Wo)}}(e)||function(t){const e=Xo(t);if(!(e.byteLength>=14&&16973===e.getUint16(0,zo)&&e.getUint32(2,Wo)===e.byteLength))return null;return{mimeType:"image/bmp",width:e.getUint32(18,Wo),height:e.getUint32(22,Wo)}}(e)}function Xo(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}const Zo={id:"image",module:"images",name:"Images",version:"3.1.4",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(t,e,r){const n=((e=e||{}).image||{}).type||"auto",{url:s}=r||{};let i;switch(function(t){switch(t){case"auto":case"data":return function(){if(Uo)return"imagebitmap";if(xo)return"image";if(No)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return Uo||xo||No;case"imagebitmap":return Uo;case"image":return xo;case"data":return No;default:throw new Error("@loaders.gl/images: image ".concat(t," not supported in this environment"))}}(t),t}}(n)){case"imagebitmap":i=await qo(t,e,s);break;case"image":i=await Vo(t,e,s);break;case"data":i=await async function(t,e){const{mimeType:r}=Yo(t)||{},n=globalThis._parseImageNode;return o(n),await n(t,r)}(t);break;default:o(!1)}return"data"===n&&(i=function(t){switch(Ho(t)){case"data":return t;case"image":case"imagebitmap":const e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}(i)),i},tests:[t=>Boolean(Yo(new DataView(t)))],options:{image:{type:"auto",decode:!0}}},$o=["image/png","image/jpeg","image/gif"],ta={};function ea(t){return void 0===ta[t]&&(ta[t]=function(t){switch(t){case"image/webp":return function(){if(!a)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch{return!1}}();case"image/svg":return a;default:if(!a){const{_parseImageNode:e}=globalThis;return Boolean(e)&&$o.includes(t)}return!0}}(t)),ta[t]}function ra(t,e){if(!t)throw new Error(e||"assert failed: gltf")}function na(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;const r=e.baseUri||e.uri;if(!r)throw new Error("'baseUri' must be provided to resolve relative url ".concat(t));return r.substr(0,r.lastIndexOf("/")+1)+t}const sa=["SCALAR","VEC2","VEC3","VEC4"],ia=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],oa=new Map(ia),aa={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ca={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ua={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function la(t){return sa[t-1]||sa[0]}function ha(t){const e=oa.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function da(t,e){const r=ua[t.componentType],n=aa[t.type],s=ca[t.componentType],i=t.count*n,o=t.count*n*s;return ra(o>=0&&o<=e.byteLength),{ArrayType:r,length:i,byteLength:o}}const fa={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class Aa{constructor(t){p(this,"gltf",void 0),p(this,"sourceBuffers",void 0),p(this,"byteLength",void 0),this.gltf=t||{json:{...fa},buffers:[]},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]}getExtension(t){const e=this.getUsedExtensions().find((e=>e===t)),r=this.json.extensions||{};return e?r[t]||!0:null}getRequiredExtension(t){const e=this.getRequiredExtensions().find((e=>e===t));return e?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}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 r=this.json[t]&&this.json[t][e];if(!r)throw new Error("glTF file error: Could not find ".concat(t,"[").concat(e,"]"));return r}getTypedArrayForBufferView(t){const e=(t=this.getBufferView(t)).buffer,r=this.gltf.buffers[e];ra(r);const n=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,n,t.byteLength)}getTypedArrayForAccessor(t){t=this.getAccessor(t);const e=this.getBufferView(t.bufferView),r=this.getBuffer(e.buffer).data,{ArrayType:n,length:s}=da(t,e);return new n(r,e.byteOffset+t.byteOffset,s)}getTypedArrayForImageData(t){t=this.getAccessor(t);const e=this.getBufferView(t.bufferView),r=this.getBuffer(e.buffer).data,n=e.byteOffset||0;return new Uint8Array(r,n,e.byteLength)}addApplicationData(t,e){return this.json[t]=e,this}addExtraData(t,e){return this.json.extras=this.json.extras||{},this.json.extras[t]=e,this}addObjectExtension(t,e,r){return t.extensions=t.extensions||{},t.extensions[e]=r,this.registerUsedExtension(e),this}setObjectExtension(t,e,r){(t.extensions||{})[e]=r}removeObjectExtension(t,e){const r=t.extensions||{},n=r[e];return delete r[e],n}addExtension(t,e={}){return ra(e),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=e,this.registerUsedExtension(t),e}addRequiredExtension(t,e={}){return ra(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){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t),this.json.extensions&&delete this.json.extensions[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:r}=t;this.json.nodes=this.json.nodes||[];const n={mesh:e};return r&&(n.matrix=r),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(t){const{attributes:e,indices:r,material:n,mode:s=4}=t,i={primitives:[{attributes:this._addAttributes(e),mode:s}]};if(r){const t=this._addIndices(r);i.primitives[0].indices=t}return Number.isFinite(n)&&(i.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(i),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 r=Yo(t),n=e||(null==r?void 0:r.mimeType),s={bufferView:this.addBufferView(t),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}addBufferView(t){const e=t.byteLength;ra(Number.isFinite(e)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);const r={buffer:0,byteOffset:this.byteLength,byteLength:e};return this.byteLength+=J(e,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(r),this.json.bufferViews.length-1}addAccessor(t,e){const r={bufferView:t,type:la(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(r),this.json.accessors.length-1}addBinaryBuffer(t,e={size:3}){const r=this.addBufferView(t);let n={min:e.min,max:e.max};n.min&&n.max||(n=this._getAccessorMinMax(t,e.size));const s={size:e.size,componentType:ha(t),count:Math.round(t.length/e.size),min:n.min,max:n.max};return this.addAccessor(r,Object.assign(s,e))}addTexture(t){const{imageIndex:e}=t,r={source:e};return this.json.textures=this.json.textures||[],this.json.textures.push(r),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 r=this.byteLength,n=new ArrayBuffer(r),s=new Uint8Array(n);let i=0;for(const t of this.sourceBuffers||[])i=P(t,s,i);null!==(t=this.json)&&void 0!==t&&null!==(e=t.buffers)&&void 0!==e&&e[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(t,e){let r=!0;for(;r;){const n=t.indexOf(e);n>-1?t.splice(n,1):r=!1}}_addAttributes(t={}){const e={};for(const r in t){const n=t[r],s=this._getGltfAttributeName(r),i=this.addBinaryBuffer(n.value,n);e[s]=i}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 r={min:null,max:null};if(t.length96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let n=0;n0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(e)}function Oa(t,e,r=4,n,s){var i;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=n.DracoWriter.encodeSync({attributes:t}),a=null==s||null===(i=s.parseSync)||void 0===i?void 0:i.call(s,{attributes:t}),c=n._addFauxAttributes(a.attributes),u=n.addBufferView(o);return{primitives:[{attributes:c,mode:r,extensions:{[Ra]:{bufferView:u,attributes:c}}}]}}function*xa(t){for(const e of t.json.meshes||[])for(const t of e.primitives)yield t}var Ua=Object.freeze({__proto__:null,name:"KHR_draco_mesh_compression",preprocess:function(t,e,r){const n=new Aa(t);for(const t of xa(n))n.getObjectExtension(t,Ra)},decode:async function(t,e,r){var n;if(null==e||null===(n=e.gltf)||void 0===n||!n.decompressMeshes)return;const s=new Aa(t),i=[];for(const t of xa(s))s.getObjectExtension(t,Ra)&&i.push(Sa(s,t,e,r));await Promise.all(i),s.removeExtension(Ra)},encode:function(t,e={}){const r=new Aa(t);for(const t of r.json.meshes||[])Oa(t),r.addRequiredExtension(Ra)}});const La="KHR_lights_punctual";var Na=Object.freeze({__proto__:null,name:"KHR_lights_punctual",decode:async function(t){const e=new Aa(t),{json:r}=e,n=e.getExtension(La);n&&(e.json.lights=n.lights,e.removeExtension(La));for(const t of r.nodes||[]){const r=e.getObjectExtension(t,La);r&&(t.light=r.light),e.removeObjectExtension(t,La)}},encode:async function(t){const e=new Aa(t),{json:r}=e;if(r.lights){const t=e.addExtension(La);ra(!t.lights),t.lights=r.lights,delete r.lights}if(e.json.lights){for(const t of e.json.lights){const r=t.node;e.addObjectExtension(r,La,t)}delete e.json.lights}}});const Ha="KHR_materials_unlit";const Ja="KHR_techniques_webgl";function Pa(t,e){const r=Object.assign({},t.values);return Object.keys(t.uniforms||{}).forEach((e=>{t.uniforms[e].value&&!(e in r)&&(r[e]=t.uniforms[e].value)})),Object.keys(r).forEach((t=>{"object"==typeof r[t]&&void 0!==r[t].index&&(r[t].texture=e.getTexture(r[t].index))})),r}const ja=[va,_a,Da,Ua,Na,Object.freeze({__proto__:null,name:"KHR_materials_unlit",decode:async function(t){const e=new Aa(t),{json:r}=e;e.removeExtension(Ha);for(const t of r.materials||[]){t.extensions&&t.extensions.KHR_materials_unlit&&(t.unlit=!0),e.removeObjectExtension(t,Ha)}},encode:function(t){const e=new Aa(t),{json:r}=e;if(e.materials)for(const t of r.materials||[])t.unlit&&(delete t.unlit,e.addObjectExtension(t,Ha,{}),e.addExtension(Ha))}}),Object.freeze({__proto__:null,name:"KHR_techniques_webgl",decode:async function(t){const e=new Aa(t),{json:r}=e,n=e.getExtension(Ja);if(n){const t=function(t,e){const{programs:r=[],shaders:n=[],techniques:s=[]}=t,i=new TextDecoder;return n.forEach((t=>{if(!Number.isFinite(t.bufferView))throw new Error("KHR_techniques_webgl: no shader code");t.code=i.decode(e.getTypedArrayForBufferView(t.bufferView))})),r.forEach((t=>{t.fragmentShader=n[t.fragmentShader],t.vertexShader=n[t.vertexShader]})),s.forEach((t=>{t.program=r[t.program]})),s}(n,e);for(const n of r.materials||[]){const r=e.getObjectExtension(n,Ja);r&&(n.technique=Object.assign({},r,t[r.technique]),n.technique.values=Pa(n.technique,e)),e.removeObjectExtension(n,Ja)}e.removeExtension(Ja)}},encode:async function(t,e){}})];function ka(t,e){var r;const n=(null==e||null===(r=e.gltf)||void 0===r?void 0:r.excludeExtensions)||{};return!(t in n&&!n[t])}const Va="KHR_binary_glTF";const Ka={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Qa={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 qa{constructor(){p(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),p(this,"json",void 0)}normalize(t,e){this.json=t.json;const r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version ".concat(r.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(r),this._convertTopLevelObjectsToArrays(r),function(t){const e=new Aa(t),{json:r}=e;for(const t of r.images||[]){const r=e.getObjectExtension(t,Va);r&&Object.assign(t,r),e.removeObjectExtension(t,Va)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,e.removeExtension(Va)}(t),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_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 Ka)this._convertTopLevelObjectToArray(t,e)}_convertTopLevelObjectToArray(t,e){const r=t[e];if(r&&!Array.isArray(r)){t[e]=[];for(const n in r){const s=r[n];s.id=s.id||n;const i=t[e].length;t[e].push(s),this.idToIndexMap[e][n]=i}}}_convertObjectIdsToArrayIndices(t){for(const e in Ka)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:r,material:n}=e;for(const e in t)t[e]=this._convertIdToIndex(t[e],"accessor");r&&(e.indices=this._convertIdToIndex(r,"accessor")),n&&(e.material=this._convertIdToIndex(n,"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 ".concat(e)),t[e]=[]);for(const r of t[e])for(const t in r){const e=r[t],n=this._convertIdToIndex(e,t);r[t]=n}}_convertIdToIndex(t,e){const r=Qa[e];if(r in this.idToIndexMap){const n=this.idToIndexMap[r][t];if(!Number.isFinite(n))throw new Error("gltf v1: failed to resolve ".concat(e," with id ").concat(t));return n}return t}_updateObjects(t){for(const t of this.json.buffers)delete t.type}_updateMaterial(t){for(const e of t.materials){e.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const r=e.values&&e.values.tex,n=t.textures.findIndex((t=>t.id===r));-1!==n&&(e.pbrMetallicRoughness.baseColorTexture={index:n})}}}const za={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Wa={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ya=10240,Xa=10241,Za=10242,$a=10243,tc=10497,ec={magFilter:Ya,minFilter:Xa,wrapS:Za,wrapT:$a},rc={[Ya]:9729,[Xa]:9986,[Za]:tc,[$a]:tc};class nc{constructor(){p(this,"baseUri",""),p(this,"json",{}),p(this,"buffers",[]),p(this,"images",[])}postProcess(t,e={}){const{json:r,buffers:n=[],images:s=[],baseUri:i=""}=t;return ra(r),this.baseUri=i,this.json=r,this.buffers=n,this.images=s,this._resolveTree(this.json,e),this.json}_resolveTree(t,e={}){t.bufferViews&&(t.bufferViews=t.bufferViews.map(((t,e)=>this._resolveBufferView(t,e)))),t.images&&(t.images=t.images.map(((t,e)=>this._resolveImage(t,e)))),t.samplers&&(t.samplers=t.samplers.map(((t,e)=>this._resolveSampler(t,e)))),t.textures&&(t.textures=t.textures.map(((t,e)=>this._resolveTexture(t,e)))),t.accessors&&(t.accessors=t.accessors.map(((t,e)=>this._resolveAccessor(t,e)))),t.materials&&(t.materials=t.materials.map(((t,e)=>this._resolveMaterial(t,e)))),t.meshes&&(t.meshes=t.meshes.map(((t,e)=>this._resolveMesh(t,e)))),t.nodes&&(t.nodes=t.nodes.map(((t,e)=>this._resolveNode(t,e)))),t.skins&&(t.skins=t.skins.map(((t,e)=>this._resolveSkin(t,e)))),t.scenes&&(t.scenes=t.scenes.map(((t,e)=>this._resolveScene(t,e)))),void 0!==t.scene&&(t.scene=t.scenes[this.json.scene])}getScene(t){return this._get("scenes",t)}getNode(t){return this._get("nodes",t)}getSkin(t){return this._get("skins",t)}getMesh(t){return this._get("meshes",t)}getMaterial(t){return this._get("materials",t)}getAccessor(t){return this._get("accessors",t)}getCamera(t){return null}getTexture(t){return this._get("textures",t)}getSampler(t){return this._get("samplers",t)}getImage(t){return this._get("images",t)}getBufferView(t){return this._get("bufferViews",t)}getBuffer(t){return this._get("buffers",t)}_get(t,e){if("object"==typeof e)return e;const r=this.json[t]&&this.json[t][e];return r||console.warn("glTF file error: Could not find ".concat(t,"[").concat(e,"]")),r}_resolveScene(t,e){return t.id=t.id||"scene-".concat(e),t.nodes=(t.nodes||[]).map((t=>this.getNode(t))),t}_resolveNode(t,e){return t.id=t.id||"node-".concat(e),t.children&&(t.children=t.children.map((t=>this.getNode(t)))),void 0!==t.mesh?t.mesh=this.getMesh(t.mesh):void 0!==t.meshes&&t.meshes.length&&(t.mesh=t.meshes.reduce(((t,e)=>{const r=this.getMesh(e);return t.id=r.id,t.primitives=t.primitives.concat(r.primitives),t}),{primitives:[]})),void 0!==t.camera&&(t.camera=this.getCamera(t.camera)),void 0!==t.skin&&(t.skin=this.getSkin(t.skin)),t}_resolveSkin(t,e){return t.id=t.id||"skin-".concat(e),t.inverseBindMatrices=this.getAccessor(t.inverseBindMatrices),t}_resolveMesh(t,e){return t.id=t.id||"mesh-".concat(e),t.primitives&&(t.primitives=t.primitives.map((t=>{const e=(t={...t}).attributes;t.attributes={};for(const r in e)t.attributes[r]=this.getAccessor(e[r]);return void 0!==t.indices&&(t.indices=this.getAccessor(t.indices)),void 0!==t.material&&(t.material=this.getMaterial(t.material)),t}))),t}_resolveMaterial(t,e){if(t.id=t.id||"material-".concat(e),t.normalTexture&&(t.normalTexture={...t.normalTexture},t.normalTexture.texture=this.getTexture(t.normalTexture.index)),t.occlusionTexture&&(t.occlustionTexture={...t.occlustionTexture},t.occlusionTexture.texture=this.getTexture(t.occlusionTexture.index)),t.emissiveTexture&&(t.emmisiveTexture={...t.emmisiveTexture},t.emissiveTexture.texture=this.getTexture(t.emissiveTexture.index)),t.emissiveFactor||(t.emissiveFactor=t.emmisiveTexture?[1,1,1]:[0,0,0]),t.pbrMetallicRoughness){t.pbrMetallicRoughness={...t.pbrMetallicRoughness};const e=t.pbrMetallicRoughness;e.baseColorTexture&&(e.baseColorTexture={...e.baseColorTexture},e.baseColorTexture.texture=this.getTexture(e.baseColorTexture.index)),e.metallicRoughnessTexture&&(e.metallicRoughnessTexture={...e.metallicRoughnessTexture},e.metallicRoughnessTexture.texture=this.getTexture(e.metallicRoughnessTexture.index))}return t}_resolveAccessor(t,e){var r,n;if(t.id=t.id||"accessor-".concat(e),void 0!==t.bufferView&&(t.bufferView=this.getBufferView(t.bufferView)),t.bytesPerComponent=(r=t.componentType,Wa[r]),t.components=(n=t.type,za[n]),t.bytesPerElement=t.bytesPerComponent*t.components,t.bufferView){const e=t.bufferView.buffer,{ArrayType:r,byteLength:n}=da(t,t.bufferView),s=(t.bufferView.byteOffset||0)+(t.byteOffset||0)+e.byteOffset;let i=e.arrayBuffer.slice(s,s+n);t.bufferView.byteStride&&(i=this._getValueFromInterleavedBuffer(e,s,t.bufferView.byteStride,t.bytesPerElement,t.count)),t.value=new r(i)}return t}_getValueFromInterleavedBuffer(t,e,r,n,s){const i=new Uint8Array(s*n);for(let o=0;o20);const n=e.getUint32(r+0,ac),s=e.getUint32(r+4,ac);return r+=8,o(0===s),uc(t,e,r,n),r+=n,r+=lc(t,e,r,t.header.byteLength)}(t,s,r);case 2:return function(t,e,r,n){return o(t.header.byteLength>20),function(t,e,r,n){for(;r+8<=t.header.byteLength;){const s=e.getUint32(r+0,ac),i=e.getUint32(r+4,ac);switch(r+=8,i){case ic:uc(t,e,r,s);break;case oc:lc(t,e,r,s);break;case 0:n.strict||uc(t,e,r,s);break;case 1:n.strict||lc(t,e,r,s)}r+=J(s,4)}}(t,e,r,n),r+t.header.byteLength}(t,s,r,{});default:throw new Error("Invalid GLB version ".concat(t.version,". Only supports v1 and v2."))}}function uc(t,e,r,n){const s=new Uint8Array(e.buffer,r,n),i=new TextDecoder("utf8").decode(s);return t.json=JSON.parse(i),J(n,4)}function lc(t,e,r,n){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:e.buffer}),J(n,4)}async function hc(t,e,r=0,n,s){var i,o,a,c;!function(t,e,r,n){n.uri&&(t.baseUri=n.uri);if(e instanceof ArrayBuffer&&!function(t,e=0,r={}){const n=new DataView(t),{magic:s=sc}=r,i=n.getUint32(e,!1);return i===s||i===sc}(e,r,n)){e=(new TextDecoder).decode(e)}if("string"==typeof e)t.json=U(e);else if(e instanceof ArrayBuffer){const s={};r=cc(s,e,r,n.glb),ra("glTF"===s.type,"Invalid GLB magic string ".concat(s.type)),t._glb=s,t.json=s.json}else ra(!1,"GLTF: must be ArrayBuffer or string");const s=t.json.buffers||[];if(t.buffers=new Array(s.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 i=t.json.images||[];t.images=new Array(i.length).fill({})}(t,e,r,n),function(t,e={}){(new qa).normalize(t,e)}(t,{normalize:null==n||null===(i=n.gltf)||void 0===i?void 0:i.normalize}),function(t,e={},r){const n=ja.filter((t=>ka(t.name,e)));for(const i of n){var s;null===(s=i.preprocess)||void 0===s||s.call(i,t,e,r)}}(t,n,s);const u=[];if(null!=n&&null!==(o=n.gltf)&&void 0!==o&&o.loadBuffers&&t.json.buffers&&await async function(t,e,r){const n=t.json.buffers||[];for(let o=0;oka(t.name,e)));for(const i of n){var s;await(null===(s=i.decode)||void 0===s?void 0:s.call(i,t,e,r))}}(t,n,s);return u.push(l),await Promise.all(u),null!=n&&null!==(c=n.gltf)&&void 0!==c&&c.postProcess?function(t,e){return(new nc).postProcess(t,e)}(t,n):t}async function dc(t,e,r,n,s){const{fetch:i,parse:o}=s;let a;if(e.uri){const t=na(e.uri,n),r=await i(t);a=await r.arrayBuffer()}if(Number.isFinite(e.bufferView)){const r=function(t,e,r){const n=t.bufferViews[r];ra(n);const s=e[n.buffer];ra(s);const i=(n.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,i,n.byteLength)}(t.json,t.buffers,e.bufferView);a=H(r.buffer,r.byteOffset,r.byteLength)}ra(a,"glTF image has no data");let c=await o(a,[Zo,So],{mimeType:e.mimeType,basis:n.basis||{format:Ro()}},s);c&&c[0]&&(c={compressed:!0,mipmaps:!1,width:c[0].width,height:c[0].height,data:c}),t.images=t.images||[],t.images[r]=c}const fc={name:"glTF",id:"gltf",module:"gltf",version:"3.1.4",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(t,e={},r){(e={...fc.options,...e}).gltf={...fc.options.gltf,...e.gltf};const{byteOffset:n=0}=e;return await hc({},t,n,e,r)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};const Ac=0,mc=1;function pc(t,e,r,n){t.rotateYtoZ=!0;const s=t.byteOffset+t.byteLength-r;if(0===s)throw new Error("glTF byte length must be greater than 0.");return t.gltfUpAxis=n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",t.gltfArrayBuffer=H(e,r,s),t.gltfByteOffset=0,t.gltfByteLength=s,r%4==0||console.warn("".concat(t.type,": embedded glb is not aligned to a 4-byte boundary.")),t.byteOffset+t.byteLength}async function Bc(t,e,r,n){const s=r["3d-tiles"]||{};if(function(t,e,r){switch(e){case Ac:const e=new Uint8Array(t.gltfArrayBuffer,t.gltfByteOffset),r=(new TextDecoder).decode(e);t.gltfUrl=r.replace(/[\s\0]+$/,""),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;break;case mc:break;default:throw new Error("b3dm: Illegal glTF format field")}}(t,e),s.loadGLTF){const{parse:e,fetch:s}=n;t.gltfUrl&&(t.gltfArrayBuffer=await s(t.gltfUrl,r),t.gltfByteOffset=0),t.gltfArrayBuffer&&(t.gltf=await e(t.gltfArrayBuffer,fc,r,n),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength)}}async function gc(t,e,r,n,s){var i;r=function(t,e,r,n,s){r=Vi(t,e,r),r=Qi(t,e,r),r=qi(t,e,r),r=pc(t,e,r,n);const i=new Ri(t.featureTableJson,t.featureTableBinary);return t.rtcCenter=i.getGlobalProperty("RTC_CENTER",Ti.FLOAT,3),r}(t,e,r,n),await Bc(t,mc,n,s);const o=null==t||null===(i=t.gltf)||void 0===i?void 0:i.extensions;return o&&o.CESIUM_RTC&&(t.rtcCenter=o.CESIUM_RTC.center),r}async function yc(t,e,r,n,s){return r=function(t,e,r,n,s){if(r=Vi(t,e,r),1!==t.version)throw new Error("Instanced 3D Model version ".concat(t.version," is not supported"));r=Qi(t,e,r);const i=new DataView(e);if(t.gltfFormat=i.getUint32(r,!0),r=qi(t,e,r+=4),r=pc(t,e,r,n),0===t.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new Ri(t.featureTableJson,t.featureTableBinary),a=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=a,!Number.isFinite(a))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");t.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),t.rtcCenter=o.getGlobalProperty("RTC_CENTER",Ti.FLOAT,3);new ki(t.batchTableJson,t.batchTableBinary,a);return function(t,e,r,n){const s=[new Array(n),t._batchTable][0],i=new Pe;new Pe,new Pe,new Pe;const o=new We,a=new Cr,c=new Pe,u={},l=new rr,h=[],d=[],f=new Pe,A=new Pe;for(let r=0;r12;){const o={};t.tiles.push(o),r=await i(e,r,n,s,o)}return r}(s,t,e,r,n,Cc);case Ls:return await gc(s,t,e,r,n);case Hs:return await async function(t,e,r,n){t.rotateYtoZ=!0,t.gltfUpAxis=r["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y";const{parse:s}=n;t.gltf=await s(e,fc,r,n)}(s,t,r,n);case Ns:return await yc(s,t,e,r,n);case Us:return await Xi(s,t,e,r,n);default:throw new Error("3DTileLoader: unknown type ".concat(s.type))}}async function bc(t,e,r){const n=t[e].bufferView,s=t.bufferViews[n],i=t.buffers[s.buffer];if(i.uri){const t=await lt(i.uri),e=await t.arrayBuffer();return new Uint8Array(e,s.byteOffset,s.byteLength)}return new Uint8Array(r,s.byteOffset,s.byteLength)}function wc(t){const e=new DataView(t);return e.getUint32(0,!0)+2**32*e.getUint32(4,!0)}const Tc={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Os,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:async function(t){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 e=wc(t.slice(8,16)),r=new Uint8Array(t,24,e),n=new TextDecoder("utf8").decode(r),s=JSON.parse(n),i=wc(t.slice(16,24));let o=new ArrayBuffer(0);return i&&(o=t.slice(24+e)),"bufferView"in s.tileAvailability&&(s.tileAvailability.explicitBitstream=await bc(s,"tileAvailability",o)),"bufferView"in s.contentAvailability&&(s.contentAvailability.explicitBitstream=await bc(s,"contentAvailability",o)),"bufferView"in s.childSubtreeAvailability&&(s.childSubtreeAvailability.explicitBitstream=await bc(s,"childSubtreeAvailability",o)),s},options:{}},Ec={QUADTREE:4,OCTREE:8};async function Mc(t,e,r={mortonIndex:0,x:0,y:0,z:0},n=0,s=0,i={level:0,mortonIndex:0,x:0,y:0,z:0}){const{subdivisionScheme:o,subtreeLevels:a,maximumLevel:c,contentUrlTemplate:u,subtreesUriTemplate:l,basePath:h}=e,d={children:[],lodMetricValue:0,contentUrl:""},f=Ec[o],A=1&n,m=n>>1&1,p=n>>2&1,B=(f**s-1)/(f-1);let g=_c(r.mortonIndex,n),y=B+g,C=_c(r.x,A),b=_c(r.y,m),w=_c(r.z,p),T=!1;s+1>a&&(T=vc(t.childSubtreeAvailability,g));const E=_c(i.x,C),M=_c(i.y,b),v=_c(i.z,w),I=s+i.level;if(T){const e=Fc("".concat(h,"/").concat(l),I,E,M,v);t=await ie(e,Tc),i.mortonIndex=g,i.x=C,i.y=b,i.z=w,i.level=s,g=0,y=0,C=0,b=0,w=0,s=0}if(!vc(t.tileAvailability,y)||s>c)return d;vc(t.contentAvailability,y)&&(d.contentUrl=Fc(u,I,E,M,v));const _=s+1,F={mortonIndex:g,x:C,y:b,z:w};for(let r=0;r>n&1)}(e,t.explicitBitstream)}function Ic(t,e,r,n){const{basePath:s,refine:i,getRefine:o,lodMetricType:a,getTileType:c,rootLodMetricValue:u,rootBoundingVolume:l}=n,h=t.contentUrl&&t.contentUrl.replace("".concat(s,"/"),""),d=u/2**e,f=function(t,e,r){if(e.region){const{childTileX:n,childTileY:s,childTileZ:i}=r,[o,a,c,u,l,h]=e.region,d=2**t,f=(c-o)/d,A=(u-a)/d,m=(h-l)/d,[p,B]=[o+f*n,o+f*(n+1)],[g,y]=[a+A*s,a+A*(s+1)],[C,b]=[l+m*i,l+m*(i+1)];return{region:[p,g,B,y,C,b]}}return console.warn("Unsupported bounding volume type: ",e),null}(e,l,r);return{children:t.children,contentUrl:t.contentUrl,content:{uri:h},id:t.contentUrl,refine:o(i),type:c(t),lodMetricType:a,lodMetricValue:d,boundingVolume:f}}function _c(t,e){return parseInt(t.toString(2)+e.toString(2),2)}function Fc(t,e,r,n,s){const i=function(t){const e={};for(const r in t)e["{".concat(r,"}")]=t[r];return e}({level:e,x:r,y:n,z:s});return t.replace(/{level}|{x}|{y}|{z}/gi,(t=>i[t]))}function Dc(t){if(!t.contentUrl)return Wn;const e=t.contentUrl.split(".").pop();switch(e){case"pnts":return Xn;case"i3dm":case"b3dm":case"glb":case"gltf":return Yn;default:return e}}function Gc(t){switch(t){case"REPLACE":case"replace":return zn;case"ADD":case"add":return qn;default:return t}}function Rc(t,e){if(!t)return null;if(t.content){const r=t.content.uri||t.content.url;t.contentUrl="".concat(e.basePath,"/").concat(r)}return t.id=t.contentUrl,t.lodMetricType=es,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform,t.type=Dc(t),t.refine=Gc(t.refine),t}async function Sc(t){if(!t.root)return null;const e=t.basePath,r=t.root.extensions["3DTILES_implicit_tiling"],{subdivisionScheme:n,maximumLevel:s,subtreeLevels:i,subtrees:{uri:o}}=r,a=Fc(o,0,0,0,0),c="".concat(e,"/").concat(a),u=await ie(c,Tc),l="".concat(e,"/").concat(t.root.content.uri),h=t.root.refine,d=t.root.geometricError,f=t.root.boundingVolume,A={contentUrlTemplate:l,subtreesUriTemplate:o,subdivisionScheme:n,subtreeLevels:i,maximumLevel:s,refine:h,basePath:e,lodMetricType:es,rootLodMetricValue:d,rootBoundingVolume:f,getTileType:Dc,getRefine:Gc};return await async function(t,e,r){if(!t)return null;t.lodMetricType=es,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform;const{children:n,contentUrl:s}=await Mc(e,r);s&&(t.contentUrl=s,t.content={uri:s.replace("".concat(r.basePath,"/"),"")});return t.refine=Gc(t.refine),t.type=Dc(t),t.children=n,t.id=t.contentUrl,t}(t.root,u,A)}const Oc="3DTILES_implicit_tiling",xc={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Os,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(t,e,r){const n=e["3d-tiles"]||{};let s;s="auto"===n.isTileset?r.url&&-1!==r.url.indexOf(".json"):n.isTileset;t=s?await async function(t,e,r){var n;const s=JSON.parse((new TextDecoder).decode(t));return s.loader=e.loader||xc,s.url=r.url,s.basePath=function(t){return W(t.url)}(s),s.root=function(t){var e,r;return(null==t||null===(e=t.extensionsRequired)||void 0===e?void 0:e.includes(Oc))&&(null==t||null===(r=t.extensionsUsed)||void 0===r?void 0:r.includes(Oc))}(s)?await Sc(s):function(t){const e=t.basePath,r=Rc(t.root,t),n=[];for(n.push(r);n.length>0;){const t=(n.pop()||{}).children||[];for(const r of t)Rc(r,{basePath:e}),n.push(r)}return r}(s),s.type=ts,s.lodMetricType=es,s.lodMetricValue=(null===(n=s.root)||void 0===n?void 0:n.lodMetricValue)||0,s}(t,e,r):await async function(t,e,r){const n={content:{featureIds:null}},s=0;return await Cc(t,s,e,r,n.content),n.content}(t,e,r);return t},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};const Uc="https://api.cesium.com/v1/assets";async function Lc(t,e){if(!e){const r=await async function(t){o(t);const e=Uc,r={Authorization:"Bearer ".concat(t)},n=await lt(e,{fetch:{headers:r}});if(!n.ok)throw new Error(n.statusText);return await n.json()}(t);for(const t of r.items)"3DTILES"===t.type&&(e=t.id)}const r=await async function(t,e){o(t,e);const r={Authorization:"Bearer ".concat(t)},n="".concat(Uc,"/").concat(e);let s=await lt("".concat(n),{fetch:{headers:r}});if(!s.ok)throw new Error(s.statusText);let i=await s.json();if(s=await lt("".concat(n,"/endpoint"),{fetch:{headers:r}}),!s.ok)throw new Error(s.statusText);const a=await s.json();return i={...i,...a},i}(t,e),{type:n,url:s}=r;return o("3DTILES"===n&&s),r.headers={Authorization:"Bearer ".concat(r.accessToken)},r}const Nc={...xc,id:"cesium-ion",name:"Cesium Ion",preload:async function(t,e={}){e=e["cesium-ion"]||{};const{accessToken:r}=e;let n=e.assetId;if(!Number.isFinite(n)){const e=t.match(/\/([0-9]+)\/tileset.json/);n=e&&e[1]}return Lc(r,n)},parse:async(t,e,r)=>((e={...e})["3d-tiles"]=e["cesium-ion"],e.loader=Nc,xc.parse(t,e,r)),options:{"cesium-ion":{...xc.options["3d-tiles"],accessToken:null}}};function Hc(t){const r=64,n=document.createElement("canvas");n.width=r,n.height=r;const s=n.getContext("2d");s.rect(0,0,r,r);const i=s.createLinearGradient(0,0,r,r);for(let e=0;e{if(t.isMesh)if(t.geometry.dispose(),t.material.isMaterial)Yc(t.material);else for(const e of t.material)Yc(e)}));for(let e=t.children.length-1;e>=0;e--){const r=t.children[e];t.remove(r)}}t.Loader3DTiles=class{static load(o){return i(this,void 0,void 0,(function*(){const a=Object.assign(Object.assign({},Wc),o.options),{url:c}=o,u=a.updateInterval,l={};if(a.cesiumIONToken){l["cesium-ion"]={accessToken:a.cesiumIONToken};const t=yield Nc.preload(c,l);l.fetch={headers:t.headers}}o.loadingManager&&o.loadingManager.itemStart(c);const h=yield ie(c,xc,Object.assign({},l)),d={},f={},A=[],m=new e.Group,p=new e.Group;a.debug||(p.visible=!1);const B={pointSize:{type:"f",value:a.pointSize},gradient:{type:"t",value:qc},grayscale:{type:"t",value:zc},rootCenter:{type:"vec3",value:new e.Vector3},rootNormal:{type:"vec3",value:new e.Vector3},coloring:{type:"i",value:a.pointCloudColoring},hideGround:{type:"b",value:!0},elevationRange:{type:"vec2",value:new e.Vector2(0,400)},maxIntensity:{type:"f",value:1},intensityContrast:{type:"f",value:1},alpha:{type:"f",value:1}},g=new e.ShaderMaterial({uniforms:B,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:a.transparent,vertexColors:!0});let y=null,C=null;const b=new r.GLTFLoader;let w,T;a.basisTranscoderPath&&(w=new s.KTX2Loader,w.detectSupport(o.renderer),w.setTranscoderPath(a.basisTranscoderPath+"/"),w.setWorkerLimit(1),b.setKTX2Loader(w)),a.dracoDecoderPath&&(T=new n.DRACOLoader,T.setDecoderPath(a.dracoDecoderPath+"/"),T.setWorkerLimit(a.maxConcurrency),b.setDRACOLoader(T));const E=new e.MeshBasicMaterial({transparent:a.transparent}),M={maximumMemoryUsage:a.maximumMemoryUsage,maximumScreenSpaceError:a.maximumScreenSpaceError,viewDistanceScale:a.viewDistanceScale,skipLevelOfDetail:a.skipLevelOfDetail,updateTransforms:a.updateTransforms,throttleRequests:a.throttleRequests,maxRequests:a.maxRequests,contentLoader:r=>i(this,void 0,void 0,(function*(){let n=null;switch(r.type){case Xn:n=function(t,r,n,s){const i={rtc_center:t.content.rtcCenter,points:t.content.attributes.positions,intensities:t.content.attributes.intensity,classifications:t.content.attributes.classification,rgb:null,rgba:null},{colors:o}=t.content.attributes;o&&3===o.size&&(i.rgb=o.value);o&&4===o.size&&(i.rgba=o.value);const a=new e.BufferGeometry;a.setAttribute("position",new e.Float32BufferAttribute(i.points,3));const c=(new e.Matrix4).fromArray(t.computedTransform).premultiply(s);i.rgba?a.setAttribute("color",new e.Float32BufferAttribute(i.rgba,4)):i.rgb&&a.setAttribute("color",new e.Uint8BufferAttribute(i.rgb,3,!0));i.intensities&&a.setAttribute("intensity",new e.BufferAttribute(i.intensities,1,!0));i.classifications&&a.setAttribute("classification",new e.Uint8BufferAttribute(i.classifications,1,!1));const u=new e.Points(a,n.material||r);if(i.rtc_center){const t=i.rtc_center;c.multiply((new e.Matrix4).makeTranslation(t[0],t[1],t[2]))}return u.applyMatrix4(c),u}(r,g,a,H);break;case Yn:case Zn:n=yield function(r,n,s,o,a){return i(this,void 0,void 0,(function*(){return new Promise(((i,c)=>{var u;const l=(new e.Matrix4).makeRotationAxis(new e.Vector3(1,0,0),Math.PI/2),h="Z"!==(null===(u=n.tileset.asset)||void 0===u?void 0:u.gltfUpAxis),d=(new e.Matrix4).fromArray(n.computedTransform).premultiply(a);h&&d.multiply(l),r.parse(n.content.gltfArrayBuffer,n.contentUrl?n.contentUrl.substr(0,n.contentUrl.lastIndexOf("/")+1):"",(e=>{const r=e.scenes[0];r.applyMatrix4(d),r.traverse((e=>{if("Mesh"==e.type){const r=e,n=r.material,i=n.map;o.material?(r.material=o.material.clone(),n.dispose()):o.shading==t.Shading.FlatTexture&&(r.material=s.clone(),n.dispose()),o.shading!=t.Shading.ShadedNoTexture?"ShaderMaterial"==r.material.type?r.material.uniforms.map={value:i}:r.material.map=i:(i&&i.dispose(),r.material.map=null),o.shaderCallback&&(r.onBeforeRender=o.shaderCallback),r.material.wireframe=o.wireframe,o.computeNormals&&r.geometry.computeVertexNormals()}})),i(r)}),(t=>{c(new Error(`error parsing gltf in tile ${n.id}: ${t}`))}))}))}))}(b,r,E,a,H)}if(n&&(n.visible=!1,d[r.id]=n,m.add(d[r.id]),a.debug)){const t=Pc(r);p.add(t),f[r.id]=t}})),onTileLoad:t=>i(this,void 0,void 0,(function*(){v&&(!D&&(null==t?void 0:t.depth)<=5&&J(t),v._frameNumber++,j(v,d,C,y))})),onTileUnload:t=>{A.push(t)},onTileError:(t,e)=>{console.error("Tile error",t.id,e)}},v=new Ss(h,Object.assign(Object.assign({},M),{loadOptions:Object.assign(Object.assign({},l),{maxConcurrency:a.maxConcurrency,worker:a.worker,gltf:{loadImages:!1},"3d-tiles":{loadGLTF:!1}})})),I=new e.Matrix4,_=new e.Matrix4,F=new e.Vector3;let D=!1;if(v.root.boundingVolume?(v.root.header.boundingVolume.region&&(console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."),a.geoTransform=t.GeoTransform.WGS84Cartesian),_.setPosition(v.root.boundingVolume.center[0],v.root.boundingVolume.center[1],v.root.boundingVolume.center[2])):console.warn("Bounding volume not found, no transformations applied"),a.debug){const t=Pc(v.root);p.add(t),f[v.root.id]=t}let G=!1,R=!1;B.rootCenter.value.copy(F),B.rootNormal.value.copy(new e.Vector3(0,0,1).normalize()),v.stats.get("Loader concurrency").count=a.maxConcurrency,v.stats.get("Maximum SSE").count=a.maximumScreenSpaceError,v.stats.get("Maximum mem usage").count=a.maximumMemoryUsage;let S=0;const O=(new e.Matrix4).makeTranslation(1/0,1/0,1/0);let x=null;const U=new e.Vector3(1/0,1/0,1/0);let L=null;m.updateMatrixWorld(!0);const N=(new e.Matrix4).copy(m.matrixWorld),H=(new e.Matrix4).copy(N).invert();if(J(v.root),P(),a.debug&&(f[v.root.id].applyMatrix4(I),p.matrixWorld.copy(m.matrixWorld)),a.geoTransform==t.GeoTransform.Mercator){const t=function(t,r){const n=2*Math.PI*6378137/2,s=r*n/180;let i=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180);return i=i*n/180,new e.Vector2(s,i)}(v.cartographicCenter[1],v.cartographicCenter[0]);F.set(t.x,0,-t.y),m.position.copy(F),m.rotation.set(-Math.PI/2,0,0),m.updateMatrixWorld(!0)}else a.geoTransform==t.GeoTransform.WGS84Cartesian&&(m.applyMatrix4(_),m.updateMatrixWorld(!0),F.copy(m.position));function J(t){if(!t.boundingVolume.halfAxes)return;const r=t.boundingVolume.halfAxes,n=(new e.Matrix4).extractRotation(jc(r)).premultiply((new e.Matrix4).extractRotation(H));if(!(new e.Euler).setFromRotationMatrix(n).equals(new e.Euler)){D=!0;const t=new e.Vector3(_.elements[12],_.elements[13],_.elements[14]);_.extractRotation(n),_.setPosition(t),P()}}function P(){a.geoTransform!=t.GeoTransform.WGS84Cartesian&&(I.copy(_).invert(),I.premultiply(N),I.copy(N).multiply((new e.Matrix4).copy(_).invert()),v.modelMatrix=new rr(I.toArray()))}function j(t,r,n,s){if(G)return;if(!L||s.aspect!=x){const t=new Sn({fov:s.fov/180*Math.PI,aspectRatio:s.aspect,near:s.near,far:s.far});L=t.sseDenominator,x=s.aspect,a.debug&&console.log("Updated sse denonimator:",L)}const i=Jc(s).planes.map((t=>new bn(t.normal.toArray(),t.constant))),c=new Mn(i),u=new e.Vector2;n.getSize(u);const l={camera:{position:U.toArray()},height:u.y,frameNumber:t._frameNumber,sseDenominator:L,cullingVolume:c,viewport:{id:0}};t._cache.reset(),t._traverser.traverse(t.root,l,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(;A.length>0;){const t=A.pop();r[t.id]&&t.contentState==jn&&(m.remove(r[t.id]),Xc(r[t.id]),delete r[t.id]),f[t.id]&&(Xc(f[t.id]),p.remove(f[t.id]),delete f[t.id])}const h=t.stats.get("Tiles Loaded").count,d=t.stats.get("Tiles Loading").count;return o.onProgress&&o.onProgress(h,h+d),o.loadingManager&&!R&&0==d&&(null==a.preloadTilesCount||h>=a.preloadTilesCount)&&(R=!0,o.loadingManager.itemEnd(o.url)),l}return{model:m,runtime:{getTileset:()=>v,getStats:()=>v.stats,showTiles:t=>{p.visible=t},setWireframe:t=>{a.wireframe=t,m.traverse((r=>{r instanceof e.Mesh&&(r.material.wireframe=t)}))},setDebug:t=>{a.debug=t,p.visible=t},setShading:t=>{a.shading=t},getTileBoxes:()=>p,setViewDistanceScale:t=>{v.options.viewDistanceScale=t,v._frameNumber++,j(v,d,C,y)},setHideGround:t=>{B.hideGround.value=t},setPointCloudColoring:t=>{B.coloring.value=t},setElevationRange:t=>{B.elevationRange.value.set(t[0],t[1])},setMaxIntensity:t=>{B.maxIntensity.value=t},setIntensityContrast:t=>{B.intensityContrast.value=t},setPointAlpha:t=>{B.alpha.value=t},getLatLongHeightFromPosition:t=>{const r=v.ellipsoid.cartesianToCartographic((new e.Vector3).copy(t).applyMatrix4((new e.Matrix4).copy(I).invert()).toArray());return{lat:r[1],long:r[0],height:r[2]}},getPositionFromLatLongHeight:t=>{const r=v.ellipsoid.cartographicToCartesian([t.long,t.lat,t.height]);return new e.Vector3(...r).applyMatrix4(I)},getCameraFrustum:t=>{const r=Jc(t).planes.map((t=>new bn(t.normal.toArray(),t.constant))).map((t=>function(t){const r=new e.Group,n=new e.PlaneGeometry(10,5),s=new e.Vector3(...t.projectPointOntoPlane([0,0,0])),i=new e.Vector3(t.normal.x,t.normal.y,t.normal.z),o=(new e.Vector3).copy(s).add(i);n.lookAt(o),n.translate(s.x,s.y,s.z);const a=new e.MeshBasicMaterial({color:65535,side:e.DoubleSide}),c=new e.Mesh(n,a),u=new e.ArrowHelper(i,s,5,16776960);return r.add(u),r.add(c),r}(t))),n=new e.Group;for(const t of r)n.add(t);return n},update:function(t,r,n){if(y=n,C=r,S+=t,v&&S>=u){if(!N.equals(m.matrixWorld)){N.copy(m.matrixWorld),P();const t=(new e.Vector3).setFromMatrixPosition(N);B.rootCenter.value.copy(t),B.rootNormal.value.copy(new e.Vector3(0,0,1).applyMatrix4(N).normalize()),H.copy(N).invert(),a.debug&&(f[v.root.id].matrixWorld.copy(I),f[v.root.id].applyMatrix4(N))}!(n.matrixWorld.equals(O)&&n.aspect==x)&&(S=0,v._frameNumber++,n.getWorldPosition(U),O.copy(n.matrixWorld),j(v,d,r,n))}},dispose:function(){for(G=!0,v._destroy();m.children.length>0;){const t=m.children[0];Xc(t),m.remove(t)}for(;p.children.length>0;){const t=p.children[0];p.remove(t),t.geometry.dispose(),t.material.dispose()}w&&w.dispose(),T&&T.dispose()}}}}))}},Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=three-loader-3dtiles.min.js.map