typegpu 0.8.1 → 0.8.2
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/{chunk-7S3IK3D4.js → chunk-6U5HPHCJ.js} +2 -2
- package/{chunk-7XFSK632.js → chunk-CGQB3SER.js} +2 -2
- package/{chunk-4W5Z7BO4.js → chunk-CRZWTZM2.js} +2 -2
- package/chunk-CRZWTZM2.js.map +1 -0
- package/{chunk-2UXPGML5.js → chunk-ECR2EGZX.js} +2 -2
- package/{chunk-VOVQAOVG.js → chunk-PWBIFP67.js} +2 -2
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/data/index.d.ts +3 -3
- package/data/index.js +1 -1
- package/index.d.ts +2 -2
- package/index.js +14 -14
- package/index.js.map +1 -1
- package/{matrix-DLipCOZF.d.ts → matrix-DIfOiRyz.d.ts} +1 -1
- package/package.json +5 -13
- package/std/index.d.ts +2 -2
- package/std/index.js +1 -1
- package/{tgpuConstant-BU72w5qs.d.cts → tgpuConstant-BTQFNlQH.d.ts} +9 -0
- package/chunk-3246CM7C.cjs +0 -2
- package/chunk-3246CM7C.cjs.map +0 -1
- package/chunk-4W5Z7BO4.js.map +0 -1
- package/chunk-5Y6GTBWR.cjs +0 -3
- package/chunk-5Y6GTBWR.cjs.map +0 -1
- package/chunk-PRMFGUQT.cjs +0 -2
- package/chunk-PRMFGUQT.cjs.map +0 -1
- package/chunk-TRE7NUKE.cjs +0 -10
- package/chunk-TRE7NUKE.cjs.map +0 -1
- package/chunk-ZYGTVBDH.cjs +0 -7
- package/chunk-ZYGTVBDH.cjs.map +0 -1
- package/common/index.cjs +0 -7
- package/common/index.cjs.map +0 -1
- package/common/index.d.cts +0 -24
- package/data/index.cjs +0 -2
- package/data/index.cjs.map +0 -1
- package/data/index.d.cts +0 -402
- package/index.cjs +0 -192
- package/index.cjs.map +0 -1
- package/index.d.cts +0 -369
- package/matrix-DHFT4O8f.d.cts +0 -122
- package/std/index.cjs +0 -2
- package/std/index.cjs.map +0 -1
- package/std/index.d.cts +0 -639
- package/tgpuConstant-BU72w5qs.d.ts +0 -5192
- /package/{chunk-7S3IK3D4.js.map → chunk-6U5HPHCJ.js.map} +0 -0
- /package/{chunk-7XFSK632.js.map → chunk-CGQB3SER.js.map} +0 -0
- /package/{chunk-2UXPGML5.js.map → chunk-ECR2EGZX.js.map} +0 -0
- /package/{chunk-VOVQAOVG.js.map → chunk-PWBIFP67.js.map} +0 -0
package/chunk-TRE7NUKE.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/shared/symbols.ts","../src/data/wgslTypes.ts","../src/shared/env.ts","../src/shared/meta.ts","../src/shared/vertexFormat.ts","../src/data/dataTypes.ts","../src/errors.ts","../src/tgsl/conversion.ts","../src/data/vectorImpl.ts"],"names":["version","$internal","$gpuValueOf","$getNameForward","$providing","$ownSnippet","$resolve","$repr","$gpuRepr","$reprPartial","$memIdent","$validStorageSchema","$validUniformSchema","$validVertexSchema","$invalidSchemaReason","isMarkedInternal","value","Void","wgslTypeLiterals","isVecInstance","v","isVec2","isVec3","isVec4","isVec","isMatInstance","isMat2x2f","isMat3x3f","isMat4x4f","isMat","isFloat32VecInstance","element","isWgslData","isWgslArray","schema","isWgslStruct","isPtr","isAtomic","isAlignAttrib","isSizeAttrib","isLocationAttrib","isInterpolateAttrib","isBuiltinAttrib","isDecorated","isVoid","isNumericSchema","type","isHalfPrecisionSchema","DEV","TEST","exp","label","isNamable","getName","globalWithMeta","PERF","name","data","records","entries","isForwarded","definition","getMetaData","setName","setMetaData","hasTinyestMetadata","metaData","map","vertexFormats","kindToDefaultFormatMap","undecorate","looseTypeLiterals","isLooseData","isDisarray","isUnstruct","isLooseDecorated","getCustomAlignment","getCustomSize","getCustomLocation","isData","UnknownData","InfixDispatch","lhs","operator","MatrixColumnsAccess","matrix","ConsoleLog","op","prefix","invariant","condition","message","provided"],"mappings":"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","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-TRE7NUKE.cjs","sourcesContent":["{\n \"name\": \"typegpu\",\n \"private\": true,\n \"version\": \"0.8.1\",\n \"description\": \"A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.\",\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": \"./src/index.ts\",\n \"./data\": \"./src/data/index.ts\",\n \"./std\": \"./src/std/index.ts\",\n \"./common\": \"./src/common/index.ts\"\n },\n \"publishConfig\": {\n \"directory\": \"dist\",\n \"linkDirectory\": false,\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \"./package.json\": \"./dist/package.json\",\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"module\": \"./dist/index.js\",\n \"import\": \"./dist/index.js\",\n \"default\": \"./dist/index.cjs\"\n },\n \"./data\": {\n \"types\": \"./dist/data/index.d.ts\",\n \"module\": \"./dist/data/index.js\",\n \"import\": \"./dist/data/index.js\",\n \"default\": \"./dist/data/index.cjs\"\n },\n \"./std\": {\n \"types\": \"./dist/std/index.d.ts\",\n \"module\": \"./dist/std/index.js\",\n \"import\": \"./dist/std/index.js\",\n \"default\": \"./dist/std/index.cjs\"\n },\n \"./common\": {\n \"types\": \"./dist/common/index.d.ts\",\n \"module\": \"./dist/common/index.js\",\n \"import\": \"./dist/common/index.js\",\n \"default\": \"./dist/common/index.cjs\"\n }\n }\n },\n \"sideEffects\": false,\n \"scripts\": {\n \"build\": \"tsup\",\n \"test:types\": \"pnpm tsc --p ./tsconfig.test.json --noEmit\",\n \"prepublishOnly\": \"tgpu-dev-cli prepack\"\n },\n \"engines\": {\n \"node\": \">=12.20.0\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/software-mansion/TypeGPU.git\"\n },\n \"keywords\": [\n \"webgpu\",\n \"wgpu\",\n \"wgsl\",\n \"typescript\",\n \"compute\",\n \"shader\",\n \"shaders\",\n \"gpgpu\"\n ],\n \"bugs\": {\n \"url\": \"https://github.com/software-mansion/TypeGPU/issues\"\n },\n \"homepage\": \"https://typegpu.com\",\n \"devDependencies\": {\n \"@ark/attest\": \"^0.49.0\",\n \"@typegpu/tgpu-dev-cli\": \"workspace:*\",\n \"@webgpu/types\": \"catalog:types\",\n \"arktype\": \"catalog:\",\n \"jiti\": \"catalog:build\",\n \"jsdom\": \"^27.0.0\",\n \"tsup\": \"catalog:build\",\n \"typescript\": \"catalog:types\",\n \"unplugin-typegpu\": \"workspace:*\",\n \"wgpu-matrix\": \"catalog:example\"\n },\n \"packageManager\": \"pnpm@10.15.1+sha512.34e538c329b5553014ca8e8f4535997f96180a1d0f614339357449935350d924e22f8614682191264ec33d1462ac21561aff97f6bb18065351c162c7e8f6de67\",\n \"dependencies\": {\n \"tinyest\": \"workspace:~0.1.2\",\n \"typed-binary\": \"^4.3.1\"\n }\n}\n","// The version is inlined during build-time 🎉\n// It helps us identify problems when two versions of\n// TypeGPU are used at the same time.\nimport { version } from '../../package.json';\n\nexport const $internal = Symbol(`typegpu:${version}:$internal`);\n/**\n * The getter to the value of this resource, accessible on the GPU\n */\nexport const $gpuValueOf = Symbol(`typegpu:${version}:$gpuValueOf`);\nexport const $getNameForward = Symbol(`typegpu:${version}:$getNameForward`);\n/**\n * Marks an object with slot-value bindings\n */\nexport const $providing = Symbol(`typegpu:${version}:$providing`);\n\n/**\n * Objects can provide the snippet that represents them.\n */\nexport const $ownSnippet = Symbol(`typegpu:${version}:$ownSnippet`);\n\nexport const $resolve = Symbol(`typegpu:${version}:$resolve`);\n\n//\n// Type tokens\n//\n\n/**\n * Type token for the inferred (CPU & GPU) representation of a resource\n */\nexport const $repr = Symbol(`typegpu:${version}:$repr`);\n/**\n * Type token for the inferred (GPU-side) representation of a resource\n * If present, it shadows the value of `$repr` for GPU-side inference.\n */\nexport const $gpuRepr = Symbol(`typegpu:${version}:$gpuRepr`);\n/**\n * Type token for the inferred partial representation of a resource.\n * If present, it shadows the value of `$repr` for use in partial IO.\n */\nexport const $reprPartial = Symbol(`typegpu:${version}:$reprPartial`);\n/**\n * Type token holding schemas that are identical in memory layout.\n */\nexport const $memIdent = Symbol(`typegpu:${version}:$memIdent`);\n\n/**\n * Type token, signaling that a schema can be used in a storage buffer.\n */\nexport const $validStorageSchema = Symbol(\n `typegpu:${version}:$invalidStorageSchema`,\n);\n/**\n * Type token, signaling that a schema can be used in a uniform buffer.\n */\nexport const $validUniformSchema = Symbol(\n `typegpu:${version}:$validUniformSchema`,\n);\n/**\n * Type token, signaling that a schema can be used in a vertex buffer.\n */\nexport const $validVertexSchema = Symbol(\n `typegpu:${version}:$validVertexSchema`,\n);\n/**\n * Type token, containing a reason for why the schema is invalid (if it is).\n */\nexport const $invalidSchemaReason = Symbol(\n `typegpu:${version}:$invalidSchemaReason`,\n);\n\nexport function isMarkedInternal(\n value: unknown,\n): value is { [$internal]: Record<string, unknown> | true } {\n return !!(value as { [$internal]: Record<string, unknown> })?.[$internal];\n}\n","import type { TgpuNamable } from '../shared/meta.ts';\nimport { isMarkedInternal } from '../shared/symbols.ts';\nimport type {\n ExtractInvalidSchemaError,\n Infer,\n InferGPU,\n InferGPURecord,\n InferPartial,\n InferPartialRecord,\n InferRecord,\n IsValidStorageSchema,\n IsValidUniformSchema,\n IsValidVertexSchema,\n MemIdentity,\n MemIdentityRecord,\n} from '../shared/repr.ts';\nimport type {\n $gpuRepr,\n $invalidSchemaReason,\n $memIdent,\n $repr,\n $reprPartial,\n $validStorageSchema,\n $validUniformSchema,\n $validVertexSchema,\n} from '../shared/symbols.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { Prettify, SwapNever } from '../shared/utilityTypes.ts';\nimport type { DualFn } from './dualFn.ts';\nimport type {\n WgslExternalTexture,\n WgslStorageTexture,\n WgslTexture,\n} from './texture.ts';\nimport type { WgslComparisonSampler, WgslSampler } from './sampler.ts';\n\ntype DecoratedLocation<T extends BaseData> = Decorated<T, Location[]>;\n\nexport interface BaseData {\n // biome-ignore lint/suspicious/noExplicitAny: we sometimes house functions on the internal object, so the type needs to be wider\n readonly [$internal]: true | Record<string, any>;\n readonly type: string;\n readonly [$repr]: unknown;\n}\n\nexport interface NumberArrayView {\n readonly length: number;\n [n: number]: number;\n [Symbol.iterator]: () => Iterator<number>;\n}\n\n/**\n * Vector infix notation.\n *\n * @privateRemarks\n * These functions are not defined on vectors,\n * but are instead assigned to `VecBase` after both `data` and `std` are initialized.\n */\nexport interface vecInfixNotation<T extends AnyNumericVecInstance> {\n add(other: number): T;\n add(other: T): T;\n\n sub(other: number): T;\n sub(other: T): T;\n\n mul(other: number): T;\n mul(other: T): T;\n mul(other: mBaseForVec<T>): T;\n\n div(other: number): T;\n div(other: T): T;\n}\n\n/**\n * Matrix infix notation.\n *\n * @privateRemarks\n * These functions are not defined on matrices,\n * but are instead assigned to `MatBase` after both `data` and `std` are initialized.\n */\nexport interface matInfixNotation<T extends AnyMatInstance> {\n add(other: T): T;\n\n sub(other: T): T;\n\n mul(other: number): T;\n mul(other: vBaseForMat<T>): vBaseForMat<T>;\n mul(other: T): T;\n}\n\n/**\n * Represents a 64-bit integer.\n */\nexport interface AbstractInt extends BaseData {\n readonly type: 'abstractInt';\n // Type-tokens, not available at runtime\n readonly [$repr]: number;\n readonly [$invalidSchemaReason]: 'Abstract numerics are not host-shareable';\n // ---\n}\n\n/**\n * Represents a 64-bit IEEE 754 floating point number.\n */\nexport interface AbstractFloat extends BaseData {\n readonly type: 'abstractFloat';\n // Type-tokens, not available at runtime\n readonly [$repr]: number;\n readonly [$invalidSchemaReason]: 'Abstract numerics are not host-shareable';\n // ---\n}\n\nexport interface Void extends BaseData {\n readonly type: 'void';\n // Type-tokens, not available at runtime\n // biome-ignore lint/suspicious/noConfusingVoidType: void is void\n readonly [$repr]: void;\n readonly [$invalidSchemaReason]: 'Void is not host-shareable';\n // ---\n}\nexport const Void = {\n [$internal]: true,\n type: 'void',\n toString() {\n return 'void';\n },\n} as Void;\n\n// #region Instance Types\n\ninterface Swizzle2<T2, T3, T4> {\n readonly xx: T2;\n readonly xy: T2;\n readonly yx: T2;\n readonly yy: T2;\n\n readonly xxx: T3;\n readonly xxy: T3;\n readonly xyx: T3;\n readonly xyy: T3;\n readonly yxx: T3;\n readonly yxy: T3;\n readonly yyx: T3;\n readonly yyy: T3;\n\n readonly xxxx: T4;\n readonly xxxy: T4;\n readonly xxyx: T4;\n readonly xxyy: T4;\n readonly xyxx: T4;\n readonly xyxy: T4;\n readonly xyyx: T4;\n readonly xyyy: T4;\n readonly yxxx: T4;\n readonly yxxy: T4;\n readonly yxyx: T4;\n readonly yxyy: T4;\n readonly yyxx: T4;\n readonly yyxy: T4;\n readonly yyyx: T4;\n readonly yyyy: T4;\n}\n\ninterface Swizzle3<T2, T3, T4> extends Swizzle2<T2, T3, T4> {\n readonly xz: T2;\n readonly yz: T2;\n readonly zx: T2;\n readonly zy: T2;\n readonly zz: T2;\n\n readonly xxz: T3;\n readonly xyz: T3;\n readonly xzx: T3;\n readonly xzy: T3;\n readonly xzz: T3;\n readonly yxz: T3;\n readonly yyz: T3;\n readonly yzx: T3;\n readonly yzy: T3;\n readonly yzz: T3;\n readonly zxx: T3;\n readonly zxy: T3;\n readonly zxz: T3;\n readonly zyx: T3;\n readonly zyy: T3;\n readonly zyz: T3;\n readonly zzx: T3;\n readonly zzy: T3;\n readonly zzz: T3;\n\n readonly xxxz: T4;\n readonly xxyz: T4;\n readonly xxzx: T4;\n readonly xxzy: T4;\n readonly xxzz: T4;\n readonly xyxz: T4;\n readonly xyyz: T4;\n readonly xyzx: T4;\n readonly xyzy: T4;\n readonly xyzz: T4;\n readonly xzxx: T4;\n readonly xzxy: T4;\n readonly xzxz: T4;\n readonly xzyx: T4;\n readonly xzyy: T4;\n readonly xzyz: T4;\n readonly xzzx: T4;\n readonly xzzy: T4;\n readonly xzzz: T4;\n readonly yxxz: T4;\n readonly yxyz: T4;\n readonly yxzx: T4;\n readonly yxzy: T4;\n readonly yxzz: T4;\n readonly yyxz: T4;\n readonly yyyz: T4;\n readonly yyzx: T4;\n readonly yyzy: T4;\n readonly yyzz: T4;\n readonly yzxx: T4;\n readonly yzxy: T4;\n readonly yzxz: T4;\n readonly yzyx: T4;\n readonly yzyy: T4;\n readonly yzyz: T4;\n readonly yzzx: T4;\n readonly yzzy: T4;\n readonly yzzz: T4;\n readonly zxxx: T4;\n readonly zxxy: T4;\n readonly zxxz: T4;\n readonly zxyx: T4;\n readonly zxyy: T4;\n readonly zxyz: T4;\n readonly zxzx: T4;\n readonly zxzy: T4;\n readonly zxzz: T4;\n readonly zyxx: T4;\n readonly zyxy: T4;\n readonly zyxz: T4;\n readonly zyyx: T4;\n readonly zyyy: T4;\n readonly zyyz: T4;\n readonly zyzx: T4;\n readonly zyzy: T4;\n readonly zyzz: T4;\n readonly zzxx: T4;\n readonly zzxy: T4;\n readonly zzxz: T4;\n readonly zzyx: T4;\n readonly zzyy: T4;\n readonly zzyz: T4;\n readonly zzzx: T4;\n readonly zzzy: T4;\n readonly zzzz: T4;\n}\n\ninterface Swizzle4<T2, T3, T4> extends Swizzle3<T2, T3, T4> {\n readonly yw: T2;\n readonly zw: T2;\n readonly wx: T2;\n readonly wy: T2;\n readonly wz: T2;\n readonly ww: T2;\n\n readonly xxw: T3;\n readonly xyw: T3;\n readonly xzw: T3;\n readonly xwx: T3;\n readonly xwy: T3;\n readonly xwz: T3;\n readonly xww: T3;\n readonly yxw: T3;\n readonly yyw: T3;\n readonly yzw: T3;\n readonly ywx: T3;\n readonly ywy: T3;\n readonly ywz: T3;\n readonly yww: T3;\n readonly zxw: T3;\n readonly zyw: T3;\n readonly zzw: T3;\n readonly zwx: T3;\n readonly zwy: T3;\n readonly zwz: T3;\n readonly zww: T3;\n readonly wxx: T3;\n readonly wxz: T3;\n readonly wxy: T3;\n readonly wyy: T3;\n readonly wyz: T3;\n readonly wzz: T3;\n readonly wwx: T3;\n readonly wwy: T3;\n readonly wwz: T3;\n readonly www: T3;\n\n readonly xxxw: T4;\n readonly xxyw: T4;\n readonly xxzw: T4;\n readonly xxwx: T4;\n readonly xxwy: T4;\n readonly xxwz: T4;\n readonly xxww: T4;\n readonly xyxw: T4;\n readonly xyyw: T4;\n readonly xyzw: T4;\n readonly xywx: T4;\n readonly xywy: T4;\n readonly xywz: T4;\n readonly xyww: T4;\n readonly xzxw: T4;\n readonly xzyw: T4;\n readonly xzzw: T4;\n readonly xzwx: T4;\n readonly xzwy: T4;\n readonly xzwz: T4;\n readonly xzww: T4;\n readonly xwxx: T4;\n readonly xwxy: T4;\n readonly xwxz: T4;\n readonly xwyy: T4;\n readonly xwyz: T4;\n readonly xwzz: T4;\n readonly xwwx: T4;\n readonly xwwy: T4;\n readonly xwwz: T4;\n readonly xwww: T4;\n readonly yxxw: T4;\n readonly yxyw: T4;\n readonly yxzw: T4;\n readonly yxwx: T4;\n readonly yxwy: T4;\n readonly yxwz: T4;\n readonly yxww: T4;\n readonly yyxw: T4;\n readonly yyyw: T4;\n readonly yyzw: T4;\n readonly yywx: T4;\n readonly yywy: T4;\n readonly yywz: T4;\n readonly yyww: T4;\n readonly yzxw: T4;\n readonly yzyw: T4;\n readonly yzzw: T4;\n readonly yzwx: T4;\n readonly yzwy: T4;\n readonly yzwz: T4;\n readonly yzww: T4;\n readonly ywxx: T4;\n readonly ywxy: T4;\n readonly ywxz: T4;\n readonly ywxw: T4;\n readonly ywyy: T4;\n readonly ywyz: T4;\n readonly ywzz: T4;\n readonly ywwx: T4;\n readonly ywwy: T4;\n readonly ywwz: T4;\n readonly ywww: T4;\n readonly zxxw: T4;\n readonly zxyw: T4;\n readonly zxzw: T4;\n readonly zxwx: T4;\n readonly zxwy: T4;\n readonly zxwz: T4;\n readonly zxww: T4;\n readonly zyxw: T4;\n readonly zyyw: T4;\n readonly zyzw: T4;\n readonly zywx: T4;\n readonly zywy: T4;\n readonly zywz: T4;\n readonly zyww: T4;\n readonly zzxw: T4;\n readonly zzyw: T4;\n readonly zzzw: T4;\n readonly zzwx: T4;\n readonly zzwy: T4;\n readonly zzwz: T4;\n readonly zzww: T4;\n readonly zwxx: T4;\n readonly zwxy: T4;\n readonly zwxz: T4;\n readonly zwxw: T4;\n readonly zwyy: T4;\n readonly zwyz: T4;\n readonly zwzz: T4;\n readonly zwwx: T4;\n readonly zwwy: T4;\n readonly zwwz: T4;\n readonly zwww: T4;\n readonly wxxx: T4;\n readonly wxxy: T4;\n readonly wxxz: T4;\n readonly wxxw: T4;\n readonly wxyx: T4;\n readonly wxyy: T4;\n readonly wxyz: T4;\n readonly wxyw: T4;\n readonly wxzx: T4;\n readonly wxzy: T4;\n readonly wxzz: T4;\n readonly wxzw: T4;\n readonly wxwx: T4;\n readonly wxwy: T4;\n readonly wxwz: T4;\n readonly wxww: T4;\n readonly wyxx: T4;\n readonly wyxy: T4;\n readonly wyxz: T4;\n readonly wyxw: T4;\n readonly wyyy: T4;\n readonly wyyz: T4;\n readonly wyzw: T4;\n readonly wywx: T4;\n readonly wywy: T4;\n readonly wywz: T4;\n readonly wyww: T4;\n readonly wzxx: T4;\n readonly wzxy: T4;\n readonly wzxz: T4;\n readonly wzxw: T4;\n readonly wzyy: T4;\n readonly wzyz: T4;\n readonly wzzy: T4;\n readonly wzzw: T4;\n readonly wzwx: T4;\n readonly wzwy: T4;\n readonly wzwz: T4;\n readonly wzww: T4;\n readonly wwxx: T4;\n readonly wwxy: T4;\n readonly wwxz: T4;\n readonly wwxw: T4;\n readonly wwyy: T4;\n readonly wwyz: T4;\n readonly wwzz: T4;\n readonly wwwx: T4;\n readonly wwwy: T4;\n readonly wwwz: T4;\n readonly wwww: T4;\n}\n\ntype Tuple2<S> = [S, S];\ntype Tuple3<S> = [S, S, S];\ntype Tuple4<S> = [S, S, S, S];\n\n/**\n * Interface representing its WGSL vector type counterpart: vec2f or vec2<f32>.\n * A vector with 2 elements of type f32\n */\nexport interface v2f\n extends Tuple2<number>, Swizzle2<v2f, v3f, v4f>, vecInfixNotation<v2f> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec2f';\n x: number;\n y: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec2h or vec2<f16>.\n * A vector with 2 elements of type f16\n */\nexport interface v2h\n extends Tuple2<number>, Swizzle2<v2h, v3h, v4h>, vecInfixNotation<v2h> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec2h';\n x: number;\n y: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec2i or vec2<i32>.\n * A vector with 2 elements of type i32\n */\nexport interface v2i\n extends Tuple2<number>, Swizzle2<v2i, v3i, v4i>, vecInfixNotation<v2i> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec2i';\n x: number;\n y: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec2u or vec2<u32>.\n * A vector with 2 elements of type u32\n */\nexport interface v2u\n extends Tuple2<number>, Swizzle2<v2u, v3u, v4u>, vecInfixNotation<v2u> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec2u';\n x: number;\n y: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: `vec2<bool>`.\n * A vector with 2 elements of type `bool`\n */\nexport interface v2b extends Tuple2<boolean>, Swizzle2<v2b, v3b, v4b> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec2<bool>';\n x: boolean;\n y: boolean;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec3f or vec3<f32>.\n * A vector with 3 elements of type f32\n */\nexport interface v3f\n extends Tuple3<number>, Swizzle3<v2f, v3f, v4f>, vecInfixNotation<v3f> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec3f';\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec3h or vec3<f16>.\n * A vector with 3 elements of type f16\n */\nexport interface v3h\n extends Tuple3<number>, Swizzle3<v2h, v3h, v4h>, vecInfixNotation<v3h> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec3h';\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec3i or vec3<i32>.\n * A vector with 3 elements of type i32\n */\nexport interface v3i\n extends Tuple3<number>, Swizzle3<v2i, v3i, v4i>, vecInfixNotation<v3i> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec3i';\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec3u or vec3<u32>.\n * A vector with 3 elements of type u32\n */\nexport interface v3u\n extends Tuple3<number>, Swizzle3<v2u, v3u, v4u>, vecInfixNotation<v3u> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec3u';\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: `vec3<bool>`.\n * A vector with 3 elements of type `bool`\n */\nexport interface v3b extends Tuple3<boolean>, Swizzle3<v2b, v3b, v4b> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec3<bool>';\n x: boolean;\n y: boolean;\n z: boolean;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec4f or vec4<f32>.\n * A vector with 4 elements of type f32\n */\nexport interface v4f\n extends Tuple4<number>, Swizzle4<v2f, v3f, v4f>, vecInfixNotation<v4f> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec4f';\n x: number;\n y: number;\n z: number;\n w: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec4h or vec4<f16>.\n * A vector with 4 elements of type f16\n */\nexport interface v4h\n extends Tuple4<number>, Swizzle4<v2h, v3h, v4h>, vecInfixNotation<v4h> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec4h';\n x: number;\n y: number;\n z: number;\n w: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec4i or vec4<i32>.\n * A vector with 4 elements of type i32\n */\nexport interface v4i\n extends Tuple4<number>, Swizzle4<v2i, v3i, v4i>, vecInfixNotation<v4i> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec4i';\n x: number;\n y: number;\n z: number;\n w: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: vec4u or vec4<u32>.\n * A vector with 4 elements of type u32\n */\nexport interface v4u\n extends Tuple4<number>, Swizzle4<v2u, v3u, v4u>, vecInfixNotation<v4u> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec4u';\n x: number;\n y: number;\n z: number;\n w: number;\n}\n\n/**\n * Interface representing its WGSL vector type counterpart: `vec4<bool>`.\n * A vector with 4 elements of type `bool`\n */\nexport interface v4b extends Tuple4<boolean>, Swizzle4<v2b, v3b, v4b> {\n readonly [$internal]: true;\n /** use to distinguish between vectors of the same size on the type level */\n readonly kind: 'vec4<bool>';\n x: boolean;\n y: boolean;\n z: boolean;\n w: boolean;\n}\n\nexport type AnyFloat32VecInstance = v2f | v3f | v4f;\n\nexport type AnyFloat16VecInstance = v2h | v3h | v4h;\n\nexport type AnyFloatVecInstance = v2f | v2h | v3f | v3h | v4f | v4h;\n\nexport type AnyUnsignedVecInstance = v2u | v3u | v4u;\n\nexport type AnyIntegerVecInstance = v2i | v2u | v3i | v3u | v4i | v4u;\n\nexport type AnyBooleanVecInstance = v2b | v3b | v4b;\n\nexport type AnySignedVecInstance =\n | v2i\n | v2f\n | v2h\n | v3i\n | v3f\n | v3h\n | v4i\n | v4f\n | v4h;\n\nexport type AnyNumericVec2Instance = v2f | v2h | v2i | v2u;\nexport type AnyNumericVec3Instance = v3f | v3h | v3i | v3u;\nexport type AnyNumericVec4Instance = v4f | v4h | v4i | v4u;\n\nexport type AnyNumericVecInstance =\n | AnyNumericVec2Instance\n | AnyNumericVec3Instance\n | AnyNumericVec4Instance;\n\nexport type AnyVec2Instance = v2f | v2h | v2i | v2u | v2b;\nexport type AnyVec3Instance = v3f | v3h | v3i | v3u | v3b;\nexport type AnyVec4Instance = v4f | v4h | v4i | v4u | v4b;\n\nexport type AnyVecInstance =\n | AnyVec2Instance\n | AnyVec3Instance\n | AnyVec4Instance;\n\nexport type VecKind = AnyVecInstance['kind'];\n\n/**\n * Interface representing its WGSL matrix type counterpart: mat2x2\n * A matrix with 2 rows and 2 columns, with elements of type `TColumn`\n */\nexport interface mat2x2<TColumn> extends NumberArrayView {\n readonly [$internal]: true;\n readonly length: 4;\n readonly kind: string;\n /* override */ readonly columns: readonly [TColumn, TColumn];\n [n: number]: number;\n}\n\n/**\n * Interface representing its WGSL matrix type counterpart: mat2x2f or mat2x2<f32>\n * A matrix with 2 rows and 2 columns, with elements of type d.f32\n */\nexport interface m2x2f extends mat2x2<v2f>, matInfixNotation<m2x2f> {\n readonly kind: 'mat2x2f';\n}\n\n/**\n * Interface representing its WGSL matrix type counterpart: mat3x3\n * A matrix with 3 rows and 3 columns, with elements of type `TColumn`\n */\nexport interface mat3x3<TColumn> extends NumberArrayView {\n readonly [$internal]: true;\n readonly length: 12;\n readonly kind: string;\n /* override */ readonly columns: readonly [TColumn, TColumn, TColumn];\n [n: number]: number;\n}\n\n/**\n * Interface representing its WGSL matrix type counterpart: mat3x3f or mat3x3<f32>\n * A matrix with 3 rows and 3 columns, with elements of type d.f32\n */\nexport interface m3x3f extends mat3x3<v3f>, matInfixNotation<m3x3f> {\n readonly kind: 'mat3x3f';\n}\n\n/**\n * Interface representing its WGSL matrix type counterpart: mat4x4\n * A matrix with 4 rows and 4 columns, with elements of type `TColumn`\n */\nexport interface mat4x4<TColumn> extends NumberArrayView {\n readonly [$internal]: true;\n readonly length: 16;\n readonly kind: string;\n /* override */ readonly columns: readonly [\n TColumn,\n TColumn,\n TColumn,\n TColumn,\n ];\n [n: number]: number;\n}\n\n/**\n * Interface representing its WGSL matrix type counterpart: mat4x4f or mat4x4<f32>\n * A matrix with 4 rows and 4 columns, with elements of type d.f32\n */\nexport interface m4x4f extends mat4x4<v4f>, matInfixNotation<m4x4f> {\n readonly kind: 'mat4x4f';\n}\n\nexport type AnyMatInstance = m2x2f | m3x3f | m4x4f;\n\nexport type vBaseForMat<T extends AnyMatInstance> = T extends m2x2f ? v2f\n : T extends m3x3f ? v3f\n : v4f;\n\nexport type mBaseForVec<T extends AnyVecInstance> = T extends v2f ? m2x2f\n : T extends v3f ? m3x3f\n : T extends v4f ? m4x4f\n : never;\n\n// #endregion\n\n// #region WGSL Schema Types\n\n/**\n * Boolean schema representing a single WGSL bool value.\n * Cannot be used inside buffers as it is not host-shareable.\n */\nexport interface Bool extends DualFn<(v?: number | boolean) => boolean> {\n readonly type: 'bool';\n\n // Type-tokens, not available at runtime\n readonly [$repr]: boolean;\n readonly [$invalidSchemaReason]:\n 'Bool is not host-shareable, use U32 or I32 instead';\n // ---\n}\n\n/**\n * 32-bit float schema representing a single WGSL f32 value.\n */\nexport interface F32 extends DualFn<(v?: number | boolean) => number> {\n readonly type: 'f32';\n\n // Type-tokens, not available at runtime\n readonly [$repr]: number;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * 16-bit float schema representing a single WGSL f16 value.\n */\nexport interface F16 extends DualFn<(v?: number | boolean) => number> {\n readonly type: 'f16';\n\n // Type-tokens, not available at runtime\n readonly [$repr]: number;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Signed 32-bit integer schema representing a single WGSL i32 value.\n */\nexport interface I32 extends DualFn<(v?: number | boolean) => number> {\n readonly type: 'i32';\n\n // Type-tokens, not available at runtime\n readonly [$repr]: number;\n readonly [$memIdent]: I32 | Atomic<I32> | DecoratedLocation<I32>;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Unsigned 32-bit integer schema representing a single WGSL u32 value.\n */\nexport interface U32 extends DualFn<(v?: number | boolean) => number> {\n readonly type: 'u32';\n\n // Type-tokens, not available at runtime\n readonly [$repr]: number;\n readonly [$memIdent]: U32 | Atomic<U32> | DecoratedLocation<U32>;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Unsigned 16-bit integer schema used exclusively for index buffer schemas.\n */\nexport interface U16 extends BaseData {\n readonly type: 'u16';\n\n // Type-tokens, not available at runtime\n readonly [$repr]: number;\n readonly [$invalidSchemaReason]:\n 'U16 is only usable inside arrays for index buffers, use U32 or I32 instead';\n // ---\n}\n\n/**\n * Type of the `d.vec2f` object/function: vector data type schema/constructor\n */\nexport interface Vec2f extends\n DualFn<\n & ((x: number, y: number) => v2f)\n & ((xy: number) => v2f)\n & (() => v2f)\n & ((v: AnyNumericVec2Instance) => v2f)\n > {\n readonly type: 'vec2f';\n readonly primitive: F32;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v2f;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec2h` object/function: vector data type schema/constructor\n */\nexport interface Vec2h extends\n DualFn<\n & ((x: number, y: number) => v2h)\n & ((xy: number) => v2h)\n & (() => v2h)\n & ((v: AnyNumericVec2Instance) => v2h)\n > {\n readonly type: 'vec2h';\n readonly primitive: F16;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v2h;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec2i` object/function: vector data type schema/constructor\n */\nexport interface Vec2i extends\n DualFn<\n & ((x: number, y: number) => v2i)\n & ((xy: number) => v2i)\n & (() => v2i)\n & ((v: AnyNumericVec2Instance) => v2i)\n > {\n readonly type: 'vec2i';\n readonly primitive: I32;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v2i;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec2u` object/function: vector data type schema/constructor\n */\nexport interface Vec2u extends\n DualFn<\n & ((x: number, y: number) => v2u)\n & ((xy: number) => v2u)\n & (() => v2u)\n & ((v: AnyNumericVec2Instance) => v2u)\n > {\n readonly type: 'vec2u';\n readonly primitive: U32;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v2u;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec2b` object/function: vector data type schema/constructor\n * Cannot be used inside buffers as it is not host-shareable.\n */\nexport interface Vec2b extends\n DualFn<\n & ((x: boolean, y: boolean) => v2b)\n & ((xy: boolean) => v2b)\n & (() => v2b)\n & ((v: v2b) => v2b)\n > {\n readonly type: 'vec2<bool>';\n readonly primitive: Bool;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v2b;\n readonly [$invalidSchemaReason]:\n 'Boolean vectors is not host-shareable, use numeric vectors instead';\n // ---\n}\n\n/**\n * Type of the `d.vec3f` object/function: vector data type schema/constructor\n */\nexport interface Vec3f extends\n DualFn<\n & ((x: number, y: number, z: number) => v3f)\n & ((xyz: number) => v3f)\n & (() => v3f)\n & ((v: AnyNumericVec3Instance) => v3f)\n & ((v0: AnyNumericVec2Instance, z: number) => v3f)\n & ((x: number, v0: AnyNumericVec2Instance) => v3f)\n > {\n readonly type: 'vec3f';\n readonly primitive: F32;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v3f;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec3h` object/function: vector data type schema/constructor\n */\nexport interface Vec3h extends\n DualFn<\n & ((x: number, y: number, z: number) => v3h)\n & ((xyz: number) => v3h)\n & (() => v3h)\n & ((v: AnyNumericVec3Instance) => v3h)\n & ((v0: AnyNumericVec2Instance, z: number) => v3h)\n & ((x: number, v0: AnyNumericVec2Instance) => v3h)\n > {\n readonly type: 'vec3h';\n readonly primitive: F16;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v3h;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec3i` object/function: vector data type schema/constructor\n */\nexport interface Vec3i extends\n DualFn<\n & ((x: number, y: number, z: number) => v3i)\n & ((xyz: number) => v3i)\n & (() => v3i)\n & ((v: AnyNumericVec3Instance) => v3i)\n & ((v0: AnyNumericVec2Instance, z: number) => v3i)\n & ((x: number, v0: AnyNumericVec2Instance) => v3i)\n > {\n readonly type: 'vec3i';\n readonly primitive: I32;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v3i;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec3u` object/function: vector data type schema/constructor\n */\nexport interface Vec3u extends\n DualFn<\n & ((x: number, y: number, z: number) => v3u)\n & ((xyz: number) => v3u)\n & (() => v3u)\n & ((v: AnyNumericVec3Instance) => v3u)\n & ((v0: AnyNumericVec2Instance, z: number) => v3u)\n & ((x: number, v0: AnyNumericVec2Instance) => v3u)\n > {\n readonly type: 'vec3u';\n readonly primitive: U32;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v3u;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec3b` object/function: vector data type schema/constructor\n * Cannot be used inside buffers as it is not host-shareable.\n */\nexport interface Vec3b extends\n DualFn<\n & ((x: boolean, y: boolean, z: boolean) => v3b)\n & ((xyz: boolean) => v3b)\n & (() => v3b)\n & ((v: v3b) => v3b)\n & ((v0: v2b, z: boolean) => v3b)\n & ((x: boolean, v0: v2b) => v3b)\n > {\n readonly type: 'vec3<bool>';\n readonly primitive: Bool;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v3b;\n readonly [$invalidSchemaReason]:\n 'Boolean vectors is not host-shareable, use numeric vectors instead';\n // ---\n}\n\n/**\n * Type of the `d.vec4f` object/function: vector data type schema/constructor\n */\nexport interface Vec4f extends\n DualFn<\n & ((x: number, y: number, z: number, w: number) => v4f)\n & ((xyzw: number) => v4f)\n & (() => v4f)\n & ((v: AnyNumericVec4Instance) => v4f)\n & ((v0: AnyNumericVec3Instance, w: number) => v4f)\n & ((x: number, v0: AnyNumericVec3Instance) => v4f)\n & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4f)\n & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4f)\n & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4f)\n & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4f)\n > {\n readonly type: 'vec4f';\n readonly primitive: F32;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v4f;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec4h` object/function: vector data type schema/constructor\n */\nexport interface Vec4h extends\n DualFn<\n & ((x: number, y: number, z: number, w: number) => v4h)\n & ((xyzw: number) => v4h)\n & (() => v4h)\n & ((v: AnyNumericVec4Instance) => v4h)\n & ((v0: AnyNumericVec3Instance, w: number) => v4h)\n & ((x: number, v0: AnyNumericVec3Instance) => v4h)\n & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4h)\n & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4h)\n & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4h)\n & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4h)\n > {\n readonly type: 'vec4h';\n readonly primitive: F16;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v4h;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec4i` object/function: vector data type schema/constructor\n */\nexport interface Vec4i extends\n DualFn<\n & ((x: number, y: number, z: number, w: number) => v4i)\n & ((xyzw: number) => v4i)\n & (() => v4i)\n & ((v: AnyNumericVec4Instance) => v4i)\n & ((v0: AnyNumericVec3Instance, w: number) => v4i)\n & ((x: number, v0: AnyNumericVec3Instance) => v4i)\n & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4i)\n & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4i)\n & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4i)\n & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4i)\n > {\n readonly type: 'vec4i';\n readonly primitive: I32;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v4i;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec4u` object/function: vector data type schema/constructor\n */\nexport interface Vec4u extends\n DualFn<\n & ((x: number, y: number, z: number, w: number) => v4u)\n & ((xyzw: number) => v4u)\n & (() => v4u)\n & ((v: AnyNumericVec4Instance) => v4u)\n & ((v0: AnyNumericVec3Instance, w: number) => v4u)\n & ((x: number, v0: AnyNumericVec3Instance) => v4u)\n & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4u)\n & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4u)\n & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4u)\n & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4u)\n > {\n readonly type: 'vec4u';\n readonly primitive: U32;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v4u;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\n/**\n * Type of the `d.vec4b` object/function: vector data type schema/constructor\n * Cannot be used inside buffers as it is not host-shareable.\n */\nexport interface Vec4b extends\n DualFn<\n & ((x: boolean, y: boolean, z: boolean, w: boolean) => v4b)\n & ((xyzw: boolean) => v4b)\n & (() => v4b)\n & ((v: v4b) => v4b)\n & ((v0: v3b, w: boolean) => v4b)\n & ((x: boolean, v0: v3b) => v4b)\n & ((v0: v2b, v1: v2b) => v4b)\n & ((v0: v2b, z: boolean, w: boolean) => v4b)\n & ((x: boolean, v0: v2b, z: boolean) => v4b)\n & ((x: boolean, y: boolean, v0: v2b) => v4b)\n > {\n readonly type: 'vec4<bool>';\n readonly primitive: Bool;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: v4b;\n readonly [$invalidSchemaReason]:\n 'Boolean vectors is not host-shareable, use numeric vectors instead';\n // ---\n}\n\n/**\n * Type of the `d.mat2x2f` object/function: matrix data type schema/constructor\n */\nexport interface Mat2x2f extends BaseData {\n readonly type: 'mat2x2f';\n\n // Type-tokens, not available at runtime\n readonly [$repr]: m2x2f;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n // ---\n\n (...elements: [number, number, number, number]): m2x2f;\n (...columns: [v2f, v2f]): m2x2f;\n (): m2x2f;\n identity(): m2x2f;\n}\n\n/**\n * Type of the `d.mat3x3f` object/function: matrix data type schema/constructor\n */\nexport interface Mat3x3f extends BaseData {\n readonly type: 'mat3x3f';\n\n // Type-tokens, not available at runtime\n readonly [$repr]: m3x3f;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n // ---\n\n // deno-fmt-ignore\n (...elements: [number, number, number, number, number, number, number, number, number]): m3x3f;\n (...columns: [v3f, v3f, v3f]): m3x3f;\n (): m3x3f;\n identity(): m3x3f;\n}\n\n/**\n * Type of the `d.mat4x4f` object/function: matrix data type schema/constructor\n */\nexport interface Mat4x4f extends BaseData {\n readonly type: 'mat4x4f';\n\n // Type-tokens, not available at runtime\n readonly [$repr]: m4x4f;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n // ---\n\n // deno-fmt-ignore\n (...elements: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]): m4x4f;\n (...columns: [v4f, v4f, v4f, v4f]): m4x4f;\n (): m4x4f;\n identity(): m4x4f;\n translation(vec: v3f): m4x4f;\n scaling(vec: v3f): m4x4f;\n rotationX(angle: number): m4x4f;\n rotationY(angle: number): m4x4f;\n rotationZ(angle: number): m4x4f;\n}\n\n/**\n * Array schema constructed via `d.arrayOf` function.\n *\n * Responsible for handling reading and writing array values\n * between binary and JS representation. Takes into account\n * the `byteAlignment` requirement of its elementType.\n */\nexport interface WgslArray<TElement extends BaseData = BaseData>\n extends BaseData {\n <T extends TElement>(elements: Infer<T>[]): Infer<T>[];\n (): Infer<TElement>[];\n readonly type: 'array';\n readonly elementCount: number;\n readonly elementType: TElement;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: Infer<TElement>[];\n readonly [$gpuRepr]: InferGPU<TElement>[];\n readonly [$reprPartial]:\n | { idx: number; value: InferPartial<TElement> }[]\n | undefined;\n readonly [$memIdent]: WgslArray<MemIdentity<TElement>>;\n readonly [$validStorageSchema]: IsValidStorageSchema<TElement>;\n readonly [$validUniformSchema]: IsValidUniformSchema<TElement>;\n readonly [$validVertexSchema]: IsValidVertexSchema<TElement>;\n readonly [$invalidSchemaReason]:\n `in array element — ${ExtractInvalidSchemaError<TElement>}`;\n // ---\n}\n\n/**\n * Struct schema constructed via `d.struct` function.\n *\n * Responsible for handling reading and writing struct values\n * between binary and JS representation. Takes into account\n * the `byteAlignment` requirement of its members.\n */\nexport interface WgslStruct<\n // biome-ignore lint/suspicious/noExplicitAny: the widest type that works with both covariance and contravariance\n TProps extends Record<string, BaseData> = any,\n> extends BaseData, TgpuNamable {\n readonly [$internal]: {\n isAbstruct: boolean;\n };\n readonly type: 'struct';\n readonly propTypes: TProps;\n\n (props: Prettify<InferRecord<TProps>>): Prettify<InferRecord<TProps>>;\n (): Prettify<InferRecord<TProps>>;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: Prettify<InferRecord<TProps>>;\n readonly [$gpuRepr]: Prettify<InferGPURecord<TProps>>;\n readonly [$memIdent]: WgslStruct<Prettify<MemIdentityRecord<TProps>>>;\n readonly [$reprPartial]:\n | Prettify<Partial<InferPartialRecord<TProps>>>\n | undefined;\n readonly [$invalidSchemaReason]: SwapNever<\n {\n [K in keyof TProps]: ExtractInvalidSchemaError<\n TProps[K],\n `in struct property '${K & string}' — `\n >;\n }[keyof TProps],\n undefined\n >;\n readonly [$validStorageSchema]: {\n [K in keyof TProps]: IsValidStorageSchema<TProps[K]>;\n }[keyof TProps] extends true ? true : false;\n readonly [$validUniformSchema]: {\n [K in keyof TProps]: IsValidUniformSchema<TProps[K]>;\n }[keyof TProps] extends true ? true : false;\n readonly [$validVertexSchema]: {\n [K in keyof TProps]: IsValidVertexSchema<TProps[K]>;\n }[keyof TProps] extends true ? true : false;\n // ---\n}\n\n/** @deprecated Just use `WgslStruct` without any type parameters */\nexport type AnyWgslStruct = WgslStruct;\n\nexport type AddressSpace =\n | 'uniform'\n | 'storage'\n | 'workgroup'\n | 'private'\n | 'function'\n | 'handle';\nexport type Access = 'read' | 'write' | 'read-write';\n\nexport interface Ptr<\n TAddr extends AddressSpace = AddressSpace,\n TInner extends StorableData = StorableData,\n TAccess extends Access = Access,\n> extends BaseData {\n readonly type: 'ptr';\n readonly inner: TInner;\n readonly addressSpace: TAddr;\n readonly access: TAccess;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: Infer<TInner>;\n readonly [$invalidSchemaReason]: 'Pointers are not host-shareable';\n // ---\n}\n\n/**\n * Schema representing the `atomic<...>` WGSL data type.\n */\nexport interface Atomic<TInner extends U32 | I32 = U32 | I32> extends BaseData {\n readonly type: 'atomic';\n readonly inner: TInner;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: Infer<TInner>;\n readonly [$gpuRepr]: TInner extends U32 ? atomicU32 : atomicI32;\n readonly [$memIdent]: MemIdentity<TInner>;\n readonly [$validStorageSchema]: true;\n readonly [$validUniformSchema]: true;\n readonly [$validVertexSchema]: true;\n // ---\n}\n\nexport interface atomicU32 {\n readonly [$internal]: true;\n readonly type: 'atomicU32';\n}\n\nexport interface atomicI32 {\n readonly [$internal]: true;\n readonly type: 'atomicI32';\n}\n\nexport interface Align<T extends number> {\n readonly [$internal]: true;\n readonly type: '@align';\n readonly params: [T];\n}\n\nexport interface Size<T extends number> {\n readonly [$internal]: true;\n readonly type: '@size';\n readonly params: [T];\n}\n\nexport interface Location<T extends number = number> {\n readonly [$internal]: true;\n readonly type: '@location';\n readonly params: [T];\n}\n\nexport type PerspectiveOrLinearInterpolationType = `${\n | 'perspective'\n | 'linear'}${'' | ', center' | ', centroid' | ', sample'}`;\nexport type FlatInterpolationType = `flat${'' | ', first' | ', either'}`;\nexport type InterpolationType =\n | PerspectiveOrLinearInterpolationType\n | FlatInterpolationType;\n\nexport interface Interpolate<T extends InterpolationType = InterpolationType> {\n readonly [$internal]: true;\n readonly type: '@interpolate';\n readonly params: [T];\n}\n\nexport interface Builtin<T extends string> {\n readonly [$internal]: true;\n readonly type: '@builtin';\n readonly params: [T];\n}\n\nexport interface Invariant {\n readonly [$internal]: true;\n readonly type: '@invariant';\n readonly params: [];\n}\n\nexport interface Decorated<\n TInner extends BaseData = BaseData,\n TAttribs extends unknown[] = unknown[],\n> extends BaseData {\n readonly type: 'decorated';\n readonly inner: TInner;\n readonly attribs: TAttribs;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: Infer<TInner>;\n readonly [$gpuRepr]: InferGPU<TInner>;\n readonly [$reprPartial]: InferPartial<TInner>;\n readonly [$memIdent]: TAttribs extends Location[]\n ? MemIdentity<TInner> | Decorated<MemIdentity<TInner>, TAttribs>\n : Decorated<MemIdentity<TInner>, TAttribs>;\n readonly [$validStorageSchema]: IsValidStorageSchema<TInner>;\n readonly [$validUniformSchema]: IsValidUniformSchema<TInner>;\n readonly [$validVertexSchema]: IsValidVertexSchema<TInner>;\n readonly [$invalidSchemaReason]: ExtractInvalidSchemaError<TInner>;\n // ---\n}\n\nexport const wgslTypeLiterals = [\n 'bool',\n 'f32',\n 'f16',\n 'i32',\n 'u32',\n 'u16',\n 'vec2f',\n 'vec2h',\n 'vec2i',\n 'vec2u',\n 'vec2<bool>',\n 'vec3f',\n 'vec3h',\n 'vec3i',\n 'vec3u',\n 'vec3<bool>',\n 'vec4f',\n 'vec4h',\n 'vec4i',\n 'vec4u',\n 'vec4<bool>',\n 'mat2x2f',\n 'mat3x3f',\n 'mat4x4f',\n 'struct',\n 'array',\n 'ptr',\n 'atomic',\n 'decorated',\n 'abstractInt',\n 'abstractFloat',\n 'void',\n 'texture_1d',\n 'texture_storage_1d',\n 'texture_2d',\n 'texture_storage_2d',\n 'texture_multisampled_2d',\n 'texture_depth_2d',\n 'texture_depth_multisampled_2d',\n 'texture_2d_array',\n 'texture_storage_2d_array',\n 'texture_depth_2d_array',\n 'texture_cube',\n 'texture_depth_cube',\n 'texture_cube_array',\n 'texture_depth_cube_array',\n 'texture_3d',\n 'texture_storage_3d',\n 'texture_external',\n 'sampler',\n 'sampler_comparison',\n] as const;\n\nexport type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];\n\nexport type PerspectiveOrLinearInterpolatableBaseType =\n | F32\n | F16\n | Vec2f\n | Vec2h\n | Vec3f\n | Vec3h\n | Vec4f\n | Vec4h;\n\nexport type PerspectiveOrLinearInterpolatableData =\n | PerspectiveOrLinearInterpolatableBaseType\n | Decorated<PerspectiveOrLinearInterpolatableBaseType>;\n\nexport type FlatInterpolatableAdditionalBaseType =\n | I32\n | U32\n | Vec2i\n | Vec2u\n | Vec3i\n | Vec3u\n | Vec4i\n | Vec4u;\n\nexport type FlatInterpolatableData =\n | PerspectiveOrLinearInterpolatableData\n | FlatInterpolatableAdditionalBaseType\n | Decorated<FlatInterpolatableAdditionalBaseType>;\n\nexport type TextureSampleTypes =\n | F32\n | I32\n | U32;\n\nexport type ScalarData =\n | Bool\n | F32\n | F16\n | I32\n | U32\n | AbstractInt\n | AbstractFloat;\n\nexport type VecData =\n | Vec2f\n | Vec2h\n | Vec2i\n | Vec2u\n | Vec2b\n | Vec3f\n | Vec3h\n | Vec3i\n | Vec3u\n | Vec3b\n | Vec4f\n | Vec4h\n | Vec4i\n | Vec4u\n | Vec4b;\n\nexport type MatData =\n | Mat2x2f\n | Mat3x3f\n | Mat4x4f;\n\nexport type StorableData =\n | ScalarData\n | VecData\n | MatData\n | Atomic\n | WgslArray\n | WgslStruct;\n\nexport type AnyFloat32VecData = Vec2f | Vec3f | Vec4f;\n\nexport type AnyFloat16VecData = Vec2h | Vec3h | Vec4h;\n\nexport type AnyWgslData =\n | Bool\n | F32\n | F16\n | I32\n | U32\n | U16\n | Vec2f\n | Vec2h\n | Vec2i\n | Vec2u\n | Vec2b\n | Vec3f\n | Vec3h\n | Vec3i\n | Vec3u\n | Vec3b\n | Vec4f\n | Vec4h\n | Vec4i\n | Vec4u\n | Vec4b\n | Mat2x2f\n | Mat3x3f\n | Mat4x4f\n | WgslStruct\n | WgslArray\n | Ptr\n | Atomic<U32>\n | Atomic<I32>\n | Decorated\n | AbstractInt\n | AbstractFloat\n | Void\n | WgslTexture\n | WgslStorageTexture\n | WgslExternalTexture\n | WgslSampler\n | WgslComparisonSampler;\n\n// #endregion\n\nexport function isVecInstance(value: unknown): value is AnyVecInstance {\n const v = value as AnyVecInstance | undefined;\n return isMarkedInternal(v) &&\n typeof v.kind === 'string' &&\n v.kind.startsWith('vec');\n}\n\nexport function isVec2(value: unknown): value is Vec2f | Vec2h | Vec2i | Vec2u {\n const v = value as AnyWgslData | undefined;\n return isMarkedInternal(v) &&\n typeof v.type === 'string' &&\n v.type.startsWith('vec2');\n}\n\nexport function isVec3(value: unknown): value is Vec3f | Vec3h | Vec3i | Vec3u {\n const v = value as AnyWgslData | undefined;\n return isMarkedInternal(v) &&\n typeof v.type === 'string' &&\n v.type.startsWith('vec3');\n}\n\nexport function isVec4(value: unknown): value is Vec4f | Vec4h | Vec4i | Vec4u {\n const v = value as AnyWgslData | undefined;\n return isMarkedInternal(v) &&\n typeof v.type === 'string' &&\n v.type.startsWith('vec4');\n}\n\nexport function isVec(\n value: unknown,\n): value is\n | Vec2f\n | Vec2h\n | Vec2i\n | Vec2u\n | Vec3f\n | Vec3h\n | Vec3i\n | Vec3u\n | Vec4f\n | Vec4h\n | Vec4i\n | Vec4u {\n return isVec2(value) || isVec3(value) || isVec4(value);\n}\n\nexport function isMatInstance(value: unknown): value is AnyMatInstance {\n const v = value as AnyMatInstance | undefined;\n return isMarkedInternal(v) &&\n typeof v.kind?.startsWith === 'function' &&\n v.kind.startsWith('mat');\n}\n\nexport function isMat2x2f(value: unknown): value is Mat2x2f {\n return (\n isMarkedInternal(value) &&\n (value as AnyWgslData)?.type === 'mat2x2f'\n );\n}\n\nexport function isMat3x3f(value: unknown): value is Mat3x3f {\n return (\n isMarkedInternal(value) &&\n (value as AnyWgslData)?.type === 'mat3x3f'\n );\n}\n\nexport function isMat4x4f(value: unknown): value is Mat4x4f {\n return (\n isMarkedInternal(value) &&\n (value as AnyWgslData)?.type === 'mat4x4f'\n );\n}\n\nexport function isMat(value: unknown): value is Mat2x2f | Mat3x3f | Mat4x4f {\n return isMat2x2f(value) || isMat3x3f(value) || isMat4x4f(value);\n}\n\nexport function isFloat32VecInstance(\n element: number | AnyVecInstance | AnyMatInstance,\n): element is AnyFloat32VecInstance {\n return isVecInstance(element) &&\n ['vec2f', 'vec3f', 'vec4f'].includes(element.kind);\n}\n\nexport function isWgslData(value: unknown): value is AnyWgslData {\n return (\n isMarkedInternal(value) &&\n wgslTypeLiterals.includes((value as AnyWgslData)?.type)\n );\n}\n\n/**\n * Checks whether passed in value is an array schema,\n * as opposed to, e.g., a disarray schema.\n *\n * Array schemas can be used to describe uniform and storage buffers,\n * whereas disarray schemas cannot.\n *\n * @example\n * isWgslArray(d.arrayOf(d.u32, 4)) // true\n * isWgslArray(d.disarray(d.u32, 4)) // false\n * isWgslArray(d.vec3f) // false\n */\nexport function isWgslArray<T extends WgslArray>(\n schema: T | unknown,\n): schema is T {\n return isMarkedInternal(schema) && (schema as T)?.type === 'array';\n}\n\n/**\n * Checks whether passed in value is a struct schema,\n * as opposed to, e.g., an unstruct schema.\n *\n * Struct schemas can be used to describe uniform and storage buffers,\n * whereas unstruct schemas cannot.\n *\n * @example\n * isWgslStruct(d.struct({ a: d.u32 })) // true\n * isWgslStruct(d.unstruct({ a: d.u32 })) // false\n * isWgslStruct(d.vec3f) // false\n */\nexport function isWgslStruct<T extends WgslStruct>(\n schema: T | unknown,\n): schema is T {\n return isMarkedInternal(schema) && (schema as T)?.type === 'struct';\n}\n\n/**\n * Checks whether passed in value is a pointer schema.\n *\n * @example\n * isPtr(d.ptrFn(d.f32)) // true\n * isPtr(d.ptrPrivate(d.f32)) // true\n * isPtr(d.f32) // false\n */\nexport function isPtr<T extends Ptr>(schema: T | unknown): schema is T {\n return isMarkedInternal(schema) && (schema as T)?.type === 'ptr';\n}\n\n/**\n * Checks whether the passed in value is an atomic schema.\n *\n * @example\n * isAtomic(d.atomic(d.u32)) // true\n * isAtomic(d.u32) // false\n */\nexport function isAtomic<T extends Atomic<U32 | I32>>(\n schema: T | unknown,\n): schema is T {\n return isMarkedInternal(schema) && (schema as T)?.type === 'atomic';\n}\n\nexport function isAlignAttrib<T extends Align<number>>(\n value: unknown | T,\n): value is T {\n return isMarkedInternal(value) && (value as T)?.type === '@align';\n}\n\nexport function isSizeAttrib<T extends Size<number>>(\n value: unknown | T,\n): value is T {\n return isMarkedInternal(value) && (value as T)?.type === '@size';\n}\n\nexport function isLocationAttrib<T extends Location<number>>(\n value: unknown | T,\n): value is T {\n return isMarkedInternal(value) && (value as T)?.type === '@location';\n}\n\nexport function isInterpolateAttrib<T extends Interpolate<InterpolationType>>(\n value: unknown | T,\n): value is T {\n return isMarkedInternal(value) && (value as T)?.type === '@interpolate';\n}\n\nexport function isBuiltinAttrib<T extends Builtin<string>>(\n value: unknown | T,\n): value is T {\n return isMarkedInternal(value) && (value as T)?.type === '@builtin';\n}\n\nexport function isInvariantAttrib<T extends Invariant>(\n value: unknown | T,\n): value is T {\n return isMarkedInternal(value) && (value as T)?.type === '@invariant';\n}\n\nexport function isDecorated<T extends Decorated>(\n value: unknown | T,\n): value is T {\n return isMarkedInternal(value) && (value as T)?.type === 'decorated';\n}\n\nexport function isAbstractFloat(value: unknown): value is AbstractFloat {\n return (\n isMarkedInternal(value) &&\n (value as AbstractFloat).type === 'abstractFloat'\n );\n}\n\nexport function isAbstractInt(value: unknown): value is AbstractInt {\n return (\n isMarkedInternal(value) &&\n (value as AbstractInt).type === 'abstractInt'\n );\n}\n\nexport function isAbstract(\n value: unknown,\n): value is AbstractFloat | AbstractInt {\n return isAbstractFloat(value) || isAbstractInt(value);\n}\n\nexport function isConcrete(value: unknown): boolean {\n return !isAbstract(value);\n}\n\nexport function isVoid(value: unknown): value is Void {\n return isMarkedInternal(value) && (value as Void).type === 'void';\n}\n\nexport function isNumericSchema(\n schema: unknown,\n): schema is AbstractInt | AbstractFloat | F32 | F16 | I32 | U32 {\n const type = (schema as BaseData)?.type;\n\n return (\n isMarkedInternal(schema) &&\n (type === 'abstractInt' ||\n type === 'abstractFloat' ||\n type === 'f32' ||\n type === 'f16' ||\n type === 'i32' ||\n type === 'u32')\n );\n}\n\nexport function isHalfPrecisionSchema(\n schema: unknown,\n): schema is F16 | Vec2h | Vec3h | Vec4h {\n const type = (schema as BaseData)?.type;\n\n return (\n isMarkedInternal(schema) &&\n (type === 'f16' ||\n type === 'vec2h' ||\n type === 'vec3h' ||\n type === 'vec4h')\n );\n}\n","/**\n * This can be used to branch functionality between \"dev\" and \"prod\" modes, so that our\n * library can omit doing unnecessary work once it's out in the wild\n *\n * Even though the value of this constant uses Node.js specific APIs, pretty much every\n * bundler replaces the expression below with either `development` or `production`\n */\nexport const DEV = process.env.NODE_ENV === 'development';\n\nexport const TEST = process.env.NODE_ENV === 'test';\n","import type { Block, FuncParameter } from 'tinyest';\nimport { DEV, TEST } from './env.ts';\nimport { $getNameForward, isMarkedInternal } from './symbols.ts';\n\nexport interface MetaData {\n v?: number;\n name?: string | undefined;\n ast?: {\n params: FuncParameter[];\n body: Block;\n externalNames: string[];\n } | undefined;\n externals?: Record<string, unknown> | undefined;\n}\n\n/**\n * Don't use or you WILL get fired from your job.\n *\n * The information that this type describes is additional\n * properties that we add onto `globalThis`, used by tools\n * like `unplugin-typegpu` or our test suite.\n *\n * @internal\n */\nexport type INTERNAL_GlobalExt = typeof globalThis & {\n __TYPEGPU_META__: WeakMap<object, MetaData>;\n __TYPEGPU_AUTONAME__: <T>(exp: T, label: string) => T;\n __TYPEGPU_MEASURE_PERF__?: boolean | undefined;\n __TYPEGPU_PERF_RECORDS__?: Map<string, unknown[]> | undefined;\n};\n\nObject.assign(globalThis, {\n '__TYPEGPU_AUTONAME__': <T>(exp: T, label: string): T => {\n if (isNamable(exp) && isMarkedInternal(exp) && !getName(exp)) {\n exp.$name(label);\n }\n return exp;\n },\n});\n\nconst globalWithMeta = globalThis as INTERNAL_GlobalExt;\n\n/**\n * Performance measurements are only enabled in dev & test environments for now\n */\nexport const PERF = (DEV || TEST) && ({\n get enabled() {\n return !!globalWithMeta.__TYPEGPU_MEASURE_PERF__;\n },\n record(name: string, data: unknown) {\n // biome-ignore lint/suspicious/noAssignInExpressions: it's fine\n const records = (globalWithMeta.__TYPEGPU_PERF_RECORDS__ ??= new Map());\n let entries = records.get(name);\n if (!entries) {\n entries = [];\n records.set(name, entries);\n }\n entries.push(data);\n },\n }) || undefined;\n\nfunction isForwarded(value: unknown): value is { [$getNameForward]: unknown } {\n return !!(value as { [$getNameForward]?: unknown })?.[$getNameForward];\n}\n\nexport function getName(definition: unknown): string | undefined {\n if (isForwarded(definition)) {\n return getName(definition[$getNameForward]);\n }\n return getMetaData(definition)?.name;\n}\n\nexport function setName(definition: object, name: string): void {\n if (isForwarded(definition)) {\n setName(definition[$getNameForward] as object, name);\n }\n setMetaData(definition, { name });\n}\n\n/**\n * Can be assigned a name. Not to be confused with\n * being able to HAVE a name.\n * The `$name` function should use `setName` to rename the object itself,\n * or rename the object `$getNameForward` symbol points to instead if applicable.\n */\nexport interface TgpuNamable {\n $name(label: string): this;\n}\n\nexport function isNamable(value: unknown): value is TgpuNamable {\n return !!(value as TgpuNamable)?.$name;\n}\n\n/**\n * AST's are given to functions with a 'use gpu' directive, which this function checks for.\n */\nexport function hasTinyestMetadata(\n value: unknown,\n): value is (...args: never[]) => unknown {\n return !!getMetaData(value)?.ast;\n}\n\nexport function getMetaData(\n definition: unknown,\n): MetaData | undefined {\n return globalWithMeta.__TYPEGPU_META__.get(\n // it's fine, if it's not an object, the get will return undefined\n definition as object,\n );\n}\n\nexport function setMetaData(definition: object, metaData: object) {\n globalWithMeta.__TYPEGPU_META__ ??= new WeakMap();\n const map = globalWithMeta.__TYPEGPU_META__;\n map.set(definition, { ...map.get(definition), ...metaData });\n}\n","export const vertexFormats = [\n 'uint8',\n 'uint8x2',\n 'uint8x4',\n 'sint8',\n 'sint8x2',\n 'sint8x4',\n 'unorm8',\n 'unorm8x2',\n 'unorm8x4',\n 'snorm8',\n 'snorm8x2',\n 'snorm8x4',\n 'uint16',\n 'uint16x2',\n 'uint16x4',\n 'sint16',\n 'sint16x2',\n 'sint16x4',\n 'unorm16',\n 'unorm16x2',\n 'unorm16x4',\n 'snorm16',\n 'snorm16x2',\n 'snorm16x4',\n 'float16',\n 'float16x2',\n 'float16x4',\n 'float32',\n 'float32x2',\n 'float32x3',\n 'float32x4',\n 'uint32',\n 'uint32x2',\n 'uint32x3',\n 'uint32x4',\n 'sint32',\n 'sint32x2',\n 'sint32x3',\n 'sint32x4',\n 'unorm10-10-10-2',\n 'unorm8x4-bgra',\n] as const;\n\nexport type VertexFormat = (typeof vertexFormats)[number];\n\nexport const kindToDefaultFormatMap = {\n f32: 'float32',\n vec2f: 'float32x2',\n vec3f: 'float32x3',\n vec4f: 'float32x4',\n f16: 'float16',\n vec2h: 'float16x2',\n // vec3h has no direct equivalent in the spec\n vec4h: 'float16x4',\n u32: 'uint32',\n vec2u: 'uint32x2',\n vec3u: 'uint32x3',\n vec4u: 'uint32x4',\n i32: 'sint32',\n vec2i: 'sint32x2',\n vec3i: 'sint32x3',\n vec4i: 'sint32x4',\n} as const;\n\nexport type KindToDefaultFormatMap = typeof kindToDefaultFormatMap;\n\nexport interface TgpuVertexAttrib<TFormat extends VertexFormat = VertexFormat> {\n readonly format: TFormat;\n readonly offset: number;\n}\n\nexport type AnyVertexAttribs =\n | Record<string, TgpuVertexAttrib>\n | TgpuVertexAttrib;\n\n/**\n * All vertex attribute formats that can be interpreted as\n * an single or multi component u32 in a shader.\n * https://www.w3.org/TR/webgpu/#vertex-formats\n */\ntype U32CompatibleFormats =\n | TgpuVertexAttrib<'uint8'>\n | TgpuVertexAttrib<'uint8x2'>\n | TgpuVertexAttrib<'uint8x4'>\n | TgpuVertexAttrib<'uint16'>\n | TgpuVertexAttrib<'uint16x2'>\n | TgpuVertexAttrib<'uint16x4'>\n | TgpuVertexAttrib<'uint32'>\n | TgpuVertexAttrib<'uint32x2'>\n | TgpuVertexAttrib<'uint32x3'>\n | TgpuVertexAttrib<'uint32x4'>;\n\n/**\n * All vertex attribute formats that can be interpreted as\n * an single or multi component i32 in a shader.\n * https://www.w3.org/TR/webgpu/#vertex-formats\n */\ntype I32CompatibleFormats =\n | TgpuVertexAttrib<'sint8'>\n | TgpuVertexAttrib<'sint8x2'>\n | TgpuVertexAttrib<'sint8x4'>\n | TgpuVertexAttrib<'sint16'>\n | TgpuVertexAttrib<'sint16x2'>\n | TgpuVertexAttrib<'sint16x4'>\n | TgpuVertexAttrib<'sint32'>\n | TgpuVertexAttrib<'sint32x2'>\n | TgpuVertexAttrib<'sint32x3'>\n | TgpuVertexAttrib<'sint32x4'>;\n\n/**\n * All vertex attribute formats that can be interpreted as\n * an single or multi component f32 in a shader.\n * https://www.w3.org/TR/webgpu/#vertex-formats\n */\ntype F32CompatibleFormats =\n | TgpuVertexAttrib<'unorm8'>\n | TgpuVertexAttrib<'unorm8x2'>\n | TgpuVertexAttrib<'unorm8x4'>\n | TgpuVertexAttrib<'snorm8'>\n | TgpuVertexAttrib<'snorm8x2'>\n | TgpuVertexAttrib<'snorm8x4'>\n | TgpuVertexAttrib<'unorm16'>\n | TgpuVertexAttrib<'unorm16x2'>\n | TgpuVertexAttrib<'unorm16x4'>\n | TgpuVertexAttrib<'snorm16'>\n | TgpuVertexAttrib<'snorm16x2'>\n | TgpuVertexAttrib<'snorm16x4'>\n | TgpuVertexAttrib<'float16'>\n | TgpuVertexAttrib<'float16x2'>\n | TgpuVertexAttrib<'float16x4'>\n | TgpuVertexAttrib<'float32'>\n | TgpuVertexAttrib<'float32x2'>\n | TgpuVertexAttrib<'float32x3'>\n | TgpuVertexAttrib<'float32x4'>\n | TgpuVertexAttrib<'unorm10-10-10-2'>\n | TgpuVertexAttrib<'unorm8x4-bgra'>;\n\n/**\n * All vertex attribute formats that can be interpreted as\n * a single or multi component f16 in a shader. (same as f32 on the shader side)\n * https://www.w3.org/TR/webgpu/#vertex-formats\n */\ntype F16CompatibleFormats = F32CompatibleFormats;\n\nexport type KindToAcceptedAttribMap = {\n u32: U32CompatibleFormats;\n vec2u: U32CompatibleFormats;\n vec3u: U32CompatibleFormats;\n vec4u: U32CompatibleFormats;\n\n i32: I32CompatibleFormats;\n vec2i: I32CompatibleFormats;\n vec3i: I32CompatibleFormats;\n vec4i: I32CompatibleFormats;\n\n f16: F16CompatibleFormats;\n vec2h: F16CompatibleFormats;\n vec3h: F16CompatibleFormats;\n vec4h: F16CompatibleFormats;\n\n f32: F32CompatibleFormats;\n vec2f: F32CompatibleFormats;\n vec3f: F32CompatibleFormats;\n vec4f: F32CompatibleFormats;\n};\n","import { setName, type TgpuNamable } from '../shared/meta.ts';\nimport { isMarkedInternal } from '../shared/symbols.ts';\nimport type {\n Infer,\n InferGPURecord,\n InferPartial,\n InferPartialRecord,\n InferRecord,\n IsValidVertexSchema,\n MemIdentityRecord,\n} from '../shared/repr.ts';\nimport type {\n $gpuRepr,\n $invalidSchemaReason,\n $memIdent,\n $repr,\n $reprPartial,\n $validVertexSchema,\n} from '../shared/symbols.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { Prettify } from '../shared/utilityTypes.ts';\nimport { vertexFormats } from '../shared/vertexFormat.ts';\nimport type {\n WgslExternalTexture,\n WgslStorageTexture,\n WgslTexture,\n} from './texture.ts';\nimport type { Snippet } from './snippet.ts';\nimport type { PackedData } from './vertexFormatData.ts';\nimport * as wgsl from './wgslTypes.ts';\nimport type { WgslComparisonSampler, WgslSampler } from './sampler.ts';\n\n/**\n * Array schema constructed via `d.disarrayOf` function.\n *\n * Useful for defining vertex buffers.\n * Elements in the schema are not aligned in respect to their `byteAlignment`,\n * unless they are explicitly decorated with the custom align attribute\n * via `d.align` function.\n */\nexport interface Disarray<TElement extends wgsl.BaseData = wgsl.BaseData>\n extends wgsl.BaseData {\n <T extends TElement>(elements: Infer<T>[]): Infer<T>[];\n (): Infer<TElement>[];\n readonly type: 'disarray';\n readonly elementCount: number;\n readonly elementType: TElement;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: Infer<TElement>[];\n readonly [$reprPartial]:\n | { idx: number; value: InferPartial<TElement> }[]\n | undefined;\n readonly [$validVertexSchema]: IsValidVertexSchema<TElement>;\n readonly [$invalidSchemaReason]:\n 'Disarrays are not host-shareable, use arrays instead';\n // ---\n}\n\n/**\n * Struct schema constructed via `d.unstruct` function.\n *\n * Useful for defining vertex buffers, as the standard layout restrictions do not apply.\n * Members are not aligned in respect to their `byteAlignment`,\n * unless they are explicitly decorated with the custom align attribute\n * via `d.align` function.\n */\nexport interface Unstruct<\n // biome-ignore lint/suspicious/noExplicitAny: the widest type that works with both covariance and contravariance\n TProps extends Record<string, wgsl.BaseData> = any,\n> extends wgsl.BaseData, TgpuNamable {\n (props: Prettify<InferRecord<TProps>>): Prettify<InferRecord<TProps>>;\n (): Prettify<InferRecord<TProps>>;\n readonly type: 'unstruct';\n readonly propTypes: TProps;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: Prettify<InferRecord<TProps>>;\n readonly [$gpuRepr]: Prettify<InferGPURecord<TProps>>;\n readonly [$memIdent]: Unstruct<Prettify<MemIdentityRecord<TProps>>>;\n readonly [$reprPartial]:\n | Prettify<Partial<InferPartialRecord<TProps>>>\n | undefined;\n readonly [$validVertexSchema]: {\n [K in keyof TProps]: IsValidVertexSchema<TProps[K]>;\n }[keyof TProps] extends true ? true : false;\n readonly [$invalidSchemaReason]:\n 'Unstructs are not host-shareable, use structs instead';\n // ---\n}\n\n/** @deprecated Just use `Unstruct` without any type parameters */\nexport type AnyUnstruct = Unstruct;\n\nexport interface LooseDecorated<\n TInner extends wgsl.BaseData = wgsl.BaseData,\n TAttribs extends unknown[] = unknown[],\n> extends wgsl.BaseData {\n readonly type: 'loose-decorated';\n readonly inner: TInner;\n readonly attribs: TAttribs;\n\n // Type-tokens, not available at runtime\n readonly [$repr]: Infer<TInner>;\n readonly [$invalidSchemaReason]:\n 'Loosely decorated schemas are not host-shareable';\n readonly [$validVertexSchema]: IsValidVertexSchema<TInner>;\n // ---\n}\n\n/**\n * Type utility to extract the inner type from decorated types.\n */\nexport type Undecorate<T> = T extends {\n readonly type: 'decorated' | 'loose-decorated';\n readonly inner: infer TInner;\n} ? TInner\n : T;\n\n/**\n * Type utility to undecorate all values in a record.\n */\nexport type UndecorateRecord<T extends Record<string, unknown>> = {\n [Key in keyof T]: Undecorate<T[Key]>;\n};\n\n/**\n * Runtime function to extract the inner data type from decorated types.\n * If the data is not decorated, returns the data as-is.\n */\nexport function undecorate(data: AnyData): AnyData {\n if (data.type === 'decorated' || data.type === 'loose-decorated') {\n return data.inner as AnyData;\n }\n return data;\n}\n\nconst looseTypeLiterals = [\n 'unstruct',\n 'disarray',\n 'loose-decorated',\n ...vertexFormats,\n] as const;\n\nexport type LooseTypeLiteral = (typeof looseTypeLiterals)[number];\n\nexport type AnyLooseData = Disarray | Unstruct | LooseDecorated | PackedData;\n\nexport function isLooseData(data: unknown): data is AnyLooseData {\n return (\n isMarkedInternal(data) &&\n looseTypeLiterals.includes((data as AnyLooseData)?.type)\n );\n}\n\n/**\n * Checks whether the passed in value is a disarray schema,\n * as opposed to, e.g., a regular array schema.\n *\n * Array schemas can be used to describe uniform and storage buffers,\n * whereas disarray schemas cannot. Disarrays are useful for\n * defining vertex buffers instead.\n *\n * @example\n * isDisarray(d.arrayOf(d.u32, 4)) // false\n * isDisarray(d.disarrayOf(d.u32, 4)) // true\n * isDisarray(d.vec3f) // false\n */\nexport function isDisarray<T extends Disarray>(\n schema: T | unknown,\n): schema is T {\n return isMarkedInternal(schema) && (schema as T)?.type === 'disarray';\n}\n\n/**\n * Checks whether passed in value is a unstruct schema,\n * as opposed to, e.g., a struct schema.\n *\n * Struct schemas can be used to describe uniform and storage buffers,\n * whereas unstruct schemas cannot. Unstructs are useful for\n * defining vertex buffers instead.\n *\n * @example\n * isUnstruct(d.struct({ a: d.u32 })) // false\n * isUnstruct(d.unstruct({ a: d.u32 })) // true\n * isUnstruct(d.vec3f) // false\n */\nexport function isUnstruct<T extends Unstruct>(\n schema: T | unknown,\n): schema is T {\n return isMarkedInternal(schema) && (schema as T)?.type === 'unstruct';\n}\n\nexport function isLooseDecorated<T extends LooseDecorated>(\n value: T | unknown,\n): value is T {\n return isMarkedInternal(value) && (value as T)?.type === 'loose-decorated';\n}\n\nexport function getCustomAlignment(data: wgsl.BaseData): number | undefined {\n return (data as unknown as wgsl.Decorated | LooseDecorated).attribs?.find(\n wgsl.isAlignAttrib,\n )?.params[0];\n}\n\nexport function getCustomSize(data: wgsl.BaseData): number | undefined {\n return (data as unknown as wgsl.Decorated | LooseDecorated).attribs?.find(\n wgsl.isSizeAttrib,\n )?.params[0];\n}\n\nexport function getCustomLocation(data: wgsl.BaseData): number | undefined {\n return (data as unknown as wgsl.Decorated | LooseDecorated).attribs?.find(\n wgsl.isLocationAttrib,\n )?.params[0];\n}\n\nexport function isData(value: unknown): value is AnyData {\n return wgsl.isWgslData(value) || isLooseData(value);\n}\n\nexport type AnyData = wgsl.AnyWgslData | AnyLooseData;\nexport type AnyConcreteData = Exclude<\n AnyData,\n | wgsl.AbstractInt\n | wgsl.AbstractFloat\n | wgsl.Void\n | WgslTexture\n | WgslStorageTexture\n | WgslExternalTexture\n | WgslSampler\n | WgslComparisonSampler\n>;\n\nexport interface UnknownData {\n readonly type: 'unknown';\n}\n\nexport const UnknownData = {\n type: 'unknown' as const,\n toString() {\n return 'unknown';\n },\n} as UnknownData;\n\nexport class InfixDispatch {\n constructor(\n readonly name: string,\n readonly lhs: Snippet,\n readonly operator: (lhs: Snippet, rhs: Snippet) => Snippet,\n ) {}\n}\n\nexport class MatrixColumnsAccess {\n constructor(\n readonly matrix: Snippet,\n ) {}\n}\n\nexport class ConsoleLog {\n [$internal] = true;\n constructor(readonly op: string) {\n setName(this, 'consoleLog');\n }\n}\n","import type { TgpuBuffer } from './core/buffer/buffer.ts';\nimport type { TgpuSlot } from './core/slot/slotTypes.ts';\nimport type { TgpuVertexLayout } from './core/vertexLayout/vertexLayout.ts';\nimport type { AnyData, Disarray } from './data/dataTypes.ts';\nimport type { WgslArray } from './data/wgslTypes.ts';\nimport { getName, hasTinyestMetadata } from './shared/meta.ts';\nimport { DEV } from './shared/env.ts';\nimport type { TgpuBindGroupLayout } from './tgpuBindGroupLayout.ts';\n\nconst prefix = 'Invariant failed';\n\n/**\n * Inspired by: https://github.com/alexreardon/tiny-invariant/blob/master/src/tiny-invariant.ts\n */\nexport function invariant(\n condition: unknown,\n message?: string | (() => string),\n): asserts condition {\n if (condition) {\n // Condition passed\n return;\n }\n\n // In production we strip the message but still throw\n if (!DEV) {\n throw new Error(prefix);\n }\n\n // When not in production we allow the message to pass through\n // *This block will be removed in production builds*\n\n const provided = typeof message === 'function' ? message() : message;\n\n // Options:\n // 1. message provided: `${prefix}: ${provided}`\n // 2. message not provided: prefix\n const value = provided ? `${prefix}: ${provided}` : prefix;\n throw new Error(value);\n}\n\n/**\n * An error that happens during resolution of WGSL code.\n * Contains a trace of all ancestor resolvables in\n * which this error originated.\n *\n * @category Errors\n */\nexport class ResolutionError extends Error {\n constructor(\n public readonly cause: unknown,\n public readonly trace: unknown[],\n ) {\n let entries = trace.map((ancestor) =>\n `- ${\n hasTinyestMetadata(ancestor) ? `fn*:${getName(ancestor)}` : ancestor\n }`\n );\n\n // Showing only the root and leaf nodes.\n if (entries.length > 20) {\n entries = [...entries.slice(0, 11), '...', ...entries.slice(-10)];\n }\n\n super(\n `Resolution of the following tree failed:\\n${entries.join('\\n')}: ${\n cause && typeof cause === 'object' && 'message' in cause\n ? cause.message\n : cause\n }`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, ResolutionError.prototype);\n }\n\n appendToTrace(ancestor: unknown): ResolutionError {\n const newTrace = [ancestor, ...this.trace];\n\n return new ResolutionError(this.cause, newTrace);\n }\n}\n\n/**\n * An error that happens during execution of TypeGPU functions.\n * Contains a trace of all TypeGPU functions called along the way.\n *\n * @category Errors\n */\nexport class ExecutionError extends Error {\n constructor(\n public readonly cause: unknown,\n public readonly trace: unknown[],\n ) {\n let entries = trace.map((ancestor) => `- ${ancestor}`);\n\n // Showing only the root and leaf nodes.\n if (entries.length > 20) {\n entries = [...entries.slice(0, 11), '...', ...entries.slice(-10)];\n }\n\n super(\n `Execution of the following tree failed:\\n${entries.join('\\n')}: ${\n cause && typeof cause === 'object' && 'message' in cause\n ? cause.message\n : cause\n }`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, ExecutionError.prototype);\n }\n\n appendToTrace(ancestor: unknown): ExecutionError {\n const newTrace = [ancestor, ...this.trace];\n\n return new ExecutionError(this.cause, newTrace);\n }\n}\n\n/**\n * @category Errors\n */\nexport class MissingSlotValueError extends Error {\n constructor(public readonly slot: TgpuSlot<unknown>) {\n super(`Missing value for '${slot}'`);\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingSlotValueError.prototype);\n }\n}\n\n/**\n * @category Errors\n */\nexport class NotUniformError extends Error {\n constructor(value: TgpuBuffer<AnyData>) {\n super(\n `Buffer '${\n getName(value) ?? '<unnamed>'\n }' is not bindable as a uniform. Use .$usage('uniform') to allow it.`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, NotUniformError.prototype);\n }\n}\n\nexport class MissingLinksError extends Error {\n constructor(fnLabel: string | undefined, externalNames: string[]) {\n super(\n `The function '${\n fnLabel ?? '<unnamed>'\n }' is missing links to the following external values: ${externalNames}.`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingLinksError.prototype);\n }\n}\n\nexport class MissingBindGroupsError extends Error {\n constructor(layouts: Iterable<TgpuBindGroupLayout>) {\n super(\n `Missing bind groups for layouts: '${\n [...layouts].map((layout) => getName(layout) ?? '<unnamed>').join(', ')\n }'. Please provide it using pipeline.with(bindGroup).(...)`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingBindGroupsError.prototype);\n }\n}\n\nexport class MissingVertexBuffersError extends Error {\n constructor(layouts: Iterable<TgpuVertexLayout<WgslArray | Disarray>>) {\n super(\n `Missing vertex buffers for layouts: '${\n [...layouts].map((layout) => getName(layout) ?? '<unnamed>').join(', ')\n }'. Please provide it using pipeline.with(layout, buffer).(...)`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingVertexBuffersError.prototype);\n }\n}\n\nexport class IllegalVarAccessError extends Error {\n constructor(msg: string) {\n super(msg);\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, IllegalVarAccessError.prototype);\n }\n}\n\nexport class IllegalBufferAccessError extends Error {\n constructor(msg: string) {\n super(msg);\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, IllegalBufferAccessError.prototype);\n }\n}\n\nexport class WgslTypeError extends Error {\n constructor(msg: string) {\n super(msg);\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, WgslTypeError.prototype);\n }\n}\n","import { stitch } from '../core/resolve/stitch.ts';\nimport type { AnyData, UnknownData } from '../data/dataTypes.ts';\nimport { undecorate } from '../data/dataTypes.ts';\nimport { snip, type Snippet } from '../data/snippet.ts';\nimport {\n type AnyWgslData,\n type F16,\n type F32,\n type I32,\n isMat,\n isVec,\n type U32,\n type WgslStruct,\n} from '../data/wgslTypes.ts';\nimport { invariant, WgslTypeError } from '../errors.ts';\nimport { DEV, TEST } from '../shared/env.ts';\nimport { assertExhaustive } from '../shared/utilityTypes.ts';\n\ntype ConversionAction = 'ref' | 'deref' | 'cast' | 'none';\n\ntype ConversionRankInfo =\n | { rank: number; action: 'cast'; targetType: AnyData }\n | { rank: number; action: Exclude<ConversionAction, 'cast'> };\n\nconst INFINITE_RANK: ConversionRankInfo = {\n rank: Number.POSITIVE_INFINITY,\n action: 'none',\n};\n\nfunction getAutoConversionRank(\n src: AnyData,\n dest: AnyData,\n): ConversionRankInfo {\n const trueSrc = undecorate(src);\n const trueDst = undecorate(dest);\n\n if (trueSrc.type === trueDst.type) {\n return { rank: 0, action: 'none' };\n }\n\n if (trueSrc.type === 'abstractFloat') {\n if (trueDst.type === 'f32') return { rank: 1, action: 'none' };\n if (trueDst.type === 'f16') return { rank: 2, action: 'none' };\n }\n\n if (trueSrc.type === 'abstractInt') {\n if (trueDst.type === 'i32') return { rank: 3, action: 'none' };\n if (trueDst.type === 'u32') return { rank: 4, action: 'none' };\n if (trueDst.type === 'abstractFloat') return { rank: 5, action: 'none' };\n if (trueDst.type === 'f32') return { rank: 6, action: 'none' };\n if (trueDst.type === 'f16') return { rank: 7, action: 'none' };\n }\n\n if (isVec(trueSrc) && isVec(trueDst)) {\n return getAutoConversionRank(trueSrc.primitive, trueDst.primitive);\n }\n\n if (isMat(trueSrc) && isMat(trueDst)) {\n // Matrix conversion rank depends only on component type (always f32 for now)\n return { rank: 0, action: 'none' };\n }\n\n return INFINITE_RANK;\n}\n\nfunction getImplicitConversionRank(\n src: AnyData,\n dest: AnyData,\n): ConversionRankInfo {\n const trueSrc = undecorate(src);\n const trueDst = undecorate(dest);\n\n if (\n trueSrc.type === 'ptr' &&\n getAutoConversionRank(trueSrc.inner as AnyData, trueDst).rank <\n Number.POSITIVE_INFINITY\n ) {\n return { rank: 0, action: 'deref' };\n }\n\n if (\n trueDst.type === 'ptr' &&\n getAutoConversionRank(trueSrc, trueDst.inner as AnyData).rank <\n Number.POSITIVE_INFINITY\n ) {\n return { rank: 1, action: 'ref' };\n }\n\n const primitivePreference = {\n f32: 0,\n f16: 1,\n i32: 2,\n u32: 3,\n bool: 4,\n } as const;\n type PrimitiveType = keyof typeof primitivePreference;\n\n if (\n trueSrc.type in primitivePreference &&\n trueDst.type in primitivePreference\n ) {\n const srcType = trueSrc.type as PrimitiveType;\n const destType = trueDst.type as PrimitiveType;\n\n if (srcType !== destType) {\n const srcPref = primitivePreference[srcType];\n const destPref = primitivePreference[destType];\n\n const rank = destPref < srcPref ? 10 : 20;\n\n return { rank: rank, action: 'cast', targetType: trueDst };\n }\n }\n\n if (trueSrc.type === 'abstractFloat') {\n if (trueDst.type === 'u32') {\n return { rank: 2, action: 'cast', targetType: trueDst };\n }\n if (trueDst.type === 'i32') {\n return { rank: 1, action: 'cast', targetType: trueDst };\n }\n }\n\n return INFINITE_RANK;\n}\n\nfunction getConversionRank(\n src: AnyData,\n dest: AnyData,\n allowImplicit: boolean,\n): ConversionRankInfo {\n const autoRank = getAutoConversionRank(src, dest);\n if (autoRank.rank < Number.POSITIVE_INFINITY) {\n return autoRank;\n }\n if (allowImplicit) {\n return getImplicitConversionRank(src, dest);\n }\n return INFINITE_RANK;\n}\n\nexport type ConversionResultAction = {\n sourceIndex: number;\n action: ConversionAction;\n targetType?: U32 | F32 | I32 | F16;\n};\n\nexport type ConversionResult = {\n targetType: AnyData;\n actions: ConversionResultAction[];\n hasImplicitConversions?: boolean;\n};\n\nfunction findBestType(\n types: AnyData[],\n uniqueTypes: AnyData[],\n allowImplicit: boolean,\n): ConversionResult | undefined {\n let bestResult:\n | { type: AnyData; details: ConversionRankInfo[]; sum: number }\n | undefined;\n\n for (const targetType of uniqueTypes) {\n const details: ConversionRankInfo[] = [];\n let sum = 0;\n for (const sourceType of types) {\n const conversion = getConversionRank(\n sourceType,\n targetType,\n allowImplicit,\n );\n sum += conversion.rank;\n if (conversion.rank === Number.POSITIVE_INFINITY) {\n break;\n }\n details.push(conversion);\n }\n if (sum < (bestResult?.sum ?? Number.POSITIVE_INFINITY)) {\n bestResult = { type: targetType, details, sum };\n }\n }\n if (!bestResult) {\n return undefined;\n }\n const actions: ConversionResultAction[] = bestResult.details.map((\n detail,\n index,\n ) => ({\n sourceIndex: index,\n action: detail.action,\n ...(detail.action === 'cast' && {\n targetType: detail.targetType as U32 | F32 | I32 | F16,\n }),\n }));\n\n return {\n targetType: bestResult.type,\n actions,\n hasImplicitConversions: actions.some((action) => action.action === 'cast'),\n };\n}\n\nexport function getBestConversion(\n types: AnyData[],\n targetTypes?: AnyData[],\n): ConversionResult | undefined {\n if (types.length === 0) return undefined;\n\n const uniqueTargetTypes = [\n ...new Set((targetTypes || types).map(undecorate)),\n ];\n\n const explicitResult = findBestType(types, uniqueTargetTypes, false);\n if (explicitResult) {\n return explicitResult;\n }\n\n const implicitResult = findBestType(types, uniqueTargetTypes, true);\n if (implicitResult) {\n return implicitResult;\n }\n\n return undefined;\n}\n\nfunction applyActionToSnippet(\n snippet: Snippet,\n action: ConversionResultAction,\n targetType: AnyData,\n): Snippet {\n if (action.action === 'none') {\n return snip(snippet.value, targetType);\n }\n\n switch (action.action) {\n case 'ref':\n return snip(stitch`&${snippet}`, targetType);\n case 'deref':\n return snip(stitch`*${snippet}`, targetType);\n case 'cast': {\n // Casting means calling the schema with the snippet as an argument.\n return (targetType as unknown as (val: Snippet) => Snippet)(snippet);\n }\n default: {\n assertExhaustive(action.action, 'applyActionToSnippet');\n }\n }\n}\n\nexport function unify<T extends (AnyData | UnknownData)[]>(\n inTypes: T,\n restrictTo?: AnyData[] | undefined,\n): { [K in keyof T]: AnyWgslData } | undefined {\n if (inTypes.some((type) => type.type === 'unknown')) {\n return undefined;\n }\n\n const conversion = getBestConversion(inTypes as AnyData[], restrictTo);\n if (!conversion) {\n return undefined;\n }\n\n return inTypes.map(() => conversion.targetType) as {\n [K in keyof T]: AnyWgslData;\n };\n}\n\nexport function convertToCommonType<T extends Snippet[]>(\n values: T,\n restrictTo?: AnyData[] | undefined,\n verbose = true,\n): T | undefined {\n const types = values.map((value) => value.dataType);\n\n if (types.some((type) => type.type === 'unknown')) {\n return undefined;\n }\n\n if (DEV && Array.isArray(restrictTo) && restrictTo.length === 0) {\n console.warn(\n 'convertToCommonType was called with an empty restrictTo array, which prevents any conversions from being made. If you intend to allow all conversions, pass undefined instead. If this was intended call the function conditionally since the result will always be undefined.',\n );\n }\n\n const conversion = getBestConversion(types as AnyData[], restrictTo);\n if (!conversion) {\n return undefined;\n }\n\n if ((TEST || DEV) && verbose && conversion.hasImplicitConversions) {\n console.warn(\n `Implicit conversions from [\\n${\n values\n .map((v) => ` ${v.value}: ${v.dataType.type}`)\n .join(\n ',\\n',\n )\n }\\n] to ${conversion.targetType.type} are supported, but not recommended.\nConsider using explicit conversions instead.`,\n );\n }\n\n return values.map((value, index) => {\n const action = conversion.actions[index];\n invariant(action, 'Action should not be undefined');\n return applyActionToSnippet(value, action, conversion.targetType);\n }) as T;\n}\n\nexport function tryConvertSnippet(\n snippet: Snippet,\n targetDataType: AnyData,\n verbose = true,\n): Snippet {\n if (targetDataType === snippet.dataType) {\n return snip(snippet.value, targetDataType);\n }\n\n if (snippet.dataType.type === 'unknown') {\n // This is it, it's now or never. We expect a specific type, and we're going to get it\n return snip(stitch`${snip(snippet.value, targetDataType)}`, targetDataType);\n }\n\n const converted = convertToCommonType([snippet], [targetDataType], verbose);\n\n if (!converted) {\n throw new WgslTypeError(\n `Cannot convert value of type '${snippet.dataType.type}' to type '${targetDataType.type}'`,\n );\n }\n\n return converted[0] as Snippet;\n}\n\nexport function convertStructValues(\n structType: WgslStruct,\n values: Record<string, Snippet>,\n): Snippet[] {\n const propKeys = Object.keys(structType.propTypes);\n\n return propKeys.map((key) => {\n const val = values[key];\n if (!val) {\n throw new Error(`Missing property ${key}`);\n }\n\n const targetType = structType.propTypes[key];\n const converted = convertToCommonType([val], [targetType]);\n\n return converted?.[0] ?? val;\n });\n}\n","import { $internal, $resolve } from '../shared/symbols.ts';\nimport type { SelfResolvable } from '../types.ts';\nimport type { AnyData } from './dataTypes.ts';\nimport { bool, f16, f32, i32, u32 } from './numeric.ts';\nimport { type ResolvedSnippet, snip } from './snippet.ts';\nimport type { VecKind } from './wgslTypes.ts';\n\ntype VecSchema<S> = AnyData & {\n [$internal]: {\n jsImpl: (v?: S) => S;\n };\n};\n\n// deno-fmt-ignore\nexport abstract class VecBase<S> extends Array implements SelfResolvable {\n abstract readonly [$internal]: {\n elementSchema: VecSchema<S>;\n };\n abstract get kind(): VecKind;\n\n abstract get _Vec2(): new (\n x: S,\n y: S,\n ) => Vec2<S>;\n abstract get _Vec3(): new (\n x: S,\n y: S,\n z: S,\n ) => Vec3<S>;\n abstract get _Vec4(): new (\n x: S,\n y: S,\n z: S,\n w: S,\n ) => Vec4<S>;\n\n castElement(): (v?: S) => S {\n return this[$internal].elementSchema[$internal].jsImpl;\n }\n\n [$resolve](): ResolvedSnippet {\n const schema = this[$internal].elementSchema;\n if (this.every((e) => !e)) {\n return snip(`${this.kind}()`, schema);\n }\n if (this.every((e) => this[0] === e)) {\n return snip(`${this.kind}(${this[0]})`, schema);\n }\n return snip(`${this.kind}(${this.join(', ')})`, schema);\n }\n\n toString() {\n return this[$resolve]().value;\n }\n\n get xx() { return new this._Vec2(this[0], this[0]); }\n get xy() { return new this._Vec2(this[0], this[1]); }\n get xz() { return new this._Vec2(this[0], this[2]); }\n get xw() { return new this._Vec2(this[0], this[3]); }\n get yx() { return new this._Vec2(this[1], this[0]); }\n get yy() { return new this._Vec2(this[1], this[1]); }\n get yz() { return new this._Vec2(this[1], this[2]); }\n get yw() { return new this._Vec2(this[1], this[3]); }\n get zx() { return new this._Vec2(this[2], this[0]); }\n get zy() { return new this._Vec2(this[2], this[1]); }\n get zz() { return new this._Vec2(this[2], this[2]); }\n get zw() { return new this._Vec2(this[2], this[3]); }\n get wx() { return new this._Vec2(this[3], this[0]); }\n get wy() { return new this._Vec2(this[3], this[1]); }\n get wz() { return new this._Vec2(this[3], this[2]); }\n get ww() { return new this._Vec2(this[3], this[3]); }\n get xxx() { return new this._Vec3(this[0], this[0], this[0]); }\n get xxy() { return new this._Vec3(this[0], this[0], this[1]); }\n get xxz() { return new this._Vec3(this[0], this[0], this[2]); }\n get xxw() { return new this._Vec3(this[0], this[0], this[3]); }\n get xyx() { return new this._Vec3(this[0], this[1], this[0]); }\n get xyy() { return new this._Vec3(this[0], this[1], this[1]); }\n get xyz() { return new this._Vec3(this[0], this[1], this[2]); }\n get xyw() { return new this._Vec3(this[0], this[1], this[3]); }\n get xzx() { return new this._Vec3(this[0], this[2], this[0]); }\n get xzy() { return new this._Vec3(this[0], this[2], this[1]); }\n get xzz() { return new this._Vec3(this[0], this[2], this[2]); }\n get xzw() { return new this._Vec3(this[0], this[2], this[3]); }\n get xwx() { return new this._Vec3(this[0], this[3], this[0]); }\n get xwy() { return new this._Vec3(this[0], this[3], this[1]); }\n get xwz() { return new this._Vec3(this[0], this[3], this[2]); }\n get xww() { return new this._Vec3(this[0], this[3], this[3]); }\n get yxx() { return new this._Vec3(this[1], this[0], this[0]); }\n get yxy() { return new this._Vec3(this[1], this[0], this[1]); }\n get yxz() { return new this._Vec3(this[1], this[0], this[2]); }\n get yxw() { return new this._Vec3(this[1], this[0], this[3]); }\n get yyx() { return new this._Vec3(this[1], this[1], this[0]); }\n get yyy() { return new this._Vec3(this[1], this[1], this[1]); }\n get yyz() { return new this._Vec3(this[1], this[1], this[2]); }\n get yyw() { return new this._Vec3(this[1], this[1], this[3]); }\n get yzx() { return new this._Vec3(this[1], this[2], this[0]); }\n get yzy() { return new this._Vec3(this[1], this[2], this[1]); }\n get yzz() { return new this._Vec3(this[1], this[2], this[2]); }\n get yzw() { return new this._Vec3(this[1], this[2], this[3]); }\n get ywx() { return new this._Vec3(this[1], this[3], this[0]); }\n get ywy() { return new this._Vec3(this[1], this[3], this[1]); }\n get ywz() { return new this._Vec3(this[1], this[3], this[2]); }\n get yww() { return new this._Vec3(this[1], this[3], this[3]); }\n get zxx() { return new this._Vec3(this[2], this[0], this[0]); }\n get zxy() { return new this._Vec3(this[2], this[0], this[1]); }\n get zxz() { return new this._Vec3(this[2], this[0], this[2]); }\n get zxw() { return new this._Vec3(this[2], this[0], this[3]); }\n get zyx() { return new this._Vec3(this[2], this[1], this[0]); }\n get zyy() { return new this._Vec3(this[2], this[1], this[1]); }\n get zyz() { return new this._Vec3(this[2], this[1], this[2]); }\n get zyw() { return new this._Vec3(this[2], this[1], this[3]); }\n get zzx() { return new this._Vec3(this[2], this[2], this[0]); }\n get zzy() { return new this._Vec3(this[2], this[2], this[1]); }\n get zzz() { return new this._Vec3(this[2], this[2], this[2]); }\n get zzw() { return new this._Vec3(this[2], this[2], this[3]); }\n get zwx() { return new this._Vec3(this[2], this[3], this[0]); }\n get zwy() { return new this._Vec3(this[2], this[3], this[1]); }\n get zwz() { return new this._Vec3(this[2], this[3], this[2]); }\n get zww() { return new this._Vec3(this[2], this[3], this[3]); }\n get wxx() { return new this._Vec3(this[3], this[0], this[0]); }\n get wxy() { return new this._Vec3(this[3], this[0], this[1]); }\n get wxz() { return new this._Vec3(this[3], this[0], this[2]); }\n get wxw() { return new this._Vec3(this[3], this[0], this[3]); }\n get wyx() { return new this._Vec3(this[3], this[1], this[0]); }\n get wyy() { return new this._Vec3(this[3], this[1], this[1]); }\n get wyz() { return new this._Vec3(this[3], this[1], this[2]); }\n get wyw() { return new this._Vec3(this[3], this[1], this[3]); }\n get wzx() { return new this._Vec3(this[3], this[2], this[0]); }\n get wzy() { return new this._Vec3(this[3], this[2], this[1]); }\n get wzz() { return new this._Vec3(this[3], this[2], this[2]); }\n get wzw() { return new this._Vec3(this[3], this[2], this[3]); }\n get wwx() { return new this._Vec3(this[3], this[3], this[0]); }\n get wwy() { return new this._Vec3(this[3], this[3], this[1]); }\n get wwz() { return new this._Vec3(this[3], this[3], this[2]); }\n get www() { return new this._Vec3(this[3], this[3], this[3]); }\n get xxxx() { return new this._Vec4(this[0], this[0], this[0], this[0]); }\n get xxxy() { return new this._Vec4(this[0], this[0], this[0], this[1]); }\n get xxxz() { return new this._Vec4(this[0], this[0], this[0], this[2]); }\n get xxxw() { return new this._Vec4(this[0], this[0], this[0], this[3]); }\n get xxyx() { return new this._Vec4(this[0], this[0], this[1], this[0]); }\n get xxyy() { return new this._Vec4(this[0], this[0], this[1], this[1]); }\n get xxyz() { return new this._Vec4(this[0], this[0], this[1], this[2]); }\n get xxyw() { return new this._Vec4(this[0], this[0], this[1], this[3]); }\n get xxzx() { return new this._Vec4(this[0], this[0], this[2], this[0]); }\n get xxzy() { return new this._Vec4(this[0], this[0], this[2], this[1]); }\n get xxzz() { return new this._Vec4(this[0], this[0], this[2], this[2]); }\n get xxzw() { return new this._Vec4(this[0], this[0], this[2], this[3]); }\n get xxwx() { return new this._Vec4(this[0], this[0], this[3], this[0]); }\n get xxwy() { return new this._Vec4(this[0], this[0], this[3], this[1]); }\n get xxwz() { return new this._Vec4(this[0], this[0], this[3], this[2]); }\n get xxww() { return new this._Vec4(this[0], this[0], this[3], this[3]); }\n get xyxx() { return new this._Vec4(this[0], this[1], this[0], this[0]); }\n get xyxy() { return new this._Vec4(this[0], this[1], this[0], this[1]); }\n get xyxz() { return new this._Vec4(this[0], this[1], this[0], this[2]); }\n get xyxw() { return new this._Vec4(this[0], this[1], this[0], this[3]); }\n get xyyx() { return new this._Vec4(this[0], this[1], this[1], this[0]); }\n get xyyy() { return new this._Vec4(this[0], this[1], this[1], this[1]); }\n get xyyz() { return new this._Vec4(this[0], this[1], this[1], this[2]); }\n get xyyw() { return new this._Vec4(this[0], this[1], this[1], this[3]); }\n get xyzx() { return new this._Vec4(this[0], this[1], this[2], this[0]); }\n get xyzy() { return new this._Vec4(this[0], this[1], this[2], this[1]); }\n get xyzz() { return new this._Vec4(this[0], this[1], this[2], this[2]); }\n get xyzw() { return new this._Vec4(this[0], this[1], this[2], this[3]); }\n get xywx() { return new this._Vec4(this[0], this[1], this[3], this[0]); }\n get xywy() { return new this._Vec4(this[0], this[1], this[3], this[1]); }\n get xywz() { return new this._Vec4(this[0], this[1], this[3], this[2]); }\n get xyww() { return new this._Vec4(this[0], this[1], this[3], this[3]); }\n get xzxx() { return new this._Vec4(this[0], this[2], this[0], this[0]); }\n get xzxy() { return new this._Vec4(this[0], this[2], this[0], this[1]); }\n get xzxz() { return new this._Vec4(this[0], this[2], this[0], this[2]); }\n get xzxw() { return new this._Vec4(this[0], this[2], this[0], this[3]); }\n get xzyx() { return new this._Vec4(this[0], this[2], this[1], this[0]); }\n get xzyy() { return new this._Vec4(this[0], this[2], this[1], this[1]); }\n get xzyz() { return new this._Vec4(this[0], this[2], this[1], this[2]); }\n get xzyw() { return new this._Vec4(this[0], this[2], this[1], this[3]); }\n get xzzx() { return new this._Vec4(this[0], this[2], this[2], this[0]); }\n get xzzy() { return new this._Vec4(this[0], this[2], this[2], this[1]); }\n get xzzz() { return new this._Vec4(this[0], this[2], this[2], this[2]); }\n get xzzw() { return new this._Vec4(this[0], this[2], this[2], this[3]); }\n get xzwx() { return new this._Vec4(this[0], this[2], this[3], this[0]); }\n get xzwy() { return new this._Vec4(this[0], this[2], this[3], this[1]); }\n get xzwz() { return new this._Vec4(this[0], this[2], this[3], this[2]); }\n get xzww() { return new this._Vec4(this[0], this[2], this[3], this[3]); }\n get xwxx() { return new this._Vec4(this[0], this[3], this[0], this[0]); }\n get xwxy() { return new this._Vec4(this[0], this[3], this[0], this[1]); }\n get xwxz() { return new this._Vec4(this[0], this[3], this[0], this[2]); }\n get xwxw() { return new this._Vec4(this[0], this[3], this[0], this[3]); }\n get xwyx() { return new this._Vec4(this[0], this[3], this[1], this[0]); }\n get xwyy() { return new this._Vec4(this[0], this[3], this[1], this[1]); }\n get xwyz() { return new this._Vec4(this[0], this[3], this[1], this[2]); }\n get xwyw() { return new this._Vec4(this[0], this[3], this[1], this[3]); }\n get xwzx() { return new this._Vec4(this[0], this[3], this[2], this[0]); }\n get xwzy() { return new this._Vec4(this[0], this[3], this[2], this[1]); }\n get xwzz() { return new this._Vec4(this[0], this[3], this[2], this[2]); }\n get xwzw() { return new this._Vec4(this[0], this[3], this[2], this[3]); }\n get xwwx() { return new this._Vec4(this[0], this[3], this[3], this[0]); }\n get xwwy() { return new this._Vec4(this[0], this[3], this[3], this[1]); }\n get xwwz() { return new this._Vec4(this[0], this[3], this[3], this[2]); }\n get xwww() { return new this._Vec4(this[0], this[3], this[3], this[3]); }\n get yxxx() { return new this._Vec4(this[1], this[0], this[0], this[0]); }\n get yxxy() { return new this._Vec4(this[1], this[0], this[0], this[1]); }\n get yxxz() { return new this._Vec4(this[1], this[0], this[0], this[2]); }\n get yxxw() { return new this._Vec4(this[1], this[0], this[0], this[3]); }\n get yxyx() { return new this._Vec4(this[1], this[0], this[1], this[0]); }\n get yxyy() { return new this._Vec4(this[1], this[0], this[1], this[1]); }\n get yxyz() { return new this._Vec4(this[1], this[0], this[1], this[2]); }\n get yxyw() { return new this._Vec4(this[1], this[0], this[1], this[3]); }\n get yxzx() { return new this._Vec4(this[1], this[0], this[2], this[0]); }\n get yxzy() { return new this._Vec4(this[1], this[0], this[2], this[1]); }\n get yxzz() { return new this._Vec4(this[1], this[0], this[2], this[2]); }\n get yxzw() { return new this._Vec4(this[1], this[0], this[2], this[3]); }\n get yxwx() { return new this._Vec4(this[1], this[0], this[3], this[0]); }\n get yxwy() { return new this._Vec4(this[1], this[0], this[3], this[1]); }\n get yxwz() { return new this._Vec4(this[1], this[0], this[3], this[2]); }\n get yxww() { return new this._Vec4(this[1], this[0], this[3], this[3]); }\n get yyxx() { return new this._Vec4(this[1], this[1], this[0], this[0]); }\n get yyxy() { return new this._Vec4(this[1], this[1], this[0], this[1]); }\n get yyxz() { return new this._Vec4(this[1], this[1], this[0], this[2]); }\n get yyxw() { return new this._Vec4(this[1], this[1], this[0], this[3]); }\n get yyyx() { return new this._Vec4(this[1], this[1], this[1], this[0]); }\n get yyyy() { return new this._Vec4(this[1], this[1], this[1], this[1]); }\n get yyyz() { return new this._Vec4(this[1], this[1], this[1], this[2]); }\n get yyyw() { return new this._Vec4(this[1], this[1], this[1], this[3]); }\n get yyzx() { return new this._Vec4(this[1], this[1], this[2], this[0]); }\n get yyzy() { return new this._Vec4(this[1], this[1], this[2], this[1]); }\n get yyzz() { return new this._Vec4(this[1], this[1], this[2], this[2]); }\n get yyzw() { return new this._Vec4(this[1], this[1], this[2], this[3]); }\n get yywx() { return new this._Vec4(this[1], this[1], this[3], this[0]); }\n get yywy() { return new this._Vec4(this[1], this[1], this[3], this[1]); }\n get yywz() { return new this._Vec4(this[1], this[1], this[3], this[2]); }\n get yyww() { return new this._Vec4(this[1], this[1], this[3], this[3]); }\n get yzxx() { return new this._Vec4(this[1], this[2], this[0], this[0]); }\n get yzxy() { return new this._Vec4(this[1], this[2], this[0], this[1]); }\n get yzxz() { return new this._Vec4(this[1], this[2], this[0], this[2]); }\n get yzxw() { return new this._Vec4(this[1], this[2], this[0], this[3]); }\n get yzyx() { return new this._Vec4(this[1], this[2], this[1], this[0]); }\n get yzyy() { return new this._Vec4(this[1], this[2], this[1], this[1]); }\n get yzyz() { return new this._Vec4(this[1], this[2], this[1], this[2]); }\n get yzyw() { return new this._Vec4(this[1], this[2], this[1], this[3]); }\n get yzzx() { return new this._Vec4(this[1], this[2], this[2], this[0]); }\n get yzzy() { return new this._Vec4(this[1], this[2], this[2], this[1]); }\n get yzzz() { return new this._Vec4(this[1], this[2], this[2], this[2]); }\n get yzzw() { return new this._Vec4(this[1], this[2], this[2], this[3]); }\n get yzwx() { return new this._Vec4(this[1], this[2], this[3], this[0]); }\n get yzwy() { return new this._Vec4(this[1], this[2], this[3], this[1]); }\n get yzwz() { return new this._Vec4(this[1], this[2], this[3], this[2]); }\n get yzww() { return new this._Vec4(this[1], this[2], this[3], this[3]); }\n get ywxx() { return new this._Vec4(this[1], this[3], this[0], this[0]); }\n get ywxy() { return new this._Vec4(this[1], this[3], this[0], this[1]); }\n get ywxz() { return new this._Vec4(this[1], this[3], this[0], this[2]); }\n get ywxw() { return new this._Vec4(this[1], this[3], this[0], this[3]); }\n get ywyx() { return new this._Vec4(this[1], this[3], this[1], this[0]); }\n get ywyy() { return new this._Vec4(this[1], this[3], this[1], this[1]); }\n get ywyz() { return new this._Vec4(this[1], this[3], this[1], this[2]); }\n get ywyw() { return new this._Vec4(this[1], this[3], this[1], this[3]); }\n get ywzx() { return new this._Vec4(this[1], this[3], this[2], this[0]); }\n get ywzy() { return new this._Vec4(this[1], this[3], this[2], this[1]); }\n get ywzz() { return new this._Vec4(this[1], this[3], this[2], this[2]); }\n get ywzw() { return new this._Vec4(this[1], this[3], this[2], this[3]); }\n get ywwx() { return new this._Vec4(this[1], this[3], this[3], this[0]); }\n get ywwy() { return new this._Vec4(this[1], this[3], this[3], this[1]); }\n get ywwz() { return new this._Vec4(this[1], this[3], this[3], this[2]); }\n get ywww() { return new this._Vec4(this[1], this[3], this[3], this[3]); }\n get zxxx() { return new this._Vec4(this[2], this[0], this[0], this[0]); }\n get zxxy() { return new this._Vec4(this[2], this[0], this[0], this[1]); }\n get zxxz() { return new this._Vec4(this[2], this[0], this[0], this[2]); }\n get zxxw() { return new this._Vec4(this[2], this[0], this[0], this[3]); }\n get zxyx() { return new this._Vec4(this[2], this[0], this[1], this[0]); }\n get zxyy() { return new this._Vec4(this[2], this[0], this[1], this[1]); }\n get zxyz() { return new this._Vec4(this[2], this[0], this[1], this[2]); }\n get zxyw() { return new this._Vec4(this[2], this[0], this[1], this[3]); }\n get zxzx() { return new this._Vec4(this[2], this[0], this[2], this[0]); }\n get zxzy() { return new this._Vec4(this[2], this[0], this[2], this[1]); }\n get zxzz() { return new this._Vec4(this[2], this[0], this[2], this[2]); }\n get zxzw() { return new this._Vec4(this[2], this[0], this[2], this[3]); }\n get zxwx() { return new this._Vec4(this[2], this[0], this[3], this[0]); }\n get zxwy() { return new this._Vec4(this[2], this[0], this[3], this[1]); }\n get zxwz() { return new this._Vec4(this[2], this[0], this[3], this[2]); }\n get zxww() { return new this._Vec4(this[2], this[0], this[3], this[3]); }\n get zyxx() { return new this._Vec4(this[2], this[1], this[0], this[0]); }\n get zyxy() { return new this._Vec4(this[2], this[1], this[0], this[1]); }\n get zyxz() { return new this._Vec4(this[2], this[1], this[0], this[2]); }\n get zyxw() { return new this._Vec4(this[2], this[1], this[0], this[3]); }\n get zyyx() { return new this._Vec4(this[2], this[1], this[1], this[0]); }\n get zyyy() { return new this._Vec4(this[2], this[1], this[1], this[1]); }\n get zyyz() { return new this._Vec4(this[2], this[1], this[1], this[2]); }\n get zyyw() { return new this._Vec4(this[2], this[1], this[1], this[3]); }\n get zyzx() { return new this._Vec4(this[2], this[1], this[2], this[0]); }\n get zyzy() { return new this._Vec4(this[2], this[1], this[2], this[1]); }\n get zyzz() { return new this._Vec4(this[2], this[1], this[2], this[2]); }\n get zyzw() { return new this._Vec4(this[2], this[1], this[2], this[3]); }\n get zywx() { return new this._Vec4(this[2], this[1], this[3], this[0]); }\n get zywy() { return new this._Vec4(this[2], this[1], this[3], this[1]); }\n get zywz() { return new this._Vec4(this[2], this[1], this[3], this[2]); }\n get zyww() { return new this._Vec4(this[2], this[1], this[3], this[3]); }\n get zzxx() { return new this._Vec4(this[2], this[2], this[0], this[0]); }\n get zzxy() { return new this._Vec4(this[2], this[2], this[0], this[1]); }\n get zzxz() { return new this._Vec4(this[2], this[2], this[0], this[2]); }\n get zzxw() { return new this._Vec4(this[2], this[2], this[0], this[3]); }\n get zzyx() { return new this._Vec4(this[2], this[2], this[1], this[0]); }\n get zzyy() { return new this._Vec4(this[2], this[2], this[1], this[1]); }\n get zzyz() { return new this._Vec4(this[2], this[2], this[1], this[2]); }\n get zzyw() { return new this._Vec4(this[2], this[2], this[1], this[3]); }\n get zzzx() { return new this._Vec4(this[2], this[2], this[2], this[0]); }\n get zzzy() { return new this._Vec4(this[2], this[2], this[2], this[1]); }\n get zzzz() { return new this._Vec4(this[2], this[2], this[2], this[2]); }\n get zzzw() { return new this._Vec4(this[2], this[2], this[2], this[3]); }\n get zzwx() { return new this._Vec4(this[2], this[2], this[3], this[0]); }\n get zzwy() { return new this._Vec4(this[2], this[2], this[3], this[1]); }\n get zzwz() { return new this._Vec4(this[2], this[2], this[3], this[2]); }\n get zzww() { return new this._Vec4(this[2], this[2], this[3], this[3]); }\n get zwxx() { return new this._Vec4(this[2], this[3], this[0], this[0]); }\n get zwxy() { return new this._Vec4(this[2], this[3], this[0], this[1]); }\n get zwxz() { return new this._Vec4(this[2], this[3], this[0], this[2]); }\n get zwxw() { return new this._Vec4(this[2], this[3], this[0], this[3]); }\n get zwyx() { return new this._Vec4(this[2], this[3], this[1], this[0]); }\n get zwyy() { return new this._Vec4(this[2], this[3], this[1], this[1]); }\n get zwyz() { return new this._Vec4(this[2], this[3], this[1], this[2]); }\n get zwyw() { return new this._Vec4(this[2], this[3], this[1], this[3]); }\n get zwzx() { return new this._Vec4(this[2], this[3], this[2], this[0]); }\n get zwzy() { return new this._Vec4(this[2], this[3], this[2], this[1]); }\n get zwzz() { return new this._Vec4(this[2], this[3], this[2], this[2]); }\n get zwzw() { return new this._Vec4(this[2], this[3], this[2], this[3]); }\n get zwwx() { return new this._Vec4(this[2], this[3], this[3], this[0]); }\n get zwwy() { return new this._Vec4(this[2], this[3], this[3], this[1]); }\n get zwwz() { return new this._Vec4(this[2], this[3], this[3], this[2]); }\n get zwww() { return new this._Vec4(this[2], this[3], this[3], this[3]); }\n get wxxx() { return new this._Vec4(this[3], this[0], this[0], this[0]); }\n get wxxy() { return new this._Vec4(this[3], this[0], this[0], this[1]); }\n get wxxz() { return new this._Vec4(this[3], this[0], this[0], this[2]); }\n get wxxw() { return new this._Vec4(this[3], this[0], this[0], this[3]); }\n get wxyx() { return new this._Vec4(this[3], this[0], this[1], this[0]); }\n get wxyy() { return new this._Vec4(this[3], this[0], this[1], this[1]); }\n get wxyz() { return new this._Vec4(this[3], this[0], this[1], this[2]); }\n get wxyw() { return new this._Vec4(this[3], this[0], this[1], this[3]); }\n get wxzx() { return new this._Vec4(this[3], this[0], this[2], this[0]); }\n get wxzy() { return new this._Vec4(this[3], this[0], this[2], this[1]); }\n get wxzz() { return new this._Vec4(this[3], this[0], this[2], this[2]); }\n get wxzw() { return new this._Vec4(this[3], this[0], this[2], this[3]); }\n get wxwx() { return new this._Vec4(this[3], this[0], this[3], this[0]); }\n get wxwy() { return new this._Vec4(this[3], this[0], this[3], this[1]); }\n get wxwz() { return new this._Vec4(this[3], this[0], this[3], this[2]); }\n get wxww() { return new this._Vec4(this[3], this[0], this[3], this[3]); }\n get wyxx() { return new this._Vec4(this[3], this[1], this[0], this[0]); }\n get wyxy() { return new this._Vec4(this[3], this[1], this[0], this[1]); }\n get wyxz() { return new this._Vec4(this[3], this[1], this[0], this[2]); }\n get wyxw() { return new this._Vec4(this[3], this[1], this[0], this[3]); }\n get wyyx() { return new this._Vec4(this[3], this[1], this[1], this[0]); }\n get wyyy() { return new this._Vec4(this[3], this[1], this[1], this[1]); }\n get wyyz() { return new this._Vec4(this[3], this[1], this[1], this[2]); }\n get wyyw() { return new this._Vec4(this[3], this[1], this[1], this[3]); }\n get wyzx() { return new this._Vec4(this[3], this[1], this[2], this[0]); }\n get wyzy() { return new this._Vec4(this[3], this[1], this[2], this[1]); }\n get wyzz() { return new this._Vec4(this[3], this[1], this[2], this[2]); }\n get wyzw() { return new this._Vec4(this[3], this[1], this[2], this[3]); }\n get wywx() { return new this._Vec4(this[3], this[1], this[3], this[0]); }\n get wywy() { return new this._Vec4(this[3], this[1], this[3], this[1]); }\n get wywz() { return new this._Vec4(this[3], this[1], this[3], this[2]); }\n get wyww() { return new this._Vec4(this[3], this[1], this[3], this[3]); }\n get wzxx() { return new this._Vec4(this[3], this[2], this[0], this[0]); }\n get wzxy() { return new this._Vec4(this[3], this[2], this[0], this[1]); }\n get wzxz() { return new this._Vec4(this[3], this[2], this[0], this[2]); }\n get wzxw() { return new this._Vec4(this[3], this[2], this[0], this[3]); }\n get wzyx() { return new this._Vec4(this[3], this[2], this[1], this[0]); }\n get wzyy() { return new this._Vec4(this[3], this[2], this[1], this[1]); }\n get wzyz() { return new this._Vec4(this[3], this[2], this[1], this[2]); }\n get wzyw() { return new this._Vec4(this[3], this[2], this[1], this[3]); }\n get wzzx() { return new this._Vec4(this[3], this[2], this[2], this[0]); }\n get wzzy() { return new this._Vec4(this[3], this[2], this[2], this[1]); }\n get wzzz() { return new this._Vec4(this[3], this[2], this[2], this[2]); }\n get wzzw() { return new this._Vec4(this[3], this[2], this[2], this[3]); }\n get wzwx() { return new this._Vec4(this[3], this[2], this[3], this[0]); }\n get wzwy() { return new this._Vec4(this[3], this[2], this[3], this[1]); }\n get wzwz() { return new this._Vec4(this[3], this[2], this[3], this[2]); }\n get wzww() { return new this._Vec4(this[3], this[2], this[3], this[3]); }\n get wwxx() { return new this._Vec4(this[3], this[3], this[0], this[0]); }\n get wwxy() { return new this._Vec4(this[3], this[3], this[0], this[1]); }\n get wwxz() { return new this._Vec4(this[3], this[3], this[0], this[2]); }\n get wwxw() { return new this._Vec4(this[3], this[3], this[0], this[3]); }\n get wwyx() { return new this._Vec4(this[3], this[3], this[1], this[0]); }\n get wwyy() { return new this._Vec4(this[3], this[3], this[1], this[1]); }\n get wwyz() { return new this._Vec4(this[3], this[3], this[1], this[2]); }\n get wwyw() { return new this._Vec4(this[3], this[3], this[1], this[3]); }\n get wwzx() { return new this._Vec4(this[3], this[3], this[2], this[0]); }\n get wwzy() { return new this._Vec4(this[3], this[3], this[2], this[1]); }\n get wwzz() { return new this._Vec4(this[3], this[3], this[2], this[2]); }\n get wwzw() { return new this._Vec4(this[3], this[3], this[2], this[3]); }\n get wwwx() { return new this._Vec4(this[3], this[3], this[3], this[0]); }\n get wwwy() { return new this._Vec4(this[3], this[3], this[3], this[1]); }\n get wwwz() { return new this._Vec4(this[3], this[3], this[3], this[2]); }\n get wwww() { return new this._Vec4(this[3], this[3], this[3], this[3]); }\n}\n\ntype Tuple2<S> = [S, S];\ntype Tuple3<S> = [S, S, S];\ntype Tuple4<S> = [S, S, S, S];\n\nabstract class Vec2<S> extends VecBase<S> implements Tuple2<S> {\n declare readonly length: 2;\n\n e0: S;\n e1: S;\n\n constructor(x?: S, y?: S) {\n super(2);\n this.e0 = this.castElement()(x);\n this.e1 = this.castElement()(y ?? x);\n }\n\n get 0() {\n return this.e0;\n }\n\n get 1() {\n return this.e1;\n }\n\n set 0(value: S) {\n this.e0 = this.castElement()(value);\n }\n\n set 1(value: S) {\n this.e1 = this.castElement()(value);\n }\n\n get x() {\n return this[0];\n }\n\n get y() {\n return this[1];\n }\n\n set x(value: S) {\n this[0] = this.castElement()(value);\n }\n\n set y(value: S) {\n this[1] = this.castElement()(value);\n }\n}\n\nabstract class Vec3<S> extends VecBase<S> implements Tuple3<S> {\n declare readonly length: 3;\n\n e0: S;\n e1: S;\n e2: S;\n\n constructor(x?: S, y?: S, z?: S) {\n super(3);\n this.e0 = this.castElement()(x);\n this.e1 = this.castElement()(y ?? x);\n this.e2 = this.castElement()(z ?? x);\n }\n\n get 0() {\n return this.e0;\n }\n\n get 1() {\n return this.e1;\n }\n\n get 2() {\n return this.e2;\n }\n\n set 0(value: S) {\n this.e0 = this.castElement()(value);\n }\n\n set 1(value: S) {\n this.e1 = this.castElement()(value);\n }\n\n set 2(value: S) {\n this.e2 = this.castElement()(value);\n }\n\n get x() {\n return this[0];\n }\n\n get y() {\n return this[1];\n }\n\n get z() {\n return this[2];\n }\n\n set x(value: S) {\n this[0] = this.castElement()(value);\n }\n\n set y(value: S) {\n this[1] = this.castElement()(value);\n }\n\n set z(value: S) {\n this[2] = this.castElement()(value);\n }\n}\n\nabstract class Vec4<S> extends VecBase<S> implements Tuple4<S> {\n declare readonly length: 4;\n\n e0: S;\n e1: S;\n e2: S;\n e3: S;\n\n constructor(x?: S, y?: S, z?: S, w?: S) {\n super(4);\n this.e0 = this.castElement()(x);\n this.e1 = this.castElement()(y ?? x);\n this.e2 = this.castElement()(z ?? x);\n this.e3 = this.castElement()(w ?? x);\n }\n\n get 0() {\n return this.e0;\n }\n\n get 1() {\n return this.e1;\n }\n\n get 2() {\n return this.e2;\n }\n\n get 3() {\n return this.e3;\n }\n\n set 0(value: S) {\n this.e0 = this.castElement()(value);\n }\n\n set 1(value: S) {\n this.e1 = this.castElement()(value);\n }\n\n set 2(value: S) {\n this.e2 = this.castElement()(value);\n }\n\n set 3(value: S) {\n this.e3 = this.castElement()(value);\n }\n\n get x() {\n return this[0];\n }\n\n get y() {\n return this[1];\n }\n\n get z() {\n return this[2];\n }\n\n get w() {\n return this[3];\n }\n\n set x(value: S) {\n this[0] = value;\n }\n\n set y(value: S) {\n this[1] = value;\n }\n\n set z(value: S) {\n this[2] = value;\n }\n\n set w(value: S) {\n this[3] = value;\n }\n}\n\nexport class Vec2fImpl extends Vec2<number> {\n get [$internal]() {\n return {\n elementSchema: f32,\n };\n }\n\n get kind() {\n return 'vec2f' as const;\n }\n\n get _Vec2() {\n return Vec2fImpl;\n }\n get _Vec3() {\n return Vec3fImpl;\n }\n get _Vec4() {\n return Vec4fImpl;\n }\n}\n\nexport class Vec2hImpl extends Vec2<number> {\n get [$internal]() {\n return {\n elementSchema: f16,\n };\n }\n\n get kind() {\n return 'vec2h' as const;\n }\n\n get _Vec2() {\n return Vec2hImpl;\n }\n get _Vec3() {\n return Vec3hImpl;\n }\n get _Vec4() {\n return Vec4hImpl;\n }\n}\n\nexport class Vec2iImpl extends Vec2<number> {\n get [$internal]() {\n return {\n elementSchema: i32,\n };\n }\n\n get kind() {\n return 'vec2i' as const;\n }\n\n get _Vec2() {\n return Vec2iImpl;\n }\n get _Vec3() {\n return Vec3iImpl;\n }\n get _Vec4() {\n return Vec4iImpl;\n }\n}\n\nexport class Vec2uImpl extends Vec2<number> {\n get [$internal]() {\n return {\n elementSchema: u32,\n };\n }\n\n get kind() {\n return 'vec2u' as const;\n }\n\n get _Vec2() {\n return Vec2uImpl;\n }\n get _Vec3() {\n return Vec3uImpl;\n }\n get _Vec4() {\n return Vec4uImpl;\n }\n}\n\nexport class Vec2bImpl extends Vec2<boolean> {\n get [$internal]() {\n return {\n elementSchema: bool,\n };\n }\n\n get kind() {\n return 'vec2<bool>' as const;\n }\n\n get _Vec2() {\n return Vec2bImpl;\n }\n get _Vec3() {\n return Vec3bImpl;\n }\n get _Vec4() {\n return Vec4bImpl;\n }\n}\n\nexport class Vec3fImpl extends Vec3<number> {\n get [$internal]() {\n return {\n elementSchema: f32,\n };\n }\n\n get kind() {\n return 'vec3f' as const;\n }\n\n get _Vec2() {\n return Vec2fImpl;\n }\n get _Vec3() {\n return Vec3fImpl;\n }\n get _Vec4() {\n return Vec4fImpl;\n }\n}\n\nexport class Vec3hImpl extends Vec3<number> {\n get [$internal]() {\n return {\n elementSchema: f16,\n };\n }\n\n get kind() {\n return 'vec3h' as const;\n }\n\n get _Vec2() {\n return Vec2hImpl;\n }\n get _Vec3() {\n return Vec3hImpl;\n }\n get _Vec4() {\n return Vec4hImpl;\n }\n}\n\nexport class Vec3iImpl extends Vec3<number> {\n get [$internal]() {\n return {\n elementSchema: i32,\n };\n }\n\n get kind() {\n return 'vec3i' as const;\n }\n\n get _Vec2() {\n return Vec2iImpl;\n }\n get _Vec3() {\n return Vec3iImpl;\n }\n get _Vec4() {\n return Vec4iImpl;\n }\n}\n\nexport class Vec3uImpl extends Vec3<number> {\n get [$internal]() {\n return {\n elementSchema: u32,\n };\n }\n\n get kind() {\n return 'vec3u' as const;\n }\n\n get _Vec2() {\n return Vec2uImpl;\n }\n get _Vec3() {\n return Vec3uImpl;\n }\n get _Vec4() {\n return Vec4uImpl;\n }\n}\n\nexport class Vec3bImpl extends Vec3<boolean> {\n get [$internal]() {\n return {\n elementSchema: bool,\n };\n }\n\n get kind() {\n return 'vec3<bool>' as const;\n }\n\n get _Vec2() {\n return Vec2bImpl;\n }\n get _Vec3() {\n return Vec3bImpl;\n }\n get _Vec4() {\n return Vec4bImpl;\n }\n}\n\nexport class Vec4fImpl extends Vec4<number> {\n get [$internal]() {\n return {\n elementSchema: f32,\n };\n }\n\n get kind() {\n return 'vec4f' as const;\n }\n\n get _Vec2() {\n return Vec2fImpl;\n }\n get _Vec3() {\n return Vec3fImpl;\n }\n get _Vec4() {\n return Vec4fImpl;\n }\n}\n\nexport class Vec4hImpl extends Vec4<number> {\n get [$internal]() {\n return {\n elementSchema: f16,\n };\n }\n\n get kind() {\n return 'vec4h' as const;\n }\n\n get _Vec2() {\n return Vec2hImpl;\n }\n get _Vec3() {\n return Vec3hImpl;\n }\n get _Vec4() {\n return Vec4hImpl;\n }\n}\n\nexport class Vec4iImpl extends Vec4<number> {\n get [$internal]() {\n return {\n elementSchema: i32,\n };\n }\n\n get kind() {\n return 'vec4i' as const;\n }\n\n get _Vec2() {\n return Vec2iImpl;\n }\n get _Vec3() {\n return Vec3iImpl;\n }\n get _Vec4() {\n return Vec4iImpl;\n }\n}\n\nexport class Vec4uImpl extends Vec4<number> {\n get [$internal]() {\n return {\n elementSchema: u32,\n };\n }\n\n get kind() {\n return 'vec4u' as const;\n }\n\n get _Vec2() {\n return Vec2uImpl;\n }\n get _Vec3() {\n return Vec3uImpl;\n }\n get _Vec4() {\n return Vec4uImpl;\n }\n}\n\nexport class Vec4bImpl extends Vec4<boolean> {\n get [$internal]() {\n return {\n elementSchema: bool,\n };\n }\n\n get kind() {\n return 'vec4<bool>' as const;\n }\n\n get _Vec2() {\n return Vec2bImpl;\n }\n get _Vec3() {\n return Vec3bImpl;\n }\n get _Vec4() {\n return Vec4bImpl;\n }\n}\n"]}
|
package/chunk-ZYGTVBDH.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8;var _chunkTRE7NUKEcjs = require('./chunk-TRE7NUKE.cjs');var Qe=class{};function Wt(e){let t=_chunkTRE7NUKEcjs.La.call(void 0, (...r)=>{let a=[];for(let s of r)if(typeof s=="number")a.push(s);else for(let i=0;i<s.length;++i)a.push(s[i]);if(a.length!==0&&a.length!==e.columns*e.rows)throw new Error(`'${e.type}' constructor called with invalid number of arguments.`);for(let s=a.length;s<e.columns*e.rows;++s)a.push(0);return new e.MatImpl(...a)},(...r)=>_chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`${e.type}(${r})`,n),e.type),n=Object.assign(t,{type:e.type,identity:fn[e.columns],translation:e.columns===4?gn:void 0,scaling:e.columns===4?hn:void 0,rotationX:e.columns===4?vn:void 0,rotationY:e.columns===4?bn:void 0,rotationZ:e.columns===4?wn:void 0});return n}var zt= (_class =class extends Qe{__init() {this[_chunkTRE7NUKEcjs.a]=!0}__init2() {this.length=4}constructor(...t){super();_class.prototype.__init.call(this);_class.prototype.__init2.call(this);,this.columns=[this.makeColumn(t[0],t[1]),this.makeColumn(t[2],t[3])]}get 0(){return this.columns[0].x}get 1(){return this.columns[0].y}get 2(){return this.columns[1].x}get 3(){return this.columns[1].y}set 0(t){this.columns[0].x=t}set 1(t){this.columns[0].y=t}set 2(t){this.columns[1].x=t}set 3(t){this.columns[1].y=t}*[Symbol.iterator](){yield this[0],yield this[1],yield this[2],yield this[3]}[_chunkTRE7NUKEcjs.f](){return _chunkTRE7NUKEcjs.aa.call(void 0, `${this.kind}(${Array.from({length:this.length}).map((t,n)=>this[n]).join(", ")})`,ie)}toString(){return this[_chunkTRE7NUKEcjs.f]().value}}, _class),Vt= (_class2 =class extends zt{constructor(...args) { super(...args); _class2.prototype.__init3.call(this); }__init3() {this.kind="mat2x2f"}makeColumn(t,n){return _chunkTRE7NUKEcjs.Xa.call(void 0, t,n)}}, _class2),Ft= (_class3 =class extends Qe{__init4() {this[_chunkTRE7NUKEcjs.a]=!0}__init5() {this.length=12}constructor(...t){super();_class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);,this.columns=[this.makeColumn(t[0],t[1],t[2]),this.makeColumn(t[3],t[4],t[5]),this.makeColumn(t[6],t[7],t[8])]}get 0(){return this.columns[0].x}get 1(){return this.columns[0].y}get 2(){return this.columns[0].z}get 3(){return 0}get 4(){return this.columns[1].x}get 5(){return this.columns[1].y}get 6(){return this.columns[1].z}get 7(){return 0}get 8(){return this.columns[2].x}get 9(){return this.columns[2].y}get 10(){return this.columns[2].z}get 11(){return 0}set 0(t){this.columns[0].x=t}set 1(t){this.columns[0].y=t}set 2(t){this.columns[0].z=t}set 3(t){}set 4(t){this.columns[1].x=t}set 5(t){this.columns[1].y=t}set 6(t){this.columns[1].z=t}set 7(t){}set 8(t){this.columns[2].x=t}set 9(t){this.columns[2].y=t}set 10(t){this.columns[2].z=t}set 11(t){}*[Symbol.iterator](){for(let t=0;t<12;t++)yield this[t]}[_chunkTRE7NUKEcjs.f](){return _chunkTRE7NUKEcjs.aa.call(void 0, `${this.kind}(${this[0]}, ${this[1]}, ${this[2]}, ${this[4]}, ${this[5]}, ${this[6]}, ${this[8]}, ${this[9]}, ${this[10]})`,le)}toString(){return this[_chunkTRE7NUKEcjs.f]().value}}, _class3),Ct= (_class4 =class extends Ft{constructor(...args2) { super(...args2); _class4.prototype.__init6.call(this); }__init6() {this.kind="mat3x3f"}makeColumn(t,n,r){return _chunkTRE7NUKEcjs.ab.call(void 0, t,n,r)}}, _class4),Pt= (_class5 =class extends Qe{__init7() {this[_chunkTRE7NUKEcjs.a]=!0}constructor(...t){super();_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);,this.columns=[this.makeColumn(t[0],t[1],t[2],t[3]),this.makeColumn(t[4],t[5],t[6],t[7]),this.makeColumn(t[8],t[9],t[10],t[11]),this.makeColumn(t[12],t[13],t[14],t[15])]}__init8() {this.length=16}get 0(){return this.columns[0].x}get 1(){return this.columns[0].y}get 2(){return this.columns[0].z}get 3(){return this.columns[0].w}get 4(){return this.columns[1].x}get 5(){return this.columns[1].y}get 6(){return this.columns[1].z}get 7(){return this.columns[1].w}get 8(){return this.columns[2].x}get 9(){return this.columns[2].y}get 10(){return this.columns[2].z}get 11(){return this.columns[2].w}get 12(){return this.columns[3].x}get 13(){return this.columns[3].y}get 14(){return this.columns[3].z}get 15(){return this.columns[3].w}set 0(t){this.columns[0].x=t}set 1(t){this.columns[0].y=t}set 2(t){this.columns[0].z=t}set 3(t){this.columns[0].w=t}set 4(t){this.columns[1].x=t}set 5(t){this.columns[1].y=t}set 6(t){this.columns[1].z=t}set 7(t){this.columns[1].w=t}set 8(t){this.columns[2].x=t}set 9(t){this.columns[2].y=t}set 10(t){this.columns[2].z=t}set 11(t){this.columns[2].w=t}set 12(t){this.columns[3].x=t}set 13(t){this.columns[3].y=t}set 14(t){this.columns[3].z=t}set 15(t){this.columns[3].w=t}*[Symbol.iterator](){for(let t=0;t<16;t++)yield this[t]}[_chunkTRE7NUKEcjs.f](){return _chunkTRE7NUKEcjs.aa.call(void 0, `${this.kind}(${Array.from({length:this.length}).map((t,n)=>this[n]).join(", ")})`,A)}toString(){return this[_chunkTRE7NUKEcjs.f]().value}}, _class5),kt= (_class6 =class extends Pt{constructor(...args3) { super(...args3); _class6.prototype.__init9.call(this); }__init9() {this.kind="mat4x4f"}makeColumn(t,n,r,a){return _chunkTRE7NUKEcjs.fb.call(void 0, t,n,r,a)}}, _class6),Tn= exports.b =_chunkTRE7NUKEcjs.La.call(void 0, ()=>ie(1,0,0,1),()=>_chunkTRE7NUKEcjs.aa.call(void 0, "mat2x2f(1, 0, 0, 1)",ie),"identity2"),xn= exports.c =_chunkTRE7NUKEcjs.La.call(void 0, ()=>le(1,0,0,0,1,0,0,0,1),()=>_chunkTRE7NUKEcjs.aa.call(void 0, "mat3x3f(1, 0, 0, 0, 1, 0, 0, 0, 1)",le),"identity3"),dn= exports.d =_chunkTRE7NUKEcjs.La.call(void 0, ()=>A(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),()=>_chunkTRE7NUKEcjs.aa.call(void 0, "mat4x4f(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)",A),"identity4"),fn={2:Tn,3:xn,4:dn},gn= exports.e =_chunkTRE7NUKEcjs.La.call(void 0, e=>A(1,0,0,0,0,1,0,0,0,0,1,0,e.x,e.y,e.z,1),e=>_chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`mat4x4f(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, ${e}.x, ${e}.y, ${e}.z, 1)`,A),"translation4"),hn= exports.f =_chunkTRE7NUKEcjs.La.call(void 0, e=>A(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1),e=>_chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`mat4x4f(${e}.x, 0, 0, 0, 0, ${e}.y, 0, 0, 0, 0, ${e}.z, 0, 0, 0, 0, 1)`,A),"scaling4"),vn= exports.g =_chunkTRE7NUKEcjs.La.call(void 0, e=>A(1,0,0,0,0,Math.cos(e),Math.sin(e),0,0,-Math.sin(e),Math.cos(e),0,0,0,0,1),e=>_chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`mat4x4f(1, 0, 0, 0, 0, cos(${e}), sin(${e}), 0, 0, -sin(${e}), cos(${e}), 0, 0, 0, 0, 1)`,A),"rotationX4"),bn= exports.h =_chunkTRE7NUKEcjs.La.call(void 0, e=>A(Math.cos(e),0,-Math.sin(e),0,0,1,0,0,Math.sin(e),0,Math.cos(e),0,0,0,0,1),e=>_chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`mat4x4f(cos(${e}), 0, -sin(${e}), 0, 0, 1, 0, 0, sin(${e}), 0, cos(${e}), 0, 0, 0, 0, 1)`,A),"rotationY4"),wn= exports.i =_chunkTRE7NUKEcjs.La.call(void 0, e=>A(Math.cos(e),Math.sin(e),0,0,-Math.sin(e),Math.cos(e),0,0,0,0,1,0,0,0,0,1),e=>_chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`mat4x4f(cos(${e}), sin(${e}), 0, 0, -sin(${e}), cos(${e}), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)`,A),"rotationZ4"),ie= exports.j =Wt({type:"mat2x2f",rows:2,columns:2,MatImpl:Vt}),le= exports.k =Wt({type:"mat3x3f",rows:3,columns:3,MatImpl:Ct}),A= exports.l =Wt({type:"mat4x4f",rows:4,columns:4,MatImpl:kt});function Hr(e){return e.kind==="mat3x3f"?[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]]:Array.from({length:e.length}).map((t,n)=>e[n])}function en(e){return _optionalChain([e, 'optionalAccess', _2 => _2[_chunkTRE7NUKEcjs.b]])}var Sn={f:{1:_chunkTRE7NUKEcjs.Ua,2:_chunkTRE7NUKEcjs.Xa,3:_chunkTRE7NUKEcjs.ab,4:_chunkTRE7NUKEcjs.fb},h:{1:_chunkTRE7NUKEcjs.Va,2:_chunkTRE7NUKEcjs.Ya,3:_chunkTRE7NUKEcjs.bb,4:_chunkTRE7NUKEcjs.gb},i:{1:_chunkTRE7NUKEcjs.Ta,2:_chunkTRE7NUKEcjs.Za,3:_chunkTRE7NUKEcjs.cb,4:_chunkTRE7NUKEcjs.hb},u:{1:_chunkTRE7NUKEcjs.Ra,2:_chunkTRE7NUKEcjs._a,3:_chunkTRE7NUKEcjs.db,4:_chunkTRE7NUKEcjs.ib},b:{1:_chunkTRE7NUKEcjs.Qa,2:_chunkTRE7NUKEcjs.$a,3:_chunkTRE7NUKEcjs.eb,4:_chunkTRE7NUKEcjs.jb}},Mn={vec2f:_chunkTRE7NUKEcjs.Xa,vec2h:_chunkTRE7NUKEcjs.Ya,vec2i:_chunkTRE7NUKEcjs.Za,vec2u:_chunkTRE7NUKEcjs._a,"vec2<bool>":_chunkTRE7NUKEcjs.$a,vec3f:_chunkTRE7NUKEcjs.ab,vec3h:_chunkTRE7NUKEcjs.bb,vec3i:_chunkTRE7NUKEcjs.cb,vec3u:_chunkTRE7NUKEcjs.db,"vec3<bool>":_chunkTRE7NUKEcjs.eb,vec4f:_chunkTRE7NUKEcjs.fb,vec4h:_chunkTRE7NUKEcjs.gb,vec4i:_chunkTRE7NUKEcjs.hb,vec4u:_chunkTRE7NUKEcjs.ib,"vec4<bool>":_chunkTRE7NUKEcjs.jb,mat2x2f:ie,mat3x3f:le,mat4x4f:A};function Xe(e,t){if(_chunkTRE7NUKEcjs.D.call(void 0, e)||_chunkTRE7NUKEcjs.S.call(void 0, e))return _nullishCoalesce(e.propTypes[t], () => (_chunkTRE7NUKEcjs.W));if(e===_chunkTRE7NUKEcjs.Qa||_chunkTRE7NUKEcjs.N.call(void 0, e))return _chunkTRE7NUKEcjs.W;let n=t.length;if(_chunkTRE7NUKEcjs.v.call(void 0, e)&&n>=1&&n<=4){let r=e.type.includes("bool")?"b":e.type[4],a=Sn[r][n];if(a)return a}return _chunkTRE7NUKEcjs.W}var tn={mat2x2f:_chunkTRE7NUKEcjs.Xa,mat3x3f:_chunkTRE7NUKEcjs.ab,mat4x4f:_chunkTRE7NUKEcjs.fb};function mt(e){return _chunkTRE7NUKEcjs.C.call(void 0, e)||_chunkTRE7NUKEcjs.R.call(void 0, e)?e.elementType:_chunkTRE7NUKEcjs.v.call(void 0, e)?e.primitive:e.type in tn?tn[e.type]:_chunkTRE7NUKEcjs.W}function pt(e){return e>=2**63||e<-(2**63)?_chunkTRE7NUKEcjs.aa.call(void 0, e,_chunkTRE7NUKEcjs.Pa):Number.isInteger(e)?(Number.isSafeInteger(e)||console.warn(`The integer ${e} exceeds the safe integer range and may have lost precision.`),_chunkTRE7NUKEcjs.aa.call(void 0, e,_chunkTRE7NUKEcjs.Oa)):_chunkTRE7NUKEcjs.aa.call(void 0, e,_chunkTRE7NUKEcjs.Pa)}function yt(e){return e.type==="abstractFloat"?_chunkTRE7NUKEcjs.Ua:e.type==="abstractInt"?_chunkTRE7NUKEcjs.Ta:e}function os(e){return e.map(t=>_chunkTRE7NUKEcjs.aa.call(void 0, t.value,yt(t.dataType)))}function Tt(e){if(_chunkTRE7NUKEcjs._.call(void 0, e))return e;let t=_chunkTRE7NUKEcjs.ua.call(void 0, e);return t||(_chunkTRE7NUKEcjs.r.call(void 0, e)||_chunkTRE7NUKEcjs.w.call(void 0, e)?_chunkTRE7NUKEcjs.aa.call(void 0, e,Mn[e.kind]):typeof e=="string"||typeof e=="function"||typeof e=="object"||typeof e=="symbol"||typeof e>"u"||e===null?_chunkTRE7NUKEcjs.aa.call(void 0, e,_chunkTRE7NUKEcjs.W):typeof e=="number"?pt(e):typeof e=="boolean"?_chunkTRE7NUKEcjs.aa.call(void 0, e,_chunkTRE7NUKEcjs.Qa):_chunkTRE7NUKEcjs.aa.call(void 0, e,_chunkTRE7NUKEcjs.W))}var _t={get(e,t){if(t in e)return Reflect.get(e,t);if(t==="toString"||t===Symbol.toStringTag||t===Symbol.toPrimitive)return()=>e.toString();if(typeof t=="symbol")return;let r=_chunkTRE7NUKEcjs.ua.call(void 0, e).dataType,a=Xe(r,String(t));if(a.type!=="unknown")return new Proxy({[_chunkTRE7NUKEcjs.a]:!0,[_chunkTRE7NUKEcjs.f]:s=>_chunkTRE7NUKEcjs.aa.call(void 0, `${s.resolve(e).value}.${String(t)}`,a),get[_chunkTRE7NUKEcjs.e](){return _chunkTRE7NUKEcjs.aa.call(void 0, this,a)},toString:()=>`${String(e)}.${t}`},_t)}};function ys(e){let t=e;for(;;){let n=en(t);if(!n)break;t=n}return t}function nn(e,t){return new Ut(e,t)}var Ut= (_class7 =class{constructor(t,n){;_class7.prototype.__init10.call(this);this.dataType=t;this.#e=n}__init10() {this[_chunkTRE7NUKEcjs.a]={}}#e;$name(t){return _chunkTRE7NUKEcjs.k.call(void 0, this,t),this}[_chunkTRE7NUKEcjs.f](t){let n=t.getUniqueName(this),r=t.resolve(this.dataType).value,a=t.resolve(this.#e,this.dataType).value;return t.addDeclaration(`const ${n}: ${r} = ${a};`),_chunkTRE7NUKEcjs.aa.call(void 0, n,this.dataType)}toString(){return`const:${_nullishCoalesce(_chunkTRE7NUKEcjs.j.call(void 0, this), () => ("<unnamed>"))}`}get[_chunkTRE7NUKEcjs.b](){let t=this.dataType;return new Proxy({[_chunkTRE7NUKEcjs.a]:!0,get[_chunkTRE7NUKEcjs.e](){return _chunkTRE7NUKEcjs.aa.call(void 0, this,t)},[_chunkTRE7NUKEcjs.f]:n=>n.resolve(this),toString:()=>`const:${_nullishCoalesce(_chunkTRE7NUKEcjs.j.call(void 0, this), () => ("<unnamed>"))}.$`},_t)}get value(){return _chunkTRE7NUKEcjs.Da.call(void 0, )?this[_chunkTRE7NUKEcjs.b]:this.#e}get $(){return this.value}}, _class7);function ws(){return{[_chunkTRE7NUKEcjs.a]:!0,type:"sampler",[_chunkTRE7NUKEcjs.g]:void 0}}function Ss(){return{[_chunkTRE7NUKEcjs.a]:!0,type:"sampler_comparison",[_chunkTRE7NUKEcjs.g]:void 0}}function Ms(e){return!!e[_chunkTRE7NUKEcjs.a]&&e.type==="sampler"}function Is(e){return!!e[_chunkTRE7NUKEcjs.a]&&e.type==="sampler_comparison"}function Vs(e){if("multisampled"in e){if(e.multisampled){if(e.dimension==="2d")return $n(e.sampleType);throw new Error(`Multisampled textures only support '2d' dimension, got '${e.dimension}'`)}switch(e.dimension){case"1d":return In(e.sampleType);case"2d":return An(e.sampleType);case"2d-array":return zn(e.sampleType);case"3d":return Cn(e.sampleType);case"cube":return Vn(e.sampleType);case"cube-array":return Fn(e.sampleType);default:throw new Error(`Unsupported texture dimension: '${e.dimension}'`)}}if(!("access"in e))throw new Error("Descriptor is neither a sampled nor a storage texture");switch(e.dimension){case"1d":return Pn(e.format,e.access);case"2d":return kn(e.format,e.access);case"2d-array":return Wn(e.format,e.access);case"3d":return _n(e.format,e.access);default:throw new Error(`Unsupported storage texture dimension: '${e.dimension}'`)}}function L(e,t){let r=e.startsWith("texture_depth")?["depth","float","unfilterable-float"]:t.sampleType.type==="i32"?["sint"]:t.sampleType.type==="u32"?["uint"]:["float","unfilterable-float"];return{[_chunkTRE7NUKEcjs.a]:!0,[_chunkTRE7NUKEcjs.g]:void 0,type:e,bindingSampleType:r,...t}}function xt(e,t){return{[_chunkTRE7NUKEcjs.a]:!0,[_chunkTRE7NUKEcjs.g]:void 0,type:e,...t}}var rn=new Map,dt= exports.z ={"write-only":"write","read-only":"read","read-write":"read_write"};function $(e,t){let n=rn.get(e);return n||(n=t(),rn.set(e,n)),n}function In(e){let t=e||_chunkTRE7NUKEcjs.Ua,n=`texture_1d<${t.type}>`;return $(n,()=>L("texture_1d",{dimension:"1d",sampleType:t,multisampled:!1}))}function An(e){let t=e||_chunkTRE7NUKEcjs.Ua,n=`texture_2d<${t.type}>`;return $(n,()=>L("texture_2d",{dimension:"2d",sampleType:t,multisampled:!1}))}function $n(e){let t=e||_chunkTRE7NUKEcjs.Ua,n=`texture_multisampled_2d<${t.type}>`;return $(n,()=>L("texture_multisampled_2d",{dimension:"2d",sampleType:t,multisampled:!0}))}function zn(e){let t=e||_chunkTRE7NUKEcjs.Ua,n=`texture_2d_array<${t.type}>`;return $(n,()=>L("texture_2d_array",{dimension:"2d-array",sampleType:t,multisampled:!1}))}function Vn(e){let t=e||_chunkTRE7NUKEcjs.Ua,n=`texture_cube<${t.type}>`;return $(n,()=>L("texture_cube",{dimension:"cube",sampleType:t,multisampled:!1}))}function Fn(e){let t=e||_chunkTRE7NUKEcjs.Ua,n=`texture_cube_array<${t.type}>`;return $(n,()=>L("texture_cube_array",{dimension:"cube-array",sampleType:t,multisampled:!1}))}function Cn(e){let t=e||_chunkTRE7NUKEcjs.Ua,n=`texture_3d<${t.type}>`;return $(n,()=>L("texture_3d",{dimension:"3d",sampleType:t,multisampled:!1}))}function Pn(e,t){let n=t||"write-only",r=`texture_storage_1d<${e}, ${dt[n]}>`;return $(r,()=>xt("texture_storage_1d",{dimension:"1d",format:e,access:n}))}function kn(e,t){let n=t||"write-only",r=`texture_storage_2d<${e}, ${dt[n]}>`;return $(r,()=>xt("texture_storage_2d",{dimension:"2d",format:e,access:n}))}function Wn(e,t){let n=t||"write-only",r=`texture_storage_2d_array<${e}, ${dt[n]}>`;return $(r,()=>xt("texture_storage_2d_array",{dimension:"2d-array",format:e,access:n}))}function _n(e,t){let n=t||"write-only",r=`texture_storage_3d<${e}, ${dt[n]}>`;return $(r,()=>xt("texture_storage_3d",{dimension:"3d",format:e,access:n}))}function Fs(){return $("texture_depth_2d",()=>L("texture_depth_2d",{dimension:"2d",sampleType:_chunkTRE7NUKEcjs.Ua,multisampled:!1}))}function Cs(){return $("texture_depth_multisampled_2d",()=>L("texture_depth_multisampled_2d",{dimension:"2d",sampleType:_chunkTRE7NUKEcjs.Ua,multisampled:!0}))}function Ps(){return $("texture_depth_2d_array",()=>L("texture_depth_2d_array",{dimension:"2d-array",sampleType:_chunkTRE7NUKEcjs.Ua,multisampled:!1}))}function ks(){return $("texture_depth_cube",()=>L("texture_depth_cube",{dimension:"cube",sampleType:_chunkTRE7NUKEcjs.Ua,multisampled:!1}))}function Ws(){return $("texture_depth_cube_array",()=>L("texture_depth_cube_array",{dimension:"cube-array",sampleType:_chunkTRE7NUKEcjs.Ua,multisampled:!1}))}function _s(){return $("texture_external",()=>({[_chunkTRE7NUKEcjs.a]:!0,[_chunkTRE7NUKEcjs.g]:void 0,type:"texture_external",dimension:"2d"}))}function Us(e){return!!e[_chunkTRE7NUKEcjs.a]&&typeof e.multisampled=="boolean"}function Ds(e){return!!e[_chunkTRE7NUKEcjs.a]&&typeof e.format=="string"&&typeof e.access=="string"}function Gs(e){return new Dt(e)}var Dt= (_class8 =class{constructor(t){;_class8.prototype.__init11.call(this);_class8.prototype.__init12.call(this);this.inner=t}__init11() {this[_chunkTRE7NUKEcjs.a]=!0}__init12() {this.type="atomic"}}, _class8);var me=(e,t,n)=>{if(e===t)return 0;let r=y((n-e)/(t-e),0,1);return r*r*(3-2*r)},y=(e,t,n)=>Math.min(Math.max(t,e),n),he=(e,t)=>t===0?e:Math.trunc(e/t);function Y(e){let t=new DataView(new ArrayBuffer(4));return t.setUint32(0,e,!0),t.getFloat32(0,!0)}function J(e){let t=new DataView(new ArrayBuffer(4));return t.setUint32(0,e,!0),t.getInt32(0,!0)}var N=_chunkTRE7NUKEcjs.$a[_chunkTRE7NUKEcjs.a].jsImpl,q=_chunkTRE7NUKEcjs.Xa[_chunkTRE7NUKEcjs.a].jsImpl,ye=_chunkTRE7NUKEcjs.Ya[_chunkTRE7NUKEcjs.a].jsImpl,Ue=_chunkTRE7NUKEcjs.Za[_chunkTRE7NUKEcjs.a].jsImpl,tt=_chunkTRE7NUKEcjs._a[_chunkTRE7NUKEcjs.a].jsImpl,O=_chunkTRE7NUKEcjs.eb[_chunkTRE7NUKEcjs.a].jsImpl,_=_chunkTRE7NUKEcjs.ab[_chunkTRE7NUKEcjs.a].jsImpl,ee=_chunkTRE7NUKEcjs.bb[_chunkTRE7NUKEcjs.a].jsImpl,De=_chunkTRE7NUKEcjs.cb[_chunkTRE7NUKEcjs.a].jsImpl,nt=_chunkTRE7NUKEcjs.db[_chunkTRE7NUKEcjs.a].jsImpl,K=_chunkTRE7NUKEcjs.jb[_chunkTRE7NUKEcjs.a].jsImpl,j=_chunkTRE7NUKEcjs.fb[_chunkTRE7NUKEcjs.a].jsImpl,Te=_chunkTRE7NUKEcjs.gb[_chunkTRE7NUKEcjs.a].jsImpl,Be=_chunkTRE7NUKEcjs.hb[_chunkTRE7NUKEcjs.a].jsImpl,rt=_chunkTRE7NUKEcjs.ib[_chunkTRE7NUKEcjs.a].jsImpl,Me=e=>Math.sqrt(e.x**2+e.y**2),Ie=e=>Math.sqrt(e.x**2+e.y**2+e.z**2),Ae=e=>Math.sqrt(e.x**2+e.y**2+e.z**2+e.w**2),ft=(e,t)=>e.x*t.x+e.y*t.y,gt=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z,ht=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,h=e=>t=>q(e(t.x),e(t.y)),b=e=>t=>ye(e(t.x),e(t.y)),$e=e=>t=>Ue(e(t.x),e(t.y)),Ye=e=>t=>tt(e(t.x),e(t.y)),f=e=>t=>_(e(t.x),e(t.y),e(t.z)),w=e=>t=>ee(e(t.x),e(t.y),e(t.z)),ze=e=>t=>De(e(t.x),e(t.y),e(t.z)),Je=e=>t=>nt(e(t.x),e(t.y),e(t.z)),x=e=>t=>j(e(t.x),e(t.y),e(t.z),e(t.w)),S=e=>t=>Te(e(t.x),e(t.y),e(t.z),e(t.w)),Ve=e=>t=>Be(e(t.x),e(t.y),e(t.z),e(t.w)),et=e=>t=>rt(e(t.x),e(t.y),e(t.z),e(t.w)),sn=e=>t=>{let n=t.columns;return ie(h(e)(n[0]),h(e)(n[1]))},an=e=>t=>{let n=t.columns;return le(f(e)(n[0]),f(e)(n[1]),f(e)(n[2]))},on=e=>t=>{let n=t.columns;return A(x(e)(n[0]),x(e)(n[1]),x(e)(n[2]),x(e)(n[3]))},pe=e=>(t,n)=>q(e(t.x,n.x),e(t.y,n.y)),ve=e=>(t,n)=>ye(e(t.x,n.x),e(t.y,n.y)),Fe=e=>(t,n)=>Ue(e(t.x,n.x),e(t.y,n.y)),Ce=e=>(t,n)=>tt(e(t.x,n.x),e(t.y,n.y)),te=e=>(t,n)=>_(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),be=e=>(t,n)=>ee(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),Pe=e=>(t,n)=>De(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ke=e=>(t,n)=>nt(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),X=e=>(t,n)=>j(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),we=e=>(t,n)=>Te(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),We=e=>(t,n)=>Be(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),_e=e=>(t,n)=>rt(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),Un=e=>(t,n)=>{let r=t.columns,a=n.columns;return ie(pe(e)(r[0],a[0]),pe(e)(r[1],a[1]))},Dn=e=>(t,n)=>{let r=t.columns,a=n.columns;return le(te(e)(r[0],a[0]),te(e)(r[1],a[1]),te(e)(r[2],a[2]))},Bn=e=>(t,n)=>{let r=t.columns,a=n.columns;return A(X(e)(r[0],a[0]),X(e)(r[1],a[1]),X(e)(r[2],a[2]),X(e)(r[3],a[3]))},Rn=e=>(t,n,r)=>q(e(t.x,n.x,r.x),e(t.y,n.y,r.y)),Gn=e=>(t,n,r)=>ye(e(t.x,n.x,r.x),e(t.y,n.y,r.y)),En=e=>(t,n,r)=>_(e(t.x,n.x,r.x),e(t.y,n.y,r.y),e(t.z,n.z,r.z)),Ln=e=>(t,n,r)=>ee(e(t.x,n.x,r.x),e(t.y,n.y,r.y),e(t.z,n.z,r.z)),Nn=e=>(t,n,r)=>j(e(t.x,n.x,r.x),e(t.y,n.y,r.y),e(t.z,n.z,r.z),e(t.w,n.w,r.w)),On=e=>(t,n,r)=>Te(e(t.x,n.x,r.x),e(t.y,n.y,r.y),e(t.z,n.z,r.z),e(t.w,n.w,r.w)),m= exports.W ={eq:{vec2f:(e,t)=>N(e.x===t.x,e.y===t.y),vec2h:(e,t)=>N(e.x===t.x,e.y===t.y),vec2i:(e,t)=>N(e.x===t.x,e.y===t.y),vec2u:(e,t)=>N(e.x===t.x,e.y===t.y),"vec2<bool>":(e,t)=>N(e.x===t.x,e.y===t.y),vec3f:(e,t)=>O(e.x===t.x,e.y===t.y,e.z===t.z),vec3h:(e,t)=>O(e.x===t.x,e.y===t.y,e.z===t.z),vec3i:(e,t)=>O(e.x===t.x,e.y===t.y,e.z===t.z),vec3u:(e,t)=>O(e.x===t.x,e.y===t.y,e.z===t.z),"vec3<bool>":(e,t)=>O(e.x===t.x,e.y===t.y,e.z===t.z),vec4f:(e,t)=>K(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4h:(e,t)=>K(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4i:(e,t)=>K(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4u:(e,t)=>K(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),"vec4<bool>":(e,t)=>K(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w)},lt:{vec2f:(e,t)=>N(e.x<t.x,e.y<t.y),vec2h:(e,t)=>N(e.x<t.x,e.y<t.y),vec2i:(e,t)=>N(e.x<t.x,e.y<t.y),vec2u:(e,t)=>N(e.x<t.x,e.y<t.y),vec3f:(e,t)=>O(e.x<t.x,e.y<t.y,e.z<t.z),vec3h:(e,t)=>O(e.x<t.x,e.y<t.y,e.z<t.z),vec3i:(e,t)=>O(e.x<t.x,e.y<t.y,e.z<t.z),vec3u:(e,t)=>O(e.x<t.x,e.y<t.y,e.z<t.z),vec4f:(e,t)=>K(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4h:(e,t)=>K(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4i:(e,t)=>K(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4u:(e,t)=>K(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w)},or:{"vec2<bool>":(e,t)=>N(e.x||t.x,e.y||t.y),"vec3<bool>":(e,t)=>O(e.x||t.x,e.y||t.y,e.z||t.z),"vec4<bool>":(e,t)=>K(e.x||t.x,e.y||t.y,e.z||t.z,e.w||t.w)},all:{"vec2<bool>":e=>e.x&&e.y,"vec3<bool>":e=>e.x&&e.y&&e.z,"vec4<bool>":e=>e.x&&e.y&&e.z&&e.w},abs:{vec2f:h(Math.abs),vec2h:b(Math.abs),vec2i:$e(Math.abs),vec2u:Ye(Math.abs),vec3f:f(Math.abs),vec3h:w(Math.abs),vec3i:ze(Math.abs),vec3u:Je(Math.abs),vec4f:x(Math.abs),vec4h:S(Math.abs),vec4i:Ve(Math.abs),vec4u:et(Math.abs)},atan2:{vec2f:pe(Math.atan2),vec2h:ve(Math.atan2),vec3f:te(Math.atan2),vec3h:be(Math.atan2),vec4f:X(Math.atan2),vec4h:we(Math.atan2)},acos:{vec2f:h(Math.acos),vec2h:b(Math.acos),vec2i:$e(Math.acos),vec2u:Ye(Math.acos),vec3f:f(Math.acos),vec3h:w(Math.acos),vec3i:ze(Math.acos),vec3u:Je(Math.acos),vec4f:x(Math.acos),vec4h:S(Math.acos),vec4i:Ve(Math.acos),vec4u:et(Math.acos)},acosh:{vec2f:h(Math.acosh),vec2h:b(Math.acosh),vec3f:f(Math.acosh),vec3h:w(Math.acosh),vec4f:x(Math.acosh),vec4h:S(Math.acosh)},asin:{vec2f:h(Math.asin),vec2h:b(Math.asin),vec3f:f(Math.asin),vec3h:w(Math.asin),vec4f:x(Math.asin),vec4h:S(Math.asin)},asinh:{vec2f:h(Math.asinh),vec2h:b(Math.asinh),vec3f:f(Math.asinh),vec3h:w(Math.asinh),vec4f:x(Math.asinh),vec4h:S(Math.asinh)},atan:{vec2f:h(Math.atan),vec2h:b(Math.atan),vec3f:f(Math.atan),vec3h:w(Math.atan),vec4f:x(Math.atan),vec4h:S(Math.atan)},atanh:{vec2f:h(Math.atanh),vec2h:b(Math.atanh),vec3f:f(Math.atanh),vec3h:w(Math.atanh),vec4f:x(Math.atanh),vec4h:S(Math.atanh)},ceil:{vec2f:h(Math.ceil),vec2h:b(Math.ceil),vec3f:f(Math.ceil),vec3h:w(Math.ceil),vec4f:x(Math.ceil),vec4h:S(Math.ceil)},clamp:{vec2f:(e,t,n)=>q(y(e.x,t.x,n.x),y(e.y,t.y,n.y)),vec2h:(e,t,n)=>ye(y(e.x,t.x,n.x),y(e.y,t.y,n.y)),vec2i:(e,t,n)=>Ue(y(e.x,t.x,n.x),y(e.y,t.y,n.y)),vec2u:(e,t,n)=>tt(y(e.x,t.x,n.x),y(e.y,t.y,n.y)),vec3f:(e,t,n)=>_(y(e.x,t.x,n.x),y(e.y,t.y,n.y),y(e.z,t.z,n.z)),vec3h:(e,t,n)=>ee(y(e.x,t.x,n.x),y(e.y,t.y,n.y),y(e.z,t.z,n.z)),vec3i:(e,t,n)=>De(y(e.x,t.x,n.x),y(e.y,t.y,n.y),y(e.z,t.z,n.z)),vec3u:(e,t,n)=>nt(y(e.x,t.x,n.x),y(e.y,t.y,n.y),y(e.z,t.z,n.z)),vec4f:(e,t,n)=>j(y(e.x,t.x,n.x),y(e.y,t.y,n.y),y(e.z,t.z,n.z),y(e.w,t.w,n.w)),vec4h:(e,t,n)=>Te(y(e.x,t.x,n.x),y(e.y,t.y,n.y),y(e.z,t.z,n.z),y(e.w,t.w,n.w)),vec4i:(e,t,n)=>Be(y(e.x,t.x,n.x),y(e.y,t.y,n.y),y(e.z,t.z,n.z),y(e.w,t.w,n.w)),vec4u:(e,t,n)=>rt(y(e.x,t.x,n.x),y(e.y,t.y,n.y),y(e.z,t.z,n.z),y(e.w,t.w,n.w))},length:{vec2f:Me,vec2h:Me,vec3f:Ie,vec3h:Ie,vec4f:Ae,vec4h:Ae},add:{vec2f:pe((e,t)=>e+t),vec2h:ve((e,t)=>e+t),vec2i:Fe((e,t)=>e+t),vec2u:Ce((e,t)=>e+t),vec3f:te((e,t)=>e+t),vec3h:be((e,t)=>e+t),vec3i:Pe((e,t)=>e+t),vec3u:ke((e,t)=>e+t),vec4f:X((e,t)=>e+t),vec4h:we((e,t)=>e+t),vec4i:We((e,t)=>e+t),vec4u:_e((e,t)=>e+t),mat2x2f:Un((e,t)=>e+t),mat3x3f:Dn((e,t)=>e+t),mat4x4f:Bn((e,t)=>e+t)},smoothstep:{vec2f:Rn(me),vec2h:Gn(me),vec3f:En(me),vec3h:Ln(me),vec4f:Nn(me),vec4h:On(me)},addMixed:{vec2f:(e,t)=>h(n=>n+t)(e),vec2h:(e,t)=>b(n=>n+t)(e),vec2i:(e,t)=>$e(n=>n+t)(e),vec2u:(e,t)=>Ye(n=>n+t)(e),vec3f:(e,t)=>f(n=>n+t)(e),vec3h:(e,t)=>w(n=>n+t)(e),vec3i:(e,t)=>ze(n=>n+t)(e),vec3u:(e,t)=>Je(n=>n+t)(e),vec4f:(e,t)=>x(n=>n+t)(e),vec4h:(e,t)=>S(n=>n+t)(e),vec4i:(e,t)=>Ve(n=>n+t)(e),vec4u:(e,t)=>et(n=>n+t)(e),mat2x2f:(e,t)=>sn(n=>n+t)(e),mat3x3f:(e,t)=>an(n=>n+t)(e),mat4x4f:(e,t)=>on(n=>n+t)(e)},mulSxV:{vec2f:(e,t)=>h(n=>e*n)(t),vec2h:(e,t)=>b(n=>e*n)(t),vec2i:(e,t)=>$e(n=>e*n)(t),vec2u:(e,t)=>Ye(n=>e*n)(t),vec3f:(e,t)=>f(n=>e*n)(t),vec3h:(e,t)=>w(n=>e*n)(t),vec3i:(e,t)=>ze(n=>e*n)(t),vec3u:(e,t)=>Je(n=>e*n)(t),vec4f:(e,t)=>x(n=>e*n)(t),vec4h:(e,t)=>S(n=>e*n)(t),vec4i:(e,t)=>Ve(n=>e*n)(t),vec4u:(e,t)=>et(n=>e*n)(t),mat2x2f:(e,t)=>sn(n=>e*n)(t),mat3x3f:(e,t)=>an(n=>e*n)(t),mat4x4f:(e,t)=>on(n=>e*n)(t)},mulVxV:{vec2f:pe((e,t)=>e*t),vec2h:ve((e,t)=>e*t),vec2i:Fe((e,t)=>e*t),vec2u:Ce((e,t)=>e*t),vec3f:te((e,t)=>e*t),vec3h:be((e,t)=>e*t),vec3i:Pe((e,t)=>e*t),vec3u:ke((e,t)=>e*t),vec4f:X((e,t)=>e*t),vec4h:we((e,t)=>e*t),vec4i:We((e,t)=>e*t),vec4u:_e((e,t)=>e*t),mat2x2f:(e,t)=>{let n=e.columns,r=t.columns;return ie(n[0].x*r[0].x+n[1].x*r[0].y,n[0].y*r[0].x+n[1].y*r[0].y,n[0].x*r[1].x+n[1].x*r[1].y,n[0].y*r[1].x+n[1].y*r[1].y)},mat3x3f:(e,t)=>{let n=e.columns,r=t.columns;return le(n[0].x*r[0].x+n[1].x*r[0].y+n[2].x*r[0].z,n[0].y*r[0].x+n[1].y*r[0].y+n[2].y*r[0].z,n[0].z*r[0].x+n[1].z*r[0].y+n[2].z*r[0].z,n[0].x*r[1].x+n[1].x*r[1].y+n[2].x*r[1].z,n[0].y*r[1].x+n[1].y*r[1].y+n[2].y*r[1].z,n[0].z*r[1].x+n[1].z*r[1].y+n[2].z*r[1].z,n[0].x*r[2].x+n[1].x*r[2].y+n[2].x*r[2].z,n[0].y*r[2].x+n[1].y*r[2].y+n[2].y*r[2].z,n[0].z*r[2].x+n[1].z*r[2].y+n[2].z*r[2].z)},mat4x4f:(e,t)=>{let n=e.columns,r=t.columns;return A(n[0].x*r[0].x+n[1].x*r[0].y+n[2].x*r[0].z+n[3].x*r[0].w,n[0].y*r[0].x+n[1].y*r[0].y+n[2].y*r[0].z+n[3].y*r[0].w,n[0].z*r[0].x+n[1].z*r[0].y+n[2].z*r[0].z+n[3].z*r[0].w,n[0].w*r[0].x+n[1].w*r[0].y+n[2].w*r[0].z+n[3].w*r[0].w,n[0].x*r[1].x+n[1].x*r[1].y+n[2].x*r[1].z+n[3].x*r[1].w,n[0].y*r[1].x+n[1].y*r[1].y+n[2].y*r[1].z+n[3].y*r[1].w,n[0].z*r[1].x+n[1].z*r[1].y+n[2].z*r[1].z+n[3].z*r[1].w,n[0].w*r[1].x+n[1].w*r[1].y+n[2].w*r[1].z+n[3].w*r[1].w,n[0].x*r[2].x+n[1].x*r[2].y+n[2].x*r[2].z+n[3].x*r[2].w,n[0].y*r[2].x+n[1].y*r[2].y+n[2].y*r[2].z+n[3].y*r[2].w,n[0].z*r[2].x+n[1].z*r[2].y+n[2].z*r[2].z+n[3].z*r[2].w,n[0].w*r[2].x+n[1].w*r[2].y+n[2].w*r[2].z+n[3].w*r[2].w,n[0].x*r[3].x+n[1].x*r[3].y+n[2].x*r[3].z+n[3].x*r[3].w,n[0].y*r[3].x+n[1].y*r[3].y+n[2].y*r[3].z+n[3].y*r[3].w,n[0].z*r[3].x+n[1].z*r[3].y+n[2].z*r[3].z+n[3].z*r[3].w,n[0].w*r[3].x+n[1].w*r[3].y+n[2].w*r[3].z+n[3].w*r[3].w)}},mulMxV:{mat2x2f:(e,t)=>{let n=e.columns;return q(n[0].x*t.x+n[1].x*t.y,n[0].y*t.x+n[1].y*t.y)},mat3x3f:(e,t)=>{let n=e.columns;return _(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z)},mat4x4f:(e,t)=>{let n=e.columns;return j(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z+n[3].x*t.w,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z+n[3].y*t.w,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z+n[3].z*t.w,n[0].w*t.x+n[1].w*t.y+n[2].w*t.z+n[3].w*t.w)}},mulVxM:{mat2x2f:(e,t)=>{let n=t.columns;return q(e.x*n[0].x+e.y*n[0].y,e.x*n[1].x+e.y*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return _(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return j(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z+e.w*n[0].w,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z+e.w*n[1].w,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z+e.w*n[2].w,e.x*n[3].x+e.y*n[3].y+e.z*n[3].z+e.w*n[3].w)}},div:{vec2f:pe((e,t)=>e/t),vec2h:ve((e,t)=>e/t),vec2i:Fe(he),vec2u:Ce(he),vec3f:te((e,t)=>e/t),vec3h:be((e,t)=>e/t),vec3i:Pe(he),vec3u:ke(he),vec4f:X((e,t)=>e/t),vec4h:we((e,t)=>e/t),vec4i:We(he),vec4u:_e(he)},dot:{vec2f:ft,vec2h:ft,vec2i:ft,vec2u:ft,vec3f:gt,vec3h:gt,vec3i:gt,vec3u:gt,vec4f:ht,vec4h:ht,vec4i:ht,vec4u:ht},normalize:{vec2f:e=>{let t=Me(e);return q(e.x/t,e.y/t)},vec2h:e=>{let t=Me(e);return ye(e.x/t,e.y/t)},vec2i:e=>{let t=Me(e);return Ue(e.x/t,e.y/t)},vec2u:e=>{let t=Me(e);return tt(e.x/t,e.y/t)},vec3f:e=>{let t=Ie(e);return _(e.x/t,e.y/t,e.z/t)},vec3h:e=>{let t=Ie(e);return ee(e.x/t,e.y/t,e.z/t)},vec3i:e=>{let t=Ie(e);return De(e.x/t,e.y/t,e.z/t)},vec3u:e=>{let t=Ie(e);return nt(e.x/t,e.y/t,e.z/t)},vec4f:e=>{let t=Ae(e);return j(e.x/t,e.y/t,e.z/t,e.w/t)},vec4h:e=>{let t=Ae(e);return Te(e.x/t,e.y/t,e.z/t,e.w/t)},vec4i:e=>{let t=Ae(e);return Be(e.x/t,e.y/t,e.z/t,e.w/t)},vec4u:e=>{let t=Ae(e);return rt(e.x/t,e.y/t,e.z/t,e.w/t)}},cross:{vec3f:(e,t)=>_(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x),vec3h:(e,t)=>ee(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x)},mod:{vec2f:pe((e,t)=>e%t),vec2h:ve((e,t)=>e%t),vec2i:Fe((e,t)=>e%t),vec2u:Ce((e,t)=>e%t),vec3f:te((e,t)=>e%t),vec3h:be((e,t)=>e%t),vec3i:Pe((e,t)=>e%t),vec3u:ke((e,t)=>e%t),vec4f:X((e,t)=>e%t),vec4h:we((e,t)=>e%t),vec4i:We((e,t)=>e%t),vec4u:_e((e,t)=>e%t)},floor:{vec2f:h(Math.floor),vec2h:b(Math.floor),vec3f:f(Math.floor),vec3h:w(Math.floor),vec4f:x(Math.floor),vec4h:S(Math.floor)},max:{vec2f:pe(Math.max),vec2h:ve(Math.max),vec2i:Fe(Math.max),vec2u:Ce(Math.max),vec3f:te(Math.max),vec3h:be(Math.max),vec3i:Pe(Math.max),vec3u:ke(Math.max),vec4f:X(Math.max),vec4h:we(Math.max),vec4i:We(Math.max),vec4u:_e(Math.max)},min:{vec2f:pe(Math.min),vec2h:ve(Math.min),vec2i:Fe(Math.min),vec2u:Ce(Math.min),vec3f:te(Math.min),vec3h:be(Math.min),vec3i:Pe(Math.min),vec3u:ke(Math.min),vec4f:X(Math.min),vec4h:we(Math.min),vec4i:We(Math.min),vec4u:_e(Math.min)},pow:{vec2f:(e,t)=>q(e.x**t.x,e.y**t.y),vec2h:(e,t)=>ye(e.x**t.x,e.y**t.y),vec3f:(e,t)=>_(e.x**t.x,e.y**t.y,e.z**t.z),vec3h:(e,t)=>ee(e.x**t.x,e.y**t.y,e.z**t.z),vec4f:(e,t)=>j(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w),vec4h:(e,t)=>Te(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w)},sign:{vec2f:h(Math.sign),vec2h:b(Math.sign),vec2i:$e(Math.sign),vec3f:f(Math.sign),vec3h:w(Math.sign),vec3i:ze(Math.sign),vec4f:x(Math.sign),vec4h:S(Math.sign),vec4i:Ve(Math.sign)},sqrt:{vec2f:h(Math.sqrt),vec2h:b(Math.sqrt),vec3f:f(Math.sqrt),vec3h:w(Math.sqrt),vec4f:x(Math.sqrt),vec4h:S(Math.sqrt)},mix:{vec2f:(e,t,n)=>typeof n=="number"?q(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):q(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec2h:(e,t,n)=>typeof n=="number"?ye(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):ye(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec3f:(e,t,n)=>typeof n=="number"?_(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):_(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec3h:(e,t,n)=>typeof n=="number"?ee(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):ee(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec4f:(e,t,n)=>typeof n=="number"?j(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):j(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w),vec4h:(e,t,n)=>typeof n=="number"?Te(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):Te(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w)},sin:{vec2f:h(Math.sin),vec2h:b(Math.sin),vec3f:f(Math.sin),vec3h:w(Math.sin),vec4f:x(Math.sin),vec4h:S(Math.sin)},cos:{vec2f:h(Math.cos),vec2h:b(Math.cos),vec3f:f(Math.cos),vec3h:w(Math.cos),vec4f:x(Math.cos),vec4h:S(Math.cos)},cosh:{vec2f:h(Math.cosh),vec2h:b(Math.cosh),vec3f:f(Math.cosh),vec3h:w(Math.cosh),vec4f:x(Math.cosh),vec4h:S(Math.cosh)},exp:{vec2f:h(Math.exp),vec2h:b(Math.exp),vec3f:f(Math.exp),vec3h:w(Math.exp),vec4f:x(Math.exp),vec4h:S(Math.exp)},exp2:{vec2f:h(e=>2**e),vec2h:b(e=>2**e),vec3f:f(e=>2**e),vec3h:w(e=>2**e),vec4f:x(e=>2**e),vec4h:S(e=>2**e)},log:{vec2f:h(Math.log),vec2h:b(Math.log),vec3f:f(Math.log),vec3h:w(Math.log),vec4f:x(Math.log),vec4h:S(Math.log)},log2:{vec2f:h(Math.log2),vec2h:b(Math.log2),vec3f:f(Math.log2),vec3h:w(Math.log2),vec4f:x(Math.log2),vec4h:S(Math.log2)},fract:{vec2f:h(e=>e-Math.floor(e)),vec2h:b(e=>e-Math.floor(e)),vec3f:f(e=>e-Math.floor(e)),vec3h:w(e=>e-Math.floor(e)),vec4f:x(e=>e-Math.floor(e)),vec4h:S(e=>e-Math.floor(e))},isCloseToZero:{vec2f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec2h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec3f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec3h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec4f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t,vec4h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t},neg:{vec2f:h(e=>-e),vec2h:b(e=>-e),vec2i:$e(e=>-e),vec2u:Ye(e=>-e),"vec2<bool>":e=>N(!e.x,!e.y),vec3f:f(e=>-e),vec3h:w(e=>-e),vec3i:ze(e=>-e),vec3u:Je(e=>-e),"vec3<bool>":e=>O(!e.x,!e.y,!e.z),vec4f:x(e=>-e),vec4h:S(e=>-e),vec4i:Ve(e=>-e),vec4u:et(e=>-e),"vec4<bool>":e=>K(!e.x,!e.y,!e.z,!e.w)},select:{vec2f:(e,t,n)=>q(n.x?t.x:e.x,n.y?t.y:e.y),vec2h:(e,t,n)=>ye(n.x?t.x:e.x,n.y?t.y:e.y),vec2i:(e,t,n)=>Ue(n.x?t.x:e.x,n.y?t.y:e.y),vec2u:(e,t,n)=>tt(n.x?t.x:e.x,n.y?t.y:e.y),"vec2<bool>":(e,t,n)=>N(n.x?t.x:e.x,n.y?t.y:e.y),vec3f:(e,t,n)=>_(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3h:(e,t,n)=>ee(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3i:(e,t,n)=>De(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3u:(e,t,n)=>nt(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),"vec3<bool>":(e,t,n)=>O(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec4f:(e,t,n)=>j(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4h:(e,t,n)=>Te(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4i:(e,t,n)=>Be(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4u:(e,t,n)=>rt(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),"vec4<bool>":(e,t,n)=>K(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w)},tanh:{vec2f:h(Math.tanh),vec2h:b(Math.tanh),vec3f:f(Math.tanh),vec3h:w(Math.tanh),vec4f:x(Math.tanh),vec4h:S(Math.tanh)},bitcastU32toF32:{vec2u:e=>q(Y(e.x),Y(e.y)),vec3u:e=>_(Y(e.x),Y(e.y),Y(e.z)),vec4u:e=>j(Y(e.x),Y(e.y),Y(e.z),Y(e.w))},bitcastU32toI32:{vec2u:e=>Ue(J(e.x),J(e.y)),vec3u:e=>De(J(e.x),J(e.y),J(e.z)),vec4u:e=>Be(J(e.x),J(e.y),J(e.z),J(e.w))}};function un(e,t){if(typeof e=="number"&&typeof t=="number")return e+t;if(typeof e=="number"&&_chunkTRE7NUKEcjs.r.call(void 0, t))return m.addMixed[t.kind](t,e);if(_chunkTRE7NUKEcjs.r.call(void 0, e)&&typeof t=="number")return m.addMixed[e.kind](e,t);if(_chunkTRE7NUKEcjs.r.call(void 0, e)&&_chunkTRE7NUKEcjs.r.call(void 0, t)||_chunkTRE7NUKEcjs.w.call(void 0, e)&&_chunkTRE7NUKEcjs.w.call(void 0, t))return m.add[e.kind](e,t);throw new Error("Add/Sub called with invalid arguments.")}var Bt=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"add",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e), () => (e));return{argTypes:t,returnType:_chunkTRE7NUKEcjs.N.call(void 0, t[0])?t[1]:t[0]}},normalImpl:un,codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`(${e} + ${t})`});function Kn(e,t){return un(e,cn(-1,t))}var Re=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"sub",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e), () => (e));return{argTypes:t,returnType:_chunkTRE7NUKEcjs.N.call(void 0, t[0])?t[1]:t[0]}},normalImpl:Kn,codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`(${e} - ${t})`});function cn(e,t){if(typeof e=="number"&&typeof t=="number")return e*t;if(typeof e=="number"&&(_chunkTRE7NUKEcjs.r.call(void 0, t)||_chunkTRE7NUKEcjs.w.call(void 0, t)))return m.mulSxV[t.kind](e,t);if((_chunkTRE7NUKEcjs.r.call(void 0, e)||_chunkTRE7NUKEcjs.w.call(void 0, e))&&typeof t=="number")return m.mulSxV[e.kind](t,e);if(_chunkTRE7NUKEcjs.r.call(void 0, e)&&_chunkTRE7NUKEcjs.r.call(void 0, t))return m.mulVxV[e.kind](e,t);if(_chunkTRE7NUKEcjs.A.call(void 0, e)&&_chunkTRE7NUKEcjs.w.call(void 0, t))return m.mulVxM[t.kind](e,t);if(_chunkTRE7NUKEcjs.w.call(void 0, e)&&_chunkTRE7NUKEcjs.A.call(void 0, t))return m.mulMxV[e.kind](e,t);if(_chunkTRE7NUKEcjs.w.call(void 0, e)&&_chunkTRE7NUKEcjs.w.call(void 0, t))return m.mulVxV[e.kind](e,t);throw new Error("Mul called with invalid arguments.")}var st=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"mul",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e), () => (e)),n=_chunkTRE7NUKEcjs.N.call(void 0, t[0])?t[1]:_chunkTRE7NUKEcjs.N.call(void 0, t[1])||t[0].type.startsWith("vec")?t[0]:t[1].type.startsWith("vec")?t[1]:t[0];return{argTypes:t,returnType:n}},normalImpl:cn,codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`(${e} * ${t})`});function qn(e,t){if(typeof e=="number"&&typeof t=="number")return e/t;if(typeof e=="number"&&_chunkTRE7NUKEcjs.r.call(void 0, t)){let n=_chunkTRE7NUKEcjs.kb[t.kind][_chunkTRE7NUKEcjs.a].jsImpl;return m.div[t.kind](n(e),t)}if(_chunkTRE7NUKEcjs.r.call(void 0, e)&&typeof t=="number"){let n=_chunkTRE7NUKEcjs.kb[e.kind][_chunkTRE7NUKEcjs.a].jsImpl;return m.div[e.kind](e,n(t))}if(_chunkTRE7NUKEcjs.r.call(void 0, e)&&_chunkTRE7NUKEcjs.r.call(void 0, t))return m.div[e.kind](e,t);throw new Error("Div called with invalid arguments.")}var Rt=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"div",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e,[_chunkTRE7NUKEcjs.Ua,_chunkTRE7NUKEcjs.Va,_chunkTRE7NUKEcjs.Pa]), () => (e));return{argTypes:t,returnType:_chunkTRE7NUKEcjs.N.call(void 0, t[0])?t[1]:t[0]}},normalImpl:qn,codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`(${e} / ${t})`,ignoreImplicitCastWarning:!0}),na= exports.$ =_chunkTRE7NUKEcjs.Na.call(void 0, {name:"mod",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e), () => (e));return{argTypes:t,returnType:_chunkTRE7NUKEcjs.N.call(void 0, t[0])?t[1]:t[0]}},normalImpl(e,t){if(typeof e=="number"&&typeof t=="number")return e%t;if(typeof e=="number"&&_chunkTRE7NUKEcjs.r.call(void 0, t)){let n=_chunkTRE7NUKEcjs.kb[t.kind];return m.mod[t.kind](n(e),t)}if(_chunkTRE7NUKEcjs.r.call(void 0, e)&&typeof t=="number"){let n=_chunkTRE7NUKEcjs.kb[e.kind];return m.mod[e.kind](e,n(t))}if(_chunkTRE7NUKEcjs.r.call(void 0, e)&&_chunkTRE7NUKEcjs.r.call(void 0, t))return m.mod[e.kind](e,t);throw new Error("Mod called with invalid arguments, expected types: number or vector.")},codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`(${e} % ${t})`});function jn(e){return typeof e=="number"?-e:m.neg[e.kind](e)}var ra=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"neg",signature:e=>({argTypes:[e],returnType:e}),normalImpl:jn,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`-(${e})`});function Zn(e){return typeof e=="number"?Math.abs(e):m.abs[e.kind](e)}var da=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"abs",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Zn,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`abs(${e})`});function Hn(e){return typeof e=="number"?Math.acos(e):m.acos[e.kind](e)}var fa=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"acos",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Hn,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`acos(${e})`});function Qn(e){return typeof e=="number"?Math.acosh(e):m.acosh[e.kind](e)}var ga=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"acosh",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Qn,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`acosh(${e})`});function Xn(e){return typeof e=="number"?Math.asin(e):m.asin[e.kind](e)}var ha=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"asin",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Xn,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`asin(${e})`});function Yn(e){return typeof e=="number"?Math.asinh(e):m.asinh[e.kind](e)}var va=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"asinh",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Yn,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`asinh(${e})`});function Jn(e){return typeof e=="number"?Math.atan(e):m.atan[e.kind](e)}var ba=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"atan",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Jn,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`atan(${e})`});function er(e){return typeof e=="number"?Math.atanh(e):m.atanh[e.kind](e)}var wa=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"atanh",signature:e=>({argTypes:[e],returnType:e}),normalImpl:er,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`atanh(${e})`});function tr(e,t){return typeof e=="number"&&typeof t=="number"?Math.atan2(e,t):m.atan2[e.kind](e,t)}var Sa=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"atan2",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e,[_chunkTRE7NUKEcjs.Ua,_chunkTRE7NUKEcjs.Va,_chunkTRE7NUKEcjs.Pa]), () => (e));return{argTypes:t,returnType:t[0]}},normalImpl:tr,codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`atan2(${e}, ${t})`});function nr(e){return typeof e=="number"?Math.ceil(e):m.ceil[e.kind](e)}var Ma=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"ceil",signature:e=>({argTypes:[e],returnType:e}),normalImpl:nr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`ceil(${e})`});function rr(e,t,n){return typeof e=="number"?Math.min(Math.max(t,e),n):m.clamp[e.kind](e,t,n)}var Ia=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"clamp",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e), () => (e));return{argTypes:t,returnType:t[0]}},normalImpl:rr,codegenImpl:(e,t,n)=>_chunkTRE7NUKEcjs.Ea`clamp(${e}, ${t}, ${n})`});function sr(e){return typeof e=="number"?Math.cos(e):m.cos[e.kind](e)}var Aa=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"cos",signature:e=>({argTypes:[e],returnType:e}),normalImpl:sr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`cos(${e})`});function ar(e){return typeof e=="number"?Math.cosh(e):m.cosh[e.kind](e)}var $a=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"cosh",signature:e=>({argTypes:[e],returnType:e}),normalImpl:ar,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`cosh(${e})`});var za=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"countLeadingZeros",signature:e=>({argTypes:[e],returnType:e}),normalImpl:"CPU implementation for countLeadingZeros not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`countLeadingZeros(${e})`});var Va=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"countOneBits",signature:e=>({argTypes:[e],returnType:e}),normalImpl:"CPU implementation for countOneBits not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`countOneBits(${e})`});var Fa=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"countTrailingZeros",signature:e=>({argTypes:[e],returnType:e}),normalImpl:"CPU implementation for countTrailingZeros not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`countTrailingZeros(${e})`}),Ca= exports.qa =_chunkTRE7NUKEcjs.Na.call(void 0, {name:"cross",signature:(e,t)=>({argTypes:[e,t],returnType:e}),normalImpl:(e,t)=>m.cross[e.kind](e,t),codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`cross(${e}, ${t})`});function or(e){if(typeof e=="number")return e*180/Math.PI;throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for degrees on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")}var Pa=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"degrees",signature:e=>({argTypes:[e],returnType:e}),normalImpl:or,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`degrees(${e})`}),ka= exports.sa =_chunkTRE7NUKEcjs.Na.call(void 0, {name:"determinant",signature:e=>({argTypes:[e],returnType:_chunkTRE7NUKEcjs.Ua}),normalImpl:"CPU implementation for determinant not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`determinant(${e})`});function ur(e,t){return typeof e=="number"&&typeof t=="number"?Math.abs(e-t):fr(Re(e,t))}var Wa=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"distance",signature:(e,t)=>({argTypes:[e,t],returnType:_chunkTRE7NUKEcjs.O.call(void 0, e)?_chunkTRE7NUKEcjs.Va:_chunkTRE7NUKEcjs.Ua}),normalImpl:ur,codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`distance(${e}, ${t})`}),cr= exports.ua =_chunkTRE7NUKEcjs.Na.call(void 0, {name:"dot",signature:(e,t)=>({argTypes:[e,t],returnType:e.primitive}),normalImpl:(e,t)=>m.dot[e.kind](e,t),codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`dot(${e}, ${t})`}),_a= exports.va =_chunkTRE7NUKEcjs.Na.call(void 0, {name:"dot4U8Packed",signature:(e,t)=>({argTypes:[_chunkTRE7NUKEcjs.Ra,_chunkTRE7NUKEcjs.Ra],returnType:_chunkTRE7NUKEcjs.Ra}),normalImpl:"CPU implementation for dot4U8Packed not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`dot4U8Packed(${e}, ${t})`}),Ua= exports.wa =_chunkTRE7NUKEcjs.Na.call(void 0, {name:"dot4I8Packed",signature:(e,t)=>({argTypes:[_chunkTRE7NUKEcjs.Ra,_chunkTRE7NUKEcjs.Ra],returnType:_chunkTRE7NUKEcjs.Ta}),normalImpl:"CPU implementation for dot4I8Packed not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`dot4I8Packed(${e}, ${t})`});function ir(e){return typeof e=="number"?Math.exp(e):m.exp[e.kind](e)}var Da=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"exp",signature:e=>({argTypes:[e],returnType:e}),normalImpl:ir,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`exp(${e})`});function lr(e){return typeof e=="number"?2**e:m.exp2[e.kind](e)}var Ba=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"exp2",signature:e=>({argTypes:[e],returnType:e}),normalImpl:lr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`exp2(${e})`});var Ra=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"extractBits",signature:(e,t,n)=>({argTypes:[e,_chunkTRE7NUKEcjs.Ra,_chunkTRE7NUKEcjs.Ra],returnType:e}),normalImpl:"CPU implementation for extractBits not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:(e,t,n)=>_chunkTRE7NUKEcjs.Ea`extractBits(${e}, ${t}, ${n})`}),Ga= exports.Aa =_chunkTRE7NUKEcjs.Na.call(void 0, {name:"faceForward",signature:(e,t,n)=>({argTypes:[e,t,n],returnType:e}),normalImpl:"CPU implementation for faceForward not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:(e,t,n)=>_chunkTRE7NUKEcjs.Ea`faceForward(${e}, ${t}, ${n})`});var Ea=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"firstLeadingBit",signature:e=>({argTypes:[e],returnType:e}),normalImpl:"CPU implementation for firstLeadingBit not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`firstLeadingBit(${e})`});var La=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"firstTrailingBit",signature:e=>({argTypes:[e],returnType:e}),normalImpl:"CPU implementation for firstTrailingBit not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`firstTrailingBit(${e})`});function mr(e){return typeof e=="number"?Math.floor(e):m.floor[e.kind](e)}var Na=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"floor",signature:(...e)=>({argTypes:e,returnType:e[0]}),normalImpl:mr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`floor(${e})`});function pr(e,t,n){if(typeof e=="number")return e*t+n;throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for fma on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")}var Oa=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"fma",signature:(e,t,n)=>({argTypes:[e,t,n],returnType:e}),normalImpl:pr,codegenImpl:(e,t,n)=>_chunkTRE7NUKEcjs.Ea`fma(${e}, ${t}, ${n})`});function yr(e){return typeof e=="number"?e-Math.floor(e):m.fract[e.kind](e)}var Ka=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"fract",signature:(...e)=>({argTypes:e,returnType:e[0]}),normalImpl:yr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`fract(${e})`}),Tr={f32:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.Ua,exp:_chunkTRE7NUKEcjs.Ta}),f16:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.Va,exp:_chunkTRE7NUKEcjs.Ta}),abstractFloat:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.Pa,exp:_chunkTRE7NUKEcjs.Oa}),vec2f:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.Xa,exp:_chunkTRE7NUKEcjs.Za}),vec3f:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.ab,exp:_chunkTRE7NUKEcjs.cb}),vec4f:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.fb,exp:_chunkTRE7NUKEcjs.hb}),vec2h:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.Ya,exp:_chunkTRE7NUKEcjs.Za}),vec3h:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.bb,exp:_chunkTRE7NUKEcjs.cb}),vec4h:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.gb,exp:_chunkTRE7NUKEcjs.hb})},qa= exports.Ga =_chunkTRE7NUKEcjs.La.call(void 0, e=>{throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for frexp not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")},e=>{let t=Tr[e.dataType.type];if(!t)throw new Error(`Unsupported data type for frexp: ${e.dataType.type}. Supported types are f32, f16, abstractFloat, vec2f, vec3f, vec4f, vec2h, vec3h, vec4h.`);return _chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`frexp(${e})`,t)},"frexp");var ja=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"insertBits",signature:(e,t,n,r)=>({argTypes:[e,t,_chunkTRE7NUKEcjs.Ra,_chunkTRE7NUKEcjs.Ra],returnType:e}),normalImpl:"CPU implementation for insertBits not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:(e,t,n,r)=>_chunkTRE7NUKEcjs.Ea`insertBits(${e}, ${t}, ${n}, ${r})`});function xr(e){if(typeof e=="number")return 1/Math.sqrt(e);throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for inverseSqrt on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")}var Za=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"inverseSqrt",signature:e=>({argTypes:[e],returnType:e}),normalImpl:xr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`inverseSqrt(${e})`});var Ha=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"ldexp",signature:(e,t)=>{switch(e.type){case"abstractFloat":return{argTypes:[_chunkTRE7NUKEcjs.Pa,_chunkTRE7NUKEcjs.Oa],returnType:e};case"f32":case"f16":return{argTypes:[e,_chunkTRE7NUKEcjs.Ta],returnType:e};case"vec2f":case"vec2h":return{argTypes:[e,_chunkTRE7NUKEcjs.Za],returnType:e};case"vec3f":case"vec3h":return{argTypes:[e,_chunkTRE7NUKEcjs.cb],returnType:e};case"vec4f":case"vec4h":return{argTypes:[e,_chunkTRE7NUKEcjs.hb],returnType:e};default:throw new Error(`Unsupported data type for ldexp: ${e.type}. Supported types are abstractFloat, f32, f16, vec2f, vec2h, vec3f, vec3h, vec4f, vec4h.`)}},normalImpl:"CPU implementation for ldexp not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`ldexp(${e}, ${t})`});function dr(e){return typeof e=="number"?Math.abs(e):m.length[e.kind](e)}var fr=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"length",signature:e=>({argTypes:[e],returnType:_chunkTRE7NUKEcjs.O.call(void 0, e)?_chunkTRE7NUKEcjs.Va:_chunkTRE7NUKEcjs.Ua}),normalImpl:dr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`length(${e})`});function gr(e){return typeof e=="number"?Math.log(e):m.log[e.kind](e)}var Qa=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"log",signature:e=>({argTypes:[e],returnType:e}),normalImpl:gr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`log(${e})`});function hr(e){return typeof e=="number"?Math.log2(e):m.log2[e.kind](e)}var Xa=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"log2",signature:e=>({argTypes:[e],returnType:e}),normalImpl:hr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`log2(${e})`});function vr(e,t){return typeof e=="number"?Math.max(e,t):m.max[e.kind](e,t)}var Ya=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"max",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e), () => (e));return{argTypes:t,returnType:t[0]}},normalImpl:vr,codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`max(${e}, ${t})`});function br(e,t){return typeof e=="number"?Math.min(e,t):m.min[e.kind](e,t)}var Ja=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"min",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e), () => (e));return{argTypes:t,returnType:t[0]}},normalImpl:br,codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`min(${e}, ${t})`});function wr(e,t,n){if(typeof e=="number"){if(typeof n!="number"||typeof t!="number")throw new Error("When e1 and e2 are numbers, the blend factor must be a number.");return e*(1-n)+t*n}if(typeof e=="number"||typeof t=="number")throw new Error("e1 and e2 need to both be vectors of the same kind.");return m.mix[e.kind](e,t,n)}var eo=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"mix",signature:(e,t,n)=>({argTypes:[e,t,n],returnType:e}),normalImpl:wr,codegenImpl:(e,t,n)=>_chunkTRE7NUKEcjs.Ea`mix(${e}, ${t}, ${n})`}),Sr={f32:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.Ua,whole:_chunkTRE7NUKEcjs.Ua}),f16:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.Va,whole:_chunkTRE7NUKEcjs.Va}),abstractFloat:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.Pa,whole:_chunkTRE7NUKEcjs.Pa}),vec2f:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.Xa,whole:_chunkTRE7NUKEcjs.Xa}),vec3f:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.ab,whole:_chunkTRE7NUKEcjs.ab}),vec4f:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.fb,whole:_chunkTRE7NUKEcjs.fb}),vec2h:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.Ya,whole:_chunkTRE7NUKEcjs.Ya}),vec3h:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.bb,whole:_chunkTRE7NUKEcjs.bb}),vec4h:_chunkTRE7NUKEcjs.sc.call(void 0, {fract:_chunkTRE7NUKEcjs.gb,whole:_chunkTRE7NUKEcjs.gb})};var to=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"modf",signature:e=>{let t=Sr[e.type];if(!t)throw new Error(`Unsupported data type for modf: ${e.type}. Supported types are f32, f16, abstractFloat, vec2f, vec3f, vec4f, vec2h, vec3h, vec4h.`);return{argTypes:[e],returnType:t}},normalImpl:"CPU implementation for modf not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`modf(${e})`}),no= exports.Ra =_chunkTRE7NUKEcjs.Na.call(void 0, {name:"normalize",signature:e=>({argTypes:[e],returnType:e}),normalImpl:e=>m.normalize[e.kind](e),codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`normalize(${e})`});function Mr(e,t){if(typeof e=="number"&&typeof t=="number")return e**t;if(_chunkTRE7NUKEcjs.r.call(void 0, e)&&_chunkTRE7NUKEcjs.r.call(void 0, t))return m.pow[e.kind](e,t);throw new Error("Invalid arguments to pow()")}var ln=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"pow",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e,[_chunkTRE7NUKEcjs.Ua,_chunkTRE7NUKEcjs.Va,_chunkTRE7NUKEcjs.Pa]), () => (e));return{argTypes:t,returnType:_chunkTRE7NUKEcjs.N.call(void 0, t[0])?t[1]:t[0]}},normalImpl:Mr,codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`pow(${e}, ${t})`});var ro=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"quantizeToF16",signature:e=>({argTypes:[e],returnType:e}),normalImpl:"CPU implementation for quantizeToF16 not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`quantizeToF16(${e})`});function Ir(e){if(typeof e=="number")return e*Math.PI/180;throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for radians on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")}var so=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"radians",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e,[_chunkTRE7NUKEcjs.Ua,_chunkTRE7NUKEcjs.Va,_chunkTRE7NUKEcjs.Pa]), () => (e));return{argTypes:t,returnType:t[0]}},normalImpl:Ir,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`radians(${e})`}),ao= exports.Va =_chunkTRE7NUKEcjs.Na.call(void 0, {name:"reflect",signature:(e,t)=>({argTypes:[e,t],returnType:e}),normalImpl:(e,t)=>Re(e,st(2*cr(t,e),t)),codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`reflect(${e}, ${t})`}),oo= exports.Wa =_chunkTRE7NUKEcjs.La.call(void 0, (e,t,n)=>{throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for refract not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")},(e,t,n)=>_chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`refract(${e}, ${t}, ${n})`,e.dataType),"refract",(e,t,n)=>[e.dataType,t.dataType,_chunkTRE7NUKEcjs.O.call(void 0, e)?_chunkTRE7NUKEcjs.Va:_chunkTRE7NUKEcjs.Ua]);var uo=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"reverseBits",signature:e=>({argTypes:[e],returnType:e}),normalImpl:"CPU implementation for reverseBits not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`reverseBits(${e})`});function Ar(e){if(typeof e=="number")return Math.round(e);throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for round on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")}var co=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"round",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Ar,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`round(${e})`});function $r(e){if(typeof e=="number")return Math.max(0,Math.min(1,e));throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for saturate on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")}var io=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"saturate",signature:e=>({argTypes:[e],returnType:e}),normalImpl:$r,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`saturate(${e})`});function zr(e){return typeof e=="number"?Math.sign(e):m.sign[e.kind](e)}var lo=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"sign",signature:e=>({argTypes:[e],returnType:e}),normalImpl:zr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`sign(${e})`});function Vr(e){return typeof e=="number"?Math.sin(e):m.sin[e.kind](e)}var mo=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"sin",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Vr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`sin(${e})`});function Fr(e){if(typeof e=="number")return Math.sinh(e);throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for sinh on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")}var po=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"sinh",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Fr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`sinh(${e})`});function Cr(e,t,n){return typeof n=="number"?me(e,t,n):m.smoothstep[n.kind](e,t,n)}var yo=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"smoothstep",signature:(e,t,n)=>({argTypes:[e,t,n],returnType:n}),normalImpl:Cr,codegenImpl:(e,t,n)=>_chunkTRE7NUKEcjs.Ea`smoothstep(${e}, ${t}, ${n})`});function Pr(e){return typeof e=="number"?Math.sqrt(e):m.sqrt[e.kind](e)}var To=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"sqrt",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Pr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`sqrt(${e})`});function kr(e,t){if(typeof e=="number")return e<=t?1:0;throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for step on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")}var xo=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"step",signature:(...e)=>{let t=_nullishCoalesce(_chunkTRE7NUKEcjs.Ha.call(void 0, e,[_chunkTRE7NUKEcjs.Ua,_chunkTRE7NUKEcjs.Va,_chunkTRE7NUKEcjs.Pa]), () => (e));return{argTypes:t,returnType:t[0]}},normalImpl:kr,codegenImpl:(e,t)=>_chunkTRE7NUKEcjs.Ea`step(${e}, ${t})`});function Wr(e){if(typeof e=="number")return Math.tan(e);throw new (0, _chunkTRE7NUKEcjs.Ma)("CPU implementation for tan on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues")}var fo=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"tan",signature:e=>({argTypes:[e],returnType:e}),normalImpl:Wr,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`tan(${e})`});function _r(e){return typeof e=="number"?Math.tanh(e):m.tanh[e.kind](e)}var go=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"tanh",signature:e=>({argTypes:[e],returnType:e}),normalImpl:_r,codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`tanh(${e})`}),ho= exports.gb =_chunkTRE7NUKEcjs.Na.call(void 0, {name:"transpose",signature:e=>({argTypes:[e],returnType:e}),normalImpl:"CPU implementation for transpose not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`transpose(${e})`});var vo=_chunkTRE7NUKEcjs.Na.call(void 0, {name:"trunc",signature:e=>({argTypes:[e],returnType:e}),normalImpl:"CPU implementation for trunc not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues",codegenImpl:e=>_chunkTRE7NUKEcjs.Ea`trunc(${e})`});var _tinyest = require('tinyest'); var Ur = _interopRequireWildcard(_tinyest);var{NodeTypeCatalog:g}=Ur,Dr=["==","!=","<","<=",">",">=","<<",">>","+","-","*","/","%","|","^","&","&&","||"],Br=["&&","||","==","!=","<","<=",">",">="],Rr=["vec2f","vec3f","vec4f","vec2h","vec3h","vec4h","vec2i","vec3i","vec4i","vec2u","vec3u","vec4u","mat2x2f","mat3x3f","mat4x4f"],mn= exports.ib ={add:Bt,sub:Re,mul:st,div:Rt};function pn(e,t,n){return n?Br.includes(t)?_chunkTRE7NUKEcjs.Qa:t==="="?n:e:t==="!"||t==="~"?_chunkTRE7NUKEcjs.Qa:e}var Gr={"+":Bt[_chunkTRE7NUKEcjs.a].gpuImpl,"-":Re[_chunkTRE7NUKEcjs.a].gpuImpl,"*":st[_chunkTRE7NUKEcjs.a].gpuImpl,"/":Rt[_chunkTRE7NUKEcjs.a].gpuImpl,"**":ln[_chunkTRE7NUKEcjs.a].gpuImpl},Gt=class{#e=void 0;initGenerator(t){this.#e=t}get ctx(){if(!this.#e)throw new Error("WGSL Generator has not yet been initialized. Please call initialize(ctx) before using the generator.");return this.#e}block([t,n]){this.ctx.pushBlockScope();try{this.ctx.indent();let r=n.map(a=>this.statement(a)).join(`
|
|
2
|
-
`);return this.ctx.dedent(),`{
|
|
3
|
-
${r}
|
|
4
|
-
${this.ctx.pre}}`}finally{this.ctx.popBlockScope()}}blockVariable(t,n){let r=_chunkTRE7NUKEcjs.aa.call(void 0, this.ctx.makeNameValid(t),n);return this.ctx.defineVariable(t,r),r}identifier(t){if(!t)throw new Error("Cannot resolve an empty identifier");let n=this.ctx.getById(t);if(!n)throw new Error(`Identifier ${t} not found`);return n}typedExpression(t,n){let r=this.ctx.expectedType;this.ctx.expectedType=n;try{let a=this.expression(t);return _chunkTRE7NUKEcjs.Ja.call(void 0, a,n)}finally{this.ctx.expectedType=r}}expression(t){if(typeof t=="string")return this.identifier(t);if(typeof t=="boolean")return _chunkTRE7NUKEcjs.aa.call(void 0, t,_chunkTRE7NUKEcjs.Qa);if(t[0]===g.logicalExpr||t[0]===g.binaryExpr||t[0]===g.assignmentExpr){let[n,r,a,s]=t,i=this.expression(r),p=this.expression(s),d=Gr[a];if(d)return d(i,p);let M=t[0]===g.assignmentExpr?i.dataType.type==="ptr"?[i.dataType.inner]:[i.dataType]:void 0,[z,U]=_nullishCoalesce(_chunkTRE7NUKEcjs.Ia.call(void 0, [i,p],M), () => ([i,p])),at=this.ctx.resolve(z.value,z.dataType).value,Et=this.ctx.resolve(U.value,U.dataType).value,yn=pn(z.dataType,a,U.dataType);return _chunkTRE7NUKEcjs.aa.call(void 0, Dr.includes(a)?`(${at} ${a} ${Et})`:`${at} ${a} ${Et}`,yn)}if(t[0]===g.postUpdate){let[n,r,a]=t,s=this.expression(a),i=this.ctx.resolve(s.value,s.dataType).value;return _chunkTRE7NUKEcjs.aa.call(void 0, `${i}${r}`,s.dataType)}if(t[0]===g.unaryExpr){let[n,r,a]=t,s=this.expression(a),i=this.ctx.resolve(s.value,s.dataType).value,p=pn(s.dataType,r);return _chunkTRE7NUKEcjs.aa.call(void 0, `${r}${i}`,p)}if(t[0]===g.memberAccess){let[n,r,a]=t,s=this.expression(r);if(s.value===console)return _chunkTRE7NUKEcjs.aa.call(void 0, new (0, _chunkTRE7NUKEcjs.Z)(a),_chunkTRE7NUKEcjs.W);if(Rr.includes(s.dataType.type)&&a in mn)return{value:new (0, _chunkTRE7NUKEcjs.X)(a,s,mn[a][_chunkTRE7NUKEcjs.a].gpuImpl),dataType:_chunkTRE7NUKEcjs.W};if(s.dataType.type==="unknown"){let i=s.value[a];return Tt(i)}return _chunkTRE7NUKEcjs.E.call(void 0, s.dataType)?_chunkTRE7NUKEcjs.aa.call(void 0, `(*${this.ctx.resolve(s.value).value}).${a}`,Xe(s.dataType.inner,a)):_chunkTRE7NUKEcjs.C.call(void 0, s.dataType)&&a==="length"?s.dataType.elementCount===0?_chunkTRE7NUKEcjs.aa.call(void 0, `arrayLength(&${this.ctx.resolve(s.value).value})`,_chunkTRE7NUKEcjs.Ra):_chunkTRE7NUKEcjs.aa.call(void 0, String(s.dataType.elementCount),_chunkTRE7NUKEcjs.Oa):_chunkTRE7NUKEcjs.z.call(void 0, s.dataType)&&a==="columns"?_chunkTRE7NUKEcjs.aa.call(void 0, new (0, _chunkTRE7NUKEcjs.Y)(s),_chunkTRE7NUKEcjs.W):_chunkTRE7NUKEcjs.v.call(void 0, s.dataType)&&_chunkTRE7NUKEcjs.r.call(void 0, s.value)?Tt(s.value[a]):_chunkTRE7NUKEcjs.aa.call(void 0, `${this.ctx.resolve(s.value).value}.${a}`,Xe(s.dataType,a))}if(t[0]===g.indexAccess){let[n,r,a]=t,s=this.expression(r),i=this.expression(a),p=this.ctx.resolve(i.value,i.dataType).value;if(s.value instanceof _chunkTRE7NUKEcjs.Y)return _chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`${s.value.matrix}[${p}]`,mt(s.value.matrix.dataType));let d=this.ctx.resolve(s.value,s.dataType).value;if(s.dataType.type==="unknown"){if(Array.isArray(a)&&a[0]===g.numericLiteral)return Tt(s.value[a[1]]);throw new Error(`Unable to index a value of unknown type with index ${p}. If the value is an array, to address this, consider one of the following approaches: (1) declare the array using 'tgpu.const', (2) store the array in a buffer, or (3) define the array within the GPU function scope.`)}if(_chunkTRE7NUKEcjs.z.call(void 0, s.dataType))throw new Error("The only way of accessing matrix elements in TGSL is through the 'columns' property.");return _chunkTRE7NUKEcjs.E.call(void 0, s.dataType)?_chunkTRE7NUKEcjs.aa.call(void 0, `(*${d})[${p}]`,mt(s.dataType.inner)):_chunkTRE7NUKEcjs.aa.call(void 0, `${d}[${p}]`,_chunkTRE7NUKEcjs.V.call(void 0, s.dataType)?mt(s.dataType):_chunkTRE7NUKEcjs.W)}if(t[0]===g.numericLiteral){let n=typeof t[1]=="string"?pt(Lr(t[1])):pt(t[1]);if(!n)throw new Error(`Invalid numeric literal ${t[1]}`);return n}if(t[0]===g.call){let[n,r,a]=t,s=this.expression(r);if(_chunkTRE7NUKEcjs.D.call(void 0, s.value)||_chunkTRE7NUKEcjs.C.call(void 0, s.value)){if(a.length>1)throw new (0, _chunkTRE7NUKEcjs.la)("Array and struct schemas should always be called with at most 1 argument");if(!a[0])return _chunkTRE7NUKEcjs.aa.call(void 0, `${this.ctx.resolve(s.value).value}()`,s.value);let p=this.typedExpression(a[0],s.value);return _chunkTRE7NUKEcjs.aa.call(void 0, this.ctx.resolve(p.value,s.value).value,s.value)}if(s.value===nn)throw new Error("Constants cannot be defined within TypeGPU function scope. To address this, move the constant definition outside the function scope.");if(s.value instanceof _chunkTRE7NUKEcjs.X){if(!a[0])throw new (0, _chunkTRE7NUKEcjs.la)(`An infix operator '${s.value.name}' was called without any arguments`);let p=this.expression(a[0]);return s.value.operator(s.value.lhs,p)}if(!_chunkTRE7NUKEcjs.h.call(void 0, s.value)){let p=a.map(M=>this.expression(M)),d=this.ctx.shelllessRepo.get(s.value,p);if(d)return this.ctx.withResetIndentLevel(()=>{let M=this.ctx.resolve(d);return _chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`${M.value}(${p})`,M.dataType)});throw new Error(`Function '${_nullishCoalesce(_chunkTRE7NUKEcjs.j.call(void 0, s.value), () => (String(s.value)))}' is not marked with the 'use gpu' directive and cannot be used in a shader`)}let i=_nullishCoalesce(_optionalChain([s, 'access', _3 => _3.value, 'access', _4 => _4[_chunkTRE7NUKEcjs.a], 'optionalAccess', _5 => _5.argConversionHint]), () => ("keep"));try{let p;if(Array.isArray(i))p=a.map((M,z)=>{let U=i[z];if(!U)throw new (0, _chunkTRE7NUKEcjs.la)(`Function '${_chunkTRE7NUKEcjs.j.call(void 0, s.value)}' was called with too many arguments`);return this.typedExpression(M,U)});else{let M=a.map(z=>this.expression(z));i==="keep"?p=M:i==="unify"?p=_nullishCoalesce(_chunkTRE7NUKEcjs.Ia.call(void 0, M), () => (M)):p=i(...M).map((z,U)=>[z,M[U]]).map(([z,U])=>_chunkTRE7NUKEcjs.Ja.call(void 0, U,z))}if(s.value instanceof _chunkTRE7NUKEcjs.Z)return this.ctx.generateLog(s.value.op,p);let d=s.value(...p);if(!_chunkTRE7NUKEcjs._.call(void 0, d))throw new Error("Functions running in codegen mode must return snippets");return d}catch(p){throw new (0, _chunkTRE7NUKEcjs.ca)(p,[{toString:()=>_chunkTRE7NUKEcjs.j.call(void 0, s.value)}])}}if(t[0]===g.objectExpr){let n=t[1],r=this.ctx.expectedType;if(!r||!_chunkTRE7NUKEcjs.D.call(void 0, r))throw new (0, _chunkTRE7NUKEcjs.la)(`No target type could be inferred for object with keys [${Object.keys(n).join(", ")}], please wrap the object in the corresponding schema.`);let a=Object.fromEntries(Object.entries(r.propTypes).map(([i,p])=>{let d=n[i];if(d===void 0)throw new (0, _chunkTRE7NUKEcjs.la)(`Missing property ${i} in object literal for struct ${r}`);let M=this.typedExpression(d,p);return[i,M]})),s=_chunkTRE7NUKEcjs.Ka.call(void 0, r,a);return _chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`${this.ctx.resolve(r).value}(${s})`,r)}if(t[0]===g.arrayExpr){let[n,r]=t,a=this.ctx.expectedType,s,i;if(_chunkTRE7NUKEcjs.C.call(void 0, a)){if(s=a.elementType,i=r.map(d=>this.typedExpression(d,s)),i.length!==a.elementCount)throw new (0, _chunkTRE7NUKEcjs.la)(`Cannot create value of type '${a}' from an array of length: ${i.length}`)}else{let d=r.map(z=>this.expression(z));if(d.length===0)throw new (0, _chunkTRE7NUKEcjs.la)("Cannot infer the type of an empty array literal.");let M=_chunkTRE7NUKEcjs.Ia.call(void 0, d);if(!M)throw new (0, _chunkTRE7NUKEcjs.la)("The given values cannot be automatically converted to a common type. Consider wrapping the array in an appropriate schema");i=M,s=yt(_optionalChain([i, 'access', _6 => _6[0], 'optionalAccess', _7 => _7.dataType]))}let p=`array<${this.ctx.resolve(s).value}, ${i.length}>`;return _chunkTRE7NUKEcjs.aa.call(void 0, _chunkTRE7NUKEcjs.Ea`${p}(${i})`,_chunkTRE7NUKEcjs.tc[_chunkTRE7NUKEcjs.a].jsImpl(s,i.length))}if(t[0]===g.stringLiteral)return _chunkTRE7NUKEcjs.aa.call(void 0, t[1],_chunkTRE7NUKEcjs.W);if(t[0]===g.preUpdate)throw new Error("Cannot use pre-updates in TGSL.");Er(t)}functionDefinition(t){return this.block(t)}statement(t){if(typeof t=="string")return`${this.ctx.pre}${this.ctx.resolve(this.identifier(t).value).value};`;if(typeof t=="boolean")return`${this.ctx.pre}${t?"true":"false"};`;if(t[0]===g.return){let n=t[1];if(n!==void 0){let r=this.ctx.topFunctionReturnType,a=r?this.typedExpression(n,r):this.expression(n);return _chunkTRE7NUKEcjs.ba.call(void 0, a.dataType.type!=="unknown","Return type should be known"),this.ctx.reportReturnType(a.dataType),_chunkTRE7NUKEcjs.Ea`${this.ctx.pre}return ${a};`}return`${this.ctx.pre}return;`}if(t[0]===g.if){let[n,r,a,s]=t,i=this.typedExpression(r,_chunkTRE7NUKEcjs.Qa),p=i.value===!1?void 0:this.block(vt(a)),d=i.value===!0||!s?void 0:this.block(vt(s));return i.value===!0?`${this.ctx.pre}${p}`:i.value===!1?d?`${this.ctx.pre}${d}`:"":d?_chunkTRE7NUKEcjs.Ea`\
|
|
5
|
-
${this.ctx.pre}if (${i}) ${p}
|
|
6
|
-
${this.ctx.pre}else ${d}`:_chunkTRE7NUKEcjs.Ea`${this.ctx.pre}if (${i}) ${p}`}if(t[0]===g.let||t[0]===g.const){let[n,r,a]=t,s=a!==void 0?this.expression(a):void 0;if(!s)throw new Error(`Cannot create variable '${r}' without an initial value.`);if(_chunkTRE7NUKEcjs.Q.call(void 0, s.dataType))throw new Error(`Cannot create variable '${r}' with loose data type.`);let i=this.blockVariable(r,yt(s.dataType));return _chunkTRE7NUKEcjs.Ea`${this.ctx.pre}var ${i.value} = ${s};`}if(t[0]===g.block)return this.block(t);if(t[0]===g.for){let[n,r,a,s,i]=t,[p,d,M]=this.ctx.withResetIndentLevel(()=>[r?this.statement(r):void 0,a?this.typedExpression(a,_chunkTRE7NUKEcjs.Qa):void 0,s?this.statement(s):void 0]),z=p?p.slice(0,-1):"",U=M?M.slice(0,-1):"",at=this.block(vt(i));return _chunkTRE7NUKEcjs.Ea`${this.ctx.pre}for (${z}; ${d}; ${U}) ${at}`}if(t[0]===g.while){let[n,r,a]=t,s=this.typedExpression(r,_chunkTRE7NUKEcjs.Qa),i=this.ctx.resolve(s.value).value,p=this.block(vt(a));return`${this.ctx.pre}while (${i}) ${p}`}return t[0]===g.continue?`${this.ctx.pre}continue;`:t[0]===g.break?`${this.ctx.pre}break;`:`${this.ctx.pre}${this.ctx.resolve(this.expression(t).value).value};`}};function Er(e){throw new Error(`'${_chunkTRE7NUKEcjs.lb.call(void 0, e)}' was not handled by the WGSL generator.`)}function Lr(e){return/^0x[0-9a-f]+$/i.test(e)?Number.parseInt(e):/^0b[01]+$/i.test(e)?Number.parseInt(e.slice(2),2):Number.parseFloat(e)}function vt(e){return typeof e!="object"||e[0]!==g.block?[g.block,[e]]:e}var Nr=new Gt,Bo= exports.jb =Nr;exports.a = Qe; exports.b = Tn; exports.c = xn; exports.d = dn; exports.e = gn; exports.f = hn; exports.g = vn; exports.h = bn; exports.i = wn; exports.j = ie; exports.k = le; exports.l = A; exports.m = Hr; exports.n = pt; exports.o = yt; exports.p = os; exports.q = Tt; exports.r = _t; exports.s = ys; exports.t = nn; exports.u = ws; exports.v = Ss; exports.w = Ms; exports.x = Is; exports.y = Vs; exports.z = dt; exports.A = In; exports.B = An; exports.C = $n; exports.D = zn; exports.E = Vn; exports.F = Fn; exports.G = Cn; exports.H = Pn; exports.I = kn; exports.J = Wn; exports.K = _n; exports.L = Fs; exports.M = Cs; exports.N = Ps; exports.O = ks; exports.P = Ws; exports.Q = _s; exports.R = Us; exports.S = Ds; exports.T = Gs; exports.U = Y; exports.V = J; exports.W = m; exports.X = Bt; exports.Y = Re; exports.Z = st; exports._ = Rt; exports.$ = na; exports.aa = ra; exports.ba = da; exports.ca = fa; exports.da = ga; exports.ea = ha; exports.fa = va; exports.ga = ba; exports.ha = wa; exports.ia = Sa; exports.ja = Ma; exports.ka = Ia; exports.la = Aa; exports.ma = $a; exports.na = za; exports.oa = Va; exports.pa = Fa; exports.qa = Ca; exports.ra = Pa; exports.sa = ka; exports.ta = Wa; exports.ua = cr; exports.va = _a; exports.wa = Ua; exports.xa = Da; exports.ya = Ba; exports.za = Ra; exports.Aa = Ga; exports.Ba = Ea; exports.Ca = La; exports.Da = Na; exports.Ea = Oa; exports.Fa = Ka; exports.Ga = qa; exports.Ha = ja; exports.Ia = Za; exports.Ja = Ha; exports.Ka = fr; exports.La = Qa; exports.Ma = Xa; exports.Na = Ya; exports.Oa = Ja; exports.Pa = eo; exports.Qa = to; exports.Ra = no; exports.Sa = ln; exports.Ta = ro; exports.Ua = so; exports.Va = ao; exports.Wa = oo; exports.Xa = uo; exports.Ya = co; exports.Za = io; exports._a = lo; exports.$a = mo; exports.ab = po; exports.bb = yo; exports.cb = To; exports.db = xo; exports.eb = fo; exports.fb = go; exports.gb = ho; exports.hb = vo; exports.ib = mn; exports.jb = Bo;
|
|
7
|
-
//# sourceMappingURL=chunk-ZYGTVBDH.cjs.map
|