(()=>{"use strict";(()=>{if("undefined"!=typeof __webpack_require__){var t=__webpack_require__.u,e=__webpack_require__.e,a={},r={};__webpack_require__.u=function(e){return t(e)+(a.hasOwnProperty(e)?"?"+a[e]:"")},__webpack_require__.e=function(h){return e(h).catch((function(e){var o=r.hasOwnProperty(h)?r[h]:3;if(o<1){var n=t(h);throw e.message="Loading chunk "+h+" failed after 3 retries.\n("+n+")",e.request=n,e}return new Promise((function(t){setTimeout((function(){var e=Date.now();a[h]=e,r[h]=o-1,t(__webpack_require__.e(h))}),500)}))}))}}})();var 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","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=(e,a)=>{var r="";for(let h=1;h<=a;h++){let o=Math.floor(e)/Math.pow(83,a-h)%83;r+=t[Math.floor(o)]}return r},a=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},r=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},h=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),o=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},n=(t,e,r,h)=>{let o=0,n=0,i=0,s=4*e;for(let l=0;l<e;l++){let e=4*l;for(let u=0;u<r;u++){let r=e+u*s,M=h(l,u);o+=M*a(t[r]),n+=M*a(t[r+1]),i+=M*a(t[r+2])}}let l=1/(e*r);return[o*l,n*l,i*l]},i=(t,a,i,s,l)=>{if(s<1||s>9||l<1||l>9)throw new o("BlurHash must have between 1 and 9 components");if(a*i*4!==t.length)throw new o("Width and height must match the pixels array");let u=[];for(let e=0;e<l;e++)for(let r=0;r<s;r++){let h=0==r&&0==e?1:2,o=n(t,a,i,((t,o)=>h*Math.cos(Math.PI*r*t/a)*Math.cos(Math.PI*e*o/i)));u.push(o)}let M,f=u[0],_=u.slice(1),c="";if(c+=e(s-1+9*(l-1),1),_.length>0){let t=Math.max(..._.map((t=>Math.max(...t)))),a=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));M=(a+1)/166,c+=e(a,1)}else M=1,c+=e(0,1);return c+=e((t=>(r(t[0])<<16)+(r(t[1])<<8)+r(t[2]))(f),4),_.forEach((t=>{c+=e(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*h(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*h(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*h(t[2]/e,.5)+9.5)))))(t,M),2)})),c};const s=self;s.addEventListener("message",(t=>{const{seq:e,imageData:a}=t.data,r=i(a.data,a.width,a.height,a.width>=a.height?4:3,a.height>=a.width?4:3);s.postMessage({seq:e,blurhash:r})}))})();
//# sourceMappingURL=blurhash.worker.js.map