m={};g(e);const M=function(f){const p=E(L(f));return l&&p[l]?p[l]():p};return M.classes=function(f){if(f!=null){if(x(f)==="array")i=f,s=[f[0],f[f.length-1]];else{const p=E.analyze(s);f===0?i=[p.min,p.max]:i=E.limits(p,"e",f)}return M}return i},M.domain=function(f){if(!arguments.length)return s;h=f[0],u=f[f.length-1],o=[];const p=c.length;if(f.length===p&&h!==u)for(let $ of Array.from(f))o.push(($-h)/(u-h));else{for(let $=0;$2){const $=f.map((S,C)=>C/(f.length-1)),_=f.map(S=>(S-h)/(u-h));_.every((S,C)=>$[C]===S)||(O=S=>{if(S<=0||S>=1)return S;let C=0;for(;S>=_[C+1];)C++;const N=(S-_[C])/(_[C+1]-_[C]);return $[C]+N*($[C+1]-$[C])})}}return s=[h,u],M},M.mode=function(f){return arguments.length?(t=f,k(),M):t},M.range=function(f,p){return g(f),M},M.out=function(f){return l=f,M},M.spread=function(f){return arguments.length?(n=f,M):n},M.correctLightness=function(f){return f==null&&(f=!0),b=f,k(),b?z=function(p){const $=L(0,!0).lab()[0],_=L(1,!0).lab()[0],S=$>_;let C=L(p,!0).lab()[0];const N=$+(_-$)*p;let W=C-N,Lt=0,Vt=1,qt=20;for(;Math.abs(W)>.01&&qt-- >0;)(function(){return S&&(W*=-1),W<0?(Lt=p,p+=(Vt-p)*.5):(Vt=p,p+=(Lt-p)*.5),C=L(p,!0).lab()[0],W=C-N})();return p}:z=p=>p,M},M.padding=function(f){return f!=null?(x(f)==="number"&&(f=[f,f]),a=f,M):a},M.colors=function(f,p){arguments.length<2&&(p="hex");let $=[];if(arguments.length===0)$=c.slice(0);else if(f===1)$=[M(.5)];else if(f>1){const _=s[0],S=s[1]-_;$=is(0,f).map(C=>M(_+C/(f-1)*S))}else{e=[];let _=[];if(i&&i.length>2)for(let S=1,C=i.length,N=1<=C;N?SC;N?S++:S--)_.push((i[S-1]+i[S])*.5);else _=s;$=_.map(S=>M(S))}return E[p]&&($=$.map(_=>_[p]())),$},M.cache=function(f){return f!=null?(v=f,M):v},M.gamma=function(f){return f!=null?(P=f,M):P},M.nodata=function(f){return f!=null?(r=E(f),M):r},M}function is(e,t,r){let n=[],s=eo;s?a++:a--)n.push(a);return n}const cs=function(e){let t=[1,1];for(let r=1;rnew d(o)),e.length===2)[r,n]=e.map(o=>o.lab()),t=function(o){const a=[0,1,2].map(i=>r[i]+o*(n[i]-r[i]));return new d(a,"lab")};else if(e.length===3)[r,n,s]=e.map(o=>o.lab()),t=function(o){const a=[0,1,2].map(i=>(1-o)*(1-o)*r[i]+2*(1-o)*o*n[i]+o*o*s[i]);return new d(a,"lab")};else if(e.length===4){let o;[r,n,s,o]=e.map(a=>a.lab()),t=function(a){const i=[0,1,2].map(c=>(1-a)*(1-a)*(1-a)*r[c]+3*(1-a)*(1-a)*a*n[c]+3*(1-a)*a*a*s[c]+a*a*a*o[c]);return new d(i,"lab")}}else if(e.length>=5){let o,a,i;o=e.map(c=>c.lab()),i=e.length-1,a=cs(i),t=function(c){const l=1-c,h=[0,1,2].map(u=>o.reduce((b,m,v)=>b+a[v]*l**(i-v)*c**v*m[u],0));return new d(h,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return t},fs=e=>{const t=ls(e);return t.scale=()=>Ht(t),t},{round:or}=Math;d.prototype.rgb=function(e=!0){return e===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(or)},d.prototype.rgba=function(e=!0){return this._rgb.slice(0,4).map((t,r)=>r<3?e===!1?t:or(t):t)},Object.assign(E,{rgb:(...e)=>new d(...e,"rgb")}),w.format.rgb=(...e)=>{const t=A(e,"rgba");return t[3]===void 0&&(t[3]=1),t},w.autodetect.push({p:3,test:(...e)=>{if(e=A(e,"rgba"),x(e)==="array"&&(e.length===3||e.length===4&&x(e[3])=="number"&&e[3]>=0&&e[3]<=1))return"rgb"}});const I=(e,t,r)=>{if(!I[r])throw new Error("unknown blend mode "+r);return I[r](e,t)},st=e=>(t,r)=>{const n=E(r).rgb(),s=E(t).rgb();return E.rgb(e(n,s))},ot=e=>(t,r)=>{const n=[];return n[0]=e(t[0],r[0]),n[1]=e(t[1],r[1]),n[2]=e(t[2],r[2]),n},hs=e=>e,us=(e,t)=>e*t/255,ds=(e,t)=>e>t?t:e,bs=(e,t)=>e>t?e:t,ps=(e,t)=>255*(1-(1-e/255)*(1-t/255)),ms=(e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255)),gs=(e,t)=>255*(1-(1-t/255)/(e/255)),ys=(e,t)=>e===255?255:(e=255*(t/255)/(1-e/255),e>255?255:e);I.normal=st(ot(hs)),I.multiply=st(ot(us)),I.screen=st(ot(ps)),I.overlay=st(ot(ms)),I.darken=st(ot(ds)),I.lighten=st(ot(bs)),I.dodge=st(ot(ys)),I.burn=st(ot(gs));const{pow:vs,sin:_s,cos:$s}=Math;function ws(e=300,t=-1.5,r=1,n=1,s=[0,1]){let o=0,a;x(s)==="array"?a=s[1]-s[0]:(a=0,s=[s,s]);const i=function(c){const l=K*((e+120)/360+t*c),h=vs(s[0]+a*c,n),b=(o!==0?r[0]+c*o:r)*h*(1-h)/2,m=$s(l),v=_s(l),P=h+b*(-.14861*m+1.78277*v),g=h+b*(-.29227*m-.90649*v),y=h+b*(1.97294*m);return E(ee([P*255,g*255,y*255,1]))};return i.start=function(c){return c==null?e:(e=c,i)},i.rotations=function(c){return c==null?t:(t=c,i)},i.gamma=function(c){return c==null?n:(n=c,i)},i.hue=function(c){return c==null?r:(r=c,x(r)==="array"?(o=r[1]-r[0],o===0&&(r=r[1])):o=0,i)},i.lightness=function(c){return c==null?s:(x(c)==="array"?(s=c,a=c[1]-c[0]):(s=[c,c],a=0),i)},i.scale=()=>E.scale(i),i.hue(r),i}const As="0123456789abcdef",{floor:ks,random:xs}=Math,Es=()=>{let e="#";for(let t=0;t<6;t++)e+=As.charAt(ks(xs()*16));return new d(e,"hex")},{log:ar,pow:Ms,floor:Ss,abs:Cs}=Math;function ir(e,t=null){const r={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return x(e)==="object"&&(e=Object.values(e)),e.forEach(n=>{t&&x(n)==="object"&&(n=n[t]),n!=null&&!isNaN(n)&&(r.values.push(n),r.sum+=n,nr.max&&(r.max=n),r.count+=1)}),r.domain=[r.min,r.max],r.limits=(n,s)=>cr(r,n,s),r}function cr(e,t="equal",r=7){x(e)=="array"&&(e=ir(e));const{min:n,max:s}=e,o=e.values.sort((i,c)=>i-c);if(r===1)return[n,s];const a=[];if(t.substr(0,1)==="c"&&(a.push(n),a.push(s)),t.substr(0,1)==="e"){a.push(n);for(let i=1;i 0");const i=Math.LOG10E*ar(n),c=Math.LOG10E*ar(s);a.push(n);for(let l=1;l200&&(u=!1)}const v={};for(let g=0;gg-y),a.push(P[0]);for(let g=1;g{e=new d(e),t=new d(t);const r=e.luminance(),n=t.luminance();return r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)};/**
* @license
*
* The APCA contrast prediction algorithm is based of the formulas published
* in the APCA-1.0.98G specification by Myndex. The specification is available at:
* https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg
*
* Note that the APCA implementation is still beta, so please update to
* future versions of chroma.js when they become available.
*
* You can read more about the APCA Readability Criterion at
* https://readtech.org/ARC/
*/const lr=.027,Ns=5e-4,Rs=.1,fr=1.14,Bt=.022,hr=1.414,Ls=(e,t)=>{e=new d(e),t=new d(t),e.alpha()<1&&(e=pt(t,e,e.alpha(),"rgb"));const r=ur(...e.rgb()),n=ur(...t.rgb()),s=r>=Bt?r:r+Math.pow(Bt-r,hr),o=n>=Bt?n:n+Math.pow(Bt-n,hr),a=Math.pow(o,.56)-Math.pow(s,.57),i=Math.pow(o,.65)-Math.pow(s,.62),c=Math.abs(o-s)0?c-lr:c+lr)*100};function ur(e,t,r){return .2126729*Math.pow(e/255,2.4)+.7151522*Math.pow(t/255,2.4)+.072175*Math.pow(r/255,2.4)}const{sqrt:J,pow:T,min:Os,max:zs,atan2:dr,abs:br,cos:Dt,sin:pr,exp:Ts,PI:mr}=Math;function js(e,t,r=1,n=1,s=1){var o=function(Me){return 360*Me/(2*mr)},a=function(Me){return 2*mr*Me/360};e=new d(e),t=new d(t);const[i,c,l]=Array.from(e.lab()),[h,u,b]=Array.from(t.lab()),m=(i+h)/2,v=J(T(c,2)+T(l,2)),P=J(T(u,2)+T(b,2)),g=(v+P)/2,y=.5*(1-J(T(g,7)/(T(g,7)+T(25,7)))),z=c*(1+y),O=u*(1+y),L=J(T(z,2)+T(l,2)),k=J(T(O,2)+T(b,2)),M=(L+k)/2,f=o(dr(l,z)),p=o(dr(b,O)),$=f>=0?f:f+360,_=p>=0?p:p+360,S=br($-_)>180?($+_+360)/2:($+_)/2,C=1-.17*Dt(a(S-30))+.24*Dt(a(2*S))+.32*Dt(a(3*S+6))-.2*Dt(a(4*S-63));let N=_-$;N=br(N)<=180?N:_<=$?N+360:N-360,N=2*J(L*k)*pr(a(N)/2);const W=h-i,Lt=k-L,Vt=1+.015*T(m-50,2)/J(20+T(m-50,2)),qt=1+.045*M,Tr=1+.015*M*C,co=30*Ts(-T((S-275)/25,2)),lo=-(2*J(T(M,7)/(T(M,7)+T(25,7))))*pr(2*a(co)),fo=J(T(W/(r*Vt),2)+T(Lt/(n*qt),2)+T(N/(s*Tr),2)+lo*(Lt/(n*qt))*(N/(s*Tr)));return zs(0,Os(100,fo))}function Us(e,t,r="lab"){e=new d(e),t=new d(t);const n=e.get(r),s=t.get(r);let o=0;for(let a in n){const i=(n[a]||0)-(s[a]||0);o+=i*i}return Math.sqrt(o)}const Ys=(...e)=>{try{return new d(...e),!0}catch{return!1}},Hs={cool(){return Ht([E.hsl(180,1,.9),E.hsl(250,.7,.4)])},hot(){return Ht(["#000","#f00","#ff0","#fff"]).mode("rgb")}},ye={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},gr=Object.keys(ye),yr=new Map(gr.map(e=>[e.toLowerCase(),e])),Bs=typeof Proxy=="function"?new Proxy(ye,{get(e,t){const r=t.toLowerCase();if(yr.has(r))return e[yr.get(r)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(gr)}}):ye,Ds=(...e)=>{e=A(e,"cmyk");const[t,r,n,s]=e,o=e.length>4?e[4]:1;return s===1?[0,0,0,o]:[t>=1?0:255*(1-t)*(1-s),r>=1?0:255*(1-r)*(1-s),n>=1?0:255*(1-n)*(1-s),o]},{max:vr}=Math,Gs=(...e)=>{let[t,r,n]=A(e,"rgb");t=t/255,r=r/255,n=n/255;const s=1-vr(t,vr(r,n)),o=s<1?1/(1-s):0,a=(1-t-s)*o,i=(1-r-s)*o,c=(1-n-s)*o;return[a,i,c,s]};d.prototype.cmyk=function(){return Gs(this._rgb)},Object.assign(E,{cmyk:(...e)=>new d(...e,"cmyk")}),w.format.cmyk=Ds,w.autodetect.push({p:2,test:(...e)=>{if(e=A(e,"cmyk"),x(e)==="array"&&e.length===4)return"cmyk"}});const Xs=(...e)=>{const t=A(e,"hsla");let r=dt(e)||"lsa";return t[0]=G(t[0]||0)+"deg",t[1]=G(t[1]*100)+"%",t[2]=G(t[2]*100)+"%",r==="hsla"||t.length>3&&t[3]<1?(t[3]="/ "+(t.length>3?t[3]:1),r="hsla"):t.length=3,`${r.substr(0,3)}(${t.join(" ")})`},Is=(...e)=>{const t=A(e,"lab");let r=dt(e)||"lab";return t[0]=G(t[0])+"%",t[1]=G(t[1]),t[2]=G(t[2]),r==="laba"||t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`lab(${t.join(" ")})`},Vs=(...e)=>{const t=A(e,"lch");let r=dt(e)||"lab";return t[0]=G(t[0])+"%",t[1]=G(t[1]),t[2]=isNaN(t[2])?"none":G(t[2])+"deg",r==="lcha"||t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`lch(${t.join(" ")})`},qs=(...e)=>{const t=A(e,"lab");return t[0]=G(t[0]*100)+"%",t[1]=re(t[1]),t[2]=re(t[2]),t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`oklab(${t.join(" ")})`},_r=(...e)=>{const[t,r,n,...s]=A(e,"rgb"),[o,a,i]=be(t,r,n),[c,l,h]=tr(o,a,i);return[c,l,h,...s.length>0&&s[0]<1?[s[0]]:[]]},Zs=(...e)=>{const t=A(e,"lch");return t[0]=G(t[0]*100)+"%",t[1]=re(t[1]),t[2]=isNaN(t[2])?"none":G(t[2])+"deg",t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`oklch(${t.join(" ")})`},{round:ve}=Math,Ws=(...e)=>{const t=A(e,"rgba");let r=dt(e)||"rgb";if(r.substr(0,3)==="hsl")return Xs(rr(t),r);if(r.substr(0,3)==="lab"){const n=Rt();F("d50");const s=Is(ae(t),r);return F(n),s}if(r.substr(0,3)==="lch"){const n=Rt();F("d50");const s=Vs(fe(t),r);return F(n),s}return r.substr(0,5)==="oklab"?qs(be(t)):r.substr(0,5)==="oklch"?Zs(_r(t)):(t[0]=ve(t[0]),t[1]=ve(t[1]),t[2]=ve(t[2]),(r==="rgba"||t.length>3&&t[3]<1)&&(t[3]="/ "+(t.length>3?t[3]:1),r="rgba"),`${r.substr(0,3)}(${t.slice(0,r==="rgb"?3:4).join(" ")})`)},$r=(...e)=>{e=A(e,"lch");const[t,r,n,...s]=e,[o,a,i]=Qe(t,r,n),[c,l,h]=de(o,a,i);return[c,l,h,...s.length>0&&s[0]<1?[s[0]]:[]]},Q=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,V=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,Gt=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,X=/\s*/.source,vt=/\s+/.source,_e=/\s*,\s*/.source,Xt=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,_t=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,wr=new RegExp("^rgba?\\("+X+[Q,Q,Q].join(vt)+_t+"\\)$"),Ar=new RegExp("^rgb\\("+X+[Q,Q,Q].join(_e)+X+"\\)$"),kr=new RegExp("^rgba\\("+X+[Q,Q,Q,V].join(_e)+X+"\\)$"),xr=new RegExp("^hsla?\\("+X+[Xt,Gt,Gt].join(vt)+_t+"\\)$"),Er=new RegExp("^hsl?\\("+X+[Xt,Gt,Gt].join(_e)+X+"\\)$"),Mr=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Sr=new RegExp("^lab\\("+X+[V,V,V].join(vt)+_t+"\\)$"),Cr=new RegExp("^lch\\("+X+[V,V,Xt].join(vt)+_t+"\\)$"),Pr=new RegExp("^oklab\\("+X+[V,V,V].join(vt)+_t+"\\)$"),Nr=new RegExp("^oklch\\("+X+[V,V,Xt].join(vt)+_t+"\\)$"),{round:Rr}=Math,$t=e=>e.map((t,r)=>r<=2?lt(Rr(t),0,255):t),j=(e,t=0,r=100,n=!1)=>(typeof e=="string"&&e.endsWith("%")&&(e=parseFloat(e.substring(0,e.length-1))/100,n?e=t+(e+1)*.5*(r-t):e=t+e*(r-t)),+e),D=(e,t)=>e==="none"?t:e,$e=e=>{if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t;if(w.format.named)try{return w.format.named(e)}catch{}if((t=e.match(wr))||(t=e.match(Ar))){let r=t.slice(1,4);for(let s=0;s<3;s++)r[s]=+j(D(r[s],0),0,255);r=$t(r);const n=t[4]!==void 0?+j(t[4],0,1):1;return r[3]=n,r}if(t=e.match(kr)){const r=t.slice(1,5);for(let n=0;n<4;n++)r[n]=+j(r[n],0,255);return r}if((t=e.match(xr))||(t=e.match(Er))){const r=t.slice(1,4);r[0]=+D(r[0].replace("deg",""),0),r[1]=+j(D(r[1],0),0,100)*.01,r[2]=+j(D(r[2],0),0,100)*.01;const n=$t(ue(r)),s=t[4]!==void 0?+j(t[4],0,1):1;return n[3]=s,n}if(t=e.match(Mr)){const r=t.slice(1,4);r[1]*=.01,r[2]*=.01;const n=ue(r);for(let s=0;s<3;s++)n[s]=Rr(n[s]);return n[3]=+t[4],n}if(t=e.match(Sr)){const r=t.slice(1,4);r[0]=j(D(r[0],0),0,100),r[1]=j(D(r[1],0),-125,125,!0),r[2]=j(D(r[2],0),-125,125,!0);const n=Rt();F("d50");const s=$t(se(r));F(n);const o=t[4]!==void 0?+j(t[4],0,1):1;return s[3]=o,s}if(t=e.match(Cr)){const r=t.slice(1,4);r[0]=j(r[0],0,100),r[1]=j(D(r[1],0),0,150,!1),r[2]=+D(r[2].replace("deg",""),0);const n=Rt();F("d50");const s=$t(le(r));F(n);const o=t[4]!==void 0?+j(t[4],0,1):1;return s[3]=o,s}if(t=e.match(Pr)){const r=t.slice(1,4);r[0]=j(D(r[0],0),0,1),r[1]=j(D(r[1],0),-.4,.4,!0),r[2]=j(D(r[2],0),-.4,.4,!0);const n=$t(de(r)),s=t[4]!==void 0?+j(t[4],0,1):1;return n[3]=s,n}if(t=e.match(Nr)){const r=t.slice(1,4);r[0]=j(D(r[0],0),0,1),r[1]=j(D(r[1],0),0,.4,!1),r[2]=+D(r[2].replace("deg",""),0);const n=$t($r(r)),s=t[4]!==void 0?+j(t[4],0,1):1;return n[3]=s,n}};$e.test=e=>wr.test(e)||xr.test(e)||Sr.test(e)||Cr.test(e)||Pr.test(e)||Nr.test(e)||Ar.test(e)||kr.test(e)||Er.test(e)||Mr.test(e)||e==="transparent",d.prototype.css=function(e){return Ws(this._rgb,e)};const Ks=(...e)=>new d(...e,"css");E.css=Ks,w.format.css=$e,w.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&x(e)==="string"&&$e.test(e))return"css"}}),w.format.gl=(...e)=>{const t=A(e,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t};const Fs=(...e)=>new d(...e,"gl");E.gl=Fs,d.prototype.gl=function(){const e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]},d.prototype.hex=function(e){return Ke(this._rgb,e)};const Js=(...e)=>new d(...e,"hex");E.hex=Js,w.format.hex=We,w.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&x(e)==="string"&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});const{log:It}=Math,Lr=e=>{const t=e/100;let r,n,s;return t<66?(r=255,n=t<6?0:-155.25485562709179-.44596950469579133*(n=t-2)+104.49216199393888*It(n),s=t<20?0:-254.76935184120902+.8274096064007395*(s=t-10)+115.67994401066147*It(s)):(r=351.97690566805693+.114206453784165*(r=t-55)-40.25366309332127*It(r),n=325.4494125711974+.07943456536662342*(n=t-50)-28.0852963507957*It(n),s=255),[r,n,s,1]},{round:Qs}=Math,to=(...e)=>{const t=A(e,"rgb"),r=t[0],n=t[2];let s=1e3,o=4e4;const a=.4;let i;for(;o-s>a;){i=(o+s)*.5;const c=Lr(i);c[2]/c[0]>=n/r?o=i:s=i}return Qs(i)};d.prototype.temp=d.prototype.kelvin=d.prototype.temperature=function(){return to(this._rgb)};const we=(...e)=>new d(...e,"temp");Object.assign(E,{temp:we,kelvin:we,temperature:we}),w.format.temp=w.format.kelvin=w.format.temperature=Lr,d.prototype.oklch=function(){return _r(this._rgb)},Object.assign(E,{oklch:(...e)=>new d(...e,"oklch")}),w.format.oklch=$r,w.autodetect.push({p:2,test:(...e)=>{if(e=A(e,"oklch"),x(e)==="array"&&e.length===3)return"oklch"}}),Object.assign(E,{analyze:ir,average:ss,bezier:fs,blend:I,brewer:Bs,Color:d,colors:bt,contrast:Ps,contrastAPCA:Ls,cubehelix:ws,deltaE:js,distance:Us,input:w,interpolate:pt,limits:cr,mix:pt,random:Es,scale:Ht,scales:Hs,valid:Ys});const Or=42,eo=["#30123b","#4145ab","#4675ed","#39a2fc","#1bcfd4","#24eca6","#61fc6c","#a4fc3b","#d1e834","#f3c63a","#fe9b2d","#f36315","#d93806","#b11901","#7a0402"],ro=[0,.071,.143,.214,.286,.357,.429,.5,.571,.643,.714,.786,.857,.929,1],Ae=(e,t=0)=>Array.isArray(e)?e:Number.isInteger(e)?Array(e+t).fill(e+t-1).map((r,n)=>n/Math.max(r,1)):(console.warn("expected prop to be 'number[]' or 'int'",e),[]),ke=(e,t)=>((t?1-e:e)*100).toFixed(2)+"%",xe=(e,t,r=t,n=!1)=>[ke(t),e(n?1-r:r).hex()],Z=(e,t=!1)=>{if(e===""||e===!0)return!0;if(!e)return;let r=typeof e=="string"||e instanceof String?e.startsWith("[")?JSON.parse(e):e.split(","):Array.isArray(e)?[...e]:[e];return t&&(r=r==null?void 0:r.map(n=>n==""||isNaN(n)?n:+n)),r.length>1?r:r[0]},no=e=>{let{colors:t,labels:r,ticks:n,classes:s,vertical:o,reverse:a,flip:i,before:c,after:l,colorReverse:h,colorMode:u,colorGamma:b,colorCorrectLightness:m,colorPadding:v,colorClass:P,centeredEdgeLabels:g}=e;t=Z(t),r=Z(r),n=Z(n,!0),s=Z(s,!0),v=Z(v,!0),o=Z(o),a=Z(a),i=Z(i),h=Z(h),m=Z(m),r===!0&&(Array.isArray(n)?r=[...n]:Array.isArray(s)&&(r=[...s])),a^o&&(Array.isArray(n)&&(n=n.reverse().map(f=>1-f)),Array.isArray(s)&&(s=s.reverse().map(f=>1-f)));let y=null,z=null,O=null,L=null;s===!0&&(n?s=Array.isArray(n)?n:n-1:Array.isArray(r)?s=r==null?void 0:r.length:Array.isArray(t)&&(s=t==null?void 0:t.length));let k;if(t===!0?k=E.scale(eo).domain(ro):t===void 0?t=["#fff","#000"]:Array.isArray(t)||(t=E.brewer[t]||["#fff",t]),t!==!0&&a^o&&(t=[...t].reverse()),k=k||E.scale(t),u&&(k=k.mode(u)),b&&(k=k.gamma(b)),m&&(k=k.correctLightness()),v&&(k=k.padding(v)),s)switch(P){case"average":k=k.domain([0,1]);break;case"equal":Array.isArray(s)||(s=Ae(s,1)),k=k.classes([0,...s,1]);break;default:k=k.classes(s);break}if(c===""&&(c=k(o?1:0).hex()),l===""&&(l=k(o?0:1).hex()),!s||Number(s)<=1)z=Array(Or).fill(Or-1).map((f,p)=>xe(k,p/f,p/f,h));else{let f=Ae(s,1);if(Array.isArray(f)){let p=f.length-1;z=f.reduce(($,_,S,C)=>{let N=C[S+1],W=(_+N)/2;return Ske(p,o)),y=y||f,a^o&&(O=O.reverse()))}if(r!==void 0){if(r===!0)if(y){let p=y.length-(s?1:0);r=Array(p).fill(Math.max(p-1,1)).map(($,_)=>`${parseFloat((_/$).toFixed(2))}`)}else r=["0","1"];Array.isArray(r)||(r=["0",r]),a^o&&Array.isArray(r)&&(r=r.reverse());let f;switch(y&&r.length-y.length){case 0:f=p=>y[p],g=!1;break;case-1:f=p=>(y[p]+y[p+1])/2,g=!0;break;default:r.length>1?(f=p=>p/(r.length-1),g=!1):(f=()=>.5,g=!0);break}L=r.map((p,$)=>[ke(o?1-f($):f($)),p])}return{stops$:z,ticks$:O,labels$:L,before:c,after:l,vertical:o,klass:`dv-sb${c?" b":""}${l?" a":""}${i?" f":""}${o?" v":" h"}${g?" c":""}`}},so=".dv-sb{--s: var(--scalebar-size, 14);--f: var(--label-font, calc(var(--bz) * .9) monospace);--f0: var(--label-font0, var(--f));--f1: var(--label-font1, var(--f0));--sz: var(--container-size, calc(var(--s) * 2px));--bz: var(--bar-size, calc(var(--sz) / 2));--bo: var(--bar-offset);--tc: var(--tick-color, currentColor);--tc0: var(--tick-color0, var(--tc));--tc1: var(--tick-color1, var(--tc0));--tw: var(--tick-width, 2px);--tw0: var(--tick-width0, var(--tw));--tw1: var(--tick-width1, var(--tw0));--ts: var(--tick-size, var(--s));--ts0: var(--tick-size0, calc(var(--ts) * 1.7));--ts1: var(--tick-size1, var(--ts0));--to: var(--tick-offset, 0px);--to0: var(--tick-offset0, var(--to));--to1: var(--tick-offset1, var(--to0));--tb: var(--tick-blend, normal);--tb0: var(--tick-blend0, var(--tb));--tb1: var(--tick-blend1, var(--tb0));--lc: var(--label-color, currentColor);--lc0: var(--label-color0, var(--lc));--lc1: var(--label-color1, var(--lc0));--lo: var(--label-offset, var(--bz));--lo0: var(--label-offset0, var(--lo));--lo1: var(--label-offset1, var(--lo0));--li: var(--label-indent, 0px);--li0: var(--label-indent0, var(--li));--li1: var(--label-indent1, calc(var(--li0) * -1));--lb: var(--label-blend, normal);--lb0: var(--label-blend0, var(--lb));--lb1: var(--label-blend1, var(--lb0));--_: calc(var(--sz) - var(--bz));--_to: calc((var(--to)*-1) + (var(--sz) - var(--ts)*1px));--_to0: calc((var(--to0)*-1) + (var(--sz) - var(--ts0)*1px));--_to1: calc((var(--to1)*-1) + (var(--_to0)))}svg{display:block;overflow:visible;width:100%;height:var(--sz)}svg rect{width:100%;height:var(--bz);transform:translateY(var(--bo))}svg rect.b{transform:translate(calc(var(--bz)*-1))}svg.f rect{transform:translateY(var(--bo, var(--_)))}svg.v{width:var(--sz);height:100%}svg.v rect{width:var(--bz);height:100%;transform:translate(var(--bo))}svg.v rect.b{transform:translateY(calc(var(--bz)*-1))}svg.f.v rect{transform:translate(var(--bo, var(--_)))}svg rect.b,svg rect.a{height:var(--bz);width:var(--bz)}svg use{stroke:var(--tc);stroke-width:var(--tw);mix-blend-mode:var(--tb);transform:translateY(var(--to)) scaleY(var(--ts))}svg use:first-of-type{stroke:var(--tc0);stroke-width:var(--tw0);mix-blend-mode:var(--tb0)}svg use:last-of-type{stroke:var(--tc1);stroke-width:var(--tw1);mix-blend-mode:var(--tb1)}svg use:last-of-type{transform:translateY(var(--to1)) scaleY(var(--ts1))}svg use:first-of-type{transform:translateY(var(--to0)) scaleY(var(--ts0))}svg.f use{transform:translateY(var(--_to)) scaleY(var(--ts))}svg.f use:last-of-type{transform:translateY(var(--_to1)) scaleY(var(--ts1))}svg.f use:first-of-type{transform:translateY(var(--_to0)) scaleY(var(--ts0))}svg.v use{transform:translate(var(--to)) scaleX(var(--ts))}svg.v use:last-of-type{transform:translate(var(--to1)) scaleX(var(--ts1))}svg.v use:first-of-type{transform:translate(var(--to0)) scaleX(var(--ts0))}svg.v.f use{transform:translate(var(--_to)) scaleX(var(--ts))}svg.v.f use:last-of-type{transform:translate(var(--_to1)) scaleX(var(--ts1))}svg.v.f use:first-of-type{transform:translate(var(--_to0)) scaleX(var(--ts0))}svg text{font:var(--f);fill:var(--lc);mix-blend-mode:var(--lb)}svg text:last-of-type{font:var(--f1);fill:var(--lc1);mix-blend-mode:var(--lb1)}svg text:first-of-type{font:var(--f0);fill:var(--lc0);mix-blend-mode:var(--lb0)}svg.h text{text-anchor:middle;dominant-baseline:text-before-edge;transform:translate(var(--li),var(--lo))}svg.h text:last-of-type{transform:translate(calc(var(--li1) - .3em),var(--lo1))}svg.h text:first-of-type{transform:translate(calc(var(--li0) + .3em),var(--lo0))}svg.h:not(.c) text:last-of-type{text-anchor:end}svg.h:not(.c) text:first-of-type{text-anchor:start}svg.h.f text{dominant-baseline:text-after-edge}svg.v text{text-anchor:start;dominant-baseline:central;transform:translate(calc(var(--lo) + .3em),var(--li))}svg.v text:last-of-type{transform:translate(calc(var(--lo) + .3em),calc(-1*var(--li1)))}svg.v text:first-of-type{transform:translate(calc(var(--lo) + .3em),calc(-1*var(--li0)))}svg.v:not(.c) text:last-of-type{dominant-baseline:text-before-edge}svg.v:not(.c) text:first-of-type{dominant-baseline:text-after-edge}svg.v:not(.c).f text:last-of-type{transform:translate(calc(var(--lo) - .3em),calc(-1*var(--li1)))}svg.v:not(.c).f text:first-of-type{transform:translate(calc(var(--lo) - .3em),calc(-1*var(--li0)))}svg.v.f text{text-anchor:end;transform:translate(calc(var(--lo) - .3em),var(--li))}";var oo=Object.defineProperty,ao=Object.getOwnPropertyDescriptor,Y=(e,t,r,n)=>{for(var s=n>1?void 0:n?ao(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(n?a(t,r,s):a(s))||s);return n&&s&&oo(t,r,s),s};const Ee={attribute:!0,reflect:!0},wt={type:Boolean,...Ee},tt={type:String,...Ee},io={type:Number,...Ee};R.DVscalebar=class extends Nt{render(){let{stops$:t,ticks$:r,labels$:n,before:s,after:o,vertical:a,klass:i}=no(this),c=a?1:0,l=a?0:1,h=a?"translate(-1,1) rotate(-90)":"",u=a?"100%":0,b=a?0:"100%",m=t==null?void 0:t.map(g=>St``),v=r==null?void 0:r.map(g=>St``),P=n==null?void 0:n.map(g=>St`${g[1]}`);return Zr`
`}},R.DVscalebar.styles=Pe(`
:host {
display: block;
}
:host([hidden]) {
display: none;
}
${so}`),Y([H(tt)],R.DVscalebar.prototype,"colors",2),Y([H(tt)],R.DVscalebar.prototype,"labels",2),Y([H(tt)],R.DVscalebar.prototype,"ticks",2),Y([H(tt)],R.DVscalebar.prototype,"classes",2),Y([H(wt)],R.DVscalebar.prototype,"vertical",2),Y([H(wt)],R.DVscalebar.prototype,"reverse",2),Y([H(wt)],R.DVscalebar.prototype,"flip",2),Y([H(tt)],R.DVscalebar.prototype,"before",2),Y([H(tt)],R.DVscalebar.prototype,"after",2),Y([H(wt)],R.DVscalebar.prototype,"colorReverse",2),Y([H(tt)],R.DVscalebar.prototype,"colorMode",2),Y([H(io)],R.DVscalebar.prototype,"colorGamma",2),Y([H(wt)],R.DVscalebar.prototype,"colorCorrectLightness",2),Y([H(tt)],R.DVscalebar.prototype,"colorPadding",2),Y([H(tt)],R.DVscalebar.prototype,"colorClass",2),Y([H(wt)],R.DVscalebar.prototype,"centeredEdgeLabels",2),R.DVscalebar=Y([rn("dv-scalebar")],R.DVscalebar),Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});