@m3e/web 2.5.10 → 2.5.12
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 +371 -125
- package/dist/all.js.map +1 -1
- package/dist/all.min.js +56 -56
- package/dist/all.min.js.map +1 -1
- package/dist/autocomplete.js +23 -5
- package/dist/autocomplete.js.map +1 -1
- package/dist/autocomplete.min.js +1 -1
- package/dist/autocomplete.min.js.map +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/breadcrumb.js.map +1 -1
- package/dist/breadcrumb.min.js +1 -1
- package/dist/breadcrumb.min.js.map +1 -1
- package/dist/button.js +13 -7
- package/dist/button.js.map +1 -1
- package/dist/button.min.js +1 -1
- package/dist/button.min.js.map +1 -1
- package/dist/checkbox.js +5 -0
- package/dist/checkbox.js.map +1 -1
- package/dist/checkbox.min.js +1 -1
- package/dist/checkbox.min.js.map +1 -1
- package/dist/chips.js +2 -2
- package/dist/chips.js.map +1 -1
- package/dist/chips.min.js +1 -1
- package/dist/chips.min.js.map +1 -1
- package/dist/core.js +27 -23
- 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 +5263 -5233
- package/dist/custom-elements.json +51230 -50306
- package/dist/fab.js +9 -9
- package/dist/fab.js.map +1 -1
- package/dist/fab.min.js +1 -1
- package/dist/fab.min.js.map +1 -1
- package/dist/form-field.js +4 -5
- package/dist/form-field.js.map +1 -1
- package/dist/form-field.min.js +2 -2
- package/dist/form-field.min.js.map +1 -1
- package/dist/html-custom-data.json +1693 -1666
- package/dist/icon-button.js +48 -42
- package/dist/icon-button.js.map +1 -1
- package/dist/icon-button.min.js +1 -1
- package/dist/icon-button.min.js.map +1 -1
- package/dist/menu.js +2 -2
- package/dist/menu.js.map +1 -1
- package/dist/menu.min.js +1 -1
- package/dist/menu.min.js.map +1 -1
- package/dist/option.js +13 -3
- package/dist/option.js.map +1 -1
- package/dist/option.min.js +1 -1
- package/dist/option.min.js.map +1 -1
- package/dist/paginator.js +1 -1
- package/dist/paginator.js.map +1 -1
- package/dist/paginator.min.js +2 -2
- package/dist/paginator.min.js.map +1 -1
- package/dist/radio-group.js +6 -1
- package/dist/radio-group.js.map +1 -1
- package/dist/radio-group.min.js +1 -1
- package/dist/radio-group.min.js.map +1 -1
- package/dist/select.js +18 -2
- package/dist/select.js.map +1 -1
- package/dist/select.min.js +1 -1
- package/dist/select.min.js.map +1 -1
- package/dist/split-button.js +1 -1
- package/dist/split-button.js.map +1 -1
- package/dist/split-button.min.js +1 -1
- package/dist/split-button.min.js.map +1 -1
- package/dist/src/autocomplete/AutocompleteElement.d.ts.map +1 -1
- package/dist/src/button/ButtonElement.d.ts +1 -0
- package/dist/src/button/ButtonElement.d.ts.map +1 -1
- package/dist/src/checkbox/CheckboxElement.d.ts.map +1 -1
- package/dist/src/core/shared/mixins/LinkButton.d.ts.map +1 -1
- package/dist/src/core/shared/tokens/DesignToken.d.ts +3 -0
- package/dist/src/core/shared/tokens/DesignToken.d.ts.map +1 -1
- package/dist/src/core/shared/tokens/MeasurementToken.d.ts +13 -7
- package/dist/src/core/shared/tokens/MeasurementToken.d.ts.map +1 -1
- package/dist/src/fab/styles/FabSizeToken.d.ts.map +1 -1
- package/dist/src/form-field/FormFieldElement.d.ts.map +1 -1
- package/dist/src/icon-button/IconButtonElement.d.ts +1 -0
- package/dist/src/icon-button/IconButtonElement.d.ts.map +1 -1
- package/dist/src/icon-button/styles/IconButtonSizeToken.d.ts.map +1 -1
- package/dist/src/menu/MenuElement.d.ts.map +1 -1
- package/dist/src/menu/MenuItemElementBase.d.ts.map +1 -1
- package/dist/src/option/OptionElement.d.ts.map +1 -1
- package/dist/src/option/OptionPanelElement.d.ts.map +1 -1
- package/dist/src/paginator/PaginatorElement.d.ts.map +1 -1
- package/dist/src/radio-group/RadioElement.d.ts.map +1 -1
- package/dist/src/select/SelectElement.d.ts.map +1 -1
- package/dist/src/split-button/SplitButtonElement.d.ts.map +1 -1
- package/dist/src/switch/SwitchElement.d.ts.map +1 -1
- package/dist/src/switch/styles/SwitchToken.d.ts.map +1 -1
- package/dist/src/theme/ThemeElement.d.ts +6 -0
- package/dist/src/theme/ThemeElement.d.ts.map +1 -1
- package/dist/src/theme/ThemeIconElement.d.ts +60 -0
- package/dist/src/theme/ThemeIconElement.d.ts.map +1 -0
- package/dist/src/theme/ThemeVariant.d.ts +3 -0
- package/dist/src/theme/ThemeVariant.d.ts.map +1 -0
- package/dist/src/theme/index.d.ts +2 -0
- package/dist/src/theme/index.d.ts.map +1 -1
- package/dist/switch.js +16 -11
- package/dist/switch.js.map +1 -1
- package/dist/switch.min.js +1 -1
- package/dist/switch.min.js.map +1 -1
- package/dist/theme.js +184 -11
- package/dist/theme.js.map +1 -1
- package/dist/theme.min.js +31 -31
- package/dist/theme.min.js.map +1 -1
- package/package.json +1 -1
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 e,__classPrivateFieldGet as t,__classPrivateFieldSet as r}from"tslib";import{unsafeCSS as a,css as n,LitElement as o,html as i}from"lit";import{property as s}from"lit/decorators.js";import{DesignToken as c,registerStyleSheet as u,customElement as h}from"@m3e/web/core";
|
|
6
|
+
import{__decorate as e,__classPrivateFieldGet as t,__classPrivateFieldSet as r}from"tslib";import{unsafeCSS as a,css as n,LitElement as o,html as i}from"lit";import{property as s}from"lit/decorators.js";import{DesignToken as c,registerStyleSheet as u,customElement as h,Role as l}from"@m3e/web/core";
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2021 Google LLC
|
|
@@ -20,7 +20,7 @@ import{__decorate as e,__classPrivateFieldGet as t,__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 m(e){return e<0?-1:0===e?0:1}function d(e,t,r){return(1-r)*e+r*t}function f(e,t,r){return r<e?e:r>t?t:r}function p(e){return(e%=360)<0&&(e+=360),e}function g(e){return(e%=360)<0&&(e+=360),e}function y(e,t){return 180-Math.abs(Math.abs(e-t)-180)}function C(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 l(e){return e<0?-1:0===e?0:1}function m(e,t,r){return(1-r)*e+r*t}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 P=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],v=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],S=[95.047,100,108.883];function b(e,t,r){return(255<<24|(255&e)<<16|(255&t)<<8|255&r)>>>0}function k(e){return b(F(e[0]),F(e[1]),F(e[2]))}function w(e){return e>>24&255}function T(e){return e>>16&255}function A(e){return e>>8&255}function x(e){return 255&e}function D(e,t,r){const a=v,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 b(F(n),F(o),F(i))}function M(e){const t=B(T(e)),r=B(A(e)),a=B(x(e)),n=P,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/S[1],u=s/S[2],h=H(o/S[0]),l=H(c);return[116*l-16,500*(h-l),200*(l-H(u))]}function E(e){const t=function(e){return C([B(T(e)),B(A(e)),B(x(e))],P)}(e)[1];return 116*H(t/100)-16}function I(e){return 100*R((e+16)/116)}function _(e){return 116*H(e/100)-16}function B(e){const t=e/255;return t<=.040449936?t/12.92*100:100*Math.pow((t+.055)/1.055,2.4)}function F(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 H(e){const t=24389/27;return e>216/24389?Math.pow(e,1/3):(t*e+16)/116}function R(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 l(e){return e<0?-1:0===e?0:1}function m(e,t,r){return(1-r)*e+r*t}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 V{static make(e=function(){return S}(),t=200/Math.PI*I(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,h=u>=.9?d(.59,.69,10*(u-.9)):d(.525,.59,10*(u-.8));let l=n?1:u*(1-1/3.6*Math.exp((-t-42)/92));l=l>1?1:l<0?0:l;const m=u,f=[l*(100/i)+1-l,l*(100/s)+1-l,l*(100/c)+1-l],p=1/(5*t+1),g=p*p*p*p,y=1-g,C=g*t+.1*y*y*Math.cbrt(5*t),P=I(r)/e[1],v=1.48+Math.sqrt(P),b=.725/Math.pow(P,.2),k=b,w=[Math.pow(C*f[0]*i/100,.42),Math.pow(C*f[1]*s/100,.42),Math.pow(C*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 V(P,(2*T[0]+T[1]+.05*T[2])*b,b,k,h,m,f,C,Math.pow(C,.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}}V.DEFAULT=V.make();
|
|
56
56
|
/**
|
|
57
57
|
* @license
|
|
58
58
|
* Copyright 2021 Google LLC
|
|
@@ -69,7 +69,7 @@ function l(e){return e<0?-1:0===e?0:1}function m(e,t,r){return(1-r)*e+r*t}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 L{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 L.fromIntInViewingConditions(e,V.DEFAULT)}static fromIntInViewingConditions(e,t){const r=(65280&e)>>8,a=255&e,n=B((16711680&e)>>16),o=B(r),i=B(a),s=.41233895*n+.35762064*o+.18051042*i,c=.2126*n+.7152*o+.0722*i,u=.01932141*n+.11916382*o+.95034478*i,h=.401288*s+.650173*c-.051461*u,l=-.250268*s+1.204414*c+.045854*u,d=-.002079*s+.048952*c+.953127*u,f=t.rgbD[0]*h,p=t.rgbD[1]*l,y=t.rgbD[2]*d,C=Math.pow(t.fl*Math.abs(f)/100,.42),P=Math.pow(t.fl*Math.abs(p)/100,.42),v=Math.pow(t.fl*Math.abs(y)/100,.42),S=400*m(f)*C/(C+27.13),b=400*m(p)*P/(P+27.13),k=400*m(y)*v/(v+27.13),w=(11*S+-12*b+k)/11,T=(S+b-2*k)/9,A=(20*S+20*b+21*k)/20,x=(40*S+20*b+k)/20,D=g(180*Math.atan2(T,w)/Math.PI),M=D*Math.PI/180,E=x*t.nbb,I=100*Math.pow(E/t.aw,t.c*t.z),_=4/t.c*Math.sqrt(I/100)*(t.aw+4)*t.fLRoot,F=D<20.14?D+360:D,H=5e4/13*(.25*(Math.cos(F*Math.PI/180+2)+3.8))*t.nc*t.ncb*Math.sqrt(w*w+T*T)/(A+.305),R=Math.pow(H,.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),V=R*Math.sqrt(I/100),O=V*t.fLRoot,N=50*Math.sqrt(R*t.c/(t.aw+4)),U=(1+100*.007)*I/(1+.007*I),z=1/.0228*Math.log(1+.0228*O),$=z*Math.cos(M),K=z*Math.sin(M);return new L(D,V,I,_,O,N,U,$,K)}static fromJch(e,t,r){return L.fromJchInViewingConditions(e,t,r,V.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 L(r,t,e,n,o,s,u,l,m)}static fromUcs(e,t,r){return L.fromUcsInViewingConditions(e,t,r,V.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 L.fromJchInViewingConditions(u,s,c,a)}toInt(){return this.viewed(V.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),u=Math.cos(a),h=23*(s+.305)*r/(23*i+11*r*u+108*r*c),l=h*u,d=h*c,f=(460*s+451*l+288*d)/1403,p=(460*s-891*l-261*d)/1403,g=(460*s-220*l-6300*d)/1403,y=Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),C=m(f)*(100/e.fl)*Math.pow(y,1/.42),P=Math.max(0,27.13*Math.abs(p)/(400-Math.abs(p))),v=m(p)*(100/e.fl)*Math.pow(P,1/.42),S=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),b=m(g)*(100/e.fl)*Math.pow(S,1/.42),k=C/e.rgbD[0],w=v/e.rgbD[1],T=b/e.rgbD[2];return D(1.86206786*k-1.01125463*w+.14918677*T,.38752654*k+.62144744*w-.00897398*T,-.0158415*k-.03412294*w+1.04996444*T)}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,u=a.rgbD[2]*i,h=Math.pow(a.fl*Math.abs(s)/100,.42),l=Math.pow(a.fl*Math.abs(c)/100,.42),d=Math.pow(a.fl*Math.abs(u)/100,.42),f=400*m(s)*h/(h+27.13),p=400*m(c)*l/(l+27.13),g=400*m(u)*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,v=(40*f+20*p+g)/20,S=180*Math.atan2(C,y)/Math.PI,b=S<0?S+360:S>=360?S-360:S,k=b*Math.PI/180,w=v*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,x=b<20.14?b+360:b,D=5e4/13*(1/4*(Math.cos(x*Math.PI/180+2)+3.8))*a.nc*a.ncb*Math.sqrt(y*y+C*C)/(P+.305),M=Math.pow(D,.9)*Math.pow(1.64-Math.pow(.29,a.n),.73),E=M*Math.sqrt(T/100),I=E*a.fLRoot,_=50*Math.sqrt(M*a.c/(a.aw+4)),B=(1+100*.007)*T/(1+.007*T),F=Math.log(1+.0228*I)/.0228,H=F*Math.cos(k),R=F*Math.sin(k);return new L(b,E,T,A,I,_,B,H,R)}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),u=Math.cos(a),h=23*(s+.305)*r/(23*i+11*r*u+108*r*c),l=h*u,d=h*c,f=(460*s+451*l+288*d)/1403,p=(460*s-891*l-261*d)/1403,g=(460*s-220*l-6300*d)/1403,y=Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),C=m(f)*(100/e.fl)*Math.pow(y,1/.42),P=Math.max(0,27.13*Math.abs(p)/(400-Math.abs(p))),v=m(p)*(100/e.fl)*Math.pow(P,1/.42),S=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),b=m(g)*(100/e.fl)*Math.pow(S,1/.42),k=C/e.rgbD[0],w=v/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 V{constructor(e,t,r,a,n,o,i,s,c){this.hue=e,this.chroma=t,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 O{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*m(e)*t/(t+27.13)}static hueOf(e){const t=C(e,O.SCALED_DISCOUNT_FROM_LINRGB),r=O.chromaticAdaptation(t[0]),a=O.chromaticAdaptation(t[1]),n=O.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 O.sanitizeRadians(t-e)<O.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=O.intercept(e[a],t,r[a]);return O.lerpPoint(e,n,r)}static isBounded(e){return 0<=e&&e<=100}static nthVertex(e,t){const r=O.Y_FROM_LINRGB[0],a=O.Y_FROM_LINRGB[1],n=O.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 O.isBounded(c)?[c,t,s]:[-1,-1,-1]}if(t<8){const t=o,s=i,c=(e-s*r-t*n)/a;return O.isBounded(c)?[s,c,t]:[-1,-1,-1]}{const t=o,s=i,c=(e-t*r-s*a)/n;return O.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=O.nthVertex(e,c);if(u[0]<0)continue;const h=O.hueOf(u);i?(s||O.areInCyclicOrder(n,h,o))&&(s=!1,O.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=O.bisectToSegment(e,t);let a=r[0],n=O.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=O.criticalPlaneBelow(O.trueDelinearized(a[e])),i=O.criticalPlaneAbove(O.trueDelinearized(o[e]))):(r=O.criticalPlaneAbove(O.trueDelinearized(a[e])),i=O.criticalPlaneBelow(O.trueDelinearized(o[e])));for(let s=0;s<8&&!(Math.abs(i-r)<=1);s++){const s=Math.floor((r+i)/2),c=O.CRITICAL_PLANES[s],u=O.setCoordinate(a,c,o,e),h=O.hueOf(u);O.areInCyclicOrder(n,t,h)?(o=u,i=s):(a=u,n=h,r=s)}}return O.midpoint(a,o)}static inverseChromaticAdaptation(e){const t=Math.abs(e),r=Math.max(0,27.13*t/(400-t));return m(e)*Math.pow(r,1/.42)}static findResultByJ(e,t,r){let a=11*Math.sqrt(r);const n=V.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,p=d*s,g=(460*m+451*f+288*p)/1403,y=(460*m-891*f-261*p)/1403,P=(460*m-220*f-6300*p)/1403,v=C([O.inverseChromaticAdaptation(g),O.inverseChromaticAdaptation(y),O.inverseChromaticAdaptation(P)],O.LINRGB_FROM_SCALED_DISCOUNT);if(v[0]<0||v[1]<0||v[2]<0)return 0;const S=O.Y_FROM_LINRGB[0],b=O.Y_FROM_LINRGB[1],w=O.Y_FROM_LINRGB[2],T=S*v[0]+b*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:k(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=F(I(e));return b(t,t,t)}(r);const a=(e=g(e))/180*Math.PI,n=I(r),o=O.findResultByJ(a,t,n);if(0!==o)return o;return k(O.bisectToLimit(n,a))}static solveToCam(e,t,r){return L.fromInt(O.solveToInt(e,t,r))}}O.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]],O.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]],O.Y_FROM_LINRGB=[.2126,.7152,.0722],O.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,7 @@ class V{constructor(e,t,r,a,n,o,i,s,c){this.hue=e,this.chroma=t,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 N{static from(e,t,r){return new N(O.solveToInt(e,t,r))}static fromInt(e){return new N(e)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(e){this.setInternalState(O.solveToInt(e,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(e){this.setInternalState(O.solveToInt(this.internalHue,e,this.internalTone))}get tone(){return this.internalTone}set tone(e){this.setInternalState(O.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=L.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=E(e),this.argb=e}setInternalState(e){const t=L.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=E(e),this.argb=e}inViewingConditions(e){const t=L.fromInt(this.toInt()).xyzInViewingConditions(e),r=L.fromXyzInViewingConditions(t[0],t[1],t[2],V.make());return N.from(r.hue,r.chroma,_(t[1]))}}
|
|
106
106
|
/**
|
|
107
107
|
* @license
|
|
108
108
|
* Copyright 2021 Google LLC
|
|
@@ -118,7 +118,7 @@ class O{static from(e,t,r){return new O(L.solveToInt(e,t,r))}static fromInt(e){r
|
|
|
118
118
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
119
|
* See the License for the specific language governing permissions and
|
|
120
120
|
* limitations under the License.
|
|
121
|
-
*/class
|
|
121
|
+
*/class U{static harmonize(e,t){const r=N.fromInt(e),a=N.fromInt(t),n=y(r.hue,a.hue),o=Math.min(.5*n,15),i=g(r.hue+o*(s=r.hue,g(a.hue-s)<=180?1:-1));var s;return N.from(i,r.chroma,r.tone).toInt()}static hctHue(e,t,r){const a=U.cam16Ucs(e,t,r),n=L.fromInt(a),o=L.fromInt(e);return N.from(n.hue,o.chroma,E(e)).toInt()}static cam16Ucs(e,t,r){const a=L.fromInt(e),n=L.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 L.fromUcs(c,u,h).toInt()}}
|
|
122
122
|
/**
|
|
123
123
|
* @license
|
|
124
124
|
* Copyright 2022 Google LLC
|
|
@@ -134,7 +134,7 @@ class O{static from(e,t,r){return new O(L.solveToInt(e,t,r))}static fromInt(e){r
|
|
|
134
134
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
135
135
|
* See the License for the specific language governing permissions and
|
|
136
136
|
* limitations under the License.
|
|
137
|
-
*/class
|
|
137
|
+
*/class z{static ratioOfTones(e,t){return e=f(0,100,e),t=f(0,100,t),z.ratioOfYs(I(e),I(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=I(e),a=t*(r+5)-5,n=z.ratioOfYs(a,r),o=Math.abs(n-t);if(n<t&&o>.04)return-1;const i=_(a)+.4;return i<0||i>100?-1:i}static darker(e,t){if(e<0||e>100)return-1;const r=I(e),a=(r+5)/t-5,n=z.ratioOfYs(r,a),o=Math.abs(n-t);if(n<t&&o>.04)return-1;const i=_(a)-.4;return i<0||i>100?-1:i}static lighterUnsafe(e,t){const r=z.lighter(e,t);return r<0?100:r}static darkerUnsafe(e,t){const r=z.darker(e,t);return r<0?0:r}}
|
|
138
138
|
/**
|
|
139
139
|
* @license
|
|
140
140
|
* Copyright 2023 Google LLC
|
|
@@ -150,7 +150,7 @@ class O{static from(e,t,r){return new O(L.solveToInt(e,t,r))}static fromInt(e){r
|
|
|
150
150
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
151
151
|
* See the License for the specific language governing permissions and
|
|
152
152
|
* limitations under the License.
|
|
153
|
-
*/class ${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 $.isDisliked(e)?
|
|
153
|
+
*/class ${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 $.isDisliked(e)?N.from(e.hue,e.chroma,70):e}}
|
|
154
154
|
/**
|
|
155
155
|
* @license
|
|
156
156
|
* Copyright 2022 Google LLC
|
|
@@ -166,7 +166,7 @@ class O{static from(e,t,r){return new O(L.solveToInt(e,t,r))}static fromInt(e){r
|
|
|
166
166
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
167
167
|
* See the License for the specific language governing permissions and
|
|
168
168
|
* limitations under the License.
|
|
169
|
-
*/function
|
|
169
|
+
*/function K(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),Y.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 Y{static fromPalette(e){return new Y(e.name??"",e.palette,e.tone??Y.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 Y.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=X(e.specVersion).getHct(e,this);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(e,r),r}getTone(e){return X(e.specVersion).getTone(e,this)}static foregroundTone(e,t){const r=z.lighterUnsafe(e,t),a=z.darkerUnsafe(e,t),n=z.ratioOfTones(r,e),o=z.ratioOfTones(a,e);if(Y.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 Y.tonePrefersLightForeground(e)&&!Y.toneAllowsLightForeground(e)?49:e}}const q=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,l=u?o:n,m=t.name===h.name,d=e.isDark?1:-1;let p=h.tone(e),g=l.tone(e);if(t.background&&h.contrastCurve&&l.contrastCurve){const a=t.background(e),n=h.contrastCurve(e),o=l.contrastCurve(e);if(a&&n&&o){const t=a.getTone(e),i=n.get(e.contrastLevel),s=o.get(e.contrastLevel);z.ratioOfTones(t,p)<i&&(p=Y.foregroundTone(t,i)),z.ratioOfTones(t,g)<s&&(g=Y.foregroundTone(t,s)),r&&(p=Y.foregroundTone(t,i),g=Y.foregroundTone(t,s))}}return(g-p)*d<i&&(g=f(0,100,p+i*d),(g-p)*d>=i||(p=f(0,100,g-i*d))),50<=p&&p<60?d>0?(p=60,g=Math.max(g,p+i*d)):(p=49,g=Math.min(g,p+i*d)):50<=g&&g<60&&(c?d>0?(p=60,g=Math.max(g,p+i*d)):(p=49,g=Math.min(g,p+i*d)):g=d>0?60:49),m?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(z.ratioOfTones(n,a)>=o||(a=Y.foregroundTone(n,o)),r&&(a=Y.foregroundTone(n,o)),t.isBackground&&50<=a&&a<60&&(a=z.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(z.ratioOfTones(h,a)>=o&&z.ratioOfTones(l,a)>=o)return a;const m=z.lighter(h,o),d=z.darker(l,o),f=[];-1!==m&&f.push(m),-1!==d&&f.push(d);return Y.tonePrefersLightForeground(c)||Y.tonePrefersLightForeground(u)?m<0?100:m:1===f.length?f[0]:d<0?0:d}}},G=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 N.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),l=u.getTone(e);const m=s*(c?1:-1);if("exact"===i?h=f(0,100,l+m):"nearer"===i?h=f(0,100,m>0?f(l,l+m,h):f(l+m,l,h)):"farther"===i&&(h=m>0?f(l+m,100,h):f(0,l+m,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=z.ratioOfTones(t,h)>=n&&e.contrastLevel>=0?h:Y.foregroundTone(t,n)}}return t.isBackground&&!t.name.endsWith("_fixed_dim")&&(h=h>=57?f(65,100,h):f(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=z.ratioOfTones(a,r)>=n&&e.contrastLevel>=0?r:Y.foregroundTone(a,n),t.isBackground&&!t.name.endsWith("_fixed_dim")&&(r=r>=57?f(65,100,r):f(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(z.ratioOfTones(u,r)>=n&&z.ratioOfTones(h,r)>=n)return r;const l=z.lighter(u,n),m=z.darker(h,n),d=[];-1!==l&&d.push(l),-1!==m&&d.push(m);return Y.tonePrefersLightForeground(s)||Y.tonePrefersLightForeground(c)?l<0?100:l:1===d.length?d[0]:m<0?0:m}}};function X(e){return"2025"===e?G:q}
|
|
170
170
|
/**
|
|
171
171
|
* @license
|
|
172
172
|
* Copyright 2021 Google LLC
|
|
@@ -182,7 +182,7 @@ class O{static from(e,t,r){return new O(L.solveToInt(e,t,r))}static fromInt(e){r
|
|
|
182
182
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
183
183
|
* See the License for the specific language governing permissions and
|
|
184
184
|
* limitations under the License.
|
|
185
|
-
*/class
|
|
185
|
+
*/class W{static fromInt(e){const t=N.fromInt(e);return W.fromHct(t)}static fromHct(e){return new W(e.hue,e.chroma,e)}static fromHueAndChroma(e,t){const r=new j(e,t).create();return new W(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&&N.isYellow(this.hue)?this.averageArgb(this.tone(98),this.tone(100)):N.from(this.hue,this.chroma,e).toInt(),this.cache.set(e,t)),t}getHct(e){return N.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 j{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 N.from(this.hue,this.requestedChroma,e);e=r}else a?e=r+1:t=r}return N.from(this.hue,this.requestedChroma,e)}maxChroma(e){if(this.chromaCache.has(e))return this.chromaCache.get(e);const t=N.from(this.hue,this.maxChromaValue,e).chroma;return this.chromaCache.set(e,t),t}}
|
|
186
186
|
/**
|
|
187
187
|
* @license
|
|
188
188
|
* Copyright 2023 Google LLC
|
|
@@ -198,7 +198,7 @@ class O{static from(e,t,r){return new O(L.solveToInt(e,t,r))}static fromInt(e){r
|
|
|
198
198
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
199
|
* See the License for the specific language governing permissions and
|
|
200
200
|
* limitations under the License.
|
|
201
|
-
*/class
|
|
201
|
+
*/class J{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=p(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=p(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 m=e-l-1;for(let e=1;e<m+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=J.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=g(o+1*e);if(!J.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,J.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=N.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=M(e.toInt()),r=g(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(g(r-50)*Math.PI/180)-.5}}
|
|
202
202
|
/**
|
|
203
203
|
* @license
|
|
204
204
|
* Copyright 2023 Google LLC
|
|
@@ -214,7 +214,7 @@ class O{static from(e,t,r){return new O(L.solveToInt(e,t,r))}static fromInt(e){r
|
|
|
214
214
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
215
215
|
* See the License for the specific language governing permissions and
|
|
216
216
|
* limitations under the License.
|
|
217
|
-
*/class
|
|
217
|
+
*/class Q{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?d(this.low,this.normal,(e- -1)/1):e<.5?d(this.normal,this.medium,(e-0)/.5):e<1?d(this.medium,this.high,(e-.5)/.5):this.high}}
|
|
218
218
|
/**
|
|
219
219
|
* @license
|
|
220
220
|
* Copyright 2023 Google LLC
|
|
@@ -230,7 +230,7 @@ class O{static from(e,t,r){return new O(L.solveToInt(e,t,r))}static fromInt(e){r
|
|
|
230
230
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
231
231
|
* See the License for the specific language governing permissions and
|
|
232
232
|
* limitations under the License.
|
|
233
|
-
*/class
|
|
233
|
+
*/class Z{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"}}
|
|
234
234
|
/**
|
|
235
235
|
* @license
|
|
236
236
|
* Copyright 2022 Google LLC
|
|
@@ -246,7 +246,7 @@ class O{static from(e,t,r){return new O(L.solveToInt(e,t,r))}static fromInt(e){r
|
|
|
246
246
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
247
247
|
* See the License for the specific language governing permissions and
|
|
248
248
|
* limitations under the License.
|
|
249
|
-
*/var
|
|
249
|
+
*/var ee;
|
|
250
250
|
/**
|
|
251
251
|
* @license
|
|
252
252
|
* Copyright 2025 Google LLC
|
|
@@ -263,7 +263,7 @@ class O{static from(e,t,r){return new O(L.solveToInt(e,t,r))}static fromInt(e){r
|
|
|
263
263
|
* See the License for the specific language governing permissions and
|
|
264
264
|
* limitations under the License.
|
|
265
265
|
*/
|
|
266
|
-
function ee(e){return e.variant===Z.FIDELITY||e.variant===Z.CONTENT}function te(e){return e.variant===Z.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"}(Z||(Z={}));class re{primaryPaletteKeyColor(){return K.fromPalette({name:"primary_palette_key_color",palette:e=>e.primaryPalette,tone:e=>e.primaryPalette.keyColor.tone})}secondaryPaletteKeyColor(){return K.fromPalette({name:"secondary_palette_key_color",palette:e=>e.secondaryPalette,tone:e=>e.secondaryPalette.keyColor.tone})}tertiaryPaletteKeyColor(){return K.fromPalette({name:"tertiary_palette_key_color",palette:e=>e.tertiaryPalette,tone:e=>e.tertiaryPalette.keyColor.tone})}neutralPaletteKeyColor(){return K.fromPalette({name:"neutral_palette_key_color",palette:e=>e.neutralPalette,tone:e=>e.neutralPalette.keyColor.tone})}neutralVariantPaletteKeyColor(){return K.fromPalette({name:"neutral_variant_palette_key_color",palette:e=>e.neutralVariantPalette,tone:e=>e.neutralVariantPalette.keyColor.tone})}errorPaletteKeyColor(){return K.fromPalette({name:"error_palette_key_color",palette:e=>e.errorPalette,tone:e=>e.errorPalette.keyColor.tone})}background(){return K.fromPalette({name:"background",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0})}onBackground(){return K.fromPalette({name:"on_background",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>this.background(),contrastCurve:e=>new J(3,3,4.5,7)})}surface(){return K.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0})}surfaceDim(){return K.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:new J(87,87,80,75).get(e.contrastLevel),isBackground:!0})}surfaceBright(){return K.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?new J(24,24,29,34).get(e.contrastLevel):98,isBackground:!0})}surfaceContainerLowest(){return K.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new J(4,4,2,0).get(e.contrastLevel):100,isBackground:!0})}surfaceContainerLow(){return K.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>e.isDark?new J(10,10,11,12).get(e.contrastLevel):new J(96,96,96,95).get(e.contrastLevel),isBackground:!0})}surfaceContainer(){return K.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>e.isDark?new J(12,12,16,20).get(e.contrastLevel):new J(94,94,92,90).get(e.contrastLevel),isBackground:!0})}surfaceContainerHigh(){return K.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>e.isDark?new J(17,17,21,25).get(e.contrastLevel):new J(92,92,88,85).get(e.contrastLevel),isBackground:!0})}surfaceContainerHighest(){return K.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new J(22,22,26,30).get(e.contrastLevel):new J(90,90,84,80).get(e.contrastLevel),isBackground:!0})}onSurface(){return K.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>this.highestSurface(e),contrastCurve:e=>new J(4.5,7,11,21)})}surfaceVariant(){return K.fromPalette({name:"surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:90,isBackground:!0})}onSurfaceVariant(){return K.fromPalette({name:"on_surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?80:30,background:e=>this.highestSurface(e),contrastCurve:e=>new J(3,4.5,7,11)})}inverseSurface(){return K.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:20,isBackground:!0})}inverseOnSurface(){return K.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?20:95,background:e=>this.inverseSurface(),contrastCurve:e=>new J(4.5,7,11,21)})}outline(){return K.fromPalette({name:"outline",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?60:50,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1.5,3,4.5,7)})}outlineVariant(){return K.fromPalette({name:"outline_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:80,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1,1,3,4.5)})}shadow(){return K.fromPalette({name:"shadow",palette:e=>e.neutralPalette,tone:e=>0})}scrim(){return K.fromPalette({name:"scrim",palette:e=>e.neutralPalette,tone:e=>0})}surfaceTint(){return K.fromPalette({name:"surface_tint",palette:e=>e.primaryPalette,tone:e=>e.isDark?80:40,isBackground:!0})}primary(){return K.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>te(e)?e.isDark?100:0:e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(3,4.5,7,7),toneDeltaPair:e=>new Q(this.primaryContainer(),this.primary(),10,"nearer",!1)})}primaryDim(){}onPrimary(){return K.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,tone:e=>te(e)?e.isDark?10:90:e.isDark?20:100,background:e=>this.primary(),contrastCurve:e=>new J(4.5,7,11,21)})}primaryContainer(){return K.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>ee(e)?e.sourceColorHct.tone:te(e)?e.isDark?85:25:e.isDark?30:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1,1,3,4.5),toneDeltaPair:e=>new Q(this.primaryContainer(),this.primary(),10,"nearer",!1)})}onPrimaryContainer(){return K.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,tone:e=>ee(e)?K.foregroundTone(this.primaryContainer().tone(e),4.5):te(e)?e.isDark?0:100:e.isDark?90:30,background:e=>this.primaryContainer(),contrastCurve:e=>new J(3,4.5,7,11)})}inversePrimary(){return K.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>e.isDark?40:80,background:e=>this.inverseSurface(),contrastCurve:e=>new J(3,4.5,7,7)})}secondary(){return K.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(3,4.5,7,7),toneDeltaPair:e=>new Q(this.secondaryContainer(),this.secondary(),10,"nearer",!1)})}secondaryDim(){}onSecondary(){return K.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,tone:e=>te(e)?e.isDark?10:100:e.isDark?20:100,background:e=>this.secondary(),contrastCurve:e=>new J(4.5,7,11,21)})}secondaryContainer(){return K.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>{const t=e.isDark?30:90;return te(e)?e.isDark?30:85:ee(e)?function(e,t,r,a){let n=r,o=O.from(e,t,r);if(o.chroma<t){let r=o.chroma;for(;o.chroma<t;){n+=a?-1:1;const i=O.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 J(1,1,3,4.5),toneDeltaPair:e=>new Q(this.secondaryContainer(),this.secondary(),10,"nearer",!1)})}onSecondaryContainer(){return K.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,tone:e=>te(e)?e.isDark?90:10:ee(e)?K.foregroundTone(this.secondaryContainer().tone(e),4.5):e.isDark?90:30,background:e=>this.secondaryContainer(),contrastCurve:e=>new J(3,4.5,7,11)})}tertiary(){return K.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>te(e)?e.isDark?90:25:e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(3,4.5,7,7),toneDeltaPair:e=>new Q(this.tertiaryContainer(),this.tertiary(),10,"nearer",!1)})}tertiaryDim(){}onTertiary(){return K.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,tone:e=>te(e)?e.isDark?10:90:e.isDark?20:100,background:e=>this.tertiary(),contrastCurve:e=>new J(4.5,7,11,21)})}tertiaryContainer(){return K.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>{if(te(e))return e.isDark?60:49;if(!ee(e))return e.isDark?30:90;const t=e.tertiaryPalette.getHct(e.sourceColorHct.tone);return $.fixIfDisliked(t).tone},isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1,1,3,4.5),toneDeltaPair:e=>new Q(this.tertiaryContainer(),this.tertiary(),10,"nearer",!1)})}onTertiaryContainer(){return K.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>te(e)?e.isDark?0:100:ee(e)?K.foregroundTone(this.tertiaryContainer().tone(e),4.5):e.isDark?90:30,background:e=>this.tertiaryContainer(),contrastCurve:e=>new J(3,4.5,7,11)})}error(){return K.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(3,4.5,7,7),toneDeltaPair:e=>new Q(this.errorContainer(),this.error(),10,"nearer",!1)})}errorDim(){}onError(){return K.fromPalette({name:"on_error",palette:e=>e.errorPalette,tone:e=>e.isDark?20:100,background:e=>this.error(),contrastCurve:e=>new J(4.5,7,11,21)})}errorContainer(){return K.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>e.isDark?30:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1,1,3,4.5),toneDeltaPair:e=>new Q(this.errorContainer(),this.error(),10,"nearer",!1)})}onErrorContainer(){return K.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,tone:e=>te(e)?e.isDark?90:10:e.isDark?90:30,background:e=>this.errorContainer(),contrastCurve:e=>new J(3,4.5,7,11)})}primaryFixed(){return K.fromPalette({name:"primary_fixed",palette:e=>e.primaryPalette,tone:e=>te(e)?40:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1,1,3,4.5),toneDeltaPair:e=>new Q(this.primaryFixed(),this.primaryFixedDim(),10,"lighter",!0)})}primaryFixedDim(){return K.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>te(e)?30:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1,1,3,4.5),toneDeltaPair:e=>new Q(this.primaryFixed(),this.primaryFixedDim(),10,"lighter",!0)})}onPrimaryFixed(){return K.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,tone:e=>te(e)?100:10,background:e=>this.primaryFixedDim(),secondBackground:e=>this.primaryFixed(),contrastCurve:e=>new J(4.5,7,11,21)})}onPrimaryFixedVariant(){return K.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,tone:e=>te(e)?90:30,background:e=>this.primaryFixedDim(),secondBackground:e=>this.primaryFixed(),contrastCurve:e=>new J(3,4.5,7,11)})}secondaryFixed(){return K.fromPalette({name:"secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>te(e)?80:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1,1,3,4.5),toneDeltaPair:e=>new Q(this.secondaryFixed(),this.secondaryFixedDim(),10,"lighter",!0)})}secondaryFixedDim(){return K.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>te(e)?70:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1,1,3,4.5),toneDeltaPair:e=>new Q(this.secondaryFixed(),this.secondaryFixedDim(),10,"lighter",!0)})}onSecondaryFixed(){return K.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>10,background:e=>this.secondaryFixedDim(),secondBackground:e=>this.secondaryFixed(),contrastCurve:e=>new J(4.5,7,11,21)})}onSecondaryFixedVariant(){return K.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,tone:e=>te(e)?25:30,background:e=>this.secondaryFixedDim(),secondBackground:e=>this.secondaryFixed(),contrastCurve:e=>new J(3,4.5,7,11)})}tertiaryFixed(){return K.fromPalette({name:"tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>te(e)?40:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1,1,3,4.5),toneDeltaPair:e=>new Q(this.tertiaryFixed(),this.tertiaryFixedDim(),10,"lighter",!0)})}tertiaryFixedDim(){return K.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>te(e)?30:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new J(1,1,3,4.5),toneDeltaPair:e=>new Q(this.tertiaryFixed(),this.tertiaryFixedDim(),10,"lighter",!0)})}onTertiaryFixed(){return K.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>te(e)?100:10,background:e=>this.tertiaryFixedDim(),secondBackground:e=>this.tertiaryFixed(),contrastCurve:e=>new J(4.5,7,11,21)})}onTertiaryFixedVariant(){return K.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,tone:e=>te(e)?90:30,background:e=>this.tertiaryFixedDim(),secondBackground:e=>this.tertiaryFixed(),contrastCurve:e=>new J(3,4.5,7,11)})}highestSurface(e){return e.isDark?this.surfaceBright():this.surfaceDim()}}
|
|
266
|
+
function te(e){return e.variant===ee.FIDELITY||e.variant===ee.CONTENT}function re(e){return e.variant===ee.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"}(ee||(ee={}));class ae{primaryPaletteKeyColor(){return Y.fromPalette({name:"primary_palette_key_color",palette:e=>e.primaryPalette,tone:e=>e.primaryPalette.keyColor.tone})}secondaryPaletteKeyColor(){return Y.fromPalette({name:"secondary_palette_key_color",palette:e=>e.secondaryPalette,tone:e=>e.secondaryPalette.keyColor.tone})}tertiaryPaletteKeyColor(){return Y.fromPalette({name:"tertiary_palette_key_color",palette:e=>e.tertiaryPalette,tone:e=>e.tertiaryPalette.keyColor.tone})}neutralPaletteKeyColor(){return Y.fromPalette({name:"neutral_palette_key_color",palette:e=>e.neutralPalette,tone:e=>e.neutralPalette.keyColor.tone})}neutralVariantPaletteKeyColor(){return Y.fromPalette({name:"neutral_variant_palette_key_color",palette:e=>e.neutralVariantPalette,tone:e=>e.neutralVariantPalette.keyColor.tone})}errorPaletteKeyColor(){return Y.fromPalette({name:"error_palette_key_color",palette:e=>e.errorPalette,tone:e=>e.errorPalette.keyColor.tone})}background(){return Y.fromPalette({name:"background",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0})}onBackground(){return Y.fromPalette({name:"on_background",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>this.background(),contrastCurve:e=>new Q(3,3,4.5,7)})}surface(){return Y.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0})}surfaceDim(){return Y.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:new Q(87,87,80,75).get(e.contrastLevel),isBackground:!0})}surfaceBright(){return Y.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?new Q(24,24,29,34).get(e.contrastLevel):98,isBackground:!0})}surfaceContainerLowest(){return Y.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new Q(4,4,2,0).get(e.contrastLevel):100,isBackground:!0})}surfaceContainerLow(){return Y.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>e.isDark?new Q(10,10,11,12).get(e.contrastLevel):new Q(96,96,96,95).get(e.contrastLevel),isBackground:!0})}surfaceContainer(){return Y.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>e.isDark?new Q(12,12,16,20).get(e.contrastLevel):new Q(94,94,92,90).get(e.contrastLevel),isBackground:!0})}surfaceContainerHigh(){return Y.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>e.isDark?new Q(17,17,21,25).get(e.contrastLevel):new Q(92,92,88,85).get(e.contrastLevel),isBackground:!0})}surfaceContainerHighest(){return Y.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new Q(22,22,26,30).get(e.contrastLevel):new Q(90,90,84,80).get(e.contrastLevel),isBackground:!0})}onSurface(){return Y.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(4.5,7,11,21)})}surfaceVariant(){return Y.fromPalette({name:"surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:90,isBackground:!0})}onSurfaceVariant(){return Y.fromPalette({name:"on_surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?80:30,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(3,4.5,7,11)})}inverseSurface(){return Y.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:20,isBackground:!0})}inverseOnSurface(){return Y.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?20:95,background:e=>this.inverseSurface(),contrastCurve:e=>new Q(4.5,7,11,21)})}outline(){return Y.fromPalette({name:"outline",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?60:50,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1.5,3,4.5,7)})}outlineVariant(){return Y.fromPalette({name:"outline_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:80,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1,1,3,4.5)})}shadow(){return Y.fromPalette({name:"shadow",palette:e=>e.neutralPalette,tone:e=>0})}scrim(){return Y.fromPalette({name:"scrim",palette:e=>e.neutralPalette,tone:e=>0})}surfaceTint(){return Y.fromPalette({name:"surface_tint",palette:e=>e.primaryPalette,tone:e=>e.isDark?80:40,isBackground:!0})}primary(){return Y.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>re(e)?e.isDark?100:0:e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(3,4.5,7,7),toneDeltaPair:e=>new Z(this.primaryContainer(),this.primary(),10,"nearer",!1)})}primaryDim(){}onPrimary(){return Y.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,tone:e=>re(e)?e.isDark?10:90:e.isDark?20:100,background:e=>this.primary(),contrastCurve:e=>new Q(4.5,7,11,21)})}primaryContainer(){return Y.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>te(e)?e.sourceColorHct.tone:re(e)?e.isDark?85:25:e.isDark?30:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1,1,3,4.5),toneDeltaPair:e=>new Z(this.primaryContainer(),this.primary(),10,"nearer",!1)})}onPrimaryContainer(){return Y.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,tone:e=>te(e)?Y.foregroundTone(this.primaryContainer().tone(e),4.5):re(e)?e.isDark?0:100:e.isDark?90:30,background:e=>this.primaryContainer(),contrastCurve:e=>new Q(3,4.5,7,11)})}inversePrimary(){return Y.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>e.isDark?40:80,background:e=>this.inverseSurface(),contrastCurve:e=>new Q(3,4.5,7,7)})}secondary(){return Y.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(3,4.5,7,7),toneDeltaPair:e=>new Z(this.secondaryContainer(),this.secondary(),10,"nearer",!1)})}secondaryDim(){}onSecondary(){return Y.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,tone:e=>re(e)?e.isDark?10:100:e.isDark?20:100,background:e=>this.secondary(),contrastCurve:e=>new Q(4.5,7,11,21)})}secondaryContainer(){return Y.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>{const t=e.isDark?30:90;return re(e)?e.isDark?30:85:te(e)?function(e,t,r,a){let n=r,o=N.from(e,t,r);if(o.chroma<t){let r=o.chroma;for(;o.chroma<t;){n+=a?-1:1;const i=N.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 Q(1,1,3,4.5),toneDeltaPair:e=>new Z(this.secondaryContainer(),this.secondary(),10,"nearer",!1)})}onSecondaryContainer(){return Y.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,tone:e=>re(e)?e.isDark?90:10:te(e)?Y.foregroundTone(this.secondaryContainer().tone(e),4.5):e.isDark?90:30,background:e=>this.secondaryContainer(),contrastCurve:e=>new Q(3,4.5,7,11)})}tertiary(){return Y.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>re(e)?e.isDark?90:25:e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(3,4.5,7,7),toneDeltaPair:e=>new Z(this.tertiaryContainer(),this.tertiary(),10,"nearer",!1)})}tertiaryDim(){}onTertiary(){return Y.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,tone:e=>re(e)?e.isDark?10:90:e.isDark?20:100,background:e=>this.tertiary(),contrastCurve:e=>new Q(4.5,7,11,21)})}tertiaryContainer(){return Y.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>{if(re(e))return e.isDark?60:49;if(!te(e))return e.isDark?30:90;const t=e.tertiaryPalette.getHct(e.sourceColorHct.tone);return $.fixIfDisliked(t).tone},isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1,1,3,4.5),toneDeltaPair:e=>new Z(this.tertiaryContainer(),this.tertiary(),10,"nearer",!1)})}onTertiaryContainer(){return Y.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>re(e)?e.isDark?0:100:te(e)?Y.foregroundTone(this.tertiaryContainer().tone(e),4.5):e.isDark?90:30,background:e=>this.tertiaryContainer(),contrastCurve:e=>new Q(3,4.5,7,11)})}error(){return Y.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(3,4.5,7,7),toneDeltaPair:e=>new Z(this.errorContainer(),this.error(),10,"nearer",!1)})}errorDim(){}onError(){return Y.fromPalette({name:"on_error",palette:e=>e.errorPalette,tone:e=>e.isDark?20:100,background:e=>this.error(),contrastCurve:e=>new Q(4.5,7,11,21)})}errorContainer(){return Y.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>e.isDark?30:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1,1,3,4.5),toneDeltaPair:e=>new Z(this.errorContainer(),this.error(),10,"nearer",!1)})}onErrorContainer(){return Y.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,tone:e=>re(e)?e.isDark?90:10:e.isDark?90:30,background:e=>this.errorContainer(),contrastCurve:e=>new Q(3,4.5,7,11)})}primaryFixed(){return Y.fromPalette({name:"primary_fixed",palette:e=>e.primaryPalette,tone:e=>re(e)?40:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1,1,3,4.5),toneDeltaPair:e=>new Z(this.primaryFixed(),this.primaryFixedDim(),10,"lighter",!0)})}primaryFixedDim(){return Y.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>re(e)?30:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1,1,3,4.5),toneDeltaPair:e=>new Z(this.primaryFixed(),this.primaryFixedDim(),10,"lighter",!0)})}onPrimaryFixed(){return Y.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,tone:e=>re(e)?100:10,background:e=>this.primaryFixedDim(),secondBackground:e=>this.primaryFixed(),contrastCurve:e=>new Q(4.5,7,11,21)})}onPrimaryFixedVariant(){return Y.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,tone:e=>re(e)?90:30,background:e=>this.primaryFixedDim(),secondBackground:e=>this.primaryFixed(),contrastCurve:e=>new Q(3,4.5,7,11)})}secondaryFixed(){return Y.fromPalette({name:"secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>re(e)?80:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1,1,3,4.5),toneDeltaPair:e=>new Z(this.secondaryFixed(),this.secondaryFixedDim(),10,"lighter",!0)})}secondaryFixedDim(){return Y.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>re(e)?70:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1,1,3,4.5),toneDeltaPair:e=>new Z(this.secondaryFixed(),this.secondaryFixedDim(),10,"lighter",!0)})}onSecondaryFixed(){return Y.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>10,background:e=>this.secondaryFixedDim(),secondBackground:e=>this.secondaryFixed(),contrastCurve:e=>new Q(4.5,7,11,21)})}onSecondaryFixedVariant(){return Y.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,tone:e=>re(e)?25:30,background:e=>this.secondaryFixedDim(),secondBackground:e=>this.secondaryFixed(),contrastCurve:e=>new Q(3,4.5,7,11)})}tertiaryFixed(){return Y.fromPalette({name:"tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>re(e)?40:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1,1,3,4.5),toneDeltaPair:e=>new Z(this.tertiaryFixed(),this.tertiaryFixedDim(),10,"lighter",!0)})}tertiaryFixedDim(){return Y.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>re(e)?30:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new Q(1,1,3,4.5),toneDeltaPair:e=>new Z(this.tertiaryFixed(),this.tertiaryFixedDim(),10,"lighter",!0)})}onTertiaryFixed(){return Y.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>re(e)?100:10,background:e=>this.tertiaryFixedDim(),secondBackground:e=>this.tertiaryFixed(),contrastCurve:e=>new Q(4.5,7,11,21)})}onTertiaryFixedVariant(){return Y.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,tone:e=>re(e)?90:30,background:e=>this.tertiaryFixedDim(),secondBackground:e=>this.tertiaryFixed(),contrastCurve:e=>new Q(3,4.5,7,11)})}highestSurface(e){return e.isDark?this.surfaceBright():this.surfaceDim()}}
|
|
267
267
|
/**
|
|
268
268
|
* @license
|
|
269
269
|
* Copyright 2025 Google LLC
|
|
@@ -279,7 +279,7 @@ function ee(e){return e.variant===Z.FIDELITY||e.variant===Z.CONTENT}function te(
|
|
|
279
279
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
280
280
|
* See the License for the specific language governing permissions and
|
|
281
281
|
* limitations under the License.
|
|
282
|
-
*/function
|
|
282
|
+
*/function ne(e,t=0,r=100,a=1){return f(t,r,ie(e.hue,e.chroma*a,100,!0))}function oe(e,t=0,r=100){return f(t,r,ie(e.hue,e.chroma,0,!1))}function ie(e,t,r,a){let n=r,o=N.from(e,t,n);for(;o.chroma<t&&!(r<0||r>100);){r+=a?-1:1;const i=N.from(e,t,r);o.chroma<i.chroma&&(o=i,n=r)}return n}function se(e){return 1.5===e?new Q(1.5,1.5,3,5.5):3===e?new Q(3,3,4.5,7):4.5===e?new Q(4.5,4.5,7,11):6===e?new Q(6,6,7,11):7===e?new Q(7,7,11,21):9===e?new Q(9,9,11,21):11===e?new Q(11,11,21,21):21===e?new Q(21,21,21,21):new Q(e,e,7,21)}
|
|
283
283
|
/**
|
|
284
284
|
* @license
|
|
285
285
|
* Copyright 2022 Google LLC
|
|
@@ -296,7 +296,7 @@ function ee(e){return e.variant===Z.FIDELITY||e.variant===Z.CONTENT}function te(
|
|
|
296
296
|
* See the License for the specific language governing permissions and
|
|
297
297
|
* limitations under the License.
|
|
298
298
|
*/
|
|
299
|
-
class se{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 se.colorSpec.highestSurface(e)}primaryPaletteKeyColor(){return se.colorSpec.primaryPaletteKeyColor()}secondaryPaletteKeyColor(){return se.colorSpec.secondaryPaletteKeyColor()}tertiaryPaletteKeyColor(){return se.colorSpec.tertiaryPaletteKeyColor()}neutralPaletteKeyColor(){return se.colorSpec.neutralPaletteKeyColor()}neutralVariantPaletteKeyColor(){return se.colorSpec.neutralVariantPaletteKeyColor()}errorPaletteKeyColor(){return se.colorSpec.errorPaletteKeyColor()}background(){return se.colorSpec.background()}onBackground(){return se.colorSpec.onBackground()}surface(){return se.colorSpec.surface()}surfaceDim(){return se.colorSpec.surfaceDim()}surfaceBright(){return se.colorSpec.surfaceBright()}surfaceContainerLowest(){return se.colorSpec.surfaceContainerLowest()}surfaceContainerLow(){return se.colorSpec.surfaceContainerLow()}surfaceContainer(){return se.colorSpec.surfaceContainer()}surfaceContainerHigh(){return se.colorSpec.surfaceContainerHigh()}surfaceContainerHighest(){return se.colorSpec.surfaceContainerHighest()}onSurface(){return se.colorSpec.onSurface()}surfaceVariant(){return se.colorSpec.surfaceVariant()}onSurfaceVariant(){return se.colorSpec.onSurfaceVariant()}outline(){return se.colorSpec.outline()}outlineVariant(){return se.colorSpec.outlineVariant()}inverseSurface(){return se.colorSpec.inverseSurface()}inverseOnSurface(){return se.colorSpec.inverseOnSurface()}shadow(){return se.colorSpec.shadow()}scrim(){return se.colorSpec.scrim()}surfaceTint(){return se.colorSpec.surfaceTint()}primary(){return se.colorSpec.primary()}primaryDim(){return se.colorSpec.primaryDim()}onPrimary(){return se.colorSpec.onPrimary()}primaryContainer(){return se.colorSpec.primaryContainer()}onPrimaryContainer(){return se.colorSpec.onPrimaryContainer()}inversePrimary(){return se.colorSpec.inversePrimary()}primaryFixed(){return se.colorSpec.primaryFixed()}primaryFixedDim(){return se.colorSpec.primaryFixedDim()}onPrimaryFixed(){return se.colorSpec.onPrimaryFixed()}onPrimaryFixedVariant(){return se.colorSpec.onPrimaryFixedVariant()}secondary(){return se.colorSpec.secondary()}secondaryDim(){return se.colorSpec.secondaryDim()}onSecondary(){return se.colorSpec.onSecondary()}secondaryContainer(){return se.colorSpec.secondaryContainer()}onSecondaryContainer(){return se.colorSpec.onSecondaryContainer()}secondaryFixed(){return se.colorSpec.secondaryFixed()}secondaryFixedDim(){return se.colorSpec.secondaryFixedDim()}onSecondaryFixed(){return se.colorSpec.onSecondaryFixed()}onSecondaryFixedVariant(){return se.colorSpec.onSecondaryFixedVariant()}tertiary(){return se.colorSpec.tertiary()}tertiaryDim(){return se.colorSpec.tertiaryDim()}onTertiary(){return se.colorSpec.onTertiary()}tertiaryContainer(){return se.colorSpec.tertiaryContainer()}onTertiaryContainer(){return se.colorSpec.onTertiaryContainer()}tertiaryFixed(){return se.colorSpec.tertiaryFixed()}tertiaryFixedDim(){return se.colorSpec.tertiaryFixedDim()}onTertiaryFixed(){return se.colorSpec.onTertiaryFixed()}onTertiaryFixedVariant(){return se.colorSpec.onTertiaryFixedVariant()}error(){return se.colorSpec.error()}errorDim(){return se.colorSpec.errorDim()}onError(){return se.colorSpec.onError()}errorContainer(){return se.colorSpec.errorContainer()}onErrorContainer(){return se.colorSpec.onErrorContainer()}static highestSurface(e){return se.colorSpec.highestSurface(e)}}se.contentAccentToneDelta=15,se.colorSpec=new class extends re{surface(){const e=K.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>(super.surface().tone(e),"phone"===e.platform?e.isDark?4:O.isYellow(e.neutralPalette.hue)?99:e.variant===Z.VIBRANT?97:98:0),isBackground:!0});return z(super.surface(),"2025",e)}surfaceDim(){const e=K.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?4:O.isYellow(e.neutralPalette.hue)?90:e.variant===Z.VIBRANT?85:87,isBackground:!0,chromaMultiplier:e=>{if(!e.isDark){if(e.variant===Z.NEUTRAL)return 2.5;if(e.variant===Z.TONAL_SPOT)return 1.7;if(e.variant===Z.EXPRESSIVE)return O.isYellow(e.neutralPalette.hue)?2.7:1.75;if(e.variant===Z.VIBRANT)return 1.36}return 1}});return z(super.surfaceDim(),"2025",e)}surfaceBright(){const e=K.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?18:O.isYellow(e.neutralPalette.hue)?99:e.variant===Z.VIBRANT?97:98,isBackground:!0,chromaMultiplier:e=>{if(e.isDark){if(e.variant===Z.NEUTRAL)return 2.5;if(e.variant===Z.TONAL_SPOT)return 1.7;if(e.variant===Z.EXPRESSIVE)return O.isYellow(e.neutralPalette.hue)?2.7:1.75;if(e.variant===Z.VIBRANT)return 1.36}return 1}});return z(super.surfaceBright(),"2025",e)}surfaceContainerLowest(){const e=K.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?0:100,isBackground:!0});return z(super.surfaceContainerLowest(),"2025",e)}surfaceContainerLow(){const e=K.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>"phone"===e.platform?e.isDark?6:O.isYellow(e.neutralPalette.hue)?98:e.variant===Z.VIBRANT?95:96:15,isBackground:!0,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===Z.NEUTRAL)return 1.3;if(e.variant===Z.TONAL_SPOT)return 1.25;if(e.variant===Z.EXPRESSIVE)return O.isYellow(e.neutralPalette.hue)?1.3:1.15;if(e.variant===Z.VIBRANT)return 1.08}return 1}});return z(super.surfaceContainerLow(),"2025",e)}surfaceContainer(){const e=K.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>"phone"===e.platform?e.isDark?9:O.isYellow(e.neutralPalette.hue)?96:e.variant===Z.VIBRANT?92:94:20,isBackground:!0,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===Z.NEUTRAL)return 1.6;if(e.variant===Z.TONAL_SPOT)return 1.4;if(e.variant===Z.EXPRESSIVE)return O.isYellow(e.neutralPalette.hue)?1.6:1.3;if(e.variant===Z.VIBRANT)return 1.15}return 1}});return z(super.surfaceContainer(),"2025",e)}surfaceContainerHigh(){const e=K.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>"phone"===e.platform?e.isDark?12:O.isYellow(e.neutralPalette.hue)?94:e.variant===Z.VIBRANT?90:92:25,isBackground:!0,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===Z.NEUTRAL)return 1.9;if(e.variant===Z.TONAL_SPOT)return 1.5;if(e.variant===Z.EXPRESSIVE)return O.isYellow(e.neutralPalette.hue)?1.95:1.45;if(e.variant===Z.VIBRANT)return 1.22}return 1}});return z(super.surfaceContainerHigh(),"2025",e)}surfaceContainerHighest(){const e=K.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?15:O.isYellow(e.neutralPalette.hue)?92:e.variant===Z.VIBRANT?88:90,isBackground:!0,chromaMultiplier:e=>e.variant===Z.NEUTRAL?2.2:e.variant===Z.TONAL_SPOT?1.7:e.variant===Z.EXPRESSIVE?O.isYellow(e.neutralPalette.hue)?2.3:1.6:e.variant===Z.VIBRANT?1.29:1});return z(super.surfaceContainerHighest(),"2025",e)}onSurface(){const e=K.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.variant===Z.VIBRANT?ae(e.neutralPalette,0,100,1.1):K.getInitialToneFromBackground(e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh())(e),chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===Z.NEUTRAL)return 2.2;if(e.variant===Z.TONAL_SPOT)return 1.7;if(e.variant===Z.EXPRESSIVE)return O.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?ie(11):ie(9)});return z(super.onSurface(),"2025",e)}onSurfaceVariant(){const e=K.fromPalette({name:"on_surface_variant",palette:e=>e.neutralPalette,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===Z.NEUTRAL)return 2.2;if(e.variant===Z.TONAL_SPOT)return 1.7;if(e.variant===Z.EXPRESSIVE)return O.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?ie(6):ie(4.5):ie(7)});return z(super.onSurfaceVariant(),"2025",e)}outline(){const e=K.fromPalette({name:"outline",palette:e=>e.neutralPalette,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===Z.NEUTRAL)return 2.2;if(e.variant===Z.TONAL_SPOT)return 1.7;if(e.variant===Z.EXPRESSIVE)return O.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?ie(3):ie(4.5)});return z(super.outline(),"2025",e)}outlineVariant(){const e=K.fromPalette({name:"outline_variant",palette:e=>e.neutralPalette,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===Z.NEUTRAL)return 2.2;if(e.variant===Z.TONAL_SPOT)return 1.7;if(e.variant===Z.EXPRESSIVE)return O.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?ie(1.5):ie(3)});return z(super.outlineVariant(),"2025",e)}inverseSurface(){const e=K.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?98:4,isBackground:!0});return z(super.inverseSurface(),"2025",e)}inverseOnSurface(){const e=K.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,background:e=>this.inverseSurface(),contrastCurve:e=>ie(7)});return z(super.inverseOnSurface(),"2025",e)}primary(){const e=K.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>e.variant===Z.NEUTRAL?"phone"===e.platform?e.isDark?80:40:90:e.variant===Z.TONAL_SPOT?"phone"===e.platform?e.isDark?80:ae(e.primaryPalette):ae(e.primaryPalette,0,90):e.variant===Z.EXPRESSIVE?"phone"===e.platform?ae(e.primaryPalette,0,O.isYellow(e.primaryPalette.hue)?25:O.isCyan(e.primaryPalette.hue)?88:98):ae(e.primaryPalette):"phone"===e.platform?ae(e.primaryPalette,0,O.isCyan(e.primaryPalette.hue)?88:98):ae(e.primaryPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?ie(4.5):ie(7),toneDeltaPair:e=>"phone"===e.platform?new Q(this.primaryContainer(),this.primary(),5,"relative_lighter",!0,"farther"):void 0});return z(super.primary(),"2025",e)}primaryDim(){return K.fromPalette({name:"primary_dim",palette:e=>e.primaryPalette,tone:e=>e.variant===Z.NEUTRAL?85:e.variant===Z.TONAL_SPOT?ae(e.primaryPalette,0,90):ae(e.primaryPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>ie(4.5),toneDeltaPair:e=>new Q(this.primaryDim(),this.primary(),5,"darker",!0,"farther")})}onPrimary(){const e=K.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,background:e=>"phone"===e.platform?this.primary():this.primaryDim(),contrastCurve:e=>"phone"===e.platform?ie(6):ie(7)});return z(super.onPrimary(),"2025",e)}primaryContainer(){const e=K.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>"watch"===e.platform?30:e.variant===Z.NEUTRAL?e.isDark?30:90:e.variant===Z.TONAL_SPOT?e.isDark?ne(e.primaryPalette,35,93):ae(e.primaryPalette,0,90):e.variant===Z.EXPRESSIVE?e.isDark?ae(e.primaryPalette,30,93):ae(e.primaryPalette,78,O.isCyan(e.primaryPalette.hue)?88:90):e.isDark?ne(e.primaryPalette,66,93):ae(e.primaryPalette,66,O.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 Q(this.primaryContainer(),this.primaryDim(),10,"darker",!0,"farther"),contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ie(1.5):void 0});return z(super.primaryContainer(),"2025",e)}onPrimaryContainer(){const e=K.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,background:e=>this.primaryContainer(),contrastCurve:e=>"phone"===e.platform?ie(6):ie(7)});return z(super.onPrimaryContainer(),"2025",e)}primaryFixed(){const e=K.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?ie(1.5):void 0});return z(super.primaryFixed(),"2025",e)}primaryFixedDim(){const e=K.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>this.primaryFixed().getTone(e),isBackground:!0,toneDeltaPair:e=>new Q(this.primaryFixedDim(),this.primaryFixed(),5,"darker",!0,"exact")});return z(super.primaryFixedDim(),"2025",e)}onPrimaryFixed(){const e=K.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,background:e=>this.primaryFixedDim(),contrastCurve:e=>ie(7)});return z(super.onPrimaryFixed(),"2025",e)}onPrimaryFixedVariant(){const e=K.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,background:e=>this.primaryFixedDim(),contrastCurve:e=>ie(4.5)});return z(super.onPrimaryFixedVariant(),"2025",e)}inversePrimary(){const e=K.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>ae(e.primaryPalette),background:e=>this.inverseSurface(),contrastCurve:e=>"phone"===e.platform?ie(6):ie(7)});return z(super.inversePrimary(),"2025",e)}secondary(){const e=K.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>"watch"===e.platform?e.variant===Z.NEUTRAL?90:ae(e.secondaryPalette,0,90):e.variant===Z.NEUTRAL?e.isDark?ne(e.secondaryPalette,0,98):ae(e.secondaryPalette):e.variant===Z.VIBRANT?ae(e.secondaryPalette,0,e.isDark?90:98):e.isDark?80:ae(e.secondaryPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?ie(4.5):ie(7),toneDeltaPair:e=>"phone"===e.platform?new Q(this.secondaryContainer(),this.secondary(),5,"relative_lighter",!0,"farther"):void 0});return z(super.secondary(),"2025",e)}secondaryDim(){return K.fromPalette({name:"secondary_dim",palette:e=>e.secondaryPalette,tone:e=>e.variant===Z.NEUTRAL?85:ae(e.secondaryPalette,0,90),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>ie(4.5),toneDeltaPair:e=>new Q(this.secondaryDim(),this.secondary(),5,"darker",!0,"farther")})}onSecondary(){const e=K.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,background:e=>"phone"===e.platform?this.secondary():this.secondaryDim(),contrastCurve:e=>"phone"===e.platform?ie(6):ie(7)});return z(super.onSecondary(),"2025",e)}secondaryContainer(){const e=K.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>"watch"===e.platform?30:e.variant===Z.VIBRANT?e.isDark?ne(e.secondaryPalette,30,40):ae(e.secondaryPalette,84,90):e.variant===Z.EXPRESSIVE?e.isDark?15:ae(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 Q(this.secondaryContainer(),this.secondaryDim(),10,"darker",!0,"farther"):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ie(1.5):void 0});return z(super.secondaryContainer(),"2025",e)}onSecondaryContainer(){const e=K.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,background:e=>this.secondaryContainer(),contrastCurve:e=>"phone"===e.platform?ie(6):ie(7)});return z(super.onSecondaryContainer(),"2025",e)}secondaryFixed(){const e=K.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?ie(1.5):void 0});return z(super.secondaryFixed(),"2025",e)}secondaryFixedDim(){const e=K.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>this.secondaryFixed().getTone(e),isBackground:!0,toneDeltaPair:e=>new Q(this.secondaryFixedDim(),this.secondaryFixed(),5,"darker",!0,"exact")});return z(super.secondaryFixedDim(),"2025",e)}onSecondaryFixed(){const e=K.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,background:e=>this.secondaryFixedDim(),contrastCurve:e=>ie(7)});return z(super.onSecondaryFixed(),"2025",e)}onSecondaryFixedVariant(){const e=K.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,background:e=>this.secondaryFixedDim(),contrastCurve:e=>ie(4.5)});return z(super.onSecondaryFixedVariant(),"2025",e)}tertiary(){const e=K.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>"watch"===e.platform?e.variant===Z.TONAL_SPOT?ae(e.tertiaryPalette,0,90):ae(e.tertiaryPalette):e.variant===Z.EXPRESSIVE||e.variant===Z.VIBRANT?ae(e.tertiaryPalette,0,O.isCyan(e.tertiaryPalette.hue)?88:e.isDark?98:100):e.isDark?ae(e.tertiaryPalette,0,98):ae(e.tertiaryPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?ie(4.5):ie(7),toneDeltaPair:e=>"phone"===e.platform?new Q(this.tertiaryContainer(),this.tertiary(),5,"relative_lighter",!0,"farther"):void 0});return z(super.tertiary(),"2025",e)}tertiaryDim(){return K.fromPalette({name:"tertiary_dim",palette:e=>e.tertiaryPalette,tone:e=>e.variant===Z.TONAL_SPOT?ae(e.tertiaryPalette,0,90):ae(e.tertiaryPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>ie(4.5),toneDeltaPair:e=>new Q(this.tertiaryDim(),this.tertiary(),5,"darker",!0,"farther")})}onTertiary(){const e=K.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,background:e=>"phone"===e.platform?this.tertiary():this.tertiaryDim(),contrastCurve:e=>"phone"===e.platform?ie(6):ie(7)});return z(super.onTertiary(),"2025",e)}tertiaryContainer(){const e=K.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>"watch"===e.platform?e.variant===Z.TONAL_SPOT?ae(e.tertiaryPalette,0,90):ae(e.tertiaryPalette):e.variant===Z.NEUTRAL?e.isDark?ae(e.tertiaryPalette,0,93):ae(e.tertiaryPalette,0,96):e.variant===Z.TONAL_SPOT?ae(e.tertiaryPalette,0,e.isDark?93:100):e.variant===Z.EXPRESSIVE?ae(e.tertiaryPalette,75,O.isCyan(e.tertiaryPalette.hue)?88:e.isDark?93:100):e.isDark?ae(e.tertiaryPalette,0,93):ae(e.tertiaryPalette,72,100),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,toneDeltaPair:e=>"watch"===e.platform?new Q(this.tertiaryContainer(),this.tertiaryDim(),10,"darker",!0,"farther"):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ie(1.5):void 0});return z(super.tertiaryContainer(),"2025",e)}onTertiaryContainer(){const e=K.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,background:e=>this.tertiaryContainer(),contrastCurve:e=>"phone"===e.platform?ie(6):ie(7)});return z(super.onTertiaryContainer(),"2025",e)}tertiaryFixed(){const e=K.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?ie(1.5):void 0});return z(super.tertiaryFixed(),"2025",e)}tertiaryFixedDim(){const e=K.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>this.tertiaryFixed().getTone(e),isBackground:!0,toneDeltaPair:e=>new Q(this.tertiaryFixedDim(),this.tertiaryFixed(),5,"darker",!0,"exact")});return z(super.tertiaryFixedDim(),"2025",e)}onTertiaryFixed(){const e=K.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,background:e=>this.tertiaryFixedDim(),contrastCurve:e=>ie(7)});return z(super.onTertiaryFixed(),"2025",e)}onTertiaryFixedVariant(){const e=K.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,background:e=>this.tertiaryFixedDim(),contrastCurve:e=>ie(4.5)});return z(super.onTertiaryFixedVariant(),"2025",e)}error(){const e=K.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>"phone"===e.platform?e.isDark?ne(e.errorPalette,0,98):ae(e.errorPalette):ne(e.errorPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?ie(4.5):ie(7),toneDeltaPair:e=>"phone"===e.platform?new Q(this.errorContainer(),this.error(),5,"relative_lighter",!0,"farther"):void 0});return z(super.error(),"2025",e)}errorDim(){return K.fromPalette({name:"error_dim",palette:e=>e.errorPalette,tone:e=>ne(e.errorPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>ie(4.5),toneDeltaPair:e=>new Q(this.errorDim(),this.error(),5,"darker",!0,"farther")})}onError(){const e=K.fromPalette({name:"on_error",palette:e=>e.errorPalette,background:e=>"phone"===e.platform?this.error():this.errorDim(),contrastCurve:e=>"phone"===e.platform?ie(6):ie(7)});return z(super.onError(),"2025",e)}errorContainer(){const e=K.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>"watch"===e.platform?30:e.isDark?ne(e.errorPalette,30,93):ae(e.errorPalette,0,90),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,toneDeltaPair:e=>"watch"===e.platform?new Q(this.errorContainer(),this.errorDim(),10,"darker",!0,"farther"):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?ie(1.5):void 0});return z(super.errorContainer(),"2025",e)}onErrorContainer(){const e=K.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,background:e=>this.errorContainer(),contrastCurve:e=>"phone"===e.platform?ie(4.5):ie(7)});return z(super.onErrorContainer(),"2025",e)}surfaceVariant(){const e=Object.assign(this.surfaceContainerHighest().clone(),{name:"surface_variant"});return z(super.surfaceVariant(),"2025",e)}surfaceTint(){const e=Object.assign(this.primary().clone(),{name:"surface_tint"});return z(super.surfaceTint(),"2025",e)}background(){const e=Object.assign(this.surface().clone(),{name:"background"});return z(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 z(super.onBackground(),"2025",e)}},se.primaryPaletteKeyColor=se.colorSpec.primaryPaletteKeyColor(),se.secondaryPaletteKeyColor=se.colorSpec.secondaryPaletteKeyColor(),se.tertiaryPaletteKeyColor=se.colorSpec.tertiaryPaletteKeyColor(),se.neutralPaletteKeyColor=se.colorSpec.neutralPaletteKeyColor(),se.neutralVariantPaletteKeyColor=se.colorSpec.neutralVariantPaletteKeyColor(),se.background=se.colorSpec.background(),se.onBackground=se.colorSpec.onBackground(),se.surface=se.colorSpec.surface(),se.surfaceDim=se.colorSpec.surfaceDim(),se.surfaceBright=se.colorSpec.surfaceBright(),se.surfaceContainerLowest=se.colorSpec.surfaceContainerLowest(),se.surfaceContainerLow=se.colorSpec.surfaceContainerLow(),se.surfaceContainer=se.colorSpec.surfaceContainer(),se.surfaceContainerHigh=se.colorSpec.surfaceContainerHigh(),se.surfaceContainerHighest=se.colorSpec.surfaceContainerHighest(),se.onSurface=se.colorSpec.onSurface(),se.surfaceVariant=se.colorSpec.surfaceVariant(),se.onSurfaceVariant=se.colorSpec.onSurfaceVariant(),se.inverseSurface=se.colorSpec.inverseSurface(),se.inverseOnSurface=se.colorSpec.inverseOnSurface(),se.outline=se.colorSpec.outline(),se.outlineVariant=se.colorSpec.outlineVariant(),se.shadow=se.colorSpec.shadow(),se.scrim=se.colorSpec.scrim(),se.surfaceTint=se.colorSpec.surfaceTint(),se.primary=se.colorSpec.primary(),se.onPrimary=se.colorSpec.onPrimary(),se.primaryContainer=se.colorSpec.primaryContainer(),se.onPrimaryContainer=se.colorSpec.onPrimaryContainer(),se.inversePrimary=se.colorSpec.inversePrimary(),se.secondary=se.colorSpec.secondary(),se.onSecondary=se.colorSpec.onSecondary(),se.secondaryContainer=se.colorSpec.secondaryContainer(),se.onSecondaryContainer=se.colorSpec.onSecondaryContainer(),se.tertiary=se.colorSpec.tertiary(),se.onTertiary=se.colorSpec.onTertiary(),se.tertiaryContainer=se.colorSpec.tertiaryContainer(),se.onTertiaryContainer=se.colorSpec.onTertiaryContainer(),se.error=se.colorSpec.error(),se.onError=se.colorSpec.onError(),se.errorContainer=se.colorSpec.errorContainer(),se.onErrorContainer=se.colorSpec.onErrorContainer(),se.primaryFixed=se.colorSpec.primaryFixed(),se.primaryFixedDim=se.colorSpec.primaryFixedDim(),se.onPrimaryFixed=se.colorSpec.onPrimaryFixed(),se.onPrimaryFixedVariant=se.colorSpec.onPrimaryFixedVariant(),se.secondaryFixed=se.colorSpec.secondaryFixed(),se.secondaryFixedDim=se.colorSpec.secondaryFixedDim(),se.onSecondaryFixed=se.colorSpec.onSecondaryFixed(),se.onSecondaryFixedVariant=se.colorSpec.onSecondaryFixedVariant(),se.tertiaryFixed=se.colorSpec.tertiaryFixed(),se.tertiaryFixedDim=se.colorSpec.tertiaryFixedDim(),se.onTertiaryFixed=se.colorSpec.onTertiaryFixed(),se.onTertiaryFixedVariant=se.colorSpec.onTertiaryFixedVariant();
|
|
299
|
+
class ce{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 ce.colorSpec.highestSurface(e)}primaryPaletteKeyColor(){return ce.colorSpec.primaryPaletteKeyColor()}secondaryPaletteKeyColor(){return ce.colorSpec.secondaryPaletteKeyColor()}tertiaryPaletteKeyColor(){return ce.colorSpec.tertiaryPaletteKeyColor()}neutralPaletteKeyColor(){return ce.colorSpec.neutralPaletteKeyColor()}neutralVariantPaletteKeyColor(){return ce.colorSpec.neutralVariantPaletteKeyColor()}errorPaletteKeyColor(){return ce.colorSpec.errorPaletteKeyColor()}background(){return ce.colorSpec.background()}onBackground(){return ce.colorSpec.onBackground()}surface(){return ce.colorSpec.surface()}surfaceDim(){return ce.colorSpec.surfaceDim()}surfaceBright(){return ce.colorSpec.surfaceBright()}surfaceContainerLowest(){return ce.colorSpec.surfaceContainerLowest()}surfaceContainerLow(){return ce.colorSpec.surfaceContainerLow()}surfaceContainer(){return ce.colorSpec.surfaceContainer()}surfaceContainerHigh(){return ce.colorSpec.surfaceContainerHigh()}surfaceContainerHighest(){return ce.colorSpec.surfaceContainerHighest()}onSurface(){return ce.colorSpec.onSurface()}surfaceVariant(){return ce.colorSpec.surfaceVariant()}onSurfaceVariant(){return ce.colorSpec.onSurfaceVariant()}outline(){return ce.colorSpec.outline()}outlineVariant(){return ce.colorSpec.outlineVariant()}inverseSurface(){return ce.colorSpec.inverseSurface()}inverseOnSurface(){return ce.colorSpec.inverseOnSurface()}shadow(){return ce.colorSpec.shadow()}scrim(){return ce.colorSpec.scrim()}surfaceTint(){return ce.colorSpec.surfaceTint()}primary(){return ce.colorSpec.primary()}primaryDim(){return ce.colorSpec.primaryDim()}onPrimary(){return ce.colorSpec.onPrimary()}primaryContainer(){return ce.colorSpec.primaryContainer()}onPrimaryContainer(){return ce.colorSpec.onPrimaryContainer()}inversePrimary(){return ce.colorSpec.inversePrimary()}primaryFixed(){return ce.colorSpec.primaryFixed()}primaryFixedDim(){return ce.colorSpec.primaryFixedDim()}onPrimaryFixed(){return ce.colorSpec.onPrimaryFixed()}onPrimaryFixedVariant(){return ce.colorSpec.onPrimaryFixedVariant()}secondary(){return ce.colorSpec.secondary()}secondaryDim(){return ce.colorSpec.secondaryDim()}onSecondary(){return ce.colorSpec.onSecondary()}secondaryContainer(){return ce.colorSpec.secondaryContainer()}onSecondaryContainer(){return ce.colorSpec.onSecondaryContainer()}secondaryFixed(){return ce.colorSpec.secondaryFixed()}secondaryFixedDim(){return ce.colorSpec.secondaryFixedDim()}onSecondaryFixed(){return ce.colorSpec.onSecondaryFixed()}onSecondaryFixedVariant(){return ce.colorSpec.onSecondaryFixedVariant()}tertiary(){return ce.colorSpec.tertiary()}tertiaryDim(){return ce.colorSpec.tertiaryDim()}onTertiary(){return ce.colorSpec.onTertiary()}tertiaryContainer(){return ce.colorSpec.tertiaryContainer()}onTertiaryContainer(){return ce.colorSpec.onTertiaryContainer()}tertiaryFixed(){return ce.colorSpec.tertiaryFixed()}tertiaryFixedDim(){return ce.colorSpec.tertiaryFixedDim()}onTertiaryFixed(){return ce.colorSpec.onTertiaryFixed()}onTertiaryFixedVariant(){return ce.colorSpec.onTertiaryFixedVariant()}error(){return ce.colorSpec.error()}errorDim(){return ce.colorSpec.errorDim()}onError(){return ce.colorSpec.onError()}errorContainer(){return ce.colorSpec.errorContainer()}onErrorContainer(){return ce.colorSpec.onErrorContainer()}static highestSurface(e){return ce.colorSpec.highestSurface(e)}}ce.contentAccentToneDelta=15,ce.colorSpec=new class extends ae{surface(){const e=Y.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>(super.surface().tone(e),"phone"===e.platform?e.isDark?4:N.isYellow(e.neutralPalette.hue)?99:e.variant===ee.VIBRANT?97:98:0),isBackground:!0});return K(super.surface(),"2025",e)}surfaceDim(){const e=Y.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?4:N.isYellow(e.neutralPalette.hue)?90:e.variant===ee.VIBRANT?85:87,isBackground:!0,chromaMultiplier:e=>{if(!e.isDark){if(e.variant===ee.NEUTRAL)return 2.5;if(e.variant===ee.TONAL_SPOT)return 1.7;if(e.variant===ee.EXPRESSIVE)return N.isYellow(e.neutralPalette.hue)?2.7:1.75;if(e.variant===ee.VIBRANT)return 1.36}return 1}});return K(super.surfaceDim(),"2025",e)}surfaceBright(){const e=Y.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?18:N.isYellow(e.neutralPalette.hue)?99:e.variant===ee.VIBRANT?97:98,isBackground:!0,chromaMultiplier:e=>{if(e.isDark){if(e.variant===ee.NEUTRAL)return 2.5;if(e.variant===ee.TONAL_SPOT)return 1.7;if(e.variant===ee.EXPRESSIVE)return N.isYellow(e.neutralPalette.hue)?2.7:1.75;if(e.variant===ee.VIBRANT)return 1.36}return 1}});return K(super.surfaceBright(),"2025",e)}surfaceContainerLowest(){const e=Y.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?0:100,isBackground:!0});return K(super.surfaceContainerLowest(),"2025",e)}surfaceContainerLow(){const e=Y.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>"phone"===e.platform?e.isDark?6:N.isYellow(e.neutralPalette.hue)?98:e.variant===ee.VIBRANT?95:96:15,isBackground:!0,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===ee.NEUTRAL)return 1.3;if(e.variant===ee.TONAL_SPOT)return 1.25;if(e.variant===ee.EXPRESSIVE)return N.isYellow(e.neutralPalette.hue)?1.3:1.15;if(e.variant===ee.VIBRANT)return 1.08}return 1}});return K(super.surfaceContainerLow(),"2025",e)}surfaceContainer(){const e=Y.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>"phone"===e.platform?e.isDark?9:N.isYellow(e.neutralPalette.hue)?96:e.variant===ee.VIBRANT?92:94:20,isBackground:!0,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===ee.NEUTRAL)return 1.6;if(e.variant===ee.TONAL_SPOT)return 1.4;if(e.variant===ee.EXPRESSIVE)return N.isYellow(e.neutralPalette.hue)?1.6:1.3;if(e.variant===ee.VIBRANT)return 1.15}return 1}});return K(super.surfaceContainer(),"2025",e)}surfaceContainerHigh(){const e=Y.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>"phone"===e.platform?e.isDark?12:N.isYellow(e.neutralPalette.hue)?94:e.variant===ee.VIBRANT?90:92:25,isBackground:!0,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===ee.NEUTRAL)return 1.9;if(e.variant===ee.TONAL_SPOT)return 1.5;if(e.variant===ee.EXPRESSIVE)return N.isYellow(e.neutralPalette.hue)?1.95:1.45;if(e.variant===ee.VIBRANT)return 1.22}return 1}});return K(super.surfaceContainerHigh(),"2025",e)}surfaceContainerHighest(){const e=Y.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?15:N.isYellow(e.neutralPalette.hue)?92:e.variant===ee.VIBRANT?88:90,isBackground:!0,chromaMultiplier:e=>e.variant===ee.NEUTRAL?2.2:e.variant===ee.TONAL_SPOT?1.7:e.variant===ee.EXPRESSIVE?N.isYellow(e.neutralPalette.hue)?2.3:1.6:e.variant===ee.VIBRANT?1.29:1});return K(super.surfaceContainerHighest(),"2025",e)}onSurface(){const e=Y.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.variant===ee.VIBRANT?ne(e.neutralPalette,0,100,1.1):Y.getInitialToneFromBackground(e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh())(e),chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===ee.NEUTRAL)return 2.2;if(e.variant===ee.TONAL_SPOT)return 1.7;if(e.variant===ee.EXPRESSIVE)return N.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?se(11):se(9)});return K(super.onSurface(),"2025",e)}onSurfaceVariant(){const e=Y.fromPalette({name:"on_surface_variant",palette:e=>e.neutralPalette,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===ee.NEUTRAL)return 2.2;if(e.variant===ee.TONAL_SPOT)return 1.7;if(e.variant===ee.EXPRESSIVE)return N.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?se(6):se(4.5):se(7)});return K(super.onSurfaceVariant(),"2025",e)}outline(){const e=Y.fromPalette({name:"outline",palette:e=>e.neutralPalette,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===ee.NEUTRAL)return 2.2;if(e.variant===ee.TONAL_SPOT)return 1.7;if(e.variant===ee.EXPRESSIVE)return N.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?se(3):se(4.5)});return K(super.outline(),"2025",e)}outlineVariant(){const e=Y.fromPalette({name:"outline_variant",palette:e=>e.neutralPalette,chromaMultiplier:e=>{if("phone"===e.platform){if(e.variant===ee.NEUTRAL)return 2.2;if(e.variant===ee.TONAL_SPOT)return 1.7;if(e.variant===ee.EXPRESSIVE)return N.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?se(1.5):se(3)});return K(super.outlineVariant(),"2025",e)}inverseSurface(){const e=Y.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?98:4,isBackground:!0});return K(super.inverseSurface(),"2025",e)}inverseOnSurface(){const e=Y.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,background:e=>this.inverseSurface(),contrastCurve:e=>se(7)});return K(super.inverseOnSurface(),"2025",e)}primary(){const e=Y.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>e.variant===ee.NEUTRAL?"phone"===e.platform?e.isDark?80:40:90:e.variant===ee.TONAL_SPOT?"phone"===e.platform?e.isDark?80:ne(e.primaryPalette):ne(e.primaryPalette,0,90):e.variant===ee.EXPRESSIVE?"phone"===e.platform?ne(e.primaryPalette,0,N.isYellow(e.primaryPalette.hue)?25:N.isCyan(e.primaryPalette.hue)?88:98):ne(e.primaryPalette):"phone"===e.platform?ne(e.primaryPalette,0,N.isCyan(e.primaryPalette.hue)?88:98):ne(e.primaryPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?se(4.5):se(7),toneDeltaPair:e=>"phone"===e.platform?new Z(this.primaryContainer(),this.primary(),5,"relative_lighter",!0,"farther"):void 0});return K(super.primary(),"2025",e)}primaryDim(){return Y.fromPalette({name:"primary_dim",palette:e=>e.primaryPalette,tone:e=>e.variant===ee.NEUTRAL?85:e.variant===ee.TONAL_SPOT?ne(e.primaryPalette,0,90):ne(e.primaryPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>se(4.5),toneDeltaPair:e=>new Z(this.primaryDim(),this.primary(),5,"darker",!0,"farther")})}onPrimary(){const e=Y.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,background:e=>"phone"===e.platform?this.primary():this.primaryDim(),contrastCurve:e=>"phone"===e.platform?se(6):se(7)});return K(super.onPrimary(),"2025",e)}primaryContainer(){const e=Y.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>"watch"===e.platform?30:e.variant===ee.NEUTRAL?e.isDark?30:90:e.variant===ee.TONAL_SPOT?e.isDark?oe(e.primaryPalette,35,93):ne(e.primaryPalette,0,90):e.variant===ee.EXPRESSIVE?e.isDark?ne(e.primaryPalette,30,93):ne(e.primaryPalette,78,N.isCyan(e.primaryPalette.hue)?88:90):e.isDark?oe(e.primaryPalette,66,93):ne(e.primaryPalette,66,N.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 Z(this.primaryContainer(),this.primaryDim(),10,"darker",!0,"farther"),contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?se(1.5):void 0});return K(super.primaryContainer(),"2025",e)}onPrimaryContainer(){const e=Y.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,background:e=>this.primaryContainer(),contrastCurve:e=>"phone"===e.platform?se(6):se(7)});return K(super.onPrimaryContainer(),"2025",e)}primaryFixed(){const e=Y.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?se(1.5):void 0});return K(super.primaryFixed(),"2025",e)}primaryFixedDim(){const e=Y.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>this.primaryFixed().getTone(e),isBackground:!0,toneDeltaPair:e=>new Z(this.primaryFixedDim(),this.primaryFixed(),5,"darker",!0,"exact")});return K(super.primaryFixedDim(),"2025",e)}onPrimaryFixed(){const e=Y.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,background:e=>this.primaryFixedDim(),contrastCurve:e=>se(7)});return K(super.onPrimaryFixed(),"2025",e)}onPrimaryFixedVariant(){const e=Y.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,background:e=>this.primaryFixedDim(),contrastCurve:e=>se(4.5)});return K(super.onPrimaryFixedVariant(),"2025",e)}inversePrimary(){const e=Y.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>ne(e.primaryPalette),background:e=>this.inverseSurface(),contrastCurve:e=>"phone"===e.platform?se(6):se(7)});return K(super.inversePrimary(),"2025",e)}secondary(){const e=Y.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>"watch"===e.platform?e.variant===ee.NEUTRAL?90:ne(e.secondaryPalette,0,90):e.variant===ee.NEUTRAL?e.isDark?oe(e.secondaryPalette,0,98):ne(e.secondaryPalette):e.variant===ee.VIBRANT?ne(e.secondaryPalette,0,e.isDark?90:98):e.isDark?80:ne(e.secondaryPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?se(4.5):se(7),toneDeltaPair:e=>"phone"===e.platform?new Z(this.secondaryContainer(),this.secondary(),5,"relative_lighter",!0,"farther"):void 0});return K(super.secondary(),"2025",e)}secondaryDim(){return Y.fromPalette({name:"secondary_dim",palette:e=>e.secondaryPalette,tone:e=>e.variant===ee.NEUTRAL?85:ne(e.secondaryPalette,0,90),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>se(4.5),toneDeltaPair:e=>new Z(this.secondaryDim(),this.secondary(),5,"darker",!0,"farther")})}onSecondary(){const e=Y.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,background:e=>"phone"===e.platform?this.secondary():this.secondaryDim(),contrastCurve:e=>"phone"===e.platform?se(6):se(7)});return K(super.onSecondary(),"2025",e)}secondaryContainer(){const e=Y.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>"watch"===e.platform?30:e.variant===ee.VIBRANT?e.isDark?oe(e.secondaryPalette,30,40):ne(e.secondaryPalette,84,90):e.variant===ee.EXPRESSIVE?e.isDark?15:ne(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 Z(this.secondaryContainer(),this.secondaryDim(),10,"darker",!0,"farther"):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?se(1.5):void 0});return K(super.secondaryContainer(),"2025",e)}onSecondaryContainer(){const e=Y.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,background:e=>this.secondaryContainer(),contrastCurve:e=>"phone"===e.platform?se(6):se(7)});return K(super.onSecondaryContainer(),"2025",e)}secondaryFixed(){const e=Y.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?se(1.5):void 0});return K(super.secondaryFixed(),"2025",e)}secondaryFixedDim(){const e=Y.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>this.secondaryFixed().getTone(e),isBackground:!0,toneDeltaPair:e=>new Z(this.secondaryFixedDim(),this.secondaryFixed(),5,"darker",!0,"exact")});return K(super.secondaryFixedDim(),"2025",e)}onSecondaryFixed(){const e=Y.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,background:e=>this.secondaryFixedDim(),contrastCurve:e=>se(7)});return K(super.onSecondaryFixed(),"2025",e)}onSecondaryFixedVariant(){const e=Y.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,background:e=>this.secondaryFixedDim(),contrastCurve:e=>se(4.5)});return K(super.onSecondaryFixedVariant(),"2025",e)}tertiary(){const e=Y.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>"watch"===e.platform?e.variant===ee.TONAL_SPOT?ne(e.tertiaryPalette,0,90):ne(e.tertiaryPalette):e.variant===ee.EXPRESSIVE||e.variant===ee.VIBRANT?ne(e.tertiaryPalette,0,N.isCyan(e.tertiaryPalette.hue)?88:e.isDark?98:100):e.isDark?ne(e.tertiaryPalette,0,98):ne(e.tertiaryPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?se(4.5):se(7),toneDeltaPair:e=>"phone"===e.platform?new Z(this.tertiaryContainer(),this.tertiary(),5,"relative_lighter",!0,"farther"):void 0});return K(super.tertiary(),"2025",e)}tertiaryDim(){return Y.fromPalette({name:"tertiary_dim",palette:e=>e.tertiaryPalette,tone:e=>e.variant===ee.TONAL_SPOT?ne(e.tertiaryPalette,0,90):ne(e.tertiaryPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>se(4.5),toneDeltaPair:e=>new Z(this.tertiaryDim(),this.tertiary(),5,"darker",!0,"farther")})}onTertiary(){const e=Y.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,background:e=>"phone"===e.platform?this.tertiary():this.tertiaryDim(),contrastCurve:e=>"phone"===e.platform?se(6):se(7)});return K(super.onTertiary(),"2025",e)}tertiaryContainer(){const e=Y.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>"watch"===e.platform?e.variant===ee.TONAL_SPOT?ne(e.tertiaryPalette,0,90):ne(e.tertiaryPalette):e.variant===ee.NEUTRAL?e.isDark?ne(e.tertiaryPalette,0,93):ne(e.tertiaryPalette,0,96):e.variant===ee.TONAL_SPOT?ne(e.tertiaryPalette,0,e.isDark?93:100):e.variant===ee.EXPRESSIVE?ne(e.tertiaryPalette,75,N.isCyan(e.tertiaryPalette.hue)?88:e.isDark?93:100):e.isDark?ne(e.tertiaryPalette,0,93):ne(e.tertiaryPalette,72,100),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,toneDeltaPair:e=>"watch"===e.platform?new Z(this.tertiaryContainer(),this.tertiaryDim(),10,"darker",!0,"farther"):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?se(1.5):void 0});return K(super.tertiaryContainer(),"2025",e)}onTertiaryContainer(){const e=Y.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,background:e=>this.tertiaryContainer(),contrastCurve:e=>"phone"===e.platform?se(6):se(7)});return K(super.onTertiaryContainer(),"2025",e)}tertiaryFixed(){const e=Y.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?se(1.5):void 0});return K(super.tertiaryFixed(),"2025",e)}tertiaryFixedDim(){const e=Y.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>this.tertiaryFixed().getTone(e),isBackground:!0,toneDeltaPair:e=>new Z(this.tertiaryFixedDim(),this.tertiaryFixed(),5,"darker",!0,"exact")});return K(super.tertiaryFixedDim(),"2025",e)}onTertiaryFixed(){const e=Y.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,background:e=>this.tertiaryFixedDim(),contrastCurve:e=>se(7)});return K(super.onTertiaryFixed(),"2025",e)}onTertiaryFixedVariant(){const e=Y.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,background:e=>this.tertiaryFixedDim(),contrastCurve:e=>se(4.5)});return K(super.onTertiaryFixedVariant(),"2025",e)}error(){const e=Y.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>"phone"===e.platform?e.isDark?oe(e.errorPalette,0,98):ne(e.errorPalette):oe(e.errorPalette),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):this.surfaceContainerHigh(),contrastCurve:e=>"phone"===e.platform?se(4.5):se(7),toneDeltaPair:e=>"phone"===e.platform?new Z(this.errorContainer(),this.error(),5,"relative_lighter",!0,"farther"):void 0});return K(super.error(),"2025",e)}errorDim(){return Y.fromPalette({name:"error_dim",palette:e=>e.errorPalette,tone:e=>oe(e.errorPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>se(4.5),toneDeltaPair:e=>new Z(this.errorDim(),this.error(),5,"darker",!0,"farther")})}onError(){const e=Y.fromPalette({name:"on_error",palette:e=>e.errorPalette,background:e=>"phone"===e.platform?this.error():this.errorDim(),contrastCurve:e=>"phone"===e.platform?se(6):se(7)});return K(super.onError(),"2025",e)}errorContainer(){const e=Y.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>"watch"===e.platform?30:e.isDark?oe(e.errorPalette,30,93):ne(e.errorPalette,0,90),isBackground:!0,background:e=>"phone"===e.platform?this.highestSurface(e):void 0,toneDeltaPair:e=>"watch"===e.platform?new Z(this.errorContainer(),this.errorDim(),10,"darker",!0,"farther"):void 0,contrastCurve:e=>"phone"===e.platform&&e.contrastLevel>0?se(1.5):void 0});return K(super.errorContainer(),"2025",e)}onErrorContainer(){const e=Y.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,background:e=>this.errorContainer(),contrastCurve:e=>"phone"===e.platform?se(4.5):se(7)});return K(super.onErrorContainer(),"2025",e)}surfaceVariant(){const e=Object.assign(this.surfaceContainerHighest().clone(),{name:"surface_variant"});return K(super.surfaceVariant(),"2025",e)}surfaceTint(){const e=Object.assign(this.primary().clone(),{name:"surface_tint"});return K(super.surfaceTint(),"2025",e)}background(){const e=Object.assign(this.surface().clone(),{name:"background"});return K(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 K(super.onBackground(),"2025",e)}},ce.primaryPaletteKeyColor=ce.colorSpec.primaryPaletteKeyColor(),ce.secondaryPaletteKeyColor=ce.colorSpec.secondaryPaletteKeyColor(),ce.tertiaryPaletteKeyColor=ce.colorSpec.tertiaryPaletteKeyColor(),ce.neutralPaletteKeyColor=ce.colorSpec.neutralPaletteKeyColor(),ce.neutralVariantPaletteKeyColor=ce.colorSpec.neutralVariantPaletteKeyColor(),ce.background=ce.colorSpec.background(),ce.onBackground=ce.colorSpec.onBackground(),ce.surface=ce.colorSpec.surface(),ce.surfaceDim=ce.colorSpec.surfaceDim(),ce.surfaceBright=ce.colorSpec.surfaceBright(),ce.surfaceContainerLowest=ce.colorSpec.surfaceContainerLowest(),ce.surfaceContainerLow=ce.colorSpec.surfaceContainerLow(),ce.surfaceContainer=ce.colorSpec.surfaceContainer(),ce.surfaceContainerHigh=ce.colorSpec.surfaceContainerHigh(),ce.surfaceContainerHighest=ce.colorSpec.surfaceContainerHighest(),ce.onSurface=ce.colorSpec.onSurface(),ce.surfaceVariant=ce.colorSpec.surfaceVariant(),ce.onSurfaceVariant=ce.colorSpec.onSurfaceVariant(),ce.inverseSurface=ce.colorSpec.inverseSurface(),ce.inverseOnSurface=ce.colorSpec.inverseOnSurface(),ce.outline=ce.colorSpec.outline(),ce.outlineVariant=ce.colorSpec.outlineVariant(),ce.shadow=ce.colorSpec.shadow(),ce.scrim=ce.colorSpec.scrim(),ce.surfaceTint=ce.colorSpec.surfaceTint(),ce.primary=ce.colorSpec.primary(),ce.onPrimary=ce.colorSpec.onPrimary(),ce.primaryContainer=ce.colorSpec.primaryContainer(),ce.onPrimaryContainer=ce.colorSpec.onPrimaryContainer(),ce.inversePrimary=ce.colorSpec.inversePrimary(),ce.secondary=ce.colorSpec.secondary(),ce.onSecondary=ce.colorSpec.onSecondary(),ce.secondaryContainer=ce.colorSpec.secondaryContainer(),ce.onSecondaryContainer=ce.colorSpec.onSecondaryContainer(),ce.tertiary=ce.colorSpec.tertiary(),ce.onTertiary=ce.colorSpec.onTertiary(),ce.tertiaryContainer=ce.colorSpec.tertiaryContainer(),ce.onTertiaryContainer=ce.colorSpec.onTertiaryContainer(),ce.error=ce.colorSpec.error(),ce.onError=ce.colorSpec.onError(),ce.errorContainer=ce.colorSpec.errorContainer(),ce.onErrorContainer=ce.colorSpec.onErrorContainer(),ce.primaryFixed=ce.colorSpec.primaryFixed(),ce.primaryFixedDim=ce.colorSpec.primaryFixedDim(),ce.onPrimaryFixed=ce.colorSpec.onPrimaryFixed(),ce.onPrimaryFixedVariant=ce.colorSpec.onPrimaryFixedVariant(),ce.secondaryFixed=ce.colorSpec.secondaryFixed(),ce.secondaryFixedDim=ce.colorSpec.secondaryFixedDim(),ce.onSecondaryFixed=ce.colorSpec.onSecondaryFixed(),ce.onSecondaryFixedVariant=ce.colorSpec.onSecondaryFixedVariant(),ce.tertiaryFixed=ce.colorSpec.tertiaryFixed(),ce.tertiaryFixedDim=ce.colorSpec.tertiaryFixedDim(),ce.onTertiaryFixed=ce.colorSpec.onTertiaryFixed(),ce.onTertiaryFixedVariant=ce.colorSpec.onTertiaryFixedVariant();
|
|
300
300
|
/**
|
|
301
301
|
* @license
|
|
302
302
|
* Copyright 2022 Google LLC
|
|
@@ -313,7 +313,7 @@ class se{constructor(){this.allColors=[this.background(),this.onBackground(),thi
|
|
|
313
313
|
* See the License for the specific language governing permissions and
|
|
314
314
|
* limitations under the License.
|
|
315
315
|
*/
|
|
316
|
-
class ce{static maybeFallbackSpecVersion(e,t){switch(t){case Z.EXPRESSIVE:case Z.VIBRANT:case Z.TONAL_SPOT:case Z.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=ce.maybeFallbackSpecVersion(e.specVersion??"2021",this.variant),this.sourceColorHct=e.sourceColorHct,this.primaryPalette=e.primaryPalette??de(this.specVersion).getPrimaryPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.secondaryPalette=e.secondaryPalette??de(this.specVersion).getSecondaryPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.tertiaryPalette=e.tertiaryPalette??de(this.specVersion).getTertiaryPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.neutralPalette=e.neutralPalette??de(this.specVersion).getNeutralPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.neutralVariantPalette=e.neutralVariantPalette??de(this.specVersion).getNeutralVariantPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.errorPalette=e.errorPalette??de(this.specVersion).getErrorPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel)??X.fromHueAndChroma(25,84),this.colors=new se}toString(){return`Scheme: variant=${Z[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 p(r[e]);return n}static getRotatedHue(e,t,r){let a=ce.getPiecewiseHue(e,t,r);return Math.min(t.length-1,r.length)<=0&&(a=0),p(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())}}ce.DEFAULT_SPEC_VERSION="2021",ce.DEFAULT_PLATFORM="phone";class ue{getPrimaryPalette(e,t,r,a,n){switch(e){case Z.CONTENT:case Z.FIDELITY:return X.fromHueAndChroma(t.hue,t.chroma);case Z.FRUIT_SALAD:return X.fromHueAndChroma(p(t.hue-50),48);case Z.MONOCHROME:return X.fromHueAndChroma(t.hue,0);case Z.NEUTRAL:return X.fromHueAndChroma(t.hue,12);case Z.RAINBOW:return X.fromHueAndChroma(t.hue,48);case Z.TONAL_SPOT:return X.fromHueAndChroma(t.hue,36);case Z.EXPRESSIVE:return X.fromHueAndChroma(p(t.hue+240),40);case Z.VIBRANT:return X.fromHueAndChroma(t.hue,200);default:throw new Error(`Unsupported variant: ${e}`)}}getSecondaryPalette(e,t,r,a,n){switch(e){case Z.CONTENT:case Z.FIDELITY:return X.fromHueAndChroma(t.hue,Math.max(t.chroma-32,.5*t.chroma));case Z.FRUIT_SALAD:return X.fromHueAndChroma(p(t.hue-50),36);case Z.MONOCHROME:return X.fromHueAndChroma(t.hue,0);case Z.NEUTRAL:return X.fromHueAndChroma(t.hue,8);case Z.RAINBOW:case Z.TONAL_SPOT:return X.fromHueAndChroma(t.hue,16);case Z.EXPRESSIVE:return X.fromHueAndChroma(ce.getRotatedHue(t,[0,21,51,121,151,191,271,321,360],[45,95,45,20,45,90,45,45,45]),24);case Z.VIBRANT:return X.fromHueAndChroma(ce.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 Z.CONTENT:return X.fromHct($.fixIfDisliked(new j(t).analogous(3,6)[2]));case Z.FIDELITY:return X.fromHct($.fixIfDisliked(new j(t).complement));case Z.FRUIT_SALAD:return X.fromHueAndChroma(t.hue,36);case Z.MONOCHROME:return X.fromHueAndChroma(t.hue,0);case Z.NEUTRAL:return X.fromHueAndChroma(t.hue,16);case Z.RAINBOW:case Z.TONAL_SPOT:return X.fromHueAndChroma(p(t.hue+60),24);case Z.EXPRESSIVE:return X.fromHueAndChroma(ce.getRotatedHue(t,[0,21,51,121,151,191,271,321,360],[120,120,20,45,20,15,20,120,120]),32);case Z.VIBRANT:return X.fromHueAndChroma(ce.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 Z.CONTENT:case Z.FIDELITY:return X.fromHueAndChroma(t.hue,t.chroma/8);case Z.FRUIT_SALAD:return X.fromHueAndChroma(t.hue,10);case Z.MONOCHROME:return X.fromHueAndChroma(t.hue,0);case Z.NEUTRAL:return X.fromHueAndChroma(t.hue,2);case Z.RAINBOW:return X.fromHueAndChroma(t.hue,0);case Z.TONAL_SPOT:return X.fromHueAndChroma(t.hue,6);case Z.EXPRESSIVE:return X.fromHueAndChroma(p(t.hue+15),8);case Z.VIBRANT:return X.fromHueAndChroma(t.hue,10);default:throw new Error(`Unsupported variant: ${e}`)}}getNeutralVariantPalette(e,t,r,a,n){switch(e){case Z.CONTENT:case Z.FIDELITY:return X.fromHueAndChroma(t.hue,t.chroma/8+4);case Z.FRUIT_SALAD:return X.fromHueAndChroma(t.hue,16);case Z.MONOCHROME:return X.fromHueAndChroma(t.hue,0);case Z.NEUTRAL:return X.fromHueAndChroma(t.hue,2);case Z.RAINBOW:return X.fromHueAndChroma(t.hue,0);case Z.TONAL_SPOT:return X.fromHueAndChroma(t.hue,8);case Z.EXPRESSIVE:return X.fromHueAndChroma(p(t.hue+15),12);case Z.VIBRANT:return X.fromHueAndChroma(t.hue,12);default:throw new Error(`Unsupported variant: ${e}`)}}getErrorPalette(e,t,r,a,n){}}class he extends ue{getPrimaryPalette(e,t,r,a,n){switch(e){case Z.NEUTRAL:return X.fromHueAndChroma(t.hue,"phone"===a?O.isBlue(t.hue)?12:8:O.isBlue(t.hue)?16:12);case Z.TONAL_SPOT:return X.fromHueAndChroma(t.hue,"phone"===a&&r?26:32);case Z.EXPRESSIVE:return X.fromHueAndChroma(t.hue,"phone"===a?r?36:48:40);case Z.VIBRANT:return X.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 Z.NEUTRAL:return X.fromHueAndChroma(t.hue,"phone"===a?O.isBlue(t.hue)?6:4:O.isBlue(t.hue)?10:6);case Z.TONAL_SPOT:return X.fromHueAndChroma(t.hue,16);case Z.EXPRESSIVE:return X.fromHueAndChroma(ce.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 Z.VIBRANT:return X.fromHueAndChroma(ce.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 Z.NEUTRAL:return X.fromHueAndChroma(ce.getRotatedHue(t,[0,38,105,161,204,278,333,360],[-32,26,10,-39,24,-15,-32]),"phone"===a?20:36);case Z.TONAL_SPOT:return X.fromHueAndChroma(ce.getRotatedHue(t,[0,20,71,161,333,360],[-40,48,-32,40,-32]),"phone"===a?28:32);case Z.EXPRESSIVE:return X.fromHueAndChroma(ce.getRotatedHue(t,[0,105,140,204,253,278,300,333,360],[-165,160,-105,101,-101,-160,-170,-165]),48);case Z.VIBRANT:return X.fromHueAndChroma(ce.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 ce.getRotatedHue(e,[0,71,124,253,278,300,360],[10,0,10,0,10,0])}static getExpressiveNeutralChroma(e,t,r){const a=he.getExpressiveNeutralHue(e);return"phone"===r?t?O.isYellow(a)?6:14:18:12}static getVibrantNeutralHue(e){return ce.getRotatedHue(e,[0,38,105,140,333,360],[-14,10,-14,10,-14])}static getVibrantNeutralChroma(e,t){const r=he.getVibrantNeutralHue(e);return"phone"===t||O.isBlue(r)?28:20}getNeutralPalette(e,t,r,a,n){switch(e){case Z.NEUTRAL:return X.fromHueAndChroma(t.hue,"phone"===a?1.4:6);case Z.TONAL_SPOT:return X.fromHueAndChroma(t.hue,"phone"===a?5:10);case Z.EXPRESSIVE:return X.fromHueAndChroma(he.getExpressiveNeutralHue(t),he.getExpressiveNeutralChroma(t,r,a));case Z.VIBRANT:return X.fromHueAndChroma(he.getVibrantNeutralHue(t),he.getVibrantNeutralChroma(t,a));default:return super.getNeutralPalette(e,t,r,a,n)}}getNeutralVariantPalette(e,t,r,a,n){switch(e){case Z.NEUTRAL:return X.fromHueAndChroma(t.hue,2.2*("phone"===a?1.4:6));case Z.TONAL_SPOT:return X.fromHueAndChroma(t.hue,1.7*("phone"===a?5:10));case Z.EXPRESSIVE:const o=he.getExpressiveNeutralHue(t),i=he.getExpressiveNeutralChroma(t,r,a);return X.fromHueAndChroma(o,i*(o>=105&&o<125?1.6:2.3));case Z.VIBRANT:const s=he.getVibrantNeutralHue(t),c=he.getVibrantNeutralChroma(t,a);return X.fromHueAndChroma(s,1.29*c);default:return super.getNeutralVariantPalette(e,t,r,a,n)}}getErrorPalette(e,t,r,a,n){const o=ce.getPiecewiseHue(t,[0,3,13,23,33,43,153,273,360],[12,22,32,12,22,32,22,12]);switch(e){case Z.NEUTRAL:return X.fromHueAndChroma(o,"phone"===a?50:40);case Z.TONAL_SPOT:return X.fromHueAndChroma(o,"phone"===a?60:48);case Z.EXPRESSIVE:return X.fromHueAndChroma(o,"phone"===a?64:48);case Z.VIBRANT:return X.fromHueAndChroma(o,"phone"===a?80:60);default:return super.getErrorPalette(e,t,r,a,n)}}}const le=new ue,me=new he;function de(e){return"2025"===e?me:le}
|
|
316
|
+
class ue{static maybeFallbackSpecVersion(e,t){switch(t){case ee.EXPRESSIVE:case ee.VIBRANT:case ee.TONAL_SPOT:case ee.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=ue.maybeFallbackSpecVersion(e.specVersion??"2021",this.variant),this.sourceColorHct=e.sourceColorHct,this.primaryPalette=e.primaryPalette??fe(this.specVersion).getPrimaryPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.secondaryPalette=e.secondaryPalette??fe(this.specVersion).getSecondaryPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.tertiaryPalette=e.tertiaryPalette??fe(this.specVersion).getTertiaryPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.neutralPalette=e.neutralPalette??fe(this.specVersion).getNeutralPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.neutralVariantPalette=e.neutralVariantPalette??fe(this.specVersion).getNeutralVariantPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel),this.errorPalette=e.errorPalette??fe(this.specVersion).getErrorPalette(this.variant,e.sourceColorHct,this.isDark,this.platform,this.contrastLevel)??W.fromHueAndChroma(25,84),this.colors=new ce}toString(){return`Scheme: variant=${ee[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 g(r[e]);return n}static getRotatedHue(e,t,r){let a=ue.getPiecewiseHue(e,t,r);return Math.min(t.length-1,r.length)<=0&&(a=0),g(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())}}ue.DEFAULT_SPEC_VERSION="2021",ue.DEFAULT_PLATFORM="phone";class he{getPrimaryPalette(e,t,r,a,n){switch(e){case ee.CONTENT:case ee.FIDELITY:return W.fromHueAndChroma(t.hue,t.chroma);case ee.FRUIT_SALAD:return W.fromHueAndChroma(g(t.hue-50),48);case ee.MONOCHROME:return W.fromHueAndChroma(t.hue,0);case ee.NEUTRAL:return W.fromHueAndChroma(t.hue,12);case ee.RAINBOW:return W.fromHueAndChroma(t.hue,48);case ee.TONAL_SPOT:return W.fromHueAndChroma(t.hue,36);case ee.EXPRESSIVE:return W.fromHueAndChroma(g(t.hue+240),40);case ee.VIBRANT:return W.fromHueAndChroma(t.hue,200);default:throw new Error(`Unsupported variant: ${e}`)}}getSecondaryPalette(e,t,r,a,n){switch(e){case ee.CONTENT:case ee.FIDELITY:return W.fromHueAndChroma(t.hue,Math.max(t.chroma-32,.5*t.chroma));case ee.FRUIT_SALAD:return W.fromHueAndChroma(g(t.hue-50),36);case ee.MONOCHROME:return W.fromHueAndChroma(t.hue,0);case ee.NEUTRAL:return W.fromHueAndChroma(t.hue,8);case ee.RAINBOW:case ee.TONAL_SPOT:return W.fromHueAndChroma(t.hue,16);case ee.EXPRESSIVE:return W.fromHueAndChroma(ue.getRotatedHue(t,[0,21,51,121,151,191,271,321,360],[45,95,45,20,45,90,45,45,45]),24);case ee.VIBRANT:return W.fromHueAndChroma(ue.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 ee.CONTENT:return W.fromHct($.fixIfDisliked(new J(t).analogous(3,6)[2]));case ee.FIDELITY:return W.fromHct($.fixIfDisliked(new J(t).complement));case ee.FRUIT_SALAD:return W.fromHueAndChroma(t.hue,36);case ee.MONOCHROME:return W.fromHueAndChroma(t.hue,0);case ee.NEUTRAL:return W.fromHueAndChroma(t.hue,16);case ee.RAINBOW:case ee.TONAL_SPOT:return W.fromHueAndChroma(g(t.hue+60),24);case ee.EXPRESSIVE:return W.fromHueAndChroma(ue.getRotatedHue(t,[0,21,51,121,151,191,271,321,360],[120,120,20,45,20,15,20,120,120]),32);case ee.VIBRANT:return W.fromHueAndChroma(ue.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 ee.CONTENT:case ee.FIDELITY:return W.fromHueAndChroma(t.hue,t.chroma/8);case ee.FRUIT_SALAD:return W.fromHueAndChroma(t.hue,10);case ee.MONOCHROME:return W.fromHueAndChroma(t.hue,0);case ee.NEUTRAL:return W.fromHueAndChroma(t.hue,2);case ee.RAINBOW:return W.fromHueAndChroma(t.hue,0);case ee.TONAL_SPOT:return W.fromHueAndChroma(t.hue,6);case ee.EXPRESSIVE:return W.fromHueAndChroma(g(t.hue+15),8);case ee.VIBRANT:return W.fromHueAndChroma(t.hue,10);default:throw new Error(`Unsupported variant: ${e}`)}}getNeutralVariantPalette(e,t,r,a,n){switch(e){case ee.CONTENT:case ee.FIDELITY:return W.fromHueAndChroma(t.hue,t.chroma/8+4);case ee.FRUIT_SALAD:return W.fromHueAndChroma(t.hue,16);case ee.MONOCHROME:return W.fromHueAndChroma(t.hue,0);case ee.NEUTRAL:return W.fromHueAndChroma(t.hue,2);case ee.RAINBOW:return W.fromHueAndChroma(t.hue,0);case ee.TONAL_SPOT:return W.fromHueAndChroma(t.hue,8);case ee.EXPRESSIVE:return W.fromHueAndChroma(g(t.hue+15),12);case ee.VIBRANT:return W.fromHueAndChroma(t.hue,12);default:throw new Error(`Unsupported variant: ${e}`)}}getErrorPalette(e,t,r,a,n){}}class le extends he{getPrimaryPalette(e,t,r,a,n){switch(e){case ee.NEUTRAL:return W.fromHueAndChroma(t.hue,"phone"===a?N.isBlue(t.hue)?12:8:N.isBlue(t.hue)?16:12);case ee.TONAL_SPOT:return W.fromHueAndChroma(t.hue,"phone"===a&&r?26:32);case ee.EXPRESSIVE:return W.fromHueAndChroma(t.hue,"phone"===a?r?36:48:40);case ee.VIBRANT:return W.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 ee.NEUTRAL:return W.fromHueAndChroma(t.hue,"phone"===a?N.isBlue(t.hue)?6:4:N.isBlue(t.hue)?10:6);case ee.TONAL_SPOT:return W.fromHueAndChroma(t.hue,16);case ee.EXPRESSIVE:return W.fromHueAndChroma(ue.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 ee.VIBRANT:return W.fromHueAndChroma(ue.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 ee.NEUTRAL:return W.fromHueAndChroma(ue.getRotatedHue(t,[0,38,105,161,204,278,333,360],[-32,26,10,-39,24,-15,-32]),"phone"===a?20:36);case ee.TONAL_SPOT:return W.fromHueAndChroma(ue.getRotatedHue(t,[0,20,71,161,333,360],[-40,48,-32,40,-32]),"phone"===a?28:32);case ee.EXPRESSIVE:return W.fromHueAndChroma(ue.getRotatedHue(t,[0,105,140,204,253,278,300,333,360],[-165,160,-105,101,-101,-160,-170,-165]),48);case ee.VIBRANT:return W.fromHueAndChroma(ue.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 ue.getRotatedHue(e,[0,71,124,253,278,300,360],[10,0,10,0,10,0])}static getExpressiveNeutralChroma(e,t,r){const a=le.getExpressiveNeutralHue(e);return"phone"===r?t?N.isYellow(a)?6:14:18:12}static getVibrantNeutralHue(e){return ue.getRotatedHue(e,[0,38,105,140,333,360],[-14,10,-14,10,-14])}static getVibrantNeutralChroma(e,t){const r=le.getVibrantNeutralHue(e);return"phone"===t||N.isBlue(r)?28:20}getNeutralPalette(e,t,r,a,n){switch(e){case ee.NEUTRAL:return W.fromHueAndChroma(t.hue,"phone"===a?1.4:6);case ee.TONAL_SPOT:return W.fromHueAndChroma(t.hue,"phone"===a?5:10);case ee.EXPRESSIVE:return W.fromHueAndChroma(le.getExpressiveNeutralHue(t),le.getExpressiveNeutralChroma(t,r,a));case ee.VIBRANT:return W.fromHueAndChroma(le.getVibrantNeutralHue(t),le.getVibrantNeutralChroma(t,a));default:return super.getNeutralPalette(e,t,r,a,n)}}getNeutralVariantPalette(e,t,r,a,n){switch(e){case ee.NEUTRAL:return W.fromHueAndChroma(t.hue,2.2*("phone"===a?1.4:6));case ee.TONAL_SPOT:return W.fromHueAndChroma(t.hue,1.7*("phone"===a?5:10));case ee.EXPRESSIVE:const o=le.getExpressiveNeutralHue(t),i=le.getExpressiveNeutralChroma(t,r,a);return W.fromHueAndChroma(o,i*(o>=105&&o<125?1.6:2.3));case ee.VIBRANT:const s=le.getVibrantNeutralHue(t),c=le.getVibrantNeutralChroma(t,a);return W.fromHueAndChroma(s,1.29*c);default:return super.getNeutralVariantPalette(e,t,r,a,n)}}getErrorPalette(e,t,r,a,n){const o=ue.getPiecewiseHue(t,[0,3,13,23,33,43,153,273,360],[12,22,32,12,22,32,22,12]);switch(e){case ee.NEUTRAL:return W.fromHueAndChroma(o,"phone"===a?50:40);case ee.TONAL_SPOT:return W.fromHueAndChroma(o,"phone"===a?60:48);case ee.EXPRESSIVE:return W.fromHueAndChroma(o,"phone"===a?64:48);case ee.VIBRANT:return W.fromHueAndChroma(o,"phone"===a?80:60);default:return super.getErrorPalette(e,t,r,a,n)}}}const me=new he,de=new le;function fe(e){return"2025"===e?de:me}
|
|
317
317
|
/**
|
|
318
318
|
* @license
|
|
319
319
|
* Copyright 2021 Google LLC
|
|
@@ -329,7 +329,7 @@ class ce{static maybeFallbackSpecVersion(e,t){switch(t){case Z.EXPRESSIVE:case Z
|
|
|
329
329
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
330
330
|
* See the License for the specific language governing permissions and
|
|
331
331
|
* limitations under the License.
|
|
332
|
-
*/class
|
|
332
|
+
*/class pe{static of(e){return new pe(e,!1)}static contentOf(e){return new pe(e,!0)}static fromColors(e){return pe.createPaletteFromColors(!1,e)}static contentFromColors(e){return pe.createPaletteFromColors(!0,e)}static createPaletteFromColors(e,t){const r=new pe(t.primary,e);if(t.secondary){const a=new pe(t.secondary,e);r.a2=a.a1}if(t.tertiary){const a=new pe(t.tertiary,e);r.a3=a.a1}if(t.error){const a=new pe(t.error,e);r.error=a.a1}if(t.neutral){const a=new pe(t.neutral,e);r.n1=a.n1}if(t.neutralVariant){const a=new pe(t.neutralVariant,e);r.n2=a.n2}return r}constructor(e,t){const r=N.fromInt(e),a=r.hue,n=r.chroma;t?(this.a1=W.fromHueAndChroma(a,n),this.a2=W.fromHueAndChroma(a,n/3),this.a3=W.fromHueAndChroma(a+60,n/2),this.n1=W.fromHueAndChroma(a,Math.min(n/12,4)),this.n2=W.fromHueAndChroma(a,Math.min(n/6,8))):(this.a1=W.fromHueAndChroma(a,Math.max(48,n)),this.a2=W.fromHueAndChroma(a,16),this.a3=W.fromHueAndChroma(a+60,24),this.n1=W.fromHueAndChroma(a,4),this.n2=W.fromHueAndChroma(a,8)),this.error=W.fromHueAndChroma(25,84)}}
|
|
333
333
|
/**
|
|
334
334
|
* @license
|
|
335
335
|
* Copyright 2021 Google LLC
|
|
@@ -345,7 +345,7 @@ class ce{static maybeFallbackSpecVersion(e,t){switch(t){case Z.EXPRESSIVE:case Z
|
|
|
345
345
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
346
346
|
* See the License for the specific language governing permissions and
|
|
347
347
|
* limitations under the License.
|
|
348
|
-
*/class
|
|
348
|
+
*/class ge{fromInt(e){return M(e)}toInt(e){return function(e,t,r){const a=S,n=(e+16)/116,o=n-r/200,i=R(t/500+n),s=R(n),c=R(o);return D(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}}
|
|
349
349
|
/**
|
|
350
350
|
* @license
|
|
351
351
|
* Copyright 2021 Google LLC
|
|
@@ -361,7 +361,7 @@ class ce{static maybeFallbackSpecVersion(e,t){switch(t){case Z.EXPRESSIVE:case Z
|
|
|
361
361
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
362
362
|
* See the License for the specific language governing permissions and
|
|
363
363
|
* limitations under the License.
|
|
364
|
-
*/class
|
|
364
|
+
*/class ye{static quantize(e,t,r){const a=new Map,n=new Array,o=new Array,i=new ge;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 Ce)}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 Ce{constructor(){this.distance=-1,this.index=-1}}
|
|
365
365
|
/**
|
|
366
366
|
* @license
|
|
367
367
|
* Copyright 2021 Google LLC
|
|
@@ -377,7 +377,7 @@ class ce{static maybeFallbackSpecVersion(e,t){switch(t){case Z.EXPRESSIVE:case Z
|
|
|
377
377
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
378
378
|
* See the License for the specific language governing permissions and
|
|
379
379
|
* limitations under the License.
|
|
380
|
-
*/class
|
|
380
|
+
*/class Pe{static quantize(e){const t=new Map;for(let r=0;r<e.length;r++){const a=e[r];w(a)<255||t.set(a,(t.get(a)??0)+1)}return t}}
|
|
381
381
|
/**
|
|
382
382
|
* @license
|
|
383
383
|
* Copyright 2021 Google LLC
|
|
@@ -393,7 +393,7 @@ class ce{static maybeFallbackSpecVersion(e,t){switch(t){case Z.EXPRESSIVE:case Z
|
|
|
393
393
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
394
394
|
* See the License for the specific language governing permissions and
|
|
395
395
|
* limitations under the License.
|
|
396
|
-
*/const
|
|
396
|
+
*/const ve=33,Se=35937,be="red",ke="green",we="blue";class Te{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:Se}).fill(0),this.momentsR=Array.from({length:Se}).fill(0),this.momentsG=Array.from({length:Se}).fill(0),this.momentsB=Array.from({length:Se}).fill(0),this.moments=Array.from({length:Se}).fill(0);const t=Pe.quantize(e);for(const[e,r]of t.entries()){const t=T(e),a=A(e),n=x(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<ve;e++){const t=Array.from({length:ve}).fill(0),r=Array.from({length:ve}).fill(0),a=Array.from({length:ve}).fill(0),n=Array.from({length:ve}).fill(0),o=Array.from({length:ve}).fill(0);for(let i=1;i<ve;i++){let s=0,c=0,u=0,h=0,l=0;for(let m=1;m<ve;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 Ae);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 xe(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,be,e.r0+1,e.r1,r,a,n,o),s=this.maximize(e,ke,e.g0+1,e.g1,r,a,n,o),c=this.maximize(e,we,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=be}else u=l>=h&&l>=m?ke:we;switch(t.r1=e.r1,t.g1=e.g1,t.b1=e.b1,u){case be:e.r1=i.cutLocation,t.r0=e.r1,t.g0=e.g0,t.b0=e.b0;break;case ke:e.g1=s.cutLocation,t.r0=e.r0,t.g0=e.g1,t.b0=e.b0;break;case we: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 De(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 be: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 ke: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 we: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 be: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 ke: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 we: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 Ae{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 xe{constructor(e,t){this.requestedCount=e,this.resultCount=t}}class De{constructor(e,t){this.cutLocation=e,this.maximum=t}}
|
|
397
397
|
/**
|
|
398
398
|
* @license
|
|
399
399
|
* Copyright 2021 Google LLC
|
|
@@ -409,7 +409,7 @@ class ce{static maybeFallbackSpecVersion(e,t){switch(t){case Z.EXPRESSIVE:case Z
|
|
|
409
409
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
410
410
|
* See the License for the specific language governing permissions and
|
|
411
411
|
* limitations under the License.
|
|
412
|
-
*/class
|
|
412
|
+
*/class Me{static quantize(e,t){const r=(new Te).quantize(e,t);return ye.quantize(e,r,t)}}
|
|
413
413
|
/**
|
|
414
414
|
* @license
|
|
415
415
|
* Copyright 2021 Google LLC
|
|
@@ -425,7 +425,7 @@ class ce{static maybeFallbackSpecVersion(e,t){switch(t){case Z.EXPRESSIVE:case Z
|
|
|
425
425
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
426
426
|
* See the License for the specific language governing permissions and
|
|
427
427
|
* limitations under the License.
|
|
428
|
-
*/class
|
|
428
|
+
*/class Ee{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 Ee.lightFromCorePalette(pe.of(e))}static dark(e){return Ee.darkFromCorePalette(pe.of(e))}static lightContent(e){return Ee.lightFromCorePalette(pe.contentOf(e))}static darkContent(e){return Ee.darkFromCorePalette(pe.contentOf(e))}static lightFromCorePalette(e){return new Ee({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 Ee({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}}}
|
|
429
429
|
/**
|
|
430
430
|
* @license
|
|
431
431
|
* Copyright 2021 Google LLC
|
|
@@ -441,7 +441,7 @@ class ce{static maybeFallbackSpecVersion(e,t){switch(t){case Z.EXPRESSIVE:case Z
|
|
|
441
441
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
442
442
|
* See the License for the specific language governing permissions and
|
|
443
443
|
* limitations under the License.
|
|
444
|
-
*/const Ie={desired:4,fallbackColorARGB:4282549748,filter:!0};function
|
|
444
|
+
*/const Ie={desired:4,fallbackColorARGB:4282549748,filter:!0};function _e(e,t){return e.score>t.score?-1:e.score<t.score?1:0}class Be{constructor(){}static score(e,t){const{desired:r,fallbackColorARGB:a,filter:n}={...Ie,...t},o=[],i=new Array(360).fill(0);let s=0;for(const[t,r]of e.entries()){const e=N.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[p(r)]+=t}}const u=new Array;for(const e of o){const t=c[p(Math.round(e.hue))];if(n&&(e.chroma<Be.CUTOFF_CHROMA||t<=Be.CUTOFF_EXCITED_PROPORTION))continue;const r=100*t*Be.WEIGHT_PROPORTION,a=e.chroma<Be.TARGET_CHROMA?Be.WEIGHT_CHROMA_BELOW:Be.WEIGHT_CHROMA_ABOVE,o=r+(e.chroma-Be.TARGET_CHROMA)*a;u.push({hct:e,score:o})}u.sort(_e);const h=[];for(let e=90;e>=15;e--){h.length=0;for(const{hct:t}of u){if(h.find(r=>y(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}}
|
|
445
445
|
/**
|
|
446
446
|
* @license
|
|
447
447
|
* Copyright 2021 Google LLC
|
|
@@ -458,7 +458,7 @@ class ce{static maybeFallbackSpecVersion(e,t){switch(t){case Z.EXPRESSIVE:case Z
|
|
|
458
458
|
* See the License for the specific language governing permissions and
|
|
459
459
|
* limitations under the License.
|
|
460
460
|
*/
|
|
461
|
-
function
|
|
461
|
+
function Fe(e){const t=T(e),r=A(e),a=x(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 He(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=Re(e.slice(0,1).repeat(2)),o=Re(e.slice(1,2).repeat(2)),i=Re(e.slice(2,3).repeat(2))):r?(n=Re(e.slice(0,2)),o=Re(e.slice(2,4)),i=Re(e.slice(4,6))):a&&(n=Re(e.slice(2,4)),o=Re(e.slice(4,6)),i=Re(e.slice(6,8))),(255<<24|(255&n)<<16|(255&o)<<8|255&i)>>>0}function Re(e){return parseInt(e,16)}
|
|
462
462
|
/**
|
|
463
463
|
* @license
|
|
464
464
|
* Copyright 2021 Google LLC
|
|
@@ -474,7 +474,7 @@ function Be(e){const t=w(e),r=T(e),a=A(e),n=[t.toString(16),r.toString(16),a.toS
|
|
|
474
474
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
475
475
|
* See the License for the specific language governing permissions and
|
|
476
476
|
* limitations under the License.
|
|
477
|
-
*/async function
|
|
477
|
+
*/async function Ve(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=b(a,n,o);t.push(i)}const r=Me.quantize(t,128),a=Be.score(r);return a[0]}
|
|
478
478
|
/**
|
|
479
479
|
* @license
|
|
480
480
|
* Copyright 2021 Google LLC
|
|
@@ -490,5 +490,5 @@ function Be(e){const t=w(e),r=T(e),a=A(e),n=[t.toString(16),r.toString(16),a.toS
|
|
|
490
490
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
491
491
|
* See the License for the specific language governing permissions and
|
|
492
492
|
* limitations under the License.
|
|
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 Re(e,t=[]){const r=fe.of(e);return{source:e,schemes:{light:Me.light(e),dark:Me.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=N.harmonize(a,n));const o=fe.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 Ve(e){return Be(await He(e))}var Le,Oe,Ne,Ue,$e,ze,Ke,Ye,qe;_e.TARGET_CHROMA=48,_e.WEIGHT_PROPORTION=.7,_e.WEIGHT_CHROMA_ABOVE=.3,_e.WEIGHT_CHROMA_BELOW=.1,_e.CUTOFF_CHROMA=5,_e.CUTOFF_EXCITED_PROPORTION=.01;let Ge=class extends o{constructor(){super(...arguments),Le.add(this),Oe.set(this,new CSSStyleSheet),Ne.set(this,!1),Ue.set(this,void 0),$e.set(this,void 0),ze.set(this,void 0),Ke.set(this,()=>t(this,Le,"m",Ye).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,$e,"f")?.matches??!1}}connectedCallback(){super.connectedCallback(),this.parentElement instanceof HTMLBodyElement?(this.shadowRoot?.adoptedStyleSheets.includes(t(this,Oe,"f"))&&(this.shadowRoot.adoptedStyleSheets=this.shadowRoot.adoptedStyleSheets.filter(e=>e!==t(this,Oe,"f"))),document.adoptedStyleSheets.includes(t(this,Oe,"f"))||(document.adoptedStyleSheets=[t(this,Oe,"f"),...document.adoptedStyleSheets])):(document.adoptedStyleSheets.includes(t(this,Oe,"f"))&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==t(this,Oe,"f"))),this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(t(this,Oe,"f"))&&(this.shadowRoot.adoptedStyleSheets=[t(this,Oe,"f"),...this.shadowRoot.adoptedStyleSheets])),r(this,Ue,matchMedia("(prefers-color-scheme: light)"),"f"),r(this,$e,matchMedia("(prefers-color-scheme: dark)"),"f"),r(this,ze,matchMedia("(forced-colors: active)"),"f"),[t(this,Ue,"f"),t(this,$e,"f"),t(this,ze,"f")].forEach(e=>e.addEventListener("change",t(this,Ke,"f")))}disconnectedCallback(){super.disconnectedCallback(),[t(this,Ue,"f"),t(this,$e,"f"),t(this,ze,"f")].forEach(e=>e?.removeEventListener("change",t(this,Ke,"f"))),r(this,Ue,r(this,$e,r(this,ze,void 0,"f"),"f"),"f"),document.adoptedStyleSheets.includes(t(this,Oe,"f"))&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==t(this,Oe,"f")))}updated(e){super.updated(e),t(this,Le,"m",Ye).call(this,t(this,Ne,"f")&&["color","scheme","contrast"].some(t=>e.has(t)))}firstUpdated(e){super.firstUpdated(e),r(this,Ne,!0,"f")}render(){return i`<slot></slot>`}};Oe=new WeakMap,Ne=new WeakMap,Ue=new WeakMap,$e=new WeakMap,ze=new WeakMap,Ke=new WeakMap,Le=new WeakSet,Ye=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=Fe(e.slice(0,1).repeat(2)),o=Fe(e.slice(1,2).repeat(2)),i=Fe(e.slice(2,3).repeat(2))):r?(n=Fe(e.slice(0,2)),o=Fe(e.slice(2,4)),i=Fe(e.slice(4,6))):a&&(n=Fe(e.slice(2,4)),o=Fe(e.slice(4,6)),i=Fe(e.slice(6,8))),(255<<24|(255&n)<<16|(255&o)<<8|255&i)>>>0}(this.color),a=Re(r),n=new ce({sourceColorHct:O.fromInt(r),variant:1,contrastLevel:t(this,Le,"m",qe).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 se,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()}`}: ${Be(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: ${Be(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,Oe,"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,Oe,"f").replaceSync(`:host { ${o} }`);t(this,Ne,"f")&&this.dispatchEvent(new Event("change",{bubbles:!0})),e&&document.body.offsetHeight},qe=function(){switch(this.contrast){case"high":return 1;case"medium":return.5;default:return 0}},(()=>{if("undefined"!=typeof window){const e=e=>{let t="";for(const r in e){const a=e[r].toString();if(!a.startsWith("var("))continue;const n=a.trim().slice(4,-1),[o,i]=n.split(/,(.+)/).map(e=>e.trim());o.startsWith("--")&&i&&(t+=`${o}:${i};`)}return t},t=(e,t)=>{const{[t]:r,...a}=e;return a};let r="";r+=e(c.typescale.standard.display.large),r+=e(c.typescale.standard.display.medium),r+=e(c.typescale.standard.display.small),r+=e(c.typescale.standard.headline.large),r+=e(c.typescale.standard.headline.medium),r+=e(c.typescale.standard.headline.small),r+=e(c.typescale.standard.title.large),r+=e(c.typescale.standard.title.medium),r+=e(c.typescale.standard.title.small),r+=e(c.typescale.standard.label.large),r+=e(c.typescale.standard.label.medium),r+=e(c.typescale.standard.label.small),r+=e(c.typescale.standard.body.large),r+=e(c.typescale.standard.body.medium),r+=e(c.typescale.standard.body.small),r+=e(c.elevation),r+=e(c.shape.corner.value),r+=e(t(c.shape.corner,"value")),r+=e(c.motion.duration),r+=e(c.motion.easing),r+=e(c.motion.spring),r+=e(t(c.density,"calc")),r+=e(c.measurement),r+=e(c.state),u(a(`html{${r}}`))}})(),Ge.styles=n`:host { display: contents; }`,e([s()],Ge.prototype,"color",void 0),e([s()],Ge.prototype,"scheme",void 0),e([s()],Ge.prototype,"contrast",void 0),e([s({attribute:"strong-focus",type:Boolean})],Ge.prototype,"strongFocus",void 0),e([s({type:Number})],Ge.prototype,"density",void 0),e([s()],Ge.prototype,"motion",void 0),Ge=e([h("m3e-theme")],Ge);export{Ge as M3eThemeElement,Ve as getColorFromImage};
|
|
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 Le(e,t=[]){const r=pe.of(e);return{source:e,schemes:{light:Ee.light(e),dark:Ee.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=U.harmonize(a,n));const o=pe.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 Oe(e){return Fe(await Ve(e))}var Ne,Ue,ze,$e,Ke,Ye,qe,Ge,Xe,We;Be.TARGET_CHROMA=48,Be.WEIGHT_PROPORTION=.7,Be.WEIGHT_CHROMA_ABOVE=.3,Be.WEIGHT_CHROMA_BELOW=.1,Be.CUTOFF_CHROMA=5,Be.CUTOFF_EXCITED_PROPORTION=.01;let je=class extends o{constructor(){super(...arguments),Ne.add(this),Ue.set(this,new CSSStyleSheet),ze.set(this,!1),$e.set(this,void 0),Ke.set(this,void 0),Ye.set(this,void 0),qe.set(this,()=>t(this,Ne,"m",Ge).call(this,!0)),this.color="#6750A4",this.variant="neutral",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,Ke,"f")?.matches??!1}}connectedCallback(){super.connectedCallback(),this.parentElement instanceof HTMLBodyElement?(this.shadowRoot?.adoptedStyleSheets.includes(t(this,Ue,"f"))&&(this.shadowRoot.adoptedStyleSheets=this.shadowRoot.adoptedStyleSheets.filter(e=>e!==t(this,Ue,"f"))),document.adoptedStyleSheets.includes(t(this,Ue,"f"))||(document.adoptedStyleSheets=[t(this,Ue,"f"),...document.adoptedStyleSheets])):(document.adoptedStyleSheets.includes(t(this,Ue,"f"))&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==t(this,Ue,"f"))),this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(t(this,Ue,"f"))&&(this.shadowRoot.adoptedStyleSheets=[t(this,Ue,"f"),...this.shadowRoot.adoptedStyleSheets])),r(this,$e,matchMedia("(prefers-color-scheme: light)"),"f"),r(this,Ke,matchMedia("(prefers-color-scheme: dark)"),"f"),r(this,Ye,matchMedia("(forced-colors: active)"),"f"),[t(this,$e,"f"),t(this,Ke,"f"),t(this,Ye,"f")].forEach(e=>e.addEventListener("change",t(this,qe,"f")))}disconnectedCallback(){super.disconnectedCallback(),[t(this,$e,"f"),t(this,Ke,"f"),t(this,Ye,"f")].forEach(e=>e?.removeEventListener("change",t(this,qe,"f"))),r(this,$e,r(this,Ke,r(this,Ye,void 0,"f"),"f"),"f"),document.adoptedStyleSheets.includes(t(this,Ue,"f"))&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==t(this,Ue,"f")))}updated(e){super.updated(e),t(this,Ne,"m",Ge).call(this,t(this,ze,"f")&&["color","scheme","contrast"].some(t=>e.has(t)))}firstUpdated(e){super.firstUpdated(e),r(this,ze,!0,"f")}render(){return i`<slot></slot>`}};var Je,Qe,Ze,et,tt;Ue=new WeakMap,ze=new WeakMap,$e=new WeakMap,Ke=new WeakMap,Ye=new WeakMap,qe=new WeakMap,Ne=new WeakSet,Ge=function(e){const r=He(this.color),a=Le(r),n=new ue({sourceColorHct:N.fromInt(r),variant:t(this,Ne,"m",Xe).call(this),contrastLevel:t(this,Ne,"m",We).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 ce,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()}`}: ${Fe(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: ${Fe(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,Ue,"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,Ue,"f").replaceSync(`:host { ${o} }`);t(this,ze,"f")&&this.dispatchEvent(new Event("change",{bubbles:!0})),e&&document.body.offsetHeight},Xe=function(){switch(this.variant){case"neutral":return 1;case"tonal-spot":return 2;case"vibrant":return 3;case"expressive":return 4;case"fidelity":return 5;case"content":return 6;case"rainbow":return 7;case"fruit-salad":return 8;default:return 0}},We=function(){switch(this.contrast){case"high":return 1;case"medium":return.5;default:return 0}},(()=>{if("undefined"!=typeof window){const e=e=>{let t="";for(const r in e){const a=e[r].toString();if(!a.startsWith("var("))continue;const n=a.trim().slice(4,-1),[o,i]=n.split(/,(.+)/).map(e=>e.trim());o.startsWith("--")&&i&&(t+=`${o}:${i};`)}return t},t=(e,...t)=>{const r={...e};for(const e of t)delete r[e];return r};let r="";r+=e(c.typescale.standard.display.large),r+=e(c.typescale.standard.display.medium),r+=e(c.typescale.standard.display.small),r+=e(c.typescale.standard.headline.large),r+=e(c.typescale.standard.headline.medium),r+=e(c.typescale.standard.headline.small),r+=e(c.typescale.standard.title.large),r+=e(c.typescale.standard.title.medium),r+=e(c.typescale.standard.title.small),r+=e(c.typescale.standard.label.large),r+=e(c.typescale.standard.label.medium),r+=e(c.typescale.standard.label.small),r+=e(c.typescale.standard.body.large),r+=e(c.typescale.standard.body.medium),r+=e(c.typescale.standard.body.small),r+=e(c.elevation),r+=e(c.shape.corner.value),r+=e(t(c.shape.corner,"value","extraLargeEnd","extraLargeStart","mediumTop","mediumEnd","mediumStart","smallTop","smallEnd","smallStart","extraSmallEnd","extraSmallStart","extraSmallBottom")),r+=e(c.motion.duration),r+=e(c.motion.easing),r+=e(c.motion.spring),r+=e(t(c.density,"calc")),r+=e(c.measurement),r+=e(c.state),u(a(`html{${r}}`))}})(),je.styles=n`:host { display: contents; }`,e([s()],je.prototype,"color",void 0),e([s()],je.prototype,"variant",void 0),e([s()],je.prototype,"scheme",void 0),e([s()],je.prototype,"contrast",void 0),e([s({attribute:"strong-focus",type:Boolean})],je.prototype,"strongFocus",void 0),e([s({type:Number})],je.prototype,"density",void 0),e([s()],je.prototype,"motion",void 0),je=e([h("m3e-theme")],je);let rt=class extends(l(o,"img")){constructor(){super(...arguments),Je.add(this),Qe.set(this,void 0),Ze.set(this,void 0),et.set(this,()=>this.requestUpdate()),this.color="#6750A4",this.variant="neutral",this.scheme="auto"}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,Ze,"f")?.matches??!1}}connectedCallback(){super.connectedCallback(),r(this,Qe,matchMedia("(prefers-color-scheme: light)"),"f"),r(this,Ze,matchMedia("(prefers-color-scheme: dark)"),"f"),[t(this,Qe,"f"),t(this,Ze,"f")].forEach(e=>e.addEventListener("change",t(this,et,"f")))}disconnectedCallback(){super.disconnectedCallback(),[t(this,Qe,"f"),t(this,Ze,"f")].forEach(e=>e?.removeEventListener("change",t(this,et,"f"))),r(this,Qe,r(this,Ze,void 0,"f"),"f")}updated(e){super.updated(e);const r=this.shadowRoot?.querySelector(".base"),a=He(this.color),n=Le(a),o=new ue({sourceColorHct:N.fromInt(a),variant:t(this,Je,"m",tt).call(this),contrastLevel:0,isDark:this.isDark,primaryPalette:n.palettes.primary,neutralPalette:n.palettes.neutral}),i=new ce;r?.style.setProperty("--_theme-icon-container-color",Fe(i.surface().getArgb(o))),r?.style.setProperty("--_theme-icon-color",Fe(i.primary().getArgb(o)))}render(){return i`<div class="base"><svg viewBox="0 0 80 80" class="icon"><path class="container" d="M77.87 0C79.05 0 80 .95 80 2.13v75.74c0 1.17-.95 2.13-2.13 2.13H2.13C.96 80 0 79.04 0 77.87V2.13C0 .95.96 0 2.13 0h75.74z"/><path class="color" d="M54 40c3.32 0 6 2.69 6 6 0 1.2 0-1.2 0 0 0 3.31-2.68 6-6 6H26c-3.31 0-6-2.69-6-6 0-1.2 0 1.2 0 0 0-3.31 2.69-6 6-6h28z"/><path class="color" d="M0 0h80v17.24H0V0z"/></svg></div>`}};Qe=new WeakMap,Ze=new WeakMap,et=new WeakMap,Je=new WeakSet,tt=function(){switch(this.variant){case"neutral":return 1;case"tonal-spot":return 2;case"vibrant":return 3;case"expressive":return 4;case"fidelity":return 5;case"content":return 6;case"rainbow":return 7;case"fruit-salad":return 8;default:return 0}},rt.styles=n`:host { display: inline-block; width: var(--m3e-theme-icon-size, 1.5rem); height: var(--m3e-theme-icon-size, 1.5rem); } .base { width: 100%; height: 100%; border-radius: var(--m3e-theme-icon-shape, ${c.shape.corner.extraSmall}); outline: solid 1px color-mix( in srgb, var(--m3e-theme-icon-outline-color, ${c.color.outlineVariant}) var(--m3e-theme-icon-outline-opacity, 50%), transparent ); } .icon { width: 100%; height: 100%; } .container { fill: var(--m3e-theme-icon-container-color, var(--_theme-icon-container-color)); } .color { fill: var(--m3e-theme-icon-color, var(--_theme-icon-color)); }`,e([s()],rt.prototype,"color",void 0),e([s()],rt.prototype,"variant",void 0),e([s()],rt.prototype,"scheme",void 0),rt=e([h("m3e-theme-icon")],rt);export{je as M3eThemeElement,rt as M3eThemeIconElement,Oe as getColorFromImage};
|
|
494
494
|
//# sourceMappingURL=theme.min.js.map
|