1var S=Object.defineProperty;var b=(t,e,i)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var o=(t,e,i)=>b(t,typeof e!="symbol"?e+"":e,i);const U=`#version 300 es 2precision mediump float; 3 4layout(location = 0) in vec4 a_position; 5 6uniform vec2 u_resolution; 7uniform float u_pixelRatio; 8uniform float u_imageAspectRatio; 9uniform float u_originX; 10uniform float u_originY; 11uniform float u_worldWidth; 12uniform float u_worldHeight; 13uniform float u_fit; 14uniform float u_scale; 15uniform float u_rotation; 16uniform float u_offsetX; 17uniform float u_offsetY; 18 19out vec2 v_objectUV; 20out vec2 v_objectBoxSize; 21out vec2 v_responsiveUV; 22out vec2 v_responsiveBoxGivenSize; 23out vec2 v_patternUV; 24out vec2 v_patternBoxSize; 25out vec2 v_imageUV; 26 27vec3 getBoxSize(float boxRatio, vec2 givenBoxSize) { 28 vec2 box = vec2(0.); 29 // fit = none 30 box.x = boxRatio * min(givenBoxSize.x / boxRatio, givenBoxSize.y); 31 float noFitBoxWidth = box.x; 32 if (u_fit == 1.) { // fit = contain 33 box.x = boxRatio * min(u_resolution.x / boxRatio, u_resolution.y); 34 } else if (u_fit == 2.) { // fit = cover 35 box.x = boxRatio * max(u_resolution.x / boxRatio, u_resolution.y); 36 } 37 box.y = box.x / boxRatio; 38 return vec3(box, noFitBoxWidth); 39} 40 41void main() { 42 gl_Position = a_position; 43 44 vec2 uv = gl_Position.xy * .5; 45 vec2 boxOrigin = vec2(.5 - u_originX, u_originY - .5); 46 vec2 givenBoxSize = vec2(u_worldWidth, u_worldHeight); 47 givenBoxSize = max(givenBoxSize, vec2(1.)) * u_pixelRatio; 48 float r = u_rotation * 3.14159265358979323846 / 180.; 49 mat2 graphicRotation = mat2(cos(r), sin(r), -sin(r), cos(r)); 50 vec2 graphicOffset = vec2(-u_offsetX, u_offsetY); 51 52 53 // =================================================== 54 55 float fixedRatio = 1.; 56 vec2 fixedRatioBoxGivenSize = vec2( 57 (u_worldWidth == 0.) ? u_resolution.x : givenBoxSize.x, 58 (u_worldHeight == 0.) ? u_resolution.y : givenBoxSize.y 59 ); 60 61 v_objectBoxSize = getBoxSize(fixedRatio, fixedRatioBoxGivenSize).xy; 62 vec2 objectWorldScale = u_resolution.xy / v_objectBoxSize; 63 64 v_objectUV = uv; 65 v_objectUV *= objectWorldScale; 66 v_objectUV += boxOrigin * (objectWorldScale - 1.); 67 v_objectUV += graphicOffset; 68 v_objectUV /= u_scale; 69 v_objectUV = graphicRotation * v_objectUV; 70 71 // =================================================== 72 73 v_responsiveBoxGivenSize = vec2( 74 (u_worldWidth == 0.) ? u_resolution.x : givenBoxSize.x, 75 (u_worldHeight == 0.) ? u_resolution.y : givenBoxSize.y 76 ); 77 float responsiveRatio = v_responsiveBoxGivenSize.x / v_responsiveBoxGivenSize.y; 78 vec2 responsiveBoxSize = getBoxSize(responsiveRatio, v_responsiveBoxGivenSize).xy; 79 vec2 responsiveBoxScale = u_resolution.xy / responsiveBoxSize; 80 81 #ifdef ADD_HELPERS 82 v_responsiveHelperBox = uv; 83 v_responsiveHelperBox *= responsiveBoxScale; 84 v_responsiveHelperBox += boxOrigin * (responsiveBoxScale - 1.); 85 #endif 86 87 v_responsiveUV = uv; 88 v_responsiveUV *= responsiveBoxScale; 89 v_responsiveUV += boxOrigin * (responsiveBoxScale - 1.); 90 v_responsiveUV += graphicOffset; 91 v_responsiveUV /= u_scale; 92 v_responsiveUV.x *= responsiveRatio; 93 v_responsiveUV = graphicRotation * v_responsiveUV; 94 v_responsiveUV.x /= responsiveRatio; 95 96 // =================================================== 97 98 float patternBoxRatio = givenBoxSize.x / givenBoxSize.y; 99 vec2 patternBoxGivenSize = vec2( 100 (u_worldWidth == 0.) ? u_resolution.x : givenBoxSize.x, 101 (u_worldHeight == 0.) ? u_resolution.y : givenBoxSize.y 102 ); 103 patternBoxRatio = patternBoxGivenSize.x / patternBoxGivenSize.y; 104 105 vec3 boxSizeData = getBoxSize(patternBoxRatio, patternBoxGivenSize); 106 v_patternBoxSize = boxSizeData.xy; 107 float patternBoxNoFitBoxWidth = boxSizeData.z; 108 vec2 patternBoxScale = u_resolution.xy / v_patternBoxSize; 109 110 v_patternUV = uv; 111 v_patternUV += graphicOffset / patternBoxScale; 112 v_patternUV += boxOrigin; 113 v_patternUV -= boxOrigin / patternBoxScale; 114 v_patternUV *= u_resolution.xy; 115 v_patternUV /= u_pixelRatio; 116 if (u_fit > 0.) { 117 v_patternUV *= (patternBoxNoFitBoxWidth / v_patternBoxSize.x); 118 } 119 v_patternUV /= u_scale; 120 v_patternUV = graphicRotation * v_patternUV; 121 v_patternUV += boxOrigin / patternBoxScale; 122 v_patternUV -= boxOrigin; 123 // x100 is a default multiplier between vertex and fragmant shaders 124 // we use it to avoid UV presision issues 125 v_patternUV *= .01; 126 127 // =================================================== 128 129 vec2 imageBoxSize; 130 if (u_fit == 1.) { // contain 131 imageBoxSize.x = min(u_resolution.x / u_imageAspectRatio, u_resolution.y) * u_imageAspectRatio; 132 } else if (u_fit == 2.) { // cover 133 imageBoxSize.x = max(u_resolution.x / u_imageAspectRatio, u_resolution.y) * u_imageAspectRatio; 134 } else { 135 imageBoxSize.x = min(10.0, 10.0 / u_imageAspectRatio * u_imageAspectRatio); 136 } 137 imageBoxSize.y = imageBoxSize.x / u_imageAspectRatio; 138 vec2 imageBoxScale = u_resolution.xy / imageBoxSize; 139 140 v_imageUV = uv; 141 v_imageUV *= imageBoxScale; 142 v_imageUV += boxOrigin * (imageBoxScale - 1.); 143 v_imageUV += graphicOffset; 144 v_imageUV /= u_scale; 145 v_imageUV.x *= u_imageAspectRatio; 146 v_imageUV = graphicRotation * v_imageUV; 147 v_imageUV.x /= u_imageAspectRatio; 148 149 v_imageUV += .5; 150 v_imageUV.y = 1. - v_imageUV.y; 151}`;class L{constructor(e,i,r,a,s=0,n=0,h=2,c=8294400,u=[]){o(this,"parentElement");o(this,"canvasElement");o(this,"gl");o(this,"program",null);o(this,"uniformLocations",{});o(this,"fragmentShader");o(this,"rafId",null);o(this,"lastRenderTime",0);o(this,"currentFrame",0);o(this,"speed",0);o(this,"currentSpeed",0);o(this,"providedUniforms");o(this,"mipmaps",[]);o(this,"hasBeenDisposed",!1);o(this,"resolutionChanged",!0);o(this,"textures",new Map);o(this,"minPixelRatio");o(this,"maxPixelCount");o(this,"isSafari",z());o(this,"uniformCache",{});o(this,"textureUnitMap",new Map);o(this,"ownerDocument");o(this,"initProgram",()=>{const e=E(this.gl,U,this.fragmentShader);e&&(this.program=e)});o(this,"setupPositionAttribute",()=>{const e=this.gl.getAttribLocation(this.program,"a_position"),i=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,i);const r=[-1,-1,1,-1,-1,1,-1,1,1,-1,1,1];this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(r),this.gl.STATIC_DRAW),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,0,0)});o(this,"setupUniforms",()=>{const e={u_time:this.gl.getUniformLocation(this.program,"u_time"),u_pixelRatio:this.gl.getUniformLocation(this.program,"u_pixelRatio"),u_resolution:this.gl.getUniformLocation(this.program,"u_resolution")};
151Object.entries(this.providedUniforms).forEach(([i,r])=>{if(e[i]=this.gl.getUniformLocation(this.program,i),r instanceof HTMLImageElement){const a=`${i}AspectRatio`;e[a]=this.gl.getUniformLocation(this.program,a)}}),this.uniformLocations=e});o(this,"renderScale",1);o(this,"parentWidth",0);o(this,"parentHeight",0);o(this,"parentDevicePixelWidth",0);o(this,"parentDevicePixelHeight",0);o(this,"devicePixelsSupported",!1);o(this,"resizeObserver",null);o(this,"setupResizeObserver",()=>{this.resizeObserver=new ResizeObserver(([e])=>{var i;if(e!=null&&e.borderBoxSize[0]){const r=(i=e.devicePixelContentBoxSize)==null?void 0:i[0];r!==void 0&&(this.devicePixelsSupported=!0,this.parentDevicePixelWidth=r.inlineSize,this.parentDevicePixelHeight=r.blockSize),this.parentWidth=e.borderBoxSize[0].inlineSize,this.parentHeight=e.borderBoxSize[0].blockSize}this.handleResize()}),this.resizeObserver.observe(this.parentElement)});o(this,"handleVisualViewportChange",()=>{var e;(e=this.resizeObserver)==null||e.disconnect(),this.setupResizeObserver()});o(this,"handleResize",()=>{let e=0,i=0;const r=Math.max(1,window.devicePixelRatio),a=(visualViewport==null?void 0:visualViewport.scale)??1;if(this.devicePixelsSupported){const l=Math.max(1,this.minPixelRatio/r);e=this.parentDevicePixelWidth*l*a,i=this.parentDevicePixelHeight*l*a}else{let l=Math.max(r,this.minPixelRatio)*a;if(this.isSafari){const f=w(this.ownerDocument);l*=Math.max(1,f)}e=Math.round(this.parentWidth)*l,i=Math.round(this.parentHeight)*l}const s=Math.sqrt(this.maxPixelCount)/Math.sqrt(e*i),n=Math.min(1,s),h=Math.round(e*n),c=Math.round(i*n),u=h/Math.round(this.parentWidth);(this.canvasElement.width!==h||this.canvasElement.height!==c||this.renderScale!==u)&&(this.renderScale=u,this.canvasElement.width=h,this.canvasElement.height=c,this.resolutionChanged=!0,this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.render(performance.now()))});o(this,"render",e=>{if(this.hasBeenDisposed)return;if(this.program===null){console.warn("Tried to render before program or gl was initialized");return}const i=e-this.lastRenderTime;this.lastRenderTime=e,this.currentSpeed!==0&&(this.currentFrame+=i*this.currentSpeed),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.useProgram(this.program),this.gl.uniform1f(this.uniformLocations.u_time,this.currentFrame*.001),this.resolutionChanged&&(this.gl.uniform2f(this.uniformLocations.u_resolution,this.gl.canvas.width,this.gl.canvas.height),this.gl.uniform1f(this.uniformLocations.u_pixelRatio,this.renderScale),this.resolutionChanged=!1),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.currentSpeed!==0?this.requestRender():this.rafId=null});o(this,"requestRender",()=>{this.rafId!==null&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(this.render)});o(this,"setTextureUniform",(e,i)=>{if(!i.complete||i.naturalWidth===0)throw new Error(`Paper Shaders: image for uniform ${e} must be fully loaded`);const r=this.textures.get(e);r&&this.gl.deleteTexture(r),this.textureUnitMap.has(e)||this.textureUnitMap.set(e,this.textureUnitMap.size);const a=this.textureUnitMap.get(e);this.gl.activeTexture(this.gl.TEXTURE0+a);const s=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,s),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,i),this.mipmaps.includes(e)&&(this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR));const n=this.gl.getError();if(n!==this.gl.NO_ERROR||s===null){console.error("Paper Shaders: WebGL error when uploading texture:",n);return}this.textures.set(e,s);const h=this.uniformLocations[e];if(h){this.gl.uniform1i(h,a);const c=`${e}AspectRatio`,u=this.uniformLocations[c];
151if(u){const l=i.naturalWidth/i.naturalHeight;this.gl.uniform1f(u,l)}}});o(this,"areUniformValuesEqual",(e,i)=>e===i?!0:Array.isArray(e)&&Array.isArray(i)&&e.length===i.length?e.every((r,a)=>this.areUniformValuesEqual(r,i[a])):!1);o(this,"setUniformValues",e=>{this.gl.useProgram(this.program),Object.entries(e).forEach(([i,r])=>{let a=r;if(r instanceof HTMLImageElement&&(a=`${r.src.slice(0,200)}|${r.naturalWidth}x${r.naturalHeight}`),this.areUniformValuesEqual(this.uniformCache[i],a))return;this.uniformCache[i]=a;const s=this.uniformLocations[i];if(!s){console.warn(`Uniform location for ${i} not found`);return}if(r instanceof HTMLImageElement)this.setTextureUniform(i,r);else if(Array.isArray(r)){let n=null,h=null;if(r[0]!==void 0&&Array.isArray(r[0])){const c=r[0].length;if(r.every(u=>u.length===c))n=r.flat(),h=c;else{console.warn(`All child arrays must be the same length for ${i}`);return}}else n=r,h=n.length;switch(h){case 2:this.gl.uniform2fv(s,n);break;case 3:this.gl.uniform3fv(s,n);break;case 4:this.gl.uniform4fv(s,n);break;case 9:this.gl.uniformMatrix3fv(s,!1,n);break;case 16:this.gl.uniformMatrix4fv(s,!1,n);break;default:console.warn(`Unsupported uniform array length: ${h}`)}}else typeof r=="number"?this.gl.uniform1f(s,r):typeof r=="boolean"?this.gl.uniform1i(s,r?1:0):console.warn(`Unsupported uniform type for ${i}: ${typeof r}`)})});o(this,"getCurrentFrame",()=>this.currentFrame);o(this,"setFrame",e=>{this.currentFrame=e,this.lastRenderTime=performance.now(),this.render(performance.now())});o(this,"setSpeed",(e=1)=>{this.speed=e,this.setCurrentSpeed(this.ownerDocument.hidden?0:e)});o(this,"setCurrentSpeed",e=>{this.currentSpeed=e,this.rafId===null&&e!==0&&(this.lastRenderTime=performance.now(),this.rafId=requestAnimationFrame(this.render)),this.rafId!==null&&e===0&&(cancelAnimationFrame(this.rafId),this.rafId=null)});o(this,"setMaxPixelCount",(e=8294400)=>{this.maxPixelCount=e,this.handleResize()});o(this,"setMinPixelRatio",(e=2)=>{this.minPixelRatio=e,this.handleResize()});o(this,"setUniforms",e=>{this.setUniformValues(e),this.providedUniforms={...this.providedUniforms,...e},this.render(performance.now())});o(this,"handleDocumentVisibilityChange",()=>{this.setCurrentSpeed(this.ownerDocument.hidden?0:this.speed)});o(this,"dispose",()=>{this.hasBeenDisposed=!0,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.gl&&this.program&&(this.textures.forEach(e=>{this.gl.deleteTexture(e)}),this.textures.clear(),this.gl.deleteProgram(this.program),this.program=null,this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.getError()),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),visualViewport==null||visualViewport.removeEventListener("resize",this.handleVisualViewportChange),this.ownerDocument.removeEventListener("visibilitychange",this.handleDocumentVisibilityChange),this.uniformLocations={},this.canvasElement.remove(),delete this.parentElement.paperShaderMount});if((e==null?void 0:e.nodeType)===1)this.parentElement=e;else throw new Error("Paper Shaders: parent element must be an HTMLElement");if(this.ownerDocument=e.ownerDocument,!this.ownerDocument.querySelector("style[data-paper-shader]")){const d=this.ownerDocument.createElement("style");d.innerHTML=B,d.setAttribute("data-paper-shader",""),this.ownerDocument.head.prepend(d)}const l=this.ownerDocument.createElement("canvas");this.canvasElement=l,this.parentElement.prepend(l),this.fragmentShader=i,this.providedUniforms=r,this.mipmaps=u,this.currentFrame=n,this.minPixelRatio=h,this.maxPixelCount=c;const f=l.getContext("webgl2",a);if(!f)throw new Error("Paper Shaders: WebGL is not supported in this browser");this.gl=f,this.initProgram(),this.setupPositionAttribute(),this.setupUniforms(),this.setUniformValues(this.providedUniforms),this.setupResizeObserver(),visualViewport==null||visualViewport.addEventListener("resize",this.handleVisualViewportChange),this.setSpeed(s),this.parentElement.setAttribute("data-paper-shader",""),this.parentElement.paperShaderMount=this,this.ownerDocument.addEventListener("visibilitychange",this.handleDocumentVisibilityChange)}}function R(t,e,i){const r=t.createShader(e);return r?(t.shaderSource(r,i),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS)?r:(console.error("An error occurred compiling the shaders: "+t.getShaderInfoLog(r)),t.deleteShader(r),null)):null}function E(t,e,i){const r=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT),a=r?r.precision:null;a&&a<23&&(e=e.replace(/precision\s+(lowp|mediump)\s+float;/g,"precision highp float;"),i=i.replace(/precision\s+(lowp|mediump)\s+float/g,"precision highp float").replace(/\b(uniform|varying|attribute)\s+(lowp|mediump)\s+(\w+)/g,"$1 highp $3"));const s=R(t,t.VERTEX_SHADER,e),n=R(t,t.FRAGMENT_SHADER,i);if(!s||!n)return null;const h=t.createProgram();return h?(t.attachShader(h,s),t.attachShader(h,n),t.linkProgram(h),t.getProgramParameter(h,t.LINK_STATUS)?(t.detachShader(h,s),t.detachShader(h,n),t.deleteShader(s),t.deleteShader(n),h):(console.error("Unable to initialize the shader program: "+t.getProgramInfoLog(h)),t.deleteProgram(h),t.deleteShader(s),t.deleteShader(n),null)):null}const B=`@layer paper-shaders { 152 :where([data-paper-shader]) { 153 isolation: isolate; 154 position: relative; 155 156 & canvas { 157 contain: strict; 158 display: block; 159 position: absolute; 160 inset: 0; 161 z-index: -1; 162 width: 100%; 163 height: 100%; 164 border-radius: inherit; 165 corner-shape: inherit; 166 } 167 } 168}`;function M(t){return"paperShaderMount"in t}function z(){const t=navigator.userAgent.toLowerCase();return t.includes("safari")&&!t.includes("chrome")&&!t.includes("android")}
168function w(t){const e=(visualViewport==null?void 0:visualViewport.scale)??1,i=(visualViewport==null?void 0:visualViewport.width)??window.innerWidth,r=window.innerWidth-t.documentElement.clientWidth,a=e*i+r,s=outerWidth/a,n=Math.round(100*s);return n%5===0?n/100:n===33?1/3:n===67?2/3:n===133?4/3:s}const D={fit:"contain",scale:1,rotation:0,offsetX:0,offsetY:0,originX:.5,originY:.5,worldWidth:0,worldHeight:0},I={fit:"none",scale:1,rotation:0,offsetX:0,offsetY:0,originX:.5,originY:.5,worldWidth:0,worldHeight:0},F={none:0,contain:1,cover:2},C=` 169#define TWO_PI 6.28318530718 170#define PI 3.14159265358979323846 171`,O=` 172vec2 rotate(vec2 uv, float th) { 173 return mat2(cos(th), sin(th), -sin(th), cos(th)) * uv; 174} 175`,W=` 176 float hash11(float p) { 177 p = fract(p * 0.3183099) + 0.1; 178 p *= p + 19.19; 179 return fract(p * p); 180 } 181`,H=` 182 float hash21(vec2 p) { 183 p = fract(p * vec2(0.3183099, 0.3678794)) + 0.1; 184 p += dot(p, p + 19.19); 185 return fract(p.x * p.y); 186 } 187`,X=` 188 float randomR(vec2 p) { 189 vec2 uv = floor(p) / 100. + .5; 190 return texture(u_noiseTexture, fract(uv)).r; 191 } 192`,G=` 193vec3 permute(vec3 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); } 194float snoise(vec2 v) { 195 const vec4 C = vec4(0.211324865405187, 0.366025403784439, 196 -0.577350269189626, 0.024390243902439); 197 vec2 i = floor(v + dot(v, C.yy)); 198 vec2 x0 = v - i + dot(i, C.xx); 199 vec2 i1; 200 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0); 201 vec4 x12 = x0.xyxy + C.xxzz; 202 x12.xy -= i1; 203 i = mod(i, 289.0); 204 vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) 205 + i.x + vec3(0.0, i1.x, 1.0)); 206 vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), 207 dot(x12.zw, x12.zw)), 0.0); 208 m = m * m; 209 m = m * m; 210 vec3 x = 2.0 * fract(p * C.www) - 1.0; 211 vec3 h = abs(x) - 0.5; 212 vec3 ox = floor(x + 0.5); 213 vec3 a0 = x - ox; 214 m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h); 215 vec3 g; 216 g.x = a0.x * x0.x + h.x * x0.y; 217 g.yz = a0.yz * x12.xz + h.yz * x12.yw; 218 return 130.0 * dot(m, g); 219} 220`;function j(t){if(Array.isArray(t))return t.length===4?t:t.length===3?[...t,1]:_;if(typeof t!="string")return _;let e,i,r,a=1;if(t.startsWith("#"))[e,i,r,a]=A(t);else if(t.startsWith("rgb"))[e,i,r,a]=T(t);else if(t.startsWith("hsl"))[e,i,r,a]=V(P(t));else return console.error("Unsupported color format",t),_;return[g(e,0,1),g(i,0,1),g(r,0,1),g(a,0,1)]}function A(t){t=t.replace(/^#/,""),t.length===3&&(t=t.split("").map(s=>s+s).join("")),t.length===6&&(t=t+"ff");const e=parseInt(t.slice(0,2),16)/255,i=parseInt(t.slice(2,4),16)/255,r=parseInt(t.slice(4,6),16)/255,a=parseInt(t.slice(6,8),16)/255;return[e,i,r,a]}function T(t){const e=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([0-9.]+))?\s*\)$/i);return e?[parseInt(e[1]??"0")/255,parseInt(e[2]??"0")/255,parseInt(e[3]??"0")/255,e[4]===void 0?1:parseFloat(e[4])]:[0,0,0,1]}function P(t){const e=t.match(/^hsla?\s*\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*([0-9.]+))?\s*\)$/i);return e?[parseInt(e[1]??"0"),parseInt(e[2]??"0"),parseInt(e[3]??"0"),e[4]===void 0?1:parseFloat(e[4])]:[0,0,0,1]}function V(t){const[e,i,r,a]=t,s=e/360,n=i/100,h=r/100;let c,u,l;if(i===0)c=u=l=h;else{const f=(m,v,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<.16666666666666666?m+(v-m)*6*p:p<.5?v:p<.6666666666666666?m+(v-m)*(.6666666666666666-p)*6:m),d=h<.5?h*(1+n):h+n-h*n,x=2*h-d;c=f(x,d,s+1/3),u=f(x,d,s),l=f(x,d,s-1/3)}return[c,u,l,a]}const g=(t,e,i)=>Math.min(Math.max(t,e),i),_=[0,0,0,1];export{L as S,F as a,H as b,D as c,C as d,I as e,j as g,M as i,W as p,O as r,G as s,X as t}; 221//# sourceMappingURL=get-shader-color-from-string-DGP5waOq.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.