@luma.gl/core 9.3.0-alpha.6 → 9.3.0-alpha.9

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.
Files changed (202) hide show
  1. package/dist/adapter/canvas-surface.d.ts +1 -1
  2. package/dist/adapter/canvas-surface.d.ts.map +1 -1
  3. package/dist/adapter/device.d.ts +13 -3
  4. package/dist/adapter/device.d.ts.map +1 -1
  5. package/dist/adapter/device.js +73 -6
  6. package/dist/adapter/device.js.map +1 -1
  7. package/dist/adapter/luma.js +1 -1
  8. package/dist/adapter/resources/command-buffer.d.ts +3 -1
  9. package/dist/adapter/resources/command-buffer.d.ts.map +1 -1
  10. package/dist/adapter/resources/command-buffer.js +3 -1
  11. package/dist/adapter/resources/command-buffer.js.map +1 -1
  12. package/dist/adapter/resources/command-encoder.d.ts +3 -1
  13. package/dist/adapter/resources/command-encoder.d.ts.map +1 -1
  14. package/dist/adapter/resources/command-encoder.js +3 -1
  15. package/dist/adapter/resources/command-encoder.js.map +1 -1
  16. package/dist/adapter/resources/compute-pipeline.d.ts +2 -2
  17. package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
  18. package/dist/adapter/resources/framebuffer.d.ts +1 -1
  19. package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
  20. package/dist/adapter/resources/render-pipeline.d.ts +10 -4
  21. package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
  22. package/dist/adapter/resources/render-pipeline.js +2 -1
  23. package/dist/adapter/resources/render-pipeline.js.map +1 -1
  24. package/dist/adapter/resources/texture-view.d.ts +1 -1
  25. package/dist/adapter/resources/texture-view.d.ts.map +1 -1
  26. package/dist/adapter/resources/texture.d.ts +5 -4
  27. package/dist/adapter/resources/texture.d.ts.map +1 -1
  28. package/dist/adapter/resources/texture.js +4 -3
  29. package/dist/adapter/resources/texture.js.map +1 -1
  30. package/dist/adapter/types/attachments.d.ts +1 -1
  31. package/dist/adapter/types/attachments.d.ts.map +1 -1
  32. package/dist/adapter/types/buffer-layout.d.ts +1 -1
  33. package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
  34. package/dist/adapter/types/parameters.d.ts +3 -1
  35. package/dist/adapter/types/parameters.d.ts.map +1 -1
  36. package/dist/adapter/types/parameters.js +1 -0
  37. package/dist/adapter/types/parameters.js.map +1 -1
  38. package/dist/adapter/types/shader-layout.d.ts +10 -6
  39. package/dist/adapter/types/shader-layout.d.ts.map +1 -1
  40. package/dist/adapter/types/uniforms.d.ts +6 -0
  41. package/dist/adapter/types/uniforms.d.ts.map +1 -1
  42. package/dist/adapter-utils/bind-groups.d.ts +9 -0
  43. package/dist/adapter-utils/bind-groups.d.ts.map +1 -0
  44. package/dist/adapter-utils/bind-groups.js +41 -0
  45. package/dist/adapter-utils/bind-groups.js.map +1 -0
  46. package/dist/adapter-utils/get-attribute-from-layouts.d.ts +2 -2
  47. package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -1
  48. package/dist/adapter-utils/get-attribute-from-layouts.js +6 -6
  49. package/dist/adapter-utils/get-attribute-from-layouts.js.map +1 -1
  50. package/dist/dist.dev.js +983 -223
  51. package/dist/dist.min.js +5 -5
  52. package/dist/factories/bind-group-factory.d.ts +20 -0
  53. package/dist/factories/bind-group-factory.d.ts.map +1 -0
  54. package/dist/factories/bind-group-factory.js +79 -0
  55. package/dist/factories/bind-group-factory.js.map +1 -0
  56. package/dist/factories/core-module-state.d.ts +7 -0
  57. package/dist/factories/core-module-state.d.ts.map +1 -0
  58. package/dist/{shadertypes/data-types/shader-types.js → factories/core-module-state.js} +1 -1
  59. package/dist/factories/core-module-state.js.map +1 -0
  60. package/dist/factories/pipeline-factory.d.ts +54 -0
  61. package/dist/factories/pipeline-factory.d.ts.map +1 -0
  62. package/dist/factories/pipeline-factory.js +270 -0
  63. package/dist/factories/pipeline-factory.js.map +1 -0
  64. package/dist/factories/shader-factory.d.ts +20 -0
  65. package/dist/factories/shader-factory.d.ts.map +1 -0
  66. package/dist/factories/shader-factory.js +84 -0
  67. package/dist/factories/shader-factory.js.map +1 -0
  68. package/dist/index.cjs +942 -221
  69. package/dist/index.cjs.map +4 -4
  70. package/dist/index.d.ts +22 -14
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +13 -9
  73. package/dist/index.js.map +1 -1
  74. package/dist/portable/uniform-block.d.ts +1 -1
  75. package/dist/portable/uniform-block.d.ts.map +1 -1
  76. package/dist/portable/uniform-buffer-layout.d.ts +20 -15
  77. package/dist/portable/uniform-buffer-layout.d.ts.map +1 -1
  78. package/dist/portable/uniform-buffer-layout.js +188 -43
  79. package/dist/portable/uniform-buffer-layout.js.map +1 -1
  80. package/dist/portable/uniform-store.d.ts +5 -6
  81. package/dist/portable/uniform-store.d.ts.map +1 -1
  82. package/dist/portable/uniform-store.js +6 -3
  83. package/dist/portable/uniform-store.js.map +1 -1
  84. package/dist/shadertypes/data-types/data-type-decoder.d.ts +20 -0
  85. package/dist/shadertypes/data-types/data-type-decoder.d.ts.map +1 -0
  86. package/dist/shadertypes/data-types/data-type-decoder.js +79 -0
  87. package/dist/shadertypes/data-types/data-type-decoder.js.map +1 -0
  88. package/dist/shadertypes/data-types/data-types.d.ts +31 -12
  89. package/dist/shadertypes/data-types/data-types.d.ts.map +1 -1
  90. package/dist/{image-utils → shadertypes/image-types}/image-types.d.ts +0 -6
  91. package/dist/shadertypes/image-types/image-types.d.ts.map +1 -0
  92. package/dist/shadertypes/image-types/image-types.js.map +1 -0
  93. package/dist/shadertypes/shader-types/shader-type-decoder.d.ts +41 -0
  94. package/dist/shadertypes/shader-types/shader-type-decoder.d.ts.map +1 -0
  95. package/dist/shadertypes/{data-types/decode-shader-types.js → shader-types/shader-type-decoder.js} +32 -2
  96. package/dist/shadertypes/shader-types/shader-type-decoder.js.map +1 -0
  97. package/dist/shadertypes/shader-types/shader-types.d.ts +101 -0
  98. package/dist/shadertypes/shader-types/shader-types.d.ts.map +1 -0
  99. package/dist/shadertypes/shader-types/shader-types.js +30 -0
  100. package/dist/shadertypes/shader-types/shader-types.js.map +1 -0
  101. package/dist/shadertypes/texture-types/pixel-utils.d.ts.map +1 -0
  102. package/dist/shadertypes/texture-types/pixel-utils.js.map +1 -0
  103. package/dist/shadertypes/{textures → texture-types}/texture-format-decoder.d.ts +1 -0
  104. package/dist/shadertypes/texture-types/texture-format-decoder.d.ts.map +1 -0
  105. package/dist/shadertypes/{textures → texture-types}/texture-format-decoder.js +4 -3
  106. package/dist/shadertypes/texture-types/texture-format-decoder.js.map +1 -0
  107. package/dist/shadertypes/texture-types/texture-format-generics.d.ts +34 -0
  108. package/dist/shadertypes/texture-types/texture-format-generics.d.ts.map +1 -0
  109. package/dist/shadertypes/texture-types/texture-format-generics.js.map +1 -0
  110. package/dist/shadertypes/texture-types/texture-format-table.d.ts.map +1 -0
  111. package/dist/shadertypes/texture-types/texture-format-table.js.map +1 -0
  112. package/dist/shadertypes/{textures → texture-types}/texture-formats.d.ts +5 -1
  113. package/dist/shadertypes/texture-types/texture-formats.d.ts.map +1 -0
  114. package/dist/shadertypes/{textures → texture-types}/texture-formats.js +1 -0
  115. package/dist/shadertypes/texture-types/texture-formats.js.map +1 -0
  116. package/dist/shadertypes/{textures → texture-types}/texture-layout.d.ts +1 -1
  117. package/dist/shadertypes/texture-types/texture-layout.d.ts.map +1 -0
  118. package/dist/shadertypes/texture-types/texture-layout.js.map +1 -0
  119. package/dist/shadertypes/vertex-types/vertex-format-decoder.d.ts +24 -0
  120. package/dist/shadertypes/vertex-types/vertex-format-decoder.d.ts.map +1 -0
  121. package/dist/shadertypes/vertex-types/vertex-format-decoder.js +106 -0
  122. package/dist/shadertypes/vertex-types/vertex-format-decoder.js.map +1 -0
  123. package/dist/shadertypes/vertex-types/vertex-formats.d.ts +50 -0
  124. package/dist/shadertypes/vertex-types/vertex-formats.d.ts.map +1 -0
  125. package/dist/shadertypes/vertex-types/vertex-formats.js.map +1 -0
  126. package/package.json +2 -2
  127. package/src/adapter/canvas-surface.ts +1 -1
  128. package/src/adapter/device.ts +115 -10
  129. package/src/adapter/resources/command-buffer.ts +3 -1
  130. package/src/adapter/resources/command-encoder.ts +3 -1
  131. package/src/adapter/resources/compute-pipeline.ts +2 -2
  132. package/src/adapter/resources/framebuffer.ts +1 -1
  133. package/src/adapter/resources/render-pipeline.ts +12 -5
  134. package/src/adapter/resources/texture-view.ts +1 -1
  135. package/src/adapter/resources/texture.ts +6 -5
  136. package/src/adapter/types/attachments.ts +1 -1
  137. package/src/adapter/types/buffer-layout.ts +1 -1
  138. package/src/adapter/types/parameters.ts +4 -1
  139. package/src/adapter/types/shader-layout.ts +15 -9
  140. package/src/adapter/types/uniforms.ts +12 -0
  141. package/src/adapter-utils/bind-groups.ts +71 -0
  142. package/src/adapter-utils/get-attribute-from-layouts.ts +8 -11
  143. package/src/factories/bind-group-factory.ts +139 -0
  144. package/src/factories/core-module-state.ts +11 -0
  145. package/src/factories/pipeline-factory.ts +328 -0
  146. package/src/factories/shader-factory.ts +103 -0
  147. package/src/index.ts +47 -26
  148. package/src/portable/uniform-block.ts +1 -1
  149. package/src/portable/uniform-buffer-layout.ts +269 -62
  150. package/src/portable/uniform-store.ts +14 -11
  151. package/src/shadertypes/data-types/data-type-decoder.ts +105 -0
  152. package/src/shadertypes/data-types/data-types.ts +100 -48
  153. package/src/{image-utils → shadertypes/image-types}/image-types.ts +0 -7
  154. package/src/shadertypes/{data-types/decode-shader-types.ts → shader-types/shader-type-decoder.ts} +76 -11
  155. package/src/shadertypes/shader-types/shader-types.ts +207 -0
  156. package/src/shadertypes/{textures → texture-types}/texture-format-decoder.ts +4 -3
  157. package/src/shadertypes/{textures → texture-types}/texture-format-generics.ts +42 -48
  158. package/src/shadertypes/{textures → texture-types}/texture-formats.ts +14 -2
  159. package/src/shadertypes/vertex-types/vertex-format-decoder.ts +131 -0
  160. package/src/shadertypes/vertex-types/vertex-formats.ts +183 -0
  161. package/dist/image-utils/image-types.d.ts.map +0 -1
  162. package/dist/image-utils/image-types.js.map +0 -1
  163. package/dist/shadertypes/data-types/decode-shader-types.d.ts +0 -17
  164. package/dist/shadertypes/data-types/decode-shader-types.d.ts.map +0 -1
  165. package/dist/shadertypes/data-types/decode-shader-types.js.map +0 -1
  166. package/dist/shadertypes/data-types/shader-types.d.ts +0 -43
  167. package/dist/shadertypes/data-types/shader-types.d.ts.map +0 -1
  168. package/dist/shadertypes/data-types/shader-types.js.map +0 -1
  169. package/dist/shadertypes/textures/pixel-utils.d.ts.map +0 -1
  170. package/dist/shadertypes/textures/pixel-utils.js.map +0 -1
  171. package/dist/shadertypes/textures/texture-format-decoder.d.ts.map +0 -1
  172. package/dist/shadertypes/textures/texture-format-decoder.js.map +0 -1
  173. package/dist/shadertypes/textures/texture-format-generics.d.ts +0 -33
  174. package/dist/shadertypes/textures/texture-format-generics.d.ts.map +0 -1
  175. package/dist/shadertypes/textures/texture-format-generics.js.map +0 -1
  176. package/dist/shadertypes/textures/texture-format-table.d.ts.map +0 -1
  177. package/dist/shadertypes/textures/texture-format-table.js.map +0 -1
  178. package/dist/shadertypes/textures/texture-formats.d.ts.map +0 -1
  179. package/dist/shadertypes/textures/texture-formats.js.map +0 -1
  180. package/dist/shadertypes/textures/texture-layout.d.ts.map +0 -1
  181. package/dist/shadertypes/textures/texture-layout.js.map +0 -1
  182. package/dist/shadertypes/vertex-arrays/decode-vertex-format.d.ts +0 -18
  183. package/dist/shadertypes/vertex-arrays/decode-vertex-format.d.ts.map +0 -1
  184. package/dist/shadertypes/vertex-arrays/decode-vertex-format.js +0 -100
  185. package/dist/shadertypes/vertex-arrays/decode-vertex-format.js.map +0 -1
  186. package/dist/shadertypes/vertex-arrays/vertex-formats.d.ts +0 -27
  187. package/dist/shadertypes/vertex-arrays/vertex-formats.d.ts.map +0 -1
  188. package/dist/shadertypes/vertex-arrays/vertex-formats.js.map +0 -1
  189. package/src/shadertypes/data-types/shader-types.ts +0 -94
  190. package/src/shadertypes/vertex-arrays/decode-vertex-format.ts +0 -124
  191. package/src/shadertypes/vertex-arrays/vertex-formats.ts +0 -91
  192. /package/dist/{image-utils → shadertypes/image-types}/image-types.js +0 -0
  193. /package/dist/shadertypes/{textures → texture-types}/pixel-utils.d.ts +0 -0
  194. /package/dist/shadertypes/{textures → texture-types}/pixel-utils.js +0 -0
  195. /package/dist/shadertypes/{textures → texture-types}/texture-format-generics.js +0 -0
  196. /package/dist/shadertypes/{textures → texture-types}/texture-format-table.d.ts +0 -0
  197. /package/dist/shadertypes/{textures → texture-types}/texture-format-table.js +0 -0
  198. /package/dist/shadertypes/{textures → texture-types}/texture-layout.js +0 -0
  199. /package/dist/shadertypes/{vertex-arrays → vertex-types}/vertex-formats.js +0 -0
  200. /package/src/shadertypes/{textures → texture-types}/pixel-utils.ts +0 -0
  201. /package/src/shadertypes/{textures → texture-types}/texture-format-table.ts +0 -0
  202. /package/src/shadertypes/{textures → texture-types}/texture-layout.ts +0 -0
package/dist/dist.min.js CHANGED
@@ -4,17 +4,17 @@
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 ue=Object.defineProperty;var ar=Object.getOwnPropertyDescriptor;var cr=Object.getOwnPropertyNames;var ur=Object.prototype.hasOwnProperty;var lr=(r,e,t)=>e in r?ue(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var fr=(r,e)=>{for(var t in e)ue(r,t,{get:e[t],enumerable:!0})},dr=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of cr(e))!ur.call(r,s)&&s!==t&&ue(r,s,{get:()=>e[s],enumerable:!(i=ar(e,s))||i.enumerable});return r};var hr=r=>dr(ue({},"__esModule",{value:!0}),r);var u=(r,e,t)=>(lr(r,typeof e!="symbol"?e+"":e,t),t);var Ei={};fr(Ei,{Adapter:()=>Me,Buffer:()=>m,CanvasContext:()=>Y,CommandBuffer:()=>ie,CommandEncoder:()=>re,ComputePass:()=>te,ComputePipeline:()=>ee,Device:()=>D,DeviceFeatures:()=>Ee,DeviceLimits:()=>Se,ExternalTexture:()=>q,Fence:()=>ae,Framebuffer:()=>J,PipelineLayout:()=>ce,PresentationContext:()=>Ie,QuerySet:()=>oe,RenderPass:()=>C,RenderPipeline:()=>Z,Resource:()=>l,Sampler:()=>B,Shader:()=>K,SharedRenderPipeline:()=>ke,Texture:()=>g,TextureFormatDecoder:()=>j,TextureView:()=>X,TransformFeedback:()=>ne,UniformBlock:()=>N,UniformBufferLayout:()=>F,UniformStore:()=>Ne,VertexArray:()=>se,_getTextureFormatDefinition:()=>V,_getTextureFormatTable:()=>Te,assert:()=>De,assertDefined:()=>Be,getAttributeInfosFromLayouts:()=>mt,getAttributeShaderTypeInfo:()=>$e,getDataType:()=>ye,getDataTypeInfo:()=>z,getExternalImageSize:()=>Pe,getNormalizedDataType:()=>ge,getScratchArray:()=>Zt,getTextureImageView:()=>vt,getTypedArrayConstructor:()=>$t,getVariableShaderTypeInfo:()=>Ue,getVertexFormatFromAttribute:()=>zt,getVertexFormatInfo:()=>L,isExternalImage:()=>_e,log:()=>f,luma:()=>Vt,makeVertexFormat:()=>Ke,readPixel:()=>ir,setTextureImageData:()=>rr,textureFormatDecoder:()=>y,writePixel:()=>sr});function W(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var R=class{constructor(e,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=W(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(W()-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 O=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){let{name:t,type:i}=e,s=this.stats[t];return s||(e instanceof R?s=e:s=new R(t,i),this.stats[t]=s),s}};var mr="GPU Time and Memory",pr=["Adapter","GPU","GPU Type","GPU Backend","Frame Rate","CPU Time","GPU Time","GPU Memory","Buffer Memory","Texture Memory","Referenced Buffer Memory","Referenced Texture Memory","Swap Chain Texture"],Tt=new WeakMap,_t=new WeakMap,Ve=class{stats=new Map;getStats(e){return this.get(e)}get(e){this.stats.has(e)||this.stats.set(e,new O({id:e}));let t=this.stats.get(e);return e===mr&&gr(t,pr),t}},le=new Ve;function gr(r,e){let t=r.stats,i=!1;for(let c of e)t[c]||(r.get(c),i=!0);let s=Object.keys(t).length,n=Tt.get(r);if(!i&&n?.orderedStatNames===e&&n.statCount===s)return;let o={},a=_t.get(e);a||(a=new Set(e),_t.set(e,a));for(let c of e)t[c]&&(o[c]=t[c]);for(let[c,d]of Object.entries(t))a.has(c)||(o[c]=d);for(let c of Object.keys(t))delete t[c];Object.assign(t,o),Tt.set(r,{orderedStatNames:e,statCount:s})}var fe=globalThis,br=globalThis.document||{},de=globalThis.process||{},yr=globalThis.console,zi=globalThis.navigator||{};function Pt(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=r||e;return Boolean(t&&t.indexOf("Electron")>=0)}function w(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Pt()}var je="4.1.1";function k(r,e){if(!r)throw new Error(e||"Assertion failed")}function Qe(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return k(Number.isFinite(e)&&e>=0),e}function St(r){let{logLevel:e,message:t}=r;r.logLevel=Qe(e);let i=r.args?Array.from(r.args):[];for(;i.length&&i.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&i.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let s=typeof r.message;return k(s==="string"||s==="object"),Object.assign(r,{args:i},r.opts)}var M=()=>{},he=class{constructor({level:e=0}={}){this.userData={},this._onceCache=new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...t){return this._log("warn",0,e,t,{once:!0})}error(e,...t){return this._log("error",0,e,t)}log(e,t,...i){return this._log("log",e,t,i)}info(e,t,...i){return this._log("info",e,t,i)}once(e,t,...i){return this._log("once",e,t,i,{once:!0})}_log(e,t,i,s,n={}){let o=St({logLevel:t,message:i,args:this._buildArgs(t,i,s),opts:n});return this._createLogFunction(e,o,n)}_buildArgs(e,t,i){return[e,t,...i]}_createLogFunction(e,t,i){if(!this._shouldLog(t.logLevel))return M;let s=this._getOnceTag(i.tag??t.tag??t.message);if((i.once||t.once)&&s!==void 0){if(this._onceCache.has(s))return M;this._onceCache.add(s)}return this._emit(e,t)}_shouldLog(e){return this.getLevel()>=Qe(e)}_getOnceTag(e){if(e!==void 0)try{return typeof e=="string"?e:String(e)}catch{return}}};function wr(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var me=class{constructor(e,t,i="sessionStorage"){this.storage=wr(i),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function Et(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function Ct(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var pe;(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"})(pe||(pe={}));var vr=10;function At(r){return typeof r!="string"?r:(r=r.toUpperCase(),pe[r]||pe.WHITE)}function Rt(r,e,t){return!w&&typeof r=="string"&&(e&&(r=`\x1B[${At(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${At(t)+vr}m${r}\x1B[49m`)),r}function Mt(r,e=["constructor"]){let t=Object.getPrototypeOf(r),i=Object.getOwnPropertyNames(t),s=r;for(let n of i){let o=s[n];typeof o=="function"&&(e.find(a=>n===a)||(s[n]=o.bind(r)))}}function U(){let r;if(w()&&fe.performance)r=fe?.performance?.now?.();else if("hrtime"in de){let e=de?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var $={debug:w()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Ye={enabled:!0,level:0},T=class extends he{constructor({id:e}={id:""}){super({level:0}),this.VERSION=je,this._startTs=U(),this._deltaTs=U(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new me(`__probe-${this.id}__`,{[this.id]:Ye}),this.timeStamp(`${this.id} started`),Mt(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((U()-this._startTs).toPrecision(10))}getDelta(){return Number((U()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,t){this._updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e,...t){return this._log("warn",0,e,t,{method:$.warn,once:!0})}error(e,...t){return this._log("error",0,e,t,{method:$.error})}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t,...i){return this._log("log",e,t,i,{method:$.log,time:!0,once:!0})}log(e,t,...i){return this._log("log",e,t,i,{method:$.debug})}info(e,t,...i){return this._log("info",e,t,i,{method:console.info})}once(e,t,...i){return this._log("once",e,t,i,{method:$.debug||$.info,once:!0})}table(e,t,i){return t?this._log("table",e,t,i&&[i]||[],{method:console.table||M,tag:_r(t)}):M}time(e,t){return this._log("time",e,t,[],{method:console.time?console.time:console.info})}timeEnd(e,t){return this._log("time",e,t,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,t){return this._log("time",e,t,[],{method:console.timeStamp||M})}group(e,t,i={collapsed:!1}){let s=(i.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,t,[],{method:s})}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||M})}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,t){let i=t.method;k(i),t.total=this.getTotal(),t.delta=this.getDelta(),this._deltaTs=U();let s=Tr(this.id,t.message,t);return i.bind(console,s,...t.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(Ye),this._storage.config[this.id]}_updateConfiguration(e){let t=this._storage.config[this.id]||{...Ye};this._storage.setConfiguration({[this.id]:{...t,...e}})}};T.VERSION=je;function Tr(r,e,t){if(typeof e=="string"){let i=t.time?Ct(Et(t.total)):"";e=t.time?`${r}: ${i} ${e}`:`${r}: ${e}`,e=Rt(e,t.color,t.background)}return e}function _r(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var ps=new T({id:"@probe.gl/log"});var f=new T({id:"luma.gl"});var Xe={};function P(r="id"){Xe[r]=Xe[r]||1;let e=Xe[r]++;return`${r}-${e}`}var Pr="cpu-hotspot-profiler",Lt="GPU Resource Counts",Dt="Resource Counts",Bt="GPU Time and Memory",Sr=["Resources","Buffers","Textures","Samplers","TextureViews","Framebuffers","QuerySets","Shaders","RenderPipelines","ComputePipelines","PipelineLayouts","VertexArrays","RenderPasss","ComputePasss","CommandEncoders","CommandBuffers"],Er=["Resources","Buffers","Textures","Samplers","TextureViews","Framebuffers","QuerySets","Shaders","RenderPipelines","SharedRenderPipelines","ComputePipelines","PipelineLayouts","VertexArrays","RenderPasss","ComputePasss","CommandEncoders","CommandBuffers"],Cr=Sr.flatMap(r=>[`${r} Created`,`${r} Active`]),Ar=Er.flatMap(r=>[`${r} Created`,`${r} Active`]),It=new WeakMap,Ot=new WeakMap,l=class{toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;allocatedBytesName=null;_attachedResources=new Set;constructor(e,t,i){if(!e)throw new Error("no device");this._device=e,this.props=Rr(t,i);let s=this.props.id!=="undefined"?this.props.id:P(this[Symbol.toStringTag]);this.props.id=s,this.id=s,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyed||this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of this._attachedResources)e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyed||(this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0)}removeStats(){let e=G(this._device),t=e?S():0,i=[this._device.statsManager.getStats(Lt),this._device.statsManager.getStats(Dt)],s=Ut(this._device);for(let o of i)kt(o,s);let n=this.getStatsName();for(let o of i)o.get("Resources Active").decrementCount(),o.get(`${n}s Active`).decrementCount();e&&(e.statsBookkeepingCalls=(e.statsBookkeepingCalls||0)+1,e.statsBookkeepingTimeMs=(e.statsBookkeepingTimeMs||0)+(S()-t))}trackAllocatedMemory(e,t=this.getStatsName()){let i=G(this._device),s=i?S():0,n=this._device.statsManager.getStats(Bt);this.allocatedBytes>0&&this.allocatedBytesName&&(n.get("GPU Memory").subtractCount(this.allocatedBytes),n.get(`${this.allocatedBytesName} Memory`).subtractCount(this.allocatedBytes)),n.get("GPU Memory").addCount(e),n.get(`${t} Memory`).addCount(e),i&&(i.statsBookkeepingCalls=(i.statsBookkeepingCalls||0)+1,i.statsBookkeepingTimeMs=(i.statsBookkeepingTimeMs||0)+(S()-s)),this.allocatedBytes=e,this.allocatedBytesName=t}trackReferencedMemory(e,t=this.getStatsName()){this.trackAllocatedMemory(e,`Referenced ${t}`)}trackDeallocatedMemory(e=this.getStatsName()){if(this.allocatedBytes===0){this.allocatedBytesName=null;return}let t=G(this._device),i=t?S():0,s=this._device.statsManager.getStats(Bt);s.get("GPU Memory").subtractCount(this.allocatedBytes),s.get(`${this.allocatedBytesName||e} Memory`).subtractCount(this.allocatedBytes),t&&(t.statsBookkeepingCalls=(t.statsBookkeepingCalls||0)+1,t.statsBookkeepingTimeMs=(t.statsBookkeepingTimeMs||0)+(S()-i)),this.allocatedBytes=0,this.allocatedBytesName=null}trackDeallocatedReferencedMemory(e=this.getStatsName()){this.trackDeallocatedMemory(`Referenced ${e}`)}addStats(){let e=this.getStatsName(),t=G(this._device),i=t?S():0,s=[this._device.statsManager.getStats(Lt),this._device.statsManager.getStats(Dt)],n=Ut(this._device);for(let o of s)kt(o,n);for(let o of s)o.get("Resources Created").incrementCount(),o.get("Resources Active").incrementCount(),o.get(`${e}s Created`).incrementCount(),o.get(`${e}s Active`).incrementCount();t&&(t.statsBookkeepingCalls=(t.statsBookkeepingCalls||0)+1,t.statsBookkeepingTimeMs=(t.statsBookkeepingTimeMs||0)+(S()-i)),Mr(this._device,e)}getStatsName(){return Lr(this)}};u(l,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Rr(r,e){let t={...e};for(let i in r)r[i]!==void 0&&(t[i]=r[i]);return t}function kt(r,e){let t=r.stats,i=!1;for(let c of e)t[c]||(r.get(c),i=!0);let s=Object.keys(t).length,n=It.get(r);if(!i&&n?.orderedStatNames===e&&n.statCount===s)return;let o={},a=Ot.get(e);a||(a=new Set(e),Ot.set(e,a));for(let c of e)t[c]&&(o[c]=t[c]);for(let[c,d]of Object.entries(t))a.has(c)||(o[c]=d);for(let c of Object.keys(t))delete t[c];Object.assign(t,o),It.set(r,{orderedStatNames:e,statCount:s})}function Ut(r){return r.type==="webgl"?Ar:Cr}function G(r){let e=r.userData[Pr];return e?.enabled?e:null}function S(){return globalThis.performance?.now?.()??Date.now()}function Mr(r,e){let t=G(r);if(!(!t||!t.activeDefaultFramebufferAcquireDepth))switch(t.transientCanvasResourceCreates=(t.transientCanvasResourceCreates||0)+1,e){case"Texture":t.transientCanvasTextureCreates=(t.transientCanvasTextureCreates||0)+1;break;case"TextureView":t.transientCanvasTextureViewCreates=(t.transientCanvasTextureViewCreates||0)+1;break;case"Sampler":t.transientCanvasSamplerCreates=(t.transientCanvasSamplerCreates||0)+1;break;case"Framebuffer":t.transientCanvasFramebufferCreates=(t.transientCanvasFramebufferCreates||0)+1;break;default:break}}function Lr(r){let e=Object.getPrototypeOf(r);for(;e;){let t=Object.getPrototypeOf(e);if(!t||t===l.prototype)return Dr(e)||r[Symbol.toStringTag]||r.constructor.name;e=t}return r[Symbol.toStringTag]||r.constructor.name}function Dr(r){let e=Object.getOwnPropertyDescriptor(r,Symbol.toStringTag);return typeof e?.get=="function"?e.get.call(r):typeof e?.value=="string"?e.value:null}var H=class extends l{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let i={...t};(t.usage||0)&H.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?i.indexType="uint32":t.data instanceof Uint16Array?i.indexType="uint16":t.data instanceof Uint8Array&&(i.indexType="uint8")),delete i.data,super(e,i,H.defaultProps),this.usage=i.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}debugData=new ArrayBuffer(0);_setDebugData(e,t,i){let s=null,n;ArrayBuffer.isView(e)?(s=e,n=e.buffer):n=e;let o=Math.min(e?e.byteLength:i,H.DEBUG_DATA_MAX_LENGTH);if(n===null)this.debugData=new ArrayBuffer(o);else{let a=Math.min(s?.byteOffset||0,n.byteLength),c=Math.max(0,n.byteLength-a),d=Math.min(o,c);this.debugData=new Uint8Array(n,a,d).slice().buffer}}},m=H;u(m,"INDEX",16),u(m,"VERTEX",32),u(m,"UNIFORM",64),u(m,"STORAGE",128),u(m,"INDIRECT",256),u(m,"QUERY_RESOLVE",512),u(m,"MAP_READ",1),u(m,"MAP_WRITE",2),u(m,"COPY_SRC",4),u(m,"COPY_DST",8),u(m,"DEBUG_DATA_MAX_LENGTH",32),u(m,"defaultProps",{...l.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0});function z(r){let e=r.includes("norm"),t=!e&&!r.startsWith("float"),i=r.startsWith("s"),s=qe[r],[n,o,a]=s||["uint8 ","i32",1];return{signedType:n,primitiveType:o,byteLength:a,normalized:e,integer:t,signed:i}}function ge(r){let e=r;switch(e){case"uint8":return"unorm8";case"sint8":return"snorm8";case"uint16":return"unorm16";case"sint16":return"snorm16";default:return e}}function be(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}function ye(r){let e=ArrayBuffer.isView(r)?r.constructor:r;if(e===Uint8ClampedArray)return"uint8";let t=Object.values(qe).find(i=>e===i[4]);if(!t)throw new Error(e.name);return t[0]}function $t(r){let[,,,,e]=qe[r];return e}var qe={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]};function L(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,i]=r.split("x"),s=t,n=i?parseInt(i):1,o=z(s),a={type:s,components:n,byteLength:o.byteLength*n,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(a.webglOnly=!0),a}function Ke(r,e,t){let i=t?ge(r):r;switch(i){case"unorm8":return e===1?"unorm8":e===3?"unorm8x3-webgl":`${i}x${e}`;case"snorm8":case"uint8":case"sint8":case"uint16":case"sint16":case"unorm16":case"snorm16":case"float16":if(e===1||e===3)throw new Error(`size: ${e}`);return`${i}x${e}`;default:return e===1?i:`${i}x${e}`}}function zt(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let i=e,s=ye(r);return Ke(s,i,t)}function Ft(r){let e;switch(r.primitiveType){case"f32":e="float32";break;case"i32":e="sint32";break;case"u32":e="uint32";break;case"f16":return r.components<=2?"float16x2":"float16x4"}return r.components===1?e:`${e}x${r.components}`}var b="texture-compression-bc",h="texture-compression-astc",v="texture-compression-etc2",Br="texture-compression-etc1-webgl",xe="texture-compression-pvrtc-webgl",Je="texture-compression-atc-webgl",we="float32-renderable-webgl",Ze="float16-renderable-webgl",Ir="rgb9e5ufloat-renderable-webgl",et="snorm8-renderable-webgl",E="norm16-webgl",tt="norm16-renderable-webgl",rt="snorm16-renderable-webgl",ve="float32-filterable",Nt="float16-filterable-webgl";function V(r){let e=Wt[r];if(!e)throw new Error(`Unsupported texture format ${r}`);return e}function Te(){return Wt}var Or={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:et},rg8snorm:{render:et},"rgb8snorm-webgl":{},rgba8snorm:{render:et},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:E,render:tt},rg16unorm:{f:E,render:tt},"rgb16unorm-webgl":{f:E,render:!1},rgba16unorm:{f:E,render:tt},r16snorm:{f:E,render:rt},rg16snorm:{f:E,render:rt},"rgb16snorm-webgl":{f:E,render:!1},rgba16snorm:{f:E,render:rt},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:Ze,filter:"float16-filterable-webgl"},rg16float:{render:Ze,filter:Nt},rgba16float:{render:Ze,filter:Nt},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:we,filter:ve},rg32float:{render:!1,filter:ve},"rgb32float-webgl":{render:we,filter:ve},rgba32float:{render:we,filter:ve},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:Ir},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:we},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},rgb10a2uint:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}},kr={"bc1-rgb-unorm-webgl":{f:b},"bc1-rgb-unorm-srgb-webgl":{f:b},"bc1-rgba-unorm":{f:b},"bc1-rgba-unorm-srgb":{f:b},"bc2-rgba-unorm":{f:b},"bc2-rgba-unorm-srgb":{f:b},"bc3-rgba-unorm":{f:b},"bc3-rgba-unorm-srgb":{f:b},"bc4-r-unorm":{f:b},"bc4-r-snorm":{f:b},"bc5-rg-unorm":{f:b},"bc5-rg-snorm":{f:b},"bc6h-rgb-ufloat":{f:b},"bc6h-rgb-float":{f:b},"bc7-rgba-unorm":{f:b},"bc7-rgba-unorm-srgb":{f:b},"etc2-rgb8unorm":{f:v},"etc2-rgb8unorm-srgb":{f:v},"etc2-rgb8a1unorm":{f:v},"etc2-rgb8a1unorm-srgb":{f:v},"etc2-rgba8unorm":{f:v},"etc2-rgba8unorm-srgb":{f:v},"eac-r11unorm":{f:v},"eac-r11snorm":{f:v},"eac-rg11unorm":{f:v},"eac-rg11snorm":{f:v},"astc-4x4-unorm":{f:h},"astc-4x4-unorm-srgb":{f:h},"astc-5x4-unorm":{f:h},"astc-5x4-unorm-srgb":{f:h},"astc-5x5-unorm":{f:h},"astc-5x5-unorm-srgb":{f:h},"astc-6x5-unorm":{f:h},"astc-6x5-unorm-srgb":{f:h},"astc-6x6-unorm":{f:h},"astc-6x6-unorm-srgb":{f:h},"astc-8x5-unorm":{f:h},"astc-8x5-unorm-srgb":{f:h},"astc-8x6-unorm":{f:h},"astc-8x6-unorm-srgb":{f:h},"astc-8x8-unorm":{f:h},"astc-8x8-unorm-srgb":{f:h},"astc-10x5-unorm":{f:h},"astc-10x5-unorm-srgb":{f:h},"astc-10x6-unorm":{f:h},"astc-10x6-unorm-srgb":{f:h},"astc-10x8-unorm":{f:h},"astc-10x8-unorm-srgb":{f:h},"astc-10x10-unorm":{f:h},"astc-10x10-unorm-srgb":{f:h},"astc-12x10-unorm":{f:h},"astc-12x10-unorm-srgb":{f:h},"astc-12x12-unorm":{f:h},"astc-12x12-unorm-srgb":{f:h},"pvrtc-rgb4unorm-webgl":{f:xe},"pvrtc-rgba4unorm-webgl":{f:xe},"pvrtc-rgb2unorm-webgl":{f:xe},"pvrtc-rgba2unorm-webgl":{f:xe},"etc1-rbg-unorm-webgl":{f:Br},"atc-rgb-unorm-webgl":{f:Je},"atc-rgba-unorm-webgl":{f:Je},"atc-rgbai-unorm-webgl":{f:Je}},Wt={...Or,...kr};var Ur=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,$r=["rgb","rgba","bgra"],zr=["depth","stencil"],Fr=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],j=class{isColor(e){return $r.some(t=>e.startsWith(t))}isDepthStencil(e){return zr.some(t=>e.startsWith(t))}isCompressed(e){return Fr.some(t=>e.startsWith(t))}getInfo(e){return Gt(e)}getCapabilities(e){return Wr(e)}computeMemoryLayout(e){return Nr(e)}},y=new j;function Nr({format:r,width:e,height:t,depth:i,byteAlignment:s}){let n=y.getInfo(r),{bytesPerPixel:o,bytesPerBlock:a=o,blockWidth:c=1,blockHeight:d=1,compressed:p=!1}=n,A=p?Math.ceil(e/c):e,We=p?Math.ceil(t/d):t,nr=A*a,Ge=Math.ceil(nr/s)*s,He=We,or=Ge*He*i;return{bytesPerPixel:o,bytesPerRow:Ge,rowsPerImage:He,depthOrArrayLayers:i,bytesPerImage:Ge*He,byteLength:or}}function Wr(r){let e=V(r),t={format:r,create:e.f??!0,render:e.render??!0,filter:e.filter??!0,blend:e.blend??!0,store:e.store??!0},i=Gt(r),s=r.startsWith("depth")||r.startsWith("stencil"),n=i?.signed,o=i?.integer,a=i?.webgl,c=Boolean(i?.compressed);return t.render&&=!s&&!c,t.filter&&=!s&&!n&&!o&&!a,t}function Gt(r){let e=Gr(r);if(y.isCompressed(r)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0,e.bytesPerBlock=Vr(r);let i=Hr(r);i&&(e.blockWidth=i.blockWidth,e.blockHeight=i.blockHeight)}let t=Ur.exec(r);if(t){let[,i,s,n,o,a]=t,c=`${n}${s}`,d=z(c),p=d.byteLength*8,A=i?.length??1,We=[p,A>=2?p:0,A>=3?p:0,A>=4?p:0];e={format:r,attachment:e.attachment,dataType:d.signedType,components:A,channels:i,integer:d.integer,signed:d.signed,normalized:d.normalized,bitsPerChannel:We,bytesPerPixel:d.byteLength*A,packed:e.packed,srgb:e.srgb},a==="-webgl"&&(e.webgl=!0),o==="-srgb"&&(e.srgb=!0)}return r.endsWith("-webgl")&&(e.webgl=!0),r.endsWith("-srgb")&&(e.srgb=!0),e}function Gr(r){let e=V(r),t=e.bytesPerPixel||1,i=e.bitsPerChannel||[8,8,8,8];return delete e.bitsPerChannel,delete e.bytesPerPixel,delete e.f,delete e.render,delete e.filter,delete e.blend,delete e.store,{...e,format:r,attachment:e.attachment||"color",channels:e.channels||"r",components:e.components||e.channels?.length||1,bytesPerPixel:t,bitsPerChannel:i,dataType:e.dataType||"uint8",srgb:e.srgb??!1,packed:e.packed??!1,webgl:e.webgl??!1,integer:e.integer??!1,signed:e.signed??!1,normalized:e.normalized??!1,compressed:e.compressed??!1}}function Hr(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,i,s]=t;return{blockWidth:Number(i),blockHeight:Number(s)}}return r.startsWith("bc")||r.startsWith("etc1")||r.startsWith("etc2")||r.startsWith("eac")||r.startsWith("atc")?{blockWidth:4,blockHeight:4}:r.startsWith("pvrtc-rgb4")||r.startsWith("pvrtc-rgba4")?{blockWidth:4,blockHeight:4}:r.startsWith("pvrtc-rgb2")||r.startsWith("pvrtc-rgba2")?{blockWidth:8,blockHeight:4}:null}function Vr(r){return r.startsWith("bc1")||r.startsWith("bc4")||r.startsWith("etc1")||r.startsWith("etc2-rgb8")||r.startsWith("etc2-rgb8a1")||r.startsWith("eac-r11")||r==="atc-rgb-unorm-webgl"?8:r.startsWith("bc2")||r.startsWith("bc3")||r.startsWith("bc5")||r.startsWith("bc6h")||r.startsWith("bc7")||r.startsWith("etc2-rgba8")||r.startsWith("eac-rg11")||r.startsWith("astc")||r==="atc-rgba-unorm-webgl"||r==="atc-rgbai-unorm-webgl"?16:r.startsWith("pvrtc")?8:16}function _e(r){return typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement||typeof VideoFrame<"u"&&r instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas}function Pe(r){if(typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height};if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement)return{width:r.naturalWidth,height:r.naturalHeight};if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement)return{width:r.videoWidth,height:r.videoHeight};if(typeof VideoFrame<"u"&&r instanceof VideoFrame)return{width:r.displayWidth,height:r.displayHeight};throw new Error("Unknown image type")}var Se=class{},Ee=class{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}},it=class{get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=le;timestamp=0;_reused=!1;_moduleData={};_textureCaps={};_debugGPUTimeQuery=null;constructor(e){this.props={...it.defaultProps,...e},this.id=this.props.id||P(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(e){return L(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return y.getInfo(e)}getTextureFormatCapabilities(e){let t=this._textureCaps[e];if(!t){let i=this._getDeviceTextureFormatCapabilities(e);t=this._getDeviceSpecificTextureFormatCapabilities(i),this._textureCaps[e]=t}return t}getMipLevelCount(e,t,i=1){let s=Math.max(e,t,i);return 1+Math.floor(Math.log2(s))}isExternalImage(e){return _e(e)}getExternalImageSize(e){return Pe(e)}isTextureFormatSupported(e){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return y.isCompressed(e)}getSupportedCompressedTextureFormats(){let e=[];for(let t of Object.keys(Te()))this.isTextureFormatCompressed(t)&&this.isTextureFormatSupported(t)&&e.push(t);return e}pushDebugGroup(e){this.commandEncoder.pushDebugGroup(e)}popDebugGroup(){this.commandEncoder?.popDebugGroup()}insertDebugMarker(e){this.commandEncoder?.insertDebugMarker(e)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(e,t,...i){return this.props.onError(e,t)?()=>{}:f.error(this.type==="webgl"?"%cWebGL":"%cWebGPU","color: white; background: red; padding: 2px 6px; border-radius: 3px;",e.message,t,...i)}debug(){if(this.props.debug)debugger;else{let e=`'Type luma.log.set({debug: true}) in console to enable debug breakpoints',
8
- or create a device with the 'debug: true' prop.`;f.once(0,e)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createFence(){throw new Error("createFence() not implemented")}beginRenderPass(e){return this.commandEncoder.beginRenderPass(e)}beginComputePass(e){return this.commandEncoder.beginComputePass(e)}generateMipmapsWebGPU(e){throw new Error("not implemented")}_createSharedRenderPipelineWebGL(e){throw new Error("_createSharedRenderPipelineWebGL() not implemented")}_supportsDebugGPUTime(){return this.features.has("timestamp-query")&&Boolean(this.props.debug||this.props.debugGPUTime)}_enableDebugGPUTime(e=256){if(!this._supportsDebugGPUTime())return null;if(this._debugGPUTimeQuery)return this._debugGPUTimeQuery;try{this._debugGPUTimeQuery=this.createQuerySet({type:"timestamp",count:e}),this.commandEncoder=this.createCommandEncoder({id:this.commandEncoder.props.id,timeProfilingQuerySet:this._debugGPUTimeQuery})}catch{this._debugGPUTimeQuery=null}return this._debugGPUTimeQuery}_disableDebugGPUTime(){this._debugGPUTimeQuery&&(this.commandEncoder.getTimeProfilingQuerySet()===this._debugGPUTimeQuery&&(this.commandEncoder=this.createCommandEncoder({id:this.commandEncoder.props.id})),this._debugGPUTimeQuery.destroy(),this._debugGPUTimeQuery=null)}_isDebugGPUTimeEnabled(){return this._debugGPUTimeQuery!==null}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}getModuleData(e){return this._moduleData[e]||={},this._moduleData[e]}static _getCanvasContextProps(e){return e.createCanvasContext===!0?{}:e.createCanvasContext}_getDeviceTextureFormatCapabilities(e){let t=y.getCapabilities(e),i=n=>(typeof n=="string"?this.features.has(n):n)??!0,s=i(t.create);return{format:e,create:s,render:s&&i(t.render),filter:s&&i(t.filter),blend:s&&i(t.blend),store:s&&i(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};if((e.usage||0)&m.INDEX&&(e.indexType||(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":e.data instanceof Uint8Array&&(t.data=new Uint16Array(e.data),t.indexType="uint16")),!t.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return t}},D=it;u(D,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>{},onResize:(e,t)=>{let[i,s]=e.getDevicePixelSize();f.log(1,`${e} resized => ${i}x${s}px`)()},onPositionChange:(e,t)=>{let[i,s]=e.getPosition();f.log(1,`${e} repositioned => ${i},${s}`)()},onVisibilityChange:e=>f.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>f.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:Qr(),debugGPUTime:!1,debugShaders:f.get("debug-shaders")||void 0,debugFramebuffers:Boolean(f.get("debug-framebuffers")),debugFactories:Boolean(f.get("debug-factories")),debugWebGL:Boolean(f.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!0,_destroyShaders:!1,_cachePipelines:!0,_sharePipelines:!0,_destroyPipelines:!1,_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0});function jr(r,e){return r!=null?Boolean(r):e!==void 0?e!=="production":!1}function Qr(){return jr(f.get("debug"),Yr())}function Yr(){let r=globalThis.process;if(r?.env)return r.env.NODE_ENV}var Xr="set luma.log.level=1 (or higher) to trace rendering",Ht="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",Ae=class{stats=le;log=f;VERSION="9.3.0-alpha.6";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw f.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),f.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");f.error("This version of luma.gl has already been initialized")()}f.log(1,`${this.VERSION} - ${Xr}`)(),globalThis.luma=this}async createDevice(e={}){let t={...Ae.defaultProps,...e},i=this.selectAdapter(t.type,t.adapters);if(!i)throw new Error(Ht);return t.waitForPageLoad&&await i.pageLoaded,await i.create(t)}async attachDevice(e,t){let i=this._getTypeFromHandle(e,t.adapters),s=i&&this.selectAdapter(i,t.adapters);if(!s)throw new Error(Ht);return await s?.attach?.(e,t)}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){let t=this._getAdapterMap(e);return Array.from(t).map(([,i])=>i).filter(i=>i.isSupported?.()).map(i=>i.type)}getBestAvailableAdapterType(e=[]){let t=["webgpu","webgl","null"],i=this._getAdapterMap(e);for(let s of t)if(i.get(s)?.isSupported?.())return s;return null}selectAdapter(e,t=[]){let i=e;e==="best-available"&&(i=this.getBestAvailableAdapterType(t));let s=this._getAdapterMap(t);return i&&s.get(i)||null}enforceWebGL2(e=!0,t=[]){let s=this._getAdapterMap(t).get("webgl");s||f.warn("enforceWebGL2: webgl adapter not found")(),s?.enforceWebGL2?.(e)}setDefaultDeviceProps(e){Object.assign(Ae.defaultProps,e)}_getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let i of e)t.set(i.type,i);return t}_getTypeFromHandle(e,t=[]){return e instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&e instanceof GPUDevice||e?.queue?"webgpu":e===null?"null":(e instanceof WebGLRenderingContext?f.warn("WebGL1 is not supported",e)():f.warn("Unknown handle type",e)(),null)}},Ce=Ae;u(Ce,"defaultProps",{...D.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});var Vt=new Ce;var Me=class{get pageLoaded(){return Jr()}},qr=w()&&typeof document<"u",Kr=()=>qr&&document.readyState==="complete",Re=null;function Jr(){return Re||(Kr()||typeof window>"u"?Re=Promise.resolve():Re=new Promise(r=>window.addEventListener("load",()=>r()))),Re}var Le=class{props;_resizeObserver;_intersectionObserver;_observeDevicePixelRatioTimeout=null;_observeDevicePixelRatioMediaQuery=null;_handleDevicePixelRatioChange=()=>this._refreshDevicePixelRatio();_trackPositionInterval=null;_started=!1;get started(){return this._started}constructor(e){this.props=e}start(){if(!(this._started||!this.props.canvas)){this._started=!0,this._intersectionObserver||=new IntersectionObserver(e=>this.props.onIntersection(e)),this._resizeObserver||=new ResizeObserver(e=>this.props.onResize(e)),this._intersectionObserver.observe(this.props.canvas);try{this._resizeObserver.observe(this.props.canvas,{box:"device-pixel-content-box"})}catch{this._resizeObserver.observe(this.props.canvas,{box:"content-box"})}this._observeDevicePixelRatioTimeout=setTimeout(()=>this._refreshDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}}stop(){this._started&&(this._started=!1,this._observeDevicePixelRatioTimeout&&(clearTimeout(this._observeDevicePixelRatioTimeout),this._observeDevicePixelRatioTimeout=null),this._observeDevicePixelRatioMediaQuery&&(this._observeDevicePixelRatioMediaQuery.removeEventListener("change",this._handleDevicePixelRatioChange),this._observeDevicePixelRatioMediaQuery=null),this._trackPositionInterval&&(clearInterval(this._trackPositionInterval),this._trackPositionInterval=null),this._resizeObserver?.disconnect(),this._intersectionObserver?.disconnect())}_refreshDevicePixelRatio(){this._started&&(this.props.onDevicePixelRatioChange(),this._observeDevicePixelRatioMediaQuery?.removeEventListener("change",this._handleDevicePixelRatioChange),this._observeDevicePixelRatioMediaQuery=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this._observeDevicePixelRatioMediaQuery.addEventListener("change",this._handleDevicePixelRatioChange,{once:!0}))}_trackPosition(e=100){this._trackPositionInterval||(this._trackPositionInterval=setInterval(()=>{this._started?this.props.onPositionChange():this._trackPositionInterval&&(clearInterval(this._trackPositionInterval),this._trackPositionInterval=null)},e))}};function jt(){let r,e;return{promise:new Promise((i,s)=>{r=i,e=s}),resolve:r,reject:e}}function De(r,e){if(!r){let t=new Error(e??"luma.gl assertion failed.");throw Error.captureStackTrace?.(t,De),t}}function Be(r,e){return De(r,e),r}var Q=class{static isHTMLCanvas(e){return typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement}static isOffscreenCanvas(e){return typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=jt();_canvasObserver;_position=[0,0];destroyed=!1;_needsDrawingBufferResize=!0;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){this.props={...Q.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,w()?e.canvas?typeof e.canvas=="string"?this.canvas=ei(e.canvas):this.canvas=e.canvas:this.canvas=ti(e):this.canvas={width:e.width||1,height:e.height||1},Q.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):Q.isOffscreenCanvas(this.canvas)?(this.id=e.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=e.id||"node-canvas-context",this.type="node"),this.cssWidth=this.htmlCanvas?.clientWidth||this.canvas.width,this.cssHeight=this.htmlCanvas?.clientHeight||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],this._canvasObserver=new Le({canvas:this.htmlCanvas,trackPosition:this.props.trackPosition,onResize:t=>this._handleResize(t),onIntersection:t=>this._handleIntersection(t),onDevicePixelRatioChange:()=>this._observeDevicePixelRatio(),onPositionChange:()=>this.updatePosition()})}destroy(){this.destroyed||(this.destroyed=!0,this._stopObservers(),this.device=null)}setProps(e){return"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1,this._updateDrawingBufferSize()),this}getCurrentFramebuffer(e){return this._resizeDrawingBufferIfNeeded(),this._getCurrentFramebuffer(e)}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){let e=this.device.limits.maxTextureDimension2D;return[e,e]}setDrawingBufferSize(e,t){e=Math.floor(e),t=Math.floor(t),!(this.drawingBufferWidth===e&&this.drawingBufferHeight===t)&&(this.drawingBufferWidth=e,this.drawingBufferHeight=t,this._needsDrawingBufferResize=!0)}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(e,t=!0){let i=this.cssToDeviceRatio(),[s,n]=this.getDrawingBufferSize();return ri(e,i,s,n,t)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[e,t]=this.getDrawingBufferSize();return e>0&&t>0?e/t:1}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),[t]=this.getCSSSize();return t?e/t:1}catch{return 1}}resize(e){this.setDrawingBufferSize(e.width,e.height)}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}_startObservers(){this.destroyed||this._canvasObserver.start()}_stopObservers(){this._canvasObserver.stop()}_handleIntersection(e){if(this.destroyed)return;let t=e.find(s=>s.target===this.canvas);if(!t)return;let i=t.isIntersecting;this.isVisible!==i&&(this.isVisible=i,this.device.props.onVisibilityChange(this))}_handleResize(e){if(this.destroyed)return;let t=e.find(d=>d.target===this.canvas);if(!t)return;let i=Be(t.contentBoxSize?.[0]);this.cssWidth=i.inlineSize,this.cssHeight=i.blockSize;let s=this.getDevicePixelSize(),n=t.devicePixelContentBoxSize?.[0]?.inlineSize||i.inlineSize*devicePixelRatio,o=t.devicePixelContentBoxSize?.[0]?.blockSize||i.blockSize*devicePixelRatio,[a,c]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(n,a)),this.devicePixelHeight=Math.max(1,Math.min(o,c)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:s})}_updateDrawingBufferSize(){if(this.props.autoResize)if(typeof this.props.useDevicePixels=="number"){let e=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*e,this.cssHeight*e)}else this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight);this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition()}_resizeDrawingBufferIfNeeded(){this._needsDrawingBufferResize&&(this._needsDrawingBufferResize=!1,(this.drawingBufferWidth!==this.canvas.width||this.drawingBufferHeight!==this.canvas.height)&&(this.canvas.width=this.drawingBufferWidth,this.canvas.height=this.drawingBufferHeight,this._configureDevice()))}_observeDevicePixelRatio(){if(this.destroyed||!this._canvasObserver.started)return;let e=this.devicePixelRatio;this.devicePixelRatio=window.devicePixelRatio,this.updatePosition(),this.device.props.onDevicePixelRatioChange?.(this,{oldRatio:e})}updatePosition(){if(this.destroyed)return;let e=this.htmlCanvas?.getBoundingClientRect();if(e){let t=[e.left,e.top];if(this._position??=t,t[0]!==this._position[0]||t[1]!==this._position[1]){let s=this._position;this._position=t,this.device.props.onPositionChange?.(this,{oldPosition:s})}}}},_=Q;u(_,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1});function Zr(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e)throw new Error(`${r} is not an HTML element`);return e}return r||document.body}function ei(r){let e=document.getElementById(r);if(!_.isHTMLCanvas(e))throw new Error("Object is not a canvas element");return e}function ti(r){let{width:e,height:t}=r,i=document.createElement("canvas");i.id=P("lumagl-auto-created-canvas"),i.width=e||1,i.height=t||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(t)?`${t}px`:"100%",r?.visible||(i.style.visibility="hidden");let s=Zr(r?.container||null);return s.insertBefore(i,s.firstChild),i}function ri(r,e,t,i,s){let n=r,o=Qt(n[0],e,t),a=Yt(n[1],e,i,s),c=Qt(n[0]+1,e,t),d=c===t-1?c:c-1;c=Yt(n[1]+1,e,i,s);let p;return s?(c=c===0?c:c+1,p=a,a=c):p=c===i-1?c:c-1,{x:o,y:a,width:Math.max(d-o+1,1),height:Math.max(p-a+1,1)}}function Qt(r,e,t){return Math.min(Math.round(r*e),t-1)}function Yt(r,e,t,i){return i?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var Y=class extends _{};u(Y,"defaultProps",_.defaultProps);var Ie=class extends _{};var Oe=class extends l{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=Oe.normalizeProps(e,t),super(e,t,Oe.defaultProps)}static normalizeProps(e,t){return t}},B=Oe;u(B,"defaultProps",{...l.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var ii={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},x=class extends l{dimension;baseDimension;format;width;height;depth;mipLevels;samples;byteAlignment;ready=Promise.resolve(this);isReady=!0;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(e,t,i){if(t=x.normalizeProps(e,t),super(e,t,x.defaultProps),this.dimension=this.props.dimension,this.baseDimension=ii[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.samples=this.props.samples||1,this.dimension==="cube"&&(this.depth=6),this.props.width===void 0||this.props.height===void 0)if(e.isExternalImage(t.data)){let s=e.getExternalImageSize(t.data);this.width=s?.width||1,this.height=s?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&f.warn(`${this} created with undefined width or height. This is deprecated. Use DynamicTexture instead.`)();this.byteAlignment=i?.byteAlignment||1,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createTexture({...this.props,...e})}setSampler(e){this.sampler=e instanceof B?e:this.device.createSampler(e)}copyImageData(e){let{data:t,depth:i,...s}=e;this.writeData(t,{...s,depthOrArrayLayers:s.depthOrArrayLayers??i})}computeMemoryLayout(e={}){let t=this._normalizeTextureReadOptions(e),{width:i=this.width,height:s=this.height,depthOrArrayLayers:n=this.depth}=t,{format:o,byteAlignment:a}=this;return y.computeMemoryLayout({format:o,width:i,height:s,depth:n,byteAlignment:a})}readBuffer(e,t){throw new Error("readBuffer not implemented")}readDataAsync(e){throw new Error("readBuffer not implemented")}writeBuffer(e,t){throw new Error("readBuffer not implemented")}writeData(e,t){throw new Error("readBuffer not implemented")}readDataSyncWebGL(e){throw new Error("readDataSyncWebGL not available")}generateMipmapsWebGL(){throw new Error("generateMipmapsWebGL not available")}static normalizeProps(e,t){let i={...t},{width:s,height:n}=i;return typeof s=="number"&&(i.width=Math.max(1,Math.ceil(s))),typeof n=="number"&&(i.height=Math.max(1,Math.ceil(n))),i}_initializeData(e){this.device.isExternalImage(e)?this.copyExternalImage({image:e,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):e&&this.copyImageData({data:e,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(e){let{data:t,depth:i,...s}=e,n=this._normalizeTextureWriteOptions({...s,depthOrArrayLayers:s.depthOrArrayLayers??i});return{data:t,depth:n.depthOrArrayLayers,...n}}_normalizeCopyExternalImageOptions(e){let t=x._omitUndefined(e),i=t.mipLevel??0,s=this._getMipLevelSize(i),n=this.device.getExternalImageSize(e.image),o={...x.defaultCopyExternalImageOptions,...s,...n,...t};return o.width=Math.min(o.width,s.width-o.x),o.height=Math.min(o.height,s.height-o.y),o.depth=Math.min(o.depth,s.depthOrArrayLayers-o.z),o}_normalizeTextureReadOptions(e){let t=x._omitUndefined(e),i=t.mipLevel??0,s=this._getMipLevelSize(i),n={...x.defaultTextureReadOptions,...s,...t};return n.width=Math.min(n.width,s.width-n.x),n.height=Math.min(n.height,s.height-n.y),n.depthOrArrayLayers=Math.min(n.depthOrArrayLayers,s.depthOrArrayLayers-n.z),n}_getSupportedColorReadOptions(e){let t=this._normalizeTextureReadOptions(e),i=y.getInfo(this.format);switch(this._validateColorReadAspect(t),this._validateColorReadFormat(i),this.dimension){case"2d":case"cube":case"cube-array":case"2d-array":case"3d":return t;default:throw new Error(`${this} color readback does not support ${this.dimension} textures`)}}_validateColorReadAspect(e){if(e.aspect!=="all")throw new Error(`${this} color readback only supports aspect 'all'`)}_validateColorReadFormat(e){if(e.compressed)throw new Error(`${this} color readback does not support compressed formats (${this.format})`);switch(e.attachment){case"color":return;case"depth":throw new Error(`${this} color readback does not support depth formats (${this.format})`);case"stencil":throw new Error(`${this} color readback does not support stencil formats (${this.format})`);case"depth-stencil":throw new Error(`${this} color readback does not support depth-stencil formats (${this.format})`);default:throw new Error(`${this} color readback does not support format ${this.format}`)}}_normalizeTextureWriteOptions(e){let t=x._omitUndefined(e),i=t.mipLevel??0,s=this._getMipLevelSize(i),n={...x.defaultTextureWriteOptions,...s,...t};n.width=Math.min(n.width,s.width-n.x),n.height=Math.min(n.height,s.height-n.y),n.depthOrArrayLayers=Math.min(n.depthOrArrayLayers,s.depthOrArrayLayers-n.z);let o=y.computeMemoryLayout({format:this.format,width:n.width,height:n.height,depth:n.depthOrArrayLayers,byteAlignment:this.byteAlignment}),a=o.bytesPerPixel*n.width;if(n.bytesPerRow=t.bytesPerRow??o.bytesPerRow,n.rowsPerImage=t.rowsPerImage??n.height,n.bytesPerRow<a)throw new Error(`bytesPerRow (${n.bytesPerRow}) must be at least ${a} for ${this.format}`);if(n.rowsPerImage<n.height)throw new Error(`rowsPerImage (${n.rowsPerImage}) must be at least ${n.height} for ${this.format}`);let c=this.device.getTextureFormatInfo(this.format).bytesPerPixel;if(c&&n.bytesPerRow%c!==0)throw new Error(`bytesPerRow (${n.bytesPerRow}) must be a multiple of bytesPerPixel (${c}) for ${this.format}`);return n}_getMipLevelSize(e){let t=Math.max(1,this.width>>e),i=this.baseDimension==="1d"?1:Math.max(1,this.height>>e),s=this.dimension==="3d"?Math.max(1,this.depth>>e):this.depth;return{width:t,height:i,depthOrArrayLayers:s}}getAllocatedByteLength(){let e=0;for(let t=0;t<this.mipLevels;t++){let{width:i,height:s,depthOrArrayLayers:n}=this._getMipLevelSize(t);e+=y.computeMemoryLayout({format:this.format,width:i,height:s,depth:n,byteAlignment:1}).byteLength}return e*this.samples}static _omitUndefined(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}},g=x;u(g,"SAMPLE",4),u(g,"STORAGE",8),u(g,"RENDER",16),u(g,"COPY_SRC",1),u(g,"COPY_DST",2),u(g,"TEXTURE",4),u(g,"RENDER_ATTACHMENT",16),u(g,"defaultProps",{...l.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:x.SAMPLE|x.RENDER|x.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),u(g,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,width:void 0,height:void 0,depthOrArrayLayers:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),u(g,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}),u(g,"defaultTextureReadOptions",{x:0,y:0,z:0,width:void 0,height:void 0,depthOrArrayLayers:1,mipLevel:0,aspect:"all"}),u(g,"defaultTextureWriteOptions",{byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,x:0,y:0,z:0,width:void 0,height:void 0,depthOrArrayLayers:1,mipLevel:0,aspect:"all"});var st=class extends l{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,st.defaultProps)}},X=st;u(X,"defaultProps",{...l.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var nt=class extends l{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,nt.defaultProps)}},q=nt;u(q,"defaultProps",{...l.defaultProps,source:void 0,colorSpace:"srgb"});function Xt(r,e,t){let i="",s=e.split(/\r?\n/),n=r.slice().sort((o,a)=>o.lineNum-a.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let a=1;a<=s.length;a++){let c=s[a-1],d=n[o];for(c&&d&&(i+=qt(c,a,t));n.length>o&&d.lineNum===a;){let p=n[o++];p&&(i+=ot(p,s,p.lineNum,{...t,inlineSource:!1}))}}for(;n.length>o;){let a=n[o++];a&&(i+=ot(a,[],0,{...t,inlineSource:!1}))}return i;case"issues":case"no":for(let a of r)i+=ot(a,s,a.lineNum,{inlineSource:t?.showSourceCode!=="no"});return i}}function ot(r,e,t,i){if(i?.inlineSource){let n=si(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
7
+ "use strict";var __exports__=(()=>{var be=Object.defineProperty;var _r=Object.getOwnPropertyDescriptor;var wr=Object.getOwnPropertyNames;var Pr=Object.prototype.hasOwnProperty;var vr=(r,e,t)=>e in r?be(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Sr=(r,e)=>{for(var t in e)be(r,t,{get:e[t],enumerable:!0})},Tr=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of wr(e))!Pr.call(r,s)&&s!==t&&be(r,s,{get:()=>e[s],enumerable:!(i=_r(e,s))||i.enumerable});return r};var Cr=r=>Tr(be({},"__esModule",{value:!0}),r);var u=(r,e,t)=>(vr(r,typeof e!="symbol"?e+"":e,t),t);var qi={};Sr(qi,{Adapter:()=>Ie,Buffer:()=>p,CanvasContext:()=>re,CommandBuffer:()=>fe,CommandEncoder:()=>ue,ComputePass:()=>ce,ComputePipeline:()=>D,Device:()=>k,DeviceFeatures:()=>Be,DeviceLimits:()=>Le,ExternalTexture:()=>se,Fence:()=>pe,Framebuffer:()=>ne,PipelineFactory:()=>oe,PipelineLayout:()=>ge,PresentationContext:()=>Fe,QuerySet:()=>me,RenderPass:()=>$,RenderPipeline:()=>T,Resource:()=>f,Sampler:()=>F,Shader:()=>G,ShaderFactory:()=>ae,SharedRenderPipeline:()=>ze,Texture:()=>g,TextureView:()=>ie,TransformFeedback:()=>de,UniformBlock:()=>Y,UniformBufferLayout:()=>Q,UniformStore:()=>Qe,VertexArray:()=>he,_getDefaultBindGroupFactory:()=>cr,_getTextureFormatDefinition:()=>ee,_getTextureFormatTable:()=>Ae,assert:()=>Oe,assertDefined:()=>ke,dataTypeDecoder:()=>L,flattenBindingsByGroup:()=>ar,getAttributeInfosFromLayouts:()=>Ct,getAttributeShaderTypeInfo:()=>Tt,getExternalImageSize:()=>Re,getScratchArray:()=>hr,getShaderLayoutBinding:()=>xt,getTextureImageView:()=>$t,getTypedArrayConstructor:()=>lr,getVariableShaderTypeInfo:()=>le,isExternalImage:()=>Ee,log:()=>l,luma:()=>tr,normalizeBindingsByGroup:()=>We,readPixel:()=>br,setTextureImageData:()=>gr,shaderTypeDecoder:()=>Ne,textureFormatDecoder:()=>x,vertexFormatDecoder:()=>B,writePixel:()=>yr});function J(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var U=class{constructor(e,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=J(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(J()-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 W=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){let{name:t,type:i}=e,s=this.stats[t];return s||(e instanceof U?s=e:s=new U(t,i),this.stats[t]=s),s}};var Ar="GPU Time and Memory",Er=["Adapter","GPU","GPU Type","GPU Backend","Frame Rate","CPU Time","GPU Time","GPU Memory","Buffer Memory","Texture Memory","Referenced Buffer Memory","Referenced Texture Memory","Swap Chain Texture"],It=new WeakMap,Ut=new WeakMap,Ye=class{stats=new Map;getStats(e){return this.get(e)}get(e){this.stats.has(e)||this.stats.set(e,new W({id:e}));let t=this.stats.get(e);return e===Ar&&Rr(t,Er),t}},ye=new Ye;function Rr(r,e){let t=r.stats,i=!1;for(let c of e)t[c]||(r.get(c),i=!0);let s=Object.keys(t).length,n=It.get(r);if(!i&&n?.orderedStatNames===e&&n.statCount===s)return;let o={},a=Ut.get(e);a||(a=new Set(e),Ut.set(e,a));for(let c of e)t[c]&&(o[c]=t[c]);for(let[c,h]of Object.entries(t))a.has(c)||(o[c]=h);for(let c of Object.keys(t))delete t[c];Object.assign(t,o),It.set(r,{orderedStatNames:e,statCount:s})}var xe=globalThis,Lr=globalThis.document||{},_e=globalThis.process||{},Br=globalThis.console,us=globalThis.navigator||{};function Ot(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=r||e;return Boolean(t&&t.indexOf("Electron")>=0)}function w(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Ot()}var Xe="4.1.1";function H(r,e){if(!r)throw new Error(e||"Assertion failed")}function qe(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return H(Number.isFinite(e)&&e>=0),e}function kt(r){let{logLevel:e,message:t}=r;r.logLevel=qe(e);let i=r.args?Array.from(r.args):[];for(;i.length&&i.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&i.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let s=typeof r.message;return H(s==="string"||s==="object"),Object.assign(r,{args:i},r.opts)}var O=()=>{},we=class{constructor({level:e=0}={}){this.userData={},this._onceCache=new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...t){return this._log("warn",0,e,t,{once:!0})}error(e,...t){return this._log("error",0,e,t)}log(e,t,...i){return this._log("log",e,t,i)}info(e,t,...i){return this._log("info",e,t,i)}once(e,t,...i){return this._log("once",e,t,i,{once:!0})}_log(e,t,i,s,n={}){let o=kt({logLevel:t,message:i,args:this._buildArgs(t,i,s),opts:n});return this._createLogFunction(e,o,n)}_buildArgs(e,t,i){return[e,t,...i]}_createLogFunction(e,t,i){if(!this._shouldLog(t.logLevel))return O;let s=this._getOnceTag(i.tag??t.tag??t.message);if((i.once||t.once)&&s!==void 0){if(this._onceCache.has(s))return O;this._onceCache.add(s)}return this._emit(e,t)}_shouldLog(e){return this.getLevel()>=qe(e)}_getOnceTag(e){if(e!==void 0)try{return typeof e=="string"?e:String(e)}catch{return}}};function Dr(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var Pe=class{constructor(e,t,i="sessionStorage"){this.storage=Dr(i),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function Ft(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function Gt(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var ve;(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"})(ve||(ve={}));var $r=10;function zt(r){return typeof r!="string"?r:(r=r.toUpperCase(),ve[r]||ve.WHITE)}function Wt(r,e,t){return!w&&typeof r=="string"&&(e&&(r=`\x1B[${zt(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${zt(t)+$r}m${r}\x1B[49m`)),r}function Ht(r,e=["constructor"]){let t=Object.getPrototypeOf(r),i=Object.getOwnPropertyNames(t),s=r;for(let n of i){let o=s[n];typeof o=="function"&&(e.find(a=>n===a)||(s[n]=o.bind(r)))}}function N(){let r;if(w()&&xe.performance)r=xe?.performance?.now?.();else if("hrtime"in _e){let e=_e?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var V={debug:w()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Je={enabled:!0,level:0},A=class extends we{constructor({id:e}={id:""}){super({level:0}),this.VERSION=Xe,this._startTs=N(),this._deltaTs=N(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Pe(`__probe-${this.id}__`,{[this.id]:Je}),this.timeStamp(`${this.id} started`),Ht(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((N()-this._startTs).toPrecision(10))}getDelta(){return Number((N()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,t){this._updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e,...t){return this._log("warn",0,e,t,{method:V.warn,once:!0})}error(e,...t){return this._log("error",0,e,t,{method:V.error})}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t,...i){return this._log("log",e,t,i,{method:V.log,time:!0,once:!0})}log(e,t,...i){return this._log("log",e,t,i,{method:V.debug})}info(e,t,...i){return this._log("info",e,t,i,{method:console.info})}once(e,t,...i){return this._log("once",e,t,i,{method:V.debug||V.info,once:!0})}table(e,t,i){return t?this._log("table",e,t,i&&[i]||[],{method:console.table||O,tag:Ur(t)}):O}time(e,t){return this._log("time",e,t,[],{method:console.time?console.time:console.info})}timeEnd(e,t){return this._log("time",e,t,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,t){return this._log("time",e,t,[],{method:console.timeStamp||O})}group(e,t,i={collapsed:!1}){let s=(i.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,t,[],{method:s})}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||O})}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,t){let i=t.method;H(i),t.total=this.getTotal(),t.delta=this.getDelta(),this._deltaTs=N();let s=Ir(this.id,t.message,t);return i.bind(console,s,...t.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(Je),this._storage.config[this.id]}_updateConfiguration(e){let t=this._storage.config[this.id]||{...Je};this._storage.setConfiguration({[this.id]:{...t,...e}})}};A.VERSION=Xe;function Ir(r,e,t){if(typeof e=="string"){let i=t.time?Gt(Ft(t.total)):"";e=t.time?`${r}: ${i} ${e}`:`${r}: ${e}`,e=Wt(e,t.color,t.background)}return e}function Ur(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var Fs=new A({id:"@probe.gl/log"});var l=new A({id:"luma.gl"});var Ke={};function v(r="id"){Ke[r]=Ke[r]||1;let e=Ke[r]++;return`${r}-${e}`}var Or="cpu-hotspot-profiler",Nt="GPU Resource Counts",Vt="Resource Counts",jt="GPU Time and Memory",kr=["Resources","Buffers","Textures","Samplers","TextureViews","Framebuffers","QuerySets","Shaders","RenderPipelines","ComputePipelines","PipelineLayouts","VertexArrays","RenderPasss","ComputePasss","CommandEncoders","CommandBuffers"],Fr=["Resources","Buffers","Textures","Samplers","TextureViews","Framebuffers","QuerySets","Shaders","RenderPipelines","SharedRenderPipelines","ComputePipelines","PipelineLayouts","VertexArrays","RenderPasss","ComputePasss","CommandEncoders","CommandBuffers"],Gr=kr.flatMap(r=>[`${r} Created`,`${r} Active`]),zr=Fr.flatMap(r=>[`${r} Created`,`${r} Active`]),Qt=new WeakMap,Yt=new WeakMap,f=class{toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;allocatedBytesName=null;_attachedResources=new Set;constructor(e,t,i){if(!e)throw new Error("no device");this._device=e,this.props=Wr(t,i);let s=this.props.id!=="undefined"?this.props.id:v(this[Symbol.toStringTag]);this.props.id=s,this.id=s,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyed||this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of this._attachedResources)e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyed||(this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0)}removeStats(){let e=K(this._device),t=e?R():0,i=[this._device.statsManager.getStats(Nt),this._device.statsManager.getStats(Vt)],s=qt(this._device);for(let o of i)Xt(o,s);let n=this.getStatsName();for(let o of i)o.get("Resources Active").decrementCount(),o.get(`${n}s Active`).decrementCount();e&&(e.statsBookkeepingCalls=(e.statsBookkeepingCalls||0)+1,e.statsBookkeepingTimeMs=(e.statsBookkeepingTimeMs||0)+(R()-t))}trackAllocatedMemory(e,t=this.getStatsName()){let i=K(this._device),s=i?R():0,n=this._device.statsManager.getStats(jt);this.allocatedBytes>0&&this.allocatedBytesName&&(n.get("GPU Memory").subtractCount(this.allocatedBytes),n.get(`${this.allocatedBytesName} Memory`).subtractCount(this.allocatedBytes)),n.get("GPU Memory").addCount(e),n.get(`${t} Memory`).addCount(e),i&&(i.statsBookkeepingCalls=(i.statsBookkeepingCalls||0)+1,i.statsBookkeepingTimeMs=(i.statsBookkeepingTimeMs||0)+(R()-s)),this.allocatedBytes=e,this.allocatedBytesName=t}trackReferencedMemory(e,t=this.getStatsName()){this.trackAllocatedMemory(e,`Referenced ${t}`)}trackDeallocatedMemory(e=this.getStatsName()){if(this.allocatedBytes===0){this.allocatedBytesName=null;return}let t=K(this._device),i=t?R():0,s=this._device.statsManager.getStats(jt);s.get("GPU Memory").subtractCount(this.allocatedBytes),s.get(`${this.allocatedBytesName||e} Memory`).subtractCount(this.allocatedBytes),t&&(t.statsBookkeepingCalls=(t.statsBookkeepingCalls||0)+1,t.statsBookkeepingTimeMs=(t.statsBookkeepingTimeMs||0)+(R()-i)),this.allocatedBytes=0,this.allocatedBytesName=null}trackDeallocatedReferencedMemory(e=this.getStatsName()){this.trackDeallocatedMemory(`Referenced ${e}`)}addStats(){let e=this.getStatsName(),t=K(this._device),i=t?R():0,s=[this._device.statsManager.getStats(Nt),this._device.statsManager.getStats(Vt)],n=qt(this._device);for(let o of s)Xt(o,n);for(let o of s)o.get("Resources Created").incrementCount(),o.get("Resources Active").incrementCount(),o.get(`${e}s Created`).incrementCount(),o.get(`${e}s Active`).incrementCount();t&&(t.statsBookkeepingCalls=(t.statsBookkeepingCalls||0)+1,t.statsBookkeepingTimeMs=(t.statsBookkeepingTimeMs||0)+(R()-i)),Hr(this._device,e)}getStatsName(){return Nr(this)}};u(f,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Wr(r,e){let t={...e};for(let i in r)r[i]!==void 0&&(t[i]=r[i]);return t}function Xt(r,e){let t=r.stats,i=!1;for(let c of e)t[c]||(r.get(c),i=!0);let s=Object.keys(t).length,n=Qt.get(r);if(!i&&n?.orderedStatNames===e&&n.statCount===s)return;let o={},a=Yt.get(e);a||(a=new Set(e),Yt.set(e,a));for(let c of e)t[c]&&(o[c]=t[c]);for(let[c,h]of Object.entries(t))a.has(c)||(o[c]=h);for(let c of Object.keys(t))delete t[c];Object.assign(t,o),Qt.set(r,{orderedStatNames:e,statCount:s})}function qt(r){return r.type==="webgl"?zr:Gr}function K(r){let e=r.userData[Or];return e?.enabled?e:null}function R(){return globalThis.performance?.now?.()??Date.now()}function Hr(r,e){let t=K(r);if(!(!t||!t.activeDefaultFramebufferAcquireDepth))switch(t.transientCanvasResourceCreates=(t.transientCanvasResourceCreates||0)+1,e){case"Texture":t.transientCanvasTextureCreates=(t.transientCanvasTextureCreates||0)+1;break;case"TextureView":t.transientCanvasTextureViewCreates=(t.transientCanvasTextureViewCreates||0)+1;break;case"Sampler":t.transientCanvasSamplerCreates=(t.transientCanvasSamplerCreates||0)+1;break;case"Framebuffer":t.transientCanvasFramebufferCreates=(t.transientCanvasFramebufferCreates||0)+1;break;default:break}}function Nr(r){let e=Object.getPrototypeOf(r);for(;e;){let t=Object.getPrototypeOf(e);if(!t||t===f.prototype)return Vr(e)||r[Symbol.toStringTag]||r.constructor.name;e=t}return r[Symbol.toStringTag]||r.constructor.name}function Vr(r){let e=Object.getOwnPropertyDescriptor(r,Symbol.toStringTag);return typeof e?.get=="function"?e.get.call(r):typeof e?.value=="string"?e.value:null}var Z=class extends f{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let i={...t};(t.usage||0)&Z.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?i.indexType="uint32":t.data instanceof Uint16Array?i.indexType="uint16":t.data instanceof Uint8Array&&(i.indexType="uint8")),delete i.data,super(e,i,Z.defaultProps),this.usage=i.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}debugData=new ArrayBuffer(0);_setDebugData(e,t,i){let s=null,n;ArrayBuffer.isView(e)?(s=e,n=e.buffer):n=e;let o=Math.min(e?e.byteLength:i,Z.DEBUG_DATA_MAX_LENGTH);if(n===null)this.debugData=new ArrayBuffer(o);else{let a=Math.min(s?.byteOffset||0,n.byteLength),c=Math.max(0,n.byteLength-a),h=Math.min(o,c);this.debugData=new Uint8Array(n,a,h).slice().buffer}}},p=Z;u(p,"INDEX",16),u(p,"VERTEX",32),u(p,"UNIFORM",64),u(p,"STORAGE",128),u(p,"INDIRECT",256),u(p,"QUERY_RESOLVE",512),u(p,"MAP_READ",1),u(p,"MAP_WRITE",2),u(p,"COPY_SRC",4),u(p,"COPY_DST",8),u(p,"DEBUG_DATA_MAX_LENGTH",32),u(p,"defaultProps",{...f.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0});var et=class{getDataTypeInfo(e){let[t,i,s]=Ze[e],n=e.includes("norm"),o=!n&&!e.startsWith("float"),a=e.startsWith("s");return{signedType:t,primitiveType:i,byteLength:s,normalized:n,integer:o,signed:a}}getNormalizedDataType(e){let t=e;switch(t){case"uint8":return"unorm8";case"sint8":return"snorm8";case"uint16":return"unorm16";case"sint16":return"snorm16";default:return t}}alignTo(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}getDataType(e){let t=ArrayBuffer.isView(e)?e.constructor:e;if(t===Uint8ClampedArray)return"uint8";let i=Object.values(Ze).find(s=>t===s[4]);if(!i)throw new Error(t.name);return i[0]}getTypedArrayConstructor(e){let[,,,,t]=Ze[e];return t}},L=new et,Ze={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]};var tt=class{getVertexFormatInfo(e){let t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);let[i,s]=e.split("x"),n=i,o=s?parseInt(s):1,a=L.getDataTypeInfo(n),c={type:n,components:o,byteLength:a.byteLength*o,integer:a.integer,signed:a.signed,normalized:a.normalized};return t&&(c.webglOnly=!0),c}makeVertexFormat(e,t,i){let s=i?L.getNormalizedDataType(e):e;switch(s){case"unorm8":return t===1?"unorm8":t===3?"unorm8x3-webgl":`${s}x${t}`;case"snorm8":case"uint8":case"sint8":case"uint16":case"sint16":case"unorm16":case"snorm16":case"float16":if(t===1||t===3)throw new Error(`size: ${t}`);return`${s}x${t}`;default:return t===1?s:`${s}x${t}`}}getVertexFormatFromAttribute(e,t,i){if(!t||t>4)throw new Error(`size ${t}`);let s=t,n=L.getDataType(e);return this.makeVertexFormat(n,s,i)}getCompatibleVertexFormat(e){let t;switch(e.primitiveType){case"f32":t="float32";break;case"i32":t="sint32";break;case"u32":t="uint32";break;case"f16":return e.components<=2?"float16x2":"float16x4"}return e.components===1?t:`${t}x${e.components}`}},B=new tt;var b="texture-compression-bc",m="texture-compression-astc",S="texture-compression-etc2",jr="texture-compression-etc1-webgl",Se="texture-compression-pvrtc-webgl",rt="texture-compression-atc-webgl",Te="float32-renderable-webgl",it="float16-renderable-webgl",Qr="rgb9e5ufloat-renderable-webgl",st="snorm8-renderable-webgl",M="norm16-webgl",nt="norm16-renderable-webgl",ot="snorm16-renderable-webgl",Ce="float32-filterable",Jt="float16-filterable-webgl";function ee(r){let e=Kt[r];if(!e)throw new Error(`Unsupported texture format ${r}`);return e}function Ae(){return Kt}var Yr={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:st},rg8snorm:{render:st},"rgb8snorm-webgl":{},rgba8snorm:{render:st},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:M,render:nt},rg16unorm:{f:M,render:nt},"rgb16unorm-webgl":{f:M,render:!1},rgba16unorm:{f:M,render:nt},r16snorm:{f:M,render:ot},rg16snorm:{f:M,render:ot},"rgb16snorm-webgl":{f:M,render:!1},rgba16snorm:{f:M,render:ot},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:it,filter:"float16-filterable-webgl"},rg16float:{render:it,filter:Jt},rgba16float:{render:it,filter:Jt},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:Te,filter:Ce},rg32float:{render:!1,filter:Ce},"rgb32float-webgl":{render:Te,filter:Ce},rgba32float:{render:Te,filter:Ce},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:Qr},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:Te},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},rgb10a2uint:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}},Xr={"bc1-rgb-unorm-webgl":{f:b},"bc1-rgb-unorm-srgb-webgl":{f:b},"bc1-rgba-unorm":{f:b},"bc1-rgba-unorm-srgb":{f:b},"bc2-rgba-unorm":{f:b},"bc2-rgba-unorm-srgb":{f:b},"bc3-rgba-unorm":{f:b},"bc3-rgba-unorm-srgb":{f:b},"bc4-r-unorm":{f:b},"bc4-r-snorm":{f:b},"bc5-rg-unorm":{f:b},"bc5-rg-snorm":{f:b},"bc6h-rgb-ufloat":{f:b},"bc6h-rgb-float":{f:b},"bc7-rgba-unorm":{f:b},"bc7-rgba-unorm-srgb":{f:b},"etc2-rgb8unorm":{f:S},"etc2-rgb8unorm-srgb":{f:S},"etc2-rgb8a1unorm":{f:S},"etc2-rgb8a1unorm-srgb":{f:S},"etc2-rgba8unorm":{f:S},"etc2-rgba8unorm-srgb":{f:S},"eac-r11unorm":{f:S},"eac-r11snorm":{f:S},"eac-rg11unorm":{f:S},"eac-rg11snorm":{f:S},"astc-4x4-unorm":{f:m},"astc-4x4-unorm-srgb":{f:m},"astc-5x4-unorm":{f:m},"astc-5x4-unorm-srgb":{f:m},"astc-5x5-unorm":{f:m},"astc-5x5-unorm-srgb":{f:m},"astc-6x5-unorm":{f:m},"astc-6x5-unorm-srgb":{f:m},"astc-6x6-unorm":{f:m},"astc-6x6-unorm-srgb":{f:m},"astc-8x5-unorm":{f:m},"astc-8x5-unorm-srgb":{f:m},"astc-8x6-unorm":{f:m},"astc-8x6-unorm-srgb":{f:m},"astc-8x8-unorm":{f:m},"astc-8x8-unorm-srgb":{f:m},"astc-10x5-unorm":{f:m},"astc-10x5-unorm-srgb":{f:m},"astc-10x6-unorm":{f:m},"astc-10x6-unorm-srgb":{f:m},"astc-10x8-unorm":{f:m},"astc-10x8-unorm-srgb":{f:m},"astc-10x10-unorm":{f:m},"astc-10x10-unorm-srgb":{f:m},"astc-12x10-unorm":{f:m},"astc-12x10-unorm-srgb":{f:m},"astc-12x12-unorm":{f:m},"astc-12x12-unorm-srgb":{f:m},"pvrtc-rgb4unorm-webgl":{f:Se},"pvrtc-rgba4unorm-webgl":{f:Se},"pvrtc-rgb2unorm-webgl":{f:Se},"pvrtc-rgba2unorm-webgl":{f:Se},"etc1-rbg-unorm-webgl":{f:jr},"atc-rgb-unorm-webgl":{f:rt},"atc-rgba-unorm-webgl":{f:rt},"atc-rgbai-unorm-webgl":{f:rt}},Kt={...Yr,...Xr};var qr=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,Jr=["rgb","rgba","bgra"],Kr=["depth","stencil"],Zr=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],at=class{isColor(e){return Jr.some(t=>e.startsWith(t))}isDepthStencil(e){return Kr.some(t=>e.startsWith(t))}isCompressed(e){return Zr.some(t=>e.startsWith(t))}getInfo(e){return Zt(e)}getCapabilities(e){return ti(e)}computeMemoryLayout(e){return ei(e)}},x=new at;function ei({format:r,width:e,height:t,depth:i,byteAlignment:s}){let n=x.getInfo(r),{bytesPerPixel:o,bytesPerBlock:a=o,blockWidth:c=1,blockHeight:h=1,compressed:d=!1}=n,y=d?Math.ceil(e/c):e,X=d?Math.ceil(t/h):t,P=y*a,q=Math.ceil(P/s)*s,I=X,xr=q*I*i;return{bytesPerPixel:o,bytesPerRow:q,rowsPerImage:I,depthOrArrayLayers:i,bytesPerImage:q*I,byteLength:xr}}function ti(r){let e=ee(r),t={format:r,create:e.f??!0,render:e.render??!0,filter:e.filter??!0,blend:e.blend??!0,store:e.store??!0},i=Zt(r),s=r.startsWith("depth")||r.startsWith("stencil"),n=i?.signed,o=i?.integer,a=i?.webgl,c=Boolean(i?.compressed);return t.render&&=!s&&!c,t.filter&&=!s&&!n&&!o&&!a,t}function Zt(r){let e=ri(r);if(x.isCompressed(r)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0,e.bytesPerBlock=si(r);let i=ii(r);i&&(e.blockWidth=i.blockWidth,e.blockHeight=i.blockHeight)}let t=e.packed?null:qr.exec(r);if(t){let[,i,s,n,o,a]=t,c=`${n}${s}`,h=L.getDataTypeInfo(c),d=h.byteLength*8,y=i?.length??1,X=[d,y>=2?d:0,y>=3?d:0,y>=4?d:0];e={format:r,attachment:e.attachment,dataType:h.signedType,components:y,channels:i,integer:h.integer,signed:h.signed,normalized:h.normalized,bitsPerChannel:X,bytesPerPixel:h.byteLength*y,packed:e.packed,srgb:e.srgb},a==="-webgl"&&(e.webgl=!0),o==="-srgb"&&(e.srgb=!0)}return r.endsWith("-webgl")&&(e.webgl=!0),r.endsWith("-srgb")&&(e.srgb=!0),e}function ri(r){let e=ee(r),t=e.bytesPerPixel||1,i=e.bitsPerChannel||[8,8,8,8];return delete e.bitsPerChannel,delete e.bytesPerPixel,delete e.f,delete e.render,delete e.filter,delete e.blend,delete e.store,{...e,format:r,attachment:e.attachment||"color",channels:e.channels||"r",components:e.components||e.channels?.length||1,bytesPerPixel:t,bitsPerChannel:i,dataType:e.dataType||"uint8",srgb:e.srgb??!1,packed:e.packed??!1,webgl:e.webgl??!1,integer:e.integer??!1,signed:e.signed??!1,normalized:e.normalized??!1,compressed:e.compressed??!1}}function ii(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,i,s]=t;return{blockWidth:Number(i),blockHeight:Number(s)}}return r.startsWith("bc")||r.startsWith("etc1")||r.startsWith("etc2")||r.startsWith("eac")||r.startsWith("atc")?{blockWidth:4,blockHeight:4}:r.startsWith("pvrtc-rgb4")||r.startsWith("pvrtc-rgba4")?{blockWidth:4,blockHeight:4}:r.startsWith("pvrtc-rgb2")||r.startsWith("pvrtc-rgba2")?{blockWidth:8,blockHeight:4}:null}function si(r){return r.startsWith("bc1")||r.startsWith("bc4")||r.startsWith("etc1")||r.startsWith("etc2-rgb8")||r.startsWith("etc2-rgb8a1")||r.startsWith("eac-r11")||r==="atc-rgb-unorm-webgl"?8:r.startsWith("bc2")||r.startsWith("bc3")||r.startsWith("bc5")||r.startsWith("bc6h")||r.startsWith("bc7")||r.startsWith("etc2-rgba8")||r.startsWith("eac-rg11")||r.startsWith("astc")||r==="atc-rgba-unorm-webgl"||r==="atc-rgbai-unorm-webgl"?16:r.startsWith("pvrtc")?8:16}function Ee(r){return typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement||typeof VideoFrame<"u"&&r instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas}function Re(r){if(typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height};if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement)return{width:r.naturalWidth,height:r.naturalHeight};if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement)return{width:r.videoWidth,height:r.videoHeight};if(typeof VideoFrame<"u"&&r instanceof VideoFrame)return{width:r.displayWidth,height:r.displayHeight};throw new Error("Unknown image type")}var Le=class{};function ni(r,e){let t=ct(r),i=e.map(ct).filter(s=>s!==void 0);return[t,...i].filter(s=>s!==void 0)}function ct(r){if(r!==void 0){if(r===null||typeof r=="string"||typeof r=="number"||typeof r=="boolean")return r;if(r instanceof Error)return r.message;if(Array.isArray(r))return r.map(ct);if(typeof r=="object"){if(oi(r)){let e=String(r);if(e!=="[object Object]")return e}return ai(r)?ci(r):r.constructor?.name||"Object"}return String(r)}}function oi(r){return"toString"in r&&typeof r.toString=="function"&&r.toString!==Object.prototype.toString}function ai(r){return"message"in r&&"type"in r}function ci(r){let e=typeof r.type=="string"?r.type:"message",t=typeof r.message=="string"?r.message:"",i=typeof r.lineNum=="number"?r.lineNum:null,s=typeof r.linePos=="number"?r.linePos:null,n=i!==null&&s!==null?` @ ${i}:${s}`:i!==null?` @ ${i}`:"";return`${e}${n}: ${t}`.trim()}var Be=class{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}},ut=class{get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=ye;_factories={};timestamp=0;_reused=!1;_moduleData={};_textureCaps={};_debugGPUTimeQuery=null;constructor(e){this.props={...ut.defaultProps,...e},this.id=this.props.id||v(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(e){return B.getVertexFormatInfo(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return x.getInfo(e)}getTextureFormatCapabilities(e){let t=this._textureCaps[e];if(!t){let i=this._getDeviceTextureFormatCapabilities(e);t=this._getDeviceSpecificTextureFormatCapabilities(i),this._textureCaps[e]=t}return t}getMipLevelCount(e,t,i=1){let s=Math.max(e,t,i);return 1+Math.floor(Math.log2(s))}isExternalImage(e){return Ee(e)}getExternalImageSize(e){return Re(e)}isTextureFormatSupported(e){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return x.isCompressed(e)}getSupportedCompressedTextureFormats(){let e=[];for(let t of Object.keys(Ae()))this.isTextureFormatCompressed(t)&&this.isTextureFormatSupported(t)&&e.push(t);return e}pushDebugGroup(e){this.commandEncoder.pushDebugGroup(e)}popDebugGroup(){this.commandEncoder?.popDebugGroup()}insertDebugMarker(e){this.commandEncoder?.insertDebugMarker(e)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(e,t,...i){if(!this.props.onError(e,t)){let n=ni(t,i);return l.error(this.type==="webgl"?"%cWebGL":"%cWebGPU","color: white; background: red; padding: 2px 6px; border-radius: 3px;",e.message,...n)}return()=>{}}debug(){if(this.props.debug)debugger;else{let e=`'Type luma.log.set({debug: true}) in console to enable debug breakpoints',
8
+ or create a device with the 'debug: true' prop.`;l.once(0,e)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createFence(){throw new Error("createFence() not implemented")}beginRenderPass(e){return this.commandEncoder.beginRenderPass(e)}beginComputePass(e){return this.commandEncoder.beginComputePass(e)}generateMipmapsWebGPU(e){throw new Error("not implemented")}_createSharedRenderPipelineWebGL(e){throw new Error("_createSharedRenderPipelineWebGL() not implemented")}_createBindGroupLayoutWebGPU(e,t){throw new Error("_createBindGroupLayoutWebGPU() not implemented")}_createBindGroupWebGPU(e,t,i,s){throw new Error("_createBindGroupWebGPU() not implemented")}_supportsDebugGPUTime(){return this.features.has("timestamp-query")&&Boolean(this.props.debug||this.props.debugGPUTime)}_enableDebugGPUTime(e=256){if(!this._supportsDebugGPUTime())return null;if(this._debugGPUTimeQuery)return this._debugGPUTimeQuery;try{this._debugGPUTimeQuery=this.createQuerySet({type:"timestamp",count:e}),this.commandEncoder=this.createCommandEncoder({id:this.commandEncoder.props.id,timeProfilingQuerySet:this._debugGPUTimeQuery})}catch{this._debugGPUTimeQuery=null}return this._debugGPUTimeQuery}_disableDebugGPUTime(){this._debugGPUTimeQuery&&(this.commandEncoder.getTimeProfilingQuerySet()===this._debugGPUTimeQuery&&(this.commandEncoder=this.createCommandEncoder({id:this.commandEncoder.props.id})),this._debugGPUTimeQuery.destroy(),this._debugGPUTimeQuery=null)}_isDebugGPUTimeEnabled(){return this._debugGPUTimeQuery!==null}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}getModuleData(e){return this._moduleData[e]||={},this._moduleData[e]}static _getCanvasContextProps(e){return e.createCanvasContext===!0?{}:e.createCanvasContext}_getDeviceTextureFormatCapabilities(e){let t=x.getCapabilities(e),i=n=>(typeof n=="string"?this.features.has(n):n)??!0,s=i(t.create);return{format:e,create:s,render:s&&i(t.render),filter:s&&i(t.filter),blend:s&&i(t.blend),store:s&&i(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};if((e.usage||0)&p.INDEX&&(e.indexType||(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":e.data instanceof Uint8Array&&(t.data=new Uint16Array(e.data),t.indexType="uint16")),!t.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return t}},k=ut;u(k,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>{},onResize:(e,t)=>{let[i,s]=e.getDevicePixelSize();l.log(1,`${e} resized => ${i}x${s}px`)()},onPositionChange:(e,t)=>{let[i,s]=e.getPosition();l.log(1,`${e} repositioned => ${i},${s}`)()},onVisibilityChange:e=>l.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>l.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:fi(),debugGPUTime:!1,debugShaders:l.get("debug-shaders")||void 0,debugFramebuffers:Boolean(l.get("debug-framebuffers")),debugFactories:Boolean(l.get("debug-factories")),debugWebGL:Boolean(l.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!0,_destroyShaders:!1,_cachePipelines:!0,_sharePipelines:!0,_destroyPipelines:!1,_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0});function ui(r,e){return r!=null?Boolean(r):e!==void 0?e!=="production":!1}function fi(){return ui(l.get("debug"),li())}function li(){let r=globalThis.process;if(r?.env)return r.env.NODE_ENV}var hi="set luma.log.level=1 (or higher) to trace rendering",er="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",De=class{stats=ye;log=l;VERSION="9.3.0-alpha.9";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw l.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),l.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");l.error("This version of luma.gl has already been initialized")()}l.log(1,`${this.VERSION} - ${hi}`)(),globalThis.luma=this}async createDevice(e={}){let t={...De.defaultProps,...e},i=this.selectAdapter(t.type,t.adapters);if(!i)throw new Error(er);return t.waitForPageLoad&&await i.pageLoaded,await i.create(t)}async attachDevice(e,t){let i=this._getTypeFromHandle(e,t.adapters),s=i&&this.selectAdapter(i,t.adapters);if(!s)throw new Error(er);return await s?.attach?.(e,t)}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){let t=this._getAdapterMap(e);return Array.from(t).map(([,i])=>i).filter(i=>i.isSupported?.()).map(i=>i.type)}getBestAvailableAdapterType(e=[]){let t=["webgpu","webgl","null"],i=this._getAdapterMap(e);for(let s of t)if(i.get(s)?.isSupported?.())return s;return null}selectAdapter(e,t=[]){let i=e;e==="best-available"&&(i=this.getBestAvailableAdapterType(t));let s=this._getAdapterMap(t);return i&&s.get(i)||null}enforceWebGL2(e=!0,t=[]){let s=this._getAdapterMap(t).get("webgl");s||l.warn("enforceWebGL2: webgl adapter not found")(),s?.enforceWebGL2?.(e)}setDefaultDeviceProps(e){Object.assign(De.defaultProps,e)}_getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let i of e)t.set(i.type,i);return t}_getTypeFromHandle(e,t=[]){return e instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&e instanceof GPUDevice||e?.queue?"webgpu":e===null?"null":(e instanceof WebGLRenderingContext?l.warn("WebGL1 is not supported",e)():l.warn("Unknown handle type",e)(),null)}},Me=De;u(Me,"defaultProps",{...k.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});var tr=new Me;var Ie=class{get pageLoaded(){return pi()}},di=w()&&typeof document<"u",mi=()=>di&&document.readyState==="complete",$e=null;function pi(){return $e||(mi()||typeof window>"u"?$e=Promise.resolve():$e=new Promise(r=>window.addEventListener("load",()=>r()))),$e}var Ue=class{props;_resizeObserver;_intersectionObserver;_observeDevicePixelRatioTimeout=null;_observeDevicePixelRatioMediaQuery=null;_handleDevicePixelRatioChange=()=>this._refreshDevicePixelRatio();_trackPositionInterval=null;_started=!1;get started(){return this._started}constructor(e){this.props=e}start(){if(!(this._started||!this.props.canvas)){this._started=!0,this._intersectionObserver||=new IntersectionObserver(e=>this.props.onIntersection(e)),this._resizeObserver||=new ResizeObserver(e=>this.props.onResize(e)),this._intersectionObserver.observe(this.props.canvas);try{this._resizeObserver.observe(this.props.canvas,{box:"device-pixel-content-box"})}catch{this._resizeObserver.observe(this.props.canvas,{box:"content-box"})}this._observeDevicePixelRatioTimeout=setTimeout(()=>this._refreshDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}}stop(){this._started&&(this._started=!1,this._observeDevicePixelRatioTimeout&&(clearTimeout(this._observeDevicePixelRatioTimeout),this._observeDevicePixelRatioTimeout=null),this._observeDevicePixelRatioMediaQuery&&(this._observeDevicePixelRatioMediaQuery.removeEventListener("change",this._handleDevicePixelRatioChange),this._observeDevicePixelRatioMediaQuery=null),this._trackPositionInterval&&(clearInterval(this._trackPositionInterval),this._trackPositionInterval=null),this._resizeObserver?.disconnect(),this._intersectionObserver?.disconnect())}_refreshDevicePixelRatio(){this._started&&(this.props.onDevicePixelRatioChange(),this._observeDevicePixelRatioMediaQuery?.removeEventListener("change",this._handleDevicePixelRatioChange),this._observeDevicePixelRatioMediaQuery=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this._observeDevicePixelRatioMediaQuery.addEventListener("change",this._handleDevicePixelRatioChange,{once:!0}))}_trackPosition(e=100){this._trackPositionInterval||(this._trackPositionInterval=setInterval(()=>{this._started?this.props.onPositionChange():this._trackPositionInterval&&(clearInterval(this._trackPositionInterval),this._trackPositionInterval=null)},e))}};function rr(){let r,e;return{promise:new Promise((i,s)=>{r=i,e=s}),resolve:r,reject:e}}function Oe(r,e){if(!r){let t=new Error(e??"luma.gl assertion failed.");throw Error.captureStackTrace?.(t,Oe),t}}function ke(r,e){return Oe(r,e),r}var te=class{static isHTMLCanvas(e){return typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement}static isOffscreenCanvas(e){return typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=rr();_canvasObserver;_position=[0,0];destroyed=!1;_needsDrawingBufferResize=!0;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){this.props={...te.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,w()?e.canvas?typeof e.canvas=="string"?this.canvas=bi(e.canvas):this.canvas=e.canvas:this.canvas=yi(e):this.canvas={width:e.width||1,height:e.height||1},te.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):te.isOffscreenCanvas(this.canvas)?(this.id=e.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=e.id||"node-canvas-context",this.type="node"),this.cssWidth=this.htmlCanvas?.clientWidth||this.canvas.width,this.cssHeight=this.htmlCanvas?.clientHeight||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],this._canvasObserver=new Ue({canvas:this.htmlCanvas,trackPosition:this.props.trackPosition,onResize:t=>this._handleResize(t),onIntersection:t=>this._handleIntersection(t),onDevicePixelRatioChange:()=>this._observeDevicePixelRatio(),onPositionChange:()=>this.updatePosition()})}destroy(){this.destroyed||(this.destroyed=!0,this._stopObservers(),this.device=null)}setProps(e){return"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1,this._updateDrawingBufferSize()),this}getCurrentFramebuffer(e){return this._resizeDrawingBufferIfNeeded(),this._getCurrentFramebuffer(e)}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){let e=this.device.limits.maxTextureDimension2D;return[e,e]}setDrawingBufferSize(e,t){e=Math.floor(e),t=Math.floor(t),!(this.drawingBufferWidth===e&&this.drawingBufferHeight===t)&&(this.drawingBufferWidth=e,this.drawingBufferHeight=t,this._needsDrawingBufferResize=!0)}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(e,t=!0){let i=this.cssToDeviceRatio(),[s,n]=this.getDrawingBufferSize();return xi(e,i,s,n,t)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[e,t]=this.getDrawingBufferSize();return e>0&&t>0?e/t:1}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),[t]=this.getCSSSize();return t?e/t:1}catch{return 1}}resize(e){this.setDrawingBufferSize(e.width,e.height)}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}_startObservers(){this.destroyed||this._canvasObserver.start()}_stopObservers(){this._canvasObserver.stop()}_handleIntersection(e){if(this.destroyed)return;let t=e.find(s=>s.target===this.canvas);if(!t)return;let i=t.isIntersecting;this.isVisible!==i&&(this.isVisible=i,this.device.props.onVisibilityChange(this))}_handleResize(e){if(this.destroyed)return;let t=e.find(h=>h.target===this.canvas);if(!t)return;let i=ke(t.contentBoxSize?.[0]);this.cssWidth=i.inlineSize,this.cssHeight=i.blockSize;let s=this.getDevicePixelSize(),n=t.devicePixelContentBoxSize?.[0]?.inlineSize||i.inlineSize*devicePixelRatio,o=t.devicePixelContentBoxSize?.[0]?.blockSize||i.blockSize*devicePixelRatio,[a,c]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(n,a)),this.devicePixelHeight=Math.max(1,Math.min(o,c)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:s})}_updateDrawingBufferSize(){if(this.props.autoResize)if(typeof this.props.useDevicePixels=="number"){let e=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*e,this.cssHeight*e)}else this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight);this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition()}_resizeDrawingBufferIfNeeded(){this._needsDrawingBufferResize&&(this._needsDrawingBufferResize=!1,(this.drawingBufferWidth!==this.canvas.width||this.drawingBufferHeight!==this.canvas.height)&&(this.canvas.width=this.drawingBufferWidth,this.canvas.height=this.drawingBufferHeight,this._configureDevice()))}_observeDevicePixelRatio(){if(this.destroyed||!this._canvasObserver.started)return;let e=this.devicePixelRatio;this.devicePixelRatio=window.devicePixelRatio,this.updatePosition(),this.device.props.onDevicePixelRatioChange?.(this,{oldRatio:e})}updatePosition(){if(this.destroyed)return;let e=this.htmlCanvas?.getBoundingClientRect();if(e){let t=[e.left,e.top];if(this._position??=t,t[0]!==this._position[0]||t[1]!==this._position[1]){let s=this._position;this._position=t,this.device.props.onPositionChange?.(this,{oldPosition:s})}}}},E=te;u(E,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1});function gi(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e)throw new Error(`${r} is not an HTML element`);return e}return r||document.body}function bi(r){let e=document.getElementById(r);if(!E.isHTMLCanvas(e))throw new Error("Object is not a canvas element");return e}function yi(r){let{width:e,height:t}=r,i=document.createElement("canvas");i.id=v("lumagl-auto-created-canvas"),i.width=e||1,i.height=t||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(t)?`${t}px`:"100%",r?.visible||(i.style.visibility="hidden");let s=gi(r?.container||null);return s.insertBefore(i,s.firstChild),i}function xi(r,e,t,i,s){let n=r,o=ir(n[0],e,t),a=sr(n[1],e,i,s),c=ir(n[0]+1,e,t),h=c===t-1?c:c-1;c=sr(n[1]+1,e,i,s);let d;return s?(c=c===0?c:c+1,d=a,a=c):d=c===i-1?c:c-1,{x:o,y:a,width:Math.max(h-o+1,1),height:Math.max(d-a+1,1)}}function ir(r,e,t){return Math.min(Math.round(r*e),t-1)}function sr(r,e,t,i){return i?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var re=class extends E{};u(re,"defaultProps",E.defaultProps);var Fe=class extends E{};var Ge=class extends f{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=Ge.normalizeProps(e,t),super(e,t,Ge.defaultProps)}static normalizeProps(e,t){return t}},F=Ge;u(F,"defaultProps",{...f.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var _i={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},_=class extends f{dimension;baseDimension;format;width;height;depth;mipLevels;samples;byteAlignment;ready=Promise.resolve(this);isReady=!0;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(e,t,i){if(t=_.normalizeProps(e,t),super(e,t,_.defaultProps),this.dimension=this.props.dimension,this.baseDimension=_i[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.samples=this.props.samples||1,this.dimension==="cube"&&(this.depth=6),this.props.width===void 0||this.props.height===void 0)if(e.isExternalImage(t.data)){let s=e.getExternalImageSize(t.data);this.width=s?.width||1,this.height=s?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&l.warn(`${this} created with undefined width or height. This is deprecated. Use DynamicTexture instead.`)();this.byteAlignment=i?.byteAlignment||1,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createTexture({...this.props,...e})}setSampler(e){this.sampler=e instanceof F?e:this.device.createSampler(e)}copyImageData(e){let{data:t,depth:i,...s}=e;this.writeData(t,{...s,depthOrArrayLayers:s.depthOrArrayLayers??i})}computeMemoryLayout(e={}){let t=this._normalizeTextureReadOptions(e),{width:i=this.width,height:s=this.height,depthOrArrayLayers:n=this.depth}=t,{format:o,byteAlignment:a}=this;return x.computeMemoryLayout({format:o,width:i,height:s,depth:n,byteAlignment:a})}readBuffer(e,t){throw new Error("readBuffer not implemented")}readDataAsync(e){throw new Error("readBuffer not implemented")}writeBuffer(e,t){throw new Error("readBuffer not implemented")}writeData(e,t){throw new Error("readBuffer not implemented")}readDataSyncWebGL(e){throw new Error("readDataSyncWebGL not available")}generateMipmapsWebGL(){throw new Error("generateMipmapsWebGL not available")}static normalizeProps(e,t){let i={...t},{width:s,height:n}=i;return typeof s=="number"&&(i.width=Math.max(1,Math.ceil(s))),typeof n=="number"&&(i.height=Math.max(1,Math.ceil(n))),i}_initializeData(e){this.device.isExternalImage(e)?this.copyExternalImage({image:e,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):e&&this.copyImageData({data:e,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(e){let{data:t,depth:i,...s}=e,n=this._normalizeTextureWriteOptions({...s,depthOrArrayLayers:s.depthOrArrayLayers??i});return{data:t,depth:n.depthOrArrayLayers,...n}}_normalizeCopyExternalImageOptions(e){let t=_._omitUndefined(e),i=t.mipLevel??0,s=this._getMipLevelSize(i),n=this.device.getExternalImageSize(e.image),o={..._.defaultCopyExternalImageOptions,...s,...n,...t};return o.width=Math.min(o.width,s.width-o.x),o.height=Math.min(o.height,s.height-o.y),o.depth=Math.min(o.depth,s.depthOrArrayLayers-o.z),o}_normalizeTextureReadOptions(e){let t=_._omitUndefined(e),i=t.mipLevel??0,s=this._getMipLevelSize(i),n={..._.defaultTextureReadOptions,...s,...t};return n.width=Math.min(n.width,s.width-n.x),n.height=Math.min(n.height,s.height-n.y),n.depthOrArrayLayers=Math.min(n.depthOrArrayLayers,s.depthOrArrayLayers-n.z),n}_getSupportedColorReadOptions(e){let t=this._normalizeTextureReadOptions(e),i=x.getInfo(this.format);switch(this._validateColorReadAspect(t),this._validateColorReadFormat(i),this.dimension){case"2d":case"cube":case"cube-array":case"2d-array":case"3d":return t;default:throw new Error(`${this} color readback does not support ${this.dimension} textures`)}}_validateColorReadAspect(e){if(e.aspect!=="all")throw new Error(`${this} color readback only supports aspect 'all'`)}_validateColorReadFormat(e){if(e.compressed)throw new Error(`${this} color readback does not support compressed formats (${this.format})`);switch(e.attachment){case"color":return;case"depth":throw new Error(`${this} color readback does not support depth formats (${this.format})`);case"stencil":throw new Error(`${this} color readback does not support stencil formats (${this.format})`);case"depth-stencil":throw new Error(`${this} color readback does not support depth-stencil formats (${this.format})`);default:throw new Error(`${this} color readback does not support format ${this.format}`)}}_normalizeTextureWriteOptions(e){let t=_._omitUndefined(e),i=t.mipLevel??0,s=this._getMipLevelSize(i),n={..._.defaultTextureWriteOptions,...s,...t};n.width=Math.min(n.width,s.width-n.x),n.height=Math.min(n.height,s.height-n.y),n.depthOrArrayLayers=Math.min(n.depthOrArrayLayers,s.depthOrArrayLayers-n.z);let o=x.computeMemoryLayout({format:this.format,width:n.width,height:n.height,depth:n.depthOrArrayLayers,byteAlignment:this.byteAlignment}),a=o.bytesPerPixel*n.width;if(n.bytesPerRow=t.bytesPerRow??o.bytesPerRow,n.rowsPerImage=t.rowsPerImage??n.height,n.bytesPerRow<a)throw new Error(`bytesPerRow (${n.bytesPerRow}) must be at least ${a} for ${this.format}`);if(n.rowsPerImage<n.height)throw new Error(`rowsPerImage (${n.rowsPerImage}) must be at least ${n.height} for ${this.format}`);let c=this.device.getTextureFormatInfo(this.format).bytesPerPixel;if(c&&n.bytesPerRow%c!==0)throw new Error(`bytesPerRow (${n.bytesPerRow}) must be a multiple of bytesPerPixel (${c}) for ${this.format}`);return n}_getMipLevelSize(e){let t=Math.max(1,this.width>>e),i=this.baseDimension==="1d"?1:Math.max(1,this.height>>e),s=this.dimension==="3d"?Math.max(1,this.depth>>e):this.depth;return{width:t,height:i,depthOrArrayLayers:s}}getAllocatedByteLength(){let e=0;for(let t=0;t<this.mipLevels;t++){let{width:i,height:s,depthOrArrayLayers:n}=this._getMipLevelSize(t);e+=x.computeMemoryLayout({format:this.format,width:i,height:s,depth:n,byteAlignment:1}).byteLength}return e*this.samples}static _omitUndefined(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}},g=_;u(g,"SAMPLE",4),u(g,"STORAGE",8),u(g,"RENDER",16),u(g,"COPY_SRC",1),u(g,"COPY_DST",2),u(g,"TEXTURE",4),u(g,"RENDER_ATTACHMENT",16),u(g,"defaultProps",{...f.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:_.SAMPLE|_.RENDER|_.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),u(g,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,width:void 0,height:void 0,depthOrArrayLayers:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),u(g,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}),u(g,"defaultTextureReadOptions",{x:0,y:0,z:0,width:void 0,height:void 0,depthOrArrayLayers:1,mipLevel:0,aspect:"all"}),u(g,"defaultTextureWriteOptions",{byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,x:0,y:0,z:0,width:void 0,height:void 0,depthOrArrayLayers:1,mipLevel:0,aspect:"all"});var ft=class extends f{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,ft.defaultProps)}},ie=ft;u(ie,"defaultProps",{...f.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var lt=class extends f{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,lt.defaultProps)}},se=lt;u(se,"defaultProps",{...f.defaultProps,source:void 0,colorSpace:"srgb"});function nr(r,e,t){let i="",s=e.split(/\r?\n/),n=r.slice().sort((o,a)=>o.lineNum-a.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let a=1;a<=s.length;a++){let c=s[a-1],h=n[o];for(c&&h&&(i+=or(c,a,t));n.length>o&&h.lineNum===a;){let d=n[o++];d&&(i+=ht(d,s,d.lineNum,{...t,inlineSource:!1}))}}for(;n.length>o;){let a=n[o++];a&&(i+=ht(a,[],0,{...t,inlineSource:!1}))}return i;case"issues":case"no":for(let a of r)i+=ht(a,s,a.lineNum,{inlineSource:t?.showSourceCode!=="no"});return i}}function ht(r,e,t,i){if(i?.inlineSource){let n=wi(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
9
9
  `:"";return`
10
10
  ${n}${o}${r.type.toUpperCase()}: ${r.message}
11
11
 
12
- `}let s=r.type==="error"?"red":"orange";return i?.html?`<div class='luma-compiler-log-${r.type}' style="color:${s};"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function si(r,e,t){let i="";for(let s=e-2;s<=e;s++){let n=r[s-1];n!==void 0&&(i+=qt(n,e,t))}return i}function qt(r,e,t){let i=t?.html?oi(r):r;return`${ni(String(e),4)}: ${i}${t?.html?"<br/>":`
13
- `}`}function ni(r,e){let t="";for(let i=r.length;i<e;++i)t+=" ";return t+r}function oi(r){return r.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}var at=class extends l{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){t={...t,debugShaders:t.debugShaders||e.props.debugShaders||"errors"},super(e,{id:ai(t),...t},at.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){let e=this.props.debugShaders;switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let t=await this.getCompilationInfo();e==="warnings"&&t?.length===0||this._displayShaderLog(t,this.id)}_displayShaderLog(e,t){if(typeof document>"u"||!document?.createElement)return;let i=t,s=`${this.stage} shader "${i}"`,n=Xt(e,this.source,{showSourceCode:"all",html:!0}),o=this.getTranslatedSource(),a=document.createElement("div");a.innerHTML=`<h1>Compilation error in ${s}</h1>
12
+ `}let s=r.type==="error"?"red":"orange";return i?.html?`<div class='luma-compiler-log-${r.type}' style="color:${s};"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function wi(r,e,t){let i="";for(let s=e-2;s<=e;s++){let n=r[s-1];n!==void 0&&(i+=or(n,e,t))}return i}function or(r,e,t){let i=t?.html?vi(r):r;return`${Pi(String(e),4)}: ${i}${t?.html?"<br/>":`
13
+ `}`}function Pi(r,e){let t="";for(let i=r.length;i<e;++i)t+=" ";return t+r}function vi(r){return r.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}var dt=class extends f{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){t={...t,debugShaders:t.debugShaders||e.props.debugShaders||"errors"},super(e,{id:Si(t),...t},dt.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){let e=this.props.debugShaders;switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let t=await this.getCompilationInfo();e==="warnings"&&t?.length===0||this._displayShaderLog(t,this.id)}_displayShaderLog(e,t){if(typeof document>"u"||!document?.createElement)return;let i=t,s=`${this.stage} shader "${i}"`,n=nr(e,this.source,{showSourceCode:"all",html:!0}),o=this.getTranslatedSource(),a=document.createElement("div");a.innerHTML=`<h1>Compilation error in ${s}</h1>
14
14
  <div style="display:flex;position:fixed;top:10px;right:20px;gap:2px;">
15
15
  <button id="copy">Copy source</button><br/>
16
16
  <button id="close">Close</button>
17
17
  </div>
18
- <code><pre>${n}</pre></code>`,o&&(a.innerHTML+=`<br /><h1>Translated Source</h1><br /><br /><code><pre>${o}</pre></code>`),a.style.top="0",a.style.left="0",a.style.background="white",a.style.position="fixed",a.style.zIndex="9999",a.style.maxWidth="100vw",a.style.maxHeight="100vh",a.style.overflowY="auto",document.body.appendChild(a),a.querySelector(".luma-compiler-log-error")?.scrollIntoView(),a.querySelector("button#close").onclick=()=>{a.remove()},a.querySelector("button#copy").onclick=()=>{navigator.clipboard.writeText(this.source)}}},K=at;u(K,"defaultProps",{...l.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});function ai(r){return ci(r.source)||r.id||P(`unnamed ${r.stage}-shader`)}function ci(r,e="unnamed"){return/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r)?.[1]??e}var ct=class extends l{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,ct.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(s=>s.texture.clone(e)),i=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,...e,colorAttachments:t,depthStencilAttachment:i})}resize(e){let t=!e;if(e){let[i,s]=Array.isArray(e)?e:[e.width,e.height];t=t||s!==this.height||i!==this.width,this.width=i,this.height=s}t&&(f.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((t,i)=>{if(typeof t=="string"){let s=this.createColorTexture(t,i);return this.attachResource(s),s.view}return t instanceof g?t.view:t});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof g?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:g.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:g.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){if(this.colorAttachments.forEach((i,s)=>{let n=i.texture.clone({width:e,height:t});this.destroyAttachedResource(i),this.colorAttachments[s]=n.view,this.attachResource(n.view)}),this.depthStencilAttachment){let i=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}this.updateAttachments()}},J=ct;u(J,"defaultProps",{...l.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var ut=class extends l{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";sharedRenderPipeline=null;get isPending(){return this.linkStatus==="pending"||this.vs.compilationStatus==="pending"||this.fs?.compilationStatus==="pending"}get isErrored(){return this.linkStatus==="error"||this.vs.compilationStatus==="error"||this.fs?.compilationStatus==="error"}constructor(e,t){super(e,t,ut.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[],this.sharedRenderPipeline=this.props._sharedRenderPipeline||null}},Z=ut;u(Z,"defaultProps",{...l.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},varyings:void 0,bufferMode:void 0,disableWarnings:!1,_sharedRenderPipeline:void 0,bindings:void 0});var ke=class extends l{get[Symbol.toStringTag](){return"SharedRenderPipeline"}constructor(e,t){super(e,t,{...l.defaultProps,handle:void 0,vs:void 0,fs:void 0,varyings:void 0,bufferMode:void 0})}};var I=class extends l{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=I.normalizeProps(e,t),super(e,t,I.defaultProps)}static normalizeProps(e,t){return t}},C=I;u(C,"defaultClearColor",[0,0,0,1]),u(C,"defaultClearDepth",1),u(C,"defaultClearStencil",0),u(C,"defaultProps",{...l.defaultProps,framebuffer:null,parameters:void 0,clearColor:I.defaultClearColor,clearColors:void 0,clearDepth:I.defaultClearDepth,clearStencil:I.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var lt=class extends l{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,lt.defaultProps),this.shaderLayout=t.shaderLayout}},ee=lt;u(ee,"defaultProps",{...l.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var ft=class extends l{constructor(e,t){super(e,t,ft.defaultProps)}get[Symbol.toStringTag](){return"ComputePass"}},te=ft;u(te,"defaultProps",{...l.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var dt=class extends l{get[Symbol.toStringTag](){return"CommandEncoder"}_timeProfilingQuerySet=null;_timeProfilingSlotCount=0;_gpuTimeMs;constructor(e,t){super(e,t,dt.defaultProps),this._timeProfilingQuerySet=t.timeProfilingQuerySet??null,this._timeProfilingSlotCount=0,this._gpuTimeMs=void 0}async resolveTimeProfilingQuerySet(){if(this._gpuTimeMs=void 0,!this._timeProfilingQuerySet)return;let e=Math.floor(this._timeProfilingSlotCount/2);if(e<=0)return;let t=e*2,i=await this._timeProfilingQuerySet.readResults({firstQuery:0,queryCount:t}),s=0n;for(let n=0;n<t;n+=2)s+=i[n+1]-i[n];this._gpuTimeMs=Number(s)/1e6}getTimeProfilingSlotCount(){return this._timeProfilingSlotCount}getTimeProfilingQuerySet(){return this._timeProfilingQuerySet}_applyTimeProfilingToPassProps(e){let t=e||{};if(!this._supportsTimestampQueries()||!this._timeProfilingQuerySet||t.timestampQuerySet!==void 0||t.beginTimestampIndex!==void 0||t.endTimestampIndex!==void 0)return t;let i=this._timeProfilingSlotCount;return i+1>=this._timeProfilingQuerySet.props.count?t:(this._timeProfilingSlotCount+=2,{...t,timestampQuerySet:this._timeProfilingQuerySet,beginTimestampIndex:i,endTimestampIndex:i+1})}_supportsTimestampQueries(){return this.device.features.has("timestamp-query")}},re=dt;u(re,"defaultProps",{...l.defaultProps,measureExecutionTime:void 0,timeProfilingQuerySet:void 0});var ht=class extends l{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,ht.defaultProps)}},ie=ht;u(ie,"defaultProps",{...l.defaultProps});function Ue(r){let e=li(r),t=hi[e];if(!t)throw new Error(`Unsupported variable shader type: ${r}`);return t}function $e(r){let e=ui(r),t=di[e];if(!t)throw new Error(`Unsupported attribute shader type: ${r}`);let[i,s]=t,n=i==="i32"||i==="u32",o=i!=="u32",a=fi[i]*s;return{primitiveType:i,components:s,byteLength:a,integer:n,signed:o}}function ui(r){return Kt[r]||r}function li(r){return mi[r]||r}var fi={f32:4,f16:2,i32:4,u32:4},di={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]},hi={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},Kt={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},mi={...Kt,mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"};function mt(r,e){let t={};for(let i of r.attributes){let s=pi(r,e,i.name);s&&(t[i.name]=s)}return t}function Jt(r,e,t=16){let i=mt(r,e),s=new Array(t).fill(null);for(let n of Object.values(i))s[n.location]=n;return s}function pi(r,e,t){let i=gi(r,t),s=bi(e,t);if(!i)return null;let n=$e(i.type),o=Ft(n),a=s?.vertexFormat||o,c=L(a);return{attributeName:s?.attributeName||i.name,bufferName:s?.bufferName||i.name,location:i.location,shaderType:i.type,primitiveType:n.primitiveType,shaderComponents:n.components,vertexFormat:a,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:n.integer,stepMode:s?.stepMode||i.stepMode||"vertex",byteOffset:s?.byteOffset||0,byteStride:s?.byteStride||0}}function gi(r,e){let t=r.attributes.find(i=>i.name===e);return t||f.warn(`shader layout attribute "${e}" not present in shader`),t||null}function bi(r,e){yi(r);let t=xi(r,e);return t||(t=wi(r,e),t)?t:(f.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function yi(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&f.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function xi(r,e){for(let t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function wi(r,e){for(let t of r){let i=t.byteStride;if(typeof t.byteStride!="number")for(let n of t.attributes||[]){let o=L(n.format);i+=o.byteLength}let s=t.attributes?.find(n=>n.attribute===e);if(s)return{attributeName:s.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:s.format,byteOffset:s.byteOffset,byteStride:i}}return null}var pt=class extends l{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,pt.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=Jt(t.shaderLayout,t.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(new Error("constant attributes not supported"),this)()}},se=pt;u(se,"defaultProps",{...l.defaultProps,shaderLayout:void 0,bufferLayout:[]});var gt=class extends l{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,gt.defaultProps)}},ne=gt;u(ne,"defaultProps",{...l.defaultProps,layout:void 0,buffers:{}});var bt=class extends l{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,bt.defaultProps)}},oe=bt;u(oe,"defaultProps",{...l.defaultProps,type:void 0,count:void 0});var yt=class extends l{get[Symbol.toStringTag](){return"Fence"}constructor(e,t={}){super(e,t,yt.defaultProps)}},ae=yt;u(ae,"defaultProps",{...l.defaultProps});var xt=class extends l{get[Symbol.toStringTag](){return"PipelineLayout"}constructor(e,t){super(e,t,xt.defaultProps)}},ce=xt;u(ce,"defaultProps",{...l.defaultProps,shaderLayout:{attributes:[],bindings:[]}});var ze;function wt(r){return(!ze||ze.byteLength<r)&&(ze=new ArrayBuffer(r)),ze}function Zt(r,e){let t=wt(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}var vi=1024,F=class{layout={};byteLength;constructor(e,t={}){let i=0;for(let[s,n]of Object.entries(e))i=this._addToLayout(s,n,i,t?.[s]);i+=(4-i%4)%4,this.byteLength=Math.max(i*4,vi)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}getData(e){let t=wt(this.byteLength),i={i32:new Int32Array(t),u32:new Uint32Array(t),f32:new Float32Array(t),f16:new Uint16Array(t)};for(let[s,n]of Object.entries(e))this._writeCompositeValue(i,s,n);return new Uint8Array(t,0,this.byteLength)}_addToLayout(e,t,i,s=1){if(typeof t=="string"){let n=Ue(t),o=n.components*s,a=be(i,n.components);return this.layout[e]={offset:a,size:o,type:n.type},a+o}if(Array.isArray(t)){let n=t[0],o=s>1?s:t.length>1?t[1]:1,a=be(i,4);for(let c=0;c<o;c++)a=this._addToLayout(`${e}[${c}]`,n,a);return a}if(typeof t=="object"){let n=be(i,4);for(let[o,a]of Object.entries(t))n=this._addToLayout(`${e}.${o}`,a,n);return n}throw new Error(`Unsupported CompositeShaderType for ${e}`)}_writeCompositeValue(e,t,i){if(this.layout[t]){this._writeToBuffer(e,t,i);return}if(Array.isArray(i)){for(let s=0;s<i.length;s++){let n=i[s],o=`${t}[${s}]`;this._writeCompositeValue(e,o,n)}return}if(typeof i=="object"&&i!==null){for(let[s,n]of Object.entries(i)){let o=`${t}.${s}`;this._writeCompositeValue(e,o,n)}return}f.warn(`Unsupported uniform value for ${t}:`,i)()}_writeToBuffer(e,t,i){let s=this.layout[t];if(!s){f.warn(`Uniform ${t} not found in layout`)();return}let{type:n,size:o,offset:a}=s,c=e[n];o===1?c[a]=Number(i):c.set(i,a)}};function Ti(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Fe(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":Ti(r)}var _i=128;function er(r,e,t=16){if(r===e)return!0;let i=r,s=e;if(!Fe(i)||!Fe(s)||i.length!==s.length)return!1;let n=Math.min(t,_i);if(i.length>n)return!1;for(let o=0;o<i.length;++o)if(s[o]!==i[o])return!1;return!0}function tr(r){return Fe(r)?r.slice():r}var N=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(s=>s.type==="uniform"&&s.name===e?.name);if(!t)throw new Error(e?.name);let i=t;for(let s of i.uniforms||[])this.bindingLayout[s.name]=s}}setUniforms(e){for(let[t,i]of Object.entries(e))this._setUniform(t,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){er(this.uniforms[e],t)||(this.uniforms[e]=tr(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var Ne=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,i]of Object.entries(e)){let s=t,n=new F(i.uniformTypes??{},i.uniformSizes??{});this.uniformBufferLayouts.set(s,n);let o=new N({name:t});o.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(s,o)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,i]of Object.entries(e))this.uniformBlocks.get(t)?.setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,i){i&&this.setUniforms(i);let s=this.getUniformBufferByteLength(t),n=e.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:s}),o=this.getUniformBufferData(t);return n.write(o),n}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let i=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:i});this.uniformBuffers.set(t,s)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(t);e||=i}return e&&f.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),s=!1;if(i&&t?.needsRedraw){s||=t.needsRedraw;let n=this.getUniformBufferData(e);i=this.uniformBuffers.get(e),i?.write(n);let o=this.uniformBlocks.get(e)?.getAllUniforms();f.log(4,`Writing to uniform buffer ${String(e)}`,n,o)()}return s}};function vt(r,e,t,i=0){let s=y.getInfo(t),n=s.bytesPerPixel/s.components,{bytesPerImage:o}=e,a=o*i,c=e.bytesPerImage/n;switch(t){case"rgba8unorm":case"bgra8unorm":case"rgba8uint":return new Uint8Array(r,a,c);case"r8unorm":return new Uint8Array(r,a,c);case"r16uint":case"rgba16uint":return new Uint16Array(r,a,c);case"r32uint":case"rgba32uint":return new Uint32Array(r,a,c);case"r32float":return new Float32Array(r,a,c);case"rgba16float":return new Uint16Array(r,a,c);case"rgba32float":return new Float32Array(r,a,c);default:throw new Error(`Unsupported format: ${t}`)}}function rr(r,e,t,i,s=0){let o=e.bytesPerImage/e.bytesPerPixel,a=i.subarray(0,o);vt(r,e,t,s).set(a,0)}function ir(r,e,t,i){if(e<0||e>=r.width||t<0||t>=r.height)throw new Error("Coordinates out of bounds.");let s=t*r.bytesPerRow+e*r.bytesPerPixel,n=new DataView(r.arrayBuffer,s,r.bytesPerPixel),o=0,a=[];for(let c=0;c<4;c++){let d=i[c]??0;if(d<=0)a.push(0);else{let p=Pi(n,o,d);a.push(p),o+=d}}return[a[0]??0,a[1]??0,a[2]??0,a[3]??0]}function sr(r,e,t,i){let s=e;for(let n=0;n<4;n++){let o=t[n]??0,a=(1<<o)-1,c=(i[n]??0)&a;Si(r,s,o,c),s+=o}}function Pi(r,e,t){if(e%8===0){let s=e/8;if(t===8&&s+1<=r.byteLength)return r.getUint8(s);if(t===16&&s+2<=r.byteLength)return r.getUint16(s,!1);if(t===32&&s+4<=r.byteLength)return r.getUint32(s,!1)}let i=0;for(let s=0;s<t;s++){let n=e+s,o=Math.floor(n/8),a=n%8,d=r.getUint8(o)>>7-a&1;i=i<<1|d}return i}function Si(r,e,t,i){if(e%8===0){let s=e/8;if(t===8&&s+1<=r.byteLength){r.setUint8(s,i&255);return}else if(t===16&&s+2<=r.byteLength){r.setUint16(s,i&65535,!1);return}else if(t===32&&s+4<=r.byteLength){r.setUint32(s,i,!1);return}}for(let s=0;s<t;s++){let n=e+s,o=Math.floor(n/8),c=1<<7-n%8,d=i>>t-1-s&1,p=r.getUint8(o);p&=~c,d&&(p|=c),r.setUint8(o,p)}}return hr(Ei);})();
18
+ <code><pre>${n}</pre></code>`,o&&(a.innerHTML+=`<br /><h1>Translated Source</h1><br /><br /><code><pre>${o}</pre></code>`),a.style.top="0",a.style.left="0",a.style.background="white",a.style.position="fixed",a.style.zIndex="9999",a.style.maxWidth="100vw",a.style.maxHeight="100vh",a.style.overflowY="auto",document.body.appendChild(a),a.querySelector(".luma-compiler-log-error")?.scrollIntoView(),a.querySelector("button#close").onclick=()=>{a.remove()},a.querySelector("button#copy").onclick=()=>{navigator.clipboard.writeText(this.source)}}},G=dt;u(G,"defaultProps",{...f.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});function Si(r){return Ti(r.source)||r.id||v(`unnamed ${r.stage}-shader`)}function Ti(r,e="unnamed"){return/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r)?.[1]??e}var mt=class extends f{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,mt.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(s=>s.texture.clone(e)),i=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,...e,colorAttachments:t,depthStencilAttachment:i})}resize(e){let t=!e;if(e){let[i,s]=Array.isArray(e)?e:[e.width,e.height];t=t||s!==this.height||i!==this.width,this.width=i,this.height=s}t&&(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((t,i)=>{if(typeof t=="string"){let s=this.createColorTexture(t,i);return this.attachResource(s),s.view}return t instanceof g?t.view:t});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof g?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:g.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:g.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){if(this.colorAttachments.forEach((i,s)=>{let n=i.texture.clone({width:e,height:t});this.destroyAttachedResource(i),this.colorAttachments[s]=n.view,this.attachResource(n.view)}),this.depthStencilAttachment){let i=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}this.updateAttachments()}},ne=mt;u(ne,"defaultProps",{...f.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var pt=class extends f{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";sharedRenderPipeline=null;get isPending(){return this.linkStatus==="pending"||this.vs.compilationStatus==="pending"||this.fs?.compilationStatus==="pending"}get isErrored(){return this.linkStatus==="error"||this.vs.compilationStatus==="error"||this.fs?.compilationStatus==="error"}constructor(e,t){super(e,t,pt.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[],this.sharedRenderPipeline=this.props._sharedRenderPipeline||null}},T=pt;u(T,"defaultProps",{...f.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},varyings:void 0,bufferMode:void 0,disableWarnings:!1,_sharedRenderPipeline:void 0,bindings:void 0,bindGroups:void 0});var ze=class extends f{get[Symbol.toStringTag](){return"SharedRenderPipeline"}constructor(e,t){super(e,t,{...f.defaultProps,handle:void 0,vs:void 0,fs:void 0,varyings:void 0,bufferMode:void 0})}};var gt=class extends f{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,gt.defaultProps),this.shaderLayout=t.shaderLayout}},D=gt;u(D,"defaultProps",{...f.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var bt=class{static getDefaultPipelineFactory(e){let t=e.getModuleData("@luma.gl/core");return t.defaultPipelineFactory||=new bt(e),t.defaultPipelineFactory}device;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};_sharedRenderPipelineCache={};get[Symbol.toStringTag](){return"PipelineFactory"}toString(){return`PipelineFactory(${this.device.id})`}constructor(e){this.device=e}createRenderPipeline(e){if(!this.device.props._cachePipelines)return this.device.createRenderPipeline(e);let t={...T.defaultProps,...e},i=this._renderPipelineCache,s=this._hashRenderPipeline(t),n=i[s]?.resource;if(n)i[s].useCount++,this.device.props.debugFactories&&l.log(3,`${this}: ${i[s].resource} reused, count=${i[s].useCount}, (id=${e.id})`)();else{let o=this.device.type==="webgl"&&this.device.props._sharePipelines?this.createSharedRenderPipeline(t):void 0;n=this.device.createRenderPipeline({...t,id:t.id?`${t.id}-cached`:v("unnamed-cached"),_sharedRenderPipeline:o}),n.hash=s,i[s]={resource:n,useCount:1},this.device.props.debugFactories&&l.log(3,`${this}: ${n} created, count=${i[s].useCount}`)()}return n}createComputePipeline(e){if(!this.device.props._cachePipelines)return this.device.createComputePipeline(e);let t={...D.defaultProps,...e},i=this._computePipelineCache,s=this._hashComputePipeline(t),n=i[s]?.resource;return n?(i[s].useCount++,this.device.props.debugFactories&&l.log(3,`${this}: ${i[s].resource} reused, count=${i[s].useCount}, (id=${e.id})`)()):(n=this.device.createComputePipeline({...t,id:t.id?`${t.id}-cached`:void 0}),n.hash=s,i[s]={resource:n,useCount:1},this.device.props.debugFactories&&l.log(3,`${this}: ${n} created, count=${i[s].useCount}`)()),n}release(e){if(!this.device.props._cachePipelines){e.destroy();return}let t=this._getCache(e),i=e.hash;t[i].useCount--,t[i].useCount===0?(this._destroyPipeline(e),this.device.props.debugFactories&&l.log(3,`${this}: ${e} released and destroyed`)()):t[i].useCount<0?(l.error(`${this}: ${e} released, useCount < 0, resetting`)(),t[i].useCount=0):this.device.props.debugFactories&&l.log(3,`${this}: ${e} released, count=${t[i].useCount}`)()}createSharedRenderPipeline(e){let t=this._hashSharedRenderPipeline(e),i=this._sharedRenderPipelineCache[t];return i||(i={resource:this.device._createSharedRenderPipelineWebGL(e),useCount:0},this._sharedRenderPipelineCache[t]=i),i.useCount++,i.resource}releaseSharedRenderPipeline(e){if(!e.sharedRenderPipeline)return;let t=this._hashSharedRenderPipeline(e.sharedRenderPipeline.props),i=this._sharedRenderPipelineCache[t];i&&(i.useCount--,i.useCount===0&&(i.resource.destroy(),delete this._sharedRenderPipelineCache[t]))}_destroyPipeline(e){let t=this._getCache(e);return this.device.props._destroyPipelines?(delete t[e.hash],e.destroy(),e instanceof T&&this.releaseSharedRenderPipeline(e),!0):!1}_getCache(e){let t;if(e instanceof D&&(t=this._computePipelineCache),e instanceof T&&(t=this._renderPipelineCache),!t)throw new Error(`${this}`);if(!t[e.hash])throw new Error(`${this}: ${e} matched incorrect entry`);return t}_hashComputePipeline(e){let{type:t}=this.device,i=this._getHash(e.shader.source),s=this._getHash(JSON.stringify(e.shaderLayout));return`${t}/C/${i}SL${s}`}_hashRenderPipeline(e){let t=e.vs?this._getHash(e.vs.source):0,i=e.fs?this._getHash(e.fs.source):0,s=this._getWebGLVaryingHash(e),n=this._getHash(JSON.stringify(e.shaderLayout)),o=this._getHash(JSON.stringify(e.bufferLayout)),{type:a}=this.device;switch(a){case"webgl":let c=this._getHash(JSON.stringify(e.parameters));return`${a}/R/${t}/${i}V${s}T${e.topology}P${c}SL${n}BL${o}`;case"webgpu":default:let h=this._getHash(JSON.stringify({vertexEntryPoint:e.vertexEntryPoint,fragmentEntryPoint:e.fragmentEntryPoint})),d=this._getHash(JSON.stringify(e.parameters)),y=this._getWebGPUAttachmentHash(e);return`${a}/R/${t}/${i}V${s}T${e.topology}EP${h}P${d}SL${n}BL${o}A${y}`}}_hashSharedRenderPipeline(e){let t=e.vs?this._getHash(e.vs.source):0,i=e.fs?this._getHash(e.fs.source):0,s=this._getWebGLVaryingHash(e);return`webgl/S/${t}/${i}V${s}`}_getHash(e){return this._hashes[e]===void 0&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}_getWebGLVaryingHash(e){let{varyings:t=[],bufferMode:i=null}=e;return this._getHash(JSON.stringify({varyings:t,bufferMode:i}))}_getWebGPUAttachmentHash(e){let t=e.colorAttachmentFormats??[this.device.preferredColorFormat],i=e.parameters?.depthWriteEnabled?e.depthStencilAttachmentFormat||this.device.preferredDepthFormat:null;return this._getHash(JSON.stringify({colorAttachmentFormats:t,depthStencilAttachmentFormat:i}))}},oe=bt;u(oe,"defaultProps",{...T.defaultProps});var yt=class{static getDefaultShaderFactory(e){let t=e.getModuleData("@luma.gl/core");return t.defaultShaderFactory||=new yt(e),t.defaultShaderFactory}device;_cache={};get[Symbol.toStringTag](){return"ShaderFactory"}toString(){return`${this[Symbol.toStringTag]}(${this.device.id})`}constructor(e){this.device=e}createShader(e){if(!this.device.props._cacheShaders)return this.device.createShader(e);let t=this._hashShader(e),i=this._cache[t];if(i)i.useCount++,this.device.props.debugFactories&&l.log(3,`${this}: Reusing shader ${i.resource.id} count=${i.useCount}`)();else{let s=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[t]=i={resource:s,useCount:1},this.device.props.debugFactories&&l.log(3,`${this}: Created new shader ${s.id}`)()}return i.resource}release(e){if(!this.device.props._cacheShaders){e.destroy();return}let t=this._hashShader(e),i=this._cache[t];if(i)if(i.useCount--,i.useCount===0)this.device.props._destroyShaders&&(delete this._cache[t],i.resource.destroy(),this.device.props.debugFactories&&l.log(3,`${this}: Releasing shader ${e.id}, destroyed`)());else{if(i.useCount<0)throw new Error(`ShaderFactory: Shader ${e.id} released too many times`);this.device.props.debugFactories&&l.log(3,`${this}: Releasing shader ${e.id} count=${i.useCount}`)()}}_hashShader(e){return`${e.stage}:${e.source}`}},ae=yt;u(ae,"defaultProps",{...G.defaultProps});function xt(r,e,t){let i=r.bindings.find(s=>s.name===e||`${s.name.toLocaleLowerCase()}uniforms`===e.toLocaleLowerCase());return!i&&!t?.ignoreWarnings&&l.warn(`Binding ${e} not set: Not found in shader layout.`)(),i||null}function We(r,e){if(!e)return{};if(Ci(e))return Object.fromEntries(Object.entries(e).map(([s,n])=>[Number(s),{...n}]));let t={};for(let[i,s]of Object.entries(e)){let o=xt(r,i)?.group??0;t[o]||={},t[o][i]=s}return t}function ar(r){let e={};for(let t of Object.values(r))Object.assign(e,t);return e}function Ci(r){let e=Object.keys(r);return e.length>0&&e.every(t=>/^\d+$/.test(t))}var _t=class{device;_layoutCacheByPipeline=new WeakMap;_bindGroupCacheByLayout=new WeakMap;constructor(e){this.device=e}getBindGroups(e,t,i){if(this.device.type!=="webgpu"||e.shaderLayout.bindings.length===0)return{};let s=We(e.shaderLayout,t),n={};for(let o of Ai(e.shaderLayout.bindings)){let a=s[o],c=this._getBindGroupLayout(e,o);if(!a||Object.keys(a).length===0){Ei(e.shaderLayout.bindings,o)||(n[o]=this._getEmptyBindGroup(c,e.shaderLayout,o));continue}let h=i?.[o];if(h){let d=this._getLayoutBindGroupCache(c);if(d.bindGroupsBySource.has(h)){n[o]=d.bindGroupsBySource.get(h)||null;continue}let y=this.device._createBindGroupWebGPU(c,e.shaderLayout,a,o);d.bindGroupsBySource.set(h,y),n[o]=y}else n[o]=this.device._createBindGroupWebGPU(c,e.shaderLayout,a,o)}return n}_getBindGroupLayout(e,t){let i=this._layoutCacheByPipeline.get(e);return i||(i={},this._layoutCacheByPipeline.set(e,i)),i[t]||=this.device._createBindGroupLayoutWebGPU(e,t),i[t]}_getEmptyBindGroup(e,t,i){let s=this._getLayoutBindGroupCache(e);return s.emptyBindGroup||=this.device._createBindGroupWebGPU(e,t,{},i)||null,s.emptyBindGroup}_getLayoutBindGroupCache(e){let t=this._bindGroupCacheByLayout.get(e);return t||(t={bindGroupsBySource:new WeakMap},this._bindGroupCacheByLayout.set(e,t)),t}};function cr(r){return r._factories.bindGroupFactory||=new _t(r),r._factories.bindGroupFactory}function Ai(r){let e=r.reduce((t,i)=>Math.max(t,i.group),-1);return Array.from({length:e+1},(t,i)=>i)}function Ei(r,e){return r.some(t=>t.group===e)}var z=class extends f{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=z.normalizeProps(e,t),super(e,t,z.defaultProps)}static normalizeProps(e,t){return t}},$=z;u($,"defaultClearColor",[0,0,0,1]),u($,"defaultClearDepth",1),u($,"defaultClearStencil",0),u($,"defaultProps",{...f.defaultProps,framebuffer:null,parameters:void 0,clearColor:z.defaultClearColor,clearColors:void 0,clearDepth:z.defaultClearDepth,clearStencil:z.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var wt=class extends f{constructor(e,t){super(e,t,wt.defaultProps)}get[Symbol.toStringTag](){return"ComputePass"}},ce=wt;u(ce,"defaultProps",{...f.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Pt=class extends f{get[Symbol.toStringTag](){return"CommandEncoder"}_timeProfilingQuerySet=null;_timeProfilingSlotCount=0;_gpuTimeMs;constructor(e,t){super(e,t,Pt.defaultProps),this._timeProfilingQuerySet=t.timeProfilingQuerySet??null,this._timeProfilingSlotCount=0,this._gpuTimeMs=void 0}async resolveTimeProfilingQuerySet(){if(this._gpuTimeMs=void 0,!this._timeProfilingQuerySet)return;let e=Math.floor(this._timeProfilingSlotCount/2);if(e<=0)return;let t=e*2,i=await this._timeProfilingQuerySet.readResults({firstQuery:0,queryCount:t}),s=0n;for(let n=0;n<t;n+=2)s+=i[n+1]-i[n];this._gpuTimeMs=Number(s)/1e6}getTimeProfilingSlotCount(){return this._timeProfilingSlotCount}getTimeProfilingQuerySet(){return this._timeProfilingQuerySet}_applyTimeProfilingToPassProps(e){let t=e||{};if(!this._supportsTimestampQueries()||!this._timeProfilingQuerySet||t.timestampQuerySet!==void 0||t.beginTimestampIndex!==void 0||t.endTimestampIndex!==void 0)return t;let i=this._timeProfilingSlotCount;return i+1>=this._timeProfilingQuerySet.props.count?t:(this._timeProfilingSlotCount+=2,{...t,timestampQuerySet:this._timeProfilingQuerySet,beginTimestampIndex:i,endTimestampIndex:i+1})}_supportsTimestampQueries(){return this.device.features.has("timestamp-query")}},ue=Pt;u(ue,"defaultProps",{...f.defaultProps,measureExecutionTime:void 0,timeProfilingQuerySet:void 0});var vt=class extends f{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,vt.defaultProps)}},fe=vt;u(fe,"defaultProps",{...f.defaultProps});function le(r){let e=He(r),t=Mi[e];if(!t)throw new Error(`Unsupported variable shader type: ${r}`);return t}function Tt(r){let e=ur(r),t=Bi[e];if(!t)throw new Error(`Unsupported attribute shader type: ${r}`);let[i,s]=t,n=i==="i32"||i==="u32",o=i!=="u32",a=Li[i]*s;return{primitiveType:i,components:s,byteLength:a,integer:n,signed:o}}var St=class{getVariableShaderTypeInfo(e){return le(e)}getAttributeShaderTypeInfo(e){return Tt(e)}makeShaderAttributeType(e,t){return Ri(e,t)}resolveAttributeShaderTypeAlias(e){return ur(e)}resolveVariableShaderTypeAlias(e){return He(e)}};function Ri(r,e){return e===1?r:`vec${e}<${r}>`}function ur(r){return Di[r]||r}function He(r){return $i[r]||r}var Ne=new St,Li={f32:4,f16:2,i32:4,u32:4},Bi={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]},Mi={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},Di={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},$i={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>",mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"};function Ct(r,e){let t={};for(let i of r.attributes){let s=Ii(r,e,i.name);s&&(t[i.name]=s)}return t}function fr(r,e,t=16){let i=Ct(r,e),s=new Array(t).fill(null);for(let n of Object.values(i))s[n.location]=n;return s}function Ii(r,e,t){let i=Ui(r,t),s=Oi(e,t);if(!i)return null;let n=Ne.getAttributeShaderTypeInfo(i.type),o=B.getCompatibleVertexFormat(n),a=s?.vertexFormat||o,c=B.getVertexFormatInfo(a);return{attributeName:s?.attributeName||i.name,bufferName:s?.bufferName||i.name,location:i.location,shaderType:i.type,primitiveType:n.primitiveType,shaderComponents:n.components,vertexFormat:a,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:n.integer,stepMode:s?.stepMode||i.stepMode||"vertex",byteOffset:s?.byteOffset||0,byteStride:s?.byteStride||0}}function Ui(r,e){let t=r.attributes.find(i=>i.name===e);return t||l.warn(`shader layout attribute "${e}" not present in shader`),t||null}function Oi(r,e){ki(r);let t=Fi(r,e);return t||(t=Gi(r,e),t)?t:(l.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function ki(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Fi(r,e){for(let t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function Gi(r,e){for(let t of r){let i=t.byteStride;if(typeof t.byteStride!="number")for(let n of t.attributes||[]){let o=B.getVertexFormatInfo(n.format);i+=o.byteLength}let s=t.attributes?.find(n=>n.attribute===e);if(s)return{attributeName:s.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:s.format,byteOffset:s.byteOffset,byteStride:i}}return null}var At=class extends f{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,At.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=fr(t.shaderLayout,t.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(new Error("constant attributes not supported"),this)()}},he=At;u(he,"defaultProps",{...f.defaultProps,shaderLayout:void 0,bufferLayout:[]});var Et=class extends f{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Et.defaultProps)}},de=Et;u(de,"defaultProps",{...f.defaultProps,layout:void 0,buffers:{}});var Rt=class extends f{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,Rt.defaultProps)}},me=Rt;u(me,"defaultProps",{...f.defaultProps,type:void 0,count:void 0});var Lt=class extends f{get[Symbol.toStringTag](){return"Fence"}constructor(e,t={}){super(e,t,Lt.defaultProps)}},pe=Lt;u(pe,"defaultProps",{...f.defaultProps});var Bt=class extends f{get[Symbol.toStringTag](){return"PipelineLayout"}constructor(e,t){super(e,t,Bt.defaultProps)}},ge=Bt;u(ge,"defaultProps",{...f.defaultProps,shaderLayout:{attributes:[],bindings:[]}});function C(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}function lr(r){let[,,,,e]=zi[r];return e}var zi={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]};var Ve;function Mt(r){return(!Ve||Ve.byteLength<r)&&(Ve=new ArrayBuffer(r)),Ve}function hr(r,e){let t=Mt(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function Wi(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function j(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":Wi(r)}var Hi=1024,Q=class{layout={};uniformTypes;byteLength;constructor(e){this.uniformTypes={...e};let t=0;for(let[i,s]of Object.entries(this.uniformTypes))t=this._addToLayout(i,s,t);t=C(t,4),this.byteLength=Math.max(t*4,Hi)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}getFlatUniformValues(e){let t={};for(let[i,s]of Object.entries(e)){let n=this.uniformTypes[i];n?this._flattenCompositeValue(t,i,n,s):this.layout[i]&&(t[i]=s)}return t}getData(e){let t=Mt(this.byteLength);new Uint8Array(t,0,this.byteLength).fill(0);let i={i32:new Int32Array(t),u32:new Uint32Array(t),f32:new Float32Array(t),f16:new Uint16Array(t)},s=this.getFlatUniformValues(e);for(let[n,o]of Object.entries(s))this._writeLeafValue(i,n,o);return new Uint8Array(t,0,this.byteLength)}_addToLayout(e,t,i){if(typeof t=="string"){let s=je(t),n=C(i,s.alignment);return this.layout[e]={offset:n,...s},n+s.size}if(Array.isArray(t)){if(Array.isArray(t[0]))throw new Error(`Nested arrays are not supported for ${e}`);let s=t[0],n=t[1],o=C(Dt(s),4),a=C(i,4);for(let c=0;c<n;c++)this._addToLayout(`${e}[${c}]`,s,a+c*o);return a+o*n}if(dr(t)){let s=C(i,4);for(let[n,o]of Object.entries(t))s=this._addToLayout(`${e}.${n}`,o,s);return C(s,4)}throw new Error(`Unsupported CompositeShaderType for ${e}`)}_flattenCompositeValue(e,t,i,s){if(s!==void 0){if(typeof i=="string"||this.layout[t]){e[t]=s;return}if(Array.isArray(i)){let n=i[0],o=i[1];if(Array.isArray(n))throw new Error(`Nested arrays are not supported for ${t}`);if(typeof n=="string"&&j(s)){this._flattenPackedArray(e,t,n,o,s);return}if(!Array.isArray(s)){l.warn(`Unsupported uniform array value for ${t}:`,s)();return}for(let a=0;a<Math.min(s.length,o);a++){let c=s[a];c!==void 0&&this._flattenCompositeValue(e,`${t}[${a}]`,n,c)}return}if(dr(i)&&Vi(s)){for(let[n,o]of Object.entries(s)){if(o===void 0)continue;let a=`${t}.${n}`;this._flattenCompositeValue(e,a,i[n],o)}return}l.warn(`Unsupported uniform value for ${t}:`,s)()}}_flattenPackedArray(e,t,i,s,n){let o=n,c=je(i).components;for(let h=0;h<s;h++){let d=h*c;if(d>=o.length)break;c===1?e[`${t}[${h}]`]=Number(o[d]):e[`${t}[${h}]`]=ji(n,d,d+c)}}_writeLeafValue(e,t,i){let s=this.layout[t];if(!s){l.warn(`Uniform ${t} not found in layout`)();return}let{type:n,components:o,columns:a,rows:c,offset:h}=s,d=e[n];if(o===1){d[h]=Number(i);return}let y=i;if(a===1){for(let P=0;P<o;P++)d[h+P]=Number(y[P]??0);return}let X=0;for(let P=0;P<a;P++){let q=h+P*4;for(let I=0;I<c;I++)d[q+I]=Number(y[X++]??0)}}};function Dt(r){if(typeof r=="string")return je(r).size;if(Array.isArray(r)){let t=r[0],i=r[1];if(Array.isArray(t))throw new Error("Nested arrays are not supported");return C(Dt(t),4)*i}let e=0;for(let t of Object.values(r)){let i=t;e=C(e,Ni(i)),e+=Dt(i)}return C(e,4)}function Ni(r){return typeof r=="string"?je(r).alignment:(Array.isArray(r),4)}function je(r){let e=He(r),t=le(e),i=/^mat(\d)x(\d)<.+>$/.exec(e);if(i){let n=Number(i[1]),o=Number(i[2]);return{alignment:4,size:n*4,components:n*o,columns:n,rows:o,shaderType:e,type:t.type}}let s=/^vec(\d)<.+>$/.exec(e);if(s){let n=Number(s[1]);return{alignment:n===2?2:4,size:n===3?4:n,components:n,columns:1,rows:n,shaderType:e,type:t.type}}return{alignment:1,size:1,components:1,columns:1,rows:1,shaderType:e,type:t.type}}function dr(r){return Boolean(r)&&typeof r=="object"&&!Array.isArray(r)}function Vi(r){return Boolean(r)&&typeof r=="object"&&!Array.isArray(r)&&!ArrayBuffer.isView(r)}function ji(r,e,t){return Array.prototype.slice.call(r,e,t)}var Qi=128;function mr(r,e,t=16){if(r===e)return!0;let i=r,s=e;if(!j(i)||!j(s)||i.length!==s.length)return!1;let n=Math.min(t,Qi);if(i.length>n)return!1;for(let o=0;o<i.length;++o)if(s[o]!==i[o])return!1;return!0}function pr(r){return j(r)?r.slice():r}var Y=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(s=>s.type==="uniform"&&s.name===e?.name);if(!t)throw new Error(e?.name);let i=t;for(let s of i.uniforms||[])this.bindingLayout[s.name]=s}}setUniforms(e){for(let[t,i]of Object.entries(e))this._setUniform(t,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){mr(this.uniforms[e],t)||(this.uniforms[e]=pr(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var Qe=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,i]of Object.entries(e)){let s=t,n=new Q(i.uniformTypes??{});this.uniformBufferLayouts.set(s,n);let o=new Y({name:t});o.setUniforms(n.getFlatUniformValues(i.defaultUniforms||{})),this.uniformBlocks.set(s,o)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,i]of Object.entries(e)){let s=t,o=this.uniformBufferLayouts.get(s)?.getFlatUniformValues(i||{});this.uniformBlocks.get(s)?.setUniforms(o||{})}this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,i){i&&this.setUniforms(i);let s=this.getUniformBufferByteLength(t),n=e.createBuffer({usage:p.UNIFORM|p.COPY_DST,byteLength:s}),o=this.getUniformBufferData(t);return n.write(o),n}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let i=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:p.UNIFORM|p.COPY_DST,byteLength:i});this.uniformBuffers.set(t,s)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(t);e||=i}return e&&l.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),s=!1;if(i&&t?.needsRedraw){s||=t.needsRedraw;let n=this.getUniformBufferData(e);i=this.uniformBuffers.get(e),i?.write(n);let o=this.uniformBlocks.get(e)?.getAllUniforms();l.log(4,`Writing to uniform buffer ${String(e)}`,n,o)()}return s}};function $t(r,e,t,i=0){let s=x.getInfo(t),n=s.bytesPerPixel/s.components,{bytesPerImage:o}=e,a=o*i,c=e.bytesPerImage/n;switch(t){case"rgba8unorm":case"bgra8unorm":case"rgba8uint":return new Uint8Array(r,a,c);case"r8unorm":return new Uint8Array(r,a,c);case"r16uint":case"rgba16uint":return new Uint16Array(r,a,c);case"r32uint":case"rgba32uint":return new Uint32Array(r,a,c);case"r32float":return new Float32Array(r,a,c);case"rgba16float":return new Uint16Array(r,a,c);case"rgba32float":return new Float32Array(r,a,c);default:throw new Error(`Unsupported format: ${t}`)}}function gr(r,e,t,i,s=0){let o=e.bytesPerImage/e.bytesPerPixel,a=i.subarray(0,o);$t(r,e,t,s).set(a,0)}function br(r,e,t,i){if(e<0||e>=r.width||t<0||t>=r.height)throw new Error("Coordinates out of bounds.");let s=t*r.bytesPerRow+e*r.bytesPerPixel,n=new DataView(r.arrayBuffer,s,r.bytesPerPixel),o=0,a=[];for(let c=0;c<4;c++){let h=i[c]??0;if(h<=0)a.push(0);else{let d=Yi(n,o,h);a.push(d),o+=h}}return[a[0]??0,a[1]??0,a[2]??0,a[3]??0]}function yr(r,e,t,i){let s=e;for(let n=0;n<4;n++){let o=t[n]??0,a=(1<<o)-1,c=(i[n]??0)&a;Xi(r,s,o,c),s+=o}}function Yi(r,e,t){if(e%8===0){let s=e/8;if(t===8&&s+1<=r.byteLength)return r.getUint8(s);if(t===16&&s+2<=r.byteLength)return r.getUint16(s,!1);if(t===32&&s+4<=r.byteLength)return r.getUint32(s,!1)}let i=0;for(let s=0;s<t;s++){let n=e+s,o=Math.floor(n/8),a=n%8,h=r.getUint8(o)>>7-a&1;i=i<<1|h}return i}function Xi(r,e,t,i){if(e%8===0){let s=e/8;if(t===8&&s+1<=r.byteLength){r.setUint8(s,i&255);return}else if(t===16&&s+2<=r.byteLength){r.setUint16(s,i&65535,!1);return}else if(t===32&&s+4<=r.byteLength){r.setUint32(s,i,!1);return}}for(let s=0;s<t;s++){let n=e+s,o=Math.floor(n/8),c=1<<7-n%8,h=i>>t-1-s&1,d=r.getUint8(o);d&=~c,h&&(d|=c),r.setUint8(o,d)}}return Cr(qi);})();
19
19
  return __exports__;
20
20
  });
@@ -0,0 +1,20 @@
1
+ import type { Bindings, BindingsByGroup } from "../adapter/types/shader-layout.js";
2
+ import type { Device } from "../adapter/device.js";
3
+ import type { ComputePipeline } from "../adapter/resources/compute-pipeline.js";
4
+ import type { RenderPipeline } from "../adapter/resources/render-pipeline.js";
5
+ type AnyPipeline = RenderPipeline | ComputePipeline;
6
+ type BindGroupCacheKeys = Partial<Record<number, object>>;
7
+ type BindGroupMap = Partial<Record<number, unknown>>;
8
+ export declare class BindGroupFactory {
9
+ readonly device: Device;
10
+ private readonly _layoutCacheByPipeline;
11
+ private readonly _bindGroupCacheByLayout;
12
+ constructor(device: Device);
13
+ getBindGroups(pipeline: AnyPipeline, bindings?: Bindings | BindingsByGroup, bindGroupCacheKeys?: BindGroupCacheKeys): BindGroupMap;
14
+ private _getBindGroupLayout;
15
+ private _getEmptyBindGroup;
16
+ private _getLayoutBindGroupCache;
17
+ }
18
+ export declare function _getDefaultBindGroupFactory(device: Device): BindGroupFactory;
19
+ export {};
20
+ //# sourceMappingURL=bind-group-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind-group-factory.d.ts","sourceRoot":"","sources":["../../src/factories/bind-group-factory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EAGhB,0CAAuC;AACxC,OAAO,KAAK,EAAC,MAAM,EAAC,6BAA0B;AAC9C,OAAO,KAAK,EAAC,eAAe,EAAC,iDAA8C;AAC3E,OAAO,KAAK,EAAC,cAAc,EAAC,gDAA6C;AAGzE,KAAK,WAAW,GAAG,cAAc,GAAG,eAAe,CAAC;AAEpD,KAAK,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1D,KAAK,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAOrD,qBAAa,gBAAgB;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAoD;IAC3F,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAwD;gBAEpF,MAAM,EAAE,MAAM;IAI1B,aAAa,CACX,QAAQ,EAAE,WAAW,EACrB,QAAQ,CAAC,EAAE,QAAQ,GAAG,eAAe,EACrC,kBAAkB,CAAC,EAAE,kBAAkB,GACtC,YAAY;IAoDf,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,wBAAwB;CAQjC;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAG5E"}
@@ -0,0 +1,79 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { normalizeBindingsByGroup } from "../adapter-utils/bind-groups.js";
5
+ export class BindGroupFactory {
6
+ device;
7
+ _layoutCacheByPipeline = new WeakMap();
8
+ _bindGroupCacheByLayout = new WeakMap();
9
+ constructor(device) {
10
+ this.device = device;
11
+ }
12
+ getBindGroups(pipeline, bindings, bindGroupCacheKeys) {
13
+ if (this.device.type !== 'webgpu' || pipeline.shaderLayout.bindings.length === 0) {
14
+ return {};
15
+ }
16
+ const bindingsByGroup = normalizeBindingsByGroup(pipeline.shaderLayout, bindings);
17
+ const resolvedBindGroups = {};
18
+ for (const group of getBindGroupIndicesUpToMax(pipeline.shaderLayout.bindings)) {
19
+ const groupBindings = bindingsByGroup[group];
20
+ const bindGroupLayout = this._getBindGroupLayout(pipeline, group);
21
+ if (!groupBindings || Object.keys(groupBindings).length === 0) {
22
+ if (!hasBindingsInGroup(pipeline.shaderLayout.bindings, group)) {
23
+ resolvedBindGroups[group] = this._getEmptyBindGroup(bindGroupLayout, pipeline.shaderLayout, group);
24
+ }
25
+ continue;
26
+ }
27
+ const bindGroupCacheKey = bindGroupCacheKeys?.[group];
28
+ if (bindGroupCacheKey) {
29
+ const layoutCache = this._getLayoutBindGroupCache(bindGroupLayout);
30
+ if (layoutCache.bindGroupsBySource.has(bindGroupCacheKey)) {
31
+ resolvedBindGroups[group] = layoutCache.bindGroupsBySource.get(bindGroupCacheKey) || null;
32
+ continue;
33
+ }
34
+ const bindGroup = this.device._createBindGroupWebGPU(bindGroupLayout, pipeline.shaderLayout, groupBindings, group);
35
+ layoutCache.bindGroupsBySource.set(bindGroupCacheKey, bindGroup);
36
+ resolvedBindGroups[group] = bindGroup;
37
+ }
38
+ else {
39
+ resolvedBindGroups[group] = this.device._createBindGroupWebGPU(bindGroupLayout, pipeline.shaderLayout, groupBindings, group);
40
+ }
41
+ }
42
+ return resolvedBindGroups;
43
+ }
44
+ _getBindGroupLayout(pipeline, group) {
45
+ let layoutCache = this._layoutCacheByPipeline.get(pipeline);
46
+ if (!layoutCache) {
47
+ layoutCache = {};
48
+ this._layoutCacheByPipeline.set(pipeline, layoutCache);
49
+ }
50
+ layoutCache[group] ||= this.device._createBindGroupLayoutWebGPU(pipeline, group);
51
+ return layoutCache[group];
52
+ }
53
+ _getEmptyBindGroup(bindGroupLayout, shaderLayout, group) {
54
+ const layoutCache = this._getLayoutBindGroupCache(bindGroupLayout);
55
+ layoutCache.emptyBindGroup ||=
56
+ this.device._createBindGroupWebGPU(bindGroupLayout, shaderLayout, {}, group) || null;
57
+ return layoutCache.emptyBindGroup;
58
+ }
59
+ _getLayoutBindGroupCache(bindGroupLayout) {
60
+ let layoutCache = this._bindGroupCacheByLayout.get(bindGroupLayout);
61
+ if (!layoutCache) {
62
+ layoutCache = { bindGroupsBySource: new WeakMap() };
63
+ this._bindGroupCacheByLayout.set(bindGroupLayout, layoutCache);
64
+ }
65
+ return layoutCache;
66
+ }
67
+ }
68
+ export function _getDefaultBindGroupFactory(device) {
69
+ device._factories.bindGroupFactory ||= new BindGroupFactory(device);
70
+ return device._factories.bindGroupFactory;
71
+ }
72
+ function getBindGroupIndicesUpToMax(bindings) {
73
+ const maxGroup = bindings.reduce((highestGroup, binding) => Math.max(highestGroup, binding.group), -1);
74
+ return Array.from({ length: maxGroup + 1 }, (_, group) => group);
75
+ }
76
+ function hasBindingsInGroup(bindings, group) {
77
+ return bindings.some(binding => binding.group === group);
78
+ }
79
+ //# sourceMappingURL=bind-group-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind-group-factory.js","sourceRoot":"","sources":["../../src/factories/bind-group-factory.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAWpC,OAAO,EAAC,wBAAwB,EAAC,wCAAqC;AAYtE,MAAM,OAAO,gBAAgB;IAClB,MAAM,CAAS;IAEP,sBAAsB,GAAsC,IAAI,OAAO,EAAE,CAAC;IAC1E,uBAAuB,GAA0C,IAAI,OAAO,EAAE,CAAC;IAEhG,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,aAAa,CACX,QAAqB,EACrB,QAAqC,EACrC,kBAAuC;QAEvC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjF,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,eAAe,GAAG,wBAAwB,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAClF,MAAM,kBAAkB,GAAiB,EAAE,CAAC;QAE5C,KAAK,MAAM,KAAK,IAAI,0BAA0B,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/E,MAAM,aAAa,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YAC7C,MAAM,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YAElE,IAAI,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC9D,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;oBAC/D,kBAAkB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,kBAAkB,CACjD,eAAe,EACf,QAAQ,CAAC,YAAY,EACrB,KAAK,CACN,CAAC;gBACJ,CAAC;gBACD,SAAS;YACX,CAAC;YAED,MAAM,iBAAiB,GAAG,kBAAkB,EAAE,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,iBAAiB,EAAE,CAAC;gBACtB,MAAM,WAAW,GAAG,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,CAAC;gBACnE,IAAI,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;oBAC1D,kBAAkB,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,IAAI,CAAC;oBAC1F,SAAS;gBACX,CAAC;gBAED,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAClD,eAAe,EACf,QAAQ,CAAC,YAAY,EACrB,aAAa,EACb,KAAK,CACN,CAAC;gBACF,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;gBACjE,kBAAkB,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;YACxC,CAAC;iBAAM,CAAC;gBACN,kBAAkB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAC5D,eAAe,EACf,QAAQ,CAAC,YAAY,EACrB,aAAa,EACb,KAAK,CACN,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAEO,mBAAmB,CAAC,QAAqB,EAAE,KAAa;QAC9D,IAAI,WAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5D,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,EAAE,CAAC;YACjB,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACzD,CAAC;QAED,WAAW,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,QAAQ,EAAE,KAAK,CAAW,CAAC;QAC3F,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAEO,kBAAkB,CACxB,eAAuB,EACvB,YAA6B,EAC7B,KAAa;QAEb,MAAM,WAAW,GAAG,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,CAAC;QACnE,WAAW,CAAC,cAAc;YACxB,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,eAAe,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC;QACvF,OAAO,WAAW,CAAC,cAAc,CAAC;IACpC,CAAC;IAEO,wBAAwB,CAAC,eAAuB;QACtD,IAAI,WAAW,GAAG,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACpE,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,EAAC,kBAAkB,EAAE,IAAI,OAAO,EAAE,EAAC,CAAC;YAClD,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AAED,MAAM,UAAU,2BAA2B,CAAC,MAAc;IACxD,MAAM,CAAC,UAAU,CAAC,gBAAgB,KAAK,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACpE,OAAO,MAAM,CAAC,UAAU,CAAC,gBAAoC,CAAC;AAChE,CAAC;AAED,SAAS,0BAA0B,CAAC,QAAqC;IACvE,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAC9B,CAAC,YAAY,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC,EAChE,CAAC,CAAC,CACH,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,QAAQ,GAAG,CAAC,EAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAqC,EAAE,KAAa;IAC9E,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { PipelineFactory } from "./pipeline-factory.js";
2
+ import type { ShaderFactory } from "./shader-factory.js";
3
+ export type CoreModuleState = {
4
+ defaultPipelineFactory?: PipelineFactory;
5
+ defaultShaderFactory?: ShaderFactory;
6
+ };
7
+ //# sourceMappingURL=core-module-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-module-state.d.ts","sourceRoot":"","sources":["../../src/factories/core-module-state.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,8BAA2B;AACxD,OAAO,KAAK,EAAC,aAAa,EAAC,4BAAyB;AAEpD,MAAM,MAAM,eAAe,GAAG;IAC5B,sBAAsB,CAAC,EAAE,eAAe,CAAC;IACzC,oBAAoB,CAAC,EAAE,aAAa,CAAC;CACtC,CAAC"}
@@ -2,4 +2,4 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
  export {};
5
- //# sourceMappingURL=shader-types.js.map
5
+ //# sourceMappingURL=core-module-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-module-state.js","sourceRoot":"","sources":["../../src/factories/core-module-state.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC"}