@deck.gl/jupyter-widget 9.0.2 → 9.0.3

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
@@ -540,7 +540,7 @@ __p+='`),f}),o+=`';
540
540
  } catch (error) {
541
541
  console.error(error);
542
542
  throw error;
543
- }`}function CP(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2?arguments[2]:void 0,i=r||new Set;if(t){if(Z6(t))i.add(t);else if(Z6(t.buffer))i.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let n in t)CP(t[n],e,i)}}return r===void 0?Array.from(i):[]}function Z6(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}var MP=()=>{},yp=class{static isSupported(){return typeof Worker<"u"&&Za||typeof I0<"u"&&!Za}constructor(e){this.name=void 0,this.source=void 0,this.url=void 0,this.terminated=!1,this.worker=void 0,this.onMessage=void 0,this.onError=void 0,this._loadableURL="";let{name:r,source:i,url:n}=e;yl(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=MP,this.onError=o=>console.log(o),this.worker=Za?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=MP,this.onError=MP,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,r){r=r||CP(e),this.worker.postMessage(e,r)}_getErrorFromErrorEvent(e){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,e.message&&(r+=`${e.message} in `),e.lineno&&(r+=`:${e.lineno}:${e.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=Y6({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},e.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},e.onmessageerror=r=>console.error(r),e}_createNodeWorker(){let e;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new I0(i,{eval:!1})}else if(this.source)e=new I0(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",r=>{this.onMessage(r)}),e.on("error",r=>{this.onError(r)}),e.on("exit",r=>{}),e}};var Kv=class{static isSupported(){return yp.isSupported()}constructor(e){this.name="unnamed",this.source=void 0,this.url=void 0,this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1,this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(o,s,l)=>o.done(l),i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(o,s)=>o.error(s),n=new Promise(o=>(this.jobQueue.push({name:e,onMessage:r,onError:i,onStart:o}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:e,backlog:this.jobQueue.length});let i=new Yv(r.name,e);e.onMessage=n=>r.onMessage(i,n.type,n.payload),e.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}catch(n){console.error(`Worker exception: ${n}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!Za||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new yp({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return X6?this.maxMobileConcurrency:this.maxConcurrency}};var wre={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},xc=class{static isSupported(){return yp.isSupported()}static getWorkerFarm(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return xc._workerFarm=xc._workerFarm||new xc({}),xc._workerFarm.setProps(e),xc._workerFarm}constructor(e){this.props=void 0,this.workerPools=new Map,this.props={...wre},this.setProps(e),this.workerPools=new Map}destroy(){for(let e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:r,source:i,url:n}=e,o=this.workerPools.get(r);return o||(o=new Kv({name:r,source:i,url:n}),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}}};xc._workerFarm=void 0;function IP(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e[t.id]||{},i=Za?`${t.id}-worker.js`:`${t.id}-worker-node.js`,n=r.workerUrl;if(!n&&t.id==="compression"&&(n=e.workerUrl),e._workerType==="test"&&(Za?n=`modules/${t.module}/dist/${i}`:n=`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!n){let o=t.version;o==="latest"&&(o=W6);let s=o?`@${o}`:"";n=`https://unpkg.com/@loaders.gl/${t.module}${s}/dist/${i}`}return yl(n),n}function PP(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:qv;yl(t,"no worker provided");let r=t.version;return!(!e||!r)}var RP={};async function _f(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return e&&(t=J6(t,e,r,i)),RP[t]=RP[t]||Tre(t),await RP[t]}function J6(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(!r.useLocalLibraries&&t.startsWith("http"))return t;i=i||t;let n=r.modules||{};return n[i]?n[i]:Za?r.CDN?(yl(r.CDN.startsWith("http")),`${r.CDN}/${e}@${qv}/dist/libs/${i}`):Xv?`../src/libs/${i}`:`modules/${e}/src/libs/${i}`:`modules/${e}/dist/libs/${i}`}async function Tre(t){if(t.endsWith("wasm"))return await Sre(t);if(!Za)try{return Zc&&Zc.requireFromFile&&await Zc.requireFromFile(t)}catch(r){return console.error(r),null}if(Xv)return importScripts(t);let e=await Cre(t);return Ere(e,t)}function Ere(t,e){if(!Za)return Zc.requireFromString&&Zc.requireFromString(t,e);if(Xv)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function Sre(t){return Za||!Zc.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await Zc.readFileAsArrayBuffer(t)}async function Cre(t){return Za||!Zc.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await Zc.readFileAsText(t)}function BP(t,e){return!xc.isSupported()||!Za&&!(e!=null&&e._nodeWorkers)?!1:t.worker&&e?.worker}async function OP(t,e,r,i,n){let o=t.id,s=IP(t,r),u=xc.getWorkerFarm(r).getWorkerPool({name:o,url:s});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let f=await u.startJob("process-on-worker",Mre.bind(null,n));return f.postMessage("process",{input:e,options:r,context:i}),await(await f.result).result}async function Mre(t,e,r,i){switch(r){case"done":e.done(i);break;case"error":e.error(new Error(i.error));break;case"process":let{id:n,input:o,options:s}=i;try{let l=await t(o,s);e.postMessage("done",{id:n,result:l})}catch(l){let u=l instanceof Error?l.message:"unknown error";e.postMessage("error",{id:n,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function $6(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?Q6(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?Q6(t,0,e):""}function Q6(t,e,r){if(t.byteLength<=e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function DP(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${$6(t)}"`)}}function LP(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;let i=new Uint8Array(t),n=new Uint8Array(e);for(let o=0;o<i.length;++o)if(i[o]!==n[o])return!1;return!0}function FP(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return eU(e)}function eU(t){let e=t.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=e.reduce((o,s)=>o+s.byteLength,0),i=new Uint8Array(r),n=0;for(let o of e)i.set(o,n),n+=o.byteLength;return i.buffer}function Zv(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let i=e,n=i&&i.length>1&&i[0].constructor||null;if(!n)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let o=i.reduce((u,f)=>u+f.length,0),s=new n(o),l=0;for(let u of i)s.set(u,l),l+=u.length;return s}function KA(t,e,r){let i=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(i).buffer}function vp(t,e){return On(t>=0),On(e>0),t+(e-1)&~(e-1)}function NP(t,e,r){let i;if(t instanceof ArrayBuffer)i=new Uint8Array(t);else{let n=t.byteOffset,o=t.byteLength;i=new Uint8Array(t.buffer||t.arrayBuffer,n,o)}return e.set(i,r),r+vp(i.byteLength,4)}async function kP(t){let e=[];for await(let r of t)e.push(r);return FP(...e)}function Jv(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var ZA=class{constructor(e,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=e,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(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Jv(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Jv()-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 Bl=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:i}=e,n=this.stats[r];return n||(e instanceof ZA?n=e:n=new ZA(r,i),this.stats[r]=n),n}};var Ire="Queued Requests",Pre="Active Requests",Rre="Cancelled Requests",Bre="Queued Requests Ever",Ore="Active Requests Ever",Dre={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},xp=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.props=void 0,this.stats=void 0,this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.updateTimer=null,this.props={...Dre,...e},this.stats=new Bl({id:this.props.id}),this.stats.get(Ire),this.stats.get(Pre),this.stats.get(Rre),this.stats.get(Bre),this.stats.get(Ore)}scheduleRequest(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let i={handle:e,priority:0,getPriority:r},n=new Promise(o=>(i.resolve=o,i));return this.requestQueue.push(i),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){let{handle:r,resolve:i}=e,n=!1,o=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({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 e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let i=this.requestQueue.shift();i&&this._issueRequest(i)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let i=e[r];this._updateRequest(i)||(e.splice(r,1),this.requestMap.delete(i.handle),r--)}e.sort((r,i)=>r.priority-i.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var Lre="",tU={};function UP(t){for(let e in tU)if(t.startsWith(e)){let r=tU[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${Lre}${t}`),t}function rU(t){return t&&typeof t=="object"&&t.isBuffer}function L2(t){if(rU(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if(typeof t=="string"){let e=t;return new TextEncoder().encode(e).buffer}if(t&&typeof t=="object"&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}var Jc={};As(Jc,{dirname:()=>Nre,filename:()=>Fre,join:()=>kre,resolve:()=>Ure});function iU(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(t=window.location)===null||t===void 0?void 0:t.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function Fre(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function Nre(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function kre(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let i="/";return e=e.map((n,o)=>(o&&(n=n.replace(new RegExp(`^${i}`),"")),o!==e.length-1&&(n=n.replace(new RegExp(`${i}$`),"")),n)),e.join(i)}function Ure(){let t=[];for(let n=0;n<arguments.length;n++)t[n]=n<0||arguments.length<=n?void 0:arguments[n];let e="",r=!1,i;for(let n=t.length-1;n>=-1&&!r;n--){let o;n>=0?o=t[n]:(i===void 0&&(i=iU()),o=i),o.length!==0&&(e=`${o}/${e}`,r=o.charCodeAt(0)===Qv)}return e=zre(e,!r),r?`/${e}`:e.length>0?e:"."}var Qv=47,zP=46;function zre(t,e){let r="",i=-1,n=0,o,s=!1;for(let l=0;l<=t.length;++l){if(l<t.length)o=t.charCodeAt(l);else{if(o===Qv)break;o=Qv}if(o===Qv){if(!(i===l-1||n===1))if(i!==l-1&&n===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==zP||r.charCodeAt(r.length-2)!==zP){if(r.length>2){let u=r.length-1,f=u;for(;f>=0&&r.charCodeAt(f)!==Qv;--f);if(f!==u){r=f===-1?"":r.slice(0,f),i=l,n=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",i=l,n=0,s=!1;continue}}e&&(r.length>0?r+="/..":r="..",s=!0)}else{let u=t.slice(i+1,l);r.length>0?r+=`/${u}`:r=u,s=!1}i=l,n=0}else o===zP&&n!==-1?++n:n=-1}return r}var F2=class{constructor(e){this.data=void 0,this.fetch=void 0,this.loadOptions=void 0,this._needsRefresh=!0,this.props=void 0,this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=Vre(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}};function Vre(t){let e=t?.fetch;if(e&&typeof e=="function")return(i,n)=>e(i,n);let r=t?.fetch;return r&&typeof r!="function"?i=>fetch(i,r):i=>fetch(i)}var Iu=class extends F2{};Iu.type="template";Iu.testURL=t=>!1;var jre=t=>typeof t=="boolean",$v=t=>typeof t=="function",JA=t=>t!==null&&typeof t=="object",VP=t=>JA(t)&&t.constructor==={}.constructor;var nU=t=>Boolean(t)&&typeof t[Symbol.iterator]=="function",oU=t=>t&&typeof t[Symbol.asyncIterator]=="function";var Pu=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json;var Ru=t=>typeof Blob<"u"&&t instanceof Blob,sU=t=>t&&typeof t=="object"&&t.isBuffer;var Hre=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||JA(t)&&$v(t.tee)&&$v(t.cancel)&&$v(t.getReader);var Gre=t=>JA(t)&&$v(t.read)&&$v(t.pipe)&&jre(t.readable),N2=t=>Hre(t)||Gre(t);var Wre=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,qre=/^([-\w.]+\/[-\w.+]+)/;function aU(t){let e=qre.exec(t);return e?e[1]:t}function jP(t){let e=Wre.exec(t);return e?e[1]:""}var lU=/\?.*/;function cU(t){let e=t.match(lU);return e&&e[0]}function P0(t){return t.replace(lU,"")}function QA(t){return Pu(t)?t.url:Ru(t)?t.name||"":typeof t=="string"?t:""}function ex(t){if(Pu(t)){let e=t,r=e.headers.get("content-type")||"",i=P0(e.url);return aU(r)||jP(i)}return Ru(t)?t.type||"":typeof t=="string"?jP(t):""}function uU(t){return Pu(t)?t.headers["content-length"]||-1:Ru(t)?t.size:typeof t=="string"?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}async function k2(t){if(Pu(t))return t;let e={},r=uU(t);r>=0&&(e["content-length"]=String(r));let i=QA(t),n=ex(t);n&&(e["content-type"]=n);let o=await Yre(t);o&&(e["x-first-bytes"]=o),typeof t=="string"&&(t=new TextEncoder().encode(t));let s=new Response(t,{headers:e});return Object.defineProperty(s,"url",{value:i}),s}async function hU(t){if(!t.ok){let e=await Xre(t);throw new Error(e)}}async function Xre(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{let r=t.headers.get("Content-Type"),i=t.statusText;r!=null&&r.includes("application/json")&&(i+=` ${await t.text()}`),e+=i,e=e.length>60?`${e.slice(0,60)}...`:e}catch{}return e}async function Yre(t){if(typeof t=="string")return`data:,${t.slice(0,5)}`;if(t instanceof Blob){let r=t.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=o=>{var s;return i(o==null||(s=o.target)===null||s===void 0?void 0:s.result)},n.readAsDataURL(r)})}if(t instanceof ArrayBuffer){let r=t.slice(0,5);return`data:base64,${Kre(r)}`}return null}function Kre(t){let e="",r=new Uint8Array(t);for(let i=0;i<r.byteLength;i++)e+=String.fromCharCode(r[i]);return btoa(e)}function Zre(t){return!Jre(t)&&!Qre(t)}function Jre(t){return t.startsWith("http:")||t.startsWith("https:")}function Qre(t){return t.startsWith("data:")}async function R0(t,e){if(typeof t=="string"){let n=UP(t);if(Zre(n)){var r;if((r=globalThis.loaders)!==null&&r!==void 0&&r.fetchNode){var i;return(i=globalThis.loaders)===null||i===void 0?void 0:i.fetchNode(n,e)}}return await fetch(n,e)}return await k2(t)}var U2=globalThis,$re=globalThis.document||{},z2=globalThis.process||{},eie=globalThis.console,fU=globalThis.navigator||{};function V2(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,r=t||e;return Boolean(r&&r.indexOf("Electron")>=0)}function Ol(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||V2()}function HP(t){return!t&&!Ol()?"Node":V2(t)?"Electron":(t||fU.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var GP="4.0.7";function rie(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var j2=class{constructor(e,r,i="sessionStorage"){this.storage=rie(i),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function dU(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function pU(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var H2;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(H2||(H2={}));var iie=10;function AU(t){return typeof t!="string"?t:(t=t.toUpperCase(),H2[t]||H2.WHITE)}function mU(t,e,r){return!Ol&&typeof t=="string"&&(e&&(t=`\x1B[${AU(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${AU(r)+iie}m${t}\x1B[49m`)),t}function gU(t,e=["constructor"]){let r=Object.getPrototypeOf(t),i=Object.getOwnPropertyNames(r),n=t;for(let o of i){let s=n[o];typeof s=="function"&&(e.find(l=>o===l)||(n[o]=s.bind(t)))}}function tx(t,e){if(!t)throw new Error(e||"Assertion failed")}function $A(){let t;if(Ol()&&U2.performance)t=U2?.performance?.now?.();else if("hrtime"in z2){let e=z2?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var B0={debug:Ol()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},nie={enabled:!0,level:0};function O0(){}var _U={},yU={once:!0},bc=class{constructor({id:e}={id:""}){this.VERSION=GP,this._startTs=$A(),this._deltaTs=$A(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new j2(`__probe-${this.id}__`,nie),this.timeStamp(`${this.id} started`),gU(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number(($A()-this._startTs).toPrecision(10))}getDelta(){return Number(($A()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e){return this._getLogFunction(0,e,B0.warn,arguments,yU)}error(e){return this._getLogFunction(0,e,B0.error,arguments)}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r){return this._getLogFunction(e,r,B0.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,B0.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,B0.debug||B0.info,arguments,yU)}table(e,r,i){return r?this._getLogFunction(e,r,console.table||O0,i&&[i],{tag:sie(r)}):O0}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||O0)}group(e,r,i={collapsed:!1}){let n=vU({logLevel:e,message:r,opts:i}),{collapsed:o}=i;return n.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,r,i={}){return this.group(e,r,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||O0)}withGroup(e,r,i){this.group(e,r)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=xU(e)}_getLogFunction(e,r,i,n,o){if(this._shouldLog(e)){o=vU({logLevel:e,message:r,args:n,opts:o}),i=i||o.method,tx(i),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=$A();let s=o.tag||o.message;if(o.once&&s)if(!_U[s])_U[s]=$A();else return O0;return r=oie(this.id,o.message,o),i.bind(console,r,...o.args)}return O0}};bc.VERSION=GP;function xU(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return tx(Number.isFinite(e)&&e>=0),e}function vU(t){let{logLevel:e,message:r}=t;t.logLevel=xU(e);let i=t.args?Array.from(t.args):[];for(;i.length&&i.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&i.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let n=typeof t.message;return tx(n==="string"||n==="object"),Object.assign(t,{args:i},t.opts)}function oie(t,e,r){if(typeof e=="string"){let i=r.time?pU(dU(r.total)):"";e=r.time?`${t}: ${i} ${e}`:`${t}: ${e}`,e=mU(e,r.color,r.background)}return e}function sie(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe={};var WP=new bc({id:"@probe.gl/log"});var qP=new bc({id:"loaders.gl"}),G2=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},W2=class{constructor(){this.console=void 0,this.console=console}log(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return this.console.log.bind(this.console,...r)}info(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return this.console.info.bind(this.console,...r)}warn(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return this.console.warn.bind(this.console,...r)}error(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return this.console.error.bind(this.console,...r)}};var XP={fetch:null,mimeType:void 0,nothrow:!1,log:new W2,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:gd,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},bU={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 YP(){globalThis.loaders=globalThis.loaders||{};let{loaders:t}=globalThis;return t._state=t._state||{},t._state}function KP(){let t=YP();return t.globalOptions=t.globalOptions||{...XP},t.globalOptions}function EU(t,e,r,i){return r=r||[],r=Array.isArray(r)?r:[r],aie(t,r),cie(e,t,i)}function aie(t,e){wU(t,null,XP,bU,e);for(let r of e){let i=t&&t[r.id]||{},n=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};wU(i,r.id,n,o,e)}}function wU(t,e,r,i,n){let o=e||"Top level",s=e?`${e}.`:"";for(let l in t){let u=!e&&JA(t[l]),f=l==="baseUri"&&!e,v=l==="workerUrl"&&e;if(!(l in r)&&!f&&!v){if(l in i)qP.warn(`${o} loader option '${s}${l}' no longer supported, use '${i[l]}'`)();else if(!u){let T=lie(l,n);qP.warn(`${o} loader option '${s}${l}' not recognized. ${T}`)()}}}}function lie(t,e){let r=t.toLowerCase(),i="";for(let n of e)for(let o in n.options){if(t===o)return`Did you mean '${n.id}.${o}'?`;let s=o.toLowerCase();(r.startsWith(s)||s.startsWith(r))&&(i=i||`Did you mean '${n.id}.${o}'?`)}return i}function cie(t,e,r){let n={...t.options||{}};return uie(n,r),n.log===null&&(n.log=new G2),TU(n,KP()),TU(n,e),n}function TU(t,e){for(let r in e)if(r in e){let i=e[r];VP(i)&&VP(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function uie(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}function rx(t){var e;return t?(Array.isArray(t)&&(t=t[0]),Array.isArray((e=t)===null||e===void 0?void 0:e.extensions)):!1}function ix(t){var e,r;On(t,"null loader"),On(rx(t),"invalid loader");let i;return Array.isArray(t)&&(i=t[1],t=t[0],t={...t,options:{...t.options,...i}}),((e=t)!==null&&e!==void 0&&e.parseTextSync||(r=t)!==null&&r!==void 0&&r.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}var SU=()=>{let t=YP();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function em(t){let e=SU();t=Array.isArray(t)?t:[t];for(let r of t){let i=ix(r);e.find(n=>i===n)||e.unshift(i)}}function CU(){return SU()}var MU=new bc({id:"loaders.gl"});var hie=/\.([^.]+)$/;async function RU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!BU(t))return null;let n=IU(t,e,{...r,nothrow:!0},i);if(n)return n;if(Ru(t)&&(t=await t.slice(0,10).arrayBuffer(),n=IU(t,e,r,i)),!n&&!(r!=null&&r.nothrow))throw new Error(OU(t));return n}function IU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!BU(t))return null;if(e&&!Array.isArray(e))return ix(e);let n=[];e&&(n=n.concat(e)),r!=null&&r.ignoreRegisteredLoaders||n.push(...CU()),die(n);let o=fie(t,n,r,i);if(!o&&!(r!=null&&r.nothrow))throw new Error(OU(t));return o}function fie(t,e,r,i){let n=QA(t),o=ex(t),s=P0(n)||i?.url,l=null,u="";if(r!=null&&r.mimeType&&(l=ZP(e,r?.mimeType),u=`match forced by supplied MIME type ${r?.mimeType}`),l=l||pie(e,s),u=u||(l?`matched url ${s}`:""),l=l||ZP(e,o),u=u||(l?`matched MIME type ${o}`:""),l=l||mie(e,t),u=u||(l?`matched initial data ${DU(t)}`:""),r!=null&&r.fallbackMimeType&&(l=l||ZP(e,r?.fallbackMimeType),u=u||(l?`matched fallback MIME type ${o}`:"")),u){var f;MU.log(1,`selectLoader selected ${(f=l)===null||f===void 0?void 0:f.name}: ${u}.`)}return l}function BU(t){return!(t instanceof Response&&t.status===204)}function OU(t){let e=QA(t),r=ex(t),i="No valid loader found (";i+=e?`${Jc.filename(e)}, `:"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=t?DU(t):"";return i+=n?` first bytes: "${n}"`:"first bytes: not available",i+=")",i}function die(t){for(let e of t)ix(e)}function pie(t,e){let r=e&&hie.exec(e),i=r&&r[1];return i?Aie(t,i):null}function Aie(t,e){e=e.toLowerCase();for(let r of t)for(let i of r.extensions)if(i.toLowerCase()===e)return r;return null}function ZP(t,e){for(let r of t)if(r.mimeTypes&&r.mimeTypes.includes(e)||e===`application/x.${r.id}`)return r;return null}function mie(t,e){if(!e)return null;for(let r of t)if(typeof e=="string"){if(gie(e,r))return r}else if(ArrayBuffer.isView(e)){if(PU(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer&&PU(e,0,r))return r;return null}function gie(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some(i=>t.startsWith(i))}function PU(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>_ie(t,e,r,n))}function _ie(t,e,r,i){if(i instanceof ArrayBuffer)return LP(i,t,i.byteLength);switch(typeof i){case"function":return i(t);case"string":let n=JP(t,e,i.length);return i===n;default:return!1}}function DU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?JP(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?JP(t,0,e):""}function JP(t,e,r){if(t.byteLength<e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function*LU(t,e){let r=e?.chunkSize||262144,i=0,n=new TextEncoder;for(;i<t.length;){let o=Math.min(t.length-i,r),s=t.slice(i,i+o);i+=o,yield n.encode(s)}}function FU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){let{chunkSize:r=262144}=e,i=0;for(;i<t.byteLength;){let n=Math.min(t.byteLength-i,r),o=new ArrayBuffer(n),s=new Uint8Array(t,i,n);new Uint8Array(o).set(s),i+=n,yield o}}()}async function*NU(t,e){let r=e?.chunkSize||1048576,i=0;for(;i<t.size;){let n=i+r,o=await t.slice(i,n).arrayBuffer();i=n,yield o}}function QP(t,e){return gd?yie(t,e):vie(t,e)}async function*yie(t,e){let r=t.getReader(),i;try{for(;;){let n=i||r.read();e!=null&&e._streamReadAhead&&(i=r.read());let{done:o,value:s}=await n;if(o)return;yield L2(s)}}catch{r.releaseLock()}}async function*vie(t,e){for await(let r of t)yield L2(r)}function kU(t,e){if(typeof t=="string")return LU(t,e);if(t instanceof ArrayBuffer)return FU(t,e);if(Ru(t))return NU(t,e);if(N2(t))return QP(t,e);if(Pu(t))return QP(t.body,e);throw new Error("makeIterator")}var UU="Cannot convert supplied data type";function xie(t,e,r){if(e.text&&typeof t=="string")return t;if(sU(t)&&(t=t.buffer),t instanceof ArrayBuffer){let i=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let i=t.buffer,n=t.byteLength||t.length;return(t.byteOffset!==0||n!==i.byteLength)&&(i=i.slice(t.byteOffset,t.byteOffset+n)),i}throw new Error(UU)}async function zU(t,e,r){let i=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if(typeof t=="string"||i)return xie(t,e,r);if(Ru(t)&&(t=await k2(t)),Pu(t)){let n=t;return await hU(n),e.binary?await n.arrayBuffer():await n.text()}if(N2(t)&&(t=kU(t,r)),nU(t)||oU(t))return kP(t);throw new Error(UU)}function q2(t,e){let r=KP(),i=t||r;return typeof i.fetch=="function"?i.fetch:JA(i.fetch)?n=>R0(n,i.fetch):e!=null&&e.fetch?e?.fetch:R0}function VU(t,e,r){if(r)return r;let i={fetch:q2(e,t),...t};if(i.url){let n=P0(i.url);i.baseUrl=n,i.queryString=cU(i.url),i.filename=Jc.filename(n),i.baseUrl=Jc.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function jU(t,e){if(t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){let i=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...i]:i}return r&&r.length?r:void 0}async function bp(t,e,r,i){e&&!Array.isArray(e)&&!rx(e)&&(i=void 0,r=e,e=void 0),t=await t,r=r||{};let n=QA(t),s=jU(e,i),l=await RU(t,s,r);return l?(r=EU(r,l,s,n),i=VU({url:n,_parse:bp,loaders:s},r,i||null),await bie(l,t,r,i)):null}async function bie(t,e,r,i){if(PP(t),r=Wv(t.options,r),Pu(e)){let o=e,{ok:s,redirected:l,status:u,statusText:f,type:v,url:T}=o,E=Object.fromEntries(o.headers.entries());i.response={headers:E,ok:s,redirected:l,status:u,statusText:f,type:v,url:T}}e=await zU(e,t,r);let n=t;if(n.parseTextSync&&typeof e=="string")return n.parseTextSync(e,r,i);if(BP(t,r))return await OP(t,e,r,i,bp);if(n.parseText&&typeof e=="string")return await n.parseText(e,r,i);if(n.parse)return await n.parse(e,r,i);throw yl(!n.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}async function _a(t,e,r,i){let n,o;!Array.isArray(e)&&!rx(e)?(n=[],o=e,i=void 0):(n=e,o=r);let s=q2(o),l=t;return typeof t=="string"&&(l=await s(t)),Ru(t)&&(l=await s(t)),Array.isArray(n)?await bp(l,n,o):await bp(l,n,o)}var Kt=new bc({id:"luma.gl"});var $P=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new Bl({id:e})),this.stats.get(e)}},D0=new $P;function wie(){let t="9.0.6",e="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==t)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${t}`);return globalThis.luma||(Ol()&&Kt.log(1,`${t} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:t,version:t,log:Kt,stats:D0}),t}var HU=wie();function Tie(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)?t:null}function wp(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number"?t:null:Tie(t)}var e3={};function oa(t="id"){e3[t]=e3[t]||1;let e=e3[t]++;return`${t}-${e}`}function Tp(t){let e=!0;for(let r in t){e=!1;break}return e}var hn=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,r,i){if(!e)throw new Error("no device");this._device=e,this.props=Eie(r,i);let n=this.props.id!=="undefined"?this.props.id:oa(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(e,r=this[Symbol.toStringTag]){let i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.get(`${r} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${r}s Created`).incrementCount(),e.get(`${r}s Active`).incrementCount()}};si(hn,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Eie(t,e){let r={...e};for(let i in t)t[i]!==void 0&&(r[i]=t[i]);return r}var nx=class extends hn{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,r){let i={...r};(r.usage||0)&nx.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?i.indexType="uint32":r.data instanceof Uint16Array&&(i.indexType="uint16")),super(e,i,nx.defaultProps),this.usage=r.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,r){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,r,i){let n=ArrayBuffer.isView(e)?e.buffer:e,o=Math.min(e?e.byteLength:i,nx.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(o):r===0&&i===e.byteLength?this.debugData=n.slice(0,o):this.debugData=n.slice(r,r+o)}},Xi=nx;si(Xi,"defaultProps",{...hn.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),si(Xi,"MAP_READ",1),si(Xi,"MAP_WRITE",2),si(Xi,"COPY_SRC",4),si(Xi,"COPY_DST",8),si(Xi,"INDEX",16),si(Xi,"VERTEX",32),si(Xi,"UNIFORM",64),si(Xi,"STORAGE",128),si(Xi,"INDIRECT",256),si(Xi,"QUERY_RESOLVE",512),si(Xi,"DEBUG_DATA_MAX_LENGTH",32);function X2(t){let e=GU[t],r=Sie(e),i=t.includes("norm"),n=!i&&!t.startsWith("float"),o=t.startsWith("s");return{dataType:GU[t],byteLength:r,integer:n,signed:o,normalized:i}}function Sie(t){return Cie[t]}var GU={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Cie={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Mie=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Iie=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function WU(t){return Mie.some(e=>t.startsWith(e))}function Y2(t){let e=Iie.exec(t);if(e){let[,r,i,n,o,s]=e;if(r){let l=`${n}${i}`,u=X2(l);return{format:r,components:r.length,srgb:o==="-srgb",unsized:s==="-unsized",webgl:s==="-webgl",...u}}}return Rie(t)}var Pie={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Rie(t){let e=Pie[t];if(!e)throw new Error(`Unknown format ${t}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var ox=class{},sx=class{features;disabledFeatures;constructor(e=[],r){this.features=new Set(e),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures[e]&&this.features.has(e)}},t3=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...t3.defaultProps,...e},this.id=this.props.id||oa(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=D0;_lumaData={};isTextureFormatCompressed(e){return WU(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,r){throw new Error("not implemented")}readPixelsToBufferWebGL(e,r){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,r){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let r={...e};return(e.usage||0)&Xi.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?r.indexType="uint32":e.data instanceof Uint16Array?r.indexType="uint16":Kt.warn("indices buffer content must be of integer type")()),r}},wc=t3;si(wc,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(Kt.get("debug")),spector:Boolean(Kt.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>Kt.error(e.message)}),si(wc,"VERSION",HU);function Yi(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}var ax=new Map,Tc=class{static registerDevices(e){for(let r of e)Yi(r.type&&r.isSupported&&r.create),ax.set(r.type,r)}static getAvailableDevices(){return Array.from(ax).map(e=>e.type)}static getSupportedDevices(){return Array.from(ax).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(wc.defaultProps,e)}static async attachDevice(e){let r=qU(e.devices)||ax;if(e.handle instanceof WebGL2RenderingContext){let i=r.get("webgl");if(i)return await i.attach(e.handle)}if(e.handle===null){let i=r.get("unknown");if(i)return await i.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(e={}){e={...wc.defaultProps,...e},e.gl&&(e.type="webgl");let r=qU(e.devices)||ax;switch(e.type){case"webgpu":let i=r.get("webgpu");if(i)return await i.create(e);break;case"webgl":let n=r.get("webgl");if(n)return await n.create(e);break;case"unknown":let o=r.get("unknown");if(o)return await o.create(e);break;case"best-available":if(i=r.get("webgpu"),i?.isSupported?.())return await i.create(e);if(n=r.get("webgl"),n?.isSupported?.())return await n.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}};si(Tc,"defaultProps",{...wc.defaultProps,type:"best-available",devices:void 0}),si(Tc,"stats",D0),si(Tc,"log",Kt);function qU(t){if(!t||t?.length===0)return null;let e=new Map;for(let r of t)e.set(r.type,r);return e}var Bie=Ol()&&typeof document<"u",K2=()=>Bie&&document.readyState==="complete",Oie={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},Ep=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return K2()}constructor(e){if(this.props={...Oie,...e},e=this.props,!Ol()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=Fie(e.canvas):this.canvas=e.canvas;else{let r=Nie(e),i=Lie(e?.container||null);i.insertBefore(r,i.firstChild),this.canvas=r,e?.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&&e.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let i of r)i.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}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 e=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*e,r.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,r]=this.getPixelSize();return e/r}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:r}=this._canvasSizeInfo;return r?e/r:1}catch{return 1}}cssToDevicePixels(e,r=!0){let i=this.cssToDeviceRatio(),[n,o]=this.getDrawingBufferSize();return kie(e,i,n,o,r)}setDevicePixelRatio(e,r={}){if(!this.htmlCanvas)return;let i="width"in r?r.width:this.htmlCanvas.clientWidth,n="height"in r?r.height:this.htmlCanvas.clientHeight;(!i||!n)&&(Kt.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,i=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==i||o.clientHeight!==n||o.devicePixelRatio!==e){let s=e,l=Math.floor(i*s),u=Math.floor(n*s);this.htmlCanvas.width=l,this.htmlCanvas.height=u;let[f,v]=this.getDrawingBufferSize();(f!==l||v!==u)&&(s=Math.min(f/i,v/n),this.htmlCanvas.width=Math.floor(i*s),this.htmlCanvas.height=Math.floor(n*s),Kt.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};si(Ep,"pageLoaded",Die());function Die(){return K2()||typeof window>"u"?Promise.resolve():new Promise(t=>{window.addEventListener("load",()=>t())})}function Lie(t){if(typeof t=="string"){let e=document.getElementById(t);if(!e&&!K2())throw new Error(`Accessing '${t}' before page was loaded`);if(!e)throw new Error(`${t} is not an HTML element`);return e}else if(t)return t;return document.body}function Fie(t){let e=document.getElementById(t);if(!e&&!K2())throw new Error(`Accessing '${t}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function Nie(t){let{width:e,height:r}=t,i=document.createElement("canvas");return i.id="lumagl-auto-created-canvas",i.width=e||1,i.height=r||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(r)?`${r}px`:"100%",i}function kie(t,e,r,i,n){let o=t,s=XU(o[0],e,r),l=YU(o[1],e,i,n),u=XU(o[0]+1,e,r),f=u===r-1?u:u-1;u=YU(o[1]+1,e,i,n);let v;return n?(u=u===0?u:u+1,v=l,l=u):v=u===i-1?u:u-1,{x:s,y:l,width:Math.max(f-s+1,1),height:Math.max(v-l+1,1)}}function XU(t,e,r){return Math.min(Math.round(t*e),r-1)}function YU(t,e,r,i){return i?Math.max(0,r-1-Math.round(t*e)):Math.min(Math.round(t*e),r-1)}var r3=class extends hn{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,r,i=r3.defaultProps){super(e,r,i),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.updateTimestamp=e.incrementTimestamp()}},bo=r3;si(bo,"defaultProps",{...hn.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),si(bo,"COPY_SRC",1),si(bo,"COPY_DST",2),si(bo,"TEXTURE_BINDING",4),si(bo,"STORAGE_BINDING",8),si(bo,"RENDER_ATTACHMENT",16);var i3=class extends hn{get[Symbol.toStringTag](){return"TextureView"}constructor(e,r){super(e,r,i3.defaultProps)}},Sp=i3;si(Sp,"defaultProps",{...hn.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});function ZU(t,e,r){let i="",n=e.split(/\r?\n/),o=t.slice().sort((s,l)=>s.lineNum-l.lineNum);switch(r?.showSourceCode||"no"){case"all":let s=0;for(let l=1;l<=n.length;l++)for(i+=JU(n[l-1],l,r);o.length>s&&o[s].lineNum===l;){let u=o[s++];i+=KU(u,n,u.lineNum,{...r,inlineSource:!1})}return i;case"issues":case"no":for(let l of t)i+=KU(l,n,l.lineNum,{inlineSource:r?.showSourceCode!=="no"});return i}}function KU(t,e,r,i){if(i?.inlineSource){let n=Uie(e,r),o=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^
543
+ }`}function CP(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2?arguments[2]:void 0,i=r||new Set;if(t){if(Z6(t))i.add(t);else if(Z6(t.buffer))i.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let n in t)CP(t[n],e,i)}}return r===void 0?Array.from(i):[]}function Z6(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}var MP=()=>{},yp=class{static isSupported(){return typeof Worker<"u"&&Za||typeof I0<"u"&&!Za}constructor(e){this.name=void 0,this.source=void 0,this.url=void 0,this.terminated=!1,this.worker=void 0,this.onMessage=void 0,this.onError=void 0,this._loadableURL="";let{name:r,source:i,url:n}=e;yl(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=MP,this.onError=o=>console.log(o),this.worker=Za?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=MP,this.onError=MP,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,r){r=r||CP(e),this.worker.postMessage(e,r)}_getErrorFromErrorEvent(e){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,e.message&&(r+=`${e.message} in `),e.lineno&&(r+=`:${e.lineno}:${e.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=Y6({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},e.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},e.onmessageerror=r=>console.error(r),e}_createNodeWorker(){let e;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new I0(i,{eval:!1})}else if(this.source)e=new I0(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",r=>{this.onMessage(r)}),e.on("error",r=>{this.onError(r)}),e.on("exit",r=>{}),e}};var Kv=class{static isSupported(){return yp.isSupported()}constructor(e){this.name="unnamed",this.source=void 0,this.url=void 0,this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1,this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(o,s,l)=>o.done(l),i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(o,s)=>o.error(s),n=new Promise(o=>(this.jobQueue.push({name:e,onMessage:r,onError:i,onStart:o}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:e,backlog:this.jobQueue.length});let i=new Yv(r.name,e);e.onMessage=n=>r.onMessage(i,n.type,n.payload),e.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}catch(n){console.error(`Worker exception: ${n}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!Za||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new yp({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return X6?this.maxMobileConcurrency:this.maxConcurrency}};var wre={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},xc=class{static isSupported(){return yp.isSupported()}static getWorkerFarm(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return xc._workerFarm=xc._workerFarm||new xc({}),xc._workerFarm.setProps(e),xc._workerFarm}constructor(e){this.props=void 0,this.workerPools=new Map,this.props={...wre},this.setProps(e),this.workerPools=new Map}destroy(){for(let e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:r,source:i,url:n}=e,o=this.workerPools.get(r);return o||(o=new Kv({name:r,source:i,url:n}),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}}};xc._workerFarm=void 0;function IP(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e[t.id]||{},i=Za?`${t.id}-worker.js`:`${t.id}-worker-node.js`,n=r.workerUrl;if(!n&&t.id==="compression"&&(n=e.workerUrl),e._workerType==="test"&&(Za?n=`modules/${t.module}/dist/${i}`:n=`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!n){let o=t.version;o==="latest"&&(o=W6);let s=o?`@${o}`:"";n=`https://unpkg.com/@loaders.gl/${t.module}${s}/dist/${i}`}return yl(n),n}function PP(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:qv;yl(t,"no worker provided");let r=t.version;return!(!e||!r)}var RP={};async function _f(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return e&&(t=J6(t,e,r,i)),RP[t]=RP[t]||Tre(t),await RP[t]}function J6(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(!r.useLocalLibraries&&t.startsWith("http"))return t;i=i||t;let n=r.modules||{};return n[i]?n[i]:Za?r.CDN?(yl(r.CDN.startsWith("http")),`${r.CDN}/${e}@${qv}/dist/libs/${i}`):Xv?`../src/libs/${i}`:`modules/${e}/src/libs/${i}`:`modules/${e}/dist/libs/${i}`}async function Tre(t){if(t.endsWith("wasm"))return await Sre(t);if(!Za)try{return Zc&&Zc.requireFromFile&&await Zc.requireFromFile(t)}catch(r){return console.error(r),null}if(Xv)return importScripts(t);let e=await Cre(t);return Ere(e,t)}function Ere(t,e){if(!Za)return Zc.requireFromString&&Zc.requireFromString(t,e);if(Xv)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function Sre(t){return Za||!Zc.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await Zc.readFileAsArrayBuffer(t)}async function Cre(t){return Za||!Zc.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await Zc.readFileAsText(t)}function BP(t,e){return!xc.isSupported()||!Za&&!(e!=null&&e._nodeWorkers)?!1:t.worker&&e?.worker}async function OP(t,e,r,i,n){let o=t.id,s=IP(t,r),u=xc.getWorkerFarm(r).getWorkerPool({name:o,url:s});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let f=await u.startJob("process-on-worker",Mre.bind(null,n));return f.postMessage("process",{input:e,options:r,context:i}),await(await f.result).result}async function Mre(t,e,r,i){switch(r){case"done":e.done(i);break;case"error":e.error(new Error(i.error));break;case"process":let{id:n,input:o,options:s}=i;try{let l=await t(o,s);e.postMessage("done",{id:n,result:l})}catch(l){let u=l instanceof Error?l.message:"unknown error";e.postMessage("error",{id:n,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function $6(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?Q6(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?Q6(t,0,e):""}function Q6(t,e,r){if(t.byteLength<=e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function DP(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${$6(t)}"`)}}function LP(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;let i=new Uint8Array(t),n=new Uint8Array(e);for(let o=0;o<i.length;++o)if(i[o]!==n[o])return!1;return!0}function FP(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return eU(e)}function eU(t){let e=t.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=e.reduce((o,s)=>o+s.byteLength,0),i=new Uint8Array(r),n=0;for(let o of e)i.set(o,n),n+=o.byteLength;return i.buffer}function Zv(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let i=e,n=i&&i.length>1&&i[0].constructor||null;if(!n)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let o=i.reduce((u,f)=>u+f.length,0),s=new n(o),l=0;for(let u of i)s.set(u,l),l+=u.length;return s}function KA(t,e,r){let i=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(i).buffer}function vp(t,e){return On(t>=0),On(e>0),t+(e-1)&~(e-1)}function NP(t,e,r){let i;if(t instanceof ArrayBuffer)i=new Uint8Array(t);else{let n=t.byteOffset,o=t.byteLength;i=new Uint8Array(t.buffer||t.arrayBuffer,n,o)}return e.set(i,r),r+vp(i.byteLength,4)}async function kP(t){let e=[];for await(let r of t)e.push(r);return FP(...e)}function Jv(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var ZA=class{constructor(e,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=e,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(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Jv(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Jv()-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 Bl=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:i}=e,n=this.stats[r];return n||(e instanceof ZA?n=e:n=new ZA(r,i),this.stats[r]=n),n}};var Ire="Queued Requests",Pre="Active Requests",Rre="Cancelled Requests",Bre="Queued Requests Ever",Ore="Active Requests Ever",Dre={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},xp=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.props=void 0,this.stats=void 0,this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.updateTimer=null,this.props={...Dre,...e},this.stats=new Bl({id:this.props.id}),this.stats.get(Ire),this.stats.get(Pre),this.stats.get(Rre),this.stats.get(Bre),this.stats.get(Ore)}scheduleRequest(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let i={handle:e,priority:0,getPriority:r},n=new Promise(o=>(i.resolve=o,i));return this.requestQueue.push(i),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){let{handle:r,resolve:i}=e,n=!1,o=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({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 e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let i=this.requestQueue.shift();i&&this._issueRequest(i)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let i=e[r];this._updateRequest(i)||(e.splice(r,1),this.requestMap.delete(i.handle),r--)}e.sort((r,i)=>r.priority-i.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var Lre="",tU={};function UP(t){for(let e in tU)if(t.startsWith(e)){let r=tU[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${Lre}${t}`),t}function rU(t){return t&&typeof t=="object"&&t.isBuffer}function L2(t){if(rU(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if(typeof t=="string"){let e=t;return new TextEncoder().encode(e).buffer}if(t&&typeof t=="object"&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}var Jc={};As(Jc,{dirname:()=>Nre,filename:()=>Fre,join:()=>kre,resolve:()=>Ure});function iU(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(t=window.location)===null||t===void 0?void 0:t.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function Fre(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function Nre(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function kre(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let i="/";return e=e.map((n,o)=>(o&&(n=n.replace(new RegExp(`^${i}`),"")),o!==e.length-1&&(n=n.replace(new RegExp(`${i}$`),"")),n)),e.join(i)}function Ure(){let t=[];for(let n=0;n<arguments.length;n++)t[n]=n<0||arguments.length<=n?void 0:arguments[n];let e="",r=!1,i;for(let n=t.length-1;n>=-1&&!r;n--){let o;n>=0?o=t[n]:(i===void 0&&(i=iU()),o=i),o.length!==0&&(e=`${o}/${e}`,r=o.charCodeAt(0)===Qv)}return e=zre(e,!r),r?`/${e}`:e.length>0?e:"."}var Qv=47,zP=46;function zre(t,e){let r="",i=-1,n=0,o,s=!1;for(let l=0;l<=t.length;++l){if(l<t.length)o=t.charCodeAt(l);else{if(o===Qv)break;o=Qv}if(o===Qv){if(!(i===l-1||n===1))if(i!==l-1&&n===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==zP||r.charCodeAt(r.length-2)!==zP){if(r.length>2){let u=r.length-1,f=u;for(;f>=0&&r.charCodeAt(f)!==Qv;--f);if(f!==u){r=f===-1?"":r.slice(0,f),i=l,n=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",i=l,n=0,s=!1;continue}}e&&(r.length>0?r+="/..":r="..",s=!0)}else{let u=t.slice(i+1,l);r.length>0?r+=`/${u}`:r=u,s=!1}i=l,n=0}else o===zP&&n!==-1?++n:n=-1}return r}var F2=class{constructor(e){this.data=void 0,this.fetch=void 0,this.loadOptions=void 0,this._needsRefresh=!0,this.props=void 0,this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=Vre(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}};function Vre(t){let e=t?.fetch;if(e&&typeof e=="function")return(i,n)=>e(i,n);let r=t?.fetch;return r&&typeof r!="function"?i=>fetch(i,r):i=>fetch(i)}var Iu=class extends F2{};Iu.type="template";Iu.testURL=t=>!1;var jre=t=>typeof t=="boolean",$v=t=>typeof t=="function",JA=t=>t!==null&&typeof t=="object",VP=t=>JA(t)&&t.constructor==={}.constructor;var nU=t=>Boolean(t)&&typeof t[Symbol.iterator]=="function",oU=t=>t&&typeof t[Symbol.asyncIterator]=="function";var Pu=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json;var Ru=t=>typeof Blob<"u"&&t instanceof Blob,sU=t=>t&&typeof t=="object"&&t.isBuffer;var Hre=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||JA(t)&&$v(t.tee)&&$v(t.cancel)&&$v(t.getReader);var Gre=t=>JA(t)&&$v(t.read)&&$v(t.pipe)&&jre(t.readable),N2=t=>Hre(t)||Gre(t);var Wre=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,qre=/^([-\w.]+\/[-\w.+]+)/;function aU(t){let e=qre.exec(t);return e?e[1]:t}function jP(t){let e=Wre.exec(t);return e?e[1]:""}var lU=/\?.*/;function cU(t){let e=t.match(lU);return e&&e[0]}function P0(t){return t.replace(lU,"")}function QA(t){return Pu(t)?t.url:Ru(t)?t.name||"":typeof t=="string"?t:""}function ex(t){if(Pu(t)){let e=t,r=e.headers.get("content-type")||"",i=P0(e.url);return aU(r)||jP(i)}return Ru(t)?t.type||"":typeof t=="string"?jP(t):""}function uU(t){return Pu(t)?t.headers["content-length"]||-1:Ru(t)?t.size:typeof t=="string"?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}async function k2(t){if(Pu(t))return t;let e={},r=uU(t);r>=0&&(e["content-length"]=String(r));let i=QA(t),n=ex(t);n&&(e["content-type"]=n);let o=await Yre(t);o&&(e["x-first-bytes"]=o),typeof t=="string"&&(t=new TextEncoder().encode(t));let s=new Response(t,{headers:e});return Object.defineProperty(s,"url",{value:i}),s}async function hU(t){if(!t.ok){let e=await Xre(t);throw new Error(e)}}async function Xre(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{let r=t.headers.get("Content-Type"),i=t.statusText;r!=null&&r.includes("application/json")&&(i+=` ${await t.text()}`),e+=i,e=e.length>60?`${e.slice(0,60)}...`:e}catch{}return e}async function Yre(t){if(typeof t=="string")return`data:,${t.slice(0,5)}`;if(t instanceof Blob){let r=t.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=o=>{var s;return i(o==null||(s=o.target)===null||s===void 0?void 0:s.result)},n.readAsDataURL(r)})}if(t instanceof ArrayBuffer){let r=t.slice(0,5);return`data:base64,${Kre(r)}`}return null}function Kre(t){let e="",r=new Uint8Array(t);for(let i=0;i<r.byteLength;i++)e+=String.fromCharCode(r[i]);return btoa(e)}function Zre(t){return!Jre(t)&&!Qre(t)}function Jre(t){return t.startsWith("http:")||t.startsWith("https:")}function Qre(t){return t.startsWith("data:")}async function R0(t,e){if(typeof t=="string"){let n=UP(t);if(Zre(n)){var r;if((r=globalThis.loaders)!==null&&r!==void 0&&r.fetchNode){var i;return(i=globalThis.loaders)===null||i===void 0?void 0:i.fetchNode(n,e)}}return await fetch(n,e)}return await k2(t)}var U2=globalThis,$re=globalThis.document||{},z2=globalThis.process||{},eie=globalThis.console,fU=globalThis.navigator||{};function V2(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,r=t||e;return Boolean(r&&r.indexOf("Electron")>=0)}function Ol(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||V2()}function HP(t){return!t&&!Ol()?"Node":V2(t)?"Electron":(t||fU.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var GP="4.0.7";function rie(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var j2=class{constructor(e,r,i="sessionStorage"){this.storage=rie(i),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function dU(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function pU(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var H2;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(H2||(H2={}));var iie=10;function AU(t){return typeof t!="string"?t:(t=t.toUpperCase(),H2[t]||H2.WHITE)}function mU(t,e,r){return!Ol&&typeof t=="string"&&(e&&(t=`\x1B[${AU(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${AU(r)+iie}m${t}\x1B[49m`)),t}function gU(t,e=["constructor"]){let r=Object.getPrototypeOf(t),i=Object.getOwnPropertyNames(r),n=t;for(let o of i){let s=n[o];typeof s=="function"&&(e.find(l=>o===l)||(n[o]=s.bind(t)))}}function tx(t,e){if(!t)throw new Error(e||"Assertion failed")}function $A(){let t;if(Ol()&&U2.performance)t=U2?.performance?.now?.();else if("hrtime"in z2){let e=z2?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var B0={debug:Ol()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},nie={enabled:!0,level:0};function O0(){}var _U={},yU={once:!0},bc=class{constructor({id:e}={id:""}){this.VERSION=GP,this._startTs=$A(),this._deltaTs=$A(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new j2(`__probe-${this.id}__`,nie),this.timeStamp(`${this.id} started`),gU(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number(($A()-this._startTs).toPrecision(10))}getDelta(){return Number(($A()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e){return this._getLogFunction(0,e,B0.warn,arguments,yU)}error(e){return this._getLogFunction(0,e,B0.error,arguments)}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r){return this._getLogFunction(e,r,B0.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,B0.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,B0.debug||B0.info,arguments,yU)}table(e,r,i){return r?this._getLogFunction(e,r,console.table||O0,i&&[i],{tag:sie(r)}):O0}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||O0)}group(e,r,i={collapsed:!1}){let n=vU({logLevel:e,message:r,opts:i}),{collapsed:o}=i;return n.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,r,i={}){return this.group(e,r,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||O0)}withGroup(e,r,i){this.group(e,r)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=xU(e)}_getLogFunction(e,r,i,n,o){if(this._shouldLog(e)){o=vU({logLevel:e,message:r,args:n,opts:o}),i=i||o.method,tx(i),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=$A();let s=o.tag||o.message;if(o.once&&s)if(!_U[s])_U[s]=$A();else return O0;return r=oie(this.id,o.message,o),i.bind(console,r,...o.args)}return O0}};bc.VERSION=GP;function xU(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return tx(Number.isFinite(e)&&e>=0),e}function vU(t){let{logLevel:e,message:r}=t;t.logLevel=xU(e);let i=t.args?Array.from(t.args):[];for(;i.length&&i.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&i.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let n=typeof t.message;return tx(n==="string"||n==="object"),Object.assign(t,{args:i},t.opts)}function oie(t,e,r){if(typeof e=="string"){let i=r.time?pU(dU(r.total)):"";e=r.time?`${t}: ${i} ${e}`:`${t}: ${e}`,e=mU(e,r.color,r.background)}return e}function sie(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe={};var WP=new bc({id:"@probe.gl/log"});var qP=new bc({id:"loaders.gl"}),G2=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},W2=class{constructor(){this.console=void 0,this.console=console}log(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return this.console.log.bind(this.console,...r)}info(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return this.console.info.bind(this.console,...r)}warn(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return this.console.warn.bind(this.console,...r)}error(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return this.console.error.bind(this.console,...r)}};var XP={fetch:null,mimeType:void 0,nothrow:!1,log:new W2,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:gd,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},bU={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 YP(){globalThis.loaders=globalThis.loaders||{};let{loaders:t}=globalThis;return t._state=t._state||{},t._state}function KP(){let t=YP();return t.globalOptions=t.globalOptions||{...XP},t.globalOptions}function EU(t,e,r,i){return r=r||[],r=Array.isArray(r)?r:[r],aie(t,r),cie(e,t,i)}function aie(t,e){wU(t,null,XP,bU,e);for(let r of e){let i=t&&t[r.id]||{},n=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};wU(i,r.id,n,o,e)}}function wU(t,e,r,i,n){let o=e||"Top level",s=e?`${e}.`:"";for(let l in t){let u=!e&&JA(t[l]),f=l==="baseUri"&&!e,v=l==="workerUrl"&&e;if(!(l in r)&&!f&&!v){if(l in i)qP.warn(`${o} loader option '${s}${l}' no longer supported, use '${i[l]}'`)();else if(!u){let T=lie(l,n);qP.warn(`${o} loader option '${s}${l}' not recognized. ${T}`)()}}}}function lie(t,e){let r=t.toLowerCase(),i="";for(let n of e)for(let o in n.options){if(t===o)return`Did you mean '${n.id}.${o}'?`;let s=o.toLowerCase();(r.startsWith(s)||s.startsWith(r))&&(i=i||`Did you mean '${n.id}.${o}'?`)}return i}function cie(t,e,r){let n={...t.options||{}};return uie(n,r),n.log===null&&(n.log=new G2),TU(n,KP()),TU(n,e),n}function TU(t,e){for(let r in e)if(r in e){let i=e[r];VP(i)&&VP(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function uie(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}function rx(t){var e;return t?(Array.isArray(t)&&(t=t[0]),Array.isArray((e=t)===null||e===void 0?void 0:e.extensions)):!1}function ix(t){var e,r;On(t,"null loader"),On(rx(t),"invalid loader");let i;return Array.isArray(t)&&(i=t[1],t=t[0],t={...t,options:{...t.options,...i}}),((e=t)!==null&&e!==void 0&&e.parseTextSync||(r=t)!==null&&r!==void 0&&r.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}var SU=()=>{let t=YP();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function em(t){let e=SU();t=Array.isArray(t)?t:[t];for(let r of t){let i=ix(r);e.find(n=>i===n)||e.unshift(i)}}function CU(){return SU()}var MU=new bc({id:"loaders.gl"});var hie=/\.([^.]+)$/;async function RU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!BU(t))return null;let n=IU(t,e,{...r,nothrow:!0},i);if(n)return n;if(Ru(t)&&(t=await t.slice(0,10).arrayBuffer(),n=IU(t,e,r,i)),!n&&!(r!=null&&r.nothrow))throw new Error(OU(t));return n}function IU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!BU(t))return null;if(e&&!Array.isArray(e))return ix(e);let n=[];e&&(n=n.concat(e)),r!=null&&r.ignoreRegisteredLoaders||n.push(...CU()),die(n);let o=fie(t,n,r,i);if(!o&&!(r!=null&&r.nothrow))throw new Error(OU(t));return o}function fie(t,e,r,i){let n=QA(t),o=ex(t),s=P0(n)||i?.url,l=null,u="";if(r!=null&&r.mimeType&&(l=ZP(e,r?.mimeType),u=`match forced by supplied MIME type ${r?.mimeType}`),l=l||pie(e,s),u=u||(l?`matched url ${s}`:""),l=l||ZP(e,o),u=u||(l?`matched MIME type ${o}`:""),l=l||mie(e,t),u=u||(l?`matched initial data ${DU(t)}`:""),r!=null&&r.fallbackMimeType&&(l=l||ZP(e,r?.fallbackMimeType),u=u||(l?`matched fallback MIME type ${o}`:"")),u){var f;MU.log(1,`selectLoader selected ${(f=l)===null||f===void 0?void 0:f.name}: ${u}.`)}return l}function BU(t){return!(t instanceof Response&&t.status===204)}function OU(t){let e=QA(t),r=ex(t),i="No valid loader found (";i+=e?`${Jc.filename(e)}, `:"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=t?DU(t):"";return i+=n?` first bytes: "${n}"`:"first bytes: not available",i+=")",i}function die(t){for(let e of t)ix(e)}function pie(t,e){let r=e&&hie.exec(e),i=r&&r[1];return i?Aie(t,i):null}function Aie(t,e){e=e.toLowerCase();for(let r of t)for(let i of r.extensions)if(i.toLowerCase()===e)return r;return null}function ZP(t,e){for(let r of t)if(r.mimeTypes&&r.mimeTypes.includes(e)||e===`application/x.${r.id}`)return r;return null}function mie(t,e){if(!e)return null;for(let r of t)if(typeof e=="string"){if(gie(e,r))return r}else if(ArrayBuffer.isView(e)){if(PU(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer&&PU(e,0,r))return r;return null}function gie(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some(i=>t.startsWith(i))}function PU(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>_ie(t,e,r,n))}function _ie(t,e,r,i){if(i instanceof ArrayBuffer)return LP(i,t,i.byteLength);switch(typeof i){case"function":return i(t);case"string":let n=JP(t,e,i.length);return i===n;default:return!1}}function DU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?JP(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?JP(t,0,e):""}function JP(t,e,r){if(t.byteLength<e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function*LU(t,e){let r=e?.chunkSize||262144,i=0,n=new TextEncoder;for(;i<t.length;){let o=Math.min(t.length-i,r),s=t.slice(i,i+o);i+=o,yield n.encode(s)}}function FU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){let{chunkSize:r=262144}=e,i=0;for(;i<t.byteLength;){let n=Math.min(t.byteLength-i,r),o=new ArrayBuffer(n),s=new Uint8Array(t,i,n);new Uint8Array(o).set(s),i+=n,yield o}}()}async function*NU(t,e){let r=e?.chunkSize||1048576,i=0;for(;i<t.size;){let n=i+r,o=await t.slice(i,n).arrayBuffer();i=n,yield o}}function QP(t,e){return gd?yie(t,e):vie(t,e)}async function*yie(t,e){let r=t.getReader(),i;try{for(;;){let n=i||r.read();e!=null&&e._streamReadAhead&&(i=r.read());let{done:o,value:s}=await n;if(o)return;yield L2(s)}}catch{r.releaseLock()}}async function*vie(t,e){for await(let r of t)yield L2(r)}function kU(t,e){if(typeof t=="string")return LU(t,e);if(t instanceof ArrayBuffer)return FU(t,e);if(Ru(t))return NU(t,e);if(N2(t))return QP(t,e);if(Pu(t))return QP(t.body,e);throw new Error("makeIterator")}var UU="Cannot convert supplied data type";function xie(t,e,r){if(e.text&&typeof t=="string")return t;if(sU(t)&&(t=t.buffer),t instanceof ArrayBuffer){let i=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let i=t.buffer,n=t.byteLength||t.length;return(t.byteOffset!==0||n!==i.byteLength)&&(i=i.slice(t.byteOffset,t.byteOffset+n)),i}throw new Error(UU)}async function zU(t,e,r){let i=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if(typeof t=="string"||i)return xie(t,e,r);if(Ru(t)&&(t=await k2(t)),Pu(t)){let n=t;return await hU(n),e.binary?await n.arrayBuffer():await n.text()}if(N2(t)&&(t=kU(t,r)),nU(t)||oU(t))return kP(t);throw new Error(UU)}function q2(t,e){let r=KP(),i=t||r;return typeof i.fetch=="function"?i.fetch:JA(i.fetch)?n=>R0(n,i.fetch):e!=null&&e.fetch?e?.fetch:R0}function VU(t,e,r){if(r)return r;let i={fetch:q2(e,t),...t};if(i.url){let n=P0(i.url);i.baseUrl=n,i.queryString=cU(i.url),i.filename=Jc.filename(n),i.baseUrl=Jc.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function jU(t,e){if(t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){let i=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...i]:i}return r&&r.length?r:void 0}async function bp(t,e,r,i){e&&!Array.isArray(e)&&!rx(e)&&(i=void 0,r=e,e=void 0),t=await t,r=r||{};let n=QA(t),s=jU(e,i),l=await RU(t,s,r);return l?(r=EU(r,l,s,n),i=VU({url:n,_parse:bp,loaders:s},r,i||null),await bie(l,t,r,i)):null}async function bie(t,e,r,i){if(PP(t),r=Wv(t.options,r),Pu(e)){let o=e,{ok:s,redirected:l,status:u,statusText:f,type:v,url:T}=o,E=Object.fromEntries(o.headers.entries());i.response={headers:E,ok:s,redirected:l,status:u,statusText:f,type:v,url:T}}e=await zU(e,t,r);let n=t;if(n.parseTextSync&&typeof e=="string")return n.parseTextSync(e,r,i);if(BP(t,r))return await OP(t,e,r,i,bp);if(n.parseText&&typeof e=="string")return await n.parseText(e,r,i);if(n.parse)return await n.parse(e,r,i);throw yl(!n.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}async function _a(t,e,r,i){let n,o;!Array.isArray(e)&&!rx(e)?(n=[],o=e,i=void 0):(n=e,o=r);let s=q2(o),l=t;return typeof t=="string"&&(l=await s(t)),Ru(t)&&(l=await s(t)),Array.isArray(n)?await bp(l,n,o):await bp(l,n,o)}var Kt=new bc({id:"luma.gl"});var $P=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new Bl({id:e})),this.stats.get(e)}},D0=new $P;function wie(){let t="9.0.7",e="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==t)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${t}`);return globalThis.luma||(Ol()&&Kt.log(1,`${t} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:t,version:t,log:Kt,stats:D0}),t}var HU=wie();function Tie(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)?t:null}function wp(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number"?t:null:Tie(t)}var e3={};function oa(t="id"){e3[t]=e3[t]||1;let e=e3[t]++;return`${t}-${e}`}function Tp(t){let e=!0;for(let r in t){e=!1;break}return e}var hn=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,r,i){if(!e)throw new Error("no device");this._device=e,this.props=Eie(r,i);let n=this.props.id!=="undefined"?this.props.id:oa(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(e,r=this[Symbol.toStringTag]){let i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.get(`${r} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${r}s Created`).incrementCount(),e.get(`${r}s Active`).incrementCount()}};si(hn,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Eie(t,e){let r={...e};for(let i in t)t[i]!==void 0&&(r[i]=t[i]);return r}var nx=class extends hn{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,r){let i={...r};(r.usage||0)&nx.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?i.indexType="uint32":r.data instanceof Uint16Array&&(i.indexType="uint16")),super(e,i,nx.defaultProps),this.usage=r.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,r){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,r,i){let n=ArrayBuffer.isView(e)?e.buffer:e,o=Math.min(e?e.byteLength:i,nx.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(o):r===0&&i===e.byteLength?this.debugData=n.slice(0,o):this.debugData=n.slice(r,r+o)}},Xi=nx;si(Xi,"defaultProps",{...hn.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),si(Xi,"MAP_READ",1),si(Xi,"MAP_WRITE",2),si(Xi,"COPY_SRC",4),si(Xi,"COPY_DST",8),si(Xi,"INDEX",16),si(Xi,"VERTEX",32),si(Xi,"UNIFORM",64),si(Xi,"STORAGE",128),si(Xi,"INDIRECT",256),si(Xi,"QUERY_RESOLVE",512),si(Xi,"DEBUG_DATA_MAX_LENGTH",32);function X2(t){let e=GU[t],r=Sie(e),i=t.includes("norm"),n=!i&&!t.startsWith("float"),o=t.startsWith("s");return{dataType:GU[t],byteLength:r,integer:n,signed:o,normalized:i}}function Sie(t){return Cie[t]}var GU={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Cie={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Mie=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Iie=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function WU(t){return Mie.some(e=>t.startsWith(e))}function Y2(t){let e=Iie.exec(t);if(e){let[,r,i,n,o,s]=e;if(r){let l=`${n}${i}`,u=X2(l);return{format:r,components:r.length,srgb:o==="-srgb",unsized:s==="-unsized",webgl:s==="-webgl",...u}}}return Rie(t)}var Pie={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Rie(t){let e=Pie[t];if(!e)throw new Error(`Unknown format ${t}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var ox=class{},sx=class{features;disabledFeatures;constructor(e=[],r){this.features=new Set(e),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures[e]&&this.features.has(e)}},t3=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...t3.defaultProps,...e},this.id=this.props.id||oa(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=D0;_lumaData={};isTextureFormatCompressed(e){return WU(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,r){throw new Error("not implemented")}readPixelsToBufferWebGL(e,r){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,r){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let r={...e};return(e.usage||0)&Xi.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?r.indexType="uint32":e.data instanceof Uint16Array?r.indexType="uint16":Kt.warn("indices buffer content must be of integer type")()),r}},wc=t3;si(wc,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(Kt.get("debug")),spector:Boolean(Kt.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>Kt.error(e.message)}),si(wc,"VERSION",HU);function Yi(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}var ax=new Map,Tc=class{static registerDevices(e){for(let r of e)Yi(r.type&&r.isSupported&&r.create),ax.set(r.type,r)}static getAvailableDevices(){return Array.from(ax).map(e=>e.type)}static getSupportedDevices(){return Array.from(ax).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(wc.defaultProps,e)}static async attachDevice(e){let r=qU(e.devices)||ax;if(e.handle instanceof WebGL2RenderingContext){let i=r.get("webgl");if(i)return await i.attach(e.handle)}if(e.handle===null){let i=r.get("unknown");if(i)return await i.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(e={}){e={...wc.defaultProps,...e},e.gl&&(e.type="webgl");let r=qU(e.devices)||ax;switch(e.type){case"webgpu":let i=r.get("webgpu");if(i)return await i.create(e);break;case"webgl":let n=r.get("webgl");if(n)return await n.create(e);break;case"unknown":let o=r.get("unknown");if(o)return await o.create(e);break;case"best-available":if(i=r.get("webgpu"),i?.isSupported?.())return await i.create(e);if(n=r.get("webgl"),n?.isSupported?.())return await n.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}};si(Tc,"defaultProps",{...wc.defaultProps,type:"best-available",devices:void 0}),si(Tc,"stats",D0),si(Tc,"log",Kt);function qU(t){if(!t||t?.length===0)return null;let e=new Map;for(let r of t)e.set(r.type,r);return e}var Bie=Ol()&&typeof document<"u",K2=()=>Bie&&document.readyState==="complete",Oie={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},Ep=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return K2()}constructor(e){if(this.props={...Oie,...e},e=this.props,!Ol()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=Fie(e.canvas):this.canvas=e.canvas;else{let r=Nie(e),i=Lie(e?.container||null);i.insertBefore(r,i.firstChild),this.canvas=r,e?.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&&e.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let i of r)i.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}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 e=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*e,r.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,r]=this.getPixelSize();return e/r}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:r}=this._canvasSizeInfo;return r?e/r:1}catch{return 1}}cssToDevicePixels(e,r=!0){let i=this.cssToDeviceRatio(),[n,o]=this.getDrawingBufferSize();return kie(e,i,n,o,r)}setDevicePixelRatio(e,r={}){if(!this.htmlCanvas)return;let i="width"in r?r.width:this.htmlCanvas.clientWidth,n="height"in r?r.height:this.htmlCanvas.clientHeight;(!i||!n)&&(Kt.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,i=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==i||o.clientHeight!==n||o.devicePixelRatio!==e){let s=e,l=Math.floor(i*s),u=Math.floor(n*s);this.htmlCanvas.width=l,this.htmlCanvas.height=u;let[f,v]=this.getDrawingBufferSize();(f!==l||v!==u)&&(s=Math.min(f/i,v/n),this.htmlCanvas.width=Math.floor(i*s),this.htmlCanvas.height=Math.floor(n*s),Kt.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};si(Ep,"pageLoaded",Die());function Die(){return K2()||typeof window>"u"?Promise.resolve():new Promise(t=>{window.addEventListener("load",()=>t())})}function Lie(t){if(typeof t=="string"){let e=document.getElementById(t);if(!e&&!K2())throw new Error(`Accessing '${t}' before page was loaded`);if(!e)throw new Error(`${t} is not an HTML element`);return e}else if(t)return t;return document.body}function Fie(t){let e=document.getElementById(t);if(!e&&!K2())throw new Error(`Accessing '${t}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function Nie(t){let{width:e,height:r}=t,i=document.createElement("canvas");return i.id="lumagl-auto-created-canvas",i.width=e||1,i.height=r||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(r)?`${r}px`:"100%",i}function kie(t,e,r,i,n){let o=t,s=XU(o[0],e,r),l=YU(o[1],e,i,n),u=XU(o[0]+1,e,r),f=u===r-1?u:u-1;u=YU(o[1]+1,e,i,n);let v;return n?(u=u===0?u:u+1,v=l,l=u):v=u===i-1?u:u-1,{x:s,y:l,width:Math.max(f-s+1,1),height:Math.max(v-l+1,1)}}function XU(t,e,r){return Math.min(Math.round(t*e),r-1)}function YU(t,e,r,i){return i?Math.max(0,r-1-Math.round(t*e)):Math.min(Math.round(t*e),r-1)}var r3=class extends hn{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,r,i=r3.defaultProps){super(e,r,i),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.updateTimestamp=e.incrementTimestamp()}},bo=r3;si(bo,"defaultProps",{...hn.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),si(bo,"COPY_SRC",1),si(bo,"COPY_DST",2),si(bo,"TEXTURE_BINDING",4),si(bo,"STORAGE_BINDING",8),si(bo,"RENDER_ATTACHMENT",16);var i3=class extends hn{get[Symbol.toStringTag](){return"TextureView"}constructor(e,r){super(e,r,i3.defaultProps)}},Sp=i3;si(Sp,"defaultProps",{...hn.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});function ZU(t,e,r){let i="",n=e.split(/\r?\n/),o=t.slice().sort((s,l)=>s.lineNum-l.lineNum);switch(r?.showSourceCode||"no"){case"all":let s=0;for(let l=1;l<=n.length;l++)for(i+=JU(n[l-1],l,r);o.length>s&&o[s].lineNum===l;){let u=o[s++];i+=KU(u,n,u.lineNum,{...r,inlineSource:!1})}return i;case"issues":case"no":for(let l of t)i+=KU(l,n,l.lineNum,{inlineSource:r?.showSourceCode!=="no"});return i}}function KU(t,e,r,i){if(i?.inlineSource){let n=Uie(e,r),o=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^
544
544
  `:"";return`
545
545
  ${n}${o}${t.type.toUpperCase()}: ${t.message}
546
546
 
@@ -550,7 +550,7 @@ ${n}${o}${t.type.toUpperCase()}: ${t.message}
550
550
  <code style="user-select:text;"><pre>
551
551
  ${n}
552
552
  </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);let l=document.getElementsByClassName("luma-compiler-log-error");l[0]?.scrollIntoView&&l[0].scrollIntoView(),s.onclick=()=>{let u=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(u)}}},Cp=o3;si(Cp,"defaultProps",{...hn.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function Gie(t){return n3(t.source).name||t.id||oa(`unnamed ${t.stage}-shader`)}var s3=class extends hn{get[Symbol.toStringTag](){return"Sampler"}constructor(e,r){super(e,r,s3.defaultProps)}},Mp=s3;si(Mp,"defaultProps",{...hn.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var a3=class extends hn{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,r={}){super(e,r,a3.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let r=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];r=r||n!==this.height||i!==this.width,this.width=i,this.height=n}r&&(Kt.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=>{if(typeof r=="string"){let i=this.createColorTexture(r);return this.attachResource(i),i.view}return r instanceof bo?r.view:r});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let r=this.createDepthStencilTexture(e);this.attachResource(r),this.depthStencilAttachment=r.view}else e instanceof bo?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:bo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:bo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,r){for(let i=0;i<this.colorAttachments.length;++i)if(this.colorAttachments[i]){let n=this.device._createTexture({...this.colorAttachments[i].props,width:e,height:r});this.destroyAttachedResource(this.colorAttachments[i]),this.colorAttachments[i]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let i=this.device._createTexture({...this.depthStencilAttachment.props,width:e,height:r});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}}},yf=a3;si(yf,"defaultProps",{...hn.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var l3=class extends hn{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,r){super(e,r,l3.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},mh=l3;si(mh,"defaultProps",{...hn.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});var c3=class extends hn{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,r){super(e,r,c3.defaultProps)}},L0=c3;si(L0,"defaultProps",{...hn.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var u3=class extends hn{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(e,r){super(e,r,u3.defaultProps)}},tm=u3;si(tm,"defaultProps",{...hn.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var h3=class extends hn{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,r){super(e,r,h3.defaultProps)}},F0=h3;si(F0,"defaultProps",{...hn.defaultProps,measureExecutionTime:void 0});var f3=class extends hn{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,r){super(e,r,f3.defaultProps)}},N0=f3;si(N0,"defaultProps",{...hn.defaultProps});function QU(t){let[e,r]=qie[t],i=e==="i32"||e==="u32",n=e!=="u32",o=Xie[e]*r,s=Wie(e,r);return{dataType:e,components:r,defaultVertexFormat:s,byteLength:o,integer:i,signed:n}}function Wie(t,e){let r;switch(t){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?r:`${r}x${e}`}var qie={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]},Xie={f32:4,f16:2,i32:4,u32:4};function d3(t){let e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);let[r,i]=t.split("x"),n=r,o=i?parseInt(i):1,s=X2(n),l={type:n,components:o,byteLength:s.byteLength*o,integer:s.integer,signed:s.signed,normalized:s.normalized};return e&&(l.webglOnly=!0),l}function Z2(t,e){let r={};for(let i of t.attributes)r[i.name]=Yie(t,e,i.name);return r}function $U(t,e,r=16){let i=Z2(t,e),n=new Array(r).fill(null);for(let o of Object.values(i))n[o.location]=o;return n}function Yie(t,e,r){let i=Kie(t,r),n=Zie(e,r);if(!i)return null;let o=QU(i.type),s=n?.vertexFormat||o.defaultVertexFormat,l=d3(s);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:s,bufferDataType:l.type,bufferComponents:l.components,normalized:l.normalized,integer:o.integer,stepMode:n?.stepMode||i.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function Kie(t,e){let r=t.attributes.find(i=>i.name===e);return r||Kt.warn(`shader layout attribute "${e}" not present in shader`),r||null}function Zie(t,e){Jie(t);let r=Qie(t,e);return r||(r=$ie(t,e),r)?r:(Kt.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Jie(t){for(let e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&Kt.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Qie(t,e){for(let r of t)if(r.format&&r.name===e)return{attributeName:r.name,bufferName:e,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}function $ie(t,e){for(let r of t){let i=r.byteStride;if(typeof r.byteStride!="number")for(let o of r.attributes||[]){let s=d3(o.format);i+=s.byteLength}let n=r.attributes?.find(o=>o.attribute===e);if(n)return{attributeName:n.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:i}}return null}function p3(t,e){let r={...t,attributes:t.attributes.map(i=>({...i}))};for(let i of e?.attributes||[]){let n=r.attributes.find(o=>o.name===i.name);n?(n.type=i.type||n.type,n.stepMode=i.stepMode||n.stepMode):Kt.warn(`shader layout attribute ${i.name} not present in shader`)}return r}var A3=class extends hn{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,r){super(e,r,A3.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=$U(r.renderPipeline.shaderLayout,r.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,r){throw new Error("constant attributes not supported")}},k0=A3;si(k0,"defaultProps",{...hn.defaultProps,renderPipeline:null});var m3=class extends hn{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,r){super(e,r,m3.defaultProps)}},U0=m3;si(U0,"defaultProps",{...hn.defaultProps,layout:void 0,buffers:{}});var g3=class extends hn{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,r){super(e,r,g3.defaultProps)}},z0=g3;si(z0,"defaultProps",{...hn.defaultProps,type:void 0,count:void 0});var ene={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 ez(t){let e=ene[t];return Yi(t),e}function tz(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}var J2;function Q2(t){return(!J2||J2.byteLength<t)&&(J2=new ArrayBuffer(t)),J2}function _3(t,e){let r=Q2(t.BYTES_PER_ELEMENT*e);return new t(r,0,e)}function y3(t){let{target:e,source:r,start:i=0,count:n=1}=t,o=r.length,s=n*o,l=0;for(let u=i;l<o;l++)e[u++]=r[l];for(;l<s;)l<s-l?(e.copyWithin(i+l,i,i+l),l*=2):(e.copyWithin(i+l,i,i+s-l),l=s);return t.target}var rz=1024,$2=class{layout={};byteLength;constructor(e){let r=0;for(let[n,o]of Object.entries(e)){let s=ez(o),{type:l,components:u}=s;r=tz(r,u);let f=r;r+=u,this.layout[n]={type:l,size:u,offset:f}}r+=(4-r%4)%4;let i=r*4;this.byteLength=Math.max(i,rz)}getData(e){let r=Math.max(this.byteLength,rz),i=Q2(r),n={i32:new Int32Array(i),u32:new Uint32Array(i),f32:new Float32Array(i),f16:new Uint16Array(i)};for(let[o,s]of Object.entries(e)){let l=this.layout[o];if(!l){Kt.warn(`Supplied uniform value ${o} not present in uniform block layout`)();continue}let{type:u,size:f,offset:v}=l,T=n[u];if(f===1){if(typeof s!="number"&&typeof s!="boolean"){Kt.warn(`Supplied value for single component uniform ${o} is not a number: ${s}`)();continue}T[v]=Number(s)}else{let E=wp(s);if(!E){Kt.warn(`Supplied value for multi component / array uniform ${o} is not a numeric array: ${s}`)();continue}T.set(E,v)}}return new Uint8Array(i)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function iz(t,e,r=16){if(t!==e)return!1;let i=wp(t);if(!i)return!1;let n=wp(e);if(n&&i.length===n.length){for(let o=0;o<i.length;++o)if(n[o]!==i[o])return!1}return!0}function nz(t){let e=wp(t);return e?e.slice():t}var eT=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name,e?.name&&e?.shaderLayout){let r=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!r)throw new Error(e?.name);let i=r;for(let n of i.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[r,i]of Object.entries(e))this._setUniform(r,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${r}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,r){iz(this.uniforms[e],r)||(this.uniforms[e]=nz(r),this.modifiedUniforms[e]=!0,this.modified=!0)}};var lx=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[r,i]of Object.entries(e)){let n=r,o=new $2(i.uniformTypes||{});this.uniformBufferLayouts.set(n,o);let s=new eT({name:r});s.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(n,s)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[r,i]of Object.entries(e))this.uniformBlocks.get(r).setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e).byteLength}getUniformBufferData(e){let r=this.uniformBlocks.get(e).getAllUniforms();return this.uniformBufferLayouts.get(e).getData(r)}createUniformBuffer(e,r,i){i&&this.setUniforms(i);let n=this.getUniformBufferByteLength(r),o=e.createBuffer({usage:Xi.UNIFORM|Xi.COPY_DST,byteLength:n}),s=this.getUniformBufferData(r);return o.write(s),o}getManagedUniformBuffer(e,r){if(!this.uniformBuffers.get(r)){let i=this.getUniformBufferByteLength(r),n=e.createBuffer({usage:Xi.UNIFORM|Xi.COPY_DST,byteLength:i});this.uniformBuffers.set(r,n)}return this.uniformBuffers.get(r)}updateUniformBuffers(){let e=!1;for(let r of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(r);e||=i}return e&&Kt.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let r=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),n=!1;if(i&&r.needsRedraw){n||=r.needsRedraw;let o=this.getUniformBufferData(e);this.uniformBuffers.get(e).write(o);let l=this.uniformBlocks.get(e).getAllUniforms();Kt.log(4,`Writing to uniform buffer ${String(e)}`,o,l)()}return n}};function tT(t){let e=ArrayBuffer.isView(t)?t.constructor:t;switch(e){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(e.constructor.name)}}function cx(t){switch(t){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(t)}}function v3(t,e,r){if(!e||e>4)throw new Error(`size ${e}`);let i=e,n=tT(t);if(n==="uint8"||n==="sint8"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}if(n==="uint16"||n==="sint16"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}return i===1?n:`${n}x${i}`}function oz(t){return wp(t)!==null||typeof t=="number"||typeof t=="boolean"}function ux(t){let e={bindings:{},uniforms:{}};return Object.keys(t).forEach(r=>{let i=t[r];oz(i)?e.uniforms[r]=i:e.bindings[r]=i}),e}function x3(t,e,r){let{removedProps:i={},deprecatedProps:n={},replacedProps:o={}}=r;for(let l in i)if(l in e){let f=i[l]?`${t}.${i[l]}`:"N/A";Kt.removed(`${t}.${l}`,f)()}for(let l in n)if(l in e){let u=n[l];Kt.deprecated(`${t}.${l}`,`${t}.${u}`)()}let s=null;for(let[l,u]of Object.entries(o))l in e&&(Kt.deprecated(`${t}.${l}`,`${t}.${u}`)(),s=s||Object.assign({},e),s[u]=e[l],delete s[l]);return s||e}var tne="";async function b3(t,e){return await new Promise((r,i)=>{try{let n=new Image;n.onload=()=>r(n),n.onerror=()=>i(new Error(`Could not load image ${t}.`)),n.crossOrigin=e?.crossOrigin||"anonymous",n.src=t.startsWith("http")?t:tne+t}catch(n){i(n)}})}async function hx(t,e){let r=document.getElementsByTagName("head")[0];if(!r)throw new Error("loadScript");let i=document.createElement("script");return i.setAttribute("type","text/javascript"),i.setAttribute("src",t),e&&(i.id=e),new Promise((n,o)=>{i.onload=n,i.onerror=s=>o(new Error(`Unable to load script '${t}': ${s}`)),r.appendChild(i)})}function fx(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!fx(t[i],e[i],r-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof t=="object"&&typeof e=="object"){let i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(let o of i)if(!e.hasOwnProperty(o)||!fx(t[o],e[o],r-1))return!1;return!0}return!1}function w3(t){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,1e3/60)}function T3(t){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(t):clearTimeout(t)}var vf;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t[t.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",t[t.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",t[t.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",t[t.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",t[t.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",t[t.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",t[t.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",t[t.LINE_WEBGL=6913]="LINE_WEBGL",t[t.FILL_WEBGL=6914]="FILL_WEBGL",t[t.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",t[t.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",t[t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",t[t.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",t[t.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",t[t.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",t[t.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",t[t.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",t[t.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",t[t.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",t[t.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",t[t.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",t[t.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",t[t.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",t[t.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",t[t.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",t[t.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",t[t.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",t[t.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",t[t.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",t[t.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",t[t.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",t[t.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",t[t.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(vf||(vf={}));var px={[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},ya=(t,e,r)=>e?t.enable(r):t.disable(r),sz=(t,e,r)=>t.hint(r,e),Qc=(t,e,r)=>t.pixelStorei(r,e),az=(t,e,r)=>{let i=r===36006?36009:36008;return t.bindFramebuffer(i,e)},dx=(t,e,r)=>{let n={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];t.bindBuffer(n,e)};function E3(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}var lz={[3042]:ya,[32773]:(t,e)=>t.blendColor(...e),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(t,e)=>t.clearColor(...e),[3107]:(t,e)=>t.colorMask(...e),[2884]:ya,[2885]:(t,e)=>t.cullFace(e),[2929]:ya,[2931]:(t,e)=>t.clearDepth(e),[2932]:(t,e)=>t.depthFunc(e),[2928]:(t,e)=>t.depthRange(...e),[2930]:(t,e)=>t.depthMask(e),[3024]:ya,[35723]:sz,[35725]:(t,e)=>t.useProgram(e),[36007]:(t,e)=>t.bindRenderbuffer(36161,e),[36389]:(t,e)=>t.bindTransformFeedback?.(36386,e),[34229]:(t,e)=>t.bindVertexArray(e),[36006]:az,[36010]:az,[34964]:dx,[36662]:dx,[36663]:dx,[35053]:dx,[35055]:dx,[2886]:(t,e)=>t.frontFace(e),[33170]:sz,[2849]:(t,e)=>t.lineWidth(e),[32823]:ya,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:ya,[32926]:ya,[32928]:ya,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:ya,[3088]:(t,e)=>t.scissor(...e),[2960]:ya,[2961]:(t,e)=>t.clearStencil(e),[2968]:(t,e)=>t.stencilMaskSeparate(1028,e),[36005]:(t,e)=>t.stencilMaskSeparate(1029,e),[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]:(t,e)=>t.viewport(...e),[34383]:ya,[10754]:ya,[12288]:ya,[12289]:ya,[12290]:ya,[12291]:ya,[12292]:ya,[12293]:ya,[12294]:ya,[12295]:ya,[3333]:Qc,[3317]:Qc,[37440]:Qc,[37441]:Qc,[37443]:Qc,[3330]:Qc,[3332]:Qc,[3331]:Qc,[3314]:Qc,[32878]:Qc,[3316]:Qc,[3315]:Qc,[32877]:Qc,framebuffer:(t,e)=>{let r=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,r)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{let r=typeof e=="number"?[e,e]:e;t.blendEquationSeparate(...r)},blendFunc:(t,e)=>{let r=e?.length===2?[...e,...e]:e;t.blendFuncSeparate(...r)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(...e),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=E3(e)?e:[e,e];let[r,i]=e;t.stencilMaskSeparate(1028,r),t.stencilMaskSeparate(1029,i)},stencilFunc:(t,e)=>{e=E3(e)&&e.length===3?[...e,...e]:e;let[r,i,n,o,s,l]=e;t.stencilFuncSeparate(1028,r,i,n),t.stencilFuncSeparate(1029,o,s,l)},stencilOp:(t,e)=>{e=E3(e)&&e.length===3?[...e,...e]:e;let[r,i,n,o,s,l]=e;t.stencilOpSeparate(1028,r,i,n),t.stencilOpSeparate(1029,o,s,l)},viewport:(t,e)=>t.viewport(...e)};function Ys(t,e,r){return e[t]!==void 0?e[t]:r[t]}var cz={blendEquation:(t,e,r)=>t.blendEquationSeparate(Ys(32777,e,r),Ys(34877,e,r)),blendFunc:(t,e,r)=>t.blendFuncSeparate(Ys(32969,e,r),Ys(32968,e,r),Ys(32971,e,r),Ys(32970,e,r)),polygonOffset:(t,e,r)=>t.polygonOffset(Ys(32824,e,r),Ys(10752,e,r)),sampleCoverage:(t,e,r)=>t.sampleCoverage(Ys(32938,e,r),Ys(32939,e,r)),stencilFuncFront:(t,e,r)=>t.stencilFuncSeparate(1028,Ys(2962,e,r),Ys(2967,e,r),Ys(2963,e,r)),stencilFuncBack:(t,e,r)=>t.stencilFuncSeparate(1029,Ys(34816,e,r),Ys(36003,e,r),Ys(36004,e,r)),stencilOpFront:(t,e,r)=>t.stencilOpSeparate(1028,Ys(2964,e,r),Ys(2965,e,r),Ys(2966,e,r)),stencilOpBack:(t,e,r)=>t.stencilOpSeparate(1029,Ys(34817,e,r),Ys(34818,e,r),Ys(34819,e,r))},S3={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,r)=>t({[e]:r}),hint:(t,e,r)=>t({[e]:r}),useProgram:(t,e)=>t({[35725]:e}),bindRenderbuffer:(t,e,r)=>t({[36007]:r}),bindTransformFeedback:(t,e,r)=>t({[36389]:r}),bindVertexArray:(t,e)=>t({[34229]:e}),bindFramebuffer:(t,e,r)=>{switch(e){case 36160:return t({[36006]:r,[36010]:r});case 36009:return t({[36006]:r});case 36008:return t({[36010]:r});default:return null}},bindBuffer:(t,e,r)=>{let i={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[e];return i?t({[i]:r}):{valueChanged:!0}},blendColor:(t,e,r,i,n)=>t({[32773]:new Float32Array([e,r,i,n])}),blendEquation:(t,e)=>t({[32777]:e,[34877]:e}),blendEquationSeparate:(t,e,r)=>t({[32777]:e,[34877]:r}),blendFunc:(t,e,r)=>t({[32969]:e,[32968]:r,[32971]:e,[32970]:r}),blendFuncSeparate:(t,e,r,i,n)=>t({[32969]:e,[32968]:r,[32971]:i,[32970]:n}),clearColor:(t,e,r,i,n)=>t({[3106]:new Float32Array([e,r,i,n])}),clearDepth:(t,e)=>t({[2931]:e}),clearStencil:(t,e)=>t({[2961]:e}),colorMask:(t,e,r,i,n)=>t({[3107]:[e,r,i,n]}),cullFace:(t,e)=>t({[2885]:e}),depthFunc:(t,e)=>t({[2932]:e}),depthRange:(t,e,r)=>t({[2928]:new Float32Array([e,r])}),depthMask:(t,e)=>t({[2930]:e}),frontFace:(t,e)=>t({[2886]:e}),lineWidth:(t,e)=>t({[2849]:e}),polygonOffset:(t,e,r)=>t({[32824]:e,[10752]:r}),sampleCoverage:(t,e,r)=>t({[32938]:e,[32939]:r}),scissor:(t,e,r,i,n)=>t({[3088]:new Int32Array([e,r,i,n])}),stencilMask:(t,e)=>t({[2968]:e,[36005]:e}),stencilMaskSeparate:(t,e,r)=>t({[e===1028?2968:36005]:r}),stencilFunc:(t,e,r,i)=>t({[2962]:e,[2967]:r,[2963]:i,[34816]:e,[36003]:r,[36004]:i}),stencilFuncSeparate:(t,e,r,i,n)=>t({[e===1028?2962:34816]:r,[e===1028?2967:36003]:i,[e===1028?2963:36004]:n}),stencilOp:(t,e,r,i)=>t({[2964]:e,[2965]:r,[2966]:i,[34817]:e,[34818]:r,[34819]:i}),stencilOpSeparate:(t,e,r,i,n)=>t({[e===1028?2964:34817]:r,[e===1028?2965:34818]:i,[e===1028?2966:34819]:n}),viewport:(t,e,r,i,n)=>t({[2978]:[e,r,i,n]})},xf=(t,e)=>t.isEnabled(e),C3={[3042]:xf,[2884]:xf,[2929]:xf,[3024]:xf,[32823]:xf,[32926]:xf,[32928]:xf,[3089]:xf,[2960]:xf,[35977]:xf},uz=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 Bu(t,e){if(rne(e))return;let r={};for(let n in e){let o=Number(n),s=lz[n];s&&(typeof s=="string"?r[s]=!0:s(t,e[n],o))}let i=t.state&&t.state.cache;if(i)for(let n in r){let o=cz[n];o(t,e,i)}}function rT(t,e=px){if(typeof e=="number"){let n=e,o=C3[n];return o?o(t,n):t.getParameter(n)}let r=Array.isArray(e)?e:Object.keys(e),i={};for(let n of r){let o=C3[n];i[n]=o?o(t,Number(n)):t.getParameter(Number(n))}return i}function hz(t){Bu(t,px)}function rne(t){for(let e in t)return!1;return!0}function fz(t,e){if(t===e)return!0;let r=Array.isArray(t)||ArrayBuffer.isView(t),i=Array.isArray(e)||ArrayBuffer.isView(e);if(r&&i&&t.length===e.length){for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}return!1}var M3=class{gl;program=null;stateStack=[];enable=!0;cache;log;constructor(e,{copyState:r=!1,log:i=()=>{}}={}){this.gl=e,this.cache=r?rT(e):Object.assign({},px),this.log=i,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){Yi(this.stateStack.length>0);let e=this.stateStack[this.stateStack.length-1];Bu(this.gl,e),this.stateStack.pop()}_updateCache(e){let r=!1,i,n=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in e){Yi(o!==void 0);let s=e[o],l=this.cache[o];fz(s,l)||(r=!0,i=l,n&&!(o in n)&&(n[o]=l),this.cache[o]=s)}return{valueChanged:r,oldValue:i}}};function rm(t){return t.state}function I3(t,e){let{enable:r=!0,copyState:i}=e;if(Yi(i!==void 0),!t.state){t.state=new M3(t,{copyState:i}),nne(t);for(let o in S3){let s=S3[o];ine(t,o,s)}dz(t,"getParameter"),dz(t,"isEnabled")}let n=rm(t);return n.enable=r,t}function Ip(t){let e=rm(t);e||(I3(t,{copyState:!1}),e=rm(t)),e.push()}function _d(t){let e=rm(t);Yi(e),e.pop()}function dz(t,e){let r=t[e].bind(t);t[e]=function(n){if(n===void 0||uz.has(n))return r(n);let o=rm(t);return n in o.cache||(o.cache[n]=r(n)),o.enable?o.cache[n]:r(n)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function ine(t,e,r){if(!t[e])return;let i=t[e].bind(t);t[e]=function(...o){let s=rm(t),{valueChanged:l,oldValue:u}=r(s._updateCache,...o);return l&&i(...o),u},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}function nne(t){let e=t.useProgram.bind(t);t.useProgram=function(i){let n=rm(t);n.program!==i&&(e(i),n.program=i)}}var one={powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function pz(t,e){e={...one,...e};let r=null,i=o=>r=o.statusMessage||r;t.addEventListener("webglcontextcreationerror",i,!1);let n=null;if(n||=t.getContext("webgl2",e),t.removeEventListener("webglcontextcreationerror",i,!1),!n)throw new Error(`Failed to create WebGL context: ${r||"Unknown error"}`);if(e.onContextLost){let{onContextLost:o}=e;t.addEventListener("webglcontextlost",s=>o(s),!1)}if(e.onContextRestored){let{onContextRestored:o}=e;t.addEventListener("webglcontextrestored",s=>o(s),!1)}return n}function Ou(t,e,r){return r[e]===void 0&&(r[e]=t.getExtension(e)||null),r[e]}function Az(t,e){let r=t.getParameter(7936),i=t.getParameter(7937);Ou(t,"WEBGL_debug_renderer_info",e);let n=e.WEBGL_debug_renderer_info,o=t.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),s=t.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),l=o||r,u=s||i,f=t.getParameter(7938),v=mz(l,u),T=sne(l,u),E=ane(l,u);return{type:"webgl",gpu:v,gpuType:E,gpuBackend:T,vendor:l,renderer:u,version:f,shadingLanguage:"glsl",shadingLanguageVersion:300}}function mz(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function sne(t,e){return/Metal/i.exec(t)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(t)||/ANGLE/i.exec(e)?"opengl":"unknown"}function ane(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(mz(t,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function iT(t){switch(t){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(t))}var Dl="texture-compression-bc",Ho="texture-compression-astc",bf="texture-compression-etc2",lne="texture-compression-etc1-webgl",nT="texture-compression-pvrtc-webgl",P3="texture-compression-atc-webgl",Ax="float32-renderable-webgl",R3="float16-renderable-webgl",cne="rgb9e5ufloat_renderable-webgl",B3="snorm8-renderable-webgl",mx="norm16-renderable-webgl",O3="snorm16-renderable-webgl",oT="float32-filterable",gz="float16-filterable-webgl",gx="WEBGL_compressed_texture_s3tc",_x="WEBGL_compressed_texture_s3tc_srgb",V0="EXT_texture_compression_rgtc",j0="EXT_texture_compression_bptc",une="WEBGL_compressed_texture_etc",hne="WEBGL_compressed_texture_astc",fne="WEBGL_compressed_texture_etc1",dne="WEBGL_compressed_texture_pvrtc",pne="WEBGL_compressed_texture_atc",_z="EXT_texture_norm16",yz="EXT_render_snorm",Ane="EXT_color_buffer_float",sT={"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":[yz],"norm16-renderable-webgl":[_z],"snorm16-renderable-webgl":[_z,yz],"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":[gx,_x,V0,j0],"texture-compression-bc5-webgl":[V0],"texture-compression-bc7-webgl":[j0],"texture-compression-etc2":[une],"texture-compression-astc":[hne],"texture-compression-etc1-webgl":[fne],"texture-compression-pvrtc-webgl":[dne],"texture-compression-atc-webgl":[pne]};function vz(t){return t in sT}function xz(t,e,r){return(sT[e]||[]).every(n=>Ou(t,n,r))}var aT={"rgb8unorm-unsized":{gl:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,rb:!0},r8snorm:{gl:36756,b:1,c:1,render:B3},r8uint:{gl:33330,b:1,c:1,rb:!0},r8sint:{gl:33329,b:1,c:1,rb:!0},rg8unorm:{gl:33323,b:2,c:2,rb:!0},rg8snorm:{gl:36757,b:2,c:2,render:B3},rg8uint:{gl:33336,b:2,c:2,rb:!0},rg8sint:{gl:33335,b:2,c:2,rb:!0},r16uint:{gl:33332,b:2,c:1,rb:!0},r16sint:{gl:33331,b:2,c:1,rb:!0},r16float:{gl:33325,b:2,c:1,render:R3,filter:"float16-filterable-webgl",rb:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:mx,rb:!0},"r16snorm-webgl":{gl:36760,b:2,c:1,f:O3},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,rb:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,rb:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,rb:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,b:4,c:4,bpp:4},rgba8snorm:{gl:36759,b:4,c:4,render:B3},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:R3,filter:gz,rb:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,render:mx},"rg16snorm-webgl":{gl:36761,b:2,c:2,render:O3},r32uint:{gl:33334,b:4,c:1,bpp:4,rb:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,rb:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:Ax,filter:oT},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:cne},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:Ax,rb:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,rb:!0},"rgb10a2uint-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,rb:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:mx},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:mx},rg32uint:{gl:33340,b:8,c:2,rb:!0},rg32sint:{gl:33339,b:8,c:2,rb:!0},rg32float:{gl:33328,b:8,c:2,render:Ax,filter:oT,rb:!0},rgba16uint:{gl:36214,b:8,c:4,rb:!0},rgba16sint:{gl:36232,b:8,c:4,rb:!0},rgba16float:{gl:34842,b:8,c:4,render:R3,filter:gz},"rgba16unorm-webgl":{gl:32859,b:2,c:4,render:mx,rb:!0},"rgba16snorm-webgl":{gl:36763,b:2,c:4,render:O3},"rgb32float-webgl":{gl:34837,render:Ax,filter:oT,gl2ext:Ane,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,rb:!0},rgba32sint:{gl:36226,b:16,c:4,rb:!0},rgba32float:{gl:34836,b:16,c:4,render:Ax,filter:oT,rb:!0},stencil8:{gl:36168,b:1,c:1,attachment:36128,rb:!0},depth16unorm:{gl:33189,b:2,c:1,attachment:36096,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096,dataFormat:6402,types:[5125]},depth32float:{gl:36012,b:4,c:1,attachment:36096,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,dataFormat:34041,types:[34042],rb:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:gx,f:Dl},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:_x,f:Dl},"bc1-rgba-unorm":{gl:33777,x:gx,f:Dl},"bc1-rgba-unorm-srgb":{gl:35916,x:_x,f:Dl},"bc2-rgba-unorm":{gl:33778,x:gx,f:Dl},"bc2-rgba-unorm-srgb":{gl:35918,x:_x,f:Dl},"bc3-rgba-unorm":{gl:33779,x:gx,f:Dl},"bc3-rgba-unorm-srgb":{gl:35919,x:_x,f:Dl},"bc4-r-unorm":{gl:36283,x:V0,f:Dl},"bc4-r-snorm":{gl:36284,x:V0,f:Dl},"bc5-rg-unorm":{gl:36285,x:V0,f:Dl},"bc5-rg-snorm":{gl:36286,x:V0,f:Dl},"bc6h-rgb-ufloat":{gl:36495,x:j0,f:Dl},"bc6h-rgb-float":{gl:36494,x:j0,f:Dl},"bc7-rgba-unorm":{gl:36492,x:j0,f:Dl},"bc7-rgba-unorm-srgb":{gl:36493,x:j0,f:Dl},"etc2-rgb8unorm":{gl:37492,f:bf},"etc2-rgb8unorm-srgb":{gl:37494,f:bf},"etc2-rgb8a1unorm":{gl:37496,f:bf},"etc2-rgb8a1unorm-srgb":{gl:37497,f:bf},"etc2-rgba8unorm":{gl:37493,f:bf},"etc2-rgba8unorm-srgb":{gl:37495,f:bf},"eac-r11unorm":{gl:37488,f:bf},"eac-r11snorm":{gl:37489,f:bf},"eac-rg11unorm":{gl:37490,f:bf},"eac-rg11snorm":{gl:37491,f:bf},"astc-4x4-unorm":{gl:37808,f:Ho},"astc-4x4-unorm-srgb":{gl:37840,f:Ho},"astc-5x4-unorm":{gl:37809,f:Ho},"astc-5x4-unorm-srgb":{gl:37841,f:Ho},"astc-5x5-unorm":{gl:37810,f:Ho},"astc-5x5-unorm-srgb":{gl:37842,f:Ho},"astc-6x5-unorm":{gl:37811,f:Ho},"astc-6x5-unorm-srgb":{gl:37843,f:Ho},"astc-6x6-unorm":{gl:37812,f:Ho},"astc-6x6-unorm-srgb":{gl:37844,f:Ho},"astc-8x5-unorm":{gl:37813,f:Ho},"astc-8x5-unorm-srgb":{gl:37845,f:Ho},"astc-8x6-unorm":{gl:37814,f:Ho},"astc-8x6-unorm-srgb":{gl:37846,f:Ho},"astc-8x8-unorm":{gl:37815,f:Ho},"astc-8x8-unorm-srgb":{gl:37847,f:Ho},"astc-10x5-unorm":{gl:37819,f:Ho},"astc-10x5-unorm-srgb":{gl:37851,f:Ho},"astc-10x6-unorm":{gl:37817,f:Ho},"astc-10x6-unorm-srgb":{gl:37849,f:Ho},"astc-10x8-unorm":{gl:37818,f:Ho},"astc-10x8-unorm-srgb":{gl:37850,f:Ho},"astc-10x10-unorm":{gl:37819,f:Ho},"astc-10x10-unorm-srgb":{gl:37851,f:Ho},"astc-12x10-unorm":{gl:37820,f:Ho},"astc-12x10-unorm-srgb":{gl:37852,f:Ho},"astc-12x12-unorm":{gl:37821,f:Ho},"astc-12x12-unorm-srgb":{gl:37853,f:Ho},"pvrtc-rgb4unorm-webgl":{gl:35840,f:nT},"pvrtc-rgba4unorm-webgl":{gl:35842,f:nT},"pvrtc-rbg2unorm-webgl":{gl:35841,f:nT},"pvrtc-rgba2unorm-webgl":{gl:35843,f:nT},"etc1-rbg-unorm-webgl":{gl:36196,f:lne},"atc-rgb-unorm-webgl":{gl:35986,f:P3},"atc-rgba-unorm-webgl":{gl:35986,f:P3},"atc-rgbai-unorm-webgl":{gl:34798,f:P3}},mne={[6403]:1,[36244]:1,[33319]:2,[33320]:2,[6407]:3,[36248]:3,[6408]:4,[36249]:4,[6402]:1,[34041]:1,[6406]:1,[6409]:1,[6410]:2},gne={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function lT(t,e,r){let i=aT[e];if(!i||i.gl===void 0)return!1;let n=i.x||i.gl2ext;return n?Boolean(Ou(t,n,r)):!0}function D3(t){let r=aT[t]?.gl;if(r===void 0)throw new Error(`Unsupported texture format ${t}`);return r}function bz(t,e,r){if(!lT(t,e,r)||e.startsWith("depth")||e.startsWith("stencil"))return!1;try{if(Y2(e).signed)return!1}catch{return!1}return e.endsWith("32float")?Boolean(Ou(t,"OES_texture_float_linear, extensions",r)):e.endsWith("16float")?Boolean(Ou(t,"OES_texture_half_float_linear, extensions",r)):!0}function wz(t,e,r){return!(!lT(t,e,r)||typeof e=="number")}function H0(t){let e=aT[t],r=D3(t),i=Y2(t);return{format:r,dataFormat:e?.dataFormat||_ne(i.format,i.integer,i.normalized,r),type:i.dataType?iT(i.dataType):e?.types?.[0]||5121,compressed:i.compressed}}function Tz(t){let e=aT[t];if(!e?.attachment)throw new Error(`${t} is not a depth stencil format`);return e.attachment}function L3(t){let e=H0(t),r=mne[e.dataFormat]||4,i=gne[e.type]||1;return r*i}function _ne(t,e,r,i){if(i===6408||i===6407)return i;switch(t){case"r":return e&&!r?36244:6403;case"rg":return e&&!r?33320:33319;case"rgb":return e&&!r?36248:6407;case"rgba":return e&&!r?36249:6408;default:return 6408}}var Ez={"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"},cT=class extends sx{gl;extensions;testedFeatures=new Set;constructor(e,r,i){super([],i),this.gl=e,this.extensions=r,Ou(e,"EXT_color_buffer_float",r)}*[Symbol.iterator](){let e=this.getFeatures();for(let r of e)this.has(r)&&(yield r);return[]}has(e){return this.disabledFeatures[e]?!1:(this.testedFeatures.has(e)||(this.testedFeatures.add(e),vz(e)&&xz(this.gl,e,this.extensions)&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)),this.features.has(e))}initializeFeatures(){let e=this.getFeatures().filter(r=>r!=="polygon-mode-webgl");for(let r of e)this.has(r)}getFeatures(){return[...Object.keys(Ez),...Object.keys(sT)]}getWebGLFeature(e){let r=Ez[e];return Boolean(typeof r=="string"?Ou(this.gl,r,this.extensions):r)}};var uT=class extends ox{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(e){super(),this.gl=e}getParameter(e){return this.limits[e]===void 0&&(this.limits[e]=this.gl.getParameter(e)),this.limits[e]}};function Du(t,e,r){if(yne(e))return r(t);let{nocatch:i=!0}=e;Ip(t),Bu(t,e);let n;if(i)n=r(t),_d(t);else try{n=r(t)}finally{_d(t)}return n}function yne(t){for(let e in t)return!1;return!0}function Cz(t,e,r,i){if(Tp(e))return i(t);let n=t;Ip(n.gl);try{return vne(t,e),Bu(n.gl,r),i(t)}finally{_d(n.gl)}}function vne(t,e){let r=t,{gl:i}=r;if(e.cullMode)switch(e.cullMode){case"none":i.disable(2884);break;case"front":i.enable(2884),i.cullFace(1028);break;case"back":i.enable(2884),i.cullFace(1029);break}if(e.frontFace&&i.frontFace(im("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&i.enable(34383),e.depthBias!==void 0&&i.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0),e.provokingVertex&&t.features.has("provoking-vertex-webgl")){let o=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,s=im("provokingVertex",e.provokingVertex,{first:36429,last:36430});o?.provokingVertexWEBGL(s)}if((e.polygonMode||e.polygonOffsetLine)&&t.features.has("polygon-mode-webgl")){if(e.polygonMode){let o=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,s=im("polygonMode",e.polygonMode,{fill:6914,line:6913});o?.polygonModeWEBGL(1028,s),o?.polygonModeWEBGL(1029,s)}e.polygonOffsetLine&&i.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&i.enable(12288),e.clipDistance1&&i.enable(12289),e.clipDistance2&&i.enable(12290),e.clipDistance3&&i.enable(12291),e.clipDistance4&&i.enable(12292),e.clipDistance5&&i.enable(12293),e.clipDistance6&&i.enable(12294),e.clipDistance7&&i.enable(12295)),e.depthWriteEnabled!==void 0&&i.depthMask(bne("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?i.enable(2929):i.disable(2929),i.depthFunc(fT("depthCompare",e.depthCompare))),e.stencilWriteMask){let n=e.stencilWriteMask;i.stencilMaskSeparate(1028,n),i.stencilMaskSeparate(1029,n)}if(e.stencilReadMask&&Kt.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let n=e.stencilReadMask||4294967295,o=fT("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?i.enable(2960):i.disable(2960),i.stencilFuncSeparate(1028,o,0,n),i.stencilFuncSeparate(1029,o,0,n)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let n=F3("stencilPassOperation",e.stencilPassOperation),o=F3("stencilFailOperation",e.stencilFailOperation),s=F3("stencilDepthFailOperation",e.stencilDepthFailOperation);i.stencilOpSeparate(1028,o,s,n),i.stencilOpSeparate(1029,o,s,n)}if(e.blendColorOperation||e.blendAlphaOperation){i.enable(3042);let n=Sz("blendColorOperation",e.blendColorOperation||"add"),o=Sz("blendAlphaOperation",e.blendAlphaOperation||"add");i.blendEquationSeparate(n,o);let s=hT("blendColorSrcFactor",e.blendColorSrcFactor||"one"),l=hT("blendColorDstFactor",e.blendColorDstFactor||"zero"),u=hT("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),f=hT("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");i.blendFuncSeparate(s,l,u,f)}}function fT(t,e){return im(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function F3(t,e){return im(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Sz(t,e){return im(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function hT(t,e){return im(t,e,{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 xne(t,e){return`Illegal parameter ${e} for ${t}`}function im(t,e,r){if(!(e in r))throw new Error(xne(t,e));return r[e]}function bne(t,e){return e}function dT(t){let e={};return t.addressModeU&&(e[10242]=N3(t.addressModeU)),t.addressModeV&&(e[10243]=N3(t.addressModeV)),t.addressModeW&&(e[32882]=N3(t.addressModeW)),t.magFilter&&(e[10240]=Mz(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=wne(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[33082]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[33083]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[34892]=34894),t.compare&&(e[34893]=fT("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function N3(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function Mz(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}function wne(t,e){if(!e)return Mz(t);switch(t){case"nearest":return e==="nearest"?9984:9986;case"linear":return e==="nearest"?9985:9987}}var Jl=class extends Xi{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(e,r={}){super(e,r),this.device=e,this.gl=this.device.gl;let i=typeof r=="object"?r.handle:void 0;this.handle=i||this.gl.createBuffer(),e.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=Tne(this.props.usage),this.glUsage=Ene(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(e,r=0,i=e.byteLength+r){let n=this.glTarget;this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,i,this.glUsage),this.gl.bufferSubData(n,r,e),this.gl.bindBuffer(n,null),this.bytesUsed=i,this.byteLength=i,this._setDebugData(e,r,i),this.trackAllocatedMemory(i)}_initWithByteLength(e){Yi(e>=0);let r=e;e===0&&(r=new Float32Array(0));let i=this.glTarget;return this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,r,this.glUsage),this.gl.bindBuffer(i,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.trackAllocatedMemory(e),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(e,r=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,r,e),this.gl.bindBuffer(36663,null),this._setDebugData(e,r,e.byteLength)}async readAsync(e=0,r){return this.readSyncWebGL(e,r)}readSyncWebGL(e=0,r){r=r??this.byteLength-e;let i=new Uint8Array(r),n=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,i,n,r),this.gl.bindBuffer(36662,null),this._setDebugData(i,e,r),i}};function Tne(t){return t&Xi.INDEX?34963:t&Xi.VERTEX?34962:t&Xi.UNIFORM?35345:34962}function Ene(t){return t&Xi.INDEX||t&Xi.VERTEX?35044:t&Xi.UNIFORM?35048:35044}var nm=class extends Mp{device;handle;parameters;constructor(e,r){super(e,r),this.device=e,this.parameters=dT(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(e){for(let[r,i]of Object.entries(e)){let n=Number(r);switch(n){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,n,i);break;default:this.device.gl.samplerParameteri(this.handle,n,i);break}}}};var gh=class extends Sp{device;gl;handle;texture;constructor(e,r){super(e,{...bo.defaultProps,...r}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var Sne={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},pT=class extends bo{MAX_ATTRIBUTES;device;gl;handle;sampler=void 0;view=void 0;glFormat=void 0;type=void 0;dataFormat=void 0;mipmaps=void 0;target;textureUnit=void 0;loaded=!1;_video;constructor(e,r){super(e,{...Sne,format:"rgba8unorm",...r}),this.device=e,this.gl=this.device.gl,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=Cne(this.props),this.loaded=!1,typeof this.props?.data=="string"&&Object.assign(this.props,{data:b3(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}createView(e){return new gh(this.device,{...e,texture:this})}initialize(e={}){if(this.props.dimension==="cube")return this.initializeCube(e);let r=e.data;if(r instanceof Promise)return r.then(U=>this.initialize(Object.assign({},e,{pixels:U,data:U}))),this;let i=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(i&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(e)),this;let{parameters:n={}}=e,{pixels:o=null,pixelStore:s={},textureUnit:l=void 0,mipmaps:u=!0}=e;r||(r=o);let{width:f,height:v,dataFormat:T,type:E,compressed:M=!1}=e,{depth:O=0}=e,F=D3(e.format);return{width:f,height:v,compressed:M,dataFormat:T,type:E}=this._deduceParameters({format:e.format,type:E,dataFormat:T,compressed:M,data:r,width:f,height:v}),this.width=f,this.height=v,this.glFormat=F,this.type=E,this.dataFormat=T,this.textureUnit=l,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),this.mipmaps=u,this.setImageData({data:r,width:f,height:v,depth:O,format:F,type:E,dataFormat:T,parameters:s,compressed:M}),this.setSampler(e.sampler),this._setSamplerParameters(n),this.view=this.createView({...this.props,mipLevelCount:1,arrayLayerCount:1}),u&&this.device.isTextureFormatFilterable(e.format)&&this.generateMipmap(),i&&(this._video={video:r,parameters:n,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(e){let{mipmaps:r=!0,parameters:i={}}=e;return this.setCubeMapImageData(e).then(()=>{this.loaded=!0,r&&this.generateMipmap(e),this.setSampler(e.sampler),this._setSamplerParameters(i)}),this}setSampler(e={}){let r;e instanceof nm?(this.sampler=e,r=e.props):(this.sampler=new nm(this.device,e),r=e);let i=dT(r);return this._setSamplerParameters(i),this}resize(e){let{height:r,width:i,mipmaps:n=!1}=e;return i!==this.width||r!==this.height?this.initialize({width:i,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:n}):this}update(){if(this._video){let{video:e,parameters:r,lastTime:i}=this._video;if(i===e.currentTime||e.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:e,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=e.currentTime}}generateMipmap(e={}){return this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Du(this.gl,e,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this}setImageData(e){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(e);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:i=null,level:n=0,glFormat:o=this.glFormat,offset:s=0,parameters:l={}}=e,{data:u=null,type:f=this.type,width:v=this.width,height:T=this.height,dataFormat:E=this.dataFormat,compressed:M=!1}=e;u||(u=i),{type:f,dataFormat:E,compressed:M,width:v,height:T}=this._deduceParameters({format:this.props.format,type:f,dataFormat:E,compressed:M,data:u,width:v,height:T});let{gl:O}=this;O.bindTexture(this.target,this.handle);let F=null;if({data:u,dataType:F}=this._getDataType({data:u,compressed:M}),Du(this.gl,l,()=>{switch(F){case"null":O.texImage2D(r,n,o,v,T,0,E,f,u);break;case"typed-array":O.texImage2D(r,n,o,v,T,0,E,f,u,s);break;case"buffer":this.device.gl.bindBuffer(35052,u.handle||u),this.device.gl.texImage2D(r,n,o,v,T,0,E,f,s),this.device.gl.bindBuffer(35052,null);break;case"browser-object":O.texImage2D(r,n,o,v,T,0,E,f,u);break;case"compressed":for(let[U,G]of u.entries())O.compressedTexImage2D(r,U,G.format,G.width,G.height,0,G.data);break;default:Yi(!1,"Unknown image data type")}}),u&&u.byteLength)this.trackAllocatedMemory(u.byteLength,"Texture");else{let U=L3(this.props.format);this.trackAllocatedMemory(this.width*this.height*U,"Texture")}return this.loaded=!0,this}setSubImageData({target:e=this.target,pixels:r=null,data:i=null,x:n=0,y:o=0,width:s=this.width,height:l=this.height,level:u=0,glFormat:f=this.glFormat,type:v=this.type,dataFormat:T=this.dataFormat,compressed:E=!1,offset:M=0,parameters:O={}}){if({type:v,dataFormat:T,compressed:E,width:s,height:l}=this._deduceParameters({format:this.props.format,type:v,dataFormat:T,compressed:E,data:i,width:s,height:l}),Yi(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=r),i&&i.data){let F=i;i=F.data,s=F.shape[0],l=F.shape[1]}i instanceof Jl&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),Du(this.gl,O,()=>{E?this.gl.compressedTexSubImage2D(e,u,n,o,s,l,f,i):i===null?this.gl.texSubImage2D(e,u,n,o,s,l,T,v,null):ArrayBuffer.isView(i)?this.gl.texSubImage2D(e,u,n,o,s,l,T,v,i,M):typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer?(this.device.gl.bindBuffer(35052,i),this.device.gl.texSubImage2D(e,u,n,o,s,l,T,v,M),this.device.gl.bindBuffer(35052,null)):this.device.gl.texSubImage2D(e,u,n,o,s,l,T,v,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(e={}){return Kt.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,this.handle),e}unbind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,null),e}_getDataType({data:e,compressed:r=!1}){return r?{data:e,dataType:"compressed"}:e===null?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof Jl?{data:e.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&e instanceof WebGLBuffer?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}_deduceParameters(e){let{format:r,data:i}=e,{width:n,height:o,dataFormat:s,type:l,compressed:u}=e,f=H0(r);return s=s||f.dataFormat,l=l||f.type,u=u||f.compressed,{width:n,height:o}=this._deduceImageSize(i,n,o),{dataFormat:s,type:l,compressed:u,width:n,height:o,format:r,data:i}}_deduceImageSize(e,r,i){let n;return typeof ImageData<"u"&&e instanceof ImageData?n={width:e.width,height:e.height}:typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement?n={width:e.naturalWidth,height:e.naturalHeight}:typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement?n={width:e.width,height:e.height}:typeof ImageBitmap<"u"&&e instanceof ImageBitmap?n={width:e.width,height:e.height}:typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?n={width:e.videoWidth,height:e.videoHeight}:e?n={width:r,height:i}:n={width:r>=0?r:1,height:i>=0?i:1},Yi(n,"Could not deduced texture size"),Yi(r===void 0||n.width===r,"Deduced texture width does not match supplied width"),Yi(i===void 0||n.height===i,"Deduced texture height does not match supplied height"),n}async setCubeMapImageData(e){let{gl:r}=this,{width:i,height:n,pixels:o,data:s,format:l=6408,type:u=5121}=e,f=o||s,v=await Promise.all(pT.FACES.map(T=>{let E=f[T];return Promise.all(Array.isArray(E)?E:[E])}));this.bind(),pT.FACES.forEach((T,E)=>{v[E].length>1&&this.props.mipmaps!==!1&&Kt.warn(`${this.id} has mipmap and multiple LODs.`)(),v[E].forEach((M,O)=>{i&&n?r.texImage2D(T,O,l,i,n,0,l,u,M):r.texImage2D(T,O,l,l,u,M)})}),this.unbind()}setImageDataForFace(e){let{face:r,width:i,height:n,pixels:o,data:s,format:l=6408,type:u=5121}=e,{gl:f}=this,v=o||s;return this.bind(),v instanceof Promise?v.then(T=>this.setImageDataForFace(Object.assign({},e,{face:r,data:T,pixels:T}))):this.width||this.height?f.texImage2D(r,0,l,i,n,0,l,u,v):f.texImage2D(r,0,l,l,u,v),this}setImageData3D(e){let{level:r=0,dataFormat:i,format:n,type:o,width:s,height:l,depth:u=1,offset:f=0,data:v,parameters:T={}}=e;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let E=H0(n);if(Du(this.gl,T,()=>{ArrayBuffer.isView(v)&&this.gl.texImage3D(this.target,r,E.format,s,l,u,0,E.dataFormat,E.type,v),v instanceof Jl&&(this.gl.bindBuffer(35052,v.handle),this.gl.texImage3D(this.target,r,i,s,l,u,0,n,o,f))}),v&&v.byteLength)this.trackAllocatedMemory(v.byteLength,"Texture");else{let M=L3(this.props.format);this.trackAllocatedMemory(this.width*this.height*this.depth*M,"Texture")}return this.loaded=!0,this}_setSamplerParameters(e){if(!Tp(e)){Mne(e),this.gl.bindTexture(this.target,this.handle);for(let[r,i]of Object.entries(e)){let n=Number(r),o=i;switch(n){case 33082:case 33083:this.gl.texParameterf(this.target,n,o);break;default:this.gl.texParameteri(this.target,n,o);break}}this.gl.bindTexture(this.target,null)}}},Ql=pT;si(Ql,"FACES",[34069,34070,34071,34072,34073,34074]);function Cne(t){switch(t.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(t.dimension)}}function Mne(t){Kt.log(1,"texture sampler parameters",t)()}var wf=class extends yf{device;gl;handle;get texture(){return this.colorAttachments[0]}constructor(e,r){super(e,r);let i=r.handle===null;if(this.device=e,this.gl=e.gl,this.handle=this.props.handle||i?this.props.handle:this.gl.createFramebuffer(),!i){e.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures();let n=this.gl.bindFramebuffer(36160,this.handle);for(let o=0;o<this.colorAttachments.length;++o){let s=this.colorAttachments[o],l=36064+o;s&&this._attachOne(l,s)}if(this.depthStencilAttachment&&this._attachOne(Tz(this.depthStencilAttachment.props.format),this.depthStencilAttachment),r.check!==!1){let o=this.gl.checkFramebufferStatus(36160);if(o!==36053)throw new Error(`Framebuffer ${Pne(o)}`)}this.gl.bindFramebuffer(36160,n)}}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}createDepthStencilTexture(e){return new Ql(this.device,{id:`${this.id}-depth-stencil`,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;e===void 0&&(e=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let i of this.colorAttachments)i.texture.resize({width:e,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.texture.resize({width:e,height:r}),this}_attachOne(e,r){if(Array.isArray(r)){let[i,n=0,o=0]=r;return this._attachTexture(e,i,n,o),i}if(r instanceof Ql)return this._attachTexture(e,r,0,0),r;if(r instanceof gh){let i=r;return this._attachTexture(e,i.texture,i.props.baseMipLevel,i.props.baseArrayLayer),r.texture}throw new Error("attach")}_attachTexture(e,r,i,n){let{gl:o}=this.device;switch(o.bindTexture(r.target,r.handle),r.target){case 35866:case 32879:o.framebufferTextureLayer(36160,e,r.target,n,i);break;case 34067:let s=Ine(i);o.framebufferTexture2D(36160,e,s,r.handle,n);break;case 3553:o.framebufferTexture2D(36160,e,3553,r.handle,n);break;default:Yi(!1,"Illegal texture type")}o.bindTexture(r.target,null)}};function Ine(t){return t<34069?t+34069:t}function Pne(t){switch(t){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`${t}`}}var AT=class extends Ep{device;presentationSize;_framebuffer=null;constructor(e,r){super(r),this.device=e,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new wf(this.device,{handle:null}),this._framebuffer}update(){let e=this.getPixelSize();(e[0]!==this.presentationSize[0]||e[1]!==this.presentationSize[1])&&(this.presentationSize=e,this.resize())}resize(e){if(this.device.gl&&this.canvas){let r=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(r,e);return}}commit(){}};var Rne={spector:Kt.get("spector")||Kt.get("inspect")},Bne="https://spectorcdn.babylonjs.com/spector.bundle.js",One=1,Ec=null,Iz=!1;async function Pz(t){if(!globalThis.SPECTOR)try{await hx(Bne)}catch(e){Kt.warn(String(e))}}function Rz(t){if(t={...Rne,...t},!t?.spector||(!Ec&&globalThis.SPECTOR&&(Kt.probe(One,"SPECTOR found and initialized")(),Ec=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=Ec)),!Ec))return null;if(Iz||(Iz=!0,Ec.spyCanvases(),Ec?.onCaptureStarted.add(e=>Kt.info("Spector capture started:",e)()),Ec?.onCapture.add(e=>{Kt.info("Spector capture complete:",e)(),Ec?.getResultUI(),Ec?.resultView.display(),Ec?.resultView.addCapture(e)})),t?.canvas){if(typeof t.spector=="string"&&t.spector!==t.canvas.id)return Ec;Ec?.startCapture(t?.canvas,500),new Promise(e=>setTimeout(e,2e3)).then(e=>{Kt.info("Spector capture stopped after 2 seconds")(),Ec?.stopCapture()})}return Ec}var Dne="https://unpkg.com/webgl-debug@2.0.1/index.js";function Bz(t){return t.luma=t.luma||{},t.luma}async function Oz(){Ol()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await hx(Dne))}function Dz(t,e={}){return t?e.debug?Fne(t,e):Lne(t):null}function Lne(t){let e=Bz(t);return e.realContext?e.realContext:t}function Fne(t,e){if(!globalThis.WebGLDebugUtils)return Kt.warn("webgl-debug not loaded")(),t;let r=Bz(t);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...vf,...t});let i=globalThis.WebGLDebugUtils.makeDebugContext(t,Nne.bind(null,e),kne.bind(null,e));for(let s in vf)!(s in i)&&typeof vf[s]=="number"&&(i[s]=vf[s]);class n{}Object.setPrototypeOf(i,Object.getPrototypeOf(t)),Object.setPrototypeOf(n,i);let o=Object.create(n);return r.realContext=t,r.debugContext=o,o.debug=!0,o}function k3(t,e){e=Array.from(e).map(i=>i===void 0?"undefined":i);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${t}(${r})`}function Nne(t,e,r,i){i=Array.from(i).map(l=>l===void 0?"undefined":l);let n=globalThis.WebGLDebugUtils.glEnumToString(e),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,i),s=`${n} in gl.${r}(${o})`;Kt.error(s)();debugger;if(t.throwOnError)throw new Error(s)}function kne(t,e,r){let i="";if(Kt.level>=1&&(i=k3(e,r),Kt.log(1,i)()),t.break&&t.break.length>0&&(i=i||k3(e,r),t.break.every(o=>i.indexOf(o)!==-1)))debugger;for(let n of r)if(n===void 0){if(i=i||k3(e,r),t.throwOnError)throw new Error(`Undefined argument: ${i}`);Kt.error(`Undefined argument: ${i}`)();debugger}}function Fz(t){let e=t.split(/\r?\n/),r=[];for(let i of e){if(i.length<=1)continue;let n=i.split(":");if(n.length===2){let[T,E]=n;r.push({message:E.trim(),type:Lz(T),lineNum:0,linePos:0});continue}let[o,s,l,...u]=n,f=parseInt(l,10);isNaN(f)&&(f=0);let v=parseInt(s,10);isNaN(v)&&(v=0),r.push({message:u.join(":").trim(),type:Lz(o),lineNum:f,linePos:v})}return r}function Lz(t){let e=["warning","error","info"],r=t.toLowerCase();return e.includes(r)?r:"info"}var mT=class extends Cp{device;handle;constructor(e,r){switch(super(e,r),this.device=e,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)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return Fz(e)}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)}async _compile(e){e=(n=>n.startsWith("#version ")?n:`#version 100
553
- ${n}`)(e);let{gl:i}=this.device;if(i.shaderSource(this.handle,e),i.compileShader(this.handle),Kt.level===0){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}Kt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),Kt.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};var Une=256,zne=1024,Vne=16384,U3=6144,jne=[1,2,4,8],gT=class extends L0{device;glParameters;constructor(e,r){super(e,r),this.device=e,Ip(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){_d(this.device.gl),this.props.framebuffer&&Bu(this.device.gl,{framebuffer:null})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),e.scissorRect&&(r.scissorTest=!0,r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(r.colorMask=jne.map(i=>Boolean(i&e.colorMask))),this.glParameters=r,Bu(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=Vne,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=Une,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=zne,e.clearStencil=this.props.clearStencil),r!==0&&Du(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){Du(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl.clearBufferiv(U3,e,r);break;case Uint32Array:this.device.gl.clearBufferuiv(U3,e,r);break;case Float32Array:default:this.device.gl.clearBufferfv(U3,e,r);break}})}};var Hne="Failed to deduce GL constant from typed array";function Nz(t){switch(ArrayBuffer.isView(t)?t.constructor:t){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(Hne)}}function yx(t,e){let{clamped:r=!0}=e||{};switch(t){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")}}var Gne={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},Wne={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},Pp=class{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(e){return yx(e.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(e){return Yi(e.size),yx(e.type||5126).BYTES_PER_ELEMENT*e.size}static resolve(...e){return new Pp(Gne,...e)}constructor(...e){e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return Pp.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return Pp.getBytesPerVertex(this)}_assign(e={}){return e=x3("Accessor",e,Wne),e.type!==void 0&&(this.type=e.type,(e.type===5124||e.type===5125)&&(this.integer=!0)),e.size!==void 0&&(this.size=e.size),e.offset!==void 0&&(this.offset=e.offset),e.stride!==void 0&&(this.stride=e.stride),e.normalize!==void 0&&(this.normalized=e.normalize),e.normalized!==void 0&&(this.normalized=e.normalized),e.integer!==void 0&&(this.integer=e.integer),e.divisor!==void 0&&(this.divisor=e.divisor),e.buffer!==void 0&&(this.buffer=e.buffer),e.index!==void 0&&(typeof e.index=="boolean"?this.index=e.index?1:0:this.index=e.index),e.instanced!==void 0&&(this.divisor=e.instanced?1:0),e.isInstanced!==void 0&&(this.divisor=e.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function kz(t){return qne.includes(t)}var qne=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],Uz={[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 z3(t){let e=Uz[t];if(!e)throw new Error("uniform");let[r,i,,n]=e;return{format:n,components:i,glType:r}}function zz(t){let e=Uz[t];if(!e)throw new Error("attribute");let[,r,,i,n]=e;return{attributeType:i,vertexFormat:n,components:r}}function Vz(t,e){let r={attributes:[],bindings:[]};r.attributes=Xne(t,e);let i=Zne(t,e);for(let l of i){let u=l.uniforms.map(f=>({name:f.name,format:f.format,byteOffset:f.byteOffset,byteStride:f.byteStride,arrayLength:f.arrayLength}));r.bindings.push({type:"uniform",name:l.name,location:l.location,visibility:(l.vertex?1:0)&(l.fragment?2:0),minBindingSize:l.byteLength,uniforms:u})}let n=Kne(t,e),o=0;for(let l of n)if(kz(l.type)){let{viewDimension:u,sampleType:f}=Qne(l.type);r.bindings.push({type:"texture",name:l.name,location:o,viewDimension:u,sampleType:f}),l.textureUnit=o,o+=1}n.length&&(r.uniforms=n);let s=Yne(t,e);return s?.length&&(r.varyings=s),r}function Xne(t,e){let r=[],i=t.getProgramParameter(e,35721);for(let n=0;n<i;n++){let o=t.getActiveAttrib(e,n);if(!o)throw new Error("activeInfo");let{name:s,type:l}=o,u=t.getAttribLocation(e,s);if(u>=0){let{attributeType:f}=zz(l),v=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:u,stepMode:v,type:f})}}return r.sort((n,o)=>n.location-o.location),r}function Yne(t,e){let r=[],i=t.getProgramParameter(e,35971);for(let n=0;n<i;n++){let o=t.getTransformFeedbackVarying(e,n);if(!o)throw new Error("activeInfo");let{name:s,type:l,size:u}=o,{glType:f,components:v}=z3(l),T=new Pp({type:f,size:u*v}),E={location:n,name:s,accessor:T};r.push(E)}return r.sort((n,o)=>n.location-o.location),r}function Kne(t,e){let r=[],i=t.getProgramParameter(e,35718);for(let n=0;n<i;n++){let o=t.getActiveUniform(e,n);if(!o)throw new Error("activeInfo");let{name:s,size:l,type:u}=o,{name:f,isArray:v}=$ne(s),T=t.getUniformLocation(e,f),E={location:T,name:f,size:l,type:u,isArray:v};if(r.push(E),E.size>1)for(let M=0;M<E.size;M++){let O=`${f}[${M}]`;T=t.getUniformLocation(e,O);let F={...E,name:O,location:T};r.push(F)}}return r}function Zne(t,e){let r=(o,s)=>t.getActiveUniformBlockParameter(e,o,s),i=[],n=t.getProgramParameter(e,35382);for(let o=0;o<n;o++){let s={name:t.getActiveUniformBlockName(e,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},l=r(o,35395)||[],u=t.getActiveUniforms(e,l,35383),f=t.getActiveUniforms(e,l,35384),v=t.getActiveUniforms(e,l,35387),T=t.getActiveUniforms(e,l,35388);for(let E=0;E<s.uniformCount;++E){let M=t.getActiveUniform(e,l[E]);if(!M)throw new Error("activeInfo");s.uniforms.push({name:M.name,format:z3(u[E]).format,type:u[E],arrayLength:f[E],byteOffset:v[E],byteStride:T[E]})}i.push(s)}return i.sort((o,s)=>o.location-s.location),i}var Jne={[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 Qne(t){let e=Jne[t];if(!e)throw new Error("sampler");let[r,i]=e;return{viewDimension:r,sampleType:i}}function $ne(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function jz(t,e,r,i){let n=t,o=i;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 i!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,i);case 5126:return t.uniform1fv(e,s);case 35664:return t.uniform2fv(e,s);case 35665:return t.uniform3fv(e,s);case 35666:return t.uniform4fv(e,s);case 5124:return t.uniform1iv(e,s);case 35667:return t.uniform2iv(e,s);case 35668:return t.uniform3iv(e,s);case 35669:return t.uniform4iv(e,s);case 35670:return t.uniform1iv(e,s);case 35671:return t.uniform2iv(e,s);case 35672:return t.uniform3iv(e,s);case 35673:return t.uniform4iv(e,s);case 5125:return n.uniform1uiv(e,s,1);case 36294:return n.uniform2uiv(e,s,2);case 36295:return n.uniform3uiv(e,s,3);case 36296:return n.uniform4uiv(e,s,4);case 35674:return t.uniformMatrix2fv(e,!1,s);case 35675:return t.uniformMatrix3fv(e,!1,s);case 35676:return t.uniformMatrix4fv(e,!1,s);case 35685:return n.uniformMatrix2x3fv(e,!1,s);case 35686:return n.uniformMatrix2x4fv(e,!1,s);case 35687:return n.uniformMatrix3x2fv(e,!1,s);case 35688:return n.uniformMatrix3x4fv(e,!1,s);case 35689:return n.uniformMatrix4x2fv(e,!1,s);case 35690:return n.uniformMatrix4x3fv(e,!1,s)}throw new Error("Illegal uniform")}function Hz(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(t)}}function Gz(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(t)}}var Wz=4,_T=class extends mh{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,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:i,bufferMode:n=35981}=r;switch(i&&i.length>0&&(this.varyings=i,this.device.gl.transformFeedbackVaryings(this.handle,i,n)),this._linkShaders(),Kt.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=Vz(this.device.gl,this.handle),Kt.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=p3(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":Kt.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e,r){for(let[i,n]of Object.entries(e)){let o=this.shaderLayout.bindings.find(s=>s.name===i)||this.shaderLayout.bindings.find(s=>s.name===`${i}Uniforms`);if(!o){let s=this.shaderLayout.bindings.map(l=>`"${l.name}"`).join(", ");r?.disableWarnings||Kt.warn(`Unknown binding "${i}" in render pipeline "${this.id}", expected one of ${s}`)();continue}switch(n||Kt.warn(`Unsetting binding "${i}" in render pipeline "${this.id}"`)(),o.type){case"uniform":if(!(n instanceof Jl)&&!(n.buffer instanceof Jl))throw new Error("buffer value");break;case"texture":if(!(n instanceof gh||n instanceof Ql||n instanceof wf))throw new Error("texture value");break;case"sampler":Kt.warn(`Ignoring sampler ${i}`)();break;default:throw new Error(o.type)}this.bindings[i]=n}}draw(e){let{renderPass:r,parameters:i=this.props.parameters,topology:n=this.props.topology,vertexArray:o,vertexCount:s,instanceCount:l,firstVertex:u=0,transformFeedback:f}=e,v=Hz(n),T=Boolean(o.indexBuffer),E=o.indexBuffer?.glIndexType,M=Number(l)>0;if(this.linkStatus!=="success")return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable()||s===0)return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;if(s===0)return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)(),!0;this.device.gl.useProgram(this.handle),o.bindBeforeRender(r),f&&f.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let O=r;return Cz(this.device,i,O.glParameters,()=>{T&&M?this.device.gl.drawElementsInstanced(v,s||0,E,u,l||0):T?this.device.gl.drawElements(v,s||0,E,u):M?this.device.gl.drawArraysInstanced(v,u,s||0,l||0):this.device.gl.drawArrays(v,u,s||0),f&&f.end()}),o.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=ux(e);Object.keys(r).forEach(i=>{Kt.warn(`Unsupported value "${JSON.stringify(r[i])}" used in setUniforms() for key ${i}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),Kt.time(Wz,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),Kt.timeEnd(Wz,`linkProgram for ${this.id}`)(),Kt.level,!this.device.features.has("compilation-status-async-webgl")){let i=this._getLinkStatus();this._reportLinkStatus(i);return}Kt.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),Kt.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}_reportLinkStatus(e){switch(e){case"success":return;default:throw this.vs.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`)):this.fs?.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`)):new Error(`Error during ${e}: ${this.device.gl.getProgramInfoLog(this.handle)}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let[,r]of Object.entries(this.bindings))r instanceof Ql&&(r.update(),e=e&&r.loaded);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,i=0;for(let n of this.shaderLayout.bindings){let o=this.bindings[n.name]||this.bindings[n.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${n.name} in ${this.id}`);switch(n.type){case"uniform":let{name:s}=n,l=e.getUniformBlockIndex(this.handle,s);if(l===4294967295)throw new Error(`Invalid uniform block name ${s}`);e.uniformBlockBinding(this.handle,i,l),o instanceof Jl?e.bindBufferBase(35345,i,o.handle):e.bindBufferRange(35345,i,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),i+=1;break;case"texture":if(!(o instanceof gh||o instanceof Ql||o instanceof wf))throw new Error("texture");let u;if(o instanceof gh)u=o.texture;else if(o instanceof Ql)u=o;else if(o instanceof wf&&o.colorAttachments[0]instanceof gh)Kt.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),u=o.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+r),e.bindTexture(u.target,u.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${n.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:i,type:n,textureUnit:o}=e,s=this.uniforms[r]??o;s!==void 0&&jz(this.device.gl,i,n,s)}}};var yT=class extends N0{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":eoe(this.device,r.options);break;case"copy-buffer-to-texture":toe(this.device,r.options);break;case"copy-texture-to-buffer":roe(this.device,r.options);break;case"copy-texture-to-texture":ioe(this.device,r.options);break}}};function eoe(t,e){let r=e.source,i=e.destination;t.gl.bindBuffer(36662,r.handle),t.gl.bindBuffer(36663,i.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function toe(t,e){throw new Error("Not implemented")}function roe(t,e){let{source:r,mipLevel:i=0,aspect:n="all",width:o=e.source.width,height:s=e.source.height,depthOrArrayLayers:l=0,origin:u=[0,0],destination:f,byteOffset:v=0,bytesPerRow:T,rowsPerImage:E}=e;if(n!=="all")throw new Error("not supported");if(i!==0||l!==0||T||E)throw new Error("not implemented");let{framebuffer:M,destroyFramebuffer:O}=qz(r),F;try{let U=f,G=o||M.width,J=s||M.height,K=H0(M.texture.props.format),ne=K.dataFormat,ge=K.type;t.gl.bindBuffer(35051,U.handle),F=t.gl.bindFramebuffer(36160,M.handle),t.gl.readPixels(u[0],u[1],G,J,ne,ge,v)}finally{t.gl.bindBuffer(35051,null),F!==void 0&&t.gl.bindFramebuffer(36160,F),O&&M.destroy()}}function ioe(t,e){let{source:r,destinationMipLevel:i=0,origin:n=[0,0],destinationOrigin:o=[0,0],destination:s}=e,{width:l=e.destination.width,height:u=e.destination.height}=e,{framebuffer:f,destroyFramebuffer:v}=qz(r),[T,E]=n,[M,O,F]=o,U=t.gl.bindFramebuffer(36160,f.handle),G=null,J;if(s instanceof Ql)G=s,l=Number.isFinite(l)?l:G.width,u=Number.isFinite(u)?u:G.height,G.bind(0),J=G.target;else throw new Error("invalid destination");switch(J){case 3553:case 34067:t.gl.copyTexSubImage2D(J,i,M,O,T,E,l,u);break;case 35866:case 32879:t.gl.copyTexSubImage3D(J,i,M,O,F,T,E,l,u);break;default:}G&&G.unbind(),t.gl.bindFramebuffer(36160,U),v&&f.destroy()}function qz(t){if(t instanceof bo){let{width:e,height:r,id:i}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${i}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var vT=class extends F0{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new yT(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,i){}};var G0=class extends k0{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return HP()==="Chrome"}constructor(e,r){super(e,r),this.device=e,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(e){let r=e;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(e,r){let i=r;if(i.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:n,type:o,stride:s,offset:l,normalized:u,integer:f,divisor:v}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,i.handle),f?this.device.gl.vertexAttribIPointer(e,n,o,s,l):this.device.gl.vertexAttribPointer(e,n,o,u,s,l),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,v||0),this.attributes[e]=i,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let r=this.attributes[e];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(e,r)}}_getAccessor(e){let r=this.attributeInfos[e];if(!r)throw new Error(`Unknown attribute location ${e}`);let i=iT(r.bufferDataType);return{size:r.bufferComponents,type:i,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(e,r=!0){let n=G0.isConstantAttributeZeroSupported(this.device)||e!==0;(r||n)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,r){let i=noe(r),n=i.byteLength*e,o=i.length*e;if(this.buffer&&n!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${n} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:n}),s=s||!ooe(i,this.bufferValue),s){let l=_3(r.constructor,o);y3({target:l,source:i,start:0,count:o}),this.buffer.write(l),this.bufferValue=r}return this.buffer}};function noe(t){return Array.isArray(t)?new Float32Array(t):t}function ooe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var xT=class extends U0{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,r){super(e,r),this.device=e,this.gl=e.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(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(Gz(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let i=this._getVaryingIndex(e),{buffer:n,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(i<0){this.unusedBuffers[e]=n,Kt.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[i]={buffer:n,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(i,n,s,o)}getBuffer(e){if(Xz(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof Jl)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:i=0,byteLength:n=e.buffer.byteLength}=e;return{buffer:r,byteOffset:i,byteLength:n}}_getVaryingIndex(e){if(Xz(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:i,byteOffset:n}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,n,i)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,r,i=0,n){let o=r&&r.handle;!o||n===void 0?this.gl.bindBufferBase(35982,e,o):this.gl.bindBufferRange(35982,e,o,i,n)}};function Xz(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var bT=class extends z0{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,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(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,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 e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,n)=>{let o=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>e?(n("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};function V3(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return Yi(!1),0}}function Yz(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return Yi(!1),0}}function Kz(t,e){let{sourceX:r=0,sourceY:i=0,sourceFormat:n=6408,sourceAttachment:o=36064}=e||{},{target:s=null,sourceWidth:l,sourceHeight:u,sourceType:f}=e||{},{framebuffer:v,deleteFramebuffer:T}=Jz(t);Yi(v);let{gl:E,handle:M}=v;l=l||v.width,u=u||v.height;let O=o-36064;f=f||v.colorAttachments[O]?.texture?.type||5121,s=aoe(s,f,n,l,u),f=f||Nz(s);let F=E.bindFramebuffer(36160,M);return E.readPixels(r,i,l,u,n,f,s),E.bindFramebuffer(36160,F||null),T&&v.destroy(),s}function Zz(t,e){let{target:r,sourceX:i=0,sourceY:n=0,sourceFormat:o=6408,targetByteOffset:s=0}=e||{},{sourceWidth:l,sourceHeight:u,sourceType:f}=e||{},{framebuffer:v,deleteFramebuffer:T}=Jz(t);Yi(v),l=l||v.width,u=u||v.height;let E=v;f=f||5121;let M=r;if(!M){let F=V3(o),U=Yz(f),G=s+l*u*F*U;M=E.device.createBuffer({byteLength:G})}let O=t.device.createCommandEncoder();return O.copyTextureToBuffer({source:t,width:l,height:u,origin:[i,n],destination:M,byteOffset:s}),O.destroy(),T&&v.destroy(),M}function Jz(t){return t instanceof yf?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:soe(t),deleteFramebuffer:!0}}function soe(t,e){let{device:r,width:i,height:n,id:o}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${o}`,width:i,height:n,colorAttachments:[t]})}function aoe(t,e,r,i,n){if(t)return t;e=e||5121;let o=yx(e,{clamped:!1}),s=V3(r);return new o(i*n*s)}var loe=256,coe=1024,uoe=16384;var hoe="clear: bad arguments";function Qz(t,e){let{framebuffer:r=null,color:i=null,depth:n=null,stencil:o=null}=e||{},s={};r&&(s.framebuffer=r);let l=0;i&&(l|=uoe,i!==!0&&(s.clearColor=i)),n&&(l|=loe,n!==!0&&(s.clearDepth=n)),o&&(l|=coe,n!==!0&&(s.clearStencil=n)),Yi(l!==0,hoe);let u=t.gl;Du(u,s,()=>{u.clear(l)})}var vx=1,W0=class extends wc{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;static isSupported(){return typeof WebGL2RenderingContext<"u"}static attach(e){if(e instanceof W0)return e;if(e?.device instanceof wc)return e.device;if(!foe(e))throw new Error("Invalid WebGL2RenderingContext");return new W0({gl:e})}static async create(e={}){Kt.groupCollapsed(vx,"WebGLDevice created")();let r=[];e.debug&&r.push(Oz()),e.spector&&r.push(Pz()),typeof e.canvas=="string"&&r.push(Ep.pageLoaded);let i=await Promise.allSettled(r);for(let s of i)s.status==="rejected"&&Kt.error(`Failed to initialize debug libraries ${s.reason}`)();if(Kt.probe(vx+1,"DOM is loaded")(),e.gl?.device)return Kt.warn("reattaching existing device")(),W0.attach(e.gl);let n=new W0(e),o=`Created ${n.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return Kt.probe(vx,o)(),Kt.table(vx,n.info)(),Kt.groupEnd(vx)(),n}constructor(e){super({...e,id:e.id||oa("webgl-device")});let r=e.gl?.device;if(r)throw new Error(`WebGL context already attached to device ${r.id}`);let i=e.gl?.canvas||e.canvas;this.canvasContext=new AT(this,{...e,canvas:i}),this.lost=new Promise(l=>{this._resolveContextLost=l});let n=e.gl||null;if(n||=pz(this.canvasContext.canvas,{...e,onContextLost:l=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})}),!n)throw new Error("WebGL context creation failed");this.handle=n,this.gl=n,this.gl.device=this,this.gl._version=2,this.info=Az(this.gl,this._extensions),this.limits=new uT(this.gl),this.features=new cT(this.gl,this._extensions,this.props.disabledFeatures),this.props.initalizeFeatures&&this.features.initializeFeatures(),this.canvasContext.resize();let{enable:o=!0,copyState:s=!1}=e;I3(this.gl,{enable:o,copyState:s,log:(...l)=>Kt.log(1,...l)()}),e.debug&&(this.gl=Dz(this.gl,{...e,throwOnError:!0}),this.debug=!0,Kt.level=Math.max(Kt.level,1),Kt.warn("WebGL debug mode activated. Performance reduced.")()),e.spector&&(this.spectorJS=Rz({...this.props,canvas:this.handle.canvas}))}destroy(){}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(e){return lT(this.gl,e,this._extensions)}isTextureFormatFilterable(e){return bz(this.gl,e,this._extensions)}isTextureFormatRenderable(e){return wz(this.gl,e,this._extensions)}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._getBufferProps(e);return new Jl(this,r)}_createTexture(e){return new Ql(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new nm(this,e)}createShader(e){return new mT(this,e)}createFramebuffer(e){return new wf(this,e)}createVertexArray(e){return new G0(this,e)}createTransformFeedback(e){return new xT(this,e)}createQuerySet(e){return new bT(this,e)}createRenderPipeline(e){return new _T(this,e)}beginRenderPass(e){return new gT(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(e){return new vT(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return Kz(e,r)}readPixelsToBufferWebGL(e,r){return Zz(e,r)}setParametersWebGL(e){Bu(this.gl,e)}getParametersWebGL(e){return rT(this.gl,e)}withParametersWebGL(e,r){return Du(this.gl,e,r)}clearWebGL(e){Qz(this,e)}resetWebGL(){Kt.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),hz(this.gl)}gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;loseDevice(){let e=!1,i=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return i&&(e=!0,i.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){Ip(this.gl)}popState(){_d(this.gl)}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){r=r||this.gl2||this.gl;let i=Number(e);for(let n in r)if(r[n]===i)return`GL.${n}`;return String(e)}_constants;setConstantAttributeWebGL(e,r){let i=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(i).fill(null);let n=this._constants[e];switch(n&&moe(n,r)&&Kt.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:doe(this,e,r);break;case Int32Array:poe(this,e,r);break;case Uint32Array:Aoe(this,e,r);break;default:Yi(!1)}}getExtension(e){return Ou(this.gl,e,this._extensions),this._extensions}},Tf=W0;si(Tf,"type","webgl");function foe(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:Boolean(t&&Number.isFinite(t._version))}function doe(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:Yi(!1)}}function poe(t,e,r){t.gl.vertexAttribI4iv(e,r)}function Aoe(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function moe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var $z,e5,r5={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function wT(){return document.createElement("div")}function goe(t){if(!t.picked)return null;if(t.object===$z)return e5;let e={html:yoe(t.object),style:r5};return e5=e,$z=t.object,e}var _oe=new Set(["position","index"]);function yoe(t){let e=wT();for(let r in t){if(_oe.has(r))continue;let i=wT();i.className="header",i.textContent=r;let n=wT();n.className="value",n.textContent=xoe(t[r]);let o=wT();voe(o,i,n),o.appendChild(i),o.appendChild(n),e.appendChild(o)}return e.innerHTML}function voe(t,e,r){Object.assign(e.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(t.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function xoe(t){let e;if(Array.isArray(t)&&t.length>4)e=`Array<${t.length}>`;else if(typeof t=="string")e=t;else if(typeof t=="number")e=String(t);else try{e=JSON.stringify(t)}catch{e="<Non-Serializable Object>"}let r=50;return e.length>r&&(e=e.slice(0,r)),e}function t5(t,e){let r,i=t,n="properties",o=/{[^}]*}/g,s=u=>u.replace(/[{}]/g,""),l=[...new Set(t.match(o).map(s))];for(let u of l){if(u.includes(".")){r=e;let f=u.split(".");for(let v of f)if(r.hasOwnProperty(v))r=r[v];else{r=void 0;break}}else e.hasOwnProperty(u)?r=e[u]:e[n]&&e[n].hasOwnProperty(u)?r=e[n][u]:r=void 0;i=i.replaceAll(`{${u}}`,r)}return i}function j3(t){return t?t.html||t.text?e=>{if(!e.picked)return null;let r={style:t.style||r5};return t.html?r.html=t5(t.html,e.object):r.text=t5(t.text,e.object),r}:goe:null}function i5(t){let e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=t,document.getElementsByTagName("head")[0].appendChild(e)}function n5(t,e){let r=document.createElement("div");return r.style.width=Number.isFinite(t)?`${t}px`:t,r.style.height=`${e}px`,r.style.position="relative",r}var s5=ga(o5()),boe="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",W3=s5.default;function a5(t=boe){i5(t)}function l5(){let t=["mapboxgl-missing-css"];for(let e of t){let r=document.getElementsByClassName(e)[0];r&&r.style&&(r.style.display="none")}}var q3={};function c5(t){if(!q3[t]){let e=document.createElement("script");e.type="text/javascript",e.src=t,document.querySelector("head").appendChild(e),q3[t]=new Promise(i=>{e.onload=i})}return q3[t]}var u5="4.1.4";var X3,woe=(X3=globalThis.loaders)===null||X3===void 0?void 0:X3.parseImageNode,Y3=typeof Image<"u",K3=typeof ImageBitmap<"u",Toe=Boolean(woe),Z3=gd?!0:Toe;function h5(t){switch(t){case"auto":return K3||Y3||Z3;case"imagebitmap":return K3;case"image":return Y3;case"data":return Z3;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function f5(){if(K3)return"imagebitmap";if(Y3)return"image";if(Z3)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function d5(t){let e=Eoe(t);if(!e)throw new Error("Not an image");return e}function xx(t){switch(d5(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Eoe(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Soe=/^data:image\/svg\+xml/,Coe=/\.svg((\?|#).*)?$/;function TT(t){return t&&(Soe.test(t)||Coe.test(t))}function p5(t,e){if(TT(e)){let i=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return J3(t,e)}function J3(t,e){if(TT(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function ET(t,e,r){let i=p5(t,r),n=self.URL||self.webkitURL,o=typeof i!="string"&&n.createObjectURL(i);try{return await Moe(o||i,e)}finally{o&&n.revokeObjectURL(o)}}async function Moe(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";n(new Error(s))}}catch(o){n(o)}})}var Ioe={},A5=!0;async function m5(t,e,r){let i;TT(r)?i=await ET(t,e,r):i=J3(t,r);let n=e&&e.imagebitmap;return await Poe(i,n)}async function Poe(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((Roe(e)||!A5)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),A5=!1}return await createImageBitmap(t)}function Roe(t){for(let e in t||Ioe)return!1;return!0}function g5(t){return!Loe(t,"ftyp",4)||!(t[8]&96)?null:Boe(t)}function Boe(t){switch(Ooe(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Ooe(t,e,r){return String.fromCharCode(...t.slice(e,r))}function Doe(t){return[...t].map(e=>e.charCodeAt(0))}function Loe(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=Doe(e);for(let n=0;n<i.length;++n)if(i[n]!==t[n+r])return!1;return!0}var Ef=!1,bx=!0;function om(t){let e=wx(t);return Noe(e)||zoe(e)||koe(e)||Uoe(e)||Foe(e)}function Foe(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=g5(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function Noe(t){let e=wx(t);return e.byteLength>=24&&e.getUint32(0,Ef)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Ef),height:e.getUint32(20,Ef)}:null}function koe(t){let e=wx(t);return e.byteLength>=10&&e.getUint32(0,Ef)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,bx),height:e.getUint16(8,bx)}:null}function Uoe(t){let e=wx(t);return e.byteLength>=14&&e.getUint16(0,Ef)===16973&&e.getUint32(2,bx)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,bx),height:e.getUint32(22,bx)}:null}function zoe(t){let e=wx(t);if(!(e.byteLength>=3&&e.getUint16(0,Ef)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=Voe(),o=2;for(;o+9<e.byteLength;){let s=e.getUint16(o,Ef);if(n.has(s))return{mimeType:"image/jpeg",height:e.getUint16(o+5,Ef),width:e.getUint16(o+7,Ef)};if(!i.has(s))return null;o+=2,o+=e.getUint16(o,Ef)}return null}function Voe(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function wx(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function _5(t,e){var r;let{mimeType:i}=om(t)||{},n=(r=globalThis.loaders)===null||r===void 0?void 0:r.parseImageNode;return On(n),await n(t,i)}async function y5(t,e,r){e=e||{};let n=(e.image||{}).type||"auto",{url:o}=r||{},s=joe(n),l;switch(s){case"imagebitmap":l=await m5(t,e,o);break;case"image":l=await ET(t,e,o);break;case"data":l=await _5(t,e);break;default:On(!1)}return n==="data"&&(l=xx(l)),l}function joe(t){switch(t){case"auto":case"data":return f5();default:return h5(t),t}}var Hoe=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Goe=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Woe={image:{type:"auto",decode:!0}},Sf={id:"image",module:"images",name:"Images",version:u5,mimeTypes:Goe,extensions:Hoe,parse:y5,tests:[t=>Boolean(om(new DataView(t)))],options:Woe};var Q3={};function $3(t){if(Q3[t]===void 0){let e=gd?Xoe(t):qoe(t);Q3[t]=e}return Q3[t]}function qoe(t){var e,r;let i=["image/png","image/jpeg","image/gif"],n=((e=globalThis.loaders)===null||e===void 0?void 0:e.imageFormatsNode)||i,o=(r=globalThis.loaders)===null||r===void 0?void 0:r.parseImageNode;return Boolean(o)&&n.includes(t)}function Xoe(t){switch(t){case"image/avif":case"image/webp":return Yoe(t);default:return!0}}function Yoe(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var Koe=new bc({id:"deck"}),ur=Koe;var eR={};function v5(t){eR=t}function Ks(t,e,r,i){ur.level>0&&eR[t]&&eR[t].call(null,e,r,i)}function Zoe(t){let e=t[0],r=t[t.length-1];return e==="{"&&r==="}"||e==="["&&r==="]"}var x5={id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:Zoe,parseTextSync:JSON.parse};function Joe(){let t="9.0.1",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(ur.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:ur,_registerLoggers:v5},em([x5,[Sf,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}var ST=Joe();function Cf(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var tR={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function w5(t){let e={};for(let[r,i]of Object.entries(t))e[r]=Qoe(i);return e}function T5(t,e,r){let i={};for(let[n,o]of Object.entries(e))t&&n in t&&!o.private?(o.validate&&Cf(o.validate(t[n],o),`${r}: invalid ${n}`),i[n]=t[n]):i[n]=o.value;return i}function Qoe(t){let e=b5(t);if(e!=="object")return{value:t,...tR[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...tR[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=b5(t.value),{...t,...tR[e],type:e}):{type:"object",value:null};throw new Error("props")}function b5(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var E5=`#ifdef MODULE_LOGDEPTH
553
+ ${n}`)(e);let{gl:i}=this.device;if(i.shaderSource(this.handle,e),i.compileShader(this.handle),Kt.level===0){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}Kt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),Kt.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};var Une=256,zne=1024,Vne=16384,U3=6144,jne=[1,2,4,8],gT=class extends L0{device;glParameters;constructor(e,r){super(e,r),this.device=e,Ip(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){_d(this.device.gl),this.props.framebuffer&&Bu(this.device.gl,{framebuffer:null})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),e.scissorRect&&(r.scissorTest=!0,r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(r.colorMask=jne.map(i=>Boolean(i&e.colorMask))),this.glParameters=r,Bu(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=Vne,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=Une,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=zne,e.clearStencil=this.props.clearStencil),r!==0&&Du(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){Du(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl.clearBufferiv(U3,e,r);break;case Uint32Array:this.device.gl.clearBufferuiv(U3,e,r);break;case Float32Array:default:this.device.gl.clearBufferfv(U3,e,r);break}})}};var Hne="Failed to deduce GL constant from typed array";function Nz(t){switch(ArrayBuffer.isView(t)?t.constructor:t){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(Hne)}}function yx(t,e){let{clamped:r=!0}=e||{};switch(t){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")}}var Gne={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},Wne={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},Pp=class{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(e){return yx(e.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(e){return Yi(e.size),yx(e.type||5126).BYTES_PER_ELEMENT*e.size}static resolve(...e){return new Pp(Gne,...e)}constructor(...e){e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return Pp.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return Pp.getBytesPerVertex(this)}_assign(e={}){return e=x3("Accessor",e,Wne),e.type!==void 0&&(this.type=e.type,(e.type===5124||e.type===5125)&&(this.integer=!0)),e.size!==void 0&&(this.size=e.size),e.offset!==void 0&&(this.offset=e.offset),e.stride!==void 0&&(this.stride=e.stride),e.normalize!==void 0&&(this.normalized=e.normalize),e.normalized!==void 0&&(this.normalized=e.normalized),e.integer!==void 0&&(this.integer=e.integer),e.divisor!==void 0&&(this.divisor=e.divisor),e.buffer!==void 0&&(this.buffer=e.buffer),e.index!==void 0&&(typeof e.index=="boolean"?this.index=e.index?1:0:this.index=e.index),e.instanced!==void 0&&(this.divisor=e.instanced?1:0),e.isInstanced!==void 0&&(this.divisor=e.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function kz(t){return qne.includes(t)}var qne=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],Uz={[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 z3(t){let e=Uz[t];if(!e)throw new Error("uniform");let[r,i,,n]=e;return{format:n,components:i,glType:r}}function zz(t){let e=Uz[t];if(!e)throw new Error("attribute");let[,r,,i,n]=e;return{attributeType:i,vertexFormat:n,components:r}}function Vz(t,e){let r={attributes:[],bindings:[]};r.attributes=Xne(t,e);let i=Zne(t,e);for(let l of i){let u=l.uniforms.map(f=>({name:f.name,format:f.format,byteOffset:f.byteOffset,byteStride:f.byteStride,arrayLength:f.arrayLength}));r.bindings.push({type:"uniform",name:l.name,location:l.location,visibility:(l.vertex?1:0)&(l.fragment?2:0),minBindingSize:l.byteLength,uniforms:u})}let n=Kne(t,e),o=0;for(let l of n)if(kz(l.type)){let{viewDimension:u,sampleType:f}=Qne(l.type);r.bindings.push({type:"texture",name:l.name,location:o,viewDimension:u,sampleType:f}),l.textureUnit=o,o+=1}n.length&&(r.uniforms=n);let s=Yne(t,e);return s?.length&&(r.varyings=s),r}function Xne(t,e){let r=[],i=t.getProgramParameter(e,35721);for(let n=0;n<i;n++){let o=t.getActiveAttrib(e,n);if(!o)throw new Error("activeInfo");let{name:s,type:l}=o,u=t.getAttribLocation(e,s);if(u>=0){let{attributeType:f}=zz(l),v=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:u,stepMode:v,type:f})}}return r.sort((n,o)=>n.location-o.location),r}function Yne(t,e){let r=[],i=t.getProgramParameter(e,35971);for(let n=0;n<i;n++){let o=t.getTransformFeedbackVarying(e,n);if(!o)throw new Error("activeInfo");let{name:s,type:l,size:u}=o,{glType:f,components:v}=z3(l),T=new Pp({type:f,size:u*v}),E={location:n,name:s,accessor:T};r.push(E)}return r.sort((n,o)=>n.location-o.location),r}function Kne(t,e){let r=[],i=t.getProgramParameter(e,35718);for(let n=0;n<i;n++){let o=t.getActiveUniform(e,n);if(!o)throw new Error("activeInfo");let{name:s,size:l,type:u}=o,{name:f,isArray:v}=$ne(s),T=t.getUniformLocation(e,f),E={location:T,name:f,size:l,type:u,isArray:v};if(r.push(E),E.size>1)for(let M=0;M<E.size;M++){let O=`${f}[${M}]`;T=t.getUniformLocation(e,O);let F={...E,name:O,location:T};r.push(F)}}return r}function Zne(t,e){let r=(o,s)=>t.getActiveUniformBlockParameter(e,o,s),i=[],n=t.getProgramParameter(e,35382);for(let o=0;o<n;o++){let s={name:t.getActiveUniformBlockName(e,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},l=r(o,35395)||[],u=t.getActiveUniforms(e,l,35383),f=t.getActiveUniforms(e,l,35384),v=t.getActiveUniforms(e,l,35387),T=t.getActiveUniforms(e,l,35388);for(let E=0;E<s.uniformCount;++E){let M=t.getActiveUniform(e,l[E]);if(!M)throw new Error("activeInfo");s.uniforms.push({name:M.name,format:z3(u[E]).format,type:u[E],arrayLength:f[E],byteOffset:v[E],byteStride:T[E]})}i.push(s)}return i.sort((o,s)=>o.location-s.location),i}var Jne={[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 Qne(t){let e=Jne[t];if(!e)throw new Error("sampler");let[r,i]=e;return{viewDimension:r,sampleType:i}}function $ne(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function jz(t,e,r,i){let n=t,o=i;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 i!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,i);case 5126:return t.uniform1fv(e,s);case 35664:return t.uniform2fv(e,s);case 35665:return t.uniform3fv(e,s);case 35666:return t.uniform4fv(e,s);case 5124:return t.uniform1iv(e,s);case 35667:return t.uniform2iv(e,s);case 35668:return t.uniform3iv(e,s);case 35669:return t.uniform4iv(e,s);case 35670:return t.uniform1iv(e,s);case 35671:return t.uniform2iv(e,s);case 35672:return t.uniform3iv(e,s);case 35673:return t.uniform4iv(e,s);case 5125:return n.uniform1uiv(e,s,1);case 36294:return n.uniform2uiv(e,s,2);case 36295:return n.uniform3uiv(e,s,3);case 36296:return n.uniform4uiv(e,s,4);case 35674:return t.uniformMatrix2fv(e,!1,s);case 35675:return t.uniformMatrix3fv(e,!1,s);case 35676:return t.uniformMatrix4fv(e,!1,s);case 35685:return n.uniformMatrix2x3fv(e,!1,s);case 35686:return n.uniformMatrix2x4fv(e,!1,s);case 35687:return n.uniformMatrix3x2fv(e,!1,s);case 35688:return n.uniformMatrix3x4fv(e,!1,s);case 35689:return n.uniformMatrix4x2fv(e,!1,s);case 35690:return n.uniformMatrix4x3fv(e,!1,s)}throw new Error("Illegal uniform")}function Hz(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(t)}}function Gz(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(t)}}var Wz=4,_T=class extends mh{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,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:i,bufferMode:n=35981}=r;switch(i&&i.length>0&&(this.varyings=i,this.device.gl.transformFeedbackVaryings(this.handle,i,n)),this._linkShaders(),Kt.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=Vz(this.device.gl,this.handle),Kt.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=p3(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":Kt.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e,r){for(let[i,n]of Object.entries(e)){let o=this.shaderLayout.bindings.find(s=>s.name===i)||this.shaderLayout.bindings.find(s=>s.name===`${i}Uniforms`);if(!o){let s=this.shaderLayout.bindings.map(l=>`"${l.name}"`).join(", ");r?.disableWarnings||Kt.warn(`Unknown binding "${i}" in render pipeline "${this.id}", expected one of ${s}`)();continue}switch(n||Kt.warn(`Unsetting binding "${i}" in render pipeline "${this.id}"`)(),o.type){case"uniform":if(!(n instanceof Jl)&&!(n.buffer instanceof Jl))throw new Error("buffer value");break;case"texture":if(!(n instanceof gh||n instanceof Ql||n instanceof wf))throw new Error("texture value");break;case"sampler":Kt.warn(`Ignoring sampler ${i}`)();break;default:throw new Error(o.type)}this.bindings[i]=n}}draw(e){let{renderPass:r,parameters:i=this.props.parameters,topology:n=this.props.topology,vertexArray:o,vertexCount:s,instanceCount:l,firstVertex:u=0,transformFeedback:f}=e,v=Hz(n),T=Boolean(o.indexBuffer),E=o.indexBuffer?.glIndexType,M=Number(l)>0;if(this.linkStatus!=="success")return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable()||s===0)return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;if(s===0)return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)(),!0;this.device.gl.useProgram(this.handle),o.bindBeforeRender(r),f&&f.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let O=r;return Cz(this.device,i,O.glParameters,()=>{T&&M?this.device.gl.drawElementsInstanced(v,s||0,E,u,l||0):T?this.device.gl.drawElements(v,s||0,E,u):M?this.device.gl.drawArraysInstanced(v,u,s||0,l||0):this.device.gl.drawArrays(v,u,s||0),f&&f.end()}),o.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=ux(e);Object.keys(r).forEach(i=>{Kt.warn(`Unsupported value "${JSON.stringify(r[i])}" used in setUniforms() for key ${i}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),Kt.time(Wz,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),Kt.timeEnd(Wz,`linkProgram for ${this.id}`)(),Kt.level,!this.device.features.has("compilation-status-async-webgl")){let i=this._getLinkStatus();this._reportLinkStatus(i);return}Kt.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),Kt.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}_reportLinkStatus(e){switch(e){case"success":return;default:throw this.vs.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`)):this.fs?.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`)):new Error(`Error during ${e}: ${this.device.gl.getProgramInfoLog(this.handle)}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let[,r]of Object.entries(this.bindings))r instanceof Ql&&(r.update(),e=e&&r.loaded);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,i=0;for(let n of this.shaderLayout.bindings){let o=this.bindings[n.name]||this.bindings[n.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${n.name} in ${this.id}`);switch(n.type){case"uniform":let{name:s}=n,l=e.getUniformBlockIndex(this.handle,s);if(l===4294967295)throw new Error(`Invalid uniform block name ${s}`);e.uniformBlockBinding(this.handle,i,l),o instanceof Jl?e.bindBufferBase(35345,i,o.handle):e.bindBufferRange(35345,i,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),i+=1;break;case"texture":if(!(o instanceof gh||o instanceof Ql||o instanceof wf))throw new Error("texture");let u;if(o instanceof gh)u=o.texture;else if(o instanceof Ql)u=o;else if(o instanceof wf&&o.colorAttachments[0]instanceof gh)Kt.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),u=o.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+r),e.bindTexture(u.target,u.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${n.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:i,type:n,textureUnit:o}=e,s=this.uniforms[r]??o;s!==void 0&&jz(this.device.gl,i,n,s)}}};var yT=class extends N0{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":eoe(this.device,r.options);break;case"copy-buffer-to-texture":toe(this.device,r.options);break;case"copy-texture-to-buffer":roe(this.device,r.options);break;case"copy-texture-to-texture":ioe(this.device,r.options);break}}};function eoe(t,e){let r=e.source,i=e.destination;t.gl.bindBuffer(36662,r.handle),t.gl.bindBuffer(36663,i.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function toe(t,e){throw new Error("Not implemented")}function roe(t,e){let{source:r,mipLevel:i=0,aspect:n="all",width:o=e.source.width,height:s=e.source.height,depthOrArrayLayers:l=0,origin:u=[0,0],destination:f,byteOffset:v=0,bytesPerRow:T,rowsPerImage:E}=e;if(n!=="all")throw new Error("not supported");if(i!==0||l!==0||T||E)throw new Error("not implemented");let{framebuffer:M,destroyFramebuffer:O}=qz(r),F;try{let U=f,G=o||M.width,J=s||M.height,K=H0(M.texture.props.format),ne=K.dataFormat,ge=K.type;t.gl.bindBuffer(35051,U.handle),F=t.gl.bindFramebuffer(36160,M.handle),t.gl.readPixels(u[0],u[1],G,J,ne,ge,v)}finally{t.gl.bindBuffer(35051,null),F!==void 0&&t.gl.bindFramebuffer(36160,F),O&&M.destroy()}}function ioe(t,e){let{source:r,destinationMipLevel:i=0,origin:n=[0,0],destinationOrigin:o=[0,0],destination:s}=e,{width:l=e.destination.width,height:u=e.destination.height}=e,{framebuffer:f,destroyFramebuffer:v}=qz(r),[T,E]=n,[M,O,F]=o,U=t.gl.bindFramebuffer(36160,f.handle),G=null,J;if(s instanceof Ql)G=s,l=Number.isFinite(l)?l:G.width,u=Number.isFinite(u)?u:G.height,G.bind(0),J=G.target;else throw new Error("invalid destination");switch(J){case 3553:case 34067:t.gl.copyTexSubImage2D(J,i,M,O,T,E,l,u);break;case 35866:case 32879:t.gl.copyTexSubImage3D(J,i,M,O,F,T,E,l,u);break;default:}G&&G.unbind(),t.gl.bindFramebuffer(36160,U),v&&f.destroy()}function qz(t){if(t instanceof bo){let{width:e,height:r,id:i}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${i}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var vT=class extends F0{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new yT(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,i){}};var G0=class extends k0{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return HP()==="Chrome"}constructor(e,r){super(e,r),this.device=e,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(e){let r=e;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(e,r){let i=r;if(i.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:n,type:o,stride:s,offset:l,normalized:u,integer:f,divisor:v}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,i.handle),f?this.device.gl.vertexAttribIPointer(e,n,o,s,l):this.device.gl.vertexAttribPointer(e,n,o,u,s,l),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,v||0),this.attributes[e]=i,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let r=this.attributes[e];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(e,r)}}_getAccessor(e){let r=this.attributeInfos[e];if(!r)throw new Error(`Unknown attribute location ${e}`);let i=iT(r.bufferDataType);return{size:r.bufferComponents,type:i,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(e,r=!0){let n=G0.isConstantAttributeZeroSupported(this.device)||e!==0;(r||n)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,r){let i=noe(r),n=i.byteLength*e,o=i.length*e;if(this.buffer&&n!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${n} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:n}),s=s||!ooe(i,this.bufferValue),s){let l=_3(r.constructor,o);y3({target:l,source:i,start:0,count:o}),this.buffer.write(l),this.bufferValue=r}return this.buffer}};function noe(t){return Array.isArray(t)?new Float32Array(t):t}function ooe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var xT=class extends U0{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,r){super(e,r),this.device=e,this.gl=e.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(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(Gz(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let i=this._getVaryingIndex(e),{buffer:n,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(i<0){this.unusedBuffers[e]=n,Kt.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[i]={buffer:n,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(i,n,s,o)}getBuffer(e){if(Xz(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof Jl)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:i=0,byteLength:n=e.buffer.byteLength}=e;return{buffer:r,byteOffset:i,byteLength:n}}_getVaryingIndex(e){if(Xz(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:i,byteOffset:n}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,n,i)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,r,i=0,n){let o=r&&r.handle;!o||n===void 0?this.gl.bindBufferBase(35982,e,o):this.gl.bindBufferRange(35982,e,o,i,n)}};function Xz(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var bT=class extends z0{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,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(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,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 e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,n)=>{let o=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>e?(n("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};function V3(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return Yi(!1),0}}function Yz(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return Yi(!1),0}}function Kz(t,e){let{sourceX:r=0,sourceY:i=0,sourceFormat:n=6408,sourceAttachment:o=36064}=e||{},{target:s=null,sourceWidth:l,sourceHeight:u,sourceType:f}=e||{},{framebuffer:v,deleteFramebuffer:T}=Jz(t);Yi(v);let{gl:E,handle:M}=v;l=l||v.width,u=u||v.height;let O=o-36064;f=f||v.colorAttachments[O]?.texture?.type||5121,s=aoe(s,f,n,l,u),f=f||Nz(s);let F=E.bindFramebuffer(36160,M);return E.readPixels(r,i,l,u,n,f,s),E.bindFramebuffer(36160,F||null),T&&v.destroy(),s}function Zz(t,e){let{target:r,sourceX:i=0,sourceY:n=0,sourceFormat:o=6408,targetByteOffset:s=0}=e||{},{sourceWidth:l,sourceHeight:u,sourceType:f}=e||{},{framebuffer:v,deleteFramebuffer:T}=Jz(t);Yi(v),l=l||v.width,u=u||v.height;let E=v;f=f||5121;let M=r;if(!M){let F=V3(o),U=Yz(f),G=s+l*u*F*U;M=E.device.createBuffer({byteLength:G})}let O=t.device.createCommandEncoder();return O.copyTextureToBuffer({source:t,width:l,height:u,origin:[i,n],destination:M,byteOffset:s}),O.destroy(),T&&v.destroy(),M}function Jz(t){return t instanceof yf?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:soe(t),deleteFramebuffer:!0}}function soe(t,e){let{device:r,width:i,height:n,id:o}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${o}`,width:i,height:n,colorAttachments:[t]})}function aoe(t,e,r,i,n){if(t)return t;e=e||5121;let o=yx(e,{clamped:!1}),s=V3(r);return new o(i*n*s)}var loe=256,coe=1024,uoe=16384;var hoe="clear: bad arguments";function Qz(t,e){let{framebuffer:r=null,color:i=null,depth:n=null,stencil:o=null}=e||{},s={};r&&(s.framebuffer=r);let l=0;i&&(l|=uoe,i!==!0&&(s.clearColor=i)),n&&(l|=loe,n!==!0&&(s.clearDepth=n)),o&&(l|=coe,n!==!0&&(s.clearStencil=n)),Yi(l!==0,hoe);let u=t.gl;Du(u,s,()=>{u.clear(l)})}var vx=1,W0=class extends wc{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;static isSupported(){return typeof WebGL2RenderingContext<"u"}static attach(e){if(e instanceof W0)return e;if(e?.device instanceof wc)return e.device;if(!foe(e))throw new Error("Invalid WebGL2RenderingContext");return new W0({gl:e})}static async create(e={}){Kt.groupCollapsed(vx,"WebGLDevice created")();let r=[];e.debug&&r.push(Oz()),e.spector&&r.push(Pz()),typeof e.canvas=="string"&&r.push(Ep.pageLoaded);let i=await Promise.allSettled(r);for(let s of i)s.status==="rejected"&&Kt.error(`Failed to initialize debug libraries ${s.reason}`)();if(Kt.probe(vx+1,"DOM is loaded")(),e.gl?.device)return Kt.warn("reattaching existing device")(),W0.attach(e.gl);let n=new W0(e),o=`Created ${n.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return Kt.probe(vx,o)(),Kt.table(vx,n.info)(),Kt.groupEnd(vx)(),n}constructor(e){super({...e,id:e.id||oa("webgl-device")});let r=e.gl?.device;if(r)throw new Error(`WebGL context already attached to device ${r.id}`);let i=e.gl?.canvas||e.canvas;this.canvasContext=new AT(this,{...e,canvas:i}),this.lost=new Promise(l=>{this._resolveContextLost=l});let n=e.gl||null;if(n||=pz(this.canvasContext.canvas,{...e,onContextLost:l=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})}),!n)throw new Error("WebGL context creation failed");this.handle=n,this.gl=n,this.gl.device=this,this.gl._version=2,this.info=Az(this.gl,this._extensions),this.limits=new uT(this.gl),this.features=new cT(this.gl,this._extensions,this.props.disabledFeatures),this.props.initalizeFeatures&&this.features.initializeFeatures(),this.canvasContext.resize();let{enable:o=!0,copyState:s=!1}=e;I3(this.gl,{enable:o,copyState:s,log:(...l)=>Kt.log(1,...l)()}),e.debug&&(this.gl=Dz(this.gl,{...e,throwOnError:!0}),this.debug=!0,Kt.level=Math.max(Kt.level,1),Kt.warn("WebGL debug mode activated. Performance reduced.")()),e.spector&&(this.spectorJS=Rz({...this.props,canvas:this.handle.canvas}))}destroy(){}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(e){return lT(this.gl,e,this._extensions)}isTextureFormatFilterable(e){return bz(this.gl,e,this._extensions)}isTextureFormatRenderable(e){return wz(this.gl,e,this._extensions)}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._getBufferProps(e);return new Jl(this,r)}_createTexture(e){return new Ql(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new nm(this,e)}createShader(e){return new mT(this,e)}createFramebuffer(e){return new wf(this,e)}createVertexArray(e){return new G0(this,e)}createTransformFeedback(e){return new xT(this,e)}createQuerySet(e){return new bT(this,e)}createRenderPipeline(e){return new _T(this,e)}beginRenderPass(e){return new gT(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(e){return new vT(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return Kz(e,r)}readPixelsToBufferWebGL(e,r){return Zz(e,r)}setParametersWebGL(e){Bu(this.gl,e)}getParametersWebGL(e){return rT(this.gl,e)}withParametersWebGL(e,r){return Du(this.gl,e,r)}clearWebGL(e){Qz(this,e)}resetWebGL(){Kt.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),hz(this.gl)}gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;loseDevice(){let e=!1,i=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return i&&(e=!0,i.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){Ip(this.gl)}popState(){_d(this.gl)}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){r=r||this.gl2||this.gl;let i=Number(e);for(let n in r)if(r[n]===i)return`GL.${n}`;return String(e)}_constants;setConstantAttributeWebGL(e,r){let i=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(i).fill(null);let n=this._constants[e];switch(n&&moe(n,r)&&Kt.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:doe(this,e,r);break;case Int32Array:poe(this,e,r);break;case Uint32Array:Aoe(this,e,r);break;default:Yi(!1)}}getExtension(e){return Ou(this.gl,e,this._extensions),this._extensions}},Tf=W0;si(Tf,"type","webgl");function foe(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:Boolean(t&&Number.isFinite(t._version))}function doe(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:Yi(!1)}}function poe(t,e,r){t.gl.vertexAttribI4iv(e,r)}function Aoe(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function moe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var $z,e5,r5={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function wT(){return document.createElement("div")}function goe(t){if(!t.picked)return null;if(t.object===$z)return e5;let e={html:yoe(t.object),style:r5};return e5=e,$z=t.object,e}var _oe=new Set(["position","index"]);function yoe(t){let e=wT();for(let r in t){if(_oe.has(r))continue;let i=wT();i.className="header",i.textContent=r;let n=wT();n.className="value",n.textContent=xoe(t[r]);let o=wT();voe(o,i,n),o.appendChild(i),o.appendChild(n),e.appendChild(o)}return e.innerHTML}function voe(t,e,r){Object.assign(e.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(t.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function xoe(t){let e;if(Array.isArray(t)&&t.length>4)e=`Array<${t.length}>`;else if(typeof t=="string")e=t;else if(typeof t=="number")e=String(t);else try{e=JSON.stringify(t)}catch{e="<Non-Serializable Object>"}let r=50;return e.length>r&&(e=e.slice(0,r)),e}function t5(t,e){let r,i=t,n="properties",o=/{[^}]*}/g,s=u=>u.replace(/[{}]/g,""),l=[...new Set(t.match(o).map(s))];for(let u of l){if(u.includes(".")){r=e;let f=u.split(".");for(let v of f)if(r.hasOwnProperty(v))r=r[v];else{r=void 0;break}}else e.hasOwnProperty(u)?r=e[u]:e[n]&&e[n].hasOwnProperty(u)?r=e[n][u]:r=void 0;i=i.replaceAll(`{${u}}`,r)}return i}function j3(t){return t?t.html||t.text?e=>{if(!e.picked)return null;let r={style:t.style||r5};return t.html?r.html=t5(t.html,e.object):r.text=t5(t.text,e.object),r}:goe:null}function i5(t){let e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=t,document.getElementsByTagName("head")[0].appendChild(e)}function n5(t,e){let r=document.createElement("div");return r.style.width=Number.isFinite(t)?`${t}px`:t,r.style.height=`${e}px`,r.style.position="relative",r}var s5=ga(o5()),boe="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",W3=s5.default;function a5(t=boe){i5(t)}function l5(){let t=["mapboxgl-missing-css"];for(let e of t){let r=document.getElementsByClassName(e)[0];r&&r.style&&(r.style.display="none")}}var q3={};function c5(t){if(!q3[t]){let e=document.createElement("script");e.type="text/javascript",e.src=t,document.querySelector("head").appendChild(e),q3[t]=new Promise(i=>{e.onload=i})}return q3[t]}var u5="4.1.4";var X3,woe=(X3=globalThis.loaders)===null||X3===void 0?void 0:X3.parseImageNode,Y3=typeof Image<"u",K3=typeof ImageBitmap<"u",Toe=Boolean(woe),Z3=gd?!0:Toe;function h5(t){switch(t){case"auto":return K3||Y3||Z3;case"imagebitmap":return K3;case"image":return Y3;case"data":return Z3;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function f5(){if(K3)return"imagebitmap";if(Y3)return"image";if(Z3)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function d5(t){let e=Eoe(t);if(!e)throw new Error("Not an image");return e}function xx(t){switch(d5(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Eoe(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Soe=/^data:image\/svg\+xml/,Coe=/\.svg((\?|#).*)?$/;function TT(t){return t&&(Soe.test(t)||Coe.test(t))}function p5(t,e){if(TT(e)){let i=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return J3(t,e)}function J3(t,e){if(TT(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function ET(t,e,r){let i=p5(t,r),n=self.URL||self.webkitURL,o=typeof i!="string"&&n.createObjectURL(i);try{return await Moe(o||i,e)}finally{o&&n.revokeObjectURL(o)}}async function Moe(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";n(new Error(s))}}catch(o){n(o)}})}var Ioe={},A5=!0;async function m5(t,e,r){let i;TT(r)?i=await ET(t,e,r):i=J3(t,r);let n=e&&e.imagebitmap;return await Poe(i,n)}async function Poe(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((Roe(e)||!A5)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),A5=!1}return await createImageBitmap(t)}function Roe(t){for(let e in t||Ioe)return!1;return!0}function g5(t){return!Loe(t,"ftyp",4)||!(t[8]&96)?null:Boe(t)}function Boe(t){switch(Ooe(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Ooe(t,e,r){return String.fromCharCode(...t.slice(e,r))}function Doe(t){return[...t].map(e=>e.charCodeAt(0))}function Loe(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=Doe(e);for(let n=0;n<i.length;++n)if(i[n]!==t[n+r])return!1;return!0}var Ef=!1,bx=!0;function om(t){let e=wx(t);return Noe(e)||zoe(e)||koe(e)||Uoe(e)||Foe(e)}function Foe(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=g5(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function Noe(t){let e=wx(t);return e.byteLength>=24&&e.getUint32(0,Ef)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Ef),height:e.getUint32(20,Ef)}:null}function koe(t){let e=wx(t);return e.byteLength>=10&&e.getUint32(0,Ef)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,bx),height:e.getUint16(8,bx)}:null}function Uoe(t){let e=wx(t);return e.byteLength>=14&&e.getUint16(0,Ef)===16973&&e.getUint32(2,bx)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,bx),height:e.getUint32(22,bx)}:null}function zoe(t){let e=wx(t);if(!(e.byteLength>=3&&e.getUint16(0,Ef)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=Voe(),o=2;for(;o+9<e.byteLength;){let s=e.getUint16(o,Ef);if(n.has(s))return{mimeType:"image/jpeg",height:e.getUint16(o+5,Ef),width:e.getUint16(o+7,Ef)};if(!i.has(s))return null;o+=2,o+=e.getUint16(o,Ef)}return null}function Voe(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function wx(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function _5(t,e){var r;let{mimeType:i}=om(t)||{},n=(r=globalThis.loaders)===null||r===void 0?void 0:r.parseImageNode;return On(n),await n(t,i)}async function y5(t,e,r){e=e||{};let n=(e.image||{}).type||"auto",{url:o}=r||{},s=joe(n),l;switch(s){case"imagebitmap":l=await m5(t,e,o);break;case"image":l=await ET(t,e,o);break;case"data":l=await _5(t,e);break;default:On(!1)}return n==="data"&&(l=xx(l)),l}function joe(t){switch(t){case"auto":case"data":return f5();default:return h5(t),t}}var Hoe=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Goe=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Woe={image:{type:"auto",decode:!0}},Sf={id:"image",module:"images",name:"Images",version:u5,mimeTypes:Goe,extensions:Hoe,parse:y5,tests:[t=>Boolean(om(new DataView(t)))],options:Woe};var Q3={};function $3(t){if(Q3[t]===void 0){let e=gd?Xoe(t):qoe(t);Q3[t]=e}return Q3[t]}function qoe(t){var e,r;let i=["image/png","image/jpeg","image/gif"],n=((e=globalThis.loaders)===null||e===void 0?void 0:e.imageFormatsNode)||i,o=(r=globalThis.loaders)===null||r===void 0?void 0:r.parseImageNode;return Boolean(o)&&n.includes(t)}function Xoe(t){switch(t){case"image/avif":case"image/webp":return Yoe(t);default:return!0}}function Yoe(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var Koe=new bc({id:"deck"}),ur=Koe;var eR={};function v5(t){eR=t}function Ks(t,e,r,i){ur.level>0&&eR[t]&&eR[t].call(null,e,r,i)}function Zoe(t){let e=t[0],r=t[t.length-1];return e==="{"&&r==="}"||e==="["&&r==="]"}var x5={id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:Zoe,parseTextSync:JSON.parse};function Joe(){let t="9.0.2",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(ur.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:ur,_registerLoggers:v5},em([x5,[Sf,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}var ST=Joe();function Cf(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var tR={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function w5(t){let e={};for(let[r,i]of Object.entries(t))e[r]=Qoe(i);return e}function T5(t,e,r){let i={};for(let[n,o]of Object.entries(e))t&&n in t&&!o.private?(o.validate&&Cf(o.validate(t[n],o),`${r}: invalid ${n}`),i[n]=t[n]):i[n]=o.value;return i}function Qoe(t){let e=b5(t);if(e!=="object")return{value:t,...tR[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...tR[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=b5(t.value),{...t,...tR[e],type:e}):{type:"object",value:null};throw new Error("props")}function b5(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var E5=`#ifdef MODULE_LOGDEPTH
554
554
  logdepth_adjustPosition(gl_Position);
555
555
  #endif
556
556
  `,S5=`#ifdef MODULE_MATERIAL