1import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./compiler-runtime-DPI-XUKY.js";var i=e(t(),1);function a(e){return[(e>>16&255)/255,(e>>8&255)/255,(255&e)/255]}[`SCREEN`,`LINEAR_LIGHT`].reduce((e,t,n)=>Object.assign(e,{[t]:n}),{});var o=class{constructor(e,t,n,r=!1){let i=this,a=document.location.search.toLowerCase().indexOf(`debug=webgl`)!==-1;i.canvas=e,i.gl=i.canvas.getContext(`webgl`,{antialias:!0}),i.meshes=[];let o=i.gl;if(!o)throw Error(`uvcanvas: WebGL context unavailable`);t&&n&&this.setSize(t,n),i.lastDebugMsg,i.debug=r&&a?function(e){let t=new Date;t-i.lastDebugMsg>1e3&&console.log(`---`),console.log(t.toLocaleTimeString()+Array(Math.max(0,32-e.length)).join(` `)+e+`: `,...Array.from(arguments).slice(1)),i.lastDebugMsg=t}:()=>{},Object.defineProperties(i,{Material:{enumerable:!1,value:class{constructor(e,t,n={}){let r=this;function a(e,t){let n=o.createShader(e);return o.shaderSource(n,t),o.compileShader(n),o.getShaderParameter(n,o.COMPILE_STATUS)||console.error(o.getShaderInfoLog(n)),i.debug(`Material.compileShaderSource`,{source:t}),n}function s(e,t){return Object.entries(e).map(([e,n])=>n.getDeclaration(e,t)).join(` 2`)}r.uniforms=n,r.uniformInstances=[];let c=` 3 precision highp float; 4 `;r.vertexSource=`\n ${c}\n attribute vec4 position;\n attribute vec2 uv;\n attribute vec2 uvNorm;\n ${s(i.commonUniforms,`vertex`)}\n ${s(n,`vertex`)}\n ${e}\n `,r.Source=`\n ${c}\n ${s(i.commonUniforms,`fragment`)}\n ${s(n,`fragment`)}\n ${t}\n `,r.vertexShader=a(o.VERTEX_SHADER,r.vertexSource),r.fragmentShader=a(o.FRAGMENT_SHADER,r.Source),r.program=o.createProgram(),o.attachShader(r.program,r.vertexShader),o.attachShader(r.program,r.fragmentShader),o.linkProgram(r.program),o.getProgramParameter(r.program,o.LINK_STATUS)||console.error(o.getProgramInfoLog(r.program)),o.useProgram(r.program),r.attachUniforms(void 0,i.commonUniforms),r.attachUniforms(void 0,r.uniforms)}attachUniforms(e,t){let n=this;e===void 0?Object.entries(t).forEach(([e,t])=>{n.attachUniforms(e,t)}):t.type==`array`?t.value.forEach((t,r)=>n.attachUniforms(`${e}[${r}]`,t)):t.type==`struct`?Object.entries(t.value).forEach(([t,r])=>n.attachUniforms(`${e}.${t}`,r)):(i.debug(`Material.attachUniforms`,{name:e,uniform:t}),n.uniformInstances.push({uniform:t,location:o.getUniformLocation(n.program,e)}))}}},Uniform:{enumerable:!1,value:class{constructor(e){this.type=`float`,Object.assign(this,e),this.typeFn={float:`1f`,int:`1i`,vec2:`2fv`,vec3:`3fv`,vec4:`4fv`,mat4:`Matrix4fv`}[this.type]||`1f`,this.update()}update(e){this.value!==void 0&&o[`uniform${this.typeFn}`](e,this.typeFn.indexOf(`Matrix`)===0?this.transpose:this.value,this.typeFn.indexOf(`Matrix`)===0?this.value:null)}getDeclaration(e,t,n){let r=this;if(r.excludeFrom!==t){if(r.type===`array`)return r.value[0].getDeclaration(e,t,r.value.length)+`\nconst int ${e}_length = ${r.value.length};`;if(r.type===`struct`){let i=e.replace(`u_`,``);return i=i.charAt(0).toUpperCase()+i.slice(1),`uniform struct ${i} 5 {\n`+Object.entries(r.value).map(([e,n])=>n.getDeclaration(e,t).replace(/^uniform/,``)).join(``)+`\n} ${e}${n>0?`[${n}]`:``};`}return`uniform ${r.type} ${e}${n>0?`[${n}]`:``};`}}}},PlaneGeometry:{enumerable:!1,value:class{constructor(e,t,n,r,a){o.createBuffer(),this.attributes={position:new i.Attribute({target:o.ARRAY_BUFFER,size:3}),uv:new i.Attribute({target:o.ARRAY_BUFFER,size:2}),uvNorm:new i.Attribute({target:o.ARRAY_BUFFER,size:2}),index:new i.Attribute({target:o.ELEMENT_ARRAY_BUFFER,size:3,type:o.UNSIGNED_SHORT})},this.setTopology(n,r),this.setSize(e,t,a)}setTopology(e=1,t=1){let n=this;n.xSegCount=e,n.ySegCount=t,n.vertexCount=(n.xSegCount+1)*(n.ySegCount+1),n.quadCount=n.xSegCount*n.ySegCount*2,n.attributes.uv.values=new Float32Array(2*n.vertexCount),n.attributes.uvNorm.values=new Float32Array(2*n.vertexCount),n.attributes.index.values=new Uint16Array(3*n.quadCount);for(let e=0;e<=n.ySegCount;e++)for(let t=0;t<=n.xSegCount;t++){let r=e*(n.xSegCount+1)+t;if(n.attributes.uv.values[2*r]=t/n.xSegCount,n.attributes.uv.values[2*r+1]=1-e/n.ySegCount,n.attributes.uvNorm.values[2*r]=t/n.xSegCount*2-1,n.attributes.uvNorm.values[2*r+1]=1-e/n.ySegCount*2,t<n.xSegCount&&e<n.ySegCount){let i=e*n.xSegCount+t;n.attributes.index.values[6*i]=r,n.attributes.index.values[6*i+1]=r+1+n.xSegCount,n.attributes.index.values[6*i+2]=r+1,n.attributes.index.values[6*i+3]=r+1,n.attributes.index.values[6*i+4]=r+1+n.xSegCount,n.attributes.index.values[6*i+5]=r+2+n.xSegCount}}
5n.attributes.uv.update(),n.attributes.uvNorm.update(),n.attributes.index.update(),i.debug(`Geometry.setTopology`,{uv:n.attributes.uv,uvNorm:n.attributes.uvNorm,index:n.attributes.index})}setSize(e=1,t=1,n=`xz`){let r=this;r.width=e,r.height=t,r.orientation=n,r.attributes.position.values&&r.attributes.position.values.length===3*r.vertexCount||(r.attributes.position.values=new Float32Array(3*r.vertexCount));let a=e/-2,o=t/-2,s=e/r.xSegCount,c=t/r.ySegCount;for(let e=0;e<=r.ySegCount;e++){let t=o+e*c;for(let i=0;i<=r.xSegCount;i++){let o=a+i*s,c=e*(r.xSegCount+1)+i;r.attributes.position.values[3*c+`xyz`.indexOf(n[0])]=o,r.attributes.position.values[3*c+`xyz`.indexOf(n[1])]=-t}}r.attributes.position.update(),i.debug(`Geometry.setSize`,{position:r.attributes.position})}}},Mesh:{enumerable:!1,value:class{constructor(e,t){let n=this;n.geometry=e,n.material=t,n.wireframe=!1,n.attributeInstances=[],Object.entries(n.geometry.attributes).forEach(([e,t])=>{n.attributeInstances.push({attribute:t,location:t.attach(e,n.material.program)})}),i.meshes.push(n),i.debug(`Mesh.constructor`,{mesh:n})}draw(){o.useProgram(this.material.program),this.material.uniformInstances.forEach(({uniform:e,location:t})=>e.update(t)),this.attributeInstances.forEach(({attribute:e,location:t})=>e.use(t)),o.drawElements(this.wireframe?o.LINES:o.TRIANGLES,this.geometry.attributes.index.values.length,o.UNSIGNED_SHORT,0)}remove(){i.meshes=i.meshes.filter(e=>e!=this)}}},Attribute:{enumerable:!1,value:class{constructor(e){this.type=o.FLOAT,this.normalized=!1,this.buffer=o.createBuffer(),Object.assign(this,e),this.update()}update(){this.values!==void 0&&(o.bindBuffer(this.target,this.buffer),o.bufferData(this.target,this.values,o.STATIC_DRAW))}attach(e,t){let n=o.getAttribLocation(t,e);return this.target===o.ARRAY_BUFFER&&(o.enableVertexAttribArray(n),o.vertexAttribPointer(n,this.size,this.type,this.normalized,0,0)),n}use(e){o.bindBuffer(this.target,this.buffer),this.target===o.ARRAY_BUFFER&&(o.enableVertexAttribArray(e),o.vertexAttribPointer(e,this.size,this.type,this.normalized,0,0))}}}});let s=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];i.commonUniforms={projectionMatrix:new i.Uniform({type:`mat4`,value:s}),modelViewMatrix:new i.Uniform({type:`mat4`,value:s}),resolution:new i.Uniform({type:`vec2`,value:[1,1]}),aspectRatio:new i.Uniform({type:`float`,value:1})}}setSize(e=640,t=480){this.width=e,this.height=t,this.canvas.width=e,this.canvas.height=t,this.gl.viewport(0,0,e,t),this.commonUniforms.resolution.value=[e,t],this.commonUniforms.aspectRatio.value=e/t,this.debug(`MiniGL.setSize`,{width:e,height:t})}setOrthographicCamera(e=0,t=0,n=0,r=-2e3,i=2e3){this.commonUniforms.projectionMatrix.value=[2/this.width,0,0,0,0,2/this.height,0,0,0,0,2/(r-i),0,e,t,n,1],this.debug(`setOrthographicCamera`,this.commonUniforms.projectionMatrix.value)}render(){this.gl.clearColor(0,0,0,0),this.gl.clearDepth(1),this.meshes.forEach(e=>e.draw())}};function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=class{constructor(){s(this,`el`,void 0),s(this,`gradientColors`,void 0),s(this,`cssVarRetries`,0),s(this,`maxCssVarRetries`,200),s(this,`angle`,0),s(this,`isLoadedClass`,!1),s(this,`isScrolling`,!1),s(this,`scrollingTimeout`,void 0),s(this,`scrollingRefreshDelay`,200),s(this,`isIntersecting`,!1),s(this,`shaderFiles`,void 0),s(this,`vertexShader`,void 0),s(this,`sectionColors`,void 0),s(this,`conf`,void 0),s(this,`uniforms`,void 0),s(this,`t`,1253106),s(this,`last`,0),s(this,`width`,void 0),s(this,`minWidth`,1111),s(this,`height`,void 0),s(this,`minHeight`,1111),s(this,`xSegCount`,void 0),s(this,`ySegCount`,void 0),s(this,`mesh`,void 0),s(this,`material`,void 0),s(this,`geometry`,void 0),s(this,`minigl`,void 0),s(this,`scrollObserver`,void 0),s(this,`amp`,320),s(this,`seed`,5),s(this,`freqX`,14e-5),s(this,`freqY`,29e-5),s(this,`freqDelta`,1e-5),s(this,`activeColors`,[1,1,1,1]),s(this,`isMetaKey`,!1),s(this,`isGradientLegendVisible`,!1),s(this,`isMouseDown`,!1),s(this,`handleScroll`,()=>{clearTimeout(this.scrollingTimeout),this.scrollingTimeout=setTimeout(this.handleScrollEnd,this.scrollingRefreshDelay),this.isGradientLegendVisible&&this.hideGradientLegend(),this.conf.playing&&(this.isScrolling=!0,this.pause())}),s(this,`handleScrollEnd`,()=>{this.isScrolling=!1,this.isIntersecting&&this.play()}),s(this,`resize`,()=>{this.width=window.innerWidth,this.height=window.innerHeight,this.minigl.setSize(this.width,this.height),this.minigl.setOrthogra
5phicCamera(),this.xSegCount=Math.ceil(this.width*this.conf.density[0]),this.ySegCount=Math.ceil(this.height*this.conf.density[1]),this.mesh.geometry.setTopology(this.xSegCount,this.ySegCount),this.mesh.geometry.setSize(this.width,this.height),this.mesh.material.uniforms.u_shadow_power.value=this.width<600?5:6}),s(this,`animate`,e=>{if(!this.shouldSkipFrame(e)||this.isMouseDown){if(this.t+=Math.min(e-this.last,1e3/15),this.last=e,this.isMouseDown){let e=160;this.isMetaKey&&(e=-160),this.t+=e}this.mesh.material.uniforms.u_time.value=this.t,this.minigl.render()}if(this.last!==0&&this.isStatic)return this.minigl.render(),void this.disconnect();(this.conf.playing||this.isMouseDown)&&requestAnimationFrame(this.animate)}),s(this,`addIsLoadedClass`,()=>{!this.isLoadedClass&&(this.isLoadedClass=!0,this.el.classList.add(`isLoaded`))}),s(this,`pause`,()=>{this.conf.playing=!1}),s(this,`play`,()=>{requestAnimationFrame(this.animate),this.conf.playing=!0}),s(this,`initGradient`,e=>{let{el:t,gradientColors:n=[]}=e||{};return this.el=t||document.createElement(`canvas`),this.gradientColors=n,this.connect().catch(e=>{this.onError?.(e)}),this})}async connect(){this.shaderFiles={vertex:`varying vec3 v_color; 6 7void main() { 8 float time = u_time * u_global.noiseSpeed; 9 10 vec2 noiseCoord = resolution * uvNorm * u_global.noiseFreq; 11 12 vec2 st = 1. - uvNorm.xy; 13 14 // 15 // Tilting the plane 16 // 17 18 // Front-to-back tilt 19 float tilt = resolution.y / 2.0 * uvNorm.y; 20 21 // Left-to-right angle 22 float incline = resolution.x * uvNorm.x / 2.0 * u_vertDeform.incline; 23 24 // Up-down shift to offset incline 25 float offset = resolution.x / 2.0 * u_vertDeform.incline * mix(u_vertDeform.offsetBottom, u_vertDeform.offsetTop, uv.y); 26 27 // 28 // Vertex noise 29 // 30 31 float noise = snoise(vec3( 32 noiseCoord.x * u_vertDeform.noiseFreq.x + time * u_vertDeform.noiseFlow, 33 noiseCoord.y * u_vertDeform.noiseFreq.y, 34 time * u_vertDeform.noiseSpeed + u_vertDeform.noiseSeed 35 )) * u_vertDeform.noiseAmp; 36 37 // Fade noise to zero at edges 38 noise *= 1.0 - pow(abs(uvNorm.y), 2.0); 39 40 // Clamp to 0 41 noise = max(0.0, noise); 42 43 vec3 pos = vec3( 44 position.x, 45 position.y + tilt + incline + noise - offset, 46 position.z 47 ); 48 49 // 50 // Vertex color, to be passed to fragment shader 51 // 52 53 if (u_active_colors[0] == 1.) { 54 v_color = u_baseColor; 55 } 56 57 for (int i = 0; i < u_waveLayers_length; i++) { 58 if (u_active_colors[i + 1] == 1.) { 59 WaveLayers layer = u_waveLayers[i]; 60 61 float noise = smoothstep( 62 layer.noiseFloor, 63 layer.noiseCeil, 64 snoise(vec3( 65 noiseCoord.x * layer.noiseFreq.x + time * layer.noiseFlow, 66 noiseCoord.y * layer.noiseFreq.y, 67 time * layer.noiseSpeed + layer.noiseSeed 68 )) / 2.0 + 0.5 69 ); 70 71 v_color = blendNormal(v_color, layer.color, pow(noise, 4.)); 72 } 73 } 74 75 // 76 // Finish 77 // 78 79 gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0); 80}`,noise:`// 81// Description : Array and textureless GLSL 2D/3D/4D simplex 82// noise functions. 83// Author : Ian McEwan, Ashima Arts. 84// Maintainer : stegu 85// Lastmod : 20110822 (ijm) 86// License : Copyright (C) 2011 Ashima Arts. All rights reserved. 87// Distributed under the MIT License. See LICENSE file. 88// https://github.com/ashima/webgl-noise 89// https://github.com/stegu/webgl-noise 90// 91 92vec3 mod289(vec3 x) { 93 return x - floor(x * (1.0 / 289.0)) * 289.0; 94} 95 96vec4 mod289(vec4 x) { 97 return x - floor(x * (1.0 / 289.0)) * 289.0; 98} 99 100vec4 permute(vec4 x) { 101 return mod289(((x*34.0)+1.0)*x); 102} 103 104vec4 taylorInvSqrt(vec4 r) 105{ 106 return 1.79284291400159 - 0.85373472095314 * r; 107} 108 109float snoise(vec3 v) 110{ 111 const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; 112 const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); 113 114// First corner 115 vec3 i = floor(v + dot(v, C.yyy) ); 116 vec3 x0 = v - i + dot(i, C.xxx) ; 117 118// Other corners 119 vec3 g = step(x0.yzx, x0.xyz); 120 vec3 l = 1.0 - g; 121 vec3 i1 = min( g.xyz, l.zxy ); 122 vec3 i2 = max( g.xyz, l.zxy ); 123 124 // x0 = x0 - 0.0 + 0.0 * C.xxx; 125 // x1 = x0 - i1 + 1.0 * C.xxx; 126 // x2 = x0 - i2 + 2.0 * C.xxx; 127 // x3 = x0 - 1.0 + 3.0 * C.xxx; 128 vec3 x1 = x0 - i1 + C.xxx; 129 vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y 130 vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y 131 132// Permutations 133 i = mod289(i); 134 vec4 p = permute( permute( permute( 135 i.z + vec4(0.0, i1.z, i2.z, 1.0 )) 136 + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 137 + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); 138 139// Gradients: 7x7 points over a square, mapped onto an octahedron. 140// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) 141 float n_ = 0.142857142857; // 1.0/7.0 142 vec3 ns = n_ * D.wyz - D.xzx; 143 144 vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7) 145 146 vec4 x_ = floor(j * ns.z); 147 vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) 148 149 vec4 x = x_ *ns.x + ns.yyyy; 150 vec4 y = y_ *ns.x + ns.yyyy; 151 vec4 h = 1.0 - abs(x) - abs(y); 152 153 vec4 b0 = vec4( x.xy, y.xy ); 154 vec4 b1 = vec4( x.zw, y.zw ); 155
156 //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0; 157 //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0; 158 vec4 s0 = floor(b0)*2.0 + 1.0; 159 vec4 s1 = floor(b1)*2.0 + 1.0; 160 vec4 sh = -step(h, vec4(0.0)); 161 162 vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; 163 vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; 164 165 vec3 p0 = vec3(a0.xy,h.x); 166 vec3 p1 = vec3(a0.zw,h.y); 167 vec3 p2 = vec3(a1.xy,h.z); 168 vec3 p3 = vec3(a1.zw,h.w); 169 170//Normalise gradients 171 vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); 172 p0 *= norm.x; 173 p1 *= norm.y; 174 p2 *= norm.z; 175 p3 *= norm.w; 176 177// Mix final noise value 178 vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); 179 m = m * m; 180 return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 181 dot(p2,x2), dot(p3,x3) ) ); 182}`,blend:`// 183// https://github.com/jamieowen/glsl-blend 184// 185 186// Normal 187 188vec3 blendNormal(vec3 base, vec3 blend) { 189 return blend; 190} 191 192vec3 blendNormal(vec3 base, vec3 blend, float opacity) { 193 return (blendNormal(base, blend) * opacity + base * (1.0 - opacity)); 194} 195 196// Screen 197 198float blendScreen(float base, float blend) { 199 return 1.0-((1.0-base)*(1.0-blend)); 200} 201 202vec3 blendScreen(vec3 base, vec3 blend) { 203 return vec3(blendScreen(base.r,blend.r),blendScreen(base.g,blend.g),blendScreen(base.b,blend.b)); 204} 205 206vec3 blendScreen(vec3 base, vec3 blend, float opacity) { 207 return (blendScreen(base, blend) * opacity + base * (1.0 - opacity)); 208} 209 210// Multiply 211 212vec3 blendMultiply(vec3 base, vec3 blend) { 213 return base*blend; 214} 215 216vec3 blendMultiply(vec3 base, vec3 blend, float opacity) { 217 return (blendMultiply(base, blend) * opacity + base * (1.0 - opacity)); 218} 219 220// Overlay 221 222float blendOverlay(float base, float blend) { 223 return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend)); 224} 225 226vec3 blendOverlay(vec3 base, vec3 blend) { 227 return vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b)); 228} 229 230vec3 blendOverlay(vec3 base, vec3 blend, float opacity) { 231 return (blendOverlay(base, blend) * opacity + base * (1.0 - opacity)); 232} 233 234// Hard light 235 236vec3 blendHardLight(vec3 base, vec3 blend) { 237 return blendOverlay(blend,base); 238} 239 240vec3 blendHardLight(vec3 base, vec3 blend, float opacity) { 241 return (blendHardLight(base, blend) * opacity + base * (1.0 - opacity)); 242} 243 244// Soft light 245 246float blendSoftLight(float base, float blend) { 247 return (blend<0.5)?(2.0*base*blend+base*base*(1.0-2.0*blend)):(sqrt(base)*(2.0*blend-1.0)+2.0*base*(1.0-blend)); 248} 249 250vec3 blendSoftLight(vec3 base, vec3 blend) { 251 return vec3(blendSoftLight(base.r,blend.r),blendSoftLight(base.g,blend.g),blendSoftLight(base.b,blend.b)); 252} 253 254vec3 blendSoftLight(vec3 base, vec3 blend, float opacity) { 255 return (blendSoftLight(base, blend) * opacity + base * (1.0 - opacity)); 256} 257 258// Color dodge 259 260float blendColorDodge(float base, float blend) { 261 return (blend==1.0)?blend:min(base/(1.0-blend),1.0); 262} 263 264vec3 blendColorDodge(vec3 base, vec3 blend) { 265 return vec3(blendColorDodge(base.r,blend.r),blendColorDodge(base.g,blend.g),blendColorDodge(base.b,blend.b)); 266} 267 268vec3 blendColorDodge(vec3 base, vec3 blend, float opacity) { 269 return (blendColorDodge(base, blend) * opacity + base * (1.0 - opacity)); 270} 271 272// Color burn 273 274float blendColorBurn(float base, float blend) { 275 return (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0); 276} 277 278vec3 blendColorBurn(vec3 base, vec3 blend) { 279 return vec3(blendColorBurn(base.r,blend.r),blendColorBurn(base.g,blend.g),blendColorBurn(base.b,blend.b)); 280} 281 282vec3 blendColorBurn(vec3 base, vec3 blend, float opacity) { 283 return (blendColorBurn(base, blend) * opacity + base * (1.0 - opacity)); 284} 285 286// Vivid Light 287 288float blendVividLight(float base, float blend) { 289 return (blend<0.5)?blendColorBurn(base,(2.0*blend)):blendColorDodge(base,(2.0*(blend-0.5))); 290} 291 292vec3 blendVividLight(vec3 base, vec3 blend) { 293 return vec3(blendVividLight(base.r,blend.r),blendVividLight(base.g,blend.g),blendVividLight(base.b,blend.b)); 294} 295 296vec3 blendVividLight(vec3 base, vec3 blend, float opacity) { 297 return (blendVividLight(base, blend) * opacity + base * (1.0 - opacity)); 298} 299 300// Lighten 301 302float blendLighten(float base, float blend) { 303 return max(blend,base); 304} 305 306vec3 blendLighten(vec3 base, vec3 blend) { 307 return vec3(blendLighten(base.r,blend.r),blendLighten(base.g,blend.g),blendLighten(base.b,blend.b)); 308} 309 310vec3 blendLighten(vec3 base, vec3 blend, float opacity) { 311 return (blendLighten(base, blend) * opacity + base * (1.0 - opacity)); 312} 313 314// Linear burn 315 316float blendLinearBurn(float base, float blend) {
317 // Note : Same implementation as BlendSubtractf 318 return max(base+blend-1.0,0.0); 319} 320 321vec3 blendLinearBurn(vec3 base, vec3 blend) { 322 // Note : Same implementation as BlendSubtract 323 return max(base+blend-vec3(1.0),vec3(0.0)); 324} 325 326vec3 blendLinearBurn(vec3 base, vec3 blend, float opacity) { 327 return (blendLinearBurn(base, blend) * opacity + base * (1.0 - opacity)); 328} 329 330// Linear dodge 331 332float blendLinearDodge(float base, float blend) { 333 // Note : Same implementation as BlendAddf 334 return min(base+blend,1.0); 335} 336 337vec3 blendLinearDodge(vec3 base, vec3 blend) { 338 // Note : Same implementation as BlendAdd 339 return min(base+blend,vec3(1.0)); 340} 341 342vec3 blendLinearDodge(vec3 base, vec3 blend, float opacity) { 343 return (blendLinearDodge(base, blend) * opacity + base * (1.0 - opacity)); 344} 345 346// Linear light 347 348float blendLinearLight(float base, float blend) { 349 return blend<0.5?blendLinearBurn(base,(2.0*blend)):blendLinearDodge(base,(2.0*(blend-0.5))); 350} 351 352vec3 blendLinearLight(vec3 base, vec3 blend) { 353 return vec3(blendLinearLight(base.r,blend.r),blendLinearLight(base.g,blend.g),blendLinearLight(base.b,blend.b)); 354} 355 356vec3 blendLinearLight(vec3 base, vec3 blend, float opacity) { 357 return (blendLinearLight(base, blend) * opacity + base * (1.0 - opacity)); 358}`,fragment:`varying vec3 v_color; 359 360void main() { 361 vec3 color = v_color; 362 if (u_darken_top == 1.0) { 363 vec2 st = gl_FragCoord.xy/resolution.xy; 364 color.g -= pow(st.y + sin(-12.0) * st.x, u_shadow_power) * 0.4; 365 } 366 gl_FragColor = vec4(color, 1.0); 367}`},this.conf={presetName:``,wireframe:!1,density:[.06,.16],zoom:1,rotation:0,playing:!0},this.minigl=new o(this.el,null,null,!0),this.init(),this.addIsLoadedClass()}disconnect(){this.scrollObserver&&(window.removeEventListener(`scroll`,this.handleScroll),window.removeEventListener(`mousedown`,this.handleMouseDown),window.removeEventListener(`mouseup`,this.handleMouseUp),window.removeEventListener(`keydown`,this.handleKeyDown),this.scrollObserver.disconnect()),window.removeEventListener(`resize`,this.resize)}initMaterial(){this.uniforms={u_time:new this.minigl.Uniform({value:0}),u_shadow_power:new this.minigl.Uniform({value:5}),u_darken_top:new this.minigl.Uniform({value:+(this.el.dataset.jsDarkenTop===``)}),u_active_colors:new this.minigl.Uniform({value:this.activeColors,type:`vec4`}),u_global:new this.minigl.Uniform({value:{noiseFreq:new this.minigl.Uniform({value:[this.freqX,this.freqY],type:`vec2`}),noiseSpeed:new this.minigl.Uniform({value:5e-6})},type:`struct`}),u_vertDeform:new this.minigl.Uniform({value:{incline:new this.minigl.Uniform({value:Math.sin(this.angle)/Math.cos(this.angle)}),offsetTop:new this.minigl.Uniform({value:-.5}),offsetBottom:new this.minigl.Uniform({value:-.5}),noiseFreq:new this.minigl.Uniform({value:[3,4],type:`vec2`}),noiseAmp:new this.minigl.Uniform({value:this.amp}),noiseSpeed:new this.minigl.Uniform({value:10}),noiseFlow:new this.minigl.Uniform({value:3}),noiseSeed:new this.minigl.Uniform({value:this.seed})},type:`struct`,excludeFrom:`fragment`}),u_baseColor:new this.minigl.Uniform({value:this.sectionColors[0],type:`vec3`,excludeFrom:`fragment`}),u_waveLayers:new this.minigl.Uniform({value:[],excludeFrom:`fragment`,type:`array`})};for(let e=1;e<this.sectionColors.length;e+=1)this.uniforms.u_waveLayers.value.push(new this.minigl.Uniform({value:{color:new this.minigl.Uniform({value:this.sectionColors[e],type:`vec3`}),noiseFreq:new this.minigl.Uniform({value:[2+e/this.sectionColors.length,3+e/this.sectionColors.length],type:`vec2`}),noiseSpeed:new this.minigl.Uniform({value:11+.3*e}),noiseFlow:new this.minigl.Uniform({value:6.5+.3*e}),noiseSeed:new this.minigl.Uniform({value:this.seed+10*e}),noiseFloor:new this.minigl.Uniform({value:.1}),noiseCeil:new this.minigl.Uniform({value:.63+.07*e})},type:`struct`}));return this.vertexShader=[this.shaderFiles.noise,this.shaderFiles.blend,this.shaderFiles.vertex].join(` 368 369`),new this.minigl.Material(this.vertexShader,this.shaderFiles.fragment,this.uniforms)}initMesh(){this.material=this.initMaterial(),this.geometry=new this.minigl.PlaneGeometry,this.mesh=new this.minigl.Mesh(this.geometry,this.material)}shouldSkipFrame(e){return!!window.document.hidden||!this.conf.playing||parseInt(e,10)%2==0||void 0}updateFrequency(e){this.freqX+=e,this.freqY+=e}toggleColor(e){this.activeColors[e]=+(this.activeColors[e]===0)}showGradientLegend(){this.width>this.minWidth&&(this.isGradientLegendVisible=!0,document.body.classList.add(`isGradientLegendVisible`))}hideGradientLegend(){this.isGradientLegendVisible=!1,document.body.classList.remove(`isGradientLegendVisible`)}init(){this.initGradientColors(),this.initMesh(),this.resize(),requestAnimationFrame(this.animate),window.addEventListener(`resize`,this.resize)}initGradientColors(){this.sectionColors=this.gradientColors.map(e=>(e.length===4&&(e=`#${e.substr(1).split(``).map(e=>e+e).join(``)}`),e&&`0x${e.substr(1)}
369`)).filter(Boolean).map(a)}};function l(){try{let e=document.createElement(`canvas`).getContext(`webgl`,{antialias:!0});return e?(e.getExtension(`WEBGL_lose_context`)?.loseContext(),!0):!1}catch{return!1}}function u({fallback:e=null}={}){let t=(0,i.useRef)(null),[n,r]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{if(!t.current)return;let e=t.current;if(!l()){r(!0);return}let n=new c;return n.onError=()=>r(!0),n.initGradient({gradientColors:[`#ef008f`,`#6ec3f4`,`#7038ff`,`#ffba27`]}),e.appendChild(n.el),()=>{n.disconnect(),n.el.parentNode===e&&e.removeChild(n.el),n.minigl?.gl?.getExtension(`WEBGL_lose_context`)?.loseContext()}},[]),n?e:i.createElement(`div`,{ref:t,style:{width:`100%`,height:`100%`}})}var d=r(),f=e(n(),1);function p(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(`div`,{className:`h-full w-full`,style:{backgroundImage:`linear-gradient(90deg, #ef008f 0%, #6ec3f4 33%, #7038ff 66%, #ffba27 100%)`}}),e[0]=t):t=e[0],t}export{u as n,p as t}; 370//# sourceMappingURL=zenitho-fallback-D79Urebh.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.