@deck.gl/jupyter-widget 9.1.0-beta.3 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -533,12 +533,12 @@ __p+='`),h}),o+=`';
533
533
  `:"\r"}function ut(ot,J,G,mt){w.errors.push({type:ot,code:J,message:G,row:mt})}}function iv(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wL(e){e=e||{};var t=e.delimiter,r=e.newline,n=e.comments,i=e.step,o=e.preview,s=e.fastMode,c;e.quoteChar===void 0?c='"':c=e.quoteChar;var l=c;if(e.escapeChar!==void 0&&(l=e.escapeChar),(typeof t!="string"||Mf.BAD_DELIMITERS.indexOf(t)>-1)&&(t=","),n===t)throw new Error("Comment character same as delimiter");n===!0?n="#":(typeof n!="string"||Mf.BAD_DELIMITERS.indexOf(n)>-1)&&(n=!1),r!==`
534
534
  `&&r!=="\r"&&r!==`\r
535
535
  `&&(r=`
536
- `);var h=0,p=!1;this.parse=function(x,w,E){if(typeof x!="string")throw new Error("Input must be a string");var P=x.length,B=t.length,D=r.length,W=n.length,X=ll(i);h=0;var q=[],$=[],et=[],F=0;if(!x)return ir();if(s||s!==!1&&x.indexOf(c)===-1){for(var ut=x.split(r),ot=0;ot<ut.length;ot++){if(et=ut[ot],h+=et.length,ot!==ut.length-1)h+=r.length;else if(E)return ir();if(!(n&&et.substr(0,W)===n)){if(X){if(q=[],Ue(et.split(t)),on(),p)return ir()}else Ue(et.split(t));if(o&&ot>=o)return q=q.slice(0,o),ir(!0)}}return ir()}for(var J=x.indexOf(t,h),G=x.indexOf(r,h),mt=new RegExp(iv(l)+iv(c),"g"),Mt;;){if(x[h]===c){for(Mt=h,h++;;){if(Mt=x.indexOf(c,Mt+1),Mt===-1)return E||$.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:q.length,index:h}),gr();if(Mt===P-1){var ct=x.substring(h,Mt).replace(mt,c);return gr(ct)}if(c===l&&x[Mt+1]===l){Mt++;continue}if(!(c!==l&&Mt!==0&&x[Mt-1]===l)){var gt=G===-1?J:Math.min(J,G),ee=sr(gt);if(x[Mt+1+ee]===t){if(et.push(x.substring(h,Mt).replace(mt,c)),h=Mt+1+ee+B,J=x.indexOf(t,h),G=x.indexOf(r,h),X&&(on(),p))return ir();if(o&&q.length>=o)return ir(!0);break}var Ne=sr(G);if(x.substr(Mt+1+Ne,D)===r){if(et.push(x.substring(h,Mt).replace(mt,c)),Xr(Mt+1+Ne+D),J=x.indexOf(t,h),X&&(on(),p))return ir();if(o&&q.length>=o)return ir(!0);break}$.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:q.length,index:h}),Mt++}}if(X&&(on(),p))return ir();if(o&&q.length>=o)return ir(!0);continue}if(n&&et.length===0&&x.substr(h,W)===n){if(G===-1)return ir();h=G+D,G=x.indexOf(r,h),J=x.indexOf(t,h);continue}if(J!==-1&&(J<G||G===-1)){et.push(x.substring(h,J)),h=J+B,J=x.indexOf(t,h);continue}if(G!==-1){if(et.push(x.substring(h,G)),Xr(G+D),X&&(on(),p))return ir();if(o&&q.length>=o)return ir(!0);continue}break}return gr();function Ue(Xe){q.push(Xe),F=h}function sr(Xe){var He=0;if(Xe!==-1){var _n=x.substring(Mt+1,Xe);_n&&_n.trim()===""&&(He=_n.length)}return He}function gr(Xe){return E||(typeof Xe>"u"&&(Xe=x.substr(h)),et.push(Xe),h=P,Ue(et),X&&on()),ir()}function Xr(Xe){h=Xe,Ue(et),et=[],G=x.indexOf(r,h)}function ir(Xe,He){var _n=He||!1;return{data:_n?q[0]:q,errors:$,meta:{delimiter:t,linebreak:r,aborted:p,truncated:!!Xe,cursor:F+(w||0)}}}function on(){i(ir(void 0,!0)),q=[],$=[]}},this.abort=function(){p=!0},this.getCharIndex=function(){return h}}function TL(e){if(typeof e!="object"||e===null)return e;var t=Array.isArray(e)?[]:{};for(var r in e)t[r]=TL(e[r]);return t}function ll(e){return typeof e=="function"}var{ChunkStreamer:hV}=p_;function d_(e){e=e||{},hV.call(this,e),this.textDecoder=new TextDecoder(this._config.encoding),this.stream=async function(t){this._input=t;try{for await(let r of t)this.parseChunk(this.getStringChunk(r));this._finished=!0,this.parseChunk("")}catch(r){this._sendError(r)}},this._nextChunk=function(){},this.getStringChunk=function(t){return typeof t=="string"?t:this.textDecoder.decode(t,{stream:!0})}}d_.prototype=Object.create(hV.prototype);d_.prototype.constructor=d_;var Fft="4.2.1",EL="object-row-table",ov={dataType:null,batchType:null,id:"csv",module:"csv",name:"CSV",version:Fft,extensions:["csv","tsv","dsv"],mimeTypes:["text/csv","text/tab-separated-values","text/dsv"],category:"table",parse:async(e,t)=>fV(new TextDecoder().decode(e),t),parseText:(e,t)=>fV(e,t),parseInBatches:zft,options:{csv:{shape:EL,optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[","," ","|",";"]}}};async function fV(e,t){let r={...ov.options.csv,...t?.csv},n=Uft(e),o=r.header==="auto"?pV(n):Boolean(r.header),s={...r,header:o,download:!1,transformHeader:o?dV():void 0,error:x=>{throw new Error(x)}},c=p_.parse(e,s),l=c.data,h=c.meta.fields||mV(r.columnPrefix,n.length),p=r.shape||EL;switch(p){case"object-row-table":return{shape:"object-row-table",data:l.map(x=>Array.isArray(x)?rv(x,h):x)};case"array-row-table":return{shape:"array-row-table",data:l.map(x=>Array.isArray(x)?x:nv(x,h))};default:throw new Error(p)}}function zft(e,t){t={...t},t.batchSize==="auto"&&(t.batchSize=4e3);let r={...ov.options.csv,...t?.csv},n=new h_,i=!0,o=null,s=null,c=null,l={...r,header:!1,download:!1,chunkSize:1024*1024*5,skipEmptyLines:!1,step(h){let p=h.data;if(r.skipEmptyLines&&p.flat().join("").trim()==="")return;let x=h.meta.cursor;if(i&&!o&&(r.header==="auto"?pV(p):Boolean(r.header))){o=p.map(dV());return}i&&(i=!1,o||(o=mV(r.columnPrefix,p.length)),c=Vft(p,o)),r.optimizeMemoryUsage&&(p=JSON.parse(JSON.stringify(p)));let w=r.shape||EL;s=s||new u_(c,{shape:w,...t});try{s.addRow(p);let E=s&&s.getFullBatch({bytesUsed:x});E&&n.enqueue(E)}catch(E){n.enqueue(E)}},complete(h){try{let p=h.meta.cursor,x=s&&s.getFinalBatch({bytesUsed:p});x&&n.enqueue(x)}catch(p){n.enqueue(p)}n.close()}};return p_.parse(e,l,d_),n}function pV(e){return e&&e.every(t=>typeof t=="string")}function Uft(e){return p_.parse(e,{download:!1,dynamicTyping:!0,preview:1}).data[0]}function dV(){let e=new Set;return t=>{let r=t,n=1;for(;e.has(r);)r=`${t}.${n}`,n++;return e.add(r),r}}function mV(e,t=0){let r=[];for(let n=0;n<t;n++)r.push(`${e}${n+1}`);return r}function Vft(e,t){let r=t?{}:[];for(let n=0;n<e.length;n++){let i=t&&t[n]||n;switch(typeof e[n]){case"number":case"boolean":r[i]={name:String(i),index:n,type:Float32Array};break;case"string":default:r[i]={name:String(i),index:n,type:Array}}}return r}async function iu(e,t,r,n){return n._parse(e,t,r,n)}function Ti(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Sf={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},jft=Sf.self||Sf.window||Sf.global||{},Hft=Sf.window||Sf.self||Sf.global||{},Wft=Sf.global||Sf.self||Sf.window||{},qft=Sf.document||{};var Dp=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var AV=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Gft=AV&&parseFloat(AV[1])||0;var bE=globalThis,Xft=globalThis.document||{},wE=globalThis.process||{},Yft=globalThis.console,gV=globalThis.navigator||{};function TE(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function ul(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||TE()}function ML(e){return!e&&!ul()?"Node":TE(e)?"Electron":(e||gV.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var SL="4.1.0-alpha.2";function Zft(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var EE=class{constructor(t,r,n="sessionStorage"){this.storage=Zft(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function _V(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function yV(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var ME;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ME||(ME={}));var $ft=10;function xV(e){return typeof e!="string"?e:(e=e.toUpperCase(),ME[e]||ME.WHITE)}function vV(e,t,r){return!ul&&typeof e=="string"&&(t&&(e=`\x1B[${xV(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${xV(r)+$ft}m${e}\x1B[49m`)),e}function bV(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(c=>o===c)||(i[o]=s.bind(e)))}}function sv(e,t){if(!e)throw new Error(t||"Assertion failed")}function kA(){let e;if(ul()&&bE.performance)e=bE?.performance?.now?.();else if("hrtime"in wE){let t=wE?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var m_={debug:ul()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Qft={enabled:!0,level:0};function A_(){}var wV={},TV={once:!0},Bl=class{constructor({id:t}={id:""}){this.VERSION=SL,this._startTs=kA(),this._deltaTs=kA(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new EE(`__probe-${this.id}__`,Qft),this.timeStamp(`${this.id} started`),bV(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((kA()-this._startTs).toPrecision(10))}getDelta(){return Number((kA()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,m_.warn,arguments,TV)}error(t){return this._getLogFunction(0,t,m_.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,m_.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,m_.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,m_.debug||m_.info,arguments,TV)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||A_,n&&[n],{tag:tpt(r)}):A_}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||A_)}group(t,r,n={collapsed:!1}){let i=EV({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||A_)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=MV(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=EV({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,sv(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=kA();let s=o.tag||o.message;if(o.once&&s)if(!wV[s])wV[s]=kA();else return A_;return r=Jft(this.id,o.message,o),n.bind(console,r,...o.args)}return A_}};Bl.VERSION=SL;function MV(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 sv(Number.isFinite(t)&&t>=0),t}function EV(e){let{logLevel:t,message:r}=e;e.logLevel=MV(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return sv(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function Jft(e,t,r){if(typeof t=="string"){let n=r.time?yV(_V(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=vV(t,r.color,r.background)}return t}function tpt(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var CL=new Bl({id:"@probe.gl/log"});function av(e,t){return SV(e||{},t)}function SV(e,t,r=0){if(r>3)return t;let n={...e};for(let[i,o]of Object.entries(t))o&&typeof o=="object"&&!Array.isArray(o)?n[i]=SV(n[i]||{},t[i],r+1):n[i]=t[i];return n}function PL(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function IL(e){return globalThis.loaders?.modules?.[e]||null}var CV="latest";function ept(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.1"),globalThis._loadersgl_.version}var cv=ept();function wc(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Cf={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},_Ut=Cf.self||Cf.window||Cf.global||{},yUt=Cf.window||Cf.self||Cf.global||{},xUt=Cf.global||Cf.self||Cf.window||{},vUt=Cf.document||{};var ec=typeof process!="object"||String(process)!=="[object process]"||process.browser,lv=typeof importScripts=="function",IV=typeof window<"u"&&typeof window.orientation<"u",PV=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),bUt=PV&&parseFloat(PV[1])||0;var uv=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,r){this.name=t,this.workerThread=r,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){wc(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){wc(this.isRunning),this.isRunning=!1,this._reject(t)}};var g_=class{terminate(){}};var RL=new Map;function RV(e){wc(e.source&&!e.url||!e.source&&e.url);let t=RL.get(e.source||e.url);return t||(e.url&&(t=rpt(e.url),RL.set(e.url,t)),e.source&&(t=LV(e.source),RL.set(e.source,t))),wc(t),t}function rpt(e){if(!e.startsWith("http"))return e;let t=npt(e);return LV(t)}function LV(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function npt(e){return`try {
536
+ `);var h=0,p=!1;this.parse=function(x,w,E){if(typeof x!="string")throw new Error("Input must be a string");var P=x.length,B=t.length,D=r.length,W=n.length,X=ll(i);h=0;var q=[],$=[],et=[],F=0;if(!x)return ir();if(s||s!==!1&&x.indexOf(c)===-1){for(var ut=x.split(r),ot=0;ot<ut.length;ot++){if(et=ut[ot],h+=et.length,ot!==ut.length-1)h+=r.length;else if(E)return ir();if(!(n&&et.substr(0,W)===n)){if(X){if(q=[],Ue(et.split(t)),on(),p)return ir()}else Ue(et.split(t));if(o&&ot>=o)return q=q.slice(0,o),ir(!0)}}return ir()}for(var J=x.indexOf(t,h),G=x.indexOf(r,h),mt=new RegExp(iv(l)+iv(c),"g"),Mt;;){if(x[h]===c){for(Mt=h,h++;;){if(Mt=x.indexOf(c,Mt+1),Mt===-1)return E||$.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:q.length,index:h}),gr();if(Mt===P-1){var ct=x.substring(h,Mt).replace(mt,c);return gr(ct)}if(c===l&&x[Mt+1]===l){Mt++;continue}if(!(c!==l&&Mt!==0&&x[Mt-1]===l)){var gt=G===-1?J:Math.min(J,G),ee=sr(gt);if(x[Mt+1+ee]===t){if(et.push(x.substring(h,Mt).replace(mt,c)),h=Mt+1+ee+B,J=x.indexOf(t,h),G=x.indexOf(r,h),X&&(on(),p))return ir();if(o&&q.length>=o)return ir(!0);break}var Ne=sr(G);if(x.substr(Mt+1+Ne,D)===r){if(et.push(x.substring(h,Mt).replace(mt,c)),Xr(Mt+1+Ne+D),J=x.indexOf(t,h),X&&(on(),p))return ir();if(o&&q.length>=o)return ir(!0);break}$.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:q.length,index:h}),Mt++}}if(X&&(on(),p))return ir();if(o&&q.length>=o)return ir(!0);continue}if(n&&et.length===0&&x.substr(h,W)===n){if(G===-1)return ir();h=G+D,G=x.indexOf(r,h),J=x.indexOf(t,h);continue}if(J!==-1&&(J<G||G===-1)){et.push(x.substring(h,J)),h=J+B,J=x.indexOf(t,h);continue}if(G!==-1){if(et.push(x.substring(h,G)),Xr(G+D),X&&(on(),p))return ir();if(o&&q.length>=o)return ir(!0);continue}break}return gr();function Ue(Xe){q.push(Xe),F=h}function sr(Xe){var He=0;if(Xe!==-1){var _n=x.substring(Mt+1,Xe);_n&&_n.trim()===""&&(He=_n.length)}return He}function gr(Xe){return E||(typeof Xe>"u"&&(Xe=x.substr(h)),et.push(Xe),h=P,Ue(et),X&&on()),ir()}function Xr(Xe){h=Xe,Ue(et),et=[],G=x.indexOf(r,h)}function ir(Xe,He){var _n=He||!1;return{data:_n?q[0]:q,errors:$,meta:{delimiter:t,linebreak:r,aborted:p,truncated:!!Xe,cursor:F+(w||0)}}}function on(){i(ir(void 0,!0)),q=[],$=[]}},this.abort=function(){p=!0},this.getCharIndex=function(){return h}}function TL(e){if(typeof e!="object"||e===null)return e;var t=Array.isArray(e)?[]:{};for(var r in e)t[r]=TL(e[r]);return t}function ll(e){return typeof e=="function"}var{ChunkStreamer:hV}=p_;function d_(e){e=e||{},hV.call(this,e),this.textDecoder=new TextDecoder(this._config.encoding),this.stream=async function(t){this._input=t;try{for await(let r of t)this.parseChunk(this.getStringChunk(r));this._finished=!0,this.parseChunk("")}catch(r){this._sendError(r)}},this._nextChunk=function(){},this.getStringChunk=function(t){return typeof t=="string"?t:this.textDecoder.decode(t,{stream:!0})}}d_.prototype=Object.create(hV.prototype);d_.prototype.constructor=d_;var Fft="4.2.1",EL="object-row-table",ov={dataType:null,batchType:null,id:"csv",module:"csv",name:"CSV",version:Fft,extensions:["csv","tsv","dsv"],mimeTypes:["text/csv","text/tab-separated-values","text/dsv"],category:"table",parse:async(e,t)=>fV(new TextDecoder().decode(e),t),parseText:(e,t)=>fV(e,t),parseInBatches:zft,options:{csv:{shape:EL,optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[","," ","|",";"]}}};async function fV(e,t){let r={...ov.options.csv,...t?.csv},n=Uft(e),o=r.header==="auto"?pV(n):Boolean(r.header),s={...r,header:o,download:!1,transformHeader:o?dV():void 0,error:x=>{throw new Error(x)}},c=p_.parse(e,s),l=c.data,h=c.meta.fields||mV(r.columnPrefix,n.length),p=r.shape||EL;switch(p){case"object-row-table":return{shape:"object-row-table",data:l.map(x=>Array.isArray(x)?rv(x,h):x)};case"array-row-table":return{shape:"array-row-table",data:l.map(x=>Array.isArray(x)?x:nv(x,h))};default:throw new Error(p)}}function zft(e,t){t={...t},t.batchSize==="auto"&&(t.batchSize=4e3);let r={...ov.options.csv,...t?.csv},n=new h_,i=!0,o=null,s=null,c=null,l={...r,header:!1,download:!1,chunkSize:1024*1024*5,skipEmptyLines:!1,step(h){let p=h.data;if(r.skipEmptyLines&&p.flat().join("").trim()==="")return;let x=h.meta.cursor;if(i&&!o&&(r.header==="auto"?pV(p):Boolean(r.header))){o=p.map(dV());return}i&&(i=!1,o||(o=mV(r.columnPrefix,p.length)),c=Vft(p,o)),r.optimizeMemoryUsage&&(p=JSON.parse(JSON.stringify(p)));let w=r.shape||EL;s=s||new u_(c,{shape:w,...t});try{s.addRow(p);let E=s&&s.getFullBatch({bytesUsed:x});E&&n.enqueue(E)}catch(E){n.enqueue(E)}},complete(h){try{let p=h.meta.cursor,x=s&&s.getFinalBatch({bytesUsed:p});x&&n.enqueue(x)}catch(p){n.enqueue(p)}n.close()}};return p_.parse(e,l,d_),n}function pV(e){return e&&e.every(t=>typeof t=="string")}function Uft(e){return p_.parse(e,{download:!1,dynamicTyping:!0,preview:1}).data[0]}function dV(){let e=new Set;return t=>{let r=t,n=1;for(;e.has(r);)r=`${t}.${n}`,n++;return e.add(r),r}}function mV(e,t=0){let r=[];for(let n=0;n<t;n++)r.push(`${e}${n+1}`);return r}function Vft(e,t){let r=t?{}:[];for(let n=0;n<e.length;n++){let i=t&&t[n]||n;switch(typeof e[n]){case"number":case"boolean":r[i]={name:String(i),index:n,type:Float32Array};break;case"string":default:r[i]={name:String(i),index:n,type:Array}}}return r}async function iu(e,t,r,n){return n._parse(e,t,r,n)}function Ti(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Sf={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},jft=Sf.self||Sf.window||Sf.global||{},Hft=Sf.window||Sf.self||Sf.global||{},Wft=Sf.global||Sf.self||Sf.window||{},qft=Sf.document||{};var Dp=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var AV=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Gft=AV&&parseFloat(AV[1])||0;var bE=globalThis,Xft=globalThis.document||{},wE=globalThis.process||{},Yft=globalThis.console,gV=globalThis.navigator||{};function TE(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function ul(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||TE()}function ML(e){return!e&&!ul()?"Node":TE(e)?"Electron":(e||gV.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var SL="4.1.0";function Zft(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var EE=class{constructor(t,r,n="sessionStorage"){this.storage=Zft(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function _V(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function yV(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var ME;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ME||(ME={}));var $ft=10;function xV(e){return typeof e!="string"?e:(e=e.toUpperCase(),ME[e]||ME.WHITE)}function vV(e,t,r){return!ul&&typeof e=="string"&&(t&&(e=`\x1B[${xV(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${xV(r)+$ft}m${e}\x1B[49m`)),e}function bV(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(c=>o===c)||(i[o]=s.bind(e)))}}function sv(e,t){if(!e)throw new Error(t||"Assertion failed")}function kA(){let e;if(ul()&&bE.performance)e=bE?.performance?.now?.();else if("hrtime"in wE){let t=wE?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var m_={debug:ul()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Qft={enabled:!0,level:0};function A_(){}var wV={},TV={once:!0},Bl=class{constructor({id:t}={id:""}){this.VERSION=SL,this._startTs=kA(),this._deltaTs=kA(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new EE(`__probe-${this.id}__`,Qft),this.timeStamp(`${this.id} started`),bV(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((kA()-this._startTs).toPrecision(10))}getDelta(){return Number((kA()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,m_.warn,arguments,TV)}error(t){return this._getLogFunction(0,t,m_.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,m_.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,m_.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,m_.debug||m_.info,arguments,TV)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||A_,n&&[n],{tag:tpt(r)}):A_}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||A_)}group(t,r,n={collapsed:!1}){let i=EV({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||A_)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=MV(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=EV({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,sv(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=kA();let s=o.tag||o.message;if(o.once&&s)if(!wV[s])wV[s]=kA();else return A_;return r=Jft(this.id,o.message,o),n.bind(console,r,...o.args)}return A_}};Bl.VERSION=SL;function MV(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 sv(Number.isFinite(t)&&t>=0),t}function EV(e){let{logLevel:t,message:r}=e;e.logLevel=MV(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return sv(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function Jft(e,t,r){if(typeof t=="string"){let n=r.time?yV(_V(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=vV(t,r.color,r.background)}return t}function tpt(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var CL=new Bl({id:"@probe.gl/log"});function av(e,t){return SV(e||{},t)}function SV(e,t,r=0){if(r>3)return t;let n={...e};for(let[i,o]of Object.entries(t))o&&typeof o=="object"&&!Array.isArray(o)?n[i]=SV(n[i]||{},t[i],r+1):n[i]=t[i];return n}function PL(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function IL(e){return globalThis.loaders?.modules?.[e]||null}var CV="latest";function ept(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.1"),globalThis._loadersgl_.version}var cv=ept();function wc(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Cf={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},_Ut=Cf.self||Cf.window||Cf.global||{},yUt=Cf.window||Cf.self||Cf.global||{},xUt=Cf.global||Cf.self||Cf.window||{},vUt=Cf.document||{};var ec=typeof process!="object"||String(process)!=="[object process]"||process.browser,lv=typeof importScripts=="function",IV=typeof window<"u"&&typeof window.orientation<"u",PV=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),bUt=PV&&parseFloat(PV[1])||0;var uv=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,r){this.name=t,this.workerThread=r,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){wc(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){wc(this.isRunning),this.isRunning=!1,this._reject(t)}};var g_=class{terminate(){}};var RL=new Map;function RV(e){wc(e.source&&!e.url||!e.source&&e.url);let t=RL.get(e.source||e.url);return t||(e.url&&(t=rpt(e.url),RL.set(e.url,t)),e.source&&(t=LV(e.source),RL.set(e.source,t))),wc(t),t}function rpt(e){if(!e.startsWith("http"))return e;let t=npt(e);return LV(t)}function LV(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function npt(e){return`try {
537
537
  importScripts('${e}');
538
538
  } catch (error) {
539
539
  console.error(error);
540
540
  throw error;
541
- }`}function LL(e,t=!0,r){let n=r||new Set;if(e){if(OV(e))n.add(e);else if(OV(e.buffer))n.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e=="object")for(let i in e)LL(e[i],t,n)}}return r===void 0?Array.from(n):[]}function OV(e){return e?e instanceof ArrayBuffer||typeof MessagePort<"u"&&e instanceof MessagePort||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas:!1}var OL=()=>{},Yd=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&ec||typeof g_<"u"&&!ec}constructor(t){let{name:r,source:n,url:i}=t;wc(n||i),this.name=r,this.source=n,this.url=i,this.onMessage=OL,this.onError=o=>console.log(o),this.worker=ec?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=OL,this.onError=OL,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,r){r=r||LL(t),this.worker.postMessage(t,r)}_getErrorFromErrorEvent(t){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,t.message&&(r+=`${t.message} in `),t.lineno&&(r+=`:${t.lineno}:${t.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=RV({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},t.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},t.onmessageerror=r=>console.error(r),t}_createNodeWorker(){let t;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new g_(n,{eval:!1})}else if(this.source)t=new g_(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",r=>{this.onMessage(r)}),t.on("error",r=>{this.onError(r)}),t.on("exit",r=>{}),t}};var hv=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Yd.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,r=(i,o,s)=>i.done(s),n=(i,o)=>i.error(o)){let i=new Promise(o=>(this.jobQueue.push({name:t,onMessage:r,onError:n,onStart:o}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:t,backlog:this.jobQueue.length});let n=new uv(r.name,t);t.onMessage=i=>r.onMessage(n,i.type,i.payload),t.onError=i=>r.onError(n,i),r.onStart(n);try{await n.result}catch(i){console.error(`Worker exception: ${i}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!ec||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Yd({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return IV?this.maxMobileConcurrency:this.maxConcurrency}};var ipt={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},FA=class{props;workerPools=new Map;static isSupported(){return Yd.isSupported()}static getWorkerFarm(t={}){return FA._workerFarm=FA._workerFarm||new FA({}),FA._workerFarm.setProps(t),FA._workerFarm}constructor(t){this.props={...ipt},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:r,source:n,url:i}=t,o=this.workerPools.get(r);return o||(o=new hv({name:r,source:n,url:i}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},Kd=FA;Vr(Kd,"_workerFarm");function BL(e,t={}){let r=t[e.id]||{},n=ec?`${e.id}-worker.js`:`${e.id}-worker-node.js`,i=r.workerUrl;if(!i&&e.id==="compression"&&(i=t.workerUrl),t._workerType==="test"&&(ec?i=`modules/${e.module}/dist/${n}`:i=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!i){let o=e.version;o==="latest"&&(o=CV);let s=o?`@${o}`:"";i=`https://unpkg.com/@loaders.gl/${e.module}${s}/dist/${n}`}return wc(i),i}function DL(e,t=cv){wc(e,"no worker provided");let r=e.version;return!(!t||!r)}var NL={};async function Pf(e,t=null,r={},n=null){return t&&(e=BV(e,t,r,n)),NL[e]=NL[e]||opt(e),await NL[e]}function BV(e,t,r={},n=null){if(!r.useLocalLibraries&&e.startsWith("http"))return e;n=n||e;let i=r.modules||{};return i[n]?i[n]:ec?r.CDN?(wc(r.CDN.startsWith("http")),`${r.CDN}/${t}@${cv}/dist/libs/${n}`):lv?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function opt(e){if(e.endsWith("wasm"))return await apt(e);if(!ec)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(e)}catch(r){return console.error(r),null}if(lv)return importScripts(e);let t=await cpt(e);return spt(t,e)}function spt(e,t){if(!ec){let{requireFromString:n}=globalThis.loaders||{};return n?.(e,t)}if(lv)return eval.call(globalThis,e),null;let r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch{r.text=e}return document.body.appendChild(r),null}async function apt(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return ec||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function cpt(e){let{readFileAsText:t}=globalThis.loaders||{};return ec||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function kL(e,t){return!Kd.isSupported()||!ec&&!t?._nodeWorkers?!1:e.worker&&t?.worker}async function FL(e,t,r,n,i){let o=e.id,s=BL(e,r),l=Kd.getWorkerFarm(r).getWorkerPool({name:o,url:s});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));let h=await l.startJob("process-on-worker",lpt.bind(null,i));return h.postMessage("process",{input:t,options:r,context:n}),await(await h.result).result}async function lpt(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:i,input:o,options:s}=n;try{let c=await e(o,s);t.postMessage("done",{id:i,result:c})}catch(c){let l=c instanceof Error?c.message:"unknown error";t.postMessage("error",{id:i,error:l})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function NV(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?DV(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?DV(e,0,t):""}function DV(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),i="";for(let o=0;o<r;o++)i+=String.fromCharCode(n.getUint8(t+o));return i}function zL(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${NV(e)}"`)}}function UL(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let n=new Uint8Array(e),i=new Uint8Array(t);for(let o=0;o<n.length;++o)if(n[o]!==i[o])return!1;return!0}function VL(...e){return kV(e)}function kV(e){let t=e.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=t.reduce((o,s)=>o+s.byteLength,0),n=new Uint8Array(r),i=0;for(let o of t)n.set(o,i),i+=o.byteLength;return n.buffer}function fv(...e){let t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let n=t.reduce((s,c)=>s+c.length,0),i=new r(n),o=0;for(let s of t)i.set(s,o),o+=s.length;return i}function zA(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}function Zd(e,t){return Ti(e>=0),Ti(t>0),e+(t-1)&~(t-1)}function jL(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let i=e.byteOffset,o=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,i,o)}return t.set(n,r),r+Zd(n.byteLength,4)}async function HL(e){let t=[];for await(let r of e)t.push(r);return VL(...t)}function pv(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var UA=class{constructor(t,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=pv(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(pv()-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)}};var Nc=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof UA?i=t:i=new UA(r,n),this.stats[r]=i),i}};var upt="Queued Requests",hpt="Active Requests",fpt="Cancelled Requests",ppt="Queued Requests Ever",dpt="Active Requests Ever",mpt={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},$d=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...mpt,...t},this.stats=new Nc({id:this.props.id}),this.stats.get(upt),this.stats.get(hpt),this.stats.get(fpt),this.stats.get(ppt),this.stats.get(dpt)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},i=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){let{handle:r,resolve:n}=t,i=!1,o=()=>{i||(i=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Apt="",FV={};function WL(e){for(let t in FV)if(e.startsWith(t)){let r=FV[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Apt}${e}`),e}function zV(e){return e&&typeof e=="object"&&e.isBuffer}function SE(e){if(zV(e))return e;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}var ou={};Lo(ou,{dirname:()=>_pt,filename:()=>gpt,join:()=>ypt,resolve:()=>xpt});function UV(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function gpt(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function _pt(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function ypt(...e){let t="/";return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${t}`),"")),n!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function xpt(...e){let t=[];for(let o=0;o<e.length;o++)t[o]=e[o];let r="",n=!1,i;for(let o=t.length-1;o>=-1&&!n;o--){let s;o>=0?s=t[o]:(i===void 0&&(i=UV()),s=i),s.length!==0&&(r=`${s}/${r}`,n=s.charCodeAt(0)===dv)}return r=vpt(r,!n),n?`/${r}`:r.length>0?r:"."}var dv=47,qL=46;function vpt(e,t){let r="",n=-1,i=0,o,s=!1;for(let c=0;c<=e.length;++c){if(c<e.length)o=e.charCodeAt(c);else{if(o===dv)break;o=dv}if(o===dv){if(!(n===c-1||i===1))if(n!==c-1&&i===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==qL||r.charCodeAt(r.length-2)!==qL){if(r.length>2){let l=r.length-1,h=l;for(;h>=0&&r.charCodeAt(h)!==dv;--h);if(h!==l){r=h===-1?"":r.slice(0,h),n=c,i=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",n=c,i=0,s=!1;continue}}t&&(r.length>0?r+="/..":r="..",s=!0)}else{let l=e.slice(n+1,c);r.length>0?r+=`/${l}`:r=l,s=!1}n=c,i=0}else o===qL&&i!==-1?++i:i=-1}return r}var CE=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=bpt(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function bpt(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,i)=>t(n,i);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var Uu=class extends CE{};Vr(Uu,"type","template"),Vr(Uu,"testURL",t=>!1);var wpt=e=>typeof e=="boolean",mv=e=>typeof e=="function",VA=e=>e!==null&&typeof e=="object",XL=e=>VA(e)&&e.constructor==={}.constructor;var VV=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",jV=e=>e&&typeof e[Symbol.asyncIterator]=="function";var Vu=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var ju=e=>typeof Blob<"u"&&e instanceof Blob,HV=e=>e&&typeof e=="object"&&e.isBuffer;var Tpt=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||VA(e)&&mv(e.tee)&&mv(e.cancel)&&mv(e.getReader);var Ept=e=>VA(e)&&mv(e.read)&&mv(e.pipe)&&wpt(e.readable),PE=e=>Tpt(e)||Ept(e);var IE=class extends Error{constructor(t,r){super(t),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var Mpt=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Spt=/^([-\w.]+\/[-\w.+]+)/;function YL(e,t){return e.toLowerCase()===t.toLowerCase()}function WV(e){let t=Spt.exec(e);return t?t[1]:e}function KL(e){let t=Mpt.exec(e);return t?t[1]:""}var qV=/\?.*/;function GV(e){let t=e.match(qV);return t&&t[0]}function __(e){return e.replace(qV,"")}function XV(e){if(e.length<50)return e;let t=e.slice(e.length-15);return`${e.substr(0,32)}...${t}`}function jA(e){return Vu(e)?e.url:ju(e)?e.name||"":typeof e=="string"?e:""}function Av(e){if(Vu(e)){let t=e,r=t.headers.get("content-type")||"",n=__(t.url);return WV(r)||KL(n)}return ju(e)?e.type||"":typeof e=="string"?KL(e):""}function YV(e){return Vu(e)?e.headers["content-length"]||-1:ju(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function RE(e){if(Vu(e))return e;let t={},r=YV(e);r>=0&&(t["content-length"]=String(r));let n=jA(e),i=Av(e);i&&(t["content-type"]=i);let o=await Ppt(e);o&&(t["x-first-bytes"]=o),typeof e=="string"&&(e=new TextEncoder().encode(e));let s=new Response(e,{headers:t});return Object.defineProperty(s,"url",{value:n}),s}async function KV(e){if(!e.ok)throw await Cpt(e)}async function Cpt(e){let t=XV(e.url),r=`Failed to fetch resource (${e.status}) ${e.statusText}: ${t}`;r=r.length>100?`${r.slice(0,100)}...`:r;let n={reason:e.statusText,url:e.url,response:e};try{let i=e.headers.get("Content-Type");n.reason=i?.includes("application/json")?await e.json():e.text()}catch{}return new IE(r,n)}async function Ppt(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(n=>{let i=new FileReader;i.onload=o=>n(o?.target?.result),i.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5);return`data:base64,${Ipt(r)}`}return null}function Ipt(e){let t="",r=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)t+=String.fromCharCode(r[n]);return btoa(t)}function Rpt(e){return!Lpt(e)&&!Opt(e)}function Lpt(e){return e.startsWith("http:")||e.startsWith("https:")}function Opt(e){return e.startsWith("data:")}async function y_(e,t){if(typeof e=="string"){let r=WL(e);return Rpt(r)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(r,t):await fetch(r,t)}return await RE(e)}var ZL=new Bl({id:"loaders.gl"}),LE=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},OE=class{console;constructor(){this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}};var $L={fetch:null,mimeType:void 0,nothrow:!1,log:new OE,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Dp,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},ZV={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function QL(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function JL(){let e=QL();return e.globalOptions=e.globalOptions||{...$L},e.globalOptions}function JV(e,t,r,n){return r=r||[],r=Array.isArray(r)?r:[r],Bpt(e,r),Npt(t,e,n)}function Bpt(e,t){$V(e,null,$L,ZV,t);for(let r of t){let n=e&&e[r.id]||{},i=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};$V(n,r.id,i,o,t)}}function $V(e,t,r,n,i){let o=t||"Top level",s=t?`${t}.`:"";for(let c in e){let l=!t&&VA(e[c]),h=c==="baseUri"&&!t,p=c==="workerUrl"&&t;if(!(c in r)&&!h&&!p){if(c in n)ZL.warn(`${o} loader option '${s}${c}' no longer supported, use '${n[c]}'`)();else if(!l){let x=Dpt(c,i);ZL.warn(`${o} loader option '${s}${c}' not recognized. ${x}`)()}}}}function Dpt(e,t){let r=e.toLowerCase(),n="";for(let i of t)for(let o in i.options){if(e===o)return`Did you mean '${i.id}.${o}'?`;let s=o.toLowerCase();(r.startsWith(s)||s.startsWith(r))&&(n=n||`Did you mean '${i.id}.${o}'?`)}return n}function Npt(e,t,r){let i={...e.options||{}};return kpt(i,r),i.log===null&&(i.log=new LE),QV(i,JL()),QV(i,t),i}function QV(e,t){for(let r in t)if(r in t){let n=t[r];XL(n)&&XL(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function kpt(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}function gv(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e?.extensions)):!1}function _v(e){Ti(e,"null loader"),Ti(gv(e),"invalid loader");let t;return Array.isArray(e)&&(t=e[1],e=e[0],e={...e,options:{...e.options,...t}}),(e?.parseTextSync||e?.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var t9=()=>{let e=QL();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function HA(e){let t=t9();e=Array.isArray(e)?e:[e];for(let r of e){let n=_v(r);t.find(i=>n===i)||t.unshift(n)}}function e9(){return t9()}var r9=new Bl({id:"loaders.gl"});var Fpt=/\.([^.]+)$/;async function o9(e,t=[],r,n){if(!s9(e))return null;let i=n9(e,t,{...r,nothrow:!0},n);if(i)return i;if(ju(e)&&(e=await e.slice(0,10).arrayBuffer(),i=n9(e,t,r,n)),!i&&!r?.nothrow)throw new Error(a9(e));return i}function n9(e,t=[],r,n){if(!s9(e))return null;if(t&&!Array.isArray(t))return _v(t);let i=[];t&&(i=i.concat(t)),r?.ignoreRegisteredLoaders||i.push(...e9()),Upt(i);let o=zpt(e,i,r,n);if(!o&&!r?.nothrow)throw new Error(a9(e));return o}function zpt(e,t,r,n){let i=jA(e),o=Av(e),s=__(i)||n?.url,c=null,l="";return r?.mimeType&&(c=tO(t,r?.mimeType),l=`match forced by supplied MIME type ${r?.mimeType}`),c=c||Vpt(t,s),l=l||(c?`matched url ${s}`:""),c=c||tO(t,o),l=l||(c?`matched MIME type ${o}`:""),c=c||Hpt(t,e),l=l||(c?`matched initial data ${c9(e)}`:""),r?.fallbackMimeType&&(c=c||tO(t,r?.fallbackMimeType),l=l||(c?`matched fallback MIME type ${o}`:"")),l&&r9.log(1,`selectLoader selected ${c?.name}: ${l}.`),c}function s9(e){return!(e instanceof Response&&e.status===204)}function a9(e){let t=jA(e),r=Av(e),n="No valid loader found (";n+=t?`${ou.filename(t)}, `:"no url provided, ",n+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let i=e?c9(e):"";return n+=i?` first bytes: "${i}"`:"first bytes: not available",n+=")",n}function Upt(e){for(let t of e)_v(t)}function Vpt(e,t){let r=t&&Fpt.exec(t),n=r&&r[1];return n?jpt(e,n):null}function jpt(e,t){t=t.toLowerCase();for(let r of e)for(let n of r.extensions)if(n.toLowerCase()===t)return r;return null}function tO(e,t){for(let r of e)if(r.mimeTypes?.some(n=>YL(t,n))||YL(t,`application/x.${r.id}`))return r;return null}function Hpt(e,t){if(!t)return null;for(let r of e)if(typeof t=="string"){if(Wpt(t,r))return r}else if(ArrayBuffer.isView(t)){if(i9(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&i9(t,0,r))return r;return null}function Wpt(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>e.startsWith(n))}function i9(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>qpt(e,t,r,i))}function qpt(e,t,r,n){if(n instanceof ArrayBuffer)return UL(n,e,n.byteLength);switch(typeof n){case"function":return n(e);case"string":let i=eO(e,t,n.length);return n===i;default:return!1}}function c9(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?eO(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?eO(e,0,t):""}function eO(e,t,r){if(e.byteLength<t+r)return"";let n=new DataView(e),i="";for(let o=0;o<r;o++)i+=String.fromCharCode(n.getUint8(t+o));return i}function*l9(e,t){let r=t?.chunkSize||262144,n=0,i=new TextEncoder;for(;n<e.length;){let o=Math.min(e.length-n,r),s=e.slice(n,n+o);n+=o,yield i.encode(s)}}function*u9(e,t={}){let{chunkSize:r=262144}=t,n=0;for(;n<e.byteLength;){let i=Math.min(e.byteLength-n,r),o=new ArrayBuffer(i),s=new Uint8Array(e,n,i);new Uint8Array(o).set(s),n+=i,yield o}}async function*h9(e,t){let r=t?.chunkSize||1048576,n=0;for(;n<e.size;){let i=n+r,o=await e.slice(n,i).arrayBuffer();n=i,yield o}}function rO(e,t){return Dp?Gpt(e,t):Xpt(e,t)}async function*Gpt(e,t){let r=e.getReader(),n;try{for(;;){let i=n||r.read();t?._streamReadAhead&&(n=r.read());let{done:o,value:s}=await i;if(o)return;yield SE(s)}}catch{r.releaseLock()}}async function*Xpt(e,t){for await(let r of e)yield SE(r)}function f9(e,t){if(typeof e=="string")return l9(e,t);if(e instanceof ArrayBuffer)return u9(e,t);if(ju(e))return h9(e,t);if(PE(e))return rO(e,t);if(Vu(e))return rO(e.body,t);throw new Error("makeIterator")}var p9="Cannot convert supplied data type";function Ypt(e,t,r){if(t.text&&typeof e=="string")return e;if(HV(e)&&(e=e.buffer),e instanceof ArrayBuffer){let n=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);let n=e.buffer,i=e.byteLength||e.length;return(e.byteOffset!==0||i!==n.byteLength)&&(n=n.slice(e.byteOffset,e.byteOffset+i)),n}throw new Error(p9)}async function d9(e,t,r){let n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||n)return Ypt(e,t,r);if(ju(e)&&(e=await RE(e)),Vu(e)){let i=e;return await KV(i),t.binary?await i.arrayBuffer():await i.text()}if(PE(e)&&(e=f9(e,r)),VV(e)||jV(e))return HL(e);throw new Error(p9)}function BE(e,t){let r=JL(),n=e||r;return typeof n.fetch=="function"?n.fetch:VA(n.fetch)?i=>y_(i,n.fetch):t?.fetch?t?.fetch:y_}function m9(e,t,r){if(r)return r;let n={fetch:BE(t,e),...e};if(n.url){let i=__(n.url);n.baseUrl=i,n.queryString=GV(n.url),n.filename=ou.filename(i),n.baseUrl=ou.dirname(i)}return Array.isArray(n.loaders)||(n.loaders=null),n}function A9(e,t){if(e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let n=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...n]:n}return r&&r.length?r:void 0}async function Qd(e,t,r,n){t&&!Array.isArray(t)&&!gv(t)&&(n=void 0,r=t,t=void 0),e=await e,r=r||{};let i=jA(e),s=A9(t,n),c=await o9(e,s,r);return c?(r=JV(r,c,s,i),n=m9({url:i,_parse:Qd,loaders:s},r,n||null),await Kpt(c,e,r,n)):null}async function Kpt(e,t,r,n){if(DL(e),r=av(e.options,r),Vu(t)){let o=t,{ok:s,redirected:c,status:l,statusText:h,type:p,url:x}=o,w=Object.fromEntries(o.headers.entries());n.response={headers:w,ok:s,redirected:c,status:l,statusText:h,type:p,url:x}}t=await d9(t,e,r);let i=e;if(i.parseTextSync&&typeof t=="string")return i.parseTextSync(t,r,n);if(kL(e,r))return await FL(e,t,r,n,Qd);if(i.parseText&&typeof t=="string")return await i.parseText(t,r,n);if(i.parse)return await i.parse(t,r,n);throw wc(!i.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}async function xa(e,t,r,n){let i,o;!Array.isArray(t)&&!gv(t)?(i=[],o=t,n=void 0):(i=t,o=r);let s=BE(o),c=e;return typeof e=="string"&&(c=await s(e)),ju(e)&&(c=await s(e)),Array.isArray(i)?await Qd(c,i,o):await Qd(c,i,o)}var nO=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new Nc({id:t})),this.stats.get(t)}},DE=new nO;var qe=new Bl({id:"luma.gl"});var iO={};function Jd(e="id"){iO[e]=iO[e]||1;let t=iO[e]++;return`${e}-${t}`}var ti=class{toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,r,n){if(!t)throw new Error("no device");this._device=t,this.props=Zpt(r,n);let i=this.props.id!=="undefined"?this.props.id:Jd(this[Symbol.toStringTag]);this.props.id=i,this.id=i,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];t.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(t,r=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(t),n.get(`${r} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${r}s Created`).incrementCount(),t.get(`${r}s Active`).incrementCount()}};Vr(ti,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Zpt(e,t){let r={...t};for(let n in e)e[n]!==void 0&&(r[n]=e[n]);return r}var yv=class extends ti{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,r){let n={...r};(r.usage||0)&yv.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?n.indexType="uint32":r.data instanceof Uint16Array&&(n.indexType="uint16")),delete n.data,super(t,n,yv.defaultProps),this.usage=n.usage||0,this.indexType=n.indexType,this.updateTimestamp=t.incrementTimestamp()}clone(t){return this.device.createBuffer({...this.props,...t})}readSyncWebGL(t,r){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,r,n){let i=ArrayBuffer.isView(t)?t.buffer:t,o=Math.min(t?t.byteLength:n,yv.DEBUG_DATA_MAX_LENGTH);i===null?this.debugData=new ArrayBuffer(o):r===0&&n===i.byteLength?this.debugData=i.slice(0,o):this.debugData=i.slice(r,r+o)}},Vn=yv;Vr(Vn,"defaultProps",{...ti.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),Vr(Vn,"MAP_READ",1),Vr(Vn,"MAP_WRITE",2),Vr(Vn,"COPY_SRC",4),Vr(Vn,"COPY_DST",8),Vr(Vn,"INDEX",16),Vr(Vn,"VERTEX",32),Vr(Vn,"UNIFORM",64),Vr(Vn,"STORAGE",128),Vr(Vn,"INDIRECT",256),Vr(Vn,"QUERY_RESOLVE",512),Vr(Vn,"DEBUG_DATA_MAX_LENGTH",32);function NE(e){let t=g9[e],r=$pt(t),n=e.includes("norm"),i=!n&&!e.startsWith("float"),o=e.startsWith("s");return{dataType:g9[e],byteLength:r,integer:i,signed:o,normalized:n}}function $pt(e){return Qpt[e]}var g9={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Qpt={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var kc="texture-compression-bc",Oo="texture-compression-astc",If="texture-compression-etc2",Jpt="texture-compression-etc1-webgl",kE="texture-compression-pvrtc-webgl",oO="texture-compression-atc-webgl",FE="float32-renderable-webgl",sO="float16-renderable-webgl",tdt="rgb9e5ufloat-renderable-webgl",aO="snorm8-renderable-webgl",xv="norm16-renderable-webgl",cO="snorm16-renderable-webgl",zE="float32-filterable",_9="float16-filterable-webgl";function UE(e){let t=edt[e];if(!t)throw new Error(`Unsupported texture format ${e}`);return t}var edt={r8unorm:{},r8snorm:{render:aO},r8uint:{},r8sint:{},rg8unorm:{},rg8snorm:{render:aO},rg8uint:{},rg8sint:{},r16uint:{},r16sint:{},r16float:{render:sO,filter:"float16-filterable-webgl"},"r16unorm-webgl":{f:xv},"r16snorm-webgl":{f:cO},"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},"rgb8unorm-webgl":{},"rgb8snorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},rgba8snorm:{render:aO},rgba8uint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{},rg16sint:{},rg16float:{render:sO,filter:_9},"rg16unorm-webgl":{render:xv},"rg16snorm-webgl":{render:cO},r32uint:{},r32sint:{},r32float:{render:FE,filter:zE},rgb9e5ufloat:{channels:"rgb",packed:!0,render:tdt},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:FE},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},"rgb10a2uint-webgl":{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1,wgpu:!1},"rgb16unorm-webgl":{f:xv},"rgb16snorm-webgl":{f:xv},rg32uint:{},rg32sint:{},rg32float:{render:!1,filter:zE},rgba16uint:{},rgba16sint:{},rgba16float:{render:sO,filter:_9},"rgba16unorm-webgl":{render:xv},"rgba16snorm-webgl":{render:cO},"rgb32float-webgl":{render:FE,filter:zE},rgba32uint:{},rgba32sint:{},rgba32float:{render:FE,filter:zE},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:kc},"bc1-rgb-unorm-srgb-webgl":{f:kc},"bc1-rgba-unorm":{f:kc},"bc1-rgba-unorm-srgb":{f:kc},"bc2-rgba-unorm":{f:kc},"bc2-rgba-unorm-srgb":{f:kc},"bc3-rgba-unorm":{f:kc},"bc3-rgba-unorm-srgb":{f:kc},"bc4-r-unorm":{f:kc},"bc4-r-snorm":{f:kc},"bc5-rg-unorm":{f:kc},"bc5-rg-snorm":{f:kc},"bc6h-rgb-ufloat":{f:kc},"bc6h-rgb-float":{f:kc},"bc7-rgba-unorm":{f:kc},"bc7-rgba-unorm-srgb":{f:kc},"etc2-rgb8unorm":{f:If},"etc2-rgb8unorm-srgb":{f:If},"etc2-rgb8a1unorm":{f:If},"etc2-rgb8a1unorm-srgb":{f:If},"etc2-rgba8unorm":{f:If},"etc2-rgba8unorm-srgb":{f:If},"eac-r11unorm":{f:If},"eac-r11snorm":{f:If},"eac-rg11unorm":{f:If},"eac-rg11snorm":{f:If},"astc-4x4-unorm":{f:Oo},"astc-4x4-unorm-srgb":{f:Oo},"astc-5x4-unorm":{f:Oo},"astc-5x4-unorm-srgb":{f:Oo},"astc-5x5-unorm":{f:Oo},"astc-5x5-unorm-srgb":{f:Oo},"astc-6x5-unorm":{f:Oo},"astc-6x5-unorm-srgb":{f:Oo},"astc-6x6-unorm":{f:Oo},"astc-6x6-unorm-srgb":{f:Oo},"astc-8x5-unorm":{f:Oo},"astc-8x5-unorm-srgb":{f:Oo},"astc-8x6-unorm":{f:Oo},"astc-8x6-unorm-srgb":{f:Oo},"astc-8x8-unorm":{f:Oo},"astc-8x8-unorm-srgb":{f:Oo},"astc-10x5-unorm":{f:Oo},"astc-10x5-unorm-srgb":{f:Oo},"astc-10x6-unorm":{f:Oo},"astc-10x6-unorm-srgb":{f:Oo},"astc-10x8-unorm":{f:Oo},"astc-10x8-unorm-srgb":{f:Oo},"astc-10x10-unorm":{f:Oo},"astc-10x10-unorm-srgb":{f:Oo},"astc-12x10-unorm":{f:Oo},"astc-12x10-unorm-srgb":{f:Oo},"astc-12x12-unorm":{f:Oo},"astc-12x12-unorm-srgb":{f:Oo},"pvrtc-rgb4unorm-webgl":{f:kE},"pvrtc-rgba4unorm-webgl":{f:kE},"pvrtc-rbg2unorm-webgl":{f:kE},"pvrtc-rgba2unorm-webgl":{f:kE},"etc1-rbg-unorm-webgl":{f:Jpt},"atc-rgb-unorm-webgl":{f:oO},"atc-rgba-unorm-webgl":{f:oO},"atc-rgbai-unorm-webgl":{f:oO}};var rdt=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],ndt=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/;function lO(e){return rdt.some(t=>e.startsWith(t))}function x_(e){let t=idt(e);if(lO(e)){t.channels="rgb",t.components=3,t.bytesPerPixel=1,t.srgb=!1,t.compressed=!0;let n=odt(e);n&&(t.blockWidth=n.blockWidth,t.blockHeight=n.blockHeight)}let r=ndt.exec(e);if(r){let[,n,i,o,s,c]=r,l=`${o}${i}`,h=NE(l),p=h.byteLength*8,x=n.length,w=[p,x>=2?p:0,x>=3?p:0,x>=4?p:0];t={format:e,attachment:t.attachment,dataType:h.dataType,components:x,channels:n,integer:h.integer,signed:h.signed,normalized:h.normalized,bitsPerChannel:w,bytesPerPixel:h.byteLength*n.length,packed:t.packed,srgb:t.srgb},c==="-webgl"&&(t.webgl=!0),s==="-srgb"&&(t.srgb=!0)}return e.endsWith("-webgl")&&(t.webgl=!0),e.endsWith("-srgb")&&(t.srgb=!0),t}function idt(e){let t=UE(e),r=t.bytesPerPixel||1,n=t.bitsPerChannel||[8,8,8,8];return delete t.bitsPerChannel,delete t.bytesPerPixel,delete t.f,delete t.render,delete t.filter,delete t.blend,delete t.store,{...t,format:e,attachment:t.attachment||"color",channels:t.channels||"r",components:t.components||t.channels?.length||1,bytesPerPixel:r,bitsPerChannel:n,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}}function odt(e){let r=/.*-(\d+)x(\d+)-.*/.exec(e);if(r){let[,n,i]=r;return{blockWidth:Number(n),blockHeight:Number(i)}}return null}function y9(e){let t=UE(e),r={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},n=x_(e),i=e.startsWith("depth")||e.startsWith("stencil"),o=n?.signed,s=n?.integer,c=n?.webgl;return r.render&&=!o,r.filter&&=!i&&!o&&!s&&!c,r}var vv=class{},bv=class{features;disabledFeatures;constructor(t=[],r){this.features=new Set(t),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures?.[t]&&this.features.has(t)}},uO=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...uO.defaultProps,...t},this.id=this.props.id||Jd(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=DE;timestamp=0;_lumaData={};getTextureFormatCapabilities(t){let r=y9(t),n=s=>(typeof s=="string"?this.features.has(s):s)??!0,i=n(r.create),o={format:t,create:i,render:i&&n(r.render),filter:i&&n(r.filter),blend:i&&n(r.blend),store:i&&n(r.store)};return this._getDeviceSpecificTextureFormatCapabilities(o)}isTextureFormatSupported(t,r){return this.getTextureFormatCapabilities(t).create}isTextureFormatFilterable(t){return this.getTextureFormatCapabilities(t).filter}isTextureFormatRenderable(t){return this.getTextureFormatCapabilities(t).render}isTextureFormatCompressed(t){return lO(t)}loseDevice(){return!1}reportError(t){this.props.onError(t)}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createCommandEncoder(t={}){throw new Error("not implemented")}incrementTimestamp(){return this.timestamp++}onError(t){this.props.onError(t)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(t,r){throw new Error("not implemented")}readPixelsToBufferWebGL(t,r){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,r){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}_normalizeBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let r={...t};return(t.usage||0)&Vn.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?r.indexType="uint32":t.data instanceof Uint16Array?r.indexType="uint16":qe.warn("indices buffer content must be of integer type")()),r}},Dl=uO;Vr(Dl,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,onError:t=>qe.error(t.message)(),_requestMaxLimits:!0,_factoryDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_resourceDefaults:{},webgl:{},debug:qe.get("debug")||void 0,debugShaders:qe.get("debug-shaders")||void 0,debugFramebuffers:Boolean(qe.get("debug-framebuffers")),debugWebGL:Boolean(qe.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_handle:void 0});var sdt=ul()&&typeof document<"u",adt=()=>sdt&&document.readyState==="complete",cdt="set luma.log.level=1 (or higher) to trace rendering",x9="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",v_=class{stats=DE;log=qe;VERSION="9.1.0-beta.16";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw qe.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),qe.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");qe.error("This version of luma.gl has already been initialized")()}qe.log(1,`${this.VERSION} - ${cdt}`)(),globalThis.luma=this}registerAdapters(t){for(let r of t)this.preregisteredAdapters.set(r.type,r)}getSupportedAdapters(t=[]){let r=this.getAdapterMap(t);return Array.from(r).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapter(t=[]){let r=this.getAdapterMap(t);return r.get("webgpu")?.isSupported?.()?"webgpu":r.get("webgl")?.isSupported?.()?"webgl":null}setDefaultDeviceProps(t){Object.assign(v_.defaultProps,t)}async createDevice(t={}){t={...v_.defaultProps,...t},t.waitForPageLoad&&await v_.pageLoaded;let r=this.getAdapterMap(t.adapters),n=t.type||"";n==="best-available"&&(n=this.getBestAvailableAdapter(t.adapters)||n);let s=await(this.getAdapterMap(t.adapters)||r).get(n)?.create?.(t);if(s)return s;throw new Error(x9)}async attachDevice(t){let r=this.getAdapterMap(t.adapters),n="";t.handle instanceof WebGL2RenderingContext&&(n="webgl"),t.createCanvasContext&&await v_.pageLoaded,t.handle===null&&(n="unknown");let o=await r.get(n)?.attach?.(null);if(o)return o;throw new Error(x9)}enforceWebGL2(t=!0,r=[]){let i=this.getAdapterMap(r).get("webgl");i||qe.warn("enforceWebGL2: webgl adapter not found")(),i?.enforceWebGL2?.(t)}getAdapterMap(t=[]){let r=new Map(this.preregisteredAdapters);for(let n of t)r.set(n.type,n);return r}registerDevices(t){qe.warn("luma.registerDevices() is deprecated, use luma.registerAdapters() instead");for(let r of t){let n=r.adapter;n&&this.preregisteredAdapters.set(n.type,n)}}},wv=v_;Vr(wv,"defaultProps",{...Dl.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0}),Vr(wv,"pageLoaded",ldt().then(()=>{qe.probe(2,"DOM is loaded")()}));var Rf=new wv;function ldt(){return adt()||typeof window>"u"?Promise.resolve():new Promise(e=>{window.addEventListener("load",()=>e())})}var Tv=class{};var hO=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(t){if(this.props={...hO.defaultProps,...t},t=this.props,!ul()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(t.canvas)typeof t.canvas=="string"?this.canvas=hdt(t.canvas):this.canvas=t.canvas;else{let r=fdt(t),n=udt(t?.container||null);n.insertBefore(r,n.firstChild),this.canvas=r,t?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let n of r)n.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(t){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(t=t===void 0?this.props.useDevicePixels:t,!t||t<=0)?1:t===!0?typeof window<"u"&&window.devicePixelRatio||1:t}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let t=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*t,r.clientHeight*t]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[t,r]=this.getPixelSize();return t/r}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),r=this._canvasSizeInfo.clientWidth||this.htmlCanvas?.clientWidth;return r?t/r:1}catch{return 1}}cssToDevicePixels(t,r=!0){let n=this.cssToDeviceRatio(),[i,o]=this.getDrawingBufferSize();return pdt(t,n,i,o,r)}setDevicePixelRatio(t,r={}){if(!this.htmlCanvas)return;let n="width"in r?r.width:this.htmlCanvas.clientWidth,i="height"in r?r.height:this.htmlCanvas.clientHeight;(!n||!i)&&(qe.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,n=this.htmlCanvas.width||1,i=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==n||o.clientHeight!==i||o.devicePixelRatio!==t){let s=t,c=Math.floor(n*s),l=Math.floor(i*s);if(this.htmlCanvas.width=c,this.htmlCanvas.height=l,this.device.gl){let[p,x]=this.getDrawingBufferSize();(p!==c||x!==l)&&(s=Math.min(p/n,x/i),this.htmlCanvas.width=Math.floor(n*s),this.htmlCanvas.height=Math.floor(i*s),qe.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=i,this._canvasSizeInfo.devicePixelRatio=t}}}getDrawingBufferSize(){let t=this.device.gl;if(!t)throw new Error("canvas size");return[t.drawingBufferWidth,t.drawingBufferHeight]}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}},b_=hO;Vr(b_,"defaultProps",{canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb"});function udt(e){if(typeof e=="string"){let t=document.getElementById(e);if(!t)throw new Error(`${e} is not an HTML element`);return t}else if(e)return e;return document.body}function hdt(e){let t=document.getElementById(e);if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function fdt(e){let{width:t,height:r}=e,n=document.createElement("canvas");return n.id=Jd("lumagl-auto-created-canvas"),n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?`${t}px`:"100%",n.style.height=Number.isFinite(r)?`${r}px`:"100%",n}function pdt(e,t,r,n,i){let o=e,s=v9(o[0],t,r),c=b9(o[1],t,n,i),l=v9(o[0]+1,t,r),h=l===r-1?l:l-1;l=b9(o[1]+1,t,n,i);let p;return i?(l=l===0?l:l+1,p=c,c=l):p=l===n-1?l:l-1,{x:s,y:c,width:Math.max(h-s+1,1),height:Math.max(p-c+1,1)}}function v9(e,t,r){return Math.min(Math.round(e*t),r-1)}function b9(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}var Np=class extends ti{get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}dimension;format;width;height;depth;mipLevels;updateTimestamp;constructor(t,r){if(r=Np.normalizeProps(t,r),super(t,r,Np.defaultProps),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.props.width===void 0||this.props.height===void 0){let n=Np.getTextureDataSize(this.props.data);this.width=n?.width||1,this.height=n?.height||1}this.props.mipmaps&&this.props.mipLevels===void 0&&(this.props.mipLevels="pyramid"),this.mipLevels=this.props.mipLevels==="pyramid"?Np.getMipLevelCount(this.width,this.height):this.props.mipLevels||1,this.updateTimestamp=t.incrementTimestamp()}clone(t){return this.device.createTexture({...this.props,...t})}static isExternalImage(t){return typeof ImageData<"u"&&t instanceof ImageData||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement||typeof VideoFrame<"u"&&t instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas}static getExternalImageSize(t){if(typeof ImageData<"u"&&t instanceof ImageData||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height};if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement)return{width:t.naturalWidth,height:t.naturalHeight};if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)return{width:t.videoWidth,height:t.videoHeight};if(typeof VideoFrame<"u"&&t instanceof VideoFrame)return{width:t.displayWidth,height:t.displayHeight};throw new Error("Unknown image type")}static isTextureLevelData(t){let r=t?.data;return ArrayBuffer.isView(r)}static getTextureDataSize(t){if(!t||ArrayBuffer.isView(t))return null;if(Array.isArray(t))return Np.getTextureDataSize(t[0]);if(Np.isExternalImage(t))return Np.getExternalImageSize(t);if(t&&typeof t=="object"&&t.constructor===Object){let n=Object.values(t)[0];return{width:n.width,height:n.height}}throw new Error("texture size deduction failed")}static normalizeTextureData(t,r){let n;return ArrayBuffer.isView(t)?n=[{data:t,width:r.width,height:r.height}]:Array.isArray(t)?n=t:n=[t],n}static getMipLevelCount(t,r){return Math.floor(Math.log2(Math.max(t,r)))+1}static getCubeFaceDepth(t){switch(t){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(t)}}static normalizeProps(t,r){let n={...r},i=t?.props?._resourceDefaults?.texture||{};Object.assign(n,i);let{width:o,height:s}=n;return typeof o=="number"&&(n.width=Math.max(1,Math.ceil(o))),typeof s=="number"&&(n.height=Math.max(1,Math.ceil(s))),n}},fi=Np;Vr(fi,"COPY_SRC",1),Vr(fi,"COPY_DST",2),Vr(fi,"TEXTURE",4),Vr(fi,"STORAGE",8),Vr(fi,"RENDER_ATTACHMENT",16),Vr(fi,"CubeFaces",["+X","-X","+Y","-Y","+Z","-Z"]),Vr(fi,"defaultProps",{...ti.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!1,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,sampler:{},view:void 0,flipY:void 0}),Vr(fi,"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});var fO=class extends ti{get[Symbol.toStringTag](){return"TextureView"}constructor(t,r){super(t,r,fO.defaultProps)}},tm=fO;Vr(tm,"defaultProps",{...ti.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});function T9(e,t,r){let n="",i=t.split(/\r?\n/),o=e.slice().sort((s,c)=>s.lineNum-c.lineNum);switch(r?.showSourceCode||"no"){case"all":let s=0;for(let c=1;c<=i.length;c++)for(n+=E9(i[c-1],c,r);o.length>s&&o[s].lineNum===c;){let l=o[s++];n+=w9(l,i,l.lineNum,{...r,inlineSource:!1})}return n;case"issues":case"no":for(let c of e)n+=w9(c,i,c.lineNum,{inlineSource:r?.showSourceCode!=="no"});return n}}function w9(e,t,r,n){if(n?.inlineSource){let o=ddt(t,r),s=e.linePos>0?`${" ".repeat(e.linePos+5)}^^^
541
+ }`}function LL(e,t=!0,r){let n=r||new Set;if(e){if(OV(e))n.add(e);else if(OV(e.buffer))n.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e=="object")for(let i in e)LL(e[i],t,n)}}return r===void 0?Array.from(n):[]}function OV(e){return e?e instanceof ArrayBuffer||typeof MessagePort<"u"&&e instanceof MessagePort||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas:!1}var OL=()=>{},Yd=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&ec||typeof g_<"u"&&!ec}constructor(t){let{name:r,source:n,url:i}=t;wc(n||i),this.name=r,this.source=n,this.url=i,this.onMessage=OL,this.onError=o=>console.log(o),this.worker=ec?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=OL,this.onError=OL,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,r){r=r||LL(t),this.worker.postMessage(t,r)}_getErrorFromErrorEvent(t){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,t.message&&(r+=`${t.message} in `),t.lineno&&(r+=`:${t.lineno}:${t.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=RV({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},t.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},t.onmessageerror=r=>console.error(r),t}_createNodeWorker(){let t;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new g_(n,{eval:!1})}else if(this.source)t=new g_(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",r=>{this.onMessage(r)}),t.on("error",r=>{this.onError(r)}),t.on("exit",r=>{}),t}};var hv=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Yd.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,r=(i,o,s)=>i.done(s),n=(i,o)=>i.error(o)){let i=new Promise(o=>(this.jobQueue.push({name:t,onMessage:r,onError:n,onStart:o}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:t,backlog:this.jobQueue.length});let n=new uv(r.name,t);t.onMessage=i=>r.onMessage(n,i.type,i.payload),t.onError=i=>r.onError(n,i),r.onStart(n);try{await n.result}catch(i){console.error(`Worker exception: ${i}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!ec||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Yd({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return IV?this.maxMobileConcurrency:this.maxConcurrency}};var ipt={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},FA=class{props;workerPools=new Map;static isSupported(){return Yd.isSupported()}static getWorkerFarm(t={}){return FA._workerFarm=FA._workerFarm||new FA({}),FA._workerFarm.setProps(t),FA._workerFarm}constructor(t){this.props={...ipt},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:r,source:n,url:i}=t,o=this.workerPools.get(r);return o||(o=new hv({name:r,source:n,url:i}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},Kd=FA;Vr(Kd,"_workerFarm");function BL(e,t={}){let r=t[e.id]||{},n=ec?`${e.id}-worker.js`:`${e.id}-worker-node.js`,i=r.workerUrl;if(!i&&e.id==="compression"&&(i=t.workerUrl),t._workerType==="test"&&(ec?i=`modules/${e.module}/dist/${n}`:i=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!i){let o=e.version;o==="latest"&&(o=CV);let s=o?`@${o}`:"";i=`https://unpkg.com/@loaders.gl/${e.module}${s}/dist/${n}`}return wc(i),i}function DL(e,t=cv){wc(e,"no worker provided");let r=e.version;return!(!t||!r)}var NL={};async function Pf(e,t=null,r={},n=null){return t&&(e=BV(e,t,r,n)),NL[e]=NL[e]||opt(e),await NL[e]}function BV(e,t,r={},n=null){if(!r.useLocalLibraries&&e.startsWith("http"))return e;n=n||e;let i=r.modules||{};return i[n]?i[n]:ec?r.CDN?(wc(r.CDN.startsWith("http")),`${r.CDN}/${t}@${cv}/dist/libs/${n}`):lv?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function opt(e){if(e.endsWith("wasm"))return await apt(e);if(!ec)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(e)}catch(r){return console.error(r),null}if(lv)return importScripts(e);let t=await cpt(e);return spt(t,e)}function spt(e,t){if(!ec){let{requireFromString:n}=globalThis.loaders||{};return n?.(e,t)}if(lv)return eval.call(globalThis,e),null;let r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch{r.text=e}return document.body.appendChild(r),null}async function apt(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return ec||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function cpt(e){let{readFileAsText:t}=globalThis.loaders||{};return ec||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function kL(e,t){return!Kd.isSupported()||!ec&&!t?._nodeWorkers?!1:e.worker&&t?.worker}async function FL(e,t,r,n,i){let o=e.id,s=BL(e,r),l=Kd.getWorkerFarm(r).getWorkerPool({name:o,url:s});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));let h=await l.startJob("process-on-worker",lpt.bind(null,i));return h.postMessage("process",{input:t,options:r,context:n}),await(await h.result).result}async function lpt(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:i,input:o,options:s}=n;try{let c=await e(o,s);t.postMessage("done",{id:i,result:c})}catch(c){let l=c instanceof Error?c.message:"unknown error";t.postMessage("error",{id:i,error:l})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function NV(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?DV(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?DV(e,0,t):""}function DV(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),i="";for(let o=0;o<r;o++)i+=String.fromCharCode(n.getUint8(t+o));return i}function zL(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${NV(e)}"`)}}function UL(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let n=new Uint8Array(e),i=new Uint8Array(t);for(let o=0;o<n.length;++o)if(n[o]!==i[o])return!1;return!0}function VL(...e){return kV(e)}function kV(e){let t=e.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=t.reduce((o,s)=>o+s.byteLength,0),n=new Uint8Array(r),i=0;for(let o of t)n.set(o,i),i+=o.byteLength;return n.buffer}function fv(...e){let t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let n=t.reduce((s,c)=>s+c.length,0),i=new r(n),o=0;for(let s of t)i.set(s,o),o+=s.length;return i}function zA(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}function Zd(e,t){return Ti(e>=0),Ti(t>0),e+(t-1)&~(t-1)}function jL(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let i=e.byteOffset,o=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,i,o)}return t.set(n,r),r+Zd(n.byteLength,4)}async function HL(e){let t=[];for await(let r of e)t.push(r);return VL(...t)}function pv(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var UA=class{constructor(t,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=pv(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(pv()-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)}};var Nc=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof UA?i=t:i=new UA(r,n),this.stats[r]=i),i}};var upt="Queued Requests",hpt="Active Requests",fpt="Cancelled Requests",ppt="Queued Requests Ever",dpt="Active Requests Ever",mpt={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},$d=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...mpt,...t},this.stats=new Nc({id:this.props.id}),this.stats.get(upt),this.stats.get(hpt),this.stats.get(fpt),this.stats.get(ppt),this.stats.get(dpt)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},i=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){let{handle:r,resolve:n}=t,i=!1,o=()=>{i||(i=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Apt="",FV={};function WL(e){for(let t in FV)if(e.startsWith(t)){let r=FV[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Apt}${e}`),e}function zV(e){return e&&typeof e=="object"&&e.isBuffer}function SE(e){if(zV(e))return e;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}var ou={};Lo(ou,{dirname:()=>_pt,filename:()=>gpt,join:()=>ypt,resolve:()=>xpt});function UV(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function gpt(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function _pt(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function ypt(...e){let t="/";return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${t}`),"")),n!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function xpt(...e){let t=[];for(let o=0;o<e.length;o++)t[o]=e[o];let r="",n=!1,i;for(let o=t.length-1;o>=-1&&!n;o--){let s;o>=0?s=t[o]:(i===void 0&&(i=UV()),s=i),s.length!==0&&(r=`${s}/${r}`,n=s.charCodeAt(0)===dv)}return r=vpt(r,!n),n?`/${r}`:r.length>0?r:"."}var dv=47,qL=46;function vpt(e,t){let r="",n=-1,i=0,o,s=!1;for(let c=0;c<=e.length;++c){if(c<e.length)o=e.charCodeAt(c);else{if(o===dv)break;o=dv}if(o===dv){if(!(n===c-1||i===1))if(n!==c-1&&i===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==qL||r.charCodeAt(r.length-2)!==qL){if(r.length>2){let l=r.length-1,h=l;for(;h>=0&&r.charCodeAt(h)!==dv;--h);if(h!==l){r=h===-1?"":r.slice(0,h),n=c,i=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",n=c,i=0,s=!1;continue}}t&&(r.length>0?r+="/..":r="..",s=!0)}else{let l=e.slice(n+1,c);r.length>0?r+=`/${l}`:r=l,s=!1}n=c,i=0}else o===qL&&i!==-1?++i:i=-1}return r}var CE=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=bpt(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function bpt(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,i)=>t(n,i);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var Uu=class extends CE{};Vr(Uu,"type","template"),Vr(Uu,"testURL",t=>!1);var wpt=e=>typeof e=="boolean",mv=e=>typeof e=="function",VA=e=>e!==null&&typeof e=="object",XL=e=>VA(e)&&e.constructor==={}.constructor;var VV=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",jV=e=>e&&typeof e[Symbol.asyncIterator]=="function";var Vu=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var ju=e=>typeof Blob<"u"&&e instanceof Blob,HV=e=>e&&typeof e=="object"&&e.isBuffer;var Tpt=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||VA(e)&&mv(e.tee)&&mv(e.cancel)&&mv(e.getReader);var Ept=e=>VA(e)&&mv(e.read)&&mv(e.pipe)&&wpt(e.readable),PE=e=>Tpt(e)||Ept(e);var IE=class extends Error{constructor(t,r){super(t),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var Mpt=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Spt=/^([-\w.]+\/[-\w.+]+)/;function YL(e,t){return e.toLowerCase()===t.toLowerCase()}function WV(e){let t=Spt.exec(e);return t?t[1]:e}function KL(e){let t=Mpt.exec(e);return t?t[1]:""}var qV=/\?.*/;function GV(e){let t=e.match(qV);return t&&t[0]}function __(e){return e.replace(qV,"")}function XV(e){if(e.length<50)return e;let t=e.slice(e.length-15);return`${e.substr(0,32)}...${t}`}function jA(e){return Vu(e)?e.url:ju(e)?e.name||"":typeof e=="string"?e:""}function Av(e){if(Vu(e)){let t=e,r=t.headers.get("content-type")||"",n=__(t.url);return WV(r)||KL(n)}return ju(e)?e.type||"":typeof e=="string"?KL(e):""}function YV(e){return Vu(e)?e.headers["content-length"]||-1:ju(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function RE(e){if(Vu(e))return e;let t={},r=YV(e);r>=0&&(t["content-length"]=String(r));let n=jA(e),i=Av(e);i&&(t["content-type"]=i);let o=await Ppt(e);o&&(t["x-first-bytes"]=o),typeof e=="string"&&(e=new TextEncoder().encode(e));let s=new Response(e,{headers:t});return Object.defineProperty(s,"url",{value:n}),s}async function KV(e){if(!e.ok)throw await Cpt(e)}async function Cpt(e){let t=XV(e.url),r=`Failed to fetch resource (${e.status}) ${e.statusText}: ${t}`;r=r.length>100?`${r.slice(0,100)}...`:r;let n={reason:e.statusText,url:e.url,response:e};try{let i=e.headers.get("Content-Type");n.reason=i?.includes("application/json")?await e.json():e.text()}catch{}return new IE(r,n)}async function Ppt(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(n=>{let i=new FileReader;i.onload=o=>n(o?.target?.result),i.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5);return`data:base64,${Ipt(r)}`}return null}function Ipt(e){let t="",r=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)t+=String.fromCharCode(r[n]);return btoa(t)}function Rpt(e){return!Lpt(e)&&!Opt(e)}function Lpt(e){return e.startsWith("http:")||e.startsWith("https:")}function Opt(e){return e.startsWith("data:")}async function y_(e,t){if(typeof e=="string"){let r=WL(e);return Rpt(r)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(r,t):await fetch(r,t)}return await RE(e)}var ZL=new Bl({id:"loaders.gl"}),LE=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},OE=class{console;constructor(){this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}};var $L={fetch:null,mimeType:void 0,nothrow:!1,log:new OE,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Dp,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},ZV={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function QL(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function JL(){let e=QL();return e.globalOptions=e.globalOptions||{...$L},e.globalOptions}function JV(e,t,r,n){return r=r||[],r=Array.isArray(r)?r:[r],Bpt(e,r),Npt(t,e,n)}function Bpt(e,t){$V(e,null,$L,ZV,t);for(let r of t){let n=e&&e[r.id]||{},i=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};$V(n,r.id,i,o,t)}}function $V(e,t,r,n,i){let o=t||"Top level",s=t?`${t}.`:"";for(let c in e){let l=!t&&VA(e[c]),h=c==="baseUri"&&!t,p=c==="workerUrl"&&t;if(!(c in r)&&!h&&!p){if(c in n)ZL.warn(`${o} loader option '${s}${c}' no longer supported, use '${n[c]}'`)();else if(!l){let x=Dpt(c,i);ZL.warn(`${o} loader option '${s}${c}' not recognized. ${x}`)()}}}}function Dpt(e,t){let r=e.toLowerCase(),n="";for(let i of t)for(let o in i.options){if(e===o)return`Did you mean '${i.id}.${o}'?`;let s=o.toLowerCase();(r.startsWith(s)||s.startsWith(r))&&(n=n||`Did you mean '${i.id}.${o}'?`)}return n}function Npt(e,t,r){let i={...e.options||{}};return kpt(i,r),i.log===null&&(i.log=new LE),QV(i,JL()),QV(i,t),i}function QV(e,t){for(let r in t)if(r in t){let n=t[r];XL(n)&&XL(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function kpt(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}function gv(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e?.extensions)):!1}function _v(e){Ti(e,"null loader"),Ti(gv(e),"invalid loader");let t;return Array.isArray(e)&&(t=e[1],e=e[0],e={...e,options:{...e.options,...t}}),(e?.parseTextSync||e?.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var t9=()=>{let e=QL();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function HA(e){let t=t9();e=Array.isArray(e)?e:[e];for(let r of e){let n=_v(r);t.find(i=>n===i)||t.unshift(n)}}function e9(){return t9()}var r9=new Bl({id:"loaders.gl"});var Fpt=/\.([^.]+)$/;async function o9(e,t=[],r,n){if(!s9(e))return null;let i=n9(e,t,{...r,nothrow:!0},n);if(i)return i;if(ju(e)&&(e=await e.slice(0,10).arrayBuffer(),i=n9(e,t,r,n)),!i&&!r?.nothrow)throw new Error(a9(e));return i}function n9(e,t=[],r,n){if(!s9(e))return null;if(t&&!Array.isArray(t))return _v(t);let i=[];t&&(i=i.concat(t)),r?.ignoreRegisteredLoaders||i.push(...e9()),Upt(i);let o=zpt(e,i,r,n);if(!o&&!r?.nothrow)throw new Error(a9(e));return o}function zpt(e,t,r,n){let i=jA(e),o=Av(e),s=__(i)||n?.url,c=null,l="";return r?.mimeType&&(c=tO(t,r?.mimeType),l=`match forced by supplied MIME type ${r?.mimeType}`),c=c||Vpt(t,s),l=l||(c?`matched url ${s}`:""),c=c||tO(t,o),l=l||(c?`matched MIME type ${o}`:""),c=c||Hpt(t,e),l=l||(c?`matched initial data ${c9(e)}`:""),r?.fallbackMimeType&&(c=c||tO(t,r?.fallbackMimeType),l=l||(c?`matched fallback MIME type ${o}`:"")),l&&r9.log(1,`selectLoader selected ${c?.name}: ${l}.`),c}function s9(e){return!(e instanceof Response&&e.status===204)}function a9(e){let t=jA(e),r=Av(e),n="No valid loader found (";n+=t?`${ou.filename(t)}, `:"no url provided, ",n+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let i=e?c9(e):"";return n+=i?` first bytes: "${i}"`:"first bytes: not available",n+=")",n}function Upt(e){for(let t of e)_v(t)}function Vpt(e,t){let r=t&&Fpt.exec(t),n=r&&r[1];return n?jpt(e,n):null}function jpt(e,t){t=t.toLowerCase();for(let r of e)for(let n of r.extensions)if(n.toLowerCase()===t)return r;return null}function tO(e,t){for(let r of e)if(r.mimeTypes?.some(n=>YL(t,n))||YL(t,`application/x.${r.id}`))return r;return null}function Hpt(e,t){if(!t)return null;for(let r of e)if(typeof t=="string"){if(Wpt(t,r))return r}else if(ArrayBuffer.isView(t)){if(i9(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&i9(t,0,r))return r;return null}function Wpt(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>e.startsWith(n))}function i9(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>qpt(e,t,r,i))}function qpt(e,t,r,n){if(n instanceof ArrayBuffer)return UL(n,e,n.byteLength);switch(typeof n){case"function":return n(e);case"string":let i=eO(e,t,n.length);return n===i;default:return!1}}function c9(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?eO(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?eO(e,0,t):""}function eO(e,t,r){if(e.byteLength<t+r)return"";let n=new DataView(e),i="";for(let o=0;o<r;o++)i+=String.fromCharCode(n.getUint8(t+o));return i}function*l9(e,t){let r=t?.chunkSize||262144,n=0,i=new TextEncoder;for(;n<e.length;){let o=Math.min(e.length-n,r),s=e.slice(n,n+o);n+=o,yield i.encode(s)}}function*u9(e,t={}){let{chunkSize:r=262144}=t,n=0;for(;n<e.byteLength;){let i=Math.min(e.byteLength-n,r),o=new ArrayBuffer(i),s=new Uint8Array(e,n,i);new Uint8Array(o).set(s),n+=i,yield o}}async function*h9(e,t){let r=t?.chunkSize||1048576,n=0;for(;n<e.size;){let i=n+r,o=await e.slice(n,i).arrayBuffer();n=i,yield o}}function rO(e,t){return Dp?Gpt(e,t):Xpt(e,t)}async function*Gpt(e,t){let r=e.getReader(),n;try{for(;;){let i=n||r.read();t?._streamReadAhead&&(n=r.read());let{done:o,value:s}=await i;if(o)return;yield SE(s)}}catch{r.releaseLock()}}async function*Xpt(e,t){for await(let r of e)yield SE(r)}function f9(e,t){if(typeof e=="string")return l9(e,t);if(e instanceof ArrayBuffer)return u9(e,t);if(ju(e))return h9(e,t);if(PE(e))return rO(e,t);if(Vu(e))return rO(e.body,t);throw new Error("makeIterator")}var p9="Cannot convert supplied data type";function Ypt(e,t,r){if(t.text&&typeof e=="string")return e;if(HV(e)&&(e=e.buffer),e instanceof ArrayBuffer){let n=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);let n=e.buffer,i=e.byteLength||e.length;return(e.byteOffset!==0||i!==n.byteLength)&&(n=n.slice(e.byteOffset,e.byteOffset+i)),n}throw new Error(p9)}async function d9(e,t,r){let n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||n)return Ypt(e,t,r);if(ju(e)&&(e=await RE(e)),Vu(e)){let i=e;return await KV(i),t.binary?await i.arrayBuffer():await i.text()}if(PE(e)&&(e=f9(e,r)),VV(e)||jV(e))return HL(e);throw new Error(p9)}function BE(e,t){let r=JL(),n=e||r;return typeof n.fetch=="function"?n.fetch:VA(n.fetch)?i=>y_(i,n.fetch):t?.fetch?t?.fetch:y_}function m9(e,t,r){if(r)return r;let n={fetch:BE(t,e),...e};if(n.url){let i=__(n.url);n.baseUrl=i,n.queryString=GV(n.url),n.filename=ou.filename(i),n.baseUrl=ou.dirname(i)}return Array.isArray(n.loaders)||(n.loaders=null),n}function A9(e,t){if(e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let n=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...n]:n}return r&&r.length?r:void 0}async function Qd(e,t,r,n){t&&!Array.isArray(t)&&!gv(t)&&(n=void 0,r=t,t=void 0),e=await e,r=r||{};let i=jA(e),s=A9(t,n),c=await o9(e,s,r);return c?(r=JV(r,c,s,i),n=m9({url:i,_parse:Qd,loaders:s},r,n||null),await Kpt(c,e,r,n)):null}async function Kpt(e,t,r,n){if(DL(e),r=av(e.options,r),Vu(t)){let o=t,{ok:s,redirected:c,status:l,statusText:h,type:p,url:x}=o,w=Object.fromEntries(o.headers.entries());n.response={headers:w,ok:s,redirected:c,status:l,statusText:h,type:p,url:x}}t=await d9(t,e,r);let i=e;if(i.parseTextSync&&typeof t=="string")return i.parseTextSync(t,r,n);if(kL(e,r))return await FL(e,t,r,n,Qd);if(i.parseText&&typeof t=="string")return await i.parseText(t,r,n);if(i.parse)return await i.parse(t,r,n);throw wc(!i.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}async function xa(e,t,r,n){let i,o;!Array.isArray(t)&&!gv(t)?(i=[],o=t,n=void 0):(i=t,o=r);let s=BE(o),c=e;return typeof e=="string"&&(c=await s(e)),ju(e)&&(c=await s(e)),Array.isArray(i)?await Qd(c,i,o):await Qd(c,i,o)}var nO=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new Nc({id:t})),this.stats.get(t)}},DE=new nO;var qe=new Bl({id:"luma.gl"});var iO={};function Jd(e="id"){iO[e]=iO[e]||1;let t=iO[e]++;return`${e}-${t}`}var ti=class{toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,r,n){if(!t)throw new Error("no device");this._device=t,this.props=Zpt(r,n);let i=this.props.id!=="undefined"?this.props.id:Jd(this[Symbol.toStringTag]);this.props.id=i,this.id=i,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];t.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(t,r=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(t),n.get(`${r} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${r}s Created`).incrementCount(),t.get(`${r}s Active`).incrementCount()}};Vr(ti,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Zpt(e,t){let r={...t};for(let n in e)e[n]!==void 0&&(r[n]=e[n]);return r}var yv=class extends ti{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,r){let n={...r};(r.usage||0)&yv.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?n.indexType="uint32":r.data instanceof Uint16Array&&(n.indexType="uint16")),delete n.data,super(t,n,yv.defaultProps),this.usage=n.usage||0,this.indexType=n.indexType,this.updateTimestamp=t.incrementTimestamp()}clone(t){return this.device.createBuffer({...this.props,...t})}readSyncWebGL(t,r){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,r,n){let i=ArrayBuffer.isView(t)?t.buffer:t,o=Math.min(t?t.byteLength:n,yv.DEBUG_DATA_MAX_LENGTH);i===null?this.debugData=new ArrayBuffer(o):r===0&&n===i.byteLength?this.debugData=i.slice(0,o):this.debugData=i.slice(r,r+o)}},Vn=yv;Vr(Vn,"defaultProps",{...ti.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),Vr(Vn,"MAP_READ",1),Vr(Vn,"MAP_WRITE",2),Vr(Vn,"COPY_SRC",4),Vr(Vn,"COPY_DST",8),Vr(Vn,"INDEX",16),Vr(Vn,"VERTEX",32),Vr(Vn,"UNIFORM",64),Vr(Vn,"STORAGE",128),Vr(Vn,"INDIRECT",256),Vr(Vn,"QUERY_RESOLVE",512),Vr(Vn,"DEBUG_DATA_MAX_LENGTH",32);function NE(e){let t=g9[e],r=$pt(t),n=e.includes("norm"),i=!n&&!e.startsWith("float"),o=e.startsWith("s");return{dataType:g9[e],byteLength:r,integer:i,signed:o,normalized:n}}function $pt(e){return Qpt[e]}var g9={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Qpt={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var kc="texture-compression-bc",Oo="texture-compression-astc",If="texture-compression-etc2",Jpt="texture-compression-etc1-webgl",kE="texture-compression-pvrtc-webgl",oO="texture-compression-atc-webgl",FE="float32-renderable-webgl",sO="float16-renderable-webgl",tdt="rgb9e5ufloat-renderable-webgl",aO="snorm8-renderable-webgl",xv="norm16-renderable-webgl",cO="snorm16-renderable-webgl",zE="float32-filterable",_9="float16-filterable-webgl";function UE(e){let t=edt[e];if(!t)throw new Error(`Unsupported texture format ${e}`);return t}var edt={r8unorm:{},r8snorm:{render:aO},r8uint:{},r8sint:{},rg8unorm:{},rg8snorm:{render:aO},rg8uint:{},rg8sint:{},r16uint:{},r16sint:{},r16float:{render:sO,filter:"float16-filterable-webgl"},"r16unorm-webgl":{f:xv},"r16snorm-webgl":{f:cO},"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},"rgb8unorm-webgl":{},"rgb8snorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},rgba8snorm:{render:aO},rgba8uint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{},rg16sint:{},rg16float:{render:sO,filter:_9},"rg16unorm-webgl":{render:xv},"rg16snorm-webgl":{render:cO},r32uint:{},r32sint:{},r32float:{render:FE,filter:zE},rgb9e5ufloat:{channels:"rgb",packed:!0,render:tdt},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:FE},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},"rgb10a2uint-webgl":{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1,wgpu:!1},"rgb16unorm-webgl":{f:xv},"rgb16snorm-webgl":{f:xv},rg32uint:{},rg32sint:{},rg32float:{render:!1,filter:zE},rgba16uint:{},rgba16sint:{},rgba16float:{render:sO,filter:_9},"rgba16unorm-webgl":{render:xv},"rgba16snorm-webgl":{render:cO},"rgb32float-webgl":{render:FE,filter:zE},rgba32uint:{},rgba32sint:{},rgba32float:{render:FE,filter:zE},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:kc},"bc1-rgb-unorm-srgb-webgl":{f:kc},"bc1-rgba-unorm":{f:kc},"bc1-rgba-unorm-srgb":{f:kc},"bc2-rgba-unorm":{f:kc},"bc2-rgba-unorm-srgb":{f:kc},"bc3-rgba-unorm":{f:kc},"bc3-rgba-unorm-srgb":{f:kc},"bc4-r-unorm":{f:kc},"bc4-r-snorm":{f:kc},"bc5-rg-unorm":{f:kc},"bc5-rg-snorm":{f:kc},"bc6h-rgb-ufloat":{f:kc},"bc6h-rgb-float":{f:kc},"bc7-rgba-unorm":{f:kc},"bc7-rgba-unorm-srgb":{f:kc},"etc2-rgb8unorm":{f:If},"etc2-rgb8unorm-srgb":{f:If},"etc2-rgb8a1unorm":{f:If},"etc2-rgb8a1unorm-srgb":{f:If},"etc2-rgba8unorm":{f:If},"etc2-rgba8unorm-srgb":{f:If},"eac-r11unorm":{f:If},"eac-r11snorm":{f:If},"eac-rg11unorm":{f:If},"eac-rg11snorm":{f:If},"astc-4x4-unorm":{f:Oo},"astc-4x4-unorm-srgb":{f:Oo},"astc-5x4-unorm":{f:Oo},"astc-5x4-unorm-srgb":{f:Oo},"astc-5x5-unorm":{f:Oo},"astc-5x5-unorm-srgb":{f:Oo},"astc-6x5-unorm":{f:Oo},"astc-6x5-unorm-srgb":{f:Oo},"astc-6x6-unorm":{f:Oo},"astc-6x6-unorm-srgb":{f:Oo},"astc-8x5-unorm":{f:Oo},"astc-8x5-unorm-srgb":{f:Oo},"astc-8x6-unorm":{f:Oo},"astc-8x6-unorm-srgb":{f:Oo},"astc-8x8-unorm":{f:Oo},"astc-8x8-unorm-srgb":{f:Oo},"astc-10x5-unorm":{f:Oo},"astc-10x5-unorm-srgb":{f:Oo},"astc-10x6-unorm":{f:Oo},"astc-10x6-unorm-srgb":{f:Oo},"astc-10x8-unorm":{f:Oo},"astc-10x8-unorm-srgb":{f:Oo},"astc-10x10-unorm":{f:Oo},"astc-10x10-unorm-srgb":{f:Oo},"astc-12x10-unorm":{f:Oo},"astc-12x10-unorm-srgb":{f:Oo},"astc-12x12-unorm":{f:Oo},"astc-12x12-unorm-srgb":{f:Oo},"pvrtc-rgb4unorm-webgl":{f:kE},"pvrtc-rgba4unorm-webgl":{f:kE},"pvrtc-rbg2unorm-webgl":{f:kE},"pvrtc-rgba2unorm-webgl":{f:kE},"etc1-rbg-unorm-webgl":{f:Jpt},"atc-rgb-unorm-webgl":{f:oO},"atc-rgba-unorm-webgl":{f:oO},"atc-rgbai-unorm-webgl":{f:oO}};var rdt=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],ndt=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/;function lO(e){return rdt.some(t=>e.startsWith(t))}function x_(e){let t=idt(e);if(lO(e)){t.channels="rgb",t.components=3,t.bytesPerPixel=1,t.srgb=!1,t.compressed=!0;let n=odt(e);n&&(t.blockWidth=n.blockWidth,t.blockHeight=n.blockHeight)}let r=ndt.exec(e);if(r){let[,n,i,o,s,c]=r,l=`${o}${i}`,h=NE(l),p=h.byteLength*8,x=n.length,w=[p,x>=2?p:0,x>=3?p:0,x>=4?p:0];t={format:e,attachment:t.attachment,dataType:h.dataType,components:x,channels:n,integer:h.integer,signed:h.signed,normalized:h.normalized,bitsPerChannel:w,bytesPerPixel:h.byteLength*n.length,packed:t.packed,srgb:t.srgb},c==="-webgl"&&(t.webgl=!0),s==="-srgb"&&(t.srgb=!0)}return e.endsWith("-webgl")&&(t.webgl=!0),e.endsWith("-srgb")&&(t.srgb=!0),t}function idt(e){let t=UE(e),r=t.bytesPerPixel||1,n=t.bitsPerChannel||[8,8,8,8];return delete t.bitsPerChannel,delete t.bytesPerPixel,delete t.f,delete t.render,delete t.filter,delete t.blend,delete t.store,{...t,format:e,attachment:t.attachment||"color",channels:t.channels||"r",components:t.components||t.channels?.length||1,bytesPerPixel:r,bitsPerChannel:n,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}}function odt(e){let r=/.*-(\d+)x(\d+)-.*/.exec(e);if(r){let[,n,i]=r;return{blockWidth:Number(n),blockHeight:Number(i)}}return null}function y9(e){let t=UE(e),r={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},n=x_(e),i=e.startsWith("depth")||e.startsWith("stencil"),o=n?.signed,s=n?.integer,c=n?.webgl;return r.render&&=!o,r.filter&&=!i&&!o&&!s&&!c,r}var vv=class{},bv=class{features;disabledFeatures;constructor(t=[],r){this.features=new Set(t),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures?.[t]&&this.features.has(t)}},uO=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...uO.defaultProps,...t},this.id=this.props.id||Jd(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=DE;timestamp=0;_lumaData={};getTextureFormatCapabilities(t){let r=y9(t),n=s=>(typeof s=="string"?this.features.has(s):s)??!0,i=n(r.create),o={format:t,create:i,render:i&&n(r.render),filter:i&&n(r.filter),blend:i&&n(r.blend),store:i&&n(r.store)};return this._getDeviceSpecificTextureFormatCapabilities(o)}isTextureFormatSupported(t,r){return this.getTextureFormatCapabilities(t).create}isTextureFormatFilterable(t){return this.getTextureFormatCapabilities(t).filter}isTextureFormatRenderable(t){return this.getTextureFormatCapabilities(t).render}isTextureFormatCompressed(t){return lO(t)}loseDevice(){return!1}reportError(t){this.props.onError(t)}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createCommandEncoder(t={}){throw new Error("not implemented")}incrementTimestamp(){return this.timestamp++}onError(t){this.props.onError(t)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(t,r){throw new Error("not implemented")}readPixelsToBufferWebGL(t,r){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,r){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}_normalizeBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let r={...t};return(t.usage||0)&Vn.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?r.indexType="uint32":t.data instanceof Uint16Array?r.indexType="uint16":qe.warn("indices buffer content must be of integer type")()),r}},Dl=uO;Vr(Dl,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,onError:t=>qe.error(t.message)(),_requestMaxLimits:!0,_factoryDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_resourceDefaults:{},webgl:{},debug:qe.get("debug")||void 0,debugShaders:qe.get("debug-shaders")||void 0,debugFramebuffers:Boolean(qe.get("debug-framebuffers")),debugWebGL:Boolean(qe.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_handle:void 0});var sdt=ul()&&typeof document<"u",adt=()=>sdt&&document.readyState==="complete",cdt="set luma.log.level=1 (or higher) to trace rendering",x9="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",v_=class{stats=DE;log=qe;VERSION="9.1.0";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw qe.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),qe.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");qe.error("This version of luma.gl has already been initialized")()}qe.log(1,`${this.VERSION} - ${cdt}`)(),globalThis.luma=this}registerAdapters(t){for(let r of t)this.preregisteredAdapters.set(r.type,r)}getSupportedAdapters(t=[]){let r=this.getAdapterMap(t);return Array.from(r).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapter(t=[]){let r=this.getAdapterMap(t);return r.get("webgpu")?.isSupported?.()?"webgpu":r.get("webgl")?.isSupported?.()?"webgl":null}setDefaultDeviceProps(t){Object.assign(v_.defaultProps,t)}async createDevice(t={}){t={...v_.defaultProps,...t},t.waitForPageLoad&&await v_.pageLoaded;let r=this.getAdapterMap(t.adapters),n=t.type||"";n==="best-available"&&(n=this.getBestAvailableAdapter(t.adapters)||n);let s=await(this.getAdapterMap(t.adapters)||r).get(n)?.create?.(t);if(s)return s;throw new Error(x9)}async attachDevice(t){let r=this.getAdapterMap(t.adapters),n="";t.handle instanceof WebGL2RenderingContext&&(n="webgl"),t.createCanvasContext&&await v_.pageLoaded,t.handle===null&&(n="unknown");let o=await r.get(n)?.attach?.(null);if(o)return o;throw new Error(x9)}enforceWebGL2(t=!0,r=[]){let i=this.getAdapterMap(r).get("webgl");i||qe.warn("enforceWebGL2: webgl adapter not found")(),i?.enforceWebGL2?.(t)}getAdapterMap(t=[]){let r=new Map(this.preregisteredAdapters);for(let n of t)r.set(n.type,n);return r}registerDevices(t){qe.warn("luma.registerDevices() is deprecated, use luma.registerAdapters() instead");for(let r of t){let n=r.adapter;n&&this.preregisteredAdapters.set(n.type,n)}}},wv=v_;Vr(wv,"defaultProps",{...Dl.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0}),Vr(wv,"pageLoaded",ldt().then(()=>{qe.probe(2,"DOM is loaded")()}));var Rf=new wv;function ldt(){return adt()||typeof window>"u"?Promise.resolve():new Promise(e=>{window.addEventListener("load",()=>e())})}var Tv=class{};var hO=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(t){if(this.props={...hO.defaultProps,...t},t=this.props,!ul()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(t.canvas)typeof t.canvas=="string"?this.canvas=hdt(t.canvas):this.canvas=t.canvas;else{let r=fdt(t),n=udt(t?.container||null);n.insertBefore(r,n.firstChild),this.canvas=r,t?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let n of r)n.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(t){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(t=t===void 0?this.props.useDevicePixels:t,!t||t<=0)?1:t===!0?typeof window<"u"&&window.devicePixelRatio||1:t}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let t=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*t,r.clientHeight*t]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[t,r]=this.getPixelSize();return t/r}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),r=this._canvasSizeInfo.clientWidth||this.htmlCanvas?.clientWidth;return r?t/r:1}catch{return 1}}cssToDevicePixels(t,r=!0){let n=this.cssToDeviceRatio(),[i,o]=this.getDrawingBufferSize();return pdt(t,n,i,o,r)}setDevicePixelRatio(t,r={}){if(!this.htmlCanvas)return;let n="width"in r?r.width:this.htmlCanvas.clientWidth,i="height"in r?r.height:this.htmlCanvas.clientHeight;(!n||!i)&&(qe.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,n=this.htmlCanvas.width||1,i=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==n||o.clientHeight!==i||o.devicePixelRatio!==t){let s=t,c=Math.floor(n*s),l=Math.floor(i*s);if(this.htmlCanvas.width=c,this.htmlCanvas.height=l,this.device.gl){let[p,x]=this.getDrawingBufferSize();(p!==c||x!==l)&&(s=Math.min(p/n,x/i),this.htmlCanvas.width=Math.floor(n*s),this.htmlCanvas.height=Math.floor(i*s),qe.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=i,this._canvasSizeInfo.devicePixelRatio=t}}}getDrawingBufferSize(){let t=this.device.gl;if(!t)throw new Error("canvas size");return[t.drawingBufferWidth,t.drawingBufferHeight]}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}},b_=hO;Vr(b_,"defaultProps",{canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb"});function udt(e){if(typeof e=="string"){let t=document.getElementById(e);if(!t)throw new Error(`${e} is not an HTML element`);return t}else if(e)return e;return document.body}function hdt(e){let t=document.getElementById(e);if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function fdt(e){let{width:t,height:r}=e,n=document.createElement("canvas");return n.id=Jd("lumagl-auto-created-canvas"),n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?`${t}px`:"100%",n.style.height=Number.isFinite(r)?`${r}px`:"100%",n}function pdt(e,t,r,n,i){let o=e,s=v9(o[0],t,r),c=b9(o[1],t,n,i),l=v9(o[0]+1,t,r),h=l===r-1?l:l-1;l=b9(o[1]+1,t,n,i);let p;return i?(l=l===0?l:l+1,p=c,c=l):p=l===n-1?l:l-1,{x:s,y:c,width:Math.max(h-s+1,1),height:Math.max(p-c+1,1)}}function v9(e,t,r){return Math.min(Math.round(e*t),r-1)}function b9(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}var Np=class extends ti{get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}dimension;format;width;height;depth;mipLevels;updateTimestamp;constructor(t,r){if(r=Np.normalizeProps(t,r),super(t,r,Np.defaultProps),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.props.width===void 0||this.props.height===void 0){let n=Np.getTextureDataSize(this.props.data);this.width=n?.width||1,this.height=n?.height||1}this.props.mipmaps&&this.props.mipLevels===void 0&&(this.props.mipLevels="pyramid"),this.mipLevels=this.props.mipLevels==="pyramid"?Np.getMipLevelCount(this.width,this.height):this.props.mipLevels||1,this.updateTimestamp=t.incrementTimestamp()}clone(t){return this.device.createTexture({...this.props,...t})}static isExternalImage(t){return typeof ImageData<"u"&&t instanceof ImageData||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement||typeof VideoFrame<"u"&&t instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas}static getExternalImageSize(t){if(typeof ImageData<"u"&&t instanceof ImageData||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height};if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement)return{width:t.naturalWidth,height:t.naturalHeight};if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)return{width:t.videoWidth,height:t.videoHeight};if(typeof VideoFrame<"u"&&t instanceof VideoFrame)return{width:t.displayWidth,height:t.displayHeight};throw new Error("Unknown image type")}static isTextureLevelData(t){let r=t?.data;return ArrayBuffer.isView(r)}static getTextureDataSize(t){if(!t||ArrayBuffer.isView(t))return null;if(Array.isArray(t))return Np.getTextureDataSize(t[0]);if(Np.isExternalImage(t))return Np.getExternalImageSize(t);if(t&&typeof t=="object"&&t.constructor===Object){let n=Object.values(t)[0];return{width:n.width,height:n.height}}throw new Error("texture size deduction failed")}static normalizeTextureData(t,r){let n;return ArrayBuffer.isView(t)?n=[{data:t,width:r.width,height:r.height}]:Array.isArray(t)?n=t:n=[t],n}static getMipLevelCount(t,r){return Math.floor(Math.log2(Math.max(t,r)))+1}static getCubeFaceDepth(t){switch(t){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(t)}}static normalizeProps(t,r){let n={...r},i=t?.props?._resourceDefaults?.texture||{};Object.assign(n,i);let{width:o,height:s}=n;return typeof o=="number"&&(n.width=Math.max(1,Math.ceil(o))),typeof s=="number"&&(n.height=Math.max(1,Math.ceil(s))),n}},fi=Np;Vr(fi,"COPY_SRC",1),Vr(fi,"COPY_DST",2),Vr(fi,"TEXTURE",4),Vr(fi,"STORAGE",8),Vr(fi,"RENDER_ATTACHMENT",16),Vr(fi,"CubeFaces",["+X","-X","+Y","-Y","+Z","-Z"]),Vr(fi,"defaultProps",{...ti.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!1,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,sampler:{},view:void 0,flipY:void 0}),Vr(fi,"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});var fO=class extends ti{get[Symbol.toStringTag](){return"TextureView"}constructor(t,r){super(t,r,fO.defaultProps)}},tm=fO;Vr(tm,"defaultProps",{...ti.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});function T9(e,t,r){let n="",i=t.split(/\r?\n/),o=e.slice().sort((s,c)=>s.lineNum-c.lineNum);switch(r?.showSourceCode||"no"){case"all":let s=0;for(let c=1;c<=i.length;c++)for(n+=E9(i[c-1],c,r);o.length>s&&o[s].lineNum===c;){let l=o[s++];n+=w9(l,i,l.lineNum,{...r,inlineSource:!1})}return n;case"issues":case"no":for(let c of e)n+=w9(c,i,c.lineNum,{inlineSource:r?.showSourceCode!=="no"});return n}}function w9(e,t,r,n){if(n?.inlineSource){let o=ddt(t,r),s=e.linePos>0?`${" ".repeat(e.linePos+5)}^^^
542
542
  `:"";return`
543
543
  ${o}${s}${e.type.toUpperCase()}: ${e.message}
544
544
 
@@ -548,7 +548,7 @@ ${o}${s}${e.type.toUpperCase()}: ${e.message}
548
548
  <code style="user-select:text;"><pre>
549
549
  ${i}
550
550
  </pre></code>`,s.style.top="10px",s.style.left="10px",s.style.position="absolute",s.style.zIndex="9999",s.style.width="100%",s.style.textAlign="left",document.body.appendChild(s),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),s.onclick=()=>{let l=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(l)}}},em=pO;Vr(em,"defaultProps",{...ti.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});function gdt(e){return M9(e.source)||e.id||Jd(`unnamed ${e.stage}-shader`)}function M9(e,t="unnamed"){let n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(e);return n?n[1]:t}var VE=class extends ti{get[Symbol.toStringTag](){return"Sampler"}constructor(t,r){r=VE.normalizeProps(t,r),super(t,r,VE.defaultProps)}static normalizeProps(t,r){let n=t?.props?._resourceDefaults?.sampler||{};return{...r,...n}}},rm=VE;Vr(rm,"defaultProps",{...ti.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});var dO=class extends ti{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(t,r={}){super(t,r,dO.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(t){let r=this.colorAttachments.map(i=>i.texture.clone(t)),n=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(t);return this.device.createFramebuffer({...this.props,colorAttachments:r,depthStencilAttachment:n})}resize(t){let r=!t;if(t){let[n,i]=Array.isArray(t)?t:[t.width,t.height];r=r||i!==this.height||n!==this.width,this.width=n,this.height=i}r&&(qe.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((r,n)=>{if(typeof r=="string"){let i=this.createColorTexture(r,n);return this.attachResource(i),i.view}return r instanceof fi?r.view:r});let t=this.props.depthStencilAttachment;if(t)if(typeof t=="string"){let r=this.createDepthStencilTexture(t);this.attachResource(r),this.depthStencilAttachment=r.view}else t instanceof fi?this.depthStencilAttachment=t.view:this.depthStencilAttachment=t}createColorTexture(t,r){return this.device.createTexture({id:`${this.id}-color-attachment-${r}`,usage:fi.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(t){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:fi.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(t,r){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let i=this.colorAttachments[n].texture.clone({width:t,height:r});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=i.view,this.attachResource(i.view)}if(this.depthStencilAttachment){let n=this.depthStencilAttachment.texture.clone({width:t,height:r});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}this.updateAttachments()}},Lf=dO;Vr(Lf,"defaultProps",{...ti.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var mO=class extends ti{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(t,r){super(t,r,mO.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(t){throw new Error("Use uniform blocks")}},Eh=mO;Vr(Eh,"defaultProps",{...ti.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var WA=class extends ti{get[Symbol.toStringTag](){return"RenderPass"}constructor(t,r){r=WA.normalizeProps(t,r),super(t,r,WA.defaultProps)}static normalizeProps(t,r){return{...t.props._resourceDefaults?.renderPass,...r}}},kp=WA;Vr(kp,"defaultClearColor",[0,0,0,1]),Vr(kp,"defaultClearDepth",1),Vr(kp,"defaultClearStencil",0),Vr(kp,"defaultProps",{...ti.defaultProps,framebuffer:null,parameters:void 0,clearColor:WA.defaultClearColor,clearColors:void 0,clearDepth:WA.defaultClearDepth,clearStencil:WA.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var AO=class extends ti{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(t,r){super(t,r,AO.defaultProps),this.shaderLayout=r.shaderLayout}},qA=AO;Vr(qA,"defaultProps",{...ti.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var gO=class extends ti{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(t,r){super(t,r,gO.defaultProps)}},w_=gO;Vr(w_,"defaultProps",{...ti.defaultProps,measureExecutionTime:void 0});var _O=class extends ti{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(t,r){super(t,r,_O.defaultProps)}},T_=_O;Vr(T_,"defaultProps",{...ti.defaultProps});function S9(e){let[t,r]=ydt[e],n=t==="i32"||t==="u32",i=t!=="u32",o=xdt[t]*r,s=_dt(t,r);return{dataType:t,components:r,defaultVertexFormat:s,byteLength:o,integer:n,signed:i}}function _dt(e,t){let r;switch(e){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?r:`${r}x${t}`}var ydt={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},xdt={f32:4,f16:2,i32:4,u32:4};function yO(e){let t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);let[r,n]=e.split("x"),i=r,o=n?parseInt(n):1,s=NE(i),c={type:i,components:o,byteLength:s.byteLength*o,integer:s.integer,signed:s.signed,normalized:s.normalized};return t&&(c.webglOnly=!0),c}function jE(e,t){let r={};for(let n of e.attributes){let i=vdt(e,t,n.name);i&&(r[n.name]=i)}return r}function C9(e,t,r=16){let n=jE(e,t),i=new Array(r).fill(null);for(let o of Object.values(n))i[o.location]=o;return i}function vdt(e,t,r){let n=bdt(e,r),i=wdt(t,r);if(!n)return null;let o=S9(n.type),s=i?.vertexFormat||o.defaultVertexFormat,c=yO(s);return{attributeName:i?.attributeName||n.name,bufferName:i?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:s,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:o.integer,stepMode:i?.stepMode||n.stepMode||"vertex",byteOffset:i?.byteOffset||0,byteStride:i?.byteStride||0}}function bdt(e,t){let r=e.attributes.find(n=>n.name===t);return r||qe.warn(`shader layout attribute "${t}" not present in shader`),r||null}function wdt(e,t){Tdt(e);let r=Edt(e,t);return r||(r=Mdt(e,t),r)?r:(qe.warn(`layout for attribute "${t}" not present in buffer layout`),null)}function Tdt(e){for(let t of e)(t.attributes&&t.format||!t.attributes&&!t.format)&&qe.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Edt(e,t){for(let r of e)if(r.format&&r.name===t)return{attributeName:r.name,bufferName:t,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}function Mdt(e,t){for(let r of e){let n=r.byteStride;if(typeof r.byteStride!="number")for(let o of r.attributes||[]){let s=yO(o.format);n+=s.byteLength}let i=r.attributes?.find(o=>o.attribute===t);if(i)return{attributeName:i.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:i.format,byteOffset:i.byteOffset,byteStride:n}}return null}var xO=class extends ti{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(t,r){super(t,r,xO.defaultProps),this.maxVertexAttributes=t.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null);let{shaderLayout:n,bufferLayout:i}=r.renderPipeline||{};if(!n||!i)throw new Error("VertexArray");this.attributeInfos=C9(n,i,this.maxVertexAttributes)}setConstantWebGL(t,r){throw new Error("constant attributes not supported")}},E_=xO;Vr(E_,"defaultProps",{...ti.defaultProps,renderPipeline:null});var vO=class extends ti{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(t,r){super(t,r,vO.defaultProps)}},M_=vO;Vr(M_,"defaultProps",{...ti.defaultProps,layout:void 0,buffers:{}});var bO=class extends ti{get[Symbol.toStringTag](){return"QuerySet"}constructor(t,r){super(t,r,bO.defaultProps)}},S_=bO;Vr(S_,"defaultProps",{...ti.defaultProps,type:void 0,count:void 0});var Sdt={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function P9(e){return Sdt[e]}function I9(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}var HE;function wO(e){return(!HE||HE.byteLength<e)&&(HE=new ArrayBuffer(e)),HE}function TO(e,t){let r=wO(e.BYTES_PER_ELEMENT*t);return new e(r,0,t)}function Cdt(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function C_(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number":Cdt(e)}var R9=1024,WE=class{layout={};byteLength;constructor(t){let r=0;for(let[i,o]of Object.entries(t)){let s=P9(o),{type:c,components:l}=s;r=I9(r,l);let h=r;r+=l,this.layout[i]={type:c,size:l,offset:h}}r+=(4-r%4)%4;let n=r*4;this.byteLength=Math.max(n,R9)}getData(t){let r=Math.max(this.byteLength,R9),n=wO(r),i={i32:new Int32Array(n),u32:new Uint32Array(n),f32:new Float32Array(n),f16:new Uint16Array(n)};for(let[o,s]of Object.entries(t)){let c=this.layout[o];if(!c){qe.warn(`Supplied uniform value ${o} not present in uniform block layout`)();continue}let{type:l,size:h,offset:p}=c,x=i[l];if(h===1){if(typeof s!="number"&&typeof s!="boolean"){qe.warn(`Supplied value for single component uniform ${o} is not a number: ${s}`)();continue}x[p]=Number(s)}else{if(!C_(s)){qe.warn(`Supplied value for multi component / array uniform ${o} is not a numeric array: ${s}`)();continue}x.set(s,p)}}return new Uint8Array(n)}has(t){return Boolean(this.layout[t])}get(t){return this.layout[t]}};function L9(e,t,r=16){if(e!==t)return!1;let n=e,i=t;if(!C_(n))return!1;if(C_(i)&&n.length===i.length){for(let o=0;o<n.length;++o)if(i[o]!==n[o])return!1}return!0}function O9(e){return C_(e)?e.slice():e}var qE=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(t){if(this.name=t?.name||"unnamed",t?.name&&t?.shaderLayout){let r=t?.shaderLayout.bindings?.find(i=>i.type==="uniform"&&i.name===t?.name);if(!r)throw new Error(t?.name);let n=r;for(let i of n.uniforms||[])this.bindingLayout[i.name]=i}}setUniforms(t){for(let[r,n]of Object.entries(t))this._setUniform(r,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${r}=${n}`)}setNeedsRedraw(t){this.needsRedraw=this.needsRedraw||t}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(t,r){L9(this.uniforms[t],r)||(this.uniforms[t]=O9(r),this.modifiedUniforms[t]=!0,this.modified=!0)}};var Ev=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(t){for(let[r,n]of Object.entries(t)){let i=r,o=new WE(n.uniformTypes||{});this.uniformBufferLayouts.set(i,o);let s=new qE({name:r});s.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(i,s)}}destroy(){for(let t of this.uniformBuffers.values())t.destroy()}setUniforms(t){for(let[r,n]of Object.entries(t))this.uniformBlocks.get(r)?.setUniforms(n);this.updateUniformBuffers()}getUniformBufferByteLength(t){return this.uniformBufferLayouts.get(t)?.byteLength||0}getUniformBufferData(t){let r=this.uniformBlocks.get(t)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(t)?.getData(r)}createUniformBuffer(t,r,n){n&&this.setUniforms(n);let i=this.getUniformBufferByteLength(r),o=t.createBuffer({usage:Vn.UNIFORM|Vn.COPY_DST,byteLength:i}),s=this.getUniformBufferData(r);return o.write(s),o}getManagedUniformBuffer(t,r){if(!this.uniformBuffers.get(r)){let n=this.getUniformBufferByteLength(r),i=t.createBuffer({usage:Vn.UNIFORM|Vn.COPY_DST,byteLength:n});this.uniformBuffers.set(r,i)}return this.uniformBuffers.get(r)}updateUniformBuffers(){let t=!1;for(let r of this.uniformBlocks.keys()){let n=this.updateUniformBuffer(r);t||=n}return t&&qe.log(3,`UniformStore.updateUniformBuffers(): ${t}`)(),t}updateUniformBuffer(t){let r=this.uniformBlocks.get(t),n=this.uniformBuffers.get(t),i=!1;if(n&&r?.needsRedraw){i||=r.needsRedraw;let o=this.getUniformBufferData(t);n=this.uniformBuffers.get(t),n?.write(o);let s=this.uniformBlocks.get(t)?.getAllUniforms();qe.log(4,`Writing to uniform buffer ${String(t)}`,o,s)()}return i}};function GE(e){let t=ArrayBuffer.isView(e)?e.constructor:e;switch(t){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(t.constructor.name)}}function Mv(e){switch(e){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(e)}}function EO(e,t,r){if(!t||t>4)throw new Error(`size ${t}`);let n=t,i=GE(e);if(i==="uint8"&&r&&n===1)return"unorm8-webgl";if(i==="uint8"&&r&&n===3)return"unorm8x3-webgl";if(i==="uint8"||i==="sint8"){if(n===1||n===3)throw new Error(`size: ${t}`);return r&&(i=i.replace("int","norm")),`${i}x${n}`}if(i==="uint16"||i==="sint16"){if(n===1||n===3)throw new Error(`size: ${t}`);return r&&(i=i.replace("int","norm")),`${i}x${n}`}return n===1?i:`${i}x${n}`}var GA=class{bufferLayouts;constructor(t){this.bufferLayouts=t}getBufferLayout(t){return this.bufferLayouts.find(r=>r.name===t)||null}getAttributeNamesForBuffer(t){return t.attributes?t.attributes?.map(r=>r.attribute):[t.name]}mergeBufferLayouts(t,r){let n=[...t];for(let i of r){let o=n.findIndex(s=>s.name===i.name);o<0?n.push(i):n[o]=i}return n}};var Of;(function(e){e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e[e.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",e[e.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",e[e.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",e[e.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",e[e.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",e[e.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",e[e.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",e[e.LINE_WEBGL=6913]="LINE_WEBGL",e[e.FILL_WEBGL=6914]="FILL_WEBGL",e[e.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",e[e.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",e[e.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",e[e.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",e[e.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",e[e.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",e[e.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",e[e.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",e[e.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",e[e.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",e[e.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",e[e.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",e[e.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",e[e.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",e[e.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",e[e.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",e[e.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",e[e.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",e[e.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",e[e.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",e[e.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",e[e.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",e[e.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",e[e.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(Of||(Of={}));var Cv={[3042]:!1,[32773]:new Float32Array([0,0,0,0]),[32777]:32774,[34877]:32774,[32969]:1,[32968]:0,[32971]:1,[32970]:0,[3106]:new Float32Array([0,0,0,0]),[3107]:[!0,!0,!0,!0],[2884]:!1,[2885]:1029,[2929]:!1,[2931]:1,[2932]:513,[2928]:new Float32Array([0,1]),[2930]:!0,[3024]:!0,[35725]:null,[36006]:null,[36007]:null,[34229]:null,[34964]:null,[2886]:2305,[33170]:4352,[2849]:1,[32823]:!1,[32824]:0,[10752]:0,[32926]:!1,[32928]:!1,[32938]:1,[32939]:!1,[3089]:!1,[3088]:new Int32Array([0,0,1024,1024]),[2960]:!1,[2961]:0,[2968]:4294967295,[36005]:4294967295,[2962]:519,[2967]:0,[2963]:4294967295,[34816]:519,[36003]:0,[36004]:4294967295,[2964]:7680,[2965]:7680,[2966]:7680,[34817]:7680,[34818]:7680,[34819]:7680,[2978]:[0,0,1024,1024],[36389]:null,[36662]:null,[36663]:null,[35053]:null,[35055]:null,[35723]:4352,[36010]:null,[35977]:!1,[3333]:4,[3317]:4,[37440]:!1,[37441]:!1,[37443]:37444,[3330]:0,[3332]:0,[3331]:0,[3314]:0,[32878]:0,[3316]:0,[3315]:0,[32877]:0},va=(e,t,r)=>t?e.enable(r):e.disable(r),B9=(e,t,r)=>e.hint(r,t),su=(e,t,r)=>e.pixelStorei(r,t),D9=(e,t,r)=>{let n=r===36006?36009:36008;return e.bindFramebuffer(n,t)},Sv=(e,t,r)=>{let i={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];e.bindBuffer(i,t)};function MO(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}var N9={[3042]:va,[32773]:(e,t)=>e.blendColor(...t),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(e,t)=>e.clearColor(...t),[3107]:(e,t)=>e.colorMask(...t),[2884]:va,[2885]:(e,t)=>e.cullFace(t),[2929]:va,[2931]:(e,t)=>e.clearDepth(t),[2932]:(e,t)=>e.depthFunc(t),[2928]:(e,t)=>e.depthRange(...t),[2930]:(e,t)=>e.depthMask(t),[3024]:va,[35723]:B9,[35725]:(e,t)=>e.useProgram(t),[36007]:(e,t)=>e.bindRenderbuffer(36161,t),[36389]:(e,t)=>e.bindTransformFeedback?.(36386,t),[34229]:(e,t)=>e.bindVertexArray(t),[36006]:D9,[36010]:D9,[34964]:Sv,[36662]:Sv,[36663]:Sv,[35053]:Sv,[35055]:Sv,[2886]:(e,t)=>e.frontFace(t),[33170]:B9,[2849]:(e,t)=>e.lineWidth(t),[32823]:va,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:va,[32926]:va,[32928]:va,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:va,[3088]:(e,t)=>e.scissor(...t),[2960]:va,[2961]:(e,t)=>e.clearStencil(t),[2968]:(e,t)=>e.stencilMaskSeparate(1028,t),[36005]:(e,t)=>e.stencilMaskSeparate(1029,t),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(e,t)=>e.viewport(...t),[34383]:va,[10754]:va,[12288]:va,[12289]:va,[12290]:va,[12291]:va,[12292]:va,[12293]:va,[12294]:va,[12295]:va,[3333]:su,[3317]:su,[37440]:su,[37441]:su,[37443]:su,[3330]:su,[3332]:su,[3331]:su,[3314]:su,[32878]:su,[3316]:su,[3315]:su,[32877]:su,framebuffer:(e,t)=>{let r=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,r)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{let r=typeof t=="number"?[t,t]:t;e.blendEquationSeparate(...r)},blendFunc:(e,t)=>{let r=t?.length===2?[...t,...t]:t;e.blendFuncSeparate(...r)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(t[0],t[1]||!1),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{t=MO(t)?t:[t,t];let[r,n]=t;e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,n)},stencilFunc:(e,t)=>{t=MO(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,s,c]=t;e.stencilFuncSeparate(1028,r,n,i),e.stencilFuncSeparate(1029,o,s,c)},stencilOp:(e,t)=>{t=MO(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,s,c]=t;e.stencilOpSeparate(1028,r,n,i),e.stencilOpSeparate(1029,o,s,c)},viewport:(e,t)=>e.viewport(...t)};function Ws(e,t,r){return t[e]!==void 0?t[e]:r[e]}var k9={blendEquation:(e,t,r)=>e.blendEquationSeparate(Ws(32777,t,r),Ws(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(Ws(32969,t,r),Ws(32968,t,r),Ws(32971,t,r),Ws(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(Ws(32824,t,r),Ws(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(Ws(32938,t,r),Ws(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,Ws(2962,t,r),Ws(2967,t,r),Ws(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,Ws(34816,t,r),Ws(36003,t,r),Ws(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,Ws(2964,t,r),Ws(2965,t,r),Ws(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,Ws(34817,t,r),Ws(34818,t,r),Ws(34819,t,r))},SO={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),useProgram:(e,t)=>e({[35725]:t}),bindRenderbuffer:(e,t,r)=>e({[36007]:r}),bindTransformFeedback:(e,t,r)=>e({[36389]:r}),bindVertexArray:(e,t)=>e({[34229]:t}),bindFramebuffer:(e,t,r)=>{switch(t){case 36160:return e({[36006]:r,[36010]:r});case 36009:return e({[36006]:r});case 36008:return e({[36010]:r});default:return null}},bindBuffer:(e,t,r)=>{let n={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[t];return n?e({[n]:r}):{valueChanged:!0}},blendColor:(e,t,r,n,i)=>e({[32773]:new Float32Array([t,r,n,i])}),blendEquation:(e,t)=>e({[32777]:t,[34877]:t}),blendEquationSeparate:(e,t,r)=>e({[32777]:t,[34877]:r}),blendFunc:(e,t,r)=>e({[32969]:t,[32968]:r,[32971]:t,[32970]:r}),blendFuncSeparate:(e,t,r,n,i)=>e({[32969]:t,[32968]:r,[32971]:n,[32970]:i}),clearColor:(e,t,r,n,i)=>e({[3106]:new Float32Array([t,r,n,i])}),clearDepth:(e,t)=>e({[2931]:t}),clearStencil:(e,t)=>e({[2961]:t}),colorMask:(e,t,r,n,i)=>e({[3107]:[t,r,n,i]}),cullFace:(e,t)=>e({[2885]:t}),depthFunc:(e,t)=>e({[2932]:t}),depthRange:(e,t,r)=>e({[2928]:new Float32Array([t,r])}),depthMask:(e,t)=>e({[2930]:t}),frontFace:(e,t)=>e({[2886]:t}),lineWidth:(e,t)=>e({[2849]:t}),polygonOffset:(e,t,r)=>e({[32824]:t,[10752]:r}),sampleCoverage:(e,t,r)=>e({[32938]:t,[32939]:r}),scissor:(e,t,r,n,i)=>e({[3088]:new Int32Array([t,r,n,i])}),stencilMask:(e,t)=>e({[2968]:t,[36005]:t}),stencilMaskSeparate:(e,t,r)=>e({[t===1028?2968:36005]:r}),stencilFunc:(e,t,r,n)=>e({[2962]:t,[2967]:r,[2963]:n,[34816]:t,[36003]:r,[36004]:n}),stencilFuncSeparate:(e,t,r,n,i)=>e({[t===1028?2962:34816]:r,[t===1028?2967:36003]:n,[t===1028?2963:36004]:i}),stencilOp:(e,t,r,n)=>e({[2964]:t,[2965]:r,[2966]:n,[34817]:t,[34818]:r,[34819]:n}),stencilOpSeparate:(e,t,r,n,i)=>e({[t===1028?2964:34817]:r,[t===1028?2965:34818]:n,[t===1028?2966:34819]:i}),viewport:(e,t,r,n,i)=>e({[2978]:[t,r,n,i]})},Bf=(e,t)=>e.isEnabled(t),CO={[3042]:Bf,[2884]:Bf,[2929]:Bf,[3024]:Bf,[32823]:Bf,[32926]:Bf,[32928]:Bf,[3089]:Bf,[2960]:Bf,[35977]:Bf},F9=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function Mh(e,t){if(Pdt(t))return;let r={};for(let i in t){let o=Number(i),s=N9[i];s&&(typeof s=="string"?r[s]=!0:s(e,t[i],o))}let n=e.state&&e.state.cache;if(n)for(let i in r){let o=k9[i];o(e,t,n)}}function XE(e,t=Cv){if(typeof t=="number"){let i=t,o=CO[i];return o?o(e,i):e.getParameter(i)}let r=Array.isArray(t)?t:Object.keys(t),n={};for(let i of r){let o=CO[i];n[i]=o?o(e,Number(i)):e.getParameter(Number(i))}return n}function z9(e){Mh(e,Cv)}function Pdt(e){for(let t in e)return!1;return!0}function U9(e,t){if(e===t)return!0;let r=Array.isArray(e)||ArrayBuffer.isView(e),n=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&n&&e.length===t.length){for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}return!1}var Sh=class{static get(t){return t.state}gl;program=null;stateStack=[];enable=!0;cache=null;log;initialized=!1;constructor(t,r){this.gl=t,this.log=r?.log||(()=>{}),this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(t={}){this.stateStack.push({})}pop(){let t=this.stateStack[this.stateStack.length-1];Mh(this.gl,t),this.stateStack.pop()}trackState(t,r){if(this.cache=r.copyState?XE(t):Object.assign({},Cv),this.initialized)throw new Error("WebGLStateTracker");this.initialized=!0,this.gl.state=this,Rdt(t);for(let n in SO){let i=SO[n];Idt(t,n,i)}V9(t,"getParameter"),V9(t,"isEnabled")}_updateCache(t){let r=!1,n,i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in t){let s=t[o],c=this.cache[o];U9(s,c)||(r=!0,n=c,i&&!(o in i)&&(i[o]=c),this.cache[o]=s)}return{valueChanged:r,oldValue:n}}};function V9(e,t){let r=e[t].bind(e);e[t]=function(i){if(i===void 0||F9.has(i))return r(i);let o=Sh.get(e);return i in o.cache||(o.cache[i]=r(i)),o.enable?o.cache[i]:r(i)},Object.defineProperty(e[t],"name",{value:`${t}-from-cache`,configurable:!1})}function Idt(e,t,r){if(!e[t])return;let n=e[t].bind(e);e[t]=function(...o){let s=Sh.get(e),{valueChanged:c,oldValue:l}=r(s._updateCache,...o);return c&&n(...o),l},Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}function Rdt(e){let t=e.useProgram.bind(e);e.useProgram=function(n){let i=Sh.get(e);i.program!==n&&(t(n),i.program=n)}}function j9(e,t,r){let n="",i={preserveDrawingBuffer:!0,...r},o=null;if(o||=e.getContext("webgl2",i),i.failIfMajorPerformanceCaveat&&(n||="Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow."),!o&&!r.failIfMajorPerformanceCaveat&&(i.failIfMajorPerformanceCaveat=!1,o=e.getContext("webgl2",i),o.luma||={},o.luma.softwareRenderer=!0),o||(o=e.getContext("webgl",{}),o&&(o=null,n||="Your browser only supports WebGL1")),!o)throw n||="Your browser does not support WebGL",new Error(`Failed to create WebGL context: ${n}`);let{onContextLost:s,onContextRestored:c}=t;return e.addEventListener("webglcontextlost",l=>s(l),!1),e.addEventListener("webglcontextrestored",l=>c(l),!1),o.luma||={},o}function Df(e,t,r){return r[t]===void 0&&(r[t]=e.getExtension(t)||null),r[t]}function H9(e,t){let r=e.getParameter(7936),n=e.getParameter(7937);Df(e,"WEBGL_debug_renderer_info",t);let i=t.WEBGL_debug_renderer_info,o=e.getParameter(i?i.UNMASKED_VENDOR_WEBGL:7936),s=e.getParameter(i?i.UNMASKED_RENDERER_WEBGL:7937),c=o||r,l=s||n,h=e.getParameter(7938),p=W9(c,l),x=Ldt(c,l),w=Odt(c,l);return{type:"webgl",gpu:p,gpuType:w,gpuBackend:x,vendor:c,renderer:l,version:h,shadingLanguage:"glsl",shadingLanguageVersion:300}}function W9(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}function Ldt(e,t){return/Metal/i.exec(e)||/Metal/i.exec(t)?"metal":/ANGLE/i.exec(e)||/ANGLE/i.exec(t)?"opengl":"unknown"}function Odt(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(W9(e,t)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function YE(e){switch(e){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(e))}var Pv="WEBGL_compressed_texture_s3tc",Iv="WEBGL_compressed_texture_s3tc_srgb",P_="EXT_texture_compression_rgtc",I_="EXT_texture_compression_bptc",Bdt="WEBGL_compressed_texture_etc",Ddt="WEBGL_compressed_texture_astc",Ndt="WEBGL_compressed_texture_etc1",kdt="WEBGL_compressed_texture_pvrtc",Fdt="WEBGL_compressed_texture_atc",q9="EXT_texture_norm16",G9="EXT_render_snorm",zdt="EXT_color_buffer_float",KE={"float32-renderable-webgl":["EXT_color_buffer_float"],"float16-renderable-webgl":["EXT_color_buffer_half_float"],"rgb9e5ufloat-renderable-webgl":["WEBGL_render_shared_exponent"],"snorm8-renderable-webgl":[G9],"norm16-renderable-webgl":[q9],"snorm16-renderable-webgl":[q9,G9],"float32-filterable":["OES_texture_float_linear"],"float16-filterable-webgl":["OES_texture_half_float_linear"],"texture-filterable-anisotropic-webgl":["EXT_texture_filter_anisotropic"],"texture-blend-float-webgl":["EXT_float_blend"],"texture-compression-bc":[Pv,Iv,P_,I_],"texture-compression-bc5-webgl":[P_],"texture-compression-bc7-webgl":[I_],"texture-compression-etc2":[Bdt],"texture-compression-astc":[Ddt],"texture-compression-etc1-webgl":[Ndt],"texture-compression-pvrtc-webgl":[kdt],"texture-compression-atc-webgl":[Fdt]};function X9(e){return e in KE}function Y9(e,t,r){return(KE[t]||[]).every(i=>Df(e,i,r))}var PO={r8unorm:{gl:33321,rb:!0},r8snorm:{gl:36756},r8uint:{gl:33330,rb:!0},r8sint:{gl:33329,rb:!0},rg8unorm:{gl:33323,rb:!0},rg8snorm:{gl:36757},rg8uint:{gl:33336,rb:!0},rg8sint:{gl:33335,rb:!0},r16uint:{gl:33332,rb:!0},r16sint:{gl:33331,rb:!0},r16float:{gl:33325,rb:!0},"r16unorm-webgl":{gl:33322,rb:!0},"r16snorm-webgl":{gl:36760},"rgba4unorm-webgl":{gl:32854,rb:!0},"rgb565unorm-webgl":{gl:36194,rb:!0},"rgb5a1unorm-webgl":{gl:32855,rb:!0},"rgb8unorm-webgl":{gl:32849},"rgb8snorm-webgl":{gl:36758},rgba8unorm:{gl:32856},"rgba8unorm-srgb":{gl:35907},rgba8snorm:{gl:36759},rgba8uint:{gl:36220},rgba8sint:{gl:36238},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{gl:33338},rg16sint:{gl:33337},rg16float:{gl:33327,rb:!0},"rg16unorm-webgl":{gl:33324},"rg16snorm-webgl":{gl:36761},r32uint:{gl:33334,rb:!0},r32sint:{gl:33333,rb:!0},r32float:{gl:33326},rgb9e5ufloat:{gl:35901},rg11b10ufloat:{gl:35898,rb:!0},rgb10a2unorm:{gl:32857,rb:!0},"rgb10a2uint-webgl":{gl:36975,rb:!0},"rgb16unorm-webgl":{gl:32852},"rgb16snorm-webgl":{gl:36762},rg32uint:{gl:33340,rb:!0},rg32sint:{gl:33339,rb:!0},rg32float:{gl:33328,rb:!0},rgba16uint:{gl:36214,rb:!0},rgba16sint:{gl:36232,rb:!0},rgba16float:{gl:34842},"rgba16unorm-webgl":{gl:32859,rb:!0},"rgba16snorm-webgl":{gl:36763},"rgb32float-webgl":{gl:34837,x:zdt,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,rb:!0},rgba32sint:{gl:36226,rb:!0},rgba32float:{gl:34836,rb:!0},stencil8:{gl:36168,rb:!0},depth16unorm:{gl:33189,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,dataFormat:6402,types:[5125]},depth32float:{gl:36012,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth32float-stencil8":{gl:36013,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:Pv},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:Iv},"bc1-rgba-unorm":{gl:33777,x:Pv},"bc1-rgba-unorm-srgb":{gl:35916,x:Iv},"bc2-rgba-unorm":{gl:33778,x:Pv},"bc2-rgba-unorm-srgb":{gl:35918,x:Iv},"bc3-rgba-unorm":{gl:33779,x:Pv},"bc3-rgba-unorm-srgb":{gl:35919,x:Iv},"bc4-r-unorm":{gl:36283,x:P_},"bc4-r-snorm":{gl:36284,x:P_},"bc5-rg-unorm":{gl:36285,x:P_},"bc5-rg-snorm":{gl:36286,x:P_},"bc6h-rgb-ufloat":{gl:36495,x:I_},"bc6h-rgb-float":{gl:36494,x:I_},"bc7-rgba-unorm":{gl:36492,x:I_},"bc7-rgba-unorm-srgb":{gl:36493,x:I_},"etc2-rgb8unorm":{gl:37492},"etc2-rgb8unorm-srgb":{gl:37494},"etc2-rgb8a1unorm":{gl:37496},"etc2-rgb8a1unorm-srgb":{gl:37497},"etc2-rgba8unorm":{gl:37493},"etc2-rgba8unorm-srgb":{gl:37495},"eac-r11unorm":{gl:37488},"eac-r11snorm":{gl:37489},"eac-rg11unorm":{gl:37490},"eac-rg11snorm":{gl:37491},"astc-4x4-unorm":{gl:37808},"astc-4x4-unorm-srgb":{gl:37840},"astc-5x4-unorm":{gl:37809},"astc-5x4-unorm-srgb":{gl:37841},"astc-5x5-unorm":{gl:37810},"astc-5x5-unorm-srgb":{gl:37842},"astc-6x5-unorm":{gl:37811},"astc-6x5-unorm-srgb":{gl:37843},"astc-6x6-unorm":{gl:37812},"astc-6x6-unorm-srgb":{gl:37844},"astc-8x5-unorm":{gl:37813},"astc-8x5-unorm-srgb":{gl:37845},"astc-8x6-unorm":{gl:37814},"astc-8x6-unorm-srgb":{gl:37846},"astc-8x8-unorm":{gl:37815},"astc-8x8-unorm-srgb":{gl:37847},"astc-10x5-unorm":{gl:37819},"astc-10x5-unorm-srgb":{gl:37851},"astc-10x6-unorm":{gl:37817},"astc-10x6-unorm-srgb":{gl:37849},"astc-10x8-unorm":{gl:37818},"astc-10x8-unorm-srgb":{gl:37850},"astc-10x10-unorm":{gl:37819},"astc-10x10-unorm-srgb":{gl:37851},"astc-12x10-unorm":{gl:37820},"astc-12x10-unorm-srgb":{gl:37852},"astc-12x12-unorm":{gl:37821},"astc-12x12-unorm-srgb":{gl:37853},"pvrtc-rgb4unorm-webgl":{gl:35840},"pvrtc-rgba4unorm-webgl":{gl:35842},"pvrtc-rbg2unorm-webgl":{gl:35841},"pvrtc-rgba2unorm-webgl":{gl:35843},"etc1-rbg-unorm-webgl":{gl:36196},"atc-rgb-unorm-webgl":{gl:35986},"atc-rgba-unorm-webgl":{gl:35986},"atc-rgbai-unorm-webgl":{gl:34798}};function K9(e,t,r){let n=t.create,i=PO[t.format];return i?.gl===void 0&&(n=!1),i?.x&&(n=n&&Boolean(Df(e,i.x,r))),{format:t.format,create:n&&t.create,render:n&&t.render,filter:n&&t.filter,blend:n&&t.blend,store:n&&t.store}}function ZE(e){let t=PO[e],r=Vdt(e),n=x_(e);return{internalFormat:r,format:t?.dataFormat||Udt(n.channels,n.integer,n.normalized,r),type:n.dataType?YE(n.dataType):t?.types?.[0]||5121,compressed:n.compressed||!1}}function Z9(e){switch(x_(e).attachment){case"depth":return 36096;case"stencil":return 36128;case"depth-stencil":return 33306;default:throw new Error(`Not a depth stencil format: ${e}`)}}function Udt(e,t,r,n){if(n===6408||n===6407)return n;switch(e){case"r":return t&&!r?36244:6403;case"rg":return t&&!r?33320:33319;case"rgb":return t&&!r?36248:6407;case"rgba":return t&&!r?36249:6408;case"bgra":throw new Error("bgra pixels not supported by WebGL");default:return 6408}}function Vdt(e){let r=PO[e]?.gl;if(r===void 0)throw new Error(`Unsupported texture format ${e}`);return r}var $9={"depth-clip-control":"EXT_depth_clamp","timer-query-webgl":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"},$E=class extends bv{gl;extensions;testedFeatures=new Set;constructor(t,r,n){super([],n),this.gl=t,this.extensions=r,Df(t,"EXT_color_buffer_float",r)}*[Symbol.iterator](){let t=this.getFeatures();for(let r of t)this.has(r)&&(yield r);return[]}has(t){return this.disabledFeatures?.[t]?!1:(this.testedFeatures.has(t)||(this.testedFeatures.add(t),X9(t)&&Y9(this.gl,t,this.extensions)&&this.features.add(t),this.getWebGLFeature(t)&&this.features.add(t)),this.features.has(t))}initializeFeatures(){let t=this.getFeatures().filter(r=>r!=="polygon-mode-webgl");for(let r of t)this.has(r)}getFeatures(){return[...Object.keys($9),...Object.keys(KE)]}getWebGLFeature(t){let r=$9[t];return Boolean(typeof r=="string"?Df(this.gl,r,this.extensions):r)}};var QE=class extends vv{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderComponents(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(t){super(),this.gl=t}getParameter(t){return this.limits[t]===void 0&&(this.limits[t]=this.gl.getParameter(t)),this.limits[t]||0}};var Nf=class extends Lf{device;gl;handle;colorAttachments=[];depthStencilAttachment=null;constructor(t,r){super(t,r);let n=r.handle===null;this.device=t,this.gl=t.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),n||(t.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.updateAttachments())}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}updateAttachments(){let t=this.gl.bindFramebuffer(36160,this.handle);for(let r=0;r<this.colorAttachments.length;++r){let n=this.colorAttachments[r];if(n){let i=36064+r;this._attachTextureView(i,n)}}if(this.depthStencilAttachment){let r=Z9(this.depthStencilAttachment.props.format);this._attachTextureView(r,this.depthStencilAttachment)}if(this.device.props.debug){let r=this.gl.checkFramebufferStatus(36160);if(r!==36053)throw new Error(`Framebuffer ${Hdt(r)}`)}this.gl.bindFramebuffer(36160,t)}_attachTextureView(t,r){let{gl:n}=this.device,{texture:i}=r,o=r.props.baseMipLevel,s=r.props.baseArrayLayer;switch(n.bindTexture(i.glTarget,i.handle),i.glTarget){case 35866:case 32879:n.framebufferTextureLayer(36160,t,i.handle,o,s);break;case 34067:let c=jdt(s);n.framebufferTexture2D(36160,t,c,i.handle,o);break;case 3553:n.framebufferTexture2D(36160,t,3553,i.handle,o);break;default:throw new Error("Illegal texture type")}n.bindTexture(i.glTarget,null)}};function jdt(e){return e<34069?e+34069:e}function Hdt(e){switch(e){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${e}`}}var JE=class extends b_{device;format="rgba8unorm";depthStencilFormat="depth24plus";presentationSize;_framebuffer=null;get[Symbol.toStringTag](){return"WebGLCanvasContext"}constructor(t,r){super(r),this.device=t,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new Nf(this.device,{handle:null}),this._framebuffer}update(){let t=this.getPixelSize();(t[0]!==this.presentationSize[0]||t[1]!==this.presentationSize[1])&&(this.presentationSize=t,this.resize())}resize(t){if(this.device.gl&&this.canvas){let r=this.getDevicePixelRatio(t?.useDevicePixels);this.setDevicePixelRatio(r,t);return}}commit(){}};async function tM(e,t){let r=document.getElementsByTagName("head")[0];if(!r)throw new Error("loadScript");let n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",e),t&&(n.id=t),new Promise((i,o)=>{n.onload=i,n.onerror=s=>o(new Error(`Unable to load script '${e}': ${s}`)),r.appendChild(n)})}var Wdt=1,au=null,Q9=!1,eM={debugSpectorJS:qe.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0};async function J9(e){if(!globalThis.SPECTOR)try{await tM(e.debugSpectorJSUrl||eM.debugSpectorJSUrl)}catch(t){qe.warn(String(t))}}function t7(e){if(e={...eM,...e},!e.debugSpectorJS)return null;if(!au&&globalThis.SPECTOR&&!globalThis.luma?.spector){qe.probe(Wdt,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();let{Spector:t}=globalThis.SPECTOR;au=new t,globalThis.luma&&(globalThis.luma.spector=au)}if(!au)return null;if(Q9||(Q9=!0,au.spyCanvases(),au?.onCaptureStarted.add(t=>qe.info("Spector capture started:",t)()),au?.onCapture.add(t=>{qe.info("Spector capture complete:",t)(),au?.getResultUI(),au?.resultView.display(),au?.resultView.addCapture(t)})),e.gl){let t=e.gl,r=t.device;au?.startCapture(e.gl,500),t.device=r,new Promise(n=>setTimeout(n,2e3)).then(n=>{qe.info("Spector capture stopped after 2 seconds")(),au?.stopCapture()})}return au}var qdt="https://unpkg.com/webgl-debug@2.0.1/index.js";function r7(e){return e.luma=e.luma||{},e.luma}async function n7(){ul()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await tM(qdt))}function i7(e,t={}){return t.debugWebGL||t.traceWebGL?Xdt(e,t):Gdt(e)}function Gdt(e){let t=r7(e);return t.realContext?t.realContext:e}function Xdt(e,t){if(!globalThis.WebGLDebugUtils)return qe.warn("webgl-debug not loaded")(),e;let r=r7(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...Of,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,Ydt.bind(null,t),Kdt.bind(null,t));for(let s in Of)!(s in n)&&typeof Of[s]=="number"&&(n[s]=Of[s]);class i{}Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(i,n);let o=Object.create(i);return r.realContext=e,r.debugContext=o,o.debug=!0,o}function e7(e,t){t=Array.from(t).map(n=>n===void 0?"undefined":n);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${e}(${r})`}function Ydt(e,t,r,n){n=Array.from(n).map(c=>c===void 0?"undefined":c);let i=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),s=`${i} in gl.${r}(${o})`;qe.error(s)();debugger}function Kdt(e,t,r){let n="";qe.level>=1&&(n=e7(t,r),e.traceWebGL&&qe.log(1,n)());for(let i of r)if(i===void 0){n=n||e7(t,r);debugger}}var IO={};function o7(e="id"){IO[e]=IO[e]||1;let t=IO[e]++;return`${e}-${t}`}var Ch=class extends Vn{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(t,r={}){super(t,r),this.device=t,this.gl=this.device.gl;let n=typeof r=="object"?r.handle:void 0;this.handle=n||this.gl.createBuffer(),t.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=Zdt(this.props.usage),this.glUsage=$dt(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(t,r=0,n=t.byteLength+r){let i=this.glTarget;this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,n,this.glUsage),this.gl.bufferSubData(i,r,t),this.gl.bindBuffer(i,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(t,r,n),this.trackAllocatedMemory(n)}_initWithByteLength(t){let r=t;t===0&&(r=new Float32Array(0));let n=this.glTarget;return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.glUsage),this.gl.bindBuffer(n,null),this.bytesUsed=t,this.byteLength=t,this._setDebugData(null,0,t),this.trackAllocatedMemory(t),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(t,r=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,r,t),this.gl.bindBuffer(36663,null),this._setDebugData(t,r,t.byteLength)}async readAsync(t=0,r){return this.readSyncWebGL(t,r)}readSyncWebGL(t=0,r){r=r??this.byteLength-t;let n=new Uint8Array(r),i=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,t,n,i,r),this.gl.bindBuffer(36662,null),this._setDebugData(n,t,r),n}};function Zdt(e){return e&Vn.INDEX?34963:e&Vn.VERTEX?34962:e&Vn.UNIFORM?35345:34962}function $dt(e){return e&Vn.INDEX||e&Vn.VERTEX?35044:e&Vn.UNIFORM?35048:35044}function a7(e){let t=e.split(/\r?\n/),r=[];for(let n of t){if(n.length<=1)continue;let i=n.split(":");if(i.length===2){let[x,w]=i;r.push({message:w.trim(),type:s7(x),lineNum:0,linePos:0});continue}let[o,s,c,...l]=i,h=parseInt(c,10);isNaN(h)&&(h=0);let p=parseInt(s,10);isNaN(p)&&(p=0),r.push({message:l.join(":").trim(),type:s7(o),lineNum:h,linePos:p})}return r}function s7(e){let t=["warning","error","info"],r=e.toLowerCase();return t.includes(r)?r:"info"}var rM=class extends em{device;handle;constructor(t,r){switch(super(t,r),this.device=t,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}get asyncCompilationStatus(){return this._waitForCompilationComplete().then(()=>this.compilationStatus)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let t=this.device.gl.getShaderInfoLog(this.handle);return t?a7(t):[]}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)||null}async _compile(t){t=t.startsWith("#version ")?t:`#version 300 es
551
- ${t}`;let{gl:r}=this.device;if(r.shaderSource(this.handle,t),r.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}qe.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),qe.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let t=async i=>await new Promise(o=>setTimeout(o,i));if(!this.device.features.has("compilation-status-async-webgl")){await t(10);return}let{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,37297))return;await t(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};function l7(e,t,r,n){if(emt(t))return n(e);let i=e;i.pushState();try{return Qdt(e,t),Mh(i.gl,r),n(e)}finally{i.popState()}}function Qdt(e,t){let r=e,{gl:n}=r;if(t.cullMode)switch(t.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(t.frontFace&&n.frontFace(XA("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.unclippedDepth&&e.features.has("depth-clip-control")&&n.enable(34383),t.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0)),t.provokingVertex&&e.features.has("provoking-vertex-webgl")){let o=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,s=XA("provokingVertex",t.provokingVertex,{first:36429,last:36430});o?.provokingVertexWEBGL(s)}if((t.polygonMode||t.polygonOffsetLine)&&e.features.has("polygon-mode-webgl")){if(t.polygonMode){let o=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,s=XA("polygonMode",t.polygonMode,{fill:6914,line:6913});o?.polygonModeWEBGL(1028,s),o?.polygonModeWEBGL(1029,s)}t.polygonOffsetLine&&n.enable(10754)}if(e.features.has("shader-clip-cull-distance-webgl")&&(t.clipDistance0&&n.enable(12288),t.clipDistance1&&n.enable(12289),t.clipDistance2&&n.enable(12290),t.clipDistance3&&n.enable(12291),t.clipDistance4&&n.enable(12292),t.clipDistance5&&n.enable(12293),t.clipDistance6&&n.enable(12294),t.clipDistance7&&n.enable(12295)),t.depthWriteEnabled!==void 0&&n.depthMask(tmt("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(iM("depthCompare",t.depthCompare))),t.stencilWriteMask){let i=t.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(t.stencilReadMask&&qe.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let i=t.stencilReadMask||4294967295,o=iM("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,o,0,i),n.stencilFuncSeparate(1029,o,0,i)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let i=RO("stencilPassOperation",t.stencilPassOperation),o=RO("stencilFailOperation",t.stencilFailOperation),s=RO("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,o,s,i),n.stencilOpSeparate(1029,o,s,i)}switch(t.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break;default:}if(t.blendColorOperation||t.blendAlphaOperation){let i=c7("blendColorOperation",t.blendColorOperation||"add"),o=c7("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(i,o);let s=nM("blendColorSrcFactor",t.blendColorSrcFactor||"one"),c=nM("blendColorDstFactor",t.blendColorDstFactor||"zero"),l=nM("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),h=nM("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(s,c,l,h)}}function iM(e,t){return XA(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function RO(e,t){return XA(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function c7(e,t){return XA(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function nM(e,t){return XA(e,t,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function Jdt(e,t){return`Illegal parameter ${t} for ${e}`}function XA(e,t,r){if(!(t in r))throw new Error(Jdt(e,t));return r[t]}function tmt(e,t){return t}function emt(e){let t=!0;for(let r in e){t=!1;break}return t}function oM(e){let t={};return e.addressModeU&&(t[10242]=LO(e.addressModeU)),e.addressModeV&&(t[10243]=LO(e.addressModeV)),e.addressModeW&&(t[32882]=LO(e.addressModeW)),e.magFilter&&(t[10240]=OO(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=rmt(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[33082]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[33083]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[34892]=34894),e.compare&&(t[34893]=iM("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function LO(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function OO(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function rmt(e,t="none"){if(!t)return OO(e);switch(t){case"none":return OO(e);case"nearest":return e==="nearest"?9984:9986;case"linear":return e==="nearest"?9985:9987}}var YA=class extends rm{device;handle;parameters;constructor(t,r){super(t,r),this.device=t,this.parameters=oM(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(t){for(let[r,n]of Object.entries(t)){let i=Number(r);switch(i){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,i,n);break;default:this.device.gl.samplerParameteri(this.handle,i,n);break}}}};var kf=class extends tm{device;gl;handle;texture;constructor(t,r){super(t,{...fi.defaultProps,...r}),this.device=t,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var nmt="Failed to deduce GL constant from typed array";function u7(e){switch(ArrayBuffer.isView(e)?e.constructor:e){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(nmt)}}function h7(e,t){let{clamped:r=!0}=t||{};switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function BO(e){switch(e){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function f7(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}function KA(e,t,r){if(imt(t))return r(e);let{nocatch:n=!0}=t,i=Sh.get(e);i.push(),Mh(e,t);let o;if(n)o=r(e),i.pop();else try{o=r(e)}finally{i.pop()}return o}function imt(e){for(let t in e)return!1;return!0}function p7(e,t,r){let{dimension:n,width:i,height:o,depth:s=0}=r,{glInternalFormat:c}=r,l=r.glTarget;switch(n){case"2d-array":case"3d":e.texStorage3D(l,t,c,i,o,s);break;default:e.texStorage2D(l,t,c,i,o)}}function DO(e,t,r,n){let{width:i,height:o}=n,{dimension:s,depth:c=0,mipLevel:l=0}=n,{x:h=0,y:p=0,z:x=0}=n,{glFormat:w,glType:E}=n,P=m7(n.glTarget,s,c),B=n.flipY?{[37440]:!0}:{};KA(e,B,()=>{switch(s){case"2d-array":case"3d":e.bindTexture(P,t),e.texSubImage3D(P,l,h,p,x,i,o,c,w,E,r),e.bindTexture(P,null);break;case"2d":case"cube":e.bindTexture(P,t),e.texSubImage2D(P,l,h,p,i,o,w,E,r),e.bindTexture(P,null);break;default:throw new Error(s)}})}function NO(e,t,r){let{dimension:n,width:i,height:o,depth:s=0,mipLevel:c=0,byteOffset:l=0}=r,{x:h=0,y:p=0,z:x=0}=r,{glFormat:w,glType:E,compressed:P}=r,B=m7(r.glTarget,n,s);switch(n){case"2d-array":case"3d":P?e.compressedTexSubImage3D(B,c,h,p,x,i,o,s,w,t,l):e.texSubImage3D(B,c,h,p,x,i,o,s,w,E,t,l);break;case"2d":case"cube":P?e.compressedTexSubImage2D(B,c,h,p,i,o,w,t,l):e.texSubImage2D(B,c,h,p,i,o,w,E,t,l);break;default:throw new Error(n)}}function d7(e){switch(e){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866;case"cube-array":break}throw new Error(e)}function m7(e,t,r){return t==="cube"?34069+r:e}function A7(e,t){let{sourceX:r=0,sourceY:n=0,sourceAttachment:i=0}=t||{},{target:o=null,sourceWidth:s,sourceHeight:c,sourceDepth:l,sourceFormat:h,sourceType:p}=t||{},{framebuffer:x,deleteFramebuffer:w}=_7(e),{gl:E,handle:P}=x;s||=x.width,c||=x.height;let B=x.colorAttachments[i]?.texture;if(!B)throw new Error(`Invalid framebuffer attachment ${i}`);l=B?.depth||1,h||=B?.glFormat||6408,p||=B?.glType||5121,o=smt(o,p,h,s,c,l),p=p||u7(o);let D=E.bindFramebuffer(36160,P);return E.readBuffer(36064+i),E.readPixels(r,n,s,c,h,p,o),E.readBuffer(36064),E.bindFramebuffer(36160,D||null),w&&x.destroy(),o}function g7(e,t){let{target:r,sourceX:n=0,sourceY:i=0,sourceFormat:o=6408,targetByteOffset:s=0}=t||{},{sourceWidth:c,sourceHeight:l,sourceType:h}=t||{},{framebuffer:p,deleteFramebuffer:x}=_7(e);c=c||p.width,l=l||p.height;let w=p;h=h||5121;let E=r;if(!E){let B=BO(o),D=f7(h),W=s+c*l*B*D;E=w.device.createBuffer({byteLength:W})}let P=e.device.createCommandEncoder();return P.copyTextureToBuffer({sourceTexture:e,width:c,height:l,origin:[n,i],destinationBuffer:E,byteOffset:s}),P.destroy(),x&&p.destroy(),E}function _7(e){return e instanceof Lf?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:omt(e),deleteFramebuffer:!0}}function omt(e,t){let{device:r,width:n,height:i,id:o}=e;return r.createFramebuffer({...t,id:`framebuffer-for-${o}`,width:n,height:i,colorAttachments:[e]})}function smt(e,t,r,n,i,o){if(e)return e;t||=5121;let s=h7(t,{clamped:!1}),c=BO(r);return new s(n*i*c)}var Ff=class extends fi{device;gl;handle;sampler=void 0;view=void 0;mipmaps;compressed;glTarget;glFormat;glType;glInternalFormat;textureUnit=0;constructor(t,r){super(t,r);let n={...this.props};n.data=r.data,this.device=t,this.gl=this.device.gl,this.glTarget=d7(this.props.dimension);let i=ZE(this.props.format);this.glInternalFormat=i.internalFormat,this.glFormat=i.format,this.glType=i.type,this.compressed=i.compressed,this.mipmaps=Boolean(this.props.mipmaps),this._initialize(n),Object.seal(this)}_initialize(t){this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:t.data});let{width:r,height:n}=t;if(!r||!n){let i=fi.getTextureDataSize(t.data);r=i?.width||1,n=i?.height||1}if(this.width=r,this.height=n,this.depth=t.depth,this.setSampler(t.sampler),this.view=new kf(this.device,{...this.props,texture:this}),this.bind(),p7(this.gl,this.mipLevels,this),t.data)switch(t.dimension){case"1d":this.setTexture1DData(t.data);break;case"2d":this.setTexture2DData(t.data);break;case"3d":this.setTexture3DData(t.data);break;case"cube":this.setTextureCubeData(t.data);break;case"2d-array":this.setTextureArrayData(t.data);break;case"cube-array":this.setTextureCubeArrayData(t.data);break;default:throw new Error(t.dimension)}this.mipmaps&&this.generateMipmap()}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(t){return new kf(this.device,{...t,texture:this})}setSampler(t={}){let r;t instanceof YA?(this.sampler=t,r=t.props):(this.sampler=new YA(this.device,t),r=t);let n=oM(r);this._setSamplerParameters(n)}generateMipmap(t){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(qe.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!t?.force)))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(n){qe.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}copyExternalImage(t){let r=fi.getExternalImageSize(t.image),n={...fi.defaultCopyExternalImageOptions,...r,...t},{image:i,depth:o,mipLevel:s,x:c,y:l,z:h,flipY:p}=n,{width:x,height:w}=n,{dimension:E,glTarget:P,glFormat:B,glInternalFormat:D,glType:W}=this;if(x=Math.min(x,this.width-c),w=Math.min(w,this.height-l),t.sourceX||t.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");return DO(this.device.gl,this.handle,i,{dimension:E,mipLevel:s,x:c,y:l,z:h,width:x,height:w,depth:o,glFormat:B,glInternalFormat:D,glType:W,glTarget:P,flipY:p}),{width:n.width,height:n.height}}setTexture1DData(t){throw new Error("setTexture1DData not supported in WebGL.")}setTexture2DData(t,r=0){this.bind();let n=fi.normalizeTextureData(t,this);n.length>1&&this.props.mipmaps!==!1&&qe.warn(`Texture ${this.id} mipmap and multiple LODs.`)();for(let i=0;i<n.length;i++){let o=n[i];this._setMipLevel(r,i,o)}this.unbind()}setTexture3DData(t){if(this.props.dimension!=="3d")throw new Error(this.id);ArrayBuffer.isView(t)&&(this.bind(),NO(this.device.gl,t,this),this.unbind())}setTextureCubeData(t,r=0){if(this.props.dimension!=="cube")throw new Error(this.id);for(let n of fi.CubeFaces)this.setTextureCubeFaceData(t[n],n)}setTextureArrayData(t){throw this.props.dimension!=="2d-array"?new Error(this.id):new Error("setTextureArrayData not implemented.")}setTextureCubeArrayData(t){throw new Error("setTextureCubeArrayData not supported in WebGL2.")}setTextureCubeFaceData(t,r,n=0){Array.isArray(t)&&t.length>1&&this.props.mipmaps!==!1&&qe.warn(`${this.id} has mipmap and multiple LODs.`)();let i=fi.CubeFaces.indexOf(r);this.setTexture2DData(t,i)}update(){throw new Error("Texture.update() not implemented. Use ExternalTexture")}setImageDataForFace(t){let{face:r,width:n,height:i,pixels:o,data:s,format:c=6408,type:l=5121}=t,{gl:h}=this,p=o||s;this.bind(),p instanceof Promise?p.then(x=>this.setImageDataForFace(Object.assign({},t,{face:r,data:x,pixels:x}))):this.width||this.height?h.texImage2D(r,0,c,n,i,0,c,l,p):h.texImage2D(r,0,c,c,l,p)}_getImageDataMap(t){for(let r=0;r<fi.CubeFaces.length;++r){let n=fi.CubeFaces[r];t[n]&&(t[34069+r]=t[n],delete t[n])}return t}_setSamplerParameters(t){qe.log(1,`${this.id} sampler parameters`,this.device.getGLKeys(t))(),this.gl.bindTexture(this.glTarget,this.handle);for(let[r,n]of Object.entries(t)){let i=Number(r),o=n;switch(i){case 33082:case 33083:this.gl.texParameterf(this.glTarget,i,o);break;case 10241:this.gl.texParameteri(this.glTarget,i,o);break;case 10242:case 10243:this.gl.texParameteri(this.glTarget,i,o);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,i,o);break;default:this.gl.texParameteri(this.glTarget,i,o);break}}this.gl.bindTexture(this.glTarget,null)}_setMipLevel(t,r,n,i=this.glTarget){if(fi.isExternalImage(n)){DO(this.device.gl,this.handle,n,{...this,depth:t,mipLevel:r,glTarget:i,flipY:this.props.flipY});return}if(fi.isTextureLevelData(n)){NO(this.device.gl,n.data,{...this,depth:t,mipLevel:r,glTarget:i});return}throw new Error("Texture: invalid image data")}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(t){let{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.glTarget,this.handle),t}unbind(t){let{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.glTarget,null),t}};var amt=[1,2,4,8],sM=class extends kp{device;glParameters;constructor(t,r){super(t,r),this.device=t;let n;if(!r?.parameters?.viewport)if(r?.framebuffer){let{width:i,height:o}=r.framebuffer;n=[0,0,i,o]}else{let[i,o]=t.getCanvasContext().getDrawingBufferSize();n=[0,0,i,o]}if(this.device.pushState(),this.setParameters({viewport:n,...this.props.parameters}),this.props.framebuffer){let i=this.props.framebuffer.colorAttachments.map((o,s)=>36064+s);this.device.gl.drawBuffers(i)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(t={}){let r={...this.glParameters};r.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,t.viewport&&(t.viewport.length>=6?(r.viewport=t.viewport.slice(0,4),r.depthRange=[t.viewport[4],t.viewport[5]]):r.viewport=t.viewport),t.scissorRect&&(r.scissorTest=!0,r.scissor=t.scissorRect),t.blendConstant&&(r.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),t[2967]=t.stencilReference),t.colorMask&&(r.colorMask=amt.map(n=>Boolean(n&t.colorMask))),this.glParameters=r,Mh(this.device.gl,r)}beginOcclusionQuery(t){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let t={...this.glParameters},r=0;this.props.clearColors&&this.props.clearColors.forEach((n,i)=>{n&&this.clearColorBuffer(i,n)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(r|=16384,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=256,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=1024,t.clearStencil=this.props.clearStencil),r!==0&&KA(this.device.gl,t,()=>{this.device.gl.clear(r)})}clearColorBuffer(t=0,r=[0,0,0,0]){KA(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,t,r);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,t,r);break;case Float32Array:this.device.gl.clearBufferfv(6144,t,r);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}};function y7(e){return cmt.includes(e)}var cmt=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],x7={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function kO(e){let t=x7[e];if(!t)throw new Error("uniform");let[r,n,,i]=t;return{format:i,components:n,glType:r}}function v7(e){let t=x7[e];if(!t)throw new Error("attribute");let[,r,,n,i]=t;return{attributeType:n,vertexFormat:i,components:r}}function b7(e,t){let r={attributes:[],bindings:[]};r.attributes=lmt(e,t);let n=fmt(e,t);for(let c of n){let l=c.uniforms.map(h=>({name:h.name,format:h.format,byteOffset:h.byteOffset,byteStride:h.byteStride,arrayLength:h.arrayLength}));r.bindings.push({type:"uniform",name:c.name,group:0,location:c.location,visibility:(c.vertex?1:0)&(c.fragment?2:0),minBindingSize:c.byteLength,uniforms:l})}let i=hmt(e,t),o=0;for(let c of i)if(y7(c.type)){let{viewDimension:l,sampleType:h}=dmt(c.type);r.bindings.push({type:"texture",name:c.name,group:0,location:o,viewDimension:l,sampleType:h}),c.textureUnit=o,o+=1}i.length&&(r.uniforms=i);let s=umt(e,t);return s?.length&&(r.varyings=s),r}function lmt(e,t){let r=[],n=e.getProgramParameter(t,35721);for(let i=0;i<n;i++){let o=e.getActiveAttrib(t,i);if(!o)throw new Error("activeInfo");let{name:s,type:c}=o,l=e.getAttribLocation(t,s);if(l>=0){let{attributeType:h}=v7(c),p=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:l,stepMode:p,type:h})}}return r.sort((i,o)=>i.location-o.location),r}function umt(e,t){let r=[],n=e.getProgramParameter(t,35971);for(let i=0;i<n;i++){let o=e.getTransformFeedbackVarying(t,i);if(!o)throw new Error("activeInfo");let{name:s,type:c,size:l}=o,{glType:h,components:p}=kO(c),x={location:i,name:s,type:h,size:l*p};r.push(x)}return r.sort((i,o)=>i.location-o.location),r}function hmt(e,t){let r=[],n=e.getProgramParameter(t,35718);for(let i=0;i<n;i++){let o=e.getActiveUniform(t,i);if(!o)throw new Error("activeInfo");let{name:s,size:c,type:l}=o,{name:h,isArray:p}=mmt(s),x=e.getUniformLocation(t,h),w={location:x,name:h,size:c,type:l,isArray:p};if(r.push(w),w.size>1)for(let E=0;E<w.size;E++){let P=`${h}[${E}]`;x=e.getUniformLocation(t,P);let B={...w,name:P,location:x};r.push(B)}}return r}function fmt(e,t){let r=(o,s)=>e.getActiveUniformBlockParameter(t,o,s),n=[],i=e.getProgramParameter(t,35382);for(let o=0;o<i;o++){let s={name:e.getActiveUniformBlockName(t,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},c=r(o,35395)||[],l=e.getActiveUniforms(t,c,35383),h=e.getActiveUniforms(t,c,35384),p=e.getActiveUniforms(t,c,35387),x=e.getActiveUniforms(t,c,35388);for(let w=0;w<s.uniformCount;++w){let E=e.getActiveUniform(t,c[w]);if(!E)throw new Error("activeInfo");s.uniforms.push({name:E.name,format:kO(l[w]).format,type:l[w],arrayLength:h[w],byteOffset:p[w],byteStride:x[w]})}n.push(s)}return n.sort((o,s)=>o.location-s.location),n}var pmt={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function dmt(e){let t=pmt[e];if(!t)throw new Error("sampler");let[r,n]=t;return{viewDimension:r,sampleType:n}}function mmt(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${e}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function w7(e,t,r,n){let i=e,o=n;o===!0&&(o=1),o===!1&&(o=0);let s=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return e.uniform1i(t,n);case 5126:return e.uniform1fv(t,s);case 35664:return e.uniform2fv(t,s);case 35665:return e.uniform3fv(t,s);case 35666:return e.uniform4fv(t,s);case 5124:return e.uniform1iv(t,s);case 35667:return e.uniform2iv(t,s);case 35668:return e.uniform3iv(t,s);case 35669:return e.uniform4iv(t,s);case 35670:return e.uniform1iv(t,s);case 35671:return e.uniform2iv(t,s);case 35672:return e.uniform3iv(t,s);case 35673:return e.uniform4iv(t,s);case 5125:return i.uniform1uiv(t,s,1);case 36294:return i.uniform2uiv(t,s,2);case 36295:return i.uniform3uiv(t,s,3);case 36296:return i.uniform4uiv(t,s,4);case 35674:return e.uniformMatrix2fv(t,!1,s);case 35675:return e.uniformMatrix3fv(t,!1,s);case 35676:return e.uniformMatrix4fv(t,!1,s);case 35685:return i.uniformMatrix2x3fv(t,!1,s);case 35686:return i.uniformMatrix2x4fv(t,!1,s);case 35687:return i.uniformMatrix3x2fv(t,!1,s);case 35688:return i.uniformMatrix3x4fv(t,!1,s);case 35689:return i.uniformMatrix4x2fv(t,!1,s);case 35690:return i.uniformMatrix4x3fv(t,!1,s)}throw new Error("Illegal uniform")}function T7(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function E7(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number":!1}function Rv(e){return T7(e)||E7(e)}function Amt(e){return Rv(e)!==null||typeof e=="number"||typeof e=="boolean"}function M7(e){let t={bindings:{},uniforms:{}};return Object.keys(e).forEach(r=>{let n=e[r];Amt(n)?t.uniforms[r]=n:t.bindings[r]=n}),t}function S7(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw new Error(e)}}function C7(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;default:throw new Error(e)}}var P7=4,aM=class extends Eh{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(t,r){super(t,r),this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:n,bufferMode:i=35981}=r;n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,i)),this._linkShaders(),qe.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=b7(this.device.gl,this.handle),qe.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=gmt(this.introspectedLayout,r.shaderLayout)}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(t,r){for(let[n,i]of Object.entries(t)){let o=this.shaderLayout.bindings.find(s=>s.name===n)||this.shaderLayout.bindings.find(s=>s.name===`${n}Uniforms`);if(!o){let s=this.shaderLayout.bindings.map(c=>`"${c.name}"`).join(", ");r?.disableWarnings||qe.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${s}`,i)();continue}switch(i||qe.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),o.type){case"uniform":if(!(i instanceof Ch)&&!(i.buffer instanceof Ch))throw new Error("buffer value");break;case"texture":if(!(i instanceof kf||i instanceof Ff||i instanceof Nf))throw new Error("texture value");break;case"sampler":qe.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(o.type)}this.bindings[n]=i}}draw(t){let{renderPass:r,parameters:n=this.props.parameters,topology:i=this.props.topology,vertexArray:o,vertexCount:s,instanceCount:c,isInstanced:l=!1,firstVertex:h=0,transformFeedback:p}=t,x=S7(i),w=Boolean(o.indexBuffer),E=o.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return qe.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return qe.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),o.bindBeforeRender(r),p&&p.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let P=r;return l7(this.device,n,P.glParameters,()=>{w&&l?this.device.gl.drawElementsInstanced(x,s||0,E,h,c||0):w?this.device.gl.drawElements(x,s||0,E,h):l?this.device.gl.drawArraysInstanced(x,h,s||0,c||0):this.device.gl.drawArrays(x,h,s||0),p&&p.end()}),o.unbindAfterRender(r),!0}setUniformsWebGL(t){let{bindings:r}=M7(t);Object.keys(r).forEach(n=>{qe.warn(`Unsupported value "${JSON.stringify(r[n])}" used in setUniforms() for key ${n}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,t)}async _linkShaders(){let{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),qe.time(P7,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),qe.timeEnd(P7,`linkProgram for ${this.id}`)(),qe.level,!this.device.features.has("compilation-status-async-webgl")){let n=this._getLinkStatus();this._reportLinkStatus(n);return}qe.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),qe.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}async _reportLinkStatus(t){switch(t){case"success":return;default:switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`);case"pending":this.vs.asyncCompilationStatus.then(()=>this.vs.debugShader());break;case"success":break}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`);case"pending":this.fs.asyncCompilationStatus.then(()=>this.fs.debugShader());break;case"success":break}let r=this.device.gl.getProgramInfoLog(this.handle);throw new Error(`Error during ${t}: ${r}`)}}_getLinkStatus(){let{gl:t}=this.device;return t.getProgramParameter(this.handle,35714)?(t.validateProgram(this.handle),t.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let t=async i=>await new Promise(o=>setTimeout(o,i));if(!this.device.features.has("compilation-status-async-webgl")){await t(10);return}let{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,37297))return;await t(10)}}_areTexturesRenderable(){let t=!0;for(let r of this.shaderLayout.bindings)!this.bindings[r.name]&&!this.bindings[r.name.replace(/Uniforms$/,"")]&&(qe.warn(`Binding ${r.name} not found in ${this.id}`)(),t=!1);return t}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:t}=this.device;t.useProgram(this.handle);let r=0,n=0;for(let i of this.shaderLayout.bindings){let o=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":let{name:s}=i,c=t.getUniformBlockIndex(this.handle,s);if(c===4294967295)throw new Error(`Invalid uniform block name ${s}`);t.uniformBlockBinding(this.handle,n,c),o instanceof Ch?t.bindBufferBase(35345,n,o.handle):t.bindBufferRange(35345,n,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),n+=1;break;case"texture":if(!(o instanceof kf||o instanceof Ff||o instanceof Nf))throw new Error("texture");let l;if(o instanceof kf)l=o.texture;else if(o instanceof Ff)l=o;else if(o instanceof Nf&&o.colorAttachments[0]instanceof kf)qe.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=o.colorAttachments[0].texture;else throw new Error("No texture");t.activeTexture(33984+r),t.bindTexture(l.glTarget,l.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(let t of this.shaderLayout.uniforms||[]){let{name:r,location:n,type:i,textureUnit:o}=t,s=this.uniforms[r]??o;s!==void 0&&w7(this.device.gl,n,i,s)}}};function gmt(e,t){let r={...e,attributes:e.attributes.map(n=>({...n}))};for(let n of t?.attributes||[]){let i=r.attributes.find(o=>o.name===n.name);i?(i.type=n.type||i.type,i.stepMode=n.stepMode||i.stepMode):qe.warn(`shader layout attribute ${n.name} not present in shader`)}return r}var cM=class extends T_{device;commands=[];constructor(t){super(t,{}),this.device=t}submitCommands(t=this.commands){for(let r of t)switch(r.name){case"copy-buffer-to-buffer":_mt(this.device,r.options);break;case"copy-buffer-to-texture":ymt(this.device,r.options);break;case"copy-texture-to-buffer":xmt(this.device,r.options);break;case"copy-texture-to-texture":vmt(this.device,r.options);break;default:throw new Error(r.name)}}};function _mt(e,t){let r=t.sourceBuffer,n=t.destinationBuffer;e.gl.bindBuffer(36662,r.handle),e.gl.bindBuffer(36663,n.handle),e.gl.copyBufferSubData(36662,36663,t.sourceOffset??0,t.destinationOffset??0,t.size),e.gl.bindBuffer(36662,null),e.gl.bindBuffer(36663,null)}function ymt(e,t){throw new Error("Not implemented")}function xmt(e,t){let{sourceTexture:r,mipLevel:n=0,aspect:i="all",width:o=t.sourceTexture.width,height:s=t.sourceTexture.height,depthOrArrayLayers:c=0,origin:l=[0,0],destinationBuffer:h,byteOffset:p=0,bytesPerRow:x,rowsPerImage:w}=t;if(i!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||c!==0||x||w)throw new Error("not implemented");let{framebuffer:E,destroyFramebuffer:P}=I7(r),B;try{let D=h,W=o||E.width,X=s||E.height,q=ZE(E.colorAttachments[0].texture.props.format),$=q.format,et=q.type;e.gl.bindBuffer(35051,D.handle),B=e.gl.bindFramebuffer(36160,E.handle),e.gl.readPixels(l[0],l[1],W,X,$,et,p)}finally{e.gl.bindBuffer(35051,null),B!==void 0&&e.gl.bindFramebuffer(36160,B),P&&E.destroy()}}function vmt(e,t){let{sourceTexture:r,destinationMipLevel:n=0,origin:i=[0,0],destinationOrigin:o=[0,0],destinationTexture:s}=t,{width:c=t.destinationTexture.width,height:l=t.destinationTexture.height}=t,{framebuffer:h,destroyFramebuffer:p}=I7(r),[x,w]=i,[E,P,B]=o,D=e.gl.bindFramebuffer(36160,h.handle),W=null,X;if(s instanceof Ff)W=s,c=Number.isFinite(c)?c:W.width,l=Number.isFinite(l)?l:W.height,W.bind(0),X=W.glTarget;else throw new Error("invalid destination");switch(X){case 3553:case 34067:e.gl.copyTexSubImage2D(X,n,E,P,x,w,c,l);break;case 35866:case 32879:e.gl.copyTexSubImage3D(X,n,E,P,B,x,w,c,l);break;default:}W&&W.unbind(),e.gl.bindFramebuffer(36160,D),p&&h.destroy()}function I7(e){if(e instanceof fi){let{width:t,height:r,id:n}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${n}`,width:t,height:r,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}var lM=class extends w_{device;commandBuffer;constructor(t,r){super(t,r),this.device=t,this.commandBuffer=new cM(t)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(t){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:t})}copyBufferToTexture(t){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:t})}copyTextureToBuffer(t){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:t})}copyTextureToTexture(t){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:t})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}resolveQuerySet(t,r,n){}};function R7(e){let{target:t,source:r,start:n=0,count:i=1}=e,o=r.length,s=i*o,c=0;for(let l=n;c<o;c++)t[l++]=r[c];for(;c<s;)c<s-c?(t.copyWithin(n+c,n,n+c),c*=2):(t.copyWithin(n+c,n,n+s-c),c=s);return e.target}var R_=class extends E_{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(t){return ML()==="Chrome"}constructor(t,r){super(t,r),this.device=t,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(t){let r=t;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r,this.device.gl.bindVertexArray(null)}setBuffer(t,r){let n=r;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:i,type:o,stride:s,offset:c,normalized:l,integer:h,divisor:p}=this._getAccessor(t);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),h?this.device.gl.vertexAttribIPointer(t,i,o,s,c):this.device.gl.vertexAttribPointer(t,i,o,l,s,c),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(t),this.device.gl.vertexAttribDivisor(t,p||0),this.attributes[t]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(t,r){this._enable(t,!1),this.attributes[t]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){let r=this.attributes[t];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(t,r)}}_getAccessor(t){let r=this.attributeInfos[t];if(!r)throw new Error(`Unknown attribute location ${t}`);let n=YE(r.bufferDataType);return{size:r.bufferComponents,type:n,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(t,r=!0){let i=R_.isConstantAttributeZeroSupported(this.device)||t!==0;(r||i)&&(t=Number(t),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl.bindVertexArray(null))}getConstantBuffer(t,r){let n=bmt(r),i=n.byteLength*t,o=n.length*t;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),s=s||!wmt(n,this.bufferValue),s){let c=TO(r.constructor,o);R7({target:c,source:n,start:0,count:o}),this.buffer.write(c),this.bufferValue=r}return this.buffer}};function bmt(e){return Array.isArray(e)?new Float32Array(e):e}function wmt(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var uM=class extends M_{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(t,r){super(t,r),this.device=t,this.gl=t.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(t="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(C7(t))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(t){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])})}setBuffer(t,r){let n=this._getVaryingIndex(t),{buffer:i,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(n<0){this.unusedBuffers[t]=i,qe.warn(`${this.id} unusedBuffers varying buffer ${t}`)();return}this.buffers[n]={buffer:i,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(n,i,s,o)}getBuffer(t){if(L7(t))return this.buffers[t]||null;let r=this._getVaryingIndex(t);return r>=0?this.buffers[r]:null}bind(t=this.handle){if(typeof t!="function")return this.gl.bindTransformFeedback(36386,t),this;let r;return this._bound?r=t():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=t(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(t){if(t instanceof Ch)return{buffer:t,byteOffset:0,byteLength:t.byteLength};let{buffer:r,byteOffset:n=0,byteLength:i=t.buffer.byteLength}=t;return{buffer:r,byteOffset:n,byteLength:i}}_getVaryingIndex(t){if(L7(t))return Number(t);for(let r of this.layout.varyings)if(t===r.name)return r.location;return-1}_bindBuffers(){for(let t in this.buffers){let{buffer:r,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[t]);this._bindBuffer(Number(t),r,i,n)}}_unbindBuffers(){for(let t in this.buffers)this.gl.bindBufferBase(35982,Number(t),null)}_bindBuffer(t,r,n=0,i){let o=r&&r.handle;!o||i===void 0?this.gl.bindBufferBase(35982,t,o):this.gl.bindBufferRange(35982,t,o,n,i)}};function L7(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var hM=class extends S_{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(t,r){if(super(t,r),this.device=t,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(t){return this._begin(t?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(t){this._queryPending||(this.target=t,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let t=this.device.gl.getQueryParameter(this.handle,34919);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(t=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((n,i)=>{let o=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):r++>t?(i("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};var Na=class extends Dl{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;constructor(t){if(super({...t,id:t.id||o7("webgl-device")}),!t.createCanvasContext)throw new Error("WebGLDevice requires props.createCanvasContext to be set");let r=t.createCanvasContext===!0?{}:t.createCanvasContext,n=r.canvas?.gl?.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new JE(this,r),this.lost=new Promise(p=>{this._resolveContextLost=p});let i={...t.webgl};r.alphaMode==="premultiplied"&&(i.premultipliedAlpha=!0),t.powerPreference!==void 0&&(i.powerPreference=t.powerPreference);let s=this.props._handle||j9(this.canvasContext.canvas,{onContextLost:p=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:p=>console.log("WebGL context restored")},i);if(!s)throw new Error("WebGL context creation failed");if(n=s.device,n)throw new Error(`WebGL context already attached to device ${n.id}`);this.handle=s,this.gl=s,this.spectorJS=t7({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=H9(this.gl,this._extensions),this.limits=new QE(this.gl),this.features=new $E(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),r.autoResize!==!1&&this.canvasContext.resize(),new Sh(this.gl,{log:(...p)=>qe.log(1,...p)()}).trackState(this.gl,{copyState:!1});let l=t.debugWebGL||t.debug,h=t.debugWebGL;l&&(this.gl=i7(this.gl,{debugWebGL:l,traceWebGL:h}),qe.warn("WebGL debug mode activated. Performance reduced.")(),t.debugWebGL&&(qe.level=Math.max(qe.level,1)))}destroy(){}get isLost(){return this.gl.isContextLost()}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){let r=this._normalizeBufferProps(t);return new Ch(this,r)}createTexture(t){return new Ff(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new YA(this,t)}createShader(t){return new rM(this,t)}createFramebuffer(t){return new Nf(this,t)}createVertexArray(t){return new R_(this,t)}createTransformFeedback(t){return new uM(this,t)}createQuerySet(t){return new hM(this,t)}createRenderPipeline(t){return new aM(this,t)}beginRenderPass(t){return new sM(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(t){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(t={}){return new lM(this,t)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(t,r){return A7(t,r)}readPixelsToBufferWebGL(t,r){return g7(t,r)}setParametersWebGL(t){Mh(this.gl,t)}getParametersWebGL(t){return XE(this.gl,t)}withParametersWebGL(t,r){return KA(this.gl,t,r)}resetWebGL(){qe.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),z9(this.gl)}_getDeviceSpecificTextureFormatCapabilities(t){return K9(this.gl,t,this._extensions)}loseDevice(){let t=!1,n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(t=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),t}pushState(){Sh.get(this.gl).push()}popState(){Sh.get(this.gl).pop()}setSpectorMetadata(t,r){t.__SPECTOR_Metadata=r}getGLKey(t,r){let n=Number(t);for(let i in this.gl)if(this.gl[i]===n)return`GL.${i}`;return r?.emptyIfUnknown?"":String(t)}getGLKeys(t){let r={emptyIfUnknown:!0};return Object.entries(t).reduce((n,[i,o])=>(n[`${i}:${this.getGLKey(i,r)}`]=`${o}:${this.getGLKey(o,r)}`,n),{})}_constants;setConstantAttributeWebGL(t,r){let n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);let i=this._constants[t];switch(i&&Smt(i,r)&&qe.info(1,`setConstantAttributeWebGL(${t}) could have been skipped, value unchanged`)(),this._constants[t]=r,r.constructor){case Float32Array:Tmt(this,t,r);break;case Int32Array:Emt(this,t,r);break;case Uint32Array:Mmt(this,t,r);break;default:throw new Error("constant")}}getExtension(t){return Df(this.gl,t,this._extensions),this._extensions}};function Tmt(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:}}function Emt(e,t,r){e.gl.vertexAttribI4iv(t,r)}function Mmt(e,t,r){e.gl.vertexAttribI4uiv(t,r)}function Smt(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var Cmt={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},Pmt=e=>({drawBuffersWEBGL(t){return e.drawBuffers(t)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),Imt=e=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return e.createVertexArray()},deleteVertexArrayOES(t){return e.deleteVertexArray(t)},isVertexArrayOES(t){return e.isVertexArray(t)},bindVertexArrayOES(t){return e.bindVertexArray(t)}}),Rmt=e=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...t){return e.drawArraysInstanced(...t)},drawElementsInstancedANGLE(...t){return e.drawElementsInstanced(...t)},vertexAttribDivisorANGLE(...t){return e.vertexAttribDivisor(...t)}});function O7(e=!0){let t=HTMLCanvasElement.prototype;if(!e&&t.originalGetContext){t.getContext=t.originalGetContext,t.originalGetContext=void 0;return}t.originalGetContext=t.getContext,t.getContext=function(r,n){if(r==="webgl"||r==="experimental-webgl"){let i=this.originalGetContext("webgl2",n);return i instanceof HTMLElement&&Lmt(i),i}return this.originalGetContext(r,n)}}function Lmt(e){e.getExtension("EXT_color_buffer_float");let t={...Cmt,WEBGL_disjoint_timer_query:e.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:Pmt(e),OES_vertex_array_object:Imt(e),ANGLE_instanced_arrays:Rmt(e)},r=e.getExtension;e.getExtension=function(i){let o=r.call(e,i);return o||(i in t?t[i]:null)};let n=e.getSupportedExtensions;e.getSupportedExtensions=function(){return(n.apply(e)||[])?.concat(Object.keys(t))}}var fM=1,FO=class extends Tv{type="webgl";constructor(){super(),Dl.defaultProps={...Dl.defaultProps,...eM},Na.adapter=this}isSupported(){return typeof WebGL2RenderingContext<"u"}enforceWebGL2(t){O7(t)}async attach(t){if(t instanceof Na)return t;if(t?.device instanceof Dl)return t.device;if(!Omt(t))throw new Error("Invalid WebGL2RenderingContext");return new Na({_handle:t,createCanvasContext:{canvas:t.canvas,autoResize:!1}})}async create(t={}){qe.groupCollapsed(fM,"WebGLDevice created")();let r=[];(t.debugWebGL||t.debug)&&r.push(n7()),t.debugSpectorJS&&r.push(J9(t));let n=await Promise.allSettled(r);for(let s of n)s.status==="rejected"&&qe.error(`Failed to initialize debug libraries ${s.reason}`)();let i=new Na(t),o=`Created ${i.type}${i.debug?" debug":""} context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return qe.probe(fM,o)(),qe.table(fM,i.info)(),qe.groupEnd(fM)(),i}};function Omt(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}var pM=new FO;var B7,D7,k7={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function dM(){return document.createElement("div")}function Bmt(e){if(!e.picked)return null;if(e.object===B7)return D7;let t={html:Nmt(e.object),style:k7};return D7=t,B7=e.object,t}var Dmt=new Set(["position","index"]);function Nmt(e){let t=dM();for(let r in e){if(Dmt.has(r))continue;let n=dM();n.className="header",n.textContent=r;let i=dM();i.className="value",i.textContent=Fmt(e[r]);let o=dM();kmt(o,n,i),o.appendChild(n),o.appendChild(i),t.appendChild(o)}return t.innerHTML}function kmt(e,t,r){Object.assign(t.style,{fontWeight:700,marginRight:"10px",flex:"1 1 0%"}),Object.assign(r.style,{flex:"none",maxWidth:"250px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}),Object.assign(e.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function Fmt(e){let t;if(Array.isArray(e)&&e.length>4)t=`Array<${e.length}>`;else if(typeof e=="string")t=e;else if(typeof e=="number")t=String(e);else try{t=JSON.stringify(e)}catch{t="<Non-Serializable Object>"}let r=50;return t.length>r&&(t=t.slice(0,r)),t}function N7(e,t){let r,n=e,i="properties",o=/{[^}]*}/g,s=l=>l.replace(/[{}]/g,""),c=[...new Set(e.match(o).map(s))];for(let l of c){if(l.includes(".")){r=t;let h=l.split(".");for(let p of h)if(r.hasOwnProperty(p))r=r[p];else{r=void 0;break}}else t.hasOwnProperty(l)?r=t[l]:t[i]&&t[i].hasOwnProperty(l)?r=t[i][l]:r=void 0;n=n.replaceAll(`{${l}}`,r)}return n}function zO(e){return e?e.html||e.text?t=>{if(!t.picked)return null;let r={style:e.style||k7};return e.html?r.html=N7(e.html,t.object):r.text=N7(e.text,t.object),r}:Bmt:null}function F7(e){let t=document.createElement("link");t.type="text/css",t.rel="stylesheet",t.href=e,document.getElementsByTagName("head")[0].appendChild(t)}function z7(e,t){let r=document.createElement("div");return r.style.width=Number.isFinite(e)?`${e}px`:e,r.style.height=`${t}px`,r.style.position="relative",r}var V7=tc(U7()),zmt="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",jO=V7.default;function j7(e=zmt){F7(e)}function H7(){let e=["mapboxgl-missing-css"];for(let t of e){let r=document.getElementsByClassName(t)[0];r&&r.style&&(r.style.display="none")}}var HO={};function W7(e){if(!HO[e]){let t=document.createElement("script");t.type="text/javascript",t.src=e,document.querySelector("head").appendChild(t),HO[e]=new Promise(n=>{t.onload=n})}return HO[e]}var q7="4.2.1";var Umt=globalThis.loaders?.parseImageNode,WO=typeof Image<"u",qO=typeof ImageBitmap<"u",Vmt=Boolean(Umt),GO=Dp?!0:Vmt;function G7(e){switch(e){case"auto":return qO||WO||GO;case"imagebitmap":return qO;case"image":return WO;case"data":return GO;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function X7(){if(qO)return"imagebitmap";if(WO)return"image";if(GO)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Y7(e){let t=jmt(e);if(!t)throw new Error("Not an image");return t}function Lv(e){switch(Y7(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function jmt(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var Hmt=/^data:image\/svg\+xml/,Wmt=/\.svg((\?|#).*)?$/;function mM(e){return e&&(Hmt.test(e)||Wmt.test(e))}function K7(e,t){if(mM(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return XO(e,t)}function XO(e,t){if(mM(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function AM(e,t,r){let n=K7(e,r),i=self.URL||self.webkitURL,o=typeof n!="string"&&i.createObjectURL(n);try{return await qmt(o||n,t)}finally{o&&i.revokeObjectURL(o)}}async function qmt(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,i)=>{try{r.onload=()=>n(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var Gmt={},Z7=!0;async function $7(e,t,r){let n;mM(r)?n=await AM(e,t,r):n=XO(e,r);let i=t&&t.imagebitmap;return await Xmt(n,i)}async function Xmt(e,t=null){if((Ymt(t)||!Z7)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),Z7=!1}return await createImageBitmap(e)}function Ymt(e){for(let t in e||Gmt)return!1;return!0}function Q7(e){return!Qmt(e,"ftyp",4)||!(e[8]&96)?null:Kmt(e)}function Kmt(e){switch(Zmt(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Zmt(e,t,r){return String.fromCharCode(...e.slice(t,r))}function $mt(e){return[...e].map(t=>t.charCodeAt(0))}function Qmt(e,t,r=0){let n=$mt(t);for(let i=0;i<n.length;++i)if(n[i]!==e[i+r])return!1;return!0}var zf=!1,Ov=!0;function ZA(e){let t=Bv(e);return tAt(t)||nAt(t)||eAt(t)||rAt(t)||Jmt(t)}function Jmt(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Q7(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function tAt(e){let t=Bv(e);return t.byteLength>=24&&t.getUint32(0,zf)===2303741511?{mimeType:"image/png",width:t.getUint32(16,zf),height:t.getUint32(20,zf)}:null}function eAt(e){let t=Bv(e);return t.byteLength>=10&&t.getUint32(0,zf)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Ov),height:t.getUint16(8,Ov)}:null}function rAt(e){let t=Bv(e);return t.byteLength>=14&&t.getUint16(0,zf)===16973&&t.getUint32(2,Ov)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Ov),height:t.getUint32(22,Ov)}:null}function nAt(e){let t=Bv(e);if(!(t.byteLength>=3&&t.getUint16(0,zf)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=iAt(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,zf);if(i.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,zf),width:t.getUint16(o+7,zf)};if(!n.has(s))return null;o+=2,o+=t.getUint16(o,zf)}return null}function iAt(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Bv(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function J7(e,t){let{mimeType:r}=ZA(e)||{},n=globalThis.loaders?.parseImageNode;return Ti(n),await n(e,r)}async function tj(e,t,r){t=t||{};let i=(t.image||{}).type||"auto",{url:o}=r||{},s=oAt(i),c;switch(s){case"imagebitmap":c=await $7(e,t,o);break;case"image":c=await AM(e,t,o);break;case"data":c=await J7(e,t);break;default:Ti(!1)}return i==="data"&&(c=Lv(c)),c}function oAt(e){switch(e){case"auto":case"data":return X7();default:return G7(e),e}}var sAt=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],aAt=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],cAt={image:{type:"auto",decode:!0}},Uf={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:q7,mimeTypes:aAt,extensions:sAt,parse:tj,tests:[e=>Boolean(ZA(new DataView(e)))],options:cAt};var YO={};function KO(e){if(YO[e]===void 0){let t=Dp?uAt(e):lAt(e);YO[e]=t}return YO[e]}function lAt(e){let t=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||t,n=globalThis.loaders?.parseImageNode;return Boolean(n)&&r.includes(e)}function uAt(e){switch(e){case"image/avif":case"image/webp":return hAt(e);default:return!0}}function hAt(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var fAt=new Bl({id:"deck"}),br=fAt;var ZO={};function ej(e){ZO=e}function qs(e,t,r,n){br.level>0&&ZO[e]&&ZO[e].call(null,t,r,n)}function pAt(e){let t=e[0],r=e[e.length-1];return t==="{"&&r==="}"||t==="["&&r==="]"}var rj={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:pAt,parseTextSync:JSON.parse};function dAt(){let e="9.1.0-beta.3",t=globalThis.deck&&globalThis.deck.VERSION;if(t&&t!==e)throw new Error(`deck.gl - multiple versions detected: ${t} vs ${e}`);return t||(br.log(1,`deck.gl ${e}`)(),globalThis.deck={...globalThis.deck,VERSION:e,version:e,log:br,_registerLoggers:ej},HA([rj,[Uf,{imagebitmap:{premultiplyAlpha:"none"}}]])),e}var gM=dAt();function _M(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var $O={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function ij(e){let t={};for(let[r,n]of Object.entries(e))t[r]=mAt(n);return t}function mAt(e){let t=nj(e);if(t!=="object")return{value:e,...$O[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...$O[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=nj(e.value),{...e,...$O[t],type:t}):{type:"object",value:null};throw new Error("props")}function nj(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var oj=`#ifdef MODULE_LOGDEPTH
551
+ ${t}`;let{gl:r}=this.device;if(r.shaderSource(this.handle,t),r.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}qe.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),qe.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let t=async i=>await new Promise(o=>setTimeout(o,i));if(!this.device.features.has("compilation-status-async-webgl")){await t(10);return}let{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,37297))return;await t(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};function l7(e,t,r,n){if(emt(t))return n(e);let i=e;i.pushState();try{return Qdt(e,t),Mh(i.gl,r),n(e)}finally{i.popState()}}function Qdt(e,t){let r=e,{gl:n}=r;if(t.cullMode)switch(t.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(t.frontFace&&n.frontFace(XA("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.unclippedDepth&&e.features.has("depth-clip-control")&&n.enable(34383),t.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0)),t.provokingVertex&&e.features.has("provoking-vertex-webgl")){let o=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,s=XA("provokingVertex",t.provokingVertex,{first:36429,last:36430});o?.provokingVertexWEBGL(s)}if((t.polygonMode||t.polygonOffsetLine)&&e.features.has("polygon-mode-webgl")){if(t.polygonMode){let o=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,s=XA("polygonMode",t.polygonMode,{fill:6914,line:6913});o?.polygonModeWEBGL(1028,s),o?.polygonModeWEBGL(1029,s)}t.polygonOffsetLine&&n.enable(10754)}if(e.features.has("shader-clip-cull-distance-webgl")&&(t.clipDistance0&&n.enable(12288),t.clipDistance1&&n.enable(12289),t.clipDistance2&&n.enable(12290),t.clipDistance3&&n.enable(12291),t.clipDistance4&&n.enable(12292),t.clipDistance5&&n.enable(12293),t.clipDistance6&&n.enable(12294),t.clipDistance7&&n.enable(12295)),t.depthWriteEnabled!==void 0&&n.depthMask(tmt("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(iM("depthCompare",t.depthCompare))),t.stencilWriteMask){let i=t.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(t.stencilReadMask&&qe.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let i=t.stencilReadMask||4294967295,o=iM("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,o,0,i),n.stencilFuncSeparate(1029,o,0,i)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let i=RO("stencilPassOperation",t.stencilPassOperation),o=RO("stencilFailOperation",t.stencilFailOperation),s=RO("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,o,s,i),n.stencilOpSeparate(1029,o,s,i)}switch(t.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break;default:}if(t.blendColorOperation||t.blendAlphaOperation){let i=c7("blendColorOperation",t.blendColorOperation||"add"),o=c7("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(i,o);let s=nM("blendColorSrcFactor",t.blendColorSrcFactor||"one"),c=nM("blendColorDstFactor",t.blendColorDstFactor||"zero"),l=nM("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),h=nM("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(s,c,l,h)}}function iM(e,t){return XA(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function RO(e,t){return XA(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function c7(e,t){return XA(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function nM(e,t){return XA(e,t,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function Jdt(e,t){return`Illegal parameter ${t} for ${e}`}function XA(e,t,r){if(!(t in r))throw new Error(Jdt(e,t));return r[t]}function tmt(e,t){return t}function emt(e){let t=!0;for(let r in e){t=!1;break}return t}function oM(e){let t={};return e.addressModeU&&(t[10242]=LO(e.addressModeU)),e.addressModeV&&(t[10243]=LO(e.addressModeV)),e.addressModeW&&(t[32882]=LO(e.addressModeW)),e.magFilter&&(t[10240]=OO(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=rmt(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[33082]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[33083]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[34892]=34894),e.compare&&(t[34893]=iM("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function LO(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function OO(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function rmt(e,t="none"){if(!t)return OO(e);switch(t){case"none":return OO(e);case"nearest":return e==="nearest"?9984:9986;case"linear":return e==="nearest"?9985:9987}}var YA=class extends rm{device;handle;parameters;constructor(t,r){super(t,r),this.device=t,this.parameters=oM(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(t){for(let[r,n]of Object.entries(t)){let i=Number(r);switch(i){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,i,n);break;default:this.device.gl.samplerParameteri(this.handle,i,n);break}}}};var kf=class extends tm{device;gl;handle;texture;constructor(t,r){super(t,{...fi.defaultProps,...r}),this.device=t,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var nmt="Failed to deduce GL constant from typed array";function u7(e){switch(ArrayBuffer.isView(e)?e.constructor:e){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(nmt)}}function h7(e,t){let{clamped:r=!0}=t||{};switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function BO(e){switch(e){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function f7(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}function KA(e,t,r){if(imt(t))return r(e);let{nocatch:n=!0}=t,i=Sh.get(e);i.push(),Mh(e,t);let o;if(n)o=r(e),i.pop();else try{o=r(e)}finally{i.pop()}return o}function imt(e){for(let t in e)return!1;return!0}function p7(e,t,r){let{dimension:n,width:i,height:o,depth:s=0}=r,{glInternalFormat:c}=r,l=r.glTarget;switch(n){case"2d-array":case"3d":e.texStorage3D(l,t,c,i,o,s);break;default:e.texStorage2D(l,t,c,i,o)}}function DO(e,t,r,n){let{width:i,height:o}=n,{dimension:s,depth:c=0,mipLevel:l=0}=n,{x:h=0,y:p=0,z:x=0}=n,{glFormat:w,glType:E}=n,P=m7(n.glTarget,s,c),B=n.flipY?{[37440]:!0}:{};KA(e,B,()=>{switch(s){case"2d-array":case"3d":e.bindTexture(P,t),e.texSubImage3D(P,l,h,p,x,i,o,c,w,E,r),e.bindTexture(P,null);break;case"2d":case"cube":e.bindTexture(P,t),e.texSubImage2D(P,l,h,p,i,o,w,E,r),e.bindTexture(P,null);break;default:throw new Error(s)}})}function NO(e,t,r){let{dimension:n,width:i,height:o,depth:s=0,mipLevel:c=0,byteOffset:l=0}=r,{x:h=0,y:p=0,z:x=0}=r,{glFormat:w,glType:E,compressed:P}=r,B=m7(r.glTarget,n,s);switch(n){case"2d-array":case"3d":P?e.compressedTexSubImage3D(B,c,h,p,x,i,o,s,w,t,l):e.texSubImage3D(B,c,h,p,x,i,o,s,w,E,t,l);break;case"2d":case"cube":P?e.compressedTexSubImage2D(B,c,h,p,i,o,w,t,l):e.texSubImage2D(B,c,h,p,i,o,w,E,t,l);break;default:throw new Error(n)}}function d7(e){switch(e){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866;case"cube-array":break}throw new Error(e)}function m7(e,t,r){return t==="cube"?34069+r:e}function A7(e,t){let{sourceX:r=0,sourceY:n=0,sourceAttachment:i=0}=t||{},{target:o=null,sourceWidth:s,sourceHeight:c,sourceDepth:l,sourceFormat:h,sourceType:p}=t||{},{framebuffer:x,deleteFramebuffer:w}=_7(e),{gl:E,handle:P}=x;s||=x.width,c||=x.height;let B=x.colorAttachments[i]?.texture;if(!B)throw new Error(`Invalid framebuffer attachment ${i}`);l=B?.depth||1,h||=B?.glFormat||6408,p||=B?.glType||5121,o=smt(o,p,h,s,c,l),p=p||u7(o);let D=E.bindFramebuffer(36160,P);return E.readBuffer(36064+i),E.readPixels(r,n,s,c,h,p,o),E.readBuffer(36064),E.bindFramebuffer(36160,D||null),w&&x.destroy(),o}function g7(e,t){let{target:r,sourceX:n=0,sourceY:i=0,sourceFormat:o=6408,targetByteOffset:s=0}=t||{},{sourceWidth:c,sourceHeight:l,sourceType:h}=t||{},{framebuffer:p,deleteFramebuffer:x}=_7(e);c=c||p.width,l=l||p.height;let w=p;h=h||5121;let E=r;if(!E){let B=BO(o),D=f7(h),W=s+c*l*B*D;E=w.device.createBuffer({byteLength:W})}let P=e.device.createCommandEncoder();return P.copyTextureToBuffer({sourceTexture:e,width:c,height:l,origin:[n,i],destinationBuffer:E,byteOffset:s}),P.destroy(),x&&p.destroy(),E}function _7(e){return e instanceof Lf?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:omt(e),deleteFramebuffer:!0}}function omt(e,t){let{device:r,width:n,height:i,id:o}=e;return r.createFramebuffer({...t,id:`framebuffer-for-${o}`,width:n,height:i,colorAttachments:[e]})}function smt(e,t,r,n,i,o){if(e)return e;t||=5121;let s=h7(t,{clamped:!1}),c=BO(r);return new s(n*i*c)}var Ff=class extends fi{device;gl;handle;sampler=void 0;view=void 0;mipmaps;compressed;glTarget;glFormat;glType;glInternalFormat;textureUnit=0;constructor(t,r){super(t,r);let n={...this.props};n.data=r.data,this.device=t,this.gl=this.device.gl,this.glTarget=d7(this.props.dimension);let i=ZE(this.props.format);this.glInternalFormat=i.internalFormat,this.glFormat=i.format,this.glType=i.type,this.compressed=i.compressed,this.mipmaps=Boolean(this.props.mipmaps),this._initialize(n),Object.seal(this)}_initialize(t){this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:t.data});let{width:r,height:n}=t;if(!r||!n){let i=fi.getTextureDataSize(t.data);r=i?.width||1,n=i?.height||1}if(this.width=r,this.height=n,this.depth=t.depth,this.setSampler(t.sampler),this.view=new kf(this.device,{...this.props,texture:this}),this.bind(),p7(this.gl,this.mipLevels,this),t.data)switch(t.dimension){case"1d":this.setTexture1DData(t.data);break;case"2d":this.setTexture2DData(t.data);break;case"3d":this.setTexture3DData(t.data);break;case"cube":this.setTextureCubeData(t.data);break;case"2d-array":this.setTextureArrayData(t.data);break;case"cube-array":this.setTextureCubeArrayData(t.data);break;default:throw new Error(t.dimension)}this.mipmaps&&this.generateMipmap()}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(t){return new kf(this.device,{...t,texture:this})}setSampler(t={}){let r;t instanceof YA?(this.sampler=t,r=t.props):(this.sampler=new YA(this.device,t),r=t);let n=oM(r);this._setSamplerParameters(n)}generateMipmap(t){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(qe.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!t?.force)))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(n){qe.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}copyExternalImage(t){let r=fi.getExternalImageSize(t.image),n={...fi.defaultCopyExternalImageOptions,...r,...t},{image:i,depth:o,mipLevel:s,x:c,y:l,z:h,flipY:p}=n,{width:x,height:w}=n,{dimension:E,glTarget:P,glFormat:B,glInternalFormat:D,glType:W}=this;if(x=Math.min(x,this.width-c),w=Math.min(w,this.height-l),t.sourceX||t.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");return DO(this.device.gl,this.handle,i,{dimension:E,mipLevel:s,x:c,y:l,z:h,width:x,height:w,depth:o,glFormat:B,glInternalFormat:D,glType:W,glTarget:P,flipY:p}),{width:n.width,height:n.height}}setTexture1DData(t){throw new Error("setTexture1DData not supported in WebGL.")}setTexture2DData(t,r=0){this.bind();let n=fi.normalizeTextureData(t,this);n.length>1&&this.props.mipmaps!==!1&&qe.warn(`Texture ${this.id} mipmap and multiple LODs.`)();for(let i=0;i<n.length;i++){let o=n[i];this._setMipLevel(r,i,o)}this.unbind()}setTexture3DData(t){if(this.props.dimension!=="3d")throw new Error(this.id);ArrayBuffer.isView(t)&&(this.bind(),NO(this.device.gl,t,this),this.unbind())}setTextureCubeData(t,r=0){if(this.props.dimension!=="cube")throw new Error(this.id);for(let n of fi.CubeFaces)this.setTextureCubeFaceData(t[n],n)}setTextureArrayData(t){throw this.props.dimension!=="2d-array"?new Error(this.id):new Error("setTextureArrayData not implemented.")}setTextureCubeArrayData(t){throw new Error("setTextureCubeArrayData not supported in WebGL2.")}setTextureCubeFaceData(t,r,n=0){Array.isArray(t)&&t.length>1&&this.props.mipmaps!==!1&&qe.warn(`${this.id} has mipmap and multiple LODs.`)();let i=fi.CubeFaces.indexOf(r);this.setTexture2DData(t,i)}update(){throw new Error("Texture.update() not implemented. Use ExternalTexture")}setImageDataForFace(t){let{face:r,width:n,height:i,pixels:o,data:s,format:c=6408,type:l=5121}=t,{gl:h}=this,p=o||s;this.bind(),p instanceof Promise?p.then(x=>this.setImageDataForFace(Object.assign({},t,{face:r,data:x,pixels:x}))):this.width||this.height?h.texImage2D(r,0,c,n,i,0,c,l,p):h.texImage2D(r,0,c,c,l,p)}_getImageDataMap(t){for(let r=0;r<fi.CubeFaces.length;++r){let n=fi.CubeFaces[r];t[n]&&(t[34069+r]=t[n],delete t[n])}return t}_setSamplerParameters(t){qe.log(1,`${this.id} sampler parameters`,this.device.getGLKeys(t))(),this.gl.bindTexture(this.glTarget,this.handle);for(let[r,n]of Object.entries(t)){let i=Number(r),o=n;switch(i){case 33082:case 33083:this.gl.texParameterf(this.glTarget,i,o);break;case 10241:this.gl.texParameteri(this.glTarget,i,o);break;case 10242:case 10243:this.gl.texParameteri(this.glTarget,i,o);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,i,o);break;default:this.gl.texParameteri(this.glTarget,i,o);break}}this.gl.bindTexture(this.glTarget,null)}_setMipLevel(t,r,n,i=this.glTarget){if(fi.isExternalImage(n)){DO(this.device.gl,this.handle,n,{...this,depth:t,mipLevel:r,glTarget:i,flipY:this.props.flipY});return}if(fi.isTextureLevelData(n)){NO(this.device.gl,n.data,{...this,depth:t,mipLevel:r,glTarget:i});return}throw new Error("Texture: invalid image data")}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(t){let{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.glTarget,this.handle),t}unbind(t){let{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.glTarget,null),t}};var amt=[1,2,4,8],sM=class extends kp{device;glParameters;constructor(t,r){super(t,r),this.device=t;let n;if(!r?.parameters?.viewport)if(r?.framebuffer){let{width:i,height:o}=r.framebuffer;n=[0,0,i,o]}else{let[i,o]=t.getCanvasContext().getDrawingBufferSize();n=[0,0,i,o]}if(this.device.pushState(),this.setParameters({viewport:n,...this.props.parameters}),this.props.framebuffer){let i=this.props.framebuffer.colorAttachments.map((o,s)=>36064+s);this.device.gl.drawBuffers(i)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(t={}){let r={...this.glParameters};r.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,t.viewport&&(t.viewport.length>=6?(r.viewport=t.viewport.slice(0,4),r.depthRange=[t.viewport[4],t.viewport[5]]):r.viewport=t.viewport),t.scissorRect&&(r.scissorTest=!0,r.scissor=t.scissorRect),t.blendConstant&&(r.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),t[2967]=t.stencilReference),t.colorMask&&(r.colorMask=amt.map(n=>Boolean(n&t.colorMask))),this.glParameters=r,Mh(this.device.gl,r)}beginOcclusionQuery(t){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let t={...this.glParameters},r=0;this.props.clearColors&&this.props.clearColors.forEach((n,i)=>{n&&this.clearColorBuffer(i,n)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(r|=16384,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=256,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=1024,t.clearStencil=this.props.clearStencil),r!==0&&KA(this.device.gl,t,()=>{this.device.gl.clear(r)})}clearColorBuffer(t=0,r=[0,0,0,0]){KA(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,t,r);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,t,r);break;case Float32Array:this.device.gl.clearBufferfv(6144,t,r);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}};function y7(e){return cmt.includes(e)}var cmt=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],x7={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function kO(e){let t=x7[e];if(!t)throw new Error("uniform");let[r,n,,i]=t;return{format:i,components:n,glType:r}}function v7(e){let t=x7[e];if(!t)throw new Error("attribute");let[,r,,n,i]=t;return{attributeType:n,vertexFormat:i,components:r}}function b7(e,t){let r={attributes:[],bindings:[]};r.attributes=lmt(e,t);let n=fmt(e,t);for(let c of n){let l=c.uniforms.map(h=>({name:h.name,format:h.format,byteOffset:h.byteOffset,byteStride:h.byteStride,arrayLength:h.arrayLength}));r.bindings.push({type:"uniform",name:c.name,group:0,location:c.location,visibility:(c.vertex?1:0)&(c.fragment?2:0),minBindingSize:c.byteLength,uniforms:l})}let i=hmt(e,t),o=0;for(let c of i)if(y7(c.type)){let{viewDimension:l,sampleType:h}=dmt(c.type);r.bindings.push({type:"texture",name:c.name,group:0,location:o,viewDimension:l,sampleType:h}),c.textureUnit=o,o+=1}i.length&&(r.uniforms=i);let s=umt(e,t);return s?.length&&(r.varyings=s),r}function lmt(e,t){let r=[],n=e.getProgramParameter(t,35721);for(let i=0;i<n;i++){let o=e.getActiveAttrib(t,i);if(!o)throw new Error("activeInfo");let{name:s,type:c}=o,l=e.getAttribLocation(t,s);if(l>=0){let{attributeType:h}=v7(c),p=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:l,stepMode:p,type:h})}}return r.sort((i,o)=>i.location-o.location),r}function umt(e,t){let r=[],n=e.getProgramParameter(t,35971);for(let i=0;i<n;i++){let o=e.getTransformFeedbackVarying(t,i);if(!o)throw new Error("activeInfo");let{name:s,type:c,size:l}=o,{glType:h,components:p}=kO(c),x={location:i,name:s,type:h,size:l*p};r.push(x)}return r.sort((i,o)=>i.location-o.location),r}function hmt(e,t){let r=[],n=e.getProgramParameter(t,35718);for(let i=0;i<n;i++){let o=e.getActiveUniform(t,i);if(!o)throw new Error("activeInfo");let{name:s,size:c,type:l}=o,{name:h,isArray:p}=mmt(s),x=e.getUniformLocation(t,h),w={location:x,name:h,size:c,type:l,isArray:p};if(r.push(w),w.size>1)for(let E=0;E<w.size;E++){let P=`${h}[${E}]`;x=e.getUniformLocation(t,P);let B={...w,name:P,location:x};r.push(B)}}return r}function fmt(e,t){let r=(o,s)=>e.getActiveUniformBlockParameter(t,o,s),n=[],i=e.getProgramParameter(t,35382);for(let o=0;o<i;o++){let s={name:e.getActiveUniformBlockName(t,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},c=r(o,35395)||[],l=e.getActiveUniforms(t,c,35383),h=e.getActiveUniforms(t,c,35384),p=e.getActiveUniforms(t,c,35387),x=e.getActiveUniforms(t,c,35388);for(let w=0;w<s.uniformCount;++w){let E=e.getActiveUniform(t,c[w]);if(!E)throw new Error("activeInfo");s.uniforms.push({name:E.name,format:kO(l[w]).format,type:l[w],arrayLength:h[w],byteOffset:p[w],byteStride:x[w]})}n.push(s)}return n.sort((o,s)=>o.location-s.location),n}var pmt={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function dmt(e){let t=pmt[e];if(!t)throw new Error("sampler");let[r,n]=t;return{viewDimension:r,sampleType:n}}function mmt(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${e}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function w7(e,t,r,n){let i=e,o=n;o===!0&&(o=1),o===!1&&(o=0);let s=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return e.uniform1i(t,n);case 5126:return e.uniform1fv(t,s);case 35664:return e.uniform2fv(t,s);case 35665:return e.uniform3fv(t,s);case 35666:return e.uniform4fv(t,s);case 5124:return e.uniform1iv(t,s);case 35667:return e.uniform2iv(t,s);case 35668:return e.uniform3iv(t,s);case 35669:return e.uniform4iv(t,s);case 35670:return e.uniform1iv(t,s);case 35671:return e.uniform2iv(t,s);case 35672:return e.uniform3iv(t,s);case 35673:return e.uniform4iv(t,s);case 5125:return i.uniform1uiv(t,s,1);case 36294:return i.uniform2uiv(t,s,2);case 36295:return i.uniform3uiv(t,s,3);case 36296:return i.uniform4uiv(t,s,4);case 35674:return e.uniformMatrix2fv(t,!1,s);case 35675:return e.uniformMatrix3fv(t,!1,s);case 35676:return e.uniformMatrix4fv(t,!1,s);case 35685:return i.uniformMatrix2x3fv(t,!1,s);case 35686:return i.uniformMatrix2x4fv(t,!1,s);case 35687:return i.uniformMatrix3x2fv(t,!1,s);case 35688:return i.uniformMatrix3x4fv(t,!1,s);case 35689:return i.uniformMatrix4x2fv(t,!1,s);case 35690:return i.uniformMatrix4x3fv(t,!1,s)}throw new Error("Illegal uniform")}function T7(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function E7(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number":!1}function Rv(e){return T7(e)||E7(e)}function Amt(e){return Rv(e)!==null||typeof e=="number"||typeof e=="boolean"}function M7(e){let t={bindings:{},uniforms:{}};return Object.keys(e).forEach(r=>{let n=e[r];Amt(n)?t.uniforms[r]=n:t.bindings[r]=n}),t}function S7(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw new Error(e)}}function C7(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;default:throw new Error(e)}}var P7=4,aM=class extends Eh{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(t,r){super(t,r),this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:n,bufferMode:i=35981}=r;n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,i)),this._linkShaders(),qe.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=b7(this.device.gl,this.handle),qe.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=gmt(this.introspectedLayout,r.shaderLayout)}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(t,r){for(let[n,i]of Object.entries(t)){let o=this.shaderLayout.bindings.find(s=>s.name===n)||this.shaderLayout.bindings.find(s=>s.name===`${n}Uniforms`);if(!o){let s=this.shaderLayout.bindings.map(c=>`"${c.name}"`).join(", ");r?.disableWarnings||qe.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${s}`,i)();continue}switch(i||qe.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),o.type){case"uniform":if(!(i instanceof Ch)&&!(i.buffer instanceof Ch))throw new Error("buffer value");break;case"texture":if(!(i instanceof kf||i instanceof Ff||i instanceof Nf))throw new Error("texture value");break;case"sampler":qe.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(o.type)}this.bindings[n]=i}}draw(t){let{renderPass:r,parameters:n=this.props.parameters,topology:i=this.props.topology,vertexArray:o,vertexCount:s,instanceCount:c,isInstanced:l=!1,firstVertex:h=0,transformFeedback:p}=t,x=S7(i),w=Boolean(o.indexBuffer),E=o.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return qe.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return qe.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),o.bindBeforeRender(r),p&&p.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let P=r;return l7(this.device,n,P.glParameters,()=>{w&&l?this.device.gl.drawElementsInstanced(x,s||0,E,h,c||0):w?this.device.gl.drawElements(x,s||0,E,h):l?this.device.gl.drawArraysInstanced(x,h,s||0,c||0):this.device.gl.drawArrays(x,h,s||0),p&&p.end()}),o.unbindAfterRender(r),!0}setUniformsWebGL(t){let{bindings:r}=M7(t);Object.keys(r).forEach(n=>{qe.warn(`Unsupported value "${JSON.stringify(r[n])}" used in setUniforms() for key ${n}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,t)}async _linkShaders(){let{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),qe.time(P7,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),qe.timeEnd(P7,`linkProgram for ${this.id}`)(),qe.level,!this.device.features.has("compilation-status-async-webgl")){let n=this._getLinkStatus();this._reportLinkStatus(n);return}qe.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),qe.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}async _reportLinkStatus(t){switch(t){case"success":return;default:switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`);case"pending":this.vs.asyncCompilationStatus.then(()=>this.vs.debugShader());break;case"success":break}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`);case"pending":this.fs.asyncCompilationStatus.then(()=>this.fs.debugShader());break;case"success":break}let r=this.device.gl.getProgramInfoLog(this.handle);throw new Error(`Error during ${t}: ${r}`)}}_getLinkStatus(){let{gl:t}=this.device;return t.getProgramParameter(this.handle,35714)?(t.validateProgram(this.handle),t.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let t=async i=>await new Promise(o=>setTimeout(o,i));if(!this.device.features.has("compilation-status-async-webgl")){await t(10);return}let{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,37297))return;await t(10)}}_areTexturesRenderable(){let t=!0;for(let r of this.shaderLayout.bindings)!this.bindings[r.name]&&!this.bindings[r.name.replace(/Uniforms$/,"")]&&(qe.warn(`Binding ${r.name} not found in ${this.id}`)(),t=!1);return t}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:t}=this.device;t.useProgram(this.handle);let r=0,n=0;for(let i of this.shaderLayout.bindings){let o=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":let{name:s}=i,c=t.getUniformBlockIndex(this.handle,s);if(c===4294967295)throw new Error(`Invalid uniform block name ${s}`);t.uniformBlockBinding(this.handle,n,c),o instanceof Ch?t.bindBufferBase(35345,n,o.handle):t.bindBufferRange(35345,n,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),n+=1;break;case"texture":if(!(o instanceof kf||o instanceof Ff||o instanceof Nf))throw new Error("texture");let l;if(o instanceof kf)l=o.texture;else if(o instanceof Ff)l=o;else if(o instanceof Nf&&o.colorAttachments[0]instanceof kf)qe.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=o.colorAttachments[0].texture;else throw new Error("No texture");t.activeTexture(33984+r),t.bindTexture(l.glTarget,l.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(let t of this.shaderLayout.uniforms||[]){let{name:r,location:n,type:i,textureUnit:o}=t,s=this.uniforms[r]??o;s!==void 0&&w7(this.device.gl,n,i,s)}}};function gmt(e,t){let r={...e,attributes:e.attributes.map(n=>({...n}))};for(let n of t?.attributes||[]){let i=r.attributes.find(o=>o.name===n.name);i?(i.type=n.type||i.type,i.stepMode=n.stepMode||i.stepMode):qe.warn(`shader layout attribute ${n.name} not present in shader`)}return r}var cM=class extends T_{device;commands=[];constructor(t){super(t,{}),this.device=t}submitCommands(t=this.commands){for(let r of t)switch(r.name){case"copy-buffer-to-buffer":_mt(this.device,r.options);break;case"copy-buffer-to-texture":ymt(this.device,r.options);break;case"copy-texture-to-buffer":xmt(this.device,r.options);break;case"copy-texture-to-texture":vmt(this.device,r.options);break;default:throw new Error(r.name)}}};function _mt(e,t){let r=t.sourceBuffer,n=t.destinationBuffer;e.gl.bindBuffer(36662,r.handle),e.gl.bindBuffer(36663,n.handle),e.gl.copyBufferSubData(36662,36663,t.sourceOffset??0,t.destinationOffset??0,t.size),e.gl.bindBuffer(36662,null),e.gl.bindBuffer(36663,null)}function ymt(e,t){throw new Error("Not implemented")}function xmt(e,t){let{sourceTexture:r,mipLevel:n=0,aspect:i="all",width:o=t.sourceTexture.width,height:s=t.sourceTexture.height,depthOrArrayLayers:c=0,origin:l=[0,0],destinationBuffer:h,byteOffset:p=0,bytesPerRow:x,rowsPerImage:w}=t;if(i!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||c!==0||x||w)throw new Error("not implemented");let{framebuffer:E,destroyFramebuffer:P}=I7(r),B;try{let D=h,W=o||E.width,X=s||E.height,q=ZE(E.colorAttachments[0].texture.props.format),$=q.format,et=q.type;e.gl.bindBuffer(35051,D.handle),B=e.gl.bindFramebuffer(36160,E.handle),e.gl.readPixels(l[0],l[1],W,X,$,et,p)}finally{e.gl.bindBuffer(35051,null),B!==void 0&&e.gl.bindFramebuffer(36160,B),P&&E.destroy()}}function vmt(e,t){let{sourceTexture:r,destinationMipLevel:n=0,origin:i=[0,0],destinationOrigin:o=[0,0],destinationTexture:s}=t,{width:c=t.destinationTexture.width,height:l=t.destinationTexture.height}=t,{framebuffer:h,destroyFramebuffer:p}=I7(r),[x,w]=i,[E,P,B]=o,D=e.gl.bindFramebuffer(36160,h.handle),W=null,X;if(s instanceof Ff)W=s,c=Number.isFinite(c)?c:W.width,l=Number.isFinite(l)?l:W.height,W.bind(0),X=W.glTarget;else throw new Error("invalid destination");switch(X){case 3553:case 34067:e.gl.copyTexSubImage2D(X,n,E,P,x,w,c,l);break;case 35866:case 32879:e.gl.copyTexSubImage3D(X,n,E,P,B,x,w,c,l);break;default:}W&&W.unbind(),e.gl.bindFramebuffer(36160,D),p&&h.destroy()}function I7(e){if(e instanceof fi){let{width:t,height:r,id:n}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${n}`,width:t,height:r,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}var lM=class extends w_{device;commandBuffer;constructor(t,r){super(t,r),this.device=t,this.commandBuffer=new cM(t)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(t){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:t})}copyBufferToTexture(t){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:t})}copyTextureToBuffer(t){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:t})}copyTextureToTexture(t){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:t})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}resolveQuerySet(t,r,n){}};function R7(e){let{target:t,source:r,start:n=0,count:i=1}=e,o=r.length,s=i*o,c=0;for(let l=n;c<o;c++)t[l++]=r[c];for(;c<s;)c<s-c?(t.copyWithin(n+c,n,n+c),c*=2):(t.copyWithin(n+c,n,n+s-c),c=s);return e.target}var R_=class extends E_{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(t){return ML()==="Chrome"}constructor(t,r){super(t,r),this.device=t,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(t){let r=t;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r,this.device.gl.bindVertexArray(null)}setBuffer(t,r){let n=r;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:i,type:o,stride:s,offset:c,normalized:l,integer:h,divisor:p}=this._getAccessor(t);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),h?this.device.gl.vertexAttribIPointer(t,i,o,s,c):this.device.gl.vertexAttribPointer(t,i,o,l,s,c),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(t),this.device.gl.vertexAttribDivisor(t,p||0),this.attributes[t]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(t,r){this._enable(t,!1),this.attributes[t]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){let r=this.attributes[t];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(t,r)}}_getAccessor(t){let r=this.attributeInfos[t];if(!r)throw new Error(`Unknown attribute location ${t}`);let n=YE(r.bufferDataType);return{size:r.bufferComponents,type:n,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(t,r=!0){let i=R_.isConstantAttributeZeroSupported(this.device)||t!==0;(r||i)&&(t=Number(t),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl.bindVertexArray(null))}getConstantBuffer(t,r){let n=bmt(r),i=n.byteLength*t,o=n.length*t;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),s=s||!wmt(n,this.bufferValue),s){let c=TO(r.constructor,o);R7({target:c,source:n,start:0,count:o}),this.buffer.write(c),this.bufferValue=r}return this.buffer}};function bmt(e){return Array.isArray(e)?new Float32Array(e):e}function wmt(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var uM=class extends M_{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(t,r){super(t,r),this.device=t,this.gl=t.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(t="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(C7(t))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(t){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])})}setBuffer(t,r){let n=this._getVaryingIndex(t),{buffer:i,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(n<0){this.unusedBuffers[t]=i,qe.warn(`${this.id} unusedBuffers varying buffer ${t}`)();return}this.buffers[n]={buffer:i,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(n,i,s,o)}getBuffer(t){if(L7(t))return this.buffers[t]||null;let r=this._getVaryingIndex(t);return r>=0?this.buffers[r]:null}bind(t=this.handle){if(typeof t!="function")return this.gl.bindTransformFeedback(36386,t),this;let r;return this._bound?r=t():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=t(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(t){if(t instanceof Ch)return{buffer:t,byteOffset:0,byteLength:t.byteLength};let{buffer:r,byteOffset:n=0,byteLength:i=t.buffer.byteLength}=t;return{buffer:r,byteOffset:n,byteLength:i}}_getVaryingIndex(t){if(L7(t))return Number(t);for(let r of this.layout.varyings)if(t===r.name)return r.location;return-1}_bindBuffers(){for(let t in this.buffers){let{buffer:r,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[t]);this._bindBuffer(Number(t),r,i,n)}}_unbindBuffers(){for(let t in this.buffers)this.gl.bindBufferBase(35982,Number(t),null)}_bindBuffer(t,r,n=0,i){let o=r&&r.handle;!o||i===void 0?this.gl.bindBufferBase(35982,t,o):this.gl.bindBufferRange(35982,t,o,n,i)}};function L7(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var hM=class extends S_{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(t,r){if(super(t,r),this.device=t,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(t){return this._begin(t?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(t){this._queryPending||(this.target=t,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let t=this.device.gl.getQueryParameter(this.handle,34919);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(t=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((n,i)=>{let o=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):r++>t?(i("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};var Na=class extends Dl{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;constructor(t){if(super({...t,id:t.id||o7("webgl-device")}),!t.createCanvasContext)throw new Error("WebGLDevice requires props.createCanvasContext to be set");let r=t.createCanvasContext===!0?{}:t.createCanvasContext,n=r.canvas?.gl?.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new JE(this,r),this.lost=new Promise(p=>{this._resolveContextLost=p});let i={...t.webgl};r.alphaMode==="premultiplied"&&(i.premultipliedAlpha=!0),t.powerPreference!==void 0&&(i.powerPreference=t.powerPreference);let s=this.props._handle||j9(this.canvasContext.canvas,{onContextLost:p=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:p=>console.log("WebGL context restored")},i);if(!s)throw new Error("WebGL context creation failed");if(n=s.device,n)throw new Error(`WebGL context already attached to device ${n.id}`);this.handle=s,this.gl=s,this.spectorJS=t7({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=H9(this.gl,this._extensions),this.limits=new QE(this.gl),this.features=new $E(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),r.autoResize!==!1&&this.canvasContext.resize(),new Sh(this.gl,{log:(...p)=>qe.log(1,...p)()}).trackState(this.gl,{copyState:!1});let l=t.debugWebGL||t.debug,h=t.debugWebGL;l&&(this.gl=i7(this.gl,{debugWebGL:l,traceWebGL:h}),qe.warn("WebGL debug mode activated. Performance reduced.")(),t.debugWebGL&&(qe.level=Math.max(qe.level,1)))}destroy(){}get isLost(){return this.gl.isContextLost()}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){let r=this._normalizeBufferProps(t);return new Ch(this,r)}createTexture(t){return new Ff(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new YA(this,t)}createShader(t){return new rM(this,t)}createFramebuffer(t){return new Nf(this,t)}createVertexArray(t){return new R_(this,t)}createTransformFeedback(t){return new uM(this,t)}createQuerySet(t){return new hM(this,t)}createRenderPipeline(t){return new aM(this,t)}beginRenderPass(t){return new sM(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(t){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(t={}){return new lM(this,t)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(t,r){return A7(t,r)}readPixelsToBufferWebGL(t,r){return g7(t,r)}setParametersWebGL(t){Mh(this.gl,t)}getParametersWebGL(t){return XE(this.gl,t)}withParametersWebGL(t,r){return KA(this.gl,t,r)}resetWebGL(){qe.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),z9(this.gl)}_getDeviceSpecificTextureFormatCapabilities(t){return K9(this.gl,t,this._extensions)}loseDevice(){let t=!1,n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(t=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),t}pushState(){Sh.get(this.gl).push()}popState(){Sh.get(this.gl).pop()}setSpectorMetadata(t,r){t.__SPECTOR_Metadata=r}getGLKey(t,r){let n=Number(t);for(let i in this.gl)if(this.gl[i]===n)return`GL.${i}`;return r?.emptyIfUnknown?"":String(t)}getGLKeys(t){let r={emptyIfUnknown:!0};return Object.entries(t).reduce((n,[i,o])=>(n[`${i}:${this.getGLKey(i,r)}`]=`${o}:${this.getGLKey(o,r)}`,n),{})}_constants;setConstantAttributeWebGL(t,r){let n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);let i=this._constants[t];switch(i&&Smt(i,r)&&qe.info(1,`setConstantAttributeWebGL(${t}) could have been skipped, value unchanged`)(),this._constants[t]=r,r.constructor){case Float32Array:Tmt(this,t,r);break;case Int32Array:Emt(this,t,r);break;case Uint32Array:Mmt(this,t,r);break;default:throw new Error("constant")}}getExtension(t){return Df(this.gl,t,this._extensions),this._extensions}};function Tmt(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:}}function Emt(e,t,r){e.gl.vertexAttribI4iv(t,r)}function Mmt(e,t,r){e.gl.vertexAttribI4uiv(t,r)}function Smt(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var Cmt={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},Pmt=e=>({drawBuffersWEBGL(t){return e.drawBuffers(t)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),Imt=e=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return e.createVertexArray()},deleteVertexArrayOES(t){return e.deleteVertexArray(t)},isVertexArrayOES(t){return e.isVertexArray(t)},bindVertexArrayOES(t){return e.bindVertexArray(t)}}),Rmt=e=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...t){return e.drawArraysInstanced(...t)},drawElementsInstancedANGLE(...t){return e.drawElementsInstanced(...t)},vertexAttribDivisorANGLE(...t){return e.vertexAttribDivisor(...t)}});function O7(e=!0){let t=HTMLCanvasElement.prototype;if(!e&&t.originalGetContext){t.getContext=t.originalGetContext,t.originalGetContext=void 0;return}t.originalGetContext=t.getContext,t.getContext=function(r,n){if(r==="webgl"||r==="experimental-webgl"){let i=this.originalGetContext("webgl2",n);return i instanceof HTMLElement&&Lmt(i),i}return this.originalGetContext(r,n)}}function Lmt(e){e.getExtension("EXT_color_buffer_float");let t={...Cmt,WEBGL_disjoint_timer_query:e.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:Pmt(e),OES_vertex_array_object:Imt(e),ANGLE_instanced_arrays:Rmt(e)},r=e.getExtension;e.getExtension=function(i){let o=r.call(e,i);return o||(i in t?t[i]:null)};let n=e.getSupportedExtensions;e.getSupportedExtensions=function(){return(n.apply(e)||[])?.concat(Object.keys(t))}}var fM=1,FO=class extends Tv{type="webgl";constructor(){super(),Dl.defaultProps={...Dl.defaultProps,...eM},Na.adapter=this}isSupported(){return typeof WebGL2RenderingContext<"u"}enforceWebGL2(t){O7(t)}async attach(t){if(t instanceof Na)return t;if(t?.device instanceof Dl)return t.device;if(!Omt(t))throw new Error("Invalid WebGL2RenderingContext");return new Na({_handle:t,createCanvasContext:{canvas:t.canvas,autoResize:!1}})}async create(t={}){qe.groupCollapsed(fM,"WebGLDevice created")();let r=[];(t.debugWebGL||t.debug)&&r.push(n7()),t.debugSpectorJS&&r.push(J9(t));let n=await Promise.allSettled(r);for(let s of n)s.status==="rejected"&&qe.error(`Failed to initialize debug libraries ${s.reason}`)();let i=new Na(t),o=`Created ${i.type}${i.debug?" debug":""} context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return qe.probe(fM,o)(),qe.table(fM,i.info)(),qe.groupEnd(fM)(),i}};function Omt(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}var pM=new FO;var B7,D7,k7={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function dM(){return document.createElement("div")}function Bmt(e){if(!e.picked)return null;if(e.object===B7)return D7;let t={html:Nmt(e.object),style:k7};return D7=t,B7=e.object,t}var Dmt=new Set(["position","index"]);function Nmt(e){let t=dM();for(let r in e){if(Dmt.has(r))continue;let n=dM();n.className="header",n.textContent=r;let i=dM();i.className="value",i.textContent=Fmt(e[r]);let o=dM();kmt(o,n,i),o.appendChild(n),o.appendChild(i),t.appendChild(o)}return t.innerHTML}function kmt(e,t,r){Object.assign(t.style,{fontWeight:700,marginRight:"10px",flex:"1 1 0%"}),Object.assign(r.style,{flex:"none",maxWidth:"250px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}),Object.assign(e.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function Fmt(e){let t;if(Array.isArray(e)&&e.length>4)t=`Array<${e.length}>`;else if(typeof e=="string")t=e;else if(typeof e=="number")t=String(e);else try{t=JSON.stringify(e)}catch{t="<Non-Serializable Object>"}let r=50;return t.length>r&&(t=t.slice(0,r)),t}function N7(e,t){let r,n=e,i="properties",o=/{[^}]*}/g,s=l=>l.replace(/[{}]/g,""),c=[...new Set(e.match(o).map(s))];for(let l of c){if(l.includes(".")){r=t;let h=l.split(".");for(let p of h)if(r.hasOwnProperty(p))r=r[p];else{r=void 0;break}}else t.hasOwnProperty(l)?r=t[l]:t[i]&&t[i].hasOwnProperty(l)?r=t[i][l]:r=void 0;n=n.replaceAll(`{${l}}`,r)}return n}function zO(e){return e?e.html||e.text?t=>{if(!t.picked)return null;let r={style:e.style||k7};return e.html?r.html=N7(e.html,t.object):r.text=N7(e.text,t.object),r}:Bmt:null}function F7(e){let t=document.createElement("link");t.type="text/css",t.rel="stylesheet",t.href=e,document.getElementsByTagName("head")[0].appendChild(t)}function z7(e,t){let r=document.createElement("div");return r.style.width=Number.isFinite(e)?`${e}px`:e,r.style.height=`${t}px`,r.style.position="relative",r}var V7=tc(U7()),zmt="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",jO=V7.default;function j7(e=zmt){F7(e)}function H7(){let e=["mapboxgl-missing-css"];for(let t of e){let r=document.getElementsByClassName(t)[0];r&&r.style&&(r.style.display="none")}}var HO={};function W7(e){if(!HO[e]){let t=document.createElement("script");t.type="text/javascript",t.src=e,document.querySelector("head").appendChild(t),HO[e]=new Promise(n=>{t.onload=n})}return HO[e]}var q7="4.2.1";var Umt=globalThis.loaders?.parseImageNode,WO=typeof Image<"u",qO=typeof ImageBitmap<"u",Vmt=Boolean(Umt),GO=Dp?!0:Vmt;function G7(e){switch(e){case"auto":return qO||WO||GO;case"imagebitmap":return qO;case"image":return WO;case"data":return GO;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function X7(){if(qO)return"imagebitmap";if(WO)return"image";if(GO)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Y7(e){let t=jmt(e);if(!t)throw new Error("Not an image");return t}function Lv(e){switch(Y7(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function jmt(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var Hmt=/^data:image\/svg\+xml/,Wmt=/\.svg((\?|#).*)?$/;function mM(e){return e&&(Hmt.test(e)||Wmt.test(e))}function K7(e,t){if(mM(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return XO(e,t)}function XO(e,t){if(mM(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function AM(e,t,r){let n=K7(e,r),i=self.URL||self.webkitURL,o=typeof n!="string"&&i.createObjectURL(n);try{return await qmt(o||n,t)}finally{o&&i.revokeObjectURL(o)}}async function qmt(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,i)=>{try{r.onload=()=>n(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var Gmt={},Z7=!0;async function $7(e,t,r){let n;mM(r)?n=await AM(e,t,r):n=XO(e,r);let i=t&&t.imagebitmap;return await Xmt(n,i)}async function Xmt(e,t=null){if((Ymt(t)||!Z7)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),Z7=!1}return await createImageBitmap(e)}function Ymt(e){for(let t in e||Gmt)return!1;return!0}function Q7(e){return!Qmt(e,"ftyp",4)||!(e[8]&96)?null:Kmt(e)}function Kmt(e){switch(Zmt(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Zmt(e,t,r){return String.fromCharCode(...e.slice(t,r))}function $mt(e){return[...e].map(t=>t.charCodeAt(0))}function Qmt(e,t,r=0){let n=$mt(t);for(let i=0;i<n.length;++i)if(n[i]!==e[i+r])return!1;return!0}var zf=!1,Ov=!0;function ZA(e){let t=Bv(e);return tAt(t)||nAt(t)||eAt(t)||rAt(t)||Jmt(t)}function Jmt(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Q7(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function tAt(e){let t=Bv(e);return t.byteLength>=24&&t.getUint32(0,zf)===2303741511?{mimeType:"image/png",width:t.getUint32(16,zf),height:t.getUint32(20,zf)}:null}function eAt(e){let t=Bv(e);return t.byteLength>=10&&t.getUint32(0,zf)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Ov),height:t.getUint16(8,Ov)}:null}function rAt(e){let t=Bv(e);return t.byteLength>=14&&t.getUint16(0,zf)===16973&&t.getUint32(2,Ov)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Ov),height:t.getUint32(22,Ov)}:null}function nAt(e){let t=Bv(e);if(!(t.byteLength>=3&&t.getUint16(0,zf)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=iAt(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,zf);if(i.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,zf),width:t.getUint16(o+7,zf)};if(!n.has(s))return null;o+=2,o+=t.getUint16(o,zf)}return null}function iAt(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Bv(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function J7(e,t){let{mimeType:r}=ZA(e)||{},n=globalThis.loaders?.parseImageNode;return Ti(n),await n(e,r)}async function tj(e,t,r){t=t||{};let i=(t.image||{}).type||"auto",{url:o}=r||{},s=oAt(i),c;switch(s){case"imagebitmap":c=await $7(e,t,o);break;case"image":c=await AM(e,t,o);break;case"data":c=await J7(e,t);break;default:Ti(!1)}return i==="data"&&(c=Lv(c)),c}function oAt(e){switch(e){case"auto":case"data":return X7();default:return G7(e),e}}var sAt=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],aAt=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],cAt={image:{type:"auto",decode:!0}},Uf={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:q7,mimeTypes:aAt,extensions:sAt,parse:tj,tests:[e=>Boolean(ZA(new DataView(e)))],options:cAt};var YO={};function KO(e){if(YO[e]===void 0){let t=Dp?uAt(e):lAt(e);YO[e]=t}return YO[e]}function lAt(e){let t=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||t,n=globalThis.loaders?.parseImageNode;return Boolean(n)&&r.includes(e)}function uAt(e){switch(e){case"image/avif":case"image/webp":return hAt(e);default:return!0}}function hAt(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var fAt=new Bl({id:"deck"}),br=fAt;var ZO={};function ej(e){ZO=e}function qs(e,t,r,n){br.level>0&&ZO[e]&&ZO[e].call(null,t,r,n)}function pAt(e){let t=e[0],r=e[e.length-1];return t==="{"&&r==="}"||t==="["&&r==="]"}var rj={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:pAt,parseTextSync:JSON.parse};function dAt(){let e="9.1.0",t=globalThis.deck&&globalThis.deck.VERSION;if(t&&t!==e)throw new Error(`deck.gl - multiple versions detected: ${t} vs ${e}`);return t||(br.log(1,`deck.gl ${e}`)(),globalThis.deck={...globalThis.deck,VERSION:e,version:e,log:br,_registerLoggers:ej},HA([rj,[Uf,{imagebitmap:{premultiplyAlpha:"none"}}]])),e}var gM=dAt();function _M(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var $O={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function ij(e){let t={};for(let[r,n]of Object.entries(e))t[r]=mAt(n);return t}function mAt(e){let t=nj(e);if(t!=="object")return{value:e,...$O[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...$O[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=nj(e.value),{...e,...$O[t],type:t}):{type:"object",value:null};throw new Error("props")}function nj(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var oj=`#ifdef MODULE_LOGDEPTH
552
552
  logdepth_adjustPosition(gl_Position);
553
553
  #endif
554
554
  `,sj=`#ifdef MODULE_MATERIAL
@@ -3604,7 +3604,7 @@ void main() {
3604
3604
 
3605
3605
  fragColor.w = 1.0;
3606
3606
  }
3607
- `;return new jn(e,{bufferLayout:t.bufferLayout,modules:[...t.modules||[],IX],defines:{...t.defines,NON_INSTANCED_MODEL:1,NUM_CHANNELS:t.channelCount},isInstanced:!1,vs:n,fs:i,topology:"point-list"})}var hbt=`uniform aggregatorTransformUniforms {
3607
+ `;return new jn(e,{bufferLayout:t.bufferLayout,modules:[...t.modules||[],IX],defines:{...t.defines,NON_INSTANCED_MODEL:1,NUM_CHANNELS:t.channelCount},isInstanced:!1,vs:n,fs:i,topology:"point-list",disableWarnings:!0})}var hbt=`uniform aggregatorTransformUniforms {
3608
3608
  ivec4 binIdRange;
3609
3609
  bvec3 isCount;
3610
3610
  bvec3 isMean;