@m3e/web 2.5.7 → 2.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +3599 -863
- package/dist/all.js.map +1 -1
- package/dist/all.min.js +120 -57
- package/dist/all.min.js.map +1 -1
- package/dist/card.js +2 -2
- package/dist/card.js.map +1 -1
- package/dist/card.min.js +1 -1
- package/dist/card.min.js.map +1 -1
- package/dist/content-pane.js +1 -1
- package/dist/content-pane.js.map +1 -1
- package/dist/content-pane.min.js +1 -1
- package/dist/content-pane.min.js.map +1 -1
- package/dist/core.js +20 -4
- package/dist/core.js.map +1 -1
- package/dist/core.min.js +1 -1
- package/dist/core.min.js.map +1 -1
- package/dist/css-custom-data.json +496 -481
- package/dist/custom-elements.json +5642 -5588
- package/dist/drawer-container.js +13 -7
- package/dist/drawer-container.js.map +1 -1
- package/dist/drawer-container.min.js +1 -1
- package/dist/drawer-container.min.js.map +1 -1
- package/dist/html-custom-data.json +292 -292
- package/dist/loading-indicator.js +8 -8
- package/dist/loading-indicator.js.map +1 -1
- package/dist/loading-indicator.min.js +1 -1
- package/dist/loading-indicator.min.js.map +1 -1
- package/dist/slide-group.js +1 -1
- package/dist/slide-group.js.map +1 -1
- package/dist/slide-group.min.js.map +1 -1
- package/dist/snackbar.js +2 -2
- package/dist/snackbar.js.map +1 -1
- package/dist/snackbar.min.js +1 -1
- package/dist/snackbar.min.js.map +1 -1
- package/dist/src/card/styles/CardStyle.d.ts.map +1 -1
- package/dist/src/content-pane/ContentPaneElement.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/ScrollController.d.ts.map +1 -1
- package/dist/src/drawer-container/DrawerContainerElement.d.ts.map +1 -1
- package/dist/src/drawer-container/DrawerToggleElement.d.ts.map +1 -1
- package/dist/src/loading-indicator/LoadingIndicatorElement.d.ts +1 -1
- package/dist/src/loading-indicator/LoadingIndicatorElement.d.ts.map +1 -1
- package/dist/src/snackbar/SnackbarElement.d.ts.map +1 -1
- package/dist/src/theme/ThemeElement.d.ts.map +1 -1
- package/dist/src/toc/TocElement.d.ts +4 -0
- package/dist/src/toc/TocElement.d.ts.map +1 -1
- package/dist/theme.js +3529 -832
- package/dist/theme.js.map +1 -1
- package/dist/theme.min.js +94 -31
- package/dist/theme.min.js.map +1 -1
- package/dist/toc.js +23 -6
- package/dist/toc.js.map +1 -1
- package/dist/toc.min.js +1 -1
- package/dist/toc.min.js.map +1 -1
- package/package.json +2 -2
package/dist/theme.min.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2025–2026 matraic
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
|
-
import{__decorate as
|
|
6
|
+
import{__decorate as e,__classPrivateFieldGet as t,__classPrivateFieldSet as r}from"tslib";import{css as a,LitElement as n,html as o}from"lit";import{property as i}from"lit/decorators.js";import{customElement as s,DesignToken as c}from"@m3e/web/core";
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2021 Google LLC
|
|
@@ -20,7 +20,7 @@ import{__decorate as t,__classPrivateFieldGet as e,__classPrivateFieldSet as r}f
|
|
|
20
20
|
* See the License for the specific language governing permissions and
|
|
21
21
|
* limitations under the License.
|
|
22
22
|
*/
|
|
23
|
-
function
|
|
23
|
+
function u(e){return e<0?-1:0===e?0:1}function h(e,t,r){return(1-r)*e+r*t}function l(e,t,r){return r<e?e:r>t?t:r}function m(e){return(e%=360)<0&&(e+=360),e}function d(e){return(e%=360)<0&&(e+=360),e}function f(e,t){return 180-Math.abs(Math.abs(e-t)-180)}function p(e,t){return[e[0]*t[0][0]+e[1]*t[0][1]+e[2]*t[0][2],e[0]*t[1][0]+e[1]*t[1][1]+e[2]*t[1][2],e[0]*t[2][0]+e[1]*t[2][1]+e[2]*t[2][2]]}
|
|
24
24
|
/**
|
|
25
25
|
* @license
|
|
26
26
|
* Copyright 2021 Google LLC
|
|
@@ -36,7 +36,7 @@ function h(t){return t<0?-1:0===t?0:1}function u(t,e,r){return(1-r)*t+r*e}functi
|
|
|
36
36
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
37
37
|
* See the License for the specific language governing permissions and
|
|
38
38
|
* limitations under the License.
|
|
39
|
-
*/const
|
|
39
|
+
*/const g=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],y=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],C=[95.047,100,108.883];function P(e,t,r){return(255<<24|(255&e)<<16|(255&t)<<8|255&r)>>>0}function S(e){return P(E(e[0]),E(e[1]),E(e[2]))}function v(e){return e>>24&255}function b(e){return e>>16&255}function k(e){return e>>8&255}function w(e){return 255&e}function T(e,t,r){const a=y,n=a[0][0]*e+a[0][1]*t+a[0][2]*r,o=a[1][0]*e+a[1][1]*t+a[1][2]*r,i=a[2][0]*e+a[2][1]*t+a[2][2]*r;return P(E(n),E(o),E(i))}function A(e){const t=I(b(e)),r=I(k(e)),a=I(w(e)),n=g,o=n[0][0]*t+n[0][1]*r+n[0][2]*a,i=n[1][0]*t+n[1][1]*r+n[1][2]*a,s=n[2][0]*t+n[2][1]*r+n[2][2]*a,c=i/C[1],u=s/C[2],h=_(o/C[0]),l=_(c);return[116*l-16,500*(h-l),200*(l-_(u))]}function D(e){const t=function(e){return p([I(b(e)),I(k(e)),I(w(e))],g)}(e)[1];return 116*_(t/100)-16}function x(e){return 100*B((e+16)/116)}function M(e){return 116*_(e/100)-16}function I(e){const t=e/255;return t<=.040449936?t/12.92*100:100*Math.pow((t+.055)/1.055,2.4)}function E(e){const t=e/100;let r=0;return r=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,a=0,n=255,(o=Math.round(255*r))<a?a:o>n?n:o;var a,n,o}function _(e){const t=24389/27;return e>216/24389?Math.pow(e,1/3):(t*e+16)/116}function B(e){const t=e*e*e;return t>216/24389?t:(116*e-16)/(24389/27)}
|
|
40
40
|
/**
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright 2021 Google LLC
|
|
@@ -52,7 +52,7 @@ function h(t){return t<0?-1:0===t?0:1}function u(t,e,r){return(1-r)*t+r*e}functi
|
|
|
52
52
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
53
53
|
* See the License for the specific language governing permissions and
|
|
54
54
|
* limitations under the License.
|
|
55
|
-
*/class
|
|
55
|
+
*/class F{static make(e=function(){return C}(),t=200/Math.PI*x(50)/100,r=50,a=2,n=!1){const o=e,i=.401288*o[0]+.650173*o[1]+-.051461*o[2],s=-.250268*o[0]+1.204414*o[1]+.045854*o[2],c=-.002079*o[0]+.048952*o[1]+.953127*o[2],u=.8+a/10,l=u>=.9?h(.59,.69,10*(u-.9)):h(.525,.59,10*(u-.8));let m=n?1:u*(1-1/3.6*Math.exp((-t-42)/92));m=m>1?1:m<0?0:m;const d=u,f=[m*(100/i)+1-m,m*(100/s)+1-m,m*(100/c)+1-m],p=1/(5*t+1),g=p*p*p*p,y=1-g,P=g*t+.1*y*y*Math.cbrt(5*t),S=x(r)/e[1],v=1.48+Math.sqrt(S),b=.725/Math.pow(S,.2),k=b,w=[Math.pow(P*f[0]*i/100,.42),Math.pow(P*f[1]*s/100,.42),Math.pow(P*f[2]*c/100,.42)],T=[400*w[0]/(w[0]+27.13),400*w[1]/(w[1]+27.13),400*w[2]/(w[2]+27.13)];return new F(S,(2*T[0]+T[1]+.05*T[2])*b,b,k,l,d,f,P,Math.pow(P,.25),v)}constructor(e,t,r,a,n,o,i,s,c,u){this.n=e,this.aw=t,this.nbb=r,this.ncb=a,this.c=n,this.nc=o,this.rgbD=i,this.fl=s,this.fLRoot=c,this.z=u}}F.DEFAULT=F.make();
|
|
56
56
|
/**
|
|
57
57
|
* @license
|
|
58
58
|
* Copyright 2021 Google LLC
|
|
@@ -69,7 +69,7 @@ function h(t){return t<0?-1:0===t?0:1}function u(t,e,r){return(1-r)*t+r*e}functi
|
|
|
69
69
|
* See the License for the specific language governing permissions and
|
|
70
70
|
* limitations under the License.
|
|
71
71
|
*/
|
|
72
|
-
class
|
|
72
|
+
class H{constructor(e,t,r,a,n,o,i,s,c){this.hue=e,this.chroma=t,this.j=r,this.q=a,this.m=n,this.s=o,this.jstar=i,this.astar=s,this.bstar=c}distance(e){const t=this.jstar-e.jstar,r=this.astar-e.astar,a=this.bstar-e.bstar,n=Math.sqrt(t*t+r*r+a*a);return 1.41*Math.pow(n,.63)}static fromInt(e){return H.fromIntInViewingConditions(e,F.DEFAULT)}static fromIntInViewingConditions(e,t){const r=(65280&e)>>8,a=255&e,n=I((16711680&e)>>16),o=I(r),i=I(a),s=.41233895*n+.35762064*o+.18051042*i,c=.2126*n+.7152*o+.0722*i,h=.01932141*n+.11916382*o+.95034478*i,l=.401288*s+.650173*c-.051461*h,m=-.250268*s+1.204414*c+.045854*h,f=-.002079*s+.048952*c+.953127*h,p=t.rgbD[0]*l,g=t.rgbD[1]*m,y=t.rgbD[2]*f,C=Math.pow(t.fl*Math.abs(p)/100,.42),P=Math.pow(t.fl*Math.abs(g)/100,.42),S=Math.pow(t.fl*Math.abs(y)/100,.42),v=400*u(p)*C/(C+27.13),b=400*u(g)*P/(P+27.13),k=400*u(y)*S/(S+27.13),w=(11*v+-12*b+k)/11,T=(v+b-2*k)/9,A=(20*v+20*b+21*k)/20,D=(40*v+20*b+k)/20,x=d(180*Math.atan2(T,w)/Math.PI),M=x*Math.PI/180,E=D*t.nbb,_=100*Math.pow(E/t.aw,t.c*t.z),B=4/t.c*Math.sqrt(_/100)*(t.aw+4)*t.fLRoot,F=x<20.14?x+360:x,R=5e4/13*(.25*(Math.cos(F*Math.PI/180+2)+3.8))*t.nc*t.ncb*Math.sqrt(w*w+T*T)/(A+.305),V=Math.pow(R,.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),L=V*Math.sqrt(_/100),O=L*t.fLRoot,N=50*Math.sqrt(V*t.c/(t.aw+4)),U=(1+100*.007)*_/(1+.007*_),z=1/.0228*Math.log(1+.0228*O),$=z*Math.cos(M),K=z*Math.sin(M);return new H(x,L,_,B,O,N,U,$,K)}static fromJch(e,t,r){return H.fromJchInViewingConditions(e,t,r,F.DEFAULT)}static fromJchInViewingConditions(e,t,r,a){const n=4/a.c*Math.sqrt(e/100)*(a.aw+4)*a.fLRoot,o=t*a.fLRoot,i=t/Math.sqrt(e/100),s=50*Math.sqrt(i*a.c/(a.aw+4)),c=r*Math.PI/180,u=(1+100*.007)*e/(1+.007*e),h=1/.0228*Math.log(1+.0228*o),l=h*Math.cos(c),m=h*Math.sin(c);return new H(r,t,e,n,o,s,u,l,m)}static fromUcs(e,t,r){return H.fromUcsInViewingConditions(e,t,r,F.DEFAULT)}static fromUcsInViewingConditions(e,t,r,a){const n=t,o=r,i=Math.sqrt(n*n+o*o),s=(Math.exp(.0228*i)-1)/.0228/a.fLRoot;let c=Math.atan2(o,n)*(180/Math.PI);c<0&&(c+=360);const u=e/(1-.007*(e-100));return H.fromJchInViewingConditions(u,s,c,a)}toInt(){return this.viewed(F.DEFAULT)}viewed(e){const t=0===this.chroma||0===this.j?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),a=this.hue*Math.PI/180,n=.25*(Math.cos(a+2)+3.8),o=e.aw*Math.pow(this.j/100,1/e.c/e.z),i=n*(5e4/13)*e.nc*e.ncb,s=o/e.nbb,c=Math.sin(a),h=Math.cos(a),l=23*(s+.305)*r/(23*i+11*r*h+108*r*c),m=l*h,d=l*c,f=(460*s+451*m+288*d)/1403,p=(460*s-891*m-261*d)/1403,g=(460*s-220*m-6300*d)/1403,y=Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),C=u(f)*(100/e.fl)*Math.pow(y,1/.42),P=Math.max(0,27.13*Math.abs(p)/(400-Math.abs(p))),S=u(p)*(100/e.fl)*Math.pow(P,1/.42),v=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),b=u(g)*(100/e.fl)*Math.pow(v,1/.42),k=C/e.rgbD[0],w=S/e.rgbD[1],A=b/e.rgbD[2];return T(1.86206786*k-1.01125463*w+.14918677*A,.38752654*k+.62144744*w-.00897398*A,-.0158415*k-.03412294*w+1.04996444*A)}static fromXyzInViewingConditions(e,t,r,a){const n=.401288*e+.650173*t-.051461*r,o=-.250268*e+1.204414*t+.045854*r,i=-.002079*e+.048952*t+.953127*r,s=a.rgbD[0]*n,c=a.rgbD[1]*o,h=a.rgbD[2]*i,l=Math.pow(a.fl*Math.abs(s)/100,.42),m=Math.pow(a.fl*Math.abs(c)/100,.42),d=Math.pow(a.fl*Math.abs(h)/100,.42),f=400*u(s)*l/(l+27.13),p=400*u(c)*m/(m+27.13),g=400*u(h)*d/(d+27.13),y=(11*f+-12*p+g)/11,C=(f+p-2*g)/9,P=(20*f+20*p+21*g)/20,S=(40*f+20*p+g)/20,v=180*Math.atan2(C,y)/Math.PI,b=v<0?v+360:v>=360?v-360:v,k=b*Math.PI/180,w=S*a.nbb,T=100*Math.pow(w/a.aw,a.c*a.z),A=4/a.c*Math.sqrt(T/100)*(a.aw+4)*a.fLRoot,D=b<20.14?b+360:b,x=5e4/13*(1/4*(Math.cos(D*Math.PI/180+2)+3.8))*a.nc*a.ncb*Math.sqrt(y*y+C*C)/(P+.305),M=Math.pow(x,.9)*Math.pow(1.64-Math.pow(.29,a.n),.73),I=M*Math.sqrt(T/100),E=I*a.fLRoot,_=50*Math.sqrt(M*a.c/(a.aw+4)),B=(1+100*.007)*T/(1+.007*T),F=Math.log(1+.0228*E)/.0228,R=F*Math.cos(k),V=F*Math.sin(k);return new H(b,I,T,A,E,_,B,R,V)}xyzInViewingConditions(e){const t=0===this.chroma||0===this.j?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),a=this.hue*Math.PI/180,n=.25*(Math.cos(a+2)+3.8),o=e.aw*Math.pow(this.j/100,1/e.c/e.z),i=n*(5e4/13)*e.nc*e.ncb,s=o/e.nbb,c=Math.sin(a),h=Math.cos(a),l=23*(s+.305)*r/(23*i+11*r*h+108*r*c),m=l*h,d=l*c,f=(460*s+451*m+288*d)/1403,p=(460*s-891*m-261*d)/1403,g=(460*s-220*m-6300*d)/1403,y=Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),C=u(f)*(100/e.fl)*Math.pow(y,1/.42),P=Math.max(0,27.13*Math.abs(p)/(400-Math.abs(p))),S=u(p)*(100/e.fl)*Math.pow(P,1/.42),v=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),b=u(g)*(100/e.fl)*Math.pow(v,1/.42),k=C/e.rgbD[0],w=S/e.rgbD[1],T=b/e.rgbD[2];return[1.86206786*k-1.01125463*w+.14918677*T,.38752654*k+.62144744*w-.00897398*T,-.0158415*k-.03412294*w+1.04996444*T]}}
|
|
73
73
|
/**
|
|
74
74
|
* @license
|
|
75
75
|
* Copyright 2021 Google LLC
|
|
@@ -85,7 +85,7 @@ class F{constructor(t,e,r,n,a,o,i,s,c){this.hue=t,this.chroma=e,this.j=r,this.q=
|
|
|
85
85
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
86
86
|
* See the License for the specific language governing permissions and
|
|
87
87
|
* limitations under the License.
|
|
88
|
-
*/class
|
|
88
|
+
*/class R{static sanitizeRadians(e){return(e+8*Math.PI)%(2*Math.PI)}static trueDelinearized(e){const t=e/100;let r=0;return r=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,255*r}static chromaticAdaptation(e){const t=Math.pow(Math.abs(e),.42);return 400*u(e)*t/(t+27.13)}static hueOf(e){const t=p(e,R.SCALED_DISCOUNT_FROM_LINRGB),r=R.chromaticAdaptation(t[0]),a=R.chromaticAdaptation(t[1]),n=R.chromaticAdaptation(t[2]),o=(11*r+-12*a+n)/11,i=(r+a-2*n)/9;return Math.atan2(i,o)}static areInCyclicOrder(e,t,r){return R.sanitizeRadians(t-e)<R.sanitizeRadians(r-e)}static intercept(e,t,r){return(t-e)/(r-e)}static lerpPoint(e,t,r){return[e[0]+(r[0]-e[0])*t,e[1]+(r[1]-e[1])*t,e[2]+(r[2]-e[2])*t]}static setCoordinate(e,t,r,a){const n=R.intercept(e[a],t,r[a]);return R.lerpPoint(e,n,r)}static isBounded(e){return 0<=e&&e<=100}static nthVertex(e,t){const r=R.Y_FROM_LINRGB[0],a=R.Y_FROM_LINRGB[1],n=R.Y_FROM_LINRGB[2],o=t%4<=1?0:100,i=t%2==0?0:100;if(t<4){const t=o,s=i,c=(e-t*a-s*n)/r;return R.isBounded(c)?[c,t,s]:[-1,-1,-1]}if(t<8){const t=o,s=i,c=(e-s*r-t*n)/a;return R.isBounded(c)?[s,c,t]:[-1,-1,-1]}{const t=o,s=i,c=(e-t*r-s*a)/n;return R.isBounded(c)?[t,s,c]:[-1,-1,-1]}}static bisectToSegment(e,t){let r=[-1,-1,-1],a=r,n=0,o=0,i=!1,s=!0;for(let c=0;c<12;c++){const u=R.nthVertex(e,c);if(u[0]<0)continue;const h=R.hueOf(u);i?(s||R.areInCyclicOrder(n,h,o))&&(s=!1,R.areInCyclicOrder(n,t,h)?(a=u,o=h):(r=u,n=h)):(r=u,a=u,n=h,o=h,i=!0)}return[r,a]}static midpoint(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2,(e[2]+t[2])/2]}static criticalPlaneBelow(e){return Math.floor(e-.5)}static criticalPlaneAbove(e){return Math.ceil(e-.5)}static bisectToLimit(e,t){const r=R.bisectToSegment(e,t);let a=r[0],n=R.hueOf(a),o=r[1];for(let e=0;e<3;e++)if(a[e]!==o[e]){let r=-1,i=255;a[e]<o[e]?(r=R.criticalPlaneBelow(R.trueDelinearized(a[e])),i=R.criticalPlaneAbove(R.trueDelinearized(o[e]))):(r=R.criticalPlaneAbove(R.trueDelinearized(a[e])),i=R.criticalPlaneBelow(R.trueDelinearized(o[e])));for(let s=0;s<8&&!(Math.abs(i-r)<=1);s++){const s=Math.floor((r+i)/2),c=R.CRITICAL_PLANES[s],u=R.setCoordinate(a,c,o,e),h=R.hueOf(u);R.areInCyclicOrder(n,t,h)?(o=u,i=s):(a=u,n=h,r=s)}}return R.midpoint(a,o)}static inverseChromaticAdaptation(e){const t=Math.abs(e),r=Math.max(0,27.13*t/(400-t));return u(e)*Math.pow(r,1/.42)}static findResultByJ(e,t,r){let a=11*Math.sqrt(r);const n=F.DEFAULT,o=1/Math.pow(1.64-Math.pow(.29,n.n),.73),i=.25*(Math.cos(e+2)+3.8)*(5e4/13)*n.nc*n.ncb,s=Math.sin(e),c=Math.cos(e);for(let e=0;e<5;e++){const u=a/100,h=0===t||0===a?0:t/Math.sqrt(u),l=Math.pow(h*o,1/.9),m=n.aw*Math.pow(u,1/n.c/n.z)/n.nbb,d=23*(m+.305)*l/(23*i+11*l*c+108*l*s),f=d*c,g=d*s,y=(460*m+451*f+288*g)/1403,C=(460*m-891*f-261*g)/1403,P=(460*m-220*f-6300*g)/1403,v=p([R.inverseChromaticAdaptation(y),R.inverseChromaticAdaptation(C),R.inverseChromaticAdaptation(P)],R.LINRGB_FROM_SCALED_DISCOUNT);if(v[0]<0||v[1]<0||v[2]<0)return 0;const b=R.Y_FROM_LINRGB[0],k=R.Y_FROM_LINRGB[1],w=R.Y_FROM_LINRGB[2],T=b*v[0]+k*v[1]+w*v[2];if(T<=0)return 0;if(4===e||Math.abs(T-r)<.002)return v[0]>100.01||v[1]>100.01||v[2]>100.01?0:S(v);a-=(T-r)*a/(2*T)}return 0}static solveToInt(e,t,r){if(t<1e-4||r<1e-4||r>99.9999)return function(e){const t=E(x(e));return P(t,t,t)}(r);const a=(e=d(e))/180*Math.PI,n=x(r),o=R.findResultByJ(a,t,n);if(0!==o)return o;return S(R.bisectToLimit(n,a))}static solveToCam(e,t,r){return H.fromInt(R.solveToInt(e,t,r))}}R.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]],R.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]],R.Y_FROM_LINRGB=[.2126,.7152,.0722],R.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];
|
|
89
89
|
/**
|
|
90
90
|
* @license
|
|
91
91
|
* Copyright 2021 Google LLC
|
|
@@ -102,7 +102,23 @@ class F{constructor(t,e,r,n,a,o,i,s,c){this.hue=t,this.chroma=e,this.j=r,this.q=
|
|
|
102
102
|
* See the License for the specific language governing permissions and
|
|
103
103
|
* limitations under the License.
|
|
104
104
|
*/
|
|
105
|
-
class
|
|
105
|
+
class V{static from(e,t,r){return new V(R.solveToInt(e,t,r))}static fromInt(e){return new V(e)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(e){this.setInternalState(R.solveToInt(e,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(e){this.setInternalState(R.solveToInt(this.internalHue,e,this.internalTone))}get tone(){return this.internalTone}set tone(e){this.setInternalState(R.solveToInt(this.internalHue,this.internalChroma,e))}setValue(e,t){this[e]=t}toString(){return`HCT(${this.hue.toFixed(0)}, ${this.chroma.toFixed(0)}, ${this.tone.toFixed(0)})`}static isBlue(e){return e>=250&&e<270}static isYellow(e){return e>=105&&e<125}static isCyan(e){return e>=170&&e<207}constructor(e){this.argb=e;const t=H.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=D(e),this.argb=e}setInternalState(e){const t=H.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=D(e),this.argb=e}inViewingConditions(e){const t=H.fromInt(this.toInt()).xyzInViewingConditions(e),r=H.fromXyzInViewingConditions(t[0],t[1],t[2],F.make());return V.from(r.hue,r.chroma,M(t[1]))}}
|
|
106
|
+
/**
|
|
107
|
+
* @license
|
|
108
|
+
* Copyright 2021 Google LLC
|
|
109
|
+
*
|
|
110
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
111
|
+
* you may not use this file except in compliance with the License.
|
|
112
|
+
* You may obtain a copy of the License at
|
|
113
|
+
*
|
|
114
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
+
*
|
|
116
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
117
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
118
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
+
* See the License for the specific language governing permissions and
|
|
120
|
+
* limitations under the License.
|
|
121
|
+
*/class L{static harmonize(e,t){const r=V.fromInt(e),a=V.fromInt(t),n=f(r.hue,a.hue),o=Math.min(.5*n,15),i=d(r.hue+o*(s=r.hue,d(a.hue-s)<=180?1:-1));var s;return V.from(i,r.chroma,r.tone).toInt()}static hctHue(e,t,r){const a=L.cam16Ucs(e,t,r),n=H.fromInt(a),o=H.fromInt(e);return V.from(n.hue,o.chroma,D(e)).toInt()}static cam16Ucs(e,t,r){const a=H.fromInt(e),n=H.fromInt(t),o=a.jstar,i=a.astar,s=a.bstar,c=o+(n.jstar-o)*r,u=i+(n.astar-i)*r,h=s+(n.bstar-s)*r;return H.fromUcs(c,u,h).toInt()}}
|
|
106
122
|
/**
|
|
107
123
|
* @license
|
|
108
124
|
* Copyright 2022 Google LLC
|
|
@@ -118,7 +134,7 @@ class L{static from(t,e,r){return new L(B.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
118
134
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
135
|
* See the License for the specific language governing permissions and
|
|
120
136
|
* limitations under the License.
|
|
121
|
-
*/class O{static ratioOfTones(t
|
|
137
|
+
*/class O{static ratioOfTones(e,t){return e=l(0,100,e),t=l(0,100,t),O.ratioOfYs(x(e),x(t))}static ratioOfYs(e,t){const r=e>t?e:t;return(r+5)/((r===t?e:t)+5)}static lighter(e,t){if(e<0||e>100)return-1;const r=x(e),a=t*(r+5)-5,n=O.ratioOfYs(a,r),o=Math.abs(n-t);if(n<t&&o>.04)return-1;const i=M(a)+.4;return i<0||i>100?-1:i}static darker(e,t){if(e<0||e>100)return-1;const r=x(e),a=(r+5)/t-5,n=O.ratioOfYs(r,a),o=Math.abs(n-t);if(n<t&&o>.04)return-1;const i=M(a)-.4;return i<0||i>100?-1:i}static lighterUnsafe(e,t){const r=O.lighter(e,t);return r<0?100:r}static darkerUnsafe(e,t){const r=O.darker(e,t);return r<0?0:r}}
|
|
122
138
|
/**
|
|
123
139
|
* @license
|
|
124
140
|
* Copyright 2023 Google LLC
|
|
@@ -134,7 +150,7 @@ class L{static from(t,e,r){return new L(B.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
134
150
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
135
151
|
* See the License for the specific language governing permissions and
|
|
136
152
|
* limitations under the License.
|
|
137
|
-
*/class
|
|
153
|
+
*/class N{static isDisliked(e){const t=Math.round(e.hue)>=90&&Math.round(e.hue)<=111,r=Math.round(e.chroma)>16,a=Math.round(e.tone)<65;return t&&r&&a}static fixIfDisliked(e){return N.isDisliked(e)?V.from(e.hue,e.chroma,70):e}}
|
|
138
154
|
/**
|
|
139
155
|
* @license
|
|
140
156
|
* Copyright 2022 Google LLC
|
|
@@ -150,7 +166,7 @@ class L{static from(t,e,r){return new L(B.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
150
166
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
151
167
|
* See the License for the specific language governing permissions and
|
|
152
168
|
* limitations under the License.
|
|
153
|
-
*/
|
|
169
|
+
*/function U(e,t,r){return function(e,t,r){if(e.name!==r.name)throw new Error(`Attempting to extend color ${e.name} with color ${r.name} of different name for spec version ${t}.`);if(e.isBackground!==r.isBackground)throw new Error(`Attempting to extend color ${e.name} as a ${e.isBackground?"background":"foreground"} with color ${r.name} as a ${r.isBackground?"background":"foreground"} for spec version ${t}.`)}(e,t,r),z.fromPalette({name:e.name,palette:a=>a.specVersion===t?r.palette(a):e.palette(a),tone:a=>a.specVersion===t?r.tone(a):e.tone(a),isBackground:e.isBackground,chromaMultiplier:a=>{const n=a.specVersion===t?r.chromaMultiplier:e.chromaMultiplier;return void 0!==n?n(a):1},background:a=>{const n=a.specVersion===t?r.background:e.background;return void 0!==n?n(a):void 0},secondBackground:a=>{const n=a.specVersion===t?r.secondBackground:e.secondBackground;return void 0!==n?n(a):void 0},contrastCurve:a=>{const n=a.specVersion===t?r.contrastCurve:e.contrastCurve;return void 0!==n?n(a):void 0},toneDeltaPair:a=>{const n=a.specVersion===t?r.toneDeltaPair:e.toneDeltaPair;return void 0!==n?n(a):void 0}})}class z{static fromPalette(e){return new z(e.name??"",e.palette,e.tone??z.getInitialToneFromBackground(e.background),e.isBackground??!1,e.chromaMultiplier,e.background,e.secondBackground,e.contrastCurve,e.toneDeltaPair)}static getInitialToneFromBackground(e){return void 0===e?e=>50:t=>e(t)?e(t).getTone(t):50}constructor(e,t,r,a,n,o,i,s,c){if(this.name=e,this.palette=t,this.tone=r,this.isBackground=a,this.chromaMultiplier=n,this.background=o,this.secondBackground=i,this.contrastCurve=s,this.toneDeltaPair=c,this.hctCache=new Map,!o&&i)throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);if(!o&&s)throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);if(o&&!s)throw new Error(`Color ${e} has backgrounddefined, but contrastCurve is not defined.`)}clone(){return z.fromPalette({name:this.name,palette:this.palette,tone:this.tone,isBackground:this.isBackground,chromaMultiplier:this.chromaMultiplier,background:this.background,secondBackground:this.secondBackground,contrastCurve:this.contrastCurve,toneDeltaPair:this.toneDeltaPair})}clearCache(){this.hctCache.clear()}getArgb(e){return this.getHct(e).toInt()}getHct(e){const t=this.hctCache.get(e);if(null!=t)return t;const r=Y(e.specVersion).getHct(e,this);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(e,r),r}getTone(e){return Y(e.specVersion).getTone(e,this)}static foregroundTone(e,t){const r=O.lighterUnsafe(e,t),a=O.darkerUnsafe(e,t),n=O.ratioOfTones(r,e),o=O.ratioOfTones(a,e);if(z.tonePrefersLightForeground(e)){const e=Math.abs(n-o)<.1&&n<t&&o<t;return n>=t||n>=o||e?r:a}return o>=t||o>=n?a:r}static tonePrefersLightForeground(e){return Math.round(e)<60}static toneAllowsLightForeground(e){return Math.round(e)<=49}static enableLightForeground(e){return z.tonePrefersLightForeground(e)&&!z.toneAllowsLightForeground(e)?49:e}}const $=new class{getHct(e,t){const r=t.getTone(e);return t.palette(e).getHct(r)}getTone(e,t){const r=e.contrastLevel<0,a=t.toneDeltaPair?t.toneDeltaPair(e):void 0;if(a){const n=a.roleA,o=a.roleB,i=a.delta,s=a.polarity,c=a.stayTogether,u="nearer"===s||"lighter"===s&&!e.isDark||"darker"===s&&e.isDark,h=u?n:o,m=u?o:n,d=t.name===h.name,f=e.isDark?1:-1;let p=h.tone(e),g=m.tone(e);if(t.background&&h.contrastCurve&&m.contrastCurve){const a=t.background(e),n=h.contrastCurve(e),o=m.contrastCurve(e);if(a&&n&&o){const t=a.getTone(e),i=n.get(e.contrastLevel),s=o.get(e.contrastLevel);O.ratioOfTones(t,p)<i&&(p=z.foregroundTone(t,i)),O.ratioOfTones(t,g)<s&&(g=z.foregroundTone(t,s)),r&&(p=z.foregroundTone(t,i),g=z.foregroundTone(t,s))}}return(g-p)*f<i&&(g=l(0,100,p+i*f),(g-p)*f>=i||(p=l(0,100,g-i*f))),50<=p&&p<60?f>0?(p=60,g=Math.max(g,p+i*f)):(p=49,g=Math.min(g,p+i*f)):50<=g&&g<60&&(c?f>0?(p=60,g=Math.max(g,p+i*f)):(p=49,g=Math.min(g,p+i*f)):g=f>0?60:49),d?p:g}{let a=t.tone(e);if(null==t.background||void 0===t.background(e)||null==t.contrastCurve||void 0===t.contrastCurve(e))return a;const n=t.background(e).getTone(e),o=t.contrastCurve(e).get(e.contrastLevel);if(O.ratioOfTones(n,a)>=o||(a=z.foregroundTone(n,o)),r&&(a=z.foregroundTone(n,o)),t.isBackground&&50<=a&&a<60&&(a=O.ratioOfTones(49,n)>=o?49:60),null==t.secondBackground||void 0===t.secondBackground(e))return a;const[i,s]=[t.background,t.secondBackground],[c,u]=[i(e).getTone(e),s(e).getTone(e)],[h,l]=[Math.max(c,u),Math.min(c,u)];if(O.ratioOfTones(h,a)>=o&&O.ratioOfTones(l,a)>=o)return a;const m=O.lighter(h,o),d=O.darker(l,o),f=[];-1!==m&&f.push(m),-1!==d&&f.push(d);return z.tonePrefersLightForeground(c)||z.tonePrefersLightForeground(u)?m<0?100:m:1===f.length?f[0]:d<0?0:d}}},K=new class{getHct(e,t){const r=t.palette(e),a=t.getTone(e),n=r.hue,o=r.chroma*(t.chromaMultiplier?t.chromaMultiplier(e):1);return V.from(n,o,a)}getTone(e,t){const r=t.toneDeltaPair?t.toneDeltaPair(e):void 0;if(r){const a=r.roleA,n=r.roleB,o=r.polarity,i=r.constraint,s="darker"===o||"relative_lighter"===o&&e.isDark||"relative_darker"===o&&!e.isDark?-r.delta:r.delta,c=t.name===a.name,u=c?n:a;let h=(c?a:n).tone(e),m=u.getTone(e);const d=s*(c?1:-1);if("exact"===i?h=l(0,100,m+d):"nearer"===i?h=l(0,100,d>0?l(m,m+d,h):l(m+d,m,h)):"farther"===i&&(h=d>0?l(m+d,100,h):l(0,m+d,h)),t.background&&t.contrastCurve){const r=t.background(e),a=t.contrastCurve(e);if(r&&a){const t=r.getTone(e),n=a.get(e.contrastLevel);h=O.ratioOfTones(t,h)>=n&&e.contrastLevel>=0?h:z.foregroundTone(t,n)}}return t.isBackground&&!t.name.endsWith("_fixed_dim")&&(h=h>=57?l(65,100,h):l(0,49,h)),h}{let r=t.tone(e);if(null==t.background||void 0===t.background(e)||null==t.contrastCurve||void 0===t.contrastCurve(e))return r;const a=t.background(e).getTone(e),n=t.contrastCurve(e).get(e.contrastLevel);if(r=O.ratioOfTones(a,r)>=n&&e.contrastLevel>=0?r:z.foregroundTone(a,n),t.isBackground&&!t.name.endsWith("_fixed_dim")&&(r=r>=57?l(65,100,r):l(0,49,r)),null==t.secondBackground||void 0===t.secondBackground(e))return r;const[o,i]=[t.background,t.secondBackground],[s,c]=[o(e).getTone(e),i(e).getTone(e)],[u,h]=[Math.max(s,c),Math.min(s,c)];if(O.ratioOfTones(u,r)>=n&&O.ratioOfTones(h,r)>=n)return r;const m=O.lighter(u,n),d=O.darker(h,n),f=[];-1!==m&&f.push(m),-1!==d&&f.push(d);return z.tonePrefersLightForeground(s)||z.tonePrefersLightForeground(c)?m<0?100:m:1===f.length?f[0]:d<0?0:d}}};function Y(e){return"2025"===e?K:$}
|
|
154
170
|
/**
|
|
155
171
|
* @license
|
|
156
172
|
* Copyright 2021 Google LLC
|
|
@@ -166,7 +182,7 @@ class L{static from(t,e,r){return new L(B.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
166
182
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
167
183
|
* See the License for the specific language governing permissions and
|
|
168
184
|
* limitations under the License.
|
|
169
|
-
*/class
|
|
185
|
+
*/class q{static fromInt(e){const t=V.fromInt(e);return q.fromHct(t)}static fromHct(e){return new q(e.hue,e.chroma,e)}static fromHueAndChroma(e,t){const r=new G(e,t).create();return new q(e,t,r)}constructor(e,t,r){this.hue=e,this.chroma=t,this.keyColor=r,this.cache=new Map}tone(e){let t=this.cache.get(e);return void 0===t&&(t=99==e&&V.isYellow(this.hue)?this.averageArgb(this.tone(98),this.tone(100)):V.from(this.hue,this.chroma,e).toInt(),this.cache.set(e,t)),t}getHct(e){return V.fromInt(this.tone(e))}averageArgb(e,t){const r=e>>>16&255,a=e>>>8&255,n=255&e,o=t>>>16&255,i=t>>>8&255,s=255&t;return(255<<24|(255&Math.round((r+o)/2))<<16|(255&Math.round((a+i)/2))<<8|255&Math.round((n+s)/2))>>>0}}class G{constructor(e,t){this.hue=e,this.requestedChroma=t,this.chromaCache=new Map,this.maxChromaValue=200}create(){let e=0,t=100;for(;e<t;){const r=Math.floor((e+t)/2),a=this.maxChroma(r)<this.maxChroma(r+1);if(this.maxChroma(r)>=this.requestedChroma-.01)if(Math.abs(e-50)<Math.abs(t-50))t=r;else{if(e===r)return V.from(this.hue,this.requestedChroma,e);e=r}else a?e=r+1:t=r}return V.from(this.hue,this.requestedChroma,e)}maxChroma(e){if(this.chromaCache.has(e))return this.chromaCache.get(e);const t=V.from(this.hue,this.maxChromaValue,e).chroma;return this.chromaCache.set(e,t),t}}
|
|
170
186
|
/**
|
|
171
187
|
* @license
|
|
172
188
|
* Copyright 2023 Google LLC
|
|
@@ -182,7 +198,7 @@ class L{static from(t,e,r){return new L(B.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
182
198
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
183
199
|
* See the License for the specific language governing permissions and
|
|
184
200
|
* limitations under the License.
|
|
185
|
-
*/class
|
|
201
|
+
*/class X{constructor(e){this.input=e,this.hctsByTempCache=[],this.hctsByHueCache=[],this.tempsByHctCache=new Map,this.inputRelativeTemperatureCache=-1,this.complementCache=null}get hctsByTemp(){if(this.hctsByTempCache.length>0)return this.hctsByTempCache;const e=this.hctsByHue.concat([this.input]),t=this.tempsByHct;return e.sort((e,r)=>t.get(e)-t.get(r)),this.hctsByTempCache=e,e}get warmest(){return this.hctsByTemp[this.hctsByTemp.length-1]}get coldest(){return this.hctsByTemp[0]}analogous(e=5,t=12){const r=Math.round(this.input.hue),a=this.hctsByHue[r];let n=this.relativeTemperature(a);const o=[a];let i=0;for(let e=0;e<360;e++){const t=m(r+e),a=this.hctsByHue[t],o=this.relativeTemperature(a),s=Math.abs(o-n);n=o,i+=s}let s=1;const c=i/t;let u=0;for(n=this.relativeTemperature(a);o.length<t;){const e=m(r+s),a=this.hctsByHue[e],i=this.relativeTemperature(a);u+=Math.abs(i-n);let h=u>=o.length*c,l=1;for(;h&&o.length<t;){o.push(a);h=u>=(o.length+l)*c,l++}if(n=i,s++,s>360){for(;o.length<t;)o.push(a);break}}const h=[this.input],l=Math.floor((e-1)/2);for(let e=1;e<l+1;e++){let t=0-e;for(;t<0;)t=o.length+t;t>=o.length&&(t%=o.length),h.splice(0,0,o[t])}const d=e-l-1;for(let e=1;e<d+1;e++){let t=e;for(;t<0;)t=o.length+t;t>=o.length&&(t%=o.length),h.push(o[t])}return h}get complement(){if(null!=this.complementCache)return this.complementCache;const e=this.coldest.hue,t=this.tempsByHct.get(this.coldest),r=this.warmest.hue,a=this.tempsByHct.get(this.warmest)-t,n=X.isBetween(this.input.hue,e,r),o=n?r:e,i=n?e:r;let s=1e3,c=this.hctsByHue[Math.round(this.input.hue)];const u=1-this.inputRelativeTemperature;for(let e=0;e<=360;e+=1){const r=d(o+1*e);if(!X.isBetween(r,o,i))continue;const n=this.hctsByHue[Math.round(r)],h=(this.tempsByHct.get(n)-t)/a,l=Math.abs(u-h);l<s&&(s=l,c=n)}return this.complementCache=c,this.complementCache}relativeTemperature(e){const t=this.tempsByHct.get(this.warmest)-this.tempsByHct.get(this.coldest),r=this.tempsByHct.get(e)-this.tempsByHct.get(this.coldest);return 0===t?.5:r/t}get inputRelativeTemperature(){return this.inputRelativeTemperatureCache>=0||(this.inputRelativeTemperatureCache=this.relativeTemperature(this.input)),this.inputRelativeTemperatureCache}get tempsByHct(){if(this.tempsByHctCache.size>0)return this.tempsByHctCache;const e=this.hctsByHue.concat([this.input]),t=new Map;for(const r of e)t.set(r,X.rawTemperature(r));return this.tempsByHctCache=t,t}get hctsByHue(){if(this.hctsByHueCache.length>0)return this.hctsByHueCache;const e=[];for(let t=0;t<=360;t+=1){const r=V.from(t,this.input.chroma,this.input.tone);e.push(r)}return this.hctsByHueCache=e,this.hctsByHueCache}static isBetween(e,t,r){return t<r?t<=e&&e<=r:t<=e||e<=r}static rawTemperature(e){const t=A(e.toInt()),r=d(180*Math.atan2(t[2],t[1])/Math.PI),a=Math.sqrt(t[1]*t[1]+t[2]*t[2]);return.02*Math.pow(a,1.07)*Math.cos(d(r-50)*Math.PI/180)-.5}}
|
|
186
202
|
/**
|
|
187
203
|
* @license
|
|
188
204
|
* Copyright 2023 Google LLC
|
|
@@ -198,7 +214,23 @@ class L{static from(t,e,r){return new L(B.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
198
214
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
215
|
* See the License for the specific language governing permissions and
|
|
200
216
|
* limitations under the License.
|
|
201
|
-
*/class
|
|
217
|
+
*/class W{constructor(e,t,r,a){this.low=e,this.normal=t,this.medium=r,this.high=a}get(e){return e<=-1?this.low:e<0?h(this.low,this.normal,(e- -1)/1):e<.5?h(this.normal,this.medium,(e-0)/.5):e<1?h(this.medium,this.high,(e-.5)/.5):this.high}}
|
|
218
|
+
/**
|
|
219
|
+
* @license
|
|
220
|
+
* Copyright 2023 Google LLC
|
|
221
|
+
*
|
|
222
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
223
|
+
* you may not use this file except in compliance with the License.
|
|
224
|
+
* You may obtain a copy of the License at
|
|
225
|
+
*
|
|
226
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
227
|
+
*
|
|
228
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
229
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
230
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
231
|
+
* See the License for the specific language governing permissions and
|
|
232
|
+
* limitations under the License.
|
|
233
|
+
*/class j{constructor(e,t,r,a,n,o){this.roleA=e,this.roleB=t,this.delta=r,this.polarity=a,this.stayTogether=n,this.constraint=o,this.constraint=o??"exact"}}
|
|
202
234
|
/**
|
|
203
235
|
* @license
|
|
204
236
|
* Copyright 2022 Google LLC
|
|
@@ -214,7 +246,40 @@ class L{static from(t,e,r){return new L(B.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
214
246
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
215
247
|
* See the License for the specific language governing permissions and
|
|
216
248
|
* limitations under the License.
|
|
217
|
-
*/var
|
|
249
|
+
*/var J;
|
|
250
|
+
/**
|
|
251
|
+
* @license
|
|
252
|
+
* Copyright 2025 Google LLC
|
|
253
|
+
*
|
|
254
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
255
|
+
* you may not use this file except in compliance with the License.
|
|
256
|
+
* You may obtain a copy of the License at
|
|
257
|
+
*
|
|
258
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
259
|
+
*
|
|
260
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
261
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
262
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
263
|
+
* See the License for the specific language governing permissions and
|
|
264
|
+
* limitations under the License.
|
|
265
|
+
*/
|
|
266
|
+
function Q(e){return e.variant===J.FIDELITY||e.variant===J.CONTENT}function Z(e){return e.variant===J.MONOCHROME}!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"}(J||(J={}));class ee{primaryPaletteKeyColor(){return z.fromPalette({name:"primary_palette_key_color",palette:e=>e.primaryPalette,tone:e=>e.primaryPalette.keyColor.tone})}secondaryPaletteKeyColor(){return z.fromPalette({name:"secondary_palette_key_color",palette:e=>e.secondaryPalette,tone:e=>e.secondaryPalette.keyColor.tone})}tertiaryPaletteKeyColor(){return z.fromPalette({name:"tertiary_palette_key_color",palette:e=>e.tertiaryPalette,tone:e=>e.tertiaryPalette.keyColor.tone})}neutralPaletteKeyColor(){return z.fromPalette({name:"neutral_palette_key_color",palette:e=>e.neutralPalette,tone:e=>e.neutralPalette.keyColor.tone})}neutralVariantPaletteKeyColor(){return z.fromPalette({name:"neutral_variant_palette_key_color",palette:e=>e.neutralVariantPalette,tone:e=>e.neutralVariantPalette.keyColor.tone})}errorPaletteKeyColor(){return z.fromPalette({name:"error_palette_key_color",palette:e=>e.errorPalette,tone:e=>e.errorPalette.keyColor.tone})}background(){return z.fromPalette({name:"background",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0})}onBackground(){return z.fromPalette({name:"on_background",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>this.background(),contrastCurve:e=>new W(3,3,4.5,7)})}surface(){return z.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0})}surfaceDim(){return z.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:new W(87,87,80,75).get(e.contrastLevel),isBackground:!0})}surfaceBright(){return z.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?new W(24,24,29,34).get(e.contrastLevel):98,isBackground:!0})}surfaceContainerLowest(){return z.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new W(4,4,2,0).get(e.contrastLevel):100,isBackground:!0})}surfaceContainerLow(){return z.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>e.isDark?new W(10,10,11,12).get(e.contrastLevel):new W(96,96,96,95).get(e.contrastLevel),isBackground:!0})}surfaceContainer(){return z.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>e.isDark?new W(12,12,16,20).get(e.contrastLevel):new W(94,94,92,90).get(e.contrastLevel),isBackground:!0})}surfaceContainerHigh(){return z.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>e.isDark?new W(17,17,21,25).get(e.contrastLevel):new W(92,92,88,85).get(e.contrastLevel),isBackground:!0})}surfaceContainerHighest(){return z.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new W(22,22,26,30).get(e.contrastLevel):new W(90,90,84,80).get(e.contrastLevel),isBackground:!0})}onSurface(){return z.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>this.highestSurface(e),contrastCurve:e=>new W(4.5,7,11,21)})}surfaceVariant(){return z.fromPalette({name:"surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:90,isBackground:!0})}onSurfaceVariant(){return z.fromPalette({name:"on_surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?80:30,background:e=>this.highestSurface(e),contrastCurve:e=>new W(3,4.5,7,11)})}inverseSurface(){return z.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:20,isBackground:!0})}inverseOnSurface(){return z.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?20:95,background:e=>this.inverseSurface(),contrastCurve:e=>new W(4.5,7,11,21)})}outline(){return z.fromPalette({name:"outline",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?60:50,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1.5,3,4.5,7)})}outlineVariant(){return z.fromPalette({name:"outline_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:80,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5)})}shadow(){return z.fromPalette({name:"shadow",palette:e=>e.neutralPalette,tone:e=>0})}scrim(){return z.fromPalette({name:"scrim",palette:e=>e.neutralPalette,tone:e=>0})}surfaceTint(){return z.fromPalette({name:"surface_tint",palette:e=>e.primaryPalette,tone:e=>e.isDark?80:40,isBackground:!0})}primary(){return z.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>Z(e)?e.isDark?100:0:e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(3,4.5,7,7),toneDeltaPair:e=>new j(this.primaryContainer(),this.primary(),10,"nearer",!1)})}primaryDim(){}onPrimary(){return z.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,tone:e=>Z(e)?e.isDark?10:90:e.isDark?20:100,background:e=>this.primary(),contrastCurve:e=>new W(4.5,7,11,21)})}primaryContainer(){return z.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>Q(e)?e.sourceColorHct.tone:Z(e)?e.isDark?85:25:e.isDark?30:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5),toneDeltaPair:e=>new j(this.primaryContainer(),this.primary(),10,"nearer",!1)})}onPrimaryContainer(){return z.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,tone:e=>Q(e)?z.foregroundTone(this.primaryContainer().tone(e),4.5):Z(e)?e.isDark?0:100:e.isDark?90:30,background:e=>this.primaryContainer(),contrastCurve:e=>new W(3,4.5,7,11)})}inversePrimary(){return z.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>e.isDark?40:80,background:e=>this.inverseSurface(),contrastCurve:e=>new W(3,4.5,7,7)})}secondary(){return z.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(3,4.5,7,7),toneDeltaPair:e=>new j(this.secondaryContainer(),this.secondary(),10,"nearer",!1)})}secondaryDim(){}onSecondary(){return z.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,tone:e=>Z(e)?e.isDark?10:100:e.isDark?20:100,background:e=>this.secondary(),contrastCurve:e=>new W(4.5,7,11,21)})}secondaryContainer(){return z.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>{const t=e.isDark?30:90;return Z(e)?e.isDark?30:85:Q(e)?function(e,t,r,a){let n=r,o=V.from(e,t,r);if(o.chroma<t){let r=o.chroma;for(;o.chroma<t;){n+=a?-1:1;const i=V.from(e,t,n);if(r>i.chroma)break;if(Math.abs(i.chroma-t)<.4)break;Math.abs(i.chroma-t)<Math.abs(o.chroma-t)&&(o=i),r=Math.max(r,i.chroma)}}return n}(e.secondaryPalette.hue,e.secondaryPalette.chroma,t,!e.isDark):t},isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5),toneDeltaPair:e=>new j(this.secondaryContainer(),this.secondary(),10,"nearer",!1)})}onSecondaryContainer(){return z.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,tone:e=>Z(e)?e.isDark?90:10:Q(e)?z.foregroundTone(this.secondaryContainer().tone(e),4.5):e.isDark?90:30,background:e=>this.secondaryContainer(),contrastCurve:e=>new W(3,4.5,7,11)})}tertiary(){return z.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>Z(e)?e.isDark?90:25:e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(3,4.5,7,7),toneDeltaPair:e=>new j(this.tertiaryContainer(),this.tertiary(),10,"nearer",!1)})}tertiaryDim(){}onTertiary(){return z.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,tone:e=>Z(e)?e.isDark?10:90:e.isDark?20:100,background:e=>this.tertiary(),contrastCurve:e=>new W(4.5,7,11,21)})}tertiaryContainer(){return z.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>{if(Z(e))return e.isDark?60:49;if(!Q(e))return e.isDark?30:90;const t=e.tertiaryPalette.getHct(e.sourceColorHct.tone);return N.fixIfDisliked(t).tone},isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5),toneDeltaPair:e=>new j(this.tertiaryContainer(),this.tertiary(),10,"nearer",!1)})}onTertiaryContainer(){return z.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>Z(e)?e.isDark?0:100:Q(e)?z.foregroundTone(this.tertiaryContainer().tone(e),4.5):e.isDark?90:30,background:e=>this.tertiaryContainer(),contrastCurve:e=>new W(3,4.5,7,11)})}error(){return z.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(3,4.5,7,7),toneDeltaPair:e=>new j(this.errorContainer(),this.error(),10,"nearer",!1)})}errorDim(){}onError(){return z.fromPalette({name:"on_error",palette:e=>e.errorPalette,tone:e=>e.isDark?20:100,background:e=>this.error(),contrastCurve:e=>new W(4.5,7,11,21)})}errorContainer(){return z.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>e.isDark?30:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5),toneDeltaPair:e=>new j(this.errorContainer(),this.error(),10,"nearer",!1)})}onErrorContainer(){return z.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,tone:e=>Z(e)?e.isDark?90:10:e.isDark?90:30,background:e=>this.errorContainer(),contrastCurve:e=>new W(3,4.5,7,11)})}primaryFixed(){return z.fromPalette({name:"primary_fixed",palette:e=>e.primaryPalette,tone:e=>Z(e)?40:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5),toneDeltaPair:e=>new j(this.primaryFixed(),this.primaryFixedDim(),10,"lighter",!0)})}primaryFixedDim(){return z.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>Z(e)?30:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5),toneDeltaPair:e=>new j(this.primaryFixed(),this.primaryFixedDim(),10,"lighter",!0)})}onPrimaryFixed(){return z.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,tone:e=>Z(e)?100:10,background:e=>this.primaryFixedDim(),secondBackground:e=>this.primaryFixed(),contrastCurve:e=>new W(4.5,7,11,21)})}onPrimaryFixedVariant(){return z.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,tone:e=>Z(e)?90:30,background:e=>this.primaryFixedDim(),secondBackground:e=>this.primaryFixed(),contrastCurve:e=>new W(3,4.5,7,11)})}secondaryFixed(){return z.fromPalette({name:"secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>Z(e)?80:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5),toneDeltaPair:e=>new j(this.secondaryFixed(),this.secondaryFixedDim(),10,"lighter",!0)})}secondaryFixedDim(){return z.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>Z(e)?70:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5),toneDeltaPair:e=>new j(this.secondaryFixed(),this.secondaryFixedDim(),10,"lighter",!0)})}onSecondaryFixed(){return z.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>10,background:e=>this.secondaryFixedDim(),secondBackground:e=>this.secondaryFixed(),contrastCurve:e=>new W(4.5,7,11,21)})}onSecondaryFixedVariant(){return z.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,tone:e=>Z(e)?25:30,background:e=>this.secondaryFixedDim(),secondBackground:e=>this.secondaryFixed(),contrastCurve:e=>new W(3,4.5,7,11)})}tertiaryFixed(){return z.fromPalette({name:"tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>Z(e)?40:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5),toneDeltaPair:e=>new j(this.tertiaryFixed(),this.tertiaryFixedDim(),10,"lighter",!0)})}tertiaryFixedDim(){return z.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>Z(e)?30:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new W(1,1,3,4.5),toneDeltaPair:e=>new j(this.tertiaryFixed(),this.tertiaryFixedDim(),10,"lighter",!0)})}onTertiaryFixed(){return z.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>Z(e)?100:10,background:e=>this.tertiaryFixedDim(),secondBackground:e=>this.tertiaryFixed(),contrastCurve:e=>new W(4.5,7,11,21)})}onTertiaryFixedVariant(){return z.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,tone:e=>Z(e)?90:30,background:e=>this.tertiaryFixedDim(),secondBackground:e=>this.tertiaryFixed(),contrastCurve:e=>new W(3,4.5,7,11)})}highestSurface(e){return e.isDark?this.surfaceBright():this.surfaceDim()}}
|
|
267
|
+
/**
|
|
268
|
+
* @license
|
|
269
|
+
* Copyright 2025 Google LLC
|
|
270
|
+
*
|
|
271
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
272
|
+
* you may not use this file except in compliance with the License.
|
|
273
|
+
* You may obtain a copy of the License at
|
|
274
|
+
*
|
|
275
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
276
|
+
*
|
|
277
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
278
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
279
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
280
|
+
* See the License for the specific language governing permissions and
|
|
281
|
+
* limitations under the License.
|
|
282
|
+
*/function te(e,t=0,r=100,a=1){return l(t,r,ae(e.hue,e.chroma*a,100,!0))}function re(e,t=0,r=100){return l(t,r,ae(e.hue,e.chroma,0,!1))}function ae(e,t,r,a){let n=r,o=V.from(e,t,n);for(;o.chroma<t&&!(r<0||r>100);){r+=a?-1:1;const i=V.from(e,t,r);o.chroma<i.chroma&&(o=i,n=r)}return n}function ne(e){return 1.5===e?new W(1.5,1.5,3,5.5):3===e?new W(3,3,4.5,7):4.5===e?new W(4.5,4.5,7,11):6===e?new W(6,6,7,11):7===e?new W(7,7,11,21):9===e?new W(9,9,11,21):11===e?new W(11,11,21,21):21===e?new W(21,21,21,21):new W(e,e,7,21)}
|
|
218
283
|
/**
|
|
219
284
|
* @license
|
|
220
285
|
* Copyright 2022 Google LLC
|
|
@@ -231,7 +296,7 @@ class L{static from(t,e,r){return new L(B.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
231
296
|
* See the License for the specific language governing permissions and
|
|
232
297
|
* limitations under the License.
|
|
233
298
|
*/
|
|
234
|
-
function U(t){return t.variant===G.FIDELITY||t.variant===G.CONTENT}function $(t){return t.variant===G.MONOCHROME}!function(t){t[t.MONOCHROME=0]="MONOCHROME",t[t.NEUTRAL=1]="NEUTRAL",t[t.TONAL_SPOT=2]="TONAL_SPOT",t[t.VIBRANT=3]="VIBRANT",t[t.EXPRESSIVE=4]="EXPRESSIVE",t[t.FIDELITY=5]="FIDELITY",t[t.CONTENT=6]="CONTENT",t[t.RAINBOW=7]="RAINBOW",t[t.FRUIT_SALAD=8]="FRUIT_SALAD"}(G||(G={}));class W{static highestSurface(t){return t.isDark?W.surfaceBright:W.surfaceDim}}W.contentAccentToneDelta=15,W.primaryPaletteKeyColor=H.fromPalette({name:"primary_palette_key_color",palette:t=>t.primaryPalette,tone:t=>t.primaryPalette.keyColor.tone}),W.secondaryPaletteKeyColor=H.fromPalette({name:"secondary_palette_key_color",palette:t=>t.secondaryPalette,tone:t=>t.secondaryPalette.keyColor.tone}),W.tertiaryPaletteKeyColor=H.fromPalette({name:"tertiary_palette_key_color",palette:t=>t.tertiaryPalette,tone:t=>t.tertiaryPalette.keyColor.tone}),W.neutralPaletteKeyColor=H.fromPalette({name:"neutral_palette_key_color",palette:t=>t.neutralPalette,tone:t=>t.neutralPalette.keyColor.tone}),W.neutralVariantPaletteKeyColor=H.fromPalette({name:"neutral_variant_palette_key_color",palette:t=>t.neutralVariantPalette,tone:t=>t.neutralVariantPalette.keyColor.tone}),W.background=H.fromPalette({name:"background",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:98,isBackground:!0}),W.onBackground=H.fromPalette({name:"on_background",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:10,background:t=>W.background,contrastCurve:new N(3,3,4.5,7)}),W.surface=H.fromPalette({name:"surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:98,isBackground:!0}),W.surfaceDim=H.fromPalette({name:"surface_dim",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:new N(87,87,80,75).get(t.contrastLevel),isBackground:!0}),W.surfaceBright=H.fromPalette({name:"surface_bright",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(24,24,29,34).get(t.contrastLevel):98,isBackground:!0}),W.surfaceContainerLowest=H.fromPalette({name:"surface_container_lowest",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(4,4,2,0).get(t.contrastLevel):100,isBackground:!0}),W.surfaceContainerLow=H.fromPalette({name:"surface_container_low",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(10,10,11,12).get(t.contrastLevel):new N(96,96,96,95).get(t.contrastLevel),isBackground:!0}),W.surfaceContainer=H.fromPalette({name:"surface_container",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(12,12,16,20).get(t.contrastLevel):new N(94,94,92,90).get(t.contrastLevel),isBackground:!0}),W.surfaceContainerHigh=H.fromPalette({name:"surface_container_high",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(17,17,21,25).get(t.contrastLevel):new N(92,92,88,85).get(t.contrastLevel),isBackground:!0}),W.surfaceContainerHighest=H.fromPalette({name:"surface_container_highest",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(22,22,26,30).get(t.contrastLevel):new N(90,90,84,80).get(t.contrastLevel),isBackground:!0}),W.onSurface=H.fromPalette({name:"on_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:10,background:t=>W.highestSurface(t),contrastCurve:new N(4.5,7,11,21)}),W.surfaceVariant=H.fromPalette({name:"surface_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?30:90,isBackground:!0}),W.onSurfaceVariant=H.fromPalette({name:"on_surface_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?80:30,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,11)}),W.inverseSurface=H.fromPalette({name:"inverse_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:20}),W.inverseOnSurface=H.fromPalette({name:"inverse_on_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?20:95,background:t=>W.inverseSurface,contrastCurve:new N(4.5,7,11,21)}),W.outline=H.fromPalette({name:"outline",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?60:50,background:t=>W.highestSurface(t),contrastCurve:new N(1.5,3,4.5,7)}),W.outlineVariant=H.fromPalette({name:"outline_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?30:80,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5)}),W.shadow=H.fromPalette({name:"shadow",palette:t=>t.neutralPalette,tone:t=>0}),W.scrim=H.fromPalette({name:"scrim",palette:t=>t.neutralPalette,tone:t=>0}),W.surfaceTint=H.fromPalette({name:"surface_tint",palette:t=>t.primaryPalette,tone:t=>t.isDark?80:40,isBackground:!0}),W.primary=H.fromPalette({name:"primary",palette:t=>t.primaryPalette,tone:t=>$(t)?t.isDark?100:0:t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.primaryContainer,W.primary,10,"nearer",!1)}),W.onPrimary=H.fromPalette({name:"on_primary",palette:t=>t.primaryPalette,tone:t=>$(t)?t.isDark?10:90:t.isDark?20:100,background:t=>W.primary,contrastCurve:new N(4.5,7,11,21)}),W.primaryContainer=H.fromPalette({name:"primary_container",palette:t=>t.primaryPalette,tone:t=>U(t)?t.sourceColorHct.tone:$(t)?t.isDark?85:25:t.isDark?30:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.primaryContainer,W.primary,10,"nearer",!1)}),W.onPrimaryContainer=H.fromPalette({name:"on_primary_container",palette:t=>t.primaryPalette,tone:t=>U(t)?H.foregroundTone(W.primaryContainer.tone(t),4.5):$(t)?t.isDark?0:100:t.isDark?90:30,background:t=>W.primaryContainer,contrastCurve:new N(3,4.5,7,11)}),W.inversePrimary=H.fromPalette({name:"inverse_primary",palette:t=>t.primaryPalette,tone:t=>t.isDark?40:80,background:t=>W.inverseSurface,contrastCurve:new N(3,4.5,7,7)}),W.secondary=H.fromPalette({name:"secondary",palette:t=>t.secondaryPalette,tone:t=>t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.secondaryContainer,W.secondary,10,"nearer",!1)}),W.onSecondary=H.fromPalette({name:"on_secondary",palette:t=>t.secondaryPalette,tone:t=>$(t)?t.isDark?10:100:t.isDark?20:100,background:t=>W.secondary,contrastCurve:new N(4.5,7,11,21)}),W.secondaryContainer=H.fromPalette({name:"secondary_container",palette:t=>t.secondaryPalette,tone:t=>{const e=t.isDark?30:90;return $(t)?t.isDark?30:85:U(t)?function(t,e,r,n){let a=r,o=L.from(t,e,r);if(o.chroma<e){let r=o.chroma;for(;o.chroma<e;){a+=n?-1:1;const i=L.from(t,e,a);if(r>i.chroma)break;if(Math.abs(i.chroma-e)<.4)break;Math.abs(i.chroma-e)<Math.abs(o.chroma-e)&&(o=i),r=Math.max(r,i.chroma)}}return a}(t.secondaryPalette.hue,t.secondaryPalette.chroma,e,!t.isDark):e},isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.secondaryContainer,W.secondary,10,"nearer",!1)}),W.onSecondaryContainer=H.fromPalette({name:"on_secondary_container",palette:t=>t.secondaryPalette,tone:t=>$(t)?t.isDark?90:10:U(t)?H.foregroundTone(W.secondaryContainer.tone(t),4.5):t.isDark?90:30,background:t=>W.secondaryContainer,contrastCurve:new N(3,4.5,7,11)}),W.tertiary=H.fromPalette({name:"tertiary",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?90:25:t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.tertiaryContainer,W.tertiary,10,"nearer",!1)}),W.onTertiary=H.fromPalette({name:"on_tertiary",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?10:90:t.isDark?20:100,background:t=>W.tertiary,contrastCurve:new N(4.5,7,11,21)}),W.tertiaryContainer=H.fromPalette({name:"tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>{if($(t))return t.isDark?60:49;if(!U(t))return t.isDark?30:90;const e=t.tertiaryPalette.getHct(t.sourceColorHct.tone);return E.fixIfDisliked(e).tone},isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.tertiaryContainer,W.tertiary,10,"nearer",!1)}),W.onTertiaryContainer=H.fromPalette({name:"on_tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?0:100:U(t)?H.foregroundTone(W.tertiaryContainer.tone(t),4.5):t.isDark?90:30,background:t=>W.tertiaryContainer,contrastCurve:new N(3,4.5,7,11)}),W.error=H.fromPalette({name:"error",palette:t=>t.errorPalette,tone:t=>t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.errorContainer,W.error,10,"nearer",!1)}),W.onError=H.fromPalette({name:"on_error",palette:t=>t.errorPalette,tone:t=>t.isDark?20:100,background:t=>W.error,contrastCurve:new N(4.5,7,11,21)}),W.errorContainer=H.fromPalette({name:"error_container",palette:t=>t.errorPalette,tone:t=>t.isDark?30:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.errorContainer,W.error,10,"nearer",!1)}),W.onErrorContainer=H.fromPalette({name:"on_error_container",palette:t=>t.errorPalette,tone:t=>$(t)?t.isDark?90:10:t.isDark?90:30,background:t=>W.errorContainer,contrastCurve:new N(3,4.5,7,11)}),W.primaryFixed=H.fromPalette({name:"primary_fixed",palette:t=>t.primaryPalette,tone:t=>$(t)?40:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.primaryFixed,W.primaryFixedDim,10,"lighter",!0)}),W.primaryFixedDim=H.fromPalette({name:"primary_fixed_dim",palette:t=>t.primaryPalette,tone:t=>$(t)?30:80,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.primaryFixed,W.primaryFixedDim,10,"lighter",!0)}),W.onPrimaryFixed=H.fromPalette({name:"on_primary_fixed",palette:t=>t.primaryPalette,tone:t=>$(t)?100:10,background:t=>W.primaryFixedDim,secondBackground:t=>W.primaryFixed,contrastCurve:new N(4.5,7,11,21)}),W.onPrimaryFixedVariant=H.fromPalette({name:"on_primary_fixed_variant",palette:t=>t.primaryPalette,tone:t=>$(t)?90:30,background:t=>W.primaryFixedDim,secondBackground:t=>W.primaryFixed,contrastCurve:new N(3,4.5,7,11)}),W.secondaryFixed=H.fromPalette({name:"secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>$(t)?80:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.secondaryFixed,W.secondaryFixedDim,10,"lighter",!0)}),W.secondaryFixedDim=H.fromPalette({name:"secondary_fixed_dim",palette:t=>t.secondaryPalette,tone:t=>$(t)?70:80,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.secondaryFixed,W.secondaryFixedDim,10,"lighter",!0)}),W.onSecondaryFixed=H.fromPalette({name:"on_secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>10,background:t=>W.secondaryFixedDim,secondBackground:t=>W.secondaryFixed,contrastCurve:new N(4.5,7,11,21)}),W.onSecondaryFixedVariant=H.fromPalette({name:"on_secondary_fixed_variant",palette:t=>t.secondaryPalette,tone:t=>$(t)?25:30,background:t=>W.secondaryFixedDim,secondBackground:t=>W.secondaryFixed,contrastCurve:new N(3,4.5,7,11)}),W.tertiaryFixed=H.fromPalette({name:"tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>$(t)?40:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.tertiaryFixed,W.tertiaryFixedDim,10,"lighter",!0)}),W.tertiaryFixedDim=H.fromPalette({name:"tertiary_fixed_dim",palette:t=>t.tertiaryPalette,tone:t=>$(t)?30:80,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.tertiaryFixed,W.tertiaryFixedDim,10,"lighter",!0)}),W.onTertiaryFixed=H.fromPalette({name:"on_tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>$(t)?100:10,background:t=>W.tertiaryFixedDim,secondBackground:t=>W.tertiaryFixed,contrastCurve:new N(4.5,7,11,21)}),W.onTertiaryFixedVariant=H.fromPalette({name:"on_tertiary_fixed_variant",palette:t=>t.tertiaryPalette,tone:t=>$(t)?90:30,background:t=>W.tertiaryFixedDim,secondBackground:t=>W.tertiaryFixed,contrastCurve:new N(3,4.5,7,11)});
|
|
299
|
+
class oe{constructor(){this.allColors=[this.background(),this.onBackground(),this.surface(),this.surfaceDim(),this.surfaceBright(),this.surfaceContainerLowest(),this.surfaceContainerLow(),this.surfaceContainer(),this.surfaceContainerHigh(),this.surfaceContainerHighest(),this.onSurface(),this.onSurfaceVariant(),this.outline(),this.outlineVariant(),this.inverseSurface(),this.inverseOnSurface(),this.primary(),this.primaryDim(),this.onPrimary(),this.primaryContainer(),this.onPrimaryContainer(),this.primaryFixed(),this.primaryFixedDim(),this.onPrimaryFixed(),this.onPrimaryFixedVariant(),this.inversePrimary(),this.secondary(),this.secondaryDim(),this.onSecondary(),this.secondaryContainer(),this.onSecondaryContainer(),this.secondaryFixed(),this.secondaryFixedDim(),this.onSecondaryFixed(),this.onSecondaryFixedVariant(),this.tertiary(),this.tertiaryDim(),this.onTertiary(),this.tertiaryContainer(),this.onTertiaryContainer(),this.tertiaryFixed(),this.tertiaryFixedDim(),this.onTertiaryFixed(),this.onTertiaryFixedVariant(),this.error(),this.errorDim(),this.onError(),this.errorContainer(),this.onErrorContainer()].filter(e=>void 0!==e)}highestSurface(e){return oe.colorSpec.highestSurface(e)}primaryPaletteKeyColor(){return oe.colorSpec.primaryPaletteKeyColor()}secondaryPaletteKeyColor(){return oe.colorSpec.secondaryPaletteKeyColor()}tertiaryPaletteKeyColor(){return oe.colorSpec.tertiaryPaletteKeyColor()}neutralPaletteKeyColor(){return oe.colorSpec.neutralPaletteKeyColor()}neutralVariantPaletteKeyColor(){return oe.colorSpec.neutralVariantPaletteKeyColor()}errorPaletteKeyColor(){return oe.colorSpec.errorPaletteKeyColor()}background(){return oe.colorSpec.background()}onBackground(){return oe.colorSpec.onBackground()}surface(){return oe.colorSpec.surface()}surfaceDim(){return oe.colorSpec.surfaceDim()}surfaceBright(){return oe.colorSpec.surfaceBright()}surfaceContainerLowest(){return oe.colorSpec.surfaceContainerLowest()}surfaceContainerLow(){return oe.colorSpec.surfaceContainerLow()}surfaceContainer(){return oe.colorSpec.surfaceContainer()}surfaceContainerHigh(){return oe.colorSpec.surfaceContainerHigh()}surfaceContainerHighest(){return oe.colorSpec.surfaceContainerHighest()}onSurface(){return oe.colorSpec.onSurface()}surfaceVariant(){return oe.colorSpec.surfaceVariant()}onSurfaceVariant(){return oe.colorSpec.onSurfaceVariant()}outline(){return oe.colorSpec.outline()}outlineVariant(){return oe.colorSpec.outlineVariant()}inverseSurface(){return oe.colorSpec.inverseSurface()}inverseOnSurface(){return oe.colorSpec.inverseOnSurface()}shadow(){return oe.colorSpec.shadow()}scrim(){return oe.colorSpec.scrim()}surfaceTint(){return oe.colorSpec.surfaceTint()}primary(){return oe.colorSpec.primary()}primaryDim(){return oe.colorSpec.primaryDim()}onPrimary(){return oe.colorSpec.onPrimary()}primaryContainer(){return oe.colorSpec.primaryContainer()}onPrimaryContainer(){return oe.colorSpec.onPrimaryContainer()}inversePrimary(){return oe.colorSpec.inversePrimary()}primaryFixed(){return oe.colorSpec.primaryFixed()}primaryFixedDim(){return oe.colorSpec.primaryFixedDim()}onPrimaryFixed(){return oe.colorSpec.onPrimaryFixed()}onPrimaryFixedVariant(){return oe.colorSpec.onPrimaryFixedVariant()}secondary(){return oe.colorSpec.secondary()}secondaryDim(){return oe.colorSpec.secondaryDim()}onSecondary(){return oe.colorSpec.onSecondary()}secondaryContainer(){return oe.colorSpec.secondaryContainer()}onSecondaryContainer(){return oe.colorSpec.onSecondaryContainer()}secondaryFixed(){return oe.colorSpec.secondaryFixed()}secondaryFixedDim(){return oe.colorSpec.secondaryFixedDim()}onSecondaryFixed(){return oe.colorSpec.onSecondaryFixed()}onSecondaryFixedVariant(){return oe.colorSpec.onSecondaryFixedVariant()}tertiary(){return oe.colorSpec.tertiary()}tertiaryDim(){return oe.colorSpec.tertiaryDim()}onTertiary(){return oe.colorSpec.onTertiary()}tertiaryContainer(){return oe.colorSpec.tertiaryContainer()}onTertiaryContainer(){return oe.colorSpec.onTertiaryContainer()}tertiaryFixed(){return oe.colorSpec.tertiaryFixed()}tertiaryFixedDim(){return oe.colorSpec.tertiaryFixedDim()}onTertiaryFixed(){return oe.colorSpec.onTertiaryFixed()}onTertiaryFixedVariant(){return oe.colorSpec.onTertiaryFixedVariant()}error(){return oe.colorSpec.error()}errorDim(){return oe.colorSpec.errorDim()}onError(){return oe.colorSpec.onError()}errorContainer(){return oe.colorSpec.errorContainer()}onErrorContainer(){return oe.colorSpec.onErrorContainer()}static highestSurface(e){return oe.colorSpec.highestSurface(e)}}oe.contentAccentToneDelta=15,oe.colorSpec=new class extends ee{surface(){const e=z.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>(super.surface().tone(e),"phone"===e.platform?e.isDark?4:V.isYellow(e.neutralPalette.hue)?99:e.variant===J.VIBRANT?97:98:0),isBackground:!0});return U(super.surface(),"2025",e)}surfaceDim(){const e=z.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?4:V.isYellow(e.neutralPalette.hue)?90:e.variant===J.VIBRANT?85:87,isBackground:!0,chromaMultiplier:e=>{if(!e.isDark){if(e.variant===J.NEUTRAL)return 2.5;if(e.variant===J.TONAL_SPOT)return 1.7;if(e.variant===J.EXPRESSIVE)return V.isYellow(e.neutralPalette.hue)?2.7:1.75;if(e.variant===J.VIBRANT)return 1.36}return 1}});return U(super.surfaceDim(),"2025",e)}surfaceBright(){const e=z.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?18:V.isYellow(e.neutralPalette.hue)?99:e.variant===J.VIBRANT?97:98,isBackground:!0,chromaMultiplier:e=>{if(e.isDark){if(e.variant===J.NEUTRAL)return 2.5;if(e.variant===J.TONAL_SPOT)return 1.7;if(e.variant===J.EXPRESSIVE)return V.isYellow(e.neutralPalette.hue)?2.7:1.75;if(e.variant===J.VIBRANT)return 1.36}return 1}});return U(super.surfaceBright(),"2025",e)}surfaceContainerLowest(){const e=z.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?0:100,isBackground:!0});return U(super.surfaceContainerLowest(),"2025",e)}surfaceContainerLow(){const e=z.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>"phone"===e.platform?e.isDark?6:V.isYellow(e.neutralPalette.hue)?98:e.variant===J.VIBRANT?95:96:15,isBackground:!0,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===J.NEUTRAL)return 1.3;if(e.variant===J.TONAL_SPOT)return 1.25;if(e.variant===J.EXPRESSIVE)return V.isYellow(e.neutralPalette.hue)?1.3:1.15;if(e.variant===J.VIBRANT)return 1.08}return 1}});return U(super.surfaceContainerLow(),"2025",e)}surfaceContainer(){const e=z.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>"phone"===e.platform?e.isDark?9:V.isYellow(e.neutralPalette.hue)?96:e.variant===J.VIBRANT?92:94:20,isBackground:!0,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===J.NEUTRAL)return 1.6;if(e.variant===J.TONAL_SPOT)return 1.4;if(e.variant===J.EXPRESSIVE)return V.isYellow(e.neutralPalette.hue)?1.6:1.3;if(e.variant===J.VIBRANT)return 1.15}return 1}});return U(super.surfaceContainer(),"2025",e)}surfaceContainerHigh(){const e=z.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>"phone"===e.platform?e.isDark?12:V.isYellow(e.neutralPalette.hue)?94:e.variant===J.VIBRANT?90:92:25,isBackground:!0,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===J.NEUTRAL)return 1.9;if(e.variant===J.TONAL_SPOT)return 1.5;if(e.variant===J.EXPRESSIVE)return V.isYellow(e.neutralPalette.hue)?1.95:1.45;if(e.variant===J.VIBRANT)return 1.22}return 1}});return U(super.surfaceContainerHigh(),"2025",e)}surfaceContainerHighest(){const e=z.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?15:V.isYellow(e.neutralPalette.hue)?92:e.variant===J.VIBRANT?88:90,isBackground:!0,chromaMultiplier:e=>e.variant===J.NEUTRAL?2.2:e.variant===J.TONAL_SPOT?1.7:e.variant===J.EXPRESSIVE?V.isYellow(e.neutralPalette.hue)?2.3:1.6:e.variant===J.VIBRANT?1.29:1});return U(super.surfaceContainerHighest(),"2025",e)}onSurface(){const e=z.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.variant===J.VIBRANT?te(e.neutralPalette,0,100,1.1):z.getInitialToneFromBackground(e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh())(e),chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===J.NEUTRAL)return 2.2;if(e.variant===J.TONAL_SPOT)return 1.7;if(e.variant===J.EXPRESSIVE)return V.isYellow(e.neutralPalette.hue)?e.isDark?3:2.3:1.6}return 1},background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>e.isDark&&"phone"===e.platform?ne(11):ne(9)});return U(super.onSurface(),"2025",e)}onSurfaceVariant(){const e=z.fromPalette({name:"on_surface_variant",palette:e=>e.neutralPalette,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===J.NEUTRAL)return 2.2;if(e.variant===J.TONAL_SPOT)return 1.7;if(e.variant===J.EXPRESSIVE)return V.isYellow(e.neutralPalette.hue)?e.isDark?3:2.3:1.6}return 1},background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?e.isDark?ne(6):ne(4.5):ne(7)});return U(super.onSurfaceVariant(),"2025",e)}outline(){const e=z.fromPalette({name:"outline",palette:e=>e.neutralPalette,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===J.NEUTRAL)return 2.2;if(e.variant===J.TONAL_SPOT)return 1.7;if(e.variant===J.EXPRESSIVE)return V.isYellow(e.neutralPalette.hue)?e.isDark?3:2.3:1.6}return 1},background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?ne(3):ne(4.5)});return U(super.outline(),"2025",e)}outlineVariant(){const e=z.fromPalette({name:"outline_variant",palette:e=>e.neutralPalette,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===J.NEUTRAL)return 2.2;if(e.variant===J.TONAL_SPOT)return 1.7;if(e.variant===J.EXPRESSIVE)return V.isYellow(e.neutralPalette.hue)?e.isDark?3:2.3:1.6}return 1},background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?ne(1.5):ne(3)});return U(super.outlineVariant(),"2025",e)}inverseSurface(){const e=z.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?98:4,isBackground:!0});return U(super.inverseSurface(),"2025",e)}inverseOnSurface(){const e=z.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,background:e=>this.inverseSurface(),contrastCurve:e=>ne(7)});return U(super.inverseOnSurface(),"2025",e)}primary(){const e=z.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>e.variant===J.NEUTRAL?"phone"===e.platform?e.isDark?80:40:90:e.variant===J.TONAL_SPOT?"phone"===e.platform?e.isDark?80:te(e.primaryPalette):te(e.primaryPalette,0,90):e.variant===J.EXPRESSIVE?"phone"===e.platform?te(e.primaryPalette,0,V.isYellow(e.primaryPalette.hue)?25:V.isCyan(e.primaryPalette.hue)?88:98):te(e.primaryPalette):"phone"===e.platform?te(e.primaryPalette,0,V.isCyan(e.primaryPalette.hue)?88:98):te(e.primaryPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?ne(4.5):ne(7),toneDeltaPair:e=>"phone"===e.platform?new j(this.primaryContainer(),this.primary(),5,"relative_lighter",!0,"farther"):void 0});return U(super.primary(),"2025",e)}primaryDim(){return z.fromPalette({name:"primary_dim",palette:e=>e.primaryPalette,tone:e=>e.variant===J.NEUTRAL?85:e.variant===J.TONAL_SPOT?te(e.primaryPalette,0,90):te(e.primaryPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>ne(4.5),toneDeltaPair:e=>new j(this.primaryDim(),this.primary(),5,"darker",!0,"farther")})}onPrimary(){const e=z.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,background:e=>"phone"===e.platform?this.primary():this.primaryDim(),contrastCurve:e=>"phone"===e.platform?ne(6):ne(7)});return U(super.onPrimary(),"2025",e)}primaryContainer(){const e=z.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>"watch"===e.platform?30:e.variant===J.NEUTRAL?e.isDark?30:90:e.variant===J.TONAL_SPOT?e.isDark?re(e.primaryPalette,35,93):te(e.primaryPalette,0,90):e.variant===J.EXPRESSIVE?e.isDark?te(e.primaryPalette,30,93):te(e.primaryPalette,78,V.isCyan(e.primaryPalette.hue)?88:90):e.isDark?re(e.primaryPalette,66,93):te(e.primaryPalette,66,V.isCyan(e.primaryPalette.hue)?88:93),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,toneDeltaPair:e=>"phone"===e.platform?void 0:new j(this.primaryContainer(),this.primaryDim(),10,"darker",!0,"farther"),contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ne(1.5):void 0});return U(super.primaryContainer(),"2025",e)}onPrimaryContainer(){const e=z.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,background:e=>this.primaryContainer(),contrastCurve:e=>"phone"===e.platform?ne(6):ne(7)});return U(super.onPrimaryContainer(),"2025",e)}primaryFixed(){const e=z.fromPalette({name:"primary_fixed",palette:e=>e.primaryPalette,tone:e=>{let t=Object.assign({},e,{isDark:!1,contrastLevel:0});return this.primaryContainer().getTone(t)},isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ne(1.5):void 0});return U(super.primaryFixed(),"2025",e)}primaryFixedDim(){const e=z.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>this.primaryFixed().getTone(e),isBackground:!0,toneDeltaPair:e=>new j(this.primaryFixedDim(),this.primaryFixed(),5,"darker",!0,"exact")});return U(super.primaryFixedDim(),"2025",e)}onPrimaryFixed(){const e=z.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,background:e=>this.primaryFixedDim(),contrastCurve:e=>ne(7)});return U(super.onPrimaryFixed(),"2025",e)}onPrimaryFixedVariant(){const e=z.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,background:e=>this.primaryFixedDim(),contrastCurve:e=>ne(4.5)});return U(super.onPrimaryFixedVariant(),"2025",e)}inversePrimary(){const e=z.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>te(e.primaryPalette),background:e=>this.inverseSurface(),contrastCurve:e=>"phone"===e.platform?ne(6):ne(7)});return U(super.inversePrimary(),"2025",e)}secondary(){const e=z.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>"watch"===e.platform?e.variant===J.NEUTRAL?90:te(e.secondaryPalette,0,90):e.variant===J.NEUTRAL?e.isDark?re(e.secondaryPalette,0,98):te(e.secondaryPalette):e.variant===J.VIBRANT?te(e.secondaryPalette,0,e.isDark?90:98):e.isDark?80:te(e.secondaryPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?ne(4.5):ne(7),toneDeltaPair:e=>"phone"===e.platform?new j(this.secondaryContainer(),this.secondary(),5,"relative_lighter",!0,"farther"):void 0});return U(super.secondary(),"2025",e)}secondaryDim(){return z.fromPalette({name:"secondary_dim",palette:e=>e.secondaryPalette,tone:e=>e.variant===J.NEUTRAL?85:te(e.secondaryPalette,0,90),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>ne(4.5),toneDeltaPair:e=>new j(this.secondaryDim(),this.secondary(),5,"darker",!0,"farther")})}onSecondary(){const e=z.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,background:e=>"phone"===e.platform?this.secondary():this.secondaryDim(),contrastCurve:e=>"phone"===e.platform?ne(6):ne(7)});return U(super.onSecondary(),"2025",e)}secondaryContainer(){const e=z.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>"watch"===e.platform?30:e.variant===J.VIBRANT?e.isDark?re(e.secondaryPalette,30,40):te(e.secondaryPalette,84,90):e.variant===J.EXPRESSIVE?e.isDark?15:te(e.secondaryPalette,90,95):e.isDark?25:90,isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,toneDeltaPair:e=>"watch"===e.platform?new j(this.secondaryContainer(),this.secondaryDim(),10,"darker",!0,"farther"):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ne(1.5):void 0});return U(super.secondaryContainer(),"2025",e)}onSecondaryContainer(){const e=z.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,background:e=>this.secondaryContainer(),contrastCurve:e=>"phone"===e.platform?ne(6):ne(7)});return U(super.onSecondaryContainer(),"2025",e)}secondaryFixed(){const e=z.fromPalette({name:"secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>{let t=Object.assign({},e,{isDark:!1,contrastLevel:0});return this.secondaryContainer().getTone(t)},isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ne(1.5):void 0});return U(super.secondaryFixed(),"2025",e)}secondaryFixedDim(){const e=z.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>this.secondaryFixed().getTone(e),isBackground:!0,toneDeltaPair:e=>new j(this.secondaryFixedDim(),this.secondaryFixed(),5,"darker",!0,"exact")});return U(super.secondaryFixedDim(),"2025",e)}onSecondaryFixed(){const e=z.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,background:e=>this.secondaryFixedDim(),contrastCurve:e=>ne(7)});return U(super.onSecondaryFixed(),"2025",e)}onSecondaryFixedVariant(){const e=z.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,background:e=>this.secondaryFixedDim(),contrastCurve:e=>ne(4.5)});return U(super.onSecondaryFixedVariant(),"2025",e)}tertiary(){const e=z.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>"watch"===e.platform?e.variant===J.TONAL_SPOT?te(e.tertiaryPalette,0,90):te(e.tertiaryPalette):e.variant===J.EXPRESSIVE||e.variant===J.VIBRANT?te(e.tertiaryPalette,0,V.isCyan(e.tertiaryPalette.hue)?88:e.isDark?98:100):e.isDark?te(e.tertiaryPalette,0,98):te(e.tertiaryPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?ne(4.5):ne(7),toneDeltaPair:e=>"phone"===e.platform?new j(this.tertiaryContainer(),this.tertiary(),5,"relative_lighter",!0,"farther"):void 0});return U(super.tertiary(),"2025",e)}tertiaryDim(){return z.fromPalette({name:"tertiary_dim",palette:e=>e.tertiaryPalette,tone:e=>e.variant===J.TONAL_SPOT?te(e.tertiaryPalette,0,90):te(e.tertiaryPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>ne(4.5),toneDeltaPair:e=>new j(this.tertiaryDim(),this.tertiary(),5,"darker",!0,"farther")})}onTertiary(){const e=z.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,background:e=>"phone"===e.platform?this.tertiary():this.tertiaryDim(),contrastCurve:e=>"phone"===e.platform?ne(6):ne(7)});return U(super.onTertiary(),"2025",e)}tertiaryContainer(){const e=z.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>"watch"===e.platform?e.variant===J.TONAL_SPOT?te(e.tertiaryPalette,0,90):te(e.tertiaryPalette):e.variant===J.NEUTRAL?e.isDark?te(e.tertiaryPalette,0,93):te(e.tertiaryPalette,0,96):e.variant===J.TONAL_SPOT?te(e.tertiaryPalette,0,e.isDark?93:100):e.variant===J.EXPRESSIVE?te(e.tertiaryPalette,75,V.isCyan(e.tertiaryPalette.hue)?88:e.isDark?93:100):e.isDark?te(e.tertiaryPalette,0,93):te(e.tertiaryPalette,72,100),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,toneDeltaPair:e=>"watch"===e.platform?new j(this.tertiaryContainer(),this.tertiaryDim(),10,"darker",!0,"farther"):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ne(1.5):void 0});return U(super.tertiaryContainer(),"2025",e)}onTertiaryContainer(){const e=z.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,background:e=>this.tertiaryContainer(),contrastCurve:e=>"phone"===e.platform?ne(6):ne(7)});return U(super.onTertiaryContainer(),"2025",e)}tertiaryFixed(){const e=z.fromPalette({name:"tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>{let t=Object.assign({},e,{isDark:!1,contrastLevel:0});return this.tertiaryContainer().getTone(t)},isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ne(1.5):void 0});return U(super.tertiaryFixed(),"2025",e)}tertiaryFixedDim(){const e=z.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>this.tertiaryFixed().getTone(e),isBackground:!0,toneDeltaPair:e=>new j(this.tertiaryFixedDim(),this.tertiaryFixed(),5,"darker",!0,"exact")});return U(super.tertiaryFixedDim(),"2025",e)}onTertiaryFixed(){const e=z.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,background:e=>this.tertiaryFixedDim(),contrastCurve:e=>ne(7)});return U(super.onTertiaryFixed(),"2025",e)}onTertiaryFixedVariant(){const e=z.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,background:e=>this.tertiaryFixedDim(),contrastCurve:e=>ne(4.5)});return U(super.onTertiaryFixedVariant(),"2025",e)}error(){const e=z.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>"phone"===e.platform?e.isDark?re(e.errorPalette,0,98):te(e.errorPalette):re(e.errorPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?ne(4.5):ne(7),toneDeltaPair:e=>"phone"===e.platform?new j(this.errorContainer(),this.error(),5,"relative_lighter",!0,"farther"):void 0});return U(super.error(),"2025",e)}errorDim(){return z.fromPalette({name:"error_dim",palette:e=>e.errorPalette,tone:e=>re(e.errorPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>ne(4.5),toneDeltaPair:e=>new j(this.errorDim(),this.error(),5,"darker",!0,"farther")})}onError(){const e=z.fromPalette({name:"on_error",palette:e=>e.errorPalette,background:e=>"phone"===e.platform?this.error():this.errorDim(),contrastCurve:e=>"phone"===e.platform?ne(6):ne(7)});return U(super.onError(),"2025",e)}errorContainer(){const e=z.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>"watch"===e.platform?30:e.isDark?re(e.errorPalette,30,93):te(e.errorPalette,0,90),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,toneDeltaPair:e=>"watch"===e.platform?new j(this.errorContainer(),this.errorDim(),10,"darker",!0,"farther"):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ne(1.5):void 0});return U(super.errorContainer(),"2025",e)}onErrorContainer(){const e=z.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,background:e=>this.errorContainer(),contrastCurve:e=>"phone"===e.platform?ne(4.5):ne(7)});return U(super.onErrorContainer(),"2025",e)}surfaceVariant(){const e=Object.assign(this.surfaceContainerHighest().clone(),{name:"surface_variant"});return U(super.surfaceVariant(),"2025",e)}surfaceTint(){const e=Object.assign(this.primary().clone(),{name:"surface_tint"});return U(super.surfaceTint(),"2025",e)}background(){const e=Object.assign(this.surface().clone(),{name:"background"});return U(super.background(),"2025",e)}onBackground(){const e=Object.assign(this.onSurface().clone(),{name:"on_background",tone:e=>"watch"===e.platform?100:this.onSurface().getTone(e)});return U(super.onBackground(),"2025",e)}},oe.primaryPaletteKeyColor=oe.colorSpec.primaryPaletteKeyColor(),oe.secondaryPaletteKeyColor=oe.colorSpec.secondaryPaletteKeyColor(),oe.tertiaryPaletteKeyColor=oe.colorSpec.tertiaryPaletteKeyColor(),oe.neutralPaletteKeyColor=oe.colorSpec.neutralPaletteKeyColor(),oe.neutralVariantPaletteKeyColor=oe.colorSpec.neutralVariantPaletteKeyColor(),oe.background=oe.colorSpec.background(),oe.onBackground=oe.colorSpec.onBackground(),oe.surface=oe.colorSpec.surface(),oe.surfaceDim=oe.colorSpec.surfaceDim(),oe.surfaceBright=oe.colorSpec.surfaceBright(),oe.surfaceContainerLowest=oe.colorSpec.surfaceContainerLowest(),oe.surfaceContainerLow=oe.colorSpec.surfaceContainerLow(),oe.surfaceContainer=oe.colorSpec.surfaceContainer(),oe.surfaceContainerHigh=oe.colorSpec.surfaceContainerHigh(),oe.surfaceContainerHighest=oe.colorSpec.surfaceContainerHighest(),oe.onSurface=oe.colorSpec.onSurface(),oe.surfaceVariant=oe.colorSpec.surfaceVariant(),oe.onSurfaceVariant=oe.colorSpec.onSurfaceVariant(),oe.inverseSurface=oe.colorSpec.inverseSurface(),oe.inverseOnSurface=oe.colorSpec.inverseOnSurface(),oe.outline=oe.colorSpec.outline(),oe.outlineVariant=oe.colorSpec.outlineVariant(),oe.shadow=oe.colorSpec.shadow(),oe.scrim=oe.colorSpec.scrim(),oe.surfaceTint=oe.colorSpec.surfaceTint(),oe.primary=oe.colorSpec.primary(),oe.onPrimary=oe.colorSpec.onPrimary(),oe.primaryContainer=oe.colorSpec.primaryContainer(),oe.onPrimaryContainer=oe.colorSpec.onPrimaryContainer(),oe.inversePrimary=oe.colorSpec.inversePrimary(),oe.secondary=oe.colorSpec.secondary(),oe.onSecondary=oe.colorSpec.onSecondary(),oe.secondaryContainer=oe.colorSpec.secondaryContainer(),oe.onSecondaryContainer=oe.colorSpec.onSecondaryContainer(),oe.tertiary=oe.colorSpec.tertiary(),oe.onTertiary=oe.colorSpec.onTertiary(),oe.tertiaryContainer=oe.colorSpec.tertiaryContainer(),oe.onTertiaryContainer=oe.colorSpec.onTertiaryContainer(),oe.error=oe.colorSpec.error(),oe.onError=oe.colorSpec.onError(),oe.errorContainer=oe.colorSpec.errorContainer(),oe.onErrorContainer=oe.colorSpec.onErrorContainer(),oe.primaryFixed=oe.colorSpec.primaryFixed(),oe.primaryFixedDim=oe.colorSpec.primaryFixedDim(),oe.onPrimaryFixed=oe.colorSpec.onPrimaryFixed(),oe.onPrimaryFixedVariant=oe.colorSpec.onPrimaryFixedVariant(),oe.secondaryFixed=oe.colorSpec.secondaryFixed(),oe.secondaryFixedDim=oe.colorSpec.secondaryFixedDim(),oe.onSecondaryFixed=oe.colorSpec.onSecondaryFixed(),oe.onSecondaryFixedVariant=oe.colorSpec.onSecondaryFixedVariant(),oe.tertiaryFixed=oe.colorSpec.tertiaryFixed(),oe.tertiaryFixedDim=oe.colorSpec.tertiaryFixedDim(),oe.onTertiaryFixed=oe.colorSpec.onTertiaryFixed(),oe.onTertiaryFixedVariant=oe.colorSpec.onTertiaryFixedVariant();
|
|
235
300
|
/**
|
|
236
301
|
* @license
|
|
237
302
|
* Copyright 2022 Google LLC
|
|
@@ -248,7 +313,7 @@ function U(t){return t.variant===G.FIDELITY||t.variant===G.CONTENT}function $(t)
|
|
|
248
313
|
* See the License for the specific language governing permissions and
|
|
249
314
|
* limitations under the License.
|
|
250
315
|
*/
|
|
251
|
-
class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.variant,this.contrastLevel=t.contrastLevel,this.isDark=t.isDark,this.sourceColorHct=L.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=V.fromHueAndChroma(25,84)}static getRotatedHue(t,e,r){const n=t.hue;if(e.length!==r.length)throw new Error(`mismatch between hue length ${e.length} & rotations ${r.length}`);if(1===r.length)return d(t.hue+r[0]);const a=e.length;for(let t=0;t<=a-2;t++){const a=e[t],o=e[t+1];if(a<n&&n<o)return d(n+r[t])}return n}getArgb(t){return t.getArgb(this)}getHct(t){return t.getHct(this)}get primaryPaletteKeyColor(){return this.getArgb(W.primaryPaletteKeyColor)}get secondaryPaletteKeyColor(){return this.getArgb(W.secondaryPaletteKeyColor)}get tertiaryPaletteKeyColor(){return this.getArgb(W.tertiaryPaletteKeyColor)}get neutralPaletteKeyColor(){return this.getArgb(W.neutralPaletteKeyColor)}get neutralVariantPaletteKeyColor(){return this.getArgb(W.neutralVariantPaletteKeyColor)}get background(){return this.getArgb(W.background)}get onBackground(){return this.getArgb(W.onBackground)}get surface(){return this.getArgb(W.surface)}get surfaceDim(){return this.getArgb(W.surfaceDim)}get surfaceBright(){return this.getArgb(W.surfaceBright)}get surfaceContainerLowest(){return this.getArgb(W.surfaceContainerLowest)}get surfaceContainerLow(){return this.getArgb(W.surfaceContainerLow)}get surfaceContainer(){return this.getArgb(W.surfaceContainer)}get surfaceContainerHigh(){return this.getArgb(W.surfaceContainerHigh)}get surfaceContainerHighest(){return this.getArgb(W.surfaceContainerHighest)}get onSurface(){return this.getArgb(W.onSurface)}get surfaceVariant(){return this.getArgb(W.surfaceVariant)}get onSurfaceVariant(){return this.getArgb(W.onSurfaceVariant)}get inverseSurface(){return this.getArgb(W.inverseSurface)}get inverseOnSurface(){return this.getArgb(W.inverseOnSurface)}get outline(){return this.getArgb(W.outline)}get outlineVariant(){return this.getArgb(W.outlineVariant)}get shadow(){return this.getArgb(W.shadow)}get scrim(){return this.getArgb(W.scrim)}get surfaceTint(){return this.getArgb(W.surfaceTint)}get primary(){return this.getArgb(W.primary)}get onPrimary(){return this.getArgb(W.onPrimary)}get primaryContainer(){return this.getArgb(W.primaryContainer)}get onPrimaryContainer(){return this.getArgb(W.onPrimaryContainer)}get inversePrimary(){return this.getArgb(W.inversePrimary)}get secondary(){return this.getArgb(W.secondary)}get onSecondary(){return this.getArgb(W.onSecondary)}get secondaryContainer(){return this.getArgb(W.secondaryContainer)}get onSecondaryContainer(){return this.getArgb(W.onSecondaryContainer)}get tertiary(){return this.getArgb(W.tertiary)}get onTertiary(){return this.getArgb(W.onTertiary)}get tertiaryContainer(){return this.getArgb(W.tertiaryContainer)}get onTertiaryContainer(){return this.getArgb(W.onTertiaryContainer)}get error(){return this.getArgb(W.error)}get onError(){return this.getArgb(W.onError)}get errorContainer(){return this.getArgb(W.errorContainer)}get onErrorContainer(){return this.getArgb(W.onErrorContainer)}get primaryFixed(){return this.getArgb(W.primaryFixed)}get primaryFixedDim(){return this.getArgb(W.primaryFixedDim)}get onPrimaryFixed(){return this.getArgb(W.onPrimaryFixed)}get onPrimaryFixedVariant(){return this.getArgb(W.onPrimaryFixedVariant)}get secondaryFixed(){return this.getArgb(W.secondaryFixed)}get secondaryFixedDim(){return this.getArgb(W.secondaryFixedDim)}get onSecondaryFixed(){return this.getArgb(W.onSecondaryFixed)}get onSecondaryFixedVariant(){return this.getArgb(W.onSecondaryFixedVariant)}get tertiaryFixed(){return this.getArgb(W.tertiaryFixed)}get tertiaryFixedDim(){return this.getArgb(W.tertiaryFixedDim)}get onTertiaryFixed(){return this.getArgb(W.onTertiaryFixed)}get onTertiaryFixedVariant(){return this.getArgb(W.onTertiaryFixedVariant)}}
|
|
316
|
+
class ie{static maybeFallbackSpecVersion(e,t){switch(t){case J.EXPRESSIVE:case J.VIBRANT:case J.TONAL_SPOT:case J.NEUTRAL:return e;default:return"2021"}}constructor(e){this.sourceColorArgb=e.sourceColorHct.toInt(),this.variant=e.variant,this.contrastLevel=e.contrastLevel,this.isDark=e.isDark,this.platform=e.platform??"phone",this.specVersion=ie.maybeFallbackSpecVersion(e.specVersion??"2021",this.variant),this.sourceColorHct=e.sourceColorHct,this.primaryPalette=e.primaryPalette??le(this.specVersion).getPrimaryPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.secondaryPalette=e.secondaryPalette??le(this.specVersion).getSecondaryPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.tertiaryPalette=e.tertiaryPalette??le(this.specVersion).getTertiaryPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.neutralPalette=e.neutralPalette??le(this.specVersion).getNeutralPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.neutralVariantPalette=e.neutralVariantPalette??le(this.specVersion).getNeutralVariantPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.errorPalette=e.errorPalette??le(this.specVersion).getErrorPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel)??q.fromHueAndChroma(25,84),this.colors=new oe}toString(){return`Scheme: variant=${J[this.variant]}, mode=${this.isDark?"dark":"light"}, platform=${this.platform}, contrastLevel=${this.contrastLevel.toFixed(1)}, seed=${this.sourceColorHct.toString()}, specVersion=${this.specVersion}`}static getPiecewiseHue(e,t,r){const a=Math.min(t.length-1,r.length),n=e.hue;for(let e=0;e<a;e++)if(n>=t[e]&&n<t[e+1])return d(r[e]);return n}static getRotatedHue(e,t,r){let a=ie.getPiecewiseHue(e,t,r);return Math.min(t.length-1,r.length)<=0&&(a=0),d(e.hue+a)}getArgb(e){return e.getArgb(this)}getHct(e){return e.getHct(this)}get primaryPaletteKeyColor(){return this.getArgb(this.colors.primaryPaletteKeyColor())}get secondaryPaletteKeyColor(){return this.getArgb(this.colors.secondaryPaletteKeyColor())}get tertiaryPaletteKeyColor(){return this.getArgb(this.colors.tertiaryPaletteKeyColor())}get neutralPaletteKeyColor(){return this.getArgb(this.colors.neutralPaletteKeyColor())}get neutralVariantPaletteKeyColor(){return this.getArgb(this.colors.neutralVariantPaletteKeyColor())}get errorPaletteKeyColor(){return this.getArgb(this.colors.errorPaletteKeyColor())}get background(){return this.getArgb(this.colors.background())}get onBackground(){return this.getArgb(this.colors.onBackground())}get surface(){return this.getArgb(this.colors.surface())}get surfaceDim(){return this.getArgb(this.colors.surfaceDim())}get surfaceBright(){return this.getArgb(this.colors.surfaceBright())}get surfaceContainerLowest(){return this.getArgb(this.colors.surfaceContainerLowest())}get surfaceContainerLow(){return this.getArgb(this.colors.surfaceContainerLow())}get surfaceContainer(){return this.getArgb(this.colors.surfaceContainer())}get surfaceContainerHigh(){return this.getArgb(this.colors.surfaceContainerHigh())}get surfaceContainerHighest(){return this.getArgb(this.colors.surfaceContainerHighest())}get onSurface(){return this.getArgb(this.colors.onSurface())}get surfaceVariant(){return this.getArgb(this.colors.surfaceVariant())}get onSurfaceVariant(){return this.getArgb(this.colors.onSurfaceVariant())}get inverseSurface(){return this.getArgb(this.colors.inverseSurface())}get inverseOnSurface(){return this.getArgb(this.colors.inverseOnSurface())}get outline(){return this.getArgb(this.colors.outline())}get outlineVariant(){return this.getArgb(this.colors.outlineVariant())}get shadow(){return this.getArgb(this.colors.shadow())}get scrim(){return this.getArgb(this.colors.scrim())}get surfaceTint(){return this.getArgb(this.colors.surfaceTint())}get primary(){return this.getArgb(this.colors.primary())}get primaryDim(){const e=this.colors.primaryDim();if(void 0===e)throw new Error("`primaryDim` color is undefined prior to 2025 spec.");return this.getArgb(e)}get onPrimary(){return this.getArgb(this.colors.onPrimary())}get primaryContainer(){return this.getArgb(this.colors.primaryContainer())}get onPrimaryContainer(){return this.getArgb(this.colors.onPrimaryContainer())}get primaryFixed(){return this.getArgb(this.colors.primaryFixed())}get primaryFixedDim(){return this.getArgb(this.colors.primaryFixedDim())}get onPrimaryFixed(){return this.getArgb(this.colors.onPrimaryFixed())}get onPrimaryFixedVariant(){return this.getArgb(this.colors.onPrimaryFixedVariant())}get inversePrimary(){return this.getArgb(this.colors.inversePrimary())}get secondary(){return this.getArgb(this.colors.secondary())}get secondaryDim(){const e=this.colors.secondaryDim();if(void 0===e)throw new Error("`secondaryDim` color is undefined prior to 2025 spec.");return this.getArgb(e)}get onSecondary(){return this.getArgb(this.colors.onSecondary())}get secondaryContainer(){return this.getArgb(this.colors.secondaryContainer())}get onSecondaryContainer(){return this.getArgb(this.colors.onSecondaryContainer())}get secondaryFixed(){return this.getArgb(this.colors.secondaryFixed())}get secondaryFixedDim(){return this.getArgb(this.colors.secondaryFixedDim())}get onSecondaryFixed(){return this.getArgb(this.colors.onSecondaryFixed())}get onSecondaryFixedVariant(){return this.getArgb(this.colors.onSecondaryFixedVariant())}get tertiary(){return this.getArgb(this.colors.tertiary())}get tertiaryDim(){const e=this.colors.tertiaryDim();if(void 0===e)throw new Error("`tertiaryDim` color is undefined prior to 2025 spec.");return this.getArgb(e)}get onTertiary(){return this.getArgb(this.colors.onTertiary())}get tertiaryContainer(){return this.getArgb(this.colors.tertiaryContainer())}get onTertiaryContainer(){return this.getArgb(this.colors.onTertiaryContainer())}get tertiaryFixed(){return this.getArgb(this.colors.tertiaryFixed())}get tertiaryFixedDim(){return this.getArgb(this.colors.tertiaryFixedDim())}get onTertiaryFixed(){return this.getArgb(this.colors.onTertiaryFixed())}get onTertiaryFixedVariant(){return this.getArgb(this.colors.onTertiaryFixedVariant())}get error(){return this.getArgb(this.colors.error())}get errorDim(){const e=this.colors.errorDim();if(void 0===e)throw new Error("`errorDim` color is undefined prior to 2025 spec.");return this.getArgb(e)}get onError(){return this.getArgb(this.colors.onError())}get errorContainer(){return this.getArgb(this.colors.errorContainer())}get onErrorContainer(){return this.getArgb(this.colors.onErrorContainer())}}ie.DEFAULT_SPEC_VERSION="2021",ie.DEFAULT_PLATFORM="phone";class se{getPrimaryPalette(e,t,r,a,n){switch(e){case J.CONTENT:case J.FIDELITY:return q.fromHueAndChroma(t.hue,t.chroma);case J.FRUIT_SALAD:return q.fromHueAndChroma(d(t.hue-50),48);case J.MONOCHROME:return q.fromHueAndChroma(t.hue,0);case J.NEUTRAL:return q.fromHueAndChroma(t.hue,12);case J.RAINBOW:return q.fromHueAndChroma(t.hue,48);case J.TONAL_SPOT:return q.fromHueAndChroma(t.hue,36);case J.EXPRESSIVE:return q.fromHueAndChroma(d(t.hue+240),40);case J.VIBRANT:return q.fromHueAndChroma(t.hue,200);default:throw new Error(`Unsupported variant: ${e}`)}}getSecondaryPalette(e,t,r,a,n){switch(e){case J.CONTENT:case J.FIDELITY:return q.fromHueAndChroma(t.hue,Math.max(t.chroma-32,.5*t.chroma));case J.FRUIT_SALAD:return q.fromHueAndChroma(d(t.hue-50),36);case J.MONOCHROME:return q.fromHueAndChroma(t.hue,0);case J.NEUTRAL:return q.fromHueAndChroma(t.hue,8);case J.RAINBOW:case J.TONAL_SPOT:return q.fromHueAndChroma(t.hue,16);case J.EXPRESSIVE:return q.fromHueAndChroma(ie.getRotatedHue(t,[0,21,51,121,151,191,271,321,360],[45,95,45,20,45,90,45,45,45]),24);case J.VIBRANT:return q.fromHueAndChroma(ie.getRotatedHue(t,[0,41,61,101,131,181,251,301,360],[18,15,10,12,15,18,15,12,12]),24);default:throw new Error(`Unsupported variant: ${e}`)}}getTertiaryPalette(e,t,r,a,n){switch(e){case J.CONTENT:return q.fromHct(N.fixIfDisliked(new X(t).analogous(3,6)[2]));case J.FIDELITY:return q.fromHct(N.fixIfDisliked(new X(t).complement));case J.FRUIT_SALAD:return q.fromHueAndChroma(t.hue,36);case J.MONOCHROME:return q.fromHueAndChroma(t.hue,0);case J.NEUTRAL:return q.fromHueAndChroma(t.hue,16);case J.RAINBOW:case J.TONAL_SPOT:return q.fromHueAndChroma(d(t.hue+60),24);case J.EXPRESSIVE:return q.fromHueAndChroma(ie.getRotatedHue(t,[0,21,51,121,151,191,271,321,360],[120,120,20,45,20,15,20,120,120]),32);case J.VIBRANT:return q.fromHueAndChroma(ie.getRotatedHue(t,[0,41,61,101,131,181,251,301,360],[35,30,20,25,30,35,30,25,25]),32);default:throw new Error(`Unsupported variant: ${e}`)}}getNeutralPalette(e,t,r,a,n){switch(e){case J.CONTENT:case J.FIDELITY:return q.fromHueAndChroma(t.hue,t.chroma/8);case J.FRUIT_SALAD:return q.fromHueAndChroma(t.hue,10);case J.MONOCHROME:return q.fromHueAndChroma(t.hue,0);case J.NEUTRAL:return q.fromHueAndChroma(t.hue,2);case J.RAINBOW:return q.fromHueAndChroma(t.hue,0);case J.TONAL_SPOT:return q.fromHueAndChroma(t.hue,6);case J.EXPRESSIVE:return q.fromHueAndChroma(d(t.hue+15),8);case J.VIBRANT:return q.fromHueAndChroma(t.hue,10);default:throw new Error(`Unsupported variant: ${e}`)}}getNeutralVariantPalette(e,t,r,a,n){switch(e){case J.CONTENT:case J.FIDELITY:return q.fromHueAndChroma(t.hue,t.chroma/8+4);case J.FRUIT_SALAD:return q.fromHueAndChroma(t.hue,16);case J.MONOCHROME:return q.fromHueAndChroma(t.hue,0);case J.NEUTRAL:return q.fromHueAndChroma(t.hue,2);case J.RAINBOW:return q.fromHueAndChroma(t.hue,0);case J.TONAL_SPOT:return q.fromHueAndChroma(t.hue,8);case J.EXPRESSIVE:return q.fromHueAndChroma(d(t.hue+15),12);case J.VIBRANT:return q.fromHueAndChroma(t.hue,12);default:throw new Error(`Unsupported variant: ${e}`)}}getErrorPalette(e,t,r,a,n){}}class ce extends se{getPrimaryPalette(e,t,r,a,n){switch(e){case J.NEUTRAL:return q.fromHueAndChroma(t.hue,"phone"===a?V.isBlue(t.hue)?12:8:V.isBlue(t.hue)?16:12);case J.TONAL_SPOT:return q.fromHueAndChroma(t.hue,"phone"===a&&r?26:32);case J.EXPRESSIVE:return q.fromHueAndChroma(t.hue,"phone"===a?r?36:48:40);case J.VIBRANT:return q.fromHueAndChroma(t.hue,"phone"===a?74:56);default:return super.getPrimaryPalette(e,t,r,a,n)}}getSecondaryPalette(e,t,r,a,n){switch(e){case J.NEUTRAL:return q.fromHueAndChroma(t.hue,"phone"===a?V.isBlue(t.hue)?6:4:V.isBlue(t.hue)?10:6);case J.TONAL_SPOT:return q.fromHueAndChroma(t.hue,16);case J.EXPRESSIVE:return q.fromHueAndChroma(ie.getRotatedHue(t,[0,105,140,204,253,278,300,333,360],[-160,155,-100,96,-96,-156,-165,-160]),"phone"===a&&r?16:24);case J.VIBRANT:return q.fromHueAndChroma(ie.getRotatedHue(t,[0,38,105,140,333,360],[-14,10,-14,10,-14]),"phone"===a?56:36);default:return super.getSecondaryPalette(e,t,r,a,n)}}getTertiaryPalette(e,t,r,a,n){switch(e){case J.NEUTRAL:return q.fromHueAndChroma(ie.getRotatedHue(t,[0,38,105,161,204,278,333,360],[-32,26,10,-39,24,-15,-32]),"phone"===a?20:36);case J.TONAL_SPOT:return q.fromHueAndChroma(ie.getRotatedHue(t,[0,20,71,161,333,360],[-40,48,-32,40,-32]),"phone"===a?28:32);case J.EXPRESSIVE:return q.fromHueAndChroma(ie.getRotatedHue(t,[0,105,140,204,253,278,300,333,360],[-165,160,-105,101,-101,-160,-170,-165]),48);case J.VIBRANT:return q.fromHueAndChroma(ie.getRotatedHue(t,[0,38,71,105,140,161,253,333,360],[-72,35,24,-24,62,50,62,-72]),56);default:return super.getTertiaryPalette(e,t,r,a,n)}}static getExpressiveNeutralHue(e){return ie.getRotatedHue(e,[0,71,124,253,278,300,360],[10,0,10,0,10,0])}static getExpressiveNeutralChroma(e,t,r){const a=ce.getExpressiveNeutralHue(e);return"phone"===r?t?V.isYellow(a)?6:14:18:12}static getVibrantNeutralHue(e){return ie.getRotatedHue(e,[0,38,105,140,333,360],[-14,10,-14,10,-14])}static getVibrantNeutralChroma(e,t){const r=ce.getVibrantNeutralHue(e);return"phone"===t||V.isBlue(r)?28:20}getNeutralPalette(e,t,r,a,n){switch(e){case J.NEUTRAL:return q.fromHueAndChroma(t.hue,"phone"===a?1.4:6);case J.TONAL_SPOT:return q.fromHueAndChroma(t.hue,"phone"===a?5:10);case J.EXPRESSIVE:return q.fromHueAndChroma(ce.getExpressiveNeutralHue(t),ce.getExpressiveNeutralChroma(t,r,a));case J.VIBRANT:return q.fromHueAndChroma(ce.getVibrantNeutralHue(t),ce.getVibrantNeutralChroma(t,a));default:return super.getNeutralPalette(e,t,r,a,n)}}getNeutralVariantPalette(e,t,r,a,n){switch(e){case J.NEUTRAL:return q.fromHueAndChroma(t.hue,2.2*("phone"===a?1.4:6));case J.TONAL_SPOT:return q.fromHueAndChroma(t.hue,1.7*("phone"===a?5:10));case J.EXPRESSIVE:const o=ce.getExpressiveNeutralHue(t),i=ce.getExpressiveNeutralChroma(t,r,a);return q.fromHueAndChroma(o,i*(o>=105&&o<125?1.6:2.3));case J.VIBRANT:const s=ce.getVibrantNeutralHue(t),c=ce.getVibrantNeutralChroma(t,a);return q.fromHueAndChroma(s,1.29*c);default:return super.getNeutralVariantPalette(e,t,r,a,n)}}getErrorPalette(e,t,r,a,n){const o=ie.getPiecewiseHue(t,[0,3,13,23,33,43,153,273,360],[12,22,32,12,22,32,22,12]);switch(e){case J.NEUTRAL:return q.fromHueAndChroma(o,"phone"===a?50:40);case J.TONAL_SPOT:return q.fromHueAndChroma(o,"phone"===a?60:48);case J.EXPRESSIVE:return q.fromHueAndChroma(o,"phone"===a?64:48);case J.VIBRANT:return q.fromHueAndChroma(o,"phone"===a?80:60);default:return super.getErrorPalette(e,t,r,a,n)}}}const ue=new se,he=new ce;function le(e){return"2025"===e?he:ue}
|
|
252
317
|
/**
|
|
253
318
|
* @license
|
|
254
319
|
* Copyright 2021 Google LLC
|
|
@@ -264,7 +329,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
264
329
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
265
330
|
* See the License for the specific language governing permissions and
|
|
266
331
|
* limitations under the License.
|
|
267
|
-
*/class
|
|
332
|
+
*/class me{static of(e){return new me(e,!1)}static contentOf(e){return new me(e,!0)}static fromColors(e){return me.createPaletteFromColors(!1,e)}static contentFromColors(e){return me.createPaletteFromColors(!0,e)}static createPaletteFromColors(e,t){const r=new me(t.primary,e);if(t.secondary){const a=new me(t.secondary,e);r.a2=a.a1}if(t.tertiary){const a=new me(t.tertiary,e);r.a3=a.a1}if(t.error){const a=new me(t.error,e);r.error=a.a1}if(t.neutral){const a=new me(t.neutral,e);r.n1=a.n1}if(t.neutralVariant){const a=new me(t.neutralVariant,e);r.n2=a.n2}return r}constructor(e,t){const r=V.fromInt(e),a=r.hue,n=r.chroma;t?(this.a1=q.fromHueAndChroma(a,n),this.a2=q.fromHueAndChroma(a,n/3),this.a3=q.fromHueAndChroma(a+60,n/2),this.n1=q.fromHueAndChroma(a,Math.min(n/12,4)),this.n2=q.fromHueAndChroma(a,Math.min(n/6,8))):(this.a1=q.fromHueAndChroma(a,Math.max(48,n)),this.a2=q.fromHueAndChroma(a,16),this.a3=q.fromHueAndChroma(a+60,24),this.n1=q.fromHueAndChroma(a,4),this.n2=q.fromHueAndChroma(a,8)),this.error=q.fromHueAndChroma(25,84)}}
|
|
268
333
|
/**
|
|
269
334
|
* @license
|
|
270
335
|
* Copyright 2021 Google LLC
|
|
@@ -280,7 +345,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
280
345
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
281
346
|
* See the License for the specific language governing permissions and
|
|
282
347
|
* limitations under the License.
|
|
283
|
-
*/class
|
|
348
|
+
*/class de{fromInt(e){return A(e)}toInt(e){return function(e,t,r){const a=C,n=(e+16)/116,o=n-r/200,i=B(t/500+n),s=B(n),c=B(o);return T(i*a[0],s*a[1],c*a[2])}(e[0],e[1],e[2])}distance(e,t){const r=e[0]-t[0],a=e[1]-t[1],n=e[2]-t[2];return r*r+a*a+n*n}}
|
|
284
349
|
/**
|
|
285
350
|
* @license
|
|
286
351
|
* Copyright 2021 Google LLC
|
|
@@ -296,7 +361,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
296
361
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
297
362
|
* See the License for the specific language governing permissions and
|
|
298
363
|
* limitations under the License.
|
|
299
|
-
*/class
|
|
364
|
+
*/class fe{static quantize(e,t,r){const a=new Map,n=new Array,o=new Array,i=new de;let s=0;for(let t=0;t<e.length;t++){const r=e[t],c=a.get(r);void 0===c?(s++,n.push(i.fromInt(r)),o.push(r),a.set(r,1)):a.set(r,c+1)}const c=new Array;for(let e=0;e<s;e++){const t=o[e],r=a.get(t);void 0!==r&&(c[e]=r)}let u=Math.min(r,s);t.length>0&&(u=Math.min(u,t.length));const h=new Array;for(let e=0;e<t.length;e++)h.push(i.fromInt(t[e]));const l=u-h.length;if(0===t.length&&l>0)for(let e=0;e<l;e++){const e=100*Math.random(),t=201*Math.random()-100,r=201*Math.random()-100;h.push(new Array(e,t,r))}const m=new Array;for(let e=0;e<s;e++)m.push(Math.floor(Math.random()*u));const d=new Array;for(let e=0;e<u;e++){d.push(new Array);for(let t=0;t<u;t++)d[e].push(0)}const f=new Array;for(let e=0;e<u;e++){f.push(new Array);for(let t=0;t<u;t++)f[e].push(new pe)}const p=new Array;for(let e=0;e<u;e++)p.push(0);for(let e=0;e<10;e++){for(let e=0;e<u;e++){for(let t=e+1;t<u;t++){const r=i.distance(h[e],h[t]);f[t][e].distance=r,f[t][e].index=e,f[e][t].distance=r,f[e][t].index=t}f[e].sort();for(let t=0;t<u;t++)d[e][t]=f[e][t].index}let t=0;for(let e=0;e<s;e++){const r=n[e],a=m[e],o=h[a],s=i.distance(r,o);let c=s,l=-1;for(let e=0;e<u;e++){if(f[a][e].distance>=4*s)continue;const t=i.distance(r,h[e]);t<c&&(c=t,l=e)}if(-1!==l){Math.abs(Math.sqrt(c)-Math.sqrt(s))>3&&(t++,m[e]=l)}}if(0===t&&0!==e)break;const r=new Array(u).fill(0),a=new Array(u).fill(0),o=new Array(u).fill(0);for(let e=0;e<u;e++)p[e]=0;for(let e=0;e<s;e++){const t=m[e],i=n[e],s=c[e];p[t]+=s,r[t]+=i[0]*s,a[t]+=i[1]*s,o[t]+=i[2]*s}for(let e=0;e<u;e++){const t=p[e];if(0===t){h[e]=[0,0,0];continue}const n=r[e]/t,i=a[e]/t,s=o[e]/t;h[e]=[n,i,s]}}const g=new Map;for(let e=0;e<u;e++){const t=p[e];if(0===t)continue;const r=i.toInt(h[e]);g.has(r)||g.set(r,t)}return g}}class pe{constructor(){this.distance=-1,this.index=-1}}
|
|
300
365
|
/**
|
|
301
366
|
* @license
|
|
302
367
|
* Copyright 2021 Google LLC
|
|
@@ -312,7 +377,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
312
377
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
313
378
|
* See the License for the specific language governing permissions and
|
|
314
379
|
* limitations under the License.
|
|
315
|
-
*/class
|
|
380
|
+
*/class ge{static quantize(e){const t=new Map;for(let r=0;r<e.length;r++){const a=e[r];v(a)<255||t.set(a,(t.get(a)??0)+1)}return t}}
|
|
316
381
|
/**
|
|
317
382
|
* @license
|
|
318
383
|
* Copyright 2021 Google LLC
|
|
@@ -328,7 +393,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
328
393
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
329
394
|
* See the License for the specific language governing permissions and
|
|
330
395
|
* limitations under the License.
|
|
331
|
-
*/const
|
|
396
|
+
*/const ye=33,Ce=35937,Pe="red",Se="green",ve="blue";class be{constructor(e=[],t=[],r=[],a=[],n=[],o=[]){this.weights=e,this.momentsR=t,this.momentsG=r,this.momentsB=a,this.moments=n,this.cubes=o}quantize(e,t){this.constructHistogram(e),this.computeMoments();const r=this.createBoxes(t);return this.createResult(r.resultCount)}constructHistogram(e){this.weights=Array.from({length:Ce}).fill(0),this.momentsR=Array.from({length:Ce}).fill(0),this.momentsG=Array.from({length:Ce}).fill(0),this.momentsB=Array.from({length:Ce}).fill(0),this.moments=Array.from({length:Ce}).fill(0);const t=ge.quantize(e);for(const[e,r]of t.entries()){const t=b(e),a=k(e),n=w(e),o=3,i=1+(t>>o),s=1+(a>>o),c=1+(n>>o),u=this.getIndex(i,s,c);this.weights[u]=(this.weights[u]??0)+r,this.momentsR[u]+=r*t,this.momentsG[u]+=r*a,this.momentsB[u]+=r*n,this.moments[u]+=r*(t*t+a*a+n*n)}}computeMoments(){for(let e=1;e<ye;e++){const t=Array.from({length:ye}).fill(0),r=Array.from({length:ye}).fill(0),a=Array.from({length:ye}).fill(0),n=Array.from({length:ye}).fill(0),o=Array.from({length:ye}).fill(0);for(let i=1;i<ye;i++){let s=0,c=0,u=0,h=0,l=0;for(let m=1;m<ye;m++){const d=this.getIndex(e,i,m);s+=this.weights[d],c+=this.momentsR[d],u+=this.momentsG[d],h+=this.momentsB[d],l+=this.moments[d],t[m]+=s,r[m]+=c,a[m]+=u,n[m]+=h,o[m]+=l;const f=this.getIndex(e-1,i,m);this.weights[d]=this.weights[f]+t[m],this.momentsR[d]=this.momentsR[f]+r[m],this.momentsG[d]=this.momentsG[f]+a[m],this.momentsB[d]=this.momentsB[f]+n[m],this.moments[d]=this.moments[f]+o[m]}}}}createBoxes(e){this.cubes=Array.from({length:e}).fill(0).map(()=>new ke);const t=Array.from({length:e}).fill(0);this.cubes[0].r0=0,this.cubes[0].g0=0,this.cubes[0].b0=0,this.cubes[0].r1=32,this.cubes[0].g1=32,this.cubes[0].b1=32;let r=e,a=0;for(let n=1;n<e;n++){this.cut(this.cubes[a],this.cubes[n])?(t[a]=this.cubes[a].vol>1?this.variance(this.cubes[a]):0,t[n]=this.cubes[n].vol>1?this.variance(this.cubes[n]):0):(t[a]=0,n--),a=0;let e=t[0];for(let r=1;r<=n;r++)t[r]>e&&(e=t[r],a=r);if(e<=0){r=n+1;break}}return new we(e,r)}createResult(e){const t=[];for(let r=0;r<e;++r){const e=this.cubes[r],a=this.volume(e,this.weights);if(a>0){const r=255<<24|(255&Math.round(this.volume(e,this.momentsR)/a))<<16|(255&Math.round(this.volume(e,this.momentsG)/a))<<8|255&Math.round(this.volume(e,this.momentsB)/a);t.push(r)}}return t}variance(e){const t=this.volume(e,this.momentsR),r=this.volume(e,this.momentsG),a=this.volume(e,this.momentsB);return this.moments[this.getIndex(e.r1,e.g1,e.b1)]-this.moments[this.getIndex(e.r1,e.g1,e.b0)]-this.moments[this.getIndex(e.r1,e.g0,e.b1)]+this.moments[this.getIndex(e.r1,e.g0,e.b0)]-this.moments[this.getIndex(e.r0,e.g1,e.b1)]+this.moments[this.getIndex(e.r0,e.g1,e.b0)]+this.moments[this.getIndex(e.r0,e.g0,e.b1)]-this.moments[this.getIndex(e.r0,e.g0,e.b0)]-(t*t+r*r+a*a)/this.volume(e,this.weights)}cut(e,t){const r=this.volume(e,this.momentsR),a=this.volume(e,this.momentsG),n=this.volume(e,this.momentsB),o=this.volume(e,this.weights),i=this.maximize(e,Pe,e.r0+1,e.r1,r,a,n,o),s=this.maximize(e,Se,e.g0+1,e.g1,r,a,n,o),c=this.maximize(e,ve,e.b0+1,e.b1,r,a,n,o);let u;const h=i.maximum,l=s.maximum,m=c.maximum;if(h>=l&&h>=m){if(i.cutLocation<0)return!1;u=Pe}else u=l>=h&&l>=m?Se:ve;switch(t.r1=e.r1,t.g1=e.g1,t.b1=e.b1,u){case Pe:e.r1=i.cutLocation,t.r0=e.r1,t.g0=e.g0,t.b0=e.b0;break;case Se:e.g1=s.cutLocation,t.r0=e.r0,t.g0=e.g1,t.b0=e.b0;break;case ve:e.b1=c.cutLocation,t.r0=e.r0,t.g0=e.g0,t.b0=e.b1;break;default:throw new Error("unexpected direction "+u)}return e.vol=(e.r1-e.r0)*(e.g1-e.g0)*(e.b1-e.b0),t.vol=(t.r1-t.r0)*(t.g1-t.g0)*(t.b1-t.b0),!0}maximize(e,t,r,a,n,o,i,s){const c=this.bottom(e,t,this.momentsR),u=this.bottom(e,t,this.momentsG),h=this.bottom(e,t,this.momentsB),l=this.bottom(e,t,this.weights);let m=0,d=-1,f=0,p=0,g=0,y=0;for(let C=r;C<a;C++){if(f=c+this.top(e,t,C,this.momentsR),p=u+this.top(e,t,C,this.momentsG),g=h+this.top(e,t,C,this.momentsB),y=l+this.top(e,t,C,this.weights),0===y)continue;let r=1*(f*f+p*p+g*g),a=1*y,P=r/a;f=n-f,p=o-p,g=i-g,y=s-y,0!==y&&(r=1*(f*f+p*p+g*g),a=1*y,P+=r/a,P>m&&(m=P,d=C))}return new Te(d,m)}volume(e,t){return t[this.getIndex(e.r1,e.g1,e.b1)]-t[this.getIndex(e.r1,e.g1,e.b0)]-t[this.getIndex(e.r1,e.g0,e.b1)]+t[this.getIndex(e.r1,e.g0,e.b0)]-t[this.getIndex(e.r0,e.g1,e.b1)]+t[this.getIndex(e.r0,e.g1,e.b0)]+t[this.getIndex(e.r0,e.g0,e.b1)]-t[this.getIndex(e.r0,e.g0,e.b0)]}bottom(e,t,r){switch(t){case Pe:return-r[this.getIndex(e.r0,e.g1,e.b1)]+r[this.getIndex(e.r0,e.g1,e.b0)]+r[this.getIndex(e.r0,e.g0,e.b1)]-r[this.getIndex(e.r0,e.g0,e.b0)];case Se:return-r[this.getIndex(e.r1,e.g0,e.b1)]+r[this.getIndex(e.r1,e.g0,e.b0)]+r[this.getIndex(e.r0,e.g0,e.b1)]-r[this.getIndex(e.r0,e.g0,e.b0)];case ve:return-r[this.getIndex(e.r1,e.g1,e.b0)]+r[this.getIndex(e.r1,e.g0,e.b0)]+r[this.getIndex(e.r0,e.g1,e.b0)]-r[this.getIndex(e.r0,e.g0,e.b0)];default:throw new Error("unexpected direction $direction")}}top(e,t,r,a){switch(t){case Pe:return a[this.getIndex(r,e.g1,e.b1)]-a[this.getIndex(r,e.g1,e.b0)]-a[this.getIndex(r,e.g0,e.b1)]+a[this.getIndex(r,e.g0,e.b0)];case Se:return a[this.getIndex(e.r1,r,e.b1)]-a[this.getIndex(e.r1,r,e.b0)]-a[this.getIndex(e.r0,r,e.b1)]+a[this.getIndex(e.r0,r,e.b0)];case ve:return a[this.getIndex(e.r1,e.g1,r)]-a[this.getIndex(e.r1,e.g0,r)]-a[this.getIndex(e.r0,e.g1,r)]+a[this.getIndex(e.r0,e.g0,r)];default:throw new Error("unexpected direction $direction")}}getIndex(e,t,r){return(e<<10)+(e<<6)+e+(t<<5)+t+r}}class ke{constructor(e=0,t=0,r=0,a=0,n=0,o=0,i=0){this.r0=e,this.r1=t,this.g0=r,this.g1=a,this.b0=n,this.b1=o,this.vol=i}}class we{constructor(e,t){this.requestedCount=e,this.resultCount=t}}class Te{constructor(e,t){this.cutLocation=e,this.maximum=t}}
|
|
332
397
|
/**
|
|
333
398
|
* @license
|
|
334
399
|
* Copyright 2021 Google LLC
|
|
@@ -344,10 +409,10 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
344
409
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
345
410
|
* See the License for the specific language governing permissions and
|
|
346
411
|
* limitations under the License.
|
|
347
|
-
*/class
|
|
412
|
+
*/class Ae{static quantize(e,t){const r=(new be).quantize(e,t);return fe.quantize(e,r,t)}}
|
|
348
413
|
/**
|
|
349
414
|
* @license
|
|
350
|
-
* Copyright
|
|
415
|
+
* Copyright 2021 Google LLC
|
|
351
416
|
*
|
|
352
417
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
353
418
|
* you may not use this file except in compliance with the License.
|
|
@@ -360,10 +425,10 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
360
425
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
361
426
|
* See the License for the specific language governing permissions and
|
|
362
427
|
* limitations under the License.
|
|
363
|
-
*/class
|
|
428
|
+
*/class De{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(e){return De.lightFromCorePalette(me.of(e))}static dark(e){return De.darkFromCorePalette(me.of(e))}static lightContent(e){return De.lightFromCorePalette(me.contentOf(e))}static darkContent(e){return De.darkFromCorePalette(me.contentOf(e))}static lightFromCorePalette(e){return new De({primary:e.a1.tone(40),onPrimary:e.a1.tone(100),primaryContainer:e.a1.tone(90),onPrimaryContainer:e.a1.tone(10),secondary:e.a2.tone(40),onSecondary:e.a2.tone(100),secondaryContainer:e.a2.tone(90),onSecondaryContainer:e.a2.tone(10),tertiary:e.a3.tone(40),onTertiary:e.a3.tone(100),tertiaryContainer:e.a3.tone(90),onTertiaryContainer:e.a3.tone(10),error:e.error.tone(40),onError:e.error.tone(100),errorContainer:e.error.tone(90),onErrorContainer:e.error.tone(10),background:e.n1.tone(99),onBackground:e.n1.tone(10),surface:e.n1.tone(99),onSurface:e.n1.tone(10),surfaceVariant:e.n2.tone(90),onSurfaceVariant:e.n2.tone(30),outline:e.n2.tone(50),outlineVariant:e.n2.tone(80),shadow:e.n1.tone(0),scrim:e.n1.tone(0),inverseSurface:e.n1.tone(20),inverseOnSurface:e.n1.tone(95),inversePrimary:e.a1.tone(80)})}static darkFromCorePalette(e){return new De({primary:e.a1.tone(80),onPrimary:e.a1.tone(20),primaryContainer:e.a1.tone(30),onPrimaryContainer:e.a1.tone(90),secondary:e.a2.tone(80),onSecondary:e.a2.tone(20),secondaryContainer:e.a2.tone(30),onSecondaryContainer:e.a2.tone(90),tertiary:e.a3.tone(80),onTertiary:e.a3.tone(20),tertiaryContainer:e.a3.tone(30),onTertiaryContainer:e.a3.tone(90),error:e.error.tone(80),onError:e.error.tone(20),errorContainer:e.error.tone(30),onErrorContainer:e.error.tone(80),background:e.n1.tone(10),onBackground:e.n1.tone(90),surface:e.n1.tone(10),onSurface:e.n1.tone(90),surfaceVariant:e.n2.tone(30),onSurfaceVariant:e.n2.tone(80),outline:e.n2.tone(60),outlineVariant:e.n2.tone(30),shadow:e.n1.tone(0),scrim:e.n1.tone(0),inverseSurface:e.n1.tone(90),inverseOnSurface:e.n1.tone(20),inversePrimary:e.a1.tone(40)})}constructor(e){this.props=e}toJSON(){return{...this.props}}}
|
|
364
429
|
/**
|
|
365
430
|
* @license
|
|
366
|
-
* Copyright
|
|
431
|
+
* Copyright 2021 Google LLC
|
|
367
432
|
*
|
|
368
433
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
369
434
|
* you may not use this file except in compliance with the License.
|
|
@@ -376,8 +441,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
376
441
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
377
442
|
* See the License for the specific language governing permissions and
|
|
378
443
|
* limitations under the License.
|
|
379
|
-
*/
|
|
380
|
-
class ut extends K{constructor(t,e,r){super({sourceColorArgb:t.toInt(),variant:G.VIBRANT,contrastLevel:r,isDark:e,primaryPalette:V.fromHueAndChroma(t.hue,200),secondaryPalette:V.fromHueAndChroma(K.getRotatedHue(t,ut.hues,ut.secondaryRotations),24),tertiaryPalette:V.fromHueAndChroma(K.getRotatedHue(t,ut.hues,ut.tertiaryRotations),32),neutralPalette:V.fromHueAndChroma(t.hue,10),neutralVariantPalette:V.fromHueAndChroma(t.hue,12)})}}ut.hues=[0,41,61,101,131,181,251,301,360],ut.secondaryRotations=[18,15,10,12,15,18,15,12,12],ut.tertiaryRotations=[35,30,20,25,30,35,30,25,25];
|
|
444
|
+
*/const xe={desired:4,fallbackColorARGB:4282549748,filter:!0};function Me(e,t){return e.score>t.score?-1:e.score<t.score?1:0}class Ie{constructor(){}static score(e,t){const{desired:r,fallbackColorARGB:a,filter:n}={...xe,...t},o=[],i=new Array(360).fill(0);let s=0;for(const[t,r]of e.entries()){const e=V.fromInt(t);o.push(e);i[Math.floor(e.hue)]+=r,s+=r}const c=new Array(360).fill(0);for(let e=0;e<360;e++){const t=i[e]/s;for(let r=e-14;r<e+16;r++){c[m(r)]+=t}}const u=new Array;for(const e of o){const t=c[m(Math.round(e.hue))];if(n&&(e.chroma<Ie.CUTOFF_CHROMA||t<=Ie.CUTOFF_EXCITED_PROPORTION))continue;const r=100*t*Ie.WEIGHT_PROPORTION,a=e.chroma<Ie.TARGET_CHROMA?Ie.WEIGHT_CHROMA_BELOW:Ie.WEIGHT_CHROMA_ABOVE,o=r+(e.chroma-Ie.TARGET_CHROMA)*a;u.push({hct:e,score:o})}u.sort(Me);const h=[];for(let e=90;e>=15;e--){h.length=0;for(const{hct:t}of u){if(h.find(r=>f(t.hue,r.hue)<e)||h.push(t),h.length>=r)break}if(h.length>=r)break}const l=[];0===h.length&&l.push(a);for(const e of h)l.push(e.toInt());return l}}
|
|
381
445
|
/**
|
|
382
446
|
* @license
|
|
383
447
|
* Copyright 2021 Google LLC
|
|
@@ -394,7 +458,7 @@ class ut extends K{constructor(t,e,r){super({sourceColorArgb:t.toInt(),variant:G
|
|
|
394
458
|
* See the License for the specific language governing permissions and
|
|
395
459
|
* limitations under the License.
|
|
396
460
|
*/
|
|
397
|
-
|
|
461
|
+
function Ee(e){const t=b(e),r=k(e),a=w(e),n=[t.toString(16),r.toString(16),a.toString(16)];for(const[e,t]of n.entries())1===t.length&&(n[e]="0"+t);return"#"+n.join("")}function _e(e){return parseInt(e,16)}
|
|
398
462
|
/**
|
|
399
463
|
* @license
|
|
400
464
|
* Copyright 2021 Google LLC
|
|
@@ -410,8 +474,7 @@ const lt={desired:4,fallbackColorARGB:4282549748,filter:!0};function mt(t,e){ret
|
|
|
410
474
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
411
475
|
* See the License for the specific language governing permissions and
|
|
412
476
|
* limitations under the License.
|
|
413
|
-
*/
|
|
414
|
-
function gt(t){const e=P(t),r=M(t),n=k(t),a=[e.toString(16),r.toString(16),n.toString(16)];for(const[t,e]of a.entries())1===e.length&&(a[t]="0"+e);return"#"+a.join("")}function ft(t){return parseInt(t,16)}
|
|
477
|
+
*/async function Be(e){return function(e){const t=[];for(let r=0;r<e.length;r+=4){const a=e[r],n=e[r+1],o=e[r+2];if(e[r+3]<255)continue;const i=P(a,n,o);t.push(i)}const r=Ae.quantize(t,128),a=Ie.score(r);return a[0]}
|
|
415
478
|
/**
|
|
416
479
|
* @license
|
|
417
480
|
* Copyright 2021 Google LLC
|
|
@@ -427,5 +490,5 @@ function gt(t){const e=P(t),r=M(t),n=k(t),a=[e.toString(16),r.toString(16),n.toS
|
|
|
427
490
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
428
491
|
* See the License for the specific language governing permissions and
|
|
429
492
|
* limitations under the License.
|
|
430
|
-
*/
|
|
493
|
+
*/(await new Promise((t,r)=>{const a=document.createElement("canvas"),n=a.getContext("2d");if(!n)return void r(new Error("Could not get canvas context"));const o=()=>{a.width=e.width,a.height=e.height,n.drawImage(e,0,0);let r=[0,0,e.width,e.height];const o=e.dataset.area;o&&/^\d+(\s*,\s*\d+){3}$/.test(o)&&(r=o.split(/\s*,\s*/).map(e=>parseInt(e,10)));const[i,s,c,u]=r;t(n.getImageData(i,s,c,u).data)},i=()=>{r(new Error("Image load failed"))};e.complete?o():(e.onload=o,e.onerror=i)}))}function Fe(e,t=[]){const r=me.of(e);return{source:e,schemes:{light:De.light(e),dark:De.dark(e)},palettes:{primary:r.a1,secondary:r.a2,tertiary:r.a3,neutral:r.n1,neutralVariant:r.n2,error:r.error},customColors:t.map(t=>function(e,t){let r=t.value;const a=r,n=e;t.blend&&(r=L.harmonize(a,n));const o=me.of(r),i=o.a1;return{color:t,value:r,light:{color:i.tone(40),onColor:i.tone(100),colorContainer:i.tone(90),onColorContainer:i.tone(10)},dark:{color:i.tone(80),onColor:i.tone(20),colorContainer:i.tone(30),onColorContainer:i.tone(90)}}}(e,t))}}async function He(e){return Ee(await Be(e))}var Re,Ve,Le,Oe,Ne,Ue,ze,$e,Ke;Ie.TARGET_CHROMA=48,Ie.WEIGHT_PROPORTION=.7,Ie.WEIGHT_CHROMA_ABOVE=.3,Ie.WEIGHT_CHROMA_BELOW=.1,Ie.CUTOFF_CHROMA=5,Ie.CUTOFF_EXCITED_PROPORTION=.01;let Ye=class extends n{constructor(){super(...arguments),Re.add(this),Ve.set(this,new CSSStyleSheet),Le.set(this,!1),Oe.set(this,void 0),Ne.set(this,void 0),Ue.set(this,void 0),ze.set(this,()=>t(this,Re,"m",$e).call(this,!0)),this.color="#6750A4",this.scheme="auto",this.contrast="standard",this.strongFocus=!1,this.density=0,this.motion="standard"}get isDark(){switch(this.scheme){case"light":return!1;case"dark":return!0;default:if(this.parentElement instanceof HTMLBodyElement)switch(document.documentElement.style.colorScheme){case"light":return!1;case"dark":return!0}return t(this,Ne,"f")?.matches??!1}}connectedCallback(){super.connectedCallback(),this.parentElement instanceof HTMLBodyElement?(this.shadowRoot?.adoptedStyleSheets.includes(t(this,Ve,"f"))&&(this.shadowRoot.adoptedStyleSheets=this.shadowRoot.adoptedStyleSheets.filter(e=>e!==t(this,Ve,"f"))),document.adoptedStyleSheets.includes(t(this,Ve,"f"))||(document.adoptedStyleSheets=[t(this,Ve,"f"),...document.adoptedStyleSheets])):(document.adoptedStyleSheets.includes(t(this,Ve,"f"))&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==t(this,Ve,"f"))),this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(t(this,Ve,"f"))&&(this.shadowRoot.adoptedStyleSheets=[t(this,Ve,"f"),...this.shadowRoot.adoptedStyleSheets])),r(this,Oe,matchMedia("(prefers-color-scheme: light)"),"f"),r(this,Ne,matchMedia("(prefers-color-scheme: dark)"),"f"),r(this,Ue,matchMedia("(forced-colors: active)"),"f"),[t(this,Oe,"f"),t(this,Ne,"f"),t(this,Ue,"f")].forEach(e=>e.addEventListener("change",t(this,ze,"f")))}disconnectedCallback(){super.disconnectedCallback(),[t(this,Oe,"f"),t(this,Ne,"f"),t(this,Ue,"f")].forEach(e=>e?.removeEventListener("change",t(this,ze,"f"))),r(this,Oe,r(this,Ne,r(this,Ue,void 0,"f"),"f"),"f"),document.adoptedStyleSheets.includes(t(this,Ve,"f"))&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==t(this,Ve,"f")))}updated(e){super.updated(e),t(this,Re,"m",$e).call(this,t(this,Le,"f")&&["color","scheme","contrast"].some(t=>e.has(t)))}firstUpdated(e){super.firstUpdated(e),r(this,Le,!0,"f")}render(){return o`<slot></slot>`}};Ve=new WeakMap,Le=new WeakMap,Oe=new WeakMap,Ne=new WeakMap,Ue=new WeakMap,ze=new WeakMap,Re=new WeakSet,$e=function(e){const r=function(e){const t=3===(e=e.replace("#","")).length,r=6===e.length,a=8===e.length;if(!t&&!r&&!a)throw new Error("unexpected hex "+e);let n=0,o=0,i=0;return t?(n=_e(e.slice(0,1).repeat(2)),o=_e(e.slice(1,2).repeat(2)),i=_e(e.slice(2,3).repeat(2))):r?(n=_e(e.slice(0,2)),o=_e(e.slice(2,4)),i=_e(e.slice(4,6))):a&&(n=_e(e.slice(2,4)),o=_e(e.slice(4,6)),i=_e(e.slice(6,8))),(255<<24|(255&n)<<16|(255&o)<<8|255&i)>>>0}(this.color),a=Fe(r),n=new ie({sourceColorHct:V.fromInt(r),variant:1,contrastLevel:t(this,Re,"m",Ke).call(this),isDark:this.isDark,primaryPalette:a.palettes.primary,secondaryPalette:a.palettes.secondary,tertiaryPalette:a.palettes.tertiary,neutralPalette:a.palettes.neutral,neutralVariantPalette:a.palettes.neutralVariant,errorPalette:a.palettes.error});let o="";const i=new oe,s=[...i.allColors,i.surfaceVariant(),i.shadow(),i.scrim(),i.surfaceTint()];for(const e of s){o+=`${`--md-sys-color-${e.name.replace(/_/g,"-").toLowerCase()}`}: ${Ee(e.getArgb(n))};`}if("expressive"===this.motion&&(o+="--md-sys-motion-spring-fast-spatial: 350ms cubic-bezier(0.42, 1.67, 0.21, 0.90);",o+="--md-sys-motion-spring-default-spatial: 500ms cubic-bezier(0.38, 1.21, 0.22, 1.00);",o+="--md-sys-motion-spring-slow-spatial: 650ms cubic-bezier(0.39, 1.29, 0.35, 0.98);",o+="--md-sys-motion-spring-fast-effects: 150ms cubic-bezier(0.31, 0.94, 0.34, 1.00);",o+="--md-sys-motion-spring-default-effects: 200ms cubic-bezier(0.34, 0.80, 0.34, 1.00);",o+="--md-sys-motion-spring-slow-effects: 300ms cubic-bezier(0.34, 0.88, 0.34, 1.00);"),o+=`--md-sys-density-scale: ${this.density};`,o+=`--m3e-scrollbar-thumb-color: ${Ee(n.neutralPalette.tone(60))};`,o+=`--m3e-focus-ring-visibility: ${this.strongFocus?"visible":"hidden"};`,o+=`font-size: ${c.typescale.standard.body.large.fontSize};`,o+=`font-weight: ${c.typescale.standard.body.large.fontWeight};`,o+=`line-height: ${c.typescale.standard.body.large.lineHeight};`,o+=`letter-spacing: ${c.typescale.standard.body.large.tracking};`,this.parentElement instanceof HTMLBodyElement)switch(t(this,Ve,"f").replaceSync(`\n html { ${o} }\n @media not (forced-colors: active) {\n body { \n background-color: var(--md-sys-color-background);\n color: var(--md-sys-color-on-background);\n scrollbar-color: ${c.scrollbar.color};\n }\n }`),this.scheme){case"light":document.documentElement.style.colorScheme="light";break;case"dark":document.documentElement.style.colorScheme="dark";break;default:switch(document.documentElement.style.colorScheme){case"light":case"dark":document.documentElement.style.colorScheme="light dark"}}else t(this,Ve,"f").replaceSync(`:host { ${o} }`);t(this,Le,"f")&&this.dispatchEvent(new Event("change",{bubbles:!0})),e&&document.body.offsetHeight},Ke=function(){switch(this.contrast){case"high":return 1;case"medium":return.5;default:return 0}},Ye.styles=a`:host { display: contents; }`,e([i()],Ye.prototype,"color",void 0),e([i()],Ye.prototype,"scheme",void 0),e([i()],Ye.prototype,"contrast",void 0),e([i({attribute:"strong-focus",type:Boolean})],Ye.prototype,"strongFocus",void 0),e([i({type:Number})],Ye.prototype,"density",void 0),e([i()],Ye.prototype,"motion",void 0),Ye=e([s("m3e-theme")],Ye);export{Ye as M3eThemeElement,He as getColorFromImage};
|
|
431
494
|
//# sourceMappingURL=theme.min.js.map
|