Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@luma.gl/core

Package Overview
Dependencies
Maintainers
8
Versions
244
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luma.gl/core - npm Package Compare versions

Comparing version 9.1.0-alpha.1 to 9.1.0-alpha.2

2

dist/dist.min.js

@@ -7,3 +7,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

else root['luma'] = factory();})(globalThis, function () {
"use strict";var __exports__=(()=>{var Q=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var fe=Object.prototype.hasOwnProperty;var le=(r,t,e)=>t in r?Q(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var me=(r,t)=>{for(var e in t)Q(r,e,{get:t[e],enumerable:!0})},he=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ce(t))!fe.call(r,o)&&o!==e&&Q(r,o,{get:()=>t[o],enumerable:!(n=ue(t,o))||n.enumerable});return r};var de=r=>he(Q({},"__esModule",{value:!0}),r);var a=(r,t,e)=>(le(r,typeof t!="symbol"?t+"":t,e),e);var tr={};me(tr,{Buffer:()=>m,CanvasContext:()=>D,CommandBuffer:()=>j,CommandEncoder:()=>O,ComputePass:()=>W,ComputePipeline:()=>V,Device:()=>b,DeviceFeatures:()=>it,DeviceLimits:()=>st,ExternalTexture:()=>U,Framebuffer:()=>z,QuerySet:()=>q,RenderPass:()=>k,RenderPipeline:()=>G,Resource:()=>u,Sampler:()=>H,Shader:()=>F,Texture:()=>h,TextureView:()=>N,TransformFeedback:()=>Z,UniformBlock:()=>P,UniformBufferLayout:()=>C,UniformStore:()=>mt,VERSION:()=>nt,VertexArray:()=>X,decodeShaderAttributeType:()=>ct,decodeShaderUniformType:()=>ft,decodeTextureFormat:()=>jt,decodeVertexFormat:()=>Y,getAttributeInfosFromLayouts:()=>Ct,getDataTypeFromTypedArray:()=>Rt,getScratchArray:()=>re,getScratchArrayBuffer:()=>K,getTypedArrayFromDataType:()=>ie,getVertexFormatFromAttribute:()=>ae,glsl:()=>Je,log:()=>f,luma:()=>T});var J=globalThis,pe=globalThis.document||{},tt=globalThis.process||{},ge=globalThis.console,rr=globalThis.navigator||{};function Dt(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 d(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Dt()}var ht="4.0.7";function be(r){try{let t=window[r],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}var et=class{constructor(t,e,n="sessionStorage"){this.storage=be(n),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 $t(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 Nt(r,t=8){let e=Math.max(t-r.length,0);return`${" ".repeat(e)}${r}`}var rt;(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"})(rt||(rt={}));var we=10;function Ut(r){return typeof r!="string"?r:(r=r.toUpperCase(),rt[r]||rt.WHITE)}function Ft(r,t,e){return!d&&typeof r=="string"&&(t&&(r=`\x1B[${Ut(t)}m${r}\x1B[39m`),e&&(r=`\x1B[${Ut(e)+we}m${r}\x1B[49m`)),r}function Ht(r,t=["constructor"]){let e=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(e),o=r;for(let s of n){let i=o[s];typeof i=="function"&&(t.find(c=>s===c)||(o[s]=i.bind(r)))}}function B(r,t){if(!r)throw new Error(t||"Assertion failed")}function w(){let r;if(d()&&J.performance)r=J?.performance?.now?.();else if("hrtime"in tt){let t=tt?.hrtime?.();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var S={debug:d()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},xe={enabled:!0,level:0};function v(){}var zt={},Gt={once:!0},y=class{constructor({id:t}={id:""}){this.VERSION=ht,this._startTs=w(),this._deltaTs=w(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new et(`__probe-${this.id}__`,xe),this.timeStamp(`${this.id} started`),Ht(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((w()-this._startTs).toPrecision(10))}getDelta(){return Number((w()-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,S.warn,arguments,Gt)}error(t){return this._getLogFunction(0,t,S.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,S.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,S.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,S.debug||S.info,arguments,Gt)}table(t,e,n){return e?this._getLogFunction(t,e,console.table||v,n&&[n],{tag:Se(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,n={collapsed:!1}){let o=kt({logLevel:t,message:e,opts:n}),{collapsed:s}=n;return o.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,e,n={}){return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||v)}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Vt(t)}_getLogFunction(t,e,n,o,s){if(this._shouldLog(t)){s=kt({logLevel:t,message:e,args:o,opts:s}),n=n||s.method,B(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=w();let i=s.tag||s.message;if(s.once&&i)if(!zt[i])zt[i]=w();else return v;return e=Te(this.id,s.message,s),n.bind(console,e,...s.args)}return v}};y.VERSION=ht;function Vt(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 B(Number.isFinite(t)&&t>=0),t}function kt(r){let{logLevel:t,message:e}=r;r.logLevel=Vt(t);let n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&n.unshift(e),r.message=t;break;case"object":Object.assign(r,t);break;default:}typeof r.message=="function"&&(r.message=r.message());let o=typeof r.message;return B(o==="string"||o==="object"),Object.assign(r,{args:n},r.opts)}function Te(r,t,e){if(typeof t=="string"){let n=e.time?Nt($t(e.total)):"";t=e.time?`${r}: ${n} ${t}`:`${r}: ${t}`,t=Ft(t,e.color,e.background)}return t}function Se(r){for(let t in r)for(let e in r[t])return e||"untitled";return"empty"}globalThis.probe={};var Lr=new y({id:"@probe.gl/log"});var f=new y({id:"luma.gl"});function M(){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 x=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=M(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(M()-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 E=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:n}=t,o=this.stats[e];return o||(t instanceof x?o=t:o=new x(e,n),this.stats[e]=o),o}};var dt=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new E({id:t})),this.stats.get(t)}},A=new dt;function ve(){let r="9.1.0-alpha.1",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()&&f.log(1,`${r} - ${t}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:f,stats:A}),r}var nt=ve();var pt={};function _(r="id"){pt[r]=pt[r]||1;let t=pt[r]++;return`${r}-${t}`}var u=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,e,n){if(!t)throw new Error("no device");this._device=t,this.props=Ee(e,n);let o=this.props.id!=="undefined"?this.props.id:_(this[Symbol.toStringTag]);this.props.id=o,this.id=o,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 n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(t),n.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()}};a(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Ee(r,t){let e={...t};for(let n in r)r[n]!==void 0&&(e[n]=r[n]);return e}var R=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,e){let n={...e};(e.usage||0)&R.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?n.indexType="uint32":e.data instanceof Uint16Array&&(n.indexType="uint16")),super(t,n,R.defaultProps),this.usage=e.usage||0,this.indexType=n.indexType,this.updateTimestamp=t.incrementTimestamp()}readSyncWebGL(t,e){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,e,n){let o=ArrayBuffer.isView(t)?t.buffer:t,s=Math.min(t?t.byteLength:n,R.DEBUG_DATA_MAX_LENGTH);o===null?this.debugData=new ArrayBuffer(s):e===0&&n===o.byteLength?this.debugData=o.slice(0,s):this.debugData=o.slice(e,e+s)}},m=R;a(m,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),a(m,"MAP_READ",1),a(m,"MAP_WRITE",2),a(m,"COPY_SRC",4),a(m,"COPY_DST",8),a(m,"INDEX",16),a(m,"VERTEX",32),a(m,"UNIFORM",64),a(m,"STORAGE",128),a(m,"INDIRECT",256),a(m,"QUERY_RESOLVE",512),a(m,"DEBUG_DATA_MAX_LENGTH",32);function ot(r){let t=Wt[r],e=Ae(t),n=r.includes("norm"),o=!n&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:Wt[r],byteLength:e,integer:o,signed:s,normalized:n}}function Ae(r){return _e[r]}var Wt={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},_e={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Le=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Ce=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function Ot(r){return Le.some(t=>r.startsWith(t))}function jt(r){let t=Ce.exec(r);if(t){let[,e,n,o,s,i]=t;if(e){let c=`${o}${n}`,l=ot(c);return{format:e,components:e.length,srgb:s==="-srgb",unsized:i==="-unsized",webgl:i==="-webgl",...l}}}return Be(r)}var Pe={"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 Be(r){let t=Pe[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 st=class{},it=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)}},gt=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...gt.defaultProps,...t},this.id=this.props.id||_(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=A;_lumaData={};isTextureFormatCompressed(t){return Ot(t)}loseDevice(){return!1}error(t){this.props.onError(t)}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(t){return 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")}resetWebGL(){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":f.warn("indices buffer content must be of integer type")()),e}},b=gt;a(b,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,onError:t=>f.error(t.message),gl:null,debug:Boolean(f.get("debug")),spector:Boolean(f.get("spector")),break:f.get("break")||[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},_factoryDestroyPolicy:"unused"}),a(b,"VERSION",nt);var I=new Map,at=class{static registerDevices(t){for(let e of t)I.set(e.type,e)}static getAvailableDevices(){return Array.from(I).map(t=>t.type)}static getSupportedDevices(){return Array.from(I).filter(t=>t.isSupported()).map(t=>t.type)}static setDefaultDeviceProps(t){Object.assign(at.defaultProps,t)}static async attachDevice(t){let e=Yt(t.devices)||I;if(t.handle instanceof WebGL2RenderingContext){let n=e.get("webgl");if(n)return await n.attach(t.handle)}if(t.handle===null){let n=e.get("unknown");if(n)return await n.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={...at.defaultProps,...t},t.gl&&(t.type="webgl");let e=Yt(t.devices)||I,n,o;switch(t.type){case"webgpu":if(n=e.get("webgpu"),n)return await n.create(t);break;case"webgl":if(o=e.get("webgl"),o)return await o.create(t);break;case"unknown":let s=e.get("unknown");if(s)return await s.create(t);break;case"best-available":if(n=e.get("webgpu"),n?.isSupported?.())return await n.create(t);if(o=e.get("webgl"),o?.isSupported?.())return await o.create(t);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(t=!0){let e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(n,o){return n==="webgl"||n==="experimental-webgl"?this.originalGetContext("webgl2",o):this.originalGetContext(n,o)}}},T=at;a(T,"defaultProps",{...b.defaultProps,type:"best-available",devices:void 0}),a(T,"stats",A),a(T,"log",f);function Yt(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 Me=d()&&typeof document<"u",ut=()=>Me&&document.readyState==="complete",Re={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},D=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return ut()}constructor(t){if(this.props={...Re,...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=$e(t.canvas):this.canvas=t.canvas;else{let e=Ne(t),n=De(t?.container||null);n.insertBefore(e,n.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 n of e)n.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 n=this.cssToDeviceRatio(),[o,s]=this.getDrawingBufferSize();return Ue(t,n,o,s,e)}setDevicePixelRatio(t,e={}){if(!this.htmlCanvas)return;let n="width"in e?e.width:this.htmlCanvas.clientWidth,o="height"in e?e.height:this.htmlCanvas.clientHeight;(!n||!o)&&(f.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,n=this.htmlCanvas.width||1,o=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==n||s.clientHeight!==o||s.devicePixelRatio!==t){let i=t,c=Math.floor(n*i),l=Math.floor(o*i);this.htmlCanvas.width=c,this.htmlCanvas.height=l;let[g,p]=this.getDrawingBufferSize();(g!==c||p!==l)&&(i=Math.min(g/n,p/o),this.htmlCanvas.width=Math.floor(n*i),this.htmlCanvas.height=Math.floor(o*i),f.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=o,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)}};a(D,"pageLoaded",Ie());function Ie(){return ut()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function De(r){if(typeof r=="string"){let t=document.getElementById(r);if(!t&&!ut())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 $e(r){let t=document.getElementById(r);if(!t&&!ut())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 Ne(r){let{width:t,height:e}=r,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=e||1,n.style.width=Number.isFinite(t)?`${t}px`:"100%",n.style.height=Number.isFinite(e)?`${e}px`:"100%",n}function Ue(r,t,e,n,o){let s=r,i=Xt(s[0],t,e),c=Zt(s[1],t,n,o),l=Xt(s[0]+1,t,e),g=l===e-1?l:l-1;l=Zt(s[1]+1,t,n,o);let p;return o?(l=l===0?l:l+1,p=c,c=l):p=l===n-1?l:l-1,{x:i,y:c,width:Math.max(g-i+1,1),height:Math.max(p-c+1,1)}}function Xt(r,t,e){return Math.min(Math.round(r*t),e-1)}function Zt(r,t,e,n){return n?Math.max(0,e-1-Math.round(r*t)):Math.min(Math.round(r*t),e-1)}var $=class extends u{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;mipLevels;updateTimestamp;static isExternalImage(t){return typeof ImageData<"u"&&t instanceof ImageData||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement}static getExternalImageSize(t){return typeof ImageData<"u"&&t instanceof ImageData||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?{width:t.width,height:t.height}:typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement?{width:t.naturalWidth,height:t.naturalHeight}:typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:null}isTextureLevelData(t){let e=t?.data;return ArrayBuffer.isView(e)}getTextureDataSize(t){if(!t||ArrayBuffer.isView(t))return null;if(Array.isArray(t))return this.getTextureDataSize(t[0]);if($.isExternalImage(t))return $.getExternalImageSize(t);if(t&&typeof t=="object"&&t.constructor===Object){let e=t;return{width:e.width,height:e.height}}throw new Error("texture size deduction failed")}getMipLevelCount(t,e){return Math.floor(Math.log2(Math.max(t,e)))+1}getCubeFaceDepth(t){switch(t){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(t)}}constructor(t,e){if(super(t,e,$.defaultProps),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.props.width===void 0||this.props.height===void 0){let n=this.getTextureDataSize(this.props.data);this.width=n?.width||1,this.height=n?.height||1}this.props.mipmaps&&this.props.mipLevels===void 0&&(this.props.mipLevels="pyramid"),this.mipLevels=this.props.mipLevels==="pyramid"?this.getMipLevelCount(this.width,this.height):this.props.mipLevels||1,this.updateTimestamp=t.incrementTimestamp()}},h=$;a(h,"COPY_SRC",1),a(h,"COPY_DST",2),a(h,"TEXTURE",4),a(h,"STORAGE",8),a(h,"RENDER_ATTACHMENT",16),a(h,"CubeFaces",["+X","-X","+Y","-Y","+Z","-Z"]),a(h,"defaultProps",{...u.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!1,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,sampler:{},view:void 0});var yt=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(t,e){super(t,e,yt.defaultProps)}},N=yt;a(N,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var bt=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(t,e){super(t,e,bt.defaultProps)}},U=bt;a(U,"defaultProps",{...u.defaultProps,source:void 0,colorSpace:"srgb"});function Kt(r,t,e){let n="",o=t.split(/\r?\n/),s=r.slice().sort((i,c)=>i.lineNum-c.lineNum);switch(e?.showSourceCode||"no"){case"all":let i=0;for(let c=1;c<=o.length;c++)for(n+=Qt(o[c-1],c,e);s.length>i&&s[i].lineNum===c;){let l=s[i++];n+=qt(l,o,l.lineNum,{...e,inlineSource:!1})}return n;case"issues":case"no":for(let c of r)n+=qt(c,o,c.lineNum,{inlineSource:e?.showSourceCode!=="no"});return n}}function qt(r,t,e,n){if(n?.inlineSource){let o=Fe(t,e),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
"use strict";var __exports__=(()=>{var Q=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var fe=Object.prototype.hasOwnProperty;var le=(r,t,e)=>t in r?Q(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var me=(r,t)=>{for(var e in t)Q(r,e,{get:t[e],enumerable:!0})},he=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ce(t))!fe.call(r,o)&&o!==e&&Q(r,o,{get:()=>t[o],enumerable:!(n=ue(t,o))||n.enumerable});return r};var de=r=>he(Q({},"__esModule",{value:!0}),r);var a=(r,t,e)=>(le(r,typeof t!="symbol"?t+"":t,e),e);var tr={};me(tr,{Buffer:()=>m,CanvasContext:()=>D,CommandBuffer:()=>j,CommandEncoder:()=>O,ComputePass:()=>W,ComputePipeline:()=>V,Device:()=>b,DeviceFeatures:()=>it,DeviceLimits:()=>st,ExternalTexture:()=>U,Framebuffer:()=>z,QuerySet:()=>q,RenderPass:()=>k,RenderPipeline:()=>G,Resource:()=>u,Sampler:()=>H,Shader:()=>F,Texture:()=>h,TextureView:()=>N,TransformFeedback:()=>Z,UniformBlock:()=>P,UniformBufferLayout:()=>C,UniformStore:()=>mt,VERSION:()=>nt,VertexArray:()=>X,decodeShaderAttributeType:()=>ct,decodeShaderUniformType:()=>ft,decodeTextureFormat:()=>jt,decodeVertexFormat:()=>Y,getAttributeInfosFromLayouts:()=>Ct,getDataTypeFromTypedArray:()=>Rt,getScratchArray:()=>re,getScratchArrayBuffer:()=>K,getTypedArrayFromDataType:()=>ie,getVertexFormatFromAttribute:()=>ae,glsl:()=>Je,log:()=>f,luma:()=>T});var J=globalThis,pe=globalThis.document||{},tt=globalThis.process||{},ge=globalThis.console,rr=globalThis.navigator||{};function Dt(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 d(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Dt()}var ht="4.0.7";function be(r){try{let t=window[r],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}var et=class{constructor(t,e,n="sessionStorage"){this.storage=be(n),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 $t(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 Nt(r,t=8){let e=Math.max(t-r.length,0);return`${" ".repeat(e)}${r}`}var rt;(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"})(rt||(rt={}));var we=10;function Ut(r){return typeof r!="string"?r:(r=r.toUpperCase(),rt[r]||rt.WHITE)}function Ft(r,t,e){return!d&&typeof r=="string"&&(t&&(r=`\x1B[${Ut(t)}m${r}\x1B[39m`),e&&(r=`\x1B[${Ut(e)+we}m${r}\x1B[49m`)),r}function Ht(r,t=["constructor"]){let e=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(e),o=r;for(let s of n){let i=o[s];typeof i=="function"&&(t.find(c=>s===c)||(o[s]=i.bind(r)))}}function B(r,t){if(!r)throw new Error(t||"Assertion failed")}function w(){let r;if(d()&&J.performance)r=J?.performance?.now?.();else if("hrtime"in tt){let t=tt?.hrtime?.();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var S={debug:d()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},xe={enabled:!0,level:0};function v(){}var zt={},Gt={once:!0},y=class{constructor({id:t}={id:""}){this.VERSION=ht,this._startTs=w(),this._deltaTs=w(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new et(`__probe-${this.id}__`,xe),this.timeStamp(`${this.id} started`),Ht(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((w()-this._startTs).toPrecision(10))}getDelta(){return Number((w()-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,S.warn,arguments,Gt)}error(t){return this._getLogFunction(0,t,S.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,S.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,S.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,S.debug||S.info,arguments,Gt)}table(t,e,n){return e?this._getLogFunction(t,e,console.table||v,n&&[n],{tag:Se(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,n={collapsed:!1}){let o=kt({logLevel:t,message:e,opts:n}),{collapsed:s}=n;return o.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,e,n={}){return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||v)}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Vt(t)}_getLogFunction(t,e,n,o,s){if(this._shouldLog(t)){s=kt({logLevel:t,message:e,args:o,opts:s}),n=n||s.method,B(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=w();let i=s.tag||s.message;if(s.once&&i)if(!zt[i])zt[i]=w();else return v;return e=Te(this.id,s.message,s),n.bind(console,e,...s.args)}return v}};y.VERSION=ht;function Vt(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 B(Number.isFinite(t)&&t>=0),t}function kt(r){let{logLevel:t,message:e}=r;r.logLevel=Vt(t);let n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&n.unshift(e),r.message=t;break;case"object":Object.assign(r,t);break;default:}typeof r.message=="function"&&(r.message=r.message());let o=typeof r.message;return B(o==="string"||o==="object"),Object.assign(r,{args:n},r.opts)}function Te(r,t,e){if(typeof t=="string"){let n=e.time?Nt($t(e.total)):"";t=e.time?`${r}: ${n} ${t}`:`${r}: ${t}`,t=Ft(t,e.color,e.background)}return t}function Se(r){for(let t in r)for(let e in r[t])return e||"untitled";return"empty"}globalThis.probe={};var Lr=new y({id:"@probe.gl/log"});var f=new y({id:"luma.gl"});function M(){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 x=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=M(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(M()-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 E=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:n}=t,o=this.stats[e];return o||(t instanceof x?o=t:o=new x(e,n),this.stats[e]=o),o}};var dt=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new E({id:t})),this.stats.get(t)}},A=new dt;function ve(){let r="9.1.0-alpha.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||(d()&&f.log(1,`${r} - ${t}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:f,stats:A}),r}var nt=ve();var pt={};function _(r="id"){pt[r]=pt[r]||1;let t=pt[r]++;return`${r}-${t}`}var u=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,e,n){if(!t)throw new Error("no device");this._device=t,this.props=Ee(e,n);let o=this.props.id!=="undefined"?this.props.id:_(this[Symbol.toStringTag]);this.props.id=o,this.id=o,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 n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(t),n.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()}};a(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Ee(r,t){let e={...t};for(let n in r)r[n]!==void 0&&(e[n]=r[n]);return e}var R=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,e){let n={...e};(e.usage||0)&R.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?n.indexType="uint32":e.data instanceof Uint16Array&&(n.indexType="uint16")),super(t,n,R.defaultProps),this.usage=e.usage||0,this.indexType=n.indexType,this.updateTimestamp=t.incrementTimestamp()}readSyncWebGL(t,e){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,e,n){let o=ArrayBuffer.isView(t)?t.buffer:t,s=Math.min(t?t.byteLength:n,R.DEBUG_DATA_MAX_LENGTH);o===null?this.debugData=new ArrayBuffer(s):e===0&&n===o.byteLength?this.debugData=o.slice(0,s):this.debugData=o.slice(e,e+s)}},m=R;a(m,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),a(m,"MAP_READ",1),a(m,"MAP_WRITE",2),a(m,"COPY_SRC",4),a(m,"COPY_DST",8),a(m,"INDEX",16),a(m,"VERTEX",32),a(m,"UNIFORM",64),a(m,"STORAGE",128),a(m,"INDIRECT",256),a(m,"QUERY_RESOLVE",512),a(m,"DEBUG_DATA_MAX_LENGTH",32);function ot(r){let t=Wt[r],e=Ae(t),n=r.includes("norm"),o=!n&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:Wt[r],byteLength:e,integer:o,signed:s,normalized:n}}function Ae(r){return _e[r]}var Wt={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},_e={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Le=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Ce=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function Ot(r){return Le.some(t=>r.startsWith(t))}function jt(r){let t=Ce.exec(r);if(t){let[,e,n,o,s,i]=t;if(e){let c=`${o}${n}`,l=ot(c);return{format:e,components:e.length,srgb:s==="-srgb",unsized:i==="-unsized",webgl:i==="-webgl",...l}}}return Be(r)}var Pe={"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 Be(r){let t=Pe[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 st=class{},it=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)}},gt=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...gt.defaultProps,...t},this.id=this.props.id||_(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=A;_lumaData={};isTextureFormatCompressed(t){return Ot(t)}loseDevice(){return!1}error(t){this.props.onError(t)}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(t){return 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")}resetWebGL(){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":f.warn("indices buffer content must be of integer type")()),e}},b=gt;a(b,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,onError:t=>f.error(t.message),gl:null,debug:Boolean(f.get("debug")),spector:Boolean(f.get("spector")),break:f.get("break")||[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},_factoryDestroyPolicy:"unused"}),a(b,"VERSION",nt);var I=new Map,at=class{static registerDevices(t){for(let e of t)I.set(e.type,e)}static getAvailableDevices(){return Array.from(I).map(t=>t.type)}static getSupportedDevices(){return Array.from(I).filter(t=>t.isSupported()).map(t=>t.type)}static setDefaultDeviceProps(t){Object.assign(at.defaultProps,t)}static async attachDevice(t){let e=Yt(t.devices)||I;if(t.handle instanceof WebGL2RenderingContext){let n=e.get("webgl");if(n)return await n.attach(t.handle)}if(t.handle===null){let n=e.get("unknown");if(n)return await n.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={...at.defaultProps,...t},t.gl&&(t.type="webgl");let e=Yt(t.devices)||I,n,o;switch(t.type){case"webgpu":if(n=e.get("webgpu"),n)return await n.create(t);break;case"webgl":if(o=e.get("webgl"),o)return await o.create(t);break;case"unknown":let s=e.get("unknown");if(s)return await s.create(t);break;case"best-available":if(n=e.get("webgpu"),n?.isSupported?.())return await n.create(t);if(o=e.get("webgl"),o?.isSupported?.())return await o.create(t);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(t=!0){let e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(n,o){return n==="webgl"||n==="experimental-webgl"?this.originalGetContext("webgl2",o):this.originalGetContext(n,o)}}},T=at;a(T,"defaultProps",{...b.defaultProps,type:"best-available",devices:void 0}),a(T,"stats",A),a(T,"log",f);function Yt(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 Me=d()&&typeof document<"u",ut=()=>Me&&document.readyState==="complete",Re={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},D=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return ut()}constructor(t){if(this.props={...Re,...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=$e(t.canvas):this.canvas=t.canvas;else{let e=Ne(t),n=De(t?.container||null);n.insertBefore(e,n.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 n of e)n.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 n=this.cssToDeviceRatio(),[o,s]=this.getDrawingBufferSize();return Ue(t,n,o,s,e)}setDevicePixelRatio(t,e={}){if(!this.htmlCanvas)return;let n="width"in e?e.width:this.htmlCanvas.clientWidth,o="height"in e?e.height:this.htmlCanvas.clientHeight;(!n||!o)&&(f.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,n=this.htmlCanvas.width||1,o=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==n||s.clientHeight!==o||s.devicePixelRatio!==t){let i=t,c=Math.floor(n*i),l=Math.floor(o*i);this.htmlCanvas.width=c,this.htmlCanvas.height=l;let[g,p]=this.getDrawingBufferSize();(g!==c||p!==l)&&(i=Math.min(g/n,p/o),this.htmlCanvas.width=Math.floor(n*i),this.htmlCanvas.height=Math.floor(o*i),f.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=o,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)}};a(D,"pageLoaded",Ie());function Ie(){return ut()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function De(r){if(typeof r=="string"){let t=document.getElementById(r);if(!t&&!ut())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 $e(r){let t=document.getElementById(r);if(!t&&!ut())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 Ne(r){let{width:t,height:e}=r,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=e||1,n.style.width=Number.isFinite(t)?`${t}px`:"100%",n.style.height=Number.isFinite(e)?`${e}px`:"100%",n}function Ue(r,t,e,n,o){let s=r,i=Xt(s[0],t,e),c=Zt(s[1],t,n,o),l=Xt(s[0]+1,t,e),g=l===e-1?l:l-1;l=Zt(s[1]+1,t,n,o);let p;return o?(l=l===0?l:l+1,p=c,c=l):p=l===n-1?l:l-1,{x:i,y:c,width:Math.max(g-i+1,1),height:Math.max(p-c+1,1)}}function Xt(r,t,e){return Math.min(Math.round(r*t),e-1)}function Zt(r,t,e,n){return n?Math.max(0,e-1-Math.round(r*t)):Math.min(Math.round(r*t),e-1)}var $=class extends u{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;mipLevels;updateTimestamp;static isExternalImage(t){return typeof ImageData<"u"&&t instanceof ImageData||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement}static getExternalImageSize(t){return typeof ImageData<"u"&&t instanceof ImageData||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?{width:t.width,height:t.height}:typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement?{width:t.naturalWidth,height:t.naturalHeight}:typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:null}isTextureLevelData(t){let e=t?.data;return ArrayBuffer.isView(e)}getTextureDataSize(t){if(!t||ArrayBuffer.isView(t))return null;if(Array.isArray(t))return this.getTextureDataSize(t[0]);if($.isExternalImage(t))return $.getExternalImageSize(t);if(t&&typeof t=="object"&&t.constructor===Object){let e=t;return{width:e.width,height:e.height}}throw new Error("texture size deduction failed")}getMipLevelCount(t,e){return Math.floor(Math.log2(Math.max(t,e)))+1}getCubeFaceDepth(t){switch(t){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(t)}}constructor(t,e){if(super(t,e,$.defaultProps),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.props.width===void 0||this.props.height===void 0){let n=this.getTextureDataSize(this.props.data);this.width=n?.width||1,this.height=n?.height||1}this.props.mipmaps&&this.props.mipLevels===void 0&&(this.props.mipLevels="pyramid"),this.mipLevels=this.props.mipLevels==="pyramid"?this.getMipLevelCount(this.width,this.height):this.props.mipLevels||1,this.updateTimestamp=t.incrementTimestamp()}},h=$;a(h,"COPY_SRC",1),a(h,"COPY_DST",2),a(h,"TEXTURE",4),a(h,"STORAGE",8),a(h,"RENDER_ATTACHMENT",16),a(h,"CubeFaces",["+X","-X","+Y","-Y","+Z","-Z"]),a(h,"defaultProps",{...u.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!1,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,sampler:{},view:void 0});var yt=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(t,e){super(t,e,yt.defaultProps)}},N=yt;a(N,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var bt=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(t,e){super(t,e,bt.defaultProps)}},U=bt;a(U,"defaultProps",{...u.defaultProps,source:void 0,colorSpace:"srgb"});function Kt(r,t,e){let n="",o=t.split(/\r?\n/),s=r.slice().sort((i,c)=>i.lineNum-c.lineNum);switch(e?.showSourceCode||"no"){case"all":let i=0;for(let c=1;c<=o.length;c++)for(n+=Qt(o[c-1],c,e);s.length>i&&s[i].lineNum===c;){let l=s[i++];n+=qt(l,o,l.lineNum,{...e,inlineSource:!1})}return n;case"issues":case"no":for(let c of r)n+=qt(c,o,c.lineNum,{inlineSource:e?.showSourceCode!=="no"});return n}}function qt(r,t,e,n){if(n?.inlineSource){let o=Fe(t,e),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
`:"";return`

@@ -10,0 +10,0 @@ ${o}${s}${r.type.toUpperCase()}: ${r.message}

@@ -53,3 +53,3 @@ export { VERSION } from "./init.js";

export type { UniformValue } from "./adapter/types/uniforms.js";
export type { NumberArray } from "./types.js";
export type { NumberArray, TypedArray, TypedArrayConstructor } from "./types.js";
export type { VertexFormat, VertexType } from "./gpu-type-utils/vertex-formats.js";

@@ -56,0 +56,0 @@ export type { ShaderDataType, ShaderAttributeType, ShaderUniformType } from "./gpu-type-utils/shader-types.js";

@@ -14,3 +14,3 @@ // luma.gl

// @ts-expect-error
const VERSION = typeof "9.1.0-alpha.1" !== 'undefined' ? "9.1.0-alpha.1" : 'running from source';
const VERSION = typeof "9.1.0-alpha.2" !== 'undefined' ? "9.1.0-alpha.2" : 'running from source';
const STARTUP_MESSAGE = 'set luma.log.level=1 (or higher) to trace rendering';

@@ -17,0 +17,0 @@ // Assign luma.log.level in console to control logging: \

@@ -1,2 +0,2 @@

import { TypedArray, NumberArray } from "../types.js";
import type { TypedArray, NumberArray } from "../types.js";
/**

@@ -3,0 +3,0 @@ * Check is an array is a typed array

{
"name": "@luma.gl/core",
"version": "9.1.0-alpha.1",
"version": "9.1.0-alpha.2",
"description": "The luma.gl core Device API",

@@ -49,3 +49,3 @@ "license": "MIT",

},
"gitHead": "bc5c11c87f1e4db857e701688ca1410d7f51fd0f"
"gitHead": "cb258afdefd2d5712d2decca35c746dd9d77a03e"
}

@@ -133,3 +133,3 @@ // luma.gl

export type {NumberArray} from './types';
export type {NumberArray, TypedArray, TypedArrayConstructor} from './types';
export type {VertexFormat, VertexType} from './gpu-type-utils/vertex-formats';

@@ -136,0 +136,0 @@ export type {

@@ -5,3 +5,3 @@ // luma.gl

import {TypedArray, NumberArray} from '../types';
import type {TypedArray, NumberArray} from '../types';

@@ -8,0 +8,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc