| (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{2765:(e,n,t)=>{"use strict";t.d(n,{Providers:()=>o});var r=t(6384),i=t(7923);function o(e){let{children:n}=e;return(0,r.jsx)(i.N,{attribute:"class",defaultTheme:"dark",enableSystem:!0,disableTransitionOnChange:!0,children:n})}},5297:()=>{},6396:(e,n,t)=>{"use strict";t.d(n,{default:()=>c});var r=t(6384),i=t(7210),o=t(3660),a=t(2471),u=t(7240),l=t(3047),s=t(6636);function c(e){let{colorStops:n=["#00d8ff","#7cff67","#00d8ff"],amplitude:t=1,blend:c=.5}=e,v=(0,s.useRef)(e);v.current=e;let f=(0,s.useRef)(null);return(0,s.useEffect)(()=>{let e,r=f.current;if(!r)return;let s=new i.A({alpha:!0,premultipliedAlpha:!0,antialias:!0}),m=s.gl;function d(){if(!r)return;let n=r.offsetWidth,t=r.offsetHeight;s.setSize(n,t),e&&(e.uniforms.uResolution.value=[n,t])}m.clearColor(0,0,0,0),m.enable(m.BLEND),m.blendFunc(m.ONE,m.ONE_MINUS_SRC_ALPHA),m.canvas.style.backgroundColor="transparent",window.addEventListener("resize",d);let h=new o.l(m);h.attributes.uv&&delete h.attributes.uv;let x=n.map(e=>{let n=new a.Q(e);return[n.r,n.g,n.b]});e=new u.B(m,{vertex:"#version 300 es\nin vec2 position;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n}\n",fragment:"#version 300 es\nprecision highp float;\n\nuniform float uTime;\nuniform float uAmplitude;\nuniform vec3 uColorStops[3];\nuniform vec2 uResolution;\nuniform float uBlend;\n\nout vec4 fragColor;\n\nvec3 permute(vec3 x) {\n return mod(((x * 34.0) + 1.0) * x, 289.0);\n}\n\nfloat snoise(vec2 v){\n const vec4 C = vec4(\n 0.211324865405187, 0.366025403784439,\n -0.577350269189626, 0.024390243902439\n );\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod(i, 289.0);\n\n vec3 p = permute(\n permute(i.y + vec3(0.0, i1.y, 1.0))\n + i.x + vec3(0.0, i1.x, 1.0)\n );\n\n vec3 m = max(\n 0.5 - vec3(\n dot(x0, x0),\n dot(x12.xy, x12.xy),\n dot(x12.zw, x12.zw)\n ), \n 0.0\n );\n m = m * m;\n m = m * m;\n\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);\n\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\nstruct ColorStop {\n vec3 color;\n float position;\n};\n\n#define COLOR_RAMP(colors, factor, finalColor) { int index = 0; for (int i = 0; i < 2; i++) { ColorStop currentColor = colors[i]; bool isInBetween = currentColor.position <= factor; index = int(mix(float(index), float(i), float(isInBetween))); } ColorStop currentColor = colors[index]; ColorStop nextColor = colors[index + 1]; float range = nextColor.position - currentColor.position; float lerpFactor = (factor - currentColor.position) / range; finalColor = mix(currentColor.color, nextColor.color, lerpFactor); }\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / uResolution;\n \n ColorStop colors[3];\n colors[0] = ColorStop(uColorStops[0], 0.0);\n colors[1] = ColorStop(uColorStops[1], 0.5);\n colors[2] = ColorStop(uColorStops[2], 1.0);\n \n vec3 rampColor;\n COLOR_RAMP(colors, uv.x, rampColor);\n \n float height = snoise(vec2(uv.x * 2.0 + uTime * 0.1, uTime * 0.25)) * 0.5 * uAmplitude;\n height = exp(height);\n height = (uv.y * 2.0 - height + 0.2);\n float intensity = 0.6 * height;\n \n float midPoint = 0.20;\n float auroraAlpha = smoothstep(midPoint - uBlend * 0.5, midPoint + uBlend * 0.5, intensity);\n \n vec3 auroraColor = intensity * rampColor;\n \n fragColor = vec4(auroraColor * auroraAlpha, auroraAlpha);\n}\n",uniforms:{uTime:{value:0},uAmplitude:{value:t},uColorStops:{value:x},uResolution:{value:[r.offsetWidth,r.offsetHeight]},uBlend:{value:c}}});let g=new l.e(m,{geometry:h,program:e});r.appendChild(m.canvas);let p=0,T=t=>{p=requestAnimationFrame(T);let{time:r=.01*t,speed:i=1}=v.current;if(e){var o,u,l;e.uniforms.uTime.value=r*i*.1,e.uniforms.uAmplitude.value=null!=(o=v.current.amplitude)?o:1,e.uniforms.uBlend.value=null!=(u=v.current.blend)?u:c;let t=null!=(l=v.current.colorStops)?l:n;e.uniforms.uColorStops.value=t.map(e=>{let n=new a.Q(e);return[n.r,n.g,n.b]}),s.render({scene:g})}};return p=requestAnimationFrame(T),d(),()=>{var e;cancelAnimationFrame(p),window.removeEventListener("resize",d),r&&m.canvas.parentNode===r&&r.removeChild(m.canvas),null==(e=m.getExtension("WEBGL_lose_context"))||e.loseContext()}},[t]),(0,r.jsx)("div",{ref:f,className:"aurora-container w-full h-full"})}},7665:(e,n,t)=>{"use strict";t.d(n,{default:()=>f});var r=t(6384),i=t(7210),o=t(3423),a=t(5924),u=t(7240),l=t(3047),s=t(6636);let c=["#ffffff","#ffffff","#ffffff"],v=e=>{3===(e=e.replace(/^#/,"")).length&&(e=e.split("").map(e=>e+e).join(""));let n=parseInt(e,16);return[(n>>16&255)/255,(n>>8&255)/255,(255&n)/255]},f=e=>{let{particleCount:n=200,particleSpread:t=10,speed:f=.1,particleColors:m,moveParticlesOnHover:d=!1,particleHoverFactor:h=1,alphaParticles:x=!1,particleBaseSize:g=100,sizeRandomness:p=1,cameraDistance:T=20,disableRotation:E=!1,className:R}=e,y=(0,s.useRef)(null),S=(0,s.useRef)({x:0,y:0});return(0,s.useEffect)(()=>{let e,r=y.current;if(!r)return;let s=new i.A({depth:!1,alpha:!0}),R=s.gl;r.appendChild(R.canvas),R.clearColor(0,0,0,0);let w=new o.i(R,{fov:15});w.position.set(0,0,T);let b=()=>{let e=r.clientWidth,n=r.clientHeight;s.setSize(e,n),w.perspective({aspect:R.canvas.width/R.canvas.height})};window.addEventListener("resize",b,!1),b();let _=e=>{let n=r.getBoundingClientRect();S.current={x:(e.clientX-n.left)/n.width*2-1,y:-((e.clientY-n.top)/n.height*2-1)}};d&&r.addEventListener("mousemove",_);let A=new Float32Array(3*n),D=new Float32Array(4*n),C=new Float32Array(3*n),F=m&&m.length>0?m:c;for(let e=0;e<n;e++){let n,t,r,i;do i=(n=2*Math.random()-1)*n+(t=2*Math.random()-1)*t+(r=2*Math.random()-1)*r;while(i>1||0===i);let o=Math.cbrt(Math.random());A.set([n*o,t*o,r*o],3*e),D.set([Math.random(),Math.random(),Math.random(),Math.random()],4*e);let a=v(F[Math.floor(Math.random()*F.length)]);C.set(a,3*e)}let P=new a.V(R,{position:{size:3,data:A},random:{size:4,data:D},color:{size:3,data:C}}),L=new u.B(R,{vertex:"\n attribute vec3 position;\n attribute vec4 random;\n attribute vec3 color;\n \n uniform mat4 modelMatrix;\n uniform mat4 viewMatrix;\n uniform mat4 projectionMatrix;\n uniform float uTime;\n uniform float uSpread;\n uniform float uBaseSize;\n uniform float uSizeRandomness;\n \n varying vec4 vRandom;\n varying vec3 vColor;\n \n void main() {\n vRandom = random;\n vColor = color;\n \n vec3 pos = position * uSpread;\n pos.z *= 10.0;\n \n vec4 mPos = modelMatrix * vec4(pos, 1.0);\n float t = uTime;\n mPos.x += sin(t * random.z + 6.28 * random.w) * mix(0.1, 1.5, random.x);\n mPos.y += sin(t * random.y + 6.28 * random.x) * mix(0.1, 1.5, random.w);\n mPos.z += sin(t * random.w + 6.28 * random.y) * mix(0.1, 1.5, random.z);\n \n vec4 mvPos = viewMatrix * mPos;\n gl_PointSize = (uBaseSize * (1.0 + uSizeRandomness * (random.x - 0.5))) / length(mvPos.xyz);\n gl_Position = projectionMatrix * mvPos;\n }\n",fragment:"\n precision highp float;\n \n uniform float uTime;\n uniform float uAlphaParticles;\n varying vec4 vRandom;\n varying vec3 vColor;\n \n void main() {\n vec2 uv = gl_PointCoord.xy;\n float d = length(uv - vec2(0.5));\n \n if(uAlphaParticles < 0.5) {\n if(d > 0.5) {\n discard;\n }\n gl_FragColor = vec4(vColor + 0.2 * sin(uv.yxx + uTime + vRandom.y * 6.28), 1.0);\n } else {\n float circle = smoothstep(0.5, 0.4, d) * 0.8;\n gl_FragColor = vec4(vColor + 0.2 * sin(uv.yxx + uTime + vRandom.y * 6.28), circle);\n }\n }\n",uniforms:{uTime:{value:0},uSpread:{value:t},uBaseSize:{value:g},uSizeRandomness:{value:p},uAlphaParticles:{value:+!!x}},transparent:!0,depthTest:!1}),z=new l.e(R,{mode:R.POINTS,geometry:P,program:L}),U=performance.now(),B=0,N=n=>{e=requestAnimationFrame(N);let t=n-U;U=n,B+=t*f,L.uniforms.uTime.value=.001*B,d?(z.position.x=-S.current.x*h,z.position.y=-S.current.y*h):(z.position.x=0,z.position.y=0),E||(z.rotation.x=.1*Math.sin(2e-4*B),z.rotation.y=.15*Math.cos(5e-4*B),z.rotation.z+=.01*f),s.render({scene:z,camera:w})};return e=requestAnimationFrame(N),()=>{window.removeEventListener("resize",b),d&&r.removeEventListener("mousemove",_),cancelAnimationFrame(e),r.contains(R.canvas)&&r.removeChild(R.canvas)}},[n,t,f,d,h,x,g,p,T,E,m]),(0,r.jsx)("div",{ref:y,className:"particles-container ".concat(R," relative w-full h-full")})}},7811:(e,n,t)=>{"use strict";t.d(n,{default:()=>s});var r=t(6384),i=t(2692),o=t(2309),a=t(1685),u=t.n(a),l=t(8033);function s(){return(0,r.jsx)("header",{className:"w-full z-10",children:(0,r.jsx)("div",{className:"container mx-auto",children:(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-3",children:[(0,r.jsx)("div",{className:"flex items-center",children:(0,r.jsxs)(u(),{href:"/",className:"flex items-center gap-2",children:[(0,r.jsx)(o.default,{src:"https://notes-wudi.pages.dev/images/logo.png",alt:"Chendi Wu Logo",width:32,height:32,className:"rounded-full"}),(0,r.jsx)("span",{className:"text-white font-medium",children:"Clearify"})]})}),(0,r.jsx)("div",{className:"flex items-center gap-6",children:(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsx)(l.$,{asChild:!0,variant:"outline",size:"icon","aria-label":"GitHub",children:(0,r.jsx)(u(),{href:"https://github.com/WuChenDi/clearify",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(i.A,{className:"w-5 h-5"})})})})})]})})})}},8033:(e,n,t)=>{"use strict";t.d(n,{$:()=>l});var r=t(6384);t(6636);var i=t(6568),o=t(88),a=t(8942);let u=(0,o.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:n,variant:t,size:o,asChild:l=!1,...s}=e,c=l?i.DX:"button";return(0,r.jsx)(c,{"data-slot":"button",className:(0,a.cn)(u({variant:t,size:o,className:n})),...s})}},8438:(e,n,t)=>{Promise.resolve().then(t.bind(t,7206)),Promise.resolve().then(t.bind(t,1336)),Promise.resolve().then(t.bind(t,207)),Promise.resolve().then(t.t.bind(t,1685,23)),Promise.resolve().then(t.t.bind(t,2576,23)),Promise.resolve().then(t.t.bind(t,5448,23)),Promise.resolve().then(t.bind(t,432)),Promise.resolve().then(t.t.bind(t,5297,23)),Promise.resolve().then(t.bind(t,2765)),Promise.resolve().then(t.bind(t,7811)),Promise.resolve().then(t.bind(t,6396)),Promise.resolve().then(t.bind(t,7665)),Promise.resolve().then(t.bind(t,8835))},8835:(e,n,t)=>{"use strict";t.d(n,{default:()=>o});var r=t(6384),i=t(6636);function o(e){let{SIM_RESOLUTION:n=128,DYE_RESOLUTION:t=1440,CAPTURE_RESOLUTION:o=512,DENSITY_DISSIPATION:a=3.5,VELOCITY_DISSIPATION:u=2,PRESSURE:l=.1,PRESSURE_ITERATIONS:s=20,CURL:c=3,SPLAT_RADIUS:v=.2,SPLAT_FORCE:f=6e3,SHADING:m=!0,COLOR_UPDATE_SPEED:d=10,BACK_COLOR:h={r:.5,g:0,b:0},TRANSPARENT:x=!0}=e,g=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e,r,i,o,h,x=g.current;if(!x)return;let p=[{id:-1,texcoordX:0,texcoordY:0,prevTexcoordX:0,prevTexcoordY:0,deltaX:0,deltaY:0,down:!1,moved:!1,color:{r:0,g:0,b:0}}],T={SIM_RESOLUTION:n,DYE_RESOLUTION:t,DENSITY_DISSIPATION:a,VELOCITY_DISSIPATION:u,PRESSURE:l,PRESSURE_ITERATIONS:s,CURL:c,SPLAT_RADIUS:v,SPLAT_FORCE:f,SHADING:m,COLOR_UPDATE_SPEED:d},{gl:E,ext:R}=function(e){let n,t,r,i={alpha:!0,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1},o=e.getContext("webgl2",i);if(o||(o=e.getContext("webgl",i)||e.getContext("experimental-webgl",i)),!o)throw Error("Unable to initialize WebGL.");let a="drawBuffers"in o,u=!1,l=null;a?(o.getExtension("EXT_color_buffer_float"),u=!!o.getExtension("OES_texture_float_linear")):(l=o.getExtension("OES_texture_half_float"),u=!!o.getExtension("OES_texture_half_float_linear")),o.clearColor(0,0,0,1);let s=a?o.HALF_FLOAT:l&&l.HALF_FLOAT_OES||0;return a?(n=y(o,o.RGBA16F,o.RGBA,s),t=y(o,o.RG16F,o.RG,s),r=y(o,o.R16F,o.RED,s)):(n=y(o,o.RGBA,o.RGBA,s),t=y(o,o.RGBA,o.RGBA,s),r=y(o,o.RGBA,o.RGBA,s)),{gl:o,ext:{formatRGBA:n,formatRG:t,formatR:r,halfFloatTexType:s,supportLinearFiltering:u}}}(x);if(!E||!R)return;function y(e,n,t,r){if(!function(e,n,t,r){let i=e.createTexture();if(!i)return!1;e.bindTexture(e.TEXTURE_2D,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,n,4,4,0,t,r,null);let o=e.createFramebuffer();return!!o&&(e.bindFramebuffer(e.FRAMEBUFFER,o),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE)}(e,n,t,r)){if("drawBuffers"in e)switch(n){case e.R16F:return y(e,e.RG16F,e.RG,r);case e.RG16F:return y(e,e.RGBA16F,e.RGBA,r)}return null}return{internalFormat:n,format:t}}function S(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=function(e,n){if(!n)return e;let t="";for(let e of n)t+="#define ".concat(e,"\n");return t+e}(n,t),i=E.createShader(e);return i?(E.shaderSource(i,r),E.compileShader(i),E.getShaderParameter(i,E.COMPILE_STATUS)||console.trace(E.getShaderInfoLog(i)),i):null}function w(e,n){if(!e||!n)return null;let t=E.createProgram();return t?(E.attachShader(t,e),E.attachShader(t,n),E.linkProgram(t),E.getProgramParameter(t,E.LINK_STATUS)||console.trace(E.getProgramInfoLog(t)),t):null}function b(e){let n={},t=E.getProgramParameter(e,E.ACTIVE_UNIFORMS);for(let r=0;r<t;r++){let t=E.getActiveUniform(e,r);t&&(n[t.name]=E.getUniformLocation(e,t.name))}return n}R.supportLinearFiltering||(T.DYE_RESOLUTION=256,T.SHADING=!1);class _{bind(){this.program&&E.useProgram(this.program)}constructor(e,n){this.program=w(e,n),this.uniforms=this.program?b(this.program):{}}}class A{setKeywords(e){let n=0;for(let t of e)n+=function(e){if(!e.length)return 0;let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t)|0;return n}(t);let t=this.programs[n];if(null==t){let r=S(E.FRAGMENT_SHADER,this.fragmentShaderSource,e);t=w(this.vertexShader,r),this.programs[n]=t}t!==this.activeProgram&&(t&&(this.uniforms=b(t)),this.activeProgram=t)}bind(){this.activeProgram&&E.useProgram(this.activeProgram)}constructor(e,n){this.vertexShader=e,this.fragmentShaderSource=n,this.programs={},this.activeProgram=null,this.uniforms={}}}let D=S(E.VERTEX_SHADER,"\n precision highp float;\n attribute vec2 aPosition;\n varying vec2 vUv;\n varying vec2 vL;\n varying vec2 vR;\n varying vec2 vT;\n varying vec2 vB;\n uniform vec2 texelSize;\n\n void main () {\n vUv = aPosition * 0.5 + 0.5;\n vL = vUv - vec2(texelSize.x, 0.0);\n vR = vUv + vec2(texelSize.x, 0.0);\n vT = vUv + vec2(0.0, texelSize.y);\n vB = vUv - vec2(0.0, texelSize.y);\n gl_Position = vec4(aPosition, 0.0, 1.0);\n }\n "),C=S(E.FRAGMENT_SHADER,"\n precision mediump float;\n precision mediump sampler2D;\n varying highp vec2 vUv;\n uniform sampler2D uTexture;\n\n void main () {\n gl_FragColor = texture2D(uTexture, vUv);\n }\n "),F=S(E.FRAGMENT_SHADER,"\n precision mediump float;\n precision mediump sampler2D;\n varying highp vec2 vUv;\n uniform sampler2D uTexture;\n uniform float value;\n\n void main () {\n gl_FragColor = value * texture2D(uTexture, vUv);\n }\n "),P=S(E.FRAGMENT_SHADER,"\n precision highp float;\n precision highp sampler2D;\n varying vec2 vUv;\n uniform sampler2D uTarget;\n uniform float aspectRatio;\n uniform vec3 color;\n uniform vec2 point;\n uniform float radius;\n\n void main () {\n vec2 p = vUv - point.xy;\n p.x *= aspectRatio;\n vec3 splat = exp(-dot(p, p) / radius) * color;\n vec3 base = texture2D(uTarget, vUv).xyz;\n gl_FragColor = vec4(base + splat, 1.0);\n }\n "),L=S(E.FRAGMENT_SHADER,"\n precision highp float;\n precision highp sampler2D;\n varying vec2 vUv;\n uniform sampler2D uVelocity;\n uniform sampler2D uSource;\n uniform vec2 texelSize;\n uniform vec2 dyeTexelSize;\n uniform float dt;\n uniform float dissipation;\n\n vec4 bilerp (sampler2D sam, vec2 uv, vec2 tsize) {\n vec2 st = uv / tsize - 0.5;\n vec2 iuv = floor(st);\n vec2 fuv = fract(st);\n\n vec4 a = texture2D(sam, (iuv + vec2(0.5, 0.5)) * tsize);\n vec4 b = texture2D(sam, (iuv + vec2(1.5, 0.5)) * tsize);\n vec4 c = texture2D(sam, (iuv + vec2(0.5, 1.5)) * tsize);\n vec4 d = texture2D(sam, (iuv + vec2(1.5, 1.5)) * tsize);\n\n return mix(mix(a, b, fuv.x), mix(c, d, fuv.x), fuv.y);\n }\n\n void main () {\n #ifdef MANUAL_FILTERING\n vec2 coord = vUv - dt * bilerp(uVelocity, vUv, texelSize).xy * texelSize;\n vec4 result = bilerp(uSource, coord, dyeTexelSize);\n #else\n vec2 coord = vUv - dt * texture2D(uVelocity, vUv).xy * texelSize;\n vec4 result = texture2D(uSource, coord);\n #endif\n float decay = 1.0 + dissipation * dt;\n gl_FragColor = result / decay;\n }\n ",R.supportLinearFiltering?null:["MANUAL_FILTERING"]),z=S(E.FRAGMENT_SHADER,"\n precision mediump float;\n precision mediump sampler2D;\n varying highp vec2 vUv;\n varying highp vec2 vL;\n varying highp vec2 vR;\n varying highp vec2 vT;\n varying highp vec2 vB;\n uniform sampler2D uVelocity;\n\n void main () {\n float L = texture2D(uVelocity, vL).x;\n float R = texture2D(uVelocity, vR).x;\n float T = texture2D(uVelocity, vT).y;\n float B = texture2D(uVelocity, vB).y;\n\n vec2 C = texture2D(uVelocity, vUv).xy;\n if (vL.x < 0.0) { L = -C.x; }\n if (vR.x > 1.0) { R = -C.x; }\n if (vT.y > 1.0) { T = -C.y; }\n if (vB.y < 0.0) { B = -C.y; }\n\n float div = 0.5 * (R - L + T - B);\n gl_FragColor = vec4(div, 0.0, 0.0, 1.0);\n }\n "),U=S(E.FRAGMENT_SHADER,"\n precision mediump float;\n precision mediump sampler2D;\n varying highp vec2 vUv;\n varying highp vec2 vL;\n varying highp vec2 vR;\n varying highp vec2 vT;\n varying highp vec2 vB;\n uniform sampler2D uVelocity;\n\n void main () {\n float L = texture2D(uVelocity, vL).y;\n float R = texture2D(uVelocity, vR).y;\n float T = texture2D(uVelocity, vT).x;\n float B = texture2D(uVelocity, vB).x;\n float vorticity = R - L - T + B;\n gl_FragColor = vec4(0.5 * vorticity, 0.0, 0.0, 1.0);\n }\n "),B=S(E.FRAGMENT_SHADER,"\n precision highp float;\n precision highp sampler2D;\n varying vec2 vUv;\n varying vec2 vL;\n varying vec2 vR;\n varying vec2 vT;\n varying vec2 vB;\n uniform sampler2D uVelocity;\n uniform sampler2D uCurl;\n uniform float curl;\n uniform float dt;\n\n void main () {\n float L = texture2D(uCurl, vL).x;\n float R = texture2D(uCurl, vR).x;\n float T = texture2D(uCurl, vT).x;\n float B = texture2D(uCurl, vB).x;\n float C = texture2D(uCurl, vUv).x;\n\n vec2 force = 0.5 * vec2(abs(T) - abs(B), abs(R) - abs(L));\n force /= length(force) + 0.0001;\n force *= curl * C;\n force.y *= -1.0;\n\n vec2 velocity = texture2D(uVelocity, vUv).xy;\n velocity += force * dt;\n velocity = min(max(velocity, -1000.0), 1000.0);\n gl_FragColor = vec4(velocity, 0.0, 1.0);\n }\n "),N=S(E.FRAGMENT_SHADER,"\n precision mediump float;\n precision mediump sampler2D;\n varying highp vec2 vUv;\n varying highp vec2 vL;\n varying highp vec2 vR;\n varying highp vec2 vT;\n varying highp vec2 vB;\n uniform sampler2D uPressure;\n uniform sampler2D uDivergence;\n\n void main () {\n float L = texture2D(uPressure, vL).x;\n float R = texture2D(uPressure, vR).x;\n float T = texture2D(uPressure, vT).x;\n float B = texture2D(uPressure, vB).x;\n float C = texture2D(uPressure, vUv).x;\n float divergence = texture2D(uDivergence, vUv).x;\n float pressure = (L + R + B + T - divergence) * 0.25;\n gl_FragColor = vec4(pressure, 0.0, 0.0, 1.0);\n }\n "),M=S(E.FRAGMENT_SHADER,"\n precision mediump float;\n precision mediump sampler2D;\n varying highp vec2 vUv;\n varying highp vec2 vL;\n varying highp vec2 vR;\n varying highp vec2 vT;\n varying highp vec2 vB;\n uniform sampler2D uPressure;\n uniform sampler2D uVelocity;\n\n void main () {\n float L = texture2D(uPressure, vL).x;\n float R = texture2D(uPressure, vR).x;\n float T = texture2D(uPressure, vT).x;\n float B = texture2D(uPressure, vB).x;\n vec2 velocity = texture2D(uVelocity, vUv).xy;\n velocity.xy -= vec2(R - L, T - B);\n gl_FragColor = vec4(velocity, 0.0, 1.0);\n }\n "),I=(()=>{let e=E.createBuffer();E.bindBuffer(E.ARRAY_BUFFER,e),E.bufferData(E.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),E.STATIC_DRAW);let n=E.createBuffer();return E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,n),E.bufferData(E.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),E.STATIC_DRAW),E.vertexAttribPointer(0,2,E.FLOAT,!1,0,0),E.enableVertexAttribArray(0),function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];E&&(e?(E.viewport(0,0,e.width,e.height),E.bindFramebuffer(E.FRAMEBUFFER,e.fbo)):(E.viewport(0,0,E.drawingBufferWidth,E.drawingBufferHeight),E.bindFramebuffer(E.FRAMEBUFFER,null)),n&&(E.clearColor(0,0,0,1),E.clear(E.COLOR_BUFFER_BIT)),E.drawElements(E.TRIANGLES,6,E.UNSIGNED_SHORT,0))}})(),X=new _(D,C),O=new _(D,F),G=new _(D,P),Y=new _(D,L),V=new _(D,z),H=new _(D,U),k=new _(D,B),j=new _(D,N),W=new _(D,M),q=new A(D,"\n precision highp float;\n precision highp sampler2D;\n varying vec2 vUv;\n varying vec2 vL;\n varying vec2 vR;\n varying vec2 vT;\n varying vec2 vB;\n uniform sampler2D uTexture;\n uniform sampler2D uDithering;\n uniform vec2 ditherScale;\n uniform vec2 texelSize;\n\n vec3 linearToGamma (vec3 color) {\n color = max(color, vec3(0));\n return max(1.055 * pow(color, vec3(0.416666667)) - 0.055, vec3(0));\n }\n\n void main () {\n vec3 c = texture2D(uTexture, vUv).rgb;\n #ifdef SHADING\n vec3 lc = texture2D(uTexture, vL).rgb;\n vec3 rc = texture2D(uTexture, vR).rgb;\n vec3 tc = texture2D(uTexture, vT).rgb;\n vec3 bc = texture2D(uTexture, vB).rgb;\n\n float dx = length(rc) - length(lc);\n float dy = length(tc) - length(bc);\n\n vec3 n = normalize(vec3(dx, dy, length(texelSize)));\n vec3 l = vec3(0.0, 0.0, 1.0);\n\n float diffuse = clamp(dot(n, l) + 0.7, 0.7, 1.0);\n c *= diffuse;\n #endif\n\n float a = max(c.r, max(c.g, c.b));\n gl_FragColor = vec4(c, a);\n }\n ");function K(e,n,t,r,i,o){E.activeTexture(E.TEXTURE0);let a=E.createTexture();E.bindTexture(E.TEXTURE_2D,a),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,o),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,o),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.texImage2D(E.TEXTURE_2D,0,t,e,n,0,r,i,null);let u=E.createFramebuffer();E.bindFramebuffer(E.FRAMEBUFFER,u),E.framebufferTexture2D(E.FRAMEBUFFER,E.COLOR_ATTACHMENT0,E.TEXTURE_2D,a,0),E.viewport(0,0,e,n),E.clear(E.COLOR_BUFFER_BIT);let l=1/e,s=1/n;return{texture:a,fbo:u,width:e,height:n,texelSizeX:l,texelSizeY:s,attach:e=>(E.activeTexture(E.TEXTURE0+e),E.bindTexture(E.TEXTURE_2D,a),e)}}function Q(e,n,t,r,i,o){let a=K(e,n,t,r,i,o),u=K(e,n,t,r,i,o);return{width:e,height:n,texelSizeX:a.texelSizeX,texelSizeY:a.texelSizeY,read:a,write:u,swap(){let e=this.read;this.read=this.write,this.write=e}}}function $(e,n,t,r,i,o,a){return e.width===n&&e.height===t||(e.read=function(e,n,t,r,i,o,a){let u=K(n,t,r,i,o,a);return X.bind(),X.uniforms.uTexture&&E.uniform1i(X.uniforms.uTexture,e.attach(0)),I(u,!1),u}(e.read,n,t,r,i,o,a),e.write=K(n,t,r,i,o,a),e.width=n,e.height=t,e.texelSizeX=1/n,e.texelSizeY=1/t),e}function J(){let n=Z(T.SIM_RESOLUTION),t=Z(T.DYE_RESOLUTION),a=R.halfFloatTexType,u=R.formatRGBA,l=R.formatRG,s=R.formatR,c=R.supportLinearFiltering?E.LINEAR:E.NEAREST;E.disable(E.BLEND),e=e?$(e,t.width,t.height,u.internalFormat,u.format,a,c):Q(t.width,t.height,u.internalFormat,u.format,a,c),r=r?$(r,n.width,n.height,l.internalFormat,l.format,a,c):Q(n.width,n.height,l.internalFormat,l.format,a,c),i=K(n.width,n.height,s.internalFormat,s.format,a,E.NEAREST),o=K(n.width,n.height,s.internalFormat,s.format,a,E.NEAREST),h=Q(n.width,n.height,s.internalFormat,s.format,a,E.NEAREST)}function Z(e){let n=E.drawingBufferWidth,t=E.drawingBufferHeight,r=n/t,i=Math.round(e),o=Math.round(e*(r<1?1/r:r));return n>t?{width:o,height:i}:{width:i,height:o}}function ee(e){return Math.floor(e*(window.devicePixelRatio||1))}let en=[];T.SHADING&&en.push("SHADING"),q.setKeywords(en),J();let et=Date.now(),er=0;function ei(){var n;let t=function(){let e=Date.now(),n=(e-et)/1e3;return n=Math.min(n,.016666),et=e,n}();(function(){let e=ee(x.clientWidth),n=ee(x.clientHeight);return(x.width!==e||x.height!==n)&&(x.width=e,x.height=n,!0)})()&&J(),(er+=t*T.COLOR_UPDATE_SPEED)>=1&&(er=function(e,n,t){let r=1;return 0===r?n:(e-n)%r+n}(er,0,1),p.forEach(e=>{e.color=el()})),function(){for(let e of p)e.moved&&(e.moved=!1,function(e){let n=e.deltaX*T.SPLAT_FORCE,t=e.deltaY*T.SPLAT_FORCE;eo(e.texcoordX,e.texcoordY,n,t,e.color)}(e))}(),function(n){E.disable(E.BLEND),H.bind(),H.uniforms.texelSize&&E.uniform2f(H.uniforms.texelSize,r.texelSizeX,r.texelSizeY),H.uniforms.uVelocity&&E.uniform1i(H.uniforms.uVelocity,r.read.attach(0)),I(o),k.bind(),k.uniforms.texelSize&&E.uniform2f(k.uniforms.texelSize,r.texelSizeX,r.texelSizeY),k.uniforms.uVelocity&&E.uniform1i(k.uniforms.uVelocity,r.read.attach(0)),k.uniforms.uCurl&&E.uniform1i(k.uniforms.uCurl,o.attach(1)),k.uniforms.curl&&E.uniform1f(k.uniforms.curl,T.CURL),k.uniforms.dt&&E.uniform1f(k.uniforms.dt,n),I(r.write),r.swap(),V.bind(),V.uniforms.texelSize&&E.uniform2f(V.uniforms.texelSize,r.texelSizeX,r.texelSizeY),V.uniforms.uVelocity&&E.uniform1i(V.uniforms.uVelocity,r.read.attach(0)),I(i),O.bind(),O.uniforms.uTexture&&E.uniform1i(O.uniforms.uTexture,h.read.attach(0)),O.uniforms.value&&E.uniform1f(O.uniforms.value,T.PRESSURE),I(h.write),h.swap(),j.bind(),j.uniforms.texelSize&&E.uniform2f(j.uniforms.texelSize,r.texelSizeX,r.texelSizeY),j.uniforms.uDivergence&&E.uniform1i(j.uniforms.uDivergence,i.attach(0));for(let e=0;e<T.PRESSURE_ITERATIONS;e++)j.uniforms.uPressure&&E.uniform1i(j.uniforms.uPressure,h.read.attach(1)),I(h.write),h.swap();W.bind(),W.uniforms.texelSize&&E.uniform2f(W.uniforms.texelSize,r.texelSizeX,r.texelSizeY),W.uniforms.uPressure&&E.uniform1i(W.uniforms.uPressure,h.read.attach(0)),W.uniforms.uVelocity&&E.uniform1i(W.uniforms.uVelocity,r.read.attach(1)),I(r.write),r.swap(),Y.bind(),Y.uniforms.texelSize&&E.uniform2f(Y.uniforms.texelSize,r.texelSizeX,r.texelSizeY),!R.supportLinearFiltering&&Y.uniforms.dyeTexelSize&&E.uniform2f(Y.uniforms.dyeTexelSize,r.texelSizeX,r.texelSizeY);let t=r.read.attach(0);Y.uniforms.uVelocity&&E.uniform1i(Y.uniforms.uVelocity,t),Y.uniforms.uSource&&E.uniform1i(Y.uniforms.uSource,t),Y.uniforms.dt&&E.uniform1f(Y.uniforms.dt,n),Y.uniforms.dissipation&&E.uniform1f(Y.uniforms.dissipation,T.VELOCITY_DISSIPATION),I(r.write),r.swap(),!R.supportLinearFiltering&&Y.uniforms.dyeTexelSize&&E.uniform2f(Y.uniforms.dyeTexelSize,e.texelSizeX,e.texelSizeY),Y.uniforms.uVelocity&&E.uniform1i(Y.uniforms.uVelocity,r.read.attach(0)),Y.uniforms.uSource&&E.uniform1i(Y.uniforms.uSource,e.read.attach(1)),Y.uniforms.dissipation&&E.uniform1f(Y.uniforms.dissipation,T.DENSITY_DISSIPATION),I(e.write),e.swap()}(t),n=null,E.blendFunc(E.ONE,E.ONE_MINUS_SRC_ALPHA),E.enable(E.BLEND),function(n){let t=n?n.width:E.drawingBufferWidth,r=n?n.height:E.drawingBufferHeight;q.bind(),T.SHADING&&q.uniforms.texelSize&&E.uniform2f(q.uniforms.texelSize,1/t,1/r),q.uniforms.uTexture&&E.uniform1i(q.uniforms.uTexture,e.read.attach(0)),I(n,!1)}(null),requestAnimationFrame(ei)}function eo(n,t,i,o,a){G.bind(),G.uniforms.uTarget&&E.uniform1i(G.uniforms.uTarget,r.read.attach(0)),G.uniforms.aspectRatio&&E.uniform1f(G.uniforms.aspectRatio,x.width/x.height),G.uniforms.point&&E.uniform2f(G.uniforms.point,n,t),G.uniforms.color&&E.uniform3f(G.uniforms.color,i,o,0),G.uniforms.radius&&E.uniform1f(G.uniforms.radius,function(e){let n=x.width/x.height;return n>1&&(e*=n),e}(T.SPLAT_RADIUS/100)),I(r.write),r.swap(),G.uniforms.uTarget&&E.uniform1i(G.uniforms.uTarget,e.read.attach(0)),G.uniforms.color&&E.uniform3f(G.uniforms.color,a.r,a.g,a.b),I(e.write),e.swap()}function ea(e,n,t,r){e.id=n,e.down=!0,e.moved=!1,e.texcoordX=t/x.width,e.texcoordY=1-r/x.height,e.prevTexcoordX=e.texcoordX,e.prevTexcoordY=e.texcoordY,e.deltaX=0,e.deltaY=0,e.color=el()}function eu(e,n,t,r){e.prevTexcoordX=e.texcoordX,e.prevTexcoordY=e.texcoordY,e.texcoordX=n/x.width,e.texcoordY=1-t/x.height,e.deltaX=function(e){let n=x.width/x.height;return n<1&&(e*=n),e}(e.texcoordX-e.prevTexcoordX),e.deltaY=function(e){let n=x.width/x.height;return n>1&&(e/=n),e}(e.texcoordY-e.prevTexcoordY),e.moved=Math.abs(e.deltaX)>0||Math.abs(e.deltaY)>0,e.color=r}function el(){let e=function(e,n,t){let r=0,i=0,o=0,a=Math.floor(6*e),u=6*e-a,l=0,s=t*(1-u*n),c=t*(1-(1-u)*n);switch(a%6){case 0:r=t,i=c,o=l;break;case 1:r=s,i=t,o=l;break;case 2:r=l,i=t,o=c;break;case 3:r=l,i=s,o=t;break;case 4:r=c,i=l,o=t;break;case 5:r=t,i=l,o=s}return{r,g:i,b:o}}(Math.random(),1,1);return e.r*=.15,e.g*=.15,e.b*=.15,e}window.addEventListener("mousedown",e=>{let n=p[0];ea(n,-1,ee(e.clientX),ee(e.clientY));let t=el();t.r*=10,t.g*=10,t.b*=10;let r=10*(Math.random()-.5),i=30*(Math.random()-.5);eo(n.texcoordX,n.texcoordY,r,i,t)}),document.body.addEventListener("mousemove",function e(n){let t=p[0],r=ee(n.clientX),i=ee(n.clientY),o=el();ei(),eu(t,r,i,o),document.body.removeEventListener("mousemove",e)}),window.addEventListener("mousemove",e=>{let n=p[0],t=ee(e.clientX),r=ee(e.clientY),i=n.color;eu(n,t,r,i)}),document.body.addEventListener("touchstart",function e(n){let t=n.targetTouches,r=p[0];for(let e=0;e<t.length;e++){let n=ee(t[e].clientX),i=ee(t[e].clientY);ei(),ea(r,t[e].identifier,n,i)}document.body.removeEventListener("touchstart",e)}),window.addEventListener("touchstart",e=>{let n=e.targetTouches,t=p[0];for(let e=0;e<n.length;e++){let r=ee(n[e].clientX),i=ee(n[e].clientY);ea(t,n[e].identifier,r,i)}},!1),window.addEventListener("touchmove",e=>{let n=e.targetTouches,t=p[0];for(let e=0;e<n.length;e++)eu(t,ee(n[e].clientX),ee(n[e].clientY),t.color)},!1),window.addEventListener("touchend",e=>{let n=e.changedTouches,t=p[0];for(let e=0;e<n.length;e++)t.down=!1})},[n,t,o,a,u,l,s,c,v,f,m,d,h,x]),(0,r.jsx)("div",{style:{position:"fixed",top:0,left:0,zIndex:50,pointerEvents:"none",width:"100%",height:"100%"},children:(0,r.jsx)("canvas",{ref:g,id:"fluid",style:{width:"100vw",height:"100vh",display:"block"}})})}},8942:(e,n,t)=>{"use strict";t.d(n,{cn:()=>o});var r=t(4534),i=t(9862);function o(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];return(0,i.QP)((0,r.$)(n))}}},e=>{var n=n=>e(e.s=n);e.O(0,[295,476,551,309,951,358],()=>n(8438)),_N_E=e.O()}]); |