@luma.gl/engine 9.0.0-alpha.41 → 9.0.0-alpha.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -5650,7 +5650,7 @@ ${stage === "fragment" ? FRAGMENT_SHADER_PROLOGUE : ""}
5650
5650
  const uniforms = this._getModuleUniforms(props);
5651
5651
  const keys = Object.keys(uniforms).filter((k) => {
5652
5652
  const uniform = uniforms[k];
5653
- return !Array.isArray(uniform) && typeof uniform !== "number" && typeof uniform !== "boolean";
5653
+ return !isNumberArray(uniform) && typeof uniform !== "number" && typeof uniform !== "boolean";
5654
5654
  });
5655
5655
  const bindings = {};
5656
5656
  for (const k of keys) {
package/dist/index.cjs CHANGED
@@ -997,7 +997,7 @@ var _Model = class {
997
997
  const uniforms = this._getModuleUniforms(props);
998
998
  const keys = Object.keys(uniforms).filter((k) => {
999
999
  const uniform = uniforms[k];
1000
- return !Array.isArray(uniform) && typeof uniform !== "number" && typeof uniform !== "boolean";
1000
+ return !(0, import_core6.isNumberArray)(uniform) && typeof uniform !== "number" && typeof uniform !== "boolean";
1001
1001
  });
1002
1002
  const bindings = {};
1003
1003
  for (const k of keys) {
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAsB,MAAM,eAAe,CAAC;AAE9F,OAAO,KAAK,EAAC,YAAY,EAAe,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CA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iB,GAAG,IAAI;IAO9C;;;OAGG;IACH,eAAe,CAAC,YAAY,EAAE,YAAY,EAAE,GAAG,IAAI;IAqBnD;;;;OAIG;IACH,aAAa,CAAC,UAAU,EAAE,wBAAwB;IASlD;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIzC;;;OAGG;IACH,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAI7C;;OAEG;IACH,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAmBtD;;OAEG;IACH,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAItD;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIpD;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI;IAKzD;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIhD;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAgCpD;;;;;;;OAOG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAWnE,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI7C,eAAe,IAAI,cAAc;CAqBlC"}
@@ -1,4 +1,4 @@
1
- import { RenderPipeline, log, uid, deepEqual } from '@luma.gl/core';
1
+ import { RenderPipeline, log, uid, deepEqual, isNumberArray } from '@luma.gl/core';
2
2
  import { getAttributeInfosFromLayouts } from '@luma.gl/core';
3
3
  import { ShaderAssembler } from '@luma.gl/shadertools';
4
4
  import { makeGPUGeometry } from "../geometry/gpu-geometry.js";
@@ -157,7 +157,7 @@ export class Model {
157
157
  const uniforms = this._getModuleUniforms(props);
158
158
  const keys = Object.keys(uniforms).filter(k => {
159
159
  const uniform = uniforms[k];
160
- return !Array.isArray(uniform) && typeof uniform !== 'number' && typeof uniform !== 'boolean';
160
+ return !isNumberArray(uniform) && typeof uniform !== 'number' && typeof uniform !== 'boolean';
161
161
  });
162
162
  const bindings = {};
163
163
  for (const k of keys) {
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","names":["RenderPipeline","log","uid","deepEqual","getAttributeInfosFromLayouts","ShaderAssembler","makeGPUGeometry","PipelineFactory","Model","constructor","device","props","id","vs","fs","pipelineFactory","userData","parameters","topology","bufferLayout","vertexCount","instanceCount","indexBuffer","bufferAttributes","constantAttributes","bindings","uniforms","pipeline","vertexArray","_pipelineNeedsUpdate","_attributeInfos","_gpuGeometry","_getModuleUniforms","defaultProps","Object","assign","platformInfo","type","info","shaderLanguage","shadingLanguages","gpu","features","getUniforms","shaderAssembler","assembleShaders","geometry","setGeometry","getDefaultPipelineFactory","_updatePipeline","createVertexArray","renderPipeline","_setGeometryAttributes","setVertexCount","setInstanceCount","indices","Error","setIndexBuffer","attributes","setAttributes","setConstantAttributes","setBindings","setUniforms","moduleSettings","updateModuleSettings","seal","destroy","release","draw","renderPass","gpuGeometry","setTopology","mergeBufferLayouts","_setPipelineNeedsUpdate","setBufferLayout","setParameters","setShaderModuleProps","keys","filter","k","uniform","Array","isArray","buffers","warn","bufferName","buffer","entries","_bufferLayout$attribu","find","layout","name","attributeNames","map","attribute","set","attributeName","attributeInfo","setBuffer","location","value","setConstant","reason","createRenderPipeline","createShader","stage","source","shaderLayout","handle","undefined","defines","modules","getDefaultShaderAssembler","layouts1","layouts2","layouts","index","findIndex","attribute2","push"],"sources":["../../src/model/model.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {\n TypedArray,\n RenderPipelineProps,\n RenderPipelineParameters,\n BufferLayout,\n VertexArray,\n AttributeInfo\n} from '@luma.gl/core';\nimport type {Binding, UniformValue, PrimitiveTopology} from '@luma.gl/core';\nimport {Device, Buffer, RenderPipeline, RenderPass, log, uid, deepEqual} from '@luma.gl/core';\nimport {getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';\nimport {ShaderAssembler} from '@luma.gl/shadertools';\nimport type {Geometry} from '../geometry/geometry';\nimport {GPUGeometry, makeGPUGeometry} from '../geometry/gpu-geometry';\nimport {PipelineFactory} from '../lib/pipeline-factory';\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Model also accepts a string shaders\n vs: {glsl?: string; wgsl?: string} | string | null;\n fs: {glsl?: string; wgsl?: string} | string | null;\n /** shadertool shader modules (added to shader code) */\n modules?: ShaderModule[];\n /** Shadertool module defines (configures shader code)*/\n defines?: Record<string, string | number | boolean>;\n // TODO - injections, hooks etc?\n\n /** pipeline factory to use to create render pipelines. Defaults to default factory for the device */\n pipelineFactory?: PipelineFactory;\n /** Shader assembler. Defaults to the ShaderAssembler.getShaderAssembler() */\n shaderAssembler?: ShaderAssembler;\n\n /** Parameters that are built into the pipeline */\n parameters?: RenderPipelineParameters;\n\n /** Geometry */\n geometry?: GPUGeometry | Geometry | null;\n\n /** Vertex count */\n vertexCount?: number;\n /** instance count */\n instanceCount?: number;\n\n indexBuffer?: Buffer | null;\n /** @note this is really a map of buffers, not a map of attributes */\n attributes?: Record<string, Buffer>;\n /** */\n constantAttributes?: Record<string, TypedArray>;\n\n /** Mapped uniforms for shadertool modules */\n moduleSettings?: Record<string, Record<string, any>>;\n};\n\n/**\n * v9 Model API\n * A model\n * - automatically reuses pipelines (programs) when possible\n * - automatically rebuilds pipelines if necessary to accommodate changed settings\n * shadertools integration\n * - accepts modules and performs shader transpilation\n */\nexport class Model {\n static defaultProps: Required<ModelProps> = {\n ...RenderPipeline.defaultProps,\n vs: null,\n fs: null,\n id: 'unnamed',\n handle: undefined,\n userData: {},\n defines: {},\n modules: [],\n moduleSettings: {},\n geometry: null,\n indexBuffer: null,\n attributes: {},\n constantAttributes: {},\n\n pipelineFactory: undefined!,\n shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()\n };\n\n readonly device: Device;\n readonly id: string;\n readonly vs: string;\n readonly fs: string;\n readonly pipelineFactory: PipelineFactory;\n userData: {[key: string]: any} = {};\n\n // Fixed properties (change can trigger pipeline rebuild)\n\n /** The render pipeline GPU parameters, depth testing etc */\n parameters: RenderPipelineParameters;\n\n /** The primitive topology */\n topology: PrimitiveTopology;\n /** Buffer layout */\n bufferLayout: BufferLayout[];\n\n // Dynamic properties\n\n /** Vertex count */\n vertexCount: number;\n /** instance count */\n instanceCount: number = 0;\n\n /** Index buffer */\n indexBuffer: Buffer | null = null;\n /** Buffer-valued attributes */\n bufferAttributes: Record<string, Buffer> = {};\n /** Constant-valued attributes */\n constantAttributes: Record<string, TypedArray> = {};\n /** Bindings (textures, samplers, uniform buffers) */\n bindings: Record<string, Binding> = {};\n /** Sets uniforms @deprecated Use uniform buffers and setBindings() for portability*/\n uniforms: Record<string, UniformValue> = {};\n\n /** The underlying GPU \"program\". @note May be recreated if parameters change */\n pipeline: RenderPipeline;\n\n /**\n * VertexArray\n * @note not implemented: if bufferLayout is updated, vertex array has to be rebuilt!\n * @todo - allow application to define multiple vertex arrays?\n * */\n vertexArray: VertexArray;\n\n _pipelineNeedsUpdate: string | false = 'newly created';\n _attributeInfos: Record<string, AttributeInfo> = {};\n _gpuGeometry: GPUGeometry | null = null;\n private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;\n private props: Required<ModelProps>;\n\n constructor(device: Device, props: ModelProps) {\n this.props = {...Model.defaultProps, ...props};\n props = this.props;\n this.id = props.id || uid('model');\n this.device = device;\n\n Object.assign(this.userData, props.userData);\n\n /** Create a shadertools platform info from the Device */\n const platformInfo: PlatformInfo = {\n type: device.info.type,\n shaderLanguage: device.info.shadingLanguages[0],\n gpu: device.info.gpu,\n features: device.features\n };\n\n const {vs, fs, getUniforms} = this.props.shaderAssembler.assembleShaders(\n platformInfo,\n this.props\n );\n this.vs = vs;\n this.fs = fs;\n this._getModuleUniforms = getUniforms;\n\n this.vertexCount = this.props.vertexCount;\n this.instanceCount = this.props.instanceCount;\n\n this.topology = this.props.topology;\n this.bufferLayout = this.props.bufferLayout;\n this.parameters = this.props.parameters;\n\n // Geometry, if provided, sets topology and vertex cound\n if (props.geometry) {\n this._gpuGeometry = this.setGeometry(props.geometry);\n }\n\n this.pipelineFactory =\n props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);\n\n // Create the pipeline\n // @note order is important\n this.pipeline = this._updatePipeline();\n\n this.vertexArray = device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Now we can apply geometry attributes\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n\n // Apply any dynamic settings that will not trigger pipeline change\n if (props.vertexCount) {\n this.setVertexCount(props.vertexCount);\n }\n if (props.instanceCount) {\n this.setInstanceCount(props.instanceCount);\n }\n // @ts-expect-error\n if (props.indices) {\n throw new Error('Model.props.indices removed. Use props.indexBuffer')\n }\n if (props.indexBuffer) {\n this.setIndexBuffer(props.indexBuffer);\n }\n if (props.attributes) {\n this.setAttributes(props.attributes);\n }\n if (props.constantAttributes) {\n this.setConstantAttributes(props.constantAttributes);\n }\n if (props.bindings) {\n this.setBindings(props.bindings);\n }\n if (props.uniforms) {\n this.setUniforms(props.uniforms);\n }\n if (props.moduleSettings) {\n this.updateModuleSettings(props.moduleSettings);\n }\n\n this.setUniforms(this._getModuleUniforms()); // Get all default module uniforms\n\n // Catch any access to non-standard props\n Object.seal(this);\n }\n\n destroy(): void {\n this.pipelineFactory.release(this.pipeline);\n }\n\n // Draw call\n\n draw(renderPass: RenderPass): void {\n // Check if the pipeline is invalidated\n // TODO - this is likely the worst place to do this from performance perspective. Perhaps add a predraw()?\n this.pipeline = this._updatePipeline();\n\n // Set pipeline state, we may be sharing a pipeline so we need to set all state on every draw\n // Any caching needs to be done inside the pipeline functions\n this.pipeline.setBindings(this.bindings);\n this.pipeline.setUniforms(this.uniforms);\n\n this.pipeline.draw({\n renderPass,\n vertexArray: this.vertexArray,\n vertexCount: this.vertexCount,\n instanceCount: this.instanceCount\n });\n }\n\n // Update fixed fields (can trigger pipeline rebuild)\n\n /**\n * Updates the optional geometry\n * Geometry, set topology and bufferLayout\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setGeometry(geometry: GPUGeometry | Geometry): GPUGeometry {\n const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);\n this.setTopology(gpuGeometry.topology || 'triangle-list');\n this.bufferLayout = mergeBufferLayouts(this.bufferLayout, gpuGeometry.bufferLayout);\n if (this.vertexArray) {\n this._setGeometryAttributes(gpuGeometry);\n }\n return gpuGeometry;\n }\n\n /**\n * Updates the optional geometry attributes\n * Geometry, sets several attributes, indexBuffer, and also vertex count\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n _setGeometryAttributes(gpuGeometry: GPUGeometry): void {\n // TODO - delete previous geometry?\n this.vertexCount = gpuGeometry.vertexCount;\n this.setAttributes(gpuGeometry.attributes);\n this.setIndexBuffer(gpuGeometry.indices);\n }\n\n /**\n * Updates the primitive topology ('triangle-list', 'triangle-strip' etc).\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setTopology(topology: PrimitiveTopology): void {\n if (topology !== this.topology) {\n this.topology = topology;\n this._setPipelineNeedsUpdate('topology');\n }\n }\n\n /**\n * Updates the buffer layout.\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setBufferLayout(bufferLayout: BufferLayout[]): void {\n this.bufferLayout = this._gpuGeometry\n ? mergeBufferLayouts(bufferLayout, this._gpuGeometry.bufferLayout)\n : bufferLayout;\n this._setPipelineNeedsUpdate('bufferLayout');\n\n // Recreate the pipeline\n this.pipeline = this._updatePipeline();\n \n // vertex array needs to be updated if we update buffer layout,\n // but not if we update parameters\n this.vertexArray = this.device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Reapply geometry attributes to the new vertex array\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n }\n\n /**\n * Set GPU parameters.\n * @note Can trigger a pipeline rebuild / pipeline cache fetch.\n * @param parameters\n */\n setParameters(parameters: RenderPipelineParameters) {\n if (!deepEqual(parameters, this.parameters, 2)) {\n this.parameters = parameters;\n this._setPipelineNeedsUpdate('parameters');\n }\n }\n\n // Update dynamic fields\n\n /**\n * Updates the vertex count (used in draw calls)\n * @note Any attributes with stepMode=vertex need to be at least this big\n */\n setVertexCount(vertexCount: number): void {\n this.vertexCount = vertexCount;\n }\n\n /**\n * Updates the instance count (used in draw calls)\n * @note Any attributes with stepMode=instance need to be at least this big\n */\n setInstanceCount(instanceCount: number): void {\n this.instanceCount = instanceCount;\n }\n\n /**\n * Updates shader module settings (which results in uniforms being set)\n */\n setShaderModuleProps(props: Record<string, any>): void {\n const uniforms = this._getModuleUniforms(props);\n\n // Extract textures & framebuffers set by the modules\n // TODO better way to extract bindings\n const keys = Object.keys(uniforms).filter(k => {\n const uniform = uniforms[k];\n return !Array.isArray(uniform) && (typeof uniform !== 'number') && (typeof uniform !== 'boolean');\n });\n const bindings: Record<string, Binding> = {};\n for (const k of keys) {\n bindings[k] = uniforms[k];\n delete uniforms[k];\n }\n\n Object.assign(this.uniforms, uniforms);\n Object.assign(this.bindings, bindings);\n }\n\n /**\n * @deprecated Updates shader module settings (which results in uniforms being set)\n */\n updateModuleSettings(props: Record<string, any>): void {\n this.setShaderModuleProps(props);\n }\n\n /**\n * Sets bindings (textures, samplers, uniform buffers)\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this.bindings, bindings);\n }\n\n /**\n * Sets individual uniforms\n * @deprecated WebGL only, use uniform buffers for portability\n * @param uniforms\n * @returns self for chaining\n */\n setUniforms(uniforms: Record<string, UniformValue>): void {\n this.pipeline.setUniforms(uniforms);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Sets the index buffer\n * @todo - how to unset it if we change geometry?\n */\n setIndexBuffer(indexBuffer: Buffer | null): void {\n this.vertexArray.setIndexBuffer(indexBuffer);\n }\n\n /**\n * Sets attributes (buffers)\n * @note Overrides any attributes previously set with the same name\n */\n setAttributes(buffers: Record<string, Buffer>): void {\n if (buffers.indices) {\n log.warn(\n `Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`\n );\n }\n for (const [bufferName, buffer] of Object.entries(buffers)) {\n const bufferLayout = this.bufferLayout.find(layout => layout.name === bufferName);\n if (!bufferLayout) {\n continue; // eslint-disable-line no-continue\n }\n\n // For an interleaved attribute we may need to set multiple attributes\n const attributeNames = bufferLayout.attributes\n ? bufferLayout.attributes?.map(layout => layout.attribute)\n : [bufferLayout.name];\n let set = false;\n for (const attributeName of attributeNames) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setBuffer(attributeInfo.location, buffer);\n set = true;\n }\n }\n if (!set) {\n log.warn(\n `Model(${this.id}): Ignoring buffer \"${buffer.id}\" for unknown attribute \"${bufferName}\"`\n )();\n }\n }\n }\n\n /**\n * Sets constant attributes\n * @note Overrides any attributes previously set with the same name\n * Constant attributes are only supported in WebGL, not in WebGPU\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @param constantAttributes\n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n for (const [attributeName, value] of Object.entries(attributes)) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setConstant(attributeInfo.location, value);\n } else {\n log.warn(`Model \"${this.id}: Ignoring constant supplied for unknown attribute \"${attributeName}\"`)();\n }\n }\n }\n\n _setPipelineNeedsUpdate(reason: string): void {\n this._pipelineNeedsUpdate = this._pipelineNeedsUpdate || reason;\n }\n\n _updatePipeline(): RenderPipeline {\n if (this._pipelineNeedsUpdate) {\n if (this.pipeline) {\n log.log(1, `Model ${this.id}: Recreating pipeline because \"${this._pipelineNeedsUpdate}\".`)();\n }\n this._pipelineNeedsUpdate = false;\n this.pipeline = this.device.createRenderPipeline({\n ...this.props,\n bufferLayout: this.bufferLayout,\n topology: this.topology,\n parameters: this.parameters,\n vs: this.device.createShader({id: '{$this.id}-vertex', stage: 'vertex', source: this.vs}),\n fs: this.fs ? this.device.createShader({id: '{$this.id}-fragment', stage: 'fragment', source: this.fs}) : null\n });\n this._attributeInfos = getAttributeInfosFromLayouts(\n this.pipeline.shaderLayout,\n this.bufferLayout\n );\n }\n return this.pipeline;\n }\n}\n\n/** TODO - move to core, document add tests */\nfunction mergeBufferLayouts(layouts1: BufferLayout[], layouts2: BufferLayout[]): BufferLayout[] {\n const layouts = [...layouts1];\n for (const attribute of layouts2) {\n const index = layouts.findIndex(attribute2 => attribute2.name === attribute.name);\n if (index < 0) {\n layouts.push(attribute);\n } else {\n layouts[index] = attribute;\n }\n }\n return layouts;\n}\n"],"mappings":"AAYA,SAAwBA,cAAc,EAAcC,GAAG,EAAEC,GAAG,EAAEC,SAAS,QAAO,eAAe;AAC7F,SAAQC,4BAA4B,QAAO,eAAe;AAE1D,SAAQC,eAAe,QAAO,sBAAsB;AAAC,SAEhCC,eAAe;AAAA,SAC5BC,eAAe;AA8CvB,OAAO,MAAMC,KAAK,CAAC;EAuEjBC,WAAWA,CAACC,MAAc,EAAEC,KAAiB,EAAE;IAAA,KAnDtCD,MAAM;IAAA,KACNE,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,eAAe;IAAA,KACxBC,QAAQ,GAAyB,CAAC,CAAC;IAAA,KAKnCC,UAAU;IAAA,KAGVC,QAAQ;IAAA,KAERC,YAAY;IAAA,KAKZC,WAAW;IAAA,KAEXC,aAAa,GAAW,CAAC;IAAA,KAGzBC,WAAW,GAAkB,IAAI;IAAA,KAEjCC,gBAAgB,GAA2B,CAAC,CAAC;IAAA,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Q,CAAC;EAC7B,KAAK,MAAMnB,SAAS,IAAIoB,QAAQ,EAAE;IAChC,MAAME,KAAK,GAAGD,OAAO,CAACE,SAAS,CAACC,UAAU,IAAIA,UAAU,CAAC3B,IAAI,KAAKG,SAAS,CAACH,IAAI,CAAC;IACjF,IAAIyB,KAAK,GAAG,CAAC,EAAE;MACbD,OAAO,CAACI,IAAI,CAACzB,SAAS,CAAC;IACzB,CAAC,MAAM;MACLqB,OAAO,CAACC,KAAK,CAAC,GAAGtB,SAAS;IAC5B;EACF;EACA,OAAOqB,OAAO;AAChB"}
1
+ {"version":3,"file":"model.js","names":["RenderPipeline","log","uid","deepEqual","isNumberArray","getAttributeInfosFromLayouts","ShaderAssembler","makeGPUGeometry","PipelineFactory","Model","constructor","device","props","id","vs","fs","pipelineFactory","userData","parameters","topology","bufferLayout","vertexCount","instanceCount","indexBuffer","bufferAttributes","constantAttributes","bindings","uniforms","pipeline","vertexArray","_pipelineNeedsUpdate","_attributeInfos","_gpuGeometry","_getModuleUniforms","defaultProps","Object","assign","platformInfo","type","info","shaderLanguage","shadingLanguages","gpu","features","getUniforms","shaderAssembler","assembleShaders","geometry","setGeometry","getDefaultPipelineFactory","_updatePipeline","createVertexArray","renderPipeline","_setGeometryAttributes","setVertexCount","setInstanceCount","indices","Error","setIndexBuffer","attributes","setAttributes","setConstantAttributes","setBindings","setUniforms","moduleSettings","updateModuleSettings","seal","destroy","release","draw","renderPass","gpuGeometry","setTopology","mergeBufferLayouts","_setPipelineNeedsUpdate","setBufferLayout","setParameters","setShaderModuleProps","keys","filter","k","uniform","buffers","warn","bufferName","buffer","entries","_bufferLayout$attribu","find","layout","name","attributeNames","map","attribute","set","attributeName","attributeInfo","setBuffer","location","value","setConstant","reason","createRenderPipeline","createShader","stage","source","shaderLayout","handle","undefined","defines","modules","getDefaultShaderAssembler","layouts1","layouts2","layouts","index","findIndex","attribute2","push"],"sources":["../../src/model/model.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {\n TypedArray,\n RenderPipelineProps,\n RenderPipelineParameters,\n BufferLayout,\n VertexArray,\n AttributeInfo\n} from '@luma.gl/core';\nimport type {Binding, UniformValue, PrimitiveTopology} from '@luma.gl/core';\nimport {Device, Buffer, RenderPipeline, RenderPass, log, uid, deepEqual, isNumberArray} from '@luma.gl/core';\nimport {getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';\nimport {ShaderAssembler} from '@luma.gl/shadertools';\nimport type {Geometry} from '../geometry/geometry';\nimport {GPUGeometry, makeGPUGeometry} from '../geometry/gpu-geometry';\nimport {PipelineFactory} from '../lib/pipeline-factory';\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Model also accepts a string shaders\n vs: {glsl?: string; wgsl?: string} | string | null;\n fs: {glsl?: string; wgsl?: string} | string | null;\n /** shadertool shader modules (added to shader code) */\n modules?: ShaderModule[];\n /** Shadertool module defines (configures shader code)*/\n defines?: Record<string, string | number | boolean>;\n // TODO - injections, hooks etc?\n\n /** pipeline factory to use to create render pipelines. Defaults to default factory for the device */\n pipelineFactory?: PipelineFactory;\n /** Shader assembler. Defaults to the ShaderAssembler.getShaderAssembler() */\n shaderAssembler?: ShaderAssembler;\n\n /** Parameters that are built into the pipeline */\n parameters?: RenderPipelineParameters;\n\n /** Geometry */\n geometry?: GPUGeometry | Geometry | null;\n\n /** Vertex count */\n vertexCount?: number;\n /** instance count */\n instanceCount?: number;\n\n indexBuffer?: Buffer | null;\n /** @note this is really a map of buffers, not a map of attributes */\n attributes?: Record<string, Buffer>;\n /** */\n constantAttributes?: Record<string, TypedArray>;\n\n /** Mapped uniforms for shadertool modules */\n moduleSettings?: Record<string, Record<string, any>>;\n};\n\n/**\n * v9 Model API\n * A model\n * - automatically reuses pipelines (programs) when possible\n * - automatically rebuilds pipelines if necessary to accommodate changed settings\n * shadertools integration\n * - accepts modules and performs shader transpilation\n */\nexport class Model {\n static defaultProps: Required<ModelProps> = {\n ...RenderPipeline.defaultProps,\n vs: null,\n fs: null,\n id: 'unnamed',\n handle: undefined,\n userData: {},\n defines: {},\n modules: [],\n moduleSettings: {},\n geometry: null,\n indexBuffer: null,\n attributes: {},\n constantAttributes: {},\n\n pipelineFactory: undefined!,\n shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()\n };\n\n readonly device: Device;\n readonly id: string;\n readonly vs: string;\n readonly fs: string;\n readonly pipelineFactory: PipelineFactory;\n userData: {[key: string]: any} = {};\n\n // Fixed properties (change can trigger pipeline rebuild)\n\n /** The render pipeline GPU parameters, depth testing etc */\n parameters: RenderPipelineParameters;\n\n /** The primitive topology */\n topology: PrimitiveTopology;\n /** Buffer layout */\n bufferLayout: BufferLayout[];\n\n // Dynamic properties\n\n /** Vertex count */\n vertexCount: number;\n /** instance count */\n instanceCount: number = 0;\n\n /** Index buffer */\n indexBuffer: Buffer | null = null;\n /** Buffer-valued attributes */\n bufferAttributes: Record<string, Buffer> = {};\n /** Constant-valued attributes */\n constantAttributes: Record<string, TypedArray> = {};\n /** Bindings (textures, samplers, uniform buffers) */\n bindings: Record<string, Binding> = {};\n /** Sets uniforms @deprecated Use uniform buffers and setBindings() for portability*/\n uniforms: Record<string, UniformValue> = {};\n\n /** The underlying GPU \"program\". @note May be recreated if parameters change */\n pipeline: RenderPipeline;\n\n /**\n * VertexArray\n * @note not implemented: if bufferLayout is updated, vertex array has to be rebuilt!\n * @todo - allow application to define multiple vertex arrays?\n * */\n vertexArray: VertexArray;\n\n _pipelineNeedsUpdate: string | false = 'newly created';\n _attributeInfos: Record<string, AttributeInfo> = {};\n _gpuGeometry: GPUGeometry | null = null;\n private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;\n private props: Required<ModelProps>;\n\n constructor(device: Device, props: ModelProps) {\n this.props = {...Model.defaultProps, ...props};\n props = this.props;\n this.id = props.id || uid('model');\n this.device = device;\n\n Object.assign(this.userData, props.userData);\n\n /** Create a shadertools platform info from the Device */\n const platformInfo: PlatformInfo = {\n type: device.info.type,\n shaderLanguage: device.info.shadingLanguages[0],\n gpu: device.info.gpu,\n features: device.features\n };\n\n const {vs, fs, getUniforms} = this.props.shaderAssembler.assembleShaders(\n platformInfo,\n this.props\n );\n this.vs = vs;\n this.fs = fs;\n this._getModuleUniforms = getUniforms;\n\n this.vertexCount = this.props.vertexCount;\n this.instanceCount = this.props.instanceCount;\n\n this.topology = this.props.topology;\n this.bufferLayout = this.props.bufferLayout;\n this.parameters = this.props.parameters;\n\n // Geometry, if provided, sets topology and vertex cound\n if (props.geometry) {\n this._gpuGeometry = this.setGeometry(props.geometry);\n }\n\n this.pipelineFactory =\n props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);\n\n // Create the pipeline\n // @note order is important\n this.pipeline = this._updatePipeline();\n\n this.vertexArray = device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Now we can apply geometry attributes\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n\n // Apply any dynamic settings that will not trigger pipeline change\n if (props.vertexCount) {\n this.setVertexCount(props.vertexCount);\n }\n if (props.instanceCount) {\n this.setInstanceCount(props.instanceCount);\n }\n // @ts-expect-error\n if (props.indices) {\n throw new Error('Model.props.indices removed. Use props.indexBuffer')\n }\n if (props.indexBuffer) {\n this.setIndexBuffer(props.indexBuffer);\n }\n if (props.attributes) {\n this.setAttributes(props.attributes);\n }\n if (props.constantAttributes) {\n this.setConstantAttributes(props.constantAttributes);\n }\n if (props.bindings) {\n this.setBindings(props.bindings);\n }\n if (props.uniforms) {\n this.setUniforms(props.uniforms);\n }\n if (props.moduleSettings) {\n this.updateModuleSettings(props.moduleSettings);\n }\n\n this.setUniforms(this._getModuleUniforms()); // Get all default module uniforms\n\n // Catch any access to non-standard props\n Object.seal(this);\n }\n\n destroy(): void {\n this.pipelineFactory.release(this.pipeline);\n }\n\n // Draw call\n\n draw(renderPass: RenderPass): void {\n // Check if the pipeline is invalidated\n // TODO - this is likely the worst place to do this from performance perspective. Perhaps add a predraw()?\n this.pipeline = this._updatePipeline();\n\n // Set pipeline state, we may be sharing a pipeline so we need to set all state on every draw\n // Any caching needs to be done inside the pipeline functions\n this.pipeline.setBindings(this.bindings);\n this.pipeline.setUniforms(this.uniforms);\n\n this.pipeline.draw({\n renderPass,\n vertexArray: this.vertexArray,\n vertexCount: this.vertexCount,\n instanceCount: this.instanceCount\n });\n }\n\n // Update fixed fields (can trigger pipeline rebuild)\n\n /**\n * Updates the optional geometry\n * Geometry, set topology and bufferLayout\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setGeometry(geometry: GPUGeometry | Geometry): GPUGeometry {\n const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);\n this.setTopology(gpuGeometry.topology || 'triangle-list');\n this.bufferLayout = mergeBufferLayouts(this.bufferLayout, gpuGeometry.bufferLayout);\n if (this.vertexArray) {\n this._setGeometryAttributes(gpuGeometry);\n }\n return gpuGeometry;\n }\n\n /**\n * Updates the optional geometry attributes\n * Geometry, sets several attributes, indexBuffer, and also vertex count\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n _setGeometryAttributes(gpuGeometry: GPUGeometry): void {\n // TODO - delete previous geometry?\n this.vertexCount = gpuGeometry.vertexCount;\n this.setAttributes(gpuGeometry.attributes);\n this.setIndexBuffer(gpuGeometry.indices);\n }\n\n /**\n * Updates the primitive topology ('triangle-list', 'triangle-strip' etc).\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setTopology(topology: PrimitiveTopology): void {\n if (topology !== this.topology) {\n this.topology = topology;\n this._setPipelineNeedsUpdate('topology');\n }\n }\n\n /**\n * Updates the buffer layout.\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setBufferLayout(bufferLayout: BufferLayout[]): void {\n this.bufferLayout = this._gpuGeometry\n ? mergeBufferLayouts(bufferLayout, this._gpuGeometry.bufferLayout)\n : bufferLayout;\n this._setPipelineNeedsUpdate('bufferLayout');\n\n // Recreate the pipeline\n this.pipeline = this._updatePipeline();\n \n // vertex array needs to be updated if we update buffer layout,\n // but not if we update parameters\n this.vertexArray = this.device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Reapply geometry attributes to the new vertex array\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n }\n\n /**\n * Set GPU parameters.\n * @note Can trigger a pipeline rebuild / pipeline cache fetch.\n * @param parameters\n */\n setParameters(parameters: RenderPipelineParameters) {\n if (!deepEqual(parameters, this.parameters, 2)) {\n this.parameters = parameters;\n this._setPipelineNeedsUpdate('parameters');\n }\n }\n\n // Update dynamic fields\n\n /**\n * Updates the vertex count (used in draw calls)\n * @note Any attributes with stepMode=vertex need to be at least this big\n */\n setVertexCount(vertexCount: number): void {\n this.vertexCount = vertexCount;\n }\n\n /**\n * Updates the instance count (used in draw calls)\n * @note Any attributes with stepMode=instance need to be at least this big\n */\n setInstanceCount(instanceCount: number): void {\n this.instanceCount = instanceCount;\n }\n\n /**\n * Updates shader module settings (which results in uniforms being set)\n */\n setShaderModuleProps(props: Record<string, any>): void {\n const uniforms = this._getModuleUniforms(props);\n\n // Extract textures & framebuffers set by the modules\n // TODO better way to extract bindings\n const keys = Object.keys(uniforms).filter(k => {\n const uniform = uniforms[k];\n return !isNumberArray(uniform) && (typeof uniform !== 'number') && (typeof uniform !== 'boolean');\n });\n const bindings: Record<string, Binding> = {};\n for (const k of keys) {\n bindings[k] = uniforms[k];\n delete uniforms[k];\n }\n\n Object.assign(this.uniforms, uniforms);\n Object.assign(this.bindings, bindings);\n }\n\n /**\n * @deprecated Updates shader module settings (which results in uniforms being set)\n */\n updateModuleSettings(props: Record<string, any>): void {\n this.setShaderModuleProps(props);\n }\n\n /**\n * Sets bindings (textures, samplers, uniform buffers)\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this.bindings, bindings);\n }\n\n /**\n * Sets individual uniforms\n * @deprecated WebGL only, use uniform buffers for portability\n * @param uniforms\n * @returns self for chaining\n */\n setUniforms(uniforms: Record<string, UniformValue>): void {\n this.pipeline.setUniforms(uniforms);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Sets the index buffer\n * @todo - how to unset it if we change geometry?\n */\n setIndexBuffer(indexBuffer: Buffer | null): void {\n this.vertexArray.setIndexBuffer(indexBuffer);\n }\n\n /**\n * Sets attributes (buffers)\n * @note Overrides any attributes previously set with the same name\n */\n setAttributes(buffers: Record<string, Buffer>): void {\n if (buffers.indices) {\n log.warn(\n `Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`\n );\n }\n for (const [bufferName, buffer] of Object.entries(buffers)) {\n const bufferLayout = this.bufferLayout.find(layout => layout.name === bufferName);\n if (!bufferLayout) {\n continue; // eslint-disable-line no-continue\n }\n\n // For an interleaved attribute we may need to set multiple attributes\n const attributeNames = bufferLayout.attributes\n ? bufferLayout.attributes?.map(layout => layout.attribute)\n : [bufferLayout.name];\n let set = false;\n for (const attributeName of attributeNames) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setBuffer(attributeInfo.location, buffer);\n set = true;\n }\n }\n if (!set) {\n log.warn(\n `Model(${this.id}): Ignoring buffer \"${buffer.id}\" for unknown attribute \"${bufferName}\"`\n )();\n }\n }\n }\n\n /**\n * Sets constant attributes\n * @note Overrides any attributes previously set with the same name\n * Constant attributes are only supported in WebGL, not in WebGPU\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @param constantAttributes\n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n for (const [attributeName, value] of Object.entries(attributes)) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setConstant(attributeInfo.location, value);\n } else {\n log.warn(`Model \"${this.id}: Ignoring constant supplied for unknown attribute \"${attributeName}\"`)();\n }\n }\n }\n\n _setPipelineNeedsUpdate(reason: string): void {\n this._pipelineNeedsUpdate = this._pipelineNeedsUpdate || reason;\n }\n\n _updatePipeline(): RenderPipeline {\n if (this._pipelineNeedsUpdate) {\n if (this.pipeline) {\n log.log(1, `Model ${this.id}: Recreating pipeline because \"${this._pipelineNeedsUpdate}\".`)();\n }\n this._pipelineNeedsUpdate = false;\n this.pipeline = this.device.createRenderPipeline({\n ...this.props,\n bufferLayout: this.bufferLayout,\n topology: this.topology,\n parameters: this.parameters,\n vs: this.device.createShader({id: '{$this.id}-vertex', stage: 'vertex', source: this.vs}),\n fs: this.fs ? this.device.createShader({id: '{$this.id}-fragment', stage: 'fragment', source: this.fs}) : null\n });\n this._attributeInfos = getAttributeInfosFromLayouts(\n this.pipeline.shaderLayout,\n this.bufferLayout\n );\n }\n return this.pipeline;\n }\n}\n\n/** TODO - move to core, document add tests */\nfunction mergeBufferLayouts(layouts1: BufferLayout[], layouts2: BufferLayout[]): BufferLayout[] {\n const layouts = [...layouts1];\n for (const attribute of layouts2) {\n const index = layouts.findIndex(attribute2 => attribute2.name === attribute.name);\n if (index < 0) {\n layouts.push(attribute);\n } else {\n layouts[index] = attribute;\n }\n }\n return layouts;\n}\n"],"mappings":"AAYA,SAAwBA,cAAc,EAAcC,GAAG,EAAEC,GAAG,EAAEC,SAAS,EAAEC,aAAa,QAAO,eAAe;AAC5G,SAAQC,4BAA4B,QAAO,eAAe;AAE1D,SAAQC,eAAe,QAAO,sBAAsB;AAAC,SAEhCC,eAAe;AAAA,SAC5BC,eAAe;AA8CvB,OAAO,MAAMC,KAAK,CAAC;EAuEjBC,WAAWA,CAACC,MAAc,EAAEC,KAAiB,EAAE;IAAA,KAnDtCD,MAAM;IAAA,KACNE,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,eAAe;IAAA,KACxBC,QAAQ,GAAyB,CAAC,CAAC;IAAA,KAKnCC,UAAU;IAAA,KAGVC,QAAQ;IAAA,KAERC,YAAY;IAAA,KAKZC,WAAW;IAAA,KAEX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C,kBAAkBA,CAACuC,QAAwB,EAAEC,QAAwB,EAAkB;EAC9F,MAAMC,OAAO,GAAG,CAAC,GAAGF,QAAQ,CAAC;EAC7B,KAAK,MAAMnB,SAAS,IAAIoB,QAAQ,EAAE;IAChC,MAAME,KAAK,GAAGD,OAAO,CAACE,SAAS,CAACC,UAAU,IAAIA,UAAU,CAAC3B,IAAI,KAAKG,SAAS,CAACH,IAAI,CAAC;IACjF,IAAIyB,KAAK,GAAG,CAAC,EAAE;MACbD,OAAO,CAACI,IAAI,CAACzB,SAAS,CAAC;IACzB,CAAC,MAAM;MACLqB,OAAO,CAACC,KAAK,CAAC,GAAGtB,SAAS;IAC5B;EACF;EACA,OAAOqB,OAAO;AAChB"}
package/dist.min.js CHANGED
@@ -4,12 +4,12 @@
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 jo=Object.create;var he=Object.defineProperty;var Fo=Object.getOwnPropertyDescriptor;var Uo=Object.getOwnPropertyNames;var Go=Object.getPrototypeOf,zo=Object.prototype.hasOwnProperty;var Ue=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bo=(e,t)=>{for(var r in t)he(e,r,{get:t[r],enumerable:!0})},Sr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Uo(t))!zo.call(e,i)&&i!==r&&he(e,i,{get:()=>t[i],enumerable:!(n=Fo(t,i))||n.enumerable});return e};var pe=(e,t,r)=>(r=e!=null?jo(Go(e)):{},Sr(t||!e||!e.__esModule?he(r,"default",{value:e,enumerable:!0}):r,e)),ko=e=>Sr(he({},"__esModule",{value:!0}),e);var Lr=Ue((Rc,gt)=>{function He(e){return gt.exports=He=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt.exports.__esModule=!0,gt.exports.default=gt.exports,He(e)}gt.exports=He,gt.exports.__esModule=!0,gt.exports.default=gt.exports});var Nr=Ue((Cc,vt)=>{var Dr=Lr().default;function Ir(){"use strict";vt.exports=Ir=function(){return e},vt.exports.__esModule=!0,vt.exports.default=vt.exports;var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(g,p,d){g[p]=d.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function a(g,p,d){return Object.defineProperty(g,p,{value:d,enumerable:!0,configurable:!0,writable:!0}),g[p]}try{a({},"")}catch{a=function(d,_,E){return d[_]=E}}function f(g,p,d,_){var E=p&&p.prototype instanceof h?p:h,P=Object.create(E.prototype),D=new U(_||[]);return n(P,"_invoke",{value:w(g,d,D)}),P}function u(g,p,d){try{return{type:"normal",arg:g.call(p,d)}}catch(_){return{type:"throw",arg:_}}}e.wrap=f;var l={};function h(){}function v(){}function m(){}var y={};a(y,o,function(){return this});var b=Object.getPrototypeOf,O=b&&b(b(C([])));O&&O!==t&&r.call(O,o)&&(y=O);var R=m.prototype=h.prototype=Object.create(y);function x(g){["next","throw","return"].forEach(function(p){a(g,p,function(d){return this._invoke(p,d)})})}function S(g,p){function d(E,P,D,z){var I=u(g[E],g,P);if(I.type!=="throw"){var G=I.arg,k=G.value;return k&&Dr(k)=="object"&&r.call(k,"__await")?p.resolve(k.__await).then(function(V){d("next",V,D,z)},function(V){d("throw",V,D,z)}):p.resolve(k).then(function(V){G.value=V,D(G)},function(V){return d("throw",V,D,z)})}z(I.arg)}var _;n(this,"_invoke",{value:function(P,D){function z(){return new p(function(I,G){d(P,D,I,G)})}return _=_?_.then(z,z):z()}})}function w(g,p,d){var _="suspendedStart";return function(E,P){if(_==="executing")throw new Error("Generator is already running");if(_==="completed"){if(E==="throw")throw P;return{value:void 0,done:!0}}for(d.method=E,d.arg=P;;){var D=d.delegate;if(D){var z=M(D,d);if(z){if(z===l)continue;return z}}if(d.method==="next")d.sent=d._sent=d.arg;else if(d.method==="throw"){if(_==="suspendedStart")throw _="completed",d.arg;d.dispatchException(d.arg)}else d.method==="return"&&d.abrupt("return",d.arg);_="executing";var I=u(g,p,d);if(I.type==="normal"){if(_=d.done?"completed":"suspendedYield",I.arg===l)continue;return{value:I.arg,done:d.done}}I.type==="throw"&&(_="completed",d.method="throw",d.arg=I.arg)}}}function M(g,p){var d=p.method,_=g.iterator[d];if(_===void 0)return p.delegate=null,d==="throw"&&g.iterator.return&&(p.method="return",p.arg=void 0,M(g,p),p.method==="throw")||d!=="return"&&(p.method="throw",p.arg=new TypeError("The iterator does not provide a '"+d+"' method")),l;var E=u(_,g.iterator,p.arg);if(E.type==="throw")return p.method="throw",p.arg=E.arg,p.delegate=null,l;var P=E.arg;return P?P.done?(p[g.resultName]=P.value,p.next=g.nextLoc,p.method!=="return"&&(p.method="next",p.arg=void 0),p.delegate=null,l):P:(p.method="throw",p.arg=new TypeError("iterator result is not an object"),p.delegate=null,l)}function j(g){var p={tryLoc:g[0]};1 in g&&(p.catchLoc=g[1]),2 in g&&(p.finallyLoc=g[2],p.afterLoc=g[3]),this.tryEntries.push(p)}function N(g){var p=g.completion||{};p.type="normal",delete p.arg,g.completion=p}function U(g){this.tryEntries=[{tryLoc:"root"}],g.forEach(j,this),this.reset(!0)}function C(g){if(g||g===""){var p=g[o];if(p)return p.call(g);if(typeof g.next=="function")return g;if(!isNaN(g.length)){var d=-1,_=function E(){for(;++d<g.length;)if(r.call(g,d))return E.value=g[d],E.done=!1,E;return E.value=void 0,E.done=!0,E};return _.next=_}}throw new TypeError(Dr(g)+" is not iterable")}return v.prototype=m,n(R,"constructor",{value:m,configurable:!0}),n(m,"constructor",{value:v,configurable:!0}),v.displayName=a(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(g){var p=typeof g=="function"&&g.constructor;return!!p&&(p===v||(p.displayName||p.name)==="GeneratorFunction")},e.mark=function(g){return Object.setPrototypeOf?Object.setPrototypeOf(g,m):(g.__proto__=m,a(g,c,"GeneratorFunction")),g.prototype=Object.create(R),g},e.awrap=function(g){return{__await:g}},x(S.prototype),a(S.prototype,s,function(){return this}),e.AsyncIterator=S,e.async=function(g,p,d,_,E){E===void 0&&(E=Promise);var P=new S(f(g,p,d,_),E);return e.isGeneratorFunction(p)?P:P.next().then(function(D){return D.done?D.value:P.next()})},x(R),a(R,c,"Generator"),a(R,o,function(){return this}),a(R,"toString",function(){return"[object Generator]"}),e.keys=function(g){var p=Object(g),d=[];for(var _ in p)d.push(_);return d.reverse(),function E(){for(;d.length;){var P=d.pop();if(P in p)return E.value=P,E.done=!1,E}return E.done=!0,E}},e.values=C,U.prototype={constructor:U,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(N),!p)for(var d in this)d.charAt(0)==="t"&&r.call(this,d)&&!isNaN(+d.slice(1))&&(this[d]=void 0)},stop:function(){this.done=!0;var p=this.tryEntries[0].completion;if(p.type==="throw")throw p.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var d=this;function _(G,k){return D.type="throw",D.arg=p,d.next=G,k&&(d.method="next",d.arg=void 0),!!k}for(var E=this.tryEntries.length-1;E>=0;--E){var P=this.tryEntries[E],D=P.completion;if(P.tryLoc==="root")return _("end");if(P.tryLoc<=this.prev){var z=r.call(P,"catchLoc"),I=r.call(P,"finallyLoc");if(z&&I){if(this.prev<P.catchLoc)return _(P.catchLoc,!0);if(this.prev<P.finallyLoc)return _(P.finallyLoc)}else if(z){if(this.prev<P.catchLoc)return _(P.catchLoc,!0)}else{if(!I)throw new Error("try statement without catch or finally");if(this.prev<P.finallyLoc)return _(P.finallyLoc)}}}},abrupt:function(p,d){for(var _=this.tryEntries.length-1;_>=0;--_){var E=this.tryEntries[_];if(E.tryLoc<=this.prev&&r.call(E,"finallyLoc")&&this.prev<E.finallyLoc){var P=E;break}}P&&(p==="break"||p==="continue")&&P.tryLoc<=d&&d<=P.finallyLoc&&(P=null);var D=P?P.completion:{};return D.type=p,D.arg=d,P?(this.method="next",this.next=P.finallyLoc,l):this.complete(D)},complete:function(p,d){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&d&&(this.next=d),l},finish:function(p){for(var d=this.tryEntries.length-1;d>=0;--d){var _=this.tryEntries[d];if(_.finallyLoc===p)return this.complete(_.completion,_.afterLoc),N(_),l}},catch:function(p){for(var d=this.tryEntries.length-1;d>=0;--d){var _=this.tryEntries[d];if(_.tryLoc===p){var E=_.completion;if(E.type==="throw"){var P=E.arg;N(_)}return P}}throw new Error("illegal catch attempt")},delegateYield:function(p,d,_){return this.delegate={iterator:C(p),resultName:d,nextLoc:_},this.method==="next"&&(this.arg=void 0),l}},e}vt.exports=Ir,vt.exports.__esModule=!0,vt.exports.default=vt.exports});var Jt=Ue((Lc,jr)=>{var de=Nr()();jr.exports=de;try{regeneratorRuntime=de}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=de:Function("r","regeneratorRuntime = r")(de)}});var tc={};Bo(tc,{AnimationLoop:()=>be,AnimationLoopTemplate:()=>Fr,ClipSpace:()=>oo,ConeGeometry:()=>ho,CubeGeometry:()=>mo,CylinderGeometry:()=>yo,Geometry:()=>st,GroupNode:()=>ao,IcoSphereGeometry:()=>xo,KeyFrames:()=>Rr,Model:()=>ae,ModelNode:()=>co,PipelineFactory:()=>se,PlaneGeometry:()=>wo,ScenegraphNode:()=>Dt,ShaderModuleUniforms:()=>Qi,SphereGeometry:()=>Mo,Timeline:()=>Tr,Transform:()=>Ji,TruncatedConeGeometry:()=>Yt,makeAnimationLoop:()=>xn});function Ge(e){if(Array.isArray(e))return e}function ze(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,s,c=[],a=!0,f=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=o.call(r)).done)&&(c.push(n.value),c.length!==t);a=!0);}catch(u){f=!0,i=u}finally{try{if(!a&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw i}}return c}}function It(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function $t(e,t){if(e){if(typeof e=="string")return It(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return It(e,t)}}function Be(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
+ "use strict";var __exports__=(()=>{var jo=Object.create;var he=Object.defineProperty;var Fo=Object.getOwnPropertyDescriptor;var Uo=Object.getOwnPropertyNames;var Go=Object.getPrototypeOf,zo=Object.prototype.hasOwnProperty;var Ue=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bo=(e,t)=>{for(var r in t)he(e,r,{get:t[r],enumerable:!0})},Sr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Uo(t))!zo.call(e,i)&&i!==r&&he(e,i,{get:()=>t[i],enumerable:!(n=Fo(t,i))||n.enumerable});return e};var pe=(e,t,r)=>(r=e!=null?jo(Go(e)):{},Sr(t||!e||!e.__esModule?he(r,"default",{value:e,enumerable:!0}):r,e)),ko=e=>Sr(he({},"__esModule",{value:!0}),e);var Lr=Ue((Rc,gt)=>{function He(e){return gt.exports=He=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt.exports.__esModule=!0,gt.exports.default=gt.exports,He(e)}gt.exports=He,gt.exports.__esModule=!0,gt.exports.default=gt.exports});var Nr=Ue((Cc,vt)=>{var Dr=Lr().default;function Ir(){"use strict";vt.exports=Ir=function(){return e},vt.exports.__esModule=!0,vt.exports.default=vt.exports;var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(g,p,d){g[p]=d.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function a(g,p,d){return Object.defineProperty(g,p,{value:d,enumerable:!0,configurable:!0,writable:!0}),g[p]}try{a({},"")}catch{a=function(d,_,E){return d[_]=E}}function f(g,p,d,_){var E=p&&p.prototype instanceof h?p:h,P=Object.create(E.prototype),D=new U(_||[]);return n(P,"_invoke",{value:w(g,d,D)}),P}function u(g,p,d){try{return{type:"normal",arg:g.call(p,d)}}catch(_){return{type:"throw",arg:_}}}e.wrap=f;var l={};function h(){}function v(){}function m(){}var y={};a(y,o,function(){return this});var b=Object.getPrototypeOf,O=b&&b(b(C([])));O&&O!==t&&r.call(O,o)&&(y=O);var R=m.prototype=h.prototype=Object.create(y);function x(g){["next","throw","return"].forEach(function(p){a(g,p,function(d){return this._invoke(p,d)})})}function S(g,p){function d(E,P,D,z){var I=u(g[E],g,P);if(I.type!=="throw"){var G=I.arg,k=G.value;return k&&Dr(k)=="object"&&r.call(k,"__await")?p.resolve(k.__await).then(function(V){d("next",V,D,z)},function(V){d("throw",V,D,z)}):p.resolve(k).then(function(V){G.value=V,D(G)},function(V){return d("throw",V,D,z)})}z(I.arg)}var _;n(this,"_invoke",{value:function(P,D){function z(){return new p(function(I,G){d(P,D,I,G)})}return _=_?_.then(z,z):z()}})}function w(g,p,d){var _="suspendedStart";return function(E,P){if(_==="executing")throw new Error("Generator is already running");if(_==="completed"){if(E==="throw")throw P;return{value:void 0,done:!0}}for(d.method=E,d.arg=P;;){var D=d.delegate;if(D){var z=M(D,d);if(z){if(z===l)continue;return z}}if(d.method==="next")d.sent=d._sent=d.arg;else if(d.method==="throw"){if(_==="suspendedStart")throw _="completed",d.arg;d.dispatchException(d.arg)}else d.method==="return"&&d.abrupt("return",d.arg);_="executing";var I=u(g,p,d);if(I.type==="normal"){if(_=d.done?"completed":"suspendedYield",I.arg===l)continue;return{value:I.arg,done:d.done}}I.type==="throw"&&(_="completed",d.method="throw",d.arg=I.arg)}}}function M(g,p){var d=p.method,_=g.iterator[d];if(_===void 0)return p.delegate=null,d==="throw"&&g.iterator.return&&(p.method="return",p.arg=void 0,M(g,p),p.method==="throw")||d!=="return"&&(p.method="throw",p.arg=new TypeError("The iterator does not provide a '"+d+"' method")),l;var E=u(_,g.iterator,p.arg);if(E.type==="throw")return p.method="throw",p.arg=E.arg,p.delegate=null,l;var P=E.arg;return P?P.done?(p[g.resultName]=P.value,p.next=g.nextLoc,p.method!=="return"&&(p.method="next",p.arg=void 0),p.delegate=null,l):P:(p.method="throw",p.arg=new TypeError("iterator result is not an object"),p.delegate=null,l)}function j(g){var p={tryLoc:g[0]};1 in g&&(p.catchLoc=g[1]),2 in g&&(p.finallyLoc=g[2],p.afterLoc=g[3]),this.tryEntries.push(p)}function N(g){var p=g.completion||{};p.type="normal",delete p.arg,g.completion=p}function U(g){this.tryEntries=[{tryLoc:"root"}],g.forEach(j,this),this.reset(!0)}function C(g){if(g||g===""){var p=g[o];if(p)return p.call(g);if(typeof g.next=="function")return g;if(!isNaN(g.length)){var d=-1,_=function E(){for(;++d<g.length;)if(r.call(g,d))return E.value=g[d],E.done=!1,E;return E.value=void 0,E.done=!0,E};return _.next=_}}throw new TypeError(Dr(g)+" is not iterable")}return v.prototype=m,n(R,"constructor",{value:m,configurable:!0}),n(m,"constructor",{value:v,configurable:!0}),v.displayName=a(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(g){var p=typeof g=="function"&&g.constructor;return!!p&&(p===v||(p.displayName||p.name)==="GeneratorFunction")},e.mark=function(g){return Object.setPrototypeOf?Object.setPrototypeOf(g,m):(g.__proto__=m,a(g,c,"GeneratorFunction")),g.prototype=Object.create(R),g},e.awrap=function(g){return{__await:g}},x(S.prototype),a(S.prototype,s,function(){return this}),e.AsyncIterator=S,e.async=function(g,p,d,_,E){E===void 0&&(E=Promise);var P=new S(f(g,p,d,_),E);return e.isGeneratorFunction(p)?P:P.next().then(function(D){return D.done?D.value:P.next()})},x(R),a(R,c,"Generator"),a(R,o,function(){return this}),a(R,"toString",function(){return"[object Generator]"}),e.keys=function(g){var p=Object(g),d=[];for(var _ in p)d.push(_);return d.reverse(),function E(){for(;d.length;){var P=d.pop();if(P in p)return E.value=P,E.done=!1,E}return E.done=!0,E}},e.values=C,U.prototype={constructor:U,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(N),!p)for(var d in this)d.charAt(0)==="t"&&r.call(this,d)&&!isNaN(+d.slice(1))&&(this[d]=void 0)},stop:function(){this.done=!0;var p=this.tryEntries[0].completion;if(p.type==="throw")throw p.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var d=this;function _(G,k){return D.type="throw",D.arg=p,d.next=G,k&&(d.method="next",d.arg=void 0),!!k}for(var E=this.tryEntries.length-1;E>=0;--E){var P=this.tryEntries[E],D=P.completion;if(P.tryLoc==="root")return _("end");if(P.tryLoc<=this.prev){var z=r.call(P,"catchLoc"),I=r.call(P,"finallyLoc");if(z&&I){if(this.prev<P.catchLoc)return _(P.catchLoc,!0);if(this.prev<P.finallyLoc)return _(P.finallyLoc)}else if(z){if(this.prev<P.catchLoc)return _(P.catchLoc,!0)}else{if(!I)throw new Error("try statement without catch or finally");if(this.prev<P.finallyLoc)return _(P.finallyLoc)}}}},abrupt:function(p,d){for(var _=this.tryEntries.length-1;_>=0;--_){var E=this.tryEntries[_];if(E.tryLoc<=this.prev&&r.call(E,"finallyLoc")&&this.prev<E.finallyLoc){var P=E;break}}P&&(p==="break"||p==="continue")&&P.tryLoc<=d&&d<=P.finallyLoc&&(P=null);var D=P?P.completion:{};return D.type=p,D.arg=d,P?(this.method="next",this.next=P.finallyLoc,l):this.complete(D)},complete:function(p,d){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&d&&(this.next=d),l},finish:function(p){for(var d=this.tryEntries.length-1;d>=0;--d){var _=this.tryEntries[d];if(_.finallyLoc===p)return this.complete(_.completion,_.afterLoc),N(_),l}},catch:function(p){for(var d=this.tryEntries.length-1;d>=0;--d){var _=this.tryEntries[d];if(_.tryLoc===p){var E=_.completion;if(E.type==="throw"){var P=E.arg;N(_)}return P}}throw new Error("illegal catch attempt")},delegateYield:function(p,d,_){return this.delegate={iterator:C(p),resultName:d,nextLoc:_},this.method==="next"&&(this.arg=void 0),l}},e}vt.exports=Ir,vt.exports.__esModule=!0,vt.exports.default=vt.exports});var Jt=Ue((Lc,jr)=>{var de=Nr()();jr.exports=de;try{regeneratorRuntime=de}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=de:Function("r","regeneratorRuntime = r")(de)}});var tc={};Bo(tc,{AnimationLoop:()=>be,AnimationLoopTemplate:()=>Fr,ClipSpace:()=>oo,ConeGeometry:()=>ho,CubeGeometry:()=>mo,CylinderGeometry:()=>yo,Geometry:()=>st,GroupNode:()=>ao,IcoSphereGeometry:()=>xo,KeyFrames:()=>Rr,Model:()=>ae,ModelNode:()=>co,PipelineFactory:()=>se,PlaneGeometry:()=>wo,ScenegraphNode:()=>It,ShaderModuleUniforms:()=>Qi,SphereGeometry:()=>Mo,Timeline:()=>Tr,Transform:()=>Ji,TruncatedConeGeometry:()=>Yt,makeAnimationLoop:()=>xn});function Ge(e){if(Array.isArray(e))return e}function ze(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,s,c=[],a=!0,f=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=o.call(r)).done)&&(c.push(n.value),c.length!==t);a=!0);}catch(u){f=!0,i=u}finally{try{if(!a&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw i}}return c}}function Nt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function $t(e,t){if(e){if(typeof e=="string")return Nt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Nt(e,t)}}function Be(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
8
8
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B(e,t){return Ge(e)||ze(e,t)||$t(e,t)||Be()}function tt(e){return tt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(e)}function ke(e,t){if(tt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(tt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zt(e){var t=ke(e,"string");return tt(t)==="symbol"?t:String(t)}function Pr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Zt(n.key),n)}}function A(e,t,r){return t&&Pr(e.prototype,t),r&&Pr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ve(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Vo(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
9
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function Vo(e,t){if(e){if(typeof e=="string")return Ar(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ar(e,t)}}function Ar(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Ho=1,qo=1,Tr=function(){function e(){T(this,e),this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}var t=e.prototype;return t.addChannel=function(n){var i=n.delay,o=i===void 0?0:i,s=n.duration,c=s===void 0?Number.POSITIVE_INFINITY:s,a=n.rate,f=a===void 0?1:a,u=n.repeat,l=u===void 0?1:u,h=Ho++,v={time:0,delay:o,duration:c,rate:f,repeat:l};return this._setChannelTime(v,this.time),this.channels.set(h,v),h},t.removeChannel=function(n){this.channels.delete(n);var i=Ve(this.animations),o;try{for(i.s();!(o=i.n()).done;){var s=B(o.value,2),c=s[0],a=s[1];a.channel===n&&this.detachAnimation(c)}}catch(f){i.e(f)}finally{i.f()}},t.isFinished=function(n){var i=this.channels.get(n);return i===void 0?!1:this.time>=i.delay+i.duration*i.repeat},t.getTime=function(n){if(n===void 0)return this.time;var i=this.channels.get(n);return i===void 0?-1:i.time},t.setTime=function(n){this.time=Math.max(0,n);var i=this.channels.values(),o=Ve(i),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;this._setChannelTime(c,this.time)}}catch(m){o.e(m)}finally{o.f()}var a=this.animations.values(),f=Ve(a),u;try{for(f.s();!(u=f.n()).done;){var l=u.value,h=l.animation,v=l.channel;h.setTime(this.getTime(v))}}catch(m){f.e(m)}finally{f.f()}},t.play=function(){this.playing=!0},t.pause=function(){this.playing=!1,this.lastEngineTime=-1},t.reset=function(){this.setTime(0)},t.attachAnimation=function(n,i){var o=qo++;return this.animations.set(o,{animation:n,channel:i}),n.setTime(this.getTime(i)),o},t.detachAnimation=function(n){this.animations.delete(n)},t.update=function(n){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=n),this.setTime(this.time+(n-this.lastEngineTime)),this.lastEngineTime=n)},t._setChannelTime=function(n,i){var o=i-n.delay,s=n.duration*n.repeat;o>=s?n.time=n.duration*n.rate:(n.time=Math.max(0,o)%n.duration,n.time*=n.rate)},A(e)}();var Rr=function(){function e(r){T(this,e),this.startIndex=-1,this.endIndex=-1,this.factor=0,this.times=[],this.values=[],this._lastTime=-1,this.setKeyFrames(r),this.setTime(0)}var t=e.prototype;return t.setKeyFrames=function(n){var i=n.length;this.times.length=i,this.values.length=i;for(var o=0;o<i;++o)this.times[o]=n[o][0],this.values[o]=n[o][1];this._calculateKeys(this._lastTime)},t.setTime=function(n){n=Math.max(0,n),n!==this._lastTime&&(this._calculateKeys(n),this._lastTime=n)},t.getStartTime=function(){return this.times[this.startIndex]},t.getEndTime=function(){return this.times[this.endIndex]},t.getStartData=function(){return this.values[this.startIndex]},t.getEndData=function(){return this.values[this.endIndex]},t._calculateKeys=function(n){var i=0,o=this.times.length;for(i=0;i<o-2&&!(this.times[i+1]>n);++i);this.startIndex=i,this.endIndex=i+1;var s=this.times[this.startIndex],c=this.times[this.endIndex];this.factor=Math.min(Math.max(0,(n-s)/(c-s)),1)},A(e)}();function Cr(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(f){r(f);return}c.done?t(a):Promise.resolve(a).then(n,i)}function lt(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(a){Cr(o,n,i,s,c,"next",a)}function c(a){Cr(o,n,i,s,c,"throw",a)}s(void 0)})}}var qe=pe(Jt(),1),Fr=function(){function e(r){T(this,e)}var t=e.prototype;return t.onInitialize=function(){var r=lt(qe.default.mark(function i(o){return qe.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",null);case 1:case"end":return c.stop()}},i)}));function n(i){return r.apply(this,arguments)}return n}(),A(e)}();function L(e,t,r){return t=Zt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var yt=pe(Jt(),1);function We(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function ct(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||We()}var Wo=globalThis.self||globalThis.window||globalThis.global,Nt=globalThis.window||globalThis.self||globalThis.global,Ko=globalThis.document||{},At=globalThis.process||{},Yo=globalThis.console,kc=globalThis.navigator||{};var me=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",qc=ct();function Xo(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var ge=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=Xo(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Ur(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function Gr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function ve(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let o=e.width*r,s=e.height*r,c=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(i,");"),"background-size:".concat(o,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),c]}var ye;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ye||(ye={}));var $o=10;function zr(e){return typeof e!="string"?e:(e=e.toUpperCase(),ye[e]||ye.WHITE)}function Br(e,t,r){if(!ct&&typeof e=="string"){if(t){let n=zr(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=zr(r);e="\x1B[".concat(n+$o,"m").concat(e,"\x1B[49m")}}return e}function kr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(c=>o===c)||(i[o]=s.bind(e)))}}function jt(e,t){if(!e)throw new Error(t||"Assertion failed")}function Tt(){let e;if(ct()&&Nt.performance){var t,r;e=Nt===null||Nt===void 0||(t=Nt.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in At){var n;let i=At===null||At===void 0||(n=At.hrtime)===null||n===void 0?void 0:n.call(At);e=i[0]*1e3+i[1]/1e6}else e=Date.now();return e}var Ft={debug:ct()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Zo={enabled:!0,level:0};function ht(){}var Vr={},Hr={once:!0},wt=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=me,this._startTs=Tt(),this._deltaTs=Tt(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new ge("__probe-".concat(this.id,"__"),Zo),this.timeStamp("".concat(this.id," started")),kr(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Tt()-this._startTs).toPrecision(10))}getDelta(){return Number((Tt()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){jt(t,r)}warn(t){return this._getLogFunction(0,t,Ft.warn,arguments,Hr)}error(t){return this._getLogFunction(0,t,Ft.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,Ft.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Ft.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Ft.debug||Ft.info,arguments,Hr)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||ht,n&&[n],{tag:es(r)}):ht}image(t){let{logLevel:r,priority:n,image:i,message:o="",scale:s=1}=t;return this._shouldLog(r||n)?ct()?ts({image:i,message:o,scale:s}):Qo({image:i,message:o,scale:s}):ht}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||ht)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=qr({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||ht)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Wr(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=qr({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,jt(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Tt();let s=o.tag||o.message;if(o.once&&s)if(!Vr[s])Vr[s]=Tt();else return ht;return r=Jo(this.id,o.message,o),n.bind(console,r,...o.args)}return ht}};wt.VERSION=me;function Wr(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return jt(Number.isFinite(t)&&t>=0),t}function qr(e){let{logLevel:t,message:r}=e;e.logLevel=Wr(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return jt(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function Jo(e,t,r){if(typeof t=="string"){let n=r.time?Gr(Ur(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=Br(t,r.color,r.background)}return t}function Qo(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),ht}function ts(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let o=new Image;return o.onload=()=>{let s=ve(o,r,n);console.log(...s)},o.src=t,ht}let i=t.nodeName||"";if(i.toLowerCase()==="img")return console.log(...ve(t,r,n)),ht;if(i.toLowerCase()==="canvas"){let o=new Image;return o.onload=()=>console.log(...ve(o,r,n)),o.src=t.toDataURL(),ht}return ht}function es(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var vf=new wt({id:"@probe.gl/log"});var K=new wt({id:"luma.gl"});function Qt(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Rt=class{constructor(t,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Qt(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Qt()-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 Et=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof Rt?i=t:i=new Rt(r,n),this.stats[r]=i),i}};var rs=function(){function e(){T(this,e),this.stats=new Map}var t=e.prototype;return t.getStats=function(n){return this.get(n)},t.get=function(n){return this.stats.has(n)||this.stats.set(n,new Et({id:n})),this.stats.get(n)},A(e)}(),Ut=new rs;function ns(){var e=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==e)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(e));return globalThis.luma||(ct()&&K.log(1,"luma.gl ".concat(e," - ").concat(t))(),globalThis.luma=globalThis.luma||{VERSION:e,version:e,log:K,stats:Ut}),e}var Kr=ns();function Yr(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)?e:null}function Gt(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number"?e:null:Yr(e)}var Ze=pe(Jt(),1);var Ke={};function H(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";Ke[e]=Ke[e]||1;var t=Ke[e]++;return"".concat(e,"-").concat(t)}function te(e,t){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},te(e,t)}function q(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&te(e,t)}function Ye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W(e,t){if(t&&(tt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ye(e)}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},F(e)}function Xr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function is(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xr(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ct=function(){function e(r,n,i){if(T(this,e),this.id=void 0,this.props=void 0,this.userData={},this.device=void 0,this._device=void 0,this.destroyed=!1,this.allocatedBytes=0,this._attachedResources=new Set,!r)throw new Error("no device");this._device=r,this.props=os(n,i);var o=this.props.id!=="undefined"?this.props.id:H(this[Symbol.toStringTag]);this.props.id=o,this.id=o,this.userData=this.props.userData||{},this.addStats()}var t=e.prototype;return t.destroy=function(){this.destroyResource()},t.delete=function(){return this.destroy(),this},t.toString=function(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")},t.getProps=function(){return this.props},t.attachResource=function(n){this._attachedResources.add(n)},t.detachResource=function(n){this._attachedResources.delete(n)},t.destroyAttachedResource=function(n){this._attachedResources.delete(n)&&n.destroy()},t.destroyAttachedResources=function(){for(var n=0,i=Object.values(this._attachedResources);n<i.length;n++){var o=i[n];o.destroy()}this._attachedResources=new Set},t.destroyResource=function(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0},t.removeStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("".concat(i,"s Active")).decrementCount()},t.trackAllocatedMemory=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(n),o.get("".concat(i," Memory")).addCount(n),this.allocatedBytes=n},t.trackDeallocatedMemory=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").subtractCount(this.allocatedBytes),i.get("".concat(n," Memory")).subtractCount(this.allocatedBytes),this.allocatedBytes=0},t.addStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("Resources Created").incrementCount(),n.get("".concat(i,"s Created")).incrementCount(),n.get("".concat(i,"s Active")).incrementCount()},A(e)}();Ct.defaultProps={id:"undefined",handle:void 0,userData:void 0};function os(e,t){var r=is({},t);for(var n in e)e[n]!==void 0&&(r[n]=e[n]);return r}var Zr;function $r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Xe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$r(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$r(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ss(e){var t=as();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function as(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}Zr=Symbol.toStringTag;var X=function(e){q(r,e);var t=ss(r);function r(i,o){var s;T(this,r);var c=Xe({},o);return(o.usage||0)&r.INDEX&&!o.indexType&&(o.data instanceof Uint32Array?c.indexType="uint32":o.data instanceof Uint16Array&&(c.indexType="uint16")),s=t.call(this,i,c,r.defaultProps),s.usage=void 0,s.indexType=void 0,s.byteLength=void 0,s.usage=o.usage||0,s.indexType=c.indexType,s}var n=r.prototype;return n.write=function(o,s){throw new Error("not implemented")},n.readAsync=function(o,s){throw new Error("not implemented")},n.getData=function(){throw new Error("not implemented")},A(r,[{key:Zr,get:function(){return"Buffer"}}]),r}(Ct);X.defaultProps=Xe(Xe({},Ct.defaultProps),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});X.MAP_READ=1;X.MAP_WRITE=2;X.COPY_SRC=4;X.COPY_DST=8;X.INDEX=16;X.VERTEX=32;X.UNIFORM=64;X.STORAGE=128;X.INDIRECT=256;X.QUERY_RESOLVE=512;var Qr;function Jr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jr(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var _e={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(K.get("debug")),break:[],gl:null};Qr=Symbol.toStringTag;var cs=function(){function e(r){T(this,e),this.id=void 0,this.statsManager=Ut,this.props=void 0,this.userData={},this._lumaData={},this.info=void 0,this.lost=void 0,this.canvasContext=void 0,this.props=$e($e({},_e),r),this.id=this.props.id||H(this[Symbol.toStringTag].toLowerCase())}var t=e.prototype;return t.loseDevice=function(){return!1},t.getCanvasContext=function(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext},t.createTexture=function(n){return(n instanceof Promise||typeof n=="string")&&(n={data:n}),this._createTexture(n)},t.createCommandEncoder=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("not implemented")},t._getBufferProps=function(n){(n instanceof ArrayBuffer||ArrayBuffer.isView(n))&&(n={data:n});var i=$e({},n);return(n.usage||0)&X.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?i.indexType="uint32":n.data instanceof Uint16Array?i.indexType="uint16":K.warn("indices buffer content must be of integer type")()),i},A(e,[{key:Qr,get:function(){return"Device"}}]),e}();cs.VERSION=Kr;function tn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function en(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fs(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=us(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
10
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function us(e,t){if(e){if(typeof e=="string")return rn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rn(e,t)}}function rn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var zt=new Map,Lt=function(){function e(){T(this,e)}return e.registerDevices=function(r){var n=fs(r),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;rt(o.type&&o.isSupported&&o.create),zt.set(o.type,o)}}catch(s){n.e(s)}finally{n.f()}},e.getAvailableDevices=function(){return Array.from(zt).map(function(r){return r.type})},e.getSupportedDevices=function(){return Array.from(zt).filter(function(r){return r.isSupported()}).map(function(r){return r.type})},e.setDefaultDeviceProps=function(r){Object.assign(_e,r)},e.createDevice=function(){var t=lt(Ze.default.mark(function n(){var i,o,s=arguments;return Ze.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:i=s.length>0&&s[0]!==void 0?s[0]:{},i=en(en({},_e),i),i.gl&&(i.type="webgl"),a.t0=i.type,a.next=a.t0==="webgpu"?6:a.t0==="webgl"||a.t0==="webgl1"||a.t0==="webgl2"?12:a.t0==="best-available"?18:24;break;case 6:if(o=zt.get("webgpu"),!o){a.next=11;break}return a.next=10,o.create(i);case 10:return a.abrupt("return",a.sent);case 11:return a.abrupt("break",24);case 12:if(o=zt.get("webgl"),!o){a.next=17;break}return a.next=16,o.create(i);case 16:return a.abrupt("return",a.sent);case 17:return a.abrupt("break",24);case 18:if(o=zt.get("webgl"),!(o&&o.isSupported())){a.next=23;break}return a.next=22,o.create(i);case 22:return a.abrupt("return",a.sent);case 23:return a.abrupt("break",24);case 24:throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.");case 25:case"end":return a.stop()}},n)}));function r(){return t.apply(this,arguments)}return r}(),A(e)}();Lt.stats=Ut;Lt.log=K;var sn;function nn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function on(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ls(e){var t=hs();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function hs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}sn=Symbol.toStringTag;var Bt=function(e){q(r,e);var t=ls(r);function r(n,i){var o;return T(this,r),o=t.call(this,n,i,r.defaultProps),o.hash="",o.vs=void 0,o.fs=void 0,o.shaderLayout=void 0,o.bufferLayout=void 0,o.shaderLayout=o.props.shaderLayout,o.bufferLayout=o.props.bufferLayout||[],o}return A(r,[{key:sn,get:function(){return"RenderPipeline"}}]),r}(Ct);Bt.defaultProps=on(on({},Ct.defaultProps),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});function an(e){var t=B(ds[e],2),r=t[0],n=t[1],i=r==="i32"||r==="u32",o=r!=="u32",s=ms[r]*n,c=ps(r,n);return{dataType:r,components:n,defaultVertexFormat:c,byteLength:s,integer:i,signed:o}}function ps(e,t){var r;switch(e){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?r:"".concat(r,"x").concat(t)}var ds={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]},ms={f32:4,f16:2,i32:4,u32:4};function fn(e){var t=cn[e],r=gs(t),n=e.includes("norm"),i=!n&&!e.startsWith("float"),o=e.startsWith("s");return{dataType:cn[e],byteLength:r,integer:i,signed:o,normalized:n}}function gs(e){var t=vs[e];return t}var cn={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},vs={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};function Je(e){var t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);var r=e.split("x"),n=B(r,2),i=n[0],o=n[1],s=i,c=o?parseInt(o):1,a=fn(s),f={type:s,components:c,byteLength:a.byteLength*c,integer:a.integer,signed:a.signed,normalized:a.normalized};return t&&(f.webglOnly=!0),f}function ee(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ys(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
11
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function ys(e,t){if(e){if(typeof e=="string")return un(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return un(e,t)}}function un(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Qe(e,t){var r={},n=ee(e.attributes),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;r[o.name]=_s(e,t,o.name)}}catch(s){n.e(s)}finally{n.f()}return r}function _s(e,t,r){var n=xs(e,r),i=bs(t,r);if(!n)return null;var o=an(n.type),s=i?.vertexFormat||o.defaultVertexFormat,c=Je(s);return{attributeName:i?.attributeName||n.name,bufferName:i?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:s,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:o.integer,stepMode:i?.stepMode||n.stepMode,byteOffset:i?.byteOffset||0,byteStride:i?.byteStride||0}}function xs(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||K.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function bs(e,t){Os(e);var r=ws(e,t);return r||(r=Es(e,t),r)?r:(K.warn('layout for attribute "'.concat(t,'" not present in buffer layout')),null)}function Os(e){var t=ee(e),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;(n.attributes&&n.format||!n.attributes&&!n.format)&&K.warn("BufferLayout ".concat(name," must have either 'attributes' or 'format' field"))}}catch(i){t.e(i)}finally{t.f()}}function ws(e,t){var r=ee(e),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.format&&i.name===t)return{attributeName:i.name,bufferName:t,stepMode:i.stepMode,vertexFormat:i.format,byteOffset:0,byteStride:i.byteStride||0}}}catch(o){r.e(o)}finally{r.f()}return null}function Es(e,t){var r=ee(e),n;try{for(r.s();!(n=r.n()).done;){var i,o=n.value,s=o.byteStride;if(typeof o.byteStride!="number"){var c=ee(o.attributes||[]),a;try{for(c.s();!(a=c.n()).done;){var f=a.value,u=Je(f.format);s+=u.byteLength}}catch(h){c.e(h)}finally{c.f()}}var l=(i=o.attributes)===null||i===void 0?void 0:i.find(function(h){return h.attribute===t});if(l)return{attributeName:l.attribute,bufferName:o.name,stepMode:o.stepMode,vertexFormat:l.format,byteOffset:l.byteOffset,byteStride:s}}}catch(h){r.e(h)}finally{r.f()}return null}function rt(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}var Ms={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function ln(e){var t=Ms[e];return rt(e),t}function hn(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}var xe;function pn(e){return(!xe||xe.byteLength<e)&&(xe=new ArrayBuffer(e)),xe}var dn=1024,tr=function(){function e(r){T(this,e),this.layout={},this.byteLength=void 0;for(var n=0,i=0,o=Object.entries(r);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1],f=ln(a),u=f.type,l=f.components;n=hn(n,l);var h=n;n+=l,this.layout[c]={type:u,size:l,offset:h}}n+=(4-n%4)%4;var v=n*4;this.byteLength=Math.max(v,dn)}var t=e.prototype;return t.getData=function(n){for(var i=Math.max(this.byteLength,dn),o=pn(i),s={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)},c=0,a=Object.entries(n);c<a.length;c++){var f=B(a[c],2),u=f[0],l=f[1],h=this.layout[u];if(!h){K.warn("Supplied uniform value ".concat(u," not present in uniform block layout"))();continue}var v=h.type,m=h.size,y=h.offset,b=s[v];if(m===1){if(typeof l!="number"&&typeof l!="boolean"){K.warn("Supplied value for single component uniform ".concat(u," is not a number: ").concat(l))();continue}b[y]=Number(l)}else{var O=Gt(l);if(!O){K.warn("Supplied value for multi component / array uniform ".concat(u," is not a numeric array: ").concat(l))();continue}b.set(O,y)}}return new Uint8Array(o)},t.has=function(n){return Boolean(this.layout[n])},t.get=function(n){var i=this.layout[n];return i},A(e)}();function re(e,t,r){if(e===t)return!0;if(!r||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!re(e[n],t[n],r-1))return!1;return!0}if(Array.isArray(t))return!1;if(tt(e)==="object"&&tt(t)==="object"){var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var s=0,c=i;s<c.length;s++){var a=c[s];if(!t.hasOwnProperty(a)||!re(e[a],t[a],r-1))return!1}return!0}return!1}function er(e){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,1e3/60)}function rr(e){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e)}var mn=function(t){return"".concat(t)};function gn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ss=0,Ps={device:null,onAddHTML:function(){return""},onInitialize:function(){var e=lt(yt.default.mark(function r(){return yt.default.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",null);case 1:case"end":return i.stop()}},r)}));function t(){return e.apply(this,arguments)}return t}(),onRender:function(){},onFinalize:function(){},onError:function(t){return console.error(t)},stats:Lt.stats.get("animation-loop-".concat(Ss++)),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1},be=function(){function e(r){if(T(this,e),this.device=null,this.canvas=null,this.props=void 0,this.animationProps=null,this.timeline=null,this.stats=void 0,this.cpuTime=void 0,this.gpuTime=void 0,this.frameRate=void 0,this.display=void 0,this.needsRedraw="initialized",this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.props=vn(vn({},Ps),r),r=this.props,!r.device)throw new Error("No device provided");var n=this.props.useDevicePixels,i=n===void 0?!0:n;this.stats=r.stats||new Et({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:r.autoResizeViewport,autoResizeDrawingBuffer:r.autoResizeDrawingBuffer,useDevicePixels:i}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}var t=e.prototype;return t.destroy=function(){this.stop(),this._setDisplay(null)},t.delete=function(){this.destroy()},t.setNeedsRedraw=function(n){return this.needsRedraw=this.needsRedraw||n,this},t.setProps=function(n){return"autoResizeViewport"in n&&(this.props.autoResizeViewport=n.autoResizeViewport||!1),"autoResizeDrawingBuffer"in n&&(this.props.autoResizeDrawingBuffer=n.autoResizeDrawingBuffer||!1),"useDevicePixels"in n&&(this.props.useDevicePixels=n.useDevicePixels||!1),this},t.start=function(){var r=lt(yt.default.mark(function i(){var o,s;return yt.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!this._running){a.next=2;break}return a.abrupt("return",this);case 2:if(this._running=!0,a.prev=3,this._running){a.next=6;break}return a.abrupt("return",null);case 6:if(this._initialized){a.next=13;break}return this._initialized=!0,a.next=10,this._initDevice();case 10:return this._initialize(),a.next=13,this.props.onInitialize(this._getAnimationProps());case 13:if(this._running){a.next=15;break}return a.abrupt("return",null);case 15:return o!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),a.abrupt("return",this);case 19:throw a.prev=19,a.t0=a.catch(3),s=a.t0 instanceof Error?a.t0:new Error("Unknown error"),this.props.onError(s),s;case 24:case"end":return a.stop()}},i,this,[[3,19]])}));function n(){return r.apply(this,arguments)}return n}(),t.redraw=function(){var n;return(n=this.device)!==null&&n!==void 0&&n.isLost?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)},t.stop=function(){return this._running&&(this.animationProps&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this},t.attachTimeline=function(n){return this.timeline=n,this.timeline},t.detachTimeline=function(){this.timeline=null},t.waitForRender=function(){var n=this;return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(function(i){n._resolveNextFrame=i})),this._nextFramePromise},t.toDataURL=function(){var r=lt(yt.default.mark(function i(){return yt.default.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return this.setNeedsRedraw("toDataURL"),s.next=3,this.waitForRender();case 3:if(!(this.canvas instanceof HTMLCanvasElement)){s.next=5;break}return s.abrupt("return",this.canvas.toDataURL());case 5:throw new Error("OffscreenCanvas");case 6:case"end":return s.stop()}},i,this)}));function n(){return r.apply(this,arguments)}return n}(),t._initialize=function(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeCanvasDrawingBuffer(),this._resizeViewport()},t._setDisplay=function(n){this.display&&(this.display.destroy(),this.display.animationLoop=null),n&&(n.animationLoop=this),this.display=n},t._requestAnimationFrame=function(){this._running&&(this._animationFrameId=er(this._animationFrame.bind(this)))},t._cancelAnimationFrame=function(){this._animationFrameId===null&&(rr(this._animationFrameId),this._animationFrameId=null)},t._animationFrame=function(){this._running&&(this.redraw(),this._requestAnimationFrame())},t._renderFrame=function(n){if(this.display){this.display._renderFrame(n);return}this.props.onRender(this._getAnimationProps())},t._clearNeedsRedraw=function(){this.needsRedraw=!1},t._setupFrame=function(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()},t._initializeAnimationProps=function(){var n;if(!this.device)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:(n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0?void 0:n.canvas,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}},t._getAnimationProps=function(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps},t._updateAnimationProps=function(){if(this.animationProps){var n=this._getSizeAndAspect(),i=n.width,o=n.height,s=n.aspect;(i!==this.animationProps.width||o!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),s!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=i,this.animationProps.height=o,this.animationProps.aspect=s,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}},t._initDevice=function(){var r=lt(yt.default.mark(function i(){var o;return yt.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this.props.device;case 2:if(this.device=c.sent,this.device){c.next=5;break}throw new Error("No device provided");case 5:this.canvas=((o=this.device.canvasContext)===null||o===void 0?void 0:o.canvas)||null;case 6:case"end":return c.stop()}},i,this)}));function n(){return r.apply(this,arguments)}return n}(),t._createInfoDiv=function(){if(this.canvas&&this.props.onAddHTML){var n=document.createElement("div");document.body.appendChild(n),n.style.position="relative";var i=document.createElement("div");i.style.position="absolute",i.style.left="10px",i.style.bottom="10px",i.style.width="300px",i.style.background="white",this.canvas instanceof HTMLCanvasElement&&n.appendChild(this.canvas),n.appendChild(i);var o=this.props.onAddHTML(i);o&&(i.innerHTML=o)}},t._getSizeAndAspect=function(){var n,i;if(!this.device)return{width:1,height:1,aspect:1};var o=((n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0?void 0:n.getPixelSize())||[1,1],s=B(o,2),c=s[0],a=s[1],f=1,u=(i=this.device)===null||i===void 0||(i=i.canvasContext)===null||i===void 0?void 0:i.canvas;return u&&u.clientHeight?f=u.clientWidth/u.clientHeight:c>0&&a>0&&(f=c/a),{width:c,height:a,aspect:f}},t._resizeViewport=function(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)},t._resizeCanvasDrawingBuffer=function(){if(this.props.autoResizeDrawingBuffer){var n;(n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0||n.resize({useDevicePixels:this.props.useDevicePixels})}},t._beginFrameTimers=function(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()},t._endFrameTimers=function(){this.cpuTime.timeEnd()},t._startEventHandling=function(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))},t._onMousemove=function(n){n instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[n.offsetX,n.offsetY])},t._onMouseleave=function(n){this._getAnimationProps()._mousePosition=null},A(e)}();var nr=pe(Jt(),1);function yn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xn(e,t){var r=this,n=null,i=t?.device||Lt.createDevice(),o=new be(_n(_n({},t),{},{device:i,onInitialize:function(c){return lt(nr.default.mark(function a(){var f;return nr.default.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=new e(c),l.next=3,(f=n)===null||f===void 0?void 0:f.onInitialize(c);case 3:return l.abrupt("return",l.sent);case 4:case"end":return l.stop()}},a)}))()},onRender:function(c){var a;return(a=n)===null||a===void 0?void 0:a.onRender(c)},onFinalize:function(c){var a;return(a=n)===null||a===void 0?void 0:a.onFinalize(c)}}));return o.getInfo=function(){return r.AnimationLoopTemplateCtor.info},o}function ir(e){if(Array.isArray(e))return It(e)}function or(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function sr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
12
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ne(e){return ir(e)||or(e)||$t(e)||sr()}var nt=function(t){return"".concat(t)};function dt(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}function bn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Mt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ar={number:{type:"number",validate:function(t,r){return Number.isFinite(t)&&tt(r)==="object"&&(r.max===void 0||t<=r.max)&&(r.min===void 0||t>=r.min)}},array:{type:"array",validate:function(t,r){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function wn(e){for(var t={},r=0,n=Object.entries(e);r<n.length;r++){var i=B(n[r],2),o=i[0],s=i[1];t[o]=As(s)}return t}function En(e,t,r){for(var n={},i=0,o=Object.entries(t);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1];e&&c in e&&!a.private?(a.validate&&dt(a.validate(e[c],a),"".concat(r,": invalid ").concat(c)),n[c]=e[c]):n[c]=a.value}return n}function As(e){var t=On(e);if(t!=="object")return Mt(Mt({value:e},ar[t]),{},{type:t});if(tt(e)==="object")return e?e.type!==void 0?Mt(Mt(Mt({},e),ar[e.type]),{},{type:e.type}):e.value===void 0?{type:"object",value:e}:(t=On(e.value),Mt(Mt(Mt({},e),ar[t]),{},{type:t})):{type:"object",value:null};throw new Error("props")}function On(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":tt(e)}function $(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Mn,Sn,Pn=nt(Mn||(Mn=$([`#ifdef MODULE_LOGDEPTH
9
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function Vo(e,t){if(e){if(typeof e=="string")return Ar(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ar(e,t)}}function Ar(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Ho=1,qo=1,Tr=function(){function e(){T(this,e),this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}var t=e.prototype;return t.addChannel=function(n){var i=n.delay,o=i===void 0?0:i,s=n.duration,c=s===void 0?Number.POSITIVE_INFINITY:s,a=n.rate,f=a===void 0?1:a,u=n.repeat,l=u===void 0?1:u,h=Ho++,v={time:0,delay:o,duration:c,rate:f,repeat:l};return this._setChannelTime(v,this.time),this.channels.set(h,v),h},t.removeChannel=function(n){this.channels.delete(n);var i=Ve(this.animations),o;try{for(i.s();!(o=i.n()).done;){var s=B(o.value,2),c=s[0],a=s[1];a.channel===n&&this.detachAnimation(c)}}catch(f){i.e(f)}finally{i.f()}},t.isFinished=function(n){var i=this.channels.get(n);return i===void 0?!1:this.time>=i.delay+i.duration*i.repeat},t.getTime=function(n){if(n===void 0)return this.time;var i=this.channels.get(n);return i===void 0?-1:i.time},t.setTime=function(n){this.time=Math.max(0,n);var i=this.channels.values(),o=Ve(i),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;this._setChannelTime(c,this.time)}}catch(m){o.e(m)}finally{o.f()}var a=this.animations.values(),f=Ve(a),u;try{for(f.s();!(u=f.n()).done;){var l=u.value,h=l.animation,v=l.channel;h.setTime(this.getTime(v))}}catch(m){f.e(m)}finally{f.f()}},t.play=function(){this.playing=!0},t.pause=function(){this.playing=!1,this.lastEngineTime=-1},t.reset=function(){this.setTime(0)},t.attachAnimation=function(n,i){var o=qo++;return this.animations.set(o,{animation:n,channel:i}),n.setTime(this.getTime(i)),o},t.detachAnimation=function(n){this.animations.delete(n)},t.update=function(n){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=n),this.setTime(this.time+(n-this.lastEngineTime)),this.lastEngineTime=n)},t._setChannelTime=function(n,i){var o=i-n.delay,s=n.duration*n.repeat;o>=s?n.time=n.duration*n.rate:(n.time=Math.max(0,o)%n.duration,n.time*=n.rate)},A(e)}();var Rr=function(){function e(r){T(this,e),this.startIndex=-1,this.endIndex=-1,this.factor=0,this.times=[],this.values=[],this._lastTime=-1,this.setKeyFrames(r),this.setTime(0)}var t=e.prototype;return t.setKeyFrames=function(n){var i=n.length;this.times.length=i,this.values.length=i;for(var o=0;o<i;++o)this.times[o]=n[o][0],this.values[o]=n[o][1];this._calculateKeys(this._lastTime)},t.setTime=function(n){n=Math.max(0,n),n!==this._lastTime&&(this._calculateKeys(n),this._lastTime=n)},t.getStartTime=function(){return this.times[this.startIndex]},t.getEndTime=function(){return this.times[this.endIndex]},t.getStartData=function(){return this.values[this.startIndex]},t.getEndData=function(){return this.values[this.endIndex]},t._calculateKeys=function(n){var i=0,o=this.times.length;for(i=0;i<o-2&&!(this.times[i+1]>n);++i);this.startIndex=i,this.endIndex=i+1;var s=this.times[this.startIndex],c=this.times[this.endIndex];this.factor=Math.min(Math.max(0,(n-s)/(c-s)),1)},A(e)}();function Cr(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(f){r(f);return}c.done?t(a):Promise.resolve(a).then(n,i)}function lt(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(a){Cr(o,n,i,s,c,"next",a)}function c(a){Cr(o,n,i,s,c,"throw",a)}s(void 0)})}}var qe=pe(Jt(),1),Fr=function(){function e(r){T(this,e)}var t=e.prototype;return t.onInitialize=function(){var r=lt(qe.default.mark(function i(o){return qe.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",null);case 1:case"end":return c.stop()}},i)}));function n(i){return r.apply(this,arguments)}return n}(),A(e)}();function L(e,t,r){return t=Zt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var yt=pe(Jt(),1);function We(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function ct(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||We()}var Wo=globalThis.self||globalThis.window||globalThis.global,jt=globalThis.window||globalThis.self||globalThis.global,Ko=globalThis.document||{},Tt=globalThis.process||{},Yo=globalThis.console,kc=globalThis.navigator||{};var me=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",qc=ct();function Xo(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var ge=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=Xo(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Ur(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function Gr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function ve(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let o=e.width*r,s=e.height*r,c=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(i,");"),"background-size:".concat(o,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),c]}var ye;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ye||(ye={}));var $o=10;function zr(e){return typeof e!="string"?e:(e=e.toUpperCase(),ye[e]||ye.WHITE)}function Br(e,t,r){if(!ct&&typeof e=="string"){if(t){let n=zr(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=zr(r);e="\x1B[".concat(n+$o,"m").concat(e,"\x1B[49m")}}return e}function kr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(c=>o===c)||(i[o]=s.bind(e)))}}function Ft(e,t){if(!e)throw new Error(t||"Assertion failed")}function Rt(){let e;if(ct()&&jt.performance){var t,r;e=jt===null||jt===void 0||(t=jt.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in Tt){var n;let i=Tt===null||Tt===void 0||(n=Tt.hrtime)===null||n===void 0?void 0:n.call(Tt);e=i[0]*1e3+i[1]/1e6}else e=Date.now();return e}var Ut={debug:ct()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Zo={enabled:!0,level:0};function ht(){}var Vr={},Hr={once:!0},wt=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=me,this._startTs=Rt(),this._deltaTs=Rt(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new ge("__probe-".concat(this.id,"__"),Zo),this.timeStamp("".concat(this.id," started")),kr(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Rt()-this._startTs).toPrecision(10))}getDelta(){return Number((Rt()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){Ft(t,r)}warn(t){return this._getLogFunction(0,t,Ut.warn,arguments,Hr)}error(t){return this._getLogFunction(0,t,Ut.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,Ut.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Ut.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Ut.debug||Ut.info,arguments,Hr)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||ht,n&&[n],{tag:es(r)}):ht}image(t){let{logLevel:r,priority:n,image:i,message:o="",scale:s=1}=t;return this._shouldLog(r||n)?ct()?ts({image:i,message:o,scale:s}):Qo({image:i,message:o,scale:s}):ht}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||ht)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=qr({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||ht)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Wr(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=qr({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,Ft(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Rt();let s=o.tag||o.message;if(o.once&&s)if(!Vr[s])Vr[s]=Rt();else return ht;return r=Jo(this.id,o.message,o),n.bind(console,r,...o.args)}return ht}};wt.VERSION=me;function Wr(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Ft(Number.isFinite(t)&&t>=0),t}function qr(e){let{logLevel:t,message:r}=e;e.logLevel=Wr(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return Ft(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function Jo(e,t,r){if(typeof t=="string"){let n=r.time?Gr(Ur(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=Br(t,r.color,r.background)}return t}function Qo(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),ht}function ts(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let o=new Image;return o.onload=()=>{let s=ve(o,r,n);console.log(...s)},o.src=t,ht}let i=t.nodeName||"";if(i.toLowerCase()==="img")return console.log(...ve(t,r,n)),ht;if(i.toLowerCase()==="canvas"){let o=new Image;return o.onload=()=>console.log(...ve(o,r,n)),o.src=t.toDataURL(),ht}return ht}function es(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var vf=new wt({id:"@probe.gl/log"});var K=new wt({id:"luma.gl"});function Qt(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Ct=class{constructor(t,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Qt(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Qt()-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 Et=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof Ct?i=t:i=new Ct(r,n),this.stats[r]=i),i}};var rs=function(){function e(){T(this,e),this.stats=new Map}var t=e.prototype;return t.getStats=function(n){return this.get(n)},t.get=function(n){return this.stats.has(n)||this.stats.set(n,new Et({id:n})),this.stats.get(n)},A(e)}(),Gt=new rs;function ns(){var e=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==e)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(e));return globalThis.luma||(ct()&&K.log(1,"luma.gl ".concat(e," - ").concat(t))(),globalThis.luma=globalThis.luma||{VERSION:e,version:e,log:K,stats:Gt}),e}var Kr=ns();function Yr(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)?e:null}function Mt(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number"?e:null:Yr(e)}var Ze=pe(Jt(),1);var Ke={};function H(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";Ke[e]=Ke[e]||1;var t=Ke[e]++;return"".concat(e,"-").concat(t)}function te(e,t){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},te(e,t)}function q(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&te(e,t)}function Ye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W(e,t){if(t&&(tt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ye(e)}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},F(e)}function Xr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function is(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xr(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Lt=function(){function e(r,n,i){if(T(this,e),this.id=void 0,this.props=void 0,this.userData={},this.device=void 0,this._device=void 0,this.destroyed=!1,this.allocatedBytes=0,this._attachedResources=new Set,!r)throw new Error("no device");this._device=r,this.props=os(n,i);var o=this.props.id!=="undefined"?this.props.id:H(this[Symbol.toStringTag]);this.props.id=o,this.id=o,this.userData=this.props.userData||{},this.addStats()}var t=e.prototype;return t.destroy=function(){this.destroyResource()},t.delete=function(){return this.destroy(),this},t.toString=function(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")},t.getProps=function(){return this.props},t.attachResource=function(n){this._attachedResources.add(n)},t.detachResource=function(n){this._attachedResources.delete(n)},t.destroyAttachedResource=function(n){this._attachedResources.delete(n)&&n.destroy()},t.destroyAttachedResources=function(){for(var n=0,i=Object.values(this._attachedResources);n<i.length;n++){var o=i[n];o.destroy()}this._attachedResources=new Set},t.destroyResource=function(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0},t.removeStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("".concat(i,"s Active")).decrementCount()},t.trackAllocatedMemory=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(n),o.get("".concat(i," Memory")).addCount(n),this.allocatedBytes=n},t.trackDeallocatedMemory=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").subtractCount(this.allocatedBytes),i.get("".concat(n," Memory")).subtractCount(this.allocatedBytes),this.allocatedBytes=0},t.addStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("Resources Created").incrementCount(),n.get("".concat(i,"s Created")).incrementCount(),n.get("".concat(i,"s Active")).incrementCount()},A(e)}();Lt.defaultProps={id:"undefined",handle:void 0,userData:void 0};function os(e,t){var r=is({},t);for(var n in e)e[n]!==void 0&&(r[n]=e[n]);return r}var Zr;function $r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Xe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$r(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$r(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ss(e){var t=as();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function as(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}Zr=Symbol.toStringTag;var X=function(e){q(r,e);var t=ss(r);function r(i,o){var s;T(this,r);var c=Xe({},o);return(o.usage||0)&r.INDEX&&!o.indexType&&(o.data instanceof Uint32Array?c.indexType="uint32":o.data instanceof Uint16Array&&(c.indexType="uint16")),s=t.call(this,i,c,r.defaultProps),s.usage=void 0,s.indexType=void 0,s.byteLength=void 0,s.usage=o.usage||0,s.indexType=c.indexType,s}var n=r.prototype;return n.write=function(o,s){throw new Error("not implemented")},n.readAsync=function(o,s){throw new Error("not implemented")},n.getData=function(){throw new Error("not implemented")},A(r,[{key:Zr,get:function(){return"Buffer"}}]),r}(Lt);X.defaultProps=Xe(Xe({},Lt.defaultProps),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});X.MAP_READ=1;X.MAP_WRITE=2;X.COPY_SRC=4;X.COPY_DST=8;X.INDEX=16;X.VERTEX=32;X.UNIFORM=64;X.STORAGE=128;X.INDIRECT=256;X.QUERY_RESOLVE=512;var Qr;function Jr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jr(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var _e={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(K.get("debug")),break:[],gl:null};Qr=Symbol.toStringTag;var cs=function(){function e(r){T(this,e),this.id=void 0,this.statsManager=Gt,this.props=void 0,this.userData={},this._lumaData={},this.info=void 0,this.lost=void 0,this.canvasContext=void 0,this.props=$e($e({},_e),r),this.id=this.props.id||H(this[Symbol.toStringTag].toLowerCase())}var t=e.prototype;return t.loseDevice=function(){return!1},t.getCanvasContext=function(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext},t.createTexture=function(n){return(n instanceof Promise||typeof n=="string")&&(n={data:n}),this._createTexture(n)},t.createCommandEncoder=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("not implemented")},t._getBufferProps=function(n){(n instanceof ArrayBuffer||ArrayBuffer.isView(n))&&(n={data:n});var i=$e({},n);return(n.usage||0)&X.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?i.indexType="uint32":n.data instanceof Uint16Array?i.indexType="uint16":K.warn("indices buffer content must be of integer type")()),i},A(e,[{key:Qr,get:function(){return"Device"}}]),e}();cs.VERSION=Kr;function tn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function en(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fs(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=us(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
10
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function us(e,t){if(e){if(typeof e=="string")return rn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rn(e,t)}}function rn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var zt=new Map,Dt=function(){function e(){T(this,e)}return e.registerDevices=function(r){var n=fs(r),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;rt(o.type&&o.isSupported&&o.create),zt.set(o.type,o)}}catch(s){n.e(s)}finally{n.f()}},e.getAvailableDevices=function(){return Array.from(zt).map(function(r){return r.type})},e.getSupportedDevices=function(){return Array.from(zt).filter(function(r){return r.isSupported()}).map(function(r){return r.type})},e.setDefaultDeviceProps=function(r){Object.assign(_e,r)},e.createDevice=function(){var t=lt(Ze.default.mark(function n(){var i,o,s=arguments;return Ze.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:i=s.length>0&&s[0]!==void 0?s[0]:{},i=en(en({},_e),i),i.gl&&(i.type="webgl"),a.t0=i.type,a.next=a.t0==="webgpu"?6:a.t0==="webgl"||a.t0==="webgl1"||a.t0==="webgl2"?12:a.t0==="best-available"?18:24;break;case 6:if(o=zt.get("webgpu"),!o){a.next=11;break}return a.next=10,o.create(i);case 10:return a.abrupt("return",a.sent);case 11:return a.abrupt("break",24);case 12:if(o=zt.get("webgl"),!o){a.next=17;break}return a.next=16,o.create(i);case 16:return a.abrupt("return",a.sent);case 17:return a.abrupt("break",24);case 18:if(o=zt.get("webgl"),!(o&&o.isSupported())){a.next=23;break}return a.next=22,o.create(i);case 22:return a.abrupt("return",a.sent);case 23:return a.abrupt("break",24);case 24:throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.");case 25:case"end":return a.stop()}},n)}));function r(){return t.apply(this,arguments)}return r}(),A(e)}();Dt.stats=Gt;Dt.log=K;var sn;function nn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function on(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ls(e){var t=hs();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function hs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}sn=Symbol.toStringTag;var Bt=function(e){q(r,e);var t=ls(r);function r(n,i){var o;return T(this,r),o=t.call(this,n,i,r.defaultProps),o.hash="",o.vs=void 0,o.fs=void 0,o.shaderLayout=void 0,o.bufferLayout=void 0,o.shaderLayout=o.props.shaderLayout,o.bufferLayout=o.props.bufferLayout||[],o}return A(r,[{key:sn,get:function(){return"RenderPipeline"}}]),r}(Lt);Bt.defaultProps=on(on({},Lt.defaultProps),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});function an(e){var t=B(ds[e],2),r=t[0],n=t[1],i=r==="i32"||r==="u32",o=r!=="u32",s=ms[r]*n,c=ps(r,n);return{dataType:r,components:n,defaultVertexFormat:c,byteLength:s,integer:i,signed:o}}function ps(e,t){var r;switch(e){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?r:"".concat(r,"x").concat(t)}var ds={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]},ms={f32:4,f16:2,i32:4,u32:4};function fn(e){var t=cn[e],r=gs(t),n=e.includes("norm"),i=!n&&!e.startsWith("float"),o=e.startsWith("s");return{dataType:cn[e],byteLength:r,integer:i,signed:o,normalized:n}}function gs(e){var t=vs[e];return t}var cn={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},vs={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};function Je(e){var t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);var r=e.split("x"),n=B(r,2),i=n[0],o=n[1],s=i,c=o?parseInt(o):1,a=fn(s),f={type:s,components:c,byteLength:a.byteLength*c,integer:a.integer,signed:a.signed,normalized:a.normalized};return t&&(f.webglOnly=!0),f}function ee(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ys(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
11
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function ys(e,t){if(e){if(typeof e=="string")return un(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return un(e,t)}}function un(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Qe(e,t){var r={},n=ee(e.attributes),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;r[o.name]=_s(e,t,o.name)}}catch(s){n.e(s)}finally{n.f()}return r}function _s(e,t,r){var n=xs(e,r),i=bs(t,r);if(!n)return null;var o=an(n.type),s=i?.vertexFormat||o.defaultVertexFormat,c=Je(s);return{attributeName:i?.attributeName||n.name,bufferName:i?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:s,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:o.integer,stepMode:i?.stepMode||n.stepMode,byteOffset:i?.byteOffset||0,byteStride:i?.byteStride||0}}function xs(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||K.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function bs(e,t){Os(e);var r=ws(e,t);return r||(r=Es(e,t),r)?r:(K.warn('layout for attribute "'.concat(t,'" not present in buffer layout')),null)}function Os(e){var t=ee(e),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;(n.attributes&&n.format||!n.attributes&&!n.format)&&K.warn("BufferLayout ".concat(name," must have either 'attributes' or 'format' field"))}}catch(i){t.e(i)}finally{t.f()}}function ws(e,t){var r=ee(e),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.format&&i.name===t)return{attributeName:i.name,bufferName:t,stepMode:i.stepMode,vertexFormat:i.format,byteOffset:0,byteStride:i.byteStride||0}}}catch(o){r.e(o)}finally{r.f()}return null}function Es(e,t){var r=ee(e),n;try{for(r.s();!(n=r.n()).done;){var i,o=n.value,s=o.byteStride;if(typeof o.byteStride!="number"){var c=ee(o.attributes||[]),a;try{for(c.s();!(a=c.n()).done;){var f=a.value,u=Je(f.format);s+=u.byteLength}}catch(h){c.e(h)}finally{c.f()}}var l=(i=o.attributes)===null||i===void 0?void 0:i.find(function(h){return h.attribute===t});if(l)return{attributeName:l.attribute,bufferName:o.name,stepMode:o.stepMode,vertexFormat:l.format,byteOffset:l.byteOffset,byteStride:s}}}catch(h){r.e(h)}finally{r.f()}return null}function rt(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}var Ms={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function ln(e){var t=Ms[e];return rt(e),t}function hn(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}var xe;function pn(e){return(!xe||xe.byteLength<e)&&(xe=new ArrayBuffer(e)),xe}var dn=1024,tr=function(){function e(r){T(this,e),this.layout={},this.byteLength=void 0;for(var n=0,i=0,o=Object.entries(r);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1],f=ln(a),u=f.type,l=f.components;n=hn(n,l);var h=n;n+=l,this.layout[c]={type:u,size:l,offset:h}}n+=(4-n%4)%4;var v=n*4;this.byteLength=Math.max(v,dn)}var t=e.prototype;return t.getData=function(n){for(var i=Math.max(this.byteLength,dn),o=pn(i),s={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)},c=0,a=Object.entries(n);c<a.length;c++){var f=B(a[c],2),u=f[0],l=f[1],h=this.layout[u];if(!h){K.warn("Supplied uniform value ".concat(u," not present in uniform block layout"))();continue}var v=h.type,m=h.size,y=h.offset,b=s[v];if(m===1){if(typeof l!="number"&&typeof l!="boolean"){K.warn("Supplied value for single component uniform ".concat(u," is not a number: ").concat(l))();continue}b[y]=Number(l)}else{var O=Mt(l);if(!O){K.warn("Supplied value for multi component / array uniform ".concat(u," is not a numeric array: ").concat(l))();continue}b.set(O,y)}}return new Uint8Array(o)},t.has=function(n){return Boolean(this.layout[n])},t.get=function(n){var i=this.layout[n];return i},A(e)}();function re(e,t,r){if(e===t)return!0;if(!r||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!re(e[n],t[n],r-1))return!1;return!0}if(Array.isArray(t))return!1;if(tt(e)==="object"&&tt(t)==="object"){var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var s=0,c=i;s<c.length;s++){var a=c[s];if(!t.hasOwnProperty(a)||!re(e[a],t[a],r-1))return!1}return!0}return!1}function er(e){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,1e3/60)}function rr(e){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e)}var mn=function(t){return"".concat(t)};function gn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ss=0,Ps={device:null,onAddHTML:function(){return""},onInitialize:function(){var e=lt(yt.default.mark(function r(){return yt.default.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",null);case 1:case"end":return i.stop()}},r)}));function t(){return e.apply(this,arguments)}return t}(),onRender:function(){},onFinalize:function(){},onError:function(t){return console.error(t)},stats:Dt.stats.get("animation-loop-".concat(Ss++)),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1},be=function(){function e(r){if(T(this,e),this.device=null,this.canvas=null,this.props=void 0,this.animationProps=null,this.timeline=null,this.stats=void 0,this.cpuTime=void 0,this.gpuTime=void 0,this.frameRate=void 0,this.display=void 0,this.needsRedraw="initialized",this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.props=vn(vn({},Ps),r),r=this.props,!r.device)throw new Error("No device provided");var n=this.props.useDevicePixels,i=n===void 0?!0:n;this.stats=r.stats||new Et({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:r.autoResizeViewport,autoResizeDrawingBuffer:r.autoResizeDrawingBuffer,useDevicePixels:i}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}var t=e.prototype;return t.destroy=function(){this.stop(),this._setDisplay(null)},t.delete=function(){this.destroy()},t.setNeedsRedraw=function(n){return this.needsRedraw=this.needsRedraw||n,this},t.setProps=function(n){return"autoResizeViewport"in n&&(this.props.autoResizeViewport=n.autoResizeViewport||!1),"autoResizeDrawingBuffer"in n&&(this.props.autoResizeDrawingBuffer=n.autoResizeDrawingBuffer||!1),"useDevicePixels"in n&&(this.props.useDevicePixels=n.useDevicePixels||!1),this},t.start=function(){var r=lt(yt.default.mark(function i(){var o,s;return yt.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!this._running){a.next=2;break}return a.abrupt("return",this);case 2:if(this._running=!0,a.prev=3,this._running){a.next=6;break}return a.abrupt("return",null);case 6:if(this._initialized){a.next=13;break}return this._initialized=!0,a.next=10,this._initDevice();case 10:return this._initialize(),a.next=13,this.props.onInitialize(this._getAnimationProps());case 13:if(this._running){a.next=15;break}return a.abrupt("return",null);case 15:return o!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),a.abrupt("return",this);case 19:throw a.prev=19,a.t0=a.catch(3),s=a.t0 instanceof Error?a.t0:new Error("Unknown error"),this.props.onError(s),s;case 24:case"end":return a.stop()}},i,this,[[3,19]])}));function n(){return r.apply(this,arguments)}return n}(),t.redraw=function(){var n;return(n=this.device)!==null&&n!==void 0&&n.isLost?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)},t.stop=function(){return this._running&&(this.animationProps&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this},t.attachTimeline=function(n){return this.timeline=n,this.timeline},t.detachTimeline=function(){this.timeline=null},t.waitForRender=function(){var n=this;return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(function(i){n._resolveNextFrame=i})),this._nextFramePromise},t.toDataURL=function(){var r=lt(yt.default.mark(function i(){return yt.default.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return this.setNeedsRedraw("toDataURL"),s.next=3,this.waitForRender();case 3:if(!(this.canvas instanceof HTMLCanvasElement)){s.next=5;break}return s.abrupt("return",this.canvas.toDataURL());case 5:throw new Error("OffscreenCanvas");case 6:case"end":return s.stop()}},i,this)}));function n(){return r.apply(this,arguments)}return n}(),t._initialize=function(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeCanvasDrawingBuffer(),this._resizeViewport()},t._setDisplay=function(n){this.display&&(this.display.destroy(),this.display.animationLoop=null),n&&(n.animationLoop=this),this.display=n},t._requestAnimationFrame=function(){this._running&&(this._animationFrameId=er(this._animationFrame.bind(this)))},t._cancelAnimationFrame=function(){this._animationFrameId===null&&(rr(this._animationFrameId),this._animationFrameId=null)},t._animationFrame=function(){this._running&&(this.redraw(),this._requestAnimationFrame())},t._renderFrame=function(n){if(this.display){this.display._renderFrame(n);return}this.props.onRender(this._getAnimationProps())},t._clearNeedsRedraw=function(){this.needsRedraw=!1},t._setupFrame=function(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()},t._initializeAnimationProps=function(){var n;if(!this.device)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:(n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0?void 0:n.canvas,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}},t._getAnimationProps=function(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps},t._updateAnimationProps=function(){if(this.animationProps){var n=this._getSizeAndAspect(),i=n.width,o=n.height,s=n.aspect;(i!==this.animationProps.width||o!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),s!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=i,this.animationProps.height=o,this.animationProps.aspect=s,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}},t._initDevice=function(){var r=lt(yt.default.mark(function i(){var o;return yt.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this.props.device;case 2:if(this.device=c.sent,this.device){c.next=5;break}throw new Error("No device provided");case 5:this.canvas=((o=this.device.canvasContext)===null||o===void 0?void 0:o.canvas)||null;case 6:case"end":return c.stop()}},i,this)}));function n(){return r.apply(this,arguments)}return n}(),t._createInfoDiv=function(){if(this.canvas&&this.props.onAddHTML){var n=document.createElement("div");document.body.appendChild(n),n.style.position="relative";var i=document.createElement("div");i.style.position="absolute",i.style.left="10px",i.style.bottom="10px",i.style.width="300px",i.style.background="white",this.canvas instanceof HTMLCanvasElement&&n.appendChild(this.canvas),n.appendChild(i);var o=this.props.onAddHTML(i);o&&(i.innerHTML=o)}},t._getSizeAndAspect=function(){var n,i;if(!this.device)return{width:1,height:1,aspect:1};var o=((n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0?void 0:n.getPixelSize())||[1,1],s=B(o,2),c=s[0],a=s[1],f=1,u=(i=this.device)===null||i===void 0||(i=i.canvasContext)===null||i===void 0?void 0:i.canvas;return u&&u.clientHeight?f=u.clientWidth/u.clientHeight:c>0&&a>0&&(f=c/a),{width:c,height:a,aspect:f}},t._resizeViewport=function(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)},t._resizeCanvasDrawingBuffer=function(){if(this.props.autoResizeDrawingBuffer){var n;(n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0||n.resize({useDevicePixels:this.props.useDevicePixels})}},t._beginFrameTimers=function(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()},t._endFrameTimers=function(){this.cpuTime.timeEnd()},t._startEventHandling=function(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))},t._onMousemove=function(n){n instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[n.offsetX,n.offsetY])},t._onMouseleave=function(n){this._getAnimationProps()._mousePosition=null},A(e)}();var nr=pe(Jt(),1);function yn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xn(e,t){var r=this,n=null,i=t?.device||Dt.createDevice(),o=new be(_n(_n({},t),{},{device:i,onInitialize:function(c){return lt(nr.default.mark(function a(){var f;return nr.default.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=new e(c),l.next=3,(f=n)===null||f===void 0?void 0:f.onInitialize(c);case 3:return l.abrupt("return",l.sent);case 4:case"end":return l.stop()}},a)}))()},onRender:function(c){var a;return(a=n)===null||a===void 0?void 0:a.onRender(c)},onFinalize:function(c){var a;return(a=n)===null||a===void 0?void 0:a.onFinalize(c)}}));return o.getInfo=function(){return r.AnimationLoopTemplateCtor.info},o}function ir(e){if(Array.isArray(e))return Nt(e)}function or(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function sr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
12
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ne(e){return ir(e)||or(e)||$t(e)||sr()}var nt=function(t){return"".concat(t)};function dt(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}function bn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function St(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ar={number:{type:"number",validate:function(t,r){return Number.isFinite(t)&&tt(r)==="object"&&(r.max===void 0||t<=r.max)&&(r.min===void 0||t>=r.min)}},array:{type:"array",validate:function(t,r){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function wn(e){for(var t={},r=0,n=Object.entries(e);r<n.length;r++){var i=B(n[r],2),o=i[0],s=i[1];t[o]=As(s)}return t}function En(e,t,r){for(var n={},i=0,o=Object.entries(t);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1];e&&c in e&&!a.private?(a.validate&&dt(a.validate(e[c],a),"".concat(r,": invalid ").concat(c)),n[c]=e[c]):n[c]=a.value}return n}function As(e){var t=On(e);if(t!=="object")return St(St({value:e},ar[t]),{},{type:t});if(tt(e)==="object")return e?e.type!==void 0?St(St(St({},e),ar[e.type]),{},{type:e.type}):e.value===void 0?{type:"object",value:e}:(t=On(e.value),St(St(St({},e),ar[t]),{},{type:t})):{type:"object",value:null};throw new Error("props")}function On(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":tt(e)}function $(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Mn,Sn,Pn=nt(Mn||(Mn=$([`#ifdef MODULE_LOGDEPTH
13
13
  logdepth_adjustPosition(gl_Position);
14
14
  #endif
15
15
  `],[`\\
@@ -197,7 +197,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
197
197
  `),i.header&&(r+=" ".concat(i.header)),t[n]){var o=t[n];o.sort(function(f,u){return f.order-u.order});var s=ti(o),c;try{for(s.s();!(c=s.n()).done;){var a=c.value;r+=" ".concat(a.injection,`
198
198
  `)}}catch(f){s.e(f)}finally{s.f()}}i.footer&&(r+=" ".concat(i.footer)),r+=`}
199
199
  `}return r}function hr(e){var t={vertex:{},fragment:{}},r=ti(e),n;try{for(r.s();!(n=r.n()).done;){var i=n.value,o=void 0,s=void 0;typeof i!="string"?(o=i,s=o.hook):(o={},s=i),s=s.trim();var c=s.split(":"),a=B(c,2),f=a[0],u=a[1],l=s.replace(/\(.+/,""),h=Object.assign(o,{signature:u});switch(f){case"vs":t.vertex[l]=h;break;case"fs":t.fragment[l]=h;break;default:throw new Error(f)}}}catch(v){r.e(v)}finally{r.f()}return t}var ei;function pr(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Vs(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
200
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function Vs(e,t){if(e){if(typeof e=="string")return ri(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ri(e,t)}}function ri(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ni(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function St(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ni(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ni(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ai=`
200
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function Vs(e,t){if(e){if(typeof e=="string")return ri(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ri(e,t)}}function ri(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ni(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Pt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ni(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ni(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ai=`
201
201
 
202
202
  `.concat(ie,`
203
203
 
@@ -206,7 +206,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
206
206
  `],[`\\
207
207
  precision highp float;
208
208
 
209
- `])));function ci(e,t){var r=t.vs,n=t.fs,i=Nn(t.modules||[]);switch(e.shaderLanguage){case"glsl":return{vs:oi(e,St(St({},t),{},{source:r,stage:"vertex",modules:i})),fs:oi(e,St(St({},t),{},{source:n,stage:"fragment",modules:i})),getUniforms:si(i)};case"wgsl":return{vs:ii(e,St(St({},t),{},{source:r,stage:"vertex",modules:i})),fs:ii(e,St(St({},t),{},{source:n,stage:"fragment",modules:i})),getUniforms:si(i)}}}function ii(e,t){var r=t.source,n=t.stage,i=t.modules,o=t.defines,s=o===void 0?{}:o,c=t.hookFunctions,a=c===void 0?[]:c,f=t.inject,u=f===void 0?{}:f,l=t.log;dt(typeof r=="string","shader source must be a string");var h=r,v={};i.forEach(function(D){Object.assign(v,D.getDefines())}),Object.assign(v,s);var m="",y=hr(a),b={},O={},R={};for(var x in u){var S=typeof u[x]=="string"?{injection:u[x],order:0}:u[x],w=/^(v|f)s:(#)?([\w-]+)$/.exec(x);if(w){var M=w[2],j=w[3];M?j==="decl"?O[x]=[S]:R[x]=[S]:b[x]=[S]}else R[x]=[S]}var N=pr(i),U;try{for(N.s();!(U=N.n()).done;){var C=U.value;l&&C.checkDeprecations(h,l);var g=C.getModuleSource(n,"wgsl");m+=g;var p=C.injections[n];for(var d in p){var _=/^(v|f)s:#([\w-]+)$/.exec(d);if(_){var E=_[2],P=E==="decl"?O:R;P[d]=P[d]||[],P[d].push(p[d])}else b[d]=b[d]||[],b[d].push(p[d])}}}catch(D){N.e(D)}finally{N.f()}return m+=ai,m=oe(m,n,O),m+=lr(y[n],b),m+=h,m=oe(m,n,R),m}function oi(e,t){var r=t.source.includes("->"),n=t.id,i=t.source,o=t.stage,s=t.language,c=s===void 0?r?"wgsl":"glsl":s,a=t.modules,f=t.defines,u=f===void 0?{}:f,l=t.hookFunctions,h=l===void 0?[]:l,v=t.inject,m=v===void 0?{}:v,y=t.transpileToGLSL100,b=y===void 0?!1:y,O=t.prologue,R=O===void 0?!r:O,x=t.log;dt(typeof i=="string","shader source must be a string");var S=i.split(`
209
+ `])));function ci(e,t){var r=t.vs,n=t.fs,i=Nn(t.modules||[]);switch(e.shaderLanguage){case"glsl":return{vs:oi(e,Pt(Pt({},t),{},{source:r,stage:"vertex",modules:i})),fs:oi(e,Pt(Pt({},t),{},{source:n,stage:"fragment",modules:i})),getUniforms:si(i)};case"wgsl":return{vs:ii(e,Pt(Pt({},t),{},{source:r,stage:"vertex",modules:i})),fs:ii(e,Pt(Pt({},t),{},{source:n,stage:"fragment",modules:i})),getUniforms:si(i)}}}function ii(e,t){var r=t.source,n=t.stage,i=t.modules,o=t.defines,s=o===void 0?{}:o,c=t.hookFunctions,a=c===void 0?[]:c,f=t.inject,u=f===void 0?{}:f,l=t.log;dt(typeof r=="string","shader source must be a string");var h=r,v={};i.forEach(function(D){Object.assign(v,D.getDefines())}),Object.assign(v,s);var m="",y=hr(a),b={},O={},R={};for(var x in u){var S=typeof u[x]=="string"?{injection:u[x],order:0}:u[x],w=/^(v|f)s:(#)?([\w-]+)$/.exec(x);if(w){var M=w[2],j=w[3];M?j==="decl"?O[x]=[S]:R[x]=[S]:b[x]=[S]}else R[x]=[S]}var N=pr(i),U;try{for(N.s();!(U=N.n()).done;){var C=U.value;l&&C.checkDeprecations(h,l);var g=C.getModuleSource(n,"wgsl");m+=g;var p=C.injections[n];for(var d in p){var _=/^(v|f)s:#([\w-]+)$/.exec(d);if(_){var E=_[2],P=E==="decl"?O:R;P[d]=P[d]||[],P[d].push(p[d])}else b[d]=b[d]||[],b[d].push(p[d])}}}catch(D){N.e(D)}finally{N.f()}return m+=ai,m=oe(m,n,O),m+=lr(y[n],b),m+=h,m=oe(m,n,R),m}function oi(e,t){var r=t.source.includes("->"),n=t.id,i=t.source,o=t.stage,s=t.language,c=s===void 0?r?"wgsl":"glsl":s,a=t.modules,f=t.defines,u=f===void 0?{}:f,l=t.hookFunctions,h=l===void 0?[]:l,v=t.inject,m=v===void 0?{}:v,y=t.transpileToGLSL100,b=y===void 0?!1:y,O=t.prologue,R=O===void 0?!r:O,x=t.log;dt(typeof i=="string","shader source must be a string");var S=i.split(`
210
210
  `),w=100,M="",j=i;S[0].indexOf("#version ")===0?(w=300,M=S[0],j=S.slice(1).join(`
211
211
  `)):M="#version ".concat(w);var N=b?100:w,U={};a.forEach(function(Xt){Object.assign(U,Xt.getDefines())}),Object.assign(U,u);var C="";switch(c){case"wgsl":break;case"glsl":C=R?"".concat(M,`
212
212
  `).concat(qs({id:n,source:i,stage:o}),`
@@ -224,7 +224,7 @@ precision highp float;
224
224
  `),t++;var i=e[n];(i||Number.isFinite(i))&&(r+="#define ".concat(n.toUpperCase()," ").concat(e[n],`
225
225
  `))}return t===0&&(r+=`
226
226
  `),r}function fi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ui(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fi(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hi(e,t){if(!t.vs)throw new Error("no vertex shader");var r=li(e,t.vs),n;return t.fs&&(n=li(e,t.fs)),ui(ui({},t),{},{vs:r,fs:n})}function li(e,t){if(typeof t=="string")return t;switch(e.type){case"webgpu":if(t!=null&&t.wgsl)return t.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(t!=null&&t.glsl)return t.glsl;throw new Error("WebGL does not support WGSL shaders")}}function pi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function di(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pi(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var we=function(){function e(){T(this,e),this._hookFunctions=[],this._defaultModules=[]}e.getDefaultShaderAssembler=function(){return e.defaultShaderAssembler=e.defaultShaderAssembler||new e,e.defaultShaderAssembler};var t=e.prototype;return t.addDefaultModule=function(n){this._defaultModules.find(function(i){return i.name===(typeof n=="string"?n:n.name)})||this._defaultModules.push(n)},t.removeDefaultModule=function(n){var i=typeof n=="string"?n:n.name;this._defaultModules=this._defaultModules.filter(function(o){return o.name!==i})},t.addShaderHook=function(n,i){i&&(n=Object.assign(i,{hook:n})),this._hookFunctions.push(n)},t.assembleShaders=function(n,i){var o=this._getModuleList(i.modules),s=this._hookFunctions,c=hi(n,i),a=ci(n,di(di({},c),{},{modules:o,hookFunctions:s}));return a},t._getModuleList=function(){for(var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],i=new Array(this._defaultModules.length+n.length),o={},s=0,c=0,a=this._defaultModules.length;c<a;++c){var f=this._defaultModules[c],u=f.name;i[s++]=f,o[u]=!0}for(var l=0,h=n.length;l<h;++l){var v=n[l],m=v.name;o[m]||(i[s++]=v,o[m]=!0)}return i.length=s,i},A(e)}();we.defaultShaderAssembler=void 0;var jh=1/Math.PI*180,Fh=1/180*Math.PI,Ks={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Ks}};var et=globalThis.mathgl.config;function mi(e,{precision:t=et.precision}={}){return e=Ys(e),"".concat(parseFloat(e.toPrecision(t)))}function Vt(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function dr(e,t,r){let n=et.EPSILON;r&&(et.EPSILON=r);try{if(e===t)return!0;if(Vt(e)&&Vt(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!dr(e[i],t[i]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=et.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{et.EPSILON=n}}function Ys(e){return Math.round(e/et.EPSILON)*et.EPSILON}function Xs(e){function t(){var r=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var Ht=class extends Xs(Array){clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Vt(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(et)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+mi(this[n],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(r,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!dr(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let i=0;i<this.ELEMENTS;++i){let o=t[i],s=typeof r=="number"?r:r[i];this[i]=o+n*(s-o)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(et.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=t;return this.check()}addScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t),r);return this.check()}get elements(){return this}};function $s(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function it(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function Ee(e,t,r=""){if(et.debug&&!$s(e,t))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return e}function mr(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var Me=class extends Ht{get x(){return this[0]}set x(t){this[0]=it(t)}get y(){return this[1]}set y(t){this[1]=it(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let i=this[n]-t[n];r+=i*i}return it(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return it(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return mr(t>=0&&t<this.ELEMENTS,"index is out of range"),it(this[t])}setComponent(t,r){return mr(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){return this.add(new this.constructor(t).multiplyScalar(r))}};var _t=typeof Float32Array<"u"?Float32Array:Array;var Yh=Math.PI/180;function Zs(){let e=new _t(2);return _t!=Float32Array&&(e[0]=0,e[1]=0),e}function yi(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}var Xh=function(){let e=Zs();return function(t,r,n,i,o,s){let c,a;for(r||(r=2),n||(n=0),i?a=Math.min(i*r+n,t.length):a=t.length,c=n;c<a;c+=r)e[0]=t[c],e[1]=t[c+1],o(e,e,s),t[c]=e[0],t[c+1]=e[1];return t}}();function _i(e,t,r){let n=t[0],i=t[1],o=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/o,e[1]=(r[1]*n+r[5]*i)/o,e}function Se(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o||1;return e[0]=(r[0]*n+r[4]*i+r[8]*o)/s,e[1]=(r[1]*n+r[5]*i+r[9]*o)/s,e[2]=(r[2]*n+r[6]*i+r[10]*o)/s,e}function xi(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function Js(){let e=new _t(3);return _t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Qs(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function bi(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[0],c=r[1],a=r[2];return e[0]=i*a-o*c,e[1]=o*s-n*a,e[2]=n*c-i*s,e}function Pe(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,e}function Oi(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=n*r[0]+i*r[3]+o*r[6],e[1]=n*r[1]+i*r[4]+o*r[7],e[2]=n*r[2]+i*r[5]+o*r[8],e}function wi(e,t,r){let n=r[0],i=r[1],o=r[2],s=r[3],c=t[0],a=t[1],f=t[2],u=i*f-o*a,l=o*c-n*f,h=n*a-i*c,v=i*h-o*l,m=o*u-n*h,y=n*l-i*u,b=s*2;return u*=b,l*=b,h*=b,v*=2,m*=2,y*=2,e[0]=c+u+v,e[1]=a+l+m,e[2]=f+h+y,e}function Ei(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function Mi(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function Si(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function Pi(e,t){let r=e[0],n=e[1],i=e[2],o=t[0],s=t[1],c=t[2],a=Math.sqrt((r*r+n*n+i*i)*(o*o+s*s+c*c)),f=a&&Qs(e,t)/a;return Math.acos(Math.min(Math.max(f,-1),1))}var Jh=function(){let e=Js();return function(t,r,n,i,o,s){let c,a;for(r||(r=3),n||(n=0),i?a=Math.min(i*r+n,t.length):a=t.length,c=n;c<a;c+=r)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],o(e,e,s),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var vr=[0,0,0],Ae,ot=class extends Me{static get ZERO(){return Ae||(Ae=new ot(0,0,0),Object.freeze(Ae)),Ae}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Vt(t)?this.copy(t):(et.debug&&(it(t),it(r),it(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return et.debug&&(it(t.x),it(t.y),it(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=it(t)}angle(t){return Pi(this,t)}cross(t){return bi(this,this,t),this.check()}rotateX({radians:t,origin:r=vr}){return Ei(this,this,r,t),this.check()}rotateY({radians:t,origin:r=vr}){return Mi(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=vr}){return Si(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Pe(this,this,t),this.check()}transformAsVector(t){return Se(this,this,t),this.check()}transformByMatrix3(t){return Oi(this,this,t),this.check()}transformByMatrix2(t){return xi(this,this,t),this.check()}transformByQuaternion(t){return wi(this,this,t),this.check()}};var Te=class extends Ht{toString(){let t="[";if(et.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=" ".concat(this[n*this.RANK+r])}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=" ".concat(this[r])}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=it(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}};function ta(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ai(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],o=t[6],s=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=i,e[13]=s,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Ti(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],c=t[5],a=t[6],f=t[7],u=t[8],l=t[9],h=t[10],v=t[11],m=t[12],y=t[13],b=t[14],O=t[15],R=r*c-n*s,x=r*a-i*s,S=r*f-o*s,w=n*a-i*c,M=n*f-o*c,j=i*f-o*a,N=u*y-l*m,U=u*b-h*m,C=u*O-v*m,g=l*b-h*y,p=l*O-v*y,d=h*O-v*b,_=R*d-x*p+S*g+w*C-M*U+j*N;return _?(_=1/_,e[0]=(c*d-a*p+f*g)*_,e[1]=(i*p-n*d-o*g)*_,e[2]=(y*j-b*M+O*w)*_,e[3]=(h*M-l*j-v*w)*_,e[4]=(a*C-s*d-f*U)*_,e[5]=(r*d-i*C+o*U)*_,e[6]=(b*S-m*j-O*x)*_,e[7]=(u*j-h*S+v*x)*_,e[8]=(s*p-c*C+f*N)*_,e[9]=(n*C-r*p-o*N)*_,e[10]=(m*M-y*S+O*R)*_,e[11]=(l*S-u*M-v*R)*_,e[12]=(c*U-s*g-a*N)*_,e[13]=(r*g-n*U+i*N)*_,e[14]=(y*x-m*w-b*R)*_,e[15]=(u*w-l*x+h*R)*_,e):null}function Ri(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],c=e[6],a=e[7],f=e[8],u=e[9],l=e[10],h=e[11],v=e[12],m=e[13],y=e[14],b=e[15],O=t*s-r*o,R=t*c-n*o,x=r*c-n*s,S=f*m-u*v,w=f*y-l*v,M=u*y-l*m,j=t*M-r*w+n*S,N=o*M-s*w+c*S,U=f*x-u*R+l*O,C=v*x-m*R+y*O;return a*j-i*N+b*U-h*C}function yr(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],c=t[4],a=t[5],f=t[6],u=t[7],l=t[8],h=t[9],v=t[10],m=t[11],y=t[12],b=t[13],O=t[14],R=t[15],x=r[0],S=r[1],w=r[2],M=r[3];return e[0]=x*n+S*c+w*l+M*y,e[1]=x*i+S*a+w*h+M*b,e[2]=x*o+S*f+w*v+M*O,e[3]=x*s+S*u+w*m+M*R,x=r[4],S=r[5],w=r[6],M=r[7],e[4]=x*n+S*c+w*l+M*y,e[5]=x*i+S*a+w*h+M*b,e[6]=x*o+S*f+w*v+M*O,e[7]=x*s+S*u+w*m+M*R,x=r[8],S=r[9],w=r[10],M=r[11],e[8]=x*n+S*c+w*l+M*y,e[9]=x*i+S*a+w*h+M*b,e[10]=x*o+S*f+w*v+M*O,e[11]=x*s+S*u+w*m+M*R,x=r[12],S=r[13],w=r[14],M=r[15],e[12]=x*n+S*c+w*l+M*y,e[13]=x*i+S*a+w*h+M*b,e[14]=x*o+S*f+w*v+M*O,e[15]=x*s+S*u+w*m+M*R,e}function Ci(e,t,r){let n=r[0],i=r[1],o=r[2],s,c,a,f,u,l,h,v,m,y,b,O;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(s=t[0],c=t[1],a=t[2],f=t[3],u=t[4],l=t[5],h=t[6],v=t[7],m=t[8],y=t[9],b=t[10],O=t[11],e[0]=s,e[1]=c,e[2]=a,e[3]=f,e[4]=u,e[5]=l,e[6]=h,e[7]=v,e[8]=m,e[9]=y,e[10]=b,e[11]=O,e[12]=s*n+u*i+m*o+t[12],e[13]=c*n+l*i+y*o+t[13],e[14]=a*n+h*i+b*o+t[14],e[15]=f*n+v*i+O*o+t[15]),e}function Li(e,t,r){let n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Di(e,t,r,n){let i=n[0],o=n[1],s=n[2],c=Math.sqrt(i*i+o*o+s*s),a,f,u,l,h,v,m,y,b,O,R,x,S,w,M,j,N,U,C,g,p,d,_,E;return c<1e-6?null:(c=1/c,i*=c,o*=c,s*=c,f=Math.sin(r),a=Math.cos(r),u=1-a,l=t[0],h=t[1],v=t[2],m=t[3],y=t[4],b=t[5],O=t[6],R=t[7],x=t[8],S=t[9],w=t[10],M=t[11],j=i*i*u+a,N=o*i*u+s*f,U=s*i*u-o*f,C=i*o*u-s*f,g=o*o*u+a,p=s*o*u+i*f,d=i*s*u+o*f,_=o*s*u-i*f,E=s*s*u+a,e[0]=l*j+y*N+x*U,e[1]=h*j+b*N+S*U,e[2]=v*j+O*N+w*U,e[3]=m*j+R*N+M*U,e[4]=l*C+y*g+x*p,e[5]=h*C+b*g+S*p,e[6]=v*C+O*g+w*p,e[7]=m*C+R*g+M*p,e[8]=l*d+y*_+x*E,e[9]=h*d+b*_+S*E,e[10]=v*d+O*_+w*E,e[11]=m*d+R*_+M*E,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Ii(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[4],s=t[5],c=t[6],a=t[7],f=t[8],u=t[9],l=t[10],h=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+f*n,e[5]=s*i+u*n,e[6]=c*i+l*n,e[7]=a*i+h*n,e[8]=f*i-o*n,e[9]=u*i-s*n,e[10]=l*i-c*n,e[11]=h*i-a*n,e}function Ni(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],c=t[2],a=t[3],f=t[8],u=t[9],l=t[10],h=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-f*n,e[1]=s*i-u*n,e[2]=c*i-l*n,e[3]=a*i-h*n,e[8]=o*n+f*i,e[9]=s*n+u*i,e[10]=c*n+l*i,e[11]=a*n+h*i,e}function ji(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],c=t[2],a=t[3],f=t[4],u=t[5],l=t[6],h=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i+f*n,e[1]=s*i+u*n,e[2]=c*i+l*n,e[3]=a*i+h*n,e[4]=f*i-o*n,e[5]=u*i-s*n,e[6]=l*i-c*n,e[7]=h*i-a*n,e}function Fi(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,c=n+n,a=i+i,f=r*s,u=n*s,l=n*c,h=i*s,v=i*c,m=i*a,y=o*s,b=o*c,O=o*a;return e[0]=1-l-m,e[1]=u+O,e[2]=h-b,e[3]=0,e[4]=u-O,e[5]=1-f-m,e[6]=v+y,e[7]=0,e[8]=h+b,e[9]=v-y,e[10]=1-f-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ui(e,t,r,n,i,o,s){let c=1/(r-t),a=1/(i-n),f=1/(o-s);return e[0]=o*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*a,e[6]=0,e[7]=0,e[8]=(r+t)*c,e[9]=(i+n)*a,e[10]=(s+o)*f,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*f,e[15]=0,e}function ea(e,t,r,n,i){let o=1/Math.tan(t/2);if(e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let s=1/(n-i);e[10]=(i+n)*s,e[14]=2*i*n*s}else e[10]=-1,e[14]=-2*n;return e}var Gi=ea;function ra(e,t,r,n,i,o,s){let c=1/(t-r),a=1/(n-i),f=1/(o-s);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*f,e[11]=0,e[12]=(t+r)*c,e[13]=(i+n)*a,e[14]=(s+o)*f,e[15]=1,e}var zi=ra;function Bi(e,t,r,n){let i,o,s,c,a,f,u,l,h,v,m=t[0],y=t[1],b=t[2],O=n[0],R=n[1],x=n[2],S=r[0],w=r[1],M=r[2];return Math.abs(m-S)<1e-6&&Math.abs(y-w)<1e-6&&Math.abs(b-M)<1e-6?ta(e):(l=m-S,h=y-w,v=b-M,i=1/Math.sqrt(l*l+h*h+v*v),l*=i,h*=i,v*=i,o=R*v-x*h,s=x*l-O*v,c=O*h-R*l,i=Math.sqrt(o*o+s*s+c*c),i?(i=1/i,o*=i,s*=i,c*=i):(o=0,s=0,c=0),a=h*c-v*s,f=v*o-l*c,u=l*s-h*o,i=Math.sqrt(a*a+f*f+u*u),i?(i=1/i,a*=i,f*=i,u*=i):(a=0,f=0,u=0),e[0]=o,e[1]=a,e[2]=l,e[3]=0,e[4]=s,e[5]=f,e[6]=h,e[7]=0,e[8]=c,e[9]=u,e[10]=v,e[11]=0,e[12]=-(o*m+s*y+c*b),e[13]=-(a*m+f*y+u*b),e[14]=-(l*m+h*y+v*b),e[15]=1,e)}function na(){let e=new _t(4);return _t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function ki(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,e}var lp=function(){let e=na();return function(t,r,n,i,o,s){let c,a;for(r||(r=4),n||(n=0),i?a=Math.min(i*r+n,t.length):a=t.length,c=n;c<a;c+=r)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],o(e,e,s),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var br;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(br||(br={}));var ia=45*Math.PI/180,oa=1,_r=.1,xr=500,sa=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),mt=class extends Te{static get IDENTITY(){return ca()}static get ZERO(){return aa()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return br}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,i,o,s,c,a,f,u,l,h,v,m,y,b){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=c,this[7]=a,this[8]=f,this[9]=u,this[10]=l,this[11]=h,this[12]=v,this[13]=m,this[14]=y,this[15]=b,this.check()}setRowMajor(t,r,n,i,o,s,c,a,f,u,l,h,v,m,y,b){return this[0]=t,this[1]=o,this[2]=f,this[3]=v,this[4]=r,this[5]=s,this[6]=u,this[7]=m,this[8]=n,this[9]=c,this[10]=l,this[11]=y,this[12]=i,this[13]=a,this[14]=h,this[15]=b,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(sa)}fromObject(t){return this.check()}fromQuaternion(t){return Fi(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:i,top:o,near:s=_r,far:c=xr}=t;return c===1/0?fa(this,r,n,i,o,s):Ui(this,r,n,i,o,s,c),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return Bi(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:o,near:s=_r,far:c=xr}=t;return zi(this,r,n,i,o,s,c),this.check()}orthographic(t){let{fovy:r=ia,aspect:n=oa,focalDistance:i=1,near:o=_r,far:s=xr}=t;Vi(r);let c=r/2,a=i*Math.tan(c),f=a*n;return this.ortho({left:-f,right:f,bottom:-a,top:a,near:o,far:s})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:o=500}=t;return Vi(r),Gi(this,r,n,i,o),this.check()}determinant(){return Ri(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],s=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*o,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*o,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*o,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],s=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*o,t[2]=this[2]*s,t[3]=this[4]*i,t[4]=this[5]*o,t[5]=this[6]*s,t[6]=this[8]*i,t[7]=this[9]*o,t[8]=this[10]*s,t}transpose(){return Ai(this,this),this.check()}invert(){return Ti(this,this),this.check()}multiplyLeft(t){return yr(this,t,this),this.check()}multiplyRight(t){return yr(this,this,t),this.check()}rotateX(t){return Ii(this,this,t),this.check()}rotateY(t){return Ni(this,this,t),this.check()}rotateZ(t){return ji(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return Di(this,this,t,r),this.check()}scale(t){return Li(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Ci(this,this,t),this.check()}transform(t,r){return t.length===4?(r=ki(r||[-0,-0,-0,-0],t,this),Ee(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=yi(r||[-0,-0],t,this);break;case 3:i=Pe(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=_i(r||[-0,-0],t,this);break;case 3:n=Se(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(n,t.length),n}transformPoint(t,r){return this.transformAsPoint(t,r)}transformVector(t,r){return this.transformAsPoint(t,r)}transformDirection(t,r){return this.transformAsVector(t,r)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}},Re,Ce;function aa(){return Re||(Re=new mt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Re)),Re}function ca(){return Ce||(Ce=new mt,Object.freeze(Ce)),Ce}function Vi(e){if(e>Math.PI*2)throw Error("expected radians")}function fa(e,t,r,n,i,o){let s=2*o/(r-t),c=2*o/(i-n),a=(r+t)/(r-t),f=(i+n)/(i-n),u=-1,l=-1,h=-2*o;return e[0]=s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=f,e[10]=u,e[11]=l,e[12]=0,e[13]=0,e[14]=h,e[15]=0,e}var Hi=function(){function e(r){T(this,e),this.id=void 0,this.userData={},this.topology=void 0,this.bufferLayout=[],this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.id=r.id||H("geometry"),this.topology=r.topology,this.indices=r.indices||null,this.attributes=r.attributes,this.vertexCount=r.vertexCount,this.bufferLayout=r.bufferLayout||[],this.indices&&rt(this.indices.usage===X.INDEX)}var t=e.prototype;return t.destroy=function(){var n;this.indices.destroy(),this.attributes.positions.destroy(),this.attributes.normals.destroy(),this.attributes.texCoords.destroy(),(n=this.attributes.colors)===null||n===void 0||n.destroy()},t.getVertexCount=function(){return this.vertexCount},t.getAttributes=function(){return this.attributes},t.getIndexes=function(){return this.indices},t._calculateVertexCount=function(n){var i=n.byteLength/12;return i},A(e)}();function qi(e,t){if(t instanceof Hi)return t;var r=ua(e,t),n=la(e,t),i=n.attributes,o=n.bufferLayout;return new Hi({topology:t.topology||"triangle-list",bufferLayout:o,vertexCount:t.vertexCount,indices:r,attributes:i})}function ua(e,t){if(t.indices){var r=t.indices.value;return e.createBuffer({usage:X.INDEX,data:r})}}function la(e,t){for(var r=[],n={},i=0,o=Object.entries(t.attributes);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1],f=c;switch(c){case"POSITION":f="positions";break;case"NORMAL":f="normals";break;case"TEXCOORD_0":f="texCoords";break}n[f]=e.createBuffer({data:a.value,id:"".concat(c,"-buffer")}),r.push({name:f,format:"float32x".concat(a.size)})}var u=t._calculateVertexCount(t.attributes,t.indices);return{attributes:n,bufferLayout:r,vertexCount:u}}function Wi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wi(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var se=function(){e.getDefaultPipelineFactory=function(n){return n._lumaData.defaultPipelineFactory=n._lumaData.defaultPipelineFactory||new e(n),n._lumaData.defaultPipelineFactory};function e(r){T(this,e),this.device=void 0,this._hashCounter=0,this._hashes={},this._useCounts={},this._pipelineCache={},this.device=r}var t=e.prototype;return t.createRenderPipeline=function(n){var i=xt(xt({},e.defaultProps),n),o=this._hashRenderPipeline(xt({},i));if(!this._pipelineCache[o]){var s=this.device.createRenderPipeline(xt(xt({},i),{},{vs:this.device.createShader({stage:"vertex",source:i.vs}),fs:i.fs?this.device.createShader({stage:"fragment",source:i.fs}):null}));s.hash=o,this._pipelineCache[o]=s,this._useCounts[o]=0}return this._useCounts[o]++,this._pipelineCache[o]},t.release=function(n){var i=n.hash;this._useCounts[i]--,this._useCounts[i]===0&&(this._pipelineCache[i].destroy(),delete this._pipelineCache[i],delete this._useCounts[i])},t._createRenderPipeline=function(n){if(!n.fs)throw new Error("fs");var i=this.device.createRenderPipeline(xt(xt({},n),{},{vs:this.device.createShader({stage:"vertex",source:n.vs}),fs:n.fs?this.device.createShader({stage:"fragment",source:n.fs}):null}));return i},t._hashRenderPipeline=function(n){var i=this._getHash(n.vs),o=n.fs?this._getHash(n.fs):0,s="-";switch(this.device.info.type){case"webgpu":var c=this._getHash(JSON.stringify(n.parameters)),a=this._getHash(JSON.stringify(n.bufferLayout));return"".concat(i,"/").concat(o,"V").concat(s,"T").concat(n.topology,"P").concat(c,"BL").concat(a,"}");default:return"".concat(i,"/").concat(o,"V").concat(s)}},t._getHash=function(n){return this._hashes[n]===void 0&&(this._hashes[n]=this._hashCounter++),this._hashes[n]},A(e)}();se.defaultProps=xt(xt({},Bt.defaultProps),{},{vs:void 0,fs:void 0});function Or(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ha(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
227
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function ha(e,t){if(e){if(typeof e=="string")return Ki(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ki(e,t)}}function Ki(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Yi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Wt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Yi(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ae=function(){function e(r,n){T(this,e),this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.pipeline=void 0,this.vertexArray=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this.props=Wt(Wt({},e.defaultProps),n),n=this.props,this.id=n.id||H("model"),this.device=r,Object.assign(this.userData,n.userData);var i={type:r.info.type,shaderLanguage:r.info.shadingLanguages[0],gpu:r.info.gpu,features:r.features},o=this.props.shaderAssembler.assembleShaders(i,this.props),s=o.vs,c=o.fs,a=o.getUniforms;if(this.vs=s,this.fs=c,this._getModuleUniforms=a,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,n.geometry&&(this._gpuGeometry=this.setGeometry(n.geometry)),this.pipelineFactory=n.pipelineFactory||se.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=r.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),n.vertexCount&&this.setVertexCount(n.vertexCount),n.instanceCount&&this.setInstanceCount(n.instanceCount),n.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");n.indexBuffer&&this.setIndexBuffer(n.indexBuffer),n.attributes&&this.setAttributes(n.attributes),n.constantAttributes&&this.setConstantAttributes(n.constantAttributes),n.bindings&&this.setBindings(n.bindings),n.uniforms&&this.setUniforms(n.uniforms),n.moduleSettings&&this.updateModuleSettings(n.moduleSettings),this.setUniforms(this._getModuleUniforms()),Object.seal(this)}var t=e.prototype;return t.destroy=function(){this.pipelineFactory.release(this.pipeline)},t.draw=function(n){this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:n,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount})},t.setGeometry=function(n){var i=n&&qi(this.device,n);return this.setTopology(i.topology||"triangle-list"),this.bufferLayout=Xi(this.bufferLayout,i.bufferLayout),this.vertexArray&&this._setGeometryAttributes(i),i},t._setGeometryAttributes=function(n){this.vertexCount=n.vertexCount,this.setAttributes(n.attributes),this.setIndexBuffer(n.indices)},t.setTopology=function(n){n!==this.topology&&(this.topology=n,this._setPipelineNeedsUpdate("topology"))},t.setBufferLayout=function(n){this.bufferLayout=this._gpuGeometry?Xi(n,this._gpuGeometry.bufferLayout):n,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)},t.setParameters=function(n){re(n,this.parameters,2)||(this.parameters=n,this._setPipelineNeedsUpdate("parameters"))},t.setVertexCount=function(n){this.vertexCount=n},t.setInstanceCount=function(n){this.instanceCount=n},t.setShaderModuleProps=function(n){var i=this._getModuleUniforms(n),o=Object.keys(i).filter(function(u){var l=i[u];return!Array.isArray(l)&&typeof l!="number"&&typeof l!="boolean"}),s={},c=Or(o),a;try{for(c.s();!(a=c.n()).done;){var f=a.value;s[f]=i[f],delete i[f]}}catch(u){c.e(u)}finally{c.f()}Object.assign(this.uniforms,i),Object.assign(this.bindings,s)},t.updateModuleSettings=function(n){this.setShaderModuleProps(n)},t.setBindings=function(n){Object.assign(this.bindings,n)},t.setUniforms=function(n){this.pipeline.setUniforms(n),Object.assign(this.uniforms,n)},t.setIndexBuffer=function(n){this.vertexArray.setIndexBuffer(n)},t.setAttributes=function(n){var i=this;n.indices&&K.warn("Model:".concat(this.id," setAttributes() - indexBuffer should be set using setIndexBuffer()"));for(var o=function(){var u,l=B(c[s],2),h=l[0],v=l[1],m=i.bufferLayout.find(function(w){return w.name===h});if(!m)return"continue";var y=m.attributes?(u=m.attributes)===null||u===void 0?void 0:u.map(function(w){return w.attribute}):[m.name],b=!1,O=Or(y),R;try{for(O.s();!(R=O.n()).done;){var x=R.value,S=i._attributeInfos[x];S&&(i.vertexArray.setBuffer(S.location,v),b=!0)}}catch(w){O.e(w)}finally{O.f()}b||K.warn("Model(".concat(i.id,'): Ignoring buffer "').concat(v.id,'" for unknown attribute "').concat(h,'"'))()},s=0,c=Object.entries(n);s<c.length;s++)var a=o()},t.setConstantAttributes=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1],f=this._attributeInfos[c];f?this.vertexArray.setConstant(f.location,a):K.warn('Model "'.concat(this.id,': Ignoring constant supplied for unknown attribute "').concat(c,'"'))()}},t._setPipelineNeedsUpdate=function(n){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||n},t._updatePipeline=function(){return this._pipelineNeedsUpdate&&(this.pipeline&&K.log(1,"Model ".concat(this.id,': Recreating pipeline because "').concat(this._pipelineNeedsUpdate,'".'))(),this._pipelineNeedsUpdate=!1,this.pipeline=this.device.createRenderPipeline(Wt(Wt({},this.props),{},{bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:this.device.createShader({id:"{$this.id}-vertex",stage:"vertex",source:this.vs}),fs:this.fs?this.device.createShader({id:"{$this.id}-fragment",stage:"fragment",source:this.fs}):null})),this._attributeInfos=Qe(this.pipeline.shaderLayout,this.bufferLayout)),this.pipeline},A(e)}();ae.defaultProps=Wt(Wt({},Bt.defaultProps),{},{vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:{},geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},pipelineFactory:void 0,shaderAssembler:we.getDefaultShaderAssembler()});function Xi(e,t){var r=ne(e),n=Or(t),i;try{var o=function(){var c=i.value,a=r.findIndex(function(f){return f.name===c.name});a<0?r.push(c):r[a]=c};for(n.s();!(i=n.n()).done;)o()}catch(s){n.e(s)}finally{n.f()}return r}function $i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Zi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$i(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$i(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ji=function(){e.isSupported=function(n){return!1};function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};T(this,e),this.device=void 0,this.gl=void 0,this.elementCount=0,this.elementIDBuffer=null}var t=e.prototype;return t.destroy=function(){},t.delete=function(){this.destroy()},t.run=function(n){var i=n||{},o=i.clearRenderTarget,s=o===void 0?!0:o,c=this._updateDrawOptions(n);s&&c.framebuffer},t.swap=function(){},t.getBuffer=function(n){return null},t.getData=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}},t.getFramebuffer=function(){return null},t.update=function(n){},t._updateModelProps=function(n){var i=Zi({},n);return i},t._buildResourceTransforms=function(n){},t._updateDrawOptions=function(n){var i=Zi({},n);return i},A(e)}();var Qi=function(){function e(r){T(this,e),this.device=void 0,this.shaderModule=void 0,this.useUniformBuffers=void 0,this.uniformBufferLayout=void 0,this.uniformBuffer=null,this.uniforms={},this.modifiedUniforms={},this.modified=!0,this.needsRedraw="initialized",this.device=r.device,this.shaderModule=r.shaderModule,this.useUniformBuffers=this.device.info.type!=="webgl";for(var n={},i=0,o=Object.entries(r.shaderModule.uniforms);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1].format;n[c]=a}this.uniformBufferLayout=new tr(n),this.useUniformBuffers&&(this.uniformBuffer=this.device.createBuffer({usage:X.UNIFORM,byteLength:this.uniformBufferLayout.byteLength}))}var t=e.prototype;return t.setUniforms=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1];this._setUniform(c,a),this.setNeedsRedraw(c)}},t.setNeedsRedraw=function(n){this.needsRedraw=this.needsRedraw||n},t.getUniformBuffer=function(){if(this.needsRedraw){var n=this.getModifiedUniforms(),i=this.uniformBufferLayout.getData(n);this.uniformBuffer.write(i)}return this.uniformBuffer},t.getUniforms=function(n){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms[n]||{}},t.getModifiedUniforms=function(){var n=this.modifiedUniforms;return this.modifiedUniforms={},this.needsRedraw=!1,n},t._setUniform=function(n,i){pa(this.uniforms[n],i)||(this.uniforms[n]=i,this.modifiedUniforms[n]=!0,this.modified=!0)},A(e)}();function pa(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:16;if(e!==t)return!1;var n=Gt(e);if(!n)return!1;var i=Gt(t);if(i&&n.length===i.length){for(var o=0;o<n.length;++o)if(i[o]!==n[o])return!1}return!0}function to(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function da(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?to(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):to(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var st=function(){function e(r){T(this,e),this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};var n=r.attributes,i=n===void 0?{}:n,o=r.indices,s=o===void 0?null:o,c=r.vertexCount,a=c===void 0?null:c;this.id=r.id||H("geometry"),this.topology=r.topology,s&&(this.indices=ArrayBuffer.isView(s)?{value:s,size:1}:s),this.attributes={};for(var f=0,u=Object.entries(i);f<u.length;f++){var l=B(u[f],2),h=l[0],v=l[1],m=ArrayBuffer.isView(v)?{value:v}:v;rt(ArrayBuffer.isView(m.value),"".concat(this._print(h),": must be typed array or object with value as typed array")),(h==="POSITION"||h==="positions")&&!m.size&&(m.size=3),h==="indices"?(rt(!this.indices),this.indices=m):this.attributes[h]=m}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=a||this._calculateVertexCount(this.attributes,this.indices)}var t=e.prototype;return t.getVertexCount=function(){return this.vertexCount},t.getAttributes=function(){return this.indices?da({indices:this.indices},this.attributes):this.attributes},t._print=function(n){return"Geometry ".concat(this.id," attribute ").concat(n)},t._setAttributes=function(n,i){return this},t._calculateVertexCount=function(n,i){if(i)return i.value.length;for(var o=1/0,s=0,c=Object.values(n);s<c.length;s++){var a=c[s],f=a.value,u=a.size,l=a.constant;!l&&f&&u>=1&&(o=Math.min(o,f.length/u))}return rt(Number.isFinite(o)),o},A(e)}();var eo;function ro(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function no(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ro(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ro(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ma(e){var t=ga();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function ga(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var va=mn(eo||(eo=$([`attribute vec2 aClipSpacePosition;
227
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function ha(e,t){if(e){if(typeof e=="string")return Ki(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ki(e,t)}}function Ki(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Yi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Wt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Yi(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ae=function(){function e(r,n){T(this,e),this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.pipeline=void 0,this.vertexArray=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this.props=Wt(Wt({},e.defaultProps),n),n=this.props,this.id=n.id||H("model"),this.device=r,Object.assign(this.userData,n.userData);var i={type:r.info.type,shaderLanguage:r.info.shadingLanguages[0],gpu:r.info.gpu,features:r.features},o=this.props.shaderAssembler.assembleShaders(i,this.props),s=o.vs,c=o.fs,a=o.getUniforms;if(this.vs=s,this.fs=c,this._getModuleUniforms=a,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,n.geometry&&(this._gpuGeometry=this.setGeometry(n.geometry)),this.pipelineFactory=n.pipelineFactory||se.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=r.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),n.vertexCount&&this.setVertexCount(n.vertexCount),n.instanceCount&&this.setInstanceCount(n.instanceCount),n.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");n.indexBuffer&&this.setIndexBuffer(n.indexBuffer),n.attributes&&this.setAttributes(n.attributes),n.constantAttributes&&this.setConstantAttributes(n.constantAttributes),n.bindings&&this.setBindings(n.bindings),n.uniforms&&this.setUniforms(n.uniforms),n.moduleSettings&&this.updateModuleSettings(n.moduleSettings),this.setUniforms(this._getModuleUniforms()),Object.seal(this)}var t=e.prototype;return t.destroy=function(){this.pipelineFactory.release(this.pipeline)},t.draw=function(n){this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:n,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount})},t.setGeometry=function(n){var i=n&&qi(this.device,n);return this.setTopology(i.topology||"triangle-list"),this.bufferLayout=Xi(this.bufferLayout,i.bufferLayout),this.vertexArray&&this._setGeometryAttributes(i),i},t._setGeometryAttributes=function(n){this.vertexCount=n.vertexCount,this.setAttributes(n.attributes),this.setIndexBuffer(n.indices)},t.setTopology=function(n){n!==this.topology&&(this.topology=n,this._setPipelineNeedsUpdate("topology"))},t.setBufferLayout=function(n){this.bufferLayout=this._gpuGeometry?Xi(n,this._gpuGeometry.bufferLayout):n,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)},t.setParameters=function(n){re(n,this.parameters,2)||(this.parameters=n,this._setPipelineNeedsUpdate("parameters"))},t.setVertexCount=function(n){this.vertexCount=n},t.setInstanceCount=function(n){this.instanceCount=n},t.setShaderModuleProps=function(n){var i=this._getModuleUniforms(n),o=Object.keys(i).filter(function(u){var l=i[u];return!Mt(l)&&typeof l!="number"&&typeof l!="boolean"}),s={},c=Or(o),a;try{for(c.s();!(a=c.n()).done;){var f=a.value;s[f]=i[f],delete i[f]}}catch(u){c.e(u)}finally{c.f()}Object.assign(this.uniforms,i),Object.assign(this.bindings,s)},t.updateModuleSettings=function(n){this.setShaderModuleProps(n)},t.setBindings=function(n){Object.assign(this.bindings,n)},t.setUniforms=function(n){this.pipeline.setUniforms(n),Object.assign(this.uniforms,n)},t.setIndexBuffer=function(n){this.vertexArray.setIndexBuffer(n)},t.setAttributes=function(n){var i=this;n.indices&&K.warn("Model:".concat(this.id," setAttributes() - indexBuffer should be set using setIndexBuffer()"));for(var o=function(){var u,l=B(c[s],2),h=l[0],v=l[1],m=i.bufferLayout.find(function(w){return w.name===h});if(!m)return"continue";var y=m.attributes?(u=m.attributes)===null||u===void 0?void 0:u.map(function(w){return w.attribute}):[m.name],b=!1,O=Or(y),R;try{for(O.s();!(R=O.n()).done;){var x=R.value,S=i._attributeInfos[x];S&&(i.vertexArray.setBuffer(S.location,v),b=!0)}}catch(w){O.e(w)}finally{O.f()}b||K.warn("Model(".concat(i.id,'): Ignoring buffer "').concat(v.id,'" for unknown attribute "').concat(h,'"'))()},s=0,c=Object.entries(n);s<c.length;s++)var a=o()},t.setConstantAttributes=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1],f=this._attributeInfos[c];f?this.vertexArray.setConstant(f.location,a):K.warn('Model "'.concat(this.id,': Ignoring constant supplied for unknown attribute "').concat(c,'"'))()}},t._setPipelineNeedsUpdate=function(n){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||n},t._updatePipeline=function(){return this._pipelineNeedsUpdate&&(this.pipeline&&K.log(1,"Model ".concat(this.id,': Recreating pipeline because "').concat(this._pipelineNeedsUpdate,'".'))(),this._pipelineNeedsUpdate=!1,this.pipeline=this.device.createRenderPipeline(Wt(Wt({},this.props),{},{bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:this.device.createShader({id:"{$this.id}-vertex",stage:"vertex",source:this.vs}),fs:this.fs?this.device.createShader({id:"{$this.id}-fragment",stage:"fragment",source:this.fs}):null})),this._attributeInfos=Qe(this.pipeline.shaderLayout,this.bufferLayout)),this.pipeline},A(e)}();ae.defaultProps=Wt(Wt({},Bt.defaultProps),{},{vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:{},geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},pipelineFactory:void 0,shaderAssembler:we.getDefaultShaderAssembler()});function Xi(e,t){var r=ne(e),n=Or(t),i;try{var o=function(){var c=i.value,a=r.findIndex(function(f){return f.name===c.name});a<0?r.push(c):r[a]=c};for(n.s();!(i=n.n()).done;)o()}catch(s){n.e(s)}finally{n.f()}return r}function $i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Zi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$i(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$i(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ji=function(){e.isSupported=function(n){return!1};function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};T(this,e),this.device=void 0,this.gl=void 0,this.elementCount=0,this.elementIDBuffer=null}var t=e.prototype;return t.destroy=function(){},t.delete=function(){this.destroy()},t.run=function(n){var i=n||{},o=i.clearRenderTarget,s=o===void 0?!0:o,c=this._updateDrawOptions(n);s&&c.framebuffer},t.swap=function(){},t.getBuffer=function(n){return null},t.getData=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}},t.getFramebuffer=function(){return null},t.update=function(n){},t._updateModelProps=function(n){var i=Zi({},n);return i},t._buildResourceTransforms=function(n){},t._updateDrawOptions=function(n){var i=Zi({},n);return i},A(e)}();var Qi=function(){function e(r){T(this,e),this.device=void 0,this.shaderModule=void 0,this.useUniformBuffers=void 0,this.uniformBufferLayout=void 0,this.uniformBuffer=null,this.uniforms={},this.modifiedUniforms={},this.modified=!0,this.needsRedraw="initialized",this.device=r.device,this.shaderModule=r.shaderModule,this.useUniformBuffers=this.device.info.type!=="webgl";for(var n={},i=0,o=Object.entries(r.shaderModule.uniforms);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1].format;n[c]=a}this.uniformBufferLayout=new tr(n),this.useUniformBuffers&&(this.uniformBuffer=this.device.createBuffer({usage:X.UNIFORM,byteLength:this.uniformBufferLayout.byteLength}))}var t=e.prototype;return t.setUniforms=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var s=B(o[i],2),c=s[0],a=s[1];this._setUniform(c,a),this.setNeedsRedraw(c)}},t.setNeedsRedraw=function(n){this.needsRedraw=this.needsRedraw||n},t.getUniformBuffer=function(){if(this.needsRedraw){var n=this.getModifiedUniforms(),i=this.uniformBufferLayout.getData(n);this.uniformBuffer.write(i)}return this.uniformBuffer},t.getUniforms=function(n){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms[n]||{}},t.getModifiedUniforms=function(){var n=this.modifiedUniforms;return this.modifiedUniforms={},this.needsRedraw=!1,n},t._setUniform=function(n,i){pa(this.uniforms[n],i)||(this.uniforms[n]=i,this.modifiedUniforms[n]=!0,this.modified=!0)},A(e)}();function pa(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:16;if(e!==t)return!1;var n=Mt(e);if(!n)return!1;var i=Mt(t);if(i&&n.length===i.length){for(var o=0;o<n.length;++o)if(i[o]!==n[o])return!1}return!0}function to(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function da(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?to(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):to(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var st=function(){function e(r){T(this,e),this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};var n=r.attributes,i=n===void 0?{}:n,o=r.indices,s=o===void 0?null:o,c=r.vertexCount,a=c===void 0?null:c;this.id=r.id||H("geometry"),this.topology=r.topology,s&&(this.indices=ArrayBuffer.isView(s)?{value:s,size:1}:s),this.attributes={};for(var f=0,u=Object.entries(i);f<u.length;f++){var l=B(u[f],2),h=l[0],v=l[1],m=ArrayBuffer.isView(v)?{value:v}:v;rt(ArrayBuffer.isView(m.value),"".concat(this._print(h),": must be typed array or object with value as typed array")),(h==="POSITION"||h==="positions")&&!m.size&&(m.size=3),h==="indices"?(rt(!this.indices),this.indices=m):this.attributes[h]=m}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=a||this._calculateVertexCount(this.attributes,this.indices)}var t=e.prototype;return t.getVertexCount=function(){return this.vertexCount},t.getAttributes=function(){return this.indices?da({indices:this.indices},this.attributes):this.attributes},t._print=function(n){return"Geometry ".concat(this.id," attribute ").concat(n)},t._setAttributes=function(n,i){return this},t._calculateVertexCount=function(n,i){if(i)return i.value.length;for(var o=1/0,s=0,c=Object.values(n);s<c.length;s++){var a=c[s],f=a.value,u=a.size,l=a.constant;!l&&f&&u>=1&&(o=Math.min(o,f.length/u))}return rt(Number.isFinite(o)),o},A(e)}();var eo;function ro(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function no(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ro(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ro(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ma(e){var t=ga();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function ga(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var va=mn(eo||(eo=$([`attribute vec2 aClipSpacePosition;
228
228
  attribute vec2 aTexCoord;
229
229
  attribute vec2 aCoordinate;
230
230
 
@@ -253,8 +253,8 @@ void main(void) {
253
253
  coordinate = aCoordinate;
254
254
  uv = aTexCoord;
255
255
  }
256
- `]))),io=[-1,-1,1,-1,-1,1,1,1],oo=function(e){q(r,e);var t=ma(r);function r(n,i){T(this,r);var o=io.map(function(s){return s===-1?0:s});return t.call(this,n,no(no({},i),{},{vs:va,vertexCount:4,geometry:new st({topology:"triangle-strip",vertexCount:4,attributes:{aClipSpacePosition:{size:2,value:new Float32Array(io)},aTexCoord:{size:2,value:new Float32Array(o)},aCoordinate:{size:2,value:new Float32Array(o)}}})}))}return A(r)}(ae);var Dt=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,e),this.id=void 0,this.matrix=new mt,this.display=!0,this.position=new ot,this.rotation=new ot,this.scale=new ot(1,1,1),this.userData={},this.props={};var n=r.id;this.id=n||H(this.constructor.name),this._setScenegraphNodeProps(r)}var t=e.prototype;return t.getBounds=function(){return null},t.destroy=function(){},t.delete=function(){this.destroy()},t.setProps=function(n){return this._setScenegraphNodeProps(n),this},t.toString=function(){return"{type: ScenegraphNode, id: ".concat(this.id,")}")},t.setPosition=function(n){return rt(n.length===3,"setPosition requires vector argument"),this.position=n,this},t.setRotation=function(n){return rt(n.length===3,"setRotation requires vector argument"),this.rotation=n,this},t.setScale=function(n){return rt(n.length===3,"setScale requires vector argument"),this.scale=n,this},t.setMatrix=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i?this.matrix.copy(n):this.matrix=n},t.setMatrixComponents=function(n){var i=n.position,o=n.rotation,s=n.scale,c=n.update,a=c===void 0?!0:c;return i&&this.setPosition(i),o&&this.setRotation(o),s&&this.setScale(s),a&&this.updateMatrix(),this},t.updateMatrix=function(){var n=this.position,i=this.rotation,o=this.scale;return this.matrix.identity(),this.matrix.translate(n),this.matrix.rotateXYZ(i),this.matrix.scale(o),this},t.update=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.position,o=n.rotation,s=n.scale;return i&&this.setPosition(i),o&&this.setRotation(o),s&&this.setScale(s),this.updateMatrix(),this},t.getCoordinateUniforms=function(n,i){rt(n),i=i||this.matrix;var o=new mt(n).multiplyRight(i),s=o.invert(),c=s.transpose();return{viewMatrix:n,modelMatrix:i,objectMatrix:i,worldMatrix:o,worldInverseMatrix:s,worldInverseTransposeMatrix:c}},t._setScenegraphNodeProps=function(n){"display"in n&&(this.display=n.display),"position"in n&&this.setPosition(n.position),"rotation"in n&&this.setRotation(n.rotation),"scale"in n&&this.setScale(n.scale),"matrix"in n&&this.setMatrix(n.matrix),Object.assign(this.props,n)},A(e)}();function wr(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=F(e),e!==null););return e}function Kt(){return typeof Reflect<"u"&&Reflect.get?Kt=Reflect.get.bind():Kt=function(t,r,n){var i=wr(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Kt.apply(this,arguments)}function ya(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_a(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
257
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function _a(e,t){if(e){if(typeof e=="string")return so(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return so(e,t)}}function so(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function xa(e){var t=ba();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function ba(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var ao=function(e){q(r,e);var t=xa(r);function r(){var i,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r),o=Array.isArray(o)?{children:o}:o;var s=o,c=s.children,a=c===void 0?[]:c;return K.assert(a.every(function(f){return f instanceof Dt}),"every child must an instance of ScenegraphNode"),i=t.call(this,o),i.children=void 0,i.children=a,i}var n=r.prototype;return n.getBounds=function(){var o=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];return this.traverse(function(s,c){var a=c.worldMatrix,f=s.getBounds();if(f){var u=B(f,2),l=u[0],h=u[1],v=new ot(l).add(h).divide([2,2,2]);a.transformAsPoint(v,v);var m=new ot(h).subtract(l).divide([2,2,2]);a.transformAsVector(m,m);for(var y=0;y<8;y++)for(var b=new ot(y&1?-1:1,y&2?-1:1,y&4?-1:1).multiply(m).add(v),O=0;O<3;O++)o[0][O]=Math.min(o[0][O],b[O]),o[1][O]=Math.max(o[1][O],b[O])}}),Number.isFinite(o[0][0])?o:null},n.destroy=function(){this.children.forEach(function(o){return o.destroy()}),this.removeAll(),Kt(F(r.prototype),"destroy",this).call(this)},n.add=function(){for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];for(var a=0,f=s;a<f.length;a++){var u=f[a];Array.isArray(u)?this.add.apply(this,ne(u)):this.children.push(u)}return this},n.remove=function(o){var s=this.children,c=s.indexOf(o);return c>-1&&s.splice(c,1),this},n.removeAll=function(){return this.children=[],this},n.traverse=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=s.worldMatrix,a=c===void 0?new mt:c,f=new mt(a).multiplyRight(this.matrix),u=ya(this.children),l;try{for(u.s();!(l=u.n()).done;){var h=l.value;h instanceof r?h.traverse(o,{worldMatrix:f}):o(h,{worldMatrix:f})}}catch(v){u.e(v)}finally{u.f()}},A(r)}(Dt);function Oa(e){var t=wa();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function wa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var co=function(e){q(r,e);var t=Oa(r);function r(i){var o;return T(this,r),o=t.call(this,i),o.model=void 0,o.bounds=null,o.managedResources=void 0,o.model=i.model,o.managedResources=i.managedResources||[],o.bounds=i.bounds||null,o.setProps(i),o}var n=r.prototype;return n.getBounds=function(){return this.bounds},n.destroy=function(){this.model&&(this.model.destroy(),this.model=null),this.managedResources.forEach(function(o){return o.destroy()}),this.managedResources=[]},n.draw=function(o){return this.model.draw(o)},A(r)}(Dt);function fo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Er(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ea(e){var t=Ma();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ma(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Sa={x:[2,0,1],y:[0,1,2],z:[1,2,0]},Yt=function(e){q(r,e);var t=Ea(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("truncated-code-geometry"):i,s=Pa(n),c=s.indices,a=s.attributes;return t.call(this,Er(Er({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Er({POSITION:{size:3,value:a.POSITION},NORMAL:{size:3,value:a.NORMAL},TEXCOORD_0:{size:2,value:a.TEXCOORD_0}},n.attributes)}))}return A(r)}(st);function Pa(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.bottomRadius,r=t===void 0?0:t,n=e.topRadius,i=n===void 0?0:n,o=e.height,s=o===void 0?1:o,c=e.nradial,a=c===void 0?10:c,f=e.nvertical,u=f===void 0?10:f,l=e.verticalAxis,h=l===void 0?"y":l,v=e.topCap,m=v===void 0?!1:v,y=e.bottomCap,b=y===void 0?!1:y,O=(m?2:0)+(b?2:0),R=(a+1)*(u+1+O),x=Math.atan2(r-i,s),S=Math.sin,w=Math.cos,M=Math.PI,j=w(x),N=S(x),U=m?-2:0,C=u+(b?2:0),g=a+1,p=new Uint16Array(a*(u+O)*6),d=Sa[h],_=new Float32Array(R*3),E=new Float32Array(R*3),P=new Float32Array(R*2),D=0,z=0,I=U;I<=C;I++){var G=I/u,k=s*G,V=void 0;I<0?(k=0,G=1,V=r):I>u?(k=s,G=1,V=i):V=r+(i-r)*(I/u),(I===-2||I===u+2)&&(V=0,G=0),k-=s/2;for(var pt=0;pt<g;pt++){var ft=S(pt*M*2/a),Z=w(pt*M*2/a);_[D+d[0]]=ft*V,_[D+d[1]]=k,_[D+d[2]]=Z*V,E[D+d[0]]=I<0||I>u?0:ft*j,E[D+d[1]]=I<0?-1:I>u?1:N,E[D+d[2]]=I<0||I>u?0:Z*j,P[z+0]=pt/a,P[z+1]=G,z+=2,D+=3}}for(var J=0;J<u+O;J++)for(var Q=0;Q<a;Q++){var at=(J*a+Q)*6;p[at+0]=g*(J+0)+0+Q,p[at+1]=g*(J+0)+1+Q,p[at+2]=g*(J+1)+1+Q,p[at+3]=g*(J+0)+0+Q,p[at+4]=g*(J+1)+1+Q,p[at+5]=g*(J+1)+0+Q}return{indices:p,attributes:{POSITION:_,NORMAL:E,TEXCOORD_0:P}}}function uo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function lo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Aa(e){var t=Ta();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ta(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var ho=function(e){q(r,e);var t=Aa(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cone-geometry"):i,s=n.radius,c=s===void 0?1:s,a=n.cap,f=a===void 0?!0:a;return t.call(this,lo(lo({},n),{},{id:o,topRadius:0,topCap:Boolean(f),bottomCap:Boolean(f),bottomRadius:c}))}return A(r)}(Yt);function po(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Pt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?po(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):po(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ra(e){var t=Ca();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ca(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var mo=function(e){q(r,e);var t=Ra(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cube-geometry"):i,s=n.indices,c=s===void 0?!0:s;return t.call(this,c?Pt(Pt({},n),{},{id:o,topology:"triangle-list",indices:{size:1,value:La},attributes:Pt(Pt({},Ga),n.attributes)}):Pt(Pt({},n),{},{id:o,topology:"triangle-list",indices:void 0,attributes:Pt(Pt({},za),n.attributes)}))}return A(r)}(st),La=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),Da=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),Ia=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0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),Ga={POSITION:{size:3,value:Da},NORMAL:{size:3,value:Ia},TEXCOORD_0:{size:2,value:Na}},za={POSITION:{size:4,value:ja},TEXCOORD_0:{size:2,value:Fa},COLOR_0:{size:3,value:Ua}};function go(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?go(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):go(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ba(e){var t=ka();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function ka(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var yo=function(e){q(r,e);var t=Ba(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cylinder-geometry"):i,s=n.radius,c=s===void 0?1:s;return t.call(this,vo(vo({},n),{},{id:o,bottomRadius:c,topRadius:c}))}return A(r)}(Yt);function _o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Le(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_o(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_o(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Va(e){var t=Ha();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ha(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var qa=[-1,0,0,0,1,0,0,0,-1,0,0,1,0,-1,0,1,0,0],Wa=[3,4,5,3,5,1,3,1,0,3,0,4,4,0,2,4,2,5,2,0,1,5,2,1],xo=function(e){q(r,e);var t=Va(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("ico-sphere-geometry"):i,s=Ka(n),c=s.indices,a=s.attributes;return t.call(this,Le(Le({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Le(Le({},a),n.attributes)}))}return A(r)}(st);function Ka(e){var t=e.iterations,r=t===void 0?0:t,n=Math.PI,i=n*2,o=[].concat(qa),s=[].concat(Wa);o.push(),s.push();for(var c=function(){var Ne={};return function(bt,Ot){bt*=3,Ot*=3;var Ao=bt<Ot?bt:Ot,To=bt>Ot?bt:Ot,je="".concat(Ao,"|").concat(To);if(je in Ne)return Ne[je];var Ro=o[bt],Co=o[bt+1],Lo=o[bt+2],Do=o[Ot],Io=o[Ot+1],No=o[Ot+2],fe=(Ro+Do)/2,ue=(Co+Io)/2,le=(Lo+No)/2,Fe=Math.sqrt(fe*fe+ue*ue+le*le);return fe/=Fe,ue/=Fe,le/=Fe,o.push(fe,ue,le),Ne[je]=o.length/3-1}}(),a=0;a<r;a++){for(var f=[],u=0;u<s.length;u+=3){var l=c(s[u+0],s[u+1]),h=c(s[u+1],s[u+2]),v=c(s[u+2],s[u+0]);f.push(v,s[u+0],l,l,s[u+1],h,h,s[u+2],v,l,h,v)}s=f}for(var m=new Array(o.length),y=new Array(o.length/3*2),b=s.length,O=b-3;O>=0;O-=3){var R=s[O+0],x=s[O+1],S=s[O+2],w=R*3,M=x*3,j=S*3,N=R*2,U=x*2,C=S*2,g=o[w+0],p=o[w+1],d=o[w+2],_=Math.acos(d/Math.sqrt(g*g+p*p+d*d)),E=Math.atan2(p,g)+n,P=_/n,D=1-E/i,z=o[M+0],I=o[M+1],G=o[M+2],k=Math.acos(G/Math.sqrt(z*z+I*I+G*G)),V=Math.atan2(I,z)+n,pt=k/n,ft=1-V/i,Z=o[j+0],J=o[j+1],Q=o[j+2],at=Math.acos(Q/Math.sqrt(Z*Z+J*J+Q*Q)),Xt=Math.atan2(J,Z)+n,Mr=at/n,ce=1-Xt/i,So=[Z-z,J-I,Q-G],Po=[g-z,p-I,d-G],ut=new ot(So).cross(Po).normalize(),Y=void 0;(D===0||ft===0||ce===0)&&(D===0||D>.5)&&(ft===0||ft>.5)&&(ce===0||ce>.5)&&(o.push(o[w+0],o[w+1],o[w+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=P,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z,o.push(o[M+0],o[M+1],o[M+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=pt,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z,o.push(o[j+0],o[j+1],o[j+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=Mr,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z),m[w+0]=m[M+0]=m[j+0]=ut.x,m[w+1]=m[M+1]=m[j+1]=ut.y,m[w+2]=m[M+2]=m[j+2]=ut.z,y[N+0]=D,y[N+1]=P,y[U+0]=ft,y[U+1]=pt,y[C+0]=ce,y[C+1]=Mr}return{indices:{size:1,value:new Uint16Array(s)},attributes:{POSITION:{size:3,value:new Float32Array(o)},NORMAL:{size:3,value:new Float32Array(m)},TEXCOORD_0:{size:2,value:new Float32Array(y)}}}}function bo(e){var t=e.indices,r=e.attributes;if(!t)return e;var n=t.value.length,i={};for(var o in r){var s=r[o],c=s.constant,a=s.value,f=s.size;if(!(c||!f)){for(var u=new a.constructor(n*f),l=0;l<n;++l)for(var h=t.value[l],v=0;v<f;v++)u[l*f+v]=a[h*f+v];i[o]={size:f,value:u}}}return{attributes:Object.assign({},r,i)}}function Oo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function De(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Oo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ya(e){var t=Xa();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Xa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var wo=function(e){q(r,e);var t=Ya(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("plane-geometry"):i,s=$a(n),c=s.indices,a=s.attributes;return t.call(this,De(De({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:De(De({},a),n.attributes)}))}return A(r)}(st);function $a(e){var t=e.type,r=t===void 0?"x,y":t,n=e.offset,i=n===void 0?0:n,o=e.flipCull,s=o===void 0?!1:o,c=e.unpack,a=c===void 0?!1:c,f=r.split(","),u=e["".concat(f[0],"len")]||1,l=e["".concat(f[1],"len")]||1,h=e["n".concat(f[0])]||1,v=e["n".concat(f[1])]||1,m=(h+1)*(v+1),y=new Float32Array(m*3),b=new Float32Array(m*3),O=new Float32Array(m*2);s&&(u=-u);for(var R=0,x=0,S=0;S<=v;S++)for(var w=0;w<=h;w++){var M=w/h,j=S/v;switch(O[R+0]=s?1-M:M,O[R+1]=j,r){case"x,y":y[x+0]=u*M-u*.5,y[x+1]=l*j-l*.5,y[x+2]=i,b[x+0]=0,b[x+1]=0,b[x+2]=s?1:-1;break;case"x,z":y[x+0]=u*M-u*.5,y[x+1]=i,y[x+2]=l*j-l*.5,b[x+0]=0,b[x+1]=s?1:-1,b[x+2]=0;break;case"y,z":y[x+0]=i,y[x+1]=u*M-u*.5,y[x+2]=l*j-l*.5,b[x+0]=s?1:-1,b[x+1]=0,b[x+2]=0;break;default:throw new Error("PlaneGeometry: unknown type")}R+=2,x+=3}for(var N=h+1,U=new Uint16Array(h*v*6),C=0;C<v;C++)for(var g=0;g<h;g++){var p=(C*h+g)*6;U[p+0]=(C+0)*N+g,U[p+1]=(C+1)*N+g,U[p+2]=(C+0)*N+g+1,U[p+3]=(C+1)*N+g,U[p+4]=(C+1)*N+g+1,U[p+5]=(C+0)*N+g+1}var d={indices:{size:1,value:U},attributes:{POSITION:{size:3,value:y},NORMAL:{size:3,value:b},TEXCOORD_0:{size:2,value:O}}};return a?bo(d):d}function Eo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ie(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Eo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Eo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Za(e){var t=Ja();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ja(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Mo=function(e){q(r,e);var t=Za(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("sphere-geometry"):i,s=Qa(n),c=s.indices,a=s.attributes;return t.call(this,Ie(Ie({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Ie(Ie({},a),n.attributes)}))}return A(r)}(st);function Qa(e){for(var t=e.nlat,r=t===void 0?10:t,n=e.nlong,i=n===void 0?10:n,o=0,s=Math.PI,c=s-o,a=0,f=2*Math.PI,u=f-a,l=(r+1)*(i+1),h=function(ft,Z,J,Q,at){return e.radius||1},v=new Float32Array(l*3),m=new Float32Array(l*3),y=new Float32Array(l*2),b=l>65535?Uint32Array:Uint16Array,O=new b(r*i*6),R=0;R<=r;R++)for(var x=0;x<=i;x++){var S=x/i,w=R/r,M=x+R*(i+1),j=M*2,N=M*3,U=u*S,C=c*w,g=Math.sin(U),p=Math.cos(U),d=Math.sin(C),_=Math.cos(C),E=p*d,P=_,D=g*d,z=h(E,P,D,S,w);v[N+0]=z*E,v[N+1]=z*P,v[N+2]=z*D,m[N+0]=E,m[N+1]=P,m[N+2]=D,y[j+0]=S,y[j+1]=1-w}for(var I=i+1,G=0;G<i;G++)for(var k=0;k<r;k++){var V=(G*r+k)*6;O[V+0]=k*I+G,O[V+1]=k*I+G+1,O[V+2]=(k+1)*I+G,O[V+3]=(k+1)*I+G,O[V+4]=k*I+G+1,O[V+5]=(k+1)*I+G+1}return{indices:{size:1,value:O},attributes:{POSITION:{size:3,value:v},NORMAL:{size:3,value:m},TEXCOORD_0:{size:2,value:y}}}}return ko(tc);})();
256
+ `]))),io=[-1,-1,1,-1,-1,1,1,1],oo=function(e){q(r,e);var t=ma(r);function r(n,i){T(this,r);var o=io.map(function(s){return s===-1?0:s});return t.call(this,n,no(no({},i),{},{vs:va,vertexCount:4,geometry:new st({topology:"triangle-strip",vertexCount:4,attributes:{aClipSpacePosition:{size:2,value:new Float32Array(io)},aTexCoord:{size:2,value:new Float32Array(o)},aCoordinate:{size:2,value:new Float32Array(o)}}})}))}return A(r)}(ae);var It=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,e),this.id=void 0,this.matrix=new mt,this.display=!0,this.position=new ot,this.rotation=new ot,this.scale=new ot(1,1,1),this.userData={},this.props={};var n=r.id;this.id=n||H(this.constructor.name),this._setScenegraphNodeProps(r)}var t=e.prototype;return t.getBounds=function(){return null},t.destroy=function(){},t.delete=function(){this.destroy()},t.setProps=function(n){return this._setScenegraphNodeProps(n),this},t.toString=function(){return"{type: ScenegraphNode, id: ".concat(this.id,")}")},t.setPosition=function(n){return rt(n.length===3,"setPosition requires vector argument"),this.position=n,this},t.setRotation=function(n){return rt(n.length===3,"setRotation requires vector argument"),this.rotation=n,this},t.setScale=function(n){return rt(n.length===3,"setScale requires vector argument"),this.scale=n,this},t.setMatrix=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i?this.matrix.copy(n):this.matrix=n},t.setMatrixComponents=function(n){var i=n.position,o=n.rotation,s=n.scale,c=n.update,a=c===void 0?!0:c;return i&&this.setPosition(i),o&&this.setRotation(o),s&&this.setScale(s),a&&this.updateMatrix(),this},t.updateMatrix=function(){var n=this.position,i=this.rotation,o=this.scale;return this.matrix.identity(),this.matrix.translate(n),this.matrix.rotateXYZ(i),this.matrix.scale(o),this},t.update=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.position,o=n.rotation,s=n.scale;return i&&this.setPosition(i),o&&this.setRotation(o),s&&this.setScale(s),this.updateMatrix(),this},t.getCoordinateUniforms=function(n,i){rt(n),i=i||this.matrix;var o=new mt(n).multiplyRight(i),s=o.invert(),c=s.transpose();return{viewMatrix:n,modelMatrix:i,objectMatrix:i,worldMatrix:o,worldInverseMatrix:s,worldInverseTransposeMatrix:c}},t._setScenegraphNodeProps=function(n){"display"in n&&(this.display=n.display),"position"in n&&this.setPosition(n.position),"rotation"in n&&this.setRotation(n.rotation),"scale"in n&&this.setScale(n.scale),"matrix"in n&&this.setMatrix(n.matrix),Object.assign(this.props,n)},A(e)}();function wr(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=F(e),e!==null););return e}function Kt(){return typeof Reflect<"u"&&Reflect.get?Kt=Reflect.get.bind():Kt=function(t,r,n){var i=wr(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Kt.apply(this,arguments)}function ya(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_a(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
257
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function _a(e,t){if(e){if(typeof e=="string")return so(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return so(e,t)}}function so(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function xa(e){var t=ba();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function ba(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var ao=function(e){q(r,e);var t=xa(r);function r(){var i,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r),o=Array.isArray(o)?{children:o}:o;var s=o,c=s.children,a=c===void 0?[]:c;return K.assert(a.every(function(f){return f instanceof It}),"every child must an instance of ScenegraphNode"),i=t.call(this,o),i.children=void 0,i.children=a,i}var n=r.prototype;return n.getBounds=function(){var o=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];return this.traverse(function(s,c){var a=c.worldMatrix,f=s.getBounds();if(f){var u=B(f,2),l=u[0],h=u[1],v=new ot(l).add(h).divide([2,2,2]);a.transformAsPoint(v,v);var m=new ot(h).subtract(l).divide([2,2,2]);a.transformAsVector(m,m);for(var y=0;y<8;y++)for(var b=new ot(y&1?-1:1,y&2?-1:1,y&4?-1:1).multiply(m).add(v),O=0;O<3;O++)o[0][O]=Math.min(o[0][O],b[O]),o[1][O]=Math.max(o[1][O],b[O])}}),Number.isFinite(o[0][0])?o:null},n.destroy=function(){this.children.forEach(function(o){return o.destroy()}),this.removeAll(),Kt(F(r.prototype),"destroy",this).call(this)},n.add=function(){for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];for(var a=0,f=s;a<f.length;a++){var u=f[a];Array.isArray(u)?this.add.apply(this,ne(u)):this.children.push(u)}return this},n.remove=function(o){var s=this.children,c=s.indexOf(o);return c>-1&&s.splice(c,1),this},n.removeAll=function(){return this.children=[],this},n.traverse=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=s.worldMatrix,a=c===void 0?new mt:c,f=new mt(a).multiplyRight(this.matrix),u=ya(this.children),l;try{for(u.s();!(l=u.n()).done;){var h=l.value;h instanceof r?h.traverse(o,{worldMatrix:f}):o(h,{worldMatrix:f})}}catch(v){u.e(v)}finally{u.f()}},A(r)}(It);function Oa(e){var t=wa();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function wa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var co=function(e){q(r,e);var t=Oa(r);function r(i){var o;return T(this,r),o=t.call(this,i),o.model=void 0,o.bounds=null,o.managedResources=void 0,o.model=i.model,o.managedResources=i.managedResources||[],o.bounds=i.bounds||null,o.setProps(i),o}var n=r.prototype;return n.getBounds=function(){return this.bounds},n.destroy=function(){this.model&&(this.model.destroy(),this.model=null),this.managedResources.forEach(function(o){return o.destroy()}),this.managedResources=[]},n.draw=function(o){return this.model.draw(o)},A(r)}(It);function fo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Er(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ea(e){var t=Ma();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ma(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Sa={x:[2,0,1],y:[0,1,2],z:[1,2,0]},Yt=function(e){q(r,e);var t=Ea(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("truncated-code-geometry"):i,s=Pa(n),c=s.indices,a=s.attributes;return t.call(this,Er(Er({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Er({POSITION:{size:3,value:a.POSITION},NORMAL:{size:3,value:a.NORMAL},TEXCOORD_0:{size:2,value:a.TEXCOORD_0}},n.attributes)}))}return A(r)}(st);function Pa(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.bottomRadius,r=t===void 0?0:t,n=e.topRadius,i=n===void 0?0:n,o=e.height,s=o===void 0?1:o,c=e.nradial,a=c===void 0?10:c,f=e.nvertical,u=f===void 0?10:f,l=e.verticalAxis,h=l===void 0?"y":l,v=e.topCap,m=v===void 0?!1:v,y=e.bottomCap,b=y===void 0?!1:y,O=(m?2:0)+(b?2:0),R=(a+1)*(u+1+O),x=Math.atan2(r-i,s),S=Math.sin,w=Math.cos,M=Math.PI,j=w(x),N=S(x),U=m?-2:0,C=u+(b?2:0),g=a+1,p=new Uint16Array(a*(u+O)*6),d=Sa[h],_=new Float32Array(R*3),E=new Float32Array(R*3),P=new Float32Array(R*2),D=0,z=0,I=U;I<=C;I++){var G=I/u,k=s*G,V=void 0;I<0?(k=0,G=1,V=r):I>u?(k=s,G=1,V=i):V=r+(i-r)*(I/u),(I===-2||I===u+2)&&(V=0,G=0),k-=s/2;for(var pt=0;pt<g;pt++){var ft=S(pt*M*2/a),Z=w(pt*M*2/a);_[D+d[0]]=ft*V,_[D+d[1]]=k,_[D+d[2]]=Z*V,E[D+d[0]]=I<0||I>u?0:ft*j,E[D+d[1]]=I<0?-1:I>u?1:N,E[D+d[2]]=I<0||I>u?0:Z*j,P[z+0]=pt/a,P[z+1]=G,z+=2,D+=3}}for(var J=0;J<u+O;J++)for(var Q=0;Q<a;Q++){var at=(J*a+Q)*6;p[at+0]=g*(J+0)+0+Q,p[at+1]=g*(J+0)+1+Q,p[at+2]=g*(J+1)+1+Q,p[at+3]=g*(J+0)+0+Q,p[at+4]=g*(J+1)+1+Q,p[at+5]=g*(J+1)+0+Q}return{indices:p,attributes:{POSITION:_,NORMAL:E,TEXCOORD_0:P}}}function uo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function lo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Aa(e){var t=Ta();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ta(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var ho=function(e){q(r,e);var t=Aa(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cone-geometry"):i,s=n.radius,c=s===void 0?1:s,a=n.cap,f=a===void 0?!0:a;return t.call(this,lo(lo({},n),{},{id:o,topRadius:0,topCap:Boolean(f),bottomCap:Boolean(f),bottomRadius:c}))}return A(r)}(Yt);function po(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function At(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?po(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):po(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ra(e){var t=Ca();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ca(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var mo=function(e){q(r,e);var t=Ra(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cube-geometry"):i,s=n.indices,c=s===void 0?!0:s;return t.call(this,c?At(At({},n),{},{id:o,topology:"triangle-list",indices:{size:1,value:La},attributes:At(At({},Ga),n.attributes)}):At(At({},n),{},{id:o,topology:"triangle-list",indices:void 0,attributes:At(At({},za),n.attributes)}))}return A(r)}(st),La=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),Da=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),Ia=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),Na=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),ja=new Float32Array([1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,1,-1,-1,1,-1,1,1,1,1,1,1,1,1,1,-1,1,-1,1,-1,1,-1,1,1,1,1,1,-1,1,-1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1]),Fa=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),Ua=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),Ga={POSITION:{size:3,value:Da},NORMAL:{size:3,value:Ia},TEXCOORD_0:{size:2,value:Na}},za={POSITION:{size:4,value:ja},TEXCOORD_0:{size:2,value:Fa},COLOR_0:{size:3,value:Ua}};function go(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?go(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):go(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ba(e){var t=ka();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function ka(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var yo=function(e){q(r,e);var t=Ba(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cylinder-geometry"):i,s=n.radius,c=s===void 0?1:s;return t.call(this,vo(vo({},n),{},{id:o,bottomRadius:c,topRadius:c}))}return A(r)}(Yt);function _o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Le(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_o(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_o(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Va(e){var t=Ha();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ha(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var qa=[-1,0,0,0,1,0,0,0,-1,0,0,1,0,-1,0,1,0,0],Wa=[3,4,5,3,5,1,3,1,0,3,0,4,4,0,2,4,2,5,2,0,1,5,2,1],xo=function(e){q(r,e);var t=Va(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("ico-sphere-geometry"):i,s=Ka(n),c=s.indices,a=s.attributes;return t.call(this,Le(Le({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Le(Le({},a),n.attributes)}))}return A(r)}(st);function Ka(e){var t=e.iterations,r=t===void 0?0:t,n=Math.PI,i=n*2,o=[].concat(qa),s=[].concat(Wa);o.push(),s.push();for(var c=function(){var Ne={};return function(bt,Ot){bt*=3,Ot*=3;var Ao=bt<Ot?bt:Ot,To=bt>Ot?bt:Ot,je="".concat(Ao,"|").concat(To);if(je in Ne)return Ne[je];var Ro=o[bt],Co=o[bt+1],Lo=o[bt+2],Do=o[Ot],Io=o[Ot+1],No=o[Ot+2],fe=(Ro+Do)/2,ue=(Co+Io)/2,le=(Lo+No)/2,Fe=Math.sqrt(fe*fe+ue*ue+le*le);return fe/=Fe,ue/=Fe,le/=Fe,o.push(fe,ue,le),Ne[je]=o.length/3-1}}(),a=0;a<r;a++){for(var f=[],u=0;u<s.length;u+=3){var l=c(s[u+0],s[u+1]),h=c(s[u+1],s[u+2]),v=c(s[u+2],s[u+0]);f.push(v,s[u+0],l,l,s[u+1],h,h,s[u+2],v,l,h,v)}s=f}for(var m=new Array(o.length),y=new Array(o.length/3*2),b=s.length,O=b-3;O>=0;O-=3){var R=s[O+0],x=s[O+1],S=s[O+2],w=R*3,M=x*3,j=S*3,N=R*2,U=x*2,C=S*2,g=o[w+0],p=o[w+1],d=o[w+2],_=Math.acos(d/Math.sqrt(g*g+p*p+d*d)),E=Math.atan2(p,g)+n,P=_/n,D=1-E/i,z=o[M+0],I=o[M+1],G=o[M+2],k=Math.acos(G/Math.sqrt(z*z+I*I+G*G)),V=Math.atan2(I,z)+n,pt=k/n,ft=1-V/i,Z=o[j+0],J=o[j+1],Q=o[j+2],at=Math.acos(Q/Math.sqrt(Z*Z+J*J+Q*Q)),Xt=Math.atan2(J,Z)+n,Mr=at/n,ce=1-Xt/i,So=[Z-z,J-I,Q-G],Po=[g-z,p-I,d-G],ut=new ot(So).cross(Po).normalize(),Y=void 0;(D===0||ft===0||ce===0)&&(D===0||D>.5)&&(ft===0||ft>.5)&&(ce===0||ce>.5)&&(o.push(o[w+0],o[w+1],o[w+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=P,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z,o.push(o[M+0],o[M+1],o[M+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=pt,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z,o.push(o[j+0],o[j+1],o[j+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=Mr,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z),m[w+0]=m[M+0]=m[j+0]=ut.x,m[w+1]=m[M+1]=m[j+1]=ut.y,m[w+2]=m[M+2]=m[j+2]=ut.z,y[N+0]=D,y[N+1]=P,y[U+0]=ft,y[U+1]=pt,y[C+0]=ce,y[C+1]=Mr}return{indices:{size:1,value:new Uint16Array(s)},attributes:{POSITION:{size:3,value:new Float32Array(o)},NORMAL:{size:3,value:new Float32Array(m)},TEXCOORD_0:{size:2,value:new Float32Array(y)}}}}function bo(e){var t=e.indices,r=e.attributes;if(!t)return e;var n=t.value.length,i={};for(var o in r){var s=r[o],c=s.constant,a=s.value,f=s.size;if(!(c||!f)){for(var u=new a.constructor(n*f),l=0;l<n;++l)for(var h=t.value[l],v=0;v<f;v++)u[l*f+v]=a[h*f+v];i[o]={size:f,value:u}}}return{attributes:Object.assign({},r,i)}}function Oo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function De(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Oo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ya(e){var t=Xa();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Xa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var wo=function(e){q(r,e);var t=Ya(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("plane-geometry"):i,s=$a(n),c=s.indices,a=s.attributes;return t.call(this,De(De({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:De(De({},a),n.attributes)}))}return A(r)}(st);function $a(e){var t=e.type,r=t===void 0?"x,y":t,n=e.offset,i=n===void 0?0:n,o=e.flipCull,s=o===void 0?!1:o,c=e.unpack,a=c===void 0?!1:c,f=r.split(","),u=e["".concat(f[0],"len")]||1,l=e["".concat(f[1],"len")]||1,h=e["n".concat(f[0])]||1,v=e["n".concat(f[1])]||1,m=(h+1)*(v+1),y=new Float32Array(m*3),b=new Float32Array(m*3),O=new Float32Array(m*2);s&&(u=-u);for(var R=0,x=0,S=0;S<=v;S++)for(var w=0;w<=h;w++){var M=w/h,j=S/v;switch(O[R+0]=s?1-M:M,O[R+1]=j,r){case"x,y":y[x+0]=u*M-u*.5,y[x+1]=l*j-l*.5,y[x+2]=i,b[x+0]=0,b[x+1]=0,b[x+2]=s?1:-1;break;case"x,z":y[x+0]=u*M-u*.5,y[x+1]=i,y[x+2]=l*j-l*.5,b[x+0]=0,b[x+1]=s?1:-1,b[x+2]=0;break;case"y,z":y[x+0]=i,y[x+1]=u*M-u*.5,y[x+2]=l*j-l*.5,b[x+0]=s?1:-1,b[x+1]=0,b[x+2]=0;break;default:throw new Error("PlaneGeometry: unknown type")}R+=2,x+=3}for(var N=h+1,U=new Uint16Array(h*v*6),C=0;C<v;C++)for(var g=0;g<h;g++){var p=(C*h+g)*6;U[p+0]=(C+0)*N+g,U[p+1]=(C+1)*N+g,U[p+2]=(C+0)*N+g+1,U[p+3]=(C+1)*N+g,U[p+4]=(C+1)*N+g+1,U[p+5]=(C+0)*N+g+1}var d={indices:{size:1,value:U},attributes:{POSITION:{size:3,value:y},NORMAL:{size:3,value:b},TEXCOORD_0:{size:2,value:O}}};return a?bo(d):d}function Eo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ie(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Eo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Eo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Za(e){var t=Ja();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ja(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Mo=function(e){q(r,e);var t=Za(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("sphere-geometry"):i,s=Qa(n),c=s.indices,a=s.attributes;return t.call(this,Ie(Ie({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Ie(Ie({},a),n.attributes)}))}return A(r)}(st);function Qa(e){for(var t=e.nlat,r=t===void 0?10:t,n=e.nlong,i=n===void 0?10:n,o=0,s=Math.PI,c=s-o,a=0,f=2*Math.PI,u=f-a,l=(r+1)*(i+1),h=function(ft,Z,J,Q,at){return e.radius||1},v=new Float32Array(l*3),m=new Float32Array(l*3),y=new Float32Array(l*2),b=l>65535?Uint32Array:Uint16Array,O=new b(r*i*6),R=0;R<=r;R++)for(var x=0;x<=i;x++){var S=x/i,w=R/r,M=x+R*(i+1),j=M*2,N=M*3,U=u*S,C=c*w,g=Math.sin(U),p=Math.cos(U),d=Math.sin(C),_=Math.cos(C),E=p*d,P=_,D=g*d,z=h(E,P,D,S,w);v[N+0]=z*E,v[N+1]=z*P,v[N+2]=z*D,m[N+0]=E,m[N+1]=P,m[N+2]=D,y[j+0]=S,y[j+1]=1-w}for(var I=i+1,G=0;G<i;G++)for(var k=0;k<r;k++){var V=(G*r+k)*6;O[V+0]=k*I+G,O[V+1]=k*I+G+1,O[V+2]=(k+1)*I+G,O[V+3]=(k+1)*I+G,O[V+4]=k*I+G+1,O[V+5]=(k+1)*I+G+1}return{indices:{size:1,value:O},attributes:{POSITION:{size:3,value:v},NORMAL:{size:3,value:m},TEXCOORD_0:{size:2,value:y}}}}return ko(tc);})();
258
258
  /*! Bundled license information:
259
259
 
260
260
  @babel/runtime/helpers/regeneratorRuntime.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/engine",
3
- "version": "9.0.0-alpha.41",
3
+ "version": "9.0.0-alpha.42",
4
4
  "description": "WebGL2 Components for High Performance Rendering and Computation",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -40,12 +40,12 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@babel/runtime": "^7.0.0",
43
- "@luma.gl/constants": "9.0.0-alpha.41",
44
- "@luma.gl/core": "9.0.0-alpha.41",
45
- "@luma.gl/shadertools": "9.0.0-alpha.41",
43
+ "@luma.gl/constants": "9.0.0-alpha.42",
44
+ "@luma.gl/core": "9.0.0-alpha.42",
45
+ "@luma.gl/shadertools": "9.0.0-alpha.42",
46
46
  "@math.gl/core": "^4.0.0",
47
47
  "@probe.gl/log": "^4.0.2",
48
48
  "@probe.gl/stats": "^4.0.2"
49
49
  },
50
- "gitHead": "e8a5f47c6890d0b1883979c09114676b8fa90cc6"
50
+ "gitHead": "61f38eaaa9cc42fa08d1c00690e370fa85681e30"
51
51
  }
Binary file
@@ -10,7 +10,7 @@ import type {
10
10
  AttributeInfo
11
11
  } from '@luma.gl/core';
12
12
  import type {Binding, UniformValue, PrimitiveTopology} from '@luma.gl/core';
13
- import {Device, Buffer, RenderPipeline, RenderPass, log, uid, deepEqual} from '@luma.gl/core';
13
+ import {Device, Buffer, RenderPipeline, RenderPass, log, uid, deepEqual, isNumberArray} from '@luma.gl/core';
14
14
  import {getAttributeInfosFromLayouts} from '@luma.gl/core';
15
15
  import type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';
16
16
  import {ShaderAssembler} from '@luma.gl/shadertools';
@@ -350,7 +350,7 @@ export class Model {
350
350
  // TODO better way to extract bindings
351
351
  const keys = Object.keys(uniforms).filter(k => {
352
352
  const uniform = uniforms[k];
353
- return !Array.isArray(uniform) && (typeof uniform !== 'number') && (typeof uniform !== 'boolean');
353
+ return !isNumberArray(uniform) && (typeof uniform !== 'number') && (typeof uniform !== 'boolean');
354
354
  });
355
355
  const bindings: Record<string, Binding> = {};
356
356
  for (const k of keys) {