typegpu 0.5.7 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import{$ as K,Aa as S,Ba as _,K as z,L as v,M as A,P as U,Q as O,T as $,U as c,W as E,X as T,Y as g,Z as m,_ as D,a as o,e as h,f as L,ka as s,la as w,ma as p,oa as f,qa as V,ra as F,ta as N,va as M,wa as d,ya as u}from"./chunk-SWJVYRFM.js";function X(t){let e=r=>r;return Object.setPrototypeOf(e,Y),e.propTypes=t,e}var Y={[o]:!0,type:"struct",$name(t){return L(this,t),this},toString(){return`struct:${h(this)??"<unnamed>"}`}};var b=(t,e)=>{let r=e-1,i=~r;return(t&r)===0?t:(t&i)+e};var n=class{constructor(e){this.type=e}[o]=!0},Z={uint8:s,uint8x2:F,uint8x4:_,sint8:w,sint8x2:V,sint8x4:S,unorm8:p,unorm8x2:f,unorm8x4:u,snorm8:p,snorm8x2:f,snorm8x4:u,uint16:s,uint16x2:F,uint16x4:_,sint16:w,sint16x2:V,sint16x4:S,unorm16:p,unorm16x2:f,unorm16x4:u,snorm16:p,snorm16x2:f,snorm16x4:u,float16:p,float16x2:f,float16x4:u,float32:p,float32x2:f,float32x3:N,float32x4:u,uint32:s,uint32x2:F,uint32x3:d,uint32x4:_,sint32:w,sint32x2:V,sint32x3:M,sint32x4:S,"unorm10-10-10-2":u,"unorm8x4-bgra":u},H=Object.keys(Z),Vt=new n("uint8"),Ft=new n("uint8x2"),St=new n("uint8x4"),_t=new n("sint8"),ht=new n("sint8x2"),Lt=new n("sint8x4"),Wt=new n("unorm8"),kt=new n("unorm8x2"),Pt=new n("unorm8x4"),zt=new n("snorm8"),Ut=new n("snorm8x2"),Ot=new n("snorm8x4"),$t=new n("uint16"),Et=new n("uint16x2"),Nt=new n("uint16x4"),Mt=new n("sint16"),Ct=new n("sint16x2"),Gt=new n("sint16x4"),jt=new n("unorm16"),Rt=new n("unorm16x2"),Kt=new n("unorm16x4"),Ht=new n("snorm16"),Jt=new n("snorm16x2"),qt=new n("snorm16x4"),Qt=new n("float16"),Xt=new n("float16x2"),Yt=new n("float16x4"),Zt=new n("float32"),te=new n("float32x2"),ee=new n("float32x3"),ne=new n("float32x4"),re=new n("uint32"),oe=new n("uint32x2"),ie=new n("uint32x3"),ae=new n("uint32x4"),se=new n("sint32"),ue=new n("sint32x2"),pe=new n("sint32x3"),xe=new n("sint32x4"),le=new n("unorm10-10-10-2"),me=new n("unorm8x4-bgra");var tt={f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2h:4,vec2i:8,vec2u:8,vec3f:16,vec3h:8,vec3i:16,vec3u:16,vec4f:16,vec4h:8,vec4i:16,vec4u:16,mat2x2f:8,mat3x3f:16,mat4x4f:16,atomic:4};function et(t){let e=t?.type,r=tt[e];if(r!==void 0)return r;if(A(t))return Object.values(t.propTypes).map(x).reduce((i,y)=>i>y?i:y);if(v(t))return x(t.elementType);if(g(t)){let i=Object.values(t.propTypes)[0];return i?D(i)??1:1}if(T(t))return D(t.elementType)??1;if(c(t)||m(t))return D(t)??x(t.inner);if(H.includes(e))return 1;throw new Error(`Cannot determine alignment of data: ${JSON.stringify(t)}`)}function nt(t){if(g(t)){let e=Object.values(t.propTypes)[0];return e?I(e):1}return T(t)?I(t.elementType):m(t)?D(t)??I(t.inner):D(t)??1}var J=new WeakMap,q=new WeakMap;function x(t){let e=J.get(t);return e===void 0&&(e=et(t),J.set(t,e)),e}function I(t){let e=q.get(t);return e===void 0&&(e=nt(t),q.set(t,e)),e}function rt(t){return x(t)}var ot={f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2h:4,vec2i:8,vec2u:8,vec3f:12,vec3h:6,vec3i:12,vec3u:12,vec4f:16,vec4h:8,vec4i:16,vec4u:16,mat2x2f:16,mat3x3f:48,mat4x4f:64,uint8:1,uint8x2:2,uint8x4:4,sint8:1,sint8x2:2,sint8x4:4,unorm8:1,unorm8x2:2,unorm8x4:4,snorm8:1,snorm8x2:2,snorm8x4:4,uint16:2,uint16x2:4,uint16x4:8,sint16:2,sint16x2:4,sint16x4:8,unorm16:2,unorm16x2:4,unorm16x4:8,snorm16:2,snorm16x2:4,snorm16x4:8,float16:2,float16x2:4,float16x4:8,float32:4,float32x2:8,float32x3:12,float32x4:16,uint32:4,uint32x2:8,uint32x3:12,uint32x4:16,sint32:4,sint32x2:8,sint32x3:12,sint32x4:16,"unorm10-10-10-2":4,"unorm8x4-bgra":4,atomic:4};function it(t){let e=0;for(let r of Object.values(t.propTypes)){if(Number.isNaN(e))throw new Error("Only the last property of a struct can be unbounded");if(e=b(e,x(r)),e+=l(r),Number.isNaN(e)&&r.type!=="array")throw new Error("Cannot nest unbounded struct within another struct")}return b(e,x(t))}function at(t){let e=0;for(let r of Object.values(t.propTypes)){let i=I(r);e=b(e,i),e+=l(r)}return e}function st(t){let e=ot[t?.type];if(e!==void 0)return e;if(A(t))return it(t);if(g(t))return at(t);if(v(t)){if(t.elementCount===0)return Number.NaN;let r=x(t.elementType);return b(l(t.elementType),r)*t.elementCount}if(T(t)){let r=I(t.elementType);return b(l(t.elementType),r)*t.elementCount}if(c(t)||m(t))return K(t)??l(t.inner);throw new Error(`Cannot determine size of data: ${t}`)}var Q=new WeakMap;function l(t){let e=Q.get(t);return e===void 0&&(e=st(t),Q.set(t,e)),e}function ut(t){return l(t)}function G(t,e){return new C(t,e)}var C=class{constructor(e,r){this.elementType=e;this.elementCount=r;if(Number.isNaN(l(e)))throw new Error("Cannot nest runtime sized arrays.");if(!Number.isInteger(r)||r<0)throw new Error(`Cannot create array schema with invalid element count: ${r}.`)}[o]=!0;type="array";toString(){return`arrayOf(${this.elementType})`}};function pt(t,e){return new j(t,e)}var j=class{constructor(e,r){this.elementType=e;this.elementCount=r;if(!Number.isInteger(r)||r<0)throw new Error(`Cannot create disarray schema with invalid element count: ${r}.`)}[o]=!0;type="disarray";"~reprPartial"};function xt(t){let e=r=>r;return Object.setPrototypeOf(e,lt),e.propTypes=t,e}var lt={[o]:!0,type:"unstruct",$name(t){return L(this,t),this},toString(){return`unstruct:${h(this)??"<unnamed>"}`}};function mt(t){return new R(t)}var R=class{constructor(e){this.inner=e}[o]=!0;type="atomic";"~memIdent";"~gpuRepr"};function B(t,e){return c(t)?new k(t.inner,[e,...t.attribs]):m(t)?new P(t.inner,[e,...t.attribs]):E(t)?new P(t,[e]):new k(t,[e])}function ct(t,e){return B(e,{[o]:!0,type:"@align",value:t})}function yt(t,e){return B(e,{[o]:!0,type:"@size",value:t})}function ft(t,e){return B(e,{[o]:!0,type:"@location",value:t})}function dt(t,e){return B(e,{[o]:!0,type:"@interpolate",value:t})}function Tt(t){return(c(t)||m(t))&&t.attribs.find($)!==void 0}function $e(t){return!c(t)&&!m(t)?"":t.attribs.map(e=>`${e.type}(${e.value}) `).join("")}var W=class{constructor(e,r){this.inner=e;this.attribs=r;let i=r.find(U)?.value,y=r.find(O)?.value;if(i!==void 0){if(i<=0)throw new Error(`Custom data alignment must be a positive number, got: ${i}.`);if(Math.log2(i)%1!==0)throw new Error(`Alignment has to be a power of 2, got: ${i}.`);if(z(this.inner)&&i%x(this.inner)!==0)throw new Error(`Custom alignment has to be a multiple of the standard data alignment. Got: ${i}, expected multiple of: ${x(this.inner)}.`)}if(y!==void 0){if(y<l(this.inner))throw new Error(`Custom data size cannot be smaller then the standard data size. Got: ${y}, expected at least: ${l(this.inner)}.`);if(y<=0)throw new Error(`Custom data size must be a positive number. Got: ${y}.`)}}[o]=!0},k=class extends W{[o]=!0;type="decorated";"~gpuRepr";"~reprPartial";"~memIdent"},P=class extends W{[o]=!0;type="loose-decorated"};function a(t,e){return B(t,{[o]:!0,type:"@builtin",value:e})}var gt={vertexIndex:a(s,"vertex_index"),instanceIndex:a(s,"instance_index"),position:a(u,"position"),clipDistances:a(G(s,8),"clip_distances"),frontFacing:a(p,"front_facing"),fragDepth:a(p,"frag_depth"),sampleIndex:a(s,"sample_index"),sampleMask:a(s,"sample_mask"),localInvocationId:a(d,"local_invocation_id"),localInvocationIndex:a(s,"local_invocation_index"),globalInvocationId:a(d,"global_invocation_id"),workgroupId:a(d,"workgroup_id"),numWorkgroups:a(d,"num_workgroups"),subgroupInvocationId:a(s,"subgroup_invocation_id"),subgroupSize:a(s,"subgroup_size")};export{b as a,Z as b,H as c,Vt as d,Ft as e,St as f,_t as g,ht as h,Lt as i,Wt as j,kt as k,Pt as l,zt as m,Ut as n,Ot as o,$t as p,Et as q,Nt as r,Mt as s,Ct as t,Gt as u,jt as v,Rt as w,Kt as x,Ht as y,Jt as z,qt as A,Qt as B,Xt as C,Yt as D,Zt as E,te as F,ee as G,ne as H,re as I,oe as J,ie as K,ae as L,se as M,ue as N,pe as O,xe as P,le as Q,me as R,x as S,I as T,rt as U,l as V,ut as W,G as X,ct as Y,yt as Z,ft as _,dt as $,Tt as aa,$e as ba,X as ca,pt as da,xt as ea,mt as fa,gt as ga};
2
+ //# sourceMappingURL=chunk-734H4JWF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/data/struct.ts","../src/mathUtils.ts","../src/data/vertexFormatData.ts","../src/data/alignmentOf.ts","../src/data/sizeOf.ts","../src/data/array.ts","../src/data/disarray.ts","../src/data/unstruct.ts","../src/data/atomic.ts","../src/data/attributes.ts","../src/builtin.ts"],"sourcesContent":["import { getName, setName } from '../shared/meta.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { AnyWgslData, WgslStruct } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Creates a struct schema that can be used to construct GPU buffers.\n * Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).\n * The order of members matches the passed in properties object.\n *\n * @example\n * const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });\n *\n * @param props Record with `string` keys and `TgpuData` values,\n * each entry describing one struct member.\n */\nexport function struct<TProps extends Record<string, AnyWgslData>>(\n props: TProps,\n): WgslStruct<TProps> {\n const struct = <T>(props: T) => props;\n Object.setPrototypeOf(struct, WgslStructImpl);\n struct.propTypes = props;\n\n return struct as WgslStruct<TProps>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst WgslStructImpl = {\n [$internal]: true,\n type: 'struct',\n\n $name(label: string) {\n setName(this, label);\n return this;\n },\n\n toString(): string {\n return `struct:${getName(this) ?? '<unnamed>'}`;\n },\n};\n","/**\n * @param value\n * @param modulo has to be power of 2\n */\nexport const roundUp = (value: number, modulo: number) => {\n const bitMask = modulo - 1;\n const invBitMask = ~bitMask;\n return (value & bitMask) === 0 ? value : (value & invBitMask) + modulo;\n};\n","import { $repr, type Infer } from '../shared/repr.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { VertexFormat } from '../shared/vertexFormat.ts';\nimport { f32, i32, u32 } from './numeric.ts';\nimport {\n vec2f,\n vec2i,\n vec2u,\n vec3f,\n vec3i,\n vec3u,\n vec4f,\n vec4i,\n vec4u,\n} from './vector.ts';\n\nexport type FormatToWGSLType<T extends VertexFormat> =\n (typeof formatToWGSLType)[T];\n\nexport interface TgpuVertexFormatData<T extends VertexFormat> {\n readonly [$internal]: true;\n readonly type: T;\n readonly [$repr]: Infer<FormatToWGSLType<T>>;\n}\n\nclass TgpuVertexFormatDataImpl<T extends VertexFormat>\n implements TgpuVertexFormatData<T> {\n public readonly [$internal] = true;\n /** Used as a type-token for the `Infer<T>` functionality. */\n declare public readonly [$repr]: Infer<FormatToWGSLType<T>>;\n\n constructor(public readonly type: T) {}\n}\n\nexport const formatToWGSLType = {\n uint8: u32,\n uint8x2: vec2u,\n uint8x4: vec4u,\n sint8: i32,\n sint8x2: vec2i,\n sint8x4: vec4i,\n unorm8: f32,\n unorm8x2: vec2f,\n unorm8x4: vec4f,\n snorm8: f32,\n snorm8x2: vec2f,\n snorm8x4: vec4f,\n uint16: u32,\n uint16x2: vec2u,\n uint16x4: vec4u,\n sint16: i32,\n sint16x2: vec2i,\n sint16x4: vec4i,\n unorm16: f32,\n unorm16x2: vec2f,\n unorm16x4: vec4f,\n snorm16: f32,\n snorm16x2: vec2f,\n snorm16x4: vec4f,\n float16: f32,\n float16x2: vec2f,\n float16x4: vec4f,\n float32: f32,\n float32x2: vec2f,\n float32x3: vec3f,\n float32x4: vec4f,\n uint32: u32,\n uint32x2: vec2u,\n uint32x3: vec3u,\n uint32x4: vec4u,\n sint32: i32,\n sint32x2: vec2i,\n sint32x3: vec3i,\n sint32x4: vec4i,\n 'unorm10-10-10-2': vec4f,\n 'unorm8x4-bgra': vec4f,\n} as const;\n\nexport const packedFormats = Object.keys(formatToWGSLType);\n\nexport type uint8 = TgpuVertexFormatData<'uint8'>;\nexport const uint8 = new TgpuVertexFormatDataImpl('uint8') as uint8;\n\nexport type uint8x2 = TgpuVertexFormatData<'uint8x2'>;\nexport const uint8x2 = new TgpuVertexFormatDataImpl('uint8x2') as uint8x2;\n\nexport type uint8x4 = TgpuVertexFormatData<'uint8x4'>;\nexport const uint8x4 = new TgpuVertexFormatDataImpl('uint8x4') as uint8x4;\n\nexport type sint8 = TgpuVertexFormatData<'sint8'>;\nexport const sint8 = new TgpuVertexFormatDataImpl('sint8') as sint8;\n\nexport type sint8x2 = TgpuVertexFormatData<'sint8x2'>;\nexport const sint8x2 = new TgpuVertexFormatDataImpl('sint8x2') as sint8x2;\n\nexport type sint8x4 = TgpuVertexFormatData<'sint8x4'>;\nexport const sint8x4 = new TgpuVertexFormatDataImpl('sint8x4') as sint8x4;\n\nexport type unorm8 = TgpuVertexFormatData<'unorm8'>;\nexport const unorm8 = new TgpuVertexFormatDataImpl('unorm8') as unorm8;\n\nexport type unorm8x2 = TgpuVertexFormatData<'unorm8x2'>;\nexport const unorm8x2 = new TgpuVertexFormatDataImpl('unorm8x2') as unorm8x2;\n\nexport type unorm8x4 = TgpuVertexFormatData<'unorm8x4'>;\nexport const unorm8x4 = new TgpuVertexFormatDataImpl('unorm8x4') as unorm8x4;\n\nexport type snorm8 = TgpuVertexFormatData<'snorm8'>;\nexport const snorm8 = new TgpuVertexFormatDataImpl('snorm8') as snorm8;\n\nexport type snorm8x2 = TgpuVertexFormatData<'snorm8x2'>;\nexport const snorm8x2 = new TgpuVertexFormatDataImpl('snorm8x2') as snorm8x2;\n\nexport type snorm8x4 = TgpuVertexFormatData<'snorm8x4'>;\nexport const snorm8x4 = new TgpuVertexFormatDataImpl('snorm8x4') as snorm8x4;\n\nexport type uint16 = TgpuVertexFormatData<'uint16'>;\nexport const uint16 = new TgpuVertexFormatDataImpl('uint16') as uint16;\n\nexport type uint16x2 = TgpuVertexFormatData<'uint16x2'>;\nexport const uint16x2 = new TgpuVertexFormatDataImpl('uint16x2') as uint16x2;\n\nexport type uint16x4 = TgpuVertexFormatData<'uint16x4'>;\nexport const uint16x4 = new TgpuVertexFormatDataImpl('uint16x4') as uint16x4;\n\nexport type sint16 = TgpuVertexFormatData<'sint16'>;\nexport const sint16 = new TgpuVertexFormatDataImpl('sint16') as sint16;\n\nexport type sint16x2 = TgpuVertexFormatData<'sint16x2'>;\nexport const sint16x2 = new TgpuVertexFormatDataImpl('sint16x2') as sint16x2;\n\nexport type sint16x4 = TgpuVertexFormatData<'sint16x4'>;\nexport const sint16x4 = new TgpuVertexFormatDataImpl('sint16x4') as sint16x4;\n\nexport type unorm16 = TgpuVertexFormatData<'unorm16'>;\nexport const unorm16 = new TgpuVertexFormatDataImpl('unorm16') as unorm16;\n\nexport type unorm16x2 = TgpuVertexFormatData<'unorm16x2'>;\nexport const unorm16x2 = new TgpuVertexFormatDataImpl('unorm16x2') as unorm16x2;\n\nexport type unorm16x4 = TgpuVertexFormatData<'unorm16x4'>;\nexport const unorm16x4 = new TgpuVertexFormatDataImpl('unorm16x4') as unorm16x4;\n\nexport type snorm16 = TgpuVertexFormatData<'snorm16'>;\nexport const snorm16 = new TgpuVertexFormatDataImpl('snorm16') as snorm16;\n\nexport type snorm16x2 = TgpuVertexFormatData<'snorm16x2'>;\nexport const snorm16x2 = new TgpuVertexFormatDataImpl('snorm16x2') as snorm16x2;\n\nexport type snorm16x4 = TgpuVertexFormatData<'snorm16x4'>;\nexport const snorm16x4 = new TgpuVertexFormatDataImpl('snorm16x4') as snorm16x4;\n\nexport type float16 = TgpuVertexFormatData<'float16'>;\nexport const float16 = new TgpuVertexFormatDataImpl('float16') as float16;\n\nexport type float16x2 = TgpuVertexFormatData<'float16x2'>;\nexport const float16x2 = new TgpuVertexFormatDataImpl('float16x2') as float16x2;\n\nexport type float16x4 = TgpuVertexFormatData<'float16x4'>;\nexport const float16x4 = new TgpuVertexFormatDataImpl('float16x4') as float16x4;\n\nexport type float32 = TgpuVertexFormatData<'float32'>;\nexport const float32 = new TgpuVertexFormatDataImpl('float32') as float32;\n\nexport type float32x2 = TgpuVertexFormatData<'float32x2'>;\nexport const float32x2 = new TgpuVertexFormatDataImpl('float32x2') as float32x2;\n\nexport type float32x3 = TgpuVertexFormatData<'float32x3'>;\nexport const float32x3 = new TgpuVertexFormatDataImpl('float32x3') as float32x3;\n\nexport type float32x4 = TgpuVertexFormatData<'float32x4'>;\nexport const float32x4 = new TgpuVertexFormatDataImpl('float32x4') as float32x4;\n\nexport type uint32 = TgpuVertexFormatData<'uint32'>;\nexport const uint32 = new TgpuVertexFormatDataImpl('uint32') as uint32;\n\nexport type uint32x2 = TgpuVertexFormatData<'uint32x2'>;\nexport const uint32x2 = new TgpuVertexFormatDataImpl('uint32x2') as uint32x2;\n\nexport type uint32x3 = TgpuVertexFormatData<'uint32x3'>;\nexport const uint32x3 = new TgpuVertexFormatDataImpl('uint32x3') as uint32x3;\n\nexport type uint32x4 = TgpuVertexFormatData<'uint32x4'>;\nexport const uint32x4 = new TgpuVertexFormatDataImpl('uint32x4') as uint32x4;\n\nexport type sint32 = TgpuVertexFormatData<'sint32'>;\nexport const sint32 = new TgpuVertexFormatDataImpl('sint32') as sint32;\n\nexport type sint32x2 = TgpuVertexFormatData<'sint32x2'>;\nexport const sint32x2 = new TgpuVertexFormatDataImpl('sint32x2') as sint32x2;\n\nexport type sint32x3 = TgpuVertexFormatData<'sint32x3'>;\nexport const sint32x3 = new TgpuVertexFormatDataImpl('sint32x3') as sint32x3;\n\nexport type sint32x4 = TgpuVertexFormatData<'sint32x4'>;\nexport const sint32x4 = new TgpuVertexFormatDataImpl('sint32x4') as sint32x4;\n\nexport type unorm10_10_10_2 = TgpuVertexFormatData<'unorm10-10-10-2'>;\nexport const unorm10_10_10_2 = new TgpuVertexFormatDataImpl(\n 'unorm10-10-10-2',\n) as unorm10_10_10_2;\n\nexport type unorm8x4_bgra = TgpuVertexFormatData<'unorm8x4-bgra'>;\nexport const unorm8x4_bgra = new TgpuVertexFormatDataImpl(\n 'unorm8x4-bgra',\n) as unorm8x4_bgra;\n\nexport type PackedData =\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","import {\n type AnyData,\n getCustomAlignment,\n isDisarray,\n isLooseDecorated,\n isUnstruct,\n} from './dataTypes.ts';\nimport { packedFormats } from './vertexFormatData.ts';\nimport {\n type BaseData,\n isDecorated,\n isWgslArray,\n isWgslStruct,\n} from './wgslTypes.ts';\n\nconst knownAlignmentMap: Record<string, number> = {\n f32: 4,\n f16: 2,\n i32: 4,\n u32: 4,\n vec2f: 8,\n vec2h: 4,\n vec2i: 8,\n vec2u: 8,\n vec3f: 16,\n vec3h: 8,\n vec3i: 16,\n vec3u: 16,\n vec4f: 16,\n vec4h: 8,\n vec4i: 16,\n vec4u: 16,\n mat2x2f: 8,\n mat3x3f: 16,\n mat4x4f: 16,\n atomic: 4,\n};\n\nfunction computeAlignment(data: object): number {\n const dataType = (data as BaseData)?.type;\n const knownAlignment = knownAlignmentMap[dataType];\n if (knownAlignment !== undefined) {\n return knownAlignment;\n }\n\n if (isWgslStruct(data)) {\n return Object.values(data.propTypes)\n .map(alignmentOf)\n .reduce((a, b) => (a > b ? a : b));\n }\n\n if (isWgslArray(data)) {\n return alignmentOf(data.elementType);\n }\n\n if (isUnstruct(data)) {\n // A loose struct is aligned to its first property.\n const firstProp = Object.values(data.propTypes)[0];\n return firstProp ? (getCustomAlignment(firstProp) ?? 1) : 1;\n }\n\n if (isDisarray(data)) {\n return getCustomAlignment(data.elementType) ?? 1;\n }\n\n if (isDecorated(data) || isLooseDecorated(data)) {\n return getCustomAlignment(data) ?? alignmentOf(data.inner);\n }\n\n if (packedFormats.includes(dataType)) {\n return 1;\n }\n\n throw new Error(\n `Cannot determine alignment of data: ${JSON.stringify(data)}`,\n );\n}\n\nfunction computeCustomAlignment(data: BaseData): number {\n if (isUnstruct(data)) {\n // A loose struct is aligned to its first property.\n const firstProp = Object.values(data.propTypes)[0];\n return firstProp ? customAlignmentOf(firstProp) : 1;\n }\n\n if (isDisarray(data)) {\n return customAlignmentOf(data.elementType);\n }\n\n if (isLooseDecorated(data)) {\n return getCustomAlignment(data) ?? customAlignmentOf(data.inner);\n }\n\n return getCustomAlignment(data) ?? 1;\n}\n\n/**\n * Since alignments can be inferred from data types, they are not stored on them.\n * Instead, this weak map acts as an extended property of those data types.\n */\nconst cachedAlignments = new WeakMap<object, number>();\n\nconst cachedCustomAlignments = new WeakMap<object, number>();\n\nexport function alignmentOf(data: BaseData): number {\n let alignment = cachedAlignments.get(data);\n if (alignment === undefined) {\n alignment = computeAlignment(data);\n cachedAlignments.set(data, alignment);\n }\n\n return alignment;\n}\n\nexport function customAlignmentOf(data: BaseData): number {\n let alignment = cachedCustomAlignments.get(data);\n if (alignment === undefined) {\n alignment = computeCustomAlignment(data);\n cachedCustomAlignments.set(data, alignment);\n }\n\n return alignment;\n}\n\n/**\n * Returns the alignment (in bytes) of data represented by the `schema`.\n */\nexport function PUBLIC_alignmentOf(schema: AnyData): number {\n return alignmentOf(schema);\n}\n","import { roundUp } from '../mathUtils.ts';\nimport { alignmentOf, customAlignmentOf } from './alignmentOf.ts';\nimport type { AnyData, LooseTypeLiteral, Unstruct } from './dataTypes.ts';\nimport {\n getCustomSize,\n isDisarray,\n isLooseDecorated,\n isUnstruct,\n} from './dataTypes.ts';\nimport type { BaseData, WgslStruct, WgslTypeLiteral } from './wgslTypes.ts';\nimport { isDecorated, isWgslArray, isWgslStruct } from './wgslTypes.ts';\n\nconst knownSizesMap: Record<string, number> = {\n f32: 4,\n f16: 2,\n i32: 4,\n u32: 4,\n vec2f: 8,\n vec2h: 4,\n vec2i: 8,\n vec2u: 8,\n vec3f: 12,\n vec3h: 6,\n vec3i: 12,\n vec3u: 12,\n vec4f: 16,\n vec4h: 8,\n vec4i: 16,\n vec4u: 16,\n mat2x2f: 16,\n mat3x3f: 48,\n mat4x4f: 64,\n uint8: 1,\n uint8x2: 2,\n uint8x4: 4,\n sint8: 1,\n sint8x2: 2,\n sint8x4: 4,\n unorm8: 1,\n unorm8x2: 2,\n unorm8x4: 4,\n snorm8: 1,\n snorm8x2: 2,\n snorm8x4: 4,\n uint16: 2,\n uint16x2: 4,\n uint16x4: 8,\n sint16: 2,\n sint16x2: 4,\n sint16x4: 8,\n unorm16: 2,\n unorm16x2: 4,\n unorm16x4: 8,\n snorm16: 2,\n snorm16x2: 4,\n snorm16x4: 8,\n float16: 2,\n float16x2: 4,\n float16x4: 8,\n float32: 4,\n float32x2: 8,\n float32x3: 12,\n float32x4: 16,\n uint32: 4,\n uint32x2: 8,\n uint32x3: 12,\n uint32x4: 16,\n sint32: 4,\n sint32x2: 8,\n sint32x3: 12,\n sint32x4: 16,\n 'unorm10-10-10-2': 4,\n 'unorm8x4-bgra': 4,\n atomic: 4,\n} satisfies Partial<Record<WgslTypeLiteral | LooseTypeLiteral, number>>;\n\nfunction sizeOfStruct(struct: WgslStruct) {\n let size = 0;\n for (const property of Object.values(struct.propTypes)) {\n if (Number.isNaN(size)) {\n throw new Error('Only the last property of a struct can be unbounded');\n }\n\n size = roundUp(size, alignmentOf(property));\n size += sizeOf(property);\n\n if (Number.isNaN(size) && property.type !== 'array') {\n throw new Error('Cannot nest unbounded struct within another struct');\n }\n }\n\n return roundUp(size, alignmentOf(struct));\n}\n\nfunction sizeOfUnstruct(data: Unstruct) {\n let size = 0;\n\n for (const property of Object.values(data.propTypes)) {\n const alignment = customAlignmentOf(property);\n size = roundUp(size, alignment);\n size += sizeOf(property);\n }\n\n return size;\n}\n\nfunction computeSize(data: object): number {\n const knownSize = knownSizesMap[(data as BaseData)?.type];\n\n if (knownSize !== undefined) {\n return knownSize;\n }\n\n if (isWgslStruct(data)) {\n return sizeOfStruct(data);\n }\n\n if (isUnstruct(data)) {\n return sizeOfUnstruct(data);\n }\n\n if (isWgslArray(data)) {\n if (data.elementCount === 0) {\n return Number.NaN;\n }\n\n const alignment = alignmentOf(data.elementType);\n const stride = roundUp(sizeOf(data.elementType), alignment);\n return stride * data.elementCount;\n }\n\n if (isDisarray(data)) {\n const alignment = customAlignmentOf(data.elementType);\n const stride = roundUp(sizeOf(data.elementType), alignment);\n return stride * data.elementCount;\n }\n\n if (isDecorated(data) || isLooseDecorated(data)) {\n return getCustomSize(data) ?? sizeOf(data.inner);\n }\n\n throw new Error(`Cannot determine size of data: ${data}`);\n}\n\n/**\n * Since sizes can be inferred from data types, they are not stored on them.\n * Instead, this weak map acts as an extended property of those data types.\n */\nconst cachedSizes = new WeakMap<BaseData, number>();\n\nexport function sizeOf(schema: BaseData): number {\n let size = cachedSizes.get(schema);\n\n if (size === undefined) {\n size = computeSize(schema);\n cachedSizes.set(schema, size);\n }\n\n return size;\n}\n\n/**\n * Returns the size (in bytes) of data represented by the `schema`.\n */\nexport function PUBLIC_sizeOf(schema: AnyData): number {\n return sizeOf(schema);\n}\n","import type {\n $repr,\n Infer,\n InferGPU,\n InferPartial,\n MemIdentity,\n} from '../shared/repr.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport { sizeOf } from './sizeOf.ts';\nimport type { AnyWgslData, BaseData, WgslArray } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Creates an array schema that can be used to construct gpu buffers.\n * Describes arrays with fixed-size length, storing elements of the same type.\n *\n * @example\n * const LENGTH = 3;\n * const array = d.arrayOf(d.u32, LENGTH);\n *\n * @param elementType The type of elements in the array.\n * @param elementCount The number of elements in the array.\n */\nexport function arrayOf<TElement extends AnyWgslData>(\n elementType: TElement,\n elementCount: number,\n): WgslArray<TElement> {\n return new WgslArrayImpl(elementType, elementCount);\n}\n\n// --------------\n// Implementation\n// --------------\n\nclass WgslArrayImpl<TElement extends BaseData> implements WgslArray<TElement> {\n public readonly [$internal] = true;\n public readonly type = 'array';\n /** Type-token, not available at runtime */\n declare public readonly [$repr]: Infer<TElement>[];\n /** Type-token, not available at runtime */\n declare public readonly '~gpuRepr': InferGPU<TElement>[];\n /** Type-token, not available at runtime */\n declare public readonly '~reprPartial': {\n idx: number;\n value: InferPartial<TElement>;\n }[];\n /** Type-token, not available at runtime */\n declare public readonly '~memIdent': WgslArray<MemIdentity<TElement>>;\n\n constructor(\n public readonly elementType: TElement,\n public readonly elementCount: number,\n ) {\n if (Number.isNaN(sizeOf(elementType))) {\n throw new Error('Cannot nest runtime sized arrays.');\n }\n\n if (!Number.isInteger(elementCount) || elementCount < 0) {\n throw new Error(\n `Cannot create array schema with invalid element count: ${elementCount}.`,\n );\n }\n }\n\n toString() {\n return `arrayOf(${this.elementType})`;\n }\n}\n","import type { $repr, Infer, InferPartial } from '../shared/repr.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { AnyData, Disarray } from './dataTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Creates an array schema that can be used to construct vertex buffers.\n * Describes arrays with fixed-size length, storing elements of the same type.\n *\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 *\n * @example\n * const disarray = d.disarrayOf(d.vec3f, 3); // packed array of vec3f\n *\n * @example\n * const disarray = d.disarrayOf(d.align(16, d.vec3f), 3);\n *\n * @param elementType The type of elements in the array.\n * @param count The number of elements in the array.\n */\nexport function disarrayOf<TElement extends AnyData>(\n elementType: TElement,\n count: number,\n): Disarray<TElement> {\n return new DisarrayImpl(elementType, count);\n}\n\n// --------------\n// Implementation\n// --------------\n\nclass DisarrayImpl<TElement extends AnyData> implements Disarray<TElement> {\n public readonly [$internal] = true;\n public readonly type = 'disarray';\n /** Type-token, not available at runtime */\n declare public readonly [$repr]: Infer<TElement>[];\n /** Type-token, not available at runtime */\n public readonly '~reprPartial'!: {\n idx: number;\n value: InferPartial<TElement>;\n }[];\n\n constructor(\n public readonly elementType: TElement,\n public readonly elementCount: number,\n ) {\n if (!Number.isInteger(elementCount) || elementCount < 0) {\n throw new Error(\n `Cannot create disarray schema with invalid element count: ${elementCount}.`,\n );\n }\n }\n}\n","import { getName, setName } from '../shared/meta.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { Unstruct } from './dataTypes.ts';\nimport type { BaseData } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Creates a loose struct schema that can be used to construct vertex buffers.\n * Describes structs with members of both loose and non-loose types.\n *\n * The order of members matches the passed in properties object.\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 *\n * @example\n * const CircleStruct = d.unstruct({ radius: d.f32, pos: d.vec3f }); // packed struct with no padding\n *\n * @example\n * const CircleStruct = d.unstruct({ radius: d.f32, pos: d.align(16, d.vec3f) });\n *\n * @param properties Record with `string` keys and `TgpuData` or `TgpuLooseData` values,\n * each entry describing one struct member.\n */\nexport function unstruct<TProps extends Record<string, BaseData>>(\n properties: TProps,\n): Unstruct<TProps> {\n const unstruct = <T>(props: T) => props;\n Object.setPrototypeOf(unstruct, UnstructImpl);\n unstruct.propTypes = properties;\n\n return unstruct as unknown as Unstruct<TProps>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst UnstructImpl = {\n [$internal]: true,\n type: 'unstruct',\n\n $name(label: string) {\n setName(this, label);\n return this;\n },\n\n toString(): string {\n return `unstruct:${getName(this) ?? '<unnamed>'}`;\n },\n};\n","import type { $repr, Infer, MemIdentity } from '../shared/repr.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { Atomic, atomicI32, atomicU32, I32, U32 } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Marks a concrete integer scalar type schema (u32 or i32) as a WGSL atomic.\n *\n * @example\n * const atomicU32 = d.atomic(d.u32);\n * const atomicI32 = d.atomic(d.i32);\n *\n * @param data Underlying type schema.\n */\nexport function atomic<TSchema extends U32 | I32>(\n data: TSchema,\n): Atomic<TSchema> {\n return new AtomicImpl(data);\n}\n\n// --------------\n// Implementation\n// --------------\n\nclass AtomicImpl<TSchema extends U32 | I32> implements Atomic<TSchema> {\n public readonly [$internal] = true;\n public readonly type = 'atomic';\n /** Type-token, not available at runtime */\n declare public readonly [$repr]: Infer<TSchema>;\n /** Type-token, not available at runtime */\n public readonly '~memIdent'!: MemIdentity<TSchema>;\n /** Type-token, not available at runtime */\n public readonly '~gpuRepr': TSchema extends U32 ? atomicU32 : atomicI32;\n\n constructor(public readonly inner: TSchema) {}\n}\n","import type {\n $repr,\n Infer,\n InferGPU,\n InferPartial,\n MemIdentity,\n} from '../shared/repr.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport { alignmentOf } from './alignmentOf.ts';\nimport {\n type AnyData,\n type AnyLooseData,\n isLooseData,\n isLooseDecorated,\n type LooseDecorated,\n type LooseTypeLiteral,\n} from './dataTypes.ts';\nimport { sizeOf } from './sizeOf.ts';\nimport {\n type Align,\n type AnyWgslData,\n type BaseData,\n type Builtin,\n type Decorated,\n type FlatInterpolatableData,\n type FlatInterpolationType,\n type Interpolate,\n type InterpolationType,\n isAlignAttrib,\n isBuiltinAttrib,\n isDecorated,\n isSizeAttrib,\n isWgslData,\n type Location,\n type PerspectiveOrLinearInterpolatableData,\n type PerspectiveOrLinearInterpolationType,\n type Size,\n type WgslTypeLiteral,\n} from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\nexport const builtinNames = [\n 'vertex_index',\n 'instance_index',\n 'position',\n 'clip_distances',\n 'front_facing',\n 'frag_depth',\n 'sample_index',\n 'sample_mask',\n 'fragment',\n 'local_invocation_id',\n 'local_invocation_index',\n 'global_invocation_id',\n 'workgroup_id',\n 'num_workgroups',\n 'subgroup_invocation_id',\n 'subgroup_size',\n] as const;\n\nexport type BuiltinName = (typeof builtinNames)[number];\n\nexport type AnyAttribute<\n AllowedBuiltins extends Builtin<BuiltinName> = Builtin<BuiltinName>,\n> =\n | Align<number>\n | Size<number>\n | Location<number>\n | Interpolate<InterpolationType>\n | AllowedBuiltins;\n\nexport type ExtractAttributes<T> = T extends {\n readonly attribs: unknown[];\n} ? T['attribs']\n : [];\n\ntype Undecorate<T> = T extends { readonly inner: infer TInner } ? TInner : T;\n\n/**\n * Decorates a data-type `TData` with an attribute `TAttrib`.\n *\n * - if `TData` is loose\n * - if `TData` is already `LooseDecorated`\n * - Prepend `TAttrib` to the existing attribute tuple.\n * - else\n * - Wrap `TData` with `LooseDecorated` and a single attribute `[TAttrib]`\n * - else\n * - if `TData` is already `Decorated`\n * - Prepend `TAttrib` to the existing attribute tuple.\n * - else\n * - Wrap `TData` with `Decorated` and a single attribute `[TAttrib]`\n */\nexport type Decorate<\n TData extends BaseData,\n TAttrib extends AnyAttribute,\n> = TData['type'] extends WgslTypeLiteral\n ? Decorated<Undecorate<TData>, [TAttrib, ...ExtractAttributes<TData>]>\n : TData['type'] extends LooseTypeLiteral\n ? LooseDecorated<Undecorate<TData>, [TAttrib, ...ExtractAttributes<TData>]>\n : never;\n\nexport type IsBuiltin<T> = ExtractAttributes<T>[number] extends [] ? false\n : ExtractAttributes<T>[number] extends Builtin<BuiltinName> ? true\n : false;\n\nexport type HasCustomLocation<T> = ExtractAttributes<T>[number] extends []\n ? false\n : ExtractAttributes<T>[number] extends Location ? true\n : false;\n\nexport function attribute<TData extends BaseData, TAttrib extends AnyAttribute>(\n data: TData,\n attrib: TAttrib,\n): Decorated | LooseDecorated {\n if (isDecorated(data)) {\n return new DecoratedImpl(data.inner, [\n attrib,\n ...data.attribs,\n ]) as Decorated;\n }\n\n if (isLooseDecorated(data)) {\n return new LooseDecoratedImpl(data.inner, [\n attrib,\n ...data.attribs,\n ]) as LooseDecorated;\n }\n\n if (isLooseData(data)) {\n return new LooseDecoratedImpl(data, [attrib]) as unknown as LooseDecorated;\n }\n\n return new DecoratedImpl(data, [attrib]) as unknown as Decorated;\n}\n\n/**\n * Gives the wrapped data-type a custom byte alignment. Useful in order to\n * fulfill uniform alignment requirements.\n *\n * @example\n * const Data = d.struct({\n * a: u32, // takes up 4 bytes\n * // 12 bytes of padding, because `b` is custom aligned to multiples of 16 bytes\n * b: d.align(16, u32),\n * });\n *\n * @param alignment The multiple of bytes this data should align itself to.\n * @param data The data-type to align.\n */\nexport function align<TAlign extends number, TData extends AnyData>(\n alignment: TAlign,\n data: TData,\n): Decorate<TData, Align<TAlign>> {\n return attribute(data, {\n [$internal]: true,\n type: '@align',\n value: alignment,\n // biome-ignore lint/suspicious/noExplicitAny: <tired of lying to types>\n }) as any;\n}\n\n/**\n * Adds padding bytes after the wrapped data-type, until the whole value takes up `size` bytes.\n *\n * @example\n * const Data = d.struct({\n * a: d.size(16, u32), // takes up 16 bytes, instead of 4\n * b: u32, // starts at byte 16, because `a` has a custom size\n * });\n *\n * @param size The amount of bytes that should be reserved for this data-type.\n * @param data The data-type to wrap.\n */\nexport function size<TSize extends number, TData extends AnyData>(\n size: TSize,\n data: TData,\n): Decorate<TData, Size<TSize>> {\n return attribute(data, {\n [$internal]: true,\n type: '@size',\n value: size,\n // biome-ignore lint/suspicious/noExplicitAny: <tired of lying to types>\n }) as any;\n}\n\n/**\n * Assigns an explicit numeric location to a struct member or a parameter that has this type.\n *\n * @example\n * const VertexOutput = {\n * a: d.u32, // has implicit location 0\n * b: d.location(5, d.u32),\n * c: d.u32, // has implicit location 6\n * };\n *\n * @param location The explicit numeric location.\n * @param data The data-type to wrap.\n */\nexport function location<TLocation extends number, TData extends AnyData>(\n location: TLocation,\n data: TData,\n): Decorate<TData, Location<TLocation>> {\n return attribute(data, {\n [$internal]: true,\n type: '@location',\n value: location,\n // biome-ignore lint/suspicious/noExplicitAny: <tired of lying to types>\n }) as any;\n}\n\n/**\n * Specifies how user-defined vertex shader output (fragment shader input)\n * must be interpolated.\n *\n * Tip: Integer outputs cannot be interpolated.\n *\n * @example\n * const VertexOutput = {\n * a: d.f32, // has implicit 'perspective, center' interpolation\n * b: d.interpolate('linear, sample', d.f32),\n * };\n *\n * @param interpolationType How data should be interpolated.\n * @param data The data-type to wrap.\n */\nexport function interpolate<\n TInterpolation extends PerspectiveOrLinearInterpolationType,\n TData extends PerspectiveOrLinearInterpolatableData,\n>(\n interpolationType: TInterpolation,\n data: TData,\n): Decorate<TData, Interpolate<TInterpolation>>;\n\n/**\n * Specifies how user-defined vertex shader output (fragment shader input)\n * must be interpolated.\n *\n * Tip: Default sampling method of `flat` is `first`. Unless you specifically\n * need deterministic behavior provided by `'flat, first'`, prefer explicit\n * `'flat, either'` as it could be slightly faster in hardware.\n *\n * @example\n * const VertexOutput = {\n * a: d.f32, // has implicit 'perspective, center' interpolation\n * b: d.interpolate('flat, either', d.u32), // integer outputs cannot interpolate\n * };\n *\n * @param interpolationType How data should be interpolated.\n * @param data The data-type to wrap.\n */\nexport function interpolate<\n TInterpolation extends FlatInterpolationType,\n TData extends FlatInterpolatableData,\n>(\n interpolationType: TInterpolation,\n data: TData,\n): Decorate<TData, Interpolate<TInterpolation>>;\n\nexport function interpolate<\n TInterpolation extends InterpolationType,\n TData extends AnyData,\n>(\n interpolationType: TInterpolation,\n data: TData,\n): Decorate<TData, Interpolate<TInterpolation>> {\n return attribute(data, {\n [$internal]: true,\n type: '@interpolate',\n value: interpolationType,\n // biome-ignore lint/suspicious/noExplicitAny: <tired of lying to types>\n }) as any;\n}\n\nexport function isBuiltin<\n T extends\n | Decorated<AnyWgslData, AnyAttribute[]>\n | LooseDecorated<AnyLooseData, AnyAttribute[]>,\n>(value: T | unknown): value is T {\n return (\n (isDecorated(value) || isLooseDecorated(value)) &&\n value.attribs.find(isBuiltinAttrib) !== undefined\n );\n}\n\nexport function getAttributesString<T extends BaseData>(field: T): string {\n if (!isDecorated(field) && !isLooseDecorated(field)) {\n return '';\n }\n\n return (field.attribs as AnyAttribute[])\n .map((attrib) => `${attrib.type}(${attrib.value}) `)\n .join('');\n}\n\n// --------------\n// Implementation\n// --------------\n\nclass BaseDecoratedImpl<TInner extends BaseData, TAttribs extends unknown[]> {\n public readonly [$internal] = true;\n declare public readonly [$repr]: Infer<TInner>;\n\n constructor(\n public readonly inner: TInner,\n public readonly attribs: TAttribs,\n ) {\n const alignAttrib = attribs.find(isAlignAttrib)?.value;\n const sizeAttrib = attribs.find(isSizeAttrib)?.value;\n\n if (alignAttrib !== undefined) {\n if (alignAttrib <= 0) {\n throw new Error(\n `Custom data alignment must be a positive number, got: ${alignAttrib}.`,\n );\n }\n\n if (Math.log2(alignAttrib) % 1 !== 0) {\n throw new Error(\n `Alignment has to be a power of 2, got: ${alignAttrib}.`,\n );\n }\n\n if (isWgslData(this.inner)) {\n if (alignAttrib % alignmentOf(this.inner) !== 0) {\n throw new Error(\n `Custom alignment has to be a multiple of the standard data alignment. Got: ${alignAttrib}, expected multiple of: ${\n alignmentOf(this.inner)\n }.`,\n );\n }\n }\n }\n\n if (sizeAttrib !== undefined) {\n if (sizeAttrib < sizeOf(this.inner)) {\n throw new Error(\n `Custom data size cannot be smaller then the standard data size. Got: ${sizeAttrib}, expected at least: ${\n sizeOf(this.inner)\n }.`,\n );\n }\n\n if (sizeAttrib <= 0) {\n throw new Error(\n `Custom data size must be a positive number. Got: ${sizeAttrib}.`,\n );\n }\n }\n }\n}\n\nclass DecoratedImpl<TInner extends BaseData, TAttribs extends unknown[]>\n extends BaseDecoratedImpl<TInner, TAttribs>\n implements Decorated<TInner, TAttribs> {\n public readonly [$internal] = true;\n public readonly type = 'decorated';\n readonly '~gpuRepr': InferGPU<TInner>;\n readonly '~reprPartial': InferPartial<TInner>;\n public readonly '~memIdent'!: TAttribs extends Location[]\n ? MemIdentity<TInner> | Decorated<MemIdentity<TInner>, TAttribs>\n : Decorated<MemIdentity<TInner>, TAttribs>;\n}\n\nclass LooseDecoratedImpl<TInner extends BaseData, TAttribs extends unknown[]>\n extends BaseDecoratedImpl<TInner, TAttribs>\n implements LooseDecorated<TInner, TAttribs> {\n public readonly [$internal] = true;\n public readonly type = 'loose-decorated';\n}\n","import { arrayOf } from './data/array.ts';\nimport { attribute } from './data/attributes.ts';\nimport type { LooseDecorated } from './data/dataTypes.ts';\nimport { f32, u32 } from './data/numeric.ts';\nimport { vec3u, vec4f } from './data/vector.ts';\nimport type {\n AnyWgslData,\n BaseData,\n Builtin,\n Decorated,\n F32,\n U32,\n Vec3u,\n Vec4f,\n WgslArray,\n} from './data/wgslTypes.ts';\nimport { $internal } from './shared/symbols.ts';\n\n// ----------\n// Public API\n// ----------\n\nexport type BuiltinVertexIndex = Decorated<U32, [Builtin<'vertex_index'>]>;\nexport type BuiltinInstanceIndex = Decorated<U32, [Builtin<'instance_index'>]>;\nexport type BuiltinPosition = Decorated<Vec4f, [Builtin<'position'>]>;\nexport type BuiltinClipDistances = Decorated<\n WgslArray<U32>,\n [Builtin<'clip_distances'>]\n>;\nexport type BuiltinFrontFacing = Decorated<F32, [Builtin<'front_facing'>]>;\nexport type BuiltinFragDepth = Decorated<F32, [Builtin<'frag_depth'>]>;\nexport type BuiltinSampleIndex = Decorated<U32, [Builtin<'sample_index'>]>;\nexport type BuiltinSampleMask = Decorated<U32, [Builtin<'sample_mask'>]>;\nexport type BuiltinLocalInvocationId = Decorated<\n Vec3u,\n [Builtin<'local_invocation_id'>]\n>;\nexport type BuiltinLocalInvocationIndex = Decorated<\n U32,\n [Builtin<'local_invocation_index'>]\n>;\nexport type BuiltinGlobalInvocationId = Decorated<\n Vec3u,\n [Builtin<'global_invocation_id'>]\n>;\nexport type BuiltinWorkgroupId = Decorated<Vec3u, [Builtin<'workgroup_id'>]>;\nexport type BuiltinNumWorkgroups = Decorated<\n Vec3u,\n [Builtin<'num_workgroups'>]\n>;\nexport type BuiltinSubgroupInvocationId = Decorated<\n U32,\n [Builtin<'subgroup_invocation_id'>]\n>;\nexport type BuiltinSubgroupSize = Decorated<U32, [Builtin<'subgroup_size'>]>;\n\nfunction defineBuiltin<T extends Decorated | LooseDecorated>(\n dataType: AnyWgslData,\n value: T['attribs'][0] extends { value: infer TValue } ? TValue : never,\n): T {\n return attribute(dataType, {\n [$internal]: true,\n type: '@builtin',\n // biome-ignore lint/suspicious/noExplicitAny: it's fine\n value: value as any,\n }) as T;\n}\n\nexport const builtin = {\n vertexIndex: defineBuiltin<BuiltinVertexIndex>(u32, 'vertex_index'),\n instanceIndex: defineBuiltin<BuiltinInstanceIndex>(u32, 'instance_index'),\n position: defineBuiltin<BuiltinPosition>(vec4f, 'position'),\n clipDistances: defineBuiltin<BuiltinClipDistances>(\n arrayOf(u32, 8),\n 'clip_distances',\n ),\n frontFacing: defineBuiltin<BuiltinFrontFacing>(f32, 'front_facing'),\n fragDepth: defineBuiltin<BuiltinFragDepth>(f32, 'frag_depth'),\n sampleIndex: defineBuiltin<BuiltinSampleIndex>(u32, 'sample_index'),\n sampleMask: defineBuiltin<BuiltinSampleMask>(u32, 'sample_mask'),\n localInvocationId: defineBuiltin<BuiltinLocalInvocationId>(\n vec3u,\n 'local_invocation_id',\n ),\n localInvocationIndex: defineBuiltin<BuiltinLocalInvocationIndex>(\n u32,\n 'local_invocation_index',\n ),\n globalInvocationId: defineBuiltin<BuiltinGlobalInvocationId>(\n vec3u,\n 'global_invocation_id',\n ),\n workgroupId: defineBuiltin<BuiltinWorkgroupId>(vec3u, 'workgroup_id'),\n numWorkgroups: defineBuiltin<BuiltinNumWorkgroups>(vec3u, 'num_workgroups'),\n subgroupInvocationId: defineBuiltin<BuiltinSubgroupInvocationId>(\n u32,\n 'subgroup_invocation_id',\n ),\n subgroupSize: defineBuiltin<BuiltinSubgroupSize>(u32, 'subgroup_size'),\n} as const;\n\nexport type AnyBuiltin = (typeof builtin)[keyof typeof builtin];\nexport type AnyComputeBuiltin =\n | BuiltinLocalInvocationId\n | BuiltinLocalInvocationIndex\n | BuiltinGlobalInvocationId\n | BuiltinWorkgroupId\n | BuiltinNumWorkgroups\n | BuiltinSubgroupInvocationId\n | BuiltinSubgroupSize;\nexport type AnyVertexInputBuiltin = BuiltinVertexIndex | BuiltinInstanceIndex;\nexport type AnyVertexOutputBuiltin = BuiltinClipDistances | BuiltinPosition;\nexport type AnyFragmentInputBuiltin =\n | BuiltinPosition\n | BuiltinFrontFacing\n | BuiltinSampleIndex\n | BuiltinSampleMask\n | BuiltinSubgroupInvocationId\n | BuiltinSubgroupSize;\nexport type AnyFragmentOutputBuiltin = BuiltinFragDepth | BuiltinSampleMask;\n\nexport type OmitBuiltins<S> = S extends AnyBuiltin ? never\n : S extends BaseData ? S\n : {\n [Key in keyof S as S[Key] extends AnyBuiltin ? never : Key]: S[Key];\n };\n"],"mappings":"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","names":["struct","props","WgslStructImpl","$internal","label","setName","getName","roundUp","value","modulo","bitMask","invBitMask","TgpuVertexFormatDataImpl","type","$internal","formatToWGSLType","u32","vec2u","vec4u","i32","vec2i","vec4i","f32","vec2f","vec4f","vec3f","vec3u","vec3i","packedFormats","uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10_10_10_2","unorm8x4_bgra","knownAlignmentMap","computeAlignment","data","dataType","knownAlignment","isWgslStruct","alignmentOf","a","b","isWgslArray","isUnstruct","firstProp","getCustomAlignment","isDisarray","isDecorated","isLooseDecorated","packedFormats","computeCustomAlignment","customAlignmentOf","cachedAlignments","cachedCustomAlignments","alignment","PUBLIC_alignmentOf","schema","knownSizesMap","sizeOfStruct","struct","size","property","roundUp","alignmentOf","sizeOf","sizeOfUnstruct","data","alignment","customAlignmentOf","computeSize","knownSize","isWgslStruct","isUnstruct","isWgslArray","isDisarray","isDecorated","isLooseDecorated","getCustomSize","cachedSizes","schema","PUBLIC_sizeOf","arrayOf","elementType","elementCount","WgslArrayImpl","sizeOf","$internal","disarrayOf","elementType","count","DisarrayImpl","elementCount","$internal","unstruct","properties","props","UnstructImpl","$internal","label","setName","getName","atomic","data","AtomicImpl","inner","$internal","attribute","data","attrib","isDecorated","DecoratedImpl","isLooseDecorated","LooseDecoratedImpl","isLooseData","align","alignment","$internal","size","location","interpolate","interpolationType","isBuiltin","value","isBuiltinAttrib","getAttributesString","field","BaseDecoratedImpl","inner","attribs","alignAttrib","isAlignAttrib","sizeAttrib","isSizeAttrib","isWgslData","alignmentOf","sizeOf","defineBuiltin","dataType","value","attribute","$internal","builtin","u32","vec4f","arrayOf","f32","vec3u"]}
@@ -0,0 +1,41 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 P="0.5.9";var r=Symbol(`typegpu:${P}:$internal`),se= exports.b =Symbol(`typegpu:${P}:$wgslDataType`),dt= exports.c =Symbol(`typegpu:${P}:$gpuValueOf`),O= exports.d =Symbol(`typegpu:${P}:$getNameForward`);function Ve(e){return!!_optionalChain([e, 'optionalAccess', _2 => _2[O]])}function C(e){return Ve(e)?C(e[O]):_optionalChain([ve, 'call', _3 => _3(e), 'optionalAccess', _4 => _4.name])}function ie(e,t){_e(e,{name:t})}function gt(e){return!!_optionalChain([e, 'optionalAccess', _5 => _5.$name])}function ve(e){return globalThis.__TYPEGPU_META__.get(e)}function _e(e,t){globalThis.__TYPEGPU_META__??=new WeakMap;let n=globalThis.__TYPEGPU_META__;n.set(e,{...n.get(e),...t})}var K="Invariant failed";function Y(e,t){if(e)return;throw new Error(K)}var ae=class e extends Error{constructor(n,a){let s=a.map(i=>`- ${i}`);s.length>20&&(s=[...s.slice(0,11),"...",...s.slice(-10)]);super(`Resolution of the following tree failed:
2
+ ${s.join(`
3
+ `)}: ${n&&typeof n=="object"&&"message"in n?n.message:n}`);this.cause=n;this.trace=a;Object.setPrototypeOf(this,e.prototype)}appendToTrace(n){let a=[n,...this.trace];return new e(this.cause,a)}},oe= exports.l =class e extends Error{constructor(n){super(`Missing value for '${n}'`);this.slot=n;Object.setPrototypeOf(this,e.prototype)}},he= exports.m =class e extends Error{constructor(t){super(`Buffer '${_nullishCoalesce(C(t), () => ("<unnamed>"))}' is not bindable as a uniform. Use .$usage('uniform') to allow it.`),Object.setPrototypeOf(this,e.prototype)}},ue= exports.n =class e extends Error{constructor(t,n){super(`The function '${_nullishCoalesce(t, () => ("<unnamed>"))}' is missing links to the following external values: ${n}.`),Object.setPrototypeOf(this,e.prototype)}},ye= exports.o =class e extends Error{constructor(t){super(`Missing bind groups for layouts: '${[...t].map(n=>_nullishCoalesce(C(n), () => ("<unnamed>"))).join(", ")}'. Please provide it using pipeline.with(layout, bindGroup).(...)`),Object.setPrototypeOf(this,e.prototype)}},ce= exports.p =class e extends Error{constructor(t){super(`Missing vertex buffers for layouts: '${[...t].map(n=>_nullishCoalesce(C(n), () => ("<unnamed>"))).join(", ")}'. Please provide it using pipeline.with(layout, buffer).(...)`),Object.setPrototypeOf(this,e.prototype)}};var d=Symbol("Type token for the inferred (CPU & GPU) representation of a resource");function _t(e){return!!_optionalChain([e, 'optionalAccess', _6 => _6[se]])}var At={[r]:!0,type:"void",[d]:void 0},Ae=["bool","f32","f16","i32","u32","vec2f","vec2h","vec2i","vec2u","vec2<bool>","vec3f","vec3h","vec3i","vec3u","vec3<bool>","vec4f","vec4h","vec4i","vec4u","vec4<bool>","mat2x2f","mat3x3f","mat4x4f","struct","array","ptr","atomic","decorated","abstractInt","abstractFloat","void"];function Ie(e){let t=e;return!!_optionalChain([t, 'optionalAccess', _7 => _7[r]])&&typeof _optionalChain([t, 'access', _8 => _8.kind, 'optionalAccess', _9 => _9.startsWith])=="function"&&t.kind.startsWith("vec")}function $e(e){let t=e;return!!_optionalChain([t, 'optionalAccess', _10 => _10[r]])&&typeof _optionalChain([t, 'access', _11 => _11.type, 'optionalAccess', _12 => _12.startsWith])=="function"&&_optionalChain([t, 'access', _13 => _13.type, 'access', _14 => _14.startsWith, 'optionalCall', _15 => _15("vec2")])}function ke(e){let t=e;return!!_optionalChain([t, 'optionalAccess', _16 => _16[r]])&&typeof _optionalChain([t, 'access', _17 => _17.type, 'optionalAccess', _18 => _18.startsWith])=="function"&&t.type.startsWith("vec3")}function Se(e){let t=e;return!!_optionalChain([t, 'optionalAccess', _19 => _19[r]])&&typeof _optionalChain([t, 'access', _20 => _20.type, 'optionalAccess', _21 => _21.startsWith])=="function"&&t.type.startsWith("vec4")}function le(e){return $e(e)||ke(e)||Se(e)}function It(e){let t=e;return!!_optionalChain([t, 'optionalAccess', _22 => _22[r]])&&typeof _optionalChain([t, 'access', _23 => _23.kind, 'optionalAccess', _24 => _24.startsWith])=="function"&&t.kind.startsWith("mat")}function De(e){return _optionalChain([e, 'optionalAccess', _25 => _25[r]])&&_optionalChain([e, 'optionalAccess', _26 => _26.type])==="mat2x2f"}function Pe(e){return _optionalChain([e, 'optionalAccess', _27 => _27[r]])&&_optionalChain([e, 'optionalAccess', _28 => _28.type])==="mat3x3f"}function Ce(e){return _optionalChain([e, 'optionalAccess', _29 => _29[r]])&&_optionalChain([e, 'optionalAccess', _30 => _30.type])==="mat4x4f"}function $t(e){return De(e)||Pe(e)||Ce(e)}function kt(e){return Ie(e)&&["vec2f","vec3f","vec4f"].includes(e.kind)}function xe(e){return _optionalChain([e, 'optionalAccess', _31 => _31[r]])&&Ae.includes(_optionalChain([e, 'optionalAccess', _32 => _32.type]))}function St(e){return _optionalChain([e, 'optionalAccess', _33 => _33[r]])&&_optionalChain([e, 'optionalAccess', _34 => _34.type])==="array"}function Dt(e){return _optionalChain([e, 'optionalAccess', _35 => _35[r]])&&_optionalChain([e, 'optionalAccess', _36 => _36.type])==="struct"}function Pt(e){return _optionalChain([e, 'optionalAccess', _37 => _37[r]])&&_optionalChain([e, 'optionalAccess', _38 => _38.type])==="ptr"}function Ct(e){return _optionalChain([e, 'optionalAccess', _39 => _39[r]])&&_optionalChain([e, 'optionalAccess', _40 => _40.type])==="atomic"}function we(e){return _optionalChain([e, 'optionalAccess', _41 => _41[r]])&&_optionalChain([e, 'optionalAccess', _42 => _42.type])==="@align"}function de(e){return _optionalChain([e, 'optionalAccess', _43 => _43[r]])&&_optionalChain([e, 'optionalAccess', _44 => _44.type])==="@size"}function pe(e){return _optionalChain([e, 'optionalAccess', _45 => _45[r]])&&_optionalChain([e, 'optionalAccess', _46 => _46.type])==="@location"}function Ft(e){return _optionalChain([e, 'optionalAccess', _47 => _47[r]])&&_optionalChain([e, 'optionalAccess', _48 => _48.type])==="@interpolate"}function Mt(e){return _optionalChain([e, 'optionalAccess', _49 => _49[r]])&&_optionalChain([e, 'optionalAccess', _50 => _50.type])==="@builtin"}function me(e){return _optionalChain([e, 'optionalAccess', _51 => _51[r]])&&_optionalChain([e, 'optionalAccess', _52 => _52.type])==="decorated"}function Nt(e){return _optionalChain([e, 'optionalAccess', _53 => _53[r]])&&e.type==="void"}var ge=["uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],Ut= exports.x ={f32:"float32",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",f16:"float16",vec2h:"float16x2",vec4h:"float16x4",u32:"uint32",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",i32:"sint32",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4"};var Me=["unstruct","disarray","loose-decorated",...ge];function Ne(e){return _optionalChain([e, 'optionalAccess', _54 => _54[r]])&&Me.includes(_optionalChain([e, 'optionalAccess', _55 => _55.type]))}function Lt(e){return _optionalChain([e, 'optionalAccess', _56 => _56[r]])&&_optionalChain([e, 'optionalAccess', _57 => _57.type])==="disarray"}function jt(e){return _optionalChain([e, 'optionalAccess', _58 => _58[r]])&&_optionalChain([e, 'optionalAccess', _59 => _59.type])==="unstruct"}function Gt(e){return _optionalChain([e, 'optionalAccess', _60 => _60[r]])&&_optionalChain([e, 'optionalAccess', _61 => _61.type])==="loose-decorated"}function Et(e){return _optionalChain([e, 'access', _62 => _62.attribs, 'optionalAccess', _63 => _63.find, 'call', _64 => _64(we), 'optionalAccess', _65 => _65.value])}function Ot(e){return _optionalChain([e, 'access', _66 => _66.attribs, 'optionalAccess', _67 => _67.find, 'call', _68 => _68(de), 'optionalAccess', _69 => _69.value])}function Kt(e){return _optionalChain([e, 'access', _70 => _70.attribs, 'optionalAccess', _71 => _71.find, 'call', _72 => _72(pe), 'optionalAccess', _73 => _73.value])}function Yt(e){return xe(e)||Ne(e)}var Ht={type:"unknown",toString(){return"unknown"}},W=class{constructor(t,n){this.value=t;this.dataType=n}};function y(e,t){return new W(e,t.type==="decorated"||t.type==="loose-decorated"?t.inner:t)}function Xt(e){return e instanceof W}var _typedbinary = require('typed-binary'); var _typedbinary2 = _interopRequireDefault(_typedbinary);var L=null,Ue=Symbol("CPU"),Be=Symbol("GPU"),Re= exports.q ={CPU:Ue,GPU:Be},F=[];function qt(e,t){Y(L===null,"Cannot nest context providers"),L=e;try{return t()}finally{L=null}}function Qt(){return L}function en(e){F.push(e)}function tn(e){let t=F.pop();e!==void 0&&Y(t===e,"Unexpected mode")}var fe=()=>F.length>0&&F[F.length-1]===Re.GPU;function*on(e){let t=0;for(;;)e.has(t)||(yield t),t++}function o(e,t,n,a){let s=(...i)=>fe()?t(...i):e(...i);return s[r]={implementation:e,argTypes:a},ie(s,n),s}var xn={[r]:!0,type:"abstractInt"},wn= exports.ia ={[r]:!0,type:"abstractFloat"},G= exports.ja ={[r]:!0,type:"bool"},We=o(e=>typeof e=="boolean"?e?1:0:Number.isInteger(e)?((e<0||e>4294967295)&&console.warn(`u32 value ${e} overflowed`),(e&4294967295)>>>0):Math.max(0,Math.min(4294967295,Math.floor(e))),e=>y(`u32(${e.value})`,M),"u32Cast"),M= exports.ka =Object.assign(We,{type:"u32"}),Le=o(e=>{if(typeof e=="boolean")return e?1:0;if(Number.isInteger(e))return(e<-2147483648||e>2147483647)&&console.warn(`i32 value ${e} overflowed`),(e|0)&4294967295;let t=e<0?Math.ceil(e):Math.floor(e);return Math.max(-2147483648,Math.min(2147483647,t))},e=>y(`i32(${e.value})`,N),"i32Cast"),N= exports.la =Object.assign(Le,{type:"i32"}),je=o(e=>{if(typeof e=="boolean")return e?1:0;let t=new Float32Array(1);return t[0]=e,t[0]},e=>y(`f32(${e.value})`,U),"f32Cast"),U= exports.ma =Object.assign(je,{type:"f32"}),Ge=o(e=>{if(typeof e=="boolean")return e?1:0;let t=new ArrayBuffer(2);return _typedbinary2.default.f16.write(new _typedbinary2.default.BufferWriter(t),e),_typedbinary2.default.f16.read(new _typedbinary2.default.BufferReader(t))},e=>y(`f16(${e.value})`,B),"f16Cast"),B= exports.na =Object.assign(Ge,{type:"f16"});var R= (_class =class extends Array{constructor(...args) { super(...args); _class.prototype.__init.call(this); }__init() {this[r]=!0}"~resolve"(){return`${this.kind}(${this.join(", ")})`}toString(){return this["~resolve"]()}get xx(){return new this._Vec2(this[0],this[0])}get xy(){return new this._Vec2(this[0],this[1])}get xz(){return new this._Vec2(this[0],this[2])}get xw(){return new this._Vec2(this[0],this[3])}get yx(){return new this._Vec2(this[1],this[0])}get yy(){return new this._Vec2(this[1],this[1])}get yz(){return new this._Vec2(this[1],this[2])}get yw(){return new this._Vec2(this[1],this[3])}get zx(){return new this._Vec2(this[2],this[0])}get zy(){return new this._Vec2(this[2],this[1])}get zz(){return new this._Vec2(this[2],this[2])}get zw(){return new this._Vec2(this[2],this[3])}get wx(){return new this._Vec2(this[3],this[0])}get wy(){return new this._Vec2(this[3],this[1])}get wz(){return new this._Vec2(this[3],this[2])}get ww(){return new this._Vec2(this[3],this[3])}get xxx(){return new this._Vec3(this[0],this[0],this[0])}get xxy(){return new this._Vec3(this[0],this[0],this[1])}get xxz(){return new this._Vec3(this[0],this[0],this[2])}get xxw(){return new this._Vec3(this[0],this[0],this[3])}get xyx(){return new this._Vec3(this[0],this[1],this[0])}get xyy(){return new this._Vec3(this[0],this[1],this[1])}get xyz(){return new this._Vec3(this[0],this[1],this[2])}get xyw(){return new this._Vec3(this[0],this[1],this[3])}get xzx(){return new this._Vec3(this[0],this[2],this[0])}get xzy(){return new this._Vec3(this[0],this[2],this[1])}get xzz(){return new this._Vec3(this[0],this[2],this[2])}get xzw(){return new this._Vec3(this[0],this[2],this[3])}get xwx(){return new this._Vec3(this[0],this[3],this[0])}get xwy(){return new this._Vec3(this[0],this[3],this[1])}get xwz(){return new this._Vec3(this[0],this[3],this[2])}get xww(){return new this._Vec3(this[0],this[3],this[3])}get yxx(){return new this._Vec3(this[1],this[0],this[0])}get yxy(){return new this._Vec3(this[1],this[0],this[1])}get yxz(){return new this._Vec3(this[1],this[0],this[2])}get yxw(){return new this._Vec3(this[1],this[0],this[3])}get yyx(){return new this._Vec3(this[1],this[1],this[0])}get yyy(){return new this._Vec3(this[1],this[1],this[1])}get yyz(){return new this._Vec3(this[1],this[1],this[2])}get yyw(){return new this._Vec3(this[1],this[1],this[3])}get yzx(){return new this._Vec3(this[1],this[2],this[0])}get yzy(){return new this._Vec3(this[1],this[2],this[1])}get yzz(){return new this._Vec3(this[1],this[2],this[2])}get yzw(){return new this._Vec3(this[1],this[2],this[3])}get ywx(){return new this._Vec3(this[1],this[3],this[0])}get ywy(){return new this._Vec3(this[1],this[3],this[1])}get ywz(){return new this._Vec3(this[1],this[3],this[2])}get yww(){return new this._Vec3(this[1],this[3],this[3])}get zxx(){return new this._Vec3(this[2],this[0],this[0])}get zxy(){return new this._Vec3(this[2],this[0],this[1])}get zxz(){return new this._Vec3(this[2],this[0],this[2])}get zxw(){return new this._Vec3(this[2],this[0],this[3])}get zyx(){return new this._Vec3(this[2],this[1],this[0])}get zyy(){return new this._Vec3(this[2],this[1],this[1])}get zyz(){return new this._Vec3(this[2],this[1],this[2])}get zyw(){return new this._Vec3(this[2],this[1],this[3])}get zzx(){return new this._Vec3(this[2],this[2],this[0])}get zzy(){return new this._Vec3(this[2],this[2],this[1])}get zzz(){return new this._Vec3(this[2],this[2],this[2])}get zzw(){return new this._Vec3(this[2],this[2],this[3])}get zwx(){return new this._Vec3(this[2],this[3],this[0])}get zwy(){return new this._Vec3(this[2],this[3],this[1])}get zwz(){return new this._Vec3(this[2],this[3],this[2])}get zww(){return new this._Vec3(this[2],this[3],this[3])}get wxx(){return new this._Vec3(this[3],this[0],this[0])}get wxy(){return new this._Vec3(this[3],this[0],this[1])}get wxz(){return new this._Vec3(this[3],this[0],this[2])}get wxw(){return new this._Vec3(this[3],this[0],this[3])}get wyx(){return new this._Vec3(this[3],this[1],this[0])}get wyy(){return new this._Vec3(this[3],this[1],this[1])}get wyz(){return new this._Vec3(this[3],this[1],this[2])}get wyw(){return new this._Vec3(this[3],this[1],this[3])}get wzx(){return new this._Vec3(this[3],this[2],this[0])}get wzy(){return new this._Vec3(this[3],this[2],this[1])}get wzz(){return new this._Vec3(this[3],this[2],this[2])}get wzw(){return new this._Vec3(this[3],this[2],this[3])}get wwx(){return new this._Vec3(this[3],this[3],this[0])}get wwy(){return new this._Vec3(this[3],this[3],this[1])}get wwz(){return new this._Vec3(this[3],this[3],this[2])}get www(){return new this._Vec3(this[3],this[3],this[3])}get xxxx(){return new this._Vec4(this[0],this[0],this[0],this[0])}get xxxy(){return new this._Vec4(this[0],this[0],this[0],this[1])}get xxxz(){return new this._Vec4(this[0],this[0],this[0],this[2])}get xxxw(){return new this._Vec4(this[0],this[0],this[0],this[3])}get xxyx(){return new this._Vec4(this[0],this[0],this[1],this[0])}get xxyy(){return new this._Vec4(this[0],this[0],this[1],this[1])}get xxyz(){return new this._Vec4(this[0],this[0],this[1],this[2])}get xxyw(){return new this._Vec4(this[0],this[0],this[1],this[3])}get xxzx(){return new this._Vec4(this[0],this[0],this[2],this[0])}get xxzy(){return new this._Vec4(this[0],this[0],this[2],this[1])}get xxzz(){return new this._Vec4(this[0],this[0],this[2],this[2])}get xxzw(){return new this._Vec4(this[0],this[0],this[2],this[3])}get xxwx(){return new this._Vec4(this[0],this[0],this[3],this[0])}get xxwy(){return new this._Vec4(this[0],this[0],this[3],this[1])}get xxwz(){return new this._Vec4(this[0],this[0],this[3],this[2])}get xxww(){return new this._Vec4(this[0],this[0],this[3],this[3])}get xyxx(){return new this._Vec4(this[0],this[1],this[0],this[0])}get xyxy(){return new this._Vec4(this[0],this[1],this[0],this[1])}get xyxz(){return new this._Vec4(this[0],this[1],this[0],this[2])}get xyxw(){return new this._Vec4(this[0],this[1],this[0],this[3])}get xyyx(){return new this._Vec4(this[0],this[1],this[1],this[0])}get xyyy(){return new this._Vec4(this[0],this[1],this[1],this[1])}get xyyz(){return new this._Vec4(this[0],this[1],this[1],this[2])}get xyyw(){return new this._Vec4(this[0],this[1],this[1],this[3])}get xyzx(){return new this._Vec4(this[0],this[1],this[2],this[0])}get xyzy(){return new this._Vec4(this[0],this[1],this[2],this[1])}get xyzz(){return new this._Vec4(this[0],this[1],this[2],this[2])}get xyzw(){return new this._Vec4(this[0],this[1],this[2],this[3])}get xywx(){return new this._Vec4(this[0],this[1],this[3],this[0])}get xywy(){return new this._Vec4(this[0],this[1],this[3],this[1])}get xywz(){return new this._Vec4(this[0],this[1],this[3],this[2])}get xyww(){return new this._Vec4(this[0],this[1],this[3],this[3])}get xzxx(){return new this._Vec4(this[0],this[2],this[0],this[0])}get xzxy(){return new this._Vec4(this[0],this[2],this[0],this[1])}get xzxz(){return new this._Vec4(this[0],this[2],this[0],this[2])}get xzxw(){return new this._Vec4(this[0],this[2],this[0],this[3])}get xzyx(){return new this._Vec4(this[0],this[2],this[1],this[0])}get xzyy(){return new this._Vec4(this[0],this[2],this[1],this[1])}get xzyz(){return new this._Vec4(this[0],this[2],this[1],this[2])}get xzyw(){return new this._Vec4(this[0],this[2],this[1],this[3])}get xzzx(){return new this._Vec4(this[0],this[2],this[2],this[0])}get xzzy(){return new this._Vec4(this[0],this[2],this[2],this[1])}get xzzz(){return new this._Vec4(this[0],this[2],this[2],this[2])}get xzzw(){return new this._Vec4(this[0],this[2],this[2],this[3])}get xzwx(){return new this._Vec4(this[0],this[2],this[3],this[0])}get xzwy(){return new this._Vec4(this[0],this[2],this[3],this[1])}get xzwz(){return new this._Vec4(this[0],this[2],this[3],this[2])}get xzww(){return new this._Vec4(this[0],this[2],this[3],this[3])}get xwxx(){return new this._Vec4(this[0],this[3],this[0],this[0])}get xwxy(){return new this._Vec4(this[0],this[3],this[0],this[1])}get xwxz(){return new this._Vec4(this[0],this[3],this[0],this[2])}get xwxw(){return new this._Vec4(this[0],this[3],this[0],this[3])}get xwyx(){return new this._Vec4(this[0],this[3],this[1],this[0])}get xwyy(){return new this._Vec4(this[0],this[3],this[1],this[1])}get xwyz(){return new this._Vec4(this[0],this[3],this[1],this[2])}get xwyw(){return new this._Vec4(this[0],this[3],this[1],this[3])}get xwzx(){return new this._Vec4(this[0],this[3],this[2],this[0])}get xwzy(){return new this._Vec4(this[0],this[3],this[2],this[1])}get xwzz(){return new this._Vec4(this[0],this[3],this[2],this[2])}get xwzw(){return new this._Vec4(this[0],this[3],this[2],this[3])}get xwwx(){return new this._Vec4(this[0],this[3],this[3],this[0])}get xwwy(){return new this._Vec4(this[0],this[3],this[3],this[1])}get xwwz(){return new this._Vec4(this[0],this[3],this[3],this[2])}get xwww(){return new this._Vec4(this[0],this[3],this[3],this[3])}get yxxx(){return new this._Vec4(this[1],this[0],this[0],this[0])}get yxxy(){return new this._Vec4(this[1],this[0],this[0],this[1])}get yxxz(){return new this._Vec4(this[1],this[0],this[0],this[2])}get yxxw(){return new this._Vec4(this[1],this[0],this[0],this[3])}get yxyx(){return new this._Vec4(this[1],this[0],this[1],this[0])}get yxyy(){return new this._Vec4(this[1],this[0],this[1],this[1])}get yxyz(){return new this._Vec4(this[1],this[0],this[1],this[2])}get yxyw(){return new this._Vec4(this[1],this[0],this[1],this[3])}get yxzx(){return new this._Vec4(this[1],this[0],this[2],this[0])}get yxzy(){return new this._Vec4(this[1],this[0],this[2],this[1])}get yxzz(){return new this._Vec4(this[1],this[0],this[2],this[2])}get yxzw(){return new this._Vec4(this[1],this[0],this[2],this[3])}get yxwx(){return new this._Vec4(this[1],this[0],this[3],this[0])}get yxwy(){return new this._Vec4(this[1],this[0],this[3],this[1])}get yxwz(){return new this._Vec4(this[1],this[0],this[3],this[2])}get yxww(){return new this._Vec4(this[1],this[0],this[3],this[3])}get yyxx(){return new this._Vec4(this[1],this[1],this[0],this[0])}get yyxy(){return new this._Vec4(this[1],this[1],this[0],this[1])}get yyxz(){return new this._Vec4(this[1],this[1],this[0],this[2])}get yyxw(){return new this._Vec4(this[1],this[1],this[0],this[3])}get yyyx(){return new this._Vec4(this[1],this[1],this[1],this[0])}get yyyy(){return new this._Vec4(this[1],this[1],this[1],this[1])}get yyyz(){return new this._Vec4(this[1],this[1],this[1],this[2])}get yyyw(){return new this._Vec4(this[1],this[1],this[1],this[3])}get yyzx(){return new this._Vec4(this[1],this[1],this[2],this[0])}get yyzy(){return new this._Vec4(this[1],this[1],this[2],this[1])}get yyzz(){return new this._Vec4(this[1],this[1],this[2],this[2])}get yyzw(){return new this._Vec4(this[1],this[1],this[2],this[3])}get yywx(){return new this._Vec4(this[1],this[1],this[3],this[0])}get yywy(){return new this._Vec4(this[1],this[1],this[3],this[1])}get yywz(){return new this._Vec4(this[1],this[1],this[3],this[2])}get yyww(){return new this._Vec4(this[1],this[1],this[3],this[3])}get yzxx(){return new this._Vec4(this[1],this[2],this[0],this[0])}get yzxy(){return new this._Vec4(this[1],this[2],this[0],this[1])}get yzxz(){return new this._Vec4(this[1],this[2],this[0],this[2])}get yzxw(){return new this._Vec4(this[1],this[2],this[0],this[3])}get yzyx(){return new this._Vec4(this[1],this[2],this[1],this[0])}get yzyy(){return new this._Vec4(this[1],this[2],this[1],this[1])}get yzyz(){return new this._Vec4(this[1],this[2],this[1],this[2])}get yzyw(){return new this._Vec4(this[1],this[2],this[1],this[3])}get yzzx(){return new this._Vec4(this[1],this[2],this[2],this[0])}get yzzy(){return new this._Vec4(this[1],this[2],this[2],this[1])}get yzzz(){return new this._Vec4(this[1],this[2],this[2],this[2])}get yzzw(){return new this._Vec4(this[1],this[2],this[2],this[3])}get yzwx(){return new this._Vec4(this[1],this[2],this[3],this[0])}get yzwy(){return new this._Vec4(this[1],this[2],this[3],this[1])}get yzwz(){return new this._Vec4(this[1],this[2],this[3],this[2])}get yzww(){return new this._Vec4(this[1],this[2],this[3],this[3])}get ywxx(){return new this._Vec4(this[1],this[3],this[0],this[0])}get ywxy(){return new this._Vec4(this[1],this[3],this[0],this[1])}get ywxz(){return new this._Vec4(this[1],this[3],this[0],this[2])}get ywxw(){return new this._Vec4(this[1],this[3],this[0],this[3])}get ywyx(){return new this._Vec4(this[1],this[3],this[1],this[0])}get ywyy(){return new this._Vec4(this[1],this[3],this[1],this[1])}get ywyz(){return new this._Vec4(this[1],this[3],this[1],this[2])}get ywyw(){return new this._Vec4(this[1],this[3],this[1],this[3])}get ywzx(){return new this._Vec4(this[1],this[3],this[2],this[0])}get ywzy(){return new this._Vec4(this[1],this[3],this[2],this[1])}get ywzz(){return new this._Vec4(this[1],this[3],this[2],this[2])}get ywzw(){return new this._Vec4(this[1],this[3],this[2],this[3])}get ywwx(){return new this._Vec4(this[1],this[3],this[3],this[0])}get ywwy(){return new this._Vec4(this[1],this[3],this[3],this[1])}get ywwz(){return new this._Vec4(this[1],this[3],this[3],this[2])}get ywww(){return new this._Vec4(this[1],this[3],this[3],this[3])}get zxxx(){return new this._Vec4(this[2],this[0],this[0],this[0])}get zxxy(){return new this._Vec4(this[2],this[0],this[0],this[1])}get zxxz(){return new this._Vec4(this[2],this[0],this[0],this[2])}get zxxw(){return new this._Vec4(this[2],this[0],this[0],this[3])}get zxyx(){return new this._Vec4(this[2],this[0],this[1],this[0])}get zxyy(){return new this._Vec4(this[2],this[0],this[1],this[1])}get zxyz(){return new this._Vec4(this[2],this[0],this[1],this[2])}get zxyw(){return new this._Vec4(this[2],this[0],this[1],this[3])}get zxzx(){return new this._Vec4(this[2],this[0],this[2],this[0])}get zxzy(){return new this._Vec4(this[2],this[0],this[2],this[1])}get zxzz(){return new this._Vec4(this[2],this[0],this[2],this[2])}get zxzw(){return new this._Vec4(this[2],this[0],this[2],this[3])}get zxwx(){return new this._Vec4(this[2],this[0],this[3],this[0])}get zxwy(){return new this._Vec4(this[2],this[0],this[3],this[1])}get zxwz(){return new this._Vec4(this[2],this[0],this[3],this[2])}get zxww(){return new this._Vec4(this[2],this[0],this[3],this[3])}get zyxx(){return new this._Vec4(this[2],this[1],this[0],this[0])}get zyxy(){return new this._Vec4(this[2],this[1],this[0],this[1])}get zyxz(){return new this._Vec4(this[2],this[1],this[0],this[2])}get zyxw(){return new this._Vec4(this[2],this[1],this[0],this[3])}get zyyx(){return new this._Vec4(this[2],this[1],this[1],this[0])}get zyyy(){return new this._Vec4(this[2],this[1],this[1],this[1])}get zyyz(){return new this._Vec4(this[2],this[1],this[1],this[2])}get zyyw(){return new this._Vec4(this[2],this[1],this[1],this[3])}get zyzx(){return new this._Vec4(this[2],this[1],this[2],this[0])}get zyzy(){return new this._Vec4(this[2],this[1],this[2],this[1])}get zyzz(){return new this._Vec4(this[2],this[1],this[2],this[2])}get zyzw(){return new this._Vec4(this[2],this[1],this[2],this[3])}get zywx(){return new this._Vec4(this[2],this[1],this[3],this[0])}get zywy(){return new this._Vec4(this[2],this[1],this[3],this[1])}get zywz(){return new this._Vec4(this[2],this[1],this[3],this[2])}get zyww(){return new this._Vec4(this[2],this[1],this[3],this[3])}get zzxx(){return new this._Vec4(this[2],this[2],this[0],this[0])}get zzxy(){return new this._Vec4(this[2],this[2],this[0],this[1])}get zzxz(){return new this._Vec4(this[2],this[2],this[0],this[2])}get zzxw(){return new this._Vec4(this[2],this[2],this[0],this[3])}get zzyx(){return new this._Vec4(this[2],this[2],this[1],this[0])}get zzyy(){return new this._Vec4(this[2],this[2],this[1],this[1])}get zzyz(){return new this._Vec4(this[2],this[2],this[1],this[2])}get zzyw(){return new this._Vec4(this[2],this[2],this[1],this[3])}get zzzx(){return new this._Vec4(this[2],this[2],this[2],this[0])}get zzzy(){return new this._Vec4(this[2],this[2],this[2],this[1])}get zzzz(){return new this._Vec4(this[2],this[2],this[2],this[2])}get zzzw(){return new this._Vec4(this[2],this[2],this[2],this[3])}get zzwx(){return new this._Vec4(this[2],this[2],this[3],this[0])}get zzwy(){return new this._Vec4(this[2],this[2],this[3],this[1])}get zzwz(){return new this._Vec4(this[2],this[2],this[3],this[2])}get zzww(){return new this._Vec4(this[2],this[2],this[3],this[3])}get zwxx(){return new this._Vec4(this[2],this[3],this[0],this[0])}get zwxy(){return new this._Vec4(this[2],this[3],this[0],this[1])}get zwxz(){return new this._Vec4(this[2],this[3],this[0],this[2])}get zwxw(){return new this._Vec4(this[2],this[3],this[0],this[3])}get zwyx(){return new this._Vec4(this[2],this[3],this[1],this[0])}get zwyy(){return new this._Vec4(this[2],this[3],this[1],this[1])}get zwyz(){return new this._Vec4(this[2],this[3],this[1],this[2])}get zwyw(){return new this._Vec4(this[2],this[3],this[1],this[3])}get zwzx(){return new this._Vec4(this[2],this[3],this[2],this[0])}get zwzy(){return new this._Vec4(this[2],this[3],this[2],this[1])}get zwzz(){return new this._Vec4(this[2],this[3],this[2],this[2])}get zwzw(){return new this._Vec4(this[2],this[3],this[2],this[3])}get zwwx(){return new this._Vec4(this[2],this[3],this[3],this[0])}get zwwy(){return new this._Vec4(this[2],this[3],this[3],this[1])}get zwwz(){return new this._Vec4(this[2],this[3],this[3],this[2])}get zwww(){return new this._Vec4(this[2],this[3],this[3],this[3])}get wxxx(){return new this._Vec4(this[3],this[0],this[0],this[0])}get wxxy(){return new this._Vec4(this[3],this[0],this[0],this[1])}get wxxz(){return new this._Vec4(this[3],this[0],this[0],this[2])}get wxxw(){return new this._Vec4(this[3],this[0],this[0],this[3])}get wxyx(){return new this._Vec4(this[3],this[0],this[1],this[0])}get wxyy(){return new this._Vec4(this[3],this[0],this[1],this[1])}get wxyz(){return new this._Vec4(this[3],this[0],this[1],this[2])}get wxyw(){return new this._Vec4(this[3],this[0],this[1],this[3])}get wxzx(){return new this._Vec4(this[3],this[0],this[2],this[0])}get wxzy(){return new this._Vec4(this[3],this[0],this[2],this[1])}get wxzz(){return new this._Vec4(this[3],this[0],this[2],this[2])}get wxzw(){return new this._Vec4(this[3],this[0],this[2],this[3])}get wxwx(){return new this._Vec4(this[3],this[0],this[3],this[0])}get wxwy(){return new this._Vec4(this[3],this[0],this[3],this[1])}get wxwz(){return new this._Vec4(this[3],this[0],this[3],this[2])}get wxww(){return new this._Vec4(this[3],this[0],this[3],this[3])}get wyxx(){return new this._Vec4(this[3],this[1],this[0],this[0])}get wyxy(){return new this._Vec4(this[3],this[1],this[0],this[1])}get wyxz(){return new this._Vec4(this[3],this[1],this[0],this[2])}get wyxw(){return new this._Vec4(this[3],this[1],this[0],this[3])}get wyyx(){return new this._Vec4(this[3],this[1],this[1],this[0])}get wyyy(){return new this._Vec4(this[3],this[1],this[1],this[1])}get wyyz(){return new this._Vec4(this[3],this[1],this[1],this[2])}get wyyw(){return new this._Vec4(this[3],this[1],this[1],this[3])}get wyzx(){return new this._Vec4(this[3],this[1],this[2],this[0])}get wyzy(){return new this._Vec4(this[3],this[1],this[2],this[1])}get wyzz(){return new this._Vec4(this[3],this[1],this[2],this[2])}get wyzw(){return new this._Vec4(this[3],this[1],this[2],this[3])}get wywx(){return new this._Vec4(this[3],this[1],this[3],this[0])}get wywy(){return new this._Vec4(this[3],this[1],this[3],this[1])}get wywz(){return new this._Vec4(this[3],this[1],this[3],this[2])}get wyww(){return new this._Vec4(this[3],this[1],this[3],this[3])}get wzxx(){return new this._Vec4(this[3],this[2],this[0],this[0])}get wzxy(){return new this._Vec4(this[3],this[2],this[0],this[1])}get wzxz(){return new this._Vec4(this[3],this[2],this[0],this[2])}get wzxw(){return new this._Vec4(this[3],this[2],this[0],this[3])}get wzyx(){return new this._Vec4(this[3],this[2],this[1],this[0])}get wzyy(){return new this._Vec4(this[3],this[2],this[1],this[1])}get wzyz(){return new this._Vec4(this[3],this[2],this[1],this[2])}get wzyw(){return new this._Vec4(this[3],this[2],this[1],this[3])}get wzzx(){return new this._Vec4(this[3],this[2],this[2],this[0])}get wzzy(){return new this._Vec4(this[3],this[2],this[2],this[1])}get wzzz(){return new this._Vec4(this[3],this[2],this[2],this[2])}get wzzw(){return new this._Vec4(this[3],this[2],this[2],this[3])}get wzwx(){return new this._Vec4(this[3],this[2],this[3],this[0])}get wzwy(){return new this._Vec4(this[3],this[2],this[3],this[1])}get wzwz(){return new this._Vec4(this[3],this[2],this[3],this[2])}get wzww(){return new this._Vec4(this[3],this[2],this[3],this[3])}get wwxx(){return new this._Vec4(this[3],this[3],this[0],this[0])}get wwxy(){return new this._Vec4(this[3],this[3],this[0],this[1])}get wwxz(){return new this._Vec4(this[3],this[3],this[0],this[2])}get wwxw(){return new this._Vec4(this[3],this[3],this[0],this[3])}get wwyx(){return new this._Vec4(this[3],this[3],this[1],this[0])}get wwyy(){return new this._Vec4(this[3],this[3],this[1],this[1])}get wwyz(){return new this._Vec4(this[3],this[3],this[1],this[2])}get wwyw(){return new this._Vec4(this[3],this[3],this[1],this[3])}get wwzx(){return new this._Vec4(this[3],this[3],this[2],this[0])}get wwzy(){return new this._Vec4(this[3],this[3],this[2],this[1])}get wwzz(){return new this._Vec4(this[3],this[3],this[2],this[2])}get wwzw(){return new this._Vec4(this[3],this[3],this[2],this[3])}get wwwx(){return new this._Vec4(this[3],this[3],this[3],this[0])}get wwwy(){return new this._Vec4(this[3],this[3],this[3],this[1])}get wwwz(){return new this._Vec4(this[3],this[3],this[3],this[2])}get wwww(){return new this._Vec4(this[3],this[3],this[3],this[3])}}, _class),l=class extends R{constructor(t,n){super(2),this[0]=_nullishCoalesce(t, () => (this.getDefaultValue())),this[1]=_nullishCoalesce(_nullishCoalesce(n, () => (t)), () => (this.getDefaultValue()))}get x(){return this[0]}get y(){return this[1]}set x(t){this[0]=t}set y(t){this[1]=t}},x=class extends R{constructor(t,n,a){super(3),this[0]=_nullishCoalesce(t, () => (this.getDefaultValue())),this[1]=_nullishCoalesce(_nullishCoalesce(n, () => (t)), () => (this.getDefaultValue())),this[2]=_nullishCoalesce(_nullishCoalesce(a, () => (t)), () => (this.getDefaultValue()))}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(t){this[0]=t}set y(t){this[1]=t}set z(t){this[2]=t}},w=class extends R{constructor(t,n,a,s){super(4),this[0]=_nullishCoalesce(t, () => (this.getDefaultValue())),this[1]=_nullishCoalesce(_nullishCoalesce(n, () => (t)), () => (this.getDefaultValue())),this[2]=_nullishCoalesce(_nullishCoalesce(a, () => (t)), () => (this.getDefaultValue())),this[3]=_nullishCoalesce(_nullishCoalesce(s, () => (t)), () => (this.getDefaultValue()))}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(t){this[0]=t}set y(t){this[1]=t}set z(t){this[2]=t}set w(t){this[3]=t}},p=class e extends l{getDefaultValue(){return 0}get kind(){return"vec2f"}get _Vec2(){return e}get _Vec3(){return b}get _Vec4(){return A}},m=class e extends l{getDefaultValue(){return 0}get kind(){return"vec2h"}get _Vec2(){return e}get _Vec3(){return z}get _Vec4(){return I}},g=class e extends l{getDefaultValue(){return 0}get kind(){return"vec2i"}get _Vec2(){return e}get _Vec3(){return V}get _Vec4(){return $}},f=class e extends l{getDefaultValue(){return 0}get kind(){return"vec2u"}get _Vec2(){return e}get _Vec3(){return v}get _Vec4(){return k}},T=class e extends l{getDefaultValue(){return!1}get kind(){return"vec2<bool>"}get _Vec2(){return e}get _Vec3(){return _}get _Vec4(){return S}},b=class e extends x{getDefaultValue(){return 0}get kind(){return"vec3f"}get _Vec2(){return p}get _Vec3(){return e}get _Vec4(){return A}},z=class e extends x{getDefaultValue(){return 0}get kind(){return"vec3h"}get _Vec2(){return m}get _Vec3(){return e}get _Vec4(){return I}},V=class e extends x{getDefaultValue(){return 0}get kind(){return"vec3i"}get _Vec2(){return g}get _Vec3(){return e}get _Vec4(){return $}},v=class e extends x{getDefaultValue(){return 0}get kind(){return"vec3u"}get _Vec2(){return f}get _Vec3(){return e}get _Vec4(){return k}},_=class e extends x{getDefaultValue(){return!1}get kind(){return"vec3<bool>"}get _Vec2(){return T}get _Vec3(){return e}get _Vec4(){return S}},A=class e extends w{getDefaultValue(){return 0}get kind(){return"vec4f"}get _Vec2(){return p}get _Vec3(){return b}get _Vec4(){return e}},I=class e extends w{getDefaultValue(){return 0}get kind(){return"vec4h"}get _Vec2(){return m}get _Vec3(){return z}get _Vec4(){return e}},$=class e extends w{getDefaultValue(){return 0}get kind(){return"vec4i"}get _Vec2(){return g}get _Vec3(){return V}get _Vec4(){return e}},k=class e extends w{getDefaultValue(){return 0}get kind(){return"vec4u"}get _Vec2(){return f}get _Vec3(){return v}get _Vec4(){return e}},S=class e extends w{getDefaultValue(){return!1}get kind(){return"vec4<bool>"}get _Vec2(){return T}get _Vec3(){return _}get _Vec4(){return e}};var H=h(p),Ee= exports.pa =h(m),Oe= exports.qa =h(g),Ke= exports.ra =h(f),Ye= exports.sa =h(T),X= exports.ta =h(b),He= exports.ua =h(z),Xe= exports.va =h(V),Ze= exports.wa =h(v),Je= exports.xa =h(_),Z= exports.ya =h(A),qe= exports.za =h(I),Qe= exports.Aa =h($),et= exports.Ba =h(k),tt= exports.Ca =h(S),nt={vec2f:H,vec2h:Ee,vec2i:Oe,vec2u:Ke,"vec2<bool>":Ye,vec3f:X,vec3h:He,vec3i:Xe,vec3u:Ze,"vec3<bool>":Je,vec4f:Z,vec4h:qe,vec4i:Qe,vec4u:et,"vec4<bool>":tt},rt= exports.Da ={vec2f:U,vec2h:B,vec2i:N,vec2u:M,"vec2<bool>":G,vec3f:U,vec3h:B,vec3i:N,vec3u:M,"vec3<bool>":G,vec4f:U,vec4h:B,vec4i:N,vec4u:M,"vec4<bool>":G};function h(e){let{kind:t,length:n}=new e,a=o((...s)=>{let i=new Array(s.length),u=0;for(let D of s)if(typeof D=="number"||typeof D=="boolean")i[u++]=D;else for(let E=0;E<D.length;++E)i[u++]=D[E];if(i.length<=1||i.length===n)return new e(...i);throw new Error(`'${t}' constructor called with invalid number of arguments.`)},(...s)=>y(`${t}(${s.map(i=>i.value).join(", ")})`,nt[t]),t,(...s)=>s.map(i=>{let u=i.dataType;return me(u)&&(u=u.inner),le(u)?u:rt[t]}));return Object.assign(a,{type:t,[d]:void 0})}function re(e){let t={[r]:!0,[d]:void 0,type:e.type,identity:ot[e.columns],translation:e.columns===4?ht:void 0,scaling:e.columns===4?ut:void 0,rotationX:e.columns===4?yt:void 0,rotationY:e.columns===4?ct:void 0,rotationZ:e.columns===4?lt:void 0},n=o((...a)=>{let s=[];for(let i of a)if(typeof i=="number")s.push(i);else for(let u=0;u<i.length;++u)s.push(i[u]);if(s.length!==0&&s.length!==e.columns*e.rows)throw new Error(`'${e.type}' constructor called with invalid number of arguments.`);for(let i=s.length;i<e.columns*e.rows;++i)s.push(0);return e.makeFromElements(...s)},(...a)=>y(`${t.type}(${a.map(s=>s.value).join(", ")})`,t),t.type);return Object.assign(n,t)}var J= (_class2 =class{__init2() {this[r]=!0}__init3() {this.length=4}constructor(...t){;_class2.prototype.__init2.call(this);_class2.prototype.__init3.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]}"~resolve"(){return`${this.kind}(${Array.from({length:this.length}).map((t,n)=>this[n]).join(", ")})`}}, _class2),q= (_class3 =class extends J{constructor(...args2) { super(...args2); _class3.prototype.__init4.call(this); }__init4() {this.kind="mat2x2f"}makeColumn(t,n){return H(t,n)}}, _class3),Q= (_class4 =class{__init5() {this[r]=!0}__init6() {this.length=12}constructor(...t){;_class4.prototype.__init5.call(this);_class4.prototype.__init6.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]}"~resolve"(){return`${this.kind}(${this[0]}, ${this[1]}, ${this[2]}, ${this[4]}, ${this[5]}, ${this[6]}, ${this[8]}, ${this[9]}, ${this[10]})`}}, _class4),ee= (_class5 =class extends Q{constructor(...args3) { super(...args3); _class5.prototype.__init7.call(this); }__init7() {this.kind="mat3x3f"}makeColumn(t,n,a){return X(t,n,a)}}, _class5),te= (_class6 =class{__init8() {this[r]=!0}constructor(...t){;_class6.prototype.__init8.call(this);_class6.prototype.__init9.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])]}__init9() {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]}"~resolve"(){return`${this.kind}(${Array.from({length:this.length}).map((t,n)=>this[n]).join(", ")})`}}, _class6),ne= (_class7 =class extends te{constructor(...args4) { super(...args4); _class7.prototype.__init10.call(this); }__init10() {this.kind="mat4x4f"}makeColumn(t,n,a,s){return Z(t,n,a,s)}}, _class7),st= exports.Ea =o(()=>Te(1,0,0,1),()=>({value:`mat4x4f(
4
+ 1.0, 0.0,
5
+ 0.0, 1.0
6
+ )`,dataType:Te}),"identity2"),it= exports.Fa =o(()=>be(1,0,0,0,1,0,0,0,1),()=>({value:`mat4x4f(
7
+ 1.0, 0.0, 0.0,
8
+ 0.0, 1.0, 0.0,
9
+ 0.0, 0.0, 1.0,
10
+ )`,dataType:be}),"identity3"),at= exports.Ga =o(()=>c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),()=>({value:`mat4x4f(
11
+ 1.0, 0.0, 0.0, 0.0,
12
+ 0.0, 1.0, 0.0, 0.0,
13
+ 0.0, 0.0, 1.0, 0.0,
14
+ 0.0, 0.0, 0.0, 1.0
15
+ )`,dataType:c}),"identity4"),ot={2:st,3:it,4:at},ht= exports.Ha =o(e=>c(1,0,0,0,0,1,0,0,0,0,1,0,e.x,e.y,e.z,1),e=>({value:`mat4x4f(
16
+ 1, 0, 0, 0,
17
+ 0, 1, 0, 0,
18
+ 0, 0, 1, 0,
19
+ ${e.value}.x, ${e.value}.y, ${e.value}.z, 1
20
+ )`,dataType:c}),"translation4"),ut= exports.Ia =o(e=>c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1),e=>({value:`mat4x4f(
21
+ ${e.value}.x, 0, 0, 0,
22
+ 0, ${e.value}.y, 0, 0,
23
+ 0, 0, ${e.value}.z, 0,
24
+ 0, 0, 0, 1
25
+ )`,dataType:c}),"scaling4"),yt= exports.Ja =o(e=>c(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=>y(`mat4x4f(
26
+ 1, 0, 0, 0,
27
+ 0, cos(${e.value}), sin(${e.value}), 0,
28
+ 0, -sin(${e.value}), cos(${e.value}), 0,
29
+ 0, 0, 0, 1
30
+ )`,c),"rotationX4"),ct= exports.Ka =o(e=>c(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=>y(`mat4x4f(
31
+ cos(${e.value}), 0, -sin(${e.value}), 0,
32
+ 0, 1, 0, 0,
33
+ sin(${e.value}), 0, cos(${e.value}), 0,
34
+ 0, 0, 0, 1
35
+ )`,c),"rotationY4"),lt= exports.La =o(e=>c(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=>y(`mat4x4f(
36
+ cos(${e.value}), sin(${e.value}), 0, 0,
37
+ -sin(${e.value}), cos(${e.value}), 0, 0,
38
+ 0, 0, 1, 0,
39
+ 0, 0, 0, 1
40
+ )`,c),"rotationZ4"),Te= exports.Ma =re({type:"mat2x2f",rows:2,columns:2,makeFromElements:(...e)=>new q(...e)}),be= exports.Na =re({type:"mat3x3f",rows:3,columns:3,makeFromElements:(...e)=>new ee(...e)}),c= exports.Oa =re({type:"mat4x4f",rows:4,columns:4,makeFromElements:(...e)=>new ne(...e)});function Sn(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 Cn(e){return{[r]:!0,type:"ptr",inner:e,addressSpace:"function",access:"read-write"}}function Fn(e){return{[r]:!0,type:"ptr",inner:e,addressSpace:"private",access:"read-write"}}function Mn(e){return{[r]:!0,type:"ptr",inner:e,addressSpace:"workgroup",access:"read-write"}}function Nn(e,t="read"){return{[r]:!0,type:"ptr",inner:e,addressSpace:"storage",access:t}}function Un(e){return{[r]:!0,type:"ptr",inner:e,addressSpace:"uniform",access:"read"}}function Bn(e){return{[r]:!0,type:"ptr",inner:e,addressSpace:"handle",access:"read"}}exports.a = r; exports.b = se; exports.c = dt; exports.d = O; exports.e = C; exports.f = ie; exports.g = gt; exports.h = ve; exports.i = _e; exports.j = Y; exports.k = ae; exports.l = oe; exports.m = he; exports.n = ue; exports.o = ye; exports.p = ce; exports.q = Re; exports.r = qt; exports.s = Qt; exports.t = en; exports.u = tn; exports.v = fe; exports.w = ge; exports.x = Ut; exports.y = d; exports.z = _t; exports.A = At; exports.B = Ie; exports.C = $e; exports.D = ke; exports.E = le; exports.F = It; exports.G = De; exports.H = Pe; exports.I = $t; exports.J = kt; exports.K = xe; exports.L = St; exports.M = Dt; exports.N = Pt; exports.O = Ct; exports.P = we; exports.Q = de; exports.R = pe; exports.S = Ft; exports.T = Mt; exports.U = me; exports.V = Nt; exports.W = Ne; exports.X = Lt; exports.Y = jt; exports.Z = Gt; exports._ = Et; exports.$ = Ot; exports.aa = Kt; exports.ba = Yt; exports.ca = Ht; exports.da = y; exports.ea = Xt; exports.fa = on; exports.ga = o; exports.ha = xn; exports.ia = wn; exports.ja = G; exports.ka = M; exports.la = N; exports.ma = U; exports.na = B; exports.oa = H; exports.pa = Ee; exports.qa = Oe; exports.ra = Ke; exports.sa = Ye; exports.ta = X; exports.ua = He; exports.va = Xe; exports.wa = Ze; exports.xa = Je; exports.ya = Z; exports.za = qe; exports.Aa = Qe; exports.Ba = et; exports.Ca = tt; exports.Da = rt; exports.Ea = st; exports.Fa = it; exports.Ga = at; exports.Ha = ht; exports.Ia = ut; exports.Ja = yt; exports.Ka = ct; exports.La = lt; exports.Ma = Te; exports.Na = be; exports.Oa = c; exports.Pa = Sn; exports.Qa = Cn; exports.Ra = Fn; exports.Sa = Mn; exports.Ta = Nn; exports.Ua = Un; exports.Va = Bn;
41
+ //# sourceMappingURL=chunk-BJSN5UVV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json","../src/shared/symbols.ts","../src/shared/meta.ts","../src/errors.ts","../src/data/matrix.ts","../src/data/ptr.ts"],"names":["version","$internal","$wgslDataType","$gpuValueOf","$getNameForward","isForwarded","value","getName","definition","getMetaData","setName","name","setMetaData","isNamable","metaData","map","prefix","invariant","condition","message","ResolutionError","_ResolutionError","cause","trace","entries","ancestor"],"mappings":"AAGE,+2BAAAA,CAAAA,CAAW,OAAA,CCEN,IAAMC,CAAAA,CAAY,MAAA,CAAO,CAAA,QAAA,EAAWD,CAAO,CAAA,UAAA,CAAY,CAAA,CAIjDE,EAAAA,aAAgB,MAAA,CAAO,CAAA,QAAA,EAAWF,CAAO,CAAA,cAAA,CAAgB,CAAA,CAIzDG,EAAAA,aAAc,MAAA,CAAO,CAAA,QAAA,EAAWH,CAAO,CAAA,YAAA,CAAc,CAAA,CACrDI,CAAAA,aAAkB,MAAA,CAAO,CAAA,QAAA,EAAWJ,CAAO,CAAA,gBAAA,CAAkB,CAAA,CCI1E,SAASK,EAAAA,CAAYC,CAAAA,CAAyD,CAC5E,MAAO,CAAC,iBAAEA,CAAAA,4BAAAA,CAA4CF,CAAe,GACvE,CAEO,SAASG,CAAAA,CAAQC,CAAAA,CAAyC,CAC/D,OAAIH,EAAAA,CAAYG,CAAU,CAAA,CACjBD,CAAAA,CAAQC,CAAAA,CAAWJ,CAAe,CAAC,CAAA,iBAErCK,EAAAA,mBAAYD,CAAU,CAAA,6BAAG,MAClC,CAEO,SAASE,EAAAA,CAAQF,CAAAA,CAAoBG,CAAAA,CAAoB,CAC9DC,EAAAA,CAAYJ,CAAAA,CAAY,CAAE,IAAA,CAAAG,CAAK,CAAC,CAClC,CAYO,SAASE,EAAAA,CAAUP,CAAAA,CAAsC,CAC9D,MAAO,CAAC,iBAAEA,CAAAA,6BAAuB,OACnC,CAEO,SAASG,EAAAA,CACdD,CAAAA,CACsB,CACtB,OAAQ,UAAA,CAAyC,gBAAA,CAAiB,GAAA,CAEhEA,CACF,CACF,CAEO,SAASI,EAAAA,CAAYJ,CAAAA,CAAoBM,CAAAA,CAAkB,CAC/D,UAAA,CAAyC,gBAAA,GAAqB,IAAI,OAAA,CACnE,IAAMC,CAAAA,CAAO,UAAA,CAAyC,gBAAA,CACtDA,CAAAA,CAAI,GAAA,CAAIP,CAAAA,CAAY,CAAE,GAAGO,CAAAA,CAAI,GAAA,CAAIP,CAAU,CAAA,CAAG,GAAGM,CAAS,CAAC,CAC7D,CCpDA,IAAME,CAAAA,CAAS,kBAAA,CAKR,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACmB,CACnB,EAAA,CAAID,CAAAA,CAEF,MAAA,CAKA,MAAM,IAAI,KAAA,CAAMF,CAAM,CAa1B,CASO,IAAMI,EAAAA,CAAN,MAAMC,EAAAA,QAAwB,KAAM,CACzC,WAAA,CACkBC,CAAAA,CACAC,CAAAA,CAChB,CACA,IAAIC,CAAAA,CAAUD,CAAAA,CAAM,GAAA,CAAKE,CAAAA,EAAa,CAAA,EAAA,EAAKA,CAAQ,CAAA,CAAA;AAQU;AAmD3D;ACgaK;AAAA;AAkBA,KAAA;AAAA;AAAA;AAAA;AAmBA,KAAA;AAAA;AAAA;AAAA;AAAA;AAkCA,KAAA;AAAA;AAAA;AAAA;AAIiD,QAAA;AAwBjD,OAAA;AACW,QAAA;AACG,WAAA;AACG,cAAA;AAAA;AA0BtB,OAAA;AAAA;AAEmC,eAAA;AACC,gBAAA;AAAA;AA0BpC,OAAA;AACoC,YAAA;AAAA;AAED,YAAA;AAAA;AA0BnC,OAAA;AACgC,YAAA;AACC,aAAA;AAAA;AAAA;ACvqBnC,OAAA","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-BJSN5UVV.cjs","sourcesContent":["{\n \"name\": \"typegpu\",\n \"private\": true,\n \"version\": \"0.5.9\",\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 },\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 }\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.46.0\",\n \"@typegpu/tgpu-dev-cli\": \"workspace:*\",\n \"@types/node\": \"^22.13.14\",\n \"@webgpu/types\": \"catalog:\",\n \"arktype\": \"catalog:\",\n \"jiti\": \"^2.4.2\",\n \"tgpu-jit\": \"workspace:*\",\n \"tsup\": \"catalog:\",\n \"typescript\": \"catalog:\",\n \"unplugin-typegpu\": \"workspace:*\",\n \"wesl\": \"0.6.7\",\n \"wgpu-matrix\": \"^3.4.0\"\n },\n \"packageManager\": \"pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af\",\n \"dependencies\": {\n \"tinyest\": \"workspace:~0.1.1\",\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 * A value's data type as seen by the WGSL generator\n */\nexport const $wgslDataType = Symbol(`typegpu:${version}:$wgslDataType`);\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","import type { Block, FuncParameter } from 'tinyest';\nimport { $getNameForward } from './symbols.ts';\n\nexport interface MetaData {\n name?: string | undefined;\n ast?: {\n v: number;\n params: FuncParameter[];\n body: Block;\n externalNames: string[];\n } | undefined;\n externals?: Record<string, unknown> | undefined;\n}\n\ninterface GlobalWithMeta {\n __TYPEGPU_META__: WeakMap<object, MetaData>;\n}\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 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\nexport function getMetaData(\n definition: unknown,\n): MetaData | undefined {\n return (globalThis as unknown as GlobalWithMeta).__TYPEGPU_META__.get(\n // biome-ignore lint/suspicious/noExplicitAny: it's fine, if it's not an object, the get will return undefined\n definition as any,\n );\n}\n\nexport function setMetaData(definition: object, metaData: object) {\n (globalThis as unknown as GlobalWithMeta).__TYPEGPU_META__ ??= new WeakMap();\n const map = (globalThis as unknown as GlobalWithMeta).__TYPEGPU_META__;\n map.set(definition, { ...map.get(definition), ...metaData });\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 } from './shared/meta.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 (process.env.NODE_ENV === 'production') {\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) => `- ${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 `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 * @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(layout, 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","import { createDualImpl } from '../shared/generators.ts';\nimport { $repr } from '../shared/repr.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { SelfResolvable } from '../types.ts';\nimport { snip } from './dataTypes.ts';\nimport { vec2f, vec3f, vec4f } from './vector.ts';\nimport type {\n AnyWgslData,\n m2x2f,\n m3x3f,\n m4x4f,\n mat2x2,\n Mat2x2f,\n mat3x3,\n Mat3x3f,\n mat4x4,\n Mat4x4f,\n matBase,\n v2f,\n v3f,\n v4f,\n VecKind,\n} from './wgslTypes.ts';\n\n// --------------\n// Implementation\n// --------------\n\ntype vBase = {\n kind: VecKind;\n length: number;\n [n: number]: number;\n};\n\ninterface MatSchemaOptions<TType extends string, ValueType> {\n type: TType;\n rows: 2 | 3 | 4;\n columns: 2 | 3 | 4;\n makeFromElements(...elements: number[]): ValueType;\n}\n\ntype MatConstructor<\n ValueType extends matBase<ColumnType>,\n ColumnType extends vBase,\n> = (...args: (number | ColumnType)[]) => ValueType;\n\nfunction createMatSchema<\n TType extends string,\n ValueType extends matBase<ColumnType>,\n ColumnType extends vBase,\n>(\n options: MatSchemaOptions<TType, ValueType>,\n): { type: TType; [$repr]: ValueType } & MatConstructor<ValueType, ColumnType> {\n const MatSchema = {\n [$internal]: true,\n [$repr]: undefined as unknown as ValueType,\n type: options.type,\n identity: identityFunctions[options.columns],\n translation: options.columns === 4 ? translation4 : undefined,\n scaling: options.columns === 4 ? scaling4 : undefined,\n rotationX: options.columns === 4 ? rotationX4 : undefined,\n rotationY: options.columns === 4 ? rotationY4 : undefined,\n rotationZ: options.columns === 4 ? rotationZ4 : undefined,\n } as unknown as AnyWgslData;\n\n const construct = createDualImpl(\n // CPU implementation\n (...args: (number | ColumnType)[]): ValueType => {\n const elements: number[] = [];\n\n for (const arg of args) {\n if (typeof arg === 'number') {\n elements.push(arg);\n } else {\n for (let i = 0; i < arg.length; ++i) {\n elements.push(arg[i] as number);\n }\n }\n }\n\n if (\n elements.length !== 0 &&\n elements.length !== options.columns * options.rows\n ) {\n throw new Error(\n `'${options.type}' constructor called with invalid number of arguments.`,\n );\n }\n\n for (let i = elements.length; i < options.columns * options.rows; ++i) {\n elements.push(0);\n }\n\n return options.makeFromElements(...elements);\n },\n // GPU implementation\n (...args) =>\n snip(\n `${MatSchema.type}(${args.map((v) => v.value).join(', ')})`,\n MatSchema,\n ),\n MatSchema.type,\n );\n\n return Object.assign(construct, MatSchema) as unknown as {\n type: TType;\n [$repr]: ValueType;\n } & MatConstructor<ValueType, ColumnType>;\n}\n\nabstract class mat2x2Impl<TColumn extends v2f>\n implements mat2x2<TColumn>, SelfResolvable {\n public readonly [$internal] = true;\n public readonly columns: readonly [TColumn, TColumn];\n public readonly length = 4;\n public abstract readonly kind: string;\n [n: number]: number;\n\n constructor(...elements: number[]) {\n this.columns = [\n this.makeColumn(elements[0] as number, elements[1] as number),\n this.makeColumn(elements[2] as number, elements[3] as number),\n ];\n }\n\n abstract makeColumn(e0: number, e1: number): TColumn;\n\n get [0]() {\n return this.columns[0].x;\n }\n\n get [1]() {\n return this.columns[0].y;\n }\n\n get [2]() {\n return this.columns[1].x;\n }\n\n get [3]() {\n return this.columns[1].y;\n }\n\n set [0](value: number) {\n this.columns[0].x = value;\n }\n\n set [1](value: number) {\n this.columns[0].y = value;\n }\n\n set [2](value: number) {\n this.columns[1].x = value;\n }\n\n set [3](value: number) {\n this.columns[1].y = value;\n }\n\n *[Symbol.iterator]() {\n yield this[0];\n yield this[1];\n yield this[2];\n yield this[3];\n }\n\n '~resolve'(): string {\n return `${this.kind}(${\n Array.from({ length: this.length })\n .map((_, i) => this[i])\n .join(', ')\n })`;\n }\n}\nclass mat2x2fImpl extends mat2x2Impl<v2f> implements m2x2f {\n public readonly kind = 'mat2x2f';\n\n makeColumn(e0: number, e1: number): v2f {\n return vec2f(e0, e1);\n }\n}\n\nabstract class mat3x3Impl<TColumn extends v3f>\n implements mat3x3<TColumn>, SelfResolvable {\n public readonly [$internal] = true;\n public readonly columns: readonly [TColumn, TColumn, TColumn];\n public readonly length = 12;\n public abstract readonly kind: string;\n [n: number]: number;\n\n constructor(...elements: number[]) {\n this.columns = [\n this.makeColumn(\n elements[0] as number,\n elements[1] as number,\n elements[2] as number,\n ),\n this.makeColumn(\n elements[3] as number,\n elements[4] as number,\n elements[5] as number,\n ),\n this.makeColumn(\n elements[6] as number,\n elements[7] as number,\n elements[8] as number,\n ),\n ];\n }\n\n abstract makeColumn(x: number, y: number, z: number): TColumn;\n\n get [0]() {\n return this.columns[0].x;\n }\n\n get [1]() {\n return this.columns[0].y;\n }\n\n get [2]() {\n return this.columns[0].z;\n }\n\n get [3]() {\n return 0;\n }\n\n get [4]() {\n return this.columns[1].x;\n }\n\n get [5]() {\n return this.columns[1].y;\n }\n\n get [6]() {\n return this.columns[1].z;\n }\n\n get [7]() {\n return 0;\n }\n\n get [8]() {\n return this.columns[2].x;\n }\n\n get [9]() {\n return this.columns[2].y;\n }\n\n get [10]() {\n return this.columns[2].z;\n }\n\n get [11]() {\n return 0;\n }\n\n set [0](value: number) {\n this.columns[0].x = value;\n }\n\n set [1](value: number) {\n this.columns[0].y = value;\n }\n\n set [2](value: number) {\n this.columns[0].z = value;\n }\n\n set [3](_: number) {}\n\n set [4](value: number) {\n this.columns[1].x = value;\n }\n\n set [5](value: number) {\n this.columns[1].y = value;\n }\n\n set [6](value: number) {\n this.columns[1].z = value;\n }\n\n set [7](_: number) {}\n\n set [8](value: number) {\n this.columns[2].x = value;\n }\n\n set [9](value: number) {\n this.columns[2].y = value;\n }\n\n set [10](value: number) {\n this.columns[2].z = value;\n }\n\n set [11](_: number) {}\n\n *[Symbol.iterator]() {\n for (let i = 0; i < 12; i++) {\n yield this[i] as number;\n }\n }\n\n '~resolve'(): string {\n return `${this.kind}(${this[0]}, ${this[1]}, ${this[2]}, ${this[4]}, ${\n this[5]\n }, ${this[6]}, ${this[8]}, ${this[9]}, ${this[10]})`;\n }\n}\n\nclass mat3x3fImpl extends mat3x3Impl<v3f> implements m3x3f {\n public readonly kind = 'mat3x3f';\n makeColumn(x: number, y: number, z: number): v3f {\n return vec3f(x, y, z);\n }\n}\n\nabstract class mat4x4Impl<TColumn extends v4f>\n implements mat4x4<TColumn>, SelfResolvable {\n public readonly [$internal] = true;\n public readonly columns: readonly [TColumn, TColumn, TColumn, TColumn];\n public abstract readonly kind: string;\n\n constructor(...elements: number[]) {\n this.columns = [\n this.makeColumn(\n elements[0] as number,\n elements[1] as number,\n elements[2] as number,\n elements[3] as number,\n ),\n this.makeColumn(\n elements[4] as number,\n elements[5] as number,\n elements[6] as number,\n elements[7] as number,\n ),\n this.makeColumn(\n elements[8] as number,\n elements[9] as number,\n elements[10] as number,\n elements[11] as number,\n ),\n this.makeColumn(\n elements[12] as number,\n elements[13] as number,\n elements[14] as number,\n elements[15] as number,\n ),\n ];\n }\n\n abstract makeColumn(x: number, y: number, z: number, w: number): TColumn;\n\n public readonly length = 16;\n [n: number]: number;\n\n get [0]() {\n return this.columns[0].x;\n }\n\n get [1]() {\n return this.columns[0].y;\n }\n\n get [2]() {\n return this.columns[0].z;\n }\n\n get [3]() {\n return this.columns[0].w;\n }\n\n get [4]() {\n return this.columns[1].x;\n }\n\n get [5]() {\n return this.columns[1].y;\n }\n\n get [6]() {\n return this.columns[1].z;\n }\n\n get [7]() {\n return this.columns[1].w;\n }\n\n get [8]() {\n return this.columns[2].x;\n }\n\n get [9]() {\n return this.columns[2].y;\n }\n\n get [10]() {\n return this.columns[2].z;\n }\n\n get [11]() {\n return this.columns[2].w;\n }\n\n get [12]() {\n return this.columns[3].x;\n }\n\n get [13]() {\n return this.columns[3].y;\n }\n\n get [14]() {\n return this.columns[3].z;\n }\n\n get [15]() {\n return this.columns[3].w;\n }\n\n set [0](value: number) {\n this.columns[0].x = value;\n }\n\n set [1](value: number) {\n this.columns[0].y = value;\n }\n\n set [2](value: number) {\n this.columns[0].z = value;\n }\n\n set [3](value: number) {\n this.columns[0].w = value;\n }\n\n set [4](value: number) {\n this.columns[1].x = value;\n }\n\n set [5](value: number) {\n this.columns[1].y = value;\n }\n\n set [6](value: number) {\n this.columns[1].z = value;\n }\n\n set [7](value: number) {\n this.columns[1].w = value;\n }\n\n set [8](value: number) {\n this.columns[2].x = value;\n }\n\n set [9](value: number) {\n this.columns[2].y = value;\n }\n\n set [10](value: number) {\n this.columns[2].z = value;\n }\n\n set [11](value: number) {\n this.columns[2].w = value;\n }\n\n set [12](value: number) {\n this.columns[3].x = value;\n }\n\n set [13](value: number) {\n this.columns[3].y = value;\n }\n\n set [14](value: number) {\n this.columns[3].z = value;\n }\n\n set [15](value: number) {\n this.columns[3].w = value;\n }\n\n *[Symbol.iterator]() {\n for (let i = 0; i < 16; i++) {\n yield this[i] as number;\n }\n }\n\n '~resolve'(): string {\n return `${this.kind}(${\n Array.from({ length: this.length })\n .map((_, i) => this[i])\n .join(', ')\n })`;\n }\n}\n\nclass mat4x4fImpl extends mat4x4Impl<v4f> implements m4x4f {\n public readonly kind = 'mat4x4f';\n\n makeColumn(x: number, y: number, z: number, w: number): v4f {\n return vec4f(x, y, z, w);\n }\n}\n\n// ----------\n// Matrix ops\n// ----------\n\n/**\n * Returns a 2-by-2 identity matrix.\n * @returns {m2x2f} The result matrix.\n */\nexport const identity2 = createDualImpl(\n // CPU implementation\n () => mat2x2f(1, 0, 0, 1),\n // GPU implementation\n () => ({\n value: `mat4x4f(\n 1.0, 0.0,\n 0.0, 1.0\n )`,\n dataType: mat2x2f,\n }),\n 'identity2',\n);\n\n/**\n * Returns a 3-by-3 identity matrix.\n * @returns {m3x3f} The result matrix.\n */\nexport const identity3 = createDualImpl(\n // CPU implementation\n () => mat3x3f(1, 0, 0, 0, 1, 0, 0, 0, 1),\n // GPU implementation\n () => ({\n value: `mat4x4f(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0,\n )`,\n dataType: mat3x3f,\n }),\n 'identity3',\n);\n\n/**\n * Returns a 4-by-4 identity matrix.\n * @returns {m4x4f} The result matrix.\n */\nexport const identity4 = createDualImpl(\n // CPU implementation\n () => mat4x4f(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),\n // GPU implementation\n () => ({\n value: `mat4x4f(\n 1.0, 0.0, 0.0, 0.0,\n 0.0, 1.0, 0.0, 0.0,\n 0.0, 0.0, 1.0, 0.0,\n 0.0, 0.0, 0.0, 1.0\n )`,\n dataType: mat4x4f,\n }),\n 'identity4',\n);\n\nconst identityFunctions = {\n 2: identity2,\n 3: identity3,\n 4: identity4,\n};\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param {v3f} vector - The vector by which to translate.\n * @returns {m4x4f} The translation matrix.\n */\nexport const translation4 = createDualImpl(\n // CPU implementation\n (vector: v3f) =>\n // deno-fmt-ignore\n mat4x4f(\n 1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n vector.x, vector.y, vector.z, 1,\n ),\n // GPU implementation\n (vector) => ({\n value: `mat4x4f(\n 1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0, \n ${vector.value}.x, ${vector.value}.y, ${vector.value}.z, 1\n )`,\n dataType: mat4x4f,\n }),\n 'translation4',\n);\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by the corresponding entry in the given vector.\n * @param {v3f} vector - A vector of three entries specifying the factor by which to scale in each dimension.\n * @returns {m4x4f} The scaling matrix.\n */\nexport const scaling4 = createDualImpl(\n // CPU implementation\n (vector: v3f) =>\n // deno-fmt-ignore\n mat4x4f(\n vector.x, 0, 0, 0,\n 0, vector.y, 0, 0,\n 0, 0, vector.z, 0,\n 0, 0, 0, 1,\n ),\n // GPU implementation\n (vector) => ({\n value: `mat4x4f(\n ${vector.value}.x, 0, 0, 0,\n 0, ${vector.value}.y, 0, 0,\n 0, 0, ${vector.value}.z, 0, \n 0, 0, 0, 1\n )`,\n dataType: mat4x4f,\n }),\n 'scaling4',\n);\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param {number} angle - The angle by which to rotate (in radians).\n * @returns {m4x4f} The rotation matrix.\n */\nexport const rotationX4 = createDualImpl(\n // CPU implementation\n (a: number) =>\n // deno-fmt-ignore\n mat4x4f(\n 1, 0, 0, 0,\n 0, Math.cos(a), Math.sin(a), 0,\n 0, -Math.sin(a), Math.cos(a), 0,\n 0, 0, 0, 1,\n ),\n // GPU implementation\n (a) =>\n snip(\n `mat4x4f(\n 1, 0, 0, 0,\n 0, cos(${a.value}), sin(${a.value}), 0,\n 0, -sin(${a.value}), cos(${a.value}), 0,\n 0, 0, 0, 1\n )`,\n mat4x4f,\n ),\n 'rotationX4',\n);\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param {number} angle - The angle by which to rotate (in radians).\n * @returns {m4x4f} The rotation matrix.\n */\nexport const rotationY4 = createDualImpl(\n // CPU implementation\n (a: number) =>\n // deno-fmt-ignore\n mat4x4f(\n Math.cos(a), 0, -Math.sin(a), 0,\n 0, 1, 0, 0,\n Math.sin(a), 0, Math.cos(a), 0,\n 0, 0, 0, 1,\n ),\n // GPU implementation\n (a) =>\n snip(\n `mat4x4f(\n cos(${a.value}), 0, -sin(${a.value}), 0,\n 0, 1, 0, 0,\n sin(${a.value}), 0, cos(${a.value}), 0,\n 0, 0, 0, 1\n )`,\n mat4x4f,\n ),\n 'rotationY4',\n);\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param {number} angle - The angle by which to rotate (in radians).\n * @returns {m4x4f} The rotation matrix.\n */\nexport const rotationZ4 = createDualImpl(\n // CPU implementation\n (a: number) =>\n // deno-fmt-ignore\n mat4x4f(\n Math.cos(a), Math.sin(a), 0, 0,\n -Math.sin(a), Math.cos(a), 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1,\n ),\n // GPU implementation\n (a) =>\n snip(\n `mat4x4f(\n cos(${a.value}), sin(${a.value}), 0, 0,\n -sin(${a.value}), cos(${a.value}), 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1\n )`,\n mat4x4f,\n ),\n 'rotationZ4',\n);\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Schema representing mat2x2f - a matrix with 2 rows and 2 columns, with elements of type f32.\n * Also a constructor function for this matrix type.\n *\n * @example\n * const zero2x2 = mat2x2f(); // filled with zeros\n *\n * @example\n * const mat = mat2x2f(0, 1, 2, 3);\n * mat.columns[0] // vec2f(0, 1)\n * mat.columns[1] // vec2f(2, 3)\n *\n * @example\n * const mat = mat2x2f(\n * vec2f(0, 1), // column 0\n * vec2f(1, 2), // column 1\n * );\n *\n * @example\n * const buffer = root.createBuffer(d.mat2x2f, d.mat2x2f(0, 1, 2, 3)); // buffer holding a d.mat2x2f value, with an initial value of ((0, 1), (2, 3))\n */\nexport const mat2x2f = createMatSchema<'mat2x2f', m2x2f, v2f>({\n type: 'mat2x2f',\n rows: 2,\n columns: 2,\n makeFromElements: (...elements: number[]) => new mat2x2fImpl(...elements),\n}) as Mat2x2f;\n\n/**\n * Schema representing mat3x3f - a matrix with 3 rows and 3 columns, with elements of type f32.\n * Also a constructor function for this matrix type.\n *\n * @example\n * const zero3x3 = mat3x3f(); // filled with zeros\n *\n * @example\n * const mat = mat3x3f(0, 1, 2, 3, 4, 5, 6, 7, 8);\n * mat.columns[0] // vec3f(0, 1, 2)\n * mat.columns[1] // vec3f(3, 4, 5)\n * mat.columns[2] // vec3f(6, 7, 8)\n *\n * @example\n * const mat = mat3x3f(\n * vec3f(0, 1, 2), // column 0\n * vec3f(2, 3, 4), // column 1\n * vec3f(5, 6, 7), // column 2\n * );\n *\n * @example\n * const buffer = root.createBuffer(d.mat3x3f, d.mat3x3f()); // buffer holding a d.mat3x3f value, with an initial value of mat3x3f filled with zeros\n */\nexport const mat3x3f = createMatSchema<'mat3x3f', m3x3f, v3f>({\n type: 'mat3x3f',\n rows: 3,\n columns: 3,\n makeFromElements: (...elements: number[]) => new mat3x3fImpl(...elements),\n}) as Mat3x3f;\n\n/**\n * Schema representing mat4x4f - a matrix with 4 rows and 4 columns, with elements of type f32.\n * Also a constructor function for this matrix type.\n *\n * @example\n * const zero4x4 = mat4x4f(); // filled with zeros\n *\n * @example\n * const mat = mat4x4f(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);\n * mat.columns[0] // vec4f(0, 1, 2, 3)\n * mat.columns[1] // vec4f(4, 5, 6, 7)\n * mat.columns[2] // vec4f(8, 9, 10, 11)\n * mat.columns[3] // vec4f(12, 13, 14, 15)\n *\n * @example\n * const mat = mat4x4f(\n * vec4f(0, 1, 2, 3), // column 0\n * vec4f(4, 5, 6, 7), // column 1\n * vec4f(8, 9, 10, 11), // column 2\n * vec4f(12, 13, 14, 15), // column 3\n * );\n *\n * @example\n * const buffer = root.createBuffer(d.mat4x4f, d.mat4x4f()); // buffer holding a d.mat4x4f value, with an initial value of mat4x4f filled with zeros\n */\nexport const mat4x4f = createMatSchema<'mat4x4f', m4x4f, v4f>({\n type: 'mat4x4f',\n rows: 4,\n columns: 4,\n makeFromElements: (...elements: number[]) => new mat4x4fImpl(...elements),\n}) as Mat4x4f;\n\nexport function matToArray(mat: m2x2f | m3x3f | m4x4f): number[] {\n if (mat.kind === 'mat3x3f') {\n return [\n mat[0],\n mat[1],\n mat[2],\n mat[4],\n mat[5],\n mat[6],\n mat[8],\n mat[9],\n mat[10],\n ] as number[];\n }\n\n return Array.from({ length: mat.length }).map((_, idx) => mat[idx] as number);\n}\n","import { $internal } from '../shared/symbols.ts';\nimport type { AnyData } from './dataTypes.ts';\nimport type { Ptr } from './wgslTypes.ts';\n\nexport function ptrFn<T extends AnyData>(\n inner: T,\n): Ptr<'function', T, 'read-write'> {\n return {\n [$internal]: true,\n type: 'ptr',\n inner,\n addressSpace: 'function',\n access: 'read-write',\n } as Ptr<'function', T, 'read-write'>;\n}\n\nexport function ptrPrivate<T extends AnyData>(\n inner: T,\n): Ptr<'private', T, 'read-write'> {\n return {\n [$internal]: true,\n type: 'ptr',\n inner,\n addressSpace: 'private',\n access: 'read-write',\n } as Ptr<'private', T, 'read-write'>;\n}\n\nexport function ptrWorkgroup<T extends AnyData>(\n inner: T,\n): Ptr<'workgroup', T, 'read-write'> {\n return {\n [$internal]: true,\n type: 'ptr',\n inner,\n addressSpace: 'workgroup',\n access: 'read-write',\n } as Ptr<'workgroup', T, 'read-write'>;\n}\n\nexport function ptrStorage<\n T extends AnyData,\n TAccess extends 'read' | 'read-write' = 'read',\n>(inner: T, access: TAccess = 'read' as TAccess): Ptr<'storage', T, TAccess> {\n return {\n [$internal]: true,\n type: 'ptr',\n inner,\n addressSpace: 'storage',\n access,\n } as Ptr<'storage', T, TAccess>;\n}\n\nexport function ptrUniform<T extends AnyData>(\n inner: T,\n): Ptr<'uniform', T, 'read'> {\n return {\n [$internal]: true,\n type: 'ptr',\n inner,\n addressSpace: 'uniform',\n access: 'read',\n } as Ptr<'uniform', T, 'read'>;\n}\n\nexport function ptrHandle<T extends AnyData>(\n inner: T,\n): Ptr<'handle', T, 'read'> {\n return {\n [$internal]: true,\n type: 'ptr',\n inner,\n addressSpace: 'handle',\n access: 'read',\n } as Ptr<'handle', T, 'read'>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkBJSN5UVVcjs = require('./chunk-BJSN5UVV.cjs');function X(t){let e=r=>r;return Object.setPrototypeOf(e,Y),e.propTypes=t,e}var Y={[_chunkBJSN5UVVcjs.a]:!0,type:"struct",$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this},toString(){return`struct:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}};var b=(t,e)=>{let r=e-1,i=~r;return(t&r)===0?t:(t&i)+e};var n= (_class =class{constructor(e){;_class.prototype.__init.call(this);this.type=e}__init() {this[_chunkBJSN5UVVcjs.a]=!0}}, _class),Z= exports.b ={uint8:_chunkBJSN5UVVcjs.ka,uint8x2:_chunkBJSN5UVVcjs.ra,uint8x4:_chunkBJSN5UVVcjs.Ba,sint8:_chunkBJSN5UVVcjs.la,sint8x2:_chunkBJSN5UVVcjs.qa,sint8x4:_chunkBJSN5UVVcjs.Aa,unorm8:_chunkBJSN5UVVcjs.ma,unorm8x2:_chunkBJSN5UVVcjs.oa,unorm8x4:_chunkBJSN5UVVcjs.ya,snorm8:_chunkBJSN5UVVcjs.ma,snorm8x2:_chunkBJSN5UVVcjs.oa,snorm8x4:_chunkBJSN5UVVcjs.ya,uint16:_chunkBJSN5UVVcjs.ka,uint16x2:_chunkBJSN5UVVcjs.ra,uint16x4:_chunkBJSN5UVVcjs.Ba,sint16:_chunkBJSN5UVVcjs.la,sint16x2:_chunkBJSN5UVVcjs.qa,sint16x4:_chunkBJSN5UVVcjs.Aa,unorm16:_chunkBJSN5UVVcjs.ma,unorm16x2:_chunkBJSN5UVVcjs.oa,unorm16x4:_chunkBJSN5UVVcjs.ya,snorm16:_chunkBJSN5UVVcjs.ma,snorm16x2:_chunkBJSN5UVVcjs.oa,snorm16x4:_chunkBJSN5UVVcjs.ya,float16:_chunkBJSN5UVVcjs.ma,float16x2:_chunkBJSN5UVVcjs.oa,float16x4:_chunkBJSN5UVVcjs.ya,float32:_chunkBJSN5UVVcjs.ma,float32x2:_chunkBJSN5UVVcjs.oa,float32x3:_chunkBJSN5UVVcjs.ta,float32x4:_chunkBJSN5UVVcjs.ya,uint32:_chunkBJSN5UVVcjs.ka,uint32x2:_chunkBJSN5UVVcjs.ra,uint32x3:_chunkBJSN5UVVcjs.wa,uint32x4:_chunkBJSN5UVVcjs.Ba,sint32:_chunkBJSN5UVVcjs.la,sint32x2:_chunkBJSN5UVVcjs.qa,sint32x3:_chunkBJSN5UVVcjs.va,sint32x4:_chunkBJSN5UVVcjs.Aa,"unorm10-10-10-2":_chunkBJSN5UVVcjs.ya,"unorm8x4-bgra":_chunkBJSN5UVVcjs.ya},H= exports.c =Object.keys(Z),Vt= exports.d =new n("uint8"),Ft= exports.e =new n("uint8x2"),St= exports.f =new n("uint8x4"),_t= exports.g =new n("sint8"),ht= exports.h =new n("sint8x2"),Lt= exports.i =new n("sint8x4"),Wt= exports.j =new n("unorm8"),kt= exports.k =new n("unorm8x2"),Pt= exports.l =new n("unorm8x4"),zt= exports.m =new n("snorm8"),Ut= exports.n =new n("snorm8x2"),Ot= exports.o =new n("snorm8x4"),$t= exports.p =new n("uint16"),Et= exports.q =new n("uint16x2"),Nt= exports.r =new n("uint16x4"),Mt= exports.s =new n("sint16"),Ct= exports.t =new n("sint16x2"),Gt= exports.u =new n("sint16x4"),jt= exports.v =new n("unorm16"),Rt= exports.w =new n("unorm16x2"),Kt= exports.x =new n("unorm16x4"),Ht= exports.y =new n("snorm16"),Jt= exports.z =new n("snorm16x2"),qt= exports.A =new n("snorm16x4"),Qt= exports.B =new n("float16"),Xt= exports.C =new n("float16x2"),Yt= exports.D =new n("float16x4"),Zt= exports.E =new n("float32"),te= exports.F =new n("float32x2"),ee= exports.G =new n("float32x3"),ne= exports.H =new n("float32x4"),re= exports.I =new n("uint32"),oe= exports.J =new n("uint32x2"),ie= exports.K =new n("uint32x3"),ae= exports.L =new n("uint32x4"),se= exports.M =new n("sint32"),ue= exports.N =new n("sint32x2"),pe= exports.O =new n("sint32x3"),xe= exports.P =new n("sint32x4"),le= exports.Q =new n("unorm10-10-10-2"),me= exports.R =new n("unorm8x4-bgra");var tt={f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2h:4,vec2i:8,vec2u:8,vec3f:16,vec3h:8,vec3i:16,vec3u:16,vec4f:16,vec4h:8,vec4i:16,vec4u:16,mat2x2f:8,mat3x3f:16,mat4x4f:16,atomic:4};function et(t){let e=_optionalChain([t, 'optionalAccess', _2 => _2.type]),r=tt[e];if(r!==void 0)return r;if(_chunkBJSN5UVVcjs.M.call(void 0, t))return Object.values(t.propTypes).map(x).reduce((i,y)=>i>y?i:y);if(_chunkBJSN5UVVcjs.L.call(void 0, t))return x(t.elementType);if(_chunkBJSN5UVVcjs.Y.call(void 0, t)){let i=Object.values(t.propTypes)[0];return i?_nullishCoalesce(_chunkBJSN5UVVcjs._.call(void 0, i), () => (1)):1}if(_chunkBJSN5UVVcjs.X.call(void 0, t))return _nullishCoalesce(_chunkBJSN5UVVcjs._.call(void 0, t.elementType), () => (1));if(_chunkBJSN5UVVcjs.U.call(void 0, t)||_chunkBJSN5UVVcjs.Z.call(void 0, t))return _nullishCoalesce(_chunkBJSN5UVVcjs._.call(void 0, t), () => (x(t.inner)));if(H.includes(e))return 1;throw new Error(`Cannot determine alignment of data: ${JSON.stringify(t)}`)}function nt(t){if(_chunkBJSN5UVVcjs.Y.call(void 0, t)){let e=Object.values(t.propTypes)[0];return e?I(e):1}return _chunkBJSN5UVVcjs.X.call(void 0, t)?I(t.elementType):_chunkBJSN5UVVcjs.Z.call(void 0, t)?_nullishCoalesce(_chunkBJSN5UVVcjs._.call(void 0, t), () => (I(t.inner))):_nullishCoalesce(_chunkBJSN5UVVcjs._.call(void 0, t), () => (1))}var J=new WeakMap,q=new WeakMap;function x(t){let e=J.get(t);return e===void 0&&(e=et(t),J.set(t,e)),e}function I(t){let e=q.get(t);return e===void 0&&(e=nt(t),q.set(t,e)),e}function rt(t){return x(t)}var ot={f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2h:4,vec2i:8,vec2u:8,vec3f:12,vec3h:6,vec3i:12,vec3u:12,vec4f:16,vec4h:8,vec4i:16,vec4u:16,mat2x2f:16,mat3x3f:48,mat4x4f:64,uint8:1,uint8x2:2,uint8x4:4,sint8:1,sint8x2:2,sint8x4:4,unorm8:1,unorm8x2:2,unorm8x4:4,snorm8:1,snorm8x2:2,snorm8x4:4,uint16:2,uint16x2:4,uint16x4:8,sint16:2,sint16x2:4,sint16x4:8,unorm16:2,unorm16x2:4,unorm16x4:8,snorm16:2,snorm16x2:4,snorm16x4:8,float16:2,float16x2:4,float16x4:8,float32:4,float32x2:8,float32x3:12,float32x4:16,uint32:4,uint32x2:8,uint32x3:12,uint32x4:16,sint32:4,sint32x2:8,sint32x3:12,sint32x4:16,"unorm10-10-10-2":4,"unorm8x4-bgra":4,atomic:4};function it(t){let e=0;for(let r of Object.values(t.propTypes)){if(Number.isNaN(e))throw new Error("Only the last property of a struct can be unbounded");if(e=b(e,x(r)),e+=l(r),Number.isNaN(e)&&r.type!=="array")throw new Error("Cannot nest unbounded struct within another struct")}return b(e,x(t))}function at(t){let e=0;for(let r of Object.values(t.propTypes)){let i=I(r);e=b(e,i),e+=l(r)}return e}function st(t){let e=ot[_optionalChain([t, 'optionalAccess', _3 => _3.type])];if(e!==void 0)return e;if(_chunkBJSN5UVVcjs.M.call(void 0, t))return it(t);if(_chunkBJSN5UVVcjs.Y.call(void 0, t))return at(t);if(_chunkBJSN5UVVcjs.L.call(void 0, t)){if(t.elementCount===0)return Number.NaN;let r=x(t.elementType);return b(l(t.elementType),r)*t.elementCount}if(_chunkBJSN5UVVcjs.X.call(void 0, t)){let r=I(t.elementType);return b(l(t.elementType),r)*t.elementCount}if(_chunkBJSN5UVVcjs.U.call(void 0, t)||_chunkBJSN5UVVcjs.Z.call(void 0, t))return _nullishCoalesce(_chunkBJSN5UVVcjs.$.call(void 0, t), () => (l(t.inner)));throw new Error(`Cannot determine size of data: ${t}`)}var Q=new WeakMap;function l(t){let e=Q.get(t);return e===void 0&&(e=st(t),Q.set(t,e)),e}function ut(t){return l(t)}function G(t,e){return new C(t,e)}var C= (_class2 =class{constructor(e,r){;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);this.elementType=e;this.elementCount=r;if(Number.isNaN(l(e)))throw new Error("Cannot nest runtime sized arrays.");if(!Number.isInteger(r)||r<0)throw new Error(`Cannot create array schema with invalid element count: ${r}.`)}__init2() {this[_chunkBJSN5UVVcjs.a]=!0}__init3() {this.type="array"}toString(){return`arrayOf(${this.elementType})`}}, _class2);function pt(t,e){return new j(t,e)}var j= (_class3 =class{constructor(e,r){;_class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);this.elementType=e;this.elementCount=r;if(!Number.isInteger(r)||r<0)throw new Error(`Cannot create disarray schema with invalid element count: ${r}.`)}__init4() {this[_chunkBJSN5UVVcjs.a]=!0}__init5() {this.type="disarray"}}, _class3);function xt(t){let e=r=>r;return Object.setPrototypeOf(e,lt),e.propTypes=t,e}var lt={[_chunkBJSN5UVVcjs.a]:!0,type:"unstruct",$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this},toString(){return`unstruct:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}};function mt(t){return new R(t)}var R= (_class4 =class{constructor(e){;_class4.prototype.__init6.call(this);_class4.prototype.__init7.call(this);this.inner=e}__init6() {this[_chunkBJSN5UVVcjs.a]=!0}__init7() {this.type="atomic"}}, _class4);function B(t,e){return _chunkBJSN5UVVcjs.U.call(void 0, t)?new k(t.inner,[e,...t.attribs]):_chunkBJSN5UVVcjs.Z.call(void 0, t)?new P(t.inner,[e,...t.attribs]):_chunkBJSN5UVVcjs.W.call(void 0, t)?new P(t,[e]):new k(t,[e])}function ct(t,e){return B(e,{[_chunkBJSN5UVVcjs.a]:!0,type:"@align",value:t})}function yt(t,e){return B(e,{[_chunkBJSN5UVVcjs.a]:!0,type:"@size",value:t})}function ft(t,e){return B(e,{[_chunkBJSN5UVVcjs.a]:!0,type:"@location",value:t})}function dt(t,e){return B(e,{[_chunkBJSN5UVVcjs.a]:!0,type:"@interpolate",value:t})}function Tt(t){return(_chunkBJSN5UVVcjs.U.call(void 0, t)||_chunkBJSN5UVVcjs.Z.call(void 0, t))&&t.attribs.find(_chunkBJSN5UVVcjs.T)!==void 0}function $e(t){return!_chunkBJSN5UVVcjs.U.call(void 0, t)&&!_chunkBJSN5UVVcjs.Z.call(void 0, t)?"":t.attribs.map(e=>`${e.type}(${e.value}) `).join("")}var W= (_class5 =class{constructor(e,r){;_class5.prototype.__init8.call(this);this.inner=e;this.attribs=r;let i=_optionalChain([r, 'access', _4 => _4.find, 'call', _5 => _5(_chunkBJSN5UVVcjs.P), 'optionalAccess', _6 => _6.value]),y=_optionalChain([r, 'access', _7 => _7.find, 'call', _8 => _8(_chunkBJSN5UVVcjs.Q), 'optionalAccess', _9 => _9.value]);if(i!==void 0){if(i<=0)throw new Error(`Custom data alignment must be a positive number, got: ${i}.`);if(Math.log2(i)%1!==0)throw new Error(`Alignment has to be a power of 2, got: ${i}.`);if(_chunkBJSN5UVVcjs.K.call(void 0, this.inner)&&i%x(this.inner)!==0)throw new Error(`Custom alignment has to be a multiple of the standard data alignment. Got: ${i}, expected multiple of: ${x(this.inner)}.`)}if(y!==void 0){if(y<l(this.inner))throw new Error(`Custom data size cannot be smaller then the standard data size. Got: ${y}, expected at least: ${l(this.inner)}.`);if(y<=0)throw new Error(`Custom data size must be a positive number. Got: ${y}.`)}}__init8() {this[_chunkBJSN5UVVcjs.a]=!0}}, _class5),k= (_class6 =class extends W{constructor(...args) { super(...args); _class6.prototype.__init9.call(this);_class6.prototype.__init10.call(this); }__init9() {this[_chunkBJSN5UVVcjs.a]=!0}__init10() {this.type="decorated"}}, _class6),P= (_class7 =class extends W{constructor(...args2) { super(...args2); _class7.prototype.__init11.call(this);_class7.prototype.__init12.call(this); }__init11() {this[_chunkBJSN5UVVcjs.a]=!0}__init12() {this.type="loose-decorated"}}, _class7);function a(t,e){return B(t,{[_chunkBJSN5UVVcjs.a]:!0,type:"@builtin",value:e})}var gt={vertexIndex:a(_chunkBJSN5UVVcjs.ka,"vertex_index"),instanceIndex:a(_chunkBJSN5UVVcjs.ka,"instance_index"),position:a(_chunkBJSN5UVVcjs.ya,"position"),clipDistances:a(G(_chunkBJSN5UVVcjs.ka,8),"clip_distances"),frontFacing:a(_chunkBJSN5UVVcjs.ma,"front_facing"),fragDepth:a(_chunkBJSN5UVVcjs.ma,"frag_depth"),sampleIndex:a(_chunkBJSN5UVVcjs.ka,"sample_index"),sampleMask:a(_chunkBJSN5UVVcjs.ka,"sample_mask"),localInvocationId:a(_chunkBJSN5UVVcjs.wa,"local_invocation_id"),localInvocationIndex:a(_chunkBJSN5UVVcjs.ka,"local_invocation_index"),globalInvocationId:a(_chunkBJSN5UVVcjs.wa,"global_invocation_id"),workgroupId:a(_chunkBJSN5UVVcjs.wa,"workgroup_id"),numWorkgroups:a(_chunkBJSN5UVVcjs.wa,"num_workgroups"),subgroupInvocationId:a(_chunkBJSN5UVVcjs.ka,"subgroup_invocation_id"),subgroupSize:a(_chunkBJSN5UVVcjs.ka,"subgroup_size")};exports.a = b; exports.b = Z; exports.c = H; exports.d = Vt; exports.e = Ft; exports.f = St; exports.g = _t; exports.h = ht; exports.i = Lt; exports.j = Wt; exports.k = kt; exports.l = Pt; exports.m = zt; exports.n = Ut; exports.o = Ot; exports.p = $t; exports.q = Et; exports.r = Nt; exports.s = Mt; exports.t = Ct; exports.u = Gt; exports.v = jt; exports.w = Rt; exports.x = Kt; exports.y = Ht; exports.z = Jt; exports.A = qt; exports.B = Qt; exports.C = Xt; exports.D = Yt; exports.E = Zt; exports.F = te; exports.G = ee; exports.H = ne; exports.I = re; exports.J = oe; exports.K = ie; exports.L = ae; exports.M = se; exports.N = ue; exports.O = pe; exports.P = xe; exports.Q = le; exports.R = me; exports.S = x; exports.T = I; exports.U = rt; exports.V = l; exports.W = ut; exports.X = G; exports.Y = ct; exports.Z = yt; exports._ = ft; exports.$ = dt; exports.aa = Tt; exports.ba = $e; exports.ca = X; exports.da = pt; exports.ea = xt; exports.fa = mt; exports.ga = gt;
2
+ //# sourceMappingURL=chunk-BZVU4Q6A.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-BZVU4Q6A.cjs","../src/data/struct.ts"],"names":["struct","props","WgslStructImpl","$internal","label","setName","getName"],"mappings":"AAAA,m0BAAiP,SCmBjOA,CAAAA,CACdC,CAAAA,CACoB,CACpB,IAAMD,CAAAA,CAAaC,CAAAA,EAAaA,CAAAA,CAChC,OAAA,MAAA,CAAO,cAAA,CAAeD,CAAAA,CAAQE,CAAc,CAAA,CAC5CF,CAAAA,CAAO,SAAA,CAAYC,CAAAA,CAEZD,CACT,CAMA,IAAME,CAAAA,CAAiB,CACrB,CAACC,mBAAS,CAAA,CAAG,CAAA,CAAA,CACb,IAAA,CAAM,QAAA,CAEN,KAAA,CAAMC,CAAAA,CAAe,CACnB,OAAAC,iCAAAA,IAAQ,CAAMD,CAAK,CAAA,CACZ,IACT,CAAA,CAEA,QAAA,CAAA,CAAmB,CACjB,MAAO,CAAA,OAAA,mBAAUE,iCAAAA,IAAY,CAAA,SAAK,aAAW,CAAA,CAAA","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-BZVU4Q6A.cjs","sourcesContent":[null,"import { getName, setName } from '../shared/meta.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { AnyWgslData, WgslStruct } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Creates a struct schema that can be used to construct GPU buffers.\n * Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).\n * The order of members matches the passed in properties object.\n *\n * @example\n * const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });\n *\n * @param props Record with `string` keys and `TgpuData` values,\n * each entry describing one struct member.\n */\nexport function struct<TProps extends Record<string, AnyWgslData>>(\n props: TProps,\n): WgslStruct<TProps> {\n const struct = <T>(props: T) => props;\n Object.setPrototypeOf(struct, WgslStructImpl);\n struct.propTypes = props;\n\n return struct as WgslStruct<TProps>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst WgslStructImpl = {\n [$internal]: true,\n type: 'struct',\n\n $name(label: string) {\n setName(this, label);\n return this;\n },\n\n toString(): string {\n return `struct:${getName(this) ?? '<unnamed>'}`;\n },\n};\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkBJSN5UVVcjs = require('./chunk-BJSN5UVV.cjs');var S=e=>Math.sqrt(e.x**2+e.y**2),D=e=>Math.sqrt(e.x**2+e.y**2+e.z**2),E=e=>Math.sqrt(e.x**2+e.y**2+e.z**2+e.w**2),ae=(e,n)=>e.x*n.x+e.y*n.y,re=(e,n)=>e.x*n.x+e.y*n.y+e.z*n.z,ve=(e,n)=>e.x*n.x+e.y*n.y+e.z*n.z+e.w*n.w,r=(e,n,s)=>Math.min(Math.max(n,e),s),u=e=>n=>_chunkBJSN5UVVcjs.oa.call(void 0, e(n.x),e(n.y)),w=e=>n=>_chunkBJSN5UVVcjs.pa.call(void 0, e(n.x),e(n.y)),R=e=>n=>_chunkBJSN5UVVcjs.qa.call(void 0, e(n.x),e(n.y)),K=e=>n=>_chunkBJSN5UVVcjs.ra.call(void 0, e(n.x),e(n.y)),y=e=>n=>_chunkBJSN5UVVcjs.ta.call(void 0, e(n.x),e(n.y),e(n.z)),l=e=>n=>_chunkBJSN5UVVcjs.ua.call(void 0, e(n.x),e(n.y),e(n.z)),$=e=>n=>_chunkBJSN5UVVcjs.va.call(void 0, e(n.x),e(n.y),e(n.z)),k=e=>n=>_chunkBJSN5UVVcjs.wa.call(void 0, e(n.x),e(n.y),e(n.z)),x=e=>n=>_chunkBJSN5UVVcjs.ya.call(void 0, e(n.x),e(n.y),e(n.z),e(n.w)),o=e=>n=>_chunkBJSN5UVVcjs.za.call(void 0, e(n.x),e(n.y),e(n.z),e(n.w)),N=e=>n=>_chunkBJSN5UVVcjs.Aa.call(void 0, e(n.x),e(n.y),e(n.z),e(n.w)),O=e=>n=>_chunkBJSN5UVVcjs.Ba.call(void 0, e(n.x),e(n.y),e(n.z),e(n.w)),ue=e=>n=>{let s=n.columns;return _chunkBJSN5UVVcjs.Ma.call(void 0, u(e)(s[0]),u(e)(s[1]))},we=e=>n=>{let s=n.columns;return _chunkBJSN5UVVcjs.Na.call(void 0, y(e)(s[0]),y(e)(s[1]),y(e)(s[2]))},le=e=>n=>{let s=n.columns;return _chunkBJSN5UVVcjs.Oa.call(void 0, x(e)(s[0]),x(e)(s[1]),x(e)(s[2]),x(e)(s[3]))},F=e=>(n,s)=>_chunkBJSN5UVVcjs.oa.call(void 0, e(n.x,s.x),e(n.y,s.y)),j=e=>(n,s)=>_chunkBJSN5UVVcjs.pa.call(void 0, e(n.x,s.x),e(n.y,s.y)),J=e=>(n,s)=>_chunkBJSN5UVVcjs.qa.call(void 0, e(n.x,s.x),e(n.y,s.y)),Q=e=>(n,s)=>_chunkBJSN5UVVcjs.ra.call(void 0, e(n.x,s.x),e(n.y,s.y)),A=e=>(n,s)=>_chunkBJSN5UVVcjs.ta.call(void 0, e(n.x,s.x),e(n.y,s.y),e(n.z,s.z)),P=e=>(n,s)=>_chunkBJSN5UVVcjs.ua.call(void 0, e(n.x,s.x),e(n.y,s.y),e(n.z,s.z)),X=e=>(n,s)=>_chunkBJSN5UVVcjs.va.call(void 0, e(n.x,s.x),e(n.y,s.y),e(n.z,s.z)),Y=e=>(n,s)=>_chunkBJSN5UVVcjs.wa.call(void 0, e(n.x,s.x),e(n.y,s.y),e(n.z,s.z)),p=e=>(n,s)=>_chunkBJSN5UVVcjs.ya.call(void 0, e(n.x,s.x),e(n.y,s.y),e(n.z,s.z),e(n.w,s.w)),Z=e=>(n,s)=>_chunkBJSN5UVVcjs.za.call(void 0, e(n.x,s.x),e(n.y,s.y),e(n.z,s.z),e(n.w,s.w)),ee=e=>(n,s)=>_chunkBJSN5UVVcjs.Aa.call(void 0, e(n.x,s.x),e(n.y,s.y),e(n.z,s.z),e(n.w,s.w)),ne=e=>(n,s)=>_chunkBJSN5UVVcjs.Ba.call(void 0, e(n.x,s.x),e(n.y,s.y),e(n.z,s.z),e(n.w,s.w)),fe=e=>(n,s)=>{let t=n.columns,T=s.columns;return _chunkBJSN5UVVcjs.Ma.call(void 0, F(e)(t[0],T[0]),F(e)(t[1],T[1]))},ge=e=>(n,s)=>{let t=n.columns,T=s.columns;return _chunkBJSN5UVVcjs.Na.call(void 0, A(e)(t[0],T[0]),A(e)(t[1],T[1]),A(e)(t[2],T[2]))},he=e=>(n,s)=>{let t=n.columns,T=s.columns;return _chunkBJSN5UVVcjs.Oa.call(void 0, p(e)(t[0],T[0]),p(e)(t[1],T[1]),p(e)(t[2],T[2]),p(e)(t[3],T[3]))},d={divInteger:(e,n)=>n===0?e:Math.trunc(e/n)},c= exports.a ={eq:{vec2f:(e,n)=>_chunkBJSN5UVVcjs.sa.call(void 0, e.x===n.x,e.y===n.y),vec2h:(e,n)=>_chunkBJSN5UVVcjs.sa.call(void 0, e.x===n.x,e.y===n.y),vec2i:(e,n)=>_chunkBJSN5UVVcjs.sa.call(void 0, e.x===n.x,e.y===n.y),vec2u:(e,n)=>_chunkBJSN5UVVcjs.sa.call(void 0, e.x===n.x,e.y===n.y),"vec2<bool>":(e,n)=>_chunkBJSN5UVVcjs.sa.call(void 0, e.x===n.x,e.y===n.y),vec3f:(e,n)=>_chunkBJSN5UVVcjs.xa.call(void 0, e.x===n.x,e.y===n.y,e.z===n.z),vec3h:(e,n)=>_chunkBJSN5UVVcjs.xa.call(void 0, e.x===n.x,e.y===n.y,e.z===n.z),vec3i:(e,n)=>_chunkBJSN5UVVcjs.xa.call(void 0, e.x===n.x,e.y===n.y,e.z===n.z),vec3u:(e,n)=>_chunkBJSN5UVVcjs.xa.call(void 0, e.x===n.x,e.y===n.y,e.z===n.z),"vec3<bool>":(e,n)=>_chunkBJSN5UVVcjs.xa.call(void 0, e.x===n.x,e.y===n.y,e.z===n.z),vec4f:(e,n)=>_chunkBJSN5UVVcjs.Ca.call(void 0, e.x===n.x,e.y===n.y,e.z===n.z,e.w===n.w),vec4h:(e,n)=>_chunkBJSN5UVVcjs.Ca.call(void 0, e.x===n.x,e.y===n.y,e.z===n.z,e.w===n.w),vec4i:(e,n)=>_chunkBJSN5UVVcjs.Ca.call(void 0, e.x===n.x,e.y===n.y,e.z===n.z,e.w===n.w),vec4u:(e,n)=>_chunkBJSN5UVVcjs.Ca.call(void 0, e.x===n.x,e.y===n.y,e.z===n.z,e.w===n.w),"vec4<bool>":(e,n)=>_chunkBJSN5UVVcjs.Ca.call(void 0, e.x===n.x,e.y===n.y,e.z===n.z,e.w===n.w)},lt:{vec2f:(e,n)=>_chunkBJSN5UVVcjs.sa.call(void 0, e.x<n.x,e.y<n.y),vec2h:(e,n)=>_chunkBJSN5UVVcjs.sa.call(void 0, e.x<n.x,e.y<n.y),vec2i:(e,n)=>_chunkBJSN5UVVcjs.sa.call(void 0, e.x<n.x,e.y<n.y),vec2u:(e,n)=>_chunkBJSN5UVVcjs.sa.call(void 0, e.x<n.x,e.y<n.y),vec3f:(e,n)=>_chunkBJSN5UVVcjs.xa.call(void 0, e.x<n.x,e.y<n.y,e.z<n.z),vec3h:(e,n)=>_chunkBJSN5UVVcjs.xa.call(void 0, e.x<n.x,e.y<n.y,e.z<n.z),vec3i:(e,n)=>_chunkBJSN5UVVcjs.xa.call(void 0, e.x<n.x,e.y<n.y,e.z<n.z),vec3u:(e,n)=>_chunkBJSN5UVVcjs.xa.call(void 0, e.x<n.x,e.y<n.y,e.z<n.z),vec4f:(e,n)=>_chunkBJSN5UVVcjs.Ca.call(void 0, e.x<n.x,e.y<n.y,e.z<n.z,e.w<n.w),vec4h:(e,n)=>_chunkBJSN5UVVcjs.Ca.call(void 0, e.x<n.x,e.y<n.y,e.z<n.z,e.w<n.w),vec4i:(e,n)=>_chunkBJSN5UVVcjs.Ca.call(void 0, e.x<n.x,e.y<n.y,e.z<n.z,e.w<n.w),vec4u:(e,n)=>_chunkBJSN5UVVcjs.Ca.call(void 0, e.x<n.x,e.y<n.y,e.z<n.z,e.w<n.w)},or:{"vec2<bool>":(e,n)=>_chunkBJSN5UVVcjs.sa.call(void 0, e.x||n.x,e.y||n.y),"vec3<bool>":(e,n)=>_chunkBJSN5UVVcjs.xa.call(void 0, e.x||n.x,e.y||n.y,e.z||n.z),"vec4<bool>":(e,n)=>_chunkBJSN5UVVcjs.Ca.call(void 0, e.x||n.x,e.y||n.y,e.z||n.z,e.w||n.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:u(Math.abs),vec2h:w(Math.abs),vec2i:R(Math.abs),vec2u:K(Math.abs),vec3f:y(Math.abs),vec3h:l(Math.abs),vec3i:$(Math.abs),vec3u:k(Math.abs),vec4f:x(Math.abs),vec4h:o(Math.abs),vec4i:N(Math.abs),vec4u:O(Math.abs)},atan2:{vec2f:F(Math.atan2),vec2h:j(Math.atan2),vec3f:A(Math.atan2),vec3h:P(Math.atan2),vec4f:p(Math.atan2),vec4h:Z(Math.atan2)},acos:{vec2f:u(Math.acos),vec2h:w(Math.acos),vec2i:R(Math.acos),vec2u:K(Math.acos),vec3f:y(Math.acos),vec3h:l(Math.acos),vec3i:$(Math.acos),vec3u:k(Math.acos),vec4f:x(Math.acos),vec4h:o(Math.acos),vec4i:N(Math.acos),vec4u:O(Math.acos)},acosh:{vec2f:u(Math.acosh),vec2h:w(Math.acosh),vec3f:y(Math.acosh),vec3h:l(Math.acosh),vec4f:x(Math.acosh),vec4h:o(Math.acosh)},asin:{vec2f:u(Math.asin),vec2h:w(Math.asin),vec2i:R(Math.asin),vec2u:K(Math.asin),vec3f:y(Math.asin),vec3h:l(Math.asin),vec3i:$(Math.asin),vec3u:k(Math.asin),vec4f:x(Math.asin),vec4h:o(Math.asin),vec4i:N(Math.asin),vec4u:O(Math.asin)},ceil:{vec2f:u(Math.ceil),vec2h:w(Math.ceil),vec3f:y(Math.ceil),vec3h:l(Math.ceil),vec4f:x(Math.ceil),vec4h:o(Math.ceil)},clamp:{vec2f:(e,n,s)=>_chunkBJSN5UVVcjs.oa.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y)),vec2h:(e,n,s)=>_chunkBJSN5UVVcjs.pa.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y)),vec2i:(e,n,s)=>_chunkBJSN5UVVcjs.qa.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y)),vec2u:(e,n,s)=>_chunkBJSN5UVVcjs.ra.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y)),vec3f:(e,n,s)=>_chunkBJSN5UVVcjs.ta.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y),r(e.z,n.z,s.z)),vec3h:(e,n,s)=>_chunkBJSN5UVVcjs.ua.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y),r(e.z,n.z,s.z)),vec3i:(e,n,s)=>_chunkBJSN5UVVcjs.va.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y),r(e.z,n.z,s.z)),vec3u:(e,n,s)=>_chunkBJSN5UVVcjs.wa.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y),r(e.z,n.z,s.z)),vec4f:(e,n,s)=>_chunkBJSN5UVVcjs.ya.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y),r(e.z,n.z,s.z),r(e.w,n.w,s.w)),vec4h:(e,n,s)=>_chunkBJSN5UVVcjs.za.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y),r(e.z,n.z,s.z),r(e.w,n.w,s.w)),vec4i:(e,n,s)=>_chunkBJSN5UVVcjs.Aa.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y),r(e.z,n.z,s.z),r(e.w,n.w,s.w)),vec4u:(e,n,s)=>_chunkBJSN5UVVcjs.Ba.call(void 0, r(e.x,n.x,s.x),r(e.y,n.y,s.y),r(e.z,n.z,s.z),r(e.w,n.w,s.w))},length:{vec2f:S,vec2h:S,vec3f:D,vec3h:D,vec4f:E,vec4h:E},add:{vec2f:F((e,n)=>e+n),vec2h:j((e,n)=>e+n),vec2i:J((e,n)=>e+n),vec2u:Q((e,n)=>e+n),vec3f:A((e,n)=>e+n),vec3h:P((e,n)=>e+n),vec3i:X((e,n)=>e+n),vec3u:Y((e,n)=>e+n),vec4f:p((e,n)=>e+n),vec4h:Z((e,n)=>e+n),vec4i:ee((e,n)=>e+n),vec4u:ne((e,n)=>e+n),mat2x2f:fe((e,n)=>e+n),mat3x3f:ge((e,n)=>e+n),mat4x4f:he((e,n)=>e+n)},addMixed:{vec2f:(e,n)=>u(s=>s+n)(e),vec2h:(e,n)=>w(s=>s+n)(e),vec2i:(e,n)=>R(s=>s+n)(e),vec2u:(e,n)=>K(s=>s+n)(e),vec3f:(e,n)=>y(s=>s+n)(e),vec3h:(e,n)=>l(s=>s+n)(e),vec3i:(e,n)=>$(s=>s+n)(e),vec3u:(e,n)=>k(s=>s+n)(e),vec4f:(e,n)=>x(s=>s+n)(e),vec4h:(e,n)=>o(s=>s+n)(e),vec4i:(e,n)=>N(s=>s+n)(e),vec4u:(e,n)=>O(s=>s+n)(e),mat2x2f:(e,n)=>ue(s=>s+n)(e),mat3x3f:(e,n)=>we(s=>s+n)(e),mat4x4f:(e,n)=>le(s=>s+n)(e)},mulSxV:{vec2f:(e,n)=>u(s=>e*s)(n),vec2h:(e,n)=>w(s=>e*s)(n),vec2i:(e,n)=>R(s=>e*s)(n),vec2u:(e,n)=>K(s=>e*s)(n),vec3f:(e,n)=>y(s=>e*s)(n),vec3h:(e,n)=>l(s=>e*s)(n),vec3i:(e,n)=>$(s=>e*s)(n),vec3u:(e,n)=>k(s=>e*s)(n),vec4f:(e,n)=>x(s=>e*s)(n),vec4h:(e,n)=>o(s=>e*s)(n),vec4i:(e,n)=>N(s=>e*s)(n),vec4u:(e,n)=>O(s=>e*s)(n),mat2x2f:(e,n)=>ue(s=>e*s)(n),mat3x3f:(e,n)=>we(s=>e*s)(n),mat4x4f:(e,n)=>le(s=>e*s)(n)},mulVxV:{vec2f:F((e,n)=>e*n),vec2h:j((e,n)=>e*n),vec2i:J((e,n)=>e*n),vec2u:Q((e,n)=>e*n),vec3f:A((e,n)=>e*n),vec3h:P((e,n)=>e*n),vec3i:X((e,n)=>e*n),vec3u:Y((e,n)=>e*n),vec4f:p((e,n)=>e*n),vec4h:Z((e,n)=>e*n),vec4i:ee((e,n)=>e*n),vec4u:ne((e,n)=>e*n),mat2x2f:(e,n)=>{let s=e.columns,t=n.columns;return _chunkBJSN5UVVcjs.Ma.call(void 0, s[0].x*t[0].x+s[1].x*t[0].y,s[0].y*t[0].x+s[1].y*t[0].y,s[0].x*t[1].x+s[1].x*t[1].y,s[0].y*t[1].x+s[1].y*t[1].y)},mat3x3f:(e,n)=>{let s=e.columns,t=n.columns;return _chunkBJSN5UVVcjs.Na.call(void 0, s[0].x*t[0].x+s[1].x*t[0].y+s[2].x*t[0].z,s[0].y*t[0].x+s[1].y*t[0].y+s[2].y*t[0].z,s[0].z*t[0].x+s[1].z*t[0].y+s[2].z*t[0].z,s[0].x*t[1].x+s[1].x*t[1].y+s[2].x*t[1].z,s[0].y*t[1].x+s[1].y*t[1].y+s[2].y*t[1].z,s[0].z*t[1].x+s[1].z*t[1].y+s[2].z*t[1].z,s[0].x*t[2].x+s[1].x*t[2].y+s[2].x*t[2].z,s[0].y*t[2].x+s[1].y*t[2].y+s[2].y*t[2].z,s[0].z*t[2].x+s[1].z*t[2].y+s[2].z*t[2].z)},mat4x4f:(e,n)=>{let s=e.columns,t=n.columns;return _chunkBJSN5UVVcjs.Oa.call(void 0, s[0].x*t[0].x+s[1].x*t[0].y+s[2].x*t[0].z+s[3].x*t[0].w,s[0].y*t[0].x+s[1].y*t[0].y+s[2].y*t[0].z+s[3].y*t[0].w,s[0].z*t[0].x+s[1].z*t[0].y+s[2].z*t[0].z+s[3].z*t[0].w,s[0].w*t[0].x+s[1].w*t[0].y+s[2].w*t[0].z+s[3].w*t[0].w,s[0].x*t[1].x+s[1].x*t[1].y+s[2].x*t[1].z+s[3].x*t[1].w,s[0].y*t[1].x+s[1].y*t[1].y+s[2].y*t[1].z+s[3].y*t[1].w,s[0].z*t[1].x+s[1].z*t[1].y+s[2].z*t[1].z+s[3].z*t[1].w,s[0].w*t[1].x+s[1].w*t[1].y+s[2].w*t[1].z+s[3].w*t[1].w,s[0].x*t[2].x+s[1].x*t[2].y+s[2].x*t[2].z+s[3].x*t[2].w,s[0].y*t[2].x+s[1].y*t[2].y+s[2].y*t[2].z+s[3].y*t[2].w,s[0].z*t[2].x+s[1].z*t[2].y+s[2].z*t[2].z+s[3].z*t[2].w,s[0].w*t[2].x+s[1].w*t[2].y+s[2].w*t[2].z+s[3].w*t[2].w,s[0].x*t[3].x+s[1].x*t[3].y+s[2].x*t[3].z+s[3].x*t[3].w,s[0].y*t[3].x+s[1].y*t[3].y+s[2].y*t[3].z+s[3].y*t[3].w,s[0].z*t[3].x+s[1].z*t[3].y+s[2].z*t[3].z+s[3].z*t[3].w,s[0].w*t[3].x+s[1].w*t[3].y+s[2].w*t[3].z+s[3].w*t[3].w)}},mulMxV:{mat2x2f:(e,n)=>{let s=e.columns;return _chunkBJSN5UVVcjs.oa.call(void 0, s[0].x*n.x+s[1].x*n.y,s[0].y*n.x+s[1].y*n.y)},mat3x3f:(e,n)=>{let s=e.columns;return _chunkBJSN5UVVcjs.ta.call(void 0, s[0].x*n.x+s[1].x*n.y+s[2].x*n.z,s[0].y*n.x+s[1].y*n.y+s[2].y*n.z,s[0].z*n.x+s[1].z*n.y+s[2].z*n.z)},mat4x4f:(e,n)=>{let s=e.columns;return _chunkBJSN5UVVcjs.ya.call(void 0, s[0].x*n.x+s[1].x*n.y+s[2].x*n.z+s[3].x*n.w,s[0].y*n.x+s[1].y*n.y+s[2].y*n.z+s[3].y*n.w,s[0].z*n.x+s[1].z*n.y+s[2].z*n.z+s[3].z*n.w,s[0].w*n.x+s[1].w*n.y+s[2].w*n.z+s[3].w*n.w)}},mulVxM:{mat2x2f:(e,n)=>{let s=n.columns;return _chunkBJSN5UVVcjs.oa.call(void 0, e.x*s[0].x+e.y*s[0].y,e.x*s[1].x+e.y*s[1].y)},mat3x3f:(e,n)=>{let s=n.columns;return _chunkBJSN5UVVcjs.ta.call(void 0, e.x*s[0].x+e.y*s[0].y+e.z*s[0].z,e.x*s[1].x+e.y*s[1].y+e.z*s[1].z,e.x*s[2].x+e.y*s[2].y+e.z*s[2].z)},mat4x4f:(e,n)=>{let s=n.columns;return _chunkBJSN5UVVcjs.ya.call(void 0, e.x*s[0].x+e.y*s[0].y+e.z*s[0].z+e.w*s[0].w,e.x*s[1].x+e.y*s[1].y+e.z*s[1].z+e.w*s[1].w,e.x*s[2].x+e.y*s[2].y+e.z*s[2].z+e.w*s[2].w,e.x*s[3].x+e.y*s[3].y+e.z*s[3].z+e.w*s[3].w)}},div:{vec2f:F((e,n)=>e/n),vec2h:j((e,n)=>e/n),vec2i:J(d.divInteger),vec2u:Q(d.divInteger),vec3f:A((e,n)=>e/n),vec3h:P((e,n)=>e/n),vec3i:X(d.divInteger),vec3u:Y(d.divInteger),vec4f:p((e,n)=>e/n),vec4h:Z((e,n)=>e/n),vec4i:ee(d.divInteger),vec4u:ne(d.divInteger)},divMixed:{vec2f:(e,n)=>u(s=>s/n)(e),vec2h:(e,n)=>w(s=>s/n)(e),vec2i:(e,n)=>R(s=>d.divInteger(s,n))(e),vec2u:(e,n)=>K(s=>d.divInteger(s,n))(e),vec3f:(e,n)=>y(s=>s/n)(e),vec3h:(e,n)=>l(s=>s/n)(e),vec3i:(e,n)=>$(s=>d.divInteger(s,n))(e),vec3u:(e,n)=>k(s=>d.divInteger(s,n))(e),vec4f:(e,n)=>x(s=>s/n)(e),vec4h:(e,n)=>o(s=>s/n)(e),vec4i:(e,n)=>N(s=>d.divInteger(s,n))(e),vec4u:(e,n)=>O(s=>d.divInteger(s,n))(e)},dot:{vec2f:ae,vec2h:ae,vec2i:ae,vec2u:ae,vec3f:re,vec3h:re,vec3i:re,vec3u:re,vec4f:ve,vec4h:ve,vec4i:ve,vec4u:ve},normalize:{vec2f:e=>{let n=S(e);return _chunkBJSN5UVVcjs.oa.call(void 0, e.x/n,e.y/n)},vec2h:e=>{let n=S(e);return _chunkBJSN5UVVcjs.pa.call(void 0, e.x/n,e.y/n)},vec2i:e=>{let n=S(e);return _chunkBJSN5UVVcjs.qa.call(void 0, e.x/n,e.y/n)},vec2u:e=>{let n=S(e);return _chunkBJSN5UVVcjs.ra.call(void 0, e.x/n,e.y/n)},vec3f:e=>{let n=D(e);return _chunkBJSN5UVVcjs.ta.call(void 0, e.x/n,e.y/n,e.z/n)},vec3h:e=>{let n=D(e);return _chunkBJSN5UVVcjs.ua.call(void 0, e.x/n,e.y/n,e.z/n)},vec3i:e=>{let n=D(e);return _chunkBJSN5UVVcjs.va.call(void 0, e.x/n,e.y/n,e.z/n)},vec3u:e=>{let n=D(e);return _chunkBJSN5UVVcjs.wa.call(void 0, e.x/n,e.y/n,e.z/n)},vec4f:e=>{let n=E(e);return _chunkBJSN5UVVcjs.ya.call(void 0, e.x/n,e.y/n,e.z/n,e.w/n)},vec4h:e=>{let n=E(e);return _chunkBJSN5UVVcjs.za.call(void 0, e.x/n,e.y/n,e.z/n,e.w/n)},vec4i:e=>{let n=E(e);return _chunkBJSN5UVVcjs.Aa.call(void 0, e.x/n,e.y/n,e.z/n,e.w/n)},vec4u:e=>{let n=E(e);return _chunkBJSN5UVVcjs.Ba.call(void 0, e.x/n,e.y/n,e.z/n,e.w/n)}},cross:{vec3f:(e,n)=>_chunkBJSN5UVVcjs.ta.call(void 0, e.y*n.z-e.z*n.y,e.z*n.x-e.x*n.z,e.x*n.y-e.y*n.x),vec3h:(e,n)=>_chunkBJSN5UVVcjs.ua.call(void 0, e.y*n.z-e.z*n.y,e.z*n.x-e.x*n.z,e.x*n.y-e.y*n.x)},floor:{vec2f:u(Math.floor),vec2h:w(Math.floor),vec3f:y(Math.floor),vec3h:l(Math.floor),vec4f:x(Math.floor),vec4h:o(Math.floor)},max:{vec2f:F(Math.max),vec2h:j(Math.max),vec2i:J(Math.max),vec2u:Q(Math.max),vec3f:A(Math.max),vec3h:P(Math.max),vec3i:X(Math.max),vec3u:Y(Math.max),vec4f:p(Math.max),vec4h:Z(Math.max),vec4i:ee(Math.max),vec4u:ne(Math.max)},min:{vec2f:F(Math.min),vec2h:j(Math.min),vec2i:J(Math.min),vec2u:Q(Math.min),vec3f:A(Math.min),vec3h:P(Math.min),vec3i:X(Math.min),vec3u:Y(Math.min),vec4f:p(Math.min),vec4h:Z(Math.min),vec4i:ee(Math.min),vec4u:ne(Math.min)},pow:{vec2f:(e,n)=>_chunkBJSN5UVVcjs.oa.call(void 0, e.x**n.x,e.y**n.y),vec2h:(e,n)=>_chunkBJSN5UVVcjs.pa.call(void 0, e.x**n.x,e.y**n.y),vec3f:(e,n)=>_chunkBJSN5UVVcjs.ta.call(void 0, e.x**n.x,e.y**n.y,e.z**n.z),vec3h:(e,n)=>_chunkBJSN5UVVcjs.ua.call(void 0, e.x**n.x,e.y**n.y,e.z**n.z),vec4f:(e,n)=>_chunkBJSN5UVVcjs.ya.call(void 0, e.x**n.x,e.y**n.y,e.z**n.z,e.w**n.w),vec4h:(e,n)=>_chunkBJSN5UVVcjs.za.call(void 0, e.x**n.x,e.y**n.y,e.z**n.z,e.w**n.w)},sign:{vec2f:u(Math.sign),vec2h:w(Math.sign),vec2i:R(Math.sign),vec3f:y(Math.sign),vec3h:l(Math.sign),vec3i:$(Math.sign),vec4f:x(Math.sign),vec4h:o(Math.sign),vec4i:N(Math.sign)},sqrt:{vec2f:u(Math.sqrt),vec2h:w(Math.sqrt),vec3f:y(Math.sqrt),vec3h:l(Math.sqrt),vec4f:x(Math.sqrt),vec4h:o(Math.sqrt)},mix:{vec2f:(e,n,s)=>typeof s=="number"?_chunkBJSN5UVVcjs.oa.call(void 0, e.x*(1-s)+n.x*s,e.y*(1-s)+n.y*s):_chunkBJSN5UVVcjs.oa.call(void 0, e.x*(1-s.x)+n.x*s.x,e.y*(1-s.y)+n.y*s.y),vec2h:(e,n,s)=>typeof s=="number"?_chunkBJSN5UVVcjs.pa.call(void 0, e.x*(1-s)+n.x*s,e.y*(1-s)+n.y*s):_chunkBJSN5UVVcjs.pa.call(void 0, e.x*(1-s.x)+n.x*s.x,e.y*(1-s.y)+n.y*s.y),vec3f:(e,n,s)=>typeof s=="number"?_chunkBJSN5UVVcjs.ta.call(void 0, e.x*(1-s)+n.x*s,e.y*(1-s)+n.y*s,e.z*(1-s)+n.z*s):_chunkBJSN5UVVcjs.ta.call(void 0, e.x*(1-s.x)+n.x*s.x,e.y*(1-s.y)+n.y*s.y,e.z*(1-s.z)+n.z*s.z),vec3h:(e,n,s)=>typeof s=="number"?_chunkBJSN5UVVcjs.ua.call(void 0, e.x*(1-s)+n.x*s,e.y*(1-s)+n.y*s,e.z*(1-s)+n.z*s):_chunkBJSN5UVVcjs.ua.call(void 0, e.x*(1-s.x)+n.x*s.x,e.y*(1-s.y)+n.y*s.y,e.z*(1-s.z)+n.z*s.z),vec4f:(e,n,s)=>typeof s=="number"?_chunkBJSN5UVVcjs.ya.call(void 0, e.x*(1-s)+n.x*s,e.y*(1-s)+n.y*s,e.z*(1-s)+n.z*s,e.w*(1-s)+n.w*s):_chunkBJSN5UVVcjs.ya.call(void 0, e.x*(1-s.x)+n.x*s.x,e.y*(1-s.y)+n.y*s.y,e.z*(1-s.z)+n.z*s.z,e.w*(1-s.w)+n.w*s.w),vec4h:(e,n,s)=>typeof s=="number"?_chunkBJSN5UVVcjs.za.call(void 0, e.x*(1-s)+n.x*s,e.y*(1-s)+n.y*s,e.z*(1-s)+n.z*s,e.w*(1-s)+n.w*s):_chunkBJSN5UVVcjs.za.call(void 0, e.x*(1-s.x)+n.x*s.x,e.y*(1-s.y)+n.y*s.y,e.z*(1-s.z)+n.z*s.z,e.w*(1-s.w)+n.w*s.w)},sin:{vec2f:u(Math.sin),vec2h:w(Math.sin),vec3f:y(Math.sin),vec3h:l(Math.sin),vec4f:x(Math.sin),vec4h:o(Math.sin)},cos:{vec2f:u(Math.cos),vec2h:w(Math.cos),vec3f:y(Math.cos),vec3h:l(Math.cos),vec4f:x(Math.cos),vec4h:o(Math.cos)},cosh:{vec2f:u(Math.cosh),vec2h:w(Math.cosh),vec3f:y(Math.cosh),vec3h:l(Math.cosh),vec4f:x(Math.cosh),vec4h:o(Math.cosh)},exp:{vec2f:u(Math.exp),vec2h:w(Math.exp),vec3f:y(Math.exp),vec3h:l(Math.exp),vec4f:x(Math.exp),vec4h:o(Math.exp)},exp2:{vec2f:u(e=>2**e),vec2h:w(e=>2**e),vec3f:y(e=>2**e),vec3h:l(e=>2**e),vec4f:x(e=>2**e),vec4h:o(e=>2**e)},log:{vec2f:u(Math.log),vec2h:w(Math.log),vec3f:y(Math.log),vec3h:l(Math.log),vec4f:x(Math.log),vec4h:o(Math.log)},log2:{vec2f:u(Math.log2),vec2h:w(Math.log2),vec3f:y(Math.log2),vec3h:l(Math.log2),vec4f:x(Math.log2),vec4h:o(Math.log2)},fract:{vec2f:u(e=>e-Math.floor(e)),vec2h:w(e=>e-Math.floor(e)),vec3f:y(e=>e-Math.floor(e)),vec3h:l(e=>e-Math.floor(e)),vec4f:x(e=>e-Math.floor(e)),vec4h:o(e=>e-Math.floor(e))},isCloseToZero:{vec2f:(e,n)=>Math.abs(e.x)<=n&&Math.abs(e.y)<=n,vec2h:(e,n)=>Math.abs(e.x)<=n&&Math.abs(e.y)<=n,vec3f:(e,n)=>Math.abs(e.x)<=n&&Math.abs(e.y)<=n&&Math.abs(e.z)<=n,vec3h:(e,n)=>Math.abs(e.x)<=n&&Math.abs(e.y)<=n&&Math.abs(e.z)<=n,vec4f:(e,n)=>Math.abs(e.x)<=n&&Math.abs(e.y)<=n&&Math.abs(e.z)<=n&&Math.abs(e.w)<=n,vec4h:(e,n)=>Math.abs(e.x)<=n&&Math.abs(e.y)<=n&&Math.abs(e.z)<=n&&Math.abs(e.w)<=n},neg:{vec2f:u(e=>-e),vec2h:w(e=>-e),vec2i:R(e=>-e),vec2u:K(e=>-e),"vec2<bool>":e=>_chunkBJSN5UVVcjs.sa.call(void 0, !e.x,!e.y),vec3f:y(e=>-e),vec3h:l(e=>-e),vec3i:$(e=>-e),vec3u:k(e=>-e),"vec3<bool>":e=>_chunkBJSN5UVVcjs.xa.call(void 0, !e.x,!e.y,!e.z),vec4f:x(e=>-e),vec4h:o(e=>-e),vec4i:N(e=>-e),vec4u:O(e=>-e),"vec4<bool>":e=>_chunkBJSN5UVVcjs.Ca.call(void 0, !e.x,!e.y,!e.z,!e.w)},select:{vec2f:(e,n,s)=>_chunkBJSN5UVVcjs.oa.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y),vec2h:(e,n,s)=>_chunkBJSN5UVVcjs.pa.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y),vec2i:(e,n,s)=>_chunkBJSN5UVVcjs.qa.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y),vec2u:(e,n,s)=>_chunkBJSN5UVVcjs.ra.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y),"vec2<bool>":(e,n,s)=>_chunkBJSN5UVVcjs.sa.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y),vec3f:(e,n,s)=>_chunkBJSN5UVVcjs.ta.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y,s.z?n.z:e.z),vec3h:(e,n,s)=>_chunkBJSN5UVVcjs.ua.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y,s.z?n.z:e.z),vec3i:(e,n,s)=>_chunkBJSN5UVVcjs.va.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y,s.z?n.z:e.z),vec3u:(e,n,s)=>_chunkBJSN5UVVcjs.wa.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y,s.z?n.z:e.z),"vec3<bool>":(e,n,s)=>_chunkBJSN5UVVcjs.xa.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y,s.z?n.z:e.z),vec4f:(e,n,s)=>_chunkBJSN5UVVcjs.ya.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y,s.z?n.z:e.z,s.w?n.w:e.w),vec4h:(e,n,s)=>_chunkBJSN5UVVcjs.za.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y,s.z?n.z:e.z,s.w?n.w:e.w),vec4i:(e,n,s)=>_chunkBJSN5UVVcjs.Aa.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y,s.z?n.z:e.z,s.w?n.w:e.w),vec4u:(e,n,s)=>_chunkBJSN5UVVcjs.Ba.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y,s.z?n.z:e.z,s.w?n.w:e.w),"vec4<bool>":(e,n,s)=>_chunkBJSN5UVVcjs.Ca.call(void 0, s.x?n.x:e.x,s.y?n.y:e.y,s.z?n.z:e.z,s.w?n.w:e.w)},tanh:{vec2f:u(Math.tanh),vec2h:w(Math.tanh),vec3f:y(Math.tanh),vec3h:l(Math.tanh),vec4f:x(Math.tanh),vec4h:o(Math.tanh)}};function G(e){return de(e.dataType)}function de(e){let n=_optionalChain([e, 'optionalAccess', _2 => _2.type]);return!!_optionalChain([e, 'optionalAccess', _3 => _3[_chunkBJSN5UVVcjs.a]])&&(n==="abstractInt"||n==="abstractFloat"||n==="f32"||n==="f16"||n==="i32"||n==="u32")}function oe(e,n){if(typeof e=="number"&&typeof n=="number")return e+n;if(typeof e=="number"&&_chunkBJSN5UVVcjs.B.call(void 0, n))return c.addMixed[n.kind](n,e);if(_chunkBJSN5UVVcjs.B.call(void 0, e)&&typeof n=="number")return c.addMixed[e.kind](e,n);if(_chunkBJSN5UVVcjs.B.call(void 0, e)&&_chunkBJSN5UVVcjs.B.call(void 0, n)||_chunkBJSN5UVVcjs.F.call(void 0, e)&&_chunkBJSN5UVVcjs.F.call(void 0, n))return c.add[e.kind](e,n);throw new Error("Add/Sub called with invalid arguments.")}var ke=_chunkBJSN5UVVcjs.ga.call(void 0, oe,(e,n)=>_chunkBJSN5UVVcjs.da.call(void 0, `(${e.value} + ${n.value})`,G(e)?n.dataType:e.dataType),"coerce");function Te(e,n){return oe(e,me(-1,n))}var ie=_chunkBJSN5UVVcjs.ga.call(void 0, Te,(e,n)=>_chunkBJSN5UVVcjs.da.call(void 0, `(${e.value} - ${n.value})`,G(e)?n.dataType:e.dataType),"sub","coerce");function be(e,n){if(typeof e=="number"&&typeof n=="number")return e*n;if(typeof e=="number"&&(_chunkBJSN5UVVcjs.B.call(void 0, n)||_chunkBJSN5UVVcjs.F.call(void 0, n)))return c.mulSxV[n.kind](e,n);if((_chunkBJSN5UVVcjs.B.call(void 0, e)||_chunkBJSN5UVVcjs.F.call(void 0, e))&&typeof n=="number")return c.mulSxV[e.kind](n,e);if(_chunkBJSN5UVVcjs.B.call(void 0, e)&&_chunkBJSN5UVVcjs.B.call(void 0, n))return c.mulVxV[e.kind](e,n);if(_chunkBJSN5UVVcjs.J.call(void 0, e)&&_chunkBJSN5UVVcjs.F.call(void 0, n))return c.mulVxM[n.kind](e,n);if(_chunkBJSN5UVVcjs.F.call(void 0, e)&&_chunkBJSN5UVVcjs.J.call(void 0, n))return c.mulMxV[e.kind](e,n);if(_chunkBJSN5UVVcjs.F.call(void 0, e)&&_chunkBJSN5UVVcjs.F.call(void 0, n))return c.mulVxV[e.kind](e,n);throw new Error("Mul called with invalid arguments.")}var me=_chunkBJSN5UVVcjs.ga.call(void 0, be,(e,n)=>{let s=G(e)?n.dataType:G(n)||e.dataType.type.startsWith("vec")?e.dataType:n.dataType.type.startsWith("vec")?n.dataType:e.dataType;return _chunkBJSN5UVVcjs.da.call(void 0, `(${e.value} * ${n.value})`,s)},"mul");function Me(e,n){if(typeof e=="number"&&typeof n=="number")return e/n;if(typeof e=="number"&&_chunkBJSN5UVVcjs.B.call(void 0, n))return c.divMixed[n.kind](n,e);if(_chunkBJSN5UVVcjs.B.call(void 0, e)&&typeof n=="number")return c.divMixed[e.kind](e,n);if(_chunkBJSN5UVVcjs.B.call(void 0, e)&&_chunkBJSN5UVVcjs.B.call(void 0, n))return c.div[e.kind](e,n);throw new Error("Div called with invalid arguments.")}var Oe=_chunkBJSN5UVVcjs.ga.call(void 0, Me,(e,n)=>G(e)&&G(n)?_chunkBJSN5UVVcjs.da.call(void 0, `(f32(${e.value}) / ${n.value})`,_chunkBJSN5UVVcjs.ma):_chunkBJSN5UVVcjs.da.call(void 0, `(${e.value} / ${n.value})`,e.dataType),"div"),Le= exports.h =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.abs(e):c.abs[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `abs(${e.value})`,e.dataType),"abs"),_e= exports.i =_chunkBJSN5UVVcjs.ga.call(void 0, (e,n)=>typeof e=="number"&&typeof n=="number"?Math.atan2(e,n):c.atan2[e.kind](e,n),(e,n)=>_chunkBJSN5UVVcjs.da.call(void 0, `atan2(${e.value}, ${n.value})`,e.dataType),"atan2"),Ue= exports.j =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.acos(e):c.acos[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `acos(${e.value})`,e.dataType),"acos"),We= exports.k =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.acosh(e):c.acosh[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `acosh(${e.value})`,e.dataType),"acosh"),qe= exports.l =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.asin(e):c.asin[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `asin(${e.value})`,e.dataType),"asin"),Ce= exports.m =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.ceil(e):c.ceil[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `ceil(${e.value})`,e.dataType),"ceil"),Se= exports.n =_chunkBJSN5UVVcjs.ga.call(void 0, (e,n,s)=>typeof e=="number"?Math.min(Math.max(n,e),s):c.clamp[e.kind](e,n,s),(e,n,s)=>_chunkBJSN5UVVcjs.da.call(void 0, `clamp(${e.value}, ${n.value}, ${s.value})`,e.dataType),"clamp"),De= exports.o =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.cos(e):c.cos[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `cos(${e.value})`,e.dataType),"cos"),Ee= exports.p =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.cosh(e):c.cosh[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `cosh(${e.value})`,e.dataType),"cosh"),je= exports.q =_chunkBJSN5UVVcjs.ga.call(void 0, (e,n)=>c.cross[e.kind](e,n),(e,n)=>_chunkBJSN5UVVcjs.da.call(void 0, `cross(${e.value}, ${n.value})`,e.dataType),"cross"),ze= exports.r =_chunkBJSN5UVVcjs.ga.call(void 0, (e,n)=>c.dot[e.kind](e,n),(e,n)=>_chunkBJSN5UVVcjs.da.call(void 0, `dot(${e.value}, ${n.value})`,_chunkBJSN5UVVcjs.ma),"dot"),Pe= exports.s =_chunkBJSN5UVVcjs.ga.call(void 0, e=>c.normalize[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `normalize(${e.value})`,e.dataType),"normalize"),Ze= exports.t =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.floor(e):c.floor[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `floor(${e.value})`,e.dataType),"floor"),Ge= exports.u =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?e-Math.floor(e):c.fract[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `fract(${e.value})`,e.dataType),"fract"),pe= exports.v =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.abs(e):c.length[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `length(${e.value})`,_chunkBJSN5UVVcjs.ma),"length"),He= exports.w =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.log(e):c.log[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `log(${e.value})`,e.dataType),"log"),Je= exports.x =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.log2(e):c.log2[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `log2(${e.value})`,e.dataType),"log2"),Qe= exports.y =_chunkBJSN5UVVcjs.ga.call(void 0, (e,n)=>typeof e=="number"?Math.max(e,n):c.max[e.kind](e,n),(e,n)=>_chunkBJSN5UVVcjs.da.call(void 0, `max(${e.value}, ${n.value})`,e.dataType),"max","coerce"),Xe= exports.z =_chunkBJSN5UVVcjs.ga.call(void 0, (e,n)=>typeof e=="number"?Math.min(e,n):c.min[e.kind](e,n),(e,n)=>_chunkBJSN5UVVcjs.da.call(void 0, `min(${e.value}, ${n.value})`,e.dataType),"min","coerce"),Ye= exports.A =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.sign(e):c.sign[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `sign(${e.value})`,e.dataType),"sign"),en= exports.B =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.sin(e):c.sin[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `sin(${e.value})`,e.dataType),"sin"),nn= exports.C =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.exp(e):c.exp[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `exp(${e.value})`,e.dataType),"exp"),sn= exports.D =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?2**e:c.exp2[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `exp2(${e.value})`,e.dataType),"exp2"),tn= exports.E =_chunkBJSN5UVVcjs.ga.call(void 0, (e,n)=>{if(typeof e=="number"&&typeof n=="number")return e**n;if(typeof e=="object"&&typeof n=="object"&&"kind"in e&&"kind"in n)return c.pow[e.kind](e,n);throw new Error("Invalid arguments to pow()")},(e,n)=>_chunkBJSN5UVVcjs.da.call(void 0, `pow(${e.value}, ${n.value})`,e.dataType),"pow"),cn= exports.F =_chunkBJSN5UVVcjs.ga.call(void 0, (e,n,s)=>{if(typeof e=="number"){if(typeof s!="number"||typeof n!="number")throw new Error("When e1 and e2 are numbers, the blend factor must be a number.");return e*(1-s)+n*s}if(typeof e=="number"||typeof n=="number")throw new Error("e1 and e2 need to both be vectors of the same kind.");return c.mix[e.kind](e,n,s)},(e,n,s)=>_chunkBJSN5UVVcjs.da.call(void 0, `mix(${e.value}, ${n.value}, ${s.value})`,e.dataType),"mix"),an= exports.G =_chunkBJSN5UVVcjs.ga.call(void 0, (e,n)=>ie(e,me(2*ze(n,e),n)),(e,n)=>_chunkBJSN5UVVcjs.da.call(void 0, `reflect(${e.value}, ${n.value})`,e.dataType),"reflect"),rn= exports.H =_chunkBJSN5UVVcjs.ga.call(void 0, (e,n)=>typeof e=="number"&&typeof n=="number"?Math.abs(e-n):pe(ie(e,n)),(e,n)=>_chunkBJSN5UVVcjs.da.call(void 0, `distance(${e.value}, ${n.value})`,_chunkBJSN5UVVcjs.ma),"distance"),vn= exports.I =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?-e:c.neg[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `-(${e.value})`,e.dataType),"neg"),xn= exports.J =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.sqrt(e):c.sqrt[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `sqrt(${e.value})`,e.dataType),"sqrt"),yn= exports.K =_chunkBJSN5UVVcjs.ga.call(void 0, e=>typeof e=="number"?Math.tanh(e):c.tanh[e.kind](e),e=>_chunkBJSN5UVVcjs.da.call(void 0, `tanh(${e.value})`,e.dataType),"tanh");exports.a = c; exports.b = G; exports.c = de; exports.d = ke; exports.e = ie; exports.f = me; exports.g = Oe; exports.h = Le; exports.i = _e; exports.j = Ue; exports.k = We; exports.l = qe; exports.m = Ce; exports.n = Se; exports.o = De; exports.p = Ee; exports.q = je; exports.r = ze; exports.s = Pe; exports.t = Ze; exports.u = Ge; exports.v = pe; exports.w = He; exports.x = Je; exports.y = Qe; exports.z = Xe; exports.A = Ye; exports.B = en; exports.C = nn; exports.D = sn; exports.E = tn; exports.F = cn; exports.G = an; exports.H = rn; exports.I = vn; exports.J = xn; exports.K = yn;
2
+ //# sourceMappingURL=chunk-CDUKTYES.cjs.map