@luma.gl/core 9.0.6 → 9.0.8

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/init.js CHANGED
@@ -11,7 +11,7 @@ import { lumaStats } from "./utils/stats-manager.js";
11
11
  function initializeLuma() {
12
12
  // Version detection using babel plugin
13
13
  // @ts-expect-error
14
- const VERSION = typeof "9.0.5" !== 'undefined' ? "9.0.5" : 'running from source';
14
+ const VERSION = typeof "9.0.7" !== 'undefined' ? "9.0.7" : 'running from source';
15
15
  const STARTUP_MESSAGE = 'set luma.log.level=1 (or higher) to trace rendering';
16
16
  // Assign luma.log.level in console to control logging: \
17
17
  // 0: none, 1: minimal, 2: verbose, 3: attribute/uniforms, 4: gl logs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/core",
3
- "version": "9.0.6",
3
+ "version": "9.0.8",
4
4
  "description": "The luma.gl core Device API",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,5 +46,5 @@
46
46
  "@probe.gl/stats": "^4.0.2",
47
47
  "@types/offscreencanvas": "^2019.6.4"
48
48
  },
49
- "gitHead": "937f4cffd47819854b44ce1532add35f6a8d049c"
49
+ "gitHead": "40aa2ca078c5ff2d52445dce6a9efa982fba67a2"
50
50
  }
@@ -7,7 +7,7 @@ import type {RenderPassParameters} from '../types/parameters';
7
7
  // import {Binding} from '../types/shader-layout';
8
8
  import {Resource, ResourceProps} from './resource';
9
9
  import {Framebuffer} from './framebuffer';
10
- import {NumberArray} from '../..';
10
+ import {NumberArray} from '../../types';
11
11
  import {QuerySet} from './query-set';
12
12
 
13
13
  /**
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {TypedArray, TypedArrayConstructor} from '../..';
5
+ import {TypedArray, TypedArrayConstructor} from '../../types';
6
6
  import {VertexFormat} from '../types/vertex-formats';
7
7
 
8
8
  // import {DataType} from '../types/vertex-formats';
package/dist.min.js DELETED
@@ -1,18 +0,0 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if (typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if (typeof define === 'function' && define.amd) define([], factory);
5
- else if (typeof exports === 'object') exports['luma'] = factory();
6
- else root['luma'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var J=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var Ft=Object.prototype.hasOwnProperty;var It=(r,e,t)=>e in r?J(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var _t=(r,e)=>{for(var t in e)J(r,t,{get:e[t],enumerable:!0})},Mt=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Lt(e))!Ft.call(r,n)&&n!==t&&J(r,n,{get:()=>e[n],enumerable:!(o=Dt(e,n))||o.enumerable});return r};var Ut=r=>Mt(J({},"__esModule",{value:!0}),r);var u=(r,e,t)=>(It(r,typeof e!="symbol"?e+"":e,t),t);var Br={};_t(Br,{Buffer:()=>f,CanvasContext:()=>U,CommandBuffer:()=>j,CommandEncoder:()=>q,ComputePass:()=>W,ComputePipeline:()=>H,Device:()=>x,DeviceFeatures:()=>me,DeviceLimits:()=>ue,ExternalTexture:()=>k,Framebuffer:()=>O,QuerySet:()=>K,RenderPass:()=>G,RenderPipeline:()=>z,Resource:()=>m,Sampler:()=>$,Shader:()=>N,StatsManager:()=>_,Texture:()=>l,TextureView:()=>V,TransformFeedback:()=>X,UniformBlock:()=>F,UniformBufferLayout:()=>L,UniformStore:()=>ge,VERSION:()=>ae,VertexArray:()=>Y,assert:()=>E,cancelAnimationFrame:()=>Et,cast:()=>yt,checkProps:()=>Pt,decodeShaderAttributeType:()=>fe,decodeShaderUniformType:()=>de,decodeTextureFormat:()=>ot,decodeVertexFormat:()=>Q,deepEqual:()=>he,fillArray:()=>ft,formatCompilerLog:()=>ce,formatValue:()=>Oe,getAttributeInfosFromLayouts:()=>Me,getDataTypeFromTypedArray:()=>Ne,getScratchArray:()=>ct,getScratchArrayBuffer:()=>Z,getTypedArrayFromDataType:()=>bt,getVertexFormatFromAttribute:()=>ht,glsl:()=>Rr,isNumberArray:()=>h,isObjectEmpty:()=>et,isTypedArray:()=>xe,isUniformValue:()=>$e,loadFile:()=>wt,loadImage:()=>At,loadImageBitmap:()=>St,loadScript:()=>Rt,log:()=>c,luma:()=>D,makeRandomNumberGenerator:()=>ze,mergeShaderLayout:()=>mt,random:()=>Bt,requestAnimationFrame:()=>Ct,setPathPrefix:()=>vt,splitUniformsAndBindings:()=>xt,stubRemovedMethods:()=>Tt,uid:()=>P});function ye(r){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let e=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,t=r||e;return!!(t&&t.indexOf("Electron")>=0)}function d(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||ye()}var Vt=globalThis.self||globalThis.window||globalThis.global,ee=globalThis.window||globalThis.self||globalThis.global,kt=globalThis.document||{},te=globalThis.process||{},Nt=globalThis.console,Fr=globalThis.navigator||{};var re="4.0.6",Mr=d();function $t(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var oe=class{constructor(e,t,o="sessionStorage"){this.storage=$t(o),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 We(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 qe(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}function ne(r,e,t,o=600){let n=r.src.replace(/\(/g,"%28").replace(/\)/g,"%29");r.width>o&&(t=Math.min(t,o/r.width));let s=r.width*t,a=r.height*t,i=["font-size:1px;",`padding:${Math.floor(a/2)}px ${Math.floor(s/2)}px;`,`line-height:${a}px;`,`background:url(${n});`,`background-size:${s}px ${a}px;`,"color:transparent;"].join("");return[`${e} %c+`,i]}var se;(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"})(se||(se={}));var Ot=10;function je(r){return typeof r!="string"?r:(r=r.toUpperCase(),se[r]||se.WHITE)}function Qe(r,e,t){return!d&&typeof r=="string"&&(e&&(r=`\x1B[${je(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${je(t)+Ot}m${r}\x1B[49m`)),r}function Ye(r,e=["constructor"]){let t=Object.getPrototypeOf(r),o=Object.getOwnPropertyNames(t),n=r;for(let s of o){let a=n[s];typeof a=="function"&&(e.find(i=>s===i)||(n[s]=a.bind(r)))}}function A(r,e){if(!r)throw new Error(e||"Assertion failed")}function v(){let r;if(d()&&ee.performance)r=ee?.performance?.now?.();else if("hrtime"in te){let e=te?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var R={debug:d()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},zt={enabled:!0,level:0};function g(){}var Xe={},Ke={once:!0},T=class{constructor({id:e}={id:""}){this.VERSION=re,this._startTs=v(),this._deltaTs=v(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new oe(`__probe-${this.id}__`,zt),this.timeStamp(`${this.id} started`),Ye(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((v()-this._startTs).toPrecision(10))}getDelta(){return Number((v()-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){A(e,t)}warn(e){return this._getLogFunction(0,e,R.warn,arguments,Ke)}error(e){return this._getLogFunction(0,e,R.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,R.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,R.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,R.debug||R.info,arguments,Ke)}table(e,t,o){return t?this._getLogFunction(e,t,console.table||g,o&&[o],{tag:qt(t)}):g}image({logLevel:e,priority:t,image:o,message:n="",scale:s=1}){return this._shouldLog(e||t)?d()?Wt({image:o,message:n,scale:s}):Ht({image:o,message:n,scale:s}):g}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||g)}group(e,t,o={collapsed:!1}){let n=Ze({logLevel:e,message:t,opts:o}),{collapsed:s}=o;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t,o={}){return this.group(e,t,Object.assign({},o,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||g)}withGroup(e,t,o){this.group(e,t)();try{o()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Je(e)}_getLogFunction(e,t,o,n,s){if(this._shouldLog(e)){s=Ze({logLevel:e,message:t,args:n,opts:s}),o=o||s.method,A(o),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=v();let a=s.tag||s.message;if(s.once&&a)if(!Xe[a])Xe[a]=v();else return g;return t=Gt(this.id,s.message,s),o.bind(console,t,...s.args)}return g}};T.VERSION=re;function Je(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 A(Number.isFinite(e)&&e>=0),e}function Ze(r){let{logLevel:e,message:t}=r;r.logLevel=Je(e);let o=r.args?Array.from(r.args):[];for(;o.length&&o.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&o.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return A(n==="string"||n==="object"),Object.assign(r,{args:o},r.opts)}function Gt(r,e,t){if(typeof e=="string"){let o=t.time?qe(We(t.total)):"";e=t.time?`${r}: ${o} ${e}`:`${r}: ${e}`,e=Qe(e,t.color,t.background)}return e}function Ht({image:r,message:e="",scale:t=1}){return console.warn("removed"),g}function Wt({image:r,message:e="",scale:t=1}){if(typeof r=="string"){let n=new Image;return n.onload=()=>{let s=ne(n,e,t);console.log(...s)},n.src=r,g}let o=r.nodeName||"";if(o.toLowerCase()==="img")return console.log(...ne(r,e,t)),g;if(o.toLowerCase()==="canvas"){let n=new Image;return n.onload=()=>console.log(...ne(n,e,t)),n.src=r.toDataURL(),g}return g}function qt(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var ao=new T({id:"@probe.gl/log"});var c=new T({id:"luma.gl"});function I(){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 w=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=I(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(I()-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 B=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:o}=e,n=this.stats[t];return n||(e instanceof w?n=e:n=new w(t,o),this.stats[t]=n),n}};var _=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new B({id:e})),this.stats.get(e)}},C=new _;function jt(){let r=typeof __VERSION__<"u"?__VERSION__:"running from source",e="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==r)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${r}`);return globalThis.luma||(d()&&c.log(1,`${r} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:c,stats:C}),r}var ae=jt();function xe(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)?r:null}function h(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number"?r:null:xe(r)}var Te={};function P(r="id"){Te[r]=Te[r]||1;let e=Te[r]++;return`${r}-${e}`}function et(r){let e=!0;for(let t in r){e=!1;break}return e}var m=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,o){if(!e)throw new Error("no device");this._device=e,this.props=Qt(t,o);let n=this.props.id!=="undefined"?this.props.id:P(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get(`${t}s Active`).decrementCount()}trackAllocatedMemory(e,t=this[Symbol.toStringTag]){let o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(e),o.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()}};u(m,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Qt(r,e){let t={...e};for(let o in r)r[o]!==void 0&&(t[o]=r[o]);return t}var M=class extends m{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let o={...t};(t.usage||0)&M.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?o.indexType="uint32":t.data instanceof Uint16Array&&(o.indexType="uint16")),super(e,o,M.defaultProps),this.usage=t.usage||0,this.indexType=o.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,t){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,t,o){let n=ArrayBuffer.isView(e)?e.buffer:e,s=Math.min(e?e.byteLength:o,M.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(s):t===0&&o===e.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(t,t+s)}},f=M;u(f,"defaultProps",{...m.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),u(f,"MAP_READ",1),u(f,"MAP_WRITE",2),u(f,"COPY_SRC",4),u(f,"COPY_DST",8),u(f,"INDEX",16),u(f,"VERTEX",32),u(f,"UNIFORM",64),u(f,"STORAGE",128),u(f,"INDIRECT",256),u(f,"QUERY_RESOLVE",512),u(f,"DEBUG_DATA_MAX_LENGTH",32);function ie(r){let e=tt[r],t=Yt(e),o=r.includes("norm"),n=!o&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:tt[r],byteLength:t,integer:n,signed:s,normalized:o}}function Yt(r){return Xt[r]}var tt={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Xt={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Kt=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Zt=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function rt(r){return Kt.some(e=>r.startsWith(e))}function ot(r){let e=Zt.exec(r);if(e){let[,t,o,n,s,a]=e;if(t){let i=`${n}${o}`,p=ie(i);return{format:t,components:t.length,srgb:s==="-srgb",unsized:a==="-unsized",webgl:a==="-webgl",...p}}}return er(r)}var Jt={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function er(r){let e=Jt[r];if(!e)throw new Error(`Unknown format ${r}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var ue=class{},me=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)}},Pe=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...Pe.defaultProps,...e},this.id=this.props.id||P(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=C;_lumaData={};isTextureFormatCompressed(e){return rt(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,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")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};return(e.usage||0)&f.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":c.warn("indices buffer content must be of integer type")()),t}},x=Pe;u(x,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(c.get("debug")),spector:Boolean(c.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>c.error(e.message)}),u(x,"VERSION",ae);function E(r,e){if(!r)throw new Error(e||"luma.gl: assertion failed.")}var S=new Map,D=class{static registerDevices(e){for(let t of e)E(t.type&&t.isSupported&&t.create),S.set(t.type,t)}static getAvailableDevices(){return Array.from(S).map(e=>e.type)}static getSupportedDevices(){return Array.from(S).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(x.defaultProps,e)}static async createDevice(e={}){e={...x.defaultProps,...e},e.gl&&(e.type="webgl");let t;switch(e.type){case"webgpu":if(t=S.get("webgpu"),t)return await t.create(e);break;case"webgl":if(t=S.get("webgl"),t)return await t.create(e);break;case"best-available":if(t=S.get("webgpu"),t&&t.isSupported())return await t.create(e);if(t=S.get("webgl"),t&&t.isSupported())return await t.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}};u(D,"stats",C),u(D,"log",c);var tr=d()&&typeof document<"u",pe=()=>tr&&document.readyState==="complete",rr={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},U=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return pe()}constructor(e){if(this.props={...rr,...e},e=this.props,!d()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=sr(e.canvas):this.canvas=e.canvas;else{let t=ar(e),o=nr(e?.container||null);o.insertBefore(t,o.firstChild),this.canvas=t,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(t=>{for(let o of t)o.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),t=this.canvas;return t.parentElement?[t.clientWidth*e,t.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,t]=this.getPixelSize();return e/t}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:t}=this._canvasSizeInfo;return t?e/t:1}catch{return 1}}cssToDevicePixels(e,t=!0){let o=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return ir(e,o,n,s,t)}setDevicePixelRatio(e,t={}){if(!this.htmlCanvas)return;let o="width"in t?t.width:this.htmlCanvas.clientWidth,n="height"in t?t.height:this.htmlCanvas.clientHeight;(!o||!n)&&(c.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,o=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==o||s.clientHeight!==n||s.devicePixelRatio!==e){let a=e,i=Math.floor(o*a),p=Math.floor(n*a);this.htmlCanvas.width=i,this.htmlCanvas.height=p;let[b,y]=this.getDrawingBufferSize();(b!==i||y!==p)&&(a=Math.min(b/o,y/n),this.htmlCanvas.width=Math.floor(o*a),this.htmlCanvas.height=Math.floor(n*a),c.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=o,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};u(U,"pageLoaded",or());function or(){return pe()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function nr(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e&&!pe())throw new Error(`Accessing '${r}' before page was loaded`);if(!e)throw new Error(`${r} is not an HTML element`);return e}else if(r)return r;return document.body}function sr(r){let e=document.getElementById(r);if(!e&&!pe())throw new Error(`Accessing '${r}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function ar(r){let{width:e,height:t}=r,o=document.createElement("canvas");return o.id="lumagl-auto-created-canvas",o.width=e||1,o.height=t||1,o.style.width=Number.isFinite(e)?`${e}px`:"100%",o.style.height=Number.isFinite(t)?`${t}px`:"100%",o}function ir(r,e,t,o,n){let s=r,a=nt(s[0],e,t),i=st(s[1],e,o,n),p=nt(s[0]+1,e,t),b=p===t-1?p:p-1;p=st(s[1]+1,e,o,n);let y;return n?(p=p===0?p:p+1,y=i,i=p):y=p===o-1?p:p-1,{x:a,y:i,width:Math.max(b-a+1,1),height:Math.max(y-i+1,1)}}function nt(r,e,t){return Math.min(Math.round(r*e),t-1)}function st(r,e,t,o){return o?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var ve=class extends m{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,t,o=ve.defaultProps){super(e,t,o),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=e.incrementTimestamp()}},l=ve;u(l,"defaultProps",{...m.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),u(l,"COPY_SRC",1),u(l,"COPY_DST",2),u(l,"TEXTURE_BINDING",4),u(l,"STORAGE_BINDING",8),u(l,"RENDER_ATTACHMENT",16);var we=class extends m{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,we.defaultProps)}},V=we;u(V,"defaultProps",{...m.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var Se=class extends m{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,Se.defaultProps)}},k=Se;u(k,"defaultProps",{...m.defaultProps,source:null,colorSpace:"srgb"});function ce(r,e,t){let o="",n=e.split(/\r?\n/),s=r.slice().sort((a,i)=>a.lineNum-i.lineNum);switch(t?.showSourceCode||"no"){case"all":let a=0;for(let i=1;i<=n.length;i++)for(o+=it(n[i-1],i,t);s.length>a&&s[a].lineNum===i;){let p=s[a++];o+=at(p,n,p.lineNum,{...t,inlineSource:!1})}return o;case"issues":case"no":for(let i of r)o+=at(i,n,i.lineNum,{inlineSource:t?.showSourceCode!=="no"});return o}}function at(r,e,t,o){if(o?.inlineSource){let n=ur(e,t),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
8
- `:"";return`
9
- ${n}${s}${r.type.toUpperCase()}: ${r.message}
10
-
11
- `}return o?.html?`<div class='luma-compiler-log-error' style="color:red;"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function ur(r,e,t){let o="";for(let n=e-2;n<=e;n++){let s=r[n-1];s!==void 0&&(o+=it(s,e,t))}return o}function it(r,e,t){let o=t?.html?pr(r):r;return`${mr(String(e),4)}: ${o}${t?.html?"<br/>":`
12
- `}`}function mr(r,e){let t="";for(let o=r.length;o<e;++o)t+=" ";return t+r}function pr(r){return r.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function Ae(r,e){return{name:cr(r,e),language:"glsl",version:fr(r)}}function cr(r,e="unnamed"){let o=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return o?o[1]:e}function fr(r){let e=100,t=r.match(/[^\s]+/g);if(t&&t.length>=2&&t[0]==="#version"){let o=parseInt(t[1],10);Number.isFinite(o)&&(e=o)}return e}var Re=class extends m{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){super(e,{id:dr(t),...t},Re.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(e=this.props.debug){switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let t=await this.getCompilationInfo();this.props.debug==="warnings"&&t?.length===0||this._displayShaderLog(t)}_displayShaderLog(e){if(typeof document>"u"||!document?.createElement)return;let t=Ae(this.source).name,o=`${this.stage} ${t}`,n=ce(e,this.source,{showSourceCode:"all",html:!0}),s=this.getTranslatedSource();s&&(n+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${s}</pre></code>`);let a=document.createElement("Button");a.innerHTML=`
13
- <h1>Shader Compilation Error in ${o}</h1><br /><br />
14
- <code style="user-select:text;"><pre>
15
- ${n}
16
- </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);let i=document.getElementsByClassName("luma-compiler-log-error");i[0]?.scrollIntoView&&i[0].scrollIntoView(),a.onclick=()=>{let p=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(p)}}},N=Re;u(N,"defaultProps",{...m.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function dr(r){return Ae(r.source).name||r.id||P(`unnamed ${r.stage}-shader`)}var Be=class extends m{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){super(e,t,Be.defaultProps)}},$=Be;u($,"defaultProps",{...m.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var Ce=class extends m{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,t={}){super(e,t,Ce.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let t=!e;if(e){let[o,n]=Array.isArray(e)?e:[e.width,e.height];t=t||n!==this.height||o!==this.width,this.width=o,this.height=n}t&&(c.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=>{if(typeof t=="string"){let o=this.createColorTexture(t);return this.attachResource(o),o.view}return t instanceof l?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 l?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:l.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:l.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){for(let o=0;o<this.colorAttachments.length;++o)if(this.colorAttachments[o]){let n=this.device._createTexture({...this.colorAttachments[o].props,width:e,height:t});this.destroyAttachedResource(this.colorAttachments[o]),this.colorAttachments[o]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let o=this.device._createTexture({...this.depthStencilAttachment.props,width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=o.view,this.attachResource(o)}}},O=Ce;u(O,"defaultProps",{...m.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Ee=class extends m{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,Ee.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},z=Ee;u(z,"defaultProps",{...m.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});var De=class extends m{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){super(e,t,De.defaultProps)}},G=De;u(G,"defaultProps",{...m.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Le=class extends m{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(e,t){super(e,t,Le.defaultProps)}},H=Le;u(H,"defaultProps",{...m.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Fe=class extends m{get[Symbol.toStringTag](){return"ComputePass"}constructor(e,t){super(e,t,Fe.defaultProps)}},W=Fe;u(W,"defaultProps",{...m.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ie=class extends m{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,Ie.defaultProps)}},q=Ie;u(q,"defaultProps",{...m.defaultProps,measureExecutionTime:void 0});var _e=class extends m{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,_e.defaultProps)}},j=_e;u(j,"defaultProps",{...m.defaultProps});function fe(r){let[e,t]=gr[r],o=e==="i32"||e==="u32",n=e!=="u32",s=br[e]*t,a=lr(e,t);return{dataType:e,components:t,defaultVertexFormat:a,byteLength:s,integer:o,signed:n}}function lr(r,e){let t;switch(r){case"f32":t="float32";break;case"i32":t="sint32";break;case"u32":t="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?t:`${t}x${e}`}var gr={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]},br={f32:4,f16:2,i32:4,u32:4};function Q(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,o]=r.split("x"),n=t,s=o?parseInt(o):1,a=ie(n),i={type:n,components:s,byteLength:a.byteLength*s,integer:a.integer,signed:a.signed,normalized:a.normalized};return e&&(i.webglOnly=!0),i}function Me(r,e){let t={};for(let o of r.attributes)t[o.name]=hr(r,e,o.name);return t}function ut(r,e,t=16){let o=Me(r,e),n=new Array(t).fill(null);for(let s of Object.values(o))n[s.location]=s;return n}function hr(r,e,t){let o=yr(r,t),n=xr(e,t);if(!o)return null;let s=fe(o.type),a=n?.vertexFormat||s.defaultVertexFormat,i=Q(a);return{attributeName:n?.attributeName||o.name,bufferName:n?.bufferName||o.name,location:o.location,shaderType:o.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:a,bufferDataType:i.type,bufferComponents:i.components,normalized:i.normalized,integer:s.integer,stepMode:n?.stepMode||o.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function yr(r,e){let t=r.attributes.find(o=>o.name===e);return t||c.warn(`shader layout attribute "${e}" not present in shader`),t||null}function xr(r,e){Tr(r);let t=Pr(r,e);return t||(t=vr(r,e),t)?t:(c.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Tr(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&c.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Pr(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 vr(r,e){for(let t of r){let o=t.byteStride;if(typeof t.byteStride!="number")for(let s of t.attributes||[]){let a=Q(s.format);o+=a.byteLength}let n=t.attributes?.find(s=>s.attribute===e);if(n)return{attributeName:n.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:o}}return null}function mt(r,e){let t={...r,attributes:r.attributes.map(o=>({...o}))};for(let o of e?.attributes||[]){let n=t.attributes.find(s=>s.name===o.name);n?(n.type=o.type||n.type,n.stepMode=o.stepMode||n.stepMode):c.warn(`shader layout attribute ${o.name} not present in shader`)}return t}var Ue=class extends m{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,Ue.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=ut(t.renderPipeline.shaderLayout,t.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){throw new Error("constant attributes not supported")}},Y=Ue;u(Y,"defaultProps",{...m.defaultProps,renderPipeline:null});var Ve=class extends m{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Ve.defaultProps)}},X=Ve;u(X,"defaultProps",{...m.defaultProps,layout:void 0,buffers:{}});var ke=class extends m{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,ke.defaultProps)}},K=ke;u(K,"defaultProps",{...m.defaultProps,type:void 0,count:void 0});var wr={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function de(r){let e=wr[r];return E(r),e}function pt(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var le;function Z(r){return(!le||le.byteLength<r)&&(le=new ArrayBuffer(r)),le}function ct(r,e){let t=Z(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function ft(r){let{target:e,source:t,start:o=0,count:n=1}=r,s=t.length,a=n*s,i=0;for(let p=o;i<s;i++)e[p++]=t[i];for(;i<a;)i<a-i?(e.copyWithin(o+i,o,o+i),i*=2):(e.copyWithin(o+i,o,o+a-i),i=a);return r.target}var dt=1024,L=class{layout={};byteLength;constructor(e){let t=0;for(let[n,s]of Object.entries(e)){let a=de(s),{type:i,components:p}=a;t=pt(t,p);let b=t;t+=p,this.layout[n]={type:i,size:p,offset:b}}t+=(4-t%4)%4;let o=t*4;this.byteLength=Math.max(o,dt)}getData(e){let t=Math.max(this.byteLength,dt),o=Z(t),n={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)};for(let[s,a]of Object.entries(e)){let i=this.layout[s];if(!i){c.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:p,size:b,offset:y}=i,Ge=n[p];if(b===1){if(typeof a!="number"&&typeof a!="boolean"){c.warn(`Supplied value for single component uniform ${s} is not a number: ${a}`)();continue}Ge[y]=Number(a)}else{let He=h(a);if(!He){c.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${a}`)();continue}Ge.set(He,y)}}return new Uint8Array(o)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function lt(r,e,t=16){if(r!==e)return!1;let o=h(r);if(!o)return!1;let n=h(e);if(n&&o.length===n.length){for(let s=0;s<o.length;++s)if(n[s]!==o[s])return!1}return!0}function gt(r){let e=h(r);return e?e.slice():r}var F=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name,e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!t)throw new Error(e?.name);let o=t;for(let n of o.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[t,o]of Object.entries(e))this._setUniform(t,o),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${o}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){lt(this.uniforms[e],t)||(this.uniforms[e]=gt(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var ge=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,o]of Object.entries(e)){let n=t,s=new L(o.uniformTypes||{});this.uniformBufferLayouts.set(n,s);let a=new F({name:t});a.setUniforms(o.defaultUniforms||{}),this.uniformBlocks.set(n,a)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,o]of Object.entries(e))this.uniformBlocks.get(t).setUniforms(o);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e).byteLength}getUniformBufferData(e){let t=this.uniformBlocks.get(e).getAllUniforms();return this.uniformBufferLayouts.get(e).getData(t)}createUniformBuffer(e,t,o){o&&this.setUniforms(o);let n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:f.UNIFORM|f.COPY_DST,byteLength:n}),a=this.getUniformBufferData(t);return s.write(a),s}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let o=this.getUniformBufferByteLength(t),n=e.createBuffer({usage:f.UNIFORM|f.COPY_DST,byteLength:o});this.uniformBuffers.set(t,n)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let o=this.updateUniformBuffer(t);e||=o}return e&&c.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),o=this.uniformBuffers.get(e),n=!1;if(o&&t.needsRedraw){n||=t.needsRedraw;let s=this.getUniformBufferData(e);this.uniformBuffers.get(e).write(s);let i=this.uniformBlocks.get(e).getAllUniforms();c.log(4,`Writing to uniform buffer ${String(e)}`,s,i)()}return n}};function Ne(r){let e=ArrayBuffer.isView(r)?r.constructor:r;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function bt(r){switch(r){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(r)}}function ht(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let o=e,n=Ne(r);if(n==="uint8"||n==="sint8"){if(o===1||o===3)throw new Error(`size: ${e}`);return t&&(n=n.replace("int","norm")),`${n}x${o}`}if(n==="uint16"||n==="sint16"){if(o===1||o===3)throw new Error(`size: ${e}`);return t&&(n=n.replace("int","norm")),`${n}x${o}`}return o===1?n:`${n}x${o}`}function yt(r){return r}function $e(r){return h(r)!==null||typeof r=="number"||typeof r=="boolean"}function xt(r){let e={bindings:{},uniforms:{}};return Object.keys(r).forEach(t=>{let o=r[t];$e(o)?e.uniforms[t]=o:e.bindings[t]=o}),e}function Sr(r,e={}){let{maxElts:t=16,size:o=1}=e,n="[";for(let a=0;a<r.length&&a<t;++a)a>0&&(n+=`,${a%o===0?" ":""}`),n+=Oe(r[a],e);let s=r.length>t?"...":"]";return`${n}${s}`}function Oe(r,e={}){let{isInteger:o=!1}=e;if(Array.isArray(r)||ArrayBuffer.isView(r))return Sr(r,e);if(typeof r!="number")return String(r);if(Math.abs(r)<1e-16)return o?"0":"0.";if(o||Math.abs(r)>100&&Math.abs(r)<1e4)return r.toFixed(0);let n=r.toPrecision(2);return n.indexOf(".0")===n.length-2?n.slice(0,-1):n}function Tt(r,e,t,o){let n=`See luma.gl ${t} Upgrade Guide at https://luma.gl/docs/upgrade-guide`,s=Object.getPrototypeOf(r);o.forEach(a=>{s.methodName||(s[a]=()=>{throw c.removed(`Calling removed method ${e}.${a}: `,n)(),new Error(a)})})}function Pt(r,e,t){let{removedProps:o={},deprecatedProps:n={},replacedProps:s={}}=t;for(let i in o)if(i in e){let b=o[i]?`${r}.${o[i]}`:"N/A";c.removed(`${r}.${i}`,b)()}for(let i in n)if(i in e){let p=n[i];c.deprecated(`${r}.${i}`,`${r}.${p}`)()}let a=null;for(let[i,p]of Object.entries(s))i in e&&(c.deprecated(`${r}.${i}`,`${r}.${p}`)(),a=a||Object.assign({},e),a[p]=e[i],delete a[i]);return a||e}var be="";function vt(r){be=r}async function wt(r,e){r=r.startsWith("http")?r:be+r;let t=e?.dataType||"text";return await(await fetch(r,e))[t]()}async function St(r,e){let t=new Image;return t.crossOrigin=e?.crossOrigin||"anonymous",t.src=r.startsWith("http")?r:be+r,await t.decode(),await createImageBitmap(t)}async function At(r,e){return await new Promise((t,o)=>{try{let n=new Image;n.onload=()=>t(n),n.onerror=()=>o(new Error(`Could not load image ${r}.`)),n.crossOrigin=e?.crossOrigin||"anonymous",n.src=r.startsWith("http")?r:be+r}catch(n){o(n)}})}async function Rt(r,e){let t=document.getElementsByTagName("head")[0];if(!t)throw new Error("loadScript");let o=document.createElement("script");return o.setAttribute("type","text/javascript"),o.setAttribute("src",r),e&&(o.id=e),new Promise((n,s)=>{o.onload=n,o.onerror=a=>s(new Error(`Unable to load script '${r}': ${a}`)),t.appendChild(o)})}function ze(){let r=1,e=1;return()=>(r=Math.sin(e*17.23),e=Math.cos(r*27.92),Ar(Math.abs(r*e)*1432.71))}function Ar(r){return r-Math.floor(r)}var Bt=ze();function he(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 o=0;o<r.length;o++)if(!he(r[o],e[o],t-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof r=="object"&&typeof e=="object"){let o=Object.keys(r),n=Object.keys(e);if(o.length!==n.length)return!1;for(let s of o)if(!e.hasOwnProperty(s)||!he(r[s],e[s],t-1))return!1;return!0}return!1}function Ct(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function Et(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}var Rr=r=>`${r}`;return Ut(Br);})();
17
- return __exports__;
18
- });