(()=>{"use strict";function r(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=new Array(t);n15.5?r:"0"+r)+(this.green>15.5?t:"0"+t)+(this.blue>15.5?n:"0"+n)};a.toHSL=function(){return function(r){var t=r.red,n=r.green,e=r.blue,a=r.alpha,i=t/255,o=n/255,u=e/255,l=Math.max(i,o,u),s=Math.min(i,o,u),f=l-s,h=(l+s)/2,c=f>0?f/(1-Math.abs(2*h-1)):0;if(0===f)return{hue:0,saturation:c,lightness:h,alpha:a};var p=0;switch(l){case i:p=(o-u)/f%6;break;case o:p=(u-i)/f+2;break;case u:p=(o-u)/f+4}return{hue:60*p,saturation:c,lightness:h,alpha:a}}({red:this.red,green:this.green,blue:this.blue,alpha:this.alpha})};a.getRelativeLuminance=function(){ var r=this.red/255,t=this.green/255,n=this.blue/255;return.2126*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))};r.parseString=function(r){return null!=r.match(e)?this.parseColorFnString(r):null!=r.match(n)?this.parseHexString(r):void 0};r.parseRgbString=function(t){return"transparent"===t?new r(0,0,0,0):this.parseColorFnString(t)};r.parseHexString=function(e){if(null!=e.match(n)&&![6,8].includes(e.length)){if((e=e.replace("#","")).length<6){var a=t(e,4),i=a[0],o=a[1],u=a[2],l=a[3];e=i+i+o+o+u+u;null!=l&&(e+=l+l)}var s=e.match(/.{1,2}/g);if(null!=s)return new r(parseInt(s[0],16),parseInt(s[1],16),parseInt(s[2],16),null!=s[3]?parseInt(s[3],16)/255:1)}};r.parseColorFnString=function(n){var a,i=t(null!==(a=n.match(e))&&void 0!==a?a:[],3),o=i[1],u=i[2];if(null!=o&&null!=u){var l=u.split(/\s*[,/\s]\s*/).map((function(r){return r.replace(",","").trim()})).filter((function(r){ return""!==r})).map((function(r,t){return function(r,t,n){if(/%$/.test(t))return 3===n?parseFloat(t)/100:255*parseFloat(t)/100;if("h"===r[n]){if(/turn$/.test(t))return 360*parseFloat(t);if(/rad$/.test(t))return 57.3*parseFloat(t)}return parseFloat(t)}(o,r,t)}));if("hsl"===o.substr(0,3)){var s=function(r){var t=r.hue,n=r.saturation,e=r.lightness,a=r.alpha;n/=255;e/=255;var i=(1-Math.abs(2*e-1))*n,o=i*(1-Math.abs(t/60%2-1)),u=e-i/2,l=(t<60?[i,o,0]:t<120?[o,i,0]:t<180?[0,i,o]:t<240?[0,o,i]:t<300?[o,0,i]:[i,0,o]).map((function(r){return Math.round(255*(r+u))}));return{red:l[0],green:l[1],blue:l[2],alpha:a}}({hue:l[0],saturation:l[1],lightness:l[2],alpha:l[3]});return new r(s.red,s.green,s.blue,s.alpha)}return new r(l[0],l[1],l[2],"number"==typeof l[3]?l[3]:1)}};return r}();function i(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=new Array(t);n=i;s--)for(var f=e+o;f>=o;f--)if(l(i,o,e,s,f)){var h=i-(s-i),c=o-(f-o);r.add(u(s,f,n));r.add(u(s,c,n));r.add(u(h,f,n));r.add(u(h,c,n))}return r}function f(r,t,n){ return o(s(new Set,r,n,1)).some((function(r){return t[r+3]<=15}))}self.addEventListener("message",(function(r){var t=r.data,n=t.imageData,e=t.scaledBorderSize,i=t.color,o=t.id,u=function(r,t,n){var e=a.parseString(n),i=new Uint8ClampedArray(r.data.length),o=new Set;if(null==e)throw new Error("Invalid color");for(var u=0;u