@deck.gl/core
Version:
deck.gl core library
17 lines (16 loc) • 747 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if (typeof define === 'function' && define.amd) define([], factory);
else if (typeof exports === 'object') exports['deck'] = factory();
else root['deck'] = factory();})(globalThis, function () {
"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 Is(){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=Is(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Is()-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 Ps=O(()=>{wd();Ml();Cl()});var Ol,Oo,kl=O(()=>{Ps();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 Cs(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 Nn(){}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 Cs(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 Cs(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 kn,ob,Fd,Bd,Fe,Ul=O(()=>{dr();Sd();Id();Md();kd();Nd();Dd();kn={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,kn.warn,arguments,Bd)}error(e){return this._getLogFunction(0,e,kn.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,kn.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,kn.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,kn.debug||kn.info,arguments,Bd)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||Nn,n&&[n],{tag:cb(t)}):Nn}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||Nn)}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||Nn)}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,Cs(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 Nn;return t=ab(this.id,i.message,i),n.bind(console,t,...i.args)}return Nn}};Fe.VERSION=Ll});var Vd=O(()=>{globalThis.probe={}});var wR,Ms=O(()=>{Ul();Ul();Vd();wR=new Fe({id:"@probe.gl/log"})});var I,Xt=O(()=>{Ms();I=new Fe({id:"luma.gl"})});function pr(r="id"){Vl[r]=Vl[r]||1;let e=Vl[r]++;return`${r}-${e}`}var Vl,Os=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(()=>{Os();$=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 ks,W,Lo=O(()=>{Pe();ks=class extends ${get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let n={...t};(t.usage||0)&ks.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?n.indexType="uint32":t.data instanceof Uint16Array&&(n.indexType="uint16")),delete n.data,super(e,n,ks.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,ks.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=ks;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 Ns(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,Ds=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 Dn(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=Ns(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(()=>{Ds()});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,Fs,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",Fs="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:Fs},rg16unorm:{render:Fs},"rgb16unorm-webgl":{f:Fs},rgba16unorm:{render:Fs},r16snorm:{f:Yl},rg16snorm:{render:Yl},"rgb16snorm-webgl":{f:Fs},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=Ns(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(()=>{Ds();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 Bs,Ls,Zl,Be,Gl=O(()=>{kl();Xt();Os();Lo();Uo();Kl();Kd();Bs=class{},Ls=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 Dn(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',
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 Us,bb,Tb,Xo,Qd=O(()=>{dr();Us=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 Fn,Hr,np=O(()=>{dr();Os();ep();Fn=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={...Fn.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},Fn.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):Fn.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],Fn.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=Fn;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)}^^^
`:"";return`
${i}${o}${r.type.toUpperCase()}: ${r.message}
`}let s=r.type==="error"?"red":"#8B4000";return n?.html?`<div class='luma-compiler-log-error' style="color:${s};"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function Ib(r,e,t){let n="";for(let s=e-2;s<=e;s++){let i=r[s-1];i!==void 0&&(n+=op(i,e,t))}return n}function op(r,e,t){let n=t?.html?Cb(r):r;return`${Pb(String(e),4)}: ${n}${t?.html?"<br/>":`
`}`}function Pb(r,e){let t="";for(let n=r.length;n<e;++n)t+=" ";return t+r}function Cb(r){return r.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}var ap=O(()=>{});function Mb(r){return Ob(r.source)||r.id||pr(`unnamed ${r.stage}-shader`)}function Ob(r,e="unnamed"){let n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return n?n[1]:e}var ru,_r,cp=O(()=>{Pe();Os();ap();ru=class extends ${get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){t={...t,debugShaders:t.debugShaders||e.props.debugShaders||"errors"},super(e,{id:Mb(t),...t},ru.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){let e=this.props.debugShaders;switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let t=await this.getCompilationInfo();e==="warnings"&&t?.length===0||this._displayShaderLog(t,this.id)}_displayShaderLog(e,t){if(typeof document>"u"||!document?.createElement)return;let n=t,s=`${this.stage} shader "${n}"`,i=ip(e,this.source,{showSourceCode:"all",html:!0}),o=this.getTranslatedSource();o&&(i+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${o}</pre></code>`);let a=document.createElement("Button");a.innerHTML=`
<h1>Compilation error in ${s}</h1><br /><br />
<code style="user-select:text;"><pre>
${i}
</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,Bn,dp=O(()=>{Pe();ou=class extends ${get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,ou.defaultProps)}},Bn=ou;L(Bn,"defaultProps",{...$.defaultProps,measureExecutionTime:void 0})});var au,Ln,pp=O(()=>{Pe();au=class extends ${get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,au.defaultProps)}},Ln=au;L(Ln,"defaultProps",{...$.defaultProps})});function Vs(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",co