@gis_victory/gismap 2.0.65 → 2.0.67

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.
@@ -1 +0,0 @@
1
- function e(e,t){if(!e)throw new Error(t||"loader assertion failed.")}const t=Boolean("object"!=typeof process||"[object process]"!==String(process)||process.browser),n="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);n&&parseFloat(n[1]);const r=globalThis,o=globalThis.process||{},i=globalThis.navigator||{};function s(e){if("undefined"!=typeof window&&"renderer"===window.process?.type)return!0;if("undefined"!=typeof process&&Boolean(process.versions?.electron))return!0;const t="undefined"!=typeof navigator&&navigator.userAgent;return Boolean(t&&t.indexOf("Electron")>=0)}function a(){return!("object"==typeof process&&"[object process]"===String(process)&&!process?.browser)||s()}const c="4.1.1";function l(e,t){if(!e)throw new Error("Assertion failed")}function _(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return l(Number.isFinite(t)&&t>=0),t}const u=()=>{};class E{constructor({level:e=0}={}){this.userData={},this._onceCache=/* @__PURE__ */new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...t){return this._log("warn",0,e,t,{once:!0})}error(e,...t){return this._log("error",0,e,t)}log(e,t,...n){return this._log("log",e,t,n)}info(e,t,...n){return this._log("info",e,t,n)}once(e,t,...n){return this._log("once",e,t,n,{once:!0})}_log(e,t,n,r,o={}){const i=function(e){const{logLevel:t,message:n}=e;e.logLevel=_(t);const r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":void 0!==n&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const o=typeof e.message;return l("string"===o||"object"===o),Object.assign(e,{args:r},e.opts)}({logLevel:t,message:n,args:this._buildArgs(t,n,r),opts:o});return this._createLogFunction(e,i,o)}_buildArgs(e,t,n){return[e,t,...n]}_createLogFunction(e,t,n){if(!this._shouldLog(t.logLevel))return u;const r=this._getOnceTag(n.tag??t.tag??t.message);if((n.once||t.once)&&void 0!==r){if(this._onceCache.has(r))return u;this._onceCache.add(r)}return this._emit(e,t)}_shouldLog(e){return this.getLevel()>=_(e)}_getOnceTag(e){if(void 0!==e)try{return"string"==typeof e?e:String(e)}catch{return}}}class h{constructor(e,t,n="sessionStorage"){this.storage=function(e){try{const t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch(t){return null}}(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}var f,d;(d=f||(f={}))[d.BLACK=30]="BLACK",d[d.RED=31]="RED",d[d.GREEN=32]="GREEN",d[d.YELLOW=33]="YELLOW",d[d.BLUE=34]="BLUE",d[d.MAGENTA=35]="MAGENTA",d[d.CYAN=36]="CYAN",d[d.WHITE=37]="WHITE",d[d.BRIGHT_BLACK=90]="BRIGHT_BLACK",d[d.BRIGHT_RED=91]="BRIGHT_RED",d[d.BRIGHT_GREEN=92]="BRIGHT_GREEN",d[d.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",d[d.BRIGHT_BLUE=94]="BRIGHT_BLUE",d[d.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",d[d.BRIGHT_CYAN=96]="BRIGHT_CYAN",d[d.BRIGHT_WHITE=97]="BRIGHT_WHITE";function p(e){return"string"!=typeof e?e:(e=e.toUpperCase(),f[e]||f.WHITE)}function T(){let e;if(a()&&r.performance)e=r?.performance?.now?.();else if("hrtime"in o){const t=o?.hrtime?.();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const R={debug:a()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},A={enabled:!0,level:0};class g extends E{constructor({id:e}={id:""}){super({level:0}),this.VERSION=c,this._startTs=T(),this._deltaTs=T(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new h(`__probe-${this.id}__`,{[this.id]:A}),this.timeStamp(`${this.id} started`),function(e,t=["constructor"]){const n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),o=e;for(const i of r){const n=o[i];"function"==typeof n&&(t.find(e=>i===e)||(o[i]=n.bind(e)))}}(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((T()-this._startTs).toPrecision(10))}getDelta(){return Number((T()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,t){this._updateConfiguration({[e]:t})}settings(){console.table}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e,...t){return this._log("warn",0,e,t,{method:R.warn,once:!0})}error(e,...t){return this._log("error",0,e,t,{method:R.error})}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t,...n){return this._log("log",e,t,n,{method:R.log,time:!0,once:!0})}log(e,t,...n){return this._log("log",e,t,n,{method:R.debug})}info(e,t,...n){return this._log("info",e,t,n,{method:console.info})}once(e,t,...n){return this._log("once",e,t,n,{method:R.debug||R.info,once:!0})}table(e,t,n){return t?this._log("table",e,t,n&&[n]||[],{method:console.table||u,tag:m(t)}):u}time(e,t){return this._log("time",e,t,[],{method:console.time?console.time:console.info})}timeEnd(e,t){return this._log("time",e,t,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,t){return this._log("time",e,t,[],{method:console.timeStamp||u})}group(e,t,n={collapsed:!1}){const r=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,t,[],{method:r})}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||u})}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,t){const n=t.method;l(n),t.total=this.getTotal(),t.delta=this.getDelta(),this._deltaTs=T();const r=function(e,t,n){if("string"==typeof t){const r=n.time?function(e,t=8){const n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}(function(e){let t;return t=e<10?`${e.toFixed(2)}ms`:e<100?`${e.toFixed(1)}ms`:e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(2)}s`,t}(n.total)):"";t=function(e,t,n){a||"string"!=typeof e||(t&&(e=`[${p(t)}m${e}`),n&&(e=`[${p(n)+10}m${e}`));return e}(t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,n.color,n.background)}return t}(this.id,t.message,t);return n.bind(console,r,...t.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(A),this._storage.config[this.id]}_updateConfiguration(e){const t=this._storage.config[this.id]||{...A};this._storage.setConfiguration({[this.id]:{...t,...e}})}}function m(e){for(const t in e)for(const n in e[t])return n||"untitled";return"empty"}g.VERSION=c;const S="4.4.2",M=S[0]>="0"&&S[0]<="9"?`v${S}`:"";const N=function(){const e=new g({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=e,globalThis.loaders.version=M,globalThis.probe||={},globalThis.probe.loaders=e,e}(),O=e=>"function"==typeof e,C=e=>null!==e&&"object"==typeof e,I=e=>C(e)&&e.constructor==={}.constructor,b=e=>"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer,L=e=>C(e)&&"number"==typeof e.byteLength&&"function"==typeof e.slice,P=e=>"undefined"!=typeof Response&&e instanceof Response||C(e)&&O(e.arrayBuffer)&&O(e.text)&&O(e.json),y=e=>"undefined"!=typeof Blob&&e instanceof Blob,D=e=>(e=>"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||C(e)&&O(e.tee)&&O(e.cancel)&&O(e.getReader))(e)||(e=>C(e)&&O(e.read)&&O(e.pipe)&&(e=>"boolean"==typeof e)(e.readable))(e);function U(e,t){return B(e||{},t)}function B(e,t,n=0){if(n>3)return t;const r={...e};for(const[o,i]of Object.entries(t))i&&"object"==typeof i&&!Array.isArray(i)?r[o]=B(r[o]||{},t[o],n+1):r[o]=t[o];return r}const F=(globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.2"),globalThis._loadersgl_.version);function w(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}const v="object"!=typeof process||"[object process]"!==String(process)||process.browser,G="function"==typeof importScripts,x="undefined"!=typeof window&&void 0!==window.orientation,j="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);j&&parseFloat(j[1]);class W{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,t){this.name=e,this.workerThread=t,this.result=new Promise((e,t)=>{this._resolve=e,this._reject=t})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){w(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){w(this.isRunning),this.isRunning=!1,this._reject(e)}}class H{terminate(){}}const X=/* @__PURE__ */new Map;function k(e){w(e.source&&!e.url||!e.source&&e.url);let t=X.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return $((t=e,`try {\n importScripts('${t}');\n} catch (error) {\n console.error(error);\n throw error;\n}`));var t}(e.url),X.set(e.url,t)),e.source&&(t=$(e.source),X.set(e.source,t))),w(t),t}function $(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function V(e,t=!0,n){const r=n||/* @__PURE__ */new Set;if(e){if(z(e))r.add(e);else if(z(e.buffer))r.add(e.buffer);else if(ArrayBuffer.isView(e));else if(t&&"object"==typeof e)for(const o in e)V(e[o],t,r)}else;return void 0===n?Array.from(r):[]}function z(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}const Y=()=>{};class K{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return"undefined"!=typeof Worker&&v||void 0!==H&&!v}constructor(e){const{name:t,source:n,url:r}=e;w(n||r),this.name=t,this.source=n,this.url=r,this.onMessage=Y,this.onError=e=>{},this.worker=v?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Y,this.onError=Y,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,t){t=t||V(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=`${e.message} in `),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=k({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},e.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},e.onmessageerror=e=>{},e}_createNodeWorker(){let e;if(this.url){const t=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,n=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";e=new H(t,{eval:!1,type:n})}else{if(!this.source)throw new Error("no worker");e=new H(this.source,{eval:!0})}return e.on("message",e=>{this.onMessage(e)}),e.on("error",e=>{this.onError(e)}),e.on("exit",e=>{}),e}}class Z{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return K.isSupported()}constructor(e){this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}async startJob(e,t=(e,t,n)=>e.done(n),n=(e,t)=>e.error(t)){const r=new Promise(r=>(this.jobQueue.push({name:e,onMessage:t,onError:n,onStart:r}),this));return this._startQueuedJob(),await r}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});const r=new W(t.name,e);e.onMessage=e=>t.onMessage(r,e.type,e.payload),e.onError=e=>t.onError(r,e),t.onStart(r);try{await r.result}catch(n){}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!v||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;const e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new K({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return x?this.maxMobileConcurrency:this.maxConcurrency}}const q={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class Q{props;workerPools=/* @__PURE__ */new Map;static _workerFarm;static isSupported(){return K.isSupported()}static getWorkerFarm(e={}){return Q._workerFarm=Q._workerFarm||new Q({}),Q._workerFarm.setProps(e),Q._workerFarm}constructor(e){this.props={...q},this.setProps(e),this.workerPools=/* @__PURE__ */new Map}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=/* @__PURE__ */new Map}setProps(e){this.props={...this.props,...e};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:t,source:n,url:r}=e;let o=this.workerPools.get(t);return o||(o=new Z({name:t,source:n,url:r}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}async function J(e,t,n,r,o){const i=e.id,s=function(e,t={}){const n=t[e.id]||{},r=v?`${e.id}-worker.js`:`${e.id}-worker-node.js`;let o=n.workerUrl;if(o||"compression"!==e.id||(o=t.workerUrl),"test"===(t._workerType||t?.core?._workerType)&&(o=v?`modules/${e.module}/dist/${r}`:`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!o){let t=e.version;"latest"===t&&(t="latest");const n=t?`@${t}`:"";o=`https://unpkg.com/@loaders.gl/${e.module}${n}/dist/${r}`}return w(o),o}(e,n),a=Q.getWorkerFarm(n?.core).getWorkerPool({name:i,url:s});n=JSON.parse(JSON.stringify(n)),r=JSON.parse(JSON.stringify(r||{}));const c=await a.startJob("process-on-worker",ee.bind(null,o));c.postMessage("process",{input:t,options:n,context:r});const l=await c.result;return await l.result}async function ee(e,t,n,r){switch(n){case"done":t.done(r);break;case"error":t.error(new Error(r.error));break;case"process":const{id:n,input:i,options:s}=r;try{const r=await e(i,s);t.postMessage("done",{id:n,result:r})}catch(o){const e=o instanceof Error?o.message:"unknown error";t.postMessage("error",{id:n,error:e})}}}function te(...e){return function(e){const t=e.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),n=t.reduce((e,t)=>e+t.byteLength,0),r=new Uint8Array(n);let o=0;for(const i of t)r.set(i,o),o+=i.byteLength;return r.buffer}(e)}function ne(e,t,n){const r=void 0!==n?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}function re(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){const{buffer:t,byteOffset:n,byteLength:r}=e;return oe(t,n,r)}return oe(e)}function oe(e,t=0,n=e.byteLength-t){const r=new Uint8Array(e,t,n),o=new Uint8Array(r.length);return o.set(r),o.buffer}function ie(){let e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if("undefined"!=typeof process&&process.hrtime){const t=process.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}class se{constructor(e,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=ie(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(ie()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class ae{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(const e of Object.values(this.stats))e.reset();return this}forEach(e){for(const t of Object.values(this.stats))e(t)}getTable(){const e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(e=>this._getOrCreate(e))}_getOrCreate(e){const{name:t,type:n}=e;let r=this.stats[t];return r||(r=e instanceof se?e:new se(t,n),this.stats[t]=r),r}}const ce={};function le(e){for(const t in ce)if(e.startsWith(t)){const n=ce[t];e=e.replace(t,n)}return e.startsWith("http://")||e.startsWith("https://")||(e=`${e}`),e}function _e(e){return e&&"object"==typeof e&&e.isBuffer}function ue(e){if(_e(e))return e;if(e instanceof ArrayBuffer)return e;if(b(e))return he(e);if(ArrayBuffer.isView(e)){const t=e.buffer;return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.byteLength)}if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function Ee(e){if(e instanceof ArrayBuffer)return e;if(b(e))return he(e);const{buffer:t,byteOffset:n,byteLength:r}=e;return t instanceof ArrayBuffer&&0===n&&r===t.byteLength?t:he(t,n,r)}function he(e,t=0,n=e.byteLength-t){const r=new Uint8Array(e,t,n),o=new Uint8Array(r.length);return o.set(r),o.buffer}function fe(){if("undefined"!=typeof process&&void 0!==process.cwd)return process.cwd();const e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function de(e){const t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):e}function pe(e){const t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function Te(...e){const t=[];for(let i=0;i<e.length;i++)t[i]=e[i];let n,r="",o=!1;for(let i=t.length-1;i>=-1&&!o;i--){let e;i>=0?e=t[i]:(void 0===n&&(n=fe()),e=n),0!==e.length&&(r=`${e}/${r}`,o=e.charCodeAt(0)===Re)}return r=function(e,t){let n,r="",o=-1,i=0,s=!1;for(let a=0;a<=e.length;++a){if(a<e.length)n=e.charCodeAt(a);else{if(n===Re)break;n=Re}if(n===Re){if(o===a-1||1===i);else if(o!==a-1&&2===i){if(r.length<2||!s||r.charCodeAt(r.length-1)!==Ae||r.charCodeAt(r.length-2)!==Ae)if(r.length>2){const e=r.length-1;let t=e;for(;t>=0&&r.charCodeAt(t)!==Re;--t);if(t!==e){r=-1===t?"":r.slice(0,t),o=a,i=0,s=!1;continue}}else if(2===r.length||1===r.length){r="",o=a,i=0,s=!1;continue}t&&(r.length>0?r+="/..":r="..",s=!0)}else{const t=e.slice(o+1,a);r.length>0?r+=`/${t}`:r=t,s=!1}o=a,i=0}else n===Ae&&-1!==i?++i:i=-1}return r}(r,!o),o?`/${r}`:r.length>0?r:"."}const Re=47,Ae=46;class ge extends Error{constructor(e,t){super(e),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response}const me=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Se=/^([-\w.]+\/[-\w.+]+)/;function Me(e,t){return e.toLowerCase()===t.toLowerCase()}function Ne(e){const t=me.exec(e);return t?t[1]:""}const Oe=/\?.*/;function Ce(e){return e.replace(Oe,"")}function Ie(e){if(P(e))return e.url;if(y(e)){return("name"in e?e.name:"")||""}return"string"==typeof e?e:""}function be(e){if(P(e)){const t=e.headers.get("content-type")||"",n=Ce(e.url);return function(e){const t=Se.exec(e);return t?t[1]:e}(t)||Ne(n)}return y(e)?e.type||"":"string"==typeof e?Ne(e):""}async function Le(e){if(P(e))return e;const t={},n=function(e){if(P(e))return e.headers["content-length"]||-1;if(y(e))return e.size;return"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}(e);n>=0&&(t["content-length"]=String(n));const r=Ie(e),o=be(e);o&&(t["content-type"]=o);const i=await async function(e){const t=5;if("string"==typeof e)return`data:,${e.slice(0,t)}`;if(e instanceof Blob){const t=e.slice(0,5);return await new Promise(e=>{const n=new FileReader;n.onload=t=>e(t?.target?.result),n.readAsDataURL(t)})}if(e instanceof ArrayBuffer){return`data:base64,${function(e){let t="";const n=new Uint8Array(e);for(let r=0;r<n.byteLength;r++)t+=String.fromCharCode(n[r]);return btoa(t)}(e.slice(0,t))}`}return null}(e);i&&(t["x-first-bytes"]=i),"string"==typeof e&&(e=(new TextEncoder).encode(e));const s=new Response(e,{headers:t});return Object.defineProperty(s,"url",{value:r}),s}async function Pe(e){if(!e.ok){const t=await async function(e){const n=function(e){if(e.length<50)return e;const t=e.slice(e.length-15);return`${e.substr(0,32)}...${t}`}(e.url);let r=`Failed to fetch resource (${e.status}) ${e.statusText}: ${n}`;r=r.length>100?`${r.slice(0,100)}...`:r;const o={reason:e.statusText,url:e.url,response:e};try{const t=e.headers.get("Content-Type");o.reason=!e.bodyUsed&&t?.includes("application/json")?await e.json():await e.text()}catch(t){}return new ge(r,o)}(e);throw t}}async function ye(e,t){if("string"==typeof e){const n=le(e);return function(e){return!function(e){return e.startsWith("http:")||e.startsWith("https:")}(e)&&!function(e){return e.startsWith("data:")}(e)}(n)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(n,t):await fetch(n,t)}return await Le(e)}const De=new g({id:"loaders.gl"});class Ue{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const Be={core:{baseUrl:void 0,fetch:null,mimeType:void 0,fallbackMimeType:void 0,ignoreRegisteredLoaders:void 0,nothrow:!1,log:new class{console;constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}},useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:t,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]}},Fe={baseUri:"core.baseUrl",fetch:"core.fetch",mimeType:"core.mimeType",fallbackMimeType:"core.fallbackMimeType",ignoreRegisteredLoaders:"core.ignoreRegisteredLoaders",nothrow:"core.nothrow",log:"core.log",useLocalLibraries:"core.useLocalLibraries",CDN:"core.CDN",worker:"core.worker",maxConcurrency:"core.maxConcurrency",maxMobileConcurrency:"core.maxMobileConcurrency",reuseWorkers:"core.reuseWorkers",_nodeWorkers:"core.nodeWorkers",_workerType:"core._workerType",_worker:"core._workerType",limit:"core.limit",_limitMB:"core._limitMB",batchSize:"core.batchSize",batchDebounceMs:"core.batchDebounceMs",metadata:"core.metadata",transforms:"core.transforms",throws:"nothrow",dataType:"(no longer used)",uri:"core.baseUrl",method:"core.fetch.method",headers:"core.fetch.headers",body:"core.fetch.body",mode:"core.fetch.mode",credentials:"core.fetch.credentials",cache:"core.fetch.cache",redirect:"core.fetch.redirect",referrer:"core.fetch.referrer",referrerPolicy:"core.fetch.referrerPolicy",integrity:"core.fetch.integrity",keepalive:"core.fetch.keepalive",signal:"core.fetch.signal"},we=["baseUrl","fetch","mimeType","fallbackMimeType","ignoreRegisteredLoaders","nothrow","log","useLocalLibraries","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms"];function ve(){globalThis.loaders=globalThis.loaders||{};const{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function Ge(){const e=ve();return e.globalOptions=e.globalOptions||{...Be,core:{...Be.core}},je(e.globalOptions)}function xe(e,t,n,r){return n=n||[],function(e,t){We(e,null,Be,Fe,t);for(const n of t){const r=e&&e[n.id]||{},o=n.options&&n.options[n.id]||{},i=n.deprecatedOptions&&n.deprecatedOptions[n.id]||{};We(r,n.id,o,i,t)}}(e,n=Array.isArray(n)?n:[n]),je(function(e,t,n){const r=e.options||{},o={...r};r.core&&(o.core={...r.core});ke(o),null===o.core?.log&&(o.core={...o.core,log:new Ue});Xe(o,je(Ge()));const i=je(t);return Xe(o,i),function(e,t){if(!t)return;const n=void 0!==e.core?.baseUrl;n||(e.core||={},e.core.baseUrl=pe(Ce(t)))}(o,n),function(e){const t=e.core;if(!t)return;for(const n of we)void 0!==t[n]&&(e[n]=t[n])}(o),o}(t,e,r))}function je(e){const t=function(e){const t={...e};e.core&&(t.core={...e.core});return t}(e);ke(t);for(const n of we)t.core&&void 0!==t.core[n]&&delete t[n];return t.core&&void 0!==t.core._workerType&&delete t._worker,t}function We(e,t,n,r,o){const i=t||"Top level",s=t?`${t}.`:"";for(const a in e){const c=!t&&C(e[a]);if(!(a in n)&&!("baseUri"===a&&!t)&&!("workerUrl"===a&&t))if(a in r)De.level>0&&De.warn(`${i} loader option '${s}${a}' no longer supported, use '${r[a]}'`)();else if(!c&&De.level>0){const e=He(a,o);De.warn(`${i} loader option '${s}${a}' not recognized. ${e}`)()}}}function He(e,t){const n=e.toLowerCase();let r="";for(const o of t)for(const t in o.options){if(e===t)return`Did you mean '${o.id}.${t}'?`;const i=t.toLowerCase();(n.startsWith(i)||i.startsWith(n))&&(r=r||`Did you mean '${o.id}.${t}'?`)}return r}function Xe(e,t){for(const n in t)if(n in t){const r=t[n];I(r)&&I(e[n])?e[n]={...e[n],...t[n]}:e[n]=t[n]}}function ke(e){void 0!==e.baseUri&&(e.core||={},void 0===e.core.baseUrl&&(e.core.baseUrl=e.baseUri));for(const n of we)if(void 0!==e[n]){const t=e.core=e.core||{};void 0===t[n]&&(t[n]=e[n])}const t=e._worker;void 0!==t&&(e.core||={},void 0===e.core._workerType&&(e.core._workerType=t))}function $e(e){if(!e)return!1;Array.isArray(e)&&(e=e[0]);return Array.isArray(e?.extensions)}function Ve(t){let n;return e(t,"null loader"),e($e(t),"invalid loader"),Array.isArray(t)&&(n=t[1],t=t[0],t={...t,options:{...t.options,...n}}),(t?.parseTextSync||t?.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}const ze=()=>{const e=ve();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Ye(e){const t=ze();e=Array.isArray(e)?e:[e];for(const n of e){const e=Ve(n);t.find(t=>e===t)||t.unshift(e)}}const Ke=/\.([^.]+)$/;function Ze(e){const t=be(e);return Boolean(t&&(t.startsWith("text/")||"application/json"===t||t.endsWith("+json")))}function qe(e,t=[],n,r){if(!Qe(e))return null;const o=je(n||{});if(o.core||={},t&&!Array.isArray(t))return Ve(t);let i=[];t&&(i=i.concat(t)),o.core.ignoreRegisteredLoaders||i.push(...ze()),function(e){for(const t of e)Ve(t)}(i);const s=function(e,t,n,r){const o=Ie(e),i=be(e),s=Ce(o)||r?.url;let a=null,c="";n?.core?.mimeType&&(a=et(t,n?.core?.mimeType),c=`match forced by supplied MIME type ${n?.core?.mimeType}`);a=a||function(e,t){const n=t&&Ke.exec(t),r=n&&n[1];return r?function(e,t){t=t.toLowerCase();for(const n of e)for(const e of n.extensions)if(e.toLowerCase()===t)return n;return null}(e,r):null}(t,s),c=c||(a?`matched url ${s}`:""),a=a||et(t,i),c=c||(a?`matched MIME type ${i}`:""),a=a||function(e,t){if(!t)return null;for(const n of e)if("string"==typeof t){if(tt(t,n))return n}else if(ArrayBuffer.isView(t)){if(nt(t.buffer,t.byteOffset,n))return n}else if(t instanceof ArrayBuffer){if(nt(t,0,n))return n}return null}(t,e),c=c||(a?`matched initial data ${rt(e)}`:""),n?.core?.fallbackMimeType&&(a=a||et(t,n?.core?.fallbackMimeType),c=c||(a?`matched fallback MIME type ${i}`:""));c&&N.log(1,`selectLoader selected ${a?.name}: ${c}.`);return a}(e,i,o,r);if(!s&&!o.core.nothrow)throw new Error(Je(e));return s}function Qe(e){return!(e instanceof Response&&204===e.status)}function Je(e){const t=Ie(e),n=be(e);let r="No valid loader found (";r+=t?`${de(t)}, `:"no url provided, ",r+=`MIME type: ${n?`"${n}"`:"not provided"}, `;const o=e?rt(e):"";return r+=o?` first bytes: "${o}"`:"first bytes: not available",r+=")",r}function et(e,t){for(const n of e){if(n.mimeTypes?.some(e=>Me(t,e)))return n;if(Me(t,`application/x.${n.id}`))return n}return null}function tt(e,t){if(t.testText)return t.testText(e);return(Array.isArray(t.tests)?t.tests:[t.tests]).some(t=>e.startsWith(t))}function nt(e,t,n){return(Array.isArray(n.tests)?n.tests:[n.tests]).some(n=>function(e,t,n,r){if(L(r))return function(e,t,n){if(n=n||e.byteLength,e.byteLength<n||t.byteLength<n)return!1;const r=new Uint8Array(e),o=new Uint8Array(t);for(let i=0;i<r.length;++i)if(r[i]!==o[i])return!1;return!0}(r,e,r.byteLength);switch(typeof r){case"function":return r(Ee(e));case"string":return r===ot(e,t,r.length);default:return!1}}(e,t,0,n))}function rt(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return ot(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return ot(e,0,t)}return""}function ot(e,t,n){if(e.byteLength<t+n)return"";const r=new DataView(e);let o="";for(let i=0;i<n;i++)o+=String.fromCharCode(r.getUint8(t+i));return o}const it=262144;function st(e,n){return t?async function*(e,t){const n=e.getReader();let r;try{for(;;){const e=r||n.read();t?._streamReadAhead&&(r=n.read());const{done:o,value:i}=await e;if(o)return;yield ue(i)}}catch(o){n.releaseLock()}}(e,n):async function*(e){for await(const t of e)yield ue(t)}(e)}function at(e,t){if("string"==typeof e)return function*(e,t){const n=t?.chunkSize||262144;let r=0;const o=new TextEncoder;for(;r<e.length;){const t=Math.min(e.length-r,n),i=e.slice(r,r+t);r+=t,yield Ee(o.encode(i))}}(e,t);if(e instanceof ArrayBuffer)return function*(e,t={}){const{chunkSize:n=it}=t;let r=0;for(;r<e.byteLength;){const t=Math.min(e.byteLength-r,n),o=new ArrayBuffer(t),i=new Uint8Array(e,r,t);new Uint8Array(o).set(i),r+=t,yield o}}(e,t);if(y(e))return async function*(e,t){const n=t?.chunkSize||1048576;let r=0;for(;r<e.size;){const t=r+n,o=await e.slice(r,t).arrayBuffer();r=t,yield o}}(e,t);if(D(e))return st(e,t);if(P(e)){const n=e.body;if(!n)throw new Error("Readable stream not available on Response");return st(n,t)}throw new Error("makeIterator")}const ct="Cannot convert supplied data type";function lt(e,t,n){if(t.text&&"string"==typeof e)return e;if(_e(e)&&(e=e.buffer),L(e)){const n=function(e){return ArrayBuffer.isView(e)?e:new Uint8Array(e)}(e);if(t.text&&!t.binary){return new TextDecoder("utf8").decode(n)}return ue(n)}throw new Error(ct)}async function _t(e,t,n){if("string"==typeof e||L(e))return lt(e,t);if(y(e)&&(e=await Le(e)),P(e))return await Pe(e),t.binary?await e.arrayBuffer():await e.text();if(D(e)&&(e=at(e,n)),r=e,Boolean(r)&&O(r[Symbol.iterator])||(e=>Boolean(e)&&O(e[Symbol.asyncIterator]))(e))return async function(e){const t=[];for await(const n of e)t.push(re(n));return te(...t)}(e);var r;throw new Error(ct)}function ut(e,t){const n=Ge(),r=e||n,o=r.fetch??r.core?.fetch;return"function"==typeof o?o:C(o)?e=>ye(e,o):t?.fetch?t?.fetch:ye}function Et(e,t,n){if(n)return n;const r={fetch:ut(t,e),...e};if(r.url){const e=Ce(r.url);r.baseUrl=e,r.queryString=function(e){const t=e.match(Oe);return t&&t[0]}(r.url),r.filename=de(e),r.baseUrl=pe(e)}return Array.isArray(r.loaders)||(r.loaders=null),r}async function ht(e,t,n,r){!t||Array.isArray(t)||$e(t)||(r=void 0,n=t,t=void 0),n=n||{};const o=Ie(e=await e),i=function(e,t){if(e&&!Array.isArray(e))return e;let n;if(e&&(n=Array.isArray(e)?e:[e]),t&&t.loaders){const e=Array.isArray(t.loaders)?t.loaders:[t.loaders];n=n?[...n,...e]:e}return n&&n.length?n:void 0}(t,r),s=await async function(e,t=[],n,r){if(!Qe(e))return null;const o=je(n||{});if(o.core||={},e instanceof Response&&Ze(e)){const n=qe(await e.clone().text(),t,{...o,core:{...o.core,nothrow:!0}},r);if(n)return n}let i=qe(e,t,{...o,core:{...o.core,nothrow:!0}},r);if(i)return i;y(e)&&(i=qe(e=await e.slice(0,10).arrayBuffer(),t,o,r)),!i&&e instanceof Response&&Ze(e)&&(i=qe(await e.clone().text(),t,o,r));if(!i&&!o.core.nothrow)throw new Error(Je(e));return i}(e,i,n);if(!s)return null;const a=xe(n,s,i,o);return r=Et({url:o,_parse:ht,loaders:i},a,r||null),await async function(e,t,n,r){if(function(e){w(e,"no worker provided");const t=e.version}(e),n=U(e.options,n),P(t)){const{ok:e,redirected:n,status:o,statusText:i,type:s,url:a}=t,c=Object.fromEntries(t.headers.entries());r.response={headers:c,ok:e,redirected:n,status:o,statusText:i,type:s,url:a}}t=await _t(t,e,n);const o=e;if(o.parseTextSync&&"string"==typeof t)return o.parseTextSync(t,n,r);if(function(e,t){if(!Q.isSupported())return!1;if(!v&&!(t?._nodeWorkers??t?.core?._nodeWorkers))return!1;const n=t?.worker??t?.core?.worker;return Boolean(e.worker&&n)}(e,n))return await J(e,t,n,r,ht);if(o.parseText&&"string"==typeof t)return await o.parseText(t,n,r);if(o.parse)return await o.parse(t,n,r);throw w(!o.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}(s,e,a,r)}async function ft(e,t,n,r){let o,i;Array.isArray(t)||$e(t)?(o=t,i=n):(o=[],i=t);const s=ut(i);let a=e;if("string"==typeof e&&(a=await s(e)),y(e)&&(a=await s(e)),"string"==typeof e){const t=je(i||{});t.core?.baseUrl||(i={...i,core:{...i?.core,baseUrl:e}})}return Array.isArray(o),await ht(a,o,i)}const dt=globalThis.loaders?.parseImageNode,pt="undefined"!=typeof Image,Tt="undefined"!=typeof ImageBitmap,Rt=Boolean(dt),At=!!t||Rt;function gt(e){const t=function(e){if("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)return"imagebitmap";if("undefined"!=typeof Image&&e instanceof Image)return"image";if(e&&"object"==typeof e&&e.data&&e.width&&e.height)return"data";return null}(e);if(!t)throw new Error("Not an image");return t}function mt(e){switch(gt(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}const St=/^data:image\/svg\+xml/,Mt=/\.svg((\?|#).*)?$/;function Nt(e){return e&&(St.test(e)||Mt.test(e))}function Ot(e,t){if(Nt(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ct(e,t,n){const r=function(e,t){if(Nt(t)){let t=(new TextDecoder).decode(e);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(t=unescape(encodeURIComponent(t)))}catch(n){throw new Error(n.message)}return`data:image/svg+xml;base64,${btoa(t)}`}return Ot(e,t)}(e,n),o=self.URL||self.webkitURL,i="string"!=typeof r&&o.createObjectURL(r);try{return await async function(e,t){const n=new Image;if(n.src=e,t.image&&t.image.decode&&n.decode)return await n.decode(),n;return await new Promise((e,t)=>{try{n.onload=()=>e(n),n.onerror=e=>{const n=e instanceof Error?e.message:"error";t(new Error(n))}}catch(r){t(r)}})}(i||r,t)}finally{i&&o.revokeObjectURL(i)}}let It=!0;async function bt(e,t,n){let r;if(Nt(n)){r=await Ct(e,t,n)}else r=Ot(e,n);const o=t&&t.imagebitmap;return await async function(e,t=null){!function(e){if(!e)return!0;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)&&It||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(n){It=!1}return await createImageBitmap(e)}(r,o)}function Lt(e){return function(e,t,n=0){const r=(o=t,[...o].map(e=>e.charCodeAt(0)));var o;for(let i=0;i<r.length;++i)if(r[i]!==e[i+n])return!1;return!0}(e,"ftyp",4)&&96&e[8]?function(e){switch((t=e,n=8,r=12,String.fromCharCode(...t.slice(n,r))).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}var t,n,r}(e):null}const Pt=!1,yt=!0;function Dt(e){const t=Ut(e);return function(e){const t=Ut(e),n=t.byteLength>=24&&2303741511===t.getUint32(0,Pt);if(!n)return null;return{mimeType:"image/png",width:t.getUint32(16,Pt),height:t.getUint32(20,Pt)}}(t)||function(e){const t=Ut(e),n=t.byteLength>=3&&65496===t.getUint16(0,Pt)&&255===t.getUint8(2);if(!n)return null;const{tableMarkers:r,sofMarkers:o}=function(){const e=/* @__PURE__ */new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);const t=/* @__PURE__ */new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let i=2;for(;i+9<t.byteLength;){const e=t.getUint16(i,Pt);if(o.has(e))return{mimeType:"image/jpeg",height:t.getUint16(i+5,Pt),width:t.getUint16(i+7,Pt)};if(!r.has(e))return null;i+=2,i+=t.getUint16(i,Pt)}return null}(t)||function(e){const t=Ut(e),n=t.byteLength>=10&&1195984440===t.getUint32(0,Pt);if(!n)return null;return{mimeType:"image/gif",width:t.getUint16(6,yt),height:t.getUint16(8,yt)}}(t)||function(e){const t=Ut(e),n=t.byteLength>=14&&16973===t.getUint16(0,Pt)&&t.getUint32(2,yt)===t.byteLength;if(!n)return null;return{mimeType:"image/bmp",width:t.getUint32(18,yt),height:t.getUint32(22,yt)}}(t)||function(e){const t=new Uint8Array(e instanceof DataView?e.buffer:e),n=Lt(t);if(!n)return null;return{mimeType:n.mimeType,width:0,height:0}}(t)}function Ut(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")}const Bt={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:"4.4.2",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],parse:async function(t,n,r){const o=((n=n||{}).image||{}).type||"auto",{url:i}=r||{};let s;switch(function(e){switch(e){case"auto":case"data":return function(){if(Tt)return"imagebitmap";if(pt)return"image";if(At)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return Tt||pt||At;case"imagebitmap":return Tt;case"image":return pt;case"data":return At;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}(e),e}}(o)){case"imagebitmap":s=await bt(t,n,i);break;case"image":s=await Ct(t,n,i);break;case"data":s=await async function(t){const{mimeType:n}=Dt(t)||{},r=globalThis.loaders?.parseImageNode;return e(r),await r(t,n)}(t);break;default:e(!1)}return"data"===o&&(s=mt(s)),s},tests:[e=>Boolean(Dt(new DataView(e)))],options:{image:{type:"auto",decode:!0}}},Ft=new g({id:"deck"}),wt={attributeUpdateStart:-1,attributeManagerUpdateStart:-1,attributeUpdateMessages:[]};let vt={};var Gt;function xt(e){vt=e}function jt(e,t,n,r){Ft.level>0&&vt[e]&&vt[e].call(null,t,n,r)}function Wt(e,t){if(!e){const e=new Error(t||"shadertools: assertion failed.");throw Error.captureStackTrace?.(e,Wt),e}}"production"!==process.env.NODE_ENV&&(Gt=Ft,vt={"layer.changeFlag":(e,t,n)=>{Gt.log(3,`${e.id} ${t}: `,n[t])()},"layer.initialize":e=>{Gt.log(1,`Initializing ${e}`)()},"layer.update":(e,t)=>{if(t){const t=e.getChangeFlags();Gt.log(2,`Updating ${e} because: ${Object.keys(t).filter(e=>t[e]).join(", ")}`)()}else Gt.log(4,`${e} does not need update`)()},"layer.matched":(e,t)=>{t&&Gt.log(4,`Matched ${e}, state transfered`)()},"layer.finalize":e=>{Gt.log(1,`Finalizing ${e}`)()},"compositeLayer.renderLayers":(e,t,n)=>{t?Gt.log(2,`Composite layer rendered new subLayers ${e}`,n)():Gt.log(4,`Composite layer reused subLayers ${e}`,n)()},"layerManager.setLayers":(e,t,n)=>{t&&Gt.log(2,`Updating ${n.length} deck layers`)()},"layerManager.activateViewport":(e,t)=>{Gt.log(3,"Viewport changed",t)()},"attributeManager.invalidate":(e,t,n)=>{Gt.log(1,n?`invalidated attributes ${n} (${t}) for ${e.id}`:`invalidated all attributes for ${e.id}`)()},"attributeManager.updateStart":e=>{wt.attributeUpdateMessages.length=0,wt.attributeManagerUpdateStart=Date.now()},"attributeManager.updateEnd":(e,t)=>{const n=Math.round(Date.now()-wt.attributeManagerUpdateStart);Gt.groupCollapsed(2,`Updated attributes for ${t} instances in ${e.id} in ${n}ms`)();for(const r of wt.attributeUpdateMessages)Gt.log(3,r)();Gt.groupEnd(2)()},"attribute.updateStart":e=>{wt.attributeUpdateStart=Date.now()},"attribute.allocate":(e,t)=>{const n=`${e.id} allocated ${t}`;wt.attributeUpdateMessages.push(n)},"attribute.updateEnd":(e,t)=>{const n=Math.round(Date.now()-wt.attributeUpdateStart),r=`${e.id} updated ${t} in ${n}ms`;wt.attributeUpdateMessages.push(r)},"deckRenderer.renderLayers":(e,t,n)=>{const{pass:r,redrawReason:o}=n;for(const i of t){const{totalCount:t,visibleCount:n,compositeCount:s,pickableCount:a}=i,c=t-s-n;Gt.log(2,`RENDER #${e.renderCount} ${n} (of ${t} layers) to ${r} because ${o} (${c} hidden, ${s} composite ${a} pickable)`)()}}});const Ht={number:{type:"number",validate:(e,t)=>Number.isFinite(e)&&"object"==typeof t&&(void 0===t.max||e<=t.max)&&(void 0===t.min||e>=t.min)},array:{type:"array",validate:(e,t)=>Array.isArray(e)||ArrayBuffer.isView(e)}};function Xt(e){let t=kt(e);if("object"!==t)return{value:e,...Ht[t],type:t};if("object"==typeof e)return e?void 0!==e.type?{...e,...Ht[e.type],type:e.type}:void 0===e.value?{type:"object",value:e}:(t=kt(e.value),{...e,...Ht[t],type:t}):{type:"object",value:null};throw new Error("props")}function kt(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}const $t={vertex:"#ifdef MODULE_LOGDEPTH\n logdepth_adjustPosition(gl_Position);\n#endif\n",fragment:"#ifdef MODULE_MATERIAL\n fragColor = material_filterColor(fragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n fragColor = lighting_filterColor(fragColor);\n#endif\n\n#ifdef MODULE_FOG\n fragColor = fog_filterColor(fragColor);\n#endif\n\n#ifdef MODULE_PICKING\n fragColor = picking_filterHighlightColor(fragColor);\n fragColor = picking_filterPickingColor(fragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n logdepth_setFragDepth();\n#endif\n"},Vt=/void\s+main\s*\([^)]*\)\s*\{\n?/,zt=/}\n?[^{}]*$/,Yt=[],Kt="__LUMA_INJECT_DECLARATIONS__";function Zt(e){const t={vertex:{},fragment:{}};for(const n in e){let r=e[n];"string"==typeof r&&(r={order:0,injection:r}),t[qt(n)][n]=r}return t}function qt(e){const t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function Qt(e,t,n,r=!1){const o="vertex"===t;for(const i in n){const t=n[i];t.sort((e,t)=>e.order-t.order),Yt.length=t.length;for(let e=0,n=t.length;e<n;++e)Yt[e]=t[e].injection;const r=`${Yt.join("\n")}\n`;switch(i){case"vs:#decl":o&&(e=e.replace(Kt,r));break;case"vs:#main-start":o&&(e=e.replace(Vt,e=>e+r));break;case"vs:#main-end":o&&(e=e.replace(zt,e=>r+e));break;case"fs:#decl":o||(e=e.replace(Kt,r));break;case"fs:#main-start":o||(e=e.replace(Vt,e=>e+r));break;case"fs:#main-end":o||(e=e.replace(zt,e=>r+e));break;default:e=e.replace(i,e=>e+r)}}return e=e.replace(Kt,""),r&&(e=e.replace(/\}\s*$/,e=>e+$t[t])),e}function Jt(e){e.map(e=>function(e){if(e.instance)return;Jt(e.dependencies||[]);const{propTypes:t={},deprecations:n=[],inject:r={}}=e,o={normalizedInjections:Zt(r),parsedDeprecations:tn(n)};t&&(o.propValidators=function(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Xt(r);return t}(t));e.instance=o;let i={};t&&(i=Object.entries(t).reduce((e,[t,n])=>{const r=n?.value;return r&&(e[t]=r),e},{}));e.defaultUniforms={...e.defaultUniforms,...i}}(e))}function en(e,t,n){e.deprecations?.forEach(e=>{e.regex?.test(t)&&(e.deprecated?n.deprecated(e.old,e.new)():n.removed(e.old,e.new)())})}function tn(e){return e.forEach(e=>{if("function"===e.type)e.regex=new RegExp(`\\b${e.old}\\(`);else e.regex=new RegExp(`${e.type} ${e.old};`)}),e}function nn(e){Jt(e);const t={},n={};rn({modules:e,level:0,moduleMap:t,moduleDepth:n});const r=Object.keys(n).sort((e,t)=>n[t]-n[e]).map(e=>t[e]);return Jt(r),r}function rn(e){const{modules:t,level:n,moduleMap:r,moduleDepth:o}=e;if(n>=5)throw new Error("Possible loop in shader dependency graph");for(const i of t)r[i.name]=i,(void 0===o[i.name]||o[i.name]<n)&&(o[i.name]=n);for(const i of t)i.dependencies&&rn({modules:i.dependencies,level:n+1,moduleMap:r,moduleDepth:o})}const on=/^(?:uniform\s+)?(?:(?:lowp|mediump|highp)\s+)?[A-Za-z0-9_]+(?:<[^>]+>)?\s+([A-Za-z0-9_]+)(?:\s*\[[^\]]+\])?\s*;/,sn=/((?:layout\s*\([^)]*\)\s*)*)uniform\s+([A-Za-z_][A-Za-z0-9_]*)\s*\{([\s\S]*?)\}\s*([A-Za-z_][A-Za-z0-9_]*)?\s*;/g;function an(e){return`${e.name}Uniforms`}function cn(e,t){const n="wgsl"===t?e.source:"vertex"===t?e.vs:e.fs;if(!n)return null;return function(e,t,n){const r="wgsl"===t?function(e,t){const n=new RegExp(`\\bstruct\\s+${t}\\b`,"m").exec(e);if(!n)return null;const r=e.indexOf("{",n.index);if(r<0)return null;let o=0;for(let i=r;i<e.length;i++){const t=e[i];if("{"!==t){if("}"===t&&(o--,0===o))return e.slice(r+1,i)}else o++}return null}(e,n):function(e,t){const n=_n(e).find(e=>e.blockName===t);return n?.body||null}(e,n);if(!r)return null;const o=[];for(const i of r.split("\n")){const e=i.replace(/\/\/.*$/,"").trim();if(!e||e.startsWith("#"))continue;const n="wgsl"===t?e.match(/^([A-Za-z0-9_]+)\s*:/):e.match(on);n&&o.push(n[1])}return o}(n,"wgsl"===t?"wgsl":"glsl",an(e))}function ln(e,t,n={}){const r=function(e,t){const n=Object.keys(e.uniformTypes||{});if(!n.length)return null;const r=cn(e,t);return r?{moduleName:e.name,uniformBlockName:an(e),stage:t,expectedUniformNames:n,actualUniformNames:r,matches:un(n,r)}:null}(e,t);if(!r||r.matches)return r;const o=function(e){const{expectedUniformNames:t,actualUniformNames:n}=e,r=t.filter(e=>!n.includes(e)),o=n.filter(e=>!t.includes(e)),i=[`Expected ${t.length} fields, found ${n.length}.`],s=function(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return`First mismatch at field ${r+1}: expected ${e[r]}, found ${t[r]}.`;if(e.length>t.length)return`Shader block ends after field ${t.length}; expected next field ${e[t.length]}.`;if(t.length>e.length)return`Shader block has extra field ${t.length}: ${t[e.length]}.`;return null}(t,n);s&&i.push(s);r.length&&i.push(`Missing from shader block (${r.length}): ${hn(r)}.`);o.length&&i.push(`Unexpected in shader block (${o.length}): ${hn(o)}.`);t.length<=12&&n.length<=12&&(r.length||o.length)&&(i.push(`Expected: ${t.join(", ")}.`),i.push(`Actual: ${n.join(", ")}.`));return`${e.moduleName}: ${e.stage} shader uniform block ${e.uniformBlockName} does not match module.uniformTypes. ${i.join(" ")}`}(r);return n.log?.error?.(o,r)(),!1!==n.throwOnError&&Wt(!1,o),r}function _n(e){const t=[],n=function(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"")}(e);for(const r of n.matchAll(sn)){const e=r[1]?.trim()||null;t.push({blockName:r[2],body:r[3],instanceName:r[4]||null,layoutQualifier:e,hasLayoutQualifier:Boolean(e),isStd140:Boolean(e&&/\blayout\s*\([^)]*\bstd140\b[^)]*\)/.exec(e))})}return t}function un(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function En(e){return e.replace(/\s+/g," ").trim()}function hn(e,t=8){if(e.length<=t)return e.join(", ");const n=e.length-t;return`${e.slice(0,t).join(", ")}, ... (${n} more)`}const fn=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,"#version 300 es\n"],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],dn=[...fn,[Rn("attribute"),"in $1"],[Rn("varying"),"out $1"]],pn=[...fn,[Rn("varying"),"in $1"]];function Tn(e,t){for(const[n,r]of t)e=e.replace(n,r);return e}function Rn(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function An(e,t){let n="";for(const r in e){const o=e[r];if(n+=`void ${o.signature} {\n`,o.header&&(n+=` ${o.header}`),t[r]){const e=t[r];e.sort((e,t)=>e.order-t.order);for(const t of e)n+=` ${t.injection}\n`}o.footer&&(n+=` ${o.footer}`),n+="}\n"}return n}function gn(e){const t={vertex:{},fragment:{}};for(const n of e){let e,r;"string"!=typeof n?(e=n,r=e.hook):(e={},r=n),r=r.trim();const[o,i]=r.split(":"),s=r.replace(/\(.+/,""),a=Object.assign(e,{signature:i});switch(o){case"vs":t.vertex[s]=a;break;case"fs":t.fragment[s]=a;break;default:throw new Error(o)}}return t}function mn(e,t="unnamed"){const n=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(e);return n?n[1]:t}function Sn(e){let t=100;const n=e.match(/[^\s]+/g);if(n&&n.length>=2&&"#version"===n[0]){const e=parseInt(n[1],10);Number.isFinite(e)&&(t=e)}if(100!==t&&300!==t)throw new Error(`Invalid GLSL version ${t}`);return t}const Mn="(?:var<\\s*(uniform|storage(?:\\s*,\\s*[A-Za-z_][A-Za-z0-9_]*)?)\\s*>|var)\\s+([A-Za-z_][A-Za-z0-9_]*)",Nn="\\s*",On=[new RegExp(`@binding\\(\\s*(auto|\\d+)\\s*\\)${Nn}@group\\(\\s*(\\d+)\\s*\\)${Nn}${Mn}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)${Nn}@binding\\(\\s*(auto|\\d+)\\s*\\)${Nn}${Mn}`,"g")],Cn=[new RegExp(`@binding\\(\\s*(auto|\\d+)\\s*\\)${Nn}@group\\(\\s*(\\d+)\\s*\\)${Nn}${Mn}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)${Nn}@binding\\(\\s*(auto|\\d+)\\s*\\)${Nn}${Mn}`,"g")],In=[new RegExp(`@binding\\(\\s*(\\d+)\\s*\\)${Nn}@group\\(\\s*(\\d+)\\s*\\)${Nn}${Mn}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)${Nn}@binding\\(\\s*(\\d+)\\s*\\)${Nn}${Mn}`,"g")],bn=[new RegExp(`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${Mn}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)\\s*${Mn}`,"g"),new RegExp(`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${Mn}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${Mn}`,"g")];function Ln(e){const t=e.split("");let n=0,r=0,o=!1,i=!1,s=!1;for(;n<e.length;){const a=e[n],c=e[n+1];if(i)s?s=!1:"\\"===a?s=!0:'"'===a&&(i=!1),n++;else if(o)"\n"===a||"\r"===a?o=!1:t[n]=" ",n++;else if(r>0){if("/"===a&&"*"===c){t[n]=" ",t[n+1]=" ",r++,n+=2;continue}if("*"===a&&"/"===c){t[n]=" ",t[n+1]=" ",r--,n+=2;continue}"\n"!==a&&"\r"!==a&&(t[n]=" "),n++}else'"'!==a?"/"!==a||"/"!==c?"/"!==a||"*"!==c?n++:(t[n]=" ",t[n+1]=" ",r=1,n+=2):(t[n]=" ",t[n+1]=" ",o=!0,n+=2):(i=!0,n++)}return t.join("")}function Pn(e,t){const n=Ln(e),r=[];for(const o of t){let i;for(o.lastIndex=0,i=o.exec(n);i;){const s=o===t[0],a=i.index,c=i[0].length;r.push({match:e.slice(a,a+c),index:a,length:c,bindingToken:i[s?1:2],groupToken:i[s?2:1],accessDeclaration:i[3]?.trim(),name:i[4]}),i=o.exec(n)}}return r.sort((e,t)=>e.index-t.index)}function yn(e,t,n){const r=Pn(e,t);if(!r.length)return e;let o="",i=0;for(const s of r)o+=e.slice(i,s.index),o+=n(s),i=s.index+s.length;return o+=e.slice(i),o}function Dn(e){return/@binding\(\s*auto\s*\)/.test(Ln(e))}const Un=[new RegExp(`@binding\\(\\s*(\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${Mn}\\s*:\\s*([^;]+);`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(\\d+)\\s*\\)\\s*${Mn}\\s*:\\s*([^;]+);`,"g")];function Bn(e,t=[]){const n=Ln(e),r=/* @__PURE__ */new Map;for(const i of t)r.set(wn(i.name,i.group,i.location),i.moduleName);const o=[];for(const i of Un){let e;for(i.lastIndex=0,e=i.exec(n);e;){const t=i===Un[0],s=Number(e[t?1:2]),a=Number(e[t?2:1]),c=e[3]?.trim(),l=e[4],_=e[5].trim(),u=r.get(wn(l,a,s));o.push(Fn({name:l,group:a,binding:s,owner:u?"module":"application",moduleName:u,accessDeclaration:c,resourceType:_})),e=i.exec(n)}}return o.sort((e,t)=>e.group!==t.group?e.group-t.group:e.binding!==t.binding?e.binding-t.binding:e.name.localeCompare(t.name))}function Fn(e){const t={name:e.name,group:e.group,binding:e.binding,owner:e.owner,kind:"unknown",moduleName:e.moduleName,resourceType:e.resourceType};if(e.accessDeclaration){const n=e.accessDeclaration.split(",").map(e=>e.trim());if("uniform"===n[0])return{...t,kind:"uniform",access:"uniform"};if("storage"===n[0]){const e=n[1]||"read_write";return{...t,kind:"read"===e?"read-only-storage":"storage",access:e}}}return"sampler"===e.resourceType||"sampler_comparison"===e.resourceType?{...t,kind:"sampler",samplerKind:"sampler_comparison"===e.resourceType?"comparison":"filtering"}:e.resourceType.startsWith("texture_storage_")?{...t,kind:"storage-texture",access:xn(e.resourceType),viewDimension:vn(e.resourceType)}:e.resourceType.startsWith("texture_")?{...t,kind:"texture",viewDimension:vn(e.resourceType),sampleType:Gn(e.resourceType),multisampled:e.resourceType.startsWith("texture_multisampled_")}:t}function wn(e,t,n){return`${t}:${n}:${e}`}function vn(e){return e.includes("cube_array")?"cube-array":e.includes("2d_array")?"2d-array":e.includes("cube")?"cube":e.includes("3d")?"3d":e.includes("2d")?"2d":e.includes("1d")?"1d":void 0}function Gn(e){return e.startsWith("texture_depth_")?"depth":e.includes("<i32>")?"sint":e.includes("<u32>")?"uint":e.includes("<f32>")?"float":void 0}function xn(e){const t=/,\s*([A-Za-z_][A-Za-z0-9_]*)\s*>$/.exec(e);return t?.[1]}const jn=`\n\n${Kt}\n`,Wn=100;function Hn(e){const t=nn(e.modules||[]),{source:n,bindingAssignments:r}=function(e,t){const{source:n,stage:r,modules:o,hookFunctions:i=[],inject:s={},log:a}=t;Wt("string"==typeof n,"shader source must be a string");const c=n;let l="";const _=gn(i),u={},E={},h={};for(const A in s){const e="string"==typeof s[A]?{injection:s[A],order:0}:s[A],t=/^(v|f)s:(#)?([\w-]+)$/.exec(A);if(t){const n=t[2],r=t[3];n?"decl"===r?E[A]=[e]:h[A]=[e]:u[A]=[e]}else h[A]=[e]}const f=o,d=function(e){const t=Pn(e,Cn),n=/* @__PURE__ */new Map;for(const i of t){if("auto"===i.bindingToken)continue;const e=Number(i.bindingToken),t=Number(i.groupToken);Yn(t,e,i.name),Zn(n,t,e,`application binding "${i.name}"`)}const r={sawSupportedBindingDeclaration:t.length>0},o=yn(e,Cn,e=>function(e,t,n){const{match:r,bindingToken:o,groupToken:i,name:s}=e,a=Number(i);if("auto"===o){const e=function(e,t){const n=t.get(e)||/* @__PURE__ */new Set;let r=0;for(;n.has(r);)r++;return r}(a,t);return Yn(a,e,s),Zn(t,a,e,`application binding "${s}"`),r.replace(/@binding\(\s*auto\s*\)/,`@binding(${e})`)}return n.sawSupportedBindingDeclaration=!0,r}(e,n,r));if(Dn(e)&&!r.sawSupportedBindingDeclaration)throw new Error('Unsupported @binding(auto) declaration form in application WGSL. Use adjacent "@group(N)" and "@binding(auto)" decorators followed by a bindable "var" declaration.');return{source:o}}(c),p=function(e){const t=/* @__PURE__ */new Map;for(const n of Pn(e,In)){const e=Number(n.bindingToken),r=Number(n.groupToken);Yn(r,e,n.name),Zn(t,r,e,`application binding "${n.name}"`)}return t}(d.source),T=function(e,t,n){const r=/* @__PURE__ */new Map;if(!t)return r;for(const o of e)for(const e of zn(o)){const i=Qn(e.group,o.name,e.name),s=t.get(i);if(void 0!==s){const t=r.get(e.group)||/* @__PURE__ */new Map,o=t.get(s);if(o&&o!==i)throw new Error(`Duplicate WGSL binding reservation for modules "${o}" and "${i}": group ${e.group}, binding ${s}.`);Zn(n,e.group,s,`registered module binding "${i}"`),t.set(s,i),r.set(e.group,t)}}return r}(f,t._bindingRegistry,p),R=[];for(const A of f){a&&en(A,c,a);const e=Vn($n(A,"wgsl",a),A,{usedBindingsByGroup:p,bindingRegistry:t._bindingRegistry,reservedBindingKeysByGroup:T});R.push(...e.bindingAssignments);l+=e.source;const n=A.injections?.[r]||{};for(const t in n){const e=/^(v|f)s:#([\w-]+)$/.exec(t);if(e){const r="decl"===e[2]?E:h;r[t]=r[t]||[],r[t].push(n[t])}else u[t]=u[t]||[],u[t].push(n[t])}}return l+=jn,l=Qt(l,r,E),l+=An(_[r],u),l+=function(e){if(0===e.length)return"";let t="// ----- MODULE WGSL BINDING ASSIGNMENTS ---------------\n";for(const n of e)t+=`// ${n.moduleName}.${n.name} -> @group(${n.group}) @binding(${n.location})\n`;return t+="\n",t}(R),l+=d.source,l=Qt(l,r,h),function(e){const t=function(e,t){return Pn(e,t===On||t===Cn?bn:t).find(e=>"auto"===e.bindingToken)}(e,On);if(!t)return;const n=function(e,t){const n=/^\/\/ ----- MODULE ([^\n]+) ---------------$/gm;let r,o;o=n.exec(e);for(;o&&o.index<=t;)r=o[1],o=n.exec(e);return r}(e,t.index);if(n)throw new Error(`Unresolved @binding(auto) for module "${n}" binding "${t.name}" remained in assembled WGSL source.`);if(function(e,t){const n=e.indexOf(jn);return!(n>=0)||t>n}(e,t.index))throw new Error(`Unresolved @binding(auto) for application binding "${t.name}" remained in assembled WGSL source.`);throw new Error(`Unresolved @binding(auto) remained in assembled WGSL source near "${function(e){return e.replace(/\s+/g," ").trim()}(t.match)}".`)}(l),{source:l,bindingAssignments:R}}(e.platformInfo,{...e,source:e.source,stage:"vertex",modules:t});return{source:n,getUniforms:kn(t),bindingAssignments:r,bindingTable:Bn(n,r)}}function Xn(e,t){const{source:n,stage:r,language:o="glsl",modules:i,defines:s={},hookFunctions:a=[],inject:c={},prologue:l=!0,log:_}=t;Wt("string"==typeof n,"shader source must be a string");const u="glsl"===o?function(e,t){return{name:mn(e,t),language:"glsl",version:Sn(e)}}(n).version:-1,E=e.shaderLanguageVersion,h=100===u?"#version 100":"#version 300 es",f=n.split("\n").slice(1).join("\n"),d={};i.forEach(e=>{Object.assign(d,e.defines)}),Object.assign(d,s);let p="";switch(o){case"wgsl":break;case"glsl":p=l?`${h}\n\n// ----- PROLOGUE -------------------------\n#define SHADER_TYPE_${r.toUpperCase()}\n\n${function(e){switch(e?.gpu.toLowerCase()){case"apple":return"#define APPLE_GPU\n// Apple optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";case"nvidia":return"#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n";case"intel":return"#define INTEL_GPU\n// Intel optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";case"amd":return"#define AMD_GPU\n";default:return"#define DEFAULT_GPU\n// Prevent driver from optimizing away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Headless Chrome's software shader 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// If the GPU doesn't have full 32 bits precision, will causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n"}}(e)}\n${"fragment"===r?"precision highp float;\n":""}\n\n// ----- APPLICATION DEFINES -------------------------\n\n${function(e={}){let t="";for(const n in e){const r=e[n];(r||Number.isFinite(r))&&(t+=`#define ${n.toUpperCase()} ${e[n]}\n`)}return t}(d)}\n\n`:`${h}\n`}const T=gn(a),R={},A={},g={};for(const m in c){const e="string"==typeof c[m]?{injection:c[m],order:0}:c[m],t=/^(v|f)s:(#)?([\w-]+)$/.exec(m);if(t){const n=t[2],r=t[3];n?"decl"===r?A[m]=[e]:g[m]=[e]:R[m]=[e]}else g[m]=[e]}for(const m of i){_&&en(m,f,_);p+=$n(m,r,_);const e=m.instance?.normalizedInjections[r]||{};for(const t in e){const n=/^(v|f)s:#([\w-]+)$/.exec(t);if(n){const r="decl"===n[2]?A:g;r[t]=r[t]||[],r[t].push(e[t])}else R[t]=R[t]||[],R[t].push(e[t])}}return p+="// ----- MAIN SHADER SOURCE -------------------------",p+=jn,p=Qt(p,r,A),p+=An(T[r],R),p+=f,p=Qt(p,r,g),"glsl"===o&&u!==E&&(p=function(e,t){if(300!==Number(e.match(/^#version[ \t]+(\d+)/m)?.[1]||100))throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(t){case"vertex":return Tn(e,dn);case"fragment":return Tn(e,pn);default:throw new Error(t)}}(p,r)),"glsl"===o&&function(e,t,n){const r=_n(e).filter(e=>!e.isStd140),o=/* @__PURE__ */new Set;for(const i of r){if(o.has(i.blockName))continue;o.add(i.blockName);const e="",r=i.hasLayoutQualifier?`declares ${En(i.layoutQualifier)} instead of layout(std140)`:"does not declare layout(std140)",s=`${e}${t} shader uniform block ${i.blockName} ${r}. luma.gl host-side shader block packing assumes explicit layout(std140) for GLSL uniform blocks. Add \`layout(std140)\` to the block declaration.`;n?.warn?.(s,i)()}}(p,r,_),p.trim()}function kn(e){return function(t){const n={};for(const r of e){const e=r.getUniforms?.(t,n);Object.assign(n,e)}return n}}function $n(e,t,n){let r;switch(t){case"vertex":r=e.vs||"";break;case"fragment":r=e.fs||"";break;case"wgsl":r=e.source||"";break;default:Wt(!1)}if(!e.name)throw new Error("Shader module must have a name");ln(e,t,{log:n});const o=e.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");let i=`// ----- MODULE ${e.name} ---------------\n\n`;return"wgsl"!==t&&(i+=`#define MODULE_${o}\n`),i+=`${r}\n`,i}function Vn(e,t,n){const r=[],o={sawSupportedBindingDeclaration:Pn(e,On).length>0,nextHintedBindingLocation:"number"==typeof t.firstBindingSlot?t.firstBindingSlot:null},i=yn(e,On,e=>function(e,t){const{module:n,context:r,bindingAssignments:o,relocationState:i}=t,{match:s,bindingToken:a,groupToken:c,name:l}=e,_=Number(c);if("auto"===a){const e=Qn(_,n.name,l),t=r.bindingRegistry?.get(e),a=void 0!==t?t:null===i.nextHintedBindingLocation?qn(_,r.usedBindingsByGroup):qn(_,r.usedBindingsByGroup,i.nextHintedBindingLocation);return Kn(n.name,_,a,l),void 0!==t&&function(e,t,n,r){const o=e.get(t);if(!o)return!1;const i=o.get(n);if(!i)return!1;if(i!==r)throw new Error(`Registered module binding "${r}" collided with "${i}": group ${t}, binding ${n}.`);return!0}(r.reservedBindingKeysByGroup,_,a,e)?(o.push({moduleName:n.name,name:l,group:_,location:a}),s.replace(/@binding\(\s*auto\s*\)/,`@binding(${a})`)):(Zn(r.usedBindingsByGroup,_,a,`module "${n.name}" binding "${l}"`),r.bindingRegistry?.set(e,a),o.push({moduleName:n.name,name:l,group:_,location:a}),null!==i.nextHintedBindingLocation&&void 0===t&&(i.nextHintedBindingLocation=a+1),s.replace(/@binding\(\s*auto\s*\)/,`@binding(${a})`))}const u=Number(a);return Kn(n.name,_,u,l),Zn(r.usedBindingsByGroup,_,u,`module "${n.name}" binding "${l}"`),o.push({moduleName:n.name,name:l,group:_,location:u}),s}(e,{module:t,context:n,bindingAssignments:r,relocationState:o}));if(Dn(e)&&!o.sawSupportedBindingDeclaration)throw new Error(`Unsupported @binding(auto) declaration form in module "${t.name}". Use adjacent "@group(N)" and "@binding(auto)" decorators followed by a bindable "var" declaration.`);return{source:i,bindingAssignments:r}}function zn(e){const t=[],n=e.source||"";for(const r of Pn(n,On))t.push({name:r.name,group:Number(r.groupToken)});return t}function Yn(e,t,n){if(0===e&&t>=Wn)throw new Error(`Application binding "${n}" in group 0 uses reserved binding ${t}. Application-owned explicit group-0 bindings must stay below 100.`)}function Kn(e,t,n,r){if(0===t&&n<Wn)throw new Error(`Module "${e}" binding "${r}" in group 0 uses reserved application binding ${n}. Module-owned explicit group-0 bindings must be 100 or higher.`)}function Zn(e,t,n,r){const o=e.get(t)||/* @__PURE__ */new Set;if(o.has(n))throw new Error(`Duplicate WGSL binding assignment for ${r}: group ${t}, binding ${n}.`);o.add(n),e.set(t,o)}function qn(e,t,n){const r=t.get(e)||/* @__PURE__ */new Set;let o=n??(0===e?Wn:r.size>0?Math.max(...r)+1:0);for(;r.has(o);)o++;return o}function Qn(e,t,n){return`${e}:${t}:${n}`}const Jn="([a-zA-Z_][a-zA-Z0-9_]*)",er=new RegExp(`^\\s*\\#\\s*ifdef\\s*${Jn}\\s*$`),tr=new RegExp(`^\\s*\\#\\s*ifndef\\s*${Jn}\\s*(?:\\/\\/.*)?$`),nr=/^\s*\#\s*else\s*(?:\/\/.*)?$/,rr=/^\s*\#\s*endif\s*$/,or=new RegExp(`^\\s*\\#\\s*ifdef\\s*${Jn}\\s*(?:\\/\\/.*)?$`),ir=/^\s*\#\s*endif\s*(?:\/\/.*)?$/;class sr{static defaultShaderAssembler;_hookFunctions=[];_defaultModules=[];_wgslBindingRegistry=/* @__PURE__ */new Map;static getDefaultShaderAssembler(){return sr.defaultShaderAssembler=sr.defaultShaderAssembler||new sr,sr.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(t=>t.name===("string"==typeof e?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){const t="string"==typeof e?e:e.name;this._defaultModules=this._defaultModules.filter(e=>e.name!==t)}addShaderHook(e,t){t&&(e=Object.assign(t,{hook:e})),this._hookFunctions.push(e)}assembleWGSLShader(e){const t=this._getModuleList(e.modules),n=this._hookFunctions,{source:r,getUniforms:o,bindingAssignments:i}=Hn({...e,source:e.source,_bindingRegistry:this._wgslBindingRegistry,modules:t,hookFunctions:n}),s={...t.reduce((e,t)=>(Object.assign(e,t.defines),e),{}),...e.defines},a="wgsl"===e.platformInfo.shaderLanguage?function(e,t){const n=e.split("\n"),r=[],o=[];let i=!0;for(const s of n){const e=s.match(or)||s.match(er),n=s.match(tr),a=s.match(nr),c=s.match(ir)||s.match(rr);if(e||n){const r=(e||n)?.[1],s=Boolean(t?.defines?.[r]),a=e?s:!s,c=i&&a;o.push({parentActive:i,branchTaken:a,active:c}),i=c}else if(a){const e=o[o.length-1];if(!e)throw new Error("Encountered #else without matching #ifdef or #ifndef");e.active=e.parentActive&&!e.branchTaken,e.branchTaken=!0,i=e.active}else c?(o.pop(),i=!o.length||o[o.length-1].active):i&&r.push(s)}if(o.length>0)throw new Error("Unterminated conditional block in shader source");return r.join("\n")}(r,{defines:s}):r;return{source:a,getUniforms:o,modules:t,bindingAssignments:i,bindingTable:Bn(a,i)}}assembleGLSLShaderPair(e){const t=this._getModuleList(e.modules),n=this._hookFunctions,r=function(e){const{vs:t,fs:n}=e,r=nn(e.modules||[]);return{vs:Xn(e.platformInfo,{...e,source:t,stage:"vertex",modules:r}),fs:Xn(e.platformInfo,{...e,source:n,stage:"fragment",modules:r}),getUniforms:kn(r)}}({...e,vs:e.vs,fs:e.fs,modules:t,hookFunctions:n});return{...r,modules:t}}_getModuleList(e=[]){const t=new Array(this._defaultModules.length+e.length),n={};let r=0;for(let o=0,i=this._defaultModules.length;o<i;++o){const e=this._defaultModules[o],i=e.name;t[r++]=e,n[i]=!0}for(let o=0,i=e.length;o<i;++o){const i=e[o],s=i.name;n[s]||(t[r++]=i,n[s]=!0)}return t.length=r,Jt(t),t}}const ar=1/Math.PI*180,cr=1/180*Math.PI;globalThis.mathgl=globalThis.mathgl||{config:{EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1}};const lr=globalThis.mathgl.config;function _r(e,{precision:t=lr.precision}={}){return e=function(e){return Math.round(e/lr.EPSILON)*lr.EPSILON}(e),`${parseFloat(e.toPrecision(t))}`}function ur(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Er(e){return function(e,t){return Rr(e,e=>e*cr,t)}(e)}function hr(e){return fr(e)}function fr(e,t){return Rr(e,e=>e*ar,t)}function dr(e,t,n){return Rr(e,e=>Math.max(t,Math.min(n,e)))}function pr(e,t,n){return ur(e)?e.map((e,r)=>pr(e,t[r],n)):n*t+(1-n)*e}function Tr(e,t,n){const r=lr.EPSILON;n&&(lr.EPSILON=n);try{if(e===t)return!0;if(ur(e)&&ur(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!Tr(e[n],t[n]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):"number"==typeof e&&"number"==typeof t&&Math.abs(e-t)<=lr.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{lr.EPSILON=r}}function Rr(e,t,n){if(ur(e)){const r=e;n=n||function(e){return e.clone?e.clone():new Array(e.length)}(r);for(let o=0;o<n.length&&o<r.length;++o){const r="number"==typeof e?e:e[o];n[o]=t(r,o,n)}return n}return t(e)}class Ar extends Array{clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+t];return this.check()}toArray(e=[],t=0){for(let n=0;n<this.ELEMENTS;++n)e[t+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:ur(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(lr)}formatString(e){let t="";for(let n=0;n<this.ELEMENTS;++n)t+=(n>0?", ":"")+_r(this[n],e);return`${e.printTypes?this.constructor.name:""}[${t}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!Tr(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,n){if(void 0===n)return this.lerp(this,e,t);for(let r=0;r<this.ELEMENTS;++r){const o=e[r],i="number"==typeof t?t:t[r];this[r]=o+n*(i-o)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),t[n]);return this.check()}add(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]+=t[e];return this.check()}subtract(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]-=t[e];return this.check()}scale(e){if("number"==typeof e)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(lr.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),t);return this.check()}get elements(){return this}}function gr(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function mr(e,t,n=""){if(lr.debug&&!function(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Sr(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}class Mr extends Ar{get x(){return this[0]}set x(e){this[0]=gr(e)}get y(){return this[1]}set y(e){this[1]=gr(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let n=0;n<this.ELEMENTS;++n){const r=this[n]-e[n];t+=r*r}return gr(t)}dot(e){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*e[n];return gr(t)}normalize(){const e=this.magnitude();if(0!==e)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t[e];return this.check()}divide(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t[e];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return Sr(e>=0&&e<this.ELEMENTS,"index is out of range"),gr(this[e])}setComponent(e,t){return Sr(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}const Nr=1e-6;let Or="undefined"!=typeof Float32Array?Float32Array:Array;function Cr(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function Ir(e,t,n,r){const o=t[0],i=t[1];return e[0]=o+r*(n[0]-o),e[1]=i+r*(n[1]-i),e}function br(e,t,n){const r=t[0],o=t[1];return e[0]=n[0]*r+n[2]*o,e[1]=n[1]*r+n[3]*o,e}function Lr(e,t,n){const r=t[0],o=t[1];return e[0]=n[0]*r+n[2]*o+n[4],e[1]=n[1]*r+n[3]*o+n[5],e}function Pr(e,t,n){const r=t[0],o=t[1];return e[0]=n[0]*r+n[3]*o+n[6],e[1]=n[1]*r+n[4]*o+n[7],e}function yr(e,t,n){const r=t[0],o=t[1];return e[0]=n[0]*r+n[4]*o+n[12],e[1]=n[1]*r+n[5]*o+n[13],e}const Dr=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e};function Ur(e,t,n){const r=t[0],o=t[1],i=n[3]*r+n[7]*o||1;return e[0]=(n[0]*r+n[4]*o)/i,e[1]=(n[1]*r+n[5]*o)/i,e}function Br(e,t,n){const r=t[0],o=t[1],i=t[2],s=n[3]*r+n[7]*o+n[11]*i||1;return e[0]=(n[0]*r+n[4]*o+n[8]*i)/s,e[1]=(n[1]*r+n[5]*o+n[9]*i)/s,e[2]=(n[2]*r+n[6]*o+n[10]*i)/s,e}function Fr(e,t,n){const r=t[0],o=t[1];return e[0]=n[0]*r+n[2]*o,e[1]=n[1]*r+n[3]*o,e[2]=t[2],e[3]=t[3],e}function wr(e,t,n){const r=t[0],o=t[1],i=t[2];return e[0]=n[0]*r+n[3]*o+n[6]*i,e[1]=n[1]*r+n[4]*o+n[7]*i,e[2]=n[2]*r+n[5]*o+n[8]*i,e[3]=t[3],e}function vr(){const e=new Or(3);return Or!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gr(e){const t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function xr(e,t,n){const r=new Or(3);return r[0]=e,r[1]=t,r[2]=n,r}function jr(e,t){const n=t[0],r=t[1],o=t[2];let i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function Wr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Hr(e,t,n){const r=t[0],o=t[1],i=t[2],s=n[0],a=n[1],c=n[2];return e[0]=o*c-i*a,e[1]=i*s-r*c,e[2]=r*a-o*s,e}function Xr(e,t,n){const r=t[0],o=t[1],i=t[2];let s=n[3]*r+n[7]*o+n[11]*i+n[15];return s=s||1,e[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/s,e[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/s,e[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/s,e}function kr(e,t,n){const r=t[0],o=t[1],i=t[2];return e[0]=r*n[0]+o*n[3]+i*n[6],e[1]=r*n[1]+o*n[4]+i*n[7],e[2]=r*n[2]+o*n[5]+i*n[8],e}function $r(e,t,n){const r=n[0],o=n[1],i=n[2],s=n[3],a=t[0],c=t[1],l=t[2];let _=o*l-i*c,u=i*a-r*l,E=r*c-o*a,h=o*E-i*u,f=i*_-r*E,d=r*u-o*_;const p=2*s;return _*=p,u*=p,E*=p,h*=2,f*=2,d*=2,e[0]=a+_+h,e[1]=c+u+f,e[2]=l+E+d,e}!function(){const e=function(){const e=new Or(2);return Or!=Float32Array&&(e[0]=0,e[1]=0),e}()}();const Vr=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e},zr=Gr,Yr=function(e){const t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r};!function(){const e=vr()}();const Kr=[0,0,0];let Zr;class qr extends Mr{static get ZERO(){return Zr||(Zr=new qr(0,0,0),Object.freeze(Zr)),Zr}constructor(e=0,t=0,n=0){super(-0,-0,-0),1===arguments.length&&ur(e)?this.copy(e):(lr.debug&&(gr(e),gr(t),gr(n)),this[0]=e,this[1]=t,this[2]=n)}set(e,t,n){return this[0]=e,this[1]=t,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return lr.debug&&(gr(e.x),gr(e.y),gr(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=gr(e)}angle(e){return function(e,t){const n=e[0],r=e[1],o=e[2],i=t[0],s=t[1],a=t[2],c=Math.sqrt((n*n+r*r+o*o)*(i*i+s*s+a*a)),l=c&&Wr(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}(this,e)}cross(e){return Hr(this,this,e),this.check()}rotateX({radians:e,origin:t=Kr}){return function(e,t,n,r){const o=[],i=[];o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],i[0]=o[0],i[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),i[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2]}(this,this,t,e),this.check()}rotateY({radians:e,origin:t=Kr}){return function(e,t,n,r){const o=[],i=[];o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],i[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),i[1]=o[1],i[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2]}(this,this,t,e),this.check()}rotateZ({radians:e,origin:t=Kr}){return function(e,t,n,r){const o=[],i=[];o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],i[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),i[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),i[2]=o[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2]}(this,this,t,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Xr(this,this,e),this.check()}transformAsVector(e){return Br(this,this,e),this.check()}transformByMatrix3(e){return kr(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,n){const r=t[0],o=t[1];e[0]=n[0]*r+n[2]*o,e[1]=n[1]*r+n[3]*o,e[2]=t[2]}(this,this,e),this.check()}transformByQuaternion(e){return $r(this,this,e),this.check()}}class Qr extends Ar{toString(){let e="[";if(lr.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let n=0;n<this.RANK;++n)e+=` ${this[n*this.RANK+t]}`}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=` ${this[t]}`}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,n){return this[t*this.RANK+e]=gr(n),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const n=e*this.RANK;for(let r=0;r<this.RANK;++r)t[r]=this[n+r];return t}setColumn(e,t){const n=e*this.RANK;for(let r=0;r<this.RANK;++r)this[n+r]=t[r];return this}}function Jr(e,t){const n=t[0],r=t[1],o=t[2],i=t[3],s=t[4],a=t[5],c=t[6],l=t[7],_=t[8],u=t[9],E=t[10],h=t[11],f=t[12],d=t[13],p=t[14],T=t[15],R=n*a-r*s,A=n*c-o*s,g=n*l-i*s,m=r*c-o*a,S=r*l-i*a,M=o*l-i*c,N=_*d-u*f,O=_*p-E*f,C=_*T-h*f,I=u*p-E*d,b=u*T-h*d,L=E*T-h*p;let P=R*L-A*b+g*I+m*C-S*O+M*N;return P?(P=1/P,e[0]=(a*L-c*b+l*I)*P,e[1]=(o*b-r*L-i*I)*P,e[2]=(d*M-p*S+T*m)*P,e[3]=(E*S-u*M-h*m)*P,e[4]=(c*C-s*L-l*O)*P,e[5]=(n*L-o*C+i*O)*P,e[6]=(p*g-f*M-T*A)*P,e[7]=(_*M-E*g+h*A)*P,e[8]=(s*b-a*C+l*N)*P,e[9]=(r*C-n*b-i*N)*P,e[10]=(f*S-d*g+T*R)*P,e[11]=(u*g-_*S-h*R)*P,e[12]=(a*O-s*I-c*N)*P,e[13]=(n*I-r*O+o*N)*P,e[14]=(d*A-f*m-p*R)*P,e[15]=(_*m-u*A+E*R)*P,e):null}function eo(e,t,n){const r=t[0],o=t[1],i=t[2],s=t[3],a=t[4],c=t[5],l=t[6],_=t[7],u=t[8],E=t[9],h=t[10],f=t[11],d=t[12],p=t[13],T=t[14],R=t[15];let A=n[0],g=n[1],m=n[2],S=n[3];return e[0]=A*r+g*a+m*u+S*d,e[1]=A*o+g*c+m*E+S*p,e[2]=A*i+g*l+m*h+S*T,e[3]=A*s+g*_+m*f+S*R,A=n[4],g=n[5],m=n[6],S=n[7],e[4]=A*r+g*a+m*u+S*d,e[5]=A*o+g*c+m*E+S*p,e[6]=A*i+g*l+m*h+S*T,e[7]=A*s+g*_+m*f+S*R,A=n[8],g=n[9],m=n[10],S=n[11],e[8]=A*r+g*a+m*u+S*d,e[9]=A*o+g*c+m*E+S*p,e[10]=A*i+g*l+m*h+S*T,e[11]=A*s+g*_+m*f+S*R,A=n[12],g=n[13],m=n[14],S=n[15],e[12]=A*r+g*a+m*u+S*d,e[13]=A*o+g*c+m*E+S*p,e[14]=A*i+g*l+m*h+S*T,e[15]=A*s+g*_+m*f+S*R,e}function to(e,t,n){const r=n[0],o=n[1],i=n[2];let s,a,c,l,_,u,E,h,f,d,p,T;return t===e?(e[12]=t[0]*r+t[4]*o+t[8]*i+t[12],e[13]=t[1]*r+t[5]*o+t[9]*i+t[13],e[14]=t[2]*r+t[6]*o+t[10]*i+t[14],e[15]=t[3]*r+t[7]*o+t[11]*i+t[15]):(s=t[0],a=t[1],c=t[2],l=t[3],_=t[4],u=t[5],E=t[6],h=t[7],f=t[8],d=t[9],p=t[10],T=t[11],e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=_,e[5]=u,e[6]=E,e[7]=h,e[8]=f,e[9]=d,e[10]=p,e[11]=T,e[12]=s*r+_*o+f*i+t[12],e[13]=a*r+u*o+d*i+t[13],e[14]=c*r+E*o+p*i+t[14],e[15]=l*r+h*o+T*i+t[15]),e}function no(e,t,n){const r=n[0],o=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ro(e,t,n){const r=Math.sin(n),o=Math.cos(n),i=t[4],s=t[5],a=t[6],c=t[7],l=t[8],_=t[9],u=t[10],E=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*o+l*r,e[5]=s*o+_*r,e[6]=a*o+u*r,e[7]=c*o+E*r,e[8]=l*o-i*r,e[9]=_*o-s*r,e[10]=u*o-a*r,e[11]=E*o-c*r,e}function oo(e,t,n){const r=Math.sin(n),o=Math.cos(n),i=t[0],s=t[1],a=t[2],c=t[3],l=t[4],_=t[5],u=t[6],E=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*o+l*r,e[1]=s*o+_*r,e[2]=a*o+u*r,e[3]=c*o+E*r,e[4]=l*o-i*r,e[5]=_*o-s*r,e[6]=u*o-a*r,e[7]=E*o-c*r,e}function io(e,t){const n=t[0],r=t[1],o=t[2],i=t[4],s=t[5],a=t[6],c=t[8],l=t[9],_=t[10];return e[0]=Math.sqrt(n*n+r*r+o*o),e[1]=Math.sqrt(i*i+s*s+a*a),e[2]=Math.sqrt(c*c+l*l+_*_),e}const so=function(e,t,n,r,o){const i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0){const t=1/(r-o);e[10]=(o+r)*t,e[14]=2*o*r*t}else e[10]=-1,e[14]=-2*r;return e};const ao=function(e,t,n,r,o,i,s){const a=1/(t-n),c=1/(r-o),l=1/(i-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*a,e[13]=(o+r)*c,e[14]=(s+i)*l,e[15]=1,e};function co(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function lo(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function _o(e){const t=e[0],n=e[1],r=e[2],o=e[3];return Math.sqrt(t*t+n*n+r*r+o*o)}function uo(e){const t=e[0],n=e[1],r=e[2],o=e[3];return t*t+n*n+r*r+o*o}function Eo(e,t){const n=t[0],r=t[1],o=t[2],i=t[3];let s=n*n+r*r+o*o+i*i;return s>0&&(s=1/Math.sqrt(s)),e[0]=n*s,e[1]=r*s,e[2]=o*s,e[3]=i*s,e}function ho(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function fo(e,t,n,r){const o=t[0],i=t[1],s=t[2],a=t[3];return e[0]=o+r*(n[0]-o),e[1]=i+r*(n[1]-i),e[2]=s+r*(n[2]-s),e[3]=a+r*(n[3]-a),e}function po(e,t,n){const r=t[0],o=t[1],i=t[2],s=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*s,e[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*s,e[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*s,e[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*s,e}function To(e,t,n){const r=t[0],o=t[1],i=t[2],s=n[0],a=n[1],c=n[2],l=n[3],_=l*r+a*i-c*o,u=l*o+c*r-s*i,E=l*i+s*o-a*r,h=-s*r-a*o-c*i;return e[0]=_*l+h*-s+u*-c-E*-a,e[1]=u*l+h*-a+E*-s-_*-c,e[2]=E*l+h*-c+_*-a-u*-s,e[3]=t[3],e}var Ro,Ao;!function(){const e=function(){const e=new Or(4);return Or!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}()}(),(Ao=Ro||(Ro={}))[Ao.COL0ROW0=0]="COL0ROW0",Ao[Ao.COL0ROW1=1]="COL0ROW1",Ao[Ao.COL0ROW2=2]="COL0ROW2",Ao[Ao.COL0ROW3=3]="COL0ROW3",Ao[Ao.COL1ROW0=4]="COL1ROW0",Ao[Ao.COL1ROW1=5]="COL1ROW1",Ao[Ao.COL1ROW2=6]="COL1ROW2",Ao[Ao.COL1ROW3=7]="COL1ROW3",Ao[Ao.COL2ROW0=8]="COL2ROW0",Ao[Ao.COL2ROW1=9]="COL2ROW1",Ao[Ao.COL2ROW2=10]="COL2ROW2",Ao[Ao.COL2ROW3=11]="COL2ROW3",Ao[Ao.COL3ROW0=12]="COL3ROW0",Ao[Ao.COL3ROW1=13]="COL3ROW1",Ao[Ao.COL3ROW2=14]="COL3ROW2",Ao[Ao.COL3ROW3=15]="COL3ROW3";const go=45*Math.PI/180,mo=1,So=.1,Mo=500,No=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class Oo extends Qr{static get IDENTITY(){return function(){Io||(Io=new Oo,Object.freeze(Io));return Io}()}static get ZERO(){return function(){Co||(Co=new Oo([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Co));return Co}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Ro}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,n,r,o,i,s,a,c,l,_,u,E,h,f,d){return this[0]=e,this[1]=t,this[2]=n,this[3]=r,this[4]=o,this[5]=i,this[6]=s,this[7]=a,this[8]=c,this[9]=l,this[10]=_,this[11]=u,this[12]=E,this[13]=h,this[14]=f,this[15]=d,this.check()}setRowMajor(e,t,n,r,o,i,s,a,c,l,_,u,E,h,f,d){return this[0]=e,this[1]=o,this[2]=c,this[3]=E,this[4]=t,this[5]=i,this[6]=l,this[7]=h,this[8]=n,this[9]=s,this[10]=_,this[11]=f,this[12]=r,this[13]=a,this[14]=u,this[15]=d,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(No)}fromObject(e){return this.check()}fromQuaternion(e){return function(e,t){const n=t[0],r=t[1],o=t[2],i=t[3],s=n+n,a=r+r,c=o+o,l=n*s,_=r*s,u=r*a,E=o*s,h=o*a,f=o*c,d=i*s,p=i*a,T=i*c;e[0]=1-u-f,e[1]=_+T,e[2]=E-p,e[3]=0,e[4]=_-T,e[5]=1-l-f,e[6]=h+d,e[7]=0,e[8]=E+p,e[9]=h-d,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this,e),this.check()}frustum(e){const{left:t,right:n,bottom:r,top:o,near:i=So,far:s=Mo}=e;return s===1/0?function(e,t,n,r,o,i){const s=2*i/(n-t),a=2*i/(o-r),c=(n+t)/(n-t),l=(o+r)/(o-r),_=-1,u=-1,E=-2*i;e[0]=s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=_,e[11]=u,e[12]=0,e[13]=0,e[14]=E,e[15]=0}(this,t,n,r,o,i):function(e,t,n,r,o,i,s){const a=1/(n-t),c=1/(o-r),l=1/(i-s);e[0]=2*i*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*c,e[6]=0,e[7]=0,e[8]=(n+t)*a,e[9]=(o+r)*c,e[10]=(s+i)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*i*2*l,e[15]=0}(this,t,n,r,o,i,s),this.check()}lookAt(e){const{eye:t,center:n=[0,0,0],up:r=[0,1,0]}=e;return function(e,t,n,r){let o,i,s,a,c,l,_,u,E,h;const f=t[0],d=t[1],p=t[2],T=r[0],R=r[1],A=r[2],g=n[0],m=n[1],S=n[2];Math.abs(f-g)<Nr&&Math.abs(d-m)<Nr&&Math.abs(p-S)<Nr?function(e){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):(u=f-g,E=d-m,h=p-S,o=1/Math.sqrt(u*u+E*E+h*h),u*=o,E*=o,h*=o,i=R*h-A*E,s=A*u-T*h,a=T*E-R*u,o=Math.sqrt(i*i+s*s+a*a),o?(o=1/o,i*=o,s*=o,a*=o):(i=0,s=0,a=0),c=E*a-h*s,l=h*i-u*a,_=u*s-E*i,o=Math.sqrt(c*c+l*l+_*_),o?(o=1/o,c*=o,l*=o,_*=o):(c=0,l=0,_=0),e[0]=i,e[1]=c,e[2]=u,e[3]=0,e[4]=s,e[5]=l,e[6]=E,e[7]=0,e[8]=a,e[9]=_,e[10]=h,e[11]=0,e[12]=-(i*f+s*d+a*p),e[13]=-(c*f+l*d+_*p),e[14]=-(u*f+E*d+h*p),e[15]=1)}(this,t,n,r),this.check()}ortho(e){const{left:t,right:n,bottom:r,top:o,near:i=So,far:s=Mo}=e;return ao(this,t,n,r,o,i,s),this.check()}orthographic(e){const{fovy:t=go,aspect:n=mo,focalDistance:r=1,near:o=So,far:i=Mo}=e;bo(t);const s=t/2,a=r*Math.tan(s),c=a*n;return this.ortho({left:-c,right:c,bottom:-a,top:a,near:o,far:i})}perspective(e){const{fovy:t=45*Math.PI/180,aspect:n=1,near:r=.1,far:o=500}=e;return bo(t),so(this,t,n,r,o),this.check()}determinant(){return function(e){const t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],s=e[5],a=e[6],c=e[7],l=e[8],_=e[9],u=e[10],E=e[11],h=e[12],f=e[13],d=e[14],p=t*s-n*i,T=t*a-r*i,R=n*a-r*s,A=l*f-_*h,g=l*d-u*h,m=_*d-u*f;return c*(t*m-n*g+r*A)-o*(i*m-s*g+a*A)+e[15]*(l*R-_*T+u*p)-E*(h*R-f*T+d*p)}(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const n=this.getScale(t),r=1/n[0],o=1/n[1],i=1/n[2];return e[0]=this[0]*r,e[1]=this[1]*o,e[2]=this[2]*i,e[3]=0,e[4]=this[4]*r,e[5]=this[5]*o,e[6]=this[6]*i,e[7]=0,e[8]=this[8]*r,e[9]=this[9]*o,e[10]=this[10]*i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const n=this.getScale(t),r=1/n[0],o=1/n[1],i=1/n[2];return e[0]=this[0]*r,e[1]=this[1]*o,e[2]=this[2]*i,e[3]=this[4]*r,e[4]=this[5]*o,e[5]=this[6]*i,e[6]=this[8]*r,e[7]=this[9]*o,e[8]=this[10]*i,e}transpose(){return function(e,t){if(e===t){const n=t[1],r=t[2],o=t[3],i=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=o,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15]}(this,this),this.check()}invert(){return Jr(this,this),this.check()}multiplyLeft(e){return eo(this,e,this),this.check()}multiplyRight(e){return eo(this,this,e),this.check()}rotateX(e){return ro(this,this,e),this.check()}rotateY(e){return function(e,t,n){const r=Math.sin(n),o=Math.cos(n),i=t[0],s=t[1],a=t[2],c=t[3],l=t[8],_=t[9],u=t[10],E=t[11];t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*o-l*r,e[1]=s*o-_*r,e[2]=a*o-u*r,e[3]=c*o-E*r,e[8]=i*r+l*o,e[9]=s*r+_*o,e[10]=a*r+u*o,e[11]=c*r+E*o}(this,this,e),this.check()}rotateZ(e){return oo(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return function(e,t,n,r){let o,i,s,a,c,l,_,u,E,h,f,d,p,T,R,A,g,m,S,M,N,O,C,I,b=r[0],L=r[1],P=r[2],y=Math.sqrt(b*b+L*L+P*P);y<Nr||(y=1/y,b*=y,L*=y,P*=y,i=Math.sin(n),o=Math.cos(n),s=1-o,a=t[0],c=t[1],l=t[2],_=t[3],u=t[4],E=t[5],h=t[6],f=t[7],d=t[8],p=t[9],T=t[10],R=t[11],A=b*b*s+o,g=L*b*s+P*i,m=P*b*s-L*i,S=b*L*s-P*i,M=L*L*s+o,N=P*L*s+b*i,O=b*P*s+L*i,C=L*P*s-b*i,I=P*P*s+o,e[0]=a*A+u*g+d*m,e[1]=c*A+E*g+p*m,e[2]=l*A+h*g+T*m,e[3]=_*A+f*g+R*m,e[4]=a*S+u*M+d*N,e[5]=c*S+E*M+p*N,e[6]=l*S+h*M+T*N,e[7]=_*S+f*M+R*N,e[8]=a*O+u*C+d*I,e[9]=c*O+E*C+p*I,e[10]=l*O+h*C+T*I,e[11]=_*O+f*C+R*I,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]))}(this,this,e,t),this.check()}scale(e){return no(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return to(this,this,e),this.check()}transform(e,t){return 4===e.length?(mr(t=po(t||[-0,-0,-0,-0],e,this),4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){const{length:n}=e;let r;switch(n){case 2:r=yr(t||[-0,-0],e,this);break;case 3:r=Xr(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return mr(r,e.length),r}transformAsVector(e,t){let n;switch(e.length){case 2:n=Ur(t||[-0,-0],e,this);break;case 3:n=Br(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return mr(n,e.length),n}transformPoint(e,t){return this.transformAsPoint(e,t)}transformVector(e,t){return this.transformAsPoint(e,t)}transformDirection(e,t){return this.transformAsVector(e,t)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,n){return this.identity().translate([e,t,n])}}let Co,Io;function bo(e){if(e>2*Math.PI)throw Error("expected radians")}const Lo={name:"fp32",vs:"#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\n\n// All these functions are for substituting tan() function from Intel GPU only\nconst float TWO_PI = 6.2831854820251465;\nconst float PI_2 = 1.5707963705062866;\nconst float PI_16 = 0.1963495463132858;\n\nconst float SIN_TABLE_0 = 0.19509032368659973;\nconst float SIN_TABLE_1 = 0.3826834261417389;\nconst float SIN_TABLE_2 = 0.5555702447891235;\nconst float SIN_TABLE_3 = 0.7071067690849304;\n\nconst float COS_TABLE_0 = 0.9807852506637573;\nconst float COS_TABLE_1 = 0.9238795042037964;\nconst float COS_TABLE_2 = 0.8314695954322815;\nconst float COS_TABLE_3 = 0.7071067690849304;\n\nconst float INVERSE_FACTORIAL_3 = 1.666666716337204e-01; // 1/3!\nconst float INVERSE_FACTORIAL_5 = 8.333333767950535e-03; // 1/5!\nconst float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04; // 1/7!\nconst float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06; // 1/9!\n\nfloat sin_taylor_fp32(float a) {\n float r, s, t, x;\n\n if (a == 0.0) {\n return 0.0;\n }\n\n x = -a * a;\n s = a;\n r = a;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_3;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_5;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_7;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_9;\n s = s + t;\n\n return s;\n}\n\nvoid sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {\n if (a == 0.0) {\n sin_t = 0.0;\n cos_t = 1.0;\n }\n sin_t = sin_taylor_fp32(a);\n cos_t = sqrt(1.0 - sin_t * sin_t);\n}\n\nfloat tan_taylor_fp32(float a) {\n float sin_a;\n float cos_a;\n\n if (a == 0.0) {\n return 0.0;\n }\n\n // 2pi range reduction\n float z = floor(a / TWO_PI);\n float r = a - TWO_PI * z;\n\n float t;\n float q = floor(r / PI_2 + 0.5);\n int j = int(q);\n\n if (j < -2 || j > 2) {\n return 1.0 / 0.0;\n }\n\n t = r - PI_2 * q;\n\n q = floor(t / PI_16 + 0.5);\n int k = int(q);\n int abs_k = int(abs(float(k)));\n\n if (abs_k > 4) {\n return 1.0 / 0.0;\n } else {\n t = t - PI_16 * q;\n }\n\n float u = 0.0;\n float v = 0.0;\n\n float sin_t, cos_t;\n float s, c;\n sincos_taylor_fp32(t, sin_t, cos_t);\n\n if (k == 0) {\n s = sin_t;\n c = cos_t;\n } else {\n if (abs(float(abs_k) - 1.0) < 0.5) {\n u = COS_TABLE_0;\n v = SIN_TABLE_0;\n } else if (abs(float(abs_k) - 2.0) < 0.5) {\n u = COS_TABLE_1;\n v = SIN_TABLE_1;\n } else if (abs(float(abs_k) - 3.0) < 0.5) {\n u = COS_TABLE_2;\n v = SIN_TABLE_2;\n } else if (abs(float(abs_k) - 4.0) < 0.5) {\n u = COS_TABLE_3;\n v = SIN_TABLE_3;\n }\n if (k > 0) {\n s = u * sin_t + v * cos_t;\n c = u * cos_t - v * sin_t;\n } else {\n s = u * sin_t - v * cos_t;\n c = u * cos_t + v * sin_t;\n }\n }\n\n if (j == 0) {\n sin_a = s;\n cos_a = c;\n } else if (j == 1) {\n sin_a = c;\n cos_a = -s;\n } else if (j == -1) {\n sin_a = -c;\n cos_a = s;\n } else {\n sin_a = -s;\n cos_a = -c;\n }\n return sin_a / cos_a;\n}\n#endif\n\nfloat tan_fp32(float a) {\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\n return tan_taylor_fp32(a);\n#else\n return tan(a);\n#endif\n}\n"},Po=["Adapter","GPU","GPU Type","GPU Backend","Frame Rate","CPU Time","GPU Time","GPU Memory","Buffer Memory","Texture Memory","Referenced Buffer Memory","Referenced Texture Memory","Swap Chain Texture"],yo=/* @__PURE__ */new WeakMap,Do=/* @__PURE__ */new WeakMap;const Uo=new class{stats=/* @__PURE__ */new Map;getStats(e){return this.get(e)}get(e){this.stats.has(e)||this.stats.set(e,new ae({id:e}));const t=this.stats.get(e);return"GPU Time and Memory"===e&&function(e,t){const n=e.stats;let r=!1;for(const c of t)n[c]||(e.get(c),r=!0);const o=Object.keys(n).length,i=yo.get(e);if(!r&&i?.orderedStatNames===t&&i.statCount===o)return;const s={};let a=Do.get(t);a||(a=new Set(t),Do.set(t,a));for(const c of t)n[c]&&(s[c]=n[c]);for(const[c,l]of Object.entries(n))a.has(c)||(s[c]=l);for(const c of Object.keys(n))delete n[c];Object.assign(n,s),yo.set(e,{orderedStatNames:t,statCount:o})}(t,Po),t}};const Bo=new g({id:"luma.gl"}),Fo={};function wo(e="id"){Fo[e]=Fo[e]||1;return`${e}-${Fo[e]++}`}const vo="GPU Resource Counts",Go="Resource Counts",xo="GPU Time and Memory",jo=["Resources","Buffers","Textures","Samplers","TextureViews","Framebuffers","QuerySets","Shaders","RenderPipelines","ComputePipelines","PipelineLayouts","VertexArrays","RenderPasss","ComputePasss","CommandEncoders","CommandBuffers"].flatMap(e=>[`${e} Created`,`${e} Active`]),Wo=["Resources","Buffers","Textures","Samplers","TextureViews","Framebuffers","QuerySets","Shaders","RenderPipelines","SharedRenderPipelines","ComputePipelines","PipelineLayouts","VertexArrays","RenderPasss","ComputePasss","CommandEncoders","CommandBuffers"].flatMap(e=>[`${e} Created`,`${e} Active`]),Ho=/* @__PURE__ */new WeakMap,Xo=/* @__PURE__ */new WeakMap;class ko{static defaultProps={id:"undefined",handle:void 0,userData:void 0};toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;allocatedBytesName=null;_attachedResources=/* @__PURE__ */new Set;constructor(e,t,n){if(!e)throw new Error("no device");this._device=e,this.props=function(e,t){const n={...t};for(const r in e)void 0!==e[r]&&(n[r]=e[r]);return n}(t,n);const r="undefined"!==this.props.id?this.props.id:wo(this[Symbol.toStringTag]);this.props.id=r,this.id=r,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyed||this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(const e of this._attachedResources)e.destroy();this._attachedResources=/* @__PURE__ */new Set}destroyResource(){this.destroyed||(this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0)}removeStats(){const e=zo(this._device),t=e?Yo():0,n=[this._device.statsManager.getStats(vo),this._device.statsManager.getStats(Go)],r=Vo(this._device);for(const i of n)$o(i,r);const o=this.getStatsName();for(const i of n)i.get("Resources Active").decrementCount(),i.get(`${o}s Active`).decrementCount();e&&(e.statsBookkeepingCalls=(e.statsBookkeepingCalls||0)+1,e.statsBookkeepingTimeMs=(e.statsBookkeepingTimeMs||0)+(Yo()-t))}trackAllocatedMemory(e,t=this.getStatsName()){const n=zo(this._device),r=n?Yo():0,o=this._device.statsManager.getStats(xo);this.allocatedBytes>0&&this.allocatedBytesName&&(o.get("GPU Memory").subtractCount(this.allocatedBytes),o.get(`${this.allocatedBytesName} Memory`).subtractCount(this.allocatedBytes)),o.get("GPU Memory").addCount(e),o.get(`${t} Memory`).addCount(e),n&&(n.statsBookkeepingCalls=(n.statsBookkeepingCalls||0)+1,n.statsBookkeepingTimeMs=(n.statsBookkeepingTimeMs||0)+(Yo()-r)),this.allocatedBytes=e,this.allocatedBytesName=t}trackReferencedMemory(e,t=this.getStatsName()){this.trackAllocatedMemory(e,`Referenced ${t}`)}trackDeallocatedMemory(e=this.getStatsName()){if(0===this.allocatedBytes)return void(this.allocatedBytesName=null);const t=zo(this._device),n=t?Yo():0,r=this._device.statsManager.getStats(xo);r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${this.allocatedBytesName||e} Memory`).subtractCount(this.allocatedBytes),t&&(t.statsBookkeepingCalls=(t.statsBookkeepingCalls||0)+1,t.statsBookkeepingTimeMs=(t.statsBookkeepingTimeMs||0)+(Yo()-n)),this.allocatedBytes=0,this.allocatedBytesName=null}trackDeallocatedReferencedMemory(e=this.getStatsName()){this.trackDeallocatedMemory(`Referenced ${e}`)}addStats(){const e=this.getStatsName(),t=zo(this._device),n=t?Yo():0,r=[this._device.statsManager.getStats(vo),this._device.statsManager.getStats(Go)],o=Vo(this._device);for(const i of r)$o(i,o);for(const i of r)i.get("Resources Created").incrementCount(),i.get("Resources Active").incrementCount(),i.get(`${e}s Created`).incrementCount(),i.get(`${e}s Active`).incrementCount();t&&(t.statsBookkeepingCalls=(t.statsBookkeepingCalls||0)+1,t.statsBookkeepingTimeMs=(t.statsBookkeepingTimeMs||0)+(Yo()-n)),function(e,t){const n=zo(e);if(!n||!n.activeDefaultFramebufferAcquireDepth)return;switch(n.transientCanvasResourceCreates=(n.transientCanvasResourceCreates||0)+1,t){case"Texture":n.transientCanvasTextureCreates=(n.transientCanvasTextureCreates||0)+1;break;case"TextureView":n.transientCanvasTextureViewCreates=(n.transientCanvasTextureViewCreates||0)+1;break;case"Sampler":n.transientCanvasSamplerCreates=(n.transientCanvasSamplerCreates||0)+1;break;case"Framebuffer":n.transientCanvasFramebufferCreates=(n.transientCanvasFramebufferCreates||0)+1}}(this._device,e)}getStatsName(){return function(e){let t=Object.getPrototypeOf(e);for(;t;){const n=Object.getPrototypeOf(t);if(!n||n===ko.prototype)return Ko(t)||e[Symbol.toStringTag]||e.constructor.name;t=n}return e[Symbol.toStringTag]||e.constructor.name}(this)}}function $o(e,t){const n=e.stats;let r=!1;for(const c of t)n[c]||(e.get(c),r=!0);const o=Object.keys(n).length,i=Ho.get(e);if(!r&&i?.orderedStatNames===t&&i.statCount===o)return;const s={};let a=Xo.get(t);a||(a=new Set(t),Xo.set(t,a));for(const c of t)n[c]&&(s[c]=n[c]);for(const[c,l]of Object.entries(n))a.has(c)||(s[c]=l);for(const c of Object.keys(n))delete n[c];Object.assign(n,s),Ho.set(e,{orderedStatNames:t,statCount:o})}function Vo(e){return"webgl"===e.type?Wo:jo}function zo(e){const t=e.userData["cpu-hotspot-profiler"];return t?.enabled?t:null}function Yo(){return globalThis.performance?.now?.()??Date.now()}function Ko(e){const t=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag);return"function"==typeof t?.get?t.get.call(e):"string"==typeof t?.value?t.value:null}class Zo extends ko{static INDEX=16;static VERTEX=32;static UNIFORM=64;static STORAGE=128;static INDIRECT=256;static QUERY_RESOLVE=512;static MAP_READ=1;static MAP_WRITE=2;static COPY_SRC=4;static COPY_DST=8;get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){const n={...t};(t.usage||0)&Zo.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?n.indexType="uint32":t.data instanceof Uint16Array?n.indexType="uint16":t.data instanceof Uint8Array&&(n.indexType="uint8")),delete n.data,super(e,n,Zo.defaultProps),this.usage=n.usage||0,this.indexType=n.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}static DEBUG_DATA_MAX_LENGTH=32;debugData=new ArrayBuffer(0);_setDebugData(e,t,n){let r,o=null;ArrayBuffer.isView(e)?(o=e,r=e.buffer):r=e;const i=Math.min(e?e.byteLength:n,Zo.DEBUG_DATA_MAX_LENGTH);if(null===r)this.debugData=new ArrayBuffer(i);else{const e=Math.min(o?.byteOffset||0,r.byteLength),t=Math.max(0,r.byteLength-e),n=Math.min(i,t);this.debugData=new Uint8Array(r,e,n).slice().buffer}}static defaultProps={...ko.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0}}const qo=new class{getDataTypeInfo(e){const[t,n,r]=Qo[e],o=e.includes("norm");return{signedType:t,primitiveType:n,byteLength:r,normalized:o,integer:!o&&!e.startsWith("float"),signed:e.startsWith("s")}}getNormalizedDataType(e){const t=e;switch(t){case"uint8":return"unorm8";case"sint8":return"snorm8";case"uint16":return"unorm16";case"sint16":return"snorm16";default:return t}}alignTo(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}getDataType(e){const t=ArrayBuffer.isView(e)?e.constructor:e;if(t===Uint8ClampedArray)return"uint8";const n=Object.values(Qo).find(e=>t===e[4]);if(!n)throw new Error(t.name);return n[0]}getTypedArrayConstructor(e){const[,,,,t]=Qo[e];return t}},Qo={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]};const Jo=new class{getVertexFormatInfo(e){let t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);const[n,r]=e.split("x"),o=n,i=r?parseInt(r):1,s=qo.getDataTypeInfo(o),a={type:o,components:i,byteLength:s.byteLength*i,integer:s.integer,signed:s.signed,normalized:s.normalized};return t&&(a.webglOnly=!0),a}makeVertexFormat(e,t,n){const r=n?qo.getNormalizedDataType(e):e;switch(r){case"unorm8":return 1===t?"unorm8":3===t?"unorm8x3-webgl":`${r}x${t}`;case"snorm8":return 1===t?"snorm8":3===t?"snorm8x3-webgl":`${r}x${t}`;case"uint8":case"sint8":case"float16":if(1===t||3===t)throw new Error(`size: ${t}`);return`${r}x${t}`;case"uint16":return 1===t?"uint16":3===t?"uint16x3-webgl":`${r}x${t}`;case"sint16":return 1===t?"sint16":3===t?"sint16x3-webgl":`${r}x${t}`;case"unorm16":return 1===t?"unorm16":3===t?"unorm16x3-webgl":`${r}x${t}`;case"snorm16":return 1===t?"snorm16":3===t?"snorm16x3-webgl":`${r}x${t}`;default:return 1===t?r:`${r}x${t}`}}getVertexFormatFromAttribute(e,t,n){if(!t||t>4)throw new Error(`size ${t}`);const r=t,o=qo.getDataType(e);return this.makeVertexFormat(o,r,n)}getCompatibleVertexFormat(e){let t;switch(e.primitiveType){case"f32":t="float32";break;case"i32":t="sint32";break;case"u32":t="uint32";break;case"f16":return e.components<=2?"float16x2":"float16x4"}return 1===e.components?t:`${t}x${e.components}`}},ei="texture-compression-bc",ti="texture-compression-astc",ni="texture-compression-etc2",ri="texture-compression-pvrtc-webgl",oi="texture-compression-atc-webgl",ii="float32-renderable-webgl",si="float16-renderable-webgl",ai="snorm8-renderable-webgl",ci="norm16-webgl",li="norm16-renderable-webgl",_i="snorm16-renderable-webgl",ui="float32-filterable",Ei="float16-filterable-webgl";function hi(e){const t=fi[e];if(!t)throw new Error(`Unsupported texture format ${e}`);return t}const fi={...{r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:ai},rg8snorm:{render:ai},"rgb8snorm-webgl":{},rgba8snorm:{render:ai},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:ci,render:li},rg16unorm:{f:ci,render:li},"rgb16unorm-webgl":{f:ci,render:!1},rgba16unorm:{f:ci,render:li},r16snorm:{f:ci,render:_i},rg16snorm:{f:ci,render:_i},"rgb16snorm-webgl":{f:ci,render:!1},rgba16snorm:{f:ci,render:_i},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:si,filter:"float16-filterable-webgl"},rg16float:{render:si,filter:Ei},rgba16float:{render:si,filter:Ei},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:ii,filter:ui},rg32float:{render:!1,filter:ui},"rgb32float-webgl":{render:ii,filter:ui},rgba32float:{render:ii,filter:ui},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:"rgb9e5ufloat-renderable-webgl"},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:ii},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},rgb10a2uint:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}},...{"bc1-rgb-unorm-webgl":{f:ei},"bc1-rgb-unorm-srgb-webgl":{f:ei},"bc1-rgba-unorm":{f:ei},"bc1-rgba-unorm-srgb":{f:ei},"bc2-rgba-unorm":{f:ei},"bc2-rgba-unorm-srgb":{f:ei},"bc3-rgba-unorm":{f:ei},"bc3-rgba-unorm-srgb":{f:ei},"bc4-r-unorm":{f:ei},"bc4-r-snorm":{f:ei},"bc5-rg-unorm":{f:ei},"bc5-rg-snorm":{f:ei},"bc6h-rgb-ufloat":{f:ei},"bc6h-rgb-float":{f:ei},"bc7-rgba-unorm":{f:ei},"bc7-rgba-unorm-srgb":{f:ei},"etc2-rgb8unorm":{f:ni},"etc2-rgb8unorm-srgb":{f:ni},"etc2-rgb8a1unorm":{f:ni},"etc2-rgb8a1unorm-srgb":{f:ni},"etc2-rgba8unorm":{f:ni},"etc2-rgba8unorm-srgb":{f:ni},"eac-r11unorm":{f:ni},"eac-r11snorm":{f:ni},"eac-rg11unorm":{f:ni},"eac-rg11snorm":{f:ni},"astc-4x4-unorm":{f:ti},"astc-4x4-unorm-srgb":{f:ti},"astc-5x4-unorm":{f:ti},"astc-5x4-unorm-srgb":{f:ti},"astc-5x5-unorm":{f:ti},"astc-5x5-unorm-srgb":{f:ti},"astc-6x5-unorm":{f:ti},"astc-6x5-unorm-srgb":{f:ti},"astc-6x6-unorm":{f:ti},"astc-6x6-unorm-srgb":{f:ti},"astc-8x5-unorm":{f:ti},"astc-8x5-unorm-srgb":{f:ti},"astc-8x6-unorm":{f:ti},"astc-8x6-unorm-srgb":{f:ti},"astc-8x8-unorm":{f:ti},"astc-8x8-unorm-srgb":{f:ti},"astc-10x5-unorm":{f:ti},"astc-10x5-unorm-srgb":{f:ti},"astc-10x6-unorm":{f:ti},"astc-10x6-unorm-srgb":{f:ti},"astc-10x8-unorm":{f:ti},"astc-10x8-unorm-srgb":{f:ti},"astc-10x10-unorm":{f:ti},"astc-10x10-unorm-srgb":{f:ti},"astc-12x10-unorm":{f:ti},"astc-12x10-unorm-srgb":{f:ti},"astc-12x12-unorm":{f:ti},"astc-12x12-unorm-srgb":{f:ti},"pvrtc-rgb4unorm-webgl":{f:ri},"pvrtc-rgba4unorm-webgl":{f:ri},"pvrtc-rgb2unorm-webgl":{f:ri},"pvrtc-rgba2unorm-webgl":{f:ri},"etc1-rbg-unorm-webgl":{f:"texture-compression-etc1-webgl"},"atc-rgb-unorm-webgl":{f:oi},"atc-rgba-unorm-webgl":{f:oi},"atc-rgbai-unorm-webgl":{f:oi}}},di=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,pi=["rgb","rgba","bgra"],Ti=["depth","stencil"],Ri=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"];const Ai=new class{isColor(e){return pi.some(t=>e.startsWith(t))}isDepthStencil(e){return Ti.some(t=>e.startsWith(t))}isCompressed(e){return Ri.some(t=>e.startsWith(t))}getInfo(e){return gi(e)}getCapabilities(e){return function(e){const t=hi(e),n={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},r=gi(e),o=e.startsWith("depth")||e.startsWith("stencil"),i=r?.signed,s=r?.integer,a=r?.webgl,c=Boolean(r?.compressed);return n.render&&=!o&&!c,n.filter&&=!(o||i||s||a),n}(e)}computeMemoryLayout(e){return function({format:e,width:t,height:n,depth:r,byteAlignment:o}){const i=Ai.getInfo(e),{bytesPerPixel:s,bytesPerBlock:a=s,blockWidth:c=1,blockHeight:l=1,compressed:_=!1}=i,u=_?Math.ceil(t/c):t,E=_?Math.ceil(n/l):n,h=u*a,f=Math.ceil(h/o)*o;return{bytesPerPixel:s,bytesPerRow:f,rowsPerImage:E,depthOrArrayLayers:r,bytesPerImage:f*E,byteLength:f*E*r}}(e)}};function gi(e){let t=function(e){const t=hi(e),n=t.bytesPerPixel||1,r=t.bitsPerChannel||[8,8,8,8];delete t.bitsPerChannel,delete t.bytesPerPixel,delete t.f,delete t.render,delete t.filter,delete t.blend,delete t.store;const o={...t,format:e,attachment:t.attachment||"color",channels:t.channels||"r",components:t.components||t.channels?.length||1,bytesPerPixel:n,bitsPerChannel:r,dataType:t.dataType||"uint8",srgb:t.srgb??!1,packed:t.packed??!1,webgl:t.webgl??!1,integer:t.integer??!1,signed:t.signed??!1,normalized:t.normalized??!1,compressed:t.compressed??!1};return o}(e);if(Ai.isCompressed(e)){t.channels="rgb",t.components=3,t.bytesPerPixel=1,t.srgb=!1,t.compressed=!0,t.bytesPerBlock=function(e){if(e.startsWith("bc1")||e.startsWith("bc4")||e.startsWith("etc1")||e.startsWith("etc2-rgb8")||e.startsWith("etc2-rgb8a1")||e.startsWith("eac-r11")||"atc-rgb-unorm-webgl"===e)return 8;if(e.startsWith("bc2")||e.startsWith("bc3")||e.startsWith("bc5")||e.startsWith("bc6h")||e.startsWith("bc7")||e.startsWith("etc2-rgba8")||e.startsWith("eac-rg11")||e.startsWith("astc")||"atc-rgba-unorm-webgl"===e||"atc-rgbai-unorm-webgl"===e)return 16;if(e.startsWith("pvrtc"))return 8;return 16}(e);const n=function(e){const t=/.*-(\d+)x(\d+)-.*/.exec(e);if(t){const[,e,n]=t;return{blockWidth:Number(e),blockHeight:Number(n)}}if(e.startsWith("bc")||e.startsWith("etc1")||e.startsWith("etc2")||e.startsWith("eac")||e.startsWith("atc"))return{blockWidth:4,blockHeight:4};if(e.startsWith("pvrtc-rgb4")||e.startsWith("pvrtc-rgba4"))return{blockWidth:4,blockHeight:4};if(e.startsWith("pvrtc-rgb2")||e.startsWith("pvrtc-rgba2"))return{blockWidth:8,blockHeight:4};return null}(e);n&&(t.blockWidth=n.blockWidth,t.blockHeight=n.blockHeight)}const n=t.packed?null:di.exec(e);if(n){const[,r,o,i,s,a]=n,c=`${i}${o}`,l=qo.getDataTypeInfo(c),_=8*l.byteLength,u=r?.length??1,E=[_,u>=2?_:0,u>=3?_:0,u>=4?_:0];t={format:e,attachment:t.attachment,dataType:l.signedType,components:u,channels:r,integer:l.integer,signed:l.signed,normalized:l.normalized,bitsPerChannel:E,bytesPerPixel:l.byteLength*u,packed:t.packed,srgb:t.srgb},"-webgl"===a&&(t.webgl=!0),"-srgb"===s&&(t.srgb=!0)}return e.endsWith("-webgl")&&(t.webgl=!0),e.endsWith("-srgb")&&(t.srgb=!0),t}function mi(e){return"undefined"!=typeof ImageData&&e instanceof ImageData||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas}function Si(e){if("undefined"!=typeof ImageData&&e instanceof ImageData||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return{width:e.width,height:e.height};if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement)return{width:e.naturalWidth,height:e.naturalHeight};if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)return{width:e.videoWidth,height:e.videoHeight};if("undefined"!=typeof VideoFrame&&e instanceof VideoFrame)return{width:e.displayWidth,height:e.displayHeight};throw new Error("Unknown image type")}class Mi{}function Ni(e){if(void 0!==e){if(null===e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Error)return e.message;if(Array.isArray(e))return e.map(Ni);if("object"==typeof e){if(function(e){return"toString"in e&&"function"==typeof e.toString&&e.toString!==Object.prototype.toString}(e)){const t=String(e);if("[object Object]"!==t)return t}return function(e){return"message"in e&&"type"in e}(e)?function(e){const t="string"==typeof e.type?e.type:"message",n="string"==typeof e.message?e.message:"",r="number"==typeof e.lineNum?e.lineNum:null,o="number"==typeof e.linePos?e.linePos:null;return`${t}${null!==r&&null!==o?` @ ${r}:${o}`:null!==r?` @ ${r}`:""}: ${n}`.trim()}(e):e.constructor?.name||"Object"}return String(e)}}class Oi{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}}class Ci{static defaultProps={id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>{},onResize:(e,t)=>{const[n,r]=e.getDevicePixelSize();Bo.log(1,`${e} resized => ${n}x${r}px`)()},onPositionChange:(e,t)=>{const[n,r]=e.getPosition();Bo.log(1,`${e} repositioned => ${n},${r}`)()},onVisibilityChange:e=>Bo.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>Bo.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:Ii(),debugGPUTime:!1,debugShaders:Bo.get("debug-shaders")||void 0,debugFramebuffers:Boolean(Bo.get("debug-framebuffers")),debugFactories:Boolean(Bo.get("debug-factories")),debugWebGL:Boolean(Bo.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!0,_destroyShaders:!1,_cachePipelines:!0,_sharePipelines:!0,_destroyPipelines:!1,_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0};get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=Uo;_factories={};timestamp=0;_reused=!1;_moduleData={};_textureCaps={};_debugGPUTimeQuery=null;constructor(e){this.props={...Ci.defaultProps,...e},this.id=this.props.id||wo(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(e){return Jo.getVertexFormatInfo(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return Ai.getInfo(e)}getTextureFormatCapabilities(e){let t=this._textureCaps[e];if(!t){const n=this._getDeviceTextureFormatCapabilities(e);t=this._getDeviceSpecificTextureFormatCapabilities(n),this._textureCaps[e]=t}return t}getMipLevelCount(e,t,n=1){const r=Math.max(e,t,n);return 1+Math.floor(Math.log2(r))}isExternalImage(e){return mi(e)}getExternalImageSize(e){return Si(e)}isTextureFormatSupported(e){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return Ai.isCompressed(e)}getSupportedCompressedTextureFormats(){const e=[];for(const t of Object.keys(fi))this.isTextureFormatCompressed(t)&&this.isTextureFormatSupported(t)&&e.push(t);return e}pushDebugGroup(e){this.commandEncoder.pushDebugGroup(e)}popDebugGroup(){this.commandEncoder?.popDebugGroup()}insertDebugMarker(e){this.commandEncoder?.insertDebugMarker(e)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(e,t,...n){if(!this.props.onError(e,t)){const r=function(e,t){return[Ni(e),...t.map(Ni).filter(e=>void 0!==e)].filter(e=>void 0!==e)}(t,n);return Bo.error("webgl"===this.type?"%cWebGL":"%cWebGPU","color: white; background: red; padding: 2px 6px; border-radius: 3px;",e.message,...r)}return()=>{}}debug(){if(this.props.debug);else{const e="'Type luma.log.set({debug: true}) in console to enable debug breakpoints',\nor create a device with the 'debug: true' prop.";Bo.once(0,e)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createFence(){throw new Error("createFence() not implemented")}beginRenderPass(e){return this.commandEncoder.beginRenderPass(e)}beginComputePass(e){return this.commandEncoder.beginComputePass(e)}generateMipmapsWebGPU(e){throw new Error("not implemented")}_createSharedRenderPipelineWebGL(e){throw new Error("_createSharedRenderPipelineWebGL() not implemented")}_createBindGroupLayoutWebGPU(e,t){throw new Error("_createBindGroupLayoutWebGPU() not implemented")}_createBindGroupWebGPU(e,t,n,r,o){throw new Error("_createBindGroupWebGPU() not implemented")}_supportsDebugGPUTime(){return this.features.has("timestamp-query")&&Boolean(this.props.debug||this.props.debugGPUTime)}_enableDebugGPUTime(e=256){if(!this._supportsDebugGPUTime())return null;if(this._debugGPUTimeQuery)return this._debugGPUTimeQuery;try{this._debugGPUTimeQuery=this.createQuerySet({type:"timestamp",count:e}),this.commandEncoder=this.createCommandEncoder({id:this.commandEncoder.props.id,timeProfilingQuerySet:this._debugGPUTimeQuery})}catch{this._debugGPUTimeQuery=null}return this._debugGPUTimeQuery}_disableDebugGPUTime(){this._debugGPUTimeQuery&&(this.commandEncoder.getTimeProfilingQuerySet()===this._debugGPUTimeQuery&&(this.commandEncoder=this.createCommandEncoder({id:this.commandEncoder.props.id})),this._debugGPUTimeQuery.destroy(),this._debugGPUTimeQuery=null)}_isDebugGPUTimeEnabled(){return null!==this._debugGPUTimeQuery}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}getModuleData(e){return this._moduleData[e]||={},this._moduleData[e]}static _getCanvasContextProps(e){return!0===e.createCanvasContext?{}:e.createCanvasContext}_getDeviceTextureFormatCapabilities(e){const t=Ai.getCapabilities(e),n=e=>("string"==typeof e?this.features.has(e):e)??!0,r=n(t.create);return{format:e,create:r,render:r&&n(t.render),filter:r&&n(t.filter),blend:r&&n(t.blend),store:r&&n(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t={...e};if((e.usage||0)&Zo.INDEX&&(e.indexType||(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":e.data instanceof Uint8Array&&(t.data=new Uint16Array(e.data),t.indexType="uint16")),!t.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return t}}function Ii(){return e=Bo.get("debug"),t=function(){const e=globalThis.process;if(e?.env)return e.env.NODE_ENV}(),null!=e?Boolean(e):void 0!==t&&"production"!==t;var e,t}class bi extends ko{static defaultProps={...ko.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1};get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){super(e,t=bi.normalizeProps(e,t),bi.defaultProps)}static normalizeProps(e,t){return t}}const Li={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"};class Pi extends ko{static SAMPLE=4;static STORAGE=8;static RENDER=16;static COPY_SRC=1;static COPY_DST=2;static TEXTURE=4;static RENDER_ATTACHMENT=16;dimension;baseDimension;format;width;height;depth;mipLevels;samples;byteAlignment;ready=Promise.resolve(this);isReady=!0;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(e,t,n){if(super(e,t=Pi.normalizeProps(e,t),Pi.defaultProps),this.dimension=this.props.dimension,this.baseDimension=Li[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.samples=this.props.samples||1,"cube"===this.dimension&&(this.depth=6),void 0===this.props.width||void 0===this.props.height)if(e.isExternalImage(t.data)){const n=e.getExternalImageSize(t.data);this.width=n?.width||1,this.height=n?.height||1}else this.width=1,this.height=1,void 0!==this.props.width&&void 0!==this.props.height||Bo.warn(`${this} created with undefined width or height. This is deprecated. Use DynamicTexture instead.`)();this.byteAlignment=n?.byteAlignment||1,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createTexture({...this.props,...e})}setSampler(e){this.sampler=e instanceof bi?e:this.device.createSampler(e)}copyImageData(e){const{data:t,depth:n,...r}=e;this.writeData(t,{...r,depthOrArrayLayers:r.depthOrArrayLayers??n})}computeMemoryLayout(e={}){const t=this._normalizeTextureReadOptions(e),{width:n=this.width,height:r=this.height,depthOrArrayLayers:o=this.depth}=t,{format:i,byteAlignment:s}=this;return Ai.computeMemoryLayout({format:i,width:n,height:r,depth:o,byteAlignment:s})}readBuffer(e,t){throw new Error("readBuffer not implemented")}readDataAsync(e){throw new Error("readBuffer not implemented")}writeBuffer(e,t){throw new Error("readBuffer not implemented")}writeData(e,t){throw new Error("readBuffer not implemented")}readDataSyncWebGL(e){throw new Error("readDataSyncWebGL not available")}generateMipmapsWebGL(){throw new Error("generateMipmapsWebGL not available")}static normalizeProps(e,t){const n={...t},{width:r,height:o}=n;return"number"==typeof r&&(n.width=Math.max(1,Math.ceil(r))),"number"==typeof o&&(n.height=Math.max(1,Math.ceil(o))),n}_initializeData(e){this.device.isExternalImage(e)?this.copyExternalImage({image:e,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):e&&this.copyImageData({data:e,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(e){const{data:t,depth:n,...r}=e,o=this._normalizeTextureWriteOptions({...r,depthOrArrayLayers:r.depthOrArrayLayers??n});return{data:t,depth:o.depthOrArrayLayers,...o}}_normalizeCopyExternalImageOptions(e){const t=Pi._omitUndefined(e),n=t.mipLevel??0,r=this._getMipLevelSize(n),o=this.device.getExternalImageSize(e.image),i={...Pi.defaultCopyExternalImageOptions,...r,...o,...t};return i.width=Math.min(i.width,r.width-i.x),i.height=Math.min(i.height,r.height-i.y),i.depth=Math.min(i.depth,r.depthOrArrayLayers-i.z),i}_normalizeTextureReadOptions(e){const t=Pi._omitUndefined(e),n=t.mipLevel??0,r=this._getMipLevelSize(n),o={...Pi.defaultTextureReadOptions,...r,...t};return o.width=Math.min(o.width,r.width-o.x),o.height=Math.min(o.height,r.height-o.y),o.depthOrArrayLayers=Math.min(o.depthOrArrayLayers,r.depthOrArrayLayers-o.z),o}_getSupportedColorReadOptions(e){const t=this._normalizeTextureReadOptions(e),n=Ai.getInfo(this.format);switch(this._validateColorReadAspect(t),this._validateColorReadFormat(n),this.dimension){case"2d":case"cube":case"cube-array":case"2d-array":case"3d":return t;default:throw new Error(`${this} color readback does not support ${this.dimension} textures`)}}_validateColorReadAspect(e){if("all"!==e.aspect)throw new Error(`${this} color readback only supports aspect 'all'`)}_validateColorReadFormat(e){if(e.compressed)throw new Error(`${this} color readback does not support compressed formats (${this.format})`);switch(e.attachment){case"color":return;case"depth":throw new Error(`${this} color readback does not support depth formats (${this.format})`);case"stencil":throw new Error(`${this} color readback does not support stencil formats (${this.format})`);case"depth-stencil":throw new Error(`${this} color readback does not support depth-stencil formats (${this.format})`);default:throw new Error(`${this} color readback does not support format ${this.format}`)}}_normalizeTextureWriteOptions(e){const t=Pi._omitUndefined(e),n=t.mipLevel??0,r=this._getMipLevelSize(n),o={...Pi.defaultTextureWriteOptions,...r,...t};o.width=Math.min(o.width,r.width-o.x),o.height=Math.min(o.height,r.height-o.y),o.depthOrArrayLayers=Math.min(o.depthOrArrayLayers,r.depthOrArrayLayers-o.z);const i=Ai.computeMemoryLayout({format:this.format,width:o.width,height:o.height,depth:o.depthOrArrayLayers,byteAlignment:this.byteAlignment}),s=i.bytesPerPixel*o.width;if(o.bytesPerRow=t.bytesPerRow??i.bytesPerRow,o.rowsPerImage=t.rowsPerImage??o.height,o.bytesPerRow<s)throw new Error(`bytesPerRow (${o.bytesPerRow}) must be at least ${s} for ${this.format}`);if(o.rowsPerImage<o.height)throw new Error(`rowsPerImage (${o.rowsPerImage}) must be at least ${o.height} for ${this.format}`);const a=this.device.getTextureFormatInfo(this.format).bytesPerPixel;if(a&&o.bytesPerRow%a!==0)throw new Error(`bytesPerRow (${o.bytesPerRow}) must be a multiple of bytesPerPixel (${a}) for ${this.format}`);return o}_getMipLevelSize(e){return{width:Math.max(1,this.width>>e),height:"1d"===this.baseDimension?1:Math.max(1,this.height>>e),depthOrArrayLayers:"3d"===this.dimension?Math.max(1,this.depth>>e):this.depth}}getAllocatedByteLength(){let e=0;for(let t=0;t<this.mipLevels;t++){const{width:n,height:r,depthOrArrayLayers:o}=this._getMipLevelSize(t);e+=Ai.computeMemoryLayout({format:this.format,width:n,height:r,depth:o,byteAlignment:1}).byteLength}return e*this.samples}static _omitUndefined(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}static defaultProps={...ko.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:Pi.SAMPLE|Pi.RENDER|Pi.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0};static defaultCopyDataOptions={data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,width:void 0,height:void 0,depthOrArrayLayers:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all"};static defaultCopyExternalImageOptions={image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1};static defaultTextureReadOptions={x:0,y:0,z:0,width:void 0,height:void 0,depthOrArrayLayers:1,mipLevel:0,aspect:"all"};static defaultTextureWriteOptions={byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,x:0,y:0,z:0,width:void 0,height:void 0,depthOrArrayLayers:1,mipLevel:0,aspect:"all"}}const yi="#define SMOOTH_EDGE_RADIUS 0.5",Di={name:"geometry",source:"const SMOOTH_EDGE_RADIUS: f32 = 0.5;\n\nstruct VertexGeometry {\n position: vec4<f32>,\n worldPosition: vec3<f32>,\n worldPositionAlt: vec3<f32>,\n normal: vec3<f32>,\n uv: vec2<f32>,\n pickingColor: vec3<f32>,\n};\n\nvar<private> geometry_: VertexGeometry = VertexGeometry(\n vec4<f32>(0.0, 0.0, 1.0, 0.0),\n vec3<f32>(0.0, 0.0, 0.0),\n vec3<f32>(0.0, 0.0, 0.0),\n vec3<f32>(0.0, 0.0, 0.0),\n vec2<f32>(0.0, 0.0),\n vec3<f32>(0.0, 0.0, 0.0)\n);\n\nstruct FragmentGeometry {\n uv: vec2<f32>,\n};\n\nvar<private> fragmentGeometry: FragmentGeometry;\n\nfn smoothedge(edge: f32, x: f32) -> f32 {\n return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);\n}\n",vs:`${yi}\n\nstruct VertexGeometry {\n vec4 position;\n vec3 worldPosition;\n vec3 worldPositionAlt;\n vec3 normal;\n vec2 uv;\n vec3 pickingColor;\n} geometry = VertexGeometry(\n vec4(0.0, 0.0, 1.0, 0.0),\n vec3(0.0),\n vec3(0.0),\n vec3(0.0),\n vec2(0.0),\n vec3(0.0)\n);\n`,fs:`${yi}\n\nstruct FragmentGeometry {\n vec2 uv;\n} geometry;\n\nfloat smoothedge(float edge, float x) {\n return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);\n}\n`};var Ui,Bi,Fi,wi,vi,Gi;(Bi=Ui||(Ui={}))[Bi.Start=1]="Start",Bi[Bi.Move=2]="Move",Bi[Bi.End=4]="End",Bi[Bi.Cancel=8]="Cancel",(wi=Fi||(Fi={}))[wi.None=0]="None",wi[wi.Left=1]="Left",wi[wi.Right=2]="Right",wi[wi.Up=4]="Up",wi[wi.Down=8]="Down",wi[wi.Horizontal=3]="Horizontal",wi[wi.Vertical=12]="Vertical",wi[wi.All=15]="All",(Gi=vi||(vi={}))[Gi.Possible=1]="Possible",Gi[Gi.Began=2]="Began",Gi[Gi.Changed=4]="Changed",Gi[Gi.Ended=8]="Ended",Gi[Gi.Recognized=8]="Recognized",Gi[Gi.Cancelled=16]="Cancelled",Gi[Gi.Failed=32]="Failed";const xi="compute",ji="auto",Wi="manipulation",Hi="none",Xi="pan-x",ki="pan-y";function $i(e){return e.trim().split(/\s+/g)}function Vi(e,t,n){if(e)for(const r of $i(t))e.addEventListener(r,n,!1)}function zi(e,t,n){if(e)for(const r of $i(t))e.removeEventListener(r,n,!1)}function Yi(e){return(e.ownerDocument||e).defaultView}function Ki(e){const t=e.length;if(1===t)return{x:Math.round(e[0].clientX),y:Math.round(e[0].clientY)};let n=0,r=0,o=0;for(;o<t;)n+=e[o].clientX,r+=e[o].clientY,o++;return{x:Math.round(n/t),y:Math.round(r/t)}}function Zi(e){const t=[];let n=0;for(;n<e.pointers.length;)t[n]={clientX:Math.round(e.pointers[n].clientX),clientY:Math.round(e.pointers[n].clientY)},n++;return{timeStamp:Date.now(),pointers:t,center:Ki(t),deltaX:e.deltaX,deltaY:e.deltaY}}function qi(e,t){const n=t.x-e.x,r=t.y-e.y;return Math.sqrt(n*n+r*r)}function Qi(e,t){const n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}function Ji(e,t){const n=t.clientX-e.clientX,r=t.clientY-e.clientY;return 180*Math.atan2(r,n)/Math.PI}function es(e,t){return e===t?Fi.None:Math.abs(e)>=Math.abs(t)?e<0?Fi.Left:Fi.Right:t<0?Fi.Up:Fi.Down}function ts(e,t,n){return{x:t/e||0,y:n/e||0}}function ns(e,t){const{session:n}=e,{pointers:r}=t,{length:o}=r;n.firstInput||(n.firstInput=Zi(t)),o>1&&!n.firstMultiple?n.firstMultiple=Zi(t):1===o&&(n.firstMultiple=!1);const{firstInput:i,firstMultiple:s}=n,a=s?s.center:i.center,c=t.center=Ki(r);t.timeStamp=Date.now(),t.deltaTime=t.timeStamp-i.timeStamp,t.angle=function(e,t){const n=t.x-e.x,r=t.y-e.y;return 180*Math.atan2(r,n)/Math.PI}(a,c),t.distance=qi(a,c);const{deltaX:l,deltaY:_}=function(e,t){const n=t.center;let r=e.offsetDelta,o=e.prevDelta;const i=e.prevInput;return t.eventType!==Ui.Start&&i?.eventType!==Ui.End||(o=e.prevDelta={x:i?.deltaX||0,y:i?.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),{deltaX:o.x+(n.x-r.x),deltaY:o.y+(n.y-r.y)}}(n,t);t.deltaX=l,t.deltaY=_,t.offsetDirection=es(t.deltaX,t.deltaY);const u=ts(t.deltaTime,t.deltaX,t.deltaY);var E,h;t.overallVelocityX=u.x,t.overallVelocityY=u.y,t.overallVelocity=Math.abs(u.x)>Math.abs(u.y)?u.x:u.y,t.scale=s?(E=s.pointers,Qi((h=r)[0],h[1])/Qi(E[0],E[1])):1,t.rotation=s?function(e,t){return Ji(t[1],t[0])-Ji(e[1],e[0])}(s.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length;let f=e.element;return function(e,t){let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1}(t.srcEvent.target,f)&&(f=t.srcEvent.target),t.target=f,function(e,t){const n=e.lastInterval||t,r=t.timeStamp-n.timeStamp;let o,i,s,a;if(t.eventType!==Ui.Cancel&&(r>25||void 0===n.velocity)){const c=t.deltaX-n.deltaX,l=t.deltaY-n.deltaY,_=ts(r,c,l);i=_.x,s=_.y,o=Math.abs(_.x)>Math.abs(_.y)?_.x:_.y,a=es(c,l),e.lastInterval=t}else o=n.velocity,i=n.velocityX,s=n.velocityY,a=n.direction;t.velocity=o,t.velocityX=i,t.velocityY=s,t.direction=a}(n,t),t}let rs=class{constructor(e){this.evEl="",this.evWin="",this.evTarget="",this.domHandler=e=>{this.manager.options.enable&&this.handler(e)},this.manager=e,this.element=e.element,this.target=e.options.inputTarget||e.element}callback(e,t){!function(e,t,n){const r=n.pointers.length,o=n.changedPointers.length,i=t&Ui.Start&&r-o===0,s=t&(Ui.End|Ui.Cancel)&&r-o===0;n.isFirst=Boolean(i),n.isFinal=Boolean(s),i&&(e.session={}),n.eventType=t;const a=ns(e,n);e.emit("hammer.input",a),e.recognize(a),e.session.prevInput=a}(this.manager,e,t)}init(){Vi(this.element,this.evEl,this.domHandler),Vi(this.target,this.evTarget,this.domHandler),Vi(Yi(this.element),this.evWin,this.domHandler)}destroy(){zi(this.element,this.evEl,this.domHandler),zi(this.target,this.evTarget,this.domHandler),zi(Yi(this.element),this.evWin,this.domHandler)}};const os={pointerdown:Ui.Start,pointermove:Ui.Move,pointerup:Ui.End,pointercancel:Ui.Cancel,pointerout:Ui.Cancel};class is extends rs{constructor(e){super(e),this.evEl="pointerdown",this.evWin="pointermove pointerup pointercancel",this.store=this.manager.session.pointerEvents=[],this.init()}handler(e){const{store:t}=this;let n=!1;const r=os[e.type],o=e.pointerType,i="touch"===o;let s=t.findIndex(t=>t.pointerId===e.pointerId);r&Ui.Start&&(e.buttons||i)?s<0&&(t.push(e),s=t.length-1):r&(Ui.End|Ui.Cancel)&&(n=!0),s<0||(t[s]=e,this.callback(r,{pointers:t,changedPointers:[e],eventType:r,pointerType:o,srcEvent:e}),n&&t.splice(s,1))}}let ss=1;function as(e){return e&vi.Cancelled?"cancel":e&vi.Ended?"end":e&vi.Changed?"move":e&vi.Began?"start":""}class cs{constructor(e){this.options=e,this.id=ss++,this.state=vi.Possible,this.simultaneous={},this.requireFail=[]}set(e){return Object.assign(this.options,e),this.manager.touchAction.update(),this}recognizeWith(e){if(Array.isArray(e)){for(const t of e)this.recognizeWith(t);return this}let t;if("string"==typeof e){if(t=this.manager.get(e),!t)throw new Error(`Cannot find recognizer ${e}`)}else t=e;const{simultaneous:n}=this;return n[t.id]||(n[t.id]=t,t.recognizeWith(this)),this}dropRecognizeWith(e){if(Array.isArray(e)){for(const t of e)this.dropRecognizeWith(t);return this}let t;return t="string"==typeof e?this.manager.get(e):e,t&&delete this.simultaneous[t.id],this}requireFailure(e){if(Array.isArray(e)){for(const t of e)this.requireFailure(t);return this}let t;if("string"==typeof e){if(t=this.manager.get(e),!t)throw new Error(`Cannot find recognizer ${e}`)}else t=e;const{requireFail:n}=this;return-1===n.indexOf(t)&&(n.push(t),t.requireFailure(this)),this}dropRequireFailure(e){if(Array.isArray(e)){for(const t of e)this.dropRequireFailure(t);return this}let t;if(t="string"==typeof e?this.manager.get(e):e,t){const e=this.requireFail.indexOf(t);e>-1&&this.requireFail.splice(e,1)}return this}hasRequireFailures(){return Boolean(this.requireFail.find(e=>e.options.enable))}canRecognizeWith(e){return Boolean(this.simultaneous[e.id])}emit(e){if(!e)return;const{state:t}=this;t<vi.Ended&&this.manager.emit(this.options.event+as(t),e),this.manager.emit(this.options.event,e),e.additionalEvent&&this.manager.emit(e.additionalEvent,e),t>=vi.Ended&&this.manager.emit(this.options.event+as(t),e)}tryEmit(e){this.canEmit()?this.emit(e):this.state=vi.Failed}canEmit(){let e=0;for(;e<this.requireFail.length;){if(!(this.requireFail[e].state&(vi.Failed|vi.Possible)))return!1;e++}return!0}recognize(e){const t={...e};if(!this.options.enable)return this.reset(),void(this.state=vi.Failed);this.state&(vi.Recognized|vi.Cancelled|vi.Failed)&&(this.state=vi.Possible),this.state=this.process(t),this.state&(vi.Began|vi.Changed|vi.Ended|vi.Cancelled)&&this.tryEmit(t)}getEventNames(){return[this.options.event]}reset(){}}class ls extends cs{attrTest(e){const t=this.options.pointers;return 0===t||e.pointers.length===t}process(e){const{state:t}=this,{eventType:n}=e,r=t&(vi.Began|vi.Changed),o=this.attrTest(e);return r&&(n&Ui.Cancel||!o)?t|vi.Cancelled:r||o?n&Ui.End?t|vi.Ended:t&vi.Began?t|vi.Changed:vi.Began:vi.Failed}}class _s extends cs{constructor(e={}){super({enable:!0,event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10,...e}),this.pTime=null,this.pCenter=null,this._timer=null,this._input=null,this.count=0}getTouchAction(){return[Wi]}process(e){const{options:t}=this,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,o=e.deltaTime<t.time;if(this.reset(),e.eventType&Ui.Start&&0===this.count)return this.failTimeout();if(r&&o&&n){if(e.eventType!==Ui.End)return this.failTimeout();const n=!this.pTime||e.timeStamp-this.pTime<t.interval,r=!this.pCenter||qi(this.pCenter,e.center)<t.posThreshold;this.pTime=e.timeStamp,this.pCenter=e.center,r&&n?this.count+=1:this.count=1,this._input=e;if(0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=setTimeout(()=>{this.state=vi.Recognized,this.tryEmit(this._input)},t.interval),vi.Began):vi.Recognized}return vi.Failed}failTimeout(){return this._timer=setTimeout(()=>{this.state=vi.Failed},this.options.interval),vi.Failed}reset(){clearTimeout(this._timer)}emit(e){this.state===vi.Recognized&&(e.tapCount=this.count,this.manager.emit(this.options.event,e))}}const us=["","start","move","end","cancel","up","down","left","right"];class Es extends ls{constructor(e={}){super({enable:!0,pointers:1,event:"pan",threshold:10,direction:Fi.All,...e}),this.pX=null,this.pY=null}getTouchAction(){const{options:{direction:e}}=this,t=[];return e&Fi.Horizontal&&t.push(ki),e&Fi.Vertical&&t.push(Xi),t}getEventNames(){return us.map(e=>this.options.event+e)}directionTest(e){const{options:t}=this;let n=!0,{distance:r}=e,{direction:o}=e;const i=e.deltaX,s=e.deltaY;return o&t.direction||(t.direction&Fi.Horizontal?(o=0===i?Fi.None:i<0?Fi.Left:Fi.Right,n=i!==this.pX,r=Math.abs(e.deltaX)):(o=0===s?Fi.None:s<0?Fi.Up:Fi.Down,n=s!==this.pY,r=Math.abs(e.deltaY))),e.direction=o,n&&r>t.threshold&&Boolean(o&t.direction)}attrTest(e){return super.attrTest(e)&&(Boolean(this.state&vi.Began)||!(this.state&vi.Began)&&this.directionTest(e))}emit(e){this.pX=e.deltaX,this.pY=e.deltaY;const t=Fi[e.direction].toLowerCase();t&&(e.additionalEvent=this.options.event+t),super.emit(e)}}const hs=["","start","move","end","cancel","in","out"];class fs{constructor(e,t,n){this.element=e,this.callback=t,this.options=n}}const ds=-1!==("undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"").indexOf("firefox"),ps=4.000244140625;class Ts extends fs{constructor(e,t,n){super(e,t,{enable:!0,...n}),this.handleEvent=e=>{if(!this.options.enable)return;let t=e.deltaY;globalThis.WheelEvent&&(ds&&e.deltaMode===globalThis.WheelEvent.DOM_DELTA_PIXEL&&(t/=globalThis.devicePixelRatio),e.deltaMode===globalThis.WheelEvent.DOM_DELTA_LINE&&(t*=40)),0!==t&&t%ps===0&&(t=Math.floor(t/ps)),e.shiftKey&&t&&(t*=.25),this.callback({type:"wheel",center:{x:e.clientX,y:e.clientY},delta:-t,srcEvent:e,pointerType:"mouse",target:e.target})},e.addEventListener("wheel",this.handleEvent,{passive:!1})}destroy(){this.element.removeEventListener("wheel",this.handleEvent)}enableEventType(e,t){"wheel"===e&&(this.options.enable=t)}}const Rs={DEFAULT:"default",LNGLAT:"lnglat",METER_OFFSETS:"meter-offsets",LNGLAT_OFFSETS:"lnglat-offsets",CARTESIAN:"cartesian"};Object.defineProperty(Rs,"IDENTITY",{get:()=>(Ft.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),Rs.CARTESIAN)});const As={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},gs={common:0,meters:1,pixels:2},ms={click:"onClick",dblclick:"onClick",panstart:"onDragStart",panmove:"onDrag",panend:"onDragEnd"},Ss={multipan:[Es,{threshold:10,direction:Fi.Vertical,pointers:2}],pinch:[class extends ls{constructor(e={}){super({enable:!0,event:"pinch",threshold:0,pointers:2,...e})}getTouchAction(){return[Hi]}getEventNames(){return hs.map(e=>this.options.event+e)}attrTest(e){return super.attrTest(e)&&(Math.abs(e.scale-1)>this.options.threshold||Boolean(this.state&vi.Began))}emit(e){if(1!==e.scale){const t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}super.emit(e)}},{},null,["multipan"]],pan:[Es,{threshold:1},["pinch"],["multipan"]],dblclick:[_s,{event:"dblclick",taps:2}],click:[_s,{event:"click"},null,["dblclick"]]};function Ms(e,t){if(e===t)return!0;if(Array.isArray(e)){const n=e.length;if(!t||t.length!==n)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}return!1}function Ns(e){let t,n={};return r=>{for(const o in r)if(!Ms(r[o],n[o])){t=e(r),n=r;break}return t}}const Os=[0,0,0,0],Cs=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],Is=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],bs=[0,0,0],Ls=[0,0,0],Ps={default:-1,cartesian:0,lnglat:1,"meter-offsets":2,"lnglat-offsets":3};function ys(e){const t=Ps[e];if(void 0===t)throw new Error(`Invalid coordinateSystem: ${e}`);return t}const Ds=Ns(function({viewport:e,devicePixelRatio:t,coordinateSystem:n,coordinateOrigin:r}){const{projectionCenter:o,viewProjectionMatrix:i,originCommon:s,cameraPosCommon:a,shaderCoordinateOrigin:c,geospatialOrigin:l}=function(e,t,n){const{viewMatrixUncentered:r,projectionMatrix:o}=e;let{viewMatrix:i,viewProjectionMatrix:s}=e,a=Os,c=Os,l=e.cameraPosition;const{geospatialOrigin:_,shaderCoordinateOrigin:u,offsetMode:E}=Us(e,t,n);E&&(c=e.projectPosition(_||u),l=[l[0]-c[0],l[1]-c[1],l[2]-c[2]],c[3]=1,a=po([],c,s),i=r||i,s=eo([],o,i),s=eo([],s,Cs));return{viewMatrix:i,viewProjectionMatrix:s,projectionCenter:a,originCommon:c,cameraPosCommon:l,shaderCoordinateOrigin:u,geospatialOrigin:_}}(e,n,r),_=e.getDistanceScales(),u=[e.width*t,e.height*t],E=po([],[0,0,-e.focalDistance,1],e.projectionMatrix)[3]||1,h={coordinateSystem:ys(n),projectionMode:e.projectionMode,coordinateOrigin:c,commonOrigin:s.slice(0,3),center:o,pseudoMeters:Boolean(e._pseudoMeters),viewportSize:u,devicePixelRatio:t,focalDistance:E,commonUnitsPerMeter:_.unitsPerMeter,commonUnitsPerWorldUnit:_.unitsPerMeter,commonUnitsPerWorldUnit2:bs,scale:e.scale,wrapLongitude:!1,viewProjectionMatrix:i,modelMatrix:Is,cameraPosition:a};if(l){const t=e.getDistanceScales(l);switch(n){case"meter-offsets":h.commonUnitsPerWorldUnit=t.unitsPerMeter,h.commonUnitsPerWorldUnit2=t.unitsPerMeter2;break;case"lnglat":case"lnglat-offsets":e._pseudoMeters||(h.commonUnitsPerMeter=t.unitsPerMeter),h.commonUnitsPerWorldUnit=t.unitsPerDegree,h.commonUnitsPerWorldUnit2=t.unitsPerDegree2;break;case"cartesian":h.commonUnitsPerWorldUnit=[1,1,t.unitsPerMeter[2]],h.commonUnitsPerWorldUnit2=[0,0,t.unitsPerMeter2[2]]}}return h});function Us(e,t,n=Ls){n.length<3&&(n=[n[0],n[1],0]);let r,o=n,i=!0;switch(r="lnglat-offsets"===t||"meter-offsets"===t?n:e.isGeospatial?[Math.fround(e.longitude),Math.fround(e.latitude),0]:null,e.projectionMode){case As.WEB_MERCATOR:"lnglat"!==t&&"cartesian"!==t||(r=[0,0,0],i=!1);break;case As.WEB_MERCATOR_AUTO_OFFSET:"lnglat"===t?o=r:"cartesian"===t&&(o=[Math.fround(e.center[0]),Math.fround(e.center[1]),0],r=e.unprojectPosition(o),o[0]-=n[0],o[1]-=n[1],o[2]-=n[2]);break;case As.IDENTITY:o=e.position.map(Math.fround),o[2]=o[2]||0;break;case As.GLOBE:i=!1,r=null;break;default:i=!1}return{geospatialOrigin:r,shaderCoordinateOrigin:o,offsetMode:i}}const Bs=`${`${["default","lnglat","meter-offsets","lnglat-offsets","cartesian"].map(e=>`const COORDINATE_SYSTEM_${e.toUpperCase().replaceAll("-","_")}: i32 = ${ys(e)};`).join("")}\n${Object.keys(As).map(e=>`const PROJECTION_MODE_${e}: i32 = ${As[e]};`).join("")}\n${Object.keys(gs).map(e=>`const UNIT_${e.toUpperCase()}: i32 = ${gs[e]};`).join("")}\n\nconst TILE_SIZE: f32 = 512.0;\nconst PI: f32 = 3.1415926536;\nconst WORLD_SCALE: f32 = TILE_SIZE / (PI * 2.0);\nconst ZERO_64_LOW: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);\nconst EARTH_RADIUS: f32 = 6370972.0; // meters\nconst GLOBE_RADIUS: f32 = 256.0;\n\n// -----------------------------------------------------------------------------\n// Uniform block (converted from GLSL uniform block)\n// -----------------------------------------------------------------------------\nstruct ProjectUniforms {\n wrapLongitude: i32,\n coordinateSystem: i32,\n commonUnitsPerMeter: vec3<f32>,\n projectionMode: i32,\n scale: f32,\n commonUnitsPerWorldUnit: vec3<f32>,\n commonUnitsPerWorldUnit2: vec3<f32>,\n center: vec4<f32>,\n modelMatrix: mat4x4<f32>,\n viewProjectionMatrix: mat4x4<f32>,\n viewportSize: vec2<f32>,\n devicePixelRatio: f32,\n focalDistance: f32,\n cameraPosition: vec3<f32>,\n coordinateOrigin: vec3<f32>,\n commonOrigin: vec3<f32>,\n pseudoMeters: i32,\n};\n\n@group(0) @binding(auto)\nvar<uniform> project: ProjectUniforms;\n\n// -----------------------------------------------------------------------------\n// Geometry data shared across the project helpers.\n// The active layer shader is responsible for populating this private module\n// state before calling the project functions below.\n// -----------------------------------------------------------------------------\n\n// Structure to carry additional geometry data used by deck.gl filters.\nstruct Geometry {\n worldPosition: vec3<f32>,\n worldPositionAlt: vec3<f32>,\n position: vec4<f32>,\n normal: vec3<f32>,\n uv: vec2<f32>,\n pickingColor: vec3<f32>,\n};\n\nvar<private> geometry: Geometry;\n`}\n\n// -----------------------------------------------------------------------------\n// Functions\n// -----------------------------------------------------------------------------\n\n// Returns an adjustment factor for commonUnitsPerMeter\nfn _project_size_at_latitude(lat: f32) -> f32 {\n let y = clamp(lat, -89.9, 89.9);\n return 1.0 / cos(radians(y));\n}\n\n// Overloaded version: scales a value in meters at a given latitude.\nfn _project_size_at_latitude_m(meters: f32, lat: f32) -> f32 {\n return meters * project.commonUnitsPerMeter.z * _project_size_at_latitude(lat);\n}\n\n// Computes a non-linear scale factor based on geometry.\n// (Note: This function relies on "geometry" being provided.)\nfn project_size() -> f32 {\n if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR &&\n project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT &&\n project.pseudoMeters == 0) {\n if (geometry.position.w == 0.0) {\n return _project_size_at_latitude(geometry.worldPosition.y);\n }\n let y: f32 = geometry.position.y / TILE_SIZE * 2.0 - 1.0;\n let y2 = y * y;\n let y4 = y2 * y2;\n let y6 = y4 * y2;\n return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;\n }\n return 1.0;\n}\n\n// Overloads to scale offsets (meters to world units)\nfn project_size_float(meters: f32) -> f32 {\n return meters * project.commonUnitsPerMeter.z * project_size();\n}\n\nfn project_size_vec2(meters: vec2<f32>) -> vec2<f32> {\n return meters * project.commonUnitsPerMeter.xy * project_size();\n}\n\nfn project_size_vec3(meters: vec3<f32>) -> vec3<f32> {\n return meters * project.commonUnitsPerMeter * project_size();\n}\n\nfn project_size_vec4(meters: vec4<f32>) -> vec4<f32> {\n return vec4<f32>(meters.xyz * project.commonUnitsPerMeter, meters.w);\n}\n\n// Returns a rotation matrix aligning the z‑axis with the given up vector.\nfn project_get_orientation_matrix(up: vec3<f32>) -> mat3x3<f32> {\n let uz = normalize(up);\n let ux = select(\n vec3<f32>(1.0, 0.0, 0.0),\n normalize(vec3<f32>(uz.y, -uz.x, 0.0)),\n abs(uz.z) == 1.0\n );\n let uy = cross(uz, ux);\n return mat3x3<f32>(ux, uy, uz);\n}\n\n// Since WGSL does not support "out" parameters, we return a struct.\nstruct RotationResult {\n needsRotation: bool,\n transform: mat3x3<f32>,\n};\n\nfn project_needs_rotation(commonPosition: vec3<f32>) -> RotationResult {\n if (project.projectionMode == PROJECTION_MODE_GLOBE) {\n return RotationResult(true, project_get_orientation_matrix(commonPosition));\n } else {\n return RotationResult(false, mat3x3<f32>()); // identity alternative if needed\n };\n}\n\n// Projects a normal vector from the current coordinate system to world space.\nfn project_normal(vector: vec3<f32>) -> vec3<f32> {\n let normal_modelspace = project.modelMatrix * vec4<f32>(vector, 0.0);\n var n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter);\n let rotResult = project_needs_rotation(geometry.position.xyz);\n if (rotResult.needsRotation) {\n n = rotResult.transform * n;\n }\n return n;\n}\n\n// Applies a scale offset based on y-offset (dy)\nfn project_offset_(offset: vec4<f32>) -> vec4<f32> {\n let dy: f32 = offset.y;\n let commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy;\n return vec4<f32>(offset.xyz * commonUnitsPerWorldUnit, offset.w);\n}\n\n// Projects lng/lat coordinates to a unit tile [0,1]\nfn project_mercator_(lnglat: vec2<f32>) -> vec2<f32> {\n var x = lnglat.x;\n if (project.wrapLongitude != 0) {\n x = ((x + 180.0) % 360.0) - 180.0;\n }\n let y = clamp(lnglat.y, -89.9, 89.9);\n return vec2<f32>(\n radians(x) + PI,\n PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\n// Projects lng/lat/z coordinates for a globe projection.\nfn project_globe_(lnglatz: vec3<f32>) -> vec3<f32> {\n let lambda = radians(lnglatz.x);\n let phi = radians(lnglatz.y);\n let cosPhi = cos(phi);\n let D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;\n return vec3<f32>(\n sin(lambda) * cosPhi,\n -cos(lambda) * cosPhi,\n sin(phi)\n ) * D;\n}\n\n// Projects positions (with an optional 64-bit low part) from the input\n// coordinate system to the common space.\nfn project_position_vec4_f64(position: vec4<f32>, position64Low: vec3<f32>) -> vec4<f32> {\n var position_world = project.modelMatrix * position;\n\n // Work around for a Mac+NVIDIA bug:\n if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) {\n if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n return vec4<f32>(\n project_mercator_(position_world.xy),\n _project_size_at_latitude_m(position_world.z, position_world.y),\n position_world.w\n );\n }\n if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {\n position_world = vec4f(position_world.xyz + project.coordinateOrigin, position_world.w);\n }\n }\n if (project.projectionMode == PROJECTION_MODE_GLOBE) {\n if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n return vec4<f32>(\n project_globe_(position_world.xyz),\n position_world.w\n );\n }\n }\n if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) {\n return vec4<f32>(\n project_mercator_(position_world.xy) - project.commonOrigin.xy,\n project_size_float(position_world.z),\n position_world.w\n );\n }\n }\n }\n if (project.projectionMode == PROJECTION_MODE_IDENTITY ||\n (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&\n (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {\n position_world = vec4f(position_world.xyz - project.coordinateOrigin, position_world.w);\n }\n\n return project_offset_(position_world) +\n project_offset_(project.modelMatrix * vec4<f32>(position64Low, 0.0));\n}\n\n// Overloaded versions for different input types.\nfn project_position_vec4_f32(position: vec4<f32>) -> vec4<f32> {\n return project_position_vec4_f64(position, ZERO_64_LOW);\n}\n\nfn project_position_vec3_f64(position: vec3<f32>, position64Low: vec3<f32>) -> vec3<f32> {\n let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), position64Low);\n return projected_position.xyz;\n}\n\nfn project_position_vec3_f32(position: vec3<f32>) -> vec3<f32> {\n let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), ZERO_64_LOW);\n return projected_position.xyz;\n}\n\nfn project_position_vec2_f32(position: vec2<f32>) -> vec2<f32> {\n let projected_position = project_position_vec4_f64(vec4<f32>(position, 0.0, 1.0), ZERO_64_LOW);\n return projected_position.xy;\n}\n\n// Transforms a common space position to clip space.\nfn project_common_position_to_clipspace_with_projection(position: vec4<f32>, viewProjectionMatrix: mat4x4<f32>, center: vec4<f32>) -> vec4<f32> {\n return viewProjectionMatrix * position + center;\n}\n\n// Uses the project viewProjectionMatrix and center.\nfn project_common_position_to_clipspace(position: vec4<f32>) -> vec4<f32> {\n return project_common_position_to_clipspace_with_projection(position, project.viewProjectionMatrix, project.center);\n}\n\n// Returns a clip space offset corresponding to a given number of screen pixels.\nfn project_pixel_size_to_clipspace(pixels: vec2<f32>) -> vec2<f32> {\n let offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0;\n return offset * project.focalDistance;\n}\n\nfn project_meter_size_to_pixel(meters: f32) -> f32 {\n return project_size_float(meters) * project.scale;\n}\n\nfn project_unit_size_to_pixel(size: f32, unit: i32) -> f32 {\n if (unit == UNIT_METERS) {\n return project_meter_size_to_pixel(size);\n } else if (unit == UNIT_COMMON) {\n return size * project.scale;\n }\n // UNIT_PIXELS: no scaling applied.\n return size;\n}\n\nfn project_pixel_size_float(pixels: f32) -> f32 {\n return pixels / project.scale;\n}\n\nfn project_pixel_size_vec2(pixels: vec2<f32>) -> vec2<f32> {\n return pixels / project.scale;\n}\n`,Fs=["default","lnglat","meter-offsets","lnglat-offsets","cartesian"].map(e=>`const int COORDINATE_SYSTEM_${e.toUpperCase().replaceAll("-","_")} = ${ys(e)};`).join(""),ws=Object.keys(As).map(e=>`const int PROJECTION_MODE_${e} = ${As[e]};`).join(""),vs=Object.keys(gs).map(e=>`const int UNIT_${e.toUpperCase()} = ${gs[e]};`).join(""),Gs={};const xs={name:"project",dependencies:[Lo,Di],source:Bs,vs:`${Fs}\n${ws}\n${vs}\nlayout(std140) uniform projectUniforms {\nbool wrapLongitude;\nint coordinateSystem;\nvec3 commonUnitsPerMeter;\nint projectionMode;\nfloat scale;\nvec3 commonUnitsPerWorldUnit;\nvec3 commonUnitsPerWorldUnit2;\nvec4 center;\nmat4 modelMatrix;\nmat4 viewProjectionMatrix;\nvec2 viewportSize;\nfloat devicePixelRatio;\nfloat focalDistance;\nvec3 cameraPosition;\nvec3 coordinateOrigin;\nvec3 commonOrigin;\nbool pseudoMeters;\n} project;\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / (PI * 2.0);\nconst vec3 ZERO_64_LOW = vec3(0.0);\nconst float EARTH_RADIUS = 6370972.0;\nconst float GLOBE_RADIUS = 256.0;\nfloat project_size_at_latitude(float lat) {\nfloat y = clamp(lat, -89.9, 89.9);\nreturn 1.0 / cos(radians(y));\n}\nfloat project_size() {\nif (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR &&\nproject.coordinateSystem == COORDINATE_SYSTEM_LNGLAT &&\nproject.pseudoMeters == false) {\nif (geometry.position.w == 0.0) {\nreturn project_size_at_latitude(geometry.worldPosition.y);\n}\nfloat y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;\nfloat y2 = y * y;\nfloat y4 = y2 * y2;\nfloat y6 = y4 * y2;\nreturn 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;\n}\nreturn 1.0;\n}\nfloat project_size_at_latitude(float meters, float lat) {\nreturn meters * project.commonUnitsPerMeter.z * project_size_at_latitude(lat);\n}\nfloat project_size(float meters) {\nreturn meters * project.commonUnitsPerMeter.z * project_size();\n}\nvec2 project_size(vec2 meters) {\nreturn meters * project.commonUnitsPerMeter.xy * project_size();\n}\nvec3 project_size(vec3 meters) {\nreturn meters * project.commonUnitsPerMeter * project_size();\n}\nvec4 project_size(vec4 meters) {\nreturn vec4(meters.xyz * project.commonUnitsPerMeter, meters.w);\n}\nmat3 project_get_orientation_matrix(vec3 up) {\nvec3 uz = normalize(up);\nvec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));\nvec3 uy = cross(uz, ux);\nreturn mat3(ux, uy, uz);\n}\nbool project_needs_rotation(vec3 commonPosition, out mat3 transform) {\nif (project.projectionMode == PROJECTION_MODE_GLOBE) {\ntransform = project_get_orientation_matrix(commonPosition);\nreturn true;\n}\nreturn false;\n}\nvec3 project_normal(vec3 vector) {\nvec4 normal_modelspace = project.modelMatrix * vec4(vector, 0.0);\nvec3 n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter);\nmat3 rotation;\nif (project_needs_rotation(geometry.position.xyz, rotation)) {\nn = rotation * n;\n}\nreturn n;\n}\nvec4 project_offset_(vec4 offset) {\nfloat dy = offset.y;\nvec3 commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy;\nreturn vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);\n}\nvec2 project_mercator_(vec2 lnglat) {\nfloat x = lnglat.x;\nif (project.wrapLongitude) {\nx = mod(x + 180., 360.0) - 180.;\n}\nfloat y = clamp(lnglat.y, -89.9, 89.9);\nreturn vec2(\nradians(x) + PI,\nPI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))\n) * WORLD_SCALE;\n}\nvec3 project_globe_(vec3 lnglatz) {\nfloat lambda = radians(lnglatz.x);\nfloat phi = radians(lnglatz.y);\nfloat cosPhi = cos(phi);\nfloat D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;\nreturn vec3(\nsin(lambda) * cosPhi,\n-cos(lambda) * cosPhi,\nsin(phi)\n) * D;\n}\nvec4 project_position(vec4 position, vec3 position64Low) {\nvec4 position_world = project.modelMatrix * position;\nif (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) {\nif (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\nreturn vec4(\nproject_mercator_(position_world.xy),\nproject_size_at_latitude(position_world.z, position_world.y),\nposition_world.w\n);\n}\nif (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {\nposition_world.xyz += project.coordinateOrigin;\n}\n}\nif (project.projectionMode == PROJECTION_MODE_GLOBE) {\nif (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\nreturn vec4(\nproject_globe_(position_world.xyz),\nposition_world.w\n);\n}\n}\nif (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\nif (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\nif (abs(position_world.y - project.coordinateOrigin.y) > 0.25) {\nreturn vec4(\nproject_mercator_(position_world.xy) - project.commonOrigin.xy,\nproject_size(position_world.z),\nposition_world.w\n);\n}\n}\n}\nif (project.projectionMode == PROJECTION_MODE_IDENTITY ||\n(project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&\n(project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\nproject.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {\nposition_world.xyz -= project.coordinateOrigin;\n}\nreturn project_offset_(position_world) + project_offset_(project.modelMatrix * vec4(position64Low, 0.0));\n}\nvec4 project_position(vec4 position) {\nreturn project_position(position, ZERO_64_LOW);\n}\nvec3 project_position(vec3 position, vec3 position64Low) {\nvec4 projected_position = project_position(vec4(position, 1.0), position64Low);\nreturn projected_position.xyz;\n}\nvec3 project_position(vec3 position) {\nvec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);\nreturn projected_position.xyz;\n}\nvec2 project_position(vec2 position) {\nvec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);\nreturn projected_position.xy;\n}\nvec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {\nreturn viewProjectionMatrix * position + center;\n}\nvec4 project_common_position_to_clipspace(vec4 position) {\nreturn project_common_position_to_clipspace(position, project.viewProjectionMatrix, project.center);\n}\nvec2 project_pixel_size_to_clipspace(vec2 pixels) {\nvec2 offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0;\nreturn offset * project.focalDistance;\n}\nfloat project_size_to_pixel(float meters) {\nreturn project_size(meters) * project.scale;\n}\nvec2 project_size_to_pixel(vec2 meters) {\nreturn project_size(meters) * project.scale;\n}\nfloat project_size_to_pixel(float size, int unit) {\nif (unit == UNIT_METERS) return project_size_to_pixel(size);\nif (unit == UNIT_COMMON) return size * project.scale;\nreturn size;\n}\nfloat project_pixel_size(float pixels) {\nreturn pixels / project.scale;\n}\nvec2 project_pixel_size(vec2 pixels) {\nreturn pixels / project.scale;\n}\n`,getUniforms:function(e=Gs){return"viewport"in e?function({viewport:e,devicePixelRatio:t=1,modelMatrix:n=null,coordinateSystem:r="default",coordinateOrigin:o=Ls,autoWrapLongitude:i=!1}){"default"===r&&(r=e.isGeospatial?"lnglat":"cartesian");const s=Ds({viewport:e,devicePixelRatio:t,coordinateSystem:r,coordinateOrigin:o});return s.wrapLongitude=i,s.modelMatrix=n||Is,s}(e):{}},uniformTypes:{wrapLongitude:"f32",coordinateSystem:"i32",commonUnitsPerMeter:"vec3<f32>",projectionMode:"i32",scale:"f32",commonUnitsPerWorldUnit:"vec3<f32>",commonUnitsPerWorldUnit2:"vec3<f32>",center:"vec4<f32>",modelMatrix:"mat4x4<f32>",viewProjectionMatrix:"mat4x4<f32>",viewportSize:"vec2<f32>",devicePixelRatio:"f32",focalDistance:"f32",cameraPosition:"vec3<f32>",coordinateOrigin:"vec3<f32>",commonOrigin:"vec3<f32>",pseudoMeters:"f32"}};function js(e,t){const n=po([],t,e);return lo(n,n,1/n[3]),n}function Ws(e,t,n){return e<t?t:e>n?n:e}const Hs=Math.log2||function(e){return Math.log(e)*Math.LOG2E};function Xs(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}const ks=Math.PI,$s=ks/4,Vs=ks/180,zs=180/ks,Ys=512,Ks=4003e4,Zs=85.051129,qs=1.5;function Qs(e){const[t,n]=e;Xs(Number.isFinite(t)),Xs(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");const r=n*Vs;return[Ys*(t*Vs+ks)/(2*ks),Ys*(ks+Math.log(Math.tan($s+.5*r)))/(2*ks)]}function Js(e){const[t,n]=e,r=t/Ys*(2*ks)-ks,o=2*(Math.atan(Math.exp(n/Ys*(2*ks)-ks))-$s);return[r*zs,o*zs]}function ea(e){const{latitude:t}=e;Xs(Number.isFinite(t));const n=Math.cos(t*Vs);return Hs(Ks*n)-9}function ta(e){return 12790407194604047e-21/Math.cos(e*Vs)}function na(e){const{latitude:t,longitude:n,highPrecision:r=!1}=e;Xs(Number.isFinite(t)&&Number.isFinite(n));const o=Ys,i=Math.cos(t*Vs),s=o/360,a=s/i,c=12790407194604047e-21/i,l={unitsPerMeter:[c,c,c],metersPerUnit:[1/c,1/c,1/c],unitsPerDegree:[s,a,c],degreesPerUnit:[.703125,1/a,1/c]};if(r){const e=Vs*Math.tan(t*Vs)/i,n=s*e/2,r=12790407194604047e-21*e,o=r/a*c;l.unitsPerDegree2=[0,n,r],l.unitsPerMeter2=[o,0,o]}return l}function ra(e,t){const[n,r,o]=e,[i,s,a]=t,{unitsPerMeter:c,unitsPerMeter2:l}=na({longitude:n,latitude:r,highPrecision:!0}),_=Qs(e);_[0]+=i*(c[0]+l[0]*s),_[1]+=s*(c[1]+l[1]*s);const u=Js(_),E=(o||0)+(a||0);return Number.isFinite(o)||Number.isFinite(a)?[u[0],u[1],E]:u}function oa(e){return 2*Math.atan(.5/e)*zs}function ia(e){return.5/Math.tan(.5*e*Vs)}function sa(e,t){const[n,r,o=0]=e;return Xs(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(o)),js(t,[n,r,o,1])}function aa(e,t,n=0){const[r,o,i]=e;if(Xs(Number.isFinite(r)&&Number.isFinite(o),"invalid pixel coordinate"),Number.isFinite(i)){return js(t,[r,o,i,1])}const s=js(t,[r,o,0,1]),a=js(t,[r,o,1,1]),c=s[2],l=a[2];return Ir([],s,a,c===l?0:((n||0)-c)/(l-c))}function ca(e){const{width:t,height:n,bounds:r,minExtent:o=0,maxZoom:i=24,offset:s=[0,0]}=e,[[a,c],[l,_]]=r,u=function(e=0){if("number"==typeof e)return{top:e,bottom:e,left:e,right:e};return Xs(Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.left)&&Number.isFinite(e.right)),e}(e.padding),E=Qs([a,Ws(_,-85.051129,Zs)]),h=Qs([l,Ws(c,-85.051129,Zs)]),f=[Math.max(Math.abs(h[0]-E[0]),o),Math.max(Math.abs(h[1]-E[1]),o)],d=[t-u.left-u.right-2*Math.abs(s[0]),n-u.top-u.bottom-2*Math.abs(s[1])];Xs(d[0]>0&&d[1]>0);const p=d[0]/f[0],T=d[1]/f[1],R=(u.right-u.left)/2/p,A=(u.top-u.bottom)/2/T,g=Js([(h[0]+E[0])/2+R,(h[1]+E[1])/2+A]),m=Math.min(i,Hs(Math.abs(Math.min(p,T))));return Xs(Number.isFinite(m)),{longitude:g[0],latitude:g[1],zoom:m}}const la=Math.PI/180;function _a(e,t,n){const{pixelUnprojectionMatrix:r}=e,o=js(r,[t,0,1,1]),i=js(r,[t,e.height,1,1]),s=Js(Ir([],o,i,(n*e.distanceScales.unitsPerMeter[2]-o[2])/(i[2]-o[2])));return s.push(n),s}const ua=new class{constructor(e={}){this._pool=[],this.opts={overAlloc:2,poolSize:100},this.setOptions(e)}setOptions(e){Object.assign(this.opts,e)}allocate(e,t,{size:n=1,type:r,padding:o=0,copy:i=!1,initialize:s=!1,maxCount:a}){const c=r||e&&e.constructor||Float32Array,l=t*n+o;if(ArrayBuffer.isView(e)){if(l<=e.length)return e;if(l*e.BYTES_PER_ELEMENT<=e.buffer.byteLength)return new c(e.buffer,0,l)}let _=1/0;a&&(_=a*n+o);const u=this._allocate(c,l,s,_);return e&&i?u.set(e):s||u.fill(0,0,4),this._release(e),u}release(e){this._release(e)}_allocate(e,t,n,r){let o=Math.max(Math.ceil(t*this.opts.overAlloc),1);o>r&&(o=r);const i=this._pool,s=e.BYTES_PER_ELEMENT*o,a=i.findIndex(e=>e.byteLength>=s);if(a>=0){const t=new e(i.splice(a,1)[0],0,o);return n&&t.fill(0),t}return new e(o)}_release(e){if(!ArrayBuffer.isView(e))return;const t=this._pool,{buffer:n}=e,{byteLength:r}=n,o=t.findIndex(e=>e.byteLength>=r);o<0?t.push(n):(o>0||t.length<this.opts.poolSize)&&t.splice(o,0,n),t.length>this.opts.poolSize&&t.shift()}};function Ea(e,t){const n=e%t;return n<0?t+n:n}const ha=new qr;function fa(e,t,n,r){ha.set(e,t,n);const o=ha.len();return{distance:r/o,normal:new qr(-e/o,-t/o,-n/o)}}function da(e){return e-Math.fround(e)}let pa;function Ta(e,t){const{size:n=1,startIndex:r=0}=t,o=void 0!==t.endIndex?t.endIndex:e.length,i=(o-r)/n;pa=ua.allocate(pa,i,{type:Float32Array,size:2*n});let s=r,a=0;for(;s<o;){for(let t=0;t<n;t++){const r=e[s++];pa[a+t]=r,pa[a+t+n]=da(r)}a+=2*n}return pa.subarray(0,i*n*2)}function Ra(e){let t=null,n=!1;for(const r of e)r&&(t?(n||(t=[[t[0][0],t[0][1]],[t[1][0],t[1][1]]],n=!0),t[0][0]=Math.min(t[0][0],r[0][0]),t[0][1]=Math.min(t[0][1],r[0][1]),t[1][0]=Math.max(t[1][0],r[1][0]),t[1][1]=Math.max(t[1][1],r[1][1])):t=r);return t}const Aa=Math.PI/180,ga=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],ma=[0,0,0],Sa={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};class Ma{constructor(e={}){this._frustumPlanes={},this.id=e.id||this.constructor.displayName||"viewport",this.x=e.x||0,this.y=e.y||0,this.width=e.width||1,this.height=e.height||1,this.zoom=e.zoom||0,this.padding=e.padding,this.distanceScales=e.distanceScales||Sa,this.focalDistance=e.focalDistance||1,this.position=e.position||ma,this.modelMatrix=e.modelMatrix||null;const{longitude:t,latitude:n}=e;this.isGeospatial=Number.isFinite(n)&&Number.isFinite(t),this._initProps(e),this._initMatrices(e),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}get subViewports(){return null}get metersPerPixel(){return this.distanceScales.metersPerUnit[2]/this.scale}get projectionMode(){return this.isGeospatial?this.zoom<12?As.WEB_MERCATOR:As.WEB_MERCATOR_AUTO_OFFSET:As.IDENTITY}equals(e){return e instanceof Ma&&(this===e||e.width===this.width&&e.height===this.height&&e.scale===this.scale&&Tr(e.projectionMatrix,this.projectionMatrix)&&Tr(e.viewMatrix,this.viewMatrix))}project(e,{topLeft:t=!0}={}){const n=sa(this.projectPosition(e),this.pixelProjectionMatrix),[r,o]=n,i=t?o:this.height-o;return 2===e.length?[r,i]:[r,i,n[2]]}unproject(e,{topLeft:t=!0,targetZ:n}={}){const[r,o,i]=e,s=t?o:this.height-o,a=n&&n*this.distanceScales.unitsPerMeter[2],c=aa([r,s,i],this.pixelUnprojectionMatrix,a),[l,_,u]=this.unprojectPosition(c);return Number.isFinite(i)?[l,_,u]:Number.isFinite(n)?[l,_,n]:[l,_]}projectPosition(e){const[t,n]=this.projectFlat(e);return[t,n,(e[2]||0)*this.distanceScales.unitsPerMeter[2]]}unprojectPosition(e){const[t,n]=this.unprojectFlat(e);return[t,n,(e[2]||0)*this.distanceScales.metersPerUnit[2]]}projectFlat(e){if(this.isGeospatial){const t=Qs(e);return t[1]=dr(t[1],-318,830),t}return e}unprojectFlat(e){return this.isGeospatial?Js(e):e}getBounds(e={}){const t={targetZ:e.z||0},n=this.unproject([0,0],t),r=this.unproject([this.width,0],t),o=this.unproject([0,this.height],t),i=this.unproject([this.width,this.height],t);return[Math.min(n[0],r[0],o[0],i[0]),Math.min(n[1],r[1],o[1],i[1]),Math.max(n[0],r[0],o[0],i[0]),Math.max(n[1],r[1],o[1],i[1])]}getDistanceScales(e){return e&&this.isGeospatial?na({longitude:e[0],latitude:e[1],highPrecision:!0}):this.distanceScales}containsPixel({x:e,y:t,width:n=1,height:r=1}){return e<this.x+this.width&&this.x<e+n&&t<this.y+this.height&&this.y<t+r}getFrustumPlanes(){return this._frustumPlanes.near||Object.assign(this._frustumPlanes,{left:fa((e=this.viewProjectionMatrix)[3]+e[0],e[7]+e[4],e[11]+e[8],e[15]+e[12]),right:fa(e[3]-e[0],e[7]-e[4],e[11]-e[8],e[15]-e[12]),bottom:fa(e[3]+e[1],e[7]+e[5],e[11]+e[9],e[15]+e[13]),top:fa(e[3]-e[1],e[7]-e[5],e[11]-e[9],e[15]-e[13]),near:fa(e[3]+e[2],e[7]+e[6],e[11]+e[10],e[15]+e[14]),far:fa(e[3]-e[2],e[7]-e[6],e[11]-e[10],e[15]-e[14])}),this._frustumPlanes;var e}panByPosition(e,t,n){return null}_initProps(e){const t=e.longitude,n=e.latitude;this.isGeospatial&&(Number.isFinite(e.zoom)||(this.zoom=ea({latitude:n})+Math.log2(this.focalDistance)),this.distanceScales=e.distanceScales||na({latitude:n,longitude:t}));const r=Math.pow(2,this.zoom);this.scale=r;const{position:o,modelMatrix:i}=e;let s=ma;if(o&&(s=i?new Oo(i).transformAsVector(o,[]):o),this.isGeospatial){const e=this.projectPosition([t,n,0]);this.center=new qr(s).scale(this.distanceScales.unitsPerMeter).add(e)}else this.center=this.projectPosition(s)}_initMatrices(e){const{viewMatrix:t=ga,projectionMatrix:n=null,orthographic:r=!1,fovyRadians:o,fovy:i=75,near:s=.1,far:a=1e3,padding:c=null,focalDistance:l=1}=e;this.viewMatrixUncentered=t,this.viewMatrix=(new Oo).multiplyRight(t).translate(new qr(this.center).negate()),this.projectionMatrix=n||function({width:e,height:t,orthographic:n,fovyRadians:r,focalDistance:o,padding:i,near:s,far:a}){const c=e/t,l=n?(new Oo).orthographic({fovy:r,aspect:c,focalDistance:o,near:s,far:a}):(new Oo).perspective({fovy:r,aspect:c,near:s,far:a});if(i){const{left:n=0,right:r=0,top:o=0,bottom:s=0}=i,a=dr((n+e-r)/2,0,e)-e/2,c=dr((o+t-s)/2,0,t)-t/2;l[8]-=2*a/e,l[9]+=2*c/t}return l}({width:this.width,height:this.height,orthographic:r,fovyRadians:o||i*Aa,focalDistance:l,padding:c,near:s,far:a});const _=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];var u;eo(_,_,this.projectionMatrix),eo(_,_,this.viewMatrix),this.viewProjectionMatrix=_,this.viewMatrixInverse=Jr([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=[(u=this.viewMatrixInverse)[12],u[13],u[14]];const E=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],h=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];no(E,E,[this.width/2,-this.height/2,1]),to(E,E,[1,-1,0]),eo(h,E,this.viewProjectionMatrix),this.pixelProjectionMatrix=h,this.pixelUnprojectionMatrix=Jr([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||Ft.warn("Pixel project matrix not invertible")()}}Ma.displayName="Viewport";class Na extends Ma{constructor(e={}){const{latitude:t=0,longitude:n=0,zoom:r=0,pitch:o=0,bearing:i=0,nearZMultiplier:s=.1,farZMultiplier:a=1.01,nearZ:c,farZ:l,orthographic:_=!1,projectionMatrix:u,repeat:E=!1,worldOffset:h=0,position:f,padding:d,legacyMeterSizes:p=!1}=e;let{width:T,height:R,altitude:A=1.5}=e;const g=Math.pow(2,r);let m;T=T||1,R=R||1;let S=null;if(u)A=u[5]/2,m=oa(A);else{let n;if(e.fovy?(m=e.fovy,A=ia(m)):m=oa(A),d){const{top:e=0,bottom:t=0}=d;n=[0,dr((e+R-t)/2,0,R)-R/2]}S=function(e){const{width:t,height:n,altitude:r,pitch:o=0,offset:i,center:s,scale:a,nearZMultiplier:c=1,farZMultiplier:l=1}=e;let{fovy:_=oa(qs)}=e;void 0!==r&&(_=oa(r));const u=_*Vs,E=o*Vs,h=ia(_);let f=h;s&&(f+=s[2]*a/Math.cos(E)/n);const d=u*(.5+(i?i[1]:0)/n),p=Math.sin(d)*f/Math.sin(Ws(Math.PI/2-E-d,.01,Math.PI-.01)),T=Math.sin(E)*p+f,R=10*f;return{fov:u,aspect:t/n,focalDistance:h,near:c,far:Math.min(T*l,R)}}({width:T,height:R,scale:g,center:f&&[0,0,f[2]*ta(t)],offset:n,pitch:o,fovy:m,nearZMultiplier:s,farZMultiplier:a}),Number.isFinite(c)&&(S.near=c),Number.isFinite(l)&&(S.far=l)}let M=function(e){const{height:t,pitch:n,bearing:r,altitude:o,scale:i,center:s}=e,a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];to(a,a,[0,0,-o]),ro(a,a,-n*Vs),oo(a,a,r*Vs);const c=i/t;var l,_;return no(a,a,[c,c,c]),s&&to(a,a,((l=[])[0]=-(_=s)[0],l[1]=-_[1],l[2]=-_[2],l)),a}({height:R,pitch:o,bearing:i,scale:g,altitude:A});if(h){M=(new Oo).translate([512*h,0,0]).multiplyLeft(M)}super({...e,width:T,height:R,viewMatrix:M,longitude:n,latitude:t,zoom:r,...S,fovy:m,focalDistance:A}),this.latitude=t,this.longitude=n,this.zoom=r,this.pitch=o,this.bearing=i,this.altitude=A,this.fovy=m,this.orthographic=_,this._subViewports=E?[]:null,this._pseudoMeters=p,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){const e=this.getBounds(),t=Math.floor((e[0]+180)/360),n=Math.ceil((e[2]-180)/360);for(let r=t;r<=n;r++){const e=r?new Na({...this,worldOffset:r}):this;this._subViewports.push(e)}}return this._subViewports}projectPosition(e){if(this._pseudoMeters)return super.projectPosition(e);const[t,n]=this.projectFlat(e);return[t,n,(e[2]||0)*ta(e[1])]}unprojectPosition(e){if(this._pseudoMeters)return super.unprojectPosition(e);const[t,n]=this.unprojectFlat(e);return[t,n,(e[2]||0)/ta(n)]}addMetersToLngLat(e,t){return ra(e,t)}panByPosition(e,t,n){const r=aa(t,this.pixelUnprojectionMatrix),o=Cr([],this.projectFlat(e),((i=[])[0]=-(s=r)[0],i[1]=-s[1],i));var i,s;const a=Cr([],this.center,o),[c,l]=this.unprojectFlat(a);return{longitude:c,latitude:l}}panByPosition3D(e,t){const n=e[2]||0,r=Dr([],e,this.unproject(t,{targetZ:n}));return{longitude:this.longitude+r[0],latitude:this.latitude+r[1]}}getBounds(e={}){const t=function(e,t=0){const{width:n,height:r,unproject:o}=e,i={targetZ:t},s=o([0,r],i),a=o([n,r],i);let c,l;return(e.fovy?.5*e.fovy*la:Math.atan(.5/e.altitude))>(90-e.pitch)*la-.01?(c=_a(e,0,t),l=_a(e,n,t)):(c=o([0,0],i),l=o([n,0],i)),[s,a,l,c]}(this,e.z||0);return[Math.min(t[0][0],t[1][0],t[2][0],t[3][0]),Math.min(t[0][1],t[1][1],t[2][1],t[3][1]),Math.max(t[0][0],t[1][0],t[2][0],t[3][0]),Math.max(t[0][1],t[1][1],t[2][1],t[3][1])]}fitBounds(e,t={}){const{width:n,height:r}=this,{longitude:o,latitude:i,zoom:s}=ca({width:n,height:r,bounds:e,...t});return new Na({width:n,height:r,longitude:o,latitude:i,zoom:s})}}Na.displayName="WebMercatorViewport";const Oa={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},Ca=/* @__PURE__ */Symbol.for("component"),Ia=/* @__PURE__ */Symbol.for("propTypes"),ba=/* @__PURE__ */Symbol.for("deprecatedProps"),La=/* @__PURE__ */Symbol.for("asyncPropDefaults"),Pa=/* @__PURE__ */Symbol.for("asyncPropOriginal"),ya=/* @__PURE__ */Symbol.for("asyncPropResolved");function Da(e,t=()=>!0){return Array.isArray(e)?Ua(e,t,[]):t(e)?[e]:[]}function Ua(e,t,n){let r=-1;for(;++r<e.length;){const o=e[r];Array.isArray(o)?Ua(o,t,n):t(o)&&n.push(o)}return n}function Ba({target:e,source:t,start:n=0,count:r=1}){const o=t.length,i=r*o;let s=0;for(let a=n;s<o;s++)e[a++]=t[s];for(;s<i;)s<i-s?(e.copyWithin(n+s,n,n+s),s*=2):(e.copyWithin(n+s,n,n+i-s),s=i);return e}function Fa(e,t,n){if(e===t)return!0;if(!n||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Fa(e[r],t[r],n-1))return!1;return!0}if(Array.isArray(t))return!1;if("object"==typeof e&&"object"==typeof t){const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(const i of r){if(!t.hasOwnProperty(i))return!1;if(!Fa(e[i],t[i],n-1))return!1}return!0}return!1}class wa{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){this.cancel(),this.settings=e,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(null===this._handle){const{_timeline:e,settings:t}=this;this._handle=e.addChannel({delay:e.getTime(),duration:t.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}}function va(e,t){if(!e)throw new Error(t||"deck.gl: assertion failed.")}const Ga=Math.PI/180,xa=180/Math.PI,ja=6370972,Wa=256;function Ha(){const e=4018225162502676e-20,t=Math.PI/180*Wa;return{unitsPerMeter:[e,e,e],unitsPerMeter2:[0,0,0],metersPerUnit:[24886.609375,24886.609375,24886.609375],unitsPerDegree:[t,t,e],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/t,1/t,24886.609375]}}class Xa extends Ma{constructor(e={}){const{longitude:t=0,zoom:n=0,nearZMultiplier:r=.5,farZMultiplier:o=1,resolution:i=10}=e;let{latitude:s=0,height:a,altitude:c=1.5,fovy:l}=e;s=Math.max(Math.min(s,Zs),-85.051129),a=a||1,l?c=ia(l):l=oa(c);const _=Math.pow(2,n-ka(s)),u=e.nearZ??r,E=e.farZ??(c+512*_/a)*o,h=(new Oo).lookAt({eye:[0,-c,0],up:[0,0,1]});h.rotateX(s*Ga),h.rotateZ(-t*Ga),h.scale(_/a),super({...e,height:a,viewMatrix:h,longitude:t,latitude:s,zoom:n,distanceScales:Ha(),fovy:l,focalDistance:c,near:u,far:E}),this.scale=_,this.latitude=s,this.longitude=t,this.fovy=l,this.resolution=i}get projectionMode(){return As.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){const t={targetZ:e.z||0},n=this.unproject([0,this.height/2],t),r=this.unproject([this.width/2,0],t),o=this.unproject([this.width,this.height/2],t),i=this.unproject([this.width/2,this.height],t);return o[0]<this.longitude&&(o[0]+=360),n[0]>this.longitude&&(n[0]-=360),[Math.min(n[0],o[0],r[0],i[0]),Math.min(n[1],o[1],r[1],i[1]),Math.max(n[0],o[0],r[0],i[0]),Math.max(n[1],o[1],r[1],i[1])]}unproject(e,{topLeft:t=!0,targetZ:n}={}){const[r,o,i]=e,s=t?o:this.height-o,{pixelUnprojectionMatrix:a}=this;let c;if(Number.isFinite(i))c=$a(a,[r,s,i,1]);else{const e=$a(a,[r,s,-1,1]),t=$a(a,[r,s,1,1]),o=((n||0)/ja+1)*Wa,i=Yr(Vr([],e,t)),l=Yr(e),_=Yr(t),u=4*((4*l*_-(i-l-_)**2)/16)/i;c=function(e,t,n,r){const o=t[0],i=t[1],s=t[2];return e[0]=o+r*(n[0]-o),e[1]=i+r*(n[1]-i),e[2]=s+r*(n[2]-s),e}([],e,t,(Math.sqrt(l-u)-Math.sqrt(Math.max(0,o*o-u)))/Math.sqrt(i))}const[l,_,u]=this.unprojectPosition(c);return Number.isFinite(i)?[l,_,u]:Number.isFinite(n)?[l,_,n]:[l,_]}projectPosition(e){const[t,n,r=0]=e,o=t*Ga,i=n*Ga,s=Math.cos(i),a=(r/ja+1)*Wa;return[Math.sin(o)*s*a,-Math.cos(o)*s*a,Math.sin(i)*a]}unprojectPosition(e){const[t,n,r]=e,o=zr(e),i=Math.asin(r/o);return[Math.atan2(t,-n)*xa,i*xa,(o/Wa-1)*ja]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition([e,t,n],r,o){const i=.25/Math.pow(2,this.zoom-ka(this.latitude)),s=e+i*(o[0]-r[0]);let a=t-i*(o[1]-r[1]);a=Math.max(Math.min(a,Zs),-85.051129);const c={longitude:s,latitude:a,zoom:n-ka(t)};return c.zoom+=ka(c.latitude),c}}function ka(e){const t=Math.PI*Math.cos(e*Math.PI/180);return Math.log2(t)}function $a(e,t){const n=po([],t,e);return lo(n,n,1/n[3]),n}var Va,za;async function Ya(e,t){const n=document.getElementsByTagName("head")[0];if(!n)throw new Error("loadScript");const r=document.createElement("script");return r.setAttribute("type","text/javascript"),r.setAttribute("src",e),new Promise((t,o)=>{r.onload=t,r.onerror=t=>o(new Error(`Unable to load script '${e}': ${t}`)),n.appendChild(r)})}function Ka(e){const t=e.luma||{_polyfilled:!1,extensions:{},softwareRenderer:!1};return t._polyfilled??=!1,t.extensions||={},e.luma=t,t}Xa.displayName="GlobeViewport",(za=Va||(Va={}))[za.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",za[za.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",za[za.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",za[za.POINTS=0]="POINTS",za[za.LINES=1]="LINES",za[za.LINE_LOOP=2]="LINE_LOOP",za[za.LINE_STRIP=3]="LINE_STRIP",za[za.TRIANGLES=4]="TRIANGLES",za[za.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",za[za.TRIANGLE_FAN=6]="TRIANGLE_FAN",za[za.ZERO=0]="ZERO",za[za.ONE=1]="ONE",za[za.SRC_COLOR=768]="SRC_COLOR",za[za.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",za[za.SRC_ALPHA=770]="SRC_ALPHA",za[za.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",za[za.DST_ALPHA=772]="DST_ALPHA",za[za.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",za[za.DST_COLOR=774]="DST_COLOR",za[za.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",za[za.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",za[za.CONSTANT_COLOR=32769]="CONSTANT_COLOR",za[za.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",za[za.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",za[za.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",za[za.FUNC_ADD=32774]="FUNC_ADD",za[za.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",za[za.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",za[za.BLEND_EQUATION=32777]="BLEND_EQUATION",za[za.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",za[za.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",za[za.BLEND_DST_RGB=32968]="BLEND_DST_RGB",za[za.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",za[za.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",za[za.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",za[za.BLEND_COLOR=32773]="BLEND_COLOR",za[za.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",za[za.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",za[za.LINE_WIDTH=2849]="LINE_WIDTH",za[za.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",za[za.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",za[za.CULL_FACE_MODE=2885]="CULL_FACE_MODE",za[za.FRONT_FACE=2886]="FRONT_FACE",za[za.DEPTH_RANGE=2928]="DEPTH_RANGE",za[za.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",za[za.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",za[za.DEPTH_FUNC=2932]="DEPTH_FUNC",za[za.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",za[za.STENCIL_FUNC=2962]="STENCIL_FUNC",za[za.STENCIL_FAIL=2964]="STENCIL_FAIL",za[za.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",za[za.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",za[za.STENCIL_REF=2967]="STENCIL_REF",za[za.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",za[za.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",za[za.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",za[za.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",za[za.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",za[za.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",za[za.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",za[za.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",za[za.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",za[za.VIEWPORT=2978]="VIEWPORT",za[za.SCISSOR_BOX=3088]="SCISSOR_BOX",za[za.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",za[za.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",za[za.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",za[za.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",za[za.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",za[za.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",za[za.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",za[za.RED_BITS=3410]="RED_BITS",za[za.GREEN_BITS=3411]="GREEN_BITS",za[za.BLUE_BITS=3412]="BLUE_BITS",za[za.ALPHA_BITS=3413]="ALPHA_BITS",za[za.DEPTH_BITS=3414]="DEPTH_BITS",za[za.STENCIL_BITS=3415]="STENCIL_BITS",za[za.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",za[za.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",za[za.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",za[za.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",za[za.SAMPLES=32937]="SAMPLES",za[za.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",za[za.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",za[za.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",za[za.VENDOR=7936]="VENDOR",za[za.RENDERER=7937]="RENDERER",za[za.VERSION=7938]="VERSION",za[za.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",za[za.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",za[za.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",za[za.STATIC_DRAW=35044]="STATIC_DRAW",za[za.STREAM_DRAW=35040]="STREAM_DRAW",za[za.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",za[za.ARRAY_BUFFER=34962]="ARRAY_BUFFER",za[za.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",za[za.BUFFER_SIZE=34660]="BUFFER_SIZE",za[za.BUFFER_USAGE=34661]="BUFFER_USAGE",za[za.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",za[za.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",za[za.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",za[za.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",za[za.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",za[za.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",za[za.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",za[za.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",za[za.CULL_FACE=2884]="CULL_FACE",za[za.FRONT=1028]="FRONT",za[za.BACK=1029]="BACK",za[za.FRONT_AND_BACK=1032]="FRONT_AND_BACK",za[za.BLEND=3042]="BLEND",za[za.DEPTH_TEST=2929]="DEPTH_TEST",za[za.DITHER=3024]="DITHER",za[za.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",za[za.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",za[za.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",za[za.SCISSOR_TEST=3089]="SCISSOR_TEST",za[za.STENCIL_TEST=2960]="STENCIL_TEST",za[za.NO_ERROR=0]="NO_ERROR",za[za.INVALID_ENUM=1280]="INVALID_ENUM",za[za.INVALID_VALUE=1281]="INVALID_VALUE",za[za.INVALID_OPERATION=1282]="INVALID_OPERATION",za[za.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",za[za.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",za[za.CW=2304]="CW",za[za.CCW=2305]="CCW",za[za.DONT_CARE=4352]="DONT_CARE",za[za.FASTEST=4353]="FASTEST",za[za.NICEST=4354]="NICEST",za[za.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",za[za.BYTE=5120]="BYTE",za[za.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",za[za.SHORT=5122]="SHORT",za[za.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",za[za.INT=5124]="INT",za[za.UNSIGNED_INT=5125]="UNSIGNED_INT",za[za.FLOAT=5126]="FLOAT",za[za.DOUBLE=5130]="DOUBLE",za[za.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",za[za.ALPHA=6406]="ALPHA",za[za.RGB=6407]="RGB",za[za.RGBA=6408]="RGBA",za[za.LUMINANCE=6409]="LUMINANCE",za[za.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",za[za.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",za[za.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",za[za.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",za[za.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",za[za.VERTEX_SHADER=35633]="VERTEX_SHADER",za[za.COMPILE_STATUS=35713]="COMPILE_STATUS",za[za.DELETE_STATUS=35712]="DELETE_STATUS",za[za.LINK_STATUS=35714]="LINK_STATUS",za[za.VALIDATE_STATUS=35715]="VALIDATE_STATUS",za[za.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",za[za.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",za[za.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",za[za.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",za[za.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",za[za.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",za[za.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",za[za.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",za[za.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",za[za.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",za[za.SHADER_TYPE=35663]="SHADER_TYPE",za[za.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",za[za.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",za[za.NEVER=512]="NEVER",za[za.LESS=513]="LESS",za[za.EQUAL=514]="EQUAL",za[za.LEQUAL=515]="LEQUAL",za[za.GREATER=516]="GREATER",za[za.NOTEQUAL=517]="NOTEQUAL",za[za.GEQUAL=518]="GEQUAL",za[za.ALWAYS=519]="ALWAYS",za[za.KEEP=7680]="KEEP",za[za.REPLACE=7681]="REPLACE",za[za.INCR=7682]="INCR",za[za.DECR=7683]="DECR",za[za.INVERT=5386]="INVERT",za[za.INCR_WRAP=34055]="INCR_WRAP",za[za.DECR_WRAP=34056]="DECR_WRAP",za[za.NEAREST=9728]="NEAREST",za[za.LINEAR=9729]="LINEAR",za[za.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",za[za.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",za[za.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",za[za.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",za[za.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",za[za.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",za[za.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",za[za.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",za[za.TEXTURE_2D=3553]="TEXTURE_2D",za[za.TEXTURE=5890]="TEXTURE",za[za.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",za[za.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",za[za.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",za[za.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",za[za.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",za[za.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",za[za.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",za[za.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",za[za.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",za[za.TEXTURE0=33984]="TEXTURE0",za[za.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",za[za.REPEAT=10497]="REPEAT",za[za.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",za[za.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",za[za.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",za[za.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",za[za.FLOAT_VEC2=35664]="FLOAT_VEC2",za[za.FLOAT_VEC3=35665]="FLOAT_VEC3",za[za.FLOAT_VEC4=35666]="FLOAT_VEC4",za[za.INT_VEC2=35667]="INT_VEC2",za[za.INT_VEC3=35668]="INT_VEC3",za[za.INT_VEC4=35669]="INT_VEC4",za[za.BOOL=35670]="BOOL",za[za.BOOL_VEC2=35671]="BOOL_VEC2",za[za.BOOL_VEC3=35672]="BOOL_VEC3",za[za.BOOL_VEC4=35673]="BOOL_VEC4",za[za.FLOAT_MAT2=35674]="FLOAT_MAT2",za[za.FLOAT_MAT3=35675]="FLOAT_MAT3",za[za.FLOAT_MAT4=35676]="FLOAT_MAT4",za[za.SAMPLER_2D=35678]="SAMPLER_2D",za[za.SAMPLER_CUBE=35680]="SAMPLER_CUBE",za[za.LOW_FLOAT=36336]="LOW_FLOAT",za[za.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",za[za.HIGH_FLOAT=36338]="HIGH_FLOAT",za[za.LOW_INT=36339]="LOW_INT",za[za.MEDIUM_INT=36340]="MEDIUM_INT",za[za.HIGH_INT=36341]="HIGH_INT",za[za.FRAMEBUFFER=36160]="FRAMEBUFFER",za[za.RENDERBUFFER=36161]="RENDERBUFFER",za[za.RGBA4=32854]="RGBA4",za[za.RGB5_A1=32855]="RGB5_A1",za[za.RGB565=36194]="RGB565",za[za.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",za[za.STENCIL_INDEX=6401]="STENCIL_INDEX",za[za.STENCIL_INDEX8=36168]="STENCIL_INDEX8",za[za.DEPTH_STENCIL=34041]="DEPTH_STENCIL",za[za.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",za[za.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",za[za.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",za[za.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",za[za.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",za[za.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",za[za.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",za[za.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",za[za.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",za[za.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",za[za.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",za[za.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",za[za.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",za[za.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",za[za.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",za[za.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",za[za.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",za[za.NONE=0]="NONE",za[za.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",za[za.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",za[za.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",za[za.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",za[za.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",za[za.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",za[za.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",za[za.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",za[za.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",za[za.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",za[za.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",za[za.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",za[za.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",za[za.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",za[za.READ_BUFFER=3074]="READ_BUFFER",za[za.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",za[za.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",za[za.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",za[za.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",za[za.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",za[za.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",za[za.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",za[za.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",za[za.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",za[za.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",za[za.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",za[za.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",za[za.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",za[za.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",za[za.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",za[za.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",za[za.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",za[za.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",za[za.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",za[za.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",za[za.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",za[za.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",za[za.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",za[za.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",za[za.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",za[za.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",za[za.RED=6403]="RED",za[za.RGB8=32849]="RGB8",za[za.RGBA8=32856]="RGBA8",za[za.RGB10_A2=32857]="RGB10_A2",za[za.TEXTURE_3D=32879]="TEXTURE_3D",za[za.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",za[za.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",za[za.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",za[za.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",za[za.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",za[za.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",za[za.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",za[za.SRGB=35904]="SRGB",za[za.SRGB8=35905]="SRGB8",za[za.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",za[za.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",za[za.RGBA32F=34836]="RGBA32F",za[za.RGB32F=34837]="RGB32F",za[za.RGBA16F=34842]="RGBA16F",za[za.RGB16F=34843]="RGB16F",za[za.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",za[za.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",za[za.R11F_G11F_B10F=35898]="R11F_G11F_B10F",za[za.RGB9_E5=35901]="RGB9_E5",za[za.RGBA32UI=36208]="RGBA32UI",za[za.RGB32UI=36209]="RGB32UI",za[za.RGBA16UI=36214]="RGBA16UI",za[za.RGB16UI=36215]="RGB16UI",za[za.RGBA8UI=36220]="RGBA8UI",za[za.RGB8UI=36221]="RGB8UI",za[za.RGBA32I=36226]="RGBA32I",za[za.RGB32I=36227]="RGB32I",za[za.RGBA16I=36232]="RGBA16I",za[za.RGB16I=36233]="RGB16I",za[za.RGBA8I=36238]="RGBA8I",za[za.RGB8I=36239]="RGB8I",za[za.RED_INTEGER=36244]="RED_INTEGER",za[za.RGB_INTEGER=36248]="RGB_INTEGER",za[za.RGBA_INTEGER=36249]="RGBA_INTEGER",za[za.R8=33321]="R8",za[za.RG8=33323]="RG8",za[za.R16F=33325]="R16F",za[za.R32F=33326]="R32F",za[za.RG16F=33327]="RG16F",za[za.RG32F=33328]="RG32F",za[za.R8I=33329]="R8I",za[za.R8UI=33330]="R8UI",za[za.R16I=33331]="R16I",za[za.R16UI=33332]="R16UI",za[za.R32I=33333]="R32I",za[za.R32UI=33334]="R32UI",za[za.RG8I=33335]="RG8I",za[za.RG8UI=33336]="RG8UI",za[za.RG16I=33337]="RG16I",za[za.RG16UI=33338]="RG16UI",za[za.RG32I=33339]="RG32I",za[za.RG32UI=33340]="RG32UI",za[za.R8_SNORM=36756]="R8_SNORM",za[za.RG8_SNORM=36757]="RG8_SNORM",za[za.RGB8_SNORM=36758]="RGB8_SNORM",za[za.RGBA8_SNORM=36759]="RGBA8_SNORM",za[za.RGB10_A2UI=36975]="RGB10_A2UI",za[za.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",za[za.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",za[za.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",za[za.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",za[za.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",za[za.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",za[za.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",za[za.HALF_FLOAT=5131]="HALF_FLOAT",za[za.RG=33319]="RG",za[za.RG_INTEGER=33320]="RG_INTEGER",za[za.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",za[za.CURRENT_QUERY=34917]="CURRENT_QUERY",za[za.QUERY_RESULT=34918]="QUERY_RESULT",za[za.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",za[za.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",za[za.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",za[za.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",za[za.DRAW_BUFFER0=34853]="DRAW_BUFFER0",za[za.DRAW_BUFFER1=34854]="DRAW_BUFFER1",za[za.DRAW_BUFFER2=34855]="DRAW_BUFFER2",za[za.DRAW_BUFFER3=34856]="DRAW_BUFFER3",za[za.DRAW_BUFFER4=34857]="DRAW_BUFFER4",za[za.DRAW_BUFFER5=34858]="DRAW_BUFFER5",za[za.DRAW_BUFFER6=34859]="DRAW_BUFFER6",za[za.DRAW_BUFFER7=34860]="DRAW_BUFFER7",za[za.DRAW_BUFFER8=34861]="DRAW_BUFFER8",za[za.DRAW_BUFFER9=34862]="DRAW_BUFFER9",za[za.DRAW_BUFFER10=34863]="DRAW_BUFFER10",za[za.DRAW_BUFFER11=34864]="DRAW_BUFFER11",za[za.DRAW_BUFFER12=34865]="DRAW_BUFFER12",za[za.DRAW_BUFFER13=34866]="DRAW_BUFFER13",za[za.DRAW_BUFFER14=34867]="DRAW_BUFFER14",za[za.DRAW_BUFFER15=34868]="DRAW_BUFFER15",za[za.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",za[za.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",za[za.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",za[za.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",za[za.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",za[za.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",za[za.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",za[za.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",za[za.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",za[za.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",za[za.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",za[za.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",za[za.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",za[za.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",za[za.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",za[za.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",za[za.SAMPLER_3D=35679]="SAMPLER_3D",za[za.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",za[za.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",za[za.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",za[za.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",za[za.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",za[za.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",za[za.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",za[za.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",za[za.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",za[za.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",za[za.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",za[za.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",za[za.MAX_SAMPLES=36183]="MAX_SAMPLES",za[za.SAMPLER_BINDING=35097]="SAMPLER_BINDING",za[za.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",za[za.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",za[za.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",za[za.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",za[za.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",za[za.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",za[za.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",za[za.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",za[za.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",za[za.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",za[za.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",za[za.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",za[za.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",za[za.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",za[za.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",za[za.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",za[za.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",za[za.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",za[za.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",za[za.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",za[za.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",za[za.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",za[za.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",za[za.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",za[za.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",za[za.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",za[za.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",za[za.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",za[za.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",za[za.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",za[za.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",za[za.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",za[za.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",za[za.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",za[za.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",za[za.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",za[za.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",za[za.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",za[za.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",za[za.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",za[za.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",za[za.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",za[za.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",za[za.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",za[za.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",za[za.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",za[za.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",za[za.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",za[za.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",za[za.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",za[za.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",za[za.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",za[za.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",za[za.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",za[za.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",za[za.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",za[za.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",za[za.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",za[za.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",za[za.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",za[za.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",za[za.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",za[za.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",za[za.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",za[za.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",za[za.UNIFORM_TYPE=35383]="UNIFORM_TYPE",za[za.UNIFORM_SIZE=35384]="UNIFORM_SIZE",za[za.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",za[za.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",za[za.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",za[za.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",za[za.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",za[za.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",za[za.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",za[za.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",za[za.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",za[za.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",za[za.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",za[za.OBJECT_TYPE=37138]="OBJECT_TYPE",za[za.SYNC_CONDITION=37139]="SYNC_CONDITION",za[za.SYNC_STATUS=37140]="SYNC_STATUS",za[za.SYNC_FLAGS=37141]="SYNC_FLAGS",za[za.SYNC_FENCE=37142]="SYNC_FENCE",za[za.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",za[za.UNSIGNALED=37144]="UNSIGNALED",za[za.SIGNALED=37145]="SIGNALED",za[za.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",za[za.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",za[za.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",za[za.WAIT_FAILED=37149]="WAIT_FAILED",za[za.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",za[za.COLOR=6144]="COLOR",za[za.DEPTH=6145]="DEPTH",za[za.STENCIL=6146]="STENCIL",za[za.MIN=32775]="MIN",za[za.MAX=32776]="MAX",za[za.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",za[za.STREAM_READ=35041]="STREAM_READ",za[za.STREAM_COPY=35042]="STREAM_COPY",za[za.STATIC_READ=35045]="STATIC_READ",za[za.STATIC_COPY=35046]="STATIC_COPY",za[za.DYNAMIC_READ=35049]="DYNAMIC_READ",za[za.DYNAMIC_COPY=35050]="DYNAMIC_COPY",za[za.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",za[za.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",za[za.INVALID_INDEX=4294967295]="INVALID_INDEX",za[za.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",za[za.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",za[za.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",za[za.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",za[za.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",za[za.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",za[za.R16_EXT=33322]="R16_EXT",za[za.RG16_EXT=33324]="RG16_EXT",za[za.RGB16_EXT=32852]="RGB16_EXT",za[za.RGBA16_EXT=32859]="RGBA16_EXT",za[za.R16_SNORM_EXT=36760]="R16_SNORM_EXT",za[za.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",za[za.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",za[za.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",za[za.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",za[za.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",za[za.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",za[za.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",za[za.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",za[za.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",za[za.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",za[za.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",za[za.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",za[za.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",za[za.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",za[za.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",za[za.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",za[za.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",za[za.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",za[za.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",za[za.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",za[za.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",za[za.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",za[za.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",za[za.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",za[za.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",za[za.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",za[za.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",za[za.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",za[za.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",za[za.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",za[za.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",za[za.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",za[za.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",za[za.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",za[za.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",za[za.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",za[za.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",za[za.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",za[za.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",za[za.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",za[za.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",za[za.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",za[za.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",za[za.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",za[za.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",za[za.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",za[za.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",za[za.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",za[za.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",za[za.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",za[za.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",za[za.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",za[za.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",za[za.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",za[za.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",za[za.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",za[za.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",za[za.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",za[za.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",za[za.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",za[za.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",za[za.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",za[za.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",za[za.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",za[za.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",za[za.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",za[za.LINE_WEBGL=6913]="LINE_WEBGL",za[za.FILL_WEBGL=6914]="FILL_WEBGL",za[za.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",za[za.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",za[za.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",za[za.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",za[za.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",za[za.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",za[za.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",za[za.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",za[za.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",za[za.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",za[za.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",za[za.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",za[za.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",za[za.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",za[za.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",za[za.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",za[za.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",za[za.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",za[za.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",za[za.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",za[za.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",za[za.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",za[za.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",za[za.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT";let Za=null,qa=!1;const Qa={debugSpectorJS:Bo.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0};async function Ja(e){if(!globalThis.SPECTOR)try{await Ya(e.debugSpectorJSUrl||Qa.debugSpectorJSUrl)}catch(t){Bo.warn(String(t))}}function ec(e){if(!(e={...Qa,...e}).debugSpectorJS)return null;if(!Za&&globalThis.SPECTOR&&!globalThis.luma?.spector){Bo.probe(1,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();const{Spector:e}=globalThis.SPECTOR;Za=new e,globalThis.luma&&(globalThis.luma.spector=Za)}if(!Za)return null;if(qa||(qa=!0,Za.spyCanvases(),Za?.onCaptureStarted.add(e=>Bo.info("Spector capture started:",e)()),Za?.onCapture.add(e=>{Bo.info("Spector capture complete:",e)(),Za?.getResultUI(),Za?.resultView.display(),Za?.resultView.addCapture(e)})),e.gl){const t=Ka(e.gl),n=t.device;Za?.startCapture(e.gl,500),t.device=n,new Promise(e=>setTimeout(e,2e3)).then(e=>{Bo.info("Spector capture stopped after 2 seconds")(),Za?.stopCapture()})}return Za}function tc(e){return e.luma=e.luma||{},e.luma}async function nc(){a()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await Ya("https://unpkg.com/webgl-debug@2.0.1/index.js"))}function rc(e,t={}){return t.debugWebGL||t.traceWebGL?function(e,t){if(!globalThis.WebGLDebugUtils)return Bo.warn("webgl-debug not loaded")(),e;const n=tc(e);if(n.debugContext)return n.debugContext;globalThis.WebGLDebugUtils.init({...Va,...e});const r=globalThis.WebGLDebugUtils.makeDebugContext(e,ic.bind(null,t),sc.bind(null,t));for(const s in Va)s in r||"number"!=typeof Va[s]||(r[s]=Va[s]);class o{}Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.setPrototypeOf(o,r);const i=Object.create(o);return n.realContext=e,n.debugContext=i,i.luma=n,i.debug=!0,i}(e,t):function(e){const t=tc(e);return t.realContext?t.realContext:e}(e)}function oc(e,t){t=Array.from(t).map(e=>void 0===e?"undefined":e);let n=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return n=`${n.slice(0,100)}${n.length>100?"...":""}`,`gl.${e}(${n})`}function ic(e,t,n,r){r=Array.from(r).map(e=>void 0===e?"undefined":e);const o=`${globalThis.WebGLDebugUtils.glEnumToString(t)} in gl.${n}(${globalThis.WebGLDebugUtils.glFunctionArgsToString(n,r)})`;throw Bo.error("%cWebGL","color: white; background: red; padding: 2px 6px; border-radius: 3px;",o)(),new Error(o)}function sc(e,t,n){let r="";e.traceWebGL&&Bo.level>=1&&(r=oc(t,n),Bo.info(1,"%cWebGL","color: white; background: blue; padding: 2px 6px; border-radius: 3px;",r)());for(const o of n)void 0===o&&(r=r||oc(t,n))}export{Na as $,Or as A,xr as B,Wr as C,Hr as D,zr as E,jr as F,co as G,fo as H,lo as I,Eo as J,Nr as K,Ar as L,Qr as M,To as N,Oo as O,g as P,wo as Q,ko as R,ae as S,Bo as T,Zo as U,F as V,xs as W,po as X,ra as Y,Us as Z,Vr as _,w as a,is as a$,Jo as a0,nn as a1,mi as a2,Si as a3,Pi as a4,bi as a5,sr as a6,qo as a7,qr as a8,ua as a9,Sr as aA,Tr as aB,Xa as aC,Ai as aD,Dt as aE,mt as aF,Ee as aG,ne as aH,he as aI,hr as aJ,Er as aK,Gr as aL,fr as aM,pe as aN,dr as aO,Te as aP,xt as aQ,Ye as aR,Ci as aS,Uo as aT,a as aU,Hi as aV,Xi as aW,ki as aX,Wi as aY,ji as aZ,xi as a_,Ta as aa,Ft as ab,va as ac,Ba as ad,wa as ae,Ns as af,Ra as ag,jt as ah,pr as ai,Ia as aj,Fa as ak,Ca as al,Pa as am,ya as an,ba as ao,La as ap,Oa as aq,sa as ar,ft as as,Da as at,gs as au,Qs as av,Bt as aw,Rs as ax,Js as ay,io as az,G as b,vi as b0,$i as b1,fs as b2,Ts as b3,ys as b4,As as b5,aa as b6,Di as b7,Ma as b8,Ea as b9,ms as ba,Qa as bb,nc as bc,Ja as bd,Ss as be,ka as bf,Zs as bg,Wa as bh,ta as bi,s as bj,i as bk,Ka as bl,Oi as bm,Mi as bn,ec as bo,rc as bp,e as c,t as d,Mr as e,ur as f,lr as g,gr as h,v as i,Pr as j,Lr as k,br as l,U as m,Xr as n,wr as o,Fr as p,$r as q,le as r,kr as s,yr as t,mr as u,Ur as v,_o as w,uo as x,ho as y,vr as z};