@loaders.gl/i3s 4.2.0-alpha.4 → 4.2.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arcgis-webscene-loader.d.ts +1 -1
- package/dist/arcgis-webscene-loader.d.ts.map +1 -1
- package/dist/arcgis-webscene-loader.js +19 -10
- package/dist/dist.dev.js +1244 -731
- package/dist/dist.min.js +9 -0
- package/dist/i3s-attribute-loader.d.ts +2 -2
- package/dist/i3s-attribute-loader.d.ts.map +1 -1
- package/dist/i3s-attribute-loader.js +145 -94
- package/dist/i3s-building-scene-layer-loader.d.ts +2 -2
- package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -1
- package/dist/i3s-building-scene-layer-loader.js +17 -13
- package/dist/i3s-content-loader.d.ts +2 -2
- package/dist/i3s-content-loader.d.ts.map +1 -1
- package/dist/i3s-content-loader.js +23 -24
- package/dist/i3s-content-worker-node.js +1 -1
- package/dist/i3s-content-worker-node.js.map +2 -2
- package/dist/i3s-content-worker.js +3 -1
- package/dist/i3s-loader.d.ts +2 -2
- package/dist/i3s-loader.d.ts.map +1 -1
- package/dist/i3s-loader.js +76 -65
- package/dist/i3s-node-page-loader.d.ts +2 -2
- package/dist/i3s-node-page-loader.d.ts.map +1 -1
- package/dist/i3s-node-page-loader.js +16 -12
- package/dist/i3s-slpk-loader.js +18 -14
- package/dist/index.cjs +73 -138
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +14 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js +226 -184
- package/dist/lib/parsers/constants.js +72 -45
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts +1 -1
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -1
- package/dist/lib/parsers/parse-arcgis-webscene.js +79 -59
- package/dist/lib/parsers/parse-i3s-attribute.js +83 -46
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js +36 -33
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +460 -394
- package/dist/lib/parsers/parse-i3s.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s.js +84 -81
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts +1 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.js +23 -16
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js +132 -97
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js +12 -5
- package/dist/lib/utils/customize-colors.d.ts +1 -1
- package/dist/lib/utils/customize-colors.d.ts.map +1 -1
- package/dist/lib/utils/customize-colors.js +95 -81
- package/dist/lib/utils/url-utils.d.ts +1 -1
- package/dist/lib/utils/url-utils.d.ts.map +1 -1
- package/dist/lib/utils/url-utils.js +48 -28
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -6
- package/dist/workers/i3s-content-worker-node.js +1 -1
- package/dist/workers/i3s-content-worker.js +0 -1
- package/package.json +13 -12
- package/dist/arcgis-webscene-loader.js.map +0 -1
- package/dist/i3s-attribute-loader.js.map +0 -1
- package/dist/i3s-building-scene-layer-loader.js.map +0 -1
- package/dist/i3s-content-loader.js.map +0 -1
- package/dist/i3s-loader.js.map +0 -1
- package/dist/i3s-node-page-loader.js.map +0 -1
- package/dist/i3s-slpk-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
- package/dist/lib/parsers/constants.js.map +0 -1
- package/dist/lib/parsers/parse-arcgis-webscene.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
- package/dist/lib/parsers/parse-i3s.js.map +0 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.js.map +0 -1
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js.map +0 -1
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
- package/dist/lib/utils/customize-colors.js.map +0 -1
- package/dist/lib/utils/url-utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/workers/i3s-content-worker-node.js.map +0 -1
- package/dist/workers/i3s-content-worker.js.map +0 -1
|
@@ -97,7 +97,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
97
97
|
} catch (error) {
|
|
98
98
|
console.error(error);
|
|
99
99
|
throw error;
|
|
100
|
-
}`}function Mc(e,r=!0,t){let i=t||new Set;if(e){if(z5(e))i.add(e);else if(z5(e.buffer))i.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(r&&typeof e=="object")for(let a in e)Mc(e[a],r,i)}}return t===void 0?Array.from(i):[]}function z5(e){return e?e instanceof ArrayBuffer||typeof MessagePort<"u"&&e instanceof MessagePort||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas:!1}var Kg=()=>{},Eo=class{constructor(r){this.terminated=!1;this._loadableURL="";let{name:t,source:i,url:a}=r;ma(i||a),this.name=t,this.source=i,this.url=a,this.onMessage=Kg,this.onError=n=>console.log(n),this.worker=oa?this._createBrowserWorker():this._createNodeWorker()}static isSupported(){return typeof Worker<"u"&&oa||typeof qc<"u"&&!oa}destroy(){this.onMessage=Kg,this.onError=Kg,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(r,t){t=t||Mc(r),this.worker.postMessage(r,t)}_getErrorFromErrorEvent(r){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,r.message&&(t+=`${r.message} in `),r.lineno&&(t+=`:${r.lineno}:${r.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=q5({source:this.source,url:this.url});let r=new Worker(this._loadableURL,{name:this.name});return r.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},r.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},r.onmessageerror=t=>console.error(t),r}_createNodeWorker(){let r;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;r=new qc(i,{eval:!1})}else if(this.source)r=new qc(this.source,{eval:!0});else throw new Error("no worker");return r.on("message",t=>{this.onMessage(t)}),r.on("error",t=>{this.onError(t)}),r.on("exit",t=>{}),r}};var zc=class{constructor(r){this.name="unnamed";this.maxConcurrency=1;this.maxMobileConcurrency=1;this.onDebug=()=>{};this.reuseWorkers=!0;this.props={};this.jobQueue=[];this.idleQueue=[];this.count=0;this.isDestroyed=!1;this.source=r.source,this.url=r.url,this.setProps(r)}static isSupported(){return Eo.isSupported()}destroy(){this.idleQueue.forEach(r=>r.destroy()),this.isDestroyed=!0}setProps(r){this.props={...this.props,...r},r.name!==void 0&&(this.name=r.name),r.maxConcurrency!==void 0&&(this.maxConcurrency=r.maxConcurrency),r.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=r.maxMobileConcurrency),r.reuseWorkers!==void 0&&(this.reuseWorkers=r.reuseWorkers),r.onDebug!==void 0&&(this.onDebug=r.onDebug)}async startJob(r,t=(a,n,o)=>a.done(o),i=(a,n)=>a.error(n)){let a=new Promise(n=>(this.jobQueue.push({name:r,onMessage:t,onError:i,onStart:n}),this));return this._startQueuedJob(),await a}async _startQueuedJob(){if(!this.jobQueue.length)return;let r=this._getAvailableWorker();if(!r)return;let t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:r,backlog:this.jobQueue.length});let i=new Dc(t.name,r);r.onMessage=a=>t.onMessage(i,a.type,a.payload),r.onError=a=>t.onError(i,a),t.onStart(i);try{await i.result}catch(a){console.error(`Worker exception: ${a}`)}finally{this.returnWorkerToQueue(r)}}}returnWorkerToQueue(r){!oa||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(r.destroy(),this.count--):this.idleQueue.push(r),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let r=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Eo({name:r,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return L5?this.maxMobileConcurrency:this.maxConcurrency}};var FU={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},Qa=class{constructor(r){this.workerPools=new Map;this.props={...FU},this.setProps(r),this.workerPools=new Map}static isSupported(){return Eo.isSupported()}static getWorkerFarm(r={}){return Qa._workerFarm=Qa._workerFarm||new Qa({}),Qa._workerFarm.setProps(r),Qa._workerFarm}destroy(){for(let r of this.workerPools.values())r.destroy();this.workerPools=new Map}setProps(r){this.props={...this.props,...r};for(let t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(r){let{name:t,source:i,url:a}=r,n=this.workerPools.get(t);return n||(n=new zc({name:t,source:i,url:a}),n.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,n)),n}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};async function es(){return Vg}var Yg=new Map,Za=class{static async inWorkerThread(){return typeof self<"u"||Boolean(await es())}static set onmessage(r){async function t(i){let a=await es(),{type:n,payload:o}=a?i:i.data;r(n,o)}es().then(i=>{i?(i.on("message",t),i.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=t})}static async addEventListener(r){let t=Yg.get(r);t||(t=async a=>{if(!DU(a))return;let n=await es(),{type:o,payload:s}=n?a:a.data;r(o,s)}),await es()?console.error("not implemented"):globalThis.addEventListener("message",t)}static async removeEventListener(r){let t=Yg.get(r);Yg.delete(r),await es()?console.error("not implemented"):globalThis.removeEventListener("message",t)}static async postMessage(r,t){let i={source:"loaders.gl",type:r,payload:t},a=Mc(t),n=await es();n?n.postMessage(i,a):globalThis.postMessage(i,a)}};function DU(e){let{type:r,data:t}=e;return r==="message"&&t&&typeof t.source=="string"&&t.source.startsWith("loaders.gl")}function Xg(e,r={}){let t=r[e.id]||{},i=oa?`${e.id}-worker.js`:`${e.id}-worker-node.js`,a=t.workerUrl;if(!a&&e.id==="compression"&&(a=r.workerUrl),r._workerType==="test"&&(oa?a=`modules/${e.module}/dist/${i}`:a=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!a){let n=e.version;n==="latest"&&(n=F5);let o=n?`@${n}`:"";a=`https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${i}`}return ma(a),a}function Qg(e,r=Bc){ma(e,"no worker provided");let t=e.version;return!(!r||!t)}var Jg={};Au(Jg,{readFileAsArrayBuffer:()=>_p,readFileAsText:()=>kp,requireFromFile:()=>Sp,requireFromString:()=>cu});var Zg=Pt(require("module"),1),N5=Pt(require("path"),1),Nc=Pt(require("fs"),1);async function _p(e){return e.startsWith("http")?await(await fetch(e)).arrayBuffer():Nc.readFileSync(e).buffer}async function kp(e){return e.startsWith("http")?await(await fetch(e)).text():Nc.readFileSync(e,"utf8")}async function Sp(e){if(e.startsWith("http")){let i=await(await fetch(e)).text();return cu(i)}e.startsWith("/")||(e=`${process.cwd()}/${e}`);let r=await Nc.promises.readFile(e,"utf8");return cu(r)}function cu(e,r="",t){if(typeof r=="object"&&(t=r,r=""),typeof e!="string")throw new Error(`code must be a string, not ${typeof e}`);let i=Zg.default._nodeModulePaths(N5.dirname(r)),a=typeof module<"u"&&(module==null?void 0:module.parent),n=new Zg.default(r,a);return n.filename=r,n.paths=[].concat((t==null?void 0:t.prependPaths)||[]).concat(i).concat((t==null?void 0:t.appendPaths)||[]),n._compile(e,r),a&&a.children&&a.children.splice(a.children.indexOf(n),1),n.exports}var ev={};async function gn(e,r=null,t={},i=null){return r&&(e=U5(e,r,t,i)),ev[e]=ev[e]||LU(e),await ev[e]}function U5(e,r,t={},i=null){if(!t.useLocalLibraries&&e.startsWith("http"))return e;i=i||e;let a=t.modules||{};return a[i]?a[i]:oa?t.CDN?(ma(t.CDN.startsWith("http")),`${t.CDN}/${r}@${Bc}/dist/libs/${i}`):Fc?`../src/libs/${i}`:`modules/${r}/src/libs/${i}`:`modules/${r}/dist/libs/${i}`}async function LU(e){if(e.endsWith("wasm"))return await MU(e);if(!oa)try{return Jg&&Sp&&await Sp(e)}catch(t){return console.error(t),null}if(Fc)return importScripts(e);let r=await zU(e);return qU(r,e)}function qU(e,r){if(!oa)return cu&&cu(e,r);if(Fc)return eval.call(globalThis,e),null;let t=document.createElement("script");t.id=r;try{t.appendChild(document.createTextNode(e))}catch{t.text=e}return document.body.appendChild(t),null}async function MU(e){return oa||!_p||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await _p(e)}async function zU(e){return oa||!kp||e.startsWith("http")?await(await fetch(e)).text():await kp(e)}var NU=0;async function rv(e){await Za.inWorkerThread()&&(Za.onmessage=async(r,t)=>{switch(r){case"process":try{let{input:i,options:a={},context:n={}}=t,o=await HU({loader:e,arrayBuffer:i,options:a,context:{...n,_parse:UU}});Za.postMessage("done",{result:o})}catch(i){let a=i instanceof Error?i.message:"";Za.postMessage("error",{error:a})}break;default:}})}function UU(e,r,t,i){return new Promise((a,n)=>{let o=NU++,s=(l,f)=>{if(f.id===o)switch(l){case"done":Za.removeEventListener(s),a(f.result);break;case"error":Za.removeEventListener(s),n(f.error);break;default:}};Za.addEventListener(s);let u={id:o,input:e,options:t};Za.postMessage("process",u)})}async function HU({loader:e,arrayBuffer:r,options:t,context:i}){let a,n;if(e.parseSync||e.parse)a=r,n=e.parseSync||e.parse;else if(e.parseTextSync)a=new TextDecoder().decode(r),n=e.parseTextSync;else throw new Error(`Could not load data with ${e.name} loader`);return t={...t,modules:e&&e.options&&e.options.modules||{},worker:!1},await n(a,{...t},i,e)}function tv(e,r){return!Qa.isSupported()||!oa&&!(r!=null&&r._nodeWorkers)?!1:e.worker&&(r==null?void 0:r.worker)}async function av(e,r,t,i,a){let n=e.id,o=Xg(e,t),u=Qa.getWorkerFarm(t).getWorkerPool({name:n,url:o});t=JSON.parse(JSON.stringify(t)),i=JSON.parse(JSON.stringify(i||{}));let l=await u.startJob("process-on-worker",GU.bind(null,a));return l.postMessage("process",{input:r,options:t,context:i}),await(await l.result).result}async function GU(e,r,t,i){switch(t){case"done":r.done(i);break;case"error":r.error(new Error(i.error));break;case"process":let{id:a,input:n,options:o}=i;try{let s=await e(n,o);r.postMessage("done",{id:a,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";r.postMessage("error",{id:a,error:u})}break;default:console.warn(`parse-with-worker unknown message ${t}`)}}function iv(e,r,t){if(t=t||e.byteLength,e.byteLength<t||r.byteLength<t)return!1;let i=new Uint8Array(e),a=new Uint8Array(r);for(let n=0;n<i.length;++n)if(i[n]!==a[n])return!1;return!0}function nv(...e){return H5(e)}function H5(e){let r=e.map(n=>n instanceof ArrayBuffer?new Uint8Array(n):n),t=r.reduce((n,o)=>n+o.byteLength,0),i=new Uint8Array(t),a=0;for(let n of r)i.set(n,a),a+=n.byteLength;return i.buffer}async function Uc(e){let r=[];for await(let t of e)r.push(t);return nv(...r)}function jo(e){return jo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},jo(e)}function ov(e,r){if(jo(e)!=="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var i=t.call(e,r||"default");if(jo(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function sv(e){var r=ov(e,"string");return jo(r)==="symbol"?r:String(r)}function ht(e,r,t){return r=sv(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var WU="",G5={};function rs(e){for(let r in G5)if(e.startsWith(r)){let t=G5[r];e=e.replace(r,t)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${WU}${e}`),e}function W5(e){return Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer:e}function V5(e){return e&&typeof e=="object"&&e.isBuffer}function Ep(e){if(V5(e))return W5(e);if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e=="string"){let r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}var ts={};Au(ts,{dirname:()=>KU,filename:()=>$U,join:()=>YU,resolve:()=>XU});function $5(){var r;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(r=window.location)==null?void 0:r.pathname;return(e==null?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function $U(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(r+1):""}function KU(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(0,r):""}function YU(...e){let r="/";return e=e.map((t,i)=>(i&&(t=t.replace(new RegExp(`^${r}`),"")),i!==e.length-1&&(t=t.replace(new RegExp(`${r}$`),"")),t)),e.join(r)}function XU(...e){let r=[];for(let n=0;n<e.length;n++)r[n]=e[n];let t="",i=!1,a;for(let n=r.length-1;n>=-1&&!i;n--){let o;n>=0?o=r[n]:(a===void 0&&(a=$5()),o=a),o.length!==0&&(t=`${o}/${t}`,i=o.charCodeAt(0)===Hc)}return t=QU(t,!i),i?`/${t}`:t.length>0?t:"."}var Hc=47,uv=46;function QU(e,r){let t="",i=-1,a=0,n,o=!1;for(let s=0;s<=e.length;++s){if(s<e.length)n=e.charCodeAt(s);else{if(n===Hc)break;n=Hc}if(n===Hc){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(t.length<2||!o||t.charCodeAt(t.length-1)!==uv||t.charCodeAt(t.length-2)!==uv){if(t.length>2){let u=t.length-1,l=u;for(;l>=0&&t.charCodeAt(l)!==Hc;--l);if(l!==u){t=l===-1?"":t.slice(0,l),i=s,a=0,o=!1;continue}}else if(t.length===2||t.length===1){t="",i=s,a=0,o=!1;continue}}r&&(t.length>0?t+="/..":t="..",o=!0)}else{let u=e.slice(i+1,s);t.length>0?t+=`/${u}`:t=u,o=!1}i=s,a=0}else n===uv&&a!==-1?++a:a=-1}return t}var Mn=Pt(require("fs"),1),as=class{constructor(r,t,i){r=rs(r),this.handle=Mn.default.openSync(r,t,i);let a=Mn.default.fstatSync(this.handle,{bigint:!0});this.size=Number(a.size),this.bigsize=a.size,this.url=r}async close(){return new Promise((r,t)=>{Mn.default.close(this.handle,i=>i?t(i):r())})}async truncate(r){return new Promise((t,i)=>{Mn.default.ftruncate(this.handle,r,a=>{a?i(a):(this.bigsize=BigInt(r),this.size=Number(this.bigsize),t())})})}async append(r){return new Promise((t,i)=>{Mn.default.appendFile(this.handle,r,a=>{a?i(a):(this.bigsize=this.bigsize+BigInt(r.length),this.size=Number(this.bigsize),t())})})}async stat(){return await new Promise((r,t)=>Mn.default.fstat(this.handle,{bigint:!0},(i,a)=>{let n={size:Number(a.size),bigsize:a.size,isDirectory:a.isDirectory()};i?t(i):r(n)}))}async read(r,t){let i=new ArrayBuffer(t),a=BigInt(r),n=0,o=new Uint8Array(i),s;for(;t>0;){let u=await ZU(this.handle,o,0,t,a);if(u===0)break;n+=u,a+=BigInt(u),t-=u,s!==void 0&&(s+=u)}return n<t?i.slice(0,n):i}async write(r,t=0,i=r.byteLength){return new Promise((a,n)=>{let o=Number(t),s=new Uint8Array(r,Number(t),i);Mn.default.write(this.handle,s,0,i,o,(u,l)=>u?n(u):a(l))})}};async function ZU(e,r,t,i,a){return await new Promise((n,o)=>Mn.default.read(e,r,t,i,a,(s,u)=>s?o(s):n(u)))}var Pp=Pt(require("fs/promises"),1);var lv=Pt(require("fs"),1),cv=require("stream");var jp=Pt(require("zlib"),1),JU=e=>e&&e instanceof ArrayBuffer,eH=e=>e&&e instanceof Buffer;function Ap(e,r){switch(r==null?void 0:r.get("content-encoding")){case"br":return e.pipe(jp.default.createBrotliDecompress());case"gzip":return e.pipe(jp.default.createGunzip());case"deflate":return e.pipe(jp.default.createDeflate());default:return e}}async function K5(e){let r=[];return await new Promise((t,i)=>{e.on("error",a=>i(a)),e.on("readable",()=>e.read()),e.on("data",a=>{typeof a=="string"&&i(new Error("Read stream not binary")),r.push(tH(a))}),e.on("end",()=>{let a=rH(r);t(a)})})}function rH(e){let r=e.map(n=>n instanceof ArrayBuffer?new Uint8Array(n):n),t=r.reduce((n,o)=>n+o.byteLength,0),i=new Uint8Array(t),a=0;for(let n of r)i.set(n,a),a+=n.byteLength;return i.buffer}function tH(e){if(JU(e))return e;if(eH(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;if(typeof e=="string"){let r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}var aH=e=>typeof e=="boolean",Y5=e=>typeof e=="function",iH=e=>e!==null&&typeof e=="object",nH=e=>iH(e)&&Y5(e.read)&&Y5(e.pipe)&&aH(e.readable);async function Tp(e,r){let t=/^file:\/\//;e.replace(t,"/");let i=e.split("?")[0];i=rs(i);let a=new Headers;e.endsWith(".gz")&&(a["content-encoding"]="gzip"),e.endsWith(".br")&&(a["content-encoding"]="br");try{let n=await new Promise((h,d)=>{let m=lv.default.createReadStream(i,{encoding:null});m.once("readable",()=>h(m)),m.on("error",y=>d(y))}),o=n;nH(n)?o=Ap(n,a):typeof n=="string"?o=cv.Readable.from([new TextEncoder().encode(n)]):o=cv.Readable.from([n||new ArrayBuffer(0)]);let s=200,u="OK",l=oH(i),f=new Response(o,{headers:l,status:s,statusText:u});return Object.defineProperty(f,"url",{value:e}),f}catch(n){let o=n.message,s=400,u=o,l={},f=new Response(o,{headers:l,status:s,statusText:u});return Object.defineProperty(f,"url",{value:e}),f}}function oH(e){let r={};if(!r["content-length"]){let t=lv.default.statSync(e);r["content-length"]=t.size}return e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip"),new Headers(r)}var Rp=class{constructor(){this.readable=!0;this.writable=!0}async readdir(r=".",t){return await Pp.default.readdir(r,t)}async stat(r){let t=await Pp.default.stat(r,{bigint:!0});return{size:Number(t.size),bigsize:t.size,isDirectory:t.isDirectory()}}async unlink(r){return await Pp.default.unlink(r)}async fetch(r,t){return await Tp(r,t)}async openReadableFile(r,t="r"){return new as(r,t)}async openWritableFile(r,t="w",i){return new as(r,t,i)}};var Gc=class{constructor(r={}){this.hashBatches=this.hashBatches.bind(this)}async preload(){}async*hashBatches(r,t="base64"){var o,s;let i=[];for await(let u of r)i.push(u),yield u;let a=await this.concatenate(i),n=await this.hash(a,t);(s=(o=this.options.crypto)==null?void 0:o.onEnd)==null||s.call(o,{hash:n})}async concatenate(r){return await Uc(r)}};var Wc=Pt(require("crypto"),1),Cp=class extends Gc{constructor(t){var i,a;super();this.name="crypto-node";if(this.options=t,!((a=(i=this.options)==null?void 0:i.crypto)!=null&&a.algorithm))throw new Error(this.name)}async hash(t,i){var n,o,s,u;let a=(s=(o=(n=this.options)==null?void 0:n.crypto)==null?void 0:o.algorithm)==null?void 0:s.toLowerCase();try{if(!Wc.createHash)throw new Error("crypto.createHash not available");let l=(u=Wc.createHash)==null?void 0:u(a),f=new Uint8Array(t);return l.update(f).digest("base64")}catch(l){throw Error(`${a} hash not available. ${l}`)}}async*hashBatches(t,i="base64"){var o,s,u,l,f,h,d;if(!Wc.createHash)throw new Error("crypto.createHash not available");let a=(l=Wc.createHash)==null?void 0:l((u=(s=(o=this.options)==null?void 0:o.crypto)==null?void 0:s.algorithm)==null?void 0:u.toLowerCase());for await(let m of t){let y=new Uint8Array(m);a.update(y),yield m}let n=a.digest(i);(d=(h=(f=this.options)==null?void 0:f.crypto)==null?void 0:h.onEnd)==null||d.call(h,{hash:n})}};var l4=require("node:process");var X5=Pt(require("stream"),1),fv=class{},sH=X5.Readable||fv;function dv(e,r){let t=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]();return new pv(t,r)}var pv=class extends sH{constructor(t,i){super(i);this._iterator=t,this._pulling=!1,this._bytesMode=!i||!i.objectMode}async _read(t){this._pulling||(this._pulling=!0,this._pulling=await this._pull(t,this._iterator))}async _destroy(t,i){var a,n,o,s;this._iterator&&(t?await((n=(a=this._iterator)==null?void 0:a.throw)==null?void 0:n.call(a,t)):await((s=(o=this._iterator)==null?void 0:o.return)==null?void 0:s.call(o,t)),i==null||i(null))}async _pull(t,i){var o;let a=this._bytesMode,n=null;for(;this.readable&&!(n=await i.next()).done&&(t!==null&&(t-=a&&ArrayBuffer.isView(n.value)?n.value.byteLength:1),!(!this.push(new Uint8Array(n.value))||t<=0)););return(n!=null&&n.done||!this.readable)&&(this.push(null)||!0)&&((o=i==null?void 0:i.return)==null||o.call(i)),!this.readable}};var J5=Pt(Z5(),1);delete globalThis.ReadableStream;var Ip=class extends J5.ReadableStream{};var Bp=class{constructor(r){this.isWorking=!1;this.isCancelled=!1;this.chunks=r}start(r){this.work(r)}async work(r){let{chunks:t}=this;for(this.isWorking=!0;!this.isCancelled&&(r.desiredSize||0)>0;){let i;try{i=t.next()}catch(a){r.error(a);break}i&&(!i.done&&!this.isCancelled?r.enqueue(i.value):r.close())}this.isWorking=!1}pull(r){this.isWorking||this.work(r)}cancel(){this.isCancelled=!0}};var Fp=class extends Ip{constructor(t){super(new Bp(t.values()),{type:"bytes"});this._chunks=t}async*[Symbol.asyncIterator](t){let i=this.getReader();yield*this._chunks,i.releaseLock()}};var is=class{constructor(r=[],t={}){this.parts=[],this.size=0;for(let i of r)if(typeof i=="string"){let a=new TextEncoder().encode(i);this.parts.push(a),this.size+=a.byteLength}else if(i instanceof is)this.size+=i.size,this.parts.push(...i.parts);else if(i instanceof ArrayBuffer)this.parts.push(new Uint8Array(i)),this.size+=i.byteLength;else if(i instanceof Uint8Array)this.parts.push(i),this.size+=i.byteLength;else if(ArrayBuffer.isView(i)){let{buffer:a,byteOffset:n,byteLength:o}=i;this.parts.push(new Uint8Array(a,n,o)),this.size+=o}else{let a=new TextEncoder().encode(String(i));this.parts.push(a),this.size+=a.byteLength}this.type=uH(t.type)}slice(r=0,t=this.size,i=""){let{size:a,parts:n}=this,o=r<0?Math.max(a+r,0):Math.min(r,a),s=t<0?Math.max(a+t,0):Math.min(t,a),u=Math.max(s-o,0),l=new is([],{type:i});if(u===0)return l;let f=0,h=[];for(let d of n){let{byteLength:m}=d;if(o>0&&m<=o)o-=m,s-=m;else{let y=d.subarray(o,Math.min(m,s));if(h.push(y),f+=y.byteLength,o=0,f>=u)break}}return l.parts=h,l.size=f,l}async arrayBuffer(){return this._toArrayBuffer()}async text(){let r=new TextDecoder,t="";for(let i of this.parts)t+=r.decode(i);return t}stream(){return new Fp(this.parts)}toString(){return"[object Blob]"}get[Symbol.toStringTag](){return"Blob"}_toArrayBuffer(){let r=new ArrayBuffer(this.size),t=new Uint8Array(r),i=0;for(let a of this.parts)t.set(a,i),i+=a.byteLength;return r}};function uH(e=""){let r=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(r)?"":r}function cH(){return typeof Blob>"u"&&!globalThis.Blob&&(globalThis.Blob=is),globalThis.Blob}var lH=cH();var Dp=class{constructor(){this.onload=null}abort(){}async readAsArrayBuffer(r){let t=await r.arrayBuffer();this.onload&&this.onload({target:{result:t}})}async readAsBinaryString(r){throw Error("Not implemented")}async readAsDataURL(r){let t=await r.text(),i=`data://;base64,${Ru(t)}`;this.onload&&this.onload({target:{result:i}})}async readAsText(r){let t=await r.text();this.onload&&this.onload({target:{result:t}})}};var Lp=class extends globalThis.Blob{constructor(t,i,a={}){super(t,a);this.name="";this.webkitRelativePath="";this.name=String(i).replace(/\//g,":"),this.lastModified=(a==null?void 0:a.lastModified)||Date.now()}get[Symbol.toStringTag](){return"File"}};function e4(){return typeof FileReader>"u"&&!globalThis.FileReader&&(globalThis.FileReader=Dp),typeof File>"u"&&!globalThis.File&&(globalThis.File=Lp),global}var fH=e4();var hv=Pt(require("module"),1),r4=Pt(require("path"),1),Mp=Pt(require("fs"),1);async function t4(e){return e.startsWith("http")?await(await fetch(e)).arrayBuffer():Mp.default.readFileSync(e).buffer}async function a4(e){return e.startsWith("http")?await(await fetch(e)).text():Mp.default.readFileSync(e,"utf8")}async function i4(e){if(e.startsWith("http")){let i=await(await fetch(e)).text();return qp(i)}e.startsWith("/")||(e=`${process.cwd()}/${e}`);let r=await Mp.default.readFileSync(e,"utf8");return qp(r)}function qp(e,r="",t){if(typeof r=="object"&&(t=r,r=""),r=r.replace("file://",""),typeof e!="string")throw new Error(`code must be a string, not ${typeof e}`);let i=hv.default._nodeModulePaths(r4.default.dirname(r)),a=typeof module<"u"&&(module==null?void 0:module.parent),n=new hv.default(r,a);return n.filename=r,n.paths=[].concat((t==null?void 0:t.prependPaths)||[]).concat(i).concat((t==null?void 0:t.appendPaths)||[]),n._compile(e,r),a&&a.children&&a.children.splice(a.children.indexOf(n),1),n.exports}var Ni=class{constructor(r){this.map={},r instanceof Ni?r.forEach((t,i)=>this.append(i,t)):Array.isArray(r)?r.forEach(t=>this.append(t[0],t[1])):r&&Object.getOwnPropertyNames(r).forEach(t=>this.append(t,r[t]))}append(r,t){r=Vc(r),t=n4(t);let i=this.map[r];this.map[r]=i?`${i}, ${t}`:t}delete(r){delete this.map[Vc(r)]}get(r){return r=Vc(r),this.has(r)?this.map[r]:null}has(r){return this.map.hasOwnProperty(Vc(r))}set(r,t){this.map[Vc(r)]=n4(t)}forEach(r,t=null){for(let i in this.map)this.map.hasOwnProperty(i)&&(t?r.call(t,this.map[i],i,this):r(this.map[i],i,this))}keys(){let r=[];return this.forEach(function(t,i){r.push(i)}),mv(r)}values(){let r=[];return this.forEach(function(t){r.push(t)}),mv(r)}entries(){let r=[];return this.forEach(function(t,i){r.push([i,t])}),mv(r)}*[Symbol.iterator](){yield*this.entries()}};function Vc(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e)||e==="")throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function n4(e){return typeof e!="string"&&(e=String(e)),e}function mv(e){let r={next(){let t=e.shift();return{done:t===void 0,value:t}}};return r[Symbol.iterator]=function(){return r},r}function gv(e,r){if(!e)throw new Error(`@loaders.gl/polyfills assertion ${r}`)}var bv=Pt(require("stream"),1),pH=e=>typeof e=="boolean",o4=e=>typeof e=="function",dH=e=>e!==null&&typeof e=="object",vv=e=>dH(e)&&o4(e.read)&&o4(e.pipe)&&pH(e.readable),zn=class{constructor(r,t){this.bodyUsed=!1;let{headers:i,status:a=200,statusText:n="OK",url:o}=t||{};this.url=o,this.ok=a===200,this.status=a,this.statusText=n,this.headers=new Ni((t==null?void 0:t.headers)||{}),vv(r)?this._body=Ap(r,i):typeof r=="string"?this._body=bv.Readable.from([new TextEncoder().encode(r)]):this._body=bv.Readable.from([r||new ArrayBuffer(0)])}get body(){return gv(!this.bodyUsed),gv(vv(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){return vv(this._body)?await K5(this._body):this._body||new ArrayBuffer(0)}async text(){let r=await this.arrayBuffer();return new TextDecoder().decode(r)}async json(){let r=await this.text();return JSON.parse(r)}async blob(){if(typeof Blob>"u")throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}};var u4=Pt(require("http"),1),c4=Pt(require("https"),1);var hH=e=>e&&e instanceof ArrayBuffer,mH=e=>e&&e instanceof Buffer;function s4(e){let r=e.indexOf(","),t,i;return e.slice(r-7,r)===";base64"?(t=Buffer.from(e.slice(r+1),"base64"),i=e.slice(5,r-7).trim()):(t=Buffer.from(decodeURIComponent(e.slice(r+1))),i=e.slice(5,r).trim()),i?i.startsWith(";")&&(i=`text/plain${i}`):i="text/plain;charset=US-ASCII",{arrayBuffer:gH(t),mimeType:i}}function gH(e){if(hH(e))return e;if(mH(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;if(typeof e=="string"){let r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}var yv=e=>e.startsWith("data:"),vH=e=>e.startsWith("http:")||e.startsWith("https:");async function $c(e,r){try{if(globalThis.fetch!==$c&&(vH(e)||yv(e)))return await fetch(e,r);if(yv(e)){let{arrayBuffer:l,mimeType:f}=s4(e);return new zn(l,{headers:{"content-type":f},url:e})}let t={},i=e;e.endsWith(".gz")&&(e=e.slice(0,-3),t["content-encoding"]="gzip");let a=await bH(i,r),n=_H(e,a,t),{status:o,statusText:s}=wH(a),u=!r||r.followRedirect||r.followRedirect===void 0;if(o>=300&&o<400&&n.has("location")&&u){let l=yH(e,n.get("location"));return await $c(l,r)}return new zn(a,{headers:n,status:o,statusText:s,url:e})}catch(t){return new zn(null,{status:400,statusText:String(t),url:e})}}async function bH(e,r){return await new Promise((t,i)=>{let a=xH(e,r),n=e.startsWith("https:")?c4.default.request(a,o=>t(o)):u4.default.request(a,o=>t(o));n.on("error",o=>i(o)),n.end()})}function yH(e,r){if(r.startsWith("http"))return r;let t=new URL(e);return t.pathname=r,t.href}function xH(e,r){let t=(r==null?void 0:r.headers)||{},i={};for(let n of Object.keys(t))i[n.toLowerCase()]=t[n];i["accept-encoding"]=i["accept-encoding"]||"gzip,br,deflate";let a=new URL(e);return{hostname:a.hostname,path:a.pathname,method:"GET",...r,...r==null?void 0:r.fetch,headers:i,port:a.port}}function wH(e){return e.statusCode?{status:e.statusCode,statusText:e.statusMessage||"NA"}:{status:200,statusText:"OK"}}function _H(e,r,t={}){let i={};if(r&&r.headers){let a=r.headers;for(let n in a){let o=a[n];i[n.toLowerCase()]=String(o)}}if(!i["content-length"]){let a=kH(e);Number.isFinite(a)&&(i["content-length"]=a)}return Object.assign(i,t),new Ni(i)}function kH(e){return yv(e)?e.length-5:null}var SH=parseInt(l4.versions.node.split(".")[0]);K1&&console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");globalThis.loaders=globalThis.loaders||{};globalThis.loaders.makeNodeStream=dv;globalThis.loaders.NodeFile=as;globalThis.loaders.NodeFileSystem=Rp;globalThis.loaders.fetchNode=Tp;globalThis.loaders.NodeHash=Cp;globalThis.TextEncoder||(globalThis.TextEncoder=Pu);globalThis.TextDecoder||(globalThis.TextDecoder=Bo);!("atob"in globalThis)&&Ru&&(globalThis.atob=Ru);!("btoa"in globalThis)&&Nd&&(globalThis.btoa=Nd);globalThis.loaders.encodeImageNode=Jx;globalThis.loaders.parseImageNode=Hg;globalThis.loaders.imageFormatsNode=Ug;globalThis._parseImageNode=Hg;globalThis._imageFormatsNode=Ug;globalThis.loaders.readFileAsArrayBuffer=t4;globalThis.loaders.readFileAsText=a4;globalThis.loaders.requireFromFile=i4;globalThis.loaders.requireFromString=qp;SH<18&&(!("Headers"in globalThis)&&Ni&&(globalThis.Headers=Ni),!("Response"in globalThis)&&zn&&(globalThis.Response=zn),!("fetch"in globalThis)&&$c&&(globalThis.fetch=$c));var EH=e=>typeof e=="boolean",Kc=e=>typeof e=="function",ns=e=>e!==null&&typeof e=="object",xv=e=>ns(e)&&e.constructor==={}.constructor;var f4=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",p4=e=>e&&typeof e[Symbol.asyncIterator]=="function";var di=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var hi=e=>typeof Blob<"u"&&e instanceof Blob,d4=e=>e&&typeof e=="object"&&e.isBuffer;var jH=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||ns(e)&&Kc(e.tee)&&Kc(e.cancel)&&Kc(e.getReader);var AH=e=>ns(e)&&Kc(e.read)&&Kc(e.pipe)&&EH(e.readable),zp=e=>jH(e)||AH(e);var TH=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,PH=/^([-\w.]+\/[-\w.+]+)/;function h4(e){let r=PH.exec(e);return r?r[1]:e}function wv(e){let r=TH.exec(e);return r?r[1]:""}var m4=/\?.*/;function g4(e){let r=e.match(m4);return r&&r[0]}function lu(e){return e.replace(m4,"")}function os(e){return di(e)?e.url:hi(e)?e.name||"":typeof e=="string"?e:""}function Yc(e){if(di(e)){let r=e,t=r.headers.get("content-type")||"",i=lu(r.url);return h4(t)||wv(i)}return hi(e)?e.type||"":typeof e=="string"?wv(e):""}function v4(e){return di(e)?e.headers["content-length"]||-1:hi(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function Np(e){if(di(e))return e;let r={},t=v4(e);t>=0&&(r["content-length"]=String(t));let i=os(e),a=Yc(e);a&&(r["content-type"]=a);let n=await CH(e);n&&(r["x-first-bytes"]=n),typeof e=="string"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:r});return Object.defineProperty(o,"url",{value:i}),o}async function b4(e){if(!e.ok){let r=await RH(e);throw new Error(r)}}async function RH(e){let r=`Failed to fetch resource ${e.url} (${e.status}): `;try{let t=e.headers.get("Content-Type"),i=e.statusText;t!=null&&t.includes("application/json")&&(i+=` ${await e.text()}`),r+=i,r=r.length>60?`${r.slice(0,60)}...`:r}catch{}return r}async function CH(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let t=e.slice(0,5);return await new Promise(i=>{let a=new FileReader;a.onload=n=>{var o;return i((o=n==null?void 0:n.target)==null?void 0:o.result)},a.readAsDataURL(t)})}if(e instanceof ArrayBuffer){let t=e.slice(0,5);return`data:base64,${OH(t)}`}return null}function OH(e){let r="",t=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)r+=String.fromCharCode(t[i]);return btoa(r)}function IH(e){return!BH(e)&&!FH(e)}function BH(e){return e.startsWith("http:")||e.startsWith("https:")}function FH(e){return e.startsWith("data:")}async function _v(e,r){var t,i;if(typeof e=="string"){let a=rs(e);return IH(a)&&(t=globalThis.loaders)!=null&&t.fetchNode?(i=globalThis.loaders)==null?void 0:i.fetchNode(a,r):await fetch(a,r)}return await Np(e)}function kv(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let r=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,t=e||r;return!!(t&&t.indexOf("Electron")>=0)}function Ui(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||kv()}var DH=globalThis.self||globalThis.window||globalThis.global,fu=globalThis.window||globalThis.self||globalThis.global,LH=globalThis.document||{},ss=globalThis.process||{},qH=globalThis.console,Ote=globalThis.navigator||{};var Up="4.2.0-alpha.4",Fte=Ui();function MH(e){try{let r=window[e],t="__storage_test__";return r.setItem(t,t),r.removeItem(t),r}catch{return null}}var Hp=class{constructor(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";ht(this,"storage",void 0),ht(this,"id",void 0),ht(this,"config",void 0),this.storage=MH(i),this.id=r,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(r){if(Object.assign(this.config,r),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let r={};if(this.storage){let t=this.storage.getItem(this.id);r=t?JSON.parse(t):{}}return Object.assign(this.config,r),this}};function y4(e){let r;return e<10?r="".concat(e.toFixed(2),"ms"):e<100?r="".concat(e.toFixed(1),"ms"):e<1e3?r="".concat(e.toFixed(0),"ms"):r="".concat((e/1e3).toFixed(2),"s"),r}function x4(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,t=Math.max(r-e.length,0);return"".concat(" ".repeat(t)).concat(e)}function Gp(e,r,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,a=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(t=Math.min(t,i/e.width));let n=e.width*t,o=e.height*t,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(n/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(a,");"),"background-size:".concat(n,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(r," %c+"),s]}var Wp;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Wp||(Wp={}));var zH=10;function w4(e){return typeof e!="string"?e:(e=e.toUpperCase(),Wp[e]||Wp.WHITE)}function _4(e,r,t){if(!Ui&&typeof e=="string"){if(r){let i=w4(r);e="\x1B[".concat(i,"m").concat(e,"\x1B[39m")}if(t){let i=w4(t);e="\x1B[".concat(i+zH,"m").concat(e,"\x1B[49m")}}return e}function k4(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],t=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(t),a=e;for(let n of i){let o=a[n];typeof o=="function"&&(r.find(s=>n===s)||(a[n]=o.bind(e)))}}function pu(e,r){if(!e)throw new Error(r||"Assertion failed")}function us(){let e;if(Ui()&&fu.performance){var r,t;e=fu===null||fu===void 0||(r=fu.performance)===null||r===void 0||(t=r.now)===null||t===void 0?void 0:t.call(r)}else if("hrtime"in ss){var i;let a=ss===null||ss===void 0||(i=ss.hrtime)===null||i===void 0?void 0:i.call(ss);e=a[0]*1e3+a[1]/1e6}else e=Date.now();return e}var du={debug:Ui()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},NH={enabled:!0,level:0};function mi(){}var S4={},E4={once:!0},vn=class{constructor(){let{id:r}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};ht(this,"id",void 0),ht(this,"VERSION",Up),ht(this,"_startTs",us()),ht(this,"_deltaTs",us()),ht(this,"_storage",void 0),ht(this,"userData",{}),ht(this,"LOG_THROTTLE_TIMEOUT",0),this.id=r,this.userData={},this._storage=new Hp("__probe-".concat(this.id,"__"),NH),this.timeStamp("".concat(this.id," started")),k4(this),Object.seal(this)}set level(r){this.setLevel(r)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((us()-this._startTs).toPrecision(10))}getDelta(){return Number((us()-this._deltaTs).toPrecision(10))}set priority(r){this.level=r}get priority(){return this.level}getPriority(){return this.level}enable(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:r}),this}setLevel(r){return this._storage.setConfiguration({level:r}),this}get(r){return this._storage.config[r]}set(r,t){this._storage.setConfiguration({[r]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(r,t){pu(r,t)}warn(r){return this._getLogFunction(0,r,du.warn,arguments,E4)}error(r){return this._getLogFunction(0,r,du.error,arguments)}deprecated(r,t){return this.warn("`".concat(r,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(r,t){return this.error("`".concat(r,"` has been removed. Use `").concat(t,"` instead"))}probe(r,t){return this._getLogFunction(r,t,du.log,arguments,{time:!0,once:!0})}log(r,t){return this._getLogFunction(r,t,du.debug,arguments)}info(r,t){return this._getLogFunction(r,t,console.info,arguments)}once(r,t){return this._getLogFunction(r,t,du.debug||du.info,arguments,E4)}table(r,t,i){return t?this._getLogFunction(r,t,console.table||mi,i&&[i],{tag:WH(t)}):mi}image(r){let{logLevel:t,priority:i,image:a,message:n="",scale:o=1}=r;return this._shouldLog(t||i)?Ui()?GH({image:a,message:n,scale:o}):HH({image:a,message:n,scale:o}):mi}time(r,t){return this._getLogFunction(r,t,console.time?console.time:console.info)}timeEnd(r,t){return this._getLogFunction(r,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(r,t){return this._getLogFunction(r,t,console.timeStamp||mi)}group(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},a=j4({logLevel:r,message:t,opts:i}),{collapsed:n}=i;return a.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(a)}groupCollapsed(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(r,t,Object.assign({},i,{collapsed:!0}))}groupEnd(r){return this._getLogFunction(r,"",console.groupEnd||mi)}withGroup(r,t,i){this.group(r,t)();try{i()}finally{this.groupEnd(r)()}}trace(){console.trace&&console.trace()}_shouldLog(r){return this.isEnabled()&&this.getLevel()>=A4(r)}_getLogFunction(r,t,i,a,n){if(this._shouldLog(r)){n=j4({logLevel:r,message:t,args:a,opts:n}),i=i||n.method,pu(i),n.total=this.getTotal(),n.delta=this.getDelta(),this._deltaTs=us();let o=n.tag||n.message;if(n.once&&o)if(!S4[o])S4[o]=us();else return mi;return t=UH(this.id,n.message,n),i.bind(console,t,...n.args)}return mi}};ht(vn,"VERSION",Up);function A4(e){if(!e)return 0;let r;switch(typeof e){case"number":r=e;break;case"object":r=e.logLevel||e.priority||0;break;default:return 0}return pu(Number.isFinite(r)&&r>=0),r}function j4(e){let{logLevel:r,message:t}=e;e.logLevel=A4(r);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==t;);switch(typeof r){case"string":case"function":t!==void 0&&i.unshift(t),e.message=r;break;case"object":Object.assign(e,r);break;default:}typeof e.message=="function"&&(e.message=e.message());let a=typeof e.message;return pu(a==="string"||a==="object"),Object.assign(e,{args:i},e.opts)}function UH(e,r,t){if(typeof r=="string"){let i=t.time?x4(y4(t.total)):"";r=t.time?"".concat(e,": ").concat(i," ").concat(r):"".concat(e,": ").concat(r),r=_4(r,t.color,t.background)}return r}function HH(e){let{image:r,message:t="",scale:i=1}=e;return console.warn("removed"),mi}function GH(e){let{image:r,message:t="",scale:i=1}=e;if(typeof r=="string"){let n=new Image;return n.onload=()=>{let o=Gp(n,t,i);console.log(...o)},n.src=r,mi}let a=r.nodeName||"";if(a.toLowerCase()==="img")return console.log(...Gp(r,t,i)),mi;if(a.toLowerCase()==="canvas"){let n=new Image;return n.onload=()=>console.log(...Gp(n,t,i)),n.src=r.toDataURL(),mi}return mi}function WH(e){for(let r in e)for(let t in e[r])return t||"untitled";return"empty"}var uae=new vn({id:"@probe.gl/log"});var Sv=new vn({id:"loaders.gl"}),Vp=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},$p=class{constructor(){this.console=console}log(...r){return this.console.log.bind(this.console,...r)}info(...r){return this.console.info.bind(this.console,...r)}warn(...r){return this.console.warn.bind(this.console,...r)}error(...r){return this.console.error.bind(this.console,...r)}};var Ev={fetch:null,mimeType:void 0,nothrow:!1,log:new $p,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Jo,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},T4={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 jv(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state=e._state||{},e._state}function Av(){let e=jv();return e.globalOptions=e.globalOptions||{...Ev},e.globalOptions}function C4(e,r,t,i){return t=t||[],t=Array.isArray(t)?t:[t],VH(e,t),KH(r,e,i)}function VH(e,r){P4(e,null,Ev,T4,r);for(let t of r){let i=e&&e[t.id]||{},a=t.options&&t.options[t.id]||{},n=t.deprecatedOptions&&t.deprecatedOptions[t.id]||{};P4(i,t.id,a,n,r)}}function P4(e,r,t,i,a){let n=r||"Top level",o=r?`${r}.`:"";for(let s in e){let u=!r&&ns(e[s]),l=s==="baseUri"&&!r,f=s==="workerUrl"&&r;if(!(s in t)&&!l&&!f){if(s in i)Sv.warn(`${n} loader option '${o}${s}' no longer supported, use '${i[s]}'`)();else if(!u){let h=$H(s,a);Sv.warn(`${n} loader option '${o}${s}' not recognized. ${h}`)()}}}}function $H(e,r){let t=e.toLowerCase(),i="";for(let a of r)for(let n in a.options){if(e===n)return`Did you mean '${a.id}.${n}'?`;let o=n.toLowerCase();(t.startsWith(o)||o.startsWith(t))&&(i=i||`Did you mean '${a.id}.${n}'?`)}return i}function KH(e,r,t){let a={...e.options||{}};return YH(a,t),a.log===null&&(a.log=new Vp),R4(a,Av()),R4(a,r),a}function R4(e,r){for(let t in r)if(t in r){let i=r[t];xv(i)&&xv(e[t])?e[t]={...e[t],...r[t]}:e[t]=r[t]}}function YH(e,r){r&&!("baseUri"in e)&&(e.baseUri=r)}function Xc(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e==null?void 0:e.extensions)):!1}function Tv(e){zi(e,"null loader"),zi(Xc(e),"invalid loader");let r;return Array.isArray(e)&&(r=e[1],e=e[0],e={...e,options:{...e.options,...r}}),(e!=null&&e.parseTextSync||e!=null&&e.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var XH=()=>{let e=jv();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function O4(){return XH()}var I4=new vn({id:"loaders.gl"});var QH=/\.([^.]+)$/;async function D4(e,r=[],t,i){if(!L4(e))return null;let a=B4(e,r,{...t,nothrow:!0},i);if(a)return a;if(hi(e)&&(e=await e.slice(0,10).arrayBuffer(),a=B4(e,r,t,i)),!a&&!(t!=null&&t.nothrow))throw new Error(q4(e));return a}function B4(e,r=[],t,i){if(!L4(e))return null;if(r&&!Array.isArray(r))return Tv(r);let a=[];r&&(a=a.concat(r)),t!=null&&t.ignoreRegisteredLoaders||a.push(...O4()),JH(a);let n=ZH(e,a,t,i);if(!n&&!(t!=null&&t.nothrow))throw new Error(q4(e));return n}function ZH(e,r,t,i){let a=os(e),n=Yc(e),o=lu(a)||(i==null?void 0:i.url),s=null,u="";return t!=null&&t.mimeType&&(s=Pv(r,t==null?void 0:t.mimeType),u=`match forced by supplied MIME type ${t==null?void 0:t.mimeType}`),s=s||eG(r,o),u=u||(s?`matched url ${o}`:""),s=s||Pv(r,n),u=u||(s?`matched MIME type ${n}`:""),s=s||tG(r,e),u=u||(s?`matched initial data ${M4(e)}`:""),t!=null&&t.fallbackMimeType&&(s=s||Pv(r,t==null?void 0:t.fallbackMimeType),u=u||(s?`matched fallback MIME type ${n}`:"")),u&&I4.log(1,`selectLoader selected ${s==null?void 0:s.name}: ${u}.`),s}function L4(e){return!(e instanceof Response&&e.status===204)}function q4(e){let r=os(e),t=Yc(e),i="No valid loader found (";i+=r?`${ts.filename(r)}, `:"no url provided, ",i+=`MIME type: ${t?`"${t}"`:"not provided"}, `;let a=e?M4(e):"";return i+=a?` first bytes: "${a}"`:"first bytes: not available",i+=")",i}function JH(e){for(let r of e)Tv(r)}function eG(e,r){let t=r&&QH.exec(r),i=t&&t[1];return i?rG(e,i):null}function rG(e,r){r=r.toLowerCase();for(let t of e)for(let i of t.extensions)if(i.toLowerCase()===r)return t;return null}function Pv(e,r){for(let t of e)if(t.mimeTypes&&t.mimeTypes.includes(r)||r===`application/x.${t.id}`)return t;return null}function tG(e,r){if(!r)return null;for(let t of e)if(typeof r=="string"){if(aG(r,t))return t}else if(ArrayBuffer.isView(r)){if(F4(r.buffer,r.byteOffset,t))return t}else if(r instanceof ArrayBuffer&&F4(r,0,t))return t;return null}function aG(e,r){return r.testText?r.testText(e):(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>e.startsWith(i))}function F4(e,r,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(a=>iG(e,r,t,a))}function iG(e,r,t,i){if(i instanceof ArrayBuffer)return iv(i,e,i.byteLength);switch(typeof i){case"function":return i(e);case"string":let a=Rv(e,r,i.length);return i===a;default:return!1}}function M4(e,r=5){return typeof e=="string"?e.slice(0,r):ArrayBuffer.isView(e)?Rv(e.buffer,e.byteOffset,r):e instanceof ArrayBuffer?Rv(e,0,r):""}function Rv(e,r,t){if(e.byteLength<r+t)return"";let i=new DataView(e),a="";for(let n=0;n<t;n++)a+=String.fromCharCode(i.getUint8(r+n));return a}function*z4(e,r){let t=(r==null?void 0:r.chunkSize)||262144,i=0,a=new TextEncoder;for(;i<e.length;){let n=Math.min(e.length-i,t),o=e.slice(i,i+n);i+=n,yield a.encode(o)}}function*N4(e,r={}){let{chunkSize:t=262144}=r,i=0;for(;i<e.byteLength;){let a=Math.min(e.byteLength-i,t),n=new ArrayBuffer(a),o=new Uint8Array(e,i,a);new Uint8Array(n).set(o),i+=a,yield n}}async function*U4(e,r){let t=(r==null?void 0:r.chunkSize)||1048576,i=0;for(;i<e.size;){let a=i+t,n=await e.slice(i,a).arrayBuffer();i=a,yield n}}function Cv(e,r){return Jo?nG(e,r):oG(e,r)}async function*nG(e,r){let t=e.getReader(),i;try{for(;;){let a=i||t.read();r!=null&&r._streamReadAhead&&(i=t.read());let{done:n,value:o}=await a;if(n)return;yield Ep(o)}}catch{t.releaseLock()}}async function*oG(e,r){for await(let t of e)yield Ep(t)}function H4(e,r){if(typeof e=="string")return z4(e,r);if(e instanceof ArrayBuffer)return N4(e,r);if(hi(e))return U4(e,r);if(zp(e))return Cv(e,r);if(di(e))return Cv(e.body,r);throw new Error("makeIterator")}var G4="Cannot convert supplied data type";function sG(e,r,t){if(r.text&&typeof e=="string")return e;if(d4(e)&&(e=e.buffer),e instanceof ArrayBuffer){let i=e;return r.text&&!r.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(e)){if(r.text&&!r.binary)return new TextDecoder("utf8").decode(e);let i=e.buffer,a=e.byteLength||e.length;return(e.byteOffset!==0||a!==i.byteLength)&&(i=i.slice(e.byteOffset,e.byteOffset+a)),i}throw new Error(G4)}async function W4(e,r,t){let i=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||i)return sG(e,r,t);if(hi(e)&&(e=await Np(e)),di(e)){let a=e;return await b4(a),r.binary?await a.arrayBuffer():await a.text()}if(zp(e)&&(e=H4(e,t)),f4(e)||p4(e))return Uc(e);throw new Error(G4)}function Kp(e,r){let t=Av(),i=e||t;return typeof i.fetch=="function"?i.fetch:ns(i.fetch)?a=>_v(a,i.fetch):r!=null&&r.fetch?r==null?void 0:r.fetch:_v}function V4(e,r,t){if(t)return t;let i={fetch:Kp(r,e),...e};if(i.url){let a=lu(i.url);i.baseUrl=a,i.queryString=g4(i.url),i.filename=ts.filename(a),i.baseUrl=ts.dirname(a)}return Array.isArray(i.loaders)||(i.loaders=null),i}function $4(e,r){if(e&&!Array.isArray(e))return e;let t;if(e&&(t=Array.isArray(e)?e:[e]),r&&r.loaders){let i=Array.isArray(r.loaders)?r.loaders:[r.loaders];t=t?[...t,...i]:i}return t&&t.length?t:void 0}async function Nn(e,r,t,i){r&&!Array.isArray(r)&&!Xc(r)&&(i=void 0,t=r,r=void 0),e=await e,t=t||{};let a=os(e),o=$4(r,i),s=await D4(e,o,t);return s?(t=C4(t,s,o,a),i=V4({url:a,_parse:Nn,loaders:o},t,i||null),await uG(s,e,t,i)):null}async function uG(e,r,t,i){if(Qg(e),t=Wg(e.options,t),di(r)){let n=r,{ok:o,redirected:s,status:u,statusText:l,type:f,url:h}=n,d=Object.fromEntries(n.headers.entries());i.response={headers:d,ok:o,redirected:s,status:u,statusText:l,type:f,url:h}}r=await W4(r,e,t);let a=e;if(a.parseTextSync&&typeof r=="string")return a.parseTextSync(r,t,i);if(tv(e,t))return await av(e,r,t,i,Nn);if(a.parseText&&typeof r=="string")return await a.parseText(r,t,i);if(a.parse)return await a.parse(r,t,i);throw ma(!a.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}function K4(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function Ov(e){let r=1/0,t=1/0,i=1/0,a=-1/0,n=-1/0,o=-1/0,s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let l=0;l<u;l+=3){let f=s[l],h=s[l+1],d=s[l+2];r=f<r?f:r,t=h<t?h:t,i=d<i?d:i,a=f>a?f:a,n=h>n?h:n,o=d>o?d:o}return[[r,t,i],[a,n,o]]}function Iv(e,r,t){let i=K4(r.value),a=t||Y4(r);return{name:e,type:{type:"fixed-size-list",listSize:r.size,children:[{name:"value",type:i}]},nullable:!1,metadata:a}}function Y4(e){let r={};return"byteOffset"in e&&(r.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(r.byteStride=e.byteStride.toString(10)),"normalized"in e&&(r.normalized=e.normalized.toString()),r}async function Bv(e,r,t,i){let a,n;!Array.isArray(r)&&!Xc(r)?(a=[],n=r,i=void 0):(a=r,n=t);let o=Kp(n),s=e;return typeof e=="string"&&(s=await o(e)),hi(e)&&(s=await o(e)),Array.isArray(a)?await Nn(s,a,n):await Nn(s,a,n)}var cG=1/Math.PI*180,lG=1/180*Math.PI,fG={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...fG}};var Bt=globalThis.mathgl.config;function Fv(e,{precision:r=Bt.precision}={}){return e=pG(e),"".concat(parseFloat(e.toPrecision(r)))}function Ao(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Dv(e){return X4(e)}function Lv(e){return Q4(e)}function X4(e,r){return Z4(e,t=>t*lG,r)}function Q4(e,r){return Z4(e,t=>t*cG,r)}function Un(e,r,t){let i=Bt.EPSILON;t&&(Bt.EPSILON=t);try{if(e===r)return!0;if(Ao(e)&&Ao(r)){if(e.length!==r.length)return!1;for(let a=0;a<e.length;++a)if(!Un(e[a],r[a]))return!1;return!0}return e&&e.equals?e.equals(r):r&&r.equals?r.equals(e):typeof e=="number"&&typeof r=="number"?Math.abs(e-r)<=Bt.EPSILON*Math.max(1,Math.abs(e),Math.abs(r)):!1}finally{Bt.EPSILON=i}}function pG(e){return Math.round(e/Bt.EPSILON)*Bt.EPSILON}function dG(e){return e.clone?e.clone():new Array(e.length)}function Z4(e,r,t){if(Ao(e)){let i=e;t=t||dG(i);for(let a=0;a<t.length&&a<i.length;++a){let n=typeof e=="number"?e:e[a];t[a]=r(n,a,t)}return t}return r(e)}function hG(e){function r(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return r.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e,r}var hu=class extends hG(Array){clone(){return new this.constructor().copy(this)}fromArray(r,t=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=r[i+t];return this.check()}toArray(r=[],t=0){for(let i=0;i<this.ELEMENTS;++i)r[t+i]=this[i];return r}toObject(r){return r}from(r){return Array.isArray(r)?this.copy(r):this.fromObject(r)}to(r){return r===this?this:Ao(r)?this.toArray(r):this.toObject(r)}toTarget(r){return r?this.to(r):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Bt)}formatString(r){let t="";for(let i=0;i<this.ELEMENTS;++i)t+=(i>0?", ":"")+Fv(this[i],r);return"".concat(r.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(r){if(!r||this.length!==r.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!Un(this[t],r[t]))return!1;return!0}exactEquals(r){if(!r||this.length!==r.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==r[t])return!1;return!0}negate(){for(let r=0;r<this.ELEMENTS;++r)this[r]=-this[r];return this.check()}lerp(r,t,i){if(i===void 0)return this.lerp(this,r,t);for(let a=0;a<this.ELEMENTS;++a){let n=r[a],o=typeof t=="number"?t:t[a];this[a]=n+i*(o-n)}return this.check()}min(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(r[t],this[t]);return this.check()}max(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(r[t],this[t]);return this.check()}clamp(r,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],r[i]),t[i]);return this.check()}add(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]+=t[i];return this.check()}subtract(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]-=t[i];return this.check()}scale(r){if(typeof r=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;else for(let t=0;t<this.ELEMENTS&&t<r.length;++t)this[t]*=r[t];return this.check()}multiplyByScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;return this.check()}check(){if(Bt.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let r=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)r=r&&Number.isFinite(this[t]);return r}sub(r){return this.subtract(r)}setScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=r;return this.check()}addScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]+=r;return this.check()}subScalar(r){return this.addScalar(-r)}multiplyScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;return this.check()}divideScalar(r){return this.multiplyByScalar(1/r)}clampScalar(r,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],r),t);return this.check()}get elements(){return this}};function mG(e,r){if(e.length!==r)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}function Aa(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function Yp(e,r,t=""){if(Bt.debug&&!mG(e,r))throw new Error("math.gl: ".concat(t," some fields set to invalid numbers'"));return e}function gi(e,r){if(!e)throw new Error("math.gl assertion ".concat(r))}var Xp=class extends hu{get x(){return this[0]}set x(r){this[0]=Aa(r)}get y(){return this[1]}set y(r){this[1]=Aa(r)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let r=0;for(let t=0;t<this.ELEMENTS;++t)r+=this[t]*this[t];return r}magnitudeSquared(){return this.lengthSquared()}distance(r){return Math.sqrt(this.distanceSquared(r))}distanceSquared(r){let t=0;for(let i=0;i<this.ELEMENTS;++i){let a=this[i]-r[i];t+=a*a}return Aa(t)}dot(r){let t=0;for(let i=0;i<this.ELEMENTS;++i)t+=this[i]*r[i];return Aa(t)}normalize(){let r=this.magnitude();if(r!==0)for(let t=0;t<this.ELEMENTS;++t)this[t]/=r;return this.check()}multiply(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]*=t[i];return this.check()}divide(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]/=t[i];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(r){return this.distance(r)}distanceToSquared(r){return this.distanceSquared(r)}getComponent(r){return gi(r>=0&&r<this.ELEMENTS,"index is out of range"),Aa(this[r])}setComponent(r,t){return gi(r>=0&&r<this.ELEMENTS,"index is out of range"),this[r]=t,this.check()}addVectors(r,t){return this.copy(r).add(t)}subVectors(r,t){return this.copy(r).subtract(t)}multiplyVectors(r,t){return this.copy(r).multiply(t)}addScaledVector(r,t){return this.add(new this.constructor(r).multiplyScalar(t))}};var Hi=typeof Float32Array<"u"?Float32Array:Array,Qc=Math.random;function mu(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var Hie=Math.PI/180;function gG(){let e=new Hi(2);return Hi!=Float32Array&&(e[0]=0,e[1]=0),e}function J4(e,r,t){let i=r[0],a=r[1];return e[0]=t[0]*i+t[4]*a+t[12],e[1]=t[1]*i+t[5]*a+t[13],e}var Gie=function(){let e=gG();return function(r,t,i,a,n,o){let s,u;for(t||(t=2),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],n(e,e,o),r[s]=e[0],r[s+1]=e[1];return r}}();function ej(e,r,t){let i=r[0],a=r[1],n=t[3]*i+t[7]*a||1;return e[0]=(t[0]*i+t[4]*a)/n,e[1]=(t[1]*i+t[5]*a)/n,e}function Qp(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[3]*i+t[7]*a+t[11]*n||1;return e[0]=(t[0]*i+t[4]*a+t[8]*n)/o,e[1]=(t[1]*i+t[5]*a+t[9]*n)/o,e[2]=(t[2]*i+t[6]*a+t[10]*n)/o,e}function rj(e,r,t){let i=r[0],a=r[1];return e[0]=t[0]*i+t[2]*a,e[1]=t[1]*i+t[3]*a,e[2]=r[2],e}var Jc={};Au(Jc,{add:()=>wG,angle:()=>Vv,bezier:()=>FG,ceil:()=>_G,clone:()=>vG,copy:()=>yG,create:()=>tj,cross:()=>zv,dist:()=>GG,distance:()=>sj,div:()=>HG,divide:()=>oj,dot:()=>Mv,equals:()=>zG,exactEquals:()=>MG,floor:()=>kG,forEach:()=>KG,fromValues:()=>bG,hermite:()=>BG,inverse:()=>RG,len:()=>VG,length:()=>aj,lerp:()=>OG,max:()=>EG,min:()=>SG,mul:()=>UG,multiply:()=>nj,negate:()=>PG,normalize:()=>CG,random:()=>DG,rotateX:()=>Hv,rotateY:()=>Gv,rotateZ:()=>Wv,round:()=>jG,scale:()=>AG,scaleAndAdd:()=>TG,set:()=>xG,slerp:()=>IG,sqrDist:()=>WG,sqrLen:()=>$G,squaredDistance:()=>uj,squaredLength:()=>cj,str:()=>qG,sub:()=>NG,subtract:()=>ij,transformMat3:()=>Nv,transformMat4:()=>Zc,transformQuat:()=>Uv,zero:()=>LG});function tj(){let e=new Hi(3);return Hi!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function vG(e){let r=new Hi(3);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function aj(e){let r=e[0],t=e[1],i=e[2];return Math.sqrt(r*r+t*t+i*i)}function bG(e,r,t){let i=new Hi(3);return i[0]=e,i[1]=r,i[2]=t,i}function yG(e,r){return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function xG(e,r,t,i){return e[0]=r,e[1]=t,e[2]=i,e}function wG(e,r,t){return e[0]=r[0]+t[0],e[1]=r[1]+t[1],e[2]=r[2]+t[2],e}function ij(e,r,t){return e[0]=r[0]-t[0],e[1]=r[1]-t[1],e[2]=r[2]-t[2],e}function nj(e,r,t){return e[0]=r[0]*t[0],e[1]=r[1]*t[1],e[2]=r[2]*t[2],e}function oj(e,r,t){return e[0]=r[0]/t[0],e[1]=r[1]/t[1],e[2]=r[2]/t[2],e}function _G(e,r){return e[0]=Math.ceil(r[0]),e[1]=Math.ceil(r[1]),e[2]=Math.ceil(r[2]),e}function kG(e,r){return e[0]=Math.floor(r[0]),e[1]=Math.floor(r[1]),e[2]=Math.floor(r[2]),e}function SG(e,r,t){return e[0]=Math.min(r[0],t[0]),e[1]=Math.min(r[1],t[1]),e[2]=Math.min(r[2],t[2]),e}function EG(e,r,t){return e[0]=Math.max(r[0],t[0]),e[1]=Math.max(r[1],t[1]),e[2]=Math.max(r[2],t[2]),e}function jG(e,r){return e[0]=mu(r[0]),e[1]=mu(r[1]),e[2]=mu(r[2]),e}function AG(e,r,t){return e[0]=r[0]*t,e[1]=r[1]*t,e[2]=r[2]*t,e}function TG(e,r,t,i){return e[0]=r[0]+t[0]*i,e[1]=r[1]+t[1]*i,e[2]=r[2]+t[2]*i,e}function sj(e,r){let t=r[0]-e[0],i=r[1]-e[1],a=r[2]-e[2];return Math.sqrt(t*t+i*i+a*a)}function uj(e,r){let t=r[0]-e[0],i=r[1]-e[1],a=r[2]-e[2];return t*t+i*i+a*a}function cj(e){let r=e[0],t=e[1],i=e[2];return r*r+t*t+i*i}function PG(e,r){return e[0]=-r[0],e[1]=-r[1],e[2]=-r[2],e}function RG(e,r){return e[0]=1/r[0],e[1]=1/r[1],e[2]=1/r[2],e}function CG(e,r){let t=r[0],i=r[1],a=r[2],n=t*t+i*i+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=r[0]*n,e[1]=r[1]*n,e[2]=r[2]*n,e}function Mv(e,r){return e[0]*r[0]+e[1]*r[1]+e[2]*r[2]}function zv(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[0],s=t[1],u=t[2];return e[0]=a*u-n*s,e[1]=n*o-i*u,e[2]=i*s-a*o,e}function OG(e,r,t,i){let a=r[0],n=r[1],o=r[2];return e[0]=a+i*(t[0]-a),e[1]=n+i*(t[1]-n),e[2]=o+i*(t[2]-o),e}function IG(e,r,t,i){let a=Math.acos(Math.min(Math.max(Mv(r,t),-1),1)),n=Math.sin(a),o=Math.sin((1-i)*a)/n,s=Math.sin(i*a)/n;return e[0]=o*r[0]+s*t[0],e[1]=o*r[1]+s*t[1],e[2]=o*r[2]+s*t[2],e}function BG(e,r,t,i,a,n){let o=n*n,s=o*(2*n-3)+1,u=o*(n-2)+n,l=o*(n-1),f=o*(3-2*n);return e[0]=r[0]*s+t[0]*u+i[0]*l+a[0]*f,e[1]=r[1]*s+t[1]*u+i[1]*l+a[1]*f,e[2]=r[2]*s+t[2]*u+i[2]*l+a[2]*f,e}function FG(e,r,t,i,a,n){let o=1-n,s=o*o,u=n*n,l=s*o,f=3*n*s,h=3*u*o,d=u*n;return e[0]=r[0]*l+t[0]*f+i[0]*h+a[0]*d,e[1]=r[1]*l+t[1]*f+i[1]*h+a[1]*d,e[2]=r[2]*l+t[2]*f+i[2]*h+a[2]*d,e}function DG(e,r){r=r===void 0?1:r;let t=Qc()*2*Math.PI,i=Qc()*2-1,a=Math.sqrt(1-i*i)*r;return e[0]=Math.cos(t)*a,e[1]=Math.sin(t)*a,e[2]=i*r,e}function Zc(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[3]*i+t[7]*a+t[11]*n+t[15];return o=o||1,e[0]=(t[0]*i+t[4]*a+t[8]*n+t[12])/o,e[1]=(t[1]*i+t[5]*a+t[9]*n+t[13])/o,e[2]=(t[2]*i+t[6]*a+t[10]*n+t[14])/o,e}function Nv(e,r,t){let i=r[0],a=r[1],n=r[2];return e[0]=i*t[0]+a*t[3]+n*t[6],e[1]=i*t[1]+a*t[4]+n*t[7],e[2]=i*t[2]+a*t[5]+n*t[8],e}function Uv(e,r,t){let i=t[0],a=t[1],n=t[2],o=t[3],s=r[0],u=r[1],l=r[2],f=a*l-n*u,h=n*s-i*l,d=i*u-a*s,m=a*d-n*h,y=n*f-i*d,k=i*h-a*f,x=o*2;return f*=x,h*=x,d*=x,m*=2,y*=2,k*=2,e[0]=s+f+m,e[1]=u+h+y,e[2]=l+d+k,e}function Hv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[0],n[1]=a[1]*Math.cos(i)-a[2]*Math.sin(i),n[2]=a[1]*Math.sin(i)+a[2]*Math.cos(i),e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Gv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[2]*Math.sin(i)+a[0]*Math.cos(i),n[1]=a[1],n[2]=a[2]*Math.cos(i)-a[0]*Math.sin(i),e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Wv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[0]*Math.cos(i)-a[1]*Math.sin(i),n[1]=a[0]*Math.sin(i)+a[1]*Math.cos(i),n[2]=a[2],e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Vv(e,r){let t=e[0],i=e[1],a=e[2],n=r[0],o=r[1],s=r[2],u=Math.sqrt((t*t+i*i+a*a)*(n*n+o*o+s*s)),l=u&&Mv(e,r)/u;return Math.acos(Math.min(Math.max(l,-1),1))}function LG(e){return e[0]=0,e[1]=0,e[2]=0,e}function qG(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function MG(e,r){return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]}function zG(e,r){let t=e[0],i=e[1],a=e[2],n=r[0],o=r[1],s=r[2];return Math.abs(t-n)<=1e-6*Math.max(1,Math.abs(t),Math.abs(n))&&Math.abs(i-o)<=1e-6*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-s)<=1e-6*Math.max(1,Math.abs(a),Math.abs(s))}var NG=ij,UG=nj,HG=oj,GG=sj,WG=uj,VG=aj,$G=cj,KG=function(){let e=tj();return function(r,t,i,a,n,o){let s,u;for(t||(t=3),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],e[2]=r[s+2],n(e,e,o),r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2];return r}}();var $v=[0,0,0],Zp,Ir=class extends Xp{static get ZERO(){return Zp||(Zp=new Ir(0,0,0),Object.freeze(Zp)),Zp}constructor(r=0,t=0,i=0){super(-0,-0,-0),arguments.length===1&&Ao(r)?this.copy(r):(Bt.debug&&(Aa(r),Aa(t),Aa(i)),this[0]=r,this[1]=t,this[2]=i)}set(r,t,i){return this[0]=r,this[1]=t,this[2]=i,this.check()}copy(r){return this[0]=r[0],this[1]=r[1],this[2]=r[2],this.check()}fromObject(r){return Bt.debug&&(Aa(r.x),Aa(r.y),Aa(r.z)),this[0]=r.x,this[1]=r.y,this[2]=r.z,this.check()}toObject(r){return r.x=this[0],r.y=this[1],r.z=this[2],r}get ELEMENTS(){return 3}get z(){return this[2]}set z(r){this[2]=Aa(r)}angle(r){return Vv(this,r)}cross(r){return zv(this,this,r),this.check()}rotateX({radians:r,origin:t=$v}){return Hv(this,this,t,r),this.check()}rotateY({radians:r,origin:t=$v}){return Gv(this,this,t,r),this.check()}rotateZ({radians:r,origin:t=$v}){return Wv(this,this,t,r),this.check()}transform(r){return this.transformAsPoint(r)}transformAsPoint(r){return Zc(this,this,r),this.check()}transformAsVector(r){return Qp(this,this,r),this.check()}transformByMatrix3(r){return Nv(this,this,r),this.check()}transformByMatrix2(r){return rj(this,this,r),this.check()}transformByQuaternion(r){return Uv(this,this,r),this.check()}};var Jp=class extends hu{toString(){let r="[";if(Bt.printRowMajor){r+="row-major:";for(let t=0;t<this.RANK;++t)for(let i=0;i<this.RANK;++i)r+=" ".concat(this[i*this.RANK+t])}else{r+="column-major:";for(let t=0;t<this.ELEMENTS;++t)r+=" ".concat(this[t])}return r+="]",r}getElementIndex(r,t){return t*this.RANK+r}getElement(r,t){return this[t*this.RANK+r]}setElement(r,t,i){return this[t*this.RANK+r]=Aa(i),this}getColumn(r,t=new Array(this.RANK).fill(-0)){let i=r*this.RANK;for(let a=0;a<this.RANK;++a)t[a]=this[i+a];return t}setColumn(r,t){let i=r*this.RANK;for(let a=0;a<this.RANK;++a)this[i+a]=t[a];return this}};function YG(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function lj(e,r){if(e===r){let t=r[1],i=r[2],a=r[3],n=r[6],o=r[7],s=r[11];e[1]=r[4],e[2]=r[8],e[3]=r[12],e[4]=t,e[6]=r[9],e[7]=r[13],e[8]=i,e[9]=n,e[11]=r[14],e[12]=a,e[13]=o,e[14]=s}else e[0]=r[0],e[1]=r[4],e[2]=r[8],e[3]=r[12],e[4]=r[1],e[5]=r[5],e[6]=r[9],e[7]=r[13],e[8]=r[2],e[9]=r[6],e[10]=r[10],e[11]=r[14],e[12]=r[3],e[13]=r[7],e[14]=r[11],e[15]=r[15];return e}function fj(e,r){let t=r[0],i=r[1],a=r[2],n=r[3],o=r[4],s=r[5],u=r[6],l=r[7],f=r[8],h=r[9],d=r[10],m=r[11],y=r[12],k=r[13],x=r[14],A=r[15],P=t*s-i*o,T=t*u-a*o,B=t*l-n*o,C=i*u-a*s,I=i*l-n*s,F=a*l-n*u,H=f*k-h*y,N=f*x-d*y,K=f*A-m*y,V=h*x-d*k,X=h*A-m*k,U=d*A-m*x,$=P*U-T*X+B*V+C*K-I*N+F*H;return $?($=1/$,e[0]=(s*U-u*X+l*V)*$,e[1]=(a*X-i*U-n*V)*$,e[2]=(k*F-x*I+A*C)*$,e[3]=(d*I-h*F-m*C)*$,e[4]=(u*K-o*U-l*N)*$,e[5]=(t*U-a*K+n*N)*$,e[6]=(x*B-y*F-A*T)*$,e[7]=(f*F-d*B+m*T)*$,e[8]=(o*X-s*K+l*H)*$,e[9]=(i*K-t*X-n*H)*$,e[10]=(y*I-k*B+A*P)*$,e[11]=(h*B-f*I-m*P)*$,e[12]=(s*N-o*V-u*H)*$,e[13]=(t*V-i*N+a*H)*$,e[14]=(k*T-y*C-x*P)*$,e[15]=(f*C-h*T+d*P)*$,e):null}function pj(e){let r=e[0],t=e[1],i=e[2],a=e[3],n=e[4],o=e[5],s=e[6],u=e[7],l=e[8],f=e[9],h=e[10],d=e[11],m=e[12],y=e[13],k=e[14],x=e[15],A=r*o-t*n,P=r*s-i*n,T=t*s-i*o,B=l*y-f*m,C=l*k-h*m,I=f*k-h*y,F=r*I-t*C+i*B,H=n*I-o*C+s*B,N=l*T-f*P+h*A,K=m*T-y*P+k*A;return u*F-a*H+x*N-d*K}function Kv(e,r,t){let i=r[0],a=r[1],n=r[2],o=r[3],s=r[4],u=r[5],l=r[6],f=r[7],h=r[8],d=r[9],m=r[10],y=r[11],k=r[12],x=r[13],A=r[14],P=r[15],T=t[0],B=t[1],C=t[2],I=t[3];return e[0]=T*i+B*s+C*h+I*k,e[1]=T*a+B*u+C*d+I*x,e[2]=T*n+B*l+C*m+I*A,e[3]=T*o+B*f+C*y+I*P,T=t[4],B=t[5],C=t[6],I=t[7],e[4]=T*i+B*s+C*h+I*k,e[5]=T*a+B*u+C*d+I*x,e[6]=T*n+B*l+C*m+I*A,e[7]=T*o+B*f+C*y+I*P,T=t[8],B=t[9],C=t[10],I=t[11],e[8]=T*i+B*s+C*h+I*k,e[9]=T*a+B*u+C*d+I*x,e[10]=T*n+B*l+C*m+I*A,e[11]=T*o+B*f+C*y+I*P,T=t[12],B=t[13],C=t[14],I=t[15],e[12]=T*i+B*s+C*h+I*k,e[13]=T*a+B*u+C*d+I*x,e[14]=T*n+B*l+C*m+I*A,e[15]=T*o+B*f+C*y+I*P,e}function dj(e,r,t){let i=t[0],a=t[1],n=t[2],o,s,u,l,f,h,d,m,y,k,x,A;return r===e?(e[12]=r[0]*i+r[4]*a+r[8]*n+r[12],e[13]=r[1]*i+r[5]*a+r[9]*n+r[13],e[14]=r[2]*i+r[6]*a+r[10]*n+r[14],e[15]=r[3]*i+r[7]*a+r[11]*n+r[15]):(o=r[0],s=r[1],u=r[2],l=r[3],f=r[4],h=r[5],d=r[6],m=r[7],y=r[8],k=r[9],x=r[10],A=r[11],e[0]=o,e[1]=s,e[2]=u,e[3]=l,e[4]=f,e[5]=h,e[6]=d,e[7]=m,e[8]=y,e[9]=k,e[10]=x,e[11]=A,e[12]=o*i+f*a+y*n+r[12],e[13]=s*i+h*a+k*n+r[13],e[14]=u*i+d*a+x*n+r[14],e[15]=l*i+m*a+A*n+r[15]),e}function hj(e,r,t){let i=t[0],a=t[1],n=t[2];return e[0]=r[0]*i,e[1]=r[1]*i,e[2]=r[2]*i,e[3]=r[3]*i,e[4]=r[4]*a,e[5]=r[5]*a,e[6]=r[6]*a,e[7]=r[7]*a,e[8]=r[8]*n,e[9]=r[9]*n,e[10]=r[10]*n,e[11]=r[11]*n,e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function mj(e,r,t,i){let a=i[0],n=i[1],o=i[2],s=Math.sqrt(a*a+n*n+o*o),u,l,f,h,d,m,y,k,x,A,P,T,B,C,I,F,H,N,K,V,X,U,$,Z;return s<1e-6?null:(s=1/s,a*=s,n*=s,o*=s,l=Math.sin(t),u=Math.cos(t),f=1-u,h=r[0],d=r[1],m=r[2],y=r[3],k=r[4],x=r[5],A=r[6],P=r[7],T=r[8],B=r[9],C=r[10],I=r[11],F=a*a*f+u,H=n*a*f+o*l,N=o*a*f-n*l,K=a*n*f-o*l,V=n*n*f+u,X=o*n*f+a*l,U=a*o*f+n*l,$=n*o*f-a*l,Z=o*o*f+u,e[0]=h*F+k*H+T*N,e[1]=d*F+x*H+B*N,e[2]=m*F+A*H+C*N,e[3]=y*F+P*H+I*N,e[4]=h*K+k*V+T*X,e[5]=d*K+x*V+B*X,e[6]=m*K+A*V+C*X,e[7]=y*K+P*V+I*X,e[8]=h*U+k*$+T*Z,e[9]=d*U+x*$+B*Z,e[10]=m*U+A*$+C*Z,e[11]=y*U+P*$+I*Z,r!==e&&(e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e)}function gj(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[4],o=r[5],s=r[6],u=r[7],l=r[8],f=r[9],h=r[10],d=r[11];return r!==e&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[4]=n*a+l*i,e[5]=o*a+f*i,e[6]=s*a+h*i,e[7]=u*a+d*i,e[8]=l*a-n*i,e[9]=f*a-o*i,e[10]=h*a-s*i,e[11]=d*a-u*i,e}function vj(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[0],o=r[1],s=r[2],u=r[3],l=r[8],f=r[9],h=r[10],d=r[11];return r!==e&&(e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=n*a-l*i,e[1]=o*a-f*i,e[2]=s*a-h*i,e[3]=u*a-d*i,e[8]=n*i+l*a,e[9]=o*i+f*a,e[10]=s*i+h*a,e[11]=u*i+d*a,e}function bj(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[0],o=r[1],s=r[2],u=r[3],l=r[4],f=r[5],h=r[6],d=r[7];return r!==e&&(e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=n*a+l*i,e[1]=o*a+f*i,e[2]=s*a+h*i,e[3]=u*a+d*i,e[4]=l*a-n*i,e[5]=f*a-o*i,e[6]=h*a-s*i,e[7]=d*a-u*i,e}function yj(e,r){let t=r[0],i=r[1],a=r[2],n=r[3],o=t+t,s=i+i,u=a+a,l=t*o,f=i*o,h=i*s,d=a*o,m=a*s,y=a*u,k=n*o,x=n*s,A=n*u;return e[0]=1-h-y,e[1]=f+A,e[2]=d-x,e[3]=0,e[4]=f-A,e[5]=1-l-y,e[6]=m+k,e[7]=0,e[8]=d+x,e[9]=m-k,e[10]=1-l-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function xj(e,r,t,i,a,n,o){let s=1/(t-r),u=1/(a-i),l=1/(n-o);return e[0]=n*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n*2*u,e[6]=0,e[7]=0,e[8]=(t+r)*s,e[9]=(a+i)*u,e[10]=(o+n)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*n*2*l,e[15]=0,e}function XG(e,r,t,i,a){let n=1/Math.tan(r/2);if(e[0]=n/t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,a!=null&&a!==1/0){let o=1/(i-a);e[10]=(a+i)*o,e[14]=2*a*i*o}else e[10]=-1,e[14]=-2*i;return e}var wj=XG;function QG(e,r,t,i,a,n,o){let s=1/(r-t),u=1/(i-a),l=1/(n-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(r+t)*s,e[13]=(a+i)*u,e[14]=(o+n)*l,e[15]=1,e}var _j=QG;function kj(e,r,t,i){let a,n,o,s,u,l,f,h,d,m,y=r[0],k=r[1],x=r[2],A=i[0],P=i[1],T=i[2],B=t[0],C=t[1],I=t[2];return Math.abs(y-B)<1e-6&&Math.abs(k-C)<1e-6&&Math.abs(x-I)<1e-6?YG(e):(h=y-B,d=k-C,m=x-I,a=1/Math.sqrt(h*h+d*d+m*m),h*=a,d*=a,m*=a,n=P*m-T*d,o=T*h-A*m,s=A*d-P*h,a=Math.sqrt(n*n+o*o+s*s),a?(a=1/a,n*=a,o*=a,s*=a):(n=0,o=0,s=0),u=d*s-m*o,l=m*n-h*s,f=h*o-d*n,a=Math.sqrt(u*u+l*l+f*f),a?(a=1/a,u*=a,l*=a,f*=a):(u=0,l=0,f=0),e[0]=n,e[1]=u,e[2]=h,e[3]=0,e[4]=o,e[5]=l,e[6]=d,e[7]=0,e[8]=s,e[9]=f,e[10]=m,e[11]=0,e[12]=-(n*y+o*k+s*x),e[13]=-(u*y+l*k+f*x),e[14]=-(h*y+d*k+m*x),e[15]=1,e)}function ZG(){let e=new Hi(4);return Hi!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Sj(e,r,t){let i=r[0],a=r[1],n=r[2],o=r[3];return e[0]=t[0]*i+t[4]*a+t[8]*n+t[12]*o,e[1]=t[1]*i+t[5]*a+t[9]*n+t[13]*o,e[2]=t[2]*i+t[6]*a+t[10]*n+t[14]*o,e[3]=t[3]*i+t[7]*a+t[11]*n+t[15]*o,e}var ine=function(){let e=ZG();return function(r,t,i,a,n,o){let s,u;for(t||(t=4),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],e[2]=r[s+2],e[3]=r[s+3],n(e,e,o),r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2],r[s+3]=e[3];return r}}();var Qv;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Qv||(Qv={}));var JG=45*Math.PI/180,eW=1,Yv=.1,Xv=500,rW=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),vi=class extends Jp{static get IDENTITY(){return aW()}static get ZERO(){return tW()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Qv}constructor(r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(r)?this.copy(r):this.identity()}copy(r){return this[0]=r[0],this[1]=r[1],this[2]=r[2],this[3]=r[3],this[4]=r[4],this[5]=r[5],this[6]=r[6],this[7]=r[7],this[8]=r[8],this[9]=r[9],this[10]=r[10],this[11]=r[11],this[12]=r[12],this[13]=r[13],this[14]=r[14],this[15]=r[15],this.check()}set(r,t,i,a,n,o,s,u,l,f,h,d,m,y,k,x){return this[0]=r,this[1]=t,this[2]=i,this[3]=a,this[4]=n,this[5]=o,this[6]=s,this[7]=u,this[8]=l,this[9]=f,this[10]=h,this[11]=d,this[12]=m,this[13]=y,this[14]=k,this[15]=x,this.check()}setRowMajor(r,t,i,a,n,o,s,u,l,f,h,d,m,y,k,x){return this[0]=r,this[1]=n,this[2]=l,this[3]=m,this[4]=t,this[5]=o,this[6]=f,this[7]=y,this[8]=i,this[9]=s,this[10]=h,this[11]=k,this[12]=a,this[13]=u,this[14]=d,this[15]=x,this.check()}toRowMajor(r){return r[0]=this[0],r[1]=this[4],r[2]=this[8],r[3]=this[12],r[4]=this[1],r[5]=this[5],r[6]=this[9],r[7]=this[13],r[8]=this[2],r[9]=this[6],r[10]=this[10],r[11]=this[14],r[12]=this[3],r[13]=this[7],r[14]=this[11],r[15]=this[15],r}identity(){return this.copy(rW)}fromObject(r){return this.check()}fromQuaternion(r){return yj(this,r),this.check()}frustum(r){let{left:t,right:i,bottom:a,top:n,near:o=Yv,far:s=Xv}=r;return s===1/0?iW(this,t,i,a,n,o):xj(this,t,i,a,n,o,s),this.check()}lookAt(r){let{eye:t,center:i=[0,0,0],up:a=[0,1,0]}=r;return kj(this,t,i,a),this.check()}ortho(r){let{left:t,right:i,bottom:a,top:n,near:o=Yv,far:s=Xv}=r;return _j(this,t,i,a,n,o,s),this.check()}orthographic(r){let{fovy:t=JG,aspect:i=eW,focalDistance:a=1,near:n=Yv,far:o=Xv}=r;Ej(t);let s=t/2,u=a*Math.tan(s),l=u*i;return this.ortho({left:-l,right:l,bottom:-u,top:u,near:n,far:o})}perspective(r){let{fovy:t=45*Math.PI/180,aspect:i=1,near:a=.1,far:n=500}=r;return Ej(t),wj(this,t,i,a,n),this.check()}determinant(){return pj(this)}getScale(r=[-0,-0,-0]){return r[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),r[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),r[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),r}getTranslation(r=[-0,-0,-0]){return r[0]=this[12],r[1]=this[13],r[2]=this[14],r}getRotation(r,t){r=r||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let i=this.getScale(t),a=1/i[0],n=1/i[1],o=1/i[2];return r[0]=this[0]*a,r[1]=this[1]*n,r[2]=this[2]*o,r[3]=0,r[4]=this[4]*a,r[5]=this[5]*n,r[6]=this[6]*o,r[7]=0,r[8]=this[8]*a,r[9]=this[9]*n,r[10]=this[10]*o,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}getRotationMatrix3(r,t){r=r||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let i=this.getScale(t),a=1/i[0],n=1/i[1],o=1/i[2];return r[0]=this[0]*a,r[1]=this[1]*n,r[2]=this[2]*o,r[3]=this[4]*a,r[4]=this[5]*n,r[5]=this[6]*o,r[6]=this[8]*a,r[7]=this[9]*n,r[8]=this[10]*o,r}transpose(){return lj(this,this),this.check()}invert(){return fj(this,this),this.check()}multiplyLeft(r){return Kv(this,r,this),this.check()}multiplyRight(r){return Kv(this,this,r),this.check()}rotateX(r){return gj(this,this,r),this.check()}rotateY(r){return vj(this,this,r),this.check()}rotateZ(r){return bj(this,this,r),this.check()}rotateXYZ(r){return this.rotateX(r[0]).rotateY(r[1]).rotateZ(r[2])}rotateAxis(r,t){return mj(this,this,r,t),this.check()}scale(r){return hj(this,this,Array.isArray(r)?r:[r,r,r]),this.check()}translate(r){return dj(this,this,r),this.check()}transform(r,t){return r.length===4?(t=Sj(t||[-0,-0,-0,-0],r,this),Yp(t,4),t):this.transformAsPoint(r,t)}transformAsPoint(r,t){let{length:i}=r,a;switch(i){case 2:a=J4(t||[-0,-0],r,this);break;case 3:a=Zc(t||[-0,-0,-0],r,this);break;default:throw new Error("Illegal vector")}return Yp(a,r.length),a}transformAsVector(r,t){let i;switch(r.length){case 2:i=ej(t||[-0,-0],r,this);break;case 3:i=Qp(t||[-0,-0,-0],r,this);break;default:throw new Error("Illegal vector")}return Yp(i,r.length),i}transformPoint(r,t){return this.transformAsPoint(r,t)}transformVector(r,t){return this.transformAsPoint(r,t)}transformDirection(r,t){return this.transformAsVector(r,t)}makeRotationX(r){return this.identity().rotateX(r)}makeTranslation(r,t,i){return this.identity().translate([r,t,i])}},ed,rd;function tW(){return ed||(ed=new vi([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(ed)),ed}function aW(){return rd||(rd=new vi,Object.freeze(rd)),rd}function Ej(e){if(e>Math.PI*2)throw Error("expected radians")}function iW(e,r,t,i,a,n){let o=2*n/(t-r),s=2*n/(a-i),u=(t+r)/(t-r),l=(a+i)/(a-i),f=-1,h=-1,d=-2*n;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=u,e[9]=l,e[10]=f,e[11]=h,e[12]=0,e[13]=0,e[14]=d,e[15]=0,e}var cs={};Au(cs,{EPSILON1:()=>nW,EPSILON10:()=>hW,EPSILON11:()=>mW,EPSILON12:()=>gW,EPSILON13:()=>vW,EPSILON14:()=>bW,EPSILON15:()=>yW,EPSILON16:()=>xW,EPSILON17:()=>wW,EPSILON18:()=>_W,EPSILON19:()=>kW,EPSILON2:()=>oW,EPSILON20:()=>SW,EPSILON3:()=>sW,EPSILON4:()=>uW,EPSILON5:()=>cW,EPSILON6:()=>lW,EPSILON7:()=>fW,EPSILON8:()=>pW,EPSILON9:()=>dW,PI_OVER_FOUR:()=>jW,PI_OVER_SIX:()=>AW,PI_OVER_TWO:()=>EW,TWO_PI:()=>TW});var nW=.1,oW=.01,sW=.001,uW=1e-4,cW=1e-5,lW=1e-6,fW=1e-7,pW=1e-8,dW=1e-9,hW=1e-10,mW=1e-11,gW=1e-12,vW=1e-13,bW=1e-14,yW=1e-15,xW=1e-16,wW=1e-17,_W=1e-18,kW=1e-19,SW=1e-20,EW=Math.PI/2,jW=Math.PI/4,AW=Math.PI/6,TW=Math.PI*2;var Gn=6356752314245179e-9,PW={radii:[6378137,6378137,Gn],radiiSquared:[6378137*6378137,6378137*6378137,Gn*Gn],oneOverRadii:[1/6378137,1/6378137,1/Gn],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Gn*Gn)],maximumRadius:Math.max(6378137,6378137,Gn),centerToleranceSquared:.1};function td(e){return e}var Bne=new Ir;function RW(e,r=[],t=td){return"longitude"in e?(r[0]=t(e.longitude),r[1]=t(e.latitude),r[2]=e.height):"x"in e?(r[0]=t(e.x),r[1]=t(e.y),r[2]=e.z):(r[0]=t(e[0]),r[1]=t(e[1]),r[2]=e[2]),r}function jj(e,r=[]){return RW(e,r,Bt._cartographicRadians?td:Dv)}function CW(e,r,t=td){return"longitude"in r?(r.longitude=t(e[0]),r.latitude=t(e[1]),r.height=e[2]):"x"in r?(r.x=t(e[0]),r.y=t(e[1]),r.z=e[2]):(r[0]=t(e[0]),r[1]=t(e[1]),r[2]=e[2]),r}function Aj(e,r){return CW(e,r,Bt._cartographicRadians?td:Lv)}var Tj=1e-14,OW=new Ir,Pj={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"}},Zv={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},el={east:new Ir,north:new Ir,up:new Ir,west:new Ir,south:new Ir,down:new Ir},IW=new Ir,BW=new Ir,FW=new Ir;function Jv(e,r,t,i,a,n){let o=Pj[r]&&Pj[r][t];gi(o&&(!i||i===o));let s,u,l,f=OW.copy(a);if(Un(f.x,0,Tj)&&Un(f.y,0,Tj)){let d=Math.sign(f.z);s=IW.fromArray(Zv[r]),r!=="east"&&r!=="west"&&s.scale(d),u=BW.fromArray(Zv[t]),t!=="east"&&t!=="west"&&u.scale(d),l=FW.fromArray(Zv[i]),i!=="east"&&i!=="west"&&l.scale(d)}else{let{up:d,east:m,north:y}=el;m.set(-f.y,f.x,0).normalize(),e.geodeticSurfaceNormal(f,d),y.copy(d).cross(m);let{down:k,west:x,south:A}=el;k.copy(d).scale(-1),x.copy(m).scale(-1),A.copy(y).scale(-1),s=el[r],u=el[t],l=el[i]}return n[0]=s.x,n[1]=s.y,n[2]=s.z,n[3]=0,n[4]=u.x,n[5]=u.y,n[6]=u.z,n[7]=0,n[8]=l.x,n[9]=l.y,n[10]=l.z,n[11]=0,n[12]=f.x,n[13]=f.y,n[14]=f.z,n[15]=1,n}var gu=new Ir,DW=new Ir,LW=new Ir;function Rj(e,r,t=[]){let{oneOverRadii:i,oneOverRadiiSquared:a,centerToleranceSquared:n}=r;gu.from(e);let o=gu.x,s=gu.y,u=gu.z,l=i.x,f=i.y,h=i.z,d=o*o*l*l,m=s*s*f*f,y=u*u*h*h,k=d+m+y,x=Math.sqrt(1/k);if(!Number.isFinite(x))return;let A=DW;if(A.copy(e).scale(x),k<n)return A.to(t);let P=a.x,T=a.y,B=a.z,C=LW;C.set(A.x*P*2,A.y*T*2,A.z*B*2);let I=(1-x)*gu.len()/(.5*C.len()),F=0,H,N,K,V;do{I-=F,H=1/(1+I*P),N=1/(1+I*T),K=1/(1+I*B);let X=H*H,U=N*N,$=K*K,Z=X*H,le=U*N,ve=$*K;V=d*X+m*U+y*$-1;let we=-2*(d*Z*P+m*le*T+y*ve*B);F=V/we}while(Math.abs(V)>cs.EPSILON12);return gu.scale([H,N,K]).to(t)}var ad=new Ir,Cj=new Ir,zW=new Ir,Gi=new Ir,NW=new Ir,id=new Ir,Wn=class{constructor(r=0,t=0,i=0){ht(this,"radii",void 0),ht(this,"radiiSquared",void 0),ht(this,"radiiToTheFourth",void 0),ht(this,"oneOverRadii",void 0),ht(this,"oneOverRadiiSquared",void 0),ht(this,"minimumRadius",void 0),ht(this,"maximumRadius",void 0),ht(this,"centerToleranceSquared",cs.EPSILON1),ht(this,"squaredXOverSquaredZ",void 0),gi(r>=0),gi(t>=0),gi(i>=0),this.radii=new Ir(r,t,i),this.radiiSquared=new Ir(r*r,t*t,i*i),this.radiiToTheFourth=new Ir(r*r*r*r,t*t*t*t,i*i*i*i),this.oneOverRadii=new Ir(r===0?0:1/r,t===0?0:1/t,i===0?0:1/i),this.oneOverRadiiSquared=new Ir(r===0?0:1/(r*r),t===0?0:1/(t*t),i===0?0:1/(i*i)),this.minimumRadius=Math.min(r,t,i),this.maximumRadius=Math.max(r,t,i),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(r){return this===r||Boolean(r&&this.radii.equals(r.radii))}toString(){return this.radii.toString()}cartographicToCartesian(r,t=[0,0,0]){let i=Cj,a=zW,[,,n]=r;this.geodeticSurfaceNormalCartographic(r,i),a.copy(this.radiiSquared).scale(i);let o=Math.sqrt(i.dot(a));return a.scale(1/o),i.scale(n),a.add(i),a.to(t)}cartesianToCartographic(r,t=[0,0,0]){id.from(r);let i=this.scaleToGeodeticSurface(id,Gi);if(!i)return;let a=this.geodeticSurfaceNormal(i,Cj),n=NW;n.copy(id).subtract(i);let o=Math.atan2(a.y,a.x),s=Math.asin(a.z),u=Math.sign(Jc.dot(n,id))*Jc.length(n);return Aj([o,s,u],t)}eastNorthUpToFixedFrame(r,t=new vi){return Jv(this,"east","north","up",r,t)}localFrameToFixedFrame(r,t,i,a,n=new vi){return Jv(this,r,t,i,a,n)}geocentricSurfaceNormal(r,t=[0,0,0]){return ad.from(r).normalize().to(t)}geodeticSurfaceNormalCartographic(r,t=[0,0,0]){let i=jj(r),a=i[0],n=i[1],o=Math.cos(n);return ad.set(o*Math.cos(a),o*Math.sin(a),Math.sin(n)).normalize(),ad.to(t)}geodeticSurfaceNormal(r,t=[0,0,0]){return ad.from(r).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(r,t){return Rj(r,this,t)}scaleToGeocentricSurface(r,t=[0,0,0]){Gi.from(r);let i=Gi.x,a=Gi.y,n=Gi.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(i*i*o.x+a*a*o.y+n*n*o.z);return Gi.multiplyScalar(s).to(t)}transformPositionToScaledSpace(r,t=[0,0,0]){return Gi.from(r).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(r,t=[0,0,0]){return Gi.from(r).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(r,t=0,i=[0,0,0]){gi(Un(this.radii.x,this.radii.y,cs.EPSILON15)),gi(this.radii.z>0),Gi.from(r);let a=Gi.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(a)>=this.radii.z-t))return Gi.set(0,0,a).to(i)}};ht(Wn,"WGS84",new Wn(6378137,6378137,Gn));var Oj="4.2.0-alpha.4";var Ij,UW=(Ij=globalThis.loaders)==null?void 0:Ij.parseImageNode,e1=typeof Image<"u",r1=typeof ImageBitmap<"u",HW=Boolean(UW),t1=Jo?!0:HW;function Bj(e){switch(e){case"auto":return r1||e1||t1;case"imagebitmap":return r1;case"image":return e1;case"data":return t1;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Fj(){if(r1)return"imagebitmap";if(e1)return"image";if(t1)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function GW(e){let r=WW(e);if(!r)throw new Error("Not an image");return r}function Dj(e){switch(GW(e)){case"data":return e;case"image":case"imagebitmap":let r=document.createElement("canvas"),t=r.getContext("2d");if(!t)throw new Error("getImageData");return r.width=e.width,r.height=e.height,t.drawImage(e,0,0),t.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function WW(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var VW=/^data:image\/svg\+xml/,$W=/\.svg((\?|#).*)?$/;function nd(e){return e&&(VW.test(e)||$W.test(e))}function Lj(e,r){if(nd(r)){let i=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(n){throw new Error(n.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return a1(e,r)}function a1(e,r){if(nd(r))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function od(e,r,t){let i=Lj(e,t),a=self.URL||self.webkitURL,n=typeof i!="string"&&a.createObjectURL(i);try{return await KW(n||i,r)}finally{n&&a.revokeObjectURL(n)}}async function KW(e,r){let t=new Image;return t.src=e,r.image&&r.image.decode&&t.decode?(await t.decode(),t):await new Promise((i,a)=>{try{t.onload=()=>i(t),t.onerror=n=>{let o=n instanceof Error?n.message:"error";a(new Error(o))}}catch(n){a(n)}})}var YW={},qj=!0;async function Mj(e,r,t){let i;nd(t)?i=await od(e,r,t):i=a1(e,t);let a=r&&r.imagebitmap;return await XW(i,a)}async function XW(e,r=null){if((QW(r)||!qj)&&(r=null),r)try{return await createImageBitmap(e,r)}catch(t){console.warn(t),qj=!1}return await createImageBitmap(e)}function QW(e){for(let r in e||YW)return!1;return!0}function zj(e){return!rV(e,"ftyp",4)||!(e[8]&96)?null:ZW(e)}function ZW(e){switch(JW(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function JW(e,r,t){return String.fromCharCode(...e.slice(r,t))}function eV(e){return[...e].map(r=>r.charCodeAt(0))}function rV(e,r,t=0){let i=eV(r);for(let a=0;a<i.length;++a)if(i[a]!==e[a+t])return!1;return!0}var bn=!1,rl=!0;function sd(e){let r=tl(e);return aV(r)||oV(r)||iV(r)||nV(r)||tV(r)}function tV(e){let r=new Uint8Array(e instanceof DataView?e.buffer:e),t=zj(r);return t?{mimeType:t.mimeType,width:0,height:0}:null}function aV(e){let r=tl(e);return r.byteLength>=24&&r.getUint32(0,bn)===2303741511?{mimeType:"image/png",width:r.getUint32(16,bn),height:r.getUint32(20,bn)}:null}function iV(e){let r=tl(e);return r.byteLength>=10&&r.getUint32(0,bn)===1195984440?{mimeType:"image/gif",width:r.getUint16(6,rl),height:r.getUint16(8,rl)}:null}function nV(e){let r=tl(e);return r.byteLength>=14&&r.getUint16(0,bn)===16973&&r.getUint32(2,rl)===r.byteLength?{mimeType:"image/bmp",width:r.getUint32(18,rl),height:r.getUint32(22,rl)}:null}function oV(e){let r=tl(e);if(!(r.byteLength>=3&&r.getUint16(0,bn)===65496&&r.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:a}=sV(),n=2;for(;n+9<r.byteLength;){let o=r.getUint16(n,bn);if(a.has(o))return{mimeType:"image/jpeg",height:r.getUint16(n+5,bn),width:r.getUint16(n+7,bn)};if(!i.has(o))return null;n+=2,n+=r.getUint16(n,bn)}return null}function sV(){let e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function tl(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function Nj(e,r){var a;let{mimeType:t}=sd(e)||{},i=(a=globalThis.loaders)==null?void 0:a.parseImageNode;return zi(i),await i(e,t)}async function Uj(e,r,t){r=r||{};let a=(r.image||{}).type||"auto",{url:n}=t||{},o=uV(a),s;switch(o){case"imagebitmap":s=await Mj(e,r,n);break;case"image":s=await od(e,r,n);break;case"data":s=await Nj(e,r);break;default:zi(!1)}return a==="data"&&(s=Dj(s)),s}function uV(e){switch(e){case"auto":case"data":return Fj();default:return Bj(e),e}}var cV=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],lV=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],fV={image:{type:"auto",decode:!0}},ud={id:"image",module:"images",name:"Images",version:Oj,mimeTypes:lV,extensions:cV,parse:Uj,tests:[e=>Boolean(sd(new DataView(e)))],options:fV};var Hj="4.2.0-alpha.4";var Gj={name:"Draco",id:"draco",module:"draco",version:Hj,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Vj(e,r,t){let i=$j(r.metadata),a=[],n=pV(r.attributes);for(let o in e){let s=e[o],u=Wj(o,s,n[o]);a.push(u)}if(t){let o=Wj("indices",t);a.push(o)}return{fields:a,metadata:i}}function pV(e){let r={};for(let t in e){let i=e[t];r[i.name||"undefined"]=i}return r}function Wj(e,r,t){let i=t?$j(t.metadata):void 0;return Iv(e,r,i)}function $j(e){Object.entries(e);let r={};for(let t in e)r[`${t}.string`]=JSON.stringify(e[t]);return r}var Kj={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},dV={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},hV=4,al=class{constructor(r){this.draco=r,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(r,t={}){let i=new this.draco.DecoderBuffer;i.Init(new Int8Array(r),r.byteLength),this._disableAttributeTransforms(t);let a=this.decoder.GetEncodedGeometryType(i),n=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(a){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(i,n);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(i,n);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!n.ptr){let d=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(d)}let s=this._getDracoLoaderData(n,a,t),u=this._getMeshData(n,s,t),l=Ov(u.attributes),f=Vj(u.attributes,s,u.indices);return{loader:"draco",loaderData:s,header:{vertexCount:n.num_points(),boundingBox:l},...u,schema:f}}finally{this.draco.destroy(i),n&&this.draco.destroy(n)}}_getDracoLoaderData(r,t,i){let a=this._getTopLevelMetadata(r),n=this._getDracoAttributes(r,i);return{geometry_type:t,num_attributes:r.num_attributes(),num_points:r.num_points(),num_faces:r instanceof this.draco.Mesh?r.num_faces():0,metadata:a,attributes:n}}_getDracoAttributes(r,t){let i={};for(let a=0;a<r.num_attributes();a++){let n=this.decoder.GetAttribute(r,a),o=this._getAttributeMetadata(r,a);i[n.unique_id()]={unique_id:n.unique_id(),attribute_type:n.attribute_type(),data_type:n.data_type(),num_components:n.num_components(),byte_offset:n.byte_offset(),byte_stride:n.byte_stride(),normalized:n.normalized(),attribute_index:a,metadata:o};let s=this._getQuantizationTransform(n,t);s&&(i[n.unique_id()].quantization_transform=s);let u=this._getOctahedronTransform(n,t);u&&(i[n.unique_id()].octahedron_transform=u)}return i}_getMeshData(r,t,i){let a=this._getMeshAttributes(t,r,i);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(r instanceof this.draco.Mesh)switch(i.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(r),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(r),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(r,t,i){let a={};for(let n of Object.values(r.attributes)){let o=this._deduceAttributeName(n,i);n.name=o;let{value:s,size:u}=this._getAttributeValues(t,n);a[o]={value:s,size:u,byteOffset:n.byte_offset,byteStride:n.byte_stride,normalized:n.normalized}}return a}_getTriangleListIndices(r){let i=r.num_faces()*3,a=i*hV,n=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(r,a,n),new Uint32Array(this.draco.HEAPF32.buffer,n,i).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(r){let t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(r,t),vV(t)}finally{this.draco.destroy(t)}}_getAttributeValues(r,t){let i=dV[t.data_type],a=t.num_components,o=r.num_points()*a,s=o*i.BYTES_PER_ELEMENT,u=mV(this.draco,i),l,f=this.draco._malloc(s);try{let h=this.decoder.GetAttribute(r,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(r,h,u,s,f),l=new i(this.draco.HEAPF32.buffer,f,o).slice()}finally{this.draco._free(f)}return{value:l,size:a}}_deduceAttributeName(r,t){let i=r.unique_id;for(let[o,s]of Object.entries(t.extraAttributes||{}))if(s===i)return o;let a=r.attribute_type;for(let o in Kj)if(this.draco[o]===a)return Kj[o];let n=t.attributeNameEntry||"name";return r.metadata[n]?r.metadata[n].string:`CUSTOM_ATTRIBUTE_${i}`}_getTopLevelMetadata(r){let t=this.decoder.GetMetadata(r);return this._getDracoMetadata(t)}_getAttributeMetadata(r,t){let i=this.decoder.GetAttributeMetadata(r,t);return this._getDracoMetadata(i)}_getDracoMetadata(r){if(!r||!r.ptr)return{};let t={},i=this.metadataQuerier.NumEntries(r);for(let a=0;a<i;a++){let n=this.metadataQuerier.GetEntryName(r,a);t[n]=this._getDracoMetadataField(r,n)}return t}_getDracoMetadataField(r,t){let i=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(r,t,i);let a=gV(i);return{int:this.metadataQuerier.GetIntEntry(r,t),string:this.metadataQuerier.GetStringEntry(r,t),double:this.metadataQuerier.GetDoubleEntry(r,t),intArray:a}}finally{this.draco.destroy(i)}}_disableAttributeTransforms(r){let{quantizedAttributes:t=[],octahedronAttributes:i=[]}=r,a=[...t,...i];for(let n of a)this.decoder.SkipAttributeTransform(this.draco[n])}_getQuantizationTransform(r,t){let{quantizedAttributes:i=[]}=t,a=r.attribute_type();if(i.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(r))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(s=>o.min_value(s))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(r,t){let{octahedronAttributes:i=[]}=t,a=r.attribute_type();if(i.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(r))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function mV(e,r){switch(r){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}function gV(e){let r=e.size(),t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=e.GetValue(i);return t}function vV(e){let r=e.size(),t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=e.GetValue(i);return t}var bV="1.5.6",yV="1.4.1",i1=`https://www.gstatic.com/draco/versioned/decoders/${bV}`,Ha={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},n1={[Ha.DECODER]:`${i1}/${Ha.DECODER}`,[Ha.DECODER_WASM]:`${i1}/${Ha.DECODER_WASM}`,[Ha.FALLBACK_DECODER]:`${i1}/${Ha.FALLBACK_DECODER}`,[Ha.ENCODER]:`https://raw.githubusercontent.com/google/draco/${yV}/javascript/${Ha.ENCODER}`},il;async function Yj(e){let r=e.modules||{};return r.draco3d?il=il||r.draco3d.createDecoderModule({}).then(t=>({draco:t})):il=il||xV(e),await il}async function xV(e){let r,t;switch(e.draco&&e.draco.decoderType){case"js":r=await gn(n1[Ha.FALLBACK_DECODER],"draco",e,Ha.FALLBACK_DECODER);break;case"wasm":default:[r,t]=await Promise.all([await gn(n1[Ha.DECODER],"draco",e,Ha.DECODER),await gn(n1[Ha.DECODER_WASM],"draco",e,Ha.DECODER_WASM)])}return r=r||globalThis.DracoDecoderModule,await wV(r,t)}function wV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e({...t,onModuleLoaded:a=>i({draco:a})})})}var Xj={...Gj,parse:_V};async function _V(e,r){let{draco:t}=await Yj(r),i=new al(t);try{return i.parseSync(e,r==null?void 0:r.draco)}finally{i.destroy()}}var cd="4.2.0-alpha.4";var ld={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},o1;async function u1(e){let r=e.modules||{};return r.basis?r.basis:(o1=o1||kV(e),await o1)}async function kV(e){let r=null,t=null;return[r,t]=await Promise.all([await gn(ld.TRANSCODER,"textures",e),await gn(ld.TRANSCODER_WASM,"textures",e)]),r=r||globalThis.BASIS,await SV(r,t)}function SV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e(t).then(a=>{let{BasisFile:n,initializeBasis:o}=a;o(),i({BasisFile:n})})})}var s1;async function c1(e){let r=e.modules||{};return r.basisEncoder?r.basisEncoder:(s1=s1||EV(e),await s1)}async function EV(e){let r=null,t=null;return[r,t]=await Promise.all([await gn(ld.ENCODER,"textures",e),await gn(ld.ENCODER_WASM,"textures",e)]),r=r||globalThis.BASIS,await jV(r,t)}function jV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e(t).then(a=>{let{BasisFile:n,KTX2File:o,initializeBasis:s,BasisEncoder:u}=a;s(),i({BasisFile:n,KTX2File:o,BasisEncoder:u})})})}var ce={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var AV=["","WEBKIT_","MOZ_"],Qj={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"},fd=null;function Zj(e){if(!fd){e=e||TV()||void 0,fd=new Set;for(let r of AV)for(let t in Qj)if(e&&e.getExtension(`${r}${t}`)){let i=Qj[t];fd.add(i)}}return fd}function TV(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var lA=Pt(uA(),1);function vu(e,r){let t=new Array(r.mipMapLevels),i=r.width,a=r.height,n=0;for(let o=0;o<r.mipMapLevels;++o){let s=CV(r,i,a,e,o),u=RV(e,o,n,s);t[o]={compressed:!0,format:r.internalFormat,data:u,width:i,height:a,levelSize:s},i=Math.max(1,i>>1),a=Math.max(1,a>>1),n+=s}return t}function RV(e,r,t,i){return Array.isArray(e)?e[r].levelData:new Uint8Array(e.buffer,e.byteOffset+t,i)}function CV(e,r,t,i,a){return Array.isArray(i)?e.sizeFunction(i[a]):e.sizeFunction(r,t)}var OV={131:ce.COMPRESSED_RGB_S3TC_DXT1_EXT,132:ce.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:ce.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:ce.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:ce.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:ce.COMPRESSED_RED_RGTC1_EXT,140:ce.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:ce.COMPRESSED_RED_GREEN_RGTC2_EXT,142:ce.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:ce.COMPRESSED_RGB8_ETC2,148:ce.COMPRESSED_SRGB8_ETC2,149:ce.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:ce.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:ce.COMPRESSED_RGBA8_ETC2_EAC,152:ce.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:ce.COMPRESSED_R11_EAC,154:ce.COMPRESSED_SIGNED_R11_EAC,155:ce.COMPRESSED_RG11_EAC,156:ce.COMPRESSED_SIGNED_RG11_EAC,157:ce.COMPRESSED_RGBA_ASTC_4x4_KHR,158:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:ce.COMPRESSED_RGBA_ASTC_5x4_KHR,160:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:ce.COMPRESSED_RGBA_ASTC_5x5_KHR,162:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:ce.COMPRESSED_RGBA_ASTC_6x5_KHR,164:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:ce.COMPRESSED_RGBA_ASTC_6x6_KHR,166:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:ce.COMPRESSED_RGBA_ASTC_8x5_KHR,168:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:ce.COMPRESSED_RGBA_ASTC_8x6_KHR,170:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:ce.COMPRESSED_RGBA_ASTC_8x8_KHR,172:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:ce.COMPRESSED_RGBA_ASTC_10x5_KHR,174:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:ce.COMPRESSED_RGBA_ASTC_10x6_KHR,176:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:ce.COMPRESSED_RGBA_ASTC_10x8_KHR,178:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:ce.COMPRESSED_RGBA_ASTC_10x10_KHR,180:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:ce.COMPRESSED_RGBA_ASTC_12x10_KHR,182:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:ce.COMPRESSED_RGBA_ASTC_12x12_KHR,184:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:ce.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:ce.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:ce.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:ce.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:ce.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:ce.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:ce.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:ce.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:ce.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:ce.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:ce.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:ce.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:ce.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:ce.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:ce.COMPRESSED_RGBA_ASTC_12x12_KHR};function cA(e){return OV[e]}var Ja=[171,75,84,88,32,50,48,187,13,10,26,10];function gd(e){let r=new Uint8Array(e);return!(r.byteLength<Ja.length||r[0]!==Ja[0]||r[1]!==Ja[1]||r[2]!==Ja[2]||r[3]!==Ja[3]||r[4]!==Ja[4]||r[5]!==Ja[5]||r[6]!==Ja[6]||r[7]!==Ja[7]||r[8]!==Ja[8]||r[9]!==Ja[9]||r[10]!==Ja[10]||r[11]!==Ja[11])}function fA(e){let r=new Uint8Array(e),t=(0,lA.read)(r),i=Math.max(1,t.levels.length),a=t.pixelWidth,n=t.pixelHeight,o=cA(t.vkFormat);return vu(t.levels,{mipMapLevels:i,width:a,height:n,sizeFunction:s=>s.uncompressedByteLength,internalFormat:o})}var IV={etc1:{basisFormat:0,compressed:!0,format:ce.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:ce.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:ce.COMPRESSED_RGBA_S3TC_DXT5_EXT},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:ce.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:ce.COMPRESSED_RGBA_ASTC_4X4_KHR},"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}};async function ol(e,r){if(r.basis.containerFormat==="auto"){if(gd(e)){let i=await c1(r);return pA(i.KTX2File,e,r)}let{BasisFile:t}=await u1(r);return h1(t,e,r)}switch(r.basis.module){case"encoder":let t=await c1(r);switch(r.basis.containerFormat){case"ktx2":return pA(t.KTX2File,e,r);case"basis":default:return h1(t.BasisFile,e,r)}case"transcoder":default:let{BasisFile:i}=await u1(r);return h1(i,e,r)}}function h1(e,r,t){let i=new e(new Uint8Array(r));try{if(!i.startTranscoding())throw new Error("Failed to start basis transcoding");let a=i.getNumImages(),n=[];for(let o=0;o<a;o++){let s=i.getNumLevels(o),u=[];for(let l=0;l<s;l++)u.push(BV(i,o,l,t));n.push(u)}return n}finally{i.close(),i.delete()}}function BV(e,r,t,i){let a=e.getImageWidth(r,t),n=e.getImageHeight(r,t),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:l}=dA(i,o),f=e.getImageTranscodedSizeInBytes(r,t,l),h=new Uint8Array(f);if(!e.transcodeImage(h,r,t,l,0,0))throw new Error("failed to start Basis transcoding");return{width:a,height:n,data:h,compressed:s,format:u,hasAlpha:o}}function pA(e,r,t){let i=new e(new Uint8Array(r));try{if(!i.startTranscoding())throw new Error("failed to start KTX2 transcoding");let a=i.getLevels(),n=[];for(let o=0;o<a;o++){n.push(FV(i,o,t));break}return[n]}finally{i.close(),i.delete()}}function FV(e,r,t){let{alphaFlag:i,height:a,width:n}=e.getImageLevelInfo(r,0,0),{compressed:o,format:s,basisFormat:u}=dA(t,i),l=e.getImageTranscodedSizeInBytes(r,0,0,u),f=new Uint8Array(l);if(!e.transcodeImage(f,r,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:n,height:a,data:f,compressed:o,levelSize:l,hasAlpha:i,format:s}}function dA(e,r){let t=e&&e.basis&&e.basis.format;return t==="auto"&&(t=DV()),typeof t=="object"&&(t=r?t.alpha:t.noAlpha),t=t.toLowerCase(),IV[t]}function DV(){let e=Zj();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var hA={name:"Basis",id:"basis",module:"textures",version:cd,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},sl={...hA,parse:ol};var ei={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4},LV={DXT1:ce.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:ce.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:ce.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":ce.COMPRESSED_RGB_ATC_WEBGL,ATCA:ce.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:ce.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},qV=vA,MV=vd,zV=vd,NV={DXT1:vA,DXT3:vd,DXT5:vd,"ATC ":qV,ATCA:MV,ATCI:zV};function mA(e){return new Uint32Array(e,0,ei.HEADER_LENGTH)[ei.MAGIC_NUMBER_INDEX]===ei.MAGIC_NUMBER}function gA(e){let r=new Int32Array(e,0,ei.HEADER_LENGTH),t=r[ei.HEADER_PF_FOURCC_INDEX];zi(Boolean(r[ei.HEADER_PF_FLAGS_INDEX]&ei.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let i=UV(t),a=LV[i],n=NV[i];zi(a&&n,`DDS: Unknown pixel format ${t}`);let o=1;r[ei.HEADER_FLAGS_INDEX]&ei.DDSD_MIPMAPCOUNT&&(o=Math.max(1,r[ei.MIPMAPCOUNT_INDEX]));let s=r[ei.HEADER_WIDTH_INDEX],u=r[ei.HEADER_HEIGHT_INDEX],l=r[ei.HEADER_SIZE_INDEX]+4,f=new Uint8Array(e,l);return vu(f,{mipMapLevels:o,width:s,height:u,sizeFunction:n,internalFormat:a})}function vA(e,r){return(e+3>>2)*(r+3>>2)*8}function vd(e,r){return(e+3>>2)*(r+3>>2)*16}function UV(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var bi={MAGIC_NUMBER:55727696,MAGIC_NUMBER_EXTRA:1347834371,HEADER_LENGTH:13,HEADER_SIZE:52,MAGIC_NUMBER_INDEX:0,PIXEL_FORMAT_INDEX:2,COLOUR_SPACE_INDEX:4,HEIGHT_INDEX:6,WIDTH_INDEX:7,MIPMAPCOUNT_INDEX:11,METADATA_SIZE_INDEX:12},HV={0:[ce.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[ce.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[ce.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[ce.COMPRESSED_RGB_ETC1_WEBGL],7:[ce.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[ce.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[ce.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[ce.COMPRESSED_RGB8_ETC2],23:[ce.COMPRESSED_RGBA8_ETC2_EAC],24:[ce.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[ce.COMPRESSED_R11_EAC],26:[ce.COMPRESSED_RG11_EAC],27:[ce.COMPRESSED_RGBA_ASTC_4X4_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[ce.COMPRESSED_RGBA_ASTC_5X4_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[ce.COMPRESSED_RGBA_ASTC_5X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[ce.COMPRESSED_RGBA_ASTC_6X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[ce.COMPRESSED_RGBA_ASTC_6X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[ce.COMPRESSED_RGBA_ASTC_8X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[ce.COMPRESSED_RGBA_ASTC_8X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[ce.COMPRESSED_RGBA_ASTC_8X8_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[ce.COMPRESSED_RGBA_ASTC_10X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[ce.COMPRESSED_RGBA_ASTC_10X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[ce.COMPRESSED_RGBA_ASTC_10X8_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[ce.COMPRESSED_RGBA_ASTC_10X10_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[ce.COMPRESSED_RGBA_ASTC_12X10_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[ce.COMPRESSED_RGBA_ASTC_12X12_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},GV={0:bA,1:bA,2:yA,3:yA,6:ul,7:ul,9:cl,11:cl,22:ul,23:cl,24:ul,25:ul,26:cl,27:cl,28:WV,29:VV,30:$V,31:KV,32:YV,33:XV,34:QV,35:ZV,36:JV,37:e$,38:r$,39:t$,40:a$};function xA(e){let t=new Uint32Array(e,0,bi.HEADER_LENGTH)[bi.MAGIC_NUMBER_INDEX];return t===bi.MAGIC_NUMBER||t===bi.MAGIC_NUMBER_EXTRA}function wA(e){let r=new Uint32Array(e,0,bi.HEADER_LENGTH),t=r[bi.PIXEL_FORMAT_INDEX],i=r[bi.COLOUR_SPACE_INDEX],a=HV[t]||[],n=a.length>1&&i?a[1]:a[0],o=GV[t],s=r[bi.MIPMAPCOUNT_INDEX],u=r[bi.WIDTH_INDEX],l=r[bi.HEIGHT_INDEX],f=bi.HEADER_SIZE+r[bi.METADATA_SIZE_INDEX],h=new Uint8Array(e,f);return vu(h,{mipMapLevels:s,width:u,height:l,sizeFunction:o,internalFormat:n})}function bA(e,r){return e=Math.max(e,16),r=Math.max(r,8),e*r/4}function yA(e,r){return e=Math.max(e,8),r=Math.max(r,8),e*r/2}function ul(e,r){return Math.floor((e+3)/4)*Math.floor((r+3)/4)*8}function cl(e,r){return Math.floor((e+3)/4)*Math.floor((r+3)/4)*16}function WV(e,r){return Math.floor((e+4)/5)*Math.floor((r+3)/4)*16}function VV(e,r){return Math.floor((e+4)/5)*Math.floor((r+4)/5)*16}function $V(e,r){return Math.floor((e+5)/6)*Math.floor((r+4)/5)*16}function KV(e,r){return Math.floor((e+5)/6)*Math.floor((r+5)/6)*16}function YV(e,r){return Math.floor((e+7)/8)*Math.floor((r+4)/5)*16}function XV(e,r){return Math.floor((e+7)/8)*Math.floor((r+5)/6)*16}function QV(e,r){return Math.floor((e+7)/8)*Math.floor((r+7)/8)*16}function ZV(e,r){return Math.floor((e+9)/10)*Math.floor((r+4)/5)*16}function JV(e,r){return Math.floor((e+9)/10)*Math.floor((r+5)/6)*16}function e$(e,r){return Math.floor((e+9)/10)*Math.floor((r+7)/8)*16}function r$(e,r){return Math.floor((e+9)/10)*Math.floor((r+9)/10)*16}function t$(e,r){return Math.floor((e+11)/12)*Math.floor((r+9)/10)*16}function a$(e,r){return Math.floor((e+11)/12)*Math.floor((r+11)/12)*16}function _A(e){if(gd(e))return fA(e);if(mA(e))return gA(e);if(xA(e))return wA(e);throw new Error("Texture container format not recognized")}var kA={name:"Texture Containers",id:"compressed-texture",module:"textures",version:cd,worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{libraryPath:"libs/",useBasis:!1}}},bd={...kA,parse:async(e,r)=>{var t;return(t=r==null?void 0:r["compressed-texture"])!=null&&t.useBasis?(r.basis={format:{alpha:"BC3",noAlpha:"BC1"},...r.basis,containerFormat:"ktx2",module:"encoder"},(await ol(e,r))[0]):_A(e)}};function SA(e,r=null){return r?`${e}?token=${r}`:e}var i$={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},n$={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},ls={...i$,...n$};function m1(e){switch(e){case"UInt8":return Uint8Array;case"UInt16":return Uint16Array;case"UInt32":return Uint32Array;case"Float32":return Float32Array;case"UInt64":return Float64Array;default:throw new Error(`parse i3s tile content: unknown type of data: ${e}`)}}var EA={UInt8:ls.UNSIGNED_BYTE,UInt16:ls.UNSIGNED_SHORT,Float32:ls.FLOAT,UInt32:ls.UNSIGNED_INT,UInt64:ls.DOUBLE};function bu(e){switch(e){case"UInt8":return 1;case"UInt16":case"Int16":return 2;case"UInt32":case"Int32":case"Float32":return 4;case"UInt64":case"Int64":case"Float64":return 8;default:throw new Error(`parse i3s tile content: unknown size of data: ${e}`)}}var yd=new Ir([0,0,0]);function o$(e){switch(e){case"ktx-etc2":case"dds":return bd;case"ktx2":return sl;case"jpg":case"png":default:return ud}}var s$="i3s-attribute-type";async function PA(e,r,t,i,a){var o;let n={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new vi,coordinateSystem:0,byteLength:0,texture:null};if(r.textureUrl){let s=SA(u$(r.textureUrl),(o=i==null?void 0:i.i3s)==null?void 0:o.token),u=o$(r.textureFormat),h=await(await((a==null?void 0:a.fetch)||fetch)(s)).arrayBuffer();if(i!=null&&i.i3s.decodeTextures){if(u===ud){let d={...r.textureLoaderOptions,image:{type:"data"}};try{let m=await Gg(h,[],d,a);n.texture=m}catch{let y=await Nn(h,u,d,a);n.texture=y}}else if(u===bd||u===sl){let d=await Bv(h,u,r.textureLoaderOptions);u===sl&&(d=d[0]),n.texture={compressed:!0,mipmaps:!1,width:d[0].width,height:d[0].height,data:d}}}else n.texture=h}return n.material=v$(r.materialDefinition,n.texture),n.material&&(n.texture=null),await c$(e,n,r,t,i)}function u$(e){let r=e.split(".slpk"),t;return r.length===1?t=e:r.length===2?t=r[1].slice(1):t=e,t}async function c$(e,r,t,i,a){var h,d;let n=e.byteLength,o,s,u=0,l=0,f;if(t.isDracoGeometry){let m=await Nn(e,Xj,{draco:{attributeNameEntry:s$}});s=m.header.vertexCount,f=(h=m.indices)==null?void 0:h.value;let{POSITION:y,NORMAL:k,COLOR_0:x,TEXCOORD_0:A,["feature-index"]:P,["uv-region"]:T}=m.attributes;o={position:y,normal:k,color:x,uv0:A,uvRegion:T,id:P},l$(o,m);let B=w$(P);B&&x$(o,B)}else{let{vertexAttributes:m,ordering:y,featureAttributes:k,featureAttributeOrder:x}=i.store.defaultGeometrySchema,A=p$(e,i);u=A.byteOffset,s=A.vertexCount,l=A.featureCount;let{attributes:P,byteOffset:T}=AA(e,u,m,s,y),{attributes:B}=AA(e,T,k,l,x);y$(B),o=f$(P,B)}if(!((d=a==null?void 0:a.i3s)!=null&&d.coordinateSystem)||a.i3s.coordinateSystem===2){let m=h$(o.position,t);r.modelMatrix=m.invert(),r.coordinateSystem=2}else r.modelMatrix=g$(o.position),r.coordinateSystem=3;r.attributes={positions:o.position,normals:o.normal,colors:jA(o.color),texCoords:o.uv0,uvRegions:jA(o.uvRegion||o.region)},r.indices=f||null,o.id&&o.id.value&&(r.featureIds=o.id.value);for(let m in r.attributes)r.attributes[m]||delete r.attributes[m];return r.vertexCount=s,r.byteLength=n,r}function l$(e,r){for(let t in r.loaderData.attributes){let i=r.loaderData.attributes[t];switch(i.name){case"POSITION":e.position.metadata=i.metadata;break;case"feature-index":e.id.metadata=i.metadata;break;default:break}}}function f$(e,r){return{...e,...r}}function jA(e){return e&&(e.normalized=!0,e)}function p$(e,r){let t=0,i=0,a=0;for(let{property:n,type:o}of r.store.defaultGeometrySchema.header){let s=m1(o);switch(n){case"vertexCount":i=new s(e,0,4)[0],t+=bu(o);break;case"featureCount":a=new s(e,4,4)[0],t+=bu(o);break;default:break}}return{vertexCount:i,featureCount:a,byteOffset:t}}function AA(e,r,t,i,a){let n={};for(let o of a)if(t[o]){let{valueType:s,valuesPerElement:u}=t[o];if(r+i*u*bu(s)<=e.byteLength){let l=e.slice(r),f;if(s==="UInt64")f=d$(l,i*u,bu(s));else{let h=m1(s);f=new h(l,0,i*u)}switch(n[o]={value:f,type:EA[s],size:u},o){case"color":n.color.normalized=!0;break;case"position":case"region":case"normal":default:}r=r+i*u*bu(s)}else if(o!=="uv0")break}return{attributes:n,byteOffset:r}}function d$(e,r,t){let i=[],a=new DataView(e),n=0;for(let o=0;o<r;o++){let s=a.getUint32(n,!0),u=a.getUint32(n+4,!0),l=s+2**32*u;i.push(l),n+=t}return new Uint32Array(i)}function h$(e,r){let t=r.mbs,i=e.value,a=e.metadata,n=new vi,o=new Ir(t[0],t[1],t[2]),s=new Ir;return Wn.WGS84.cartographicToCartesian(o,s),Wn.WGS84.eastNorthUpToFixedFrame(s,n),e.value=m$(i,a,o),n}function m$(e,r={},t){let i=new Float64Array(e.length),a=r["i3s-scale_x"]&&r["i3s-scale_x"].double||1,n=r["i3s-scale_y"]&&r["i3s-scale_y"].double||1;for(let o=0;o<i.length;o+=3)i[o]=e[o]*a+t.x,i[o+1]=e[o+1]*n+t.y,i[o+2]=e[o+2]+t.z;for(let o=0;o<i.length;o+=3)Wn.WGS84.cartographicToCartesian(i.subarray(o,o+3),yd),i[o]=yd.x,i[o+1]=yd.y,i[o+2]=yd.z;return i}function g$(e){var n,o;let r=e.metadata,t=((n=r==null?void 0:r["i3s-scale_x"])==null?void 0:n.double)||1,i=((o=r==null?void 0:r["i3s-scale_y"])==null?void 0:o.double)||1,a=new vi;return a[0]=t,a[5]=i,a}function v$(e,r){let t;return e?t={...e,pbrMetallicRoughness:e.pbrMetallicRoughness?{...e.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(t={pbrMetallicRoughness:{}},r?t.pbrMetallicRoughness.baseColorTexture={texCoord:0}:t.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]),t.alphaCutoff=t.alphaCutoff||.25,t.alphaMode&&(t.alphaMode=t.alphaMode.toUpperCase()),t.emissiveFactor&&(t.emissiveFactor=TA(t.emissiveFactor)),t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorFactor&&(t.pbrMetallicRoughness.baseColorFactor=TA(t.pbrMetallicRoughness.baseColorFactor)),r&&b$(t,r),t}function TA(e){let r=[...e];for(let t=0;t<e.length;t++)r[t]=e[t]/255;return r}function b$(e,r){let t={source:{image:r}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture={...e.pbrMetallicRoughness.baseColorTexture,texture:t}:e.emissiveTexture?e.emissiveTexture={...e.emissiveTexture,texture:t}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture={...e.pbrMetallicRoughness.metallicRoughnessTexture,texture:t}:e.normalTexture?e.normalTexture={...e.normalTexture,texture:t}:e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture,texture:t})}function y$(e){let{id:r,faceRange:t}=e;if(!r||!t)return;let i=r.value,a=t.value,n=a[a.length-1]+1,o=new Uint32Array(n*3),s=0,u=0;for(let l=1;l<a.length;l+=2){let f=Number(i[s]),h=a[l],d=a[l-1],m=h-d+1,y=u+m*3;o.fill(f,u,y),s++,u=y}e.id.value=o}function x$(e,r){let t=e.id.value,i=new Float32Array(t.length);for(let a=0;a<t.length;a++)i[a]=r[t[a]];e.id.value=i}function w$(e){var r,t;return(t=(r=e==null?void 0:e.metadata)==null?void 0:r["i3s-feature-ids"])==null?void 0:t.intArray}var _$="4.2.0-alpha.4",RA={name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:_$,mimeTypes:["application/octet-stream"],parse:k$,extensions:["bin"],options:{"i3s-content":{}}};async function k$(e,r,t){let{tile:i,_tileOptions:a,tileset:n,_tilesetOptions:o}=(r==null?void 0:r.i3s)||{},s=a||i,u=o||n;return!s||!u?null:await PA(e,s,u,r,t)}rv(RA);
|
|
100
|
+
}`}function Mc(e,r=!0,t){let i=t||new Set;if(e){if(z5(e))i.add(e);else if(z5(e.buffer))i.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(r&&typeof e=="object")for(let a in e)Mc(e[a],r,i)}}return t===void 0?Array.from(i):[]}function z5(e){return e?e instanceof ArrayBuffer||typeof MessagePort<"u"&&e instanceof MessagePort||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas:!1}var Kg=()=>{},Eo=class{constructor(r){this.terminated=!1;this._loadableURL="";let{name:t,source:i,url:a}=r;ma(i||a),this.name=t,this.source=i,this.url=a,this.onMessage=Kg,this.onError=n=>console.log(n),this.worker=oa?this._createBrowserWorker():this._createNodeWorker()}static isSupported(){return typeof Worker<"u"&&oa||typeof qc<"u"&&!oa}destroy(){this.onMessage=Kg,this.onError=Kg,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(r,t){t=t||Mc(r),this.worker.postMessage(r,t)}_getErrorFromErrorEvent(r){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,r.message&&(t+=`${r.message} in `),r.lineno&&(t+=`:${r.lineno}:${r.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=q5({source:this.source,url:this.url});let r=new Worker(this._loadableURL,{name:this.name});return r.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},r.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},r.onmessageerror=t=>console.error(t),r}_createNodeWorker(){let r;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;r=new qc(i,{eval:!1})}else if(this.source)r=new qc(this.source,{eval:!0});else throw new Error("no worker");return r.on("message",t=>{this.onMessage(t)}),r.on("error",t=>{this.onError(t)}),r.on("exit",t=>{}),r}};var zc=class{constructor(r){this.name="unnamed";this.maxConcurrency=1;this.maxMobileConcurrency=1;this.onDebug=()=>{};this.reuseWorkers=!0;this.props={};this.jobQueue=[];this.idleQueue=[];this.count=0;this.isDestroyed=!1;this.source=r.source,this.url=r.url,this.setProps(r)}static isSupported(){return Eo.isSupported()}destroy(){this.idleQueue.forEach(r=>r.destroy()),this.isDestroyed=!0}setProps(r){this.props={...this.props,...r},r.name!==void 0&&(this.name=r.name),r.maxConcurrency!==void 0&&(this.maxConcurrency=r.maxConcurrency),r.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=r.maxMobileConcurrency),r.reuseWorkers!==void 0&&(this.reuseWorkers=r.reuseWorkers),r.onDebug!==void 0&&(this.onDebug=r.onDebug)}async startJob(r,t=(a,n,o)=>a.done(o),i=(a,n)=>a.error(n)){let a=new Promise(n=>(this.jobQueue.push({name:r,onMessage:t,onError:i,onStart:n}),this));return this._startQueuedJob(),await a}async _startQueuedJob(){if(!this.jobQueue.length)return;let r=this._getAvailableWorker();if(!r)return;let t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:r,backlog:this.jobQueue.length});let i=new Dc(t.name,r);r.onMessage=a=>t.onMessage(i,a.type,a.payload),r.onError=a=>t.onError(i,a),t.onStart(i);try{await i.result}catch(a){console.error(`Worker exception: ${a}`)}finally{this.returnWorkerToQueue(r)}}}returnWorkerToQueue(r){!oa||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(r.destroy(),this.count--):this.idleQueue.push(r),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let r=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Eo({name:r,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return L5?this.maxMobileConcurrency:this.maxConcurrency}};var FU={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},Qa=class{constructor(r){this.workerPools=new Map;this.props={...FU},this.setProps(r),this.workerPools=new Map}static isSupported(){return Eo.isSupported()}static getWorkerFarm(r={}){return Qa._workerFarm=Qa._workerFarm||new Qa({}),Qa._workerFarm.setProps(r),Qa._workerFarm}destroy(){for(let r of this.workerPools.values())r.destroy();this.workerPools=new Map}setProps(r){this.props={...this.props,...r};for(let t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(r){let{name:t,source:i,url:a}=r,n=this.workerPools.get(t);return n||(n=new zc({name:t,source:i,url:a}),n.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,n)),n}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};async function es(){return Vg}var Yg=new Map,Za=class{static async inWorkerThread(){return typeof self<"u"||Boolean(await es())}static set onmessage(r){async function t(i){let a=await es(),{type:n,payload:o}=a?i:i.data;r(n,o)}es().then(i=>{i?(i.on("message",t),i.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=t})}static async addEventListener(r){let t=Yg.get(r);t||(t=async a=>{if(!DU(a))return;let n=await es(),{type:o,payload:s}=n?a:a.data;r(o,s)}),await es()?console.error("not implemented"):globalThis.addEventListener("message",t)}static async removeEventListener(r){let t=Yg.get(r);Yg.delete(r),await es()?console.error("not implemented"):globalThis.removeEventListener("message",t)}static async postMessage(r,t){let i={source:"loaders.gl",type:r,payload:t},a=Mc(t),n=await es();n?n.postMessage(i,a):globalThis.postMessage(i,a)}};function DU(e){let{type:r,data:t}=e;return r==="message"&&t&&typeof t.source=="string"&&t.source.startsWith("loaders.gl")}function Xg(e,r={}){let t=r[e.id]||{},i=oa?`${e.id}-worker.js`:`${e.id}-worker-node.js`,a=t.workerUrl;if(!a&&e.id==="compression"&&(a=r.workerUrl),r._workerType==="test"&&(oa?a=`modules/${e.module}/dist/${i}`:a=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!a){let n=e.version;n==="latest"&&(n=F5);let o=n?`@${n}`:"";a=`https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${i}`}return ma(a),a}function Qg(e,r=Bc){ma(e,"no worker provided");let t=e.version;return!(!r||!t)}var Jg={};Au(Jg,{readFileAsArrayBuffer:()=>_p,readFileAsText:()=>kp,requireFromFile:()=>Sp,requireFromString:()=>cu});var Zg=Pt(require("module"),1),N5=Pt(require("path"),1),Nc=Pt(require("fs"),1);async function _p(e){return e.startsWith("http")?await(await fetch(e)).arrayBuffer():Nc.readFileSync(e).buffer}async function kp(e){return e.startsWith("http")?await(await fetch(e)).text():Nc.readFileSync(e,"utf8")}async function Sp(e){if(e.startsWith("http")){let i=await(await fetch(e)).text();return cu(i)}e.startsWith("/")||(e=`${process.cwd()}/${e}`);let r=await Nc.promises.readFile(e,"utf8");return cu(r)}function cu(e,r="",t){if(typeof r=="object"&&(t=r,r=""),typeof e!="string")throw new Error(`code must be a string, not ${typeof e}`);let i=Zg.default._nodeModulePaths(N5.dirname(r)),a=typeof module<"u"&&(module==null?void 0:module.parent),n=new Zg.default(r,a);return n.filename=r,n.paths=[].concat((t==null?void 0:t.prependPaths)||[]).concat(i).concat((t==null?void 0:t.appendPaths)||[]),n._compile(e,r),a&&a.children&&a.children.splice(a.children.indexOf(n),1),n.exports}var ev={};async function gn(e,r=null,t={},i=null){return r&&(e=U5(e,r,t,i)),ev[e]=ev[e]||LU(e),await ev[e]}function U5(e,r,t={},i=null){if(!t.useLocalLibraries&&e.startsWith("http"))return e;i=i||e;let a=t.modules||{};return a[i]?a[i]:oa?t.CDN?(ma(t.CDN.startsWith("http")),`${t.CDN}/${r}@${Bc}/dist/libs/${i}`):Fc?`../src/libs/${i}`:`modules/${r}/src/libs/${i}`:`modules/${r}/dist/libs/${i}`}async function LU(e){if(e.endsWith("wasm"))return await MU(e);if(!oa)try{return Jg&&Sp&&await Sp(e)}catch(t){return console.error(t),null}if(Fc)return importScripts(e);let r=await zU(e);return qU(r,e)}function qU(e,r){if(!oa)return cu&&cu(e,r);if(Fc)return eval.call(globalThis,e),null;let t=document.createElement("script");t.id=r;try{t.appendChild(document.createTextNode(e))}catch{t.text=e}return document.body.appendChild(t),null}async function MU(e){return oa||!_p||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await _p(e)}async function zU(e){return oa||!kp||e.startsWith("http")?await(await fetch(e)).text():await kp(e)}var NU=0;async function rv(e){await Za.inWorkerThread()&&(Za.onmessage=async(r,t)=>{switch(r){case"process":try{let{input:i,options:a={},context:n={}}=t,o=await HU({loader:e,arrayBuffer:i,options:a,context:{...n,_parse:UU}});Za.postMessage("done",{result:o})}catch(i){let a=i instanceof Error?i.message:"";Za.postMessage("error",{error:a})}break;default:}})}function UU(e,r,t,i){return new Promise((a,n)=>{let o=NU++,s=(l,f)=>{if(f.id===o)switch(l){case"done":Za.removeEventListener(s),a(f.result);break;case"error":Za.removeEventListener(s),n(f.error);break;default:}};Za.addEventListener(s);let u={id:o,input:e,options:t};Za.postMessage("process",u)})}async function HU({loader:e,arrayBuffer:r,options:t,context:i}){let a,n;if(e.parseSync||e.parse)a=r,n=e.parseSync||e.parse;else if(e.parseTextSync)a=new TextDecoder().decode(r),n=e.parseTextSync;else throw new Error(`Could not load data with ${e.name} loader`);return t={...t,modules:e&&e.options&&e.options.modules||{},worker:!1},await n(a,{...t},i,e)}function tv(e,r){return!Qa.isSupported()||!oa&&!(r!=null&&r._nodeWorkers)?!1:e.worker&&(r==null?void 0:r.worker)}async function av(e,r,t,i,a){let n=e.id,o=Xg(e,t),u=Qa.getWorkerFarm(t).getWorkerPool({name:n,url:o});t=JSON.parse(JSON.stringify(t)),i=JSON.parse(JSON.stringify(i||{}));let l=await u.startJob("process-on-worker",GU.bind(null,a));return l.postMessage("process",{input:r,options:t,context:i}),await(await l.result).result}async function GU(e,r,t,i){switch(t){case"done":r.done(i);break;case"error":r.error(new Error(i.error));break;case"process":let{id:a,input:n,options:o}=i;try{let s=await e(n,o);r.postMessage("done",{id:a,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";r.postMessage("error",{id:a,error:u})}break;default:console.warn(`parse-with-worker unknown message ${t}`)}}function iv(e,r,t){if(t=t||e.byteLength,e.byteLength<t||r.byteLength<t)return!1;let i=new Uint8Array(e),a=new Uint8Array(r);for(let n=0;n<i.length;++n)if(i[n]!==a[n])return!1;return!0}function nv(...e){return H5(e)}function H5(e){let r=e.map(n=>n instanceof ArrayBuffer?new Uint8Array(n):n),t=r.reduce((n,o)=>n+o.byteLength,0),i=new Uint8Array(t),a=0;for(let n of r)i.set(n,a),a+=n.byteLength;return i.buffer}async function Uc(e){let r=[];for await(let t of e)r.push(t);return nv(...r)}function jo(e){return jo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},jo(e)}function ov(e,r){if(jo(e)!=="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var i=t.call(e,r||"default");if(jo(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function sv(e){var r=ov(e,"string");return jo(r)==="symbol"?r:String(r)}function ht(e,r,t){return r=sv(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var WU="",G5={};function rs(e){for(let r in G5)if(e.startsWith(r)){let t=G5[r];e=e.replace(r,t)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${WU}${e}`),e}function W5(e){return Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer:e}function V5(e){return e&&typeof e=="object"&&e.isBuffer}function Ep(e){if(V5(e))return W5(e);if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e=="string"){let r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}var ts={};Au(ts,{dirname:()=>KU,filename:()=>$U,join:()=>YU,resolve:()=>XU});function $5(){var r;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(r=window.location)==null?void 0:r.pathname;return(e==null?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function $U(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(r+1):""}function KU(e){let r=e?e.lastIndexOf("/"):-1;return r>=0?e.substr(0,r):""}function YU(...e){let r="/";return e=e.map((t,i)=>(i&&(t=t.replace(new RegExp(`^${r}`),"")),i!==e.length-1&&(t=t.replace(new RegExp(`${r}$`),"")),t)),e.join(r)}function XU(...e){let r=[];for(let n=0;n<e.length;n++)r[n]=e[n];let t="",i=!1,a;for(let n=r.length-1;n>=-1&&!i;n--){let o;n>=0?o=r[n]:(a===void 0&&(a=$5()),o=a),o.length!==0&&(t=`${o}/${t}`,i=o.charCodeAt(0)===Hc)}return t=QU(t,!i),i?`/${t}`:t.length>0?t:"."}var Hc=47,uv=46;function QU(e,r){let t="",i=-1,a=0,n,o=!1;for(let s=0;s<=e.length;++s){if(s<e.length)n=e.charCodeAt(s);else{if(n===Hc)break;n=Hc}if(n===Hc){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(t.length<2||!o||t.charCodeAt(t.length-1)!==uv||t.charCodeAt(t.length-2)!==uv){if(t.length>2){let u=t.length-1,l=u;for(;l>=0&&t.charCodeAt(l)!==Hc;--l);if(l!==u){t=l===-1?"":t.slice(0,l),i=s,a=0,o=!1;continue}}else if(t.length===2||t.length===1){t="",i=s,a=0,o=!1;continue}}r&&(t.length>0?t+="/..":t="..",o=!0)}else{let u=e.slice(i+1,s);t.length>0?t+=`/${u}`:t=u,o=!1}i=s,a=0}else n===uv&&a!==-1?++a:a=-1}return t}var Mn=Pt(require("fs"),1),as=class{constructor(r,t,i){r=rs(r),this.handle=Mn.default.openSync(r,t,i);let a=Mn.default.fstatSync(this.handle,{bigint:!0});this.size=Number(a.size),this.bigsize=a.size,this.url=r}async close(){return new Promise((r,t)=>{Mn.default.close(this.handle,i=>i?t(i):r())})}async truncate(r){return new Promise((t,i)=>{Mn.default.ftruncate(this.handle,r,a=>{a?i(a):(this.bigsize=BigInt(r),this.size=Number(this.bigsize),t())})})}async append(r){return new Promise((t,i)=>{Mn.default.appendFile(this.handle,r,a=>{a?i(a):(this.bigsize=this.bigsize+BigInt(r.length),this.size=Number(this.bigsize),t())})})}async stat(){return await new Promise((r,t)=>Mn.default.fstat(this.handle,{bigint:!0},(i,a)=>{let n={size:Number(a.size),bigsize:a.size,isDirectory:a.isDirectory()};i?t(i):r(n)}))}async read(r,t){let i=new ArrayBuffer(t),a=BigInt(r),n=0,o=new Uint8Array(i),s;for(;t>0;){let u=await ZU(this.handle,o,0,t,a);if(u===0)break;n+=u,a+=BigInt(u),t-=u,s!==void 0&&(s+=u)}return n<t?i.slice(0,n):i}async write(r,t=0,i=r.byteLength){return new Promise((a,n)=>{let o=Number(t),s=new Uint8Array(r,Number(t),i);Mn.default.write(this.handle,s,0,i,o,(u,l)=>u?n(u):a(l))})}};async function ZU(e,r,t,i,a){return await new Promise((n,o)=>Mn.default.read(e,r,t,i,a,(s,u)=>s?o(s):n(u)))}var Pp=Pt(require("fs/promises"),1);var lv=Pt(require("fs"),1),cv=require("stream");var jp=Pt(require("zlib"),1),JU=e=>e&&e instanceof ArrayBuffer,eH=e=>e&&e instanceof Buffer;function Ap(e,r){switch(r==null?void 0:r.get("content-encoding")){case"br":return e.pipe(jp.default.createBrotliDecompress());case"gzip":return e.pipe(jp.default.createGunzip());case"deflate":return e.pipe(jp.default.createDeflate());default:return e}}async function K5(e){let r=[];return await new Promise((t,i)=>{e.on("error",a=>i(a)),e.on("readable",()=>e.read()),e.on("data",a=>{typeof a=="string"&&i(new Error("Read stream not binary")),r.push(tH(a))}),e.on("end",()=>{let a=rH(r);t(a)})})}function rH(e){let r=e.map(n=>n instanceof ArrayBuffer?new Uint8Array(n):n),t=r.reduce((n,o)=>n+o.byteLength,0),i=new Uint8Array(t),a=0;for(let n of r)i.set(n,a),a+=n.byteLength;return i.buffer}function tH(e){if(JU(e))return e;if(eH(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;if(typeof e=="string"){let r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}var aH=e=>typeof e=="boolean",Y5=e=>typeof e=="function",iH=e=>e!==null&&typeof e=="object",nH=e=>iH(e)&&Y5(e.read)&&Y5(e.pipe)&&aH(e.readable);async function Tp(e,r){let t=/^file:\/\//;e.replace(t,"/");let i=e.split("?")[0];i=rs(i);let a=new Headers;e.endsWith(".gz")&&(a["content-encoding"]="gzip"),e.endsWith(".br")&&(a["content-encoding"]="br");try{let n=await new Promise((h,d)=>{let m=lv.default.createReadStream(i,{encoding:null});m.once("readable",()=>h(m)),m.on("error",y=>d(y))}),o=n;nH(n)?o=Ap(n,a):typeof n=="string"?o=cv.Readable.from([new TextEncoder().encode(n)]):o=cv.Readable.from([n||new ArrayBuffer(0)]);let s=200,u="OK",l=oH(i),f=new Response(o,{headers:l,status:s,statusText:u});return Object.defineProperty(f,"url",{value:e}),f}catch(n){let o=n.message,s=400,u=o,l={},f=new Response(o,{headers:l,status:s,statusText:u});return Object.defineProperty(f,"url",{value:e}),f}}function oH(e){let r={};if(!r["content-length"]){let t=lv.default.statSync(e);r["content-length"]=t.size}return e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip"),new Headers(r)}var Rp=class{constructor(){this.readable=!0;this.writable=!0}async readdir(r=".",t){return await Pp.default.readdir(r,t)}async stat(r){let t=await Pp.default.stat(r,{bigint:!0});return{size:Number(t.size),bigsize:t.size,isDirectory:t.isDirectory()}}async unlink(r){return await Pp.default.unlink(r)}async fetch(r,t){return await Tp(r,t)}async openReadableFile(r,t="r"){return new as(r,t)}async openWritableFile(r,t="w",i){return new as(r,t,i)}};var Gc=class{constructor(r={}){this.hashBatches=this.hashBatches.bind(this)}async preload(){}async*hashBatches(r,t="base64"){var o,s;let i=[];for await(let u of r)i.push(u),yield u;let a=await this.concatenate(i),n=await this.hash(a,t);(s=(o=this.options.crypto)==null?void 0:o.onEnd)==null||s.call(o,{hash:n})}async concatenate(r){return await Uc(r)}};var Wc=Pt(require("crypto"),1),Cp=class extends Gc{constructor(t){var i,a;super();this.name="crypto-node";if(this.options=t,!((a=(i=this.options)==null?void 0:i.crypto)!=null&&a.algorithm))throw new Error(this.name)}async hash(t,i){var n,o,s,u;let a=(s=(o=(n=this.options)==null?void 0:n.crypto)==null?void 0:o.algorithm)==null?void 0:s.toLowerCase();try{if(!Wc.createHash)throw new Error("crypto.createHash not available");let l=(u=Wc.createHash)==null?void 0:u(a),f=new Uint8Array(t);return l.update(f).digest("base64")}catch(l){throw Error(`${a} hash not available. ${l}`)}}async*hashBatches(t,i="base64"){var o,s,u,l,f,h,d;if(!Wc.createHash)throw new Error("crypto.createHash not available");let a=(l=Wc.createHash)==null?void 0:l((u=(s=(o=this.options)==null?void 0:o.crypto)==null?void 0:s.algorithm)==null?void 0:u.toLowerCase());for await(let m of t){let y=new Uint8Array(m);a.update(y),yield m}let n=a.digest(i);(d=(h=(f=this.options)==null?void 0:f.crypto)==null?void 0:h.onEnd)==null||d.call(h,{hash:n})}};var l4=require("node:process");var X5=Pt(require("stream"),1),fv=class{},sH=X5.Readable||fv;function dv(e,r){let t=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]();return new pv(t,r)}var pv=class extends sH{constructor(t,i){super(i);this._iterator=t,this._pulling=!1,this._bytesMode=!i||!i.objectMode}async _read(t){this._pulling||(this._pulling=!0,this._pulling=await this._pull(t,this._iterator))}async _destroy(t,i){var a,n,o,s;this._iterator&&(t?await((n=(a=this._iterator)==null?void 0:a.throw)==null?void 0:n.call(a,t)):await((s=(o=this._iterator)==null?void 0:o.return)==null?void 0:s.call(o,t)),i==null||i(null))}async _pull(t,i){var o;let a=this._bytesMode,n=null;for(;this.readable&&!(n=await i.next()).done&&(t!==null&&(t-=a&&ArrayBuffer.isView(n.value)?n.value.byteLength:1),!(!this.push(new Uint8Array(n.value))||t<=0)););return(n!=null&&n.done||!this.readable)&&(this.push(null)||!0)&&((o=i==null?void 0:i.return)==null||o.call(i)),!this.readable}};var J5=Pt(Z5(),1);delete globalThis.ReadableStream;var Ip=class extends J5.ReadableStream{};var Bp=class{constructor(r){this.isWorking=!1;this.isCancelled=!1;this.chunks=r}start(r){this.work(r)}async work(r){let{chunks:t}=this;for(this.isWorking=!0;!this.isCancelled&&(r.desiredSize||0)>0;){let i;try{i=t.next()}catch(a){r.error(a);break}i&&(!i.done&&!this.isCancelled?r.enqueue(i.value):r.close())}this.isWorking=!1}pull(r){this.isWorking||this.work(r)}cancel(){this.isCancelled=!0}};var Fp=class extends Ip{constructor(t){super(new Bp(t.values()),{type:"bytes"});this._chunks=t}async*[Symbol.asyncIterator](t){let i=this.getReader();yield*this._chunks,i.releaseLock()}};var is=class{constructor(r=[],t={}){this.parts=[],this.size=0;for(let i of r)if(typeof i=="string"){let a=new TextEncoder().encode(i);this.parts.push(a),this.size+=a.byteLength}else if(i instanceof is)this.size+=i.size,this.parts.push(...i.parts);else if(i instanceof ArrayBuffer)this.parts.push(new Uint8Array(i)),this.size+=i.byteLength;else if(i instanceof Uint8Array)this.parts.push(i),this.size+=i.byteLength;else if(ArrayBuffer.isView(i)){let{buffer:a,byteOffset:n,byteLength:o}=i;this.parts.push(new Uint8Array(a,n,o)),this.size+=o}else{let a=new TextEncoder().encode(String(i));this.parts.push(a),this.size+=a.byteLength}this.type=uH(t.type)}slice(r=0,t=this.size,i=""){let{size:a,parts:n}=this,o=r<0?Math.max(a+r,0):Math.min(r,a),s=t<0?Math.max(a+t,0):Math.min(t,a),u=Math.max(s-o,0),l=new is([],{type:i});if(u===0)return l;let f=0,h=[];for(let d of n){let{byteLength:m}=d;if(o>0&&m<=o)o-=m,s-=m;else{let y=d.subarray(o,Math.min(m,s));if(h.push(y),f+=y.byteLength,o=0,f>=u)break}}return l.parts=h,l.size=f,l}async arrayBuffer(){return this._toArrayBuffer()}async text(){let r=new TextDecoder,t="";for(let i of this.parts)t+=r.decode(i);return t}stream(){return new Fp(this.parts)}toString(){return"[object Blob]"}get[Symbol.toStringTag](){return"Blob"}_toArrayBuffer(){let r=new ArrayBuffer(this.size),t=new Uint8Array(r),i=0;for(let a of this.parts)t.set(a,i),i+=a.byteLength;return r}};function uH(e=""){let r=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(r)?"":r}function cH(){return typeof Blob>"u"&&!globalThis.Blob&&(globalThis.Blob=is),globalThis.Blob}var lH=cH();var Dp=class{constructor(){this.onload=null}abort(){}async readAsArrayBuffer(r){let t=await r.arrayBuffer();this.onload&&this.onload({target:{result:t}})}async readAsBinaryString(r){throw Error("Not implemented")}async readAsDataURL(r){let t=await r.text(),i=`data://;base64,${Ru(t)}`;this.onload&&this.onload({target:{result:i}})}async readAsText(r){let t=await r.text();this.onload&&this.onload({target:{result:t}})}};var Lp=class extends globalThis.Blob{constructor(t,i,a={}){super(t,a);this.name="";this.webkitRelativePath="";this.name=String(i).replace(/\//g,":"),this.lastModified=(a==null?void 0:a.lastModified)||Date.now()}get[Symbol.toStringTag](){return"File"}};function e4(){return typeof FileReader>"u"&&!globalThis.FileReader&&(globalThis.FileReader=Dp),typeof File>"u"&&!globalThis.File&&(globalThis.File=Lp),global}var fH=e4();var hv=Pt(require("module"),1),r4=Pt(require("path"),1),Mp=Pt(require("fs"),1);async function t4(e){return e.startsWith("http")?await(await fetch(e)).arrayBuffer():Mp.default.readFileSync(e).buffer}async function a4(e){return e.startsWith("http")?await(await fetch(e)).text():Mp.default.readFileSync(e,"utf8")}async function i4(e){if(e.startsWith("http")){let i=await(await fetch(e)).text();return qp(i)}e.startsWith("/")||(e=`${process.cwd()}/${e}`);let r=await Mp.default.readFileSync(e,"utf8");return qp(r)}function qp(e,r="",t){if(typeof r=="object"&&(t=r,r=""),r=r.replace("file://",""),typeof e!="string")throw new Error(`code must be a string, not ${typeof e}`);let i=hv.default._nodeModulePaths(r4.default.dirname(r)),a=typeof module<"u"&&(module==null?void 0:module.parent),n=new hv.default(r,a);return n.filename=r,n.paths=[].concat((t==null?void 0:t.prependPaths)||[]).concat(i).concat((t==null?void 0:t.appendPaths)||[]),n._compile(e,r),a&&a.children&&a.children.splice(a.children.indexOf(n),1),n.exports}var Ni=class{constructor(r){this.map={},r instanceof Ni?r.forEach((t,i)=>this.append(i,t)):Array.isArray(r)?r.forEach(t=>this.append(t[0],t[1])):r&&Object.getOwnPropertyNames(r).forEach(t=>this.append(t,r[t]))}append(r,t){r=Vc(r),t=n4(t);let i=this.map[r];this.map[r]=i?`${i}, ${t}`:t}delete(r){delete this.map[Vc(r)]}get(r){return r=Vc(r),this.has(r)?this.map[r]:null}has(r){return this.map.hasOwnProperty(Vc(r))}set(r,t){this.map[Vc(r)]=n4(t)}forEach(r,t=null){for(let i in this.map)this.map.hasOwnProperty(i)&&(t?r.call(t,this.map[i],i,this):r(this.map[i],i,this))}keys(){let r=[];return this.forEach(function(t,i){r.push(i)}),mv(r)}values(){let r=[];return this.forEach(function(t){r.push(t)}),mv(r)}entries(){let r=[];return this.forEach(function(t,i){r.push([i,t])}),mv(r)}*[Symbol.iterator](){yield*this.entries()}};function Vc(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e)||e==="")throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function n4(e){return typeof e!="string"&&(e=String(e)),e}function mv(e){let r={next(){let t=e.shift();return{done:t===void 0,value:t}}};return r[Symbol.iterator]=function(){return r},r}function gv(e,r){if(!e)throw new Error(`@loaders.gl/polyfills assertion ${r}`)}var bv=Pt(require("stream"),1),pH=e=>typeof e=="boolean",o4=e=>typeof e=="function",dH=e=>e!==null&&typeof e=="object",vv=e=>dH(e)&&o4(e.read)&&o4(e.pipe)&&pH(e.readable),zn=class{constructor(r,t){this.bodyUsed=!1;let{headers:i,status:a=200,statusText:n="OK",url:o}=t||{};this.url=o,this.ok=a===200,this.status=a,this.statusText=n,this.headers=new Ni((t==null?void 0:t.headers)||{}),vv(r)?this._body=Ap(r,i):typeof r=="string"?this._body=bv.Readable.from([new TextEncoder().encode(r)]):this._body=bv.Readable.from([r||new ArrayBuffer(0)])}get body(){return gv(!this.bodyUsed),gv(vv(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){return vv(this._body)?await K5(this._body):this._body||new ArrayBuffer(0)}async text(){let r=await this.arrayBuffer();return new TextDecoder().decode(r)}async json(){let r=await this.text();return JSON.parse(r)}async blob(){if(typeof Blob>"u")throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}};var u4=Pt(require("http"),1),c4=Pt(require("https"),1);var hH=e=>e&&e instanceof ArrayBuffer,mH=e=>e&&e instanceof Buffer;function s4(e){let r=e.indexOf(","),t,i;return e.slice(r-7,r)===";base64"?(t=Buffer.from(e.slice(r+1),"base64"),i=e.slice(5,r-7).trim()):(t=Buffer.from(decodeURIComponent(e.slice(r+1))),i=e.slice(5,r).trim()),i?i.startsWith(";")&&(i=`text/plain${i}`):i="text/plain;charset=US-ASCII",{arrayBuffer:gH(t),mimeType:i}}function gH(e){if(hH(e))return e;if(mH(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;if(typeof e=="string"){let r=e;return new TextEncoder().encode(r).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}var yv=e=>e.startsWith("data:"),vH=e=>e.startsWith("http:")||e.startsWith("https:");async function $c(e,r){try{if(globalThis.fetch!==$c&&(vH(e)||yv(e)))return await fetch(e,r);if(yv(e)){let{arrayBuffer:l,mimeType:f}=s4(e);return new zn(l,{headers:{"content-type":f},url:e})}let t={},i=e;e.endsWith(".gz")&&(e=e.slice(0,-3),t["content-encoding"]="gzip");let a=await bH(i,r),n=_H(e,a,t),{status:o,statusText:s}=wH(a),u=!r||r.followRedirect||r.followRedirect===void 0;if(o>=300&&o<400&&n.has("location")&&u){let l=yH(e,n.get("location"));return await $c(l,r)}return new zn(a,{headers:n,status:o,statusText:s,url:e})}catch(t){return new zn(null,{status:400,statusText:String(t),url:e})}}async function bH(e,r){return await new Promise((t,i)=>{let a=xH(e,r),n=e.startsWith("https:")?c4.default.request(a,o=>t(o)):u4.default.request(a,o=>t(o));n.on("error",o=>i(o)),n.end()})}function yH(e,r){if(r.startsWith("http"))return r;let t=new URL(e);return t.pathname=r,t.href}function xH(e,r){let t=(r==null?void 0:r.headers)||{},i={};for(let n of Object.keys(t))i[n.toLowerCase()]=t[n];i["accept-encoding"]=i["accept-encoding"]||"gzip,br,deflate";let a=new URL(e);return{hostname:a.hostname,path:a.pathname,method:"GET",...r,...r==null?void 0:r.fetch,headers:i,port:a.port}}function wH(e){return e.statusCode?{status:e.statusCode,statusText:e.statusMessage||"NA"}:{status:200,statusText:"OK"}}function _H(e,r,t={}){let i={};if(r&&r.headers){let a=r.headers;for(let n in a){let o=a[n];i[n.toLowerCase()]=String(o)}}if(!i["content-length"]){let a=kH(e);Number.isFinite(a)&&(i["content-length"]=a)}return Object.assign(i,t),new Ni(i)}function kH(e){return yv(e)?e.length-5:null}var SH=parseInt(l4.versions.node.split(".")[0]);K1&&console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");globalThis.loaders=globalThis.loaders||{};globalThis.loaders.makeNodeStream=dv;globalThis.loaders.NodeFile=as;globalThis.loaders.NodeFileSystem=Rp;globalThis.loaders.fetchNode=Tp;globalThis.loaders.NodeHash=Cp;globalThis.TextEncoder||(globalThis.TextEncoder=Pu);globalThis.TextDecoder||(globalThis.TextDecoder=Bo);!("atob"in globalThis)&&Ru&&(globalThis.atob=Ru);!("btoa"in globalThis)&&Nd&&(globalThis.btoa=Nd);globalThis.loaders.encodeImageNode=Jx;globalThis.loaders.parseImageNode=Hg;globalThis.loaders.imageFormatsNode=Ug;globalThis._parseImageNode=Hg;globalThis._imageFormatsNode=Ug;globalThis.loaders.readFileAsArrayBuffer=t4;globalThis.loaders.readFileAsText=a4;globalThis.loaders.requireFromFile=i4;globalThis.loaders.requireFromString=qp;SH<18&&(!("Headers"in globalThis)&&Ni&&(globalThis.Headers=Ni),!("Response"in globalThis)&&zn&&(globalThis.Response=zn),!("fetch"in globalThis)&&$c&&(globalThis.fetch=$c));var EH=e=>typeof e=="boolean",Kc=e=>typeof e=="function",ns=e=>e!==null&&typeof e=="object",xv=e=>ns(e)&&e.constructor==={}.constructor;var f4=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",p4=e=>e&&typeof e[Symbol.asyncIterator]=="function";var di=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var hi=e=>typeof Blob<"u"&&e instanceof Blob,d4=e=>e&&typeof e=="object"&&e.isBuffer;var jH=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||ns(e)&&Kc(e.tee)&&Kc(e.cancel)&&Kc(e.getReader);var AH=e=>ns(e)&&Kc(e.read)&&Kc(e.pipe)&&EH(e.readable),zp=e=>jH(e)||AH(e);var TH=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,PH=/^([-\w.]+\/[-\w.+]+)/;function h4(e){let r=PH.exec(e);return r?r[1]:e}function wv(e){let r=TH.exec(e);return r?r[1]:""}var m4=/\?.*/;function g4(e){let r=e.match(m4);return r&&r[0]}function lu(e){return e.replace(m4,"")}function os(e){return di(e)?e.url:hi(e)?e.name||"":typeof e=="string"?e:""}function Yc(e){if(di(e)){let r=e,t=r.headers.get("content-type")||"",i=lu(r.url);return h4(t)||wv(i)}return hi(e)?e.type||"":typeof e=="string"?wv(e):""}function v4(e){return di(e)?e.headers["content-length"]||-1:hi(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function Np(e){if(di(e))return e;let r={},t=v4(e);t>=0&&(r["content-length"]=String(t));let i=os(e),a=Yc(e);a&&(r["content-type"]=a);let n=await CH(e);n&&(r["x-first-bytes"]=n),typeof e=="string"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:r});return Object.defineProperty(o,"url",{value:i}),o}async function b4(e){if(!e.ok){let r=await RH(e);throw new Error(r)}}async function RH(e){let r=`Failed to fetch resource ${e.url} (${e.status}): `;try{let t=e.headers.get("Content-Type"),i=e.statusText;t!=null&&t.includes("application/json")&&(i+=` ${await e.text()}`),r+=i,r=r.length>60?`${r.slice(0,60)}...`:r}catch{}return r}async function CH(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let t=e.slice(0,5);return await new Promise(i=>{let a=new FileReader;a.onload=n=>{var o;return i((o=n==null?void 0:n.target)==null?void 0:o.result)},a.readAsDataURL(t)})}if(e instanceof ArrayBuffer){let t=e.slice(0,5);return`data:base64,${OH(t)}`}return null}function OH(e){let r="",t=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)r+=String.fromCharCode(t[i]);return btoa(r)}function IH(e){return!BH(e)&&!FH(e)}function BH(e){return e.startsWith("http:")||e.startsWith("https:")}function FH(e){return e.startsWith("data:")}async function _v(e,r){var t,i;if(typeof e=="string"){let a=rs(e);return IH(a)&&(t=globalThis.loaders)!=null&&t.fetchNode?(i=globalThis.loaders)==null?void 0:i.fetchNode(a,r):await fetch(a,r)}return await Np(e)}function kv(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let r=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,t=e||r;return!!(t&&t.indexOf("Electron")>=0)}function Ui(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||kv()}var DH=globalThis.self||globalThis.window||globalThis.global,fu=globalThis.window||globalThis.self||globalThis.global,LH=globalThis.document||{},ss=globalThis.process||{},qH=globalThis.console,Ote=globalThis.navigator||{};var Up="4.2.0-alpha.4",Fte=Ui();function MH(e){try{let r=window[e],t="__storage_test__";return r.setItem(t,t),r.removeItem(t),r}catch{return null}}var Hp=class{constructor(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";ht(this,"storage",void 0),ht(this,"id",void 0),ht(this,"config",void 0),this.storage=MH(i),this.id=r,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(r){if(Object.assign(this.config,r),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let r={};if(this.storage){let t=this.storage.getItem(this.id);r=t?JSON.parse(t):{}}return Object.assign(this.config,r),this}};function y4(e){let r;return e<10?r="".concat(e.toFixed(2),"ms"):e<100?r="".concat(e.toFixed(1),"ms"):e<1e3?r="".concat(e.toFixed(0),"ms"):r="".concat((e/1e3).toFixed(2),"s"),r}function x4(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,t=Math.max(r-e.length,0);return"".concat(" ".repeat(t)).concat(e)}function Gp(e,r,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,a=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(t=Math.min(t,i/e.width));let n=e.width*t,o=e.height*t,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(n/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(a,");"),"background-size:".concat(n,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(r," %c+"),s]}var Wp;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Wp||(Wp={}));var zH=10;function w4(e){return typeof e!="string"?e:(e=e.toUpperCase(),Wp[e]||Wp.WHITE)}function _4(e,r,t){if(!Ui&&typeof e=="string"){if(r){let i=w4(r);e="\x1B[".concat(i,"m").concat(e,"\x1B[39m")}if(t){let i=w4(t);e="\x1B[".concat(i+zH,"m").concat(e,"\x1B[49m")}}return e}function k4(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],t=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(t),a=e;for(let n of i){let o=a[n];typeof o=="function"&&(r.find(s=>n===s)||(a[n]=o.bind(e)))}}function pu(e,r){if(!e)throw new Error(r||"Assertion failed")}function us(){let e;if(Ui()&&fu.performance){var r,t;e=fu===null||fu===void 0||(r=fu.performance)===null||r===void 0||(t=r.now)===null||t===void 0?void 0:t.call(r)}else if("hrtime"in ss){var i;let a=ss===null||ss===void 0||(i=ss.hrtime)===null||i===void 0?void 0:i.call(ss);e=a[0]*1e3+a[1]/1e6}else e=Date.now();return e}var du={debug:Ui()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},NH={enabled:!0,level:0};function mi(){}var S4={},E4={once:!0},vn=class{constructor(){let{id:r}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};ht(this,"id",void 0),ht(this,"VERSION",Up),ht(this,"_startTs",us()),ht(this,"_deltaTs",us()),ht(this,"_storage",void 0),ht(this,"userData",{}),ht(this,"LOG_THROTTLE_TIMEOUT",0),this.id=r,this.userData={},this._storage=new Hp("__probe-".concat(this.id,"__"),NH),this.timeStamp("".concat(this.id," started")),k4(this),Object.seal(this)}set level(r){this.setLevel(r)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((us()-this._startTs).toPrecision(10))}getDelta(){return Number((us()-this._deltaTs).toPrecision(10))}set priority(r){this.level=r}get priority(){return this.level}getPriority(){return this.level}enable(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:r}),this}setLevel(r){return this._storage.setConfiguration({level:r}),this}get(r){return this._storage.config[r]}set(r,t){this._storage.setConfiguration({[r]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(r,t){pu(r,t)}warn(r){return this._getLogFunction(0,r,du.warn,arguments,E4)}error(r){return this._getLogFunction(0,r,du.error,arguments)}deprecated(r,t){return this.warn("`".concat(r,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(r,t){return this.error("`".concat(r,"` has been removed. Use `").concat(t,"` instead"))}probe(r,t){return this._getLogFunction(r,t,du.log,arguments,{time:!0,once:!0})}log(r,t){return this._getLogFunction(r,t,du.debug,arguments)}info(r,t){return this._getLogFunction(r,t,console.info,arguments)}once(r,t){return this._getLogFunction(r,t,du.debug||du.info,arguments,E4)}table(r,t,i){return t?this._getLogFunction(r,t,console.table||mi,i&&[i],{tag:WH(t)}):mi}image(r){let{logLevel:t,priority:i,image:a,message:n="",scale:o=1}=r;return this._shouldLog(t||i)?Ui()?GH({image:a,message:n,scale:o}):HH({image:a,message:n,scale:o}):mi}time(r,t){return this._getLogFunction(r,t,console.time?console.time:console.info)}timeEnd(r,t){return this._getLogFunction(r,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(r,t){return this._getLogFunction(r,t,console.timeStamp||mi)}group(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},a=j4({logLevel:r,message:t,opts:i}),{collapsed:n}=i;return a.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(a)}groupCollapsed(r,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(r,t,Object.assign({},i,{collapsed:!0}))}groupEnd(r){return this._getLogFunction(r,"",console.groupEnd||mi)}withGroup(r,t,i){this.group(r,t)();try{i()}finally{this.groupEnd(r)()}}trace(){console.trace&&console.trace()}_shouldLog(r){return this.isEnabled()&&this.getLevel()>=A4(r)}_getLogFunction(r,t,i,a,n){if(this._shouldLog(r)){n=j4({logLevel:r,message:t,args:a,opts:n}),i=i||n.method,pu(i),n.total=this.getTotal(),n.delta=this.getDelta(),this._deltaTs=us();let o=n.tag||n.message;if(n.once&&o)if(!S4[o])S4[o]=us();else return mi;return t=UH(this.id,n.message,n),i.bind(console,t,...n.args)}return mi}};ht(vn,"VERSION",Up);function A4(e){if(!e)return 0;let r;switch(typeof e){case"number":r=e;break;case"object":r=e.logLevel||e.priority||0;break;default:return 0}return pu(Number.isFinite(r)&&r>=0),r}function j4(e){let{logLevel:r,message:t}=e;e.logLevel=A4(r);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==t;);switch(typeof r){case"string":case"function":t!==void 0&&i.unshift(t),e.message=r;break;case"object":Object.assign(e,r);break;default:}typeof e.message=="function"&&(e.message=e.message());let a=typeof e.message;return pu(a==="string"||a==="object"),Object.assign(e,{args:i},e.opts)}function UH(e,r,t){if(typeof r=="string"){let i=t.time?x4(y4(t.total)):"";r=t.time?"".concat(e,": ").concat(i," ").concat(r):"".concat(e,": ").concat(r),r=_4(r,t.color,t.background)}return r}function HH(e){let{image:r,message:t="",scale:i=1}=e;return console.warn("removed"),mi}function GH(e){let{image:r,message:t="",scale:i=1}=e;if(typeof r=="string"){let n=new Image;return n.onload=()=>{let o=Gp(n,t,i);console.log(...o)},n.src=r,mi}let a=r.nodeName||"";if(a.toLowerCase()==="img")return console.log(...Gp(r,t,i)),mi;if(a.toLowerCase()==="canvas"){let n=new Image;return n.onload=()=>console.log(...Gp(n,t,i)),n.src=r.toDataURL(),mi}return mi}function WH(e){for(let r in e)for(let t in e[r])return t||"untitled";return"empty"}var uae=new vn({id:"@probe.gl/log"});var Sv=new vn({id:"loaders.gl"}),Vp=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},$p=class{constructor(){this.console=console}log(...r){return this.console.log.bind(this.console,...r)}info(...r){return this.console.info.bind(this.console,...r)}warn(...r){return this.console.warn.bind(this.console,...r)}error(...r){return this.console.error.bind(this.console,...r)}};var Ev={fetch:null,mimeType:void 0,nothrow:!1,log:new $p,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Jo,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},T4={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 jv(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function Av(){let e=jv();return e.globalOptions=e.globalOptions||{...Ev},e.globalOptions}function C4(e,r,t,i){return t=t||[],t=Array.isArray(t)?t:[t],VH(e,t),KH(r,e,i)}function VH(e,r){P4(e,null,Ev,T4,r);for(let t of r){let i=e&&e[t.id]||{},a=t.options&&t.options[t.id]||{},n=t.deprecatedOptions&&t.deprecatedOptions[t.id]||{};P4(i,t.id,a,n,r)}}function P4(e,r,t,i,a){let n=r||"Top level",o=r?`${r}.`:"";for(let s in e){let u=!r&&ns(e[s]),l=s==="baseUri"&&!r,f=s==="workerUrl"&&r;if(!(s in t)&&!l&&!f){if(s in i)Sv.warn(`${n} loader option '${o}${s}' no longer supported, use '${i[s]}'`)();else if(!u){let h=$H(s,a);Sv.warn(`${n} loader option '${o}${s}' not recognized. ${h}`)()}}}}function $H(e,r){let t=e.toLowerCase(),i="";for(let a of r)for(let n in a.options){if(e===n)return`Did you mean '${a.id}.${n}'?`;let o=n.toLowerCase();(t.startsWith(o)||o.startsWith(t))&&(i=i||`Did you mean '${a.id}.${n}'?`)}return i}function KH(e,r,t){let a={...e.options||{}};return YH(a,t),a.log===null&&(a.log=new Vp),R4(a,Av()),R4(a,r),a}function R4(e,r){for(let t in r)if(t in r){let i=r[t];xv(i)&&xv(e[t])?e[t]={...e[t],...r[t]}:e[t]=r[t]}}function YH(e,r){r&&!("baseUri"in e)&&(e.baseUri=r)}function Xc(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e==null?void 0:e.extensions)):!1}function Tv(e){zi(e,"null loader"),zi(Xc(e),"invalid loader");let r;return Array.isArray(e)&&(r=e[1],e=e[0],e={...e,options:{...e.options,...r}}),(e!=null&&e.parseTextSync||e!=null&&e.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var XH=()=>{let e=jv();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function O4(){return XH()}var I4=new vn({id:"loaders.gl"});var QH=/\.([^.]+)$/;async function D4(e,r=[],t,i){if(!L4(e))return null;let a=B4(e,r,{...t,nothrow:!0},i);if(a)return a;if(hi(e)&&(e=await e.slice(0,10).arrayBuffer(),a=B4(e,r,t,i)),!a&&!(t!=null&&t.nothrow))throw new Error(q4(e));return a}function B4(e,r=[],t,i){if(!L4(e))return null;if(r&&!Array.isArray(r))return Tv(r);let a=[];r&&(a=a.concat(r)),t!=null&&t.ignoreRegisteredLoaders||a.push(...O4()),JH(a);let n=ZH(e,a,t,i);if(!n&&!(t!=null&&t.nothrow))throw new Error(q4(e));return n}function ZH(e,r,t,i){let a=os(e),n=Yc(e),o=lu(a)||(i==null?void 0:i.url),s=null,u="";return t!=null&&t.mimeType&&(s=Pv(r,t==null?void 0:t.mimeType),u=`match forced by supplied MIME type ${t==null?void 0:t.mimeType}`),s=s||eG(r,o),u=u||(s?`matched url ${o}`:""),s=s||Pv(r,n),u=u||(s?`matched MIME type ${n}`:""),s=s||tG(r,e),u=u||(s?`matched initial data ${M4(e)}`:""),t!=null&&t.fallbackMimeType&&(s=s||Pv(r,t==null?void 0:t.fallbackMimeType),u=u||(s?`matched fallback MIME type ${n}`:"")),u&&I4.log(1,`selectLoader selected ${s==null?void 0:s.name}: ${u}.`),s}function L4(e){return!(e instanceof Response&&e.status===204)}function q4(e){let r=os(e),t=Yc(e),i="No valid loader found (";i+=r?`${ts.filename(r)}, `:"no url provided, ",i+=`MIME type: ${t?`"${t}"`:"not provided"}, `;let a=e?M4(e):"";return i+=a?` first bytes: "${a}"`:"first bytes: not available",i+=")",i}function JH(e){for(let r of e)Tv(r)}function eG(e,r){let t=r&&QH.exec(r),i=t&&t[1];return i?rG(e,i):null}function rG(e,r){r=r.toLowerCase();for(let t of e)for(let i of t.extensions)if(i.toLowerCase()===r)return t;return null}function Pv(e,r){for(let t of e)if(t.mimeTypes&&t.mimeTypes.includes(r)||r===`application/x.${t.id}`)return t;return null}function tG(e,r){if(!r)return null;for(let t of e)if(typeof r=="string"){if(aG(r,t))return t}else if(ArrayBuffer.isView(r)){if(F4(r.buffer,r.byteOffset,t))return t}else if(r instanceof ArrayBuffer&&F4(r,0,t))return t;return null}function aG(e,r){return r.testText?r.testText(e):(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>e.startsWith(i))}function F4(e,r,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(a=>iG(e,r,t,a))}function iG(e,r,t,i){if(i instanceof ArrayBuffer)return iv(i,e,i.byteLength);switch(typeof i){case"function":return i(e);case"string":let a=Rv(e,r,i.length);return i===a;default:return!1}}function M4(e,r=5){return typeof e=="string"?e.slice(0,r):ArrayBuffer.isView(e)?Rv(e.buffer,e.byteOffset,r):e instanceof ArrayBuffer?Rv(e,0,r):""}function Rv(e,r,t){if(e.byteLength<r+t)return"";let i=new DataView(e),a="";for(let n=0;n<t;n++)a+=String.fromCharCode(i.getUint8(r+n));return a}function*z4(e,r){let t=(r==null?void 0:r.chunkSize)||262144,i=0,a=new TextEncoder;for(;i<e.length;){let n=Math.min(e.length-i,t),o=e.slice(i,i+n);i+=n,yield a.encode(o)}}function*N4(e,r={}){let{chunkSize:t=262144}=r,i=0;for(;i<e.byteLength;){let a=Math.min(e.byteLength-i,t),n=new ArrayBuffer(a),o=new Uint8Array(e,i,a);new Uint8Array(n).set(o),i+=a,yield n}}async function*U4(e,r){let t=(r==null?void 0:r.chunkSize)||1048576,i=0;for(;i<e.size;){let a=i+t,n=await e.slice(i,a).arrayBuffer();i=a,yield n}}function Cv(e,r){return Jo?nG(e,r):oG(e,r)}async function*nG(e,r){let t=e.getReader(),i;try{for(;;){let a=i||t.read();r!=null&&r._streamReadAhead&&(i=t.read());let{done:n,value:o}=await a;if(n)return;yield Ep(o)}}catch{t.releaseLock()}}async function*oG(e,r){for await(let t of e)yield Ep(t)}function H4(e,r){if(typeof e=="string")return z4(e,r);if(e instanceof ArrayBuffer)return N4(e,r);if(hi(e))return U4(e,r);if(zp(e))return Cv(e,r);if(di(e))return Cv(e.body,r);throw new Error("makeIterator")}var G4="Cannot convert supplied data type";function sG(e,r,t){if(r.text&&typeof e=="string")return e;if(d4(e)&&(e=e.buffer),e instanceof ArrayBuffer){let i=e;return r.text&&!r.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(e)){if(r.text&&!r.binary)return new TextDecoder("utf8").decode(e);let i=e.buffer,a=e.byteLength||e.length;return(e.byteOffset!==0||a!==i.byteLength)&&(i=i.slice(e.byteOffset,e.byteOffset+a)),i}throw new Error(G4)}async function W4(e,r,t){let i=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||i)return sG(e,r,t);if(hi(e)&&(e=await Np(e)),di(e)){let a=e;return await b4(a),r.binary?await a.arrayBuffer():await a.text()}if(zp(e)&&(e=H4(e,t)),f4(e)||p4(e))return Uc(e);throw new Error(G4)}function Kp(e,r){let t=Av(),i=e||t;return typeof i.fetch=="function"?i.fetch:ns(i.fetch)?a=>_v(a,i.fetch):r!=null&&r.fetch?r==null?void 0:r.fetch:_v}function V4(e,r,t){if(t)return t;let i={fetch:Kp(r,e),...e};if(i.url){let a=lu(i.url);i.baseUrl=a,i.queryString=g4(i.url),i.filename=ts.filename(a),i.baseUrl=ts.dirname(a)}return Array.isArray(i.loaders)||(i.loaders=null),i}function $4(e,r){if(e&&!Array.isArray(e))return e;let t;if(e&&(t=Array.isArray(e)?e:[e]),r&&r.loaders){let i=Array.isArray(r.loaders)?r.loaders:[r.loaders];t=t?[...t,...i]:i}return t&&t.length?t:void 0}async function Nn(e,r,t,i){r&&!Array.isArray(r)&&!Xc(r)&&(i=void 0,t=r,r=void 0),e=await e,t=t||{};let a=os(e),o=$4(r,i),s=await D4(e,o,t);return s?(t=C4(t,s,o,a),i=V4({url:a,_parse:Nn,loaders:o},t,i||null),await uG(s,e,t,i)):null}async function uG(e,r,t,i){if(Qg(e),t=Wg(e.options,t),di(r)){let n=r,{ok:o,redirected:s,status:u,statusText:l,type:f,url:h}=n,d=Object.fromEntries(n.headers.entries());i.response={headers:d,ok:o,redirected:s,status:u,statusText:l,type:f,url:h}}r=await W4(r,e,t);let a=e;if(a.parseTextSync&&typeof r=="string")return a.parseTextSync(r,t,i);if(tv(e,t))return await av(e,r,t,i,Nn);if(a.parseText&&typeof r=="string")return await a.parseText(r,t,i);if(a.parse)return await a.parse(r,t,i);throw ma(!a.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}function K4(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function Ov(e){let r=1/0,t=1/0,i=1/0,a=-1/0,n=-1/0,o=-1/0,s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let l=0;l<u;l+=3){let f=s[l],h=s[l+1],d=s[l+2];r=f<r?f:r,t=h<t?h:t,i=d<i?d:i,a=f>a?f:a,n=h>n?h:n,o=d>o?d:o}return[[r,t,i],[a,n,o]]}function Iv(e,r,t){let i=K4(r.value),a=t||Y4(r);return{name:e,type:{type:"fixed-size-list",listSize:r.size,children:[{name:"value",type:i}]},nullable:!1,metadata:a}}function Y4(e){let r={};return"byteOffset"in e&&(r.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(r.byteStride=e.byteStride.toString(10)),"normalized"in e&&(r.normalized=e.normalized.toString()),r}async function Bv(e,r,t,i){let a,n;!Array.isArray(r)&&!Xc(r)?(a=[],n=r,i=void 0):(a=r,n=t);let o=Kp(n),s=e;return typeof e=="string"&&(s=await o(e)),hi(e)&&(s=await o(e)),Array.isArray(a)?await Nn(s,a,n):await Nn(s,a,n)}var cG=1/Math.PI*180,lG=1/180*Math.PI,fG={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...fG}};var Bt=globalThis.mathgl.config;function Fv(e,{precision:r=Bt.precision}={}){return e=pG(e),"".concat(parseFloat(e.toPrecision(r)))}function Ao(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Dv(e){return X4(e)}function Lv(e){return Q4(e)}function X4(e,r){return Z4(e,t=>t*lG,r)}function Q4(e,r){return Z4(e,t=>t*cG,r)}function Un(e,r,t){let i=Bt.EPSILON;t&&(Bt.EPSILON=t);try{if(e===r)return!0;if(Ao(e)&&Ao(r)){if(e.length!==r.length)return!1;for(let a=0;a<e.length;++a)if(!Un(e[a],r[a]))return!1;return!0}return e&&e.equals?e.equals(r):r&&r.equals?r.equals(e):typeof e=="number"&&typeof r=="number"?Math.abs(e-r)<=Bt.EPSILON*Math.max(1,Math.abs(e),Math.abs(r)):!1}finally{Bt.EPSILON=i}}function pG(e){return Math.round(e/Bt.EPSILON)*Bt.EPSILON}function dG(e){return e.clone?e.clone():new Array(e.length)}function Z4(e,r,t){if(Ao(e)){let i=e;t=t||dG(i);for(let a=0;a<t.length&&a<i.length;++a){let n=typeof e=="number"?e:e[a];t[a]=r(n,a,t)}return t}return r(e)}function hG(e){function r(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return r.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e,r}var hu=class extends hG(Array){clone(){return new this.constructor().copy(this)}fromArray(r,t=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=r[i+t];return this.check()}toArray(r=[],t=0){for(let i=0;i<this.ELEMENTS;++i)r[t+i]=this[i];return r}toObject(r){return r}from(r){return Array.isArray(r)?this.copy(r):this.fromObject(r)}to(r){return r===this?this:Ao(r)?this.toArray(r):this.toObject(r)}toTarget(r){return r?this.to(r):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Bt)}formatString(r){let t="";for(let i=0;i<this.ELEMENTS;++i)t+=(i>0?", ":"")+Fv(this[i],r);return"".concat(r.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(r){if(!r||this.length!==r.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!Un(this[t],r[t]))return!1;return!0}exactEquals(r){if(!r||this.length!==r.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==r[t])return!1;return!0}negate(){for(let r=0;r<this.ELEMENTS;++r)this[r]=-this[r];return this.check()}lerp(r,t,i){if(i===void 0)return this.lerp(this,r,t);for(let a=0;a<this.ELEMENTS;++a){let n=r[a],o=typeof t=="number"?t:t[a];this[a]=n+i*(o-n)}return this.check()}min(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(r[t],this[t]);return this.check()}max(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(r[t],this[t]);return this.check()}clamp(r,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],r[i]),t[i]);return this.check()}add(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]+=t[i];return this.check()}subtract(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]-=t[i];return this.check()}scale(r){if(typeof r=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;else for(let t=0;t<this.ELEMENTS&&t<r.length;++t)this[t]*=r[t];return this.check()}multiplyByScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;return this.check()}check(){if(Bt.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let r=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)r=r&&Number.isFinite(this[t]);return r}sub(r){return this.subtract(r)}setScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]=r;return this.check()}addScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]+=r;return this.check()}subScalar(r){return this.addScalar(-r)}multiplyScalar(r){for(let t=0;t<this.ELEMENTS;++t)this[t]*=r;return this.check()}divideScalar(r){return this.multiplyByScalar(1/r)}clampScalar(r,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],r),t);return this.check()}get elements(){return this}};function mG(e,r){if(e.length!==r)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}function Aa(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function Yp(e,r,t=""){if(Bt.debug&&!mG(e,r))throw new Error("math.gl: ".concat(t," some fields set to invalid numbers'"));return e}function gi(e,r){if(!e)throw new Error("math.gl assertion ".concat(r))}var Xp=class extends hu{get x(){return this[0]}set x(r){this[0]=Aa(r)}get y(){return this[1]}set y(r){this[1]=Aa(r)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let r=0;for(let t=0;t<this.ELEMENTS;++t)r+=this[t]*this[t];return r}magnitudeSquared(){return this.lengthSquared()}distance(r){return Math.sqrt(this.distanceSquared(r))}distanceSquared(r){let t=0;for(let i=0;i<this.ELEMENTS;++i){let a=this[i]-r[i];t+=a*a}return Aa(t)}dot(r){let t=0;for(let i=0;i<this.ELEMENTS;++i)t+=this[i]*r[i];return Aa(t)}normalize(){let r=this.magnitude();if(r!==0)for(let t=0;t<this.ELEMENTS;++t)this[t]/=r;return this.check()}multiply(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]*=t[i];return this.check()}divide(...r){for(let t of r)for(let i=0;i<this.ELEMENTS;++i)this[i]/=t[i];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(r){return this.distance(r)}distanceToSquared(r){return this.distanceSquared(r)}getComponent(r){return gi(r>=0&&r<this.ELEMENTS,"index is out of range"),Aa(this[r])}setComponent(r,t){return gi(r>=0&&r<this.ELEMENTS,"index is out of range"),this[r]=t,this.check()}addVectors(r,t){return this.copy(r).add(t)}subVectors(r,t){return this.copy(r).subtract(t)}multiplyVectors(r,t){return this.copy(r).multiply(t)}addScaledVector(r,t){return this.add(new this.constructor(r).multiplyScalar(t))}};var Hi=typeof Float32Array<"u"?Float32Array:Array,Qc=Math.random;function mu(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var Hie=Math.PI/180;function gG(){let e=new Hi(2);return Hi!=Float32Array&&(e[0]=0,e[1]=0),e}function J4(e,r,t){let i=r[0],a=r[1];return e[0]=t[0]*i+t[4]*a+t[12],e[1]=t[1]*i+t[5]*a+t[13],e}var Gie=function(){let e=gG();return function(r,t,i,a,n,o){let s,u;for(t||(t=2),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],n(e,e,o),r[s]=e[0],r[s+1]=e[1];return r}}();function ej(e,r,t){let i=r[0],a=r[1],n=t[3]*i+t[7]*a||1;return e[0]=(t[0]*i+t[4]*a)/n,e[1]=(t[1]*i+t[5]*a)/n,e}function Qp(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[3]*i+t[7]*a+t[11]*n||1;return e[0]=(t[0]*i+t[4]*a+t[8]*n)/o,e[1]=(t[1]*i+t[5]*a+t[9]*n)/o,e[2]=(t[2]*i+t[6]*a+t[10]*n)/o,e}function rj(e,r,t){let i=r[0],a=r[1];return e[0]=t[0]*i+t[2]*a,e[1]=t[1]*i+t[3]*a,e[2]=r[2],e}var Jc={};Au(Jc,{add:()=>wG,angle:()=>Vv,bezier:()=>FG,ceil:()=>_G,clone:()=>vG,copy:()=>yG,create:()=>tj,cross:()=>zv,dist:()=>GG,distance:()=>sj,div:()=>HG,divide:()=>oj,dot:()=>Mv,equals:()=>zG,exactEquals:()=>MG,floor:()=>kG,forEach:()=>KG,fromValues:()=>bG,hermite:()=>BG,inverse:()=>RG,len:()=>VG,length:()=>aj,lerp:()=>OG,max:()=>EG,min:()=>SG,mul:()=>UG,multiply:()=>nj,negate:()=>PG,normalize:()=>CG,random:()=>DG,rotateX:()=>Hv,rotateY:()=>Gv,rotateZ:()=>Wv,round:()=>jG,scale:()=>AG,scaleAndAdd:()=>TG,set:()=>xG,slerp:()=>IG,sqrDist:()=>WG,sqrLen:()=>$G,squaredDistance:()=>uj,squaredLength:()=>cj,str:()=>qG,sub:()=>NG,subtract:()=>ij,transformMat3:()=>Nv,transformMat4:()=>Zc,transformQuat:()=>Uv,zero:()=>LG});function tj(){let e=new Hi(3);return Hi!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function vG(e){let r=new Hi(3);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function aj(e){let r=e[0],t=e[1],i=e[2];return Math.sqrt(r*r+t*t+i*i)}function bG(e,r,t){let i=new Hi(3);return i[0]=e,i[1]=r,i[2]=t,i}function yG(e,r){return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function xG(e,r,t,i){return e[0]=r,e[1]=t,e[2]=i,e}function wG(e,r,t){return e[0]=r[0]+t[0],e[1]=r[1]+t[1],e[2]=r[2]+t[2],e}function ij(e,r,t){return e[0]=r[0]-t[0],e[1]=r[1]-t[1],e[2]=r[2]-t[2],e}function nj(e,r,t){return e[0]=r[0]*t[0],e[1]=r[1]*t[1],e[2]=r[2]*t[2],e}function oj(e,r,t){return e[0]=r[0]/t[0],e[1]=r[1]/t[1],e[2]=r[2]/t[2],e}function _G(e,r){return e[0]=Math.ceil(r[0]),e[1]=Math.ceil(r[1]),e[2]=Math.ceil(r[2]),e}function kG(e,r){return e[0]=Math.floor(r[0]),e[1]=Math.floor(r[1]),e[2]=Math.floor(r[2]),e}function SG(e,r,t){return e[0]=Math.min(r[0],t[0]),e[1]=Math.min(r[1],t[1]),e[2]=Math.min(r[2],t[2]),e}function EG(e,r,t){return e[0]=Math.max(r[0],t[0]),e[1]=Math.max(r[1],t[1]),e[2]=Math.max(r[2],t[2]),e}function jG(e,r){return e[0]=mu(r[0]),e[1]=mu(r[1]),e[2]=mu(r[2]),e}function AG(e,r,t){return e[0]=r[0]*t,e[1]=r[1]*t,e[2]=r[2]*t,e}function TG(e,r,t,i){return e[0]=r[0]+t[0]*i,e[1]=r[1]+t[1]*i,e[2]=r[2]+t[2]*i,e}function sj(e,r){let t=r[0]-e[0],i=r[1]-e[1],a=r[2]-e[2];return Math.sqrt(t*t+i*i+a*a)}function uj(e,r){let t=r[0]-e[0],i=r[1]-e[1],a=r[2]-e[2];return t*t+i*i+a*a}function cj(e){let r=e[0],t=e[1],i=e[2];return r*r+t*t+i*i}function PG(e,r){return e[0]=-r[0],e[1]=-r[1],e[2]=-r[2],e}function RG(e,r){return e[0]=1/r[0],e[1]=1/r[1],e[2]=1/r[2],e}function CG(e,r){let t=r[0],i=r[1],a=r[2],n=t*t+i*i+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=r[0]*n,e[1]=r[1]*n,e[2]=r[2]*n,e}function Mv(e,r){return e[0]*r[0]+e[1]*r[1]+e[2]*r[2]}function zv(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[0],s=t[1],u=t[2];return e[0]=a*u-n*s,e[1]=n*o-i*u,e[2]=i*s-a*o,e}function OG(e,r,t,i){let a=r[0],n=r[1],o=r[2];return e[0]=a+i*(t[0]-a),e[1]=n+i*(t[1]-n),e[2]=o+i*(t[2]-o),e}function IG(e,r,t,i){let a=Math.acos(Math.min(Math.max(Mv(r,t),-1),1)),n=Math.sin(a),o=Math.sin((1-i)*a)/n,s=Math.sin(i*a)/n;return e[0]=o*r[0]+s*t[0],e[1]=o*r[1]+s*t[1],e[2]=o*r[2]+s*t[2],e}function BG(e,r,t,i,a,n){let o=n*n,s=o*(2*n-3)+1,u=o*(n-2)+n,l=o*(n-1),f=o*(3-2*n);return e[0]=r[0]*s+t[0]*u+i[0]*l+a[0]*f,e[1]=r[1]*s+t[1]*u+i[1]*l+a[1]*f,e[2]=r[2]*s+t[2]*u+i[2]*l+a[2]*f,e}function FG(e,r,t,i,a,n){let o=1-n,s=o*o,u=n*n,l=s*o,f=3*n*s,h=3*u*o,d=u*n;return e[0]=r[0]*l+t[0]*f+i[0]*h+a[0]*d,e[1]=r[1]*l+t[1]*f+i[1]*h+a[1]*d,e[2]=r[2]*l+t[2]*f+i[2]*h+a[2]*d,e}function DG(e,r){r=r===void 0?1:r;let t=Qc()*2*Math.PI,i=Qc()*2-1,a=Math.sqrt(1-i*i)*r;return e[0]=Math.cos(t)*a,e[1]=Math.sin(t)*a,e[2]=i*r,e}function Zc(e,r,t){let i=r[0],a=r[1],n=r[2],o=t[3]*i+t[7]*a+t[11]*n+t[15];return o=o||1,e[0]=(t[0]*i+t[4]*a+t[8]*n+t[12])/o,e[1]=(t[1]*i+t[5]*a+t[9]*n+t[13])/o,e[2]=(t[2]*i+t[6]*a+t[10]*n+t[14])/o,e}function Nv(e,r,t){let i=r[0],a=r[1],n=r[2];return e[0]=i*t[0]+a*t[3]+n*t[6],e[1]=i*t[1]+a*t[4]+n*t[7],e[2]=i*t[2]+a*t[5]+n*t[8],e}function Uv(e,r,t){let i=t[0],a=t[1],n=t[2],o=t[3],s=r[0],u=r[1],l=r[2],f=a*l-n*u,h=n*s-i*l,d=i*u-a*s,m=a*d-n*h,y=n*f-i*d,k=i*h-a*f,x=o*2;return f*=x,h*=x,d*=x,m*=2,y*=2,k*=2,e[0]=s+f+m,e[1]=u+h+y,e[2]=l+d+k,e}function Hv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[0],n[1]=a[1]*Math.cos(i)-a[2]*Math.sin(i),n[2]=a[1]*Math.sin(i)+a[2]*Math.cos(i),e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Gv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[2]*Math.sin(i)+a[0]*Math.cos(i),n[1]=a[1],n[2]=a[2]*Math.cos(i)-a[0]*Math.sin(i),e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Wv(e,r,t,i){let a=[],n=[];return a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2],n[0]=a[0]*Math.cos(i)-a[1]*Math.sin(i),n[1]=a[0]*Math.sin(i)+a[1]*Math.cos(i),n[2]=a[2],e[0]=n[0]+t[0],e[1]=n[1]+t[1],e[2]=n[2]+t[2],e}function Vv(e,r){let t=e[0],i=e[1],a=e[2],n=r[0],o=r[1],s=r[2],u=Math.sqrt((t*t+i*i+a*a)*(n*n+o*o+s*s)),l=u&&Mv(e,r)/u;return Math.acos(Math.min(Math.max(l,-1),1))}function LG(e){return e[0]=0,e[1]=0,e[2]=0,e}function qG(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function MG(e,r){return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]}function zG(e,r){let t=e[0],i=e[1],a=e[2],n=r[0],o=r[1],s=r[2];return Math.abs(t-n)<=1e-6*Math.max(1,Math.abs(t),Math.abs(n))&&Math.abs(i-o)<=1e-6*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-s)<=1e-6*Math.max(1,Math.abs(a),Math.abs(s))}var NG=ij,UG=nj,HG=oj,GG=sj,WG=uj,VG=aj,$G=cj,KG=function(){let e=tj();return function(r,t,i,a,n,o){let s,u;for(t||(t=3),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],e[2]=r[s+2],n(e,e,o),r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2];return r}}();var $v=[0,0,0],Zp,Ir=class extends Xp{static get ZERO(){return Zp||(Zp=new Ir(0,0,0),Object.freeze(Zp)),Zp}constructor(r=0,t=0,i=0){super(-0,-0,-0),arguments.length===1&&Ao(r)?this.copy(r):(Bt.debug&&(Aa(r),Aa(t),Aa(i)),this[0]=r,this[1]=t,this[2]=i)}set(r,t,i){return this[0]=r,this[1]=t,this[2]=i,this.check()}copy(r){return this[0]=r[0],this[1]=r[1],this[2]=r[2],this.check()}fromObject(r){return Bt.debug&&(Aa(r.x),Aa(r.y),Aa(r.z)),this[0]=r.x,this[1]=r.y,this[2]=r.z,this.check()}toObject(r){return r.x=this[0],r.y=this[1],r.z=this[2],r}get ELEMENTS(){return 3}get z(){return this[2]}set z(r){this[2]=Aa(r)}angle(r){return Vv(this,r)}cross(r){return zv(this,this,r),this.check()}rotateX({radians:r,origin:t=$v}){return Hv(this,this,t,r),this.check()}rotateY({radians:r,origin:t=$v}){return Gv(this,this,t,r),this.check()}rotateZ({radians:r,origin:t=$v}){return Wv(this,this,t,r),this.check()}transform(r){return this.transformAsPoint(r)}transformAsPoint(r){return Zc(this,this,r),this.check()}transformAsVector(r){return Qp(this,this,r),this.check()}transformByMatrix3(r){return Nv(this,this,r),this.check()}transformByMatrix2(r){return rj(this,this,r),this.check()}transformByQuaternion(r){return Uv(this,this,r),this.check()}};var Jp=class extends hu{toString(){let r="[";if(Bt.printRowMajor){r+="row-major:";for(let t=0;t<this.RANK;++t)for(let i=0;i<this.RANK;++i)r+=" ".concat(this[i*this.RANK+t])}else{r+="column-major:";for(let t=0;t<this.ELEMENTS;++t)r+=" ".concat(this[t])}return r+="]",r}getElementIndex(r,t){return t*this.RANK+r}getElement(r,t){return this[t*this.RANK+r]}setElement(r,t,i){return this[t*this.RANK+r]=Aa(i),this}getColumn(r,t=new Array(this.RANK).fill(-0)){let i=r*this.RANK;for(let a=0;a<this.RANK;++a)t[a]=this[i+a];return t}setColumn(r,t){let i=r*this.RANK;for(let a=0;a<this.RANK;++a)this[i+a]=t[a];return this}};function YG(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function lj(e,r){if(e===r){let t=r[1],i=r[2],a=r[3],n=r[6],o=r[7],s=r[11];e[1]=r[4],e[2]=r[8],e[3]=r[12],e[4]=t,e[6]=r[9],e[7]=r[13],e[8]=i,e[9]=n,e[11]=r[14],e[12]=a,e[13]=o,e[14]=s}else e[0]=r[0],e[1]=r[4],e[2]=r[8],e[3]=r[12],e[4]=r[1],e[5]=r[5],e[6]=r[9],e[7]=r[13],e[8]=r[2],e[9]=r[6],e[10]=r[10],e[11]=r[14],e[12]=r[3],e[13]=r[7],e[14]=r[11],e[15]=r[15];return e}function fj(e,r){let t=r[0],i=r[1],a=r[2],n=r[3],o=r[4],s=r[5],u=r[6],l=r[7],f=r[8],h=r[9],d=r[10],m=r[11],y=r[12],k=r[13],x=r[14],A=r[15],P=t*s-i*o,T=t*u-a*o,B=t*l-n*o,C=i*u-a*s,I=i*l-n*s,F=a*l-n*u,H=f*k-h*y,N=f*x-d*y,K=f*A-m*y,V=h*x-d*k,X=h*A-m*k,U=d*A-m*x,$=P*U-T*X+B*V+C*K-I*N+F*H;return $?($=1/$,e[0]=(s*U-u*X+l*V)*$,e[1]=(a*X-i*U-n*V)*$,e[2]=(k*F-x*I+A*C)*$,e[3]=(d*I-h*F-m*C)*$,e[4]=(u*K-o*U-l*N)*$,e[5]=(t*U-a*K+n*N)*$,e[6]=(x*B-y*F-A*T)*$,e[7]=(f*F-d*B+m*T)*$,e[8]=(o*X-s*K+l*H)*$,e[9]=(i*K-t*X-n*H)*$,e[10]=(y*I-k*B+A*P)*$,e[11]=(h*B-f*I-m*P)*$,e[12]=(s*N-o*V-u*H)*$,e[13]=(t*V-i*N+a*H)*$,e[14]=(k*T-y*C-x*P)*$,e[15]=(f*C-h*T+d*P)*$,e):null}function pj(e){let r=e[0],t=e[1],i=e[2],a=e[3],n=e[4],o=e[5],s=e[6],u=e[7],l=e[8],f=e[9],h=e[10],d=e[11],m=e[12],y=e[13],k=e[14],x=e[15],A=r*o-t*n,P=r*s-i*n,T=t*s-i*o,B=l*y-f*m,C=l*k-h*m,I=f*k-h*y,F=r*I-t*C+i*B,H=n*I-o*C+s*B,N=l*T-f*P+h*A,K=m*T-y*P+k*A;return u*F-a*H+x*N-d*K}function Kv(e,r,t){let i=r[0],a=r[1],n=r[2],o=r[3],s=r[4],u=r[5],l=r[6],f=r[7],h=r[8],d=r[9],m=r[10],y=r[11],k=r[12],x=r[13],A=r[14],P=r[15],T=t[0],B=t[1],C=t[2],I=t[3];return e[0]=T*i+B*s+C*h+I*k,e[1]=T*a+B*u+C*d+I*x,e[2]=T*n+B*l+C*m+I*A,e[3]=T*o+B*f+C*y+I*P,T=t[4],B=t[5],C=t[6],I=t[7],e[4]=T*i+B*s+C*h+I*k,e[5]=T*a+B*u+C*d+I*x,e[6]=T*n+B*l+C*m+I*A,e[7]=T*o+B*f+C*y+I*P,T=t[8],B=t[9],C=t[10],I=t[11],e[8]=T*i+B*s+C*h+I*k,e[9]=T*a+B*u+C*d+I*x,e[10]=T*n+B*l+C*m+I*A,e[11]=T*o+B*f+C*y+I*P,T=t[12],B=t[13],C=t[14],I=t[15],e[12]=T*i+B*s+C*h+I*k,e[13]=T*a+B*u+C*d+I*x,e[14]=T*n+B*l+C*m+I*A,e[15]=T*o+B*f+C*y+I*P,e}function dj(e,r,t){let i=t[0],a=t[1],n=t[2],o,s,u,l,f,h,d,m,y,k,x,A;return r===e?(e[12]=r[0]*i+r[4]*a+r[8]*n+r[12],e[13]=r[1]*i+r[5]*a+r[9]*n+r[13],e[14]=r[2]*i+r[6]*a+r[10]*n+r[14],e[15]=r[3]*i+r[7]*a+r[11]*n+r[15]):(o=r[0],s=r[1],u=r[2],l=r[3],f=r[4],h=r[5],d=r[6],m=r[7],y=r[8],k=r[9],x=r[10],A=r[11],e[0]=o,e[1]=s,e[2]=u,e[3]=l,e[4]=f,e[5]=h,e[6]=d,e[7]=m,e[8]=y,e[9]=k,e[10]=x,e[11]=A,e[12]=o*i+f*a+y*n+r[12],e[13]=s*i+h*a+k*n+r[13],e[14]=u*i+d*a+x*n+r[14],e[15]=l*i+m*a+A*n+r[15]),e}function hj(e,r,t){let i=t[0],a=t[1],n=t[2];return e[0]=r[0]*i,e[1]=r[1]*i,e[2]=r[2]*i,e[3]=r[3]*i,e[4]=r[4]*a,e[5]=r[5]*a,e[6]=r[6]*a,e[7]=r[7]*a,e[8]=r[8]*n,e[9]=r[9]*n,e[10]=r[10]*n,e[11]=r[11]*n,e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function mj(e,r,t,i){let a=i[0],n=i[1],o=i[2],s=Math.sqrt(a*a+n*n+o*o),u,l,f,h,d,m,y,k,x,A,P,T,B,C,I,F,H,N,K,V,X,U,$,Z;return s<1e-6?null:(s=1/s,a*=s,n*=s,o*=s,l=Math.sin(t),u=Math.cos(t),f=1-u,h=r[0],d=r[1],m=r[2],y=r[3],k=r[4],x=r[5],A=r[6],P=r[7],T=r[8],B=r[9],C=r[10],I=r[11],F=a*a*f+u,H=n*a*f+o*l,N=o*a*f-n*l,K=a*n*f-o*l,V=n*n*f+u,X=o*n*f+a*l,U=a*o*f+n*l,$=n*o*f-a*l,Z=o*o*f+u,e[0]=h*F+k*H+T*N,e[1]=d*F+x*H+B*N,e[2]=m*F+A*H+C*N,e[3]=y*F+P*H+I*N,e[4]=h*K+k*V+T*X,e[5]=d*K+x*V+B*X,e[6]=m*K+A*V+C*X,e[7]=y*K+P*V+I*X,e[8]=h*U+k*$+T*Z,e[9]=d*U+x*$+B*Z,e[10]=m*U+A*$+C*Z,e[11]=y*U+P*$+I*Z,r!==e&&(e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e)}function gj(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[4],o=r[5],s=r[6],u=r[7],l=r[8],f=r[9],h=r[10],d=r[11];return r!==e&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[4]=n*a+l*i,e[5]=o*a+f*i,e[6]=s*a+h*i,e[7]=u*a+d*i,e[8]=l*a-n*i,e[9]=f*a-o*i,e[10]=h*a-s*i,e[11]=d*a-u*i,e}function vj(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[0],o=r[1],s=r[2],u=r[3],l=r[8],f=r[9],h=r[10],d=r[11];return r!==e&&(e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=n*a-l*i,e[1]=o*a-f*i,e[2]=s*a-h*i,e[3]=u*a-d*i,e[8]=n*i+l*a,e[9]=o*i+f*a,e[10]=s*i+h*a,e[11]=u*i+d*a,e}function bj(e,r,t){let i=Math.sin(t),a=Math.cos(t),n=r[0],o=r[1],s=r[2],u=r[3],l=r[4],f=r[5],h=r[6],d=r[7];return r!==e&&(e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=n*a+l*i,e[1]=o*a+f*i,e[2]=s*a+h*i,e[3]=u*a+d*i,e[4]=l*a-n*i,e[5]=f*a-o*i,e[6]=h*a-s*i,e[7]=d*a-u*i,e}function yj(e,r){let t=r[0],i=r[1],a=r[2],n=r[3],o=t+t,s=i+i,u=a+a,l=t*o,f=i*o,h=i*s,d=a*o,m=a*s,y=a*u,k=n*o,x=n*s,A=n*u;return e[0]=1-h-y,e[1]=f+A,e[2]=d-x,e[3]=0,e[4]=f-A,e[5]=1-l-y,e[6]=m+k,e[7]=0,e[8]=d+x,e[9]=m-k,e[10]=1-l-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function xj(e,r,t,i,a,n,o){let s=1/(t-r),u=1/(a-i),l=1/(n-o);return e[0]=n*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n*2*u,e[6]=0,e[7]=0,e[8]=(t+r)*s,e[9]=(a+i)*u,e[10]=(o+n)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*n*2*l,e[15]=0,e}function XG(e,r,t,i,a){let n=1/Math.tan(r/2);if(e[0]=n/t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,a!=null&&a!==1/0){let o=1/(i-a);e[10]=(a+i)*o,e[14]=2*a*i*o}else e[10]=-1,e[14]=-2*i;return e}var wj=XG;function QG(e,r,t,i,a,n,o){let s=1/(r-t),u=1/(i-a),l=1/(n-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(r+t)*s,e[13]=(a+i)*u,e[14]=(o+n)*l,e[15]=1,e}var _j=QG;function kj(e,r,t,i){let a,n,o,s,u,l,f,h,d,m,y=r[0],k=r[1],x=r[2],A=i[0],P=i[1],T=i[2],B=t[0],C=t[1],I=t[2];return Math.abs(y-B)<1e-6&&Math.abs(k-C)<1e-6&&Math.abs(x-I)<1e-6?YG(e):(h=y-B,d=k-C,m=x-I,a=1/Math.sqrt(h*h+d*d+m*m),h*=a,d*=a,m*=a,n=P*m-T*d,o=T*h-A*m,s=A*d-P*h,a=Math.sqrt(n*n+o*o+s*s),a?(a=1/a,n*=a,o*=a,s*=a):(n=0,o=0,s=0),u=d*s-m*o,l=m*n-h*s,f=h*o-d*n,a=Math.sqrt(u*u+l*l+f*f),a?(a=1/a,u*=a,l*=a,f*=a):(u=0,l=0,f=0),e[0]=n,e[1]=u,e[2]=h,e[3]=0,e[4]=o,e[5]=l,e[6]=d,e[7]=0,e[8]=s,e[9]=f,e[10]=m,e[11]=0,e[12]=-(n*y+o*k+s*x),e[13]=-(u*y+l*k+f*x),e[14]=-(h*y+d*k+m*x),e[15]=1,e)}function ZG(){let e=new Hi(4);return Hi!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Sj(e,r,t){let i=r[0],a=r[1],n=r[2],o=r[3];return e[0]=t[0]*i+t[4]*a+t[8]*n+t[12]*o,e[1]=t[1]*i+t[5]*a+t[9]*n+t[13]*o,e[2]=t[2]*i+t[6]*a+t[10]*n+t[14]*o,e[3]=t[3]*i+t[7]*a+t[11]*n+t[15]*o,e}var ine=function(){let e=ZG();return function(r,t,i,a,n,o){let s,u;for(t||(t=4),i||(i=0),a?u=Math.min(a*t+i,r.length):u=r.length,s=i;s<u;s+=t)e[0]=r[s],e[1]=r[s+1],e[2]=r[s+2],e[3]=r[s+3],n(e,e,o),r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2],r[s+3]=e[3];return r}}();var Qv;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Qv||(Qv={}));var JG=45*Math.PI/180,eW=1,Yv=.1,Xv=500,rW=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),vi=class extends Jp{static get IDENTITY(){return aW()}static get ZERO(){return tW()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Qv}constructor(r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(r)?this.copy(r):this.identity()}copy(r){return this[0]=r[0],this[1]=r[1],this[2]=r[2],this[3]=r[3],this[4]=r[4],this[5]=r[5],this[6]=r[6],this[7]=r[7],this[8]=r[8],this[9]=r[9],this[10]=r[10],this[11]=r[11],this[12]=r[12],this[13]=r[13],this[14]=r[14],this[15]=r[15],this.check()}set(r,t,i,a,n,o,s,u,l,f,h,d,m,y,k,x){return this[0]=r,this[1]=t,this[2]=i,this[3]=a,this[4]=n,this[5]=o,this[6]=s,this[7]=u,this[8]=l,this[9]=f,this[10]=h,this[11]=d,this[12]=m,this[13]=y,this[14]=k,this[15]=x,this.check()}setRowMajor(r,t,i,a,n,o,s,u,l,f,h,d,m,y,k,x){return this[0]=r,this[1]=n,this[2]=l,this[3]=m,this[4]=t,this[5]=o,this[6]=f,this[7]=y,this[8]=i,this[9]=s,this[10]=h,this[11]=k,this[12]=a,this[13]=u,this[14]=d,this[15]=x,this.check()}toRowMajor(r){return r[0]=this[0],r[1]=this[4],r[2]=this[8],r[3]=this[12],r[4]=this[1],r[5]=this[5],r[6]=this[9],r[7]=this[13],r[8]=this[2],r[9]=this[6],r[10]=this[10],r[11]=this[14],r[12]=this[3],r[13]=this[7],r[14]=this[11],r[15]=this[15],r}identity(){return this.copy(rW)}fromObject(r){return this.check()}fromQuaternion(r){return yj(this,r),this.check()}frustum(r){let{left:t,right:i,bottom:a,top:n,near:o=Yv,far:s=Xv}=r;return s===1/0?iW(this,t,i,a,n,o):xj(this,t,i,a,n,o,s),this.check()}lookAt(r){let{eye:t,center:i=[0,0,0],up:a=[0,1,0]}=r;return kj(this,t,i,a),this.check()}ortho(r){let{left:t,right:i,bottom:a,top:n,near:o=Yv,far:s=Xv}=r;return _j(this,t,i,a,n,o,s),this.check()}orthographic(r){let{fovy:t=JG,aspect:i=eW,focalDistance:a=1,near:n=Yv,far:o=Xv}=r;Ej(t);let s=t/2,u=a*Math.tan(s),l=u*i;return this.ortho({left:-l,right:l,bottom:-u,top:u,near:n,far:o})}perspective(r){let{fovy:t=45*Math.PI/180,aspect:i=1,near:a=.1,far:n=500}=r;return Ej(t),wj(this,t,i,a,n),this.check()}determinant(){return pj(this)}getScale(r=[-0,-0,-0]){return r[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),r[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),r[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),r}getTranslation(r=[-0,-0,-0]){return r[0]=this[12],r[1]=this[13],r[2]=this[14],r}getRotation(r,t){r=r||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let i=this.getScale(t),a=1/i[0],n=1/i[1],o=1/i[2];return r[0]=this[0]*a,r[1]=this[1]*n,r[2]=this[2]*o,r[3]=0,r[4]=this[4]*a,r[5]=this[5]*n,r[6]=this[6]*o,r[7]=0,r[8]=this[8]*a,r[9]=this[9]*n,r[10]=this[10]*o,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}getRotationMatrix3(r,t){r=r||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let i=this.getScale(t),a=1/i[0],n=1/i[1],o=1/i[2];return r[0]=this[0]*a,r[1]=this[1]*n,r[2]=this[2]*o,r[3]=this[4]*a,r[4]=this[5]*n,r[5]=this[6]*o,r[6]=this[8]*a,r[7]=this[9]*n,r[8]=this[10]*o,r}transpose(){return lj(this,this),this.check()}invert(){return fj(this,this),this.check()}multiplyLeft(r){return Kv(this,r,this),this.check()}multiplyRight(r){return Kv(this,this,r),this.check()}rotateX(r){return gj(this,this,r),this.check()}rotateY(r){return vj(this,this,r),this.check()}rotateZ(r){return bj(this,this,r),this.check()}rotateXYZ(r){return this.rotateX(r[0]).rotateY(r[1]).rotateZ(r[2])}rotateAxis(r,t){return mj(this,this,r,t),this.check()}scale(r){return hj(this,this,Array.isArray(r)?r:[r,r,r]),this.check()}translate(r){return dj(this,this,r),this.check()}transform(r,t){return r.length===4?(t=Sj(t||[-0,-0,-0,-0],r,this),Yp(t,4),t):this.transformAsPoint(r,t)}transformAsPoint(r,t){let{length:i}=r,a;switch(i){case 2:a=J4(t||[-0,-0],r,this);break;case 3:a=Zc(t||[-0,-0,-0],r,this);break;default:throw new Error("Illegal vector")}return Yp(a,r.length),a}transformAsVector(r,t){let i;switch(r.length){case 2:i=ej(t||[-0,-0],r,this);break;case 3:i=Qp(t||[-0,-0,-0],r,this);break;default:throw new Error("Illegal vector")}return Yp(i,r.length),i}transformPoint(r,t){return this.transformAsPoint(r,t)}transformVector(r,t){return this.transformAsPoint(r,t)}transformDirection(r,t){return this.transformAsVector(r,t)}makeRotationX(r){return this.identity().rotateX(r)}makeTranslation(r,t,i){return this.identity().translate([r,t,i])}},ed,rd;function tW(){return ed||(ed=new vi([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(ed)),ed}function aW(){return rd||(rd=new vi,Object.freeze(rd)),rd}function Ej(e){if(e>Math.PI*2)throw Error("expected radians")}function iW(e,r,t,i,a,n){let o=2*n/(t-r),s=2*n/(a-i),u=(t+r)/(t-r),l=(a+i)/(a-i),f=-1,h=-1,d=-2*n;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=u,e[9]=l,e[10]=f,e[11]=h,e[12]=0,e[13]=0,e[14]=d,e[15]=0,e}var cs={};Au(cs,{EPSILON1:()=>nW,EPSILON10:()=>hW,EPSILON11:()=>mW,EPSILON12:()=>gW,EPSILON13:()=>vW,EPSILON14:()=>bW,EPSILON15:()=>yW,EPSILON16:()=>xW,EPSILON17:()=>wW,EPSILON18:()=>_W,EPSILON19:()=>kW,EPSILON2:()=>oW,EPSILON20:()=>SW,EPSILON3:()=>sW,EPSILON4:()=>uW,EPSILON5:()=>cW,EPSILON6:()=>lW,EPSILON7:()=>fW,EPSILON8:()=>pW,EPSILON9:()=>dW,PI_OVER_FOUR:()=>jW,PI_OVER_SIX:()=>AW,PI_OVER_TWO:()=>EW,TWO_PI:()=>TW});var nW=.1,oW=.01,sW=.001,uW=1e-4,cW=1e-5,lW=1e-6,fW=1e-7,pW=1e-8,dW=1e-9,hW=1e-10,mW=1e-11,gW=1e-12,vW=1e-13,bW=1e-14,yW=1e-15,xW=1e-16,wW=1e-17,_W=1e-18,kW=1e-19,SW=1e-20,EW=Math.PI/2,jW=Math.PI/4,AW=Math.PI/6,TW=Math.PI*2;var Gn=6356752314245179e-9,PW={radii:[6378137,6378137,Gn],radiiSquared:[6378137*6378137,6378137*6378137,Gn*Gn],oneOverRadii:[1/6378137,1/6378137,1/Gn],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Gn*Gn)],maximumRadius:Math.max(6378137,6378137,Gn),centerToleranceSquared:.1};function td(e){return e}var Bne=new Ir;function RW(e,r=[],t=td){return"longitude"in e?(r[0]=t(e.longitude),r[1]=t(e.latitude),r[2]=e.height):"x"in e?(r[0]=t(e.x),r[1]=t(e.y),r[2]=e.z):(r[0]=t(e[0]),r[1]=t(e[1]),r[2]=e[2]),r}function jj(e,r=[]){return RW(e,r,Bt._cartographicRadians?td:Dv)}function CW(e,r,t=td){return"longitude"in r?(r.longitude=t(e[0]),r.latitude=t(e[1]),r.height=e[2]):"x"in r?(r.x=t(e[0]),r.y=t(e[1]),r.z=e[2]):(r[0]=t(e[0]),r[1]=t(e[1]),r[2]=e[2]),r}function Aj(e,r){return CW(e,r,Bt._cartographicRadians?td:Lv)}var Tj=1e-14,OW=new Ir,Pj={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"}},Zv={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},el={east:new Ir,north:new Ir,up:new Ir,west:new Ir,south:new Ir,down:new Ir},IW=new Ir,BW=new Ir,FW=new Ir;function Jv(e,r,t,i,a,n){let o=Pj[r]&&Pj[r][t];gi(o&&(!i||i===o));let s,u,l,f=OW.copy(a);if(Un(f.x,0,Tj)&&Un(f.y,0,Tj)){let d=Math.sign(f.z);s=IW.fromArray(Zv[r]),r!=="east"&&r!=="west"&&s.scale(d),u=BW.fromArray(Zv[t]),t!=="east"&&t!=="west"&&u.scale(d),l=FW.fromArray(Zv[i]),i!=="east"&&i!=="west"&&l.scale(d)}else{let{up:d,east:m,north:y}=el;m.set(-f.y,f.x,0).normalize(),e.geodeticSurfaceNormal(f,d),y.copy(d).cross(m);let{down:k,west:x,south:A}=el;k.copy(d).scale(-1),x.copy(m).scale(-1),A.copy(y).scale(-1),s=el[r],u=el[t],l=el[i]}return n[0]=s.x,n[1]=s.y,n[2]=s.z,n[3]=0,n[4]=u.x,n[5]=u.y,n[6]=u.z,n[7]=0,n[8]=l.x,n[9]=l.y,n[10]=l.z,n[11]=0,n[12]=f.x,n[13]=f.y,n[14]=f.z,n[15]=1,n}var gu=new Ir,DW=new Ir,LW=new Ir;function Rj(e,r,t=[]){let{oneOverRadii:i,oneOverRadiiSquared:a,centerToleranceSquared:n}=r;gu.from(e);let o=gu.x,s=gu.y,u=gu.z,l=i.x,f=i.y,h=i.z,d=o*o*l*l,m=s*s*f*f,y=u*u*h*h,k=d+m+y,x=Math.sqrt(1/k);if(!Number.isFinite(x))return;let A=DW;if(A.copy(e).scale(x),k<n)return A.to(t);let P=a.x,T=a.y,B=a.z,C=LW;C.set(A.x*P*2,A.y*T*2,A.z*B*2);let I=(1-x)*gu.len()/(.5*C.len()),F=0,H,N,K,V;do{I-=F,H=1/(1+I*P),N=1/(1+I*T),K=1/(1+I*B);let X=H*H,U=N*N,$=K*K,Z=X*H,le=U*N,ve=$*K;V=d*X+m*U+y*$-1;let we=-2*(d*Z*P+m*le*T+y*ve*B);F=V/we}while(Math.abs(V)>cs.EPSILON12);return gu.scale([H,N,K]).to(t)}var ad=new Ir,Cj=new Ir,zW=new Ir,Gi=new Ir,NW=new Ir,id=new Ir,Wn=class{constructor(r=0,t=0,i=0){ht(this,"radii",void 0),ht(this,"radiiSquared",void 0),ht(this,"radiiToTheFourth",void 0),ht(this,"oneOverRadii",void 0),ht(this,"oneOverRadiiSquared",void 0),ht(this,"minimumRadius",void 0),ht(this,"maximumRadius",void 0),ht(this,"centerToleranceSquared",cs.EPSILON1),ht(this,"squaredXOverSquaredZ",void 0),gi(r>=0),gi(t>=0),gi(i>=0),this.radii=new Ir(r,t,i),this.radiiSquared=new Ir(r*r,t*t,i*i),this.radiiToTheFourth=new Ir(r*r*r*r,t*t*t*t,i*i*i*i),this.oneOverRadii=new Ir(r===0?0:1/r,t===0?0:1/t,i===0?0:1/i),this.oneOverRadiiSquared=new Ir(r===0?0:1/(r*r),t===0?0:1/(t*t),i===0?0:1/(i*i)),this.minimumRadius=Math.min(r,t,i),this.maximumRadius=Math.max(r,t,i),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(r){return this===r||Boolean(r&&this.radii.equals(r.radii))}toString(){return this.radii.toString()}cartographicToCartesian(r,t=[0,0,0]){let i=Cj,a=zW,[,,n]=r;this.geodeticSurfaceNormalCartographic(r,i),a.copy(this.radiiSquared).scale(i);let o=Math.sqrt(i.dot(a));return a.scale(1/o),i.scale(n),a.add(i),a.to(t)}cartesianToCartographic(r,t=[0,0,0]){id.from(r);let i=this.scaleToGeodeticSurface(id,Gi);if(!i)return;let a=this.geodeticSurfaceNormal(i,Cj),n=NW;n.copy(id).subtract(i);let o=Math.atan2(a.y,a.x),s=Math.asin(a.z),u=Math.sign(Jc.dot(n,id))*Jc.length(n);return Aj([o,s,u],t)}eastNorthUpToFixedFrame(r,t=new vi){return Jv(this,"east","north","up",r,t)}localFrameToFixedFrame(r,t,i,a,n=new vi){return Jv(this,r,t,i,a,n)}geocentricSurfaceNormal(r,t=[0,0,0]){return ad.from(r).normalize().to(t)}geodeticSurfaceNormalCartographic(r,t=[0,0,0]){let i=jj(r),a=i[0],n=i[1],o=Math.cos(n);return ad.set(o*Math.cos(a),o*Math.sin(a),Math.sin(n)).normalize(),ad.to(t)}geodeticSurfaceNormal(r,t=[0,0,0]){return ad.from(r).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(r,t){return Rj(r,this,t)}scaleToGeocentricSurface(r,t=[0,0,0]){Gi.from(r);let i=Gi.x,a=Gi.y,n=Gi.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(i*i*o.x+a*a*o.y+n*n*o.z);return Gi.multiplyScalar(s).to(t)}transformPositionToScaledSpace(r,t=[0,0,0]){return Gi.from(r).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(r,t=[0,0,0]){return Gi.from(r).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(r,t=0,i=[0,0,0]){gi(Un(this.radii.x,this.radii.y,cs.EPSILON15)),gi(this.radii.z>0),Gi.from(r);let a=Gi.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(a)>=this.radii.z-t))return Gi.set(0,0,a).to(i)}};ht(Wn,"WGS84",new Wn(6378137,6378137,Gn));var Oj="4.2.0-alpha.4";var Ij,UW=(Ij=globalThis.loaders)==null?void 0:Ij.parseImageNode,e1=typeof Image<"u",r1=typeof ImageBitmap<"u",HW=Boolean(UW),t1=Jo?!0:HW;function Bj(e){switch(e){case"auto":return r1||e1||t1;case"imagebitmap":return r1;case"image":return e1;case"data":return t1;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Fj(){if(r1)return"imagebitmap";if(e1)return"image";if(t1)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function GW(e){let r=WW(e);if(!r)throw new Error("Not an image");return r}function Dj(e){switch(GW(e)){case"data":return e;case"image":case"imagebitmap":let r=document.createElement("canvas"),t=r.getContext("2d");if(!t)throw new Error("getImageData");return r.width=e.width,r.height=e.height,t.drawImage(e,0,0),t.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function WW(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var VW=/^data:image\/svg\+xml/,$W=/\.svg((\?|#).*)?$/;function nd(e){return e&&(VW.test(e)||$W.test(e))}function Lj(e,r){if(nd(r)){let i=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(n){throw new Error(n.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return a1(e,r)}function a1(e,r){if(nd(r))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function od(e,r,t){let i=Lj(e,t),a=self.URL||self.webkitURL,n=typeof i!="string"&&a.createObjectURL(i);try{return await KW(n||i,r)}finally{n&&a.revokeObjectURL(n)}}async function KW(e,r){let t=new Image;return t.src=e,r.image&&r.image.decode&&t.decode?(await t.decode(),t):await new Promise((i,a)=>{try{t.onload=()=>i(t),t.onerror=n=>{let o=n instanceof Error?n.message:"error";a(new Error(o))}}catch(n){a(n)}})}var YW={},qj=!0;async function Mj(e,r,t){let i;nd(t)?i=await od(e,r,t):i=a1(e,t);let a=r&&r.imagebitmap;return await XW(i,a)}async function XW(e,r=null){if((QW(r)||!qj)&&(r=null),r)try{return await createImageBitmap(e,r)}catch(t){console.warn(t),qj=!1}return await createImageBitmap(e)}function QW(e){for(let r in e||YW)return!1;return!0}function zj(e){return!rV(e,"ftyp",4)||!(e[8]&96)?null:ZW(e)}function ZW(e){switch(JW(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function JW(e,r,t){return String.fromCharCode(...e.slice(r,t))}function eV(e){return[...e].map(r=>r.charCodeAt(0))}function rV(e,r,t=0){let i=eV(r);for(let a=0;a<i.length;++a)if(i[a]!==e[a+t])return!1;return!0}var bn=!1,rl=!0;function sd(e){let r=tl(e);return aV(r)||oV(r)||iV(r)||nV(r)||tV(r)}function tV(e){let r=new Uint8Array(e instanceof DataView?e.buffer:e),t=zj(r);return t?{mimeType:t.mimeType,width:0,height:0}:null}function aV(e){let r=tl(e);return r.byteLength>=24&&r.getUint32(0,bn)===2303741511?{mimeType:"image/png",width:r.getUint32(16,bn),height:r.getUint32(20,bn)}:null}function iV(e){let r=tl(e);return r.byteLength>=10&&r.getUint32(0,bn)===1195984440?{mimeType:"image/gif",width:r.getUint16(6,rl),height:r.getUint16(8,rl)}:null}function nV(e){let r=tl(e);return r.byteLength>=14&&r.getUint16(0,bn)===16973&&r.getUint32(2,rl)===r.byteLength?{mimeType:"image/bmp",width:r.getUint32(18,rl),height:r.getUint32(22,rl)}:null}function oV(e){let r=tl(e);if(!(r.byteLength>=3&&r.getUint16(0,bn)===65496&&r.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:a}=sV(),n=2;for(;n+9<r.byteLength;){let o=r.getUint16(n,bn);if(a.has(o))return{mimeType:"image/jpeg",height:r.getUint16(n+5,bn),width:r.getUint16(n+7,bn)};if(!i.has(o))return null;n+=2,n+=r.getUint16(n,bn)}return null}function sV(){let e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function tl(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function Nj(e,r){var a;let{mimeType:t}=sd(e)||{},i=(a=globalThis.loaders)==null?void 0:a.parseImageNode;return zi(i),await i(e,t)}async function Uj(e,r,t){r=r||{};let a=(r.image||{}).type||"auto",{url:n}=t||{},o=uV(a),s;switch(o){case"imagebitmap":s=await Mj(e,r,n);break;case"image":s=await od(e,r,n);break;case"data":s=await Nj(e,r);break;default:zi(!1)}return a==="data"&&(s=Dj(s)),s}function uV(e){switch(e){case"auto":case"data":return Fj();default:return Bj(e),e}}var cV=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],lV=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],fV={image:{type:"auto",decode:!0}},ud={id:"image",module:"images",name:"Images",version:Oj,mimeTypes:lV,extensions:cV,parse:Uj,tests:[e=>Boolean(sd(new DataView(e)))],options:fV};var Hj="4.2.0-alpha.4";var Gj={name:"Draco",id:"draco",module:"draco",version:Hj,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Vj(e,r,t){let i=$j(r.metadata),a=[],n=pV(r.attributes);for(let o in e){let s=e[o],u=Wj(o,s,n[o]);a.push(u)}if(t){let o=Wj("indices",t);a.push(o)}return{fields:a,metadata:i}}function pV(e){let r={};for(let t in e){let i=e[t];r[i.name||"undefined"]=i}return r}function Wj(e,r,t){let i=t?$j(t.metadata):void 0;return Iv(e,r,i)}function $j(e){Object.entries(e);let r={};for(let t in e)r[`${t}.string`]=JSON.stringify(e[t]);return r}var Kj={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},dV={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},hV=4,al=class{constructor(r){this.draco=r,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(r,t={}){let i=new this.draco.DecoderBuffer;i.Init(new Int8Array(r),r.byteLength),this._disableAttributeTransforms(t);let a=this.decoder.GetEncodedGeometryType(i),n=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(a){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(i,n);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(i,n);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!n.ptr){let d=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(d)}let s=this._getDracoLoaderData(n,a,t),u=this._getMeshData(n,s,t),l=Ov(u.attributes),f=Vj(u.attributes,s,u.indices);return{loader:"draco",loaderData:s,header:{vertexCount:n.num_points(),boundingBox:l},...u,schema:f}}finally{this.draco.destroy(i),n&&this.draco.destroy(n)}}_getDracoLoaderData(r,t,i){let a=this._getTopLevelMetadata(r),n=this._getDracoAttributes(r,i);return{geometry_type:t,num_attributes:r.num_attributes(),num_points:r.num_points(),num_faces:r instanceof this.draco.Mesh?r.num_faces():0,metadata:a,attributes:n}}_getDracoAttributes(r,t){let i={};for(let a=0;a<r.num_attributes();a++){let n=this.decoder.GetAttribute(r,a),o=this._getAttributeMetadata(r,a);i[n.unique_id()]={unique_id:n.unique_id(),attribute_type:n.attribute_type(),data_type:n.data_type(),num_components:n.num_components(),byte_offset:n.byte_offset(),byte_stride:n.byte_stride(),normalized:n.normalized(),attribute_index:a,metadata:o};let s=this._getQuantizationTransform(n,t);s&&(i[n.unique_id()].quantization_transform=s);let u=this._getOctahedronTransform(n,t);u&&(i[n.unique_id()].octahedron_transform=u)}return i}_getMeshData(r,t,i){let a=this._getMeshAttributes(t,r,i);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(r instanceof this.draco.Mesh)switch(i.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(r),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(r),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(r,t,i){let a={};for(let n of Object.values(r.attributes)){let o=this._deduceAttributeName(n,i);n.name=o;let{value:s,size:u}=this._getAttributeValues(t,n);a[o]={value:s,size:u,byteOffset:n.byte_offset,byteStride:n.byte_stride,normalized:n.normalized}}return a}_getTriangleListIndices(r){let i=r.num_faces()*3,a=i*hV,n=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(r,a,n),new Uint32Array(this.draco.HEAPF32.buffer,n,i).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(r){let t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(r,t),vV(t)}finally{this.draco.destroy(t)}}_getAttributeValues(r,t){let i=dV[t.data_type],a=t.num_components,o=r.num_points()*a,s=o*i.BYTES_PER_ELEMENT,u=mV(this.draco,i),l,f=this.draco._malloc(s);try{let h=this.decoder.GetAttribute(r,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(r,h,u,s,f),l=new i(this.draco.HEAPF32.buffer,f,o).slice()}finally{this.draco._free(f)}return{value:l,size:a}}_deduceAttributeName(r,t){let i=r.unique_id;for(let[o,s]of Object.entries(t.extraAttributes||{}))if(s===i)return o;let a=r.attribute_type;for(let o in Kj)if(this.draco[o]===a)return Kj[o];let n=t.attributeNameEntry||"name";return r.metadata[n]?r.metadata[n].string:`CUSTOM_ATTRIBUTE_${i}`}_getTopLevelMetadata(r){let t=this.decoder.GetMetadata(r);return this._getDracoMetadata(t)}_getAttributeMetadata(r,t){let i=this.decoder.GetAttributeMetadata(r,t);return this._getDracoMetadata(i)}_getDracoMetadata(r){if(!r||!r.ptr)return{};let t={},i=this.metadataQuerier.NumEntries(r);for(let a=0;a<i;a++){let n=this.metadataQuerier.GetEntryName(r,a);t[n]=this._getDracoMetadataField(r,n)}return t}_getDracoMetadataField(r,t){let i=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(r,t,i);let a=gV(i);return{int:this.metadataQuerier.GetIntEntry(r,t),string:this.metadataQuerier.GetStringEntry(r,t),double:this.metadataQuerier.GetDoubleEntry(r,t),intArray:a}}finally{this.draco.destroy(i)}}_disableAttributeTransforms(r){let{quantizedAttributes:t=[],octahedronAttributes:i=[]}=r,a=[...t,...i];for(let n of a)this.decoder.SkipAttributeTransform(this.draco[n])}_getQuantizationTransform(r,t){let{quantizedAttributes:i=[]}=t,a=r.attribute_type();if(i.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(r))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(s=>o.min_value(s))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(r,t){let{octahedronAttributes:i=[]}=t,a=r.attribute_type();if(i.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(r))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function mV(e,r){switch(r){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}function gV(e){let r=e.size(),t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=e.GetValue(i);return t}function vV(e){let r=e.size(),t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=e.GetValue(i);return t}var bV="1.5.6",yV="1.4.1",i1=`https://www.gstatic.com/draco/versioned/decoders/${bV}`,Ha={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},n1={[Ha.DECODER]:`${i1}/${Ha.DECODER}`,[Ha.DECODER_WASM]:`${i1}/${Ha.DECODER_WASM}`,[Ha.FALLBACK_DECODER]:`${i1}/${Ha.FALLBACK_DECODER}`,[Ha.ENCODER]:`https://raw.githubusercontent.com/google/draco/${yV}/javascript/${Ha.ENCODER}`},il;async function Yj(e){let r=e.modules||{};return r.draco3d?il=il||r.draco3d.createDecoderModule({}).then(t=>({draco:t})):il=il||xV(e),await il}async function xV(e){let r,t;switch(e.draco&&e.draco.decoderType){case"js":r=await gn(n1[Ha.FALLBACK_DECODER],"draco",e,Ha.FALLBACK_DECODER);break;case"wasm":default:[r,t]=await Promise.all([await gn(n1[Ha.DECODER],"draco",e,Ha.DECODER),await gn(n1[Ha.DECODER_WASM],"draco",e,Ha.DECODER_WASM)])}return r=r||globalThis.DracoDecoderModule,await wV(r,t)}function wV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e({...t,onModuleLoaded:a=>i({draco:a})})})}var Xj={...Gj,parse:_V};async function _V(e,r){let{draco:t}=await Yj(r),i=new al(t);try{return i.parseSync(e,r==null?void 0:r.draco)}finally{i.destroy()}}var cd="4.2.0-alpha.4";var ld={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},o1;async function u1(e){let r=e.modules||{};return r.basis?r.basis:(o1=o1||kV(e),await o1)}async function kV(e){let r=null,t=null;return[r,t]=await Promise.all([await gn(ld.TRANSCODER,"textures",e),await gn(ld.TRANSCODER_WASM,"textures",e)]),r=r||globalThis.BASIS,await SV(r,t)}function SV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e(t).then(a=>{let{BasisFile:n,initializeBasis:o}=a;o(),i({BasisFile:n})})})}var s1;async function c1(e){let r=e.modules||{};return r.basisEncoder?r.basisEncoder:(s1=s1||EV(e),await s1)}async function EV(e){let r=null,t=null;return[r,t]=await Promise.all([await gn(ld.ENCODER,"textures",e),await gn(ld.ENCODER_WASM,"textures",e)]),r=r||globalThis.BASIS,await jV(r,t)}function jV(e,r){let t={};return r&&(t.wasmBinary=r),new Promise(i=>{e(t).then(a=>{let{BasisFile:n,KTX2File:o,initializeBasis:s,BasisEncoder:u}=a;s(),i({BasisFile:n,KTX2File:o,BasisEncoder:u})})})}var ce={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var AV=["","WEBKIT_","MOZ_"],Qj={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"},fd=null;function Zj(e){if(!fd){e=e||TV()||void 0,fd=new Set;for(let r of AV)for(let t in Qj)if(e&&e.getExtension(`${r}${t}`)){let i=Qj[t];fd.add(i)}}return fd}function TV(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var lA=Pt(uA(),1);function vu(e,r){let t=new Array(r.mipMapLevels),i=r.width,a=r.height,n=0;for(let o=0;o<r.mipMapLevels;++o){let s=CV(r,i,a,e,o),u=RV(e,o,n,s);t[o]={compressed:!0,format:r.internalFormat,data:u,width:i,height:a,levelSize:s},i=Math.max(1,i>>1),a=Math.max(1,a>>1),n+=s}return t}function RV(e,r,t,i){return Array.isArray(e)?e[r].levelData:new Uint8Array(e.buffer,e.byteOffset+t,i)}function CV(e,r,t,i,a){return Array.isArray(i)?e.sizeFunction(i[a]):e.sizeFunction(r,t)}var OV={131:ce.COMPRESSED_RGB_S3TC_DXT1_EXT,132:ce.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:ce.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:ce.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:ce.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:ce.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:ce.COMPRESSED_RED_RGTC1_EXT,140:ce.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:ce.COMPRESSED_RED_GREEN_RGTC2_EXT,142:ce.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:ce.COMPRESSED_RGB8_ETC2,148:ce.COMPRESSED_SRGB8_ETC2,149:ce.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:ce.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:ce.COMPRESSED_RGBA8_ETC2_EAC,152:ce.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:ce.COMPRESSED_R11_EAC,154:ce.COMPRESSED_SIGNED_R11_EAC,155:ce.COMPRESSED_RG11_EAC,156:ce.COMPRESSED_SIGNED_RG11_EAC,157:ce.COMPRESSED_RGBA_ASTC_4x4_KHR,158:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:ce.COMPRESSED_RGBA_ASTC_5x4_KHR,160:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:ce.COMPRESSED_RGBA_ASTC_5x5_KHR,162:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:ce.COMPRESSED_RGBA_ASTC_6x5_KHR,164:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:ce.COMPRESSED_RGBA_ASTC_6x6_KHR,166:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:ce.COMPRESSED_RGBA_ASTC_8x5_KHR,168:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:ce.COMPRESSED_RGBA_ASTC_8x6_KHR,170:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:ce.COMPRESSED_RGBA_ASTC_8x8_KHR,172:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:ce.COMPRESSED_RGBA_ASTC_10x5_KHR,174:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:ce.COMPRESSED_RGBA_ASTC_10x6_KHR,176:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:ce.COMPRESSED_RGBA_ASTC_10x8_KHR,178:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:ce.COMPRESSED_RGBA_ASTC_10x10_KHR,180:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:ce.COMPRESSED_RGBA_ASTC_12x10_KHR,182:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:ce.COMPRESSED_RGBA_ASTC_12x12_KHR,184:ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:ce.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:ce.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:ce.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:ce.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:ce.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:ce.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:ce.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:ce.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:ce.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:ce.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:ce.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:ce.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:ce.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:ce.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:ce.COMPRESSED_RGBA_ASTC_12x12_KHR};function cA(e){return OV[e]}var Ja=[171,75,84,88,32,50,48,187,13,10,26,10];function gd(e){let r=new Uint8Array(e);return!(r.byteLength<Ja.length||r[0]!==Ja[0]||r[1]!==Ja[1]||r[2]!==Ja[2]||r[3]!==Ja[3]||r[4]!==Ja[4]||r[5]!==Ja[5]||r[6]!==Ja[6]||r[7]!==Ja[7]||r[8]!==Ja[8]||r[9]!==Ja[9]||r[10]!==Ja[10]||r[11]!==Ja[11])}function fA(e){let r=new Uint8Array(e),t=(0,lA.read)(r),i=Math.max(1,t.levels.length),a=t.pixelWidth,n=t.pixelHeight,o=cA(t.vkFormat);return vu(t.levels,{mipMapLevels:i,width:a,height:n,sizeFunction:s=>s.uncompressedByteLength,internalFormat:o})}var IV={etc1:{basisFormat:0,compressed:!0,format:ce.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:ce.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:ce.COMPRESSED_RGBA_S3TC_DXT5_EXT},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:ce.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:ce.COMPRESSED_RGBA_ASTC_4X4_KHR},"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}};async function ol(e,r){if(r.basis.containerFormat==="auto"){if(gd(e)){let i=await c1(r);return pA(i.KTX2File,e,r)}let{BasisFile:t}=await u1(r);return h1(t,e,r)}switch(r.basis.module){case"encoder":let t=await c1(r);switch(r.basis.containerFormat){case"ktx2":return pA(t.KTX2File,e,r);case"basis":default:return h1(t.BasisFile,e,r)}case"transcoder":default:let{BasisFile:i}=await u1(r);return h1(i,e,r)}}function h1(e,r,t){let i=new e(new Uint8Array(r));try{if(!i.startTranscoding())throw new Error("Failed to start basis transcoding");let a=i.getNumImages(),n=[];for(let o=0;o<a;o++){let s=i.getNumLevels(o),u=[];for(let l=0;l<s;l++)u.push(BV(i,o,l,t));n.push(u)}return n}finally{i.close(),i.delete()}}function BV(e,r,t,i){let a=e.getImageWidth(r,t),n=e.getImageHeight(r,t),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:l}=dA(i,o),f=e.getImageTranscodedSizeInBytes(r,t,l),h=new Uint8Array(f);if(!e.transcodeImage(h,r,t,l,0,0))throw new Error("failed to start Basis transcoding");return{width:a,height:n,data:h,compressed:s,format:u,hasAlpha:o}}function pA(e,r,t){let i=new e(new Uint8Array(r));try{if(!i.startTranscoding())throw new Error("failed to start KTX2 transcoding");let a=i.getLevels(),n=[];for(let o=0;o<a;o++){n.push(FV(i,o,t));break}return[n]}finally{i.close(),i.delete()}}function FV(e,r,t){let{alphaFlag:i,height:a,width:n}=e.getImageLevelInfo(r,0,0),{compressed:o,format:s,basisFormat:u}=dA(t,i),l=e.getImageTranscodedSizeInBytes(r,0,0,u),f=new Uint8Array(l);if(!e.transcodeImage(f,r,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:n,height:a,data:f,compressed:o,levelSize:l,hasAlpha:i,format:s}}function dA(e,r){let t=e&&e.basis&&e.basis.format;return t==="auto"&&(t=DV()),typeof t=="object"&&(t=r?t.alpha:t.noAlpha),t=t.toLowerCase(),IV[t]}function DV(){let e=Zj();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var hA={name:"Basis",id:"basis",module:"textures",version:cd,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},sl={...hA,parse:ol};var ei={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4},LV={DXT1:ce.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:ce.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:ce.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":ce.COMPRESSED_RGB_ATC_WEBGL,ATCA:ce.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:ce.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},qV=vA,MV=vd,zV=vd,NV={DXT1:vA,DXT3:vd,DXT5:vd,"ATC ":qV,ATCA:MV,ATCI:zV};function mA(e){return new Uint32Array(e,0,ei.HEADER_LENGTH)[ei.MAGIC_NUMBER_INDEX]===ei.MAGIC_NUMBER}function gA(e){let r=new Int32Array(e,0,ei.HEADER_LENGTH),t=r[ei.HEADER_PF_FOURCC_INDEX];zi(Boolean(r[ei.HEADER_PF_FLAGS_INDEX]&ei.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let i=UV(t),a=LV[i],n=NV[i];zi(a&&n,`DDS: Unknown pixel format ${t}`);let o=1;r[ei.HEADER_FLAGS_INDEX]&ei.DDSD_MIPMAPCOUNT&&(o=Math.max(1,r[ei.MIPMAPCOUNT_INDEX]));let s=r[ei.HEADER_WIDTH_INDEX],u=r[ei.HEADER_HEIGHT_INDEX],l=r[ei.HEADER_SIZE_INDEX]+4,f=new Uint8Array(e,l);return vu(f,{mipMapLevels:o,width:s,height:u,sizeFunction:n,internalFormat:a})}function vA(e,r){return(e+3>>2)*(r+3>>2)*8}function vd(e,r){return(e+3>>2)*(r+3>>2)*16}function UV(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var bi={MAGIC_NUMBER:55727696,MAGIC_NUMBER_EXTRA:1347834371,HEADER_LENGTH:13,HEADER_SIZE:52,MAGIC_NUMBER_INDEX:0,PIXEL_FORMAT_INDEX:2,COLOUR_SPACE_INDEX:4,HEIGHT_INDEX:6,WIDTH_INDEX:7,MIPMAPCOUNT_INDEX:11,METADATA_SIZE_INDEX:12},HV={0:[ce.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[ce.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[ce.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[ce.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[ce.COMPRESSED_RGB_ETC1_WEBGL],7:[ce.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[ce.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[ce.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[ce.COMPRESSED_RGB8_ETC2],23:[ce.COMPRESSED_RGBA8_ETC2_EAC],24:[ce.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[ce.COMPRESSED_R11_EAC],26:[ce.COMPRESSED_RG11_EAC],27:[ce.COMPRESSED_RGBA_ASTC_4X4_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[ce.COMPRESSED_RGBA_ASTC_5X4_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[ce.COMPRESSED_RGBA_ASTC_5X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[ce.COMPRESSED_RGBA_ASTC_6X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[ce.COMPRESSED_RGBA_ASTC_6X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[ce.COMPRESSED_RGBA_ASTC_8X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[ce.COMPRESSED_RGBA_ASTC_8X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[ce.COMPRESSED_RGBA_ASTC_8X8_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[ce.COMPRESSED_RGBA_ASTC_10X5_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[ce.COMPRESSED_RGBA_ASTC_10X6_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[ce.COMPRESSED_RGBA_ASTC_10X8_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[ce.COMPRESSED_RGBA_ASTC_10X10_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[ce.COMPRESSED_RGBA_ASTC_12X10_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[ce.COMPRESSED_RGBA_ASTC_12X12_KHR,ce.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},GV={0:bA,1:bA,2:yA,3:yA,6:ul,7:ul,9:cl,11:cl,22:ul,23:cl,24:ul,25:ul,26:cl,27:cl,28:WV,29:VV,30:$V,31:KV,32:YV,33:XV,34:QV,35:ZV,36:JV,37:e$,38:r$,39:t$,40:a$};function xA(e){let t=new Uint32Array(e,0,bi.HEADER_LENGTH)[bi.MAGIC_NUMBER_INDEX];return t===bi.MAGIC_NUMBER||t===bi.MAGIC_NUMBER_EXTRA}function wA(e){let r=new Uint32Array(e,0,bi.HEADER_LENGTH),t=r[bi.PIXEL_FORMAT_INDEX],i=r[bi.COLOUR_SPACE_INDEX],a=HV[t]||[],n=a.length>1&&i?a[1]:a[0],o=GV[t],s=r[bi.MIPMAPCOUNT_INDEX],u=r[bi.WIDTH_INDEX],l=r[bi.HEIGHT_INDEX],f=bi.HEADER_SIZE+r[bi.METADATA_SIZE_INDEX],h=new Uint8Array(e,f);return vu(h,{mipMapLevels:s,width:u,height:l,sizeFunction:o,internalFormat:n})}function bA(e,r){return e=Math.max(e,16),r=Math.max(r,8),e*r/4}function yA(e,r){return e=Math.max(e,8),r=Math.max(r,8),e*r/2}function ul(e,r){return Math.floor((e+3)/4)*Math.floor((r+3)/4)*8}function cl(e,r){return Math.floor((e+3)/4)*Math.floor((r+3)/4)*16}function WV(e,r){return Math.floor((e+4)/5)*Math.floor((r+3)/4)*16}function VV(e,r){return Math.floor((e+4)/5)*Math.floor((r+4)/5)*16}function $V(e,r){return Math.floor((e+5)/6)*Math.floor((r+4)/5)*16}function KV(e,r){return Math.floor((e+5)/6)*Math.floor((r+5)/6)*16}function YV(e,r){return Math.floor((e+7)/8)*Math.floor((r+4)/5)*16}function XV(e,r){return Math.floor((e+7)/8)*Math.floor((r+5)/6)*16}function QV(e,r){return Math.floor((e+7)/8)*Math.floor((r+7)/8)*16}function ZV(e,r){return Math.floor((e+9)/10)*Math.floor((r+4)/5)*16}function JV(e,r){return Math.floor((e+9)/10)*Math.floor((r+5)/6)*16}function e$(e,r){return Math.floor((e+9)/10)*Math.floor((r+7)/8)*16}function r$(e,r){return Math.floor((e+9)/10)*Math.floor((r+9)/10)*16}function t$(e,r){return Math.floor((e+11)/12)*Math.floor((r+9)/10)*16}function a$(e,r){return Math.floor((e+11)/12)*Math.floor((r+11)/12)*16}function _A(e){if(gd(e))return fA(e);if(mA(e))return gA(e);if(xA(e))return wA(e);throw new Error("Texture container format not recognized")}var kA={name:"Texture Containers",id:"compressed-texture",module:"textures",version:cd,worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{libraryPath:"libs/",useBasis:!1}}},bd={...kA,parse:async(e,r)=>{var t;return(t=r==null?void 0:r["compressed-texture"])!=null&&t.useBasis?(r.basis={format:{alpha:"BC3",noAlpha:"BC1"},...r.basis,containerFormat:"ktx2",module:"encoder"},(await ol(e,r))[0]):_A(e)}};function SA(e,r=null){return r?`${e}?token=${r}`:e}var i$={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},n$={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},ls={...i$,...n$};function m1(e){switch(e){case"UInt8":return Uint8Array;case"UInt16":return Uint16Array;case"UInt32":return Uint32Array;case"Float32":return Float32Array;case"UInt64":return Float64Array;default:throw new Error(`parse i3s tile content: unknown type of data: ${e}`)}}var EA={UInt8:ls.UNSIGNED_BYTE,UInt16:ls.UNSIGNED_SHORT,Float32:ls.FLOAT,UInt32:ls.UNSIGNED_INT,UInt64:ls.DOUBLE};function bu(e){switch(e){case"UInt8":return 1;case"UInt16":case"Int16":return 2;case"UInt32":case"Int32":case"Float32":return 4;case"UInt64":case"Int64":case"Float64":return 8;default:throw new Error(`parse i3s tile content: unknown size of data: ${e}`)}}var yd=new Ir([0,0,0]);function o$(e){switch(e){case"ktx-etc2":case"dds":return bd;case"ktx2":return sl;case"jpg":case"png":default:return ud}}var s$="i3s-attribute-type";async function PA(e,r,t,i,a){var o;let n={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new vi,coordinateSystem:0,byteLength:0,texture:null};if(r.textureUrl){let s=SA(u$(r.textureUrl),(o=i==null?void 0:i.i3s)==null?void 0:o.token),u=o$(r.textureFormat),h=await(await((a==null?void 0:a.fetch)||fetch)(s)).arrayBuffer();if(i!=null&&i.i3s.decodeTextures){if(u===ud){let d={...r.textureLoaderOptions,image:{type:"data"}};try{let m=await Gg(h,[],d,a);n.texture=m}catch{let y=await Nn(h,u,d,a);n.texture=y}}else if(u===bd||u===sl){let d=await Bv(h,u,r.textureLoaderOptions);u===sl&&(d=d[0]),n.texture={compressed:!0,mipmaps:!1,width:d[0].width,height:d[0].height,data:d}}}else n.texture=h}return n.material=v$(r.materialDefinition,n.texture),n.material&&(n.texture=null),await c$(e,n,r,t,i)}function u$(e){let r=e.split(".slpk"),t;return r.length===1?t=e:r.length===2?t=r[1].slice(1):t=e,t}async function c$(e,r,t,i,a){var h,d;let n=e.byteLength,o,s,u=0,l=0,f;if(t.isDracoGeometry){let m=await Nn(e,Xj,{draco:{attributeNameEntry:s$}});s=m.header.vertexCount,f=(h=m.indices)==null?void 0:h.value;let{POSITION:y,NORMAL:k,COLOR_0:x,TEXCOORD_0:A,["feature-index"]:P,["uv-region"]:T}=m.attributes;o={position:y,normal:k,color:x,uv0:A,uvRegion:T,id:P},l$(o,m);let B=w$(P);B&&x$(o,B)}else{let{vertexAttributes:m,ordering:y,featureAttributes:k,featureAttributeOrder:x}=i.store.defaultGeometrySchema,A=p$(e,i);u=A.byteOffset,s=A.vertexCount,l=A.featureCount;let{attributes:P,byteOffset:T}=AA(e,u,m,s,y),{attributes:B}=AA(e,T,k,l,x);y$(B),o=f$(P,B)}if(!((d=a==null?void 0:a.i3s)!=null&&d.coordinateSystem)||a.i3s.coordinateSystem===2){let m=h$(o.position,t);r.modelMatrix=m.invert(),r.coordinateSystem=2}else r.modelMatrix=g$(o.position),r.coordinateSystem=3;r.attributes={positions:o.position,normals:o.normal,colors:jA(o.color),texCoords:o.uv0,uvRegions:jA(o.uvRegion||o.region)},r.indices=f||null,o.id&&o.id.value&&(r.featureIds=o.id.value);for(let m in r.attributes)r.attributes[m]||delete r.attributes[m];return r.vertexCount=s,r.byteLength=n,r}function l$(e,r){for(let t in r.loaderData.attributes){let i=r.loaderData.attributes[t];switch(i.name){case"POSITION":e.position.metadata=i.metadata;break;case"feature-index":e.id.metadata=i.metadata;break;default:break}}}function f$(e,r){return{...e,...r}}function jA(e){return e&&(e.normalized=!0,e)}function p$(e,r){let t=0,i=0,a=0;for(let{property:n,type:o}of r.store.defaultGeometrySchema.header){let s=m1(o);switch(n){case"vertexCount":i=new s(e,0,4)[0],t+=bu(o);break;case"featureCount":a=new s(e,4,4)[0],t+=bu(o);break;default:break}}return{vertexCount:i,featureCount:a,byteOffset:t}}function AA(e,r,t,i,a){let n={};for(let o of a)if(t[o]){let{valueType:s,valuesPerElement:u}=t[o];if(r+i*u*bu(s)<=e.byteLength){let l=e.slice(r),f;if(s==="UInt64")f=d$(l,i*u,bu(s));else{let h=m1(s);f=new h(l,0,i*u)}switch(n[o]={value:f,type:EA[s],size:u},o){case"color":n.color.normalized=!0;break;case"position":case"region":case"normal":default:}r=r+i*u*bu(s)}else if(o!=="uv0")break}return{attributes:n,byteOffset:r}}function d$(e,r,t){let i=[],a=new DataView(e),n=0;for(let o=0;o<r;o++){let s=a.getUint32(n,!0),u=a.getUint32(n+4,!0),l=s+2**32*u;i.push(l),n+=t}return new Uint32Array(i)}function h$(e,r){let t=r.mbs,i=e.value,a=e.metadata,n=new vi,o=new Ir(t[0],t[1],t[2]),s=new Ir;return Wn.WGS84.cartographicToCartesian(o,s),Wn.WGS84.eastNorthUpToFixedFrame(s,n),e.value=m$(i,a,o),n}function m$(e,r={},t){let i=new Float64Array(e.length),a=r["i3s-scale_x"]&&r["i3s-scale_x"].double||1,n=r["i3s-scale_y"]&&r["i3s-scale_y"].double||1;for(let o=0;o<i.length;o+=3)i[o]=e[o]*a+t.x,i[o+1]=e[o+1]*n+t.y,i[o+2]=e[o+2]+t.z;for(let o=0;o<i.length;o+=3)Wn.WGS84.cartographicToCartesian(i.subarray(o,o+3),yd),i[o]=yd.x,i[o+1]=yd.y,i[o+2]=yd.z;return i}function g$(e){var n,o;let r=e.metadata,t=((n=r==null?void 0:r["i3s-scale_x"])==null?void 0:n.double)||1,i=((o=r==null?void 0:r["i3s-scale_y"])==null?void 0:o.double)||1,a=new vi;return a[0]=t,a[5]=i,a}function v$(e,r){let t;return e?t={...e,pbrMetallicRoughness:e.pbrMetallicRoughness?{...e.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(t={pbrMetallicRoughness:{}},r?t.pbrMetallicRoughness.baseColorTexture={texCoord:0}:t.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]),t.alphaCutoff=t.alphaCutoff||.25,t.alphaMode&&(t.alphaMode=t.alphaMode.toUpperCase()),t.emissiveFactor&&(t.emissiveFactor=TA(t.emissiveFactor)),t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorFactor&&(t.pbrMetallicRoughness.baseColorFactor=TA(t.pbrMetallicRoughness.baseColorFactor)),r&&b$(t,r),t}function TA(e){let r=[...e];for(let t=0;t<e.length;t++)r[t]=e[t]/255;return r}function b$(e,r){let t={source:{image:r}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture={...e.pbrMetallicRoughness.baseColorTexture,texture:t}:e.emissiveTexture?e.emissiveTexture={...e.emissiveTexture,texture:t}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture={...e.pbrMetallicRoughness.metallicRoughnessTexture,texture:t}:e.normalTexture?e.normalTexture={...e.normalTexture,texture:t}:e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture,texture:t})}function y$(e){let{id:r,faceRange:t}=e;if(!r||!t)return;let i=r.value,a=t.value,n=a[a.length-1]+1,o=new Uint32Array(n*3),s=0,u=0;for(let l=1;l<a.length;l+=2){let f=Number(i[s]),h=a[l],d=a[l-1],m=h-d+1,y=u+m*3;o.fill(f,u,y),s++,u=y}e.id.value=o}function x$(e,r){let t=e.id.value,i=new Float32Array(t.length);for(let a=0;a<t.length;a++)i[a]=r[t[a]];e.id.value=i}function w$(e){var r,t;return(t=(r=e==null?void 0:e.metadata)==null?void 0:r["i3s-feature-ids"])==null?void 0:t.intArray}var _$="4.2.0-alpha.4",RA={name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:_$,mimeTypes:["application/octet-stream"],parse:k$,extensions:["bin"],options:{"i3s-content":{}}};async function k$(e,r,t){let{tile:i,_tileOptions:a,tileset:n,_tilesetOptions:o}=(r==null?void 0:r.i3s)||{},s=a||i,u=o||n;return!s||!u?null:await PA(e,s,u,r,t)}rv(RA);
|
|
101
101
|
/*! Bundled license information:
|
|
102
102
|
|
|
103
103
|
is-buffer/index.js:
|