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.
- package/chunk-734H4JWF.js +2 -0
- package/chunk-734H4JWF.js.map +1 -0
- package/chunk-BJSN5UVV.cjs +41 -0
- package/chunk-BJSN5UVV.cjs.map +1 -0
- package/chunk-BZVU4Q6A.cjs +2 -0
- package/chunk-BZVU4Q6A.cjs.map +1 -0
- package/chunk-CDUKTYES.cjs +2 -0
- package/chunk-CDUKTYES.cjs.map +1 -0
- package/chunk-CGVYLGBG.js +2 -0
- package/chunk-CGVYLGBG.js.map +1 -0
- package/chunk-SWJVYRFM.js +41 -0
- package/chunk-SWJVYRFM.js.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.cjs.map +1 -1
- package/data/index.d.cts +4 -77
- package/data/index.d.ts +4 -77
- package/data/index.js +1 -1
- package/index.cjs +21 -20
- package/index.cjs.map +1 -1
- package/index.d.cts +5 -3
- package/index.d.ts +5 -3
- package/index.js +21 -20
- package/index.js.map +1 -1
- package/matrix-BULDDGYa.d.ts +122 -0
- package/matrix-BnXitNJ7.d.cts +122 -0
- package/package.json +2 -2
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +104 -17
- package/std/index.d.ts +104 -17
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/{tgpuComputeFn-DH8_PcIR.d.cts → tgpuComputeFn-BxPDI5hQ.d.cts} +178 -95
- package/{tgpuComputeFn-DH8_PcIR.d.ts → tgpuComputeFn-BxPDI5hQ.d.ts} +178 -95
- package/chunk-5RYM4COI.js +0 -4
- package/chunk-5RYM4COI.js.map +0 -1
- package/chunk-FHOQ6WZE.cjs +0 -2
- package/chunk-FHOQ6WZE.cjs.map +0 -1
- package/chunk-ODKBWWHU.cjs +0 -4
- package/chunk-ODKBWWHU.cjs.map +0 -1
- package/chunk-SMTSXYNG.js +0 -2
- package/chunk-SMTSXYNG.js.map +0 -1
package/index.cjs
CHANGED
@@ -1,30 +1,31 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18; var _class19; var _class20; var _class21; var _class22; var _class23; var _class24; var _class25; var _class26; var _class27; var _class28;var
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18; var _class19; var _class20; var _class21; var _class22; var _class23; var _class24; var _class25; var _class26; var _class27; var _class28; var _class29;var _chunkBZVU4Q6Acjs = require('./chunk-BZVU4Q6A.cjs');var _chunkCDUKTYEScjs = require('./chunk-CDUKTYES.cjs');var _chunkBJSN5UVVcjs = require('./chunk-BJSN5UVV.cjs');function gn(e){if(typeof _optionalChain([e, 'optionalAccess', _2 => _2[_chunkBJSN5UVVcjs.c]])=="function")return e[_chunkBJSN5UVVcjs.c].bind(e)}function dt(e,t){throw new Error(`Failed to handle ${e} at ${t}`)}var ba={f:{1:_chunkBJSN5UVVcjs.ma,2:_chunkBJSN5UVVcjs.oa,3:_chunkBJSN5UVVcjs.ta,4:_chunkBJSN5UVVcjs.ya},h:{1:_chunkBJSN5UVVcjs.na,2:_chunkBJSN5UVVcjs.pa,3:_chunkBJSN5UVVcjs.ua,4:_chunkBJSN5UVVcjs.za},i:{1:_chunkBJSN5UVVcjs.la,2:_chunkBJSN5UVVcjs.qa,3:_chunkBJSN5UVVcjs.va,4:_chunkBJSN5UVVcjs.Aa},u:{1:_chunkBJSN5UVVcjs.ka,2:_chunkBJSN5UVVcjs.ra,3:_chunkBJSN5UVVcjs.wa,4:_chunkBJSN5UVVcjs.Ba},b:{1:_chunkBJSN5UVVcjs.ja,2:_chunkBJSN5UVVcjs.sa,3:_chunkBJSN5UVVcjs.xa,4:_chunkBJSN5UVVcjs.Ca}},Sa={vec2f:_chunkBJSN5UVVcjs.oa,vec2h:_chunkBJSN5UVVcjs.pa,vec2i:_chunkBJSN5UVVcjs.qa,vec2u:_chunkBJSN5UVVcjs.ra,"vec2<bool>":_chunkBJSN5UVVcjs.sa,vec3f:_chunkBJSN5UVVcjs.ta,vec3h:_chunkBJSN5UVVcjs.ua,vec3i:_chunkBJSN5UVVcjs.va,vec3u:_chunkBJSN5UVVcjs.wa,"vec3<bool>":_chunkBJSN5UVVcjs.xa,vec4f:_chunkBJSN5UVVcjs.ya,vec4h:_chunkBJSN5UVVcjs.za,vec4i:_chunkBJSN5UVVcjs.Aa,vec4u:_chunkBJSN5UVVcjs.Ba,"vec4<bool>":_chunkBJSN5UVVcjs.Ca,mat2x2f:_chunkBJSN5UVVcjs.Ma,mat3x3f:_chunkBJSN5UVVcjs.Na,mat4x4f:_chunkBJSN5UVVcjs.Oa},yn={vec2f:_chunkBJSN5UVVcjs.ma,vec2h:_chunkBJSN5UVVcjs.na,vec2i:_chunkBJSN5UVVcjs.la,vec2u:_chunkBJSN5UVVcjs.ka,"vec2<bool>":_chunkBJSN5UVVcjs.ja,vec3f:_chunkBJSN5UVVcjs.ma,vec3h:_chunkBJSN5UVVcjs.na,vec3i:_chunkBJSN5UVVcjs.la,vec3u:_chunkBJSN5UVVcjs.ka,"vec3<bool>":_chunkBJSN5UVVcjs.ja,vec4f:_chunkBJSN5UVVcjs.ma,vec4h:_chunkBJSN5UVVcjs.na,vec4i:_chunkBJSN5UVVcjs.la,vec4u:_chunkBJSN5UVVcjs.ka,"vec4<bool>":_chunkBJSN5UVVcjs.ja,mat2x2f:_chunkBJSN5UVVcjs.oa,mat3x3f:_chunkBJSN5UVVcjs.ta,mat4x4f:_chunkBJSN5UVVcjs.ya};function Ne(e,t){if(_chunkBJSN5UVVcjs.M.call(void 0, e)||_chunkBJSN5UVVcjs.Y.call(void 0, e))return _nullishCoalesce(e.propTypes[t], () => (_chunkBJSN5UVVcjs.ca));if(e===_chunkBJSN5UVVcjs.ja||_chunkCDUKTYEScjs.c.call(void 0, e))return _chunkBJSN5UVVcjs.ca;let r=t.length;if(_chunkBJSN5UVVcjs.E.call(void 0, e)&&r>=1&&r<=4){let n=e.type.includes("bool")?"b":e.type[4],a=ba[n][r];if(a)return a}return _chunkBJSN5UVVcjs.ca}function rr(e){return _chunkBJSN5UVVcjs.L.call(void 0, e)||_chunkBJSN5UVVcjs.X.call(void 0, e)?e.elementType:e.type in yn?yn[e.type]:_chunkBJSN5UVVcjs.ca}function nr(e){if(/^0x[0-9a-f]+$/i.test(e))return _chunkBJSN5UVVcjs.da.call(void 0, e,_chunkBJSN5UVVcjs.ha);if(/^0b[01]+$/i.test(e))return _chunkBJSN5UVVcjs.da.call(void 0, `${Number.parseInt(e.slice(2),2)}`,_chunkBJSN5UVVcjs.ha);if(/^-?(?:\d+\.\d*|\d*\.\d+)$/i.test(e))return _chunkBJSN5UVVcjs.da.call(void 0, e,_chunkBJSN5UVVcjs.ia);if(/^-?\d+(?:\.\d+)?e-?\d+$/i.test(e))return _chunkBJSN5UVVcjs.da.call(void 0, e,_chunkBJSN5UVVcjs.ia);if(/^-?\d+$/i.test(e))return _chunkBJSN5UVVcjs.da.call(void 0, e,_chunkBJSN5UVVcjs.ha)}var ar={rank:Number.POSITIVE_INFINITY,action:"none"};function Ae(e){return e.type==="decorated"?e.inner:e}function Tn(e){return _chunkBJSN5UVVcjs.E.call(void 0, e)?_chunkBJSN5UVVcjs.Da[e.type]:void 0}function ft(e,t){let r=Ae(e),n=Ae(t);if(r.type===n.type)return{rank:0,action:"none"};if(r.type==="abstractFloat"){if(n.type==="f32")return{rank:1,action:"none"};if(n.type==="f16")return{rank:2,action:"none"}}if(r.type==="abstractInt"){if(n.type==="i32")return{rank:3,action:"none"};if(n.type==="u32")return{rank:4,action:"none"};if(n.type==="abstractFloat")return{rank:5,action:"none"};if(n.type==="f32")return{rank:6,action:"none"};if(n.type==="f16")return{rank:7,action:"none"}}if(_chunkBJSN5UVVcjs.E.call(void 0, r)&&_chunkBJSN5UVVcjs.E.call(void 0, n)){let a=Tn(r),o=Tn(n);if(a&&o)return ft(a,o)}return _chunkBJSN5UVVcjs.I.call(void 0, r)&&_chunkBJSN5UVVcjs.I.call(void 0, n)?{rank:0,action:"none"}:ar}function va(e,t){let r=Ae(e),n=Ae(t);if(r.type==="ptr"&&ft(r.inner,n).rank<Number.POSITIVE_INFINITY)return{rank:0,action:"deref"};if(n.type==="ptr"&&ft(r,n.inner).rank<Number.POSITIVE_INFINITY)return{rank:1,action:"ref"};let a={f32:0,f16:1,i32:2,u32:3,bool:4};if(r.type in a&&n.type in a){let o=r.type,i=n.type;if(o!==i){let s=a[o];return{rank:a[i]<s?10:20,action:"cast",targetType:n}}}return ar}function Da(e,t,r){let n=ft(e,t);return n.rank<Number.POSITIVE_INFINITY?n:r?va(e,t):ar}function xn(e,t,r){let n,a=Number.POSITIVE_INFINITY,o=new Map;for(let u of t){let c=0,m=[],g=!0;for(let T of e){let x=Da(T,u,r);if(x.rank===Number.POSITIVE_INFINITY){g=!1;break}c+=x.rank,m.push(x)}g&&c<a&&(a=c,n=u,o.set(n,m))}if(!n)return;let s=o.get(n).map((u,c)=>({sourceIndex:c,action:u.action,...u.action==="cast"&&{targetType:u.targetType}})),l=s.some(u=>u.action==="cast");return{targetType:n,actions:s,hasImplicitConversions:l}}function or(e){return e.type==="abstractFloat"?_chunkBJSN5UVVcjs.ma:e.type==="abstractInt"?_chunkBJSN5UVVcjs.la:e}function hn(e,t){if(e.length===0)return;let r=[...new Set(e.map(Ae))],n=t?[...new Set(t.map(Ae))]:r,a=xn(e,n,!1);if(a)return a;let o=xn(e,n,!0);if(o)return o.hasImplicitConversions=o.actions.some(i=>i.action==="cast"),o}function Fa(e,t,r,n){if(r.action==="none")return _chunkBJSN5UVVcjs.da.call(void 0, t.value,n);let a=e.resolve(t.value);switch(r.action){case"ref":return _chunkBJSN5UVVcjs.da.call(void 0, `&${a}`,n);case"deref":return _chunkBJSN5UVVcjs.da.call(void 0, `*${a}`,n);case"cast":return _chunkBJSN5UVVcjs.da.call(void 0, `${e.resolve(n)}(${a})`,n);default:dt(r.action,"applyActionToSnippet")}}function M(e,t,r){let n=t.map(o=>o.dataType);if(n.some(o=>o===_chunkBJSN5UVVcjs.ca))return;let a=hn(n,r);if(a)return a.hasImplicitConversions&&console.warn(`Implicit conversions from [
|
2
2
|
${t.map(o=>` ${o.value}: ${o.dataType.type}`).join(`,
|
3
3
|
`)}
|
4
4
|
] to ${a.targetType.type} are supported, but not recommended.
|
5
|
-
Consider using explicit conversions instead.`),t.map((o,
|
6
|
-
`}function ga(e,t){let r=e.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, t));return e.addDeclaration(`
|
5
|
+
Consider using explicit conversions instead.`),t.map((o,i)=>{let s=a.actions[i];return _chunkBJSN5UVVcjs.j.call(void 0, s,"Action should not be undefined"),Fa(e,o,s,a.targetType)})}function ir(e,t,r){return Object.keys(t.propTypes).map(a=>{let o=r[a];if(!o)throw new Error(`Missing property ${a}`);let i=t.propTypes[a];return _nullishCoalesce(_optionalChain([M, 'call', _3 => _3(e,[o],[i]), 'optionalAccess', _4 => _4[0]]), () => (o))})}function ge(e){if(_chunkBJSN5UVVcjs.ea.call(void 0, e))return e;if(_chunkBJSN5UVVcjs.z.call(void 0, e))return _chunkBJSN5UVVcjs.da.call(void 0, e,e[_chunkBJSN5UVVcjs.b]);if(_chunkBJSN5UVVcjs.B.call(void 0, e)||_chunkBJSN5UVVcjs.F.call(void 0, e))return _chunkBJSN5UVVcjs.da.call(void 0, e,Sa[e.kind]);if(Array.isArray(e)){let t=e.map(ge).filter(Boolean),r=_chunkBJSN5UVVcjs.s.call(void 0, );if(!r)throw new Error("Tried to coerce array without a context");let n=M(r,t),a=_optionalChain([hn, 'call', _5 => _5(t.map(o=>o.dataType)), 'optionalAccess', _6 => _6.targetType]);return!n||!a?_chunkBJSN5UVVcjs.da.call(void 0, e,_chunkBJSN5UVVcjs.ca):_chunkBJSN5UVVcjs.da.call(void 0, n.map(o=>o.value).join(", "),_chunkBZVU4Q6Acjs.X.call(void 0, or(a),e.length))}return typeof e=="string"||typeof e=="function"||typeof e=="object"||typeof e=="symbol"||typeof e>"u"||e===null?_chunkBJSN5UVVcjs.da.call(void 0, e,_chunkBJSN5UVVcjs.ca):typeof e=="number"||typeof e=="bigint"?_chunkBJSN5UVVcjs.da.call(void 0, e,_nullishCoalesce(_optionalChain([nr, 'call', _7 => _7(String(e)), 'optionalAccess', _8 => _8.dataType]), () => (_chunkBJSN5UVVcjs.ca))):typeof e=="boolean"?_chunkBJSN5UVVcjs.da.call(void 0, e,_chunkBJSN5UVVcjs.ja):_chunkBJSN5UVVcjs.da.call(void 0, e,_chunkBJSN5UVVcjs.ca)}var K={get(e,t){if(t in e)return Reflect.get(e,t);if(t!=="~providing")return t==="toString"||t===Symbol.toStringTag||t===Symbol.toPrimitive?()=>e.toString():new Proxy({"~resolve":r=>`${r.resolve(e)}.${String(t)}`,toString:()=>`.value(...).${String(t)}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, e), () => ("<unnamed>"))}`,[_chunkBJSN5UVVcjs.b]:Ne(e[_chunkBJSN5UVVcjs.b],String(t))},K)}};function je(e,t){let r=t,n;for(;n=gn(r);)r=n(e);return r}function wn(e,t){return new sr(e,t)}var sr=class{constructor(t,r){this.dataType=t;this._value=r;this[_chunkBJSN5UVVcjs.a]={dataType:t}}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),n=t.resolveValue(this._value,this.dataType);return t.addDeclaration(`const ${r} = ${n};`),r}toString(){return`const:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}[_chunkBJSN5UVVcjs.c](){return new Proxy({"~resolve":t=>t.resolve(this),toString:()=>`.value:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`,[_chunkBJSN5UVVcjs.b]:this.dataType},K)}get value(){return _chunkBJSN5UVVcjs.v.call(void 0, )?this[_chunkBJSN5UVVcjs.c]():this._value}};function Pe(e){return _optionalChain([e, 'optionalAccess', _9 => _9.resourceType])==="slot"}function Be(e){return _optionalChain([e, 'optionalAccess', _10 => _10.resourceType])==="derived"}function ze(e){return _optionalChain([e, 'optionalAccess', _11 => _11["~providing"]])!==void 0}function qe(e){return _optionalChain([e, 'optionalAccess', _12 => _12.resourceType])==="accessor"}function ur(e){return typeof _optionalChain([e, 'optionalAccess', _13 => _13["~resolve"]])=="function"}function ct(e){return typeof e=="number"||typeof e=="boolean"||typeof e=="string"||ur(e)||_chunkBJSN5UVVcjs.K.call(void 0, e)||Pe(e)||Be(e)||ze(e)}function bn(e){return!!e&&typeof e=="object"&&"getMappedRange"in e&&"mapAsync"in e}function Sn(e){return _optionalChain([e, 'optionalAccess', _14 => _14.resourceType])==="buffer-usage"}function pr(e){return!!_optionalChain([e, 'optionalAccess', _15 => _15[_chunkBJSN5UVVcjs.a]])}function ye(e,t){for(let[r,n]of Object.entries(t))e[r]=n,_chunkBJSN5UVVcjs.g.call(void 0, n)&&_chunkBJSN5UVVcjs.e.call(void 0, n)===void 0&&n.$name(r)}function vn(e,t,r){let n=[...e.matchAll(/:\s*(?<arg>.*?)\s*[,)]/g)].map(a=>a?a[1]:void 0);r(Object.fromEntries(t.flatMap((a,o)=>{let i=n?n[o]:void 0;return _chunkBJSN5UVVcjs.M.call(void 0, a)&&i!==void 0?[[i,a]]:[]})))}function Re(e,t,r){let n=e.match(/->\s(?<output>[\w\d_]+)\s{/),a=n?_optionalChain([n, 'access', _16 => _16[1], 'optionalAccess', _17 => _17.trim, 'call', _18 => _18()]):void 0;_chunkBJSN5UVVcjs.M.call(void 0, t)&&a&&!/\s/g.test(a)&&r({[a]:t})}function Ia(e){return new RegExp(`(?<![\\w\\$_.])${e.replaceAll(".","\\.").replaceAll("$","\\$")}(?![\\w\\$_])`,"g")}function Te(e,t,r){return Object.entries(t).reduce((n,[a,o])=>ct(o)||_chunkBJSN5UVVcjs.W.call(void 0, o)?n.replaceAll(Ia(a),e.resolve(o)):o!==null&&typeof o=="object"?(_nullishCoalesce([...r.matchAll(new RegExp(`${a.replaceAll(".","\\.").replaceAll("$","\\$")}\\.(?<prop>.*?)(?![\\w\\$_])`,"g"))].map(s=>s[1]), () => ([]))).reduce((s,l)=>l&&l in o?Te(e,{[`${a}.${l}`]:o[l]},s):s,n):n,r)}function Dn(e){return new lr(e)}var lr= (_class =class{constructor(t){;_class.prototype.__init.call(this);this.declaration=t}__init() {this.externalsToApply=[]}$uses(t){return this.externalsToApply.push(t),this}"~resolve"(t){let r={};for(let a of this.externalsToApply)ye(r,a);let n=Te(t,r,this.declaration);return t.addDeclaration(n),""}toString(){return`declare: ${this.declaration}`}}, _class);function Fn(e,t,r){return _chunkBJSN5UVVcjs.i.call(void 0, e,{ast:t,externals:r}),e}function In(e){return()=>{throw new Error(`The function "${_nullishCoalesce(e, () => ("<unnamed>"))}" is invokable only on the GPU. If you want to use it on the CPU, mark it with the "kernel & js" directive.`)}}var _tinyest = require('tinyest'); var ro = _interopRequireWildcard(_tinyest);function Pn(e){let{strippedCode:t,argRange:r}=Ua(e),n=new gt(t);n.consume("(");let a=[];for(;!n.isAt(")");){let i=[];for(;n.isAt("@");)n.parseUntil(Un,An),n.consume(")"),i.push(n.lastParsed);n.parseUntil(Pa);let s=n.lastParsed,l;n.isAt(":")&&(n.consume(":"),n.parseUntil(Ba,Ca),l=n.lastParsed),a.push({identifier:s,attributes:i,type:l}),n.isAt(",")&&n.consume(",")}n.consume(")");let o;if(n.isAt("->")){n.consume("->");let i=[];for(;n.isAt("@");)n.parseUntil(Un,An),n.consume(")"),i.push(n.lastParsed);o={type:n.str.slice(n.pos),attributes:i}}return{args:a,ret:o,range:{begin:r[0],end:r[1]}}}function Ua(e){let t=new gt(e),r="",n;for(;!t.isFinished();){if(t.isAt(Aa)){t.advanceBy(1);continue}if(t.isAt("//")){t.consume("//"),t.parseUntil(Bn),t.advanceBy(1);continue}if(t.isAt("/*")){t.parseUntil(Ra,Va),t.consume("*/");continue}if(t.isAt("{"))return{strippedCode:r,argRange:[n,t.pos]};t.isAt("(")&&n===void 0&&(n=t.pos),n!==void 0&&(r+=t.str[t.pos]),t.advanceBy(1)}throw new Error("Invalid wgsl code!")}var gt=class{constructor(t){this.str=t;this.#e=0}#t;#e;get pos(){return this.#e}get lastParsed(){if(this.#t===void 0)throw new Error("Parse was not called yet!");return this.str.slice(this.#t,this.pos)}isFinished(){return this.#e>=this.str.length}isAt(t){if(typeof t=="string"){for(let r=0;r<t.length;r++)if(this.str[this.#e+r]!==t[r])return!1;return!0}for(let r of t)if(this.isAt(r))return!0;return!1}parseUntil(t,r){this.#t=this.#e;let n=0;for(;this.#e<this.str.length;){if(r&&this.isAt(r[0])&&(n+=1),r&&this.isAt(r[1])&&(n-=1),n===0&&this.isAt(t))return this.#e;this.#e+=1}throw new Error("Reached the end of the string without finding a match!")}advanceBy(t){this.#e+=t}consume(t){if(!this.isAt(t))throw new Error(`Expected '${t}' at position ${this.#e}, but found '${this.str.slice(this.#e,this.#e+t.length)}'`);this.advanceBy(t.length)}},Bn=new Set([`
|
6
|
+
`,"\v","\f","\r","\x85","\u2028","\u2029"]),Aa=new Set([...Bn," "," ","\u200E","\u200F"]),Un=new Set([")"]),Pa=new Set([":",",",")"]),Ba=new Set([",",")"]),Ra=new Set(["*/"]),An=["(",")"],Ca=["<",">"],Va=["/*","*/"];function ne(e,t){let r=[];typeof t=="string"&&(e.isEntry?(_chunkBJSN5UVVcjs.M.call(void 0, e.argTypes[0])&&r.push({In:e.argTypes[0]}),_chunkBJSN5UVVcjs.M.call(void 0, e.returnType)&&r.push({Out:e.returnType})):(vn(t,e.argTypes,o=>r.push(o)),Re(t,e.returnType,o=>r.push(o))));let n={applyExternals(o){r.push(o)},resolve(o,i=""){let s={};for(let u of r)ye(s,u);let l=o.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this));if(typeof t=="string"){let u=Te(o,s,t),c="",m="";if(e.isEntry){let g=_chunkBJSN5UVVcjs.M.call(void 0, e.argTypes[0])?`(in: ${o.resolve(e.argTypes[0])})`:"()",T=_chunkBJSN5UVVcjs.K.call(void 0, e.returnType)?_chunkBZVU4Q6Acjs.ba.call(void 0, e.returnType):"",x=e.returnType!==_chunkBJSN5UVVcjs.A?_chunkBJSN5UVVcjs.M.call(void 0, e.returnType)?`-> ${o.resolve(e.returnType)}`:`-> ${T!==""?T:"@location(0)"} ${o.resolve(e.returnType)}`:"";c=`${g} ${x} `,m=u}else{let g=Pn(u);if(g.args.length!==e.argTypes.length)throw new Error(`WGSL implementation has ${g.args.length} arguments, while the shell has ${e.argTypes.length} arguments.`);let T=g.args.map((y,F)=>`${y.identifier}: ${Cn(o,`parameter ${y.identifier}`,y.type,e.argTypes[F])}`).join(", "),x=e.returnType===_chunkBJSN5UVVcjs.A?"":`-> ${Cn(o,"return type",_optionalChain([g, 'access', _19 => _19.ret, 'optionalAccess', _20 => _20.type]),e.returnType)}`;c=`(${T}) ${x}`,m=u.slice(g.range.end)}o.addDeclaration(`${i}fn ${l}${c}${m}`)}else{let u=_chunkBJSN5UVVcjs.h.call(void 0, t);if(_optionalChain([u, 'optionalAccess', _21 => _21.externals])){let x=Object.fromEntries(Object.entries(u.externals).filter(([y])=>!(y in s)));ye(s,x)}let c=_nullishCoalesce(_optionalChain([u, 'optionalAccess', _22 => _22.ast]), () => (o.transpileFn(String(t)))),m=c.externalNames.filter(x=>!(x in s));if(m.length>0)throw new (0, _chunkBJSN5UVVcjs.n)(_chunkBJSN5UVVcjs.e.call(void 0, this),m);let{head:g,body:T}=o.fnToWgsl({args:e.argTypes.map((x,y)=>_chunkBJSN5UVVcjs.da.call(void 0, _optionalChain([c, 'access', _23 => _23.params, 'access', _24 => _24[y], 'optionalAccess', _25 => _25.type])===_tinyest.FuncParameterType.identifier?c.params[y].name:`_arg_${y}`,x)),argAliases:Object.fromEntries(c.params.flatMap((x,y)=>x.type===_tinyest.FuncParameterType.destructuredObject?x.props.map(({name:F,alias:U})=>[U,_chunkBJSN5UVVcjs.da.call(void 0, `_arg_${y}.${F}`,e.argTypes[y].propTypes[F])]):[])),returnType:e.returnType,body:c.body,externalMap:s});o.addDeclaration(`${i}fn ${l}${o.resolve(g)}${o.resolve(T)}`)}return l}},a=_chunkBJSN5UVVcjs.e.call(void 0, t);return a!==void 0&&_chunkBJSN5UVVcjs.f.call(void 0, n,a),n}function Cn(e,t,r,n){let a=e.resolve(n).replace(/\s/g,"");if(!r)return a;let o=r.replace(/\s/g,"");if(o!==a)throw new Error(`Type mismatch between TGPU shell and WGSL code string: ${t}, JS type "${a}", WGSL type "${o}".`);return r}function _a(e){let t=0;return Object.fromEntries(Object.entries(e).map(([r,n])=>{if(_chunkBZVU4Q6Acjs.aa.call(void 0, n))return[r,n];let a=_chunkBJSN5UVVcjs.aa.call(void 0, n);return a!==void 0?(t=a+1,[r,n]):[r,_chunkBZVU4Q6Acjs._.call(void 0, t++,n)]}))}function ae(e){return _chunkBJSN5UVVcjs.ba.call(void 0, e)?_chunkBJSN5UVVcjs.V.call(void 0, e)||_chunkBJSN5UVVcjs.aa.call(void 0, e)!==void 0?e:_chunkBZVU4Q6Acjs._.call(void 0, 0,e):_chunkBZVU4Q6Acjs.ca.call(void 0, _a(e))}function oe(e,...t){return $a(e)?Ea(e,...t):e}function $a(e){return Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw)&&e.raw.every(t=>typeof t=="string")}function Ea(e,...t){return e.slice(1).reduce((r,n,a)=>`${r}${t[a]}${n}`,e[0])}function Vn(e){let t={argTypes:e.in&&Object.keys(e.in).length!==0?[ae(e.in)]:[],returnType:_chunkBJSN5UVVcjs.A,workgroupSize:[_nullishCoalesce(e.workgroupSize[0], () => (1)),_nullishCoalesce(e.workgroupSize[1], () => (1)),_nullishCoalesce(e.workgroupSize[2], () => (1))],isEntry:!0},r=(n,...a)=>Ga(t,e.workgroupSize,oe(n,...a));return Object.assign(Object.assign(r,t),{does:r})}function Ga(e,t,r){let n=ne(e,r),a=e.argTypes[0];return{shell:e,$uses(i){return n.applyExternals(i),this},[_chunkBJSN5UVVcjs.d]:n,$name(i){return _chunkBJSN5UVVcjs.f.call(void 0, n,i),_chunkBJSN5UVVcjs.g.call(void 0, a)&&a.$name(`${i}_Input`),this},"~resolve"(i){return n.resolve(i,`@compute @workgroup_size(${t.join(", ")}) `)},toString(){return`computeFn:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, n), () => ("<unnamed>"))}`}}}function _n(e,t){let r={[_chunkBJSN5UVVcjs.a]:!0,argTypes:e,returnType:_nullishCoalesce(t, () => (_chunkBJSN5UVVcjs.A)),isEntry:!1},n=(a,...o)=>La(r,oe(a,...o));return Object.assign(Object.assign(n,r),{does:n})}function mr(e){return!!_optionalChain([e, 'optionalAccess', _26 => _26[_chunkBJSN5UVVcjs.a]])&&_optionalChain([e, 'optionalAccess', _27 => _27.resourceType])==="function"}function ka([e,t]){return`${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, e), () => ("<unnamed>"))}=${t}`}function La(e,t){let r=ne(e,t),n={[_chunkBJSN5UVVcjs.a]:{implementation:t,argTypes:e.argTypes},shell:e,resourceType:"function",$uses(i){return r.applyExternals(i),this},[_chunkBJSN5UVVcjs.d]:r,$name(i){return _chunkBJSN5UVVcjs.f.call(void 0, r,i),this},with(i,s){return $n(o,[[qe(i)?i.slot:i,s]])},"~resolve"(i){if(typeof t=="string")return r.resolve(i);let s=i;if(s.callStack===void 0)throw new Error("Cannot resolve a TGSL function outside of a generation context");try{return s.callStack.push(e.returnType),r.resolve(i)}finally{s.callStack.pop()}}},a=_chunkBJSN5UVVcjs.ga.call(void 0, (...i)=>{if(typeof t=="string")throw new Error("Cannot execute on the CPU functions constructed with raw WGSL");return t(...i)},(...i)=>_chunkBJSN5UVVcjs.da.call(void 0, new yt(o,i.map(s=>s.value)),_nullishCoalesce(e.returnType, () => (_chunkBJSN5UVVcjs.ca))),"tgpuFnCall",e.argTypes);a[_chunkBJSN5UVVcjs.a].implementation=t;let o=Object.assign(a,n);return Object.defineProperty(o,"toString",{value(){return`fn:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, r), () => ("<unnamed>"))}`}}),o}function $n(e,t){let r={[_chunkBJSN5UVVcjs.a]:{implementation:e[_chunkBJSN5UVVcjs.a].implementation,argTypes:e[_chunkBJSN5UVVcjs.a].argTypes},resourceType:"function",shell:e.shell,"~providing":{inner:e,pairs:t},$uses(o){return e.$uses(o),this},[_chunkBJSN5UVVcjs.d]:e,$name(o){return e.$name(o),this},with(o,i){return $n(a,[...t,[qe(o)?o.slot:o,i]])}},n=_chunkBJSN5UVVcjs.ga.call(void 0, (...o)=>e(...o),(...o)=>_chunkBJSN5UVVcjs.da.call(void 0, new yt(a,o.map(i=>i.value)),_nullishCoalesce(e.shell.returnType, () => (_chunkBJSN5UVVcjs.ca))),"tgpuFnCall",e.shell.argTypes),a=Object.assign(n,r);return Object.defineProperty(a,"toString",{value(){return`fn:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, e), () => ("<unnamed>"))}[${t.map(ka).join(", ")}]`}}),a[_chunkBJSN5UVVcjs.a].implementation=e[_chunkBJSN5UVVcjs.a].implementation,a}var yt=class{constructor(t,r){this._fn=t;this._params=r;this[_chunkBJSN5UVVcjs.d]=t}"~resolve"(t){return t.resolve(`${t.resolve(this._fn)}(${this._params.map(r=>t.resolve(r)).join(", ")})`)}toString(){return`call:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}};function En(e){let t={argTypes:e.in&&Object.keys(e.in).length!==0?[ae(e.in)]:[],targets:e.out,returnType:ae(e.out),isEntry:!0},r=(n,...a)=>Oa(t,oe(n,...a));return Object.assign(Object.assign(r,t),{does:r})}function Oa(e,t){let r=ne(e,t),n=e.returnType,a=e.argTypes[0];return typeof t=="string"&&Re(t,n,i=>r.applyExternals(i)),{shell:e,outputType:n,$uses(i){return r.applyExternals(i),this},[_chunkBJSN5UVVcjs.d]:r,$name(i){return _chunkBJSN5UVVcjs.f.call(void 0, r,i),_chunkBJSN5UVVcjs.g.call(void 0, n)&&n.$name(`${i}_Output`),_chunkBJSN5UVVcjs.g.call(void 0, a)&&a.$name(`${i}_Input`),this},"~resolve"(i){if(typeof t=="string")return r.resolve(i,"@fragment ");let s=i;if(s.callStack===void 0)throw new Error("Cannot resolve a TGSL function outside of a generation context");try{return s.callStack.push(n),r.resolve(i,"@fragment ")}finally{s.callStack.pop()}},toString(){return`fragmentFn:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, r), () => ("<unnamed>"))}`}}}function Gn(e){if(Object.keys(e.out).length===0)throw new Error("A vertexFn output cannot be empty since it must include the 'position' builtin.");let t={attributes:[_nullishCoalesce(e.in, () => ({}))],returnType:ae(e.out),argTypes:e.in&&Object.keys(e.in).length!==0?[ae(e.in)]:[],isEntry:!0},r=(n,...a)=>Wa(t,oe(n,...a));return Object.assign(Object.assign(r,t),{does:r})}function Wa(e,t){let r=ne(e,t),n=e.returnType,a=e.argTypes[0];return typeof t=="string"&&Re(t,n,i=>r.applyExternals(i)),{shell:e,outputType:n,inputType:a,$uses(i){return r.applyExternals(i),this},[_chunkBJSN5UVVcjs.d]:r,$name(i){return _chunkBJSN5UVVcjs.f.call(void 0, r,i),_chunkBJSN5UVVcjs.g.call(void 0, n)&&n.$name(`${i}_Output`),_chunkBJSN5UVVcjs.g.call(void 0, a)&&a.$name(`${i}_Input`),this},"~resolve"(i){if(typeof t=="string")return r.resolve(i,"@vertex ");let s=i;if(s.callStack===void 0)throw new Error("Cannot resolve a TGSL function outside of a generation context");try{return s.callStack.push(n),r.resolve(i,"@vertex ")}finally{s.callStack.pop()}},toString(){return`vertexFn:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, r), () => ("<unnamed>"))}`}}}var ie= (_class2 =class{constructor() { _class2.prototype.__init2.call(this); }__init2() {this.lastUniqueId=0}makeUnique(t){let r;return t?(r=t.replaceAll(/\s/g,"_"),r=r.replaceAll(/[^\w\d]/g,"")):r="item",`${r}_${this.lastUniqueId++}`}}, _class2),se= exports.StrictNameRegistry = (_class3 =class{constructor() { _class3.prototype.__init3.call(this); }__init3() {this._usedNames=new Set}makeUnique(t){if(t===void 0)throw new Error("Unnamed item found when using a strict name registry");let r=0,n=t;for(;this._usedNames.has(n);)r++,n=`${t}_${r}`;return this._usedNames.add(n),n}}, _class3);function Qe(e){return typeof _optionalChain([e, 'optionalAccess', _28 => _28.format])=="string"}function kn(e,t){let r=[];if(_chunkBJSN5UVVcjs.ba.call(void 0, e)){if(!Qe(t))throw new Error("Shader expected a single attribute, not a record of attributes to be passed in.");return r.push(t._layout),{usedVertexLayouts:r,bufferDefinitions:[{arrayStride:t._layout.stride,stepMode:t._layout.stepMode,attributes:[{format:t.format,offset:t.offset,shaderLocation:_nullishCoalesce(_chunkBJSN5UVVcjs.aa.call(void 0, e), () => (0))}]}]}}let n=[],a=new WeakMap,o=0;for(let[i,s]of Object.entries(e)){if(_chunkBZVU4Q6Acjs.aa.call(void 0, s))continue;let l=t[i];if(!l)throw new Error(`An attribute by the name of '${i}' was not provided to the shader.`);let u=l._layout,c=a.get(u);c||(r.push(u),c=[],n.push({arrayStride:u.stride,stepMode:u.stepMode,attributes:c}),a.set(u,c)),o=_nullishCoalesce(_chunkBJSN5UVVcjs.aa.call(void 0, s), () => (o)),c.push({format:l.format,offset:l.offset,shaderLocation:o++})}return{usedVertexLayouts:r,bufferDefinitions:n}}var Ma=["bool","f32","f16","i32","u32","vec2f","vec3f","vec4f","vec2h","vec3h","vec4h","vec2i","vec3i","vec4i","vec2u","vec3u","vec4u","vec2<bool>","vec3<bool>","vec4<bool>","mat2x2f","mat3x3f","mat4x4f"];function Na(e){return Ma.includes(e.type)}function dr(e,[t,r]){return` ${_chunkBZVU4Q6Acjs.ba.call(void 0, r)}${t}: ${e.resolve(r)},
|
7
|
+
`}function ja(e,t){let r=e.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, t));return e.addDeclaration(`
|
7
8
|
struct ${r} {
|
8
|
-
${Object.entries(t.propTypes).map(n=>
|
9
|
-
`),r}function
|
9
|
+
${Object.entries(t.propTypes).map(n=>dr(e,n)).join("")}}
|
10
|
+
`),r}function za(e,t){let r=e.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, t));return e.addDeclaration(`
|
10
11
|
struct ${r} {
|
11
|
-
${Object.entries(t.propTypes).map(n=>
|
12
|
+
${Object.entries(t.propTypes).map(n=>Qe(n[1])?dr(e,[n[0],_chunkBZVU4Q6Acjs.b[n[1].format]]):dr(e,n)).join("")}
|
12
13
|
}
|
13
|
-
`),r}function
|
14
|
-
`,
|
15
|
-
`,
|
16
|
-
`;return o}if(
|
17
|
-
`}return u}let n=
|
18
|
-
`}function Tt(e){if(pr.has(e))return pr.get(e);let t=ct(e,"offset","value"),r=new Function("output","offset","value","littleEndian=true",t);return pr.set(e,r),r}var Re={bool(){throw new Error("Booleans are not host-shareable")},f32(e,t,r){e.writeFloat32(r)},f16(e,t,r){e.writeFloat16(r)},i32(e,t,r){e.writeInt32(r)},u32(e,t,r){e.writeUint32(r)},vec2f(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y)},vec2h(e,t,r){e.writeFloat16(r.x),e.writeFloat16(r.y)},vec2i(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y)},vec2u(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y)},"vec2<bool>"(){throw new Error("Booleans are not host-shareable")},vec3f(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y),e.writeFloat32(r.z)},vec3h(e,t,r){e.writeFloat16(r.x),e.writeFloat16(r.y),e.writeFloat16(r.z)},vec3i(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y),e.writeInt32(r.z)},vec3u(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y),e.writeUint32(r.z)},"vec3<bool>"(){throw new Error("Booleans are not host-shareable")},vec4f(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y),e.writeFloat32(r.z),e.writeFloat32(r.w)},vec4h(e,t,r){e.writeFloat16(r.x),e.writeFloat16(r.y),e.writeFloat16(r.z),e.writeFloat16(r.w)},vec4i(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y),e.writeInt32(r.z),e.writeInt32(r.w)},vec4u(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y),e.writeUint32(r.z),e.writeUint32(r.w)},"vec4<bool>"(){throw new Error("Booleans are not host-shareable")},mat2x2f(e,t,r){for(let n=0;n<r.length;++n)e.writeFloat32(r[n])},mat3x3f(e,t,r){for(let n=0;n<r.length;++n)e.writeFloat32(r[n])},mat4x4f(e,t,r){for(let n=0;n<r.length;++n)e.writeFloat32(r[n])},struct(e,t,r){let n=_chunkFHOQ6WZEcjs._.call(void 0, t);B(e,n);for(let[a,o]of Object.entries(t.propTypes))B(e,_chunkFHOQ6WZEcjs._.call(void 0, o)),ne(e,o,r[a]);B(e,n)},array(e,t,r){if(t.elementCount===0)throw new Error("Cannot write using a runtime-sized schema.");let n=_chunkFHOQ6WZEcjs._.call(void 0, t);B(e,n);let a=e.currentByteOffset;for(let o=0;o<Math.min(t.elementCount,r.length);o++)B(e,n),ne(e,t.elementType,r[o]);e.seekTo(a+_chunkFHOQ6WZEcjs.ba.call(void 0, t))},ptr(){throw new Error("Pointers are not host-shareable")},atomic(e,t,r){_optionalChain([Re, 'access', _21 => _21[t.inner.type], 'optionalCall', _22 => _22(e,t,r)])},decorated(e,t,r){let n=_chunkFHOQ6WZEcjs.$.call(void 0, t);B(e,n);let a=e.currentByteOffset;_optionalChain([Re, 'access', _23 => _23[_optionalChain([t, 'access', _24 => _24.inner, 'optionalAccess', _25 => _25.type])], 'optionalCall', _26 => _26(e,t.inner,r)]),e.seekTo(a+_chunkFHOQ6WZEcjs.ba.call(void 0, t))},uint8(e,t,r){e.writeUint8(r)},uint8x2(e,t,r){e.writeUint8(r.x),e.writeUint8(r.y)},uint8x4(e,t,r){e.writeUint8(r.x),e.writeUint8(r.y),e.writeUint8(r.z),e.writeUint8(r.w)},sint8(e,t,r){e.writeInt8(r)},sint8x2(e,t,r){e.writeInt8(r.x),e.writeInt8(r.y)},sint8x4(e,t,r){e.writeInt8(r.x),e.writeInt8(r.y),e.writeInt8(r.z),e.writeInt8(r.w)},unorm8(e,t,r){e.writeUint8(r*255)},unorm8x2(e,t,r){e.writeUint8(r.x*255),e.writeUint8(r.y*255)},unorm8x4(e,t,r){e.writeUint8(r.x*255),e.writeUint8(r.y*255),e.writeUint8(r.z*255),e.writeUint8(r.w*255)},snorm8(e,t,r){e.writeUint8(r*127+128)},snorm8x2(e,t,r){e.writeUint8(r.x*127+128),e.writeUint8(r.y*127+128)},snorm8x4(e,t,r){e.writeUint8(r.x*127+128),e.writeUint8(r.y*127+128),e.writeUint8(r.z*127+128),e.writeUint8(r.w*127+128)},uint16(e,t,r){e.writeUint16(r)},uint16x2(e,t,r){e.writeUint16(r.x),e.writeUint16(r.y)},uint16x4(e,t,r){e.writeUint16(r.x),e.writeUint16(r.y),e.writeUint16(r.z),e.writeUint16(r.w)},sint16(e,t,r){e.writeInt16(r)},sint16x2(e,t,r){e.writeInt16(r.x),e.writeInt16(r.y)},sint16x4(e,t,r){e.writeInt16(r.x),e.writeInt16(r.y),e.writeInt16(r.z),e.writeInt16(r.w)},unorm16(e,t,r){e.writeUint16(r*65535)},unorm16x2(e,t,r){e.writeUint16(r.x*65535),e.writeUint16(r.y*65535)},unorm16x4(e,t,r){e.writeUint16(r.x*65535),e.writeUint16(r.y*65535),e.writeUint16(r.z*65535),e.writeUint16(r.w*65535)},snorm16(e,t,r){e.writeUint16(r*32767+32768)},snorm16x2(e,t,r){e.writeUint16(r.x*32767+32768),e.writeUint16(r.y*32767+32768)},snorm16x4(e,t,r){e.writeUint16(r.x*32767+32768),e.writeUint16(r.y*32767+32768),e.writeUint16(r.z*32767+32768),e.writeUint16(r.w*32767+32768)},float16(e,t,r){e.writeFloat16(r)},float16x2(e,t,r){e.writeFloat16(r.x),e.writeFloat16(r.y)},float16x4(e,t,r){e.writeFloat16(r.x),e.writeFloat16(r.y),e.writeFloat16(r.z),e.writeFloat16(r.w)},float32(e,t,r){e.writeFloat32(r)},float32x2(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y)},float32x3(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y),e.writeFloat32(r.z)},float32x4(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y),e.writeFloat32(r.z),e.writeFloat32(r.w)},uint32(e,t,r){e.writeUint32(r)},uint32x2(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y)},uint32x3(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y),e.writeUint32(r.z)},uint32x4(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y),e.writeUint32(r.z),e.writeUint32(r.w)},sint32(e,t,r){e.writeInt32(r)},sint32x2(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y)},sint32x3(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y),e.writeInt32(r.z)},sint32x4(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y),e.writeInt32(r.z),e.writeInt32(r.w)},"unorm10-10-10-2"(e,t,r){let n=0;n|=(r.x*1023&1023)<<22,n|=(r.x*1023&1023)<<12,n|=(r.y*1023&1023)<<2,n|=r.z*3&3,e.writeUint32(n)},"unorm8x4-bgra"(e,t,r){e.writeUint8(r.z*255),e.writeUint8(r.y*255),e.writeUint8(r.x*255),e.writeUint8(r.w*255)},disarray(e,t,r){let n=_chunkFHOQ6WZEcjs._.call(void 0, t);B(e,n);let a=e.currentByteOffset;for(let o=0;o<Math.min(t.elementCount,r.length);o++)B(e,n),_optionalChain([Re, 'access', _27 => _27[_optionalChain([t, 'access', _28 => _28.elementType, 'optionalAccess', _29 => _29.type])], 'optionalCall', _30 => _30(e,t.elementType,r[o])]);e.seekTo(a+_chunkFHOQ6WZEcjs.ba.call(void 0, t))},unstruct(e,t,r){for(let[n,a]of Object.entries(t.propTypes))_optionalChain([Re, 'access', _31 => _31[a.type], 'optionalCall', _32 => _32(e,a,r[n])])},"loose-decorated"(e,t,r){let n=_chunkFHOQ6WZEcjs.$.call(void 0, t);B(e,n);let a=e.currentByteOffset,o=Re[_optionalChain([t, 'access', _33 => _33.inner, 'optionalAccess', _34 => _34.type])];return _optionalChain([o, 'optionalCall', _35 => _35(e,t.inner,r)]),e.seekTo(a+_chunkFHOQ6WZEcjs.ba.call(void 0, t)),r}};function ne(e,t,r){let n=Re[t.type];if(!n)throw new Error(`Cannot write data of type '${t.type}'.`);n(e,t,r)}var Te={bool(){throw new Error("Booleans are not host-shareable")},f32(e){return e.readFloat32()},f16(e){return e.readFloat16()},i32(e){return e.readInt32()},u32(e){return e.readUint32()},vec2f(e){return _chunkODKBWWHUcjs.V.call(void 0, e.readFloat32(),e.readFloat32())},vec3f(e){return _chunkODKBWWHUcjs._.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32())},vec4f(e){return _chunkODKBWWHUcjs.da.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32())},vec2h(e){return _chunkODKBWWHUcjs.W.call(void 0, e.readFloat16(),e.readFloat16())},vec3h(e){return _chunkODKBWWHUcjs.$.call(void 0, e.readFloat16(),e.readFloat16(),e.readFloat16())},vec4h(e){return _chunkODKBWWHUcjs.ea.call(void 0, e.readFloat16(),e.readFloat16(),e.readFloat16(),e.readFloat16())},vec2i(e){return _chunkODKBWWHUcjs.X.call(void 0, e.readInt32(),e.readInt32())},vec3i(e){return _chunkODKBWWHUcjs.aa.call(void 0, e.readInt32(),e.readInt32(),e.readInt32())},vec4i(e){return _chunkODKBWWHUcjs.fa.call(void 0, e.readInt32(),e.readInt32(),e.readInt32(),e.readInt32())},vec2u(e){return _chunkODKBWWHUcjs.Y.call(void 0, e.readUint32(),e.readUint32())},vec3u(e){return _chunkODKBWWHUcjs.ba.call(void 0, e.readUint32(),e.readUint32(),e.readUint32())},vec4u(e){return _chunkODKBWWHUcjs.ga.call(void 0, e.readUint32(),e.readUint32(),e.readUint32(),e.readUint32())},"vec2<bool>"(){throw new Error("Booleans are not host-shareable")},"vec3<bool>"(){throw new Error("Booleans are not host-shareable")},"vec4<bool>"(){throw new Error("Booleans are not host-shareable")},mat2x2f(e){return _chunkODKBWWHUcjs.ja.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32())},mat3x3f(e){let t=()=>{let r=e.readFloat32();return e.readFloat32(),r};return _chunkODKBWWHUcjs.ka.call(void 0, e.readFloat32(),e.readFloat32(),t(),e.readFloat32(),e.readFloat32(),t(),e.readFloat32(),e.readFloat32(),t())},mat4x4f(e){return _chunkODKBWWHUcjs.la.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32())},struct(e,t){let r=_chunkFHOQ6WZEcjs._.call(void 0, t);B(e,r);let n={};for(let[a,o]of Object.entries(t.propTypes))B(e,_chunkFHOQ6WZEcjs._.call(void 0, o)),n[a]=M(e,o);return B(e,r),n},array(e,t){if(t.elementCount===0)throw new Error("Cannot read using a runtime-sized schema.");let r=_chunkFHOQ6WZEcjs._.call(void 0, t),n=[];for(let a=0;a<t.elementCount;a++){B(e,r);let o=t.elementType,s=M(e,o);n.push(s)}return B(e,r),n},ptr(){throw new Error("Pointers are not host-shareable")},atomic(e,t){return M(e,t.inner)},decorated(e,t){let r=_chunkFHOQ6WZEcjs.$.call(void 0, t);B(e,r);let n=e.currentByteOffset,a=M(e,t.inner);return e.seekTo(n+_chunkFHOQ6WZEcjs.ba.call(void 0, t)),a},uint8:e=>e.readUint8(),uint8x2:e=>_chunkODKBWWHUcjs.Y.call(void 0, e.readUint8(),e.readUint8()),uint8x4:e=>_chunkODKBWWHUcjs.ga.call(void 0, e.readUint8(),e.readUint8(),e.readUint8(),e.readUint8()),sint8:e=>e.readInt8(),sint8x2:e=>_chunkODKBWWHUcjs.X.call(void 0, e.readInt8(),e.readInt8()),sint8x4:e=>_chunkODKBWWHUcjs.fa.call(void 0, e.readInt8(),e.readInt8(),e.readInt8(),e.readInt8()),unorm8:e=>e.readUint8()/255,unorm8x2:e=>_chunkODKBWWHUcjs.V.call(void 0, e.readUint8()/255,e.readUint8()/255),unorm8x4:e=>_chunkODKBWWHUcjs.da.call(void 0, e.readUint8()/255,e.readUint8()/255,e.readUint8()/255,e.readUint8()/255),snorm8:e=>(e.readUint8()-128)/127,snorm8x2:e=>_chunkODKBWWHUcjs.V.call(void 0, (e.readUint8()-128)/127,(e.readUint8()-128)/127),snorm8x4:e=>_chunkODKBWWHUcjs.da.call(void 0, (e.readUint8()-128)/127,(e.readUint8()-128)/127,(e.readUint8()-128)/127,(e.readUint8()-128)/127),uint16:e=>e.readUint16(),uint16x2:e=>_chunkODKBWWHUcjs.Y.call(void 0, e.readUint16(),e.readUint16()),uint16x4:e=>_chunkODKBWWHUcjs.ga.call(void 0, e.readUint16(),e.readUint16(),e.readUint16(),e.readUint16()),sint16:e=>e.readInt16(),sint16x2:e=>_chunkODKBWWHUcjs.X.call(void 0, e.readInt16(),e.readInt16()),sint16x4:e=>_chunkODKBWWHUcjs.fa.call(void 0, e.readInt16(),e.readInt16(),e.readInt16(),e.readInt16()),unorm16:e=>e.readUint16()/65535,unorm16x2:e=>_chunkODKBWWHUcjs.V.call(void 0, e.readUint16()/65535,e.readUint16()/65535),unorm16x4:e=>_chunkODKBWWHUcjs.da.call(void 0, e.readUint16()/65535,e.readUint16()/65535,e.readUint16()/65535,e.readUint16()/65535),snorm16:e=>(e.readUint16()-32768)/32767,snorm16x2:e=>_chunkODKBWWHUcjs.V.call(void 0, Te.snorm16(e),Te.snorm16(e)),snorm16x4:e=>_chunkODKBWWHUcjs.da.call(void 0, Te.snorm16(e),Te.snorm16(e),Te.snorm16(e),Te.snorm16(e)),float16(e){return e.readFloat16()},float16x2:e=>_chunkODKBWWHUcjs.V.call(void 0, e.readFloat16(),e.readFloat16()),float16x4:e=>_chunkODKBWWHUcjs.da.call(void 0, e.readFloat16(),e.readFloat16(),e.readFloat16(),e.readFloat16()),float32:e=>e.readFloat32(),float32x2:e=>_chunkODKBWWHUcjs.V.call(void 0, e.readFloat32(),e.readFloat32()),float32x3:e=>_chunkODKBWWHUcjs._.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32()),float32x4:e=>_chunkODKBWWHUcjs.da.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32()),uint32:e=>e.readUint32(),uint32x2:e=>_chunkODKBWWHUcjs.Y.call(void 0, e.readUint32(),e.readUint32()),uint32x3:e=>_chunkODKBWWHUcjs.ba.call(void 0, e.readUint32(),e.readUint32(),e.readUint32()),uint32x4:e=>_chunkODKBWWHUcjs.ga.call(void 0, e.readUint32(),e.readUint32(),e.readUint32(),e.readUint32()),sint32:e=>e.readInt32(),sint32x2:e=>_chunkODKBWWHUcjs.X.call(void 0, e.readInt32(),e.readInt32()),sint32x3:e=>_chunkODKBWWHUcjs.aa.call(void 0, e.readInt32(),e.readInt32(),e.readInt32()),sint32x4:e=>_chunkODKBWWHUcjs.fa.call(void 0, e.readInt32(),e.readInt32(),e.readInt32(),e.readInt32()),"unorm10-10-10-2"(e){let t=e.readUint32(),r=(t>>22)/1023,n=(t>>12&1023)/1023,a=(t>>2&1023)/1023,o=(t&3)/3;return _chunkODKBWWHUcjs.da.call(void 0, r,n,a,o)},"unorm8x4-bgra"(e){let t=e.readByte()/255,r=e.readByte()/255,n=e.readByte()/255,a=e.readByte()/255;return _chunkODKBWWHUcjs.da.call(void 0, n,r,t,a)},unstruct(e,t){let r={};for(let[n,a]of Object.entries(t.propTypes))r[n]=M(e,a);return r},disarray(e,t){let r=_chunkFHOQ6WZEcjs._.call(void 0, t),n=[];for(let a=0;a<t.elementCount;a++)B(e,r),n.push(M(e,t.elementType));return B(e,r),n},"loose-decorated"(e,t){B(e,_chunkFHOQ6WZEcjs.$.call(void 0, t));let r=e.currentByteOffset,n=M(e,t.inner);return e.seekTo(r+_chunkFHOQ6WZEcjs.ba.call(void 0, t)),n}};function M(e,t){let r=Te[t.type];if(!r)throw new Error(`Cannot read data of type '${t.type}'.`);return r(e,t)}function hn(e,t){let r=_chunkFHOQ6WZEcjs.ba.call(void 0, e);if(r===0||t===void 0||t===null)return[];let n=new ArrayBuffer(r),a=new (0, _typedbinary.BufferWriter)(n),o=[];function s(u,d,g,c){if(d!=null){if(_chunkODKBWWHUcjs.C.call(void 0, u)||_chunkFHOQ6WZEcjs.f.call(void 0, u)){let y=gt(u);for(let[x,h]of Object.entries(y)){let T=u.propTypes[x];if(!T)continue;let D=d[x];D!==void 0&&s(T,D,g+h.offset,_nullishCoalesce(h.padding, () => (c)))}return}if(_chunkODKBWWHUcjs.B.call(void 0, u)||_chunkFHOQ6WZEcjs.e.call(void 0, u)){let y=u,x=_chunkFHOQ6WZEcjs.a.call(void 0, _chunkFHOQ6WZEcjs.ba.call(void 0, y.elementType),_chunkFHOQ6WZEcjs._.call(void 0, y.elementType));if(!Array.isArray(d))throw new Error("Partial value for array must be an array");let h=_nullishCoalesce(d, () => ([]));h.sort((T,D)=>T.idx-D.idx);for(let{idx:T,value:D}of h)s(y.elementType,D,g+T*x,x-_chunkFHOQ6WZEcjs.ba.call(void 0, y.elementType))}else{let y=_chunkFHOQ6WZEcjs.ba.call(void 0, u);a.seekTo(g),ne(a,u,d),o.push({start:g,end:g+y,padding:c})}}}if(s(e,t,0),o.length===0)return[];let i=[],l=o[0];for(let u=1;u<o.length;u++){let d=o[u];if(!d||!l)throw new Error("Internal error: missing segment");d.start===l.end+(_nullishCoalesce(l.padding, () => (0)))?(l.end=d.end,l.padding=d.padding):(i.push({data:new Uint8Array(n,l.start,l.end-l.start)}),l=d)}if(!l)throw new Error("Internal error: missing segment");return i.push({data:new Uint8Array(n,l.start,l.end-l.start)}),i}function xe(e){return!!_optionalChain([e, 'optionalAccess', _36 => _36.usableAsStorage])}var He=class e extends Error{constructor(t){super(`Resource '${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, t), () => ("<unnamed>"))}' cannot be bound as 'storage'. Use .$usage('storage') to allow it.`),Object.setPrototypeOf(this,e.prototype)}};function xt(e){return!!e.usableAsUniform}var vn={uniform:"uniform",mutable:"storage, read_write",readonly:"storage, read"},qe= (_class2 =class{constructor(t,r){;_class2.prototype.__init2.call(this);this.usage=t;this.buffer=r;this[_chunkODKBWWHUcjs.a]={dataType:r.dataType},this[_chunkODKBWWHUcjs.b]=r}__init2() {this.resourceType="buffer-usage"}$name(t){return this.buffer.$name(t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),{group:n,binding:a}=t.allocateFixedEntry(this.usage==="uniform"?{uniform:this.buffer.dataType}:{storage:this.buffer.dataType,access:this.usage},this.buffer),o=vn[this.usage];return t.addDeclaration(`@group(${n}) @binding(${a}) var<${o}> ${r}: ${t.resolve(this.buffer.dataType)};`),r}write(t){this.buffer.write(t)}toString(){return`${this.usage}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}get value(){if(!_chunkODKBWWHUcjs.r.call(void 0, ))throw new Error("Cannot access buffer's value directly in JS.");return new Proxy({"~resolve":t=>t.resolve(this),toString:()=>`.value:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`,[_chunkODKBWWHUcjs.a]:{dataType:this.buffer.dataType}},Y)}}, _class2),Je= (_class3 =class{constructor(t,r,n){;_class3.prototype.__init3.call(this);this.usage=t;this.dataType=r;this._membership=n;this[_chunkODKBWWHUcjs.a]={dataType:r},_chunkODKBWWHUcjs.d.call(void 0, this,n.key)}__init3() {this.resourceType="buffer-usage"}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout),a=vn[this.usage];return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var<${a}> ${r}: ${t.resolve(this.dataType)};`),r}toString(){return`${this.usage}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}get value(){if(!_chunkODKBWWHUcjs.r.call(void 0, ))throw new Error("Cannot access buffer's value directly in JS.");return new Proxy({"~resolve":t=>t.resolve(this),toString:()=>`.value:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`,[_chunkODKBWWHUcjs.a]:{dataType:this.dataType}},Y)}}, _class3),wn=new WeakMap;function mr(e){if(!xe(e))throw new Error(`Cannot pass ${e} to asMutable, as it is not allowed to be used as storage. To allow it, call .$usage('storage') when creating the buffer.`);let t=wn.get(e);return t||(t=new qe("mutable",e),wn.set(e,t)),t}var bn=new WeakMap;function fr(e){if(!xe(e))throw new Error(`Cannot pass ${e} to asReadonly, as it is not allowed to be used as storage. To allow it, call .$usage('storage') when creating the buffer.`);let t=bn.get(e);return t||(t=new qe("readonly",e),bn.set(e,t)),t}var Sn=new WeakMap;function gr(e){if(!xt(e))throw new Error(`Cannot pass ${e} to asUniform, as it is not allowed to be used as a uniform. To allow it, call .$usage('uniform') when creating the buffer.`);let t=Sn.get(e);return t||(t=new qe("uniform",e),Sn.set(e,t)),t}var va={uniform:gr,mutable:mr,readonly:fr};function Fn(e,t,r){return _chunkODKBWWHUcjs.A.call(void 0, t)?new ht(e,t,r):new ht(e,t,r,["storage","uniform"])}function ae(e){return e.resourceType==="buffer"}function Da(e){return!!e.usableAsVertex}var Dn=_typedbinary.getSystemEndianness.call(void 0, ),ht= (_class4 =class{constructor(t,r,n,a){;_class4.prototype.__init4.call(this);_class4.prototype.__init5.call(this);_class4.prototype.__init6.call(this);_class4.prototype.__init7.call(this);_class4.prototype.__init8.call(this);_class4.prototype.__init9.call(this);_class4.prototype.__init10.call(this);this._group=t;this.dataType=r;this.initialOrBuffer=n;this._disallowedUsages=a;nn(n)?(this._ownBuffer=!1,this._buffer=n):(this._ownBuffer=!0,this.initial=n)}__init4() {this.resourceType="buffer"}__init5() {this.flags=GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC}__init6() {this._buffer=null}__init7() {this._destroyed=!1}__init8() {this.usableAsUniform=!1}__init9() {this.usableAsStorage=!1}__init10() {this.usableAsVertex=!1}get buffer(){let t=this._group.device;if(this._destroyed)throw new Error("This buffer has been destroyed");if(!this._buffer&&(this._buffer=t.createBuffer({size:_chunkFHOQ6WZEcjs.ba.call(void 0, this.dataType),usage:this.flags,mappedAtCreation:!!this.initial,label:_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}),this.initial)){let r=new (0, _typedbinary.BufferWriter)(this._buffer.getMappedRange());ne(r,this.dataType,this.initial),this._buffer.unmap()}return this._buffer}get destroyed(){return this._destroyed}$name(t){return _chunkODKBWWHUcjs.d.call(void 0, this,t),this._buffer&&(this._buffer.label=t),this}$usage(...t){for(let r of t){if(_optionalChain([this, 'access', _37 => _37._disallowedUsages, 'optionalAccess', _38 => _38.includes, 'call', _39 => _39(r)]))throw new Error(`Buffer of type ${this.dataType.type} cannot be used as ${r}`);this.flags|=r==="uniform"?GPUBufferUsage.UNIFORM:0,this.flags|=r==="storage"?GPUBufferUsage.STORAGE:0,this.flags|=r==="vertex"?GPUBufferUsage.VERTEX:0,this.usableAsUniform=this.usableAsUniform||r==="uniform",this.usableAsStorage=this.usableAsStorage||r==="storage",this.usableAsVertex=this.usableAsVertex||r==="vertex"}return this}$addFlags(t){if(!this._ownBuffer)throw new Error("Cannot add flags to a buffer that is not managed by TypeGPU.");return t&GPUBufferUsage.MAP_READ?(this.flags=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this):t&GPUBufferUsage.MAP_WRITE?(this.flags=GPUBufferUsage.COPY_SRC|GPUBufferUsage.MAP_WRITE,this):(this.flags|=t,this)}compileWriter(){if(yt)Tt(this.dataType);else throw new Error("This environment does not allow eval")}write(t){let r=this.buffer,n=this._group.device;if(r.mapState==="mapped"){let o=r.getMappedRange();if(yt){Tt(this.dataType)(new DataView(o),0,t,Dn==="little");return}ne(new (0, _typedbinary.BufferWriter)(o),this.dataType,t);return}let a=_chunkFHOQ6WZEcjs.ba.call(void 0, this.dataType);this._hostBuffer||(this._hostBuffer=new ArrayBuffer(a)),this._group.flush(),yt?Tt(this.dataType)(new DataView(this._hostBuffer),0,t,Dn==="little"):ne(new (0, _typedbinary.BufferWriter)(this._hostBuffer),this.dataType,t),n.queue.writeBuffer(r,0,this._hostBuffer,0,a)}writePartial(t){let r=this.buffer,n=this._group.device,a=hn(this.dataType,t);if(r.mapState==="mapped"){let o=r.getMappedRange(),s=new Uint8Array(o);for(let i of a)s.set(i.data,i.data.byteOffset)}else for(let o of a)n.queue.writeBuffer(r,o.data.byteOffset,o.data,0,o.data.byteLength)}copyFrom(t){if(this.buffer.mapState==="mapped")throw new Error("Cannot copy to a mapped buffer.");let r=_chunkFHOQ6WZEcjs.ba.call(void 0, this.dataType);this._group.commandEncoder.copyBufferToBuffer(t.buffer,0,this.buffer,0,r)}async read(){this._group.flush();let t=this.buffer,r=this._group.device;if(t.mapState==="mapped"){let s=t.getMappedRange();return M(new (0, _typedbinary.BufferReader)(s),this.dataType)}if(t.usage&GPUBufferUsage.MAP_READ){await t.mapAsync(GPUMapMode.READ);let s=t.getMappedRange(),i=M(new (0, _typedbinary.BufferReader)(s),this.dataType);return t.unmap(),i}let n=r.createBuffer({size:_chunkFHOQ6WZEcjs.ba.call(void 0, this.dataType),usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),a=r.createCommandEncoder();a.copyBufferToBuffer(t,0,n,0,_chunkFHOQ6WZEcjs.ba.call(void 0, this.dataType)),r.queue.submit([a.finish()]),await r.queue.onSubmittedWorkDone(),await n.mapAsync(GPUMapMode.READ,0,_chunkFHOQ6WZEcjs.ba.call(void 0, this.dataType));let o=M(new (0, _typedbinary.BufferReader)(n.getMappedRange()),this.dataType);return n.unmap(),n.destroy(),o}as(t){return _optionalChain([va, 'access', _40 => _40[t], 'optionalCall', _41 => _41(this)])}destroy(){this._destroyed||(this._destroyed=!0,this._ownBuffer&&_optionalChain([this, 'access', _42 => _42._buffer, 'optionalAccess', _43 => _43.destroy, 'call', _44 => _44()]))}toString(){return`buffer:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}}, _class4);function An(e){return new Tr(e)}function In(e){return new xr(e)}function Ye(e){let t=e;return _optionalChain([t, 'optionalAccess', _45 => _45.resourceType])==="sampler"&&!!t[_chunkODKBWWHUcjs.a]}function Qe(e){let t=e;return _optionalChain([t, 'optionalAccess', _46 => _46.resourceType])==="sampler-comparison"&&!!t[_chunkODKBWWHUcjs.a]}var wt= (_class5 =class{constructor(t){;_class5.prototype.__init11.call(this);this._membership=t;this[_chunkODKBWWHUcjs.a]={},_chunkODKBWWHUcjs.d.call(void 0, this,t.key)}__init11() {this.resourceType="sampler"}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout);return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var ${r}: sampler;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}}, _class5),bt= (_class6 =class{constructor(t){;_class6.prototype.__init12.call(this);this._membership=t;this[_chunkODKBWWHUcjs.a]={},_chunkODKBWWHUcjs.d.call(void 0, this,t.key)}__init12() {this.resourceType="sampler-comparison"}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout);return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var ${r}: sampler_comparison;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}}, _class6),Tr= (_class7 =class{constructor(t){;_class7.prototype.__init13.call(this);_class7.prototype.__init14.call(this);this._props=t;this[_chunkODKBWWHUcjs.a]={unwrap:r=>(this._sampler||(this._sampler=r.device.createSampler({...this._props,label:_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))})),this._sampler)},this._filtering=t.minFilter==="linear"||t.magFilter==="linear"||t.mipmapFilter==="linear"}__init13() {this.resourceType="sampler"}__init14() {this._sampler=null}$name(t){return _chunkODKBWWHUcjs.d.call(void 0, this,t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),{group:n,binding:a}=t.allocateFixedEntry({sampler:this._filtering?"filtering":"non-filtering"},this);return t.addDeclaration(`@group(${n}) @binding(${a}) var ${r}: sampler;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}}, _class7),xr= (_class8 =class{constructor(t){;_class8.prototype.__init15.call(this);_class8.prototype.__init16.call(this);this._props=t;this[_chunkODKBWWHUcjs.a]={unwrap:r=>(this._sampler||(this._sampler=r.device.createSampler({...this._props,label:_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))})),this._sampler)}}__init15() {this.resourceType="sampler-comparison"}__init16() {this._sampler=null}$name(t){return _chunkODKBWWHUcjs.d.call(void 0, this,t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),{group:n,binding:a}=t.allocateFixedEntry({sampler:"comparison"},this);return t.addDeclaration(`@group(${n}) @binding(${a}) var ${r}: sampler_comparison;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}}, _class8);var St= (_class9 =class{constructor(t){;_class9.prototype.__init17.call(this);this._membership=t;_chunkODKBWWHUcjs.d.call(void 0, this,t.key)}__init17() {this.resourceType="external-texture"}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout);return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var ${r}: texture_external;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}}, _class9);var Un={r8unorm:_chunkODKBWWHUcjs.T,r8snorm:_chunkODKBWWHUcjs.T,r8uint:_chunkODKBWWHUcjs.R,r8sint:_chunkODKBWWHUcjs.S,r16uint:_chunkODKBWWHUcjs.R,r16sint:_chunkODKBWWHUcjs.S,r16float:_chunkODKBWWHUcjs.T,rg8unorm:_chunkODKBWWHUcjs.T,rg8snorm:_chunkODKBWWHUcjs.T,rg8uint:_chunkODKBWWHUcjs.R,rg8sint:_chunkODKBWWHUcjs.S,r32uint:_chunkODKBWWHUcjs.R,r32sint:_chunkODKBWWHUcjs.S,r32float:_chunkODKBWWHUcjs.T,rg16uint:_chunkODKBWWHUcjs.R,rg16sint:_chunkODKBWWHUcjs.S,rg16float:_chunkODKBWWHUcjs.T,rgba8unorm:_chunkODKBWWHUcjs.T,"rgba8unorm-srgb":_chunkODKBWWHUcjs.T,rgba8snorm:_chunkODKBWWHUcjs.T,rgba8uint:_chunkODKBWWHUcjs.R,rgba8sint:_chunkODKBWWHUcjs.S,bgra8unorm:_chunkODKBWWHUcjs.T,"bgra8unorm-srgb":_chunkODKBWWHUcjs.T,rgb9e5ufloat:_chunkODKBWWHUcjs.T,rgb10a2uint:_chunkODKBWWHUcjs.R,rgb10a2unorm:_chunkODKBWWHUcjs.T,rg11b10ufloat:_chunkODKBWWHUcjs.T,rg32uint:_chunkODKBWWHUcjs.R,rg32sint:_chunkODKBWWHUcjs.S,rg32float:_chunkODKBWWHUcjs.T,rgba16uint:_chunkODKBWWHUcjs.R,rgba16sint:_chunkODKBWWHUcjs.S,rgba16float:_chunkODKBWWHUcjs.T,rgba32uint:_chunkODKBWWHUcjs.R,rgba32sint:_chunkODKBWWHUcjs.S,rgba32float:_chunkODKBWWHUcjs.T,stencil8:_chunkODKBWWHUcjs.T,depth16unorm:_chunkODKBWWHUcjs.T,depth24plus:_chunkODKBWWHUcjs.T,"depth24plus-stencil8":_chunkODKBWWHUcjs.T,depth32float:_chunkODKBWWHUcjs.T,"depth32float-stencil8":_chunkODKBWWHUcjs.T,"bc1-rgba-unorm":_chunkODKBWWHUcjs.T,"bc1-rgba-unorm-srgb":_chunkODKBWWHUcjs.T,"bc2-rgba-unorm":_chunkODKBWWHUcjs.T,"bc2-rgba-unorm-srgb":_chunkODKBWWHUcjs.T,"bc3-rgba-unorm":_chunkODKBWWHUcjs.T,"bc3-rgba-unorm-srgb":_chunkODKBWWHUcjs.T,"bc4-r-unorm":_chunkODKBWWHUcjs.T,"bc4-r-snorm":_chunkODKBWWHUcjs.T,"bc5-rg-unorm":_chunkODKBWWHUcjs.T,"bc5-rg-snorm":_chunkODKBWWHUcjs.T,"bc6h-rgb-ufloat":_chunkODKBWWHUcjs.T,"bc6h-rgb-float":_chunkODKBWWHUcjs.T,"bc7-rgba-unorm":_chunkODKBWWHUcjs.T,"bc7-rgba-unorm-srgb":_chunkODKBWWHUcjs.T,"etc2-rgb8unorm":_chunkODKBWWHUcjs.T,"etc2-rgb8unorm-srgb":_chunkODKBWWHUcjs.T,"etc2-rgb8a1unorm":_chunkODKBWWHUcjs.T,"etc2-rgb8a1unorm-srgb":_chunkODKBWWHUcjs.T,"etc2-rgba8unorm":_chunkODKBWWHUcjs.T,"etc2-rgba8unorm-srgb":_chunkODKBWWHUcjs.T,"eac-r11unorm":_chunkODKBWWHUcjs.T,"eac-r11snorm":_chunkODKBWWHUcjs.T,"eac-rg11unorm":_chunkODKBWWHUcjs.T,"eac-rg11snorm":_chunkODKBWWHUcjs.T,"astc-4x4-unorm":_chunkODKBWWHUcjs.T,"astc-4x4-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-5x4-unorm":_chunkODKBWWHUcjs.T,"astc-5x4-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-5x5-unorm":_chunkODKBWWHUcjs.T,"astc-5x5-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-6x5-unorm":_chunkODKBWWHUcjs.T,"astc-6x5-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-6x6-unorm":_chunkODKBWWHUcjs.T,"astc-6x6-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-8x5-unorm":_chunkODKBWWHUcjs.T,"astc-8x5-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-8x6-unorm":_chunkODKBWWHUcjs.T,"astc-8x6-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-8x8-unorm":_chunkODKBWWHUcjs.T,"astc-8x8-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-10x5-unorm":_chunkODKBWWHUcjs.T,"astc-10x5-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-10x6-unorm":_chunkODKBWWHUcjs.T,"astc-10x6-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-10x8-unorm":_chunkODKBWWHUcjs.T,"astc-10x8-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-10x10-unorm":_chunkODKBWWHUcjs.T,"astc-10x10-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-12x10-unorm":_chunkODKBWWHUcjs.T,"astc-12x10-unorm-srgb":_chunkODKBWWHUcjs.T,"astc-12x12-unorm":_chunkODKBWWHUcjs.T,"astc-12x12-unorm-srgb":_chunkODKBWWHUcjs.T},Xe={rgba8unorm:_chunkODKBWWHUcjs.da,rgba8snorm:_chunkODKBWWHUcjs.da,rgba8uint:_chunkODKBWWHUcjs.ga,rgba8sint:_chunkODKBWWHUcjs.fa,rgba16uint:_chunkODKBWWHUcjs.ga,rgba16sint:_chunkODKBWWHUcjs.fa,rgba16float:_chunkODKBWWHUcjs.da,r32uint:_chunkODKBWWHUcjs.ga,r32sint:_chunkODKBWWHUcjs.fa,r32float:_chunkODKBWWHUcjs.da,rg32uint:_chunkODKBWWHUcjs.ga,rg32sint:_chunkODKBWWHUcjs.fa,rg32float:_chunkODKBWWHUcjs.da,rgba32uint:_chunkODKBWWHUcjs.ga,rgba32sint:_chunkODKBWWHUcjs.fa,rgba32float:_chunkODKBWWHUcjs.da,bgra8unorm:_chunkODKBWWHUcjs.da},Bn={f32:"float",u32:"uint",i32:"sint"},Rn={float:_chunkODKBWWHUcjs.T,"unfilterable-float":_chunkODKBWWHUcjs.T,uint:_chunkODKBWWHUcjs.R,sint:_chunkODKBWWHUcjs.S,depth:_chunkODKBWWHUcjs.T};function Cn(e,t){return new hr(e,t)}function X(e){return _optionalChain([e, 'optionalAccess', _47 => _47.resourceType])==="texture"&&!!e[_chunkODKBWWHUcjs.a]}function Ze(e){return _optionalChain([e, 'optionalAccess', _48 => _48.resourceType])==="texture-storage-view"&&!!e[_chunkODKBWWHUcjs.a]}function et(e){return _optionalChain([e, 'optionalAccess', _49 => _49.resourceType])==="texture-sampled-view"&&!!e[_chunkODKBWWHUcjs.a]}var Pn={mutable:"read_write",readonly:"read",writeonly:"write"},hr= (_class10 =class{constructor(t,r){;_class10.prototype.__init18.call(this);_class10.prototype.__init19.call(this);_class10.prototype.__init20.call(this);_class10.prototype.__init21.call(this);_class10.prototype.__init22.call(this);_class10.prototype.__init23.call(this);_class10.prototype.__init24.call(this);this.props=t;this._branch=r;this[_chunkODKBWWHUcjs.a]={unwrap:()=>{if(this._destroyed)throw new Error("This texture has been destroyed");return this._texture||(this._texture=this._branch.device.createTexture({label:_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>")),format:this.props.format,size:this.props.size,usage:this._flags,dimension:_nullishCoalesce(this.props.dimension, () => ("2d")),viewFormats:_nullishCoalesce(this.props.viewFormats, () => ([])),mipLevelCount:_nullishCoalesce(this.props.mipLevelCount, () => (1)),sampleCount:_nullishCoalesce(this.props.sampleCount, () => (1))})),this._texture}}}__init18() {this.resourceType="texture"}__init19() {this.usableAsSampled=!1}__init20() {this.usableAsStorage=!1}__init21() {this.usableAsRender=!1}__init22() {this._destroyed=!1}__init23() {this._flags=GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC}__init24() {this._texture=null}$name(t){return _chunkODKBWWHUcjs.d.call(void 0, this,t),this}$usage(...t){let r=t.includes("storage"),n=t.includes("sampled"),a=t.includes("render");return this._flags|=n?GPUTextureUsage.TEXTURE_BINDING:0,this._flags|=r?GPUTextureUsage.STORAGE_BINDING:0,this._flags|=a?GPUTextureUsage.RENDER_ATTACHMENT:0,this.usableAsStorage||=r,this.usableAsSampled||=n,this.usableAsRender||=a,this}createView(t,r){if(t==="sampled")return this._asSampled(r);let n=r;switch(t){case"mutable":return this._asMutable(n);case"readonly":return this._asReadonly(n);case"writeonly":return this._asWriteonly(n)}}_asStorage(t,r){if(!this.usableAsStorage)throw new Error("Unusable as storage");let n=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _50 => _50.format]), () => (this.props.format)),a=Xe[n];return _chunkODKBWWHUcjs.f.call(void 0, !!a,`Unsupported storage texture format: ${n}`),new wr(_nullishCoalesce(t, () => ({})),r,this)}_asReadonly(t){return this._asStorage(t,"readonly")}_asWriteonly(t){return this._asStorage(t,"writeonly")}_asMutable(t){return this._asStorage(t,"mutable")}_asSampled(t){if(!this.usableAsSampled)throw new Error("Unusable as sampled");let r=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _51 => _51.format]), () => (this.props.format));if(!Xe[r])throw new Error(`Unsupported storage texture format: ${r}`);return new br(t,this)}destroy(){this._destroyed||(this._destroyed=!0,_optionalChain([this, 'access', _52 => _52._texture, 'optionalAccess', _53 => _53.destroy, 'call', _54 => _54()]))}}, _class10),Ft={"1d":"1d","2d":"2d","2d-array":"2d_array",cube:"cube","cube-array":"cube_array","3d":"3d"},wr= (_class11 =class{constructor(t,r,n){;_class11.prototype.__init25.call(this);this.access=r;this._texture=n;this[_chunkODKBWWHUcjs.a]={unwrap:()=>(this._view||(this._view=this._texture[_chunkODKBWWHUcjs.a].unwrap().createView({label:`${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))} - View`,format:this._format,dimension:this.dimension})),this._view)},this[_chunkODKBWWHUcjs.b]=n,this.dimension=_nullishCoalesce(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _55 => _55.dimension]), () => (n.props.dimension)), () => ("2d")),this._format=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _56 => _56.format]), () => (n.props.format)),this.texelDataType=Xe[this._format]}__init25() {this.resourceType="texture-storage-view"}$name(t){return this._texture.$name(t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),{group:n,binding:a}=t.allocateFixedEntry({storageTexture:this._format,access:this.access,viewDimension:this.dimension},this),o=`texture_storage_${Ft[this.dimension]}`;return t.addDeclaration(`@group(${n}) @binding(${a}) var ${r}: ${o}<${this._format}, ${Pn[this.access]}>;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}}, _class11),vt= (_class12 =class{constructor(t,r,n,a){;_class12.prototype.__init26.call(this);this._format=t;this.dimension=r;this.access=n;this._membership=a;this[_chunkODKBWWHUcjs.a]={},this.texelDataType=Xe[this._format],_chunkODKBWWHUcjs.d.call(void 0, this,a.key)}__init26() {this.resourceType="texture-storage-view"}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout),a=`texture_storage_${Ft[this.dimension]}`;return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var ${r}: ${a}<${this._format}, ${Pn[this.access]}>;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}}, _class12),br= (_class13 =class{constructor(t,r){;_class13.prototype.__init27.call(this);this._props=t;this._texture=r;this[_chunkODKBWWHUcjs.a]={unwrap:()=>(this._view||(this._view=this._texture[_chunkODKBWWHUcjs.a].unwrap().createView({label:`${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))} - View`,...this._props})),this._view)},this[_chunkODKBWWHUcjs.b]=r,this.dimension=_nullishCoalesce(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _57 => _57.dimension]), () => (r.props.dimension)), () => ("2d")),this._format=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _58 => _58.format]), () => (r.props.format)),this.channelDataType=Un[this._format]}__init27() {this.resourceType="texture-sampled-view"}$name(t){return this._texture.$name(t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),n=(_nullishCoalesce(this._texture.props.sampleCount, () => (1)))>1,{group:a,binding:o}=t.allocateFixedEntry({texture:Bn[this.channelDataType.type],viewDimension:this.dimension,multisampled:n},this),s=n?"texture_multisampled_2d":`texture_${Ft[this.dimension]}`;return t.addDeclaration(`@group(${a}) @binding(${o}) var ${r}: ${s}<${t.resolve(this.channelDataType)}>;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}}, _class13),Dt= (_class14 =class{constructor(t,r,n,a){;_class14.prototype.__init28.call(this);this.dimension=r;this._multisampled=n;this._membership=a;this[_chunkODKBWWHUcjs.a]={},_chunkODKBWWHUcjs.d.call(void 0, this,a.key),this.channelDataType=Rn[t]}__init28() {this.resourceType="texture-sampled-view"}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout),a=this._multisampled?"texture_multisampled_2d":`texture_${Ft[this.dimension]}`;return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var ${r}: ${a}<${t.resolve(this.channelDataType)}>;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}}, _class14);function Sr(e){return!!_optionalChain([e, 'optionalAccess', _59 => _59.usableAsSampled])}function Fa(e){return!!_optionalChain([e, 'optionalAccess', _60 => _60.usableAsRender])}var At=class e extends Error{constructor(t){super(`Resource '${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, t), () => ("<unnamed>"))}' cannot be bound as 'sampled'. Use .$usage('sampled') to allow it.`),Object.setPrototypeOf(this,e.prototype)}};function It(e){return new Dr(e)}function Ut(e){return!!e&&e.resourceType==="bind-group-layout"}function Fr(e){return!!e&&e.resourceType==="bind-group"}var vr=class e extends Error{constructor(t,r){super(`Bind group '${_nullishCoalesce(t, () => ("<unnamed>"))}' is missing a required binding '${r}'`),Object.setPrototypeOf(this,e.prototype)}},Vn=["compute"],Ce=["compute","vertex","fragment"],Dr= (_class15 =class{constructor(t){;_class15.prototype.__init29.call(this);_class15.prototype.__init30.call(this);_class15.prototype.__init31.call(this);_class15.prototype.__init32.call(this);this.entries=t;let r=0;for(let[n,a]of Object.entries(t)){if(a===null){r++;continue}let o={layout:this,key:n,idx:r};if("uniform"in a&&(this.bound[n]=new Je("uniform",a.uniform,o)),"storage"in a){let s="type"in a.storage?a.storage:a.storage(0);this.bound[n]=new Je(_nullishCoalesce(a.access, () => ("readonly")),s,o)}"texture"in a&&(this.bound[n]=new Dt(a.texture,_nullishCoalesce(a.viewDimension, () => ("2d")),_nullishCoalesce(a.multisampled, () => (!1)),o)),"storageTexture"in a&&(this.bound[n]=new vt(a.storageTexture,_nullishCoalesce(a.viewDimension, () => ("2d")),_nullishCoalesce(a.access, () => ("writeonly")),o)),"externalTexture"in a&&(this.bound[n]=new St(o)),"sampler"in a&&(a.sampler==="comparison"?this.bound[n]=new bt(o):this.bound[n]=new wt(o)),"texture"in a||"storageTexture"in a||"externalTexture"in a||"sampler"in a?this.value[n]=this.bound[n]:Object.defineProperty(this.value,n,{get:()=>this.bound[n].value}),r++}}__init29() {this.resourceType="bind-group-layout"}__init30() {this.bound={}}__init31() {this.value={}}__init32() {this.$=this.value}toString(){return`bindGroupLayout:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}get index(){return this._index}$name(t){return _chunkODKBWWHUcjs.d.call(void 0, this,t),this}$idx(t){return this._index=t,this}unwrap(t){return t.device.createBindGroupLayout({label:_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>")),entries:Object.values(this.entries).map((n,a)=>{if(n===null)return null;let o=n.visibility,s={binding:a,visibility:0};if("uniform"in n)o=_nullishCoalesce(o, () => (Ce)),s.buffer={type:"uniform"};else if("storage"in n)o=_nullishCoalesce(o, () => ((n.access==="mutable"?Vn:Ce))),s.buffer={type:n.access==="mutable"?"storage":"read-only-storage"};else if("sampler"in n)o=_nullishCoalesce(o, () => (Ce)),s.sampler={type:n.sampler};else if("texture"in n)o=_nullishCoalesce(o, () => (Ce)),s.texture={sampleType:n.texture,viewDimension:_nullishCoalesce(n.viewDimension, () => ("2d")),multisampled:_nullishCoalesce(n.multisampled, () => (!1))};else if("storageTexture"in n){let i=_nullishCoalesce(n.access, () => ("writeonly"));o=_nullishCoalesce(o, () => ((i==="readonly"?Ce:Vn))),s.storageTexture={format:n.storageTexture,access:{mutable:"read-write",readonly:"read-only",writeonly:"write-only"}[i],viewDimension:_nullishCoalesce(n.viewDimension, () => ("2d"))}}else"externalTexture"in n&&(o=_nullishCoalesce(o, () => (Ce)),s.externalTexture={});return _optionalChain([o, 'optionalAccess', _61 => _61.includes, 'call', _62 => _62("compute")])&&(s.visibility|=GPUShaderStage.COMPUTE),_optionalChain([o, 'optionalAccess', _63 => _63.includes, 'call', _64 => _64("vertex")])&&(s.visibility|=GPUShaderStage.VERTEX),_optionalChain([o, 'optionalAccess', _65 => _65.includes, 'call', _66 => _66("fragment")])&&(s.visibility|=GPUShaderStage.FRAGMENT),s}).filter(n=>n!==null)})}}, _class15),Pe= (_class16 =class{constructor(t,r){;_class16.prototype.__init33.call(this);this.layout=t;this.entries=r;for(let n of Object.keys(t.entries))if(t.entries[n]!==null&&!(n in r))throw new vr(_chunkODKBWWHUcjs.c.call(void 0, t),n)}__init33() {this.resourceType="bind-group"}unwrap(t){return t.device.createBindGroup({label:_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this.layout), () => ("<unnamed>")),layout:t.unwrap(this.layout),entries:Object.entries(this.layout.entries).map(([n,a],o)=>{if(a===null)return null;let s=this.entries[n];if(s===void 0)throw new Error(`'${n}' is a resource required to populate bind group layout '${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this.layout), () => ("<unnamed>"))}'.`);if("uniform"in a){let i;if(ae(s)){if(!xt(s))throw new (0, _chunkODKBWWHUcjs.i)(s);i={buffer:t.unwrap(s)}}else i={buffer:s};return{binding:o,resource:i}}if("storage"in a){let i;if(ae(s)){if(!xe(s))throw new He(s);i={buffer:t.unwrap(s)}}else i={buffer:s};return{binding:o,resource:i}}if("texture"in a){let i;if(X(s)){if(!Sr(s))throw new At(s);i=t.unwrap(s.createView("sampled"))}else et(s)?i=t.unwrap(s):i=s;return{binding:o,resource:i}}if("storageTexture"in a){let i;if(X(s)){if(!xe(s))throw new He(s);a.access==="readonly"?i=t.unwrap(s.createView("readonly")):a.access==="mutable"?i=t.unwrap(s.createView("mutable")):i=t.unwrap(s.createView("writeonly"))}else Ze(s)?i=t.unwrap(s):i=s;return{binding:o,resource:i}}if("sampler"in a)return Ye(s)||Qe(s)?{binding:o,resource:t.unwrap(s)}:{binding:o,resource:s};if("externalTexture"in a)return{binding:o,resource:s};throw new Error(`Malformed bind group entry: ${s} (${JSON.stringify(s)})`)}).filter(n=>n!==null)})}}, _class16);var _tinyest = require('tinyest'); var Aa = _interopRequireWildcard(_tinyest);var{NodeTypeCatalog:v}=Aa,Ia=["==","!=","<","<=",">",">=","<<",">>","+","-","*","/","%","|","^","&","&&","||"],Ua=["&&","||","==","!=","<","<=",">",">="];function $n(e,t,r){return r?Ua.includes(t)?_chunkODKBWWHUcjs.Q:t==="="?r:e:t==="!"||t==="~"?_chunkODKBWWHUcjs.Q:e}function Ba(e){throw new Error(`'${JSON.stringify(e)}' was not handled by the WGSL generator.`)}function kn(e,t){return{value:t?"true":"false",dataType:_chunkODKBWWHUcjs.Q}}function En(e,[t,r]){e.pushBlockScope();try{return`${e.indent()}{
|
19
|
-
${r.map(n=>
|
14
|
+
`),r}function qa(e,t){let r=e.resolve(t.elementType);return t.elementCount===0?`array<${r}>`:`array<${r}, ${t.elementCount}>`}function Qa(e,t){let r=e.resolve(Qe(t.elementType)?_chunkBZVU4Q6Acjs.b[t.elementType.format]:t.elementType);return t.elementCount===0?`array<${r}>`:`array<${r}, ${t.elementCount}>`}function fr(e,t){if(_chunkBJSN5UVVcjs.W.call(void 0, t))return t.type==="unstruct"?za(e,t):t.type==="disarray"?Qa(e,t):t.type==="loose-decorated"?e.resolve(Qe(t.inner)?_chunkBZVU4Q6Acjs.b[t.inner.format]:t.inner):e.resolve(_chunkBZVU4Q6Acjs.b[t.type]);if(Na(t))return t.type;if(t.type==="struct")return ja(e,t);if(t.type==="array")return qa(e,t);if(t.type==="atomic")return`atomic<${fr(e,t.inner)}>`;if(t.type==="decorated")return e.resolve(t.inner);if(t.type==="ptr")return t.addressSpace==="storage"?`ptr<storage, ${e.resolve(t.inner)}, ${t.access==="read-write"?"read_write":t.access}>`:`ptr<${t.addressSpace}, ${e.resolve(t.inner)}>`;if(t.type==="abstractInt"||t.type==="abstractFloat")throw new Error("Abstract types have no concrete representation in WGSL");if(t.type==="void")throw new Error("Void has no representation in WGSL");dt(t,"resolveData")}var _typedbinary = require('typed-binary');function Ka(e,t){let r="size"in e?e.size:e.currentByteOffset,n=t-1,a=r&n;"skipBytes"in e?e.skipBytes(t-a&n):e.add(t-a&n)}var B=Ka;var Ln=new WeakMap;function Tt(e){let t=Ln.get(e);if(t)return t;let r=new _typedbinary.Measurer,n={},a;for(let o in e.propTypes){let i=e.propTypes[o];if(i===void 0)throw new Error(`Property ${o} is undefined in struct`);let s=r.size;B(r,_chunkBJSN5UVVcjs.Y.call(void 0, e)?_chunkBZVU4Q6Acjs.T.call(void 0, i):_chunkBZVU4Q6Acjs.S.call(void 0, i)),a&&(a.padding=r.size-s);let l=_chunkBZVU4Q6Acjs.V.call(void 0, i);n[o]={offset:r.size,size:l},a=n[o],r.add(l)}return a&&(a.padding=_chunkBZVU4Q6Acjs.a.call(void 0, _chunkBZVU4Q6Acjs.V.call(void 0, e),_chunkBZVU4Q6Acjs.S.call(void 0, e))-r.size),Ln.set(e,n),n}var ht=(()=>{try{return new Function("return true"),!0}catch (e2){return!1}})(),cr=new WeakMap,gr={u32:"u32",vec2u:"u32",vec3u:"u32",vec4u:"u32",i32:"i32",vec2i:"i32",vec3i:"i32",vec4i:"i32",f32:"f32",vec2f:"f32",vec3f:"f32",vec4f:"f32",vec2h:"f32",vec3h:"f32",vec4h:"f32",mat2x2f:"f32",mat3x3f:"f32",mat4x4f:"f32"},yr={u32:"setUint32",i32:"setInt32",f32:"setFloat32"};function xt(e,t,r){if(_chunkBJSN5UVVcjs.O.call(void 0, e)||_chunkBJSN5UVVcjs.U.call(void 0, e))return xt(e.inner,t,r);if(_chunkBJSN5UVVcjs.M.call(void 0, e)||_chunkBJSN5UVVcjs.Y.call(void 0, e)){let a=Tt(e),o=Object.entries(a).sort((s,l)=>s[1].offset-l[1].offset),i="";for(let[s,l]of o){let u=e.propTypes[s];u&&(i+=xt(u,`(${t} + ${l.offset})`,`${r}.${s}`))}return i}if(_chunkBJSN5UVVcjs.L.call(void 0, e)||_chunkBJSN5UVVcjs.X.call(void 0, e)){let a=e,o=_chunkBZVU4Q6Acjs.a.call(void 0, _chunkBZVU4Q6Acjs.V.call(void 0, a.elementType),_chunkBZVU4Q6Acjs.S.call(void 0, a.elementType)),i="";return i+=`for (let i = 0; i < ${a.elementCount}; i++) {
|
15
|
+
`,i+=xt(a.elementType,`(${t} + i * ${o})`,`${r}[i]`),i+=`}
|
16
|
+
`,i}if(_chunkBJSN5UVVcjs.E.call(void 0, e)){let a=gr[e.type],o="",i=yr[a],s=["x","y","z","w"],l=_chunkBJSN5UVVcjs.C.call(void 0, e)?2:_chunkBJSN5UVVcjs.D.call(void 0, e)?3:4;for(let u=0;u<l;u++)o+=`output.${i}((${t} + ${u*4}), ${r}.${s[u]}, littleEndian);
|
17
|
+
`;return o}if(_chunkBJSN5UVVcjs.I.call(void 0, e)){let a=gr[e.type],o=yr[a],i=_chunkBJSN5UVVcjs.G.call(void 0, e)?2:_chunkBJSN5UVVcjs.H.call(void 0, e)?3:4,s=i*i,l=_chunkBZVU4Q6Acjs.a.call(void 0, i*4,8),u="";for(let c=0;c<s;c++){let m=Math.floor(c/i),g=c%i,T=m*l+g*4;u+=`output.${o}((${t} + ${T}), ${r}.columns[${m}].${["x","y","z","w"][g]}, littleEndian);
|
18
|
+
`}return u}let n=gr[e.type];return`output.${yr[n]}(${t}, ${r}, littleEndian);
|
19
|
+
`}function wt(e){if(cr.has(e))return cr.get(e);let t=xt(e,"offset","value"),r=new Function("output","offset","value","littleEndian=true",t);return cr.set(e,r),r}var Ce={bool(){throw new Error("Booleans are not host-shareable")},f32(e,t,r){e.writeFloat32(r)},f16(e,t,r){e.writeFloat16(r)},i32(e,t,r){e.writeInt32(r)},u32(e,t,r){e.writeUint32(r)},vec2f(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y)},vec2h(e,t,r){e.writeFloat16(r.x),e.writeFloat16(r.y)},vec2i(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y)},vec2u(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y)},"vec2<bool>"(){throw new Error("Booleans are not host-shareable")},vec3f(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y),e.writeFloat32(r.z)},vec3h(e,t,r){e.writeFloat16(r.x),e.writeFloat16(r.y),e.writeFloat16(r.z)},vec3i(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y),e.writeInt32(r.z)},vec3u(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y),e.writeUint32(r.z)},"vec3<bool>"(){throw new Error("Booleans are not host-shareable")},vec4f(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y),e.writeFloat32(r.z),e.writeFloat32(r.w)},vec4h(e,t,r){e.writeFloat16(r.x),e.writeFloat16(r.y),e.writeFloat16(r.z),e.writeFloat16(r.w)},vec4i(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y),e.writeInt32(r.z),e.writeInt32(r.w)},vec4u(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y),e.writeUint32(r.z),e.writeUint32(r.w)},"vec4<bool>"(){throw new Error("Booleans are not host-shareable")},mat2x2f(e,t,r){for(let n=0;n<r.length;++n)e.writeFloat32(r[n])},mat3x3f(e,t,r){for(let n=0;n<r.length;++n)e.writeFloat32(r[n])},mat4x4f(e,t,r){for(let n=0;n<r.length;++n)e.writeFloat32(r[n])},struct(e,t,r){let n=_chunkBZVU4Q6Acjs.S.call(void 0, t);B(e,n);for(let[a,o]of Object.entries(t.propTypes))B(e,_chunkBZVU4Q6Acjs.S.call(void 0, o)),ue(e,o,r[a]);B(e,n)},array(e,t,r){if(t.elementCount===0)throw new Error("Cannot write using a runtime-sized schema.");let n=_chunkBZVU4Q6Acjs.S.call(void 0, t);B(e,n);let a=e.currentByteOffset;for(let o=0;o<Math.min(t.elementCount,r.length);o++)B(e,n),ue(e,t.elementType,r[o]);e.seekTo(a+_chunkBZVU4Q6Acjs.V.call(void 0, t))},ptr(){throw new Error("Pointers are not host-shareable")},atomic(e,t,r){_optionalChain([Ce, 'access', _29 => _29[t.inner.type], 'optionalCall', _30 => _30(e,t,r)])},decorated(e,t,r){let n=_chunkBZVU4Q6Acjs.T.call(void 0, t);B(e,n);let a=e.currentByteOffset;_optionalChain([Ce, 'access', _31 => _31[_optionalChain([t, 'access', _32 => _32.inner, 'optionalAccess', _33 => _33.type])], 'optionalCall', _34 => _34(e,t.inner,r)]),e.seekTo(a+_chunkBZVU4Q6Acjs.V.call(void 0, t))},uint8(e,t,r){e.writeUint8(r)},uint8x2(e,t,r){e.writeUint8(r.x),e.writeUint8(r.y)},uint8x4(e,t,r){e.writeUint8(r.x),e.writeUint8(r.y),e.writeUint8(r.z),e.writeUint8(r.w)},sint8(e,t,r){e.writeInt8(r)},sint8x2(e,t,r){e.writeInt8(r.x),e.writeInt8(r.y)},sint8x4(e,t,r){e.writeInt8(r.x),e.writeInt8(r.y),e.writeInt8(r.z),e.writeInt8(r.w)},unorm8(e,t,r){e.writeUint8(r*255)},unorm8x2(e,t,r){e.writeUint8(r.x*255),e.writeUint8(r.y*255)},unorm8x4(e,t,r){e.writeUint8(r.x*255),e.writeUint8(r.y*255),e.writeUint8(r.z*255),e.writeUint8(r.w*255)},snorm8(e,t,r){e.writeUint8(r*127+128)},snorm8x2(e,t,r){e.writeUint8(r.x*127+128),e.writeUint8(r.y*127+128)},snorm8x4(e,t,r){e.writeUint8(r.x*127+128),e.writeUint8(r.y*127+128),e.writeUint8(r.z*127+128),e.writeUint8(r.w*127+128)},uint16(e,t,r){e.writeUint16(r)},uint16x2(e,t,r){e.writeUint16(r.x),e.writeUint16(r.y)},uint16x4(e,t,r){e.writeUint16(r.x),e.writeUint16(r.y),e.writeUint16(r.z),e.writeUint16(r.w)},sint16(e,t,r){e.writeInt16(r)},sint16x2(e,t,r){e.writeInt16(r.x),e.writeInt16(r.y)},sint16x4(e,t,r){e.writeInt16(r.x),e.writeInt16(r.y),e.writeInt16(r.z),e.writeInt16(r.w)},unorm16(e,t,r){e.writeUint16(r*65535)},unorm16x2(e,t,r){e.writeUint16(r.x*65535),e.writeUint16(r.y*65535)},unorm16x4(e,t,r){e.writeUint16(r.x*65535),e.writeUint16(r.y*65535),e.writeUint16(r.z*65535),e.writeUint16(r.w*65535)},snorm16(e,t,r){e.writeUint16(r*32767+32768)},snorm16x2(e,t,r){e.writeUint16(r.x*32767+32768),e.writeUint16(r.y*32767+32768)},snorm16x4(e,t,r){e.writeUint16(r.x*32767+32768),e.writeUint16(r.y*32767+32768),e.writeUint16(r.z*32767+32768),e.writeUint16(r.w*32767+32768)},float16(e,t,r){e.writeFloat16(r)},float16x2(e,t,r){e.writeFloat16(r.x),e.writeFloat16(r.y)},float16x4(e,t,r){e.writeFloat16(r.x),e.writeFloat16(r.y),e.writeFloat16(r.z),e.writeFloat16(r.w)},float32(e,t,r){e.writeFloat32(r)},float32x2(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y)},float32x3(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y),e.writeFloat32(r.z)},float32x4(e,t,r){e.writeFloat32(r.x),e.writeFloat32(r.y),e.writeFloat32(r.z),e.writeFloat32(r.w)},uint32(e,t,r){e.writeUint32(r)},uint32x2(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y)},uint32x3(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y),e.writeUint32(r.z)},uint32x4(e,t,r){e.writeUint32(r.x),e.writeUint32(r.y),e.writeUint32(r.z),e.writeUint32(r.w)},sint32(e,t,r){e.writeInt32(r)},sint32x2(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y)},sint32x3(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y),e.writeInt32(r.z)},sint32x4(e,t,r){e.writeInt32(r.x),e.writeInt32(r.y),e.writeInt32(r.z),e.writeInt32(r.w)},"unorm10-10-10-2"(e,t,r){let n=0;n|=(r.x*1023&1023)<<22,n|=(r.x*1023&1023)<<12,n|=(r.y*1023&1023)<<2,n|=r.z*3&3,e.writeUint32(n)},"unorm8x4-bgra"(e,t,r){e.writeUint8(r.z*255),e.writeUint8(r.y*255),e.writeUint8(r.x*255),e.writeUint8(r.w*255)},disarray(e,t,r){let n=_chunkBZVU4Q6Acjs.S.call(void 0, t);B(e,n);let a=e.currentByteOffset;for(let o=0;o<Math.min(t.elementCount,r.length);o++)B(e,n),_optionalChain([Ce, 'access', _35 => _35[_optionalChain([t, 'access', _36 => _36.elementType, 'optionalAccess', _37 => _37.type])], 'optionalCall', _38 => _38(e,t.elementType,r[o])]);e.seekTo(a+_chunkBZVU4Q6Acjs.V.call(void 0, t))},unstruct(e,t,r){for(let[n,a]of Object.entries(t.propTypes))_optionalChain([Ce, 'access', _39 => _39[a.type], 'optionalCall', _40 => _40(e,a,r[n])])},"loose-decorated"(e,t,r){let n=_chunkBZVU4Q6Acjs.T.call(void 0, t);B(e,n);let a=e.currentByteOffset,o=Ce[_optionalChain([t, 'access', _41 => _41.inner, 'optionalAccess', _42 => _42.type])];return _optionalChain([o, 'optionalCall', _43 => _43(e,t.inner,r)]),e.seekTo(a+_chunkBZVU4Q6Acjs.V.call(void 0, t)),r}};function ue(e,t,r){let n=Ce[t.type];if(!n)throw new Error(`Cannot write data of type '${t.type}'.`);n(e,t,r)}var xe={bool(){throw new Error("Booleans are not host-shareable")},f32(e){return e.readFloat32()},f16(e){return e.readFloat16()},i32(e){return e.readInt32()},u32(e){return e.readUint32()},vec2f(e){return _chunkBJSN5UVVcjs.oa.call(void 0, e.readFloat32(),e.readFloat32())},vec3f(e){return _chunkBJSN5UVVcjs.ta.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32())},vec4f(e){return _chunkBJSN5UVVcjs.ya.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32())},vec2h(e){return _chunkBJSN5UVVcjs.pa.call(void 0, e.readFloat16(),e.readFloat16())},vec3h(e){return _chunkBJSN5UVVcjs.ua.call(void 0, e.readFloat16(),e.readFloat16(),e.readFloat16())},vec4h(e){return _chunkBJSN5UVVcjs.za.call(void 0, e.readFloat16(),e.readFloat16(),e.readFloat16(),e.readFloat16())},vec2i(e){return _chunkBJSN5UVVcjs.qa.call(void 0, e.readInt32(),e.readInt32())},vec3i(e){return _chunkBJSN5UVVcjs.va.call(void 0, e.readInt32(),e.readInt32(),e.readInt32())},vec4i(e){return _chunkBJSN5UVVcjs.Aa.call(void 0, e.readInt32(),e.readInt32(),e.readInt32(),e.readInt32())},vec2u(e){return _chunkBJSN5UVVcjs.ra.call(void 0, e.readUint32(),e.readUint32())},vec3u(e){return _chunkBJSN5UVVcjs.wa.call(void 0, e.readUint32(),e.readUint32(),e.readUint32())},vec4u(e){return _chunkBJSN5UVVcjs.Ba.call(void 0, e.readUint32(),e.readUint32(),e.readUint32(),e.readUint32())},"vec2<bool>"(){throw new Error("Booleans are not host-shareable")},"vec3<bool>"(){throw new Error("Booleans are not host-shareable")},"vec4<bool>"(){throw new Error("Booleans are not host-shareable")},mat2x2f(e){return _chunkBJSN5UVVcjs.Ma.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32())},mat3x3f(e){let t=()=>{let r=e.readFloat32();return e.readFloat32(),r};return _chunkBJSN5UVVcjs.Na.call(void 0, e.readFloat32(),e.readFloat32(),t(),e.readFloat32(),e.readFloat32(),t(),e.readFloat32(),e.readFloat32(),t())},mat4x4f(e){return _chunkBJSN5UVVcjs.Oa.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32())},struct(e,t){let r=_chunkBZVU4Q6Acjs.S.call(void 0, t);B(e,r);let n={};for(let[a,o]of Object.entries(t.propTypes))B(e,_chunkBZVU4Q6Acjs.S.call(void 0, o)),n[a]=N(e,o);return B(e,r),n},array(e,t){if(t.elementCount===0)throw new Error("Cannot read using a runtime-sized schema.");let r=_chunkBZVU4Q6Acjs.S.call(void 0, t),n=[];for(let a=0;a<t.elementCount;a++){B(e,r);let o=t.elementType,i=N(e,o);n.push(i)}return B(e,r),n},ptr(){throw new Error("Pointers are not host-shareable")},atomic(e,t){return N(e,t.inner)},decorated(e,t){let r=_chunkBZVU4Q6Acjs.T.call(void 0, t);B(e,r);let n=e.currentByteOffset,a=N(e,t.inner);return e.seekTo(n+_chunkBZVU4Q6Acjs.V.call(void 0, t)),a},uint8:e=>e.readUint8(),uint8x2:e=>_chunkBJSN5UVVcjs.ra.call(void 0, e.readUint8(),e.readUint8()),uint8x4:e=>_chunkBJSN5UVVcjs.Ba.call(void 0, e.readUint8(),e.readUint8(),e.readUint8(),e.readUint8()),sint8:e=>e.readInt8(),sint8x2:e=>_chunkBJSN5UVVcjs.qa.call(void 0, e.readInt8(),e.readInt8()),sint8x4:e=>_chunkBJSN5UVVcjs.Aa.call(void 0, e.readInt8(),e.readInt8(),e.readInt8(),e.readInt8()),unorm8:e=>e.readUint8()/255,unorm8x2:e=>_chunkBJSN5UVVcjs.oa.call(void 0, e.readUint8()/255,e.readUint8()/255),unorm8x4:e=>_chunkBJSN5UVVcjs.ya.call(void 0, e.readUint8()/255,e.readUint8()/255,e.readUint8()/255,e.readUint8()/255),snorm8:e=>(e.readUint8()-128)/127,snorm8x2:e=>_chunkBJSN5UVVcjs.oa.call(void 0, (e.readUint8()-128)/127,(e.readUint8()-128)/127),snorm8x4:e=>_chunkBJSN5UVVcjs.ya.call(void 0, (e.readUint8()-128)/127,(e.readUint8()-128)/127,(e.readUint8()-128)/127,(e.readUint8()-128)/127),uint16:e=>e.readUint16(),uint16x2:e=>_chunkBJSN5UVVcjs.ra.call(void 0, e.readUint16(),e.readUint16()),uint16x4:e=>_chunkBJSN5UVVcjs.Ba.call(void 0, e.readUint16(),e.readUint16(),e.readUint16(),e.readUint16()),sint16:e=>e.readInt16(),sint16x2:e=>_chunkBJSN5UVVcjs.qa.call(void 0, e.readInt16(),e.readInt16()),sint16x4:e=>_chunkBJSN5UVVcjs.Aa.call(void 0, e.readInt16(),e.readInt16(),e.readInt16(),e.readInt16()),unorm16:e=>e.readUint16()/65535,unorm16x2:e=>_chunkBJSN5UVVcjs.oa.call(void 0, e.readUint16()/65535,e.readUint16()/65535),unorm16x4:e=>_chunkBJSN5UVVcjs.ya.call(void 0, e.readUint16()/65535,e.readUint16()/65535,e.readUint16()/65535,e.readUint16()/65535),snorm16:e=>(e.readUint16()-32768)/32767,snorm16x2:e=>_chunkBJSN5UVVcjs.oa.call(void 0, xe.snorm16(e),xe.snorm16(e)),snorm16x4:e=>_chunkBJSN5UVVcjs.ya.call(void 0, xe.snorm16(e),xe.snorm16(e),xe.snorm16(e),xe.snorm16(e)),float16(e){return e.readFloat16()},float16x2:e=>_chunkBJSN5UVVcjs.oa.call(void 0, e.readFloat16(),e.readFloat16()),float16x4:e=>_chunkBJSN5UVVcjs.ya.call(void 0, e.readFloat16(),e.readFloat16(),e.readFloat16(),e.readFloat16()),float32:e=>e.readFloat32(),float32x2:e=>_chunkBJSN5UVVcjs.oa.call(void 0, e.readFloat32(),e.readFloat32()),float32x3:e=>_chunkBJSN5UVVcjs.ta.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32()),float32x4:e=>_chunkBJSN5UVVcjs.ya.call(void 0, e.readFloat32(),e.readFloat32(),e.readFloat32(),e.readFloat32()),uint32:e=>e.readUint32(),uint32x2:e=>_chunkBJSN5UVVcjs.ra.call(void 0, e.readUint32(),e.readUint32()),uint32x3:e=>_chunkBJSN5UVVcjs.wa.call(void 0, e.readUint32(),e.readUint32(),e.readUint32()),uint32x4:e=>_chunkBJSN5UVVcjs.Ba.call(void 0, e.readUint32(),e.readUint32(),e.readUint32(),e.readUint32()),sint32:e=>e.readInt32(),sint32x2:e=>_chunkBJSN5UVVcjs.qa.call(void 0, e.readInt32(),e.readInt32()),sint32x3:e=>_chunkBJSN5UVVcjs.va.call(void 0, e.readInt32(),e.readInt32(),e.readInt32()),sint32x4:e=>_chunkBJSN5UVVcjs.Aa.call(void 0, e.readInt32(),e.readInt32(),e.readInt32(),e.readInt32()),"unorm10-10-10-2"(e){let t=e.readUint32(),r=(t>>22)/1023,n=(t>>12&1023)/1023,a=(t>>2&1023)/1023,o=(t&3)/3;return _chunkBJSN5UVVcjs.ya.call(void 0, r,n,a,o)},"unorm8x4-bgra"(e){let t=e.readByte()/255,r=e.readByte()/255,n=e.readByte()/255,a=e.readByte()/255;return _chunkBJSN5UVVcjs.ya.call(void 0, n,r,t,a)},unstruct(e,t){let r={};for(let[n,a]of Object.entries(t.propTypes))r[n]=N(e,a);return r},disarray(e,t){let r=_chunkBZVU4Q6Acjs.S.call(void 0, t),n=[];for(let a=0;a<t.elementCount;a++)B(e,r),n.push(N(e,t.elementType));return B(e,r),n},"loose-decorated"(e,t){B(e,_chunkBZVU4Q6Acjs.T.call(void 0, t));let r=e.currentByteOffset,n=N(e,t.inner);return e.seekTo(r+_chunkBZVU4Q6Acjs.V.call(void 0, t)),n}};function N(e,t){let r=xe[t.type];if(!r)throw new Error(`Cannot read data of type '${t.type}'.`);return r(e,t)}function On(e,t){let r=_chunkBZVU4Q6Acjs.V.call(void 0, e);if(r===0||t===void 0||t===null)return[];let n=new ArrayBuffer(r),a=new (0, _typedbinary.BufferWriter)(n),o=[];function i(u,c,m,g){if(c!=null){if(_chunkBJSN5UVVcjs.M.call(void 0, u)||_chunkBJSN5UVVcjs.Y.call(void 0, u)){let T=Tt(u);for(let[x,y]of Object.entries(T)){let F=u.propTypes[x];if(!F)continue;let U=c[x];U!==void 0&&i(F,U,m+y.offset,_nullishCoalesce(y.padding, () => (g)))}return}if(_chunkBJSN5UVVcjs.L.call(void 0, u)||_chunkBJSN5UVVcjs.X.call(void 0, u)){let T=u,x=_chunkBZVU4Q6Acjs.a.call(void 0, _chunkBZVU4Q6Acjs.V.call(void 0, T.elementType),_chunkBZVU4Q6Acjs.S.call(void 0, T.elementType));if(!Array.isArray(c))throw new Error("Partial value for array must be an array");let y=_nullishCoalesce(c, () => ([]));y.sort((F,U)=>F.idx-U.idx);for(let{idx:F,value:U}of y)i(T.elementType,U,m+F*x,x-_chunkBZVU4Q6Acjs.V.call(void 0, T.elementType))}else{let T=_chunkBZVU4Q6Acjs.V.call(void 0, u);a.seekTo(m),ue(a,u,c),o.push({start:m,end:m+T,padding:g})}}}if(i(e,t,0),o.length===0)return[];let s=[],l=o[0];for(let u=1;u<o.length;u++){let c=o[u];if(!c||!l)throw new Error("Internal error: missing segment");c.start===l.end+(_nullishCoalesce(l.padding, () => (0)))?(l.end=c.end,l.padding=c.padding):(s.push({data:new Uint8Array(n,l.start,l.end-l.start)}),l=c)}if(!l)throw new Error("Internal error: missing segment");return s.push({data:new Uint8Array(n,l.start,l.end-l.start)}),s}function he(e){return!!_optionalChain([e, 'optionalAccess', _44 => _44.usableAsStorage])}var Ke=class e extends Error{constructor(t){super(`Resource '${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, t), () => ("<unnamed>"))}' cannot be bound as 'storage'. Use .$usage('storage') to allow it.`),Object.setPrototypeOf(this,e.prototype)}};function bt(e){return!!e.usableAsUniform}var jn={uniform:"uniform",mutable:"storage, read_write",readonly:"storage, read"},He= (_class4 =class{constructor(t,r){;_class4.prototype.__init4.call(this);this.usage=t;this.buffer=r;this[_chunkBJSN5UVVcjs.a]={dataType:r.dataType},this[_chunkBJSN5UVVcjs.d]=r}__init4() {this.resourceType="buffer-usage"}$name(t){return this.buffer.$name(t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),{group:n,binding:a}=t.allocateFixedEntry(this.usage==="uniform"?{uniform:this.buffer.dataType}:{storage:this.buffer.dataType,access:this.usage},this.buffer),o=jn[this.usage];return t.addDeclaration(`@group(${n}) @binding(${a}) var<${o}> ${r}: ${t.resolve(this.buffer.dataType)};`),r}write(t){this.buffer.write(t)}toString(){return`${this.usage}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}[_chunkBJSN5UVVcjs.c](){return new Proxy({"~resolve":t=>t.resolve(this),toString:()=>`.value:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`,[_chunkBJSN5UVVcjs.b]:this.buffer.dataType},K)}get value(){if(!_chunkBJSN5UVVcjs.v.call(void 0, ))throw new Error("Cannot access buffer's value directly in JS.");return this[_chunkBJSN5UVVcjs.c]()}}, _class4),Je= (_class5 =class{constructor(t,r,n){;_class5.prototype.__init5.call(this);this.usage=t;this.dataType=r;this._membership=n;this[_chunkBJSN5UVVcjs.a]={dataType:r},_chunkBJSN5UVVcjs.f.call(void 0, this,n.key)}__init5() {this.resourceType="buffer-usage"}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout),a=jn[this.usage];return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var<${a}> ${r}: ${t.resolve(this.dataType)};`),r}toString(){return`${this.usage}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}[_chunkBJSN5UVVcjs.c](){return new Proxy({"~resolve":t=>t.resolve(this),toString:()=>`.value:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`,[_chunkBJSN5UVVcjs.b]:this.dataType},K)}get value(){if(!_chunkBJSN5UVVcjs.v.call(void 0, ))throw new Error("Cannot access buffer's value directly in JS.");return this[_chunkBJSN5UVVcjs.c]()}}, _class5),Wn=new WeakMap;function Tr(e){if(!he(e))throw new Error(`Cannot pass ${e} to asMutable, as it is not allowed to be used as storage. To allow it, call .$usage('storage') when creating the buffer.`);let t=Wn.get(e);return t||(t=new He("mutable",e),Wn.set(e,t)),t}var Mn=new WeakMap;function xr(e){if(!he(e))throw new Error(`Cannot pass ${e} to asReadonly, as it is not allowed to be used as storage. To allow it, call .$usage('storage') when creating the buffer.`);let t=Mn.get(e);return t||(t=new He("readonly",e),Mn.set(e,t)),t}var Nn=new WeakMap;function hr(e){if(!bt(e))throw new Error(`Cannot pass ${e} to asUniform, as it is not allowed to be used as a uniform. To allow it, call .$usage('uniform') when creating the buffer.`);let t=Nn.get(e);return t||(t=new He("uniform",e),Nn.set(e,t)),t}var Za={uniform:hr,mutable:Tr,readonly:xr};function qn(e,t,r){return _chunkBJSN5UVVcjs.K.call(void 0, t)?new St(e,t,r):new St(e,t,r,["storage","uniform"])}function pe(e){return e.resourceType==="buffer"}function eo(e){return!!e.usableAsVertex}var zn=_typedbinary.getSystemEndianness.call(void 0, ),St= (_class6 =class{constructor(t,r,n,a){;_class6.prototype.__init6.call(this);_class6.prototype.__init7.call(this);_class6.prototype.__init8.call(this);_class6.prototype.__init9.call(this);_class6.prototype.__init10.call(this);_class6.prototype.__init11.call(this);_class6.prototype.__init12.call(this);this._group=t;this.dataType=r;this.initialOrBuffer=n;this._disallowedUsages=a;bn(n)?(this._ownBuffer=!1,this._buffer=n):(this._ownBuffer=!0,this.initial=n)}__init6() {this.resourceType="buffer"}__init7() {this.flags=GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC}__init8() {this._buffer=null}__init9() {this._destroyed=!1}__init10() {this.usableAsUniform=!1}__init11() {this.usableAsStorage=!1}__init12() {this.usableAsVertex=!1}get buffer(){let t=this._group.device;if(this._destroyed)throw new Error("This buffer has been destroyed");if(!this._buffer&&(this._buffer=t.createBuffer({size:_chunkBZVU4Q6Acjs.V.call(void 0, this.dataType),usage:this.flags,mappedAtCreation:!!this.initial,label:_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}),this.initial)){let r=new (0, _typedbinary.BufferWriter)(this._buffer.getMappedRange());ue(r,this.dataType,this.initial),this._buffer.unmap()}return this._buffer}get destroyed(){return this._destroyed}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this._buffer&&(this._buffer.label=t),this}$usage(...t){for(let r of t){if(_optionalChain([this, 'access', _45 => _45._disallowedUsages, 'optionalAccess', _46 => _46.includes, 'call', _47 => _47(r)]))throw new Error(`Buffer of type ${this.dataType.type} cannot be used as ${r}`);this.flags|=r==="uniform"?GPUBufferUsage.UNIFORM:0,this.flags|=r==="storage"?GPUBufferUsage.STORAGE:0,this.flags|=r==="vertex"?GPUBufferUsage.VERTEX:0,this.usableAsUniform=this.usableAsUniform||r==="uniform",this.usableAsStorage=this.usableAsStorage||r==="storage",this.usableAsVertex=this.usableAsVertex||r==="vertex"}return this}$addFlags(t){if(!this._ownBuffer)throw new Error("Cannot add flags to a buffer that is not managed by TypeGPU.");return t&GPUBufferUsage.MAP_READ?(this.flags=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this):t&GPUBufferUsage.MAP_WRITE?(this.flags=GPUBufferUsage.COPY_SRC|GPUBufferUsage.MAP_WRITE,this):(this.flags|=t,this)}compileWriter(){if(ht)wt(this.dataType);else throw new Error("This environment does not allow eval")}write(t){let r=this.buffer,n=this._group.device;if(r.mapState==="mapped"){let o=r.getMappedRange();if(ht){wt(this.dataType)(new DataView(o),0,t,zn==="little");return}ue(new (0, _typedbinary.BufferWriter)(o),this.dataType,t);return}let a=_chunkBZVU4Q6Acjs.V.call(void 0, this.dataType);this._hostBuffer||(this._hostBuffer=new ArrayBuffer(a)),this._group.flush(),ht?wt(this.dataType)(new DataView(this._hostBuffer),0,t,zn==="little"):ue(new (0, _typedbinary.BufferWriter)(this._hostBuffer),this.dataType,t),n.queue.writeBuffer(r,0,this._hostBuffer,0,a)}writePartial(t){let r=this.buffer,n=this._group.device,a=On(this.dataType,t);if(r.mapState==="mapped"){let o=r.getMappedRange(),i=new Uint8Array(o);for(let s of a)i.set(s.data,s.data.byteOffset)}else for(let o of a)n.queue.writeBuffer(r,o.data.byteOffset,o.data,0,o.data.byteLength)}copyFrom(t){if(this.buffer.mapState==="mapped")throw new Error("Cannot copy to a mapped buffer.");let r=_chunkBZVU4Q6Acjs.V.call(void 0, this.dataType);this._group.commandEncoder.copyBufferToBuffer(t.buffer,0,this.buffer,0,r)}async read(){this._group.flush();let t=this.buffer,r=this._group.device;if(t.mapState==="mapped"){let i=t.getMappedRange();return N(new (0, _typedbinary.BufferReader)(i),this.dataType)}if(t.usage&GPUBufferUsage.MAP_READ){await t.mapAsync(GPUMapMode.READ);let i=t.getMappedRange(),s=N(new (0, _typedbinary.BufferReader)(i),this.dataType);return t.unmap(),s}let n=r.createBuffer({size:_chunkBZVU4Q6Acjs.V.call(void 0, this.dataType),usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),a=r.createCommandEncoder();a.copyBufferToBuffer(t,0,n,0,_chunkBZVU4Q6Acjs.V.call(void 0, this.dataType)),r.queue.submit([a.finish()]),await r.queue.onSubmittedWorkDone(),await n.mapAsync(GPUMapMode.READ,0,_chunkBZVU4Q6Acjs.V.call(void 0, this.dataType));let o=N(new (0, _typedbinary.BufferReader)(n.getMappedRange()),this.dataType);return n.unmap(),n.destroy(),o}as(t){return _optionalChain([Za, 'access', _48 => _48[t], 'optionalCall', _49 => _49(this)])}destroy(){this._destroyed||(this._destroyed=!0,this._ownBuffer&&_optionalChain([this, 'access', _50 => _50._buffer, 'optionalAccess', _51 => _51.destroy, 'call', _52 => _52()]))}toString(){return`buffer:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}}, _class6);function Qn(e){return new Sr(e)}function Kn(e){return new vr(e)}function Ye(e){let t=e;return _optionalChain([t, 'optionalAccess', _53 => _53.resourceType])==="sampler"&&!!t[_chunkBJSN5UVVcjs.a]}function Xe(e){let t=e;return _optionalChain([t, 'optionalAccess', _54 => _54.resourceType])==="sampler-comparison"&&!!t[_chunkBJSN5UVVcjs.a]}var vt= (_class7 =class{constructor(t){;_class7.prototype.__init13.call(this);this._membership=t;this[_chunkBJSN5UVVcjs.b]=this,this[_chunkBJSN5UVVcjs.a]={},_chunkBJSN5UVVcjs.f.call(void 0, this,t.key)}__init13() {this.resourceType="sampler"}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout);return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var ${r}: sampler;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}}, _class7),Dt= (_class8 =class{constructor(t){;_class8.prototype.__init14.call(this);this._membership=t;this[_chunkBJSN5UVVcjs.b]=this,this[_chunkBJSN5UVVcjs.a]={},_chunkBJSN5UVVcjs.f.call(void 0, this,t.key)}__init14() {this.resourceType="sampler-comparison"}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout);return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var ${r}: sampler_comparison;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}}, _class8),Sr= (_class9 =class{constructor(t){;_class9.prototype.__init15.call(this);_class9.prototype.__init16.call(this);this._props=t;this[_chunkBJSN5UVVcjs.b]=this,this[_chunkBJSN5UVVcjs.a]={unwrap:r=>(this._sampler||(this._sampler=r.device.createSampler({...this._props,label:_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))})),this._sampler)},this._filtering=t.minFilter==="linear"||t.magFilter==="linear"||t.mipmapFilter==="linear"}__init15() {this.resourceType="sampler"}__init16() {this._sampler=null}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),{group:n,binding:a}=t.allocateFixedEntry({sampler:this._filtering?"filtering":"non-filtering"},this);return t.addDeclaration(`@group(${n}) @binding(${a}) var ${r}: sampler;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}}, _class9),vr= (_class10 =class{constructor(t){;_class10.prototype.__init17.call(this);_class10.prototype.__init18.call(this);this._props=t;this[_chunkBJSN5UVVcjs.b]=this,this[_chunkBJSN5UVVcjs.a]={unwrap:r=>(this._sampler||(this._sampler=r.device.createSampler({...this._props,label:_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))})),this._sampler)}}__init17() {this.resourceType="sampler-comparison"}__init18() {this._sampler=null}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),{group:n,binding:a}=t.allocateFixedEntry({sampler:"comparison"},this);return t.addDeclaration(`@group(${n}) @binding(${a}) var ${r}: sampler_comparison;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}}, _class10);var Ft= (_class11 =class{constructor(t){;_class11.prototype.__init19.call(this);this._membership=t;_chunkBJSN5UVVcjs.f.call(void 0, this,t.key)}__init19() {this.resourceType="external-texture"}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout);return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var ${r}: texture_external;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}}, _class11);var Hn={r8unorm:_chunkBJSN5UVVcjs.ma,r8snorm:_chunkBJSN5UVVcjs.ma,r8uint:_chunkBJSN5UVVcjs.ka,r8sint:_chunkBJSN5UVVcjs.la,r16uint:_chunkBJSN5UVVcjs.ka,r16sint:_chunkBJSN5UVVcjs.la,r16float:_chunkBJSN5UVVcjs.ma,rg8unorm:_chunkBJSN5UVVcjs.ma,rg8snorm:_chunkBJSN5UVVcjs.ma,rg8uint:_chunkBJSN5UVVcjs.ka,rg8sint:_chunkBJSN5UVVcjs.la,r32uint:_chunkBJSN5UVVcjs.ka,r32sint:_chunkBJSN5UVVcjs.la,r32float:_chunkBJSN5UVVcjs.ma,rg16uint:_chunkBJSN5UVVcjs.ka,rg16sint:_chunkBJSN5UVVcjs.la,rg16float:_chunkBJSN5UVVcjs.ma,rgba8unorm:_chunkBJSN5UVVcjs.ma,"rgba8unorm-srgb":_chunkBJSN5UVVcjs.ma,rgba8snorm:_chunkBJSN5UVVcjs.ma,rgba8uint:_chunkBJSN5UVVcjs.ka,rgba8sint:_chunkBJSN5UVVcjs.la,bgra8unorm:_chunkBJSN5UVVcjs.ma,"bgra8unorm-srgb":_chunkBJSN5UVVcjs.ma,rgb9e5ufloat:_chunkBJSN5UVVcjs.ma,rgb10a2uint:_chunkBJSN5UVVcjs.ka,rgb10a2unorm:_chunkBJSN5UVVcjs.ma,rg11b10ufloat:_chunkBJSN5UVVcjs.ma,rg32uint:_chunkBJSN5UVVcjs.ka,rg32sint:_chunkBJSN5UVVcjs.la,rg32float:_chunkBJSN5UVVcjs.ma,rgba16uint:_chunkBJSN5UVVcjs.ka,rgba16sint:_chunkBJSN5UVVcjs.la,rgba16float:_chunkBJSN5UVVcjs.ma,rgba32uint:_chunkBJSN5UVVcjs.ka,rgba32sint:_chunkBJSN5UVVcjs.la,rgba32float:_chunkBJSN5UVVcjs.ma,stencil8:_chunkBJSN5UVVcjs.ma,depth16unorm:_chunkBJSN5UVVcjs.ma,depth24plus:_chunkBJSN5UVVcjs.ma,"depth24plus-stencil8":_chunkBJSN5UVVcjs.ma,depth32float:_chunkBJSN5UVVcjs.ma,"depth32float-stencil8":_chunkBJSN5UVVcjs.ma,"bc1-rgba-unorm":_chunkBJSN5UVVcjs.ma,"bc1-rgba-unorm-srgb":_chunkBJSN5UVVcjs.ma,"bc2-rgba-unorm":_chunkBJSN5UVVcjs.ma,"bc2-rgba-unorm-srgb":_chunkBJSN5UVVcjs.ma,"bc3-rgba-unorm":_chunkBJSN5UVVcjs.ma,"bc3-rgba-unorm-srgb":_chunkBJSN5UVVcjs.ma,"bc4-r-unorm":_chunkBJSN5UVVcjs.ma,"bc4-r-snorm":_chunkBJSN5UVVcjs.ma,"bc5-rg-unorm":_chunkBJSN5UVVcjs.ma,"bc5-rg-snorm":_chunkBJSN5UVVcjs.ma,"bc6h-rgb-ufloat":_chunkBJSN5UVVcjs.ma,"bc6h-rgb-float":_chunkBJSN5UVVcjs.ma,"bc7-rgba-unorm":_chunkBJSN5UVVcjs.ma,"bc7-rgba-unorm-srgb":_chunkBJSN5UVVcjs.ma,"etc2-rgb8unorm":_chunkBJSN5UVVcjs.ma,"etc2-rgb8unorm-srgb":_chunkBJSN5UVVcjs.ma,"etc2-rgb8a1unorm":_chunkBJSN5UVVcjs.ma,"etc2-rgb8a1unorm-srgb":_chunkBJSN5UVVcjs.ma,"etc2-rgba8unorm":_chunkBJSN5UVVcjs.ma,"etc2-rgba8unorm-srgb":_chunkBJSN5UVVcjs.ma,"eac-r11unorm":_chunkBJSN5UVVcjs.ma,"eac-r11snorm":_chunkBJSN5UVVcjs.ma,"eac-rg11unorm":_chunkBJSN5UVVcjs.ma,"eac-rg11snorm":_chunkBJSN5UVVcjs.ma,"astc-4x4-unorm":_chunkBJSN5UVVcjs.ma,"astc-4x4-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-5x4-unorm":_chunkBJSN5UVVcjs.ma,"astc-5x4-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-5x5-unorm":_chunkBJSN5UVVcjs.ma,"astc-5x5-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-6x5-unorm":_chunkBJSN5UVVcjs.ma,"astc-6x5-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-6x6-unorm":_chunkBJSN5UVVcjs.ma,"astc-6x6-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-8x5-unorm":_chunkBJSN5UVVcjs.ma,"astc-8x5-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-8x6-unorm":_chunkBJSN5UVVcjs.ma,"astc-8x6-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-8x8-unorm":_chunkBJSN5UVVcjs.ma,"astc-8x8-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-10x5-unorm":_chunkBJSN5UVVcjs.ma,"astc-10x5-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-10x6-unorm":_chunkBJSN5UVVcjs.ma,"astc-10x6-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-10x8-unorm":_chunkBJSN5UVVcjs.ma,"astc-10x8-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-10x10-unorm":_chunkBJSN5UVVcjs.ma,"astc-10x10-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-12x10-unorm":_chunkBJSN5UVVcjs.ma,"astc-12x10-unorm-srgb":_chunkBJSN5UVVcjs.ma,"astc-12x12-unorm":_chunkBJSN5UVVcjs.ma,"astc-12x12-unorm-srgb":_chunkBJSN5UVVcjs.ma},Ze={rgba8unorm:_chunkBJSN5UVVcjs.ya,rgba8snorm:_chunkBJSN5UVVcjs.ya,rgba8uint:_chunkBJSN5UVVcjs.Ba,rgba8sint:_chunkBJSN5UVVcjs.Aa,rgba16uint:_chunkBJSN5UVVcjs.Ba,rgba16sint:_chunkBJSN5UVVcjs.Aa,rgba16float:_chunkBJSN5UVVcjs.ya,r32uint:_chunkBJSN5UVVcjs.Ba,r32sint:_chunkBJSN5UVVcjs.Aa,r32float:_chunkBJSN5UVVcjs.ya,rg32uint:_chunkBJSN5UVVcjs.Ba,rg32sint:_chunkBJSN5UVVcjs.Aa,rg32float:_chunkBJSN5UVVcjs.ya,rgba32uint:_chunkBJSN5UVVcjs.Ba,rgba32sint:_chunkBJSN5UVVcjs.Aa,rgba32float:_chunkBJSN5UVVcjs.ya,bgra8unorm:_chunkBJSN5UVVcjs.ya},Jn={f32:"float",u32:"uint",i32:"sint"},Yn={float:_chunkBJSN5UVVcjs.ma,"unfilterable-float":_chunkBJSN5UVVcjs.ma,uint:_chunkBJSN5UVVcjs.ka,sint:_chunkBJSN5UVVcjs.la,depth:_chunkBJSN5UVVcjs.ma};function Xn(e,t){return new Dr(e,t)}function X(e){return _optionalChain([e, 'optionalAccess', _55 => _55.resourceType])==="texture"&&!!e[_chunkBJSN5UVVcjs.a]}function et(e){return _optionalChain([e, 'optionalAccess', _56 => _56.resourceType])==="texture-storage-view"&&!!e[_chunkBJSN5UVVcjs.a]}function tt(e){return _optionalChain([e, 'optionalAccess', _57 => _57.resourceType])==="texture-sampled-view"&&!!e[_chunkBJSN5UVVcjs.a]}var Zn={mutable:"read_write",readonly:"read",writeonly:"write"},Dr= (_class12 =class{constructor(t,r){;_class12.prototype.__init20.call(this);_class12.prototype.__init21.call(this);_class12.prototype.__init22.call(this);_class12.prototype.__init23.call(this);_class12.prototype.__init24.call(this);_class12.prototype.__init25.call(this);_class12.prototype.__init26.call(this);this.props=t;this._branch=r;this[_chunkBJSN5UVVcjs.a]={unwrap:()=>{if(this._destroyed)throw new Error("This texture has been destroyed");return this._texture||(this._texture=this._branch.device.createTexture({label:_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>")),format:this.props.format,size:this.props.size,usage:this._flags,dimension:_nullishCoalesce(this.props.dimension, () => ("2d")),viewFormats:_nullishCoalesce(this.props.viewFormats, () => ([])),mipLevelCount:_nullishCoalesce(this.props.mipLevelCount, () => (1)),sampleCount:_nullishCoalesce(this.props.sampleCount, () => (1))})),this._texture}}}__init20() {this.resourceType="texture"}__init21() {this.usableAsSampled=!1}__init22() {this.usableAsStorage=!1}__init23() {this.usableAsRender=!1}__init24() {this._destroyed=!1}__init25() {this._flags=GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC}__init26() {this._texture=null}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this}$usage(...t){let r=t.includes("storage"),n=t.includes("sampled"),a=t.includes("render");return this._flags|=n?GPUTextureUsage.TEXTURE_BINDING:0,this._flags|=r?GPUTextureUsage.STORAGE_BINDING:0,this._flags|=a?GPUTextureUsage.RENDER_ATTACHMENT:0,this.usableAsStorage||=r,this.usableAsSampled||=n,this.usableAsRender||=a,this}createView(t,r){if(t==="sampled")return this._asSampled(r);let n=r;switch(t){case"mutable":return this._asMutable(n);case"readonly":return this._asReadonly(n);case"writeonly":return this._asWriteonly(n)}}_asStorage(t,r){if(!this.usableAsStorage)throw new Error("Unusable as storage");let n=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _58 => _58.format]), () => (this.props.format)),a=Ze[n];return _chunkBJSN5UVVcjs.j.call(void 0, !!a,`Unsupported storage texture format: ${n}`),new Fr(_nullishCoalesce(t, () => ({})),r,this)}_asReadonly(t){return this._asStorage(t,"readonly")}_asWriteonly(t){return this._asStorage(t,"writeonly")}_asMutable(t){return this._asStorage(t,"mutable")}_asSampled(t){if(!this.usableAsSampled)throw new Error("Unusable as sampled");let r=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _59 => _59.format]), () => (this.props.format));if(!Ze[r])throw new Error(`Unsupported storage texture format: ${r}`);return new Ir(t,this)}destroy(){this._destroyed||(this._destroyed=!0,_optionalChain([this, 'access', _60 => _60._texture, 'optionalAccess', _61 => _61.destroy, 'call', _62 => _62()]))}}, _class12),At={"1d":"1d","2d":"2d","2d-array":"2d_array",cube:"cube","cube-array":"cube_array","3d":"3d"},Fr= (_class13 =class{constructor(t,r,n){;_class13.prototype.__init27.call(this);this.access=r;this._texture=n;this[_chunkBJSN5UVVcjs.b]=this,this[_chunkBJSN5UVVcjs.a]={unwrap:()=>(this._view||(this._view=this._texture[_chunkBJSN5UVVcjs.a].unwrap().createView({label:`${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))} - View`,format:this._format,dimension:this.dimension})),this._view)},this[_chunkBJSN5UVVcjs.d]=n,this.dimension=_nullishCoalesce(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _63 => _63.dimension]), () => (n.props.dimension)), () => ("2d")),this._format=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _64 => _64.format]), () => (n.props.format)),this.texelDataType=Ze[this._format]}__init27() {this.resourceType="texture-storage-view"}$name(t){return this._texture.$name(t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),{group:n,binding:a}=t.allocateFixedEntry({storageTexture:this._format,access:this.access,viewDimension:this.dimension},this),o=`texture_storage_${At[this.dimension]}`;return t.addDeclaration(`@group(${n}) @binding(${a}) var ${r}: ${o}<${this._format}, ${Zn[this.access]}>;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}}, _class13),It= (_class14 =class{constructor(t,r,n,a){;_class14.prototype.__init28.call(this);this._format=t;this.dimension=r;this.access=n;this._membership=a;this[_chunkBJSN5UVVcjs.b]=this,this[_chunkBJSN5UVVcjs.a]={},this.texelDataType=Ze[this._format],_chunkBJSN5UVVcjs.f.call(void 0, this,a.key)}__init28() {this.resourceType="texture-storage-view"}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout),a=`texture_storage_${At[this.dimension]}`;return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var ${r}: ${a}<${this._format}, ${Zn[this.access]}>;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}}, _class14),Ir= (_class15 =class{constructor(t,r){;_class15.prototype.__init29.call(this);this._props=t;this._texture=r;this[_chunkBJSN5UVVcjs.b]=this,this[_chunkBJSN5UVVcjs.a]={unwrap:()=>(this._view||(this._view=this._texture[_chunkBJSN5UVVcjs.a].unwrap().createView({label:`${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))} - View`,...this._props})),this._view)},this[_chunkBJSN5UVVcjs.d]=r,this.dimension=_nullishCoalesce(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _65 => _65.dimension]), () => (r.props.dimension)), () => ("2d")),this._format=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _66 => _66.format]), () => (r.props.format)),this.channelDataType=Hn[this._format]}__init29() {this.resourceType="texture-sampled-view"}$name(t){return this._texture.$name(t),this}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),n=(_nullishCoalesce(this._texture.props.sampleCount, () => (1)))>1,{group:a,binding:o}=t.allocateFixedEntry({texture:Jn[this.channelDataType.type],viewDimension:this.dimension,multisampled:n},this),i=n?"texture_multisampled_2d":`texture_${At[this.dimension]}`;return t.addDeclaration(`@group(${a}) @binding(${o}) var ${r}: ${i}<${t.resolve(this.channelDataType)}>;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}}, _class15),Ut= (_class16 =class{constructor(t,r,n,a){;_class16.prototype.__init30.call(this);this.dimension=r;this._multisampled=n;this._membership=a;this[_chunkBJSN5UVVcjs.b]=this,this[_chunkBJSN5UVVcjs.a]={},_chunkBJSN5UVVcjs.f.call(void 0, this,a.key),this.channelDataType=Yn[t]}__init30() {this.resourceType="texture-sampled-view"}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this)),n=t.allocateLayoutEntry(this._membership.layout),a=this._multisampled?"texture_multisampled_2d":`texture_${At[this.dimension]}`;return t.addDeclaration(`@group(${n}) @binding(${this._membership.idx}) var ${r}: ${a}<${t.resolve(this.channelDataType)}>;`),r}toString(){return`${this.resourceType}:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}}, _class16);function Ur(e){return!!_optionalChain([e, 'optionalAccess', _67 => _67.usableAsSampled])}function to(e){return!!_optionalChain([e, 'optionalAccess', _68 => _68.usableAsRender])}var Pt=class e extends Error{constructor(t){super(`Resource '${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, t), () => ("<unnamed>"))}' cannot be bound as 'sampled'. Use .$usage('sampled') to allow it.`),Object.setPrototypeOf(this,e.prototype)}};function Bt(e){return new Pr(e)}function Rt(e){return!!e&&e.resourceType==="bind-group-layout"}function Br(e){return!!e&&e.resourceType==="bind-group"}var Ar=class e extends Error{constructor(t,r){super(`Bind group '${_nullishCoalesce(t, () => ("<unnamed>"))}' is missing a required binding '${r}'`),Object.setPrototypeOf(this,e.prototype)}},ea=["compute"],Ve=["compute","vertex","fragment"],Pr= (_class17 =class{constructor(t){;_class17.prototype.__init31.call(this);_class17.prototype.__init32.call(this);_class17.prototype.__init33.call(this);_class17.prototype.__init34.call(this);this.entries=t;let r=0;for(let[n,a]of Object.entries(t)){if(a===null){r++;continue}let o={layout:this,key:n,idx:r};if("uniform"in a&&(this.bound[n]=new Je("uniform",a.uniform,o)),"storage"in a){let i="type"in a.storage?a.storage:a.storage(0);this.bound[n]=new Je(_nullishCoalesce(a.access, () => ("readonly")),i,o)}"texture"in a&&(this.bound[n]=new Ut(a.texture,_nullishCoalesce(a.viewDimension, () => ("2d")),_nullishCoalesce(a.multisampled, () => (!1)),o)),"storageTexture"in a&&(this.bound[n]=new It(a.storageTexture,_nullishCoalesce(a.viewDimension, () => ("2d")),_nullishCoalesce(a.access, () => ("writeonly")),o)),"externalTexture"in a&&(this.bound[n]=new Ft(o)),"sampler"in a&&(a.sampler==="comparison"?this.bound[n]=new Dt(o):this.bound[n]=new vt(o)),"texture"in a||"storageTexture"in a||"externalTexture"in a||"sampler"in a?this.value[n]=this.bound[n]:Object.defineProperty(this.value,n,{get:()=>this.bound[n].value}),r++}}__init31() {this.resourceType="bind-group-layout"}__init32() {this.bound={}}__init33() {this.value={}}__init34() {this.$=this.value}toString(){return`bindGroupLayout:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}get index(){return this._index}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this}$idx(t){return this._index=t,this}unwrap(t){return t.device.createBindGroupLayout({label:_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>")),entries:Object.values(this.entries).map((n,a)=>{if(n===null)return null;let o=n.visibility,i={binding:a,visibility:0};if("uniform"in n)o=_nullishCoalesce(o, () => (Ve)),i.buffer={type:"uniform"};else if("storage"in n)o=_nullishCoalesce(o, () => ((n.access==="mutable"?ea:Ve))),i.buffer={type:n.access==="mutable"?"storage":"read-only-storage"};else if("sampler"in n)o=_nullishCoalesce(o, () => (Ve)),i.sampler={type:n.sampler};else if("texture"in n)o=_nullishCoalesce(o, () => (Ve)),i.texture={sampleType:n.texture,viewDimension:_nullishCoalesce(n.viewDimension, () => ("2d")),multisampled:_nullishCoalesce(n.multisampled, () => (!1))};else if("storageTexture"in n){let s=_nullishCoalesce(n.access, () => ("writeonly"));o=_nullishCoalesce(o, () => ((s==="readonly"?Ve:ea))),i.storageTexture={format:n.storageTexture,access:{mutable:"read-write",readonly:"read-only",writeonly:"write-only"}[s],viewDimension:_nullishCoalesce(n.viewDimension, () => ("2d"))}}else"externalTexture"in n&&(o=_nullishCoalesce(o, () => (Ve)),i.externalTexture={});return _optionalChain([o, 'optionalAccess', _69 => _69.includes, 'call', _70 => _70("compute")])&&(i.visibility|=GPUShaderStage.COMPUTE),_optionalChain([o, 'optionalAccess', _71 => _71.includes, 'call', _72 => _72("vertex")])&&(i.visibility|=GPUShaderStage.VERTEX),_optionalChain([o, 'optionalAccess', _73 => _73.includes, 'call', _74 => _74("fragment")])&&(i.visibility|=GPUShaderStage.FRAGMENT),i}).filter(n=>n!==null)})}}, _class17),_e= (_class18 =class{constructor(t,r){;_class18.prototype.__init35.call(this);this.layout=t;this.entries=r;for(let n of Object.keys(t.entries))if(t.entries[n]!==null&&!(n in r))throw new Ar(_chunkBJSN5UVVcjs.e.call(void 0, t),n)}__init35() {this.resourceType="bind-group"}unwrap(t){return t.device.createBindGroup({label:_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this.layout), () => ("<unnamed>")),layout:t.unwrap(this.layout),entries:Object.entries(this.layout.entries).map(([n,a],o)=>{if(a===null)return null;let i=this.entries[n];if(i===void 0)throw new Error(`'${n}' is a resource required to populate bind group layout '${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this.layout), () => ("<unnamed>"))}'.`);if("uniform"in a){let s;if(pe(i)){if(!bt(i))throw new (0, _chunkBJSN5UVVcjs.m)(i);s={buffer:t.unwrap(i)}}else s={buffer:i};return{binding:o,resource:s}}if("storage"in a){let s;if(pe(i)){if(!he(i))throw new Ke(i);s={buffer:t.unwrap(i)}}else s={buffer:i};return{binding:o,resource:s}}if("texture"in a){let s;if(X(i)){if(!Ur(i))throw new Pt(i);s=t.unwrap(i.createView("sampled"))}else tt(i)?s=t.unwrap(i):s=i;return{binding:o,resource:s}}if("storageTexture"in a){let s;if(X(i)){if(!he(i))throw new Ke(i);a.access==="readonly"?s=t.unwrap(i.createView("readonly")):a.access==="mutable"?s=t.unwrap(i.createView("mutable")):s=t.unwrap(i.createView("writeonly"))}else et(i)?s=t.unwrap(i):s=i;return{binding:o,resource:s}}if("sampler"in a)return Ye(i)||Xe(i)?{binding:o,resource:t.unwrap(i)}:{binding:o,resource:i};if("externalTexture"in a)return{binding:o,resource:i};throw new Error(`Malformed bind group entry: ${i} (${JSON.stringify(i)})`)}).filter(n=>n!==null)})}}, _class18);var{NodeTypeCatalog:D}=ro,no=["==","!=","<","<=",">",">=","<<",">>","+","-","*","/","%","|","^","&","&&","||"],ao=["&&","||","==","!=","<","<=",">",">="];function ta(e,t,r){return r?ao.includes(t)?_chunkBJSN5UVVcjs.ja:t==="="?r:e:t==="!"||t==="~"?_chunkBJSN5UVVcjs.ja:e}function oo(e){throw new Error(`'${JSON.stringify(e)}' was not handled by the WGSL generator.`)}function ra(e,[t,r]){e.pushBlockScope();try{return`${e.indent()}{
|
20
|
+
${r.map(n=>we(e,n)).join(`
|
20
21
|
`)}
|
21
|
-
${e.dedent()}}`}finally{e.popBlockScope()}}function
|
22
|
-
${
|
22
|
+
${e.dedent()}}`}finally{e.popBlockScope()}}function io(e,t,r){return e.defineVariable(t,r)}function Rr(e,t){let r=e.getById(t);if(!r)throw new Error(`Identifier ${t} not found`);return r}function _(e,t){if(typeof t=="string")return Rr(e,t);if(typeof t=="boolean")return _chunkBJSN5UVVcjs.da.call(void 0, t?"true":"false",_chunkBJSN5UVVcjs.ja);if(t[0]===D.logicalExpr||t[0]===D.binaryExpr||t[0]===D.assignmentExpr){let[r,n,a,o]=t,i=_(e,n),s=_(e,o),l=M(e,[i,s]),[u,c]=l||[i,s],m=e.resolve(u.value),g=e.resolve(c.value),T=ta(u.dataType,a,c.dataType);return _chunkBJSN5UVVcjs.da.call(void 0, no.includes(a)?`(${m} ${a} ${g})`:`${m} ${a} ${g}`,T)}if(t[0]===D.postUpdate){let[r,n,a]=t,o=_(e,a),i=e.resolve(o.value);return _chunkBJSN5UVVcjs.da.call(void 0, `${i}${n}`,o.dataType)}if(t[0]===D.unaryExpr){let[r,n,a]=t,o=_(e,a),i=e.resolve(o.value),s=ta(o.dataType,n);return _chunkBJSN5UVVcjs.da.call(void 0, `${n}${i}`,s)}if(t[0]===D.memberAccess){let[r,n,a]=t,o=_(e,n);if(o.dataType.type==="unknown"){let i=o.value[a];return ge(i)}return _chunkBJSN5UVVcjs.N.call(void 0, o.dataType)?_chunkBJSN5UVVcjs.da.call(void 0, `(*${e.resolve(o.value)}).${a}`,Ne(o.dataType.inner,a)):_chunkBJSN5UVVcjs.L.call(void 0, o.dataType)&&a==="length"?o.dataType.elementCount===0?_chunkBJSN5UVVcjs.da.call(void 0, `arrayLength(&${e.resolve(o.value)})`,_chunkBJSN5UVVcjs.ka):_chunkBJSN5UVVcjs.da.call(void 0, String(o.dataType.elementCount),_chunkBJSN5UVVcjs.ha):_chunkBJSN5UVVcjs.I.call(void 0, o.dataType)&&a==="columns"?_chunkBJSN5UVVcjs.da.call(void 0, o.value,o.dataType):_chunkBJSN5UVVcjs.E.call(void 0, o.dataType)&&_chunkBJSN5UVVcjs.B.call(void 0, o.value)?ge(o.value[a]):_chunkBJSN5UVVcjs.da.call(void 0, `${e.resolve(o.value)}.${a}`,Ne(o.dataType,a))}if(t[0]===D.indexAccess){let[r,n,a]=t,o=_(e,n),i=_(e,a),s=e.resolve(o.value),l=e.resolve(i.value);if(o.dataType.type==="unknown"){if(Array.isArray(a)&&a[0]===D.numericLiteral)return ge(o.value[a[1]]);throw new Error(`Cannot index value ${s} of unknown type with index ${l}`)}return _chunkBJSN5UVVcjs.N.call(void 0, o.dataType)?_chunkBJSN5UVVcjs.da.call(void 0, `(*${s})[${l}]`,rr(o.dataType.inner)):_chunkBJSN5UVVcjs.da.call(void 0, `${s}[${l}]`,_chunkBJSN5UVVcjs.ba.call(void 0, o.dataType)?rr(o.dataType):_chunkBJSN5UVVcjs.ca)}if(t[0]===D.numericLiteral){let r=nr(t[1]);if(!r)throw new Error(`Invalid numeric literal ${t[1]}`);return r}if(t[0]===D.call){let[r,n,a]=t,o=_(e,n);e.callStack.push(o.value);let s=a.map(m=>_(e,m)).map(m=>_chunkBJSN5UVVcjs.da.call(void 0, e.resolve(m.value),m.dataType)),l=s.map(m=>m.value);if(e.callStack.pop(),s.forEach((m,g)=>{if(m.dataType===_chunkBJSN5UVVcjs.ca)throw new Error(`Tried to pass '${m.value}' of unknown type as argument #${g} to '${typeof o.value=="string"?o.value:_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, o.value), () => ("<unnamed>"))}()'`)}),typeof o.value=="string")return _chunkBJSN5UVVcjs.da.call(void 0, `${o.value}(${l.join(", ")})`,o.dataType);if(_chunkBJSN5UVVcjs.M.call(void 0, o.value)){let m=e.resolve(o.value);return _chunkBJSN5UVVcjs.da.call(void 0, `${m}(${l.join(", ")})`,o.value)}if(!pr(o.value))throw new Error(`Function ${String(o.value)} ${_chunkBJSN5UVVcjs.e.call(void 0, o.value)} has not been created using TypeGPU APIs. Did you mean to wrap the function with tgpu.fn(args, return)(...) ?`);let u=_optionalChain([o, 'access', _75 => _75.value, 'access', _76 => _76[_chunkBJSN5UVVcjs.a], 'optionalAccess', _77 => _77.argTypes]),c;try{!u||u==="keep"?c=s:u==="coerce"?c=_nullishCoalesce(M(e,s), () => (s)):c=(Array.isArray(u)?u:u(...s)).map((T,x)=>[T,s[x]]).map(([T,x])=>{if(x.dataType.type==="unknown")return console.warn(`Internal error: unknown type when generating expression: ${t}`),x;let y=_optionalChain([M, 'call', _78 => _78(e,[x],[T]), 'optionalAccess', _79 => _79[0]]);if(!y)throw new (0, _chunkBJSN5UVVcjs.k)(`Cannot convert argument of type '${x.dataType.type}' to '${T.type}' for function ${_chunkBJSN5UVVcjs.e.call(void 0, o.value)}`,[{function:o.value,callStack:e.callStack,error:`Cannot convert argument of type '${x.dataType.type}' to '${T.type}'`,toString:()=>_chunkBJSN5UVVcjs.e.call(void 0, o.value)}]);return y});let m=o.value(...c);return _chunkBJSN5UVVcjs.da.call(void 0, e.resolve(m.value),m.dataType)}catch(m){throw new (0, _chunkBJSN5UVVcjs.k)(m,[{toString:()=>_chunkBJSN5UVVcjs.e.call(void 0, o.value)}])}}if(t[0]===D.objectExpr){let r=t[1],n=e.callStack[e.callStack.length-1];if(_chunkBJSN5UVVcjs.M.call(void 0, n)){let a=Object.keys(n.propTypes),o=Object.fromEntries(a.map(s=>{let l=r[s];if(l===void 0)throw new Error(`Missing property ${s} in object literal for struct ${n}`);return[s,_(e,l)]})),i=ir(e,n,o);return _chunkBJSN5UVVcjs.da.call(void 0, i.map(s=>e.resolve(s.value)).join(", "),n)}if(pr(n)){let a=_optionalChain([n, 'access', _80 => _80[_chunkBJSN5UVVcjs.a], 'optionalAccess', _81 => _81.argTypes]);if(typeof a=="object"&&a!==null){let o=Object.keys(a),i={};for(let s of o){let l=r[s];if(l===void 0)throw new Error(`Missing property ${s} in object literal for function ${n}`);let u=_(e,l),c=a[s],m=M(e,[u],[c]);i[s]=_nullishCoalesce(_optionalChain([m, 'optionalAccess', _82 => _82[0]]), () => (u))}return _chunkBJSN5UVVcjs.da.call(void 0, i,_chunkBJSN5UVVcjs.ca)}}throw new Error("Object expressions are only allowed as return values of functions or as arguments to structs.")}if(t[0]===D.arrayExpr){let[r,n]=t,a=n.map(m=>_(e,m));if(a.length===0)throw new Error("Cannot create empty array literal.");let o=M(e,a);if(!o)throw new Error("The given values cannot be automatically converted to a common type. Consider explicitly casting them.");let i=_optionalChain([o, 'access', _83 => _83[0], 'optionalAccess', _84 => _84.dataType]),s=i.type==="abstractFloat"?_chunkBJSN5UVVcjs.ma:i.type==="abstractInt"?_chunkBJSN5UVVcjs.la:i,u=`array<${e.resolve(s)}, ${a.length}>`,c=o.map(m=>e.resolve(m.value));return _chunkBJSN5UVVcjs.da.call(void 0, `${u}( ${c.join(", ")} )`,_chunkBZVU4Q6Acjs.X.call(void 0, s,a.length))}if(t[0]===D.stringLiteral)throw new Error("Cannot use string literals in TGSL.");if(t[0]===D.preUpdate)throw new Error("Cannot use pre-updates in TGSL.");oo(t)}function Ct(e){return typeof e!="object"||e[0]!==D.block?[D.block,[e]]:e}function we(e,t){if(typeof t=="string")return`${e.pre}${e.resolve(Rr(e,t).value)};`;if(typeof t=="boolean")return`${e.pre}${t?"true":"false"};`;if(t[0]===D.return){let r=t[1],n=r!==void 0?e.resolve(_(e,r).value):void 0;if(_chunkBJSN5UVVcjs.M.call(void 0, e.callStack[e.callStack.length-1])&&typeof r=="object"&&r[0]===D.objectExpr){let a=e.resolve(e.callStack[e.callStack.length-1]);return`${e.pre}return ${a}(${n});`}return n?`${e.pre}return ${n};`:`${e.pre}return;`}if(t[0]===D.if){let[r,n,a,o]=t,i=_(e,n),s=i,l=M(e,[i],[_chunkBJSN5UVVcjs.ja]);_optionalChain([l, 'optionalAccess', _85 => _85[0]])&&([s]=l);let u=e.resolve(s.value);e.indent();let c=we(e,Ct(a));e.dedent(),e.indent();let m=o?we(e,Ct(o)):void 0;return e.dedent(),m?`${e.pre}if (${u})
|
23
|
+
${c}
|
23
24
|
${e.pre}else
|
24
|
-
${
|
25
|
-
${
|
26
|
-
${x}`}if(t[0]===
|
27
|
-
${l}`}return t[0]===
|
25
|
+
${m}`:`${e.pre}if (${u})
|
26
|
+
${c}`}if(t[0]===D.let||t[0]===D.const){let[r,n,a]=t,o=a!==void 0?_(e,a):void 0;if(!o)throw new Error(`Cannot create variable '${n}' without an initial value.`);if(_chunkBJSN5UVVcjs.W.call(void 0, o.dataType))throw new Error(`Cannot create variable '${n}' with loose data type.`);io(e,n,or(o.dataType));let i=e.resolve(Rr(e,n).value);if(typeof a=="object"&&a[0]===D.objectExpr&&_chunkBJSN5UVVcjs.M.call(void 0, e.callStack[e.callStack.length-1])){let s=e.callStack[e.callStack.length-1],l=a[1],u={};for(let[g,T]of Object.entries(l)){if(!T)throw new Error(`Missing property ${g} in object literal`);u[g]=_(e,T)}let c=ir(e,s,u),m=e.resolve(s);return`${e.pre}var ${i} = ${m}(${c.map(g=>e.resolve(g.value)).join(", ")});`}return`${e.pre}var ${i} = ${e.resolve(o.value)};`}if(t[0]===D.block)return ra(e,t);if(t[0]===D.for){let[r,n,a,o,i]=t,s=n?we(e,n):void 0,l=s?s.slice(0,-1):"",u=a?_(e,a):void 0,c=u;if(u){let y=M(e,[u],[_chunkBJSN5UVVcjs.ja]);_optionalChain([y, 'optionalAccess', _86 => _86[0]])&&([c]=y)}let m=c?e.resolve(c.value):"",g=o?we(e,o):void 0,T=g?g.slice(0,-1):"";e.indent();let x=we(e,Ct(i));return e.dedent(),`${e.pre}for (${l}; ${m}; ${T})
|
27
|
+
${x}`}if(t[0]===D.while){let[r,n,a]=t,o=_(e,n),i=o;if(o){let u=M(e,[o],[_chunkBJSN5UVVcjs.ja]);_optionalChain([u, 'optionalAccess', _87 => _87[0]])&&([i]=u)}let s=e.resolve(i.value);e.indent();let l=we(e,Ct(a));return e.dedent(),`${e.pre}while (${s})
|
28
|
+
${l}`}return t[0]===D.continue?`${e.pre}continue;`:t[0]===D.break?`${e.pre}break;`:`${e.pre}${e.resolve(_(e,t).value)};`}function na(e,t){return ra(e,t)}var aa="#CATCHALL#",Vr= (_class19 =class{constructor() { _class19.prototype.__init36.call(this);_class19.prototype.__init37.call(this); }__init36() {this._stack=[]}__init37() {this._itemDepth=0}get itemDepth(){return this._itemDepth}get topItem(){let t=this._stack[this._stack.length-1];if(!t||t.type!=="item")throw new Error("Internal error, expected item layer to be on top.");return t}pushItem(){this._itemDepth++,this._stack.push({type:"item",usedSlots:new Set})}popItem(){this.pop("item")}pushSlotBindings(t){this._stack.push({type:"slotBinding",bindingMap:new WeakMap(t)})}popSlotBindings(){this.pop("slotBinding")}pushFunctionScope(t,r,n,a){this._stack.push({type:"functionScope",args:t,argAliases:r,returnType:n,externalMap:a})}popFunctionScope(){this.pop("functionScope")}pushBlockScope(){this._stack.push({type:"blockScope",declarations:new Map})}popBlockScope(){this.pop("blockScope")}pop(t){let r=this._stack[this._stack.length-1];if(!r||t&&r.type!==t)throw new Error(`Internal error, expected a ${t} layer to be on top.`);this._stack.pop(),t==="item"&&this._itemDepth--}readSlot(t){for(let r=this._stack.length-1;r>=0;--r){let n=this._stack[r];if(_optionalChain([n, 'optionalAccess', _88 => _88.type])==="item")n.usedSlots.add(t);else if(_optionalChain([n, 'optionalAccess', _89 => _89.type])==="slotBinding"){let a=n.bindingMap.get(t);if(a!==void 0)return a}else if(!(_optionalChain([n, 'optionalAccess', _90 => _90.type])==="functionScope"||_optionalChain([n, 'optionalAccess', _91 => _91.type])==="blockScope"))throw new Error("Unknown layer type.")}return t.defaultValue}getSnippetById(t){for(let r=this._stack.length-1;r>=0;--r){let n=this._stack[r];if(_optionalChain([n, 'optionalAccess', _92 => _92.type])==="functionScope"){let a=n.args.find(i=>i.value===t);if(a!==void 0)return a;if(n.argAliases[t])return n.argAliases[t];let o=n.externalMap[t];return o!=null?ge(o):void 0}if(_optionalChain([n, 'optionalAccess', _93 => _93.type])==="blockScope"){let a=n.declarations.get(t);if(a!==void 0)return _chunkBJSN5UVVcjs.da.call(void 0, t,a)}}}defineBlockVariable(t,r){if(r.type==="unknown")throw Error(`Tried to define variable '${t}' of unknown type`);for(let n=this._stack.length-1;n>=0;--n){let a=this._stack[n];if(_optionalChain([a, 'optionalAccess', _94 => _94.type])==="blockScope")return a.declarations.set(t,r),_chunkBJSN5UVVcjs.da.call(void 0, t,r)}throw new Error("No block scope found to define a variable in.")}}, _class19),Vt=[""," "," "," "," "," "," "," "," "],Cr=Vt.length-1,_r= (_class20 =class{constructor() { _class20.prototype.__init38.call(this); }__init38() {this.identLevel=0}get pre(){return _nullishCoalesce(Vt[this.identLevel], () => (Vt[Cr].repeat(this.identLevel/Cr)+Vt[this.identLevel%Cr]))}indent(){let t=this.pre;return this.identLevel++,t}dedent(){return this.identLevel--,this.pre}}, _class20),$r= (_class21 =class{__init39() {this._memoizedResolves=new WeakMap}__init40() {this._memoizedDerived=new WeakMap}__init41() {this._indentController=new _r}__init42() {this._itemStateStack=new Vr}__init43() {this._declarations=[]}__init44() {this[_chunkBJSN5UVVcjs.a]={itemStateStack:this._itemStateStack}}__init45() {this.bindGroupLayoutsToPlaceholderMap=new Map}__init46() {this._nextFreeLayoutPlaceholderIdx=0}__init47() {this.fixedBindings=[]}__init48() {this.callStack=[]}constructor(t){;_class21.prototype.__init39.call(this);_class21.prototype.__init40.call(this);_class21.prototype.__init41.call(this);_class21.prototype.__init42.call(this);_class21.prototype.__init43.call(this);_class21.prototype.__init44.call(this);_class21.prototype.__init45.call(this);_class21.prototype.__init46.call(this);_class21.prototype.__init47.call(this);_class21.prototype.__init48.call(this);this.names=t.names,this._jitTranspiler=t.jitTranspiler}get pre(){return this._indentController.pre}indent(){return this._indentController.indent()}dedent(){return this._indentController.dedent()}getById(t){let r=this._itemStateStack.getSnippetById(t);return r===void 0?null:r}defineVariable(t,r){return this._itemStateStack.defineBlockVariable(t,r)}pushBlockScope(){this._itemStateStack.pushBlockScope()}popBlockScope(){this._itemStateStack.popBlockScope()}transpileFn(t){if(!this._jitTranspiler)throw new Error("Tried to execute a tgpu.fn function without providing a JIT transpiler, or transpiling at build time.");return this._jitTranspiler.transpileFn(t)}fnToWgsl(t){this._itemStateStack.pushFunctionScope(t.args,t.argAliases,t.returnType,t.externalMap);try{return{head:so(this,t.args,t.returnType),body:na(this,t.body)}}finally{this._itemStateStack.popFunctionScope()}}addDeclaration(t){this._declarations.push(t)}allocateLayoutEntry(t){let r=this.bindGroupLayoutsToPlaceholderMap,n=r.get(t);return n||(n=`#BIND_GROUP_LAYOUT_${this._nextFreeLayoutPlaceholderIdx++}#`,r.set(t,n)),n}allocateFixedEntry(t,r){let n=this.fixedBindings.length;return this.fixedBindings.push({layoutEntry:t,resource:r}),{group:aa,binding:n}}readSlot(t){let r=this._itemStateStack.readSlot(t);if(r===void 0)throw new (0, _chunkBJSN5UVVcjs.l)(t);return r}withSlots(t,r){this._itemStateStack.pushSlotBindings(t);try{return r()}finally{this._itemStateStack.popSlotBindings()}}unwrap(t){if(ze(t))return this.withSlots(t["~providing"].pairs,()=>this.unwrap(t["~providing"].inner));let r=t;for(;;)if(Pe(r))r=this.readSlot(r);else if(Be(r))r=this._getOrCompute(r);else break;return r}_getOrCompute(t){let r=_nullishCoalesce(this._memoizedDerived.get(t), () => ([]));this._itemStateStack.pushItem();try{for(let o of r)if([...o.slotToValueMap.entries()].every(([s,l])=>s.areEqual(this._itemStateStack.readSlot(s),l)))return o.result;_chunkBJSN5UVVcjs.t.call(void 0, _chunkBJSN5UVVcjs.q.CPU);let n;try{n=t["~compute"]()}finally{_chunkBJSN5UVVcjs.u.call(void 0, _chunkBJSN5UVVcjs.q.CPU)}let a=new Map;for(let o of this._itemStateStack.topItem.usedSlots)a.set(o,this._itemStateStack.readSlot(o));return r.push({slotToValueMap:a,result:n}),this._memoizedDerived.set(t,r),n}catch(n){throw n instanceof _chunkBJSN5UVVcjs.k?n.appendToTrace(t):new (0, _chunkBJSN5UVVcjs.k)(n,[t])}finally{this._itemStateStack.popItem()}}_getOrInstantiate(t){let r=_nullishCoalesce(this._memoizedResolves.get(t), () => ([]));this._itemStateStack.pushItem();try{for(let o of r)if([...o.slotToValueMap.entries()].every(([s,l])=>s.areEqual(this._itemStateStack.readSlot(s),l)))return o.result;let n;_chunkBJSN5UVVcjs.ba.call(void 0, t)?n=fr(this,t):Be(t)||Pe(t)?n=this.resolve(this.unwrap(t)):ur(t)?n=t["~resolve"](this):n=this.resolveValue(t);let a=new Map;for(let o of this._itemStateStack.topItem.usedSlots)a.set(o,this._itemStateStack.readSlot(o));return r.push({slotToValueMap:a,result:n}),this._memoizedResolves.set(t,r),n}catch(n){throw n instanceof _chunkBJSN5UVVcjs.k?n.appendToTrace(t):new (0, _chunkBJSN5UVVcjs.k)(n,[t])}finally{this._itemStateStack.popItem()}}resolve(t){if(ze(t))return this.withSlots(t["~providing"].pairs,()=>this.resolve(t["~providing"].inner));if(t&&typeof t=="object"||typeof t=="function"){if(this._itemStateStack.itemDepth===0)try{_chunkBJSN5UVVcjs.t.call(void 0, _chunkBJSN5UVVcjs.q.GPU);let r=_chunkBJSN5UVVcjs.r.call(void 0, this,()=>this._getOrInstantiate(t));return`${[...this._declarations].join(`
|
28
29
|
|
29
|
-
`)}${r}`}finally{_chunkODKBWWHUcjs.q.call(void 0, _chunkODKBWWHUcjs.m.GPU)}return this._getOrInstantiate(t)}return String(t)}resolveValue(t,r){if(J(t))return this.resolve(t);if(r&&_chunkODKBWWHUcjs.B.call(void 0, r))return`array(${t.map(n=>this.resolveValue(n,r.elementType))})`;if(Array.isArray(t))return`array(${t.map(n=>this.resolveValue(n))})`;if(r&&_chunkODKBWWHUcjs.C.call(void 0, r))return`${this.resolve(r)}(${Object.entries(r.propTypes).map(([n,a])=>this.resolveValue(t[n],a))})`;throw new Error(`Value ${t} (as json: ${JSON.stringify(t)}) of schema ${r} is not resolvable to WGSL`)}}, _class19);function Ve(e,t){let r=new Rr(t),n=r.resolve(e),a=r.bindGroupLayoutsToPlaceholderMap,o=[],s=new Set([...a.keys()].map(g=>g.index).filter(g=>g!==void 0)),i=_chunkODKBWWHUcjs.M.call(void 0, s),l=r.fixedBindings.map((g,c)=>[String(c),g.layoutEntry]),u=()=>{let g=i.next().value,c=It(Object.fromEntries(l));return o[g]=c,n=n.replaceAll(_n,String(g)),[g,new Pe(c,Object.fromEntries(r.fixedBindings.map((y,x)=>[String(x),y.resource])))]},d=l.length>0?u():null;for(let[g,c]of a.entries()){let y=_nullishCoalesce(g.index, () => (i.next().value));o[y]=g,n=n.replaceAll(c,String(y))}return{code:n,bindGroupLayouts:o,catchall:d}}function Cr(e,t,r){let n=t.map(a=>`${a.value}: ${e.resolve(a.dataType)}`).join(", ");return r!==void 0?`(${n}) -> ${_chunkFHOQ6WZEcjs.ja.call(void 0, r)} ${e.resolve(r)}`:`(${n})`}function oe(e,t){let r=[];typeof t=="string"&&(e.isEntry?(Array.isArray(e.argTypes)&&_chunkODKBWWHUcjs.C.call(void 0, e.argTypes[0])&&r.push({In:e.argTypes[0]}),_chunkODKBWWHUcjs.C.call(void 0, e.returnType)&&r.push({Out:e.returnType})):Array.isArray(e.argTypes)&&(dn(t,Array.isArray(e.argTypes)?e.argTypes:Object.values(e.argTypes),o=>r.push(o)),Be(t,e.returnType,o=>r.push(o))));let n={applyExternals(o){r.push(o)},resolve(o,s=""){let i={};for(let u of r)Q(i,u);let l=o.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this));if(typeof t=="string"){let u="";if(!e.isEntry)u=Array.isArray(e.argTypes)?"":Cr(o,Object.entries(e.argTypes).map(([g,c])=>({value:g,dataType:c})),e.returnType);else{let g=Array.isArray(e.argTypes)&&_chunkODKBWWHUcjs.C.call(void 0, e.argTypes[0])?"(in: In)":"()",c=_chunkODKBWWHUcjs.A.call(void 0, e.returnType)?_chunkFHOQ6WZEcjs.ja.call(void 0, e.returnType):"",y=e.returnType!==void 0?_chunkODKBWWHUcjs.C.call(void 0, e.returnType)?"-> Out":`-> ${c!==""?c:"@location(0)"} ${o.resolve(e.returnType)}`:"";u=`${g} ${y} `}let d=ye(o,i,`${u}${t.trim()}`);o.addDeclaration(`${s}fn ${l}${d}`)}else{let u=gn(t);if(_optionalChain([u, 'optionalAccess', _88 => _88.externals])){let h=Object.fromEntries(Object.entries(u.externals).filter(([T])=>!(T in i)));Q(i,h)}let d=_nullishCoalesce(_optionalChain([u, 'optionalAccess', _89 => _89.ast]), () => (o.transpileFn(String(t))));d.argNames.type==="destructured-object"&&Q(i,Object.fromEntries(d.argNames.props.map(({prop:h,alias:T})=>[T,h]))),!Array.isArray(e.argTypes)&&d.argNames.type==="identifiers"&&d.argNames.names[0]!==void 0&&Q(i,{[d.argNames.names[0]]:Object.fromEntries(Object.keys(e.argTypes).map(h=>[h,h]))});let g=d.externalNames.filter(h=>!(h in i));if(g.length>0)throw new (0, _chunkODKBWWHUcjs.j)(_chunkODKBWWHUcjs.c.call(void 0, this),g);let c=Array.isArray(e.argTypes)?d.argNames.type==="identifiers"?e.argTypes.map((h,T)=>({value:_nullishCoalesce((d.argNames.type==="identifiers"?d.argNames.names[T]:void 0), () => (`arg_${T}`)),dataType:h})):[]:Object.entries(e.argTypes).map(([h,T])=>({value:h,dataType:T})),{head:y,body:x}=o.fnToWgsl({args:c,returnType:e.returnType,body:d.body,externalMap:i});o.addDeclaration(`${s}fn ${l}${o.resolve(y)}${o.resolve(x)}`)}return l}},a=_chunkODKBWWHUcjs.c.call(void 0, t);return a!==void 0&&_chunkODKBWWHUcjs.d.call(void 0, n,a),n}function On(e){let t=0;return Object.fromEntries(Object.entries(e).map(([r,n])=>{if(_chunkFHOQ6WZEcjs.ia.call(void 0, n))return[r,n];let a=_chunkFHOQ6WZEcjs.h.call(void 0, n);return a!==void 0?(t=a+1,[r,n]):[r,_chunkFHOQ6WZEcjs.ga.call(void 0, t++,n)]}))}function Ct(e){return _chunkFHOQ6WZEcjs.i.call(void 0, e)?_chunkODKBWWHUcjs.L.call(void 0, e)?void 0:_chunkFHOQ6WZEcjs.h.call(void 0, e)!==void 0?e:_chunkFHOQ6WZEcjs.ga.call(void 0, 0,e):_chunkFHOQ6WZEcjs.ka.call(void 0, On(e))}function $e(e){return _chunkFHOQ6WZEcjs.ka.call(void 0, On(e))}function se(e,...t){return Ca(e)?Pa(e,...t):e}function Ca(e){return Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw)&&e.raw.every(t=>typeof t=="string")}function Pa(e,...t){return e.slice(1).reduce((r,n,a)=>`${r}${t[a]}${n}`,e[0])}function Gn(e){let t={argTypes:e.in&&Object.keys(e.in).length!==0?[$e(e.in)]:[],returnType:void 0,workgroupSize:[_nullishCoalesce(e.workgroupSize[0], () => (1)),_nullishCoalesce(e.workgroupSize[1], () => (1)),_nullishCoalesce(e.workgroupSize[2], () => (1))],isEntry:!0},r=(n,...a)=>Va(t,e.workgroupSize,se(n,...a));return Object.assign(Object.assign(r,t),{does:r})}function Va(e,t,r){let n=oe(e,r),a=e.argTypes[0];return{shell:e,$uses(o){return n.applyExternals(o),this},[_chunkODKBWWHUcjs.b]:n,$name(o){return _chunkODKBWWHUcjs.d.call(void 0, n,o),_chunkODKBWWHUcjs.e.call(void 0, a)&&a.$name(`${o}_Input`),this},"~resolve"(o){return n.resolve(o,`@compute @workgroup_size(${t.join(", ")}) `)},toString(){return`computeFn:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, n), () => ("<unnamed>"))}`}}}function Wn(e,t){let r={[_chunkODKBWWHUcjs.a]:!0,argTypes:e,returnType:t,isEntry:!1},n=(a,...o)=>ka(r,se(a,...o));return Object.assign(Object.assign(n,r),{does:n})}function Pr(e){return _optionalChain([e, 'optionalAccess', _90 => _90.resourceType])==="function"}function $a([e,t]){return`${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, e), () => ("<unnamed>"))}=${t}`}function ka(e,t){let r=oe(e,t),n={[_chunkODKBWWHUcjs.a]:{implementation:t,argTypes:e.argTypes},shell:e,resourceType:"function",$uses(s){return r.applyExternals(s),this},[_chunkODKBWWHUcjs.b]:r,$name(s){return _chunkODKBWWHUcjs.d.call(void 0, r,s),this},with(s,i){return Mn(o,[[ge(s)?s.slot:s,i]])},"~resolve"(s){if(typeof t=="string")return r.resolve(s);let i=s;if(i.callStack===void 0)throw new Error("Cannot resolve a TGSL function outside of a generation context");try{return i.callStack.push(e.returnType),r.resolve(s)}finally{i.callStack.pop()}}},a=_chunkODKBWWHUcjs.N.call(void 0, (...s)=>{if(typeof t=="string")throw new Error("Cannot execute on the CPU functions constructed with raw WGSL");return t(...s)},(...s)=>({value:new Pt(o,s.map(i=>i.value)),dataType:_nullishCoalesce(e.returnType, () => (U))}),e.argTypes);a[_chunkODKBWWHUcjs.a].implementation=t;let o=Object.assign(a,n);return Object.defineProperty(o,"toString",{value(){return`fn:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, r), () => ("<unnamed>"))}`}}),o}function Mn(e,t){let r={[_chunkODKBWWHUcjs.a]:{implementation:e[_chunkODKBWWHUcjs.a].implementation,argTypes:e[_chunkODKBWWHUcjs.a].argTypes},resourceType:"function",shell:e.shell,"~providing":{inner:e,pairs:t},$uses(o){return e.$uses(o),this},[_chunkODKBWWHUcjs.b]:e,$name(o){return e.$name(o),this},with(o,s){return Mn(a,[...t,[ge(o)?o.slot:o,s]])}},n=_chunkODKBWWHUcjs.N.call(void 0, (...o)=>e(...o),(...o)=>({value:new Pt(a,o.map(s=>s.value)),dataType:_nullishCoalesce(e.shell.returnType, () => (U))}),e.shell.argTypes),a=Object.assign(n,r);return Object.defineProperty(a,"toString",{value(){return`fn:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, e), () => ("<unnamed>"))}[${t.map($a).join(", ")}]`}}),a[_chunkODKBWWHUcjs.a].implementation=e[_chunkODKBWWHUcjs.a].implementation,a}var Pt=class{constructor(t,r){this._fn=t;this._params=r;this[_chunkODKBWWHUcjs.b]=t}"~resolve"(t){return t.resolve(`${t.resolve(this._fn)}(${this._params.map(r=>t.resolve(r)).join(", ")})`)}toString(){return`call:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}};function Nn(e){let t={argTypes:e.in&&Object.keys(e.in).length!==0?[$e(e.in)]:[],targets:e.out,returnType:Ct(e.out),isEntry:!0},r=(n,...a)=>Ea(t,se(n,...a));return Object.assign(Object.assign(r,t),{does:r})}function Ea(e,t){let r=oe(e,t),n=e.returnType,a=e.argTypes[0];return typeof t=="string"&&Be(t,n,s=>r.applyExternals(s)),{shell:e,outputType:n,$uses(s){return r.applyExternals(s),this},[_chunkODKBWWHUcjs.b]:r,$name(s){return _chunkODKBWWHUcjs.d.call(void 0, r,s),_chunkODKBWWHUcjs.e.call(void 0, n)&&n.$name(`${s}_Output`),_chunkODKBWWHUcjs.e.call(void 0, a)&&a.$name(`${s}_Input`),this},"~resolve"(s){if(typeof t=="string")return r.resolve(s,"@fragment ");let i=s;if(i.callStack===void 0)throw new Error("Cannot resolve a TGSL function outside of a generation context");try{return i.callStack.push(n),r.resolve(s,"@fragment ")}finally{i.callStack.pop()}},toString(){return`fragmentFn:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, r), () => ("<unnamed>"))}`}}}function jn(e){let t={attributes:[_nullishCoalesce(e.in, () => ({}))],returnType:Object.keys(e.out).length!==0?Ct(e.out):void 0,argTypes:e.in&&Object.keys(e.in).length!==0?[$e(e.in)]:[],isEntry:!0},r=(n,...a)=>La(t,se(n,...a));return Object.assign(Object.assign(r,t),{does:r})}function La(e,t){let r=oe(e,t),n=e.returnType,a=e.argTypes[0];return typeof t=="string"&&Be(t,n,o=>r.applyExternals(o)),{shell:e,outputType:n,inputType:a,$uses(o){return r.applyExternals(o),this},[_chunkODKBWWHUcjs.b]:r,$name(o){return _chunkODKBWWHUcjs.d.call(void 0, r,o),_chunkODKBWWHUcjs.e.call(void 0, n)&&n.$name(`${o}_Output`),_chunkODKBWWHUcjs.e.call(void 0, a)&&a.$name(`${o}_Input`),this},"~resolve"(o){if(typeof t=="string")return r.resolve(o,"@vertex ");let s=o;if(s.callStack===void 0)throw new Error("Cannot resolve a TGSL function outside of a generation context");try{return s.callStack.push(n),r.resolve(o,"@vertex ")}finally{s.callStack.pop()}},toString(){return`vertexFn:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, r), () => ("<unnamed>"))}`}}}var ie= (_class20 =class{constructor() { _class20.prototype.__init47.call(this); }__init47() {this.lastUniqueId=0}makeUnique(t){let r;return t?(r=t.replaceAll(/\s/g,"_"),r=r.replaceAll(/[^\w\d]/g,"")):r="item",`${r}_${this.lastUniqueId++}`}}, _class20),ue= exports.StrictNameRegistry = (_class21 =class{constructor() { _class21.prototype.__init48.call(this); }__init48() {this._usedNames=new Set}makeUnique(t){if(t===void 0)throw new Error("Unnamed item found when using a strict name registry");let r=0,n=t;for(;this._usedNames.has(n);)r++,n=`${t}_${r}`;return this._usedNames.add(n),n}}, _class21);function zn(e){let{externals:t,template:r,names:n,unstable_jitTranspiler:a}=e,o={};Q(o,_nullishCoalesce(t, () => ({})));let s={"~resolve"(l){return ye(l,o,_nullishCoalesce(r, () => ("")))},toString:()=>"<root>"},{code:i}=Ve(s,{names:n==="strict"?new ue:new ie,jitTranspiler:a});return i}var tt= (_class22 =class{constructor(t){;_class22.prototype.__init49.call(this);this._make=t}__init49() {this._map=new WeakMap}getOrMake(t,...r){if(this._map.has(t))return this._map.get(t);let n=this._make(t,...r);return this._map.set(t,n),n}}, _class22);function Kn(e,t,r){return new Vr(new $r(e,t,r),{})}function Hn(e){let t=e;return _optionalChain([t, 'optionalAccess', _91 => _91.resourceType])==="compute-pipeline"&&!!t[_chunkODKBWWHUcjs.a]}var Vr= (_class23 =class e{constructor(t,r){;_class23.prototype.__init50.call(this);this._core=t;this._priors=r;this[_chunkODKBWWHUcjs.a]={get rawPipeline(){return t.unwrap().pipeline}},this[_chunkODKBWWHUcjs.b]=t}__init50() {this.resourceType="compute-pipeline"}get rawPipeline(){return this._core.unwrap().pipeline}with(t,r){return new e(this._core,{bindGroupLayoutMap:new Map([..._nullishCoalesce(this._priors.bindGroupLayoutMap, () => ([])),[t,r]])})}dispatchWorkgroups(t,r,n){let a=this._core.unwrap(),{branch:o}=this._core,s=o.commandEncoder.beginComputePass({label:_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this._core), () => ("<unnamed>"))});s.setPipeline(a.pipeline);let i=new Set(a.bindGroupLayouts);if(a.bindGroupLayouts.forEach((l,u)=>{if(a.catchall&&u===a.catchall[0])s.setBindGroup(u,o.unwrap(a.catchall[1])),i.delete(l);else{let d=_optionalChain([this, 'access', _92 => _92._priors, 'access', _93 => _93.bindGroupLayoutMap, 'optionalAccess', _94 => _94.get, 'call', _95 => _95(l)]);d!==void 0&&(i.delete(l),s.setBindGroup(u,o.unwrap(d)))}}),i.size>0)throw new (0, _chunkODKBWWHUcjs.k)(i);s.dispatchWorkgroups(t,r,n),s.end()}$name(t){return _chunkODKBWWHUcjs.d.call(void 0, this._core,t),this}}, _class23),$r=class{constructor(t,r,n){this.branch=t;this._slotBindings=r;this._entryFn=n}unwrap(){if(this._memo===void 0){let t=this.branch.device,{code:r,bindGroupLayouts:n,catchall:a}=Ve({"~resolve":o=>(o.withSlots(this._slotBindings,()=>{o.resolve(this._entryFn)}),""),toString:()=>`computePipeline:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`},{names:this.branch.nameRegistry,jitTranspiler:this.branch.jitTranspiler});a!==null&&_optionalChain([n, 'access', _96 => _96[a[0]], 'optionalAccess', _97 => _97.$name, 'call', _98 => _98(`${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))} - Automatic Bind Group & Layout`)]),this._memo={pipeline:t.createComputePipeline({label:_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>")),layout:t.createPipelineLayout({label:`${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))} - Pipeline Layout`,bindGroupLayouts:n.map(o=>this.branch.unwrap(o))}),compute:{module:t.createShaderModule({label:`${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))} - Shader`,code:r})}}),bindGroupLayouts:n,catchall:a}}return this._memo}};function Lr(e,t="vertex"){return new Er(e,t)}function $t(e){return _optionalChain([e, 'optionalAccess', _99 => _99.resourceType])==="vertex-layout"}var kr=Symbol("defaultAttribEntry");function Vt(e,t,r,n,a){if(_chunkODKBWWHUcjs.K.call(void 0, t)||_chunkFHOQ6WZEcjs.g.call(void 0, t)){let o=_chunkFHOQ6WZEcjs.h.call(void 0, t);return o!==void 0&&(n[_nullishCoalesce(a, () => (kr))]=o),Vt(e,t.inner,_chunkFHOQ6WZEcjs.a.call(void 0, r,_chunkFHOQ6WZEcjs.$.call(void 0, t)),n)}if(_chunkODKBWWHUcjs.C.call(void 0, t)){let o=r;return Object.fromEntries(Object.entries(t.propTypes).map(([s,i])=>{o=_chunkFHOQ6WZEcjs.a.call(void 0, o,_chunkFHOQ6WZEcjs._.call(void 0, i));let l=[s,Vt(e,i,o,n,s)];return o+=_chunkFHOQ6WZEcjs.ba.call(void 0, i),l}))}if(_chunkFHOQ6WZEcjs.f.call(void 0, t)){let o=r;return Object.fromEntries(Object.entries(t.propTypes).map(([s,i])=>{o=_chunkFHOQ6WZEcjs.a.call(void 0, o,_chunkFHOQ6WZEcjs.$.call(void 0, i));let l=[s,Vt(e,i,o,n,s)];return o+=_chunkFHOQ6WZEcjs.ba.call(void 0, i),l}))}if("type"in t&&typeof t.type=="string"){if(_chunkFHOQ6WZEcjs.b.includes(t.type))return{_layout:e,format:t.type,offset:r};let o=_chunkFHOQ6WZEcjs.c[t.type];if(o)return{_layout:e,format:o,offset:r}}throw new Error(`Unsupported data used in vertex layout: ${String(t)}`)}var Er= (_class24 =class{constructor(t,r){;_class24.prototype.__init51.call(this);_class24.prototype.__init52.call(this);this.schemaForCount=t;this.stepMode=r;let n=t(0);this.stride=_chunkFHOQ6WZEcjs.a.call(void 0, _chunkFHOQ6WZEcjs.ba.call(void 0, n.elementType),_chunkFHOQ6WZEcjs._.call(void 0, n)),this.attrib=Vt(this,n.elementType,0,this._customLocationMap)}__init51() {this.resourceType="vertex-layout"}__init52() {this._customLocationMap={}}get vertexLayout(){if(this._customLocationMap[kr]!==void 0){if(typeof this.attrib.format!="string"||typeof this.attrib.offset!="number")throw new Error("Single attribute vertex layouts must have a format and offset.");return{arrayStride:this.stride,stepMode:this.stepMode,attributes:[{format:this.attrib.format,offset:this.attrib.offset,shaderLocation:this._customLocationMap[kr]}]}}if(!Object.keys(this.attrib).every(r=>this._customLocationMap[r]!==void 0))throw new Error("All attributes must have custom locations in order to unwrap a vertex layout.");return{arrayStride:this.stride,stepMode:this.stepMode,attributes:[...Object.entries(this.attrib).map(([r,n])=>({format:n.format,offset:n.offset,shaderLocation:this._customLocationMap[r]}))]}}$name(t){return _chunkODKBWWHUcjs.d.call(void 0, this,t),this}}, _class24);function _a(e){return typeof _optionalChain([e, 'optionalAccess', _100 => _100.loadOp])=="string"}function qn(e,t){if(_chunkFHOQ6WZEcjs.i.call(void 0, e)){if(!_a(t))throw new Error("Expected a single color attachment, not a record.");return[t]}let r=[];for(let n of Object.keys(e)){let a=t[n];if(!a)throw new Error(`A color attachment by the name of '${n}' was not provided to the shader.`);r.push(a)}return r}function Oa(e){return typeof _optionalChain([e, 'optionalAccess', _101 => _101.format])=="string"}function Jn(e,t){if(_chunkFHOQ6WZEcjs.i.call(void 0, e)){if(_chunkODKBWWHUcjs.L.call(void 0, e))return[];if(!Oa(t))throw new Error("Expected a single color target configuration, not a record.");return[t]}let r=[];for(let n of Object.keys(e)){let a=t[n];if(!a)throw new Error(`A color target by the name of '${n}' was not provided to the shader.`);r.push(a)}return r}function Yn(e){return new _r(new Or(e),{})}function Qn(e){let t=e;return _optionalChain([t, 'optionalAccess', _102 => _102.resourceType])==="render-pipeline"&&!!t[_chunkODKBWWHUcjs.a]}var _r= (_class25 =class e{__init53() {this.resourceType="render-pipeline"}constructor(t,r){;_class25.prototype.__init53.call(this);this[_chunkODKBWWHUcjs.a]={core:t,priors:r},this[_chunkODKBWWHUcjs.b]=t}$name(t){return _chunkODKBWWHUcjs.d.call(void 0, this[_chunkODKBWWHUcjs.a].core,t),this}with(t,r){let n=this[_chunkODKBWWHUcjs.a];if(Ut(t))return new e(n.core,{...n.priors,bindGroupLayoutMap:new Map([..._nullishCoalesce(n.priors.bindGroupLayoutMap, () => ([])),[t,r]])});if($t(t))return new e(n.core,{...n.priors,vertexLayoutMap:new Map([..._nullishCoalesce(n.priors.vertexLayoutMap, () => ([])),[t,r]])});throw new Error("Unsupported value passed into .with()")}withColorAttachment(t){let r=this[_chunkODKBWWHUcjs.a];return new e(r.core,{...r.priors,colorAttachment:t})}withDepthStencilAttachment(t){let r=this[_chunkODKBWWHUcjs.a];return new e(r.core,{...r.priors,depthStencilAttachment:t})}draw(t,r,n,a){let o=this[_chunkODKBWWHUcjs.a],s=o.core.unwrap(),{branch:i,fragmentFn:l}=o.core.options,d={colorAttachments:qn(l.shell.targets,_nullishCoalesce(o.priors.colorAttachment, () => ({}))).map(T=>X(T.view)?{...T,view:i.unwrap(T.view).createView()}:T)},g=_chunkODKBWWHUcjs.c.call(void 0, o.core);if(g!==void 0&&(d.label=g),o.priors.depthStencilAttachment!==void 0){let T=o.priors.depthStencilAttachment;X(T.view)?d.depthStencilAttachment={...T,view:i.unwrap(T.view).createView()}:d.depthStencilAttachment=T}let c=i.commandEncoder.beginRenderPass(d);c.setPipeline(s.pipeline);let y=new Set(s.bindGroupLayouts);s.bindGroupLayouts.forEach((T,D)=>{if(s.catchall&&D===s.catchall[0])c.setBindGroup(D,i.unwrap(s.catchall[1])),y.delete(T);else{let ke=_optionalChain([o, 'access', _103 => _103.priors, 'access', _104 => _104.bindGroupLayoutMap, 'optionalAccess', _105 => _105.get, 'call', _106 => _106(T)]);ke!==void 0&&(y.delete(T),c.setBindGroup(D,i.unwrap(ke)))}});let x=new Set(o.core.usedVertexLayouts);if(o.core.usedVertexLayouts.forEach((T,D)=>{let ke=_optionalChain([o, 'access', _107 => _107.priors, 'access', _108 => _108.vertexLayoutMap, 'optionalAccess', _109 => _109.get, 'call', _110 => _110(T)]);ke&&(x.delete(T),c.setVertexBuffer(D,i.unwrap(ke)))}),y.size>0)throw new (0, _chunkODKBWWHUcjs.k)(y);if(x.size>0)throw new (0, _chunkODKBWWHUcjs.l)(x);c.draw(t,r,n,a),c.end(),i.flush()}}, _class25),Or=class{constructor(t){this.options=t;let r=Tn(t.vertexFn.shell.attributes[0],t.vertexAttribs);this._vertexBufferLayouts=r.bufferDefinitions,this.usedVertexLayouts=r.usedVertexLayouts,this._targets=Jn(t.fragmentFn.shell.targets,t.targets)}unwrap(){if(this._memo===void 0){let{branch:t,vertexFn:r,fragmentFn:n,slotBindings:a,primitiveState:o,depthStencilState:s,multisampleState:i}=this.options,{code:l,bindGroupLayouts:u,catchall:d}=Ve({"~resolve":h=>(h.withSlots(a,()=>{h.resolve(r),h.resolve(n)}),""),toString:()=>`renderPipeline:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`},{names:t.nameRegistry,jitTranspiler:t.jitTranspiler});d!==null&&_optionalChain([u, 'access', _111 => _111[d[0]], 'optionalAccess', _112 => _112.$name, 'call', _113 => _113(`${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))} - Automatic Bind Group & Layout`)]);let g=t.device,c=g.createShaderModule({label:`${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))} - Shader`,code:l}),y={layout:g.createPipelineLayout({label:`${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))} - Pipeline Layout`,bindGroupLayouts:u.map(h=>t.unwrap(h))}),vertex:{module:c,buffers:this._vertexBufferLayouts},fragment:{module:c,targets:this._targets}},x=_chunkODKBWWHUcjs.c.call(void 0, this);x!==void 0&&(y.label=x),o&&(y.primitive=o),s&&(y.depthStencil=s),i&&(y.multisample=i),this._memo={pipeline:g.createRenderPipeline(y),bindGroupLayouts:u,catchall:d}}return this._memo}};var Gr=class e{constructor(t,r){this._getRoot=t;this._slotBindings=r}with(t,r){return new e(this._getRoot,[...this._slotBindings,[ge(t)?t.slot:t,r]])}withCompute(t){return new Wr(this._getRoot(),this._slotBindings,t)}withVertex(t,r){return new Mr({branch:this._getRoot(),primitiveState:void 0,depthStencilState:void 0,slotBindings:this._slotBindings,vertexFn:t,vertexAttribs:r,multisampleState:void 0})}},Wr=class{constructor(t,r,n){this._root=t;this._slotBindings=r;this._entryFn=n}createPipeline(){return Kn(this._root,this._slotBindings,this._entryFn)}},Mr=class{constructor(t){this._options=t}withFragment(t,r,n){return _chunkODKBWWHUcjs.f.call(void 0, typeof t!="string","Just type mismatch validation"),_chunkODKBWWHUcjs.f.call(void 0, typeof r!="string","Just type mismatch validation"),new Nr({...this._options,fragmentFn:t,targets:r})}},Nr=class e{constructor(t){this._options=t}withPrimitive(t){return new e({...this._options,primitiveState:t})}withDepthStencil(t){return new e({...this._options,depthStencilState:t})}withMultisample(t){return new e({...this._options,multisampleState:t})}createPipeline(){return Yn(this._options)}},kt= (_class26 =class extends Gr{constructor(r,n,a,o){super(()=>this,[]);_class26.prototype.__init54.call(this);_class26.prototype.__init55.call(this);_class26.prototype.__init56.call(this);_class26.prototype.__init57.call(this);;this.device=r;this.nameRegistry=n;this.jitTranspiler=a;this._ownDevice=o;this["~unstable"]=this}__init54() {this._disposables=[]}__init55() {this._unwrappedBindGroupLayouts=new tt(r=>r.unwrap(this))}__init56() {this._unwrappedBindGroups=new tt(r=>r.unwrap(this))}__init57() {this._commandEncoder=null}get commandEncoder(){return this._commandEncoder||(this._commandEncoder=this.device.createCommandEncoder()),this._commandEncoder}createBuffer(r,n){let a=Fn(this,r,n);return this._disposables.push(a),a}createUniform(r,n){return this.createBuffer(r,n).$usage("uniform").as("uniform")}createMutable(r,n){return this.createBuffer(r,n).$usage("storage").as("mutable")}createReadonly(r,n){return this.createBuffer(r,n).$usage("storage").as("readonly")}createBindGroup(r,n){return new Pe(r,n)}destroy(){for(let r of this._disposables)r.destroy();this._ownDevice&&this.device.destroy()}createTexture(r){let n=Cn(r,this);return this._disposables.push(n),n}unwrap(r){if(Hn(r))return r[_chunkODKBWWHUcjs.a].rawPipeline;if(Qn(r))return r[_chunkODKBWWHUcjs.a].core.unwrap().pipeline;if(Ut(r))return this._unwrappedBindGroupLayouts.getOrMake(r);if(Fr(r))return this._unwrappedBindGroups.getOrMake(r);if(ae(r))return r.buffer;if(X(r))return r[_chunkODKBWWHUcjs.a].unwrap();if(Ze(r)){if(r[_chunkODKBWWHUcjs.a].unwrap)return r[_chunkODKBWWHUcjs.a].unwrap();throw new Error("Cannot unwrap laid-out texture view.")}if(et(r)){if(r[_chunkODKBWWHUcjs.a].unwrap)return r[_chunkODKBWWHUcjs.a].unwrap();throw new Error("Cannot unwrap laid-out texture view.")}if($t(r))return r.vertexLayout;if(Ye(r)){if(r[_chunkODKBWWHUcjs.a].unwrap)return r[_chunkODKBWWHUcjs.a].unwrap(this);throw new Error("Cannot unwrap laid-out sampler.")}if(Qe(r)){if(r[_chunkODKBWWHUcjs.a].unwrap)return r[_chunkODKBWWHUcjs.a].unwrap(this);throw new Error("Cannot unwrap laid-out comparison sampler.")}throw new Error(`Unknown resource type: ${r}`)}beginRenderPass(r,n){let a=this.commandEncoder.beginRenderPass(r),o=new Map,s=new Map,i,l=()=>{if(!i)throw new Error("Cannot draw without a call to pass.setPipeline");let{core:u,priors:d}=i[_chunkODKBWWHUcjs.a],g=u.unwrap();a.setPipeline(g.pipeline);let c=new Set(g.bindGroupLayouts);g.bindGroupLayouts.forEach((x,h)=>{if(g.catchall&&h===g.catchall[0])a.setBindGroup(h,this.unwrap(g.catchall[1])),c.delete(x);else{let T=_nullishCoalesce(_optionalChain([d, 'access', _114 => _114.bindGroupLayoutMap, 'optionalAccess', _115 => _115.get, 'call', _116 => _116(x)]), () => (o.get(x)));T!==void 0&&(c.delete(x),Fr(T)?a.setBindGroup(h,this.unwrap(T)):a.setBindGroup(h,T))}});let y=new Set;if(u.usedVertexLayouts.forEach((x,h)=>{let T=_optionalChain([d, 'access', _117 => _117.vertexLayoutMap, 'optionalAccess', _118 => _118.get, 'call', _119 => _119(x)]),D=T?{buffer:T,offset:void 0,size:void 0}:s.get(x);!D||!D.buffer?y.add(x):ae(D.buffer)?a.setVertexBuffer(h,this.unwrap(D.buffer),D.offset,D.size):a.setVertexBuffer(h,D.buffer,D.offset,D.size)}),c.size>0)throw new (0, _chunkODKBWWHUcjs.k)(c);if(y.size>0)throw new (0, _chunkODKBWWHUcjs.l)(y)};n({setViewport(...u){a.setViewport(...u)},setScissorRect(...u){a.setScissorRect(...u)},setBlendConstant(...u){a.setBlendConstant(...u)},setStencilReference(...u){a.setStencilReference(...u)},beginOcclusionQuery(...u){a.beginOcclusionQuery(...u)},endOcclusionQuery(...u){a.endOcclusionQuery(...u)},executeBundles(...u){a.executeBundles(...u)},setPipeline(u){i=u},setIndexBuffer:(u,d,g,c)=>{ae(u)?a.setIndexBuffer(this.unwrap(u),d,g,c):a.setIndexBuffer(u,d,g,c)},setVertexBuffer(u,d,g,c){s.set(u,{buffer:d,offset:g,size:c})},setBindGroup(u,d){o.set(u,d)},draw(u,d,g,c){l(),a.draw(u,d,g,c)},drawIndexed(...u){l(),a.drawIndexed(...u)},drawIndirect(...u){l(),a.drawIndirect(...u)},drawIndexedIndirect(...u){l(),a.drawIndexedIndirect(...u)}}),a.end()}flush(){this._commandEncoder&&(this.device.queue.submit([this._commandEncoder.finish()]),this._commandEncoder=null)}}, _class26);async function Xn(e){let{adapter:t,device:r,unstable_names:n="random",unstable_jitTranspiler:a}=_nullishCoalesce(e, () => ({}));if(!navigator.gpu)throw new Error("WebGPU is not supported by this browser.");let o=await navigator.gpu.requestAdapter(t);if(!o)throw new Error("Could not find a compatible GPU");return new kt(await o.requestDevice(r),n==="random"?new ie:new ue,a,!0)}function Zn(e){let{device:t,unstable_names:r="random",unstable_jitTranspiler:n}=_nullishCoalesce(e, () => ({}));return new kt(t,r==="random"?new ie:new ue,n,!1)}function Et(e){return new jr(e)}var jr= (_class27 =class{constructor(t=void 0){;_class27.prototype.__init58.call(this);this.defaultValue=t}__init58() {this.resourceType="slot"}$name(t){return _chunkODKBWWHUcjs.d.call(void 0, this,t),this}areEqual(t,r){return Object.is(t,r)}toString(){return`slot:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}get value(){let t=_chunkODKBWWHUcjs.o.call(void 0, );if(!t)throw new Error("Cannot access tgpu.slot's value outside of resolution.");return ze(t.unwrap(this))}}, _class27);function ea(e,t){return new zr(e,t)}var zr= (_class28 =class{constructor(t,r=void 0){;_class28.prototype.__init59.call(this);this.schema=t;this.defaultValue=r;this.slot=Et(r),this[_chunkODKBWWHUcjs.b]=this.slot}__init59() {this.resourceType="accessor"}$name(t){return this.slot.$name(t),this}toString(){return`accessor:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}get value(){if(!_chunkODKBWWHUcjs.o.call(void 0, ))throw new Error("Cannot access tgpu.accessor's value outside of resolution.");return new Proxy({"~resolve":r=>r.resolve(this),toString:()=>`.value:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`,[_chunkODKBWWHUcjs.a]:{dataType:this.schema}},Y)}"~resolve"(t){let r=t.unwrap(this.slot);return lt(r)?t.resolve(r):Pr(r)?`${t.resolve(r)}()`:t.resolveValue(r,this.schema)}}, _class28);function ta(e){return Wa(e)}function Ga([e,t]){return`${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, e), () => ("<unnamed>"))}=${t}`}function Wa(e){if(_chunkODKBWWHUcjs.o.call(void 0, ))throw new Error("Cannot create tgpu.derived objects at the resolution stage.");return{resourceType:"derived","~compute":e,[_chunkODKBWWHUcjs.s]:void 0,get value(){let r=_chunkODKBWWHUcjs.o.call(void 0, );if(!r)throw new Error("Cannot access tgpu.derived's value outside of resolution.");return ze(r.unwrap(this))},with(r,n){return ra(this,[[r,n]])},toString(){return"derived"}}}function ra(e,t){return{resourceType:"derived",[_chunkODKBWWHUcjs.s]:void 0,"~compute"(){throw new Error("'~compute' should never be read on bound derived items.")},"~providing":{inner:e,pairs:t},get value(){let n=_chunkODKBWWHUcjs.o.call(void 0, );if(!n)throw new Error("Cannot access tgpu.derived's value outside of resolution.");return ze(n.unwrap(this))},with(n,a){return ra(e,[...t,[n,a]])},toString(){return`derived[${t.map(Ga).join(", ")}]`}}}function na(e,t){return new Lt("private",e,t)}function aa(e){return new Lt("workgroup",e)}var Lt=class{constructor(t,r,n){this.scope=t;this._dataType=r;this._initialValue=n}"~resolve"(t){let r=t.names.makeUnique(_chunkODKBWWHUcjs.c.call(void 0, this));return this._initialValue?t.addDeclaration(`var<${this.scope}> ${r}: ${t.resolve(this._dataType)} = ${t.resolveValue(this._initialValue,this._dataType)};`):t.addDeclaration(`var<${this.scope}> ${r}: ${t.resolve(this._dataType)};`),r}$name(t){return _chunkODKBWWHUcjs.d.call(void 0, this,t),this}toString(){return`var:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`}get value(){if(!_chunkODKBWWHUcjs.r.call(void 0, ))throw new Error("Cannot access tgpu.var's value directly in JS.");return new Proxy({"~resolve":t=>t.resolve(this),toString:()=>`.value:${_nullishCoalesce(_chunkODKBWWHUcjs.c.call(void 0, this), () => ("<unnamed>"))}`,[_chunkODKBWWHUcjs.a]:{dataType:this._dataType}},Y)}};var oa={bindGroupLayout:It,vertexLayout:Lr,init:Xn,initFromDevice:Zn,resolve:zn,"~unstable":{fn:Wn,fragmentFn:Nn,vertexFn:jn,computeFn:Gn,vertexLayout:Lr,derived:ta,slot:Et,accessor:ea,privateVar:na,workgroupVar:aa,const:ln,declare:mn,sampler:An,comparisonSampler:In}},jp= exports.default =oa;Object.assign(oa,{__assignAst:cn,__removedJsImpl:yn});exports.MissingBindGroupsError = _chunkODKBWWHUcjs.k; exports.MissingLinksError = _chunkODKBWWHUcjs.j; exports.MissingSlotValueError = _chunkODKBWWHUcjs.h; exports.MissingVertexBuffersError = _chunkODKBWWHUcjs.l; exports.NotUniformError = _chunkODKBWWHUcjs.i; exports.RandomNameRegistry = ie; exports.ResolutionError = _chunkODKBWWHUcjs.g; exports.StrictNameRegistry = ue; exports.default = jp; exports.isBuffer = ae; exports.isComparisonSampler = Qe; exports.isDerived = q; exports.isSampledTextureView = et; exports.isSampler = Ye; exports.isSlot = H; exports.isStorageTextureView = Ze; exports.isTexture = X; exports.isTgpuFn = Pr; exports.isUsableAsRender = Fa; exports.isUsableAsSampled = Sr; exports.isUsableAsStorage = xe; exports.isUsableAsUniform = xt; exports.isUsableAsVertex = Da; exports.tgpu = oa; exports.unstable_asMutable = mr; exports.unstable_asReadonly = fr; exports.unstable_asUniform = gr;
|
30
|
+
`)}${r}`}finally{_chunkBJSN5UVVcjs.u.call(void 0, _chunkBJSN5UVVcjs.q.GPU)}return this._getOrInstantiate(t)}return String(t)}resolveValue(t,r){if(ct(t))return this.resolve(t);if(r&&_chunkBJSN5UVVcjs.L.call(void 0, r))return`array(${t.map(n=>this.resolveValue(n,r.elementType))})`;if(Array.isArray(t))return`array(${t.map(n=>this.resolveValue(n))})`;if(r&&_chunkBJSN5UVVcjs.M.call(void 0, r))return`${this.resolve(r)}(${Object.entries(r.propTypes).map(([n,a])=>this.resolveValue(t[n],a))})`;throw new Error(`Value ${t} (as json: ${JSON.stringify(t)}) of schema ${r} is not resolvable to WGSL`)}}, _class21);function $e(e,t){let r=new $r(t),n=r.resolve(e),a=r.bindGroupLayoutsToPlaceholderMap,o=[],i=new Set([...a.keys()].map(m=>m.index).filter(m=>m!==void 0)),s=_chunkBJSN5UVVcjs.fa.call(void 0, i),l=r.fixedBindings.map((m,g)=>[String(g),m.layoutEntry]),u=()=>{let m=s.next().value,g=Bt(Object.fromEntries(l));return o[m]=g,n=n.replaceAll(aa,String(m)),[m,new _e(g,Object.fromEntries(r.fixedBindings.map((T,x)=>[String(x),T.resource])))]},c=l.length>0?u():null;for(let[m,g]of a.entries()){let T=_nullishCoalesce(m.index, () => (s.next().value));o[T]=m,n=n.replaceAll(g,String(T))}return{code:n,bindGroupLayouts:o,catchall:c}}function so(e,t,r){let n=t.map(a=>`${a.value}: ${e.resolve(a.dataType)}`).join(", ");return r.type!=="void"?`(${n}) -> ${_chunkBZVU4Q6Acjs.ba.call(void 0, r)} ${e.resolve(r)}`:`(${n})`}function oa(e){let{externals:t,template:r,names:n,unstable_jitTranspiler:a}=e,o={};ye(o,_nullishCoalesce(t, () => ({})));let i={"~resolve"(l){return Te(l,o,_nullishCoalesce(r, () => ("")))},toString:()=>"<root>"},{code:s}=$e(i,{names:n==="strict"?new se:new ie,jitTranspiler:a});return s}function ia(e,t,r,n){return new Er(e,t,r,n)}function rt(e){let t=e;return _optionalChain([t, 'optionalAccess', _95 => _95.resourceType])==="query-set"&&!!t[_chunkBJSN5UVVcjs.a]}var Er= (_class22 =class{constructor(t,r,n,a){;_class22.prototype.__init49.call(this);_class22.prototype.__init50.call(this);_class22.prototype.__init51.call(this);_class22.prototype.__init52.call(this);_class22.prototype.__init53.call(this);_class22.prototype.__init54.call(this);this._group=t;this.type=r;this.count=n;this.rawQuerySet=a;this._ownQuerySet=!a,this._querySet=a||null}__init49() {this.resourceType="query-set"}__init50() {this._querySet=null}__init51() {this._destroyed=!1}__init52() {this._available=!0}__init53() {this._readBuffer=null}__init54() {this._resolveBuffer=null}get querySet(){if(this._destroyed)throw new Error("This QuerySet has been destroyed.");return this.rawQuerySet?this.rawQuerySet:this._querySet?this._querySet:(this._querySet=this._group.device.createQuerySet({type:this.type,count:this.count}),this._querySet)}get destroyed(){return this._destroyed}get available(){return this._available}get[_chunkBJSN5UVVcjs.a](){let t=this;return{get readBuffer(){return t._readBuffer||(t._readBuffer=t._group.device.createBuffer({size:t.count*BigUint64Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})),t._readBuffer},get resolveBuffer(){return t._resolveBuffer||(t._resolveBuffer=t._group.device.createBuffer({size:t.count*BigUint64Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC})),t._resolveBuffer}}}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this._querySet&&(this._querySet.label=t),this}resolve(){if(this._destroyed)throw new Error("This QuerySet has been destroyed.");if(!this._available)throw new Error("This QuerySet is busy resolving or reading.");let t=this._group.device.createCommandEncoder();t.resolveQuerySet(this.querySet,0,this.count,this[_chunkBJSN5UVVcjs.a].resolveBuffer,0),this._group.device.queue.submit([t.finish()])}async read(){if(this._group.flush(),!this._resolveBuffer)throw new Error("QuerySet must be resolved before reading.");this._available=!1;try{let t=this._group.device.createCommandEncoder();t.copyBufferToBuffer(this[_chunkBJSN5UVVcjs.a].resolveBuffer,0,this[_chunkBJSN5UVVcjs.a].readBuffer,0,this.count*BigUint64Array.BYTES_PER_ELEMENT),this._group.device.queue.submit([t.finish()]),await this._group.device.queue.onSubmittedWorkDone();let r=this[_chunkBJSN5UVVcjs.a].readBuffer;await r.mapAsync(GPUMapMode.READ);let n=new BigUint64Array(r.getMappedRange().slice());return r.unmap(),Array.from(n)}finally{this._available=!0}}destroy(){this._destroyed||(this._destroyed=!0,this._querySet&&this._ownQuerySet&&this._querySet.destroy(),_optionalChain([this, 'access', _96 => _96._readBuffer, 'optionalAccess', _97 => _97.destroy, 'call', _98 => _98()]),_optionalChain([this, 'access', _99 => _99._resolveBuffer, 'optionalAccess', _100 => _100.destroy, 'call', _101 => _101()]),this._readBuffer=this._resolveBuffer=null)}}, _class22);var nt= (_class23 =class{constructor(t){;_class23.prototype.__init55.call(this);this._make=t}__init55() {this._map=new WeakMap}getOrMake(t,...r){if(this._map.has(t))return this._map.get(t);let n=this._make(t,...r);return this._map.set(t,n),n}}, _class23);function _t(e,t,r){if(!r.enabledFeatures.has("timestamp-query"))throw new Error('Performance callback requires the "timestamp-query" feature to be enabled on GPU device.');return e.timestampWrites?{...e,performanceCallback:t}:{...e,performanceCallback:t,hasAutoQuerySet:!0,timestampWrites:{querySet:r.createQuerySet("timestamp",2),beginningOfPassWriteIndex:0,endOfPassWriteIndex:1}}}function $t(e,t,r){if(!r.enabledFeatures.has("timestamp-query"))throw new Error('Timestamp writes require the "timestamp-query" feature to be enabled on GPU device.');e.hasAutoQuerySet&&e.timestampWrites&&e.timestampWrites.querySet.destroy();let n={querySet:t.querySet};return t.beginningOfPassWriteIndex!==void 0&&(n.beginningOfPassWriteIndex=t.beginningOfPassWriteIndex),t.endOfPassWriteIndex!==void 0&&(n.endOfPassWriteIndex=t.endOfPassWriteIndex),{...e,hasAutoQuerySet:!1,timestampWrites:n}}function Et(e,t){if(!e.timestampWrites)return{};let{querySet:r,beginningOfPassWriteIndex:n,endOfPassWriteIndex:a}=e.timestampWrites,o={querySet:rt(r)?t.unwrap(r):r};return n!==void 0&&(o.beginningOfPassWriteIndex=n),a!==void 0&&(o.endOfPassWriteIndex=a),{timestampWrites:o}}function Gt({root:e,priors:t}){let r=_optionalChain([t, 'access', _102 => _102.timestampWrites, 'optionalAccess', _103 => _103.querySet]),n=t.performanceCallback;if(!r)throw new Error("Cannot dispatch workgroups with performance callback without a query set.");if(!rt(r))throw new Error("Performance callback with raw GPUQuerySet is not supported. Use TgpuQuerySet instead.");e.commandEncoder.resolveQuerySet(e.unwrap(r),0,r.count,r[_chunkBJSN5UVVcjs.a].resolveBuffer,0),e.flush(),e.device.queue.onSubmittedWorkDone().then(async()=>{if(!r.available)return;let a=await r.read(),o=a[_nullishCoalesce(_optionalChain([t, 'access', _104 => _104.timestampWrites, 'optionalAccess', _105 => _105.beginningOfPassWriteIndex]), () => (0))],i=a[_nullishCoalesce(_optionalChain([t, 'access', _106 => _106.timestampWrites, 'optionalAccess', _107 => _107.endOfPassWriteIndex]), () => (1))];if(o===void 0||i===void 0)throw new Error("QuerySet did not return valid timestamps.");await n(o,i)})}function sa(e,t,r){return new Gr(new kr(e,t,r),{})}function ua(e){let t=e;return _optionalChain([t, 'optionalAccess', _108 => _108.resourceType])==="compute-pipeline"&&!!t[_chunkBJSN5UVVcjs.a]}var Gr= (_class24 =class e{constructor(t,r){;_class24.prototype.__init56.call(this);this._core=t;this._priors=r;this[_chunkBJSN5UVVcjs.a]={get rawPipeline(){return t.unwrap().pipeline},get priors(){return r}},this[_chunkBJSN5UVVcjs.d]=t}__init56() {this.resourceType="compute-pipeline"}get rawPipeline(){return this._core.unwrap().pipeline}with(t,r){return new e(this._core,{...this._priors,bindGroupLayoutMap:new Map([..._nullishCoalesce(this._priors.bindGroupLayoutMap, () => ([])),[t,r]])})}withPerformanceCallback(t){let r=_t(this._priors,t,this._core.branch);return new e(this._core,r)}withTimestampWrites(t){let r=$t(this._priors,t,this._core.branch);return new e(this._core,r)}dispatchWorkgroups(t,r,n){let a=this._core.unwrap(),{branch:o}=this._core,i={label:_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this._core), () => ("<unnamed>")),...Et(this._priors,o)},s=o.commandEncoder.beginComputePass(i);s.setPipeline(a.pipeline);let l=new Set(a.bindGroupLayouts);if(a.bindGroupLayouts.forEach((u,c)=>{if(a.catchall&&c===a.catchall[0])s.setBindGroup(c,o.unwrap(a.catchall[1])),l.delete(u);else{let m=_optionalChain([this, 'access', _109 => _109._priors, 'access', _110 => _110.bindGroupLayoutMap, 'optionalAccess', _111 => _111.get, 'call', _112 => _112(u)]);m!==void 0&&(l.delete(u),s.setBindGroup(c,o.unwrap(m)))}}),l.size>0)throw new (0, _chunkBJSN5UVVcjs.o)(l);s.dispatchWorkgroups(t,r,n),s.end(),this._priors.performanceCallback&&Gt({root:o,priors:this._priors})}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this._core,t),this}}, _class24),kr=class{constructor(t,r,n){this.branch=t;this._slotBindings=r;this._entryFn=n}unwrap(){if(this._memo===void 0){let t=this.branch.device,{code:r,bindGroupLayouts:n,catchall:a}=$e({"~resolve":o=>(o.withSlots(this._slotBindings,()=>{o.resolve(this._entryFn)}),""),toString:()=>`computePipeline:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`},{names:this.branch.nameRegistry,jitTranspiler:this.branch.jitTranspiler});a!==null&&_optionalChain([n, 'access', _113 => _113[a[0]], 'optionalAccess', _114 => _114.$name, 'call', _115 => _115(`${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))} - Automatic Bind Group & Layout`)]),this._memo={pipeline:t.createComputePipeline({label:_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>")),layout:t.createPipelineLayout({label:`${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))} - Pipeline Layout`,bindGroupLayouts:n.map(o=>this.branch.unwrap(o))}),compute:{module:t.createShaderModule({label:`${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))} - Shader`,code:r})}}),bindGroupLayouts:n,catchall:a}}return this._memo}};function Wr(e,t="vertex"){return new Or(e,t)}function Lt(e){return _optionalChain([e, 'optionalAccess', _116 => _116.resourceType])==="vertex-layout"}var Lr=Symbol("defaultAttribEntry");function kt(e,t,r,n,a){if(_chunkBJSN5UVVcjs.U.call(void 0, t)||_chunkBJSN5UVVcjs.Z.call(void 0, t)){let o=_chunkBJSN5UVVcjs.aa.call(void 0, t);return o!==void 0&&(n[_nullishCoalesce(a, () => (Lr))]=o),kt(e,t.inner,_chunkBZVU4Q6Acjs.a.call(void 0, r,_chunkBZVU4Q6Acjs.T.call(void 0, t)),n)}if(_chunkBJSN5UVVcjs.M.call(void 0, t)){let o=r;return Object.fromEntries(Object.entries(t.propTypes).map(([i,s])=>{o=_chunkBZVU4Q6Acjs.a.call(void 0, o,_chunkBZVU4Q6Acjs.S.call(void 0, s));let l=[i,kt(e,s,o,n,i)];return o+=_chunkBZVU4Q6Acjs.V.call(void 0, s),l}))}if(_chunkBJSN5UVVcjs.Y.call(void 0, t)){let o=r;return Object.fromEntries(Object.entries(t.propTypes).map(([i,s])=>{o=_chunkBZVU4Q6Acjs.a.call(void 0, o,_chunkBZVU4Q6Acjs.T.call(void 0, s));let l=[i,kt(e,s,o,n,i)];return o+=_chunkBZVU4Q6Acjs.V.call(void 0, s),l}))}if("type"in t&&typeof t.type=="string"){if(_chunkBJSN5UVVcjs.w.includes(t.type))return{_layout:e,format:t.type,offset:r};let o=_chunkBJSN5UVVcjs.x[t.type];if(o)return{_layout:e,format:o,offset:r}}throw new Error(`Unsupported data used in vertex layout: ${String(t)}`)}var Or= (_class25 =class{constructor(t,r){;_class25.prototype.__init57.call(this);_class25.prototype.__init58.call(this);this.schemaForCount=t;this.stepMode=r;let n=t(0);this.stride=_chunkBZVU4Q6Acjs.a.call(void 0, _chunkBZVU4Q6Acjs.V.call(void 0, n.elementType),_chunkBZVU4Q6Acjs.S.call(void 0, n)),this.attrib=kt(this,n.elementType,0,this._customLocationMap)}__init57() {this.resourceType="vertex-layout"}__init58() {this._customLocationMap={}}get vertexLayout(){if(this._customLocationMap[Lr]!==void 0){if(typeof this.attrib.format!="string"||typeof this.attrib.offset!="number")throw new Error("Single attribute vertex layouts must have a format and offset.");return{arrayStride:this.stride,stepMode:this.stepMode,attributes:[{format:this.attrib.format,offset:this.attrib.offset,shaderLocation:this._customLocationMap[Lr]}]}}if(!Object.keys(this.attrib).every(r=>this._customLocationMap[r]!==void 0))throw new Error("All attributes must have custom locations in order to unwrap a vertex layout.");return{arrayStride:this.stride,stepMode:this.stepMode,attributes:[...Object.entries(this.attrib).map(([r,n])=>({format:n.format,offset:n.offset,shaderLocation:this._customLocationMap[r]}))]}}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this}}, _class25);function uo(e){return typeof _optionalChain([e, 'optionalAccess', _117 => _117.loadOp])=="string"}function pa(e,t){if(_chunkBJSN5UVVcjs.ba.call(void 0, e)){if(!uo(t))throw new Error("Expected a single color attachment, not a record.");return[t]}let r=[];for(let n of Object.keys(e)){let a=t[n];if(!a)throw new Error(`A color attachment by the name of '${n}' was not provided to the shader.`);r.push(a)}return r}function po(e){return typeof _optionalChain([e, 'optionalAccess', _118 => _118.format])=="string"}function la(e,t){if(_chunkBJSN5UVVcjs.ba.call(void 0, e)){if(_chunkBJSN5UVVcjs.V.call(void 0, e))return[];if(!po(t))throw new Error("Expected a single color target configuration, not a record.");return[t]}let r=[];for(let n of Object.keys(e)){let a=t[n];if(!a)throw new Error(`A color target by the name of '${n}' was not provided to the shader.`);r.push(a)}return r}function ma(e){return new Mr(new Nr(e),{})}function da(e){let t=e;return _optionalChain([t, 'optionalAccess', _119 => _119.resourceType])==="render-pipeline"&&!!t[_chunkBJSN5UVVcjs.a]}var Mr= (_class26 =class e{__init59() {this.resourceType="render-pipeline"}constructor(t,r){;_class26.prototype.__init59.call(this);this[_chunkBJSN5UVVcjs.a]={core:t,priors:r},this[_chunkBJSN5UVVcjs.d]=t}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this[_chunkBJSN5UVVcjs.a].core,t),this}with(t,r){let n=this[_chunkBJSN5UVVcjs.a];if(Rt(t))return new e(n.core,{...n.priors,bindGroupLayoutMap:new Map([..._nullishCoalesce(n.priors.bindGroupLayoutMap, () => ([])),[t,r]])});if(Lt(t))return new e(n.core,{...n.priors,vertexLayoutMap:new Map([..._nullishCoalesce(n.priors.vertexLayoutMap, () => ([])),[t,r]])});throw new Error("Unsupported value passed into .with()")}withColorAttachment(t){let r=this[_chunkBJSN5UVVcjs.a];return new e(r.core,{...r.priors,colorAttachment:t})}withDepthStencilAttachment(t){let r=this[_chunkBJSN5UVVcjs.a];return new e(r.core,{...r.priors,depthStencilAttachment:t})}withPerformanceCallback(t){let r=this[_chunkBJSN5UVVcjs.a],n=_t(r.priors,t,r.core.options.branch);return new e(r.core,n)}withTimestampWrites(t){let r=this[_chunkBJSN5UVVcjs.a],n=$t(r.priors,t,r.core.options.branch);return new e(r.core,n)}draw(t,r,n,a){let o=this[_chunkBJSN5UVVcjs.a],i=o.core.unwrap(),{branch:s,fragmentFn:l}=o.core.options,u=pa(l.shell.targets,_nullishCoalesce(o.priors.colorAttachment, () => ({}))).map(y=>X(y.view)?{...y,view:s.unwrap(y.view).createView()}:y),c={label:_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, o.core), () => ("<unnamed>")),colorAttachments:u,...Et(o.priors,s)};if(o.priors.depthStencilAttachment!==void 0){let y=o.priors.depthStencilAttachment;X(y.view)?c.depthStencilAttachment={...y,view:s.unwrap(y.view).createView()}:c.depthStencilAttachment=y}let m=s.commandEncoder.beginRenderPass(c);m.setPipeline(i.pipeline);let g=new Set(i.bindGroupLayouts);i.bindGroupLayouts.forEach((y,F)=>{if(i.catchall&&F===i.catchall[0])m.setBindGroup(F,s.unwrap(i.catchall[1])),g.delete(y);else{let U=_optionalChain([o, 'access', _120 => _120.priors, 'access', _121 => _121.bindGroupLayoutMap, 'optionalAccess', _122 => _122.get, 'call', _123 => _123(y)]);U!==void 0&&(g.delete(y),m.setBindGroup(F,s.unwrap(U)))}});let T=new Set(o.core.usedVertexLayouts);if(o.core.usedVertexLayouts.forEach((y,F)=>{let U=_optionalChain([o, 'access', _124 => _124.priors, 'access', _125 => _125.vertexLayoutMap, 'optionalAccess', _126 => _126.get, 'call', _127 => _127(y)]);U&&(T.delete(y),m.setVertexBuffer(F,s.unwrap(U)))}),g.size>0)throw new (0, _chunkBJSN5UVVcjs.o)(g);if(T.size>0)throw new (0, _chunkBJSN5UVVcjs.p)(T);m.draw(t,r,n,a),m.end(),o.priors.performanceCallback?Gt({root:s,priors:o.priors}):s.flush()}}, _class26),Nr=class{constructor(t){this.options=t;let r=kn(t.vertexFn.shell.attributes[0],t.vertexAttribs);this._vertexBufferLayouts=r.bufferDefinitions,this.usedVertexLayouts=r.usedVertexLayouts,this._targets=la(t.fragmentFn.shell.targets,t.targets)}unwrap(){if(this._memo===void 0){let{branch:t,vertexFn:r,fragmentFn:n,slotBindings:a,primitiveState:o,depthStencilState:i,multisampleState:s}=this.options,{code:l,bindGroupLayouts:u,catchall:c}=$e({"~resolve":y=>(y.withSlots(a,()=>{y.resolve(r),y.resolve(n)}),""),toString:()=>`renderPipeline:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`},{names:t.nameRegistry,jitTranspiler:t.jitTranspiler});c!==null&&_optionalChain([u, 'access', _128 => _128[c[0]], 'optionalAccess', _129 => _129.$name, 'call', _130 => _130(`${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))} - Automatic Bind Group & Layout`)]);let m=t.device,g=m.createShaderModule({label:`${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))} - Shader`,code:l}),T={layout:m.createPipelineLayout({label:`${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))} - Pipeline Layout`,bindGroupLayouts:u.map(y=>t.unwrap(y))}),vertex:{module:g,buffers:this._vertexBufferLayouts},fragment:{module:g,targets:this._targets}},x=_chunkBJSN5UVVcjs.e.call(void 0, this);x!==void 0&&(T.label=x),o&&(T.primitive=o),i&&(T.depthStencil=i),s&&(T.multisample=s),this._memo={pipeline:m.createRenderPipeline(T),bindGroupLayouts:u,catchall:c}}return this._memo}};var jr=class e{constructor(t,r){this._getRoot=t;this._slotBindings=r}with(t,r){return new e(this._getRoot,[...this._slotBindings,[qe(t)?t.slot:t,r]])}withCompute(t){return new zr(this._getRoot(),this._slotBindings,t)}withVertex(t,r){return new qr({branch:this._getRoot(),primitiveState:void 0,depthStencilState:void 0,slotBindings:this._slotBindings,vertexFn:t,vertexAttribs:r,multisampleState:void 0})}},zr=class{constructor(t,r,n){this._root=t;this._slotBindings=r;this._entryFn=n}createPipeline(){return sa(this._root,this._slotBindings,this._entryFn)}},qr=class{constructor(t){this._options=t}withFragment(t,r,n){return _chunkBJSN5UVVcjs.j.call(void 0, typeof t!="string","Just type mismatch validation"),_chunkBJSN5UVVcjs.j.call(void 0, typeof r!="string","Just type mismatch validation"),new Qr({...this._options,fragmentFn:t,targets:r})}},Qr=class e{constructor(t){this._options=t}withPrimitive(t){return new e({...this._options,primitiveState:t})}withDepthStencil(t){return new e({...this._options,depthStencilState:t})}withMultisample(t){return new e({...this._options,multisampleState:t})}createPipeline(){return ma(this._options)}},Ot= (_class27 =class extends jr{constructor(r,n,a,o){super(()=>this,[]);_class27.prototype.__init60.call(this);_class27.prototype.__init61.call(this);_class27.prototype.__init62.call(this);_class27.prototype.__init63.call(this);;this.device=r;this.nameRegistry=n;this.jitTranspiler=a;this._ownDevice=o;this["~unstable"]=this}__init60() {this._disposables=[]}__init61() {this._unwrappedBindGroupLayouts=new nt(r=>r.unwrap(this))}__init62() {this._unwrappedBindGroups=new nt(r=>r.unwrap(this))}__init63() {this._commandEncoder=null}get commandEncoder(){return this._commandEncoder||(this._commandEncoder=this.device.createCommandEncoder()),this._commandEncoder}get enabledFeatures(){return new Set(this.device.features)}createBuffer(r,n){let a=qn(this,r,n);return this._disposables.push(a),a}createUniform(r,n){return this.createBuffer(r,n).$usage("uniform").as("uniform")}createMutable(r,n){return this.createBuffer(r,n).$usage("storage").as("mutable")}createReadonly(r,n){return this.createBuffer(r,n).$usage("storage").as("readonly")}createQuerySet(r,n,a){return ia(this,r,n,a)}createBindGroup(r,n){return new _e(r,n)}destroy(){for(let r of this._disposables)r.destroy();this._ownDevice&&this.device.destroy()}createTexture(r){let n=Xn(r,this);return this._disposables.push(n),n}unwrap(r){if(ua(r))return r[_chunkBJSN5UVVcjs.a].rawPipeline;if(da(r))return r[_chunkBJSN5UVVcjs.a].core.unwrap().pipeline;if(Rt(r))return this._unwrappedBindGroupLayouts.getOrMake(r);if(Br(r))return this._unwrappedBindGroups.getOrMake(r);if(pe(r))return r.buffer;if(X(r))return r[_chunkBJSN5UVVcjs.a].unwrap();if(et(r)){if(r[_chunkBJSN5UVVcjs.a].unwrap)return r[_chunkBJSN5UVVcjs.a].unwrap();throw new Error("Cannot unwrap laid-out texture view.")}if(tt(r)){if(r[_chunkBJSN5UVVcjs.a].unwrap)return r[_chunkBJSN5UVVcjs.a].unwrap();throw new Error("Cannot unwrap laid-out texture view.")}if(Lt(r))return r.vertexLayout;if(Ye(r)){if(r[_chunkBJSN5UVVcjs.a].unwrap)return r[_chunkBJSN5UVVcjs.a].unwrap(this);throw new Error("Cannot unwrap laid-out sampler.")}if(Xe(r)){if(r[_chunkBJSN5UVVcjs.a].unwrap)return r[_chunkBJSN5UVVcjs.a].unwrap(this);throw new Error("Cannot unwrap laid-out comparison sampler.")}if(rt(r))return r.querySet;throw new Error(`Unknown resource type: ${r}`)}beginRenderPass(r,n){let a=this.commandEncoder.beginRenderPass(r),o=new Map,i=new Map,s,l=()=>{if(!s)throw new Error("Cannot draw without a call to pass.setPipeline");let{core:u,priors:c}=s[_chunkBJSN5UVVcjs.a],m=u.unwrap();a.setPipeline(m.pipeline);let g=new Set(m.bindGroupLayouts);m.bindGroupLayouts.forEach((x,y)=>{if(m.catchall&&y===m.catchall[0])a.setBindGroup(y,this.unwrap(m.catchall[1])),g.delete(x);else{let F=_nullishCoalesce(_optionalChain([c, 'access', _131 => _131.bindGroupLayoutMap, 'optionalAccess', _132 => _132.get, 'call', _133 => _133(x)]), () => (o.get(x)));F!==void 0&&(g.delete(x),Br(F)?a.setBindGroup(y,this.unwrap(F)):a.setBindGroup(y,F))}});let T=new Set;if(u.usedVertexLayouts.forEach((x,y)=>{let F=_optionalChain([c, 'access', _134 => _134.vertexLayoutMap, 'optionalAccess', _135 => _135.get, 'call', _136 => _136(x)]),U=F?{buffer:F,offset:void 0,size:void 0}:i.get(x);!U||!U.buffer?T.add(x):pe(U.buffer)?a.setVertexBuffer(y,this.unwrap(U.buffer),U.offset,U.size):a.setVertexBuffer(y,U.buffer,U.offset,U.size)}),g.size>0)throw new (0, _chunkBJSN5UVVcjs.o)(g);if(T.size>0)throw new (0, _chunkBJSN5UVVcjs.p)(T)};n({setViewport(...u){a.setViewport(...u)},setScissorRect(...u){a.setScissorRect(...u)},setBlendConstant(...u){a.setBlendConstant(...u)},setStencilReference(...u){a.setStencilReference(...u)},beginOcclusionQuery(...u){a.beginOcclusionQuery(...u)},endOcclusionQuery(...u){a.endOcclusionQuery(...u)},executeBundles(...u){a.executeBundles(...u)},setPipeline(u){s=u},setIndexBuffer:(u,c,m,g)=>{pe(u)?a.setIndexBuffer(this.unwrap(u),c,m,g):a.setIndexBuffer(u,c,m,g)},setVertexBuffer(u,c,m,g){i.set(u,{buffer:c,offset:m,size:g})},setBindGroup(u,c){o.set(u,c)},draw(u,c,m,g){l(),a.draw(u,c,m,g)},drawIndexed(...u){l(),a.drawIndexed(...u)},drawIndirect(...u){l(),a.drawIndirect(...u)},drawIndexedIndirect(...u){l(),a.drawIndexedIndirect(...u)}}),a.end()}flush(){this._commandEncoder&&(this.device.queue.submit([this._commandEncoder.finish()]),this._commandEncoder=null)}}, _class27);async function fa(e){let{adapter:t,device:r,unstable_names:n="random",unstable_jitTranspiler:a}=_nullishCoalesce(e, () => ({}));if(!navigator.gpu)throw new Error("WebGPU is not supported by this browser.");let o=await navigator.gpu.requestAdapter(t);if(!o)throw new Error("Could not find a compatible GPU");let i=[];for(let s of _nullishCoalesce(_optionalChain([r, 'optionalAccess', _137 => _137.requiredFeatures]), () => ([]))){if(!o.features.has(s))throw new Error(`Requested feature "${s}" is not supported by the adapter.`);i.push(s)}for(let s of _nullishCoalesce(_optionalChain([r, 'optionalAccess', _138 => _138.optionalFeatures]), () => ([])))o.features.has(s)?i.push(s):console.warn(`Optional feature "${s}" is not supported by the adapter.`);return new Ot(await o.requestDevice({...r,requiredFeatures:i}),n==="random"?new ie:new se,a,!0)}function ca(e){let{device:t,unstable_names:r="random",unstable_jitTranspiler:n}=_nullishCoalesce(e, () => ({}));return new Ot(t,r==="random"?new ie:new se,n,!1)}function Wt(e){return new Kr(e)}var Kr= (_class28 =class{constructor(t=void 0){;_class28.prototype.__init64.call(this);this.defaultValue=t}__init64() {this.resourceType="slot"}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this}areEqual(t,r){return Object.is(t,r)}toString(){return`slot:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}[_chunkBJSN5UVVcjs.c](t){return je(t,t.unwrap(this))}get value(){let t=_chunkBJSN5UVVcjs.s.call(void 0, );if(!t)throw new Error("Cannot access tgpu.slot's value outside of resolution.");return this[_chunkBJSN5UVVcjs.c](t)}}, _class28);function ga(e,t){return new Hr(e,t)}var Hr= (_class29 =class{constructor(t,r=void 0){;_class29.prototype.__init65.call(this);this.schema=t;this.defaultValue=r;this.slot=Wt(r),this[_chunkBJSN5UVVcjs.d]=this.slot}__init65() {this.resourceType="accessor"}$name(t){return this.slot.$name(t),this}toString(){return`accessor:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}[_chunkBJSN5UVVcjs.c](){return new Proxy({"~resolve":t=>t.resolve(this),toString:()=>`.value:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`,[_chunkBJSN5UVVcjs.b]:this.schema},K)}get value(){if(!_chunkBJSN5UVVcjs.v.call(void 0, ))throw new Error("`tgpu.accessor` values are only accessible on the GPU");return this[_chunkBJSN5UVVcjs.c]()}"~resolve"(t){let r=t.unwrap(this.slot);return Sn(r)?t.resolve(r):mr(r)?`${t.resolve(r)}()`:t.resolveValue(r,this.schema)}}, _class29);function ya(e){return mo(e)}function lo([e,t]){return`${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, e), () => ("<unnamed>"))}=${t}`}function mo(e){if(_chunkBJSN5UVVcjs.s.call(void 0, ))throw new Error("Cannot create tgpu.derived objects at the resolution stage.");return{resourceType:"derived","~compute":e,[_chunkBJSN5UVVcjs.y]:void 0,"~gpuRepr":void 0,[_chunkBJSN5UVVcjs.c](r){return je(r,r.unwrap(this))},get value(){let r=_chunkBJSN5UVVcjs.s.call(void 0, );if(!r)throw new Error("Cannot access tgpu.derived's value outside of resolution.");return this[_chunkBJSN5UVVcjs.c](r)},with(r,n){return Ta(this,[[r,n]])},toString(){return"derived"}}}function Ta(e,t){return{resourceType:"derived",[_chunkBJSN5UVVcjs.y]:void 0,"~gpuRepr":void 0,"~compute"(){throw new Error("'~compute' should never be read on bound derived items.")},"~providing":{inner:e,pairs:t},[_chunkBJSN5UVVcjs.c](n){return je(n,n.unwrap(this))},get value(){let n=_chunkBJSN5UVVcjs.s.call(void 0, );if(!n)throw new Error("Cannot access tgpu.derived's value outside of resolution.");return this[_chunkBJSN5UVVcjs.c](n)},with(n,a){return Ta(e,[...t,[n,a]])},toString(){return`derived[${t.map(lo).join(", ")}]`}}}function xa(e,t){return new Mt("private",e,t)}function ha(e){return new Mt("workgroup",e)}var Mt=class{constructor(t,r,n){this.scope=t;this._dataType=r;this._initialValue=n;this[_chunkBJSN5UVVcjs.a]={scope:t}}"~resolve"(t){let r=t.names.makeUnique(_chunkBJSN5UVVcjs.e.call(void 0, this));return this._initialValue?t.addDeclaration(`var<${this.scope}> ${r}: ${t.resolve(this._dataType)} = ${t.resolveValue(this._initialValue,this._dataType)};`):t.addDeclaration(`var<${this.scope}> ${r}: ${t.resolve(this._dataType)};`),r}$name(t){return _chunkBJSN5UVVcjs.f.call(void 0, this,t),this}toString(){return`var:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`}[_chunkBJSN5UVVcjs.c](){return new Proxy({"~resolve":t=>t.resolve(this),toString:()=>`.value:${_nullishCoalesce(_chunkBJSN5UVVcjs.e.call(void 0, this), () => ("<unnamed>"))}`,[_chunkBJSN5UVVcjs.b]:this._dataType},K)}get value(){if(!_chunkBJSN5UVVcjs.v.call(void 0, ))throw new Error("`tgpu.var` values are only accessible on the GPU");return this[_chunkBJSN5UVVcjs.c]()}};var wa={bindGroupLayout:Bt,vertexLayout:Wr,init:fa,initFromDevice:ca,resolve:oa,"~unstable":{fn:_n,fragmentFn:En,vertexFn:Gn,computeFn:Vn,vertexLayout:Wr,derived:ya,slot:Wt,accessor:ga,privateVar:xa,workgroupVar:ha,const:wn,declare:Dn,sampler:Qn,comparisonSampler:Kn}},Vl= exports.default =wa;Object.assign(wa,{__assignAst:Fn,__removedJsImpl:In});exports.MissingBindGroupsError = _chunkBJSN5UVVcjs.o; exports.MissingLinksError = _chunkBJSN5UVVcjs.n; exports.MissingSlotValueError = _chunkBJSN5UVVcjs.l; exports.MissingVertexBuffersError = _chunkBJSN5UVVcjs.p; exports.NotUniformError = _chunkBJSN5UVVcjs.m; exports.RandomNameRegistry = ie; exports.ResolutionError = _chunkBJSN5UVVcjs.k; exports.StrictNameRegistry = se; exports.default = Vl; exports.isBuffer = pe; exports.isComparisonSampler = Xe; exports.isDerived = Be; exports.isSampledTextureView = tt; exports.isSampler = Ye; exports.isSlot = Pe; exports.isStorageTextureView = et; exports.isTexture = X; exports.isTgpuFn = mr; exports.isUsableAsRender = to; exports.isUsableAsSampled = Ur; exports.isUsableAsStorage = he; exports.isUsableAsUniform = bt; exports.isUsableAsVertex = eo; exports.tgpu = wa; exports.unstable_asMutable = Tr; exports.unstable_asReadonly = xr; exports.unstable_asUniform = hr;
|
30
31
|
//# sourceMappingURL=index.cjs.map
|