shiraha-colors
Version:
Browser script to generate colors for Shiraha.
4 lines (3 loc) • 54.4 kB
JavaScript
(function () {
'use strict';
var Me=Object.defineProperty,ke=Object.defineProperties;var Te=Object.getOwnPropertyDescriptors;var se=Object.getOwnPropertySymbols;var Ie=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable;var ie=(e,t,r)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pt=(e,t)=>{for(var r in t||(t={}))Ie.call(t,r)&&ie(e,r,t[r]);if(se)for(var r of se(t))De.call(t,r)&&ie(e,r,t[r]);return e},Gt=(e,t)=>ke(e,Te(t));var W=(e,t,r)=>new Promise((n,o)=>{var a=l=>{try{i(r.next(l));}catch(u){o(u);}},s=l=>{try{i(r.throw(l));}catch(u){o(u);}},i=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,s);i((r=r.apply(e,t)).next());});var ce=([e,t,r])=>(e.width+(r-t)*10)*(e.classList.contains("u-photo")?1.2:1),Dt=()=>{var t;return (t=[...document.images].filter(({width:r})=>r>=128).map((r,n,o)=>[r,n,o.length]).sort((r,n)=>ce(n)-ce(r))[0][0])!=null?t:null};function U(e){return e<0?-1:e===0?0:1}function qt(e,t,r){return (1-r)*e+r*t}function le(e,t,r){return r<e?e:r>t?t:r}function it(e,t,r){return r<e?e:r>t?t:r}function jt(e){return e=e%360,e<0&&(e=e+360),e}function X(e){return e=e%360,e<0&&(e=e+360),e}function he(e,t){return X(t-e)<=180?1:-1}function wt(e,t){return 180-Math.abs(Math.abs(e-t)-180)}function bt(e,t){let r=e[0]*t[0][0]+e[1]*t[0][1]+e[2]*t[0][2],n=e[0]*t[1][0]+e[1]*t[1][1]+e[2]*t[1][2],o=e[0]*t[2][0]+e[1]*t[2][1]+e[2]*t[2][2];return [r,n,o]}var ue=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],we=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],vt=[95.047,100,108.883];function xt(e,t,r){return (255<<24|(e&255)<<16|(t&255)<<8|r&255)>>>0}function Yt(e){let t=ct(e[0]),r=ct(e[1]),n=ct(e[2]);return xt(t,r,n)}function $t(e){return e>>24&255}function lt(e){return e>>16&255}function ht(e){return e>>8&255}function ut(e){return e&255}function Jt(e,t,r){let n=we,o=n[0][0]*e+n[0][1]*t+n[0][2]*r,a=n[1][0]*e+n[1][1]*t+n[1][2]*r,s=n[2][0]*e+n[2][1]*t+n[2][2]*r,i=ct(o),l=ct(a),u=ct(s);return xt(i,l,u)}function Fe(e){let t=et(lt(e)),r=et(ht(e)),n=et(ut(e));return bt([t,r,n],ue)}function me(e,t,r){let n=vt,o=(e+16)/116,a=t/500+o,s=o-r/200,i=Ft(a),l=Ft(o),u=Ft(s),c=i*n[0],m=l*n[1],g=u*n[2];return Jt(c,m,g)}function Wt(e){let t=et(lt(e)),r=et(ht(e)),n=et(ut(e)),o=ue,a=o[0][0]*t+o[0][1]*r+o[0][2]*n,s=o[1][0]*t+o[1][1]*r+o[1][2]*n,i=o[2][0]*t+o[2][1]*r+o[2][2]*n,l=vt,u=a/l[0],c=s/l[1],m=i/l[2],g=Pt(u),f=Pt(c),y=Pt(m),b=116*f-16,x=500*(g-f),T=200*(f-y);return [b,x,T]}function fe(e){let t=Q(e),r=ct(t);return xt(r,r,r)}function mt(e){let t=Fe(e)[1];return 116*Pt(t/100)-16}function Q(e){return 100*Ft((e+16)/116)}function At(e){return Pt(e/100)*116-16}function et(e){let t=e/255;return t<=.040449936?t/12.92*100:Math.pow((t+.055)/1.055,2.4)*100}function ct(e){let t=e/100,r=0;return t<=.0031308?r=t*12.92:r=1.055*Math.pow(t,1/2.4)-.055,le(0,255,Math.round(r*255))}function pe(){return vt}function Xt(e){let t=lt(e),r=ht(e),n=ut(e),o=$t(e);return {r:t,g:r,b:n,a:o}}function Pt(e){let t=.008856451679035631,r=24389/27;return e>t?Math.pow(e,1/3):(r*e+16)/116}function Ft(e){let t=.008856451679035631,r=24389/27,n=e*e*e;return n>t?n:(116*e-16)/r}var N=class{static make(t=pe(),r=200/Math.PI*Q(50)/100,n=50,o=2,a=!1){let s=t,i=s[0]*.401288+s[1]*.650173+s[2]*-.051461,l=s[0]*-.250268+s[1]*1.204414+s[2]*.045854,u=s[0]*-.002079+s[1]*.048952+s[2]*.953127,c=.8+o/10,m=c>=.9?qt(.59,.69,(c-.9)*10):qt(.525,.59,(c-.8)*10),g=a?1:c*(1-1/3.6*Math.exp((-r-42)/92));g=g>1?1:g<0?0:g;let f=c,y=[g*(100/i)+1-g,g*(100/l)+1-g,g*(100/u)+1-g],b=1/(5*r+1),x=b*b*b*b,T=1-x,d=x*r+.1*T*T*Math.cbrt(5*r),A=Q(n)/t[1],D=1.48+Math.sqrt(A),R=.725/Math.pow(A,.2),B=R,C=[Math.pow(d*y[0]*i/100,.42),Math.pow(d*y[1]*l/100,.42),Math.pow(d*y[2]*u/100,.42)],k=[400*C[0]/(C[0]+27.13),400*C[1]/(C[1]+27.13),400*C[2]/(C[2]+27.13)],F=(2*k[0]+k[1]+.05*k[2])*R;return new N(A,F,R,B,m,f,y,d,Math.pow(d,.25),D)}constructor(t,r,n,o,a,s,i,l,u,c){this.n=t,this.aw=r,this.nbb=n,this.ncb=o,this.c=a,this.nc=s,this.rgbD=i,this.fl=l,this.fLRoot=u,this.z=c;}};N.DEFAULT=N.make();var O=class{constructor(t,r,n,o,a,s,i,l,u){this.hue=t,this.chroma=r,this.j=n,this.q=o,this.m=a,this.s=s,this.jstar=i,this.astar=l,this.bstar=u;}distance(t){let r=this.jstar-t.jstar,n=this.astar-t.astar,o=this.bstar-t.bstar,a=Math.sqrt(r*r+n*n+o*o);return 1.41*Math.pow(a,.63)}static fromInt(t){return O.fromIntInViewingConditions(t,N.DEFAULT)}static fromIntInViewingConditions(t,r){let n=(t&16711680)>>16,o=(t&65280)>>8,a=t&255,s=et(n),i=et(o),l=et(a),u=.41233895*s+.35762064*i+.18051042*l,c=.2126*s+.7152*i+.0722*l,m=.01932141*s+.11916382*i+.95034478*l,g=.401288*u+.650173*c-.051461*m,f=-.250268*u+1.204414*c+.045854*m,y=-.002079*u+.048952*c+.953127*m,b=r.rgbD[0]*g,x=r.rgbD[1]*f,T=r.rgbD[2]*y,d=Math.pow(r.fl*Math.abs(b)/100,.42),A=Math.pow(r.fl*Math.abs(x)/100,.42),D=Math.pow(r.fl*Math.abs(T)/100,.42),R=U(b)*400*d/(d+27.13),B=U(x)*400*A/(A+27.13),C=U(T)*400*D/(D+27.13),k=(11*R+-12*B+C)/11,F=(R+B-2*C)/9,w=(20*R+20*B+21*C)/20,G=(40*R+20*B+C)/20,Y=Math.atan2(F,k)*180/Math.PI,H=Y<0?Y+360:Y>=360?Y-360:Y,st=H*Math.PI/180,kt=G*r.nbb,ot=100*Math.pow(kt/r.aw,r.c*r.z),Tt=4/r.c*Math.sqrt(ot/100)*(r.aw+4)*r.fLRoot,Vt=H<20.14?H+360:H,zt=.25*(Math.cos(Vt*Math.PI/180+2)+3.8),Ut=5e4/13*zt*r.nc*r.ncb*Math.sqrt(k*k+F*F)/(w+.305),It=Math.pow(Ut,.9)*Math.pow(1.64-Math.pow(.29,r.n),.73),ne=It*Math.sqrt(ot/100),oe=ne*r.fLRoot,be=50*Math.sqrt(It*r.c/(r.aw+4)),Pe=(1+100*.007)*ot/(1+.007*ot),ae=1/.0228*Math.log(1+.0228*oe),xe=ae*Math.cos(st),Ae=ae*Math.sin(st);return new O(H,ne,ot,Tt,oe,be,Pe,xe,Ae)}static fromJch(t,r,n){return O.fromJchInViewingConditions(t,r,n,N.DEFAULT)}static fromJchInViewingConditions(t,r,n,o){let a=4/o.c*Math.sqrt(t/100)*(o.aw+4)*o.fLRoot,s=r*o.fLRoot,i=r/Math.sqrt(t/100),l=50*Math.sqrt(i*o.c/(o.aw+4)),u=n*Math.PI/180,c=(1+100*.007)*t/(1+.007*t),m=1/.0228*Math.log(1+.0228*s),g=m*Math.cos(u),f=m*Math.sin(u);return new O(n,r,t,a,s,l,c,g,f)}static fromUcs(t,r,n){return O.fromUcsInViewingConditions(t,r,n,N.DEFAULT)}static fromUcsInViewingConditions(t,r,n,o){let a=r,s=n,i=Math.sqrt(a*a+s*s),u=(Math.exp(i*.0228)-1)/.0228/o.fLRoot,c=Math.atan2(s,a)*(180/Math.PI);c<0&&(c+=360);let m=t/(1-(t-100)*.007);return O.fromJchInViewingConditions(m,u,c,o)}toInt(){return this.viewed(N.DEFAULT)}viewed(t){let r=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),n=Math.pow(r/Math.pow(1.64-Math.pow(.29,t.n),.73),1/.9),o=this.hue*Math.PI/180,a=.25*(Math.cos(o+2)+3.8),s=t.aw*Math.pow(this.j/100,1/t.c/t.z),i=a*(5e4/13)*t.nc*t.ncb,l=s/t.nbb,u=Math.sin(o),c=Math.cos(o),m=23*(l+.305)*n/(23*i+11*n*c+108*n*u),g=m*c,f=m*u,y=(460*l+451*g+288*f)/1403,b=(460*l-891*g-261*f)/1403,x=(460*l-220*g-6300*f)/1403,T=Math.max(0,27.13*Math.abs(y)/(400-Math.abs(y))),d=U(y)*(100/t.fl)*Math.pow(T,1/.42),A=Math.max(0,27.13*Math.abs(b)/(400-Math.abs(b))),D=U(b)*(100/t.fl)*Math.pow(A,1/.42),R=Math.max(0,27.13*Math.abs(x)/(400-Math.abs(x))),B=U(x)*(100/t.fl)*Math.pow(R,1/.42),C=d/t.rgbD[0],k=D/t.rgbD[1],F=B/t.rgbD[2],w=1.86206786*C-1.01125463*k+.14918677*F,G=.38752654*C+.62144744*k-.00897398*F,J=-.0158415*C-.03412294*k+1.04996444*F;return Jt(w,G,J)}static fromXyzInViewingConditions(t,r,n,o){let a=.401288*t+.650173*r-.051461*n,s=-.250268*t+1.204414*r+.045854*n,i=-.002079*t+.048952*r+.953127*n,l=o.rgbD[0]*a,u=o.rgbD[1]*s,c=o.rgbD[2]*i,m=Math.pow(o.fl*Math.abs(l)/100,.42),g=Math.pow(o.fl*Math.abs(u)/100,.42),f=Math.pow(o.fl*Math.abs(c)/100,.42),y=U(l)*400*m/(m+27.13),b=U(u)*400*g/(g+27.13),x=U(c)*400*f/(f+27.13),T=(11*y+-12*b+x)/11,d=(y+b-2*x)/9,A=(20*y+20*b+21*x)/20,D=(40*y+20*b+x)/20,B=Math.atan2(d,T)*180/Math.PI,C=B<0?B+360:B>=360?B-360:B,k=C*Math.PI/180,F=D*o.nbb,w=100*Math.pow(F/o.aw,o.c*o.z),G=4/o.c*Math.sqrt(w/100)*(o.aw+4)*o.fLRoot,J=C<20.14?C+360:C,Y=1/4*(Math.cos(J*Math.PI/180+2)+3.8),st=5e4/13*Y*o.nc*o.ncb*Math.sqrt(T*T+d*d)/(A+.305),kt=Math.pow(st,.9)*Math.pow(1.64-Math.pow(.29,o.n),.73),ot=kt*Math.sqrt(w/100),Tt=ot*o.fLRoot,Vt=50*Math.sqrt(kt*o.c/(o.aw+4)),zt=(1+100*.007)*w/(1+.007*w),Nt=Math.log(1+.0228*Tt)/.0228,Ut=Nt*Math.cos(k),It=Nt*Math.sin(k);return new O(C,ot,w,G,Tt,Vt,zt,Ut,It)}xyzInViewingConditions(t){let r=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),n=Math.pow(r/Math.pow(1.64-Math.pow(.29,t.n),.73),1/.9),o=this.hue*Math.PI/180,a=.25*(Math.cos(o+2)+3.8),s=t.aw*Math.pow(this.j/100,1/t.c/t.z),i=a*(5e4/13)*t.nc*t.ncb,l=s/t.nbb,u=Math.sin(o),c=Math.cos(o),m=23*(l+.305)*n/(23*i+11*n*c+108*n*u),g=m*c,f=m*u,y=(460*l+451*g+288*f)/1403,b=(460*l-891*g-261*f)/1403,x=(460*l-220*g-6300*f)/1403,T=Math.max(0,27.13*Math.abs(y)/(400-Math.abs(y))),d=U(y)*(100/t.fl)*Math.pow(T,1/.42),A=Math.max(0,27.13*Math.abs(b)/(400-Math.abs(b))),D=U(b)*(100/t.fl)*Math.pow(A,1/.42),R=Math.max(0,27.13*Math.abs(x)/(400-Math.abs(x))),B=U(x)*(100/t.fl)*Math.pow(R,1/.42),C=d/t.rgbD[0],k=D/t.rgbD[1],F=B/t.rgbD[2],w=1.86206786*C-1.01125463*k+.14918677*F,G=.38752654*C+.62144744*k-.00897398*F,J=-.0158415*C-.03412294*k+1.04996444*F;return [w,G,J]}};var P=class{static sanitizeRadians(t){return (t+Math.PI*8)%(Math.PI*2)}static trueDelinearized(t){let r=t/100,n=0;return r<=.0031308?n=r*12.92:n=1.055*Math.pow(r,1/2.4)-.055,n*255}static chromaticAdaptation(t){let r=Math.pow(Math.abs(t),.42);return U(t)*400*r/(r+27.13)}static hueOf(t){let r=bt(t,P.SCALED_DISCOUNT_FROM_LINRGB),n=P.chromaticAdaptation(r[0]),o=P.chromaticAdaptation(r[1]),a=P.chromaticAdaptation(r[2]),s=(11*n+-12*o+a)/11,i=(n+o-2*a)/9;return Math.atan2(i,s)}static areInCyclicOrder(t,r,n){let o=P.sanitizeRadians(r-t),a=P.sanitizeRadians(n-t);return o<a}static intercept(t,r,n){return (r-t)/(n-t)}static lerpPoint(t,r,n){return [t[0]+(n[0]-t[0])*r,t[1]+(n[1]-t[1])*r,t[2]+(n[2]-t[2])*r]}static setCoordinate(t,r,n,o){let a=P.intercept(t[o],r,n[o]);return P.lerpPoint(t,a,n)}static isBounded(t){return 0<=t&&t<=100}static nthVertex(t,r){let n=P.Y_FROM_LINRGB[0],o=P.Y_FROM_LINRGB[1],a=P.Y_FROM_LINRGB[2],s=r%4<=1?0:100,i=r%2===0?0:100;if(r<4){let l=s,u=i,c=(t-l*o-u*a)/n;return P.isBounded(c)?[c,l,u]:[-1,-1,-1]}else if(r<8){let l=s,u=i,c=(t-u*n-l*a)/o;return P.isBounded(c)?[u,c,l]:[-1,-1,-1]}else {let l=s,u=i,c=(t-l*n-u*o)/a;return P.isBounded(c)?[l,u,c]:[-1,-1,-1]}}static bisectToSegment(t,r){let n=[-1,-1,-1],o=n,a=0,s=0,i=!1,l=!0;for(let u=0;u<12;u++){let c=P.nthVertex(t,u);if(c[0]<0)continue;let m=P.hueOf(c);if(!i){n=c,o=c,a=m,s=m,i=!0;continue}(l||P.areInCyclicOrder(a,m,s))&&(l=!1,P.areInCyclicOrder(a,r,m)?(o=c,s=m):(n=c,a=m));}return [n,o]}static midpoint(t,r){return [(t[0]+r[0])/2,(t[1]+r[1])/2,(t[2]+r[2])/2]}static criticalPlaneBelow(t){return Math.floor(t-.5)}static criticalPlaneAbove(t){return Math.ceil(t-.5)}static bisectToLimit(t,r){let n=P.bisectToSegment(t,r),o=n[0],a=P.hueOf(o),s=n[1];for(let i=0;i<3;i++)if(o[i]!==s[i]){let l=-1,u=255;o[i]<s[i]?(l=P.criticalPlaneBelow(P.trueDelinearized(o[i])),u=P.criticalPlaneAbove(P.trueDelinearized(s[i]))):(l=P.criticalPlaneAbove(P.trueDelinearized(o[i])),u=P.criticalPlaneBelow(P.trueDelinearized(s[i])));for(let c=0;c<8&&!(Math.abs(u-l)<=1);c++){let m=Math.floor((l+u)/2),g=P.CRITICAL_PLANES[m],f=P.setCoordinate(o,g,s,i),y=P.hueOf(f);P.areInCyclicOrder(a,r,y)?(s=f,u=m):(o=f,a=y,l=m);}}return P.midpoint(o,s)}static inverseChromaticAdaptation(t){let r=Math.abs(t),n=Math.max(0,27.13*r/(400-r));return U(t)*Math.pow(n,1/.42)}static findResultByJ(t,r,n){let o=Math.sqrt(n)*11,a=N.DEFAULT,s=1/Math.pow(1.64-Math.pow(.29,a.n),.73),l=.25*(Math.cos(t+2)+3.8)*(5e4/13)*a.nc*a.ncb,u=Math.sin(t),c=Math.cos(t);for(let m=0;m<5;m++){let g=o/100,f=r===0||o===0?0:r/Math.sqrt(g),y=Math.pow(f*s,1/.9),x=a.aw*Math.pow(g,1/a.c/a.z)/a.nbb,T=23*(x+.305)*y/(23*l+11*y*c+108*y*u),d=T*c,A=T*u,D=(460*x+451*d+288*A)/1403,R=(460*x-891*d-261*A)/1403,B=(460*x-220*d-6300*A)/1403,C=P.inverseChromaticAdaptation(D),k=P.inverseChromaticAdaptation(R),F=P.inverseChromaticAdaptation(B),w=bt([C,k,F],P.LINRGB_FROM_SCALED_DISCOUNT);if(w[0]<0||w[1]<0||w[2]<0)return 0;let G=P.Y_FROM_LINRGB[0],J=P.Y_FROM_LINRGB[1],Y=P.Y_FROM_LINRGB[2],H=G*w[0]+J*w[1]+Y*w[2];if(H<=0)return 0;if(m===4||Math.abs(H-n)<.002)return w[0]>100.01||w[1]>100.01||w[2]>100.01?0:Yt(w);o=o-(H-n)*o/(2*H);}return 0}static solveToInt(t,r,n){if(r<1e-4||n<1e-4||n>99.9999)return fe(n);t=X(t);let o=t/180*Math.PI,a=Q(n),s=P.findResultByJ(o,r,a);if(s!==0)return s;let i=P.bisectToLimit(a,o);return Yt(i)}static solveToCam(t,r,n){return O.fromInt(P.solveToInt(t,r,n))}};P.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]];P.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]];P.Y_FROM_LINRGB=[.2126,.7152,.0722];P.CRITICAL_PLANES=[.015176349177441876,.045529047532325624,.07588174588720938,.10623444424209313,.13658714259697685,.16693984095186062,.19729253930674434,.2276452376616281,.2579979360165119,.28835063437139563,.3188300904430532,.350925934958123,.3848314933096426,.42057480301049466,.458183274052838,.4976837250274023,.5391024159806381,.5824650784040898,.6277969426914107,.6751227633498623,.7244668422128921,.775853049866786,.829304845476233,.8848452951698498,.942497089126609,1.0022825574869039,1.0642236851973577,1.1283421258858297,1.1946592148522128,1.2631959812511864,1.3339731595349034,1.407011200216447,1.4823302800086415,1.5599503113873272,1.6398909516233677,1.7221716113234105,1.8068114625156377,1.8938294463134073,1.9832442801866852,2.075074464868551,2.1693382909216234,2.2660538449872063,2.36523901573795,2.4669114995532007,2.5710888059345764,2.6777882626779785,2.7870270208169257,2.898822059350997,3.0131901897720907,3.1301480604002863,3.2497121605402226,3.3718988244681087,3.4967242352587946,3.624204428461639,3.754355295633311,3.887192587735158,4.022731918402185,4.160988767090289,4.301978482107941,4.445716283538092,4.592217266055746,4.741496401646282,4.893568542229298,5.048448422192488,5.20615066083972,5.3666897647573375,5.5300801301023865,5.696336044816294,5.865471690767354,6.037501145825082,6.212438385869475,6.390297286737924,6.571091626112461,6.7548350853498045,6.941541251256611,7.131223617812143,7.323895587840543,7.5195704746346665,7.7182615035334345,7.919981813454504,8.124744458384042,8.332562408825165,8.543448553206703,8.757415699253682,8.974476575321063,9.194643831691977,9.417930041841839,9.644347703669503,9.873909240696694,10.106627003236781,10.342513269534024,10.58158024687427,10.8238400726681,11.069304815507364,11.317986476196008,11.569896988756009,11.825048221409341,12.083451977536606,12.345119996613247,12.610063955123938,12.878295467455942,13.149826086772048,13.42466730586372,13.702830557985108,13.984327217668513,14.269168601521828,14.55736596900856,14.848930523210871,15.143873411576273,15.44220572664832,15.743938506781891,16.04908273684337,16.35764934889634,16.66964922287304,16.985093187232053,17.30399201960269,17.62635644741625,17.95219714852476,18.281524751807332,18.614349837764564,18.95068293910138,19.290534541298456,19.633915083172692,19.98083495742689,20.331304511189067,20.685334046541502,21.042933821039977,21.404114048223256,21.76888489811322,22.137256497705877,22.50923893145328,22.884842241736916,23.264076429332462,23.6469514538663,24.033477234264016,24.42366364919083,24.817520537484558,25.21505769858089,25.61628489293138,26.021211842414342,26.429848230738664,26.842203703840827,27.258287870275353,27.678110301598522,28.10168053274597,28.529008062403893,28.96010235337422,29.39497283293396,29.83362889318845,30.276079891419332,30.722335150426627,31.172403958865512,31.62629557157785,32.08401920991837,32.54558406207592,33.010999283389665,33.4802739966603,33.953417292456834,34.430438229418264,34.911345834551085,35.39614910352207,35.88485700094671,36.37747846067349,36.87402238606382,37.37449765026789,37.87891309649659,38.38727753828926,38.89959975977785,39.41588851594697,39.93615253289054,40.460400508064545,40.98864111053629,41.520882981230194,42.05713473317016,42.597404951718396,43.141702194811224,43.6900349931913,44.24241185063697,44.798841244188324,45.35933162437017,45.92389141541209,46.49252901546552,47.065252796817916,47.64207110610409,48.22299226451468,48.808024568002054,49.3971762874833,49.9904556690408,50.587870934119984,51.189430279724725,51.79514187861014,52.40501387947288,53.0190544071392,53.637271562750364,54.259673423945976,54.88626804504493,55.517063457223934,56.15206766869424,56.79128866487574,57.43473440856916,58.08241284012621,58.734331877617365,59.39049941699807,60.05092333227251,60.715611475655585,61.38457167773311,62.057811747619894,62.7353394731159,63.417162620860914,64.10328893648692,64.79372614476921,65.48848194977529,66.18756403501224,66.89098006357258,67.59873767827808,68.31084450182222,69.02730813691093,69.74813616640164,70.47333615344107,71.20291564160104,71.93688215501312,72.67524319850172,73.41800625771542,74.16517879925733,74.9167682708136,75.67278210128072,76.43322770089146,77.1981124613393,77.96744375590167,78.74122893956174,79.51947534912904,80.30219030335869,81.08938110306934,81.88105503125999,82.67721935322541,83.4778813166706,84.28304815182372,85.09272707154808,85.90692527145302,86.72564993000343,87.54890820862819,88.3767072518277,89.2090541872801,90.04595612594655,90.88742016217518,91.73345337380438,92.58406282226491,93.43925555268066,94.29903859396902,95.16341895893969,96.03240364439274,96.9059996312159,97.78421388448044,98.6670533535366,99.55452497210776];var I=class{static from(t,r,n){return new I(P.solveToInt(t,r,n))}static fromInt(t){return new I(t)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(t){this.setInternalState(P.solveToInt(t,this.internalChroma,this.internalTone));}get chroma(){return this.internalChroma}set chroma(t){this.setInternalState(P.solveToInt(this.internalHue,t,this.internalTone));}get tone(){return this.internalTone}set tone(t){this.setInternalState(P.solveToInt(this.internalHue,this.internalChroma,t));}constructor(t){this.argb=t;let r=O.fromInt(t);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=mt(t),this.argb=t;}setInternalState(t){let r=O.fromInt(t);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=mt(t),this.argb=t;}inViewingConditions(t){let n=O.fromInt(this.toInt()).xyzInViewingConditions(t),o=O.fromXyzInViewingConditions(n[0],n[1],n[2],N.make());return I.from(o.hue,o.chroma,At(n[1]))}};var dt=class{static harmonize(t,r){let n=I.fromInt(t),o=I.fromInt(r),a=wt(n.hue,o.hue),s=Math.min(a*.5,15),i=X(n.hue+s*he(n.hue,o.hue));return I.from(i,n.chroma,n.tone).toInt()}static hctHue(t,r,n){let o=dt.cam16Ucs(t,r,n),a=O.fromInt(o),s=O.fromInt(t);return I.from(a.hue,s.chroma,mt(t)).toInt()}static cam16Ucs(t,r,n){let o=O.fromInt(t),a=O.fromInt(r),s=o.jstar,i=o.astar,l=o.bstar,u=a.jstar,c=a.astar,m=a.bstar,g=s+(u-s)*n,f=i+(c-i)*n,y=l+(m-l)*n;return O.fromUcs(g,f,y).toInt()}};var V=class{static ratioOfTones(t,r){return t=it(0,100,t),r=it(0,100,r),V.ratioOfYs(Q(t),Q(r))}static ratioOfYs(t,r){let n=t>r?t:r,o=n===r?t:r;return (n+5)/(o+5)}static lighter(t,r){if(t<0||t>100)return -1;let n=Q(t),o=r*(n+5)-5,a=V.ratioOfYs(o,n),s=Math.abs(a-r);if(a<r&&s>.04)return -1;let i=At(o)+.4;return i<0||i>100?-1:i}static darker(t,r){if(t<0||t>100)return -1;let n=Q(t),o=(n+5)/r-5,a=V.ratioOfYs(n,o),s=Math.abs(a-r);if(a<r&&s>.04)return -1;let i=At(o)-.4;return i<0||i>100?-1:i}static lighterUnsafe(t,r){let n=V.lighter(t,r);return n<0?100:n}static darkerUnsafe(t,r){let n=V.darker(t,r);return n<0?0:n}};var at=class{static isDisliked(t){let r=Math.round(t.hue)>=90&&Math.round(t.hue)<=111,n=Math.round(t.chroma)>16,o=Math.round(t.tone)<65;return r&&n&&o}static fixIfDisliked(t){return at.isDisliked(t)?I.from(t.hue,t.chroma,70):t}};var p=class{static fromPalette(t){return new p(r=>t.palette(r).hue,r=>t.palette(r).chroma,t.tone,r=>p.toneMinContrastDefault({tone:t.tone,scheme:r,background:t.background,toneDeltaConstraint:t.toneDeltaConstraint}),r=>p.toneMaxContrastDefault({tone:t.tone,scheme:r,background:t.background,toneDeltaConstraint:t.toneDeltaConstraint}),t.background,t.toneDeltaConstraint)}static fromHueAndChroma(t){return new p(t.hue,t.chroma,t.tone,r=>p.toneMinContrastDefault({tone:t.tone,scheme:r,background:t.background,toneDeltaConstraint:t.toneDeltaConstraint}),r=>p.toneMaxContrastDefault({tone:t.tone,scheme:r,background:t.background,toneDeltaConstraint:t.toneDeltaConstraint}),t.background,t.toneDeltaConstraint)}static fromArgb(t){return new p(r=>I.fromInt(t.argb(r)).hue,r=>I.fromInt(t.argb(r)).chroma,r=>{var n,o;return (o=(n=t.tone)==null?void 0:n.call(t,r))!=null?o:I.fromInt(t.argb(r)).tone},r=>p.toneMinContrastDefault({tone:n=>{var o,a;return (a=(o=t.tone)==null?void 0:o.call(t,n))!=null?a:I.fromInt(t.argb(n)).tone},scheme:r,background:t.background,toneDeltaConstraint:t.toneDeltaConstraint}),r=>p.toneMaxContrastDefault({tone:n=>{var o,a;return (a=(o=t.tone)==null?void 0:o.call(t,n))!=null?a:I.fromInt(t.argb(n)).tone},scheme:r,background:t.background,toneDeltaConstraint:t.toneDeltaConstraint}),t.background,t.toneDeltaConstraint)}constructor(t,r,n,o,a,s,i){this.hue=t,this.chroma=r,this.tone=n,this.toneMinContrast=o,this.toneMaxContrast=a,this.background=s,this.toneDeltaConstraint=i,this.hctCache=new Map;}getArgb(t){return this.getHct(t).toInt()}getHct(t){let r=this.hctCache.get(t);if(r!=null)return r;let n=I.from(this.hue(t),this.chroma(t),this.getTone(t));return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(t,n),n}getTone(t){var l,u;let r=this.tone(t),n=t.contrastLevel<0;if(t.contrastLevel!==0){let c=this.tone(t);r=((n?this.toneMinContrast(t):this.toneMaxContrast(t))-c)*Math.abs(t.contrastLevel)+c;}let o=(l=this.background)==null?void 0:l.call(this,t),a,s,i;if(o!=null){let c=((u=o==null?void 0:o.background)==null?void 0:u.call(o,t))!=null;if(a=V.ratioOfTones(this.tone(t),o.tone(t)),n){let m=V.ratioOfTones(this.toneMinContrast(t),o.toneMinContrast(t));s=c?m:null,i=a;}else {let m=V.ratioOfTones(this.toneMaxContrast(t),o.toneMaxContrast(t));s=c?Math.min(m,a):null,i=c?Math.max(m,a):null;}}return r=p.calculateDynamicTone({scheme:t,toneStandard:this.tone,toneToJudge:c=>c.getTone(t),desiredTone:(c,m)=>r,background:o!=null?c=>o:void 0,toneDeltaConstraint:this.toneDeltaConstraint,minRatio:c=>s!=null?s:1,maxRatio:c=>i!=null?i:21}),r}static ensureToneDelta(t,r,n,o,a){let s=o?o(n):null;if(s==null||a==null)return t;let i=s.delta,l=a(s.keepAway),u=Math.abs(t-l);if(u>i)return t;switch(s.keepAwayPolarity){case"darker":return it(0,100,l+i);case"lighter":return it(0,100,l-i);case"no-preference":let c=s.keepAway.tone(n),m=r>c,g=Math.abs(u-i);return (m?t+g<=100:t<g)?t+g:t-g;default:return t}}static foregroundTone(t,r){let n=V.lighterUnsafe(t,r),o=V.darkerUnsafe(t,r),a=V.ratioOfTones(n,t),s=V.ratioOfTones(o,t);if(p.tonePrefersLightForeground(t)){let l=Math.abs(a-s)<.1&&a<r&&s<r;return a>=r||a>=s||l?n:o}else return s>=r||s>=a?o:n}static calculateDynamicTone(t){var A,D,R;let r=t.background,n=t.scheme,o=t.toneStandard,a=t.toneToJudge,s=t.desiredTone,i=t.minRatio,l=t.maxRatio,u=t.toneDeltaConstraint,c=o(n),m=c,g=r==null?void 0:r(n);if(g==null)return m;let f=g.tone(n),y=V.ratioOfTones(c,f),b=a(g),x=s(y,b),T=V.ratioOfTones(b,x),d=it((A=i==null?void 0:i(y))!=null?A:1,(D=l==null?void 0:l(y))!=null?D:21,T);return d===T?m=x:m=p.foregroundTone(b,d),((R=g.background)==null?void 0:R.call(g,n))==null&&(m=p.enableLightForeground(m)),m=p.ensureToneDelta(m,c,n,u,B=>a(B)),m}static toneMaxContrastDefault(t){return p.calculateDynamicTone({scheme:t.scheme,toneStandard:t.tone,toneToJudge:r=>r.toneMaxContrast(t.scheme),desiredTone:(r,n)=>{var a,s,i;return ((i=(s=(a=t.background)==null?void 0:a.call(t,t.scheme))==null?void 0:s.background)==null?void 0:i.call(s,t.scheme))!=null?p.foregroundTone(n,7):p.foregroundTone(n,Math.max(7,r))},background:t.background,toneDeltaConstraint:t.toneDeltaConstraint})}static toneMinContrastDefault(t){return p.calculateDynamicTone({scheme:t.scheme,toneStandard:t.tone,toneToJudge:r=>r.toneMinContrast(t.scheme),desiredTone:(r,n)=>{var a,s,i;let o=t.tone(t.scheme);return r>=7?o=p.foregroundTone(n,4.5):r>=3?o=p.foregroundTone(n,3):((i=(s=(a=t.background)==null?void 0:a.call(t,t.scheme))==null?void 0:s.background)==null?void 0:i.call(s,t.scheme))!=null&&(o=p.foregroundTone(n,r)),o},background:t.background,toneDeltaConstraint:t.toneDeltaConstraint,minRatio:r=>1,maxRatio:r=>r})}static tonePrefersLightForeground(t){return Math.round(t)<60}static toneAllowsLightForeground(t){return Math.round(t)<=49}static enableLightForeground(t){return p.tonePrefersLightForeground(t)&&!p.toneAllowsLightForeground(t)?49:t}};var q;(function(e){e[e.MONOCHROME=0]="MONOCHROME",e[e.NEUTRAL=1]="NEUTRAL",e[e.TONAL_SPOT=2]="TONAL_SPOT",e[e.VIBRANT=3]="VIBRANT",e[e.EXPRESSIVE=4]="EXPRESSIVE",e[e.FIDELITY=5]="FIDELITY",e[e.CONTENT=6]="CONTENT";})(q||(q={}));var ft=class{constructor(t,r,n){this.delta=t,this.keepAway=r,this.keepAwayPolarity=n;}};function gt(e){return e.variant===q.FIDELITY||e.variant===q.CONTENT}function E(e){return e.variant===q.MONOCHROME}function Re(e,t,r,n){let o=r,a=I.from(e,t,r);if(a.chroma<t){let s=a.chroma;for(;a.chroma<t;){o+=n?-1:1;let i=I.from(e,t,o);if(s>i.chroma||Math.abs(i.chroma-t)<.4)break;let l=Math.abs(i.chroma-t),u=Math.abs(a.chroma-t);l<u&&(a=i),s=Math.max(s,i.chroma);}}return o}function Be(e){return N.make(void 0,void 0,e.isDark?30:80,void 0,void 0)}function Zt(e,t){let r=e.inViewingConditions(Be(t));return p.tonePrefersLightForeground(e.tone)&&!p.toneAllowsLightForeground(r.tone)?p.enableLightForeground(e.tone):p.enableLightForeground(r.tone)}var h=class{static highestSurface(t){return t.isDark?h.surfaceBright:h.surfaceDim}};h.contentAccentToneDelta=15;h.background=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98});h.onBackground=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>h.background});h.surface=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98});h.surfaceDim=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?6:87});h.surfaceBright=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?24:98});h.surfaceContainerLowest=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?4:100});h.surfaceContainerLow=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?10:96});h.surfaceContainer=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?12:94});h.surfaceContainerHigh=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?17:92});h.surfaceContainerHighest=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?22:90});h.onSurface=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>h.highestSurface(e)});h.surfaceVariant=p.fromPalette({palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:90});h.onSurfaceVariant=p.fromPalette({palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?80:30,background:e=>h.surfaceVariant});h.inverseSurface=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?90:20});h.inverseOnSurface=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>e.isDark?20:95,background:e=>h.inverseSurface});h.outline=p.fromPalette({palette:e=>e.neutralVariantPalette,tone:e=>50,background:e=>h.highestSurface(e)});h.outlineVariant=p.fromPalette({palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:80,background:e=>h.highestSurface(e)});h.shadow=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>0});h.scrim=p.fromPalette({palette:e=>e.neutralPalette,tone:e=>0});h.surfaceTintColor=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>e.isDark?80:40});h.primary=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>E(e)?e.isDark?100:0:e.isDark?80:40,background:e=>h.highestSurface(e),toneDeltaConstraint:e=>new ft(h.contentAccentToneDelta,h.primaryContainer,e.isDark?"darker":"lighter")});h.onPrimary=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>E(e)?e.isDark?10:90:e.isDark?20:100,background:e=>h.primary});h.primaryContainer=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>E(e)?e.isDark?85:25:gt(e)?Zt(e.sourceColorHct,e):e.isDark?30:90,background:e=>h.highestSurface(e)});h.onPrimaryContainer=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>E(e)?e.isDark?0:100:gt(e)?p.foregroundTone(h.primaryContainer.tone(e),4.5):e.isDark?90:10,background:e=>h.primaryContainer});h.inversePrimary=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>e.isDark?40:80,background:e=>h.inverseSurface});h.inverseOnPrimary=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>e.isDark?100:20,background:e=>h.inversePrimary});h.secondary=p.fromPalette({palette:e=>e.secondaryPalette,tone:e=>e.isDark?80:40,background:e=>h.highestSurface(e),toneDeltaConstraint:e=>new ft(h.contentAccentToneDelta,h.secondaryContainer,e.isDark?"darker":"lighter")});h.onSecondary=p.fromPalette({palette:e=>e.secondaryPalette,tone:e=>E(e)?e.isDark?10:100:e.isDark?20:100,background:e=>h.secondary});h.secondaryContainer=p.fromPalette({palette:e=>e.secondaryPalette,tone:e=>{let t=e.isDark?30:90;if(E(e))return e.isDark?30:85;if(!gt(e))return t;let r=Re(e.secondaryPalette.hue,e.secondaryPalette.chroma,t,!e.isDark);return r=Zt(e.secondaryPalette.getHct(r),e),r},background:e=>h.highestSurface(e)});h.onSecondaryContainer=p.fromPalette({palette:e=>e.secondaryPalette,tone:e=>gt(e)?p.foregroundTone(h.secondaryContainer.tone(e),4.5):e.isDark?90:10,background:e=>h.secondaryContainer});h.tertiary=p.fromPalette({palette:e=>e.tertiaryPalette,tone:e=>E(e)?e.isDark?90:25:e.isDark?80:40,background:e=>h.highestSurface(e),toneDeltaConstraint:e=>new ft(h.contentAccentToneDelta,h.tertiaryContainer,e.isDark?"darker":"lighter")});h.onTertiary=p.fromPalette({palette:e=>e.tertiaryPalette,tone:e=>E(e)?e.isDark?10:90:e.isDark?20:100,background:e=>h.tertiary});h.tertiaryContainer=p.fromPalette({palette:e=>e.tertiaryPalette,tone:e=>{if(E(e))return e.isDark?60:49;if(!gt(e))return e.isDark?30:90;let t=Zt(e.tertiaryPalette.getHct(e.sourceColorHct.tone),e),r=e.tertiaryPalette.getHct(t);return at.fixIfDisliked(r).tone},background:e=>h.highestSurface(e)});h.onTertiaryContainer=p.fromPalette({palette:e=>e.tertiaryPalette,tone:e=>E(e)?e.isDark?0:100:gt(e)?p.foregroundTone(h.tertiaryContainer.tone(e),4.5):e.isDark?90:10,background:e=>h.tertiaryContainer});h.error=p.fromPalette({palette:e=>e.errorPalette,tone:e=>e.isDark?80:40,background:e=>h.highestSurface(e),toneDeltaConstraint:e=>new ft(h.contentAccentToneDelta,h.errorContainer,e.isDark?"darker":"lighter")});h.onError=p.fromPalette({palette:e=>e.errorPalette,tone:e=>e.isDark?20:100,background:e=>h.error});h.errorContainer=p.fromPalette({palette:e=>e.errorPalette,tone:e=>e.isDark?30:90,background:e=>h.highestSurface(e)});h.onErrorContainer=p.fromPalette({palette:e=>e.errorPalette,tone:e=>e.isDark?90:10,background:e=>h.errorContainer});h.primaryFixed=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>E(e)?e.isDark?100:10:90,background:e=>h.highestSurface(e)});h.primaryFixedDim=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>E(e)?e.isDark?90:20:80,background:e=>h.highestSurface(e)});h.onPrimaryFixed=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>E(e)?e.isDark?10:90:10,background:e=>h.primaryFixedDim});h.onPrimaryFixedVariant=p.fromPalette({palette:e=>e.primaryPalette,tone:e=>E(e)?e.isDark?30:70:30,background:e=>h.primaryFixedDim});h.secondaryFixed=p.fromPalette({palette:e=>e.secondaryPalette,tone:e=>E(e)?80:90,background:e=>h.highestSurface(e)});h.secondaryFixedDim=p.fromPalette({palette:e=>e.secondaryPalette,tone:e=>E(e)?70:80,background:e=>h.highestSurface(e)});h.onSecondaryFixed=p.fromPalette({palette:e=>e.secondaryPalette,tone:e=>10,background:e=>h.secondaryFixedDim});h.onSecondaryFixedVariant=p.fromPalette({palette:e=>e.secondaryPalette,tone:e=>E(e)?25:30,background:e=>h.secondaryFixedDim});h.tertiaryFixed=p.fromPalette({palette:e=>e.tertiaryPalette,tone:e=>E(e)?40:90,background:e=>h.highestSurface(e)});h.tertiaryFixedDim=p.fromPalette({palette:e=>e.tertiaryPalette,tone:e=>E(e)?30:80,background:e=>h.highestSurface(e)});h.onTertiaryFixed=p.fromPalette({palette:e=>e.tertiaryPalette,tone:e=>E(e)?90:10,background:e=>h.tertiaryFixedDim});h.onTertiaryFixedVariant=p.fromPalette({palette:e=>e.tertiaryPalette,tone:e=>E(e)?70:30,background:e=>h.tertiaryFixedDim});var M=class{static fromInt(t){let r=I.fromInt(t);return M.fromHueAndChroma(r.hue,r.chroma)}static fromHueAndChroma(t,r){return new M(t,r)}constructor(t,r){this.hue=t,this.chroma=r,this.cache=new Map;}tone(t){let r=this.cache.get(t);return r===void 0&&(r=I.from(this.hue,this.chroma,t).toInt(),this.cache.set(t,r)),r}getHct(t){return I.fromInt(this.tone(t))}};var L=class{static of(t){return new L(t,!1)}static contentOf(t){return new L(t,!0)}static fromColors(t){return L.createPaletteFromColors(!1,t)}static contentFromColors(t){return L.createPaletteFromColors(!0,t)}static createPaletteFromColors(t,r){let n=new L(r.primary,t);if(r.secondary){let o=new L(r.secondary,t);n.a2=o.a1;}if(r.tertiary){let o=new L(r.tertiary,t);n.a3=o.a1;}if(r.error){let o=new L(r.error,t);n.error=o.a1;}if(r.neutral){let o=new L(r.neutral,t);n.n1=o.n1;}if(r.neutralVariant){let o=new L(r.neutralVariant,t);n.n2=o.n2;}return n}constructor(t,r){let n=I.fromInt(t),o=n.hue,a=n.chroma;r?(this.a1=M.fromHueAndChroma(o,a),this.a2=M.fromHueAndChroma(o,a/3),this.a3=M.fromHueAndChroma(o+60,a/2),this.n1=M.fromHueAndChroma(o,Math.min(a/12,4)),this.n2=M.fromHueAndChroma(o,Math.min(a/6,8))):(this.a1=M.fromHueAndChroma(o,Math.max(48,a)),this.a2=M.fromHueAndChroma(o,16),this.a3=M.fromHueAndChroma(o+60,24),this.n1=M.fromHueAndChroma(o,4),this.n2=M.fromHueAndChroma(o,8)),this.error=M.fromHueAndChroma(25,84);}};var Rt=class{fromInt(t){return Wt(t)}toInt(t){return me(t[0],t[1],t[2])}distance(t,r){let n=t[0]-r[0],o=t[1]-r[1],a=t[2]-r[2];return n*n+o*o+a*a}};var Oe=10,Se=3,Bt=class{static quantize(t,r,n){let o=new Map,a=new Array,s=new Array,i=new Rt,l=0;for(let d=0;d<t.length;d++){let A=t[d],D=o.get(A);D===void 0?(l++,a.push(i.fromInt(A)),s.push(A),o.set(A,1)):o.set(A,D+1);}let u=new Array;for(let d=0;d<l;d++){let A=s[d],D=o.get(A);D!==void 0&&(u[d]=D);}let c=Math.min(n,l);r.length>0&&(c=Math.min(c,r.length));let m=new Array;for(let d=0;d<r.length;d++)m.push(i.fromInt(r[d]));let g=c-m.length;if(r.length===0&&g>0)for(let d=0;d<g;d++){let A=Math.random()*100,D=Math.random()*(100- -100+1)+-100,R=Math.random()*(100- -100+1)+-100;m.push(new Array(A,D,R));}let f=new Array;for(let d=0;d<l;d++)f.push(Math.floor(Math.random()*c));let y=new Array;for(let d=0;d<c;d++){y.push(new Array);for(let A=0;A<c;A++)y[d].push(0);}let b=new Array;for(let d=0;d<c;d++){b.push(new Array);for(let A=0;A<c;A++)b[d].push(new Kt);}let x=new Array;for(let d=0;d<c;d++)x.push(0);for(let d=0;d<Oe;d++){for(let C=0;C<c;C++){for(let k=C+1;k<c;k++){let F=i.distance(m[C],m[k]);b[k][C].distance=F,b[k][C].index=C,b[C][k].distance=F,b[C][k].index=k;}b[C].sort();for(let k=0;k<c;k++)y[C][k]=b[C][k].index;}let A=0;for(let C=0;C<l;C++){let k=a[C],F=f[C],w=m[F],G=i.distance(k,w),J=G,Y=-1;for(let H=0;H<c;H++){if(b[F][H].distance>=4*G)continue;let st=i.distance(k,m[H]);st<J&&(J=st,Y=H);}Y!==-1&&Math.abs(Math.sqrt(J)-Math.sqrt(G))>Se&&(A++,f[C]=Y);}if(A===0&&d!==0)break;let D=new Array(c).fill(0),R=new Array(c).fill(0),B=new Array(c).fill(0);for(let C=0;C<c;C++)x[C]=0;for(let C=0;C<l;C++){let k=f[C],F=a[C],w=u[C];x[k]+=w,D[k]+=F[0]*w,R[k]+=F[1]*w,B[k]+=F[2]*w;}for(let C=0;C<c;C++){let k=x[C];if(k===0){m[C]=[0,0,0];continue}let F=D[C]/k,w=R[C]/k,G=B[C]/k;m[C]=[F,w,G];}}let T=new Map;for(let d=0;d<c;d++){let A=x[d];if(A===0)continue;let D=i.toInt(m[d]);T.has(D)||T.set(D,A);}return T}},Kt=class{constructor(){this.distance=-1,this.index=-1;}};var Ot=class{static quantize(t){var n;let r=new Map;for(let o=0;o<t.length;o++){let a=t[o];$t(a)<255||r.set(a,((n=r.get(a))!=null?n:0)+1);}return r}};var St=5,_=33,Mt=35937,j={RED:"red",GREEN:"green",BLUE:"blue"},Et=class{constructor(t=[],r=[],n=[],o=[],a=[],s=[]){this.weights=t,this.momentsR=r,this.momentsG=n,this.momentsB=o,this.moments=a,this.cubes=s;}quantize(t,r){this.constructHistogram(t),this.computeMoments();let n=this.createBoxes(r);return this.createResult(n.resultCount)}constructHistogram(t){var n;this.weights=Array.from({length:Mt}).fill(0),this.momentsR=Array.from({length:Mt}).fill(0),this.momentsG=Array.from({length:Mt}).fill(0),this.momentsB=Array.from({length:Mt}).fill(0),this.moments=Array.from({length:Mt}).fill(0);let r=Ot.quantize(t);for(let[o,a]of r.entries()){let s=lt(o),i=ht(o),l=ut(o),u=8-St,c=(s>>u)+1,m=(i>>u)+1,g=(l>>u)+1,f=this.getIndex(c,m,g);this.weights[f]=((n=this.weights[f])!=null?n:0)+a,this.momentsR[f]+=a*s,this.momentsG[f]+=a*i,this.momentsB[f]+=a*l,this.moments[f]+=a*(s*s+i*i+l*l);}}computeMoments(){for(let t=1;t<_;t++){let r=Array.from({length:_}).fill(0),n=Array.from({length:_}).fill(0),o=Array.from({length:_}).fill(0),a=Array.from({length:_}).fill(0),s=Array.from({length:_}).fill(0);for(let i=1;i<_;i++){let l=0,u=0,c=0,m=0,g=0;for(let f=1;f<_;f++){let y=this.getIndex(t,i,f);l+=this.weights[y],u+=this.momentsR[y],c+=this.momentsG[y],m+=this.momentsB[y],g+=this.moments[y],r[f]+=l,n[f]+=u,o[f]+=c,a[f]+=m,s[f]+=g;let b=this.getIndex(t-1,i,f);this.weights[y]=this.weights[b]+r[f],this.momentsR[y]=this.momentsR[b]+n[f],this.momentsG[y]=this.momentsG[b]+o[f],this.momentsB[y]=this.momentsB[b]+a[f],this.moments[y]=this.moments[b]+s[f];}}}}createBoxes(t){this.cubes=Array.from({length:t}).fill(0).map(()=>new Qt);let r=Array.from({length:t}).fill(0);this.cubes[0].r0=0,this.cubes[0].g0=0,this.cubes[0].b0=0,this.cubes[0].r1=_-1,this.cubes[0].g1=_-1,this.cubes[0].b1=_-1;let n=t,o=0;for(let a=1;a<t;a++){this.cut(this.cubes[o],this.cubes[a])?(r[o]=this.cubes[o].vol>1?this.variance(this.cubes[o]):0,r[a]=this.cubes[a].vol>1?this.variance(this.cubes[a]):0):(r[o]=0,a--),o=0;let s=r[0];for(let i=1;i<=a;i++)r[i]>s&&(s=r[i],o=i);if(s<=0){n=a+1;break}}return new _t(t,n)}createResult(t){let r=[];for(let n=0;n<t;++n){let o=this.cubes[n],a=this.volume(o,this.weights);if(a>0){let s=Math.round(this.volume(o,this.momentsR)/a),i=Math.round(this.volume(o,this.momentsG)/a),l=Math.round(this.volume(o,this.momentsB)/a),u=255<<24|(s&255)<<16|(i&255)<<8|l&255;r.push(u);}}return r}variance(t){let r=this.volume(t,this.momentsR),n=this.volume(t,this.momentsG),o=this.volume(t,this.momentsB),a=this.moments[this.getIndex(t.r1,t.g1,t.b1)]-this.moments[this.getIndex(t.r1,t.g1,t.b0)]-this.moments[this.getIndex(t.r1,t.g0,t.b1)]+this.moments[this.getIndex(t.r1,t.g0,t.b0)]-this.moments[this.getIndex(t.r0,t.g1,t.b1)]+this.moments[this.getIndex(t.r0,t.g1,t.b0)]+this.moments[this.getIndex(t.r0,t.g0,t.b1)]-this.moments[this.getIndex(t.r0,t.g0,t.b0)],s=r*r+n*n+o*o,i=this.volume(t,this.weights);return a-s/i}cut(t,r){let n=this.volume(t,this.momentsR),o=this.volume(t,this.momentsG),a=this.volume(t,this.momentsB),s=this.volume(t,this.weights),i=this.maximize(t,j.RED,t.r0+1,t.r1,n,o,a,s),l=this.maximize(t,j.GREEN,t.g0+1,t.g1,n,o,a,s),u=this.maximize(t,j.BLUE,t.b0+1,t.b1,n,o,a,s),c,m=i.maximum,g=l.maximum,f=u.maximum;if(m>=g&&m>=f){if(i.cutLocation<0)return !1;c=j.RED;}else g>=m&&g>=f?c=j.GREEN:c=j.BLUE;switch(r.r1=t.r1,r.g1=t.g1,r.b1=t.b1,c){case j.RED:t.r1=i.cutLocation,r.r0=t.r1,r.g0=t.g0,r.b0=t.b0;break;case j.GREEN:t.g1=l.cutLocation,r.r0=t.r0,r.g0=t.g1,r.b0=t.b0;break;case j.BLUE:t.b1=u.cutLocation,r.r0=t.r0,r.g0=t.g0,r.b0=t.b1;break;default:throw new Error("unexpected direction "+c)}return t.vol=(t.r1-t.r0)*(t.g1-t.g0)*(t.b1-t.b0),r.vol=(r.r1-r.r0)*(r.g1-r.g0)*(r.b1-r.b0),!0}maximize(t,r,n,o,a,s,i,l){let u=this.bottom(t,r,this.momentsR),c=this.bottom(t,r,this.momentsG),m=this.bottom(t,r,this.momentsB),g=this.bottom(t,r,this.weights),f=0,y=-1,b=0,x=0,T=0,d=0;for(let A=n;A<o;A++){if(b=u+this.top(t,r,A,this.momentsR),x=c+this.top(t,r,A,this.momentsG),T=m+this.top(t,r,A,this.momentsB),d=g+this.top(t,r,A,this.weights),d===0)continue;let D=(b*b+x*x+T*T)*1,R=d*1,B=D/R;b=a-b,x=s-x,T=i-T,d=l-d,d!==0&&(D=(b*b+x*x+T*T)*1,R=d*1,B+=D/R,B>f&&(f=B,y=A));}return new te(y,f)}volume(t,r){return r[this.getIndex(t.r1,t.g1,t.b1)]-r[this.getIndex(t.r1,t.g1,t.b0)]-r[this.getIndex(t.r1,t.g0,t.b1)]+r[this.getIndex(t.r1,t.g0,t.b0)]-r[this.getIndex(t.r0,t.g1,t.b1)]+r[this.getIndex(t.r0,t.g1,t.b0)]+r[this.getIndex(t.r0,t.g0,t.b1)]-r[this.getIndex(t.r0,t.g0,t.b0)]}bottom(t,r,n){switch(r){case j.RED:return -n[this.getIndex(t.r0,t.g1,t.b1)]+n[this.getIndex(t.r0,t.g1,t.b0)]+n[this.getIndex(t.r0,t.g0,t.b1)]-n[this.getIndex(t.r0,t.g0,t.b0)];case j.GREEN:return -n[this.getIndex(t.r1,t.g0,t.b1)]+n[this.getIndex(t.r1,t.g0,t.b0)]+n[this.getIndex(t.r0,t.g0,t.b1)]-n[this.getIndex(t.r0,t.g0,t.b0)];case j.BLUE:return -n[this.getIndex(t.r1,t.g1,t.b0)]+n[this.getIndex(t.r1,t.g0,t.b0)]+n[this.getIndex(t.r0,t.g1,t.b0)]-n[this.getIndex(t.r0,t.g0,t.b0)];default:throw new Error("unexpected direction $direction")}}top(t,r,n,o){switch(r){case j.RED:return o[this.getIndex(n,t.g1,t.b1)]-o[this.getIndex(n,t.g1,t.b0)]-o[this.getIndex(n,t.g0,t.b1)]+o[this.getIndex(n,t.g0,t.b0)];case j.GREEN:return o[this.getIndex(t.r1,n,t.b1)]-o[this.getIndex(t.r1,n,t.b0)]-o[this.getIndex(t.r0,n,t.b1)]+o[this.getIndex(t.r0,n,t.b0)];case j.BLUE:return o[this.getIndex(t.r1,t.g1,n)]-o[this.getIndex(t.r1,t.g0,n)]-o[this.getIndex(t.r0,t.g1,n)]+o[this.getIndex(t.r0,t.g0,n)];default:throw new Error("unexpected direction $direction")}}getIndex(t,r,n){return (t<<St*2)+(t<<St+1)+t+(r<<St)+r+n}},Qt=class{constructor(t=0,r=0,n=0,o=0,a=0,s=0,i=0){this.r0=t,this.r1=r,this.g0=n,this.g1=o,this.b0=a,this.b1=s,this.vol=i;}},_t=class{constructor(t,r){this.requestedCount=t,this.resultCount=r;}},te=class{constructor(t,r){this.cutLocation=t,this.maximum=r;}};var Lt=class{static quantize(t,r){let o=new Et().quantize(t,r);return Bt.quantize(t,o,r)}};var $=class{get primary(){return this.props.primary}get onPrimary(){return this.props.onPrimary}get primaryContainer(){return this.props.primaryContainer}get onPrimaryContainer(){return this.props.onPrimaryContainer}get secondary(){return this.props.secondary}get onSecondary(){return this.props.onSecondary}get secondaryContainer(){return this.props.secondaryContainer}get onSecondaryContainer(){return this.props.onSecondaryContainer}get tertiary(){return this.props.tertiary}get onTertiary(){return this.props.onTertiary}get tertiaryContainer(){return this.props.tertiaryContainer}get onTertiaryContainer(){return this.props.onTertiaryContainer}get error(){return this.props.error}get onError(){return this.props.onError}get errorContainer(){return this.props.errorContainer}get onErrorContainer(){return this.props.onErrorContainer}get background(){return this.props.background}get onBackground(){return this.props.onBackground}get surface(){return this.props.surface}get onSurface(){return this.props.onSurface}get surfaceVariant(){return this.props.surfaceVariant}get onSurfaceVariant(){return this.props.onSurfaceVariant}get outline(){return this.props.outline}get outlineVariant(){return this.props.outlineVariant}get shadow(){return this.props.shadow}get scrim(){return this.props.scrim}get inverseSurface(){return this.props.inverseSurface}get inverseOnSurface(){return this.props.inverseOnSurface}get inversePrimary(){return this.props.inversePrimary}static light(t){return $.lightFromCorePalette(L.of(t))}static dark(t){return $.darkFromCorePalette(L.of(t))}static lightContent(t){return $.lightFromCorePalette(L.contentOf(t))}static darkContent(t){return $.darkFromCorePalette(L.contentOf(t))}static lightFromCorePalette(t){return new $({primary:t.a1.tone(40),onPrimary:t.a1.tone(100),primaryContainer:t.a1.tone(90),onPrimaryContainer:t.a1.tone(10),secondary:t.a2.tone(40),onSecondary:t.a2.tone(100),secondaryContainer:t.a2.tone(90),onSecondaryContainer:t.a2.tone(10),tertiary:t.a3.tone(40),onTertiary:t.a3.tone(100),tertiaryContainer:t.a3.tone(90),onTertiaryContainer:t.a3.tone(10),error:t.error.tone(40),onError:t.error.tone(100),errorContainer:t.error.tone(90),onErrorContainer:t.error.tone(10),background:t.n1.tone(99),onBackground:t.n1.tone(10),surface:t.n1.tone(99),onSurface:t.n1.tone(10),surfaceVariant:t.n2.tone(90),onSurfaceVariant:t.n2.tone(30),outline:t.n2.tone(50),outlineVariant:t.n2.tone(80),shadow:t.n1.tone(0),scrim:t.n1.tone(0),inverseSurface:t.n1.tone(20),inverseOnSurface:t.n1.tone(95),inversePrimary:t.a1.tone(80)})}static darkFromCorePalette(t){return new $({primary:t.a1.tone(80),onPrimary:t.a1.tone(20),primaryContainer:t.a1.tone(30),onPrimaryContainer:t.a1.tone(90),secondary:t.a2.tone(80),onSecondary:t.a2.tone(20),secondaryContainer:t.a2.tone(30),onSecondaryContainer:t.a2.tone(90),tertiary:t.a3.tone(80),onTertiary:t.a3.tone(20),tertiaryContainer:t.a3.tone(30),onTertiaryContainer:t.a3.tone(90),error:t.error.tone(80),onError:t.error.tone(20),errorContainer:t.error.tone(30),onErrorContainer:t.error.tone(80),background:t.n1.tone(10),onBackground:t.n1.tone(90),surface:t.n1.tone(10),onSurface:t.n1.tone(90),surfaceVariant:t.n2.tone(30),onSurfaceVariant:t.n2.tone(80),outline:t.n2.tone(60),outlineVariant:t.n2.tone(30),shadow:t.n1.tone(0),scrim:t.n1.tone(0),inverseSurface:t.n1.tone(90),inverseOnSurface:t.n1.tone(20),inversePrimary:t.a1.tone(40)})}constructor(t){this.props=t;}toJSON(){return pt({},this.props)}};var S=class{constructor(){}static score(t,r=!1){let n=0;for(let f of t.values())n+=f;let o=new Map,a=new Map,s=new Array(360).fill(0);for(let[f,y]of t.entries()){let b=y/n;o.set(f,b);let x=O.fromInt(f);a.set(f,x);let T=Math.round(x.hue);s[T]+=b;}let i=new Map;for(let[f,y]of a.entries()){let b=Math.round(y.hue),x=0;for(let T=b-15;T<b+15;T++){let d=jt(T);x+=s[d];}i.set(f,x);}let l=new Map;for(let[f,y]of a.entries()){let x=i.get(f)*100*S.WEIGHT_PROPORTION,T=y.chroma<S.TARGET_CHROMA?S.WEIGHT_CHROMA_BELOW:S.WEIGHT_CHROMA_ABOVE,d=(y.chroma-S.TARGET_CHROMA)*T,A=x+d;l.set(f,A);}let u=r?S.filterContent(a):S.filter(i,a),c=new Map;for(let f of u){let y=!1,b=a.get(f).hue;for(let[x]of c){let T=a.get(x).hue;if(wt(b,T)<15){y=!0;break}}y||c.set(f,l.get(f));}let m=Array.from(c.entries());m.sort((f,y)=>y[1]-f[1]);let g=m.map(f=>f[0]);return g.length===0&&g.push(4282549748),g}static filter(t,r){let n=new Array;for(let[o,a]of r.entries()){let s=t.get(o);a.chroma>=S.CUTOFF_CHROMA&&mt(o)>=S.CUTOFF_TONE&&s>=S.CUTOFF_EXCITED_PROPORTION&&n.push(o);}return n}static filterContent(t){return Array.from(t.keys())}};S.TARGET_CHROMA=48;S.WEIGHT_PROPORTION=.7;S.WEIGHT_CHROMA_ABOVE=.3;S.WEIGHT_CHROMA_BELOW=.1;S.CUTOFF_CHROMA=15;S.CUTOFF_TONE=10;S.CUTOFF_EXCITED_PROPORTION=.01;function yt(e){let t=lt(e),r=ht(e),n=ut(e),o=[t.toString(16),r.toString(16),n.toString(16)];for(let[a,s]of o.entries())s.length===1&&(o[a]="0"+s);return "#"+o.join("")}function ee(e){return W(this,null,function*(){let t=yield new Promise((s,i)=>{let l=document.createElement("canvas"),u=l.getContext("2d");if(!u){i(new Error("Could not get canvas context"));return}let c=()=>{l.width=e.width,l.height=e.height,u.drawImage(e,0,0);let m=[0,0,e.width,e.height],g=e.dataset.area;g&&/^\d+(\s*,\s*\d+){3}$/.test(g)&&(m=g.split(/\s*,\s*/).map(T=>parseInt(T,10)));let[f,y,b,x]=m;s(u.getImageData(f,y,b,x).data);};e.complete?c():e.onload=c;}),r=[];for(let s=0;s<t.length;s+=4){let i=t[s],l=t[s+1],u=t[s+2];if(t[s+3]<255)continue;let m=xt(i,l,u);r.push(m);}let n=Lt.quantize(r,128);return S.score(n)[0]})}function de(e,t){let r=t.value,n=r,o=e;t.blend&&(r=dt.harmonize(n,o));let s=L.of(r).a1;return {color:t,value:r,light:{color:s.tone(40),onColor:s.tone(100),colorContainer:s.tone(90),onColorContainer:s.tone(10)},dark:{color:s.tone(80),onColor:s.tone(20),colorContainer:s.tone(30),onColorContainer:s.tone(90)}}}var Le=Object.defineProperty,He=(e,t,r)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ct=(e,t,r)=>(He(e,typeof t!="symbol"?t+"":t,r),r),re=(e,t,r="",n)=>{for(let[o,a]of Object.entries(t.toJSON())){let s=o.replaceAll(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=n==="rgb"?Object.values(Xt(a)).slice(0,-1).join(" "):yt(a);e.style.setProperty(`--md-sys-color-${s}${r}`,i);}},ge=(e,t)=>{var o,a;let r=(t==null?void 0:t.target)||document.body,n=(o=t==null?void 0:t.dark)!=null&&o?e.schemes.dark:e.schemes.light;if(t!=null&&t.brightnessSuffix?(re(r,e.schemes.dark,"-dark",t==null?void 0:t.colorFormat),re(r,e.schemes.light,"-light",t==null?void 0:t.colorFormat)):re(r,n,"",t==null?void 0:t.colorFormat),t!=null&&t.paletteTones){let s=(a=t==null?void 0:t.paletteTones)!=null?a:[];for(let[i,l]of Object.entries(e.palettes)){let u=i.replaceAll(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();for(let c of s){let m=`--md-ref-palette-${u}${c}`,g=(t==null?void 0:t.colorFormat)==="rgb"?Object.values(Xt(l.tone(c))).slice(0,-1).join(" "):yt(l.tone(c));r.style.setProperty(m,g);}}}},z=class{constructor(t,r){Ct(this,"a1"),Ct(this,"a2"),Ct(this,"a3"),Ct(this,"n1"),Ct(this,"n2"),Ct(this,"error");let{hue:n,chroma:o}=I.fromInt(t);r?(this.a1=M.fromHueAndChroma(n,o),this.a2=M.fromHueAndChroma(n,o/3),this.a3=M.fromHueAndChroma(n+60,o/2),this.n1=M.fromHueAndChroma(n,Math.min(o/12,4)),this.n2=M.fromHueAndChroma(n,Math.min(o/6,8))):(this.a1=M.fromHueAndChroma(n,Math.max(48,o)),this.a2=M.fromHueAndChroma(n,16),this.a3=M.fromHueAndChroma(n+60,24),this.n1=M.fromHueAndChroma(n,6),this.n2=M.fromHueAndChroma(n,8)),this.error=M.fromHueAndChroma(25,84);}static of(t){return new z(t,!1)}static contentOf(t){return new z(t,!0)}static fromColors(t){return z.createPaletteFromColors(!1,t)}static contentFromColors(t){return z.createPaletteFromColors(!0,t)}static createPaletteFromColors(t,r){let n=new z(r.primary,t);if(r.secondary){let o=new z(r.secondary,t);n.a2=o.a1;}if(r.tertiary){let o=new z(r.tertiary,t);n.a3=o.a1;}if(r.error){let o=new z(r.error,t);n.error=o.a1;}if(r.neutral){let o=new z(r.neutral,t);n.n1=o.n1;}if(r.neutralVariant){let o=new z(r.neutralVariant,t);n.n2=o.n2;}return n}},tt=class{constructor(t){this.props=t;}get primary(){return this.props.primary}get onPrimary(){return this.props.onPrimary}get primaryContainer(){return this.props.primaryContainer}get onP