PageSourceSearch

https://crate.design/_next/static/chunks/8297.e1b348007201e07b.js

js crate.design collected 2026-10-09 21:31:48 UTC 10,454 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8297],{6517:(n,e,t)=>{t.d(e,{Ij:()=>v,Jt:()=>f,Q9:()=>m,fW:()=>d});var r=t(3648);function o(){let n=(0,r._)(["\n  // Simplex noise — Ashima Arts / Ian McEwan. MIT.\n  vec3 mod289(vec3 x){ return x - floor(x * (1.0/289.0)) * 289.0; }\n  vec2 mod289(vec2 x){ return x - floor(x * (1.0/289.0)) * 289.0; }\n  vec3 permute(vec3 x){ return mod289(((x*34.0)+1.0)*x); }\n\n  float snoise2(vec2 v){\n    const vec4 C = vec4(0.211324865405187, 0.366025403784439,\n                       -0.577350269189626, 0.024390243902439);\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 = mod289(i);\n    vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))\n        + i.x + vec3(0.0, i1.x, 1.0 ));\n    vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy),\n        dot(x12.zw,x12.zw)), 0.0);\n    m = m*m; m = m*m;\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    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\n  float fbm(vec2 p){\n    float v = 0.0;\n    float a = 0.5;\n    for(int i=0;i<5;i++){\n      v += a * snoise2(p);\n      p *= 2.02;\n      a *= 0.55;\n    }\n    return v;\n  }\n\n  vec2 curl(vec2 p){\n    float e = 0.01;\n    float n1 = fbm(p + vec2(0.0,  e));\n    float n2 = fbm(p + vec2(0.0, -e));\n    float n3 = fbm(p + vec2( e, 0.0));\n    float n4 = fbm(p + vec2(-e, 0.0));\n    float x = (n1 - n2) / (2.0 * e);\n    float y = (n4 - n3) / (2.0 * e);\n    return vec2(x, y);\n  }\n"]);return o=function(){return n},n}function i(){let n=(0,r._)(["\n  varying vec2 vUv;\n  void main(){\n    vUv = uv;\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n  }\n"]);return i=function(){return n},n}function c(){let n=(0,r._)(["\n  precision highp float;\n  varying vec2 vUv;\n\n  uniform float uTime;\n  uniform vec2  uMouse;\n  uniform vec2  uResolution;\n  uniform float uIntensity;\n  uniform float uReduced;\n\n  ","\n\n  vec3 palette(float t){\n    // Deep nebula ramp: stays dark across the field; only peaks brighten.\n    vec3 c0 = vec3(0.012, 0.014, 0.024); // deep ink\n    vec3 c1 = vec3(0.060, 0.045, 0.140); // bruise violet\n    vec3 c2 = vec3(0.085, 0.070, 0.200); // electric violet\n    vec3 c3 = vec3(0.080, 0.180, 0.260); // teal cyan\n    vec3 c4 = vec3(0.260, 0.260, 0.440); // pale highlight\n\n    if(t < 0.35) return mix(c0, c1, smoothstep(0.0, 0.35, t));\n    if(t < 0.65) return mix(c1, c2, smoothstep(0.35, 0.65, t));\n    if(t < 0.88) return mix(c2, c3, smoothstep(0.65, 0.88, t));\n    return mix(c3, c4, smoothstep(0.88, 1.00, t));\n  }\n\n  void main(){\n    vec2 uv = vUv;\n    vec2 p = uv * 2.0 - 1.0;\n    float aspect = uResolution.x / max(uResolution.y, 1.0);\n    p.x *= aspect;\n\n    float t = uTime * (uReduced > 0.5 ? 0.0 : 0.06);\n\n    // Flowing curl-noise field, calmer\n    vec2 q = p * 0.7;\n    vec2 flow = curl(q + t * 0.5);\n    q += flow * 0.25;\n    float n = fbm(q + t * 0.7);\n    float n2 = fbm(q * 1.5 - t * 0.4);\n\n    // Cursor warp — gentler\n    vec2 m = uMouse;\n    m.x *= aspect;\n    float md = distance(p, m);\n    float warp = exp(-md * 1.6) * 0.45;\n\n    // Final luminance, kept low overall\n    float lum = clamp(0.42 + 0.32 * n + 0.10 * n2, 0.0, 1.0);\n    lum = pow(lum, 1.5);\n\n    vec3 col = palette(lum);\n\n    // Faint iridescent ridges where flow is strong\n    float ridges = 0.5 + 0.5 * sin((p.y - p.x * 0.3) * 4.0 + t * 1.0 + n * 2.0);\n    ridges = pow(ridges, 8.0) * 0.10;\n    col += ridges * vec3(0.55, 0.45, 0.95);\n\n    // Cursor heat halo\n    col += vec3(0.30, 0.22, 0.55) * warp;\n\n    // Strong vignette to deep ink at edges\n    float vignette = smoothstep(1.7, 0.2, length(p));\n    col = mix(vec3(0.012, 0.014, 0.022), col, vignette * 0.9);\n\n    // Subtle grain\n    float grain = fract(sin(dot(uv * uResolution, vec2(12.9898,78.233))) * 43758.5453);\n    col += (grain - 0.5) * 0.012;\n\n    col *= uIntensity;\n\n    gl_FragColor = vec4(col, 1.0);\n  }\n"]);return c=function(){return n},n}function u(){let n=(0,r._)(["\n  varying vec3 vNormal;\n  varying vec3 vPos;\n  varying vec3 vView;\n\n  uniform float uTime;
1\n  uniform vec2  uMouse;\n  uniform float uReduced;\n\n  ","\n\n  // 3D-ish noise via 2D slices\n  float n3(vec3 p){\n    float a = snoise2(p.xy + p.z * 0.3);\n    float b = snoise2(p.yz - p.x * 0.4);\n    float c = snoise2(p.xz + p.y * 0.2);\n    return (a + b + c) / 3.0;\n  }\n\n  void main(){\n    vec3 pos = position;\n    float t = uTime * (uReduced > 0.5 ? 0.0 : 0.35);\n\n    float n = n3(pos * 1.2 + vec3(t * 0.5, 0.0, t * 0.3));\n    float n2 = n3(pos * 2.4 - vec3(0.0, t * 0.4, 0.0));\n\n    // Cursor warp — bulge toward the cursor in screen space\n    vec4 mvPos = modelViewMatrix * vec4(pos, 1.0);\n    vec4 mPos = projectionMatrix * mvPos;\n    vec2 ndc = mPos.xy / mPos.w;\n    float md = distance(ndc, uMouse);\n    float bulge = exp(-md * 2.2) * 0.18;\n\n    float disp = 0.12 * n + 0.05 * n2 + bulge;\n    pos += normal * disp;\n\n    vNormal = normalize(normalMatrix * normal);\n    vPos = pos;\n    vView = -normalize((modelViewMatrix * vec4(pos, 1.0)).xyz);\n\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n  }\n"]);return u=function(){return n},n}function a(){let n=(0,r._)(["\n  precision highp float;\n\n  varying vec3 vNormal;\n  varying vec3 vPos;\n  varying vec3 vView;\n\n  uniform float uTime;\n\n  vec3 iridescent(float t){\n    vec3 a = vec3(0.45, 0.32, 0.95); // violet\n    vec3 b = vec3(0.35, 0.82, 0.98); // cyan\n    vec3 c = vec3(0.95, 0.62, 0.86); // rose\n    vec3 d = vec3(0.62, 0.98, 0.84); // mint\n\n    if(t < 0.33) return mix(a, b, smoothstep(0.0, 0.33, t));\n    if(t < 0.66) return mix(b, c, smoothstep(0.33, 0.66, t));\n    return mix(c, d, smoothstep(0.66, 1.0, t));\n  }\n\n  void main(){\n    vec3 N = normalize(vNormal);\n    vec3 V = normalize(vView);\n    float fres = pow(1.0 - max(dot(N, V), 0.0), 2.4);\n\n    float band = 0.5 + 0.5 * sin(vPos.y * 2.4 + uTime * 0.5);\n    float iridT = fract(fres * 0.9 + band * 0.4 + uTime * 0.03);\n    vec3 col = iridescent(iridT);\n\n    // Inner glow\n    col += fres * 0.55;\n\n    // Slight darken at the back\n    col *= 0.85 + 0.3 * max(dot(N, vec3(0.0, 0.4, 1.0)), 0.0);\n\n    gl_FragColor = vec4(col, 1.0);\n  }\n"]);return a=function(){return n},n}let l=function(n){for(var e=arguments.length,t=Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return n.reduce((n,e,r)=>{var o;return n+e+(null!=(o=t[r])?o:"")},"")},s=l(o()),v=l(i()),f=l(c(),s),m=l(u(),s),d=l(a())},8828:(n,e,t)=>{n.exports=t(83654)},14806:(n,e,t)=>{n.exports=t(30125)},28537:(n,e,t)=>{t.r(e),t.d(e,{default:()=>v});var r=t(95155),o=t(12115),i=t(83388),c=t(30258),u=t(85339),a=t(6517),l=t(51232);function s(n){let{reduced:e}=n,t=(0,o.useRef)(null),c=(0,o.useRef)(null),l=(0,o.useRef)({x:0,y:0}),s=(0,o.useRef)({x:0,y:0});(0,o.useEffect)(()=>{let n=n=>{l.current.x=n.clientX/window.innerWidth*2-1,l.current.y=-(n.clientY/window.innerHeight*2-1)};return window.addEventListener("pointermove",n,{passive:!0}),()=>window.removeEventListener("pointermove",n)},[]);let v=(0,o.useMemo)(()=>({uTime:{value:0},uMouse:{value:new u.I9Y(0,0)},uReduced:{value:+!!e}}),[e]);return(0,i.D)((n,r)=>{t.current&&(t.current.uniforms.uTime.value+=r,s.current.x+=(l.current.x-s.current.x)*.05,s.current.y+=(l.current.y-s.current.y)*.05,t.current.uniforms.uMouse.value.set(s.current.x,s.current.y),t.current.uniforms.uReduced.value=+!!e,c.current&&!e&&(c.current.rotation.y+=.12*r,c.current.rotation.x=.1*Math.sin(.3*t.current.uniforms.uTime.value)))}),(0,r.jsxs)("mesh",{ref:c,children:[(0,r.jsx)("icosahedronGeometry",{args:[1.4,64]}),(0,r.jsx)("shaderMaterial",{ref:t,uniforms:v,vertexShader:a.Q9,fragmentShader:a.fW})]})}function v(){let n=(0,l.I)(),[e,t]=(0,o.useState)([1,1.5]);return(0,o.useEffect)(()=>{t(window.matchMedia("(max-width: 640px)").matches?[.75,1]:[1,1.5])},[]),(0,r.jsxs)(c.Hl,{"aria-hidden":!0,gl:{antialias:!0,alpha:!0,powerPreference:"high-performance"},dpr:e,camera:{position:[0,0,4.2],near:.1,far:20,fov:38},style:{position:"absolute",inset:0,width:"100%",height:"100%"},frameloop:n?"demand":"always",children:[(0,r.jsx)("ambientLight",{intensity:.6}),(0,r.jsx)(s,{reduced:n})]})}},30125:(n,e,t)=>{var r=t(12115),o="function"==typeof Object.is?Object.is:function(n,e){return n===e&&(0!==n||1/n==1/e)||n!=n&&e!=e},i=r.useState,c=r.useEffect,u=r.useLayoutEffect,a=r.useDebugValue;function l(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!o(n,t)}catch(n){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(n,e){return e()}:function(n,e){var t=e(),r=i({inst:{value:t,getSnapshot:e}}),o=r[0].inst,s=r[1];return u(function(){o.value=t,o.getSnapshot=e,l(o)&&s({inst:o})},[n,t,e]),c(function(){return l(o)&&s({inst:o}),n(function(){l(o)&&s({inst:o})})},[n]),a(t),t};e.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:s},83654:(n,e,t)=>{var r=t(12115),o=t(14806),i="function"==typeof Object.is?Object.is:function(n,e){return n===e&&(0!==n||1/n==1/e)||n!=n&&e!=e}
1,c=o.useSyncExternalStore,u=r.useRef,a=r.useEffect,l=r.useMemo,s=r.useDebugValue;e.useSyncExternalStoreWithSelector=function(n,e,t,r,o){var v=u(null);if(null===v.current){var f={hasValue:!1,value:null};v.current=f}else f=v.current;var m=c(n,(v=l(function(){function n(n){if(!a){if(a=!0,c=n,n=r(n),void 0!==o&&f.hasValue){var e=f.value;if(o(e,n))return u=e}return u=n}if(e=u,i(c,n))return e;var t=r(n);return void 0!==o&&o(e,t)?(c=n,e):(c=n,u=t)}var c,u,a=!1,l=void 0===t?null:t;return[function(){return n(e())},null===l?void 0:function(){return n(l())}]},[e,t,r,o]))[0],v[1]);return a(function(){f.hasValue=!0,f.value=m},[m]),s(m),m}},90490:(n,e,t)=>{t.d(e,{y:()=>o});let r=n=>{let e,t=new Set,r=(n,r)=>{let o="function"==typeof n?n(e):n;if(!Object.is(o,e)){let n=e;e=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},e,o),t.forEach(t=>t(e,n))}},o=()=>e,i={setState:r,getState:o,getInitialState:()=>c,subscribe:n=>(t.add(n),()=>t.delete(n))},c=e=n(r,o,i);return i},o=n=>n?r(n):r}}]);

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.