omnix-chat 2.0.0 → 2.0.1

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.
@@ -1,494 +1,663 @@
1
1
  import "./chunk-C-6Xjtra.js";
2
2
  import { t as e } from "./defineProperty-DDzGndnJ.js";
3
3
  import { a as t, i as n, n as r, r as i, t as a } from "./classPrivateFieldSet2-DmVphaHw.js";
4
- //#region node_modules/.pnpm/ai-motion@0.4.8/node_modules/ai-motion/build/Motion.js
5
- function computeBorderGeometry(e, t, n, r) {
6
- 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)), toClipX = (t) => t / e * 2 - 1, toClipY = (e) => e / t * 2 - 1, c = e, l = t, u = o, d = e - o, f = s, p = t - s, m = toClipX(0), h = toClipX(c), g = toClipY(0), _ = toClipY(l), v = toClipX(u), y = toClipX(d), b = toClipY(f), x = toClipY(p), S = o / e, C = 1 - o / e, w = s / t, T = 1 - s / t;
7
- return {
8
- positions: new Float32Array([
9
- m,
10
- g,
11
- h,
12
- g,
13
- m,
14
- b,
15
- m,
16
- b,
17
- h,
18
- g,
19
- h,
20
- b,
21
- m,
22
- x,
23
- h,
24
- x,
25
- m,
26
- _,
27
- m,
28
- _,
29
- h,
30
- x,
31
- h,
32
- _,
33
- m,
34
- b,
35
- v,
36
- b,
37
- m,
38
- x,
39
- m,
40
- x,
41
- v,
42
- b,
43
- v,
44
- x,
45
- y,
46
- b,
47
- h,
48
- b,
49
- y,
50
- x,
51
- y,
52
- x,
53
- h,
54
- b,
55
- h,
56
- x
57
- ]),
58
- uvs: new Float32Array([
59
- 0,
60
- 0,
61
- 1,
62
- 0,
63
- 0,
64
- w,
65
- 0,
66
- w,
67
- 1,
68
- 0,
69
- 1,
70
- w,
71
- 0,
72
- T,
73
- 1,
74
- T,
75
- 0,
76
- 1,
77
- 0,
78
- 1,
79
- 1,
80
- T,
81
- 1,
82
- 1,
83
- 0,
84
- w,
85
- S,
86
- w,
87
- 0,
88
- T,
89
- 0,
90
- T,
91
- S,
92
- w,
93
- S,
94
- T,
95
- C,
96
- w,
97
- 1,
98
- w,
99
- C,
100
- T,
101
- C,
102
- T,
103
- 1,
104
- w,
105
- 1,
106
- T
107
- ])
108
- };
4
+ function computeBorderGeometry(e2, t2, n2, r2) {
5
+ let i2 = Math.max(1, Math.min(e2, t2)), a2 = Math.min(Math.min(n2, 20) + r2, i2), o2 = Math.min(a2, Math.floor(e2 / 2)), s2 = Math.min(a2, Math.floor(t2 / 2)), toClipX = (t3) => t3 / e2 * 2 - 1, toClipY = (e3) => e3 / t2 * 2 - 1, c2 = e2, l2 = t2, u2 = o2, d2 = e2 - o2, f2 = s2, p2 = t2 - s2, m2 = toClipX(0), h2 = toClipX(c2), g2 = toClipY(0), _2 = toClipY(l2), v2 = toClipX(u2), y = toClipX(d2), b = toClipY(f2), x = toClipY(p2), S = o2 / e2, C = 1 - o2 / e2, w = s2 / t2, T = 1 - s2 / t2;
6
+ return {
7
+ positions: new Float32Array([
8
+ m2,
9
+ g2,
10
+ h2,
11
+ g2,
12
+ m2,
13
+ b,
14
+ m2,
15
+ b,
16
+ h2,
17
+ g2,
18
+ h2,
19
+ b,
20
+ m2,
21
+ x,
22
+ h2,
23
+ x,
24
+ m2,
25
+ _2,
26
+ m2,
27
+ _2,
28
+ h2,
29
+ x,
30
+ h2,
31
+ _2,
32
+ m2,
33
+ b,
34
+ v2,
35
+ b,
36
+ m2,
37
+ x,
38
+ m2,
39
+ x,
40
+ v2,
41
+ b,
42
+ v2,
43
+ x,
44
+ y,
45
+ b,
46
+ h2,
47
+ b,
48
+ y,
49
+ x,
50
+ y,
51
+ x,
52
+ h2,
53
+ b,
54
+ h2,
55
+ x
56
+ ]),
57
+ uvs: new Float32Array([
58
+ 0,
59
+ 0,
60
+ 1,
61
+ 0,
62
+ 0,
63
+ w,
64
+ 0,
65
+ w,
66
+ 1,
67
+ 0,
68
+ 1,
69
+ w,
70
+ 0,
71
+ T,
72
+ 1,
73
+ T,
74
+ 0,
75
+ 1,
76
+ 0,
77
+ 1,
78
+ 1,
79
+ T,
80
+ 1,
81
+ 1,
82
+ 0,
83
+ w,
84
+ S,
85
+ w,
86
+ 0,
87
+ T,
88
+ 0,
89
+ T,
90
+ S,
91
+ w,
92
+ S,
93
+ T,
94
+ C,
95
+ w,
96
+ 1,
97
+ w,
98
+ C,
99
+ T,
100
+ C,
101
+ T,
102
+ 1,
103
+ w,
104
+ 1,
105
+ T
106
+ ])
107
+ };
109
108
  }
110
- function compileShader(e, t, n) {
111
- let r = e.createShader(t);
112
- if (!r) throw Error("Failed to create shader");
113
- if (e.shaderSource(r, n), e.compileShader(r), !e.getShaderParameter(r, e.COMPILE_STATUS)) {
114
- let t = e.getShaderInfoLog(r) || "Unknown shader error";
115
- throw e.deleteShader(r), Error(t);
116
- }
117
- return r;
109
+ function compileShader(e2, t2, n2) {
110
+ let r2 = e2.createShader(t2);
111
+ if (!r2) throw Error("Failed to create shader");
112
+ if (e2.shaderSource(r2, n2), e2.compileShader(r2), !e2.getShaderParameter(r2, e2.COMPILE_STATUS)) {
113
+ let t3 = e2.getShaderInfoLog(r2) || "Unknown shader error";
114
+ throw e2.deleteShader(r2), Error(t3);
115
+ }
116
+ return r2;
118
117
  }
119
- function createProgram(e, t, n) {
120
- let r = compileShader(e, e.VERTEX_SHADER, t), i = compileShader(e, e.FRAGMENT_SHADER, n), a = e.createProgram();
121
- if (!a) throw Error("Failed to create program");
122
- if (e.attachShader(a, r), e.attachShader(a, i), e.linkProgram(a), !e.getProgramParameter(a, e.LINK_STATUS)) {
123
- let t = e.getProgramInfoLog(a) || "Unknown link error";
124
- throw e.deleteProgram(a), e.deleteShader(r), e.deleteShader(i), Error(t);
125
- }
126
- return e.deleteShader(r), e.deleteShader(i), a;
118
+ function createProgram(e2, t2, n2) {
119
+ let r2 = compileShader(e2, e2.VERTEX_SHADER, t2), i2 = compileShader(e2, e2.FRAGMENT_SHADER, n2), a2 = e2.createProgram();
120
+ if (!a2) throw Error("Failed to create program");
121
+ if (e2.attachShader(a2, r2), e2.attachShader(a2, i2), e2.linkProgram(a2), !e2.getProgramParameter(a2, e2.LINK_STATUS)) {
122
+ let t3 = e2.getProgramInfoLog(a2) || "Unknown link error";
123
+ throw e2.deleteProgram(a2), e2.deleteShader(r2), e2.deleteShader(i2), Error(t3);
124
+ }
125
+ return e2.deleteShader(r2), e2.deleteShader(i2), a2;
127
126
  }
128
127
  var o = "#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}", s = "#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}", c = [
129
- "rgb(57, 182, 255)",
130
- "rgb(189, 69, 251)",
131
- "rgb(255, 87, 51)",
132
- "rgb(255, 214, 0)"
128
+ "rgb(57, 182, 255)",
129
+ "rgb(189, 69, 251)",
130
+ "rgb(255, 87, 51)",
131
+ "rgb(255, 214, 0)"
133
132
  ];
134
- function parseColor(e) {
135
- let t = e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
136
- if (!t) throw Error(`Invalid color format: ${e}`);
137
- let [, n, r, i] = t;
138
- return [
139
- parseInt(n) / 255,
140
- parseInt(r) / 255,
141
- parseInt(i) / 255
142
- ];
133
+ function parseColor(e2) {
134
+ let t2 = e2.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
135
+ if (!t2) throw Error(`Invalid color format: ${e2}`);
136
+ let [, n2, r2, i2] = t2;
137
+ return [
138
+ parseInt(n2) / 255,
139
+ parseInt(r2) / 255,
140
+ parseInt(i2) / 255
141
+ ];
143
142
  }
144
143
  var Motion = class {
145
- constructor(t = {}) {
146
- e(this, "element", void 0), e(this, "canvas", void 0), e(this, "options", void 0), e(this, "running", !1), e(this, "disposed", !1), e(this, "startTime", 0), e(this, "lastTime", 0), e(this, "rafId", null), e(this, "glr", void 0), e(this, "observer", void 0), this.options = {
147
- width: t.width ?? 600,
148
- height: t.height ?? 600,
149
- ratio: t.ratio ?? window.devicePixelRatio ?? 1,
150
- borderWidth: t.borderWidth ?? 8,
151
- glowWidth: t.glowWidth ?? 200,
152
- borderRadius: t.borderRadius ?? 8,
153
- mode: t.mode ?? "light",
154
- ...t
155
- }, 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();
156
- }
157
- start() {
158
- if (this.disposed) throw Error("Motion instance has been disposed.");
159
- if (this.running) return;
160
- if (!this.glr) {
161
- console.error("WebGL resources are not initialized.");
162
- return;
163
- }
164
- 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");
165
- let loop = () => {
166
- if (!this.running || !this.glr) return;
167
- this.rafId = requestAnimationFrame(loop);
168
- let e = performance.now();
169
- if (e - this.lastTime < 1e3 / 32) return;
170
- this.lastTime = e;
171
- let t = (e - this.startTime) * .001;
172
- this.render(t);
173
- };
174
- this.rafId = requestAnimationFrame(loop);
175
- }
176
- pause() {
177
- if (this.disposed) throw Error("Motion instance has been disposed.");
178
- this.running = !1, this.rafId !== null && cancelAnimationFrame(this.rafId);
179
- }
180
- dispose() {
181
- if (this.disposed) return;
182
- this.disposed = !0, this.running = !1, this.rafId !== null && cancelAnimationFrame(this.rafId);
183
- let { gl: e, vao: t, positionBuffer: n, uvBuffer: r, program: i } = this.glr;
184
- t && e.deleteVertexArray(t), n && e.deleteBuffer(n), r && e.deleteBuffer(r), e.deleteProgram(i), this.observer && this.observer.disconnect(), this.canvas.remove();
185
- }
186
- resize(e, t, n) {
187
- if (this.disposed) throw Error("Motion instance has been disposed.");
188
- if (this.options.width = e, this.options.height = t, n && (this.options.ratio = n), !this.running) return;
189
- let { gl: r, program: i, vao: a, positionBuffer: o, uvBuffer: s, uResolution: c } = this.glr, l = n ?? this.options.ratio ?? window.devicePixelRatio ?? 1, u = Math.max(1, Math.floor(e * l)), d = Math.max(1, Math.floor(t * l));
190
- this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`, (this.canvas.width !== u || this.canvas.height !== d) && (this.canvas.width = u, this.canvas.height = d), r.viewport(0, 0, this.canvas.width, this.canvas.height), this.checkGLError(r, "resize: after viewport setup");
191
- let { positions: f, uvs: p } = computeBorderGeometry(this.canvas.width, this.canvas.height, this.options.borderWidth * l, this.options.glowWidth * l);
192
- r.bindVertexArray(a), r.bindBuffer(r.ARRAY_BUFFER, o), r.bufferData(r.ARRAY_BUFFER, f, r.STATIC_DRAW);
193
- let m = r.getAttribLocation(i, "aPosition");
194
- r.enableVertexAttribArray(m), r.vertexAttribPointer(m, 2, r.FLOAT, !1, 0, 0), this.checkGLError(r, "resize: after position buffer update"), r.bindBuffer(r.ARRAY_BUFFER, s), r.bufferData(r.ARRAY_BUFFER, p, r.STATIC_DRAW);
195
- let h = r.getAttribLocation(i, "aUV");
196
- r.enableVertexAttribArray(h), r.vertexAttribPointer(h, 2, r.FLOAT, !1, 0, 0), this.checkGLError(r, "resize: after UV buffer update"), r.useProgram(i), r.uniform2f(c, this.canvas.width, this.canvas.height), r.uniform1f(this.glr.uBorderWidth, this.options.borderWidth * l), r.uniform1f(this.glr.uGlowWidth, this.options.glowWidth * l), r.uniform1f(this.glr.uBorderRadius, this.options.borderRadius * l), this.checkGLError(r, "resize: after uniform updates");
197
- let g = performance.now();
198
- this.lastTime = g;
199
- let _ = (g - this.startTime) * .001;
200
- this.render(_);
201
- }
202
- autoResize(e) {
203
- this.observer && this.observer.disconnect(), this.observer = new ResizeObserver(() => {
204
- let t = e.getBoundingClientRect();
205
- this.resize(t.width, t.height);
206
- }), this.observer.observe(e);
207
- }
208
- fadeIn() {
209
- if (this.disposed) throw Error("Motion instance has been disposed.");
210
- return new Promise((e, t) => {
211
- let n = this.canvas.animate([{
212
- opacity: 0,
213
- transform: "scale(1.2)"
214
- }, {
215
- opacity: 1,
216
- transform: "scale(1)"
217
- }], {
218
- duration: 300,
219
- easing: "ease-out",
220
- fill: "forwards"
221
- });
222
- n.onfinish = () => e(), n.oncancel = () => t("canceled");
223
- });
224
- }
225
- fadeOut() {
226
- if (this.disposed) throw Error("Motion instance has been disposed.");
227
- return new Promise((e, t) => {
228
- let n = this.canvas.animate([{
229
- opacity: 1,
230
- transform: "scale(1)"
231
- }, {
232
- opacity: 0,
233
- transform: "scale(1.2)"
234
- }], {
235
- duration: 300,
236
- easing: "ease-in",
237
- fill: "forwards"
238
- });
239
- n.onfinish = () => e(), n.oncancel = () => t("canceled");
240
- });
241
- }
242
- checkGLError(e, t) {
243
- let n = e.getError();
244
- if (n !== e.NO_ERROR) {
245
- for (console.group(`🔴 WebGL Error in ${t}`); n !== e.NO_ERROR;) {
246
- let t = this.getGLErrorName(e, n);
247
- console.error(`${t} (0x${n.toString(16)})`), n = e.getError();
248
- }
249
- console.groupEnd();
250
- }
251
- }
252
- getGLErrorName(e, t) {
253
- switch (t) {
254
- case e.INVALID_ENUM: return "INVALID_ENUM";
255
- case e.INVALID_VALUE: return "INVALID_VALUE";
256
- case e.INVALID_OPERATION: return "INVALID_OPERATION";
257
- case e.INVALID_FRAMEBUFFER_OPERATION: return "INVALID_FRAMEBUFFER_OPERATION";
258
- case e.OUT_OF_MEMORY: return "OUT_OF_MEMORY";
259
- case e.CONTEXT_LOST_WEBGL: return "CONTEXT_LOST_WEBGL";
260
- default: return "UNKNOWN_ERROR";
261
- }
144
+ constructor(t2 = {}) {
145
+ e(this, "element", void 0), e(this, "canvas", void 0), e(this, "options", void 0), e(this, "running", false), e(this, "disposed", false), e(this, "startTime", 0), e(this, "lastTime", 0), e(this, "rafId", null), e(this, "glr", void 0), e(this, "observer", void 0), this.options = {
146
+ width: t2.width ?? 600,
147
+ height: t2.height ?? 600,
148
+ ratio: t2.ratio ?? window.devicePixelRatio ?? 1,
149
+ borderWidth: t2.borderWidth ?? 8,
150
+ glowWidth: t2.glowWidth ?? 200,
151
+ borderRadius: t2.borderRadius ?? 8,
152
+ mode: t2.mode ?? "light",
153
+ ...t2
154
+ }, 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();
155
+ }
156
+ start() {
157
+ if (this.disposed) throw Error("Motion instance has been disposed.");
158
+ if (this.running) return;
159
+ if (!this.glr) {
160
+ console.error("WebGL resources are not initialized.");
161
+ return;
162
+ }
163
+ this.running = true, 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");
164
+ let loop = () => {
165
+ if (!this.running || !this.glr) return;
166
+ this.rafId = requestAnimationFrame(loop);
167
+ let e2 = performance.now();
168
+ if (e2 - this.lastTime < 1e3 / 32) return;
169
+ this.lastTime = e2;
170
+ let t2 = (e2 - this.startTime) * 1e-3;
171
+ this.render(t2);
172
+ };
173
+ this.rafId = requestAnimationFrame(loop);
174
+ }
175
+ pause() {
176
+ if (this.disposed) throw Error("Motion instance has been disposed.");
177
+ this.running = false, this.rafId !== null && cancelAnimationFrame(this.rafId);
178
+ }
179
+ dispose() {
180
+ if (this.disposed) return;
181
+ this.disposed = true, this.running = false, this.rafId !== null && cancelAnimationFrame(this.rafId);
182
+ let { gl: e2, vao: t2, positionBuffer: n2, uvBuffer: r2, program: i2 } = this.glr;
183
+ t2 && e2.deleteVertexArray(t2), n2 && e2.deleteBuffer(n2), r2 && e2.deleteBuffer(r2), e2.deleteProgram(i2), this.observer && this.observer.disconnect(), this.canvas.remove();
184
+ }
185
+ resize(e2, t2, n2) {
186
+ if (this.disposed) throw Error("Motion instance has been disposed.");
187
+ if (this.options.width = e2, this.options.height = t2, n2 && (this.options.ratio = n2), !this.running) return;
188
+ let { gl: r2, program: i2, vao: a2, positionBuffer: o2, uvBuffer: s2, uResolution: c2 } = this.glr, l2 = n2 ?? this.options.ratio ?? window.devicePixelRatio ?? 1, u2 = Math.max(1, Math.floor(e2 * l2)), d2 = Math.max(1, Math.floor(t2 * l2));
189
+ this.canvas.style.width = `${e2}px`, this.canvas.style.height = `${t2}px`, (this.canvas.width !== u2 || this.canvas.height !== d2) && (this.canvas.width = u2, this.canvas.height = d2), r2.viewport(0, 0, this.canvas.width, this.canvas.height), this.checkGLError(r2, "resize: after viewport setup");
190
+ let { positions: f2, uvs: p2 } = computeBorderGeometry(this.canvas.width, this.canvas.height, this.options.borderWidth * l2, this.options.glowWidth * l2);
191
+ r2.bindVertexArray(a2), r2.bindBuffer(r2.ARRAY_BUFFER, o2), r2.bufferData(r2.ARRAY_BUFFER, f2, r2.STATIC_DRAW);
192
+ let m2 = r2.getAttribLocation(i2, "aPosition");
193
+ r2.enableVertexAttribArray(m2), r2.vertexAttribPointer(m2, 2, r2.FLOAT, false, 0, 0), this.checkGLError(r2, "resize: after position buffer update"), r2.bindBuffer(r2.ARRAY_BUFFER, s2), r2.bufferData(r2.ARRAY_BUFFER, p2, r2.STATIC_DRAW);
194
+ let h2 = r2.getAttribLocation(i2, "aUV");
195
+ r2.enableVertexAttribArray(h2), r2.vertexAttribPointer(h2, 2, r2.FLOAT, false, 0, 0), this.checkGLError(r2, "resize: after UV buffer update"), r2.useProgram(i2), r2.uniform2f(c2, this.canvas.width, this.canvas.height), r2.uniform1f(this.glr.uBorderWidth, this.options.borderWidth * l2), r2.uniform1f(this.glr.uGlowWidth, this.options.glowWidth * l2), r2.uniform1f(this.glr.uBorderRadius, this.options.borderRadius * l2), this.checkGLError(r2, "resize: after uniform updates");
196
+ let g2 = performance.now();
197
+ this.lastTime = g2;
198
+ let _2 = (g2 - this.startTime) * 1e-3;
199
+ this.render(_2);
200
+ }
201
+ autoResize(e2) {
202
+ this.observer && this.observer.disconnect(), this.observer = new ResizeObserver(() => {
203
+ let t2 = e2.getBoundingClientRect();
204
+ this.resize(t2.width, t2.height);
205
+ }), this.observer.observe(e2);
206
+ }
207
+ fadeIn() {
208
+ if (this.disposed) throw Error("Motion instance has been disposed.");
209
+ return new Promise((e2, t2) => {
210
+ let n2 = this.canvas.animate([{
211
+ opacity: 0,
212
+ transform: "scale(1.2)"
213
+ }, {
214
+ opacity: 1,
215
+ transform: "scale(1)"
216
+ }], {
217
+ duration: 300,
218
+ easing: "ease-out",
219
+ fill: "forwards"
220
+ });
221
+ n2.onfinish = () => e2(), n2.oncancel = () => t2("canceled");
222
+ });
223
+ }
224
+ fadeOut() {
225
+ if (this.disposed) throw Error("Motion instance has been disposed.");
226
+ return new Promise((e2, t2) => {
227
+ let n2 = this.canvas.animate([{
228
+ opacity: 1,
229
+ transform: "scale(1)"
230
+ }, {
231
+ opacity: 0,
232
+ transform: "scale(1.2)"
233
+ }], {
234
+ duration: 300,
235
+ easing: "ease-in",
236
+ fill: "forwards"
237
+ });
238
+ n2.onfinish = () => e2(), n2.oncancel = () => t2("canceled");
239
+ });
240
+ }
241
+ checkGLError(e2, t2) {
242
+ let n2 = e2.getError();
243
+ if (n2 !== e2.NO_ERROR) {
244
+ for (console.group(`\u{1F534} WebGL Error in ${t2}`); n2 !== e2.NO_ERROR; ) {
245
+ let t3 = this.getGLErrorName(e2, n2);
246
+ console.error(`${t3} (0x${n2.toString(16)})`), n2 = e2.getError();
247
+ }
248
+ console.groupEnd();
249
+ }
250
+ }
251
+ getGLErrorName(e2, t2) {
252
+ switch (t2) {
253
+ case e2.INVALID_ENUM:
254
+ return "INVALID_ENUM";
255
+ case e2.INVALID_VALUE:
256
+ return "INVALID_VALUE";
257
+ case e2.INVALID_OPERATION:
258
+ return "INVALID_OPERATION";
259
+ case e2.INVALID_FRAMEBUFFER_OPERATION:
260
+ return "INVALID_FRAMEBUFFER_OPERATION";
261
+ case e2.OUT_OF_MEMORY:
262
+ return "OUT_OF_MEMORY";
263
+ case e2.CONTEXT_LOST_WEBGL:
264
+ return "CONTEXT_LOST_WEBGL";
265
+ default:
266
+ return "UNKNOWN_ERROR";
267
+ }
268
+ }
269
+ setupGL() {
270
+ let e2 = this.canvas.getContext("webgl2", {
271
+ antialias: false,
272
+ alpha: true
273
+ });
274
+ if (!e2) throw Error("WebGL2 is required but not available.");
275
+ let t2 = createProgram(e2, s, o);
276
+ this.checkGLError(e2, "setupGL: after createProgram");
277
+ let n2 = e2.createVertexArray();
278
+ e2.bindVertexArray(n2), this.checkGLError(e2, "setupGL: after VAO creation");
279
+ let { positions: r2, uvs: i2 } = computeBorderGeometry(this.canvas.width || 2, this.canvas.height || 2, this.options.borderWidth, this.options.glowWidth), a2 = e2.createBuffer();
280
+ e2.bindBuffer(e2.ARRAY_BUFFER, a2), e2.bufferData(e2.ARRAY_BUFFER, r2, e2.STATIC_DRAW);
281
+ let l2 = e2.getAttribLocation(t2, "aPosition");
282
+ e2.enableVertexAttribArray(l2), e2.vertexAttribPointer(l2, 2, e2.FLOAT, false, 0, 0), this.checkGLError(e2, "setupGL: after position buffer setup");
283
+ let u2 = e2.createBuffer();
284
+ e2.bindBuffer(e2.ARRAY_BUFFER, u2), e2.bufferData(e2.ARRAY_BUFFER, i2, e2.STATIC_DRAW);
285
+ let d2 = e2.getAttribLocation(t2, "aUV");
286
+ e2.enableVertexAttribArray(d2), e2.vertexAttribPointer(d2, 2, e2.FLOAT, false, 0, 0), this.checkGLError(e2, "setupGL: after UV buffer setup");
287
+ let f2 = e2.getUniformLocation(t2, "uResolution"), p2 = e2.getUniformLocation(t2, "uTime"), m2 = e2.getUniformLocation(t2, "uBorderWidth"), h2 = e2.getUniformLocation(t2, "uGlowWidth"), g2 = e2.getUniformLocation(t2, "uBorderRadius"), _2 = e2.getUniformLocation(t2, "uColors"), v2 = e2.getUniformLocation(t2, "uGlowExponent"), y = e2.getUniformLocation(t2, "uGlowFactor");
288
+ e2.useProgram(t2), e2.uniform1f(m2, this.options.borderWidth), e2.uniform1f(h2, this.options.glowWidth), e2.uniform1f(g2, this.options.borderRadius), this.options.mode === "dark" ? (e2.uniform1f(v2, 2), e2.uniform1f(y, 1.8)) : (e2.uniform1f(v2, 1), e2.uniform1f(y, 1));
289
+ let b = (this.options.colors || c).map(parseColor);
290
+ for (let n3 = 0; n3 < b.length; n3++) e2.uniform3f(e2.getUniformLocation(t2, `uColors[${n3}]`), ...b[n3]);
291
+ this.checkGLError(e2, "setupGL: after uniform setup"), e2.bindVertexArray(null), e2.bindBuffer(e2.ARRAY_BUFFER, null), this.glr = {
292
+ gl: e2,
293
+ program: t2,
294
+ vao: n2,
295
+ positionBuffer: a2,
296
+ uvBuffer: u2,
297
+ uResolution: f2,
298
+ uTime: p2,
299
+ uBorderWidth: m2,
300
+ uGlowWidth: h2,
301
+ uBorderRadius: g2,
302
+ uColors: _2
303
+ };
304
+ }
305
+ render(e2) {
306
+ if (!this.glr) return;
307
+ let { gl: t2, program: n2, vao: r2, uTime: i2 } = this.glr;
308
+ t2.useProgram(n2), t2.bindVertexArray(r2), t2.uniform1f(i2, e2), t2.disable(t2.DEPTH_TEST), t2.disable(t2.CULL_FACE), t2.disable(t2.BLEND), t2.clearColor(0, 0, 0, 0), t2.clear(t2.COLOR_BUFFER_BIT), t2.drawArrays(t2.TRIANGLES, 0, 24), this.checkGLError(t2, "render: after draw call"), t2.bindVertexArray(null);
309
+ }
310
+ greet() {
311
+ console.log("%c\u{1F308} ai-motion 0.4.8 \u{1F308}", "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;");
312
+ }
313
+ }, l, u, d, f, p, m, h;
314
+ (function() {
315
+ try {
316
+ if (typeof document < "u") {
317
+ var e2 = document.createElement("style");
318
+ e2.appendChild(document.createTextNode(`._wrapper_1ooyb_1 {
319
+ position: fixed;
320
+ inset: 0;
321
+ z-index: 2147483641; /* \u786E\u4FDD\u5728\u6240\u6709\u5143\u7D20\u4E4B\u4E0A\uFF0C\u9664\u4E86 panel */
322
+ cursor: wait;
323
+ overflow: hidden;
324
+
325
+ display: none;
326
+ }
327
+
328
+ ._wrapper_1ooyb_1._visible_1ooyb_11 {
329
+ display: block;
330
+ }
331
+ /* AI \u5149\u6807\u6837\u5F0F */
332
+ ._cursor_1dgwb_2 {
333
+ position: absolute;
334
+ width: var(--cursor-size, 75px);
335
+ height: var(--cursor-size, 75px);
336
+ pointer-events: none;
337
+ z-index: 10000;
338
+ }
339
+
340
+ ._cursorBorder_1dgwb_10 {
341
+ position: absolute;
342
+ width: 100%;
343
+ height: 100%;
344
+ background: linear-gradient(45deg, rgb(57, 182, 255), rgb(189, 69, 251));
345
+ 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");
346
+ mask-size: 100% 100%;
347
+ mask-repeat: no-repeat;
348
+
349
+ transform-origin: center;
350
+ transform: rotate(-135deg) scale(1.2);
351
+ margin-left: -10px;
352
+ margin-top: -18px;
353
+ }
354
+
355
+ ._cursorFilling_1dgwb_25 {
356
+ position: absolute;
357
+ width: 100%;
358
+ height: 100%;
359
+ 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");
360
+ background-size: 100% 100%;
361
+ background-repeat: no-repeat;
362
+
363
+ transform-origin: center;
364
+ transform: rotate(-135deg) scale(1.2);
365
+ margin-left: -10px;
366
+ margin-top: -18px;
367
+ }
368
+
369
+ ._cursorRipple_1dgwb_39 {
370
+ position: absolute;
371
+ width: 100%;
372
+ height: 100%;
373
+ pointer-events: none;
374
+ margin-left: -50%;
375
+ margin-top: -50%;
376
+
377
+ &::after {
378
+ content: '';
379
+ opacity: 0;
380
+ position: absolute;
381
+ inset: 0;
382
+ border: 4px solid rgba(57, 182, 255, 1);
383
+ border-radius: 50%;
262
384
  }
263
- setupGL() {
264
- let e = this.canvas.getContext("webgl2", {
265
- antialias: !1,
266
- alpha: !0
267
- });
268
- if (!e) throw Error("WebGL2 is required but not available.");
269
- let t = createProgram(e, s, o);
270
- this.checkGLError(e, "setupGL: after createProgram");
271
- let n = e.createVertexArray();
272
- e.bindVertexArray(n), this.checkGLError(e, "setupGL: after VAO creation");
273
- let { positions: r, uvs: i } = computeBorderGeometry(this.canvas.width || 2, this.canvas.height || 2, this.options.borderWidth, this.options.glowWidth), a = e.createBuffer();
274
- e.bindBuffer(e.ARRAY_BUFFER, a), e.bufferData(e.ARRAY_BUFFER, r, e.STATIC_DRAW);
275
- let l = e.getAttribLocation(t, "aPosition");
276
- e.enableVertexAttribArray(l), e.vertexAttribPointer(l, 2, e.FLOAT, !1, 0, 0), this.checkGLError(e, "setupGL: after position buffer setup");
277
- let u = e.createBuffer();
278
- e.bindBuffer(e.ARRAY_BUFFER, u), e.bufferData(e.ARRAY_BUFFER, i, e.STATIC_DRAW);
279
- let d = e.getAttribLocation(t, "aUV");
280
- e.enableVertexAttribArray(d), e.vertexAttribPointer(d, 2, e.FLOAT, !1, 0, 0), this.checkGLError(e, "setupGL: after UV buffer setup");
281
- let f = e.getUniformLocation(t, "uResolution"), p = e.getUniformLocation(t, "uTime"), m = e.getUniformLocation(t, "uBorderWidth"), h = e.getUniformLocation(t, "uGlowWidth"), g = e.getUniformLocation(t, "uBorderRadius"), _ = e.getUniformLocation(t, "uColors"), v = e.getUniformLocation(t, "uGlowExponent"), y = e.getUniformLocation(t, "uGlowFactor");
282
- e.useProgram(t), e.uniform1f(m, this.options.borderWidth), e.uniform1f(h, this.options.glowWidth), e.uniform1f(g, this.options.borderRadius), this.options.mode === "dark" ? (e.uniform1f(v, 2), e.uniform1f(y, 1.8)) : (e.uniform1f(v, 1), e.uniform1f(y, 1));
283
- let b = (this.options.colors || c).map(parseColor);
284
- for (let n = 0; n < b.length; n++) e.uniform3f(e.getUniformLocation(t, `uColors[${n}]`), ...b[n]);
285
- this.checkGLError(e, "setupGL: after uniform setup"), e.bindVertexArray(null), e.bindBuffer(e.ARRAY_BUFFER, null), this.glr = {
286
- gl: e,
287
- program: t,
288
- vao: n,
289
- positionBuffer: a,
290
- uvBuffer: u,
291
- uResolution: f,
292
- uTime: p,
293
- uBorderWidth: m,
294
- uGlowWidth: h,
295
- uBorderRadius: g,
296
- uColors: _
297
- };
385
+ }
386
+
387
+ ._cursor_1dgwb_2._clicking_1dgwb_57 ._cursorRipple_1dgwb_39::after {
388
+ animation: _cursor-ripple_1dgwb_1 300ms ease-out forwards;
389
+ }
390
+
391
+ @keyframes _cursor-ripple_1dgwb_1 {
392
+ 0% {
393
+ transform: scale(0);
394
+ opacity: 1;
298
395
  }
299
- render(e) {
300
- if (!this.glr) return;
301
- let { gl: t, program: n, vao: r, uTime: i } = this.glr;
302
- 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);
396
+ 100% {
397
+ transform: scale(2);
398
+ opacity: 0;
303
399
  }
304
- greet() {
305
- 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;");
400
+ }`)), document.head.appendChild(e2);
401
+ }
402
+ } catch (e3) {
403
+ console.error("vite-plugin-css-injected-by-js", e3);
404
+ }
405
+ })(), function() {
406
+ try {
407
+ if (typeof document < "u") {
408
+ var e2 = document.createElement("style");
409
+ e2.appendChild(document.createTextNode(`._wrapper_1ooyb_1 {
410
+ position: fixed;
411
+ inset: 0;
412
+ z-index: 2147483641; /* \u786E\u4FDD\u5728\u6240\u6709\u5143\u7D20\u4E4B\u4E0A\uFF0C\u9664\u4E86 panel */
413
+ cursor: wait;
414
+ overflow: hidden;
415
+
416
+ display: none;
417
+ }
418
+
419
+ ._wrapper_1ooyb_1._visible_1ooyb_11 {
420
+ display: block;
421
+ }
422
+ /* AI \u5149\u6807\u6837\u5F0F */
423
+ ._cursor_1dgwb_2 {
424
+ position: absolute;
425
+ width: var(--cursor-size, 75px);
426
+ height: var(--cursor-size, 75px);
427
+ pointer-events: none;
428
+ z-index: 10000;
429
+ }
430
+
431
+ ._cursorBorder_1dgwb_10 {
432
+ position: absolute;
433
+ width: 100%;
434
+ height: 100%;
435
+ background: linear-gradient(45deg, rgb(57, 182, 255), rgb(189, 69, 251));
436
+ 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");
437
+ mask-size: 100% 100%;
438
+ mask-repeat: no-repeat;
439
+
440
+ transform-origin: center;
441
+ transform: rotate(-135deg) scale(1.2);
442
+ margin-left: -10px;
443
+ margin-top: -18px;
444
+ }
445
+
446
+ ._cursorFilling_1dgwb_25 {
447
+ position: absolute;
448
+ width: 100%;
449
+ height: 100%;
450
+ 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");
451
+ background-size: 100% 100%;
452
+ background-repeat: no-repeat;
453
+
454
+ transform-origin: center;
455
+ transform: rotate(-135deg) scale(1.2);
456
+ margin-left: -10px;
457
+ margin-top: -18px;
458
+ }
459
+
460
+ ._cursorRipple_1dgwb_39 {
461
+ position: absolute;
462
+ width: 100%;
463
+ height: 100%;
464
+ pointer-events: none;
465
+ margin-left: -50%;
466
+ margin-top: -50%;
467
+
468
+ &::after {
469
+ content: '';
470
+ opacity: 0;
471
+ position: absolute;
472
+ inset: 0;
473
+ border: 4px solid rgba(57, 182, 255, 1);
474
+ border-radius: 50%;
306
475
  }
307
- }, l, u, d, f, p, m, h;
308
- (function() {
309
- try {
310
- if (typeof document < "u") {
311
- var e = document.createElement("style");
312
- 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);
313
- }
314
- } catch (e) {
315
- console.error("vite-plugin-css-injected-by-js", e);
476
+ }
477
+
478
+ ._cursor_1dgwb_2._clicking_1dgwb_57 ._cursorRipple_1dgwb_39::after {
479
+ animation: _cursor-ripple_1dgwb_1 300ms ease-out forwards;
480
+ }
481
+
482
+ @keyframes _cursor-ripple_1dgwb_1 {
483
+ 0% {
484
+ transform: scale(0);
485
+ opacity: 1;
316
486
  }
317
- })(), (function() {
318
- try {
319
- if (typeof document < "u") {
320
- var e = document.createElement("style");
321
- 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);
322
- }
323
- } catch (e) {
324
- console.error("vite-plugin-css-injected-by-js", e);
487
+ 100% {
488
+ transform: scale(2);
489
+ opacity: 0;
325
490
  }
326
- })();
491
+ }`)), document.head.appendChild(e2);
492
+ }
493
+ } catch (e3) {
494
+ console.error("vite-plugin-css-injected-by-js", e3);
495
+ }
496
+ }();
327
497
  function isPageDark() {
328
- try {
329
- return !!(hasDarkModeClass() || hasDarkModeDataAttribute() || isColorSchemeDark() || isBackgroundDark() || isMainContentBackgroundDark() || isTextColorLight());
330
- } catch (e) {
331
- return console.warn("Error determining if page is dark:", e), !1;
332
- }
498
+ try {
499
+ return !!(hasDarkModeClass() || hasDarkModeDataAttribute() || isColorSchemeDark() || isBackgroundDark() || isMainContentBackgroundDark() || isTextColorLight());
500
+ } catch (e2) {
501
+ return console.warn("Error determining if page is dark:", e2), false;
502
+ }
333
503
  }
334
504
  function hasDarkModeClass() {
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 !1;
505
+ let e2 = [
506
+ "dark",
507
+ "dark-mode",
508
+ "theme-dark",
509
+ "night",
510
+ "night-mode"
511
+ ], t2 = document.documentElement, n2 = document.body || document.documentElement;
512
+ for (let r2 of e2) if (t2.classList.contains(r2) || n2?.classList.contains(r2)) return true;
513
+ return false;
344
514
  }
345
515
  function hasDarkModeDataAttribute() {
346
- let e = document.documentElement, t = document.body || document.documentElement;
347
- for (let n of [
348
- "data-theme",
349
- "data-color-mode",
350
- "data-bs-theme",
351
- "data-mui-color-scheme"
352
- ]) {
353
- let r = t?.getAttribute(n), i = e.getAttribute(n);
354
- if (r?.toLowerCase() === "dark" || i?.toLowerCase() === "dark") return !0;
355
- }
356
- return !1;
516
+ let e2 = document.documentElement, t2 = document.body || document.documentElement;
517
+ for (let n2 of [
518
+ "data-theme",
519
+ "data-color-mode",
520
+ "data-bs-theme",
521
+ "data-mui-color-scheme"
522
+ ]) {
523
+ let r2 = t2?.getAttribute(n2), i2 = e2.getAttribute(n2);
524
+ if (r2?.toLowerCase() === "dark" || i2?.toLowerCase() === "dark") return true;
525
+ }
526
+ return false;
357
527
  }
358
528
  function isColorSchemeDark() {
359
- let e = document.querySelector("meta[name=\"color-scheme\"]")?.content.toLowerCase();
360
- if (e === "dark" || e === "only dark") return !0;
361
- let t = window.getComputedStyle(document.documentElement).getPropertyValue("color-scheme").trim().toLowerCase();
362
- return t === "dark" || t === "only dark";
529
+ let e2 = document.querySelector('meta[name="color-scheme"]')?.content.toLowerCase();
530
+ if (e2 === "dark" || e2 === "only dark") return true;
531
+ let t2 = window.getComputedStyle(document.documentElement).getPropertyValue("color-scheme").trim().toLowerCase();
532
+ return t2 === "dark" || t2 === "only dark";
363
533
  }
364
534
  function isBackgroundDark() {
365
- let e = window.getComputedStyle(document.documentElement), t = window.getComputedStyle(document.body || document.documentElement), n = e.backgroundColor, r = t.backgroundColor;
366
- return isColorDark(r) ? !0 : r === "transparent" || r.startsWith("rgba(0, 0, 0, 0)") ? isColorDark(n) : !1;
535
+ let e2 = window.getComputedStyle(document.documentElement), t2 = window.getComputedStyle(document.body || document.documentElement), n2 = e2.backgroundColor, r2 = t2.backgroundColor;
536
+ return isColorDark(r2) ? true : r2 === "transparent" || r2.startsWith("rgba(0, 0, 0, 0)") ? isColorDark(n2) : false;
367
537
  }
368
538
  function isTextColorLight() {
369
- let e = getLuminance(window.getComputedStyle(document.body || document.documentElement).color);
370
- return e !== null && e > 200;
539
+ let e2 = getLuminance(window.getComputedStyle(document.body || document.documentElement).color);
540
+ return e2 !== null && e2 > 200;
371
541
  }
372
542
  function isMainContentBackgroundDark() {
373
- let { innerWidth: e, innerHeight: t } = window, n = e * t * .5;
374
- for (let e of [
375
- "#app",
376
- "#root",
377
- "#__next"
378
- ]) {
379
- let t = document.querySelector(e);
380
- if (!t) continue;
381
- let r = t.getBoundingClientRect();
382
- if (!(r.width * r.height < n) && isColorDark(window.getComputedStyle(t).backgroundColor)) return !0;
383
- }
384
- return !1;
543
+ let { innerWidth: e2, innerHeight: t2 } = window, n2 = e2 * t2 * 0.5;
544
+ for (let e3 of [
545
+ "#app",
546
+ "#root",
547
+ "#__next"
548
+ ]) {
549
+ let t3 = document.querySelector(e3);
550
+ if (!t3) continue;
551
+ let r2 = t3.getBoundingClientRect();
552
+ if (!(r2.width * r2.height < n2) && isColorDark(window.getComputedStyle(t3).backgroundColor)) return true;
553
+ }
554
+ return false;
385
555
  }
386
- function parseRgbColor(e) {
387
- let t = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(e);
388
- return t ? {
389
- r: parseInt(t[1]),
390
- g: parseInt(t[2]),
391
- b: parseInt(t[3])
392
- } : null;
556
+ function parseRgbColor(e2) {
557
+ let t2 = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(e2);
558
+ return t2 ? {
559
+ r: parseInt(t2[1]),
560
+ g: parseInt(t2[2]),
561
+ b: parseInt(t2[3])
562
+ } : null;
393
563
  }
394
- function getLuminance(e) {
395
- if (!e || e === "transparent" || e.startsWith("rgba(0, 0, 0, 0)")) return null;
396
- let t = parseRgbColor(e);
397
- return t ? .299 * t.r + .587 * t.g + .114 * t.b : null;
564
+ function getLuminance(e2) {
565
+ if (!e2 || e2 === "transparent" || e2.startsWith("rgba(0, 0, 0, 0)")) return null;
566
+ let t2 = parseRgbColor(e2);
567
+ return t2 ? 0.299 * t2.r + 0.587 * t2.g + 0.114 * t2.b : null;
398
568
  }
399
- function isColorDark(e, t = 128) {
400
- let n = getLuminance(e);
401
- return n !== null && n < t;
569
+ function isColorDark(e2, t2 = 128) {
570
+ let n2 = getLuminance(e2);
571
+ return n2 !== null && n2 < t2;
402
572
  }
403
573
  var g = {
404
- wrapper: "_wrapper_1ooyb_1",
405
- visible: "_visible_1ooyb_11"
574
+ wrapper: "_wrapper_1ooyb_1",
575
+ visible: "_visible_1ooyb_11"
406
576
  }, _ = {
407
- cursor: "_cursor_1dgwb_2",
408
- cursorBorder: "_cursorBorder_1dgwb_10",
409
- cursorFilling: "_cursorFilling_1dgwb_25",
410
- cursorRipple: "_cursorRipple_1dgwb_39",
411
- clicking: "_clicking_1dgwb_57",
412
- "cursor-ripple": "_cursor-ripple_1dgwb_1"
577
+ cursor: "_cursor_1dgwb_2",
578
+ cursorBorder: "_cursorBorder_1dgwb_10",
579
+ cursorFilling: "_cursorFilling_1dgwb_25",
580
+ cursorRipple: "_cursorRipple_1dgwb_39",
581
+ clicking: "_clicking_1dgwb_57",
582
+ "cursor-ripple": "_cursor-ripple_1dgwb_1"
413
583
  }, v = (l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakSet(), class extends EventTarget {
414
- constructor() {
415
- super(), t(this, h), e(this, "shown", !1), e(this, "wrapper", document.createElement("div")), e(this, "motion", null), n(this, l, !1), n(this, u, document.createElement("div")), n(this, d, 0), n(this, f, 0), n(this, p, 0), n(this, m, 0), this.wrapper.id = "page-agent-runtime_simulator-mask", this.wrapper.className = g.wrapper, this.wrapper.setAttribute("data-browser-use-ignore", "true"), this.wrapper.setAttribute("data-page-agent-ignore", "true");
416
- try {
417
- let e = new Motion({
418
- mode: isPageDark() ? "dark" : "light",
419
- styles: {
420
- position: "absolute",
421
- inset: "0"
422
- }
423
- });
424
- this.motion = e, this.wrapper.appendChild(e.element), e.autoResize(this.wrapper);
425
- } catch (e) {
426
- console.warn("[SimulatorMask] Motion overlay unavailable:", e);
427
- }
428
- this.wrapper.addEventListener("click", (e) => {
429
- e.stopPropagation(), e.preventDefault();
430
- }), this.wrapper.addEventListener("mousedown", (e) => {
431
- e.stopPropagation(), e.preventDefault();
432
- }), this.wrapper.addEventListener("mouseup", (e) => {
433
- e.stopPropagation(), e.preventDefault();
434
- }), this.wrapper.addEventListener("mousemove", (e) => {
435
- e.stopPropagation(), e.preventDefault();
436
- }), this.wrapper.addEventListener("wheel", (e) => {
437
- e.stopPropagation(), e.preventDefault();
438
- }), this.wrapper.addEventListener("keydown", (e) => {
439
- e.stopPropagation(), e.preventDefault();
440
- }), this.wrapper.addEventListener("keyup", (e) => {
441
- e.stopPropagation(), e.preventDefault();
442
- }), i(h, this, _createCursor).call(this), document.body.appendChild(this.wrapper), i(h, this, _moveCursorToTarget).call(this);
443
- let movePointerToListener = (e) => {
444
- let { x: t, y: n } = e.detail;
445
- this.setCursorPosition(t, n);
446
- }, clickPointerListener = () => {
447
- this.triggerClickAnimation();
448
- }, enablePassThroughListener = () => {
449
- this.wrapper.style.pointerEvents = "none";
450
- }, disablePassThroughListener = () => {
451
- this.wrapper.style.pointerEvents = "auto";
452
- };
453
- window.addEventListener("PageAgent::MovePointerTo", movePointerToListener), window.addEventListener("PageAgent::ClickPointer", clickPointerListener), window.addEventListener("PageAgent::EnablePassThrough", enablePassThroughListener), window.addEventListener("PageAgent::DisablePassThrough", disablePassThroughListener), this.addEventListener("dispose", () => {
454
- window.removeEventListener("PageAgent::MovePointerTo", movePointerToListener), window.removeEventListener("PageAgent::ClickPointer", clickPointerListener), window.removeEventListener("PageAgent::EnablePassThrough", enablePassThroughListener), window.removeEventListener("PageAgent::DisablePassThrough", disablePassThroughListener);
455
- });
456
- }
457
- setCursorPosition(e, t) {
458
- r(l, this) || (a(p, this, e), a(m, this, t));
459
- }
460
- triggerClickAnimation() {
461
- r(l, this) || (r(u, this).classList.remove(_.clicking), r(u, this).offsetHeight, r(u, this).classList.add(_.clicking));
462
- }
463
- show() {
464
- this.shown || r(l, this) || (this.shown = !0, this.motion?.start(), this.motion?.fadeIn(), this.wrapper.classList.add(g.visible), a(d, this, window.innerWidth / 2), a(f, this, window.innerHeight / 2), a(p, this, r(d, this)), a(m, this, r(f, this)), r(u, this).style.left = `${r(d, this)}px`, r(u, this).style.top = `${r(f, this)}px`);
465
- }
466
- hide() {
467
- !this.shown || r(l, this) || (this.shown = !1, this.motion?.fadeOut(), this.motion?.pause(), r(u, this).classList.remove(_.clicking), setTimeout(() => {
468
- this.wrapper.classList.remove(g.visible);
469
- }, 800));
470
- }
471
- dispose() {
472
- a(l, this, !0), this.motion?.dispose(), this.wrapper.remove(), this.dispatchEvent(new Event("dispose"));
473
- }
584
+ constructor() {
585
+ super(), t(this, h), e(this, "shown", false), e(this, "wrapper", document.createElement("div")), e(this, "motion", null), n(this, l, false), n(this, u, document.createElement("div")), n(this, d, 0), n(this, f, 0), n(this, p, 0), n(this, m, 0), this.wrapper.id = "page-agent-runtime_simulator-mask", this.wrapper.className = g.wrapper, this.wrapper.setAttribute("data-browser-use-ignore", "true"), this.wrapper.setAttribute("data-page-agent-ignore", "true");
586
+ try {
587
+ let e2 = new Motion({
588
+ mode: isPageDark() ? "dark" : "light",
589
+ styles: {
590
+ position: "absolute",
591
+ inset: "0"
592
+ }
593
+ });
594
+ this.motion = e2, this.wrapper.appendChild(e2.element), e2.autoResize(this.wrapper);
595
+ } catch (e2) {
596
+ console.warn("[SimulatorMask] Motion overlay unavailable:", e2);
597
+ }
598
+ this.wrapper.addEventListener("click", (e2) => {
599
+ e2.stopPropagation(), e2.preventDefault();
600
+ }), this.wrapper.addEventListener("mousedown", (e2) => {
601
+ e2.stopPropagation(), e2.preventDefault();
602
+ }), this.wrapper.addEventListener("mouseup", (e2) => {
603
+ e2.stopPropagation(), e2.preventDefault();
604
+ }), this.wrapper.addEventListener("mousemove", (e2) => {
605
+ e2.stopPropagation(), e2.preventDefault();
606
+ }), this.wrapper.addEventListener("wheel", (e2) => {
607
+ e2.stopPropagation(), e2.preventDefault();
608
+ }), this.wrapper.addEventListener("keydown", (e2) => {
609
+ e2.stopPropagation(), e2.preventDefault();
610
+ }), this.wrapper.addEventListener("keyup", (e2) => {
611
+ e2.stopPropagation(), e2.preventDefault();
612
+ }), i(h, this, _createCursor).call(this), document.body.appendChild(this.wrapper), i(h, this, _moveCursorToTarget).call(this);
613
+ let movePointerToListener = (e2) => {
614
+ let { x: t2, y: n2 } = e2.detail;
615
+ this.setCursorPosition(t2, n2);
616
+ }, clickPointerListener = () => {
617
+ this.triggerClickAnimation();
618
+ }, enablePassThroughListener = () => {
619
+ this.wrapper.style.pointerEvents = "none";
620
+ }, disablePassThroughListener = () => {
621
+ this.wrapper.style.pointerEvents = "auto";
622
+ };
623
+ window.addEventListener("PageAgent::MovePointerTo", movePointerToListener), window.addEventListener("PageAgent::ClickPointer", clickPointerListener), window.addEventListener("PageAgent::EnablePassThrough", enablePassThroughListener), window.addEventListener("PageAgent::DisablePassThrough", disablePassThroughListener), this.addEventListener("dispose", () => {
624
+ window.removeEventListener("PageAgent::MovePointerTo", movePointerToListener), window.removeEventListener("PageAgent::ClickPointer", clickPointerListener), window.removeEventListener("PageAgent::EnablePassThrough", enablePassThroughListener), window.removeEventListener("PageAgent::DisablePassThrough", disablePassThroughListener);
625
+ });
626
+ }
627
+ setCursorPosition(e2, t2) {
628
+ r(l, this) || (a(p, this, e2), a(m, this, t2));
629
+ }
630
+ triggerClickAnimation() {
631
+ r(l, this) || (r(u, this).classList.remove(_.clicking), r(u, this).offsetHeight, r(u, this).classList.add(_.clicking));
632
+ }
633
+ show() {
634
+ this.shown || r(l, this) || (this.shown = true, this.motion?.start(), this.motion?.fadeIn(), this.wrapper.classList.add(g.visible), a(d, this, window.innerWidth / 2), a(f, this, window.innerHeight / 2), a(p, this, r(d, this)), a(m, this, r(f, this)), r(u, this).style.left = `${r(d, this)}px`, r(u, this).style.top = `${r(f, this)}px`);
635
+ }
636
+ hide() {
637
+ !this.shown || r(l, this) || (this.shown = false, this.motion?.fadeOut(), this.motion?.pause(), r(u, this).classList.remove(_.clicking), setTimeout(() => {
638
+ this.wrapper.classList.remove(g.visible);
639
+ }, 800));
640
+ }
641
+ dispose() {
642
+ a(l, this, true), this.motion?.dispose(), this.wrapper.remove(), this.dispatchEvent(new Event("dispose"));
643
+ }
474
644
  });
475
645
  function _createCursor() {
476
- r(u, this).className = _.cursor;
477
- let e = document.createElement("div");
478
- e.className = _.cursorRipple, r(u, this).appendChild(e);
479
- let t = document.createElement("div");
480
- t.className = _.cursorFilling, r(u, this).appendChild(t);
481
- let n = document.createElement("div");
482
- n.className = _.cursorBorder, r(u, this).appendChild(n), this.wrapper.appendChild(r(u, this));
646
+ r(u, this).className = _.cursor;
647
+ let e2 = document.createElement("div");
648
+ e2.className = _.cursorRipple, r(u, this).appendChild(e2);
649
+ let t2 = document.createElement("div");
650
+ t2.className = _.cursorFilling, r(u, this).appendChild(t2);
651
+ let n2 = document.createElement("div");
652
+ n2.className = _.cursorBorder, r(u, this).appendChild(n2), this.wrapper.appendChild(r(u, this));
483
653
  }
484
654
  function _moveCursorToTarget() {
485
- if (r(l, this)) return;
486
- let e = r(d, this) + (r(p, this) - r(d, this)) * .2, t = r(f, this) + (r(m, this) - r(f, this)) * .2, n = Math.abs(e - r(p, this));
487
- n > 0 && (n < 2 ? a(d, this, r(p, this)) : a(d, this, e), r(u, this).style.left = `${r(d, this)}px`);
488
- let o = Math.abs(t - r(m, this));
489
- o > 0 && (o < 2 ? a(f, this, r(m, this)) : a(f, this, t), r(u, this).style.top = `${r(f, this)}px`), requestAnimationFrame(() => i(h, this, _moveCursorToTarget).call(this));
655
+ if (r(l, this)) return;
656
+ let e2 = r(d, this) + (r(p, this) - r(d, this)) * 0.2, t2 = r(f, this) + (r(m, this) - r(f, this)) * 0.2, n2 = Math.abs(e2 - r(p, this));
657
+ n2 > 0 && (n2 < 2 ? a(d, this, r(p, this)) : a(d, this, e2), r(u, this).style.left = `${r(d, this)}px`);
658
+ let o2 = Math.abs(t2 - r(m, this));
659
+ o2 > 0 && (o2 < 2 ? a(f, this, r(m, this)) : a(f, this, t2), r(u, this).style.top = `${r(f, this)}px`), requestAnimationFrame(() => i(h, this, _moveCursorToTarget).call(this));
490
660
  }
491
- //#endregion
492
- export { v as SimulatorMask };
493
-
494
- //# sourceMappingURL=SimulatorMask-BHVXyogh-D3fkDyID.js.map
661
+ export {
662
+ v as SimulatorMask
663
+ };