{"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"]}