yc-vep-ui 0.5.8 → 0.5.9

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.
@@ -0,0 +1,467 @@
1
+ //#region dist/SimulatorMask-BbciSmUv-Dn2dclmH-DDLwVkTw-CSTOuUAB-DoIyr19q-Ci0HlpJS-CAUrvraj-COVM1bq7-Dco1YmaA-CAr5_7tz-Do-RAm4O-BvITr5Ns-DxkoegYp-Df_I4zne-Dd1XzJ5C-D2hp-9Wv-DfD05Tio-JFBD-L-F-DyfF_beq-DQsQyNwa-CC9X_JR9-DPluomX5.js
2
+ function e(e, t, n, r) {
3
+ let i = Math.max(1, Math.min(e, t)), a = Math.min(Math.min(n, 20) + r, i), o = Math.min(a, Math.floor(e / 2)), s = Math.min(a, Math.floor(t / 2)), c = (t) => t / e * 2 - 1, l = (e) => e / t * 2 - 1, u = e, d = t, f = o, p = e - o, m = s, h = t - s, g = c(0), _ = c(u), v = l(0), y = l(d), b = c(f), x = c(p), S = l(m), C = l(h), w = o / e, T = 1 - o / e, E = s / t, D = 1 - s / t;
4
+ return {
5
+ positions: new Float32Array([
6
+ g,
7
+ v,
8
+ _,
9
+ v,
10
+ g,
11
+ S,
12
+ g,
13
+ S,
14
+ _,
15
+ v,
16
+ _,
17
+ S,
18
+ g,
19
+ C,
20
+ _,
21
+ C,
22
+ g,
23
+ y,
24
+ g,
25
+ y,
26
+ _,
27
+ C,
28
+ _,
29
+ y,
30
+ g,
31
+ S,
32
+ b,
33
+ S,
34
+ g,
35
+ C,
36
+ g,
37
+ C,
38
+ b,
39
+ S,
40
+ b,
41
+ C,
42
+ x,
43
+ S,
44
+ _,
45
+ S,
46
+ x,
47
+ C,
48
+ x,
49
+ C,
50
+ _,
51
+ S,
52
+ _,
53
+ C
54
+ ]),
55
+ uvs: new Float32Array([
56
+ 0,
57
+ 0,
58
+ 1,
59
+ 0,
60
+ 0,
61
+ E,
62
+ 0,
63
+ E,
64
+ 1,
65
+ 0,
66
+ 1,
67
+ E,
68
+ 0,
69
+ D,
70
+ 1,
71
+ D,
72
+ 0,
73
+ 1,
74
+ 0,
75
+ 1,
76
+ 1,
77
+ D,
78
+ 1,
79
+ 1,
80
+ 0,
81
+ E,
82
+ w,
83
+ E,
84
+ 0,
85
+ D,
86
+ 0,
87
+ D,
88
+ w,
89
+ E,
90
+ w,
91
+ D,
92
+ T,
93
+ E,
94
+ 1,
95
+ E,
96
+ T,
97
+ D,
98
+ T,
99
+ D,
100
+ 1,
101
+ E,
102
+ 1,
103
+ D
104
+ ])
105
+ };
106
+ }
107
+ function t(e, t, n) {
108
+ let r = e.createShader(t);
109
+ if (!r) throw Error("Failed to create shader");
110
+ if (e.shaderSource(r, n), e.compileShader(r), !e.getShaderParameter(r, e.COMPILE_STATUS)) {
111
+ let t = e.getShaderInfoLog(r) || "Unknown shader error";
112
+ throw e.deleteShader(r), Error(t);
113
+ }
114
+ return r;
115
+ }
116
+ function n(e, n, r) {
117
+ let i = t(e, e.VERTEX_SHADER, n), a = t(e, e.FRAGMENT_SHADER, r), o = e.createProgram();
118
+ if (!o) throw Error("Failed to create program");
119
+ if (e.attachShader(o, i), e.attachShader(o, a), e.linkProgram(o), !e.getProgramParameter(o, e.LINK_STATUS)) {
120
+ let t = e.getProgramInfoLog(o) || "Unknown link error";
121
+ throw e.deleteProgram(o), e.deleteShader(i), e.deleteShader(a), Error(t);
122
+ }
123
+ return e.deleteShader(i), e.deleteShader(a), o;
124
+ }
125
+ var r = "#version 300 es\nprecision lowp float;\nin vec2 vUV;\nout vec4 outColor;\nuniform vec2 uResolution;\nuniform float uTime;\nuniform float uBorderWidth;\nuniform float uGlowWidth;\nuniform float uBorderRadius;\nuniform vec3 uColors[4];\nuniform float uGlowExponent;\nuniform float uGlowFactor;\nconst float PI = 3.14159265359;\nconst float TWO_PI = 2.0 * PI;\nconst float HALF_PI = 0.5 * PI;\nconst vec4 startPositions = vec4(0.0, PI, HALF_PI, 1.5 * PI);\nconst vec4 speeds = vec4(-1.9, -1.9, -1.5, 2.1);\nconst vec4 innerRadius = vec4(PI * 0.8, PI * 0.7, PI * 0.3, PI * 0.1);\nconst vec4 outerRadius = vec4(PI * 1.2, PI * 0.9, PI * 0.6, PI * 0.4);\nfloat random(vec2 st) {\nreturn fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123);\n}\nvec2 random2(vec2 st) {\nreturn vec2(random(st), random(st + 1.0));\n}\nfloat aaStep(float edge, float d) {\nfloat width = fwidth(d);\nreturn smoothstep(edge - width * 0.5, edge + width * 0.5, d);\n}\nfloat aaFract(float x) {\nfloat f = fract(x);\nfloat w = fwidth(x);\nfloat smooth_f = f * (1.0 - smoothstep(1.0 - w, 1.0, f));\nreturn smooth_f;\n}\nfloat sdRoundedBox(in vec2 p, in vec2 b, in float r) {\nvec2 q = abs(p) - b + r;\nreturn min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r;\n}\nfloat getInnerGlow(vec2 p, vec2 b, float radius) {\nfloat dist_x = b.x - abs(p.x);\nfloat dist_y = b.y - abs(p.y);\nfloat glow_x = smoothstep(radius, 0.0, dist_x);\nfloat glow_y = smoothstep(radius, 0.0, dist_y);\nreturn 1.0 - (1.0 - glow_x) * (1.0 - glow_y);\n}\nfloat getVignette(vec2 uv) {\nvec2 vignetteUv = uv;\nvignetteUv = vignetteUv * (1.0 - vignetteUv);\nfloat vignette = vignetteUv.x * vignetteUv.y * 25.0;\nvignette = pow(vignette, 0.16);\nvignette = 1.0 - vignette;\nreturn vignette;\n}\nfloat uvToAngle(vec2 uv) {\nvec2 center = vec2(0.5);\nvec2 dir = uv - center;\nreturn atan(dir.y, dir.x) + PI;\n}\nvoid main() {\nvec2 uv = vUV;\nvec2 pos = uv * uResolution;\nvec2 centeredPos = pos - uResolution * 0.5;\nvec2 size = uResolution - uBorderWidth;\nvec2 halfSize = size * 0.5;\nfloat dBorderBox = sdRoundedBox(centeredPos, halfSize, uBorderRadius);\nfloat border = aaStep(0.0, dBorderBox);\nfloat glow = getInnerGlow(centeredPos, halfSize, uGlowWidth);\nfloat vignette = getVignette(uv);\nglow *= vignette;\nfloat posAngle = uvToAngle(uv);\nvec4 lightCenter = mod(startPositions + speeds * uTime, TWO_PI);\nvec4 angleDist = abs(posAngle - lightCenter);\nvec4 disToLight = min(angleDist, TWO_PI - angleDist) / TWO_PI;\nfloat intensityBorder[4];\nintensityBorder[0] = 1.0;\nintensityBorder[1] = smoothstep(0.4, 0.0, disToLight.y);\nintensityBorder[2] = smoothstep(0.4, 0.0, disToLight.z);\nintensityBorder[3] = smoothstep(0.2, 0.0, disToLight.w) * 0.5;\nvec3 borderColor = vec3(0.0);\nfor(int i = 0; i < 4; i++) {\nborderColor = mix(borderColor, uColors[i], intensityBorder[i]);\n}\nborderColor *= 1.1;\nborderColor = clamp(borderColor, 0.0, 1.0);\nfloat intensityGlow[4];\nintensityGlow[0] = smoothstep(0.9, 0.0, disToLight.x);\nintensityGlow[1] = smoothstep(0.7, 0.0, disToLight.y);\nintensityGlow[2] = smoothstep(0.4, 0.0, disToLight.z);\nintensityGlow[3] = smoothstep(0.1, 0.0, disToLight.w) * 0.7;\nvec4 breath = smoothstep(0.0, 1.0, sin(uTime * 1.0 + startPositions * PI) * 0.2 + 0.8);\nvec3 glowColor = vec3(0.0);\nglowColor += uColors[0] * intensityGlow[0] * breath.x;\nglowColor += uColors[1] * intensityGlow[1] * breath.y;\nglowColor += uColors[2] * intensityGlow[2] * breath.z;\nglowColor += uColors[3] * intensityGlow[3] * breath.w * glow;\nglow = pow(glow, uGlowExponent);\nglow *= random(pos + uTime) * 0.1 + 1.0;\nglowColor *= glow * uGlowFactor;\nglowColor = clamp(glowColor, 0.0, 1.0);\nvec3 color = mix(glowColor, borderColor + glowColor * 0.2, border);\nfloat alpha = mix(glow, 1.0, border);\noutColor = vec4(color, alpha);\n}", i = "#version 300 es\nin vec2 aPosition;\nin vec2 aUV;\nout vec2 vUV;\nvoid main() {\nvUV = aUV;\ngl_Position = vec4(aPosition, 0.0, 1.0);\n}", a = [
126
+ "rgb(57, 182, 255)",
127
+ "rgb(189, 69, 251)",
128
+ "rgb(255, 87, 51)",
129
+ "rgb(255, 214, 0)"
130
+ ];
131
+ function o(e) {
132
+ let t = e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
133
+ if (!t) throw Error(`Invalid color format: ${e}`);
134
+ let [, n, r, i] = t;
135
+ return [
136
+ parseInt(n) / 255,
137
+ parseInt(r) / 255,
138
+ parseInt(i) / 255
139
+ ];
140
+ }
141
+ var s = class {
142
+ element;
143
+ canvas;
144
+ options;
145
+ running = !1;
146
+ disposed = !1;
147
+ startTime = 0;
148
+ lastTime = 0;
149
+ rafId = null;
150
+ glr;
151
+ observer;
152
+ constructor(e = {}) {
153
+ this.options = {
154
+ width: e.width ?? 600,
155
+ height: e.height ?? 600,
156
+ ratio: e.ratio ?? window.devicePixelRatio ?? 1,
157
+ borderWidth: e.borderWidth ?? 8,
158
+ glowWidth: e.glowWidth ?? 200,
159
+ borderRadius: e.borderRadius ?? 8,
160
+ mode: e.mode ?? "light",
161
+ ...e
162
+ }, this.canvas = document.createElement("canvas"), this.options.classNames && (this.canvas.className = this.options.classNames), this.options.styles && Object.assign(this.canvas.style, this.options.styles), this.canvas.style.display = "block", this.canvas.style.transformOrigin = "center", this.canvas.style.pointerEvents = "none", this.element = this.canvas, this.setupGL(), this.options.skipGreeting || this.greet();
163
+ }
164
+ start() {
165
+ if (this.disposed) throw Error("Motion instance has been disposed.");
166
+ if (this.running) return;
167
+ if (!this.glr) {
168
+ console.error("WebGL resources are not initialized.");
169
+ return;
170
+ }
171
+ this.running = !0, this.startTime = performance.now(), this.resize(this.options.width ?? 600, this.options.height ?? 600, this.options.ratio), this.glr.gl.viewport(0, 0, this.canvas.width, this.canvas.height), this.glr.gl.useProgram(this.glr.program), this.glr.gl.uniform2f(this.glr.uResolution, this.canvas.width, this.canvas.height), this.checkGLError(this.glr.gl, "start: after initial setup");
172
+ let e = () => {
173
+ if (!this.running || !this.glr) return;
174
+ this.rafId = requestAnimationFrame(e);
175
+ let t = performance.now();
176
+ if (t - this.lastTime < 1e3 / 32) return;
177
+ this.lastTime = t;
178
+ let n = (t - this.startTime) * .001;
179
+ this.render(n);
180
+ };
181
+ this.rafId = requestAnimationFrame(e);
182
+ }
183
+ pause() {
184
+ if (this.disposed) throw Error("Motion instance has been disposed.");
185
+ this.running = !1, this.rafId !== null && cancelAnimationFrame(this.rafId);
186
+ }
187
+ dispose() {
188
+ if (this.disposed) return;
189
+ this.disposed = !0, this.running = !1, this.rafId !== null && cancelAnimationFrame(this.rafId);
190
+ let { gl: e, vao: t, positionBuffer: n, uvBuffer: r, program: i } = this.glr;
191
+ t && e.deleteVertexArray(t), n && e.deleteBuffer(n), r && e.deleteBuffer(r), e.deleteProgram(i), this.observer && this.observer.disconnect(), this.canvas.remove();
192
+ }
193
+ resize(t, n, r) {
194
+ if (this.disposed) throw Error("Motion instance has been disposed.");
195
+ if (this.options.width = t, this.options.height = n, r && (this.options.ratio = r), !this.running) return;
196
+ let { gl: i, program: a, vao: o, positionBuffer: s, uvBuffer: c, uResolution: l } = this.glr, u = r ?? this.options.ratio ?? window.devicePixelRatio ?? 1, d = Math.max(1, Math.floor(t * u)), f = Math.max(1, Math.floor(n * u));
197
+ this.canvas.style.width = `${t}px`, this.canvas.style.height = `${n}px`, (this.canvas.width !== d || this.canvas.height !== f) && (this.canvas.width = d, this.canvas.height = f), i.viewport(0, 0, this.canvas.width, this.canvas.height), this.checkGLError(i, "resize: after viewport setup");
198
+ let { positions: p, uvs: m } = e(this.canvas.width, this.canvas.height, this.options.borderWidth * u, this.options.glowWidth * u);
199
+ i.bindVertexArray(o), i.bindBuffer(i.ARRAY_BUFFER, s), i.bufferData(i.ARRAY_BUFFER, p, i.STATIC_DRAW);
200
+ let h = i.getAttribLocation(a, "aPosition");
201
+ i.enableVertexAttribArray(h), i.vertexAttribPointer(h, 2, i.FLOAT, !1, 0, 0), this.checkGLError(i, "resize: after position buffer update"), i.bindBuffer(i.ARRAY_BUFFER, c), i.bufferData(i.ARRAY_BUFFER, m, i.STATIC_DRAW);
202
+ let g = i.getAttribLocation(a, "aUV");
203
+ i.enableVertexAttribArray(g), i.vertexAttribPointer(g, 2, i.FLOAT, !1, 0, 0), this.checkGLError(i, "resize: after UV buffer update"), i.useProgram(a), i.uniform2f(l, this.canvas.width, this.canvas.height), i.uniform1f(this.glr.uBorderWidth, this.options.borderWidth * u), i.uniform1f(this.glr.uGlowWidth, this.options.glowWidth * u), i.uniform1f(this.glr.uBorderRadius, this.options.borderRadius * u), this.checkGLError(i, "resize: after uniform updates");
204
+ let _ = performance.now();
205
+ this.lastTime = _;
206
+ let v = (_ - this.startTime) * .001;
207
+ this.render(v);
208
+ }
209
+ autoResize(e) {
210
+ this.observer && this.observer.disconnect(), this.observer = new ResizeObserver(() => {
211
+ let t = e.getBoundingClientRect();
212
+ this.resize(t.width, t.height);
213
+ }), this.observer.observe(e);
214
+ }
215
+ fadeIn() {
216
+ if (this.disposed) throw Error("Motion instance has been disposed.");
217
+ return new Promise((e, t) => {
218
+ let n = this.canvas.animate([{
219
+ opacity: 0,
220
+ transform: "scale(1.2)"
221
+ }, {
222
+ opacity: 1,
223
+ transform: "scale(1)"
224
+ }], {
225
+ duration: 300,
226
+ easing: "ease-out",
227
+ fill: "forwards"
228
+ });
229
+ n.onfinish = () => e(), n.oncancel = () => t("canceled");
230
+ });
231
+ }
232
+ fadeOut() {
233
+ if (this.disposed) throw Error("Motion instance has been disposed.");
234
+ return new Promise((e, t) => {
235
+ let n = this.canvas.animate([{
236
+ opacity: 1,
237
+ transform: "scale(1)"
238
+ }, {
239
+ opacity: 0,
240
+ transform: "scale(1.2)"
241
+ }], {
242
+ duration: 300,
243
+ easing: "ease-in",
244
+ fill: "forwards"
245
+ });
246
+ n.onfinish = () => e(), n.oncancel = () => t("canceled");
247
+ });
248
+ }
249
+ checkGLError(e, t) {
250
+ let n = e.getError();
251
+ if (n !== e.NO_ERROR) {
252
+ for (console.group(`🔴 WebGL Error in ${t}`); n !== e.NO_ERROR;) {
253
+ let t = this.getGLErrorName(e, n);
254
+ console.error(`${t} (0x${n.toString(16)})`), n = e.getError();
255
+ }
256
+ console.groupEnd();
257
+ }
258
+ }
259
+ getGLErrorName(e, t) {
260
+ switch (t) {
261
+ case e.INVALID_ENUM: return "INVALID_ENUM";
262
+ case e.INVALID_VALUE: return "INVALID_VALUE";
263
+ case e.INVALID_OPERATION: return "INVALID_OPERATION";
264
+ case e.INVALID_FRAMEBUFFER_OPERATION: return "INVALID_FRAMEBUFFER_OPERATION";
265
+ case e.OUT_OF_MEMORY: return "OUT_OF_MEMORY";
266
+ case e.CONTEXT_LOST_WEBGL: return "CONTEXT_LOST_WEBGL";
267
+ default: return "UNKNOWN_ERROR";
268
+ }
269
+ }
270
+ setupGL() {
271
+ let t = this.canvas.getContext("webgl2", {
272
+ antialias: !1,
273
+ alpha: !0
274
+ });
275
+ if (!t) throw Error("WebGL2 is required but not available.");
276
+ let s = n(t, i, r);
277
+ this.checkGLError(t, "setupGL: after createProgram");
278
+ let c = t.createVertexArray();
279
+ t.bindVertexArray(c), this.checkGLError(t, "setupGL: after VAO creation");
280
+ let { positions: l, uvs: u } = e(this.canvas.width || 2, this.canvas.height || 2, this.options.borderWidth, this.options.glowWidth), d = t.createBuffer();
281
+ t.bindBuffer(t.ARRAY_BUFFER, d), t.bufferData(t.ARRAY_BUFFER, l, t.STATIC_DRAW);
282
+ let f = t.getAttribLocation(s, "aPosition");
283
+ t.enableVertexAttribArray(f), t.vertexAttribPointer(f, 2, t.FLOAT, !1, 0, 0), this.checkGLError(t, "setupGL: after position buffer setup");
284
+ let p = t.createBuffer();
285
+ t.bindBuffer(t.ARRAY_BUFFER, p), t.bufferData(t.ARRAY_BUFFER, u, t.STATIC_DRAW);
286
+ let m = t.getAttribLocation(s, "aUV");
287
+ t.enableVertexAttribArray(m), t.vertexAttribPointer(m, 2, t.FLOAT, !1, 0, 0), this.checkGLError(t, "setupGL: after UV buffer setup");
288
+ let h = t.getUniformLocation(s, "uResolution"), g = t.getUniformLocation(s, "uTime"), _ = t.getUniformLocation(s, "uBorderWidth"), v = t.getUniformLocation(s, "uGlowWidth"), y = t.getUniformLocation(s, "uBorderRadius"), b = t.getUniformLocation(s, "uColors"), x = t.getUniformLocation(s, "uGlowExponent"), S = t.getUniformLocation(s, "uGlowFactor");
289
+ t.useProgram(s), t.uniform1f(_, this.options.borderWidth), t.uniform1f(v, this.options.glowWidth), t.uniform1f(y, this.options.borderRadius), this.options.mode === "dark" ? (t.uniform1f(x, 2), t.uniform1f(S, 1.8)) : (t.uniform1f(x, 1), t.uniform1f(S, 1));
290
+ let C = (this.options.colors || a).map(o);
291
+ for (let e = 0; e < C.length; e++) t.uniform3f(t.getUniformLocation(s, `uColors[${e}]`), ...C[e]);
292
+ this.checkGLError(t, "setupGL: after uniform setup"), t.bindVertexArray(null), t.bindBuffer(t.ARRAY_BUFFER, null), this.glr = {
293
+ gl: t,
294
+ program: s,
295
+ vao: c,
296
+ positionBuffer: d,
297
+ uvBuffer: p,
298
+ uResolution: h,
299
+ uTime: g,
300
+ uBorderWidth: _,
301
+ uGlowWidth: v,
302
+ uBorderRadius: y,
303
+ uColors: b
304
+ };
305
+ }
306
+ render(e) {
307
+ if (!this.glr) return;
308
+ let { gl: t, program: n, vao: r, uTime: i } = this.glr;
309
+ t.useProgram(n), t.bindVertexArray(r), t.uniform1f(i, e), t.disable(t.DEPTH_TEST), t.disable(t.CULL_FACE), t.disable(t.BLEND), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.drawArrays(t.TRIANGLES, 0, 24), this.checkGLError(t, "render: after draw call"), t.bindVertexArray(null);
310
+ }
311
+ greet() {
312
+ console.log("%c🌈 ai-motion 0.4.8 🌈", "background: linear-gradient(90deg, #39b6ff, #bd45fb, #ff5733, #ffd600); color: white; text-shadow: 0 0 2px rgba(0, 0, 0, 0.2); font-weight: bold; font-size: 1em; padding: 2px 12px; border-radius: 6px;");
313
+ }
314
+ };
315
+ (function() {
316
+ try {
317
+ if (typeof document < "u") {
318
+ var e = document.createElement("style");
319
+ e.appendChild(document.createTextNode("._wrapper_1ooyb_1 {\n position: fixed;\n inset: 0;\n z-index: 2147483641; /* 确保在所有元素之上,除了 panel */\n cursor: wait;\n overflow: hidden;\n\n display: none;\n}\n\n._wrapper_1ooyb_1._visible_1ooyb_11 {\n display: block;\n}\n/* AI 光标样式 */\n._cursor_1dgwb_2 {\n position: absolute;\n width: var(--cursor-size, 75px);\n height: var(--cursor-size, 75px);\n pointer-events: none;\n z-index: 10000;\n}\n\n._cursorBorder_1dgwb_10 {\n position: absolute;\n width: 100%;\n height: 100%;\n background: linear-gradient(45deg, rgb(57, 182, 255), rgb(189, 69, 251));\n mask-image: url(\"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20fill='none'%3e%3cg%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='none'%20stroke='%23000000'%20stroke-width='6'%20stroke-miterlimit='10'%20style='stroke:%20light-dark(rgb(0,%200,%200),%20rgb(255,%20255,%20255));'/%3e%3c/g%3e%3c/svg%3e\");\n mask-size: 100% 100%;\n mask-repeat: no-repeat;\n\n transform-origin: center;\n transform: rotate(-135deg) scale(1.2);\n margin-left: -10px;\n margin-top: -18px;\n}\n\n._cursorFilling_1dgwb_25 {\n position: absolute;\n width: 100%;\n height: 100%;\n background: url(\"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%3e%3cdefs%3e%3c/defs%3e%3cg%20xmlns='http://www.w3.org/2000/svg'%20style='filter:%20drop-shadow(light-dark(rgba(0,%200,%200,%200.4),%20rgba(237,%20237,%20237,%200.4))%203px%204px%204px);'%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='%23ffffff'%20stroke='none'%20style='fill:%20%23ffffff;'/%3e%3c/g%3e%3c/svg%3e\");\n background-size: 100% 100%;\n background-repeat: no-repeat;\n\n transform-origin: center;\n transform: rotate(-135deg) scale(1.2);\n margin-left: -10px;\n margin-top: -18px;\n}\n\n._cursorRipple_1dgwb_39 {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n margin-left: -50%;\n margin-top: -50%;\n\n &::after {\n content: '';\n opacity: 0;\n position: absolute;\n inset: 0;\n border: 4px solid rgba(57, 182, 255, 1);\n border-radius: 50%;\n }\n}\n\n._cursor_1dgwb_2._clicking_1dgwb_57 ._cursorRipple_1dgwb_39::after {\n animation: _cursor-ripple_1dgwb_1 300ms ease-out forwards;\n}\n\n@keyframes _cursor-ripple_1dgwb_1 {\n 0% {\n transform: scale(0);\n opacity: 1;\n }\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n}")), document.head.appendChild(e);
320
+ }
321
+ } catch (e) {
322
+ console.error("vite-plugin-css-injected-by-js", e);
323
+ }
324
+ })(), (function() {
325
+ try {
326
+ if (typeof document < "u") {
327
+ var e = document.createElement("style");
328
+ e.appendChild(document.createTextNode("._wrapper_1ooyb_1 {\n position: fixed;\n inset: 0;\n z-index: 2147483641; /* 确保在所有元素之上,除了 panel */\n cursor: wait;\n overflow: hidden;\n\n display: none;\n}\n\n._wrapper_1ooyb_1._visible_1ooyb_11 {\n display: block;\n}\n/* AI 光标样式 */\n._cursor_1dgwb_2 {\n position: absolute;\n width: var(--cursor-size, 75px);\n height: var(--cursor-size, 75px);\n pointer-events: none;\n z-index: 10000;\n}\n\n._cursorBorder_1dgwb_10 {\n position: absolute;\n width: 100%;\n height: 100%;\n background: linear-gradient(45deg, rgb(57, 182, 255), rgb(189, 69, 251));\n mask-image: url(\"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20fill='none'%3e%3cg%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='none'%20stroke='%23000000'%20stroke-width='6'%20stroke-miterlimit='10'%20style='stroke:%20light-dark(rgb(0,%200,%200),%20rgb(255,%20255,%20255));'/%3e%3c/g%3e%3c/svg%3e\");\n mask-size: 100% 100%;\n mask-repeat: no-repeat;\n\n transform-origin: center;\n transform: rotate(-135deg) scale(1.2);\n margin-left: -10px;\n margin-top: -18px;\n}\n\n._cursorFilling_1dgwb_25 {\n position: absolute;\n width: 100%;\n height: 100%;\n background: url(\"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%3e%3cdefs%3e%3c/defs%3e%3cg%20xmlns='http://www.w3.org/2000/svg'%20style='filter:%20drop-shadow(light-dark(rgba(0,%200,%200,%200.4),%20rgba(237,%20237,%20237,%200.4))%203px%204px%204px);'%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='%23ffffff'%20stroke='none'%20style='fill:%20%23ffffff;'/%3e%3c/g%3e%3c/svg%3e\");\n background-size: 100% 100%;\n background-repeat: no-repeat;\n\n transform-origin: center;\n transform: rotate(-135deg) scale(1.2);\n margin-left: -10px;\n margin-top: -18px;\n}\n\n._cursorRipple_1dgwb_39 {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n margin-left: -50%;\n margin-top: -50%;\n\n &::after {\n content: '';\n opacity: 0;\n position: absolute;\n inset: 0;\n border: 4px solid rgba(57, 182, 255, 1);\n border-radius: 50%;\n }\n}\n\n._cursor_1dgwb_2._clicking_1dgwb_57 ._cursorRipple_1dgwb_39::after {\n animation: _cursor-ripple_1dgwb_1 300ms ease-out forwards;\n}\n\n@keyframes _cursor-ripple_1dgwb_1 {\n 0% {\n transform: scale(0);\n opacity: 1;\n }\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n}")), document.head.appendChild(e);
329
+ }
330
+ } catch (e) {
331
+ console.error("vite-plugin-css-injected-by-js", e);
332
+ }
333
+ })();
334
+ function c() {
335
+ let e = [
336
+ "dark",
337
+ "dark-mode",
338
+ "theme-dark",
339
+ "night",
340
+ "night-mode"
341
+ ], t = document.documentElement, n = document.body || document.documentElement;
342
+ for (let r of e) if (t.classList.contains(r) || n?.classList.contains(r)) return !0;
343
+ return !!t.getAttribute("data-theme")?.toLowerCase().includes("dark");
344
+ }
345
+ function l(e) {
346
+ let t = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(e);
347
+ return t ? {
348
+ r: parseInt(t[1]),
349
+ g: parseInt(t[2]),
350
+ b: parseInt(t[3])
351
+ } : null;
352
+ }
353
+ function u(e, t = 128) {
354
+ if (!e || e === "transparent" || e.startsWith("rgba(0, 0, 0, 0)")) return !1;
355
+ let n = l(e);
356
+ return n ? .299 * n.r + .587 * n.g + .114 * n.b < t : !1;
357
+ }
358
+ function d() {
359
+ let e = window.getComputedStyle(document.documentElement), t = window.getComputedStyle(document.body || document.documentElement), n = e.backgroundColor, r = t.backgroundColor;
360
+ return u(r) ? !0 : r === "transparent" || r.startsWith("rgba(0, 0, 0, 0)") ? u(n) : !1;
361
+ }
362
+ function f() {
363
+ try {
364
+ return !!(c() || d());
365
+ } catch (e) {
366
+ return console.warn("Error determining if page is dark:", e), !1;
367
+ }
368
+ }
369
+ var p = {
370
+ wrapper: "_wrapper_1ooyb_1",
371
+ visible: "_visible_1ooyb_11"
372
+ }, m = {
373
+ cursor: "_cursor_1dgwb_2",
374
+ cursorBorder: "_cursorBorder_1dgwb_10",
375
+ cursorFilling: "_cursorFilling_1dgwb_25",
376
+ cursorRipple: "_cursorRipple_1dgwb_39",
377
+ clicking: "_clicking_1dgwb_57",
378
+ "cursor-ripple": "_cursor-ripple_1dgwb_1"
379
+ }, h = class extends EventTarget {
380
+ shown = !1;
381
+ wrapper = document.createElement("div");
382
+ motion = null;
383
+ #e = !1;
384
+ #t = document.createElement("div");
385
+ #n = 0;
386
+ #r = 0;
387
+ #i = 0;
388
+ #a = 0;
389
+ constructor() {
390
+ super(), this.wrapper.id = "page-agent-runtime_simulator-mask", this.wrapper.className = p.wrapper, this.wrapper.setAttribute("data-browser-use-ignore", "true"), this.wrapper.setAttribute("data-page-agent-ignore", "true");
391
+ try {
392
+ let e = new s({
393
+ mode: f() ? "dark" : "light",
394
+ styles: {
395
+ position: "absolute",
396
+ inset: "0"
397
+ }
398
+ });
399
+ this.motion = e, this.wrapper.appendChild(e.element), e.autoResize(this.wrapper);
400
+ } catch (e) {
401
+ console.warn("[SimulatorMask] Motion overlay unavailable:", e);
402
+ }
403
+ this.wrapper.addEventListener("click", (e) => {
404
+ e.stopPropagation(), e.preventDefault();
405
+ }), this.wrapper.addEventListener("mousedown", (e) => {
406
+ e.stopPropagation(), e.preventDefault();
407
+ }), this.wrapper.addEventListener("mouseup", (e) => {
408
+ e.stopPropagation(), e.preventDefault();
409
+ }), this.wrapper.addEventListener("mousemove", (e) => {
410
+ e.stopPropagation(), e.preventDefault();
411
+ }), this.wrapper.addEventListener("wheel", (e) => {
412
+ e.stopPropagation(), e.preventDefault();
413
+ }), this.wrapper.addEventListener("keydown", (e) => {
414
+ e.stopPropagation(), e.preventDefault();
415
+ }), this.wrapper.addEventListener("keyup", (e) => {
416
+ e.stopPropagation(), e.preventDefault();
417
+ }), this.#o(), document.body.appendChild(this.wrapper), this.#s();
418
+ let e = (e) => {
419
+ let { x: t, y: n } = e.detail;
420
+ this.setCursorPosition(t, n);
421
+ }, t = () => {
422
+ this.triggerClickAnimation();
423
+ }, n = () => {
424
+ this.wrapper.style.pointerEvents = "none";
425
+ }, r = () => {
426
+ this.wrapper.style.pointerEvents = "auto";
427
+ };
428
+ window.addEventListener("PageAgent::MovePointerTo", e), window.addEventListener("PageAgent::ClickPointer", t), window.addEventListener("PageAgent::EnablePassThrough", n), window.addEventListener("PageAgent::DisablePassThrough", r), this.addEventListener("dispose", () => {
429
+ window.removeEventListener("PageAgent::MovePointerTo", e), window.removeEventListener("PageAgent::ClickPointer", t), window.removeEventListener("PageAgent::EnablePassThrough", n), window.removeEventListener("PageAgent::DisablePassThrough", r);
430
+ });
431
+ }
432
+ #o() {
433
+ this.#t.className = m.cursor;
434
+ let e = document.createElement("div");
435
+ e.className = m.cursorRipple, this.#t.appendChild(e);
436
+ let t = document.createElement("div");
437
+ t.className = m.cursorFilling, this.#t.appendChild(t);
438
+ let n = document.createElement("div");
439
+ n.className = m.cursorBorder, this.#t.appendChild(n), this.wrapper.appendChild(this.#t);
440
+ }
441
+ #s() {
442
+ if (this.#e) return;
443
+ let e = this.#n + (this.#i - this.#n) * .2, t = this.#r + (this.#a - this.#r) * .2, n = Math.abs(e - this.#i);
444
+ n > 0 && (n < 2 ? this.#n = this.#i : this.#n = e, this.#t.style.left = `${this.#n}px`);
445
+ let r = Math.abs(t - this.#a);
446
+ r > 0 && (r < 2 ? this.#r = this.#a : this.#r = t, this.#t.style.top = `${this.#r}px`), requestAnimationFrame(() => this.#s());
447
+ }
448
+ setCursorPosition(e, t) {
449
+ this.#e || (this.#i = e, this.#a = t);
450
+ }
451
+ triggerClickAnimation() {
452
+ this.#e || (this.#t.classList.remove(m.clicking), this.#t.offsetHeight, this.#t.classList.add(m.clicking));
453
+ }
454
+ show() {
455
+ this.shown || this.#e || (this.shown = !0, this.motion?.start(), this.motion?.fadeIn(), this.wrapper.classList.add(p.visible), this.#n = window.innerWidth / 2, this.#r = window.innerHeight / 2, this.#i = this.#n, this.#a = this.#r, this.#t.style.left = `${this.#n}px`, this.#t.style.top = `${this.#r}px`);
456
+ }
457
+ hide() {
458
+ !this.shown || this.#e || (this.shown = !1, this.motion?.fadeOut(), this.motion?.pause(), this.#t.classList.remove(m.clicking), setTimeout(() => {
459
+ this.wrapper.classList.remove(p.visible);
460
+ }, 800));
461
+ }
462
+ dispose() {
463
+ this.#e = !0, console.log("dispose SimulatorMask"), this.motion?.dispose(), this.wrapper.remove(), this.dispatchEvent(new Event("dispose"));
464
+ }
465
+ };
466
+ //#endregion
467
+ export { h as SimulatorMask };