typegpu 0.5.4 → 0.5.6

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/std/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{g as k}from"../chunk-5PJ3H5OR.js";import{A as x,B as g,C as p,D as z,E as w,F as G,G as q,H as J,L as O,M as ye,O as F,W as h,o as s,q as l,r as i,s as T,t as m,u as v,v as y,w as u,x as d,y as f,z as o}from"../chunk-AKBL6GDL.js";var de=s(()=>{throw new Error("discard() can only be used on the GPU.")},()=>({value:"discard;",dataType:k}));var R=e=>Math.sqrt(e.x**2+e.y**2),K=e=>Math.sqrt(e.x**2+e.y**2+e.z**2),N=e=>Math.sqrt(e.x**2+e.y**2+e.z**2+e.w**2),C=(e,t)=>e.x*t.x+e.y*t.y,P=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z,_=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,c=(e,t,n)=>Math.min(Math.max(t,e),n),M=e=>t=>l(e(t.x),e(t.y)),b=e=>t=>i(e(t.x),e(t.y)),L=e=>t=>T(e(t.x),e(t.y)),j=e=>t=>m(e(t.x),e(t.y)),V=e=>t=>y(e(t.x),e(t.y),e(t.z)),A=e=>t=>u(e(t.x),e(t.y),e(t.z)),X=e=>t=>d(e(t.x),e(t.y),e(t.z)),Z=e=>t=>f(e(t.x),e(t.y),e(t.z)),I=e=>t=>x(e(t.x),e(t.y),e(t.z),e(t.w)),$=e=>t=>g(e(t.x),e(t.y),e(t.z),e(t.w)),H=e=>t=>p(e(t.x),e(t.y),e(t.z),e(t.w)),Q=e=>t=>z(e(t.x),e(t.y),e(t.z),e(t.w)),Y=e=>(t,n)=>l(e(t.x,n.x),e(t.y,n.y)),ee=e=>(t,n)=>i(e(t.x,n.x),e(t.y,n.y)),le=e=>(t,n)=>T(e(t.x,n.x),e(t.y,n.y)),ve=e=>(t,n)=>m(e(t.x,n.x),e(t.y,n.y)),te=e=>(t,n)=>y(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ne=e=>(t,n)=>u(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),oe=e=>(t,n)=>d(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),xe=e=>(t,n)=>f(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ae=e=>(t,n)=>x(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),se=e=>(t,n)=>g(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),we=e=>(t,n)=>p(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),ue=e=>(t,n)=>z(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),r={eq:{vec2f:(e,t)=>v(e.x===t.x,e.y===t.y),vec2h:(e,t)=>v(e.x===t.x,e.y===t.y),vec2i:(e,t)=>v(e.x===t.x,e.y===t.y),vec2u:(e,t)=>v(e.x===t.x,e.y===t.y),"vec2<bool>":(e,t)=>v(e.x===t.x,e.y===t.y),vec3f:(e,t)=>o(e.x===t.x,e.y===t.y,e.z===t.z),vec3h:(e,t)=>o(e.x===t.x,e.y===t.y,e.z===t.z),vec3i:(e,t)=>o(e.x===t.x,e.y===t.y,e.z===t.z),vec3u:(e,t)=>o(e.x===t.x,e.y===t.y,e.z===t.z),"vec3<bool>":(e,t)=>o(e.x===t.x,e.y===t.y,e.z===t.z),vec4f:(e,t)=>w(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4h:(e,t)=>w(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4i:(e,t)=>w(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4u:(e,t)=>w(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),"vec4<bool>":(e,t)=>w(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w)},lt:{vec2f:(e,t)=>v(e.x<t.x,e.y<t.y),vec2h:(e,t)=>v(e.x<t.x,e.y<t.y),vec2i:(e,t)=>v(e.x<t.x,e.y<t.y),vec2u:(e,t)=>v(e.x<t.x,e.y<t.y),vec3f:(e,t)=>o(e.x<t.x,e.y<t.y,e.z<t.z),vec3h:(e,t)=>o(e.x<t.x,e.y<t.y,e.z<t.z),vec3i:(e,t)=>o(e.x<t.x,e.y<t.y,e.z<t.z),vec3u:(e,t)=>o(e.x<t.x,e.y<t.y,e.z<t.z),vec4f:(e,t)=>w(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4h:(e,t)=>w(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4i:(e,t)=>w(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4u:(e,t)=>w(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w)},neg:{"vec2<bool>":e=>v(!e.x,!e.y),"vec3<bool>":e=>o(!e.x,!e.y,!e.z),"vec4<bool>":e=>w(!e.x,!e.y,!e.z,!e.w)},or:{"vec2<bool>":(e,t)=>v(e.x||t.x,e.y||t.y),"vec3<bool>":(e,t)=>o(e.x||t.x,e.y||t.y,e.z||t.z),"vec4<bool>":(e,t)=>w(e.x||t.x,e.y||t.y,e.z||t.z,e.w||t.w)},all:{"vec2<bool>":e=>e.x&&e.y,"vec3<bool>":e=>e.x&&e.y&&e.z,"vec4<bool>":e=>e.x&&e.y&&e.z&&e.w},abs:{vec2f:M(Math.abs),vec2h:b(Math.abs),vec2i:L(Math.abs),vec2u:j(Math.abs),vec3f:V(Math.abs),vec3h:A(Math.abs),vec3i:X(Math.abs),vec3u:Z(Math.abs),vec4f:I(Math.abs),vec4h:$(Math.abs),vec4i:H(Math.abs),vec4u:Q(Math.abs)},atan2:{vec2f:Y(Math.atan2),vec2h:ee(Math.atan2),vec3f:te(Math.atan2),vec3h:ne(Math.atan2),vec4f:ae(Math.atan2),vec4h:se(Math.atan2)},acos:{vec2f:M(Math.acos),vec2h:b(Math.acos),vec2i:L(Math.acos),vec2u:j(Math.acos),vec3f:V(Math.acos),vec3h:A(Math.acos),vec3i:X(Math.acos),vec3u:Z(Math.acos),vec4f:I(Math.acos),vec4h:$(Math.acos),vec4i:H(Math.acos),vec4u:Q(Math.acos)},asin:{vec2f:M(Math.asin),vec2h:b(Math.asin),vec2i:L(Math.asin),vec2u:j(Math.asin),vec3f:V(Math.asin),vec3h:A(Math.asin),vec3i:X(Math.asin),vec3u:Z(Math.asin),vec4f:I(Math.asin),vec4h:$(Math.asin),vec4i:H(Math.asin),vec4u:Q(Math.asin)},ceil:{vec2f:M(Math.ceil),vec2h:b(Math.ceil),vec3f:V(Math.ceil),vec3h:A(Math.ceil),vec4f:I(Math.ceil),vec4h:$(Math.ceil)},clamp:{vec2f:(e,t,n)=>l(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec2h:(e,t,n)=>i(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec2i:(e,t,n)=>T(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec2u:(e,t,n)=>m(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec3f:(e,t,n)=>y(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec3h:(e,t,n)=>u(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec3i:(e,t,n)=>d(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec3u:(e,t,n)=>f(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec4f:(e,t,n)=>x(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w)),vec4h:(e,t,n)=>g(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w)),vec4i:(e,t,n)=>p(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w)),vec4u:(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e.w-t.w)},mulSxV:{vec2f:(e,t)=>l(e*t.x,e*t.y),vec2h:(e,t)=>i(e*t.x,e*t.y),vec2i:(e,t)=>T(e*t.x,e*t.y),vec2u:(e,t)=>m(e*t.x,e*t.y),vec3f:(e,t)=>y(e*t.x,e*t.y,e*t.z),vec3h:(e,t)=>u(e*t.x,e*t.y,e*t.z),vec3i:(e,t)=>d(e*t.x,e*t.y,e*t.z),vec3u:(e,t)=>f(e*t.x,e*t.y,e*t.z),vec4f:(e,t)=>x(e*t.x,e*t.y,e*t.z,e*t.w),vec4h:(e,t)=>g(e*t.x,e*t.y,e*t.z,e*t.w),vec4i:(e,t)=>p(e*t.x,e*t.y,e*t.z,e*t.w),vec4u:(e,t)=>z(e*t.x,e*t.y,e*t.z,e*t.w),mat2x2f:(e,t)=>{let n=t.columns;return G(e*n[0].x,e*n[0].y,e*n[1].x,e*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return q(e*n[0].x,e*n[0].y,e*n[0].z,e*n[1].x,e*n[1].y,e*n[1].z,e*n[2].x,e*n[2].y,e*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return J(e*n[0].x,e*n[0].y,e*n[0].z,e*n[0].w,e*n[1].x,e*n[1].y,e*n[1].z,e*n[1].w,e*n[2].x,e*n[2].y,e*n[2].z,e*n[2].w,e*n[3].x,e*n[3].y,e*n[3].z,e*n[3].w)}},mulVxV:{vec2f:(e,t)=>l(e.x*t.x,e.y*t.y),vec2h:(e,t)=>i(e.x*t.x,e.y*t.y),vec2i:(e,t)=>T(e.x*t.x,e.y*t.y),vec2u:(e,t)=>m(e.x*t.x,e.y*t.y),vec3f:(e,t)=>y(e.x*t.x,e.y*t.y,e.z*t.z),vec3h:(e,t)=>u(e.x*t.x,e.y*t.y,e.z*t.z),vec3i:(e,t)=>d(e.x*t.x,e.y*t.y,e.z*t.z),vec3u:(e,t)=>f(e.x*t.x,e.y*t.y,e.z*t.z),vec4f:(e,t)=>x(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4h:(e,t)=>g(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4i:(e,t)=>p(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4u:(e,t)=>z(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),mat2x2f:(e,t)=>{let n=e.columns,a=t.columns;return G(n[0].x*a[0].x+n[1].x*a[0].y,n[0].y*a[0].x+n[1].y*a[0].y,n[0].x*a[1].x+n[1].x*a[1].y,n[0].y*a[1].x+n[1].y*a[1].y)},mat3x3f:(e,t)=>{let n=e.columns,a=t.columns;return q(n[0].x*a[0].x+n[1].x*a[0].y+n[2].x*a[0].z,n[0].y*a[0].x+n[1].y*a[0].y+n[2].y*a[0].z,n[0].z*a[0].x+n[1].z*a[0].y+n[2].z*a[0].z,n[0].x*a[1].x+n[1].x*a[1].y+n[2].x*a[1].z,n[0].y*a[1].x+n[1].y*a[1].y+n[2].y*a[1].z,n[0].z*a[1].x+n[1].z*a[1].y+n[2].z*a[1].z,n[0].x*a[2].x+n[1].x*a[2].y+n[2].x*a[2].z,n[0].y*a[2].x+n[1].y*a[2].y+n[2].y*a[2].z,n[0].z*a[2].x+n[1].z*a[2].y+n[2].z*a[2].z)},mat4x4f:(e,t)=>{let n=e.columns,a=t.columns;return J(n[0].x*a[0].x+n[1].x*a[0].y+n[2].x*a[0].z+n[3].x*a[0].w,n[0].y*a[0].x+n[1].y*a[0].y+n[2].y*a[0].z+n[3].y*a[0].w,n[0].z*a[0].x+n[1].z*a[0].y+n[2].z*a[0].z+n[3].z*a[0].w,n[0].w*a[0].x+n[1].w*a[0].y+n[2].w*a[0].z+n[3].w*a[0].w,n[0].x*a[1].x+n[1].x*a[1].y+n[2].x*a[1].z+n[3].x*a[1].w,n[0].y*a[1].x+n[1].y*a[1].y+n[2].y*a[1].z+n[3].y*a[1].w,n[0].z*a[1].x+n[1].z*a[1].y+n[2].z*a[1].z+n[3].z*a[1].w,n[0].w*a[1].x+n[1].w*a[1].y+n[2].w*a[1].z+n[3].w*a[1].w,n[0].x*a[2].x+n[1].x*a[2].y+n[2].x*a[2].z+n[3].x*a[2].w,n[0].y*a[2].x+n[1].y*a[2].y+n[2].y*a[2].z+n[3].y*a[2].w,n[0].z*a[2].x+n[1].z*a[2].y+n[2].z*a[2].z+n[3].z*a[2].w,n[0].w*a[2].x+n[1].w*a[2].y+n[2].w*a[2].z+n[3].w*a[2].w,n[0].x*a[3].x+n[1].x*a[3].y+n[2].x*a[3].z+n[3].x*a[3].w,n[0].y*a[3].x+n[1].y*a[3].y+n[2].y*a[3].z+n[3].y*a[3].w,n[0].z*a[3].x+n[1].z*a[3].y+n[2].z*a[3].z+n[3].z*a[3].w,n[0].w*a[3].x+n[1].w*a[3].y+n[2].w*a[3].z+n[3].w*a[3].w)}},mulMxV:{mat2x2f:(e,t)=>{let n=e.columns;return l(n[0].x*t.x+n[1].x*t.y,n[0].y*t.x+n[1].y*t.y)},mat3x3f:(e,t)=>{let n=e.columns;return y(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z)},mat4x4f:(e,t)=>{let n=e.columns;return x(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z+n[3].x*t.w,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z+n[3].y*t.w,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z+n[3].z*t.w,n[0].w*t.x+n[1].w*t.y+n[2].w*t.z+n[3].w*t.w)}},mulVxM:{mat2x2f:(e,t)=>{let n=t.columns;return l(e.x*n[0].x+e.y*n[0].y,e.x*n[1].x+e.y*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return y(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return x(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z+e.w*n[0].w,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z+e.w*n[1].w,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z+e.w*n[2].w,e.x*n[3].x+e.y*n[3].y+e.z*n[3].z+e.w*n[3].w)}},dot:{vec2f:C,vec2h:C,vec2i:C,vec2u:C,vec3f:P,vec3h:P,vec3i:P,vec3u:P,vec4f:_,vec4h:_,vec4i:_,vec4u:_},normalize:{vec2f:e=>{let t=R(e);return l(e.x/t,e.y/t)},vec2h:e=>{let t=R(e);return i(e.x/t,e.y/t)},vec2i:e=>{let t=R(e);return T(e.x/t,e.y/t)},vec2u:e=>{let t=R(e);return m(e.x/t,e.y/t)},vec3f:e=>{let t=K(e);return y(e.x/t,e.y/t,e.z/t)},vec3h:e=>{let t=K(e);return u(e.x/t,e.y/t,e.z/t)},vec3i:e=>{let t=K(e);return d(e.x/t,e.y/t,e.z/t)},vec3u:e=>{let t=K(e);return f(e.x/t,e.y/t,e.z/t)},vec4f:e=>{let t=N(e);return x(e.x/t,e.y/t,e.z/t,e.w/t)},vec4h:e=>{let t=N(e);return g(e.x/t,e.y/t,e.z/t,e.w/t)},vec4i:e=>{let t=N(e);return p(e.x/t,e.y/t,e.z/t,e.w/t)},vec4u:e=>{let t=N(e);return z(e.x/t,e.y/t,e.z/t,e.w/t)}},cross:{vec3f:(e,t)=>y(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x),vec3h:(e,t)=>u(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x)},floor:{vec2f:M(Math.floor),vec2h:b(Math.floor),vec3f:V(Math.floor),vec3h:A(Math.floor),vec4f:I(Math.floor),vec4h:$(Math.floor)},max:{vec2f:Y(Math.max),vec2h:ee(Math.max),vec2i:le(Math.max),vec2u:ve(Math.max),vec3f:te(Math.max),vec3h:ne(Math.max),vec3i:oe(Math.max),vec3u:xe(Math.max),vec4f:ae(Math.max),vec4h:se(Math.max),vec4i:we(Math.max),vec4u:ue(Math.max)},min:{vec2f:Y(Math.min),vec2h:ee(Math.min),vec2i:le(Math.min),vec2u:ve(Math.min),vec3f:te(Math.min),vec3h:ne(Math.min),vec3i:oe(Math.min),vec3u:xe(Math.min),vec4f:ae(Math.min),vec4h:se(Math.min),vec4i:we(Math.min),vec4u:ue(Math.min)},pow:{vec2f:(e,t)=>l(e.x**t.x,e.y**t.y),vec2h:(e,t)=>i(e.x**t.x,e.y**t.y),vec3f:(e,t)=>y(e.x**t.x,e.y**t.y,e.z**t.z),vec3h:(e,t)=>u(e.x**t.x,e.y**t.y,e.z**t.z),vec4f:(e,t)=>x(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w),vec4h:(e,t)=>g(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w)},mix:{vec2f:(e,t,n)=>typeof n=="number"?l(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):l(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec2h:(e,t,n)=>typeof n=="number"?i(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):i(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec3f:(e,t,n)=>typeof n=="number"?y(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):y(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec3h:(e,t,n)=>typeof n=="number"?u(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):u(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec4f:(e,t,n)=>typeof n=="number"?x(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):x(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w),vec4h:(e,t,n)=>typeof n=="number"?g(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):g(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w)},sin:{vec2f:M(Math.sin),vec2h:b(Math.sin),vec3f:V(Math.sin),vec3h:A(Math.sin),vec4f:I(Math.sin),vec4h:$(Math.sin)},cos:{vec2f:M(Math.cos),vec2h:b(Math.cos),vec3f:V(Math.cos),vec3h:A(Math.cos),vec4f:I(Math.cos),vec4h:$(Math.cos)},exp:{vec2f:M(Math.exp),vec2h:b(Math.exp),vec3f:V(Math.exp),vec3h:A(Math.exp),vec4f:I(Math.exp),vec4h:$(Math.exp)},fract:{vec2f:M(e=>e-Math.floor(e)),vec2h:b(e=>e-Math.floor(e)),vec3f:V(e=>e-Math.floor(e)),vec3h:A(e=>e-Math.floor(e)),vec4f:I(e=>e-Math.floor(e)),vec4h:$(e=>e-Math.floor(e))},isCloseToZero:{vec2f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec2h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec3f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec3h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec4f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t,vec4h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t},select:{vec2f:(e,t,n)=>l(n.x?t.x:e.x,n.y?t.y:e.y),vec2h:(e,t,n)=>i(n.x?t.x:e.x,n.y?t.y:e.y),vec2i:(e,t,n)=>T(n.x?t.x:e.x,n.y?t.y:e.y),vec2u:(e,t,n)=>m(n.x?t.x:e.x,n.y?t.y:e.y),"vec2<bool>":(e,t,n)=>v(n.x?t.x:e.x,n.y?t.y:e.y),vec3f:(e,t,n)=>y(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3h:(e,t,n)=>u(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3i:(e,t,n)=>d(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3u:(e,t,n)=>f(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),"vec3<bool>":(e,t,n)=>o(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec4f:(e,t,n)=>x(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4h:(e,t,n)=>g(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4i:(e,t,n)=>p(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4u:(e,t,n)=>z(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),"vec4<bool>":(e,t,n)=>w(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w)}};function U(e){let t=e.dataType.type;return t==="abstractInt"||t==="abstractFloat"||t==="f32"||t==="f16"||t==="i32"||t==="u32"}var fe=s((e,t)=>r.add[e.kind](e,t),(e,t)=>({value:`(${e.value} + ${t.value})`,dataType:e.dataType})),S=s((e,t)=>r.sub[e.kind](e,t),(e,t)=>({value:`(${e.value} - ${t.value})`,dataType:e.dataType})),ie=s((e,t)=>{if(typeof e=="number")return r.mulSxV[t.kind](e,t);if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t){let n=!e.kind.startsWith("mat"),a=!t.kind.startsWith("mat");if(!n&&a)return r.mulMxV[e.kind](e,t);if(n&&!a)return r.mulVxM[t.kind](e,t)}return r.mulVxV[t.kind](e,t)},(e,t)=>{let n=U(e)?t.dataType:e.dataType.type.startsWith("mat")?t.dataType.type.startsWith("mat")?e.dataType:t.dataType:e.dataType;return{value:`(${e.value} * ${t.value})`,dataType:n}}),pe=s(e=>typeof e=="number"?Math.abs(e):r.abs[e.kind](e),e=>({value:`abs(${e.value})`,dataType:e.dataType})),ze=s((e,t)=>typeof e=="number"&&typeof t=="number"?Math.atan2(e,t):r.atan2[e.kind](e,t),(e,t)=>({value:`atan2(${e.value}, ${t.value})`,dataType:e.dataType})),he=s(e=>typeof e=="number"?Math.acos(e):r.acos[e.kind](e),e=>({value:`acos(${e.value})`,dataType:e.dataType})),Me=s(e=>typeof e=="number"?Math.asin(e):r.asin[e.kind](e),e=>({value:`asin(${e.value})`,dataType:e.dataType})),be=s(e=>typeof e=="number"?Math.ceil(e):r.ceil[e.kind](e),e=>({value:`ceil(${e.value})`,dataType:e.dataType})),Ve=s((e,t,n)=>typeof e=="number"?Math.min(Math.max(t,e),n):r.clamp[e.kind](e,t,n),(e,t,n)=>({value:`clamp(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),Ae=s(e=>typeof e=="number"?Math.cos(e):r.cos[e.kind](e),e=>({value:`cos(${e.value})`,dataType:e.dataType})),Ie=s((e,t)=>r.cross[e.kind](e,t),(e,t)=>({value:`cross(${e.value}, ${t.value})`,dataType:e.dataType})),ge=s((e,t)=>r.dot[e.kind](e,t),(e,t)=>({value:`dot(${e.value}, ${t.value})`,dataType:F})),$e=s(e=>r.normalize[e.kind](e),e=>({value:`normalize(${e.value})`,dataType:e.dataType})),Be=s(e=>typeof e=="number"?Math.floor(e):r.floor[e.kind](e),e=>({value:`floor(${e.value})`,dataType:e.dataType})),Oe=s(e=>typeof e=="number"?e-Math.floor(e):r.fract[e.kind](e),e=>({value:`fract(${e.value})`,dataType:e.dataType})),Te=s(e=>typeof e=="number"?Math.abs(e):r.length[e.kind](e),e=>({value:`length(${e.value})`,dataType:F})),ke=s((e,t)=>typeof e=="number"?Math.max(e,t):r.max[e.kind](e,t),(e,t)=>({value:`max(${e.value}, ${t.value})`,dataType:e.dataType})),Fe=s((e,t)=>typeof e=="number"?Math.min(e,t):r.min[e.kind](e,t),(e,t)=>({value:`min(${e.value}, ${t.value})`,dataType:e.dataType})),Re=s(e=>typeof e=="number"?Math.sin(e):r.sin[e.kind](e),e=>({value:`sin(${e.value})`,dataType:e.dataType})),Ke=s(e=>typeof e=="number"?Math.exp(e):r.exp[e.kind](e),e=>({value:`exp(${e.value})`,dataType:e.dataType})),Ne=s((e,t)=>{if(typeof e=="number"&&typeof t=="number")return e**t;if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t)return r.pow[e.kind](e,t);throw new Error("Invalid arguments to pow()")},(e,t)=>({value:`pow(${e.value}, ${t.value})`,dataType:e.dataType})),Ue=s((e,t,n)=>{if(typeof e=="number"){if(typeof n!="number"||typeof t!="number")throw new Error("When e1 and e2 are numbers, the blend factor must be a number.");return e*(1-n)+t*n}if(typeof e=="number"||typeof t=="number")throw new Error("e1 and e2 need to both be vectors of the same kind.");return r.mix[e.kind](e,t,n)},(e,t,n)=>({value:`mix(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),Ee=s((e,t)=>S(e,ie(2*ge(t,e),t)),(e,t)=>({value:`reflect(${e.value}, ${t.value})`,dataType:e.dataType})),Se=s((e,t)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t):Te(S(e,t)),(e,t)=>({value:`distance(${e.value}, ${t.value})`,dataType:F}));function E(e){return e.dataType.type.includes("2")?v:e.dataType.type.includes("3")?o:w}var We=s((e,t)=>re(W(e,t)),(e,t)=>({value:`all(${e.value} == ${t.value})`,dataType:O})),W=s((e,t)=>r.eq[e.kind](e,t),(e,t)=>({value:`(${e.value} == ${t.value})`,dataType:E(e)})),Ce=s((e,t)=>B(W(e,t)),(e,t)=>({value:`(${e.value} != ${t.value})`,dataType:E(e)})),D=s((e,t)=>r.lt[e.kind](e,t),(e,t)=>({value:`(${e.value} < ${t.value})`,dataType:E(e)})),Pe=s((e,t)=>ce(D(e,t),W(e,t)),(e,t)=>({value:`(${e.value} <= ${t.value})`,dataType:E(e)})),_e=s((e,t)=>me(B(D(e,t)),B(W(e,t))),(e,t)=>({value:`(${e.value} > ${t.value})`,dataType:E(e)})),De=s((e,t)=>B(D(e,t)),(e,t)=>({value:`(${e.value} >= ${t.value})`,dataType:E(e)})),B=s(e=>r.neg[e.kind](e),e=>({value:`!(${e.value})`,dataType:e.dataType})),ce=s((e,t)=>r.or[e.kind](e,t),(e,t)=>({value:`(${e.value} | ${t.value})`,dataType:e.dataType})),me=s((e,t)=>B(ce(B(e),B(t))),(e,t)=>({value:`(${e.value} & ${t.value})`,dataType:e.dataType})),re=s(e=>r.all[e.kind](e),e=>({value:`all(${e.value})`,dataType:O})),Ge=s(e=>!re(B(e)),e=>({value:`any(${e.value})`,dataType:O})),qe=s((e,t,n=.01)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<n:typeof e!="number"&&typeof t!="number"?r.isCloseToZero[e.kind](S(e,t),n):!1,(e,t,n={value:.01,dataType:F})=>U(e)&&U(t)?{value:`(abs(f32(${e.value}) - f32(${t.value})) <= ${n.value})`,dataType:O}:!U(e)&&!U(t)?{value:`all(abs(${e.value} - ${t.value}) <= (${e.value} - ${e.value}) + ${n.value})`,dataType:O}:{value:"false",dataType:O}),Je=s((e,t,n)=>typeof n=="boolean"?n?t:e:r.select[e.kind](e,t,n),(e,t,n)=>({value:`select(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType}));var Le=s(()=>console.warn("workgroupBarrier is a no-op outside of GPU mode."),()=>({value:"workgroupBarrier()",dataType:k})),je=s(()=>console.warn("storageBarrier is a no-op outside of GPU mode."),()=>({value:"storageBarrier()",dataType:k})),Xe=s(()=>console.warn("textureBarrier is a no-op outside of GPU mode."),()=>({value:"textureBarrier()",dataType:k})),Ze=s(e=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},e=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicLoad(&${e.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),He=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(!h(e.dataType)||e.dataType.type!=="atomic")throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`);return{value:`atomicStore(&${e.value}, ${t.value})`,dataType:k}}),Qe=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicAdd(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),Ye=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicSub(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),et=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicMax(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),tt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicMin(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),nt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicAnd(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),at=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicOr(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),st=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicXor(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)});var ct=s(e=>e.length,e=>({value:`arrayLength(&${e.value})`,dataType:ye}));export{pe as abs,he as acos,fe as add,re as all,We as allEq,me as and,Ge as any,ct as arrayLength,Me as asin,ze as atan2,Qe as atomicAdd,nt as atomicAnd,Ze as atomicLoad,et as atomicMax,tt as atomicMin,at as atomicOr,He as atomicStore,Ye as atomicSub,st as atomicXor,be as ceil,Ve as clamp,Ae as cos,Ie as cross,de as discard,Se as distance,ge as dot,W as eq,Ke as exp,Be as floor,Oe as fract,De as ge,_e as gt,qe as isCloseTo,Pe as le,Te as length,D as lt,ke as max,Fe as min,Ue as mix,ie as mul,Ce as ne,$e as normalize,B as not,ce as or,Ne as pow,Ee as reflect,Je as select,Re as sin,je as storageBarrier,S as sub,Xe as textureBarrier,Le as workgroupBarrier};
1
+ import{A as x,B as y,C as T,D as p,E as z,F as u,G as ee,H as te,I as ne,M as S,N as O,P as U,R as F,Y as h,p as s,r as o,s as i,t as m,u as f,v,w as l,x as w,y as d,z as g}from"../chunk-KJHEEZQT.js";var he=s(()=>{throw new Error("discard() can only be used on the GPU.")},()=>({value:"discard;",dataType:F}));var R=e=>Math.sqrt(e.x**2+e.y**2),K=e=>Math.sqrt(e.x**2+e.y**2+e.z**2),N=e=>Math.sqrt(e.x**2+e.y**2+e.z**2+e.w**2),D=(e,t)=>e.x*t.x+e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(e.x===t.x,e.y===t.y),vec2h:(e,t)=>v(e.x===t.x,e.y===t.y),vec2i:(e,t)=>v(e.x===t.x,e.y===t.y),vec2u:(e,t)=>v(e.x===t.x,e.y===t.y),"vec2<bool>":(e,t)=>v(e.x===t.x,e.y===t.y),vec3f:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3h:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3i:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3u:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),"vec3<bool>":(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec4f:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4h:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4i:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4u:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),"vec4<bool>":(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w)},lt:{vec2f:(e,t)=>v(e.x<t.x,e.y<t.y),vec2h:(e,t)=>v(e.x<t.x,e.y<t.y),vec2i:(e,t)=>v(e.x<t.x,e.y<t.y),vec2u:(e,t)=>v(e.x<t.x,e.y<t.y),vec3f:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3h:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3i:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3u:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec4f:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4h:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4i:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4u:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w)},or:{"vec2<bool>":(e,t)=>v(e.x||t.x,e.y||t.y),"vec3<bool>":(e,t)=>x(e.x||t.x,e.y||t.y,e.z||t.z),"vec4<bool>":(e,t)=>u(e.x||t.x,e.y||t.y,e.z||t.z,e.w||t.w)},all:{"vec2<bool>":e=>e.x&&e.y,"vec3<bool>":e=>e.x&&e.y&&e.z,"vec4<bool>":e=>e.x&&e.y&&e.z&&e.w},abs:{vec2f:b(Math.abs),vec2h:M(Math.abs),vec2i:q(Math.abs),vec2u:J(Math.abs),vec3f:A(Math.abs),vec3h:V(Math.abs),vec3i:L(Math.abs),vec3u:j(Math.abs),vec4f:I(Math.abs),vec4h:$(Math.abs),vec4i:X(Math.abs),vec4u:Z(Math.abs)},atan2:{vec2f:ae(Math.atan2),vec2h:se(Math.atan2),vec3f:re(Math.atan2),vec3h:ce(Math.atan2),vec4f:ye(Math.atan2),vec4h:oe(Math.atan2)},acos:{vec2f:b(Math.acos),vec2h:M(Math.acos),vec2i:q(Math.acos),vec2u:J(Math.acos),vec3f:A(Math.acos),vec3h:V(Math.acos),vec3i:L(Math.acos),vec3u:j(Math.acos),vec4f:I(Math.acos),vec4h:$(Math.acos),vec4i:X(Math.acos),vec4u:Z(Math.acos)},asin:{vec2f:b(Math.asin),vec2h:M(Math.asin),vec2i:q(Math.asin),vec2u:J(Math.asin),vec3f:A(Math.asin),vec3h:V(Math.asin),vec3i:L(Math.asin),vec3u:j(Math.asin),vec4f:I(Math.asin),vec4h:$(Math.asin),vec4i:X(Math.asin),vec4u:Z(Math.asin)},ceil:{vec2f:b(Math.ceil),vec2h:M(Math.ceil),vec3f:A(Math.ceil),vec3h:V(Math.ceil),vec4f:I(Math.ceil),vec4h:$(Math.ceil)},clamp:{vec2f:(e,t,n)=>o(r(e.x,t.x,n.x),r(e.y,t.y,n.y)),vec2h:(e,t,n)=>i(r(e.x,t.x,n.x),r(e.y,t.y,n.y)),vec2i:(e,t,n)=>m(r(e.x,t.x,n.x),r(e.y,t.y,n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1].x,e*n[1].y,e*n[1].z,e*n[2].x,e*n[2].y,e*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return ne(e*n[0].x,e*n[0].y,e*n[0].z,e*n[0].w,e*n[1].x,e*n[1].y,e*n[1].z,e*n[1].w,e*n[2].x,e*n[2].y,e*n[2].z,e*n[2].w,e*n[3].x,e*n[3].y,e*n[3].z,e*n[3].w)}},mulVxV:{vec2f:(e,t)=>o(e.x*t.x,e.y*t.y),vec2h:(e,t)=>i(e.x*t.x,e.y*t.y),vec2i:(e,t)=>m(e.x*t.x,e.y*t.y),vec2u:(e,t)=>f(e.x*t.x,e.y*t.y),vec3f:(e,t)=>l(e.x*t.x,e.y*t.y,e.z*t.z),vec3h:(e,t)=>w(e.x*t.x,e.y*t.y,e.z*t.z),vec3i:(e,t)=>d(e.x*t.x,e.y*t.y,e.z*t.z),vec3u:(e,t)=>g(e.x*t.x,e.y*t.y,e.z*t.z),vec4f:(e,t)=>y(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4h:(e,t)=>T(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4i:(e,t)=>p(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4u:(e,t)=>z(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),mat2x2f:(e,t)=>{let n=e.columns,a=t.columns;return ee(n[0].x*a[0].x+n[1].x*a[0].y,n[0].y*a[0].x+n[1].y*a[0].y,n[0].x*a[1].x+n[1].x*a[1].y,n[0].y*a[1].x+n[1].y*a[1].y)},mat3x3f:(e,t)=>{let n=e.columns,a=t.columns;return te(n[0].x*a[0].x+n[1].x*a[0].y+n[2].x*a[0].z,n[0].y*a[0].x+n[1].y*a[0].y+n[2].y*a[0].z,n[0].z*a[0].x+n[1].z*a[0].y+n[2].z*a[0].z,n[0].x*a[1].x+n[1].x*a[1].y+n[2].x*a[1].z,n[0].y*a[1].x+n[1].y*a[1].y+n[2].y*a[1].z,n[0].z*a[1].x+n[1].z*a[1].y+n[2].z*a[1].z,n[0].x*a[2].x+n[1].x*a[2].y+n[2].x*a[2].z,n[0].y*a[2].x+n[1].y*a[2].y+n[2].y*a[2].z,n[0].z*a[2].x+n[1].z*a[2].y+n[2].z*a[2].z)},mat4x4f:(e,t)=>{let n=e.columns,a=t.columns;return ne(n[0].x*a[0].x+n[1].x*a[0].y+n[2].x*a[0].z+n[3].x*a[0].w,n[0].y*a[0].x+n[1].y*a[0].y+n[2].y*a[0].z+n[3].y*a[0].w,n[0].z*a[0].x+n[1].z*a[0].y+n[2].z*a[0].z+n[3].z*a[0].w,n[0].w*a[0].x+n[1].w*a[0].y+n[2].w*a[0].z+n[3].w*a[0].w,n[0].x*a[1].x+n[1].x*a[1].y+n[2].x*a[1].z+n[3].x*a[1].w,n[0].y*a[1].x+n[1].y*a[1].y+n[2].y*a[1].z+n[3].y*a[1].w,n[0].z*a[1].x+n[1].z*a[1].y+n[2].z*a[1].z+n[3].z*a[1].w,n[0].w*a[1].x+n[1].w*a[1].y+n[2].w*a[1].z+n[3].w*a[1].w,n[0].x*a[2].x+n[1].x*a[2].y+n[2].x*a[2].z+n[3].x*a[2].w,n[0].y*a[2].x+n[1].y*a[2].y+n[2].y*a[2].z+n[3].y*a[2].w,n[0].z*a[2].x+n[1].z*a[2].y+n[2].z*a[2].z+n[3].z*a[2].w,n[0].w*a[2].x+n[1].w*a[2].y+n[2].w*a[2].z+n[3].w*a[2].w,n[0].x*a[3].x+n[1].x*a[3].y+n[2].x*a[3].z+n[3].x*a[3].w,n[0].y*a[3].x+n[1].y*a[3].y+n[2].y*a[3].z+n[3].y*a[3].w,n[0].z*a[3].x+n[1].z*a[3].y+n[2].z*a[3].z+n[3].z*a[3].w,n[0].w*a[3].x+n[1].w*a[3].y+n[2].w*a[3].z+n[3].w*a[3].w)}},mulMxV:{mat2x2f:(e,t)=>{let n=e.columns;return o(n[0].x*t.x+n[1].x*t.y,n[0].y*t.x+n[1].y*t.y)},mat3x3f:(e,t)=>{let n=e.columns;return l(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z)},mat4x4f:(e,t)=>{let n=e.columns;return y(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z+n[3].x*t.w,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z+n[3].y*t.w,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z+n[3].z*t.w,n[0].w*t.x+n[1].w*t.y+n[2].w*t.z+n[3].w*t.w)}},mulVxM:{mat2x2f:(e,t)=>{let n=t.columns;return o(e.x*n[0].x+e.y*n[0].y,e.x*n[1].x+e.y*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return l(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return y(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z+e.w*n[0].w,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z+e.w*n[1].w,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z+e.w*n[2].w,e.x*n[3].x+e.y*n[3].y+e.z*n[3].z+e.w*n[3].w)}},dot:{vec2f:D,vec2h:D,vec2i:D,vec2u:D,vec3f:P,vec3h:P,vec3i:P,vec3u:P,vec4f:G,vec4h:G,vec4i:G,vec4u:G},normalize:{vec2f:e=>{let t=R(e);return o(e.x/t,e.y/t)},vec2h:e=>{let t=R(e);return i(e.x/t,e.y/t)},vec2i:e=>{let t=R(e);return m(e.x/t,e.y/t)},vec2u:e=>{let t=R(e);return f(e.x/t,e.y/t)},vec3f:e=>{let t=K(e);return l(e.x/t,e.y/t,e.z/t)},vec3h:e=>{let t=K(e);return w(e.x/t,e.y/t,e.z/t)},vec3i:e=>{let t=K(e);return d(e.x/t,e.y/t,e.z/t)},vec3u:e=>{let t=K(e);return g(e.x/t,e.y/t,e.z/t)},vec4f:e=>{let t=N(e);return y(e.x/t,e.y/t,e.z/t,e.w/t)},vec4h:e=>{let t=N(e);return T(e.x/t,e.y/t,e.z/t,e.w/t)},vec4i:e=>{let t=N(e);return p(e.x/t,e.y/t,e.z/t,e.w/t)},vec4u:e=>{let t=N(e);return z(e.x/t,e.y/t,e.z/t,e.w/t)}},cross:{vec3f:(e,t)=>l(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x),vec3h:(e,t)=>w(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x)},floor:{vec2f:b(Math.floor),vec2h:M(Math.floor),vec3f:A(Math.floor),vec3h:V(Math.floor),vec4f:I(Math.floor),vec4h:$(Math.floor)},max:{vec2f:ae(Math.max),vec2h:se(Math.max),vec2i:xe(Math.max),vec2u:ue(Math.max),vec3f:re(Math.max),vec3h:ce(Math.max),vec3i:we(Math.max),vec3u:ie(Math.max),vec4f:ye(Math.max),vec4h:oe(Math.max),vec4i:Te(Math.max),vec4u:me(Math.max)},min:{vec2f:ae(Math.min),vec2h:se(Math.min),vec2i:xe(Math.min),vec2u:ue(Math.min),vec3f:re(Math.min),vec3h:ce(Math.min),vec3i:we(Math.min),vec3u:ie(Math.min),vec4f:ye(Math.min),vec4h:oe(Math.min),vec4i:Te(Math.min),vec4u:me(Math.min)},pow:{vec2f:(e,t)=>o(e.x**t.x,e.y**t.y),vec2h:(e,t)=>i(e.x**t.x,e.y**t.y),vec3f:(e,t)=>l(e.x**t.x,e.y**t.y,e.z**t.z),vec3h:(e,t)=>w(e.x**t.x,e.y**t.y,e.z**t.z),vec4f:(e,t)=>y(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w),vec4h:(e,t)=>T(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w)},mix:{vec2f:(e,t,n)=>typeof n=="number"?o(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):o(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec2h:(e,t,n)=>typeof n=="number"?i(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):i(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec3f:(e,t,n)=>typeof n=="number"?l(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):l(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec3h:(e,t,n)=>typeof n=="number"?w(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):w(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec4f:(e,t,n)=>typeof n=="number"?y(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):y(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w),vec4h:(e,t,n)=>typeof n=="number"?T(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):T(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w)},sin:{vec2f:b(Math.sin),vec2h:M(Math.sin),vec3f:A(Math.sin),vec3h:V(Math.sin),vec4f:I(Math.sin),vec4h:$(Math.sin)},cos:{vec2f:b(Math.cos),vec2h:M(Math.cos),vec3f:A(Math.cos),vec3h:V(Math.cos),vec4f:I(Math.cos),vec4h:$(Math.cos)},exp:{vec2f:b(Math.exp),vec2h:M(Math.exp),vec3f:A(Math.exp),vec3h:V(Math.exp),vec4f:I(Math.exp),vec4h:$(Math.exp)},fract:{vec2f:b(e=>e-Math.floor(e)),vec2h:M(e=>e-Math.floor(e)),vec3f:A(e=>e-Math.floor(e)),vec3h:V(e=>e-Math.floor(e)),vec4f:I(e=>e-Math.floor(e)),vec4h:$(e=>e-Math.floor(e))},isCloseToZero:{vec2f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec2h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec3f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec3h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec4f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t,vec4h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t},neg:{vec2f:b(e=>-e),vec2h:M(e=>-e),vec2i:q(e=>-e),vec2u:J(e=>-e),"vec2<bool>":e=>v(!e.x,!e.y),vec3f:A(e=>-e),vec3h:V(e=>-e),vec3i:L(e=>-e),vec3u:j(e=>-e),"vec3<bool>":e=>x(!e.x,!e.y,!e.z),vec4f:I(e=>-e),vec4h:$(e=>-e),vec4i:X(e=>-e),vec4u:Z(e=>-e),"vec4<bool>":e=>u(!e.x,!e.y,!e.z,!e.w)},select:{vec2f:(e,t,n)=>o(n.x?t.x:e.x,n.y?t.y:e.y),vec2h:(e,t,n)=>i(n.x?t.x:e.x,n.y?t.y:e.y),vec2i:(e,t,n)=>m(n.x?t.x:e.x,n.y?t.y:e.y),vec2u:(e,t,n)=>f(n.x?t.x:e.x,n.y?t.y:e.y),"vec2<bool>":(e,t,n)=>v(n.x?t.x:e.x,n.y?t.y:e.y),vec3f:(e,t,n)=>l(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3h:(e,t,n)=>w(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3i:(e,t,n)=>d(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3u:(e,t,n)=>g(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),"vec3<bool>":(e,t,n)=>x(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec4f:(e,t,n)=>y(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4h:(e,t,n)=>T(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4i:(e,t,n)=>p(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4u:(e,t,n)=>z(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),"vec4<bool>":(e,t,n)=>u(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w)}};function W(e){let t=e.dataType.type;return t==="abstractInt"||t==="abstractFloat"||t==="f32"||t==="f16"||t==="i32"||t==="u32"}var be=s((e,t)=>c.add[e.kind](e,t),(e,t)=>({value:`(${e.value} + ${t.value})`,dataType:e.dataType})),_=s((e,t)=>c.sub[e.kind](e,t),(e,t)=>({value:`(${e.value} - ${t.value})`,dataType:e.dataType})),fe=s((e,t)=>{if(typeof e=="number")return c.mulSxV[t.kind](e,t);if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t){let n=!e.kind.startsWith("mat"),a=!t.kind.startsWith("mat");if(!n&&a)return c.mulMxV[e.kind](e,t);if(n&&!a)return c.mulVxM[t.kind](e,t)}return c.mulVxV[t.kind](e,t)},(e,t)=>{let n=W(e)?t.dataType:e.dataType.type.startsWith("mat")?t.dataType.type.startsWith("mat")?e.dataType:t.dataType:e.dataType;return{value:`(${e.value} * ${t.value})`,dataType:n}}),Me=s(e=>typeof e=="number"?Math.abs(e):c.abs[e.kind](e),e=>({value:`abs(${e.value})`,dataType:e.dataType})),Ae=s((e,t)=>typeof e=="number"&&typeof t=="number"?Math.atan2(e,t):c.atan2[e.kind](e,t),(e,t)=>({value:`atan2(${e.value}, ${t.value})`,dataType:e.dataType})),Ve=s(e=>typeof e=="number"?Math.acos(e):c.acos[e.kind](e),e=>({value:`acos(${e.value})`,dataType:e.dataType})),Ie=s(e=>typeof e=="number"?Math.asin(e):c.asin[e.kind](e),e=>({value:`asin(${e.value})`,dataType:e.dataType})),$e=s(e=>typeof e=="number"?Math.ceil(e):c.ceil[e.kind](e),e=>({value:`ceil(${e.value})`,dataType:e.dataType})),Be=s((e,t,n)=>typeof e=="number"?Math.min(Math.max(t,e),n):c.clamp[e.kind](e,t,n),(e,t,n)=>({value:`clamp(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),ke=s(e=>typeof e=="number"?Math.cos(e):c.cos[e.kind](e),e=>({value:`cos(${e.value})`,dataType:e.dataType})),Se=s((e,t)=>c.cross[e.kind](e,t),(e,t)=>({value:`cross(${e.value}, ${t.value})`,dataType:e.dataType})),de=s((e,t)=>c.dot[e.kind](e,t),(e,t)=>({value:`dot(${e.value}, ${t.value})`,dataType:U})),Oe=s(e=>c.normalize[e.kind](e),e=>({value:`normalize(${e.value})`,dataType:e.dataType})),Fe=s(e=>typeof e=="number"?Math.floor(e):c.floor[e.kind](e),e=>({value:`floor(${e.value})`,dataType:e.dataType})),Ue=s(e=>typeof e=="number"?e-Math.floor(e):c.fract[e.kind](e),e=>({value:`fract(${e.value})`,dataType:e.dataType})),ge=s(e=>typeof e=="number"?Math.abs(e):c.length[e.kind](e),e=>({value:`length(${e.value})`,dataType:U})),Re=s((e,t)=>typeof e=="number"?Math.max(e,t):c.max[e.kind](e,t),(e,t)=>({value:`max(${e.value}, ${t.value})`,dataType:e.dataType})),Ke=s((e,t)=>typeof e=="number"?Math.min(e,t):c.min[e.kind](e,t),(e,t)=>({value:`min(${e.value}, ${t.value})`,dataType:e.dataType})),Ne=s(e=>typeof e=="number"?Math.sin(e):c.sin[e.kind](e),e=>({value:`sin(${e.value})`,dataType:e.dataType})),We=s(e=>typeof e=="number"?Math.exp(e):c.exp[e.kind](e),e=>({value:`exp(${e.value})`,dataType:e.dataType})),Ee=s((e,t)=>{if(typeof e=="number"&&typeof t=="number")return e**t;if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t)return c.pow[e.kind](e,t);throw new Error("Invalid arguments to pow()")},(e,t)=>({value:`pow(${e.value}, ${t.value})`,dataType:e.dataType})),_e=s((e,t,n)=>{if(typeof e=="number"){if(typeof n!="number"||typeof t!="number")throw new Error("When e1 and e2 are numbers, the blend factor must be a number.");return e*(1-n)+t*n}if(typeof e=="number"||typeof t=="number")throw new Error("e1 and e2 need to both be vectors of the same kind.");return c.mix[e.kind](e,t,n)},(e,t,n)=>({value:`mix(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),Ce=s((e,t)=>_(e,fe(2*de(t,e),t)),(e,t)=>({value:`reflect(${e.value}, ${t.value})`,dataType:e.dataType})),De=s((e,t)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t):ge(_(e,t)),(e,t)=>({value:`distance(${e.value}, ${t.value})`,dataType:U})),Pe=s(e=>typeof e=="number"?-e:c.neg[e.kind](e),e=>({value:`-(${e.value})`,dataType:e.dataType}));function E(e){return e.dataType.type.includes("2")?v:e.dataType.type.includes("3")?x:u}var Ge=s((e,t)=>ve(C(e,t)),(e,t)=>({value:`all(${e.value} == ${t.value})`,dataType:S})),C=s((e,t)=>c.eq[e.kind](e,t),(e,t)=>({value:`(${e.value} == ${t.value})`,dataType:E(e)})),qe=s((e,t)=>k(C(e,t)),(e,t)=>({value:`(${e.value} != ${t.value})`,dataType:E(e)})),H=s((e,t)=>c.lt[e.kind](e,t),(e,t)=>({value:`(${e.value} < ${t.value})`,dataType:E(e)})),Je=s((e,t)=>le(H(e,t),C(e,t)),(e,t)=>({value:`(${e.value} <= ${t.value})`,dataType:E(e)})),Le=s((e,t)=>pe(k(H(e,t)),k(C(e,t))),(e,t)=>({value:`(${e.value} > ${t.value})`,dataType:E(e)})),je=s((e,t)=>k(H(e,t)),(e,t)=>({value:`(${e.value} >= ${t.value})`,dataType:E(e)})),k=s(e=>c.neg[e.kind](e),e=>({value:`!(${e.value})`,dataType:e.dataType})),le=s((e,t)=>c.or[e.kind](e,t),(e,t)=>({value:`(${e.value} | ${t.value})`,dataType:e.dataType})),pe=s((e,t)=>k(le(k(e),k(t))),(e,t)=>({value:`(${e.value} & ${t.value})`,dataType:e.dataType})),ve=s(e=>c.all[e.kind](e),e=>({value:`all(${e.value})`,dataType:S})),Xe=s(e=>!ve(k(e)),e=>({value:`any(${e.value})`,dataType:S})),Ze=s((e,t,n=.01)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<n:typeof e!="number"&&typeof t!="number"?c.isCloseToZero[e.kind](_(e,t),n):!1,(e,t,n={value:.01,dataType:U})=>W(e)&&W(t)?{value:`(abs(f32(${e.value}) - f32(${t.value})) <= ${n.value})`,dataType:S}:!W(e)&&!W(t)?{value:`all(abs(${e.value} - ${t.value}) <= (${e.value} - ${e.value}) + ${n.value})`,dataType:S}:{value:"false",dataType:S}),He=s((e,t,n)=>typeof n=="boolean"?n?t:e:c.select[e.kind](e,t,n),(e,t,n)=>({value:`select(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType}));var Qe=s(()=>console.warn("workgroupBarrier is a no-op outside of GPU mode."),()=>({value:"workgroupBarrier()",dataType:F})),Ye=s(()=>console.warn("storageBarrier is a no-op outside of GPU mode."),()=>({value:"storageBarrier()",dataType:F})),et=s(()=>console.warn("textureBarrier is a no-op outside of GPU mode."),()=>({value:"textureBarrier()",dataType:F})),tt=s(e=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},e=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicLoad(&${e.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),nt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(!h(e.dataType)||e.dataType.type!=="atomic")throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`);return{value:`atomicStore(&${e.value}, ${t.value})`,dataType:F}}),at=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicAdd(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),st=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicSub(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),rt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicMax(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),ct=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicMin(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),yt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicAnd(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),ot=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicOr(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),lt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicXor(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)});var vt=s(e=>e.length,e=>({value:`arrayLength(&${e.value})`,dataType:O}));import*as B from"typed-binary";var xt=s(e=>{let t=new ArrayBuffer(4);new B.BufferWriter(t).writeUint32(e);let a=new B.BufferReader(t);return o(a.readFloat16(),a.readFloat16())},e=>({value:`unpack2x16float(${e.value})`,dataType:o})),ut=s(e=>{let t=new ArrayBuffer(4),n=new B.BufferWriter(t);n.writeFloat16(e.x),n.writeFloat16(e.y);let a=new B.BufferReader(t);return O(a.readUint32())},e=>({value:`pack2x16float(${e.value})`,dataType:O})),wt=s(e=>{let t=new ArrayBuffer(4);new B.BufferWriter(t).writeUint32(e);let a=new B.BufferReader(t);return y(a.readUint8()/255,a.readUint8()/255,a.readUint8()/255,a.readUint8()/255)},e=>({value:`unpack4x8unorm(${e.value})`,dataType:y})),it=s(e=>{let t=new ArrayBuffer(4),n=new B.BufferWriter(t);n.writeUint8(e.x*255),n.writeUint8(e.y*255),n.writeUint8(e.z*255),n.writeUint8(e.w*255);let a=new B.BufferReader(t);return O(a.readUint32())},e=>({value:`pack4x8unorm(${e.value})`,dataType:O}));var Tt=s((e,t,n,a,Q)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,n,a,Q)=>{let Y=[e,t,n];return a!==void 0&&Y.push(a),Q!==void 0&&Y.push(Q),{value:`textureSample(${Y.map(ze=>ze.value).join(", ")})`,dataType:y}});export{Me as abs,Ve as acos,be as add,ve as all,Ge as allEq,pe as and,Xe as any,vt as arrayLength,Ie as asin,Ae as atan2,at as atomicAdd,yt as atomicAnd,tt as atomicLoad,rt as atomicMax,ct as atomicMin,ot as atomicOr,nt as atomicStore,st as atomicSub,lt as atomicXor,$e as ceil,Be as clamp,ke as cos,Se as cross,he as discard,De as distance,de as dot,C as eq,We as exp,Fe as floor,Ue as fract,je as ge,Le as gt,Ze as isCloseTo,Je as le,ge as length,H as lt,Re as max,Ke as min,_e as mix,fe as mul,qe as ne,Pe as neg,Oe as normalize,k as not,le as or,ut as pack2x16float,it as pack4x8unorm,Ee as pow,Ce as reflect,He as select,Ne as sin,Ye as storageBarrier,_ as sub,et as textureBarrier,Tt as textureSample,xt as unpack2x16float,wt as unpack4x8unorm,Qe as workgroupBarrier};
2
2
  //# sourceMappingURL=index.js.map