tokentracker-cli 0.41.0 → 0.42.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.ja.md +1 -0
- package/README.ko.md +1 -0
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dashboard/dist/assets/{ActivityHeatmap-DAyvtRkn.js → ActivityHeatmap-CImSj13A.js} +1 -1
- package/dashboard/dist/assets/{Card-DByZ3SxT.js → Card-DpjFlMHF.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-CZkSRYE8.js +19 -0
- package/dashboard/dist/assets/{DevicePage-BkGbFsCV.js → DevicePage-BIBlmBPl.js} +1 -1
- package/dashboard/dist/assets/{DialogTitle-BhNOpzk4.js → DialogTitle-BMKzpys0.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CQ0uWwqS.js → FadeIn-B5-cy4YN.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-OlcZIZs-.js → HeaderGithubStar-BM-sbvJG.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-VaBccp0v.js → IpCheckPage-C7-NXbFK.js} +4 -4
- package/dashboard/dist/assets/{LandingPage-BbOOtp0W.js → LandingPage-ouOFlABY.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-B26XN7XT.js → LeaderboardAvatar-DMXPtCkx.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-D43tLe4r.js → LeaderboardPage-CC4CFYAe.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfileModal-Cc3TV4wl.js → LeaderboardProfileModal-D-ncIr24.js} +3 -3
- package/dashboard/dist/assets/LeaderboardProfilePage-DtDMfVuQ.js +421 -0
- package/dashboard/dist/assets/{LimitsPage-HXB3ON_M.js → LimitsPage-qaD7Reti.js} +2 -2
- package/dashboard/dist/assets/{LocalOnlyNotice-BtgOf0xW.js → LocalOnlyNotice-BCy18fW4.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-CHNz2uuj.js → LoginPage-BLPY2ZI-.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-i1aCasNO.js → PopoverPopup-CpIlpO0j.js} +1 -1
- package/dashboard/dist/assets/{Select-Dn4TdKJu.js → Select-BOxMknxo.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-D2YtMFj0.js → SelectItemText-B0SL3Wb5.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-De7GbtPf.js +1 -0
- package/dashboard/dist/assets/{SkillsPage-Bt8e5ROp.js → SkillsPage-jpoYzUBQ.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-CGnhXDpP.js → WidgetsPage-BaEYiZZH.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-FEgpbrfx.js → WrappedPage-BYhKuiTb.js} +1 -1
- package/dashboard/dist/assets/agent-logos-DSQgCNll.js +1 -0
- package/dashboard/dist/assets/{arrow-up-right-Al34G4US.js → arrow-up-right-Brwh94cN.js} +1 -1
- package/dashboard/dist/assets/{download-BorAs8Ai.js → download-kFiot71R.js} +1 -1
- package/dashboard/dist/assets/{info-BjMpOQ6L.js → info-CGx4zWQF.js} +1 -1
- package/dashboard/dist/assets/{main-BZIH6355.js → main-9Ze1SUIZ.js} +18 -18
- package/dashboard/dist/assets/{main-DTwPGswA.css → main-DMJJVAOH.css} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-CMcyG3Sf.js → use-limits-display-prefs-Ehri95OP.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-Dda0lUdD.js → use-native-settings-BWqG5RDr.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-DpD2WuDG.js → use-usage-limits-2ZxmPfoP.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-Bar8ZQys.js → useCurrency-DQmyhw3i.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-g4Jj83C_.js → useScrollLock-BcLeWqWK.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/lib/local-api.js +63 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +15 -13
- package/dashboard/dist/assets/DashboardPage-DJLLG7DG.js +0 -19
- package/dashboard/dist/assets/LeaderboardProfilePage-DAVuscsT.js +0 -1
- package/dashboard/dist/assets/SettingsPage-D-44xtnb.js +0 -1
- package/dashboard/dist/assets/agent-logos-2LgC_fmg.js +0 -1
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import{r as _,j as p,T as xe,W as ge,Y as ve,aD as be,L as St,aE as we,G as Y,af as ye}from"./main-9Ze1SUIZ.js";import{u as ke}from"./useCurrency-DQmyhw3i.js";import{H as Me}from"./HeaderGithubStar-BM-sbvJG.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Te}from"./LeaderboardProfileModal-D-ncIr24.js";import{D as Se}from"./download-kFiot71R.js";import"./LeaderboardAvatar-DMXPtCkx.js";import"./ActivityHeatmap-CImSj13A.js";import"./info-CGx4zWQF.js";import"./arrow-up-right-Brwh94cN.js";import"./useScrollLock-BcLeWqWK.js";import"./DialogTitle-BMKzpys0.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,Ee=16,je=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
|
|
2
|
+
attribute vec2 a_position;
|
|
3
|
+
void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
|
|
4
|
+
`,Ge=`
|
|
5
|
+
precision highp float;
|
|
6
|
+
|
|
7
|
+
uniform vec2 u_resolution;
|
|
8
|
+
uniform float u_time;
|
|
9
|
+
uniform vec3 u_color1, u_color2, u_color3, u_color4, u_color5, u_color6, u_color7;
|
|
10
|
+
uniform float u_alpha1, u_alpha2, u_alpha3, u_alpha4, u_alpha5, u_alpha6, u_alpha7;
|
|
11
|
+
uniform float u_intensity, u_scale, u_direction;
|
|
12
|
+
uniform float u_softness, u_distortion, u_complexity, u_shape;
|
|
13
|
+
uniform float u_vignette, u_vigOpacity, u_blur, u_shaderOpacity;
|
|
14
|
+
|
|
15
|
+
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|
16
|
+
vec2 mod289v2(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|
17
|
+
vec3 permute(vec3 x) { return mod289((x * 34.0 + 1.0) * x); }
|
|
18
|
+
|
|
19
|
+
float snoise(vec2 v) {
|
|
20
|
+
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
|
|
21
|
+
-0.577350269189626, 0.024390243902439);
|
|
22
|
+
vec2 i = floor(v + dot(v, C.yy));
|
|
23
|
+
vec2 x0 = v - i + dot(i, C.xx);
|
|
24
|
+
vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
25
|
+
vec4 x12 = x0.xyxy + C.xxzz;
|
|
26
|
+
x12.xy -= i1;
|
|
27
|
+
i = mod289v2(i);
|
|
28
|
+
vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));
|
|
29
|
+
vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);
|
|
30
|
+
m = m * m; m = m * m;
|
|
31
|
+
vec3 x_ = 2.0 * fract(p * C.www) - 1.0;
|
|
32
|
+
vec3 h = abs(x_) - 0.5;
|
|
33
|
+
vec3 ox = floor(x_ + 0.5);
|
|
34
|
+
vec3 a0 = x_ - ox;
|
|
35
|
+
m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);
|
|
36
|
+
vec3 g;
|
|
37
|
+
g.x = a0.x * x0.x + h.x * x0.y;
|
|
38
|
+
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
39
|
+
return 130.0 * dot(m, g);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
float fbm(vec2 p, float oct) {
|
|
43
|
+
float val = 0.0, amp = 0.5;
|
|
44
|
+
int n = int(oct);
|
|
45
|
+
for (int i = 0; i < 7; i++) {
|
|
46
|
+
if (i >= n) break;
|
|
47
|
+
val += amp * snoise(p);
|
|
48
|
+
p *= 2.0;
|
|
49
|
+
amp *= 0.5;
|
|
50
|
+
}
|
|
51
|
+
return val;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
float nfbm(vec2 p) { return fbm(p, 3.0 + u_complexity * 4.0); }
|
|
55
|
+
|
|
56
|
+
/* 5-stop palette used by effect 1 (Plasma) — direct port of \`palette\` from
|
|
57
|
+
* the canonical engine. Stops at t = 0, 0.25, 0.5, 0.75, 1.0. */
|
|
58
|
+
vec3 palette(float t) {
|
|
59
|
+
t = clamp(t, 0.0, 1.0);
|
|
60
|
+
t = t * t * (3.0 - 2.0 * t);
|
|
61
|
+
float k = 64.0;
|
|
62
|
+
float w1 = u_alpha1 * exp(-k * t * t);
|
|
63
|
+
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
|
|
64
|
+
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
|
|
65
|
+
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
|
|
66
|
+
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
|
|
67
|
+
float total = w1 + w2 + w3 + w4 + w5 + 0.0001;
|
|
68
|
+
return (u_color1 * w1 + u_color2 * w2 + u_color3 * w3 +
|
|
69
|
+
u_color4 * w4 + u_color5 * w5) / total;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Per-pixel alpha that re-introduces transparency when the user dials any
|
|
73
|
+
* palette stop's alpha below 1. Same \`paletteAlpha\` from the canonical
|
|
74
|
+
* engine. With every preset shipping all-1 alphas, this returns ~1 for every
|
|
75
|
+
* pixel — but mirroring it keeps custom-preset behaviour identical. */
|
|
76
|
+
float paletteAlpha(float t) {
|
|
77
|
+
t = clamp(t, 0.0, 1.0);
|
|
78
|
+
t = t * t * (3.0 - 2.0 * t);
|
|
79
|
+
float k = 64.0;
|
|
80
|
+
float w1 = u_alpha1 * exp(-k * t * t);
|
|
81
|
+
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
|
|
82
|
+
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
|
|
83
|
+
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
|
|
84
|
+
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
|
|
85
|
+
float totalW = w1 + w2 + w3 + w4 + w5 + 0.0001;
|
|
86
|
+
float rawW = exp(-k * t * t)
|
|
87
|
+
+ exp(-k * (t - 0.25) * (t - 0.25))
|
|
88
|
+
+ exp(-k * (t - 0.5) * (t - 0.5))
|
|
89
|
+
+ exp(-k * (t - 0.75) * (t - 0.75))
|
|
90
|
+
+ exp(-k * (t - 1.0) * (t - 1.0))
|
|
91
|
+
+ 0.0001;
|
|
92
|
+
return totalW / rawW;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
vec2 warp(vec2 p, float t) {
|
|
96
|
+
float str = u_distortion * 2.0;
|
|
97
|
+
return vec2(
|
|
98
|
+
nfbm(p + vec2(t * 0.1, 0.0)),
|
|
99
|
+
nfbm(p + vec2(0.0, t * 0.12) + 5.0)
|
|
100
|
+
) * str;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Plasma: four sine bands warped by an FBM field, mapped through the
|
|
104
|
+
* 5-stop palette. Identical to effect 1 in the canonical engine. */
|
|
105
|
+
vec3 computeEffect(vec2 uv, float aspect, float t, float dist, float cpx) {
|
|
106
|
+
vec2 p = (uv - 0.5) * u_scale;
|
|
107
|
+
p.x *= aspect;
|
|
108
|
+
p += vec2(cos(u_direction), sin(u_direction)) * t * 0.15;
|
|
109
|
+
|
|
110
|
+
float freq = 3.0 + cpx * 8.0;
|
|
111
|
+
float val = 0.0;
|
|
112
|
+
val += sin(p.x * freq + t);
|
|
113
|
+
val += sin(p.y * freq + t * 1.3);
|
|
114
|
+
val += sin((p.x + p.y) * freq * 0.7 + t * 0.7);
|
|
115
|
+
val += sin(length(p) * freq * 0.8 - t * 1.5);
|
|
116
|
+
vec2 w = warp(p, t);
|
|
117
|
+
val += (w.x + w.y) * dist;
|
|
118
|
+
val = val * 0.2 * u_intensity + 0.5;
|
|
119
|
+
|
|
120
|
+
return palette(clamp(val, 0.0, 1.0));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
void main() {
|
|
124
|
+
vec2 uv = gl_FragCoord.xy / u_resolution;
|
|
125
|
+
float aspect = u_resolution.x / u_resolution.y;
|
|
126
|
+
float t = u_time; // JS already multiplied u_time by preset.speed.
|
|
127
|
+
float dist = u_distortion;
|
|
128
|
+
float cpx = u_complexity;
|
|
129
|
+
|
|
130
|
+
/* 5-tap cross blur (center + cardinal offsets). The chromatic/silver/gold
|
|
131
|
+
* presets all ship with blur=1 so this path is always active. 5 taps
|
|
132
|
+
* instead of the canonical engine's 9 saves ~44% fragment work; the
|
|
133
|
+
* perceptual difference is nil because the output is already soft from
|
|
134
|
+
* the plasma's low spatial frequency and CSS blur on reflections. */
|
|
135
|
+
vec3 col;
|
|
136
|
+
if (u_blur < 0.01) {
|
|
137
|
+
col = computeEffect(uv, aspect, t, dist, cpx);
|
|
138
|
+
} else {
|
|
139
|
+
float r = u_blur * 0.02;
|
|
140
|
+
col = computeEffect(uv, aspect, t, dist, cpx) * 0.4;
|
|
141
|
+
col += computeEffect(uv + vec2( r, 0.0), aspect, t, dist, cpx) * 0.15;
|
|
142
|
+
col += computeEffect(uv + vec2(-r, 0.0), aspect, t, dist, cpx) * 0.15;
|
|
143
|
+
col += computeEffect(uv + vec2(0.0, r), aspect, t, dist, cpx) * 0.15;
|
|
144
|
+
col += computeEffect(uv + vec2(0.0, -r), aspect, t, dist, cpx) * 0.15;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* Gamma punch — adds the contrast pop that defines the chromatic
|
|
148
|
+
* highlights. From the canonical engine: \`col = pow(col, vec3(1.3))\`. */
|
|
149
|
+
col = pow(col, vec3(1.3));
|
|
150
|
+
|
|
151
|
+
/* Vignette — soft edge darkening so corners read as recessed. The 40-px
|
|
152
|
+
* scale at the bottom of the formula is hard-coded in the canonical
|
|
153
|
+
* engine; we keep it for visual parity. */
|
|
154
|
+
float edgeDist = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));
|
|
155
|
+
float vigPx = 40.0 / min(u_resolution.x, u_resolution.y);
|
|
156
|
+
float vigRange = vigPx * (1.0 + u_vignette * 3.0);
|
|
157
|
+
float vig = edgeDist * edgeDist / (vigRange * vigRange);
|
|
158
|
+
vig = smoothstep(0.0, 1.0, vig);
|
|
159
|
+
col *= mix(1.0, vig, u_vignette * u_vigOpacity);
|
|
160
|
+
|
|
161
|
+
/* Per-pixel alpha. With all-1 alphas the formula collapses to ~1 but the
|
|
162
|
+
* computation matches the canonical engine so custom presets behave the
|
|
163
|
+
* same. */
|
|
164
|
+
float colorAlpha = (u_alpha1 + u_alpha2 + u_alpha3 + u_alpha4 + u_alpha5) / 5.0;
|
|
165
|
+
if (colorAlpha < 0.999) {
|
|
166
|
+
vec3 c1d = col - u_color1, c2d = col - u_color2, c3d = col - u_color3,
|
|
167
|
+
c4d = col - u_color4, c5d = col - u_color5;
|
|
168
|
+
float prox1 = exp(-8.0 * dot(c1d, c1d));
|
|
169
|
+
float prox2 = exp(-8.0 * dot(c2d, c2d));
|
|
170
|
+
float prox3 = exp(-8.0 * dot(c3d, c3d));
|
|
171
|
+
float prox4 = exp(-8.0 * dot(c4d, c4d));
|
|
172
|
+
float prox5 = exp(-8.0 * dot(c5d, c5d));
|
|
173
|
+
float pTotal = prox1 + prox2 + prox3 + prox4 + prox5 + 0.0001;
|
|
174
|
+
colorAlpha = (prox1 * u_alpha1 + prox2 * u_alpha2 + prox3 * u_alpha3 +
|
|
175
|
+
prox4 * u_alpha4 + prox5 * u_alpha5) / pTotal;
|
|
176
|
+
}
|
|
177
|
+
float alpha = colorAlpha;
|
|
178
|
+
|
|
179
|
+
/* Touch the unused-at-effect-1 uniforms so GL drivers that complain about
|
|
180
|
+
* declared-but-unread uniforms (some Mali / Adreno builds do) keep them
|
|
181
|
+
* live. The contribution is provably zero. */
|
|
182
|
+
alpha += 0.0 * (u_softness + u_shape +
|
|
183
|
+
u_alpha6 + u_alpha7 +
|
|
184
|
+
u_color6.x + u_color7.x);
|
|
185
|
+
|
|
186
|
+
gl_FragColor = vec4(col, alpha * u_shaderOpacity);
|
|
187
|
+
}
|
|
188
|
+
`;function Rt(t,e,a){const r=t.createShader(e);if(!r)throw new Error("metal-fx: gl.createShader returned null");if(t.shaderSource(r,a),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error(`metal-fx: shader compile failed: ${o??"(no info log)"}`)}return r}function De(t,e,a){const r=t.createProgram();if(!r)throw new Error("metal-fx: gl.createProgram returned null");if(t.attachShader(r,e),t.attachShader(r,a),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS)){const o=t.getProgramInfoLog(r);throw t.deleteProgram(r),new Error(`metal-fx: program link failed: ${o??"(no info log)"}`)}return r}const Yt=140,Kt=40,Zt=1.6,Jt=1.3;let s=null,bt=null;function Ue(t){bt=t}const qe=["u_resolution","u_time","u_color1","u_color2","u_color3","u_color4","u_color5","u_color6","u_color7","u_alpha1","u_alpha2","u_alpha3","u_alpha4","u_alpha5","u_alpha6","u_alpha7","u_intensity","u_scale","u_direction","u_softness","u_distortion","u_complexity","u_shape","u_vignette","u_vigOpacity","u_blur","u_shaderOpacity"];function Ft(t){t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);const e=Rt(t,t.VERTEX_SHADER,He),a=Rt(t,t.FRAGMENT_SHADER,Ge),r=De(t,e,a);t.useProgram(r);const o=t.createBuffer();if(!o)throw new Error("metal-fx: gl.createBuffer returned null");t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),t.STATIC_DRAW);const n=t.getAttribLocation(r,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0);const i={};for(const u of qe)i[u]=t.getUniformLocation(r,u);return{program:r,buffer:o,uniforms:i}}function te(){if(s)return s;const t=Math.min(Ne,typeof window<"u"&&window.devicePixelRatio||1),e=Math.round(Le*t),a=typeof OffscreenCanvas<"u";let r,o;if(a)r=new OffscreenCanvas(e,e),o=r.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1});else{const h=document.createElement("canvas");h.width=e,h.height=e,o=h.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1,preserveDrawingBuffer:!0})??h.getContext("experimental-webgl"),r=h}if(!o)throw new Error("metal-fx: WebGL not supported");const{program:n,buffer:i,uniforms:u}=Ft(o),l=h=>{h.preventDefault(),s&&(s.contextLost=!0)},c=()=>{if(!s)return;const h=Ft(s.gl);s.program=h.program,s.buffer=h.buffer,s.uniforms=h.uniforms,s.presetDirty=!0,s.contextLost=!1,bt?.()};return r.addEventListener("webglcontextlost",l,!1),r.addEventListener("webglcontextrestored",c,!1),s={glCanvas:r,gl:o,program:n,buffer:i,uniforms:u,preset:Xt.chromatic.modes.dark,presetDirty:!0,contextLost:!1,useOffscreen:a,frameBitmap:null,startMs:performance.now(),pausedMs:0,pausedAtMs:null,rafId:0,dpr:t,instances:new Set,frameCount:0,glowQueue:[],glowIdx:0,glowSkip:0,glowPixels:new Uint8Array(e*e*4),glowPixelsW:e,glowPixelsH:e},s}function Qe(){var t;if(!s)return;const{gl:e,program:a,buffer:r,frameBitmap:o}=s;try{o?.close(),e.deleteBuffer(r),e.deleteProgram(a),(t=e.getExtension("WEBGL_lose_context"))==null||t.loseContext()}catch{}s=null}let It=0;function dt(){if(!s)return;const t=performance.now();if(t-It<Pe)return;It=t;const{gl:e,glCanvas:a}=s,r=a.width,o=a.height;(s.glowPixelsW!==r||s.glowPixelsH!==o)&&(s.glowPixelsW=r,s.glowPixelsH=o,s.glowPixels=new Uint8Array(r*o*4)),e.readPixels(0,0,r,o,e.RGBA,e.UNSIGNED_BYTE,s.glowPixels)}const K={bx:0,by:0};function kt(t,e,a){if(!s)return K.bx=0,K.by=0,K;const{glCanvas:r}=s,o=r.width,n=r.height,i=t.dpr,u=t.cssWidth*i,l=t.cssHeight*i,c=Yt*i,h=Kt*i;let f=u*(o/c)/t.shaderScale,d=l*(n/h)/t.shaderScale;f>o&&(f=o),d>n&&(d=n);const g=(o-f)/2,x=(n-d)/2,m=g+e/t.cssWidth*f,F=x+a/t.cssHeight*d;return K.bx=Math.round(m),K.by=Math.round(n-1-F),K}const G={r:0,g:0,b:0,lum:0,count:0};function ee(t,e,a,r,o,n){const i=Math.max(1,n|0),u=Math.max(0,r-i),l=Math.min(e,r+i+1),c=Math.max(0,o-i),h=Math.min(a,o+i+1);G.r=0,G.g=0,G.b=0,G.lum=0,G.count=0;for(let f=c;f<h;f++){const d=f*e;for(let g=u;g<l;g++){const x=(d+g)*4;G.r+=t[x],G.g+=t[x+1],G.b+=t[x+2],G.lum+=(.2126*t[x]+.7152*t[x+1]+.0722*t[x+2])/255,G.count++}}return G}const R={r:255,g:255,b:255};function Ot(t,e,a,r){if(!s)return 0;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count>0?n.lum/n.count:0}function Ve(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count===0?(R.r=255,R.g=255,R.b=255,R):(R.r=n.r/n.count,R.g=n.g/n.count,R.b=n.b/n.count,R)}function Xe(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),{glowPixels:n,glowPixelsW:i,glowPixelsH:u}=s,l=Math.max(1,r|0),c=Math.max(0,o.bx-l),h=Math.min(i,o.bx+l+1),f=Math.max(0,o.by-l),d=Math.min(u,o.by+l+1);let g=-1;R.r=255,R.g=255,R.b=255;for(let x=f;x<d;x++){const m=x*i;for(let F=c;F<h;F++){const b=(m+F)*4,P=n[b],E=n[b+1],L=n[b+2],C=Math.max(P,E,L),j=Math.min(P,E,L),z=(C>0?(C-j)/C:0)*(.35+.65*(C/255));z>g&&(g=z,R.r=P,R.g=E,R.b=L)}}return R}Ue(()=>{s&&s.instances.size>0&&s.pausedAtMs===null&&nt()});typeof document<"u"&&document.addEventListener("visibilitychange",()=>{!s||s.pausedAtMs!==null||s.contextLost||(document.hidden?oe():s.instances.size>0&&nt())});function Ye(t){const e=te(),a=t.hostCanvas.getContext("2d",{alpha:!0});if(!a)throw new Error("metal-fx: canvas 2D context unavailable");const r=t.scale??1,o={canvas:t.hostCanvas,ctx:a,cssWidth:t.cssWidth,cssHeight:t.cssHeight,cornerRadius:t.cornerRadius,kind:t.kind,ringCssPx:t.ringCssPx??(t.kind==="circle"?2:1)*r,shaderScale:t.shaderScale??(t.kind==="circle"?Jt:Zt)*r,opacityMul:t.opacityMul??1,visible:!0,paused:t.paused??!1,everCopied:!1,dpr:typeof window<"u"&&window.devicePixelRatio||1,scale:r,onAfterFrame:t.onAfterFrame,onFirstCopy:t.onFirstCopy};return ae(o),e.instances.add(o),e.rafId===0&&e.pausedAtMs===null&&nt(),o}function Ke(t){if(!s)return;s.instances.delete(t);const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1),s.instances.size===0&&(oe(),Qe())}function Ze(t){s&&(s.glowQueue.includes(t)||s.glowQueue.push(t))}function Je(t){if(!s)return;const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1)}function rt(t,e){let a=!1;e.cssWidth!==void 0&&e.cssWidth!==t.cssWidth&&(t.cssWidth=e.cssWidth,a=!0),e.cssHeight!==void 0&&e.cssHeight!==t.cssHeight&&(t.cssHeight=e.cssHeight,a=!0),e.cornerRadius!==void 0&&(t.cornerRadius=e.cornerRadius),e.scale!==void 0&&(t.scale=e.scale),e.kind!==void 0&&e.kind!==t.kind&&(t.kind=e.kind,e.shaderScale===void 0&&(t.shaderScale=(e.kind==="circle"?Jt:Zt)*t.scale),e.ringCssPx===void 0&&(t.ringCssPx=(e.kind==="circle"?2:1)*t.scale)),e.shaderScale!==void 0&&(t.shaderScale=e.shaderScale),e.ringCssPx!==void 0&&(t.ringCssPx=e.ringCssPx),e.opacityMul!==void 0&&(t.opacityMul=e.opacityMul),e.paused!==void 0&&e.paused!==t.paused&&(t.paused=e.paused,!e.paused&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()),a&&ae(t)}function ta(t,e){t.visible=e,e&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()}function ea(t,e){const a=te();a.preset=Xt[t].modes[e],a.presetDirty=!0}let wt=null;function aa(t){wt=t}function ae(t){t.dpr=typeof window<"u"&&window.devicePixelRatio||1;const e=Math.max(1,Math.round(t.cssWidth*t.dpr)),a=Math.max(1,Math.round(t.cssHeight*t.dpr));t.canvas.width!==e&&(t.canvas.width=e),t.canvas.height!==a&&(t.canvas.height=a)}function ra(t){const{ctx:e,dpr:a,canvas:r}=t,o=t.ringCssPx*a,n=r.width,i=r.height,u=Math.max(0,(t.cornerRadius-t.ringCssPx)*a);e.save(),e.globalCompositeOperation="destination-out",e.fillStyle="#000",e.beginPath(),e.roundRect(o,o,n-2*o,i-2*o,u),e.fill(),e.restore()}function oa(t){var e;if(!s)return;const a=s.frameBitmap??s.glCanvas,r=t.dpr,o=t.canvas.width,n=t.canvas.height;if(o<1||n<1)return;const i=s.glCanvas.width,u=s.glCanvas.height,l=Yt*r,c=Kt*r;let h=o*(i/l)/t.shaderScale,f=n*(u/c)/t.shaderScale;h>i&&(h=i),f>u&&(f=u);const d=Math.max(0,(i-h)/2),g=Math.max(0,(u-f)/2);if(t.ctx.clearRect(0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=t.opacityMul),t.ctx.drawImage(a,d,g,h,f,0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=1),ra(t),t.onFirstCopy){const x=t.onFirstCopy;t.onFirstCopy=void 0,x()}(e=t.onAfterFrame)==null||e.call(t)}function na(){if(!s)return;const{gl:t,uniforms:e,preset:a,glCanvas:r}=s;e.u_resolution&&t.uniform2f(e.u_resolution,r.width,r.height);for(let o=0;o<7;o++){const n=e[`u_color${o+1}`];if(n){const[u,l,c]=$e(a.colors[o]);t.uniform3f(n,u,l,c)}const i=e[`u_alpha${o+1}`];i&&t.uniform1f(i,a.alphas[o])}e.u_intensity&&t.uniform1f(e.u_intensity,a.intensity),e.u_scale&&t.uniform1f(e.u_scale,a.scale),e.u_direction&&t.uniform1f(e.u_direction,a.direction*Math.PI/180),e.u_softness&&t.uniform1f(e.u_softness,a.softness),e.u_distortion&&t.uniform1f(e.u_distortion,a.distortion),e.u_complexity&&t.uniform1f(e.u_complexity,a.complexity),e.u_shape&&t.uniform1f(e.u_shape,a.shape),e.u_vignette&&t.uniform1f(e.u_vignette,a.vignette),e.u_vigOpacity&&t.uniform1f(e.u_vigOpacity,a.vigOpacity),e.u_blur&&t.uniform1f(e.u_blur,a.blur),e.u_shaderOpacity&&t.uniform1f(e.u_shaderOpacity,a.shaderOpacity),s.presetDirty=!1}function ia(t){if(!s)return;const{gl:e,uniforms:a,preset:r,glCanvas:o}=s,n=(t-s.startMs-s.pausedMs)/1e3*r.speed;e.viewport(0,0,o.width,o.height),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),s.presetDirty&&na(),a.u_time&&e.uniform1f(a.u_time,n),e.drawArrays(e.TRIANGLES,0,6),s.frameCount++}let Pt=0;function re(t){var e;if(!s)return;if(s.contextLost){s.rafId=0;return}let a=!1;for(const r of s.instances)if(r.visible&&(!r.paused||!r.everCopied)){a=!0;break}if(!a){s.rafId=0;return}if(s.rafId=requestAnimationFrame(re),!(t-Pt<Ie)){Pt=t,ia(t),s.useOffscreen&&(s.glowQueue.length>0&&dt(),(e=s.frameBitmap)==null||e.close(),s.frameBitmap=s.glCanvas.transferToImageBitmap());for(const r of s.instances)r.visible&&(r.paused&&r.everCopied||(oa(r),r.everCopied=!0));if(wt&&s.glowQueue.length>0&&++s.glowSkip%Ae===0){const r=s.glowQueue;s.glowIdx>=r.length&&(s.glowIdx=0);const o=r[s.glowIdx];o.visible&&!o.paused&&wt(o,t),s.glowIdx++}}}function nt(){!s||s.rafId!==0||(s.rafId=requestAnimationFrame(re))}function oe(){s&&(s.rafId!==0&&cancelAnimationFrame(s.rafId),s.rafId=0)}const lt={linear:t=>t,smoothstep:t=>t*t*(3-2*t)};function Z(t,e,a,r=lt.linear){return{from:t,to:e,dur:a,ease:r,startMs:-1,val:t,done:!1}}function J(t,e){t.startMs=e,t.val=t.from,t.done=!1}function At(t,e){if(t.done||t.startMs<0)return t.val;const a=Math.min(1,(e-t.startMs)/t.dur);return t.val=t.from+(t.to-t.from)*t.ease(a),a>=1&&(t.done=!0),t.val}const sa=1.5,it=1/3,la=4*it,ca=2*it,da=2*it,ua=1.35*it,ha=13*it;function Mt(t,e,a){const r=Math.max(0,Math.min(a,Math.min(t,e)/2));return 2*Math.max(0,t-2*r)+2*Math.max(0,e-2*r)+2*Math.PI*r}function _t(t,e,a,r){return r==="circle"?2*Math.PI*Math.max(0,Math.min(a,Math.min(t,e)/2)):Mt(t,e,a)}function ot(t,e,a,r,o,n,i,u){const l=u||{x:0,y:0},c=Math.max(0,Math.min(r,Math.min(e,a)/2));if(i==="circle"){const b=2*Math.PI*c;if(b<=1e-4)return l.x=e*.5,l.y=a*.5,l;t=(t%b+b)%b;const P=-Math.PI/2+t/b*Math.PI*2,E=Math.max(0,c-o+n);return l.x=e*.5+E*Math.cos(P),l.y=a*.5+E*Math.sin(P),l}const h=Math.max(0,e-2*c),f=Math.max(0,a-2*c),d=Math.PI*c/2,g=2*(h+f)+4*d;t=(t%g+g)%g;const x=Math.max(0,c-o+n);let m=t;if(m<h)return l.x=c+m,l.y=o-n,l;if(m-=h,m<d){const b=-Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=e-o+n,l.y=c+m,l;if(m-=f,m<d){const b=(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<h)return l.x=e-c-m,l.y=a-o+n,l;if(m-=h,m<d){const b=Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=o-n,l.y=a-c-m,l;m-=f;const F=Math.PI+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(F),l.y=c+x*Math.sin(F),l}function Et(t,e){const a=t*2/e;let r="";for(let o=0;o<=e;o++){const n=-t+o*a;r+=(o===0?"M ":"L ")+n.toFixed(3)+" 0 "}return r}const ft={x:0,y:0},pt={x:0,y:0};function fa(t,e,a,r,o,n){return ot(t-.1,e,a,r,o,0,n,ft),ot(t+.1,e,a,r,o,0,n,pt),Math.atan2(pt.y-ft.y,pt.x-ft.x)}function jt(t,e,a){const r=Math.max(0,Math.min(1,(a-t)/(e-t)));return r*r*(3-2*r)}function pa(t){const e=_t(t.width,t.height,t.cornerRadius,t.kind),a=sa*(t.scale??1),r=[];for(let o=0;o<$t;o++){const n=o/$t*e,i=ot(n,t.width,t.height,t.cornerRadius,a,0,t.kind);r.push({x:i.x,y:i.y,arc:n})}return r}function ma(t,e){const{width:a,height:r,cornerRadius:o}=t,n=t.scale??1,i=t.kind==="circle"?2:1,u=Math.max(0,o-i),l=(-200*n).toFixed(0),c=l,h=(540*n).toFixed(0),f=(440*n).toFixed(0),d=`x="${l}" y="${c}" width="${h}" height="${f}"`,g=`${d} filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"`,x=F=>(F*n).toFixed(3),m=F=>(F*n).toFixed(3);return["<defs>",`<filter id="${e}_bXl" ${g}><feGaussianBlur stdDeviation="${m(8.4)}"/></filter>`,`<filter id="${e}_bLg" ${g}><feGaussianBlur stdDeviation="${m(4.8)}"/></filter>`,`<filter id="${e}_bMd" ${g}><feGaussianBlur stdDeviation="${m(2.1)}"/></filter>`,`<filter id="${e}_bSm" ${g}><feGaussianBlur stdDeviation="${m(.9)}"/></filter>`,`<filter id="${e}_ebO" ${g}><feGaussianBlur stdDeviation="${m(da)}"/></filter>`,`<filter id="${e}_ebC" ${g}><feGaussianBlur stdDeviation="${m(ua)}"/></filter>`,`<radialGradient id="${e}_fg" cx="0.5" cy="0.5" r="0.5"><stop offset="0" stop-color="white"/><stop offset="0.30" stop-color="white"/><stop offset="0.65" stop-color="#404040"/><stop offset="1" stop-color="black"/></radialGradient>`,`<mask id="${e}_fm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="black"/><circle id="${e}_fc" cx="0" cy="0" r="${(ha*n).toFixed(3)}" fill="url(#${e}_fg)"/></mask>`,`<mask id="${e}_rm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="#808080"/><rect x="0" y="0" width="${a}" height="${r}" rx="${o}" ry="${o}" fill="white"/><rect x="${i}" y="${i}" width="${a-i*2}" height="${r-i*2}" rx="${u}" ry="${u}" fill="black"/></mask>`,"</defs>",`<g id="${e}_h" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g id="${e}_hI" stroke="white">`,`<path id="${e}_pXl" stroke-width="${x(26.4)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.385" filter="url(#${e}_bXl)"/>`,`<path id="${e}_pLg" stroke-width="${x(15.6)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.595" filter="url(#${e}_bLg)"/>`,`<path id="${e}_pMd" stroke-width="${x(7.2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bMd)"/>`,`<path id="${e}_pSm" stroke-width="${x(3)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bSm)"/>`,"</g></g>",`<g id="${e}_e" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g mask="url(#${e}_fm)">`,`<g id="${e}_eI" stroke="white">`,`<path id="${e}_eO" stroke-width="${x(la)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.85" filter="url(#${e}_ebO)"/>`,`<path id="${e}_eC" stroke-width="${x(ca)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="1.0" filter="url(#${e}_ebC)"/>`,"</g></g></g>"].join("")}const xa=.00875,Lt=.08,Nt=.32,ga=.05,va=3e3,Wt=.85,st=.34,mt=1500,ba=15,wa=.0075,ya=120,ka=1.5,Ma=7.8,_a=9.13952,Ca=1,Ta=1/3,Sa=.8,$a=3.51,Bt=2e3,xt=400,Ra=2.625,Fa=1.008,Ia=.31,ne=140,ie=40,se=20;let Oa=0;const q={x:0,y:0};function zt(t,e){const a=`mfxg_${++Oa}`,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","metal-fx-glow-svg"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e.width} ${e.height}`),r.innerHTML=ma(e,a),t.appendChild(r);const o=b=>r.querySelector(`#${a}_${b}`),n=o("h"),i=o("hI"),u=o("e"),l=o("eI"),c=o("fc"),h=_t(e.width,e.height,e.cornerRadius,e.kind)/Mt(ne,ie,se),f=Math.max(1,Ma*h),d=Math.max(.6,_a*Ta*h),g=Et(f,Ee),x=Et(d,je),m=[o("pXl"),o("pLg"),o("pMd"),o("pSm")],F=[o("eO"),o("eC")];for(const b of m)b.setAttribute("d",g);for(const b of F)b.setAttribute("d",x);return i.style.transformOrigin="0 0",l.style.transformOrigin="0 0",i.style.willChange="transform",l.style.willChange="transform",i.style.transition="transform 100ms linear",l.style.transition="transform 100ms linear",n.style.willChange="opacity",u.style.willChange="opacity",n.style.transition="opacity 100ms linear",u.style.transition="opacity 100ms linear",c.style.willChange="transform",{svg:r,haloGroup:n,haloInner:i,extraGroup:u,extraInner:l,fadeCircle:c,width:e.width,height:e.height,cornerRadius:e.cornerRadius,kind:e.kind,scale:e.scale??1,perim:pa(e),currentIdx:0,appearedAt:0,glowOpacity:0,relocTween:null,relocNextIdx:-1,wanderS:0,wanderTargetS:0,wanderFrames:0,tintFrom:{r:255,g:255,b:255},tintTarget:{r:255,g:255,b:255},tintTween:null,tintHoldUntil:0,lastHaloStroke:"",lastExtraStroke:""}}function Pa(t,e,a,r,o="dark"){var n;const{width:i,height:u,cornerRadius:l,perim:c}=t;if(c.length===0)return;const h=2;let f=-1,d=t.currentIdx,g=0;for(let v=0;v<c.length;v++){const M=c[v],T=Ot(e,M.x,M.y,h);T>f&&(f=T,d=v),v===t.currentIdx&&(g=T)}const x=t.appearedAt>0&&a-t.appearedAt<va,m=st+(Wt-st)*jt(Lt,Nt,g),F=!x&&f-g>ga;if(!t.relocTween||t.relocTween.done)if(t.appearedAt===0)t.currentIdx=d,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0,t.relocTween=Z(0,m,mt,lt.smoothstep),J(t.relocTween,a);else if((n=t.relocTween)!=null&&n.done&&t.relocTween.to===0){t.currentIdx=t.relocNextIdx,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0;const v=c[t.currentIdx],M=Ot(e,v.x,v.y,h),T=st+(Wt-st)*jt(Lt,Nt,M);t.relocTween=Z(0,T,mt,lt.smoothstep),J(t.relocTween,a)}else F?(t.relocNextIdx=d,t.relocTween=Z(t.glowOpacity,0,mt,lt.smoothstep),J(t.relocTween,a)):t.glowOpacity+=(m-t.glowOpacity)*xa;t.relocTween&&(t.glowOpacity=At(t.relocTween,a)),t.glowOpacity=Math.max(0,Math.min(1,t.glowOpacity));const b=_t(i,u,l,t.kind)/Mt(ne,ie,se),P=ba*b;t.wanderFrames++>=ya&&(t.wanderTargetS=(Math.random()*2-1)*P,t.wanderFrames=0),t.wanderS+=(t.wanderTargetS-t.wanderS)*wa;const E=c[t.currentIdx].arc+t.wanderS,L=ka*t.scale;ot(E,i,u,l,L,0,t.kind,q);const C=q.x,j=q.y,z=fa(E,i,u,l,L,t.kind),X=`translate(${C.toFixed(3)}px,${j.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`;t.haloInner.style.transform=X;const N=Ca*b*t.scale;ot(E,i,u,l,L,N,t.kind,q),t.extraInner.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`,t.fadeCircle.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px)`;const $=o==="light",k=$?Xe(e,C,j,h):Ve(e,C,j,h);t.tintTween?t.tintTween.done&&($?(t.tintFrom={r:t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*t.tintTween.val,g:t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*t.tintTween.val,b:t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*t.tintTween.val},t.tintTarget={...k},t.tintTween=Z(0,1,xt),J(t.tintTween,a)):a>=t.tintHoldUntil&&(t.tintFrom={...t.tintTarget},t.tintTarget={...k},t.tintTween=Z(0,1,xt),J(t.tintTween,a),t.tintHoldUntil=a+Bt)):(t.tintFrom={...k},t.tintTarget={...k},t.tintTween=Z(0,1,xt),J(t.tintTween,a),t.tintHoldUntil=$?0:a+Bt),At(t.tintTween,a);const I=t.tintTween.val;let W,B,H;if($)W=Math.round(t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I),B=Math.round(t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I),H=Math.round(t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I);else{const v=t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I,M=t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I,T=t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I,O=Math.max(v,M,T)||1;W=Math.round(255*(v/O)),B=Math.round(255*(M/O)),H=Math.round(255*(T/O))}const y=`rgb(${W},${B},${H})`;if(y!==t.lastHaloStroke&&(t.lastHaloStroke=y,t.haloInner.style.stroke=y),$){const v=Re(W,B,H),[M,T,O]=Fe(v[0],Math.min(1,v[1]*Ra),Math.max(Ia,v[2]*Fa)),D=`rgb(${M},${T},${O})`;D!==t.lastExtraStroke&&(t.lastExtraStroke=D,t.extraInner.style.stroke=D)}else t.lastExtraStroke!=="#ffffff"&&(t.lastExtraStroke="#ffffff",t.extraInner.style.stroke="#ffffff");const w=Math.max(0,Math.min(1,r));t.haloGroup.style.opacity=(t.glowOpacity*Sa*w).toFixed(3),t.extraGroup.style.opacity=Math.min(1,t.glowOpacity*$a*w).toFixed(3)}const yt=12,Ht=32,Gt=1,Dt=.55,Aa=1,Ea=1,ja=.85,La=0,Na=1.3,Ut=3.6,Wa=.7,Ba=1,za=.52,Ha=1,Ga=.044,Da=235,Ua=2.535,qa=.7,Qa=.5,Va=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function Xa(t,e){const a=Math.max(t.left-e.right,e.left-t.right,0),r=Math.max(t.top-e.bottom,e.top-t.bottom,0);return Math.sqrt(a*a+r*r)}function Ya(t,e,a,r){return!(Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top)<a||Math.max(t.left-e.right,e.left-t.right,0)>r)}function Ka(t,e,a,r){return Math.min(t.right,e.right)-Math.max(t.left,e.left)<a?!1:Math.max(t.top-e.bottom,e.top-t.bottom,0)<=r}function V(t,e,a,r,o,n){const i=Math.max(0,Math.min(n,r*.5,o*.5)),u=t.roundRect;if(typeof u=="function"){u.call(t,e,a,r,o,i);return}t.moveTo(e+i,a),t.lineTo(e+r-i,a),t.quadraticCurveTo(e+r,a,e+r,a+i),t.lineTo(e+r,a+o-i),t.quadraticCurveTo(e+r,a+o,e+r-i,a+o),t.lineTo(e+i,a+o),t.quadraticCurveTo(e,a+o,e,a+o-i),t.lineTo(e,a+i),t.quadraticCurveTo(e,a,e+i,a)}function le(t,e,a,r,o){if(!o.flipX&&!o.flipY){t.drawImage(e,0,0,a,r,o.x,o.y,o.w,o.h);return}t.save(),o.flipX&&(t.translate(o.x+o.w,0),t.scale(-1,1)),o.flipY&&(t.translate(0,o.y+o.h),t.scale(1,-1)),t.drawImage(e,0,0,a,r,o.flipX?0:o.x,o.flipY?0:o.y,o.w,o.h),t.restore()}const Za=4;function Ja(t,e,a,r,o,n,i){if(r<=2*i||o<=2*i){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+i,a+i,r-2*i,o-2*i,Math.max(0,n-i)),t.clip("evenodd")}function tr(t,e,a,r,o,n,i,u,l,c,h){const f=Math.max(1,Math.round((yt+Za*3)*h));let d=Math.max(0,i),g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),Ja(t,c.x,c.y,c.w,c.h,c.r,f),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,l),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=u,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ce(t,e,a,r,o,n,i){const u=i|0;if(u<1||r<=2*u||o<=2*u){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+u,a+u,r-2*u,o-2*u,Math.max(0,n-u)),t.clip("evenodd")}function er(t,e,a,r,o,n,i,u,l,c,h,f){let d=u*h,g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),ce(t,i.x,i.y,i.w,i.h,i.r,l),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,f),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=c,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ar(t,e,a,r,o,n,i,u){const l=t.createLinearGradient(r,o,n,i);l.addColorStop(0,`rgba(255,255,255,${u.toFixed(3)})`),l.addColorStop(.5,`rgba(255,255,255,${(u*.45).toFixed(3)})`),l.addColorStop(1,"rgba(255,255,255,0)"),t.save(),ce(t,e.x,e.y,e.w,e.h,e.r,a),t.globalCompositeOperation="lighter",t.lineWidth=a*2,t.strokeStyle=l,t.beginPath(),V(t,e.x,e.y,e.w,e.h,e.r),t.stroke(),t.restore()}function de(t){const e=getComputedStyle(t),a=[parseFloat(e.borderTopLeftRadius)||0,parseFloat(e.borderTopRightRadius)||0,parseFloat(e.borderBottomRightRadius)||0,parseFloat(e.borderBottomLeftRadius)||0].filter(r=>r>0);return a.length?Math.min.apply(null,a):0}function ue(t){const e=getComputedStyle(t),a=Math.max(parseFloat(e.borderTopWidth)||0,parseFloat(e.borderRightWidth)||0,parseFloat(e.borderBottomWidth)||0,parseFloat(e.borderLeftWidth)||0);let r=0,o=0;const n=e.boxShadow;if(n&&n!=="none"){const u=n.replace(/rgba?\([^)]*\)/g,h=>h.replace(/,/g,"\0")).split(/,\s*/);let l=1/0,c=1/0;for(const h of u){const f=h.match(/-?\d+(?:\.\d+)?px/g);if(!f||f.length<4)continue;const d=parseFloat(f[3]);d>0&&(/\binset\b/.test(h)?d<l&&(l=d):d<c&&(c=d))}Number.isFinite(l)&&(r=l),Number.isFinite(c)&&(o=c)}const i=Math.max(a,o);return{width:Math.max(a,r,o)||1,outerCssPx:i}}function qt(t){t.cornerRadius=de(t.el);const e=ue(t.el);t.hairlineWidth=e.width,t.hairlineOuterCssPx=e.outerCssPx}function rr(t){typeof ResizeObserver<"u"&&(t.resizeObserver=new ResizeObserver(()=>qt(t)),t.resizeObserver.observe(t.el)),typeof MutationObserver<"u"&&(t.mutationObserver=new MutationObserver(()=>qt(t)),t.mutationObserver.observe(t.el,{attributes:!0,attributeFilter:["style","class"]}))}function or(t){var e,a;(e=t.resizeObserver)==null||e.disconnect(),t.resizeObserver=null,(a=t.mutationObserver)==null||a.disconnect(),t.mutationObserver=null}const tt=new Set;function nr(t,e,a){if(typeof document>"u"||Va.has(t.tagName))return null;for(const g of tt)if(g.el===t)return g;const r=document.createElement("div");r.setAttribute("data-metal-fx-reflection",""),r.setAttribute("aria-hidden","true");const o=document.createElement("canvas");o.className="metal-fx-reflection-canvas";const n=o.getContext("2d",{alpha:!0});if(!n)return null;const i=document.createElement("canvas");i.className="metal-fx-reflection-stroke-canvas";const u=i.getContext("2d",{alpha:!0});if(!u)return null;r.appendChild(o),r.appendChild(i);const l=getComputedStyle(t);let c=!1;l.position==="static"&&(t.style.position="relative",c=!0);let h=!1;l.isolation!=="isolate"&&(t.style.isolation="isolate",h=!0),t.setAttribute("data-metal-fx-reflect-host",""),t.insertBefore(r,t.firstChild);const f=ue(t),d={el:t,anchor:e,anchorEl:a,wrap:r,canvas:o,ctx:n,strokeCanvas:i,strokeCtx:u,cornerRadius:de(t),hairlineWidth:f.width,hairlineOuterCssPx:f.outerCssPx,appliedPositionRelative:c,appliedIsolation:h,resizeObserver:null,mutationObserver:null};return rr(d),tt.add(d),d}function ir(t){for(const e of tt)if(e.el===t){or(e),e.canvas.width=0,e.canvas.height=0,e.strokeCanvas.width=0,e.strokeCanvas.height=0,e.wrap.parentNode===e.el&&e.el.removeChild(e.wrap),e.el.removeAttribute("data-metal-fx-reflect-host"),e.appliedPositionRelative&&(e.el.style.position=""),e.appliedIsolation&&(e.el.style.isolation=""),tt.delete(e);return}}function sr(){if(tt.size===0)return;const t=typeof window<"u"&&window.devicePixelRatio||1,e=new Map;for(const a of tt){const r=a.el.getBoundingClientRect();let o=e.get(a.anchorEl);if(o||(o=a.anchorEl.getBoundingClientRect(),e.set(a.anchorEl,o)),r.width<1||r.height<1||o.width<1||o.height<1)continue;if(!Ya(o,r,Gt,Ht)&&!Ka(o,r,Gt,Ht)){a.canvas.width!==1&&(a.canvas.width=1,a.canvas.height=1),a.strokeCanvas.width!==1&&(a.strokeCanvas.width=1,a.strokeCanvas.height=1);continue}const n=a.anchor.canvas,i=n.width|0,u=n.height|0;if(i<4||u<4)continue;const l=(o.left+o.right)*.5,c=(o.top+o.bottom)*.5,h=(r.left+r.right)*.5,f=(r.top+r.bottom)*.5,d=l-h,g=c-f,x=Math.max(o.left-r.right,r.left-o.right,0),m=Math.max(o.top-r.bottom,r.top-o.bottom,0),F=x>=m,b=Xa(o,r);let P=1-Math.min(1,b/yt);P=P*P*(3-2*P);const E=Dt+(Aa-Dt)*P,L=Math.min(Ut,E*Na*Wa),C=a.anchor.scale??1,j=Math.max(Ba*C,a.hairlineWidth),z=Math.max(1,Math.round(j*t)),X=Math.max(1,Math.round(Math.max(Ha*C,a.hairlineWidth)*t)),N=a.hairlineOuterCssPx;a.wrap.style.inset=`${-N}px`,a.wrap.style.borderRadius=`${Math.max(0,a.cornerRadius)}px`;const $=Math.max(1,Math.round((r.width+N*2)*t)),k=Math.max(1,Math.round((r.height+N*2)*t));a.canvas.width!==$&&(a.canvas.width=$),a.canvas.height!==k&&(a.canvas.height=k),a.strokeCanvas.width!==$&&(a.strokeCanvas.width=$),a.strokeCanvas.height!==k&&(a.strokeCanvas.height=k);const I=a.ctx;I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,$,k);const W=a.strokeCtx;W.setTransform(1,0,0,1,0,0),W.clearRect(0,0,$,k);const B=Math.min(yt*t,Math.max($,k));let H,y,w,v;F?(H=d>0?$:0,w=d>0?$-B:B,y=k*.5,v=k*.5):(y=g>0?k:0,v=g>0?k-B:B,H=$*.5,w=$*.5);const M=I.createLinearGradient(H,y,w,v);M.addColorStop(0,`rgba(0,0,0,${Ea})`),M.addColorStop(.5,`rgba(0,0,0,${ja})`),M.addColorStop(1,`rgba(0,0,0,${La})`);const T=i/t,O=Math.max(1,Math.round(Da*Math.max(.1,T/140)*t));let D,U,S,A,Q=!1,Ct=!1;if(F){const at=Math.max(o.top,r.top),ht=Math.min(o.bottom,r.bottom);Q=!0,D=d>0?$-O:0,U=Math.round((at-r.top+N)*t),S=O,A=Math.max(1,Math.round((ht-at)*t))}else{const at=Math.max(o.left,r.left),ht=Math.min(o.right,r.right);Ct=!0,D=Math.round((at-r.left+N)*t),U=g>0?k-O:0,S=Math.max(1,Math.round((ht-at)*t)),A=O}const Tt={x:D,y:U,w:S,h:A,flipX:Q,flipY:Ct},ut={x:0,y:0,w:$,h:k,r:Math.max(0,a.cornerRadius*t)},me=Math.min(Ut,L*Ua*qa*Qa);tr(I,n,i,u,$,k,me,M,Tt,ut,t),er(W,n,i,u,$,k,ut,L,z,M,za,Tt),ar(W,ut,X,H,y,w,v,Math.min(.85,Ga*L)),I.globalCompositeOperation="source-over",W.globalCompositeOperation="source-over"}}let gt=!1,Qt=0;function lr(){gt||(gt=!0,!(typeof requestAnimationFrame>"u")&&requestAnimationFrame(t=>{gt=!1,!(t-Qt<Oe)&&(Qt=t,sr())}))}const Vt="metal-fx-styles",cr=`
|
|
189
|
+
.metal-fx-root {
|
|
190
|
+
position: relative;
|
|
191
|
+
display: inline-flex;
|
|
192
|
+
align-items: center;
|
|
193
|
+
justify-content: center;
|
|
194
|
+
isolation: isolate;
|
|
195
|
+
overflow: visible;
|
|
196
|
+
background: #272727;
|
|
197
|
+
color: #f8f8f8;
|
|
198
|
+
}
|
|
199
|
+
.metal-fx-root[data-theme='light'] {
|
|
200
|
+
background: #ffffff;
|
|
201
|
+
color: #1d1d1d;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.metal-fx-root::before {
|
|
205
|
+
content: '';
|
|
206
|
+
position: absolute;
|
|
207
|
+
inset: 0;
|
|
208
|
+
border-radius: inherit;
|
|
209
|
+
pointer-events: none;
|
|
210
|
+
z-index: 2;
|
|
211
|
+
box-shadow: inset 0 0 50px 0 rgba(255, 255, 255, 0.02);
|
|
212
|
+
}
|
|
213
|
+
.metal-fx-root[data-theme='light']::before {
|
|
214
|
+
box-shadow: inset 0 0 50px 0 rgba(0, 0, 0, 0.02);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.metal-fx-root::after {
|
|
218
|
+
content: '';
|
|
219
|
+
position: absolute;
|
|
220
|
+
inset: 0;
|
|
221
|
+
border-radius: inherit;
|
|
222
|
+
pointer-events: none;
|
|
223
|
+
z-index: 4;
|
|
224
|
+
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
|
|
225
|
+
}
|
|
226
|
+
.metal-fx-root[data-theme='light']::after {
|
|
227
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
|
|
228
|
+
}
|
|
229
|
+
/* Circle variant gets a thicker outer rim than the button variant. */
|
|
230
|
+
.metal-fx-root[data-variant='circle']::after {
|
|
231
|
+
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
|
|
232
|
+
}
|
|
233
|
+
.metal-fx-root[data-theme='light'][data-variant='circle']::after {
|
|
234
|
+
box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.06);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.metal-fx-canvas {
|
|
238
|
+
position: absolute;
|
|
239
|
+
inset: 0;
|
|
240
|
+
width: 100%;
|
|
241
|
+
height: 100%;
|
|
242
|
+
display: block;
|
|
243
|
+
z-index: 0;
|
|
244
|
+
pointer-events: none;
|
|
245
|
+
border-radius: inherit;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* The inner spacer — defines the inset geometry where the metal ring meets
|
|
249
|
+
the interior (3 px for Button, 1-2 px for Circle) and carries the Circle dark
|
|
250
|
+
hairline ('box-shadow: inset' rules below). Intentionally transparent so
|
|
251
|
+
the wrapper's background propagates through to the punched shader centre,
|
|
252
|
+
giving consumers a single surface tone to override. See "Single-surface
|
|
253
|
+
background" in the file header for the rationale. */
|
|
254
|
+
.metal-fx-inner {
|
|
255
|
+
position: absolute;
|
|
256
|
+
inset: 3px;
|
|
257
|
+
border-radius: inherit;
|
|
258
|
+
z-index: 1;
|
|
259
|
+
pointer-events: none;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.metal-fx-root[data-variant='button'][data-shape='pill'] .metal-fx-inner {
|
|
263
|
+
border-radius: calc(var(--mfx-radius, 20px) - 3px);
|
|
264
|
+
}
|
|
265
|
+
.metal-fx-root[data-variant='button'][data-shape='circle'] .metal-fx-inner {
|
|
266
|
+
border-radius: calc(var(--mfx-radius, 16px) - 3px);
|
|
267
|
+
}
|
|
268
|
+
.metal-fx-root[data-variant='circle'][data-shape='pill'] .metal-fx-inner {
|
|
269
|
+
inset: 0;
|
|
270
|
+
border-radius: var(--mfx-radius, 20px);
|
|
271
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
|
|
272
|
+
}
|
|
273
|
+
.metal-fx-root[data-variant='circle'][data-shape='circle'] .metal-fx-inner {
|
|
274
|
+
inset: 0;
|
|
275
|
+
border-radius: var(--mfx-radius, 16px);
|
|
276
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
|
|
277
|
+
}
|
|
278
|
+
/* Circle-variant hairline alpha — light mode.
|
|
279
|
+
Source-of-truth: index.html L2261-2267. The 0.45-alpha black inset that
|
|
280
|
+
reads as a single-pixel frame against the dark interior is too heavy
|
|
281
|
+
on a #ffffff inner: it ends up looking like a hard 2-px black ring
|
|
282
|
+
against the iridescent shader. Suppressed entirely (alpha 0) — the
|
|
283
|
+
shader's own iridescent rim already defines the silhouette in light
|
|
284
|
+
mode, so an extra dark hairline only competes with it. The rule is
|
|
285
|
+
kept (rather than deleted) as a tunable hook in case a future variant
|
|
286
|
+
wants to re-introduce a soft edge. NOTE: we keep the dark-mode inset
|
|
287
|
+
and border-radius values because — unlike index.html — our renderer
|
|
288
|
+
does NOT overscan the canvas in light mode, so there is no 1-px gap
|
|
289
|
+
between inner element and shader to compensate for. */
|
|
290
|
+
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='pill'] .metal-fx-inner,
|
|
291
|
+
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='circle'] .metal-fx-inner {
|
|
292
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/* ─── Combined glow SVG (z=3) ──────────────────────────────────────────────
|
|
296
|
+
Single SVG per instance that holds BOTH the wide-halo group
|
|
297
|
+
(#mfx_haloTravel) and the catch-light group (#mfx_extraTravel), exactly
|
|
298
|
+
mirroring canonical's _buildGlowSvgInner (index.html L8078). One
|
|
299
|
+
mix-blend-mode: screen lifts the combined composite onto the shader
|
|
300
|
+
ring; per-frame opacity attributes on each inner group still drive the
|
|
301
|
+
independent fade-in / fade-out cycles for the halo and the catch-light.
|
|
302
|
+
|
|
303
|
+
Why a single SVG: the circle variant anchors halo + catch-light at the same
|
|
304
|
+
perimeter point, so they overlap in the bright zone. Two separately-
|
|
305
|
+
screened SVGs would double-screen the overlap (A + B + C - AB - AC -
|
|
306
|
+
BC + ABC instead of A + B + C - AB - AC once both groups composite
|
|
307
|
+
in source-over inside one SVG and then screen against the host once).
|
|
308
|
+
That overlap looked muted versus canonical specifically on the circle
|
|
309
|
+
variant where both layers travel together.
|
|
310
|
+
|
|
311
|
+
Source-of-truth opacity: #btnGlowSvg drops to 0.7 in dark and 0.2746 in
|
|
312
|
+
light (index.html L632/L643). */
|
|
313
|
+
.metal-fx-glow-svg {
|
|
314
|
+
position: absolute;
|
|
315
|
+
inset: 0;
|
|
316
|
+
width: 100%;
|
|
317
|
+
height: 100%;
|
|
318
|
+
overflow: visible;
|
|
319
|
+
z-index: 3;
|
|
320
|
+
pointer-events: none;
|
|
321
|
+
opacity: 0.7;
|
|
322
|
+
}
|
|
323
|
+
.metal-fx-root[data-theme='light'] .metal-fx-glow-svg {
|
|
324
|
+
/* Light-mode 1-px overscan mirrors .btn-glow-svg in metal.html so the
|
|
325
|
+
halo stays glued to the visible silhouette (the shader ring there sits
|
|
326
|
+
1 px outside the host's padding box). */
|
|
327
|
+
inset: -1px;
|
|
328
|
+
width: calc(100% + 2px);
|
|
329
|
+
height: calc(100% + 2px);
|
|
330
|
+
mix-blend-mode: multiply;
|
|
331
|
+
/* Source-of-truth: html[data-theme="light"] #btnGlowSvg { opacity: 0.2746 }
|
|
332
|
+
→ −35 % from 0.4225 from the original 0.7 dark-mode opacity. */
|
|
333
|
+
opacity: 0.2746;
|
|
334
|
+
filter: saturate(5.355) brightness(0.78);
|
|
335
|
+
}
|
|
336
|
+
/* Circle light-mode small variants (e.g. 36×36 send button): the geometrically
|
|
337
|
+
shrunk halo loses density when multiplied against #ffffff. Mirror the
|
|
338
|
+
canonical override at index.html L2316 — bump saturation + drop brightness
|
|
339
|
+
so the small glow holds together visually. */
|
|
340
|
+
.metal-fx-root[data-variant='circle'][data-shape='circle'][data-theme='light'] .metal-fx-glow-svg {
|
|
341
|
+
filter: saturate(7.5) brightness(0.6);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/* The wrapped child — hoisted into z=5 so it sits above every overlay, with
|
|
345
|
+
normalized chrome so consumer button styles don't fight the metal frame. */
|
|
346
|
+
.metal-fx-content {
|
|
347
|
+
position: relative;
|
|
348
|
+
z-index: 5;
|
|
349
|
+
display: inline-flex;
|
|
350
|
+
align-items: center;
|
|
351
|
+
justify-content: center;
|
|
352
|
+
width: 100%;
|
|
353
|
+
pointer-events: none;
|
|
354
|
+
}
|
|
355
|
+
.metal-fx-content > * {
|
|
356
|
+
pointer-events: auto;
|
|
357
|
+
}
|
|
358
|
+
.metal-fx-root[data-normalize='true'] .metal-fx-content > * {
|
|
359
|
+
background: transparent !important;
|
|
360
|
+
border: 0 !important;
|
|
361
|
+
outline: 0 !important;
|
|
362
|
+
box-shadow: none !important;
|
|
363
|
+
/* Sizing: we deliberately DO NOT force \`width: 100%; height: 100%\` on the
|
|
364
|
+
child here. That used to be the contract ("the wrapper is the visible
|
|
365
|
+
button surface; the child stretches to fill it"), but it created a cyclic
|
|
366
|
+
percentage dependency: the wrapper is \`inline-flex\` with no intrinsic
|
|
367
|
+
size, .metal-fx-content is \`width/height: 100%\` of the wrapper, and the
|
|
368
|
+
child was \`100%\` of .metal-fx-content. With nothing breaking the cycle,
|
|
369
|
+
icon-only / class-sized children collapsed.
|
|
370
|
+
|
|
371
|
+
The new contract: the child sizes itself (intrinsic content, CSS class,
|
|
372
|
+
or inline style — all work), and the wrapper's \`inline-flex\` wraps it
|
|
373
|
+
tightly. Consumers who want a metal frame BIGGER than the child (e.g.
|
|
374
|
+
padding around an icon) size <MetalFx style={{ width, height }}> AND
|
|
375
|
+
explicitly set width/height on the child to fill (or accept that the
|
|
376
|
+
child renders at its intrinsic size, centered).
|
|
377
|
+
|
|
378
|
+
Typography is intentionally NOT touched. We used to apply
|
|
379
|
+
\`color: inherit; font: inherit;\` here to "match" the wrapper, but
|
|
380
|
+
\`font: inherit\` is a shorthand that overrides font-family, font-size,
|
|
381
|
+
font-weight, AND line-height on the child — which (a) shrank the
|
|
382
|
+
button height (line-height changes propagate through the flex
|
|
383
|
+
content box) and (b) scaled em-based icons / font-icons inside the
|
|
384
|
+
child to whatever the wrapper inherited. The wrapper now stays out
|
|
385
|
+
of the child's typography entirely; consumers who want typographic
|
|
386
|
+
normalization can apply it themselves on the child element. */
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
[data-metal-fx-reflection] {
|
|
390
|
+
position: absolute;
|
|
391
|
+
inset: 0;
|
|
392
|
+
pointer-events: none;
|
|
393
|
+
border-radius: inherit;
|
|
394
|
+
overflow: hidden;
|
|
395
|
+
z-index: 0;
|
|
396
|
+
isolation: isolate;
|
|
397
|
+
}
|
|
398
|
+
.metal-fx-reflection-canvas {
|
|
399
|
+
position: absolute;
|
|
400
|
+
inset: 0;
|
|
401
|
+
width: 100%;
|
|
402
|
+
height: 100%;
|
|
403
|
+
display: block;
|
|
404
|
+
filter: blur(4px) saturate(1.2) brightness(1.58);
|
|
405
|
+
}
|
|
406
|
+
.metal-fx-reflection-stroke-canvas {
|
|
407
|
+
position: absolute;
|
|
408
|
+
inset: 0;
|
|
409
|
+
width: 100%;
|
|
410
|
+
height: 100%;
|
|
411
|
+
display: block;
|
|
412
|
+
filter: saturate(1.35) brightness(1.75);
|
|
413
|
+
}
|
|
414
|
+
/* Hosts that participate as reflection targets need positioning + isolation
|
|
415
|
+
so the wrap composites only against the host (not the parent stack). The
|
|
416
|
+
wrap injects these inline as well, but stating them here keeps reflections
|
|
417
|
+
working on hosts that already have other inline styles applied. */
|
|
418
|
+
[data-metal-fx-reflect-host] {
|
|
419
|
+
isolation: isolate;
|
|
420
|
+
}
|
|
421
|
+
`;let vt=!1;function dr(){if(vt||typeof document>"u")return;if(document.getElementById(Vt)){vt=!0;return}const t=document.createElement("style");t.id=Vt,t.textContent=cr,document.head.appendChild(t),vt=!0}dr();const ur={position:"absolute",inset:0,width:"100%",height:"100%"},hr={position:"absolute",inset:3},fr={position:"absolute",inset:0,pointerEvents:"none",zIndex:3,borderRadius:"inherit"},ct=new Map;aa((t,e)=>{const a=ct.get(t);a&&Pa(a.handles,t,e,t.opacityMul,a.themeRef.current)});function pr(t){const[e,a]=_.useState(()=>t!=="auto"?t:typeof window>"u"||!window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return _.useEffect(()=>{if(t!=="auto"){a(t);return}if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches?"dark":"light");return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),e}const he=_.forwardRef(function({children:t,variant:e="button",preset:a="chromatic",theme:r="auto",strength:o=1,paused:n=!1,borderRadius:i,normalizeHostStyles:u=!0,reflectionTargets:l,disableGlow:c=!1,shaderScale:h,ringCssPx:f,scale:d=1,className:g,style:x,...m},F){const b=_.useRef(null),P=_.useRef(null),E=_.useRef(null),L=_.useRef(null),C=_.useRef(null),j=_.useRef(null),z=_.useRef("dark"),X=_.useRef(0),[N,$]=_.useState(!1),k=pr(r);z.current=k;const I=e==="circle"?"circle":"pill",W=!c;_.useImperativeHandle(F,()=>b.current,[]);const B=(y,w)=>{if(I==="circle")return Math.min(y,w)/2;const v=typeof i=="number"?i:(()=>{var M;const T=(M=L.current)==null?void 0:M.firstElementChild;if(T){const O=parseFloat(getComputedStyle(T).borderTopLeftRadius);if(Number.isFinite(O)&&O>0)return O}return X.current})();return Math.min(v,Math.min(y,w)/2)};_.useEffect(()=>{ea(a,k)},[a,k]),_.useEffect(()=>{const y=C.current;y&&rt(y,{paused:n})},[n]),_.useEffect(()=>{const y=C.current;if(!y)return;const w={};h!==void 0&&(w.shaderScale=h),f!==void 0&&(w.ringCssPx=f),d!==void 0&&(w.scale=d),Object.keys(w).length>0&&rt(y,w)},[h,f,d]),_.useLayoutEffect(()=>{const y=P.current,w=b.current,v=E.current;if(!y||!w)return;{const S=getComputedStyle(w),A=parseFloat(S.borderTopLeftRadius);X.current=Number.isFinite(A)?A:0}const M=()=>{const S=w.getBoundingClientRect(),A=Math.max(1,Math.round(S.width)),Q=Math.max(1,Math.round(S.height));return{cssWidth:A,cssHeight:Q,cornerRadius:B(A,Q)}},T=M();C.current=Ye({hostCanvas:y,cssWidth:T.cssWidth,cssHeight:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,paused:n,shaderScale:h,ringCssPx:f,scale:d,onFirstCopy:()=>$(!0)}),w.style.setProperty("--mfx-radius",`${T.cornerRadius}px`),w.style.borderRadius=`${T.cornerRadius}px`,v&&(j.current=zt(v,{width:T.cssWidth,height:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,scale:d}));let O=0;const D=new ResizeObserver(()=>{O===0&&(O=requestAnimationFrame(()=>{O=0;const S=M(),A=C.current;A&&(rt(A,{cssWidth:S.cssWidth,cssHeight:S.cssHeight,cornerRadius:S.cornerRadius}),w.style.setProperty("--mfx-radius",`${S.cornerRadius}px`),w.style.borderRadius=`${S.cornerRadius}px`,v&&(v.innerHTML="",j.current=zt(v,{width:S.cssWidth,height:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,scale:d}),A&&j.current&&ct.set(A,{handles:j.current,themeRef:z})))}))});D.observe(w);let U=null;return typeof IntersectionObserver<"u"&&(U=new IntersectionObserver(S=>{const A=C.current;if(A)for(const Q of S)ta(A,Q.isIntersecting)},{rootMargin:"64px"}),U.observe(w)),C.current&&j.current&&(ct.set(C.current,{handles:j.current,themeRef:z}),Ze(C.current)),()=>{D.disconnect(),U?.disconnect(),O!==0&&cancelAnimationFrame(O);const S=C.current;S&&(ct.delete(S),Je(S),Ke(S)),C.current=null,j.current=null,v&&(v.innerHTML="")}},[I]),_.useEffect(()=>{const y=C.current;y&&rt(y,{opacityMul:Math.max(0,Math.min(1,o))})},[o,e]),_.useEffect(()=>{const y=C.current,w=b.current;if(!y||!w||!l||k!=="dark")return;y.onAfterFrame=lr;const v=l.flatMap(M=>M.current?[M.current]:[]);for(const M of v)nr(M,y,w);return()=>{y.onAfterFrame=void 0;for(const M of v)ir(M)}},[l,k]),_.useEffect(()=>{const y=b.current,w=C.current;if(!y||!w)return;const v=B(w.cssWidth,w.cssHeight);rt(w,{cornerRadius:v}),y.style.setProperty("--mfx-radius",`${v}px`),y.style.borderRadius=`${v}px`},[i,k,e,I]);const H=_.useMemo(()=>({...x,"--mfx-strength":String(Math.min(1,Math.max(0,o))),opacity:N?1:0,visibility:N?"visible":"hidden",transition:N?"opacity 0.15s ease-out":"none"}),[x,o,N]);return p.jsxs("div",{...m,ref:b,className:g?`metal-fx-root ${g}`:"metal-fx-root","data-variant":e,"data-shape":I,"data-theme":k,"data-paused":n?"true":void 0,"data-normalize":u?"true":"false",style:H,children:[p.jsx("canvas",{ref:P,className:"metal-fx-canvas",style:ur}),p.jsx("div",{className:"metal-fx-inner","aria-hidden":"true",style:hr}),p.jsx("div",{ref:E,"aria-hidden":"true",style:{...fr,display:W?void 0:"none"}}),p.jsx("div",{ref:L,className:"metal-fx-content",children:t})]})});he.displayName="MetalFx";const et=18;function fe(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"4"}),p.jsx("path",{d:"M12 2v2"}),p.jsx("path",{d:"M12 20v2"}),p.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),p.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),p.jsx("path",{d:"M2 12h2"}),p.jsx("path",{d:"M20 12h2"}),p.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),p.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function pe(){return p.jsx("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function mr(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),p.jsx("path",{d:"M8 21h8"}),p.jsx("path",{d:"M12 17v4"})]})}const xr=[{value:"light",label:"Light",Icon:fe},{value:"dark",label:"Dark",Icon:pe},{value:"system",label:"System",Icon:mr}];function gr(t){return t==="dark"?pe:fe}function vr({theme:t,resolvedTheme:e,onSetTheme:a,className:r="",direction:o="down",align:n="right"}){const[i,u]=_.useState(!1),l=_.useRef(null),c=_.useCallback(()=>u(!1),[]);_.useEffect(()=>{if(!i)return;const f=d=>{l.current&&!l.current.contains(d.target)&&c()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i,c]),_.useEffect(()=>{if(!i)return;const f=d=>{d.key==="Escape"&&c()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[i,c]);const h=gr(e);return p.jsxs("div",{ref:l,className:`relative ${r}`,children:[p.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,onClick:()=>u(f=>!f),className:"flex items-center justify-center w-9 h-9 rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors",children:p.jsx(h,{})}),i&&p.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${o==="up"?"bottom-full mb-1":"top-full mt-1"} ${n==="left"?"left-0":"right-0"}`,children:xr.map(({value:f,label:d,Icon:g})=>{const x=t===f;return p.jsxs("button",{type:"button",onClick:()=>{a(f),c()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${x?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[p.jsx(g,{}),p.jsx("span",{children:d})]},f)})})]})}const br="https://github.com/mm7894215/TokenTracker/releases/latest";function Ir({auth:t,signedIn:e,sessionSoftExpired:a,userId:r}){const{currency:o,rate:n}=ke(),{theme:i,resolvedTheme:u,setTheme:l}=xe(),{openLoginModal:c}=ge(),{signedIn:h,loading:f}=ve(),d=!be(),g=e&&!a,x=_.useMemo(()=>g&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,g]),m=_e({userId:r,period:"total",accessToken:x});return p.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[p.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:p.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsxs(St,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[p.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),p.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),p.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:p.jsx(Me,{})})]}),p.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[p.jsxs(St,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[p.jsx(we,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),p.jsx("span",{children:Y("leaderboard.profile.nav.back")})]}),d&&p.jsx(he,{variant:"button",preset:"chromatic",theme:"dark",borderRadius:9999,disableGlow:!0,className:"!bg-black",children:p.jsxs("a",{href:br,target:"_blank",rel:"noopener noreferrer",className:"group no-underline inline-flex h-8 items-center gap-1.5 px-3 text-xs font-bold rounded-full bg-black text-white transition-transform duration-200 active:scale-[0.98]",children:[p.jsx(Se,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:translate-y-0.5"}),p.jsx("span",{className:"hidden sm:inline",children:Y("leaderboard.profile.nav.download")})]})}),f?p.jsx("div",{className:"h-8 w-16 animate-pulse rounded-full bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):h?p.jsx(ye,{}):p.jsx("button",{type:"button",onClick:c,className:"inline-flex h-8 min-w-[76px] items-center justify-center px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm select-none",children:Y("header.auth.sign_in_aria")})]})]})}),p.jsx("main",{className:"flex-1 px-4 pt-4 pb-10 sm:pt-6 sm:pb-16",children:p.jsx("div",{className:"mx-auto max-w-3xl",children:p.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[m.loading&&p.jsx(Ce,{variant:"page"}),!m.loading&&m.error&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:Y("leaderboard.profile_modal.error")})}),!m.loading&&!m.error&&!m.data&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Y("leaderboard.profile_modal.empty")})}),!m.loading&&!m.error&&m.data&&p.jsx(Te,{data:m.data,currency:o,rate:n,variant:"page"})]})})}),p.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 px-4 transition-colors duration-200",children:p.jsxs("div",{className:"mx-auto flex max-w-3xl items-center justify-between text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[p.jsx("p",{children:Y("landing.v2.footer.line")}),p.jsx(vr,{theme:i,resolvedTheme:u,onSetTheme:l,direction:"up",align:"right"})]})})]})}export{Ir as LeaderboardProfilePage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as i,
|
|
2
|
-
`),n=async()=>{try{await navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:o("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:o("limits.copilot.otelHint.body")}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:a}),i.jsx("button",{type:"button",onClick:n,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:t?o("limits.copilot.otelHint.copied"):o("limits.copilot.otelHint.copy")})]})}function ae({claude:e,codex:t,cursor:r,gemini:l,kimi:a,kiro:n,grok:c,antigravity:w,copilot:u,order:p,visibility:f,displayMode:N}){const v={claude:e,codex:t,cursor:r,gemini:l,kimi:a,kiro:n,grok:c,antigravity:w,copilot:u},I=Array.isArray(p)&&p.length>0?p:Y,b=N===s.REMAINING?s.REMAINING:s.USED,L=b===s.REMAINING?o("limits.settings.display_mode_remaining"):o("limits.settings.display_mode_used"),g=I.filter(x=>!f||f[x]!==!1).map(x=>te(x,v[x],b)).filter(Boolean);return i.jsx(
|
|
1
|
+
import{j as i,V as _,G as o,U as E,r as P,aG as K,i as R,L as S,aH as M}from"./main-9Ze1SUIZ.js";import{u as O}from"./use-usage-limits-2ZxmPfoP.js";import{L as s,a as T,l as y,b as C,u as D}from"./use-limits-display-prefs-Ehri95OP.js";import{C as k}from"./Card-DpjFlMHF.js";import{F as A}from"./FadeIn-B5-cy4YN.js";import{L as F}from"./LocalOnlyNotice-BCy18fW4.js";import"./arrow-up-right-Brwh94cN.js";import"./download-kFiot71R.js";const $=[3,2,3,3,2,2,3];function d({className:e}){return i.jsx("div",{className:_("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function G(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(d,{className:"h-3 w-12 shrink-0"}),i.jsx(d,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(d,{className:"h-3 w-[30px] shrink-0"}),i.jsx(d,{className:"h-3 w-6 shrink-0"})]})}function H({bars:e,index:t}){const r=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(d,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(d,{className:_("h-4",r)})]}),Array.from({length:e},(l,a)=>i.jsx(G,{},a))]})}function B(){return i.jsx(k,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(d,{className:"h-3.5 w-28"}),$.map((e,t)=>i.jsx(H,{bars:e,index:t},t))]})})}const j={claude:{windows(e){return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at"},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at"},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at"}]}},codex:{windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude",labelKey:"limits.label.antigravity_claude",window:e.primary_window},{key:"gpro",labelKey:"limits.label.antigravity_gpro",window:e.secondary_window},{key:"flash",labelKey:"limits.label.antigravity_flash",window:e.tertiary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}}},U="shrink-0 text-oai-black dark:text-oai-white";function z(e){if(!e)return null;const t=typeof e=="number"?e*1e3:Date.parse(e);if(!Number.isFinite(t))return null;const r=t-Date.now();if(r<=0)return o("shared.time.now");const l=Math.floor(r/6e4);if(l<60)return`${l}m`;const a=Math.floor(l/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function W(e,t){const r=t===s.REMAINING?100-e:e;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function V({label:e,pct:t,reset:r,mode:l=s.USED}){const a=Math.max(0,Math.min(100,Number(t)||0)),n=l===s.REMAINING?100-a:a,c=Math.round(n),w=n>0&&c===0?Math.max(n,.35):n;let u=String(c);return n>0&&c===0&&(u=o("limits.bar.sub_one_percent")),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:e}),i.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:`${W(n,l)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${w}%`,minWidth:n>0?"3px":0}})}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[u,"%"]}),r&&i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r})]})}function h({name:e,providerId:t,children:r}){const l=C(t);return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[l?i.jsx(E,{provider:l,size:14,className:U}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e})]}),r]})}const Y=T;function m({children:e,tone:t="neutral"}){const r=t==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:e})}function X(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function q(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function J(e,t){return e.filter(r=>r.window).map(r=>i.jsx(V,{label:o(r.labelKey),pct:X(r.window,r.pctField),reset:z(q(r.window,r.resetField)),mode:t},r.key))}function Q({specs:e,mode:t,extra:r=null}){const l=J(e,t),a=l.length===0&&!r;return i.jsxs(i.Fragment,{children:[l,a?i.jsx(m,{children:o("limits.status.no_data")}):null,r]})}function Z(e,t,r,l,a=null){return i.jsx(h,{name:t,providerId:e,children:i.jsx(Q,{mode:r,specs:l,extra:a})},e)}function ee(e,t){return e==="kimi_parallel"&&t.parallel_limit?i.jsx(m,{children:o("limits.label.kimi_parallel",{count:t.parallel_limit})}):e==="copilot_otel"&&!t.otel_has_files&&!t.otel_enabled?i.jsx(re,{defaultDir:t.otel_default_dir}):null}function ie(e,t,r,l){const a=j[e];return a?Z(e,r,l,a.windows(t),ee(a.extra,t)):null}function te(e,t,r){if(!j[e])return null;if(!t?.configured)return i.jsx(h,{name:y(e),providerId:e,children:i.jsx(m,{children:o("limits.status.not_connected")})},e);if(t.error)return i.jsx(h,{name:y(e),providerId:e,children:i.jsx(m,{tone:"error",children:o("shared.error.prefix",{error:t.error})})},e);const l=y(e),a=t.plan_label?`${l} ${t.plan_label}`:l;return ie(e,t,a,r)}function re({defaultDir:e}){const[t,r]=P.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
2
|
+
`),n=async()=>{try{await navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:o("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:o("limits.copilot.otelHint.body")}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:a}),i.jsx("button",{type:"button",onClick:n,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:t?o("limits.copilot.otelHint.copied"):o("limits.copilot.otelHint.copy")})]})}function ae({claude:e,codex:t,cursor:r,gemini:l,kimi:a,kiro:n,grok:c,antigravity:w,copilot:u,order:p,visibility:f,displayMode:N}){const v={claude:e,codex:t,cursor:r,gemini:l,kimi:a,kiro:n,grok:c,antigravity:w,copilot:u},I=Array.isArray(p)&&p.length>0?p:Y,b=N===s.REMAINING?s.REMAINING:s.USED,L=b===s.REMAINING?o("limits.settings.display_mode_remaining"):o("limits.settings.display_mode_used"),g=I.filter(x=>!f||f[x]!==!1).map(x=>te(x,v[x],b)).filter(Boolean);return i.jsx(A,{delay:.15,children:i.jsx(k,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[o("limits.panel.title"),o("limits.panel.mode_separator"),L]}),g.length>0?g:i.jsx(m,{children:o("limits.status.all_hidden")})]})})})}const le=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function we(){const e=K(),{data:t,error:r,isLoading:l}=O(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),a=D();return!le&&!R()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(F,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:o("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:o("limits.page.subtitle")})]}),i.jsx(S,{to:"/settings","aria-label":o("limits.page.openSettings"),title:o("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:i.jsx(M,{className:"h-4 w-4","aria-hidden":!0})})]}),l?i.jsx(B,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:o("shared.error.prefix",{error:r})}):null,i.jsx(ae,{claude:t?.claude,codex:t?.codex,cursor:t?.cursor,gemini:t?.gemini,kimi:t?.kimi,kiro:t?.kiro,grok:t?.grok,antigravity:t?.antigravity,copilot:t?.copilot,order:a.order,visibility:a.visibility,displayMode:a.displayMode})]})]})})})}export{we as LimitsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,
|
|
1
|
+
import{j as e,G as t}from"./main-9Ze1SUIZ.js";import{A as r}from"./arrow-up-right-Brwh94cN.js";import{D as o}from"./download-kFiot71R.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
|