shaders 2.0.652 → 2.0.654
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/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.js +1 -1
- package/package.json +1 -1
package/dist/vue/index.js
CHANGED
|
@@ -407,7 +407,7 @@ var<${n}> ${e} : ${a};`}},cj=class{constructor(e){this.backend=e}getCurrentDepth
|
|
|
407
407
|
`,a+=e.flow.code.replace(/^\t/gm,``)+`
|
|
408
408
|
`,a+=`/* ... */ `+n+` /* ... */
|
|
409
409
|
`,a+=`// #`+i+`#
|
|
410
|
-
`,t===null?console.log(a):t(e,a),n}};const vQ=(e,t=null)=>XJ(new _Q(XJ(e),t));R(`debug`,vQ);const yQ=eY(([e])=>CQ(e.rgb)),bQ=eY(([e,t=rY(1)])=>t.mix(CQ(e.rgb),e.rgb)),xQ=eY(([e,t=rY(1)])=>{let n=EY(e.r,e.g,e.b).div(3),r=e.r.max(e.g.max(e.b)),i=r.sub(n).mul(t).mul(-3);return JX(e.rgb,r,i)}),SQ=eY(([e,t=rY(1)])=>{let n=dY(.57735,.57735,.57735),r=t.cos();return dY(e.rgb.mul(r).add(n.cross(e.rgb).mul(t.sin()).add(n.mul(zX(n,e.rgb).mul(r.oneMinus())))))}),CQ=(e,t=dY(_q.getLuminanceCoefficients(new Oq)))=>zX(e,t),wQ={name:`Grayscale`,props:{},fragmentNode:({childNode:e})=>{let{vec4:t}=xj;if(!e)return console.error(`You must pass a child component into the Grayscale shader.`),t(0);let n=e||t(0,0,0,0);return t(yQ(n.rgb).rgb,n.a)}};var TQ=r({__name:`Grayscale`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{}},{blendMode:`normal`,...Object.entries(wQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${wQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(wQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(wQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(wQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,wQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),EQ=TQ;const DQ={name:`Grid`,props:{color:{default:`#ffffff`,transform:iK,description:`The color of the grid lines`,ui:{type:`color`,label:`Color`}},cells:{default:10,description:`Number of cells along the shortest canvas edge (creates square cells)`,ui:{type:`range`,min:1,max:50,step:1,label:`Cells`}},thickness:{default:1,description:`Thickness of grid lines (normalized, 0.0-1.0)`,ui:{type:`range`,min:0,max:5,step:.1,label:`Thickness`}}},fragmentNode:({uniforms:e})=>{let{vec2:t,vec4:n,fract:r,max:i,screenUV:a,viewportSize:o,fwidth:s,smoothstep:c}=xj,l=o.x.div(o.y),u=t(a.x.mul(l),a.y.oneMinus()),d=e.cells.uniform,f=u.mul(d),p=r(f),m=e.thickness.uniform.mul(.01),h=p.x.min(p.x.oneMinus()),g=p.y.min(p.y.oneMinus()),_=s(f),v=c(m.add(_.x),m,h),y=c(m.add(_.y),m,g),b=i(v,y);return n(e.color.uniform.rgb,e.color.uniform.a.mul(b))}};var OQ=r({__name:`Grid`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},color:{},cells:{},thickness:{}},{blendMode:`normal`,...Object.entries(DQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${DQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(DQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(DQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(DQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,DQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),kQ=OQ;const AQ={name:`GridDistortion`,props:{smoothness:{default:0,description:`How smooth and flowing the motion is`,ui:{type:`range`,min:0,max:1,step:.01,label:`Smoothness`}},intensity:{default:1,description:`Strength of the distortion effect`,ui:{type:`range`,min:0,max:5,step:.1,label:`Intensity`}},swirl:{default:0,description:`Amount of swirl motion`,ui:{type:`range`,min:0,max:2,step:.1,label:`Swirl`}},duration:{default:3,description:`How long the effect persists (higher = longer)`,ui:{type:`range`,min:0,max:10,step:.1,label:`Duration`}},radius:{default:1,description:`Radius of the distortion effect`,ui:{type:`range`,min:0,max:3,step:.01,label:`Radius`}},gridSize:{default:20,description:`Resolution of the distortion grid (higher = more detailed)`,ui:{type:`range`,min:8,max:128,step:1,label:`Grid Size`}}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:n,onCleanup:r,canvas:i})=>{let{vec2:a,vec4:o,float:s,uniform:c,screenUV:l,convertToTexture:u,texture:d}=xj;if(!n)return o(0,0,0,0);let f=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(n,f,p),h=Math.max(8,Math.min(128,Math.floor(e.gridSize.uniform.value))),g=new Float32Array(h*h*2),_=new $z(g,h,h,hI,lI);_.magFilter=rI,_.minFilter=rI,_.needsUpdate=!0;let v=d(_),y=c(.5),b=c(.5),x=c(0),S=c(0),ee=.5,te=.5,ne=Date.now();t(({pointer:t})=>{let n=Date.now(),r=Math.min((n-ne)/1e3,.016);ne=n;let i=r>0?(t.x-ee)/r:0,a=r>0?(t.y-te)/r:0;x.value=x.value*.85+i*.15,S.value=S.value*.85+a*.15,y.value=t.x,b.value=t.y;let o=e.duration.uniform.value,s=e.intensity.uniform.value,c=e.radius.uniform.value*.05,l=e.swirl.uniform.value;for(let e=0;e<h;e++)for(let n=0;n<h;n++){let u=(e*h+n)*2;g[u]*=1-o*r,g[u+1]*=1-o*r;let d=(n+.5)/h,f=(e+.5)/h,p=d-t.x,m=f-t.y,_=Math.sqrt(p*p+m*m);if(_<c*2&&Math.abs(i)+Math.abs(a)>.01){let e=Math.exp(-_*_/(c*c));if(g[u]+=x.value*e*s*r*.5,g[u+1]+=S.value*e*s*r*.5,l>0){let t=Math.atan2(m,p)+Math.PI*.5;g[u]+=Math.cos(t)*l*e*r*2,g[u+1]+=Math.sin(t)*l*e*r*2}}g[u]=Math.max(-1,Math.min(1,g[u])),g[u+1]=Math.max(-1,Math.min(1,g[u+1]))}_.needsUpdate=!0,ee=t.x,te=t.y}),r(()=>{_.dispose()});let re=e.gridSize.uniform,ie=s(1).div(re),ae=l.div(ie).floor().mul(ie).add(ie.mul(.5)),oe=v.sample(ae).xy,se=s(.1),ce=s(-.1),le=oe.clamp(a(ce,ce),a(se,se)),ue=l.sub(le);return m.sample(ue)}};var jQ=r({__name:`GridDistortion`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},smoothness:{},intensity:{},swirl:{},duration:{},radius:{},gridSize:{}},{blendMode:`normal`,...Object.entries(AQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${AQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(AQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(AQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(AQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,AQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),MQ=jQ;const NQ={name:`HueShift`,props:{shift:{default:0,description:`The amount to shift the hue by`,ui:{type:`range`,min:-180,max:180,step:1,label:`Shift`}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:n}=xj;if(!t)return console.error(`You must pass a child component into the Hue Shift shader.`),n(0);let r=t||n(0,0,0,0);return n(SQ(r.rgb,e.shift.uniform).rgb,r.a)}};var PQ=r({__name:`HueShift`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},shift:{}},{blendMode:`normal`,...Object.entries(NQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${NQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(NQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(NQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(NQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,NQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),FQ=PQ;const IQ={name:`ImageTexture`,props:{src:{default:`https://picsum.photos/1920/1080`,description:`Image URL to display`,ui:{type:`text`,label:`Source URL`}},fit:{default:`cover`,description:`How the image should fit within the canvas`}},fragmentNode:({uniforms:e,onCleanup:t})=>{let{texture:n,screenUV:r}=xj,i=new DB,a=i.load(e.src.uniform.value);a.colorSpace=TI,a.flipY=!0;let o=n(a);t(()=>{a.dispose()});let s=r.xy.setY(r.y.oneMinus());return o.sample(s)}};var LQ=r({__name:`ImageTexture`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},src:{},fit:{}},{blendMode:`normal`,...Object.entries(IQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${IQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(IQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(IQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(IQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,IQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),RQ=LQ;const zQ={name:`Invert`,props:{},fragmentNode:({childNode:e})=>{let{vec4:t,vec3:n}=xj;if(!e)return console.error(`You must pass a child component into the Invert shader.`),t(0);let r=e||t(0,0,0,0);return t(n(1,1,1).sub(r.rgb),r.a)}};var BQ=r({__name:`Invert`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{}},{blendMode:`normal`,...Object.entries(zQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${zQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(zQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(zQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(zQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,zQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),VQ=BQ;const HQ={name:`LinearGradient`,props:{startColor:{default:`#1aff00`,transform:iK,description:`The starting color of the gradient`,ui:{type:`color`,label:`Start Color`}},endColor:{default:`#0000ff`,transform:iK,description:`The ending color of the gradient`,ui:{type:`color`,label:`End Color`}},angle:{default:0,transform:oK,description:`The rotation angle of the gradient (in degrees)`,ui:{type:`range`,min:0,max:360,step:1,label:`Angle`}},center:{default:{x:.5,y:.5},transform:aK}},fragmentNode:({uniforms:e})=>{let{vec2:t,mix:n,float:r,cos:i,sin:a,dot:o,radians:s,screenUV:c,abs:l,div:u}=xj,d=s(e.angle.uniform),f=i(d),p=a(d),m=t(f,p),h=t(e.center.uniform[0],e.center.uniform[1].oneMinus()),g=c.sub(h),_=o(g,m),v=r(.5).mul(l(f).add(l(p))),y=u(_,v.max(1e-6)),b=y.mul(.5).add(.5).clamp(r(0),r(1));return n(e.startColor.uniform,e.endColor.uniform,b)}};var UQ=r({__name:`LinearGradient`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},startColor:{},endColor:{},angle:{},center:{}},{blendMode:`normal`,...Object.entries(HQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${HQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(HQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(HQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(HQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,HQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),WQ=UQ;const GQ={name:`Liquify`,props:{smoothness:{default:0,description:`How smooth and flowing the motion is (0-1)`,ui:{type:`range`,min:0,max:1,step:.01,label:`Smoothness`}},intensity:{default:1,description:`Strength of the distortion effect`,ui:{type:`range`,min:0,max:5,step:.1,label:`Intensity`}},swirl:{default:0,description:`Amount of swirl motion (0-1)`,ui:{type:`range`,min:0,max:1,step:.01,label:`Swirl`}},duration:{default:3,description:`How long the effect persists (higher = longer)`,ui:{type:`range`,min:0,max:10,step:.1,label:`Duration`}},radius:{default:1,description:`Radius of the distortion effect`,ui:{type:`range`,min:0,max:3,step:.01,label:`Radius`}}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:n,onCleanup:r,canvas:i})=>{let{vec2:a,vec4:o,float:s,uniform:c,screenUV:l,convertToTexture:u,texture:d}=xj;if(!n)return o(0,0,0,0);let f=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(n,f,p),h=32,g=new Float32Array(h*h*2),_=new $z(g,h,h,hI,lI);_.magFilter=rI,_.minFilter=rI,_.needsUpdate=!0;let v=d(_),y=c(.5),b=c(.5),x=c(0),S=c(0),ee=.5,te=.5,ne=Date.now();t(({pointer:t})=>{let n=Date.now(),r=Math.min((n-ne)/1e3,.016);ne=n;let i=r>0?(t.x-ee)/r:0,a=r>0?(t.y-te)/r:0;x.value=x.value*.85+i*.15,S.value=S.value*.85+a*.15,y.value=t.x,b.value=t.y;let o=e.duration.uniform.value,s=e.intensity.uniform.value,c=e.radius.uniform.value*.05,l=e.swirl.uniform.value;for(let e=0;e<h;e++)for(let n=0;n<h;n++){let u=(e*h+n)*2;g[u]*=1-o*r,g[u+1]*=1-o*r;let d=(n+.5)/h,f=(e+.5)/h,p=d-t.x,m=f-t.y,_=Math.sqrt(p*p+m*m);if(_<c*2&&Math.abs(i)+Math.abs(a)>.01){let e=Math.exp(-_*_/(c*c));if(g[u]+=x.value*e*s*r*.5,g[u+1]+=S.value*e*s*r*.5,l>0){let t=Math.atan2(m,p)+Math.PI*.5;g[u]+=Math.cos(t)*l*e*r*2,g[u+1]+=Math.sin(t)*l*e*r*2}}g[u]=Math.max(-1,Math.min(1,g[u])),g[u+1]=Math.max(-1,Math.min(1,g[u+1]))}_.needsUpdate=!0,ee=t.x,te=t.y}),r(()=>{_.dispose()});let re=v.sample(l).xy,ie=s(.2),ae=s(-.2),oe=re.clamp(a(ae,ae),a(ie,ie)),se=l.sub(oe);return m.sample(se)}};var KQ=r({__name:`Liquify`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},smoothness:{},intensity:{},swirl:{},duration:{},radius:{}},{blendMode:`normal`,...Object.entries(GQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${GQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(GQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(GQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(GQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,GQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),qQ=KQ;const JQ={name:`Pixelate`,props:{scale:{default:50,description:`Pixel size - higher values create larger, more visible pixels`,ui:{type:`range`,min:1,max:200,step:1,label:`Scale`}}},fragmentNode:({uniforms:e,childNode:t,canvas:n})=>{let{vec4:r,floor:i,screenUV:a,convertToTexture:o}=xj;if(!t)return r(0,0,0,0);let s=Math.round(n.clientWidth),c=Math.round(n.clientHeight),l=o(t,s,c),u=e.scale.uniform,d=i(a.mul(u)).div(u);return l.sample(d)}};var YQ=r({__name:`Pixelate`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},scale:{}},{blendMode:`normal`,...Object.entries(JQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${JQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(JQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(JQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(JQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,JQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),XQ=YQ,ZQ=class extends tJ{static get type(){return`PosterizeNode`}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){let{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}};const QQ=z(ZQ).setParameterLength(2),$Q={name:`Posterize`,props:{intensity:{default:5,description:`The intensity of the posterization effect (lower is more posterized)`,ui:{type:`range`,min:2,max:20,step:1,label:`Intensity`}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:n,int:r}=xj;if(!t)return console.error(`You must pass a child component into the Posterize shader.`),n(0);let i=t||n(0,0,0,0);return QQ(i,r(e.intensity.uniform))}};var e$=r({__name:`Posterize`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},intensity:{}},{blendMode:`normal`,...Object.entries($Q.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${$Q.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries($Q.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries($Q.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF($Q,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,$Q.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),t$=e$;const n$={name:`RadialGradient`,props:{startColor:{default:`#ff0000`,transform:iK,description:`The starting color at the center of the gradient`,ui:{type:`color`,label:`Start Color`}},endColor:{default:`#0000ff`,transform:iK,description:`The ending color at the edge of the gradient`,ui:{type:`color`,label:`End Color`}},center:{default:{x:.5,y:.5},transform:aK,description:`The center point of the radial gradient`},radius:{default:1,description:`The radius of the gradient (normalized, 0.0-1.0)`,ui:{type:`range`,min:0,max:2,step:.01,label:`Radius`}}},fragmentNode:({uniforms:e})=>{let{vec2:t,mix:n,float:r,distance:i,screenUV:a,viewportSize:o}=xj,s=o.x.div(o.y),c=t(a.x.mul(s),a.y),l=t(e.center.uniform.x.mul(s),e.center.uniform.y.oneMinus()),u=i(c,l),d=u.div(e.radius.uniform).clamp(r(0),r(1));return n(e.startColor.uniform,e.endColor.uniform,d)}};var r$=r({__name:`RadialGradient`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},startColor:{},endColor:{},center:{},radius:{}},{blendMode:`normal`,...Object.entries(n$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${n$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(n$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(n$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(n$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,n$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),i$=r$;const a$={name:`Ripple`,props:{intensity:{default:1,description:`Overall ripple intensity`,ui:{type:`range`,min:0,max:5,step:.1,label:`Intensity`}},rippleSpeed:{default:150,description:`Speed of ripple expansion`,ui:{type:`range`,min:50,max:500,step:10,label:`Ripple Speed`}},damping:{default:.95,description:`Water damping (higher = less decay)`,ui:{type:`range`,min:.8,max:.99,step:.01,label:`Damping`}},mouseIntensity:{default:1,description:`Mouse movement ripple strength`,ui:{type:`range`,min:0,max:3,step:.1,label:`Mouse Intensity`}}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:n,onCleanup:r,canvas:i})=>{let{vec2:a,vec4:o,screenUV:s,convertToTexture:c,texture:l}=xj;if(!n)return o(0,0,0,0);let u=Math.round(i.clientWidth),d=Math.round(i.clientHeight),f=c(n,u,d),p=128,m={current:new Float32Array(p*p),previous:new Float32Array(p*p)};for(let e=0;e<p*p;e++)m.current[e]=0,m.previous[e]=0;let h=new $z(m.current,p,p,mI,lI);h.minFilter=rI,h.magFilter=rI,h.needsUpdate=!0;let g=l(h),_=.5,v=.5,y=0,b=(e,t,n)=>{let r=e/i.clientWidth,a=t/i.clientHeight,o=Math.floor(r*p),s=Math.floor(a*p),c=8,l=n*.5;for(let e=-c;e<=c;e++)for(let t=-c;t<=c;t++){let n=e*e+t*t;if(n<=c*c){let r=o+e,i=s+t;if(r>=0&&r<p&&i>=0&&i<p){let e=i*p+r,t=Math.sqrt(n),a=1-t/c,o=Math.cos(t/c*Math.PI*.5)*l*a;m.previous[e]+=o}}}},x=()=>{let t=e.damping.uniform.value;for(let e=1;e<p-1;e++)for(let n=1;n<p-1;n++){let r=e*p+n,i=m.previous[r-p],a=m.previous[r+p],o=m.previous[r-1],s=m.previous[r+1];m.current[r]=(i+a+o+s)/2-m.current[r],m.current[r]*=t,m.current[r]=Math.max(-2,Math.min(2,m.current[r]))}for(let e=0;e<p;e++)m.current[e]=0,m.current[(p-1)*p+e]=0,m.current[e*p]=0,m.current[e*p+(p-1)]=0;let n=m.current;m.current=m.previous,m.previous=n,h.image.data=m.current,h.needsUpdate=!0};t(({pointer:t})=>{let n=performance.now();if(n-y>=16){y=n;let r=t.x*i.clientWidth,a=t.y*i.clientHeight,o=r-_*i.clientWidth,s=a-v*i.clientHeight,c=Math.sqrt(o*o+s*s);if(c>2){let t=c/16,n=Math.min(t/10,2),i=Math.min(c/20,1),o=i*n*e.mouseIntensity.uniform.value;b(r,a,o)}_=t.x,v=t.y}x()}),r(()=>{h.dispose()});let S=s,ee=e.intensity.uniform,te=1/p,ne=g.sample(S.add(a(te,0))).r.sub(g.sample(S.sub(a(te,0))).r),re=g.sample(S.add(a(0,te))).r.sub(g.sample(S.sub(a(0,te))).r),ie=a(ne,re).mul(ee).mul(.05),ae=s.add(ie);return f.sample(ae)}};var o$=r({__name:`Ripple`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},intensity:{},rippleSpeed:{},damping:{},mouseIntensity:{}},{blendMode:`normal`,...Object.entries(a$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${a$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(a$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(a$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(a$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,a$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),s$=o$;const c$={name:`Saturation`,props:{intensity:{default:1,description:`The intensity of the saturation effect (1 being no change)`,ui:{type:`range`,min:0,max:3,step:.01,label:`Intensity`}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:n}=xj;if(!t)return console.error(`You must pass a child component into the Saturation shader.`),n(0);let r=t||n(0,0,0,0);return n(bQ(r.rgb,e.intensity.uniform).rgb,r.a)}};var l$=r({__name:`Saturation`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},intensity:{}},{blendMode:`normal`,...Object.entries(c$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${c$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(c$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(c$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(c$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,c$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),u$=l$;const d$={name:`SolidColor`,props:{color:{default:`#5b18ca`,transform:iK,description:`The solid color to display`,ui:{type:`color`,label:`Color`}}},fragmentNode:({uniforms:e})=>e.color.uniform};var f$=r({__name:`SolidColor`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},color:{}},{blendMode:`normal`,...Object.entries(d$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${d$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(d$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(d$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(d$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,d$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),p$=f$;const m$={name:`Spiral`,props:{colorBack:{default:`#000000`,transform:iK,description:`Background color`,ui:{type:`color`,label:`Background Color`}},colorFront:{default:`#ffffff`,transform:iK,description:`Spiral stroke color`,ui:{type:`color`,label:`Spiral Color`}},strokeWidth:{default:.5,description:`Thickness of spiral stroke`,ui:{type:`range`,min:0,max:2,step:.01,label:`Stroke Width`}},strokeFalloff:{default:0,description:`Stroke losing width further from center`,ui:{type:`range`,min:0,max:1,step:.01,label:`Stroke Falloff`}},softness:{default:0,description:`Color transition sharpness (0 = hard edge, 1 = smooth fade)`,ui:{type:`range`,min:0,max:1,step:.01,label:`Softness`}},speed:{default:1,description:`Animation speed (negative values reverse direction)`,ui:{type:`range`,min:-3,max:3,step:.1,label:`Speed`}},center:{default:{x:.5,y:.5},transform:aK,description:`The center point of the spiral`},scale:{default:1,description:`Scale factor for spiral bands (higher = more bands, lower = fewer bands)`,ui:{type:`range`,min:.1,max:5,step:.1,label:`Scale`}}},fragmentNode:({uniforms:e})=>{let{vec2:t,vec4:n,float:r,atan2:i,length:a,clamp:o,fract:s,abs:c,mix:l,smoothstep:u,screenUV:d,time:f,fwidth:p,viewportSize:m}=xj,h=m.x.div(m.y),g=t(d.x.mul(h),d.y),_=t(e.center.uniform.x.mul(h),e.center.uniform.y.oneMinus()),v=g.sub(_),y=f.mul(e.speed.uniform),b=a(v),x=b,S=i(v.y,v.x).sub(y),ee=r(6.283185307),te=S.div(ee),ne=x.mul(e.scale.uniform).add(te),re=s(ne),ie=c(re.sub(.5)).mul(2),ae=o(e.strokeWidth.uniform,e.strokeFalloff.uniform.mul(.005),1),oe=o(e.strokeFalloff.uniform,0,1).mul(b).oneMinus(),se=ae.mul(oe),ce=p(ne),le=r(4).sub(u(.05,.4,e.strokeWidth.uniform.mul(2)).mul(u(.05,.4,e.strokeWidth.uniform.oneMinus().mul(2))).mul(3)),ue=l(le.mul(ce),p(ie),o(ce,0,1)),de=u(se.sub(ue).sub(e.softness.uniform),se.add(ue).add(e.softness.uniform),ie),fe=e.colorFront.uniform.rgb.mul(e.colorFront.uniform.a),pe=e.colorFront.uniform.a,me=e.colorBack.uniform.rgb.mul(e.colorBack.uniform.a),he=e.colorBack.uniform.a,ge=fe.mul(de),_e=pe.mul(de),ve=ge.add(me.mul(_e.oneMinus())),ye=_e.add(he.mul(_e.oneMinus()));return n(ve,ye)}};var h$=r({__name:`Spiral`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},colorBack:{},colorFront:{},strokeWidth:{},strokeFalloff:{},softness:{},speed:{},center:{},scale:{}},{blendMode:`normal`,...Object.entries(m$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${m$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(m$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(m$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(m$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,m$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),g$=h$;const _$={name:`Swirl`,props:{colorA:{default:`#1275d8`,description:`Primary gradient color`,transform:iK,ui:{type:`color`,label:`Primary Color`}},colorB:{default:`#e19136`,description:`Secondary gradient color`,transform:iK,ui:{type:`color`,label:`Secondary Color`}},colorC:{default:`#320485`,description:`Accent gradient color`,transform:iK,ui:{type:`color`,label:`Accent Color`}},speed:{default:1,description:`Flow animation speed`,ui:{type:`range`,min:0,max:5,step:.1,label:`Speed`}},scale:{default:5,description:`Gradient scale`,ui:{type:`range`,min:.1,max:20,step:.1,label:`Scale`}},complexity:{default:5,description:`Flow complexity`,ui:{type:`range`,min:1,max:10,step:.1,label:`Complexity`}}},fragmentNode:({uniforms:e})=>{let t=AP(),n=XN.mul(e.speed.uniform),r=e.scale.uniform,i=e.complexity.uniform,a=pN(t.x.mul(r.mul(1.2)).add(n.mul(.8))).mul(.3),o=fM(t.y.mul(r.mul(.9)).sub(n.mul(.6))).mul(.3),s=LP(t.x.add(pN(t.y.mul(i.mul(2)).add(n)).mul(.08)),t.y.add(fM(t.x.mul(i.mul(1.5)).sub(n.mul(.7))).mul(.08))),c=pN(s.x.mul(r.mul(3)).add(s.y.mul(r.mul(2))).add(n.mul(.5))),l=fM(s.x.sub(s.y).mul(r.mul(2.5)).add(n.mul(.3))),u=pN(s.x.mul(i).add(a).add(s.y.mul(i.mul(.8)).add(o)).add(n.mul(.4))),d=vM(c,l,u.mul(.5).add(.5)),f=s.x.mul(.7).add(s.y.mul(.3)).add(d.mul(.2)),p=vM(e.colorA.uniform,e.colorB.uniform,gN(.1,.6,f)),m=vM(p,e.colorC.uniform,gN(.4,.9,f.add(u.mul(.3)))),h=pN(n.mul(3).add(f.mul(10))).mul(.02).add(1),g=m.mul(h);return zP(g,1)}};var v$=r({__name:`Swirl`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},colorA:{},colorB:{},colorC:{},speed:{},scale:{},complexity:{}},{blendMode:`normal`,...Object.entries(_$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${_$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(_$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(_$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(_$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,_$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),y$=v$;const b$={name:`Twirl`,props:{center:{default:{x:.5,y:.5},transform:aK,description:`The center point of the twirl effect`},intensity:{default:1,description:`The strength of the twirl effect`,ui:{type:`range`,min:-5,max:5,step:.1,label:`Intensity`}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec2:n,vec4:r,cos:i,sin:a,length:o,screenUV:s,convertToTexture:c}=xj;if(!t)return console.error(`You must pass a child component into the Twirl shader.`),r(0);let l=c(t),u=s,d=n(e.center.uniform.x,e.center.uniform.y.oneMinus()),f=u.sub(d),p=e.intensity.uniform.mul(o(f)),m=i(p),h=a(p),g=m.mul(f.x).sub(h.mul(f.y)),_=h.mul(f.x).add(m.mul(f.y)),v=n(g.add(d.x),_.add(d.y));return r(l.sample(v))}};var x$=r({__name:`Twirl`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},center:{},intensity:{}},{blendMode:`normal`,...Object.entries(b$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${b$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(b$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(b$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(b$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,b$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),S$=x$;const C$={name:`Vibrance`,props:{intensity:{default:0,description:`The intensity of the vibrance effect`,ui:{type:`range`,min:-2,max:2,step:.01,label:`Intensity`}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:n}=xj;if(!t)return console.error(`You must pass a child component into the Vibrance shader.`),n(0);let r=t||n(0,0,0,0);return n(xQ(r.rgb,e.intensity.uniform).rgb,r.a)}};var w$=r({__name:`Vibrance`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},intensity:{}},{blendMode:`normal`,...Object.entries(C$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${C$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(C$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(C$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(C$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,C$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),T$=w$;const E$=`alphaMap.alphaTest.anisotropy.anisotropyMap.anisotropyRotation.aoMap.aoMapIntensity.attenuationColor.attenuationDistance.bumpMap.clearcoat.clearcoatMap.clearcoatNormalMap.clearcoatNormalScale.clearcoatRoughness.color.dispersion.displacementMap.emissive.emissiveIntensity.emissiveMap.envMap.envMapIntensity.gradientMap.ior.iridescence.iridescenceIOR.iridescenceMap.iridescenceThicknessMap.lightMap.lightMapIntensity.map.matcap.metalness.metalnessMap.normalMap.normalScale.opacity.roughness.roughnessMap.sheen.sheenColor.sheenColorMap.sheenRoughnessMap.shininess.specular.specularColor.specularColorMap.specularIntensity.specularIntensityMap.specularMap.thickness.transmission.transmissionMap`.split(`.`);var D$=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=E$,this.renderId=0}firstInitialization(e){let t=this.renderObjects.has(e);return t===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has(`velocity`)}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,material:r,object:i}=e;if(t={material:this.getMaterialData(r),geometry:{id:n.id,attributes:this.getAttributesData(n.attributes),indexVersion:n.index?n.index.version:null,drawRange:{start:n.drawRange.start,count:n.drawRange.count}},worldMatrix:i.matrixWorld.clone()},i.center&&(t.center=i.center.clone()),i.morphTargetInfluences&&(t.morphTargetInfluences=i.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),t.material.transmission>0){let{width:n,height:r}=e.context;t.bufferWidth=n,t.bufferHeight=r}this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={version:r.version}}return t}containsNode(e){let t=e.material;for(let e in t)if(t[e]&&t[e].isNode)return!0;return e.renderer.overrideNodes.modelViewMatrix!==null||e.renderer.overrideNodes.modelNormalViewMatrix!==null}getMaterialData(e){let t={};for(let n of this.refreshUniforms){let r=e[n];if(r==null)continue;typeof r==`object`&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:r.version}:t[n]=r.clone():t[n]=r}return t}equals(e){let{object:t,material:n,geometry:r}=e,i=this.getRenderObjectData(e);if(i.worldMatrix.equals(t.matrixWorld)!==!0)return i.worldMatrix.copy(t.matrixWorld),!1;let a=i.material;for(let e in a){let t=a[e],r=n[e];if(t.equals!==void 0){if(t.equals(r)===!1)return t.copy(r),!1}else if(r.isTexture===!0){if(t.id!==r.id||t.version!==r.version)return t.id=r.id,t.version=r.version,!1}else if(t!==r)return a[e]=r,!1}if(a.transmission>0){let{width:t,height:n}=e.context;if(i.bufferWidth!==t||i.bufferHeight!==n)return i.bufferWidth=t,i.bufferHeight=n,!1}let o=i.geometry,s=r.attributes,c=o.attributes,l=Object.keys(c),u=Object.keys(s);if(o.id!==r.id)return o.id=r.id,!1;if(l.length!==u.length)return i.geometry.attributes=this.getAttributesData(s),!1;for(let e of l){let t=c[e],n=s[e];if(n===void 0)return delete c[e],!1;if(t.version!==n.version)return t.version=n.version,!1}let d=r.index,f=o.indexVersion,p=d?d.version:null;if(f!==p)return o.indexVersion=p,!1;if(o.drawRange.start!==r.drawRange.start||o.drawRange.count!==r.drawRange.count)return o.drawRange.start=r.drawRange.start,o.drawRange.count=r.drawRange.count,!1;if(i.morphTargetInfluences){let e=!1;for(let n=0;n<i.morphTargetInfluences.length;n++)i.morphTargetInfluences[n]!==t.morphTargetInfluences[n]&&(e=!0);if(e)return!0}return i.center&&i.center.equals(t.center)===!1?(i.center.copy(t.center),!0):(e.bundle!==null&&(i.version=e.bundle.version),!0)}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,i=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||i)return!1;let a=this.equals(e)!==!0;return a}};function O$(e,t=0){let n=3735928559^t,r=1103547991^t;if(e instanceof Array)for(let t=0,i;t<e.length;t++)i=e[t],n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);else for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),4294967296*(2097151&r)+(n>>>0)}const k$=e=>O$(e),A$=e=>O$(e),j$=(...e)=>O$(e);function M$(e,t=!1){let n=[];e.isNode===!0&&(n.push(e.id),e=e.getSelf());for(let{property:r,childNode:i}of N$(e))n.push(O$(r.slice(0,-4)),i.getCacheKey(t));return O$(n)}function*N$(e,t=!1){for(let n in e){if(n.startsWith(`_`)===!0)continue;let r=e[n];if(Array.isArray(r)===!0)for(let e=0;e<r.length;e++){let i=r[e];i&&(i.isNode===!0||t&&typeof i.toJSON==`function`)&&(yield{property:n,index:e,childNode:i})}else if(r&&r.isNode===!0)yield{property:n,childNode:r};else if(typeof r==`object`)for(let e in r){let i=r[e];i&&(i.isNode===!0||t&&typeof i.toJSON==`function`)&&(yield{property:n,index:e,childNode:i})}}}const P$=new Map([[1,`float`],[2,`vec2`],[3,`vec3`],[4,`vec4`],[9,`mat3`],[16,`mat4`]]),F$=new WeakMap;function I$(e){return P$.get(e)}function L$(e){if(/[iu]?vec\d/.test(e))return e.startsWith(`ivec`)?Int32Array:e.startsWith(`uvec`)?Uint32Array:Float32Array;if(/mat\d/.test(e)||/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function R$(e){if(/float|int|uint/.test(e))return 1;if(/vec2/.test(e))return 2;if(/vec3/.test(e))return 3;if(/vec4/.test(e)||/mat2/.test(e))return 4;if(/mat3/.test(e))return 9;if(/mat4/.test(e))return 16;console.error(`THREE.TSL: Unsupported type:`,e)}function z$(e){if(/float|int|uint/.test(e))return 1;if(/vec2/.test(e))return 2;if(/vec3/.test(e))return 3;if(/vec4/.test(e)||/mat2/.test(e))return 4;if(/mat3/.test(e))return 12;if(/mat4/.test(e))return 16;console.error(`THREE.TSL: Unsupported type:`,e)}function B$(e){if(/float|int|uint/.test(e))return 4;if(/vec2/.test(e))return 8;if(/vec3/.test(e)||/vec4/.test(e))return 16;if(/mat2/.test(e))return 8;if(/mat3/.test(e))return 48;if(/mat4/.test(e))return 64;console.error(`THREE.TSL: Unsupported type:`,e)}function V$(e){if(e==null)return null;let t=typeof e;return e.isNode===!0?`node`:t===`number`?`float`:t===`boolean`?`bool`:t===`string`?`string`:t===`function`?`shader`:e.isVector2===!0?`vec2`:e.isVector3===!0?`vec3`:e.isVector4===!0?`vec4`:e.isMatrix2===!0?`mat2`:e.isMatrix3===!0?`mat3`:e.isMatrix4===!0?`mat4`:e.isColor===!0?`color`:e instanceof ArrayBuffer?`ArrayBuffer`:null}function H$(e,...t){let n=e?e.slice(-4):void 0;return t.length===1&&(n===`vec2`?t=[t[0],t[0]]:n===`vec3`?t=[t[0],t[0],t[0]]:n===`vec4`&&(t=[t[0],t[0],t[0],t[0]])),e===`color`?new lz(...t):n===`vec2`?new _L(...t):n===`vec3`?new L(...t):n===`vec4`?new VL(...t):n===`mat2`?new HB(...t):n===`mat3`?new xL(...t):n===`mat4`?new _R(...t):e===`bool`?t[0]||!1:e===`float`||e===`int`||e===`uint`?t[0]||0:e===`string`?t[0]||``:e===`ArrayBuffer`?G$(t[0]):null}function U$(e){let t=F$.get(e);return t===void 0&&(t={},F$.set(e,t)),t}function W$(e){let t=``,n=new Uint8Array(e);for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return btoa(t)}function G$(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0)).buffer}const K$={VERTEX:`vertex`,FRAGMENT:`fragment`},q$={NONE:`none`,FRAME:`frame`,RENDER:`render`,OBJECT:`object`},J$={BOOLEAN:`bool`,INTEGER:`int`,FLOAT:`float`,VECTOR2:`vec2`,VECTOR3:`vec3`,VECTOR4:`vec4`,MATRIX2:`mat2`,MATRIX3:`mat3`,MATRIX4:`mat4`},Y$={READ_ONLY:`readOnly`,WRITE_ONLY:`writeOnly`,READ_WRITE:`readWrite`},X$=[`fragment`,`vertex`],Z$=[`setup`,`analyze`,`generate`],Q$=[...X$,`compute`],$$=[`x`,`y`,`z`,`w`],e1={analyze:`setup`,generate:`analyze`};let t1=0;var n1=class extends UI{static get type(){return`Node`}constructor(e=null){super(),this.nodeType=e,this.updateType=q$.NONE,this.updateBeforeType=q$.NONE,this.updateAfterType=q$.NONE,this.uuid=gL.generateUUID(),this.version=0,this.global=!1,this.parents=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,`id`,{value:t1++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,q$.FRAME)}onRenderUpdate(e){return this.onUpdate(e,q$.RENDER)}onObjectUpdate(e){return this.onUpdate(e,q$.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of N$(this))yield e}dispose(){this.dispatchEvent({type:`dispose`})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e||=this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=j$(M$(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}customCacheKey(){return 0}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e),n=e.getElementType(t);return n}getMemberType(){return`void`}getNodeType(e){let t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){let t=this.getHash(e),n=e.getNodeFromHash(t);return n||this}setup(e){let t=e.getNodeProperties(this),n=0;for(let e of this.getChildren())t[`node`+ n++]=e;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let n=e.getDataFromNode(this,`any`);n.stages=n.stages||{},n.stages[e.shaderStage]=n.stages[e.shaderStage]||[],n.stages[e.shaderStage].push(t)}if(n===1){let t=e.getNodeProperties(this);for(let n of Object.values(t))n&&n.isNode===!0&&n.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){console.warn(`Abstract function.`)}updateAfter(){console.warn(`Abstract function.`)}update(){console.warn(`Abstract function.`)}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let i=e1[e.buildStage];if(i&&r.buildStages[i]!==!0){let t=e.getBuildStage();e.setBuildStage(i),this.build(e),e.setBuildStage(t)}e.addNode(this),e.addChain(this);let a=null,o=e.getBuildStage();if(o===`setup`){this.updateReference(e);let t=e.getNodeProperties(this);if(t.initialized!==!0){t.initialized=!0,t.outputNode=this.setup(e)||t.outputNode||null;for(let n of Object.values(t))if(n&&n.isNode===!0){if(n.parents===!0){let t=e.getNodeProperties(n);t.parents=t.parents||[],t.parents.push(this)}n.build(e)}}a=t.outputNode}else if(o===`analyze`)this.analyze(e,t);else if(o===`generate`){let n=this.generate.length===1;if(n){let n=this.getNodeType(e),r=e.getDataFromNode(this);a=r.snippet,a===void 0?r.generated===void 0?(r.generated=!0,a=this.generate(e)||``,r.snippet=a):(console.warn(`THREE.Node: Recursion detected.`,this),a=``):r.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),a=e.format(a,n,t)}else a=this.generate(e,t)||``}return e.removeChain(this),e.addSequentialNode(this),a}getSerializeChildren(){return N$(this)}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:i,childNode:a}of t)i===void 0?n[r]=a.toJSON(e.meta).uuid:(n[r]===void 0&&(n[r]=Number.isInteger(i)?[]:{}),n[r][i]=a.toJSON(e.meta).uuid);Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let i of e.inputNodes[n])r.push(t[i]);this[n]=r}else if(typeof e.inputNodes[n]==`object`){let r={};for(let i in e.inputNodes[n]){let a=e.inputNodes[n][i];r[i]=t[a]}this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e==`string`;r&&(e={textures:{},images:{},nodes:{}});let i=e.nodes[t];i===void 0&&(i={uuid:t,type:n,meta:e,metadata:{version:4.7,type:`Node`,generator:`Node.toJSON`}},r!==!0&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta);function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(r){let t=a(e.textures),n=a(e.images),r=a(e.nodes);t.length>0&&(i.textures=t),n.length>0&&(i.images=n),r.length>0&&(i.nodes=r)}return i}},r1=class extends n1{static get type(){return`ArrayElementNode`}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){let t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:`uint`);return`${n}[ ${r} ]`}},i1=class extends n1{static get type(){return`ConvertNode`}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split(`|`))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),i=n.build(e,r);return e.format(i,r,t)}},a1=class extends n1{static get type(){return`TempNode`}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){let n=e.getBuildStage();if(n===`generate`){let n=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,n,t);if(n!==`void`&&t!==`void`&&this.hasDependencies(e)){let i=super.build(e,n),a=e.getVarFromNode(this,null,n),o=e.getPropertyName(a);return e.addLineFlowCode(`${o} = ${i}`,this),r.snippet=i,r.propertyName=o,e.format(r.propertyName,n,t)}}return super.build(e,t)}},o1=class extends a1{static get type(){return`JoinNode`}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType===null?e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0)):e.getVectorType(this.nodeType)}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),i=this.nodes,a=e.getComponentType(n),o=[],s=0;for(let t of i){if(s>=r){console.error(`THREE.TSL: Length of parameters exceeds maximum length of function '${n}()' type.`);break}let i=t.getNodeType(e),c=e.getTypeLength(i),l;s+c>r&&(console.error(`THREE.TSL: Length of '${n}()' data exceeds maximum length of output type.`),c=r-s,i=e.getTypeFromLength(c)),s+=c,l=t.build(e,i);let u=e.getComponentType(i);u!==a&&(l=e.format(l,u,a)),o.push(l)}let c=`${e.getType(n)}( ${o.join(`, `)} )`;return e.format(c,n,t)}};const s1=$$.join(``);var c1=class extends n1{static get type(){return`SplitNode`}constructor(e,t=`x`){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max($$.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),i=null;if(r>1){let a=null,o=this.getVectorLength();o>=r&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let s=n.build(e,a);i=this.components.length===r&&this.components===s1.slice(0,this.components.length)?e.format(s,a,t):e.format(`${s}.${this.components}`,this.getNodeType(e),t)}else i=n.build(e,t);return i}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},l1=class extends a1{static get type(){return`SetNode`}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,i=this.getNodeType(e),a=e.getComponentType(r.getNodeType(e)),o=e.getTypeFromLength(n.length,a),s=r.build(e,o),c=t.build(e,i),l=e.getTypeLength(i),u=[];for(let e=0;e<l;e++){let t=$$[e];t===n[0]?(u.push(s),e+=n.length-1):u.push(c+`.`+t)}return`${e.getType(i)}( ${u.join(`, `)} )`}},u1=class extends a1{static get type(){return`FlipNode`}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),i=n.build(e),a=e.getVarFromNode(this),o=e.getPropertyName(a);e.addLineFlowCode(o+` = `+i,this);let s=e.getTypeLength(r),c=[],l=0;for(let e=0;e<s;e++){let n=$$[e];n===t[l]?(c.push(`1.0 - `+(o+`.`+n)),l++):c.push(o+`.`+n)}return`${e.getType(r)}( ${c.join(`, `)} )`}},d1=class extends n1{static get type(){return`InputNode`}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?V$(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=V$(this.value),e.nodeType=this.nodeType,e.valueType===`ArrayBuffer`&&(e.value=W$(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?H$(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn(`Abstract function.`)}};const f1=/float|u?int/;var p1=class extends d1{static get type(){return`ConstNode`}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return f1.test(n)&&f1.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},m1=class extends n1{static get type(){return`MemberNode`}constructor(e,t){super(),this.node=e,this.property=t,this.isMemberNode=!0}getNodeType(e){return this.node.getMemberType(e,this.property)}generate(e){let t=this.node.build(e);return t+`.`+this.property}};let h1=null;const g1=new Map;function V(e,t){if(g1.has(e)){console.warn(`THREE.TSL: Redefinition of method chaining '${e}'.`);return}if(typeof t!=`function`)throw Error(`THREE.TSL: Node element ${e} is not a function`);g1.set(e,t)}const _1=e=>e.replace(/r|s/g,`x`).replace(/g|t/g,`y`).replace(/b|p/g,`z`).replace(/a|q/g,`w`),v1=e=>_1(e).split(``).sort().join(``),y1={setup(e,t){let n=t.shift();return e(G1(n),...t)},get(e,t,n){if(typeof t==`string`&&e[t]===void 0){if(e.isStackNode!==!0&&t===`assign`)return(...e)=>(h1.assign(n,...e),n);if(g1.has(t)){let r=g1.get(t);return e.isStackNode?(...e)=>n.add(r(...e)):(...e)=>r(n,...e)}else if(t===`self`)return e;else if(t.endsWith(`Assign`)&&g1.has(t.slice(0,t.length-6))){let r=g1.get(t.slice(0,t.length-6));return e.isStackNode?(...e)=>n.assign(e[0],r(...e)):(...e)=>n.assign(r(n,...e))}else if(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0)return t=_1(t),H(new c1(n,t));else if(/^set[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=v1(t.slice(3).toLowerCase()),n=>H(new l1(e,t,H(n)));else if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=v1(t.slice(4).toLowerCase()),()=>H(new u1(H(e),t));else if(t===`width`||t===`height`||t===`depth`)return t===`width`?t=`x`:t===`height`?t=`y`:t===`depth`&&(t=`z`),H(new c1(e,t));else if(/^\d+$/.test(t)===!0)return H(new r1(n,new p1(Number(t),`uint`)));else if(/^get$/.test(t)===!0)return e=>H(new m1(n,e))}return Reflect.get(e,t,n)},set(e,t,n,r){return typeof t==`string`&&e[t]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0||t===`width`||t===`height`||t===`depth`||/^\d+$/.test(t)===!0)?(r[t].assign(n),!0):Reflect.set(e,t,n,r)}},b1=new WeakMap,x1=new WeakMap,S1=function(e,t=null){let n=V$(e);if(n===`node`){let t=b1.get(e);return t===void 0&&(t=new Proxy(e,y1),b1.set(e,t),b1.set(t,t)),t}else if(t===null&&(n===`float`||n===`boolean`)||n&&n!==`shader`&&n!==`string`)return H(z1(e,t));else if(n===`shader`)return G(e);return e},C1=function(e,t=null){for(let n in e)e[n]=H(e[n],t);return e},w1=function(e,t=null){let n=e.length;for(let r=0;r<n;r++)e[r]=H(e[r],t);return e},T1=function(e,t=null,n=null,r=null){let i=e=>H(r===null?e:Object.assign(e,r)),a,o=t,s,c;function l(t){let n;return n=o?/[a-z]/i.test(o)?o+`()`:o:e.type,s!==void 0&&t.length<s?(console.error(`THREE.TSL: "${n}" parameter length is less than minimum required.`),t.concat(Array(s-t.length).fill(0))):c!==void 0&&t.length>c?(console.error(`THREE.TSL: "${n}" parameter length exceeds limit.`),t.slice(0,c)):t}return t===null?a=(...t)=>i(new e(...K1(l(t)))):n===null?a=(...n)=>i(new e(t,...K1(l(n)))):(n=H(n),a=(...r)=>i(new e(t,...K1(l(r)),n))),a.setParameterLength=(...e)=>(e.length===1?s=c=e[0]:e.length===2&&([s,c]=e),a),a.setName=e=>(o=e,a),a},E1=function(e,...t){return H(new e(...K1(t)))};var D1=class extends n1{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,inputNodes:n}=this,r=e.getNodeProperties(t),i=t.namespace&&t.namespace===e.namespace?e.getNamespace(`once`):`once`;if(r[i])return r[i];let a=null;if(t.layout){let r=x1.get(e.constructor);r===void 0&&(r=new WeakMap,x1.set(e.constructor,r));let i=r.get(t);i===void 0&&(i=H(e.buildFunctionNode(t)),r.set(t,i)),e.addInclude(i),a=H(i.call(n))}else{let r=t.jsFunc,i=n!==null||r.length>1?r(n||[],e):r(e);a=H(i)}return t.once&&(r[i]=a),a}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getOutputNamespace();return t[n]=t[n]||this.setupOutput(e),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),i=e.getNodeProperties(this),a=e.getOutputNamespace(),o=this.getOutputNode(e);if(r===`setup`){let t=e.getNamespace(`initialized`);i[t]!==!0&&(i[t]=!0,i[a]=this.getOutputNode(e),i[a].build(e)),n=i[a]}else r===`analyze`?o.build(e,t):r===`generate`&&(n=o.build(e,t)||``);return n}},O1=class extends n1{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1,this.namespace=null}setLayout(e){return this.layout=e,this}call(e=null){return G1(e),H(new D1(this,e))}setup(){return this.call()}};const k1=[!1,!0],A1=[0,1,2,3],j1=[-1,-2],M1=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],N1=new Map;for(let e of k1)N1.set(e,new p1(e));const P1=new Map;for(let e of A1)P1.set(e,new p1(e,`uint`));const F1=new Map([...P1].map(e=>new p1(e.value,`int`)));for(let e of j1)F1.set(e,new p1(e,`int`));const I1=new Map([...F1].map(e=>new p1(e.value)));for(let e of M1)I1.set(e,new p1(e));for(let e of M1)I1.set(-e,new p1(-e));const L1={bool:N1,uint:P1,ints:F1,float:I1},R1=new Map([...N1,...I1]),z1=(e,t)=>R1.has(e)?R1.get(e):e.isNode===!0?e:new p1(e,t),B1=e=>{try{return e.getNodeType()}catch{return}},V1=function(e,t=null){return(...n)=>{if((n.length===0||![`bool`,`float`,`int`,`uint`].includes(e)&&n.every(e=>typeof e!=`object`))&&(n=[H$(e,...n)]),n.length===1&&t!==null&&t.has(n[0]))return H(t.get(n[0]));if(n.length===1){let t=z1(n[0],e);return B1(t)===e?H(t):H(new i1(t,e))}let r=n.map(e=>z1(e));return H(new o1(r,e))}},H1=e=>typeof e==`object`&&e?e.value:e,U1=e=>e==null?null:e.nodeType||e.convertTo||(typeof e==`string`?e:null);function W1(e,t){return new Proxy(new O1(e,t),y1)}const H=(e,t=null)=>S1(e,t),G1=(e,t=null)=>new C1(e,t),K1=(e,t=null)=>new w1(e,t),U=(...e)=>new T1(...e),W=(...e)=>new E1(...e);let q1=0;const G=(e,t=null)=>{let n=null;t!==null&&(typeof t==`object`?n=t.return:(typeof t==`string`?n=t:console.error(`THREE.TSL: Invalid layout type.`),t=null));let r=new W1(e,n),i=(...e)=>{let t;G1(e);let i=e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype);t=i?[...e]:e[0];let a=r.call(t);return n===`void`&&a.toStack(),a};if(i.shaderNode=r,i.id=r.id,i.getNodeType=(...e)=>r.getNodeType(...e),i.getCacheKey=(...e)=>r.getCacheKey(...e),i.setLayout=e=>(r.setLayout(e),i),i.once=(e=null)=>(r.once=!0,r.namespace=e,i),t!==null){if(typeof t.inputs!=`object`){let e={name:`fn`+ q1++,type:n,inputs:[]};for(let n in t){if(n===`return`)continue;e.inputs.push({name:n,type:t[n]})}t=e}i.setLayout(t)}return i},J1=e=>{h1=e},Y1=()=>h1,X1=(...e)=>h1.If(...e),Z1=(...e)=>h1.Switch(...e);function Q1(e){return h1&&h1.add(e),e}V(`toStack`,Q1);const $1=new V1(`color`),K=new V1(`float`,L1.float),q=new V1(`int`,L1.ints),J=new V1(`uint`,L1.uint),e0=new V1(`bool`,L1.bool),Y=new V1(`vec2`),t0=new V1(`ivec2`),n0=new V1(`uvec2`),r0=new V1(`bvec2`),X=new V1(`vec3`),i0=new V1(`ivec3`),a0=new V1(`uvec3`),o0=new V1(`bvec3`),s0=new V1(`vec4`),c0=new V1(`ivec4`),l0=new V1(`uvec4`),u0=new V1(`bvec4`),d0=new V1(`mat2`),f0=new V1(`mat3`),p0=new V1(`mat4`),m0=(e=``)=>H(new p1(e,`string`)),h0=e=>H(new p1(e,`ArrayBuffer`));V(`toColor`,$1),V(`toFloat`,K),V(`toInt`,q),V(`toUint`,J),V(`toBool`,e0),V(`toVec2`,Y),V(`toIVec2`,t0),V(`toUVec2`,n0),V(`toBVec2`,r0),V(`toVec3`,X),V(`toIVec3`,i0),V(`toUVec3`,a0),V(`toBVec3`,o0),V(`toVec4`,s0),V(`toIVec4`,c0),V(`toUVec4`,l0),V(`toBVec4`,u0),V(`toMat2`,d0),V(`toMat3`,f0),V(`toMat4`,p0);const g0=U(r1).setParameterLength(2),_0=(e,t)=>H(new i1(H(e),t)),v0=(e,t)=>H(new c1(H(e),t));V(`element`,g0),V(`convert`,_0);const y0=e=>(console.warn(`THREE.TSL: append() has been renamed to Stack().`),Q1(e));V(`append`,e=>(console.warn(`THREE.TSL: .append() has been renamed to .toStack().`),Q1(e)));const b0=(...e)=>(console.warn(`THREE.TSL: tslFn() has been renamed to Fn().`),G(...e));var x0=class extends n1{static get type(){return`PropertyNode`}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0,this.global=!0}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}};const S0=(e,t)=>H(new x0(e,t)),C0=(e,t)=>H(new x0(e,t,!0)),w0=W(x0,`vec4`,`DiffuseColor`),T0=W(x0,`vec3`,`EmissiveColor`),E0=W(x0,`float`,`Roughness`),D0=W(x0,`float`,`Metalness`),O0=W(x0,`float`,`Clearcoat`),k0=W(x0,`float`,`ClearcoatRoughness`),A0=W(x0,`vec3`,`Sheen`),j0=W(x0,`float`,`SheenRoughness`),M0=W(x0,`float`,`Iridescence`),N0=W(x0,`float`,`IridescenceIOR`),P0=W(x0,`float`,`IridescenceThickness`),F0=W(x0,`float`,`AlphaT`),I0=W(x0,`float`,`Anisotropy`),L0=W(x0,`vec3`,`AnisotropyT`),R0=W(x0,`vec3`,`AnisotropyB`),z0=W(x0,`color`,`SpecularColor`),B0=W(x0,`float`,`SpecularF90`),V0=W(x0,`float`,`Shininess`),H0=W(x0,`vec4`,`Output`),U0=W(x0,`float`,`dashSize`),W0=W(x0,`float`,`gapSize`),G0=W(x0,`float`,`pointWidth`),K0=W(x0,`float`,`IOR`),q0=W(x0,`float`,`Transmission`),J0=W(x0,`float`,`Thickness`),Y0=W(x0,`float`,`AttenuationDistance`),X0=W(x0,`color`,`AttenuationColor`),Z0=W(x0,`float`,`Dispersion`);var Q0=class extends n1{static get type(){return`UniformGroupNode`}constructor(e,t=!1,n=1){super(`string`),this.name=e,this.shared=t,this.order=n,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}};const $0=e=>new Q0(e),e2=(e,t=0)=>new Q0(e,!0,t),t2=e2(`frame`),n2=e2(`render`),r2=$0(`object`);var i2=class extends d1{static get type(){return`UniformNode`}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name=``,this.groupNode=r2}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){let n=this.getSelf();return e=e.bind(n),super.onUpdate(t=>{let r=e(t,n);r!==void 0&&(this.value=r)},t)}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),i=e.getNodeFromHash(r);i===void 0&&(e.setHashNode(this,r),i=this);let a=i.getInputType(e),o=e.getUniformFromNode(i,a,e.shaderStage,this.name||e.context.label),s=e.getPropertyName(o);return e.context.label!==void 0&&delete e.context.label,e.format(s,n,t)}};const a2=(e,t)=>{let n=U1(t||e),r=e&&e.isNode===!0?e.node&&e.node.value||e.value:e;return H(new i2(r,n))};var o2=class extends a1{static get type(){return`ArrayNode`}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getNodeType(e){return this.nodeType===null&&(this.nodeType=this.values[0].getNodeType(e)),this.nodeType}getElementType(e){return this.getNodeType(e)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}};const s2=(...e)=>{let t;if(e.length===1){let n=e[0];t=new o2(null,n.length,n)}else{let n=e[0],r=e[1];t=new o2(n,r)}return H(t)};V(`toArray`,(e,t)=>s2(Array(t).fill(e)));var c2=class extends a1{static get type(){return`AssignNode`}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(e,t){return t===`void`?`void`:this.targetNode.getNodeType(e)}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable(`swizzleAssign`)===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e)),r=$$.join(``).slice(0,n)!==t.components;return r}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=e.getNodeProperties(this);r.sourceNode=n,r.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),i=this.needsSplitAssign(e),a=n.getNodeType(e),o=n.build(e),s=r.build(e,a),c=r.getNodeType(e),l=e.getDataFromNode(this),u;if(l.initialized===!0)t!==`void`&&(u=o);else if(i){let r=e.getVarFromNode(this,null,a),i=e.getPropertyName(r);e.addLineFlowCode(`${i} = ${s}`,this);let c=n.node,l=c.node.context({assign:!0}),d=l.build(e);for(let t=0;t<c.components.length;t++){let n=c.components[t];e.addLineFlowCode(`${d}.${n} = ${i}[ ${t} ]`,this)}t!==`void`&&(u=o)}else u=`${o} = ${s}`,(t===`void`||c===`void`)&&(e.addLineFlowCode(u,this),t!==`void`&&(u=o));return l.initialized=!0,e.format(u,a,t)}};const l2=U(c2).setParameterLength(2);V(`assign`,l2);var u2=class extends a1{static get type(){return`FunctionCallNode`}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),i=this.parameters,a=(t,n)=>{let r=n.type,i=r===`pointer`,a;return a=i?`&`+t.build(e):t.build(e,r),a};if(Array.isArray(i)){if(i.length>r.length)console.error(`THREE.TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'.`),i.length=r.length;else if(i.length<r.length)for(console.error(`THREE.TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.`);i.length<r.length;)i.push(K(0));for(let e=0;e<i.length;e++)t.push(a(i[e],r[e]))}else for(let e of r){let n=i[e.name];n===void 0?(console.error(`THREE.TSL: Input '${e.name}' not found in \'Fn()\'.`),t.push(a(K(0),e))):t.push(a(n,e))}let o=n.build(e,`property`);return`${o}( ${t.join(`, `)} )`}};const d2=(e,...t)=>(t=t.length>1||t[0]&&t[0].isNode===!0?K1(t):G1(t[0]),H(new u2(H(e),t)));V(`call`,d2);const f2={"==":`equal`,"!=":`notEqual`,"<":`lessThan`,">":`greaterThan`,"<=":`lessThanEqual`,">=":`greaterThanEqual`,"%":`mod`};var p2=class e extends a1{static get type(){return`OperatorNode`}constructor(t,n,r,...i){if(super(),i.length>0){let a=new e(t,n,r);for(let n=0;n<i.length-1;n++)a=new e(t,a,i[n]);n=a,r=i[i.length-1]}this.op=t,this.aNode=n,this.bNode=r,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(f2[this.op],t)}getNodeType(e){let t=this.op,n=this.aNode,r=this.bNode,i=n.getNodeType(e),a=r?r.getNodeType(e):null;if(i===`void`||a===`void`)return`void`;if(t===`%`)return i;if(t===`~`||t===`&`||t===`|`||t===`^`||t===`>>`||t===`<<`)return e.getIntegerType(i);if(t===`!`||t===`&&`||t===`||`||t===`^^`)return`bool`;if(t===`==`||t===`!=`||t===`<`||t===`>`||t===`<=`||t===`>=`){let t=Math.max(e.getTypeLength(i),e.getTypeLength(a));return t>1?`bvec${t}`:`bool`}else{if(e.isMatrix(i)){if(a===`float`)return i;if(e.isVector(a))return e.getVectorFromMatrix(i);if(e.isMatrix(a))return i}else if(e.isMatrix(a)){if(i===`float`)return a;if(e.isVector(i))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(i)?a:i}}generate(e,t){let n=this.op,{aNode:r,bNode:i}=this,a=this.getNodeType(e),o=null,s=null;a===`void`?o=s=a:(o=r.getNodeType(e),s=i?i.getNodeType(e):null,n===`<`||n===`>`||n===`<=`||n===`>=`||n===`==`||n===`!=`?e.isVector(o)?s=o:e.isVector(s)?o=s:o!==s&&(o=s=`float`):n===`>>`||n===`<<`?(o=a,s=e.changeComponentType(s,`uint`)):n===`%`?(o=a,s=e.isInteger(o)&&e.isInteger(s)?s:o):e.isMatrix(o)?s===`float`?s=`float`:e.isVector(s)?s=e.getVectorFromMatrix(o):e.isMatrix(s)||(o=s=a):o=e.isMatrix(s)?o===`float`?`float`:e.isVector(o)?e.getVectorFromMatrix(s):s=a:s=a);let c=r.build(e,o),l=i?i.build(e,s):null,u=e.getFunctionOperator(n);if(t!==`void`){let r=e.renderer.coordinateSystem===VI;if(n===`==`||n===`!=`||n===`<`||n===`>`||n===`<=`||n===`>=`)return r&&e.isVector(o)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${l} )`,a,t):e.format(`( ${c} ${n} ${l} )`,a,t);if(n===`%`)return e.isInteger(s)?e.format(`( ${c} % ${l} )`,a,t):e.format(`${this.getOperatorMethod(e,a)}( ${c}, ${l} )`,a,t);if(n===`!`||n===`~`)return e.format(`(${n}${c})`,o,t);if(u)return e.format(`${u}( ${c}, ${l} )`,a,t);if(e.isMatrix(o)&&s===`float`)return e.format(`( ${l} ${n} ${c} )`,a,t);if(o===`float`&&e.isMatrix(s))return e.format(`${c} ${n} ${l}`,a,t);{let i=`( ${c} ${n} ${l} )`;return!r&&a===`bool`&&e.isVector(o)&&e.isVector(s)&&(i=`all${i}`),e.format(i,a,t)}}else if(o!==`void`)return u?e.format(`${u}( ${c}, ${l} )`,a,t):e.isMatrix(o)&&s===`float`?e.format(`${l} ${n} ${c}`,a,t):e.format(`${c} ${n} ${l}`,a,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}};const m2=U(p2,`+`).setParameterLength(2,1/0).setName(`add`),h2=U(p2,`-`).setParameterLength(2,1/0).setName(`sub`),g2=U(p2,`*`).setParameterLength(2,1/0).setName(`mul`),_2=U(p2,`/`).setParameterLength(2,1/0).setName(`div`),v2=U(p2,`%`).setParameterLength(2).setName(`mod`),y2=U(p2,`==`).setParameterLength(2).setName(`equal`),b2=U(p2,`!=`).setParameterLength(2).setName(`notEqual`),x2=U(p2,`<`).setParameterLength(2).setName(`lessThan`),S2=U(p2,`>`).setParameterLength(2).setName(`greaterThan`),C2=U(p2,`<=`).setParameterLength(2).setName(`lessThanEqual`),w2=U(p2,`>=`).setParameterLength(2).setName(`greaterThanEqual`),T2=U(p2,`&&`).setParameterLength(2,1/0).setName(`and`),E2=U(p2,`||`).setParameterLength(2,1/0).setName(`or`),D2=U(p2,`!`).setParameterLength(1).setName(`not`),O2=U(p2,`^^`).setParameterLength(2).setName(`xor`),k2=U(p2,`&`).setParameterLength(2).setName(`bitAnd`),A2=U(p2,`~`).setParameterLength(2).setName(`bitNot`),j2=U(p2,`|`).setParameterLength(2).setName(`bitOr`),M2=U(p2,`^`).setParameterLength(2).setName(`bitXor`),N2=U(p2,`<<`).setParameterLength(2).setName(`shiftLeft`),P2=U(p2,`>>`).setParameterLength(2).setName(`shiftRight`),F2=G(([e])=>(e.addAssign(1),e)),I2=G(([e])=>(e.subAssign(1),e)),L2=G(([e])=>{let t=q(e).toConst();return e.addAssign(1),t}),R2=G(([e])=>{let t=q(e).toConst();return e.subAssign(1),t});V(`add`,m2),V(`sub`,h2),V(`mul`,g2),V(`div`,_2),V(`mod`,v2),V(`equal`,y2),V(`notEqual`,b2),V(`lessThan`,x2),V(`greaterThan`,S2),V(`lessThanEqual`,C2),V(`greaterThanEqual`,w2),V(`and`,T2),V(`or`,E2),V(`not`,D2),V(`xor`,O2),V(`bitAnd`,k2),V(`bitNot`,A2),V(`bitOr`,j2),V(`bitXor`,M2),V(`shiftLeft`,N2),V(`shiftRight`,P2),V(`incrementBefore`,F2),V(`decrementBefore`,I2),V(`increment`,L2),V(`decrement`,R2);const z2=(e,t)=>(console.warn(`THREE.TSL: "remainder()" is deprecated. Use "mod( int( ... ) )" instead.`),v2(e,t)),B2=(e,t)=>(console.warn(`THREE.TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.`),v2(q(e),q(t)));V(`remainder`,z2),V(`modInt`,B2);var Z=class e extends a1{static get type(){return`MathNode`}constructor(t,n,r=null,i=null){if(super(),(t===e.MAX||t===e.MIN)&&arguments.length>3){let a=new e(t,n,r);for(let n=2;n<arguments.length-1;n++)a=new e(t,a,arguments[n]);n=a,r=arguments[arguments.length-1],i=null}this.method=t,this.aNode=n,this.bNode=r,this.cNode=i,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,i=e.isMatrix(t)?0:e.getTypeLength(t),a=e.isMatrix(n)?0:e.getTypeLength(n),o=e.isMatrix(r)?0:e.getTypeLength(r);return i>a&&i>o?t:a>o?n:o>i?r:t}getNodeType(t){let n=this.method;return n===e.LENGTH||n===e.DISTANCE||n===e.DOT?`float`:n===e.CROSS?`vec3`:n===e.ALL||n===e.ANY?`bool`:n===e.EQUALS?t.changeComponentType(this.aNode.getNodeType(t),`bool`):this.getInputType(t)}setup(t){let{aNode:n,bNode:r,method:i}=this,a=null;if(i===e.ONE_MINUS)a=h2(1,n);else if(i===e.RECIPROCAL)a=_2(1,n);else if(i===e.DIFFERENCE)a=d4(h2(n,r));else if(i===e.TRANSFORM_DIRECTION){let e=n,i=r;t.isMatrix(e.getNodeType(t))?i=s0(X(i),0):e=s0(X(e),0);let o=g2(e,i).xyz;a=r4(o)}return a===null?super.setup(t):a}generate(t,n){let r=t.getNodeProperties(this);if(r.outputNode)return super.generate(t,n);let i=this.method,a=this.getNodeType(t),o=this.getInputType(t),s=this.aNode,c=this.bNode,l=this.cNode,u=t.renderer.coordinateSystem;if(i===e.NEGATE)return t.format(`( - `+s.build(t,o)+` )`,a,n);{let r=[];return i===e.CROSS?r.push(s.build(t,a),c.build(t,a)):u===VI&&i===e.STEP?r.push(s.build(t,t.getTypeLength(s.getNodeType(t))===1?`float`:o),c.build(t,o)):u===VI&&(i===e.MIN||i===e.MAX)?r.push(s.build(t,o),c.build(t,t.getTypeLength(c.getNodeType(t))===1?`float`:o)):i===e.REFRACT?r.push(s.build(t,o),c.build(t,o),l.build(t,`float`)):i===e.MIX?r.push(s.build(t,o),c.build(t,o),l.build(t,t.getTypeLength(l.getNodeType(t))===1?`float`:o)):(u===HI&&i===e.ATAN&&c!==null&&(i=`atan2`),t.shaderStage!==`fragment`&&(i===e.DFDX||i===e.DFDY)&&(console.warn(`THREE.TSL: '${i}' is not supported in the ${t.shaderStage} stage.`),i=`/*`+i+`*/`),r.push(s.build(t,o)),c!==null&&r.push(c.build(t,o)),l!==null&&r.push(l.build(t,o))),t.format(`${t.getMethod(i,a)}( ${r.join(`, `)} )`,a,n)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Z.ALL=`all`,Z.ANY=`any`,Z.RADIANS=`radians`,Z.DEGREES=`degrees`,Z.EXP=`exp`,Z.EXP2=`exp2`,Z.LOG=`log`,Z.LOG2=`log2`,Z.SQRT=`sqrt`,Z.INVERSE_SQRT=`inversesqrt`,Z.FLOOR=`floor`,Z.CEIL=`ceil`,Z.NORMALIZE=`normalize`,Z.FRACT=`fract`,Z.SIN=`sin`,Z.COS=`cos`,Z.TAN=`tan`,Z.ASIN=`asin`,Z.ACOS=`acos`,Z.ATAN=`atan`,Z.ABS=`abs`,Z.SIGN=`sign`,Z.LENGTH=`length`,Z.NEGATE=`negate`,Z.ONE_MINUS=`oneMinus`,Z.DFDX=`dFdx`,Z.DFDY=`dFdy`,Z.ROUND=`round`,Z.RECIPROCAL=`reciprocal`,Z.TRUNC=`trunc`,Z.FWIDTH=`fwidth`,Z.TRANSPOSE=`transpose`,Z.BITCAST=`bitcast`,Z.EQUALS=`equals`,Z.MIN=`min`,Z.MAX=`max`,Z.STEP=`step`,Z.REFLECT=`reflect`,Z.DISTANCE=`distance`,Z.DIFFERENCE=`difference`,Z.DOT=`dot`,Z.CROSS=`cross`,Z.POW=`pow`,Z.TRANSFORM_DIRECTION=`transformDirection`,Z.MIX=`mix`,Z.CLAMP=`clamp`,Z.REFRACT=`refract`,Z.SMOOTHSTEP=`smoothstep`,Z.FACEFORWARD=`faceforward`;const V2=K(1e-6),H2=K(1e6),U2=K(Math.PI),W2=K(Math.PI*2),G2=U(Z,Z.ALL).setParameterLength(1),K2=U(Z,Z.ANY).setParameterLength(1),q2=U(Z,Z.RADIANS).setParameterLength(1),J2=U(Z,Z.DEGREES).setParameterLength(1),Y2=U(Z,Z.EXP).setParameterLength(1),X2=U(Z,Z.EXP2).setParameterLength(1),Z2=U(Z,Z.LOG).setParameterLength(1),Q2=U(Z,Z.LOG2).setParameterLength(1),$2=U(Z,Z.SQRT).setParameterLength(1),e4=U(Z,Z.INVERSE_SQRT).setParameterLength(1),t4=U(Z,Z.FLOOR).setParameterLength(1),n4=U(Z,Z.CEIL).setParameterLength(1),r4=U(Z,Z.NORMALIZE).setParameterLength(1),i4=U(Z,Z.FRACT).setParameterLength(1),a4=U(Z,Z.SIN).setParameterLength(1),o4=U(Z,Z.COS).setParameterLength(1),s4=U(Z,Z.TAN).setParameterLength(1),c4=U(Z,Z.ASIN).setParameterLength(1),l4=U(Z,Z.ACOS).setParameterLength(1),u4=U(Z,Z.ATAN).setParameterLength(1,2),d4=U(Z,Z.ABS).setParameterLength(1),f4=U(Z,Z.SIGN).setParameterLength(1),p4=U(Z,Z.LENGTH).setParameterLength(1),m4=U(Z,Z.NEGATE).setParameterLength(1),h4=U(Z,Z.ONE_MINUS).setParameterLength(1),g4=U(Z,Z.DFDX).setParameterLength(1),_4=U(Z,Z.DFDY).setParameterLength(1),v4=U(Z,Z.ROUND).setParameterLength(1),y4=U(Z,Z.RECIPROCAL).setParameterLength(1),b4=U(Z,Z.TRUNC).setParameterLength(1),x4=U(Z,Z.FWIDTH).setParameterLength(1),S4=U(Z,Z.TRANSPOSE).setParameterLength(1),C4=U(Z,Z.BITCAST).setParameterLength(2),w4=(e,t)=>(console.warn(`THREE.TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"`),y2(e,t)),T4=U(Z,Z.MIN).setParameterLength(2,1/0),E4=U(Z,Z.MAX).setParameterLength(2,1/0),D4=U(Z,Z.STEP).setParameterLength(2),O4=U(Z,Z.REFLECT).setParameterLength(2),k4=U(Z,Z.DISTANCE).setParameterLength(2),A4=U(Z,Z.DIFFERENCE).setParameterLength(2),j4=U(Z,Z.DOT).setParameterLength(2),M4=U(Z,Z.CROSS).setParameterLength(2),N4=U(Z,Z.POW).setParameterLength(2),P4=U(Z,Z.POW,2).setParameterLength(1),F4=U(Z,Z.POW,3).setParameterLength(1),I4=U(Z,Z.POW,4).setParameterLength(1),L4=U(Z,Z.TRANSFORM_DIRECTION).setParameterLength(2),R4=e=>g2(f4(e),N4(d4(e),1/3)),z4=e=>j4(e,e),B4=U(Z,Z.MIX).setParameterLength(3),V4=(e,t=0,n=1)=>H(new Z(Z.CLAMP,H(e),H(t),H(n))),H4=e=>V4(e),U4=U(Z,Z.REFRACT).setParameterLength(3),W4=U(Z,Z.SMOOTHSTEP).setParameterLength(3),G4=U(Z,Z.FACEFORWARD).setParameterLength(3),K4=G(([e])=>{let t=12.9898,n=78.233,r=43758.5453,i=j4(e.xy,Y(t,n)),a=v2(i,U2);return i4(a4(a).mul(r))}),q4=(e,t,n)=>B4(t,n,e),J4=(e,t,n)=>W4(t,n,e),Y4=(e,t)=>(console.warn(`THREE.TSL: "atan2" is overloaded. Use "atan" instead.`),u4(e,t)),Boe=G4,Voe=e4;V(`all`,G2),V(`any`,K2),V(`equals`,w4),V(`radians`,q2),V(`degrees`,J2),V(`exp`,Y2),V(`exp2`,X2),V(`log`,Z2),V(`log2`,Q2),V(`sqrt`,$2),V(`inverseSqrt`,e4),V(`floor`,t4),V(`ceil`,n4),V(`normalize`,r4),V(`fract`,i4),V(`sin`,a4),V(`cos`,o4),V(`tan`,s4),V(`asin`,c4),V(`acos`,l4),V(`atan`,u4),V(`abs`,d4),V(`sign`,f4),V(`length`,p4),V(`lengthSq`,z4),V(`negate`,m4),V(`oneMinus`,h4),V(`dFdx`,g4),V(`dFdy`,_4),V(`round`,v4),V(`reciprocal`,y4),V(`trunc`,b4),V(`fwidth`,x4),V(`atan2`,Y4),V(`min`,T4),V(`max`,E4),V(`step`,D4),V(`reflect`,O4),V(`distance`,k4),V(`dot`,j4),V(`cross`,M4),V(`pow`,N4),V(`pow2`,P4),V(`pow3`,F4),V(`pow4`,I4),V(`transformDirection`,L4),V(`mix`,q4),V(`clamp`,V4),V(`refract`,U4),V(`smoothstep`,J4),V(`faceForward`,G4),V(`difference`,A4),V(`saturate`,H4),V(`cbrt`,R4),V(`transpose`,S4),V(`rand`,K4);var Hoe=class extends n1{static get type(){return`ConditionalNode`}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return this.setup(e),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let t=n.getNodeType(e);if(e.getTypeLength(t)>e.getTypeLength(r))return t}return r}setup(e){let t=this.condNode.cache(),n=this.ifNode.cache(),r=this.elseNode?this.elseNode.cache():null,i=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=i,r!==null&&(e.getDataFromNode(r).parentNodeBlock=i);let a=e.getNodeProperties(this);a.condNode=t,a.ifNode=n.context({nodeBlock:n}),a.elseNode=r?r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:i,ifNode:a,elseNode:o}=e.getNodeProperties(this),s=e.currentFunctionNode,c=t!==`void`,l=c?S0(n).build(e):``;r.nodeProperty=l;let u=i.build(e,`bool`);e.addFlowCode(`\n${e.tab}if ( ${u} ) {\n\n`).addFlowTab();let d=a.build(e,n);if(d&&(c?d=l+` = `+d+`;`:(d=`return `+d+`;`,s===null&&(console.warn(`THREE.TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.`),d=`// `+d))),e.removeFlowTab().addFlowCode(e.tab+` `+d+`
|
|
410
|
+
`,t===null?console.log(a):t(e,a),n}};const vQ=(e,t=null)=>XJ(new _Q(XJ(e),t));R(`debug`,vQ);const yQ=eY(([e])=>CQ(e.rgb)),bQ=eY(([e,t=rY(1)])=>t.mix(CQ(e.rgb),e.rgb)),xQ=eY(([e,t=rY(1)])=>{let n=EY(e.r,e.g,e.b).div(3),r=e.r.max(e.g.max(e.b)),i=r.sub(n).mul(t).mul(-3);return JX(e.rgb,r,i)}),SQ=eY(([e,t=rY(1)])=>{let n=dY(.57735,.57735,.57735),r=t.cos();return dY(e.rgb.mul(r).add(n.cross(e.rgb).mul(t.sin()).add(n.mul(zX(n,e.rgb).mul(r.oneMinus())))))}),CQ=(e,t=dY(_q.getLuminanceCoefficients(new Oq)))=>zX(e,t),wQ={name:`Grayscale`,props:{},fragmentNode:({childNode:e})=>{let{vec4:t}=xj;if(!e)return console.error(`You must pass a child component into the Grayscale shader.`),t(0);let n=e||t(0,0,0,0);return t(yQ(n.rgb).rgb,n.a)}};var TQ=r({__name:`Grayscale`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{}},{blendMode:`normal`,...Object.entries(wQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${wQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(wQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(wQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(wQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,wQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),EQ=TQ;const DQ={name:`Grid`,props:{color:{default:`#ffffff`,transform:iK,description:`The color of the grid lines`,ui:{type:`color`,label:`Color`}},cells:{default:10,description:`Number of cells along the shortest canvas edge (creates square cells)`,ui:{type:`range`,min:1,max:50,step:1,label:`Cells`}},thickness:{default:1,description:`Thickness of grid lines (normalized, 0.0-1.0)`,ui:{type:`range`,min:0,max:5,step:.1,label:`Thickness`}}},fragmentNode:({uniforms:e})=>{let{vec2:t,vec4:n,fract:r,max:i,screenUV:a,viewportSize:o,fwidth:s,smoothstep:c}=xj,l=o.x.div(o.y),u=t(a.x.mul(l),a.y.oneMinus()),d=e.cells.uniform,f=u.mul(d),p=r(f),m=e.thickness.uniform.mul(.01),h=p.x.min(p.x.oneMinus()),g=p.y.min(p.y.oneMinus()),_=s(f),v=c(m.add(_.x),m,h),y=c(m.add(_.y),m,g),b=i(v,y);return n(e.color.uniform.rgb,e.color.uniform.a.mul(b))}};var OQ=r({__name:`Grid`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},color:{},cells:{},thickness:{}},{blendMode:`normal`,...Object.entries(DQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${DQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(DQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(DQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(DQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,DQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),kQ=OQ;const AQ={name:`GridDistortion`,props:{smoothness:{default:0,description:`How smooth and flowing the motion is`,ui:{type:`range`,min:0,max:1,step:.01,label:`Smoothness`}},intensity:{default:1,description:`Strength of the distortion effect`,ui:{type:`range`,min:0,max:5,step:.1,label:`Intensity`}},swirl:{default:0,description:`Amount of swirl motion`,ui:{type:`range`,min:0,max:2,step:.1,label:`Swirl`}},duration:{default:3,description:`How long the effect persists (higher = longer)`,ui:{type:`range`,min:0,max:10,step:.1,label:`Duration`}},radius:{default:1,description:`Radius of the distortion effect`,ui:{type:`range`,min:0,max:3,step:.01,label:`Radius`}},gridSize:{default:20,description:`Resolution of the distortion grid (higher = more detailed)`,ui:{type:`range`,min:8,max:128,step:1,label:`Grid Size`}}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:n,onCleanup:r,canvas:i})=>{let{vec2:a,vec4:o,float:s,uniform:c,screenUV:l,convertToTexture:u,texture:d}=xj;if(!n)return o(0,0,0,0);let f=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(n,f,p),h=Math.max(8,Math.min(128,Math.floor(e.gridSize.uniform.value))),g=new Float32Array(h*h*2),_=new $z(g,h,h,hI,lI);_.magFilter=rI,_.minFilter=rI,_.needsUpdate=!0;let v=d(_),y=c(.5),b=c(.5),x=c(0),S=c(0),ee=.5,te=.5,ne=Date.now();t(({pointer:t})=>{let n=Date.now(),r=Math.min((n-ne)/1e3,.016);ne=n;let i=r>0?(t.x-ee)/r:0,a=r>0?(t.y-te)/r:0;x.value=x.value*.85+i*.15,S.value=S.value*.85+a*.15,y.value=t.x,b.value=t.y;let o=e.duration.uniform.value,s=e.intensity.uniform.value,c=e.radius.uniform.value*.05,l=e.swirl.uniform.value;for(let e=0;e<h;e++)for(let n=0;n<h;n++){let u=(e*h+n)*2;g[u]*=1-o*r,g[u+1]*=1-o*r;let d=(n+.5)/h,f=(e+.5)/h,p=d-t.x,m=f-t.y,_=Math.sqrt(p*p+m*m);if(_<c*2&&Math.abs(i)+Math.abs(a)>.01){let e=Math.exp(-_*_/(c*c));if(g[u]+=x.value*e*s*r*.5,g[u+1]+=S.value*e*s*r*.5,l>0){let t=Math.atan2(m,p)+Math.PI*.5;g[u]+=Math.cos(t)*l*e*r*2,g[u+1]+=Math.sin(t)*l*e*r*2}}g[u]=Math.max(-1,Math.min(1,g[u])),g[u+1]=Math.max(-1,Math.min(1,g[u+1]))}_.needsUpdate=!0,ee=t.x,te=t.y}),r(()=>{_.dispose()});let re=e.gridSize.uniform,ie=s(1).div(re),ae=l.div(ie).floor().mul(ie).add(ie.mul(.5)),oe=v.sample(ae).xy,se=s(.1),ce=s(-.1),le=oe.clamp(a(ce,ce),a(se,se)),ue=l.sub(le);return m.sample(ue)}};var jQ=r({__name:`GridDistortion`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},smoothness:{},intensity:{},swirl:{},duration:{},radius:{},gridSize:{}},{blendMode:`normal`,...Object.entries(AQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${AQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(AQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(AQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(AQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,AQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),MQ=jQ;const NQ={name:`HueShift`,props:{shift:{default:0,description:`The amount to shift the hue by`,ui:{type:`range`,min:-180,max:180,step:1,label:`Shift`}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:n}=xj;if(!t)return console.error(`You must pass a child component into the Hue Shift shader.`),n(0);let r=t||n(0,0,0,0);return n(SQ(r.rgb,e.shift.uniform).rgb,r.a)}};var PQ=r({__name:`HueShift`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},shift:{}},{blendMode:`normal`,...Object.entries(NQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${NQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(NQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(NQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(NQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,NQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),FQ=PQ;const IQ={name:`ImageTexture`,props:{src:{default:`https://picsum.photos/1920/1080`,description:`Image URL to display`,ui:{type:`text`,label:`Source URL`}},fit:{default:`cover`,description:`How the image should fit within the canvas`}},fragmentNode:({uniforms:e,onCleanup:t})=>{let{texture:n,screenUV:r}=xj,i=new DB,a=i.load(e.src.uniform.value);a.colorSpace=TI,a.flipY=!0;let o=n(a);t(()=>{a.dispose()});let s=r.xy.setY(r.y.oneMinus());return o.sample(s)}};var LQ=r({__name:`ImageTexture`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},src:{},fit:{}},{blendMode:`normal`,...Object.entries(IQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${IQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(IQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(IQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(IQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,IQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),RQ=LQ;const zQ={name:`Invert`,props:{},fragmentNode:({childNode:e})=>{let{vec4:t,vec3:n}=xj;if(!e)return console.error(`You must pass a child component into the Invert shader.`),t(0);let r=e||t(0,0,0,0);return t(n(1,1,1).sub(r.rgb),r.a)}};var BQ=r({__name:`Invert`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{}},{blendMode:`normal`,...Object.entries(zQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${zQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(zQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(zQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(zQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,zQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),VQ=BQ;const HQ={name:`LinearGradient`,props:{startColor:{default:`#1aff00`,transform:iK,description:`The starting color of the gradient`,ui:{type:`color`,label:`Start Color`}},endColor:{default:`#0000ff`,transform:iK,description:`The ending color of the gradient`,ui:{type:`color`,label:`End Color`}},angle:{default:0,transform:oK,description:`The rotation angle of the gradient (in degrees)`,ui:{type:`range`,min:0,max:360,step:1,label:`Angle`}},center:{default:{x:.5,y:.5},transform:aK}},fragmentNode:({uniforms:e})=>{let{vec2:t,mix:n,float:r,cos:i,sin:a,dot:o,radians:s,screenUV:c,abs:l,div:u}=xj,d=s(e.angle.uniform),f=i(d),p=a(d),m=t(f,p),h=t(e.center.uniform[0],e.center.uniform[1].oneMinus()),g=c.sub(h),_=o(g,m),v=r(.5).mul(l(f).add(l(p))),y=u(_,v.max(1e-6)),b=y.mul(.5).add(.5).clamp(r(0),r(1));return n(e.startColor.uniform,e.endColor.uniform,b)}};var UQ=r({__name:`LinearGradient`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},startColor:{},endColor:{},angle:{},center:{}},{blendMode:`normal`,...Object.entries(HQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${HQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(HQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(HQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(HQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,HQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),WQ=UQ;const GQ={name:`Liquify`,props:{smoothness:{default:0,description:`How smooth and flowing the motion is (0-1)`,ui:{type:`range`,min:0,max:1,step:.01,label:`Smoothness`}},intensity:{default:1,description:`Strength of the distortion effect`,ui:{type:`range`,min:0,max:5,step:.1,label:`Intensity`}},swirl:{default:0,description:`Amount of swirl motion (0-1)`,ui:{type:`range`,min:0,max:1,step:.01,label:`Swirl`}},duration:{default:3,description:`How long the effect persists (higher = longer)`,ui:{type:`range`,min:0,max:10,step:.1,label:`Duration`}},radius:{default:1,description:`Radius of the distortion effect`,ui:{type:`range`,min:0,max:3,step:.01,label:`Radius`}}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:n,onCleanup:r,canvas:i})=>{let{vec2:a,vec4:o,float:s,uniform:c,screenUV:l,convertToTexture:u,texture:d}=xj;if(!n)return o(0,0,0,0);let f=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(n,f,p),h=32,g=new Float32Array(h*h*2),_=new $z(g,h,h,hI,lI);_.magFilter=rI,_.minFilter=rI,_.needsUpdate=!0;let v=d(_),y=c(.5),b=c(.5),x=c(0),S=c(0),ee=.5,te=.5,ne=Date.now();t(({pointer:t})=>{let n=Date.now(),r=Math.min((n-ne)/1e3,.016);ne=n;let i=r>0?(t.x-ee)/r:0,a=r>0?(t.y-te)/r:0;x.value=x.value*.85+i*.15,S.value=S.value*.85+a*.15,y.value=t.x,b.value=t.y;let o=e.duration.uniform.value,s=e.intensity.uniform.value,c=e.radius.uniform.value*.05,l=e.swirl.uniform.value;for(let e=0;e<h;e++)for(let n=0;n<h;n++){let u=(e*h+n)*2;g[u]*=1-o*r,g[u+1]*=1-o*r;let d=(n+.5)/h,f=(e+.5)/h,p=d-t.x,m=f-t.y,_=Math.sqrt(p*p+m*m);if(_<c*2&&Math.abs(i)+Math.abs(a)>.01){let e=Math.exp(-_*_/(c*c));if(g[u]+=x.value*e*s*r*.5,g[u+1]+=S.value*e*s*r*.5,l>0){let t=Math.atan2(m,p)+Math.PI*.5;g[u]+=Math.cos(t)*l*e*r*2,g[u+1]+=Math.sin(t)*l*e*r*2}}g[u]=Math.max(-1,Math.min(1,g[u])),g[u+1]=Math.max(-1,Math.min(1,g[u+1]))}_.needsUpdate=!0,ee=t.x,te=t.y}),r(()=>{_.dispose()});let re=v.sample(l).xy,ie=s(.2),ae=s(-.2),oe=re.clamp(a(ae,ae),a(ie,ie)),se=l.sub(oe);return m.sample(se)}};var KQ=r({__name:`Liquify`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},smoothness:{},intensity:{},swirl:{},duration:{},radius:{}},{blendMode:`normal`,...Object.entries(GQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${GQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(GQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(GQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(GQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,GQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),qQ=KQ;const JQ={name:`Pixelate`,props:{scale:{default:50,description:`Pixel size - higher values create larger, more visible pixels`,ui:{type:`range`,min:1,max:200,step:1,label:`Scale`}}},fragmentNode:({uniforms:e,childNode:t,canvas:n})=>{let{vec4:r,floor:i,screenUV:a,convertToTexture:o}=xj;if(!t)return r(0,0,0,0);let s=Math.round(n.clientWidth),c=Math.round(n.clientHeight),l=o(t,s,c),u=e.scale.uniform,d=i(a.mul(u)).div(u);return l.sample(d)}};var YQ=r({__name:`Pixelate`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},scale:{}},{blendMode:`normal`,...Object.entries(JQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${JQ.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(JQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(JQ.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(JQ,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,JQ.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),XQ=YQ,ZQ=class extends tJ{static get type(){return`PosterizeNode`}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){let{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}};const QQ=z(ZQ).setParameterLength(2),$Q={name:`Posterize`,props:{intensity:{default:5,description:`The intensity of the posterization effect (lower is more posterized)`,ui:{type:`range`,min:2,max:20,step:1,label:`Intensity`}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:n,int:r}=xj;if(!t)return console.error(`You must pass a child component into the Posterize shader.`),n(0);let i=t||n(0,0,0,0);return QQ(i,r(e.intensity.uniform))}};var e$=r({__name:`Posterize`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},intensity:{}},{blendMode:`normal`,...Object.entries($Q.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${$Q.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries($Q.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries($Q.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF($Q,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,$Q.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),t$=e$;const n$={name:`RadialGradient`,props:{startColor:{default:`#ff0000`,transform:iK,description:`The starting color at the center of the gradient`,ui:{type:`color`,label:`Start Color`}},endColor:{default:`#0000ff`,transform:iK,description:`The ending color at the edge of the gradient`,ui:{type:`color`,label:`End Color`}},center:{default:{x:.5,y:.5},transform:aK,description:`The center point of the radial gradient`},radius:{default:1,description:`The radius of the gradient (normalized, 0.0-1.0)`,ui:{type:`range`,min:0,max:2,step:.01,label:`Radius`}}},fragmentNode:({uniforms:e})=>{let{vec2:t,mix:n,float:r,distance:i,screenUV:a,viewportSize:o}=xj,s=o.x.div(o.y),c=t(a.x.mul(s),a.y),l=t(e.center.uniform.x.mul(s),e.center.uniform.y.oneMinus()),u=i(c,l),d=u.div(e.radius.uniform).clamp(r(0),r(1));return n(e.startColor.uniform,e.endColor.uniform,d)}};var r$=r({__name:`RadialGradient`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},startColor:{},endColor:{},center:{},radius:{}},{blendMode:`normal`,...Object.entries(n$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${n$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(n$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(n$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(n$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,n$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),i$=r$;const a$={name:`Ripple`,props:{intensity:{default:1,description:`Overall ripple intensity`,ui:{type:`range`,min:0,max:5,step:.1,label:`Intensity`}},rippleSpeed:{default:150,description:`Speed of ripple expansion`,ui:{type:`range`,min:50,max:500,step:10,label:`Ripple Speed`}},damping:{default:.95,description:`Water damping (higher = less decay)`,ui:{type:`range`,min:.8,max:.99,step:.01,label:`Damping`}},mouseIntensity:{default:1,description:`Mouse movement ripple strength`,ui:{type:`range`,min:0,max:3,step:.1,label:`Mouse Intensity`}}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:n,onCleanup:r,canvas:i})=>{let{vec2:a,vec4:o,screenUV:s,convertToTexture:c,texture:l}=xj;if(!n)return o(0,0,0,0);let u=Math.round(i.clientWidth),d=Math.round(i.clientHeight),f=c(n,u,d),p=128,m={current:new Float32Array(p*p),previous:new Float32Array(p*p)};for(let e=0;e<p*p;e++)m.current[e]=0,m.previous[e]=0;let h=new $z(m.current,p,p,mI,lI);h.minFilter=rI,h.magFilter=rI,h.needsUpdate=!0;let g=l(h),_=.5,v=.5,y=0,b=(e,t,n)=>{let r=e/i.clientWidth,a=t/i.clientHeight,o=Math.floor(r*p),s=Math.floor(a*p),c=8,l=n*.5;for(let e=-c;e<=c;e++)for(let t=-c;t<=c;t++){let n=e*e+t*t;if(n<=c*c){let r=o+e,i=s+t;if(r>=0&&r<p&&i>=0&&i<p){let e=i*p+r,t=Math.sqrt(n),a=1-t/c,o=Math.cos(t/c*Math.PI*.5)*l*a;m.previous[e]+=o}}}},x=()=>{let t=e.damping.uniform.value;for(let e=1;e<p-1;e++)for(let n=1;n<p-1;n++){let r=e*p+n,i=m.previous[r-p],a=m.previous[r+p],o=m.previous[r-1],s=m.previous[r+1];m.current[r]=(i+a+o+s)/2-m.current[r],m.current[r]*=t,m.current[r]=Math.max(-2,Math.min(2,m.current[r]))}for(let e=0;e<p;e++)m.current[e]=0,m.current[(p-1)*p+e]=0,m.current[e*p]=0,m.current[e*p+(p-1)]=0;let n=m.current;m.current=m.previous,m.previous=n,h.image.data=m.current,h.needsUpdate=!0};t(({pointer:t})=>{let n=performance.now();if(n-y>=16){y=n;let r=t.x*i.clientWidth,a=t.y*i.clientHeight,o=r-_*i.clientWidth,s=a-v*i.clientHeight,c=Math.sqrt(o*o+s*s);if(c>2){let t=c/16,n=Math.min(t/10,2),i=Math.min(c/20,1),o=i*n*e.mouseIntensity.uniform.value;b(r,a,o)}_=t.x,v=t.y}x()}),r(()=>{h.dispose()});let S=s,ee=e.intensity.uniform,te=1/p,ne=g.sample(S.add(a(te,0))).r.sub(g.sample(S.sub(a(te,0))).r),re=g.sample(S.add(a(0,te))).r.sub(g.sample(S.sub(a(0,te))).r),ie=a(ne,re).mul(ee).mul(.05),ae=s.add(ie);return f.sample(ae)}};var o$=r({__name:`Ripple`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},intensity:{},rippleSpeed:{},damping:{},mouseIntensity:{}},{blendMode:`normal`,...Object.entries(a$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${a$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(a$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(a$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(a$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,a$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),s$=o$;const c$={name:`Saturation`,props:{intensity:{default:1,description:`The intensity of the saturation effect (1 being no change)`,ui:{type:`range`,min:0,max:3,step:.01,label:`Intensity`}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:n}=xj;if(!t)return console.error(`You must pass a child component into the Saturation shader.`),n(0);let r=t||n(0,0,0,0);return n(bQ(r.rgb,e.intensity.uniform).rgb,r.a)}};var l$=r({__name:`Saturation`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},intensity:{}},{blendMode:`normal`,...Object.entries(c$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${c$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(c$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(c$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(c$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,c$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),u$=l$;const d$={name:`SolidColor`,props:{color:{default:`#5b18ca`,transform:iK,description:`The solid color to display`,ui:{type:`color`,label:`Color`}}},fragmentNode:({uniforms:e})=>e.color.uniform};var f$=r({__name:`SolidColor`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},color:{}},{blendMode:`normal`,...Object.entries(d$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${d$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(d$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(d$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(d$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,d$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),p$=f$;const m$={name:`Spiral`,props:{colorBack:{default:`#000000`,transform:iK,description:`Background color`,ui:{type:`color`,label:`Background Color`}},colorFront:{default:`#ffffff`,transform:iK,description:`Spiral stroke color`,ui:{type:`color`,label:`Spiral Color`}},strokeWidth:{default:.5,description:`Thickness of spiral stroke`,ui:{type:`range`,min:0,max:2,step:.01,label:`Stroke Width`}},strokeFalloff:{default:0,description:`Stroke losing width further from center`,ui:{type:`range`,min:0,max:1,step:.01,label:`Stroke Falloff`}},softness:{default:0,description:`Color transition sharpness (0 = hard edge, 1 = smooth fade)`,ui:{type:`range`,min:0,max:1,step:.01,label:`Softness`}},speed:{default:1,description:`Animation speed (negative values reverse direction)`,ui:{type:`range`,min:-3,max:3,step:.1,label:`Speed`}},center:{default:{x:.5,y:.5},transform:aK,description:`The center point of the spiral`},scale:{default:1,description:`Scale factor for spiral bands (higher = more bands, lower = fewer bands)`,ui:{type:`range`,min:.1,max:5,step:.1,label:`Scale`}}},fragmentNode:({uniforms:e})=>{let{vec2:t,vec4:n,float:r,atan:i,length:a,clamp:o,fract:s,abs:c,mix:l,smoothstep:u,screenUV:d,time:f,fwidth:p,viewportSize:m}=xj,h=m.x.div(m.y),g=t(d.x.mul(h),d.y),_=t(e.center.uniform.x.mul(h),e.center.uniform.y.oneMinus()),v=g.sub(_),y=f.mul(e.speed.uniform),b=a(v),x=b,S=i(v.y,v.x).sub(y),ee=r(6.283185307),te=S.div(ee),ne=x.mul(e.scale.uniform).add(te),re=s(ne),ie=c(re.sub(.5)).mul(2),ae=o(e.strokeWidth.uniform,e.strokeFalloff.uniform.mul(.005),1),oe=o(e.strokeFalloff.uniform,0,1).mul(b).oneMinus(),se=ae.mul(oe),ce=p(ne),le=r(4).sub(u(.05,.4,e.strokeWidth.uniform.mul(2)).mul(u(.05,.4,e.strokeWidth.uniform.oneMinus().mul(2))).mul(3)),ue=l(le.mul(ce),p(ie),o(ce,0,1)),de=u(se.sub(ue).sub(e.softness.uniform),se.add(ue).add(e.softness.uniform),ie),fe=e.colorFront.uniform.rgb.mul(e.colorFront.uniform.a),pe=e.colorFront.uniform.a,me=e.colorBack.uniform.rgb.mul(e.colorBack.uniform.a),he=e.colorBack.uniform.a,ge=fe.mul(de),_e=pe.mul(de),ve=ge.add(me.mul(_e.oneMinus())),ye=_e.add(he.mul(_e.oneMinus()));return n(ve,ye)}};var h$=r({__name:`Spiral`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},colorBack:{},colorFront:{},strokeWidth:{},strokeFalloff:{},softness:{},speed:{},center:{},scale:{}},{blendMode:`normal`,...Object.entries(m$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${m$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(m$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(m$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(m$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,m$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),g$=h$;const _$={name:`Swirl`,props:{colorA:{default:`#1275d8`,description:`Primary gradient color`,transform:iK,ui:{type:`color`,label:`Primary Color`}},colorB:{default:`#e19136`,description:`Secondary gradient color`,transform:iK,ui:{type:`color`,label:`Secondary Color`}},colorC:{default:`#320485`,description:`Accent gradient color`,transform:iK,ui:{type:`color`,label:`Accent Color`}},speed:{default:1,description:`Flow animation speed`,ui:{type:`range`,min:0,max:5,step:.1,label:`Speed`}},scale:{default:5,description:`Gradient scale`,ui:{type:`range`,min:.1,max:20,step:.1,label:`Scale`}},complexity:{default:5,description:`Flow complexity`,ui:{type:`range`,min:1,max:10,step:.1,label:`Complexity`}}},fragmentNode:({uniforms:e})=>{let t=AP(),n=XN.mul(e.speed.uniform),r=e.scale.uniform,i=e.complexity.uniform,a=pN(t.x.mul(r.mul(1.2)).add(n.mul(.8))).mul(.3),o=fM(t.y.mul(r.mul(.9)).sub(n.mul(.6))).mul(.3),s=LP(t.x.add(pN(t.y.mul(i.mul(2)).add(n)).mul(.08)),t.y.add(fM(t.x.mul(i.mul(1.5)).sub(n.mul(.7))).mul(.08))),c=pN(s.x.mul(r.mul(3)).add(s.y.mul(r.mul(2))).add(n.mul(.5))),l=fM(s.x.sub(s.y).mul(r.mul(2.5)).add(n.mul(.3))),u=pN(s.x.mul(i).add(a).add(s.y.mul(i.mul(.8)).add(o)).add(n.mul(.4))),d=vM(c,l,u.mul(.5).add(.5)),f=s.x.mul(.7).add(s.y.mul(.3)).add(d.mul(.2)),p=vM(e.colorA.uniform,e.colorB.uniform,gN(.1,.6,f)),m=vM(p,e.colorC.uniform,gN(.4,.9,f.add(u.mul(.3)))),h=pN(n.mul(3).add(f.mul(10))).mul(.02).add(1),g=m.mul(h);return zP(g,1)}};var v$=r({__name:`Swirl`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},colorA:{},colorB:{},colorC:{},speed:{},scale:{},complexity:{}},{blendMode:`normal`,...Object.entries(_$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${_$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(_$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(_$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(_$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,_$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),y$=v$;const b$={name:`Twirl`,props:{center:{default:{x:.5,y:.5},transform:aK,description:`The center point of the twirl effect`},intensity:{default:1,description:`The strength of the twirl effect`,ui:{type:`range`,min:-5,max:5,step:.1,label:`Intensity`}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec2:n,vec4:r,cos:i,sin:a,length:o,screenUV:s,convertToTexture:c}=xj;if(!t)return console.error(`You must pass a child component into the Twirl shader.`),r(0);let l=c(t),u=s,d=n(e.center.uniform.x,e.center.uniform.y.oneMinus()),f=u.sub(d),p=e.intensity.uniform.mul(o(f)),m=i(p),h=a(p),g=m.mul(f.x).sub(h.mul(f.y)),_=h.mul(f.x).add(m.mul(f.y)),v=n(g.add(d.x),_.add(d.y));return r(l.sample(v))}};var x$=r({__name:`Twirl`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},center:{},intensity:{}},{blendMode:`normal`,...Object.entries(b$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${b$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(b$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(b$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(b$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,b$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),S$=x$;const C$={name:`Vibrance`,props:{intensity:{default:0,description:`The intensity of the vibrance effect`,ui:{type:`range`,min:-2,max:2,step:.01,label:`Intensity`}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:n}=xj;if(!t)return console.error(`You must pass a child component into the Vibrance shader.`),n(0);let r=t||n(0,0,0,0);return n(xQ(r.rgb,e.intensity.uniform).rgb,r.a)}};var w$=r({__name:`Vibrance`,props:o({blendMode:{},opacity:{},id:{},maskSource:{},maskType:{},intensity:{}},{blendMode:`normal`,...Object.entries(C$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})}),setup(t){let n=t,r=n.id||`${C$.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;d(`ombreParentId`,r);let o=e(()=>{let e={...Object.entries(C$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})};for(let t in n)t!==`blendMode`&&t!==`opacity`&&n[t]!==Object.entries(C$.props).reduce((e,[t,n])=>(e[t]=n.default,e),{})[t]&&(e[t]=m(n[t]));return e}),s=kF(C$,o.value,r),l=a(`ombreParentId`);if(l===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let u=a(`ombreNodeRegister`);if(u===void 0)throw Error(`Shader components must be used inside an <Shader> component or another shader component`);let f=a(`ombreUniformUpdate`);if(f===void 0)throw Error(`Shader components require ombreUniformUpdate from parent`);let g=a(`ombreMetadataUpdate`);if(g===void 0)throw Error(`Shader components require ombreMetadataUpdate from parent`);let _=()=>{let e=i();e.run(()=>{Object.entries(s).forEach(([e,{uniform:t,transform:i}])=>{h(()=>n[e],n=>{if(t&&t.value!==void 0){let t=i?i(n):n;f(r,e,t)}},{deep:!0})}),h(()=>[n.blendMode,n.opacity,n.maskSource,n.maskType],([e,t])=>{g(r,{blendMode:e,opacity:t,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0})},{deep:!0}),u(r,C$.fragmentNode,l,{blendMode:n.blendMode,opacity:n.opacity,id:n.id,mask:n.maskSource?{source:n.maskSource,type:n.maskType||`alpha`}:void 0,renderOrder:0},s)}),c(()=>{e.stop()})};return _(),c(()=>{u(r,null,null,null,null)}),(e,t)=>p(e.$slots,`default`)}}),T$=w$;const E$=`alphaMap.alphaTest.anisotropy.anisotropyMap.anisotropyRotation.aoMap.aoMapIntensity.attenuationColor.attenuationDistance.bumpMap.clearcoat.clearcoatMap.clearcoatNormalMap.clearcoatNormalScale.clearcoatRoughness.color.dispersion.displacementMap.emissive.emissiveIntensity.emissiveMap.envMap.envMapIntensity.gradientMap.ior.iridescence.iridescenceIOR.iridescenceMap.iridescenceThicknessMap.lightMap.lightMapIntensity.map.matcap.metalness.metalnessMap.normalMap.normalScale.opacity.roughness.roughnessMap.sheen.sheenColor.sheenColorMap.sheenRoughnessMap.shininess.specular.specularColor.specularColorMap.specularIntensity.specularIntensityMap.specularMap.thickness.transmission.transmissionMap`.split(`.`);var D$=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=E$,this.renderId=0}firstInitialization(e){let t=this.renderObjects.has(e);return t===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has(`velocity`)}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,material:r,object:i}=e;if(t={material:this.getMaterialData(r),geometry:{id:n.id,attributes:this.getAttributesData(n.attributes),indexVersion:n.index?n.index.version:null,drawRange:{start:n.drawRange.start,count:n.drawRange.count}},worldMatrix:i.matrixWorld.clone()},i.center&&(t.center=i.center.clone()),i.morphTargetInfluences&&(t.morphTargetInfluences=i.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),t.material.transmission>0){let{width:n,height:r}=e.context;t.bufferWidth=n,t.bufferHeight=r}this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={version:r.version}}return t}containsNode(e){let t=e.material;for(let e in t)if(t[e]&&t[e].isNode)return!0;return e.renderer.overrideNodes.modelViewMatrix!==null||e.renderer.overrideNodes.modelNormalViewMatrix!==null}getMaterialData(e){let t={};for(let n of this.refreshUniforms){let r=e[n];if(r==null)continue;typeof r==`object`&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:r.version}:t[n]=r.clone():t[n]=r}return t}equals(e){let{object:t,material:n,geometry:r}=e,i=this.getRenderObjectData(e);if(i.worldMatrix.equals(t.matrixWorld)!==!0)return i.worldMatrix.copy(t.matrixWorld),!1;let a=i.material;for(let e in a){let t=a[e],r=n[e];if(t.equals!==void 0){if(t.equals(r)===!1)return t.copy(r),!1}else if(r.isTexture===!0){if(t.id!==r.id||t.version!==r.version)return t.id=r.id,t.version=r.version,!1}else if(t!==r)return a[e]=r,!1}if(a.transmission>0){let{width:t,height:n}=e.context;if(i.bufferWidth!==t||i.bufferHeight!==n)return i.bufferWidth=t,i.bufferHeight=n,!1}let o=i.geometry,s=r.attributes,c=o.attributes,l=Object.keys(c),u=Object.keys(s);if(o.id!==r.id)return o.id=r.id,!1;if(l.length!==u.length)return i.geometry.attributes=this.getAttributesData(s),!1;for(let e of l){let t=c[e],n=s[e];if(n===void 0)return delete c[e],!1;if(t.version!==n.version)return t.version=n.version,!1}let d=r.index,f=o.indexVersion,p=d?d.version:null;if(f!==p)return o.indexVersion=p,!1;if(o.drawRange.start!==r.drawRange.start||o.drawRange.count!==r.drawRange.count)return o.drawRange.start=r.drawRange.start,o.drawRange.count=r.drawRange.count,!1;if(i.morphTargetInfluences){let e=!1;for(let n=0;n<i.morphTargetInfluences.length;n++)i.morphTargetInfluences[n]!==t.morphTargetInfluences[n]&&(e=!0);if(e)return!0}return i.center&&i.center.equals(t.center)===!1?(i.center.copy(t.center),!0):(e.bundle!==null&&(i.version=e.bundle.version),!0)}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,i=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||i)return!1;let a=this.equals(e)!==!0;return a}};function O$(e,t=0){let n=3735928559^t,r=1103547991^t;if(e instanceof Array)for(let t=0,i;t<e.length;t++)i=e[t],n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);else for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),4294967296*(2097151&r)+(n>>>0)}const k$=e=>O$(e),A$=e=>O$(e),j$=(...e)=>O$(e);function M$(e,t=!1){let n=[];e.isNode===!0&&(n.push(e.id),e=e.getSelf());for(let{property:r,childNode:i}of N$(e))n.push(O$(r.slice(0,-4)),i.getCacheKey(t));return O$(n)}function*N$(e,t=!1){for(let n in e){if(n.startsWith(`_`)===!0)continue;let r=e[n];if(Array.isArray(r)===!0)for(let e=0;e<r.length;e++){let i=r[e];i&&(i.isNode===!0||t&&typeof i.toJSON==`function`)&&(yield{property:n,index:e,childNode:i})}else if(r&&r.isNode===!0)yield{property:n,childNode:r};else if(typeof r==`object`)for(let e in r){let i=r[e];i&&(i.isNode===!0||t&&typeof i.toJSON==`function`)&&(yield{property:n,index:e,childNode:i})}}}const P$=new Map([[1,`float`],[2,`vec2`],[3,`vec3`],[4,`vec4`],[9,`mat3`],[16,`mat4`]]),F$=new WeakMap;function I$(e){return P$.get(e)}function L$(e){if(/[iu]?vec\d/.test(e))return e.startsWith(`ivec`)?Int32Array:e.startsWith(`uvec`)?Uint32Array:Float32Array;if(/mat\d/.test(e)||/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function R$(e){if(/float|int|uint/.test(e))return 1;if(/vec2/.test(e))return 2;if(/vec3/.test(e))return 3;if(/vec4/.test(e)||/mat2/.test(e))return 4;if(/mat3/.test(e))return 9;if(/mat4/.test(e))return 16;console.error(`THREE.TSL: Unsupported type:`,e)}function z$(e){if(/float|int|uint/.test(e))return 1;if(/vec2/.test(e))return 2;if(/vec3/.test(e))return 3;if(/vec4/.test(e)||/mat2/.test(e))return 4;if(/mat3/.test(e))return 12;if(/mat4/.test(e))return 16;console.error(`THREE.TSL: Unsupported type:`,e)}function B$(e){if(/float|int|uint/.test(e))return 4;if(/vec2/.test(e))return 8;if(/vec3/.test(e)||/vec4/.test(e))return 16;if(/mat2/.test(e))return 8;if(/mat3/.test(e))return 48;if(/mat4/.test(e))return 64;console.error(`THREE.TSL: Unsupported type:`,e)}function V$(e){if(e==null)return null;let t=typeof e;return e.isNode===!0?`node`:t===`number`?`float`:t===`boolean`?`bool`:t===`string`?`string`:t===`function`?`shader`:e.isVector2===!0?`vec2`:e.isVector3===!0?`vec3`:e.isVector4===!0?`vec4`:e.isMatrix2===!0?`mat2`:e.isMatrix3===!0?`mat3`:e.isMatrix4===!0?`mat4`:e.isColor===!0?`color`:e instanceof ArrayBuffer?`ArrayBuffer`:null}function H$(e,...t){let n=e?e.slice(-4):void 0;return t.length===1&&(n===`vec2`?t=[t[0],t[0]]:n===`vec3`?t=[t[0],t[0],t[0]]:n===`vec4`&&(t=[t[0],t[0],t[0],t[0]])),e===`color`?new lz(...t):n===`vec2`?new _L(...t):n===`vec3`?new L(...t):n===`vec4`?new VL(...t):n===`mat2`?new HB(...t):n===`mat3`?new xL(...t):n===`mat4`?new _R(...t):e===`bool`?t[0]||!1:e===`float`||e===`int`||e===`uint`?t[0]||0:e===`string`?t[0]||``:e===`ArrayBuffer`?G$(t[0]):null}function U$(e){let t=F$.get(e);return t===void 0&&(t={},F$.set(e,t)),t}function W$(e){let t=``,n=new Uint8Array(e);for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return btoa(t)}function G$(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0)).buffer}const K$={VERTEX:`vertex`,FRAGMENT:`fragment`},q$={NONE:`none`,FRAME:`frame`,RENDER:`render`,OBJECT:`object`},J$={BOOLEAN:`bool`,INTEGER:`int`,FLOAT:`float`,VECTOR2:`vec2`,VECTOR3:`vec3`,VECTOR4:`vec4`,MATRIX2:`mat2`,MATRIX3:`mat3`,MATRIX4:`mat4`},Y$={READ_ONLY:`readOnly`,WRITE_ONLY:`writeOnly`,READ_WRITE:`readWrite`},X$=[`fragment`,`vertex`],Z$=[`setup`,`analyze`,`generate`],Q$=[...X$,`compute`],$$=[`x`,`y`,`z`,`w`],e1={analyze:`setup`,generate:`analyze`};let t1=0;var n1=class extends UI{static get type(){return`Node`}constructor(e=null){super(),this.nodeType=e,this.updateType=q$.NONE,this.updateBeforeType=q$.NONE,this.updateAfterType=q$.NONE,this.uuid=gL.generateUUID(),this.version=0,this.global=!1,this.parents=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,`id`,{value:t1++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,q$.FRAME)}onRenderUpdate(e){return this.onUpdate(e,q$.RENDER)}onObjectUpdate(e){return this.onUpdate(e,q$.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of N$(this))yield e}dispose(){this.dispatchEvent({type:`dispose`})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e||=this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=j$(M$(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}customCacheKey(){return 0}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e),n=e.getElementType(t);return n}getMemberType(){return`void`}getNodeType(e){let t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){let t=this.getHash(e),n=e.getNodeFromHash(t);return n||this}setup(e){let t=e.getNodeProperties(this),n=0;for(let e of this.getChildren())t[`node`+ n++]=e;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let n=e.getDataFromNode(this,`any`);n.stages=n.stages||{},n.stages[e.shaderStage]=n.stages[e.shaderStage]||[],n.stages[e.shaderStage].push(t)}if(n===1){let t=e.getNodeProperties(this);for(let n of Object.values(t))n&&n.isNode===!0&&n.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){console.warn(`Abstract function.`)}updateAfter(){console.warn(`Abstract function.`)}update(){console.warn(`Abstract function.`)}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let i=e1[e.buildStage];if(i&&r.buildStages[i]!==!0){let t=e.getBuildStage();e.setBuildStage(i),this.build(e),e.setBuildStage(t)}e.addNode(this),e.addChain(this);let a=null,o=e.getBuildStage();if(o===`setup`){this.updateReference(e);let t=e.getNodeProperties(this);if(t.initialized!==!0){t.initialized=!0,t.outputNode=this.setup(e)||t.outputNode||null;for(let n of Object.values(t))if(n&&n.isNode===!0){if(n.parents===!0){let t=e.getNodeProperties(n);t.parents=t.parents||[],t.parents.push(this)}n.build(e)}}a=t.outputNode}else if(o===`analyze`)this.analyze(e,t);else if(o===`generate`){let n=this.generate.length===1;if(n){let n=this.getNodeType(e),r=e.getDataFromNode(this);a=r.snippet,a===void 0?r.generated===void 0?(r.generated=!0,a=this.generate(e)||``,r.snippet=a):(console.warn(`THREE.Node: Recursion detected.`,this),a=``):r.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),a=e.format(a,n,t)}else a=this.generate(e,t)||``}return e.removeChain(this),e.addSequentialNode(this),a}getSerializeChildren(){return N$(this)}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:i,childNode:a}of t)i===void 0?n[r]=a.toJSON(e.meta).uuid:(n[r]===void 0&&(n[r]=Number.isInteger(i)?[]:{}),n[r][i]=a.toJSON(e.meta).uuid);Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let i of e.inputNodes[n])r.push(t[i]);this[n]=r}else if(typeof e.inputNodes[n]==`object`){let r={};for(let i in e.inputNodes[n]){let a=e.inputNodes[n][i];r[i]=t[a]}this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e==`string`;r&&(e={textures:{},images:{},nodes:{}});let i=e.nodes[t];i===void 0&&(i={uuid:t,type:n,meta:e,metadata:{version:4.7,type:`Node`,generator:`Node.toJSON`}},r!==!0&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta);function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(r){let t=a(e.textures),n=a(e.images),r=a(e.nodes);t.length>0&&(i.textures=t),n.length>0&&(i.images=n),r.length>0&&(i.nodes=r)}return i}},r1=class extends n1{static get type(){return`ArrayElementNode`}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){let t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:`uint`);return`${n}[ ${r} ]`}},i1=class extends n1{static get type(){return`ConvertNode`}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split(`|`))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),i=n.build(e,r);return e.format(i,r,t)}},a1=class extends n1{static get type(){return`TempNode`}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){let n=e.getBuildStage();if(n===`generate`){let n=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,n,t);if(n!==`void`&&t!==`void`&&this.hasDependencies(e)){let i=super.build(e,n),a=e.getVarFromNode(this,null,n),o=e.getPropertyName(a);return e.addLineFlowCode(`${o} = ${i}`,this),r.snippet=i,r.propertyName=o,e.format(r.propertyName,n,t)}}return super.build(e,t)}},o1=class extends a1{static get type(){return`JoinNode`}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType===null?e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0)):e.getVectorType(this.nodeType)}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),i=this.nodes,a=e.getComponentType(n),o=[],s=0;for(let t of i){if(s>=r){console.error(`THREE.TSL: Length of parameters exceeds maximum length of function '${n}()' type.`);break}let i=t.getNodeType(e),c=e.getTypeLength(i),l;s+c>r&&(console.error(`THREE.TSL: Length of '${n}()' data exceeds maximum length of output type.`),c=r-s,i=e.getTypeFromLength(c)),s+=c,l=t.build(e,i);let u=e.getComponentType(i);u!==a&&(l=e.format(l,u,a)),o.push(l)}let c=`${e.getType(n)}( ${o.join(`, `)} )`;return e.format(c,n,t)}};const s1=$$.join(``);var c1=class extends n1{static get type(){return`SplitNode`}constructor(e,t=`x`){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max($$.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),i=null;if(r>1){let a=null,o=this.getVectorLength();o>=r&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let s=n.build(e,a);i=this.components.length===r&&this.components===s1.slice(0,this.components.length)?e.format(s,a,t):e.format(`${s}.${this.components}`,this.getNodeType(e),t)}else i=n.build(e,t);return i}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},l1=class extends a1{static get type(){return`SetNode`}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,i=this.getNodeType(e),a=e.getComponentType(r.getNodeType(e)),o=e.getTypeFromLength(n.length,a),s=r.build(e,o),c=t.build(e,i),l=e.getTypeLength(i),u=[];for(let e=0;e<l;e++){let t=$$[e];t===n[0]?(u.push(s),e+=n.length-1):u.push(c+`.`+t)}return`${e.getType(i)}( ${u.join(`, `)} )`}},u1=class extends a1{static get type(){return`FlipNode`}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),i=n.build(e),a=e.getVarFromNode(this),o=e.getPropertyName(a);e.addLineFlowCode(o+` = `+i,this);let s=e.getTypeLength(r),c=[],l=0;for(let e=0;e<s;e++){let n=$$[e];n===t[l]?(c.push(`1.0 - `+(o+`.`+n)),l++):c.push(o+`.`+n)}return`${e.getType(r)}( ${c.join(`, `)} )`}},d1=class extends n1{static get type(){return`InputNode`}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?V$(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=V$(this.value),e.nodeType=this.nodeType,e.valueType===`ArrayBuffer`&&(e.value=W$(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?H$(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn(`Abstract function.`)}};const f1=/float|u?int/;var p1=class extends d1{static get type(){return`ConstNode`}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return f1.test(n)&&f1.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},m1=class extends n1{static get type(){return`MemberNode`}constructor(e,t){super(),this.node=e,this.property=t,this.isMemberNode=!0}getNodeType(e){return this.node.getMemberType(e,this.property)}generate(e){let t=this.node.build(e);return t+`.`+this.property}};let h1=null;const g1=new Map;function V(e,t){if(g1.has(e)){console.warn(`THREE.TSL: Redefinition of method chaining '${e}'.`);return}if(typeof t!=`function`)throw Error(`THREE.TSL: Node element ${e} is not a function`);g1.set(e,t)}const _1=e=>e.replace(/r|s/g,`x`).replace(/g|t/g,`y`).replace(/b|p/g,`z`).replace(/a|q/g,`w`),v1=e=>_1(e).split(``).sort().join(``),y1={setup(e,t){let n=t.shift();return e(G1(n),...t)},get(e,t,n){if(typeof t==`string`&&e[t]===void 0){if(e.isStackNode!==!0&&t===`assign`)return(...e)=>(h1.assign(n,...e),n);if(g1.has(t)){let r=g1.get(t);return e.isStackNode?(...e)=>n.add(r(...e)):(...e)=>r(n,...e)}else if(t===`self`)return e;else if(t.endsWith(`Assign`)&&g1.has(t.slice(0,t.length-6))){let r=g1.get(t.slice(0,t.length-6));return e.isStackNode?(...e)=>n.assign(e[0],r(...e)):(...e)=>n.assign(r(n,...e))}else if(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0)return t=_1(t),H(new c1(n,t));else if(/^set[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=v1(t.slice(3).toLowerCase()),n=>H(new l1(e,t,H(n)));else if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=v1(t.slice(4).toLowerCase()),()=>H(new u1(H(e),t));else if(t===`width`||t===`height`||t===`depth`)return t===`width`?t=`x`:t===`height`?t=`y`:t===`depth`&&(t=`z`),H(new c1(e,t));else if(/^\d+$/.test(t)===!0)return H(new r1(n,new p1(Number(t),`uint`)));else if(/^get$/.test(t)===!0)return e=>H(new m1(n,e))}return Reflect.get(e,t,n)},set(e,t,n,r){return typeof t==`string`&&e[t]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0||t===`width`||t===`height`||t===`depth`||/^\d+$/.test(t)===!0)?(r[t].assign(n),!0):Reflect.set(e,t,n,r)}},b1=new WeakMap,x1=new WeakMap,S1=function(e,t=null){let n=V$(e);if(n===`node`){let t=b1.get(e);return t===void 0&&(t=new Proxy(e,y1),b1.set(e,t),b1.set(t,t)),t}else if(t===null&&(n===`float`||n===`boolean`)||n&&n!==`shader`&&n!==`string`)return H(z1(e,t));else if(n===`shader`)return G(e);return e},C1=function(e,t=null){for(let n in e)e[n]=H(e[n],t);return e},w1=function(e,t=null){let n=e.length;for(let r=0;r<n;r++)e[r]=H(e[r],t);return e},T1=function(e,t=null,n=null,r=null){let i=e=>H(r===null?e:Object.assign(e,r)),a,o=t,s,c;function l(t){let n;return n=o?/[a-z]/i.test(o)?o+`()`:o:e.type,s!==void 0&&t.length<s?(console.error(`THREE.TSL: "${n}" parameter length is less than minimum required.`),t.concat(Array(s-t.length).fill(0))):c!==void 0&&t.length>c?(console.error(`THREE.TSL: "${n}" parameter length exceeds limit.`),t.slice(0,c)):t}return t===null?a=(...t)=>i(new e(...K1(l(t)))):n===null?a=(...n)=>i(new e(t,...K1(l(n)))):(n=H(n),a=(...r)=>i(new e(t,...K1(l(r)),n))),a.setParameterLength=(...e)=>(e.length===1?s=c=e[0]:e.length===2&&([s,c]=e),a),a.setName=e=>(o=e,a),a},E1=function(e,...t){return H(new e(...K1(t)))};var D1=class extends n1{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,inputNodes:n}=this,r=e.getNodeProperties(t),i=t.namespace&&t.namespace===e.namespace?e.getNamespace(`once`):`once`;if(r[i])return r[i];let a=null;if(t.layout){let r=x1.get(e.constructor);r===void 0&&(r=new WeakMap,x1.set(e.constructor,r));let i=r.get(t);i===void 0&&(i=H(e.buildFunctionNode(t)),r.set(t,i)),e.addInclude(i),a=H(i.call(n))}else{let r=t.jsFunc,i=n!==null||r.length>1?r(n||[],e):r(e);a=H(i)}return t.once&&(r[i]=a),a}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getOutputNamespace();return t[n]=t[n]||this.setupOutput(e),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),i=e.getNodeProperties(this),a=e.getOutputNamespace(),o=this.getOutputNode(e);if(r===`setup`){let t=e.getNamespace(`initialized`);i[t]!==!0&&(i[t]=!0,i[a]=this.getOutputNode(e),i[a].build(e)),n=i[a]}else r===`analyze`?o.build(e,t):r===`generate`&&(n=o.build(e,t)||``);return n}},O1=class extends n1{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1,this.namespace=null}setLayout(e){return this.layout=e,this}call(e=null){return G1(e),H(new D1(this,e))}setup(){return this.call()}};const k1=[!1,!0],A1=[0,1,2,3],j1=[-1,-2],M1=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],N1=new Map;for(let e of k1)N1.set(e,new p1(e));const P1=new Map;for(let e of A1)P1.set(e,new p1(e,`uint`));const F1=new Map([...P1].map(e=>new p1(e.value,`int`)));for(let e of j1)F1.set(e,new p1(e,`int`));const I1=new Map([...F1].map(e=>new p1(e.value)));for(let e of M1)I1.set(e,new p1(e));for(let e of M1)I1.set(-e,new p1(-e));const L1={bool:N1,uint:P1,ints:F1,float:I1},R1=new Map([...N1,...I1]),z1=(e,t)=>R1.has(e)?R1.get(e):e.isNode===!0?e:new p1(e,t),B1=e=>{try{return e.getNodeType()}catch{return}},V1=function(e,t=null){return(...n)=>{if((n.length===0||![`bool`,`float`,`int`,`uint`].includes(e)&&n.every(e=>typeof e!=`object`))&&(n=[H$(e,...n)]),n.length===1&&t!==null&&t.has(n[0]))return H(t.get(n[0]));if(n.length===1){let t=z1(n[0],e);return B1(t)===e?H(t):H(new i1(t,e))}let r=n.map(e=>z1(e));return H(new o1(r,e))}},H1=e=>typeof e==`object`&&e?e.value:e,U1=e=>e==null?null:e.nodeType||e.convertTo||(typeof e==`string`?e:null);function W1(e,t){return new Proxy(new O1(e,t),y1)}const H=(e,t=null)=>S1(e,t),G1=(e,t=null)=>new C1(e,t),K1=(e,t=null)=>new w1(e,t),U=(...e)=>new T1(...e),W=(...e)=>new E1(...e);let q1=0;const G=(e,t=null)=>{let n=null;t!==null&&(typeof t==`object`?n=t.return:(typeof t==`string`?n=t:console.error(`THREE.TSL: Invalid layout type.`),t=null));let r=new W1(e,n),i=(...e)=>{let t;G1(e);let i=e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype);t=i?[...e]:e[0];let a=r.call(t);return n===`void`&&a.toStack(),a};if(i.shaderNode=r,i.id=r.id,i.getNodeType=(...e)=>r.getNodeType(...e),i.getCacheKey=(...e)=>r.getCacheKey(...e),i.setLayout=e=>(r.setLayout(e),i),i.once=(e=null)=>(r.once=!0,r.namespace=e,i),t!==null){if(typeof t.inputs!=`object`){let e={name:`fn`+ q1++,type:n,inputs:[]};for(let n in t){if(n===`return`)continue;e.inputs.push({name:n,type:t[n]})}t=e}i.setLayout(t)}return i},J1=e=>{h1=e},Y1=()=>h1,X1=(...e)=>h1.If(...e),Z1=(...e)=>h1.Switch(...e);function Q1(e){return h1&&h1.add(e),e}V(`toStack`,Q1);const $1=new V1(`color`),K=new V1(`float`,L1.float),q=new V1(`int`,L1.ints),J=new V1(`uint`,L1.uint),e0=new V1(`bool`,L1.bool),Y=new V1(`vec2`),t0=new V1(`ivec2`),n0=new V1(`uvec2`),r0=new V1(`bvec2`),X=new V1(`vec3`),i0=new V1(`ivec3`),a0=new V1(`uvec3`),o0=new V1(`bvec3`),s0=new V1(`vec4`),c0=new V1(`ivec4`),l0=new V1(`uvec4`),u0=new V1(`bvec4`),d0=new V1(`mat2`),f0=new V1(`mat3`),p0=new V1(`mat4`),m0=(e=``)=>H(new p1(e,`string`)),h0=e=>H(new p1(e,`ArrayBuffer`));V(`toColor`,$1),V(`toFloat`,K),V(`toInt`,q),V(`toUint`,J),V(`toBool`,e0),V(`toVec2`,Y),V(`toIVec2`,t0),V(`toUVec2`,n0),V(`toBVec2`,r0),V(`toVec3`,X),V(`toIVec3`,i0),V(`toUVec3`,a0),V(`toBVec3`,o0),V(`toVec4`,s0),V(`toIVec4`,c0),V(`toUVec4`,l0),V(`toBVec4`,u0),V(`toMat2`,d0),V(`toMat3`,f0),V(`toMat4`,p0);const g0=U(r1).setParameterLength(2),_0=(e,t)=>H(new i1(H(e),t)),v0=(e,t)=>H(new c1(H(e),t));V(`element`,g0),V(`convert`,_0);const y0=e=>(console.warn(`THREE.TSL: append() has been renamed to Stack().`),Q1(e));V(`append`,e=>(console.warn(`THREE.TSL: .append() has been renamed to .toStack().`),Q1(e)));const b0=(...e)=>(console.warn(`THREE.TSL: tslFn() has been renamed to Fn().`),G(...e));var x0=class extends n1{static get type(){return`PropertyNode`}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0,this.global=!0}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}};const S0=(e,t)=>H(new x0(e,t)),C0=(e,t)=>H(new x0(e,t,!0)),w0=W(x0,`vec4`,`DiffuseColor`),T0=W(x0,`vec3`,`EmissiveColor`),E0=W(x0,`float`,`Roughness`),D0=W(x0,`float`,`Metalness`),O0=W(x0,`float`,`Clearcoat`),k0=W(x0,`float`,`ClearcoatRoughness`),A0=W(x0,`vec3`,`Sheen`),j0=W(x0,`float`,`SheenRoughness`),M0=W(x0,`float`,`Iridescence`),N0=W(x0,`float`,`IridescenceIOR`),P0=W(x0,`float`,`IridescenceThickness`),F0=W(x0,`float`,`AlphaT`),I0=W(x0,`float`,`Anisotropy`),L0=W(x0,`vec3`,`AnisotropyT`),R0=W(x0,`vec3`,`AnisotropyB`),z0=W(x0,`color`,`SpecularColor`),B0=W(x0,`float`,`SpecularF90`),V0=W(x0,`float`,`Shininess`),H0=W(x0,`vec4`,`Output`),U0=W(x0,`float`,`dashSize`),W0=W(x0,`float`,`gapSize`),G0=W(x0,`float`,`pointWidth`),K0=W(x0,`float`,`IOR`),q0=W(x0,`float`,`Transmission`),J0=W(x0,`float`,`Thickness`),Y0=W(x0,`float`,`AttenuationDistance`),X0=W(x0,`color`,`AttenuationColor`),Z0=W(x0,`float`,`Dispersion`);var Q0=class extends n1{static get type(){return`UniformGroupNode`}constructor(e,t=!1,n=1){super(`string`),this.name=e,this.shared=t,this.order=n,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}};const $0=e=>new Q0(e),e2=(e,t=0)=>new Q0(e,!0,t),t2=e2(`frame`),n2=e2(`render`),r2=$0(`object`);var i2=class extends d1{static get type(){return`UniformNode`}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name=``,this.groupNode=r2}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){let n=this.getSelf();return e=e.bind(n),super.onUpdate(t=>{let r=e(t,n);r!==void 0&&(this.value=r)},t)}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),i=e.getNodeFromHash(r);i===void 0&&(e.setHashNode(this,r),i=this);let a=i.getInputType(e),o=e.getUniformFromNode(i,a,e.shaderStage,this.name||e.context.label),s=e.getPropertyName(o);return e.context.label!==void 0&&delete e.context.label,e.format(s,n,t)}};const a2=(e,t)=>{let n=U1(t||e),r=e&&e.isNode===!0?e.node&&e.node.value||e.value:e;return H(new i2(r,n))};var o2=class extends a1{static get type(){return`ArrayNode`}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getNodeType(e){return this.nodeType===null&&(this.nodeType=this.values[0].getNodeType(e)),this.nodeType}getElementType(e){return this.getNodeType(e)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}};const s2=(...e)=>{let t;if(e.length===1){let n=e[0];t=new o2(null,n.length,n)}else{let n=e[0],r=e[1];t=new o2(n,r)}return H(t)};V(`toArray`,(e,t)=>s2(Array(t).fill(e)));var c2=class extends a1{static get type(){return`AssignNode`}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(e,t){return t===`void`?`void`:this.targetNode.getNodeType(e)}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable(`swizzleAssign`)===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e)),r=$$.join(``).slice(0,n)!==t.components;return r}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=e.getNodeProperties(this);r.sourceNode=n,r.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),i=this.needsSplitAssign(e),a=n.getNodeType(e),o=n.build(e),s=r.build(e,a),c=r.getNodeType(e),l=e.getDataFromNode(this),u;if(l.initialized===!0)t!==`void`&&(u=o);else if(i){let r=e.getVarFromNode(this,null,a),i=e.getPropertyName(r);e.addLineFlowCode(`${i} = ${s}`,this);let c=n.node,l=c.node.context({assign:!0}),d=l.build(e);for(let t=0;t<c.components.length;t++){let n=c.components[t];e.addLineFlowCode(`${d}.${n} = ${i}[ ${t} ]`,this)}t!==`void`&&(u=o)}else u=`${o} = ${s}`,(t===`void`||c===`void`)&&(e.addLineFlowCode(u,this),t!==`void`&&(u=o));return l.initialized=!0,e.format(u,a,t)}};const l2=U(c2).setParameterLength(2);V(`assign`,l2);var u2=class extends a1{static get type(){return`FunctionCallNode`}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),i=this.parameters,a=(t,n)=>{let r=n.type,i=r===`pointer`,a;return a=i?`&`+t.build(e):t.build(e,r),a};if(Array.isArray(i)){if(i.length>r.length)console.error(`THREE.TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'.`),i.length=r.length;else if(i.length<r.length)for(console.error(`THREE.TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.`);i.length<r.length;)i.push(K(0));for(let e=0;e<i.length;e++)t.push(a(i[e],r[e]))}else for(let e of r){let n=i[e.name];n===void 0?(console.error(`THREE.TSL: Input '${e.name}' not found in \'Fn()\'.`),t.push(a(K(0),e))):t.push(a(n,e))}let o=n.build(e,`property`);return`${o}( ${t.join(`, `)} )`}};const d2=(e,...t)=>(t=t.length>1||t[0]&&t[0].isNode===!0?K1(t):G1(t[0]),H(new u2(H(e),t)));V(`call`,d2);const f2={"==":`equal`,"!=":`notEqual`,"<":`lessThan`,">":`greaterThan`,"<=":`lessThanEqual`,">=":`greaterThanEqual`,"%":`mod`};var p2=class e extends a1{static get type(){return`OperatorNode`}constructor(t,n,r,...i){if(super(),i.length>0){let a=new e(t,n,r);for(let n=0;n<i.length-1;n++)a=new e(t,a,i[n]);n=a,r=i[i.length-1]}this.op=t,this.aNode=n,this.bNode=r,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(f2[this.op],t)}getNodeType(e){let t=this.op,n=this.aNode,r=this.bNode,i=n.getNodeType(e),a=r?r.getNodeType(e):null;if(i===`void`||a===`void`)return`void`;if(t===`%`)return i;if(t===`~`||t===`&`||t===`|`||t===`^`||t===`>>`||t===`<<`)return e.getIntegerType(i);if(t===`!`||t===`&&`||t===`||`||t===`^^`)return`bool`;if(t===`==`||t===`!=`||t===`<`||t===`>`||t===`<=`||t===`>=`){let t=Math.max(e.getTypeLength(i),e.getTypeLength(a));return t>1?`bvec${t}`:`bool`}else{if(e.isMatrix(i)){if(a===`float`)return i;if(e.isVector(a))return e.getVectorFromMatrix(i);if(e.isMatrix(a))return i}else if(e.isMatrix(a)){if(i===`float`)return a;if(e.isVector(i))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(i)?a:i}}generate(e,t){let n=this.op,{aNode:r,bNode:i}=this,a=this.getNodeType(e),o=null,s=null;a===`void`?o=s=a:(o=r.getNodeType(e),s=i?i.getNodeType(e):null,n===`<`||n===`>`||n===`<=`||n===`>=`||n===`==`||n===`!=`?e.isVector(o)?s=o:e.isVector(s)?o=s:o!==s&&(o=s=`float`):n===`>>`||n===`<<`?(o=a,s=e.changeComponentType(s,`uint`)):n===`%`?(o=a,s=e.isInteger(o)&&e.isInteger(s)?s:o):e.isMatrix(o)?s===`float`?s=`float`:e.isVector(s)?s=e.getVectorFromMatrix(o):e.isMatrix(s)||(o=s=a):o=e.isMatrix(s)?o===`float`?`float`:e.isVector(o)?e.getVectorFromMatrix(s):s=a:s=a);let c=r.build(e,o),l=i?i.build(e,s):null,u=e.getFunctionOperator(n);if(t!==`void`){let r=e.renderer.coordinateSystem===VI;if(n===`==`||n===`!=`||n===`<`||n===`>`||n===`<=`||n===`>=`)return r&&e.isVector(o)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${l} )`,a,t):e.format(`( ${c} ${n} ${l} )`,a,t);if(n===`%`)return e.isInteger(s)?e.format(`( ${c} % ${l} )`,a,t):e.format(`${this.getOperatorMethod(e,a)}( ${c}, ${l} )`,a,t);if(n===`!`||n===`~`)return e.format(`(${n}${c})`,o,t);if(u)return e.format(`${u}( ${c}, ${l} )`,a,t);if(e.isMatrix(o)&&s===`float`)return e.format(`( ${l} ${n} ${c} )`,a,t);if(o===`float`&&e.isMatrix(s))return e.format(`${c} ${n} ${l}`,a,t);{let i=`( ${c} ${n} ${l} )`;return!r&&a===`bool`&&e.isVector(o)&&e.isVector(s)&&(i=`all${i}`),e.format(i,a,t)}}else if(o!==`void`)return u?e.format(`${u}( ${c}, ${l} )`,a,t):e.isMatrix(o)&&s===`float`?e.format(`${l} ${n} ${c}`,a,t):e.format(`${c} ${n} ${l}`,a,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}};const m2=U(p2,`+`).setParameterLength(2,1/0).setName(`add`),h2=U(p2,`-`).setParameterLength(2,1/0).setName(`sub`),g2=U(p2,`*`).setParameterLength(2,1/0).setName(`mul`),_2=U(p2,`/`).setParameterLength(2,1/0).setName(`div`),v2=U(p2,`%`).setParameterLength(2).setName(`mod`),y2=U(p2,`==`).setParameterLength(2).setName(`equal`),b2=U(p2,`!=`).setParameterLength(2).setName(`notEqual`),x2=U(p2,`<`).setParameterLength(2).setName(`lessThan`),S2=U(p2,`>`).setParameterLength(2).setName(`greaterThan`),C2=U(p2,`<=`).setParameterLength(2).setName(`lessThanEqual`),w2=U(p2,`>=`).setParameterLength(2).setName(`greaterThanEqual`),T2=U(p2,`&&`).setParameterLength(2,1/0).setName(`and`),E2=U(p2,`||`).setParameterLength(2,1/0).setName(`or`),D2=U(p2,`!`).setParameterLength(1).setName(`not`),O2=U(p2,`^^`).setParameterLength(2).setName(`xor`),k2=U(p2,`&`).setParameterLength(2).setName(`bitAnd`),A2=U(p2,`~`).setParameterLength(2).setName(`bitNot`),j2=U(p2,`|`).setParameterLength(2).setName(`bitOr`),M2=U(p2,`^`).setParameterLength(2).setName(`bitXor`),N2=U(p2,`<<`).setParameterLength(2).setName(`shiftLeft`),P2=U(p2,`>>`).setParameterLength(2).setName(`shiftRight`),F2=G(([e])=>(e.addAssign(1),e)),I2=G(([e])=>(e.subAssign(1),e)),L2=G(([e])=>{let t=q(e).toConst();return e.addAssign(1),t}),R2=G(([e])=>{let t=q(e).toConst();return e.subAssign(1),t});V(`add`,m2),V(`sub`,h2),V(`mul`,g2),V(`div`,_2),V(`mod`,v2),V(`equal`,y2),V(`notEqual`,b2),V(`lessThan`,x2),V(`greaterThan`,S2),V(`lessThanEqual`,C2),V(`greaterThanEqual`,w2),V(`and`,T2),V(`or`,E2),V(`not`,D2),V(`xor`,O2),V(`bitAnd`,k2),V(`bitNot`,A2),V(`bitOr`,j2),V(`bitXor`,M2),V(`shiftLeft`,N2),V(`shiftRight`,P2),V(`incrementBefore`,F2),V(`decrementBefore`,I2),V(`increment`,L2),V(`decrement`,R2);const z2=(e,t)=>(console.warn(`THREE.TSL: "remainder()" is deprecated. Use "mod( int( ... ) )" instead.`),v2(e,t)),B2=(e,t)=>(console.warn(`THREE.TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.`),v2(q(e),q(t)));V(`remainder`,z2),V(`modInt`,B2);var Z=class e extends a1{static get type(){return`MathNode`}constructor(t,n,r=null,i=null){if(super(),(t===e.MAX||t===e.MIN)&&arguments.length>3){let a=new e(t,n,r);for(let n=2;n<arguments.length-1;n++)a=new e(t,a,arguments[n]);n=a,r=arguments[arguments.length-1],i=null}this.method=t,this.aNode=n,this.bNode=r,this.cNode=i,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,i=e.isMatrix(t)?0:e.getTypeLength(t),a=e.isMatrix(n)?0:e.getTypeLength(n),o=e.isMatrix(r)?0:e.getTypeLength(r);return i>a&&i>o?t:a>o?n:o>i?r:t}getNodeType(t){let n=this.method;return n===e.LENGTH||n===e.DISTANCE||n===e.DOT?`float`:n===e.CROSS?`vec3`:n===e.ALL||n===e.ANY?`bool`:n===e.EQUALS?t.changeComponentType(this.aNode.getNodeType(t),`bool`):this.getInputType(t)}setup(t){let{aNode:n,bNode:r,method:i}=this,a=null;if(i===e.ONE_MINUS)a=h2(1,n);else if(i===e.RECIPROCAL)a=_2(1,n);else if(i===e.DIFFERENCE)a=d4(h2(n,r));else if(i===e.TRANSFORM_DIRECTION){let e=n,i=r;t.isMatrix(e.getNodeType(t))?i=s0(X(i),0):e=s0(X(e),0);let o=g2(e,i).xyz;a=r4(o)}return a===null?super.setup(t):a}generate(t,n){let r=t.getNodeProperties(this);if(r.outputNode)return super.generate(t,n);let i=this.method,a=this.getNodeType(t),o=this.getInputType(t),s=this.aNode,c=this.bNode,l=this.cNode,u=t.renderer.coordinateSystem;if(i===e.NEGATE)return t.format(`( - `+s.build(t,o)+` )`,a,n);{let r=[];return i===e.CROSS?r.push(s.build(t,a),c.build(t,a)):u===VI&&i===e.STEP?r.push(s.build(t,t.getTypeLength(s.getNodeType(t))===1?`float`:o),c.build(t,o)):u===VI&&(i===e.MIN||i===e.MAX)?r.push(s.build(t,o),c.build(t,t.getTypeLength(c.getNodeType(t))===1?`float`:o)):i===e.REFRACT?r.push(s.build(t,o),c.build(t,o),l.build(t,`float`)):i===e.MIX?r.push(s.build(t,o),c.build(t,o),l.build(t,t.getTypeLength(l.getNodeType(t))===1?`float`:o)):(u===HI&&i===e.ATAN&&c!==null&&(i=`atan2`),t.shaderStage!==`fragment`&&(i===e.DFDX||i===e.DFDY)&&(console.warn(`THREE.TSL: '${i}' is not supported in the ${t.shaderStage} stage.`),i=`/*`+i+`*/`),r.push(s.build(t,o)),c!==null&&r.push(c.build(t,o)),l!==null&&r.push(l.build(t,o))),t.format(`${t.getMethod(i,a)}( ${r.join(`, `)} )`,a,n)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Z.ALL=`all`,Z.ANY=`any`,Z.RADIANS=`radians`,Z.DEGREES=`degrees`,Z.EXP=`exp`,Z.EXP2=`exp2`,Z.LOG=`log`,Z.LOG2=`log2`,Z.SQRT=`sqrt`,Z.INVERSE_SQRT=`inversesqrt`,Z.FLOOR=`floor`,Z.CEIL=`ceil`,Z.NORMALIZE=`normalize`,Z.FRACT=`fract`,Z.SIN=`sin`,Z.COS=`cos`,Z.TAN=`tan`,Z.ASIN=`asin`,Z.ACOS=`acos`,Z.ATAN=`atan`,Z.ABS=`abs`,Z.SIGN=`sign`,Z.LENGTH=`length`,Z.NEGATE=`negate`,Z.ONE_MINUS=`oneMinus`,Z.DFDX=`dFdx`,Z.DFDY=`dFdy`,Z.ROUND=`round`,Z.RECIPROCAL=`reciprocal`,Z.TRUNC=`trunc`,Z.FWIDTH=`fwidth`,Z.TRANSPOSE=`transpose`,Z.BITCAST=`bitcast`,Z.EQUALS=`equals`,Z.MIN=`min`,Z.MAX=`max`,Z.STEP=`step`,Z.REFLECT=`reflect`,Z.DISTANCE=`distance`,Z.DIFFERENCE=`difference`,Z.DOT=`dot`,Z.CROSS=`cross`,Z.POW=`pow`,Z.TRANSFORM_DIRECTION=`transformDirection`,Z.MIX=`mix`,Z.CLAMP=`clamp`,Z.REFRACT=`refract`,Z.SMOOTHSTEP=`smoothstep`,Z.FACEFORWARD=`faceforward`;const V2=K(1e-6),H2=K(1e6),U2=K(Math.PI),W2=K(Math.PI*2),G2=U(Z,Z.ALL).setParameterLength(1),K2=U(Z,Z.ANY).setParameterLength(1),q2=U(Z,Z.RADIANS).setParameterLength(1),J2=U(Z,Z.DEGREES).setParameterLength(1),Y2=U(Z,Z.EXP).setParameterLength(1),X2=U(Z,Z.EXP2).setParameterLength(1),Z2=U(Z,Z.LOG).setParameterLength(1),Q2=U(Z,Z.LOG2).setParameterLength(1),$2=U(Z,Z.SQRT).setParameterLength(1),e4=U(Z,Z.INVERSE_SQRT).setParameterLength(1),t4=U(Z,Z.FLOOR).setParameterLength(1),n4=U(Z,Z.CEIL).setParameterLength(1),r4=U(Z,Z.NORMALIZE).setParameterLength(1),i4=U(Z,Z.FRACT).setParameterLength(1),a4=U(Z,Z.SIN).setParameterLength(1),o4=U(Z,Z.COS).setParameterLength(1),s4=U(Z,Z.TAN).setParameterLength(1),c4=U(Z,Z.ASIN).setParameterLength(1),l4=U(Z,Z.ACOS).setParameterLength(1),u4=U(Z,Z.ATAN).setParameterLength(1,2),d4=U(Z,Z.ABS).setParameterLength(1),f4=U(Z,Z.SIGN).setParameterLength(1),p4=U(Z,Z.LENGTH).setParameterLength(1),m4=U(Z,Z.NEGATE).setParameterLength(1),h4=U(Z,Z.ONE_MINUS).setParameterLength(1),g4=U(Z,Z.DFDX).setParameterLength(1),_4=U(Z,Z.DFDY).setParameterLength(1),v4=U(Z,Z.ROUND).setParameterLength(1),y4=U(Z,Z.RECIPROCAL).setParameterLength(1),b4=U(Z,Z.TRUNC).setParameterLength(1),x4=U(Z,Z.FWIDTH).setParameterLength(1),S4=U(Z,Z.TRANSPOSE).setParameterLength(1),C4=U(Z,Z.BITCAST).setParameterLength(2),w4=(e,t)=>(console.warn(`THREE.TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"`),y2(e,t)),T4=U(Z,Z.MIN).setParameterLength(2,1/0),E4=U(Z,Z.MAX).setParameterLength(2,1/0),D4=U(Z,Z.STEP).setParameterLength(2),O4=U(Z,Z.REFLECT).setParameterLength(2),k4=U(Z,Z.DISTANCE).setParameterLength(2),A4=U(Z,Z.DIFFERENCE).setParameterLength(2),j4=U(Z,Z.DOT).setParameterLength(2),M4=U(Z,Z.CROSS).setParameterLength(2),N4=U(Z,Z.POW).setParameterLength(2),P4=U(Z,Z.POW,2).setParameterLength(1),F4=U(Z,Z.POW,3).setParameterLength(1),I4=U(Z,Z.POW,4).setParameterLength(1),L4=U(Z,Z.TRANSFORM_DIRECTION).setParameterLength(2),R4=e=>g2(f4(e),N4(d4(e),1/3)),z4=e=>j4(e,e),B4=U(Z,Z.MIX).setParameterLength(3),V4=(e,t=0,n=1)=>H(new Z(Z.CLAMP,H(e),H(t),H(n))),H4=e=>V4(e),U4=U(Z,Z.REFRACT).setParameterLength(3),W4=U(Z,Z.SMOOTHSTEP).setParameterLength(3),G4=U(Z,Z.FACEFORWARD).setParameterLength(3),K4=G(([e])=>{let t=12.9898,n=78.233,r=43758.5453,i=j4(e.xy,Y(t,n)),a=v2(i,U2);return i4(a4(a).mul(r))}),q4=(e,t,n)=>B4(t,n,e),J4=(e,t,n)=>W4(t,n,e),Y4=(e,t)=>(console.warn(`THREE.TSL: "atan2" is overloaded. Use "atan" instead.`),u4(e,t)),Boe=G4,Voe=e4;V(`all`,G2),V(`any`,K2),V(`equals`,w4),V(`radians`,q2),V(`degrees`,J2),V(`exp`,Y2),V(`exp2`,X2),V(`log`,Z2),V(`log2`,Q2),V(`sqrt`,$2),V(`inverseSqrt`,e4),V(`floor`,t4),V(`ceil`,n4),V(`normalize`,r4),V(`fract`,i4),V(`sin`,a4),V(`cos`,o4),V(`tan`,s4),V(`asin`,c4),V(`acos`,l4),V(`atan`,u4),V(`abs`,d4),V(`sign`,f4),V(`length`,p4),V(`lengthSq`,z4),V(`negate`,m4),V(`oneMinus`,h4),V(`dFdx`,g4),V(`dFdy`,_4),V(`round`,v4),V(`reciprocal`,y4),V(`trunc`,b4),V(`fwidth`,x4),V(`atan2`,Y4),V(`min`,T4),V(`max`,E4),V(`step`,D4),V(`reflect`,O4),V(`distance`,k4),V(`dot`,j4),V(`cross`,M4),V(`pow`,N4),V(`pow2`,P4),V(`pow3`,F4),V(`pow4`,I4),V(`transformDirection`,L4),V(`mix`,q4),V(`clamp`,V4),V(`refract`,U4),V(`smoothstep`,J4),V(`faceForward`,G4),V(`difference`,A4),V(`saturate`,H4),V(`cbrt`,R4),V(`transpose`,S4),V(`rand`,K4);var Hoe=class extends n1{static get type(){return`ConditionalNode`}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return this.setup(e),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let t=n.getNodeType(e);if(e.getTypeLength(t)>e.getTypeLength(r))return t}return r}setup(e){let t=this.condNode.cache(),n=this.ifNode.cache(),r=this.elseNode?this.elseNode.cache():null,i=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=i,r!==null&&(e.getDataFromNode(r).parentNodeBlock=i);let a=e.getNodeProperties(this);a.condNode=t,a.ifNode=n.context({nodeBlock:n}),a.elseNode=r?r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:i,ifNode:a,elseNode:o}=e.getNodeProperties(this),s=e.currentFunctionNode,c=t!==`void`,l=c?S0(n).build(e):``;r.nodeProperty=l;let u=i.build(e,`bool`);e.addFlowCode(`\n${e.tab}if ( ${u} ) {\n\n`).addFlowTab();let d=a.build(e,n);if(d&&(c?d=l+` = `+d+`;`:(d=`return `+d+`;`,s===null&&(console.warn(`THREE.TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.`),d=`// `+d))),e.removeFlowTab().addFlowCode(e.tab+` `+d+`
|
|
411
411
|
|
|
412
412
|
`+e.tab+`}`),o!==null){e.addFlowCode(` else {
|
|
413
413
|
|
package/package.json
CHANGED