@luma.gl/core 9.0.0-beta.9 → 9.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,7 +59,9 @@ export declare abstract class RenderPipeline extends Resource<RenderPipelineProp
59
59
  hash: string;
60
60
  constructor(device: Device, props: RenderPipelineProps);
61
61
  /** Set bindings (stored on pipeline and set before each call) */
62
- abstract setBindings(bindings: Record<string, Binding>): void;
62
+ abstract setBindings(bindings: Record<string, Binding>, options?: {
63
+ disableWarnings?: boolean;
64
+ }): void;
63
65
  /** Draw call. Returns false if the draw call was aborted (due to resources still initializing) */
64
66
  abstract draw(options: {
65
67
  /** Render pass to draw into (targeting screen or framebuffer) */
@@ -1 +1 @@
1
- {"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/render-pipeline.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/render-pipeline.ts"],"names":[],"mappings":"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"}
package/dist/dist.dev.js CHANGED
@@ -97,44 +97,37 @@ var __exports__ = (() => {
97
97
  uid: () => uid
98
98
  });
99
99
 
100
+ // ../../node_modules/@probe.gl/env/dist/lib/globals.js
101
+ var window_ = globalThis;
102
+ var document_ = globalThis.document || {};
103
+ var process_ = globalThis.process || {};
104
+ var console_ = globalThis.console;
105
+ var navigator_ = globalThis.navigator || {};
106
+
100
107
  // ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
101
108
  function isElectron(mockUserAgent) {
102
- if (typeof window !== "undefined" && typeof window.process === "object" && // @ts-expect-error
103
- window.process.type === "renderer") {
109
+ if (typeof window !== "undefined" && window.process?.type === "renderer") {
104
110
  return true;
105
111
  }
106
- if (typeof process !== "undefined" && typeof process.versions === "object" && // eslint-disable-next-line
107
- Boolean(process.versions["electron"])) {
112
+ if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
108
113
  return true;
109
114
  }
110
- const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
115
+ const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
111
116
  const userAgent = mockUserAgent || realUserAgent;
112
- if (userAgent && userAgent.indexOf("Electron") >= 0) {
113
- return true;
114
- }
115
- return false;
117
+ return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
116
118
  }
117
119
 
118
120
  // ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
119
121
  function isBrowser() {
120
122
  const isNode = (
121
123
  // @ts-expect-error
122
- typeof process === "object" && String(process) === "[object process]" && !process.browser
124
+ typeof process === "object" && String(process) === "[object process]" && !process?.browser
123
125
  );
124
126
  return !isNode || isElectron();
125
127
  }
126
128
 
127
- // ../../node_modules/@probe.gl/env/dist/lib/globals.js
128
- var self_ = globalThis.self || globalThis.window || globalThis.global;
129
- var window_ = globalThis.window || globalThis.self || globalThis.global;
130
- var document_ = globalThis.document || {};
131
- var process_ = globalThis.process || {};
132
- var console_ = globalThis.console;
133
- var navigator_ = globalThis.navigator || {};
134
-
135
- // ../../node_modules/@probe.gl/env/dist/utils/globals.js
136
- var VERSION = true ? "4.0.6" : "untranspiled source";
137
- var isBrowser2 = isBrowser();
129
+ // ../../node_modules/@probe.gl/env/dist/index.js
130
+ var VERSION = true ? "4.0.7" : "untranspiled source";
138
131
 
139
132
  // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
140
133
  function getStorage(type) {
@@ -195,23 +188,6 @@ var __exports__ = (() => {
195
188
  const padLength = Math.max(length - string.length, 0);
196
189
  return `${" ".repeat(padLength)}${string}`;
197
190
  }
198
- function formatImage(image, message, scale, maxWidth = 600) {
199
- const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
200
- if (image.width > maxWidth) {
201
- scale = Math.min(scale, maxWidth / image.width);
202
- }
203
- const width = image.width * scale;
204
- const height = image.height * scale;
205
- const style = [
206
- "font-size:1px;",
207
- `padding:${Math.floor(height / 2)}px ${Math.floor(width / 2)}px;`,
208
- `line-height:${height}px;`,
209
- `background:url(${imageUrl});`,
210
- `background-size:${width}px ${height}px;`,
211
- "color:transparent;"
212
- ].join("");
213
- return [`${message} %c+`, style];
214
- }
215
191
 
216
192
  // ../../node_modules/@probe.gl/log/dist/utils/color.js
217
193
  var COLOR;
@@ -380,7 +356,9 @@ var __exports__ = (() => {
380
356
  }
381
357
  // Unconditional logging
382
358
  assert(condition, message) {
383
- assert(condition, message);
359
+ if (!condition) {
360
+ throw new Error(message || "Assertion failed");
361
+ }
384
362
  }
385
363
  warn(message) {
386
364
  return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
@@ -420,13 +398,6 @@ var __exports__ = (() => {
420
398
  }
421
399
  return noop;
422
400
  }
423
- /** logs an image under Chrome */
424
- image({ logLevel, priority, image, message = "", scale = 1 }) {
425
- if (!this._shouldLog(logLevel || priority)) {
426
- return noop;
427
- }
428
- return isBrowser() ? logImageInBrowser({ image, message, scale }) : logImageInNode({ image, message, scale });
429
- }
430
401
  time(logLevel, message) {
431
402
  return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
432
403
  }
@@ -542,33 +513,6 @@ var __exports__ = (() => {
542
513
  }
543
514
  return message;
544
515
  }
545
- function logImageInNode({ image, message = "", scale = 1 }) {
546
- console.warn("removed");
547
- return noop;
548
- }
549
- function logImageInBrowser({ image, message = "", scale = 1 }) {
550
- if (typeof image === "string") {
551
- const img = new Image();
552
- img.onload = () => {
553
- const args = formatImage(img, message, scale);
554
- console.log(...args);
555
- };
556
- img.src = image;
557
- return noop;
558
- }
559
- const element = image.nodeName || "";
560
- if (element.toLowerCase() === "img") {
561
- console.log(...formatImage(image, message, scale));
562
- return noop;
563
- }
564
- if (element.toLowerCase() === "canvas") {
565
- const img = new Image();
566
- img.onload = () => console.log(...formatImage(img, message, scale));
567
- img.src = image.toDataURL();
568
- return noop;
569
- }
570
- return noop;
571
- }
572
516
  function getTableHeader(table) {
573
517
  for (const key in table) {
574
518
  for (const title in table[key]) {
@@ -1332,51 +1276,76 @@ var __exports__ = (() => {
1332
1276
  }
1333
1277
 
1334
1278
  // src/lib/luma.ts
1335
- var deviceList = /* @__PURE__ */ new Map();
1279
+ var deviceMap = /* @__PURE__ */ new Map();
1336
1280
  var luma = class {
1337
1281
  static registerDevices(deviceClasses) {
1338
1282
  for (const deviceClass of deviceClasses) {
1339
1283
  assert2(deviceClass.type && deviceClass.isSupported && deviceClass.create);
1340
- deviceList.set(deviceClass.type, deviceClass);
1284
+ deviceMap.set(deviceClass.type, deviceClass);
1341
1285
  }
1342
1286
  }
1343
1287
  static getAvailableDevices() {
1344
- return Array.from(deviceList).map((Device2) => Device2.type);
1288
+ return Array.from(deviceMap).map((Device2) => Device2.type);
1345
1289
  }
1346
1290
  static getSupportedDevices() {
1347
- return Array.from(deviceList).filter((Device2) => Device2.isSupported()).map((Device2) => Device2.type);
1291
+ return Array.from(deviceMap).filter((Device2) => Device2.isSupported()).map((Device2) => Device2.type);
1348
1292
  }
1349
1293
  static setDefaultDeviceProps(props) {
1350
1294
  Object.assign(Device.defaultProps, props);
1351
1295
  }
1296
+ /** Attach to an existing GPU API handle (WebGL2RenderingContext or GPUDevice). */
1297
+ static async attachDevice(props) {
1298
+ const devices = getDeviceMap(props.devices) || deviceMap;
1299
+ if (props.handle instanceof WebGL2RenderingContext) {
1300
+ const WebGLDevice = devices.get("webgl");
1301
+ if (WebGLDevice) {
1302
+ return await WebGLDevice.attach(props.handle);
1303
+ }
1304
+ }
1305
+ if (props.handle === null) {
1306
+ const UnknownDevice = devices.get("unknown");
1307
+ if (UnknownDevice) {
1308
+ return await UnknownDevice.attach(null);
1309
+ }
1310
+ }
1311
+ throw new Error(
1312
+ "Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported."
1313
+ );
1314
+ }
1352
1315
  /** Creates a device. Asynchronously. */
1353
1316
  static async createDevice(props = {}) {
1354
1317
  props = { ...Device.defaultProps, ...props };
1355
1318
  if (props.gl) {
1356
1319
  props.type = "webgl";
1357
1320
  }
1358
- let DeviceClass;
1321
+ const devices = getDeviceMap(props.devices) || deviceMap;
1359
1322
  switch (props.type) {
1360
1323
  case "webgpu":
1361
- DeviceClass = deviceList.get("webgpu");
1362
- if (DeviceClass) {
1363
- return await DeviceClass.create(props);
1324
+ let WebGPUDevice = devices.get("webgpu");
1325
+ if (WebGPUDevice) {
1326
+ return await WebGPUDevice.create(props);
1364
1327
  }
1365
1328
  break;
1366
1329
  case "webgl":
1367
- DeviceClass = deviceList.get("webgl");
1368
- if (DeviceClass) {
1369
- return await DeviceClass.create(props);
1330
+ let WebGLDevice = devices.get("webgl");
1331
+ if (WebGLDevice) {
1332
+ return await WebGLDevice.create(props);
1333
+ }
1334
+ break;
1335
+ case "unknown":
1336
+ const UnknownDevice = devices.get("unknown");
1337
+ if (UnknownDevice) {
1338
+ return await UnknownDevice.create(props);
1370
1339
  }
1371
1340
  break;
1372
1341
  case "best-available":
1373
- DeviceClass = deviceList.get("webgpu");
1374
- if (DeviceClass && DeviceClass.isSupported()) {
1375
- return await DeviceClass.create(props);
1342
+ WebGPUDevice = devices.get("webgpu");
1343
+ if (WebGPUDevice?.isSupported?.()) {
1344
+ return await WebGPUDevice.create(props);
1376
1345
  }
1377
- DeviceClass = deviceList.get("webgl");
1378
- if (DeviceClass && DeviceClass.isSupported()) {
1379
- return await DeviceClass.create(props);
1346
+ WebGLDevice = devices.get("webgl");
1347
+ if (WebGLDevice?.isSupported?.()) {
1348
+ return await WebGLDevice.create(props);
1380
1349
  }
1381
1350
  break;
1382
1351
  }
@@ -1385,10 +1354,25 @@ var __exports__ = (() => {
1385
1354
  );
1386
1355
  }
1387
1356
  };
1357
+ __publicField(luma, "defaultProps", {
1358
+ ...Device.defaultProps,
1359
+ type: "best-available",
1360
+ devices: void 0
1361
+ });
1388
1362
  /** Global stats for all devices */
1389
1363
  __publicField(luma, "stats", lumaStats);
1390
1364
  /** Global log */
1391
1365
  __publicField(luma, "log", log);
1366
+ function getDeviceMap(deviceClasses) {
1367
+ if (!deviceClasses || deviceClasses?.length === 0) {
1368
+ return null;
1369
+ }
1370
+ const map = /* @__PURE__ */ new Map();
1371
+ for (const deviceClass of deviceClasses) {
1372
+ map.set(deviceClass.type, deviceClass);
1373
+ }
1374
+ return map;
1375
+ }
1392
1376
 
1393
1377
  // src/adapter/canvas-context.ts
1394
1378
  var isPage = isBrowser() && typeof document !== "undefined";
package/dist/dist.min.js CHANGED
@@ -4,15 +4,15 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['luma'] = factory();
6
6
  else root['luma'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var J=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames;var $e=Object.prototype.hasOwnProperty;var Re=(r,t,e)=>t in r?J(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Me=(r,t)=>{for(var e in t)J(r,e,{get:t[e],enumerable:!0})},Ne=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Le(t))!$e.call(r,n)&&n!==e&&J(r,n,{get:()=>t[n],enumerable:!(o=Ie(t,n))||o.enumerable});return r};var Fe=r=>Ne(J({},"__esModule",{value:!0}),r);var c=(r,t,e)=>(Re(r,typeof t!="symbol"?t+"":t,e),e);var Pr={};Me(Pr,{Buffer:()=>m,CanvasContext:()=>F,CommandBuffer:()=>Y,CommandEncoder:()=>j,ComputePass:()=>W,ComputePipeline:()=>O,Device:()=>x,DeviceFeatures:()=>ut,DeviceLimits:()=>ct,ExternalTexture:()=>D,Framebuffer:()=>k,QuerySet:()=>Q,RenderPass:()=>V,RenderPipeline:()=>G,Resource:()=>u,Sampler:()=>H,Shader:()=>z,StatsManager:()=>M,Texture:()=>h,TextureView:()=>U,TransformFeedback:()=>K,UniformBlock:()=>$,UniformBufferLayout:()=>L,UniformStore:()=>pt,VERSION:()=>it,VertexArray:()=>q,assert:()=>C,cancelAnimationFrame:()=>Ce,cast:()=>be,checkProps:()=>Se,decodeShaderAttributeType:()=>mt,decodeShaderUniformType:()=>dt,decodeTextureFormat:()=>oe,decodeVertexFormat:()=>X,deepEqual:()=>yt,fillArray:()=>me,formatCompilerLog:()=>lt,formatValue:()=>kt,getAttributeInfosFromLayouts:()=>Nt,getDataTypeFromTypedArray:()=>zt,getScratchArray:()=>le,getScratchArrayBuffer:()=>Z,getTypedArrayFromDataType:()=>ge,getVertexFormatFromAttribute:()=>ye,glsl:()=>_r,isNumberArray:()=>y,isObjectEmpty:()=>te,isTypedArray:()=>xt,isUniformValue:()=>Ht,loadFile:()=>Ae,loadImage:()=>ve,loadImageBitmap:()=>Ee,loadScript:()=>_e,log:()=>l,luma:()=>I,makeRandomNumberGenerator:()=>Gt,mergeShaderLayout:()=>ue,random:()=>Pe,requestAnimationFrame:()=>Be,setPathPrefix:()=>Te,splitUniformsAndBindings:()=>xe,stubRemovedMethods:()=>we,uid:()=>S});function bt(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 t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,e=r||t;return!!(e&&e.indexOf("Electron")>=0)}function d(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||bt()}var Ue=globalThis.self||globalThis.window||globalThis.global,tt=globalThis.window||globalThis.self||globalThis.global,De=globalThis.document||{},et=globalThis.process||{},ze=globalThis.console,$r=globalThis.navigator||{};var rt="4.0.6",Nr=d();function He(r){try{let t=window[r],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}var ot=class{constructor(t,e,o="sessionStorage"){this.storage=He(o),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let t={};if(this.storage){let e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}};function Wt(r){let t;return r<10?t=`${r.toFixed(2)}ms`:r<100?t=`${r.toFixed(1)}ms`:r<1e3?t=`${r.toFixed(0)}ms`:t=`${(r/1e3).toFixed(2)}s`,t}function jt(r,t=8){let e=Math.max(t-r.length,0);return`${" ".repeat(e)}${r}`}function nt(r,t,e,o=600){let n=r.src.replace(/\(/g,"%28").replace(/\)/g,"%29");r.width>o&&(e=Math.min(e,o/r.width));let s=r.width*e,i=r.height*e,a=["font-size:1px;",`padding:${Math.floor(i/2)}px ${Math.floor(s/2)}px;`,`line-height:${i}px;`,`background:url(${n});`,`background-size:${s}px ${i}px;`,"color:transparent;"].join("");return[`${t} %c+`,a]}var st;(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"})(st||(st={}));var ke=10;function Yt(r){return typeof r!="string"?r:(r=r.toUpperCase(),st[r]||st.WHITE)}function Xt(r,t,e){return!d&&typeof r=="string"&&(t&&(r=`\x1B[${Yt(t)}m${r}\x1B[39m`),e&&(r=`\x1B[${Yt(e)+ke}m${r}\x1B[49m`)),r}function qt(r,t=["constructor"]){let e=Object.getPrototypeOf(r),o=Object.getOwnPropertyNames(e),n=r;for(let s of o){let i=n[s];typeof i=="function"&&(t.find(a=>s===a)||(n[s]=i.bind(r)))}}function v(r,t){if(!r)throw new Error(t||"Assertion failed")}function T(){let r;if(d()&&tt.performance)r=tt?.performance?.now?.();else if("hrtime"in et){let t=et?.hrtime?.();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var _={debug:d()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Ge={enabled:!0,level:0};function p(){}var Kt={},Qt={once:!0},w=class{constructor({id:t}={id:""}){this.VERSION=rt,this._startTs=T(),this._deltaTs=T(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new ot(`__probe-${this.id}__`,Ge),this.timeStamp(`${this.id} started`),qt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((T()-this._startTs).toPrecision(10))}getDelta(){return Number((T()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){v(t,e)}warn(t){return this._getLogFunction(0,t,_.warn,arguments,Qt)}error(t){return this._getLogFunction(0,t,_.error,arguments)}deprecated(t,e){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${e}\` instead`)}removed(t,e){return this.error(`\`${t}\` has been removed. Use \`${e}\` instead`)}probe(t,e){return this._getLogFunction(t,e,_.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,_.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,_.debug||_.info,arguments,Qt)}table(t,e,o){return e?this._getLogFunction(t,e,console.table||p,o&&[o],{tag:je(e)}):p}image({logLevel:t,priority:e,image:o,message:n="",scale:s=1}){return this._shouldLog(t||e)?d()?We({image:o,message:n,scale:s}):Oe({image:o,message:n,scale:s}):p}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||p)}group(t,e,o={collapsed:!1}){let n=Zt({logLevel:t,message:e,opts:o}),{collapsed:s}=o;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,e,o={}){return this.group(t,e,Object.assign({},o,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||p)}withGroup(t,e,o){this.group(t,e)();try{o()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Jt(t)}_getLogFunction(t,e,o,n,s){if(this._shouldLog(t)){s=Zt({logLevel:t,message:e,args:n,opts:s}),o=o||s.method,v(o),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=T();let i=s.tag||s.message;if(s.once&&i)if(!Kt[i])Kt[i]=T();else return p;return e=Ve(this.id,s.message,s),o.bind(console,e,...s.args)}return p}};w.VERSION=rt;function Jt(r){if(!r)return 0;let t;switch(typeof r){case"number":t=r;break;case"object":t=r.logLevel||r.priority||0;break;default:return 0}return v(Number.isFinite(t)&&t>=0),t}function Zt(r){let{logLevel:t,message:e}=r;r.logLevel=Jt(t);let o=r.args?Array.from(r.args):[];for(;o.length&&o.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&o.unshift(e),r.message=t;break;case"object":Object.assign(r,t);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return v(n==="string"||n==="object"),Object.assign(r,{args:o},r.opts)}function Ve(r,t,e){if(typeof t=="string"){let o=e.time?jt(Wt(e.total)):"";t=e.time?`${r}: ${o} ${t}`:`${r}: ${t}`,t=Xt(t,e.color,e.background)}return t}function Oe({image:r,message:t="",scale:e=1}){return console.warn("removed"),p}function We({image:r,message:t="",scale:e=1}){if(typeof r=="string"){let n=new Image;return n.onload=()=>{let s=nt(n,t,e);console.log(...s)},n.src=r,p}let o=r.nodeName||"";if(o.toLowerCase()==="img")return console.log(...nt(r,t,e)),p;if(o.toLowerCase()==="canvas"){let n=new Image;return n.onload=()=>console.log(...nt(n,t,e)),n.src=r.toDataURL(),p}return p}function je(r){for(let t in r)for(let e in r[t])return e||"untitled";return"empty"}globalThis.probe={};var io=new w({id:"@probe.gl/log"});var l=new w({id:"luma.gl"});function R(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var A=class{constructor(t,e){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=R(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(R()-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 P=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,e="count"){return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let e of Object.values(this.stats))t(e)}getTable(){let t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(e=>this._getOrCreate(e))}_getOrCreate(t){let{name:e,type:o}=t,n=this.stats[e];return n||(t instanceof A?n=t:n=new A(e,o),this.stats[e]=n),n}};var M=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new P({id:t})),this.stats.get(t)}},B=new M;function Ye(){let r="9.0.0-beta.8",t="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()&&l.log(1,`${r} - ${t}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:l,stats:B}),r}var it=Ye();function xt(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)?r:null}function y(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number"?r:null:xt(r)}var wt={};function S(r="id"){wt[r]=wt[r]||1;let t=wt[r]++;return`${r}-${t}`}function te(r){let t=!0;for(let e in r){t=!1;break}return t}var u=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,e,o){if(!t)throw new Error("no device");this._device=t,this.props=Xe(e,o);let n=this.props.id!=="undefined"?this.props.id:S(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(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get(`${e}s Active`).decrementCount()}trackAllocatedMemory(t,e=this[Symbol.toStringTag]){let o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(t),o.get(`${e} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let e=this._device.statsManager.getStats("Resource Counts");e.get("GPU Memory").subtractCount(this.allocatedBytes),e.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${e}s Created`).incrementCount(),t.get(`${e}s Active`).incrementCount()}};c(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Xe(r,t){let e={...t};for(let o in r)r[o]!==void 0&&(e[o]=r[o]);return e}var N=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,e){let o={...e};(e.usage||0)&N.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?o.indexType="uint32":e.data instanceof Uint16Array&&(o.indexType="uint16")),super(t,o,N.defaultProps),this.usage=e.usage||0,this.indexType=o.indexType,this.updateTimestamp=t.incrementTimestamp()}readSyncWebGL(t,e){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,e,o){let n=ArrayBuffer.isView(t)?t.buffer:t,s=Math.min(t?t.byteLength:o,N.DEBUG_DATA_MAX_LENGTH);t===null?this.debugData=new ArrayBuffer(s):e===0&&o===t.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(e,e+s)}},m=N;c(m,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),c(m,"MAP_READ",1),c(m,"MAP_WRITE",2),c(m,"COPY_SRC",4),c(m,"COPY_DST",8),c(m,"INDEX",16),c(m,"VERTEX",32),c(m,"UNIFORM",64),c(m,"STORAGE",128),c(m,"INDIRECT",256),c(m,"QUERY_RESOLVE",512),c(m,"DEBUG_DATA_MAX_LENGTH",32);function at(r){let t=ee[r],e=qe(t),o=r.includes("norm"),n=!o&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:ee[r],byteLength:e,integer:n,signed:s,normalized:o}}function qe(r){return Ke[r]}var ee={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Ke={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Qe=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Ze=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function re(r){return Qe.some(t=>r.startsWith(t))}function oe(r){let t=Ze.exec(r);if(t){let[,e,o,n,s,i]=t;if(e){let a=`${n}${o}`,f=at(a);return{format:e,components:e.length,srgb:s==="-srgb",unsized:i==="-unsized",webgl:i==="-webgl",...f}}}return tr(r)}var Je={"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 tr(r){let t=Je[r];if(!t)throw new Error(`Unknown format ${r}`);return{format:t.format||"",components:t.components||t.format?.length||1,byteLength:t.bpp||1,srgb:!1,unsized:!1}}var ct=class{},ut=class{features;disabledFeatures;constructor(t=[],e){this.features=new Set(t),this.disabledFeatures=e||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures[t]&&this.features.has(t)}},St=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...St.defaultProps,...t},this.id=this.props.id||S(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=B;_lumaData={};isTextureFormatCompressed(t){return re(t)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(t){return(t instanceof Promise||typeof t=="string")&&(t={data:t}),this._createTexture(t)}createCommandEncoder(t={}){throw new Error("not implemented")}readPixelsToArrayWebGL(t,e){throw new Error("not implemented")}readPixelsToBufferWebGL(t,e){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,e){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(t){this.props.onError(t)}_getBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let e={...t};return(t.usage||0)&m.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?e.indexType="uint32":t.data instanceof Uint16Array?e.indexType="uint16":l.warn("indices buffer content must be of integer type")()),e}},x=St;c(x,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(l.get("debug")),spector:Boolean(l.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:t=>l.error(t.message)}),c(x,"VERSION",it);function C(r,t){if(!r)throw new Error(t||"luma.gl: assertion failed.")}var E=new Map,I=class{static registerDevices(t){for(let e of t)C(e.type&&e.isSupported&&e.create),E.set(e.type,e)}static getAvailableDevices(){return Array.from(E).map(t=>t.type)}static getSupportedDevices(){return Array.from(E).filter(t=>t.isSupported()).map(t=>t.type)}static setDefaultDeviceProps(t){Object.assign(x.defaultProps,t)}static async createDevice(t={}){t={...x.defaultProps,...t},t.gl&&(t.type="webgl");let e;switch(t.type){case"webgpu":if(e=E.get("webgpu"),e)return await e.create(t);break;case"webgl":if(e=E.get("webgl"),e)return await e.create(t);break;case"best-available":if(e=E.get("webgpu"),e&&e.isSupported())return await e.create(t);if(e=E.get("webgl"),e&&e.isSupported())return await e.create(t);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}};c(I,"stats",B),c(I,"log",l);var er=d()&&typeof document<"u",ft=()=>er&&document.readyState==="complete",rr={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},F=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return ft()}constructor(t){if(this.props={...rr,...t},t=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(t.canvas)typeof t.canvas=="string"?this.canvas=sr(t.canvas):this.canvas=t.canvas;else{let e=ir(t),o=nr(t?.container||null);o.insertBefore(e,o.firstChild),this.canvas=e,t?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(e=>{for(let o of e)o.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(t){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(t=t===void 0?this.props.useDevicePixels:t,!t||t<=0)?1:t===!0?typeof window<"u"&&window.devicePixelRatio||1:t}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let t=this.getDevicePixelRatio(),e=this.canvas;return e.parentElement?[e.clientWidth*t,e.clientHeight*t]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[t,e]=this.getPixelSize();return t/e}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),{clientWidth:e}=this._canvasSizeInfo;return e?t/e:1}catch{return 1}}cssToDevicePixels(t,e=!0){let o=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return ar(t,o,n,s,e)}setDevicePixelRatio(t,e={}){if(!this.htmlCanvas)return;let o="width"in e?e.width:this.htmlCanvas.clientWidth,n="height"in e?e.height:this.htmlCanvas.clientHeight;(!o||!n)&&(l.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,o=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==o||s.clientHeight!==n||s.devicePixelRatio!==t){let i=t,a=Math.floor(o*i),f=Math.floor(n*i);this.htmlCanvas.width=a,this.htmlCanvas.height=f;let[g,b]=this.getDrawingBufferSize();(g!==a||b!==f)&&(i=Math.min(g/o,b/n),this.htmlCanvas.width=Math.floor(o*i),this.htmlCanvas.height=Math.floor(n*i),l.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=o,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=t}}getDrawingBufferSize(){let t=this.device.gl;if(!t)throw new Error("canvas size");return[t.drawingBufferWidth,t.drawingBufferHeight]}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}};c(F,"pageLoaded",or());function or(){return ft()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function nr(r){if(typeof r=="string"){let t=document.getElementById(r);if(!t&&!ft())throw new Error(`Accessing '${r}' before page was loaded`);if(!t)throw new Error(`${r} is not an HTML element`);return t}else if(r)return r;return document.body}function sr(r){let t=document.getElementById(r);if(!t&&!ft())throw new Error(`Accessing '${r}' before page was loaded`);if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function ir(r){let{width:t,height:e}=r,o=document.createElement("canvas");return o.id="lumagl-auto-created-canvas",o.width=t||1,o.height=e||1,o.style.width=Number.isFinite(t)?`${t}px`:"100%",o.style.height=Number.isFinite(e)?`${e}px`:"100%",o}function ar(r,t,e,o,n){let s=r,i=ne(s[0],t,e),a=se(s[1],t,o,n),f=ne(s[0]+1,t,e),g=f===e-1?f:f-1;f=se(s[1]+1,t,o,n);let b;return n?(f=f===0?f:f+1,b=a,a=f):b=f===o-1?f:f-1,{x:i,y:a,width:Math.max(g-i+1,1),height:Math.max(b-a+1,1)}}function ne(r,t,e){return Math.min(Math.round(r*t),e-1)}function se(r,t,e,o){return o?Math.max(0,e-1-Math.round(r*t)):Math.min(Math.round(r*t),e-1)}var Tt=class extends u{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(t,e,o=Tt.defaultProps){super(t,e,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=t.incrementTimestamp()}},h=Tt;c(h,"defaultProps",{...u.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}),c(h,"COPY_SRC",1),c(h,"COPY_DST",2),c(h,"TEXTURE_BINDING",4),c(h,"STORAGE_BINDING",8),c(h,"RENDER_ATTACHMENT",16);var At=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(t,e){super(t,e,At.defaultProps)}},U=At;c(U,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var Et=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(t,e){super(t,e,Et.defaultProps)}},D=Et;c(D,"defaultProps",{...u.defaultProps,source:null,colorSpace:"srgb"});function lt(r,t,e){let o="",n=t.split(/\r?\n/),s=r.slice().sort((i,a)=>i.lineNum-a.lineNum);switch(e?.showSourceCode||"no"){case"all":let i=0;for(let a=1;a<=n.length;a++)for(o+=ae(n[a-1],a,e);s.length>i&&s[i].lineNum===a;){let f=s[i++];o+=ie(f,n,f.lineNum,{...e,inlineSource:!1})}return o;case"issues":case"no":for(let a of r)o+=ie(a,n,a.lineNum,{inlineSource:e?.showSourceCode!=="no"});return o}}function ie(r,t,e,o){if(o?.inlineSource){let n=cr(t,e),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
7
+ "use strict";var __exports__=(()=>{var J=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var $e=Object.prototype.hasOwnProperty;var Ie=(r,t,e)=>t in r?J(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Me=(r,t)=>{for(var e in t)J(r,e,{get:t[e],enumerable:!0})},Ne=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Re(t))!$e.call(r,n)&&n!==e&&J(r,n,{get:()=>t[n],enumerable:!(o=Le(t,n))||o.enumerable});return r};var Fe=r=>Ne(J({},"__esModule",{value:!0}),r);var c=(r,t,e)=>(Ie(r,typeof t!="symbol"?t+"":t,e),e);var vr={};Me(vr,{Buffer:()=>m,CanvasContext:()=>F,CommandBuffer:()=>Y,CommandEncoder:()=>j,ComputePass:()=>W,ComputePipeline:()=>O,Device:()=>y,DeviceFeatures:()=>at,DeviceLimits:()=>it,ExternalTexture:()=>U,Framebuffer:()=>H,QuerySet:()=>Q,RenderPass:()=>V,RenderPipeline:()=>z,Resource:()=>u,Sampler:()=>G,Shader:()=>k,StatsManager:()=>I,Texture:()=>d,TextureView:()=>D,TransformFeedback:()=>K,UniformBlock:()=>L,UniformBufferLayout:()=>C,UniformStore:()=>dt,VERSION:()=>nt,VertexArray:()=>q,assert:()=>B,cancelAnimationFrame:()=>Ce,cast:()=>be,checkProps:()=>Se,decodeShaderAttributeType:()=>ft,decodeShaderUniformType:()=>lt,decodeTextureFormat:()=>re,decodeVertexFormat:()=>X,deepEqual:()=>pt,fillArray:()=>me,formatCompilerLog:()=>ut,formatValue:()=>kt,getAttributeInfosFromLayouts:()=>It,getDataTypeFromTypedArray:()=>Dt,getScratchArray:()=>le,getScratchArrayBuffer:()=>Z,getTypedArrayFromDataType:()=>ge,getVertexFormatFromAttribute:()=>ye,glsl:()=>Er,isNumberArray:()=>g,isObjectEmpty:()=>Jt,isTypedArray:()=>yt,isUniformValue:()=>Ut,loadFile:()=>Ae,loadImage:()=>ve,loadImageBitmap:()=>Ee,loadScript:()=>_e,log:()=>l,luma:()=>A,makeRandomNumberGenerator:()=>Gt,mergeShaderLayout:()=>ue,random:()=>Pe,requestAnimationFrame:()=>Be,setPathPrefix:()=>Te,splitUniformsAndBindings:()=>xe,stubRemovedMethods:()=>we,uid:()=>w});var tt=globalThis,De=globalThis.document||{},et=globalThis.process||{},Ue=globalThis.console,Pr=globalThis.navigator||{};function Vt(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,e=r||t;return Boolean(e&&e.indexOf("Electron")>=0)}function h(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Vt()}var gt="4.0.7";function Ge(r){try{let t=window[r],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}var rt=class{constructor(t,e,o="sessionStorage"){this.storage=Ge(o),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let t={};if(this.storage){let e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}};function Ot(r){let t;return r<10?t=`${r.toFixed(2)}ms`:r<100?t=`${r.toFixed(1)}ms`:r<1e3?t=`${r.toFixed(0)}ms`:t=`${(r/1e3).toFixed(2)}s`,t}function Wt(r,t=8){let e=Math.max(t-r.length,0);return`${" ".repeat(e)}${r}`}var ot;(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"})(ot||(ot={}));var He=10;function jt(r){return typeof r!="string"?r:(r=r.toUpperCase(),ot[r]||ot.WHITE)}function Yt(r,t,e){return!h&&typeof r=="string"&&(t&&(r=`\x1B[${jt(t)}m${r}\x1B[39m`),e&&(r=`\x1B[${jt(e)+He}m${r}\x1B[49m`)),r}function Xt(r,t=["constructor"]){let e=Object.getPrototypeOf(r),o=Object.getOwnPropertyNames(e),n=r;for(let s of o){let i=n[s];typeof i=="function"&&(t.find(a=>s===a)||(n[s]=i.bind(r)))}}function R(r,t){if(!r)throw new Error(t||"Assertion failed")}function S(){let r;if(h()&&tt.performance)r=tt?.performance?.now?.();else if("hrtime"in et){let t=et?.hrtime?.();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var E={debug:h()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},ze={enabled:!0,level:0};function v(){}var qt={},Kt={once:!0},x=class{constructor({id:t}={id:""}){this.VERSION=gt,this._startTs=S(),this._deltaTs=S(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new rt(`__probe-${this.id}__`,ze),this.timeStamp(`${this.id} started`),Xt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((S()-this._startTs).toPrecision(10))}getDelta(){return Number((S()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){if(!t)throw new Error(e||"Assertion failed")}warn(t){return this._getLogFunction(0,t,E.warn,arguments,Kt)}error(t){return this._getLogFunction(0,t,E.error,arguments)}deprecated(t,e){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${e}\` instead`)}removed(t,e){return this.error(`\`${t}\` has been removed. Use \`${e}\` instead`)}probe(t,e){return this._getLogFunction(t,e,E.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,E.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,E.debug||E.info,arguments,Kt)}table(t,e,o){return e?this._getLogFunction(t,e,console.table||v,o&&[o],{tag:Oe(e)}):v}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||v)}group(t,e,o={collapsed:!1}){let n=Qt({logLevel:t,message:e,opts:o}),{collapsed:s}=o;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,e,o={}){return this.group(t,e,Object.assign({},o,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||v)}withGroup(t,e,o){this.group(t,e)();try{o()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Zt(t)}_getLogFunction(t,e,o,n,s){if(this._shouldLog(t)){s=Qt({logLevel:t,message:e,args:n,opts:s}),o=o||s.method,R(o),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=S();let i=s.tag||s.message;if(s.once&&i)if(!qt[i])qt[i]=S();else return v;return e=Ve(this.id,s.message,s),o.bind(console,e,...s.args)}return v}};x.VERSION=gt;function Zt(r){if(!r)return 0;let t;switch(typeof r){case"number":t=r;break;case"object":t=r.logLevel||r.priority||0;break;default:return 0}return R(Number.isFinite(t)&&t>=0),t}function Qt(r){let{logLevel:t,message:e}=r;r.logLevel=Zt(t);let o=r.args?Array.from(r.args):[];for(;o.length&&o.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&o.unshift(e),r.message=t;break;case"object":Object.assign(r,t);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return R(n==="string"||n==="object"),Object.assign(r,{args:o},r.opts)}function Ve(r,t,e){if(typeof t=="string"){let o=e.time?Wt(Ot(e.total)):"";t=e.time?`${r}: ${o} ${t}`:`${r}: ${t}`,t=Yt(t,e.color,e.background)}return t}function Oe(r){for(let t in r)for(let e in r[t])return e||"untitled";return"empty"}globalThis.probe={};var Zr=new x({id:"@probe.gl/log"});var l=new x({id:"luma.gl"});function $(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var T=class{constructor(t,e){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=$(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime($()-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 _=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,e="count"){return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let e of Object.values(this.stats))t(e)}getTable(){let t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(e=>this._getOrCreate(e))}_getOrCreate(t){let{name:e,type:o}=t,n=this.stats[e];return n||(t instanceof T?n=t:n=new T(e,o),this.stats[e]=n),n}};var I=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new _({id:t})),this.stats.get(t)}},P=new I;function We(){let r="9.0.2",t="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||(h()&&l.log(1,`${r} - ${t}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:l,stats:P}),r}var nt=We();function yt(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)?r:null}function g(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number"?r:null:yt(r)}var bt={};function w(r="id"){bt[r]=bt[r]||1;let t=bt[r]++;return`${r}-${t}`}function Jt(r){let t=!0;for(let e in r){t=!1;break}return t}var u=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,e,o){if(!t)throw new Error("no device");this._device=t,this.props=je(e,o);let n=this.props.id!=="undefined"?this.props.id:w(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(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get(`${e}s Active`).decrementCount()}trackAllocatedMemory(t,e=this[Symbol.toStringTag]){let o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(t),o.get(`${e} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let e=this._device.statsManager.getStats("Resource Counts");e.get("GPU Memory").subtractCount(this.allocatedBytes),e.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${e}s Created`).incrementCount(),t.get(`${e}s Active`).incrementCount()}};c(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function je(r,t){let e={...t};for(let o in r)r[o]!==void 0&&(e[o]=r[o]);return e}var M=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,e){let o={...e};(e.usage||0)&M.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?o.indexType="uint32":e.data instanceof Uint16Array&&(o.indexType="uint16")),super(t,o,M.defaultProps),this.usage=e.usage||0,this.indexType=o.indexType,this.updateTimestamp=t.incrementTimestamp()}readSyncWebGL(t,e){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,e,o){let n=ArrayBuffer.isView(t)?t.buffer:t,s=Math.min(t?t.byteLength:o,M.DEBUG_DATA_MAX_LENGTH);t===null?this.debugData=new ArrayBuffer(s):e===0&&o===t.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(e,e+s)}},m=M;c(m,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),c(m,"MAP_READ",1),c(m,"MAP_WRITE",2),c(m,"COPY_SRC",4),c(m,"COPY_DST",8),c(m,"INDEX",16),c(m,"VERTEX",32),c(m,"UNIFORM",64),c(m,"STORAGE",128),c(m,"INDIRECT",256),c(m,"QUERY_RESOLVE",512),c(m,"DEBUG_DATA_MAX_LENGTH",32);function st(r){let t=te[r],e=Ye(t),o=r.includes("norm"),n=!o&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:te[r],byteLength:e,integer:n,signed:s,normalized:o}}function Ye(r){return Xe[r]}var te={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Xe={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var qe=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Ke=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function ee(r){return qe.some(t=>r.startsWith(t))}function re(r){let t=Ke.exec(r);if(t){let[,e,o,n,s,i]=t;if(e){let a=`${n}${o}`,f=st(a);return{format:e,components:e.length,srgb:s==="-srgb",unsized:i==="-unsized",webgl:i==="-webgl",...f}}}return Ze(r)}var Qe={"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 Ze(r){let t=Qe[r];if(!t)throw new Error(`Unknown format ${r}`);return{format:t.format||"",components:t.components||t.format?.length||1,byteLength:t.bpp||1,srgb:!1,unsized:!1}}var it=class{},at=class{features;disabledFeatures;constructor(t=[],e){this.features=new Set(t),this.disabledFeatures=e||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures[t]&&this.features.has(t)}},xt=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...xt.defaultProps,...t},this.id=this.props.id||w(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=P;_lumaData={};isTextureFormatCompressed(t){return ee(t)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(t){return(t instanceof Promise||typeof t=="string")&&(t={data:t}),this._createTexture(t)}createCommandEncoder(t={}){throw new Error("not implemented")}readPixelsToArrayWebGL(t,e){throw new Error("not implemented")}readPixelsToBufferWebGL(t,e){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,e){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(t){this.props.onError(t)}_getBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let e={...t};return(t.usage||0)&m.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?e.indexType="uint32":t.data instanceof Uint16Array?e.indexType="uint16":l.warn("indices buffer content must be of integer type")()),e}},y=xt;c(y,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(l.get("debug")),spector:Boolean(l.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:t=>l.error(t.message)}),c(y,"VERSION",nt);function B(r,t){if(!r)throw new Error(t||"luma.gl: assertion failed.")}var N=new Map,A=class{static registerDevices(t){for(let e of t)B(e.type&&e.isSupported&&e.create),N.set(e.type,e)}static getAvailableDevices(){return Array.from(N).map(t=>t.type)}static getSupportedDevices(){return Array.from(N).filter(t=>t.isSupported()).map(t=>t.type)}static setDefaultDeviceProps(t){Object.assign(y.defaultProps,t)}static async attachDevice(t){let e=oe(t.devices)||N;if(t.handle instanceof WebGL2RenderingContext){let o=e.get("webgl");if(o)return await o.attach(t.handle)}if(t.handle===null){let o=e.get("unknown");if(o)return await o.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(t={}){t={...y.defaultProps,...t},t.gl&&(t.type="webgl");let e=oe(t.devices)||N;switch(t.type){case"webgpu":let o=e.get("webgpu");if(o)return await o.create(t);break;case"webgl":let n=e.get("webgl");if(n)return await n.create(t);break;case"unknown":let s=e.get("unknown");if(s)return await s.create(t);break;case"best-available":if(o=e.get("webgpu"),o?.isSupported?.())return await o.create(t);if(n=e.get("webgl"),n?.isSupported?.())return await n.create(t);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}};c(A,"defaultProps",{...y.defaultProps,type:"best-available",devices:void 0}),c(A,"stats",P),c(A,"log",l);function oe(r){if(!r||r?.length===0)return null;let t=new Map;for(let e of r)t.set(e.type,e);return t}var Je=h()&&typeof document<"u",ct=()=>Je&&document.readyState==="complete",tr={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},F=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return ct()}constructor(t){if(this.props={...tr,...t},t=this.props,!h()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(t.canvas)typeof t.canvas=="string"?this.canvas=or(t.canvas):this.canvas=t.canvas;else{let e=nr(t),o=rr(t?.container||null);o.insertBefore(e,o.firstChild),this.canvas=e,t?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(e=>{for(let o of e)o.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(t){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(t=t===void 0?this.props.useDevicePixels:t,!t||t<=0)?1:t===!0?typeof window<"u"&&window.devicePixelRatio||1:t}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let t=this.getDevicePixelRatio(),e=this.canvas;return e.parentElement?[e.clientWidth*t,e.clientHeight*t]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[t,e]=this.getPixelSize();return t/e}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),{clientWidth:e}=this._canvasSizeInfo;return e?t/e:1}catch{return 1}}cssToDevicePixels(t,e=!0){let o=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return sr(t,o,n,s,e)}setDevicePixelRatio(t,e={}){if(!this.htmlCanvas)return;let o="width"in e?e.width:this.htmlCanvas.clientWidth,n="height"in e?e.height:this.htmlCanvas.clientHeight;(!o||!n)&&(l.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,o=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==o||s.clientHeight!==n||s.devicePixelRatio!==t){let i=t,a=Math.floor(o*i),f=Math.floor(n*i);this.htmlCanvas.width=a,this.htmlCanvas.height=f;let[p,b]=this.getDrawingBufferSize();(p!==a||b!==f)&&(i=Math.min(p/o,b/n),this.htmlCanvas.width=Math.floor(o*i),this.htmlCanvas.height=Math.floor(n*i),l.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=o,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=t}}getDrawingBufferSize(){let t=this.device.gl;if(!t)throw new Error("canvas size");return[t.drawingBufferWidth,t.drawingBufferHeight]}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}};c(F,"pageLoaded",er());function er(){return ct()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function rr(r){if(typeof r=="string"){let t=document.getElementById(r);if(!t&&!ct())throw new Error(`Accessing '${r}' before page was loaded`);if(!t)throw new Error(`${r} is not an HTML element`);return t}else if(r)return r;return document.body}function or(r){let t=document.getElementById(r);if(!t&&!ct())throw new Error(`Accessing '${r}' before page was loaded`);if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function nr(r){let{width:t,height:e}=r,o=document.createElement("canvas");return o.id="lumagl-auto-created-canvas",o.width=t||1,o.height=e||1,o.style.width=Number.isFinite(t)?`${t}px`:"100%",o.style.height=Number.isFinite(e)?`${e}px`:"100%",o}function sr(r,t,e,o,n){let s=r,i=ne(s[0],t,e),a=se(s[1],t,o,n),f=ne(s[0]+1,t,e),p=f===e-1?f:f-1;f=se(s[1]+1,t,o,n);let b;return n?(f=f===0?f:f+1,b=a,a=f):b=f===o-1?f:f-1,{x:i,y:a,width:Math.max(p-i+1,1),height:Math.max(b-a+1,1)}}function ne(r,t,e){return Math.min(Math.round(r*t),e-1)}function se(r,t,e,o){return o?Math.max(0,e-1-Math.round(r*t)):Math.min(Math.round(r*t),e-1)}var wt=class extends u{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(t,e,o=wt.defaultProps){super(t,e,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=t.incrementTimestamp()}},d=wt;c(d,"defaultProps",{...u.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}),c(d,"COPY_SRC",1),c(d,"COPY_DST",2),c(d,"TEXTURE_BINDING",4),c(d,"STORAGE_BINDING",8),c(d,"RENDER_ATTACHMENT",16);var St=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(t,e){super(t,e,St.defaultProps)}},D=St;c(D,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var Tt=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(t,e){super(t,e,Tt.defaultProps)}},U=Tt;c(U,"defaultProps",{...u.defaultProps,source:null,colorSpace:"srgb"});function ut(r,t,e){let o="",n=t.split(/\r?\n/),s=r.slice().sort((i,a)=>i.lineNum-a.lineNum);switch(e?.showSourceCode||"no"){case"all":let i=0;for(let a=1;a<=n.length;a++)for(o+=ae(n[a-1],a,e);s.length>i&&s[i].lineNum===a;){let f=s[i++];o+=ie(f,n,f.lineNum,{...e,inlineSource:!1})}return o;case"issues":case"no":for(let a of r)o+=ie(a,n,a.lineNum,{inlineSource:e?.showSourceCode!=="no"});return o}}function ie(r,t,e,o){if(o?.inlineSource){let n=ir(t,e),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
8
8
  `:"";return`
9
9
  ${n}${s}${r.type.toUpperCase()}: ${r.message}
10
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 cr(r,t,e){let o="";for(let n=t-2;n<=t;n++){let s=r[n-1];s!==void 0&&(o+=ae(s,t,e))}return o}function ae(r,t,e){let o=e?.html?fr(r):r;return`${ur(String(t),4)}: ${o}${e?.html?"<br/>":`
12
- `}`}function ur(r,t){let e="";for(let o=r.length;o<t;++o)e+=" ";return e+r}function fr(r){return r.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function vt(r,t){return{name:lr(r,t),language:"glsl",version:mr(r)}}function lr(r,t="unnamed"){let o=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return o?o[1]:t}function mr(r){let t=100,e=r.match(/[^\s]+/g);if(e&&e.length>=2&&e[0]==="#version"){let o=parseInt(e[1],10);Number.isFinite(o)&&(t=o)}return t}var _t=class extends u{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(t,e){super(t,{id:dr(e),...e},_t.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(t=this.props.debug){switch(t){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let e=await this.getCompilationInfo();this.props.debug==="warnings"&&e?.length===0||this._displayShaderLog(e)}_displayShaderLog(t){if(typeof document>"u"||!document?.createElement)return;let e=vt(this.source).name,o=`${this.stage} ${e}`,n=lt(t,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 i=document.createElement("Button");i.innerHTML=`
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 ir(r,t,e){let o="";for(let n=t-2;n<=t;n++){let s=r[n-1];s!==void 0&&(o+=ae(s,t,e))}return o}function ae(r,t,e){let o=e?.html?cr(r):r;return`${ar(String(t),4)}: ${o}${e?.html?"<br/>":`
12
+ `}`}function ar(r,t){let e="";for(let o=r.length;o<t;++o)e+=" ";return e+r}function cr(r){return r.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function At(r,t){return{name:ur(r,t),language:"glsl",version:fr(r)}}function ur(r,t="unnamed"){let o=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return o?o[1]:t}function fr(r){let t=100,e=r.match(/[^\s]+/g);if(e&&e.length>=2&&e[0]==="#version"){let o=parseInt(e[1],10);Number.isFinite(o)&&(t=o)}return t}var Et=class extends u{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(t,e){super(t,{id:lr(e),...e},Et.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(t=this.props.debug){switch(t){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let e=await this.getCompilationInfo();this.props.debug==="warnings"&&e?.length===0||this._displayShaderLog(e)}_displayShaderLog(t){if(typeof document>"u"||!document?.createElement)return;let e=At(this.source).name,o=`${this.stage} ${e}`,n=ut(t,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 i=document.createElement("Button");i.innerHTML=`
13
13
  <h1>Shader Compilation Error in ${o}</h1><br /><br />
14
14
  <code style="user-select:text;"><pre>
15
15
  ${n}
16
- </pre></code>`,i.style.top="10px",i.style.left="10px",i.style.position="absolute",i.style.zIndex="9999",i.style.width="100%",i.style.textAlign="left",document.body.appendChild(i);let a=document.getElementsByClassName("luma-compiler-log-error");a[0]?.scrollIntoView&&a[0].scrollIntoView(),i.onclick=()=>{let f=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(f)}}},z=_t;c(z,"defaultProps",{...u.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function dr(r){return vt(r.source).name||r.id||S(`unnamed ${r.stage}-shader`)}var Pt=class extends u{get[Symbol.toStringTag](){return"Sampler"}constructor(t,e){super(t,e,Pt.defaultProps)}},H=Pt;c(H,"defaultProps",{...u.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 Bt=class extends u{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(t,e={}){super(t,e,Bt.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(t){let e=!t;if(t){let[o,n]=Array.isArray(t)?t:[t.width,t.height];e=e||n!==this.height||o!==this.width,this.width=o,this.height=n}e&&(l.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(e=>{if(typeof e=="string"){let o=this.createColorTexture(e);return this.attachResource(o),o.view}return e instanceof h?e.view:e});let t=this.props.depthStencilAttachment;if(t)if(typeof t=="string"){let e=this.createDepthStencilTexture(t);this.attachResource(e),this.depthStencilAttachment=e.view}else t instanceof h?this.depthStencilAttachment=t.view:this.depthStencilAttachment=t}createColorTexture(t){return this.device.createTexture({id:"color-attachment",usage:h.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}createDepthStencilTexture(t){return this.device.createTexture({id:"depth-stencil-attachment",usage:h.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}resizeAttachments(t,e){for(let o=0;o<this.colorAttachments.length;++o)if(this.colorAttachments[o]){let n=this.device._createTexture({...this.colorAttachments[o].props,width:t,height:e});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:t,height:e});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=o.view,this.attachResource(o)}}},k=Bt;c(k,"defaultProps",{...u.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Ct=class extends u{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(t,e){super(t,e,Ct.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(t){throw new Error("Use uniform blocks")}},G=Ct;c(G,"defaultProps",{...u.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 It=class extends u{get[Symbol.toStringTag](){return"RenderPass"}constructor(t,e){super(t,e,It.defaultProps)}},V=It;c(V,"defaultProps",{...u.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 Lt=class extends u{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(t,e){super(t,e,Lt.defaultProps)}},O=Lt;c(O,"defaultProps",{...u.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var $t=class extends u{get[Symbol.toStringTag](){return"ComputePass"}constructor(t,e){super(t,e,$t.defaultProps)}},W=$t;c(W,"defaultProps",{...u.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Rt=class extends u{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(t,e){super(t,e,Rt.defaultProps)}},j=Rt;c(j,"defaultProps",{...u.defaultProps,measureExecutionTime:void 0});var Mt=class extends u{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(t,e){super(t,e,Mt.defaultProps)}},Y=Mt;c(Y,"defaultProps",{...u.defaultProps});function mt(r){let[t,e]=pr[r],o=t==="i32"||t==="u32",n=t!=="u32",s=gr[t]*e,i=hr(t,e);return{dataType:t,components:e,defaultVertexFormat:i,byteLength:s,integer:o,signed:n}}function hr(r,t){let e;switch(r){case"f32":e="float32";break;case"i32":e="sint32";break;case"u32":e="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?e:`${e}x${t}`}var pr={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]},gr={f32:4,f16:2,i32:4,u32:4};function X(r){let t;r.endsWith("-webgl")&&(r.replace("-webgl",""),t=!0);let[e,o]=r.split("x"),n=e,s=o?parseInt(o):1,i=at(n),a={type:n,components:s,byteLength:i.byteLength*s,integer:i.integer,signed:i.signed,normalized:i.normalized};return t&&(a.webglOnly=!0),a}function Nt(r,t){let e={};for(let o of r.attributes)e[o.name]=yr(r,t,o.name);return e}function ce(r,t,e=16){let o=Nt(r,t),n=new Array(e).fill(null);for(let s of Object.values(o))n[s.location]=s;return n}function yr(r,t,e){let o=br(r,e),n=xr(t,e);if(!o)return null;let s=mt(o.type),i=n?.vertexFormat||s.defaultVertexFormat,a=X(i);return{attributeName:n?.attributeName||o.name,bufferName:n?.bufferName||o.name,location:o.location,shaderType:o.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:i,bufferDataType:a.type,bufferComponents:a.components,normalized:a.normalized,integer:s.integer,stepMode:n?.stepMode||o.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function br(r,t){let e=r.attributes.find(o=>o.name===t);return e||l.warn(`shader layout attribute "${t}" not present in shader`),e||null}function xr(r,t){wr(r);let e=Sr(r,t);return e||(e=Tr(r,t),e)?e:(l.warn(`layout for attribute "${t}" not present in buffer layout`),null)}function wr(r){for(let t of r)(t.attributes&&t.format||!t.attributes&&!t.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Sr(r,t){for(let e of r)if(e.format&&e.name===t)return{attributeName:e.name,bufferName:t,stepMode:e.stepMode,vertexFormat:e.format,byteOffset:0,byteStride:e.byteStride||0};return null}function Tr(r,t){for(let e of r){let o=e.byteStride;if(typeof e.byteStride!="number")for(let s of e.attributes||[]){let i=X(s.format);o+=i.byteLength}let n=e.attributes?.find(s=>s.attribute===t);if(n)return{attributeName:n.attribute,bufferName:e.name,stepMode:e.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:o}}return null}function ue(r,t){let e={...r,attributes:r.attributes.map(o=>({...o}))};for(let o of t?.attributes||[]){let n=e.attributes.find(s=>s.name===o.name);n?(n.type=o.type||n.type,n.stepMode=o.stepMode||n.stepMode):l.warn(`shader layout attribute ${o.name} not present in shader`)}return e}var Ft=class extends u{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(t,e){super(t,e,Ft.defaultProps),this.maxVertexAttributes=t.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=ce(e.renderPipeline.shaderLayout,e.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(t,e){throw new Error("constant attributes not supported")}},q=Ft;c(q,"defaultProps",{...u.defaultProps,renderPipeline:null});var Ut=class extends u{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(t,e){super(t,e,Ut.defaultProps)}},K=Ut;c(K,"defaultProps",{...u.defaultProps,layout:void 0,buffers:{}});var Dt=class extends u{get[Symbol.toStringTag](){return"QuerySet"}constructor(t,e){super(t,e,Dt.defaultProps)}},Q=Dt;c(Q,"defaultProps",{...u.defaultProps,type:void 0,count:void 0});var Ar={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 dt(r){let t=Ar[r];return C(r),t}function fe(r,t){switch(t){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var ht;function Z(r){return(!ht||ht.byteLength<r)&&(ht=new ArrayBuffer(r)),ht}function le(r,t){let e=Z(r.BYTES_PER_ELEMENT*t);return new r(e,0,t)}function me(r){let{target:t,source:e,start:o=0,count:n=1}=r,s=e.length,i=n*s,a=0;for(let f=o;a<s;a++)t[f++]=e[a];for(;a<i;)a<i-a?(t.copyWithin(o+a,o,o+a),a*=2):(t.copyWithin(o+a,o,o+i-a),a=i);return r.target}var de=1024,L=class{layout={};byteLength;constructor(t){let e=0;for(let[n,s]of Object.entries(t)){let i=dt(s),{type:a,components:f}=i;e=fe(e,f);let g=e;e+=f,this.layout[n]={type:a,size:f,offset:g}}e+=(4-e%4)%4;let o=e*4;this.byteLength=Math.max(o,de)}getData(t){let e=Math.max(this.byteLength,de),o=Z(e),n={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)};for(let[s,i]of Object.entries(t)){let a=this.layout[s];if(!a){l.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:f,size:g,offset:b}=a,Vt=n[f];if(g===1){if(typeof i!="number"&&typeof i!="boolean"){l.warn(`Supplied value for single component uniform ${s} is not a number: ${i}`)();continue}Vt[b]=Number(i)}else{let Ot=y(i);if(!Ot){l.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${i}`)();continue}Vt.set(Ot,b)}}return new Uint8Array(o)}has(t){return Boolean(this.layout[t])}get(t){return this.layout[t]}};function he(r,t,e=16){if(r!==t)return!1;let o=y(r);if(!o)return!1;let n=y(t);if(n&&o.length===n.length){for(let s=0;s<o.length;++s)if(n[s]!==o[s])return!1}return!0}function pe(r){let t=y(r);return t?t.slice():r}var $=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(t){if(this.name=t?.name,t?.name&&t?.shaderLayout){let e=t?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===t?.name);if(!e)throw new Error(t?.name);let o=e;for(let n of o.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(t){for(let[e,o]of Object.entries(t))this._setUniform(e,o),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${e}=${o}`)}setNeedsRedraw(t){this.needsRedraw=this.needsRedraw||t}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(t,e){he(this.uniforms[t],e)||(this.uniforms[t]=pe(e),this.modifiedUniforms[t]=!0,this.modified=!0)}};var pt=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(t){for(let[e,o]of Object.entries(t)){let n=e,s=new L(o.uniformTypes||{});this.uniformBufferLayouts.set(n,s);let i=new $({name:e});i.setUniforms(o.defaultUniforms||{}),this.uniformBlocks.set(n,i)}}destroy(){for(let t of this.uniformBuffers.values())t.destroy()}setUniforms(t){for(let[e,o]of Object.entries(t))this.uniformBlocks.get(e).setUniforms(o);this.updateUniformBuffers()}getUniformBufferByteLength(t){return this.uniformBufferLayouts.get(t).byteLength}getUniformBufferData(t){let e=this.uniformBlocks.get(t).getAllUniforms();return this.uniformBufferLayouts.get(t).getData(e)}createUniformBuffer(t,e,o){o&&this.setUniforms(o);let n=this.getUniformBufferByteLength(e),s=t.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:n}),i=this.getUniformBufferData(e);return s.write(i),s}getManagedUniformBuffer(t,e){if(!this.uniformBuffers.get(e)){let o=this.getUniformBufferByteLength(e),n=t.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:o});this.uniformBuffers.set(e,n)}return this.uniformBuffers.get(e)}updateUniformBuffers(){let t=!1;for(let e of this.uniformBlocks.keys()){let o=this.updateUniformBuffer(e);t||=o}return t&&l.log(3,`UniformStore.updateUniformBuffers(): ${t}`)(),t}updateUniformBuffer(t){let e=this.uniformBlocks.get(t),o=this.uniformBuffers.get(t),n=!1;if(o&&e.needsRedraw){n||=e.needsRedraw;let s=this.getUniformBufferData(t);this.uniformBuffers.get(t).write(s);let a=this.uniformBlocks.get(t).getAllUniforms();l.log(4,`Writing to uniform buffer ${String(t)}`,s,a)()}return n}};function zt(r){let t=ArrayBuffer.isView(r)?r.constructor:r;switch(t){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(t.constructor.name)}}function ge(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 ye(r,t,e){if(!t||t>4)throw new Error(`size ${t}`);let o=t,n=zt(r);if(n==="uint8"||n==="sint8"){if(o===1||o===3)throw new Error(`size: ${t}`);return e&&(n=n.replace("int","norm")),`${n}x${o}`}if(n==="uint16"||n==="sint16"){if(o===1||o===3)throw new Error(`size: ${t}`);return e&&(n=n.replace("int","norm")),`${n}x${o}`}return o===1?n:`${n}x${o}`}function be(r){return r}function Ht(r){return y(r)!==null||typeof r=="number"||typeof r=="boolean"}function xe(r){let t={bindings:{},uniforms:{}};return Object.keys(r).forEach(e=>{let o=r[e];Ht(o)?t.uniforms[e]=o:t.bindings[e]=o}),t}function Er(r,t={}){let{maxElts:e=16,size:o=1}=t,n="[";for(let i=0;i<r.length&&i<e;++i)i>0&&(n+=`,${i%o===0?" ":""}`),n+=kt(r[i],t);let s=r.length>e?"...":"]";return`${n}${s}`}function kt(r,t={}){let{isInteger:o=!1}=t;if(Array.isArray(r)||ArrayBuffer.isView(r))return Er(r,t);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 we(r,t,e,o){let n=`See luma.gl ${e} Upgrade Guide at https://luma.gl/docs/upgrade-guide`,s=Object.getPrototypeOf(r);o.forEach(i=>{s.methodName||(s[i]=()=>{throw l.removed(`Calling removed method ${t}.${i}: `,n)(),new Error(i)})})}function Se(r,t,e){let{removedProps:o={},deprecatedProps:n={},replacedProps:s={}}=e;for(let a in o)if(a in t){let g=o[a]?`${r}.${o[a]}`:"N/A";l.removed(`${r}.${a}`,g)()}for(let a in n)if(a in t){let f=n[a];l.deprecated(`${r}.${a}`,`${r}.${f}`)()}let i=null;for(let[a,f]of Object.entries(s))a in t&&(l.deprecated(`${r}.${a}`,`${r}.${f}`)(),i=i||Object.assign({},t),i[f]=t[a],delete i[a]);return i||t}var gt="";function Te(r){gt=r}async function Ae(r,t){r=r.startsWith("http")?r:gt+r;let e=t?.dataType||"text";return await(await fetch(r,t))[e]()}async function Ee(r,t){let e=new Image;return e.crossOrigin=t?.crossOrigin||"anonymous",e.src=r.startsWith("http")?r:gt+r,await e.decode(),await createImageBitmap(e)}async function ve(r,t){return await new Promise((e,o)=>{try{let n=new Image;n.onload=()=>e(n),n.onerror=()=>o(new Error(`Could not load image ${r}.`)),n.crossOrigin=t?.crossOrigin||"anonymous",n.src=r.startsWith("http")?r:gt+r}catch(n){o(n)}})}async function _e(r,t){let e=document.getElementsByTagName("head")[0];if(!e)throw new Error("loadScript");let o=document.createElement("script");return o.setAttribute("type","text/javascript"),o.setAttribute("src",r),t&&(o.id=t),new Promise((n,s)=>{o.onload=n,o.onerror=i=>s(new Error(`Unable to load script '${r}': ${i}`)),e.appendChild(o)})}function Gt(){let r=1,t=1;return()=>(r=Math.sin(t*17.23),t=Math.cos(r*27.92),vr(Math.abs(r*t)*1432.71))}function vr(r){return r-Math.floor(r)}var Pe=Gt();function yt(r,t,e){if(r===t)return!0;if(!e||!r||!t)return!1;if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let o=0;o<r.length;o++)if(!yt(r[o],t[o],e-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof r=="object"&&typeof t=="object"){let o=Object.keys(r),n=Object.keys(t);if(o.length!==n.length)return!1;for(let s of o)if(!t.hasOwnProperty(s)||!yt(r[s],t[s],e-1))return!1;return!0}return!1}function Be(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function Ce(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}var _r=r=>`${r}`;return Fe(Pr);})();
16
+ </pre></code>`,i.style.top="10px",i.style.left="10px",i.style.position="absolute",i.style.zIndex="9999",i.style.width="100%",i.style.textAlign="left",document.body.appendChild(i);let a=document.getElementsByClassName("luma-compiler-log-error");a[0]?.scrollIntoView&&a[0].scrollIntoView(),i.onclick=()=>{let f=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(f)}}},k=Et;c(k,"defaultProps",{...u.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function lr(r){return At(r.source).name||r.id||w(`unnamed ${r.stage}-shader`)}var vt=class extends u{get[Symbol.toStringTag](){return"Sampler"}constructor(t,e){super(t,e,vt.defaultProps)}},G=vt;c(G,"defaultProps",{...u.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 _t=class extends u{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(t,e={}){super(t,e,_t.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(t){let e=!t;if(t){let[o,n]=Array.isArray(t)?t:[t.width,t.height];e=e||n!==this.height||o!==this.width,this.width=o,this.height=n}e&&(l.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(e=>{if(typeof e=="string"){let o=this.createColorTexture(e);return this.attachResource(o),o.view}return e instanceof d?e.view:e});let t=this.props.depthStencilAttachment;if(t)if(typeof t=="string"){let e=this.createDepthStencilTexture(t);this.attachResource(e),this.depthStencilAttachment=e.view}else t instanceof d?this.depthStencilAttachment=t.view:this.depthStencilAttachment=t}createColorTexture(t){return this.device.createTexture({id:"color-attachment",usage:d.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}createDepthStencilTexture(t){return this.device.createTexture({id:"depth-stencil-attachment",usage:d.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}resizeAttachments(t,e){for(let o=0;o<this.colorAttachments.length;++o)if(this.colorAttachments[o]){let n=this.device._createTexture({...this.colorAttachments[o].props,width:t,height:e});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:t,height:e});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=o.view,this.attachResource(o)}}},H=_t;c(H,"defaultProps",{...u.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Pt=class extends u{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(t,e){super(t,e,Pt.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(t){throw new Error("Use uniform blocks")}},z=Pt;c(z,"defaultProps",{...u.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 Bt=class extends u{get[Symbol.toStringTag](){return"RenderPass"}constructor(t,e){super(t,e,Bt.defaultProps)}},V=Bt;c(V,"defaultProps",{...u.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 Ct=class extends u{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(t,e){super(t,e,Ct.defaultProps)}},O=Ct;c(O,"defaultProps",{...u.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Lt=class extends u{get[Symbol.toStringTag](){return"ComputePass"}constructor(t,e){super(t,e,Lt.defaultProps)}},W=Lt;c(W,"defaultProps",{...u.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Rt=class extends u{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(t,e){super(t,e,Rt.defaultProps)}},j=Rt;c(j,"defaultProps",{...u.defaultProps,measureExecutionTime:void 0});var $t=class extends u{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(t,e){super(t,e,$t.defaultProps)}},Y=$t;c(Y,"defaultProps",{...u.defaultProps});function ft(r){let[t,e]=dr[r],o=t==="i32"||t==="u32",n=t!=="u32",s=hr[t]*e,i=mr(t,e);return{dataType:t,components:e,defaultVertexFormat:i,byteLength:s,integer:o,signed:n}}function mr(r,t){let e;switch(r){case"f32":e="float32";break;case"i32":e="sint32";break;case"u32":e="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?e:`${e}x${t}`}var dr={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]},hr={f32:4,f16:2,i32:4,u32:4};function X(r){let t;r.endsWith("-webgl")&&(r.replace("-webgl",""),t=!0);let[e,o]=r.split("x"),n=e,s=o?parseInt(o):1,i=st(n),a={type:n,components:s,byteLength:i.byteLength*s,integer:i.integer,signed:i.signed,normalized:i.normalized};return t&&(a.webglOnly=!0),a}function It(r,t){let e={};for(let o of r.attributes)e[o.name]=pr(r,t,o.name);return e}function ce(r,t,e=16){let o=It(r,t),n=new Array(e).fill(null);for(let s of Object.values(o))n[s.location]=s;return n}function pr(r,t,e){let o=gr(r,e),n=yr(t,e);if(!o)return null;let s=ft(o.type),i=n?.vertexFormat||s.defaultVertexFormat,a=X(i);return{attributeName:n?.attributeName||o.name,bufferName:n?.bufferName||o.name,location:o.location,shaderType:o.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:i,bufferDataType:a.type,bufferComponents:a.components,normalized:a.normalized,integer:s.integer,stepMode:n?.stepMode||o.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function gr(r,t){let e=r.attributes.find(o=>o.name===t);return e||l.warn(`shader layout attribute "${t}" not present in shader`),e||null}function yr(r,t){br(r);let e=xr(r,t);return e||(e=wr(r,t),e)?e:(l.warn(`layout for attribute "${t}" not present in buffer layout`),null)}function br(r){for(let t of r)(t.attributes&&t.format||!t.attributes&&!t.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function xr(r,t){for(let e of r)if(e.format&&e.name===t)return{attributeName:e.name,bufferName:t,stepMode:e.stepMode,vertexFormat:e.format,byteOffset:0,byteStride:e.byteStride||0};return null}function wr(r,t){for(let e of r){let o=e.byteStride;if(typeof e.byteStride!="number")for(let s of e.attributes||[]){let i=X(s.format);o+=i.byteLength}let n=e.attributes?.find(s=>s.attribute===t);if(n)return{attributeName:n.attribute,bufferName:e.name,stepMode:e.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:o}}return null}function ue(r,t){let e={...r,attributes:r.attributes.map(o=>({...o}))};for(let o of t?.attributes||[]){let n=e.attributes.find(s=>s.name===o.name);n?(n.type=o.type||n.type,n.stepMode=o.stepMode||n.stepMode):l.warn(`shader layout attribute ${o.name} not present in shader`)}return e}var Mt=class extends u{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(t,e){super(t,e,Mt.defaultProps),this.maxVertexAttributes=t.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=ce(e.renderPipeline.shaderLayout,e.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(t,e){throw new Error("constant attributes not supported")}},q=Mt;c(q,"defaultProps",{...u.defaultProps,renderPipeline:null});var Nt=class extends u{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(t,e){super(t,e,Nt.defaultProps)}},K=Nt;c(K,"defaultProps",{...u.defaultProps,layout:void 0,buffers:{}});var Ft=class extends u{get[Symbol.toStringTag](){return"QuerySet"}constructor(t,e){super(t,e,Ft.defaultProps)}},Q=Ft;c(Q,"defaultProps",{...u.defaultProps,type:void 0,count:void 0});var Sr={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 lt(r){let t=Sr[r];return B(r),t}function fe(r,t){switch(t){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var mt;function Z(r){return(!mt||mt.byteLength<r)&&(mt=new ArrayBuffer(r)),mt}function le(r,t){let e=Z(r.BYTES_PER_ELEMENT*t);return new r(e,0,t)}function me(r){let{target:t,source:e,start:o=0,count:n=1}=r,s=e.length,i=n*s,a=0;for(let f=o;a<s;a++)t[f++]=e[a];for(;a<i;)a<i-a?(t.copyWithin(o+a,o,o+a),a*=2):(t.copyWithin(o+a,o,o+i-a),a=i);return r.target}var de=1024,C=class{layout={};byteLength;constructor(t){let e=0;for(let[n,s]of Object.entries(t)){let i=lt(s),{type:a,components:f}=i;e=fe(e,f);let p=e;e+=f,this.layout[n]={type:a,size:f,offset:p}}e+=(4-e%4)%4;let o=e*4;this.byteLength=Math.max(o,de)}getData(t){let e=Math.max(this.byteLength,de),o=Z(e),n={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)};for(let[s,i]of Object.entries(t)){let a=this.layout[s];if(!a){l.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:f,size:p,offset:b}=a,Ht=n[f];if(p===1){if(typeof i!="number"&&typeof i!="boolean"){l.warn(`Supplied value for single component uniform ${s} is not a number: ${i}`)();continue}Ht[b]=Number(i)}else{let zt=g(i);if(!zt){l.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${i}`)();continue}Ht.set(zt,b)}}return new Uint8Array(o)}has(t){return Boolean(this.layout[t])}get(t){return this.layout[t]}};function he(r,t,e=16){if(r!==t)return!1;let o=g(r);if(!o)return!1;let n=g(t);if(n&&o.length===n.length){for(let s=0;s<o.length;++s)if(n[s]!==o[s])return!1}return!0}function pe(r){let t=g(r);return t?t.slice():r}var L=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(t){if(this.name=t?.name,t?.name&&t?.shaderLayout){let e=t?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===t?.name);if(!e)throw new Error(t?.name);let o=e;for(let n of o.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(t){for(let[e,o]of Object.entries(t))this._setUniform(e,o),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${e}=${o}`)}setNeedsRedraw(t){this.needsRedraw=this.needsRedraw||t}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(t,e){he(this.uniforms[t],e)||(this.uniforms[t]=pe(e),this.modifiedUniforms[t]=!0,this.modified=!0)}};var dt=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(t){for(let[e,o]of Object.entries(t)){let n=e,s=new C(o.uniformTypes||{});this.uniformBufferLayouts.set(n,s);let i=new L({name:e});i.setUniforms(o.defaultUniforms||{}),this.uniformBlocks.set(n,i)}}destroy(){for(let t of this.uniformBuffers.values())t.destroy()}setUniforms(t){for(let[e,o]of Object.entries(t))this.uniformBlocks.get(e).setUniforms(o);this.updateUniformBuffers()}getUniformBufferByteLength(t){return this.uniformBufferLayouts.get(t).byteLength}getUniformBufferData(t){let e=this.uniformBlocks.get(t).getAllUniforms();return this.uniformBufferLayouts.get(t).getData(e)}createUniformBuffer(t,e,o){o&&this.setUniforms(o);let n=this.getUniformBufferByteLength(e),s=t.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:n}),i=this.getUniformBufferData(e);return s.write(i),s}getManagedUniformBuffer(t,e){if(!this.uniformBuffers.get(e)){let o=this.getUniformBufferByteLength(e),n=t.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:o});this.uniformBuffers.set(e,n)}return this.uniformBuffers.get(e)}updateUniformBuffers(){let t=!1;for(let e of this.uniformBlocks.keys()){let o=this.updateUniformBuffer(e);t||=o}return t&&l.log(3,`UniformStore.updateUniformBuffers(): ${t}`)(),t}updateUniformBuffer(t){let e=this.uniformBlocks.get(t),o=this.uniformBuffers.get(t),n=!1;if(o&&e.needsRedraw){n||=e.needsRedraw;let s=this.getUniformBufferData(t);this.uniformBuffers.get(t).write(s);let a=this.uniformBlocks.get(t).getAllUniforms();l.log(4,`Writing to uniform buffer ${String(t)}`,s,a)()}return n}};function Dt(r){let t=ArrayBuffer.isView(r)?r.constructor:r;switch(t){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(t.constructor.name)}}function ge(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 ye(r,t,e){if(!t||t>4)throw new Error(`size ${t}`);let o=t,n=Dt(r);if(n==="uint8"||n==="sint8"){if(o===1||o===3)throw new Error(`size: ${t}`);return e&&(n=n.replace("int","norm")),`${n}x${o}`}if(n==="uint16"||n==="sint16"){if(o===1||o===3)throw new Error(`size: ${t}`);return e&&(n=n.replace("int","norm")),`${n}x${o}`}return o===1?n:`${n}x${o}`}function be(r){return r}function Ut(r){return g(r)!==null||typeof r=="number"||typeof r=="boolean"}function xe(r){let t={bindings:{},uniforms:{}};return Object.keys(r).forEach(e=>{let o=r[e];Ut(o)?t.uniforms[e]=o:t.bindings[e]=o}),t}function Tr(r,t={}){let{maxElts:e=16,size:o=1}=t,n="[";for(let i=0;i<r.length&&i<e;++i)i>0&&(n+=`,${i%o===0?" ":""}`),n+=kt(r[i],t);let s=r.length>e?"...":"]";return`${n}${s}`}function kt(r,t={}){let{isInteger:o=!1}=t;if(Array.isArray(r)||ArrayBuffer.isView(r))return Tr(r,t);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 we(r,t,e,o){let n=`See luma.gl ${e} Upgrade Guide at https://luma.gl/docs/upgrade-guide`,s=Object.getPrototypeOf(r);o.forEach(i=>{s.methodName||(s[i]=()=>{throw l.removed(`Calling removed method ${t}.${i}: `,n)(),new Error(i)})})}function Se(r,t,e){let{removedProps:o={},deprecatedProps:n={},replacedProps:s={}}=e;for(let a in o)if(a in t){let p=o[a]?`${r}.${o[a]}`:"N/A";l.removed(`${r}.${a}`,p)()}for(let a in n)if(a in t){let f=n[a];l.deprecated(`${r}.${a}`,`${r}.${f}`)()}let i=null;for(let[a,f]of Object.entries(s))a in t&&(l.deprecated(`${r}.${a}`,`${r}.${f}`)(),i=i||Object.assign({},t),i[f]=t[a],delete i[a]);return i||t}var ht="";function Te(r){ht=r}async function Ae(r,t){r=r.startsWith("http")?r:ht+r;let e=t?.dataType||"text";return await(await fetch(r,t))[e]()}async function Ee(r,t){let e=new Image;return e.crossOrigin=t?.crossOrigin||"anonymous",e.src=r.startsWith("http")?r:ht+r,await e.decode(),await createImageBitmap(e)}async function ve(r,t){return await new Promise((e,o)=>{try{let n=new Image;n.onload=()=>e(n),n.onerror=()=>o(new Error(`Could not load image ${r}.`)),n.crossOrigin=t?.crossOrigin||"anonymous",n.src=r.startsWith("http")?r:ht+r}catch(n){o(n)}})}async function _e(r,t){let e=document.getElementsByTagName("head")[0];if(!e)throw new Error("loadScript");let o=document.createElement("script");return o.setAttribute("type","text/javascript"),o.setAttribute("src",r),t&&(o.id=t),new Promise((n,s)=>{o.onload=n,o.onerror=i=>s(new Error(`Unable to load script '${r}': ${i}`)),e.appendChild(o)})}function Gt(){let r=1,t=1;return()=>(r=Math.sin(t*17.23),t=Math.cos(r*27.92),Ar(Math.abs(r*t)*1432.71))}function Ar(r){return r-Math.floor(r)}var Pe=Gt();function pt(r,t,e){if(r===t)return!0;if(!e||!r||!t)return!1;if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let o=0;o<r.length;o++)if(!pt(r[o],t[o],e-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof r=="object"&&typeof t=="object"){let o=Object.keys(r),n=Object.keys(t);if(o.length!==n.length)return!1;for(let s of o)if(!t.hasOwnProperty(s)||!pt(r[s],t[s],e-1))return!1;return!0}return!1}function Be(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function Ce(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}var Er=r=>`${r}`;return Fe(vr);})();
17
17
  return __exports__;
18
18
  });