@deck.gl/core 9.2.0-beta.2 → 9.2.0-beta.4

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.min.js CHANGED
@@ -5,7 +5,7 @@
5
5
  else if (typeof exports === 'object') exports['deck'] = factory();
6
6
  else root['deck'] = factory();})(globalThis, function () {
7
7
  "use strict";var __exports__=(()=>{var Mo=Object.defineProperty;var Kx=Object.getOwnPropertyDescriptor;var Zx=Object.getOwnPropertyNames;var Gx=Object.prototype.hasOwnProperty;var Qx=(r,e,t)=>e in r?Mo(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var O=(r,e)=>()=>(r&&(e=r(r=0)),e);var Ht=(r,e)=>{for(var t in e)Mo(r,t,{get:e[t],enumerable:!0})},Jx=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Zx(e))!Gx.call(r,s)&&s!==t&&Mo(r,s,{get:()=>e[s],enumerable:!(n=Kx(e,s))||n.enumerable});return r};var eb=r=>Jx(Mo({},"__esModule",{value:!0}),r);var L=(r,e,t)=>(Qx(r,typeof e!="symbol"?e+"":e,t),t);function Ps(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var Cl=O(()=>{});var zr,Ml=O(()=>{Cl();zr=class{constructor(e,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Ps(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Ps()-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 Ke,wd=O(()=>{Ml();Ke=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){let{name:t,type:n}=e,s=this.stats[t];return s||(e instanceof zr?s=e:s=new zr(t,n),this.stats[t]=s),s}}});var Cs=O(()=>{wd();Ml();Cl()});var Ol,Oo,kl=O(()=>{Cs();Ol=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new Ke({id:e})),this.stats.get(e)}},Oo=new Ol});var ko,tb,No,rb,vd,Nl=O(()=>{ko=globalThis,tb=globalThis.document||{},No=globalThis.process||{},rb=globalThis.console,vd=globalThis.navigator||{}});function Do(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=r||e;return Boolean(t&&t.indexOf("Electron")>=0)}var Dl=O(()=>{});function Ie(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Do()}var Fl=O(()=>{Dl()});function Bl(r){return!r&&!Ie()?"Node":Do(r)?"Electron":(r||vd.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var Ad=O(()=>{Fl();Dl();Nl()});var Ll,dr=O(()=>{Nl();Fl();Ad();Ll="4.1.0"});function sb(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var Fo,Sd=O(()=>{Fo=class{constructor(e,t,n="sessionStorage"){this.storage=sb(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}});function Ed(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function Rd(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var Id=O(()=>{});function Pd(r){return typeof r!="string"?r:(r=r.toUpperCase(),Bo[r]||Bo.WHITE)}function Cd(r,e,t){return!Ie&&typeof r=="string"&&(e&&(r=`\x1B[${Pd(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${Pd(t)+ib}m${r}\x1B[49m`)),r}var Bo,ib,Md=O(()=>{dr();(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Bo||(Bo={}));ib=10});function Od(r,e=["constructor"]){let t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),s=r;for(let i of n){let o=s[i];typeof o=="function"&&(e.find(a=>i===a)||(s[i]=o.bind(r)))}}var kd=O(()=>{});function Ms(r,e){if(!r)throw new Error(e||"Assertion failed")}var Nd=O(()=>{});function Wr(){let r;if(Ie()&&ko.performance)r=ko?.performance?.now?.();else if("hrtime"in No){let e=No?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var Dd=O(()=>{dr()});function Dn(){}function Ud(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return Ms(Number.isFinite(e)&&e>=0),e}function Ld(r){let{logLevel:e,message:t}=r;r.logLevel=Ud(e);let n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let s=typeof r.message;return Ms(s==="string"||s==="object"),Object.assign(r,{args:n},r.opts)}function ab(r,e,t){if(typeof e=="string"){let n=t.time?Rd(Ed(t.total)):"";e=t.time?`${r}: ${n} ${e}`:`${r}: ${e}`,e=Cd(e,t.color,t.background)}return e}function cb(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}var Nn,ob,Fd,Bd,Fe,Ul=O(()=>{dr();Sd();Id();Md();kd();Nd();Dd();Nn={debug:Ie()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},ob={enabled:!0,level:0};Fd={},Bd={once:!0},Fe=class{constructor({id:e}={id:""}){this.VERSION=Ll,this._startTs=Wr(),this._deltaTs=Wr(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Fo(`__probe-${this.id}__`,ob),this.timeStamp(`${this.id} started`),Od(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((Wr()-this._startTs).toPrecision(10))}getDelta(){return Number((Wr()-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,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,Nn.warn,arguments,Bd)}error(e){return this._getLogFunction(0,e,Nn.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,Nn.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Nn.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,Nn.debug||Nn.info,arguments,Bd)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||Dn,n&&[n],{tag:cb(t)}):Dn}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||Dn)}group(e,t,n={collapsed:!1}){let s=Ld({logLevel:e,message:t,opts:n}),{collapsed:i}=n;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Dn)}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Ud(e)}_getLogFunction(e,t,n,s,i){if(this._shouldLog(e)){i=Ld({logLevel:e,message:t,args:s,opts:i}),n=n||i.method,Ms(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Wr();let o=i.tag||i.message;if(i.once&&o)if(!Fd[o])Fd[o]=Wr();else return Dn;return t=ab(this.id,i.message,i),n.bind(console,t,...i.args)}return Dn}};Fe.VERSION=Ll});var Vd=O(()=>{globalThis.probe={}});var wR,Os=O(()=>{Ul();Ul();Vd();wR=new Fe({id:"@probe.gl/log"})});var I,Xt=O(()=>{Os();I=new Fe({id:"luma.gl"})});function pr(r="id"){Vl[r]=Vl[r]||1;let e=Vl[r]++;return`${r}-${e}`}var Vl,ks=O(()=>{Vl={}});function lb(r,e){let t={...e};for(let n in r)r[n]!==void 0&&(t[n]=r[n]);return t}var $,Pe=O(()=>{ks();$=class{toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,n){if(!e)throw new Error("no device");this._device=e,this.props=lb(t,n);let s=this.props.id!=="undefined"?this.props.id:pr(this[Symbol.toStringTag]);this.props.id=s,this.id=s,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(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"),t=this[Symbol.toStringTag];e.get(`${t}s Active`).decrementCount()}trackAllocatedMemory(e,t=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(e),n.get(`${t} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let t=this._device.statsManager.getStats("Resource Counts");t.get("GPU Memory").subtractCount(this.allocatedBytes),t.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${t}s Created`).incrementCount(),e.get(`${t}s Active`).incrementCount()}};L($,"defaultProps",{id:"undefined",handle:void 0,userData:void 0})});var Ns,W,Lo=O(()=>{Pe();Ns=class extends ${get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let n={...t};(t.usage||0)&Ns.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?n.indexType="uint32":t.data instanceof Uint16Array&&(n.indexType="uint16")),delete n.data,super(e,n,Ns.defaultProps),this.usage=n.usage||0,this.indexType=n.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}debugData=new ArrayBuffer(0);_setDebugData(e,t,n){let s=ArrayBuffer.isView(e)?e.buffer:e,i=Math.min(e?e.byteLength:n,Ns.DEBUG_DATA_MAX_LENGTH);s===null?this.debugData=new ArrayBuffer(i):t===0&&n===s.byteLength?this.debugData=s.slice(0,i):this.debugData=s.slice(t,t+i)}},W=Ns;L(W,"INDEX",16),L(W,"VERTEX",32),L(W,"UNIFORM",64),L(W,"STORAGE",128),L(W,"INDIRECT",256),L(W,"QUERY_RESOLVE",512),L(W,"MAP_READ",1),L(W,"MAP_WRITE",2),L(W,"COPY_SRC",4),L(W,"COPY_DST",8),L(W,"DEBUG_DATA_MAX_LENGTH",32),L(W,"defaultProps",{...$.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0})});function Ds(r){let[e,t,n]=Wl[r],s=r.includes("norm"),i=!s&&!r.startsWith("float"),o=r.startsWith("s");return{signedType:e,primitiveType:t,byteLength:n,normalized:s,integer:i,signed:o}}function zl(r){let e=r;switch(e){case"uint8":return"unorm8";case"sint8":return"snorm8";case"uint16":return"unorm16";case"sint16":return"snorm16";default:return e}}function zd(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}function $r(r){let e=ArrayBuffer.isView(r)?r.constructor:r;if(e===Uint8ClampedArray)return"uint8";let t=Object.values(Wl).find(n=>e===n[4]);if(!t)throw new Error(e.name);return t[0]}function jr(r){let[,,,,e]=Wl[r];return e}var Wl,Fs=O(()=>{Wl={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]}});function Fn(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,n]=r.split("x"),s=t,i=n?parseInt(n):1,o=Ds(s),a={type:s,components:i,byteLength:o.byteLength*i,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(a.webglOnly=!0),a}function Wd(r,e,t){let n=t?zl(r):r;switch(n){case"unorm8":return e===1?"unorm8":e===3?"unorm8x3-webgl":`${n}x${e}`;case"snorm8":case"uint8":case"sint8":case"uint16":case"sint16":case"unorm16":case"snorm16":case"float16":if(e===1||e===3)throw new Error(`size: ${e}`);return`${n}x${e}`;default:return e===1?n:`${n}x${e}`}}function $l(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let n=e,s=$r(r);return Wd(s,n,t)}function $d(r){let e;switch(r.primitiveType){case"f32":e="float32";break;case"i32":e="sint32";break;case"u32":e="uint32";break;case"f16":return r.components<=2?"float16x2":"float16x4"}return r.components===1?e:`${e}x${r.components}`}var Uo=O(()=>{Fs()});function ql(r){let e=pb[r];if(!e)throw new Error(`Unsupported texture format ${r}`);return e}var Se,se,Rt,ub,Vo,jl,zo,Hl,fb,Xl,Bs,Yl,Wo,jd,hb,db,pb,Hd=O(()=>{Se="texture-compression-bc",se="texture-compression-astc",Rt="texture-compression-etc2",ub="texture-compression-etc1-webgl",Vo="texture-compression-pvrtc-webgl",jl="texture-compression-atc-webgl",zo="float32-renderable-webgl",Hl="float16-renderable-webgl",fb="rgb9e5ufloat-renderable-webgl",Xl="snorm8-renderable-webgl",Bs="norm16-renderable-webgl",Yl="snorm16-renderable-webgl",Wo="float32-filterable",jd="float16-filterable-webgl";hb={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:Xl},rg8snorm:{render:Xl},"rgb8snorm-webgl":{},rgba8snorm:{render:Xl},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:Bs},rg16unorm:{render:Bs},"rgb16unorm-webgl":{f:Bs},rgba16unorm:{render:Bs},r16snorm:{f:Yl},rg16snorm:{render:Yl},"rgb16snorm-webgl":{f:Bs},rgba16snorm:{render:Yl},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:Hl,filter:"float16-filterable-webgl"},rg16float:{render:Hl,filter:jd},rgba16float:{render:Hl,filter:jd},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:zo,filter:Wo},rg32float:{render:!1,filter:Wo},"rgb32float-webgl":{render:zo,filter:Wo},rgba32float:{render:zo,filter:Wo},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:fb},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:zo},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},rgb10a2uint:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}},db={"bc1-rgb-unorm-webgl":{f:Se},"bc1-rgb-unorm-srgb-webgl":{f:Se},"bc1-rgba-unorm":{f:Se},"bc1-rgba-unorm-srgb":{f:Se},"bc2-rgba-unorm":{f:Se},"bc2-rgba-unorm-srgb":{f:Se},"bc3-rgba-unorm":{f:Se},"bc3-rgba-unorm-srgb":{f:Se},"bc4-r-unorm":{f:Se},"bc4-r-snorm":{f:Se},"bc5-rg-unorm":{f:Se},"bc5-rg-snorm":{f:Se},"bc6h-rgb-ufloat":{f:Se},"bc6h-rgb-float":{f:Se},"bc7-rgba-unorm":{f:Se},"bc7-rgba-unorm-srgb":{f:Se},"etc2-rgb8unorm":{f:Rt},"etc2-rgb8unorm-srgb":{f:Rt},"etc2-rgb8a1unorm":{f:Rt},"etc2-rgb8a1unorm-srgb":{f:Rt},"etc2-rgba8unorm":{f:Rt},"etc2-rgba8unorm-srgb":{f:Rt},"eac-r11unorm":{f:Rt},"eac-r11snorm":{f:Rt},"eac-rg11unorm":{f:Rt},"eac-rg11snorm":{f:Rt},"astc-4x4-unorm":{f:se},"astc-4x4-unorm-srgb":{f:se},"astc-5x4-unorm":{f:se},"astc-5x4-unorm-srgb":{f:se},"astc-5x5-unorm":{f:se},"astc-5x5-unorm-srgb":{f:se},"astc-6x5-unorm":{f:se},"astc-6x5-unorm-srgb":{f:se},"astc-6x6-unorm":{f:se},"astc-6x6-unorm-srgb":{f:se},"astc-8x5-unorm":{f:se},"astc-8x5-unorm-srgb":{f:se},"astc-8x6-unorm":{f:se},"astc-8x6-unorm-srgb":{f:se},"astc-8x8-unorm":{f:se},"astc-8x8-unorm-srgb":{f:se},"astc-10x5-unorm":{f:se},"astc-10x5-unorm-srgb":{f:se},"astc-10x6-unorm":{f:se},"astc-10x6-unorm-srgb":{f:se},"astc-10x8-unorm":{f:se},"astc-10x8-unorm-srgb":{f:se},"astc-10x10-unorm":{f:se},"astc-10x10-unorm-srgb":{f:se},"astc-12x10-unorm":{f:se},"astc-12x10-unorm-srgb":{f:se},"astc-12x12-unorm":{f:se},"astc-12x12-unorm-srgb":{f:se},"pvrtc-rgb4unorm-webgl":{f:Vo},"pvrtc-rgba4unorm-webgl":{f:Vo},"pvrtc-rbg2unorm-webgl":{f:Vo},"pvrtc-rgba2unorm-webgl":{f:Vo},"etc1-rbg-unorm-webgl":{f:ub},"atc-rgb-unorm-webgl":{f:jl},"atc-rgba-unorm-webgl":{f:jl},"atc-rgbai-unorm-webgl":{f:jl}},pb={...hb,...db}});function Xd(r){let e=_b(r);if(Yt.isCompressed(r)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0;let n=yb(r);n&&(e.blockWidth=n.blockWidth,e.blockHeight=n.blockHeight)}let t=gb.exec(r);if(t){let[,n,s,i,o,a]=t,c=`${i}${s}`,l=Ds(c),u=l.byteLength*8,f=n.length,h=[u,f>=2?u:0,f>=3?u:0,f>=4?u:0];e={format:r,attachment:e.attachment,dataType:l.signedType,components:f,channels:n,integer:l.integer,signed:l.signed,normalized:l.normalized,bitsPerChannel:h,bytesPerPixel:l.byteLength*n.length,packed:e.packed,srgb:e.srgb},a==="-webgl"&&(e.webgl=!0),o==="-srgb"&&(e.srgb=!0)}return r.endsWith("-webgl")&&(e.webgl=!0),r.endsWith("-srgb")&&(e.srgb=!0),e}function _b(r){let e=ql(r),t=e.bytesPerPixel||1,n=e.bitsPerChannel||[8,8,8,8];return delete e.bitsPerChannel,delete e.bytesPerPixel,delete e.f,delete e.render,delete e.filter,delete e.blend,delete e.store,{...e,format:r,attachment:e.attachment||"color",channels:e.channels||"r",components:e.components||e.channels?.length||1,bytesPerPixel:t,bitsPerChannel:n,dataType:e.dataType||"uint8",srgb:e.srgb??!1,packed:e.packed??!1,webgl:e.webgl??!1,integer:e.integer??!1,signed:e.signed??!1,normalized:e.normalized??!1,compressed:e.compressed??!1}}function yb(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,n,s]=t;return{blockWidth:Number(n),blockHeight:Number(s)}}return null}var mb,gb,$o,Yt,Kl=O(()=>{Fs();Hd();mb=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],gb=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,$o=class{getInfo(e){return Xd(e)}isColor(e){return e.startsWith("rgba")||e.startsWith("bgra")||e.startsWith("rgb")}isDepthStencil(e){return e.startsWith("depth")||e.startsWith("stencil")}isCompressed(e){return mb.some(t=>e.startsWith(t))}getCapabilities(e){let t=ql(e),n={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},s=Xd(e),i=e.startsWith("depth")||e.startsWith("stencil"),o=s?.signed,a=s?.integer,c=s?.webgl;return n.render&&=!o,n.filter&&=!i&&!o&&!a&&!c,n}},Yt=new $o});function Yd(r){return typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement||typeof VideoFrame<"u"&&r instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas}function qd(r){if(typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height};if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement)return{width:r.naturalWidth,height:r.naturalHeight};if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement)return{width:r.videoWidth,height:r.videoHeight};if(typeof VideoFrame<"u"&&r instanceof VideoFrame)return{width:r.displayWidth,height:r.displayHeight};throw new Error("Unknown image type")}var Kd=O(()=>{});var Ls,Us,Zl,Be,Gl=O(()=>{kl();Xt();ks();Lo();Uo();Kl();Kd();Ls=class{},Us=class{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}},Zl=class{get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=Oo;timestamp=0;_reused=!1;_lumaData={};_textureCaps={};constructor(e){this.props={...Zl.defaultProps,...e},this.id=this.props.id||pr(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(e){return Fn(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return Yt.getInfo(e)}getTextureFormatCapabilities(e){let t=this._textureCaps[e];if(!t){let n=this._getDeviceTextureFormatCapabilities(e);t=this._getDeviceSpecificTextureFormatCapabilities(n),this._textureCaps[e]=t}return t}getMipLevelCount(e,t,n=1){let s=Math.max(e,t,n);return 1+Math.floor(Math.log2(s))}isExternalImage(e){return Yd(e)}getExternalImageSize(e){return qd(e)}isTextureFormatSupported(e){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return Yt.isCompressed(e)}pushDebugGroup(e){this.commandEncoder.pushDebugGroup(e)}popDebugGroup(){this.commandEncoder?.popDebugGroup()}insertDebugMarker(e){this.commandEncoder?.insertDebugMarker(e)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(e,t,...n){return this.props.onError(e,t)?()=>{}:I.error(e.message,t,...n)}debug(){if(this.props.debug)debugger;else{let e=`'Type luma.log.set({debug: true}) in console to enable debug breakpoints',
8
- or create a device with the 'debug: true' prop.`;I.once(0,e)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}beginRenderPass(e){return this.commandEncoder.beginRenderPass(e)}beginComputePass(e){return this.commandEncoder.beginComputePass(e)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}static _getCanvasContextProps(e){return e.createCanvasContext===!0?{}:e.createCanvasContext}_getDeviceTextureFormatCapabilities(e){let t=Yt.getCapabilities(e),n=i=>(typeof i=="string"?this.features.has(i):i)??!0,s=n(t.create);return{format:e,create:s,render:s&&n(t.render),filter:s&&n(t.filter),blend:s&&n(t.blend),store:s&&n(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};if((e.usage||0)&W.INDEX&&(e.indexType||(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array&&(t.indexType="uint16")),!t.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return t}},Be=Zl;L(Be,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>{},onResize:(e,t)=>{let[n,s]=e.getDevicePixelSize();I.log(1,`${e} resized => ${n}x${s}px`)()},onPositionChange:(e,t)=>{let[n,s]=e.getPosition();I.log(1,`${e} repositioned => ${n},${s}`)()},onVisibilityChange:e=>I.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>I.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:I.get("debug")||void 0,debugShaders:I.get("debug-shaders")||void 0,debugFramebuffers:Boolean(I.get("debug-framebuffers")),debugFactories:Boolean(I.get("debug-factories")),debugWebGL:Boolean(I.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!1,_cachePipelines:!1,_cacheDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0})});var xb,Zd,Ho,jo,mr,Gd=O(()=>{Gl();kl();Xt();xb="set luma.log.level=1 (or higher) to trace rendering",Zd="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",Ho=class{stats=Oo;log=I;VERSION="9.2.0";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw I.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),I.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");I.error("This version of luma.gl has already been initialized")()}I.log(1,`${this.VERSION} - ${xb}`)(),globalThis.luma=this}async createDevice(e={}){let t={...Ho.defaultProps,...e},n=this.selectAdapter(t.type,t.adapters);if(!n)throw new Error(Zd);return t.waitForPageLoad&&await n.pageLoaded,await n.create(t)}async attachDevice(e,t){let n=this._getTypeFromHandle(e,t.adapters),s=n&&this.selectAdapter(n,t.adapters);if(!s)throw new Error(Zd);return await s?.attach?.(e,t)}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){let t=this._getAdapterMap(e);return Array.from(t).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapterType(e=[]){let t=["webgpu","webgl","null"],n=this._getAdapterMap(e);for(let s of t)if(n.get(s)?.isSupported?.())return s;return null}selectAdapter(e,t=[]){let n=e;e==="best-available"&&(n=this.getBestAvailableAdapterType(t));let s=this._getAdapterMap(t);return n&&s.get(n)||null}enforceWebGL2(e=!0,t=[]){let s=this._getAdapterMap(t).get("webgl");s||I.warn("enforceWebGL2: webgl adapter not found")(),s?.enforceWebGL2?.(e)}setDefaultDeviceProps(e){Object.assign(Ho.defaultProps,e)}_getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let n of e)t.set(n.type,n);return t}_getTypeFromHandle(e,t=[]){return e instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&e instanceof GPUDevice||e?.queue?"webgpu":e===null?"null":(e instanceof WebGLRenderingContext?I.warn("WebGL1 is not supported",e)():I.warn("Unknown handle type",e)(),null)}},jo=Ho;L(jo,"defaultProps",{...Be.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});mr=new jo});function wb(){return Xo||(Tb()||typeof window>"u"?Xo=Promise.resolve():Xo=new Promise(r=>window.addEventListener("load",()=>r()))),Xo}var Vs,bb,Tb,Xo,Qd=O(()=>{dr();Vs=class{get pageLoaded(){return wb()}},bb=Ie()&&typeof document<"u",Tb=()=>bb&&document.readyState==="complete",Xo=null});function Jd(){let r,e;return{promise:new Promise((n,s)=>{r=n,e=s}),resolve:r,reject:e}}var ep=O(()=>{});function vb(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e)throw new Error(`${r} is not an HTML element`);return e}return r||document.body}function Ab(r){let e=document.getElementById(r);if(!Hr.isHTMLCanvas(e))throw new Error("Object is not a canvas element");return e}function Sb(r){let{width:e,height:t}=r,n=document.createElement("canvas");n.id=pr("lumagl-auto-created-canvas"),n.width=e||1,n.height=t||1,n.style.width=Number.isFinite(e)?`${e}px`:"100%",n.style.height=Number.isFinite(t)?`${t}px`:"100%",r?.visible||(n.style.visibility="hidden");let s=vb(r?.container||null);return s.insertBefore(n,s.firstChild),n}function Eb(r,e,t,n,s){let i=r,o=tp(i[0],e,t),a=rp(i[1],e,n,s),c=tp(i[0]+1,e,t),l=c===t-1?c:c-1;c=rp(i[1]+1,e,n,s);let u;return s?(c=c===0?c:c+1,u=a,a=c):u=c===n-1?c:c-1,{x:o,y:a,width:Math.max(l-o+1,1),height:Math.max(u-a+1,1)}}function tp(r,e,t){return Math.min(Math.round(r*e),t-1)}function rp(r,e,t,n){return n?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var Bn,Hr,np=O(()=>{dr();ks();ep();Bn=class{static isHTMLCanvas(e){return typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement}static isOffscreenCanvas(e){return typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=Jd();_resizeObserver;_intersectionObserver;_position;destroyed=!1;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){if(this.props={...Bn.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,Ie()?e.canvas?typeof e.canvas=="string"?this.canvas=Ab(e.canvas):this.canvas=e.canvas:this.canvas=Sb(e):this.canvas={width:e.width||1,height:e.height||1},Bn.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):Bn.isOffscreenCanvas(this.canvas)?(this.id=e.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=e.id||"node-canvas-context",this.type="node"),this.cssWidth=this.htmlCanvas?.clientWidth||this.canvas.width,this.cssHeight=this.htmlCanvas?.clientHeight||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],Bn.isHTMLCanvas(this.canvas)){this._intersectionObserver=new IntersectionObserver(t=>this._handleIntersection(t)),this._intersectionObserver.observe(this.canvas),this._resizeObserver=new ResizeObserver(t=>this._handleResize(t));try{this._resizeObserver.observe(this.canvas,{box:"device-pixel-content-box"})}catch{this._resizeObserver.observe(this.canvas,{box:"content-box"})}setTimeout(()=>this._observeDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}}destroy(){this.destroyed=!0}setProps(e){return"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1,this._updateDrawingBufferSize()),this}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){let e=this.device.limits.maxTextureDimension2D;return[e,e]}setDrawingBufferSize(e,t){this.canvas.width=e,this.canvas.height=t,this.drawingBufferWidth=e,this.drawingBufferHeight=t}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(e,t=!0){let n=this.cssToDeviceRatio(),[s,i]=this.getDrawingBufferSize();return Eb(e,n,s,i,t)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[e,t]=this.getDevicePixelSize();return e/t}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),[t]=this.getCSSSize();return t?e/t:1}catch{return 1}}resize(e){this.setDrawingBufferSize(e.width,e.height)}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}_handleIntersection(e){let t=e.find(s=>s.target===this.canvas);if(!t)return;let n=t.isIntersecting;this.isVisible!==n&&(this.isVisible=n,this.device.props.onVisibilityChange(this))}_handleResize(e){let t=e.find(c=>c.target===this.canvas);if(!t)return;this.cssWidth=t.contentBoxSize[0].inlineSize,this.cssHeight=t.contentBoxSize[0].blockSize;let n=this.getDevicePixelSize(),s=t.devicePixelContentBoxSize?.[0].inlineSize||t.contentBoxSize[0].inlineSize*devicePixelRatio,i=t.devicePixelContentBoxSize?.[0].blockSize||t.contentBoxSize[0].blockSize*devicePixelRatio,[o,a]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(s,o)),this.devicePixelHeight=Math.max(1,Math.min(i,a)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:n})}_updateDrawingBufferSize(){if(this.props.autoResize){if(typeof this.props.useDevicePixels=="number"){let e=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*e,this.cssHeight*e)}else this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight);this._updateDevice()}this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition()}_observeDevicePixelRatio(){let e=this.devicePixelRatio;this.devicePixelRatio=window.devicePixelRatio,this.updatePosition(),this.device.props.onDevicePixelRatioChange(this,{oldRatio:e}),matchMedia(`(resolution: ${this.devicePixelRatio}dppx)`).addEventListener("change",()=>this._observeDevicePixelRatio(),{once:!0})}_trackPosition(e=100){let t=setInterval(()=>{this.destroyed?clearInterval(t):this.updatePosition()},e)}updatePosition(){let e=this.htmlCanvas?.getBoundingClientRect();if(e){let t=[e.left,e.top];if(this._position??=t,t[0]!==this._position[0]||t[1]!==this._position[1]){let s=this._position;this._position=t,this.device.props.onPositionChange?.(this,{oldPosition:s})}}}},Hr=Bn;L(Hr,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1})});var Yo,Ze,Ql=O(()=>{Pe();Yo=class extends ${get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=Yo.normalizeProps(e,t),super(e,t,Yo.defaultProps)}static normalizeProps(e,t){return t}},Ze=Yo;L(Ze,"defaultProps",{...$.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1})});var Rb,qt,K,Jl=O(()=>{Pe();Ql();Xt();Rb={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},qt=class extends ${dimension;baseDimension;format;width;height;depth;mipLevels;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(e,t){if(t=qt.normalizeProps(e,t),super(e,t,qt.defaultProps),this.dimension=this.props.dimension,this.baseDimension=Rb[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.props.width===void 0||this.props.height===void 0)if(e.isExternalImage(t.data)){let n=e.getExternalImageSize(t.data);this.width=n?.width||1,this.height=n?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&I.warn(`${this} created with undefined width or height. This is deprecated. Use AsyncTexture instead.`)();this.updateTimestamp=e.incrementTimestamp()}setSampler(e){this.sampler=e instanceof Ze?e:this.device.createSampler(e)}clone(e){return this.device.createTexture({...this.props,...e})}static normalizeProps(e,t){let n={...t},{width:s,height:i}=n;return typeof s=="number"&&(n.width=Math.max(1,Math.ceil(s))),typeof i=="number"&&(n.height=Math.max(1,Math.ceil(i))),n}_initializeData(e){this.device.isExternalImage(e)?this.copyExternalImage({image:e,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):e&&this.copyImageData({data:e,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(e){let{width:t,height:n,depth:s}=this,i={...qt.defaultCopyDataOptions,width:t,height:n,depth:s,...e},o=this.device.getTextureFormatInfo(this.format);if(!e.bytesPerRow&&!o.bytesPerPixel)throw new Error(`bytesPerRow must be provided for texture format ${this.format}`);return i.bytesPerRow=e.bytesPerRow||t*(o.bytesPerPixel||4),i.rowsPerImage=e.rowsPerImage||n,i}_normalizeCopyExternalImageOptions(e){let t=this.device.getExternalImageSize(e.image),n={...qt.defaultCopyExternalImageOptions,...t,...e};return n.width=Math.min(n.width,this.width-n.x),n.height=Math.min(n.height,this.height-n.y),n}},K=qt;L(K,"SAMPLE",4),L(K,"STORAGE",8),L(K,"RENDER",16),L(K,"COPY_SRC",1),L(K,"COPY_DST",2),L(K,"TEXTURE",4),L(K,"RENDER_ATTACHMENT",16),L(K,"defaultProps",{...$.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:qt.TEXTURE|qt.RENDER_ATTACHMENT|qt.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),L(K,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),L(K,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1})});var eu,gr,sp=O(()=>{Pe();eu=class extends ${get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,eu.defaultProps)}},gr=eu;L(gr,"defaultProps",{...$.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0})});function ip(r,e,t){let n="",s=e.split(/\r?\n/),i=r.slice().sort((o,a)=>o.lineNum-a.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let a=1;a<=s.length;a++)for(n+=op(s[a-1],a,t);i.length>o&&i[o].lineNum===a;){let c=i[o++];n+=tu(c,s,c.lineNum,{...t,inlineSource:!1})}for(;i.length>o;){let a=i[o++];n+=tu(a,[],0,{...t,inlineSource:!1})}return n;case"issues":case"no":for(let a of r)n+=tu(a,s,a.lineNum,{inlineSource:t?.showSourceCode!=="no"});return n}}function tu(r,e,t,n){if(n?.inlineSource){let i=Ib(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
8
+ or create a device with the 'debug: true' prop.`;I.once(0,e)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}beginRenderPass(e){return this.commandEncoder.beginRenderPass(e)}beginComputePass(e){return this.commandEncoder.beginComputePass(e)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}static _getCanvasContextProps(e){return e.createCanvasContext===!0?{}:e.createCanvasContext}_getDeviceTextureFormatCapabilities(e){let t=Yt.getCapabilities(e),n=i=>(typeof i=="string"?this.features.has(i):i)??!0,s=n(t.create);return{format:e,create:s,render:s&&n(t.render),filter:s&&n(t.filter),blend:s&&n(t.blend),store:s&&n(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};if((e.usage||0)&W.INDEX&&(e.indexType||(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array&&(t.indexType="uint16")),!t.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return t}},Be=Zl;L(Be,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>{},onResize:(e,t)=>{let[n,s]=e.getDevicePixelSize();I.log(1,`${e} resized => ${n}x${s}px`)()},onPositionChange:(e,t)=>{let[n,s]=e.getPosition();I.log(1,`${e} repositioned => ${n},${s}`)()},onVisibilityChange:e=>I.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>I.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:I.get("debug")||void 0,debugShaders:I.get("debug-shaders")||void 0,debugFramebuffers:Boolean(I.get("debug-framebuffers")),debugFactories:Boolean(I.get("debug-factories")),debugWebGL:Boolean(I.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!1,_cachePipelines:!1,_cacheDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0})});var xb,Zd,Ho,jo,mr,Gd=O(()=>{Gl();kl();Xt();xb="set luma.log.level=1 (or higher) to trace rendering",Zd="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",Ho=class{stats=Oo;log=I;VERSION="9.2.2";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw I.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),I.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");I.error("This version of luma.gl has already been initialized")()}I.log(1,`${this.VERSION} - ${xb}`)(),globalThis.luma=this}async createDevice(e={}){let t={...Ho.defaultProps,...e},n=this.selectAdapter(t.type,t.adapters);if(!n)throw new Error(Zd);return t.waitForPageLoad&&await n.pageLoaded,await n.create(t)}async attachDevice(e,t){let n=this._getTypeFromHandle(e,t.adapters),s=n&&this.selectAdapter(n,t.adapters);if(!s)throw new Error(Zd);return await s?.attach?.(e,t)}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){let t=this._getAdapterMap(e);return Array.from(t).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapterType(e=[]){let t=["webgpu","webgl","null"],n=this._getAdapterMap(e);for(let s of t)if(n.get(s)?.isSupported?.())return s;return null}selectAdapter(e,t=[]){let n=e;e==="best-available"&&(n=this.getBestAvailableAdapterType(t));let s=this._getAdapterMap(t);return n&&s.get(n)||null}enforceWebGL2(e=!0,t=[]){let s=this._getAdapterMap(t).get("webgl");s||I.warn("enforceWebGL2: webgl adapter not found")(),s?.enforceWebGL2?.(e)}setDefaultDeviceProps(e){Object.assign(Ho.defaultProps,e)}_getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let n of e)t.set(n.type,n);return t}_getTypeFromHandle(e,t=[]){return e instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&e instanceof GPUDevice||e?.queue?"webgpu":e===null?"null":(e instanceof WebGLRenderingContext?I.warn("WebGL1 is not supported",e)():I.warn("Unknown handle type",e)(),null)}},jo=Ho;L(jo,"defaultProps",{...Be.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});mr=new jo});function wb(){return Xo||(Tb()||typeof window>"u"?Xo=Promise.resolve():Xo=new Promise(r=>window.addEventListener("load",()=>r()))),Xo}var Vs,bb,Tb,Xo,Qd=O(()=>{dr();Vs=class{get pageLoaded(){return wb()}},bb=Ie()&&typeof document<"u",Tb=()=>bb&&document.readyState==="complete",Xo=null});function Jd(){let r,e;return{promise:new Promise((n,s)=>{r=n,e=s}),resolve:r,reject:e}}var ep=O(()=>{});function vb(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e)throw new Error(`${r} is not an HTML element`);return e}return r||document.body}function Ab(r){let e=document.getElementById(r);if(!Hr.isHTMLCanvas(e))throw new Error("Object is not a canvas element");return e}function Sb(r){let{width:e,height:t}=r,n=document.createElement("canvas");n.id=pr("lumagl-auto-created-canvas"),n.width=e||1,n.height=t||1,n.style.width=Number.isFinite(e)?`${e}px`:"100%",n.style.height=Number.isFinite(t)?`${t}px`:"100%",r?.visible||(n.style.visibility="hidden");let s=vb(r?.container||null);return s.insertBefore(n,s.firstChild),n}function Eb(r,e,t,n,s){let i=r,o=tp(i[0],e,t),a=rp(i[1],e,n,s),c=tp(i[0]+1,e,t),l=c===t-1?c:c-1;c=rp(i[1]+1,e,n,s);let u;return s?(c=c===0?c:c+1,u=a,a=c):u=c===n-1?c:c-1,{x:o,y:a,width:Math.max(l-o+1,1),height:Math.max(u-a+1,1)}}function tp(r,e,t){return Math.min(Math.round(r*e),t-1)}function rp(r,e,t,n){return n?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var Bn,Hr,np=O(()=>{dr();ks();ep();Bn=class{static isHTMLCanvas(e){return typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement}static isOffscreenCanvas(e){return typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=Jd();_resizeObserver;_intersectionObserver;_position;destroyed=!1;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){if(this.props={...Bn.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,Ie()?e.canvas?typeof e.canvas=="string"?this.canvas=Ab(e.canvas):this.canvas=e.canvas:this.canvas=Sb(e):this.canvas={width:e.width||1,height:e.height||1},Bn.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):Bn.isOffscreenCanvas(this.canvas)?(this.id=e.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=e.id||"node-canvas-context",this.type="node"),this.cssWidth=this.htmlCanvas?.clientWidth||this.canvas.width,this.cssHeight=this.htmlCanvas?.clientHeight||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],Bn.isHTMLCanvas(this.canvas)){this._intersectionObserver=new IntersectionObserver(t=>this._handleIntersection(t)),this._intersectionObserver.observe(this.canvas),this._resizeObserver=new ResizeObserver(t=>this._handleResize(t));try{this._resizeObserver.observe(this.canvas,{box:"device-pixel-content-box"})}catch{this._resizeObserver.observe(this.canvas,{box:"content-box"})}setTimeout(()=>this._observeDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}}destroy(){this.destroyed=!0}setProps(e){return"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1,this._updateDrawingBufferSize()),this}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){let e=this.device.limits.maxTextureDimension2D;return[e,e]}setDrawingBufferSize(e,t){this.canvas.width=e,this.canvas.height=t,this.drawingBufferWidth=e,this.drawingBufferHeight=t}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(e,t=!0){let n=this.cssToDeviceRatio(),[s,i]=this.getDrawingBufferSize();return Eb(e,n,s,i,t)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[e,t]=this.getDevicePixelSize();return e/t}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),[t]=this.getCSSSize();return t?e/t:1}catch{return 1}}resize(e){this.setDrawingBufferSize(e.width,e.height)}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}_handleIntersection(e){let t=e.find(s=>s.target===this.canvas);if(!t)return;let n=t.isIntersecting;this.isVisible!==n&&(this.isVisible=n,this.device.props.onVisibilityChange(this))}_handleResize(e){let t=e.find(c=>c.target===this.canvas);if(!t)return;this.cssWidth=t.contentBoxSize[0].inlineSize,this.cssHeight=t.contentBoxSize[0].blockSize;let n=this.getDevicePixelSize(),s=t.devicePixelContentBoxSize?.[0].inlineSize||t.contentBoxSize[0].inlineSize*devicePixelRatio,i=t.devicePixelContentBoxSize?.[0].blockSize||t.contentBoxSize[0].blockSize*devicePixelRatio,[o,a]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(s,o)),this.devicePixelHeight=Math.max(1,Math.min(i,a)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:n})}_updateDrawingBufferSize(){if(this.props.autoResize){if(typeof this.props.useDevicePixels=="number"){let e=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*e,this.cssHeight*e)}else this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight);this._updateDevice()}this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition()}_observeDevicePixelRatio(){let e=this.devicePixelRatio;this.devicePixelRatio=window.devicePixelRatio,this.updatePosition(),this.device.props.onDevicePixelRatioChange(this,{oldRatio:e}),matchMedia(`(resolution: ${this.devicePixelRatio}dppx)`).addEventListener("change",()=>this._observeDevicePixelRatio(),{once:!0})}_trackPosition(e=100){let t=setInterval(()=>{this.destroyed?clearInterval(t):this.updatePosition()},e)}updatePosition(){let e=this.htmlCanvas?.getBoundingClientRect();if(e){let t=[e.left,e.top];if(this._position??=t,t[0]!==this._position[0]||t[1]!==this._position[1]){let s=this._position;this._position=t,this.device.props.onPositionChange?.(this,{oldPosition:s})}}}},Hr=Bn;L(Hr,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1})});var Yo,Ze,Ql=O(()=>{Pe();Yo=class extends ${get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=Yo.normalizeProps(e,t),super(e,t,Yo.defaultProps)}static normalizeProps(e,t){return t}},Ze=Yo;L(Ze,"defaultProps",{...$.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1})});var Rb,qt,K,Jl=O(()=>{Pe();Ql();Xt();Rb={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},qt=class extends ${dimension;baseDimension;format;width;height;depth;mipLevels;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(e,t){if(t=qt.normalizeProps(e,t),super(e,t,qt.defaultProps),this.dimension=this.props.dimension,this.baseDimension=Rb[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.props.width===void 0||this.props.height===void 0)if(e.isExternalImage(t.data)){let n=e.getExternalImageSize(t.data);this.width=n?.width||1,this.height=n?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&I.warn(`${this} created with undefined width or height. This is deprecated. Use AsyncTexture instead.`)();this.updateTimestamp=e.incrementTimestamp()}setSampler(e){this.sampler=e instanceof Ze?e:this.device.createSampler(e)}clone(e){return this.device.createTexture({...this.props,...e})}static normalizeProps(e,t){let n={...t},{width:s,height:i}=n;return typeof s=="number"&&(n.width=Math.max(1,Math.ceil(s))),typeof i=="number"&&(n.height=Math.max(1,Math.ceil(i))),n}_initializeData(e){this.device.isExternalImage(e)?this.copyExternalImage({image:e,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):e&&this.copyImageData({data:e,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(e){let{width:t,height:n,depth:s}=this,i={...qt.defaultCopyDataOptions,width:t,height:n,depth:s,...e},o=this.device.getTextureFormatInfo(this.format);if(!e.bytesPerRow&&!o.bytesPerPixel)throw new Error(`bytesPerRow must be provided for texture format ${this.format}`);return i.bytesPerRow=e.bytesPerRow||t*(o.bytesPerPixel||4),i.rowsPerImage=e.rowsPerImage||n,i}_normalizeCopyExternalImageOptions(e){let t=this.device.getExternalImageSize(e.image),n={...qt.defaultCopyExternalImageOptions,...t,...e};return n.width=Math.min(n.width,this.width-n.x),n.height=Math.min(n.height,this.height-n.y),n}},K=qt;L(K,"SAMPLE",4),L(K,"STORAGE",8),L(K,"RENDER",16),L(K,"COPY_SRC",1),L(K,"COPY_DST",2),L(K,"TEXTURE",4),L(K,"RENDER_ATTACHMENT",16),L(K,"defaultProps",{...$.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:qt.TEXTURE|qt.RENDER_ATTACHMENT|qt.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),L(K,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),L(K,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1})});var eu,gr,sp=O(()=>{Pe();eu=class extends ${get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,eu.defaultProps)}},gr=eu;L(gr,"defaultProps",{...$.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0})});function ip(r,e,t){let n="",s=e.split(/\r?\n/),i=r.slice().sort((o,a)=>o.lineNum-a.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let a=1;a<=s.length;a++)for(n+=op(s[a-1],a,t);i.length>o&&i[o].lineNum===a;){let c=i[o++];n+=tu(c,s,c.lineNum,{...t,inlineSource:!1})}for(;i.length>o;){let a=i[o++];n+=tu(a,[],0,{...t,inlineSource:!1})}return n;case"issues":case"no":for(let a of r)n+=tu(a,s,a.lineNum,{inlineSource:t?.showSourceCode!=="no"});return n}}function tu(r,e,t,n){if(n?.inlineSource){let i=Ib(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
9
9
  `:"";return`
10
10
  ${i}${o}${r.type.toUpperCase()}: ${r.message}
11
11
 
@@ -15,7 +15,7 @@ ${i}${o}${r.type.toUpperCase()}: ${r.message}
15
15
  <code style="user-select:text;"><pre>
16
16
  ${i}
17
17
  </pre></code>`,a.style.top="10px",a.style.left="10px",a.style.position="absolute",a.style.zIndex="9999",a.style.width="100%",a.style.textAlign="left",document.body.appendChild(a),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),a.onclick=()=>{let l=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(l)}}},_r=ru;L(_r,"defaultProps",{...$.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0})});var nu,It,lp=O(()=>{Pe();Jl();Xt();nu=class extends ${get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,nu.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(s=>s.texture.clone(e)),n=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:t,depthStencilAttachment:n})}resize(e){let t=!e;if(e){let[n,s]=Array.isArray(e)?e:[e.width,e.height];t=t||s!==this.height||n!==this.width,this.width=n,this.height=s}t&&(I.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((t,n)=>{if(typeof t=="string"){let s=this.createColorTexture(t,n);return this.attachResource(s),s.view}return t instanceof K?t.view:t});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof K?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:K.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:K.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let s=this.colorAttachments[n].texture.clone({width:e,height:t});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=s.view,this.attachResource(s.view)}if(this.depthStencilAttachment){let n=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}this.updateAttachments()}},It=nu;L(It,"defaultProps",{...$.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null})});var su,Ge,up=O(()=>{Pe();su=class extends ${get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,su.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}},Ge=su;L(Ge,"defaultProps",{...$.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},bindings:{},uniforms:{}})});var Xr,Kt,fp=O(()=>{Pe();Xr=class extends ${get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=Xr.normalizeProps(e,t),super(e,t,Xr.defaultProps)}static normalizeProps(e,t){return t}},Kt=Xr;L(Kt,"defaultClearColor",[0,0,0,1]),L(Kt,"defaultClearDepth",1),L(Kt,"defaultClearStencil",0),L(Kt,"defaultProps",{...$.defaultProps,framebuffer:null,parameters:void 0,clearColor:Xr.defaultClearColor,clearColors:void 0,clearDepth:Xr.defaultClearDepth,clearStencil:Xr.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0})});var iu,Yr,hp=O(()=>{Pe();iu=class extends ${get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,iu.defaultProps),this.shaderLayout=t.shaderLayout}},Yr=iu;L(Yr,"defaultProps",{...$.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0})});var ou,Ln,dp=O(()=>{Pe();ou=class extends ${get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,ou.defaultProps)}},Ln=ou;L(Ln,"defaultProps",{...$.defaultProps,measureExecutionTime:void 0})});var au,Un,pp=O(()=>{Pe();au=class extends ${get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,au.defaultProps)}},Un=au;L(Un,"defaultProps",{...$.defaultProps})});function zs(r){return Db[r]}function cu(r){let[e,t]=Nb[r],n=e==="i32"||e==="u32",s=e!=="u32",i=kb[e]*t;return{primitiveType:e,components:t,byteLength:i,integer:n,signed:s}}var kb,Nb,Db,Fb,qI,qo=O(()=>{kb={f32:4,f16:2,i32:4,u32:4},Nb={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]},Db={f32:{type:"f32",components:1},f16:{type:"f16",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<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",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},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},Fb={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},qI={...Fb,mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"}});function Ko(r,e){let t={};for(let n of r.attributes){let s=Bb(r,e,n.name);s&&(t[n.name]=s)}return t}function mp(r,e,t=16){let n=Ko(r,e),s=new Array(t).fill(null);for(let i of Object.values(n))s[i.location]=i;return s}function Bb(r,e,t){let n=Lb(r,t),s=Ub(e,t);if(!n)return null;let i=cu(n.type),o=$d(i),a=s?.vertexFormat||o,c=Fn(a);return{attributeName:s?.attributeName||n.name,bufferName:s?.bufferName||n.name,location:n.location,shaderType:n.type,primitiveType:i.primitiveType,shaderComponents:i.components,vertexFormat:a,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:i.integer,stepMode:s?.stepMode||n.stepMode||"vertex",byteOffset:s?.byteOffset||0,byteStride:s?.byteStride||0}}function Lb(r,e){let t=r.attributes.find(n=>n.name===e);return t||I.warn(`shader layout attribute "${e}" not present in shader`),t||null}function Ub(r,e){Vb(r);let t=zb(r,e);return t||(t=Wb(r,e),t)?t:(I.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Vb(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&I.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function zb(r,e){for(let t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function Wb(r,e){for(let t of r){let n=t.byteStride;if(typeof t.byteStride!="number")for(let i of t.attributes||[]){let o=Fn(i.format);n+=o.byteLength}let s=t.attributes?.find(i=>i.attribute===e);if(s)return{attributeName:s.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:s.format,byteOffset:s.byteOffset,byteStride:n}}return null}var lu=O(()=>{Xt();qo();Uo()});var uu,Vn,gp=O(()=>{lu();Pe();uu=class extends ${get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,uu.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=mp(t.shaderLayout,t.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(new Error("constant attributes not supported"),this)()}},Vn=uu;L(Vn,"defaultProps",{...$.defaultProps,shaderLayout:void 0,bufferLayout:[]})});var fu,zn,_p=O(()=>{Pe();fu=class extends ${get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,fu.defaultProps)}},zn=fu;L(zn,"defaultProps",{...$.defaultProps,layout:void 0,buffers:{}})});var hu,Wn,yp=O(()=>{Pe();hu=class extends ${get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,hu.defaultProps)}},Wn=hu;L(Wn,"defaultProps",{...$.defaultProps,type:void 0,count:void 0})});function du(r){return(!Zo||Zo.byteLength<r)&&(Zo=new ArrayBuffer(r)),Zo}function pu(r,e){let t=du(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}var Zo,mu=O(()=>{});function $b(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function $n(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":$b(r)}var gu=O(()=>{});var jb,Go,xp=O(()=>{Fs();qo();mu();gu();Xt();jb=1024,Go=class{layout={};byteLength;constructor(e,t={}){let n=0;for(let[i,o]of Object.entries(e)){let a=zs(o),{type:c,components:l}=a,u=l*(t?.[i]??1);n=zd(n,u);let f=n;n+=u,this.layout[i]={type:c,size:u,offset:f}}n+=(4-n%4)%4;let s=n*4;this.byteLength=Math.max(s,jb)}getData(e){let t=du(this.byteLength),n={i32:new Int32Array(t),u32:new Uint32Array(t),f32:new Float32Array(t),f16:new Uint16Array(t)};for(let[s,i]of Object.entries(e)){let o=this.layout[s];if(!o){I.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:a,size:c,offset:l}=o,u=n[a];if(c===1){if(typeof i!="number"&&typeof i!="boolean"){I.warn(`Supplied value for single component uniform ${s} is not a number: ${i}`)();continue}u[l]=Number(i)}else{if(!$n(i)){I.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${i}`)();continue}u.set(i,l)}}return new Uint8Array(t,0,this.byteLength)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}}});function bp(r,e,t=16){if(r!==e)return!1;let n=r,s=e;if(!$n(n))return!1;if($n(s)&&n.length===s.length){for(let i=0;i<n.length;++i)if(s[i]!==n[i])return!1}return!0}function Tp(r){return $n(r)?r.slice():r}var wp=O(()=>{gu()});var Qo,vp=O(()=>{wp();Qo=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(s=>s.type==="uniform"&&s.name===e?.name);if(!t)throw new Error(e?.name);let n=t;for(let s of n.uniforms||[])this.bindingLayout[s.name]=s}}setUniforms(e){for(let[t,n]of Object.entries(e))this._setUniform(t,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${n}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){bp(this.uniforms[e],t)||(this.uniforms[e]=Tp(t),this.modifiedUniforms[e]=!0,this.modified=!0)}}});var Ws,Ap=O(()=>{Lo();Xt();vp();xp();Ws=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,n]of Object.entries(e)){let s=t,i=new Go(n.uniformTypes??{},n.uniformSizes??{});this.uniformBufferLayouts.set(s,i);let o=new Qo({name:t});o.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(s,o)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,n]of Object.entries(e))this.uniformBlocks.get(t)?.setUniforms(n);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,n){n&&this.setUniforms(n);let s=this.getUniformBufferByteLength(t),i=e.createBuffer({usage:W.UNIFORM|W.COPY_DST,byteLength:s}),o=this.getUniformBufferData(t);return i.write(o),i}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:W.UNIFORM|W.COPY_DST,byteLength:n});this.uniformBuffers.set(t,s)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let n=this.updateUniformBuffer(t);e||=n}return e&&I.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),n=this.uniformBuffers.get(e),s=!1;if(n&&t?.needsRedraw){s||=t.needsRedraw;let i=this.getUniformBufferData(e);n=this.uniformBuffers.get(e),n?.write(i);let o=this.uniformBlocks.get(e)?.getAllUniforms();I.log(4,`Writing to uniform buffer ${String(e)}`,i,o)()}return s}}});var j=O(()=>{Gd();Qd();Gl();np();Lo();Jl();sp();cp();Ql();lp();up();fp();hp();dp();pp();gp();_p();yp();Ap();Fs();qo();Uo();Kl();Xt();mu();lu()});var Br,j_=O(()=>{(function(r){r[r.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",r[r.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",r[r.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r[r.ZERO=0]="ZERO",r[r.ONE=1]="ONE",r[r.SRC_COLOR=768]="SRC_COLOR",r[r.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",r[r.SRC_ALPHA=770]="SRC_ALPHA",r[r.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",r[r.DST_ALPHA=772]="DST_ALPHA",r[r.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",r[r.DST_COLOR=774]="DST_COLOR",r[r.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",r[r.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",r[r.CONSTANT_COLOR=32769]="CONSTANT_COLOR",r[r.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",r[r.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",r[r.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",r[r.FUNC_ADD=32774]="FUNC_ADD",r[r.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",r[r.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",r[r.BLEND_EQUATION=32777]="BLEND_EQUATION",r[r.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",r[r.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",r[r.BLEND_DST_RGB=32968]="BLEND_DST_RGB",r[r.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",r[r.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",r[r.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",r[r.BLEND_COLOR=32773]="BLEND_COLOR",r[r.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",r[r.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",r[r.LINE_WIDTH=2849]="LINE_WIDTH",r[r.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",r[r.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",r[r.CULL_FACE_MODE=2885]="CULL_FACE_MODE",r[r.FRONT_FACE=2886]="FRONT_FACE",r[r.DEPTH_RANGE=2928]="DEPTH_RANGE",r[r.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",r[r.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",r[r.DEPTH_FUNC=2932]="DEPTH_FUNC",r[r.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",r[r.STENCIL_FUNC=2962]="STENCIL_FUNC",r[r.STENCIL_FAIL=2964]="STENCIL_FAIL",r[r.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",r[r.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",r[r.STENCIL_REF=2967]="STENCIL_REF",r[r.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",r[r.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",r[r.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",r[r.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",r[r.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",r[r.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",r[r.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",r[r.VIEWPORT=2978]="VIEWPORT",r[r.SCISSOR_BOX=3088]="SCISSOR_BOX",r[r.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",r[r.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",r[r.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",r[r.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",r[r.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",r[r.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",r[r.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",r[r.RED_BITS=3410]="RED_BITS",r[r.GREEN_BITS=3411]="GREEN_BITS",r[r.BLUE_BITS=3412]="BLUE_BITS",r[r.ALPHA_BITS=3413]="ALPHA_BITS",r[r.DEPTH_BITS=3414]="DEPTH_BITS",r[r.STENCIL_BITS=3415]="STENCIL_BITS",r[r.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",r[r.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",r[r.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",r[r.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",r[r.SAMPLES=32937]="SAMPLES",r[r.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",r[r.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",r[r.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",r[r.VENDOR=7936]="VENDOR",r[r.RENDERER=7937]="RENDERER",r[r.VERSION=7938]="VERSION",r[r.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",r[r.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",r[r.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",r[r.STATIC_DRAW=35044]="STATIC_DRAW",r[r.STREAM_DRAW=35040]="STREAM_DRAW",r[r.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.BUFFER_SIZE=34660]="BUFFER_SIZE",r[r.BUFFER_USAGE=34661]="BUFFER_USAGE",r[r.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",r[r.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",r[r.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",r[r.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",r[r.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",r[r.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",r[r.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",r[r.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",r[r.CULL_FACE=2884]="CULL_FACE",r[r.FRONT=1028]="FRONT",r[r.BACK=1029]="BACK",r[r.FRONT_AND_BACK=1032]="FRONT_AND_BACK",r[r.BLEND=3042]="BLEND",r[r.DEPTH_TEST=2929]="DEPTH_TEST",r[r.DITHER=3024]="DITHER",r[r.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",r[r.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",r[r.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",r[r.SCISSOR_TEST=3089]="SCISSOR_TEST",r[r.STENCIL_TEST=2960]="STENCIL_TEST",r[r.NO_ERROR=0]="NO_ERROR",r[r.INVALID_ENUM=1280]="INVALID_ENUM",r[r.INVALID_VALUE=1281]="INVALID_VALUE",r[r.INVALID_OPERATION=1282]="INVALID_OPERATION",r[r.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",r[r.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",r[r.CW=2304]="CW",r[r.CCW=2305]="CCW",r[r.DONT_CARE=4352]="DONT_CARE",r[r.FASTEST=4353]="FASTEST",r[r.NICEST=4354]="NICEST",r[r.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",r[r.BYTE=5120]="BYTE",r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.SHORT=5122]="SHORT",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.INT=5124]="INT",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.FLOAT=5126]="FLOAT",r[r.DOUBLE=5130]="DOUBLE",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.ALPHA=6406]="ALPHA",r[r.RGB=6407]="RGB",r[r.RGBA=6408]="RGBA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",r[r.VERTEX_SHADER=35633]="VERTEX_SHADER",r[r.COMPILE_STATUS=35713]="COMPILE_STATUS",r[r.DELETE_STATUS=35712]="DELETE_STATUS",r[r.LINK_STATUS=35714]="LINK_STATUS",r[r.VALIDATE_STATUS=35715]="VALIDATE_STATUS",r[r.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",r[r.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",r[r.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",r[r.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",r[r.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",r[r.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",r[r.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",r[r.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",r[r.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",r[r.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",r[r.SHADER_TYPE=35663]="SHADER_TYPE",r[r.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",r[r.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",r[r.NEVER=512]="NEVER",r[r.LESS=513]="LESS",r[r.EQUAL=514]="EQUAL",r[r.LEQUAL=515]="LEQUAL",r[r.GREATER=516]="GREATER",r[r.NOTEQUAL=517]="NOTEQUAL",r[r.GEQUAL=518]="GEQUAL",r[r.ALWAYS=519]="ALWAYS",r[r.KEEP=7680]="KEEP",r[r.REPLACE=7681]="REPLACE",r[r.INCR=7682]="INCR",r[r.DECR=7683]="DECR",r[r.INVERT=5386]="INVERT",r[r.INCR_WRAP=34055]="INCR_WRAP",r[r.DECR_WRAP=34056]="DECR_WRAP",r[r.NEAREST=9728]="NEAREST",r[r.LINEAR=9729]="LINEAR",r[r.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",r[r.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",r[r.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",r[r.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",r[r.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",r[r.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",r[r.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",r[r.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE=5890]="TEXTURE",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r[r.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",r[r.TEXTURE0=33984]="TEXTURE0",r[r.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",r[r.REPEAT=10497]="REPEAT",r[r.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r[r.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",r[r.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",r[r.FLOAT_VEC2=35664]="FLOAT_VEC2",r[r.FLOAT_VEC3=35665]="FLOAT_VEC3",r[r.FLOAT_VEC4=35666]="FLOAT_VEC4",r[r.INT_VEC2=35667]="INT_VEC2",r[r.INT_VEC3=35668]="INT_VEC3",r[r.INT_VEC4=35669]="INT_VEC4",r[r.BOOL=35670]="BOOL",r[r.BOOL_VEC2=35671]="BOOL_VEC2",r[r.BOOL_VEC3=35672]="BOOL_VEC3",r[r.BOOL_VEC4=35673]="BOOL_VEC4",r[r.FLOAT_MAT2=35674]="FLOAT_MAT2",r[r.FLOAT_MAT3=35675]="FLOAT_MAT3",r[r.FLOAT_MAT4=35676]="FLOAT_MAT4",r[r.SAMPLER_2D=35678]="SAMPLER_2D",r[r.SAMPLER_CUBE=35680]="SAMPLER_CUBE",r[r.LOW_FLOAT=36336]="LOW_FLOAT",r[r.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",r[r.HIGH_FLOAT=36338]="HIGH_FLOAT",r[r.LOW_INT=36339]="LOW_INT",r[r.MEDIUM_INT=36340]="MEDIUM_INT",r[r.HIGH_INT=36341]="HIGH_INT",r[r.FRAMEBUFFER=36160]="FRAMEBUFFER",r[r.RENDERBUFFER=36161]="RENDERBUFFER",r[r.RGBA4=32854]="RGBA4",r[r.RGB5_A1=32855]="RGB5_A1",r[r.RGB565=36194]="RGB565",r[r.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",r[r.STENCIL_INDEX=6401]="STENCIL_INDEX",r[r.STENCIL_INDEX8=36168]="STENCIL_INDEX8",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r[r.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",r[r.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",r[r.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",r[r.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",r[r.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",r[r.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",r[r.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",r[r.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",r[r.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",r[r.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",r[r.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",r[r.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",r[r.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",r[r.NONE=0]="NONE",r[r.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",r[r.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",r[r.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",r[r.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",r[r.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",r[r.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",r[r.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",r[r.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",r[r.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",r[r.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",r[r.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",r[r.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",r[r.READ_BUFFER=3074]="READ_BUFFER",r[r.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",r[r.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",r[r.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",r[r.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",r[r.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",r[r.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",r[r.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",r[r.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",r[r.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",r[r.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",r[r.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",r[r.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",r[r.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",r[r.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",r[r.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",r[r.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",r[r.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",r[r.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",r[r.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",r[r.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",r[r.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",r[r.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",r[r.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",r[r.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",r[r.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",r[r.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",r[r.RED=6403]="RED",r[r.RGB8=32849]="RGB8",r[r.RGBA8=32856]="RGBA8",r[r.RGB10_A2=32857]="RGB10_A2",r[r.TEXTURE_3D=32879]="TEXTURE_3D",r[r.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",r[r.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",r[r.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",r[r.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",r[r.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",r[r.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",r[r.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",r[r.SRGB=35904]="SRGB",r[r.SRGB8=35905]="SRGB8",r[r.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",r[r.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",r[r.RGBA32F=34836]="RGBA32F",r[r.RGB32F=34837]="RGB32F",r[r.RGBA16F=34842]="RGBA16F",r[r.RGB16F=34843]="RGB16F",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",r[r.R11F_G11F_B10F=35898]="R11F_G11F_B10F",r[r.RGB9_E5=35901]="RGB9_E5",r[r.RGBA32UI=36208]="RGBA32UI",r[r.RGB32UI=36209]="RGB32UI",r[r.RGBA16UI=36214]="RGBA16UI",r[r.RGB16UI=36215]="RGB16UI",r[r.RGBA8UI=36220]="RGBA8UI",r[r.RGB8UI=36221]="RGB8UI",r[r.RGBA32I=36226]="RGBA32I",r[r.RGB32I=36227]="RGB32I",r[r.RGBA16I=36232]="RGBA16I",r[r.RGB16I=36233]="RGB16I",r[r.RGBA8I=36238]="RGBA8I",r[r.RGB8I=36239]="RGB8I",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.R8=33321]="R8",r[r.RG8=33323]="RG8",r[r.R16F=33325]="R16F",r[r.R32F=33326]="R32F",r[r.RG16F=33327]="RG16F",r[r.RG32F=33328]="RG32F",r[r.R8I=33329]="R8I",r[r.R8UI=33330]="R8UI",r[r.R16I=33331]="R16I",r[r.R16UI=33332]="R16UI",r[r.R32I=33333]="R32I",r[r.R32UI=33334]="R32UI",r[r.RG8I=33335]="RG8I",r[r.RG8UI=33336]="RG8UI",r[r.RG16I=33337]="RG16I",r[r.RG16UI=33338]="RG16UI",r[r.RG32I=33339]="RG32I",r[r.RG32UI=33340]="RG32UI",r[r.R8_SNORM=36756]="R8_SNORM",r[r.RG8_SNORM=36757]="RG8_SNORM",r[r.RGB8_SNORM=36758]="RGB8_SNORM",r[r.RGBA8_SNORM=36759]="RGBA8_SNORM",r[r.RGB10_A2UI=36975]="RGB10_A2UI",r[r.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",r[r.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.HALF_FLOAT=5131]="HALF_FLOAT",r[r.RG=33319]="RG",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",r[r.CURRENT_QUERY=34917]="CURRENT_QUERY",r[r.QUERY_RESULT=34918]="QUERY_RESULT",r[r.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",r[r.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",r[r.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",r[r.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",r[r.DRAW_BUFFER0=34853]="DRAW_BUFFER0",r[r.DRAW_BUFFER1=34854]="DRAW_BUFFER1",r[r.DRAW_BUFFER2=34855]="DRAW_BUFFER2",r[r.DRAW_BUFFER3=34856]="DRAW_BUFFER3",r[r.DRAW_BUFFER4=34857]="DRAW_BUFFER4",r[r.DRAW_BUFFER5=34858]="DRAW_BUFFER5",r[r.DRAW_BUFFER6=34859]="DRAW_BUFFER6",r[r.DRAW_BUFFER7=34860]="DRAW_BUFFER7",r[r.DRAW_BUFFER8=34861]="DRAW_BUFFER8",r[r.DRAW_BUFFER9=34862]="DRAW_BUFFER9",r[r.DRAW_BUFFER10=34863]="DRAW_BUFFER10",r[r.DRAW_BUFFER11=34864]="DRAW_BUFFER11",r[r.DRAW_BUFFER12=34865]="DRAW_BUFFER12",r[r.DRAW_BUFFER13=34866]="DRAW_BUFFER13",r[r.DRAW_BUFFER14=34867]="DRAW_BUFFER14",r[r.DRAW_BUFFER15=34868]="DRAW_BUFFER15",r[r.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",r[r.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",r[r.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",r[r.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",r[r.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",r[r.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",r[r.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",r[r.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",r[r.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",r[r.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",r[r.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",r[r.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",r[r.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",r[r.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",r[r.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",r[r.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",r[r.SAMPLER_3D=35679]="SAMPLER_3D",r[r.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",r[r.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",r[r.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",r[r.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",r[r.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",r[r.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",r[r.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",r[r.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",r[r.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",r[r.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",r[r.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",r[r.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",r[r.MAX_SAMPLES=36183]="MAX_SAMPLES",r[r.SAMPLER_BINDING=35097]="SAMPLER_BINDING",r[r.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",r[r.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",r[r.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",r[r.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",r[r.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",r[r.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",r[r.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",r[r.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",r[r.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",r[r.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",r[r.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",r[r.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",r[r.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",r[r.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",r[r.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",r[r.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",r[r.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",r[r.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",r[r.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",r[r.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",r[r.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",r[r.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",r[r.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",r[r.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",r[r.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",r[r.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",r[r.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",r[r.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",r[r.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",r[r.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",r[r.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",r[r.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",r[r.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",r[r.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",r[r.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",r[r.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",r[r.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",r[r.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",r[r.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",r[r.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",r[r.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",r[r.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",r[r.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",r[r.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",r[r.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",r[r.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r[r.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",r[r.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",r[r.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",r[r.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",r[r.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",r[r.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",r[r.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",r[r.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",r[r.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",r[r.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",r[r.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",r[r.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",r[r.UNIFORM_TYPE=35383]="UNIFORM_TYPE",r[r.UNIFORM_SIZE=35384]="UNIFORM_SIZE",r[r.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",r[r.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",r[r.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",r[r.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",r[r.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",r[r.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",r[r.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",r[r.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",r[r.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",r[r.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",r[r.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",r[r.OBJECT_TYPE=37138]="OBJECT_TYPE",r[r.SYNC_CONDITION=37139]="SYNC_CONDITION",r[r.SYNC_STATUS=37140]="SYNC_STATUS",r[r.SYNC_FLAGS=37141]="SYNC_FLAGS",r[r.SYNC_FENCE=37142]="SYNC_FENCE",r[r.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",r[r.UNSIGNALED=37144]="UNSIGNALED",r[r.SIGNALED=37145]="SIGNALED",r[r.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",r[r.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",r[r.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",r[r.WAIT_FAILED=37149]="WAIT_FAILED",r[r.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",r[r.COLOR=6144]="COLOR",r[r.DEPTH=6145]="DEPTH",r[r.STENCIL=6146]="STENCIL",r[r.MIN=32775]="MIN",r[r.MAX=32776]="MAX",r[r.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",r[r.STREAM_READ=35041]="STREAM_READ",r[r.STREAM_COPY=35042]="STREAM_COPY",r[r.STATIC_READ=35045]="STATIC_READ",r[r.STATIC_COPY=35046]="STATIC_COPY",r[r.DYNAMIC_READ=35049]="DYNAMIC_READ",r[r.DYNAMIC_COPY=35050]="DYNAMIC_COPY",r[r.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",r[r.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",r[r.INVALID_INDEX=4294967295]="INVALID_INDEX",r[r.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",r[r.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",r[r.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",r[r.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",r[r.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",r[r.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",r[r.R16_EXT=33322]="R16_EXT",r[r.RG16_EXT=33324]="RG16_EXT",r[r.RGB16_EXT=32852]="RGB16_EXT",r[r.RGBA16_EXT=32859]="RGBA16_EXT",r[r.R16_SNORM_EXT=36760]="R16_SNORM_EXT",r[r.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",r[r.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",r[r.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",r[r.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",r[r.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",r[r.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",r[r.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",r[r.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",r[r.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",r[r.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",r[r.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",r[r.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",r[r.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",r[r.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",r[r.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",r[r.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",r[r.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",r[r.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",r[r.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",r[r.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",r[r.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",r[r.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",r[r.LINE_WEBGL=6913]="LINE_WEBGL",r[r.FILL_WEBGL=6914]="FILL_WEBGL",r[r.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",r[r.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",r[r.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",r[r.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",r[r.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",r[r.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",r[r.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",r[r.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",r[r.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",r[r.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",r[r.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",r[r.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",r[r.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",r[r.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",r[r.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",r[r.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",r[r.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",r[r.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",r[r.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",r[r.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",r[r.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",r[r.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",r[r.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",r[r.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(Br||(Br={}))});var H_=O(()=>{j_()});function X_(r=!0){let e=HTMLCanvasElement.prototype;if(!r&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(t,n){if(t==="webgl"||t==="experimental-webgl"){let s=this.originalGetContext("webgl2",n);return s instanceof HTMLElement&&PA(s),s}return this.originalGetContext(t,n)}}function PA(r){r.getExtension("EXT_color_buffer_float");let e={...SA,WEBGL_disjoint_timer_query:r.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:EA(r),OES_vertex_array_object:RA(r),ANGLE_instanced_arrays:IA(r)},t=r.getExtension;r.getExtension=function(s){let i=t.call(r,s);return i||(s in e?e[s]:null)};let n=r.getSupportedExtensions;r.getSupportedExtensions=function(){return(n.apply(r)||[])?.concat(Object.keys(e))}}var SA,EA,RA,IA,Y_=O(()=>{SA={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},EA=r=>({drawBuffersWEBGL(e){return r.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),RA=r=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return r.createVertexArray()},deleteVertexArrayOES(e){return r.deleteVertexArray(e)},isVertexArrayOES(e){return r.isVertexArray(e)},bindVertexArrayOES(e){return r.bindVertexArray(e)}}),IA=r=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return r.drawArraysInstanced(...e)},drawElementsInstancedANGLE(...e){return r.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return r.vertexAttribDivisor(...e)}})});async function Fc(r,e){let t=document.getElementsByTagName("head")[0];if(!t)throw new Error("loadScript");let n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",r),e&&(n.id=e),new Promise((s,i)=>{n.onload=s,n.onerror=o=>i(new Error(`Unable to load script '${r}': ${o}`)),t.appendChild(n)})}var Vh=O(()=>{});async function K_(r){if(!globalThis.SPECTOR)try{await Fc(r.debugSpectorJSUrl||Bc.debugSpectorJSUrl)}catch(e){I.warn(String(e))}}function Z_(r){if(r={...Bc,...r},!r.debugSpectorJS)return null;if(!Ye&&globalThis.SPECTOR&&!globalThis.luma?.spector){I.probe(CA,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();let{Spector:e}=globalThis.SPECTOR;Ye=new e,globalThis.luma&&(globalThis.luma.spector=Ye)}if(!Ye)return null;if(q_||(q_=!0,Ye.spyCanvases(),Ye?.onCaptureStarted.add(e=>I.info("Spector capture started:",e)()),Ye?.onCapture.add(e=>{I.info("Spector capture complete:",e)(),Ye?.getResultUI(),Ye?.resultView.display(),Ye?.resultView.addCapture(e)})),r.gl){let e=r.gl,t=e.device;Ye?.startCapture(r.gl,500),e.device=t,new Promise(n=>setTimeout(n,2e3)).then(n=>{I.info("Spector capture stopped after 2 seconds")(),Ye?.stopCapture()})}return Ye}var CA,Ye,q_,Bc,zh=O(()=>{j();Vh();CA=1,Ye=null,q_=!1,Bc={debugSpectorJS:I.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0}});function Q_(r){return r.luma=r.luma||{},r.luma}async function J_(){Ie()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await Fc(MA))}function ey(r,e={}){return e.debugWebGL||e.traceWebGL?kA(r,e):OA(r)}function OA(r){let e=Q_(r);return e.realContext?e.realContext:r}function kA(r,e){if(!globalThis.WebGLDebugUtils)return I.warn("webgl-debug not loaded")(),r;let t=Q_(r);if(t.debugContext)return t.debugContext;globalThis.WebGLDebugUtils.init({...Br,...r});let n=globalThis.WebGLDebugUtils.makeDebugContext(r,NA.bind(null,e),DA.bind(null,e));for(let o in Br)!(o in n)&&typeof Br[o]=="number"&&(n[o]=Br[o]);class s{}Object.setPrototypeOf(n,Object.getPrototypeOf(r)),Object.setPrototypeOf(s,n);let i=Object.create(s);return t.realContext=r,t.debugContext=i,i.debug=!0,i}function G_(r,e){e=Array.from(e).map(n=>n===void 0?"undefined":n);let t=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,e);return t=`${t.slice(0,100)}${t.length>100?"...":""}`,`gl.${r}(${t})`}function NA(r,e,t,n){n=Array.from(n).map(a=>a===void 0?"undefined":a);let s=globalThis.WebGLDebugUtils.glEnumToString(e),i=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,n),o=`${s} in gl.${t}(${i})`;I.error(o)();debugger}function DA(r,e,t){let n="";I.level>=1&&(n=G_(e,t),r.traceWebGL&&I.log(1,n)());for(let s of t)if(s===void 0){n=n||G_(e,t);debugger}}var MA,Wh=O(()=>{j();H_();dr();Vh();MA="https://unpkg.com/webgl-debug@2.0.1/index.js"});function $h(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function de(r,e,t){return e[r]!==void 0?e[r]:t[r]}var no,be,ty,qe,ry,ro,ny,sy,jh,Lt,Hh,iy,Xh=O(()=>{no={[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},be=(r,e,t)=>e?r.enable(t):r.disable(t),ty=(r,e,t)=>r.hint(t,e),qe=(r,e,t)=>r.pixelStorei(t,e),ry=(r,e,t)=>{let n=t===36006?36009:36008;return r.bindFramebuffer(n,e)},ro=(r,e,t)=>{let s={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[t];r.bindBuffer(s,e)};ny={[3042]:be,[32773]:(r,e)=>r.blendColor(...e),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(r,e)=>r.clearColor(...e),[3107]:(r,e)=>r.colorMask(...e),[2884]:be,[2885]:(r,e)=>r.cullFace(e),[2929]:be,[2931]:(r,e)=>r.clearDepth(e),[2932]:(r,e)=>r.depthFunc(e),[2928]:(r,e)=>r.depthRange(...e),[2930]:(r,e)=>r.depthMask(e),[3024]:be,[35723]:ty,[35725]:(r,e)=>r.useProgram(e),[36007]:(r,e)=>r.bindRenderbuffer(36161,e),[36389]:(r,e)=>r.bindTransformFeedback?.(36386,e),[34229]:(r,e)=>r.bindVertexArray(e),[36006]:ry,[36010]:ry,[34964]:ro,[36662]:ro,[36663]:ro,[35053]:ro,[35055]:ro,[2886]:(r,e)=>r.frontFace(e),[33170]:ty,[2849]:(r,e)=>r.lineWidth(e),[32823]:be,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:be,[32926]:be,[32928]:be,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:be,[3088]:(r,e)=>r.scissor(...e),[2960]:be,[2961]:(r,e)=>r.clearStencil(e),[2968]:(r,e)=>r.stencilMaskSeparate(1028,e),[36005]:(r,e)=>r.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]:(r,e)=>r.viewport(...e),[34383]:be,[10754]:be,[12288]:be,[12289]:be,[12290]:be,[12291]:be,[12292]:be,[12293]:be,[12294]:be,[12295]:be,[3333]:qe,[3317]:qe,[37440]:qe,[37441]:qe,[37443]:qe,[3330]:qe,[3332]:qe,[3331]:qe,[3314]:qe,[32878]:qe,[3316]:qe,[3315]:qe,[32877]:qe,framebuffer:(r,e)=>{let t=e&&"handle"in e?e.handle:e;return r.bindFramebuffer(36160,t)},blend:(r,e)=>e?r.enable(3042):r.disable(3042),blendColor:(r,e)=>r.blendColor(...e),blendEquation:(r,e)=>{let t=typeof e=="number"?[e,e]:e;r.blendEquationSeparate(...t)},blendFunc:(r,e)=>{let t=e?.length===2?[...e,...e]:e;r.blendFuncSeparate(...t)},clearColor:(r,e)=>r.clearColor(...e),clearDepth:(r,e)=>r.clearDepth(e),clearStencil:(r,e)=>r.clearStencil(e),colorMask:(r,e)=>r.colorMask(...e),cull:(r,e)=>e?r.enable(2884):r.disable(2884),cullFace:(r,e)=>r.cullFace(e),depthTest:(r,e)=>e?r.enable(2929):r.disable(2929),depthFunc:(r,e)=>r.depthFunc(e),depthMask:(r,e)=>r.depthMask(e),depthRange:(r,e)=>r.depthRange(...e),dither:(r,e)=>e?r.enable(3024):r.disable(3024),derivativeHint:(r,e)=>{r.hint(35723,e)},frontFace:(r,e)=>r.frontFace(e),mipmapHint:(r,e)=>r.hint(33170,e),lineWidth:(r,e)=>r.lineWidth(e),polygonOffsetFill:(r,e)=>e?r.enable(32823):r.disable(32823),polygonOffset:(r,e)=>r.polygonOffset(...e),sampleCoverage:(r,e)=>r.sampleCoverage(e[0],e[1]||!1),scissorTest:(r,e)=>e?r.enable(3089):r.disable(3089),scissor:(r,e)=>r.scissor(...e),stencilTest:(r,e)=>e?r.enable(2960):r.disable(2960),stencilMask:(r,e)=>{e=$h(e)?e:[e,e];let[t,n]=e;r.stencilMaskSeparate(1028,t),r.stencilMaskSeparate(1029,n)},stencilFunc:(r,e)=>{e=$h(e)&&e.length===3?[...e,...e]:e;let[t,n,s,i,o,a]=e;r.stencilFuncSeparate(1028,t,n,s),r.stencilFuncSeparate(1029,i,o,a)},stencilOp:(r,e)=>{e=$h(e)&&e.length===3?[...e,...e]:e;let[t,n,s,i,o,a]=e;r.stencilOpSeparate(1028,t,n,s),r.stencilOpSeparate(1029,i,o,a)},viewport:(r,e)=>r.viewport(...e)};sy={blendEquation:(r,e,t)=>r.blendEquationSeparate(de(32777,e,t),de(34877,e,t)),blendFunc:(r,e,t)=>r.blendFuncSeparate(de(32969,e,t),de(32968,e,t),de(32971,e,t),de(32970,e,t)),polygonOffset:(r,e,t)=>r.polygonOffset(de(32824,e,t),de(10752,e,t)),sampleCoverage:(r,e,t)=>r.sampleCoverage(de(32938,e,t),de(32939,e,t)),stencilFuncFront:(r,e,t)=>r.stencilFuncSeparate(1028,de(2962,e,t),de(2967,e,t),de(2963,e,t)),stencilFuncBack:(r,e,t)=>r.stencilFuncSeparate(1029,de(34816,e,t),de(36003,e,t),de(36004,e,t)),stencilOpFront:(r,e,t)=>r.stencilOpSeparate(1028,de(2964,e,t),de(2965,e,t),de(2966,e,t)),stencilOpBack:(r,e,t)=>r.stencilOpSeparate(1029,de(34817,e,t),de(34818,e,t),de(34819,e,t))},jh={enable:(r,e)=>r({[e]:!0}),disable:(r,e)=>r({[e]:!1}),pixelStorei:(r,e,t)=>r({[e]:t}),hint:(r,e,t)=>r({[e]:t}),useProgram:(r,e)=>r({[35725]:e}),bindRenderbuffer:(r,e,t)=>r({[36007]:t}),bindTransformFeedback:(r,e,t)=>r({[36389]:t}),bindVertexArray:(r,e)=>r({[34229]:e}),bindFramebuffer:(r,e,t)=>{switch(e){case 36160:return r({[36006]:t,[36010]:t});case 36009:return r({[36006]:t});case 36008:return r({[36010]:t});default:return null}},bindBuffer:(r,e,t)=>{let n={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[e];return n?r({[n]:t}):{valueChanged:!0}},blendColor:(r,e,t,n,s)=>r({[32773]:new Float32Array([e,t,n,s])}),blendEquation:(r,e)=>r({[32777]:e,[34877]:e}),blendEquationSeparate:(r,e,t)=>r({[32777]:e,[34877]:t}),blendFunc:(r,e,t)=>r({[32969]:e,[32968]:t,[32971]:e,[32970]:t}),blendFuncSeparate:(r,e,t,n,s)=>r({[32969]:e,[32968]:t,[32971]:n,[32970]:s}),clearColor:(r,e,t,n,s)=>r({[3106]:new Float32Array([e,t,n,s])}),clearDepth:(r,e)=>r({[2931]:e}),clearStencil:(r,e)=>r({[2961]:e}),colorMask:(r,e,t,n,s)=>r({[3107]:[e,t,n,s]}),cullFace:(r,e)=>r({[2885]:e}),depthFunc:(r,e)=>r({[2932]:e}),depthRange:(r,e,t)=>r({[2928]:new Float32Array([e,t])}),depthMask:(r,e)=>r({[2930]:e}),frontFace:(r,e)=>r({[2886]:e}),lineWidth:(r,e)=>r({[2849]:e}),polygonOffset:(r,e,t)=>r({[32824]:e,[10752]:t}),sampleCoverage:(r,e,t)=>r({[32938]:e,[32939]:t}),scissor:(r,e,t,n,s)=>r({[3088]:new Int32Array([e,t,n,s])}),stencilMask:(r,e)=>r({[2968]:e,[36005]:e}),stencilMaskSeparate:(r,e,t)=>r({[e===1028?2968:36005]:t}),stencilFunc:(r,e,t,n)=>r({[2962]:e,[2967]:t,[2963]:n,[34816]:e,[36003]:t,[36004]:n}),stencilFuncSeparate:(r,e,t,n,s)=>r({[e===1028?2962:34816]:t,[e===1028?2967:36003]:n,[e===1028?2963:36004]:s}),stencilOp:(r,e,t,n)=>r({[2964]:e,[2965]:t,[2966]:n,[34817]:e,[34818]:t,[34819]:n}),stencilOpSeparate:(r,e,t,n,s)=>r({[e===1028?2964:34817]:t,[e===1028?2965:34818]:n,[e===1028?2966:34819]:s}),viewport:(r,e,t,n,s)=>r({[2978]:[e,t,n,s]})},Lt=(r,e)=>r.isEnabled(e),Hh={[3042]:Lt,[2884]:Lt,[2929]:Lt,[3024]:Lt,[32823]:Lt,[32926]:Lt,[32928]:Lt,[3089]:Lt,[2960]:Lt,[35977]:Lt},iy=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 vt(r,e){if(FA(e))return;let t={};for(let s in e){let i=Number(s),o=ny[s];o&&(typeof o=="string"?t[o]=!0:o(r,e[s],i))}let n=r.state&&r.state.cache;if(n)for(let s in t){let i=sy[s];i(r,e,n)}}function Lc(r,e=no){if(typeof e=="number"){let s=e,i=Hh[s];return i?i(r,s):r.getParameter(s)}let t=Array.isArray(e)?e:Object.keys(e),n={};for(let s of t){let i=Hh[s];n[s]=i?i(r,Number(s)):r.getParameter(Number(s))}return n}function oy(r){vt(r,no)}function FA(r){for(let e in r)return!1;return!0}var bs=O(()=>{Xh()});function cy(r,e){if(r===e)return!0;if(ay(r)&&ay(e)&&r.length===e.length){for(let t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}return!1}function ay(r){return Array.isArray(r)||ArrayBuffer.isView(r)}var ly=O(()=>{});function uy(r,e){let t=r[e].bind(r);r[e]=function(s){if(s===void 0||iy.has(s))return t(s);let i=At.get(r);return s in i.cache||(i.cache[s]=t(s)),i.enable?i.cache[s]:t(s)},Object.defineProperty(r[e],"name",{value:`${e}-from-cache`,configurable:!1})}function BA(r,e,t){if(!r[e])return;let n=r[e].bind(r);r[e]=function(...i){let o=At.get(r),{valueChanged:a,oldValue:c}=t(o._updateCache,...i);return a&&n(...i),c},Object.defineProperty(r[e],"name",{value:`${e}-to-cache`,configurable:!1})}function LA(r){let e=r.useProgram.bind(r);r.useProgram=function(n){let s=At.get(r);s.program!==n&&(e(n),s.program=n)}}var At,Yh=O(()=>{bs();ly();Xh();At=class{static get(e){return e.state}gl;program=null;stateStack=[];enable=!0;cache=null;log;initialized=!1;constructor(e,t){this.gl=e,this.log=t?.log||(()=>{}),this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){let e=this.stateStack[this.stateStack.length-1];vt(this.gl,e),this.stateStack.pop()}trackState(e,t){if(this.cache=t?.copyState?Lc(e):Object.assign({},no),this.initialized)throw new Error("WebGLStateTracker");this.initialized=!0,this.gl.state=this,LA(e);for(let n in jh){let s=jh[n];BA(e,n,s)}uy(e,"getParameter"),uy(e,"isEnabled")}_updateCache(e){let t=!1,n,s=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let i in e){let o=e[i],a=this.cache[i];cy(o,a)||(t=!0,n=a,s&&!(i in s)&&(s[i]=a),this.cache[i]=o)}return{valueChanged:t,oldValue:n}}}});function fy(r,e,t){let n="",s={preserveDrawingBuffer:!0,...t},i=null;if(i||=r.getContext("webgl2",s),s.failIfMajorPerformanceCaveat&&(n||="Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow."),!i&&!t.failIfMajorPerformanceCaveat&&(s.failIfMajorPerformanceCaveat=!1,i=r.getContext("webgl2",s),i.luma||={},i.luma.softwareRenderer=!0),i||(i=r.getContext("webgl",{}),i&&(i=null,n||="Your browser only supports WebGL1")),!i)throw n||="Your browser does not support WebGL",new Error(`Failed to create WebGL context: ${n}`);let{onContextLost:o,onContextRestored:a}=e;return r.addEventListener("webglcontextlost",c=>o(c),!1),r.addEventListener("webglcontextrestored",c=>a(c),!1),i.luma||={},i}var hy=O(()=>{});function Ut(r,e,t){return t[e]===void 0&&(t[e]=r.getExtension(e)||null),t[e]}var so=O(()=>{});function dy(r,e){let t=r.getParameter(7936),n=r.getParameter(7937);Ut(r,"WEBGL_debug_renderer_info",e);let s=e.WEBGL_debug_renderer_info,i=r.getParameter(s?s.UNMASKED_VENDOR_WEBGL:7936),o=r.getParameter(s?s.UNMASKED_RENDERER_WEBGL:7937),a=i||t,c=o||n,l=r.getParameter(7938),u=py(a,c),f=UA(a,c),h=VA(a,c);return{type:"webgl",gpu:u,gpuType:h,gpuBackend:f,vendor:a,renderer:c,version:l,shadingLanguage:"glsl",shadingLanguageVersion:300}}function py(r,e){return/NVIDIA/i.exec(r)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(r)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(r)||/Apple/i.exec(e)?"apple":/AMD/i.exec(r)||/AMD/i.exec(e)||/ATI/i.exec(r)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(r)||/SwiftShader/i.exec(e)?"software":"unknown"}function UA(r,e){return/Metal/i.exec(r)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(r)||/ANGLE/i.exec(e)?"opengl":"unknown"}function VA(r,e){if(/SwiftShader/i.exec(r)||/SwiftShader/i.exec(e))return"cpu";switch(py(r,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}var my=O(()=>{so()});function Uc(r){switch(r){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(r))}var qh=O(()=>{});function yy(r){return r in Vc}function xy(r,e,t){return(Vc[e]||[]).every(s=>Ut(r,s,t))}function by(r,e,t){let n=e.create,s=Kh[e.format];return s?.gl===void 0&&(n=!1),s?.x&&(n=n&&Boolean(Ut(r,s.x,t))),{format:e.format,create:n&&e.create,render:n&&e.render,filter:n&&e.filter,blend:n&&e.blend,store:n&&e.store}}function zc(r){let e=Kh[r],t=qA(r),n=Yt.getInfo(r);return n.compressed&&(e.dataFormat=t),{internalFormat:t,format:e?.dataFormat||YA(n.channels,n.integer,n.normalized,t),type:n.dataType?Uc(n.dataType):e?.types?.[0]||5121,compressed:n.compressed||!1}}function Ty(r){switch(Yt.getInfo(r).attachment){case"depth":return 36096;case"stencil":return 36128;case"depth-stencil":return 33306;default:throw new Error(`Not a depth stencil format: ${r}`)}}function YA(r,e,t,n){if(n===6408||n===6407)return n;switch(r){case"r":return e&&!t?36244:6403;case"rg":return e&&!t?33320:33319;case"rgb":return e&&!t?36248:6407;case"rgba":return e&&!t?36249:6408;case"bgra":throw new Error("bgra pixels not supported by WebGL");default:return 6408}}function qA(r){let t=Kh[r]?.gl;if(t===void 0)throw new Error(`Unsupported texture format ${r}`);return t}var io,oo,Ts,ws,zA,WA,$A,jA,HA,gy,_y,XA,Vc,Kh,vs=O(()=>{j();so();qh();io="WEBGL_compressed_texture_s3tc",oo="WEBGL_compressed_texture_s3tc_srgb",Ts="EXT_texture_compression_rgtc",ws="EXT_texture_compression_bptc",zA="WEBGL_compressed_texture_etc",WA="WEBGL_compressed_texture_astc",$A="WEBGL_compressed_texture_etc1",jA="WEBGL_compressed_texture_pvrtc",HA="WEBGL_compressed_texture_atc",gy="EXT_texture_norm16",_y="EXT_render_snorm",XA="EXT_color_buffer_float",Vc={"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":[_y],"norm16-renderable-webgl":[gy],"snorm16-renderable-webgl":[gy,_y],"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":[io,oo,Ts,ws],"texture-compression-bc5-webgl":[Ts],"texture-compression-bc7-webgl":[ws],"texture-compression-etc2":[zA],"texture-compression-astc":[WA],"texture-compression-etc1-webgl":[$A],"texture-compression-pvrtc-webgl":[jA],"texture-compression-atc-webgl":[HA]};Kh={r8unorm:{gl:33321,rb:!0},r8snorm:{gl:36756},r8uint:{gl:33330,rb:!0},r8sint:{gl:33329,rb:!0},rg8unorm:{gl:33323,rb:!0},rg8snorm:{gl:36757},rg8uint:{gl:33336,rb:!0},rg8sint:{gl:33335,rb:!0},r16uint:{gl:33332,rb:!0},r16sint:{gl:33331,rb:!0},r16float:{gl:33325,rb:!0},r16unorm:{gl:33322,rb:!0},r16snorm:{gl:36760},"rgba4unorm-webgl":{gl:32854,rb:!0},"rgb565unorm-webgl":{gl:36194,rb:!0},"rgb5a1unorm-webgl":{gl:32855,rb:!0},"rgb8unorm-webgl":{gl:32849},"rgb8snorm-webgl":{gl:36758},rgba8unorm:{gl:32856},"rgba8unorm-srgb":{gl:35907},rgba8snorm:{gl:36759},rgba8uint:{gl:36220},rgba8sint:{gl:36238},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{gl:33338},rg16sint:{gl:33337},rg16float:{gl:33327,rb:!0},rg16unorm:{gl:33324},rg16snorm:{gl:36761},r32uint:{gl:33334,rb:!0},r32sint:{gl:33333,rb:!0},r32float:{gl:33326},rgb9e5ufloat:{gl:35901},rg11b10ufloat:{gl:35898,rb:!0},rgb10a2unorm:{gl:32857,rb:!0},rgb10a2uint:{gl:36975,rb:!0},"rgb16unorm-webgl":{gl:32852},"rgb16snorm-webgl":{gl:36762},rg32uint:{gl:33340,rb:!0},rg32sint:{gl:33339,rb:!0},rg32float:{gl:33328,rb:!0},rgba16uint:{gl:36214,rb:!0},rgba16sint:{gl:36232,rb:!0},rgba16float:{gl:34842},rgba16unorm:{gl:32859,rb:!0},rgba16snorm:{gl:36763},"rgb32float-webgl":{gl:34837,x:XA,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,rb:!0},rgba32sint:{gl:36226,rb:!0},rgba32float:{gl:34836,rb:!0},stencil8:{gl:36168,rb:!0},depth16unorm:{gl:33189,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,dataFormat:6402,types:[5125]},depth32float:{gl:36012,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth32float-stencil8":{gl:36013,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:io},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:oo},"bc1-rgba-unorm":{gl:33777,x:io},"bc1-rgba-unorm-srgb":{gl:35916,x:oo},"bc2-rgba-unorm":{gl:33778,x:io},"bc2-rgba-unorm-srgb":{gl:35918,x:oo},"bc3-rgba-unorm":{gl:33779,x:io},"bc3-rgba-unorm-srgb":{gl:35919,x:oo},"bc4-r-unorm":{gl:36283,x:Ts},"bc4-r-snorm":{gl:36284,x:Ts},"bc5-rg-unorm":{gl:36285,x:Ts},"bc5-rg-snorm":{gl:36286,x:Ts},"bc6h-rgb-ufloat":{gl:36495,x:ws},"bc6h-rgb-float":{gl:36494,x:ws},"bc7-rgba-unorm":{gl:36492,x:ws},"bc7-rgba-unorm-srgb":{gl:36493,x:ws},"etc2-rgb8unorm":{gl:37492},"etc2-rgb8unorm-srgb":{gl:37494},"etc2-rgb8a1unorm":{gl:37496},"etc2-rgb8a1unorm-srgb":{gl:37497},"etc2-rgba8unorm":{gl:37493},"etc2-rgba8unorm-srgb":{gl:37495},"eac-r11unorm":{gl:37488},"eac-r11snorm":{gl:37489},"eac-rg11unorm":{gl:37490},"eac-rg11snorm":{gl:37491},"astc-4x4-unorm":{gl:37808},"astc-4x4-unorm-srgb":{gl:37840},"astc-5x4-unorm":{gl:37809},"astc-5x4-unorm-srgb":{gl:37841},"astc-5x5-unorm":{gl:37810},"astc-5x5-unorm-srgb":{gl:37842},"astc-6x5-unorm":{gl:37811},"astc-6x5-unorm-srgb":{gl:37843},"astc-6x6-unorm":{gl:37812},"astc-6x6-unorm-srgb":{gl:37844},"astc-8x5-unorm":{gl:37813},"astc-8x5-unorm-srgb":{gl:37845},"astc-8x6-unorm":{gl:37814},"astc-8x6-unorm-srgb":{gl:37846},"astc-8x8-unorm":{gl:37815},"astc-8x8-unorm-srgb":{gl:37847},"astc-10x5-unorm":{gl:37819},"astc-10x5-unorm-srgb":{gl:37851},"astc-10x6-unorm":{gl:37817},"astc-10x6-unorm-srgb":{gl:37849},"astc-10x8-unorm":{gl:37818},"astc-10x8-unorm-srgb":{gl:37850},"astc-10x10-unorm":{gl:37819},"astc-10x10-unorm-srgb":{gl:37851},"astc-12x10-unorm":{gl:37820},"astc-12x10-unorm-srgb":{gl:37852},"astc-12x12-unorm":{gl:37821},"astc-12x12-unorm-srgb":{gl:37853},"pvrtc-rgb4unorm-webgl":{gl:35840},"pvrtc-rgba4unorm-webgl":{gl:35842},"pvrtc-rbg2unorm-webgl":{gl:35841},"pvrtc-rgba2unorm-webgl":{gl:35843},"etc1-rbg-unorm-webgl":{gl:36196},"atc-rgb-unorm-webgl":{gl:35986},"atc-rgba-unorm-webgl":{gl:35986},"atc-rgbai-unorm-webgl":{gl:34798}}});var wy,Wc,vy=O(()=>{j();so();vs();wy={"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"},Wc=class extends Us{gl;extensions;testedFeatures=new Set;constructor(e,t,n){super([],n),this.gl=e,this.extensions=t,Ut(e,"EXT_color_buffer_float",t)}*[Symbol.iterator](){let e=this.getFeatures();for(let t of e)this.has(t)&&(yield t);return[]}has(e){return this.disabledFeatures?.[e]?!1:(this.testedFeatures.has(e)||(this.testedFeatures.add(e),yy(e)&&xy(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(t=>t!=="polygon-mode-webgl");for(let t of e)this.has(t)}getFeatures(){return[...Object.keys(wy),...Object.keys(Vc)]}getWebGLFeature(e){let t=wy[e];return Boolean(typeof t=="string"?Ut(this.gl,t,this.extensions):t)}}});var $c,Ay=O(()=>{j();$c=class extends Ls{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 maxInterStageShaderVariables(){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]||0}}});function KA(r){return r<34069?r+34069:r}function ZA(r){switch(r){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`${r}`}}var Vt,jc=O(()=>{j();vs();Vt=class extends It{device;gl;handle;colorAttachments=[];depthStencilAttachment=null;constructor(e,t){super(e,t);let n=t.handle===null;this.device=e,this.gl=e.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),n||(e._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this.autoCreateAttachmentTextures(),this.updateAttachments())}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}updateAttachments(){let e=this.gl.bindFramebuffer(36160,this.handle);for(let t=0;t<this.colorAttachments.length;++t){let n=this.colorAttachments[t];if(n){let s=36064+t;this._attachTextureView(s,n)}}if(this.depthStencilAttachment){let t=Ty(this.depthStencilAttachment.props.format);this._attachTextureView(t,this.depthStencilAttachment)}if(this.device.props.debug){let t=this.gl.checkFramebufferStatus(36160);if(t!==36053)throw new Error(`Framebuffer ${ZA(t)}`)}this.gl.bindFramebuffer(36160,e)}_attachTextureView(e,t){let{gl:n}=this.device,{texture:s}=t,i=t.props.baseMipLevel,o=t.props.baseArrayLayer;switch(n.bindTexture(s.glTarget,s.handle),s.glTarget){case 35866:case 32879:n.framebufferTextureLayer(36160,e,s.handle,i,o);break;case 34067:let a=KA(o);n.framebufferTexture2D(36160,e,a,s.handle,i);break;case 3553:n.framebufferTexture2D(36160,e,3553,s.handle,i);break;default:throw new Error("Illegal texture type")}n.bindTexture(s.glTarget,null)}}});var Hc,Sy=O(()=>{j();jc();Hc=class extends Hr{device;handle=null;_framebuffer=null;get[Symbol.toStringTag](){return"WebGLCanvasContext"}constructor(e,t){super(t),this.device=e,this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this._updateDevice()}getCurrentFramebuffer(){return this._framebuffer=this._framebuffer||new Vt(this.device,{handle:null}),this._framebuffer}_updateDevice(){}}});function Ey(r="id"){Zh[r]=Zh[r]||1;let e=Zh[r]++;return`${r}-${e}`}var Zh,Ry=O(()=>{Zh={}});function GA(r){return r&W.INDEX?34963:r&W.VERTEX?34962:r&W.UNIFORM?35345:34962}function QA(r){return r&W.INDEX||r&W.VERTEX?35044:r&W.UNIFORM?35048:35044}var St,Xc=O(()=>{j();St=class extends W{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength=0;bytesUsed=0;constructor(e,t={}){super(e,t),this.device=e,this.gl=this.device.gl;let n=typeof t=="object"?t.handle:void 0;this.handle=n||this.gl.createBuffer(),e._setWebGLDebugMetadata(this.handle,this,{spector:{...this.props,data:typeof this.props.data}}),this.glTarget=GA(this.props.usage),this.glUsage=QA(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,t.data?this._initWithData(t.data,t.byteOffset,t.byteLength):this._initWithByteLength(t.byteLength||0)}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}_initWithData(e,t=0,n=e.byteLength+t){let s=this.glTarget;this.gl.bindBuffer(s,this.handle),this.gl.bufferData(s,n,this.glUsage),this.gl.bufferSubData(s,t,e),this.gl.bindBuffer(s,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(e,t,n),this.trackAllocatedMemory(n)}_initWithByteLength(e){let t=e;e===0&&(t=new Float32Array(0));let n=this.glTarget;return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,t,this.glUsage),this.gl.bindBuffer(n,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.trackAllocatedMemory(e),this}write(e,t=0){let n=ArrayBuffer.isView(e)?e:new Uint8Array(e),s=0,i=void 0,o=36663;this.gl.bindBuffer(o,this.handle),s!==0||i!==void 0?this.gl.bufferSubData(o,t,n,s,i):this.gl.bufferSubData(o,t,n),this.gl.bindBuffer(o,null),this._setDebugData(e,t,e.byteLength)}async mapAndWriteAsync(e,t=0,n=this.byteLength-t){let s=new ArrayBuffer(n);await e(s,"copied"),this.write(s,t)}async readAsync(e=0,t){return this.readSyncWebGL(e,t)}async mapAndReadAsync(e,t=0,n){let s=await this.readAsync(t,n);return await e(s.buffer,"copied")}readSyncWebGL(e=0,t){t=t??this.byteLength-e;let n=new Uint8Array(t),s=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,n,s,t),this.gl.bindBuffer(36662,null),this._setDebugData(n,e,t),n}}});function Py(r){let e=r.split(/\r?\n/),t=[];for(let n of e){if(n.length<=1)continue;let s=n.split(":");if(s.length===2){let[f,h]=s;t.push({message:h.trim(),type:Iy(f),lineNum:0,linePos:0});continue}let[i,o,a,...c]=s,l=parseInt(a,10);isNaN(l)&&(l=0);let u=parseInt(o,10);isNaN(u)&&(u=0),t.push({message:c.join(":").trim(),type:Iy(i),lineNum:l,linePos:u})}return t}function Iy(r){let e=["warning","error","info"],t=r.toLowerCase();return e.includes(t)?t:"info"}var Cy=O(()=>{});var Yc,My=O(()=>{j();Cy();Yc=class extends _r{device;handle;constructor(e,t){switch(super(e,t),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)}e._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0,this.handle.destroyed=!0)}get asyncCompilationStatus(){return this._waitForCompilationComplete().then(()=>(this._getCompilationStatus(),this.compilationStatus))}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return e?Py(e):[]}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)||null}async _compile(e){e=e.startsWith("#version ")?e:`#version 300 es
18
- ${e}`;let{gl:t}=this.device;if(t.shaderSource(this.handle,e),t.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}I.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),I.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async s=>await new Promise(i=>setTimeout(i,s));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}});function ky(r,e,t,n){if(rS(e))return n(r);let s=r;s.pushState();try{return JA(r,e),vt(s.gl,t),n(r)}finally{s.popState()}}function JA(r,e){let t=r,{gl:n}=t;if(e.cullMode)switch(e.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(e.frontFace&&n.frontFace(Tn("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&r.features.has("depth-clip-control")&&n.enable(34383),e.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&r.features.has("provoking-vertex-webgl")){let i=t.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,o=Tn("provokingVertex",e.provokingVertex,{first:36429,last:36430});i?.provokingVertexWEBGL(o)}if((e.polygonMode||e.polygonOffsetLine)&&r.features.has("polygon-mode-webgl")){if(e.polygonMode){let i=t.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,o=Tn("polygonMode",e.polygonMode,{fill:6914,line:6913});i?.polygonModeWEBGL(1028,o),i?.polygonModeWEBGL(1029,o)}e.polygonOffsetLine&&n.enable(10754)}if(r.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&n.enable(12288),e.clipDistance1&&n.enable(12289),e.clipDistance2&&n.enable(12290),e.clipDistance3&&n.enable(12291),e.clipDistance4&&n.enable(12292),e.clipDistance5&&n.enable(12293),e.clipDistance6&&n.enable(12294),e.clipDistance7&&n.enable(12295)),e.depthWriteEnabled!==void 0&&n.depthMask(tS("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(Kc("depthCompare",e.depthCompare))),e.stencilWriteMask){let s=e.stencilWriteMask;n.stencilMaskSeparate(1028,s),n.stencilMaskSeparate(1029,s)}if(e.stencilReadMask&&I.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let s=e.stencilReadMask||4294967295,i=Kc("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,i,0,s),n.stencilFuncSeparate(1029,i,0,s)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let s=Gh("stencilPassOperation",e.stencilPassOperation),i=Gh("stencilFailOperation",e.stencilFailOperation),o=Gh("stencilDepthFailOperation",e.stencilDepthFailOperation);n.stencilOpSeparate(1028,i,o,s),n.stencilOpSeparate(1029,i,o,s)}switch(e.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break;default:}if(e.blendColorOperation||e.blendAlphaOperation){let s=Oy("blendColorOperation",e.blendColorOperation||"add"),i=Oy("blendAlphaOperation",e.blendAlphaOperation||"add");n.blendEquationSeparate(s,i);let o=qc("blendColorSrcFactor",e.blendColorSrcFactor||"one"),a=qc("blendColorDstFactor",e.blendColorDstFactor||"zero"),c=qc("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),l=qc("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");n.blendFuncSeparate(o,a,c,l)}}function Kc(r,e){return Tn(r,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function Gh(r,e){return Tn(r,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Oy(r,e){return Tn(r,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function qc(r,e,t="color"){return Tn(r,e,{one:1,zero:0,src:768,"one-minus-src":769,dst:774,"one-minus-dst":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,constant:t==="color"?32769:32771,"one-minus-constant":t==="color"?32770:32772,src1:768,"one-minus-src1":769,"src1-alpha":770,"one-minus-src1-alpha":771})}function eS(r,e){return`Illegal parameter ${e} for ${r}`}function Tn(r,e,t){if(!(e in t))throw new Error(eS(r,e));return t[e]}function tS(r,e){return e}function rS(r){let e=!0;for(let t in r){e=!1;break}return e}var Qh=O(()=>{j();bs()});function Zc(r){let e={};return r.addressModeU&&(e[10242]=Jh(r.addressModeU)),r.addressModeV&&(e[10243]=Jh(r.addressModeV)),r.addressModeW&&(e[32882]=Jh(r.addressModeW)),r.magFilter&&(e[10240]=ed(r.magFilter)),(r.minFilter||r.mipmapFilter)&&(e[10241]=nS(r.minFilter||"linear",r.mipmapFilter)),r.lodMinClamp!==void 0&&(e[33082]=r.lodMinClamp),r.lodMaxClamp!==void 0&&(e[33083]=r.lodMaxClamp),r.type==="comparison-sampler"&&(e[34892]=34894),r.compare&&(e[34893]=Kc("compare",r.compare)),r.maxAnisotropy&&(e[34046]=r.maxAnisotropy),e}function Jh(r){switch(r){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function ed(r){switch(r){case"nearest":return 9728;case"linear":return 9729}}function nS(r,e="none"){if(!e)return ed(r);switch(e){case"none":return ed(r);case"nearest":switch(r){case"nearest":return 9984;case"linear":return 9985}break;case"linear":switch(r){case"nearest":return 9986;case"linear":return 9987}}}var td=O(()=>{Qh()});var Gc,Ny=O(()=>{j();td();Gc=class extends Ze{device;handle;parameters;constructor(e,t){super(e,t),this.device=e,this.parameters=Zc(t),this.handle=t.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[t,n]of Object.entries(e)){let s=Number(t);switch(s){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,s,n);break;default:this.device.gl.samplerParameteri(this.handle,s,n);break}}}}});function Lr(r,e,t){if(sS(e))return t(r);let{nocatch:n=!0}=e,s=At.get(r);s.push(),vt(r,e);let i;if(n)i=t(r),s.pop();else try{i=t(r)}finally{s.pop()}return i}function sS(r){for(let e in r)return!1;return!0}var Qc=O(()=>{bs();Yh()});var zt,rd=O(()=>{j();zt=class extends gr{device;gl;handle;texture;constructor(e,t){super(e,{...K.defaultProps,...t}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=t.texture}}});function iS(r){switch(r){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866;case"cube-array":break}throw new Error(r)}function Dy(r,e,t){return e==="cube"?34069+t:r}var Wt,Jc=O(()=>{j();vs();td();Qc();rd();Wt=class extends K{device;gl;handle;sampler=void 0;view;glTarget;glFormat;glType;glInternalFormat;compressed;_textureUnit=0;constructor(e,t){super(e,t),this.device=e,this.gl=this.device.gl;let n=zc(this.props.format);this.glTarget=iS(this.props.dimension),this.glInternalFormat=n.internalFormat,this.glFormat=n.format,this.glType=n.type,this.compressed=n.compressed,this.handle=this.props.handle||this.gl.createTexture(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this.gl.bindTexture(this.glTarget,this.handle);let{dimension:s,width:i,height:o,depth:a,mipLevels:c,glTarget:l,glInternalFormat:u}=this;switch(s){case"2d":case"cube":this.gl.texStorage2D(l,c,u,i,o);break;case"2d-array":case"3d":this.gl.texStorage3D(l,c,u,i,o,a);break;default:throw new Error(s)}this.gl.bindTexture(this.glTarget,null),this._initializeData(t.data),this.setSampler(this.props.sampler),this.view=new zt(this.device,{...this.props,texture:this}),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(e){return new zt(this.device,{...e,texture:this})}setSampler(e={}){super.setSampler(e);let t=Zc(this.sampler.props);this._setSamplerParameters(t)}copyImageData(e){let t=this._normalizeCopyImageDataOptions(e),n=t.data,{width:s,height:i,depth:o}=this,{mipLevel:a=0,byteOffset:c=0,x:l=0,y:u=0,z:f=0}=t,{glFormat:h,glType:d,compressed:g}=this,y=Dy(this.glTarget,this.dimension,o),_=this.compressed?{}:{[3314]:t.bytesPerRow,[32878]:t.rowsPerImage};this.gl.bindTexture(y,this.handle),Lr(this.gl,_,()=>{switch(this.dimension){case"2d":case"cube":g?this.gl.compressedTexSubImage2D(y,a,l,u,s,i,h,n,c):this.gl.texSubImage2D(y,a,l,u,s,i,h,d,n,c);break;case"2d-array":case"3d":g?this.gl.compressedTexSubImage3D(y,a,l,u,f,s,i,o,h,n,c):this.gl.texSubImage3D(y,a,l,u,f,s,i,o,h,d,n,c);break;default:}}),this.gl.bindTexture(y,null)}copyExternalImage(e){let t=this._normalizeCopyExternalImageOptions(e);if(t.sourceX||t.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");let{glFormat:n,glType:s}=this,{image:i,depth:o,mipLevel:a,x:c,y:l,z:u,width:f,height:h}=t,d=Dy(this.glTarget,this.dimension,o),g=t.flipY?{[37440]:!0}:{};return this.gl.bindTexture(this.glTarget,this.handle),Lr(this.gl,g,()=>{switch(this.dimension){case"2d":case"cube":this.gl.texSubImage2D(d,a,c,l,f,h,n,s,i);break;case"2d-array":case"3d":this.gl.texSubImage3D(d,a,c,l,u,f,h,o,n,s,i);break;default:}}),this.gl.bindTexture(this.glTarget,null),{width:t.width,height:t.height}}generateMipmapsWebGL(e){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(I.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!e?.force)))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(n){I.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}_setSamplerParameters(e){I.log(2,`${this.id} sampler parameters`,this.device.getGLKeys(e))(),this.gl.bindTexture(this.glTarget,this.handle);for(let[t,n]of Object.entries(e)){let s=Number(t),i=n;switch(s){case 33082:case 33083:this.gl.texParameterf(this.glTarget,s,i);break;case 10240:case 10241:this.gl.texParameteri(this.glTarget,s,i);break;case 10242:case 10243:case 32882:this.gl.texParameteri(this.glTarget,s,i);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,s,i);break;case 34892:case 34893:this.gl.texParameteri(this.glTarget,s,i);break}}this.gl.bindTexture(this.glTarget,null)}_getActiveUnit(){return this.gl.getParameter(34016)-33984}_bind(e){let{gl:t}=this;return e!==void 0&&(this._textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.glTarget,this.handle),e}_unbind(e){let{gl:t}=this;return e!==void 0&&(this._textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.glTarget,null),e}}});function Fy(r){return aS[r]}function el(r){return oS[r]}function By(r){return Boolean(Uy[r])}function Ly(r){return Uy[r]}var oS,Uy,aS,nd=O(()=>{oS={[5126]:"f32",[35664]:"vec2<f32>",[35665]:"vec3<f32>",[35666]:"vec4<f32>",[5124]:"i32",[35667]:"vec2<i32>",[35668]:"vec3<i32>",[35669]:"vec4<i32>",[5125]:"u32",[36294]:"vec2<u32>",[36295]:"vec3<u32>",[36296]:"vec4<u32>",[35670]:"f32",[35671]:"vec2<f32>",[35672]:"vec3<f32>",[35673]:"vec4<f32>",[35674]:"mat2x2<f32>",[35685]:"mat2x3<f32>",[35686]:"mat2x4<f32>",[35687]:"mat3x2<f32>",[35675]:"mat3x3<f32>",[35688]:"mat3x4<f32>",[35689]:"mat4x2<f32>",[35690]:"mat4x3<f32>",[35676]:"mat4x4<f32>"},Uy={[35678]:{viewDimension:"2d",sampleType:"float"},[35680]:{viewDimension:"cube",sampleType:"float"},[35679]:{viewDimension:"3d",sampleType:"float"},[35682]:{viewDimension:"3d",sampleType:"depth"},[36289]:{viewDimension:"2d-array",sampleType:"float"},[36292]:{viewDimension:"2d-array",sampleType:"depth"},[36293]:{viewDimension:"cube",sampleType:"float"},[36298]:{viewDimension:"2d",sampleType:"sint"},[36299]:{viewDimension:"3d",sampleType:"sint"},[36300]:{viewDimension:"cube",sampleType:"sint"},[36303]:{viewDimension:"2d-array",sampleType:"uint"},[36306]:{viewDimension:"2d",sampleType:"uint"},[36307]:{viewDimension:"3d",sampleType:"uint"},[36308]:{viewDimension:"cube",sampleType:"uint"},[36311]:{viewDimension:"2d-array",sampleType:"uint"}},aS={uint8:5121,sint8:5120,unorm8:5121,snorm8:5120,uint16:5123,sint16:5122,unorm16:5123,snorm16:5122,uint32:5125,sint32:5124,float16:5131,float32:5126}});function Vy(r,e){let t={attributes:[],bindings:[]};t.attributes=cS(r,e);let n=fS(r,e);for(let a of n){let c=a.uniforms.map(l=>({name:l.name,format:l.format,byteOffset:l.byteOffset,byteStride:l.byteStride,arrayLength:l.arrayLength}));t.bindings.push({type:"uniform",name:a.name,group:0,location:a.location,visibility:(a.vertex?1:0)&(a.fragment?2:0),minBindingSize:a.byteLength,uniforms:c})}let s=uS(r,e),i=0;for(let a of s)if(By(a.type)){let{viewDimension:c,sampleType:l}=Ly(a.type);t.bindings.push({type:"texture",name:a.name,group:0,location:i,viewDimension:c,sampleType:l}),a.textureUnit=i,i+=1}s.length&&(t.uniforms=s);let o=lS(r,e);return o?.length&&(t.varyings=o),t}function cS(r,e){let t=[],n=r.getProgramParameter(e,35721);for(let s=0;s<n;s++){let i=r.getActiveAttrib(e,s);if(!i)throw new Error("activeInfo");let{name:o,type:a}=i,c=r.getAttribLocation(e,o);if(c>=0){let l=el(a),u=/instance/i.test(o)?"instance":"vertex";t.push({name:o,location:c,stepMode:u,type:l})}}return t.sort((s,i)=>s.location-i.location),t}function lS(r,e){let t=[],n=r.getProgramParameter(e,35971);for(let s=0;s<n;s++){let i=r.getTransformFeedbackVarying(e,s);if(!i)throw new Error("activeInfo");let{name:o,type:a,size:c}=i,l=el(a),{type:u,components:f}=zs(l);t.push({location:s,name:o,type:u,size:c*f})}return t.sort((s,i)=>s.location-i.location),t}function uS(r,e){let t=[],n=r.getProgramParameter(e,35718);for(let s=0;s<n;s++){let i=r.getActiveUniform(e,s);if(!i)throw new Error("activeInfo");let{name:o,size:a,type:c}=i,{name:l,isArray:u}=hS(o),f=r.getUniformLocation(e,l),h={location:f,name:l,size:a,type:c,isArray:u};if(t.push(h),h.size>1)for(let d=0;d<h.size;d++){let g=`${l}[${d}]`;f=r.getUniformLocation(e,g);let y={...h,name:g,location:f};t.push(y)}}return t}function fS(r,e){let t=(i,o)=>r.getActiveUniformBlockParameter(e,i,o),n=[],s=r.getProgramParameter(e,35382);for(let i=0;i<s;i++){let o={name:r.getActiveUniformBlockName(e,i)||"",location:t(i,35391),byteLength:t(i,35392),vertex:t(i,35396),fragment:t(i,35398),uniformCount:t(i,35394),uniforms:[]},a=t(i,35395)||[],c=r.getActiveUniforms(e,a,35383),l=r.getActiveUniforms(e,a,35384),u=r.getActiveUniforms(e,a,35387),f=r.getActiveUniforms(e,a,35388);for(let h=0;h<o.uniformCount;++h){let d=r.getActiveUniform(e,a[h]);if(!d)throw new Error("activeInfo");let g=el(c[h]);o.uniforms.push({name:d.name,format:g,type:c[h],arrayLength:l[h],byteOffset:u[h],byteStride:f[h]})}n.push(o)}return n.sort((i,o)=>i.location-o.location),n}function hS(r){if(r[r.length-1]!=="]")return{name:r,length:1,isArray:!1};let t=/([^[]*)(\[[0-9]+\])?/.exec(r);if(!t||t.length<2)throw new Error(`Failed to parse GLSL uniform name ${r}`);return{name:t[1],length:t[2]?1:0,isArray:Boolean(t[2])}}var zy=O(()=>{j();nd()});function Wy(r,e,t,n){let s=r,i=n;i===!0&&(i=1),i===!1&&(i=0);let o=typeof i=="number"?[i]:i;switch(t){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return r.uniform1i(e,n);case 5126:return r.uniform1fv(e,o);case 35664:return r.uniform2fv(e,o);case 35665:return r.uniform3fv(e,o);case 35666:return r.uniform4fv(e,o);case 5124:return r.uniform1iv(e,o);case 35667:return r.uniform2iv(e,o);case 35668:return r.uniform3iv(e,o);case 35669:return r.uniform4iv(e,o);case 35670:return r.uniform1iv(e,o);case 35671:return r.uniform2iv(e,o);case 35672:return r.uniform3iv(e,o);case 35673:return r.uniform4iv(e,o);case 5125:return s.uniform1uiv(e,o,1);case 36294:return s.uniform2uiv(e,o,2);case 36295:return s.uniform3uiv(e,o,3);case 36296:return s.uniform4uiv(e,o,4);case 35674:return r.uniformMatrix2fv(e,!1,o);case 35675:return r.uniformMatrix3fv(e,!1,o);case 35676:return r.uniformMatrix4fv(e,!1,o);case 35685:return s.uniformMatrix2x3fv(e,!1,o);case 35686:return s.uniformMatrix2x4fv(e,!1,o);case 35687:return s.uniformMatrix3x2fv(e,!1,o);case 35688:return s.uniformMatrix3x4fv(e,!1,o);case 35689:return s.uniformMatrix4x2fv(e,!1,o);case 35690:return s.uniformMatrix4x3fv(e,!1,o)}throw new Error("Illegal uniform")}var $y=O(()=>{});function jy(r){switch(r){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw new Error(r)}}function Hy(r){switch(r){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;default:throw new Error(r)}}var sd=O(()=>{});function dS(r,e){let t={...r,attributes:r.attributes.map(n=>({...n}))};for(let n of e?.attributes||[]){let s=t.attributes.find(i=>i.name===n.name);s?(s.type=n.type||s.type,s.stepMode=n.stepMode||s.stepMode):I.warn(`shader layout attribute ${n.name} not present in shader`)}return t}var Xy,tl,Yy=O(()=>{j();zy();Qh();$y();Xc();jc();Jc();rd();sd();Xy=4,tl=class extends Ge{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};get[Symbol.toStringTag](){return"WEBGLRenderPipeline"}constructor(e,t){super(e,t),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:{id:this.props.id}}),this.vs=t.vs,this.fs=t.fs;let{varyings:n,bufferMode:s=35981}=t;n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,s)),this._linkShaders(),I.time(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=Vy(this.device.gl,this.handle),I.timeEnd(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=t.shaderLayout?dS(this.introspectedLayout,t.shaderLayout):this.introspectedLayout}destroy(){this.handle&&(this.device.gl.useProgram(null),this.device.gl.deleteProgram(this.handle),this.destroyed=!0,this.handle.destroyed=!0,this.handle=null)}setBindings(e,t){for(let[n,s]of Object.entries(e)){let i=this.shaderLayout.bindings.find(o=>o.name===n)||this.shaderLayout.bindings.find(o=>o.name===`${n}Uniforms`);if(!i){let o=this.shaderLayout.bindings.map(a=>`"${a.name}"`).join(", ");t?.disableWarnings||I.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${o}`,s)();continue}switch(s||I.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),i.type){case"uniform":if(!(s instanceof St)&&!(s.buffer instanceof St))throw new Error("buffer value");break;case"texture":if(!(s instanceof zt||s instanceof Wt||s instanceof Vt))throw new Error(`${this} Bad texture binding for ${n}`);break;case"sampler":I.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(i.type)}this.bindings[n]=s}}draw(e){let{renderPass:t,parameters:n=this.props.parameters,topology:s=this.props.topology,vertexArray:i,vertexCount:o,instanceCount:a,isInstanced:c=!1,firstVertex:l=0,transformFeedback:u}=e,f=jy(s),h=Boolean(i.indexBuffer),d=i.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return I.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return I.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),i.bindBeforeRender(t),u&&u.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let g=t;return ky(this.device,n,g.glParameters,()=>{h&&c?this.device.gl.drawElementsInstanced(f,o||0,d,l,a||0):h?this.device.gl.drawElements(f,o||0,d,l):c?this.device.gl.drawArraysInstanced(f,l,o||0,a||0):this.device.gl.drawArrays(f,l,o||0),u&&u.end()}),i.unbindAfterRender(t),!0}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),I.time(Xy,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),I.timeEnd(Xy,`linkProgram for ${this.id}`)(),I.level,!this.device.features.has("compilation-status-async-webgl")){let n=this._getLinkStatus();this._reportLinkStatus(n);return}I.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),I.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let t=this._getLinkStatus();this._reportLinkStatus(t)}async _reportLinkStatus(e){switch(e){case"success":return;default:let t=e==="link-error"?"Link error":"Validation error";switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`${this} ${t} during compilation of ${this.vs}`);case"pending":await this.vs.asyncCompilationStatus,this.vs.debugShader();break;case"success":break}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`${this} ${t} during compilation of ${this.fs}`);case"pending":await this.fs.asyncCompilationStatus,this.fs.debugShader();break;case"success":break}let n=this.device.gl.getProgramInfoLog(this.handle);this.device.reportError(new Error(`${t} during ${e}: ${n}`),this)(),this.device.debug()}}_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-error")):(this.linkStatus="error","link-error")}async _waitForLinkComplete(){let e=async s=>await new Promise(i=>setTimeout(i,s));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let t of this.shaderLayout.bindings)!this.bindings[t.name]&&!this.bindings[t.name.replace(/Uniforms$/,"")]&&(I.warn(`Binding ${t.name} not found in ${this.id}`)(),e=!1);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let t=0,n=0;for(let s of this.shaderLayout.bindings){let i=this.bindings[s.name]||this.bindings[s.name.replace(/Uniforms$/,"")];if(!i)throw new Error(`No value for binding ${s.name} in ${this.id}`);switch(s.type){case"uniform":let{name:o}=s,a=e.getUniformBlockIndex(this.handle,o);if(a===4294967295)throw new Error(`Invalid uniform block name ${o}`);e.uniformBlockBinding(this.handle,n,a),i instanceof St?e.bindBufferBase(35345,n,i.handle):e.bindBufferRange(35345,n,i.buffer.handle,i.offset||0,i.size||i.buffer.byteLength-i.offset),n+=1;break;case"texture":if(!(i instanceof zt||i instanceof Wt||i instanceof Vt))throw new Error("texture");let c;if(i instanceof zt)c=i.texture;else if(i instanceof Wt)c=i;else if(i instanceof Vt&&i.colorAttachments[0]instanceof zt)I.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),c=i.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+t),e.bindTexture(c.glTarget,c.handle),t+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${s.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:t,location:n,type:s,textureUnit:i}=e,o=this.uniforms[t]??i;o!==void 0&&Wy(this.device.gl,n,s,o)}}}});function pS(r,e){let t=e.sourceBuffer,n=e.destinationBuffer;r.gl.bindBuffer(36662,t.handle),r.gl.bindBuffer(36663,n.handle),r.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),r.gl.bindBuffer(36662,null),r.gl.bindBuffer(36663,null)}function mS(r,e){throw new Error("Not implemented")}function gS(r,e){let{sourceTexture:t,mipLevel:n=0,aspect:s="all",width:i=e.sourceTexture.width,height:o=e.sourceTexture.height,depthOrArrayLayers:a=0,origin:c=[0,0],destinationBuffer:l,byteOffset:u=0,bytesPerRow:f,rowsPerImage:h}=e;if(s!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||a!==0||f||h)throw new Error("not implemented");let{framebuffer:d,destroyFramebuffer:g}=qy(t),y;try{let _=l,b=i||d.width,R=o||d.height,x=zc(d.colorAttachments[0].texture.props.format),S=x.format,C=x.type;r.gl.bindBuffer(35051,_.handle),y=r.gl.bindFramebuffer(36160,d.handle),r.gl.readPixels(c[0],c[1],b,R,S,C,u)}finally{r.gl.bindBuffer(35051,null),y!==void 0&&r.gl.bindFramebuffer(36160,y),g&&d.destroy()}}function _S(r,e){let{sourceTexture:t,destinationMipLevel:n=0,origin:s=[0,0],destinationOrigin:i=[0,0],destinationTexture:o}=e,{width:a=e.destinationTexture.width,height:c=e.destinationTexture.height}=e,{framebuffer:l,destroyFramebuffer:u}=qy(t),[f,h]=s,[d,g,y]=i,_=r.gl.bindFramebuffer(36160,l.handle),b,R;if(o instanceof Wt)b=o,a=Number.isFinite(a)?a:b.width,c=Number.isFinite(c)?c:b.height,b._bind(0),R=b.glTarget;else throw new Error("invalid destination");switch(R){case 3553:case 34067:r.gl.copyTexSubImage2D(R,n,d,g,f,h,a,c);break;case 35866:case 32879:r.gl.copyTexSubImage3D(R,n,d,g,y,f,h,a,c);break;default:}b&&b._unbind(),r.gl.bindFramebuffer(36160,_),u&&l.destroy()}function qy(r){if(r instanceof K){let{width:e,height:t,id:n}=r;return{framebuffer:r.device.createFramebuffer({id:`framebuffer-for-${n}`,width:e,height:t,colorAttachments:[r]}),destroyFramebuffer:!0}}return{framebuffer:r,destroyFramebuffer:!1}}var rl,Ky=O(()=>{j();Jc();vs();rl=class extends Un{device;handle=null;commands=[];constructor(e){super(e,{}),this.device=e}_executeCommands(e=this.commands){for(let t of e)switch(t.name){case"copy-buffer-to-buffer":pS(this.device,t.options);break;case"copy-buffer-to-texture":mS(this.device,t.options);break;case"copy-texture-to-buffer":gS(this.device,t.options);break;case"copy-texture-to-texture":_S(this.device,t.options);break;default:throw new Error(t.name)}}}});var yS,nl,Zy=O(()=>{j();Qc();bs();yS=[1,2,4,8],nl=class extends Kt{device;handle=null;glParameters={};constructor(e,t){super(e,t),this.device=e;let n;if(!t?.parameters?.viewport)if(t?.framebuffer){let{width:i,height:o}=t.framebuffer;n=[0,0,i,o]}else{let[i,o]=e.getDefaultCanvasContext().getDrawingBufferSize();n=[0,0,i,o]}this.device.pushState(),this.setParameters({viewport:n,...this.props.parameters});let s=this.props.framebuffer;if(this.props.framebuffer&&s?.handle){let i=this.props.framebuffer.colorAttachments.map((o,a)=>36064+a);this.device.gl.drawBuffers(i)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let t={...this.glParameters};t.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(t.depthMask=!this.props.depthReadOnly),t.stencilMask=this.props.stencilReadOnly?0:1,t[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(t.viewport=e.viewport.slice(0,4),t.depthRange=[e.viewport[4],e.viewport[5]]):t.viewport=e.viewport),e.scissorRect&&(t.scissorTest=!0,t.scissor=e.scissorRect),e.blendConstant&&(t.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),t[2967]=e.stencilReference),"colorMask"in e&&(t.colorMask=yS.map(n=>Boolean(n&e.colorMask))),this.glParameters=t,vt(this.device.gl,t)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},t=0;this.props.clearColors&&this.props.clearColors.forEach((n,s)=>{n&&this.clearColorBuffer(s,n)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(t|=16384,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(t|=256,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(t|=1024,e.clearStencil=this.props.clearStencil),t!==0&&Lr(this.device.gl,e,()=>{this.device.gl.clear(t)})}clearColorBuffer(e=0,t=[0,0,0,0]){Lr(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,e,t);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,e,t);break;case Float32Array:this.device.gl.clearBufferfv(6144,e,t);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}}});var ao,Gy=O(()=>{j();Ky();Zy();ao=class extends Ln{device;handle=null;commandBuffer;constructor(e,t){super(e,t),this.device=e,this.commandBuffer=new rl(e)}destroy(){}finish(){return this.commandBuffer}beginRenderPass(e){return new nl(this.device,e)}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}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,t,n){}}});function Qy(r){let{target:e,source:t,start:n=0,count:s=1}=r,i=t.length,o=s*i,a=0;for(let c=n;a<i;a++)e[c++]=t[a];for(;a<o;)a<o-a?(e.copyWithin(n+a,n,n+a),a*=2):(e.copyWithin(n+a,n,n+o-a),a=o);return r.target}var Jy=O(()=>{});function xS(r){return Array.isArray(r)?new Float32Array(r):r}function bS(r,e){if(!r||!e||r.length!==e.length||r.constructor!==e.constructor)return!1;for(let t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}var As,ex=O(()=>{j();dr();qh();Jy();As=class extends Vn{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return Bl()==="Chrome"}constructor(e,t){super(e,t),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 t=e;if(t&&t.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,t?t.handle:null),this.indexBuffer=t,this.device.gl.bindVertexArray(null)}setBuffer(e,t){let n=t;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:s,type:i,stride:o,offset:a,normalized:c,integer:l,divisor:u}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),l?this.device.gl.vertexAttribIPointer(e,s,i,o,a):this.device.gl.vertexAttribPointer(e,s,i,c,o,a),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,u||0),this.attributes[e]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,t){this._enable(e,!1),this.attributes[e]=t}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 t=this.attributes[e];ArrayBuffer.isView(t)&&this.device.setConstantAttributeWebGL(e,t)}}_getAccessor(e){let t=this.attributeInfos[e];if(!t)throw new Error(`Unknown attribute location ${e}`);let n=Uc(t.bufferDataType);return{size:t.bufferComponents,type:n,stride:t.byteStride,offset:t.byteOffset,normalized:t.normalized,integer:t.integer,divisor:t.stepMode==="instance"?1:0}}_enable(e,t=!0){let s=As.isConstantAttributeZeroSupported(this.device)||e!==0;(t||s)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),t?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,t){let n=xS(t),s=n.byteLength*e,i=n.length*e;if(this.buffer&&s!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${s} !== ${this.buffer.byteLength}.`);let o=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:s}),o||=!bS(n,this.bufferValue),o){let a=pu(t.constructor,i);Qy({target:a,source:n,start:0,count:i}),this.buffer.write(a),this.bufferValue=t}return this.buffer}}});function tx(r){return typeof r=="number"?Number.isInteger(r):/^\d+$/.test(r)}var sl,rx=O(()=>{j();il();sd();sl=class extends zn{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,t){super(e,t),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,t.buffers&&this.setBuffers(t.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(Hy(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let t in e)this.setBuffer(t,e[t])})}setBuffer(e,t){let n=this._getVaryingIndex(e),{buffer:s,byteLength:i,byteOffset:o}=this._getBufferRange(t);if(n<0){this.unusedBuffers[e]=s,I.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[n]={buffer:s,byteLength:i,byteOffset:o},this.bindOnUse||this._bindBuffer(n,s,o,i)}getBuffer(e){if(tx(e))return this.buffers[e]||null;let t=this._getVaryingIndex(e);return t>=0?this.buffers[t]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let t;return this._bound?t=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,t=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),t}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof St)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:t,byteOffset:n=0,byteLength:s=e.buffer.byteLength}=e;return{buffer:t,byteOffset:n,byteLength:s}}_getVaryingIndex(e){if(tx(e))return Number(e);for(let t of this.layout.varyings||[])if(e===t.name)return t.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:t,byteLength:n,byteOffset:s}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),t,s,n)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,t,n=0,s){let i=t&&t.handle;!i||s===void 0?this.gl.bindBufferBase(35982,e,i):this.gl.bindBufferRange(35982,e,i,n,s)}}});var ol,nx=O(()=>{j();ol=class extends Wn{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,t){if(super(e,t),this.device=e,t.count>1)throw new Error("WebGL QuerySet can only have one value");let n=this.device.gl.createQuery();if(!n)throw new Error("WebGL query not supported");this.handle=n,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 t=0;return this._pollingPromise=new Promise((n,s)=>{let i=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):t++>e?(s("Timed out"),this._pollingPromise=null):requestAnimationFrame(i)};requestAnimationFrame(i)}),this._pollingPromise}}});function id(r){switch(r){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function sx(r){switch(r){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}var ix=O(()=>{});function ox(r){return TS[r]}var TS,ax=O(()=>{TS={[5124]:"sint32",[5125]:"uint32",[5122]:"sint16",[5123]:"uint16",[5120]:"sint8",[5121]:"uint8",[5126]:"float32",[5131]:"float16",[33635]:"uint16",[32819]:"uint16",[32820]:"uint16",[33640]:"uint32",[35899]:"uint32",[35902]:"uint32",[34042]:"uint32",[36269]:"uint32"}});function cx(r,e){let{sourceX:t=0,sourceY:n=0,sourceAttachment:s=0}=e||{},{target:i=null,sourceWidth:o,sourceHeight:a,sourceDepth:c,sourceFormat:l,sourceType:u}=e||{},{framebuffer:f,deleteFramebuffer:h}=ux(r),{gl:d,handle:g}=f;o||=f.width,a||=f.height;let y=f.colorAttachments[s]?.texture;if(!y)throw new Error(`Invalid framebuffer attachment ${s}`);c=y?.depth||1,l||=y?.glFormat||6408,u||=y?.glType||5121,i=vS(i,u,l,o,a,c);let _=$r(i);u=u||Fy(_);let b=d.bindFramebuffer(36160,g);return d.readBuffer(36064+s),d.readPixels(t,n,o,a,l,u,i),d.readBuffer(36064),d.bindFramebuffer(36160,b||null),h&&f.destroy(),i}function lx(r,e){let{target:t,sourceX:n=0,sourceY:s=0,sourceFormat:i=6408,targetByteOffset:o=0}=e||{},{sourceWidth:a,sourceHeight:c,sourceType:l}=e||{},{framebuffer:u,deleteFramebuffer:f}=ux(r);a=a||u.width,c=c||u.height;let h=u;l=l||5121;let d=t;if(!d){let y=id(i),_=sx(l),b=o+a*c*y*_;d=h.device.createBuffer({byteLength:b})}let g=r.device.createCommandEncoder();return g.copyTextureToBuffer({sourceTexture:r,width:a,height:c,origin:[n,s],destinationBuffer:d,byteOffset:o}),g.destroy(),f&&u.destroy(),d}function ux(r){return r instanceof It?{framebuffer:r,deleteFramebuffer:!1}:{framebuffer:wS(r),deleteFramebuffer:!0}}function wS(r,e){let{device:t,width:n,height:s,id:i}=r;return t.createFramebuffer({...e,id:`framebuffer-for-${i}`,width:n,height:s,colorAttachments:[r]})}function vS(r,e,t,n,s,i){if(r)return r;e||=5121;let o=ox(e),a=jr(o),c=id(t);return new a(n*s*c)}var fx=O(()=>{j();nd();ix();ax()});var od={};Ht(od,{WebGLDevice:()=>wn});function AS(r,e,t){switch(t.length){case 1:r.gl.vertexAttrib1fv(e,t);break;case 2:r.gl.vertexAttrib2fv(e,t);break;case 3:r.gl.vertexAttrib3fv(e,t);break;case 4:r.gl.vertexAttrib4fv(e,t);break;default:}}function SS(r,e,t){r.gl.vertexAttribI4iv(e,t)}function ES(r,e,t){r.gl.vertexAttribI4uiv(e,t)}function RS(r,e){if(!r||!e||r.length!==e.length||r.constructor!==e.constructor)return!1;for(let t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}var wn,al=O(()=>{j();Yh();hy();my();vy();Ay();Sy();zh();Wh();vs();Ry();Xc();My();Ny();Jc();jc();Yy();Gy();ex();rx();nx();fx();bs();Qc();so();wn=class extends Be{type="webgl";handle;features;limits;info;canvasContext;preferredColorFormat="rgba8unorm";preferredDepthFormat="depth24plus";commandEncoder;lost;_resolveContextLost;gl;_constants;_extensions={};_polyfilled=!1;spectorJS;get[Symbol.toStringTag](){return"WebGLDevice"}toString(){return`${this[Symbol.toStringTag]}(${this.id})`}isVertexFormatSupported(e){switch(e){case"unorm8x4-bgra":return!1;default:return!0}}constructor(e){super({...e,id:e.id||Ey("webgl-device")});let t=Be._getCanvasContextProps(e);if(!t)throw new Error("WebGLDevice requires props.createCanvasContext to be set");let n=t.canvas?.gl?.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new Hc(this,t),this.lost=new Promise(u=>{this._resolveContextLost=u});let s={...e.webgl};t.alphaMode==="premultiplied"&&(s.premultipliedAlpha=!0),e.powerPreference!==void 0&&(s.powerPreference=e.powerPreference);let o=this.props._handle||fy(this.canvasContext.canvas,{onContextLost:u=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:u=>console.log("WebGL context restored")},s);if(!o)throw new Error("WebGL context creation failed");if(n=o.device,n){if(e._reuseDevices)return I.log(1,`Not creating a new Device, instead returning a reference to Device ${n.id} already attached to WebGL context`,n)(),n._reused=!0,n;throw new Error(`WebGL context already attached to device ${n.id}`)}this.handle=o,this.gl=o,this.spectorJS=Z_({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=dy(this.gl,this._extensions),this.limits=new $c(this.gl),this.features=new Wc(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),new At(this.gl,{log:(...u)=>I.log(1,...u)()}).trackState(this.gl,{copyState:!1});let c=e.debugWebGL||e.debug,l=e.debugWebGL;c&&(this.gl=ey(this.gl,{debugWebGL:c,traceWebGL:l}),I.warn("WebGL debug mode activated. Performance reduced.")(),e.debugWebGL&&(I.level=Math.max(I.level,1))),this.commandEncoder=new ao(this,{id:`${this}-command-encoder`})}destroy(){!this.props._reuseDevices&&!this._reused&&delete this.gl.device}get isLost(){return this.gl.isContextLost()}getTextureByteAlignment(){return 4}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let t=this._normalizeBufferProps(e);return new St(this,t)}createTexture(e){return new Wt(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new Gc(this,e)}createShader(e){return new Yc(this,e)}createFramebuffer(e){return new Vt(this,e)}createVertexArray(e){return new As(this,e)}createTransformFeedback(e){return new sl(this,e)}createQuerySet(e){return new ol(this,e)}createRenderPipeline(e){return new tl(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}createCommandEncoder(e={}){return new ao(this,e)}submit(e){e||(e=this.commandEncoder.finish(),this.commandEncoder.destroy(),this.commandEncoder=this.createCommandEncoder({id:`${this.id}-default-encoder`})),e._executeCommands()}readPixelsToArrayWebGL(e,t){return cx(e,t)}readPixelsToBufferWebGL(e,t){return lx(e,t)}setParametersWebGL(e){vt(this.gl,e)}getParametersWebGL(e){return Lc(this.gl,e)}withParametersWebGL(e,t){return Lr(this.gl,e,t)}resetWebGL(){I.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),oy(this.gl)}_getDeviceSpecificTextureFormatCapabilities(e){return by(this.gl,e,this._extensions)}loseDevice(){let e=!1,n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(e=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){At.get(this.gl).push()}popState(){At.get(this.gl).pop()}getGLKey(e,t){let n=Number(e);for(let s in this.gl)if(this.gl[s]===n)return`GL.${s}`;return t?.emptyIfUnknown?"":String(e)}getGLKeys(e){let t={emptyIfUnknown:!0};return Object.entries(e).reduce((n,[s,i])=>(n[`${s}:${this.getGLKey(s,t)}`]=`${i}:${this.getGLKey(i,t)}`,n),{})}setConstantAttributeWebGL(e,t){let n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);let s=this._constants[e];switch(s&&RS(s,t)&&I.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=t,t.constructor){case Float32Array:AS(this,e,t);break;case Int32Array:SS(this,e,t);break;case Uint32Array:ES(this,e,t);break;default:throw new Error("constant")}}getExtension(e){return Ut(this.gl,e,this._extensions),this._extensions}_setWebGLDebugMetadata(e,t,n){e.luma=t;let s={props:n.spector,id:n.spector.id};e.__SPECTOR_Metadata=s}}});function IS(r){return typeof WebGL2RenderingContext<"u"&&r instanceof WebGL2RenderingContext?!0:Boolean(r&&Number.isFinite(r._version))}var cl,ad,co,hx=O(()=>{j();Y_();zh();Wh();cl=1,ad=class extends Vs{type="webgl";constructor(){super(),Be.defaultProps={...Be.defaultProps,...Bc}}enforceWebGL2(e){X_(e)}isSupported(){return typeof WebGL2RenderingContext<"u"}isDeviceHandle(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:(typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext&&I.warn("WebGL1 is not supported",e)(),!1)}async attach(e){let{WebGLDevice:t}=await Promise.resolve().then(()=>(al(),od));if(e instanceof t)return e;if(e?.device instanceof t)return e.device;if(!IS(e))throw new Error("Invalid WebGL2RenderingContext");return new t({_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1}})}async create(e={}){let{WebGLDevice:t}=await Promise.resolve().then(()=>(al(),od));I.groupCollapsed(cl,"WebGLDevice created")();try{let n=[];(e.debugWebGL||e.debug)&&n.push(J_()),e.debugSpectorJS&&n.push(K_(e));let s=await Promise.allSettled(n);for(let a of s)a.status==="rejected"&&I.error(`Failed to initialize debug libraries ${a.reason}`)();let i=new t(e),o=`${i._reused?"Reusing":"Created"} device with WebGL2 ${i.props.debug?"debug ":""}context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return I.probe(cl,o)(),I.table(cl,i.info)(),i}finally{I.groupEnd(cl)()}}};co=new ad});var il=O(()=>{hx();al();Xc()});var kE={};Ht(kE,{AmbientLight:()=>ds,Attribute:()=>hr,AttributeManager:()=>vn,COORDINATE_SYSTEM:()=>Y,CompositeLayer:()=>Ux,Controller:()=>De,Deck:()=>ll,DeckGL:()=>Co,DeckRenderer:()=>xn,DirectionalLight:()=>sr,FirstPersonController:()=>Cn,FirstPersonView:()=>Wx,FirstPersonViewport:()=>In,FlyToInterpolator:()=>Io,Layer:()=>Tl,LayerExtension:()=>Xx,LayerManager:()=>gn,LightingEffect:()=>Or,LinearInterpolator:()=>Ae,MapController:()=>yn,MapView:()=>Mc,OPERATION:()=>h_,OrbitController:()=>Mn,OrbitView:()=>$x,OrbitViewport:()=>En,OrthographicController:()=>On,OrthographicView:()=>jx,OrthographicViewport:()=>Rn,PointLight:()=>_s,PostProcessEffect:()=>Hi,TRANSITION_EVENTS:()=>Ki,Tesselator:()=>Po,TransitionInterpolator:()=>lr,UNIT:()=>Pr,VERSION:()=>nc,View:()=>Ne,Viewport:()=>$e,WebMercatorViewport:()=>kr,Widget:()=>Fr,_CameraLight:()=>Wi,_Component:()=>Rs,_ComponentState:()=>An,_GlobeController:()=>kn,_GlobeView:()=>Hx,_GlobeViewport:()=>Sn,_LayersPass:()=>xt,_PickLayersPass:()=>ir,_SunLight:()=>$i,_applyStyles:()=>to,_compareProps:()=>yl,_count:()=>xl,_deepEqual:()=>le,_fillArray:()=>Ic,_flatten:()=>Dr,_memoize:()=>it,_mergeShaders:()=>bo,_registerLoggers:()=>rc,_removeStyles:()=>Dc,assert:()=>oe,color:()=>dh,createIterable:()=>Ss,fp64LowPart:()=>Nh,getShaderAssembler:()=>wc,gouraudMaterial:()=>ai,log:()=>H,phongMaterial:()=>ci,picking:()=>Oh,project:()=>Cr,project32:()=>Ah,shadow:()=>hs});var Nf={};Ht(Nf,{Buffer:()=>W,BufferTransform:()=>pt,CubeGeometry:()=>pi,Device:()=>Be,Framebuffer:()=>It,Geometry:()=>mt,GroupNode:()=>nn,Model:()=>Xe,ModelNode:()=>di,ScenegraphNode:()=>Ot,SphereGeometry:()=>mi,Texture:()=>K,TextureTransform:()=>fi,attachDevice:()=>V3,createDevice:()=>z3,enforceWebGL2:()=>W3,getSupportedAdapters:()=>L3,setDefaultDeviceProps:()=>U3,stats:()=>B3});j();j();var Hb=1,Xb=1,qr=class{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(e){let{delay:t=0,duration:n=Number.POSITIVE_INFINITY,rate:s=1,repeat:i=1}=e,o=Hb++,a={time:0,delay:t,duration:n,rate:s,repeat:i};return this._setChannelTime(a,this.time),this.channels.set(o,a),o}removeChannel(e){this.channels.delete(e);for(let[t,n]of this.animations)n.channel===e&&this.detachAnimation(t)}isFinished(e){let t=this.channels.get(e);return t===void 0?!1:this.time>=t.delay+t.duration*t.repeat}getTime(e){if(e===void 0)return this.time;let t=this.channels.get(e);return t===void 0?-1:t.time}setTime(e){this.time=Math.max(0,e);let t=this.channels.values();for(let s of t)this._setChannelTime(s,this.time);let n=this.animations.values();for(let s of n){let{animation:i,channel:o}=s;i.setTime(this.getTime(o))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(e,t){let n=Xb++;return this.animations.set(n,{animation:e,channel:t}),e.setTime(this.getTime(t)),n}detachAnimation(e){this.animations.delete(e)}update(e){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=e),this.setTime(this.time+(e-this.lastEngineTime)),this.lastEngineTime=e)}_setChannelTime(e,t){let n=t-e.delay,s=e.duration*e.repeat;n>=s?e.time=e.duration*e.rate:(e.time=Math.max(0,n)%e.duration,e.time*=e.rate)}};j();function Sp(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function Ep(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}Cs();var Yb=0,_u=class{device=null;canvas=null;props;animationProps=null;timeline=null;stats;cpuTime;gpuTime;frameRate;display;needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;_error=null;constructor(e){if(this.props={..._u.defaultAnimationLoopProps,...e},e=this.props,!e.device)throw new Error("No device provided");this.stats=e.stats||new Ke({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:e.autoResizeViewport}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null)}delete(){this.destroy()}reportError(e){this.props.onError(e),this._error=e}setNeedsRedraw(e){return this.needsRedraw=this.needsRedraw||e,this}setProps(e){return"autoResizeViewport"in e&&(this.props.autoResizeViewport=e.autoResizeViewport||!1),this}async start(){if(this._running)return this;this._running=!0;try{let e;return this._initialized||(this._initialized=!0,await this._initDevice(),this._initialize(),await this.props.onInitialize(this._getAnimationProps())),this._running?(e!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(e){let t=e instanceof Error?e:new Error("Unknown error");throw this.props.onError(t),t}}stop(){return this._running&&(this.animationProps&&!this._error&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost||this._error?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(e){return this.timeline=e,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(e=>{this._resolveNextFrame=e})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeViewport()}_setDisplay(e){this.display&&(this.display.destroy(),this.display.animationLoop=null),e&&(e.animationLoop=this),this.display=e}_requestAnimationFrame(){this._running&&(this._animationFrameId=Sp(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(Ep(this._animationFrameId),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(e){if(this.display){this.display._renderFrame(e);return}this.props.onRender(this._getAnimationProps()),this.device?.submit()}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeViewport()}_initializeAnimationProps(){let e=this.device?.getDefaultCanvasContext();if(!this.device||!e)throw new Error("loop");let t=e?.canvas,n=e.props.useDevicePixels;this.animationProps={animationLoop:this,device:this.device,canvasContext:e,canvas:t,useDevicePixels:n,timeline:this.timeline,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:e,height:t,aspect:n}=this._getSizeAndAspect();(e!==this.animationProps.width||t!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),n!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=e,this.animationProps.height=t,this.animationProps.aspect=n,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.getDefaultCanvasContext().canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let e=document.createElement("div");document.body.appendChild(e),e.style.position="relative";let t=document.createElement("div");t.style.position="absolute",t.style.left="10px",t.style.bottom="10px",t.style.width="300px",t.style.background="white",this.canvas instanceof HTMLCanvasElement&&e.appendChild(this.canvas),e.appendChild(t);let n=this.props.onAddHTML(t);n&&(t.innerHTML=n)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[e,t]=this.device?.getDefaultCanvasContext().getDevicePixelSize()||[1,1],n=1,s=this.device?.getDefaultCanvasContext().canvas;return s&&s.clientHeight?n=s.clientWidth/s.clientHeight:e>0&&t>0&&(n=e/t),{width:e,height:t,aspect:n}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_beginFrameTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()}_endFrameTimers(){this.cpuTime.timeEnd()}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(e){e instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[e.offsetX,e.offsetY])}_onMouseleave(e){this._getAnimationProps()._mousePosition=null}},jn=_u;L(jn,"defaultAnimationLoopProps",{device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:e=>console.error(e),stats:mr.stats.get(`animation-loop-${Yb++}`),autoResizeViewport:!1});j();function Jo(r,e){if(!r)throw new Error(e||"shadertools: assertion failed.")}var yu={number:{type:"number",validate(r,e){return Number.isFinite(r)&&typeof e=="object"&&(e.max===void 0||r<=e.max)&&(e.min===void 0||r>=e.min)}},array:{type:"array",validate(r,e){return Array.isArray(r)||ArrayBuffer.isView(r)}}};function Ip(r){let e={};for(let[t,n]of Object.entries(r))e[t]=qb(n);return e}function qb(r){let e=Rp(r);if(e!=="object")return{value:r,...yu[e],type:e};if(typeof r=="object")return r?r.type!==void 0?{...r,...yu[r.type],type:r.type}:r.value===void 0?{type:"object",value:r}:(e=Rp(r.value),{...r,...yu[e],type:e}):{type:"object",value:null};throw new Error("props")}function Rp(r){return Array.isArray(r)||ArrayBuffer.isView(r)?"array":typeof r}var Pp=`#ifdef MODULE_LOGDEPTH
18
+ ${e}`;let{gl:t}=this.device;if(t.shaderSource(this.handle,e),t.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}I.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),I.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async s=>await new Promise(i=>setTimeout(i,s));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}});function ky(r,e,t,n){if(rS(e))return n(r);let s=r;s.pushState();try{return JA(r,e),vt(s.gl,t),n(r)}finally{s.popState()}}function JA(r,e){let t=r,{gl:n}=t;if(e.cullMode)switch(e.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(e.frontFace&&n.frontFace(Tn("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&r.features.has("depth-clip-control")&&n.enable(34383),e.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&r.features.has("provoking-vertex-webgl")){let i=t.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,o=Tn("provokingVertex",e.provokingVertex,{first:36429,last:36430});i?.provokingVertexWEBGL(o)}if((e.polygonMode||e.polygonOffsetLine)&&r.features.has("polygon-mode-webgl")){if(e.polygonMode){let i=t.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,o=Tn("polygonMode",e.polygonMode,{fill:6914,line:6913});i?.polygonModeWEBGL(1028,o),i?.polygonModeWEBGL(1029,o)}e.polygonOffsetLine&&n.enable(10754)}if(r.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&n.enable(12288),e.clipDistance1&&n.enable(12289),e.clipDistance2&&n.enable(12290),e.clipDistance3&&n.enable(12291),e.clipDistance4&&n.enable(12292),e.clipDistance5&&n.enable(12293),e.clipDistance6&&n.enable(12294),e.clipDistance7&&n.enable(12295)),e.depthWriteEnabled!==void 0&&n.depthMask(tS("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(Kc("depthCompare",e.depthCompare))),e.stencilWriteMask){let s=e.stencilWriteMask;n.stencilMaskSeparate(1028,s),n.stencilMaskSeparate(1029,s)}if(e.stencilReadMask&&I.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let s=e.stencilReadMask||4294967295,i=Kc("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,i,0,s),n.stencilFuncSeparate(1029,i,0,s)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let s=Gh("stencilPassOperation",e.stencilPassOperation),i=Gh("stencilFailOperation",e.stencilFailOperation),o=Gh("stencilDepthFailOperation",e.stencilDepthFailOperation);n.stencilOpSeparate(1028,i,o,s),n.stencilOpSeparate(1029,i,o,s)}switch(e.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break;default:}if(e.blendColorOperation||e.blendAlphaOperation){let s=Oy("blendColorOperation",e.blendColorOperation||"add"),i=Oy("blendAlphaOperation",e.blendAlphaOperation||"add");n.blendEquationSeparate(s,i);let o=qc("blendColorSrcFactor",e.blendColorSrcFactor||"one"),a=qc("blendColorDstFactor",e.blendColorDstFactor||"zero"),c=qc("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),l=qc("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");n.blendFuncSeparate(o,a,c,l)}}function Kc(r,e){return Tn(r,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function Gh(r,e){return Tn(r,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Oy(r,e){return Tn(r,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function qc(r,e,t="color"){return Tn(r,e,{one:1,zero:0,src:768,"one-minus-src":769,dst:774,"one-minus-dst":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,constant:t==="color"?32769:32771,"one-minus-constant":t==="color"?32770:32772,src1:768,"one-minus-src1":769,"src1-alpha":770,"one-minus-src1-alpha":771})}function eS(r,e){return`Illegal parameter ${e} for ${r}`}function Tn(r,e,t){if(!(e in t))throw new Error(eS(r,e));return t[e]}function tS(r,e){return e}function rS(r){let e=!0;for(let t in r){e=!1;break}return e}var Qh=O(()=>{j();bs()});function Zc(r){let e={};return r.addressModeU&&(e[10242]=Jh(r.addressModeU)),r.addressModeV&&(e[10243]=Jh(r.addressModeV)),r.addressModeW&&(e[32882]=Jh(r.addressModeW)),r.magFilter&&(e[10240]=ed(r.magFilter)),(r.minFilter||r.mipmapFilter)&&(e[10241]=nS(r.minFilter||"linear",r.mipmapFilter)),r.lodMinClamp!==void 0&&(e[33082]=r.lodMinClamp),r.lodMaxClamp!==void 0&&(e[33083]=r.lodMaxClamp),r.type==="comparison-sampler"&&(e[34892]=34894),r.compare&&(e[34893]=Kc("compare",r.compare)),r.maxAnisotropy&&(e[34046]=r.maxAnisotropy),e}function Jh(r){switch(r){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function ed(r){switch(r){case"nearest":return 9728;case"linear":return 9729}}function nS(r,e="none"){if(!e)return ed(r);switch(e){case"none":return ed(r);case"nearest":switch(r){case"nearest":return 9984;case"linear":return 9985}break;case"linear":switch(r){case"nearest":return 9986;case"linear":return 9987}}}var td=O(()=>{Qh()});var Gc,Ny=O(()=>{j();td();Gc=class extends Ze{device;handle;parameters;constructor(e,t){super(e,t),this.device=e,this.parameters=Zc(t),this.handle=t.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[t,n]of Object.entries(e)){let s=Number(t);switch(s){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,s,n);break;default:this.device.gl.samplerParameteri(this.handle,s,n);break}}}}});function Lr(r,e,t){if(sS(e))return t(r);let{nocatch:n=!0}=e,s=At.get(r);s.push(),vt(r,e);let i;if(n)i=t(r),s.pop();else try{i=t(r)}finally{s.pop()}return i}function sS(r){for(let e in r)return!1;return!0}var Qc=O(()=>{bs();Yh()});var zt,rd=O(()=>{j();zt=class extends gr{device;gl;handle;texture;constructor(e,t){super(e,{...K.defaultProps,...t}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=t.texture}}});function iS(r){switch(r){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866;case"cube-array":break}throw new Error(r)}function Dy(r,e,t){return e==="cube"?34069+t:r}var Wt,Jc=O(()=>{j();vs();td();Qc();rd();Wt=class extends K{device;gl;handle;sampler=void 0;view;glTarget;glFormat;glType;glInternalFormat;compressed;_textureUnit=0;constructor(e,t){super(e,t),this.device=e,this.gl=this.device.gl;let n=zc(this.props.format);this.glTarget=iS(this.props.dimension),this.glInternalFormat=n.internalFormat,this.glFormat=n.format,this.glType=n.type,this.compressed=n.compressed,this.handle=this.props.handle||this.gl.createTexture(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this.gl.bindTexture(this.glTarget,this.handle);let{dimension:s,width:i,height:o,depth:a,mipLevels:c,glTarget:l,glInternalFormat:u}=this;switch(s){case"2d":case"cube":this.gl.texStorage2D(l,c,u,i,o);break;case"2d-array":case"3d":this.gl.texStorage3D(l,c,u,i,o,a);break;default:throw new Error(s)}this.gl.bindTexture(this.glTarget,null),this._initializeData(t.data),this.setSampler(this.props.sampler),this.view=new zt(this.device,{...this.props,texture:this}),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(e){return new zt(this.device,{...e,texture:this})}setSampler(e={}){super.setSampler(e);let t=Zc(this.sampler.props);this._setSamplerParameters(t)}copyImageData(e){let t=this._normalizeCopyImageDataOptions(e),n=t.data,{width:s,height:i,depth:o}=this,{mipLevel:a=0,byteOffset:c=0,x:l=0,y:u=0,z:f=0}=t,{glFormat:h,glType:d,compressed:g}=this,y=Dy(this.glTarget,this.dimension,o),_=this.compressed?{}:{[3314]:t.bytesPerRow,[32878]:t.rowsPerImage};this.gl.bindTexture(y,this.handle),Lr(this.gl,_,()=>{switch(this.dimension){case"2d":case"cube":g?this.gl.compressedTexSubImage2D(y,a,l,u,s,i,h,n,c):this.gl.texSubImage2D(y,a,l,u,s,i,h,d,n,c);break;case"2d-array":case"3d":g?this.gl.compressedTexSubImage3D(y,a,l,u,f,s,i,o,h,n,c):this.gl.texSubImage3D(y,a,l,u,f,s,i,o,h,d,n,c);break;default:}}),this.gl.bindTexture(y,null)}copyExternalImage(e){let t=this._normalizeCopyExternalImageOptions(e);if(t.sourceX||t.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");let{glFormat:n,glType:s}=this,{image:i,depth:o,mipLevel:a,x:c,y:l,z:u,width:f,height:h}=t,d=Dy(this.glTarget,this.dimension,o),g=t.flipY?{[37440]:!0}:{};return this.gl.bindTexture(this.glTarget,this.handle),Lr(this.gl,g,()=>{switch(this.dimension){case"2d":case"cube":this.gl.texSubImage2D(d,a,c,l,f,h,n,s,i);break;case"2d-array":case"3d":this.gl.texSubImage3D(d,a,c,l,u,f,h,o,n,s,i);break;default:}}),this.gl.bindTexture(this.glTarget,null),{width:t.width,height:t.height}}generateMipmapsWebGL(e){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(I.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!e?.force)))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(n){I.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}_setSamplerParameters(e){I.log(2,`${this.id} sampler parameters`,this.device.getGLKeys(e))(),this.gl.bindTexture(this.glTarget,this.handle);for(let[t,n]of Object.entries(e)){let s=Number(t),i=n;switch(s){case 33082:case 33083:this.gl.texParameterf(this.glTarget,s,i);break;case 10240:case 10241:this.gl.texParameteri(this.glTarget,s,i);break;case 10242:case 10243:case 32882:this.gl.texParameteri(this.glTarget,s,i);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,s,i);break;case 34892:case 34893:this.gl.texParameteri(this.glTarget,s,i);break}}this.gl.bindTexture(this.glTarget,null)}_getActiveUnit(){return this.gl.getParameter(34016)-33984}_bind(e){let{gl:t}=this;return e!==void 0&&(this._textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.glTarget,this.handle),e}_unbind(e){let{gl:t}=this;return e!==void 0&&(this._textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.glTarget,null),e}}});function Fy(r){return aS[r]}function el(r){return oS[r]}function By(r){return Boolean(Uy[r])}function Ly(r){return Uy[r]}var oS,Uy,aS,nd=O(()=>{oS={[5126]:"f32",[35664]:"vec2<f32>",[35665]:"vec3<f32>",[35666]:"vec4<f32>",[5124]:"i32",[35667]:"vec2<i32>",[35668]:"vec3<i32>",[35669]:"vec4<i32>",[5125]:"u32",[36294]:"vec2<u32>",[36295]:"vec3<u32>",[36296]:"vec4<u32>",[35670]:"f32",[35671]:"vec2<f32>",[35672]:"vec3<f32>",[35673]:"vec4<f32>",[35674]:"mat2x2<f32>",[35685]:"mat2x3<f32>",[35686]:"mat2x4<f32>",[35687]:"mat3x2<f32>",[35675]:"mat3x3<f32>",[35688]:"mat3x4<f32>",[35689]:"mat4x2<f32>",[35690]:"mat4x3<f32>",[35676]:"mat4x4<f32>"},Uy={[35678]:{viewDimension:"2d",sampleType:"float"},[35680]:{viewDimension:"cube",sampleType:"float"},[35679]:{viewDimension:"3d",sampleType:"float"},[35682]:{viewDimension:"3d",sampleType:"depth"},[36289]:{viewDimension:"2d-array",sampleType:"float"},[36292]:{viewDimension:"2d-array",sampleType:"depth"},[36293]:{viewDimension:"cube",sampleType:"float"},[36298]:{viewDimension:"2d",sampleType:"sint"},[36299]:{viewDimension:"3d",sampleType:"sint"},[36300]:{viewDimension:"cube",sampleType:"sint"},[36303]:{viewDimension:"2d-array",sampleType:"uint"},[36306]:{viewDimension:"2d",sampleType:"uint"},[36307]:{viewDimension:"3d",sampleType:"uint"},[36308]:{viewDimension:"cube",sampleType:"uint"},[36311]:{viewDimension:"2d-array",sampleType:"uint"}},aS={uint8:5121,sint8:5120,unorm8:5121,snorm8:5120,uint16:5123,sint16:5122,unorm16:5123,snorm16:5122,uint32:5125,sint32:5124,float16:5131,float32:5126}});function Vy(r,e){let t={attributes:[],bindings:[]};t.attributes=cS(r,e);let n=fS(r,e);for(let a of n){let c=a.uniforms.map(l=>({name:l.name,format:l.format,byteOffset:l.byteOffset,byteStride:l.byteStride,arrayLength:l.arrayLength}));t.bindings.push({type:"uniform",name:a.name,group:0,location:a.location,visibility:(a.vertex?1:0)&(a.fragment?2:0),minBindingSize:a.byteLength,uniforms:c})}let s=uS(r,e),i=0;for(let a of s)if(By(a.type)){let{viewDimension:c,sampleType:l}=Ly(a.type);t.bindings.push({type:"texture",name:a.name,group:0,location:i,viewDimension:c,sampleType:l}),a.textureUnit=i,i+=1}s.length&&(t.uniforms=s);let o=lS(r,e);return o?.length&&(t.varyings=o),t}function cS(r,e){let t=[],n=r.getProgramParameter(e,35721);for(let s=0;s<n;s++){let i=r.getActiveAttrib(e,s);if(!i)throw new Error("activeInfo");let{name:o,type:a}=i,c=r.getAttribLocation(e,o);if(c>=0){let l=el(a),u=/instance/i.test(o)?"instance":"vertex";t.push({name:o,location:c,stepMode:u,type:l})}}return t.sort((s,i)=>s.location-i.location),t}function lS(r,e){let t=[],n=r.getProgramParameter(e,35971);for(let s=0;s<n;s++){let i=r.getTransformFeedbackVarying(e,s);if(!i)throw new Error("activeInfo");let{name:o,type:a,size:c}=i,l=el(a),{type:u,components:f}=zs(l);t.push({location:s,name:o,type:u,size:c*f})}return t.sort((s,i)=>s.location-i.location),t}function uS(r,e){let t=[],n=r.getProgramParameter(e,35718);for(let s=0;s<n;s++){let i=r.getActiveUniform(e,s);if(!i)throw new Error("activeInfo");let{name:o,size:a,type:c}=i,{name:l,isArray:u}=hS(o),f=r.getUniformLocation(e,l),h={location:f,name:l,size:a,type:c,isArray:u};if(t.push(h),h.size>1)for(let d=0;d<h.size;d++){let g=`${l}[${d}]`;f=r.getUniformLocation(e,g);let y={...h,name:g,location:f};t.push(y)}}return t}function fS(r,e){let t=(i,o)=>r.getActiveUniformBlockParameter(e,i,o),n=[],s=r.getProgramParameter(e,35382);for(let i=0;i<s;i++){let o={name:r.getActiveUniformBlockName(e,i)||"",location:t(i,35391),byteLength:t(i,35392),vertex:t(i,35396),fragment:t(i,35398),uniformCount:t(i,35394),uniforms:[]},a=t(i,35395)||[],c=r.getActiveUniforms(e,a,35383),l=r.getActiveUniforms(e,a,35384),u=r.getActiveUniforms(e,a,35387),f=r.getActiveUniforms(e,a,35388);for(let h=0;h<o.uniformCount;++h){let d=r.getActiveUniform(e,a[h]);if(!d)throw new Error("activeInfo");let g=el(c[h]);o.uniforms.push({name:d.name,format:g,type:c[h],arrayLength:l[h],byteOffset:u[h],byteStride:f[h]})}n.push(o)}return n.sort((i,o)=>i.location-o.location),n}function hS(r){if(r[r.length-1]!=="]")return{name:r,length:1,isArray:!1};let t=/([^[]*)(\[[0-9]+\])?/.exec(r);if(!t||t.length<2)throw new Error(`Failed to parse GLSL uniform name ${r}`);return{name:t[1],length:t[2]?1:0,isArray:Boolean(t[2])}}var zy=O(()=>{j();nd()});function Wy(r,e,t,n){let s=r,i=n;i===!0&&(i=1),i===!1&&(i=0);let o=typeof i=="number"?[i]:i;switch(t){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return r.uniform1i(e,n);case 5126:return r.uniform1fv(e,o);case 35664:return r.uniform2fv(e,o);case 35665:return r.uniform3fv(e,o);case 35666:return r.uniform4fv(e,o);case 5124:return r.uniform1iv(e,o);case 35667:return r.uniform2iv(e,o);case 35668:return r.uniform3iv(e,o);case 35669:return r.uniform4iv(e,o);case 35670:return r.uniform1iv(e,o);case 35671:return r.uniform2iv(e,o);case 35672:return r.uniform3iv(e,o);case 35673:return r.uniform4iv(e,o);case 5125:return s.uniform1uiv(e,o,1);case 36294:return s.uniform2uiv(e,o,2);case 36295:return s.uniform3uiv(e,o,3);case 36296:return s.uniform4uiv(e,o,4);case 35674:return r.uniformMatrix2fv(e,!1,o);case 35675:return r.uniformMatrix3fv(e,!1,o);case 35676:return r.uniformMatrix4fv(e,!1,o);case 35685:return s.uniformMatrix2x3fv(e,!1,o);case 35686:return s.uniformMatrix2x4fv(e,!1,o);case 35687:return s.uniformMatrix3x2fv(e,!1,o);case 35688:return s.uniformMatrix3x4fv(e,!1,o);case 35689:return s.uniformMatrix4x2fv(e,!1,o);case 35690:return s.uniformMatrix4x3fv(e,!1,o)}throw new Error("Illegal uniform")}var $y=O(()=>{});function jy(r){switch(r){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw new Error(r)}}function Hy(r){switch(r){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;default:throw new Error(r)}}var sd=O(()=>{});function dS(r,e){let t={...r,attributes:r.attributes.map(n=>({...n}))};for(let n of e?.attributes||[]){let s=t.attributes.find(i=>i.name===n.name);s?(s.type=n.type||s.type,s.stepMode=n.stepMode||s.stepMode):I.warn(`shader layout attribute ${n.name} not present in shader`)}return t}var Xy,tl,Yy=O(()=>{j();zy();Qh();$y();Xc();jc();Jc();rd();sd();Xy=4,tl=class extends Ge{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};get[Symbol.toStringTag](){return"WEBGLRenderPipeline"}constructor(e,t){super(e,t),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:{id:this.props.id}}),this.vs=t.vs,this.fs=t.fs;let{varyings:n,bufferMode:s=35981}=t;n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,s)),this._linkShaders(),I.time(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=Vy(this.device.gl,this.handle),I.timeEnd(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=t.shaderLayout?dS(this.introspectedLayout,t.shaderLayout):this.introspectedLayout}destroy(){this.handle&&(this.device.gl.useProgram(null),this.device.gl.deleteProgram(this.handle),this.destroyed=!0,this.handle.destroyed=!0,this.handle=null)}setBindings(e,t){for(let[n,s]of Object.entries(e)){let i=this.shaderLayout.bindings.find(o=>o.name===n)||this.shaderLayout.bindings.find(o=>o.name===`${n}Uniforms`);if(!i){let o=this.shaderLayout.bindings.map(a=>`"${a.name}"`).join(", ");t?.disableWarnings||I.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${o}`,s)();continue}switch(s||I.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),i.type){case"uniform":if(!(s instanceof St)&&!(s.buffer instanceof St))throw new Error("buffer value");break;case"texture":if(!(s instanceof zt||s instanceof Wt||s instanceof Vt))throw new Error(`${this} Bad texture binding for ${n}`);break;case"sampler":I.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(i.type)}this.bindings[n]=s}}draw(e){let{renderPass:t,parameters:n=this.props.parameters,topology:s=this.props.topology,vertexArray:i,vertexCount:o,instanceCount:a,isInstanced:c=!1,firstVertex:l=0,transformFeedback:u}=e,f=jy(s),h=Boolean(i.indexBuffer),d=i.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return I.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return I.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),i.bindBeforeRender(t),u&&u.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let g=t;return ky(this.device,n,g.glParameters,()=>{h&&c?this.device.gl.drawElementsInstanced(f,o||0,d,l,a||0):h?this.device.gl.drawElements(f,o||0,d,l):c?this.device.gl.drawArraysInstanced(f,l,o||0,a||0):this.device.gl.drawArrays(f,l,o||0),u&&u.end()}),i.unbindAfterRender(t),!0}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),I.time(Xy,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),I.timeEnd(Xy,`linkProgram for ${this.id}`)(),I.level,!this.device.features.has("compilation-status-async-webgl")){let n=this._getLinkStatus();this._reportLinkStatus(n);return}I.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),I.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let t=this._getLinkStatus();this._reportLinkStatus(t)}async _reportLinkStatus(e){switch(e){case"success":return;default:let t=e==="link-error"?"Link error":"Validation error";switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`${this} ${t} during compilation of ${this.vs}`);case"pending":await this.vs.asyncCompilationStatus,this.vs.debugShader();break;case"success":break}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`${this} ${t} during compilation of ${this.fs}`);case"pending":await this.fs.asyncCompilationStatus,this.fs.debugShader();break;case"success":break}let n=this.device.gl.getProgramInfoLog(this.handle);this.device.reportError(new Error(`${t} during ${e}: ${n}`),this)(),this.device.debug()}}_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-error")):(this.linkStatus="error","link-error")}async _waitForLinkComplete(){let e=async s=>await new Promise(i=>setTimeout(i,s));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let t of this.shaderLayout.bindings)!this.bindings[t.name]&&!this.bindings[t.name.replace(/Uniforms$/,"")]&&(I.warn(`Binding ${t.name} not found in ${this.id}`)(),e=!1);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let t=0,n=0;for(let s of this.shaderLayout.bindings){let i=this.bindings[s.name]||this.bindings[s.name.replace(/Uniforms$/,"")];if(!i)throw new Error(`No value for binding ${s.name} in ${this.id}`);switch(s.type){case"uniform":let{name:o}=s,a=e.getUniformBlockIndex(this.handle,o);if(a===4294967295)throw new Error(`Invalid uniform block name ${o}`);e.uniformBlockBinding(this.handle,n,a),i instanceof St?e.bindBufferBase(35345,n,i.handle):e.bindBufferRange(35345,n,i.buffer.handle,i.offset||0,i.size||i.buffer.byteLength-i.offset),n+=1;break;case"texture":if(!(i instanceof zt||i instanceof Wt||i instanceof Vt))throw new Error("texture");let c;if(i instanceof zt)c=i.texture;else if(i instanceof Wt)c=i;else if(i instanceof Vt&&i.colorAttachments[0]instanceof zt)I.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),c=i.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+t),e.bindTexture(c.glTarget,c.handle),t+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${s.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:t,location:n,type:s,textureUnit:i}=e,o=this.uniforms[t]??i;o!==void 0&&Wy(this.device.gl,n,s,o)}}}});function pS(r,e){let t=e.sourceBuffer,n=e.destinationBuffer;r.gl.bindBuffer(36662,t.handle),r.gl.bindBuffer(36663,n.handle),r.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),r.gl.bindBuffer(36662,null),r.gl.bindBuffer(36663,null)}function mS(r,e){throw new Error("Not implemented")}function gS(r,e){let{sourceTexture:t,mipLevel:n=0,aspect:s="all",width:i=e.sourceTexture.width,height:o=e.sourceTexture.height,depthOrArrayLayers:a=0,origin:c=[0,0],destinationBuffer:l,byteOffset:u=0,bytesPerRow:f,rowsPerImage:h}=e;if(s!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||a!==0||f||h)throw new Error("not implemented");let{framebuffer:d,destroyFramebuffer:g}=qy(t),y;try{let _=l,b=i||d.width,R=o||d.height,x=zc(d.colorAttachments[0].texture.props.format),S=x.format,C=x.type;r.gl.bindBuffer(35051,_.handle),y=r.gl.bindFramebuffer(36160,d.handle),r.gl.readPixels(c[0],c[1],b,R,S,C,u)}finally{r.gl.bindBuffer(35051,null),y!==void 0&&r.gl.bindFramebuffer(36160,y),g&&d.destroy()}}function _S(r,e){let{sourceTexture:t,destinationMipLevel:n=0,origin:s=[0,0],destinationOrigin:i=[0,0],destinationTexture:o}=e,{width:a=e.destinationTexture.width,height:c=e.destinationTexture.height}=e,{framebuffer:l,destroyFramebuffer:u}=qy(t),[f,h]=s,[d,g,y]=i,_=r.gl.bindFramebuffer(36160,l.handle),b,R;if(o instanceof Wt)b=o,a=Number.isFinite(a)?a:b.width,c=Number.isFinite(c)?c:b.height,b._bind(0),R=b.glTarget;else throw new Error("invalid destination");switch(R){case 3553:case 34067:r.gl.copyTexSubImage2D(R,n,d,g,f,h,a,c);break;case 35866:case 32879:r.gl.copyTexSubImage3D(R,n,d,g,y,f,h,a,c);break;default:}b&&b._unbind(),r.gl.bindFramebuffer(36160,_),u&&l.destroy()}function qy(r){if(r instanceof K){let{width:e,height:t,id:n}=r;return{framebuffer:r.device.createFramebuffer({id:`framebuffer-for-${n}`,width:e,height:t,colorAttachments:[r]}),destroyFramebuffer:!0}}return{framebuffer:r,destroyFramebuffer:!1}}var rl,Ky=O(()=>{j();Jc();vs();rl=class extends Un{device;handle=null;commands=[];constructor(e){super(e,{}),this.device=e}_executeCommands(e=this.commands){for(let t of e)switch(t.name){case"copy-buffer-to-buffer":pS(this.device,t.options);break;case"copy-buffer-to-texture":mS(this.device,t.options);break;case"copy-texture-to-buffer":gS(this.device,t.options);break;case"copy-texture-to-texture":_S(this.device,t.options);break;default:throw new Error(t.name)}}}});var yS,nl,Zy=O(()=>{j();Qc();bs();yS=[1,2,4,8],nl=class extends Kt{device;handle=null;glParameters={};constructor(e,t){super(e,t),this.device=e;let n;if(!t?.parameters?.viewport)if(t?.framebuffer){let{width:i,height:o}=t.framebuffer;n=[0,0,i,o]}else{let[i,o]=e.getDefaultCanvasContext().getDrawingBufferSize();n=[0,0,i,o]}this.device.pushState(),this.setParameters({viewport:n,...this.props.parameters});let s=this.props.framebuffer;if(this.props.framebuffer&&s?.handle){let i=this.props.framebuffer.colorAttachments.map((o,a)=>36064+a);this.device.gl.drawBuffers(i)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let t={...this.glParameters};t.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(t.depthMask=!this.props.depthReadOnly),t.stencilMask=this.props.stencilReadOnly?0:1,t[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(t.viewport=e.viewport.slice(0,4),t.depthRange=[e.viewport[4],e.viewport[5]]):t.viewport=e.viewport),e.scissorRect&&(t.scissorTest=!0,t.scissor=e.scissorRect),e.blendConstant&&(t.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),t[2967]=e.stencilReference),"colorMask"in e&&(t.colorMask=yS.map(n=>Boolean(n&e.colorMask))),this.glParameters=t,vt(this.device.gl,t)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},t=0;this.props.clearColors&&this.props.clearColors.forEach((n,s)=>{n&&this.clearColorBuffer(s,n)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(t|=16384,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(t|=256,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(t|=1024,e.clearStencil=this.props.clearStencil),t!==0&&Lr(this.device.gl,e,()=>{this.device.gl.clear(t)})}clearColorBuffer(e=0,t=[0,0,0,0]){Lr(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,e,t);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,e,t);break;case Float32Array:this.device.gl.clearBufferfv(6144,e,t);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}}});var ao,Gy=O(()=>{j();Ky();Zy();ao=class extends Ln{device;handle=null;commandBuffer;constructor(e,t){super(e,t),this.device=e,this.commandBuffer=new rl(e)}destroy(){}finish(){return this.commandBuffer}beginRenderPass(e){return new nl(this.device,e)}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}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,t,n){}}});function Qy(r){let{target:e,source:t,start:n=0,count:s=1}=r,i=t.length,o=s*i,a=0;for(let c=n;a<i;a++)e[c++]=t[a];for(;a<o;)a<o-a?(e.copyWithin(n+a,n,n+a),a*=2):(e.copyWithin(n+a,n,n+o-a),a=o);return r.target}var Jy=O(()=>{});function xS(r){return Array.isArray(r)?new Float32Array(r):r}function bS(r,e){if(!r||!e||r.length!==e.length||r.constructor!==e.constructor)return!1;for(let t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}var As,ex=O(()=>{j();dr();qh();Jy();As=class extends Vn{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return Bl()==="Chrome"}constructor(e,t){super(e,t),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 t=e;if(t&&t.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,t?t.handle:null),this.indexBuffer=t,this.device.gl.bindVertexArray(null)}setBuffer(e,t){let n=t;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:s,type:i,stride:o,offset:a,normalized:c,integer:l,divisor:u}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),l?this.device.gl.vertexAttribIPointer(e,s,i,o,a):this.device.gl.vertexAttribPointer(e,s,i,c,o,a),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,u||0),this.attributes[e]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,t){this._enable(e,!1),this.attributes[e]=t}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 t=this.attributes[e];ArrayBuffer.isView(t)&&this.device.setConstantAttributeWebGL(e,t)}}_getAccessor(e){let t=this.attributeInfos[e];if(!t)throw new Error(`Unknown attribute location ${e}`);let n=Uc(t.bufferDataType);return{size:t.bufferComponents,type:n,stride:t.byteStride,offset:t.byteOffset,normalized:t.normalized,integer:t.integer,divisor:t.stepMode==="instance"?1:0}}_enable(e,t=!0){let s=As.isConstantAttributeZeroSupported(this.device)||e!==0;(t||s)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),t?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,t){let n=xS(t),s=n.byteLength*e,i=n.length*e;if(this.buffer&&s!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${s} !== ${this.buffer.byteLength}.`);let o=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:s}),o||=!bS(n,this.bufferValue),o){let a=pu(t.constructor,i);Qy({target:a,source:n,start:0,count:i}),this.buffer.write(a),this.bufferValue=t}return this.buffer}}});function tx(r){return typeof r=="number"?Number.isInteger(r):/^\d+$/.test(r)}var sl,rx=O(()=>{j();il();sd();sl=class extends zn{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,t){super(e,t),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,t.buffers&&this.setBuffers(t.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(Hy(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let t in e)this.setBuffer(t,e[t])})}setBuffer(e,t){let n=this._getVaryingIndex(e),{buffer:s,byteLength:i,byteOffset:o}=this._getBufferRange(t);if(n<0){this.unusedBuffers[e]=s,I.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[n]={buffer:s,byteLength:i,byteOffset:o},this.bindOnUse||this._bindBuffer(n,s,o,i)}getBuffer(e){if(tx(e))return this.buffers[e]||null;let t=this._getVaryingIndex(e);return t>=0?this.buffers[t]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let t;return this._bound?t=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,t=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),t}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof St)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:t,byteOffset:n=0,byteLength:s=e.buffer.byteLength}=e;return{buffer:t,byteOffset:n,byteLength:s}}_getVaryingIndex(e){if(tx(e))return Number(e);for(let t of this.layout.varyings||[])if(e===t.name)return t.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:t,byteLength:n,byteOffset:s}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),t,s,n)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,t,n=0,s){let i=t&&t.handle;!i||s===void 0?this.gl.bindBufferBase(35982,e,i):this.gl.bindBufferRange(35982,e,i,n,s)}}});var ol,nx=O(()=>{j();ol=class extends Wn{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,t){if(super(e,t),this.device=e,t.count>1)throw new Error("WebGL QuerySet can only have one value");let n=this.device.gl.createQuery();if(!n)throw new Error("WebGL query not supported");this.handle=n,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 t=0;return this._pollingPromise=new Promise((n,s)=>{let i=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):t++>e?(s("Timed out"),this._pollingPromise=null):requestAnimationFrame(i)};requestAnimationFrame(i)}),this._pollingPromise}}});function id(r){switch(r){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function sx(r){switch(r){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}var ix=O(()=>{});function ox(r){return TS[r]}var TS,ax=O(()=>{TS={[5124]:"sint32",[5125]:"uint32",[5122]:"sint16",[5123]:"uint16",[5120]:"sint8",[5121]:"uint8",[5126]:"float32",[5131]:"float16",[33635]:"uint16",[32819]:"uint16",[32820]:"uint16",[33640]:"uint32",[35899]:"uint32",[35902]:"uint32",[34042]:"uint32",[36269]:"uint32"}});function cx(r,e){let{sourceX:t=0,sourceY:n=0,sourceAttachment:s=0}=e||{},{target:i=null,sourceWidth:o,sourceHeight:a,sourceDepth:c,sourceFormat:l,sourceType:u}=e||{},{framebuffer:f,deleteFramebuffer:h}=ux(r),{gl:d,handle:g}=f;o||=f.width,a||=f.height;let y=f.colorAttachments[s]?.texture;if(!y)throw new Error(`Invalid framebuffer attachment ${s}`);c=y?.depth||1,l||=y?.glFormat||6408,u||=y?.glType||5121,i=vS(i,u,l,o,a,c);let _=$r(i);u=u||Fy(_);let b=d.bindFramebuffer(36160,g);return d.readBuffer(36064+s),d.readPixels(t,n,o,a,l,u,i),d.readBuffer(36064),d.bindFramebuffer(36160,b||null),h&&f.destroy(),i}function lx(r,e){let{target:t,sourceX:n=0,sourceY:s=0,sourceFormat:i=6408,targetByteOffset:o=0}=e||{},{sourceWidth:a,sourceHeight:c,sourceType:l}=e||{},{framebuffer:u,deleteFramebuffer:f}=ux(r);a=a||u.width,c=c||u.height;let h=u;l=l||5121;let d=t;if(!d){let y=id(i),_=sx(l),b=o+a*c*y*_;d=h.device.createBuffer({byteLength:b})}let g=r.device.createCommandEncoder();return g.copyTextureToBuffer({sourceTexture:r,width:a,height:c,origin:[n,s],destinationBuffer:d,byteOffset:o}),g.destroy(),f&&u.destroy(),d}function ux(r){return r instanceof It?{framebuffer:r,deleteFramebuffer:!1}:{framebuffer:wS(r),deleteFramebuffer:!0}}function wS(r,e){let{device:t,width:n,height:s,id:i}=r;return t.createFramebuffer({...e,id:`framebuffer-for-${i}`,width:n,height:s,colorAttachments:[r]})}function vS(r,e,t,n,s,i){if(r)return r;e||=5121;let o=ox(e),a=jr(o),c=id(t);return new a(n*s*c)}var fx=O(()=>{j();nd();ix();ax()});var od={};Ht(od,{WebGLDevice:()=>wn});function AS(r,e,t){switch(t.length){case 1:r.gl.vertexAttrib1fv(e,t);break;case 2:r.gl.vertexAttrib2fv(e,t);break;case 3:r.gl.vertexAttrib3fv(e,t);break;case 4:r.gl.vertexAttrib4fv(e,t);break;default:}}function SS(r,e,t){r.gl.vertexAttribI4iv(e,t)}function ES(r,e,t){r.gl.vertexAttribI4uiv(e,t)}function RS(r,e){if(!r||!e||r.length!==e.length||r.constructor!==e.constructor)return!1;for(let t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}var wn,al=O(()=>{j();Yh();hy();my();vy();Ay();Sy();zh();Wh();vs();Ry();Xc();My();Ny();Jc();jc();Yy();Gy();ex();rx();nx();fx();bs();Qc();so();wn=class extends Be{type="webgl";handle;features;limits;info;canvasContext;preferredColorFormat="rgba8unorm";preferredDepthFormat="depth24plus";commandEncoder;lost;_resolveContextLost;gl;_constants;_extensions={};_polyfilled=!1;spectorJS;get[Symbol.toStringTag](){return"WebGLDevice"}toString(){return`${this[Symbol.toStringTag]}(${this.id})`}isVertexFormatSupported(e){switch(e){case"unorm8x4-bgra":return!1;default:return!0}}constructor(e){super({...e,id:e.id||Ey("webgl-device")});let t=Be._getCanvasContextProps(e);if(!t)throw new Error("WebGLDevice requires props.createCanvasContext to be set");let n=t.canvas?.gl?.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new Hc(this,t),this.lost=new Promise(u=>{this._resolveContextLost=u});let s={...e.webgl};t.alphaMode==="premultiplied"&&(s.premultipliedAlpha=!0),e.powerPreference!==void 0&&(s.powerPreference=e.powerPreference);let o=this.props._handle||fy(this.canvasContext.canvas,{onContextLost:u=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:u=>console.log("WebGL context restored")},s);if(!o)throw new Error("WebGL context creation failed");if(n=o.device,n){if(e._reuseDevices)return I.log(1,`Not creating a new Device, instead returning a reference to Device ${n.id} already attached to WebGL context`,n)(),n._reused=!0,n;throw new Error(`WebGL context already attached to device ${n.id}`)}this.handle=o,this.gl=o,this.spectorJS=Z_({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=dy(this.gl,this._extensions),this.limits=new $c(this.gl),this.features=new Wc(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),new At(this.gl,{log:(...u)=>I.log(1,...u)()}).trackState(this.gl,{copyState:!1});let c=e.debugWebGL||e.debug,l=e.debugWebGL;c&&(this.gl=ey(this.gl,{debugWebGL:c,traceWebGL:l}),I.warn("WebGL debug mode activated. Performance reduced.")(),e.debugWebGL&&(I.level=Math.max(I.level,1))),this.commandEncoder=new ao(this,{id:`${this}-command-encoder`})}destroy(){!this.props._reuseDevices&&!this._reused&&delete this.gl.device}get isLost(){return this.gl.isContextLost()}getTextureByteAlignment(){return 4}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let t=this._normalizeBufferProps(e);return new St(this,t)}createTexture(e){return new Wt(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new Gc(this,e)}createShader(e){return new Yc(this,e)}createFramebuffer(e){return new Vt(this,e)}createVertexArray(e){return new As(this,e)}createTransformFeedback(e){return new sl(this,e)}createQuerySet(e){return new ol(this,e)}createRenderPipeline(e){return new tl(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}createCommandEncoder(e={}){return new ao(this,e)}submit(e){e||(e=this.commandEncoder.finish(),this.commandEncoder.destroy(),this.commandEncoder=this.createCommandEncoder({id:`${this.id}-default-encoder`})),e._executeCommands()}readPixelsToArrayWebGL(e,t){return cx(e,t)}readPixelsToBufferWebGL(e,t){return lx(e,t)}setParametersWebGL(e){vt(this.gl,e)}getParametersWebGL(e){return Lc(this.gl,e)}withParametersWebGL(e,t){return Lr(this.gl,e,t)}resetWebGL(){I.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),oy(this.gl)}_getDeviceSpecificTextureFormatCapabilities(e){return by(this.gl,e,this._extensions)}loseDevice(){let e=!1,n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(e=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){At.get(this.gl).push()}popState(){At.get(this.gl).pop()}getGLKey(e,t){let n=Number(e);for(let s in this.gl)if(this.gl[s]===n)return`GL.${s}`;return t?.emptyIfUnknown?"":String(e)}getGLKeys(e){let t={emptyIfUnknown:!0};return Object.entries(e).reduce((n,[s,i])=>(n[`${s}:${this.getGLKey(s,t)}`]=`${i}:${this.getGLKey(i,t)}`,n),{})}setConstantAttributeWebGL(e,t){let n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);let s=this._constants[e];switch(s&&RS(s,t)&&I.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=t,t.constructor){case Float32Array:AS(this,e,t);break;case Int32Array:SS(this,e,t);break;case Uint32Array:ES(this,e,t);break;default:throw new Error("constant")}}getExtension(e){return Ut(this.gl,e,this._extensions),this._extensions}_setWebGLDebugMetadata(e,t,n){e.luma=t;let s={props:n.spector,id:n.spector.id};e.__SPECTOR_Metadata=s}}});function IS(r){return typeof WebGL2RenderingContext<"u"&&r instanceof WebGL2RenderingContext?!0:Boolean(r&&Number.isFinite(r._version))}var cl,ad,co,hx=O(()=>{j();Y_();zh();Wh();cl=1,ad=class extends Vs{type="webgl";constructor(){super(),Be.defaultProps={...Be.defaultProps,...Bc}}enforceWebGL2(e){X_(e)}isSupported(){return typeof WebGL2RenderingContext<"u"}isDeviceHandle(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:(typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext&&I.warn("WebGL1 is not supported",e)(),!1)}async attach(e,t={}){let{WebGLDevice:n}=await Promise.resolve().then(()=>(al(),od));if(e instanceof n)return e;if(e?.device instanceof n)return e.device;if(!IS(e))throw new Error("Invalid WebGL2RenderingContext");let s=t.createCanvasContext===!0?{}:t.createCanvasContext;return new n({...t,_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1,...s}})}async create(e={}){let{WebGLDevice:t}=await Promise.resolve().then(()=>(al(),od));I.groupCollapsed(cl,"WebGLDevice created")();try{let n=[];(e.debugWebGL||e.debug)&&n.push(J_()),e.debugSpectorJS&&n.push(K_(e));let s=await Promise.allSettled(n);for(let a of s)a.status==="rejected"&&I.error(`Failed to initialize debug libraries ${a.reason}`)();let i=new t(e),o=`${i._reused?"Reusing":"Created"} device with WebGL2 ${i.props.debug?"debug ":""}context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return I.probe(cl,o)(),I.table(cl,i.info)(),i}finally{I.groupEnd(cl)()}}};co=new ad});var il=O(()=>{hx();al();Xc()});var kE={};Ht(kE,{AmbientLight:()=>ds,Attribute:()=>hr,AttributeManager:()=>vn,COORDINATE_SYSTEM:()=>Y,CompositeLayer:()=>Ux,Controller:()=>De,Deck:()=>ll,DeckGL:()=>Co,DeckRenderer:()=>xn,DirectionalLight:()=>sr,FirstPersonController:()=>Cn,FirstPersonView:()=>Wx,FirstPersonViewport:()=>In,FlyToInterpolator:()=>Io,Layer:()=>Tl,LayerExtension:()=>Xx,LayerManager:()=>gn,LightingEffect:()=>Or,LinearInterpolator:()=>Ae,MapController:()=>yn,MapView:()=>Mc,OPERATION:()=>h_,OrbitController:()=>Mn,OrbitView:()=>$x,OrbitViewport:()=>En,OrthographicController:()=>On,OrthographicView:()=>jx,OrthographicViewport:()=>Rn,PointLight:()=>_s,PostProcessEffect:()=>Hi,TRANSITION_EVENTS:()=>Ki,Tesselator:()=>Po,TransitionInterpolator:()=>lr,UNIT:()=>Pr,VERSION:()=>nc,View:()=>Ne,Viewport:()=>$e,WebMercatorViewport:()=>kr,Widget:()=>Fr,_CameraLight:()=>Wi,_Component:()=>Rs,_ComponentState:()=>An,_GlobeController:()=>kn,_GlobeView:()=>Hx,_GlobeViewport:()=>Sn,_LayersPass:()=>xt,_PickLayersPass:()=>ir,_SunLight:()=>$i,_applyStyles:()=>to,_compareProps:()=>yl,_count:()=>xl,_deepEqual:()=>le,_fillArray:()=>Ic,_flatten:()=>Dr,_memoize:()=>it,_mergeShaders:()=>bo,_registerLoggers:()=>rc,_removeStyles:()=>Dc,assert:()=>oe,color:()=>dh,createIterable:()=>Ss,fp64LowPart:()=>Nh,getShaderAssembler:()=>wc,gouraudMaterial:()=>ai,log:()=>H,phongMaterial:()=>ci,picking:()=>Oh,project:()=>Cr,project32:()=>Ah,shadow:()=>hs});var Nf={};Ht(Nf,{Buffer:()=>W,BufferTransform:()=>pt,CubeGeometry:()=>pi,Device:()=>Be,Framebuffer:()=>It,Geometry:()=>mt,GroupNode:()=>nn,Model:()=>Xe,ModelNode:()=>di,ScenegraphNode:()=>Ot,SphereGeometry:()=>mi,Texture:()=>K,TextureTransform:()=>fi,attachDevice:()=>V3,createDevice:()=>z3,enforceWebGL2:()=>W3,getSupportedAdapters:()=>L3,setDefaultDeviceProps:()=>U3,stats:()=>B3});j();j();var Hb=1,Xb=1,qr=class{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(e){let{delay:t=0,duration:n=Number.POSITIVE_INFINITY,rate:s=1,repeat:i=1}=e,o=Hb++,a={time:0,delay:t,duration:n,rate:s,repeat:i};return this._setChannelTime(a,this.time),this.channels.set(o,a),o}removeChannel(e){this.channels.delete(e);for(let[t,n]of this.animations)n.channel===e&&this.detachAnimation(t)}isFinished(e){let t=this.channels.get(e);return t===void 0?!1:this.time>=t.delay+t.duration*t.repeat}getTime(e){if(e===void 0)return this.time;let t=this.channels.get(e);return t===void 0?-1:t.time}setTime(e){this.time=Math.max(0,e);let t=this.channels.values();for(let s of t)this._setChannelTime(s,this.time);let n=this.animations.values();for(let s of n){let{animation:i,channel:o}=s;i.setTime(this.getTime(o))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(e,t){let n=Xb++;return this.animations.set(n,{animation:e,channel:t}),e.setTime(this.getTime(t)),n}detachAnimation(e){this.animations.delete(e)}update(e){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=e),this.setTime(this.time+(e-this.lastEngineTime)),this.lastEngineTime=e)}_setChannelTime(e,t){let n=t-e.delay,s=e.duration*e.repeat;n>=s?e.time=e.duration*e.rate:(e.time=Math.max(0,n)%e.duration,e.time*=e.rate)}};j();function Sp(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function Ep(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}Cs();var Yb=0,_u=class{device=null;canvas=null;props;animationProps=null;timeline=null;stats;cpuTime;gpuTime;frameRate;display;needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;_error=null;constructor(e){if(this.props={..._u.defaultAnimationLoopProps,...e},e=this.props,!e.device)throw new Error("No device provided");this.stats=e.stats||new Ke({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:e.autoResizeViewport}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null)}delete(){this.destroy()}reportError(e){this.props.onError(e),this._error=e}setNeedsRedraw(e){return this.needsRedraw=this.needsRedraw||e,this}setProps(e){return"autoResizeViewport"in e&&(this.props.autoResizeViewport=e.autoResizeViewport||!1),this}async start(){if(this._running)return this;this._running=!0;try{let e;return this._initialized||(this._initialized=!0,await this._initDevice(),this._initialize(),await this.props.onInitialize(this._getAnimationProps())),this._running?(e!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(e){let t=e instanceof Error?e:new Error("Unknown error");throw this.props.onError(t),t}}stop(){return this._running&&(this.animationProps&&!this._error&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost||this._error?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(e){return this.timeline=e,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(e=>{this._resolveNextFrame=e})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeViewport()}_setDisplay(e){this.display&&(this.display.destroy(),this.display.animationLoop=null),e&&(e.animationLoop=this),this.display=e}_requestAnimationFrame(){this._running&&(this._animationFrameId=Sp(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(Ep(this._animationFrameId),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(e){if(this.display){this.display._renderFrame(e);return}this.props.onRender(this._getAnimationProps()),this.device?.submit()}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeViewport()}_initializeAnimationProps(){let e=this.device?.getDefaultCanvasContext();if(!this.device||!e)throw new Error("loop");let t=e?.canvas,n=e.props.useDevicePixels;this.animationProps={animationLoop:this,device:this.device,canvasContext:e,canvas:t,useDevicePixels:n,timeline:this.timeline,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:e,height:t,aspect:n}=this._getSizeAndAspect();(e!==this.animationProps.width||t!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),n!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=e,this.animationProps.height=t,this.animationProps.aspect=n,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.getDefaultCanvasContext().canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let e=document.createElement("div");document.body.appendChild(e),e.style.position="relative";let t=document.createElement("div");t.style.position="absolute",t.style.left="10px",t.style.bottom="10px",t.style.width="300px",t.style.background="white",this.canvas instanceof HTMLCanvasElement&&e.appendChild(this.canvas),e.appendChild(t);let n=this.props.onAddHTML(t);n&&(t.innerHTML=n)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[e,t]=this.device?.getDefaultCanvasContext().getDevicePixelSize()||[1,1],n=1,s=this.device?.getDefaultCanvasContext().canvas;return s&&s.clientHeight?n=s.clientWidth/s.clientHeight:e>0&&t>0&&(n=e/t),{width:e,height:t,aspect:n}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_beginFrameTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()}_endFrameTimers(){this.cpuTime.timeEnd()}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(e){e instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[e.offsetX,e.offsetY])}_onMouseleave(e){this._getAnimationProps()._mousePosition=null}},jn=_u;L(jn,"defaultAnimationLoopProps",{device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:e=>console.error(e),stats:mr.stats.get(`animation-loop-${Yb++}`),autoResizeViewport:!1});j();function Jo(r,e){if(!r)throw new Error(e||"shadertools: assertion failed.")}var yu={number:{type:"number",validate(r,e){return Number.isFinite(r)&&typeof e=="object"&&(e.max===void 0||r<=e.max)&&(e.min===void 0||r>=e.min)}},array:{type:"array",validate(r,e){return Array.isArray(r)||ArrayBuffer.isView(r)}}};function Ip(r){let e={};for(let[t,n]of Object.entries(r))e[t]=qb(n);return e}function qb(r){let e=Rp(r);if(e!=="object")return{value:r,...yu[e],type:e};if(typeof r=="object")return r?r.type!==void 0?{...r,...yu[r.type],type:r.type}:r.value===void 0?{type:"object",value:r}:(e=Rp(r.value),{...r,...yu[e],type:e}):{type:"object",value:null};throw new Error("props")}function Rp(r){return Array.isArray(r)||ArrayBuffer.isView(r)?"array":typeof r}var Pp=`#ifdef MODULE_LOGDEPTH
19
19
  logdepth_adjustPosition(gl_Position);
20
20
  #endif
21
21
  `,Cp=`#ifdef MODULE_MATERIAL
@@ -858,7 +858,7 @@ ${t.source}`}),super(e,{id:t.id||xe("clip-space"),...t,vs:E3,vertexCount:4,geome
858
858
  } catch (error) {
859
859
  console.error(error);
860
860
  throw error;
861
- }`}function Lf(r,e=!0,t){let n=t||new Set;if(r){if(eg(r))n.add(r);else if(eg(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(e&&typeof r=="object")for(let s in r)Lf(r[s],e,n)}}return t===void 0?Array.from(n):[]}function eg(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}var Uf=()=>{},Ar=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&rt||typeof ns<"u"&&!rt}constructor(e){let{name:t,source:n,url:s}=e;ke(n||s),this.name=t,this.source=n,this.url=s,this.onMessage=Uf,this.onError=i=>console.log(i),this.worker=rt?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Uf,this.onError=Uf,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,t){t=t||Lf(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=`${e.message} in `),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=Qm({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},e.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},e.onmessageerror=t=>console.error(t),e}_createNodeWorker(){let e;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new ns(n,{eval:!1})}else if(this.source)e=new ns(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",t=>{this.onMessage(t)}),e.on("error",t=>{this.onError(t)}),e.on("exit",t=>{}),e}};var _i=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Ar.isSupported()}constructor(e){this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},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,t=(s,i,o)=>s.done(o),n=(s,i)=>s.error(i)){let s=new Promise(i=>(this.jobQueue.push({name:e,onMessage:t,onError:n,onStart:i}),this));return this._startQueuedJob(),await s}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});let n=new gi(t.name,e);e.onMessage=s=>t.onMessage(n,s.type,s.payload),e.onError=s=>t.onError(n,s),t.onStart(n);try{await n.result}catch(s){console.error(`Worker exception: ${s}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!rt||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 Ar({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Gm?this.maxMobileConcurrency:this.maxConcurrency}};var G3={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},on=class{props;workerPools=new Map;static isSupported(){return Ar.isSupported()}static getWorkerFarm(e={}){return on._workerFarm=on._workerFarm||new on({}),on._workerFarm.setProps(e),on._workerFarm}constructor(e){this.props={...G3},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 t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:t,source:n,url:s}=e,i=this.workerPools.get(t);return i||(i=new _i({name:t,source:n,url:s}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},Sr=on;L(Sr,"_workerFarm");function Vf(r,e={}){let t=e[r.id]||{},n=rt?`${r.id}-worker.js`:`${r.id}-worker-node.js`,s=t.workerUrl;if(!s&&r.id==="compression"&&(s=e.workerUrl),e._workerType==="test"&&(rt?s=`modules/${r.module}/dist/${n}`:s=`modules/${r.module}/src/workers/${r.id}-worker-node.ts`),!s){let i=r.version;i==="latest"&&(i=Km);let o=i?`@${i}`:"";s=`https://unpkg.com/@loaders.gl/${r.module}${o}/dist/${n}`}return ke(s),s}function zf(r,e=Ff){ke(r,"no worker provided");let t=r.version;return!(!e||!t)}function Wf(r,e){return!Sr.isSupported()||!rt&&!e?._nodeWorkers?!1:r.worker&&e?.worker}async function $f(r,e,t,n,s){let i=r.id,o=Vf(r,t),c=Sr.getWorkerFarm(t).getWorkerPool({name:i,url:o});t=JSON.parse(JSON.stringify(t)),n=JSON.parse(JSON.stringify(n||{}));let l=await c.startJob("process-on-worker",Q3.bind(null,s));return l.postMessage("process",{input:e,options:t,context:n}),await(await l.result).result}async function Q3(r,e,t,n){switch(t){case"done":e.done(n);break;case"error":e.error(new Error(n.error));break;case"process":let{id:s,input:i,options:o}=n;try{let a=await r(i,o);e.postMessage("done",{id:s,result:a})}catch(a){let c=a instanceof Error?a.message:"unknown error";e.postMessage("error",{id:s,error:c})}break;default:console.warn(`parse-with-worker unknown message ${t}`)}}function jf(r,e,t){if(t=t||r.byteLength,r.byteLength<t||e.byteLength<t)return!1;let n=new Uint8Array(r),s=new Uint8Array(e);for(let i=0;i<n.length;++i)if(n[i]!==s[i])return!1;return!0}function Hf(...r){return tg(r)}function tg(r){let e=r.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),t=e.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(t),s=0;for(let i of e)n.set(i,s),s+=i.byteLength;return n.buffer}async function Xf(r){let e=[];for await(let t of r)e.push(t);return Hf(...e)}var J3="",rg={};function Yf(r){for(let e in rg)if(r.startsWith(e)){let t=rg[e];r=r.replace(e,t)}return!r.startsWith("http://")&&!r.startsWith("https://")&&(r=`${J3}${r}`),r}function ng(r){return r&&typeof r=="object"&&r.isBuffer}function Xa(r){if(ng(r))return r;if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r))return r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);if(typeof r=="string"){let e=r;return new TextEncoder().encode(e).buffer}if(r&&typeof r=="object"&&r._toArrayBuffer)return r._toArrayBuffer();throw new Error("toArrayBuffer")}var an={};Ht(an,{dirname:()=>tw,filename:()=>ew,join:()=>rw,resolve:()=>nw});function sg(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let r=window.location?.pathname;return r?.slice(0,r.lastIndexOf("/")+1)||""}function ew(r){let e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(e+1):""}function tw(r){let e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(0,e):""}function rw(...r){let e="/";return r=r.map((t,n)=>(n&&(t=t.replace(new RegExp(`^${e}`),"")),n!==r.length-1&&(t=t.replace(new RegExp(`${e}$`),"")),t)),r.join(e)}function nw(...r){let e=[];for(let i=0;i<r.length;i++)e[i]=r[i];let t="",n=!1,s;for(let i=e.length-1;i>=-1&&!n;i--){let o;i>=0?o=e[i]:(s===void 0&&(s=sg()),o=s),o.length!==0&&(t=`${o}/${t}`,n=o.charCodeAt(0)===yi)}return t=sw(t,!n),n?`/${t}`:t.length>0?t:"."}var yi=47,qf=46;function sw(r,e){let t="",n=-1,s=0,i,o=!1;for(let a=0;a<=r.length;++a){if(a<r.length)i=r.charCodeAt(a);else{if(i===yi)break;i=yi}if(i===yi){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(t.length<2||!o||t.charCodeAt(t.length-1)!==qf||t.charCodeAt(t.length-2)!==qf){if(t.length>2){let c=t.length-1,l=c;for(;l>=0&&t.charCodeAt(l)!==yi;--l);if(l!==c){t=l===-1?"":t.slice(0,l),n=a,s=0,o=!1;continue}}else if(t.length===2||t.length===1){t="",n=a,s=0,o=!1;continue}}e&&(t.length>0?t+="/..":t="..",o=!0)}else{let c=r.slice(n+1,a);t.length>0?t+=`/${c}`:t=c,o=!1}n=a,s=0}else i===qf&&s!==-1?++s:s=-1}return t}var iw=r=>typeof r=="boolean",xi=r=>typeof r=="function",cn=r=>r!==null&&typeof r=="object",Kf=r=>cn(r)&&r.constructor==={}.constructor;var ig=r=>Boolean(r)&&typeof r[Symbol.iterator]=="function",og=r=>r&&typeof r[Symbol.asyncIterator]=="function";var nt=r=>typeof Response<"u"&&r instanceof Response||r&&r.arrayBuffer&&r.text&&r.json;var st=r=>typeof Blob<"u"&&r instanceof Blob,ag=r=>r&&typeof r=="object"&&r.isBuffer;var ow=r=>typeof ReadableStream<"u"&&r instanceof ReadableStream||cn(r)&&xi(r.tee)&&xi(r.cancel)&&xi(r.getReader);var aw=r=>cn(r)&&xi(r.read)&&xi(r.pipe)&&iw(r.readable),Ya=r=>ow(r)||aw(r);var qa=class extends Error{constructor(e,t){super(e),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response};var cw=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,lw=/^([-\w.]+\/[-\w.+]+)/;function Zf(r,e){return r.toLowerCase()===e.toLowerCase()}function cg(r){let e=lw.exec(r);return e?e[1]:r}function Gf(r){let e=cw.exec(r);return e?e[1]:""}var lg=/\?.*/;function ug(r){let e=r.match(lg);return e&&e[0]}function ss(r){return r.replace(lg,"")}function fg(r){if(r.length<50)return r;let e=r.slice(r.length-15);return`${r.substr(0,32)}...${e}`}function ln(r){return nt(r)?r.url:st(r)?r.name||"":typeof r=="string"?r:""}function bi(r){if(nt(r)){let e=r,t=e.headers.get("content-type")||"",n=ss(e.url);return cg(t)||Gf(n)}return st(r)?r.type||"":typeof r=="string"?Gf(r):""}function hg(r){return nt(r)?r.headers["content-length"]||-1:st(r)?r.size:typeof r=="string"?r.length:r instanceof ArrayBuffer||ArrayBuffer.isView(r)?r.byteLength:-1}async function Ka(r){if(nt(r))return r;let e={},t=hg(r);t>=0&&(e["content-length"]=String(t));let n=ln(r),s=bi(r);s&&(e["content-type"]=s);let i=await fw(r);i&&(e["x-first-bytes"]=i),typeof r=="string"&&(r=new TextEncoder().encode(r));let o=new Response(r,{headers:e});return Object.defineProperty(o,"url",{value:n}),o}async function dg(r){if(!r.ok)throw await uw(r)}async function uw(r){let e=fg(r.url),t=`Failed to fetch resource (${r.status}) ${r.statusText}: ${e}`;t=t.length>100?`${t.slice(0,100)}...`:t;let n={reason:r.statusText,url:r.url,response:r};try{let s=r.headers.get("Content-Type");n.reason=s?.includes("application/json")?await r.json():r.text()}catch{}return new qa(t,n)}async function fw(r){if(typeof r=="string")return`data:,${r.slice(0,5)}`;if(r instanceof Blob){let t=r.slice(0,5);return await new Promise(n=>{let s=new FileReader;s.onload=i=>n(i?.target?.result),s.readAsDataURL(t)})}if(r instanceof ArrayBuffer){let t=r.slice(0,5);return`data:base64,${hw(t)}`}return null}function hw(r){let e="",t=new Uint8Array(r);for(let n=0;n<t.byteLength;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function dw(r){return!pw(r)&&!mw(r)}function pw(r){return r.startsWith("http:")||r.startsWith("https:")}function mw(r){return r.startsWith("data:")}async function is(r,e){if(typeof r=="string"){let t=Yf(r);return dw(t)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(t,e):await fetch(t,e)}return await Ka(r)}Os();var Qf=new Fe({id:"loaders.gl"}),Za=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},Ga=class{console;constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}};var Jf={fetch:null,mimeType:void 0,nothrow:!1,log:new Ga,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:sn,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},pg={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 eh(){globalThis.loaders=globalThis.loaders||{};let{loaders:r}=globalThis;return r._state||(r._state={}),r._state}function th(){let r=eh();return r.globalOptions=r.globalOptions||{...Jf},r.globalOptions}function _g(r,e,t,n){return t=t||[],t=Array.isArray(t)?t:[t],gw(r,t),yw(e,r,n)}function gw(r,e){mg(r,null,Jf,pg,e);for(let t of e){let n=r&&r[t.id]||{},s=t.options&&t.options[t.id]||{},i=t.deprecatedOptions&&t.deprecatedOptions[t.id]||{};mg(n,t.id,s,i,e)}}function mg(r,e,t,n,s){let i=e||"Top level",o=e?`${e}.`:"";for(let a in r){let c=!e&&cn(r[a]),l=a==="baseUri"&&!e,u=a==="workerUrl"&&e;if(!(a in t)&&!l&&!u){if(a in n)Qf.warn(`${i} loader option '${o}${a}' no longer supported, use '${n[a]}'`)();else if(!c){let f=_w(a,s);Qf.warn(`${i} loader option '${o}${a}' not recognized. ${f}`)()}}}}function _w(r,e){let t=r.toLowerCase(),n="";for(let s of e)for(let i in s.options){if(r===i)return`Did you mean '${s.id}.${i}'?`;let o=i.toLowerCase();(t.startsWith(o)||o.startsWith(t))&&(n=n||`Did you mean '${s.id}.${i}'?`)}return n}function yw(r,e,t){let s={...r.options||{}};return xw(s,t),s.log===null&&(s.log=new Za),gg(s,th()),gg(s,e),s}function gg(r,e){for(let t in e)if(t in e){let n=e[t];Kf(n)&&Kf(r[t])?r[t]={...r[t],...e[t]}:r[t]=e[t]}}function xw(r,e){e&&!("baseUri"in r)&&(r.baseUri=e)}function Ti(r){return r?(Array.isArray(r)&&(r=r[0]),Array.isArray(r?.extensions)):!1}function wi(r){vr(r,"null loader"),vr(Ti(r),"invalid loader");let e;return Array.isArray(r)&&(e=r[1],r=r[0],r={...r,options:{...r.options,...e}}),(r?.parseTextSync||r?.parseText)&&(r.text=!0),r.text||(r.binary=!0),r}var yg=()=>{let r=eh();return r.loaderRegistry=r.loaderRegistry||[],r.loaderRegistry};function vi(r){let e=yg();r=Array.isArray(r)?r:[r];for(let t of r){let n=wi(t);e.find(s=>n===s)||e.unshift(n)}}function xg(){return yg()}Os();var bg=new Fe({id:"loaders.gl"});var bw=/\.([^.]+)$/;async function vg(r,e=[],t,n){if(!Ag(r))return null;let s=Tg(r,e,{...t,nothrow:!0},n);if(s)return s;if(st(r)&&(r=await r.slice(0,10).arrayBuffer(),s=Tg(r,e,t,n)),!s&&!t?.nothrow)throw new Error(Sg(r));return s}function Tg(r,e=[],t,n){if(!Ag(r))return null;if(e&&!Array.isArray(e))return wi(e);let s=[];e&&(s=s.concat(e)),t?.ignoreRegisteredLoaders||s.push(...xg()),ww(s);let i=Tw(r,s,t,n);if(!i&&!t?.nothrow)throw new Error(Sg(r));return i}function Tw(r,e,t,n){let s=ln(r),i=bi(r),o=ss(s)||n?.url,a=null,c="";return t?.mimeType&&(a=rh(e,t?.mimeType),c=`match forced by supplied MIME type ${t?.mimeType}`),a=a||vw(e,o),c=c||(a?`matched url ${o}`:""),a=a||rh(e,i),c=c||(a?`matched MIME type ${i}`:""),a=a||Sw(e,r),c=c||(a?`matched initial data ${Eg(r)}`:""),t?.fallbackMimeType&&(a=a||rh(e,t?.fallbackMimeType),c=c||(a?`matched fallback MIME type ${i}`:"")),c&&bg.log(1,`selectLoader selected ${a?.name}: ${c}.`),a}function Ag(r){return!(r instanceof Response&&r.status===204)}function Sg(r){let e=ln(r),t=bi(r),n="No valid loader found (";n+=e?`${an.filename(e)}, `:"no url provided, ",n+=`MIME type: ${t?`"${t}"`:"not provided"}, `;let s=r?Eg(r):"";return n+=s?` first bytes: "${s}"`:"first bytes: not available",n+=")",n}function ww(r){for(let e of r)wi(e)}function vw(r,e){let t=e&&bw.exec(e),n=t&&t[1];return n?Aw(r,n):null}function Aw(r,e){e=e.toLowerCase();for(let t of r)for(let n of t.extensions)if(n.toLowerCase()===e)return t;return null}function rh(r,e){for(let t of r)if(t.mimeTypes?.some(n=>Zf(e,n))||Zf(e,`application/x.${t.id}`))return t;return null}function Sw(r,e){if(!e)return null;for(let t of r)if(typeof e=="string"){if(Ew(e,t))return t}else if(ArrayBuffer.isView(e)){if(wg(e.buffer,e.byteOffset,t))return t}else if(e instanceof ArrayBuffer&&wg(e,0,t))return t;return null}function Ew(r,e){return e.testText?e.testText(r):(Array.isArray(e.tests)?e.tests:[e.tests]).some(n=>r.startsWith(n))}function wg(r,e,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(s=>Rw(r,e,t,s))}function Rw(r,e,t,n){if(n instanceof ArrayBuffer)return jf(n,r,n.byteLength);switch(typeof n){case"function":return n(r);case"string":let s=nh(r,e,n.length);return n===s;default:return!1}}function Eg(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?nh(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?nh(r,0,e):""}function nh(r,e,t){if(r.byteLength<e+t)return"";let n=new DataView(r),s="";for(let i=0;i<t;i++)s+=String.fromCharCode(n.getUint8(e+i));return s}function*Rg(r,e){let t=e?.chunkSize||262144,n=0,s=new TextEncoder;for(;n<r.length;){let i=Math.min(r.length-n,t),o=r.slice(n,n+i);n+=i,yield s.encode(o)}}function*Ig(r,e={}){let{chunkSize:t=262144}=e,n=0;for(;n<r.byteLength;){let s=Math.min(r.byteLength-n,t),i=new ArrayBuffer(s),o=new Uint8Array(r,n,s);new Uint8Array(i).set(o),n+=s,yield i}}async function*Pg(r,e){let t=e?.chunkSize||1048576,n=0;for(;n<r.size;){let s=n+t,i=await r.slice(n,s).arrayBuffer();n=s,yield i}}function sh(r,e){return sn?Iw(r,e):Pw(r,e)}async function*Iw(r,e){let t=r.getReader(),n;try{for(;;){let s=n||t.read();e?._streamReadAhead&&(n=t.read());let{done:i,value:o}=await s;if(i)return;yield Xa(o)}}catch{t.releaseLock()}}async function*Pw(r,e){for await(let t of r)yield Xa(t)}function Cg(r,e){if(typeof r=="string")return Rg(r,e);if(r instanceof ArrayBuffer)return Ig(r,e);if(st(r))return Pg(r,e);if(Ya(r))return sh(r,e);if(nt(r))return sh(r.body,e);throw new Error("makeIterator")}var Mg="Cannot convert supplied data type";function Cw(r,e,t){if(e.text&&typeof r=="string")return r;if(ag(r)&&(r=r.buffer),r instanceof ArrayBuffer){let n=r;return e.text&&!e.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(r)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(r);let n=r.buffer,s=r.byteLength||r.length;return(r.byteOffset!==0||s!==n.byteLength)&&(n=n.slice(r.byteOffset,r.byteOffset+s)),n}throw new Error(Mg)}async function Og(r,e,t){let n=r instanceof ArrayBuffer||ArrayBuffer.isView(r);if(typeof r=="string"||n)return Cw(r,e,t);if(st(r)&&(r=await Ka(r)),nt(r)){let s=r;return await dg(s),e.binary?await s.arrayBuffer():await s.text()}if(Ya(r)&&(r=Cg(r,t)),ig(r)||og(r))return Xf(r);throw new Error(Mg)}function Qa(r,e){let t=th(),n=r||t;return typeof n.fetch=="function"?n.fetch:cn(n.fetch)?s=>is(s,n.fetch):e?.fetch?e?.fetch:is}function kg(r,e,t){if(t)return t;let n={fetch:Qa(e,r),...r};if(n.url){let s=ss(n.url);n.baseUrl=s,n.queryString=ug(n.url),n.filename=an.filename(s),n.baseUrl=an.dirname(s)}return Array.isArray(n.loaders)||(n.loaders=null),n}function Ng(r,e){if(r&&!Array.isArray(r))return r;let t;if(r&&(t=Array.isArray(r)?r:[r]),e&&e.loaders){let n=Array.isArray(e.loaders)?e.loaders:[e.loaders];t=t?[...t,...n]:n}return t&&t.length?t:void 0}async function Er(r,e,t,n){e&&!Array.isArray(e)&&!Ti(e)&&(n=void 0,t=e,e=void 0),r=await r,t=t||{};let s=ln(r),o=Ng(e,n),a=await vg(r,o,t);return a?(t=_g(t,a,o,s),n=kg({url:s,_parse:Er,loaders:o},t,n||null),await Mw(a,r,t,n)):null}async function Mw(r,e,t,n){if(zf(r),t=Df(r.options,t),nt(e)){let i=e,{ok:o,redirected:a,status:c,statusText:l,type:u,url:f}=i,h=Object.fromEntries(i.headers.entries());n.response={headers:h,ok:o,redirected:a,status:c,statusText:l,type:u,url:f}}e=await Og(e,r,t);let s=r;if(s.parseTextSync&&typeof e=="string")return s.parseTextSync(e,t,n);if(Wf(r,t))return await $f(r,e,t,n,Er);if(s.parseText&&typeof e=="string")return await s.parseText(e,t,n);if(s.parse)return await s.parse(e,t,n);throw ke(!s.parseSync),new Error(`${r.id} loader - no parser found and worker is disabled`)}async function Rr(r,e,t,n){let s,i;!Array.isArray(e)&&!Ti(e)?(s=[],i=e,n=void 0):(s=e,i=t);let o=Qa(i),a=r;return typeof r=="string"&&(a=await o(r)),st(r)&&(a=await o(r)),Array.isArray(s)?await Er(a,s,i):await Er(a,s,i)}var Dg="4.2.1";var Ow=globalThis.loaders?.parseImageNode,oh=typeof Image<"u",ah=typeof ImageBitmap<"u",kw=Boolean(Ow),ch=sn?!0:kw;function Fg(r){switch(r){case"auto":return ah||oh||ch;case"imagebitmap":return ah;case"image":return oh;case"data":return ch;default:throw new Error(`@loaders.gl/images: image ${r} not supported in this environment`)}}function Bg(){if(ah)return"imagebitmap";if(oh)return"image";if(ch)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Nw(r){let e=Dw(r);if(!e)throw new Error("Not an image");return e}function Lg(r){switch(Nw(r)){case"data":return r;case"image":case"imagebitmap":let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)throw new Error("getImageData");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0),t.getImageData(0,0,r.width,r.height);default:throw new Error("getImageData")}}function Dw(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&r instanceof Image?"image":r&&typeof r=="object"&&r.data&&r.width&&r.height?"data":null}var Fw=/^data:image\/svg\+xml/,Bw=/\.svg((\?|#).*)?$/;function Ja(r){return r&&(Fw.test(r)||Bw.test(r))}function Ug(r,e){if(Ja(e)){let n=new TextDecoder().decode(r);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return lh(r,e)}function lh(r,e){if(Ja(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(r)])}async function ec(r,e,t){let n=Ug(r,t),s=self.URL||self.webkitURL,i=typeof n!="string"&&s.createObjectURL(n);try{return await Lw(i||n,e)}finally{i&&s.revokeObjectURL(i)}}async function Lw(r,e){let t=new Image;return t.src=r,e.image&&e.image.decode&&t.decode?(await t.decode(),t):await new Promise((n,s)=>{try{t.onload=()=>n(t),t.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var Uw={},Vg=!0;async function zg(r,e,t){let n;Ja(t)?n=await ec(r,e,t):n=lh(r,t);let s=e&&e.imagebitmap;return await Vw(n,s)}async function Vw(r,e=null){if((zw(e)||!Vg)&&(e=null),e)try{return await createImageBitmap(r,e)}catch(t){console.warn(t),Vg=!1}return await createImageBitmap(r)}function zw(r){for(let e in r||Uw)return!1;return!0}function Wg(r){return!Hw(r,"ftyp",4)||!(r[8]&96)?null:Ww(r)}function Ww(r){switch($w(r,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function $w(r,e,t){return String.fromCharCode(...r.slice(e,t))}function jw(r){return[...r].map(e=>e.charCodeAt(0))}function Hw(r,e,t=0){let n=jw(e);for(let s=0;s<n.length;++s)if(n[s]!==r[s+t])return!1;return!0}var Dt=!1,Ai=!0;function tc(r){let e=Si(r);return Yw(e)||Zw(e)||qw(e)||Kw(e)||Xw(e)}function Xw(r){let e=new Uint8Array(r instanceof DataView?r.buffer:r),t=Wg(e);return t?{mimeType:t.mimeType,width:0,height:0}:null}function Yw(r){let e=Si(r);return e.byteLength>=24&&e.getUint32(0,Dt)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Dt),height:e.getUint32(20,Dt)}:null}function qw(r){let e=Si(r);return e.byteLength>=10&&e.getUint32(0,Dt)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,Ai),height:e.getUint16(8,Ai)}:null}function Kw(r){let e=Si(r);return e.byteLength>=14&&e.getUint16(0,Dt)===16973&&e.getUint32(2,Ai)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Ai),height:e.getUint32(22,Ai)}:null}function Zw(r){let e=Si(r);if(!(e.byteLength>=3&&e.getUint16(0,Dt)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=Gw(),i=2;for(;i+9<e.byteLength;){let o=e.getUint16(i,Dt);if(s.has(o))return{mimeType:"image/jpeg",height:e.getUint16(i+5,Dt),width:e.getUint16(i+7,Dt)};if(!n.has(o))return null;i+=2,i+=e.getUint16(i,Dt)}return null}function Gw(){let r=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)r.add(t);return{tableMarkers:r,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Si(r){if(r instanceof DataView)return r;if(ArrayBuffer.isView(r))return new DataView(r.buffer);if(r instanceof ArrayBuffer)return new DataView(r);throw new Error("toDataView")}async function $g(r,e){let{mimeType:t}=tc(r)||{},n=globalThis.loaders?.parseImageNode;return vr(n),await n(r,t)}async function jg(r,e,t){e=e||{};let s=(e.image||{}).type||"auto",{url:i}=t||{},o=Qw(s),a;switch(o){case"imagebitmap":a=await zg(r,e,i);break;case"image":a=await ec(r,e,i);break;case"data":a=await $g(r,e);break;default:vr(!1)}return s==="data"&&(a=Lg(a)),a}function Qw(r){switch(r){case"auto":case"data":return Bg();default:return Fg(r),r}}var Jw=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],e2=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],t2={image:{type:"auto",decode:!0}},uh={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Dg,mimeTypes:e2,extensions:Jw,parse:jg,tests:[r=>Boolean(tc(new DataView(r)))],options:t2};Os();var r2=new Fe({id:"deck"}),H=r2;var fh={};function rc(r){fh=r}function he(r,e,t,n){H.level>0&&fh[r]&&fh[r].call(null,e,t,n)}function n2(r){let e=r[0],t=r[r.length-1];return e==="{"&&t==="}"||e==="["&&t==="]"}var Hg={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:n2,parseTextSync:JSON.parse};function s2(){let r="9.2.0-beta.2",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==r)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${r}`);return e||(H.log(1,`deck.gl ${r}`)(),globalThis.deck={...globalThis.deck,VERSION:r,version:r,log:H,_registerLoggers:rc},vi([Hg,[uh,{imagebitmap:{premultiplyAlpha:"none"}}]])),r}var nc=s2();var Xg=`uniform layerUniforms {
861
+ }`}function Lf(r,e=!0,t){let n=t||new Set;if(r){if(eg(r))n.add(r);else if(eg(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(e&&typeof r=="object")for(let s in r)Lf(r[s],e,n)}}return t===void 0?Array.from(n):[]}function eg(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}var Uf=()=>{},Ar=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&rt||typeof ns<"u"&&!rt}constructor(e){let{name:t,source:n,url:s}=e;ke(n||s),this.name=t,this.source=n,this.url=s,this.onMessage=Uf,this.onError=i=>console.log(i),this.worker=rt?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Uf,this.onError=Uf,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,t){t=t||Lf(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=`${e.message} in `),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=Qm({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},e.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},e.onmessageerror=t=>console.error(t),e}_createNodeWorker(){let e;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new ns(n,{eval:!1})}else if(this.source)e=new ns(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",t=>{this.onMessage(t)}),e.on("error",t=>{this.onError(t)}),e.on("exit",t=>{}),e}};var _i=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Ar.isSupported()}constructor(e){this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},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,t=(s,i,o)=>s.done(o),n=(s,i)=>s.error(i)){let s=new Promise(i=>(this.jobQueue.push({name:e,onMessage:t,onError:n,onStart:i}),this));return this._startQueuedJob(),await s}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});let n=new gi(t.name,e);e.onMessage=s=>t.onMessage(n,s.type,s.payload),e.onError=s=>t.onError(n,s),t.onStart(n);try{await n.result}catch(s){console.error(`Worker exception: ${s}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!rt||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 Ar({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Gm?this.maxMobileConcurrency:this.maxConcurrency}};var G3={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},on=class{props;workerPools=new Map;static isSupported(){return Ar.isSupported()}static getWorkerFarm(e={}){return on._workerFarm=on._workerFarm||new on({}),on._workerFarm.setProps(e),on._workerFarm}constructor(e){this.props={...G3},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 t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:t,source:n,url:s}=e,i=this.workerPools.get(t);return i||(i=new _i({name:t,source:n,url:s}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},Sr=on;L(Sr,"_workerFarm");function Vf(r,e={}){let t=e[r.id]||{},n=rt?`${r.id}-worker.js`:`${r.id}-worker-node.js`,s=t.workerUrl;if(!s&&r.id==="compression"&&(s=e.workerUrl),e._workerType==="test"&&(rt?s=`modules/${r.module}/dist/${n}`:s=`modules/${r.module}/src/workers/${r.id}-worker-node.ts`),!s){let i=r.version;i==="latest"&&(i=Km);let o=i?`@${i}`:"";s=`https://unpkg.com/@loaders.gl/${r.module}${o}/dist/${n}`}return ke(s),s}function zf(r,e=Ff){ke(r,"no worker provided");let t=r.version;return!(!e||!t)}function Wf(r,e){return!Sr.isSupported()||!rt&&!e?._nodeWorkers?!1:r.worker&&e?.worker}async function $f(r,e,t,n,s){let i=r.id,o=Vf(r,t),c=Sr.getWorkerFarm(t).getWorkerPool({name:i,url:o});t=JSON.parse(JSON.stringify(t)),n=JSON.parse(JSON.stringify(n||{}));let l=await c.startJob("process-on-worker",Q3.bind(null,s));return l.postMessage("process",{input:e,options:t,context:n}),await(await l.result).result}async function Q3(r,e,t,n){switch(t){case"done":e.done(n);break;case"error":e.error(new Error(n.error));break;case"process":let{id:s,input:i,options:o}=n;try{let a=await r(i,o);e.postMessage("done",{id:s,result:a})}catch(a){let c=a instanceof Error?a.message:"unknown error";e.postMessage("error",{id:s,error:c})}break;default:console.warn(`parse-with-worker unknown message ${t}`)}}function jf(r,e,t){if(t=t||r.byteLength,r.byteLength<t||e.byteLength<t)return!1;let n=new Uint8Array(r),s=new Uint8Array(e);for(let i=0;i<n.length;++i)if(n[i]!==s[i])return!1;return!0}function Hf(...r){return tg(r)}function tg(r){let e=r.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),t=e.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(t),s=0;for(let i of e)n.set(i,s),s+=i.byteLength;return n.buffer}async function Xf(r){let e=[];for await(let t of r)e.push(t);return Hf(...e)}var J3="",rg={};function Yf(r){for(let e in rg)if(r.startsWith(e)){let t=rg[e];r=r.replace(e,t)}return!r.startsWith("http://")&&!r.startsWith("https://")&&(r=`${J3}${r}`),r}function ng(r){return r&&typeof r=="object"&&r.isBuffer}function Xa(r){if(ng(r))return r;if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r))return r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);if(typeof r=="string"){let e=r;return new TextEncoder().encode(e).buffer}if(r&&typeof r=="object"&&r._toArrayBuffer)return r._toArrayBuffer();throw new Error("toArrayBuffer")}var an={};Ht(an,{dirname:()=>tw,filename:()=>ew,join:()=>rw,resolve:()=>nw});function sg(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let r=window.location?.pathname;return r?.slice(0,r.lastIndexOf("/")+1)||""}function ew(r){let e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(e+1):""}function tw(r){let e=r?r.lastIndexOf("/"):-1;return e>=0?r.substr(0,e):""}function rw(...r){let e="/";return r=r.map((t,n)=>(n&&(t=t.replace(new RegExp(`^${e}`),"")),n!==r.length-1&&(t=t.replace(new RegExp(`${e}$`),"")),t)),r.join(e)}function nw(...r){let e=[];for(let i=0;i<r.length;i++)e[i]=r[i];let t="",n=!1,s;for(let i=e.length-1;i>=-1&&!n;i--){let o;i>=0?o=e[i]:(s===void 0&&(s=sg()),o=s),o.length!==0&&(t=`${o}/${t}`,n=o.charCodeAt(0)===yi)}return t=sw(t,!n),n?`/${t}`:t.length>0?t:"."}var yi=47,qf=46;function sw(r,e){let t="",n=-1,s=0,i,o=!1;for(let a=0;a<=r.length;++a){if(a<r.length)i=r.charCodeAt(a);else{if(i===yi)break;i=yi}if(i===yi){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(t.length<2||!o||t.charCodeAt(t.length-1)!==qf||t.charCodeAt(t.length-2)!==qf){if(t.length>2){let c=t.length-1,l=c;for(;l>=0&&t.charCodeAt(l)!==yi;--l);if(l!==c){t=l===-1?"":t.slice(0,l),n=a,s=0,o=!1;continue}}else if(t.length===2||t.length===1){t="",n=a,s=0,o=!1;continue}}e&&(t.length>0?t+="/..":t="..",o=!0)}else{let c=r.slice(n+1,a);t.length>0?t+=`/${c}`:t=c,o=!1}n=a,s=0}else i===qf&&s!==-1?++s:s=-1}return t}var iw=r=>typeof r=="boolean",xi=r=>typeof r=="function",cn=r=>r!==null&&typeof r=="object",Kf=r=>cn(r)&&r.constructor==={}.constructor;var ig=r=>Boolean(r)&&typeof r[Symbol.iterator]=="function",og=r=>r&&typeof r[Symbol.asyncIterator]=="function";var nt=r=>typeof Response<"u"&&r instanceof Response||r&&r.arrayBuffer&&r.text&&r.json;var st=r=>typeof Blob<"u"&&r instanceof Blob,ag=r=>r&&typeof r=="object"&&r.isBuffer;var ow=r=>typeof ReadableStream<"u"&&r instanceof ReadableStream||cn(r)&&xi(r.tee)&&xi(r.cancel)&&xi(r.getReader);var aw=r=>cn(r)&&xi(r.read)&&xi(r.pipe)&&iw(r.readable),Ya=r=>ow(r)||aw(r);var qa=class extends Error{constructor(e,t){super(e),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response};var cw=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,lw=/^([-\w.]+\/[-\w.+]+)/;function Zf(r,e){return r.toLowerCase()===e.toLowerCase()}function cg(r){let e=lw.exec(r);return e?e[1]:r}function Gf(r){let e=cw.exec(r);return e?e[1]:""}var lg=/\?.*/;function ug(r){let e=r.match(lg);return e&&e[0]}function ss(r){return r.replace(lg,"")}function fg(r){if(r.length<50)return r;let e=r.slice(r.length-15);return`${r.substr(0,32)}...${e}`}function ln(r){return nt(r)?r.url:st(r)?r.name||"":typeof r=="string"?r:""}function bi(r){if(nt(r)){let e=r,t=e.headers.get("content-type")||"",n=ss(e.url);return cg(t)||Gf(n)}return st(r)?r.type||"":typeof r=="string"?Gf(r):""}function hg(r){return nt(r)?r.headers["content-length"]||-1:st(r)?r.size:typeof r=="string"?r.length:r instanceof ArrayBuffer||ArrayBuffer.isView(r)?r.byteLength:-1}async function Ka(r){if(nt(r))return r;let e={},t=hg(r);t>=0&&(e["content-length"]=String(t));let n=ln(r),s=bi(r);s&&(e["content-type"]=s);let i=await fw(r);i&&(e["x-first-bytes"]=i),typeof r=="string"&&(r=new TextEncoder().encode(r));let o=new Response(r,{headers:e});return Object.defineProperty(o,"url",{value:n}),o}async function dg(r){if(!r.ok)throw await uw(r)}async function uw(r){let e=fg(r.url),t=`Failed to fetch resource (${r.status}) ${r.statusText}: ${e}`;t=t.length>100?`${t.slice(0,100)}...`:t;let n={reason:r.statusText,url:r.url,response:r};try{let s=r.headers.get("Content-Type");n.reason=s?.includes("application/json")?await r.json():r.text()}catch{}return new qa(t,n)}async function fw(r){if(typeof r=="string")return`data:,${r.slice(0,5)}`;if(r instanceof Blob){let t=r.slice(0,5);return await new Promise(n=>{let s=new FileReader;s.onload=i=>n(i?.target?.result),s.readAsDataURL(t)})}if(r instanceof ArrayBuffer){let t=r.slice(0,5);return`data:base64,${hw(t)}`}return null}function hw(r){let e="",t=new Uint8Array(r);for(let n=0;n<t.byteLength;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function dw(r){return!pw(r)&&!mw(r)}function pw(r){return r.startsWith("http:")||r.startsWith("https:")}function mw(r){return r.startsWith("data:")}async function is(r,e){if(typeof r=="string"){let t=Yf(r);return dw(t)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(t,e):await fetch(t,e)}return await Ka(r)}Os();var Qf=new Fe({id:"loaders.gl"}),Za=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},Ga=class{console;constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}};var Jf={fetch:null,mimeType:void 0,nothrow:!1,log:new Ga,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:sn,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},pg={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 eh(){globalThis.loaders=globalThis.loaders||{};let{loaders:r}=globalThis;return r._state||(r._state={}),r._state}function th(){let r=eh();return r.globalOptions=r.globalOptions||{...Jf},r.globalOptions}function _g(r,e,t,n){return t=t||[],t=Array.isArray(t)?t:[t],gw(r,t),yw(e,r,n)}function gw(r,e){mg(r,null,Jf,pg,e);for(let t of e){let n=r&&r[t.id]||{},s=t.options&&t.options[t.id]||{},i=t.deprecatedOptions&&t.deprecatedOptions[t.id]||{};mg(n,t.id,s,i,e)}}function mg(r,e,t,n,s){let i=e||"Top level",o=e?`${e}.`:"";for(let a in r){let c=!e&&cn(r[a]),l=a==="baseUri"&&!e,u=a==="workerUrl"&&e;if(!(a in t)&&!l&&!u){if(a in n)Qf.warn(`${i} loader option '${o}${a}' no longer supported, use '${n[a]}'`)();else if(!c){let f=_w(a,s);Qf.warn(`${i} loader option '${o}${a}' not recognized. ${f}`)()}}}}function _w(r,e){let t=r.toLowerCase(),n="";for(let s of e)for(let i in s.options){if(r===i)return`Did you mean '${s.id}.${i}'?`;let o=i.toLowerCase();(t.startsWith(o)||o.startsWith(t))&&(n=n||`Did you mean '${s.id}.${i}'?`)}return n}function yw(r,e,t){let s={...r.options||{}};return xw(s,t),s.log===null&&(s.log=new Za),gg(s,th()),gg(s,e),s}function gg(r,e){for(let t in e)if(t in e){let n=e[t];Kf(n)&&Kf(r[t])?r[t]={...r[t],...e[t]}:r[t]=e[t]}}function xw(r,e){e&&!("baseUri"in r)&&(r.baseUri=e)}function Ti(r){return r?(Array.isArray(r)&&(r=r[0]),Array.isArray(r?.extensions)):!1}function wi(r){vr(r,"null loader"),vr(Ti(r),"invalid loader");let e;return Array.isArray(r)&&(e=r[1],r=r[0],r={...r,options:{...r.options,...e}}),(r?.parseTextSync||r?.parseText)&&(r.text=!0),r.text||(r.binary=!0),r}var yg=()=>{let r=eh();return r.loaderRegistry=r.loaderRegistry||[],r.loaderRegistry};function vi(r){let e=yg();r=Array.isArray(r)?r:[r];for(let t of r){let n=wi(t);e.find(s=>n===s)||e.unshift(n)}}function xg(){return yg()}Os();var bg=new Fe({id:"loaders.gl"});var bw=/\.([^.]+)$/;async function vg(r,e=[],t,n){if(!Ag(r))return null;let s=Tg(r,e,{...t,nothrow:!0},n);if(s)return s;if(st(r)&&(r=await r.slice(0,10).arrayBuffer(),s=Tg(r,e,t,n)),!s&&!t?.nothrow)throw new Error(Sg(r));return s}function Tg(r,e=[],t,n){if(!Ag(r))return null;if(e&&!Array.isArray(e))return wi(e);let s=[];e&&(s=s.concat(e)),t?.ignoreRegisteredLoaders||s.push(...xg()),ww(s);let i=Tw(r,s,t,n);if(!i&&!t?.nothrow)throw new Error(Sg(r));return i}function Tw(r,e,t,n){let s=ln(r),i=bi(r),o=ss(s)||n?.url,a=null,c="";return t?.mimeType&&(a=rh(e,t?.mimeType),c=`match forced by supplied MIME type ${t?.mimeType}`),a=a||vw(e,o),c=c||(a?`matched url ${o}`:""),a=a||rh(e,i),c=c||(a?`matched MIME type ${i}`:""),a=a||Sw(e,r),c=c||(a?`matched initial data ${Eg(r)}`:""),t?.fallbackMimeType&&(a=a||rh(e,t?.fallbackMimeType),c=c||(a?`matched fallback MIME type ${i}`:"")),c&&bg.log(1,`selectLoader selected ${a?.name}: ${c}.`),a}function Ag(r){return!(r instanceof Response&&r.status===204)}function Sg(r){let e=ln(r),t=bi(r),n="No valid loader found (";n+=e?`${an.filename(e)}, `:"no url provided, ",n+=`MIME type: ${t?`"${t}"`:"not provided"}, `;let s=r?Eg(r):"";return n+=s?` first bytes: "${s}"`:"first bytes: not available",n+=")",n}function ww(r){for(let e of r)wi(e)}function vw(r,e){let t=e&&bw.exec(e),n=t&&t[1];return n?Aw(r,n):null}function Aw(r,e){e=e.toLowerCase();for(let t of r)for(let n of t.extensions)if(n.toLowerCase()===e)return t;return null}function rh(r,e){for(let t of r)if(t.mimeTypes?.some(n=>Zf(e,n))||Zf(e,`application/x.${t.id}`))return t;return null}function Sw(r,e){if(!e)return null;for(let t of r)if(typeof e=="string"){if(Ew(e,t))return t}else if(ArrayBuffer.isView(e)){if(wg(e.buffer,e.byteOffset,t))return t}else if(e instanceof ArrayBuffer&&wg(e,0,t))return t;return null}function Ew(r,e){return e.testText?e.testText(r):(Array.isArray(e.tests)?e.tests:[e.tests]).some(n=>r.startsWith(n))}function wg(r,e,t){return(Array.isArray(t.tests)?t.tests:[t.tests]).some(s=>Rw(r,e,t,s))}function Rw(r,e,t,n){if(n instanceof ArrayBuffer)return jf(n,r,n.byteLength);switch(typeof n){case"function":return n(r);case"string":let s=nh(r,e,n.length);return n===s;default:return!1}}function Eg(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?nh(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?nh(r,0,e):""}function nh(r,e,t){if(r.byteLength<e+t)return"";let n=new DataView(r),s="";for(let i=0;i<t;i++)s+=String.fromCharCode(n.getUint8(e+i));return s}function*Rg(r,e){let t=e?.chunkSize||262144,n=0,s=new TextEncoder;for(;n<r.length;){let i=Math.min(r.length-n,t),o=r.slice(n,n+i);n+=i,yield s.encode(o)}}function*Ig(r,e={}){let{chunkSize:t=262144}=e,n=0;for(;n<r.byteLength;){let s=Math.min(r.byteLength-n,t),i=new ArrayBuffer(s),o=new Uint8Array(r,n,s);new Uint8Array(i).set(o),n+=s,yield i}}async function*Pg(r,e){let t=e?.chunkSize||1048576,n=0;for(;n<r.size;){let s=n+t,i=await r.slice(n,s).arrayBuffer();n=s,yield i}}function sh(r,e){return sn?Iw(r,e):Pw(r,e)}async function*Iw(r,e){let t=r.getReader(),n;try{for(;;){let s=n||t.read();e?._streamReadAhead&&(n=t.read());let{done:i,value:o}=await s;if(i)return;yield Xa(o)}}catch{t.releaseLock()}}async function*Pw(r,e){for await(let t of r)yield Xa(t)}function Cg(r,e){if(typeof r=="string")return Rg(r,e);if(r instanceof ArrayBuffer)return Ig(r,e);if(st(r))return Pg(r,e);if(Ya(r))return sh(r,e);if(nt(r))return sh(r.body,e);throw new Error("makeIterator")}var Mg="Cannot convert supplied data type";function Cw(r,e,t){if(e.text&&typeof r=="string")return r;if(ag(r)&&(r=r.buffer),r instanceof ArrayBuffer){let n=r;return e.text&&!e.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(r)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(r);let n=r.buffer,s=r.byteLength||r.length;return(r.byteOffset!==0||s!==n.byteLength)&&(n=n.slice(r.byteOffset,r.byteOffset+s)),n}throw new Error(Mg)}async function Og(r,e,t){let n=r instanceof ArrayBuffer||ArrayBuffer.isView(r);if(typeof r=="string"||n)return Cw(r,e,t);if(st(r)&&(r=await Ka(r)),nt(r)){let s=r;return await dg(s),e.binary?await s.arrayBuffer():await s.text()}if(Ya(r)&&(r=Cg(r,t)),ig(r)||og(r))return Xf(r);throw new Error(Mg)}function Qa(r,e){let t=th(),n=r||t;return typeof n.fetch=="function"?n.fetch:cn(n.fetch)?s=>is(s,n.fetch):e?.fetch?e?.fetch:is}function kg(r,e,t){if(t)return t;let n={fetch:Qa(e,r),...r};if(n.url){let s=ss(n.url);n.baseUrl=s,n.queryString=ug(n.url),n.filename=an.filename(s),n.baseUrl=an.dirname(s)}return Array.isArray(n.loaders)||(n.loaders=null),n}function Ng(r,e){if(r&&!Array.isArray(r))return r;let t;if(r&&(t=Array.isArray(r)?r:[r]),e&&e.loaders){let n=Array.isArray(e.loaders)?e.loaders:[e.loaders];t=t?[...t,...n]:n}return t&&t.length?t:void 0}async function Er(r,e,t,n){e&&!Array.isArray(e)&&!Ti(e)&&(n=void 0,t=e,e=void 0),r=await r,t=t||{};let s=ln(r),o=Ng(e,n),a=await vg(r,o,t);return a?(t=_g(t,a,o,s),n=kg({url:s,_parse:Er,loaders:o},t,n||null),await Mw(a,r,t,n)):null}async function Mw(r,e,t,n){if(zf(r),t=Df(r.options,t),nt(e)){let i=e,{ok:o,redirected:a,status:c,statusText:l,type:u,url:f}=i,h=Object.fromEntries(i.headers.entries());n.response={headers:h,ok:o,redirected:a,status:c,statusText:l,type:u,url:f}}e=await Og(e,r,t);let s=r;if(s.parseTextSync&&typeof e=="string")return s.parseTextSync(e,t,n);if(Wf(r,t))return await $f(r,e,t,n,Er);if(s.parseText&&typeof e=="string")return await s.parseText(e,t,n);if(s.parse)return await s.parse(e,t,n);throw ke(!s.parseSync),new Error(`${r.id} loader - no parser found and worker is disabled`)}async function Rr(r,e,t,n){let s,i;!Array.isArray(e)&&!Ti(e)?(s=[],i=e,n=void 0):(s=e,i=t);let o=Qa(i),a=r;return typeof r=="string"&&(a=await o(r)),st(r)&&(a=await o(r)),Array.isArray(s)?await Er(a,s,i):await Er(a,s,i)}var Dg="4.2.1";var Ow=globalThis.loaders?.parseImageNode,oh=typeof Image<"u",ah=typeof ImageBitmap<"u",kw=Boolean(Ow),ch=sn?!0:kw;function Fg(r){switch(r){case"auto":return ah||oh||ch;case"imagebitmap":return ah;case"image":return oh;case"data":return ch;default:throw new Error(`@loaders.gl/images: image ${r} not supported in this environment`)}}function Bg(){if(ah)return"imagebitmap";if(oh)return"image";if(ch)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Nw(r){let e=Dw(r);if(!e)throw new Error("Not an image");return e}function Lg(r){switch(Nw(r)){case"data":return r;case"image":case"imagebitmap":let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)throw new Error("getImageData");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0),t.getImageData(0,0,r.width,r.height);default:throw new Error("getImageData")}}function Dw(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&r instanceof Image?"image":r&&typeof r=="object"&&r.data&&r.width&&r.height?"data":null}var Fw=/^data:image\/svg\+xml/,Bw=/\.svg((\?|#).*)?$/;function Ja(r){return r&&(Fw.test(r)||Bw.test(r))}function Ug(r,e){if(Ja(e)){let n=new TextDecoder().decode(r);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return lh(r,e)}function lh(r,e){if(Ja(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(r)])}async function ec(r,e,t){let n=Ug(r,t),s=self.URL||self.webkitURL,i=typeof n!="string"&&s.createObjectURL(n);try{return await Lw(i||n,e)}finally{i&&s.revokeObjectURL(i)}}async function Lw(r,e){let t=new Image;return t.src=r,e.image&&e.image.decode&&t.decode?(await t.decode(),t):await new Promise((n,s)=>{try{t.onload=()=>n(t),t.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var Uw={},Vg=!0;async function zg(r,e,t){let n;Ja(t)?n=await ec(r,e,t):n=lh(r,t);let s=e&&e.imagebitmap;return await Vw(n,s)}async function Vw(r,e=null){if((zw(e)||!Vg)&&(e=null),e)try{return await createImageBitmap(r,e)}catch(t){console.warn(t),Vg=!1}return await createImageBitmap(r)}function zw(r){for(let e in r||Uw)return!1;return!0}function Wg(r){return!Hw(r,"ftyp",4)||!(r[8]&96)?null:Ww(r)}function Ww(r){switch($w(r,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function $w(r,e,t){return String.fromCharCode(...r.slice(e,t))}function jw(r){return[...r].map(e=>e.charCodeAt(0))}function Hw(r,e,t=0){let n=jw(e);for(let s=0;s<n.length;++s)if(n[s]!==r[s+t])return!1;return!0}var Dt=!1,Ai=!0;function tc(r){let e=Si(r);return Yw(e)||Zw(e)||qw(e)||Kw(e)||Xw(e)}function Xw(r){let e=new Uint8Array(r instanceof DataView?r.buffer:r),t=Wg(e);return t?{mimeType:t.mimeType,width:0,height:0}:null}function Yw(r){let e=Si(r);return e.byteLength>=24&&e.getUint32(0,Dt)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Dt),height:e.getUint32(20,Dt)}:null}function qw(r){let e=Si(r);return e.byteLength>=10&&e.getUint32(0,Dt)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,Ai),height:e.getUint16(8,Ai)}:null}function Kw(r){let e=Si(r);return e.byteLength>=14&&e.getUint16(0,Dt)===16973&&e.getUint32(2,Ai)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Ai),height:e.getUint32(22,Ai)}:null}function Zw(r){let e=Si(r);if(!(e.byteLength>=3&&e.getUint16(0,Dt)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=Gw(),i=2;for(;i+9<e.byteLength;){let o=e.getUint16(i,Dt);if(s.has(o))return{mimeType:"image/jpeg",height:e.getUint16(i+5,Dt),width:e.getUint16(i+7,Dt)};if(!n.has(o))return null;i+=2,i+=e.getUint16(i,Dt)}return null}function Gw(){let r=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)r.add(t);return{tableMarkers:r,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Si(r){if(r instanceof DataView)return r;if(ArrayBuffer.isView(r))return new DataView(r.buffer);if(r instanceof ArrayBuffer)return new DataView(r);throw new Error("toDataView")}async function $g(r,e){let{mimeType:t}=tc(r)||{},n=globalThis.loaders?.parseImageNode;return vr(n),await n(r,t)}async function jg(r,e,t){e=e||{};let s=(e.image||{}).type||"auto",{url:i}=t||{},o=Qw(s),a;switch(o){case"imagebitmap":a=await zg(r,e,i);break;case"image":a=await ec(r,e,i);break;case"data":a=await $g(r,e);break;default:vr(!1)}return s==="data"&&(a=Lg(a)),a}function Qw(r){switch(r){case"auto":case"data":return Bg();default:return Fg(r),r}}var Jw=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],e2=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],t2={image:{type:"auto",decode:!0}},uh={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Dg,mimeTypes:e2,extensions:Jw,parse:jg,tests:[r=>Boolean(tc(new DataView(r)))],options:t2};Os();var r2=new Fe({id:"deck"}),H=r2;var fh={};function rc(r){fh=r}function he(r,e,t,n){H.level>0&&fh[r]&&fh[r].call(null,e,t,n)}function n2(r){let e=r[0],t=r[r.length-1];return e==="{"&&t==="}"||e==="["&&t==="]"}var Hg={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:n2,parseTextSync:JSON.parse};function s2(){let r="9.2.0-beta.4",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==r)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${r}`);return e||(H.log(1,`deck.gl ${r}`)(),globalThis.deck={...globalThis.deck,VERSION:r,version:r,log:H,_registerLoggers:rc},vi([Hg,[uh,{imagebitmap:{premultiplyAlpha:"none"}}]])),r}var nc=s2();var Xg=`uniform layerUniforms {
862
862
  uniform float opacity;
863
863
  } layer;
864
864
  `,hh={name:"layer",vs:Xg,fs:Xg,getUniforms:r=>({opacity:Math.pow(r.opacity,.45454545454545453)}),uniformTypes:{opacity:"f32"}};var i2=`
@@ -1587,7 +1587,7 @@ void main() {
1587
1587
  void main() {
1588
1588
  fragColor = ${r}(texSrc, screen.texSize, coordinate);
1589
1589
  }
1590
- `;function sA(r,e){if(e.filter){let t=typeof e.filter=="string"?e.filter:`${r.name}_filterColor_ext`;return rA(t)}if(e.sampler){let t=typeof e.sampler=="string"?e.sampler:`${r.name}_sampleColor`;return nA(t)}return""}var iA={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant",blendAlphaDstFactor:"zero"},ir=class extends xt{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):super.render(e)}_drawPickingBuffer({layers:e,layerFilter:t,views:n,viewports:s,onViewportActive:i,pickingFBO:o,deviceRect:{x:a,y:c,width:l,height:u},cullRect:f,effects:h,pass:d="picking",pickZ:g,shaderModuleProps:y}){this.pickZ=g;let _=this._resetColorEncoder(g),b=[a,c,l,u],R=super.render({target:o,layers:e,layerFilter:t,views:n,viewports:s,onViewportActive:i,cullRect:f,effects:h?.filter(S=>S.useInPicking),pass:d,isPicking:!0,shaderModuleProps:y,clearColor:[0,0,0,0],colorMask:15,scissorRect:b});return this._colorEncoderState=null,{decodePickingColor:_&&aA.bind(null,_),stats:R}}shouldDrawLayer(e){let{pickable:t,operation:n}=e.props;return t&&n.includes("draw")||n.includes("terrain")||n.includes("mask")}getShaderModuleProps(e,t,n){return{picking:{isActive:1,isAttribute:this.pickZ},lighting:{enabled:!1}}}getLayerParameters(e,t,n){let s={...e.props.parameters},{pickable:i,operation:o}=e.props;return!this._colorEncoderState||o.includes("terrain")?s.blend=!1:i&&o.includes("draw")&&(Object.assign(s,iA),s.blend=!0,s.blendColor=oA(this._colorEncoderState,e,n)),s}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function oA(r,e,t){let{byLayer:n,byAlpha:s}=r,i,o=n.get(e);return o?(o.viewports.push(t),i=o.a):(i=n.size+1,i<=255?(o={a:i,layer:e,viewports:[t]},n.set(e,o),s[i]=o):(H.warn("Too many pickable layers, only picking the first 255")(),i=0)),[0,0,0,i/255]}function aA(r,e){let t=r.byAlpha[e[3]];return t&&{pickedLayer:t.layer,pickedViewports:t.viewports,pickedObjectIndex:t.layer.decodePickingColor(e)}}var Nr={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},ys=Symbol.for("component"),lt=Symbol.for("propTypes"),Rc=Symbol.for("deprecatedProps"),or=Symbol.for("asyncPropDefaults"),Bt=Symbol.for("asyncPropOriginal"),Tt=Symbol.for("asyncPropResolved");function Dr(r,e=()=>!0){return Array.isArray(r)?V_(r,e,[]):e(r)?[r]:[]}function V_(r,e,t){let n=-1;for(;++n<r.length;){let s=r[n];Array.isArray(s)?V_(s,e,t):e(s)&&t.push(s)}return t}function Ic({target:r,source:e,start:t=0,count:n=1}){let s=e.length,i=n*s,o=0;for(let a=t;o<s;o++)r[a++]=e[o];for(;o<i;)o<i-o?(r.copyWithin(t+o,t,t+o),o*=2):(r.copyWithin(t+o,t,t+i-o),o=i);return r}Cs();var Xi=class{constructor(e,t,n){this._loadCount=0,this._subscribers=new Set,this.id=e,this.context=n,this.setData(t)}subscribe(e){this._subscribers.add(e)}unsubscribe(e){this._subscribers.delete(e)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(e,t){if(e===this._data&&!t)return;this._data=e;let n=++this._loadCount,s=e;typeof e=="string"&&(s=Rr(e)),s instanceof Promise?(this.isLoaded=!1,this._loader=s.then(i=>{this._loadCount===n&&(this.isLoaded=!0,this._error=void 0,this._content=i)}).catch(i=>{this._loadCount===n&&(this.isLoaded=!0,this._error=i||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=e);for(let i of this._subscribers)i.onChange(this.getData())}};var Yi=class{constructor(e){this.protocol=e.protocol||"resource://",this._context={device:e.device,gl:e.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(e){return e.startsWith(this.protocol)?!0:e in this._resources}add({resourceId:e,data:t,forceUpdate:n=!1,persistent:s=!0}){let i=this._resources[e];i?i.setData(t,n):(i=new Xi(e,t,this._context),this._resources[e]=i),i.persistent=s}remove(e){let t=this._resources[e];t&&(t.delete(),delete this._resources[e])}unsubscribe({consumerId:e}){let t=this._consumers[e];if(t){for(let n in t){let s=t[n],i=this._resources[s.resourceId];i&&i.unsubscribe(s)}delete this._consumers[e],this.prune()}}subscribe({resourceId:e,onChange:t,consumerId:n,requestId:s="default"}){let{_resources:i,protocol:o}=this;e.startsWith(o)&&(e=e.replace(o,""),i[e]||this.add({resourceId:e,data:null,persistent:!1}));let a=i[e];if(this._track(n,s,a,t),a)return a.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let e in this._resources)this._resources[e].delete()}_track(e,t,n,s){let i=this._consumers,o=i[e]=i[e]||{},a=o[t],c=a&&a.resourceId&&this._resources[a.resourceId];c&&(c.unsubscribe(a),this.prune()),n&&(a?(a.onChange=s,a.resourceId=n.id):a={onChange:s,resourceId:n.id},o[t]=a,n.subscribe(a))}_prune(){this._pruneRequest=null;for(let e of Object.keys(this._resources)){let t=this._resources[e];!t.persistent&&!t.inUse()&&(t.delete(),delete this._resources[e])}}};var cA="layerManager.setLayers",lA="layerManager.activateViewport",gn=class{constructor(e,t){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=a=>{he(lA,this,a),a&&(this.context.viewport=a)};let{deck:n,stats:s,viewport:i,timeline:o}=t||{};this.layers=[],this.resourceManager=new Yi({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e?.gl,deck:n,shaderAssembler:wc(e?.info?.shadingLanguage||"glsl"),defaultShaderModules:[hh],renderPass:void 0,stats:s||new Ke({id:"deck.gl"}),viewport:i||new $e({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:o||new qr,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let e of this.layers)this._finalizeLayer(e)}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);for(let n of this.layers){let s=n.getNeedsRedraw(e);t=t||s}return t}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(e){this._needsRedraw=this._needsRedraw||e}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e}getLayers({layerIds:e}={}){return e?this.layers.filter(t=>e.find(n=>t.id.indexOf(n)===0)):this.layers}setProps(e){"debug"in e&&(this._debug=e.debug),"userData"in e&&(this.context.userData=e.userData),"layers"in e&&(this._nextLayers=e.layers),"onError"in e&&(this.context.onError=e.onError)}setLayers(e,t){he(cA,this,t,e),this._lastRenderedLayers=e;let n=Dr(e,Boolean);for(let s of n)s.context=this.context;this._updateLayers(this.layers,n)}updateLayers(){let e=this.needsUpdate();e&&(this.setNeedsRedraw(`updating layers: ${e}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,e)),this._nextLayers=null}addDefaultShaderModule(e){let{defaultShaderModules:t}=this.context;t.find(n=>n.name===e.name)||(t.push(e),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(e){let{defaultShaderModules:t}=this.context,n=t.findIndex(s=>s.name===e.name);n>=0&&(t.splice(n,1),this._defaultShaderModulesChanged=!0)}_handleError(e,t,n){n.raiseError(t,`${e} of ${n}`)}_updateLayers(e,t){let n={};for(let o of e)n[o.id]?H.warn(`Multiple old layers with same id ${o.id}`)():n[o.id]=o;if(this._defaultShaderModulesChanged){for(let o of e)o.setNeedsUpdate(),o.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}let s=[];this._updateSublayersRecursively(t,n,s),this._finalizeOldLayers(n);let i=!1;for(let o of s)if(o.hasUniformTransition()){i=`Uniform transition in ${o}`;break}this._needsUpdate=i,this.layers=s}_updateSublayersRecursively(e,t,n){for(let s of e){s.context=this.context;let i=t[s.id];i===null&&H.warn(`Multiple new layers with same id ${s.id}`)(),t[s.id]=null;let o=null;try{this._debug&&i!==s&&s.validateProps(),i?(this._transferLayerState(i,s),this._updateLayer(s)):this._initializeLayer(s),n.push(s),o=s.isComposite?s.getSubLayers():null}catch(a){this._handleError("matching",a,s)}o&&this._updateSublayersRecursively(o,t,n)}}_finalizeOldLayers(e){for(let t in e){let n=e[t];n&&this._finalizeLayer(n)}}_initializeLayer(e){try{e._initialize(),e.lifecycle=Nr.INITIALIZED}catch(t){this._handleError("initialization",t,e)}}_transferLayerState(e,t){t._transferState(e),t.lifecycle=Nr.MATCHED,t!==e&&(e.lifecycle=Nr.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(t){this._handleError("update",t,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=Nr.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=Nr.FINALIZED}catch(t){this._handleError("finalization",t,e)}}};function le(r,e,t){if(r===e)return!0;if(!t||!r||!e)return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(!le(r[n],e[n],t-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof r=="object"&&typeof e=="object"){let n=Object.keys(r),s=Object.keys(e);if(n.length!==s.length)return!1;for(let i of n)if(!e.hasOwnProperty(i)||!le(r[i],e[i],t-1))return!1;return!0}return!1}var qi=class{constructor(e){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=e.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=e.eventManager,this._eventCallbacks={onViewStateChange:e.onViewStateChange,onInteractionStateChange:e.onInteractionStateChange},Object.seal(this),this.setProps(e)}finalize(){for(let e in this.controllers){let t=this.controllers[e];t&&t.finalize()}this.controllers={}}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e,this._needsRedraw=this._needsRedraw||e}updateViewStates(){for(let e in this.controllers){let t=this.controllers[e];t&&t.updateTransition()}}getViewports(e){return e?this._viewports.filter(t=>t.containsPixel(e)):this._viewports}getViews(){let e={};return this.views.forEach(t=>{e[t.id]=t}),e}getView(e){return this.views.find(t=>t.id===e)}getViewState(e){let t=typeof e=="string"?this.getView(e):e,n=t&&this.viewState[t.getViewStateId()]||this.viewState;return t?t.filterViewState(n):n}getViewport(e){return this._viewportMap[e]}unproject(e,t){let n=this.getViewports(),s={x:e[0],y:e[1]};for(let i=n.length-1;i>=0;--i){let o=n[i];if(o.containsPixel(s)){let a=e.slice();return a[0]-=o.x,a[1]-=o.y,o.unproject(a,t)}}return null}setProps(e){e.views&&this._setViews(e.views),e.viewState&&this._setViewState(e.viewState),("width"in e||"height"in e)&&this._setSize(e.width,e.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(e,t){(e!==this.width||t!==this.height)&&(this.width=e,this.height=t,this.setNeedsUpdate("Size changed"))}_setViews(e){e=Dr(e,Boolean),this._diffViews(e,this.views)&&this.setNeedsUpdate("views changed"),this.views=e}_setViewState(e){e?(!le(e,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=e):H.warn("missing `viewState` or `initialViewState`")()}_createController(e,t){let n=t.type;return new n({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:i=>this.getView(e.id)?.makeViewport({viewState:i,width:this.width,height:this.height})})}_updateController(e,t,n,s){let i=e.controller;if(i&&n){let o={...t,...i,id:e.id,x:n.x,y:n.y,width:n.width,height:n.height};return(!s||s.constructor!==i.type)&&(s=this._createController(e,o)),s&&s.setProps(o),s}return null}_rebuildViewports(){let{views:e}=this,t=this.controllers;this._viewports=[],this.controllers={};let n=!1;for(let s=e.length;s--;){let i=e[s],o=this.getViewState(i),a=i.makeViewport({viewState:o,width:this.width,height:this.height}),c=t[i.id],l=Boolean(i.controller);l&&!c&&(n=!0),(n||!l)&&c&&(c.finalize(),c=null),this.controllers[i.id]=this._updateController(i,o,a,c),a&&this._viewports.unshift(a)}for(let s in t){let i=t[s];i&&!this.controllers[s]&&i.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(e=>{e.id&&(this._viewportMap[e.id]=this._viewportMap[e.id]||e)})}_diffViews(e,t){return e.length!==t.length?!0:e.some((n,s)=>!e[s].equals(t[s]))}};var uA=/([0-9]+\.?[0-9]*)(%|px)/;function ar(r){switch(typeof r){case"number":return{position:r,relative:!1};case"string":let e=uA.exec(r);if(e&&e.length>=3){let t=e[2]==="%",n=parseFloat(e[1]);return{position:t?n/100:n,relative:t}}default:throw new Error(`Could not parse position string ${r}`)}}function cr(r,e){return r.relative?Math.round(r.position*e):r.position}var Ne=class{constructor(e){let{id:t,x:n=0,y:s=0,width:i="100%",height:o="100%",padding:a=null}=e;this.id=t||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=ar(n),this._y=ar(s),this._width=ar(i),this._height=ar(o),this._padding=a&&{left:ar(a.left||0),right:ar(a.right||0),top:ar(a.top||0),bottom:ar(a.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e?!0:this.constructor===e.constructor&&le(this.props,e.props,2)}clone(e){let t=this.constructor;return new t({...this.props,...e})}makeViewport({width:e,height:t,viewState:n}){n=this.filterViewState(n);let s=this.getDimensions({width:e,height:t});if(!s.height||!s.width)return null;let i=this.getViewportType(n);return new i({...n,...this.props,...s})}getViewStateId(){let{viewState:e}=this.props;return typeof e=="string"?e:e?.id||this.id}filterViewState(e){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;let t={...e};for(let n in this.props.viewState)n!=="id"&&(t[n]=this.props.viewState[n]);return t}return e}getDimensions({width:e,height:t}){let n={x:cr(this._x,e),y:cr(this._y,t),width:cr(this._width,e),height:cr(this._height,t)};return this._padding&&(n.padding={left:cr(this._padding.left,e),top:cr(this._padding.top,t),right:cr(this._padding.right,e),bottom:cr(this._padding.bottom,t)}),n}get controller(){let e=this.props.controller;return e?e===!0?{type:this.ControllerType}:typeof e=="function"?{type:e}:{type:this.ControllerType,...e}:null}};var wt=class{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){this.cancel(),this.settings=e,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:e,settings:t}=this;this._handle=e.addChannel({delay:e.getTime(),duration:t.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var z_=()=>{},Ki={BREAK:1,SNAP_TO_END:2,IGNORE:3},fA=r=>r,hA=Ki.BREAK,Zi=class{constructor(e){this._onTransitionUpdate=t=>{let{time:n,settings:{interpolator:s,startProps:i,endProps:o,duration:a,easing:c}}=t,l=c(n/a),u=s.interpolateProps(i,o,l);this.propsInTransition=this.getControllerState({...this.props,...u}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=e.getControllerState,this.propsInTransition=null,this.transition=new wt(e.timeline),this.onViewStateChange=e.onViewStateChange||z_,this.onStateChange=e.onStateChange||z_}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let t=!1,n=this.props;if(this.props=e,!n||this._shouldIgnoreViewportChange(n,e))return!1;if(this._isTransitionEnabled(e)){let s=n;if(this.transition.inProgress){let{interruption:i,endProps:o}=this.transition.settings;s={...n,...i===Ki.SNAP_TO_END?o:this.propsInTransition||n}}this._triggerTransition(s,e),t=!0}else this.transition.cancel();return t}updateTransition(){this.transition.update()}_isTransitionEnabled(e){let{transitionDuration:t,transitionInterpolator:n}=e;return(t>0||t==="auto")&&Boolean(n)}_isUpdateDueToCurrentTransition(e){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition):!1}_shouldIgnoreViewportChange(e,t){return this.transition.inProgress?this.transition.settings.interruption===Ki.IGNORE||this._isUpdateDueToCurrentTransition(t):this._isTransitionEnabled(t)?t.transitionInterpolator.arePropsEqual(e,t):!0}_triggerTransition(e,t){let n=this.getControllerState(e),s=this.getControllerState(t).shortestPathFrom(n),i=t.transitionInterpolator,o=i.getDuration?i.getDuration(e,t):t.transitionDuration;if(o===0)return;let a=i.initializeProps(e,s);this.propsInTransition={};let c={duration:o,easing:t.transitionEasing||fA,interpolator:i,interruption:t.transitionInterruption||hA,startProps:a.start,endProps:a.end,onStart:t.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(t.onTransitionInterrupt),onEnd:this._onTransitionEnd(t.onTransitionEnd)};this.transition.start(c),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return t=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e?.(t)}}};function oe(r,e){if(!r)throw new Error(e||"deck.gl: assertion failed.")}var lr=class{constructor(e){let{compare:t,extract:n,required:s}=e;this._propsToCompare=t,this._propsToExtract=n||t,this._requiredProps=s}arePropsEqual(e,t){for(let n of this._propsToCompare)if(!(n in e)||!(n in t)||!He(e[n],t[n]))return!1;return!0}initializeProps(e,t){let n={},s={};for(let i of this._propsToExtract)(i in e||i in t)&&(n[i]=e[i],s[i]=t[i]);return this._checkRequiredProps(n),this._checkRequiredProps(s),{start:n,end:s}}getDuration(e,t){return t.transitionDuration}_checkRequiredProps(e){this._requiredProps&&this._requiredProps.forEach(t=>{let n=e[t];oe(Number.isFinite(n)||Array.isArray(n),`${t} is required for transition`)})}};var dA=["longitude","latitude","zoom","bearing","pitch"],pA=["longitude","latitude","zoom"],Ae=class extends lr{constructor(e={}){let t=Array.isArray(e)?e:e.transitionProps,n=Array.isArray(e)?{}:e;n.transitionProps=Array.isArray(t)?{compare:t,required:t}:t||{compare:dA,required:pA},super(n.transitionProps),this.opts=n}initializeProps(e,t){let n=super.initializeProps(e,t),{makeViewport:s,around:i}=this.opts;if(s&&i){let o=s(e),a=s(t),c=o.unproject(i);n.start.around=i,Object.assign(n.end,{around:a.project(c),aroundPosition:c,width:t.width,height:t.height})}return n}interpolateProps(e,t,n){let s={};for(let i of this._propsToExtract)s[i]=Jt(e[i]||0,t[i]||0,n);if(t.aroundPosition&&this.opts.makeViewport){let i=this.opts.makeViewport({...t,...s});Object.assign(s,i.panByPosition(t.aroundPosition,Jt(e.around,t.around,n)))}return s}};var ur={transitionDuration:0},mA=300,Pc=r=>1-(1-r)*(1-r),xs={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],MULTI_PAN:["multipanstart","multipanmove","multipanend"],DOUBLE_CLICK:["dblclick"],KEYBOARD:["keydown"]},_n={},De=class{constructor(e){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new Zi({...e,getControllerState:t=>new this.ControllerState(t),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=e.eventManager,this.onViewStateChange=e.onViewStateChange||(()=>{}),this.onStateChange=e.onStateChange||(()=>{}),this.makeViewport=e.makeViewport}set events(e){this.toggleEvents(this._customEvents,!1),this.toggleEvents(e,!0),this._customEvents=e,this.props&&this.setProps(this.props)}finalize(){for(let e in this._events)this._events[e]&&this.eventManager?.off(e,this.handleEvent);this.transitionManager.finalize()}handleEvent(e){this._controllerState=void 0;let t=this._eventStartBlocked;switch(e.type){case"panstart":return t?!1:this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return t?!1:this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"multipanstart":return t?!1:this._onMultiPanStart(e);case"multipanmove":return this._onMultiPan(e);case"multipanend":return this._onMultiPanEnd(e);case"dblclick":return this._onDoubleClick(e);case"wheel":return this._onWheel(e);case"keydown":return this._onKeyDown(e);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(e){let{x:t,y:n}=this.props,{offsetCenter:s}=e;return[s.x-t,s.y-n]}isPointInBounds(e,t){let{width:n,height:s}=this.props;if(t&&t.handled)return!1;let i=e[0]>=0&&e[0]<=n&&e[1]>=0&&e[1]<=s;return i&&t&&t.stopPropagation(),i}isFunctionKeyPressed(e){let{srcEvent:t}=e;return Boolean(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(e){let t=setTimeout(()=>{this._eventStartBlocked===t&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=t}setProps(e){e.dragMode&&(this.dragMode=e.dragMode),this.props=e,"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);let{inertia:t}=e;this.inertia=Number.isFinite(t)?t:t===!0?mA:0;let{scrollZoom:n=!0,dragPan:s=!0,dragRotate:i=!0,doubleClickZoom:o=!0,touchZoom:a=!0,touchRotate:c=!1,keyboard:l=!0}=e,u=Boolean(this.onViewStateChange);this.toggleEvents(xs.WHEEL,u&&n),this.toggleEvents(xs.PAN,u),this.toggleEvents(xs.PINCH,u&&(a||c)),this.toggleEvents(xs.MULTI_PAN,u&&c),this.toggleEvents(xs.DOUBLE_CLICK,u&&o),this.toggleEvents(xs.KEYBOARD,u&&l),this.scrollZoom=n,this.dragPan=s,this.dragRotate=i,this.doubleClickZoom=o,this.touchZoom=a,this.touchRotate=c,this.keyboard=l}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,t){this.eventManager&&e.forEach(n=>{this._events[n]!==t&&(this._events[n]=t,t?this.eventManager.on(n,this.handleEvent):this.eventManager.off(n,this.handleEvent))})}updateViewport(e,t=null,n={}){let s={...e.getViewportProps(),...t},i=this.controllerState!==e;if(this.state=e.getState(),this._setInteractionState(n),i){let o=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:s,interactionState:this._interactionState,oldViewState:o,viewId:this.props.id})}}_onTransition(e){this.onViewStateChange({...e,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(e){Object.assign(this._interactionState,e),this.onStateChange(this._interactionState)}_onPanStart(e){let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let n=this.isFunctionKeyPressed(e)||e.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(n=!n);let s=this.controllerState[n?"panStart":"rotateStart"]({pos:t});return this._panMove=n,this.updateViewport(s,ur,{isDragging:!0}),!0}_onPan(e){return this.isDragging()?this._panMove?this._onPanMove(e):this._onPanRotate(e):!1}_onPanEnd(e){return this.isDragging()?this._panMove?this._onPanMoveEnd(e):this._onPanRotateEnd(e):!1}_onPanMove(e){if(!this.dragPan)return!1;let t=this.getCenter(e),n=this.controllerState.pan({pos:t});return this.updateViewport(n,ur,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){let{inertia:t}=this;if(this.dragPan&&t&&e.velocity){let n=this.getCenter(e),s=[n[0]+e.velocityX*t/2,n[1]+e.velocityY*t/2],i=this.controllerState.pan({pos:s}).panEnd();this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:Pc},{isDragging:!1,isPanning:!0})}else{let n=this.controllerState.panEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;let t=this.getCenter(e),n=this.controllerState.rotate({pos:t});return this.updateViewport(n,ur,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){let{inertia:t}=this;if(this.dragRotate&&t&&e.velocity){let n=this.getCenter(e),s=[n[0]+e.velocityX*t/2,n[1]+e.velocityY*t/2],i=this.controllerState.rotate({pos:s}).rotateEnd();this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:Pc},{isDragging:!1,isRotating:!0})}else{let n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;e.srcEvent.preventDefault();let{speed:n=.01,smooth:s=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:i}=e,o=2/(1+Math.exp(-Math.abs(i*n)));i<0&&o!==0&&(o=1/o);let a=s?{...this._getTransitionProps({around:t}),transitionDuration:250}:ur,c=this.controllerState.zoom({pos:t,scale:o});return this.updateViewport(c,a,{isZooming:!0,isPanning:!0}),!0}_onMultiPanStart(e){let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let n=this.controllerState.rotateStart({pos:t});return this.updateViewport(n,ur,{isDragging:!0}),!0}_onMultiPan(e){if(!this.touchRotate||!this.isDragging())return!1;let t=this.getCenter(e);t[0]-=e.deltaX;let n=this.controllerState.rotate({pos:t});return this.updateViewport(n,ur,{isDragging:!0,isRotating:!0}),!0}_onMultiPanEnd(e){if(!this.isDragging())return!1;let{inertia:t}=this;if(this.touchRotate&&t&&e.velocityY){let n=this.getCenter(e),s=[n[0],n[1]+=e.velocityY*t/2],i=this.controllerState.rotate({pos:s});this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:Pc},{isDragging:!1,isRotating:!0}),this.blockEvents(t)}else{let n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let n=this.controllerState.zoomStart({pos:t}).rotateStart({pos:t});return _n._startPinchRotation=e.rotation,_n._lastPinchEvent=e,this.updateViewport(n,ur,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let t=this.controllerState;if(this.touchZoom){let{scale:n}=e,s=this.getCenter(e);t=t.zoom({pos:s,scale:n})}if(this.touchRotate){let{rotation:n}=e;t=t.rotate({deltaAngleX:_n._startPinchRotation-n})}return this.updateViewport(t,ur,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),_n._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;let{inertia:t}=this,{_lastPinchEvent:n}=_n;if(this.touchZoom&&t&&n&&e.scale!==n.scale){let s=this.getCenter(e),i=this.controllerState.rotateEnd(),o=Math.log2(e.scale),a=(o-Math.log2(n.scale))/(e.deltaTime-n.deltaTime),c=Math.pow(2,o+a*t/2);i=i.zoom({pos:s,scale:c}).zoomEnd(),this.updateViewport(i,{...this._getTransitionProps({around:s}),transitionDuration:t,transitionEasing:Pc},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(t)}else{let s=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(s,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return _n._startPinchRotation=null,_n._lastPinchEvent=null,!0}_onDoubleClick(e){if(!this.doubleClickZoom)return!1;let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let n=this.isFunctionKeyPressed(e),s=this.controllerState.zoom({pos:t,scale:n?.5:2});return this.updateViewport(s,this._getTransitionProps({around:t}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(e){if(!this.keyboard)return!1;let t=this.isFunctionKeyPressed(e),{zoomSpeed:n,moveSpeed:s,rotateSpeedX:i,rotateSpeedY:o}=this.keyboard===!0?{}:this.keyboard,{controllerState:a}=this,c,l={};switch(e.srcEvent.code){case"Minus":c=t?a.zoomOut(n).zoomOut(n):a.zoomOut(n),l.isZooming=!0;break;case"Equal":c=t?a.zoomIn(n).zoomIn(n):a.zoomIn(n),l.isZooming=!0;break;case"ArrowLeft":t?(c=a.rotateLeft(i),l.isRotating=!0):(c=a.moveLeft(s),l.isPanning=!0);break;case"ArrowRight":t?(c=a.rotateRight(i),l.isRotating=!0):(c=a.moveRight(s),l.isPanning=!0);break;case"ArrowUp":t?(c=a.rotateUp(o),l.isRotating=!0):(c=a.moveUp(s),l.isPanning=!0);break;case"ArrowDown":t?(c=a.rotateDown(o),l.isRotating=!0):(c=a.moveDown(s),l.isPanning=!0);break;default:return!1}return this.updateViewport(c,this._getTransitionProps(),l),!0}_getTransitionProps(e){let{transition:t}=this;return!t||!t.transitionInterpolator?ur:e?{...t,transitionInterpolator:new Ae({...e,...t.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:t}};var fr=class{constructor(e,t){this._viewportProps=this.applyConstraints(e),this._state=t}getViewportProps(){return this._viewportProps}getState(){return this._state}};var W_=5,gA=1.2,Gi=class extends fr{constructor(e){let{width:t,height:n,latitude:s,longitude:i,zoom:o,bearing:a=0,pitch:c=0,altitude:l=1.5,position:u=[0,0,0],maxZoom:f=20,minZoom:h=0,maxPitch:d=60,minPitch:g=0,startPanLngLat:y,startZoomLngLat:_,startRotatePos:b,startBearing:R,startPitch:x,startZoom:S,normalize:C=!0}=e;oe(Number.isFinite(i)),oe(Number.isFinite(s)),oe(Number.isFinite(o)),super({width:t,height:n,latitude:s,longitude:i,zoom:o,bearing:a,pitch:c,altitude:l,maxZoom:f,minZoom:h,maxPitch:d,minPitch:g,normalize:C,position:u},{startPanLngLat:y,startZoomLngLat:_,startRotatePos:b,startBearing:R,startPitch:x,startZoom:S}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan({pos:e,startPos:t}){let n=this.getState().startPanLngLat||this._unproject(t);if(!n)return this;let i=this.makeViewport(this.getViewportProps()).panByPosition(n,e);return this._getUpdatedState(i)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:t=0,deltaAngleY:n=0}){let{startRotatePos:s,startBearing:i,startPitch:o}=this.getState();if(!s||i===void 0||o===void 0)return this;let a;return e?a=this._getNewRotation(e,s,o,i):a={bearing:i+t,pitch:o+n},this._getUpdatedState(a)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:e}){return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:t,scale:n}){let{startZoom:s,startZoomLngLat:i}=this.getState();if(i||(s=this.getViewportProps().zoom,i=this._unproject(t)||this._unproject(e)),!i)return this;let{maxZoom:o,minZoom:a}=this.getViewportProps(),c=s+Math.log2(n);c=ee(c,a,o);let l=this.makeViewport({...this.getViewportProps(),zoom:c});return this._getUpdatedState({zoom:c,...l.panByPosition(i,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(e=2){return this._zoomFromCenter(e)}zoomOut(e=2){return this._zoomFromCenter(1/e)}moveLeft(e=100){return this._panFromCenter([e,0])}moveRight(e=100){return this._panFromCenter([-e,0])}moveUp(e=100){return this._panFromCenter([0,e])}moveDown(e=100){return this._panFromCenter([0,-e])}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}shortestPathFrom(e){let t=e.getViewportProps(),n={...this.getViewportProps()},{bearing:s,longitude:i}=n;return Math.abs(s-t.bearing)>180&&(n.bearing=s<0?s+360:s-360),Math.abs(i-t.longitude)>180&&(n.longitude=i<0?i+360:i-360),n}applyConstraints(e){let{maxZoom:t,minZoom:n,zoom:s}=e;e.zoom=ee(s,n,t);let{maxPitch:i,minPitch:o,pitch:a}=e;e.pitch=ee(a,o,i);let{normalize:c=!0}=e;return c&&Object.assign(e,Ph(e)),e}_zoomFromCenter(e){let{width:t,height:n}=this.getViewportProps();return this.zoom({pos:[t/2,n/2],scale:e})}_panFromCenter(e){let{width:t,height:n}=this.getViewportProps();return this.pan({startPos:[t/2,n/2],pos:[t/2+e[0],n/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}_unproject(e){let t=this.makeViewport(this.getViewportProps());return e&&t.unproject(e)}_getNewRotation(e,t,n,s){let i=e[0]-t[0],o=e[1]-t[1],a=e[1],c=t[1],{width:l,height:u}=this.getViewportProps(),f=i/l,h=0;o>0?Math.abs(u-c)>W_&&(h=o/(c-u)*gA):o<0&&c>W_&&(h=1-a/c),h=ee(h,-1,1);let{minPitch:d,maxPitch:g}=this.getViewportProps(),y=s+180*f,_=n;return h>0?_=n+h*(g-n):h<0&&(_=n-h*(d-n)),{pitch:_,bearing:y}}},yn=class extends De{constructor(){super(...arguments),this.ControllerState=Gi,this.transition={transitionDuration:300,transitionInterpolator:new Ae({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(e){e.position=e.position||[0,0,0];let t=this.props;super.setProps(e),(!t||t.height!==e.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...e,...this.state}))}};var Cc=class extends Ne{constructor(e={}){super(e)}getViewportType(){return kr}get ControllerType(){return yn}};Cc.displayName="MapView";var Mc=Cc;var _A=new Or;function yA(r,e){let t=r.order??1/0,n=e.order??1/0;return t-n}var Qi=class{constructor(e){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=e,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(e){let t=this._defaultEffects;if(!t.find(n=>n.id===e.id)){let n=t.findIndex(s=>yA(s,e)>0);n<0?t.push(e):t.splice(n,0,e),e.setup(this._context),this._setEffects(this.effects)}}setProps(e){"effects"in e&&(le(e.effects,this.effects,1)||this._setEffects(e.effects))}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}getEffects(){return this._resolvedEffects}_setEffects(e){let t={};for(let s of this.effects)t[s.id]=s;let n=[];for(let s of e){let i=t[s.id],o=s;i&&i!==s?i.setProps?(i.setProps(s.props),o=i):i.cleanup(this._context):i||s.setup(this._context),n.push(o),delete t[s.id]}for(let s in t)t[s].cleanup(this._context);this.effects=n,this._resolvedEffects=n.concat(this._defaultEffects),e.some(s=>s instanceof Or)||this._resolvedEffects.push(_A),this._needsRedraw="effects changed"}finalize(){for(let e of this._resolvedEffects)e.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var Ji=class extends xt{shouldDrawLayer(e){let{operation:t}=e.props;return t.includes("draw")||t.includes("terrain")}};var xA="deckRenderer.renderLayers",xn=class{constructor(e){this.device=e,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new Ji(e),this.pickLayersPass=new ir(e),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(e){this.layerFilter!==e.layerFilter&&(this.layerFilter=e.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==e.drawPickingColors&&(this.drawPickingColors=e.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(e){if(!e.viewports.length)return;let t=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,n={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...e};n.effects&&this._preRender(n.effects,n);let s=this.lastPostProcessEffect?this.renderBuffers[0]:n.target;this.lastPostProcessEffect&&(n.clearColor=[0,0,0,0],n.clearCanvas=!0);let i=t.render({...n,target:s});n.effects&&(this.lastPostProcessEffect&&(n.clearCanvas=e.clearCanvas===void 0?!0:e.clearCanvas),this._postRender(n.effects,n)),this.renderCount++,he(xA,this,i,e)}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}finalize(){let{renderBuffers:e}=this;for(let t of e)t.delete();e.length=0}_preRender(e,t){this.lastPostProcessEffect=null,t.preRenderStats=t.preRenderStats||{};for(let n of e)t.preRenderStats[n.id]=n.preRender(t),n.postRender&&(this.lastPostProcessEffect=n.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:e}=this,t=this.device.canvasContext.getDrawingBufferSize(),[n,s]=t;e.length===0&&[0,1].map(i=>{let o=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"},width:n,height:s});e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${i}`,colorAttachments:[o]}))});for(let i of e)i.resize(t)}_postRender(e,t){let{renderBuffers:n}=this,s={...t,inputBuffer:n[0],swapBuffer:n[1]};for(let i of e)if(i.postRender){s.target=i.id===this.lastPostProcessEffect?t.target:void 0;let o=i.postRender(s);s.inputBuffer=o,s.swapBuffer=o===n[0]?n[1]:n[0]}}};var bA={pickedColor:null,pickedObjectIndex:-1};function Bh({pickedColors:r,decodePickingColor:e,deviceX:t,deviceY:n,deviceRadius:s,deviceRect:i}){let{x:o,y:a,width:c,height:l}=i,u=s*s,f=-1,h=0;for(let d=0;d<l;d++){let g=d+a-n,y=g*g;if(y>u)h+=4*c;else for(let _=0;_<c;_++){if(r[h+3]-1>=0){let R=_+o-t,x=R*R+y;x<=u&&(u=x,f=h)}h+=4}}if(f>=0){let d=r.slice(f,f+4),g=e(d);if(g){let y=Math.floor(f/4/c),_=f/4-y*c;return{...g,pickedColor:d,pickedX:o+_,pickedY:a+y}}H.error("Picked non-existent layer. Is picking buffer corrupt?")()}return bA}function Lh({pickedColors:r,decodePickingColor:e}){let t=new Map;if(r){for(let n=0;n<r.length;n+=4)if(r[n+3]-1>=0){let i=r.slice(n,n+4),o=i.join(",");if(!t.has(o)){let a=e(i);a?t.set(o,{...a,color:i}):H.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(t.values())}function Oc({pickInfo:r,viewports:e,pixelRatio:t,x:n,y:s,z:i}){let o=e[0];e.length>1&&(o=TA(r?.pickedViewports||e,{x:n,y:s}));let a;if(o){let c=[n-o.x,s-o.y];i!==void 0&&(c[2]=i),a=o.unproject(c)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:n,y:s,pixel:[n,s],coordinate:a,devicePixel:r&&"pickedX"in r?[r.pickedX,r.pickedY]:void 0,pixelRatio:t}}function Uh(r){let{pickInfo:e,lastPickedInfo:t,mode:n,layers:s}=r,{pickedColor:i,pickedLayer:o,pickedObjectIndex:a}=e,c=o?[o]:[];if(n==="hover"){let f=t.index,h=t.layerId,d=o?o.props.id:null;if(d!==h||a!==f){if(d!==h){let g=s.find(y=>y.props.id===h);g&&c.unshift(g)}t.layerId=d,t.index=a,t.info=null}}let l=Oc(r),u=new Map;return u.set(null,l),c.forEach(f=>{let h={...l};f===o&&(h.color=i,h.index=a,h.picked=!0),h=kc({layer:f,info:h,mode:n});let d=h.layer;f===o&&n==="hover"&&(t.info=h),u.set(d.id,h),n==="hover"&&d.updateAutoHighlight(h)}),u}function kc({layer:r,info:e,mode:t}){for(;r&&e;){let n=e.layer||null;e.sourceLayer=n,e.layer=r,e=r.getPickingInfo({info:e,mode:t,sourceLayer:n}),r=r.parent}return e}function TA(r,e){for(let t=r.length-1;t>=0;t--){let n=r[t];if(n.containsPixel(e))return n}return r[0]}var eo=class{constructor(e){this._pickable=!0,this.device=e,this.pickLayersPass=new ir(e),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(e){"layerFilter"in e&&(this.layerFilter=e.layerFilter),"_pickable"in e&&(this._pickable=e._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}pickObjectAsync(e){return this._pickClosestObjectAsync(e)}pickObjectsAsync(e){return this._pickVisibleObjectsAsync(e)}pickObject(e){return this._pickClosestObject(e)}pickObjects(e){return this._pickVisibleObjects(e)}getLastPickedObject({x:e,y:t,layers:n,viewports:s},i=this.lastPickedInfo.info){let o=i&&i.layer&&i.layer.id,a=i&&i.viewport&&i.viewport.id,c=o?n.find(h=>h.id===o):null,l=a&&s.find(h=>h.id===a)||s[0],u=l&&l.unproject([e-l.x,t-l.y]);return{...i,...{x:e,y:t,viewport:l,coordinate:u,layer:c}}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float"))){let t=this.device.createFramebuffer({colorAttachments:["rgba32float"],depthStencilAttachment:"depth16unorm"});this.depthFBO=t}let{canvas:e}=this.device.getDefaultCanvasContext();this.pickingFBO?.resize({width:e.width,height:e.height}),this.depthFBO?.resize({width:e.width,height:e.height})}_getPickable(e){if(this._pickable===!1)return null;let t=e.filter(n=>this.pickLayersPass.shouldDrawLayer(n)&&!n.isComposite);return t.length?t:null}async _pickClosestObjectAsync({layers:e,views:t,viewports:n,x:s,y:i,radius:o=0,depth:a=1,mode:c="query",unproject3D:l,onViewportActive:u,effects:f}){let h=this.device.canvasContext.cssToDeviceRatio(),d=this._getPickable(e);if(!d||n.length===0)return{result:[],emptyInfo:Oc({viewports:n,x:s,y:i,pixelRatio:h})};this._resizeBuffer();let g=this.device.canvasContext.cssToDevicePixels([s,i],!0),y=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],_=Math.round(o*h),{width:b,height:R}=this.pickingFBO,x=this._getPickingRect({deviceX:y[0],deviceY:y[1],deviceRadius:_,deviceWidth:b,deviceHeight:R}),S={x:s-o,y:i-o,width:o*2+1,height:o*2+1},C,P=[],B=new Set;for(let N=0;N<a;N++){let k;if(x){let U=this._drawAndSample({layers:d,views:t,viewports:n,onViewportActive:u,deviceRect:x,cullRect:S,effects:f,pass:`picking:${c}`});k=Bh({...U,deviceX:y[0],deviceY:y[1],deviceRadius:_,deviceRect:x})}else k={pickedColor:null,pickedObjectIndex:-1};let F;if(k.pickedLayer&&l&&this.depthFBO){let{pickedColors:U}=this._drawAndSample({layers:[k.pickedLayer],views:t,viewports:n,onViewportActive:u,deviceRect:{x:k.pickedX,y:k.pickedY,width:1,height:1},cullRect:S,effects:f,pass:`picking:${c}:z`},!0);U[3]&&(F=U[0])}k.pickedLayer&&N+1<a&&(B.add(k.pickedLayer),k.pickedLayer.disablePickingIndex(k.pickedObjectIndex)),C=Uh({pickInfo:k,lastPickedInfo:this.lastPickedInfo,mode:c,layers:d,viewports:n,x:s,y:i,z:F,pixelRatio:h});for(let U of C.values())U.layer&&P.push(U);if(!k.pickedColor)break}for(let N of B)N.restorePickingColors();return{result:P,emptyInfo:C.get(null)}}_pickClosestObject({layers:e,views:t,viewports:n,x:s,y:i,radius:o=0,depth:a=1,mode:c="query",unproject3D:l,onViewportActive:u,effects:f}){let h=this.device.canvasContext.cssToDeviceRatio(),d=this._getPickable(e);if(!d||n.length===0)return{result:[],emptyInfo:Oc({viewports:n,x:s,y:i,pixelRatio:h})};this._resizeBuffer();let g=this.device.canvasContext.cssToDevicePixels([s,i],!0),y=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],_=Math.round(o*h),{width:b,height:R}=this.pickingFBO,x=this._getPickingRect({deviceX:y[0],deviceY:y[1],deviceRadius:_,deviceWidth:b,deviceHeight:R}),S={x:s-o,y:i-o,width:o*2+1,height:o*2+1},C,P=[],B=new Set;for(let N=0;N<a;N++){let k;if(x){let U=this._drawAndSample({layers:d,views:t,viewports:n,onViewportActive:u,deviceRect:x,cullRect:S,effects:f,pass:`picking:${c}`});k=Bh({...U,deviceX:y[0],deviceY:y[1],deviceRadius:_,deviceRect:x})}else k={pickedColor:null,pickedObjectIndex:-1};let F;if(k.pickedLayer&&l&&this.depthFBO){let{pickedColors:U}=this._drawAndSample({layers:[k.pickedLayer],views:t,viewports:n,onViewportActive:u,deviceRect:{x:k.pickedX,y:k.pickedY,width:1,height:1},cullRect:S,effects:f,pass:`picking:${c}:z`},!0);U[3]&&(F=U[0])}k.pickedLayer&&N+1<a&&(B.add(k.pickedLayer),k.pickedLayer.disablePickingIndex(k.pickedObjectIndex)),C=Uh({pickInfo:k,lastPickedInfo:this.lastPickedInfo,mode:c,layers:d,viewports:n,x:s,y:i,z:F,pixelRatio:h});for(let U of C.values())U.layer&&P.push(U);if(!k.pickedColor)break}for(let N of B)N.restorePickingColors();return{result:P,emptyInfo:C.get(null)}}async _pickVisibleObjectsAsync({layers:e,views:t,viewports:n,x:s,y:i,width:o=1,height:a=1,mode:c="query",maxObjects:l=null,onViewportActive:u,effects:f}){let h=this._getPickable(e);if(!h||n.length===0)return[];this._resizeBuffer();let d=this.device.canvasContext.cssToDeviceRatio(),g=this.device.canvasContext.cssToDevicePixels([s,i],!0),y=g.x,_=g.y+g.height,b=this.device.canvasContext.cssToDevicePixels([s+o,i+a],!0),R=b.x+b.width,x=b.y,S={x:y,y:x,width:R-y,height:_-x},C=this._drawAndSample({layers:h,views:t,viewports:n,onViewportActive:u,deviceRect:S,cullRect:{x:s,y:i,width:o,height:a},effects:f,pass:`picking:${c}`}),P=Lh(C),B=new Map,N=[],k=Number.isFinite(l);for(let F=0;F<P.length&&!(k&&N.length>=l);F++){let U=P[F],X={color:U.pickedColor,layer:null,index:U.pickedObjectIndex,picked:!0,x:s,y:i,pixelRatio:d};X=kc({layer:U.pickedLayer,info:X,mode:c});let J=X.layer.id;B.has(J)||B.set(J,new Set);let q=B.get(J),pe=X.object??X.index;q.has(pe)||(q.add(pe),N.push(X))}return N}_pickVisibleObjects({layers:e,views:t,viewports:n,x:s,y:i,width:o=1,height:a=1,mode:c="query",maxObjects:l=null,onViewportActive:u,effects:f}){let h=this._getPickable(e);if(!h||n.length===0)return[];this._resizeBuffer();let d=this.device.canvasContext.cssToDeviceRatio(),g=this.device.canvasContext.cssToDevicePixels([s,i],!0),y=g.x,_=g.y+g.height,b=this.device.canvasContext.cssToDevicePixels([s+o,i+a],!0),R=b.x+b.width,x=b.y,S={x:y,y:x,width:R-y,height:_-x},C=this._drawAndSample({layers:h,views:t,viewports:n,onViewportActive:u,deviceRect:S,cullRect:{x:s,y:i,width:o,height:a},effects:f,pass:`picking:${c}`}),P=Lh(C),B=new Map,N=[],k=Number.isFinite(l);for(let F=0;F<P.length&&!(k&&N.length>=l);F++){let U=P[F],X={color:U.pickedColor,layer:null,index:U.pickedObjectIndex,picked:!0,x:s,y:i,pixelRatio:d};X=kc({layer:U.pickedLayer,info:X,mode:c});let J=X.layer.id;B.has(J)||B.set(J,new Set);let q=B.get(J),pe=X.object??X.index;q.has(pe)||(q.add(pe),N.push(X))}return N}async _drawAndSampleAsync({layers:e,views:t,viewports:n,onViewportActive:s,deviceRect:i,cullRect:o,effects:a,pass:c},l=!1){let u=l?this.depthFBO:this.pickingFBO,f={layers:e,layerFilter:this.layerFilter,views:t,viewports:n,onViewportActive:s,pickingFBO:u,deviceRect:i,cullRect:o,effects:a,pass:c,pickZ:l,preRenderStats:{},isPicking:!0};for(let R of a)R.useInPicking&&(f.preRenderStats[R.id]=R.preRender(f));let{decodePickingColor:h}=this.pickLayersPass.render(f),{x:d,y:g,width:y,height:_}=i,b=new(l?Float32Array:Uint8Array)(y*_*4);return this.device.readPixelsToArrayWebGL(u,{sourceX:d,sourceY:g,sourceWidth:y,sourceHeight:_,target:b}),{pickedColors:b,decodePickingColor:h}}_drawAndSample({layers:e,views:t,viewports:n,onViewportActive:s,deviceRect:i,cullRect:o,effects:a,pass:c},l=!1){let u=l?this.depthFBO:this.pickingFBO,f={layers:e,layerFilter:this.layerFilter,views:t,viewports:n,onViewportActive:s,pickingFBO:u,deviceRect:i,cullRect:o,effects:a,pass:c,pickZ:l,preRenderStats:{},isPicking:!0};for(let R of a)R.useInPicking&&(f.preRenderStats[R.id]=R.preRender(f));let{decodePickingColor:h}=this.pickLayersPass.render(f),{x:d,y:g,width:y,height:_}=i,b=new(l?Float32Array:Uint8Array)(y*_*4);return this.device.readPixelsToArrayWebGL(u,{sourceX:d,sourceY:g,sourceWidth:y,sourceHeight:_,target:b}),{pickedColors:b,decodePickingColor:h}}_getPickingRect({deviceX:e,deviceY:t,deviceRadius:n,deviceWidth:s,deviceHeight:i}){let o=Math.max(0,e-n),a=Math.max(0,t-n),c=Math.min(s,e+n+1)-o,l=Math.min(i,t+n+1)-a;return c<=0||l<=0?null:{x:o,y:a,width:c,height:l}}};var wA={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},vA="top-left",$_="__root",Nc=class{constructor({deck:e,parentElement:t}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,t?.classList.add("deck-widget-container"),this.parentElement=t}getWidgets(){return this.resolvedWidgets}setProps(e){if(e.widgets&&!le(e.widgets,this.widgets,1)){let t=e.widgets.filter(Boolean);this._setWidgets(t)}}finalize(){for(let e of this.getWidgets())this._removeWidget(e);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(let e in this.containers)this.containers[e].remove()}addDefault(e){this.defaultWidgets.find(t=>t.id===e.id)||(this._addWidget(e),this.defaultWidgets.push(e),this._setWidgets(this.widgets))}onRedraw({viewports:e,layers:t}){let n=e.reduce((s,i)=>(s[i.id]=i,s),{});for(let s of this.getWidgets()){let{viewId:i}=s;if(i){let o=n[i];o&&(s.onViewportChange&&s.onViewportChange(o),s.onRedraw?.({viewports:[o],layers:t}))}else{if(s.onViewportChange)for(let o of e)s.onViewportChange(o);s.onRedraw?.({viewports:e,layers:t})}}this.lastViewports=n,this._updateContainers()}onHover(e,t){for(let n of this.getWidgets()){let{viewId:s}=n;(!s||s===e.viewport?.id)&&n.onHover?.(e,t)}}onEvent(e,t){let n=Ni[t.type];if(n)for(let s of this.getWidgets()){let{viewId:i}=s;(!i||i===e.viewport?.id)&&s[n]?.(e,t)}}_setWidgets(e){let t={};for(let n of this.resolvedWidgets)t[n.id]=n;this.resolvedWidgets.length=0;for(let n of this.defaultWidgets)t[n.id]=null,this.resolvedWidgets.push(n);for(let n of e){let s=t[n.id];s?s.viewId!==n.viewId||s.placement!==n.placement?(this._removeWidget(s),this._addWidget(n)):n!==s&&(s.setProps(n.props),n=s):this._addWidget(n),t[n.id]=null,this.resolvedWidgets.push(n)}for(let n in t){let s=t[n];s&&this._removeWidget(s)}this.widgets=e}_addWidget(e){let{viewId:t=null,placement:n=vA}=e;e.widgetManager=this,e.deck=this.deck,e.rootElement=e.onCreateRootElement(),e.rootElement&&this._getContainer(t,n).append(e.rootElement),e.onAdd?.({deck:this.deck,viewId:t}),e.updateHTML()}_removeWidget(e){e.onRemove?.(),e.rootElement&&e.rootElement.remove(),e.rootElement=void 0,e.deck=void 0,e.widgetManager=void 0}_getContainer(e,t){let n=e||$_,s=this.containers[n];s||(s=document.createElement("div"),s.style.pointerEvents="none",s.style.position="absolute",s.style.overflow="hidden",this.parentElement?.append(s),this.containers[n]=s);let i=s.querySelector(`.${t}`);return i||(i=globalThis.document.createElement("div"),i.className=t,i.style.position="absolute",i.style.zIndex="2",Object.assign(i.style,wA[t]),s.append(i)),i}_updateContainers(){let e=this.deck.width,t=this.deck.height;for(let n in this.containers){let s=this.lastViewports[n]||null,i=n===$_||s,o=this.containers[n];i?(o.style.display="block",o.style.left=`${s?s.x:0}px`,o.style.top=`${s?s.y:0}px`,o.style.width=`${s?s.width:e}px`,o.style.height=`${s?s.height:t}px`):o.style.display="none"}}};function to(r,e){e&&Object.entries(e).map(([t,n])=>{t.startsWith("--")?r.style.setProperty(t,n):r.style[t]=n})}function Dc(r,e){e&&Object.keys(e).map(t=>{t.startsWith("--")?r.style.removeProperty(t):r.style[t]=""})}var Fr=class{constructor(e,t){this.viewId=null,this.props={...t,...e},this.id=this.props.id}setProps(e){let t=this.props,n=this.rootElement;n&&t.className!==e.className&&(t.className&&n.classList.remove(t.className),e.className&&n.classList.add(e.className)),n&&!le(t.style,e.style,1)&&(Dc(n,t.style),to(n,e.style)),Object.assign(this.props,e),this.updateHTML()}updateHTML(){this.rootElement&&this.onRenderHTML(this.rootElement)}onCreateRootElement(){let e=["deck-widget",this.className,this.props.className],t=document.createElement("div");return e.filter(n=>typeof n=="string"&&n.length>0).forEach(n=>t.classList.add(n)),to(t,this.props.style),t}onAdd(e){}onRemove(){}onViewportChange(e){}onRedraw(e){}onHover(e,t){}onClick(e,t){}onDrag(e,t){}onDragStart(e,t){}onDragEnd(e,t){}};Fr.defaultProps={id:"widget",style:{},className:""};var AA={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"},bn=class extends Fr{constructor(e={}){super(e,bn.defaultProps),this.id="default-tooltip",this.placement="fill",this.className="deck-tooltip",this.isVisible=!1,this.setProps(e)}onCreateRootElement(){let e=document.createElement("div");return e.className=this.className,Object.assign(e.style,AA),e}onRenderHTML(e){}onViewportChange(e){this.isVisible&&e.id===this.lastViewport?.id&&e!==this.lastViewport&&this.setTooltip(null)}onHover(e){let{deck:t}=this,n=t&&t.props.getTooltip;if(!n)return;let s=n(e);this.lastViewport=e.viewport,this.setTooltip(s,e.x,e.y)}setTooltip(e,t,n){let s=this.rootElement;if(s){if(typeof e=="string")s.innerText=e;else if(e)e.text&&(s.innerText=e.text),e.html&&(s.innerHTML=e.html),e.className&&(s.className=e.className);else{this.isVisible=!1,s.style.display="none";return}this.isVisible=!0,s.style.display="block",s.style.transform=`translate(${t}px, ${n}px)`,e&&typeof e=="object"&&"style"in e&&Object.assign(s.style,e.style)}}};bn.defaultProps={...Fr.defaultProps};j();il();Cs();function Ur(){}var PS=({isDragging:r})=>r?"grabbing":"grab",dx={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{},gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:Ur,onWebGLInitialized:Ur,onResize:Ur,onViewStateChange:Ur,onInteractionStateChange:Ur,onBeforeRender:Ur,onAfterRender:Ur,onLoad:Ur,onError:r=>H.error(r.message,r.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:PS,getTooltip:null,debug:!1,drawPickingColors:!1},lo=class{constructor(e){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new Ke({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this._lastPointerDownInfo=null,this._onPointerMove=n=>{let{_pickRequest:s}=this;if(n.type==="pointerleave")s.x=-1,s.y=-1,s.radius=0;else{if(n.leftButton||n.rightButton)return;{let i=n.offsetCenter;if(!i)return;s.x=i.x,s.y=i.y,s.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:s.x,y:s.y}),s.event=n},this._onEvent=n=>{let s=Ni[n.type],i=n.offsetCenter;if(!s||!i||!this.layerManager)return;let o=this.layerManager.getLayers(),a=this.deckPicker.getLastPickedObject({x:i.x,y:i.y,layers:o,viewports:this.getViewports(i)},this._lastPointerDownInfo),{layer:c}=a,l=c&&(c[s]||c.props[s]),u=this.props[s],f=!1;l&&(f=l.call(c,a,n)),f||(u?.(a,n),this.widgetManager.onEvent(a,n))},this._onPointerDown=n=>{if(this.device?.type==="webgpu")return;let s=n.offsetCenter,i=this._pick("pickObject","pickObject Time",{x:s.x,y:s.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=i.result[0]||i.emptyInfo},this.props={...dx,...e},e=this.props,e.viewState&&e.initialViewState&&H.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,e.device&&(this.device=e.device);let t=this.device;!t&&e.gl&&(e.gl instanceof WebGLRenderingContext&&H.error("WebGL1 context not supported.")(),t=co.attach(e.gl)),t||(t=this._createDevice(e)),this.animationLoop=this._createAnimationLoop(t,e),this.setProps(e),e._typedArrayManagerProps&&bt.setOptions(e._typedArrayManagerProps),this.animationLoop.start()}finalize(){this.animationLoop?.stop(),this.animationLoop?.destroy(),this.animationLoop=null,this._lastPointerDownInfo=null,this.layerManager?.finalize(),this.layerManager=null,this.viewManager?.finalize(),this.viewManager=null,this.effectManager?.finalize(),this.effectManager=null,this.deckRenderer?.finalize(),this.deckRenderer=null,this.deckPicker?.finalize(),this.deckPicker=null,this.eventManager?.destroy(),this.eventManager=null,this.widgetManager?.finalize(),this.widgetManager=null,!this.props.canvas&&!this.props.device&&!this.props.gl&&this.canvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null)}setProps(e){this.stats.get("setProps Time").timeStart(),"onLayerHover"in e&&H.removed("onLayerHover","onHover")(),"onLayerClick"in e&&H.removed("onLayerClick","onClick")(),e.initialViewState&&!le(this.props.initialViewState,e.initialViewState,3)&&(this.viewState=e.initialViewState),Object.assign(this.props,e),this._setCanvasSize(this.props);let t=Object.create(this.props);if(Object.assign(t,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),e.device&&e.device.id!==this.device?.id&&(this.animationLoop?.stop(),this.canvas!==e.device.canvasContext?.canvas&&(this.canvas?.remove(),this.eventManager?.destroy(),this.canvas=null),H.log(`recreating animation loop for new device! id=${e.device.id}`),this.animationLoop=this._createAnimationLoop(e.device,e),this.animationLoop.start()),this.animationLoop?.setProps(t),e.useDevicePixels!==void 0&&this.device?.canvasContext?.canvas instanceof HTMLCanvasElement){this.device.canvasContext.props.useDevicePixels=e.useDevicePixels;let n=this.device.canvasContext.canvas,s={target:n,contentBoxSize:[{inlineSize:n.clientWidth,blockSize:n.clientHeight}],devicePixelContentBoxSize:[{inlineSize:n.clientWidth,blockSize:n.clientHeight}],borderBoxSize:[{inlineSize:n.clientWidth,blockSize:n.clientHeight}]};this.device.canvasContext._handleResize([s])}this.layerManager&&(this.viewManager.setProps(t),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(t),this.effectManager.setProps(t),this.deckRenderer.setProps(t),this.deckPicker.setProps(t),this.widgetManager.setProps(t)),this.stats.get("setProps Time").timeEnd()}needsRedraw(e={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let t=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);let n=this.viewManager.needsRedraw(e),s=this.layerManager.needsRedraw(e),i=this.effectManager.needsRedraw(e),o=this.deckRenderer.needsRedraw(e);return t=t||n||s||i||o,t}redraw(e){if(!this.layerManager)return;let t=this.needsRedraw({clearRedrawFlags:!0});t=e||t,t&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(t):this._drawLayers(t))}get isInitialized(){return this.viewManager!==null}getViews(){return oe(this.viewManager),this.viewManager.views}getViewports(e){return oe(this.viewManager),this.viewManager.getViewports(e)}getCanvas(){return this.canvas}pickObject(e){let t=this._pick("pickObject","pickObject Time",e).result;return t.length?t[0]:null}pickMultipleObjects(e){return e.depth=e.depth||10,this._pick("pickObject","pickMultipleObjects Time",e).result}pickObjects(e){return this._pick("pickObjects","pickObjects Time",e)}_addResources(e,t=!1){for(let n in e)this.layerManager.resourceManager.add({resourceId:n,data:e[n],forceUpdate:t})}_removeResources(e){for(let t of e)this.layerManager.resourceManager.remove(t)}_addDefaultEffect(e){this.effectManager.addDefaultEffect(e)}_addDefaultShaderModule(e){this.layerManager.addDefaultShaderModule(e)}_removeDefaultShaderModule(e){this.layerManager?.removeDefaultShaderModule(e)}_pick(e,t,n){oe(this.deckPicker);let{stats:s}=this;s.get("Pick Count").incrementCount(),s.get(t).timeStart();let i=this.deckPicker[e]({layers:this.layerManager.getLayers(n),views:this.viewManager.getViews(),viewports:this.getViewports(n),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...n});return s.get(t).timeEnd(),i}_createCanvas(e){let t=e.canvas;return typeof t=="string"&&(t=document.getElementById(t),oe(t)),t||(t=document.createElement("canvas"),t.id=e.id||"deckgl-overlay",e.width&&typeof e.width=="number"&&(t.width=e.width),e.height&&typeof e.height=="number"&&(t.height=e.height),(e.parent||document.body).appendChild(t)),Object.assign(t.style,e.style),t}_setCanvasSize(e){if(!this.canvas)return;let{width:t,height:n}=e;if(t||t===0){let s=Number.isFinite(t)?`${t}px`:t;this.canvas.style.width=s}if(n||n===0){let s=Number.isFinite(n)?`${n}px`:n;this.canvas.style.position=e.style?.position||"absolute",this.canvas.style.height=s}}_updateCanvasSize(){let{canvas:e}=this;if(!e)return;let t=e.clientWidth??e.width,n=e.clientHeight??e.height;(t!==this.width||n!==this.height)&&(this.width=t,this.height=n,this.viewManager?.setProps({width:t,height:n}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:t,height:n}))}_createAnimationLoop(e,t){let{gl:n,onError:s}=t;return new jn({device:e,autoResizeDrawingBuffer:!n,autoResizeViewport:!1,onInitialize:i=>this._setDevice(i.device),onRender:this._onRenderFrame.bind(this),onError:s})}_createDevice(e){let t=this.props.deviceProps?.createCanvasContext,n=typeof t=="object"?t:void 0,s={adapters:[],...e.deviceProps};s.adapters.includes(co)||s.adapters.push(co);let i={alphaMode:this.props.deviceProps?.type==="webgpu"?"premultiplied":void 0};return mr.createDevice({_reuseDevices:!0,type:"webgl",...s,createCanvasContext:{...i,...n,canvas:this._createCanvas(e),useDevicePixels:this.props.useDevicePixels,autoResize:!0}})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let{views:e}=this.props,t=Array.isArray(e)?e:e?[e]:[new Mc({id:"default-view"})];return t.length&&this.props.controller&&(t[0].props.controller=this.props.controller),t}_onContextLost(){let{onError:e}=this.props;this.animationLoop&&e&&e(new Error("WebGL context is lost"))}_pickAndCallback(){if(this.device?.type==="webgpu")return;let{_pickRequest:e}=this;if(e.event){let{result:t,emptyInfo:n}=this._pick("pickObject","pickObject Time",e);this.cursorState.isHovering=t.length>0;let s=n,i=!1;for(let o of t)s=o,i=o.layer?.onHover(o,e.event)||i;i||(this.props.onHover?.(s,e.event),this.widgetManager.onHover(s,e.event)),e.event=null}}_updateCursor(){let e=this.props.parent||this.canvas;e&&(e.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(e){if(this.device=e,!this.animationLoop)return;this.canvas||(this.canvas=this.device.canvasContext?.canvas,!this.canvas.isConnected&&this.props.parent&&this.props.parent.insertBefore(this.canvas,this.props.parent.firstChild)),this.device.type==="webgl"&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device.type==="webgl"&&this.props.onWebGLInitialized(this.device.gl);let t=new qr;t.play(),this.animationLoop.attachTimeline(t),this.eventManager=new ki(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizers:Object.keys(wh).map(s=>{let[i,o,a,c]=wh[s],l=this.props.eventRecognizerOptions?.[s],u={...o,...l,event:s};return{recognizer:new i(u),recognizeWith:a,requestFailure:c}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let s in Ni)this.eventManager.on(s,this._onEvent);this.viewManager=new qi({timeline:t,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let n=this.viewManager.getViewports()[0];this.layerManager=new gn(this.device,{deck:this,stats:this.stats,viewport:n,timeline:t}),this.effectManager=new Qi({deck:this,device:this.device}),this.deckRenderer=new xn(this.device),this.deckPicker=new eo(this.device),this.widgetManager=new Nc({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new bn),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(e,t){let{device:n,gl:s}=this.layerManager.context;this.props.onBeforeRender({device:n,gl:s});let i={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...t};this.deckRenderer?.renderLayers(i),i.pass==="screen"&&this.widgetManager.onRedraw({viewports:i.viewports,layers:i.layers}),this.props.onAfterRender({device:n,gl:s})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),H.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this.device?.type!=="webgpu"&&this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(e){let t=this.props.onViewStateChange(e)||e.viewState;this.viewState&&(this.viewState={...this.viewState,[e.viewId]:t},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(e){this.cursorState.isDragging=e.isDragging||!1,this.props.onInteractionStateChange(e)}_getFrameStats(){let{stats:e}=this;e.get("frameRate").timeEnd(),e.get("frameRate").timeStart();let t=this.animationLoop.stats;e.get("GPU Time").addTime(t.get("GPU Time").lastTiming),e.get("CPU Time").addTime(t.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:e,stats:t}=this;e.fps=t.get("frameRate").getHz(),e.setPropsTime=t.get("setProps Time").time,e.updateAttributesTime=t.get("Update Attributes").time,e.framesRedrawn=t.get("Redraw Count").count,e.pickTime=t.get("pickObject Time").time+t.get("pickMultipleObjects Time").time+t.get("pickObjects Time").time,e.pickCount=t.get("Pick Count").count,e.gpuTime=t.get("GPU Time").time,e.cpuTime=t.get("CPU Time").time,e.gpuTimePerFrame=t.get("GPU Time").getAverageTime(),e.cpuTimePerFrame=t.get("CPU Time").getAverageTime();let n=mr.stats.get("Memory Usage");e.bufferMemory=n.get("Buffer Memory").count,e.textureMemory=n.get("Texture Memory").count,e.renderbufferMemory=n.get("Renderbuffer Memory").count,e.gpuMemory=n.get("GPU Memory").count}};lo.defaultProps=dx;lo.VERSION=nc;var ll=lo;j();j();function px(r){switch(r){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return jr(r)}}var mx=$r;function uo(r,e,t){let n=t==="webgpu"&&e.type==="uint8"?"unorm8":e.type;return{attribute:r,format:e.size>1?`${n}x${e.size}`:e.type,byteOffset:e.offset||0}}function Vr(r){return r.stride||r.size*r.bytesPerElement}function gx(r,e){return r.type===e.type&&r.size===e.size&&Vr(r)===Vr(e)&&(r.offset||0)===(e.offset||0)}function cd(r,e){e.offset&&H.removed("shaderAttribute.offset","vertexOffset, elementOffset")();let t=Vr(r),n=e.vertexOffset!==void 0?e.vertexOffset:r.vertexOffset||0,s=e.elementOffset||0,i=n*t+s*r.bytesPerElement+(r.offset||0);return{...e,offset:i,stride:t}}function CS(r,e){let t=cd(r,e);return{high:t,low:{...t,offset:t.offset+r.size*4}}}var fo=class{constructor(e,t,n){this._buffer=null,this.device=e,this.id=t.id||"",this.size=t.size||1;let s=t.logicalType||t.type,i=s==="float64",{defaultValue:o}=t;o=Number.isFinite(o)?[o]:o||new Array(this.size).fill(0);let a;i?a="float32":!s&&t.isIndexed?a="uint32":a=s||"float32";let c=px(s||a);this.doublePrecision=i,i&&t.fp64===!1&&(c=Float32Array),this.value=null,this.settings={...t,defaultType:c,defaultValue:o,logicalType:s,type:a,normalized:a.includes("norm"),size:this.size,bytesPerElement:c.BYTES_PER_ELEMENT},this.state={...n,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){let e=this.getAccessor();return e.vertexOffset?e.vertexOffset*Vr(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),bt.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(e=this.id,t=null){let n={};if(this.state.constant){let s=this.value;if(t){let i=cd(this.getAccessor(),t),o=i.offset/s.BYTES_PER_ELEMENT,a=i.size||this.size;n[e]=s.subarray(o,o+a)}else n[e]=s}else n[e]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?n[`${e}64Low`]=n[e]:n[`${e}64Low`]=new Float32Array(this.size)),n}_getBufferLayout(e=this.id,t=null){let n=this.getAccessor(),s=[],i={name:this.id,byteStride:Vr(n),attributes:s};if(this.doublePrecision){let o=CS(n,t||{});s.push(uo(e,{...n,...o.high},this.device.type),uo(`${e}64Low`,{...n,...o.low},this.device.type))}else if(t){let o=cd(n,t);s.push(uo(e,{...n,...o},this.device.type))}else s.push(uo(e,n,this.device.type));return i}setAccessor(e){this.state.bufferAccessor=e}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let e=null;if(this.state.constant&&this.value){let t=Array.from(this.value);e=[t,t]}else{let{value:t,numInstances:n,size:s}=this,i=n*s;if(t&&i&&t.length>=i){let o=new Array(s).fill(1/0),a=new Array(s).fill(-1/0);for(let c=0;c<i;)for(let l=0;l<s;l++){let u=t[c++];u<o[l]&&(o[l]=u),u>a[l]&&(a[l]=u)}e=[o,a]}}return this.state.bounds=e,e}setData(e){let{state:t}=this,n;ArrayBuffer.isView(e)?n={value:e}:e instanceof W?n={buffer:e}:n=e;let s={...this.settings,...n};if(ArrayBuffer.isView(n.value)){if(!n.type)if(this.doublePrecision&&n.value instanceof Float64Array)s.type="float32";else{let o=mx(n.value);s.type=s.normalized?o.replace("int","norm"):o}s.bytesPerElement=n.value.BYTES_PER_ELEMENT,s.stride=Vr(s)}if(t.bounds=null,n.constant){let i=n.value;if(i=this._normalizeValue(i,[],0),this.settings.normalized&&(i=this.normalizeConstant(i)),!(!t.constant||!this._areValuesEqual(i,this.value)))return!1;t.externalBuffer=null,t.constant=!0,this.value=ArrayBuffer.isView(i)?i:new Float32Array(i)}else if(n.buffer){let i=n.buffer;t.externalBuffer=i,t.constant=!1,this.value=n.value||null}else if(n.value){this._checkExternalBuffer(n);let i=n.value;t.externalBuffer=null,t.constant=!1,this.value=i;let{buffer:o}=this,a=Vr(s),c=(s.vertexOffset||0)*a;if(this.doublePrecision&&i instanceof Float64Array&&(i=vc(i,s)),this.settings.isIndexed){let u=this.settings.defaultType;i.constructor!==u&&(i=new u(i))}let l=i.byteLength+c+a*2;(!o||o.byteLength<l)&&(o=this._createBuffer(l)),o.write(i,c)}return this.setAccessor(s),!0}updateSubBuffer(e={}){this.state.bounds=null;let t=this.value,{startOffset:n=0,endOffset:s}=e;this.buffer.write(this.doublePrecision&&t instanceof Float64Array?vc(t,{size:this.size,startIndex:n,endIndex:s}):t.subarray(n,s),n*t.BYTES_PER_ELEMENT+this.byteOffset)}allocate(e,t=!1){let{state:n}=this,s=n.allocatedValue,i=bt.allocate(s,e+1,{size:this.size,type:this.settings.defaultType,copy:t});this.value=i;let{byteOffset:o}=this,{buffer:a}=this;return(!a||a.byteLength<i.byteLength+o)&&(a=this._createBuffer(i.byteLength+o),t&&s&&a.write(s instanceof Float64Array?vc(s,this):s,o)),n.allocatedValue=i,n.constant=!1,n.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(e){let{value:t}=e;if(!ArrayBuffer.isView(t))throw new Error(`Attribute ${this.id} value is not TypedArray`);let n=this.settings.defaultType,s=!1;if(this.doublePrecision&&(s=t.BYTES_PER_ELEMENT<4),s)throw new Error(`Attribute ${this.id} does not support ${t.constructor.name}`);!(t instanceof n)&&this.settings.normalized&&!("normalized"in e)&&H.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(e){switch(this.settings.type){case"snorm8":return new Float32Array(e).map(t=>(t+128)/255*2-1);case"snorm16":return new Float32Array(e).map(t=>(t+32768)/65535*2-1);case"unorm8":return new Float32Array(e).map(t=>t/255);case"unorm16":return new Float32Array(e).map(t=>t/65535);default:return e}}_normalizeValue(e,t,n){let{defaultValue:s,size:i}=this.settings;if(Number.isFinite(e))return t[n]=e,t;if(!e){let o=i;for(;--o>=0;)t[n+o]=s[o];return t}switch(i){case 4:t[n+3]=Number.isFinite(e[3])?e[3]:s[3];case 3:t[n+2]=Number.isFinite(e[2])?e[2]:s[2];case 2:t[n+1]=Number.isFinite(e[1])?e[1]:s[1];case 1:t[n+0]=Number.isFinite(e[0])?e[0]:s[0];break;default:let o=i;for(;--o>=0;)t[n+o]=Number.isFinite(e[o])?e[o]:s[o]}return t}_areValuesEqual(e,t){if(!e||!t)return!1;let{size:n}=this;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}_createBuffer(e){this._buffer&&this._buffer.destroy();let{isIndexed:t,type:n}=this.settings;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:(t?W.INDEX:W.VERTEX)|W.COPY_DST,indexType:t?n:void 0,byteLength:e}),this._buffer}};var _x=[],yx=[];function Ss(r,e=0,t=1/0){let n=_x,s={index:-1,data:r,target:[]};return r?typeof r[Symbol.iterator]=="function"?n=r:r.length>0&&(yx.length=r.length,n=yx):n=_x,(e>0||Number.isFinite(t))&&(n=(Array.isArray(n)?n:Array.from(n)).slice(e,t),s.index=e-1),{iterable:n,objectInfo:s}}function ul(r){return r&&r[Symbol.asyncIterator]}function fl(r,e){let{size:t,stride:n,offset:s,startIndices:i,nested:o}=e,a=r.BYTES_PER_ELEMENT,c=n?n/a:t,l=s?s/a:0,u=Math.floor((r.length-l)/c);return(f,{index:h,target:d})=>{if(!i){let b=h*c+l;for(let R=0;R<t;R++)d[R]=r[b+R];return d}let g=i[h],y=i[h+1]||u,_;if(o){_=new Array(y-g);for(let b=g;b<y;b++){let R=b*c+l;d=new Array(t);for(let x=0;x<t;x++)d[x]=r[R+x];_[b-g]=d}}else if(c===t)_=r.subarray(g*t+l,y*t+l);else{_=new r.constructor((y-g)*t);let b=0;for(let R=g;R<y;R++){let x=R*c+l;for(let S=0;S<t;S++)_[b++]=r[x+S]}}return _}}var xx=[],ho=[[0,1/0]];function bx(r,e){if(r===ho||(e[0]<0&&(e[0]=0),e[0]>=e[1]))return r;let t=[],n=r.length,s=0;for(let i=0;i<n;i++){let o=r[i];o[1]<e[0]?(t.push(o),s=i+1):o[0]>e[1]?t.push(o):e=[Math.min(o[0],e[0]),Math.max(o[1],e[1])]}return t.splice(s,0,e),t}var OS={interpolation:{duration:0,easing:r=>r},spring:{stiffness:.05,damping:.5}};function hl(r,e){if(!r)return null;Number.isFinite(r)&&(r={type:"interpolation",duration:r});let t=r.type||"interpolation";return{...OS[t],...e,...r,type:t}}var hr=class extends fo{constructor(e,t){super(e,t,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:ho}),this.constant=!1,this.settings.update=t.update||(t.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(e){this.state.startIndices=e}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:e=!1}={}){let t=this.state.needsRedraw;return this.state.needsRedraw=t&&!e,t}layoutChanged(){return this.state.layoutChanged}setAccessor(e){var t;(t=this.state).layoutChanged||(t.layoutChanged=!gx(e,this.getAccessor())),super.setAccessor(e)}getUpdateTriggers(){let{accessor:e}=this.settings;return[this.id].concat(typeof e!="function"&&e||[])}supportsTransition(){return Boolean(this.settings.transition)}getTransitionSetting(e){if(!e||!this.supportsTransition())return null;let{accessor:t}=this.settings,n=this.settings.transition,s=Array.isArray(t)?e[t.find(i=>e[i])]:e[t];return hl(s,n)}setNeedsUpdate(e=this.id,t){if(this.state.needsUpdate=this.state.needsUpdate||e,this.setNeedsRedraw(e),t){let{startRow:n=0,endRow:s=1/0}=t;this.state.updateRanges=bx(this.state.updateRanges,[n,s])}else this.state.updateRanges=ho}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=xx}setNeedsRedraw(e=this.id){this.state.needsRedraw=this.state.needsRedraw||e}allocate(e){let{state:t,settings:n}=this;return n.noAlloc?!1:n.update?(super.allocate(e,t.updateRanges!==ho),!0):!1}updateBuffer({numInstances:e,data:t,props:n,context:s}){if(!this.needsUpdate())return!1;let{state:{updateRanges:i},settings:{update:o,noAlloc:a}}=this,c=!0;if(o){for(let[l,u]of i)o.call(s,this,{data:t,startRow:l,endRow:u,props:n,numInstances:e});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(let[l,u]of i){let f=Number.isFinite(l)?this.getVertexOffset(l):0,h=Number.isFinite(u)?this.getVertexOffset(u):a||!Number.isFinite(e)?this.value.length:e*this.size;super.updateSubBuffer({startOffset:f,endOffset:h})}this._checkAttributeArray()}else c=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),c}setConstantValue(e){let t=this.device.type==="webgpu";if(t||e===void 0||typeof e=="function"){if(t&&typeof e!="function"){let s=this._normalizeValue(e,[],0);this._areValuesEqual(s,this.value)||this.setNeedsUpdate("WebGPU constant updated")}return!1}return this.setData({constant:!0,value:e})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0}setExternalBuffer(e){let{state:t}=this;return e?(this.clearNeedsUpdate(),t.lastExternalBuffer===e||(t.lastExternalBuffer=e,this.setNeedsRedraw(),this.setData(e)),!0):(t.lastExternalBuffer=null,!1)}setBinaryValue(e,t=null){let{state:n,settings:s}=this;if(!e)return n.binaryValue=null,n.binaryAccessor=null,!1;if(s.noAlloc)return!1;if(n.binaryValue===e)return this.clearNeedsUpdate(),!0;if(n.binaryValue=e,this.setNeedsRedraw(),s.transform||t!==this.startIndices){ArrayBuffer.isView(e)&&(e={value:e});let o=e;oe(ArrayBuffer.isView(o.value),`invalid ${s.accessor}`);let a=Boolean(o.size)&&o.size!==this.size;return n.binaryAccessor=fl(o.value,{size:o.size||this.size,stride:o.stride,offset:o.offset,startIndices:t,nested:a}),!1}return this.clearNeedsUpdate(),this.setData(e),!0}getVertexOffset(e){let{startIndices:t}=this;return(t?e<t.length?t[e]:this.numInstances:e)*this.size}getValue(){let e=this.settings.shaderAttributes,t=super.getValue();if(!e)return t;for(let n in e)Object.assign(t,super.getValue(n,e[n]));return t}getBufferLayout(e){this.state.layoutChanged=!1;let t=this.settings.shaderAttributes,n=super._getBufferLayout(),{stepMode:s}=this.settings;if(s==="dynamic"?n.stepMode=e?e.isInstanced?"instance":"vertex":"instance":n.stepMode=s??"vertex",!t)return n;for(let i in t){let o=super._getBufferLayout(i,t[i]);n.attributes.push(...o.attributes)}return n}_autoUpdater(e,{data:t,startRow:n,endRow:s,props:i,numInstances:o}){if(e.constant&&this.context.device.type!=="webgpu")return;let{settings:a,state:c,value:l,size:u,startIndices:f}=e,{accessor:h,transform:d}=a,g=c.binaryAccessor||(typeof h=="function"?h:i[h]);typeof g!="function"&&typeof h=="string"&&(g=()=>i[h]),oe(typeof g=="function",`accessor "${h}" is not a function`);let y=e.getVertexOffset(n),{iterable:_,objectInfo:b}=Ss(t,n,s);for(let R of _){b.index++;let x=g(R,b);if(d&&(x=d.call(this,x)),f){let S=(b.index<f.length-1?f[b.index+1]:o)-f[b.index];if(x&&Array.isArray(x[0])){let C=y;for(let P of x)e._normalizeValue(P,l,C),C+=u}else x&&x.length>u?l.set(x,y):(e._normalizeValue(x,b.target,0),Ic({target:l,source:b.target,start:y,count:S}));y+=S*u}else e._normalizeValue(x,l,y),y+=u}}_validateAttributeUpdaters(){let{settings:e}=this;if(!(e.noAlloc||typeof e.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){let{value:e}=this,t=Math.min(4,this.size);if(e&&e.length>=t){let n=!0;switch(t){case 4:n=n&&Number.isFinite(e[3]);case 3:n=n&&Number.isFinite(e[2]);case 2:n=n&&Number.isFinite(e[1]);case 1:n=n&&Number.isFinite(e[0]);break;default:n=!1}if(!n)throw new Error(`Illegal attribute generated for ${this.id}`)}}};function ld(r){let{source:e,target:t,start:n=0,size:s,getData:i}=r,o=r.end||t.length,a=e.length,c=o-n;if(a>c){t.set(e.subarray(0,c),n);return}if(t.set(e,n),!i)return;let l=a;for(;l<c;){let u=i(l,e);for(let f=0;f<s;f++)t[n+l]=u[f]||0,l++}}function Tx({source:r,target:e,size:t,getData:n,sourceStartIndices:s,targetStartIndices:i}){if(!s||!i)return ld({source:r,target:e,size:t,getData:n}),e;let o=0,a=0,c=n&&((u,f)=>n(u+a,f)),l=Math.min(s.length,i.length);for(let u=1;u<l;u++){let f=s[u]*t,h=i[u]*t;ld({source:r.subarray(o,f),target:e,start:a,end:h,size:t,getData:c}),o=f,a=h}return a<e.length&&ld({source:[],target:e,start:a,size:t,getData:c}),e}function wx(r){let{device:e,settings:t,value:n}=r,s=new hr(e,t);return s.setData({value:n instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:t.normalized}),s}function dl(r){switch(r){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`No defined attribute type for size "${r}"`)}}function pl(r){switch(r){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw new Error("invalid type size")}}function ml(r){r.push(r.shift())}function vx(r,e){let{doublePrecision:t,settings:n,value:s,size:i}=r,o=t&&s instanceof Float64Array?2:1,a=0,{shaderAttributes:c}=r.settings;if(c)for(let l of Object.values(c))a=Math.max(a,l.vertexOffset??0);return(n.noAlloc?s.length:(e+a)*i)*o}function gl({device:r,source:e,target:t}){return(!t||t.byteLength<e.byteLength)&&(t?.destroy(),t=r.createBuffer({byteLength:e.byteLength,usage:e.usage})),t}function _l({device:r,buffer:e,attribute:t,fromLength:n,toLength:s,fromStartIndices:i,getData:o=a=>a}){let a=t.doublePrecision&&t.value instanceof Float64Array?2:1,c=t.size*a,l=t.byteOffset,u=t.settings.bytesPerElement<4?l/t.settings.bytesPerElement*4:l,f=t.startIndices,h=i&&f,d=t.isConstant;if(!h&&e&&n>=s)return e;let g=t.value instanceof Float64Array?Float32Array:t.value.constructor,y=d?t.value:new g(t.getBuffer().readSyncWebGL(l,s*g.BYTES_PER_ELEMENT).buffer);if(t.settings.normalized&&!d){let x=o;o=(S,C)=>t.normalizeConstant(x(S,C))}let _=d?(x,S)=>o(y,S):(x,S)=>o(y.subarray(x+l,x+l+c),S),b=e?new Float32Array(e.readSyncWebGL(u,n*4).buffer):new Float32Array(0),R=new Float32Array(s);return Tx({source:b,target:R,sourceStartIndices:i,targetStartIndices:f,size:c,getData:_}),(!e||e.byteLength<R.byteLength+u)&&(e?.destroy(),e=r.createBuffer({byteLength:R.byteLength+u,usage:35050})),e.write(R,u),e}var Es=class{constructor({device:e,attribute:t,timeline:n}){this.buffers=[],this.currentLength=0,this.device=e,this.transition=new wt(n),this.attribute=t,this.attributeInTransition=wx(t),this.currentStartIndices=t.startIndices}get inProgress(){return this.transition.inProgress}start(e,t,n=1/0){this.settings=e,this.currentStartIndices=this.attribute.startIndices,this.currentLength=vx(this.attribute,t),this.transition.start({...e,duration:n})}update(){let e=this.transition.update();return e&&this.onUpdate(),e}setBuffer(e){this.attributeInTransition.setData({buffer:e,normalized:this.attribute.settings.normalized,value:this.attributeInTransition.value})}cancel(){this.transition.cancel()}delete(){this.cancel();for(let e of this.buffers)e.destroy();this.buffers.length=0}};var po=class extends Es{constructor({device:e,attribute:t,timeline:n}){super({device:e,attribute:t,timeline:n}),this.type="interpolation",this.transform=FS(e,t)}start(e,t){let n=this.currentLength,s=this.currentStartIndices;if(super.start(e,t,e.duration),e.duration<=0){this.transition.cancel();return}let{buffers:i,attribute:o}=this;ml(i),i[0]=_l({device:this.device,buffer:i[0],attribute:o,fromLength:n,toLength:this.currentLength,fromStartIndices:s,getData:e.enter}),i[1]=gl({device:this.device,source:i[0],target:i[1]}),this.setBuffer(i[1]);let{transform:a}=this,c=a.model,l=Math.floor(this.currentLength/o.size);Sx(o)&&(l/=2),c.setVertexCount(l),o.isConstant?(c.setAttributes({aFrom:i[0]}),c.setConstantAttributes({aTo:o.value})):c.setAttributes({aFrom:i[0],aTo:o.getBuffer()}),a.transformFeedback.setBuffers({vCurrent:i[1]})}onUpdate(){let{duration:e,easing:t}=this.settings,{time:n}=this.transition,s=n/e;t&&(s=t(s));let{model:i}=this.transform,o={time:s};i.shaderInputs.setProps({interpolation:o}),this.transform.run({discard:!0})}delete(){super.delete(),this.transform.destroy()}},kS=`uniform interpolationUniforms {
1590
+ `;function sA(r,e){if(e.filter){let t=typeof e.filter=="string"?e.filter:`${r.name}_filterColor_ext`;return rA(t)}if(e.sampler){let t=typeof e.sampler=="string"?e.sampler:`${r.name}_sampleColor`;return nA(t)}return""}var iA={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant",blendAlphaDstFactor:"zero"},ir=class extends xt{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):super.render(e)}_drawPickingBuffer({layers:e,layerFilter:t,views:n,viewports:s,onViewportActive:i,pickingFBO:o,deviceRect:{x:a,y:c,width:l,height:u},cullRect:f,effects:h,pass:d="picking",pickZ:g,shaderModuleProps:y}){this.pickZ=g;let _=this._resetColorEncoder(g),b=[a,c,l,u],R=super.render({target:o,layers:e,layerFilter:t,views:n,viewports:s,onViewportActive:i,cullRect:f,effects:h?.filter(S=>S.useInPicking),pass:d,isPicking:!0,shaderModuleProps:y,clearColor:[0,0,0,0],colorMask:15,scissorRect:b});return this._colorEncoderState=null,{decodePickingColor:_&&aA.bind(null,_),stats:R}}shouldDrawLayer(e){let{pickable:t,operation:n}=e.props;return t&&n.includes("draw")||n.includes("terrain")||n.includes("mask")}getShaderModuleProps(e,t,n){return{picking:{isActive:1,isAttribute:this.pickZ},lighting:{enabled:!1}}}getLayerParameters(e,t,n){let s={...e.props.parameters},{pickable:i,operation:o}=e.props;return!this._colorEncoderState||o.includes("terrain")?s.blend=!1:i&&o.includes("draw")&&(Object.assign(s,iA),s.blend=!0,s.blendColor=oA(this._colorEncoderState,e,n)),s}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function oA(r,e,t){let{byLayer:n,byAlpha:s}=r,i,o=n.get(e);return o?(o.viewports.push(t),i=o.a):(i=n.size+1,i<=255?(o={a:i,layer:e,viewports:[t]},n.set(e,o),s[i]=o):(H.warn("Too many pickable layers, only picking the first 255")(),i=0)),[0,0,0,i/255]}function aA(r,e){let t=r.byAlpha[e[3]];return t&&{pickedLayer:t.layer,pickedViewports:t.viewports,pickedObjectIndex:t.layer.decodePickingColor(e)}}var Nr={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},ys=Symbol.for("component"),lt=Symbol.for("propTypes"),Rc=Symbol.for("deprecatedProps"),or=Symbol.for("asyncPropDefaults"),Bt=Symbol.for("asyncPropOriginal"),Tt=Symbol.for("asyncPropResolved");function Dr(r,e=()=>!0){return Array.isArray(r)?V_(r,e,[]):e(r)?[r]:[]}function V_(r,e,t){let n=-1;for(;++n<r.length;){let s=r[n];Array.isArray(s)?V_(s,e,t):e(s)&&t.push(s)}return t}function Ic({target:r,source:e,start:t=0,count:n=1}){let s=e.length,i=n*s,o=0;for(let a=t;o<s;o++)r[a++]=e[o];for(;o<i;)o<i-o?(r.copyWithin(t+o,t,t+o),o*=2):(r.copyWithin(t+o,t,t+i-o),o=i);return r}Cs();var Xi=class{constructor(e,t,n){this._loadCount=0,this._subscribers=new Set,this.id=e,this.context=n,this.setData(t)}subscribe(e){this._subscribers.add(e)}unsubscribe(e){this._subscribers.delete(e)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(e,t){if(e===this._data&&!t)return;this._data=e;let n=++this._loadCount,s=e;typeof e=="string"&&(s=Rr(e)),s instanceof Promise?(this.isLoaded=!1,this._loader=s.then(i=>{this._loadCount===n&&(this.isLoaded=!0,this._error=void 0,this._content=i)}).catch(i=>{this._loadCount===n&&(this.isLoaded=!0,this._error=i||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=e);for(let i of this._subscribers)i.onChange(this.getData())}};var Yi=class{constructor(e){this.protocol=e.protocol||"resource://",this._context={device:e.device,gl:e.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(e){return e.startsWith(this.protocol)?!0:e in this._resources}add({resourceId:e,data:t,forceUpdate:n=!1,persistent:s=!0}){let i=this._resources[e];i?i.setData(t,n):(i=new Xi(e,t,this._context),this._resources[e]=i),i.persistent=s}remove(e){let t=this._resources[e];t&&(t.delete(),delete this._resources[e])}unsubscribe({consumerId:e}){let t=this._consumers[e];if(t){for(let n in t){let s=t[n],i=this._resources[s.resourceId];i&&i.unsubscribe(s)}delete this._consumers[e],this.prune()}}subscribe({resourceId:e,onChange:t,consumerId:n,requestId:s="default"}){let{_resources:i,protocol:o}=this;e.startsWith(o)&&(e=e.replace(o,""),i[e]||this.add({resourceId:e,data:null,persistent:!1}));let a=i[e];if(this._track(n,s,a,t),a)return a.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let e in this._resources)this._resources[e].delete()}_track(e,t,n,s){let i=this._consumers,o=i[e]=i[e]||{},a=o[t],c=a&&a.resourceId&&this._resources[a.resourceId];c&&(c.unsubscribe(a),this.prune()),n&&(a?(a.onChange=s,a.resourceId=n.id):a={onChange:s,resourceId:n.id},o[t]=a,n.subscribe(a))}_prune(){this._pruneRequest=null;for(let e of Object.keys(this._resources)){let t=this._resources[e];!t.persistent&&!t.inUse()&&(t.delete(),delete this._resources[e])}}};var cA="layerManager.setLayers",lA="layerManager.activateViewport",gn=class{constructor(e,t){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=a=>{he(lA,this,a),a&&(this.context.viewport=a)};let{deck:n,stats:s,viewport:i,timeline:o}=t||{};this.layers=[],this.resourceManager=new Yi({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e?.gl,deck:n,shaderAssembler:wc(e?.info?.shadingLanguage||"glsl"),defaultShaderModules:[hh],renderPass:void 0,stats:s||new Ke({id:"deck.gl"}),viewport:i||new $e({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:o||new qr,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let e of this.layers)this._finalizeLayer(e)}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);for(let n of this.layers){let s=n.getNeedsRedraw(e);t=t||s}return t}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(e){this._needsRedraw=this._needsRedraw||e}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e}getLayers({layerIds:e}={}){return e?this.layers.filter(t=>e.find(n=>t.id.indexOf(n)===0)):this.layers}setProps(e){"debug"in e&&(this._debug=e.debug),"userData"in e&&(this.context.userData=e.userData),"layers"in e&&(this._nextLayers=e.layers),"onError"in e&&(this.context.onError=e.onError)}setLayers(e,t){he(cA,this,t,e),this._lastRenderedLayers=e;let n=Dr(e,Boolean);for(let s of n)s.context=this.context;this._updateLayers(this.layers,n)}updateLayers(){let e=this.needsUpdate();e&&(this.setNeedsRedraw(`updating layers: ${e}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,e)),this._nextLayers=null}addDefaultShaderModule(e){let{defaultShaderModules:t}=this.context;t.find(n=>n.name===e.name)||(t.push(e),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(e){let{defaultShaderModules:t}=this.context,n=t.findIndex(s=>s.name===e.name);n>=0&&(t.splice(n,1),this._defaultShaderModulesChanged=!0)}_handleError(e,t,n){n.raiseError(t,`${e} of ${n}`)}_updateLayers(e,t){let n={};for(let o of e)n[o.id]?H.warn(`Multiple old layers with same id ${o.id}`)():n[o.id]=o;if(this._defaultShaderModulesChanged){for(let o of e)o.setNeedsUpdate(),o.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}let s=[];this._updateSublayersRecursively(t,n,s),this._finalizeOldLayers(n);let i=!1;for(let o of s)if(o.hasUniformTransition()){i=`Uniform transition in ${o}`;break}this._needsUpdate=i,this.layers=s}_updateSublayersRecursively(e,t,n){for(let s of e){s.context=this.context;let i=t[s.id];i===null&&H.warn(`Multiple new layers with same id ${s.id}`)(),t[s.id]=null;let o=null;try{this._debug&&i!==s&&s.validateProps(),i?(this._transferLayerState(i,s),this._updateLayer(s)):this._initializeLayer(s),n.push(s),o=s.isComposite?s.getSubLayers():null}catch(a){this._handleError("matching",a,s)}o&&this._updateSublayersRecursively(o,t,n)}}_finalizeOldLayers(e){for(let t in e){let n=e[t];n&&this._finalizeLayer(n)}}_initializeLayer(e){try{e._initialize(),e.lifecycle=Nr.INITIALIZED}catch(t){this._handleError("initialization",t,e)}}_transferLayerState(e,t){t._transferState(e),t.lifecycle=Nr.MATCHED,t!==e&&(e.lifecycle=Nr.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(t){this._handleError("update",t,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=Nr.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=Nr.FINALIZED}catch(t){this._handleError("finalization",t,e)}}};function le(r,e,t){if(r===e)return!0;if(!t||!r||!e)return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(!le(r[n],e[n],t-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof r=="object"&&typeof e=="object"){let n=Object.keys(r),s=Object.keys(e);if(n.length!==s.length)return!1;for(let i of n)if(!e.hasOwnProperty(i)||!le(r[i],e[i],t-1))return!1;return!0}return!1}var qi=class{constructor(e){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=e.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=e.eventManager,this._eventCallbacks={onViewStateChange:e.onViewStateChange,onInteractionStateChange:e.onInteractionStateChange},Object.seal(this),this.setProps(e)}finalize(){for(let e in this.controllers){let t=this.controllers[e];t&&t.finalize()}this.controllers={}}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e,this._needsRedraw=this._needsRedraw||e}updateViewStates(){for(let e in this.controllers){let t=this.controllers[e];t&&t.updateTransition()}}getViewports(e){return e?this._viewports.filter(t=>t.containsPixel(e)):this._viewports}getViews(){let e={};return this.views.forEach(t=>{e[t.id]=t}),e}getView(e){return this.views.find(t=>t.id===e)}getViewState(e){let t=typeof e=="string"?this.getView(e):e,n=t&&this.viewState[t.getViewStateId()]||this.viewState;return t?t.filterViewState(n):n}getViewport(e){return this._viewportMap[e]}unproject(e,t){let n=this.getViewports(),s={x:e[0],y:e[1]};for(let i=n.length-1;i>=0;--i){let o=n[i];if(o.containsPixel(s)){let a=e.slice();return a[0]-=o.x,a[1]-=o.y,o.unproject(a,t)}}return null}setProps(e){e.views&&this._setViews(e.views),e.viewState&&this._setViewState(e.viewState),("width"in e||"height"in e)&&this._setSize(e.width,e.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(e,t){(e!==this.width||t!==this.height)&&(this.width=e,this.height=t,this.setNeedsUpdate("Size changed"))}_setViews(e){e=Dr(e,Boolean),this._diffViews(e,this.views)&&this.setNeedsUpdate("views changed"),this.views=e}_setViewState(e){e?(!le(e,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=e):H.warn("missing `viewState` or `initialViewState`")()}_createController(e,t){let n=t.type;return new n({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:i=>this.getView(e.id)?.makeViewport({viewState:i,width:this.width,height:this.height})})}_updateController(e,t,n,s){let i=e.controller;if(i&&n){let o={...t,...i,id:e.id,x:n.x,y:n.y,width:n.width,height:n.height};return(!s||s.constructor!==i.type)&&(s=this._createController(e,o)),s&&s.setProps(o),s}return null}_rebuildViewports(){let{views:e}=this,t=this.controllers;this._viewports=[],this.controllers={};let n=!1;for(let s=e.length;s--;){let i=e[s],o=this.getViewState(i),a=i.makeViewport({viewState:o,width:this.width,height:this.height}),c=t[i.id],l=Boolean(i.controller);l&&!c&&(n=!0),(n||!l)&&c&&(c.finalize(),c=null),this.controllers[i.id]=this._updateController(i,o,a,c),a&&this._viewports.unshift(a)}for(let s in t){let i=t[s];i&&!this.controllers[s]&&i.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(e=>{e.id&&(this._viewportMap[e.id]=this._viewportMap[e.id]||e)})}_diffViews(e,t){return e.length!==t.length?!0:e.some((n,s)=>!e[s].equals(t[s]))}};var uA=/([0-9]+\.?[0-9]*)(%|px)/;function ar(r){switch(typeof r){case"number":return{position:r,relative:!1};case"string":let e=uA.exec(r);if(e&&e.length>=3){let t=e[2]==="%",n=parseFloat(e[1]);return{position:t?n/100:n,relative:t}}default:throw new Error(`Could not parse position string ${r}`)}}function cr(r,e){return r.relative?Math.round(r.position*e):r.position}var Ne=class{constructor(e){let{id:t,x:n=0,y:s=0,width:i="100%",height:o="100%",padding:a=null}=e;this.id=t||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=ar(n),this._y=ar(s),this._width=ar(i),this._height=ar(o),this._padding=a&&{left:ar(a.left||0),right:ar(a.right||0),top:ar(a.top||0),bottom:ar(a.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e?!0:this.constructor===e.constructor&&le(this.props,e.props,2)}clone(e){let t=this.constructor;return new t({...this.props,...e})}makeViewport({width:e,height:t,viewState:n}){n=this.filterViewState(n);let s=this.getDimensions({width:e,height:t});if(!s.height||!s.width)return null;let i=this.getViewportType(n);return new i({...n,...this.props,...s})}getViewStateId(){let{viewState:e}=this.props;return typeof e=="string"?e:e?.id||this.id}filterViewState(e){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;let t={...e};for(let n in this.props.viewState)n!=="id"&&(t[n]=this.props.viewState[n]);return t}return e}getDimensions({width:e,height:t}){let n={x:cr(this._x,e),y:cr(this._y,t),width:cr(this._width,e),height:cr(this._height,t)};return this._padding&&(n.padding={left:cr(this._padding.left,e),top:cr(this._padding.top,t),right:cr(this._padding.right,e),bottom:cr(this._padding.bottom,t)}),n}get controller(){let e=this.props.controller;return e?e===!0?{type:this.ControllerType}:typeof e=="function"?{type:e}:{type:this.ControllerType,...e}:null}};var wt=class{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){this.cancel(),this.settings=e,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:e,settings:t}=this;this._handle=e.addChannel({delay:e.getTime(),duration:t.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var z_=()=>{},Ki={BREAK:1,SNAP_TO_END:2,IGNORE:3},fA=r=>r,hA=Ki.BREAK,Zi=class{constructor(e){this._onTransitionUpdate=t=>{let{time:n,settings:{interpolator:s,startProps:i,endProps:o,duration:a,easing:c}}=t,l=c(n/a),u=s.interpolateProps(i,o,l);this.propsInTransition=this.getControllerState({...this.props,...u}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=e.getControllerState,this.propsInTransition=null,this.transition=new wt(e.timeline),this.onViewStateChange=e.onViewStateChange||z_,this.onStateChange=e.onStateChange||z_}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let t=!1,n=this.props;if(this.props=e,!n||this._shouldIgnoreViewportChange(n,e))return!1;if(this._isTransitionEnabled(e)){let s=n;if(this.transition.inProgress){let{interruption:i,endProps:o}=this.transition.settings;s={...n,...i===Ki.SNAP_TO_END?o:this.propsInTransition||n}}this._triggerTransition(s,e),t=!0}else this.transition.cancel();return t}updateTransition(){this.transition.update()}_isTransitionEnabled(e){let{transitionDuration:t,transitionInterpolator:n}=e;return(t>0||t==="auto")&&Boolean(n)}_isUpdateDueToCurrentTransition(e){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition):!1}_shouldIgnoreViewportChange(e,t){return this.transition.inProgress?this.transition.settings.interruption===Ki.IGNORE||this._isUpdateDueToCurrentTransition(t):this._isTransitionEnabled(t)?t.transitionInterpolator.arePropsEqual(e,t):!0}_triggerTransition(e,t){let n=this.getControllerState(e),s=this.getControllerState(t).shortestPathFrom(n),i=t.transitionInterpolator,o=i.getDuration?i.getDuration(e,t):t.transitionDuration;if(o===0)return;let a=i.initializeProps(e,s);this.propsInTransition={};let c={duration:o,easing:t.transitionEasing||fA,interpolator:i,interruption:t.transitionInterruption||hA,startProps:a.start,endProps:a.end,onStart:t.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(t.onTransitionInterrupt),onEnd:this._onTransitionEnd(t.onTransitionEnd)};this.transition.start(c),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return t=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e?.(t)}}};function oe(r,e){if(!r)throw new Error(e||"deck.gl: assertion failed.")}var lr=class{constructor(e){let{compare:t,extract:n,required:s}=e;this._propsToCompare=t,this._propsToExtract=n||t,this._requiredProps=s}arePropsEqual(e,t){for(let n of this._propsToCompare)if(!(n in e)||!(n in t)||!He(e[n],t[n]))return!1;return!0}initializeProps(e,t){let n={},s={};for(let i of this._propsToExtract)(i in e||i in t)&&(n[i]=e[i],s[i]=t[i]);return this._checkRequiredProps(n),this._checkRequiredProps(s),{start:n,end:s}}getDuration(e,t){return t.transitionDuration}_checkRequiredProps(e){this._requiredProps&&this._requiredProps.forEach(t=>{let n=e[t];oe(Number.isFinite(n)||Array.isArray(n),`${t} is required for transition`)})}};var dA=["longitude","latitude","zoom","bearing","pitch"],pA=["longitude","latitude","zoom"],Ae=class extends lr{constructor(e={}){let t=Array.isArray(e)?e:e.transitionProps,n=Array.isArray(e)?{}:e;n.transitionProps=Array.isArray(t)?{compare:t,required:t}:t||{compare:dA,required:pA},super(n.transitionProps),this.opts=n}initializeProps(e,t){let n=super.initializeProps(e,t),{makeViewport:s,around:i}=this.opts;if(s&&i){let o=s(e),a=s(t),c=o.unproject(i);n.start.around=i,Object.assign(n.end,{around:a.project(c),aroundPosition:c,width:t.width,height:t.height})}return n}interpolateProps(e,t,n){let s={};for(let i of this._propsToExtract)s[i]=Jt(e[i]||0,t[i]||0,n);if(t.aroundPosition&&this.opts.makeViewport){let i=this.opts.makeViewport({...t,...s});Object.assign(s,i.panByPosition(t.aroundPosition,Jt(e.around,t.around,n)))}return s}};var ur={transitionDuration:0},mA=300,Pc=r=>1-(1-r)*(1-r),xs={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],MULTI_PAN:["multipanstart","multipanmove","multipanend"],DOUBLE_CLICK:["dblclick"],KEYBOARD:["keydown"]},_n={},De=class{constructor(e){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new Zi({...e,getControllerState:t=>new this.ControllerState(t),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=e.eventManager,this.onViewStateChange=e.onViewStateChange||(()=>{}),this.onStateChange=e.onStateChange||(()=>{}),this.makeViewport=e.makeViewport}set events(e){this.toggleEvents(this._customEvents,!1),this.toggleEvents(e,!0),this._customEvents=e,this.props&&this.setProps(this.props)}finalize(){for(let e in this._events)this._events[e]&&this.eventManager?.off(e,this.handleEvent);this.transitionManager.finalize()}handleEvent(e){this._controllerState=void 0;let t=this._eventStartBlocked;switch(e.type){case"panstart":return t?!1:this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return t?!1:this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"multipanstart":return t?!1:this._onMultiPanStart(e);case"multipanmove":return this._onMultiPan(e);case"multipanend":return this._onMultiPanEnd(e);case"dblclick":return this._onDoubleClick(e);case"wheel":return this._onWheel(e);case"keydown":return this._onKeyDown(e);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(e){let{x:t,y:n}=this.props,{offsetCenter:s}=e;return[s.x-t,s.y-n]}isPointInBounds(e,t){let{width:n,height:s}=this.props;if(t&&t.handled)return!1;let i=e[0]>=0&&e[0]<=n&&e[1]>=0&&e[1]<=s;return i&&t&&t.stopPropagation(),i}isFunctionKeyPressed(e){let{srcEvent:t}=e;return Boolean(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(e){let t=setTimeout(()=>{this._eventStartBlocked===t&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=t}setProps(e){e.dragMode&&(this.dragMode=e.dragMode),this.props=e,"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);let{inertia:t}=e;this.inertia=Number.isFinite(t)?t:t===!0?mA:0;let{scrollZoom:n=!0,dragPan:s=!0,dragRotate:i=!0,doubleClickZoom:o=!0,touchZoom:a=!0,touchRotate:c=!1,keyboard:l=!0}=e,u=Boolean(this.onViewStateChange);this.toggleEvents(xs.WHEEL,u&&n),this.toggleEvents(xs.PAN,u),this.toggleEvents(xs.PINCH,u&&(a||c)),this.toggleEvents(xs.MULTI_PAN,u&&c),this.toggleEvents(xs.DOUBLE_CLICK,u&&o),this.toggleEvents(xs.KEYBOARD,u&&l),this.scrollZoom=n,this.dragPan=s,this.dragRotate=i,this.doubleClickZoom=o,this.touchZoom=a,this.touchRotate=c,this.keyboard=l}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,t){this.eventManager&&e.forEach(n=>{this._events[n]!==t&&(this._events[n]=t,t?this.eventManager.on(n,this.handleEvent):this.eventManager.off(n,this.handleEvent))})}updateViewport(e,t=null,n={}){let s={...e.getViewportProps(),...t},i=this.controllerState!==e;if(this.state=e.getState(),this._setInteractionState(n),i){let o=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:s,interactionState:this._interactionState,oldViewState:o,viewId:this.props.id})}}_onTransition(e){this.onViewStateChange({...e,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(e){Object.assign(this._interactionState,e),this.onStateChange(this._interactionState)}_onPanStart(e){let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let n=this.isFunctionKeyPressed(e)||e.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(n=!n);let s=this.controllerState[n?"panStart":"rotateStart"]({pos:t});return this._panMove=n,this.updateViewport(s,ur,{isDragging:!0}),!0}_onPan(e){return this.isDragging()?this._panMove?this._onPanMove(e):this._onPanRotate(e):!1}_onPanEnd(e){return this.isDragging()?this._panMove?this._onPanMoveEnd(e):this._onPanRotateEnd(e):!1}_onPanMove(e){if(!this.dragPan)return!1;let t=this.getCenter(e),n=this.controllerState.pan({pos:t});return this.updateViewport(n,ur,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){let{inertia:t}=this;if(this.dragPan&&t&&e.velocity){let n=this.getCenter(e),s=[n[0]+e.velocityX*t/2,n[1]+e.velocityY*t/2],i=this.controllerState.pan({pos:s}).panEnd();this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:Pc},{isDragging:!1,isPanning:!0})}else{let n=this.controllerState.panEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;let t=this.getCenter(e),n=this.controllerState.rotate({pos:t});return this.updateViewport(n,ur,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){let{inertia:t}=this;if(this.dragRotate&&t&&e.velocity){let n=this.getCenter(e),s=[n[0]+e.velocityX*t/2,n[1]+e.velocityY*t/2],i=this.controllerState.rotate({pos:s}).rotateEnd();this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:Pc},{isDragging:!1,isRotating:!0})}else{let n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;e.srcEvent.preventDefault();let{speed:n=.01,smooth:s=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:i}=e,o=2/(1+Math.exp(-Math.abs(i*n)));i<0&&o!==0&&(o=1/o);let a=s?{...this._getTransitionProps({around:t}),transitionDuration:250}:ur,c=this.controllerState.zoom({pos:t,scale:o});return this.updateViewport(c,a,{isZooming:!0,isPanning:!0}),!0}_onMultiPanStart(e){let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let n=this.controllerState.rotateStart({pos:t});return this.updateViewport(n,ur,{isDragging:!0}),!0}_onMultiPan(e){if(!this.touchRotate||!this.isDragging())return!1;let t=this.getCenter(e);t[0]-=e.deltaX;let n=this.controllerState.rotate({pos:t});return this.updateViewport(n,ur,{isDragging:!0,isRotating:!0}),!0}_onMultiPanEnd(e){if(!this.isDragging())return!1;let{inertia:t}=this;if(this.touchRotate&&t&&e.velocityY){let n=this.getCenter(e),s=[n[0],n[1]+=e.velocityY*t/2],i=this.controllerState.rotate({pos:s});this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:Pc},{isDragging:!1,isRotating:!0}),this.blockEvents(t)}else{let n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let n=this.controllerState.zoomStart({pos:t}).rotateStart({pos:t});return _n._startPinchRotation=e.rotation,_n._lastPinchEvent=e,this.updateViewport(n,ur,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let t=this.controllerState;if(this.touchZoom){let{scale:n}=e,s=this.getCenter(e);t=t.zoom({pos:s,scale:n})}if(this.touchRotate){let{rotation:n}=e;t=t.rotate({deltaAngleX:_n._startPinchRotation-n})}return this.updateViewport(t,ur,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),_n._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;let{inertia:t}=this,{_lastPinchEvent:n}=_n;if(this.touchZoom&&t&&n&&e.scale!==n.scale){let s=this.getCenter(e),i=this.controllerState.rotateEnd(),o=Math.log2(e.scale),a=(o-Math.log2(n.scale))/(e.deltaTime-n.deltaTime),c=Math.pow(2,o+a*t/2);i=i.zoom({pos:s,scale:c}).zoomEnd(),this.updateViewport(i,{...this._getTransitionProps({around:s}),transitionDuration:t,transitionEasing:Pc},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(t)}else{let s=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(s,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return _n._startPinchRotation=null,_n._lastPinchEvent=null,!0}_onDoubleClick(e){if(!this.doubleClickZoom)return!1;let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let n=this.isFunctionKeyPressed(e),s=this.controllerState.zoom({pos:t,scale:n?.5:2});return this.updateViewport(s,this._getTransitionProps({around:t}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(e){if(!this.keyboard)return!1;let t=this.isFunctionKeyPressed(e),{zoomSpeed:n,moveSpeed:s,rotateSpeedX:i,rotateSpeedY:o}=this.keyboard===!0?{}:this.keyboard,{controllerState:a}=this,c,l={};switch(e.srcEvent.code){case"Minus":c=t?a.zoomOut(n).zoomOut(n):a.zoomOut(n),l.isZooming=!0;break;case"Equal":c=t?a.zoomIn(n).zoomIn(n):a.zoomIn(n),l.isZooming=!0;break;case"ArrowLeft":t?(c=a.rotateLeft(i),l.isRotating=!0):(c=a.moveLeft(s),l.isPanning=!0);break;case"ArrowRight":t?(c=a.rotateRight(i),l.isRotating=!0):(c=a.moveRight(s),l.isPanning=!0);break;case"ArrowUp":t?(c=a.rotateUp(o),l.isRotating=!0):(c=a.moveUp(s),l.isPanning=!0);break;case"ArrowDown":t?(c=a.rotateDown(o),l.isRotating=!0):(c=a.moveDown(s),l.isPanning=!0);break;default:return!1}return this.updateViewport(c,this._getTransitionProps(),l),!0}_getTransitionProps(e){let{transition:t}=this;return!t||!t.transitionInterpolator?ur:e?{...t,transitionInterpolator:new Ae({...e,...t.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:t}};var fr=class{constructor(e,t){this._viewportProps=this.applyConstraints(e),this._state=t}getViewportProps(){return this._viewportProps}getState(){return this._state}};var W_=5,gA=1.2,Gi=class extends fr{constructor(e){let{width:t,height:n,latitude:s,longitude:i,zoom:o,bearing:a=0,pitch:c=0,altitude:l=1.5,position:u=[0,0,0],maxZoom:f=20,minZoom:h=0,maxPitch:d=60,minPitch:g=0,startPanLngLat:y,startZoomLngLat:_,startRotatePos:b,startBearing:R,startPitch:x,startZoom:S,normalize:C=!0}=e;oe(Number.isFinite(i)),oe(Number.isFinite(s)),oe(Number.isFinite(o)),super({width:t,height:n,latitude:s,longitude:i,zoom:o,bearing:a,pitch:c,altitude:l,maxZoom:f,minZoom:h,maxPitch:d,minPitch:g,normalize:C,position:u},{startPanLngLat:y,startZoomLngLat:_,startRotatePos:b,startBearing:R,startPitch:x,startZoom:S}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan({pos:e,startPos:t}){let n=this.getState().startPanLngLat||this._unproject(t);if(!n)return this;let i=this.makeViewport(this.getViewportProps()).panByPosition(n,e);return this._getUpdatedState(i)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:t=0,deltaAngleY:n=0}){let{startRotatePos:s,startBearing:i,startPitch:o}=this.getState();if(!s||i===void 0||o===void 0)return this;let a;return e?a=this._getNewRotation(e,s,o,i):a={bearing:i+t,pitch:o+n},this._getUpdatedState(a)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:e}){return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:t,scale:n}){let{startZoom:s,startZoomLngLat:i}=this.getState();if(i||(s=this.getViewportProps().zoom,i=this._unproject(t)||this._unproject(e)),!i)return this;let{maxZoom:o,minZoom:a}=this.getViewportProps(),c=s+Math.log2(n);c=ee(c,a,o);let l=this.makeViewport({...this.getViewportProps(),zoom:c});return this._getUpdatedState({zoom:c,...l.panByPosition(i,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(e=2){return this._zoomFromCenter(e)}zoomOut(e=2){return this._zoomFromCenter(1/e)}moveLeft(e=100){return this._panFromCenter([e,0])}moveRight(e=100){return this._panFromCenter([-e,0])}moveUp(e=100){return this._panFromCenter([0,e])}moveDown(e=100){return this._panFromCenter([0,-e])}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}shortestPathFrom(e){let t=e.getViewportProps(),n={...this.getViewportProps()},{bearing:s,longitude:i}=n;return Math.abs(s-t.bearing)>180&&(n.bearing=s<0?s+360:s-360),Math.abs(i-t.longitude)>180&&(n.longitude=i<0?i+360:i-360),n}applyConstraints(e){let{maxZoom:t,minZoom:n,zoom:s}=e;e.zoom=ee(s,n,t);let{maxPitch:i,minPitch:o,pitch:a}=e;e.pitch=ee(a,o,i);let{normalize:c=!0}=e;return c&&Object.assign(e,Ph(e)),e}_zoomFromCenter(e){let{width:t,height:n}=this.getViewportProps();return this.zoom({pos:[t/2,n/2],scale:e})}_panFromCenter(e){let{width:t,height:n}=this.getViewportProps();return this.pan({startPos:[t/2,n/2],pos:[t/2+e[0],n/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}_unproject(e){let t=this.makeViewport(this.getViewportProps());return e&&t.unproject(e)}_getNewRotation(e,t,n,s){let i=e[0]-t[0],o=e[1]-t[1],a=e[1],c=t[1],{width:l,height:u}=this.getViewportProps(),f=i/l,h=0;o>0?Math.abs(u-c)>W_&&(h=o/(c-u)*gA):o<0&&c>W_&&(h=1-a/c),h=ee(h,-1,1);let{minPitch:d,maxPitch:g}=this.getViewportProps(),y=s+180*f,_=n;return h>0?_=n+h*(g-n):h<0&&(_=n-h*(d-n)),{pitch:_,bearing:y}}},yn=class extends De{constructor(){super(...arguments),this.ControllerState=Gi,this.transition={transitionDuration:300,transitionInterpolator:new Ae({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(e){e.position=e.position||[0,0,0];let t=this.props;super.setProps(e),(!t||t.height!==e.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...e,...this.state}))}};var Cc=class extends Ne{constructor(e={}){super(e)}getViewportType(){return kr}get ControllerType(){return yn}};Cc.displayName="MapView";var Mc=Cc;var _A=new Or;function yA(r,e){let t=r.order??1/0,n=e.order??1/0;return t-n}var Qi=class{constructor(e){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=e,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(e){let t=this._defaultEffects;if(!t.find(n=>n.id===e.id)){let n=t.findIndex(s=>yA(s,e)>0);n<0?t.push(e):t.splice(n,0,e),e.setup(this._context),this._setEffects(this.effects)}}setProps(e){"effects"in e&&(le(e.effects,this.effects,1)||this._setEffects(e.effects))}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}getEffects(){return this._resolvedEffects}_setEffects(e){let t={};for(let s of this.effects)t[s.id]=s;let n=[];for(let s of e){let i=t[s.id],o=s;i&&i!==s?i.setProps?(i.setProps(s.props),o=i):i.cleanup(this._context):i||s.setup(this._context),n.push(o),delete t[s.id]}for(let s in t)t[s].cleanup(this._context);this.effects=n,this._resolvedEffects=n.concat(this._defaultEffects),e.some(s=>s instanceof Or)||this._resolvedEffects.push(_A),this._needsRedraw="effects changed"}finalize(){for(let e of this._resolvedEffects)e.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var Ji=class extends xt{shouldDrawLayer(e){let{operation:t}=e.props;return t.includes("draw")||t.includes("terrain")}};var xA="deckRenderer.renderLayers",xn=class{constructor(e){this.device=e,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new Ji(e),this.pickLayersPass=new ir(e),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(e){this.layerFilter!==e.layerFilter&&(this.layerFilter=e.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==e.drawPickingColors&&(this.drawPickingColors=e.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(e){if(!e.viewports.length)return;let t=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,n={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...e};n.effects&&this._preRender(n.effects,n);let s=this.lastPostProcessEffect?this.renderBuffers[0]:n.target;this.lastPostProcessEffect&&(n.clearColor=[0,0,0,0],n.clearCanvas=!0);let i=t.render({...n,target:s});n.effects&&(this.lastPostProcessEffect&&(n.clearCanvas=e.clearCanvas===void 0?!0:e.clearCanvas),this._postRender(n.effects,n)),this.renderCount++,he(xA,this,i,e)}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}finalize(){let{renderBuffers:e}=this;for(let t of e)t.delete();e.length=0}_preRender(e,t){this.lastPostProcessEffect=null,t.preRenderStats=t.preRenderStats||{};for(let n of e)t.preRenderStats[n.id]=n.preRender(t),n.postRender&&(this.lastPostProcessEffect=n.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:e}=this,t=this.device.canvasContext.getDrawingBufferSize(),[n,s]=t;e.length===0&&[0,1].map(i=>{let o=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"},width:n,height:s});e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${i}`,colorAttachments:[o]}))});for(let i of e)i.resize(t)}_postRender(e,t){let{renderBuffers:n}=this,s={...t,inputBuffer:n[0],swapBuffer:n[1]};for(let i of e)if(i.postRender){s.target=i.id===this.lastPostProcessEffect?t.target:void 0;let o=i.postRender(s);s.inputBuffer=o,s.swapBuffer=o===n[0]?n[1]:n[0]}}};var bA={pickedColor:null,pickedObjectIndex:-1};function Bh({pickedColors:r,decodePickingColor:e,deviceX:t,deviceY:n,deviceRadius:s,deviceRect:i}){let{x:o,y:a,width:c,height:l}=i,u=s*s,f=-1,h=0;for(let d=0;d<l;d++){let g=d+a-n,y=g*g;if(y>u)h+=4*c;else for(let _=0;_<c;_++){if(r[h+3]-1>=0){let R=_+o-t,x=R*R+y;x<=u&&(u=x,f=h)}h+=4}}if(f>=0){let d=r.slice(f,f+4),g=e(d);if(g){let y=Math.floor(f/4/c),_=f/4-y*c;return{...g,pickedColor:d,pickedX:o+_,pickedY:a+y}}H.error("Picked non-existent layer. Is picking buffer corrupt?")()}return bA}function Lh({pickedColors:r,decodePickingColor:e}){let t=new Map;if(r){for(let n=0;n<r.length;n+=4)if(r[n+3]-1>=0){let i=r.slice(n,n+4),o=i.join(",");if(!t.has(o)){let a=e(i);a?t.set(o,{...a,color:i}):H.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(t.values())}function Oc({pickInfo:r,viewports:e,pixelRatio:t,x:n,y:s,z:i}){let o=e[0];e.length>1&&(o=TA(r?.pickedViewports||e,{x:n,y:s}));let a;if(o){let c=[n-o.x,s-o.y];i!==void 0&&(c[2]=i),a=o.unproject(c)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:n,y:s,pixel:[n,s],coordinate:a,devicePixel:r&&"pickedX"in r?[r.pickedX,r.pickedY]:void 0,pixelRatio:t}}function Uh(r){let{pickInfo:e,lastPickedInfo:t,mode:n,layers:s}=r,{pickedColor:i,pickedLayer:o,pickedObjectIndex:a}=e,c=o?[o]:[];if(n==="hover"){let f=t.index,h=t.layerId,d=o?o.props.id:null;if(d!==h||a!==f){if(d!==h){let g=s.find(y=>y.props.id===h);g&&c.unshift(g)}t.layerId=d,t.index=a,t.info=null}}let l=Oc(r),u=new Map;return u.set(null,l),c.forEach(f=>{let h={...l};f===o&&(h.color=i,h.index=a,h.picked=!0),h=kc({layer:f,info:h,mode:n});let d=h.layer;f===o&&n==="hover"&&(t.info=h),u.set(d.id,h),n==="hover"&&d.updateAutoHighlight(h)}),u}function kc({layer:r,info:e,mode:t}){for(;r&&e;){let n=e.layer||null;e.sourceLayer=n,e.layer=r,e=r.getPickingInfo({info:e,mode:t,sourceLayer:n}),r=r.parent}return e}function TA(r,e){for(let t=r.length-1;t>=0;t--){let n=r[t];if(n.containsPixel(e))return n}return r[0]}var eo=class{constructor(e){this._pickable=!0,this.device=e,this.pickLayersPass=new ir(e),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(e){"layerFilter"in e&&(this.layerFilter=e.layerFilter),"_pickable"in e&&(this._pickable=e._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}pickObjectAsync(e){return this._pickClosestObjectAsync(e)}pickObjectsAsync(e){return this._pickVisibleObjectsAsync(e)}pickObject(e){return this._pickClosestObject(e)}pickObjects(e){return this._pickVisibleObjects(e)}getLastPickedObject({x:e,y:t,layers:n,viewports:s},i=this.lastPickedInfo.info){let o=i&&i.layer&&i.layer.id,a=i&&i.viewport&&i.viewport.id,c=o?n.find(h=>h.id===o):null,l=a&&s.find(h=>h.id===a)||s[0],u=l&&l.unproject([e-l.x,t-l.y]);return{...i,...{x:e,y:t,viewport:l,coordinate:u,layer:c}}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float"))){let t=this.device.createFramebuffer({colorAttachments:["rgba32float"],depthStencilAttachment:"depth16unorm"});this.depthFBO=t}let{canvas:e}=this.device.getDefaultCanvasContext();this.pickingFBO?.resize({width:e.width,height:e.height}),this.depthFBO?.resize({width:e.width,height:e.height})}_getPickable(e){if(this._pickable===!1)return null;let t=e.filter(n=>this.pickLayersPass.shouldDrawLayer(n)&&!n.isComposite);return t.length?t:null}async _pickClosestObjectAsync({layers:e,views:t,viewports:n,x:s,y:i,radius:o=0,depth:a=1,mode:c="query",unproject3D:l,onViewportActive:u,effects:f}){let h=this.device.canvasContext.cssToDeviceRatio(),d=this._getPickable(e);if(!d||n.length===0)return{result:[],emptyInfo:Oc({viewports:n,x:s,y:i,pixelRatio:h})};this._resizeBuffer();let g=this.device.canvasContext.cssToDevicePixels([s,i],!0),y=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],_=Math.round(o*h),{width:b,height:R}=this.pickingFBO,x=this._getPickingRect({deviceX:y[0],deviceY:y[1],deviceRadius:_,deviceWidth:b,deviceHeight:R}),S={x:s-o,y:i-o,width:o*2+1,height:o*2+1},C,P=[],B=new Set;for(let N=0;N<a;N++){let k;if(x){let U=this._drawAndSample({layers:d,views:t,viewports:n,onViewportActive:u,deviceRect:x,cullRect:S,effects:f,pass:`picking:${c}`});k=Bh({...U,deviceX:y[0],deviceY:y[1],deviceRadius:_,deviceRect:x})}else k={pickedColor:null,pickedObjectIndex:-1};let F;if(k.pickedLayer&&l&&this.depthFBO){let{pickedColors:U}=this._drawAndSample({layers:[k.pickedLayer],views:t,viewports:n,onViewportActive:u,deviceRect:{x:k.pickedX,y:k.pickedY,width:1,height:1},cullRect:S,effects:f,pass:`picking:${c}:z`},!0);U[3]&&(F=U[0])}k.pickedLayer&&N+1<a&&(B.add(k.pickedLayer),k.pickedLayer.disablePickingIndex(k.pickedObjectIndex)),C=Uh({pickInfo:k,lastPickedInfo:this.lastPickedInfo,mode:c,layers:d,viewports:n,x:s,y:i,z:F,pixelRatio:h});for(let U of C.values())U.layer&&P.push(U);if(!k.pickedColor)break}for(let N of B)N.restorePickingColors();return{result:P,emptyInfo:C.get(null)}}_pickClosestObject({layers:e,views:t,viewports:n,x:s,y:i,radius:o=0,depth:a=1,mode:c="query",unproject3D:l,onViewportActive:u,effects:f}){let h=this.device.canvasContext.cssToDeviceRatio(),d=this._getPickable(e);if(!d||n.length===0)return{result:[],emptyInfo:Oc({viewports:n,x:s,y:i,pixelRatio:h})};this._resizeBuffer();let g=this.device.canvasContext.cssToDevicePixels([s,i],!0),y=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],_=Math.round(o*h),{width:b,height:R}=this.pickingFBO,x=this._getPickingRect({deviceX:y[0],deviceY:y[1],deviceRadius:_,deviceWidth:b,deviceHeight:R}),S={x:s-o,y:i-o,width:o*2+1,height:o*2+1},C,P=[],B=new Set;for(let N=0;N<a;N++){let k;if(x){let U=this._drawAndSample({layers:d,views:t,viewports:n,onViewportActive:u,deviceRect:x,cullRect:S,effects:f,pass:`picking:${c}`});k=Bh({...U,deviceX:y[0],deviceY:y[1],deviceRadius:_,deviceRect:x})}else k={pickedColor:null,pickedObjectIndex:-1};let F;if(k.pickedLayer&&l&&this.depthFBO){let{pickedColors:U}=this._drawAndSample({layers:[k.pickedLayer],views:t,viewports:n,onViewportActive:u,deviceRect:{x:k.pickedX,y:k.pickedY,width:1,height:1},cullRect:S,effects:f,pass:`picking:${c}:z`},!0);U[3]&&(F=U[0])}k.pickedLayer&&N+1<a&&(B.add(k.pickedLayer),k.pickedLayer.disablePickingIndex(k.pickedObjectIndex)),C=Uh({pickInfo:k,lastPickedInfo:this.lastPickedInfo,mode:c,layers:d,viewports:n,x:s,y:i,z:F,pixelRatio:h});for(let U of C.values())U.layer&&P.push(U);if(!k.pickedColor)break}for(let N of B)N.restorePickingColors();return{result:P,emptyInfo:C.get(null)}}async _pickVisibleObjectsAsync({layers:e,views:t,viewports:n,x:s,y:i,width:o=1,height:a=1,mode:c="query",maxObjects:l=null,onViewportActive:u,effects:f}){let h=this._getPickable(e);if(!h||n.length===0)return[];this._resizeBuffer();let d=this.device.canvasContext.cssToDeviceRatio(),g=this.device.canvasContext.cssToDevicePixels([s,i],!0),y=g.x,_=g.y+g.height,b=this.device.canvasContext.cssToDevicePixels([s+o,i+a],!0),R=b.x+b.width,x=b.y,S={x:y,y:x,width:R-y,height:_-x},C=this._drawAndSample({layers:h,views:t,viewports:n,onViewportActive:u,deviceRect:S,cullRect:{x:s,y:i,width:o,height:a},effects:f,pass:`picking:${c}`}),P=Lh(C),B=new Map,N=[],k=Number.isFinite(l);for(let F=0;F<P.length&&!(k&&N.length>=l);F++){let U=P[F],X={color:U.pickedColor,layer:null,index:U.pickedObjectIndex,picked:!0,x:s,y:i,pixelRatio:d};X=kc({layer:U.pickedLayer,info:X,mode:c});let J=X.layer.id;B.has(J)||B.set(J,new Set);let q=B.get(J),pe=X.object??X.index;q.has(pe)||(q.add(pe),N.push(X))}return N}_pickVisibleObjects({layers:e,views:t,viewports:n,x:s,y:i,width:o=1,height:a=1,mode:c="query",maxObjects:l=null,onViewportActive:u,effects:f}){let h=this._getPickable(e);if(!h||n.length===0)return[];this._resizeBuffer();let d=this.device.canvasContext.cssToDeviceRatio(),g=this.device.canvasContext.cssToDevicePixels([s,i],!0),y=g.x,_=g.y+g.height,b=this.device.canvasContext.cssToDevicePixels([s+o,i+a],!0),R=b.x+b.width,x=b.y,S={x:y,y:x,width:R-y,height:_-x},C=this._drawAndSample({layers:h,views:t,viewports:n,onViewportActive:u,deviceRect:S,cullRect:{x:s,y:i,width:o,height:a},effects:f,pass:`picking:${c}`}),P=Lh(C),B=new Map,N=[],k=Number.isFinite(l);for(let F=0;F<P.length&&!(k&&N.length>=l);F++){let U=P[F],X={color:U.pickedColor,layer:null,index:U.pickedObjectIndex,picked:!0,x:s,y:i,pixelRatio:d};X=kc({layer:U.pickedLayer,info:X,mode:c});let J=X.layer.id;B.has(J)||B.set(J,new Set);let q=B.get(J),pe=X.object??X.index;q.has(pe)||(q.add(pe),N.push(X))}return N}async _drawAndSampleAsync({layers:e,views:t,viewports:n,onViewportActive:s,deviceRect:i,cullRect:o,effects:a,pass:c},l=!1){let u=l?this.depthFBO:this.pickingFBO,f={layers:e,layerFilter:this.layerFilter,views:t,viewports:n,onViewportActive:s,pickingFBO:u,deviceRect:i,cullRect:o,effects:a,pass:c,pickZ:l,preRenderStats:{},isPicking:!0};for(let R of a)R.useInPicking&&(f.preRenderStats[R.id]=R.preRender(f));let{decodePickingColor:h}=this.pickLayersPass.render(f),{x:d,y:g,width:y,height:_}=i,b=new(l?Float32Array:Uint8Array)(y*_*4);return this.device.readPixelsToArrayWebGL(u,{sourceX:d,sourceY:g,sourceWidth:y,sourceHeight:_,target:b}),{pickedColors:b,decodePickingColor:h}}_drawAndSample({layers:e,views:t,viewports:n,onViewportActive:s,deviceRect:i,cullRect:o,effects:a,pass:c},l=!1){let u=l?this.depthFBO:this.pickingFBO,f={layers:e,layerFilter:this.layerFilter,views:t,viewports:n,onViewportActive:s,pickingFBO:u,deviceRect:i,cullRect:o,effects:a,pass:c,pickZ:l,preRenderStats:{},isPicking:!0};for(let R of a)R.useInPicking&&(f.preRenderStats[R.id]=R.preRender(f));let{decodePickingColor:h}=this.pickLayersPass.render(f),{x:d,y:g,width:y,height:_}=i,b=new(l?Float32Array:Uint8Array)(y*_*4);return this.device.readPixelsToArrayWebGL(u,{sourceX:d,sourceY:g,sourceWidth:y,sourceHeight:_,target:b}),{pickedColors:b,decodePickingColor:h}}_getPickingRect({deviceX:e,deviceY:t,deviceRadius:n,deviceWidth:s,deviceHeight:i}){let o=Math.max(0,e-n),a=Math.max(0,t-n),c=Math.min(s,e+n+1)-o,l=Math.min(i,t+n+1)-a;return c<=0||l<=0?null:{x:o,y:a,width:c,height:l}}};var wA={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},vA="top-left",$_="__root",Nc=class{constructor({deck:e,parentElement:t}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,t?.classList.add("deck-widget-container"),this.parentElement=t}getWidgets(){return this.resolvedWidgets}setProps(e){if(e.widgets&&!le(e.widgets,this.widgets,1)){let t=e.widgets.filter(Boolean);this._setWidgets(t)}}finalize(){for(let e of this.getWidgets())this._removeWidget(e);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(let e in this.containers)this.containers[e].remove()}addDefault(e){this.defaultWidgets.find(t=>t.id===e.id)||(this._addWidget(e),this.defaultWidgets.push(e),this._setWidgets(this.widgets))}onRedraw({viewports:e,layers:t}){let n=e.reduce((s,i)=>(s[i.id]=i,s),{});for(let s of this.getWidgets()){let{viewId:i}=s;if(i){let o=n[i];o&&(s.onViewportChange&&s.onViewportChange(o),s.onRedraw?.({viewports:[o],layers:t}))}else{if(s.onViewportChange)for(let o of e)s.onViewportChange(o);s.onRedraw?.({viewports:e,layers:t})}}this.lastViewports=n,this._updateContainers()}onHover(e,t){for(let n of this.getWidgets()){let{viewId:s}=n;(!s||s===e.viewport?.id)&&n.onHover?.(e,t)}}onEvent(e,t){let n=Ni[t.type];if(n)for(let s of this.getWidgets()){let{viewId:i}=s;(!i||i===e.viewport?.id)&&s[n]?.(e,t)}}_setWidgets(e){let t={};for(let n of this.resolvedWidgets)t[n.id]=n;this.resolvedWidgets.length=0;for(let n of this.defaultWidgets)t[n.id]=null,this.resolvedWidgets.push(n);for(let n of e){let s=t[n.id];s?s.viewId!==n.viewId||s.placement!==n.placement?(this._removeWidget(s),this._addWidget(n)):n!==s&&(s.setProps(n.props),n=s):this._addWidget(n),t[n.id]=null,this.resolvedWidgets.push(n)}for(let n in t){let s=t[n];s&&this._removeWidget(s)}this.widgets=e}_addWidget(e){let{viewId:t=null,placement:n=vA}=e;e.widgetManager=this,e.deck=this.deck,e.rootElement=e.onCreateRootElement(),e.rootElement&&this._getContainer(t,n).append(e.rootElement),e.onAdd?.({deck:this.deck,viewId:t}),e.updateHTML()}_removeWidget(e){e.onRemove?.(),e.rootElement&&e.rootElement.remove(),e.rootElement=void 0,e.deck=void 0,e.widgetManager=void 0}_getContainer(e,t){let n=e||$_,s=this.containers[n];s||(s=document.createElement("div"),s.style.pointerEvents="none",s.style.position="absolute",s.style.overflow="hidden",this.parentElement?.append(s),this.containers[n]=s);let i=s.querySelector(`.${t}`);return i||(i=globalThis.document.createElement("div"),i.className=t,i.style.position="absolute",i.style.zIndex="2",Object.assign(i.style,wA[t]),s.append(i)),i}_updateContainers(){let e=this.deck.width,t=this.deck.height;for(let n in this.containers){let s=this.lastViewports[n]||null,i=n===$_||s,o=this.containers[n];i?(o.style.display="block",o.style.left=`${s?s.x:0}px`,o.style.top=`${s?s.y:0}px`,o.style.width=`${s?s.width:e}px`,o.style.height=`${s?s.height:t}px`):o.style.display="none"}}};function to(r,e){e&&Object.entries(e).map(([t,n])=>{t.startsWith("--")?r.style.setProperty(t,n):r.style[t]=n})}function Dc(r,e){e&&Object.keys(e).map(t=>{t.startsWith("--")?r.style.removeProperty(t):r.style[t]=""})}var Fr=class{constructor(e,t){this.viewId=null,this.props={...t,...e},this.id=this.props.id}setProps(e){let t=this.props,n=this.rootElement;n&&t.className!==e.className&&(t.className&&n.classList.remove(t.className),e.className&&n.classList.add(e.className)),n&&!le(t.style,e.style,1)&&(Dc(n,t.style),to(n,e.style)),Object.assign(this.props,e),this.updateHTML()}updateHTML(){this.rootElement&&this.onRenderHTML(this.rootElement)}onCreateRootElement(){let e=["deck-widget",this.className,this.props.className],t=document.createElement("div");return e.filter(n=>typeof n=="string"&&n.length>0).forEach(n=>t.classList.add(n)),to(t,this.props.style),t}onAdd(e){}onRemove(){}onViewportChange(e){}onRedraw(e){}onHover(e,t){}onClick(e,t){}onDrag(e,t){}onDragStart(e,t){}onDragEnd(e,t){}};Fr.defaultProps={id:"widget",style:{},className:""};var AA={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"},bn=class extends Fr{constructor(e={}){super(e,bn.defaultProps),this.id="default-tooltip",this.placement="fill",this.className="deck-tooltip",this.isVisible=!1,this.setProps(e)}onCreateRootElement(){let e=document.createElement("div");return e.className=this.className,Object.assign(e.style,AA),e}onRenderHTML(e){}onViewportChange(e){this.isVisible&&e.id===this.lastViewport?.id&&e!==this.lastViewport&&this.setTooltip(null)}onHover(e){let{deck:t}=this,n=t&&t.props.getTooltip;if(!n)return;let s=n(e);this.lastViewport=e.viewport,this.setTooltip(s,e.x,e.y)}setTooltip(e,t,n){let s=this.rootElement;if(s){if(typeof e=="string")s.innerText=e;else if(e)e.text&&(s.innerText=e.text),e.html&&(s.innerHTML=e.html),e.className&&(s.className=e.className);else{this.isVisible=!1,s.style.display="none";return}this.isVisible=!0,s.style.display="block",s.style.transform=`translate(${t}px, ${n}px)`,e&&typeof e=="object"&&"style"in e&&Object.assign(s.style,e.style)}}};bn.defaultProps={...Fr.defaultProps};j();il();Cs();function Ur(){}var PS=({isDragging:r})=>r?"grabbing":"grab",dx={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{},gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:Ur,onWebGLInitialized:Ur,onResize:Ur,onViewStateChange:Ur,onInteractionStateChange:Ur,onBeforeRender:Ur,onAfterRender:Ur,onLoad:Ur,onError:r=>H.error(r.message,r.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:PS,getTooltip:null,debug:!1,drawPickingColors:!1},lo=class{constructor(e){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new Ke({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this._lastPointerDownInfo=null,this._onPointerMove=n=>{let{_pickRequest:s}=this;if(n.type==="pointerleave")s.x=-1,s.y=-1,s.radius=0;else{if(n.leftButton||n.rightButton)return;{let i=n.offsetCenter;if(!i)return;s.x=i.x,s.y=i.y,s.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:s.x,y:s.y}),s.event=n},this._onEvent=n=>{let s=Ni[n.type],i=n.offsetCenter;if(!s||!i||!this.layerManager)return;let o=this.layerManager.getLayers(),a=this.deckPicker.getLastPickedObject({x:i.x,y:i.y,layers:o,viewports:this.getViewports(i)},this._lastPointerDownInfo),{layer:c}=a,l=c&&(c[s]||c.props[s]),u=this.props[s],f=!1;l&&(f=l.call(c,a,n)),f||(u?.(a,n),this.widgetManager.onEvent(a,n))},this._onPointerDown=n=>{if(this.device?.type==="webgpu")return;let s=n.offsetCenter,i=this._pick("pickObject","pickObject Time",{x:s.x,y:s.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=i.result[0]||i.emptyInfo},this.props={...dx,...e},e=this.props,e.viewState&&e.initialViewState&&H.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,e.device&&(this.device=e.device);let t=this.device;!t&&e.gl&&(e.gl instanceof WebGLRenderingContext&&H.error("WebGL1 context not supported.")(),t=co.attach(e.gl,this.props.deviceProps)),t||(t=this._createDevice(e)),this.animationLoop=this._createAnimationLoop(t,e),this.setProps(e),e._typedArrayManagerProps&&bt.setOptions(e._typedArrayManagerProps),this.animationLoop.start()}finalize(){this.animationLoop?.stop(),this.animationLoop?.destroy(),this.animationLoop=null,this._lastPointerDownInfo=null,this.layerManager?.finalize(),this.layerManager=null,this.viewManager?.finalize(),this.viewManager=null,this.effectManager?.finalize(),this.effectManager=null,this.deckRenderer?.finalize(),this.deckRenderer=null,this.deckPicker?.finalize(),this.deckPicker=null,this.eventManager?.destroy(),this.eventManager=null,this.widgetManager?.finalize(),this.widgetManager=null,!this.props.canvas&&!this.props.device&&!this.props.gl&&this.canvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null)}setProps(e){this.stats.get("setProps Time").timeStart(),"onLayerHover"in e&&H.removed("onLayerHover","onHover")(),"onLayerClick"in e&&H.removed("onLayerClick","onClick")(),e.initialViewState&&!le(this.props.initialViewState,e.initialViewState,3)&&(this.viewState=e.initialViewState),Object.assign(this.props,e),this._setCanvasSize(this.props);let t=Object.create(this.props);if(Object.assign(t,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),e.device&&e.device.id!==this.device?.id&&(this.animationLoop?.stop(),this.canvas!==e.device.canvasContext?.canvas&&(this.canvas?.remove(),this.eventManager?.destroy(),this.canvas=null),H.log(`recreating animation loop for new device! id=${e.device.id}`)(),this.animationLoop=this._createAnimationLoop(e.device,e),this.animationLoop.start()),this.animationLoop?.setProps(t),e.useDevicePixels!==void 0&&this.device?.canvasContext?.canvas instanceof HTMLCanvasElement){this.device.canvasContext.props.useDevicePixels=e.useDevicePixels;let n=this.device.canvasContext.canvas,s={target:n,contentBoxSize:[{inlineSize:n.clientWidth,blockSize:n.clientHeight}],devicePixelContentBoxSize:[{inlineSize:n.clientWidth,blockSize:n.clientHeight}],borderBoxSize:[{inlineSize:n.clientWidth,blockSize:n.clientHeight}]};this.device.canvasContext._handleResize([s])}this.layerManager&&(this.viewManager.setProps(t),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(t),this.effectManager.setProps(t),this.deckRenderer.setProps(t),this.deckPicker.setProps(t),this.widgetManager.setProps(t)),this.stats.get("setProps Time").timeEnd()}needsRedraw(e={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let t=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);let n=this.viewManager.needsRedraw(e),s=this.layerManager.needsRedraw(e),i=this.effectManager.needsRedraw(e),o=this.deckRenderer.needsRedraw(e);return t=t||n||s||i||o,t}redraw(e){if(!this.layerManager)return;let t=this.needsRedraw({clearRedrawFlags:!0});t=e||t,t&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(t):this._drawLayers(t))}get isInitialized(){return this.viewManager!==null}getViews(){return oe(this.viewManager),this.viewManager.views}getViewports(e){return oe(this.viewManager),this.viewManager.getViewports(e)}getCanvas(){return this.canvas}pickObject(e){let t=this._pick("pickObject","pickObject Time",e).result;return t.length?t[0]:null}pickMultipleObjects(e){return e.depth=e.depth||10,this._pick("pickObject","pickMultipleObjects Time",e).result}pickObjects(e){return this._pick("pickObjects","pickObjects Time",e)}_addResources(e,t=!1){for(let n in e)this.layerManager.resourceManager.add({resourceId:n,data:e[n],forceUpdate:t})}_removeResources(e){for(let t of e)this.layerManager.resourceManager.remove(t)}_addDefaultEffect(e){this.effectManager.addDefaultEffect(e)}_addDefaultShaderModule(e){this.layerManager.addDefaultShaderModule(e)}_removeDefaultShaderModule(e){this.layerManager?.removeDefaultShaderModule(e)}_pick(e,t,n){oe(this.deckPicker);let{stats:s}=this;s.get("Pick Count").incrementCount(),s.get(t).timeStart();let i=this.deckPicker[e]({layers:this.layerManager.getLayers(n),views:this.viewManager.getViews(),viewports:this.getViewports(n),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...n});return s.get(t).timeEnd(),i}_createCanvas(e){let t=e.canvas;return typeof t=="string"&&(t=document.getElementById(t),oe(t)),t||(t=document.createElement("canvas"),t.id=e.id||"deckgl-overlay",e.width&&typeof e.width=="number"&&(t.width=e.width),e.height&&typeof e.height=="number"&&(t.height=e.height),(e.parent||document.body).appendChild(t)),Object.assign(t.style,e.style),t}_setCanvasSize(e){if(!this.canvas)return;let{width:t,height:n}=e;if(t||t===0){let s=Number.isFinite(t)?`${t}px`:t;this.canvas.style.width=s}if(n||n===0){let s=Number.isFinite(n)?`${n}px`:n;this.canvas.style.position=e.style?.position||"absolute",this.canvas.style.height=s}}_updateCanvasSize(){let{canvas:e}=this;if(!e)return;let t=e.clientWidth??e.width,n=e.clientHeight??e.height;(t!==this.width||n!==this.height)&&(this.width=t,this.height=n,this.viewManager?.setProps({width:t,height:n}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:t,height:n}))}_createAnimationLoop(e,t){let{gl:n,onError:s}=t;return new jn({device:e,autoResizeDrawingBuffer:!n,autoResizeViewport:!1,onInitialize:i=>this._setDevice(i.device),onRender:this._onRenderFrame.bind(this),onError:s})}_createDevice(e){let t=this.props.deviceProps?.createCanvasContext,n=typeof t=="object"?t:void 0,s={adapters:[],...e.deviceProps};s.adapters.includes(co)||s.adapters.push(co);let i={alphaMode:this.props.deviceProps?.type==="webgpu"?"premultiplied":void 0};return mr.createDevice({_reuseDevices:!0,type:"webgl",...s,createCanvasContext:{...i,...n,canvas:this._createCanvas(e),useDevicePixels:this.props.useDevicePixels,autoResize:!0}})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let{views:e}=this.props,t=Array.isArray(e)?e:e?[e]:[new Mc({id:"default-view"})];return t.length&&this.props.controller&&(t[0].props.controller=this.props.controller),t}_onContextLost(){let{onError:e}=this.props;this.animationLoop&&e&&e(new Error("WebGL context is lost"))}_pickAndCallback(){if(this.device?.type==="webgpu")return;let{_pickRequest:e}=this;if(e.event){let{result:t,emptyInfo:n}=this._pick("pickObject","pickObject Time",e);this.cursorState.isHovering=t.length>0;let s=n,i=!1;for(let o of t)s=o,i=o.layer?.onHover(o,e.event)||i;i||(this.props.onHover?.(s,e.event),this.widgetManager.onHover(s,e.event)),e.event=null}}_updateCursor(){let e=this.props.parent||this.canvas;e&&(e.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(e){if(this.device=e,!this.animationLoop)return;this.canvas||(this.canvas=this.device.canvasContext?.canvas,!this.canvas.isConnected&&this.props.parent&&this.props.parent.insertBefore(this.canvas,this.props.parent.firstChild)),this.device.type==="webgl"&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device.type==="webgl"&&this.props.onWebGLInitialized(this.device.gl);let t=new qr;t.play(),this.animationLoop.attachTimeline(t),this.eventManager=new ki(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizers:Object.keys(wh).map(s=>{let[i,o,a,c]=wh[s],l=this.props.eventRecognizerOptions?.[s],u={...o,...l,event:s};return{recognizer:new i(u),recognizeWith:a,requestFailure:c}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let s in Ni)this.eventManager.on(s,this._onEvent);this.viewManager=new qi({timeline:t,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let n=this.viewManager.getViewports()[0];this.layerManager=new gn(this.device,{deck:this,stats:this.stats,viewport:n,timeline:t}),this.effectManager=new Qi({deck:this,device:this.device}),this.deckRenderer=new xn(this.device),this.deckPicker=new eo(this.device),this.widgetManager=new Nc({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new bn),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(e,t){let{device:n,gl:s}=this.layerManager.context;this.props.onBeforeRender({device:n,gl:s});let i={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...t};this.deckRenderer?.renderLayers(i),i.pass==="screen"&&this.widgetManager.onRedraw({viewports:i.viewports,layers:i.layers}),this.props.onAfterRender({device:n,gl:s})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),H.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this.device?.type!=="webgpu"&&this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(e){let t=this.props.onViewStateChange(e)||e.viewState;this.viewState&&(this.viewState={...this.viewState,[e.viewId]:t},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(e){this.cursorState.isDragging=e.isDragging||!1,this.props.onInteractionStateChange(e)}_getFrameStats(){let{stats:e}=this;e.get("frameRate").timeEnd(),e.get("frameRate").timeStart();let t=this.animationLoop.stats;e.get("GPU Time").addTime(t.get("GPU Time").lastTiming),e.get("CPU Time").addTime(t.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:e,stats:t}=this;e.fps=t.get("frameRate").getHz(),e.setPropsTime=t.get("setProps Time").time,e.updateAttributesTime=t.get("Update Attributes").time,e.framesRedrawn=t.get("Redraw Count").count,e.pickTime=t.get("pickObject Time").time+t.get("pickMultipleObjects Time").time+t.get("pickObjects Time").time,e.pickCount=t.get("Pick Count").count,e.gpuTime=t.get("GPU Time").time,e.cpuTime=t.get("CPU Time").time,e.gpuTimePerFrame=t.get("GPU Time").getAverageTime(),e.cpuTimePerFrame=t.get("CPU Time").getAverageTime();let n=mr.stats.get("Memory Usage");e.bufferMemory=n.get("Buffer Memory").count,e.textureMemory=n.get("Texture Memory").count,e.renderbufferMemory=n.get("Renderbuffer Memory").count,e.gpuMemory=n.get("GPU Memory").count}};lo.defaultProps=dx;lo.VERSION=nc;var ll=lo;j();j();function px(r){switch(r){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return jr(r)}}var mx=$r;function uo(r,e,t){let n=t==="webgpu"&&e.type==="uint8"?"unorm8":e.type;return{attribute:r,format:e.size>1?`${n}x${e.size}`:e.type,byteOffset:e.offset||0}}function Vr(r){return r.stride||r.size*r.bytesPerElement}function gx(r,e){return r.type===e.type&&r.size===e.size&&Vr(r)===Vr(e)&&(r.offset||0)===(e.offset||0)}function cd(r,e){e.offset&&H.removed("shaderAttribute.offset","vertexOffset, elementOffset")();let t=Vr(r),n=e.vertexOffset!==void 0?e.vertexOffset:r.vertexOffset||0,s=e.elementOffset||0,i=n*t+s*r.bytesPerElement+(r.offset||0);return{...e,offset:i,stride:t}}function CS(r,e){let t=cd(r,e);return{high:t,low:{...t,offset:t.offset+r.size*4}}}var fo=class{constructor(e,t,n){this._buffer=null,this.device=e,this.id=t.id||"",this.size=t.size||1;let s=t.logicalType||t.type,i=s==="float64",{defaultValue:o}=t;o=Number.isFinite(o)?[o]:o||new Array(this.size).fill(0);let a;i?a="float32":!s&&t.isIndexed?a="uint32":a=s||"float32";let c=px(s||a);this.doublePrecision=i,i&&t.fp64===!1&&(c=Float32Array),this.value=null,this.settings={...t,defaultType:c,defaultValue:o,logicalType:s,type:a,normalized:a.includes("norm"),size:this.size,bytesPerElement:c.BYTES_PER_ELEMENT},this.state={...n,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){let e=this.getAccessor();return e.vertexOffset?e.vertexOffset*Vr(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),bt.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(e=this.id,t=null){let n={};if(this.state.constant){let s=this.value;if(t){let i=cd(this.getAccessor(),t),o=i.offset/s.BYTES_PER_ELEMENT,a=i.size||this.size;n[e]=s.subarray(o,o+a)}else n[e]=s}else n[e]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?n[`${e}64Low`]=n[e]:n[`${e}64Low`]=new Float32Array(this.size)),n}_getBufferLayout(e=this.id,t=null){let n=this.getAccessor(),s=[],i={name:this.id,byteStride:Vr(n),attributes:s};if(this.doublePrecision){let o=CS(n,t||{});s.push(uo(e,{...n,...o.high},this.device.type),uo(`${e}64Low`,{...n,...o.low},this.device.type))}else if(t){let o=cd(n,t);s.push(uo(e,{...n,...o},this.device.type))}else s.push(uo(e,n,this.device.type));return i}setAccessor(e){this.state.bufferAccessor=e}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let e=null;if(this.state.constant&&this.value){let t=Array.from(this.value);e=[t,t]}else{let{value:t,numInstances:n,size:s}=this,i=n*s;if(t&&i&&t.length>=i){let o=new Array(s).fill(1/0),a=new Array(s).fill(-1/0);for(let c=0;c<i;)for(let l=0;l<s;l++){let u=t[c++];u<o[l]&&(o[l]=u),u>a[l]&&(a[l]=u)}e=[o,a]}}return this.state.bounds=e,e}setData(e){let{state:t}=this,n;ArrayBuffer.isView(e)?n={value:e}:e instanceof W?n={buffer:e}:n=e;let s={...this.settings,...n};if(ArrayBuffer.isView(n.value)){if(!n.type)if(this.doublePrecision&&n.value instanceof Float64Array)s.type="float32";else{let o=mx(n.value);s.type=s.normalized?o.replace("int","norm"):o}s.bytesPerElement=n.value.BYTES_PER_ELEMENT,s.stride=Vr(s)}if(t.bounds=null,n.constant){let i=n.value;if(i=this._normalizeValue(i,[],0),this.settings.normalized&&(i=this.normalizeConstant(i)),!(!t.constant||!this._areValuesEqual(i,this.value)))return!1;t.externalBuffer=null,t.constant=!0,this.value=ArrayBuffer.isView(i)?i:new Float32Array(i)}else if(n.buffer){let i=n.buffer;t.externalBuffer=i,t.constant=!1,this.value=n.value||null}else if(n.value){this._checkExternalBuffer(n);let i=n.value;t.externalBuffer=null,t.constant=!1,this.value=i;let{buffer:o}=this,a=Vr(s),c=(s.vertexOffset||0)*a;if(this.doublePrecision&&i instanceof Float64Array&&(i=vc(i,s)),this.settings.isIndexed){let u=this.settings.defaultType;i.constructor!==u&&(i=new u(i))}let l=i.byteLength+c+a*2;(!o||o.byteLength<l)&&(o=this._createBuffer(l)),o.write(i,c)}return this.setAccessor(s),!0}updateSubBuffer(e={}){this.state.bounds=null;let t=this.value,{startOffset:n=0,endOffset:s}=e;this.buffer.write(this.doublePrecision&&t instanceof Float64Array?vc(t,{size:this.size,startIndex:n,endIndex:s}):t.subarray(n,s),n*t.BYTES_PER_ELEMENT+this.byteOffset)}allocate(e,t=!1){let{state:n}=this,s=n.allocatedValue,i=bt.allocate(s,e+1,{size:this.size,type:this.settings.defaultType,copy:t});this.value=i;let{byteOffset:o}=this,{buffer:a}=this;return(!a||a.byteLength<i.byteLength+o)&&(a=this._createBuffer(i.byteLength+o),t&&s&&a.write(s instanceof Float64Array?vc(s,this):s,o)),n.allocatedValue=i,n.constant=!1,n.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(e){let{value:t}=e;if(!ArrayBuffer.isView(t))throw new Error(`Attribute ${this.id} value is not TypedArray`);let n=this.settings.defaultType,s=!1;if(this.doublePrecision&&(s=t.BYTES_PER_ELEMENT<4),s)throw new Error(`Attribute ${this.id} does not support ${t.constructor.name}`);!(t instanceof n)&&this.settings.normalized&&!("normalized"in e)&&H.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(e){switch(this.settings.type){case"snorm8":return new Float32Array(e).map(t=>(t+128)/255*2-1);case"snorm16":return new Float32Array(e).map(t=>(t+32768)/65535*2-1);case"unorm8":return new Float32Array(e).map(t=>t/255);case"unorm16":return new Float32Array(e).map(t=>t/65535);default:return e}}_normalizeValue(e,t,n){let{defaultValue:s,size:i}=this.settings;if(Number.isFinite(e))return t[n]=e,t;if(!e){let o=i;for(;--o>=0;)t[n+o]=s[o];return t}switch(i){case 4:t[n+3]=Number.isFinite(e[3])?e[3]:s[3];case 3:t[n+2]=Number.isFinite(e[2])?e[2]:s[2];case 2:t[n+1]=Number.isFinite(e[1])?e[1]:s[1];case 1:t[n+0]=Number.isFinite(e[0])?e[0]:s[0];break;default:let o=i;for(;--o>=0;)t[n+o]=Number.isFinite(e[o])?e[o]:s[o]}return t}_areValuesEqual(e,t){if(!e||!t)return!1;let{size:n}=this;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}_createBuffer(e){this._buffer&&this._buffer.destroy();let{isIndexed:t,type:n}=this.settings;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:(t?W.INDEX:W.VERTEX)|W.COPY_DST,indexType:t?n:void 0,byteLength:e}),this._buffer}};var _x=[],yx=[];function Ss(r,e=0,t=1/0){let n=_x,s={index:-1,data:r,target:[]};return r?typeof r[Symbol.iterator]=="function"?n=r:r.length>0&&(yx.length=r.length,n=yx):n=_x,(e>0||Number.isFinite(t))&&(n=(Array.isArray(n)?n:Array.from(n)).slice(e,t),s.index=e-1),{iterable:n,objectInfo:s}}function ul(r){return r&&r[Symbol.asyncIterator]}function fl(r,e){let{size:t,stride:n,offset:s,startIndices:i,nested:o}=e,a=r.BYTES_PER_ELEMENT,c=n?n/a:t,l=s?s/a:0,u=Math.floor((r.length-l)/c);return(f,{index:h,target:d})=>{if(!i){let b=h*c+l;for(let R=0;R<t;R++)d[R]=r[b+R];return d}let g=i[h],y=i[h+1]||u,_;if(o){_=new Array(y-g);for(let b=g;b<y;b++){let R=b*c+l;d=new Array(t);for(let x=0;x<t;x++)d[x]=r[R+x];_[b-g]=d}}else if(c===t)_=r.subarray(g*t+l,y*t+l);else{_=new r.constructor((y-g)*t);let b=0;for(let R=g;R<y;R++){let x=R*c+l;for(let S=0;S<t;S++)_[b++]=r[x+S]}}return _}}var xx=[],ho=[[0,1/0]];function bx(r,e){if(r===ho||(e[0]<0&&(e[0]=0),e[0]>=e[1]))return r;let t=[],n=r.length,s=0;for(let i=0;i<n;i++){let o=r[i];o[1]<e[0]?(t.push(o),s=i+1):o[0]>e[1]?t.push(o):e=[Math.min(o[0],e[0]),Math.max(o[1],e[1])]}return t.splice(s,0,e),t}var OS={interpolation:{duration:0,easing:r=>r},spring:{stiffness:.05,damping:.5}};function hl(r,e){if(!r)return null;Number.isFinite(r)&&(r={type:"interpolation",duration:r});let t=r.type||"interpolation";return{...OS[t],...e,...r,type:t}}var hr=class extends fo{constructor(e,t){super(e,t,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:ho}),this.constant=!1,this.settings.update=t.update||(t.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(e){this.state.startIndices=e}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:e=!1}={}){let t=this.state.needsRedraw;return this.state.needsRedraw=t&&!e,t}layoutChanged(){return this.state.layoutChanged}setAccessor(e){var t;(t=this.state).layoutChanged||(t.layoutChanged=!gx(e,this.getAccessor())),super.setAccessor(e)}getUpdateTriggers(){let{accessor:e}=this.settings;return[this.id].concat(typeof e!="function"&&e||[])}supportsTransition(){return Boolean(this.settings.transition)}getTransitionSetting(e){if(!e||!this.supportsTransition())return null;let{accessor:t}=this.settings,n=this.settings.transition,s=Array.isArray(t)?e[t.find(i=>e[i])]:e[t];return hl(s,n)}setNeedsUpdate(e=this.id,t){if(this.state.needsUpdate=this.state.needsUpdate||e,this.setNeedsRedraw(e),t){let{startRow:n=0,endRow:s=1/0}=t;this.state.updateRanges=bx(this.state.updateRanges,[n,s])}else this.state.updateRanges=ho}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=xx}setNeedsRedraw(e=this.id){this.state.needsRedraw=this.state.needsRedraw||e}allocate(e){let{state:t,settings:n}=this;return n.noAlloc?!1:n.update?(super.allocate(e,t.updateRanges!==ho),!0):!1}updateBuffer({numInstances:e,data:t,props:n,context:s}){if(!this.needsUpdate())return!1;let{state:{updateRanges:i},settings:{update:o,noAlloc:a}}=this,c=!0;if(o){for(let[l,u]of i)o.call(s,this,{data:t,startRow:l,endRow:u,props:n,numInstances:e});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(let[l,u]of i){let f=Number.isFinite(l)?this.getVertexOffset(l):0,h=Number.isFinite(u)?this.getVertexOffset(u):a||!Number.isFinite(e)?this.value.length:e*this.size;super.updateSubBuffer({startOffset:f,endOffset:h})}this._checkAttributeArray()}else c=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),c}setConstantValue(e,t){let n=this.device.type==="webgpu";if(n||t===void 0||typeof t=="function"){if(n&&typeof t!="function"){let o=this._normalizeValue(t,[],0);this._areValuesEqual(o,this.value)||this.setNeedsUpdate("WebGPU constant updated")}return!1}let s=this.settings.transform&&e?this.settings.transform.call(e,t):t;return this.setData({constant:!0,value:s})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0}setExternalBuffer(e){let{state:t}=this;return e?(this.clearNeedsUpdate(),t.lastExternalBuffer===e||(t.lastExternalBuffer=e,this.setNeedsRedraw(),this.setData(e)),!0):(t.lastExternalBuffer=null,!1)}setBinaryValue(e,t=null){let{state:n,settings:s}=this;if(!e)return n.binaryValue=null,n.binaryAccessor=null,!1;if(s.noAlloc)return!1;if(n.binaryValue===e)return this.clearNeedsUpdate(),!0;if(n.binaryValue=e,this.setNeedsRedraw(),s.transform||t!==this.startIndices){ArrayBuffer.isView(e)&&(e={value:e});let o=e;oe(ArrayBuffer.isView(o.value),`invalid ${s.accessor}`);let a=Boolean(o.size)&&o.size!==this.size;return n.binaryAccessor=fl(o.value,{size:o.size||this.size,stride:o.stride,offset:o.offset,startIndices:t,nested:a}),!1}return this.clearNeedsUpdate(),this.setData(e),!0}getVertexOffset(e){let{startIndices:t}=this;return(t?e<t.length?t[e]:this.numInstances:e)*this.size}getValue(){let e=this.settings.shaderAttributes,t=super.getValue();if(!e)return t;for(let n in e)Object.assign(t,super.getValue(n,e[n]));return t}getBufferLayout(e){this.state.layoutChanged=!1;let t=this.settings.shaderAttributes,n=super._getBufferLayout(),{stepMode:s}=this.settings;if(s==="dynamic"?n.stepMode=e?e.isInstanced?"instance":"vertex":"instance":n.stepMode=s??"vertex",!t)return n;for(let i in t){let o=super._getBufferLayout(i,t[i]);n.attributes.push(...o.attributes)}return n}_autoUpdater(e,{data:t,startRow:n,endRow:s,props:i,numInstances:o}){if(e.constant&&this.context.device.type!=="webgpu")return;let{settings:a,state:c,value:l,size:u,startIndices:f}=e,{accessor:h,transform:d}=a,g=c.binaryAccessor||(typeof h=="function"?h:i[h]);typeof g!="function"&&typeof h=="string"&&(g=()=>i[h]),oe(typeof g=="function",`accessor "${h}" is not a function`);let y=e.getVertexOffset(n),{iterable:_,objectInfo:b}=Ss(t,n,s);for(let R of _){b.index++;let x=g(R,b);if(d&&(x=d.call(this,x)),f){let S=(b.index<f.length-1?f[b.index+1]:o)-f[b.index];if(x&&Array.isArray(x[0])){let C=y;for(let P of x)e._normalizeValue(P,l,C),C+=u}else x&&x.length>u?l.set(x,y):(e._normalizeValue(x,b.target,0),Ic({target:l,source:b.target,start:y,count:S}));y+=S*u}else e._normalizeValue(x,l,y),y+=u}}_validateAttributeUpdaters(){let{settings:e}=this;if(!(e.noAlloc||typeof e.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){let{value:e}=this,t=Math.min(4,this.size);if(e&&e.length>=t){let n=!0;switch(t){case 4:n=n&&Number.isFinite(e[3]);case 3:n=n&&Number.isFinite(e[2]);case 2:n=n&&Number.isFinite(e[1]);case 1:n=n&&Number.isFinite(e[0]);break;default:n=!1}if(!n)throw new Error(`Illegal attribute generated for ${this.id}`)}}};function ld(r){let{source:e,target:t,start:n=0,size:s,getData:i}=r,o=r.end||t.length,a=e.length,c=o-n;if(a>c){t.set(e.subarray(0,c),n);return}if(t.set(e,n),!i)return;let l=a;for(;l<c;){let u=i(l,e);for(let f=0;f<s;f++)t[n+l]=u[f]||0,l++}}function Tx({source:r,target:e,size:t,getData:n,sourceStartIndices:s,targetStartIndices:i}){if(!s||!i)return ld({source:r,target:e,size:t,getData:n}),e;let o=0,a=0,c=n&&((u,f)=>n(u+a,f)),l=Math.min(s.length,i.length);for(let u=1;u<l;u++){let f=s[u]*t,h=i[u]*t;ld({source:r.subarray(o,f),target:e,start:a,end:h,size:t,getData:c}),o=f,a=h}return a<e.length&&ld({source:[],target:e,start:a,size:t,getData:c}),e}function wx(r){let{device:e,settings:t,value:n}=r,s=new hr(e,t);return s.setData({value:n instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:t.normalized}),s}function dl(r){switch(r){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`No defined attribute type for size "${r}"`)}}function pl(r){switch(r){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw new Error("invalid type size")}}function ml(r){r.push(r.shift())}function vx(r,e){let{doublePrecision:t,settings:n,value:s,size:i}=r,o=t&&s instanceof Float64Array?2:1,a=0,{shaderAttributes:c}=r.settings;if(c)for(let l of Object.values(c))a=Math.max(a,l.vertexOffset??0);return(n.noAlloc?s.length:(e+a)*i)*o}function gl({device:r,source:e,target:t}){return(!t||t.byteLength<e.byteLength)&&(t?.destroy(),t=r.createBuffer({byteLength:e.byteLength,usage:e.usage})),t}function _l({device:r,buffer:e,attribute:t,fromLength:n,toLength:s,fromStartIndices:i,getData:o=a=>a}){let a=t.doublePrecision&&t.value instanceof Float64Array?2:1,c=t.size*a,l=t.byteOffset,u=t.settings.bytesPerElement<4?l/t.settings.bytesPerElement*4:l,f=t.startIndices,h=i&&f,d=t.isConstant;if(!h&&e&&n>=s)return e;let g=t.value instanceof Float64Array?Float32Array:t.value.constructor,y=d?t.value:new g(t.getBuffer().readSyncWebGL(l,s*g.BYTES_PER_ELEMENT).buffer);if(t.settings.normalized&&!d){let x=o;o=(S,C)=>t.normalizeConstant(x(S,C))}let _=d?(x,S)=>o(y,S):(x,S)=>o(y.subarray(x+l,x+l+c),S),b=e?new Float32Array(e.readSyncWebGL(u,n*4).buffer):new Float32Array(0),R=new Float32Array(s);return Tx({source:b,target:R,sourceStartIndices:i,targetStartIndices:f,size:c,getData:_}),(!e||e.byteLength<R.byteLength+u)&&(e?.destroy(),e=r.createBuffer({byteLength:R.byteLength+u,usage:35050})),e.write(R,u),e}var Es=class{constructor({device:e,attribute:t,timeline:n}){this.buffers=[],this.currentLength=0,this.device=e,this.transition=new wt(n),this.attribute=t,this.attributeInTransition=wx(t),this.currentStartIndices=t.startIndices}get inProgress(){return this.transition.inProgress}start(e,t,n=1/0){this.settings=e,this.currentStartIndices=this.attribute.startIndices,this.currentLength=vx(this.attribute,t),this.transition.start({...e,duration:n})}update(){let e=this.transition.update();return e&&this.onUpdate(),e}setBuffer(e){this.attributeInTransition.setData({buffer:e,normalized:this.attribute.settings.normalized,value:this.attributeInTransition.value})}cancel(){this.transition.cancel()}delete(){this.cancel();for(let e of this.buffers)e.destroy();this.buffers.length=0}};var po=class extends Es{constructor({device:e,attribute:t,timeline:n}){super({device:e,attribute:t,timeline:n}),this.type="interpolation",this.transform=FS(e,t)}start(e,t){let n=this.currentLength,s=this.currentStartIndices;if(super.start(e,t,e.duration),e.duration<=0){this.transition.cancel();return}let{buffers:i,attribute:o}=this;ml(i),i[0]=_l({device:this.device,buffer:i[0],attribute:o,fromLength:n,toLength:this.currentLength,fromStartIndices:s,getData:e.enter}),i[1]=gl({device:this.device,source:i[0],target:i[1]}),this.setBuffer(i[1]);let{transform:a}=this,c=a.model,l=Math.floor(this.currentLength/o.size);Sx(o)&&(l/=2),c.setVertexCount(l),o.isConstant?(c.setAttributes({aFrom:i[0]}),c.setConstantAttributes({aTo:o.value})):c.setAttributes({aFrom:i[0],aTo:o.getBuffer()}),a.transformFeedback.setBuffers({vCurrent:i[1]})}onUpdate(){let{duration:e,easing:t}=this.settings,{time:n}=this.transition,s=n/e;t&&(s=t(s));let{model:i}=this.transform,o={time:s};i.shaderInputs.setProps({interpolation:o}),this.transform.run({discard:!0})}delete(){super.delete(),this.transform.destroy()}},kS=`uniform interpolationUniforms {
1591
1591
  float time;
1592
1592
  } interpolation;
1593
1593
  `,Ax={name:"interpolation",vs:kS,uniformTypes:{time:"f32"}},NS=`#version 300 es
@@ -1667,6 +1667,6 @@ void main(void) {
1667
1667
  discard;
1668
1668
  }
1669
1669
  fragColor = vec4(1.0);
1670
- }`;function zS(r,e){let t=dl(e.size),n=pl(e.size);return new pt(r,{vs:US,fs:VS,bufferLayout:[{name:"aPrev",format:n},{name:"aCur",format:n},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],modules:[LS],defines:{ATTRIBUTE_TYPE:t},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function WS(r){return r.createTexture({data:new Uint8Array(4),format:"rgba8unorm",width:1,height:1})}function $S(r,e){return r.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}var jS={interpolation:po,spring:mo},go=class{constructor(e,{id:t,timeline:n}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=t,this.device=e,this.timeline=n,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:t,numInstances:n}){this.numInstances=n||1;for(let s in e){let i=e[s],o=i.getTransitionSetting(t);o&&this._updateAttribute(s,i,o)}for(let s in this.transitions){let i=e[s];(!i||!i.getTransitionSetting(t))&&this._removeTransition(s)}}hasAttribute(e){let t=this.transitions[e];return t&&t.inProgress}getAttributes(){let e={};for(let t in this.transitions){let n=this.transitions[t];n.inProgress&&(e[t]=n.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(let t in this.transitions)this.transitions[t].update()&&(this.needsRedraw=!0);let e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,t,n){let s=this.transitions[e],i=!s||s.type!==n.type;if(i){s&&this._removeTransition(e);let o=jS[n.type];o?this.transitions[e]=new o({attribute:t,timeline:this.timeline,device:this.device}):(H.error(`unsupported transition type '${n.type}'`)(),i=!1)}(i||t.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(n,this.numInstances))}};var Ex="attributeManager.invalidate",HS="attributeManager.updateStart",XS="attributeManager.updateEnd",YS="attribute.updateStart",qS="attribute.allocate",KS="attribute.updateEnd",vn=class{constructor(e,{id:t="attribute-manager",stats:n,timeline:s}={}){this.mergeBoundsMemoized=it(N_),this.id=t,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=n,this.attributeTransitionManager=new go(e,{id:`${t}-transitions`,timeline:s}),Object.seal(this)}finalize(){for(let e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){let t=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,t&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(let t of e)this.attributes[t]!==void 0&&(this.attributes[t].delete(),delete this.attributes[t])}invalidate(e,t){let n=this._invalidateTrigger(e,t);he(Ex,this,e,n)}invalidateAll(e){for(let t in this.attributes)this.attributes[t].setNeedsUpdate(t,e);he(Ex,this,"all")}update({data:e,numInstances:t,startIndices:n=null,transitions:s,props:i={},buffers:o={},context:a={}}){let c=!1;he(HS,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(let l in this.attributes){let u=this.attributes[l],f=u.settings.accessor;u.startIndices=n,u.numInstances=t,i[l]&&H.removed(`props.${l}`,`data.attributes.${l}`)(),u.setExternalBuffer(o[l])||u.setBinaryValue(typeof f=="string"?o[f]:void 0,e.startIndices)||typeof f=="string"&&!o[f]&&u.setConstantValue(i[f])||u.needsUpdate()&&(c=!0,this._updateAttribute({attribute:u,numInstances:t,data:e,props:i,context:a})),this.needsRedraw=this.needsRedraw||u.needsRedraw()}c&&he(XS,this,t),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:t,transitions:s})}updateTransition(){let{attributeTransitionManager:e}=this,t=e.run();return this.needsRedraw=this.needsRedraw||t,t}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){let t=e.map(n=>this.attributes[n]?.getBounds());return this.mergeBoundsMemoized(t)}getChangedAttributes(e={clearChangedFlags:!1}){let{attributes:t,attributeTransitionManager:n}=this,s={...n.getAttributes()};for(let i in t){let o=t[i];o.needsRedraw(e)&&!n.hasAttribute(i)&&(s[i]=o)}return s}getBufferLayouts(e){return Object.values(this.getAttributes()).map(t=>t.getBufferLayout(e))}_add(e,t){for(let n in e){let s=e[n],i={...s,id:n,size:s.isIndexed&&1||s.size||1,...t};this.attributes[n]=new hr(this.device,i)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){let e={};for(let t in this.attributes)this.attributes[t].getUpdateTriggers().forEach(s=>{e[s]||(e[s]=[]),e[s].push(t)});this.updateTriggers=e}_invalidateTrigger(e,t){let{attributes:n,updateTriggers:s}=this,i=s[e];return i&&i.forEach(o=>{let a=n[o];a&&a.setNeedsUpdate(a.id,t)}),i}_updateAttribute(e){let{attribute:t,numInstances:n}=e;if(he(YS,t),t.constant){t.setConstantValue(t.value);return}t.allocate(n)&&he(qS,t,n),t.updateBuffer(e)&&(this.needsRedraw=!0,he(KS,t,n))}};j();il();var _o=class extends wt{get value(){return this._value}_onUpdate(){let{time:e,settings:{fromValue:t,toValue:n,duration:s,easing:i}}=this,o=i(e/s);this._value=Jt(t,n,o)}};var Rx=1e-5;function Ix(r,e,t,n,s){let i=e-r,a=(t-e)*s,c=-i*n;return a+c+i+e}function ZS(r,e,t,n,s){if(Array.isArray(t)){let i=[];for(let o=0;o<t.length;o++)i[o]=Ix(r[o],e[o],t[o],n,s);return i}return Ix(r,e,t,n,s)}function Px(r,e){if(Array.isArray(r)){let t=0;for(let n=0;n<r.length;n++){let s=r[n]-e[n];t+=s*s}return Math.sqrt(t)}return Math.abs(r-e)}var yo=class extends wt{get value(){return this._currValue}_onUpdate(){let{fromValue:e,toValue:t,damping:n,stiffness:s}=this.settings,{_prevValue:i=e,_currValue:o=e}=this,a=ZS(i,o,t,n,s),c=Px(a,t),l=Px(a,o);c<Rx&&l<Rx&&(a=t,this.end()),this._prevValue=o,this._currValue=a}};var GS={interpolation:_o,spring:yo},xo=class{constructor(e){this.transitions=new Map,this.timeline=e}get active(){return this.transitions.size>0}add(e,t,n,s){let{transitions:i}=this;if(i.has(e)){let c=i.get(e),{value:l=c.settings.fromValue}=c;t=l,this.remove(e)}if(s=hl(s),!s)return;let o=GS[s.type];if(!o){H.error(`unsupported transition type '${s.type}'`)();return}let a=new o(this.timeline);a.start({...s,fromValue:t,toValue:n}),i.set(e,a)}remove(e){let{transitions:t}=this;t.has(e)&&(t.get(e).cancel(),t.delete(e))}update(){let e={};for(let[t,n]of this.transitions)n.update(),e[t]=n.value,n.inProgress||this.remove(t);return e}clear(){for(let e of this.transitions.keys())this.remove(e)}};function Mx(r){let e=r[lt];for(let t in e){let n=e[t],{validate:s}=n;if(s&&!s(r[t],n))throw new Error(`Invalid prop ${t}: ${r[t]}`)}}function Ox(r,e){let t=yl({newProps:r,oldProps:e,propTypes:r[lt],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),n=JS(r,e),s=!1;return n||(s=eE(r,e)),{dataChanged:n,propsChanged:t,updateTriggersChanged:s,extensionsChanged:tE(r,e),transitionsChanged:QS(r,e)}}function QS(r,e){if(!r.transitions)return!1;let t={},n=r[lt],s=!1;for(let i in r.transitions){let o=n[i],a=o&&o.type;(a==="number"||a==="color"||a==="array")&&ud(r[i],e[i],o)&&(t[i]=!0,s=!0)}return s?t:!1}function yl({newProps:r,oldProps:e,ignoreProps:t={},propTypes:n={},triggerName:s="props"}){if(e===r)return!1;if(typeof r!="object"||r===null)return`${s} changed shallowly`;if(typeof e!="object"||e===null)return`${s} changed shallowly`;for(let i of Object.keys(r))if(!(i in t)){if(!(i in e))return`${s}.${i} added`;let o=ud(r[i],e[i],n[i]);if(o)return`${s}.${i} ${o}`}for(let i of Object.keys(e))if(!(i in t)){if(!(i in r))return`${s}.${i} dropped`;if(!Object.hasOwnProperty.call(r,i)){let o=ud(r[i],e[i],n[i]);if(o)return`${s}.${i} ${o}`}}return!1}function ud(r,e,t){let n=t&&t.equal;return n&&!n(r,e,t)||!n&&(n=r&&e&&r.equals,n&&!n.call(r,e))?"changed deeply":!n&&e!==r?"changed shallowly":null}function JS(r,e){if(e===null)return"oldProps is null, initial diff";let t=!1,{dataComparator:n,_dataDiff:s}=r;return n?n(r.data,e.data)||(t="Data comparator detected a change"):r.data!==e.data&&(t="A new data container was supplied"),t&&s&&(t=s(r.data,e.data)||t),t}function eE(r,e){if(e===null)return{all:!0};if("all"in r.updateTriggers&&Cx(r,e,"all"))return{all:!0};let t={},n=!1;for(let s in r.updateTriggers)s!=="all"&&Cx(r,e,s)&&(t[s]=!0,n=!0);return n?t:!1}function tE(r,e){if(e===null)return!0;let t=e.extensions,{extensions:n}=r;if(n===t)return!1;if(!t||!n||n.length!==t.length)return!0;for(let s=0;s<n.length;s++)if(!n[s].equals(t[s]))return!0;return!1}function Cx(r,e,t){let n=r.updateTriggers[t];n=n??{};let s=e.updateTriggers[t];return s=s??{},yl({oldProps:s,newProps:n,triggerName:t})}var rE="count(): argument not an object",nE="count(): argument not a container";function xl(r){if(!iE(r))throw new Error(rE);if(typeof r.count=="function")return r.count();if(Number.isFinite(r.size))return r.size;if(Number.isFinite(r.length))return r.length;if(sE(r))return Object.keys(r).length;throw new Error(nE)}function sE(r){return r!==null&&typeof r=="object"&&r.constructor===Object}function iE(r){return r!==null&&typeof r=="object"}function bo(r,e){if(!e)return r;let t={...r,...e};if("defines"in e&&(t.defines={...r.defines,...e.defines}),"modules"in e&&(t.modules=(r.modules||[]).concat(e.modules),e.modules.some(n=>n.name==="project64"))){let n=t.modules.findIndex(s=>s.name==="project32");n>=0&&t.modules.splice(n,1)}if("inject"in e)if(!r.inject)t.inject=e.inject;else{let n={...r.inject};for(let s in e.inject)n[s]=(n[s]||"")+e.inject[s];t.inject=n}return t}j();var oE={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},fd={};function kx(r,e,t,n){if(t instanceof K)return t;t.constructor&&t.constructor.name!=="Object"&&(t={data:t});let s=null;t.compressed&&(s={minFilter:"linear",mipmapFilter:t.data.length>1?"nearest":"linear"});let{width:i,height:o}=t.data,a=e.createTexture({...t,sampler:{...oE,...s,...n},mipLevels:e.getMipLevelCount(i,o)});return a.generateMipmapsWebGL(),fd[a.id]=r,a}function Nx(r,e){!e||!(e instanceof K)||fd[e.id]===r&&(e.delete(),delete fd[e.id])}var aE={boolean:{validate(r,e){return!0},equal(r,e,t){return Boolean(r)===Boolean(e)}},number:{validate(r,e){return Number.isFinite(r)&&(!("max"in e)||r<=e.max)&&(!("min"in e)||r>=e.min)}},color:{validate(r,e){return e.optional&&!r||hd(r)&&(r.length===3||r.length===4)},equal(r,e,t){return le(r,e,1)}},accessor:{validate(r,e){let t=bl(r);return t==="function"||t===bl(e.value)},equal(r,e,t){return typeof e=="function"?!0:le(r,e,1)}},array:{validate(r,e){return e.optional&&!r||hd(r)},equal(r,e,t){let{compare:n}=t,s=Number.isInteger(n)?n:n?1:0;return n?le(r,e,s):r===e}},object:{equal(r,e,t){if(t.ignore)return!0;let{compare:n}=t,s=Number.isInteger(n)?n:n?1:0;return n?le(r,e,s):r===e}},function:{validate(r,e){return e.optional&&!r||typeof r=="function"},equal(r,e,t){return!t.compare&&t.ignore!==!1||r===e}},data:{transform:(r,e,t)=>{if(!r)return r;let{dataTransform:n}=t.props;return n?n(r):typeof r.shape=="string"&&r.shape.endsWith("-table")&&Array.isArray(r.data)?r.data:r}},image:{transform:(r,e,t)=>{let n=t.context;return!n||!n.device?null:kx(t.id,n.device,r,{...e.parameters,...t.props.textureParameters})},release:(r,e,t)=>{Nx(t.id,r)}}};function Dx(r){let e={},t={},n={};for(let[s,i]of Object.entries(r)){let o=i?.deprecatedFor;if(o)n[s]=Array.isArray(o)?o:[o];else{let a=cE(s,i);e[s]=a,t[s]=a.value}}return{propTypes:e,defaultProps:t,deprecatedProps:n}}function cE(r,e){switch(bl(e)){case"object":return To(r,e);case"array":return To(r,{type:"array",value:e,compare:!1});case"boolean":return To(r,{type:"boolean",value:e});case"number":return To(r,{type:"number",value:e});case"function":return To(r,{type:"function",value:e,compare:!0});default:return{name:r,type:"unknown",value:e}}}function To(r,e){return"type"in e?{name:r,...aE[e.type],...e}:"value"in e?{name:r,type:bl(e.value),...e}:{name:r,type:"object",value:e}}function hd(r){return Array.isArray(r)||ArrayBuffer.isView(r)}function bl(r){return hd(r)?"array":r===null?"null":typeof r}function Fx(r,e){let t;for(let i=e.length-1;i>=0;i--){let o=e[i];"extensions"in o&&(t=o.extensions)}let n=dd(r.constructor,t),s=Object.create(n);s[ys]=r,s[Bt]={},s[Tt]={};for(let i=0;i<e.length;++i){let o=e[i];for(let a in o)s[a]=o[a]}return Object.freeze(s),s}var lE="_mergedDefaultProps";function dd(r,e){if(!(r instanceof Rs.constructor))return{};let t=lE;if(e)for(let s of e){let i=s.constructor;i&&(t+=`:${i.extensionName||i.name}`)}let n=Bx(r,t);return n||(r[t]=uE(r,e||[]))}function uE(r,e){if(!r.prototype)return null;let n=Object.getPrototypeOf(r),s=dd(n),i=Bx(r,"defaultProps")||{},o=Dx(i),a=Object.assign(Object.create(null),s,o.defaultProps),c=Object.assign(Object.create(null),s?.[lt],o.propTypes),l=Object.assign(Object.create(null),s?.[Rc],o.deprecatedProps);for(let u of e){let f=dd(u.constructor);f&&(Object.assign(a,f),Object.assign(c,f[lt]),Object.assign(l,f[Rc]))}return fE(a,r),dE(a,c),hE(a,l),a[lt]=c,a[Rc]=l,e.length===0&&!pd(r,"_propTypes")&&(r._propTypes=c),a}function fE(r,e){let t=mE(e);Object.defineProperties(r,{id:{writable:!0,value:t}})}function hE(r,e){for(let t in e)Object.defineProperty(r,t,{enumerable:!1,set(n){let s=`${this.id}: ${t}`;for(let i of e[t])pd(this,i)||(this[i]=n);H.deprecated(s,e[t].join("/"))()}})}function dE(r,e){let t={},n={};for(let s in e){let i=e[s],{name:o,value:a}=i;i.async&&(t[o]=a,n[o]=pE(o))}r[or]=t,r[Bt]={},Object.defineProperties(r,n)}function pE(r){return{enumerable:!0,set(e){typeof e=="string"||e instanceof Promise||ul(e)?this[Bt][r]=e:this[Tt][r]=e},get(){if(this[Tt]){if(r in this[Tt])return this[Tt][r]||this[or][r];if(r in this[Bt]){let e=this[ys]&&this[ys].internalState;if(e&&e.hasAsyncProp(r))return e.getAsyncProp(r)||this[or][r]}}return this[or][r]}}}function pd(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Bx(r,e){return pd(r,e)&&r[e]}function mE(r){let e=r.componentName;return e||H.warn(`${r.name}.componentName not specified`)(),e||r.name}var gE=0,wo=class{constructor(...e){this.props=Fx(this,e),this.id=this.props.id,this.count=gE++}clone(e){let{props:t}=this,n={};for(let s in t[or])s in t[Tt]?n[s]=t[Tt][s]:s in t[Bt]&&(n[s]=t[Bt][s]);return new this.constructor({...t,...n,...e})}};wo.componentName="Component";wo.defaultProps={};var Rs=wo;var _E=Object.freeze({}),An=class{constructor(e){this.component=e,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let e in this.asyncProps){let t=this.asyncProps[e];t&&t.type&&t.type.release&&t.type.release(t.resolvedValue,t.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||_E}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){let t=this.asyncProps[e];return t&&t.resolvedValue}isAsyncPropLoading(e){if(e){let t=this.asyncProps[e];return Boolean(t&&t.pendingLoadCount>0&&t.pendingLoadCount!==t.resolvedLoadCount)}for(let t in this.asyncProps)if(this.isAsyncPropLoading(t))return!0;return!1}reloadAsyncProp(e,t){this._watchPromise(e,Promise.resolve(t))}setAsyncProps(e){this.component=e[ys]||this.component;let t=e[Tt]||{},n=e[Bt]||e,s=e[or]||{};for(let i in t){let o=t[i];this._createAsyncPropData(i,s[i]),this._updateAsyncProp(i,o),t[i]=this.getAsyncProp(i)}for(let i in n){let o=n[i];this._createAsyncPropData(i,s[i]),this._updateAsyncProp(i,o)}}_fetch(e,t){return null}_onResolve(e,t){}_onError(e,t){}_updateAsyncProp(e,t){if(this._didAsyncInputValueChange(e,t)){if(typeof t=="string"&&(t=this._fetch(e,t)),t instanceof Promise){this._watchPromise(e,t);return}if(ul(t)){this._resolveAsyncIterable(e,t);return}this._setPropValue(e,t)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,t){let n=this.asyncProps[e];return t===n.resolvedValue||t===n.lastValue?!1:(n.lastValue=t,!0)}_setPropValue(e,t){this._freezeAsyncOldProps();let n=this.asyncProps[e];n&&(t=this._postProcessValue(n,t),n.resolvedValue=t,n.pendingLoadCount++,n.resolvedLoadCount=n.pendingLoadCount)}_setAsyncPropValue(e,t,n){let s=this.asyncProps[e];s&&n>=s.resolvedLoadCount&&t!==void 0&&(this._freezeAsyncOldProps(),s.resolvedValue=t,s.resolvedLoadCount=n,this.onAsyncPropUpdated(e,t))}_watchPromise(e,t){let n=this.asyncProps[e];if(n){n.pendingLoadCount++;let s=n.pendingLoadCount;t.then(i=>{this.component&&(i=this._postProcessValue(n,i),this._setAsyncPropValue(e,i,s),this._onResolve(e,i))}).catch(i=>{this._onError(e,i)})}}async _resolveAsyncIterable(e,t){if(e!=="data"){this._setPropValue(e,t);return}let n=this.asyncProps[e];if(!n)return;n.pendingLoadCount++;let s=n.pendingLoadCount,i=[],o=0;for await(let a of t){if(!this.component)return;let{dataTransform:c}=this.component.props;c?i=c(a,i):i=i.concat(a),Object.defineProperty(i,"__diff",{enumerable:!1,value:[{startRow:o,endRow:i.length}]}),o=i.length,this._setAsyncPropValue(e,i,s)}this._onResolve(e,i)}_postProcessValue(e,t){let n=e.type;return n&&this.component&&(n.release&&n.release(e.resolvedValue,n,this.component),n.transform)?n.transform(t,n,this.component):t}_createAsyncPropData(e,t){if(!this.asyncProps[e]){let s=this.component&&this.component.props[lt];this.asyncProps[e]={type:s&&s[e],lastValue:null,resolvedValue:t,pendingLoadCount:0,resolvedLoadCount:0}}}};var vo=class extends An{constructor({attributeManager:e,layer:t}){super(t),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,t){let n=this.layer,s=n?.props.fetch;return s?s(t,{propName:e,layer:n}):super._fetch(e,t)}_onResolve(e,t){let n=this.layer;if(n){let s=n.props.onDataLoad;e==="data"&&s&&s(t,{propName:e,layer:n})}}_onError(e,t){let n=this.layer;n&&n.raiseError(t,`loading ${e} of ${this.layer}`)}};var yE="layer.changeFlag",xE="layer.initialize",bE="layer.update",TE="layer.finalize",wE="layer.matched",Lx=2**24-1,vE=Object.freeze([]),AE=it(({oldViewport:r,viewport:e})=>r.equals(e)),Et=new Uint8ClampedArray(0),SE={data:{type:"data",value:vE,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:r=>r&&r.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(r,{propName:e,layer:t,loaders:n,loadOptions:s,signal:i})=>{let{resourceManager:o}=t.context;s=s||t.getLoadOptions(),n=n||t.props.loaders,i&&(s={...s,fetch:{...s?.fetch,signal:i}});let a=o.contains(r);return!a&&!s&&(o.add({resourceId:r,data:Rr(r,n),persistent:!1}),a=!0),a?o.subscribe({resourceId:r,onChange:c=>t.internalState?.reloadAsyncProp(e,c),consumerId:t.id,requestId:e}):Rr(r,n,s)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:Y.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:r})=>[0,-r*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}},Ao=class extends Rs{constructor(){super(...arguments),this.internalState=null,this.lifecycle=Nr.NO_STATE,this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(e){oe(this.internalState);let t=this.internalState.viewport||this.context.viewport,n=Fh(e,{viewport:t,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[s,i,o]=fs(n,t.pixelProjectionMatrix);return e.length===2?[s,i]:[s,i,o]}unproject(e){return oe(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,t){oe(this.internalState);let n=this.internalState.viewport||this.context.viewport;return Ac(e,{viewport:n,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...t})}get isComposite(){return!1}get isDrawable(){return!0}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){let e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setShaderModuleProps(...e){for(let t of this.getModels())t.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:e}=this.props;return e===Y.DEFAULT||e===Y.LNGLAT||e===Y.CARTESIAN}onHover(e,t){return this.props.onHover&&this.props.onHover(e,t)||!1}onClick(e,t){return this.props.onClick&&this.props.onClick(e,t)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,t=[]){return t[0]=e+1&255,t[1]=e+1>>8&255,t[2]=e+1>>8>>8&255,t}decodePickingColor(e){oe(e instanceof Uint8Array);let[t,n,s]=e;return t+n*256+s*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:xl(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(e){e=bo(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(let t of this.props.extensions)e=bo(e,t.getShaders.call(this,t));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){let t=this.getAttributeManager(),{dataChanged:n}=e.changeFlags;if(n&&t)if(Array.isArray(n))for(let s of n)t.invalidateAll(s);else t.invalidateAll();if(t){let{props:s}=e,i=this.internalState.hasPickingBuffer,o=Number.isInteger(s.highlightedObjectIndex)||s.pickable||s.extensions.some(a=>a.getNeedsPickingBuffer.call(this,a));if(i!==o){this.internalState.hasPickingBuffer=o;let{pickingColors:a,instancePickingColors:c}=t.attributes,l=a||c;l&&(o&&l.constant&&(l.constant=!1,t.invalidate(l.id)),!l.value&&!o&&(l.constant=!0,l.value=[0,0,0]))}}}finalizeState(e){for(let n of this.getModels())n.destroy();let t=this.getAttributeManager();t&&t.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(let t of this.getModels())t.draw(e.renderPass)}getPickingInfo({info:e,mode:t,sourceLayer:n}){let{index:s}=e;return s>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[s]),e}raiseError(e,t){t&&(e=new Error(`${t}: ${e.message}`,{cause:e})),this.props.onError?.(e)||this.context?.onError?.(e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(e){if(!this.internalState)return;let t=this.internalState.viewport;this.internalState.viewport=e,(!t||!AE({oldViewport:t,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){let t=this.getAttributeManager();t&&(e==="all"?t.invalidateAll():t.invalidate(e))}updateAttributes(e){let t=!1;for(let n in e)e[n].layoutChanged()&&(t=!0);for(let n of this.getModels())this._setModelAttributes(n,e,t)}_updateAttributes(){let e=this.getAttributeManager();if(!e)return;let t=this.props,n=this.getNumInstances(),s=this.getStartIndices();e.update({data:t.data,numInstances:n,startIndices:s,props:t,transitions:t.transitions,buffers:t.data.attributes,context:this});let i=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(i)}_updateAttributeTransition(){let e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){let{uniformTransitions:e}=this.internalState;if(e.active){let t=e.update(),n=Object.create(this.props);for(let s in t)Object.defineProperty(n,s,{value:t[s]});return n}return this.props}calculateInstancePickingColors(e,{numInstances:t}){if(e.constant)return;let n=Math.floor(Et.length/4);if(this.internalState.usesPickingColorCache=!0,n<t){t>Lx&&H.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),Et=bt.allocate(Et,t,{size:4,copy:!0,maxCount:Math.max(t,Lx)});let s=Math.floor(Et.length/4),i=[0,0,0];for(let o=n;o<s;o++)this.encodePickingColor(o,i),Et[o*4+0]=i[0],Et[o*4+1]=i[1],Et[o*4+2]=i[2],Et[o*4+3]=0}e.value=Et.subarray(0,t*4)}_setModelAttributes(e,t,n=!1){if(!Object.keys(t).length)return;if(n){let a=this.getAttributeManager();e.setBufferLayout(a.getBufferLayouts(e)),t=a.getAttributes()}let s=e.userData?.excludeAttributes||{},i={},o={};for(let a in t){if(s[a])continue;let c=t[a].getValue();for(let l in c){let u=c[l];u instanceof W?t[a].settings.isIndexed?e.setIndexBuffer(u):i[l]=u:u&&(o[l]=u)}}e.setAttributes(i),e.setConstantAttributes(o)}disablePickingIndex(e){let t=this.props.data;if(!("attributes"in t)){this._disablePickingIndex(e);return}let{pickingColors:n,instancePickingColors:s}=this.getAttributeManager().attributes,i=n||s,o=i&&t.attributes&&t.attributes[i.id];if(o&&o.value){let a=o.value,c=this.encodePickingColor(e);for(let l=0;l<t.length;l++){let u=i.getVertexOffset(l);a[u]===c[0]&&a[u+1]===c[1]&&a[u+2]===c[2]&&this._disablePickingIndex(l)}}else this._disablePickingIndex(e)}_disablePickingIndex(e){let{pickingColors:t,instancePickingColors:n}=this.getAttributeManager().attributes,s=t||n;if(!s)return;let i=s.getVertexOffset(e),o=s.getVertexOffset(e+1);s.buffer.write(new Uint8Array(o-i),i)}restorePickingColors(){let{pickingColors:e,instancePickingColors:t}=this.getAttributeManager().attributes,n=e||t;n&&(this.internalState.usesPickingColorCache&&n.value.buffer!==Et.buffer&&(n.value=Et.subarray(0,n.value.length)),n.updateSubBuffer({startOffset:0}))}_initialize(){oe(!this.internalState),oe(Number.isFinite(this.props.coordinateSystem)),he(xE,this);let e=this._getAttributeManager();e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new vo({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(H.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new xo(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(let t of this.props.extensions)t.initializeState.call(this,this.context,t);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){he(wE,this,this===e);let{state:t,internalState:n}=e;this!==e&&(this.internalState=n,this.state=t,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let e=this.needsUpdate();if(he(bE,this,e),!e)return;let t=this.props,n=this.context,s=this.internalState,i=n.viewport,o=this._updateUniformTransition();s.propsInTransition=o,n.viewport=s.viewport||i,this.props=o;try{let a=this._getUpdateParams(),c=this.getModels();if(n.device)this.updateState(a);else try{this.updateState(a)}catch{}for(let u of this.props.extensions)u.updateState.call(this,a,u);this.setNeedsRedraw(),this._updateAttributes();let l=this.getModels()[0]!==c[0];this._postUpdate(a,l)}finally{n.viewport=i,this.props=t,this._clearChangeFlags(),s.needsUpdate=!1,s.resetOldProps()}}_finalize(){he(TE,this),this.finalizeState(this.context);for(let e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,shaderModuleProps:t=null,uniforms:n={},parameters:s={}}){this._updateAttributeTransition();let i=this.props,o=this.context;this.props=this.internalState.propsInTransition||i;try{t&&this.setShaderModuleProps(t);let{getPolygonOffset:a}=this.props,c=a&&a(n)||[0,0];o.device instanceof wn&&o.device.setParametersWebGL({polygonOffset:c});for(let l of this.getModels())l.device.type==="webgpu"?l.setParameters({...l.parameters,...s}):l.setParameters(s);if(o.device instanceof wn)o.device.withParametersWebGL(s,()=>{let l={renderPass:e,shaderModuleProps:t,uniforms:n,parameters:s,context:o};for(let u of this.props.extensions)u.draw.call(this,l,u);this.draw(l)});else{let l={renderPass:e,shaderModuleProps:t,uniforms:n,parameters:s,context:o};for(let u of this.props.extensions)u.draw.call(this,l,u);this.draw(l)}}finally{this.props=i}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(e){if(!this.internalState)return;let{changeFlags:t}=this.internalState;for(let s in e)if(e[s]){let i=!1;switch(s){case"dataChanged":let o=e[s],a=t[s];o&&Array.isArray(a)&&(t.dataChanged=Array.isArray(o)?a.concat(o):o,i=!0);default:t[s]||(t[s]=e[s],i=!0)}i&&he(yE,this,s,e)}let n=Boolean(t.dataChanged||t.updateTriggersChanged||t.propsChanged||t.extensionsChanged);t.propsOrDataChanged=n,t.somethingChanged=n||t.viewportChanged||t.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,t){let n=Ox(e,t);if(n.updateTriggersChanged)for(let s in n.updateTriggersChanged)n.updateTriggersChanged[s]&&this.invalidateAttribute(s);if(n.transitionsChanged)for(let s in n.transitionsChanged)this.internalState.uniformTransitions.add(s,t[s],e[s],e.transitions?.[s]);return this.setChangeFlags(n)}validateProps(){Mx(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){let t={highlightedObjectColor:e.picked?e.color:null},{highlightColor:n}=this.props;e.picked&&typeof n=="function"&&(t.highlightColor=n(e)),this.setShaderModuleProps({picking:t}),this.setNeedsRedraw()}_getAttributeManager(){let e=this.context;return new vn(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,t){let{props:n,oldProps:s}=e,i=this.state.model;i?.isInstanced&&i.setInstanceCount(this.getNumInstances());let{autoHighlight:o,highlightedObjectIndex:a,highlightColor:c}=n;if(t||s.autoHighlight!==o||s.highlightedObjectIndex!==a||s.highlightColor!==c){let l={};Array.isArray(c)&&(l.highlightColor=c),(t||s.autoHighlight!==o||a!==s.highlightedObjectIndex)&&(l.highlightedObjectColor=Number.isFinite(a)&&a>=0?this.encodePickingColor(a):null),this.setShaderModuleProps({picking:l})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let t=!1;t=t||this.internalState.needsRedraw&&this.id;let n=this.getAttributeManager(),s=n?n.getNeedsRedraw(e):!1;if(t=t||s,t)for(let i of this.props.extensions)i.onNeedsRedraw.call(this,i);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,t}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}};Ao.defaultProps=SE;Ao.layerName="Layer";var Tl=Ao;var EE="compositeLayer.renderLayers",wl=class extends Tl{get isComposite(){return!0}get isDrawable(){return!1}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(e=>e.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(e){}setState(e){super.setState(e),this.setNeedsUpdate()}getPickingInfo({info:e}){let{object:t}=e;return t&&t.__source&&t.__source.parent&&t.__source.parent.id===this.id&&(e.object=t.__source.object,e.index=t.__source.index),e}filterSubLayer(e){return!0}shouldRenderSubLayer(e,t){return t&&t.length}getSubLayerClass(e,t){let{_subLayerProps:n}=this.props;return n&&n[e]&&n[e].type||t}getSubLayerRow(e,t,n){return e.__source={parent:this,object:t,index:n},e}getSubLayerAccessor(e){if(typeof e=="function"){let t={index:-1,data:this.props.data,target:[]};return(n,s)=>n&&n.__source?(t.index=n.__source.index,e(n.__source.object,t)):e(n,s)}return e}getSubLayerProps(e={}){let{opacity:t,pickable:n,visible:s,parameters:i,getPolygonOffset:o,highlightedObjectIndex:a,autoHighlight:c,highlightColor:l,coordinateSystem:u,coordinateOrigin:f,wrapLongitude:h,positionFormat:d,modelMatrix:g,extensions:y,fetch:_,operation:b,_subLayerProps:R}=this.props,x={id:"",updateTriggers:{},opacity:t,pickable:n,visible:s,parameters:i,getPolygonOffset:o,highlightedObjectIndex:a,autoHighlight:c,highlightColor:l,coordinateSystem:u,coordinateOrigin:f,wrapLongitude:h,positionFormat:d,modelMatrix:g,extensions:y,fetch:_,operation:b},S=R&&e.id&&R[e.id],C=S&&S.updateTriggers,P=e.id||"sublayer";if(S){let B=this.props[lt],N=e.type?e.type._propTypes:{};for(let k in S){let F=N[k]||B[k];F&&F.type==="accessor"&&(S[k]=this.getSubLayerAccessor(S[k]))}}Object.assign(x,e,S),x.id=`${this.props.id}-${P}`,x.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...C};for(let B of y){let N=B.getSubLayerProps.call(this,B);N&&Object.assign(x,N,{updateTriggers:Object.assign(x.updateTriggers,N.updateTriggers)})}return x}_updateAutoHighlight(e){for(let t of this.getSubLayers())t.updateAutoHighlight(e)}_getAttributeManager(){return null}_postUpdate(e,t){let n=this.internalState.subLayers,s=!n||this.needsUpdate();if(s){let i=this.renderLayers();n=Dr(i,Boolean),this.internalState.subLayers=n}he(EE,this,s,n);for(let i of n)i.parent=this}};wl.layerName="CompositeLayer";var Ux=wl;var vl=Math.PI/180,Vx=180/Math.PI,Al=6370972,Is=256;function RE(){let r=Is/Al,e=Math.PI/180*Is;return{unitsPerMeter:[r,r,r],unitsPerMeter2:[0,0,0],metersPerUnit:[1/r,1/r,1/r],unitsPerDegree:[e,e,r],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,1/r]}}var Sn=class extends $e{constructor(e={}){let{longitude:t=0,zoom:n=0,nearZMultiplier:s=.5,farZMultiplier:i=1,resolution:o=10}=e,{latitude:a=0,height:c,altitude:l=1.5,fovy:u}=e;a=Math.max(Math.min(a,at),-at),c=c||1,u?l=nr(u):u=rr(l);let f=1/Math.PI/Math.cos(a*Math.PI/180),h=Math.pow(2,n)*f,d=e.nearZ??s,g=e.farZ??(l+Is*2*h/c)*i,y=new Q().lookAt({eye:[0,-l,0],up:[0,0,1]});y.rotateX(a*vl),y.rotateZ(-t*vl),y.scale(h/c),super({...e,height:c,viewMatrix:y,longitude:t,latitude:a,zoom:n,distanceScales:RE(),fovy:u,focalDistance:l,near:d,far:g}),this.scale=h,this.latitude=a,this.longitude=t,this.resolution=o}get projectionMode(){return Te.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){let t={targetZ:e.z||0},n=this.unproject([0,this.height/2],t),s=this.unproject([this.width/2,0],t),i=this.unproject([this.width,this.height/2],t),o=this.unproject([this.width/2,this.height],t);return i[0]<this.longitude&&(i[0]+=360),n[0]>this.longitude&&(n[0]-=360),[Math.min(n[0],i[0],s[0],o[0]),Math.min(n[1],i[1],s[1],o[1]),Math.max(n[0],i[0],s[0],o[0]),Math.max(n[1],i[1],s[1],o[1])]}unproject(e,{topLeft:t=!0,targetZ:n}={}){let[s,i,o]=e,a=t?i:this.height-i,{pixelUnprojectionMatrix:c}=this,l;if(Number.isFinite(o))l=md(c,[s,a,o,1]);else{let d=md(c,[s,a,-1,1]),g=md(c,[s,a,1,1]),y=((n||0)/Al+1)*Is,_=Oe.sqrLen(Oe.sub([],d,g)),b=Oe.sqrLen(d),R=Oe.sqrLen(g),S=4*((4*b*R-(_-b-R)**2)/16)/_,C=Math.sqrt(b-S),P=Math.sqrt(Math.max(0,y*y-S)),B=(C-P)/Math.sqrt(_);l=Oe.lerp([],d,g,B)}let[u,f,h]=this.unprojectPosition(l);return Number.isFinite(o)?[u,f,h]:Number.isFinite(n)?[u,f,n]:[u,f]}projectPosition(e){let[t,n,s=0]=e,i=t*vl,o=n*vl,a=Math.cos(o),c=(s/Al+1)*Is;return[Math.sin(i)*a*c,-Math.cos(i)*a*c,Math.sin(o)*c]}unprojectPosition(e){let[t,n,s]=e,i=Oe.len(e),o=Math.asin(s/i),c=Math.atan2(t,-n)*Vx,l=o*Vx,u=(i/Is-1)*Al;return[c,l,u]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition(e,t){let n=this.unproject(t);return{longitude:e[0]-n[0]+this.longitude,latitude:e[1]-n[1]+this.latitude}}};function md(r,e){let t=ze.transformMat4([],e,r);return ze.scale(t,t,1/t[3]),t}var gd=Math.PI/180;function IE({height:r,focalDistance:e,orbitAxis:t,rotationX:n,rotationOrbit:s,zoom:i}){let o=t==="Z"?[0,0,1]:[0,1,0],a=t==="Z"?[0,-e,0]:[0,0,e],c=new Q().lookAt({eye:a,up:o});c.rotateX(n*gd),t==="Z"?c.rotateZ(s*gd):c.rotateY(s*gd);let l=Math.pow(2,i)/r;return c.scale(l),c}var En=class extends $e{constructor(e){let{height:t,projectionMatrix:n,fovy:s=50,orbitAxis:i="Z",target:o=[0,0,0],rotationX:a=0,rotationOrbit:c=0,zoom:l=0}=e,u=n?n[5]/2:nr(s);super({...e,longitude:void 0,viewMatrix:IE({height:t||1,focalDistance:u,orbitAxis:i,rotationX:a,rotationOrbit:c,zoom:l}),fovy:s,focalDistance:u,position:o,zoom:l}),this.projectedCenter=this.project(this.center)}unproject(e,{topLeft:t=!0}={}){let[n,s,i=this.projectedCenter[2]]=e,o=t?s:this.height-s,[a,c,l]=ct([n,o,i],this.pixelUnprojectionMatrix);return[a,c,l]}panByPosition(e,t){let n=this.project(e),s=[this.width/2+n[0]-t[0],this.height/2+n[1]-t[1],this.projectedCenter[2]];return{target:this.unproject(s)}}};var PE=new Q().lookAt({eye:[0,0,1]});function CE({width:r,height:e,near:t,far:n,padding:s}){let i=-r/2,o=r/2,a=-e/2,c=e/2;if(s){let{left:l=0,right:u=0,top:f=0,bottom:h=0}=s,d=ee((l+r-u)/2,0,r)-r/2,g=ee((f+e-h)/2,0,e)-e/2;i-=d,o-=d,a+=g,c+=g}return new Q().ortho({left:i,right:o,bottom:a,top:c,near:t,far:n})}var Rn=class extends $e{constructor(e){let{width:t,height:n,near:s=.1,far:i=1e3,zoom:o=0,target:a=[0,0,0],padding:c=null,flipY:l=!0}=e,u=Array.isArray(o)?o[0]:o,f=Array.isArray(o)?o[1]:o,h=Math.min(u,f),d=Math.pow(2,h),g;if(u!==f){let y=Math.pow(2,u),_=Math.pow(2,f);g={unitsPerMeter:[y/d,_/d,1],metersPerUnit:[d/y,d/_,1]}}super({...e,longitude:void 0,position:a,viewMatrix:PE.clone().scale([d,d*(l?-1:1),d]),projectionMatrix:CE({width:t||1,height:n||1,padding:c,near:s,far:i}),zoom:h,distanceScales:g})}projectFlat([e,t]){let{unitsPerMeter:n}=this.distanceScales;return[e*n[0],t*n[1]]}unprojectFlat([e,t]){let{metersPerUnit:n}=this.distanceScales;return[e*n[0],t*n[1]]}panByPosition(e,t){let n=ct(t,this.pixelUnprojectionMatrix),s=this.projectFlat(e),i=_e.add([],s,_e.negate([],n)),o=_e.add([],this.center,i);return{target:this.unprojectFlat(o)}}};var In=class extends $e{constructor(e){let{longitude:t,latitude:n,modelMatrix:s,bearing:i=0,pitch:o=0,up:a=[0,0,1]}=e,l=new dt({bearing:i,pitch:o===-90?1e-4:90+o}).toVector3().normalize(),u=s?new Q(s).transformAsVector(l):l,f=Number.isFinite(n)?Bi({latitude:n}):0,h=Math.pow(2,f),d=new Q().lookAt({eye:[0,0,0],center:u,up:a}).scale(h);super({...e,zoom:f,viewMatrix:d}),this.latitude=n,this.longitude=t}};var Pn=20,zx=500,So=class extends fr{constructor(e){let{width:t,height:n,position:s=[0,0,0],bearing:i=0,pitch:o=0,longitude:a=null,latitude:c=null,maxPitch:l=90,minPitch:u=-90,startRotatePos:f,startBearing:h,startPitch:d,startZoomPosition:g,startPanPos:y,startPanPosition:_}=e;super({width:t,height:n,position:s,bearing:i,pitch:o,longitude:a,latitude:c,maxPitch:l,minPitch:u},{startRotatePos:f,startBearing:h,startPitch:d,startZoomPosition:g,startPanPos:y,startPanPosition:_}),this.makeViewport=e.makeViewport}panStart({pos:e}){let{position:t}=this.getViewportProps();return this._getUpdatedState({startPanPos:e,startPanPosition:t})}pan({pos:e}){if(!e)return this;let{startPanPos:t=[0,0],startPanPosition:n=[0,0]}=this.getState(),{width:s,height:i,bearing:o,pitch:a}=this.getViewportProps(),c=zx*(e[0]-t[0])/s,l=zx*(e[1]-t[1])/i,u=new dt({bearing:o,pitch:a}),f=new dt({bearing:o,pitch:-90}),h=u.toVector3().normalize(),d=f.toVector3().cross(h).normalize();return this._getUpdatedState({position:new G(n).add(d.scale(c)).add(h.scale(l))})}panEnd(){return this._getUpdatedState({startPanPos:null,startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:t=0,deltaAngleY:n=0}){let{startRotatePos:s,startBearing:i,startPitch:o}=this.getState(),{width:a,height:c}=this.getViewportProps();if(!s||i===void 0||o===void 0)return this;let l;if(e){let u=(e[0]-s[0])/a,f=(e[1]-s[1])/c;l={bearing:i-u*180,pitch:o-f*90}}else l={bearing:i-t,pitch:o-n};return this._getUpdatedState(l)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startBearing:null,startPitch:null})}zoomStart(){return this._getUpdatedState({startZoomPosition:this.getViewportProps().position})}zoom({pos:e,scale:t}){let n=this.getViewportProps(),s=this.getState().startZoomPosition||n.position,i=this.makeViewport(n),{projectionMatrix:o,width:a}=i,l=2*Math.atan(1/o[0])*(e[0]/a-.5),u=this.getDirection(!0);return this._move(u.rotateZ({radians:-l}),Math.log2(t)*Pn,s)}zoomEnd(){return this._getUpdatedState({startZoomPosition:null})}moveLeft(e=Pn){let t=this.getDirection(!0);return this._move(t.rotateZ({radians:Math.PI/2}),e)}moveRight(e=Pn){let t=this.getDirection(!0);return this._move(t.rotateZ({radians:-Math.PI/2}),e)}moveUp(e=Pn){let t=this.getDirection(!0);return this._move(t,e)}moveDown(e=Pn){let t=this.getDirection(!0);return this._move(t.negate(),e)}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}zoomIn(e=Pn){return this._move(new G(0,0,1),e)}zoomOut(e=Pn){return this._move(new G(0,0,-1),e)}shortestPathFrom(e){let t=e.getViewportProps(),n={...this.getViewportProps()},{bearing:s,longitude:i}=n;return Math.abs(s-t.bearing)>180&&(n.bearing=s<0?s+360:s-360),i!==null&&t.longitude!==null&&Math.abs(i-t.longitude)>180&&(n.longitude=i<0?i+360:i-360),n}_move(e,t,n=this.getViewportProps().position){let s=e.scale(t);return this._getUpdatedState({position:new G(n).add(s)})}getDirection(e=!1){return new dt({bearing:this.getViewportProps().bearing,pitch:e?90:90+this.getViewportProps().pitch}).toVector3().normalize()}_getUpdatedState(e){return new So({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{pitch:t,maxPitch:n,minPitch:s,longitude:i,bearing:o}=e;return e.pitch=ee(t,s,n),i!==null&&(i<-180||i>180)&&(e.longitude=dn(i+180,360)-180),(o<-180||o>180)&&(e.bearing=dn(o+180,360)-180),e}},Cn=class extends De{constructor(){super(...arguments),this.ControllerState=So,this.transition={transitionDuration:300,transitionInterpolator:new Ae(["position","pitch","bearing"])}}};var Sl=class extends Ne{constructor(e={}){super(e)}getViewportType(){return In}get ControllerType(){return Cn}};Sl.displayName="FirstPersonView";var Wx=Sl;var Eo=class extends fr{constructor(e){let{width:t,height:n,rotationX:s=0,rotationOrbit:i=0,target:o=[0,0,0],zoom:a=0,minRotationX:c=-90,maxRotationX:l=90,minZoom:u=-1/0,maxZoom:f=1/0,startPanPosition:h,startRotatePos:d,startRotationX:g,startRotationOrbit:y,startZoomPosition:_,startZoom:b}=e;super({width:t,height:n,rotationX:s,rotationOrbit:i,target:o,zoom:a,minRotationX:c,maxRotationX:l,minZoom:u,maxZoom:f},{startPanPosition:h,startRotatePos:d,startRotationX:g,startRotationOrbit:y,startZoomPosition:_,startZoom:b}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanPosition:this._unproject(e)})}pan({pos:e,startPosition:t}){let n=this.getState().startPanPosition||t;if(!n)return this;let i=this.makeViewport(this.getViewportProps()).panByPosition(n,e);return this._getUpdatedState(i)}panEnd(){return this._getUpdatedState({startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startRotationX:this.getViewportProps().rotationX,startRotationOrbit:this.getViewportProps().rotationOrbit})}rotate({pos:e,deltaAngleX:t=0,deltaAngleY:n=0}){let{startRotatePos:s,startRotationX:i,startRotationOrbit:o}=this.getState(),{width:a,height:c}=this.getViewportProps();if(!s||i===void 0||o===void 0)return this;let l;if(e){let u=(e[0]-s[0])/a,f=(e[1]-s[1])/c;(i<-90||i>90)&&(u*=-1),l={rotationX:i+f*180,rotationOrbit:o+u*180}}else l={rotationX:i+n,rotationOrbit:o+t};return this._getUpdatedState(l)}rotateEnd(){return this._getUpdatedState({startRotationX:null,startRotationOrbit:null})}shortestPathFrom(e){let t=e.getViewportProps(),n={...this.getViewportProps()},{rotationOrbit:s}=n;return Math.abs(s-t.rotationOrbit)>180&&(n.rotationOrbit=s<0?s+360:s-360),n}zoomStart({pos:e}){return this._getUpdatedState({startZoomPosition:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:t,scale:n}){let{startZoom:s,startZoomPosition:i}=this.getState();if(i||(s=this.getViewportProps().zoom,i=this._unproject(t)||this._unproject(e)),!i)return this;let o=this._calculateNewZoom({scale:n,startZoom:s}),a=this.makeViewport({...this.getViewportProps(),zoom:o});return this._getUpdatedState({zoom:o,...a.panByPosition(i,e)})}zoomEnd(){return this._getUpdatedState({startZoomPosition:null,startZoom:null})}zoomIn(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:e})})}zoomOut(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:1/e})})}moveLeft(e=50){return this._panFromCenter([-e,0])}moveRight(e=50){return this._panFromCenter([e,0])}moveUp(e=50){return this._panFromCenter([0,-e])}moveDown(e=50){return this._panFromCenter([0,e])}rotateLeft(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit-e})}rotateRight(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit+e})}rotateUp(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX-e})}rotateDown(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX+e})}_unproject(e){let t=this.makeViewport(this.getViewportProps());return e&&t.unproject(e)}_calculateNewZoom({scale:e,startZoom:t}){let{maxZoom:n,minZoom:s}=this.getViewportProps();t===void 0&&(t=this.getViewportProps().zoom);let i=t+Math.log2(e);return ee(i,s,n)}_panFromCenter(e){let{width:t,height:n,target:s}=this.getViewportProps();return this.pan({startPosition:s,pos:[t/2+e[0],n/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{maxZoom:t,minZoom:n,zoom:s,maxRotationX:i,minRotationX:o,rotationOrbit:a}=e;return e.zoom=Array.isArray(s)?[ee(s[0],n,t),ee(s[1],n,t)]:ee(s,n,t),e.rotationX=ee(e.rotationX,o,i),(a<-180||a>180)&&(e.rotationOrbit=dn(a+180,360)-180),e}},Mn=class extends De{constructor(){super(...arguments),this.ControllerState=Eo,this.transition={transitionDuration:300,transitionInterpolator:new Ae({transitionProps:{compare:["target","zoom","rotationX","rotationOrbit"],required:["target","zoom"]}})}}};var El=class extends Ne{constructor(e={}){super(e),this.props.orbitAxis=e.orbitAxis||"Z"}getViewportType(){return En}get ControllerType(){return Mn}};El.displayName="OrbitView";var $x=El;var _d=class extends Eo{constructor(e){super(e),this.zoomAxis=e.zoomAxis||"all"}_calculateNewZoom({scale:e,startZoom:t}){let{maxZoom:n,minZoom:s}=this.getViewportProps();t===void 0&&(t=this.getViewportProps().zoom);let i=Math.log2(e);if(Array.isArray(t)){let[o,a]=t;switch(this.zoomAxis){case"X":o=ee(o+i,s,n);break;case"Y":a=ee(a+i,s,n);break;default:let c=Math.min(o+i,a+i);c<s&&(i+=s-c),c=Math.max(o+i,a+i),c>n&&(i+=n-c),o+=i,a+=i}return[o,a]}return ee(t+i,s,n)}},On=class extends De{constructor(){super(...arguments),this.ControllerState=_d,this.transition={transitionDuration:300,transitionInterpolator:new Ae(["target","zoom"])},this.dragMode="pan"}_onPanRotate(){return!1}};var Rl=class extends Ne{constructor(e={}){super(e)}getViewportType(){return Rn}get ControllerType(){return On}};Rl.displayName="OrthographicView";var jx=Rl;var yd=class extends Gi{applyConstraints(e){let{maxZoom:t,minZoom:n,zoom:s}=e;e.zoom=ee(s,n,t);let{longitude:i,latitude:o}=e;return(i<-180||i>180)&&(e.longitude=dn(i+180,360)-180),e.latitude=ee(o,-at,at),e}},kn=class extends De{constructor(){super(...arguments),this.ControllerState=yd,this.transition={transitionDuration:300,transitionInterpolator:new Ae(["longitude","latitude","zoom"])},this.dragMode="pan"}setProps(e){super.setProps(e),this.dragRotate=!1,this.touchRotate=!1}};var Il=class extends Ne{constructor(e={}){super(e)}getViewportType(e){return e.zoom>12?kr:Sn}get ControllerType(){return kn}};Il.displayName="GlobeView";var Hx=Il;var Ro=class{static get componentName(){return Object.prototype.hasOwnProperty.call(this,"extensionName")?this.extensionName:""}constructor(e){e&&(this.opts=e)}equals(e){return this===e?!0:this.constructor===e.constructor&&le(this.opts,e.opts,1)}getShaders(e){return null}getSubLayerProps(e){let{defaultProps:t}=e.constructor,n={updateTriggers:{}};for(let s in t)if(s in this.props){let i=t[s],o=this.props[s];n[s]=o,i&&i.type==="accessor"&&(n.updateTriggers[s]=this.props.updateTriggers[s],typeof o=="function"&&(n[s]=this.getSubLayerAccessor(o)))}return n}initializeState(e,t){}updateState(e,t){}onNeedsRedraw(e){}getNeedsPickingBuffer(e){return!1}draw(e,t){}finalizeState(e,t){}};Ro.defaultProps={};Ro.extensionName="LayerExtension";var Xx=Ro;var xd={bearing:0,pitch:0,position:[0,0,0]},ME={speed:1.2,curve:1.414},Io=class extends lr{constructor(e={}){super({compare:["longitude","latitude","zoom","bearing","pitch","position"],extract:["width","height","longitude","latitude","zoom","bearing","pitch","position"],required:["width","height","latitude","longitude","zoom"]}),this.opts={...ME,...e}}interpolateProps(e,t,n){let s=Ch(e,t,n,this.opts);for(let i in xd)s[i]=Jt(e[i]||xd[i],t[i]||xd[i],n);return s}getDuration(e,t){let{transitionDuration:n}=t;return n==="auto"&&(n=Mh(e,t,this.opts)),n}};j();var Po=class{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;let{attributes:t={}}=e;this.typedArrayManager=bt,this.attributes={},this._attributeDefs=t,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);let{data:t,buffers:n={},getGeometry:s,geometryBuffer:i,positionFormat:o,dataChanged:a,normalize:c=!0}=this.opts;if(this.data=t,this.getGeometry=s,this.positionSize=i&&i.size||(o==="XY"?2:3),this.buffers=n,this.normalize=c,i&&(oe(t.startIndices),this.getGeometry=this.getGeometryFromBuffer(i),c||(n.vertexPositions=i)),this.geometryBuffer=n.vertexPositions,Array.isArray(a))for(let l of a)this._rebuildGeometry(l);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:t}){this._rebuildGeometry({startRow:e,endRow:t})}getGeometryFromBuffer(e){let t=e.value||e;return ArrayBuffer.isView(t)?fl(t,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,t){let{attributes:n,buffers:s,_attributeDefs:i,typedArrayManager:o}=this;for(let a in i)if(a in s)o.release(n[a]),n[a]=null;else{let c=i[a];c.copy=t,n[a]=o.allocate(n[a],e,c)}}_forEachGeometry(e,t,n){let{data:s,getGeometry:i}=this,{iterable:o,objectInfo:a}=Ss(s,t,n);for(let c of o){a.index++;let l=i?i(c,a):null;e(l,a.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:t,vertexStarts:n,instanceCount:s}=this,{data:i,geometryBuffer:o}=this,{startRow:a=0,endRow:c=1/0}=e||{},l={};if(e||(t=[0],n=[0]),this.normalize||!o)this._forEachGeometry((f,h)=>{let d=f&&this.normalizeGeometry(f);l[h]=d,n[h+1]=n[h]+(d?this.getGeometrySize(d):0)},a,c),s=n[n.length-1];else if(n=i.startIndices,s=n[i.length]||0,ArrayBuffer.isView(o))s=s||o.length/this.positionSize;else if(o instanceof W){let f=this.positionSize*4;s=s||o.byteLength/f}else if(o.buffer){let f=o.stride||this.positionSize*4;s=s||o.buffer.byteLength/f}else if(o.value){let f=o.value,h=o.stride/f.BYTES_PER_ELEMENT||this.positionSize;s=s||f.length/h}this._allocate(s,Boolean(e)),this.indexStarts=t,this.vertexStarts=n,this.instanceCount=s;let u={};this._forEachGeometry((f,h)=>{let d=l[h]||f;u.vertexStart=n[h],u.indexStart=t[h];let g=h<n.length-1?n[h+1]:s;u.geometrySize=g-n[h],u.geometryIndex=h,this.updateGeometryAttributes(d,u)},a,c),this.vertexCount=t[t.length-1]}};var Pl=class{constructor(e){this.map=null,this.width=0,this.height=0,this.props={...e},this._initialize(this.props)}finalize(){this.map?.remove(),this.map=null}setProps(e){let t=this.props,n={...this.props,...e};if(this.props=n,!this.map)return;this._update(t,n)&&this.redraw()}redraw(){let e=this.map;e.style&&(e._frame&&(e._frame.cancel(),e._frame=null),e._render())}getMap(){return this.map}_initialize(e){let{mapLib:t,container:n}=e;t.accessToken=e.mapboxApiAccessToken||"",this.map=new e.mapLib.Map({container:n,maxZoom:24,...e.mapOptions,...Yx(e.viewState),style:e.mapStyle,interactive:!1,trackResize:!1}),Object.defineProperty(n,"offsetWidth",{get:()=>this.width}),Object.defineProperty(n,"clientWidth",{get:()=>this.width}),Object.defineProperty(n,"offsetHeight",{get:()=>this.height}),Object.defineProperty(n,"clientHeight",{get:()=>this.height}),this.map.resize()}_update(e,t){e.mapStyle!==t.mapStyle&&this.map.setStyle(t.mapStyle);let s=e.width!==t.width||e.height!==t.height;s&&(this.width=t.width,this.height=t.height,this.map.resize());let i=e.viewState,o=t.viewState,a=o.latitude!==i.latitude||o.longitude!==i.longitude||o.zoom!==i.zoom||o.pitch!==i.pitch||o.bearing!==i.bearing;return a&&this.map.jumpTo(Yx(o)),s||a}};function Yx(r){return{center:[r.longitude,r.latitude],zoom:r.zoom,bearing:r.bearing??0,pitch:r.pitch??0}}var qx={position:"absolute",left:0,top:0,width:"100%",height:"100%"};function OE(r){let{container:e=document.body}=r;if(typeof e=="string"&&(e=document.getElementById(e)),!e)throw Error("Deck: container not found");window.getComputedStyle(e).position==="static"&&(e.style.position="relative");let n=document.createElement("div");e.appendChild(n),Object.assign(n.style,qx);let s=document.createElement("canvas");return e.appendChild(s),Object.assign(s.style,qx),{container:e,mapCanvas:n,deckCanvas:s}}var Co=class extends ll{constructor(e){if(typeof document>"u")throw Error("Deck can only be used in the browser");let{mapCanvas:t,deckCanvas:n}=OE(e),s=e.viewState||e.initialViewState,i=Number.isFinite(s&&s.latitude),{map:o=globalThis.mapboxgl||globalThis.maplibregl}=e;super({canvas:n,...e}),o&&o.Map?this._map=i&&new Pl({...e,width:0,height:0,viewState:s,container:t,mapLib:o}):this._map=o}getMapboxMap(){return this._map&&this._map.getMap()}finalize(){this._map&&this._map.finalize(),super.finalize()}setProps(e){"mapStyle"in e&&this._map&&this._map.setProps({mapStyle:e.mapStyle}),super.setProps(e)}_drawLayers(e,t){if(this._map){let n=this.getViewports()[0];n&&this._map.setProps({width:n.width,height:n.height,viewState:n})}super._drawLayers(e,t)}};globalThis.luma=globalThis.luma||{};globalThis.loaders=globalThis.loaders||{};Object.assign(globalThis.luma,Nf);Object.assign(globalThis.loaders,ih);return eb(kE);})();
1670
+ }`;function zS(r,e){let t=dl(e.size),n=pl(e.size);return new pt(r,{vs:US,fs:VS,bufferLayout:[{name:"aPrev",format:n},{name:"aCur",format:n},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],modules:[LS],defines:{ATTRIBUTE_TYPE:t},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function WS(r){return r.createTexture({data:new Uint8Array(4),format:"rgba8unorm",width:1,height:1})}function $S(r,e){return r.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}var jS={interpolation:po,spring:mo},go=class{constructor(e,{id:t,timeline:n}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=t,this.device=e,this.timeline=n,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:t,numInstances:n}){this.numInstances=n||1;for(let s in e){let i=e[s],o=i.getTransitionSetting(t);o&&this._updateAttribute(s,i,o)}for(let s in this.transitions){let i=e[s];(!i||!i.getTransitionSetting(t))&&this._removeTransition(s)}}hasAttribute(e){let t=this.transitions[e];return t&&t.inProgress}getAttributes(){let e={};for(let t in this.transitions){let n=this.transitions[t];n.inProgress&&(e[t]=n.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(let t in this.transitions)this.transitions[t].update()&&(this.needsRedraw=!0);let e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,t,n){let s=this.transitions[e],i=!s||s.type!==n.type;if(i){s&&this._removeTransition(e);let o=jS[n.type];o?this.transitions[e]=new o({attribute:t,timeline:this.timeline,device:this.device}):(H.error(`unsupported transition type '${n.type}'`)(),i=!1)}(i||t.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(n,this.numInstances))}};var Ex="attributeManager.invalidate",HS="attributeManager.updateStart",XS="attributeManager.updateEnd",YS="attribute.updateStart",qS="attribute.allocate",KS="attribute.updateEnd",vn=class{constructor(e,{id:t="attribute-manager",stats:n,timeline:s}={}){this.mergeBoundsMemoized=it(N_),this.id=t,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=n,this.attributeTransitionManager=new go(e,{id:`${t}-transitions`,timeline:s}),Object.seal(this)}finalize(){for(let e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){let t=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,t&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(let t of e)this.attributes[t]!==void 0&&(this.attributes[t].delete(),delete this.attributes[t])}invalidate(e,t){let n=this._invalidateTrigger(e,t);he(Ex,this,e,n)}invalidateAll(e){for(let t in this.attributes)this.attributes[t].setNeedsUpdate(t,e);he(Ex,this,"all")}update({data:e,numInstances:t,startIndices:n=null,transitions:s,props:i={},buffers:o={},context:a={}}){let c=!1;he(HS,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(let l in this.attributes){let u=this.attributes[l],f=u.settings.accessor;u.startIndices=n,u.numInstances=t,i[l]&&H.removed(`props.${l}`,`data.attributes.${l}`)(),u.setExternalBuffer(o[l])||u.setBinaryValue(typeof f=="string"?o[f]:void 0,e.startIndices)||typeof f=="string"&&!o[f]&&u.setConstantValue(a,i[f])||u.needsUpdate()&&(c=!0,this._updateAttribute({attribute:u,numInstances:t,data:e,props:i,context:a})),this.needsRedraw=this.needsRedraw||u.needsRedraw()}c&&he(XS,this,t),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:t,transitions:s})}updateTransition(){let{attributeTransitionManager:e}=this,t=e.run();return this.needsRedraw=this.needsRedraw||t,t}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){let t=e.map(n=>this.attributes[n]?.getBounds());return this.mergeBoundsMemoized(t)}getChangedAttributes(e={clearChangedFlags:!1}){let{attributes:t,attributeTransitionManager:n}=this,s={...n.getAttributes()};for(let i in t){let o=t[i];o.needsRedraw(e)&&!n.hasAttribute(i)&&(s[i]=o)}return s}getBufferLayouts(e){return Object.values(this.getAttributes()).map(t=>t.getBufferLayout(e))}_add(e,t){for(let n in e){let s=e[n],i={...s,id:n,size:s.isIndexed&&1||s.size||1,...t};this.attributes[n]=new hr(this.device,i)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){let e={};for(let t in this.attributes)this.attributes[t].getUpdateTriggers().forEach(s=>{e[s]||(e[s]=[]),e[s].push(t)});this.updateTriggers=e}_invalidateTrigger(e,t){let{attributes:n,updateTriggers:s}=this,i=s[e];return i&&i.forEach(o=>{let a=n[o];a&&a.setNeedsUpdate(a.id,t)}),i}_updateAttribute(e){let{attribute:t,numInstances:n}=e;if(he(YS,t),t.constant){t.setConstantValue(e.context,t.value);return}t.allocate(n)&&he(qS,t,n),t.updateBuffer(e)&&(this.needsRedraw=!0,he(KS,t,n))}};j();il();var _o=class extends wt{get value(){return this._value}_onUpdate(){let{time:e,settings:{fromValue:t,toValue:n,duration:s,easing:i}}=this,o=i(e/s);this._value=Jt(t,n,o)}};var Rx=1e-5;function Ix(r,e,t,n,s){let i=e-r,a=(t-e)*s,c=-i*n;return a+c+i+e}function ZS(r,e,t,n,s){if(Array.isArray(t)){let i=[];for(let o=0;o<t.length;o++)i[o]=Ix(r[o],e[o],t[o],n,s);return i}return Ix(r,e,t,n,s)}function Px(r,e){if(Array.isArray(r)){let t=0;for(let n=0;n<r.length;n++){let s=r[n]-e[n];t+=s*s}return Math.sqrt(t)}return Math.abs(r-e)}var yo=class extends wt{get value(){return this._currValue}_onUpdate(){let{fromValue:e,toValue:t,damping:n,stiffness:s}=this.settings,{_prevValue:i=e,_currValue:o=e}=this,a=ZS(i,o,t,n,s),c=Px(a,t),l=Px(a,o);c<Rx&&l<Rx&&(a=t,this.end()),this._prevValue=o,this._currValue=a}};var GS={interpolation:_o,spring:yo},xo=class{constructor(e){this.transitions=new Map,this.timeline=e}get active(){return this.transitions.size>0}add(e,t,n,s){let{transitions:i}=this;if(i.has(e)){let c=i.get(e),{value:l=c.settings.fromValue}=c;t=l,this.remove(e)}if(s=hl(s),!s)return;let o=GS[s.type];if(!o){H.error(`unsupported transition type '${s.type}'`)();return}let a=new o(this.timeline);a.start({...s,fromValue:t,toValue:n}),i.set(e,a)}remove(e){let{transitions:t}=this;t.has(e)&&(t.get(e).cancel(),t.delete(e))}update(){let e={};for(let[t,n]of this.transitions)n.update(),e[t]=n.value,n.inProgress||this.remove(t);return e}clear(){for(let e of this.transitions.keys())this.remove(e)}};function Mx(r){let e=r[lt];for(let t in e){let n=e[t],{validate:s}=n;if(s&&!s(r[t],n))throw new Error(`Invalid prop ${t}: ${r[t]}`)}}function Ox(r,e){let t=yl({newProps:r,oldProps:e,propTypes:r[lt],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),n=JS(r,e),s=!1;return n||(s=eE(r,e)),{dataChanged:n,propsChanged:t,updateTriggersChanged:s,extensionsChanged:tE(r,e),transitionsChanged:QS(r,e)}}function QS(r,e){if(!r.transitions)return!1;let t={},n=r[lt],s=!1;for(let i in r.transitions){let o=n[i],a=o&&o.type;(a==="number"||a==="color"||a==="array")&&ud(r[i],e[i],o)&&(t[i]=!0,s=!0)}return s?t:!1}function yl({newProps:r,oldProps:e,ignoreProps:t={},propTypes:n={},triggerName:s="props"}){if(e===r)return!1;if(typeof r!="object"||r===null)return`${s} changed shallowly`;if(typeof e!="object"||e===null)return`${s} changed shallowly`;for(let i of Object.keys(r))if(!(i in t)){if(!(i in e))return`${s}.${i} added`;let o=ud(r[i],e[i],n[i]);if(o)return`${s}.${i} ${o}`}for(let i of Object.keys(e))if(!(i in t)){if(!(i in r))return`${s}.${i} dropped`;if(!Object.hasOwnProperty.call(r,i)){let o=ud(r[i],e[i],n[i]);if(o)return`${s}.${i} ${o}`}}return!1}function ud(r,e,t){let n=t&&t.equal;return n&&!n(r,e,t)||!n&&(n=r&&e&&r.equals,n&&!n.call(r,e))?"changed deeply":!n&&e!==r?"changed shallowly":null}function JS(r,e){if(e===null)return"oldProps is null, initial diff";let t=!1,{dataComparator:n,_dataDiff:s}=r;return n?n(r.data,e.data)||(t="Data comparator detected a change"):r.data!==e.data&&(t="A new data container was supplied"),t&&s&&(t=s(r.data,e.data)||t),t}function eE(r,e){if(e===null)return{all:!0};if("all"in r.updateTriggers&&Cx(r,e,"all"))return{all:!0};let t={},n=!1;for(let s in r.updateTriggers)s!=="all"&&Cx(r,e,s)&&(t[s]=!0,n=!0);return n?t:!1}function tE(r,e){if(e===null)return!0;let t=e.extensions,{extensions:n}=r;if(n===t)return!1;if(!t||!n||n.length!==t.length)return!0;for(let s=0;s<n.length;s++)if(!n[s].equals(t[s]))return!0;return!1}function Cx(r,e,t){let n=r.updateTriggers[t];n=n??{};let s=e.updateTriggers[t];return s=s??{},yl({oldProps:s,newProps:n,triggerName:t})}var rE="count(): argument not an object",nE="count(): argument not a container";function xl(r){if(!iE(r))throw new Error(rE);if(typeof r.count=="function")return r.count();if(Number.isFinite(r.size))return r.size;if(Number.isFinite(r.length))return r.length;if(sE(r))return Object.keys(r).length;throw new Error(nE)}function sE(r){return r!==null&&typeof r=="object"&&r.constructor===Object}function iE(r){return r!==null&&typeof r=="object"}function bo(r,e){if(!e)return r;let t={...r,...e};if("defines"in e&&(t.defines={...r.defines,...e.defines}),"modules"in e&&(t.modules=(r.modules||[]).concat(e.modules),e.modules.some(n=>n.name==="project64"))){let n=t.modules.findIndex(s=>s.name==="project32");n>=0&&t.modules.splice(n,1)}if("inject"in e)if(!r.inject)t.inject=e.inject;else{let n={...r.inject};for(let s in e.inject)n[s]=(n[s]||"")+e.inject[s];t.inject=n}return t}j();var oE={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},fd={};function kx(r,e,t,n){if(t instanceof K)return t;t.constructor&&t.constructor.name!=="Object"&&(t={data:t});let s=null;t.compressed&&(s={minFilter:"linear",mipmapFilter:t.data.length>1?"nearest":"linear"});let{width:i,height:o}=t.data,a=e.createTexture({...t,sampler:{...oE,...s,...n},mipLevels:e.getMipLevelCount(i,o)});return a.generateMipmapsWebGL(),fd[a.id]=r,a}function Nx(r,e){!e||!(e instanceof K)||fd[e.id]===r&&(e.delete(),delete fd[e.id])}var aE={boolean:{validate(r,e){return!0},equal(r,e,t){return Boolean(r)===Boolean(e)}},number:{validate(r,e){return Number.isFinite(r)&&(!("max"in e)||r<=e.max)&&(!("min"in e)||r>=e.min)}},color:{validate(r,e){return e.optional&&!r||hd(r)&&(r.length===3||r.length===4)},equal(r,e,t){return le(r,e,1)}},accessor:{validate(r,e){let t=bl(r);return t==="function"||t===bl(e.value)},equal(r,e,t){return typeof e=="function"?!0:le(r,e,1)}},array:{validate(r,e){return e.optional&&!r||hd(r)},equal(r,e,t){let{compare:n}=t,s=Number.isInteger(n)?n:n?1:0;return n?le(r,e,s):r===e}},object:{equal(r,e,t){if(t.ignore)return!0;let{compare:n}=t,s=Number.isInteger(n)?n:n?1:0;return n?le(r,e,s):r===e}},function:{validate(r,e){return e.optional&&!r||typeof r=="function"},equal(r,e,t){return!t.compare&&t.ignore!==!1||r===e}},data:{transform:(r,e,t)=>{if(!r)return r;let{dataTransform:n}=t.props;return n?n(r):typeof r.shape=="string"&&r.shape.endsWith("-table")&&Array.isArray(r.data)?r.data:r}},image:{transform:(r,e,t)=>{let n=t.context;return!n||!n.device?null:kx(t.id,n.device,r,{...e.parameters,...t.props.textureParameters})},release:(r,e,t)=>{Nx(t.id,r)}}};function Dx(r){let e={},t={},n={};for(let[s,i]of Object.entries(r)){let o=i?.deprecatedFor;if(o)n[s]=Array.isArray(o)?o:[o];else{let a=cE(s,i);e[s]=a,t[s]=a.value}}return{propTypes:e,defaultProps:t,deprecatedProps:n}}function cE(r,e){switch(bl(e)){case"object":return To(r,e);case"array":return To(r,{type:"array",value:e,compare:!1});case"boolean":return To(r,{type:"boolean",value:e});case"number":return To(r,{type:"number",value:e});case"function":return To(r,{type:"function",value:e,compare:!0});default:return{name:r,type:"unknown",value:e}}}function To(r,e){return"type"in e?{name:r,...aE[e.type],...e}:"value"in e?{name:r,type:bl(e.value),...e}:{name:r,type:"object",value:e}}function hd(r){return Array.isArray(r)||ArrayBuffer.isView(r)}function bl(r){return hd(r)?"array":r===null?"null":typeof r}function Fx(r,e){let t;for(let i=e.length-1;i>=0;i--){let o=e[i];"extensions"in o&&(t=o.extensions)}let n=dd(r.constructor,t),s=Object.create(n);s[ys]=r,s[Bt]={},s[Tt]={};for(let i=0;i<e.length;++i){let o=e[i];for(let a in o)s[a]=o[a]}return Object.freeze(s),s}var lE="_mergedDefaultProps";function dd(r,e){if(!(r instanceof Rs.constructor))return{};let t=lE;if(e)for(let s of e){let i=s.constructor;i&&(t+=`:${i.extensionName||i.name}`)}let n=Bx(r,t);return n||(r[t]=uE(r,e||[]))}function uE(r,e){if(!r.prototype)return null;let n=Object.getPrototypeOf(r),s=dd(n),i=Bx(r,"defaultProps")||{},o=Dx(i),a=Object.assign(Object.create(null),s,o.defaultProps),c=Object.assign(Object.create(null),s?.[lt],o.propTypes),l=Object.assign(Object.create(null),s?.[Rc],o.deprecatedProps);for(let u of e){let f=dd(u.constructor);f&&(Object.assign(a,f),Object.assign(c,f[lt]),Object.assign(l,f[Rc]))}return fE(a,r),dE(a,c),hE(a,l),a[lt]=c,a[Rc]=l,e.length===0&&!pd(r,"_propTypes")&&(r._propTypes=c),a}function fE(r,e){let t=mE(e);Object.defineProperties(r,{id:{writable:!0,value:t}})}function hE(r,e){for(let t in e)Object.defineProperty(r,t,{enumerable:!1,set(n){let s=`${this.id}: ${t}`;for(let i of e[t])pd(this,i)||(this[i]=n);H.deprecated(s,e[t].join("/"))()}})}function dE(r,e){let t={},n={};for(let s in e){let i=e[s],{name:o,value:a}=i;i.async&&(t[o]=a,n[o]=pE(o))}r[or]=t,r[Bt]={},Object.defineProperties(r,n)}function pE(r){return{enumerable:!0,set(e){typeof e=="string"||e instanceof Promise||ul(e)?this[Bt][r]=e:this[Tt][r]=e},get(){if(this[Tt]){if(r in this[Tt])return this[Tt][r]||this[or][r];if(r in this[Bt]){let e=this[ys]&&this[ys].internalState;if(e&&e.hasAsyncProp(r))return e.getAsyncProp(r)||this[or][r]}}return this[or][r]}}}function pd(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Bx(r,e){return pd(r,e)&&r[e]}function mE(r){let e=r.componentName;return e||H.warn(`${r.name}.componentName not specified`)(),e||r.name}var gE=0,wo=class{constructor(...e){this.props=Fx(this,e),this.id=this.props.id,this.count=gE++}clone(e){let{props:t}=this,n={};for(let s in t[or])s in t[Tt]?n[s]=t[Tt][s]:s in t[Bt]&&(n[s]=t[Bt][s]);return new this.constructor({...t,...n,...e})}};wo.componentName="Component";wo.defaultProps={};var Rs=wo;var _E=Object.freeze({}),An=class{constructor(e){this.component=e,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let e in this.asyncProps){let t=this.asyncProps[e];t&&t.type&&t.type.release&&t.type.release(t.resolvedValue,t.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||_E}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){let t=this.asyncProps[e];return t&&t.resolvedValue}isAsyncPropLoading(e){if(e){let t=this.asyncProps[e];return Boolean(t&&t.pendingLoadCount>0&&t.pendingLoadCount!==t.resolvedLoadCount)}for(let t in this.asyncProps)if(this.isAsyncPropLoading(t))return!0;return!1}reloadAsyncProp(e,t){this._watchPromise(e,Promise.resolve(t))}setAsyncProps(e){this.component=e[ys]||this.component;let t=e[Tt]||{},n=e[Bt]||e,s=e[or]||{};for(let i in t){let o=t[i];this._createAsyncPropData(i,s[i]),this._updateAsyncProp(i,o),t[i]=this.getAsyncProp(i)}for(let i in n){let o=n[i];this._createAsyncPropData(i,s[i]),this._updateAsyncProp(i,o)}}_fetch(e,t){return null}_onResolve(e,t){}_onError(e,t){}_updateAsyncProp(e,t){if(this._didAsyncInputValueChange(e,t)){if(typeof t=="string"&&(t=this._fetch(e,t)),t instanceof Promise){this._watchPromise(e,t);return}if(ul(t)){this._resolveAsyncIterable(e,t);return}this._setPropValue(e,t)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,t){let n=this.asyncProps[e];return t===n.resolvedValue||t===n.lastValue?!1:(n.lastValue=t,!0)}_setPropValue(e,t){this._freezeAsyncOldProps();let n=this.asyncProps[e];n&&(t=this._postProcessValue(n,t),n.resolvedValue=t,n.pendingLoadCount++,n.resolvedLoadCount=n.pendingLoadCount)}_setAsyncPropValue(e,t,n){let s=this.asyncProps[e];s&&n>=s.resolvedLoadCount&&t!==void 0&&(this._freezeAsyncOldProps(),s.resolvedValue=t,s.resolvedLoadCount=n,this.onAsyncPropUpdated(e,t))}_watchPromise(e,t){let n=this.asyncProps[e];if(n){n.pendingLoadCount++;let s=n.pendingLoadCount;t.then(i=>{this.component&&(i=this._postProcessValue(n,i),this._setAsyncPropValue(e,i,s),this._onResolve(e,i))}).catch(i=>{this._onError(e,i)})}}async _resolveAsyncIterable(e,t){if(e!=="data"){this._setPropValue(e,t);return}let n=this.asyncProps[e];if(!n)return;n.pendingLoadCount++;let s=n.pendingLoadCount,i=[],o=0;for await(let a of t){if(!this.component)return;let{dataTransform:c}=this.component.props;c?i=c(a,i):i=i.concat(a),Object.defineProperty(i,"__diff",{enumerable:!1,value:[{startRow:o,endRow:i.length}]}),o=i.length,this._setAsyncPropValue(e,i,s)}this._onResolve(e,i)}_postProcessValue(e,t){let n=e.type;return n&&this.component&&(n.release&&n.release(e.resolvedValue,n,this.component),n.transform)?n.transform(t,n,this.component):t}_createAsyncPropData(e,t){if(!this.asyncProps[e]){let s=this.component&&this.component.props[lt];this.asyncProps[e]={type:s&&s[e],lastValue:null,resolvedValue:t,pendingLoadCount:0,resolvedLoadCount:0}}}};var vo=class extends An{constructor({attributeManager:e,layer:t}){super(t),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,t){let n=this.layer,s=n?.props.fetch;return s?s(t,{propName:e,layer:n}):super._fetch(e,t)}_onResolve(e,t){let n=this.layer;if(n){let s=n.props.onDataLoad;e==="data"&&s&&s(t,{propName:e,layer:n})}}_onError(e,t){let n=this.layer;n&&n.raiseError(t,`loading ${e} of ${this.layer}`)}};var yE="layer.changeFlag",xE="layer.initialize",bE="layer.update",TE="layer.finalize",wE="layer.matched",Lx=2**24-1,vE=Object.freeze([]),AE=it(({oldViewport:r,viewport:e})=>r.equals(e)),Et=new Uint8ClampedArray(0),SE={data:{type:"data",value:vE,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:r=>r&&r.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(r,{propName:e,layer:t,loaders:n,loadOptions:s,signal:i})=>{let{resourceManager:o}=t.context;s=s||t.getLoadOptions(),n=n||t.props.loaders,i&&(s={...s,fetch:{...s?.fetch,signal:i}});let a=o.contains(r);return!a&&!s&&(o.add({resourceId:r,data:Rr(r,n),persistent:!1}),a=!0),a?o.subscribe({resourceId:r,onChange:c=>t.internalState?.reloadAsyncProp(e,c),consumerId:t.id,requestId:e}):Rr(r,n,s)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:Y.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:r})=>[0,-r*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}},Ao=class extends Rs{constructor(){super(...arguments),this.internalState=null,this.lifecycle=Nr.NO_STATE,this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(e){oe(this.internalState);let t=this.internalState.viewport||this.context.viewport,n=Fh(e,{viewport:t,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[s,i,o]=fs(n,t.pixelProjectionMatrix);return e.length===2?[s,i]:[s,i,o]}unproject(e){return oe(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,t){oe(this.internalState);let n=this.internalState.viewport||this.context.viewport;return Ac(e,{viewport:n,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...t})}get isComposite(){return!1}get isDrawable(){return!0}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){let e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setShaderModuleProps(...e){for(let t of this.getModels())t.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:e}=this.props;return e===Y.DEFAULT||e===Y.LNGLAT||e===Y.CARTESIAN}onHover(e,t){return this.props.onHover&&this.props.onHover(e,t)||!1}onClick(e,t){return this.props.onClick&&this.props.onClick(e,t)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,t=[]){return t[0]=e+1&255,t[1]=e+1>>8&255,t[2]=e+1>>8>>8&255,t}decodePickingColor(e){oe(e instanceof Uint8Array);let[t,n,s]=e;return t+n*256+s*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:xl(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(e){e=bo(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(let t of this.props.extensions)e=bo(e,t.getShaders.call(this,t));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){let t=this.getAttributeManager(),{dataChanged:n}=e.changeFlags;if(n&&t)if(Array.isArray(n))for(let s of n)t.invalidateAll(s);else t.invalidateAll();if(t){let{props:s}=e,i=this.internalState.hasPickingBuffer,o=Number.isInteger(s.highlightedObjectIndex)||s.pickable||s.extensions.some(a=>a.getNeedsPickingBuffer.call(this,a));if(i!==o){this.internalState.hasPickingBuffer=o;let{pickingColors:a,instancePickingColors:c}=t.attributes,l=a||c;l&&(o&&l.constant&&(l.constant=!1,t.invalidate(l.id)),!l.value&&!o&&(l.constant=!0,l.value=[0,0,0]))}}}finalizeState(e){for(let n of this.getModels())n.destroy();let t=this.getAttributeManager();t&&t.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(let t of this.getModels())t.draw(e.renderPass)}getPickingInfo({info:e,mode:t,sourceLayer:n}){let{index:s}=e;return s>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[s]),e}raiseError(e,t){t&&(e=new Error(`${t}: ${e.message}`,{cause:e})),this.props.onError?.(e)||this.context?.onError?.(e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(e){if(!this.internalState)return;let t=this.internalState.viewport;this.internalState.viewport=e,(!t||!AE({oldViewport:t,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){let t=this.getAttributeManager();t&&(e==="all"?t.invalidateAll():t.invalidate(e))}updateAttributes(e){let t=!1;for(let n in e)e[n].layoutChanged()&&(t=!0);for(let n of this.getModels())this._setModelAttributes(n,e,t)}_updateAttributes(){let e=this.getAttributeManager();if(!e)return;let t=this.props,n=this.getNumInstances(),s=this.getStartIndices();e.update({data:t.data,numInstances:n,startIndices:s,props:t,transitions:t.transitions,buffers:t.data.attributes,context:this});let i=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(i)}_updateAttributeTransition(){let e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){let{uniformTransitions:e}=this.internalState;if(e.active){let t=e.update(),n=Object.create(this.props);for(let s in t)Object.defineProperty(n,s,{value:t[s]});return n}return this.props}calculateInstancePickingColors(e,{numInstances:t}){if(e.constant)return;let n=Math.floor(Et.length/4);if(this.internalState.usesPickingColorCache=!0,n<t){t>Lx&&H.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),Et=bt.allocate(Et,t,{size:4,copy:!0,maxCount:Math.max(t,Lx)});let s=Math.floor(Et.length/4),i=[0,0,0];for(let o=n;o<s;o++)this.encodePickingColor(o,i),Et[o*4+0]=i[0],Et[o*4+1]=i[1],Et[o*4+2]=i[2],Et[o*4+3]=0}e.value=Et.subarray(0,t*4)}_setModelAttributes(e,t,n=!1){if(!Object.keys(t).length)return;if(n){let a=this.getAttributeManager();e.setBufferLayout(a.getBufferLayouts(e)),t=a.getAttributes()}let s=e.userData?.excludeAttributes||{},i={},o={};for(let a in t){if(s[a])continue;let c=t[a].getValue();for(let l in c){let u=c[l];u instanceof W?t[a].settings.isIndexed?e.setIndexBuffer(u):i[l]=u:u&&(o[l]=u)}}e.setAttributes(i),e.setConstantAttributes(o)}disablePickingIndex(e){let t=this.props.data;if(!("attributes"in t)){this._disablePickingIndex(e);return}let{pickingColors:n,instancePickingColors:s}=this.getAttributeManager().attributes,i=n||s,o=i&&t.attributes&&t.attributes[i.id];if(o&&o.value){let a=o.value,c=this.encodePickingColor(e);for(let l=0;l<t.length;l++){let u=i.getVertexOffset(l);a[u]===c[0]&&a[u+1]===c[1]&&a[u+2]===c[2]&&this._disablePickingIndex(l)}}else this._disablePickingIndex(e)}_disablePickingIndex(e){let{pickingColors:t,instancePickingColors:n}=this.getAttributeManager().attributes,s=t||n;if(!s)return;let i=s.getVertexOffset(e),o=s.getVertexOffset(e+1);s.buffer.write(new Uint8Array(o-i),i)}restorePickingColors(){let{pickingColors:e,instancePickingColors:t}=this.getAttributeManager().attributes,n=e||t;n&&(this.internalState.usesPickingColorCache&&n.value.buffer!==Et.buffer&&(n.value=Et.subarray(0,n.value.length)),n.updateSubBuffer({startOffset:0}))}_initialize(){oe(!this.internalState),oe(Number.isFinite(this.props.coordinateSystem)),he(xE,this);let e=this._getAttributeManager();e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new vo({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(H.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new xo(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(let t of this.props.extensions)t.initializeState.call(this,this.context,t);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){he(wE,this,this===e);let{state:t,internalState:n}=e;this!==e&&(this.internalState=n,this.state=t,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let e=this.needsUpdate();if(he(bE,this,e),!e)return;let t=this.props,n=this.context,s=this.internalState,i=n.viewport,o=this._updateUniformTransition();s.propsInTransition=o,n.viewport=s.viewport||i,this.props=o;try{let a=this._getUpdateParams(),c=this.getModels();if(n.device)this.updateState(a);else try{this.updateState(a)}catch{}for(let u of this.props.extensions)u.updateState.call(this,a,u);this.setNeedsRedraw(),this._updateAttributes();let l=this.getModels()[0]!==c[0];this._postUpdate(a,l)}finally{n.viewport=i,this.props=t,this._clearChangeFlags(),s.needsUpdate=!1,s.resetOldProps()}}_finalize(){he(TE,this),this.finalizeState(this.context);for(let e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,shaderModuleProps:t=null,uniforms:n={},parameters:s={}}){this._updateAttributeTransition();let i=this.props,o=this.context;this.props=this.internalState.propsInTransition||i;try{t&&this.setShaderModuleProps(t);let{getPolygonOffset:a}=this.props,c=a&&a(n)||[0,0];o.device instanceof wn&&o.device.setParametersWebGL({polygonOffset:c});for(let l of this.getModels())l.device.type==="webgpu"?l.setParameters({...l.parameters,...s}):l.setParameters(s);if(o.device instanceof wn)o.device.withParametersWebGL(s,()=>{let l={renderPass:e,shaderModuleProps:t,uniforms:n,parameters:s,context:o};for(let u of this.props.extensions)u.draw.call(this,l,u);this.draw(l)});else{let l={renderPass:e,shaderModuleProps:t,uniforms:n,parameters:s,context:o};for(let u of this.props.extensions)u.draw.call(this,l,u);this.draw(l)}}finally{this.props=i}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(e){if(!this.internalState)return;let{changeFlags:t}=this.internalState;for(let s in e)if(e[s]){let i=!1;switch(s){case"dataChanged":let o=e[s],a=t[s];o&&Array.isArray(a)&&(t.dataChanged=Array.isArray(o)?a.concat(o):o,i=!0);default:t[s]||(t[s]=e[s],i=!0)}i&&he(yE,this,s,e)}let n=Boolean(t.dataChanged||t.updateTriggersChanged||t.propsChanged||t.extensionsChanged);t.propsOrDataChanged=n,t.somethingChanged=n||t.viewportChanged||t.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,t){let n=Ox(e,t);if(n.updateTriggersChanged)for(let s in n.updateTriggersChanged)n.updateTriggersChanged[s]&&this.invalidateAttribute(s);if(n.transitionsChanged)for(let s in n.transitionsChanged)this.internalState.uniformTransitions.add(s,t[s],e[s],e.transitions?.[s]);return this.setChangeFlags(n)}validateProps(){Mx(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){let t={highlightedObjectColor:e.picked?e.color:null},{highlightColor:n}=this.props;e.picked&&typeof n=="function"&&(t.highlightColor=n(e)),this.setShaderModuleProps({picking:t}),this.setNeedsRedraw()}_getAttributeManager(){let e=this.context;return new vn(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,t){let{props:n,oldProps:s}=e,i=this.state.model;i?.isInstanced&&i.setInstanceCount(this.getNumInstances());let{autoHighlight:o,highlightedObjectIndex:a,highlightColor:c}=n;if(t||s.autoHighlight!==o||s.highlightedObjectIndex!==a||s.highlightColor!==c){let l={};Array.isArray(c)&&(l.highlightColor=c),(t||s.autoHighlight!==o||a!==s.highlightedObjectIndex)&&(l.highlightedObjectColor=Number.isFinite(a)&&a>=0?this.encodePickingColor(a):null),this.setShaderModuleProps({picking:l})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let t=!1;t=t||this.internalState.needsRedraw&&this.id;let n=this.getAttributeManager(),s=n?n.getNeedsRedraw(e):!1;if(t=t||s,t)for(let i of this.props.extensions)i.onNeedsRedraw.call(this,i);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,t}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}};Ao.defaultProps=SE;Ao.layerName="Layer";var Tl=Ao;var EE="compositeLayer.renderLayers",wl=class extends Tl{get isComposite(){return!0}get isDrawable(){return!1}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(e=>e.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(e){}setState(e){super.setState(e),this.setNeedsUpdate()}getPickingInfo({info:e}){let{object:t}=e;return t&&t.__source&&t.__source.parent&&t.__source.parent.id===this.id&&(e.object=t.__source.object,e.index=t.__source.index),e}filterSubLayer(e){return!0}shouldRenderSubLayer(e,t){return t&&t.length}getSubLayerClass(e,t){let{_subLayerProps:n}=this.props;return n&&n[e]&&n[e].type||t}getSubLayerRow(e,t,n){return e.__source={parent:this,object:t,index:n},e}getSubLayerAccessor(e){if(typeof e=="function"){let t={index:-1,data:this.props.data,target:[]};return(n,s)=>n&&n.__source?(t.index=n.__source.index,e(n.__source.object,t)):e(n,s)}return e}getSubLayerProps(e={}){let{opacity:t,pickable:n,visible:s,parameters:i,getPolygonOffset:o,highlightedObjectIndex:a,autoHighlight:c,highlightColor:l,coordinateSystem:u,coordinateOrigin:f,wrapLongitude:h,positionFormat:d,modelMatrix:g,extensions:y,fetch:_,operation:b,_subLayerProps:R}=this.props,x={id:"",updateTriggers:{},opacity:t,pickable:n,visible:s,parameters:i,getPolygonOffset:o,highlightedObjectIndex:a,autoHighlight:c,highlightColor:l,coordinateSystem:u,coordinateOrigin:f,wrapLongitude:h,positionFormat:d,modelMatrix:g,extensions:y,fetch:_,operation:b},S=R&&e.id&&R[e.id],C=S&&S.updateTriggers,P=e.id||"sublayer";if(S){let B=this.props[lt],N=e.type?e.type._propTypes:{};for(let k in S){let F=N[k]||B[k];F&&F.type==="accessor"&&(S[k]=this.getSubLayerAccessor(S[k]))}}Object.assign(x,e,S),x.id=`${this.props.id}-${P}`,x.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...C};for(let B of y){let N=B.getSubLayerProps.call(this,B);N&&Object.assign(x,N,{updateTriggers:Object.assign(x.updateTriggers,N.updateTriggers)})}return x}_updateAutoHighlight(e){for(let t of this.getSubLayers())t.updateAutoHighlight(e)}_getAttributeManager(){return null}_postUpdate(e,t){let n=this.internalState.subLayers,s=!n||this.needsUpdate();if(s){let i=this.renderLayers();n=Dr(i,Boolean),this.internalState.subLayers=n}he(EE,this,s,n);for(let i of n)i.parent=this}};wl.layerName="CompositeLayer";var Ux=wl;var vl=Math.PI/180,Vx=180/Math.PI,Al=6370972,Is=256;function RE(){let r=Is/Al,e=Math.PI/180*Is;return{unitsPerMeter:[r,r,r],unitsPerMeter2:[0,0,0],metersPerUnit:[1/r,1/r,1/r],unitsPerDegree:[e,e,r],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,1/r]}}var Sn=class extends $e{constructor(e={}){let{longitude:t=0,zoom:n=0,nearZMultiplier:s=.5,farZMultiplier:i=1,resolution:o=10}=e,{latitude:a=0,height:c,altitude:l=1.5,fovy:u}=e;a=Math.max(Math.min(a,at),-at),c=c||1,u?l=nr(u):u=rr(l);let f=1/Math.PI/Math.cos(a*Math.PI/180),h=Math.pow(2,n)*f,d=e.nearZ??s,g=e.farZ??(l+Is*2*h/c)*i,y=new Q().lookAt({eye:[0,-l,0],up:[0,0,1]});y.rotateX(a*vl),y.rotateZ(-t*vl),y.scale(h/c),super({...e,height:c,viewMatrix:y,longitude:t,latitude:a,zoom:n,distanceScales:RE(),fovy:u,focalDistance:l,near:d,far:g}),this.scale=h,this.latitude=a,this.longitude=t,this.resolution=o}get projectionMode(){return Te.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){let t={targetZ:e.z||0},n=this.unproject([0,this.height/2],t),s=this.unproject([this.width/2,0],t),i=this.unproject([this.width,this.height/2],t),o=this.unproject([this.width/2,this.height],t);return i[0]<this.longitude&&(i[0]+=360),n[0]>this.longitude&&(n[0]-=360),[Math.min(n[0],i[0],s[0],o[0]),Math.min(n[1],i[1],s[1],o[1]),Math.max(n[0],i[0],s[0],o[0]),Math.max(n[1],i[1],s[1],o[1])]}unproject(e,{topLeft:t=!0,targetZ:n}={}){let[s,i,o]=e,a=t?i:this.height-i,{pixelUnprojectionMatrix:c}=this,l;if(Number.isFinite(o))l=md(c,[s,a,o,1]);else{let d=md(c,[s,a,-1,1]),g=md(c,[s,a,1,1]),y=((n||0)/Al+1)*Is,_=Oe.sqrLen(Oe.sub([],d,g)),b=Oe.sqrLen(d),R=Oe.sqrLen(g),S=4*((4*b*R-(_-b-R)**2)/16)/_,C=Math.sqrt(b-S),P=Math.sqrt(Math.max(0,y*y-S)),B=(C-P)/Math.sqrt(_);l=Oe.lerp([],d,g,B)}let[u,f,h]=this.unprojectPosition(l);return Number.isFinite(o)?[u,f,h]:Number.isFinite(n)?[u,f,n]:[u,f]}projectPosition(e){let[t,n,s=0]=e,i=t*vl,o=n*vl,a=Math.cos(o),c=(s/Al+1)*Is;return[Math.sin(i)*a*c,-Math.cos(i)*a*c,Math.sin(o)*c]}unprojectPosition(e){let[t,n,s]=e,i=Oe.len(e),o=Math.asin(s/i),c=Math.atan2(t,-n)*Vx,l=o*Vx,u=(i/Is-1)*Al;return[c,l,u]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition(e,t){let n=this.unproject(t);return{longitude:e[0]-n[0]+this.longitude,latitude:e[1]-n[1]+this.latitude}}};function md(r,e){let t=ze.transformMat4([],e,r);return ze.scale(t,t,1/t[3]),t}var gd=Math.PI/180;function IE({height:r,focalDistance:e,orbitAxis:t,rotationX:n,rotationOrbit:s,zoom:i}){let o=t==="Z"?[0,0,1]:[0,1,0],a=t==="Z"?[0,-e,0]:[0,0,e],c=new Q().lookAt({eye:a,up:o});c.rotateX(n*gd),t==="Z"?c.rotateZ(s*gd):c.rotateY(s*gd);let l=Math.pow(2,i)/r;return c.scale(l),c}var En=class extends $e{constructor(e){let{height:t,projectionMatrix:n,fovy:s=50,orbitAxis:i="Z",target:o=[0,0,0],rotationX:a=0,rotationOrbit:c=0,zoom:l=0}=e,u=n?n[5]/2:nr(s);super({...e,longitude:void 0,viewMatrix:IE({height:t||1,focalDistance:u,orbitAxis:i,rotationX:a,rotationOrbit:c,zoom:l}),fovy:s,focalDistance:u,position:o,zoom:l}),this.projectedCenter=this.project(this.center)}unproject(e,{topLeft:t=!0}={}){let[n,s,i=this.projectedCenter[2]]=e,o=t?s:this.height-s,[a,c,l]=ct([n,o,i],this.pixelUnprojectionMatrix);return[a,c,l]}panByPosition(e,t){let n=this.project(e),s=[this.width/2+n[0]-t[0],this.height/2+n[1]-t[1],this.projectedCenter[2]];return{target:this.unproject(s)}}};var PE=new Q().lookAt({eye:[0,0,1]});function CE({width:r,height:e,near:t,far:n,padding:s}){let i=-r/2,o=r/2,a=-e/2,c=e/2;if(s){let{left:l=0,right:u=0,top:f=0,bottom:h=0}=s,d=ee((l+r-u)/2,0,r)-r/2,g=ee((f+e-h)/2,0,e)-e/2;i-=d,o-=d,a+=g,c+=g}return new Q().ortho({left:i,right:o,bottom:a,top:c,near:t,far:n})}var Rn=class extends $e{constructor(e){let{width:t,height:n,near:s=.1,far:i=1e3,zoom:o=0,target:a=[0,0,0],padding:c=null,flipY:l=!0}=e,u=Array.isArray(o)?o[0]:o,f=Array.isArray(o)?o[1]:o,h=Math.min(u,f),d=Math.pow(2,h),g;if(u!==f){let y=Math.pow(2,u),_=Math.pow(2,f);g={unitsPerMeter:[y/d,_/d,1],metersPerUnit:[d/y,d/_,1]}}super({...e,longitude:void 0,position:a,viewMatrix:PE.clone().scale([d,d*(l?-1:1),d]),projectionMatrix:CE({width:t||1,height:n||1,padding:c,near:s,far:i}),zoom:h,distanceScales:g})}projectFlat([e,t]){let{unitsPerMeter:n}=this.distanceScales;return[e*n[0],t*n[1]]}unprojectFlat([e,t]){let{metersPerUnit:n}=this.distanceScales;return[e*n[0],t*n[1]]}panByPosition(e,t){let n=ct(t,this.pixelUnprojectionMatrix),s=this.projectFlat(e),i=_e.add([],s,_e.negate([],n)),o=_e.add([],this.center,i);return{target:this.unprojectFlat(o)}}};var In=class extends $e{constructor(e){let{longitude:t,latitude:n,modelMatrix:s,bearing:i=0,pitch:o=0,up:a=[0,0,1]}=e,l=new dt({bearing:i,pitch:o===-90?1e-4:90+o}).toVector3().normalize(),u=s?new Q(s).transformAsVector(l):l,f=Number.isFinite(n)?Bi({latitude:n}):0,h=Math.pow(2,f),d=new Q().lookAt({eye:[0,0,0],center:u,up:a}).scale(h);super({...e,zoom:f,viewMatrix:d}),this.latitude=n,this.longitude=t}};var Pn=20,zx=500,So=class extends fr{constructor(e){let{width:t,height:n,position:s=[0,0,0],bearing:i=0,pitch:o=0,longitude:a=null,latitude:c=null,maxPitch:l=90,minPitch:u=-90,startRotatePos:f,startBearing:h,startPitch:d,startZoomPosition:g,startPanPos:y,startPanPosition:_}=e;super({width:t,height:n,position:s,bearing:i,pitch:o,longitude:a,latitude:c,maxPitch:l,minPitch:u},{startRotatePos:f,startBearing:h,startPitch:d,startZoomPosition:g,startPanPos:y,startPanPosition:_}),this.makeViewport=e.makeViewport}panStart({pos:e}){let{position:t}=this.getViewportProps();return this._getUpdatedState({startPanPos:e,startPanPosition:t})}pan({pos:e}){if(!e)return this;let{startPanPos:t=[0,0],startPanPosition:n=[0,0]}=this.getState(),{width:s,height:i,bearing:o,pitch:a}=this.getViewportProps(),c=zx*(e[0]-t[0])/s,l=zx*(e[1]-t[1])/i,u=new dt({bearing:o,pitch:a}),f=new dt({bearing:o,pitch:-90}),h=u.toVector3().normalize(),d=f.toVector3().cross(h).normalize();return this._getUpdatedState({position:new G(n).add(d.scale(c)).add(h.scale(l))})}panEnd(){return this._getUpdatedState({startPanPos:null,startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:t=0,deltaAngleY:n=0}){let{startRotatePos:s,startBearing:i,startPitch:o}=this.getState(),{width:a,height:c}=this.getViewportProps();if(!s||i===void 0||o===void 0)return this;let l;if(e){let u=(e[0]-s[0])/a,f=(e[1]-s[1])/c;l={bearing:i-u*180,pitch:o-f*90}}else l={bearing:i-t,pitch:o-n};return this._getUpdatedState(l)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startBearing:null,startPitch:null})}zoomStart(){return this._getUpdatedState({startZoomPosition:this.getViewportProps().position})}zoom({pos:e,scale:t}){let n=this.getViewportProps(),s=this.getState().startZoomPosition||n.position,i=this.makeViewport(n),{projectionMatrix:o,width:a}=i,l=2*Math.atan(1/o[0])*(e[0]/a-.5),u=this.getDirection(!0);return this._move(u.rotateZ({radians:-l}),Math.log2(t)*Pn,s)}zoomEnd(){return this._getUpdatedState({startZoomPosition:null})}moveLeft(e=Pn){let t=this.getDirection(!0);return this._move(t.rotateZ({radians:Math.PI/2}),e)}moveRight(e=Pn){let t=this.getDirection(!0);return this._move(t.rotateZ({radians:-Math.PI/2}),e)}moveUp(e=Pn){let t=this.getDirection(!0);return this._move(t,e)}moveDown(e=Pn){let t=this.getDirection(!0);return this._move(t.negate(),e)}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}zoomIn(e=Pn){return this._move(new G(0,0,1),e)}zoomOut(e=Pn){return this._move(new G(0,0,-1),e)}shortestPathFrom(e){let t=e.getViewportProps(),n={...this.getViewportProps()},{bearing:s,longitude:i}=n;return Math.abs(s-t.bearing)>180&&(n.bearing=s<0?s+360:s-360),i!==null&&t.longitude!==null&&Math.abs(i-t.longitude)>180&&(n.longitude=i<0?i+360:i-360),n}_move(e,t,n=this.getViewportProps().position){let s=e.scale(t);return this._getUpdatedState({position:new G(n).add(s)})}getDirection(e=!1){return new dt({bearing:this.getViewportProps().bearing,pitch:e?90:90+this.getViewportProps().pitch}).toVector3().normalize()}_getUpdatedState(e){return new So({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{pitch:t,maxPitch:n,minPitch:s,longitude:i,bearing:o}=e;return e.pitch=ee(t,s,n),i!==null&&(i<-180||i>180)&&(e.longitude=dn(i+180,360)-180),(o<-180||o>180)&&(e.bearing=dn(o+180,360)-180),e}},Cn=class extends De{constructor(){super(...arguments),this.ControllerState=So,this.transition={transitionDuration:300,transitionInterpolator:new Ae(["position","pitch","bearing"])}}};var Sl=class extends Ne{constructor(e={}){super(e)}getViewportType(){return In}get ControllerType(){return Cn}};Sl.displayName="FirstPersonView";var Wx=Sl;var Eo=class extends fr{constructor(e){let{width:t,height:n,rotationX:s=0,rotationOrbit:i=0,target:o=[0,0,0],zoom:a=0,minRotationX:c=-90,maxRotationX:l=90,minZoom:u=-1/0,maxZoom:f=1/0,startPanPosition:h,startRotatePos:d,startRotationX:g,startRotationOrbit:y,startZoomPosition:_,startZoom:b}=e;super({width:t,height:n,rotationX:s,rotationOrbit:i,target:o,zoom:a,minRotationX:c,maxRotationX:l,minZoom:u,maxZoom:f},{startPanPosition:h,startRotatePos:d,startRotationX:g,startRotationOrbit:y,startZoomPosition:_,startZoom:b}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanPosition:this._unproject(e)})}pan({pos:e,startPosition:t}){let n=this.getState().startPanPosition||t;if(!n)return this;let i=this.makeViewport(this.getViewportProps()).panByPosition(n,e);return this._getUpdatedState(i)}panEnd(){return this._getUpdatedState({startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startRotationX:this.getViewportProps().rotationX,startRotationOrbit:this.getViewportProps().rotationOrbit})}rotate({pos:e,deltaAngleX:t=0,deltaAngleY:n=0}){let{startRotatePos:s,startRotationX:i,startRotationOrbit:o}=this.getState(),{width:a,height:c}=this.getViewportProps();if(!s||i===void 0||o===void 0)return this;let l;if(e){let u=(e[0]-s[0])/a,f=(e[1]-s[1])/c;(i<-90||i>90)&&(u*=-1),l={rotationX:i+f*180,rotationOrbit:o+u*180}}else l={rotationX:i+n,rotationOrbit:o+t};return this._getUpdatedState(l)}rotateEnd(){return this._getUpdatedState({startRotationX:null,startRotationOrbit:null})}shortestPathFrom(e){let t=e.getViewportProps(),n={...this.getViewportProps()},{rotationOrbit:s}=n;return Math.abs(s-t.rotationOrbit)>180&&(n.rotationOrbit=s<0?s+360:s-360),n}zoomStart({pos:e}){return this._getUpdatedState({startZoomPosition:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:t,scale:n}){let{startZoom:s,startZoomPosition:i}=this.getState();if(i||(s=this.getViewportProps().zoom,i=this._unproject(t)||this._unproject(e)),!i)return this;let o=this._calculateNewZoom({scale:n,startZoom:s}),a=this.makeViewport({...this.getViewportProps(),zoom:o});return this._getUpdatedState({zoom:o,...a.panByPosition(i,e)})}zoomEnd(){return this._getUpdatedState({startZoomPosition:null,startZoom:null})}zoomIn(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:e})})}zoomOut(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:1/e})})}moveLeft(e=50){return this._panFromCenter([-e,0])}moveRight(e=50){return this._panFromCenter([e,0])}moveUp(e=50){return this._panFromCenter([0,-e])}moveDown(e=50){return this._panFromCenter([0,e])}rotateLeft(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit-e})}rotateRight(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit+e})}rotateUp(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX-e})}rotateDown(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX+e})}_unproject(e){let t=this.makeViewport(this.getViewportProps());return e&&t.unproject(e)}_calculateNewZoom({scale:e,startZoom:t}){let{maxZoom:n,minZoom:s}=this.getViewportProps();t===void 0&&(t=this.getViewportProps().zoom);let i=t+Math.log2(e);return ee(i,s,n)}_panFromCenter(e){let{width:t,height:n,target:s}=this.getViewportProps();return this.pan({startPosition:s,pos:[t/2+e[0],n/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{maxZoom:t,minZoom:n,zoom:s,maxRotationX:i,minRotationX:o,rotationOrbit:a}=e;return e.zoom=Array.isArray(s)?[ee(s[0],n,t),ee(s[1],n,t)]:ee(s,n,t),e.rotationX=ee(e.rotationX,o,i),(a<-180||a>180)&&(e.rotationOrbit=dn(a+180,360)-180),e}},Mn=class extends De{constructor(){super(...arguments),this.ControllerState=Eo,this.transition={transitionDuration:300,transitionInterpolator:new Ae({transitionProps:{compare:["target","zoom","rotationX","rotationOrbit"],required:["target","zoom"]}})}}};var El=class extends Ne{constructor(e={}){super(e),this.props.orbitAxis=e.orbitAxis||"Z"}getViewportType(){return En}get ControllerType(){return Mn}};El.displayName="OrbitView";var $x=El;var _d=class extends Eo{constructor(e){super(e),this.zoomAxis=e.zoomAxis||"all"}_calculateNewZoom({scale:e,startZoom:t}){let{maxZoom:n,minZoom:s}=this.getViewportProps();t===void 0&&(t=this.getViewportProps().zoom);let i=Math.log2(e);if(Array.isArray(t)){let[o,a]=t;switch(this.zoomAxis){case"X":o=ee(o+i,s,n);break;case"Y":a=ee(a+i,s,n);break;default:let c=Math.min(o+i,a+i);c<s&&(i+=s-c),c=Math.max(o+i,a+i),c>n&&(i+=n-c),o+=i,a+=i}return[o,a]}return ee(t+i,s,n)}},On=class extends De{constructor(){super(...arguments),this.ControllerState=_d,this.transition={transitionDuration:300,transitionInterpolator:new Ae(["target","zoom"])},this.dragMode="pan"}_onPanRotate(){return!1}};var Rl=class extends Ne{constructor(e={}){super(e)}getViewportType(){return Rn}get ControllerType(){return On}};Rl.displayName="OrthographicView";var jx=Rl;var yd=class extends Gi{applyConstraints(e){let{maxZoom:t,minZoom:n,zoom:s}=e;e.zoom=ee(s,n,t);let{longitude:i,latitude:o}=e;return(i<-180||i>180)&&(e.longitude=dn(i+180,360)-180),e.latitude=ee(o,-at,at),e}},kn=class extends De{constructor(){super(...arguments),this.ControllerState=yd,this.transition={transitionDuration:300,transitionInterpolator:new Ae(["longitude","latitude","zoom"])},this.dragMode="pan"}setProps(e){super.setProps(e),this.dragRotate=!1,this.touchRotate=!1}};var Il=class extends Ne{constructor(e={}){super(e)}getViewportType(e){return e.zoom>12?kr:Sn}get ControllerType(){return kn}};Il.displayName="GlobeView";var Hx=Il;var Ro=class{static get componentName(){return Object.prototype.hasOwnProperty.call(this,"extensionName")?this.extensionName:""}constructor(e){e&&(this.opts=e)}equals(e){return this===e?!0:this.constructor===e.constructor&&le(this.opts,e.opts,1)}getShaders(e){return null}getSubLayerProps(e){let{defaultProps:t}=e.constructor,n={updateTriggers:{}};for(let s in t)if(s in this.props){let i=t[s],o=this.props[s];n[s]=o,i&&i.type==="accessor"&&(n.updateTriggers[s]=this.props.updateTriggers[s],typeof o=="function"&&(n[s]=this.getSubLayerAccessor(o)))}return n}initializeState(e,t){}updateState(e,t){}onNeedsRedraw(e){}getNeedsPickingBuffer(e){return!1}draw(e,t){}finalizeState(e,t){}};Ro.defaultProps={};Ro.extensionName="LayerExtension";var Xx=Ro;var xd={bearing:0,pitch:0,position:[0,0,0]},ME={speed:1.2,curve:1.414},Io=class extends lr{constructor(e={}){super({compare:["longitude","latitude","zoom","bearing","pitch","position"],extract:["width","height","longitude","latitude","zoom","bearing","pitch","position"],required:["width","height","latitude","longitude","zoom"]}),this.opts={...ME,...e}}interpolateProps(e,t,n){let s=Ch(e,t,n,this.opts);for(let i in xd)s[i]=Jt(e[i]||xd[i],t[i]||xd[i],n);return s}getDuration(e,t){let{transitionDuration:n}=t;return n==="auto"&&(n=Mh(e,t,this.opts)),n}};j();var Po=class{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;let{attributes:t={}}=e;this.typedArrayManager=bt,this.attributes={},this._attributeDefs=t,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);let{data:t,buffers:n={},getGeometry:s,geometryBuffer:i,positionFormat:o,dataChanged:a,normalize:c=!0}=this.opts;if(this.data=t,this.getGeometry=s,this.positionSize=i&&i.size||(o==="XY"?2:3),this.buffers=n,this.normalize=c,i&&(oe(t.startIndices),this.getGeometry=this.getGeometryFromBuffer(i),c||(n.vertexPositions=i)),this.geometryBuffer=n.vertexPositions,Array.isArray(a))for(let l of a)this._rebuildGeometry(l);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:t}){this._rebuildGeometry({startRow:e,endRow:t})}getGeometryFromBuffer(e){let t=e.value||e;return ArrayBuffer.isView(t)?fl(t,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,t){let{attributes:n,buffers:s,_attributeDefs:i,typedArrayManager:o}=this;for(let a in i)if(a in s)o.release(n[a]),n[a]=null;else{let c=i[a];c.copy=t,n[a]=o.allocate(n[a],e,c)}}_forEachGeometry(e,t,n){let{data:s,getGeometry:i}=this,{iterable:o,objectInfo:a}=Ss(s,t,n);for(let c of o){a.index++;let l=i?i(c,a):null;e(l,a.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:t,vertexStarts:n,instanceCount:s}=this,{data:i,geometryBuffer:o}=this,{startRow:a=0,endRow:c=1/0}=e||{},l={};if(e||(t=[0],n=[0]),this.normalize||!o)this._forEachGeometry((f,h)=>{let d=f&&this.normalizeGeometry(f);l[h]=d,n[h+1]=n[h]+(d?this.getGeometrySize(d):0)},a,c),s=n[n.length-1];else if(n=i.startIndices,s=n[i.length]||0,ArrayBuffer.isView(o))s=s||o.length/this.positionSize;else if(o instanceof W){let f=this.positionSize*4;s=s||o.byteLength/f}else if(o.buffer){let f=o.stride||this.positionSize*4;s=s||o.buffer.byteLength/f}else if(o.value){let f=o.value,h=o.stride/f.BYTES_PER_ELEMENT||this.positionSize;s=s||f.length/h}this._allocate(s,Boolean(e)),this.indexStarts=t,this.vertexStarts=n,this.instanceCount=s;let u={};this._forEachGeometry((f,h)=>{let d=l[h]||f;u.vertexStart=n[h],u.indexStart=t[h];let g=h<n.length-1?n[h+1]:s;u.geometrySize=g-n[h],u.geometryIndex=h,this.updateGeometryAttributes(d,u)},a,c),this.vertexCount=t[t.length-1]}};var Pl=class{constructor(e){this.map=null,this.width=0,this.height=0,this.props={...e},this._initialize(this.props)}finalize(){this.map?.remove(),this.map=null}setProps(e){let t=this.props,n={...this.props,...e};if(this.props=n,!this.map)return;this._update(t,n)&&this.redraw()}redraw(){let e=this.map;e.style&&(e._frame&&(e._frame.cancel(),e._frame=null),e._render())}getMap(){return this.map}_initialize(e){let{mapLib:t,container:n}=e;t.accessToken=e.mapboxApiAccessToken||"",this.map=new e.mapLib.Map({container:n,maxZoom:24,...e.mapOptions,...Yx(e.viewState),style:e.mapStyle,interactive:!1,trackResize:!1}),Object.defineProperty(n,"offsetWidth",{get:()=>this.width}),Object.defineProperty(n,"clientWidth",{get:()=>this.width}),Object.defineProperty(n,"offsetHeight",{get:()=>this.height}),Object.defineProperty(n,"clientHeight",{get:()=>this.height}),this.map.resize()}_update(e,t){e.mapStyle!==t.mapStyle&&this.map.setStyle(t.mapStyle);let s=e.width!==t.width||e.height!==t.height;s&&(this.width=t.width,this.height=t.height,this.map.resize());let i=e.viewState,o=t.viewState,a=o.latitude!==i.latitude||o.longitude!==i.longitude||o.zoom!==i.zoom||o.pitch!==i.pitch||o.bearing!==i.bearing;return a&&this.map.jumpTo(Yx(o)),s||a}};function Yx(r){return{center:[r.longitude,r.latitude],zoom:r.zoom,bearing:r.bearing??0,pitch:r.pitch??0}}var qx={position:"absolute",left:0,top:0,width:"100%",height:"100%"};function OE(r){let{container:e=document.body}=r;if(typeof e=="string"&&(e=document.getElementById(e)),!e)throw Error("Deck: container not found");window.getComputedStyle(e).position==="static"&&(e.style.position="relative");let n=document.createElement("div");e.appendChild(n),Object.assign(n.style,qx);let s=document.createElement("canvas");return e.appendChild(s),Object.assign(s.style,qx),{container:e,mapCanvas:n,deckCanvas:s}}var Co=class extends ll{constructor(e){if(typeof document>"u")throw Error("Deck can only be used in the browser");let{mapCanvas:t,deckCanvas:n}=OE(e),s=e.viewState||e.initialViewState,i=Number.isFinite(s&&s.latitude),{map:o=globalThis.mapboxgl||globalThis.maplibregl}=e;super({canvas:n,...e}),o&&o.Map?this._map=i&&new Pl({...e,width:0,height:0,viewState:s,container:t,mapLib:o}):this._map=o}getMapboxMap(){return this._map&&this._map.getMap()}finalize(){this._map&&this._map.finalize(),super.finalize()}setProps(e){"mapStyle"in e&&this._map&&this._map.setProps({mapStyle:e.mapStyle}),super.setProps(e)}_drawLayers(e,t){if(this._map){let n=this.getViewports()[0];n&&this._map.setProps({width:n.width,height:n.height,viewState:n})}super._drawLayers(e,t)}};globalThis.luma=globalThis.luma||{};globalThis.loaders=globalThis.loaders||{};Object.assign(globalThis.luma,Nf);Object.assign(globalThis.loaders,ih);return eb(kE);})();
1671
1671
  return __exports__;
1672
1672
  });