!function(){"use strict";const t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],a=a=>{let e=0;for(let o=0;o<a.length;o++){const r=a[o];e=83*e+t.indexOf(r)}return e},e=(a,e)=>{var o="";for(let r=1;r<=e;r++){let n=Math.floor(a)/Math.pow(83,e-r)%83;o+=t[Math.floor(n)]}return o},o=t=>{let a=t/255;return a<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)},r=t=>{let a=Math.max(0,Math.min(1,t));return a<=.0031308?Math.round(12.92*a*255+.5):Math.round(255*(1.055*Math.pow(a,1/2.4)-.055)+.5)},n=(t,a)=>(t<0?-1:1)*Math.pow(Math.abs(t),a);class h extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}}const s=t=>{const a=t>>8&255,e=255&t;return[o(t>>16),o(a),o(e)]},l=(t,a)=>{const e=Math.floor(t/361),o=Math.floor(t/19)%19,r=t%19;return[n((e-9)/9,2)*a,n((o-9)/9,2)*a,n((r-9)/9,2)*a]};var c=(t,e,o,n)=>{(t=>{if(!t||t.length<6)throw new h("The blurhash string must be at least 6 characters");const e=a(t[0]),o=Math.floor(e/9)+1,r=e%9+1;if(t.length!==4+2*r*o)throw new h(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*r*o}`)})(t),n|=1;const c=a(t[0]),f=Math.floor(c/9)+1,M=c%9+1,i=(a(t[1])+1)/166,u=new Array(M*f);for(let e=0;e<u.length;e++)if(0===e){const o=a(t.substring(2,6));u[e]=s(o)}else{const o=a(t.substring(4+2*e,6+2*e));u[e]=l(o,i*n)}const m=4*e,g=new Uint8ClampedArray(m*o);for(let t=0;t<o;t++)for(let a=0;a<e;a++){let n=0,h=0,s=0;for(let r=0;r<f;r++)for(let l=0;l<M;l++){const c=Math.cos(Math.PI*a*l/e)*Math.cos(Math.PI*t*r/o);let f=u[l+r*M];n+=f[0]*c,h+=f[1]*c,s+=f[2]*c}let l=r(n),c=r(h),i=r(s);g[4*a+0+t*m]=l,g[4*a+1+t*m]=c,g[4*a+2+t*m]=i,g[4*a+3+t*m]=255}return g};const f=(t,a,e,r)=>{let n=0,h=0,s=0;const l=4*a;for(let c=0;c<a;c++)for(let a=0;a<e;a++){const e=r(c,a);n+=e*o(t[4*c+0+a*l]),h+=e*o(t[4*c+1+a*l]),s+=e*o(t[4*c+2+a*l])}let c=1/(a*e);return[n*c,h*c,s*c]};onmessage=t=>async function(t){console.time("BackdropBlur process");const[a,o,s]=function(t){const a=128,e=a*(t.width/t.height)|0,o=new OffscreenCanvas(a,e).getContext("2d");return o.drawImage(t,0,0,a,e),[o.getImageData(0,0,a,e).data,a,e]}(await async function(t){const a=await(await fetch(t,{mode:"no-cors"})).blob();return createImageBitmap(a)}(t)),l=c(((t,a,o,s,l)=>{if(s<1||s>9||l<1||l>9)throw new h("BlurHash must have between 1 and 9 components");if(a*o*4!==t.length)throw new h("Width and height must match the pixels array");let c=[];for(let e=0;e<l;e++)for(let r=0;r<s;r++){const n=0==r&&0==e?1:2,h=f(t,a,o,((t,h)=>n*Math.cos(Math.PI*r*t/a)*Math.cos(Math.PI*e*h/o)));c.push(h)}const M=c[0],i=c.slice(1);let u,m="";if(m+=e(s-1+9*(l-1),1),i.length>0){let t=Math.max(...i.map((t=>Math.max(...t)))),a=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));u=(a+1)/166,m+=e(a,1)}else u=1,m+=e(0,1);var g;return m+=e((r((g=M)[0])<<16)+(r(g[1])<<8)+r(g[2]),4),i.forEach((t=>{m+=e(((t,a)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*n(t[0]/a,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*n(t[1]/a,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*n(t[2]/a,.5)+9.5)))))(t,u),2)})),m})(a,o,s,9,9),64,64),M=new OffscreenCanvas(64,64),i=M.getContext("2d"),u=i.createImageData(64,64);u.data.set(l),i.putImageData(u,0,0);let m=null;try{const t=await M.convertToBlob();m=URL.createObjectURL(t)}catch(t){console.error(t)}console.timeEnd("BackdropBlur process"),postMessage(m)}(t.data)}();
//# sourceMappingURL=src_cfx_apps_mpMenu_parts_ThemeManager_BackdropBlur_worker_ts.chunk.js.map