@luma.gl/webgpu 9.0.0-alpha.53 → 9.0.0-alpha.54
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/adapter/resources/webgpu-buffer.d.ts +9 -0
- package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
- package/dist/dist.dev.js +13 -6
- package/dist.min.js +13 -13
- package/package.json +3 -3
- package/src/adapter/resources/webgpu-buffer.ts +52 -0
|
@@ -14,4 +14,13 @@ export declare class WebGPUBuffer extends Buffer {
|
|
|
14
14
|
getMappedRange(offset?: number, size?: number): ArrayBuffer;
|
|
15
15
|
unmap(): void;
|
|
16
16
|
}
|
|
17
|
+
/** Maps the memory so that it can be read *
|
|
18
|
+
// abstract mapAsync(mode, byteOffset, byteLength): Promise<void>
|
|
19
|
+
|
|
20
|
+
/** Get the mapped range of data for reading or writing *
|
|
21
|
+
// abstract getMappedRange(byteOffset, byteLength): ArrayBuffer;
|
|
22
|
+
|
|
23
|
+
/** unmap makes the contents of the buffer available to the GPU again *
|
|
24
|
+
// abstract unmap(): void;
|
|
25
|
+
*/
|
|
17
26
|
//# sourceMappingURL=webgpu-buffer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAMnD,qBAAa,YAAa,SAAQ,MAAM;IACtC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW;IA4B3C,OAAO,IAAI,IAAI;IAKf,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,SAAI;IAUrC,SAAS,CAAC,UAAU,GAAE,MAAU,EAAE,UAAU,GAAE,MAAwB,GAAG,OAAO,CAAC,UAAU,CAAC;IAmB3G,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;IAQtD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE,cAAc,CAAC,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;IAI9D,KAAK,IAAI,IAAI;CAGd"}
|
|
1
|
+
{"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAMnD,qBAAa,YAAa,SAAQ,MAAM;IACtC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW;IA4B3C,OAAO,IAAI,IAAI;IAKf,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,SAAI;IAUrC,SAAS,CAAC,UAAU,GAAE,MAAU,EAAE,UAAU,GAAE,MAAwB,GAAG,OAAO,CAAC,UAAU,CAAC;IAmB3G,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;IAQtD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE,cAAc,CAAC,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;IAI9D,KAAK,IAAI,IAAI;CAGd;AA4CD;;;;;;;;EAQE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-buffer.js","names":["Buffer","getByteLength","props","_props$data","byteLength","data","WebGPUBuffer","constructor","device","handle","mapBuffer","Boolean","size","Math","ceil","createBuffer","usage","GPUBufferUsage","VERTEX","COPY_DST","mappedAtCreation","label","id","_writeMapped","unmap","destroy","write","byteOffset","arguments","length","undefined","queue","writeBuffer","buffer","readAsync","tempBuffer","MAP_READ","commandEncoder","createCommandEncoder","copyBufferToBuffer","submit","finish","mapAsync","GPUMapMode","READ","arrayBuffer","getMappedRange","slice","Uint8Array","typedArray","set","mode","offset"],"sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"sourcesContent":["// WEBGPU Buffer implementation\nimport {Buffer, BufferProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nfunction getByteLength(props: BufferProps): number {\n return props.byteLength || props.data?.byteLength || 0;\n}\n\nexport class WebGPUBuffer extends Buffer {\n readonly device: WebGPUDevice;\n readonly handle: GPUBuffer;\n readonly byteLength: number;\n\n constructor(device: WebGPUDevice, props: BufferProps) {\n super(device, props);\n this.device = device;\n\n this.byteLength = getByteLength(props);\n const mapBuffer = Boolean(props.data);\n\n // WebGPU buffers must be aligned to 4 bytes\n const size = Math.ceil(this.byteLength / 4) * 4;\n\n this.handle = this.props.handle || this.device.handle.createBuffer({\n size,\n // usage defaults to vertex\n usage: this.props.usage || (GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST),\n mappedAtCreation: this.props.mappedAtCreation || mapBuffer,\n label: this.props.id\n });\n\n if (props.data) {\n this._writeMapped(props.data);\n // this.handle.writeAsync({data: props.data, map: false, unmap: false});\n }\n\n if (mapBuffer && !props.mappedAtCreation) {\n this.handle.unmap();\n }\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n\n // WebGPU provides multiple ways to write a buffer...\n override write(data: ArrayBufferView, byteOffset = 0) {\n this.device.handle.queue.writeBuffer(\n this.handle,\n byteOffset,\n data.buffer,\n data.byteOffset,\n data.byteLength\n );\n }\n\n override async readAsync(byteOffset: number = 0, byteLength: number = this.byteLength): Promise<Uint8Array> {\n // We need MAP_READ flag, but only COPY_DST buffers can have MAP_READ flag, so we need to create a temp buffer\n const tempBuffer = new WebGPUBuffer(this.device, {usage: Buffer.MAP_READ | Buffer.COPY_DST, byteLength});\n\n // Now do a GPU-side copy into the temp buffer we can actually read.\n // TODO - we are spinning up an independent command queue here, what does this mean\n const commandEncoder = this.device.handle.createCommandEncoder();\n commandEncoder.copyBufferToBuffer(this.handle, byteOffset, tempBuffer.handle, 0, byteLength);\n this.device.handle.queue.submit([commandEncoder.finish()]);\n\n // Map the temp buffer and read the data.\n await tempBuffer.handle.mapAsync(GPUMapMode.READ, byteOffset, byteLength);\n const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);\n tempBuffer.handle.unmap();\n tempBuffer.destroy();\n\n return new Uint8Array(arrayBuffer);\n }\n\n _writeMapped<TypedArray>(typedArray: TypedArray): void {\n const arrayBuffer = this.handle.getMappedRange();\n // @ts-expect-error\n new typedArray.constructor(arrayBuffer).set(typedArray);\n }\n\n // WEBGPU API\n\n mapAsync(mode: number, offset: number = 0, size?: number): Promise<void> {\n return this.handle.mapAsync(mode, offset, size);\n }\n\n getMappedRange(offset: number = 0, size?: number): ArrayBuffer {\n return this.handle.getMappedRange(offset, size);\n }\n\n unmap(): void {\n this.handle.unmap();\n }\n}\n"],"mappings":"AACA,SAAQA,MAAM,QAAoB,eAAe;AAGjD,SAASC,aAAaA,CAACC,KAAkB,EAAU;EAAA,IAAAC,WAAA;EACjD,OAAOD,KAAK,CAACE,UAAU,MAAAD,WAAA,GAAID,KAAK,CAACG,IAAI,cAAAF,WAAA,uBAAVA,WAAA,CAAYC,UAAU,KAAI,CAAC;AACxD;AAEA,OAAO,MAAME,YAAY,SAASN,MAAM,CAAC;EAKvCO,WAAWA,CAACC,MAAoB,EAAEN,KAAkB,EAAE;IACpD,KAAK,CAACM,MAAM,EAAEN,KAAK,CAAC;IAAC,KALdM,MAAM;IAAA,KACNC,MAAM;IAAA,KACNL,UAAU;IAIjB,IAAI,CAACI,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACJ,UAAU,GAAGH,aAAa,CAACC,KAAK,CAAC;IACtC,MAAMQ,SAAS,GAAGC,OAAO,CAACT,KAAK,CAACG,IAAI,CAAC;IAGrC,MAAMO,IAAI,GAAGC,IAAI,CAACC,IAAI,CAAC,IAAI,CAACV,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC;IAE/C,IAAI,CAACK,MAAM,GAAG,IAAI,CAACP,KAAK,CAACO,MAAM,IAAI,IAAI,CAACD,MAAM,CAACC,MAAM,CAACM,YAAY,CAAC;MACjEH,IAAI;MAEJI,KAAK,EAAE,IAAI,CAACd,KAAK,CAACc,KAAK,IAAKC,cAAc,CAACC,MAAM,GAAGD,cAAc,CAACE,QAAS;MAC5EC,gBAAgB,EAAE,IAAI,CAAClB,KAAK,CAACkB,gBAAgB,IAAIV,SAAS;MAC1DW,KAAK,EAAE,IAAI,CAACnB,KAAK,CAACoB;IACpB,CAAC,CAAC;IAEF,IAAIpB,KAAK,CAACG,IAAI,EAAE;MACd,IAAI,CAACkB,YAAY,CAACrB,KAAK,CAACG,IAAI,CAAC;IAE/B;IAEA,IAAIK,SAAS,IAAI,CAACR,KAAK,CAACkB,gBAAgB,EAAE;MACxC,IAAI,CAACX,MAAM,CAACe,KAAK,CAAC,CAAC;IACrB;EACF;EAESC,OAAOA,CAAA,EAAS;IACvB,IAAI,CAAChB,MAAM,CAACgB,OAAO,CAAC,CAAC;EACvB;EAGSC,KAAKA,CAACrB,IAAqB,EAAkB;IAAA,IAAhBsB,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAClD,IAAI,CAACpB,MAAM,CAACC,MAAM,CAACsB,KAAK,CAACC,WAAW,CAClC,IAAI,CAACvB,MAAM,EACXkB,UAAU,EACVtB,IAAI,CAAC4B,MAAM,EACX5B,IAAI,CAACsB,UAAU,EACftB,IAAI,CAACD,UACP,CAAC;EACH;EAEA,MAAe8B,SAASA,CAAA,EAAoF;IAAA,IAAnFP,UAAkB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAExB,UAAkB,GAAAwB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI,CAACxB,UAAU;IAEnF,MAAM+B,UAAU,GAAG,IAAI7B,YAAY,CAAC,IAAI,CAACE,MAAM,EAAE;MAACQ,KAAK,EAAEhB,MAAM,CAACoC,QAAQ,GAAGpC,MAAM,CAACmB,QAAQ;MAAEf;IAAU,CAAC,CAAC;IAIxG,MAAMiC,cAAc,GAAG,IAAI,CAAC7B,MAAM,CAACC,MAAM,CAAC6B,oBAAoB,CAAC,CAAC;IAChED,cAAc,CAACE,kBAAkB,CAAC,IAAI,CAAC9B,MAAM,EAAEkB,UAAU,EAAEQ,UAAU,CAAC1B,MAAM,EAAE,CAAC,EAAEL,UAAU,CAAC;IAC5F,IAAI,CAACI,MAAM,CAACC,MAAM,CAACsB,KAAK,CAACS,MAAM,CAAC,CAACH,cAAc,CAACI,MAAM,CAAC,CAAC,CAAC,CAAC;IAG1D,MAAMN,UAAU,CAAC1B,MAAM,CAACiC,QAAQ,CAACC,UAAU,CAACC,IAAI,EAAEjB,UAAU,EAAEvB,UAAU,CAAC;IACzE,MAAMyC,WAAW,GAAGV,UAAU,CAAC1B,MAAM,CAACqC,cAAc,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC;IAC/DZ,UAAU,CAAC1B,MAAM,CAACe,KAAK,CAAC,CAAC;IACzBW,UAAU,CAACV,OAAO,CAAC,CAAC;IAEpB,OAAO,IAAIuB,UAAU,CAACH,WAAW,CAAC;EACpC;EAEAtB,YAAYA,CAAa0B,UAAsB,EAAQ;IACrD,MAAMJ,WAAW,GAAG,IAAI,CAACpC,MAAM,CAACqC,cAAc,CAAC,CAAC;IAEhD,IAAIG,UAAU,CAAC1C,WAAW,CAACsC,WAAW,CAAC,CAACK,GAAG,CAACD,UAAU,CAAC;EACzD;EAIAP,QAAQA,CAACS,IAAY,EAAoD;IAAA,IAAlDC,MAAc,GAAAxB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEhB,IAAa,GAAAgB,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IACtD,OAAO,IAAI,CAACrB,MAAM,CAACiC,QAAQ,CAACS,IAAI,EAAEC,MAAM,EAAExC,IAAI,CAAC;EACjD;EAEAkC,cAAcA,CAAA,EAAiD;IAAA,IAAhDM,MAAc,GAAAxB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEhB,IAAa,GAAAgB,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAC9C,OAAO,IAAI,CAACrB,MAAM,CAACqC,cAAc,CAACM,MAAM,EAAExC,IAAI,CAAC;EACjD;EAEAY,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACf,MAAM,CAACe,KAAK,CAAC,CAAC;EACrB;AACF"}
|
|
1
|
+
{"version":3,"file":"webgpu-buffer.js","names":["Buffer","getByteLength","props","_props$data","byteLength","data","WebGPUBuffer","constructor","device","handle","mapBuffer","Boolean","size","Math","ceil","createBuffer","usage","GPUBufferUsage","VERTEX","COPY_DST","mappedAtCreation","label","id","_writeMapped","unmap","destroy","write","byteOffset","arguments","length","undefined","queue","writeBuffer","buffer","readAsync","tempBuffer","MAP_READ","commandEncoder","createCommandEncoder","copyBufferToBuffer","submit","finish","mapAsync","GPUMapMode","READ","arrayBuffer","getMappedRange","slice","Uint8Array","typedArray","set","mode","offset"],"sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"sourcesContent":["// WEBGPU Buffer implementation\nimport {Buffer, BufferProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nfunction getByteLength(props: BufferProps): number {\n return props.byteLength || props.data?.byteLength || 0;\n}\n\nexport class WebGPUBuffer extends Buffer {\n readonly device: WebGPUDevice;\n readonly handle: GPUBuffer;\n readonly byteLength: number;\n\n constructor(device: WebGPUDevice, props: BufferProps) {\n super(device, props);\n this.device = device;\n\n this.byteLength = getByteLength(props);\n const mapBuffer = Boolean(props.data);\n\n // WebGPU buffers must be aligned to 4 bytes\n const size = Math.ceil(this.byteLength / 4) * 4;\n\n this.handle = this.props.handle || this.device.handle.createBuffer({\n size,\n // usage defaults to vertex\n usage: this.props.usage || (GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST),\n mappedAtCreation: this.props.mappedAtCreation || mapBuffer,\n label: this.props.id\n });\n\n if (props.data) {\n this._writeMapped(props.data);\n // this.handle.writeAsync({data: props.data, map: false, unmap: false});\n }\n\n if (mapBuffer && !props.mappedAtCreation) {\n this.handle.unmap();\n }\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n\n // WebGPU provides multiple ways to write a buffer...\n override write(data: ArrayBufferView, byteOffset = 0) {\n this.device.handle.queue.writeBuffer(\n this.handle,\n byteOffset,\n data.buffer,\n data.byteOffset,\n data.byteLength\n );\n }\n\n override async readAsync(byteOffset: number = 0, byteLength: number = this.byteLength): Promise<Uint8Array> {\n // We need MAP_READ flag, but only COPY_DST buffers can have MAP_READ flag, so we need to create a temp buffer\n const tempBuffer = new WebGPUBuffer(this.device, {usage: Buffer.MAP_READ | Buffer.COPY_DST, byteLength});\n\n // Now do a GPU-side copy into the temp buffer we can actually read.\n // TODO - we are spinning up an independent command queue here, what does this mean\n const commandEncoder = this.device.handle.createCommandEncoder();\n commandEncoder.copyBufferToBuffer(this.handle, byteOffset, tempBuffer.handle, 0, byteLength);\n this.device.handle.queue.submit([commandEncoder.finish()]);\n\n // Map the temp buffer and read the data.\n await tempBuffer.handle.mapAsync(GPUMapMode.READ, byteOffset, byteLength);\n const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);\n tempBuffer.handle.unmap();\n tempBuffer.destroy();\n\n return new Uint8Array(arrayBuffer);\n }\n\n _writeMapped<TypedArray>(typedArray: TypedArray): void {\n const arrayBuffer = this.handle.getMappedRange();\n // @ts-expect-error\n new typedArray.constructor(arrayBuffer).set(typedArray);\n }\n\n // WEBGPU API\n\n mapAsync(mode: number, offset: number = 0, size?: number): Promise<void> {\n return this.handle.mapAsync(mode, offset, size);\n }\n\n getMappedRange(offset: number = 0, size?: number): ArrayBuffer {\n return this.handle.getMappedRange(offset, size);\n }\n\n unmap(): void {\n this.handle.unmap();\n }\n}\n\n/*\n// Convenience API\n /** Read data from the buffer *\n async readAsync(options: {\n byteOffset?: number,\n byteLength?: number,\n map?: boolean,\n unmap?: boolean\n }): Promise<ArrayBuffer> {\n if (options.map ?? true) {\n await this.mapAsync(Buffer.MAP_READ, options.byteOffset, options.byteLength);\n }\n const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);\n if (options.unmap ?? true) {\n this.unmap();\n }\n return arrayBuffer;\n }\n\n /** Write data to the buffer *\n async writeAsync(options: {\n data: ArrayBuffer,\n byteOffset?: number,\n byteLength?: number,\n map?: boolean,\n unmap?: boolean\n }): Promise<void> {\n if (options.map ?? true) {\n await this.mapAsync(Buffer.MAP_WRITE, options.byteOffset, options.byteLength);\n }\n const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);\n const destArray = new Uint8Array(arrayBuffer);\n const srcArray = new Uint8Array(options.data);\n destArray.set(srcArray);\n if (options.unmap ?? true) {\n this.unmap();\n }\n }\n */\n\n// Mapped API (WebGPU)\n\n/** Maps the memory so that it can be read *\n // abstract mapAsync(mode, byteOffset, byteLength): Promise<void>\n\n /** Get the mapped range of data for reading or writing *\n // abstract getMappedRange(byteOffset, byteLength): ArrayBuffer;\n\n /** unmap makes the contents of the buffer available to the GPU again *\n // abstract unmap(): void;\n*/\n"],"mappings":"AACA,SAAQA,MAAM,QAAoB,eAAe;AAGjD,SAASC,aAAaA,CAACC,KAAkB,EAAU;EAAA,IAAAC,WAAA;EACjD,OAAOD,KAAK,CAACE,UAAU,MAAAD,WAAA,GAAID,KAAK,CAACG,IAAI,cAAAF,WAAA,uBAAVA,WAAA,CAAYC,UAAU,KAAI,CAAC;AACxD;AAEA,OAAO,MAAME,YAAY,SAASN,MAAM,CAAC;EAKvCO,WAAWA,CAACC,MAAoB,EAAEN,KAAkB,EAAE;IACpD,KAAK,CAACM,MAAM,EAAEN,KAAK,CAAC;IAAC,KALdM,MAAM;IAAA,KACNC,MAAM;IAAA,KACNL,UAAU;IAIjB,IAAI,CAACI,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACJ,UAAU,GAAGH,aAAa,CAACC,KAAK,CAAC;IACtC,MAAMQ,SAAS,GAAGC,OAAO,CAACT,KAAK,CAACG,IAAI,CAAC;IAGrC,MAAMO,IAAI,GAAGC,IAAI,CAACC,IAAI,CAAC,IAAI,CAACV,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC;IAE/C,IAAI,CAACK,MAAM,GAAG,IAAI,CAACP,KAAK,CAACO,MAAM,IAAI,IAAI,CAACD,MAAM,CAACC,MAAM,CAACM,YAAY,CAAC;MACjEH,IAAI;MAEJI,KAAK,EAAE,IAAI,CAACd,KAAK,CAACc,KAAK,IAAKC,cAAc,CAACC,MAAM,GAAGD,cAAc,CAACE,QAAS;MAC5EC,gBAAgB,EAAE,IAAI,CAAClB,KAAK,CAACkB,gBAAgB,IAAIV,SAAS;MAC1DW,KAAK,EAAE,IAAI,CAACnB,KAAK,CAACoB;IACpB,CAAC,CAAC;IAEF,IAAIpB,KAAK,CAACG,IAAI,EAAE;MACd,IAAI,CAACkB,YAAY,CAACrB,KAAK,CAACG,IAAI,CAAC;IAE/B;IAEA,IAAIK,SAAS,IAAI,CAACR,KAAK,CAACkB,gBAAgB,EAAE;MACxC,IAAI,CAACX,MAAM,CAACe,KAAK,CAAC,CAAC;IACrB;EACF;EAESC,OAAOA,CAAA,EAAS;IACvB,IAAI,CAAChB,MAAM,CAACgB,OAAO,CAAC,CAAC;EACvB;EAGSC,KAAKA,CAACrB,IAAqB,EAAkB;IAAA,IAAhBsB,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAClD,IAAI,CAACpB,MAAM,CAACC,MAAM,CAACsB,KAAK,CAACC,WAAW,CAClC,IAAI,CAACvB,MAAM,EACXkB,UAAU,EACVtB,IAAI,CAAC4B,MAAM,EACX5B,IAAI,CAACsB,UAAU,EACftB,IAAI,CAACD,UACP,CAAC;EACH;EAEA,MAAe8B,SAASA,CAAA,EAAoF;IAAA,IAAnFP,UAAkB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAExB,UAAkB,GAAAwB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI,CAACxB,UAAU;IAEnF,MAAM+B,UAAU,GAAG,IAAI7B,YAAY,CAAC,IAAI,CAACE,MAAM,EAAE;MAACQ,KAAK,EAAEhB,MAAM,CAACoC,QAAQ,GAAGpC,MAAM,CAACmB,QAAQ;MAAEf;IAAU,CAAC,CAAC;IAIxG,MAAMiC,cAAc,GAAG,IAAI,CAAC7B,MAAM,CAACC,MAAM,CAAC6B,oBAAoB,CAAC,CAAC;IAChED,cAAc,CAACE,kBAAkB,CAAC,IAAI,CAAC9B,MAAM,EAAEkB,UAAU,EAAEQ,UAAU,CAAC1B,MAAM,EAAE,CAAC,EAAEL,UAAU,CAAC;IAC5F,IAAI,CAACI,MAAM,CAACC,MAAM,CAACsB,KAAK,CAACS,MAAM,CAAC,CAACH,cAAc,CAACI,MAAM,CAAC,CAAC,CAAC,CAAC;IAG1D,MAAMN,UAAU,CAAC1B,MAAM,CAACiC,QAAQ,CAACC,UAAU,CAACC,IAAI,EAAEjB,UAAU,EAAEvB,UAAU,CAAC;IACzE,MAAMyC,WAAW,GAAGV,UAAU,CAAC1B,MAAM,CAACqC,cAAc,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC;IAC/DZ,UAAU,CAAC1B,MAAM,CAACe,KAAK,CAAC,CAAC;IACzBW,UAAU,CAACV,OAAO,CAAC,CAAC;IAEpB,OAAO,IAAIuB,UAAU,CAACH,WAAW,CAAC;EACpC;EAEAtB,YAAYA,CAAa0B,UAAsB,EAAQ;IACrD,MAAMJ,WAAW,GAAG,IAAI,CAACpC,MAAM,CAACqC,cAAc,CAAC,CAAC;IAEhD,IAAIG,UAAU,CAAC1C,WAAW,CAACsC,WAAW,CAAC,CAACK,GAAG,CAACD,UAAU,CAAC;EACzD;EAIAP,QAAQA,CAACS,IAAY,EAAoD;IAAA,IAAlDC,MAAc,GAAAxB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEhB,IAAa,GAAAgB,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IACtD,OAAO,IAAI,CAACrB,MAAM,CAACiC,QAAQ,CAACS,IAAI,EAAEC,MAAM,EAAExC,IAAI,CAAC;EACjD;EAEAkC,cAAcA,CAAA,EAAiD;IAAA,IAAhDM,MAAc,GAAAxB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEhB,IAAa,GAAAgB,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAC9C,OAAO,IAAI,CAACrB,MAAM,CAACqC,cAAc,CAACM,MAAM,EAAExC,IAAI,CAAC;EACjD;EAEAY,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACf,MAAM,CAACe,KAAK,CAAC,CAAC;EACrB;AACF"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -962,14 +962,20 @@ var __exports__ = (() => {
|
|
|
962
962
|
this.usage = props.usage || 0;
|
|
963
963
|
this.indexType = deducedProps.indexType;
|
|
964
964
|
}
|
|
965
|
-
|
|
965
|
+
readSyncWebGL2(byteOffset, byteLength) {
|
|
966
966
|
throw new Error("not implemented");
|
|
967
967
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
968
|
+
debugData = new ArrayBuffer(0);
|
|
969
|
+
_setDebugData(data, byteOffset, byteLength) {
|
|
970
|
+
const buffer = ArrayBuffer.isView(data) ? data.buffer : data;
|
|
971
|
+
const debugDataLength = Math.min(data ? data.byteLength : byteLength, _Buffer.DEBUG_DATA_MAX_LENGTH);
|
|
972
|
+
if (data === null) {
|
|
973
|
+
this.debugData = new ArrayBuffer(debugDataLength);
|
|
974
|
+
} else if (byteOffset === 0 && byteLength === data.byteLength) {
|
|
975
|
+
this.debugData = buffer.slice(0, debugDataLength);
|
|
976
|
+
} else {
|
|
977
|
+
this.debugData = buffer.slice(byteOffset, byteOffset + debugDataLength);
|
|
978
|
+
}
|
|
973
979
|
}
|
|
974
980
|
};
|
|
975
981
|
var Buffer2 = _Buffer;
|
|
@@ -992,6 +998,7 @@ var __exports__ = (() => {
|
|
|
992
998
|
__publicField(Buffer2, "STORAGE", 128);
|
|
993
999
|
__publicField(Buffer2, "INDIRECT", 256);
|
|
994
1000
|
__publicField(Buffer2, "QUERY_RESOLVE", 512);
|
|
1001
|
+
__publicField(Buffer2, "DEBUG_DATA_MAX_LENGTH", 32);
|
|
995
1002
|
|
|
996
1003
|
// ../core/src/adapter/device.ts
|
|
997
1004
|
var _Device = class {
|
package/dist.min.js
CHANGED
|
@@ -4,28 +4,28 @@
|
|
|
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
|
-
var __exports__=(()=>{var Nt=Object.defineProperty;var Zo=Object.getOwnPropertyDescriptor;var Jo=Object.getOwnPropertyNames;var Qo=Object.prototype.hasOwnProperty;var ei=(e,t)=>{for(var r in t)Nt(e,r,{get:t[r],enumerable:!0})},ti=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Jo(t))!Qo.call(e,o)&&o!==r&&Nt(e,o,{get:()=>t[o],enumerable:!(n=Zo(t,o))||n.enumerable});return e};var ri=e=>ti(Nt({},"__esModule",{value:!0}),e);var yl={};ei(yl,{WebGPUBuffer:()=>wt,WebGPUDevice:()=>mr,WebGPUSampler:()=>K,WebGPUShader:()=>jt,WebGPUTexture:()=>Pt});function Le(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 M(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Le()}var ni=globalThis.self||globalThis.window||globalThis.global,oe=globalThis.window||globalThis.self||globalThis.global,oi=globalThis.document||{},Z=globalThis.process||{},ii=globalThis.console,vr=globalThis.navigator||{};var He=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Ol=M();var Gt=globalThis;function Ke(e){if(!e&&!M())return"Node";if(Le(e))return"Electron";let t=e||vr.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":Gt.chrome?"Chrome":Gt.safari?"Safari":Gt.mozInnerScreenX?"Firefox":"Unknown"}function ai(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var $e=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=ai(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 br(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 Ye(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let i=e.width*r,a=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(a/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(a,"px;"),"background:url(".concat(o,");"),"background-size:".concat(i,"px ").concat(a,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}var qe;(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"})(qe||(qe={}));var ui=10;function wr(e){return typeof e!="string"?e:(e=e.toUpperCase(),qe[e]||qe.WHITE)}function _r(e,t,r){if(!M&&typeof e=="string"){if(t){let n=wr(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=wr(r);e="\x1B[".concat(n+ui,"m").concat(e,"\x1B[49m")}}return e}function Or(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),o=e;for(let i of n){let a=o[i];typeof a=="function"&&(t.find(s=>i===s)||(o[i]=a.bind(e)))}}function ie(e,t){if(!e)throw new Error(t||"Assertion failed")}function J(){let e;if(M()&&oe.performance){var t,r;e=oe===null||oe===void 0||(t=oe.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in Z){var n;let o=Z===null||Z===void 0||(n=Z.hrtime)===null||n===void 0?void 0:n.call(Z);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var ae={debug:M()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},fi={enabled:!0,level:0};function H(){}var Pr={},Sr={once:!0},q=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=He,this._startTs=J(),this._deltaTs=J(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new $e("__probe-".concat(this.id,"__"),fi),this.timeStamp("".concat(this.id," started")),Or(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((J()-this._startTs).toPrecision(10))}getDelta(){return Number((J()-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){ie(t,r)}warn(t){return this._getLogFunction(0,t,ae.warn,arguments,Sr)}error(t){return this._getLogFunction(0,t,ae.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,ae.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,ae.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,ae.debug||ae.info,arguments,Sr)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||H,n&&[n],{tag:pi(r)}):H}image(t){let{logLevel:r,priority:n,image:o,message:i="",scale:a=1}=t;return this._shouldLog(r||n)?M()?li({image:o,message:i,scale:a}):si({image:o,message:i,scale:a}):H}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||H)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=Tr({logLevel:t,message:r,opts:n}),{collapsed:i}=n;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}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||H)}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()>=jr(t)}_getLogFunction(t,r,n,o,i){if(this._shouldLog(t)){i=Tr({logLevel:t,message:r,args:o,opts:i}),n=n||i.method,ie(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=J();let a=i.tag||i.message;if(i.once&&a)if(!Pr[a])Pr[a]=J();else return H;return r=ci(this.id,i.message,i),n.bind(console,r,...i.args)}return H}};q.VERSION=He;function jr(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 ie(Number.isFinite(t)&&t>=0),t}function Tr(e){let{logLevel:t,message:r}=e;e.logLevel=jr(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 o=typeof e.message;return ie(o==="string"||o==="object"),Object.assign(e,{args:n},e.opts)}function ci(e,t,r){if(typeof t=="string"){let n=r.time?gr(br(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=_r(t,r.color,r.background)}return t}function si(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),H}function li(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let a=Ye(i,r,n);console.log(...a)},i.src=t,H}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...Ye(t,r,n)),H;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Ye(i,r,n)),i.src=t.toDataURL(),H}return H}function pi(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var Ql=new q({id:"@probe.gl/log"});var S=new q({id:"luma.gl"});function De(){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 Q=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=De(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(De()-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 ue=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,o=this.stats[r];return o||(t instanceof Q?o=t:o=new Q(r,n),this.stats[r]=o),o}};function Ne(e){return Ne=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},Ne(e)}function Er(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,di(n.key),n)}}function hi(e,t,r){return t&&Er(e.prototype,t),r&&Er(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function di(e){var t=yi(e,"string");return Ne(t)==="symbol"?t:String(t)}function yi(e,t){if(Ne(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ne(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var vi=function(){function e(){mi(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 ue({id:n})),this.stats.get(n)},hi(e)}(),Xe=new vi;function bi(){var e=typeof __VERSION__<"u"?__VERSION__:"running from 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||(M()&&S.log(1,"".concat(e," - ").concat(t))(),globalThis.luma=globalThis.luma||{VERSION:e,version:e,log:S,stats:Xe}),e}var xr=bi();var Ct={};function Y(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";Ct[e]=Ct[e]||1;var t=Ct[e]++;return"".concat(e,"-").concat(t)}function Ze(e){var t=!0;for(var r in e){t=!1;break}return t}function Ge(e){return Ge=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},Ge(e)}function Rr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function gi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rr(Object(r),!0).forEach(function(n){wi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wi(e,t,r){return t=Ir(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ar(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,Ir(n.key),n)}}function _i(e,t,r){return t&&Ar(e.prototype,t),r&&Ar(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ir(e){var t=Oi(e,"string");return Ge(t)==="symbol"?t:String(t)}function Oi(e,t){if(Ge(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ge(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var E=function(){function e(r,n,o){if(Pi(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=Si(n,o);var i=this.props.id!=="undefined"?this.props.id:Y(this[Symbol.toStringTag]);this.props.id=i,this.id=i,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,o=Object.values(this._attachedResources);n<o.length;n++){var i=o[n];i.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"),o=this[Symbol.toStringTag];n.get("".concat(o,"s Active")).decrementCount()},t.trackAllocatedMemory=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(n),i.get("".concat(o," Memory")).addCount(n),this.allocatedBytes=n},t.trackDeallocatedMemory=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").subtractCount(this.allocatedBytes),o.get("".concat(n," Memory")).subtractCount(this.allocatedBytes),this.allocatedBytes=0},t.addStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),o=this[Symbol.toStringTag];n.get("Resources Created").incrementCount(),n.get("".concat(o,"s Created")).incrementCount(),n.get("".concat(o,"s Active")).incrementCount()},_i(e)}();E.defaultProps={id:"undefined",handle:void 0,userData:void 0};function Si(e,t){var r=gi({},t);for(var n in e)e[n]!==void 0&&(r[n]=e[n]);return r}function fe(e){return fe=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},fe(e)}var Dr;function Br(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function kt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Br(Object(r),!0).forEach(function(n){Ti(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Br(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ti(e,t,r){return t=Nr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ji(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lr(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,Nr(n.key),n)}}function Ei(e,t,r){return t&&Lr(e.prototype,t),r&&Lr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nr(e){var t=xi(e,"string");return fe(t)==="symbol"?t:String(t)}function xi(e,t){if(fe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(fe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ri(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&&Mt(e,t)}function Mt(e,t){return Mt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Mt(e,t)}function Ai(e){var t=Li();return function(){var n=Je(e),o;if(t){var i=Je(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Ii(this,o)}}function Ii(e,t){if(t&&(fe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bi(e)}function Bi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Li(){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}}function Je(e){return Je=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Je(e)}Dr=Symbol.toStringTag;var C=function(e){Ri(r,e);var t=Ai(r);function r(o,i){var a;ji(this,r);var s=kt({},i);return(i.usage||0)&r.INDEX&&!i.indexType&&(i.data instanceof Uint32Array?s.indexType="uint32":i.data instanceof Uint16Array&&(s.indexType="uint16")),a=t.call(this,o,s,r.defaultProps),a.usage=void 0,a.indexType=void 0,a.byteLength=void 0,a.usage=i.usage||0,a.indexType=s.indexType,a}var n=r.prototype;return n.write=function(i,a){throw new Error("not implemented")},n.readAsync=function(i,a){throw new Error("not implemented")},n.getData=function(){throw new Error("not implemented")},Ei(r,[{key:Dr,get:function(){return"Buffer"}}]),r}(E);C.defaultProps=kt(kt({},E.defaultProps),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});C.MAP_READ=1;C.MAP_WRITE=2;C.COPY_SRC=4;C.COPY_DST=8;C.INDEX=16;C.VERTEX=32;C.UNIFORM=64;C.STORAGE=128;C.INDIRECT=256;C.QUERY_RESOLVE=512;function Ce(e){return Ce=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},Ce(e)}var kr;function Gr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ut(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Gr(Object(r),!0).forEach(function(n){Di(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Di(e,t,r){return t=Mr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ni(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cr(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,Mr(n.key),n)}}function Gi(e,t,r){return t&&Cr(e.prototype,t),r&&Cr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mr(e){var t=Ci(e,"string");return Ce(t)==="symbol"?t:String(t)}function Ci(e,t){if(Ce(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ce(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}kr=Symbol.toStringTag;var ke=function(){function e(r){Ni(this,e),this.id=void 0,this.statsManager=Xe,this.props=void 0,this.userData={},this._lumaData={},this.info=void 0,this.lost=void 0,this.canvasContext=void 0,this.props=Ut(Ut({},e.defaultProps),r),this.id=this.props.id||Y(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 o=Ut({},n);return(n.usage||0)&C.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?o.indexType="uint32":n.data instanceof Uint16Array?o.indexType="uint16":S.warn("indices buffer content must be of integer type")()),o},Gi(e,[{key:kr,get:function(){return"Device"}}]),e}();ke.defaultProps={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(S.get("debug")),break:[],gl:null};ke.VERSION=xr;function Me(e){return Me=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},Me(e)}function Qe(e,t){return Ui(e)||Mi(e,t)||Kr(e,t)||ki()}function ki(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
7
|
+
var __exports__=(()=>{var Nt=Object.defineProperty;var Zo=Object.getOwnPropertyDescriptor;var Jo=Object.getOwnPropertyNames;var Qo=Object.prototype.hasOwnProperty;var ei=(e,t)=>{for(var r in t)Nt(e,r,{get:t[r],enumerable:!0})},ti=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Jo(t))!Qo.call(e,o)&&o!==r&&Nt(e,o,{get:()=>t[o],enumerable:!(n=Zo(t,o))||n.enumerable});return e};var ri=e=>ti(Nt({},"__esModule",{value:!0}),e);var yl={};ei(yl,{WebGPUBuffer:()=>wt,WebGPUDevice:()=>mr,WebGPUSampler:()=>K,WebGPUShader:()=>jt,WebGPUTexture:()=>Pt});function Le(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 M(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Le()}var ni=globalThis.self||globalThis.window||globalThis.global,oe=globalThis.window||globalThis.self||globalThis.global,oi=globalThis.document||{},Z=globalThis.process||{},ii=globalThis.console,vr=globalThis.navigator||{};var He=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Ol=M();var Gt=globalThis;function Ke(e){if(!e&&!M())return"Node";if(Le(e))return"Electron";let t=e||vr.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":Gt.chrome?"Chrome":Gt.safari?"Safari":Gt.mozInnerScreenX?"Firefox":"Unknown"}function ai(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var $e=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=ai(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 br(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 Ye(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let i=e.width*r,a=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(a/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(a,"px;"),"background:url(".concat(o,");"),"background-size:".concat(i,"px ").concat(a,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}var Xe;(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"})(Xe||(Xe={}));var ui=10;function wr(e){return typeof e!="string"?e:(e=e.toUpperCase(),Xe[e]||Xe.WHITE)}function _r(e,t,r){if(!M&&typeof e=="string"){if(t){let n=wr(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=wr(r);e="\x1B[".concat(n+ui,"m").concat(e,"\x1B[49m")}}return e}function Or(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),o=e;for(let i of n){let a=o[i];typeof a=="function"&&(t.find(s=>i===s)||(o[i]=a.bind(e)))}}function ie(e,t){if(!e)throw new Error(t||"Assertion failed")}function J(){let e;if(M()&&oe.performance){var t,r;e=oe===null||oe===void 0||(t=oe.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in Z){var n;let o=Z===null||Z===void 0||(n=Z.hrtime)===null||n===void 0?void 0:n.call(Z);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var ae={debug:M()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},fi={enabled:!0,level:0};function H(){}var Pr={},Sr={once:!0},X=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=He,this._startTs=J(),this._deltaTs=J(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new $e("__probe-".concat(this.id,"__"),fi),this.timeStamp("".concat(this.id," started")),Or(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((J()-this._startTs).toPrecision(10))}getDelta(){return Number((J()-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){ie(t,r)}warn(t){return this._getLogFunction(0,t,ae.warn,arguments,Sr)}error(t){return this._getLogFunction(0,t,ae.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,ae.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,ae.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,ae.debug||ae.info,arguments,Sr)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||H,n&&[n],{tag:pi(r)}):H}image(t){let{logLevel:r,priority:n,image:o,message:i="",scale:a=1}=t;return this._shouldLog(r||n)?M()?li({image:o,message:i,scale:a}):si({image:o,message:i,scale:a}):H}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||H)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=Tr({logLevel:t,message:r,opts:n}),{collapsed:i}=n;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}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||H)}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()>=jr(t)}_getLogFunction(t,r,n,o,i){if(this._shouldLog(t)){i=Tr({logLevel:t,message:r,args:o,opts:i}),n=n||i.method,ie(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=J();let a=i.tag||i.message;if(i.once&&a)if(!Pr[a])Pr[a]=J();else return H;return r=ci(this.id,i.message,i),n.bind(console,r,...i.args)}return H}};X.VERSION=He;function jr(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 ie(Number.isFinite(t)&&t>=0),t}function Tr(e){let{logLevel:t,message:r}=e;e.logLevel=jr(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 o=typeof e.message;return ie(o==="string"||o==="object"),Object.assign(e,{args:n},e.opts)}function ci(e,t,r){if(typeof t=="string"){let n=r.time?gr(br(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=_r(t,r.color,r.background)}return t}function si(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),H}function li(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let a=Ye(i,r,n);console.log(...a)},i.src=t,H}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...Ye(t,r,n)),H;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Ye(i,r,n)),i.src=t.toDataURL(),H}return H}function pi(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var Ql=new X({id:"@probe.gl/log"});var S=new X({id:"luma.gl"});function De(){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 Q=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=De(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(De()-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 ue=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,o=this.stats[r];return o||(t instanceof Q?o=t:o=new Q(r,n),this.stats[r]=o),o}};function Ne(e){return Ne=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},Ne(e)}function Er(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,di(n.key),n)}}function hi(e,t,r){return t&&Er(e.prototype,t),r&&Er(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function di(e){var t=yi(e,"string");return Ne(t)==="symbol"?t:String(t)}function yi(e,t){if(Ne(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ne(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var vi=function(){function e(){mi(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 ue({id:n})),this.stats.get(n)},hi(e)}(),qe=new vi;function bi(){var e=typeof __VERSION__<"u"?__VERSION__:"running from 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||(M()&&S.log(1,"".concat(e," - ").concat(t))(),globalThis.luma=globalThis.luma||{VERSION:e,version:e,log:S,stats:qe}),e}var xr=bi();var Ct={};function Y(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";Ct[e]=Ct[e]||1;var t=Ct[e]++;return"".concat(e,"-").concat(t)}function Ze(e){var t=!0;for(var r in e){t=!1;break}return t}function Ge(e){return Ge=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},Ge(e)}function Rr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function gi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rr(Object(r),!0).forEach(function(n){wi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wi(e,t,r){return t=Ir(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ar(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,Ir(n.key),n)}}function _i(e,t,r){return t&&Ar(e.prototype,t),r&&Ar(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ir(e){var t=Oi(e,"string");return Ge(t)==="symbol"?t:String(t)}function Oi(e,t){if(Ge(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ge(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var E=function(){function e(r,n,o){if(Pi(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=Si(n,o);var i=this.props.id!=="undefined"?this.props.id:Y(this[Symbol.toStringTag]);this.props.id=i,this.id=i,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,o=Object.values(this._attachedResources);n<o.length;n++){var i=o[n];i.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"),o=this[Symbol.toStringTag];n.get("".concat(o,"s Active")).decrementCount()},t.trackAllocatedMemory=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(n),i.get("".concat(o," Memory")).addCount(n),this.allocatedBytes=n},t.trackDeallocatedMemory=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").subtractCount(this.allocatedBytes),o.get("".concat(n," Memory")).subtractCount(this.allocatedBytes),this.allocatedBytes=0},t.addStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),o=this[Symbol.toStringTag];n.get("Resources Created").incrementCount(),n.get("".concat(o,"s Created")).incrementCount(),n.get("".concat(o,"s Active")).incrementCount()},_i(e)}();E.defaultProps={id:"undefined",handle:void 0,userData:void 0};function Si(e,t){var r=gi({},t);for(var n in e)e[n]!==void 0&&(r[n]=e[n]);return r}function fe(e){return fe=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},fe(e)}var Dr;function Br(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function kt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Br(Object(r),!0).forEach(function(n){Ti(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Br(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ti(e,t,r){return t=Nr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ji(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lr(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,Nr(n.key),n)}}function Ei(e,t,r){return t&&Lr(e.prototype,t),r&&Lr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nr(e){var t=xi(e,"string");return fe(t)==="symbol"?t:String(t)}function xi(e,t){if(fe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(fe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ri(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&&Mt(e,t)}function Mt(e,t){return Mt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Mt(e,t)}function Ai(e){var t=Li();return function(){var n=Je(e),o;if(t){var i=Je(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Ii(this,o)}}function Ii(e,t){if(t&&(fe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bi(e)}function Bi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Li(){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}}function Je(e){return Je=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Je(e)}Dr=Symbol.toStringTag;var G=function(e){Ri(r,e);var t=Ai(r);function r(o,i){var a;ji(this,r);var s=kt({},i);return(i.usage||0)&r.INDEX&&!i.indexType&&(i.data instanceof Uint32Array?s.indexType="uint32":i.data instanceof Uint16Array&&(s.indexType="uint16")),a=t.call(this,o,s,r.defaultProps),a.usage=void 0,a.indexType=void 0,a.byteLength=void 0,a.debugData=new ArrayBuffer(0),a.usage=i.usage||0,a.indexType=s.indexType,a}var n=r.prototype;return n.readSyncWebGL2=function(i,a){throw new Error("not implemented")},n._setDebugData=function(i,a,s){var c=ArrayBuffer.isView(i)?i.buffer:i,h=Math.min(i?i.byteLength:s,r.DEBUG_DATA_MAX_LENGTH);i===null?this.debugData=new ArrayBuffer(h):a===0&&s===i.byteLength?this.debugData=c.slice(0,h):this.debugData=c.slice(a,a+h)},Ei(r,[{key:Dr,get:function(){return"Buffer"}}]),r}(E);G.defaultProps=kt(kt({},E.defaultProps),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});G.MAP_READ=1;G.MAP_WRITE=2;G.COPY_SRC=4;G.COPY_DST=8;G.INDEX=16;G.VERTEX=32;G.UNIFORM=64;G.STORAGE=128;G.INDIRECT=256;G.QUERY_RESOLVE=512;G.DEBUG_DATA_MAX_LENGTH=32;function Ce(e){return Ce=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},Ce(e)}var kr;function Gr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ut(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Gr(Object(r),!0).forEach(function(n){Di(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Di(e,t,r){return t=Mr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ni(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cr(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,Mr(n.key),n)}}function Gi(e,t,r){return t&&Cr(e.prototype,t),r&&Cr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mr(e){var t=Ci(e,"string");return Ce(t)==="symbol"?t:String(t)}function Ci(e,t){if(Ce(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ce(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}kr=Symbol.toStringTag;var ke=function(){function e(r){Ni(this,e),this.id=void 0,this.statsManager=qe,this.props=void 0,this.userData={},this._lumaData={},this.info=void 0,this.lost=void 0,this.canvasContext=void 0,this.props=Ut(Ut({},e.defaultProps),r),this.id=this.props.id||Y(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 o=Ut({},n);return(n.usage||0)&G.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?o.indexType="uint32":n.data instanceof Uint16Array?o.indexType="uint16":S.warn("indices buffer content must be of integer type")()),o},Gi(e,[{key:kr,get:function(){return"Device"}}]),e}();ke.defaultProps={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(S.get("debug")),break:[],gl:null};ke.VERSION=xr;function Me(e){return Me=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},Me(e)}function Qe(e,t){return Ui(e)||Mi(e,t)||Kr(e,t)||ki()}function ki(){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 Mi(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function Ui(e){if(Array.isArray(e))return e}function Fi(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Kr(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(h){throw h},f:o}}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 i=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var h=r.next();return i=h.done,h},e:function(h){a=!0,s=h},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Kr(e,t){if(e){if(typeof e=="string")return Ur(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 Ur(e,t)}}function Ur(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 Fr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Wr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fr(Object(r),!0).forEach(function(n){Wi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wi(e,t,r){return t=$r(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zr(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,$r(n.key),n)}}function Vi(e,t,r){return t&&zr(e.prototype,t),r&&zr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $r(e){var t=Hi(e,"string");return Me(t)==="symbol"?t:String(t)}function Hi(e,t){if(Me(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Me(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ki=M()&&typeof document<"u",et=function(){return Ki&&document.readyState==="complete"},$i={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},ce=function(){function e(r){var n=this;if(zi(this,e),this.device=void 0,this.id=void 0,this.props=void 0,this.canvas=void 0,this.htmlCanvas=void 0,this.offscreenCanvas=void 0,this.type=void 0,this.width=1,this.height=1,this.resizeObserver=void 0,this._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},this.props=Wr(Wr({},$i),r),r=this.props,!M()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(r.canvas)typeof r.canvas=="string"?this.canvas=Xi(r.canvas):this.canvas=r.canvas;else{var o,i,a=Zi(r),s=qi(((o=r)===null||o===void 0?void 0:o.container)||null);s.insertBefore(a,s.firstChild),this.canvas=a,(i=r)!==null&&i!==void 0&&i.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&r.autoResize&&(this.resizeObserver=new ResizeObserver(function(c){var h=Fi(c),v;try{for(h.s();!(v=h.n()).done;){var m=v.value;m.target===n.canvas&&n.update()}}catch(g){h.e(g)}finally{h.f()}}),this.resizeObserver.observe(this.canvas))}var t=e.prototype;return t.getDevicePixelRatio=function(n){if(typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(n=n===void 0?this.props.useDevicePixels:n,!n||n<=0))return 1;if(n===!0){var o=typeof window<"u"&&window.devicePixelRatio;return o||1}return n},t.getPixelSize=function(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":var n=this.getDevicePixelRatio(),o=this.canvas;return o.parentElement?[o.clientWidth*n,o.clientHeight*n]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}},t.getAspect=function(){var n=this.getPixelSize(),o=Qe(n,2),i=o[0],a=o[1];return i/a},t.cssToDeviceRatio=function(){try{var n=this.getDrawingBufferSize(),o=Qe(n,1),i=o[0],a=this._canvasSizeInfo.clientWidth;return a?i/a:1}catch{return 1}},t.cssToDevicePixels=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=this.cssToDeviceRatio(),a=this.getDrawingBufferSize(),s=Qe(a,2),c=s[0],h=s[1];return Ji(n,i,c,h,o)},t.setDevicePixelRatio=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.htmlCanvas){var i="width"in o?o.width:this.htmlCanvas.clientWidth,a="height"in o?o.height:this.htmlCanvas.clientHeight;(!i||!a)&&(S.log(1,"Canvas clientWidth/clientHeight is 0")(),n=1,i=this.htmlCanvas.width||1,a=this.htmlCanvas.height||1);var s=this._canvasSizeInfo;if(s.clientWidth!==i||s.clientHeight!==a||s.devicePixelRatio!==n){var c=n,h=Math.floor(i*c),v=Math.floor(a*c);this.htmlCanvas.width=h,this.htmlCanvas.height=v;var m=this.getDrawingBufferSize(),g=Qe(m,2),_=g[0],O=g[1];(_!==h||O!==v)&&(c=Math.min(_/i,O/a),this.htmlCanvas.width=Math.floor(i*c),this.htmlCanvas.height=Math.floor(a*c),S.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=a,this._canvasSizeInfo.devicePixelRatio=n}}},t.getDrawingBufferSize=function(){var n=this.device.gl;if(!n)throw new Error("canvas size");return[n.drawingBufferWidth,n.drawingBufferHeight]},t._setAutoCreatedCanvasId=function(n){var o;((o=this.htmlCanvas)===null||o===void 0?void 0:o.id)==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=n)},Vi(e,null,[{key:"isPageLoaded",get:function(){return et()}}]),e}();ce.pageLoaded=Yi();function Yi(){return et()||typeof window>"u"?Promise.resolve():new Promise(function(e){window.addEventListener("load",function(){return e()})})}function qi(e){if(typeof e=="string"){var t=document.getElementById(e);if(!t&&!et())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!t)throw new Error("".concat(e," is not an HTML element"));return t}else if(e)return e;return document.body}function Xi(e){var t=document.getElementById(e);if(!t&&!et())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function Zi(e){var t=e.width,r=e.height,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?"".concat(t,"px"):"100%",n.style.height=Number.isFinite(r)?"".concat(r,"px"):"100%",n}function Ji(e,t,r,n,o){var i=e,a=Vr(i[0],t,r),s=Hr(i[1],t,n,o),c=Vr(i[0]+1,t,r),h=c===r-1?c:c-1;c=Hr(i[1]+1,t,n,o);var v;return o?(c=c===0?c:c+1,v=s,s=c):v=c===n-1?c:c-1,{x:a,y:s,width:Math.max(h-a+1,1),height:Math.max(v-s+1,1)}}function Vr(e,t,r){var n=Math.min(Math.round(e*t),r-1);return n}function Hr(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}function se(e){return se=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},se(e)}var Zr;function Yr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function qr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Yr(Object(r),!0).forEach(function(n){Qi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qi(e,t,r){return t=Jr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ea(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xr(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,Jr(n.key),n)}}function ta(e,t,r){return t&&Xr(e.prototype,t),r&&Xr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jr(e){var t=ra(e,"string");return se(t)==="symbol"?t:String(t)}function ra(e,t){if(se(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(se(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function na(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&&Ft(e,t)}function Ft(e,t){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ft(e,t)}function oa(e){var t=ua();return function(){var n=tt(e),o;if(t){var i=tt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return ia(this,o)}}function ia(e,t){if(t&&(se(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aa(e)}function aa(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ua(){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}}function tt(e){return tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},tt(e)}Zr=Symbol.toStringTag;var V=function(e){na(r,e);var t=oa(r);function r(n,o){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.defaultProps;return ea(this,r),i=t.call(this,n,o,a),i.dimension=void 0,i.format=void 0,i.width=void 0,i.height=void 0,i.depth=void 0,i.sampler=void 0,i.dimension=i.props.dimension,i.format=i.props.format,i.width=i.props.width,i.height=i.props.height,i.depth=i.props.depth,i}return ta(r,[{key:Zr,get:function(){return"Texture"}}]),r}(E);V.defaultProps=qr(qr({},E.defaultProps),{},{data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,sampler:{},compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0});V.COPY_SRC=1;V.COPY_DST=2;V.TEXTURE_BINDING=4;V.STORAGE_BINDING=8;V.RENDER_ATTACHMENT=16;function le(e){return le=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},le(e)}var rn;function Qr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).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?Qr(Object(r),!0).forEach(function(n){fa(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fa(e,t,r){return t=nn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ca(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tn(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,nn(n.key),n)}}function sa(e,t,r){return t&&tn(e.prototype,t),r&&tn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function nn(e){var t=la(e,"string");return le(t)==="symbol"?t:String(t)}function la(e,t){if(le(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(le(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pa(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&&Wt(e,t)}function Wt(e,t){return Wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Wt(e,t)}function ha(e){var t=ma();return function(){var n=rt(e),o;if(t){var i=rt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return da(this,o)}}function da(e,t){if(t&&(le(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ya(e)}function ya(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}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}}function rt(e){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},rt(e)}rn=Symbol.toStringTag;var nt=function(e){pa(r,e);var t=ha(r);function r(n,o){return ca(this,r),t.call(this,n,o,r.defaultProps)}return sa(r,[{key:rn,get:function(){return"ExternalTexture"}}]),r}(E);nt.defaultProps=en(en({},E.defaultProps),{},{source:null,colorSpace:"srgb"});function Ue(e){return Ue=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},Ue(e)}function va(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ba(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(h){throw h},f:o}}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 i=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var h=r.next();return i=h.done,h},e:function(h){a=!0,s=h},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Kr(e,t){if(e){if(typeof e=="string")return Ur(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 Ur(e,t)}}function Ur(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 Fr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Wr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fr(Object(r),!0).forEach(function(n){Wi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wi(e,t,r){return t=$r(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zr(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,$r(n.key),n)}}function Vi(e,t,r){return t&&zr(e.prototype,t),r&&zr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $r(e){var t=Hi(e,"string");return Me(t)==="symbol"?t:String(t)}function Hi(e,t){if(Me(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Me(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ki=M()&&typeof document<"u",et=function(){return Ki&&document.readyState==="complete"},$i={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},ce=function(){function e(r){var n=this;if(zi(this,e),this.device=void 0,this.id=void 0,this.props=void 0,this.canvas=void 0,this.htmlCanvas=void 0,this.offscreenCanvas=void 0,this.type=void 0,this.width=1,this.height=1,this.resizeObserver=void 0,this._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},this.props=Wr(Wr({},$i),r),r=this.props,!M()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(r.canvas)typeof r.canvas=="string"?this.canvas=qi(r.canvas):this.canvas=r.canvas;else{var o,i,a=Zi(r),s=Xi(((o=r)===null||o===void 0?void 0:o.container)||null);s.insertBefore(a,s.firstChild),this.canvas=a,(i=r)!==null&&i!==void 0&&i.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&r.autoResize&&(this.resizeObserver=new ResizeObserver(function(c){var h=Fi(c),v;try{for(h.s();!(v=h.n()).done;){var m=v.value;m.target===n.canvas&&n.update()}}catch(g){h.e(g)}finally{h.f()}}),this.resizeObserver.observe(this.canvas))}var t=e.prototype;return t.getDevicePixelRatio=function(n){if(typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(n=n===void 0?this.props.useDevicePixels:n,!n||n<=0))return 1;if(n===!0){var o=typeof window<"u"&&window.devicePixelRatio;return o||1}return n},t.getPixelSize=function(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":var n=this.getDevicePixelRatio(),o=this.canvas;return o.parentElement?[o.clientWidth*n,o.clientHeight*n]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}},t.getAspect=function(){var n=this.getPixelSize(),o=Qe(n,2),i=o[0],a=o[1];return i/a},t.cssToDeviceRatio=function(){try{var n=this.getDrawingBufferSize(),o=Qe(n,1),i=o[0],a=this._canvasSizeInfo.clientWidth;return a?i/a:1}catch{return 1}},t.cssToDevicePixels=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=this.cssToDeviceRatio(),a=this.getDrawingBufferSize(),s=Qe(a,2),c=s[0],h=s[1];return Ji(n,i,c,h,o)},t.setDevicePixelRatio=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.htmlCanvas){var i="width"in o?o.width:this.htmlCanvas.clientWidth,a="height"in o?o.height:this.htmlCanvas.clientHeight;(!i||!a)&&(S.log(1,"Canvas clientWidth/clientHeight is 0")(),n=1,i=this.htmlCanvas.width||1,a=this.htmlCanvas.height||1);var s=this._canvasSizeInfo;if(s.clientWidth!==i||s.clientHeight!==a||s.devicePixelRatio!==n){var c=n,h=Math.floor(i*c),v=Math.floor(a*c);this.htmlCanvas.width=h,this.htmlCanvas.height=v;var m=this.getDrawingBufferSize(),g=Qe(m,2),_=g[0],O=g[1];(_!==h||O!==v)&&(c=Math.min(_/i,O/a),this.htmlCanvas.width=Math.floor(i*c),this.htmlCanvas.height=Math.floor(a*c),S.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=a,this._canvasSizeInfo.devicePixelRatio=n}}},t.getDrawingBufferSize=function(){var n=this.device.gl;if(!n)throw new Error("canvas size");return[n.drawingBufferWidth,n.drawingBufferHeight]},t._setAutoCreatedCanvasId=function(n){var o;((o=this.htmlCanvas)===null||o===void 0?void 0:o.id)==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=n)},Vi(e,null,[{key:"isPageLoaded",get:function(){return et()}}]),e}();ce.pageLoaded=Yi();function Yi(){return et()||typeof window>"u"?Promise.resolve():new Promise(function(e){window.addEventListener("load",function(){return e()})})}function Xi(e){if(typeof e=="string"){var t=document.getElementById(e);if(!t&&!et())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!t)throw new Error("".concat(e," is not an HTML element"));return t}else if(e)return e;return document.body}function qi(e){var t=document.getElementById(e);if(!t&&!et())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function Zi(e){var t=e.width,r=e.height,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?"".concat(t,"px"):"100%",n.style.height=Number.isFinite(r)?"".concat(r,"px"):"100%",n}function Ji(e,t,r,n,o){var i=e,a=Vr(i[0],t,r),s=Hr(i[1],t,n,o),c=Vr(i[0]+1,t,r),h=c===r-1?c:c-1;c=Hr(i[1]+1,t,n,o);var v;return o?(c=c===0?c:c+1,v=s,s=c):v=c===n-1?c:c-1,{x:a,y:s,width:Math.max(h-a+1,1),height:Math.max(v-s+1,1)}}function Vr(e,t,r){var n=Math.min(Math.round(e*t),r-1);return n}function Hr(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}function se(e){return se=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},se(e)}var Zr;function Yr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Xr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Yr(Object(r),!0).forEach(function(n){Qi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qi(e,t,r){return t=Jr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ea(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qr(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,Jr(n.key),n)}}function ta(e,t,r){return t&&qr(e.prototype,t),r&&qr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jr(e){var t=ra(e,"string");return se(t)==="symbol"?t:String(t)}function ra(e,t){if(se(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(se(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function na(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&&Ft(e,t)}function Ft(e,t){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ft(e,t)}function oa(e){var t=ua();return function(){var n=tt(e),o;if(t){var i=tt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return ia(this,o)}}function ia(e,t){if(t&&(se(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aa(e)}function aa(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ua(){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}}function tt(e){return tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},tt(e)}Zr=Symbol.toStringTag;var V=function(e){na(r,e);var t=oa(r);function r(n,o){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.defaultProps;return ea(this,r),i=t.call(this,n,o,a),i.dimension=void 0,i.format=void 0,i.width=void 0,i.height=void 0,i.depth=void 0,i.sampler=void 0,i.dimension=i.props.dimension,i.format=i.props.format,i.width=i.props.width,i.height=i.props.height,i.depth=i.props.depth,i}return ta(r,[{key:Zr,get:function(){return"Texture"}}]),r}(E);V.defaultProps=Xr(Xr({},E.defaultProps),{},{data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,sampler:{},compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0});V.COPY_SRC=1;V.COPY_DST=2;V.TEXTURE_BINDING=4;V.STORAGE_BINDING=8;V.RENDER_ATTACHMENT=16;function le(e){return le=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},le(e)}var rn;function Qr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).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?Qr(Object(r),!0).forEach(function(n){fa(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fa(e,t,r){return t=nn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ca(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tn(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,nn(n.key),n)}}function sa(e,t,r){return t&&tn(e.prototype,t),r&&tn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function nn(e){var t=la(e,"string");return le(t)==="symbol"?t:String(t)}function la(e,t){if(le(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(le(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pa(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&&Wt(e,t)}function Wt(e,t){return Wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Wt(e,t)}function ha(e){var t=ma();return function(){var n=rt(e),o;if(t){var i=rt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return da(this,o)}}function da(e,t){if(t&&(le(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ya(e)}function ya(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}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}}function rt(e){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},rt(e)}rn=Symbol.toStringTag;var nt=function(e){pa(r,e);var t=ha(r);function r(n,o){return ca(this,r),t.call(this,n,o,r.defaultProps)}return sa(r,[{key:rn,get:function(){return"ExternalTexture"}}]),r}(E);nt.defaultProps=en(en({},E.defaultProps),{},{source:null,colorSpace:"srgb"});function Ue(e){return Ue=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},Ue(e)}function va(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ba(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(h){throw h},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
10
10
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var h=r.next();return i=h.done,h},e:function(h){a=!0,s=h},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function ba(e,t){if(e){if(typeof e=="string")return on(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 on(e,t)}}function on(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 an(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function un(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?an(Object(r),!0).forEach(function(n){ga(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):an(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ga(e,t,r){return t=wa(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wa(e){var t=_a(e,"string");return Ue(t)==="symbol"?t:String(t)}function _a(e,t){if(Ue(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ue(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cn(e,t,r){var n="",o=t.split(/\r?\n/),i=e.slice().sort(function(g,_){return g.lineNum-_.lineNum});switch(r?.showSourceCode||"no"){case"all":for(var a=0,s=1;s<=o.length;s++)for(n+=sn(o[s-1],s,r);i.length>a&&i[a].lineNum===s;){var c=i[a++];n+=fn(c,o,c.lineNum,un(un({},r),{},{inlineSource:!1}))}return n;case"issues":case"no":var h=va(e),v;try{for(h.s();!(v=h.n()).done;){var m=v.value;n+=fn(m,o,m.lineNum,{inlineSource:r?.showSourceCode!=="no"})}}catch(g){h.e(g)}finally{h.f()}return n}}function fn(e,t,r,n){if(n!=null&&n.inlineSource){var o=Oa(t,r),i=e.linePos>0?"".concat(" ".repeat(e.linePos+5),`^^^
|
|
11
11
|
`):"";return`
|
|
12
12
|
`.concat(o).concat(i).concat(e.type.toUpperCase(),": ").concat(e.message,`
|
|
13
13
|
|
|
14
14
|
`)}return n!=null&&n.html?`<div class='luma-compiler-log-error' style="color:red;"><b> `.concat(e.type.toUpperCase(),": ").concat(e.message,"</b></div>"):"".concat(e.type.toUpperCase(),": ").concat(e.message)}function Oa(e,t,r){for(var n="",o=t-2;o<=t;o++){var i=e[o-1];i!==void 0&&(n+=sn(i,t,r))}return n}function sn(e,t,r){return"".concat(Pa(String(t),4),": ").concat(e).concat(r!=null&&r.html?"<br/>":`
|
|
15
|
-
`)}function Pa(e,t){for(var r="",n=e.length;n<t;++n)r+=" ";return r+e}function zt(e,t){return{name:Sa(e,t),language:"glsl",version:Ta(e)}}function Sa(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",r=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/,n=r.exec(e);return n?n[1]:t}function Ta(e){var t=100,r=e.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){var n=parseInt(r[1],10);Number.isFinite(n)&&(t=n)}return t}function ee(e){return ee=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},ee(e)}var dn;function Vt(){"use strict";Vt=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,f){l[u]=f.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(l,u,f){return Object.defineProperty(l,u,{value:f,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{c({},"")}catch{c=function(f,p,y){return f[p]=y}}function h(l,u,f,p){var y=u&&u.prototype instanceof g?u:g,d=Object.create(y.prototype),b=new I(p||[]);return n(d,"_invoke",{value:F(l,f,b)}),d}function v(l,u,f){try{return{type:"normal",arg:l.call(u,f)}}catch(p){return{type:"throw",arg:p}}}e.wrap=h;var m={};function g(){}function _(){}function O(){}var B={};c(B,i,function(){return this});var L=Object.getPrototypeOf,A=L&&L(L(k([])));A&&A!==t&&r.call(A,i)&&(B=A);var T=O.prototype=g.prototype=Object.create(B);function D(l){["next","throw","return"].forEach(function(u){c(l,u,function(f){return this._invoke(u,f)})})}function N(l,u){function f(y,d,b,w){var P=v(l[y],l,d);if(P.type!=="throw"){var x=P.arg,j=x.value;return j&&ee(j)=="object"&&r.call(j,"__await")?u.resolve(j.__await).then(function(R){f("next",R,b,w)},function(R){f("throw",R,b,w)}):u.resolve(j).then(function(R){x.value=R,b(x)},function(R){return f("throw",R,b,w)})}w(P.arg)}var p;n(this,"_invoke",{value:function(d,b){function w(){return new u(function(P,x){f(d,b,P,x)})}return p=p?p.then(w,w):w()}})}function F(l,u,f){var p="suspendedStart";return function(y,d){if(p==="executing")throw new Error("Generator is already running");if(p==="completed"){if(y==="throw")throw d;return z()}for(f.method=y,f.arg=d;;){var b=f.delegate;if(b){var w=U(b,f);if(w){if(w===m)continue;return w}}if(f.method==="next")f.sent=f._sent=f.arg;else if(f.method==="throw"){if(p==="suspendedStart")throw p="completed",f.arg;f.dispatchException(f.arg)}else f.method==="return"&&f.abrupt("return",f.arg);p="executing";var P=v(l,u,f);if(P.type==="normal"){if(p=f.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:f.done}}P.type==="throw"&&(p="completed",f.method="throw",f.arg=P.arg)}}}function U(l,u){var f=u.method,p=l.iterator[f];if(p===void 0)return u.delegate=null,f==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,U(l,u),u.method==="throw")||f!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+f+"' method")),m;var y=v(p,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function W(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function G(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function I(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(W,this),this.reset(!0)}function k(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var f=-1,p=function y(){for(;++f<l.length;)if(r.call(l,f))return y.value=l[f],y.done=!1,y;return y.value=void 0,y.done=!0,y};return p.next=p}}return{next:z}}function z(){return{value:void 0,done:!0}}return _.prototype=O,n(T,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:_,configurable:!0}),_.displayName=c(O,s,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===_||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,c(l,s,"GeneratorFunction")),l.prototype=Object.create(T),l},e.awrap=function(l){return{__await:l}},D(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,f,p,y){y===void 0&&(y=Promise);var d=new N(h(l,u,f,p),y);return e.isGeneratorFunction(u)?d:d.next().then(function(b){return b.done?b.value:d.next()})},D(T),c(T,s,"Generator"),c(T,i,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),f=[];for(var p in u)f.push(p);return f.reverse(),function y(){for(;f.length;){var d=f.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=k,I.prototype={constructor:I,reset:function(u){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(G),!u)for(var f in this)f.charAt(0)==="t"&&r.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var f=this;function p(x,j){return b.type="throw",b.arg=u,f.next=x,j&&(f.method="next",f.arg=void 0),!!j}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],b=d.completion;if(d.tryLoc==="root")return p("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return p(d.catchLoc,!0);if(this.prev<d.finallyLoc)return p(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return p(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return p(d.finallyLoc)}}}},abrupt:function(u,f){for(var p=this.tryEntries.length-1;p>=0;--p){var y=this.tryEntries[p];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=f&&f<=d.finallyLoc&&(d=null);var b=d?d.completion:{};return b.type=u,b.arg=f,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(b)},complete:function(u,f){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&f&&(this.next=f),m},finish:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.finallyLoc===u)return this.complete(p.completion,p.afterLoc),G(p),m}},catch:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.tryLoc===u){var y=p.completion;if(y.type==="throw"){var d=y.arg;G(p)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,f,p){return this.delegate={iterator:k(u),resultName:f,nextLoc:p},this.method==="next"&&(this.arg=void 0),m}},e}function ln(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(h){r(h);return}s.done?t(c):Promise.resolve(c).then(n,o)}function ja(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(c){ln(i,n,o,a,s,"next",c)}function s(c){ln(i,n,o,a,s,"throw",c)}a(void 0)})}}function pn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ht(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pn(Object(r),!0).forEach(function(n){Ea(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ea(e,t,r){return t=yn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hn(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,yn(n.key),n)}}function Ra(e,t,r){return t&&hn(e.prototype,t),r&&hn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function yn(e){var t=Aa(e,"string");return ee(t)==="symbol"?t:String(t)}function Aa(e,t){if(ee(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ee(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ia(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&&Kt(e,t)}function Kt(e,t){return Kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Kt(e,t)}function Ba(e){var t=Na();return function(){var n=ot(e),o;if(t){var i=ot(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return La(this,o)}}function La(e,t){if(t&&(ee(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Da(e)}function Da(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Na(){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}}function ot(e){return ot=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ot(e)}dn=Symbol.toStringTag;var it=function(e){Ia(r,e);var t=Ba(r);function r(o,i){var a;return xa(this,r),a=t.call(this,o,Ht({id:Ga(i)},i),r.defaultProps),a.stage=void 0,a.source=void 0,a.compilationStatus="pending",a.stage=a.props.stage,a.source=a.props.source,a}var n=r.prototype;return n.getCompilationInfoSync=function(){return null},n.debugShader=function(){var o=ja(Vt().mark(function a(){var s;return Vt().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:h.t0=this.props.debug,h.next=h.t0==="never"?3:h.t0==="errors"?4:h.t0==="warnings"||h.t0==="always"?7:8;break;case 3:return h.abrupt("return");case 4:if(this.compilationStatus!=="success"){h.next=6;break}return h.abrupt("return");case 6:return h.abrupt("break",8);case 7:return h.abrupt("break",8);case 8:return h.next=10,this.getCompilationInfo();case 10:if(s=h.sent,!(this.props.debug==="warnings"&&s?.length===0)){h.next=13;break}return h.abrupt("return");case 13:this._displayShaderLog(s);case 14:case"end":return h.stop()}},a,this)}));function i(){return o.apply(this,arguments)}return i}(),n._displayShaderLog=function(i){var a,s,c=this;if(!(typeof document>"u"||!((a=document)!==null&&a!==void 0&&a.createElement))){var h=zt(this.source).name,v="".concat(this.stage," ").concat(h),m=cn(i,this.source,{showSourceCode:"all",html:!0}),g=document.createElement("Button");g.innerHTML=`
|
|
15
|
+
`)}function Pa(e,t){for(var r="",n=e.length;n<t;++n)r+=" ";return r+e}function zt(e,t){return{name:Sa(e,t),language:"glsl",version:Ta(e)}}function Sa(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",r=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/,n=r.exec(e);return n?n[1]:t}function Ta(e){var t=100,r=e.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){var n=parseInt(r[1],10);Number.isFinite(n)&&(t=n)}return t}function ee(e){return ee=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},ee(e)}var dn;function Vt(){"use strict";Vt=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,f){l[u]=f.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(l,u,f){return Object.defineProperty(l,u,{value:f,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{c({},"")}catch{c=function(f,p,y){return f[p]=y}}function h(l,u,f,p){var y=u&&u.prototype instanceof g?u:g,d=Object.create(y.prototype),b=new I(p||[]);return n(d,"_invoke",{value:F(l,f,b)}),d}function v(l,u,f){try{return{type:"normal",arg:l.call(u,f)}}catch(p){return{type:"throw",arg:p}}}e.wrap=h;var m={};function g(){}function _(){}function O(){}var B={};c(B,i,function(){return this});var L=Object.getPrototypeOf,A=L&&L(L(k([])));A&&A!==t&&r.call(A,i)&&(B=A);var T=O.prototype=g.prototype=Object.create(B);function D(l){["next","throw","return"].forEach(function(u){c(l,u,function(f){return this._invoke(u,f)})})}function N(l,u){function f(y,d,b,w){var P=v(l[y],l,d);if(P.type!=="throw"){var x=P.arg,j=x.value;return j&&ee(j)=="object"&&r.call(j,"__await")?u.resolve(j.__await).then(function(R){f("next",R,b,w)},function(R){f("throw",R,b,w)}):u.resolve(j).then(function(R){x.value=R,b(x)},function(R){return f("throw",R,b,w)})}w(P.arg)}var p;n(this,"_invoke",{value:function(d,b){function w(){return new u(function(P,x){f(d,b,P,x)})}return p=p?p.then(w,w):w()}})}function F(l,u,f){var p="suspendedStart";return function(y,d){if(p==="executing")throw new Error("Generator is already running");if(p==="completed"){if(y==="throw")throw d;return z()}for(f.method=y,f.arg=d;;){var b=f.delegate;if(b){var w=U(b,f);if(w){if(w===m)continue;return w}}if(f.method==="next")f.sent=f._sent=f.arg;else if(f.method==="throw"){if(p==="suspendedStart")throw p="completed",f.arg;f.dispatchException(f.arg)}else f.method==="return"&&f.abrupt("return",f.arg);p="executing";var P=v(l,u,f);if(P.type==="normal"){if(p=f.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:f.done}}P.type==="throw"&&(p="completed",f.method="throw",f.arg=P.arg)}}}function U(l,u){var f=u.method,p=l.iterator[f];if(p===void 0)return u.delegate=null,f==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,U(l,u),u.method==="throw")||f!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+f+"' method")),m;var y=v(p,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function W(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function C(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function I(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(W,this),this.reset(!0)}function k(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var f=-1,p=function y(){for(;++f<l.length;)if(r.call(l,f))return y.value=l[f],y.done=!1,y;return y.value=void 0,y.done=!0,y};return p.next=p}}return{next:z}}function z(){return{value:void 0,done:!0}}return _.prototype=O,n(T,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:_,configurable:!0}),_.displayName=c(O,s,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===_||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,c(l,s,"GeneratorFunction")),l.prototype=Object.create(T),l},e.awrap=function(l){return{__await:l}},D(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,f,p,y){y===void 0&&(y=Promise);var d=new N(h(l,u,f,p),y);return e.isGeneratorFunction(u)?d:d.next().then(function(b){return b.done?b.value:d.next()})},D(T),c(T,s,"Generator"),c(T,i,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),f=[];for(var p in u)f.push(p);return f.reverse(),function y(){for(;f.length;){var d=f.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=k,I.prototype={constructor:I,reset:function(u){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(C),!u)for(var f in this)f.charAt(0)==="t"&&r.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var f=this;function p(x,j){return b.type="throw",b.arg=u,f.next=x,j&&(f.method="next",f.arg=void 0),!!j}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],b=d.completion;if(d.tryLoc==="root")return p("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return p(d.catchLoc,!0);if(this.prev<d.finallyLoc)return p(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return p(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return p(d.finallyLoc)}}}},abrupt:function(u,f){for(var p=this.tryEntries.length-1;p>=0;--p){var y=this.tryEntries[p];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=f&&f<=d.finallyLoc&&(d=null);var b=d?d.completion:{};return b.type=u,b.arg=f,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(b)},complete:function(u,f){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&f&&(this.next=f),m},finish:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.finallyLoc===u)return this.complete(p.completion,p.afterLoc),C(p),m}},catch:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.tryLoc===u){var y=p.completion;if(y.type==="throw"){var d=y.arg;C(p)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,f,p){return this.delegate={iterator:k(u),resultName:f,nextLoc:p},this.method==="next"&&(this.arg=void 0),m}},e}function ln(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(h){r(h);return}s.done?t(c):Promise.resolve(c).then(n,o)}function ja(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(c){ln(i,n,o,a,s,"next",c)}function s(c){ln(i,n,o,a,s,"throw",c)}a(void 0)})}}function pn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ht(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pn(Object(r),!0).forEach(function(n){Ea(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ea(e,t,r){return t=yn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hn(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,yn(n.key),n)}}function Ra(e,t,r){return t&&hn(e.prototype,t),r&&hn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function yn(e){var t=Aa(e,"string");return ee(t)==="symbol"?t:String(t)}function Aa(e,t){if(ee(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ee(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ia(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&&Kt(e,t)}function Kt(e,t){return Kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Kt(e,t)}function Ba(e){var t=Na();return function(){var n=ot(e),o;if(t){var i=ot(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return La(this,o)}}function La(e,t){if(t&&(ee(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Da(e)}function Da(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Na(){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}}function ot(e){return ot=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ot(e)}dn=Symbol.toStringTag;var it=function(e){Ia(r,e);var t=Ba(r);function r(o,i){var a;return xa(this,r),a=t.call(this,o,Ht({id:Ga(i)},i),r.defaultProps),a.stage=void 0,a.source=void 0,a.compilationStatus="pending",a.stage=a.props.stage,a.source=a.props.source,a}var n=r.prototype;return n.getCompilationInfoSync=function(){return null},n.debugShader=function(){var o=ja(Vt().mark(function a(){var s;return Vt().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:h.t0=this.props.debug,h.next=h.t0==="never"?3:h.t0==="errors"?4:h.t0==="warnings"||h.t0==="always"?7:8;break;case 3:return h.abrupt("return");case 4:if(this.compilationStatus!=="success"){h.next=6;break}return h.abrupt("return");case 6:return h.abrupt("break",8);case 7:return h.abrupt("break",8);case 8:return h.next=10,this.getCompilationInfo();case 10:if(s=h.sent,!(this.props.debug==="warnings"&&s?.length===0)){h.next=13;break}return h.abrupt("return");case 13:this._displayShaderLog(s);case 14:case"end":return h.stop()}},a,this)}));function i(){return o.apply(this,arguments)}return i}(),n._displayShaderLog=function(i){var a,s,c=this;if(!(typeof document>"u"||!((a=document)!==null&&a!==void 0&&a.createElement))){var h=zt(this.source).name,v="".concat(this.stage," ").concat(h),m=cn(i,this.source,{showSourceCode:"all",html:!0}),g=document.createElement("Button");g.innerHTML=`
|
|
16
16
|
<h1>Shader Compilation Error in `.concat(v,`</h1><br /><br />
|
|
17
17
|
<code style="user-select:text;"><pre>
|
|
18
18
|
`).concat(m,`
|
|
19
|
-
</pre></code>`),g.style.top="10px",g.style.left="10px",g.style.position="absolute",g.style.zIndex="9999",g.style.width="100%",g.style.textAlign="left",document.body.appendChild(g);var _=document.getElementsByClassName("luma-compiler-log-error");(s=_[0])!==null&&s!==void 0&&s.scrollIntoView&&_[0].scrollIntoView(),g.onclick=function(){var O="data:text/plain,".concat(encodeURIComponent(c.source));navigator.clipboard.writeText(O)}}},Ra(r,[{key:dn,get:function(){return"Shader"}}]),r}(E);it.defaultProps=Ht(Ht({},E.defaultProps),{},{language:"auto",stage:"vertex",source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function Ga(e){return zt(e.source).name||e.id||Y("unnamed ".concat(e.stage,"-shader"))}function pe(e){return pe=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},pe(e)}var gn;function mn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).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?mn(Object(r),!0).forEach(function(n){Ca(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ca(e,t,r){return t=wn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ka(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bn(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,wn(n.key),n)}}function Ma(e,t,r){return t&&bn(e.prototype,t),r&&bn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function wn(e){var t=Ua(e,"string");return pe(t)==="symbol"?t:String(t)}function Ua(e,t){if(pe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fa(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&&$t(e,t)}function $t(e,t){return $t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$t(e,t)}function Wa(e){var t=Ha();return function(){var n=at(e),o;if(t){var i=at(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return za(this,o)}}function za(e,t){if(t&&(pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Va(e)}function Va(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}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}}function at(e){return at=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},at(e)}gn=Symbol.toStringTag;var he=function(e){Fa(r,e);var t=Wa(r);function r(n,o){return ka(this,r),t.call(this,n,o,r.defaultProps)}return Ma(r,[{key:gn,get:function(){return"Sampler"}}]),r}(E);he.defaultProps=vn(vn({},E.defaultProps),{},{type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});function ye(e){return ye=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},ye(e)}var Sn;function _n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).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?_n(Object(r),!0).forEach(function(n){Ka(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_n(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ka(e,t,r){return t=Tn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $a(e,t){return Za(e)||
|
|
20
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qa(e,t){if(e){if(typeof e=="string")return On(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 On(e,t)}}function On(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,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function Za(e){if(Array.isArray(e))return e}function Ja(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pn(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,Tn(n.key),n)}}function Qa(e,t,r){return t&&Pn(e.prototype,t),r&&Pn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tn(e){var t=eu(e,"string");return ye(t)==="symbol"?t:String(t)}function eu(e,t){if(ye(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ye(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tu(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&&Yt(e,t)}function Yt(e,t){return Yt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Yt(e,t)}function ru(e){var t=iu();return function(){var n=ut(e),o;if(t){var i=ut(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return nu(this,o)}}function nu(e,t){if(t&&(ye(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ou(e)}function ou(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function iu(){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}}function ut(e){return ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ut(e)}Sn=Symbol.toStringTag;var ft=function(e){tu(r,e);var t=ru(r);function r(o){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ja(this,r),i=t.call(this,o,a,r.defaultProps),i.width=void 0,i.height=void 0,i.colorAttachments=[],i.depthStencilAttachment=null,i.width=i.props.width,i.height=i.props.height,i}var n=r.prototype;return n.resize=function(i){var a=!i;if(i){var s=Array.isArray(i)?i:[i.width,i.height],c=$a(s,2),h=c[0],v=c[1];a=a||v!==this.height||h!==this.width,this.width=h,this.height=v}a&&(S.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(this.width,"x").concat(this.height))(),this.resizeAttachments(this.width,this.height))},n.autoCreateAttachmentTextures=function(){var i=this;if(this.colorAttachments=this.props.colorAttachments.map(function(s){if(typeof s=="string"){var c=i.createColorTexture(s);return i.attachResource(c),c}return s}),this.props.depthStencilAttachment)if(typeof this.props.depthStencilAttachment=="string"){var a=this.createDepthStencilTexture(this.props.depthStencilAttachment);this.attachResource(a),this.depthStencilAttachment=a}else this.depthStencilAttachment=this.props.depthStencilAttachment},n.createColorTexture=function(i){return this.device.createTexture({id:"color-attachment",usage:V.RENDER_ATTACHMENT,format:i,width:this.width,height:this.height})},n.createDepthStencilTexture=function(i){return this.device.createTexture({id:"depth-stencil-attachment",usage:V.RENDER_ATTACHMENT,format:i,width:this.width,height:this.height})},n.resizeAttachments=function(i,a){for(var s=0;s<this.colorAttachments.length;++s)if(this.colorAttachments[s]){var c=this.device._createTexture(de(de({},this.colorAttachments[s].props),{},{width:i,height:a}));this.destroyAttachedResource(this.colorAttachments[s]),this.colorAttachments[s]=c,this.attachResource(c)}if(this.depthStencilAttachment){var h=this.device._createTexture(de(de({},this.depthStencilAttachment.props),{},{width:i,height:a}));this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=h,this.attachResource(h)}},Qa(r,[{key:Sn,get:function(){return"Framebuffer"}}]),r}(E);ft.defaultProps=de(de({},E.defaultProps),{},{width:1,height:1,colorAttachments:[],depthStencilAttachment:null});function me(e){return me=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},me(e)}var Rn;function jn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).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?jn(Object(r),!0).forEach(function(n){au(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function au(e,t,r){return t=An(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xn(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,An(n.key),n)}}function fu(e,t,r){return t&&xn(e.prototype,t),r&&xn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function An(e){var t=cu(e,"string");return me(t)==="symbol"?t:String(t)}function cu(e,t){if(me(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(me(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function su(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&&qt(e,t)}function qt(e,t){return qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},qt(e,t)}function lu(e){var t=du();return function(){var n=ct(e),o;if(t){var i=ct(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return pu(this,o)}}function pu(e,t){if(t&&(me(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hu(e)}function hu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function du(){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}}function ct(e){return ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ct(e)}Rn=Symbol.toStringTag;var st=function(e){su(r,e);var t=lu(r);function r(n,o){var i;return uu(this,r),i=t.call(this,n,o,r.defaultProps),i.hash="",i.vs=void 0,i.fs=void 0,i.shaderLayout=void 0,i.bufferLayout=void 0,i.shaderLayout=i.props.shaderLayout,i.bufferLayout=i.props.bufferLayout||[],i}return fu(r,[{key:Rn,get:function(){return"RenderPipeline"}}]),r}(E);st.defaultProps=En(En({},E.defaultProps),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});function ve(e){return ve=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},ve(e)}var Dn;function In(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Bn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?In(Object(r),!0).forEach(function(n){yu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):In(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yu(e,t,r){return t=Nn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ln(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,Nn(n.key),n)}}function vu(e,t,r){return t&&Ln(e.prototype,t),r&&Ln(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nn(e){var t=bu(e,"string");return ve(t)==="symbol"?t:String(t)}function bu(e,t){if(ve(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ve(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gu(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&&Xt(e,t)}function Xt(e,t){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Xt(e,t)}function wu(e){var t=Pu();return function(){var n=lt(e),o;if(t){var i=lt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _u(this,o)}}function _u(e,t){if(t&&(ve(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ou(e)}function Ou(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pu(){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}}function lt(e){return lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},lt(e)}Dn=Symbol.toStringTag;var pt=function(e){gu(r,e);var t=wu(r);function r(n,o){var i;return mu(this,r),i=t.call(this,n,o,r.defaultProps),i.hash="",i}return vu(r,[{key:Dn,get:function(){return"ComputePipeline"}}]),r}(E);pt.defaultProps=Bn(Bn({},E.defaultProps),{},{cs:void 0,csEntryPoint:void 0,csConstants:{},shaderLayout:[]});function be(e){return be=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},be(e)}var Mn;function Gn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Cn(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){Su(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}function Su(e,t,r){return t=Un(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kn(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,Un(n.key),n)}}function ju(e,t,r){return t&&kn(e.prototype,t),r&&kn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Un(e){var t=Eu(e,"string");return be(t)==="symbol"?t:String(t)}function Eu(e,t){if(be(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(be(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xu(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&&Zt(e,t)}function Zt(e,t){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Zt(e,t)}function Ru(e){var t=Bu();return function(){var n=ht(e),o;if(t){var i=ht(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Au(this,o)}}function Au(e,t){if(t&&(be(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Iu(e)}function Iu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bu(){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}}function ht(e){return ht=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ht(e)}Mn=Symbol.toStringTag;var dt=function(e){xu(r,e);var t=Ru(r);function r(n,o){return Tu(this,r),t.call(this,n,o,r.defaultProps)}return ju(r,[{key:Mn,get:function(){return"RenderPass"}}]),r}(E);dt.defaultProps=Cn(Cn({},E.defaultProps),{},{framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1});function ge(e){return ge=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},ge(e)}var zn;function Fn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Lu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fn(Object(r),!0).forEach(function(n){Du(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Du(e,t,r){return t=Vn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wn(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,Vn(n.key),n)}}function Gu(e,t,r){return t&&Wn(e.prototype,t),r&&Wn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vn(e){var t=Cu(e,"string");return ge(t)==="symbol"?t:String(t)}function Cu(e,t){if(ge(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ge(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ku(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&&Jt(e,t)}function Jt(e,t){return Jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Jt(e,t)}function Mu(e){var t=Wu();return function(){var n=yt(e),o;if(t){var i=yt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Uu(this,o)}}function Uu(e,t){if(t&&(ge(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fu(e)}function Fu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wu(){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}}function yt(e){return yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},yt(e)}zn=Symbol.toStringTag;var mt=function(e){ku(r,e);var t=Mu(r);function r(n,o){return Nu(this,r),t.call(this,n,o,E.defaultProps)}return Gu(r,[{key:zn,get:function(){return"ComputePass"}}]),r}(E);mt.defaultProps=Lu({},E.defaultProps);function zu(e,t){return $u(e)||Ku(e,t)||Hu(e,t)||Vu()}function Vu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
21
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hu(e,t){if(e){if(typeof e=="string")return Hn(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 Hn(e,t)}}function Hn(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 Ku(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function $u(e){if(Array.isArray(e))return e}function Kn(e){var t=zu(
|
|
22
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tf(e,t){if(e){if(typeof e=="string")return
|
|
23
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var h=r.next();return i=h.done,h},e:function(h){a=!0,s=h},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function of(e,t){if(e){if(typeof e=="string")return Xn(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 Xn(e,t)}}function Xn(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 af(e,t){var r={},n=Fe(e.attributes),o;try{for(n.s();!(o=n.n()).done;){var i=o.value;r[i.name]=uf(e,t,i.name)}}catch(a){n.e(a)}finally{n.f()}return r}function Zn(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:16,n=af(e,t),o=new Array(r).fill(null),i=0,a=Object.values(n);i<a.length;i++){var s=a[i];o[s.location]=s}return o}function uf(e,t,r){var n=ff(e,r),o=cf(t,r);if(!n)return null;var i=Kn(n.type),a=o?.vertexFormat||i.defaultVertexFormat,s=X(a);return{attributeName:o?.attributeName||n.name,bufferName:o?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:i.dataType,shaderComponents:i.components,vertexFormat:a,bufferDataType:s.type,bufferComponents:s.components,normalized:s.normalized,integer:i.integer,stepMode:o?.stepMode||n.stepMode,byteOffset:o?.byteOffset||0,byteStride:o?.byteStride||0}}function ff(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||S.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function cf(e,t){sf(e);var r=lf(e,t);return r||(r=pf(e,t),r)?r:(S.warn('layout for attribute "'.concat(t,'" not present in buffer layout')),null)}function sf(e){var t=Fe(e),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;(n.attributes&&n.format||!n.attributes&&!n.format)&&S.warn("BufferLayout ".concat(name," must have either 'attributes' or 'format' field"))}}catch(o){t.e(o)}finally{t.f()}}function lf(e,t){var r=Fe(e),n;try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.format&&o.name===t)return{attributeName:o.name,bufferName:t,stepMode:o.stepMode,vertexFormat:o.format,byteOffset:0,byteStride:o.byteStride||0}}}catch(i){r.e(i)}finally{r.f()}return null}function pf(e,t){var r=Fe(e),n;try{for(r.s();!(n=r.n()).done;){var o,i=n.value,a=i.byteStride;if(typeof i.byteStride!="number"){var s=Fe(i.attributes||[]),c;try{for(s.s();!(c=s.n()).done;){var h=c.value,v=X(h.format);a+=v.byteLength}}catch(g){s.e(g)}finally{s.f()}}var m=(o=i.attributes)===null||o===void 0?void 0:o.find(function(g){return g.attribute===t});if(m)return{attributeName:m.attribute,bufferName:i.name,stepMode:i.stepMode,vertexFormat:m.format,byteOffset:m.byteOffset,byteStride:a}}}catch(g){r.e(g)}finally{r.f()}return null}function we(e){return we=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},we(e)}var to;function Jn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Qn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jn(Object(r),!0).forEach(function(n){hf(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hf(e,t,r){return t=ro(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function df(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function eo(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,ro(n.key),n)}}function yf(e,t,r){return t&&eo(e.prototype,t),r&&eo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ro(e){var t=mf(e,"string");return we(t)==="symbol"?t:String(t)}function mf(e,t){if(we(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(we(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vf(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&&Qt(e,t)}function Qt(e,t){return Qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Qt(e,t)}function bf(e){var t=_f();return function(){var n=vt(e),o;if(t){var i=vt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return gf(this,o)}}function gf(e,t){if(t&&(we(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wf(e)}function wf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _f(){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}}function vt(e){return vt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vt(e)}to=Symbol.toStringTag;var bt=function(e){vf(r,e);var t=bf(r);function r(n,o){var i;return df(this,r),i=t.call(this,n,o,r.defaultProps),i.maxVertexAttributes=void 0,i.attributeInfos=void 0,i.indexBuffer=null,i.attributes=void 0,i.maxVertexAttributes=n.limits.maxVertexAttributes,i.attributes=new Array(i.maxVertexAttributes).fill(null),i.attributeInfos=Zn(o.renderPipeline.shaderLayout,o.renderPipeline.bufferLayout,i.maxVertexAttributes),i}return yf(r,[{key:to,get:function(){return"VertexArray"}}]),r}(E);bt.defaultProps=Qn(Qn({},E.defaultProps),{},{renderPipeline:null});function te(e){return te=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},te(e)}function er(){"use strict";er=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,f){l[u]=f.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(l,u,f){return Object.defineProperty(l,u,{value:f,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{c({},"")}catch{c=function(f,p,y){return f[p]=y}}function h(l,u,f,p){var y=u&&u.prototype instanceof g?u:g,d=Object.create(y.prototype),b=new I(p||[]);return n(d,"_invoke",{value:F(l,f,b)}),d}function v(l,u,f){try{return{type:"normal",arg:l.call(u,f)}}catch(p){return{type:"throw",arg:p}}}e.wrap=h;var m={};function g(){}function _(){}function O(){}var B={};c(B,i,function(){return this});var L=Object.getPrototypeOf,A=L&&L(L(k([])));A&&A!==t&&r.call(A,i)&&(B=A);var T=O.prototype=g.prototype=Object.create(B);function D(l){["next","throw","return"].forEach(function(u){c(l,u,function(f){return this._invoke(u,f)})})}function N(l,u){function f(y,d,b,w){var P=v(l[y],l,d);if(P.type!=="throw"){var x=P.arg,j=x.value;return j&&te(j)=="object"&&r.call(j,"__await")?u.resolve(j.__await).then(function(R){f("next",R,b,w)},function(R){f("throw",R,b,w)}):u.resolve(j).then(function(R){x.value=R,b(x)},function(R){return f("throw",R,b,w)})}w(P.arg)}var p;n(this,"_invoke",{value:function(d,b){function w(){return new u(function(P,x){f(d,b,P,x)})}return p=p?p.then(w,w):w()}})}function F(l,u,f){var p="suspendedStart";return function(y,d){if(p==="executing")throw new Error("Generator is already running");if(p==="completed"){if(y==="throw")throw d;return z()}for(f.method=y,f.arg=d;;){var b=f.delegate;if(b){var w=U(b,f);if(w){if(w===m)continue;return w}}if(f.method==="next")f.sent=f._sent=f.arg;else if(f.method==="throw"){if(p==="suspendedStart")throw p="completed",f.arg;f.dispatchException(f.arg)}else f.method==="return"&&f.abrupt("return",f.arg);p="executing";var P=v(l,u,f);if(P.type==="normal"){if(p=f.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:f.done}}P.type==="throw"&&(p="completed",f.method="throw",f.arg=P.arg)}}}function U(l,u){var f=u.method,p=l.iterator[f];if(p===void 0)return u.delegate=null,f==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,U(l,u),u.method==="throw")||f!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+f+"' method")),m;var y=v(p,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function W(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function G(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function I(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(W,this),this.reset(!0)}function k(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var f=-1,p=function y(){for(;++f<l.length;)if(r.call(l,f))return y.value=l[f],y.done=!1,y;return y.value=void 0,y.done=!0,y};return p.next=p}}return{next:z}}function z(){return{value:void 0,done:!0}}return _.prototype=O,n(T,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:_,configurable:!0}),_.displayName=c(O,s,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===_||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,c(l,s,"GeneratorFunction")),l.prototype=Object.create(T),l},e.awrap=function(l){return{__await:l}},D(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,f,p,y){y===void 0&&(y=Promise);var d=new N(h(l,u,f,p),y);return e.isGeneratorFunction(u)?d:d.next().then(function(b){return b.done?b.value:d.next()})},D(T),c(T,s,"Generator"),c(T,i,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),f=[];for(var p in u)f.push(p);return f.reverse(),function y(){for(;f.length;){var d=f.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=k,I.prototype={constructor:I,reset:function(u){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(G),!u)for(var f in this)f.charAt(0)==="t"&&r.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var f=this;function p(x,j){return b.type="throw",b.arg=u,f.next=x,j&&(f.method="next",f.arg=void 0),!!j}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],b=d.completion;if(d.tryLoc==="root")return p("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return p(d.catchLoc,!0);if(this.prev<d.finallyLoc)return p(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return p(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return p(d.finallyLoc)}}}},abrupt:function(u,f){for(var p=this.tryEntries.length-1;p>=0;--p){var y=this.tryEntries[p];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=f&&f<=d.finallyLoc&&(d=null);var b=d?d.completion:{};return b.type=u,b.arg=f,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(b)},complete:function(u,f){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&f&&(this.next=f),m},finish:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.finallyLoc===u)return this.complete(p.completion,p.afterLoc),G(p),m}},catch:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.tryLoc===u){var y=p.completion;if(y.type==="throw"){var d=y.arg;G(p)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,f,p){return this.delegate={iterator:k(u),resultName:f,nextLoc:p},this.method==="next"&&(this.arg=void 0),m}},e}function no(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(h){r(h);return}s.done?t(c):Promise.resolve(c).then(n,o)}function Of(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(c){no(i,n,o,a,s,"next",c)}function s(c){no(i,n,o,a,s,"throw",c)}a(void 0)})}}function oo(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,Sf(n.key),n)}}function Pf(e,t,r){return t&&oo(e.prototype,t),r&&oo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sf(e){var t=Tf(e,"string");return te(t)==="symbol"?t:String(t)}function Tf(e,t){if(te(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(te(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ef(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&&tr(e,t)}function tr(e,t){return tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},tr(e,t)}function xf(e){var t=If();return function(){var n=gt(e),o;if(t){var i=gt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Rf(this,o)}}function Rf(e,t){if(t&&(te(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Af(e)}function Af(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function If(){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}}function gt(e){return gt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},gt(e)}function Bf(e){var t;return e.byteLength||((t=e.data)===null||t===void 0?void 0:t.byteLength)||0}var wt=function(e){Ef(r,e);var t=xf(r);function r(o,i){var a;jf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.byteLength=void 0,a.device=o,a.byteLength=Bf(i);var s=Boolean(i.data),c=Math.ceil(a.byteLength/4)*4;return a.handle=a.props.handle||a.device.handle.createBuffer({size:c,usage:a.props.usage||GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,mappedAtCreation:a.props.mappedAtCreation||s,label:a.props.id}),i.data&&a._writeMapped(i.data),s&&!i.mappedAtCreation&&a.handle.unmap(),a}var n=r.prototype;return n.destroy=function(){this.handle.destroy()},n.write=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.device.handle.queue.writeBuffer(this.handle,a,i.buffer,i.byteOffset,i.byteLength)},n.readAsync=function(){var o=Of(er().mark(function a(){var s,c,h,v,m,g=arguments;return er().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return s=g.length>0&&g[0]!==void 0?g[0]:0,c=g.length>1&&g[1]!==void 0?g[1]:this.byteLength,h=new r(this.device,{usage:C.MAP_READ|C.COPY_DST,byteLength:c}),v=this.device.handle.createCommandEncoder(),v.copyBufferToBuffer(this.handle,s,h.handle,0,c),this.device.handle.queue.submit([v.finish()]),O.next=8,h.handle.mapAsync(GPUMapMode.READ,s,c);case 8:return m=h.handle.getMappedRange().slice(0),h.handle.unmap(),h.destroy(),O.abrupt("return",new Uint8Array(m));case 12:case"end":return O.stop()}},a,this)}));function i(){return o.apply(this,arguments)}return i}(),n._writeMapped=function(i){var a=this.handle.getMappedRange();new i.constructor(a).set(i)},n.mapAsync=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=arguments.length>2?arguments[2]:void 0;return this.handle.mapAsync(i,a,s)},n.getMappedRange=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=arguments.length>1?arguments[1]:void 0;return this.handle.getMappedRange(i,a)},n.unmap=function(){this.handle.unmap()},Pf(r)}(C);function _e(e){if(e.includes("webgl"))throw new Error("webgl-only format");return e}function Oe(e){return Oe=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},Oe(e)}function io(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Lf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?io(Object(r),!0).forEach(function(n){Df(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):io(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Df(e,t,r){return t=uo(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ao(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,uo(n.key),n)}}function Nf(e,t,r){return t&&ao(e.prototype,t),r&&ao(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function uo(e){var t=Gf(e,"string");return Oe(t)==="symbol"?t:String(t)}function Gf(e,t){if(Oe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Oe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Cf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kf(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&&rr(e,t)}function rr(e,t){return rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},rr(e,t)}function Mf(e){var t=Wf();return function(){var n=_t(e),o;if(t){var i=_t(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Uf(this,o)}}function Uf(e,t){if(t&&(Oe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ff(e)}function Ff(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wf(){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}}function _t(e){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},_t(e)}var K=function(e){kf(r,e);var t=Mf(r);function r(o,i){var a;Cf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o;var s=Lf({},a.props);return s.type!=="comparison-sampler"&&delete s.compare,a.handle=a.handle||a.device.handle.createSampler(s),a.handle.label=a.props.id,a}var n=r.prototype;return n.destroy=function(){},Nf(r)}(he);function Pe(e){return Pe=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},Pe(e)}function fo(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,Vf(n.key),n)}}function zf(e,t,r){return t&&fo(e.prototype,t),r&&fo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vf(e){var t=Hf(e,"string");return Pe(t)==="symbol"?t:String(t)}function Hf(e,t){if(Pe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $f(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&&nr(e,t)}function nr(e,t){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},nr(e,t)}function Yf(e){var t=Zf();return function(){var n=Ot(e),o;if(t){var i=Ot(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return qf(this,o)}}function qf(e,t){if(t&&(Pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xf(e)}function Xf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zf(){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}}function Ot(e){return Ot=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ot(e)}var Jf={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},Pt=function(e){$f(r,e);var t=Yf(r);function r(o,i){var a;if(Kf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.view=void 0,a.sampler=void 0,a.height=1,a.width=1,typeof a.props.format=="number")throw new Error("number format");return a.device=o,a.handle=a.props.handle||a.createHandle(),a.props.data&&a.setData({data:a.props.data}),a.width=a.handle.width,a.height=a.handle.height,a.sampler=i.sampler instanceof K?i.sampler:new K(a.device,i.sampler),a.view=a.handle.createView({}),a}var n=r.prototype;return n.createHandle=function(){var i,a;if(typeof this.props.format=="number")throw new Error("number format");var s=this.props.width||((i=this.props.data)===null||i===void 0?void 0:i.width)||1,c=this.props.height||((a=this.props.data)===null||a===void 0?void 0:a.height)||1;return this.device.handle.createTexture({size:{width:s,height:c,depthOrArrayLayers:this.props.depth},dimension:Jf[this.props.dimension],format:_e(this.props.format),usage:this.props.usage,mipLevelCount:this.props.mipLevels,sampleCount:this.props.samples})},n.destroy=function(){this.handle.destroy()},n.setSampler=function(i){return this.sampler=i instanceof K?i:new K(this.device,i),this},n.setData=function(i){return this.setImage({source:i.data})},n.setImage=function(i){var a=i.source,s=i.width,c=s===void 0?i.source.width:s,h=i.height,v=h===void 0?i.source.height:h,m=i.depth,g=m===void 0?1:m,_=i.sourceX,O=_===void 0?0:_,B=i.sourceY,L=B===void 0?0:B,A=i.mipLevel,T=A===void 0?0:A,D=i.x,N=D===void 0?0:D,F=i.y,U=F===void 0?0:F,W=i.z,G=W===void 0?0:W,I=i.aspect,k=I===void 0?"all":I,z=i.colorSpace,l=z===void 0?"srgb":z,u=i.premultipliedAlpha,f=u===void 0?!1:u;return this.device.handle.queue.copyExternalImageToTexture({source:a,origin:[O,L]},{texture:this.handle,origin:[N,U,G],mipLevel:T,aspect:k,colorSpace:l,premultipliedAlpha:f},[c,v,g]),{width:c,height:v}},zf(r)}(V);function Se(e){return Se=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},Se(e)}function co(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,ec(n.key),n)}}function Qf(e,t,r){return t&&co(e.prototype,t),r&&co(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ec(e){var t=tc(e,"string");return Se(t)==="symbol"?t:String(t)}function tc(e,t){if(Se(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Se(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nc(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&&or(e,t)}function or(e,t){return or=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},or(e,t)}function oc(e){var t=uc();return function(){var n=St(e),o;if(t){var i=St(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return ic(this,o)}}function ic(e,t){if(t&&(Se(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ac(e)}function ac(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uc(){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}}function St(e){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},St(e)}var so=function(e){nc(r,e);var t=oc(r);function r(o,i){var a;return rc(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.sampler=void 0,a.device=o,a.handle=a.props.handle||a.device.handle.importExternalTexture({source:i.source,colorSpace:i.colorSpace}),a.sampler=null,a}var n=r.prototype;return n.destroy=function(){},n.setSampler=function(i){return this.sampler=i instanceof K?i:new K(this.device,i),this},Qf(r)}(nt);function re(e){return re=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},re(e)}function We(){"use strict";We=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,f){l[u]=f.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(l,u,f){return Object.defineProperty(l,u,{value:f,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{c({},"")}catch{c=function(f,p,y){return f[p]=y}}function h(l,u,f,p){var y=u&&u.prototype instanceof g?u:g,d=Object.create(y.prototype),b=new I(p||[]);return n(d,"_invoke",{value:F(l,f,b)}),d}function v(l,u,f){try{return{type:"normal",arg:l.call(u,f)}}catch(p){return{type:"throw",arg:p}}}e.wrap=h;var m={};function g(){}function _(){}function O(){}var B={};c(B,i,function(){return this});var L=Object.getPrototypeOf,A=L&&L(L(k([])));A&&A!==t&&r.call(A,i)&&(B=A);var T=O.prototype=g.prototype=Object.create(B);function D(l){["next","throw","return"].forEach(function(u){c(l,u,function(f){return this._invoke(u,f)})})}function N(l,u){function f(y,d,b,w){var P=v(l[y],l,d);if(P.type!=="throw"){var x=P.arg,j=x.value;return j&&re(j)=="object"&&r.call(j,"__await")?u.resolve(j.__await).then(function(R){f("next",R,b,w)},function(R){f("throw",R,b,w)}):u.resolve(j).then(function(R){x.value=R,b(x)},function(R){return f("throw",R,b,w)})}w(P.arg)}var p;n(this,"_invoke",{value:function(d,b){function w(){return new u(function(P,x){f(d,b,P,x)})}return p=p?p.then(w,w):w()}})}function F(l,u,f){var p="suspendedStart";return function(y,d){if(p==="executing")throw new Error("Generator is already running");if(p==="completed"){if(y==="throw")throw d;return z()}for(f.method=y,f.arg=d;;){var b=f.delegate;if(b){var w=U(b,f);if(w){if(w===m)continue;return w}}if(f.method==="next")f.sent=f._sent=f.arg;else if(f.method==="throw"){if(p==="suspendedStart")throw p="completed",f.arg;f.dispatchException(f.arg)}else f.method==="return"&&f.abrupt("return",f.arg);p="executing";var P=v(l,u,f);if(P.type==="normal"){if(p=f.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:f.done}}P.type==="throw"&&(p="completed",f.method="throw",f.arg=P.arg)}}}function U(l,u){var f=u.method,p=l.iterator[f];if(p===void 0)return u.delegate=null,f==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,U(l,u),u.method==="throw")||f!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+f+"' method")),m;var y=v(p,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function W(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function G(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function I(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(W,this),this.reset(!0)}function k(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var f=-1,p=function y(){for(;++f<l.length;)if(r.call(l,f))return y.value=l[f],y.done=!1,y;return y.value=void 0,y.done=!0,y};return p.next=p}}return{next:z}}function z(){return{value:void 0,done:!0}}return _.prototype=O,n(T,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:_,configurable:!0}),_.displayName=c(O,s,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===_||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,c(l,s,"GeneratorFunction")),l.prototype=Object.create(T),l},e.awrap=function(l){return{__await:l}},D(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,f,p,y){y===void 0&&(y=Promise);var d=new N(h(l,u,f,p),y);return e.isGeneratorFunction(u)?d:d.next().then(function(b){return b.done?b.value:d.next()})},D(T),c(T,s,"Generator"),c(T,i,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),f=[];for(var p in u)f.push(p);return f.reverse(),function y(){for(;f.length;){var d=f.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=k,I.prototype={constructor:I,reset:function(u){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(G),!u)for(var f in this)f.charAt(0)==="t"&&r.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var f=this;function p(x,j){return b.type="throw",b.arg=u,f.next=x,j&&(f.method="next",f.arg=void 0),!!j}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],b=d.completion;if(d.tryLoc==="root")return p("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return p(d.catchLoc,!0);if(this.prev<d.finallyLoc)return p(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return p(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return p(d.finallyLoc)}}}},abrupt:function(u,f){for(var p=this.tryEntries.length-1;p>=0;--p){var y=this.tryEntries[p];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=f&&f<=d.finallyLoc&&(d=null);var b=d?d.completion:{};return b.type=u,b.arg=f,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(b)},complete:function(u,f){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&f&&(this.next=f),m},finish:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.finallyLoc===u)return this.complete(p.completion,p.afterLoc),G(p),m}},catch:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.tryLoc===u){var y=p.completion;if(y.type==="throw"){var d=y.arg;G(p)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,f,p){return this.delegate={iterator:k(u),resultName:f,nextLoc:p},this.method==="next"&&(this.arg=void 0),m}},e}function lo(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(h){r(h);return}s.done?t(c):Promise.resolve(c).then(n,o)}function po(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(c){lo(i,n,o,a,s,"next",c)}function s(c){lo(i,n,o,a,s,"throw",c)}a(void 0)})}}function ho(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,cc(n.key),n)}}function fc(e,t,r){return t&&ho(e.prototype,t),r&&ho(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function cc(e){var t=sc(e,"string");return re(t)==="symbol"?t:String(t)}function sc(e,t){if(re(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(re(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pc(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&&ir(e,t)}function ir(e,t){return ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ir(e,t)}function hc(e){var t=mc();return function(){var n=Tt(e),o;if(t){var i=Tt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return dc(this,o)}}function dc(e,t){if(t&&(re(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yc(e)}function yc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mc(){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}}function Tt(e){return Tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Tt(e)}var jt=function(e){pc(r,e);var t=hc(r);function r(o,i){var a;return lc(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o,a.device.handle.pushErrorScope("validation"),a.handle=a.props.handle||a.createHandle(),a.handle.label=a.props.id,a._checkCompilationError(a.device.handle.popErrorScope()),a}var n=r.prototype;return n._checkCompilationError=function(){var o=po(We().mark(function a(s){var c,h;return We().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,s;case 2:if(c=m.sent,!c){m.next=9;break}return m.next=6,this.getCompilationInfo();case 6:throw h=m.sent,S.error("Shader compilation error: ".concat(c.message),h)(),new Error("Shader compilation error: ".concat(c.message));case 9:case"end":return m.stop()}},a,this)}));function i(a){return o.apply(this,arguments)}return i}(),n.destroy=function(){},n.getCompilationInfo=function(){var o=po(We().mark(function a(){var s;return We().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.handle.getCompilationInfo();case 2:return s=h.sent,h.abrupt("return",s.messages);case 4:case"end":return h.stop()}},a,this)}));function i(){return o.apply(this,arguments)}return i}(),n.createHandle=function(){var i=this,a=this.props,s=a.source,c=a.stage,h=this.props.language;switch(h==="auto"&&(h=s.includes("->")?"wgsl":"glsl"),h){case"wgsl":return this.device.handle.createShaderModule({code:s});case"glsl":return this.device.handle.createShaderModule({code:s,transform:function(m){return i.device.glslang.compileGLSL(m,c)}});default:throw new Error(h)}},fc(r)}(it);function ze(e){return ze=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},ze(e)}function vc(e,t){return _c(e)||wc(e,t)||gc(e,t)||bc()}function bc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
19
|
+
</pre></code>`),g.style.top="10px",g.style.left="10px",g.style.position="absolute",g.style.zIndex="9999",g.style.width="100%",g.style.textAlign="left",document.body.appendChild(g);var _=document.getElementsByClassName("luma-compiler-log-error");(s=_[0])!==null&&s!==void 0&&s.scrollIntoView&&_[0].scrollIntoView(),g.onclick=function(){var O="data:text/plain,".concat(encodeURIComponent(c.source));navigator.clipboard.writeText(O)}}},Ra(r,[{key:dn,get:function(){return"Shader"}}]),r}(E);it.defaultProps=Ht(Ht({},E.defaultProps),{},{language:"auto",stage:"vertex",source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function Ga(e){return zt(e.source).name||e.id||Y("unnamed ".concat(e.stage,"-shader"))}function pe(e){return pe=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},pe(e)}var gn;function mn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).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?mn(Object(r),!0).forEach(function(n){Ca(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ca(e,t,r){return t=wn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ka(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bn(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,wn(n.key),n)}}function Ma(e,t,r){return t&&bn(e.prototype,t),r&&bn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function wn(e){var t=Ua(e,"string");return pe(t)==="symbol"?t:String(t)}function Ua(e,t){if(pe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fa(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&&$t(e,t)}function $t(e,t){return $t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$t(e,t)}function Wa(e){var t=Ha();return function(){var n=at(e),o;if(t){var i=at(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return za(this,o)}}function za(e,t){if(t&&(pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Va(e)}function Va(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}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}}function at(e){return at=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},at(e)}gn=Symbol.toStringTag;var he=function(e){Fa(r,e);var t=Wa(r);function r(n,o){return ka(this,r),t.call(this,n,o,r.defaultProps)}return Ma(r,[{key:gn,get:function(){return"Sampler"}}]),r}(E);he.defaultProps=vn(vn({},E.defaultProps),{},{type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});function ye(e){return ye=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},ye(e)}var Sn;function _n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).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?_n(Object(r),!0).forEach(function(n){Ka(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_n(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ka(e,t,r){return t=Tn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $a(e,t){return Za(e)||qa(e,t)||Xa(e,t)||Ya()}function Ya(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
20
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xa(e,t){if(e){if(typeof e=="string")return On(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 On(e,t)}}function On(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 qa(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function Za(e){if(Array.isArray(e))return e}function Ja(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pn(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,Tn(n.key),n)}}function Qa(e,t,r){return t&&Pn(e.prototype,t),r&&Pn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tn(e){var t=eu(e,"string");return ye(t)==="symbol"?t:String(t)}function eu(e,t){if(ye(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ye(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tu(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&&Yt(e,t)}function Yt(e,t){return Yt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Yt(e,t)}function ru(e){var t=iu();return function(){var n=ut(e),o;if(t){var i=ut(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return nu(this,o)}}function nu(e,t){if(t&&(ye(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ou(e)}function ou(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function iu(){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}}function ut(e){return ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ut(e)}Sn=Symbol.toStringTag;var ft=function(e){tu(r,e);var t=ru(r);function r(o){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ja(this,r),i=t.call(this,o,a,r.defaultProps),i.width=void 0,i.height=void 0,i.colorAttachments=[],i.depthStencilAttachment=null,i.width=i.props.width,i.height=i.props.height,i}var n=r.prototype;return n.resize=function(i){var a=!i;if(i){var s=Array.isArray(i)?i:[i.width,i.height],c=$a(s,2),h=c[0],v=c[1];a=a||v!==this.height||h!==this.width,this.width=h,this.height=v}a&&(S.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(this.width,"x").concat(this.height))(),this.resizeAttachments(this.width,this.height))},n.autoCreateAttachmentTextures=function(){var i=this;if(this.colorAttachments=this.props.colorAttachments.map(function(s){if(typeof s=="string"){var c=i.createColorTexture(s);return i.attachResource(c),c}return s}),this.props.depthStencilAttachment)if(typeof this.props.depthStencilAttachment=="string"){var a=this.createDepthStencilTexture(this.props.depthStencilAttachment);this.attachResource(a),this.depthStencilAttachment=a}else this.depthStencilAttachment=this.props.depthStencilAttachment},n.createColorTexture=function(i){return this.device.createTexture({id:"color-attachment",usage:V.RENDER_ATTACHMENT,format:i,width:this.width,height:this.height})},n.createDepthStencilTexture=function(i){return this.device.createTexture({id:"depth-stencil-attachment",usage:V.RENDER_ATTACHMENT,format:i,width:this.width,height:this.height})},n.resizeAttachments=function(i,a){for(var s=0;s<this.colorAttachments.length;++s)if(this.colorAttachments[s]){var c=this.device._createTexture(de(de({},this.colorAttachments[s].props),{},{width:i,height:a}));this.destroyAttachedResource(this.colorAttachments[s]),this.colorAttachments[s]=c,this.attachResource(c)}if(this.depthStencilAttachment){var h=this.device._createTexture(de(de({},this.depthStencilAttachment.props),{},{width:i,height:a}));this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=h,this.attachResource(h)}},Qa(r,[{key:Sn,get:function(){return"Framebuffer"}}]),r}(E);ft.defaultProps=de(de({},E.defaultProps),{},{width:1,height:1,colorAttachments:[],depthStencilAttachment:null});function me(e){return me=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},me(e)}var Rn;function jn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).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?jn(Object(r),!0).forEach(function(n){au(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function au(e,t,r){return t=An(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xn(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,An(n.key),n)}}function fu(e,t,r){return t&&xn(e.prototype,t),r&&xn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function An(e){var t=cu(e,"string");return me(t)==="symbol"?t:String(t)}function cu(e,t){if(me(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(me(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function su(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&&Xt(e,t)}function Xt(e,t){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Xt(e,t)}function lu(e){var t=du();return function(){var n=ct(e),o;if(t){var i=ct(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return pu(this,o)}}function pu(e,t){if(t&&(me(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hu(e)}function hu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function du(){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}}function ct(e){return ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ct(e)}Rn=Symbol.toStringTag;var st=function(e){su(r,e);var t=lu(r);function r(n,o){var i;return uu(this,r),i=t.call(this,n,o,r.defaultProps),i.hash="",i.vs=void 0,i.fs=void 0,i.shaderLayout=void 0,i.bufferLayout=void 0,i.shaderLayout=i.props.shaderLayout,i.bufferLayout=i.props.bufferLayout||[],i}return fu(r,[{key:Rn,get:function(){return"RenderPipeline"}}]),r}(E);st.defaultProps=En(En({},E.defaultProps),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});function ve(e){return ve=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},ve(e)}var Dn;function In(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Bn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?In(Object(r),!0).forEach(function(n){yu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):In(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yu(e,t,r){return t=Nn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ln(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,Nn(n.key),n)}}function vu(e,t,r){return t&&Ln(e.prototype,t),r&&Ln(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nn(e){var t=bu(e,"string");return ve(t)==="symbol"?t:String(t)}function bu(e,t){if(ve(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ve(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gu(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&&qt(e,t)}function qt(e,t){return qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},qt(e,t)}function wu(e){var t=Pu();return function(){var n=lt(e),o;if(t){var i=lt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _u(this,o)}}function _u(e,t){if(t&&(ve(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ou(e)}function Ou(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pu(){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}}function lt(e){return lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},lt(e)}Dn=Symbol.toStringTag;var pt=function(e){gu(r,e);var t=wu(r);function r(n,o){var i;return mu(this,r),i=t.call(this,n,o,r.defaultProps),i.hash="",i}return vu(r,[{key:Dn,get:function(){return"ComputePipeline"}}]),r}(E);pt.defaultProps=Bn(Bn({},E.defaultProps),{},{cs:void 0,csEntryPoint:void 0,csConstants:{},shaderLayout:[]});function be(e){return be=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},be(e)}var Mn;function Gn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Cn(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){Su(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}function Su(e,t,r){return t=Un(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kn(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,Un(n.key),n)}}function ju(e,t,r){return t&&kn(e.prototype,t),r&&kn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Un(e){var t=Eu(e,"string");return be(t)==="symbol"?t:String(t)}function Eu(e,t){if(be(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(be(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xu(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&&Zt(e,t)}function Zt(e,t){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Zt(e,t)}function Ru(e){var t=Bu();return function(){var n=ht(e),o;if(t){var i=ht(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Au(this,o)}}function Au(e,t){if(t&&(be(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Iu(e)}function Iu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bu(){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}}function ht(e){return ht=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ht(e)}Mn=Symbol.toStringTag;var dt=function(e){xu(r,e);var t=Ru(r);function r(n,o){return Tu(this,r),t.call(this,n,o,r.defaultProps)}return ju(r,[{key:Mn,get:function(){return"RenderPass"}}]),r}(E);dt.defaultProps=Cn(Cn({},E.defaultProps),{},{framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1});function ge(e){return ge=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},ge(e)}var zn;function Fn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Lu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fn(Object(r),!0).forEach(function(n){Du(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Du(e,t,r){return t=Vn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wn(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,Vn(n.key),n)}}function Gu(e,t,r){return t&&Wn(e.prototype,t),r&&Wn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vn(e){var t=Cu(e,"string");return ge(t)==="symbol"?t:String(t)}function Cu(e,t){if(ge(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ge(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ku(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&&Jt(e,t)}function Jt(e,t){return Jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Jt(e,t)}function Mu(e){var t=Wu();return function(){var n=yt(e),o;if(t){var i=yt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Uu(this,o)}}function Uu(e,t){if(t&&(ge(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fu(e)}function Fu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wu(){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}}function yt(e){return yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},yt(e)}zn=Symbol.toStringTag;var mt=function(e){ku(r,e);var t=Mu(r);function r(n,o){return Nu(this,r),t.call(this,n,o,E.defaultProps)}return Gu(r,[{key:zn,get:function(){return"ComputePass"}}]),r}(E);mt.defaultProps=Lu({},E.defaultProps);function zu(e,t){return $u(e)||Ku(e,t)||Hu(e,t)||Vu()}function Vu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
21
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hu(e,t){if(e){if(typeof e=="string")return Hn(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 Hn(e,t)}}function Hn(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 Ku(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function $u(e){if(Array.isArray(e))return e}function Kn(e){var t=zu(Xu[e],2),r=t[0],n=t[1],o=r==="i32"||r==="u32",i=r!=="u32",a=qu[r]*n,s=Yu(r,n);return{dataType:r,components:n,defaultVertexFormat:s,byteLength:a,integer:o,signed:i}}function Yu(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 Xu={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]},qu={f32:4,f16:2,i32:4,u32:4};function Yn(e){var t=$n[e],r=Zu(t),n=e.includes("norm"),o=!n&&!e.startsWith("float"),i=e.startsWith("s");return{dataType:$n[e],byteLength:r,integer:o,signed:i,normalized:n}}function Zu(e){var t=Ju[e];return t}var $n={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Ju={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};function Qu(e,t){return nf(e)||rf(e,t)||tf(e,t)||ef()}function ef(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
22
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tf(e,t){if(e){if(typeof e=="string")return Xn(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 Xn(e,t)}}function Xn(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 rf(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function nf(e){if(Array.isArray(e))return e}function q(e){var t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);var r=e.split("x"),n=Qu(r,2),o=n[0],i=n[1],a=o,s=i?parseInt(i):1,c=Yn(a),h={type:a,components:s,byteLength:c.byteLength*s,integer:c.integer,signed:c.signed,normalized:c.normalized};return t&&(h.webglOnly=!0),h}function Fe(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=of(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(h){throw h},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
23
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var h=r.next();return i=h.done,h},e:function(h){a=!0,s=h},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function of(e,t){if(e){if(typeof e=="string")return qn(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 qn(e,t)}}function qn(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 af(e,t){var r={},n=Fe(e.attributes),o;try{for(n.s();!(o=n.n()).done;){var i=o.value;r[i.name]=uf(e,t,i.name)}}catch(a){n.e(a)}finally{n.f()}return r}function Zn(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:16,n=af(e,t),o=new Array(r).fill(null),i=0,a=Object.values(n);i<a.length;i++){var s=a[i];o[s.location]=s}return o}function uf(e,t,r){var n=ff(e,r),o=cf(t,r);if(!n)return null;var i=Kn(n.type),a=o?.vertexFormat||i.defaultVertexFormat,s=q(a);return{attributeName:o?.attributeName||n.name,bufferName:o?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:i.dataType,shaderComponents:i.components,vertexFormat:a,bufferDataType:s.type,bufferComponents:s.components,normalized:s.normalized,integer:i.integer,stepMode:o?.stepMode||n.stepMode,byteOffset:o?.byteOffset||0,byteStride:o?.byteStride||0}}function ff(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||S.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function cf(e,t){sf(e);var r=lf(e,t);return r||(r=pf(e,t),r)?r:(S.warn('layout for attribute "'.concat(t,'" not present in buffer layout')),null)}function sf(e){var t=Fe(e),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;(n.attributes&&n.format||!n.attributes&&!n.format)&&S.warn("BufferLayout ".concat(name," must have either 'attributes' or 'format' field"))}}catch(o){t.e(o)}finally{t.f()}}function lf(e,t){var r=Fe(e),n;try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.format&&o.name===t)return{attributeName:o.name,bufferName:t,stepMode:o.stepMode,vertexFormat:o.format,byteOffset:0,byteStride:o.byteStride||0}}}catch(i){r.e(i)}finally{r.f()}return null}function pf(e,t){var r=Fe(e),n;try{for(r.s();!(n=r.n()).done;){var o,i=n.value,a=i.byteStride;if(typeof i.byteStride!="number"){var s=Fe(i.attributes||[]),c;try{for(s.s();!(c=s.n()).done;){var h=c.value,v=q(h.format);a+=v.byteLength}}catch(g){s.e(g)}finally{s.f()}}var m=(o=i.attributes)===null||o===void 0?void 0:o.find(function(g){return g.attribute===t});if(m)return{attributeName:m.attribute,bufferName:i.name,stepMode:i.stepMode,vertexFormat:m.format,byteOffset:m.byteOffset,byteStride:a}}}catch(g){r.e(g)}finally{r.f()}return null}function we(e){return we=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},we(e)}var to;function Jn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Qn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jn(Object(r),!0).forEach(function(n){hf(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hf(e,t,r){return t=ro(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function df(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function eo(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,ro(n.key),n)}}function yf(e,t,r){return t&&eo(e.prototype,t),r&&eo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ro(e){var t=mf(e,"string");return we(t)==="symbol"?t:String(t)}function mf(e,t){if(we(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(we(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vf(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&&Qt(e,t)}function Qt(e,t){return Qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Qt(e,t)}function bf(e){var t=_f();return function(){var n=vt(e),o;if(t){var i=vt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return gf(this,o)}}function gf(e,t){if(t&&(we(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wf(e)}function wf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _f(){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}}function vt(e){return vt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vt(e)}to=Symbol.toStringTag;var bt=function(e){vf(r,e);var t=bf(r);function r(n,o){var i;return df(this,r),i=t.call(this,n,o,r.defaultProps),i.maxVertexAttributes=void 0,i.attributeInfos=void 0,i.indexBuffer=null,i.attributes=void 0,i.maxVertexAttributes=n.limits.maxVertexAttributes,i.attributes=new Array(i.maxVertexAttributes).fill(null),i.attributeInfos=Zn(o.renderPipeline.shaderLayout,o.renderPipeline.bufferLayout,i.maxVertexAttributes),i}return yf(r,[{key:to,get:function(){return"VertexArray"}}]),r}(E);bt.defaultProps=Qn(Qn({},E.defaultProps),{},{renderPipeline:null});function te(e){return te=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},te(e)}function er(){"use strict";er=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,f){l[u]=f.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(l,u,f){return Object.defineProperty(l,u,{value:f,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{c({},"")}catch{c=function(f,p,y){return f[p]=y}}function h(l,u,f,p){var y=u&&u.prototype instanceof g?u:g,d=Object.create(y.prototype),b=new I(p||[]);return n(d,"_invoke",{value:F(l,f,b)}),d}function v(l,u,f){try{return{type:"normal",arg:l.call(u,f)}}catch(p){return{type:"throw",arg:p}}}e.wrap=h;var m={};function g(){}function _(){}function O(){}var B={};c(B,i,function(){return this});var L=Object.getPrototypeOf,A=L&&L(L(k([])));A&&A!==t&&r.call(A,i)&&(B=A);var T=O.prototype=g.prototype=Object.create(B);function D(l){["next","throw","return"].forEach(function(u){c(l,u,function(f){return this._invoke(u,f)})})}function N(l,u){function f(y,d,b,w){var P=v(l[y],l,d);if(P.type!=="throw"){var x=P.arg,j=x.value;return j&&te(j)=="object"&&r.call(j,"__await")?u.resolve(j.__await).then(function(R){f("next",R,b,w)},function(R){f("throw",R,b,w)}):u.resolve(j).then(function(R){x.value=R,b(x)},function(R){return f("throw",R,b,w)})}w(P.arg)}var p;n(this,"_invoke",{value:function(d,b){function w(){return new u(function(P,x){f(d,b,P,x)})}return p=p?p.then(w,w):w()}})}function F(l,u,f){var p="suspendedStart";return function(y,d){if(p==="executing")throw new Error("Generator is already running");if(p==="completed"){if(y==="throw")throw d;return z()}for(f.method=y,f.arg=d;;){var b=f.delegate;if(b){var w=U(b,f);if(w){if(w===m)continue;return w}}if(f.method==="next")f.sent=f._sent=f.arg;else if(f.method==="throw"){if(p==="suspendedStart")throw p="completed",f.arg;f.dispatchException(f.arg)}else f.method==="return"&&f.abrupt("return",f.arg);p="executing";var P=v(l,u,f);if(P.type==="normal"){if(p=f.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:f.done}}P.type==="throw"&&(p="completed",f.method="throw",f.arg=P.arg)}}}function U(l,u){var f=u.method,p=l.iterator[f];if(p===void 0)return u.delegate=null,f==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,U(l,u),u.method==="throw")||f!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+f+"' method")),m;var y=v(p,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function W(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function C(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function I(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(W,this),this.reset(!0)}function k(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var f=-1,p=function y(){for(;++f<l.length;)if(r.call(l,f))return y.value=l[f],y.done=!1,y;return y.value=void 0,y.done=!0,y};return p.next=p}}return{next:z}}function z(){return{value:void 0,done:!0}}return _.prototype=O,n(T,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:_,configurable:!0}),_.displayName=c(O,s,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===_||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,c(l,s,"GeneratorFunction")),l.prototype=Object.create(T),l},e.awrap=function(l){return{__await:l}},D(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,f,p,y){y===void 0&&(y=Promise);var d=new N(h(l,u,f,p),y);return e.isGeneratorFunction(u)?d:d.next().then(function(b){return b.done?b.value:d.next()})},D(T),c(T,s,"Generator"),c(T,i,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),f=[];for(var p in u)f.push(p);return f.reverse(),function y(){for(;f.length;){var d=f.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=k,I.prototype={constructor:I,reset:function(u){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(C),!u)for(var f in this)f.charAt(0)==="t"&&r.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var f=this;function p(x,j){return b.type="throw",b.arg=u,f.next=x,j&&(f.method="next",f.arg=void 0),!!j}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],b=d.completion;if(d.tryLoc==="root")return p("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return p(d.catchLoc,!0);if(this.prev<d.finallyLoc)return p(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return p(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return p(d.finallyLoc)}}}},abrupt:function(u,f){for(var p=this.tryEntries.length-1;p>=0;--p){var y=this.tryEntries[p];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=f&&f<=d.finallyLoc&&(d=null);var b=d?d.completion:{};return b.type=u,b.arg=f,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(b)},complete:function(u,f){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&f&&(this.next=f),m},finish:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.finallyLoc===u)return this.complete(p.completion,p.afterLoc),C(p),m}},catch:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.tryLoc===u){var y=p.completion;if(y.type==="throw"){var d=y.arg;C(p)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,f,p){return this.delegate={iterator:k(u),resultName:f,nextLoc:p},this.method==="next"&&(this.arg=void 0),m}},e}function no(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(h){r(h);return}s.done?t(c):Promise.resolve(c).then(n,o)}function Of(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(c){no(i,n,o,a,s,"next",c)}function s(c){no(i,n,o,a,s,"throw",c)}a(void 0)})}}function oo(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,Sf(n.key),n)}}function Pf(e,t,r){return t&&oo(e.prototype,t),r&&oo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sf(e){var t=Tf(e,"string");return te(t)==="symbol"?t:String(t)}function Tf(e,t){if(te(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(te(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ef(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&&tr(e,t)}function tr(e,t){return tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},tr(e,t)}function xf(e){var t=If();return function(){var n=gt(e),o;if(t){var i=gt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Rf(this,o)}}function Rf(e,t){if(t&&(te(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Af(e)}function Af(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function If(){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}}function gt(e){return gt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},gt(e)}function Bf(e){var t;return e.byteLength||((t=e.data)===null||t===void 0?void 0:t.byteLength)||0}var wt=function(e){Ef(r,e);var t=xf(r);function r(o,i){var a;jf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.byteLength=void 0,a.device=o,a.byteLength=Bf(i);var s=Boolean(i.data),c=Math.ceil(a.byteLength/4)*4;return a.handle=a.props.handle||a.device.handle.createBuffer({size:c,usage:a.props.usage||GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,mappedAtCreation:a.props.mappedAtCreation||s,label:a.props.id}),i.data&&a._writeMapped(i.data),s&&!i.mappedAtCreation&&a.handle.unmap(),a}var n=r.prototype;return n.destroy=function(){this.handle.destroy()},n.write=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.device.handle.queue.writeBuffer(this.handle,a,i.buffer,i.byteOffset,i.byteLength)},n.readAsync=function(){var o=Of(er().mark(function a(){var s,c,h,v,m,g=arguments;return er().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return s=g.length>0&&g[0]!==void 0?g[0]:0,c=g.length>1&&g[1]!==void 0?g[1]:this.byteLength,h=new r(this.device,{usage:G.MAP_READ|G.COPY_DST,byteLength:c}),v=this.device.handle.createCommandEncoder(),v.copyBufferToBuffer(this.handle,s,h.handle,0,c),this.device.handle.queue.submit([v.finish()]),O.next=8,h.handle.mapAsync(GPUMapMode.READ,s,c);case 8:return m=h.handle.getMappedRange().slice(0),h.handle.unmap(),h.destroy(),O.abrupt("return",new Uint8Array(m));case 12:case"end":return O.stop()}},a,this)}));function i(){return o.apply(this,arguments)}return i}(),n._writeMapped=function(i){var a=this.handle.getMappedRange();new i.constructor(a).set(i)},n.mapAsync=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=arguments.length>2?arguments[2]:void 0;return this.handle.mapAsync(i,a,s)},n.getMappedRange=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=arguments.length>1?arguments[1]:void 0;return this.handle.getMappedRange(i,a)},n.unmap=function(){this.handle.unmap()},Pf(r)}(G);function _e(e){if(e.includes("webgl"))throw new Error("webgl-only format");return e}function Oe(e){return Oe=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},Oe(e)}function io(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Lf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?io(Object(r),!0).forEach(function(n){Df(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):io(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Df(e,t,r){return t=uo(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ao(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,uo(n.key),n)}}function Nf(e,t,r){return t&&ao(e.prototype,t),r&&ao(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function uo(e){var t=Gf(e,"string");return Oe(t)==="symbol"?t:String(t)}function Gf(e,t){if(Oe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Oe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Cf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kf(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&&rr(e,t)}function rr(e,t){return rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},rr(e,t)}function Mf(e){var t=Wf();return function(){var n=_t(e),o;if(t){var i=_t(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Uf(this,o)}}function Uf(e,t){if(t&&(Oe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ff(e)}function Ff(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wf(){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}}function _t(e){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},_t(e)}var K=function(e){kf(r,e);var t=Mf(r);function r(o,i){var a;Cf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o;var s=Lf({},a.props);return s.type!=="comparison-sampler"&&delete s.compare,a.handle=a.handle||a.device.handle.createSampler(s),a.handle.label=a.props.id,a}var n=r.prototype;return n.destroy=function(){},Nf(r)}(he);function Pe(e){return Pe=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},Pe(e)}function fo(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,Vf(n.key),n)}}function zf(e,t,r){return t&&fo(e.prototype,t),r&&fo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vf(e){var t=Hf(e,"string");return Pe(t)==="symbol"?t:String(t)}function Hf(e,t){if(Pe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $f(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&&nr(e,t)}function nr(e,t){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},nr(e,t)}function Yf(e){var t=Zf();return function(){var n=Ot(e),o;if(t){var i=Ot(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Xf(this,o)}}function Xf(e,t){if(t&&(Pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qf(e)}function qf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zf(){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}}function Ot(e){return Ot=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ot(e)}var Jf={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},Pt=function(e){$f(r,e);var t=Yf(r);function r(o,i){var a;if(Kf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.view=void 0,a.sampler=void 0,a.height=1,a.width=1,typeof a.props.format=="number")throw new Error("number format");return a.device=o,a.handle=a.props.handle||a.createHandle(),a.props.data&&a.setData({data:a.props.data}),a.width=a.handle.width,a.height=a.handle.height,a.sampler=i.sampler instanceof K?i.sampler:new K(a.device,i.sampler),a.view=a.handle.createView({}),a}var n=r.prototype;return n.createHandle=function(){var i,a;if(typeof this.props.format=="number")throw new Error("number format");var s=this.props.width||((i=this.props.data)===null||i===void 0?void 0:i.width)||1,c=this.props.height||((a=this.props.data)===null||a===void 0?void 0:a.height)||1;return this.device.handle.createTexture({size:{width:s,height:c,depthOrArrayLayers:this.props.depth},dimension:Jf[this.props.dimension],format:_e(this.props.format),usage:this.props.usage,mipLevelCount:this.props.mipLevels,sampleCount:this.props.samples})},n.destroy=function(){this.handle.destroy()},n.setSampler=function(i){return this.sampler=i instanceof K?i:new K(this.device,i),this},n.setData=function(i){return this.setImage({source:i.data})},n.setImage=function(i){var a=i.source,s=i.width,c=s===void 0?i.source.width:s,h=i.height,v=h===void 0?i.source.height:h,m=i.depth,g=m===void 0?1:m,_=i.sourceX,O=_===void 0?0:_,B=i.sourceY,L=B===void 0?0:B,A=i.mipLevel,T=A===void 0?0:A,D=i.x,N=D===void 0?0:D,F=i.y,U=F===void 0?0:F,W=i.z,C=W===void 0?0:W,I=i.aspect,k=I===void 0?"all":I,z=i.colorSpace,l=z===void 0?"srgb":z,u=i.premultipliedAlpha,f=u===void 0?!1:u;return this.device.handle.queue.copyExternalImageToTexture({source:a,origin:[O,L]},{texture:this.handle,origin:[N,U,C],mipLevel:T,aspect:k,colorSpace:l,premultipliedAlpha:f},[c,v,g]),{width:c,height:v}},zf(r)}(V);function Se(e){return Se=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},Se(e)}function co(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,ec(n.key),n)}}function Qf(e,t,r){return t&&co(e.prototype,t),r&&co(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ec(e){var t=tc(e,"string");return Se(t)==="symbol"?t:String(t)}function tc(e,t){if(Se(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Se(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nc(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&&or(e,t)}function or(e,t){return or=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},or(e,t)}function oc(e){var t=uc();return function(){var n=St(e),o;if(t){var i=St(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return ic(this,o)}}function ic(e,t){if(t&&(Se(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ac(e)}function ac(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uc(){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}}function St(e){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},St(e)}var so=function(e){nc(r,e);var t=oc(r);function r(o,i){var a;return rc(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.sampler=void 0,a.device=o,a.handle=a.props.handle||a.device.handle.importExternalTexture({source:i.source,colorSpace:i.colorSpace}),a.sampler=null,a}var n=r.prototype;return n.destroy=function(){},n.setSampler=function(i){return this.sampler=i instanceof K?i:new K(this.device,i),this},Qf(r)}(nt);function re(e){return re=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},re(e)}function We(){"use strict";We=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,f){l[u]=f.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(l,u,f){return Object.defineProperty(l,u,{value:f,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{c({},"")}catch{c=function(f,p,y){return f[p]=y}}function h(l,u,f,p){var y=u&&u.prototype instanceof g?u:g,d=Object.create(y.prototype),b=new I(p||[]);return n(d,"_invoke",{value:F(l,f,b)}),d}function v(l,u,f){try{return{type:"normal",arg:l.call(u,f)}}catch(p){return{type:"throw",arg:p}}}e.wrap=h;var m={};function g(){}function _(){}function O(){}var B={};c(B,i,function(){return this});var L=Object.getPrototypeOf,A=L&&L(L(k([])));A&&A!==t&&r.call(A,i)&&(B=A);var T=O.prototype=g.prototype=Object.create(B);function D(l){["next","throw","return"].forEach(function(u){c(l,u,function(f){return this._invoke(u,f)})})}function N(l,u){function f(y,d,b,w){var P=v(l[y],l,d);if(P.type!=="throw"){var x=P.arg,j=x.value;return j&&re(j)=="object"&&r.call(j,"__await")?u.resolve(j.__await).then(function(R){f("next",R,b,w)},function(R){f("throw",R,b,w)}):u.resolve(j).then(function(R){x.value=R,b(x)},function(R){return f("throw",R,b,w)})}w(P.arg)}var p;n(this,"_invoke",{value:function(d,b){function w(){return new u(function(P,x){f(d,b,P,x)})}return p=p?p.then(w,w):w()}})}function F(l,u,f){var p="suspendedStart";return function(y,d){if(p==="executing")throw new Error("Generator is already running");if(p==="completed"){if(y==="throw")throw d;return z()}for(f.method=y,f.arg=d;;){var b=f.delegate;if(b){var w=U(b,f);if(w){if(w===m)continue;return w}}if(f.method==="next")f.sent=f._sent=f.arg;else if(f.method==="throw"){if(p==="suspendedStart")throw p="completed",f.arg;f.dispatchException(f.arg)}else f.method==="return"&&f.abrupt("return",f.arg);p="executing";var P=v(l,u,f);if(P.type==="normal"){if(p=f.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:f.done}}P.type==="throw"&&(p="completed",f.method="throw",f.arg=P.arg)}}}function U(l,u){var f=u.method,p=l.iterator[f];if(p===void 0)return u.delegate=null,f==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,U(l,u),u.method==="throw")||f!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+f+"' method")),m;var y=v(p,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function W(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function C(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function I(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(W,this),this.reset(!0)}function k(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var f=-1,p=function y(){for(;++f<l.length;)if(r.call(l,f))return y.value=l[f],y.done=!1,y;return y.value=void 0,y.done=!0,y};return p.next=p}}return{next:z}}function z(){return{value:void 0,done:!0}}return _.prototype=O,n(T,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:_,configurable:!0}),_.displayName=c(O,s,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===_||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,c(l,s,"GeneratorFunction")),l.prototype=Object.create(T),l},e.awrap=function(l){return{__await:l}},D(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,f,p,y){y===void 0&&(y=Promise);var d=new N(h(l,u,f,p),y);return e.isGeneratorFunction(u)?d:d.next().then(function(b){return b.done?b.value:d.next()})},D(T),c(T,s,"Generator"),c(T,i,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),f=[];for(var p in u)f.push(p);return f.reverse(),function y(){for(;f.length;){var d=f.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=k,I.prototype={constructor:I,reset:function(u){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(C),!u)for(var f in this)f.charAt(0)==="t"&&r.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var f=this;function p(x,j){return b.type="throw",b.arg=u,f.next=x,j&&(f.method="next",f.arg=void 0),!!j}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],b=d.completion;if(d.tryLoc==="root")return p("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return p(d.catchLoc,!0);if(this.prev<d.finallyLoc)return p(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return p(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return p(d.finallyLoc)}}}},abrupt:function(u,f){for(var p=this.tryEntries.length-1;p>=0;--p){var y=this.tryEntries[p];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=f&&f<=d.finallyLoc&&(d=null);var b=d?d.completion:{};return b.type=u,b.arg=f,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(b)},complete:function(u,f){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&f&&(this.next=f),m},finish:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.finallyLoc===u)return this.complete(p.completion,p.afterLoc),C(p),m}},catch:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.tryLoc===u){var y=p.completion;if(y.type==="throw"){var d=y.arg;C(p)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,f,p){return this.delegate={iterator:k(u),resultName:f,nextLoc:p},this.method==="next"&&(this.arg=void 0),m}},e}function lo(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(h){r(h);return}s.done?t(c):Promise.resolve(c).then(n,o)}function po(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(c){lo(i,n,o,a,s,"next",c)}function s(c){lo(i,n,o,a,s,"throw",c)}a(void 0)})}}function ho(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,cc(n.key),n)}}function fc(e,t,r){return t&&ho(e.prototype,t),r&&ho(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function cc(e){var t=sc(e,"string");return re(t)==="symbol"?t:String(t)}function sc(e,t){if(re(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(re(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pc(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&&ir(e,t)}function ir(e,t){return ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ir(e,t)}function hc(e){var t=mc();return function(){var n=Tt(e),o;if(t){var i=Tt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return dc(this,o)}}function dc(e,t){if(t&&(re(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yc(e)}function yc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mc(){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}}function Tt(e){return Tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Tt(e)}var jt=function(e){pc(r,e);var t=hc(r);function r(o,i){var a;return lc(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o,a.device.handle.pushErrorScope("validation"),a.handle=a.props.handle||a.createHandle(),a.handle.label=a.props.id,a._checkCompilationError(a.device.handle.popErrorScope()),a}var n=r.prototype;return n._checkCompilationError=function(){var o=po(We().mark(function a(s){var c,h;return We().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,s;case 2:if(c=m.sent,!c){m.next=9;break}return m.next=6,this.getCompilationInfo();case 6:throw h=m.sent,S.error("Shader compilation error: ".concat(c.message),h)(),new Error("Shader compilation error: ".concat(c.message));case 9:case"end":return m.stop()}},a,this)}));function i(a){return o.apply(this,arguments)}return i}(),n.destroy=function(){},n.getCompilationInfo=function(){var o=po(We().mark(function a(){var s;return We().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.handle.getCompilationInfo();case 2:return s=h.sent,h.abrupt("return",s.messages);case 4:case"end":return h.stop()}},a,this)}));function i(){return o.apply(this,arguments)}return i}(),n.createHandle=function(){var i=this,a=this.props,s=a.source,c=a.stage,h=this.props.language;switch(h==="auto"&&(h=s.includes("->")?"wgsl":"glsl"),h){case"wgsl":return this.device.handle.createShaderModule({code:s});case"glsl":return this.device.handle.createShaderModule({code:s,transform:function(m){return i.device.glslang.compileGLSL(m,c)}});default:throw new Error(h)}},fc(r)}(it);function ze(e){return ze=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},ze(e)}function vc(e,t){return _c(e)||wc(e,t)||gc(e,t)||bc()}function bc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
24
24
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gc(e,t){if(e){if(typeof e=="string")return yo(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 yo(e,t)}}function yo(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 wc(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function _c(e){if(Array.isArray(e))return e}function mo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).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?mo(Object(r),!0).forEach(function(n){Oc(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Oc(e,t,r){return t=Pc(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pc(e){var t=Sc(e,"string");return ze(t)==="symbol"?t:String(t)}function Sc(e,t){if(ze(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ze(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $(e){return e.depthStencil=e.depthStencil||{format:"depth24plus",stencilFront:{},stencilBack:{},depthWriteEnabled:!1,depthCompare:"less-equal"},e.depthStencil}var Tc={cullMode:function(t,r,n){n.primitive=n.primitive||{},n.primitive.cullMode=r},frontFace:function(t,r,n){n.primitive=n.primitive||{},n.primitive.frontFace=r},depthWriteEnabled:function(t,r,n){var o=$(n);o.depthWriteEnabled=r},depthCompare:function(t,r,n){var o=$(n);o.depthCompare=r},depthFormat:function(t,r,n){var o=$(n);o.format=r},depthBias:function(t,r,n){var o=$(n);o.depthBias=r},depthBiasSlopeScale:function(t,r,n){var o=$(n);o.depthBiasSlopeScale=r},depthBiasClamp:function(t,r,n){var o=$(n);o.depthBiasClamp=r},stencilReadMask:function(t,r,n){var o=$(n);o.stencilReadMask=r},stencilWriteMask:function(t,r,n){var o=$(n);o.stencilWriteMask=r},stencilCompare:function(t,r,n){var o=$(n);o.stencilFront.compare=r,o.stencilBack.compare=r},stencilPassOperation:function(t,r,n){var o=$(n);o.stencilFront.passOp=r,o.stencilBack.passOp=r},stencilFailOperation:function(t,r,n){var o=$(n);o.stencilFront.failOp=r,o.stencilBack.failOp=r},stencilDepthFailOperation:function(t,r,n){var o=$(n);o.stencilFront.depthFailOp=r,o.stencilBack.depthFailOp=r},sampleCount:function(t,r,n){n.multisample=n.multisample||{},n.multisample.count=r},sampleMask:function(t,r,n){n.multisample=n.multisample||{},n.multisample.mask=r},sampleAlphaToCoverageEnabled:function(t,r,n){n.multisample=n.multisample||{},n.multisample.alphaToCoverageEnabled=r},colorMask:function(t,r,n){var o=bo(n);o[0].writeMask=r},blendColorOperation:function(t,r,n){bo(n)}},jc={primitive:{cullMode:"back",topology:"triangle-list"},vertex:{module:void 0,entryPoint:"main"},fragment:{module:void 0,entryPoint:"main",targets:[]},layout:"auto"};function go(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Object.assign(e,vo(vo({},jc),e)),Ec(e,t)}function Ec(e,t){for(var r=0,n=Object.entries(t);r<n.length;r++){var o=vc(n[r],2),i=o[0],a=o[1],s=Tc[i];if(!s)throw new Error("Illegal parameter ".concat(i));s(i,a,e)}}function bo(e){var t,r,n,o;if(e.fragment.targets=((t=e.fragment)===null||t===void 0?void 0:t.targets)||[],!Array.isArray((r=e.fragment)===null||r===void 0?void 0:r.targets))throw new Error("colorstate");if(((n=e.fragment)===null||n===void 0||(n=n.targets)===null||n===void 0?void 0:n.length)===0){var i;(i=e.fragment.targets)===null||i===void 0||i.push({})}return(o=e.fragment)===null||o===void 0?void 0:o.targets}function xc(e,t){return Bc(e)||Ic(e,t)||Ac(e,t)||Rc()}function Rc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
25
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ac(e,t){if(e){if(typeof e=="string")return wo(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 wo(e,t)}}function wo(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 Ic(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function Bc(e){if(Array.isArray(e))return e}function Oo(e,t,r,n){var o=Dc(n,r);return e.createBindGroup({layout:t,entries:o})}function Lc(e,t){var r=e.bindings.find(function(n){return n.name===t});return r||S.warn("Binding ".concat(t," not set: Not found in shader layout."))(),r}function Dc(e,t){for(var r=[],n=0,o=Object.entries(e);n<o.length;n++){var i=xc(o[n],2),a=i[0],s=i[1],c=Lc(t,a);c&&r.push(Nc(s,c.location))}return r}function Nc(e,t){if(e instanceof
|
|
26
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var h=r.next();return i=h.done,h},e:function(h){a=!0,s=h},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Gc(e,t){if(e){if(typeof e=="string")return Po(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 Po(e,t)}}function Po(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 ar(e){if(e.endsWith("-webgl"))throw new Error("WebGPU does not support vertex format ".concat(e));return e}function To(e,t){var r=[],n=new Set,o=Te(t),i;try{for(o.s();!(i=o.n()).done;){var a=i.value,s=[],c="vertex",h=0;if(a.attributes){var v=Te(a.attributes),m;try{for(v.s();!(m=v.n()).done;){var g=m.value,_=g.attribute,O=So(e,_,n);c=O.stepMode||"vertex",s.push({format:ar(g.format||a.format),offset:g.byteOffset,shaderLocation:O.location}),h+=
|
|
27
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mc(e,t){if(e){if(typeof e=="string")return Eo(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 Eo(e,t)}}function Eo(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 Uc(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function Fc(e){if(Array.isArray(e))return e}function xo(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,zc(n.key),n)}}function Wc(e,t,r){return t&&xo(e.prototype,t),r&&xo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function zc(e){var t=Vc(e,"string");return je(t)==="symbol"?t:String(t)}function Vc(e,t){if(je(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(je(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kc(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&&ur(e,t)}function ur(e,t){return ur=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ur(e,t)}function $c(e){var t=Xc();return function(){var n=Et(e),o;if(t){var i=Et(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Yc(this,o)}}function Yc(e,t){if(t&&(je(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qc(e)}function qc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xc(){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}}function Et(e){return Et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Et(e)}var Ro=function(e){Kc(r,e);var t=$c(r);function r(o,i){var a;if(Hc(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.vs=void 0,a.fs=null,a._bufferSlots=void 0,a._buffers=void 0,a._indexBuffer=null,a._bindGroupLayout=null,a._bindGroup=null,a.device=o,a.handle=a.props.handle,!a.handle){var s=a._getRenderPipelineDescriptor();S.groupCollapsed(1,"new WebGPURenderPipeline(".concat(a.id,")"))(),S.probe(1,JSON.stringify(s,null,2))(),S.groupEnd(1)(),a.handle=a.device.handle.createRenderPipeline(s)}return a.handle.label=a.props.id,a.vs=i.vs,a.fs=i.fs,a._bufferSlots=jo(a.props.shaderLayout,a.props.bufferLayout),a._buffers=new Array(Object.keys(a._bufferSlots).length).fill(null),a}var n=r.prototype;return n.destroy=function(){},n.setIndexBuffer=function(i){this._indexBuffer=i},n.setAttributes=function(i){for(var a=0,s=Object.entries(i);a<s.length;a++){var c=Cc(s[a],2),h=c[0],v=c[1],m=this._bufferSlots[h];if(m>=0)this._buffers[m]=v;else throw new Error("Setting attribute '".concat(h,"' not listed in shader layout for program ").concat(this.id))}},n.setConstantAttributes=function(i){throw new Error("not implemented")},n.setBindings=function(i){Ze(this.props.bindings)||(Object.assign(this.props.bindings,i),this._bindGroupLayout=this._bindGroupLayout||this.handle.getBindGroupLayout(0),this._bindGroup=Oo(this.device.handle,this._bindGroupLayout,this.props.shaderLayout,this.props.bindings))},n.setUniforms=function(i){if(!Ze(i))throw new Error("WebGPU does not support uniforms")},n._getBuffers=function(){return this._buffers},n._getBindGroup=function(){return this._bindGroup},n._getRenderPipelineDescriptor=function(){var i={module:this.props.vs.handle,entryPoint:this.props.vsEntryPoint||"main",buffers:To(this.props.shaderLayout,this.props.bufferLayout)},a;if(this.props.fs){var s;a={module:this.props.fs.handle,entryPoint:this.props.fsEntryPoint||"main",targets:[{format:_e((s=this.device)===null||s===void 0||(s=s.canvasContext)===null||s===void 0?void 0:s.format)}]}}switch(this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":throw new Error("WebGPU does not support primitive topology ".concat(this.props.topology));default:}var c={vertex:i,fragment:a,primitive:{topology:this.props.topology},layout:"auto"};return go(c,this.props.parameters),c},n.draw=function(i){var a=i.renderPass||this.device.getDefaultRenderPass();a.handle.setPipeline(this.handle);var s=this._getBindGroup();s&&a.handle.setBindGroup(0,s),this._setAttributeBuffers(a),i.indexCount?a.handle.drawIndexed(i.indexCount,i.instanceCount,i.firstIndex,i.baseVertex,i.firstInstance):a.handle.draw(i.vertexCount||0,i.instanceCount||1,i.firstInstance)},n._setAttributeBuffers=function(i){var a=this;this._indexBuffer&&i.handle.setIndexBuffer(this._indexBuffer.handle,this._indexBuffer.props.indexType);for(var s=this._getBuffers(),c=function(m){var g=s[m];if(!g){var _=a.props.shaderLayout.attributes.find(function(O){return O.location===m});throw new Error("No buffer provided for attribute '".concat(_?.name||"","' in Model '").concat(a.props.id,"'"))}i.handle.setVertexBuffer(m,g.handle)},h=0;h<s.length;++h)c(h)},Wc(r)}(st);function Ee(e){return Ee=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},Ee(e)}function Ao(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,Jc(n.key),n)}}function Zc(e,t,r){return t&&Ao(e.prototype,t),r&&Ao(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jc(e){var t=Qc(e,"string");return Ee(t)==="symbol"?t:String(t)}function Qc(e,t){if(Ee(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ee(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function es(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ts(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&&fr(e,t)}function fr(e,t){return fr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},fr(e,t)}function rs(e){var t=is();return function(){var n=xt(e),o;if(t){var i=xt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return ns(this,o)}}function ns(e,t){if(t&&(Ee(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return os(e)}function os(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function is(){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}}function xt(e){return xt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},xt(e)}var Io=function(e){ts(r,e);var t=rs(r);function r(o,i){var a;es(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o;var s=a.props.cs;return a.handle=a.props.handle||a.device.handle.createComputePipeline({label:a.props.id,compute:{module:s.handle,entryPoint:a.props.csEntryPoint},layout:"auto"}),a}var n=r.prototype;return n._getBindGroupLayout=function(){return this.handle.getBindGroupLayout(0)},Zc(r)}(pt);function xe(e){return xe=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},xe(e)}function Bo(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,us(n.key),n)}}function as(e,t,r){return t&&Bo(e.prototype,t),r&&Bo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function us(e){var t=fs(e,"string");return xe(t)==="symbol"?t:String(t)}function fs(e,t){if(xe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(xe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ss(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&&cr(e,t)}function cr(e,t){return cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},cr(e,t)}function ls(e){var t=ds();return function(){var n=Rt(e),o;if(t){var i=Rt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return ps(this,o)}}function ps(e,t){if(t&&(xe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hs(e)}function hs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ds(){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}}function Rt(e){return Rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Rt(e)}var Lo=function(e){ss(r,e);var t=ls(r);function r(o){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};cs(this,r),i=t.call(this,o,a),i.device=void 0,i.handle=void 0,i.pipeline=null,i.device=o;var s=a.framebuffer||o.canvasContext.getCurrentFramebuffer(),c=i.getRenderPassDescriptor(s);return S.groupCollapsed(1,"new WebGPURenderPass(".concat(i.id,")"))(),S.probe(1,JSON.stringify(c,null,2))(),S.groupEnd(1)(),i.handle=i.props.handle||o.commandEncoder.beginRenderPass(c),i.handle.label=i.props.id,i}var n=r.prototype;return n.destroy=function(){},n.end=function(){this.handle.end()},n.setPipeline=function(i){this.pipeline=i,this.handle.setPipeline(this.pipeline.handle)},n.setBindings=function(i){var a,s;(a=this.pipeline)===null||a===void 0||a.setBindings(i);var c=(s=this.pipeline)===null||s===void 0?void 0:s._getBindGroup();c&&this.handle.setBindGroup(0,c)},n.setIndexBuffer=function(i,a){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,c=arguments.length>3?arguments[3]:void 0;this.handle.setIndexBuffer(i.handle,a,s,c)},n.setVertexBuffer=function(i,a){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;this.handle.setVertexBuffer(i,a.handle,s)},n.draw=function(i){i.indexCount?this.handle.drawIndexed(i.indexCount,i.instanceCount,i.firstIndex,i.baseVertex,i.firstInstance):this.handle.draw(i.vertexCount||0,i.instanceCount||1,i.firstIndex,i.firstInstance)},n.drawIndirect=function(){},n.setParameters=function(i){var a=i.blendConstant,s=i.stencilReference,c=i.scissorRect,h=i.viewport;a&&this.handle.setBlendConstant(a),s&&this.handle.setStencilReference(s),c&&this.handle.setScissorRect(c[0],c[1],c[2],c[3]),h&&this.handle.setViewport(h[0],h[1],h[2],h[3],h[4],h[5])},n.pushDebugGroup=function(i){this.handle.pushDebugGroup(i)},n.popDebugGroup=function(){this.handle.popDebugGroup()},n.insertDebugMarker=function(i){this.handle.insertDebugMarker(i)},n.getRenderPassDescriptor=function(i){var a=this,s={colorAttachments:[]};if(s.colorAttachments=i.colorAttachments.map(function(m){return{loadOp:a.props.clearColor!==!1?"clear":"load",colorClearValue:a.props.clearColor||[0,0,0,0],storeOp:a.props.discard?"discard":"store",view:m.handle.createView()}}),i.depthStencilAttachment){s.depthStencilAttachment={view:i.depthStencilAttachment.handle.createView()};var c=s.depthStencilAttachment;this.props.depthReadOnly&&(c.depthReadOnly=!0),c.depthClearValue=this.props.clearDepth||0;var h=!0;h&&(c.depthLoadOp=this.props.clearDepth!==!1?"clear":"load",c.depthStoreOp="store");var v=!1;v&&(c.stencilLoadOp=this.props.clearStencil!==!1?"clear":"load",c.stencilStoreOp="store")}return s},as(r)}(dt);function Re(e){return Re=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},Re(e)}function Do(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,ms(n.key),n)}}function ys(e,t,r){return t&&Do(e.prototype,t),r&&Do(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ms(e){var t=vs(e,"string");return Re(t)==="symbol"?t:String(t)}function vs(e,t){if(Re(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Re(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gs(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&&sr(e,t)}function sr(e,t){return sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},sr(e,t)}function ws(e){var t=Ps();return function(){var n=At(e),o;if(t){var i=At(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _s(this,o)}}function _s(e,t){if(t&&(Re(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Os(e)}function Os(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ps(){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}}function At(e){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},At(e)}var No=function(e){gs(r,e);var t=ws(r);function r(o,i){var a,s;return bs(this,r),s=t.call(this,o,i),s.device=void 0,s.handle=void 0,s._bindGroupLayout=null,s.device=o,s.handle=s.props.handle||((a=o.commandEncoder)===null||a===void 0?void 0:a.beginComputePass({label:s.props.id})),s}var n=r.prototype;return n.destroy=function(){},n.end=function(){this.handle.end()},n.setPipeline=function(i){var a=i;this.handle.setPipeline(a.handle),this._bindGroupLayout=a._getBindGroupLayout()},n.setBindings=function(i){throw new Error("fix me")},n.dispatch=function(i,a,s){this.handle.dispatchWorkgroups(i,a,s)},n.dispatchIndirect=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=i;this.handle.dispatchWorkgroupsIndirect(s.handle,a)},n.pushDebugGroup=function(i){this.handle.pushDebugGroup(i)},n.popDebugGroup=function(){this.handle.popDebugGroup()},n.insertDebugMarker=function(i){this.handle.insertDebugMarker(i)},ys(r)}(mt);function Ae(e){return Ae=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},Ae(e)}var Co;function Ss(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Go(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,js(n.key),n)}}function Ts(e,t,r){return t&&Go(e.prototype,t),r&&Go(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function js(e){var t=Es(e,"string");return Ae(t)==="symbol"?t:String(t)}function Es(e,t){if(Ae(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ae(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xs(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&&lr(e,t)}function lr(e,t){return lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},lr(e,t)}function Rs(e){var t=Bs();return function(){var n=It(e),o;if(t){var i=It(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return As(this,o)}}function As(e,t){if(t&&(Ae(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Is(e)}function Is(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bs(){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}}function It(e){return It=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},It(e)}Co=Symbol.toStringTag;var ko=function(e){xs(r,e);var t=Rs(r);r.isConstantAttributeZeroSupported=function(i){return i.info.type==="webgl2"||Ke()==="Chrome"};function r(o,i){var a;return Ss(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o,a}var n=r.prototype;return n.destroy=function(){},n.setIndexBuffer=function(i){this.indexBuffer=i},n.setBuffer=function(i,a){this.attributes[i]=a},n.setConstant=function(i,a){S.warn("".concat(this.id," constant attributes not supported on WebGPU"))},n.bindBeforeRender=function(i,a,s){var c=i,h=this.indexBuffer;c.handle.setIndexBuffer(h?.handle,h?.indexType);for(var v=0;v<this.maxVertexAttributes;v++){var m=this.attributes[v];c.handle.setVertexBuffer(v,m.handle)}},n.unbindAfterRender=function(i){},Ts(r,[{key:Co,get:function(){return"WebGPUVertexArray"}}]),r}(bt);function Ie(e){return Ie=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},Ie(e)}function Mo(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,Ds(n.key),n)}}function Ls(e,t,r){return t&&Mo(e.prototype,t),r&&Mo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ds(e){var t=Ns(e,"string");return Ie(t)==="symbol"?t:String(t)}function Ns(e,t){if(Ie(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ie(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Gs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cs(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&&pr(e,t)}function pr(e,t){return pr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},pr(e,t)}function ks(e){var t=Fs();return function(){var n=Bt(e),o;if(t){var i=Bt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Ms(this,o)}}function Ms(e,t){if(t&&(Ie(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Us(e)}function Us(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Fs(){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}}function Bt(e){return Bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Bt(e)}var Uo=function(e){Cs(r,e);var t=ks(r);function r(n,o){var i;return Gs(this,r),i=t.call(this,n,o),i.device=void 0,i.device=n,i.autoCreateAttachmentTextures(),i}return Ls(r)}(ft);function Be(e){return Be=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},Be(e)}function Ws(e,t){return Ks(e)||Hs(e,t)||Vs(e,t)||zs()}function zs(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
28
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vs(e,t){if(e){if(typeof e=="string")return Fo(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 Fo(e,t)}}function Fo(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 Hs(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function Ks(e){if(Array.isArray(e))return e}function Wo(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,Ys(n.key),n)}}function $s(e,t,r){return t&&Wo(e.prototype,t),r&&Wo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ys(e){var t=
|
|
29
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ol(e,t){if(e){if(typeof e=="string")return zo(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 zo(e,t)}}function zo(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 il(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function al(e){if(Array.isArray(e))return e}function Vo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ho(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vo(Object(r),!0).forEach(function(n){ul(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ul(e,t,r){return t=qo(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ve(){"use strict";Ve=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,f){l[u]=f.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(l,u,f){return Object.defineProperty(l,u,{value:f,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{c({},"")}catch{c=function(f,p,y){return f[p]=y}}function h(l,u,f,p){var y=u&&u.prototype instanceof g?u:g,d=Object.create(y.prototype),b=new I(p||[]);return n(d,"_invoke",{value:F(l,f,b)}),d}function v(l,u,f){try{return{type:"normal",arg:l.call(u,f)}}catch(p){return{type:"throw",arg:p}}}e.wrap=h;var m={};function g(){}function _(){}function O(){}var B={};c(B,i,function(){return this});var L=Object.getPrototypeOf,A=L&&L(L(k([])));A&&A!==t&&r.call(A,i)&&(B=A);var T=O.prototype=g.prototype=Object.create(B);function D(l){["next","throw","return"].forEach(function(u){c(l,u,function(f){return this._invoke(u,f)})})}function N(l,u){function f(y,d,b,w){var P=v(l[y],l,d);if(P.type!=="throw"){var x=P.arg,j=x.value;return j&&ne(j)=="object"&&r.call(j,"__await")?u.resolve(j.__await).then(function(R){f("next",R,b,w)},function(R){f("throw",R,b,w)}):u.resolve(j).then(function(R){x.value=R,b(x)},function(R){return f("throw",R,b,w)})}w(P.arg)}var p;n(this,"_invoke",{value:function(d,b){function w(){return new u(function(P,x){f(d,b,P,x)})}return p=p?p.then(w,w):w()}})}function F(l,u,f){var p="suspendedStart";return function(y,d){if(p==="executing")throw new Error("Generator is already running");if(p==="completed"){if(y==="throw")throw d;return z()}for(f.method=y,f.arg=d;;){var b=f.delegate;if(b){var w=U(b,f);if(w){if(w===m)continue;return w}}if(f.method==="next")f.sent=f._sent=f.arg;else if(f.method==="throw"){if(p==="suspendedStart")throw p="completed",f.arg;f.dispatchException(f.arg)}else f.method==="return"&&f.abrupt("return",f.arg);p="executing";var P=v(l,u,f);if(P.type==="normal"){if(p=f.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:f.done}}P.type==="throw"&&(p="completed",f.method="throw",f.arg=P.arg)}}}function U(l,u){var f=u.method,p=l.iterator[f];if(p===void 0)return u.delegate=null,f==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,U(l,u),u.method==="throw")||f!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+f+"' method")),m;var y=v(p,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function W(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function G(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function I(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(W,this),this.reset(!0)}function k(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var f=-1,p=function y(){for(;++f<l.length;)if(r.call(l,f))return y.value=l[f],y.done=!1,y;return y.value=void 0,y.done=!0,y};return p.next=p}}return{next:z}}function z(){return{value:void 0,done:!0}}return _.prototype=O,n(T,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:_,configurable:!0}),_.displayName=c(O,s,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===_||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,c(l,s,"GeneratorFunction")),l.prototype=Object.create(T),l},e.awrap=function(l){return{__await:l}},D(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,f,p,y){y===void 0&&(y=Promise);var d=new N(h(l,u,f,p),y);return e.isGeneratorFunction(u)?d:d.next().then(function(b){return b.done?b.value:d.next()})},D(T),c(T,s,"Generator"),c(T,i,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),f=[];for(var p in u)f.push(p);return f.reverse(),function y(){for(;f.length;){var d=f.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=k,I.prototype={constructor:I,reset:function(u){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(G),!u)for(var f in this)f.charAt(0)==="t"&&r.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var f=this;function p(x,j){return b.type="throw",b.arg=u,f.next=x,j&&(f.method="next",f.arg=void 0),!!j}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],b=d.completion;if(d.tryLoc==="root")return p("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return p(d.catchLoc,!0);if(this.prev<d.finallyLoc)return p(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return p(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return p(d.finallyLoc)}}}},abrupt:function(u,f){for(var p=this.tryEntries.length-1;p>=0;--p){var y=this.tryEntries[p];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=f&&f<=d.finallyLoc&&(d=null);var b=d?d.completion:{};return b.type=u,b.arg=f,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(b)},complete:function(u,f){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&f&&(this.next=f),m},finish:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.finallyLoc===u)return this.complete(p.completion,p.afterLoc),G(p),m}},catch:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.tryLoc===u){var y=p.completion;if(y.type==="throw"){var d=y.arg;G(p)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,f,p){return this.delegate={iterator:k(u),resultName:f,nextLoc:p},this.method==="next"&&(this.arg=void 0),m}},e}function Ko(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(h){r(h);return}s.done?t(c):Promise.resolve(c).then(n,o)}function $o(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(c){Ko(i,n,o,a,s,"next",c)}function s(c){Ko(i,n,o,a,s,"throw",c)}a(void 0)})}}function fl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yo(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,qo(n.key),n)}}function cl(e,t,r){return t&&Yo(e.prototype,t),r&&Yo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function qo(e){var t=sl(e,"string");return ne(t)==="symbol"?t:String(t)}function sl(e,t){if(ne(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ne(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ll(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&&yr(e,t)}function yr(e,t){return yr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},yr(e,t)}function pl(e){var t=dl();return function(){var n=Dt(e),o;if(t){var i=Dt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return hl(this,o)}}function hl(e,t){if(t&&(ne(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xo(e)}function Xo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dl(){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}}function Dt(e){return Dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Dt(e)}var mr=function(e){ll(r,e);var t=pl(r);r.isSupported=function(){return Boolean(typeof navigator<"u"&&navigator.gpu)},r.create=function(){var o=$o(Ve().mark(function a(s){var c,h,v,m;return Ve().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:if(navigator.gpu){_.next=2;break}throw new Error("WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu");case 2:return S.groupCollapsed(1,"WebGPUDevice created")(),_.next=5,navigator.gpu.requestAdapter({powerPreference:"high-performance"});case 5:if(c=_.sent,c){_.next=8;break}throw new Error("Failed to request WebGPU adapter");case 8:return _.next=10,c.requestAdapterInfo();case 10:return h=_.sent,S.probe(2,"Adapter available",h)(),_.next=14,c.requestDevice({requiredFeatures:c.features});case 14:if(v=_.sent,S.probe(1,"GPUDevice available")(),typeof s.canvas!="string"){_.next=20;break}return _.next=19,ce.pageLoaded;case 19:S.probe(1,"DOM is loaded")();case 20:return m=new r(v,c,h,s),S.probe(1,"Device created. For more info, set chrome://flags/#enable-webgpu-developer-features")(),S.table(1,m.info)(),S.groupEnd(1)(),_.abrupt("return",m);case 25:case"end":return _.stop()}},a)}));function i(a){return o.apply(this,arguments)}return i}();function r(o,i,a,s){var c;fl(this,r),c=t.call(this,Ho(Ho({},s),{},{id:s.id||Y("webgpu-device")})),c.handle=void 0,c.adapter=void 0,c.lost=void 0,c.canvasContext=null,c.commandEncoder=null,c.renderPass=null,c._info=void 0,c._isLost=!1,c.features=void 0,c.handle=o,c.adapter=i;var h=(a.driver||"").split(" Version "),v=rl(h,2),m=v[0],g=v[1],_=a.vendor||c.adapter.__brand||"unknown",O=m||"",B=g||"",L=_==="apple"?"apple":"unknown",A=a.architecture||"unknown",T=a.backend||"unknown",D=(a.type||"").split(" ")[0].toLowerCase()||"unknown";return c._info={type:"webgpu",vendor:_,renderer:O,version:B,gpu:L,gpuType:D,gpuBackend:T,gpuArchitecture:A,shadingLanguage:"wgsl",shadingLanguageVersion:100},c.lost=new Promise(function(){var N=$o(Ve().mark(function F(U){var W;return Ve().wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return I.next=2,c.handle.lost;case 2:W=I.sent,c._isLost=!0,U({reason:"destroyed",message:W.message});case 5:case"end":return I.stop()}},F)}));return function(F){return N.apply(this,arguments)}}()),c.canvasContext=new dr(Xo(c),c.adapter,{canvas:s.canvas,height:s.height,width:s.width,container:s.container}),c.features=c._getFeatures(),c}var n=r.prototype;return n.destroy=function(){this.handle.destroy()},n.isTextureFormatSupported=function(i){return!i.includes("webgl")},n.isTextureFormatFilterable=function(i){return this.isTextureFormatSupported(i)},n.isTextureFormatRenderable=function(i){return this.isTextureFormatSupported(i)},n.createBuffer=function(i){var a=this._getBufferProps(i);return new wt(this,a)},n._createTexture=function(i){return new Pt(this,i)},n.createExternalTexture=function(i){return new so(this,i)},n.createShader=function(i){return new jt(this,i)},n.createSampler=function(i){return new K(this,i)},n.createRenderPipeline=function(i){return new Ro(this,i)},n.createFramebuffer=function(i){throw new Error("Not implemented")},n.createComputePipeline=function(i){return new Io(this,i)},n.createVertexArray=function(i){return new ko(this,i)},n.beginRenderPass=function(i){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new Lo(this,i)},n.beginComputePass=function(i){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new No(this,i)},n.createTransformFeedback=function(i){throw new Error("Transform feedback not supported in WebGPU")},n.createCanvasContext=function(i){return new dr(this,this.adapter,i)},n.getDefaultRenderPass=function(){throw new Error("a")},n.submit=function(){var i,a=(i=this.commandEncoder)===null||i===void 0?void 0:i.finish();a&&this.handle.queue.submit([a]),this.commandEncoder=null},n._getFeatures=function(){var i=new Set(this.handle.features);return i.has("depth-clamping")&&(i.delete("depth-clamping"),i.add("depth-clip-control")),i.has("texture-compression-bc")&&i.add("texture-compression-bc5-webgl"),i.add("webgpu"),i.add("timer-query-webgl"),i.add("vertex-array-object-webgl1"),i.add("instanced-rendering-webgl1"),i.add("multiple-render-targets-webgl1"),i.add("index-uint32-webgl1"),i.add("blend-minmax-webgl1"),i.add("texture-blend-float-webgl1"),i.add("texture-formats-srgb-webgl1"),i.add("texture-formats-depth-webgl1"),i.add("texture-formats-float32-webgl1"),i.add("texture-formats-float16-webgl1"),i.add("texture-filter-linear-float32-webgl"),i.add("texture-filter-linear-float16-webgl"),i.add("texture-filter-anisotropic-webgl"),i.add("texture-renderable-rgba32float-webgl"),i.add("texture-renderable-float32-webgl"),i.add("texture-renderable-float16-webgl"),i.add("glsl-frag-data"),i.add("glsl-frag-depth"),i.add("glsl-derivatives"),i.add("glsl-texture-lod"),i},n.copyExternalImageToTexture=function(i){var a,s=i.source,c=i.sourceX,h=c===void 0?0:c,v=i.sourceY,m=v===void 0?0:v,g=i.texture,_=i.mipLevel,O=_===void 0?0:_,B=i.aspect,L=B===void 0?"all":B,A=i.colorSpace,T=A===void 0?"display-p3":A,D=i.premultipliedAlpha,N=D===void 0?!1:D,F=i.width,U=F===void 0?g.width:F,W=i.height,G=W===void 0?g.height:W,I=i.depth,k=I===void 0?1:I,z=g;(a=this.handle)===null||a===void 0||a.queue.copyExternalImageToTexture({source:s,origin:[h,m]},{texture:z.handle,origin:[0,0,0],mipLevel:O,aspect:L,colorSpace:T,premultipliedAlpha:N},[U,G,k])},cl(r,[{key:"info",get:function(){return this._info}},{key:"limits",get:function(){return this.handle.limits}},{key:"isLost",get:function(){return this._isLost}}]),r}(ke);mr.type="webgpu";return ri(yl);})();
|
|
25
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ac(e,t){if(e){if(typeof e=="string")return wo(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 wo(e,t)}}function wo(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 Ic(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function Bc(e){if(Array.isArray(e))return e}function Oo(e,t,r,n){var o=Dc(n,r);return e.createBindGroup({layout:t,entries:o})}function Lc(e,t){var r=e.bindings.find(function(n){return n.name===t});return r||S.warn("Binding ".concat(t," not set: Not found in shader layout."))(),r}function Dc(e,t){for(var r=[],n=0,o=Object.entries(e);n<o.length;n++){var i=xc(o[n],2),a=i[0],s=i[1],c=Lc(t,a);c&&r.push(Nc(s,c.location))}return r}function Nc(e,t){if(e instanceof G)return{binding:t,resource:{buffer:e.handle}};if(e instanceof he)return{binding:t,resource:e.handle};if(e instanceof V)return{binding:t,resource:e.handle.createView()};throw new Error("invalid binding")}function Te(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Gc(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(h){throw h},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
26
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var h=r.next();return i=h.done,h},e:function(h){a=!0,s=h},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Gc(e,t){if(e){if(typeof e=="string")return Po(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 Po(e,t)}}function Po(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 ar(e){if(e.endsWith("-webgl"))throw new Error("WebGPU does not support vertex format ".concat(e));return e}function To(e,t){var r=[],n=new Set,o=Te(t),i;try{for(o.s();!(i=o.n()).done;){var a=i.value,s=[],c="vertex",h=0;if(a.attributes){var v=Te(a.attributes),m;try{for(v.s();!(m=v.n()).done;){var g=m.value,_=g.attribute,O=So(e,_,n);c=O.stepMode||"vertex",s.push({format:ar(g.format||a.format),offset:g.byteOffset,shaderLocation:O.location}),h+=q(a.format).byteLength}}catch(D){v.e(D)}finally{v.f()}}else{var B=So(e,a.name,n);h=q(a.format).byteLength,c=B.stepMode||"vertex",s.push({format:ar(a.format),offset:0,shaderLocation:B.location})}r.push({arrayStride:a.byteStride||h,stepMode:c||"vertex",attributes:s})}}catch(D){o.e(D)}finally{o.f()}var L=Te(e.attributes),A;try{for(L.s();!(A=L.n()).done;){var T=A.value;n.has(T.name)||r.push({arrayStride:q("float32x3").byteLength,stepMode:T.stepMode||"vertex",attributes:[{format:ar("float32x3"),offset:0,shaderLocation:T.location}]})}}catch(D){L.e(D)}finally{L.f()}return r}function jo(e,t){var r=new Set,n=0,o={},i=Te(t),a;try{for(i.s();!(a=i.n()).done;){var s=a.value;if("attributes"in s){var c=Te(s.attributes),h;try{for(c.s();!(h=c.n()).done;){var v=h.value;r.add(v.attribute)}}catch(O){c.e(O)}finally{c.f()}}else r.add(s.name);o[s.name]=n++}}catch(O){i.e(O)}finally{i.f()}var m=Te(e.attributes),g;try{for(m.s();!(g=m.n()).done;){var _=g.value;r.has(_.name)||(o[_.name]=n++)}}catch(O){m.e(O)}finally{m.f()}return o}function So(e,t,r){var n=e.attributes.find(function(o){return o.name===t});if(!n)throw new Error("Unknown attribute ".concat(t));if(r.has(t))throw new Error("Duplicate attribute ".concat(t));return r.add(t),n}function je(e){return je=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},je(e)}function Cc(e,t){return Fc(e)||Uc(e,t)||Mc(e,t)||kc()}function kc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
27
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mc(e,t){if(e){if(typeof e=="string")return Eo(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 Eo(e,t)}}function Eo(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 Uc(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function Fc(e){if(Array.isArray(e))return e}function xo(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,zc(n.key),n)}}function Wc(e,t,r){return t&&xo(e.prototype,t),r&&xo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function zc(e){var t=Vc(e,"string");return je(t)==="symbol"?t:String(t)}function Vc(e,t){if(je(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(je(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kc(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&&ur(e,t)}function ur(e,t){return ur=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ur(e,t)}function $c(e){var t=qc();return function(){var n=Et(e),o;if(t){var i=Et(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Yc(this,o)}}function Yc(e,t){if(t&&(je(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xc(e)}function Xc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qc(){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}}function Et(e){return Et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Et(e)}var Ro=function(e){Kc(r,e);var t=$c(r);function r(o,i){var a;if(Hc(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.vs=void 0,a.fs=null,a._bufferSlots=void 0,a._buffers=void 0,a._indexBuffer=null,a._bindGroupLayout=null,a._bindGroup=null,a.device=o,a.handle=a.props.handle,!a.handle){var s=a._getRenderPipelineDescriptor();S.groupCollapsed(1,"new WebGPURenderPipeline(".concat(a.id,")"))(),S.probe(1,JSON.stringify(s,null,2))(),S.groupEnd(1)(),a.handle=a.device.handle.createRenderPipeline(s)}return a.handle.label=a.props.id,a.vs=i.vs,a.fs=i.fs,a._bufferSlots=jo(a.props.shaderLayout,a.props.bufferLayout),a._buffers=new Array(Object.keys(a._bufferSlots).length).fill(null),a}var n=r.prototype;return n.destroy=function(){},n.setIndexBuffer=function(i){this._indexBuffer=i},n.setAttributes=function(i){for(var a=0,s=Object.entries(i);a<s.length;a++){var c=Cc(s[a],2),h=c[0],v=c[1],m=this._bufferSlots[h];if(m>=0)this._buffers[m]=v;else throw new Error("Setting attribute '".concat(h,"' not listed in shader layout for program ").concat(this.id))}},n.setConstantAttributes=function(i){throw new Error("not implemented")},n.setBindings=function(i){Ze(this.props.bindings)||(Object.assign(this.props.bindings,i),this._bindGroupLayout=this._bindGroupLayout||this.handle.getBindGroupLayout(0),this._bindGroup=Oo(this.device.handle,this._bindGroupLayout,this.props.shaderLayout,this.props.bindings))},n.setUniforms=function(i){if(!Ze(i))throw new Error("WebGPU does not support uniforms")},n._getBuffers=function(){return this._buffers},n._getBindGroup=function(){return this._bindGroup},n._getRenderPipelineDescriptor=function(){var i={module:this.props.vs.handle,entryPoint:this.props.vsEntryPoint||"main",buffers:To(this.props.shaderLayout,this.props.bufferLayout)},a;if(this.props.fs){var s;a={module:this.props.fs.handle,entryPoint:this.props.fsEntryPoint||"main",targets:[{format:_e((s=this.device)===null||s===void 0||(s=s.canvasContext)===null||s===void 0?void 0:s.format)}]}}switch(this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":throw new Error("WebGPU does not support primitive topology ".concat(this.props.topology));default:}var c={vertex:i,fragment:a,primitive:{topology:this.props.topology},layout:"auto"};return go(c,this.props.parameters),c},n.draw=function(i){var a=i.renderPass||this.device.getDefaultRenderPass();a.handle.setPipeline(this.handle);var s=this._getBindGroup();s&&a.handle.setBindGroup(0,s),this._setAttributeBuffers(a),i.indexCount?a.handle.drawIndexed(i.indexCount,i.instanceCount,i.firstIndex,i.baseVertex,i.firstInstance):a.handle.draw(i.vertexCount||0,i.instanceCount||1,i.firstInstance)},n._setAttributeBuffers=function(i){var a=this;this._indexBuffer&&i.handle.setIndexBuffer(this._indexBuffer.handle,this._indexBuffer.props.indexType);for(var s=this._getBuffers(),c=function(m){var g=s[m];if(!g){var _=a.props.shaderLayout.attributes.find(function(O){return O.location===m});throw new Error("No buffer provided for attribute '".concat(_?.name||"","' in Model '").concat(a.props.id,"'"))}i.handle.setVertexBuffer(m,g.handle)},h=0;h<s.length;++h)c(h)},Wc(r)}(st);function Ee(e){return Ee=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},Ee(e)}function Ao(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,Jc(n.key),n)}}function Zc(e,t,r){return t&&Ao(e.prototype,t),r&&Ao(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jc(e){var t=Qc(e,"string");return Ee(t)==="symbol"?t:String(t)}function Qc(e,t){if(Ee(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ee(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function es(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ts(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&&fr(e,t)}function fr(e,t){return fr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},fr(e,t)}function rs(e){var t=is();return function(){var n=xt(e),o;if(t){var i=xt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return ns(this,o)}}function ns(e,t){if(t&&(Ee(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return os(e)}function os(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function is(){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}}function xt(e){return xt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},xt(e)}var Io=function(e){ts(r,e);var t=rs(r);function r(o,i){var a;es(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o;var s=a.props.cs;return a.handle=a.props.handle||a.device.handle.createComputePipeline({label:a.props.id,compute:{module:s.handle,entryPoint:a.props.csEntryPoint},layout:"auto"}),a}var n=r.prototype;return n._getBindGroupLayout=function(){return this.handle.getBindGroupLayout(0)},Zc(r)}(pt);function xe(e){return xe=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},xe(e)}function Bo(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,us(n.key),n)}}function as(e,t,r){return t&&Bo(e.prototype,t),r&&Bo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function us(e){var t=fs(e,"string");return xe(t)==="symbol"?t:String(t)}function fs(e,t){if(xe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(xe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ss(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&&cr(e,t)}function cr(e,t){return cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},cr(e,t)}function ls(e){var t=ds();return function(){var n=Rt(e),o;if(t){var i=Rt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return ps(this,o)}}function ps(e,t){if(t&&(xe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hs(e)}function hs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ds(){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}}function Rt(e){return Rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Rt(e)}var Lo=function(e){ss(r,e);var t=ls(r);function r(o){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};cs(this,r),i=t.call(this,o,a),i.device=void 0,i.handle=void 0,i.pipeline=null,i.device=o;var s=a.framebuffer||o.canvasContext.getCurrentFramebuffer(),c=i.getRenderPassDescriptor(s);return S.groupCollapsed(1,"new WebGPURenderPass(".concat(i.id,")"))(),S.probe(1,JSON.stringify(c,null,2))(),S.groupEnd(1)(),i.handle=i.props.handle||o.commandEncoder.beginRenderPass(c),i.handle.label=i.props.id,i}var n=r.prototype;return n.destroy=function(){},n.end=function(){this.handle.end()},n.setPipeline=function(i){this.pipeline=i,this.handle.setPipeline(this.pipeline.handle)},n.setBindings=function(i){var a,s;(a=this.pipeline)===null||a===void 0||a.setBindings(i);var c=(s=this.pipeline)===null||s===void 0?void 0:s._getBindGroup();c&&this.handle.setBindGroup(0,c)},n.setIndexBuffer=function(i,a){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,c=arguments.length>3?arguments[3]:void 0;this.handle.setIndexBuffer(i.handle,a,s,c)},n.setVertexBuffer=function(i,a){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;this.handle.setVertexBuffer(i,a.handle,s)},n.draw=function(i){i.indexCount?this.handle.drawIndexed(i.indexCount,i.instanceCount,i.firstIndex,i.baseVertex,i.firstInstance):this.handle.draw(i.vertexCount||0,i.instanceCount||1,i.firstIndex,i.firstInstance)},n.drawIndirect=function(){},n.setParameters=function(i){var a=i.blendConstant,s=i.stencilReference,c=i.scissorRect,h=i.viewport;a&&this.handle.setBlendConstant(a),s&&this.handle.setStencilReference(s),c&&this.handle.setScissorRect(c[0],c[1],c[2],c[3]),h&&this.handle.setViewport(h[0],h[1],h[2],h[3],h[4],h[5])},n.pushDebugGroup=function(i){this.handle.pushDebugGroup(i)},n.popDebugGroup=function(){this.handle.popDebugGroup()},n.insertDebugMarker=function(i){this.handle.insertDebugMarker(i)},n.getRenderPassDescriptor=function(i){var a=this,s={colorAttachments:[]};if(s.colorAttachments=i.colorAttachments.map(function(m){return{loadOp:a.props.clearColor!==!1?"clear":"load",colorClearValue:a.props.clearColor||[0,0,0,0],storeOp:a.props.discard?"discard":"store",view:m.handle.createView()}}),i.depthStencilAttachment){s.depthStencilAttachment={view:i.depthStencilAttachment.handle.createView()};var c=s.depthStencilAttachment;this.props.depthReadOnly&&(c.depthReadOnly=!0),c.depthClearValue=this.props.clearDepth||0;var h=!0;h&&(c.depthLoadOp=this.props.clearDepth!==!1?"clear":"load",c.depthStoreOp="store");var v=!1;v&&(c.stencilLoadOp=this.props.clearStencil!==!1?"clear":"load",c.stencilStoreOp="store")}return s},as(r)}(dt);function Re(e){return Re=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},Re(e)}function Do(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,ms(n.key),n)}}function ys(e,t,r){return t&&Do(e.prototype,t),r&&Do(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ms(e){var t=vs(e,"string");return Re(t)==="symbol"?t:String(t)}function vs(e,t){if(Re(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Re(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gs(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&&sr(e,t)}function sr(e,t){return sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},sr(e,t)}function ws(e){var t=Ps();return function(){var n=At(e),o;if(t){var i=At(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _s(this,o)}}function _s(e,t){if(t&&(Re(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Os(e)}function Os(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ps(){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}}function At(e){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},At(e)}var No=function(e){gs(r,e);var t=ws(r);function r(o,i){var a,s;return bs(this,r),s=t.call(this,o,i),s.device=void 0,s.handle=void 0,s._bindGroupLayout=null,s.device=o,s.handle=s.props.handle||((a=o.commandEncoder)===null||a===void 0?void 0:a.beginComputePass({label:s.props.id})),s}var n=r.prototype;return n.destroy=function(){},n.end=function(){this.handle.end()},n.setPipeline=function(i){var a=i;this.handle.setPipeline(a.handle),this._bindGroupLayout=a._getBindGroupLayout()},n.setBindings=function(i){throw new Error("fix me")},n.dispatch=function(i,a,s){this.handle.dispatchWorkgroups(i,a,s)},n.dispatchIndirect=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=i;this.handle.dispatchWorkgroupsIndirect(s.handle,a)},n.pushDebugGroup=function(i){this.handle.pushDebugGroup(i)},n.popDebugGroup=function(){this.handle.popDebugGroup()},n.insertDebugMarker=function(i){this.handle.insertDebugMarker(i)},ys(r)}(mt);function Ae(e){return Ae=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},Ae(e)}var Co;function Ss(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Go(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,js(n.key),n)}}function Ts(e,t,r){return t&&Go(e.prototype,t),r&&Go(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function js(e){var t=Es(e,"string");return Ae(t)==="symbol"?t:String(t)}function Es(e,t){if(Ae(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ae(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xs(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&&lr(e,t)}function lr(e,t){return lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},lr(e,t)}function Rs(e){var t=Bs();return function(){var n=It(e),o;if(t){var i=It(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return As(this,o)}}function As(e,t){if(t&&(Ae(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Is(e)}function Is(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bs(){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}}function It(e){return It=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},It(e)}Co=Symbol.toStringTag;var ko=function(e){xs(r,e);var t=Rs(r);r.isConstantAttributeZeroSupported=function(i){return i.info.type==="webgl2"||Ke()==="Chrome"};function r(o,i){var a;return Ss(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o,a}var n=r.prototype;return n.destroy=function(){},n.setIndexBuffer=function(i){this.indexBuffer=i},n.setBuffer=function(i,a){this.attributes[i]=a},n.setConstant=function(i,a){S.warn("".concat(this.id," constant attributes not supported on WebGPU"))},n.bindBeforeRender=function(i,a,s){var c=i,h=this.indexBuffer;c.handle.setIndexBuffer(h?.handle,h?.indexType);for(var v=0;v<this.maxVertexAttributes;v++){var m=this.attributes[v];c.handle.setVertexBuffer(v,m.handle)}},n.unbindAfterRender=function(i){},Ts(r,[{key:Co,get:function(){return"WebGPUVertexArray"}}]),r}(bt);function Ie(e){return Ie=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},Ie(e)}function Mo(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,Ds(n.key),n)}}function Ls(e,t,r){return t&&Mo(e.prototype,t),r&&Mo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ds(e){var t=Ns(e,"string");return Ie(t)==="symbol"?t:String(t)}function Ns(e,t){if(Ie(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ie(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Gs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cs(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&&pr(e,t)}function pr(e,t){return pr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},pr(e,t)}function ks(e){var t=Fs();return function(){var n=Bt(e),o;if(t){var i=Bt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Ms(this,o)}}function Ms(e,t){if(t&&(Ie(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Us(e)}function Us(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Fs(){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}}function Bt(e){return Bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Bt(e)}var Uo=function(e){Cs(r,e);var t=ks(r);function r(n,o){var i;return Gs(this,r),i=t.call(this,n,o),i.device=void 0,i.device=n,i.autoCreateAttachmentTextures(),i}return Ls(r)}(ft);function Be(e){return Be=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},Be(e)}function Ws(e,t){return Ks(e)||Hs(e,t)||Vs(e,t)||zs()}function zs(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
28
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vs(e,t){if(e){if(typeof e=="string")return Fo(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 Fo(e,t)}}function Fo(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 Hs(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function Ks(e){if(Array.isArray(e))return e}function Wo(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,Ys(n.key),n)}}function $s(e,t,r){return t&&Wo(e.prototype,t),r&&Wo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ys(e){var t=Xs(e,"string");return Be(t)==="symbol"?t:String(t)}function Xs(e,t){if(Be(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Be(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zs(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&&hr(e,t)}function hr(e,t){return hr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},hr(e,t)}function Js(e){var t=tl();return function(){var n=Lt(e),o;if(t){var i=Lt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Qs(this,o)}}function Qs(e,t){if(t&&(Be(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return el(e)}function el(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tl(){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}}function Lt(e){return Lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Lt(e)}var dr=function(e){Zs(r,e);var t=Js(r);function r(o,i,a){var s;return qs(this,r),s=t.call(this,a),s.device=void 0,s.gpuCanvasContext=void 0,s.format=navigator.gpu.getPreferredCanvasFormat(),s.depthStencilFormat="depth24plus",s.depthStencilAttachment=null,s.device=o,s.width=-1,s.height=-1,s._setAutoCreatedCanvasId("".concat(s.device.id,"-canvas")),s.gpuCanvasContext=s.canvas.getContext("webgpu"),s.format="bgra8unorm",s}var n=r.prototype;return n.destroy=function(){this.gpuCanvasContext.unconfigure()},n.getCurrentTexture=function(){return this.device._createTexture({id:"default-render-target",handle:this.gpuCanvasContext.getCurrentTexture()})},n.getCurrentFramebuffer=function(){this.update();var i=this.getCurrentTexture();return this.width=i.width,this.height=i.height,this._createDepthStencilAttachment(),new Uo(this.device,{colorAttachments:[i],depthStencilAttachment:this.depthStencilAttachment})},n.update=function(){var i=this.getPixelSize(),a=Ws(i,2),s=a[0],c=a[1],h=s!==this.width||c!==this.height;h&&(this.width=s,this.height=c,this.depthStencilAttachment&&(this.depthStencilAttachment.destroy(),this.depthStencilAttachment=null),this.gpuCanvasContext.configure({device:this.device.handle,format:_e(this.format),colorSpace:this.props.colorSpace,alphaMode:this.props.alphaMode}),S.log(1,"Resized to ".concat(this.width,"x").concat(this.height,"px"))())},n.resize=function(i){this.update()},n._createDepthStencilAttachment=function(){return this.depthStencilAttachment||(this.depthStencilAttachment=this.device.createTexture({id:"depth-stencil-target",format:this.depthStencilFormat,width:this.width,height:this.height,usage:GPUTextureUsage.RENDER_ATTACHMENT})),this.depthStencilAttachment},$s(r)}(ce);function ne(e){return ne=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},ne(e)}function rl(e,t){return al(e)||il(e,t)||ol(e,t)||nl()}function nl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
29
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ol(e,t){if(e){if(typeof e=="string")return zo(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 zo(e,t)}}function zo(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 il(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,h=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(v){h=!0,o=v}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw o}}return s}}function al(e){if(Array.isArray(e))return e}function Vo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ho(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vo(Object(r),!0).forEach(function(n){ul(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ul(e,t,r){return t=Xo(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ve(){"use strict";Ve=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,f){l[u]=f.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(l,u,f){return Object.defineProperty(l,u,{value:f,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{c({},"")}catch{c=function(f,p,y){return f[p]=y}}function h(l,u,f,p){var y=u&&u.prototype instanceof g?u:g,d=Object.create(y.prototype),b=new I(p||[]);return n(d,"_invoke",{value:F(l,f,b)}),d}function v(l,u,f){try{return{type:"normal",arg:l.call(u,f)}}catch(p){return{type:"throw",arg:p}}}e.wrap=h;var m={};function g(){}function _(){}function O(){}var B={};c(B,i,function(){return this});var L=Object.getPrototypeOf,A=L&&L(L(k([])));A&&A!==t&&r.call(A,i)&&(B=A);var T=O.prototype=g.prototype=Object.create(B);function D(l){["next","throw","return"].forEach(function(u){c(l,u,function(f){return this._invoke(u,f)})})}function N(l,u){function f(y,d,b,w){var P=v(l[y],l,d);if(P.type!=="throw"){var x=P.arg,j=x.value;return j&&ne(j)=="object"&&r.call(j,"__await")?u.resolve(j.__await).then(function(R){f("next",R,b,w)},function(R){f("throw",R,b,w)}):u.resolve(j).then(function(R){x.value=R,b(x)},function(R){return f("throw",R,b,w)})}w(P.arg)}var p;n(this,"_invoke",{value:function(d,b){function w(){return new u(function(P,x){f(d,b,P,x)})}return p=p?p.then(w,w):w()}})}function F(l,u,f){var p="suspendedStart";return function(y,d){if(p==="executing")throw new Error("Generator is already running");if(p==="completed"){if(y==="throw")throw d;return z()}for(f.method=y,f.arg=d;;){var b=f.delegate;if(b){var w=U(b,f);if(w){if(w===m)continue;return w}}if(f.method==="next")f.sent=f._sent=f.arg;else if(f.method==="throw"){if(p==="suspendedStart")throw p="completed",f.arg;f.dispatchException(f.arg)}else f.method==="return"&&f.abrupt("return",f.arg);p="executing";var P=v(l,u,f);if(P.type==="normal"){if(p=f.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:f.done}}P.type==="throw"&&(p="completed",f.method="throw",f.arg=P.arg)}}}function U(l,u){var f=u.method,p=l.iterator[f];if(p===void 0)return u.delegate=null,f==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,U(l,u),u.method==="throw")||f!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+f+"' method")),m;var y=v(p,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function W(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function C(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function I(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(W,this),this.reset(!0)}function k(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var f=-1,p=function y(){for(;++f<l.length;)if(r.call(l,f))return y.value=l[f],y.done=!1,y;return y.value=void 0,y.done=!0,y};return p.next=p}}return{next:z}}function z(){return{value:void 0,done:!0}}return _.prototype=O,n(T,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:_,configurable:!0}),_.displayName=c(O,s,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===_||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,c(l,s,"GeneratorFunction")),l.prototype=Object.create(T),l},e.awrap=function(l){return{__await:l}},D(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,f,p,y){y===void 0&&(y=Promise);var d=new N(h(l,u,f,p),y);return e.isGeneratorFunction(u)?d:d.next().then(function(b){return b.done?b.value:d.next()})},D(T),c(T,s,"Generator"),c(T,i,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),f=[];for(var p in u)f.push(p);return f.reverse(),function y(){for(;f.length;){var d=f.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=k,I.prototype={constructor:I,reset:function(u){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(C),!u)for(var f in this)f.charAt(0)==="t"&&r.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var f=this;function p(x,j){return b.type="throw",b.arg=u,f.next=x,j&&(f.method="next",f.arg=void 0),!!j}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],b=d.completion;if(d.tryLoc==="root")return p("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return p(d.catchLoc,!0);if(this.prev<d.finallyLoc)return p(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return p(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return p(d.finallyLoc)}}}},abrupt:function(u,f){for(var p=this.tryEntries.length-1;p>=0;--p){var y=this.tryEntries[p];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=f&&f<=d.finallyLoc&&(d=null);var b=d?d.completion:{};return b.type=u,b.arg=f,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(b)},complete:function(u,f){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&f&&(this.next=f),m},finish:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.finallyLoc===u)return this.complete(p.completion,p.afterLoc),C(p),m}},catch:function(u){for(var f=this.tryEntries.length-1;f>=0;--f){var p=this.tryEntries[f];if(p.tryLoc===u){var y=p.completion;if(y.type==="throw"){var d=y.arg;C(p)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,f,p){return this.delegate={iterator:k(u),resultName:f,nextLoc:p},this.method==="next"&&(this.arg=void 0),m}},e}function Ko(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(h){r(h);return}s.done?t(c):Promise.resolve(c).then(n,o)}function $o(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(c){Ko(i,n,o,a,s,"next",c)}function s(c){Ko(i,n,o,a,s,"throw",c)}a(void 0)})}}function fl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yo(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,Xo(n.key),n)}}function cl(e,t,r){return t&&Yo(e.prototype,t),r&&Yo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xo(e){var t=sl(e,"string");return ne(t)==="symbol"?t:String(t)}function sl(e,t){if(ne(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ne(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ll(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&&yr(e,t)}function yr(e,t){return yr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},yr(e,t)}function pl(e){var t=dl();return function(){var n=Dt(e),o;if(t){var i=Dt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return hl(this,o)}}function hl(e,t){if(t&&(ne(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qo(e)}function qo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dl(){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}}function Dt(e){return Dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Dt(e)}var mr=function(e){ll(r,e);var t=pl(r);r.isSupported=function(){return Boolean(typeof navigator<"u"&&navigator.gpu)},r.create=function(){var o=$o(Ve().mark(function a(s){var c,h,v,m;return Ve().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:if(navigator.gpu){_.next=2;break}throw new Error("WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu");case 2:return S.groupCollapsed(1,"WebGPUDevice created")(),_.next=5,navigator.gpu.requestAdapter({powerPreference:"high-performance"});case 5:if(c=_.sent,c){_.next=8;break}throw new Error("Failed to request WebGPU adapter");case 8:return _.next=10,c.requestAdapterInfo();case 10:return h=_.sent,S.probe(2,"Adapter available",h)(),_.next=14,c.requestDevice({requiredFeatures:c.features});case 14:if(v=_.sent,S.probe(1,"GPUDevice available")(),typeof s.canvas!="string"){_.next=20;break}return _.next=19,ce.pageLoaded;case 19:S.probe(1,"DOM is loaded")();case 20:return m=new r(v,c,h,s),S.probe(1,"Device created. For more info, set chrome://flags/#enable-webgpu-developer-features")(),S.table(1,m.info)(),S.groupEnd(1)(),_.abrupt("return",m);case 25:case"end":return _.stop()}},a)}));function i(a){return o.apply(this,arguments)}return i}();function r(o,i,a,s){var c;fl(this,r),c=t.call(this,Ho(Ho({},s),{},{id:s.id||Y("webgpu-device")})),c.handle=void 0,c.adapter=void 0,c.lost=void 0,c.canvasContext=null,c.commandEncoder=null,c.renderPass=null,c._info=void 0,c._isLost=!1,c.features=void 0,c.handle=o,c.adapter=i;var h=(a.driver||"").split(" Version "),v=rl(h,2),m=v[0],g=v[1],_=a.vendor||c.adapter.__brand||"unknown",O=m||"",B=g||"",L=_==="apple"?"apple":"unknown",A=a.architecture||"unknown",T=a.backend||"unknown",D=(a.type||"").split(" ")[0].toLowerCase()||"unknown";return c._info={type:"webgpu",vendor:_,renderer:O,version:B,gpu:L,gpuType:D,gpuBackend:T,gpuArchitecture:A,shadingLanguage:"wgsl",shadingLanguageVersion:100},c.lost=new Promise(function(){var N=$o(Ve().mark(function F(U){var W;return Ve().wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return I.next=2,c.handle.lost;case 2:W=I.sent,c._isLost=!0,U({reason:"destroyed",message:W.message});case 5:case"end":return I.stop()}},F)}));return function(F){return N.apply(this,arguments)}}()),c.canvasContext=new dr(qo(c),c.adapter,{canvas:s.canvas,height:s.height,width:s.width,container:s.container}),c.features=c._getFeatures(),c}var n=r.prototype;return n.destroy=function(){this.handle.destroy()},n.isTextureFormatSupported=function(i){return!i.includes("webgl")},n.isTextureFormatFilterable=function(i){return this.isTextureFormatSupported(i)},n.isTextureFormatRenderable=function(i){return this.isTextureFormatSupported(i)},n.createBuffer=function(i){var a=this._getBufferProps(i);return new wt(this,a)},n._createTexture=function(i){return new Pt(this,i)},n.createExternalTexture=function(i){return new so(this,i)},n.createShader=function(i){return new jt(this,i)},n.createSampler=function(i){return new K(this,i)},n.createRenderPipeline=function(i){return new Ro(this,i)},n.createFramebuffer=function(i){throw new Error("Not implemented")},n.createComputePipeline=function(i){return new Io(this,i)},n.createVertexArray=function(i){return new ko(this,i)},n.beginRenderPass=function(i){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new Lo(this,i)},n.beginComputePass=function(i){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new No(this,i)},n.createTransformFeedback=function(i){throw new Error("Transform feedback not supported in WebGPU")},n.createCanvasContext=function(i){return new dr(this,this.adapter,i)},n.getDefaultRenderPass=function(){throw new Error("a")},n.submit=function(){var i,a=(i=this.commandEncoder)===null||i===void 0?void 0:i.finish();a&&this.handle.queue.submit([a]),this.commandEncoder=null},n._getFeatures=function(){var i=new Set(this.handle.features);return i.has("depth-clamping")&&(i.delete("depth-clamping"),i.add("depth-clip-control")),i.has("texture-compression-bc")&&i.add("texture-compression-bc5-webgl"),i.add("webgpu"),i.add("timer-query-webgl"),i.add("vertex-array-object-webgl1"),i.add("instanced-rendering-webgl1"),i.add("multiple-render-targets-webgl1"),i.add("index-uint32-webgl1"),i.add("blend-minmax-webgl1"),i.add("texture-blend-float-webgl1"),i.add("texture-formats-srgb-webgl1"),i.add("texture-formats-depth-webgl1"),i.add("texture-formats-float32-webgl1"),i.add("texture-formats-float16-webgl1"),i.add("texture-filter-linear-float32-webgl"),i.add("texture-filter-linear-float16-webgl"),i.add("texture-filter-anisotropic-webgl"),i.add("texture-renderable-rgba32float-webgl"),i.add("texture-renderable-float32-webgl"),i.add("texture-renderable-float16-webgl"),i.add("glsl-frag-data"),i.add("glsl-frag-depth"),i.add("glsl-derivatives"),i.add("glsl-texture-lod"),i},n.copyExternalImageToTexture=function(i){var a,s=i.source,c=i.sourceX,h=c===void 0?0:c,v=i.sourceY,m=v===void 0?0:v,g=i.texture,_=i.mipLevel,O=_===void 0?0:_,B=i.aspect,L=B===void 0?"all":B,A=i.colorSpace,T=A===void 0?"display-p3":A,D=i.premultipliedAlpha,N=D===void 0?!1:D,F=i.width,U=F===void 0?g.width:F,W=i.height,C=W===void 0?g.height:W,I=i.depth,k=I===void 0?1:I,z=g;(a=this.handle)===null||a===void 0||a.queue.copyExternalImageToTexture({source:s,origin:[h,m]},{texture:z.handle,origin:[0,0,0],mipLevel:O,aspect:L,colorSpace:T,premultipliedAlpha:N},[U,C,k])},cl(r,[{key:"info",get:function(){return this._info}},{key:"limits",get:function(){return this.handle.limits}},{key:"isLost",get:function(){return this._isLost}}]),r}(ke);mr.type="webgpu";return ri(yl);})();
|
|
30
30
|
return __exports__;
|
|
31
31
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/webgpu",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.54",
|
|
4
4
|
"description": "WebGPU adapter for the luma.gl API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@babel/runtime": "^7.0.0",
|
|
40
|
-
"@luma.gl/core": "9.0.0-alpha.
|
|
40
|
+
"@luma.gl/core": "9.0.0-alpha.54",
|
|
41
41
|
"@probe.gl/env": "^4.0.2",
|
|
42
42
|
"@webgpu/types": "^0.1.34"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "6028eb651303eadbc8f25e86d135d28f118fa3cf"
|
|
45
45
|
}
|
|
@@ -93,3 +93,55 @@ export class WebGPUBuffer extends Buffer {
|
|
|
93
93
|
this.handle.unmap();
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
// Convenience API
|
|
99
|
+
/** Read data from the buffer *
|
|
100
|
+
async readAsync(options: {
|
|
101
|
+
byteOffset?: number,
|
|
102
|
+
byteLength?: number,
|
|
103
|
+
map?: boolean,
|
|
104
|
+
unmap?: boolean
|
|
105
|
+
}): Promise<ArrayBuffer> {
|
|
106
|
+
if (options.map ?? true) {
|
|
107
|
+
await this.mapAsync(Buffer.MAP_READ, options.byteOffset, options.byteLength);
|
|
108
|
+
}
|
|
109
|
+
const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);
|
|
110
|
+
if (options.unmap ?? true) {
|
|
111
|
+
this.unmap();
|
|
112
|
+
}
|
|
113
|
+
return arrayBuffer;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Write data to the buffer *
|
|
117
|
+
async writeAsync(options: {
|
|
118
|
+
data: ArrayBuffer,
|
|
119
|
+
byteOffset?: number,
|
|
120
|
+
byteLength?: number,
|
|
121
|
+
map?: boolean,
|
|
122
|
+
unmap?: boolean
|
|
123
|
+
}): Promise<void> {
|
|
124
|
+
if (options.map ?? true) {
|
|
125
|
+
await this.mapAsync(Buffer.MAP_WRITE, options.byteOffset, options.byteLength);
|
|
126
|
+
}
|
|
127
|
+
const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);
|
|
128
|
+
const destArray = new Uint8Array(arrayBuffer);
|
|
129
|
+
const srcArray = new Uint8Array(options.data);
|
|
130
|
+
destArray.set(srcArray);
|
|
131
|
+
if (options.unmap ?? true) {
|
|
132
|
+
this.unmap();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
// Mapped API (WebGPU)
|
|
138
|
+
|
|
139
|
+
/** Maps the memory so that it can be read *
|
|
140
|
+
// abstract mapAsync(mode, byteOffset, byteLength): Promise<void>
|
|
141
|
+
|
|
142
|
+
/** Get the mapped range of data for reading or writing *
|
|
143
|
+
// abstract getMappedRange(byteOffset, byteLength): ArrayBuffer;
|
|
144
|
+
|
|
145
|
+
/** unmap makes the contents of the buffer available to the GPU again *
|
|
146
|
+
// abstract unmap(): void;
|
|
147
|
+
*/
|