@nzlov/dsh-bing-wallpaper 1.4.0 → 1.5.0

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/README.md CHANGED
@@ -4,12 +4,15 @@
4
4
 
5
5
  Daily Bing wallpapers, image-derived theme colours, and automatic light/dark appearance for DSH Web. A standalone plugin with no changes to DSH itself.
6
6
 
7
+ ![Bing daily wallpaper settings in DSH Web, showing the wallpaper preview, source selection, and image-derived colour styles (Chinese UI)](<assets/settings-preview.png>)
8
+
7
9
  ## Features
8
10
 
9
11
  - China and international (US) Bing sources, with separate caches and no automatic cross-source fallback.
10
12
  - Ten colour styles: M3 Content, M3 Tonal Spot, M3 Fruit Salad, M3 Rainbow, M3 Monochrome, Vibrant, Faithful, Soft, Dysfunctional, and Muted.
11
13
  - Clickable palette cards show light and dark previews separated by a diagonal line.
12
- - Wallpaper visibility from 10% to 100%, with a reading overlay; photos, icons, and semantic status colours are not recoloured.
14
+ - Wallpaper visibility from 10% to 100%, with a reading overlay. Icons and semantic status colours are not recoloured.
15
+ - Optional blur, frosted glass (blur with a mist layer), blue tint, grayscale, and dimming filters, each with its own strength and a live preview. Filters affect only the wallpaper; theme colours still come from the original image.
13
16
  - Scheduled, system, follow-DSH, or fixed light/dark appearance. The default schedule is 07:00–19:00 in the browser’s local time zone.
14
17
  - Image title, date, source, and copyright overlaid at the bottom of the photo; refresh icon in the top-right corner.
15
18
  - Automatic update checks, keeping the previous image on failure; Chinese and English UI.
package/README.zh-CN.md CHANGED
@@ -4,12 +4,15 @@
4
4
 
5
5
  为 DSH Web 添加每日 Bing 壁纸、从图片提取的主题色,以及自动日夜外观。独立插件,不修改 DSH 本体。
6
6
 
7
+ ![DSH Web 中的 Bing 每日壁纸设置示例:壁纸预览、来源选择及图片取色风格](<assets/settings-preview.png>)
8
+
7
9
  ## 特性
8
10
 
9
11
  - 国内(中国)与国际(美国)Bing 来源,缓存独立,失败时不自动混用其他来源。
10
12
  - 十种取色风格:M3 Content、M3 Tonal Spot、M3 Fruit Salad、M3 Rainbow、M3 Monochrome、Vibrant、Faithful、Soft、Dysfunctional、Muted。
11
13
  - 平铺配色卡片,日夜预览以斜线分隔,点击即可切换。
12
- - 壁纸可见度 10%–100%,保留阅读蒙层;照片、图标及语义状态色不重新染色。
14
+ - 壁纸可见度 10%–100%,保留阅读蒙层;图标及语义状态色不重新染色。
15
+ - 支持模糊(Blur)、毛玻璃(模糊加雾面)、蓝色调、黑白和压暗滤镜,可分别调节强度并实时预览。滤镜仅影响壁纸,主题色仍从原图提取。
13
16
  - 支持定时、跟随系统、跟随 DSH,以及固定浅色或深色。默认按浏览器本地时间在 07:00–19:00 使用浅色。
14
17
  - 标题、日期、来源与版权叠放在图片底部,右上角提供刷新图标。
15
18
  - 自动检查更新,失败保留上一张图片;界面支持中英文。
package/boot-theme.js CHANGED
@@ -1,4 +1,6 @@
1
1
  // Dependency-free bridge for the interval before Client plugins can run.
2
+ import { createWallpaperFilters, wallpaperFilters } from './wallpaper-filter.js';
3
+
2
4
  export const PREFERENCES_KEY = 'dsh.bing-daily-theme.preferences.v1';
3
5
  export const BOOT_CACHE_KEY = 'dsh.bing-daily-theme.boot.v1';
4
6
  export const BOOT_STYLE_ID = 'bdt-boot-theme';
@@ -19,7 +21,7 @@ export function makeBootCache(settings, tokens, imageUrl) {
19
21
 
20
22
  // This pure function is also embedded verbatim in the Host's early script.
21
23
  // All persisted values are untrusted: no arbitrary CSS or URL interpolation.
22
- export function bootThemeCSS(settings, cache, now, systemDark, followDark) {
24
+ export function bootThemeCSS(settings, cache, now, systemDark, followDark, renderFilter = wallpaperFilters.css) {
23
25
  settings ??= { enabled: true, dynamic: true, paletteMode: 'content', mode: 'schedule', day: '07:00', night: '19:00', strength: 28 };
24
26
  if (!settings || settings.enabled !== true || settings.dynamic !== true || !cache || cache.version !== 1
25
27
  || cache.paletteMode !== settings.paletteMode || cache.strength !== settings.strength
@@ -28,8 +30,8 @@ export function bootThemeCSS(settings, cache, now, systemDark, followDark) {
28
30
  // Follow stays selector-driven: structured row activation order may change
29
31
  // after a Host plugin reload, and the native body selector is authoritative.
30
32
  if (settings.mode === 'follow' && typeof followDark !== 'boolean') {
31
- return bootThemeCSS(settings, cache, now, systemDark, false).replaceAll('[data-dsh-boot]', 'body:not([data-ds-dark-theme]) [data-dsh-boot]')
32
- + bootThemeCSS(settings, cache, now, systemDark, true).replaceAll('[data-dsh-boot]', 'body[data-ds-dark-theme] [data-dsh-boot]');
33
+ return bootThemeCSS(settings, cache, now, systemDark, false, renderFilter).replaceAll('[data-dsh-boot]', 'body:not([data-ds-dark-theme]) [data-dsh-boot]')
34
+ + bootThemeCSS(settings, cache, now, systemDark, true, renderFilter).replaceAll('[data-dsh-boot]', 'body[data-ds-dark-theme] [data-dsh-boot]');
33
35
  }
34
36
  let dark;
35
37
  if (settings.mode === 'schedule') {
@@ -57,16 +59,18 @@ export function bootThemeCSS(settings, cache, now, systemDark, followDark) {
57
59
  const matte = colors.background.replace('rgb(', 'rgba(').replace(')', `, ${alpha})`);
58
60
  const imageMatch = typeof url === 'string' && url.length <= 300
59
61
  && /^\/bing-daily-theme\/api\/image\?(market=en-US&)?id=OHR\.[A-Za-z0-9][A-Za-z0-9_-]*_1920x1080\.jpg$/.exec(url);
60
- const image = imageMatch && Boolean(imageMatch[1]) === (settings.market === 'en-US')
61
- ? `linear-gradient(${matte},${matte}),linear-gradient(${dark ? 'rgba(0, 0, 0, 0.62)' : 'rgba(255, 255, 255, 0.56)'},${dark ? 'rgba(0, 0, 0, 0.62)' : 'rgba(255, 255, 255, 0.56)'}),url("${url}")` : 'none';
62
- return `[data-dsh-boot]{--dsw-alias-bg-base:${colors.background};--dsw-alias-label-primary:${colors.primary};--dsw-alias-label-secondary:${colors.secondary};--dsw-alias-label-tertiary:${colors.tertiary};--dsw-alias-border-l2:${colors.border};--dsw-alias-brand-primary:${colors.brand};background-color:${colors.background}!important;background-image:${image}!important;background-size:cover;background-position:center;color-scheme:${dark ? 'dark' : 'light'}}`;
62
+ const photo = imageMatch && Boolean(imageMatch[1]) === (settings.market === 'en-US') ? `url("${url}")` : '';
63
+ const shade = dark ? 'rgba(0, 0, 0, 0.62)' : 'rgba(255, 255, 255, 0.56)';
64
+ const image = photo ? `linear-gradient(${matte},${matte}),linear-gradient(${shade},${shade}),${photo}` : 'none';
65
+ const filter = renderFilter({ selector: '[data-dsh-boot]', image: photo, overlays: [matte, shade], settings });
66
+ return `[data-dsh-boot]{--dsw-alias-bg-base:${colors.background};--dsw-alias-label-primary:${colors.primary};--dsw-alias-label-secondary:${colors.secondary};--dsw-alias-label-tertiary:${colors.tertiary};--dsw-alias-border-l2:${colors.border};--dsw-alias-brand-primary:${colors.brand};background-color:${colors.background}!important;background-image:${image}!important;background-size:cover;background-position:center;color-scheme:${dark ? 'dark' : 'light'}}${filter}`;
63
67
  }
64
68
 
65
69
  // No network await, timer, observer, global preference or body-style writes.
66
- function startBootTheme(preferencesKey, cacheKey, styleId, resolveCSS) {
70
+ function startBootTheme(preferencesKey, cacheKey, styleId, resolveCSS, createFilters) {
67
71
  try {
68
72
  const css = resolveCSS(JSON.parse(localStorage.getItem(preferencesKey)), JSON.parse(localStorage.getItem(cacheKey)),
69
- new Date(), typeof matchMedia === 'function' && matchMedia('(prefers-color-scheme: dark)').matches);
73
+ new Date(), typeof matchMedia === 'function' && matchMedia('(prefers-color-scheme: dark)').matches, undefined, createFilters().css);
70
74
  if (!css) return;
71
75
  document.getElementById(styleId)?.remove();
72
76
  const style = document.createElement('style');
@@ -75,6 +79,6 @@ function startBootTheme(preferencesKey, cacheKey, styleId, resolveCSS) {
75
79
  }
76
80
 
77
81
  export function bootThemeInjection() {
78
- const text = `;(${startBootTheme.toString()})(${JSON.stringify(PREFERENCES_KEY)},${JSON.stringify(BOOT_CACHE_KEY)},${JSON.stringify(BOOT_STYLE_ID)},${bootThemeCSS.toString()});`;
82
+ const text = `;(${startBootTheme.toString()})(${JSON.stringify(PREFERENCES_KEY)},${JSON.stringify(BOOT_CACHE_KEY)},${JSON.stringify(BOOT_STYLE_ID)},${bootThemeCSS.toString()},${createWallpaperFilters.toString()});`;
79
83
  return { kind: 'script', placement: 'body', text };
80
84
  }
package/client.js CHANGED
@@ -1,5 +1,16 @@
1
1
  // Generated by npm run build. Edit palette.js / client-main.js / appearance.js / boot-theme.js / compatibility.js / palette-preview.js instead.
2
- (()=>{var we=Object.defineProperty;var xe=(t,e)=>{for(var r in e)we(t,r,{get:e[r],enumerable:!0})};var Kt={};xe(Kt,{DEFAULTS:()=>ct,PALETTE_MODES:()=>se,WALLPAPER_VEIL:()=>Ut,backgroundAlpha:()=>ie,contrast:()=>ht,extractAccent:()=>Be,hslToRgb:()=>Fe,localDate:()=>De,luminance:()=>Yt,makeTokens:()=>Ne,normalizeSettings:()=>Se,normalizeStrength:()=>$t,rgbToHsl:()=>le,scheduledScheme:()=>Ie,wallpaperShade:()=>Te});function Y(t){return t<0?-1:t===0?0:1}function pt(t,e,r){return(1-r)*t+r*e}function Qt(t,e,r){return r<t?t:r>e?e:r}function kt(t,e,r){return r<t?t:r>e?e:r}function Ct(t){return t=t%360,t<0&&(t=t+360),t}function G(t){return t=t%360,t<0&&(t=t+360),t}function _t(t,e){return 180-Math.abs(Math.abs(t-e)-180)}function Dt(t,e){let r=t[0]*e[0][0]+t[1]*e[0][1]+t[2]*e[0][2],a=t[0]*e[1][0]+t[1]*e[1][1]+t[2]*e[1][2],n=t[0]*e[2][0]+t[1]*e[2][1]+t[2]*e[2][2];return[r,a,n]}var te=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],ke=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],ee=[95.047,100,108.883];function gt(t,e,r){return(255<<24|(t&255)<<16|(e&255)<<8|r&255)>>>0}function Gt(t){let e=ft(t[0]),r=ft(t[1]),a=ft(t[2]);return gt(e,r,a)}function Pt(t){return t>>16&255}function At(t){return t>>8&255}function vt(t){return t&255}function re(t,e,r){let a=ke,n=a[0][0]*t+a[0][1]*e+a[0][2]*r,i=a[1][0]*t+a[1][1]*e+a[1][2]*r,s=a[2][0]*t+a[2][1]*e+a[2][2]*r,c=ft(n),m=ft(i),l=ft(s);return gt(c,m,l)}function Ce(t){let e=st(Pt(t)),r=st(At(t)),a=st(vt(t));return Dt([e,r,a],te)}function qt(t){let e=st(Pt(t)),r=st(At(t)),a=st(vt(t)),n=te,i=n[0][0]*e+n[0][1]*r+n[0][2]*a,s=n[1][0]*e+n[1][1]*r+n[1][2]*a,c=n[2][0]*e+n[2][1]*r+n[2][2]*a,m=ee,l=i/m[0],d=s/m[1],h=c/m[2],f=Ft(l),u=Ft(d),g=Ft(h),p=116*u-16,P=500*(f-u),T=200*(u-g);return[p,P,T]}function ae(t){let e=rt(t),r=ft(e);return gt(r,r,r)}function Rt(t){let e=Ce(t)[1];return 116*Ft(e/100)-16}function rt(t){return 100*Pe((t+16)/116)}function Bt(t){return Ft(t/100)*116-16}function st(t){let e=t/255;return e<=.040449936?e/12.92*100:Math.pow((e+.055)/1.055,2.4)*100}function ft(t){let e=t/100,r=0;return e<=.0031308?r=e*12.92:r=1.055*Math.pow(e,1/2.4)-.055,Qt(0,255,Math.round(r*255))}function ne(){return ee}function Ft(t){let e=.008856451679035631,r=24389/27;return t>e?Math.pow(t,1/3):(r*t+16)/116}function Pe(t){let e=.008856451679035631,r=24389/27,a=t*t*t;return a>e?a:(116*t-16)/r}var et=class t{static make(e=ne(),r=200/Math.PI*rt(50)/100,a=50,n=2,i=!1){let s=e,c=s[0]*.401288+s[1]*.650173+s[2]*-.051461,m=s[0]*-.250268+s[1]*1.204414+s[2]*.045854,l=s[0]*-.002079+s[1]*.048952+s[2]*.953127,d=.8+n/10,h=d>=.9?pt(.59,.69,(d-.9)*10):pt(.525,.59,(d-.8)*10),f=i?1:d*(1-1/3.6*Math.exp((-r-42)/92));f=f>1?1:f<0?0:f;let u=d,g=[f*(100/c)+1-f,f*(100/m)+1-f,f*(100/l)+1-f],p=1/(5*r+1),P=p*p*p*p,T=1-P,S=P*r+.1*T*T*Math.cbrt(5*r),C=rt(a)/e[1],E=1.48+Math.sqrt(C),M=.725/Math.pow(C,.2),O=M,I=[Math.pow(S*g[0]*c/100,.42),Math.pow(S*g[1]*m/100,.42),Math.pow(S*g[2]*l/100,.42)],R=[400*I[0]/(I[0]+27.13),400*I[1]/(I[1]+27.13),400*I[2]/(I[2]+27.13)],V=(2*R[0]+R[1]+.05*R[2])*M;return new t(C,V,M,O,h,u,g,S,Math.pow(S,.25),E)}constructor(e,r,a,n,i,s,c,m,l,d){this.n=e,this.aw=r,this.nbb=a,this.ncb=n,this.c=i,this.nc=s,this.rgbD=c,this.fl=m,this.fLRoot=l,this.z=d}};et.DEFAULT=et.make();var it=class t{constructor(e,r,a,n,i,s,c,m,l){this.hue=e,this.chroma=r,this.j=a,this.q=n,this.m=i,this.s=s,this.jstar=c,this.astar=m,this.bstar=l}distance(e){let r=this.jstar-e.jstar,a=this.astar-e.astar,n=this.bstar-e.bstar,i=Math.sqrt(r*r+a*a+n*n);return 1.41*Math.pow(i,.63)}static fromInt(e){return t.fromIntInViewingConditions(e,et.DEFAULT)}static fromIntInViewingConditions(e,r){let a=(e&16711680)>>16,n=(e&65280)>>8,i=e&255,s=st(a),c=st(n),m=st(i),l=.41233895*s+.35762064*c+.18051042*m,d=.2126*s+.7152*c+.0722*m,h=.01932141*s+.11916382*c+.95034478*m,f=.401288*l+.650173*d-.051461*h,u=-.250268*l+1.204414*d+.045854*h,g=-.002079*l+.048952*d+.953127*h,p=r.rgbD[0]*f,P=r.rgbD[1]*u,T=r.rgbD[2]*g,S=Math.pow(r.fl*Math.abs(p)/100,.42),C=Math.pow(r.fl*Math.abs(P)/100,.42),E=Math.pow(r.fl*Math.abs(T)/100,.42),M=Y(p)*400*S/(S+27.13),O=Y(P)*400*C/(C+27.13),I=Y(T)*400*E/(E+27.13),R=(11*M+-12*O+I)/11,V=(M+O-2*I)/9,w=(20*M+20*O+21*I)/20,B=(40*M+20*O+I)/20,j=Math.atan2(V,R)*180/Math.PI,_=j<0?j+360:j>=360?j-360:j,dt=_*Math.PI/180,wt=B*r.nbb,ot=100*Math.pow(wt/r.aw,r.c*r.z),xt=4/r.c*Math.sqrt(ot/100)*(r.aw+4)*r.fLRoot,It=_<20.14?_+360:_,y=.25*(Math.cos(It*Math.PI/180+2)+3.8),D=5e4/13*y*r.nc*r.ncb*Math.sqrt(R*R+V*V)/(w+.305),U=Math.pow(D,.9)*Math.pow(1.64-Math.pow(.29,r.n),.73),Z=U*Math.sqrt(ot/100),q=Z*r.fLRoot,Q=50*Math.sqrt(U*r.c/(r.aw+4)),tt=(1+100*.007)*ot/(1+.007*ot),v=1/.0228*Math.log(1+.0228*q),J=v*Math.cos(dt),ut=v*Math.sin(dt);return new t(_,Z,ot,xt,q,Q,tt,J,ut)}static fromJch(e,r,a){return t.fromJchInViewingConditions(e,r,a,et.DEFAULT)}static fromJchInViewingConditions(e,r,a,n){let i=4/n.c*Math.sqrt(e/100)*(n.aw+4)*n.fLRoot,s=r*n.fLRoot,c=r/Math.sqrt(e/100),m=50*Math.sqrt(c*n.c/(n.aw+4)),l=a*Math.PI/180,d=(1+100*.007)*e/(1+.007*e),h=1/.0228*Math.log(1+.0228*s),f=h*Math.cos(l),u=h*Math.sin(l);return new t(a,r,e,i,s,m,d,f,u)}static fromUcs(e,r,a){return t.fromUcsInViewingConditions(e,r,a,et.DEFAULT)}static fromUcsInViewingConditions(e,r,a,n){let i=r,s=a,c=Math.sqrt(i*i+s*s),l=(Math.exp(c*.0228)-1)/.0228/n.fLRoot,d=Math.atan2(s,i)*(180/Math.PI);d<0&&(d+=360);let h=e/(1-(e-100)*.007);return t.fromJchInViewingConditions(h,l,d,n)}toInt(){return this.viewed(et.DEFAULT)}viewed(e){let r=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),a=Math.pow(r/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),n=this.hue*Math.PI/180,i=.25*(Math.cos(n+2)+3.8),s=e.aw*Math.pow(this.j/100,1/e.c/e.z),c=i*(5e4/13)*e.nc*e.ncb,m=s/e.nbb,l=Math.sin(n),d=Math.cos(n),h=23*(m+.305)*a/(23*c+11*a*d+108*a*l),f=h*d,u=h*l,g=(460*m+451*f+288*u)/1403,p=(460*m-891*f-261*u)/1403,P=(460*m-220*f-6300*u)/1403,T=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),S=Y(g)*(100/e.fl)*Math.pow(T,1/.42),C=Math.max(0,27.13*Math.abs(p)/(400-Math.abs(p))),E=Y(p)*(100/e.fl)*Math.pow(C,1/.42),M=Math.max(0,27.13*Math.abs(P)/(400-Math.abs(P))),O=Y(P)*(100/e.fl)*Math.pow(M,1/.42),I=S/e.rgbD[0],R=E/e.rgbD[1],V=O/e.rgbD[2],w=1.86206786*I-1.01125463*R+.14918677*V,B=.38752654*I+.62144744*R-.00897398*V,L=-.0158415*I-.03412294*R+1.04996444*V;return re(w,B,L)}static fromXyzInViewingConditions(e,r,a,n){let i=.401288*e+.650173*r-.051461*a,s=-.250268*e+1.204414*r+.045854*a,c=-.002079*e+.048952*r+.953127*a,m=n.rgbD[0]*i,l=n.rgbD[1]*s,d=n.rgbD[2]*c,h=Math.pow(n.fl*Math.abs(m)/100,.42),f=Math.pow(n.fl*Math.abs(l)/100,.42),u=Math.pow(n.fl*Math.abs(d)/100,.42),g=Y(m)*400*h/(h+27.13),p=Y(l)*400*f/(f+27.13),P=Y(d)*400*u/(u+27.13),T=(11*g+-12*p+P)/11,S=(g+p-2*P)/9,C=(20*g+20*p+21*P)/20,E=(40*g+20*p+P)/20,O=Math.atan2(S,T)*180/Math.PI,I=O<0?O+360:O>=360?O-360:O,R=I*Math.PI/180,V=E*n.nbb,w=100*Math.pow(V/n.aw,n.c*n.z),B=4/n.c*Math.sqrt(w/100)*(n.aw+4)*n.fLRoot,L=I<20.14?I+360:I,j=1/4*(Math.cos(L*Math.PI/180+2)+3.8),dt=5e4/13*j*n.nc*n.ncb*Math.sqrt(T*T+S*S)/(C+.305),wt=Math.pow(dt,.9)*Math.pow(1.64-Math.pow(.29,n.n),.73),ot=wt*Math.sqrt(w/100),xt=ot*n.fLRoot,It=50*Math.sqrt(wt*n.c/(n.aw+4)),y=(1+100*.007)*w/(1+.007*w),k=Math.log(1+.0228*xt)/.0228,D=k*Math.cos(R),U=k*Math.sin(R);return new t(I,ot,w,B,xt,It,y,D,U)}xyzInViewingConditions(e){let r=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),a=Math.pow(r/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),n=this.hue*Math.PI/180,i=.25*(Math.cos(n+2)+3.8),s=e.aw*Math.pow(this.j/100,1/e.c/e.z),c=i*(5e4/13)*e.nc*e.ncb,m=s/e.nbb,l=Math.sin(n),d=Math.cos(n),h=23*(m+.305)*a/(23*c+11*a*d+108*a*l),f=h*d,u=h*l,g=(460*m+451*f+288*u)/1403,p=(460*m-891*f-261*u)/1403,P=(460*m-220*f-6300*u)/1403,T=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),S=Y(g)*(100/e.fl)*Math.pow(T,1/.42),C=Math.max(0,27.13*Math.abs(p)/(400-Math.abs(p))),E=Y(p)*(100/e.fl)*Math.pow(C,1/.42),M=Math.max(0,27.13*Math.abs(P)/(400-Math.abs(P))),O=Y(P)*(100/e.fl)*Math.pow(M,1/.42),I=S/e.rgbD[0],R=E/e.rgbD[1],V=O/e.rgbD[2],w=1.86206786*I-1.01125463*R+.14918677*V,B=.38752654*I+.62144744*R-.00897398*V,L=-.0158415*I-.03412294*R+1.04996444*V;return[w,B,L]}};var nt=class t{static sanitizeRadians(e){return(e+Math.PI*8)%(Math.PI*2)}static trueDelinearized(e){let r=e/100,a=0;return r<=.0031308?a=r*12.92:a=1.055*Math.pow(r,1/2.4)-.055,a*255}static chromaticAdaptation(e){let r=Math.pow(Math.abs(e),.42);return Y(e)*400*r/(r+27.13)}static hueOf(e){let r=Dt(e,t.SCALED_DISCOUNT_FROM_LINRGB),a=t.chromaticAdaptation(r[0]),n=t.chromaticAdaptation(r[1]),i=t.chromaticAdaptation(r[2]),s=(11*a+-12*n+i)/11,c=(a+n-2*i)/9;return Math.atan2(c,s)}static areInCyclicOrder(e,r,a){let n=t.sanitizeRadians(r-e),i=t.sanitizeRadians(a-e);return n<i}static intercept(e,r,a){return(r-e)/(a-e)}static lerpPoint(e,r,a){return[e[0]+(a[0]-e[0])*r,e[1]+(a[1]-e[1])*r,e[2]+(a[2]-e[2])*r]}static setCoordinate(e,r,a,n){let i=t.intercept(e[n],r,a[n]);return t.lerpPoint(e,i,a)}static isBounded(e){return 0<=e&&e<=100}static nthVertex(e,r){let a=t.Y_FROM_LINRGB[0],n=t.Y_FROM_LINRGB[1],i=t.Y_FROM_LINRGB[2],s=r%4<=1?0:100,c=r%2===0?0:100;if(r<4){let m=s,l=c,d=(e-m*n-l*i)/a;return t.isBounded(d)?[d,m,l]:[-1,-1,-1]}else if(r<8){let m=s,l=c,d=(e-l*a-m*i)/n;return t.isBounded(d)?[l,d,m]:[-1,-1,-1]}else{let m=s,l=c,d=(e-m*a-l*n)/i;return t.isBounded(d)?[m,l,d]:[-1,-1,-1]}}static bisectToSegment(e,r){let a=[-1,-1,-1],n=a,i=0,s=0,c=!1,m=!0;for(let l=0;l<12;l++){let d=t.nthVertex(e,l);if(d[0]<0)continue;let h=t.hueOf(d);if(!c){a=d,n=d,i=h,s=h,c=!0;continue}(m||t.areInCyclicOrder(i,h,s))&&(m=!1,t.areInCyclicOrder(i,r,h)?(n=d,s=h):(a=d,i=h))}return[a,n]}static midpoint(e,r){return[(e[0]+r[0])/2,(e[1]+r[1])/2,(e[2]+r[2])/2]}static criticalPlaneBelow(e){return Math.floor(e-.5)}static criticalPlaneAbove(e){return Math.ceil(e-.5)}static bisectToLimit(e,r){let a=t.bisectToSegment(e,r),n=a[0],i=t.hueOf(n),s=a[1];for(let c=0;c<3;c++)if(n[c]!==s[c]){let m=-1,l=255;n[c]<s[c]?(m=t.criticalPlaneBelow(t.trueDelinearized(n[c])),l=t.criticalPlaneAbove(t.trueDelinearized(s[c]))):(m=t.criticalPlaneAbove(t.trueDelinearized(n[c])),l=t.criticalPlaneBelow(t.trueDelinearized(s[c])));for(let d=0;d<8&&!(Math.abs(l-m)<=1);d++){let h=Math.floor((m+l)/2),f=t.CRITICAL_PLANES[h],u=t.setCoordinate(n,f,s,c),g=t.hueOf(u);t.areInCyclicOrder(i,r,g)?(s=u,l=h):(n=u,i=g,m=h)}}return t.midpoint(n,s)}static inverseChromaticAdaptation(e){let r=Math.abs(e),a=Math.max(0,27.13*r/(400-r));return Y(e)*Math.pow(a,1/.42)}static findResultByJ(e,r,a){let n=Math.sqrt(a)*11,i=et.DEFAULT,s=1/Math.pow(1.64-Math.pow(.29,i.n),.73),m=.25*(Math.cos(e+2)+3.8)*(5e4/13)*i.nc*i.ncb,l=Math.sin(e),d=Math.cos(e);for(let h=0;h<5;h++){let f=n/100,u=r===0||n===0?0:r/Math.sqrt(f),g=Math.pow(u*s,1/.9),P=i.aw*Math.pow(f,1/i.c/i.z)/i.nbb,T=23*(P+.305)*g/(23*m+11*g*d+108*g*l),S=T*d,C=T*l,E=(460*P+451*S+288*C)/1403,M=(460*P-891*S-261*C)/1403,O=(460*P-220*S-6300*C)/1403,I=t.inverseChromaticAdaptation(E),R=t.inverseChromaticAdaptation(M),V=t.inverseChromaticAdaptation(O),w=Dt([I,R,V],t.LINRGB_FROM_SCALED_DISCOUNT);if(w[0]<0||w[1]<0||w[2]<0)return 0;let B=t.Y_FROM_LINRGB[0],L=t.Y_FROM_LINRGB[1],j=t.Y_FROM_LINRGB[2],_=B*w[0]+L*w[1]+j*w[2];if(_<=0)return 0;if(h===4||Math.abs(_-a)<.002)return w[0]>100.01||w[1]>100.01||w[2]>100.01?0:Gt(w);n=n-(_-a)*n/(2*_)}return 0}static solveToInt(e,r,a){if(r<1e-4||a<1e-4||a>99.9999)return ae(a);e=G(e);let n=e/180*Math.PI,i=rt(a),s=t.findResultByJ(n,r,i);if(s!==0)return s;let c=t.bisectToLimit(i,n);return Gt(c)}static solveToCam(e,r,a){return it.fromInt(t.solveToInt(e,r,a))}};nt.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]];nt.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]];nt.Y_FROM_LINRGB=[.2126,.7152,.0722];nt.CRITICAL_PLANES=[.015176349177441876,.045529047532325624,.07588174588720938,.10623444424209313,.13658714259697685,.16693984095186062,.19729253930674434,.2276452376616281,.2579979360165119,.28835063437139563,.3188300904430532,.350925934958123,.3848314933096426,.42057480301049466,.458183274052838,.4976837250274023,.5391024159806381,.5824650784040898,.6277969426914107,.6751227633498623,.7244668422128921,.775853049866786,.829304845476233,.8848452951698498,.942497089126609,1.0022825574869039,1.0642236851973577,1.1283421258858297,1.1946592148522128,1.2631959812511864,1.3339731595349034,1.407011200216447,1.4823302800086415,1.5599503113873272,1.6398909516233677,1.7221716113234105,1.8068114625156377,1.8938294463134073,1.9832442801866852,2.075074464868551,2.1693382909216234,2.2660538449872063,2.36523901573795,2.4669114995532007,2.5710888059345764,2.6777882626779785,2.7870270208169257,2.898822059350997,3.0131901897720907,3.1301480604002863,3.2497121605402226,3.3718988244681087,3.4967242352587946,3.624204428461639,3.754355295633311,3.887192587735158,4.022731918402185,4.160988767090289,4.301978482107941,4.445716283538092,4.592217266055746,4.741496401646282,4.893568542229298,5.048448422192488,5.20615066083972,5.3666897647573375,5.5300801301023865,5.696336044816294,5.865471690767354,6.037501145825082,6.212438385869475,6.390297286737924,6.571091626112461,6.7548350853498045,6.941541251256611,7.131223617812143,7.323895587840543,7.5195704746346665,7.7182615035334345,7.919981813454504,8.124744458384042,8.332562408825165,8.543448553206703,8.757415699253682,8.974476575321063,9.194643831691977,9.417930041841839,9.644347703669503,9.873909240696694,10.106627003236781,10.342513269534024,10.58158024687427,10.8238400726681,11.069304815507364,11.317986476196008,11.569896988756009,11.825048221409341,12.083451977536606,12.345119996613247,12.610063955123938,12.878295467455942,13.149826086772048,13.42466730586372,13.702830557985108,13.984327217668513,14.269168601521828,14.55736596900856,14.848930523210871,15.143873411576273,15.44220572664832,15.743938506781891,16.04908273684337,16.35764934889634,16.66964922287304,16.985093187232053,17.30399201960269,17.62635644741625,17.95219714852476,18.281524751807332,18.614349837764564,18.95068293910138,19.290534541298456,19.633915083172692,19.98083495742689,20.331304511189067,20.685334046541502,21.042933821039977,21.404114048223256,21.76888489811322,22.137256497705877,22.50923893145328,22.884842241736916,23.264076429332462,23.6469514538663,24.033477234264016,24.42366364919083,24.817520537484558,25.21505769858089,25.61628489293138,26.021211842414342,26.429848230738664,26.842203703840827,27.258287870275353,27.678110301598522,28.10168053274597,28.529008062403893,28.96010235337422,29.39497283293396,29.83362889318845,30.276079891419332,30.722335150426627,31.172403958865512,31.62629557157785,32.08401920991837,32.54558406207592,33.010999283389665,33.4802739966603,33.953417292456834,34.430438229418264,34.911345834551085,35.39614910352207,35.88485700094671,36.37747846067349,36.87402238606382,37.37449765026789,37.87891309649659,38.38727753828926,38.89959975977785,39.41588851594697,39.93615253289054,40.460400508064545,40.98864111053629,41.520882981230194,42.05713473317016,42.597404951718396,43.141702194811224,43.6900349931913,44.24241185063697,44.798841244188324,45.35933162437017,45.92389141541209,46.49252901546552,47.065252796817916,47.64207110610409,48.22299226451468,48.808024568002054,49.3971762874833,49.9904556690408,50.587870934119984,51.189430279724725,51.79514187861014,52.40501387947288,53.0190544071392,53.637271562750364,54.259673423945976,54.88626804504493,55.517063457223934,56.15206766869424,56.79128866487574,57.43473440856916,58.08241284012621,58.734331877617365,59.39049941699807,60.05092333227251,60.715611475655585,61.38457167773311,62.057811747619894,62.7353394731159,63.417162620860914,64.10328893648692,64.79372614476921,65.48848194977529,66.18756403501224,66.89098006357258,67.59873767827808,68.31084450182222,69.02730813691093,69.74813616640164,70.47333615344107,71.20291564160104,71.93688215501312,72.67524319850172,73.41800625771542,74.16517879925733,74.9167682708136,75.67278210128072,76.43322770089146,77.1981124613393,77.96744375590167,78.74122893956174,79.51947534912904,80.30219030335869,81.08938110306934,81.88105503125999,82.67721935322541,83.4778813166706,84.28304815182372,85.09272707154808,85.90692527145302,86.72564993000343,87.54890820862819,88.3767072518277,89.2090541872801,90.04595612594655,90.88742016217518,91.73345337380438,92.58406282226491,93.43925555268066,94.29903859396902,95.16341895893969,96.03240364439274,96.9059996312159,97.78421388448044,98.6670533535366,99.55452497210776];var F=class t{static from(e,r,a){return new t(nt.solveToInt(e,r,a))}static fromInt(e){return new t(e)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(e){this.setInternalState(nt.solveToInt(e,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(e){this.setInternalState(nt.solveToInt(this.internalHue,e,this.internalTone))}get tone(){return this.internalTone}set tone(e){this.setInternalState(nt.solveToInt(this.internalHue,this.internalChroma,e))}constructor(e){this.argb=e;let r=it.fromInt(e);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=Rt(e),this.argb=e}setInternalState(e){let r=it.fromInt(e);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=Rt(e),this.argb=e}inViewingConditions(e){let a=it.fromInt(this.toInt()).xyzInViewingConditions(e),n=it.fromXyzInViewingConditions(a[0],a[1],a[2],et.make());return t.from(n.hue,n.chroma,Bt(a[1]))}};var X=class t{static ratioOfTones(e,r){return e=kt(0,100,e),r=kt(0,100,r),t.ratioOfYs(rt(e),rt(r))}static ratioOfYs(e,r){let a=e>r?e:r,n=a===r?e:r;return(a+5)/(n+5)}static lighter(e,r){if(e<0||e>100)return-1;let a=rt(e),n=r*(a+5)-5,i=t.ratioOfYs(n,a),s=Math.abs(i-r);if(i<r&&s>.04)return-1;let c=Bt(n)+.4;return c<0||c>100?-1:c}static darker(e,r){if(e<0||e>100)return-1;let a=rt(e),n=(a+5)/r-5,i=t.ratioOfYs(a,n),s=Math.abs(i-r);if(i<r&&s>.04)return-1;let c=Bt(n)-.4;return c<0||c>100?-1:c}static lighterUnsafe(e,r){let a=t.lighter(e,r);return a<0?100:a}static darkerUnsafe(e,r){let a=t.darker(e,r);return a<0?0:a}};var mt=class t{static isDisliked(e){let r=Math.round(e.hue)>=90&&Math.round(e.hue)<=111,a=Math.round(e.chroma)>16,n=Math.round(e.tone)<65;return r&&a&&n}static fixIfDisliked(e){return t.isDisliked(e)?F.from(e.hue,e.chroma,70):e}};var x=class t{static fromPalette(e){return new t(e.name??"",e.palette,e.tone,e.isBackground??!1,e.background,e.secondBackground,e.contrastCurve,e.toneDeltaPair)}constructor(e,r,a,n,i,s,c,m){if(this.name=e,this.palette=r,this.tone=a,this.isBackground=n,this.background=i,this.secondBackground=s,this.contrastCurve=c,this.toneDeltaPair=m,this.hctCache=new Map,!i&&s)throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);if(!i&&c)throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);if(i&&!c)throw new Error(`Color ${e} has backgrounddefined, but contrastCurve is not defined.`)}getArgb(e){return this.getHct(e).toInt()}getHct(e){let r=this.hctCache.get(e);if(r!=null)return r;let a=this.getTone(e),n=this.palette(e).getHct(a);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(e,n),n}getTone(e){let r=e.contrastLevel<0;if(this.toneDeltaPair){let a=this.toneDeltaPair(e),n=a.roleA,i=a.roleB,s=a.delta,c=a.polarity,m=a.stayTogether,d=this.background(e).getTone(e),h=c==="nearer"||c==="lighter"&&!e.isDark||c==="darker"&&e.isDark,f=h?n:i,u=h?i:n,g=this.name===f.name,p=e.isDark?1:-1,P=f.contrastCurve.get(e.contrastLevel),T=u.contrastCurve.get(e.contrastLevel),S=f.tone(e),C=X.ratioOfTones(d,S)>=P?S:t.foregroundTone(d,P),E=u.tone(e),M=X.ratioOfTones(d,E)>=T?E:t.foregroundTone(d,T);return r&&(C=t.foregroundTone(d,P),M=t.foregroundTone(d,T)),(M-C)*p>=s||(M=kt(0,100,C+s*p),(M-C)*p>=s||(C=kt(0,100,M-s*p))),50<=C&&C<60?p>0?(C=60,M=Math.max(M,C+s*p)):(C=49,M=Math.min(M,C+s*p)):50<=M&&M<60&&(m?p>0?(C=60,M=Math.max(M,C+s*p)):(C=49,M=Math.min(M,C+s*p)):p>0?M=60:M=49),g?C:M}else{let a=this.tone(e);if(this.background==null)return a;let n=this.background(e).getTone(e),i=this.contrastCurve.get(e.contrastLevel);if(X.ratioOfTones(n,a)>=i||(a=t.foregroundTone(n,i)),r&&(a=t.foregroundTone(n,i)),this.isBackground&&50<=a&&a<60&&(X.ratioOfTones(49,n)>=i?a=49:a=60),this.secondBackground){let[s,c]=[this.background,this.secondBackground],[m,l]=[s(e).getTone(e),c(e).getTone(e)],[d,h]=[Math.max(m,l),Math.min(m,l)];if(X.ratioOfTones(d,a)>=i&&X.ratioOfTones(h,a)>=i)return a;let f=X.lighter(d,i),u=X.darker(h,i),g=[];return f!==-1&&g.push(f),u!==-1&&g.push(u),t.tonePrefersLightForeground(m)||t.tonePrefersLightForeground(l)?f<0?100:f:g.length===1?g[0]:u<0?0:u}return a}}static foregroundTone(e,r){let a=X.lighterUnsafe(e,r),n=X.darkerUnsafe(e,r),i=X.ratioOfTones(a,e),s=X.ratioOfTones(n,e);if(t.tonePrefersLightForeground(e)){let m=Math.abs(i-s)<.1&&i<r&&s<r;return i>=r||i>=s||m?a:n}else return s>=r||s>=i?n:a}static tonePrefersLightForeground(e){return Math.round(e)<60}static toneAllowsLightForeground(e){return Math.round(e)<=49}static enableLightForeground(e){return t.tonePrefersLightForeground(e)&&!t.toneAllowsLightForeground(e)?49:e}};var b=class t{static fromInt(e){let r=F.fromInt(e);return t.fromHct(r)}static fromHct(e){return new t(e.hue,e.chroma,e)}static fromHueAndChroma(e,r){let a=new Wt(e,r).create();return new t(e,r,a)}constructor(e,r,a){this.hue=e,this.chroma=r,this.keyColor=a,this.cache=new Map}tone(e){let r=this.cache.get(e);return r===void 0&&(r=F.from(this.hue,this.chroma,e).toInt(),this.cache.set(e,r)),r}getHct(e){return F.fromInt(this.tone(e))}},Wt=class{constructor(e,r){this.hue=e,this.requestedChroma=r,this.chromaCache=new Map,this.maxChromaValue=200}create(){let n=0,i=100;for(;n<i;){let s=Math.floor((n+i)/2),c=this.maxChroma(s)<this.maxChroma(s+1);if(this.maxChroma(s)>=this.requestedChroma-.01)if(Math.abs(n-50)<Math.abs(i-50))i=s;else{if(n===s)return F.from(this.hue,this.requestedChroma,n);n=s}else c?n=s+1:i=s}return F.from(this.hue,this.requestedChroma,n)}maxChroma(e){if(this.chromaCache.has(e))return this.chromaCache.get(e);let r=F.from(this.hue,this.maxChromaValue,e).chroma;return this.chromaCache.set(e,r),r}};var A=class{constructor(e,r,a,n){this.low=e,this.normal=r,this.medium=a,this.high=n}get(e){return e<=-1?this.low:e<0?pt(this.low,this.normal,(e- -1)/1):e<.5?pt(this.normal,this.medium,(e-0)/.5):e<1?pt(this.medium,this.high,(e-.5)/.5):this.high}};var W=class{constructor(e,r,a,n,i){this.roleA=e,this.roleB=r,this.delta=a,this.polarity=n,this.stayTogether=i}};var N;(function(t){t[t.MONOCHROME=0]="MONOCHROME",t[t.NEUTRAL=1]="NEUTRAL",t[t.TONAL_SPOT=2]="TONAL_SPOT",t[t.VIBRANT=3]="VIBRANT",t[t.EXPRESSIVE=4]="EXPRESSIVE",t[t.FIDELITY=5]="FIDELITY",t[t.CONTENT=6]="CONTENT",t[t.RAINBOW=7]="RAINBOW",t[t.FRUIT_SALAD=8]="FRUIT_SALAD"})(N||(N={}));function Mt(t){return t.variant===N.FIDELITY||t.variant===N.CONTENT}function z(t){return t.variant===N.MONOCHROME}function Ae(t,e,r,a){let n=r,i=F.from(t,e,r);if(i.chroma<e){let s=i.chroma;for(;i.chroma<e;){n+=a?-1:1;let c=F.from(t,e,n);if(s>c.chroma||Math.abs(c.chroma-e)<.4)break;let m=Math.abs(c.chroma-e),l=Math.abs(i.chroma-e);m<l&&(i=c),s=Math.max(s,c.chroma)}}return n}var o=class t{static highestSurface(e){return e.isDark?t.surfaceBright:t.surfaceDim}};o.contentAccentToneDelta=15;o.primaryPaletteKeyColor=x.fromPalette({name:"primary_palette_key_color",palette:t=>t.primaryPalette,tone:t=>t.primaryPalette.keyColor.tone});o.secondaryPaletteKeyColor=x.fromPalette({name:"secondary_palette_key_color",palette:t=>t.secondaryPalette,tone:t=>t.secondaryPalette.keyColor.tone});o.tertiaryPaletteKeyColor=x.fromPalette({name:"tertiary_palette_key_color",palette:t=>t.tertiaryPalette,tone:t=>t.tertiaryPalette.keyColor.tone});o.neutralPaletteKeyColor=x.fromPalette({name:"neutral_palette_key_color",palette:t=>t.neutralPalette,tone:t=>t.neutralPalette.keyColor.tone});o.neutralVariantPaletteKeyColor=x.fromPalette({name:"neutral_variant_palette_key_color",palette:t=>t.neutralVariantPalette,tone:t=>t.neutralVariantPalette.keyColor.tone});o.background=x.fromPalette({name:"background",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:98,isBackground:!0});o.onBackground=x.fromPalette({name:"on_background",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:10,background:t=>o.background,contrastCurve:new A(3,3,4.5,7)});o.surface=x.fromPalette({name:"surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:98,isBackground:!0});o.surfaceDim=x.fromPalette({name:"surface_dim",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:new A(87,87,80,75).get(t.contrastLevel),isBackground:!0});o.surfaceBright=x.fromPalette({name:"surface_bright",palette:t=>t.neutralPalette,tone:t=>t.isDark?new A(24,24,29,34).get(t.contrastLevel):98,isBackground:!0});o.surfaceContainerLowest=x.fromPalette({name:"surface_container_lowest",palette:t=>t.neutralPalette,tone:t=>t.isDark?new A(4,4,2,0).get(t.contrastLevel):100,isBackground:!0});o.surfaceContainerLow=x.fromPalette({name:"surface_container_low",palette:t=>t.neutralPalette,tone:t=>t.isDark?new A(10,10,11,12).get(t.contrastLevel):new A(96,96,96,95).get(t.contrastLevel),isBackground:!0});o.surfaceContainer=x.fromPalette({name:"surface_container",palette:t=>t.neutralPalette,tone:t=>t.isDark?new A(12,12,16,20).get(t.contrastLevel):new A(94,94,92,90).get(t.contrastLevel),isBackground:!0});o.surfaceContainerHigh=x.fromPalette({name:"surface_container_high",palette:t=>t.neutralPalette,tone:t=>t.isDark?new A(17,17,21,25).get(t.contrastLevel):new A(92,92,88,85).get(t.contrastLevel),isBackground:!0});o.surfaceContainerHighest=x.fromPalette({name:"surface_container_highest",palette:t=>t.neutralPalette,tone:t=>t.isDark?new A(22,22,26,30).get(t.contrastLevel):new A(90,90,84,80).get(t.contrastLevel),isBackground:!0});o.onSurface=x.fromPalette({name:"on_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:10,background:t=>o.highestSurface(t),contrastCurve:new A(4.5,7,11,21)});o.surfaceVariant=x.fromPalette({name:"surface_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?30:90,isBackground:!0});o.onSurfaceVariant=x.fromPalette({name:"on_surface_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?80:30,background:t=>o.highestSurface(t),contrastCurve:new A(3,4.5,7,11)});o.inverseSurface=x.fromPalette({name:"inverse_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:20});o.inverseOnSurface=x.fromPalette({name:"inverse_on_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?20:95,background:t=>o.inverseSurface,contrastCurve:new A(4.5,7,11,21)});o.outline=x.fromPalette({name:"outline",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?60:50,background:t=>o.highestSurface(t),contrastCurve:new A(1.5,3,4.5,7)});o.outlineVariant=x.fromPalette({name:"outline_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?30:80,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5)});o.shadow=x.fromPalette({name:"shadow",palette:t=>t.neutralPalette,tone:t=>0});o.scrim=x.fromPalette({name:"scrim",palette:t=>t.neutralPalette,tone:t=>0});o.surfaceTint=x.fromPalette({name:"surface_tint",palette:t=>t.primaryPalette,tone:t=>t.isDark?80:40,isBackground:!0});o.primary=x.fromPalette({name:"primary",palette:t=>t.primaryPalette,tone:t=>z(t)?t.isDark?100:0:t.isDark?80:40,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(3,4.5,7,7),toneDeltaPair:t=>new W(o.primaryContainer,o.primary,10,"nearer",!1)});o.onPrimary=x.fromPalette({name:"on_primary",palette:t=>t.primaryPalette,tone:t=>z(t)?t.isDark?10:90:t.isDark?20:100,background:t=>o.primary,contrastCurve:new A(4.5,7,11,21)});o.primaryContainer=x.fromPalette({name:"primary_container",palette:t=>t.primaryPalette,tone:t=>Mt(t)?t.sourceColorHct.tone:z(t)?t.isDark?85:25:t.isDark?30:90,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5),toneDeltaPair:t=>new W(o.primaryContainer,o.primary,10,"nearer",!1)});o.onPrimaryContainer=x.fromPalette({name:"on_primary_container",palette:t=>t.primaryPalette,tone:t=>Mt(t)?x.foregroundTone(o.primaryContainer.tone(t),4.5):z(t)?t.isDark?0:100:t.isDark?90:30,background:t=>o.primaryContainer,contrastCurve:new A(3,4.5,7,11)});o.inversePrimary=x.fromPalette({name:"inverse_primary",palette:t=>t.primaryPalette,tone:t=>t.isDark?40:80,background:t=>o.inverseSurface,contrastCurve:new A(3,4.5,7,7)});o.secondary=x.fromPalette({name:"secondary",palette:t=>t.secondaryPalette,tone:t=>t.isDark?80:40,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(3,4.5,7,7),toneDeltaPair:t=>new W(o.secondaryContainer,o.secondary,10,"nearer",!1)});o.onSecondary=x.fromPalette({name:"on_secondary",palette:t=>t.secondaryPalette,tone:t=>z(t)?t.isDark?10:100:t.isDark?20:100,background:t=>o.secondary,contrastCurve:new A(4.5,7,11,21)});o.secondaryContainer=x.fromPalette({name:"secondary_container",palette:t=>t.secondaryPalette,tone:t=>{let e=t.isDark?30:90;return z(t)?t.isDark?30:85:Mt(t)?Ae(t.secondaryPalette.hue,t.secondaryPalette.chroma,e,!t.isDark):e},isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5),toneDeltaPair:t=>new W(o.secondaryContainer,o.secondary,10,"nearer",!1)});o.onSecondaryContainer=x.fromPalette({name:"on_secondary_container",palette:t=>t.secondaryPalette,tone:t=>z(t)?t.isDark?90:10:Mt(t)?x.foregroundTone(o.secondaryContainer.tone(t),4.5):t.isDark?90:30,background:t=>o.secondaryContainer,contrastCurve:new A(3,4.5,7,11)});o.tertiary=x.fromPalette({name:"tertiary",palette:t=>t.tertiaryPalette,tone:t=>z(t)?t.isDark?90:25:t.isDark?80:40,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(3,4.5,7,7),toneDeltaPair:t=>new W(o.tertiaryContainer,o.tertiary,10,"nearer",!1)});o.onTertiary=x.fromPalette({name:"on_tertiary",palette:t=>t.tertiaryPalette,tone:t=>z(t)?t.isDark?10:90:t.isDark?20:100,background:t=>o.tertiary,contrastCurve:new A(4.5,7,11,21)});o.tertiaryContainer=x.fromPalette({name:"tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>{if(z(t))return t.isDark?60:49;if(!Mt(t))return t.isDark?30:90;let e=t.tertiaryPalette.getHct(t.sourceColorHct.tone);return mt.fixIfDisliked(e).tone},isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5),toneDeltaPair:t=>new W(o.tertiaryContainer,o.tertiary,10,"nearer",!1)});o.onTertiaryContainer=x.fromPalette({name:"on_tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>z(t)?t.isDark?0:100:Mt(t)?x.foregroundTone(o.tertiaryContainer.tone(t),4.5):t.isDark?90:30,background:t=>o.tertiaryContainer,contrastCurve:new A(3,4.5,7,11)});o.error=x.fromPalette({name:"error",palette:t=>t.errorPalette,tone:t=>t.isDark?80:40,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(3,4.5,7,7),toneDeltaPair:t=>new W(o.errorContainer,o.error,10,"nearer",!1)});o.onError=x.fromPalette({name:"on_error",palette:t=>t.errorPalette,tone:t=>t.isDark?20:100,background:t=>o.error,contrastCurve:new A(4.5,7,11,21)});o.errorContainer=x.fromPalette({name:"error_container",palette:t=>t.errorPalette,tone:t=>t.isDark?30:90,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5),toneDeltaPair:t=>new W(o.errorContainer,o.error,10,"nearer",!1)});o.onErrorContainer=x.fromPalette({name:"on_error_container",palette:t=>t.errorPalette,tone:t=>z(t)?t.isDark?90:10:t.isDark?90:30,background:t=>o.errorContainer,contrastCurve:new A(3,4.5,7,11)});o.primaryFixed=x.fromPalette({name:"primary_fixed",palette:t=>t.primaryPalette,tone:t=>z(t)?40:90,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5),toneDeltaPair:t=>new W(o.primaryFixed,o.primaryFixedDim,10,"lighter",!0)});o.primaryFixedDim=x.fromPalette({name:"primary_fixed_dim",palette:t=>t.primaryPalette,tone:t=>z(t)?30:80,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5),toneDeltaPair:t=>new W(o.primaryFixed,o.primaryFixedDim,10,"lighter",!0)});o.onPrimaryFixed=x.fromPalette({name:"on_primary_fixed",palette:t=>t.primaryPalette,tone:t=>z(t)?100:10,background:t=>o.primaryFixedDim,secondBackground:t=>o.primaryFixed,contrastCurve:new A(4.5,7,11,21)});o.onPrimaryFixedVariant=x.fromPalette({name:"on_primary_fixed_variant",palette:t=>t.primaryPalette,tone:t=>z(t)?90:30,background:t=>o.primaryFixedDim,secondBackground:t=>o.primaryFixed,contrastCurve:new A(3,4.5,7,11)});o.secondaryFixed=x.fromPalette({name:"secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>z(t)?80:90,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5),toneDeltaPair:t=>new W(o.secondaryFixed,o.secondaryFixedDim,10,"lighter",!0)});o.secondaryFixedDim=x.fromPalette({name:"secondary_fixed_dim",palette:t=>t.secondaryPalette,tone:t=>z(t)?70:80,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5),toneDeltaPair:t=>new W(o.secondaryFixed,o.secondaryFixedDim,10,"lighter",!0)});o.onSecondaryFixed=x.fromPalette({name:"on_secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>10,background:t=>o.secondaryFixedDim,secondBackground:t=>o.secondaryFixed,contrastCurve:new A(4.5,7,11,21)});o.onSecondaryFixedVariant=x.fromPalette({name:"on_secondary_fixed_variant",palette:t=>t.secondaryPalette,tone:t=>z(t)?25:30,background:t=>o.secondaryFixedDim,secondBackground:t=>o.secondaryFixed,contrastCurve:new A(3,4.5,7,11)});o.tertiaryFixed=x.fromPalette({name:"tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>z(t)?40:90,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5),toneDeltaPair:t=>new W(o.tertiaryFixed,o.tertiaryFixedDim,10,"lighter",!0)});o.tertiaryFixedDim=x.fromPalette({name:"tertiary_fixed_dim",palette:t=>t.tertiaryPalette,tone:t=>z(t)?30:80,isBackground:!0,background:t=>o.highestSurface(t),contrastCurve:new A(1,1,3,4.5),toneDeltaPair:t=>new W(o.tertiaryFixed,o.tertiaryFixedDim,10,"lighter",!0)});o.onTertiaryFixed=x.fromPalette({name:"on_tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>z(t)?100:10,background:t=>o.tertiaryFixedDim,secondBackground:t=>o.tertiaryFixed,contrastCurve:new A(4.5,7,11,21)});o.onTertiaryFixedVariant=x.fromPalette({name:"on_tertiary_fixed_variant",palette:t=>t.tertiaryPalette,tone:t=>z(t)?90:30,background:t=>o.tertiaryFixedDim,secondBackground:t=>o.tertiaryFixed,contrastCurve:new A(3,4.5,7,11)});var H=class{constructor(e){this.sourceColorArgb=e.sourceColorArgb,this.variant=e.variant,this.contrastLevel=e.contrastLevel,this.isDark=e.isDark,this.sourceColorHct=F.fromInt(e.sourceColorArgb),this.primaryPalette=e.primaryPalette,this.secondaryPalette=e.secondaryPalette,this.tertiaryPalette=e.tertiaryPalette,this.neutralPalette=e.neutralPalette,this.neutralVariantPalette=e.neutralVariantPalette,this.errorPalette=b.fromHueAndChroma(25,84)}static getRotatedHue(e,r,a){let n=e.hue;if(r.length!==a.length)throw new Error(`mismatch between hue length ${r.length} & rotations ${a.length}`);if(a.length===1)return G(e.hue+a[0]);let i=r.length;for(let s=0;s<=i-2;s++){let c=r[s],m=r[s+1];if(c<n&&n<m)return G(n+a[s])}return n}getArgb(e){return e.getArgb(this)}getHct(e){return e.getHct(this)}get primaryPaletteKeyColor(){return this.getArgb(o.primaryPaletteKeyColor)}get secondaryPaletteKeyColor(){return this.getArgb(o.secondaryPaletteKeyColor)}get tertiaryPaletteKeyColor(){return this.getArgb(o.tertiaryPaletteKeyColor)}get neutralPaletteKeyColor(){return this.getArgb(o.neutralPaletteKeyColor)}get neutralVariantPaletteKeyColor(){return this.getArgb(o.neutralVariantPaletteKeyColor)}get background(){return this.getArgb(o.background)}get onBackground(){return this.getArgb(o.onBackground)}get surface(){return this.getArgb(o.surface)}get surfaceDim(){return this.getArgb(o.surfaceDim)}get surfaceBright(){return this.getArgb(o.surfaceBright)}get surfaceContainerLowest(){return this.getArgb(o.surfaceContainerLowest)}get surfaceContainerLow(){return this.getArgb(o.surfaceContainerLow)}get surfaceContainer(){return this.getArgb(o.surfaceContainer)}get surfaceContainerHigh(){return this.getArgb(o.surfaceContainerHigh)}get surfaceContainerHighest(){return this.getArgb(o.surfaceContainerHighest)}get onSurface(){return this.getArgb(o.onSurface)}get surfaceVariant(){return this.getArgb(o.surfaceVariant)}get onSurfaceVariant(){return this.getArgb(o.onSurfaceVariant)}get inverseSurface(){return this.getArgb(o.inverseSurface)}get inverseOnSurface(){return this.getArgb(o.inverseOnSurface)}get outline(){return this.getArgb(o.outline)}get outlineVariant(){return this.getArgb(o.outlineVariant)}get shadow(){return this.getArgb(o.shadow)}get scrim(){return this.getArgb(o.scrim)}get surfaceTint(){return this.getArgb(o.surfaceTint)}get primary(){return this.getArgb(o.primary)}get onPrimary(){return this.getArgb(o.onPrimary)}get primaryContainer(){return this.getArgb(o.primaryContainer)}get onPrimaryContainer(){return this.getArgb(o.onPrimaryContainer)}get inversePrimary(){return this.getArgb(o.inversePrimary)}get secondary(){return this.getArgb(o.secondary)}get onSecondary(){return this.getArgb(o.onSecondary)}get secondaryContainer(){return this.getArgb(o.secondaryContainer)}get onSecondaryContainer(){return this.getArgb(o.onSecondaryContainer)}get tertiary(){return this.getArgb(o.tertiary)}get onTertiary(){return this.getArgb(o.onTertiary)}get tertiaryContainer(){return this.getArgb(o.tertiaryContainer)}get onTertiaryContainer(){return this.getArgb(o.onTertiaryContainer)}get error(){return this.getArgb(o.error)}get onError(){return this.getArgb(o.onError)}get errorContainer(){return this.getArgb(o.errorContainer)}get onErrorContainer(){return this.getArgb(o.onErrorContainer)}get primaryFixed(){return this.getArgb(o.primaryFixed)}get primaryFixedDim(){return this.getArgb(o.primaryFixedDim)}get onPrimaryFixed(){return this.getArgb(o.onPrimaryFixed)}get onPrimaryFixedVariant(){return this.getArgb(o.onPrimaryFixedVariant)}get secondaryFixed(){return this.getArgb(o.secondaryFixed)}get secondaryFixedDim(){return this.getArgb(o.secondaryFixedDim)}get onSecondaryFixed(){return this.getArgb(o.onSecondaryFixed)}get onSecondaryFixedVariant(){return this.getArgb(o.onSecondaryFixedVariant)}get tertiaryFixed(){return this.getArgb(o.tertiaryFixed)}get tertiaryFixedDim(){return this.getArgb(o.tertiaryFixedDim)}get onTertiaryFixed(){return this.getArgb(o.onTertiaryFixed)}get onTertiaryFixedVariant(){return this.getArgb(o.onTertiaryFixedVariant)}};var Tt=class t{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;let e=this.hctsByHue.concat([this.input]),r=this.tempsByHct;return e.sort((a,n)=>r.get(a)-r.get(n)),this.hctsByTempCache=e,e}get warmest(){return this.hctsByTemp[this.hctsByTemp.length-1]}get coldest(){return this.hctsByTemp[0]}analogous(e=5,r=12){let a=Math.round(this.input.hue),n=this.hctsByHue[a],i=this.relativeTemperature(n),s=[n],c=0;for(let g=0;g<360;g++){let p=Ct(a+g),P=this.hctsByHue[p],T=this.relativeTemperature(P),S=Math.abs(T-i);i=T,c+=S}let m=1,l=c/r,d=0;for(i=this.relativeTemperature(n);s.length<r;){let g=Ct(a+m),p=this.hctsByHue[g],P=this.relativeTemperature(p),T=Math.abs(P-i);d+=T;let S=s.length*l,C=d>=S,E=1;for(;C&&s.length<r;){s.push(p);let M=(s.length+E)*l;C=d>=M,E++}if(i=P,m++,m>360){for(;s.length<r;)s.push(p);break}}let h=[this.input],f=Math.floor((e-1)/2);for(let g=1;g<f+1;g++){let p=0-g;for(;p<0;)p=s.length+p;p>=s.length&&(p=p%s.length),h.splice(0,0,s[p])}let u=e-f-1;for(let g=1;g<u+1;g++){let p=g;for(;p<0;)p=s.length+p;p>=s.length&&(p=p%s.length),h.push(s[p])}return h}get complement(){if(this.complementCache!=null)return this.complementCache;let e=this.coldest.hue,r=this.tempsByHct.get(this.coldest),a=this.warmest.hue,i=this.tempsByHct.get(this.warmest)-r,s=t.isBetween(this.input.hue,e,a),c=s?a:e,m=s?e:a,l=1,d=1e3,h=this.hctsByHue[Math.round(this.input.hue)],f=1-this.inputRelativeTemperature;for(let u=0;u<=360;u+=1){let g=G(c+l*u);if(!t.isBetween(g,c,m))continue;let p=this.hctsByHue[Math.round(g)],P=(this.tempsByHct.get(p)-r)/i,T=Math.abs(f-P);T<d&&(d=T,h=p)}return this.complementCache=h,this.complementCache}relativeTemperature(e){let r=this.tempsByHct.get(this.warmest)-this.tempsByHct.get(this.coldest),a=this.tempsByHct.get(e)-this.tempsByHct.get(this.coldest);return r===0?.5:a/r}get inputRelativeTemperature(){return this.inputRelativeTemperatureCache>=0?this.inputRelativeTemperatureCache:(this.inputRelativeTemperatureCache=this.relativeTemperature(this.input),this.inputRelativeTemperatureCache)}get tempsByHct(){if(this.tempsByHctCache.size>0)return this.tempsByHctCache;let e=this.hctsByHue.concat([this.input]),r=new Map;for(let a of e)r.set(a,t.rawTemperature(a));return this.tempsByHctCache=r,r}get hctsByHue(){if(this.hctsByHueCache.length>0)return this.hctsByHueCache;let e=[];for(let r=0;r<=360;r+=1){let a=F.from(r,this.input.chroma,this.input.tone);e.push(a)}return this.hctsByHueCache=e,this.hctsByHueCache}static isBetween(e,r,a){return r<a?r<=e&&e<=a:r<=e||e<=a}static rawTemperature(e){let r=qt(e.toInt()),a=G(Math.atan2(r[2],r[1])*180/Math.PI),n=Math.sqrt(r[1]*r[1]+r[2]*r[2]);return-.5+.02*Math.pow(n,1.07)*Math.cos(G(a-50)*Math.PI/180)}};var Ot=class extends H{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:N.CONTENT,contrastLevel:a,isDark:r,primaryPalette:b.fromHueAndChroma(e.hue,e.chroma),secondaryPalette:b.fromHueAndChroma(e.hue,Math.max(e.chroma-32,e.chroma*.5)),tertiaryPalette:b.fromInt(mt.fixIfDisliked(new Tt(e).analogous(3,6)[2]).toInt()),neutralPalette:b.fromHueAndChroma(e.hue,e.chroma/8),neutralVariantPalette:b.fromHueAndChroma(e.hue,e.chroma/8+4)})}};var bt=class t extends H{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:N.EXPRESSIVE,contrastLevel:a,isDark:r,primaryPalette:b.fromHueAndChroma(G(e.hue+240),40),secondaryPalette:b.fromHueAndChroma(H.getRotatedHue(e,t.hues,t.secondaryRotations),24),tertiaryPalette:b.fromHueAndChroma(H.getRotatedHue(e,t.hues,t.tertiaryRotations),32),neutralPalette:b.fromHueAndChroma(e.hue+15,8),neutralVariantPalette:b.fromHueAndChroma(e.hue+15,12)})}};bt.hues=[0,21,51,121,151,191,271,321,360];bt.secondaryRotations=[45,95,45,20,45,90,45,45,45];bt.tertiaryRotations=[120,120,20,45,20,15,20,120,120];var Nt=class extends H{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:N.FIDELITY,contrastLevel:a,isDark:r,primaryPalette:b.fromHueAndChroma(e.hue,e.chroma),secondaryPalette:b.fromHueAndChroma(e.hue,Math.max(e.chroma-32,e.chroma*.5)),tertiaryPalette:b.fromInt(mt.fixIfDisliked(new Tt(e).complement).toInt()),neutralPalette:b.fromHueAndChroma(e.hue,e.chroma/8),neutralVariantPalette:b.fromHueAndChroma(e.hue,e.chroma/8+4)})}};var Ht=class extends H{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:N.FRUIT_SALAD,contrastLevel:a,isDark:r,primaryPalette:b.fromHueAndChroma(G(e.hue-50),48),secondaryPalette:b.fromHueAndChroma(G(e.hue-50),36),tertiaryPalette:b.fromHueAndChroma(e.hue,36),neutralPalette:b.fromHueAndChroma(e.hue,10),neutralVariantPalette:b.fromHueAndChroma(e.hue,16)})}};var Lt=class extends H{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:N.MONOCHROME,contrastLevel:a,isDark:r,primaryPalette:b.fromHueAndChroma(e.hue,0),secondaryPalette:b.fromHueAndChroma(e.hue,0),tertiaryPalette:b.fromHueAndChroma(e.hue,0),neutralPalette:b.fromHueAndChroma(e.hue,0),neutralVariantPalette:b.fromHueAndChroma(e.hue,0)})}};var Et=class extends H{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:N.NEUTRAL,contrastLevel:a,isDark:r,primaryPalette:b.fromHueAndChroma(e.hue,12),secondaryPalette:b.fromHueAndChroma(e.hue,8),tertiaryPalette:b.fromHueAndChroma(e.hue,16),neutralPalette:b.fromHueAndChroma(e.hue,2),neutralVariantPalette:b.fromHueAndChroma(e.hue,2)})}};var zt=class extends H{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:N.RAINBOW,contrastLevel:a,isDark:r,primaryPalette:b.fromHueAndChroma(e.hue,48),secondaryPalette:b.fromHueAndChroma(e.hue,16),tertiaryPalette:b.fromHueAndChroma(G(e.hue+60),24),neutralPalette:b.fromHueAndChroma(e.hue,0),neutralVariantPalette:b.fromHueAndChroma(e.hue,0)})}};var Vt=class extends H{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:N.TONAL_SPOT,contrastLevel:a,isDark:r,primaryPalette:b.fromHueAndChroma(e.hue,36),secondaryPalette:b.fromHueAndChroma(e.hue,16),tertiaryPalette:b.fromHueAndChroma(G(e.hue+60),24),neutralPalette:b.fromHueAndChroma(e.hue,6),neutralVariantPalette:b.fromHueAndChroma(e.hue,8)})}};var yt=class t extends H{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:N.VIBRANT,contrastLevel:a,isDark:r,primaryPalette:b.fromHueAndChroma(e.hue,200),secondaryPalette:b.fromHueAndChroma(H.getRotatedHue(e,t.hues,t.secondaryRotations),24),tertiaryPalette:b.fromHueAndChroma(H.getRotatedHue(e,t.hues,t.tertiaryRotations),32),neutralPalette:b.fromHueAndChroma(e.hue,10),neutralVariantPalette:b.fromHueAndChroma(e.hue,12)})}};yt.hues=[0,41,61,101,131,181,251,301,360];yt.secondaryRotations=[18,15,10,12,15,18,15,12,12];yt.tertiaryRotations=[35,30,20,25,30,35,30,25,25];var ve={desired:4,fallbackColorARGB:4282549748,filter:!0};function Me(t,e){return t.score>e.score?-1:t.score<e.score?1:0}var lt=class t{constructor(){}static score(e,r){let{desired:a,fallbackColorARGB:n,filter:i}={...ve,...r},s=[],c=new Array(360).fill(0),m=0;for(let[u,g]of e.entries()){let p=F.fromInt(u);s.push(p);let P=Math.floor(p.hue);c[P]+=g,m+=g}let l=new Array(360).fill(0);for(let u=0;u<360;u++){let g=c[u]/m;for(let p=u-14;p<u+16;p++){let P=Ct(p);l[P]+=g}}let d=new Array;for(let u of s){let g=Ct(Math.round(u.hue)),p=l[g];if(i&&(u.chroma<t.CUTOFF_CHROMA||p<=t.CUTOFF_EXCITED_PROPORTION))continue;let P=p*100*t.WEIGHT_PROPORTION,T=u.chroma<t.TARGET_CHROMA?t.WEIGHT_CHROMA_BELOW:t.WEIGHT_CHROMA_ABOVE,S=(u.chroma-t.TARGET_CHROMA)*T,C=P+S;d.push({hct:u,score:C})}d.sort(Me);let h=[];for(let u=90;u>=15;u--){h.length=0;for(let{hct:g}of d)if(h.find(P=>_t(g.hue,P.hue)<u)||h.push(g),h.length>=a)break;if(h.length>=a)break}let f=[];h.length===0&&f.push(n);for(let u of h)f.push(u.toInt());return f}};lt.TARGET_CHROMA=48;lt.WEIGHT_PROPORTION=.7;lt.WEIGHT_CHROMA_ABOVE=.3;lt.WEIGHT_CHROMA_BELOW=.1;lt.CUTOFF_CHROMA=5;lt.CUTOFF_EXCITED_PROPORTION=.01;var se=Object.freeze(["content","tonal-spot","fruit-salad","rainbow","monochrome","vibrant","faithful","soft","dysfunctional","muted"]),ct=Object.freeze({enabled:!0,dynamic:!0,market:"zh-CN",paletteMode:"content",mode:"schedule",day:"07:00",night:"19:00",strength:28});function $t(t){return Number.isFinite(t)?Math.round(Math.min(100,Math.max(10,t))):ct.strength}function ie(t){return Math.sqrt(1-$t(t)/100)}var Ut=Object.freeze({light:.56,dark:.62});function Te(t){return t==="dark"?`rgba(0, 0, 0, ${Ut.dark})`:`rgba(255, 255, 255, ${Ut.light})`}function Se(t={}){(!t||typeof t!="object")&&(t={});let e=r=>typeof r=="string"&&/^([01]\d|2[0-3]):[0-5]\d$/.test(r);return{enabled:typeof t.enabled=="boolean"?t.enabled:!0,dynamic:typeof t.dynamic=="boolean"?t.dynamic:!0,market:["zh-CN","en-US"].includes(t.market)?t.market:ct.market,paletteMode:se.includes(t.paletteMode)?t.paletteMode:ct.paletteMode,mode:["follow","schedule","system","light","dark"].includes(t.mode)?t.mode:"schedule",day:e(t.day)?t.day:ct.day,night:e(t.night)?t.night:ct.night,strength:$t(t.strength)}}function Ie(t,e,r){let a=c=>Number(c.slice(0,2))*60+Number(c.slice(3)),n=t.getHours()*60+t.getMinutes(),i=a(e),s=a(r);return i===s?null:(i<s?n>=i&&n<s:n>=i||n<s)?"light":"dark"}function De(t=new Date){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function le([t,e,r]){t/=255,e/=255,r/=255;let a=Math.max(t,e,r),n=Math.min(t,e,r),i=a-n,s=(a+n)/2,c=0,m=0;return i&&(m=i/(1-Math.abs(2*s-1)),c=a===t?(e-r)/i%6:a===e?(r-t)/i+2:(t-e)/i+4,c=(c*60+360)%360),[c,m*100,s*100]}function Fe([t,e,r]){e/=100,r/=100;let a=(1-Math.abs(2*r-1))*e,n=a*(1-Math.abs(t/60%2-1)),i=r-a/2;return(t<60?[a,n,0]:t<120?[n,a,0]:t<180?[0,a,n]:t<240?[0,n,a]:t<300?[n,0,a]:[a,0,n]).map(c=>Math.round((c+i)*255))}function Yt(t){let e=t.map(r=>(r/=255,r<=.04045?r/12.92:((r+.055)/1.055)**2.4));return e[0]*.2126+e[1]*.7152+e[2]*.0722}function ht(t,e){let r=Yt(t),a=Yt(e);return(Math.max(r,a)+.05)/(Math.min(r,a)+.05)}function Be(t){let e=new Map;for(let a=0;a+3<t.length;a+=4){if(t[a+3]<200)continue;let n=[t[a],t[a+1],t[a+2]],[i,s,c]=le(n);if(s<18||c<12||c>88)continue;let m=Math.floor(i/15),l=(.25+s/100)*(1-Math.abs(c-50)/65),d=e.get(m)||{weight:0,rgb:[0,0,0]};d.weight+=l,n.forEach((h,f)=>{d.rgb[f]+=h*l}),e.set(m,d)}let r=[...e.values()].sort((a,n)=>n.weight-a.weight)[0];if(!r){let a=0,n=[0,0,0];for(let i=0;i+3<t.length;i+=4)t[i+3]>=200&&(a++,n.forEach((s,c)=>{n[c]+=t[i+c]}));return a?n.map(i=>Math.round(i/a)):[92,116,132]}return r.rgb.map(a=>Math.round(a/r.weight))}var Jt=class extends Et{constructor(e,r,a){super(e,r,a);let n=e.hue;Object.assign(this,{primaryPalette:b.fromHueAndChroma(n,Math.min(e.chroma,20)),secondaryPalette:b.fromHueAndChroma(n,Math.min(e.chroma,8)),tertiaryPalette:b.fromHueAndChroma((n+30)%360,Math.min(e.chroma,12)),neutralPalette:b.fromHueAndChroma(n,2),neutralVariantPalette:b.fromHueAndChroma(n,4)})}},ce=Object.freeze({content:Ot,"tonal-spot":Vt,"fruit-salad":Ht,rainbow:zt,monochrome:Lt,vibrant:yt,faithful:Nt,soft:Et,dysfunctional:bt,muted:Jt}),St=new Map,$=t=>[Pt(t),At(t),vt(t)],Ee=t=>`rgb(${t.join(", ")})`;function Re(t,e){let r=gt(...t),a=`${e}:${r}`;if(!St.has(a)){let n=ce[e],i=F.fromInt(r);St.set(a,[new n(i,!1,0),new n(i,!0,0)]),St.size>22&&St.delete(St.keys().next().value)}return St.get(a)}function Oe(t,e,r){let a={},n=ie(e);for(let[i,s]of Re(t,r).entries()){let c=i===1,m=c?"dark":"light",l={"--dsw-alias-bg-base":$(s.surface),"--dsw-alias-bg-layer-1":$(s.surfaceContainerLow),"--dsw-alias-bg-layer-2":$(s.surfaceContainer),"--dsw-specific-sidebar-fill":$(s.surfaceContainerHigh),"--dsw-alias-border-l1":$(s.outlineVariant),"--dsw-alias-border-l2":$(s.outline)},d=(w,B,L)=>w.map((j,_)=>Math.round(j*(1-L)+B[_]*L));l["--dsw-alias-bg-layer-2"]=d(l["--dsw-alias-bg-layer-2"],$(s.secondaryContainer),.08),l["--dsw-specific-sidebar-fill"]=d(l["--dsw-specific-sidebar-fill"],$(s.tertiaryContainer),.18);let h=l["--dsw-alias-bg-layer-1"],f=d(l["--dsw-alias-bg-layer-2"],$(s.secondaryContainer),.2);l["--dsw-alias-bg-overlay"]=d(h,$(s.secondaryContainer),.04);let u=d(h,$(s.secondaryContainer),.24),g={"--dsw-alias-bg-layer-3":f,"--dsw-alias-bg-module-platform":f,"--dsw-alias-bg-multi-select":f,"--dsw-alias-card-fill":h,"--dsw-alias-card-fill-hover":u,"--dsw-alias-card-tile-fill":h,"--dsw-alias-onboarding-card-fill":h,"--dsw-alias-onboarding-secondary-fill":l["--dsw-alias-bg-layer-2"],"--dsw-alias-button-elevated-fill":h,"--dsw-alias-button-floating-fill":h,"--dsw-alias-button-floating-hover":u,"--dsw-alias-button-ghost-active-fill":f,"--dsw-alias-button-ghost-active-hover":u,"--dsw-alias-button-primary-dimmed":f,"--dsw-alias-interactive-bg-active":f,"--dsw-alias-interactive-bg-hover":u,"--dsw-alias-interactive-bg-hover-solid":u,"--dsw-alias-interactive-bg-hover-accent":f,"--dsw-menu-surface-fill":l["--dsw-alias-bg-overlay"],"--dsw-alias-menu-group-header-fill":h,"--dsw-specific-menu":l["--dsw-alias-bg-overlay"],"--dsw-specific-input-major":h,"--dsw-specific-login-input":l["--dsw-alias-bg-layer-2"],"--dsw-specific-selector":f,"--dsw-specific-tip":h,"--dsw-specific-sidebar-nav-item-active":f,"--dsw-specific-sidebar-nav-item-active-accent":f,"--dsw-specific-bubble":l["--dsw-alias-bg-layer-2"],"--dsw-specific-bubble-highlight":f,"--dsw-alias-markdown-code-block":l["--dsw-alias-bg-layer-2"],"--dsw-alias-markdown-code-block-banner":h,"--dsw-alias-markdown-inline-code":l["--dsw-alias-bg-layer-2"],"--dsw-alias-markdown-code-segment-selected":h,"--dsw-alias-markdown-code-segment-unselected":l["--dsw-alias-bg-layer-2"],"--dsw-alias-markdown-placeholder":f,"--dsw-alias-markdown-tag":f,"--dsw-alias-markdown-citation":f};Object.assign(l,g);let p=[h,l["--dsw-alias-bg-layer-2"],l["--dsw-alias-bg-overlay"],l["--dsw-specific-sidebar-fill"],f,u],P=Ut[m],T=c?0:255;for(let w of[0,255]){let B=w*(1-P)+T*P;p.push([B,B,B]),p.push(l["--dsw-alias-bg-base"].map(L=>L*n+B*(1-n)))}let S=(w,B,L=4.6)=>{let j=Math.round(B);for(;p.some(_=>ht($(w.tone(j)),_)<L)&&j>0&&j<100;)j+=c?1:-1;return $(w.tone(j))},C=S(s.primaryPalette,F.fromInt(s.primary).tone),E=$(s.primaryPalette.tone(Math.max(0,Math.min(100,F.fromInt(gt(...C)).tone+(c?7:-7))))),M=[[0,0,0],[255,255,255]].sort((w,B)=>Math.min(ht(B,C),ht(B,E))-Math.min(ht(w,C),ht(w,E)))[0];l["--dsw-alias-brand-primary"]=C,l["--dsw-alias-label-primary"]=S(s.neutralPalette,F.fromInt(s.onSurface).tone),l["--dsw-alias-label-secondary"]=S(s.neutralVariantPalette,F.fromInt(s.onSurfaceVariant).tone);let O=S(s.neutralVariantPalette,c?70:50);for(let w of["--dsw-alias-label-tertiary","--dsw-alias-label-caption","--dsw-alias-label-dimmed"])l[w]=O;for(let w of["--dsw-alias-brand-text","--dsw-alias-brand-primary-new-colorprimary-new-color","--dsw-alias-link"])l[w]=C;for(let w of["--dsw-alias-label-primary-bluish","--dsw-alias-label-primary-dimmed","--dsw-alias-menu-icon"])l[w]=l["--dsw-alias-label-primary"];for(let w of["--dsw-alias-button-primary-fill","--dsw-alias-button-contrast-fill"])l[w]=C;l["--dsw-alias-button-primary-hover"]=E,l["--dsw-alias-button-info-fill"]=$(s.primaryPalette.tone(35)),l["--dsw-alias-button-info-hover"]=$(s.primaryPalette.tone(28));for(let w of["--dsw-alias-label-primary-foreground","--dsw-alias-label-primary-inverted"])l[w]=M;l["--dsw-focus-ring-color"]=C,l["--dsw-alias-border-l2"]=S(s.neutralVariantPalette,c?60:50,3.1);for(let w of["--dsw-alias-border-selected","--dsw-alias-button-ghost-active-border"])l[w]=C;for(let w of["--dsw-alias-border-l3","--dsw-alias-border-l4","--dsw-alias-border-l2-darkmode-thin","--dsw-alias-onboarding-checkbox-border","--dsw-alias-scrollbar-bg-l1","--dsw-alias-scrollbar-bg-l2"])l[w]=l["--dsw-alias-border-l2"];for(let w of["--dsw-alias-scrollbar-hover-l1","--dsw-alias-scrollbar-hover-l2"])l[w]=C;let I=l["--dsw-alias-border-l3"];l["--dsw-alias-switch-thumb"]=ht([0,0,0],I)>ht([255,255,255],I)?[0,0,0]:[255,255,255];let R=$(s.neutralPalette.tone(14)),V=$(s.neutralPalette.tone(98));for(let w of["--dsw-alias-tooltip-bg","--dsw-alias-toast-bg","--dsw-alias-hovercard-bg"])l[w]=R;for(let w of["--dsw-alias-tooltip-label","--dsw-alias-toast-label","--dsw-alias-hovercard-label-primary"])l[w]=V;l["--dsw-alias-tooltip-key-bg"]=d(R,[255,255,255],.18),l["--dsw-alias-toast-action"]=$(s.primaryPalette.tone(80)),l["--dsw-alias-hovercard-label-secondary"]=$(s.neutralPalette.tone(85)),l["--dsw-alias-hovercard-label-tertiary"]=$(s.neutralPalette.tone(78));for(let[w,B]of Object.entries(l))a[w]||={},a[w][m]=w==="--dsw-alias-bg-base"?`rgba(${B.join(", ")}, ${n})`:Ee(B)}return a}function Ne(t,e=ct.strength,r=ct.paletteMode){e=$t(e);let a=[92,116,132];t=(Array.isArray(t)||ArrayBuffer.isView(t))&&t.length>=3?a.map((i,s)=>Number.isFinite(t[s])?Math.round(Math.max(0,Math.min(255,t[s]))):i):a;let n=typeof r=="string"&&Object.hasOwn(ce,r)?r:ct.paletteMode;return Oe(t,e,n)}var de="dsh.bing-daily-theme.preferences.v1",Xt="dsh.bing-daily-theme.boot.v1",Zt="bdt-boot-theme";function me(t,e,r){if(!t.enabled||!t.dynamic)return null;let a={background:"--dsw-alias-bg-layer-1",primary:"--dsw-alias-label-primary",secondary:"--dsw-alias-label-secondary",tertiary:"--dsw-alias-label-tertiary",border:"--dsw-alias-border-l2",brand:"--dsw-alias-brand-primary"},n={};for(let i of["light","dark"])n[i]=Object.fromEntries(Object.entries(a).map(([s,c])=>[s,e[c][i]]));return{version:1,market:t.market||"zh-CN",paletteMode:t.paletteMode,strength:t.strength,colors:n,imageUrl:r}}var he="body .nUhMVa_confirmPanel{--fold-bg:var(--dsw-alias-bg-layer-2)!important;--fold-border:var(--dsw-alias-border-l2)!important;--fold-ink:var(--dsw-alias-label-primary)!important;--fold-on-ink:var(--dsw-alias-bg-layer-1)!important}";var He=Object.freeze({canvas:"--dsw-specific-sidebar-fill",surface:"--dsw-alias-bg-layer-1",raised:"--dsw-alias-bg-layer-2",selected:"--dsw-specific-sidebar-nav-item-active",ink:"--dsw-alias-label-primary",muted:"--dsw-alias-label-secondary",border:"--dsw-alias-border-l2",brand:"--dsw-alias-brand-primary","on-brand":"--dsw-alias-label-primary-foreground",bubble:"--dsw-specific-bubble",code:"--dsw-alias-markdown-code-block",input:"--dsw-specific-input-major"});function pe(t,e){let r=e==="dark"?"dark":"light";return Object.fromEntries(Object.entries(He).map(([a,n])=>[`--bdt-mini-${a}`,t[n][r]]))}function fe(t,e){return t("span",{className:"bdt-mini-split","aria-hidden":!0,style:pe(e,"light")},ue(t,e,"light"),ue(t,e,"dark"),t("svg",{className:"bdt-mini-diagonal",viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":!0,focusable:!1},t("line",{x1:100,y1:0,x2:0,y2:100,vectorEffect:"non-scaling-stroke"})))}function ue(t,e,r){return t("span",{className:`bdt-mini bdt-mini-${r}`,"aria-hidden":!0,style:pe(e,r)},t("span",{className:"bdt-mini-app"},t("span",{className:"bdt-mini-sidebar"},t("span",{className:"bdt-mini-logo"},"DSH"),t("span",{className:"bdt-mini-nav bdt-mini-nav-active"},t("span",{className:"bdt-mini-line"})),t("span",{className:"bdt-mini-nav"},t("span",{className:"bdt-mini-line"})),t("span",{className:"bdt-mini-nav"},t("span",{className:"bdt-mini-line bdt-mini-short"})),t("span",{className:"bdt-mini-sidebar-footer"},t("span",{className:"bdt-mini-line bdt-mini-short"}))),t("span",{className:"bdt-mini-chat"},t("span",{className:"bdt-mini-heading"},t("span",{className:"bdt-mini-line"}),t("span",{className:"bdt-mini-badge"})),t("span",{className:"bdt-mini-bubble"},t("span",{className:"bdt-mini-line"})),t("span",{className:"bdt-mini-reply"},t("span",{className:"bdt-mini-line"}),t("span",{className:"bdt-mini-line bdt-mini-short"}),t("span",{className:"bdt-mini-code"},t("span",{className:"bdt-mini-code-line"}),t("span",{className:"bdt-mini-code-line bdt-mini-short"}))),t("span",{className:"bdt-mini-composer"},t("span",{className:"bdt-mini-line"}),t("span",{className:"bdt-mini-send"},"\u2191")))))}var ge=`
2
+ (()=>{var Re=Object.defineProperty;var Ne=(t,e)=>{for(var r in e)Re(t,r,{get:e[r],enumerable:!0})};var te={};Ne(te,{DEFAULTS:()=>mt,PALETTE_MODES:()=>pe,WALLPAPER_VEIL:()=>Gt,backgroundAlpha:()=>fe,contrast:()=>pt,extractAccent:()=>Ke,hslToRgb:()=>Je,localDate:()=>Ye,luminance:()=>Zt,makeTokens:()=>tr,normalizeSettings:()=>qe,normalizeStrength:()=>qt,rgbToHsl:()=>ge,scheduledScheme:()=>We,wallpaperShade:()=>Ge});function J(t){return t<0?-1:t===0?0:1}function bt(t,e,r){return(1-r)*t+r*e}function se(t,e,r){return r<t?t:r>e?e:r}function vt(t,e,r){return r<t?t:r>e?e:r}function At(t){return t=t%360,t<0&&(t=t+360),t}function W(t){return t=t%360,t<0&&(t=t+360),t}function Yt(t,e){return 180-Math.abs(Math.abs(t-e)-180)}function Ot(t,e){let r=t[0]*e[0][0]+t[1]*e[0][1]+t[2]*e[0][2],a=t[0]*e[1][0]+t[1]*e[1][1]+t[2]*e[1][2],n=t[0]*e[2][0]+t[1]*e[2][1]+t[2]*e[2][2];return[r,a,n]}var ie=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],He=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],le=[95.047,100,108.883];function wt(t,e,r){return(255<<24|(t&255)<<16|(e&255)<<8|r&255)>>>0}function Jt(t){let e=yt(t[0]),r=yt(t[1]),a=yt(t[2]);return wt(e,r,a)}function Mt(t){return t>>16&255}function St(t){return t>>8&255}function Tt(t){return t&255}function ce(t,e,r){let a=He,n=a[0][0]*t+a[0][1]*e+a[0][2]*r,i=a[1][0]*t+a[1][1]*e+a[1][2]*r,o=a[2][0]*t+a[2][1]*e+a[2][2]*r,c=yt(n),m=yt(i),l=yt(o);return wt(c,m,l)}function Le(t){let e=it(Mt(t)),r=it(St(t)),a=it(Tt(t));return Ot([e,r,a],ie)}function Kt(t){let e=it(Mt(t)),r=it(St(t)),a=it(Tt(t)),n=ie,i=n[0][0]*e+n[0][1]*r+n[0][2]*a,o=n[1][0]*e+n[1][1]*r+n[1][2]*a,c=n[2][0]*e+n[2][1]*r+n[2][2]*a,m=le,l=i/m[0],d=o/m[1],u=c/m[2],f=Rt(l),h=Rt(d),b=Rt(u),p=116*h-16,P=500*(f-h),S=200*(h-b);return[p,P,S]}function de(t){let e=rt(t),r=yt(e);return wt(r,r,r)}function Lt(t){let e=Le(t)[1];return 116*Rt(e/100)-16}function rt(t){return 100*ze((t+16)/116)}function Nt(t){return Rt(t/100)*116-16}function it(t){let e=t/255;return e<=.040449936?e/12.92*100:Math.pow((e+.055)/1.055,2.4)*100}function yt(t){let e=t/100,r=0;return e<=.0031308?r=e*12.92:r=1.055*Math.pow(e,1/2.4)-.055,se(0,255,Math.round(r*255))}function me(){return le}function Rt(t){let e=.008856451679035631,r=24389/27;return t>e?Math.pow(t,1/3):(r*t+16)/116}function ze(t){let e=.008856451679035631,r=24389/27,a=t*t*t;return a>e?a:(116*t-16)/r}var tt=class t{static make(e=me(),r=200/Math.PI*rt(50)/100,a=50,n=2,i=!1){let o=e,c=o[0]*.401288+o[1]*.650173+o[2]*-.051461,m=o[0]*-.250268+o[1]*1.204414+o[2]*.045854,l=o[0]*-.002079+o[1]*.048952+o[2]*.953127,d=.8+n/10,u=d>=.9?bt(.59,.69,(d-.9)*10):bt(.525,.59,(d-.8)*10),f=i?1:d*(1-1/3.6*Math.exp((-r-42)/92));f=f>1?1:f<0?0:f;let h=d,b=[f*(100/c)+1-f,f*(100/m)+1-f,f*(100/l)+1-f],p=1/(5*r+1),P=p*p*p*p,S=1-P,T=P*r+.1*S*S*Math.cbrt(5*r),C=rt(a)/e[1],O=1.48+Math.sqrt(C),M=.725/Math.pow(C,.2),H=M,I=[Math.pow(T*b[0]*c/100,.42),Math.pow(T*b[1]*m/100,.42),Math.pow(T*b[2]*l/100,.42)],B=[400*I[0]/(I[0]+27.13),400*I[1]/(I[1]+27.13),400*I[2]/(I[2]+27.13)],V=(2*B[0]+B[1]+.05*B[2])*M;return new t(C,V,M,H,u,h,b,T,Math.pow(T,.25),O)}constructor(e,r,a,n,i,o,c,m,l,d){this.n=e,this.aw=r,this.nbb=a,this.ncb=n,this.c=i,this.nc=o,this.rgbD=c,this.fl=m,this.fLRoot=l,this.z=d}};tt.DEFAULT=tt.make();var lt=class t{constructor(e,r,a,n,i,o,c,m,l){this.hue=e,this.chroma=r,this.j=a,this.q=n,this.m=i,this.s=o,this.jstar=c,this.astar=m,this.bstar=l}distance(e){let r=this.jstar-e.jstar,a=this.astar-e.astar,n=this.bstar-e.bstar,i=Math.sqrt(r*r+a*a+n*n);return 1.41*Math.pow(i,.63)}static fromInt(e){return t.fromIntInViewingConditions(e,tt.DEFAULT)}static fromIntInViewingConditions(e,r){let a=(e&16711680)>>16,n=(e&65280)>>8,i=e&255,o=it(a),c=it(n),m=it(i),l=.41233895*o+.35762064*c+.18051042*m,d=.2126*o+.7152*c+.0722*m,u=.01932141*o+.11916382*c+.95034478*m,f=.401288*l+.650173*d-.051461*u,h=-.250268*l+1.204414*d+.045854*u,b=-.002079*l+.048952*d+.953127*u,p=r.rgbD[0]*f,P=r.rgbD[1]*h,S=r.rgbD[2]*b,T=Math.pow(r.fl*Math.abs(p)/100,.42),C=Math.pow(r.fl*Math.abs(P)/100,.42),O=Math.pow(r.fl*Math.abs(S)/100,.42),M=J(p)*400*T/(T+27.13),H=J(P)*400*C/(C+27.13),I=J(S)*400*O/(O+27.13),B=(11*M+-12*H+I)/11,V=(M+H-2*I)/9,x=(20*M+20*H+21*I)/20,E=(40*M+20*H+I)/20,_=Math.atan2(V,B)*180/Math.PI,G=_<0?_+360:_>=360?_-360:_,ut=G*Math.PI/180,Ct=E*r.nbb,ot=100*Math.pow(Ct/r.aw,r.c*r.z),Pt=4/r.c*Math.sqrt(ot/100)*(r.aw+4)*r.fLRoot,Bt=G<20.14?G+360:G,y=.25*(Math.cos(Bt*Math.PI/180+2)+3.8),D=5e4/13*y*r.nc*r.ncb*Math.sqrt(B*B+V*V)/(x+.305),U=Math.pow(D,.9)*Math.pow(1.64-Math.pow(.29,r.n),.73),q=U*Math.sqrt(ot/100),N=q*r.fLRoot,Q=50*Math.sqrt(U*r.c/(r.aw+4)),K=(1+100*.007)*ot/(1+.007*ot),st=1/.0228*Math.log(1+.0228*N),et=st*Math.cos(ut),ft=st*Math.sin(ut);return new t(G,q,ot,Pt,N,Q,K,et,ft)}static fromJch(e,r,a){return t.fromJchInViewingConditions(e,r,a,tt.DEFAULT)}static fromJchInViewingConditions(e,r,a,n){let i=4/n.c*Math.sqrt(e/100)*(n.aw+4)*n.fLRoot,o=r*n.fLRoot,c=r/Math.sqrt(e/100),m=50*Math.sqrt(c*n.c/(n.aw+4)),l=a*Math.PI/180,d=(1+100*.007)*e/(1+.007*e),u=1/.0228*Math.log(1+.0228*o),f=u*Math.cos(l),h=u*Math.sin(l);return new t(a,r,e,i,o,m,d,f,h)}static fromUcs(e,r,a){return t.fromUcsInViewingConditions(e,r,a,tt.DEFAULT)}static fromUcsInViewingConditions(e,r,a,n){let i=r,o=a,c=Math.sqrt(i*i+o*o),l=(Math.exp(c*.0228)-1)/.0228/n.fLRoot,d=Math.atan2(o,i)*(180/Math.PI);d<0&&(d+=360);let u=e/(1-(e-100)*.007);return t.fromJchInViewingConditions(u,l,d,n)}toInt(){return this.viewed(tt.DEFAULT)}viewed(e){let r=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),a=Math.pow(r/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),n=this.hue*Math.PI/180,i=.25*(Math.cos(n+2)+3.8),o=e.aw*Math.pow(this.j/100,1/e.c/e.z),c=i*(5e4/13)*e.nc*e.ncb,m=o/e.nbb,l=Math.sin(n),d=Math.cos(n),u=23*(m+.305)*a/(23*c+11*a*d+108*a*l),f=u*d,h=u*l,b=(460*m+451*f+288*h)/1403,p=(460*m-891*f-261*h)/1403,P=(460*m-220*f-6300*h)/1403,S=Math.max(0,27.13*Math.abs(b)/(400-Math.abs(b))),T=J(b)*(100/e.fl)*Math.pow(S,1/.42),C=Math.max(0,27.13*Math.abs(p)/(400-Math.abs(p))),O=J(p)*(100/e.fl)*Math.pow(C,1/.42),M=Math.max(0,27.13*Math.abs(P)/(400-Math.abs(P))),H=J(P)*(100/e.fl)*Math.pow(M,1/.42),I=T/e.rgbD[0],B=O/e.rgbD[1],V=H/e.rgbD[2],x=1.86206786*I-1.01125463*B+.14918677*V,E=.38752654*I+.62144744*B-.00897398*V,R=-.0158415*I-.03412294*B+1.04996444*V;return ce(x,E,R)}static fromXyzInViewingConditions(e,r,a,n){let i=.401288*e+.650173*r-.051461*a,o=-.250268*e+1.204414*r+.045854*a,c=-.002079*e+.048952*r+.953127*a,m=n.rgbD[0]*i,l=n.rgbD[1]*o,d=n.rgbD[2]*c,u=Math.pow(n.fl*Math.abs(m)/100,.42),f=Math.pow(n.fl*Math.abs(l)/100,.42),h=Math.pow(n.fl*Math.abs(d)/100,.42),b=J(m)*400*u/(u+27.13),p=J(l)*400*f/(f+27.13),P=J(d)*400*h/(h+27.13),S=(11*b+-12*p+P)/11,T=(b+p-2*P)/9,C=(20*b+20*p+21*P)/20,O=(40*b+20*p+P)/20,H=Math.atan2(T,S)*180/Math.PI,I=H<0?H+360:H>=360?H-360:H,B=I*Math.PI/180,V=O*n.nbb,x=100*Math.pow(V/n.aw,n.c*n.z),E=4/n.c*Math.sqrt(x/100)*(n.aw+4)*n.fLRoot,R=I<20.14?I+360:I,_=1/4*(Math.cos(R*Math.PI/180+2)+3.8),ut=5e4/13*_*n.nc*n.ncb*Math.sqrt(S*S+T*T)/(C+.305),Ct=Math.pow(ut,.9)*Math.pow(1.64-Math.pow(.29,n.n),.73),ot=Ct*Math.sqrt(x/100),Pt=ot*n.fLRoot,Bt=50*Math.sqrt(Ct*n.c/(n.aw+4)),y=(1+100*.007)*x/(1+.007*x),g=Math.log(1+.0228*Pt)/.0228,D=g*Math.cos(B),U=g*Math.sin(B);return new t(I,ot,x,E,Pt,Bt,y,D,U)}xyzInViewingConditions(e){let r=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),a=Math.pow(r/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),n=this.hue*Math.PI/180,i=.25*(Math.cos(n+2)+3.8),o=e.aw*Math.pow(this.j/100,1/e.c/e.z),c=i*(5e4/13)*e.nc*e.ncb,m=o/e.nbb,l=Math.sin(n),d=Math.cos(n),u=23*(m+.305)*a/(23*c+11*a*d+108*a*l),f=u*d,h=u*l,b=(460*m+451*f+288*h)/1403,p=(460*m-891*f-261*h)/1403,P=(460*m-220*f-6300*h)/1403,S=Math.max(0,27.13*Math.abs(b)/(400-Math.abs(b))),T=J(b)*(100/e.fl)*Math.pow(S,1/.42),C=Math.max(0,27.13*Math.abs(p)/(400-Math.abs(p))),O=J(p)*(100/e.fl)*Math.pow(C,1/.42),M=Math.max(0,27.13*Math.abs(P)/(400-Math.abs(P))),H=J(P)*(100/e.fl)*Math.pow(M,1/.42),I=T/e.rgbD[0],B=O/e.rgbD[1],V=H/e.rgbD[2],x=1.86206786*I-1.01125463*B+.14918677*V,E=.38752654*I+.62144744*B-.00897398*V,R=-.0158415*I-.03412294*B+1.04996444*V;return[x,E,R]}};var nt=class t{static sanitizeRadians(e){return(e+Math.PI*8)%(Math.PI*2)}static trueDelinearized(e){let r=e/100,a=0;return r<=.0031308?a=r*12.92:a=1.055*Math.pow(r,1/2.4)-.055,a*255}static chromaticAdaptation(e){let r=Math.pow(Math.abs(e),.42);return J(e)*400*r/(r+27.13)}static hueOf(e){let r=Ot(e,t.SCALED_DISCOUNT_FROM_LINRGB),a=t.chromaticAdaptation(r[0]),n=t.chromaticAdaptation(r[1]),i=t.chromaticAdaptation(r[2]),o=(11*a+-12*n+i)/11,c=(a+n-2*i)/9;return Math.atan2(c,o)}static areInCyclicOrder(e,r,a){let n=t.sanitizeRadians(r-e),i=t.sanitizeRadians(a-e);return n<i}static intercept(e,r,a){return(r-e)/(a-e)}static lerpPoint(e,r,a){return[e[0]+(a[0]-e[0])*r,e[1]+(a[1]-e[1])*r,e[2]+(a[2]-e[2])*r]}static setCoordinate(e,r,a,n){let i=t.intercept(e[n],r,a[n]);return t.lerpPoint(e,i,a)}static isBounded(e){return 0<=e&&e<=100}static nthVertex(e,r){let a=t.Y_FROM_LINRGB[0],n=t.Y_FROM_LINRGB[1],i=t.Y_FROM_LINRGB[2],o=r%4<=1?0:100,c=r%2===0?0:100;if(r<4){let m=o,l=c,d=(e-m*n-l*i)/a;return t.isBounded(d)?[d,m,l]:[-1,-1,-1]}else if(r<8){let m=o,l=c,d=(e-l*a-m*i)/n;return t.isBounded(d)?[l,d,m]:[-1,-1,-1]}else{let m=o,l=c,d=(e-m*a-l*n)/i;return t.isBounded(d)?[m,l,d]:[-1,-1,-1]}}static bisectToSegment(e,r){let a=[-1,-1,-1],n=a,i=0,o=0,c=!1,m=!0;for(let l=0;l<12;l++){let d=t.nthVertex(e,l);if(d[0]<0)continue;let u=t.hueOf(d);if(!c){a=d,n=d,i=u,o=u,c=!0;continue}(m||t.areInCyclicOrder(i,u,o))&&(m=!1,t.areInCyclicOrder(i,r,u)?(n=d,o=u):(a=d,i=u))}return[a,n]}static midpoint(e,r){return[(e[0]+r[0])/2,(e[1]+r[1])/2,(e[2]+r[2])/2]}static criticalPlaneBelow(e){return Math.floor(e-.5)}static criticalPlaneAbove(e){return Math.ceil(e-.5)}static bisectToLimit(e,r){let a=t.bisectToSegment(e,r),n=a[0],i=t.hueOf(n),o=a[1];for(let c=0;c<3;c++)if(n[c]!==o[c]){let m=-1,l=255;n[c]<o[c]?(m=t.criticalPlaneBelow(t.trueDelinearized(n[c])),l=t.criticalPlaneAbove(t.trueDelinearized(o[c]))):(m=t.criticalPlaneAbove(t.trueDelinearized(n[c])),l=t.criticalPlaneBelow(t.trueDelinearized(o[c])));for(let d=0;d<8&&!(Math.abs(l-m)<=1);d++){let u=Math.floor((m+l)/2),f=t.CRITICAL_PLANES[u],h=t.setCoordinate(n,f,o,c),b=t.hueOf(h);t.areInCyclicOrder(i,r,b)?(o=h,l=u):(n=h,i=b,m=u)}}return t.midpoint(n,o)}static inverseChromaticAdaptation(e){let r=Math.abs(e),a=Math.max(0,27.13*r/(400-r));return J(e)*Math.pow(a,1/.42)}static findResultByJ(e,r,a){let n=Math.sqrt(a)*11,i=tt.DEFAULT,o=1/Math.pow(1.64-Math.pow(.29,i.n),.73),m=.25*(Math.cos(e+2)+3.8)*(5e4/13)*i.nc*i.ncb,l=Math.sin(e),d=Math.cos(e);for(let u=0;u<5;u++){let f=n/100,h=r===0||n===0?0:r/Math.sqrt(f),b=Math.pow(h*o,1/.9),P=i.aw*Math.pow(f,1/i.c/i.z)/i.nbb,S=23*(P+.305)*b/(23*m+11*b*d+108*b*l),T=S*d,C=S*l,O=(460*P+451*T+288*C)/1403,M=(460*P-891*T-261*C)/1403,H=(460*P-220*T-6300*C)/1403,I=t.inverseChromaticAdaptation(O),B=t.inverseChromaticAdaptation(M),V=t.inverseChromaticAdaptation(H),x=Ot([I,B,V],t.LINRGB_FROM_SCALED_DISCOUNT);if(x[0]<0||x[1]<0||x[2]<0)return 0;let E=t.Y_FROM_LINRGB[0],R=t.Y_FROM_LINRGB[1],_=t.Y_FROM_LINRGB[2],G=E*x[0]+R*x[1]+_*x[2];if(G<=0)return 0;if(u===4||Math.abs(G-a)<.002)return x[0]>100.01||x[1]>100.01||x[2]>100.01?0:Jt(x);n=n-(G-a)*n/(2*G)}return 0}static solveToInt(e,r,a){if(r<1e-4||a<1e-4||a>99.9999)return de(a);e=W(e);let n=e/180*Math.PI,i=rt(a),o=t.findResultByJ(n,r,i);if(o!==0)return o;let c=t.bisectToLimit(i,n);return Jt(c)}static solveToCam(e,r,a){return lt.fromInt(t.solveToInt(e,r,a))}};nt.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]];nt.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]];nt.Y_FROM_LINRGB=[.2126,.7152,.0722];nt.CRITICAL_PLANES=[.015176349177441876,.045529047532325624,.07588174588720938,.10623444424209313,.13658714259697685,.16693984095186062,.19729253930674434,.2276452376616281,.2579979360165119,.28835063437139563,.3188300904430532,.350925934958123,.3848314933096426,.42057480301049466,.458183274052838,.4976837250274023,.5391024159806381,.5824650784040898,.6277969426914107,.6751227633498623,.7244668422128921,.775853049866786,.829304845476233,.8848452951698498,.942497089126609,1.0022825574869039,1.0642236851973577,1.1283421258858297,1.1946592148522128,1.2631959812511864,1.3339731595349034,1.407011200216447,1.4823302800086415,1.5599503113873272,1.6398909516233677,1.7221716113234105,1.8068114625156377,1.8938294463134073,1.9832442801866852,2.075074464868551,2.1693382909216234,2.2660538449872063,2.36523901573795,2.4669114995532007,2.5710888059345764,2.6777882626779785,2.7870270208169257,2.898822059350997,3.0131901897720907,3.1301480604002863,3.2497121605402226,3.3718988244681087,3.4967242352587946,3.624204428461639,3.754355295633311,3.887192587735158,4.022731918402185,4.160988767090289,4.301978482107941,4.445716283538092,4.592217266055746,4.741496401646282,4.893568542229298,5.048448422192488,5.20615066083972,5.3666897647573375,5.5300801301023865,5.696336044816294,5.865471690767354,6.037501145825082,6.212438385869475,6.390297286737924,6.571091626112461,6.7548350853498045,6.941541251256611,7.131223617812143,7.323895587840543,7.5195704746346665,7.7182615035334345,7.919981813454504,8.124744458384042,8.332562408825165,8.543448553206703,8.757415699253682,8.974476575321063,9.194643831691977,9.417930041841839,9.644347703669503,9.873909240696694,10.106627003236781,10.342513269534024,10.58158024687427,10.8238400726681,11.069304815507364,11.317986476196008,11.569896988756009,11.825048221409341,12.083451977536606,12.345119996613247,12.610063955123938,12.878295467455942,13.149826086772048,13.42466730586372,13.702830557985108,13.984327217668513,14.269168601521828,14.55736596900856,14.848930523210871,15.143873411576273,15.44220572664832,15.743938506781891,16.04908273684337,16.35764934889634,16.66964922287304,16.985093187232053,17.30399201960269,17.62635644741625,17.95219714852476,18.281524751807332,18.614349837764564,18.95068293910138,19.290534541298456,19.633915083172692,19.98083495742689,20.331304511189067,20.685334046541502,21.042933821039977,21.404114048223256,21.76888489811322,22.137256497705877,22.50923893145328,22.884842241736916,23.264076429332462,23.6469514538663,24.033477234264016,24.42366364919083,24.817520537484558,25.21505769858089,25.61628489293138,26.021211842414342,26.429848230738664,26.842203703840827,27.258287870275353,27.678110301598522,28.10168053274597,28.529008062403893,28.96010235337422,29.39497283293396,29.83362889318845,30.276079891419332,30.722335150426627,31.172403958865512,31.62629557157785,32.08401920991837,32.54558406207592,33.010999283389665,33.4802739966603,33.953417292456834,34.430438229418264,34.911345834551085,35.39614910352207,35.88485700094671,36.37747846067349,36.87402238606382,37.37449765026789,37.87891309649659,38.38727753828926,38.89959975977785,39.41588851594697,39.93615253289054,40.460400508064545,40.98864111053629,41.520882981230194,42.05713473317016,42.597404951718396,43.141702194811224,43.6900349931913,44.24241185063697,44.798841244188324,45.35933162437017,45.92389141541209,46.49252901546552,47.065252796817916,47.64207110610409,48.22299226451468,48.808024568002054,49.3971762874833,49.9904556690408,50.587870934119984,51.189430279724725,51.79514187861014,52.40501387947288,53.0190544071392,53.637271562750364,54.259673423945976,54.88626804504493,55.517063457223934,56.15206766869424,56.79128866487574,57.43473440856916,58.08241284012621,58.734331877617365,59.39049941699807,60.05092333227251,60.715611475655585,61.38457167773311,62.057811747619894,62.7353394731159,63.417162620860914,64.10328893648692,64.79372614476921,65.48848194977529,66.18756403501224,66.89098006357258,67.59873767827808,68.31084450182222,69.02730813691093,69.74813616640164,70.47333615344107,71.20291564160104,71.93688215501312,72.67524319850172,73.41800625771542,74.16517879925733,74.9167682708136,75.67278210128072,76.43322770089146,77.1981124613393,77.96744375590167,78.74122893956174,79.51947534912904,80.30219030335869,81.08938110306934,81.88105503125999,82.67721935322541,83.4778813166706,84.28304815182372,85.09272707154808,85.90692527145302,86.72564993000343,87.54890820862819,88.3767072518277,89.2090541872801,90.04595612594655,90.88742016217518,91.73345337380438,92.58406282226491,93.43925555268066,94.29903859396902,95.16341895893969,96.03240364439274,96.9059996312159,97.78421388448044,98.6670533535366,99.55452497210776];var F=class t{static from(e,r,a){return new t(nt.solveToInt(e,r,a))}static fromInt(e){return new t(e)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(e){this.setInternalState(nt.solveToInt(e,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(e){this.setInternalState(nt.solveToInt(this.internalHue,e,this.internalTone))}get tone(){return this.internalTone}set tone(e){this.setInternalState(nt.solveToInt(this.internalHue,this.internalChroma,e))}constructor(e){this.argb=e;let r=lt.fromInt(e);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=Lt(e),this.argb=e}setInternalState(e){let r=lt.fromInt(e);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=Lt(e),this.argb=e}inViewingConditions(e){let a=lt.fromInt(this.toInt()).xyzInViewingConditions(e),n=lt.fromXyzInViewingConditions(a[0],a[1],a[2],tt.make());return t.from(n.hue,n.chroma,Nt(a[1]))}};var Z=class t{static ratioOfTones(e,r){return e=vt(0,100,e),r=vt(0,100,r),t.ratioOfYs(rt(e),rt(r))}static ratioOfYs(e,r){let a=e>r?e:r,n=a===r?e:r;return(a+5)/(n+5)}static lighter(e,r){if(e<0||e>100)return-1;let a=rt(e),n=r*(a+5)-5,i=t.ratioOfYs(n,a),o=Math.abs(i-r);if(i<r&&o>.04)return-1;let c=Nt(n)+.4;return c<0||c>100?-1:c}static darker(e,r){if(e<0||e>100)return-1;let a=rt(e),n=(a+5)/r-5,i=t.ratioOfYs(a,n),o=Math.abs(i-r);if(i<r&&o>.04)return-1;let c=Nt(n)-.4;return c<0||c>100?-1:c}static lighterUnsafe(e,r){let a=t.lighter(e,r);return a<0?100:a}static darkerUnsafe(e,r){let a=t.darker(e,r);return a<0?0:a}};var ht=class t{static isDisliked(e){let r=Math.round(e.hue)>=90&&Math.round(e.hue)<=111,a=Math.round(e.chroma)>16,n=Math.round(e.tone)<65;return r&&a&&n}static fixIfDisliked(e){return t.isDisliked(e)?F.from(e.hue,e.chroma,70):e}};var k=class t{static fromPalette(e){return new t(e.name??"",e.palette,e.tone,e.isBackground??!1,e.background,e.secondBackground,e.contrastCurve,e.toneDeltaPair)}constructor(e,r,a,n,i,o,c,m){if(this.name=e,this.palette=r,this.tone=a,this.isBackground=n,this.background=i,this.secondBackground=o,this.contrastCurve=c,this.toneDeltaPair=m,this.hctCache=new Map,!i&&o)throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);if(!i&&c)throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);if(i&&!c)throw new Error(`Color ${e} has backgrounddefined, but contrastCurve is not defined.`)}getArgb(e){return this.getHct(e).toInt()}getHct(e){let r=this.hctCache.get(e);if(r!=null)return r;let a=this.getTone(e),n=this.palette(e).getHct(a);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(e,n),n}getTone(e){let r=e.contrastLevel<0;if(this.toneDeltaPair){let a=this.toneDeltaPair(e),n=a.roleA,i=a.roleB,o=a.delta,c=a.polarity,m=a.stayTogether,d=this.background(e).getTone(e),u=c==="nearer"||c==="lighter"&&!e.isDark||c==="darker"&&e.isDark,f=u?n:i,h=u?i:n,b=this.name===f.name,p=e.isDark?1:-1,P=f.contrastCurve.get(e.contrastLevel),S=h.contrastCurve.get(e.contrastLevel),T=f.tone(e),C=Z.ratioOfTones(d,T)>=P?T:t.foregroundTone(d,P),O=h.tone(e),M=Z.ratioOfTones(d,O)>=S?O:t.foregroundTone(d,S);return r&&(C=t.foregroundTone(d,P),M=t.foregroundTone(d,S)),(M-C)*p>=o||(M=vt(0,100,C+o*p),(M-C)*p>=o||(C=vt(0,100,M-o*p))),50<=C&&C<60?p>0?(C=60,M=Math.max(M,C+o*p)):(C=49,M=Math.min(M,C+o*p)):50<=M&&M<60&&(m?p>0?(C=60,M=Math.max(M,C+o*p)):(C=49,M=Math.min(M,C+o*p)):p>0?M=60:M=49),b?C:M}else{let a=this.tone(e);if(this.background==null)return a;let n=this.background(e).getTone(e),i=this.contrastCurve.get(e.contrastLevel);if(Z.ratioOfTones(n,a)>=i||(a=t.foregroundTone(n,i)),r&&(a=t.foregroundTone(n,i)),this.isBackground&&50<=a&&a<60&&(Z.ratioOfTones(49,n)>=i?a=49:a=60),this.secondBackground){let[o,c]=[this.background,this.secondBackground],[m,l]=[o(e).getTone(e),c(e).getTone(e)],[d,u]=[Math.max(m,l),Math.min(m,l)];if(Z.ratioOfTones(d,a)>=i&&Z.ratioOfTones(u,a)>=i)return a;let f=Z.lighter(d,i),h=Z.darker(u,i),b=[];return f!==-1&&b.push(f),h!==-1&&b.push(h),t.tonePrefersLightForeground(m)||t.tonePrefersLightForeground(l)?f<0?100:f:b.length===1?b[0]:h<0?0:h}return a}}static foregroundTone(e,r){let a=Z.lighterUnsafe(e,r),n=Z.darkerUnsafe(e,r),i=Z.ratioOfTones(a,e),o=Z.ratioOfTones(n,e);if(t.tonePrefersLightForeground(e)){let m=Math.abs(i-o)<.1&&i<r&&o<r;return i>=r||i>=o||m?a:n}else return o>=r||o>=i?n:a}static tonePrefersLightForeground(e){return Math.round(e)<60}static toneAllowsLightForeground(e){return Math.round(e)<=49}static enableLightForeground(e){return t.tonePrefersLightForeground(e)&&!t.toneAllowsLightForeground(e)?49:e}};var w=class t{static fromInt(e){let r=F.fromInt(e);return t.fromHct(r)}static fromHct(e){return new t(e.hue,e.chroma,e)}static fromHueAndChroma(e,r){let a=new Xt(e,r).create();return new t(e,r,a)}constructor(e,r,a){this.hue=e,this.chroma=r,this.keyColor=a,this.cache=new Map}tone(e){let r=this.cache.get(e);return r===void 0&&(r=F.from(this.hue,this.chroma,e).toInt(),this.cache.set(e,r)),r}getHct(e){return F.fromInt(this.tone(e))}},Xt=class{constructor(e,r){this.hue=e,this.requestedChroma=r,this.chromaCache=new Map,this.maxChromaValue=200}create(){let n=0,i=100;for(;n<i;){let o=Math.floor((n+i)/2),c=this.maxChroma(o)<this.maxChroma(o+1);if(this.maxChroma(o)>=this.requestedChroma-.01)if(Math.abs(n-50)<Math.abs(i-50))i=o;else{if(n===o)return F.from(this.hue,this.requestedChroma,n);n=o}else c?n=o+1:i=o}return F.from(this.hue,this.requestedChroma,n)}maxChroma(e){if(this.chromaCache.has(e))return this.chromaCache.get(e);let r=F.from(this.hue,this.maxChromaValue,e).chroma;return this.chromaCache.set(e,r),r}};var v=class{constructor(e,r,a,n){this.low=e,this.normal=r,this.medium=a,this.high=n}get(e){return e<=-1?this.low:e<0?bt(this.low,this.normal,(e- -1)/1):e<.5?bt(this.normal,this.medium,(e-0)/.5):e<1?bt(this.medium,this.high,(e-.5)/.5):this.high}};var Y=class{constructor(e,r,a,n,i){this.roleA=e,this.roleB=r,this.delta=a,this.polarity=n,this.stayTogether=i}};var L;(function(t){t[t.MONOCHROME=0]="MONOCHROME",t[t.NEUTRAL=1]="NEUTRAL",t[t.TONAL_SPOT=2]="TONAL_SPOT",t[t.VIBRANT=3]="VIBRANT",t[t.EXPRESSIVE=4]="EXPRESSIVE",t[t.FIDELITY=5]="FIDELITY",t[t.CONTENT=6]="CONTENT",t[t.RAINBOW=7]="RAINBOW",t[t.FRUIT_SALAD=8]="FRUIT_SALAD"})(L||(L={}));function It(t){return t.variant===L.FIDELITY||t.variant===L.CONTENT}function $(t){return t.variant===L.MONOCHROME}function $e(t,e,r,a){let n=r,i=F.from(t,e,r);if(i.chroma<e){let o=i.chroma;for(;i.chroma<e;){n+=a?-1:1;let c=F.from(t,e,n);if(o>c.chroma||Math.abs(c.chroma-e)<.4)break;let m=Math.abs(c.chroma-e),l=Math.abs(i.chroma-e);m<l&&(i=c),o=Math.max(o,c.chroma)}}return n}var s=class t{static highestSurface(e){return e.isDark?t.surfaceBright:t.surfaceDim}};s.contentAccentToneDelta=15;s.primaryPaletteKeyColor=k.fromPalette({name:"primary_palette_key_color",palette:t=>t.primaryPalette,tone:t=>t.primaryPalette.keyColor.tone});s.secondaryPaletteKeyColor=k.fromPalette({name:"secondary_palette_key_color",palette:t=>t.secondaryPalette,tone:t=>t.secondaryPalette.keyColor.tone});s.tertiaryPaletteKeyColor=k.fromPalette({name:"tertiary_palette_key_color",palette:t=>t.tertiaryPalette,tone:t=>t.tertiaryPalette.keyColor.tone});s.neutralPaletteKeyColor=k.fromPalette({name:"neutral_palette_key_color",palette:t=>t.neutralPalette,tone:t=>t.neutralPalette.keyColor.tone});s.neutralVariantPaletteKeyColor=k.fromPalette({name:"neutral_variant_palette_key_color",palette:t=>t.neutralVariantPalette,tone:t=>t.neutralVariantPalette.keyColor.tone});s.background=k.fromPalette({name:"background",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:98,isBackground:!0});s.onBackground=k.fromPalette({name:"on_background",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:10,background:t=>s.background,contrastCurve:new v(3,3,4.5,7)});s.surface=k.fromPalette({name:"surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:98,isBackground:!0});s.surfaceDim=k.fromPalette({name:"surface_dim",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:new v(87,87,80,75).get(t.contrastLevel),isBackground:!0});s.surfaceBright=k.fromPalette({name:"surface_bright",palette:t=>t.neutralPalette,tone:t=>t.isDark?new v(24,24,29,34).get(t.contrastLevel):98,isBackground:!0});s.surfaceContainerLowest=k.fromPalette({name:"surface_container_lowest",palette:t=>t.neutralPalette,tone:t=>t.isDark?new v(4,4,2,0).get(t.contrastLevel):100,isBackground:!0});s.surfaceContainerLow=k.fromPalette({name:"surface_container_low",palette:t=>t.neutralPalette,tone:t=>t.isDark?new v(10,10,11,12).get(t.contrastLevel):new v(96,96,96,95).get(t.contrastLevel),isBackground:!0});s.surfaceContainer=k.fromPalette({name:"surface_container",palette:t=>t.neutralPalette,tone:t=>t.isDark?new v(12,12,16,20).get(t.contrastLevel):new v(94,94,92,90).get(t.contrastLevel),isBackground:!0});s.surfaceContainerHigh=k.fromPalette({name:"surface_container_high",palette:t=>t.neutralPalette,tone:t=>t.isDark?new v(17,17,21,25).get(t.contrastLevel):new v(92,92,88,85).get(t.contrastLevel),isBackground:!0});s.surfaceContainerHighest=k.fromPalette({name:"surface_container_highest",palette:t=>t.neutralPalette,tone:t=>t.isDark?new v(22,22,26,30).get(t.contrastLevel):new v(90,90,84,80).get(t.contrastLevel),isBackground:!0});s.onSurface=k.fromPalette({name:"on_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:10,background:t=>s.highestSurface(t),contrastCurve:new v(4.5,7,11,21)});s.surfaceVariant=k.fromPalette({name:"surface_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?30:90,isBackground:!0});s.onSurfaceVariant=k.fromPalette({name:"on_surface_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?80:30,background:t=>s.highestSurface(t),contrastCurve:new v(3,4.5,7,11)});s.inverseSurface=k.fromPalette({name:"inverse_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:20});s.inverseOnSurface=k.fromPalette({name:"inverse_on_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?20:95,background:t=>s.inverseSurface,contrastCurve:new v(4.5,7,11,21)});s.outline=k.fromPalette({name:"outline",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?60:50,background:t=>s.highestSurface(t),contrastCurve:new v(1.5,3,4.5,7)});s.outlineVariant=k.fromPalette({name:"outline_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?30:80,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5)});s.shadow=k.fromPalette({name:"shadow",palette:t=>t.neutralPalette,tone:t=>0});s.scrim=k.fromPalette({name:"scrim",palette:t=>t.neutralPalette,tone:t=>0});s.surfaceTint=k.fromPalette({name:"surface_tint",palette:t=>t.primaryPalette,tone:t=>t.isDark?80:40,isBackground:!0});s.primary=k.fromPalette({name:"primary",palette:t=>t.primaryPalette,tone:t=>$(t)?t.isDark?100:0:t.isDark?80:40,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(3,4.5,7,7),toneDeltaPair:t=>new Y(s.primaryContainer,s.primary,10,"nearer",!1)});s.onPrimary=k.fromPalette({name:"on_primary",palette:t=>t.primaryPalette,tone:t=>$(t)?t.isDark?10:90:t.isDark?20:100,background:t=>s.primary,contrastCurve:new v(4.5,7,11,21)});s.primaryContainer=k.fromPalette({name:"primary_container",palette:t=>t.primaryPalette,tone:t=>It(t)?t.sourceColorHct.tone:$(t)?t.isDark?85:25:t.isDark?30:90,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5),toneDeltaPair:t=>new Y(s.primaryContainer,s.primary,10,"nearer",!1)});s.onPrimaryContainer=k.fromPalette({name:"on_primary_container",palette:t=>t.primaryPalette,tone:t=>It(t)?k.foregroundTone(s.primaryContainer.tone(t),4.5):$(t)?t.isDark?0:100:t.isDark?90:30,background:t=>s.primaryContainer,contrastCurve:new v(3,4.5,7,11)});s.inversePrimary=k.fromPalette({name:"inverse_primary",palette:t=>t.primaryPalette,tone:t=>t.isDark?40:80,background:t=>s.inverseSurface,contrastCurve:new v(3,4.5,7,7)});s.secondary=k.fromPalette({name:"secondary",palette:t=>t.secondaryPalette,tone:t=>t.isDark?80:40,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(3,4.5,7,7),toneDeltaPair:t=>new Y(s.secondaryContainer,s.secondary,10,"nearer",!1)});s.onSecondary=k.fromPalette({name:"on_secondary",palette:t=>t.secondaryPalette,tone:t=>$(t)?t.isDark?10:100:t.isDark?20:100,background:t=>s.secondary,contrastCurve:new v(4.5,7,11,21)});s.secondaryContainer=k.fromPalette({name:"secondary_container",palette:t=>t.secondaryPalette,tone:t=>{let e=t.isDark?30:90;return $(t)?t.isDark?30:85:It(t)?$e(t.secondaryPalette.hue,t.secondaryPalette.chroma,e,!t.isDark):e},isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5),toneDeltaPair:t=>new Y(s.secondaryContainer,s.secondary,10,"nearer",!1)});s.onSecondaryContainer=k.fromPalette({name:"on_secondary_container",palette:t=>t.secondaryPalette,tone:t=>$(t)?t.isDark?90:10:It(t)?k.foregroundTone(s.secondaryContainer.tone(t),4.5):t.isDark?90:30,background:t=>s.secondaryContainer,contrastCurve:new v(3,4.5,7,11)});s.tertiary=k.fromPalette({name:"tertiary",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?90:25:t.isDark?80:40,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(3,4.5,7,7),toneDeltaPair:t=>new Y(s.tertiaryContainer,s.tertiary,10,"nearer",!1)});s.onTertiary=k.fromPalette({name:"on_tertiary",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?10:90:t.isDark?20:100,background:t=>s.tertiary,contrastCurve:new v(4.5,7,11,21)});s.tertiaryContainer=k.fromPalette({name:"tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>{if($(t))return t.isDark?60:49;if(!It(t))return t.isDark?30:90;let e=t.tertiaryPalette.getHct(t.sourceColorHct.tone);return ht.fixIfDisliked(e).tone},isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5),toneDeltaPair:t=>new Y(s.tertiaryContainer,s.tertiary,10,"nearer",!1)});s.onTertiaryContainer=k.fromPalette({name:"on_tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?0:100:It(t)?k.foregroundTone(s.tertiaryContainer.tone(t),4.5):t.isDark?90:30,background:t=>s.tertiaryContainer,contrastCurve:new v(3,4.5,7,11)});s.error=k.fromPalette({name:"error",palette:t=>t.errorPalette,tone:t=>t.isDark?80:40,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(3,4.5,7,7),toneDeltaPair:t=>new Y(s.errorContainer,s.error,10,"nearer",!1)});s.onError=k.fromPalette({name:"on_error",palette:t=>t.errorPalette,tone:t=>t.isDark?20:100,background:t=>s.error,contrastCurve:new v(4.5,7,11,21)});s.errorContainer=k.fromPalette({name:"error_container",palette:t=>t.errorPalette,tone:t=>t.isDark?30:90,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5),toneDeltaPair:t=>new Y(s.errorContainer,s.error,10,"nearer",!1)});s.onErrorContainer=k.fromPalette({name:"on_error_container",palette:t=>t.errorPalette,tone:t=>$(t)?t.isDark?90:10:t.isDark?90:30,background:t=>s.errorContainer,contrastCurve:new v(3,4.5,7,11)});s.primaryFixed=k.fromPalette({name:"primary_fixed",palette:t=>t.primaryPalette,tone:t=>$(t)?40:90,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5),toneDeltaPair:t=>new Y(s.primaryFixed,s.primaryFixedDim,10,"lighter",!0)});s.primaryFixedDim=k.fromPalette({name:"primary_fixed_dim",palette:t=>t.primaryPalette,tone:t=>$(t)?30:80,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5),toneDeltaPair:t=>new Y(s.primaryFixed,s.primaryFixedDim,10,"lighter",!0)});s.onPrimaryFixed=k.fromPalette({name:"on_primary_fixed",palette:t=>t.primaryPalette,tone:t=>$(t)?100:10,background:t=>s.primaryFixedDim,secondBackground:t=>s.primaryFixed,contrastCurve:new v(4.5,7,11,21)});s.onPrimaryFixedVariant=k.fromPalette({name:"on_primary_fixed_variant",palette:t=>t.primaryPalette,tone:t=>$(t)?90:30,background:t=>s.primaryFixedDim,secondBackground:t=>s.primaryFixed,contrastCurve:new v(3,4.5,7,11)});s.secondaryFixed=k.fromPalette({name:"secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>$(t)?80:90,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5),toneDeltaPair:t=>new Y(s.secondaryFixed,s.secondaryFixedDim,10,"lighter",!0)});s.secondaryFixedDim=k.fromPalette({name:"secondary_fixed_dim",palette:t=>t.secondaryPalette,tone:t=>$(t)?70:80,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5),toneDeltaPair:t=>new Y(s.secondaryFixed,s.secondaryFixedDim,10,"lighter",!0)});s.onSecondaryFixed=k.fromPalette({name:"on_secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>10,background:t=>s.secondaryFixedDim,secondBackground:t=>s.secondaryFixed,contrastCurve:new v(4.5,7,11,21)});s.onSecondaryFixedVariant=k.fromPalette({name:"on_secondary_fixed_variant",palette:t=>t.secondaryPalette,tone:t=>$(t)?25:30,background:t=>s.secondaryFixedDim,secondBackground:t=>s.secondaryFixed,contrastCurve:new v(3,4.5,7,11)});s.tertiaryFixed=k.fromPalette({name:"tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>$(t)?40:90,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5),toneDeltaPair:t=>new Y(s.tertiaryFixed,s.tertiaryFixedDim,10,"lighter",!0)});s.tertiaryFixedDim=k.fromPalette({name:"tertiary_fixed_dim",palette:t=>t.tertiaryPalette,tone:t=>$(t)?30:80,isBackground:!0,background:t=>s.highestSurface(t),contrastCurve:new v(1,1,3,4.5),toneDeltaPair:t=>new Y(s.tertiaryFixed,s.tertiaryFixedDim,10,"lighter",!0)});s.onTertiaryFixed=k.fromPalette({name:"on_tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>$(t)?100:10,background:t=>s.tertiaryFixedDim,secondBackground:t=>s.tertiaryFixed,contrastCurve:new v(4.5,7,11,21)});s.onTertiaryFixedVariant=k.fromPalette({name:"on_tertiary_fixed_variant",palette:t=>t.tertiaryPalette,tone:t=>$(t)?90:30,background:t=>s.tertiaryFixedDim,secondBackground:t=>s.tertiaryFixed,contrastCurve:new v(3,4.5,7,11)});var z=class{constructor(e){this.sourceColorArgb=e.sourceColorArgb,this.variant=e.variant,this.contrastLevel=e.contrastLevel,this.isDark=e.isDark,this.sourceColorHct=F.fromInt(e.sourceColorArgb),this.primaryPalette=e.primaryPalette,this.secondaryPalette=e.secondaryPalette,this.tertiaryPalette=e.tertiaryPalette,this.neutralPalette=e.neutralPalette,this.neutralVariantPalette=e.neutralVariantPalette,this.errorPalette=w.fromHueAndChroma(25,84)}static getRotatedHue(e,r,a){let n=e.hue;if(r.length!==a.length)throw new Error(`mismatch between hue length ${r.length} & rotations ${a.length}`);if(a.length===1)return W(e.hue+a[0]);let i=r.length;for(let o=0;o<=i-2;o++){let c=r[o],m=r[o+1];if(c<n&&n<m)return W(n+a[o])}return n}getArgb(e){return e.getArgb(this)}getHct(e){return e.getHct(this)}get primaryPaletteKeyColor(){return this.getArgb(s.primaryPaletteKeyColor)}get secondaryPaletteKeyColor(){return this.getArgb(s.secondaryPaletteKeyColor)}get tertiaryPaletteKeyColor(){return this.getArgb(s.tertiaryPaletteKeyColor)}get neutralPaletteKeyColor(){return this.getArgb(s.neutralPaletteKeyColor)}get neutralVariantPaletteKeyColor(){return this.getArgb(s.neutralVariantPaletteKeyColor)}get background(){return this.getArgb(s.background)}get onBackground(){return this.getArgb(s.onBackground)}get surface(){return this.getArgb(s.surface)}get surfaceDim(){return this.getArgb(s.surfaceDim)}get surfaceBright(){return this.getArgb(s.surfaceBright)}get surfaceContainerLowest(){return this.getArgb(s.surfaceContainerLowest)}get surfaceContainerLow(){return this.getArgb(s.surfaceContainerLow)}get surfaceContainer(){return this.getArgb(s.surfaceContainer)}get surfaceContainerHigh(){return this.getArgb(s.surfaceContainerHigh)}get surfaceContainerHighest(){return this.getArgb(s.surfaceContainerHighest)}get onSurface(){return this.getArgb(s.onSurface)}get surfaceVariant(){return this.getArgb(s.surfaceVariant)}get onSurfaceVariant(){return this.getArgb(s.onSurfaceVariant)}get inverseSurface(){return this.getArgb(s.inverseSurface)}get inverseOnSurface(){return this.getArgb(s.inverseOnSurface)}get outline(){return this.getArgb(s.outline)}get outlineVariant(){return this.getArgb(s.outlineVariant)}get shadow(){return this.getArgb(s.shadow)}get scrim(){return this.getArgb(s.scrim)}get surfaceTint(){return this.getArgb(s.surfaceTint)}get primary(){return this.getArgb(s.primary)}get onPrimary(){return this.getArgb(s.onPrimary)}get primaryContainer(){return this.getArgb(s.primaryContainer)}get onPrimaryContainer(){return this.getArgb(s.onPrimaryContainer)}get inversePrimary(){return this.getArgb(s.inversePrimary)}get secondary(){return this.getArgb(s.secondary)}get onSecondary(){return this.getArgb(s.onSecondary)}get secondaryContainer(){return this.getArgb(s.secondaryContainer)}get onSecondaryContainer(){return this.getArgb(s.onSecondaryContainer)}get tertiary(){return this.getArgb(s.tertiary)}get onTertiary(){return this.getArgb(s.onTertiary)}get tertiaryContainer(){return this.getArgb(s.tertiaryContainer)}get onTertiaryContainer(){return this.getArgb(s.onTertiaryContainer)}get error(){return this.getArgb(s.error)}get onError(){return this.getArgb(s.onError)}get errorContainer(){return this.getArgb(s.errorContainer)}get onErrorContainer(){return this.getArgb(s.onErrorContainer)}get primaryFixed(){return this.getArgb(s.primaryFixed)}get primaryFixedDim(){return this.getArgb(s.primaryFixedDim)}get onPrimaryFixed(){return this.getArgb(s.onPrimaryFixed)}get onPrimaryFixedVariant(){return this.getArgb(s.onPrimaryFixedVariant)}get secondaryFixed(){return this.getArgb(s.secondaryFixed)}get secondaryFixedDim(){return this.getArgb(s.secondaryFixedDim)}get onSecondaryFixed(){return this.getArgb(s.onSecondaryFixed)}get onSecondaryFixedVariant(){return this.getArgb(s.onSecondaryFixedVariant)}get tertiaryFixed(){return this.getArgb(s.tertiaryFixed)}get tertiaryFixedDim(){return this.getArgb(s.tertiaryFixedDim)}get onTertiaryFixed(){return this.getArgb(s.onTertiaryFixed)}get onTertiaryFixedVariant(){return this.getArgb(s.onTertiaryFixedVariant)}};var Dt=class t{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;let e=this.hctsByHue.concat([this.input]),r=this.tempsByHct;return e.sort((a,n)=>r.get(a)-r.get(n)),this.hctsByTempCache=e,e}get warmest(){return this.hctsByTemp[this.hctsByTemp.length-1]}get coldest(){return this.hctsByTemp[0]}analogous(e=5,r=12){let a=Math.round(this.input.hue),n=this.hctsByHue[a],i=this.relativeTemperature(n),o=[n],c=0;for(let b=0;b<360;b++){let p=At(a+b),P=this.hctsByHue[p],S=this.relativeTemperature(P),T=Math.abs(S-i);i=S,c+=T}let m=1,l=c/r,d=0;for(i=this.relativeTemperature(n);o.length<r;){let b=At(a+m),p=this.hctsByHue[b],P=this.relativeTemperature(p),S=Math.abs(P-i);d+=S;let T=o.length*l,C=d>=T,O=1;for(;C&&o.length<r;){o.push(p);let M=(o.length+O)*l;C=d>=M,O++}if(i=P,m++,m>360){for(;o.length<r;)o.push(p);break}}let u=[this.input],f=Math.floor((e-1)/2);for(let b=1;b<f+1;b++){let p=0-b;for(;p<0;)p=o.length+p;p>=o.length&&(p=p%o.length),u.splice(0,0,o[p])}let h=e-f-1;for(let b=1;b<h+1;b++){let p=b;for(;p<0;)p=o.length+p;p>=o.length&&(p=p%o.length),u.push(o[p])}return u}get complement(){if(this.complementCache!=null)return this.complementCache;let e=this.coldest.hue,r=this.tempsByHct.get(this.coldest),a=this.warmest.hue,i=this.tempsByHct.get(this.warmest)-r,o=t.isBetween(this.input.hue,e,a),c=o?a:e,m=o?e:a,l=1,d=1e3,u=this.hctsByHue[Math.round(this.input.hue)],f=1-this.inputRelativeTemperature;for(let h=0;h<=360;h+=1){let b=W(c+l*h);if(!t.isBetween(b,c,m))continue;let p=this.hctsByHue[Math.round(b)],P=(this.tempsByHct.get(p)-r)/i,S=Math.abs(f-P);S<d&&(d=S,u=p)}return this.complementCache=u,this.complementCache}relativeTemperature(e){let r=this.tempsByHct.get(this.warmest)-this.tempsByHct.get(this.coldest),a=this.tempsByHct.get(e)-this.tempsByHct.get(this.coldest);return r===0?.5:a/r}get inputRelativeTemperature(){return this.inputRelativeTemperatureCache>=0?this.inputRelativeTemperatureCache:(this.inputRelativeTemperatureCache=this.relativeTemperature(this.input),this.inputRelativeTemperatureCache)}get tempsByHct(){if(this.tempsByHctCache.size>0)return this.tempsByHctCache;let e=this.hctsByHue.concat([this.input]),r=new Map;for(let a of e)r.set(a,t.rawTemperature(a));return this.tempsByHctCache=r,r}get hctsByHue(){if(this.hctsByHueCache.length>0)return this.hctsByHueCache;let e=[];for(let r=0;r<=360;r+=1){let a=F.from(r,this.input.chroma,this.input.tone);e.push(a)}return this.hctsByHueCache=e,this.hctsByHueCache}static isBetween(e,r,a){return r<a?r<=e&&e<=a:r<=e||e<=a}static rawTemperature(e){let r=Kt(e.toInt()),a=W(Math.atan2(r[2],r[1])*180/Math.PI),n=Math.sqrt(r[1]*r[1]+r[2]*r[2]);return-.5+.02*Math.pow(n,1.07)*Math.cos(W(a-50)*Math.PI/180)}};var zt=class extends z{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:L.CONTENT,contrastLevel:a,isDark:r,primaryPalette:w.fromHueAndChroma(e.hue,e.chroma),secondaryPalette:w.fromHueAndChroma(e.hue,Math.max(e.chroma-32,e.chroma*.5)),tertiaryPalette:w.fromInt(ht.fixIfDisliked(new Dt(e).analogous(3,6)[2]).toInt()),neutralPalette:w.fromHueAndChroma(e.hue,e.chroma/8),neutralVariantPalette:w.fromHueAndChroma(e.hue,e.chroma/8+4)})}};var xt=class t extends z{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:L.EXPRESSIVE,contrastLevel:a,isDark:r,primaryPalette:w.fromHueAndChroma(W(e.hue+240),40),secondaryPalette:w.fromHueAndChroma(z.getRotatedHue(e,t.hues,t.secondaryRotations),24),tertiaryPalette:w.fromHueAndChroma(z.getRotatedHue(e,t.hues,t.tertiaryRotations),32),neutralPalette:w.fromHueAndChroma(e.hue+15,8),neutralVariantPalette:w.fromHueAndChroma(e.hue+15,12)})}};xt.hues=[0,21,51,121,151,191,271,321,360];xt.secondaryRotations=[45,95,45,20,45,90,45,45,45];xt.tertiaryRotations=[120,120,20,45,20,15,20,120,120];var $t=class extends z{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:L.FIDELITY,contrastLevel:a,isDark:r,primaryPalette:w.fromHueAndChroma(e.hue,e.chroma),secondaryPalette:w.fromHueAndChroma(e.hue,Math.max(e.chroma-32,e.chroma*.5)),tertiaryPalette:w.fromInt(ht.fixIfDisliked(new Dt(e).complement).toInt()),neutralPalette:w.fromHueAndChroma(e.hue,e.chroma/8),neutralVariantPalette:w.fromHueAndChroma(e.hue,e.chroma/8+4)})}};var Vt=class extends z{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:L.FRUIT_SALAD,contrastLevel:a,isDark:r,primaryPalette:w.fromHueAndChroma(W(e.hue-50),48),secondaryPalette:w.fromHueAndChroma(W(e.hue-50),36),tertiaryPalette:w.fromHueAndChroma(e.hue,36),neutralPalette:w.fromHueAndChroma(e.hue,10),neutralVariantPalette:w.fromHueAndChroma(e.hue,16)})}};var Ut=class extends z{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:L.MONOCHROME,contrastLevel:a,isDark:r,primaryPalette:w.fromHueAndChroma(e.hue,0),secondaryPalette:w.fromHueAndChroma(e.hue,0),tertiaryPalette:w.fromHueAndChroma(e.hue,0),neutralPalette:w.fromHueAndChroma(e.hue,0),neutralVariantPalette:w.fromHueAndChroma(e.hue,0)})}};var Ht=class extends z{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:L.NEUTRAL,contrastLevel:a,isDark:r,primaryPalette:w.fromHueAndChroma(e.hue,12),secondaryPalette:w.fromHueAndChroma(e.hue,8),tertiaryPalette:w.fromHueAndChroma(e.hue,16),neutralPalette:w.fromHueAndChroma(e.hue,2),neutralVariantPalette:w.fromHueAndChroma(e.hue,2)})}};var jt=class extends z{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:L.RAINBOW,contrastLevel:a,isDark:r,primaryPalette:w.fromHueAndChroma(e.hue,48),secondaryPalette:w.fromHueAndChroma(e.hue,16),tertiaryPalette:w.fromHueAndChroma(W(e.hue+60),24),neutralPalette:w.fromHueAndChroma(e.hue,0),neutralVariantPalette:w.fromHueAndChroma(e.hue,0)})}};var _t=class extends z{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:L.TONAL_SPOT,contrastLevel:a,isDark:r,primaryPalette:w.fromHueAndChroma(e.hue,36),secondaryPalette:w.fromHueAndChroma(e.hue,16),tertiaryPalette:w.fromHueAndChroma(W(e.hue+60),24),neutralPalette:w.fromHueAndChroma(e.hue,6),neutralVariantPalette:w.fromHueAndChroma(e.hue,8)})}};var kt=class t extends z{constructor(e,r,a){super({sourceColorArgb:e.toInt(),variant:L.VIBRANT,contrastLevel:a,isDark:r,primaryPalette:w.fromHueAndChroma(e.hue,200),secondaryPalette:w.fromHueAndChroma(z.getRotatedHue(e,t.hues,t.secondaryRotations),24),tertiaryPalette:w.fromHueAndChroma(z.getRotatedHue(e,t.hues,t.tertiaryRotations),32),neutralPalette:w.fromHueAndChroma(e.hue,10),neutralVariantPalette:w.fromHueAndChroma(e.hue,12)})}};kt.hues=[0,41,61,101,131,181,251,301,360];kt.secondaryRotations=[18,15,10,12,15,18,15,12,12];kt.tertiaryRotations=[35,30,20,25,30,35,30,25,25];var Ve={desired:4,fallbackColorARGB:4282549748,filter:!0};function Ue(t,e){return t.score>e.score?-1:t.score<e.score?1:0}var ct=class t{constructor(){}static score(e,r){let{desired:a,fallbackColorARGB:n,filter:i}={...Ve,...r},o=[],c=new Array(360).fill(0),m=0;for(let[h,b]of e.entries()){let p=F.fromInt(h);o.push(p);let P=Math.floor(p.hue);c[P]+=b,m+=b}let l=new Array(360).fill(0);for(let h=0;h<360;h++){let b=c[h]/m;for(let p=h-14;p<h+16;p++){let P=At(p);l[P]+=b}}let d=new Array;for(let h of o){let b=At(Math.round(h.hue)),p=l[b];if(i&&(h.chroma<t.CUTOFF_CHROMA||p<=t.CUTOFF_EXCITED_PROPORTION))continue;let P=p*100*t.WEIGHT_PROPORTION,S=h.chroma<t.TARGET_CHROMA?t.WEIGHT_CHROMA_BELOW:t.WEIGHT_CHROMA_ABOVE,T=(h.chroma-t.TARGET_CHROMA)*S,C=P+T;d.push({hct:h,score:C})}d.sort(Ue);let u=[];for(let h=90;h>=15;h--){u.length=0;for(let{hct:b}of d)if(u.find(P=>Yt(b.hue,P.hue)<h)||u.push(b),u.length>=a)break;if(u.length>=a)break}let f=[];u.length===0&&f.push(n);for(let h of u)f.push(h.toInt());return f}};ct.TARGET_CHROMA=48;ct.WEIGHT_PROPORTION=.7;ct.WEIGHT_CHROMA_ABOVE=.3;ct.WEIGHT_CHROMA_BELOW=.1;ct.CUTOFF_CHROMA=5;ct.CUTOFF_EXCITED_PROPORTION=.01;function he(){let t=Object.freeze({blur:Object.freeze({max:32,initial:12,unit:"px"}),frosted:Object.freeze({max:32,initial:12,unit:"px"}),blue:Object.freeze({max:60,initial:25,unit:"%"}),grayscale:Object.freeze({max:100,initial:100,unit:"%"}),dim:Object.freeze({max:60,initial:24,unit:"%"})}),e=Object.freeze(["none",...Object.keys(t)]);function r(i){let o=i?.filterMode,c=i?.filterAmounts,m=Object.fromEntries(Object.entries(t).map(([l,{max:d,initial:u}])=>{let f=c!=null&&Object.hasOwn(c,l)?c[l]:void 0;return[l,Number.isFinite(f)?Math.round(Math.min(d,Math.max(0,f))):u]}));return{filterMode:e.includes(o)?o:"none",filterAmounts:m}}function a(i){let{filterMode:o,filterAmounts:c}=r(i),m=c[o];if(!m)return null;switch(o){case"blur":case"frosted":return{filter:`blur(${m}px)`,bleed:m*3,...o==="frosted"?{tint:`rgb(255 255 255 / ${Math.round(m*.75)}%)`}:{}};case"blue":return{tint:`rgb(48 110 246 / ${m}%)`};case"grayscale":return{filter:`grayscale(${m}%)`};case"dim":return{filter:`brightness(${100-m}%)`};default:return null}}function n({selector:i,image:o,overlays:c,settings:m,fixed:l=!1}){let d=a(m);if(!o||!d)return"";let u=l?"fixed":"absolute",f=d.tint?[...c,d.tint]:c;return`${l?"":`${i}{position:relative;isolation:isolate;overflow:hidden}`}${i}::before{content:"";position:${u};inset:${d.bleed?`-${d.bleed}px`:"0"};z-index:-2;pointer-events:none;background:${o} center/cover no-repeat;${d.filter?`filter:${d.filter};`:""}}${i}::after{content:"";position:${u};inset:0;z-index:-1;pointer-events:none;background-image:${f.map(b=>`linear-gradient(${b},${b})`).join(",")}}`}return{modes:e,options:t,normalize:r,effect:a,css:n}}var dt=he();var pe=Object.freeze(["content","tonal-spot","fruit-salad","rainbow","monochrome","vibrant","faithful","soft","dysfunctional","muted"]),{filterMode:je,filterAmounts:_e}=dt.normalize(),mt=Object.freeze({enabled:!0,dynamic:!0,market:"zh-CN",paletteMode:"content",mode:"schedule",day:"07:00",night:"19:00",strength:28,filterMode:je,filterAmounts:Object.freeze(_e)});function qt(t){return Number.isFinite(t)?Math.round(Math.min(100,Math.max(10,t))):mt.strength}function fe(t){return Math.sqrt(1-qt(t)/100)}var Gt=Object.freeze({light:.56,dark:.62});function Ge(t){return t==="dark"?`rgba(0, 0, 0, ${Gt.dark})`:`rgba(255, 255, 255, ${Gt.light})`}function qe(t={}){(!t||typeof t!="object")&&(t={});let e=r=>typeof r=="string"&&/^([01]\d|2[0-3]):[0-5]\d$/.test(r);return{enabled:typeof t.enabled=="boolean"?t.enabled:!0,dynamic:typeof t.dynamic=="boolean"?t.dynamic:!0,market:["zh-CN","en-US"].includes(t.market)?t.market:mt.market,paletteMode:pe.includes(t.paletteMode)?t.paletteMode:mt.paletteMode,mode:["follow","schedule","system","light","dark"].includes(t.mode)?t.mode:"schedule",day:e(t.day)?t.day:mt.day,night:e(t.night)?t.night:mt.night,strength:qt(t.strength),...dt.normalize(t)}}function We(t,e,r){let a=c=>Number(c.slice(0,2))*60+Number(c.slice(3)),n=t.getHours()*60+t.getMinutes(),i=a(e),o=a(r);return i===o?null:(i<o?n>=i&&n<o:n>=i||n<o)?"light":"dark"}function Ye(t=new Date){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function ge([t,e,r]){t/=255,e/=255,r/=255;let a=Math.max(t,e,r),n=Math.min(t,e,r),i=a-n,o=(a+n)/2,c=0,m=0;return i&&(m=i/(1-Math.abs(2*o-1)),c=a===t?(e-r)/i%6:a===e?(r-t)/i+2:(t-e)/i+4,c=(c*60+360)%360),[c,m*100,o*100]}function Je([t,e,r]){e/=100,r/=100;let a=(1-Math.abs(2*r-1))*e,n=a*(1-Math.abs(t/60%2-1)),i=r-a/2;return(t<60?[a,n,0]:t<120?[n,a,0]:t<180?[0,a,n]:t<240?[0,n,a]:t<300?[n,0,a]:[a,0,n]).map(c=>Math.round((c+i)*255))}function Zt(t){let e=t.map(r=>(r/=255,r<=.04045?r/12.92:((r+.055)/1.055)**2.4));return e[0]*.2126+e[1]*.7152+e[2]*.0722}function pt(t,e){let r=Zt(t),a=Zt(e);return(Math.max(r,a)+.05)/(Math.min(r,a)+.05)}function Ke(t){let e=new Map;for(let a=0;a+3<t.length;a+=4){if(t[a+3]<200)continue;let n=[t[a],t[a+1],t[a+2]],[i,o,c]=ge(n);if(o<18||c<12||c>88)continue;let m=Math.floor(i/15),l=(.25+o/100)*(1-Math.abs(c-50)/65),d=e.get(m)||{weight:0,rgb:[0,0,0]};d.weight+=l,n.forEach((u,f)=>{d.rgb[f]+=u*l}),e.set(m,d)}let r=[...e.values()].sort((a,n)=>n.weight-a.weight)[0];if(!r){let a=0,n=[0,0,0];for(let i=0;i+3<t.length;i+=4)t[i+3]>=200&&(a++,n.forEach((o,c)=>{n[c]+=t[i+c]}));return a?n.map(i=>Math.round(i/a)):[92,116,132]}return r.rgb.map(a=>Math.round(a/r.weight))}var Qt=class extends Ht{constructor(e,r,a){super(e,r,a);let n=e.hue;Object.assign(this,{primaryPalette:w.fromHueAndChroma(n,Math.min(e.chroma,20)),secondaryPalette:w.fromHueAndChroma(n,Math.min(e.chroma,8)),tertiaryPalette:w.fromHueAndChroma((n+30)%360,Math.min(e.chroma,12)),neutralPalette:w.fromHueAndChroma(n,2),neutralVariantPalette:w.fromHueAndChroma(n,4)})}},be=Object.freeze({content:zt,"tonal-spot":_t,"fruit-salad":Vt,rainbow:jt,monochrome:Ut,vibrant:kt,faithful:$t,soft:Ht,dysfunctional:xt,muted:Qt}),Ft=new Map,j=t=>[Mt(t),St(t),Tt(t)],Xe=t=>`rgb(${t.join(", ")})`;function Ze(t,e){let r=wt(...t),a=`${e}:${r}`;if(!Ft.has(a)){let n=be[e],i=F.fromInt(r);Ft.set(a,[new n(i,!1,0),new n(i,!0,0)]),Ft.size>22&&Ft.delete(Ft.keys().next().value)}return Ft.get(a)}function Qe(t,e,r){let a={},n=fe(e);for(let[i,o]of Ze(t,r).entries()){let c=i===1,m=c?"dark":"light",l={"--dsw-alias-bg-base":j(o.surface),"--dsw-alias-bg-layer-1":j(o.surfaceContainerLow),"--dsw-alias-bg-layer-2":j(o.surfaceContainer),"--dsw-specific-sidebar-fill":j(o.surfaceContainerHigh),"--dsw-alias-border-l1":j(o.outlineVariant),"--dsw-alias-border-l2":j(o.outline)},d=(x,E,R)=>x.map((_,G)=>Math.round(_*(1-R)+E[G]*R));l["--dsw-alias-bg-layer-2"]=d(l["--dsw-alias-bg-layer-2"],j(o.secondaryContainer),.08),l["--dsw-specific-sidebar-fill"]=d(l["--dsw-specific-sidebar-fill"],j(o.tertiaryContainer),.18);let u=l["--dsw-alias-bg-layer-1"],f=d(l["--dsw-alias-bg-layer-2"],j(o.secondaryContainer),.2);l["--dsw-alias-bg-overlay"]=d(u,j(o.secondaryContainer),.04);let h=d(u,j(o.secondaryContainer),.24),b={"--dsw-alias-bg-layer-3":f,"--dsw-alias-bg-module-platform":f,"--dsw-alias-bg-multi-select":f,"--dsw-alias-card-fill":u,"--dsw-alias-card-fill-hover":h,"--dsw-alias-card-tile-fill":u,"--dsw-alias-onboarding-card-fill":u,"--dsw-alias-onboarding-secondary-fill":l["--dsw-alias-bg-layer-2"],"--dsw-alias-button-elevated-fill":u,"--dsw-alias-button-floating-fill":u,"--dsw-alias-button-floating-hover":h,"--dsw-alias-button-ghost-active-fill":f,"--dsw-alias-button-ghost-active-hover":h,"--dsw-alias-button-primary-dimmed":f,"--dsw-alias-interactive-bg-active":f,"--dsw-alias-interactive-bg-hover":h,"--dsw-alias-interactive-bg-hover-solid":h,"--dsw-alias-interactive-bg-hover-accent":f,"--dsw-menu-surface-fill":l["--dsw-alias-bg-overlay"],"--dsw-alias-menu-group-header-fill":u,"--dsw-specific-menu":l["--dsw-alias-bg-overlay"],"--dsw-specific-input-major":u,"--dsw-specific-login-input":l["--dsw-alias-bg-layer-2"],"--dsw-specific-selector":f,"--dsw-specific-tip":u,"--dsw-specific-sidebar-nav-item-active":f,"--dsw-specific-sidebar-nav-item-active-accent":f,"--dsw-specific-bubble":l["--dsw-alias-bg-layer-2"],"--dsw-specific-bubble-highlight":f,"--dsw-alias-markdown-code-block":l["--dsw-alias-bg-layer-2"],"--dsw-alias-markdown-code-block-banner":u,"--dsw-alias-markdown-inline-code":l["--dsw-alias-bg-layer-2"],"--dsw-alias-markdown-code-segment-selected":u,"--dsw-alias-markdown-code-segment-unselected":l["--dsw-alias-bg-layer-2"],"--dsw-alias-markdown-placeholder":f,"--dsw-alias-markdown-tag":f,"--dsw-alias-markdown-citation":f};Object.assign(l,b);let p=[u,l["--dsw-alias-bg-layer-2"],l["--dsw-alias-bg-overlay"],l["--dsw-specific-sidebar-fill"],f,h],P=Gt[m],S=c?0:255;for(let x of[0,255]){let E=x*(1-P)+S*P;p.push([E,E,E]),p.push(l["--dsw-alias-bg-base"].map(R=>R*n+E*(1-n)))}let T=(x,E,R=4.6)=>{let _=Math.round(E);for(;p.some(G=>pt(j(x.tone(_)),G)<R)&&_>0&&_<100;)_+=c?1:-1;return j(x.tone(_))},C=T(o.primaryPalette,F.fromInt(o.primary).tone),O=j(o.primaryPalette.tone(Math.max(0,Math.min(100,F.fromInt(wt(...C)).tone+(c?7:-7))))),M=[[0,0,0],[255,255,255]].sort((x,E)=>Math.min(pt(E,C),pt(E,O))-Math.min(pt(x,C),pt(x,O)))[0];l["--dsw-alias-brand-primary"]=C,l["--dsw-alias-label-primary"]=T(o.neutralPalette,F.fromInt(o.onSurface).tone),l["--dsw-alias-label-secondary"]=T(o.neutralVariantPalette,F.fromInt(o.onSurfaceVariant).tone);let H=T(o.neutralVariantPalette,c?70:50);for(let x of["--dsw-alias-label-tertiary","--dsw-alias-label-caption","--dsw-alias-label-dimmed"])l[x]=H;for(let x of["--dsw-alias-brand-text","--dsw-alias-brand-primary-new-colorprimary-new-color","--dsw-alias-link"])l[x]=C;for(let x of["--dsw-alias-label-primary-bluish","--dsw-alias-label-primary-dimmed","--dsw-alias-menu-icon"])l[x]=l["--dsw-alias-label-primary"];for(let x of["--dsw-alias-button-primary-fill","--dsw-alias-button-contrast-fill"])l[x]=C;l["--dsw-alias-button-primary-hover"]=O,l["--dsw-alias-button-info-fill"]=j(o.primaryPalette.tone(35)),l["--dsw-alias-button-info-hover"]=j(o.primaryPalette.tone(28));for(let x of["--dsw-alias-label-primary-foreground","--dsw-alias-label-primary-inverted"])l[x]=M;l["--dsw-focus-ring-color"]=C,l["--dsw-alias-border-l2"]=T(o.neutralVariantPalette,c?60:50,3.1);for(let x of["--dsw-alias-border-selected","--dsw-alias-button-ghost-active-border"])l[x]=C;for(let x of["--dsw-alias-border-l3","--dsw-alias-border-l4","--dsw-alias-border-l2-darkmode-thin","--dsw-alias-onboarding-checkbox-border","--dsw-alias-scrollbar-bg-l1","--dsw-alias-scrollbar-bg-l2"])l[x]=l["--dsw-alias-border-l2"];for(let x of["--dsw-alias-scrollbar-hover-l1","--dsw-alias-scrollbar-hover-l2"])l[x]=C;let I=l["--dsw-alias-border-l3"];l["--dsw-alias-switch-thumb"]=pt([0,0,0],I)>pt([255,255,255],I)?[0,0,0]:[255,255,255];let B=j(o.neutralPalette.tone(14)),V=j(o.neutralPalette.tone(98));for(let x of["--dsw-alias-tooltip-bg","--dsw-alias-toast-bg","--dsw-alias-hovercard-bg"])l[x]=B;for(let x of["--dsw-alias-tooltip-label","--dsw-alias-toast-label","--dsw-alias-hovercard-label-primary"])l[x]=V;l["--dsw-alias-tooltip-key-bg"]=d(B,[255,255,255],.18),l["--dsw-alias-toast-action"]=j(o.primaryPalette.tone(80)),l["--dsw-alias-hovercard-label-secondary"]=j(o.neutralPalette.tone(85)),l["--dsw-alias-hovercard-label-tertiary"]=j(o.neutralPalette.tone(78));for(let[x,E]of Object.entries(l))a[x]||={},a[x][m]=x==="--dsw-alias-bg-base"?`rgba(${E.join(", ")}, ${n})`:Xe(E)}return a}function tr(t,e=mt.strength,r=mt.paletteMode){e=qt(e);let a=[92,116,132];t=(Array.isArray(t)||ArrayBuffer.isView(t))&&t.length>=3?a.map((i,o)=>Number.isFinite(t[o])?Math.round(Math.max(0,Math.min(255,t[o]))):i):a;let n=typeof r=="string"&&Object.hasOwn(be,r)?r:mt.paletteMode;return Qe(t,e,n)}var ye="dsh.bing-daily-theme.preferences.v1",ee="dsh.bing-daily-theme.boot.v1",re="bdt-boot-theme";function we(t,e,r){if(!t.enabled||!t.dynamic)return null;let a={background:"--dsw-alias-bg-layer-1",primary:"--dsw-alias-label-primary",secondary:"--dsw-alias-label-secondary",tertiary:"--dsw-alias-label-tertiary",border:"--dsw-alias-border-l2",brand:"--dsw-alias-brand-primary"},n={};for(let i of["light","dark"])n[i]=Object.fromEntries(Object.entries(a).map(([o,c])=>[o,e[c][i]]));return{version:1,market:t.market||"zh-CN",paletteMode:t.paletteMode,strength:t.strength,colors:n,imageUrl:r}}var Ce="body .nUhMVa_confirmPanel{--fold-bg:var(--dsw-alias-bg-layer-2)!important;--fold-border:var(--dsw-alias-border-l2)!important;--fold-ink:var(--dsw-alias-label-primary)!important;--fold-on-ink:var(--dsw-alias-bg-layer-1)!important}",xe='[data-sidebar-right-panel="fullscreen"] :is([data-dockkit-host="dock"] > [data-dockkit-pane], [data-dockkit-empty])',ae="var(--dsw-alias-bg-layer-1)",er=`color-mix(in srgb, ${ae}, var(--dsw-alias-brand-primary, ${ae}) 14%)`;function Pe(t){let e=`${xe}{background-color:${ae}}`;return t?`${e}@supports (background-color:color-mix(in srgb, black, white)){${xe}{background-color:${er}}}`:e}var ne="[data-conversation-composer-overlay]:has([data-trajectory-scroll])",ve=`${ne} [data-trajectory-scroll] > table[data-scroll-ready]`,oe="body :is(.lc-root:not(:is([data-sidebar-right-panel], .lc-modal-card) *), [data-global-panel] .lc-ov-page)",Ae='[data-global-panel] [data-studio-mount] [data-testid="native-template-library"]',ke=`
3
+ ${ne},${ne} div:has(> [data-trajectory-scroll]),${Ae}{background-color:transparent}
4
+ ${oe}{--lc-canvas:transparent}
5
+ /* One extra light/dark matte for dense ledger text, not one per wrapper.
6
+ Sticky toolbar, timeline, selection and details keep their own fills. */
7
+ ${ve}{background-color:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 40%,transparent)}
8
+ `,rr={background:"bg-layer-1",foreground:"label-primary",muted:"bg-layer-2","muted-foreground":"label-secondary",secondary:"interactive-bg-active","secondary-foreground":"label-primary",accent:"interactive-bg-hover","accent-foreground":"label-primary",border:"border-l2",input:"border-l2",ring:"brand-primary",primary:"button-primary-fill","primary-foreground":"label-primary-foreground","action-background":"button-primary-fill","action-hover":"button-primary-hover","action-pressed":"button-primary-hover","action-foreground":"label-primary-foreground","action-pressed-foreground":"label-primary-foreground"},ar=`
9
+ ${ve}{--dsw-alias-trajectory-accent:var(--dsw-alias-brand-primary)}
10
+ ${oe}{--lc-control-track:var(--dsw-alias-bg-layer-2)}
11
+ ${oe} :is(.lc-card:not(.lc-recom), .lc-pulse-header):not(.lc-modal-card *){background-color:color-mix(in srgb,var(--dsw-alias-bg-layer-1),var(--dsw-alias-brand-primary) 7%)}
12
+ ${Ae}{${Object.entries(rr).map(([t,e])=>`--${t}:var(--dsw-alias-${e})`).join(";")}}
13
+ `;function Me(t){return t?ke+ar:ke}var nr=Object.freeze({canvas:"--dsw-specific-sidebar-fill",surface:"--dsw-alias-bg-layer-1",raised:"--dsw-alias-bg-layer-2",selected:"--dsw-specific-sidebar-nav-item-active",ink:"--dsw-alias-label-primary",muted:"--dsw-alias-label-secondary",border:"--dsw-alias-border-l2",brand:"--dsw-alias-brand-primary","on-brand":"--dsw-alias-label-primary-foreground",bubble:"--dsw-specific-bubble",code:"--dsw-alias-markdown-code-block",input:"--dsw-specific-input-major"});function Te(t,e){let r=e==="dark"?"dark":"light";return Object.fromEntries(Object.entries(nr).map(([a,n])=>[`--bdt-mini-${a}`,t[n][r]]))}function Ie(t,e){return t("span",{className:"bdt-mini-split","aria-hidden":!0,style:Te(e,"light")},Se(t,e,"light"),Se(t,e,"dark"),t("svg",{className:"bdt-mini-diagonal",viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":!0,focusable:!1},t("line",{x1:100,y1:0,x2:0,y2:100,vectorEffect:"non-scaling-stroke"})))}function Se(t,e,r){return t("span",{className:`bdt-mini bdt-mini-${r}`,"aria-hidden":!0,style:Te(e,r)},t("span",{className:"bdt-mini-app"},t("span",{className:"bdt-mini-sidebar"},t("span",{className:"bdt-mini-logo"},"DSH"),t("span",{className:"bdt-mini-nav bdt-mini-nav-active"},t("span",{className:"bdt-mini-line"})),t("span",{className:"bdt-mini-nav"},t("span",{className:"bdt-mini-line"})),t("span",{className:"bdt-mini-nav"},t("span",{className:"bdt-mini-line bdt-mini-short"})),t("span",{className:"bdt-mini-sidebar-footer"},t("span",{className:"bdt-mini-line bdt-mini-short"}))),t("span",{className:"bdt-mini-chat"},t("span",{className:"bdt-mini-heading"},t("span",{className:"bdt-mini-line"}),t("span",{className:"bdt-mini-badge"})),t("span",{className:"bdt-mini-bubble"},t("span",{className:"bdt-mini-line"})),t("span",{className:"bdt-mini-reply"},t("span",{className:"bdt-mini-line"}),t("span",{className:"bdt-mini-line bdt-mini-short"}),t("span",{className:"bdt-mini-code"},t("span",{className:"bdt-mini-code-line"}),t("span",{className:"bdt-mini-code-line bdt-mini-short"}))),t("span",{className:"bdt-mini-composer"},t("span",{className:"bdt-mini-line"}),t("span",{className:"bdt-mini-send"},"\u2191")))))}var De=`
3
14
  .bdt-mini-split{position:relative;display:block;height:116px;overflow:hidden;border-radius:7px;color:var(--bdt-mini-border);pointer-events:none;user-select:none}
4
15
  .bdt-mini-split>.bdt-mini{position:absolute;inset:0}.bdt-mini-light{clip-path:polygon(0 0,100% 0,0 100%)}.bdt-mini-dark{clip-path:polygon(100% 0,100% 100%,0 100%)}
5
16
  .bdt-mini-diagonal{position:absolute;inset:0;width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.5}
@@ -14,14 +25,16 @@
14
25
  .bdt-mini-bubble{display:block;align-self:flex-end;width:75%;padding:5px 6px;border-radius:5px;background:var(--bdt-mini-bubble)}
15
26
  .bdt-mini-reply{display:flex;flex-direction:column;gap:4px;min-width:0}.bdt-mini-code{display:flex;flex-direction:column;gap:3px;padding:5px 6px;border-radius:4px;background:var(--bdt-mini-code)}.bdt-mini-code-line{display:block;width:80%;height:2px;border-radius:2px;background:var(--bdt-mini-muted)}.bdt-mini-code-line.bdt-mini-short{width:54%}
16
27
  .bdt-mini-composer{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:22px;margin-top:auto;padding:3px 4px 3px 6px;border:1px solid var(--bdt-mini-border);border-radius:5px;background:var(--bdt-mini-input);color:var(--bdt-mini-muted)}.bdt-mini-composer>.bdt-mini-line{width:48%}.bdt-mini-send{display:flex;align-items:center;justify-content:center;flex:0 0 14px;height:14px;border-radius:4px;background:var(--bdt-mini-brand);color:var(--bdt-mini-on-brand);font-size:11px;font-weight:600}
17
- `;function be(t,e,r,a){let n=t.createElement,i="bing-daily-theme",s="@nzlov/dsh-bing-wallpaper",c=de;return{inject:["slots","theme","locale"],apply(m){m.effect(()=>m.locale.register(i,"en",r.en)),m.effect(()=>m.locale.register(i,"zh",r.zh));let l=m.locale.bind(i),d;try{d=e.normalizeSettings(JSON.parse(localStorage.getItem(c)||"{}"))}catch{d=e.normalizeSettings()}let h={settings:d,busy:!1,issue:"",meta:null,url:"",accent:[92,116,132],scheme:m.theme.getTheme().active.colorScheme,storageIssue:!1},f=new Set,u=y=>{h={...h,...y},f.forEach(k=>k())},g=y=>(f.add(y),()=>f.delete(y)),p=()=>t.useSyncExternalStore(g,()=>h),P=!0,T,S,C="",E=a(m.theme,()=>{d={...d,mode:"follow"},R(),u({settings:d})},e.scheduledScheme),M=0,O="",I=0;function R(){try{localStorage.setItem(c,JSON.stringify(d)),u({storageIssue:!1})}catch{u({storageIssue:!0})}}function V(){E.restore()}function w(){E.sync(d)}function B(){if(!d.enabled||!d.dynamic||h.meta&&h.meta.market!==d.market)try{localStorage.removeItem(Xt)}catch{}if(!d.enabled||!h.url){T?.(),T=void 0;return}let y=e.makeTokens(d.dynamic?h.accent:[112,112,112],d.strength,d.dynamic?d.paletteMode:"monochrome");if(!d.dynamic)for(let D of Object.keys(y))D!=="--dsw-alias-bg-base"&&delete y[D];let k=T;if(T=m.theme.overrideTokens(s,y),k?.(),d.dynamic&&h.meta?.market===d.market)try{localStorage.setItem(Xt,JSON.stringify(me(d,y,h.meta?.imageUrl)))}catch{}}function L(y){let k=e.normalizeSettings({...d,...y});if(k.day===k.night){u({issue:"sameTime"});return}if(JSON.stringify(k)===JSON.stringify(d))return;let D=d.enabled,U=k.market!==d.market;U&&(I++,S?.abort(),M=0,O="",u({busy:!1})),(k.mode!==d.mode||!k.enabled)&&V(),d=k,R(),u({settings:d,issue:""}),B(),w(),d.enabled?(!D||U)&&_():(I++,S?.abort(),u({busy:!1}))}async function j(y,k){let D=URL.createObjectURL(y),U=new Image,Z;try{if(k.throwIfAborted(),U.src=D,await Promise.race([U.decode(),new Promise((v,J)=>{Z=()=>J(new DOMException("Aborted","AbortError")),k.addEventListener("abort",Z,{once:!0})})]),k.aborted)throw new DOMException("Aborted","AbortError");let q=document.createElement("canvas");q.width=64,q.height=64;let Q=q.getContext("2d",{willReadFrequently:!0});if(!Q)throw new Error("Canvas unavailable");Q.drawImage(U,0,0,64,64);let tt=e.extractAccent(Q.getImageData(0,0,64,64).data);return{url:D,accent:tt}}catch(q){throw URL.revokeObjectURL(D),q}finally{Z&&k.removeEventListener("abort",Z)}}async function _(){if(!P||!d.enabled||h.busy)return;let y=++I,k=d.market,D=new AbortController;S=D;let U=D.signal,Z=setTimeout(()=>D.abort(),3e4);u({busy:!0,issue:""}),M=Date.now();let q;try{let Q=await fetch(`/bing-daily-theme/api/daily?market=${k}`,{signal:U,credentials:"same-origin",cache:"no-store"});if(!Q.ok)throw new Error(`Metadata HTTP ${Q.status}`);let tt=await Q.json(),v=k==="en-US"?/^\/bing-daily-theme\/api\/image\?market=en-US&id=OHR\.[A-Za-z0-9][A-Za-z0-9_-]*_1920x1080\.jpg$/:/^\/bing-daily-theme\/api\/image\?id=OHR\.[A-Za-z0-9][A-Za-z0-9_-]*_1920x1080\.jpg$/;if(tt.market!==k||typeof tt.imageUrl!="string"||tt.imageUrl.length>300||!v.test(tt.imageUrl))throw new Error("Invalid wallpaper source or URL");if(!h.meta||tt.imageUrl!==h.meta.imageUrl||!h.url){let ut=await fetch(tt.imageUrl,{signal:U,credentials:"same-origin"});if(!ut.ok)throw new Error(`Image HTTP ${ut.status}`);let jt=await ut.blob();if(jt.size>12*1024*1024||!jt.type.startsWith("image/"))throw new Error("Invalid wallpaper image");q=await j(jt,U)}if(!P||y!==I){q&&URL.revokeObjectURL(q.url);return}let J=C;q&&(C=q.url),u({meta:tt,...q||{},issue:tt.stale?"stale":""}),B(),J&&J!==C&&URL.revokeObjectURL(J),O=e.localDate()}catch{P&&y===I&&u({issue:h.url?h.meta?.market!==k?"sourceFailed":"fetchFailed":"firstFetchFailed"})}finally{clearTimeout(Z),P&&y===I&&u({busy:!1})}}function dt(){w(),d.enabled&&(e.localDate()!==O||h.meta?.market!==d.market||["fetchFailed","firstFetchFailed","sourceFailed","stale"].includes(h.issue)||Date.now()-M>=36e5)&&Date.now()-M>=6e4&&_()}m.on("theme/change",y=>{u({scheme:y.active.colorScheme}),E.changed(y)});function wt(){t.useSyncExternalStore(y=>m.locale.subscribe(y),()=>m.locale.getSnapshot())}let ot=`
28
+ `;function Fe(t,e,r,a){let n=t.createElement,i="bing-daily-theme",o="@nzlov/dsh-bing-wallpaper",c=ye;return{inject:["slots","theme","locale"],apply(m){m.effect(()=>m.locale.register(i,"en",r.en)),m.effect(()=>m.locale.register(i,"zh",r.zh));let l=m.locale.bind(i),d;try{d=e.normalizeSettings(JSON.parse(localStorage.getItem(c)||"{}"))}catch{d=e.normalizeSettings()}let u={settings:d,busy:!1,issue:"",meta:null,url:"",accent:[92,116,132],scheme:m.theme.getTheme().active.colorScheme,storageIssue:!1},f=new Set,h=y=>{u={...u,...y},f.forEach(g=>g())},b=y=>(f.add(y),()=>f.delete(y)),p=()=>t.useSyncExternalStore(b,()=>u),P=!0,S,T,C="",O=a(m.theme,()=>{d={...d,mode:"follow"},B(),h({settings:d})},e.scheduledScheme),M=0,H="",I=0;function B(){try{localStorage.setItem(c,JSON.stringify(d)),h({storageIssue:!1})}catch{h({storageIssue:!0})}}function V(){O.restore()}function x(){O.sync(d)}function E(){if(!d.enabled||!d.dynamic||u.meta&&u.meta.market!==d.market)try{localStorage.removeItem(ee)}catch{}if(!d.enabled||!u.url){S?.(),S=void 0;return}let y=e.makeTokens(d.dynamic?u.accent:[112,112,112],d.strength,d.dynamic?d.paletteMode:"monochrome");if(!d.dynamic)for(let D of Object.keys(y))D!=="--dsw-alias-bg-base"&&delete y[D];let g=S;if(S=m.theme.overrideTokens(o,y),g?.(),d.dynamic&&u.meta?.market===d.market)try{localStorage.setItem(ee,JSON.stringify(we(d,y,u.meta?.imageUrl)))}catch{}}function R(y){let g=e.normalizeSettings({...d,...y}),D=Object.keys(g).every(N=>N==="filterMode"||N==="filterAmounts"||g[N]===d[N]);if(!D&&g.day===g.night){h({issue:"sameTime"});return}if(JSON.stringify(g)===JSON.stringify(d))return;if(D){d=g,B(),h({settings:d});return}let U=d.enabled,q=g.market!==d.market;q&&(I++,T?.abort(),M=0,H="",h({busy:!1})),(g.mode!==d.mode||!g.enabled)&&V(),d=g,B(),h({settings:d,issue:""}),E(),x(),d.enabled?(!U||q)&&G():(I++,T?.abort(),h({busy:!1}))}async function _(y,g){let D=URL.createObjectURL(y),U=new Image,q;try{if(g.throwIfAborted(),U.src=D,await Promise.race([U.decode(),new Promise((st,et)=>{q=()=>et(new DOMException("Aborted","AbortError")),g.addEventListener("abort",q,{once:!0})})]),g.aborted)throw new DOMException("Aborted","AbortError");let N=document.createElement("canvas");N.width=64,N.height=64;let Q=N.getContext("2d",{willReadFrequently:!0});if(!Q)throw new Error("Canvas unavailable");Q.drawImage(U,0,0,64,64);let K=e.extractAccent(Q.getImageData(0,0,64,64).data);return{url:D,accent:K}}catch(N){throw URL.revokeObjectURL(D),N}finally{q&&g.removeEventListener("abort",q)}}async function G(){if(!P||!d.enabled||u.busy)return;let y=++I,g=d.market,D=new AbortController;T=D;let U=D.signal,q=setTimeout(()=>D.abort(),3e4);h({busy:!0,issue:""}),M=Date.now();let N;try{let Q=await fetch(`/bing-daily-theme/api/daily?market=${g}`,{signal:U,credentials:"same-origin",cache:"no-store"});if(!Q.ok)throw new Error(`Metadata HTTP ${Q.status}`);let K=await Q.json(),st=g==="en-US"?/^\/bing-daily-theme\/api\/image\?market=en-US&id=OHR\.[A-Za-z0-9][A-Za-z0-9_-]*_1920x1080\.jpg$/:/^\/bing-daily-theme\/api\/image\?id=OHR\.[A-Za-z0-9][A-Za-z0-9_-]*_1920x1080\.jpg$/;if(K.market!==g||typeof K.imageUrl!="string"||K.imageUrl.length>300||!st.test(K.imageUrl))throw new Error("Invalid wallpaper source or URL");if(!u.meta||K.imageUrl!==u.meta.imageUrl||!u.url){let ft=await fetch(K.imageUrl,{signal:U,credentials:"same-origin"});if(!ft.ok)throw new Error(`Image HTTP ${ft.status}`);let Et=await ft.blob();if(Et.size>12*1024*1024||!Et.type.startsWith("image/"))throw new Error("Invalid wallpaper image");N=await _(Et,U)}if(!P||y!==I){N&&URL.revokeObjectURL(N.url);return}let et=C;N&&(C=N.url),h({meta:K,...N||{},issue:K.stale?"stale":""}),E(),et&&et!==C&&URL.revokeObjectURL(et),H=e.localDate()}catch{P&&y===I&&h({issue:u.url?u.meta?.market!==g?"sourceFailed":"fetchFailed":"firstFetchFailed"})}finally{clearTimeout(q),P&&y===I&&h({busy:!1})}}function ut(){x(),d.enabled&&(e.localDate()!==H||u.meta?.market!==d.market||["fetchFailed","firstFetchFailed","sourceFailed","stale"].includes(u.issue)||Date.now()-M>=36e5)&&Date.now()-M>=6e4&&G()}m.on("theme/change",y=>{h({scheme:y.active.colorScheme}),O.changed(y)});function Ct(){t.useSyncExternalStore(y=>m.locale.subscribe(y),()=>m.locale.getSnapshot())}let ot=`
18
29
  .bdt-page{max-width:720px;padding:24px;color:var(--dsw-alias-label-primary);font-size:14px;line-height:1.6}
19
30
  .bdt-page h2{font-size:20px;margin:0 0 16px;font-weight:600}.bdt-page p{margin:6px 0 18px;color:var(--dsw-alias-label-secondary)}
20
- .bdt-photo{position:relative;margin:0;overflow:hidden;border-radius:12px;background:var(--dsw-alias-bg-layer-2)}.bdt-preview{width:100%;aspect-ratio:16/9;min-height:240px;object-fit:cover;display:block;background:var(--dsw-alias-bg-layer-2)}
31
+ .bdt-photo{position:relative;margin:0;overflow:hidden;border-radius:12px;background:var(--dsw-alias-bg-layer-2)}.bdt-preview{position:relative;overflow:hidden;width:100%;aspect-ratio:16/9;min-height:240px;background:var(--dsw-alias-bg-layer-2)}
32
+ .bdt-preview-image,.bdt-preview-tint{position:absolute;inset:0;width:100%;height:100%}.bdt-preview-image{display:block;object-fit:cover;max-width:none}.bdt-preview-tint{pointer-events:none}
21
33
  .bdt-card{padding:16px;border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);margin:16px 0}
22
34
  .bdt-row{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px 0;flex-wrap:wrap}.bdt-row+ .bdt-row{border-top:1px solid var(--dsw-alias-border-l1)}
23
35
  .bdt-control{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.bdt-page select,.bdt-page input[type=time],.bdt-page button{font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:7px 10px;min-height:36px;max-width:100%}
24
36
  .bdt-page button{cursor:pointer}.bdt-page button:disabled{cursor:wait;opacity:.55}.bdt-page :focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}.bdt-page input{accent-color:var(--dsw-alias-brand-primary)}
37
+ .bdt-page .bdt-wallpaper-select{box-sizing:border-box;width:12rem;min-height:44px}.bdt-filter-range{min-width:0;min-height:44px}
25
38
  .bdt-page a{color:var(--dsw-alias-brand-primary)}.bdt-muted{color:var(--dsw-alias-label-secondary);font-size:12px}.bdt-swatches{display:flex;gap:8px;margin-top:10px}.bdt-swatch{width:24px;height:24px;border-radius:50%;border:1px solid var(--dsw-alias-border-l2)}
26
39
  .bdt-photo-caption{position:absolute;inset:auto 0 0;max-height:calc(100% - 64px);overflow:auto;padding:30px 16px 14px;color:var(--dsw-alias-tooltip-label);background:linear-gradient(to bottom,transparent,color-mix(in srgb,var(--dsw-alias-tooltip-bg) 82%,transparent) 26px,color-mix(in srgb,var(--dsw-alias-tooltip-bg) 90%,transparent));font-size:12px;line-height:1.5;overflow-wrap:anywhere}
27
40
  .bdt-photo-heading{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 10px}.bdt-photo-heading strong{min-width:0;font-size:14px}.bdt-photo-date{white-space:nowrap}.bdt-photo-details{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:5px}.bdt-page .bdt-photo-caption a{min-width:0;color:inherit;text-underline-offset:2px}.bdt-photo-caption .bdt-swatches{flex-shrink:0;margin:0;gap:6px}.bdt-photo-caption .bdt-swatch{width:20px;height:20px;border-color:color-mix(in srgb,var(--dsw-alias-tooltip-label) 55%,transparent)}
@@ -35,8 +48,8 @@
35
48
  .bdt-palette-caption{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:24px}.bdt-palette-name{min-width:0;overflow-wrap:anywhere;line-height:1.4}.bdt-palette-check{display:flex;align-items:center;justify-content:center;flex:0 0 18px;height:18px;border-radius:50%;font-size:12px;visibility:hidden;background:var(--dsw-alias-brand-primary);color:var(--dsw-alias-label-primary-foreground)}.bdt-palette-choice:checked+.bdt-palette-card .bdt-palette-check{visibility:visible}
36
49
  .bdt-palette-group:disabled .bdt-palette-card{cursor:not-allowed}.bdt-palette-group:disabled .bdt-palette-name{color:var(--dsw-alias-label-secondary)}
37
50
  .bdt-palette-group,.bdt-palette-card,.bdt-mini,.bdt-mini *{box-sizing:border-box}
38
- ${ge}
39
- @media(max-width:560px){.bdt-page{padding:16px}.bdt-row{gap:8px}.bdt-row>label{width:100%}}`;function xt(){t.useEffect(()=>{document.getElementById(Zt)?.remove()},[]);let y=p();if(!y.settings.enabled||!y.url)return null;let k=e.wallpaperShade(y.scheme);return n("style",null,`html{background-image:linear-gradient(${k},${k}),url(${JSON.stringify(y.url)});background-size:cover;background-position:center;background-attachment:fixed}body{background-color:transparent!important}${y.settings.dynamic?he:""}`)}function It(){wt();let y=p(),k=y.settings,D=(v,J,ut)=>n("div",{className:"bdt-row"},n("label",{htmlFor:`bdt-${v}`},l(v)),n("div",{className:"bdt-control"},J,ut)),U=v=>n("input",{id:`bdt-${v}`,type:"checkbox",checked:k[v],onChange:J=>L({[v]:J.target.checked})}),Z=t.useMemo(()=>e.makeTokens(k.dynamic?y.accent:[112,112,112],k.strength,k.dynamic?k.paletteMode:"monochrome"),[y.accent,k.strength,k.paletteMode,k.dynamic]),q=t.useMemo(()=>e.PALETTE_MODES.map(v=>({mode:v,tokens:e.makeTokens(y.accent,k.strength,v)})),[y.accent,k.strength]),Q=t.useId(),tt=typeof y.meta?.copyrightUrl=="string"&&/^https:\/\/(?:www|cn)\.bing\.com\//.test(y.meta.copyrightUrl)?y.meta.copyrightUrl:"https://www.bing.com/";return n("section",{className:"bdt-page","aria-label":l("title")},n("style",null,ot),n("h2",null,l("title")),n("figure",{className:"bdt-photo"},y.url?n("img",{className:"bdt-preview",src:y.url,alt:y.meta?.title||l("preview")}):n("div",{className:"bdt-preview",role:"img","aria-label":l("preview")}),y.meta&&n("figcaption",{className:"bdt-photo-caption"},n("div",{className:"bdt-photo-heading"},n("strong",null,y.meta.title||l("preview")),n("span",{className:"bdt-photo-date"},`${y.meta.date} \xB7 ${l(`market.${y.meta.market}`)}`)),n("div",{className:"bdt-photo-details"},n("a",{href:tt,target:"_blank",rel:"noopener noreferrer"},y.meta.copyright||l("source")),k.dynamic&&n("div",{className:"bdt-swatches","aria-label":l("palette")},...["light","dark"].map(v=>n("span",{key:v,className:"bdt-swatch",title:l(v),style:{backgroundColor:Z["--dsw-alias-brand-primary"][v]}}))))),n("button",{className:"bdt-photo-refresh",type:"button",disabled:y.busy||!k.enabled,"aria-label":l("refresh"),title:l("refresh"),"aria-busy":y.busy,onClick:()=>{_()}},n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:!1},n("path",{d:"M3 12a9 9 0 0 1 15.36-6.36L21 8M21 3v5h-5M21 12a9 9 0 0 1-15.36 6.36L3 16M8 16H3v5"})))),n("span",{className:"bdt-photo-status",role:"status","aria-live":"polite"},k.enabled?y.busy?l("loading"):y.issue?l(y.issue):l(y.meta?y.meta.market===k.market?"ready":"sourceFailed":"waiting"):l("paused")),n("div",{className:"bdt-card"},D("enabled",U("enabled")),D("market",n("select",{id:"bdt-market",value:k.market,onChange:v=>L({market:v.target.value})},...["zh-CN","en-US"].map(v=>n("option",{key:v,value:v},l(`market.${v}`))))),D("dynamic",U("dynamic")),n("fieldset",{className:"bdt-palette-group",disabled:!k.dynamic},n("legend",null,l("paletteMode")),n("div",{className:"bdt-palette-grid"},...q.map(({mode:v,tokens:J})=>n("label",{key:v,className:"bdt-palette-option",htmlFor:`${Q}-${v}`},n("input",{id:`${Q}-${v}`,className:"bdt-palette-choice",type:"radio",name:Q,value:v,checked:k.paletteMode===v,onChange:()=>L({paletteMode:v})}),n("span",{className:"bdt-palette-card"},fe(n,J),n("span",{className:"bdt-palette-caption"},n("span",{className:"bdt-palette-name"},l(`palette.${v}`)),n("span",{className:"bdt-palette-check","aria-hidden":!0},"\u2713"))))))),D("mode",n("select",{id:"bdt-mode",value:k.mode,onChange:v=>L({mode:v.target.value})},...["schedule","system","follow","light","dark"].map(v=>n("option",{key:v,value:v},l(v))))),k.mode==="schedule"&&n("div",null,...["day","night"].map(v=>D(v,n("input",{id:`bdt-${v}`,type:"time",value:k[v],onChange:J=>L({[v]:J.target.value})})))),D("strength",n("input",{id:"bdt-strength",type:"range",min:10,max:100,step:1,value:k.strength,"aria-valuetext":`${k.strength}%`,onChange:v=>L({strength:Number(v.target.value)})}),n("output",{htmlFor:"bdt-strength"},`${k.strength}%`))),y.storageIssue&&n("p",{role:"status"},l("storageFailed")))}m.slots.inject("shell.overlay",()=>m.slots.register({name:"shell.overlay",id:"bing-daily-theme.wallpaper",order:-100},xt)),m.effect(()=>{let y=()=>m.slots.inject("settings.section",()=>m.slots.register({name:"settings.section",id:"bing-daily-theme",order:25,label:()=>l("title")},It)),k=y(),D=m.locale.subscribe(()=>{k(),k=y()});return()=>{D(),k()}}),m.effect(()=>{let y=setInterval(dt,6e4),k=()=>{document.visibilityState==="visible"&&dt()},D=()=>{M=0,dt()},U=Z=>{if(Z.key===c)try{L(e.normalizeSettings(JSON.parse(Z.newValue||"{}")))}catch{}};return document.addEventListener("visibilitychange",k),window.addEventListener("online",D),window.addEventListener("storage",U),w(),_(),()=>{P=!1,I++,clearInterval(y),S?.abort(),document.removeEventListener("visibilitychange",k),window.removeEventListener("online",D),window.removeEventListener("storage",U),document.getElementById(Zt)?.remove(),T?.(),V(),C&&URL.revokeObjectURL(C),f.clear()}})}}}function ye(t,e,r){let a=t.getTheme().preference,n="",i=!1;function s(){if(n&&t.getTheme().preference===n){i=!0;try{t.setTheme(a)}finally{i=!1}}n=""}return{restore:s,sync(c,m=new Date){if(!c.enabled||c.mode==="follow"){s();return}let l=c.mode==="schedule"?r(m,c.day,c.night):c.mode;if(l){n||(a=t.getTheme().preference),i=!0;try{t.getTheme().preference!==l&&t.setTheme(l),n=l}finally{i=!1}}},changed(c){!i&&n&&c.preference!==n&&(n="",e())}}}window.__ModuleLoader__.load({id:"@nzlov/dsh-bing-wallpaper",factory(t){return be(t("react"),Kt,{en:{title:"Bing daily wallpaper",paletteMode:"Colour mode","palette.content":"M3 Content","palette.tonal-spot":"M3 Tonal Spot","palette.fruit-salad":"M3 Fruit Salad","palette.rainbow":"M3 Rainbow","palette.monochrome":"M3 Monochrome","palette.vibrant":"Vibrant","palette.faithful":"Faithful","palette.soft":"Soft","palette.dysfunctional":"Dysfunctional","palette.muted":"Muted",enabled:"Wallpaper enabled",dynamic:"Extract theme colours",market:"Wallpaper source","market.zh-CN":"China","market.en-US":"International (US)",sourceFailed:"Could not switch sources. The previous source\u2019s wallpaper is still shown; check your connection and retry.",mode:"Day/night mode",schedule:"Local time schedule",system:"Follow system",follow:"Follow DSH appearance",light:"Light",dark:"Dark",day:"Light from",night:"Dark from",strength:"Wallpaper visibility",refresh:"Check for updates",loading:"Updating\u2026",ready:"Wallpaper is up to date",waiting:"Wallpaper paused or not yet loaded",preview:"Daily wallpaper preview",palette:"Light and dark accent colours",source:"View on Bing",paused:"Wallpaper and dynamic theme are paused",firstFetchFailed:"Wallpaper could not be loaded. Check your connection and retry.",fetchFailed:"Update failed. The previous wallpaper is kept; check your connection and retry.",stale:"Bing is unavailable. Showing the last successful wallpaper.",sameTime:"Light and dark times must be different.",storageFailed:"These controls could not be saved in this browser."},zh:{title:"Bing \u6BCF\u65E5\u58C1\u7EB8",paletteMode:"\u53D6\u8272\u6A21\u5F0F","palette.content":"M3 Content","palette.tonal-spot":"M3 Tonal Spot","palette.fruit-salad":"M3 Fruit Salad","palette.rainbow":"M3 Rainbow","palette.monochrome":"M3 Monochrome","palette.vibrant":"Vibrant","palette.faithful":"Faithful","palette.soft":"Soft","palette.dysfunctional":"Dysfunctional","palette.muted":"Muted",enabled:"\u542F\u7528\u58C1\u7EB8",dynamic:"\u4ECE\u58C1\u7EB8\u63D0\u53D6\u4E3B\u9898\u8272",market:"\u58C1\u7EB8\u6765\u6E90","market.zh-CN":"\u56FD\u5185\uFF08\u4E2D\u56FD\uFF09","market.en-US":"\u56FD\u9645\uFF08\u7F8E\u56FD\uFF09",sourceFailed:"\u5207\u6362\u6765\u6E90\u5931\u8D25\uFF0C\u4ECD\u663E\u793A\u4E0A\u4E00\u6765\u6E90\u7684\u58C1\u7EB8\uFF1B\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",mode:"\u65E5\u591C\u5207\u6362\u65B9\u5F0F",schedule:"\u6309\u672C\u5730\u65F6\u95F4\u5207\u6362",system:"\u8DDF\u968F\u7CFB\u7EDF",follow:"\u8DDF\u968F DSH \u5916\u89C2",light:"\u6D45\u8272",dark:"\u6DF1\u8272",day:"\u6D45\u8272\u5F00\u59CB\u65F6\u95F4",night:"\u6DF1\u8272\u5F00\u59CB\u65F6\u95F4",strength:"\u58C1\u7EB8\u53EF\u89C1\u5EA6",refresh:"\u68C0\u67E5\u66F4\u65B0",loading:"\u6B63\u5728\u66F4\u65B0\u2026",ready:"\u58C1\u7EB8\u5DF2\u66F4\u65B0",waiting:"\u58C1\u7EB8\u5DF2\u6682\u505C\u6216\u5C1A\u672A\u52A0\u8F7D",preview:"\u6BCF\u65E5\u58C1\u7EB8\u9884\u89C8",palette:"\u6D45\u8272\u4E0E\u6DF1\u8272\u4E3B\u9898\u7684\u5F3A\u8C03\u8272",source:"\u5728 Bing \u67E5\u770B",paused:"\u58C1\u7EB8\u548C\u52A8\u6001\u4E3B\u9898\u5DF2\u6682\u505C",firstFetchFailed:"\u6682\u65F6\u65E0\u6CD5\u83B7\u53D6\u58C1\u7EB8\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",fetchFailed:"\u66F4\u65B0\u5931\u8D25\uFF0C\u5DF2\u4FDD\u7559\u4E0A\u4E00\u5F20\u58C1\u7EB8\uFF1B\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",stale:"Bing \u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u663E\u793A\u4E0A\u6B21\u6210\u529F\u83B7\u53D6\u7684\u58C1\u7EB8\u3002",sameTime:"\u65E5\u95F4\u548C\u591C\u95F4\u7684\u5F00\u59CB\u65F6\u95F4\u4E0D\u80FD\u76F8\u540C\u3002",storageFailed:"\u65E0\u6CD5\u5728\u6B64\u6D4F\u89C8\u5668\u4FDD\u5B58\u8FD9\u4E9B\u63A7\u5236\u9879\u3002"}},ye)}});})();
51
+ ${De}
52
+ @media(max-width:560px){.bdt-page{padding:16px}.bdt-row{gap:8px}.bdt-row>label{width:100%}.bdt-row:has(.bdt-wallpaper-select,.bdt-filter-range)>.bdt-control,.bdt-page .bdt-wallpaper-select{width:100%}.bdt-filter-range{flex:1}}`;function Pt(){t.useEffect(()=>{document.getElementById(re)?.remove()},[]);let y=p();if(!y.settings.enabled||!y.url)return null;let g=e.wallpaperShade(y.scheme),D=`url(${JSON.stringify(y.url)})`,U=dt.css({selector:"html",image:D,overlays:[g],settings:y.settings,fixed:!0});return n("style",null,`html{background-image:linear-gradient(${g},${g}),${D};background-size:cover;background-position:center;background-attachment:fixed}body{background-color:transparent!important}${U}${Pe(y.settings.dynamic)}${y.settings.dynamic?Ce:""}${Me(y.settings.dynamic)}`)}function Bt(){Ct();let y=p(),g=y.settings,D=(A,gt,Oe)=>n("div",{className:"bdt-row"},n("label",{htmlFor:`bdt-${A}`},l(A)),n("div",{className:"bdt-control"},gt,Oe)),U=A=>n("input",{id:`bdt-${A}`,type:"checkbox",checked:g[A],onChange:gt=>R({[A]:gt.target.checked})}),q=dt.options[g.filterMode],N=g.filterAmounts[g.filterMode],Q=`filterAmount.${g.filterMode}`,K=`bdt-${Q}`,st=g.enabled?dt.effect(g):null,et=st?.bleed??0,ft=t.useMemo(()=>e.makeTokens(g.dynamic?y.accent:[112,112,112],g.strength,g.dynamic?g.paletteMode:"monochrome"),[y.accent,g.strength,g.paletteMode,g.dynamic]),Et=t.useMemo(()=>e.PALETTE_MODES.map(A=>({mode:A,tokens:e.makeTokens(y.accent,g.strength,A)})),[y.accent,g.strength]),Wt=t.useId(),Ee=typeof y.meta?.copyrightUrl=="string"&&/^https:\/\/(?:www|cn)\.bing\.com\//.test(y.meta.copyrightUrl)?y.meta.copyrightUrl:"https://www.bing.com/";return n("section",{className:"bdt-page","aria-label":l("title")},n("style",null,ot),n("h2",null,l("title")),n("figure",{className:"bdt-photo"},y.url?n("div",{className:"bdt-preview"},n("img",{className:"bdt-preview-image",src:y.url,alt:y.meta?.title||l("preview"),style:{filter:st?.filter,...et?{inset:-et,width:`calc(100% + ${et*2}px)`,height:`calc(100% + ${et*2}px)`}:{}}}),st?.tint&&n("span",{className:"bdt-preview-tint","aria-hidden":!0,style:{backgroundColor:st.tint}})):n("div",{className:"bdt-preview",role:"img","aria-label":l("preview")}),y.meta&&n("figcaption",{className:"bdt-photo-caption"},n("div",{className:"bdt-photo-heading"},n("strong",null,y.meta.title||l("preview")),n("span",{className:"bdt-photo-date"},`${y.meta.date} \xB7 ${l(`market.${y.meta.market}`)}`)),n("div",{className:"bdt-photo-details"},n("a",{href:Ee,target:"_blank",rel:"noopener noreferrer"},y.meta.copyright||l("source")),g.dynamic&&n("div",{className:"bdt-swatches","aria-label":l("palette")},...["light","dark"].map(A=>n("span",{key:A,className:"bdt-swatch",title:l(A),style:{backgroundColor:ft["--dsw-alias-brand-primary"][A]}}))))),n("button",{className:"bdt-photo-refresh",type:"button",disabled:y.busy||!g.enabled,"aria-label":l("refresh"),title:l("refresh"),"aria-busy":y.busy,onClick:()=>{G()}},n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:!1},n("path",{d:"M3 12a9 9 0 0 1 15.36-6.36L21 8M21 3v5h-5M21 12a9 9 0 0 1-15.36 6.36L3 16M8 16H3v5"})))),n("span",{className:"bdt-photo-status",role:"status","aria-live":"polite"},g.enabled?y.busy?l("loading"):y.issue?l(y.issue):l(y.meta?y.meta.market===g.market?"ready":"sourceFailed":"waiting"):l("paused")),n("div",{className:"bdt-card"},D("enabled",U("enabled")),D("market",n("select",{id:"bdt-market",value:g.market,onChange:A=>R({market:A.target.value}),className:"bdt-wallpaper-select"},...["zh-CN","en-US"].map(A=>n("option",{key:A,value:A},l(`market.${A}`))))),D("filterMode",n("select",{id:"bdt-filterMode",className:"bdt-wallpaper-select",value:g.filterMode,disabled:!g.enabled,onChange:A=>R({filterMode:A.target.value})},...dt.modes.map(A=>n("option",{key:A,value:A},l(`filter.${A}`))))),q&&D(Q,n("input",{id:K,className:"bdt-filter-range",type:"range",min:0,max:q.max,step:1,value:N,disabled:!g.enabled,"aria-valuetext":q.unit==="px"?`${N} ${l("filterPixels")}`:`${N}%`,onChange:A=>R({filterAmounts:{...g.filterAmounts,[g.filterMode]:Number(A.target.value)}})}),n("output",{htmlFor:K},`${N}${q.unit}`)),D("dynamic",U("dynamic")),n("fieldset",{className:"bdt-palette-group",disabled:!g.dynamic},n("legend",null,l("paletteMode")),n("div",{className:"bdt-palette-grid"},...Et.map(({mode:A,tokens:gt})=>n("label",{key:A,className:"bdt-palette-option",htmlFor:`${Wt}-${A}`},n("input",{id:`${Wt}-${A}`,className:"bdt-palette-choice",type:"radio",name:Wt,value:A,checked:g.paletteMode===A,onChange:()=>R({paletteMode:A})}),n("span",{className:"bdt-palette-card"},Ie(n,gt),n("span",{className:"bdt-palette-caption"},n("span",{className:"bdt-palette-name"},l(`palette.${A}`)),n("span",{className:"bdt-palette-check","aria-hidden":!0},"\u2713"))))))),D("mode",n("select",{id:"bdt-mode",value:g.mode,onChange:A=>R({mode:A.target.value})},...["schedule","system","follow","light","dark"].map(A=>n("option",{key:A,value:A},l(A))))),g.mode==="schedule"&&n("div",null,...["day","night"].map(A=>D(A,n("input",{id:`bdt-${A}`,type:"time",value:g[A],onChange:gt=>R({[A]:gt.target.value})})))),D("strength",n("input",{id:"bdt-strength",type:"range",min:10,max:100,step:1,value:g.strength,"aria-valuetext":`${g.strength}%`,onChange:A=>R({strength:Number(A.target.value)})}),n("output",{htmlFor:"bdt-strength"},`${g.strength}%`))),y.storageIssue&&n("p",{role:"status"},l("storageFailed")))}m.slots.inject("shell.overlay",()=>m.slots.register({name:"shell.overlay",id:"bing-daily-theme.wallpaper",order:-100},Pt)),m.effect(()=>{let y=()=>m.slots.inject("settings.section",()=>m.slots.register({name:"settings.section",id:"bing-daily-theme",order:25,label:()=>l("title")},Bt)),g=y(),D=m.locale.subscribe(()=>{g(),g=y()});return()=>{D(),g()}}),m.effect(()=>{let y=setInterval(ut,6e4),g=()=>{document.visibilityState==="visible"&&ut()},D=()=>{M=0,ut()},U=q=>{if(q.key===c)try{R(e.normalizeSettings(JSON.parse(q.newValue||"{}")))}catch{}};return document.addEventListener("visibilitychange",g),window.addEventListener("online",D),window.addEventListener("storage",U),x(),G(),()=>{P=!1,I++,clearInterval(y),T?.abort(),document.removeEventListener("visibilitychange",g),window.removeEventListener("online",D),window.removeEventListener("storage",U),document.getElementById(re)?.remove(),S?.(),V(),C&&URL.revokeObjectURL(C),f.clear()}})}}}function Be(t,e,r){let a=t.getTheme().preference,n="",i=!1;function o(){if(n&&t.getTheme().preference===n){i=!0;try{t.setTheme(a)}finally{i=!1}}n=""}return{restore:o,sync(c,m=new Date){if(!c.enabled||c.mode==="follow"){o();return}let l=c.mode==="schedule"?r(m,c.day,c.night):c.mode;if(l){n||(a=t.getTheme().preference),i=!0;try{t.getTheme().preference!==l&&t.setTheme(l),n=l}finally{i=!1}}},changed(c){!i&&n&&c.preference!==n&&(n="",e())}}}window.__ModuleLoader__.load({id:"@nzlov/dsh-bing-wallpaper",factory(t){return Fe(t("react"),te,{en:{title:"Bing daily wallpaper",paletteMode:"Colour mode","palette.content":"M3 Content","palette.tonal-spot":"M3 Tonal Spot","palette.fruit-salad":"M3 Fruit Salad","palette.rainbow":"M3 Rainbow","palette.monochrome":"M3 Monochrome","palette.vibrant":"Vibrant","palette.faithful":"Faithful","palette.soft":"Soft","palette.dysfunctional":"Dysfunctional","palette.muted":"Muted",enabled:"Wallpaper enabled",dynamic:"Extract theme colours",market:"Wallpaper source","market.zh-CN":"China","market.en-US":"International (US)",sourceFailed:"Could not switch sources. The previous source\u2019s wallpaper is still shown; check your connection and retry.",mode:"Day/night mode",schedule:"Local time schedule",system:"Follow system",follow:"Follow DSH appearance",light:"Light",dark:"Dark",day:"Light from",night:"Dark from",strength:"Wallpaper visibility",filterMode:"Background filter",filterPixels:"pixels","filter.none":"None","filter.blur":"Blur","filter.frosted":"Frosted glass","filter.blue":"Blue tint","filter.grayscale":"Grayscale","filter.dim":"Dim","filterAmount.blur":"Blur radius","filterAmount.frosted":"Frosted glass radius","filterAmount.blue":"Blue tint intensity","filterAmount.grayscale":"Grayscale intensity","filterAmount.dim":"Dimming intensity",refresh:"Check for updates",loading:"Updating\u2026",ready:"Wallpaper is up to date",waiting:"Wallpaper paused or not yet loaded",preview:"Daily wallpaper preview",palette:"Light and dark accent colours",source:"View on Bing",paused:"Wallpaper and dynamic theme are paused",firstFetchFailed:"Wallpaper could not be loaded. Check your connection and retry.",fetchFailed:"Update failed. The previous wallpaper is kept; check your connection and retry.",stale:"Bing is unavailable. Showing the last successful wallpaper.",sameTime:"Light and dark times must be different.",storageFailed:"These controls could not be saved in this browser."},zh:{title:"Bing \u6BCF\u65E5\u58C1\u7EB8",paletteMode:"\u53D6\u8272\u6A21\u5F0F","palette.content":"M3 Content","palette.tonal-spot":"M3 Tonal Spot","palette.fruit-salad":"M3 Fruit Salad","palette.rainbow":"M3 Rainbow","palette.monochrome":"M3 Monochrome","palette.vibrant":"Vibrant","palette.faithful":"Faithful","palette.soft":"Soft","palette.dysfunctional":"Dysfunctional","palette.muted":"Muted",enabled:"\u542F\u7528\u58C1\u7EB8",dynamic:"\u4ECE\u58C1\u7EB8\u63D0\u53D6\u4E3B\u9898\u8272",market:"\u58C1\u7EB8\u6765\u6E90","market.zh-CN":"\u56FD\u5185\uFF08\u4E2D\u56FD\uFF09","market.en-US":"\u56FD\u9645\uFF08\u7F8E\u56FD\uFF09",sourceFailed:"\u5207\u6362\u6765\u6E90\u5931\u8D25\uFF0C\u4ECD\u663E\u793A\u4E0A\u4E00\u6765\u6E90\u7684\u58C1\u7EB8\uFF1B\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",mode:"\u65E5\u591C\u5207\u6362\u65B9\u5F0F",schedule:"\u6309\u672C\u5730\u65F6\u95F4\u5207\u6362",system:"\u8DDF\u968F\u7CFB\u7EDF",follow:"\u8DDF\u968F DSH \u5916\u89C2",light:"\u6D45\u8272",dark:"\u6DF1\u8272",day:"\u6D45\u8272\u5F00\u59CB\u65F6\u95F4",night:"\u6DF1\u8272\u5F00\u59CB\u65F6\u95F4",strength:"\u58C1\u7EB8\u53EF\u89C1\u5EA6",filterMode:"\u80CC\u666F\u6EE4\u955C",filterPixels:"\u50CF\u7D20","filter.none":"\u65E0","filter.blur":"\u6A21\u7CCA\uFF08Blur\uFF09","filter.frosted":"\u6BDB\u73BB\u7483","filter.blue":"\u84DD\u8272\u8C03","filter.grayscale":"\u9ED1\u767D","filter.dim":"\u538B\u6697","filterAmount.blur":"\u6A21\u7CCA\u534A\u5F84","filterAmount.frosted":"\u6BDB\u73BB\u7483\u534A\u5F84","filterAmount.blue":"\u84DD\u8272\u8C03\u5F3A\u5EA6","filterAmount.grayscale":"\u9ED1\u767D\u5F3A\u5EA6","filterAmount.dim":"\u538B\u6697\u5F3A\u5EA6",refresh:"\u68C0\u67E5\u66F4\u65B0",loading:"\u6B63\u5728\u66F4\u65B0\u2026",ready:"\u58C1\u7EB8\u5DF2\u66F4\u65B0",waiting:"\u58C1\u7EB8\u5DF2\u6682\u505C\u6216\u5C1A\u672A\u52A0\u8F7D",preview:"\u6BCF\u65E5\u58C1\u7EB8\u9884\u89C8",palette:"\u6D45\u8272\u4E0E\u6DF1\u8272\u4E3B\u9898\u7684\u5F3A\u8C03\u8272",source:"\u5728 Bing \u67E5\u770B",paused:"\u58C1\u7EB8\u548C\u52A8\u6001\u4E3B\u9898\u5DF2\u6682\u505C",firstFetchFailed:"\u6682\u65F6\u65E0\u6CD5\u83B7\u53D6\u58C1\u7EB8\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",fetchFailed:"\u66F4\u65B0\u5931\u8D25\uFF0C\u5DF2\u4FDD\u7559\u4E0A\u4E00\u5F20\u58C1\u7EB8\uFF1B\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",stale:"Bing \u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u663E\u793A\u4E0A\u6B21\u6210\u529F\u83B7\u53D6\u7684\u58C1\u7EB8\u3002",sameTime:"\u65E5\u95F4\u548C\u591C\u95F4\u7684\u5F00\u59CB\u65F6\u95F4\u4E0D\u80FD\u76F8\u540C\u3002",storageFailed:"\u65E0\u6CD5\u5728\u6B64\u6D4F\u89C8\u5668\u4FDD\u5B58\u8FD9\u4E9B\u63A7\u5236\u9879\u3002"}},Be)}});})();
40
53
  /*! Bundled license information:
41
54
 
42
55
  @material/material-color-utilities/utils/math_utils.js:
package/locale/en.json CHANGED
@@ -30,6 +30,19 @@
30
30
  "day": "Light from",
31
31
  "night": "Dark from",
32
32
  "strength": "Wallpaper visibility",
33
+ "filterMode": "Background filter",
34
+ "filterPixels": "pixels",
35
+ "filter.none": "None",
36
+ "filter.blur": "Blur",
37
+ "filter.frosted": "Frosted glass",
38
+ "filter.blue": "Blue tint",
39
+ "filter.grayscale": "Grayscale",
40
+ "filter.dim": "Dim",
41
+ "filterAmount.blur": "Blur radius",
42
+ "filterAmount.frosted": "Frosted glass radius",
43
+ "filterAmount.blue": "Blue tint intensity",
44
+ "filterAmount.grayscale": "Grayscale intensity",
45
+ "filterAmount.dim": "Dimming intensity",
33
46
  "refresh": "Check for updates",
34
47
  "loading": "Updating…",
35
48
  "ready": "Wallpaper is up to date",
package/locale/zh.json CHANGED
@@ -30,6 +30,19 @@
30
30
  "day": "浅色开始时间",
31
31
  "night": "深色开始时间",
32
32
  "strength": "壁纸可见度",
33
+ "filterMode": "背景滤镜",
34
+ "filterPixels": "像素",
35
+ "filter.none": "无",
36
+ "filter.blur": "模糊(Blur)",
37
+ "filter.frosted": "毛玻璃",
38
+ "filter.blue": "蓝色调",
39
+ "filter.grayscale": "黑白",
40
+ "filter.dim": "压暗",
41
+ "filterAmount.blur": "模糊半径",
42
+ "filterAmount.frosted": "毛玻璃半径",
43
+ "filterAmount.blue": "蓝色调强度",
44
+ "filterAmount.grayscale": "黑白强度",
45
+ "filterAmount.dim": "压暗强度",
33
46
  "refresh": "检查更新",
34
47
  "loading": "正在更新…",
35
48
  "ready": "壁纸已更新",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nzlov/dsh-bing-wallpaper",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "description": "Daily Bing wallpaper, image-derived theme colours and automatic day/night appearance for DSH Web.",
6
6
  "author": "nzlov",
@@ -26,6 +26,7 @@
26
26
  "index.js",
27
27
  "bing-source.js",
28
28
  "boot-theme.js",
29
+ "wallpaper-filter.js",
29
30
  "client.js",
30
31
  "cordis.patch.yml",
31
32
  "locale/*.json",
@@ -40,7 +41,7 @@
40
41
  "build": "node scripts/build.mjs",
41
42
  "prepack": "npm run build",
42
43
  "test": "node --test test/*.test.js",
43
- "check": "node --check index.js && node --check bing-source.js && node --check palette.js && node --check client-main.js && node --check appearance.js && node --check boot-theme.js && node --check compatibility.js && node --check palette-preview.js && node --check client.js"
44
+ "check": "node --check index.js && node --check bing-source.js && node --check palette.js && node --check client-main.js && node --check appearance.js && node --check boot-theme.js && node --check compatibility.js && node --check wallpaper-filter.js && node --check palette-preview.js && node --check client.js"
44
45
  },
45
46
  "dsh": {
46
47
  "bundle": {
@@ -0,0 +1,55 @@
1
+ // Self-contained so the Host can embed the same filters in its startup script.
2
+ export function createWallpaperFilters() {
3
+ const options = Object.freeze({
4
+ blur: Object.freeze({ max: 32, initial: 12, unit: 'px' }),
5
+ frosted: Object.freeze({ max: 32, initial: 12, unit: 'px' }),
6
+ blue: Object.freeze({ max: 60, initial: 25, unit: '%' }),
7
+ grayscale: Object.freeze({ max: 100, initial: 100, unit: '%' }),
8
+ dim: Object.freeze({ max: 60, initial: 24, unit: '%' }),
9
+ });
10
+ const modes = Object.freeze(['none', ...Object.keys(options)]);
11
+
12
+ function normalize(input) {
13
+ const mode = input?.filterMode;
14
+ const amounts = input?.filterAmounts;
15
+ const filterAmounts = Object.fromEntries(Object.entries(options).map(([key, { max, initial }]) => {
16
+ const amount = amounts != null && Object.hasOwn(amounts, key) ? amounts[key] : undefined;
17
+ return [key, Number.isFinite(amount) ? Math.round(Math.min(max, Math.max(0, amount))) : initial];
18
+ }));
19
+ return { filterMode: modes.includes(mode) ? mode : 'none', filterAmounts };
20
+ }
21
+
22
+ function effect(input) {
23
+ const { filterMode, filterAmounts } = normalize(input);
24
+ const amount = filterAmounts[filterMode];
25
+ if (!amount) return null;
26
+ switch (filterMode) {
27
+ case 'blur':
28
+ case 'frosted': return {
29
+ filter: `blur(${amount}px)`, bleed: amount * 3,
30
+ // The frosted preset adds a mist layer; Blur leaves the photo colour alone.
31
+ ...(filterMode === 'frosted' ? { tint: `rgb(255 255 255 / ${Math.round(amount * .75)}%)` } : {}),
32
+ };
33
+ case 'blue': return { tint: `rgb(48 110 246 / ${amount}%)` };
34
+ case 'grayscale': return { filter: `grayscale(${amount}%)` };
35
+ case 'dim': return { filter: `brightness(${100 - amount}%)` };
36
+ default: return null;
37
+ }
38
+ }
39
+
40
+ // The caller owns the selector, validated image CSS and readability overlays.
41
+ // Put the filter on the image layer alone; paint the scrim above it, not
42
+ // inside the filter, so its existing contrast bounds still apply.
43
+ function css({ selector, image, overlays, settings, fixed = false }) {
44
+ const look = effect(settings);
45
+ if (!image || !look) return '';
46
+ const position = fixed ? 'fixed' : 'absolute';
47
+ const layers = look.tint ? [...overlays, look.tint] : overlays;
48
+ const backing = fixed ? '' : `${selector}{position:relative;isolation:isolate;overflow:hidden}`;
49
+ return `${backing}${selector}::before{content:"";position:${position};inset:${look.bleed ? `-${look.bleed}px` : '0'};z-index:-2;pointer-events:none;background:${image} center/cover no-repeat;${look.filter ? `filter:${look.filter};` : ''}}${selector}::after{content:"";position:${position};inset:0;z-index:-1;pointer-events:none;background-image:${layers.map(color => `linear-gradient(${color},${color})`).join(',')}}`;
50
+ }
51
+
52
+ return { modes, options, normalize, effect, css };
53
+ }
54
+
55
+ export const wallpaperFilters = createWallpaperFilters();