1 line
46 KiB
JavaScript
1 line
46 KiB
JavaScript
var e={207:(e,t,r)=>{e.exports=r(452)},659:(e,t,r)=>{const n=r(156),o={};for(const e of Object.keys(n))o[n[e]]=e;const a={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};e.exports=a;for(const e of Object.keys(a)){if(!("channels"in a[e]))throw new Error("missing channels property: "+e);if(!("labels"in a[e]))throw new Error("missing channel labels property: "+e);if(a[e].labels.length!==a[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:r}=a[e];delete a[e].channels,delete a[e].labels,Object.defineProperty(a[e],"channels",{value:t}),Object.defineProperty(a[e],"labels",{value:r})}a.rgb.hsl=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.min(t,r,n),a=Math.max(t,r,n),i=a-o;let s,l;a===o?s=0:t===a?s=(r-n)/i:r===a?s=2+(n-t)/i:n===a&&(s=4+(t-r)/i),s=Math.min(60*s,360),s<0&&(s+=360);const c=(o+a)/2;return l=a===o?0:c<=.5?i/(a+o):i/(2-a-o),[s,100*l,100*c]},a.rgb.hsv=function(e){let t,r,n,o,a;const i=e[0]/255,s=e[1]/255,l=e[2]/255,c=Math.max(i,s,l),u=c-Math.min(i,s,l),h=function(e){return(c-e)/6/u+.5};return 0===u?(o=0,a=0):(a=u/c,t=h(i),r=h(s),n=h(l),i===c?o=n-r:s===c?o=1/3+t-n:l===c&&(o=2/3+r-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*a,100*c]},a.rgb.hwb=function(e){const t=e[0],r=e[1];let n=e[2];const o=a.rgb.hsl(e)[0],i=1/255*Math.min(t,Math.min(r,n));return n=1-1/255*Math.max(t,Math.max(r,n)),[o,100*i,100*n]},a.rgb.cmyk=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.min(1-t,1-r,1-n);return[100*((1-t-o)/(1-o)||0),100*((1-r-o)/(1-o)||0),100*((1-n-o)/(1-o)||0),100*o]},a.rgb.keyword=function(e){const t=o[e];if(t)return t;let r,a=1/0;for(const t of Object.keys(n)){const o=(s=n[t],((i=e)[0]-s[0])**2+(i[1]-s[1])**2+(i[2]-s[2])**2);o<a&&(a=o,r=t)}var i,s;return r},a.keyword.rgb=function(e){return n[e]},a.rgb.xyz=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255;return t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,[100*(.4124*t+.3576*r+.1805*n),100*(.2126*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},a.rgb.lab=function(e){const t=a.rgb.xyz(e);let r=t[0],n=t[1],o=t[2];return r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,[116*n-16,500*(r-n),200*(n-o)]},a.hsl.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;let o,a,i;if(0===r)return i=255*n,[i,i,i];o=n<.5?n*(1+r):n+r-n*r;const s=2*n-o,l=[0,0,0];for(let e=0;e<3;e++)a=t+1/3*-(e-1),a<0&&a++,a>1&&a--,i=6*a<1?s+6*(o-s)*a:2*a<1?o:3*a<2?s+(o-s)*(2/3-a)*6:s,l[e]=255*i;return l},a.hsl.hsv=function(e){const t=e[0];let r=e[1]/100,n=e[2]/100,o=r;const a=Math.max(n,.01);return n*=2,r*=n<=1?n:2-n,o*=a<=1?a:2-a,[t,100*(0===n?2*o/(a+o):2*r/(n+r)),(n+r)/2*100]},a.hsv.rgb=function(e){const t=e[0]/60,r=e[1]/100;let n=e[2]/100;const o=Math.floor(t)%6,a=t-Math.floor(t),i=255*n*(1-r),s=255*n*(1-r*a),l=255*n*(1-r*(1-a));switch(n*=255,o){case 0:return[n,l,i];case 1:return[s,n,i];case 2:return[i,n,l];case 3:return[i,s,n];case 4:return[l,i,n];case 5:return[n,i,s]}},a.hsv.hsl=function(e){const t=e[0],r=e[1]/100,n=e[2]/100,o=Math.max(n,.01);let a,i;i=(2-r)*n;const s=(2-r)*o;return a=r*o,a/=s<=1?s:2-s,a=a||0,i/=2,[t,100*a,100*i]},a.hwb.rgb=function(e){const t=e[0]/360;let r=e[1]/100,n=e[2]/100;const o=r+n;let a;o>1&&(r/=o,n/=o);const i=Math.floor(6*t),s=1-n;a=6*t-i,1&i&&(a=1-a);const l=r+a*(s-r);let c,u,h;switch(i){default:case 6:case 0:c=s,u=l,h=r;break;case 1:c=l,u=s,h=r;break;case 2:c=r,u=s,h=l;break;case 3:c=r,u=l,h=s;break;case 4:c=l,u=r,h=s;break;case 5:c=s,u=r,h=l}return[255*c,255*u,255*h]},a.cmyk.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100,o=e[3]/100;return[255*(1-Math.min(1,t*(1-o)+o)),255*(1-Math.min(1,r*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o))]},a.xyz.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100;let o,a,i;return o=3.2406*t+-1.5372*r+-.4986*n,a=-.9689*t+1.8758*r+.0415*n,i=.0557*t+-.204*r+1.057*n,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,o=Math.min(Math.max(0,o),1),a=Math.min(Math.max(0,a),1),i=Math.min(Math.max(0,i),1),[255*o,255*a,255*i]},a.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];return t/=95.047,r/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,[116*r-16,500*(t-r),200*(r-n)]},a.lab.xyz=function(e){let t,r,n;r=(e[0]+16)/116,t=e[1]/500+r,n=r-e[2]/200;const o=r**3,a=t**3,i=n**3;return r=o>.008856?o:(r-16/116)/7.787,t=a>.008856?a:(t-16/116)/7.787,n=i>.008856?i:(n-16/116)/7.787,t*=95.047,r*=100,n*=108.883,[t,r,n]},a.lab.lch=function(e){const t=e[0],r=e[1],n=e[2];let o;return o=360*Math.atan2(n,r)/2/Math.PI,o<0&&(o+=360),[t,Math.sqrt(r*r+n*n),o]},a.lch.lab=function(e){const t=e[0],r=e[1],n=e[2]/360*2*Math.PI;return[t,r*Math.cos(n),r*Math.sin(n)]},a.rgb.ansi16=function(e,t=null){const[r,n,o]=e;let i=null===t?a.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),0===i)return 30;let s=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return 2===i&&(s+=60),s},a.hsv.ansi16=function(e){return a.rgb.ansi16(a.hsv.rgb(e),e[2])},a.rgb.ansi256=function(e){const t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},a.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},a.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;return e-=16,[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},a.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},a.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let r=t[0];3===t[0].length&&(r=r.split("").map((e=>e+e)).join(""));const n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},a.rgb.hcg=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.max(Math.max(t,r),n),a=Math.min(Math.min(t,r),n),i=o-a;let s,l;return s=i<1?a/(1-i):0,l=i<=0?0:o===t?(r-n)/i%6:o===r?2+(n-t)/i:4+(t-r)/i,l/=6,l%=1,[360*l,100*i,100*s]},a.hsl.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=r<.5?2*t*r:2*t*(1-r);let o=0;return n<1&&(o=(r-.5*n)/(1-n)),[e[0],100*n,100*o]},a.hsv.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=t*r;let o=0;return n<1&&(o=(r-n)/(1-n)),[e[0],100*n,100*o]},a.hcg.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];const o=[0,0,0],a=t%1*6,i=a%1,s=1-i;let l=0;switch(Math.floor(a)){case 0:o[0]=1,o[1]=i,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=i;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=i,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return l=(1-r)*n,[255*(r*o[0]+l),255*(r*o[1]+l),255*(r*o[2]+l)]},a.hcg.hsv=function(e){const t=e[1]/100,r=t+e[2]/100*(1-t);let n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},a.hcg.hsl=function(e){const t=e[1]/100,r=e[2]/100*(1-t)+.5*t;let n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},a.hcg.hwb=function(e){const t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},a.hwb.hcg=function(e){const t=e[1]/100,r=1-e[2]/100,n=r-t;let o=0;return n<1&&(o=(r-n)/(1-n)),[e[0],100*n,100*o]},a.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},a.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},a.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},a.gray.hsl=function(e){return[0,0,e[0]]},a.gray.hsv=a.gray.hsl,a.gray.hwb=function(e){return[0,100,e[0]]},a.gray.cmyk=function(e){return[0,0,0,e[0]]},a.gray.lab=function(e){return[e[0],0,0]},a.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},a.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},734:(e,t,r)=>{const n=r(659),o=r(507),a={};Object.keys(n).forEach((e=>{a[e]={},Object.defineProperty(a[e],"channels",{value:n[e].channels}),Object.defineProperty(a[e],"labels",{value:n[e].labels});const t=o(e);Object.keys(t).forEach((r=>{const n=t[r];a[e][r]=function(e){const t=function(...t){const r=t[0];if(null==r)return r;r.length>1&&(t=r);const n=e(t);if("object"==typeof n)for(let e=n.length,t=0;t<e;t++)n[t]=Math.round(n[t]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}(n),a[e][r].raw=function(e){const t=function(...t){const r=t[0];return null==r?r:(r.length>1&&(t=r),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)}))})),e.exports=a},507:(e,t,r)=>{const n=r(659);function o(e,t){return function(r){return t(e(r))}}function a(e,t){const r=[t[e].parent,e];let a=n[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)r.unshift(t[i].parent),a=o(n[t[i].parent][i],a),i=t[i].parent;return a.conversion=r,a}e.exports=function(e){const t=function(e){const t=function(){const e={},t=Object.keys(n);for(let r=t.length,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}(),r=[e];for(t[e].distance=0;r.length;){const e=r.pop(),o=Object.keys(n[e]);for(let n=o.length,a=0;a<n;a++){const n=o[a],i=t[n];-1===i.distance&&(i.distance=t[e].distance+1,i.parent=e,r.unshift(n))}}return t}(e),r={},o=Object.keys(t);for(let e=o.length,n=0;n<e;n++){const e=o[n];null!==t[e].parent&&(r[e]=a(e,t))}return r}},156:e=>{e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},854:(e,t,r)=>{var n=r(156),o=r(872),a=Object.hasOwnProperty,i={};for(var s in n)a.call(n,s)&&(i[n[s]]=s);var l=e.exports={to:{},get:{}};function c(e,t,r){return Math.min(Math.max(t,e),r)}function u(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}l.get=function(e){var t,r;switch(e.substring(0,3).toLowerCase()){case"hsl":t=l.get.hsl(e),r="hsl";break;case"hwb":t=l.get.hwb(e),r="hwb";break;default:t=l.get.rgb(e),r="rgb"}return t?{model:r,value:t}:null},l.get.rgb=function(e){if(!e)return null;var t,r,o,i=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(o=t[2],t=t[1],r=0;r<3;r++){var s=2*r;i[r]=parseInt(t.slice(s,s+2),16)}o&&(i[3]=parseInt(o,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(o=(t=t[1])[3],r=0;r<3;r++)i[r]=parseInt(t[r]+t[r],16);o&&(i[3]=parseInt(o+o,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(r=0;r<3;r++)i[r]=parseInt(t[r+1],0);t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:a.call(n,t[1])?((i=n[t[1]])[3]=1,i):null:null;for(r=0;r<3;r++)i[r]=Math.round(2.55*parseFloat(t[r+1]));t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[4]))}for(r=0;r<3;r++)i[r]=c(i[r],0,255);return i[3]=c(i[3],0,1),i},l.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,c(parseFloat(t[2]),0,100),c(parseFloat(t[3]),0,100),c(isNaN(r)?1:r,0,1)]}return null},l.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,c(parseFloat(t[2]),0,100),c(parseFloat(t[3]),0,100),c(isNaN(r)?1:r,0,1)]}return null},l.to.hex=function(){var e=o(arguments);return"#"+u(e[0])+u(e[1])+u(e[2])+(e[3]<1?u(Math.round(255*e[3])):"")},l.to.rgb=function(){var e=o(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},l.to.rgb.percent=function(){var e=o(arguments),t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"},l.to.hsl=function(){var e=o(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},l.to.hwb=function(){var e=o(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},l.to.keyword=function(e){return i[e.slice(0,3)]}},520:(e,t,r)=>{const n=r(854),o=r(734),a=[].slice,i=["keyword","gray","hex"],s={};for(const e of Object.keys(o))s[a.call(o[e].labels).sort().join("")]=e;const l={};function c(e,t){if(!(this instanceof c))return new c(e,t);if(t&&t in i&&(t=null),t&&!(t in o))throw new Error("Unknown model: "+t);let r,u;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof c)this.model=e.model,this.color=e.color.slice(),this.valpha=e.valpha;else if("string"==typeof e){const t=n.get(e);if(null===t)throw new Error("Unable to parse color from string: "+e);this.model=t.model,u=o[this.model].channels,this.color=t.value.slice(0,u),this.valpha="number"==typeof t.value[u]?t.value[u]:1}else if(e.length>0){this.model=t||"rgb",u=o[this.model].channels;const r=a.call(e,0,u);this.color=p(r,u),this.valpha="number"==typeof e[u]?e[u]:1}else if("number"==typeof e)this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;const t=Object.keys(e);"alpha"in e&&(t.splice(t.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);const n=t.sort().join("");if(!(n in s))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=s[n];const a=o[this.model].labels,i=[];for(r=0;r<a.length;r++)i.push(e[a[r]]);this.color=p(i)}if(l[this.model])for(u=o[this.model].channels,r=0;r<u;r++){const e=l[this.model][r];e&&(this.color[r]=e(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}c.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in n.to?this:this.rgb();t=t.round("number"==typeof e?e:1);const r=1===t.valpha?t.color:t.color.concat(this.valpha);return n.to[t.model](r)},percentString(e){const t=this.rgb().round("number"==typeof e?e:1),r=1===t.valpha?t.color:t.color.concat(this.valpha);return n.to.rgb.percent(r)},array(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object(){const e={},t=o[this.model].channels,r=o[this.model].labels;for(let n=0;n<t;n++)e[r[n]]=this.color[n];return 1!==this.valpha&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,1!==this.valpha&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,1!==this.valpha&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new c(this.color.map(function(e){return function(t){return function(e,t){return Number(e.toFixed(t))}(t,e)}}(e)).concat(this.valpha),this.model)},alpha(e){return arguments.length>0?new c(this.color.concat(Math.max(0,Math.min(1,e))),this.model):this.valpha},red:u("rgb",0,h(255)),green:u("rgb",1,h(255)),blue:u("rgb",2,h(255)),hue:u(["hsl","hsv","hsl","hwb","hcg"],0,(e=>(e%360+360)%360)),saturationl:u("hsl",1,h(100)),lightness:u("hsl",2,h(100)),saturationv:u("hsv",1,h(100)),value:u("hsv",2,h(100)),chroma:u("hcg",1,h(100)),gray:u("hcg",2,h(100)),white:u("hwb",1,h(100)),wblack:u("hwb",2,h(100)),cyan:u("cmyk",0,h(100)),magenta:u("cmyk",1,h(100)),yellow:u("cmyk",2,h(100)),black:u("cmyk",3,h(100)),x:u("xyz",0,h(100)),y:u("xyz",1,h(100)),z:u("xyz",2,h(100)),l:u("lab",0,h(100)),a:u("lab",1),b:u("lab",2),keyword(e){return arguments.length>0?new c(e):o[this.model].keyword(this.color)},hex(e){return arguments.length>0?new c(e):n.to.hex(this.rgb().round().color)},rgbNumber(){const e=this.rgb().color;return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},luminosity(){const e=this.rgb().color,t=[];for(const[r,n]of e.entries()){const e=n/255;t[r]=e<=.03928?e/12.92:((e+.055)/1.055)**2.4}return.2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(299*e[0]+587*e[1]+114*e[2])/1e3<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return c.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const r=e.rgb(),n=this.rgb(),o=void 0===t?.5:t,a=2*o-1,i=r.alpha()-n.alpha(),s=((a*i==-1?a:(a+i)/(1+a*i))+1)/2,l=1-s;return c.rgb(s*r.red()+l*n.red(),s*r.green()+l*n.green(),s*r.blue()+l*n.blue(),r.alpha()*o+n.alpha()*(1-o))}};for(const e of Object.keys(o)){if(i.includes(e))continue;const t=o[e].channels;c.prototype[e]=function(){if(this.model===e)return new c(this);if(arguments.length>0)return new c(arguments,e);const r="number"==typeof arguments[t]?t:this.valpha;return new c((n=o[this.model][e].raw(this.color),Array.isArray(n)?n:[n]).concat(r),e);var n},c[e]=function(r){return"number"==typeof r&&(r=p(a.call(arguments),t)),new c(r,e)}}function u(e,t,r){e=Array.isArray(e)?e:[e];for(const n of e)(l[n]||(l[n]=[]))[t]=r;return e=e[0],function(n){let o;return arguments.length>0?(r&&(n=r(n)),o=this[e](),o.color[t]=n,o):(o=this[e]().color[t],r&&(o=r(o)),o)}}function h(e){return function(t){return Math.max(0,Math.min(e,t))}}function p(e,t){for(let r=0;r<t;r++)"number"!=typeof e[r]&&(e[r]=0);return e}e.exports=c},195:e=>{e.exports=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))}},452:e=>{var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),i=new P(n||[]);return a._invoke=function(e,t,r){var n=h;return function(o,a){if(n===f)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw a;return C()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=j(i,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=f;var l=u(e,t,r);if("normal"===l.type){if(n=r.done?d:p,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n=d,r.method="throw",r.arg=l.arg)}}}(e,r,i),a}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var h="suspendedStart",p="suspendedYield",f="executing",d="completed",y={};function v(){}function g(){}function m(){}var b={};l(b,a,(function(){return this}));var w=Object.getPrototypeOf,O=w&&w(w(_([])));O&&O!==r&&n.call(O,a)&&(b=O);var k=m.prototype=v.prototype=Object.create(b);function L(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(o,a,i,s){var l=u(e[o],e,a);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(h).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}var o;this._invoke=function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}}function j(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=u(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function _(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}return{next:C}}function C(){return{value:t,done:!0}}return g.prototype=m,l(k,"constructor",m),l(m,"constructor",g),g.displayName=l(m,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},e.awrap=function(e){return{__await:e}},L(x.prototype),l(x.prototype,i,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new x(c(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},L(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=_,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:_(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},872:(e,t,r)=>{var n=r(195),o=Array.prototype.concat,a=Array.prototype.slice,i=e.exports=function(e){for(var t=[],r=0,i=e.length;r<i;r++){var s=e[r];n(s)?t=o.call(t,a.call(s)):t.push(s)}return t};i.wrap=function(e){return function(){return e(i(arguments))}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function h(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t,r,n,o,a,i){try{var s=e[a](i),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,o)}function y(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){d(a,n,o,i,s,"next",e)}function s(e){d(a,n,o,i,s,"throw",e)}i(void 0)}))}}r.d(n,{A:()=>F});var v=r(207);const g={maxLeaves:255,minZoomLevel:0,zoomIncrement:2,closeOnLeafClick:!0,circleSpiralSwitchover:10,circleOptions:{leavesSeparation:50,leavesOffset:[0,0]},spiralOptions:{legLengthStart:25,legLengthFactor:2.2,leavesSeparation:30,leavesOffset:[0,0]},spiderLegsAreHidden:!1,spiderLegsWidth:1,spiderLegsColor:"rgba(100, 100, 100, .7)",spiderLeavesLayout:null,spiderLeavesPaint:null};var m=r(520);function b(e,t){return w.apply(this,arguments)}function w(){return(w=y(v.mark((function e(t,r){var n,o,a;return v.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.map(r),e.next=3,Promise.all(n);case 3:return o=e.sent,a=o.findIndex((function(e){return e})),e.abrupt("return",t[a]);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e,t,r){return k.apply(this,arguments)}function k(){return(k=y(v.mark((function e(t,r,n){return v.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,o){t.getClusterLeaves.toString().includes("sendAsync")?t.getClusterLeaves(r,n,0).then((function(t){e(t)})):t.getClusterLeaves(r,n,0,(function(t,r){t?o(t):e(r)}))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const j=function(){function e(t,r){a(this,e),this.map=t,this.activeSpiderfyLayerIds=[],this.spiderifiedCluster=null,this.clickedParentClusterStyle=null,this.lastHoveredLeaf=null,this.options=x(x(x({},g),r||{}),{},{circleOptions:x(x({},g.circleOptions),(null==r?void 0:r.circleOptions)||{}),spiralOptions:x(x({},g.spiralOptions),(null==r?void 0:r.spiralOptions)||{})}),this.mapevents={click:null,zoom:null,zoomend:null,idle:null,mousemove:null}}return s(e,[{key:"applyTo",value:function(e){var t=this,r=this.map.getLayer(e);if("symbol"===r.type){var n=this.map.getSource(r.source);this.map.once("idle",this.mapevents.idle=function(){var o,a,i,s,l=null!==(o=r.layout)&&void 0!==o&&o._values?{}:r.layout||{},c=null!==(a=r.paint)&&void 0!==a&&a._values?{}:r.paint||{};null!==(i=r.layout)&&void 0!==i&&i._values&&Object.keys(r.layout._values).forEach((function(e){var t,n;l[e]=(null===(t=r.layout._values[e])||void 0===t||null===(n=t.value)||void 0===n?void 0:n.value)||r.layout._values[e]})),null!==(s=r.paint)&&void 0!==s&&s._values&&Object.keys(r.paint._values).forEach((function(e){var t,n;c[e]=(null===(t=r.paint._values[e])||void 0===t||null===(n=t.value)||void 0===n?void 0:n.value)||r.paint._values[e]})),t.map.on("click",t.mapevents.click=function(o){var a,i,s,u,h=t.options,p=h.maxLeaves,f=h.closeOnLeafClick,d=h.minZoomLevel,y=h.zoomIncrement,v=t.map.queryRenderedFeatures(o.point),g=v.find((function(t){return t.layer.id.includes("".concat(e,"-spiderfy-leaf"))}));if(g){var m,b=null===(m=t.spiderifiedCluster)||void 0===m?void 0:m.leaves[g.layer.id.split("-spiderfy-leaf")[1]];return t.options.onLeafClick&&t.options.onLeafClick(b,o),void(f&&t._clearSpiderifiedCluster())}var w=v.find((function(t){var r;return t.layer.id===e&&(null===(r=t.properties)||void 0===r?void 0:r.cluster)})),O=null===(a=t.spiderifiedCluster)||void 0===a||null===(i=a.cluster)||void 0===i||null===(s=i.properties)||void 0===s?void 0:s.cluster_id;if(w&&t.map.getZoom()<d)y&&t.map.flyTo({center:o.lngLat.toArray(),zoom:t.map.getZoom()+y});else if((!t.spiderifiedCluster||O!==(null==w||null===(u=w.properties)||void 0===u?void 0:u.cluster_id))&&(t._clearSpiderifiedCluster(),w)){t.clickedParentClusterStyle={type:r.type,layout:l,paint:c};var k=w.properties.cluster_id;n.getClusterLeaves.toString().includes("sendAsync")?n.getClusterLeaves(k,p,0).then((function(r){t.spiderifiedCluster={cluster:w,leaves:r},t._createSpiderfyLayers(e,r,w.geometry.coordinates)})):n.getClusterLeaves(k,p,0,(function(r,n){t.spiderifiedCluster={cluster:w,leaves:n},t._createSpiderfyLayers(e,n,w.geometry.coordinates)}))}}),t.options.onLeafHover&&t.map.on("mousemove",t.mapevents.mousemove=function(r){var n,o=t.map.queryRenderedFeatures(r.point).find((function(t){return t.layer.id.includes("".concat(e,"-spiderfy-leaf"))}));if((null==o?void 0:o.source)!==(null===(n=t.lastHoveredLeaf)||void 0===n?void 0:n.source))if(o){var a,i=null===(a=t.spiderifiedCluster)||void 0===a?void 0:a.leaves[o.layer.id.split("-spiderfy-leaf")[1]];t.options.onLeafHover(i,r)}else t.options.onLeafHover(null,r);t.lastHoveredLeaf=o}),t.map.on("zoom",t.mapevents.zoom=y(v.mark((function o(){var a,i,s,l,c;return v.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(t.spiderifiedCluster){o.next=2;break}return o.abrupt("return");case 2:return a=t.spiderifiedCluster,i=t.options.maxLeaves,s=t.map.querySourceFeatures(r.source,{sourceLayer:e}).filter((function(e){return e.properties.cluster})),o.next=7,b(s,function(){var e=y(v.mark((function e(t){var r,o;return v.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.properties.cluster_id,e.next=3,O(n,r,i);case 3:return o=e.sent,e.abrupt("return",JSON.stringify(o)===JSON.stringify(a.leaves));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 7:(l=o.sent)?(c=l.geometry.coordinates,t.spiderifiedCluster.cluster.geometry.coordinates=c):t._clearSpiderifiedCluster();case 9:case"end":return o.stop()}}),o)})))),t.map.on("zoomend",t.mapevents.zoomend=function(){t._updateSpiderifiedClusterCoords()})})}else console.error("map-gl-js-spiderfy found '".concat(r.type,"' as layer type but only 'symbol' is supported"))}},{key:"unspiderfyAll",value:function(){this.mapevents.click&&(this.map.off("click",this.mapevents.click),this.mapevents.click=null),this.mapevents.zoom&&(this.map.off("zoom",this.mapevents.zoom),this.mapevents.zoom=null),this.mapevents.zoomend&&(this.map.off("zoomend",this.mapevents.zoomend),this.mapevents.zoomend=null),this.mapevents.idle&&(this.map.off("idle",this.mapevents.idle),this.mapevents.idle=null),this.mapevents.mousemove&&(this.map.off("mousemove",this.mapevents.mousemove),this.mapevents.mousemove=null),this._clearSpiderifiedCluster()}},{key:"_calculatePointsInCircle",value:function(e){for(var t=this.options.circleOptions,r=t.leavesSeparation,n=t.leavesOffset,o=[],a=2*Math.PI/e,i=a,s=0;s<e;s+=1){i=a*s;var l=r*Math.cos(i)+n[0],c=r*Math.sin(i)+n[1];o.push([l,c])}return o}},{key:"_calculatePointsInSpiral",value:function(e){for(var t=this.options.spiralOptions,r=t.legLengthStart,n=t.legLengthFactor,o=t.leavesSeparation,a=t.leavesOffset,i=[],s=r,l=0,c=0;c<e;c+=1){l+=o/s+5e-4*c;var u=s*Math.cos(l)+a[0],h=s*Math.sin(l)+a[1];i.push([u,h]),s+=2*Math.PI*n/l}return i}},{key:"_clearSpiderifiedCluster",value:function(){var e,t=this;(e=this.activeSpiderfyLayerIds,function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).forEach((function(e){t.map.removeLayer(e),t.map.removeSource(e)})),this.spiderifiedCluster=null,this.activeSpiderfyLayerIds=[]}}]),e}();function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const P=function(){c(n,j);var e,t,r=(e=n,t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var r,n=p(e);if(t){var o=p(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h(this,r)});function n(){return a(this,n),r.apply(this,arguments)}return s(n,[{key:"_createSpiderfyLayers",value:function(e,t,r){var n=this.options,o=n.circleSpiralSwitchover,a=n.spiderLegsAreHidden,i=t.length<o,s=i?this._calculatePointsInCircle(t.length):this._calculatePointsInSpiral(t.length),l=!a&&this._generateLegs(s,i);this._drawFeaturesOnMap(s,l,e,r)}},{key:"_generateLegs",value:function(e,t){var r,n=this.options,o=n.spiderLegsWidth,a=n.spiderLegsColor,i=[];return e.forEach((function(e,n){t&&0!==n||(r=function(e,t,r,n){for(var o=m(n),a=e[0]-t[0],i=e[1]-t[1],s=Math.round(Math.sqrt(a*a+i*i)),l=new Uint8Array(s*r*4),c=0;c<r;c+=1)for(var u=0;u<s;u+=1){var h=4*(u*r+c);l[h+0]=o.red(),l[h+1]=o.green(),l[h+2]=o.blue(),l[h+3]=255*o.alpha()}return{width:r,height:s,data:l}}([0,0],e,o,a));var s,l,c={img:r,rotation:90+(s=e[0],l=e[1],180*Math.atan2(l,s)/Math.PI)};i.push(c)})),i}},{key:"_drawFeaturesOnMap",value:function(e,t,r,n){var o=this,a=this.clickedParentClusterStyle,i=a.layout,s=a.paint,l=this.options,c=l.spiderLegsAreHidden,u=l.spiderLeavesLayout,h=l.spiderLeavesPaint;e.forEach((function(e,a){var l,p,f={type:"Feature",geometry:{type:"Point",coordinates:n},properties:(null===(l=o.spiderifiedCluster)||void 0===l||null===(p=l.leaves[a])||void 0===p?void 0:p.properties)||{}};c||(o.map.hasImage("".concat(r,"-spiderfy-leg").concat(a))&&o.map.removeImage("".concat(r,"-spiderfy-leg").concat(a)),o.map.addImage("".concat(r,"-spiderfy-leg").concat(a),t[a].img),o.map.addLayer({id:"".concat(r,"-spiderfy-leg").concat(a),type:"symbol",source:{type:"geojson",data:{type:"FeatureCollection",features:[f]}},layout:{"icon-image":"".concat(r,"-spiderfy-leg").concat(a),"icon-allow-overlap":!0,"icon-anchor":"bottom","icon-rotate":t[a].rotation}}),o.activeSpiderfyLayerIds.push("".concat(r,"-spiderfy-leg").concat(a)),o.map.moveLayer("".concat(r,"-spiderfy-leg").concat(a),r)),o.map.addLayer({id:"".concat(r,"-spiderfy-leaf").concat(a),source:{type:"geojson",data:{type:"FeatureCollection",features:[f]}},type:"symbol",layout:S(S(S({},u),u?{}:i),{},{"icon-allow-overlap":!0,"text-allow-overlap":!0,"icon-offset":e,"text-offset":[e[0]/12,e[1]/12]}),paint:S(S(S({},h),h?{}:s),h||u||!s["icon-color"]?{}:{"icon-color":s["icon-color"].toString()})}),o.activeSpiderfyLayerIds.push("".concat(r,"-spiderfy-leaf").concat(a))}))}},{key:"_updateSpiderifiedClusterCoords",value:function(){var e=this;this.spiderifiedCluster&&this.activeSpiderfyLayerIds.forEach((function(t){var r,n=e.spiderifiedCluster.cluster.geometry.coordinates,o=e.map.getSource(t),a=null===(r=e.spiderifiedCluster)||void 0===r?void 0:r.leaves[t.split("-spiderfy-leaf")[1]];o.setData({type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:n},properties:(null==a?void 0:a.properties)||{}}]})}))}}]),n}();function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const E=function(){c(n,j);var e,t,r=(e=n,t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var r,n=p(e);if(t){var o=p(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h(this,r)});function n(e,t){var o;return a(this,n),(o=r.call(this,e,t))._points=[],o}return s(n,[{key:"_createSpiderfyLayers",value:function(e,t,r){var n=t.length<this.options.circleSpiralSwitchover;this._points=n?this._calculatePointsInCircle(t.length):this._calculatePointsInSpiral(t.length);var o=this._generateFeatures(this._points,r),a=o.spiderLeaves,i=o.spiderLegs;this._drawFeaturesOnMap(a,i,e)}},{key:"_generateFeatures",value:function(e,t){for(var r=this.map.project(t),n=[],o=[],a=0;a<e.length;a+=1){var i,s,l=this.map.unproject([r.x+e[a][0],r.y+e[a][1]]);n.push({type:"Feature",geometry:{type:"Point",coordinates:[l.lng,l.lat]},properties:(null===(i=this.spiderifiedCluster)||void 0===i||null===(s=i.leaves[a])||void 0===s?void 0:s.properties)||{},id:a}),this.options.spiderLegsAreHidden||o.push({type:"Feature",geometry:{type:"LineString",coordinates:[t,[l.lng,l.lat]]},id:a})}return{spiderLeaves:n,spiderLegs:o}}},{key:"_drawFeaturesOnMap",value:function(e,t,r){var n=this,o=this.options,a=o.spiderLegsWidth,i=o.spiderLegsColor,s=o.spiderLegsAreHidden,l=o.spiderLeavesLayout,c=o.spiderLeavesPaint,u=this.clickedParentClusterStyle,h=u.layout,p=u.paint;s||t.forEach((function(e,t){n.map.addLayer({id:"".concat(r,"-spiderfy-leg").concat(t),source:{type:"geojson",data:{type:"FeatureCollection",features:[e]}},type:"line",paint:{"line-width":a,"line-color":i}}),n.activeSpiderfyLayerIds.push("".concat(r,"-spiderfy-leg").concat(t)),n.map.moveLayer("".concat(r,"-spiderfy-leg").concat(t),r)})),e.forEach((function(e,t){n.map.addLayer({id:"".concat(r,"-spiderfy-leaf").concat(t),source:{type:"geojson",data:{type:"FeatureCollection",features:[e]}},type:"symbol",layout:C(C({},l),l?{}:h),paint:C(C(C({},c),c?{}:p),!c&&p["icon-color"]?{"icon-color":p["icon-color"].toString()}:{})}),n.activeSpiderfyLayerIds.push("".concat(r,"-spiderfy-leaf").concat(t))}))}},{key:"_updateSpiderifiedClusterCoords",value:function(){var e=this;if(this.spiderifiedCluster){var t=this.spiderifiedCluster.cluster.geometry.coordinates,r=this.map.project(t);this.activeSpiderfyLayerIds.forEach((function(n){var o,a,i=e.map.getSource(n),s=n.includes("-spiderfy-leaf")?n.substring(n.indexOf("-spiderfy-leaf")+14):n.substring(n.indexOf("-spiderfy-leg")+13),l=e.map.unproject([r.x+e._points[s][0],r.y+e._points[s][1]]);n.includes("-spiderfy-leaf")?i.setData({type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:[l.lng,l.lat]},properties:(null===(o=e.spiderifiedCluster)||void 0===o||null===(a=o.leaves[s])||void 0===a?void 0:a.properties)||{}}]}):i.setData({type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:[t,[l.lng,l.lat]]}}]})}))}}}]),n}();function F(e,t){return"3D"===((null==t?void 0:t.renderMethod)&&t.renderMethod.toUpperCase())?new E(e,t):new P(e,t)}var I=n.A;export{I as default}; |