UNPKG

use-material-you

Version:

React hook to create dynamic schemes and variants based on M3/material-color-utilities

256 lines 78.2 kB
(function(rt,it){typeof exports=="object"&&typeof module<"u"?it(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],it):(rt=typeof globalThis<"u"?globalThis:rt||self,it(rt.mylib={},rt.React))})(this,function(rt,it){"use strict";function vt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const X=vt(it);/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function v(e){return e<0?-1:e===0?0:1}function ct(e,t,r){return(1-r)*e+r*t}function Gt(e,t,r){return r<e?e:r>t?t:r}function ft(e,t,r){return r<e?e:r>t?t:r}function mt(e){return e=e%360,e<0&&(e=e+360),e}function Y(e){return e=e%360,e<0&&(e=e+360),e}function Ht(e,t){return 180-Math.abs(Math.abs(e-t)-180)}function Ct(e,t){const 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],a=e[0]*t[2][0]+e[1]*t[2][1]+e[2]*t[2][2];return[r,n,a]}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Rt=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],Vt=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],wt=[95.047,100,108.883];function dt(e,t,r){return(255<<24|(e&255)<<16|(t&255)<<8|r&255)>>>0}function Ft(e){const t=nt(e[0]),r=nt(e[1]),n=nt(e[2]);return dt(t,r,n)}function qt(e){return e>>24&255}function gt(e){return e>>16&255}function pt(e){return e>>8&255}function yt(e){return e&255}function Et(e,t,r){const n=Vt,a=n[0][0]*e+n[0][1]*t+n[0][2]*r,o=n[1][0]*e+n[1][1]*t+n[1][2]*r,i=n[2][0]*e+n[2][1]*t+n[2][2]*r,c=nt(a),u=nt(o),m=nt(i);return dt(c,u,m)}function Ut(e){const t=$(gt(e)),r=$(pt(e)),n=$(yt(e));return Ct([t,r,n],Rt)}function jt(e,t,r){const n=wt,a=(e+16)/116,o=t/500+a,i=a-r/200,c=Pt(o),u=Pt(a),m=Pt(i),h=c*n[0],g=u*n[1],y=m*n[2];return Et(h,g,y)}function Ot(e){const t=$(gt(e)),r=$(pt(e)),n=$(yt(e)),a=Rt,o=a[0][0]*t+a[0][1]*r+a[0][2]*n,i=a[1][0]*t+a[1][1]*r+a[1][2]*n,c=a[2][0]*t+a[2][1]*r+a[2][2]*n,u=wt,m=o/u[0],h=i/u[1],g=c/u[2],y=ht(m),f=ht(h),d=ht(g),l=116*f-16,M=500*(y-f),w=200*(f-d);return[l,M,w]}function Yt(e){const t=tt(e),r=nt(t);return dt(r,r,r)}function Lt(e){const t=Ut(e)[1];return 116*ht(t/100)-16}function tt(e){return 100*Pt((e+16)/116)}function xt(e){return ht(e/100)*116-16}function $(e){const t=e/255;return t<=.040449936?t/12.92*100:Math.pow((t+.055)/1.055,2.4)*100}function nt(e){const t=e/100;let r=0;return t<=.0031308?r=t*12.92:r=1.055*Math.pow(t,1/2.4)-.055,Gt(0,255,Math.round(r*255))}function Wt(){return wt}function ht(e){const t=.008856451679035631,r=24389/27;return e>t?Math.pow(e,1/3):(r*e+16)/116}function Pt(e){const t=.008856451679035631,r=24389/27,n=e*e*e;return n>t?n:(116*e-16)/r}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class K{static make(t=Wt(),r=200/Math.PI*tt(50)/100,n=50,a=2,o=!1){const i=t,c=i[0]*.401288+i[1]*.650173+i[2]*-.051461,u=i[0]*-.250268+i[1]*1.204414+i[2]*.045854,m=i[0]*-.002079+i[1]*.048952+i[2]*.953127,h=.8+a/10,g=h>=.9?ct(.59,.69,(h-.9)*10):ct(.525,.59,(h-.8)*10);let y=o?1:h*(1-1/3.6*Math.exp((-r-42)/92));y=y>1?1:y<0?0:y;const f=h,d=[y*(100/c)+1-y,y*(100/u)+1-y,y*(100/m)+1-y],l=1/(5*r+1),M=l*l*l*l,w=1-M,p=M*r+.1*w*w*Math.cbrt(5*r),b=tt(n)/t[1],D=1.48+Math.sqrt(b),T=.725/Math.pow(b,.2),F=T,A=[Math.pow(p*d[0]*c/100,.42),Math.pow(p*d[1]*u/100,.42),Math.pow(p*d[2]*m/100,.42)],x=[400*A[0]/(A[0]+27.13),400*A[1]/(A[1]+27.13),400*A[2]/(A[2]+27.13)],R=(2*x[0]+x[1]+.05*x[2])*T;return new K(b,R,T,F,g,f,d,p,Math.pow(p,.25),D)}constructor(t,r,n,a,o,i,c,u,m,h){this.n=t,this.aw=r,this.nbb=n,this.ncb=a,this.c=o,this.nc=i,this.rgbD=c,this.fl=u,this.fLRoot=m,this.z=h}}K.DEFAULT=K.make();/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class U{constructor(t,r,n,a,o,i,c,u,m){this.hue=t,this.chroma=r,this.j=n,this.q=a,this.m=o,this.s=i,this.jstar=c,this.astar=u,this.bstar=m}distance(t){const r=this.jstar-t.jstar,n=this.astar-t.astar,a=this.bstar-t.bstar,o=Math.sqrt(r*r+n*n+a*a);return 1.41*Math.pow(o,.63)}static fromInt(t){return U.fromIntInViewingConditions(t,K.DEFAULT)}static fromIntInViewingConditions(t,r){const n=(t&16711680)>>16,a=(t&65280)>>8,o=t&255,i=$(n),c=$(a),u=$(o),m=.41233895*i+.35762064*c+.18051042*u,h=.2126*i+.7152*c+.0722*u,g=.01932141*i+.11916382*c+.95034478*u,y=.401288*m+.650173*h-.051461*g,f=-.250268*m+1.204414*h+.045854*g,d=-.002079*m+.048952*h+.953127*g,l=r.rgbD[0]*y,M=r.rgbD[1]*f,w=r.rgbD[2]*d,p=Math.pow(r.fl*Math.abs(l)/100,.42),b=Math.pow(r.fl*Math.abs(M)/100,.42),D=Math.pow(r.fl*Math.abs(w)/100,.42),T=v(l)*400*p/(p+27.13),F=v(M)*400*b/(b+27.13),A=v(w)*400*D/(D+27.13),x=(11*T+-12*F+A)/11,R=(T+F-2*A)/9,B=(20*T+20*F+21*A)/20,_=(40*T+20*F+A)/20,q=Math.atan2(R,x)*180/Math.PI,L=q<0?q+360:q>=360?q-360:q,at=L*Math.PI/180,At=_*r.nbb,et=100*Math.pow(At/r.aw,r.c*r.z),Mt=4/r.c*Math.sqrt(et/100)*(r.aw+4)*r.fLRoot,kt=L<20.14?L+360:L,Tt=.25*(Math.cos(kt*Math.PI/180+2)+3.8),Bt=5e4/13*Tt*r.nc*r.ncb*Math.sqrt(x*x+R*R)/(B+.305),It=Math.pow(Bt,.9)*Math.pow(1.64-Math.pow(.29,r.n),.73),Nt=It*Math.sqrt(et/100),zt=Nt*r.fLRoot,ke=50*Math.sqrt(It*r.c/(r.aw+4)),Te=(1+100*.007)*et/(1+.007*et),_t=1/.0228*Math.log(1+.0228*zt),De=_t*Math.cos(at),Be=_t*Math.sin(at);return new U(L,Nt,et,Mt,zt,ke,Te,De,Be)}static fromJch(t,r,n){return U.fromJchInViewingConditions(t,r,n,K.DEFAULT)}static fromJchInViewingConditions(t,r,n,a){const o=4/a.c*Math.sqrt(t/100)*(a.aw+4)*a.fLRoot,i=r*a.fLRoot,c=r/Math.sqrt(t/100),u=50*Math.sqrt(c*a.c/(a.aw+4)),m=n*Math.PI/180,h=(1+100*.007)*t/(1+.007*t),g=1/.0228*Math.log(1+.0228*i),y=g*Math.cos(m),f=g*Math.sin(m);return new U(n,r,t,o,i,u,h,y,f)}static fromUcs(t,r,n){return U.fromUcsInViewingConditions(t,r,n,K.DEFAULT)}static fromUcsInViewingConditions(t,r,n,a){const o=r,i=n,c=Math.sqrt(o*o+i*i),m=(Math.exp(c*.0228)-1)/.0228/a.fLRoot;let h=Math.atan2(i,o)*(180/Math.PI);h<0&&(h+=360);const g=t/(1-(t-100)*.007);return U.fromJchInViewingConditions(g,m,h,a)}toInt(){return this.viewed(K.DEFAULT)}viewed(t){const 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),a=this.hue*Math.PI/180,o=.25*(Math.cos(a+2)+3.8),i=t.aw*Math.pow(this.j/100,1/t.c/t.z),c=o*(5e4/13)*t.nc*t.ncb,u=i/t.nbb,m=Math.sin(a),h=Math.cos(a),g=23*(u+.305)*n/(23*c+11*n*h+108*n*m),y=g*h,f=g*m,d=(460*u+451*y+288*f)/1403,l=(460*u-891*y-261*f)/1403,M=(460*u-220*y-6300*f)/1403,w=Math.max(0,27.13*Math.abs(d)/(400-Math.abs(d))),p=v(d)*(100/t.fl)*Math.pow(w,1/.42),b=Math.max(0,27.13*Math.abs(l)/(400-Math.abs(l))),D=v(l)*(100/t.fl)*Math.pow(b,1/.42),T=Math.max(0,27.13*Math.abs(M)/(400-Math.abs(M))),F=v(M)*(100/t.fl)*Math.pow(T,1/.42),A=p/t.rgbD[0],x=D/t.rgbD[1],R=F/t.rgbD[2],B=1.86206786*A-1.01125463*x+.14918677*R,_=.38752654*A+.62144744*x-.00897398*R,j=-.0158415*A-.03412294*x+1.04996444*R;return Et(B,_,j)}static fromXyzInViewingConditions(t,r,n,a){const o=.401288*t+.650173*r-.051461*n,i=-.250268*t+1.204414*r+.045854*n,c=-.002079*t+.048952*r+.953127*n,u=a.rgbD[0]*o,m=a.rgbD[1]*i,h=a.rgbD[2]*c,g=Math.pow(a.fl*Math.abs(u)/100,.42),y=Math.pow(a.fl*Math.abs(m)/100,.42),f=Math.pow(a.fl*Math.abs(h)/100,.42),d=v(u)*400*g/(g+27.13),l=v(m)*400*y/(y+27.13),M=v(h)*400*f/(f+27.13),w=(11*d+-12*l+M)/11,p=(d+l-2*M)/9,b=(20*d+20*l+21*M)/20,D=(40*d+20*l+M)/20,F=Math.atan2(p,w)*180/Math.PI,A=F<0?F+360:F>=360?F-360:F,x=A*Math.PI/180,R=D*a.nbb,B=100*Math.pow(R/a.aw,a.c*a.z),_=4/a.c*Math.sqrt(B/100)*(a.aw+4)*a.fLRoot,j=A<20.14?A+360:A,q=1/4*(Math.cos(j*Math.PI/180+2)+3.8),at=5e4/13*q*a.nc*a.ncb*Math.sqrt(w*w+p*p)/(b+.305),At=Math.pow(at,.9)*Math.pow(1.64-Math.pow(.29,a.n),.73),et=At*Math.sqrt(B/100),Mt=et*a.fLRoot,kt=50*Math.sqrt(At*a.c/(a.aw+4)),Tt=(1+100*.007)*B/(1+.007*B),Dt=Math.log(1+.0228*Mt)/.0228,Bt=Dt*Math.cos(x),It=Dt*Math.sin(x);return new U(A,et,B,_,Mt,kt,Tt,Bt,It)}xyzInViewingConditions(t){const 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),a=this.hue*Math.PI/180,o=.25*(Math.cos(a+2)+3.8),i=t.aw*Math.pow(this.j/100,1/t.c/t.z),c=o*(5e4/13)*t.nc*t.ncb,u=i/t.nbb,m=Math.sin(a),h=Math.cos(a),g=23*(u+.305)*n/(23*c+11*n*h+108*n*m),y=g*h,f=g*m,d=(460*u+451*y+288*f)/1403,l=(460*u-891*y-261*f)/1403,M=(460*u-220*y-6300*f)/1403,w=Math.max(0,27.13*Math.abs(d)/(400-Math.abs(d))),p=v(d)*(100/t.fl)*Math.pow(w,1/.42),b=Math.max(0,27.13*Math.abs(l)/(400-Math.abs(l))),D=v(l)*(100/t.fl)*Math.pow(b,1/.42),T=Math.max(0,27.13*Math.abs(M)/(400-Math.abs(M))),F=v(M)*(100/t.fl)*Math.pow(T,1/.42),A=p/t.rgbD[0],x=D/t.rgbD[1],R=F/t.rgbD[2],B=1.86206786*A-1.01125463*x+.14918677*R,_=.38752654*A+.62144744*x-.00897398*R,j=-.0158415*A-.03412294*x+1.04996444*R;return[B,_,j]}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class C{static sanitizeRadians(t){return(t+Math.PI*8)%(Math.PI*2)}static trueDelinearized(t){const r=t/100;let n=0;return r<=.0031308?n=r*12.92:n=1.055*Math.pow(r,1/2.4)-.055,n*255}static chromaticAdaptation(t){const r=Math.pow(Math.abs(t),.42);return v(t)*400*r/(r+27.13)}static hueOf(t){const r=Ct(t,C.SCALED_DISCOUNT_FROM_LINRGB),n=C.chromaticAdaptation(r[0]),a=C.chromaticAdaptation(r[1]),o=C.chromaticAdaptation(r[2]),i=(11*n+-12*a+o)/11,c=(n+a-2*o)/9;return Math.atan2(c,i)}static areInCyclicOrder(t,r,n){const a=C.sanitizeRadians(r-t),o=C.sanitizeRadians(n-t);return a<o}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,a){const o=C.intercept(t[a],r,n[a]);return C.lerpPoint(t,o,n)}static isBounded(t){return 0<=t&&t<=100}static nthVertex(t,r){const n=C.Y_FROM_LINRGB[0],a=C.Y_FROM_LINRGB[1],o=C.Y_FROM_LINRGB[2],i=r%4<=1?0:100,c=r%2===0?0:100;if(r<4){const u=i,m=c,h=(t-u*a-m*o)/n;return C.isBounded(h)?[h,u,m]:[-1,-1,-1]}else if(r<8){const u=i,m=c,h=(t-m*n-u*o)/a;return C.isBounded(h)?[m,h,u]:[-1,-1,-1]}else{const u=i,m=c,h=(t-u*n-m*a)/o;return C.isBounded(h)?[u,m,h]:[-1,-1,-1]}}static bisectToSegment(t,r){let n=[-1,-1,-1],a=n,o=0,i=0,c=!1,u=!0;for(let m=0;m<12;m++){const h=C.nthVertex(t,m);if(h[0]<0)continue;const g=C.hueOf(h);if(!c){n=h,a=h,o=g,i=g,c=!0;continue}(u||C.areInCyclicOrder(o,g,i))&&(u=!1,C.areInCyclicOrder(o,r,g)?(a=h,i=g):(n=h,o=g))}return[n,a]}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){const n=C.bisectToSegment(t,r);let a=n[0],o=C.hueOf(a),i=n[1];for(let c=0;c<3;c++)if(a[c]!==i[c]){let u=-1,m=255;a[c]<i[c]?(u=C.criticalPlaneBelow(C.trueDelinearized(a[c])),m=C.criticalPlaneAbove(C.trueDelinearized(i[c]))):(u=C.criticalPlaneAbove(C.trueDelinearized(a[c])),m=C.criticalPlaneBelow(C.trueDelinearized(i[c])));for(let h=0;h<8&&!(Math.abs(m-u)<=1);h++){const g=Math.floor((u+m)/2),y=C.CRITICAL_PLANES[g],f=C.setCoordinate(a,y,i,c),d=C.hueOf(f);C.areInCyclicOrder(o,r,d)?(i=f,m=g):(a=f,o=d,u=g)}}return C.midpoint(a,i)}static inverseChromaticAdaptation(t){const r=Math.abs(t),n=Math.max(0,27.13*r/(400-r));return v(t)*Math.pow(n,1/.42)}static findResultByJ(t,r,n){let a=Math.sqrt(n)*11;const o=K.DEFAULT,i=1/Math.pow(1.64-Math.pow(.29,o.n),.73),u=.25*(Math.cos(t+2)+3.8)*(5e4/13)*o.nc*o.ncb,m=Math.sin(t),h=Math.cos(t);for(let g=0;g<5;g++){const y=a/100,f=r===0||a===0?0:r/Math.sqrt(y),d=Math.pow(f*i,1/.9),M=o.aw*Math.pow(y,1/o.c/o.z)/o.nbb,w=23*(M+.305)*d/(23*u+11*d*h+108*d*m),p=w*h,b=w*m,D=(460*M+451*p+288*b)/1403,T=(460*M-891*p-261*b)/1403,F=(460*M-220*p-6300*b)/1403,A=C.inverseChromaticAdaptation(D),x=C.inverseChromaticAdaptation(T),R=C.inverseChromaticAdaptation(F),B=Ct([A,x,R],C.LINRGB_FROM_SCALED_DISCOUNT);if(B[0]<0||B[1]<0||B[2]<0)return 0;const _=C.Y_FROM_LINRGB[0],j=C.Y_FROM_LINRGB[1],q=C.Y_FROM_LINRGB[2],L=_*B[0]+j*B[1]+q*B[2];if(L<=0)return 0;if(g===4||Math.abs(L-n)<.002)return B[0]>100.01||B[1]>100.01||B[2]>100.01?0:Ft(B);a=a-(L-n)*a/(2*L)}return 0}static solveToInt(t,r,n){if(r<1e-4||n<1e-4||n>99.9999)return Yt(n);t=Y(t);const a=t/180*Math.PI,o=tt(n),i=C.findResultByJ(a,r,o);if(i!==0)return i;const c=C.bisectToLimit(o,a);return Ft(c)}static solveToCam(t,r,n){return U.fromInt(C.solveToInt(t,r,n))}}C.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]],C.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]],C.Y_FROM_LINRGB=[.2126,.7152,.0722],C.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];/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class S{static from(t,r,n){return new S(C.solveToInt(t,r,n))}static fromInt(t){return new S(t)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(t){this.setInternalState(C.solveToInt(t,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(t){this.setInternalState(C.solveToInt(this.internalHue,t,this.internalTone))}get tone(){return this.internalTone}set tone(t){this.setInternalState(C.solveToInt(this.internalHue,this.internalChroma,t))}constructor(t){this.argb=t;const r=U.fromInt(t);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=Lt(t),this.argb=t}setInternalState(t){const r=U.fromInt(t);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=Lt(t),this.argb=t}inViewingConditions(t){const n=U.fromInt(this.toInt()).xyzInViewingConditions(t),a=U.fromXyzInViewingConditions(n[0],n[1],n[2],K.make());return S.from(a.hue,a.chroma,xt(n[1]))}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class O{static ratioOfTones(t,r){return t=ft(0,100,t),r=ft(0,100,r),O.ratioOfYs(tt(t),tt(r))}static ratioOfYs(t,r){const n=t>r?t:r,a=n===r?t:r;return(n+5)/(a+5)}static lighter(t,r){if(t<0||t>100)return-1;const n=tt(t),a=r*(n+5)-5,o=O.ratioOfYs(a,n),i=Math.abs(o-r);if(o<r&&i>.04)return-1;const c=xt(a)+.4;return c<0||c>100?-1:c}static darker(t,r){if(t<0||t>100)return-1;const n=tt(t),a=(n+5)/r-5,o=O.ratioOfYs(n,a),i=Math.abs(o-r);if(o<r&&i>.04)return-1;const c=xt(a)-.4;return c<0||c>100?-1:c}static lighterUnsafe(t,r){const n=O.lighter(t,r);return n<0?100:n}static darkerUnsafe(t,r){const n=O.darker(t,r);return n<0?0:n}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ut{static isDisliked(t){const r=Math.round(t.hue)>=90&&Math.round(t.hue)<=111,n=Math.round(t.chroma)>16,a=Math.round(t.tone)<65;return r&&n&&a}static fixIfDisliked(t){return ut.isDisliked(t)?S.from(t.hue,t.chroma,70):t}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class P{static fromPalette(t){return new P(t.name??"",t.palette,t.tone,t.isBackground??!1,t.background,t.secondBackground,t.contrastCurve,t.toneDeltaPair)}constructor(t,r,n,a,o,i,c,u){if(this.name=t,this.palette=r,this.tone=n,this.isBackground=a,this.background=o,this.secondBackground=i,this.contrastCurve=c,this.toneDeltaPair=u,this.hctCache=new Map,!o&&i)throw new Error(`Color ${t} has secondBackgrounddefined, but background is not defined.`);if(!o&&c)throw new Error(`Color ${t} has contrastCurvedefined, but background is not defined.`);if(o&&!c)throw new Error(`Color ${t} has backgrounddefined, but contrastCurve is not defined.`)}getArgb(t){return this.getHct(t).toInt()}getHct(t){const r=this.hctCache.get(t);if(r!=null)return r;const n=this.getTone(t),a=this.palette(t).getHct(n);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(t,a),a}getTone(t){const r=t.contrastLevel<0;if(this.toneDeltaPair){const n=this.toneDeltaPair(t),a=n.roleA,o=n.roleB,i=n.delta,c=n.polarity,u=n.stayTogether,h=this.background(t).getTone(t),g=c==="nearer"||c==="lighter"&&!t.isDark||c==="darker"&&t.isDark,y=g?a:o,f=g?o:a,d=this.name===y.name,l=t.isDark?1:-1,M=y.contrastCurve.get(t.contrastLevel),w=f.contrastCurve.get(t.contrastLevel),p=y.tone(t);let b=O.ratioOfTones(h,p)>=M?p:P.foregroundTone(h,M);const D=f.tone(t);let T=O.ratioOfTones(h,D)>=w?D:P.foregroundTone(h,w);return r&&(b=P.foregroundTone(h,M),T=P.foregroundTone(h,w)),(T-b)*l>=i||(T=ft(0,100,b+i*l),(T-b)*l>=i||(b=ft(0,100,T-i*l))),50<=b&&b<60?l>0?(b=60,T=Math.max(T,b+i*l)):(b=49,T=Math.min(T,b+i*l)):50<=T&&T<60&&(u?l>0?(b=60,T=Math.max(T,b+i*l)):(b=49,T=Math.min(T,b+i*l)):l>0?T=60:T=49),d?b:T}else{let n=this.tone(t);if(this.background==null)return n;const a=this.background(t).getTone(t),o=this.contrastCurve.get(t.contrastLevel);if(O.ratioOfTones(a,n)>=o||(n=P.foregroundTone(a,o)),r&&(n=P.foregroundTone(a,o)),this.isBackground&&50<=n&&n<60&&(O.ratioOfTones(49,a)>=o?n=49:n=60),this.secondBackground){const[i,c]=[this.background,this.secondBackground],[u,m]=[i(t).getTone(t),c(t).getTone(t)],[h,g]=[Math.max(u,m),Math.min(u,m)];if(O.ratioOfTones(h,n)>=o&&O.ratioOfTones(g,n)>=o)return n;const y=O.lighter(h,o),f=O.darker(g,o),d=[];return y!==-1&&d.push(y),f!==-1&&d.push(f),P.tonePrefersLightForeground(u)||P.tonePrefersLightForeground(m)?y<0?100:y:d.length===1?d[0]:f<0?0:f}return n}}static foregroundTone(t,r){const n=O.lighterUnsafe(t,r),a=O.darkerUnsafe(t,r),o=O.ratioOfTones(n,t),i=O.ratioOfTones(a,t);if(P.tonePrefersLightForeground(t)){const u=Math.abs(o-i)<.1&&o<r&&i<r;return o>=r||o>=i||u?n:a}else return i>=r||i>=o?a:n}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}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class I{static fromInt(t){const r=S.fromInt(t);return I.fromHct(r)}static fromHct(t){return new I(t.hue,t.chroma,t)}static fromHueAndChroma(t,r){const n=new Kt(t,r).create();return new I(t,r,n)}constructor(t,r,n){this.hue=t,this.chroma=r,this.keyColor=n,this.cache=new Map}tone(t){let r=this.cache.get(t);return r===void 0&&(r=S.from(this.hue,this.chroma,t).toInt(),this.cache.set(t,r)),r}getHct(t){return S.fromInt(this.tone(t))}}class Kt{constructor(t,r){this.hue=t,this.requestedChroma=r,this.chromaCache=new Map,this.maxChromaValue=200}create(){let a=0,o=100;for(;a<o;){const i=Math.floor((a+o)/2),c=this.maxChroma(i)<this.maxChroma(i+1);if(this.maxChroma(i)>=this.requestedChroma-.01)if(Math.abs(a-50)<Math.abs(o-50))o=i;else{if(a===i)return S.from(this.hue,this.requestedChroma,a);a=i}else c?a=i+1:o=i}return S.from(this.hue,this.requestedChroma,a)}maxChroma(t){if(this.chromaCache.has(t))return this.chromaCache.get(t);const r=S.from(this.hue,this.maxChromaValue,t).chroma;return this.chromaCache.set(t,r),r}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class k{constructor(t,r,n,a){this.low=t,this.normal=r,this.medium=n,this.high=a}get(t){return t<=-1?this.low:t<0?ct(this.low,this.normal,(t- -1)/1):t<.5?ct(this.normal,this.medium,(t-0)/.5):t<1?ct(this.medium,this.high,(t-.5)/.5):this.high}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class G{constructor(t,r,n,a,o){this.roleA=t,this.roleB=r,this.delta=n,this.polarity=a,this.stayTogether=o}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var H;(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",e[e.RAINBOW=7]="RAINBOW",e[e.FRUIT_SALAD=8]="FRUIT_SALAD"})(H||(H={}));/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function st(e){return e.variant===H.FIDELITY||e.variant===H.CONTENT}function E(e){return e.variant===H.MONOCHROME}function Xt(e,t,r,n){let a=r,o=S.from(e,t,r);if(o.chroma<t){let i=o.chroma;for(;o.chroma<t;){a+=n?-1:1;const c=S.from(e,t,a);if(i>c.chroma||Math.abs(c.chroma-t)<.4)break;const u=Math.abs(c.chroma-t),m=Math.abs(o.chroma-t);u<m&&(o=c),i=Math.max(i,c.chroma)}}return a}class s{static highestSurface(t){return t.isDark?s.surfaceBright:s.surfaceDim}}s.contentAccentToneDelta=15,s.primaryPaletteKeyColor=P.fromPalette({name:"primary_palette_key_color",palette:e=>e.primaryPalette,tone:e=>e.primaryPalette.keyColor.tone}),s.secondaryPaletteKeyColor=P.fromPalette({name:"secondary_palette_key_color",palette:e=>e.secondaryPalette,tone:e=>e.secondaryPalette.keyColor.tone}),s.tertiaryPaletteKeyColor=P.fromPalette({name:"tertiary_palette_key_color",palette:e=>e.tertiaryPalette,tone:e=>e.tertiaryPalette.keyColor.tone}),s.neutralPaletteKeyColor=P.fromPalette({name:"neutral_palette_key_color",palette:e=>e.neutralPalette,tone:e=>e.neutralPalette.keyColor.tone}),s.neutralVariantPaletteKeyColor=P.fromPalette({name:"neutral_variant_palette_key_color",palette:e=>e.neutralVariantPalette,tone:e=>e.neutralVariantPalette.keyColor.tone}),s.background=P.fromPalette({name:"background",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0}),s.onBackground=P.fromPalette({name:"on_background",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>s.background,contrastCurve:new k(3,3,4.5,7)}),s.surface=P.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0}),s.surfaceDim=P.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:new k(87,87,80,75).get(e.contrastLevel),isBackground:!0}),s.surfaceBright=P.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?new k(24,24,29,34).get(e.contrastLevel):98,isBackground:!0}),s.surfaceContainerLowest=P.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new k(4,4,2,0).get(e.contrastLevel):100,isBackground:!0}),s.surfaceContainerLow=P.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>e.isDark?new k(10,10,11,12).get(e.contrastLevel):new k(96,96,96,95).get(e.contrastLevel),isBackground:!0}),s.surfaceContainer=P.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>e.isDark?new k(12,12,16,20).get(e.contrastLevel):new k(94,94,92,90).get(e.contrastLevel),isBackground:!0}),s.surfaceContainerHigh=P.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>e.isDark?new k(17,17,21,25).get(e.contrastLevel):new k(92,92,88,85).get(e.contrastLevel),isBackground:!0}),s.surfaceContainerHighest=P.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new k(22,22,26,30).get(e.contrastLevel):new k(90,90,84,80).get(e.contrastLevel),isBackground:!0}),s.onSurface=P.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>s.highestSurface(e),contrastCurve:new k(4.5,7,11,21)}),s.surfaceVariant=P.fromPalette({name:"surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:90,isBackground:!0}),s.onSurfaceVariant=P.fromPalette({name:"on_surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?80:30,background:e=>s.highestSurface(e),contrastCurve:new k(3,4.5,7,11)}),s.inverseSurface=P.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:20}),s.inverseOnSurface=P.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?20:95,background:e=>s.inverseSurface,contrastCurve:new k(4.5,7,11,21)}),s.outline=P.fromPalette({name:"outline",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?60:50,background:e=>s.highestSurface(e),contrastCurve:new k(1.5,3,4.5,7)}),s.outlineVariant=P.fromPalette({name:"outline_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:80,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5)}),s.shadow=P.fromPalette({name:"shadow",palette:e=>e.neutralPalette,tone:e=>0}),s.scrim=P.fromPalette({name:"scrim",palette:e=>e.neutralPalette,tone:e=>0}),s.surfaceTint=P.fromPalette({name:"surface_tint",palette:e=>e.primaryPalette,tone:e=>e.isDark?80:40,isBackground:!0}),s.primary=P.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>E(e)?e.isDark?100:0:e.isDark?80:40,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(3,4.5,7,7),toneDeltaPair:e=>new G(s.primaryContainer,s.primary,10,"nearer",!1)}),s.onPrimary=P.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,tone:e=>E(e)?e.isDark?10:90:e.isDark?20:100,background:e=>s.primary,contrastCurve:new k(4.5,7,11,21)}),s.primaryContainer=P.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>st(e)?e.sourceColorHct.tone:E(e)?e.isDark?85:25:e.isDark?30:90,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5),toneDeltaPair:e=>new G(s.primaryContainer,s.primary,10,"nearer",!1)}),s.onPrimaryContainer=P.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,tone:e=>st(e)?P.foregroundTone(s.primaryContainer.tone(e),4.5):E(e)?e.isDark?0:100:e.isDark?90:30,background:e=>s.primaryContainer,contrastCurve:new k(3,4.5,7,11)}),s.inversePrimary=P.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>e.isDark?40:80,background:e=>s.inverseSurface,contrastCurve:new k(3,4.5,7,7)}),s.secondary=P.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(3,4.5,7,7),toneDeltaPair:e=>new G(s.secondaryContainer,s.secondary,10,"nearer",!1)}),s.onSecondary=P.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,tone:e=>E(e)?e.isDark?10:100:e.isDark?20:100,background:e=>s.secondary,contrastCurve:new k(4.5,7,11,21)}),s.secondaryContainer=P.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>{const t=e.isDark?30:90;return E(e)?e.isDark?30:85:st(e)?Xt(e.secondaryPalette.hue,e.secondaryPalette.chroma,t,!e.isDark):t},isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5),toneDeltaPair:e=>new G(s.secondaryContainer,s.secondary,10,"nearer",!1)}),s.onSecondaryContainer=P.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,tone:e=>E(e)?e.isDark?90:10:st(e)?P.foregroundTone(s.secondaryContainer.tone(e),4.5):e.isDark?90:30,background:e=>s.secondaryContainer,contrastCurve:new k(3,4.5,7,11)}),s.tertiary=P.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>E(e)?e.isDark?90:25:e.isDark?80:40,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(3,4.5,7,7),toneDeltaPair:e=>new G(s.tertiaryContainer,s.tertiary,10,"nearer",!1)}),s.onTertiary=P.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,tone:e=>E(e)?e.isDark?10:90:e.isDark?20:100,background:e=>s.tertiary,contrastCurve:new k(4.5,7,11,21)}),s.tertiaryContainer=P.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>{if(E(e))return e.isDark?60:49;if(!st(e))return e.isDark?30:90;const t=e.tertiaryPalette.getHct(e.sourceColorHct.tone);return ut.fixIfDisliked(t).tone},isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5),toneDeltaPair:e=>new G(s.tertiaryContainer,s.tertiary,10,"nearer",!1)}),s.onTertiaryContainer=P.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>E(e)?e.isDark?0:100:st(e)?P.foregroundTone(s.tertiaryContainer.tone(e),4.5):e.isDark?90:30,background:e=>s.tertiaryContainer,contrastCurve:new k(3,4.5,7,11)}),s.error=P.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(3,4.5,7,7),toneDeltaPair:e=>new G(s.errorContainer,s.error,10,"nearer",!1)}),s.onError=P.fromPalette({name:"on_error",palette:e=>e.errorPalette,tone:e=>e.isDark?20:100,background:e=>s.error,contrastCurve:new k(4.5,7,11,21)}),s.errorContainer=P.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>e.isDark?30:90,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5),toneDeltaPair:e=>new G(s.errorContainer,s.error,10,"nearer",!1)}),s.onErrorContainer=P.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,tone:e=>E(e)?e.isDark?90:10:e.isDark?90:30,background:e=>s.errorContainer,contrastCurve:new k(3,4.5,7,11)}),s.primaryFixed=P.fromPalette({name:"primary_fixed",palette:e=>e.primaryPalette,tone:e=>E(e)?40:90,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5),toneDeltaPair:e=>new G(s.primaryFixed,s.primaryFixedDim,10,"lighter",!0)}),s.primaryFixedDim=P.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>E(e)?30:80,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5),toneDeltaPair:e=>new G(s.primaryFixed,s.primaryFixedDim,10,"lighter",!0)}),s.onPrimaryFixed=P.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,tone:e=>E(e)?100:10,background:e=>s.primaryFixedDim,secondBackground:e=>s.primaryFixed,contrastCurve:new k(4.5,7,11,21)}),s.onPrimaryFixedVariant=P.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,tone:e=>E(e)?90:30,background:e=>s.primaryFixedDim,secondBackground:e=>s.primaryFixed,contrastCurve:new k(3,4.5,7,11)}),s.secondaryFixed=P.fromPalette({name:"secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>E(e)?80:90,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5),toneDeltaPair:e=>new G(s.secondaryFixed,s.secondaryFixedDim,10,"lighter",!0)}),s.secondaryFixedDim=P.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>E(e)?70:80,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5),toneDeltaPair:e=>new G(s.secondaryFixed,s.secondaryFixedDim,10,"lighter",!0)}),s.onSecondaryFixed=P.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>10,background:e=>s.secondaryFixedDim,secondBackground:e=>s.secondaryFixed,contrastCurve:new k(4.5,7,11,21)}),s.onSecondaryFixedVariant=P.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,tone:e=>E(e)?25:30,background:e=>s.secondaryFixedDim,secondBackground:e=>s.secondaryFixed,contrastCurve:new k(3,4.5,7,11)}),s.tertiaryFixed=P.fromPalette({name:"tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>E(e)?40:90,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5),toneDeltaPair:e=>new G(s.tertiaryFixed,s.tertiaryFixedDim,10,"lighter",!0)}),s.tertiaryFixedDim=P.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>E(e)?30:80,isBackground:!0,background:e=>s.highestSurface(e),contrastCurve:new k(1,1,3,4.5),toneDeltaPair:e=>new G(s.tertiaryFixed,s.tertiaryFixedDim,10,"lighter",!0)}),s.onTertiaryFixed=P.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>E(e)?100:10,background:e=>s.tertiaryFixedDim,secondBackground:e=>s.tertiaryFixed,contrastCurve:new k(4.5,7,11,21)}),s.onTertiaryFixedVariant=P.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,tone:e=>E(e)?90:30,background:e=>s.tertiaryFixedDim,secondBackground:e=>s.tertiaryFixed,contrastCurve:new k(3,4.5,7,11)});/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class V{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.variant,this.contrastLevel=t.contrastLevel,this.isDark=t.isDark,this.sourceColorHct=S.fromInt(t.sourceColorArgb),this.primaryPalette=t.primaryPalette,this.secondaryPalette=t.secondaryPalette,this.tertiaryPalette=t.tertiaryPalette,this.neutralPalette=t.neutralPalette,this.neutralVariantPalette=t.neutralVariantPalette,this.errorPalette=I.fromHueAndChroma(25,84)}static getRotatedHue(t,r,n){const a=t.hue;if(r.length!==n.length)throw new Error(`mismatch between hue length ${r.length} & rotations ${n.length}`);if(n.length===1)return Y(t.hue+n[0]);const o=r.length;for(let i=0;i<=o-2;i++){const c=r[i],u=r[i+1];if(c<a&&a<u)return Y(a+n[i])}return a}getArgb(t){return t.getArgb(this)}getHct(t){return t.getHct(this)}get primaryPaletteKeyColor(){return this.getArgb(s.primaryPaletteKeyColor)}get secondaryPaletteKeyColor(){return this.getArgb(s.secondaryPaletteKeyColor)}get tertiaryPaletteKeyColor(){return this.getArgb(s.tertiaryPaletteKeyColor)}get neutralPaletteKeyColor(){return this.getArgb(s.neutralPaletteKeyColor)}get neutralVariantPaletteKeyColor(){return this.getArgb(s.neutralVariantPaletteKeyColor)}get background(){return this.getArgb(s.background)}get onBackground(){return this.getArgb(s.onBackground)}get surface(){return this.getArgb(s.surface)}get surfaceDim(){return this.getArgb(s.surfaceDim)}get surfaceBright(){return this.getArgb(s.surfaceBright)}get surfaceContainerLowest(){return this.getArgb(s.surfaceContainerLowest)}get surfaceContainerLow(){return this.getArgb(s.surfaceContainerLow)}get surfaceContainer(){return this.getArgb(s.surfaceContainer)}get surfaceContainerHigh(){return this.getArgb(s.surfaceContainerHigh)}get surfaceContainerHighest(){return this.getArgb(s.surfaceContainerHighest)}get onSurface(){return this.getArgb(s.onSurface)}get surfaceVariant(){return this.getArgb(s.surfaceVariant)}get onSurfaceVariant(){return this.getArgb(s.onSurfaceVariant)}get inverseSurface(){return this.getArgb(s.inverseSurface)}get inverseOnSurface(){return this.getArgb(s.inverseOnSurface)}get outline(){return this.getArgb(s.outline)}get outlineVariant(){return this.getArgb(s.outlineVariant)}get shadow(){return this.getArgb(s.shadow)}get scrim(){return this.getArgb(s.scrim)}get surfaceTint(){return this.getArgb(s.surfaceTint)}get primary(){return this.getArgb(s.primary)}get onPrimary(){return this.getArgb(s.onPrimary)}get primaryContainer(){return this.getArgb(s.primaryContainer)}get onPrimaryContainer(){return this.getArgb(s.onPrimaryContainer)}get inversePrimary(){return this.getArgb(s.inversePrimary)}get secondary(){return this.getArgb(s.secondary)}get onSecondary(){return this.getArgb(s.onSecondary)}get secondaryContainer(){return this.getArgb(s.secondaryContainer)}get onSecondaryContainer(){return this.getArgb(s.onSecondaryContainer)}get tertiary(){return this.getArgb(s.tertiary)}get onTertiary(){return this.getArgb(s.onTertiary)}get tertiaryContainer(){return this.getArgb(s.tertiaryContainer)}get onTertiaryContainer(){return this.getArgb(s.onTertiaryContainer)}get error(){return this.getArgb(s.error)}get onError(){return this.getArgb(s.onError)}get errorContainer(){return this.getArgb(s.errorContainer)}get onErrorContainer(){return this.getArgb(s.onErrorContainer)}get primaryFixed(){return this.getArgb(s.primaryFixed)}get primaryFixedDim(){return this.getArgb(s.primaryFixedDim)}get onPrimaryFixed(){return this.getArgb(s.onPrimaryFixed)}get onPrimaryFixedVariant(){return this.getArgb(s.onPrimaryFixedVariant)}get secondaryFixed(){return this.getArgb(s.secondaryFixed)}get secondaryFixedDim(){return this.getArgb(s.secondaryFixedDim)}get onSecondaryFixed(){return this.getArgb(s.onSecondaryFixed)}get onSecondaryFixedVariant(){return this.getArgb(s.onSecondaryFixedVariant)}get tertiaryFixed(){return this.getArgb(s.tertiaryFixed)}get tertiaryFixedDim(){return this.getArgb(s.tertiaryFixedDim)}get onTertiaryFixed(){return this.getArgb(s.onTertiaryFixed)}get onTertiaryFixedVariant(){return this.getArgb(s.onTertiaryFixedVariant)}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class $t{fromInt(t){return Ot(t)}toInt(t){return jt(t[0],t[1],t[2])}distance(t,r){const n=t[0]-r[0],a=t[1]-r[1],o=t[2]-r[2];return n*n+a*a+o*o}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Jt=10,Qt=3;class Zt{static quantize(t,r,n){const a=new Map,o=new Array,i=new Array,c=new $t;let u=0;for(let p=0;p<t.length;p++){const b=t[p],D=a.get(b);D===void 0?(u++,o.push(c.fromInt(b)),i.push(b),a.set(b,1)):a.set(b,D+1)}const m=new Array;for(let p=0;p<u;p++){const b=i[p],D=a.get(b);D!==void 0&&(m[p]=D)}let h=Math.min(n,u);r.length>0&&(h=Math.min(h,r.length));const g=new Array;for(let p=0;p<r.length;p++)g.push(c.fromInt(r[p]));const y=h-g.length;if(r.length===0&&y>0)for(let p=0;p<y;p++){const b=Math.random()*100,D=Math.random()*201+-100,T=Math.random()*201+-100;g.push(new Array(b