@fkn/lib 0.3.7 → 0.3.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,1459 @@
1
+ import { BoxBase as e, recursiveBox as t, recursiveRevive as n } from "osra";
2
+ //#region \0rolldown/runtime.js
3
+ var r = Object.defineProperty, i = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), a = (e, t) => {
4
+ let n = {};
5
+ for (var i in e) r(n, i, {
6
+ get: e[i],
7
+ enumerable: !0
8
+ });
9
+ return t || r(n, Symbol.toStringTag, { value: "Module" }), n;
10
+ }, o = (e, t) => {
11
+ let n = new EventTarget(), r = /* @__PURE__ */ new Map(), i = EventTarget.prototype.addEventListener.bind(n), a = EventTarget.prototype.removeEventListener.bind(n);
12
+ return Object.defineProperty(n, "addEventListener", {
13
+ configurable: !0,
14
+ value: (a, o, s) => {
15
+ if (o !== null) {
16
+ if (!r.has(a)) {
17
+ let i = (r) => {
18
+ n.dispatchEvent(new CustomEvent(a, {
19
+ detail: t(r, e),
20
+ bubbles: r.bubbles,
21
+ cancelable: r.cancelable,
22
+ composed: r.composed
23
+ }));
24
+ };
25
+ e.addEventListener(a, i), r.set(a, i);
26
+ }
27
+ i(a, o, s);
28
+ }
29
+ }
30
+ }), Object.defineProperty(n, "removeEventListener", {
31
+ configurable: !0,
32
+ value: (t, n, i) => {
33
+ if (n === null) return;
34
+ a(t, n, i);
35
+ let o = r.get(t);
36
+ o && (e.removeEventListener(t, o), r.delete(t));
37
+ }
38
+ }), n;
39
+ }, s = (e) => typeof e == "boolean" ? e ? 1 : 0 : e?.capture ? 1 : 0, c = (e) => {
40
+ let t = /* @__PURE__ */ new WeakMap();
41
+ return {
42
+ addEventListener: (n, r, i) => {
43
+ if (r === null) return;
44
+ let a = `${n}|${s(i)}`, o = t.get(r);
45
+ if (o || (o = /* @__PURE__ */ new Map(), t.set(r, o)), o.has(a)) return;
46
+ let c = typeof i == "object" && !!i && !!i.once, l = (t) => {
47
+ c && o.delete(a);
48
+ let i = e.unenrich(t, n);
49
+ typeof r == "function" ? r.call(e.target, i) : r.handleEvent(i);
50
+ };
51
+ o.set(a, l), e.remoteEvents.addEventListener(n, l, i);
52
+ },
53
+ removeEventListener: (n, r, i) => {
54
+ if (r === null) return;
55
+ let a = `${n}|${s(i)}`, o = t.get(r), c = o?.get(a);
56
+ c && (e.remoteEvents.removeEventListener(n, c, i), o.delete(a));
57
+ },
58
+ dispatchEvent: (t) => e.remoteEvents.dispatchEvent(t)
59
+ };
60
+ }, l = /* @__PURE__ */ a({
61
+ box: () => D,
62
+ createVideoElementHandle: () => T,
63
+ isType: () => E,
64
+ revive: () => O,
65
+ type: () => u
66
+ }), u = "videoElement", d = [
67
+ "currentTime",
68
+ "volume",
69
+ "muted",
70
+ "playbackRate",
71
+ "src",
72
+ "loop",
73
+ "autoplay",
74
+ "preload",
75
+ "poster",
76
+ "disableRemotePlayback"
77
+ ], f = [
78
+ "duration",
79
+ "paused",
80
+ "ended",
81
+ "seeking",
82
+ "readyState",
83
+ "currentSrc"
84
+ ], p = ["buffered", "seekable"], m = Symbol.for("fkn.remoteVideoElement"), h = Symbol.for("fkn.remoteVideoElement.state"), g = Symbol.for("fkn.remoteVideoElement.controller"), _ = (e) => e ? Array.from({ length: e.length }, (t, n) => [e.start(n), e.end(n)]) : [], v = (e) => {
85
+ let t = {};
86
+ for (let n of [...d, ...f]) t[n] = e[n];
87
+ for (let n of p) t[n] = _(e[n]);
88
+ return t.error = e.error ? {
89
+ code: e.error.code,
90
+ message: e.error.message
91
+ } : null, t;
92
+ }, y = (e) => {
93
+ let t = (t) => {
94
+ if (!Number.isInteger(t) || t < 0 || t >= e.length) throw new DOMException("Index or size is negative or greater than the allowed amount", "IndexSizeError");
95
+ };
96
+ return {
97
+ get length() {
98
+ return e.length;
99
+ },
100
+ start(n) {
101
+ return t(n), e[n][0];
102
+ },
103
+ end(n) {
104
+ return t(n), e[n][1];
105
+ }
106
+ };
107
+ }, b = (e) => e ? {
108
+ code: e.code,
109
+ message: e.message,
110
+ MEDIA_ERR_ABORTED: 1,
111
+ MEDIA_ERR_NETWORK: 2,
112
+ MEDIA_ERR_DECODE: 3,
113
+ MEDIA_ERR_SRC_NOT_SUPPORTED: 4
114
+ } : null, x = (e) => o(e, (e, t) => ({
115
+ originalDetail: e instanceof CustomEvent ? e.detail : null,
116
+ snapshot: v(t)
117
+ })), S = async (e, t) => {
118
+ switch (t) {
119
+ case "play": return await e.play(), null;
120
+ case "pause": return e.pause(), null;
121
+ case "load": return e.load(), null;
122
+ case "requestPictureInPicture":
123
+ if (typeof e.requestPictureInPicture != "function") throw Error("requestPictureInPicture is not supported in this environment");
124
+ return await e.requestPictureInPicture(), null;
125
+ case "exitPictureInPicture": {
126
+ let t = e.ownerDocument;
127
+ if (typeof t?.exitPictureInPicture != "function") throw Error("exitPictureInPicture is not supported in this environment");
128
+ return await t.exitPictureInPicture(), null;
129
+ }
130
+ default: throw Error(`videoElement: unknown method "${t}"`);
131
+ }
132
+ }, C = (e) => ({
133
+ call: async (t) => S(e, t),
134
+ set: async (t, n) => {
135
+ try {
136
+ e[t] = n;
137
+ } catch {}
138
+ return v(e);
139
+ },
140
+ events: x(e)
141
+ }), w = (e, t) => {
142
+ let n = new EventTarget();
143
+ Object.defineProperty(n, m, { value: !0 }), Object.defineProperty(n, h, { value: e }), Object.defineProperty(n, g, { value: t });
144
+ let r = c({
145
+ target: n,
146
+ remoteEvents: t.events,
147
+ unenrich: (t, n) => {
148
+ if (!(t instanceof CustomEvent)) return t;
149
+ let r = t.detail;
150
+ if (!r || !("snapshot" in r)) return t;
151
+ Object.assign(e, r.snapshot);
152
+ let i = {
153
+ bubbles: t.bubbles,
154
+ cancelable: t.cancelable,
155
+ composed: t.composed
156
+ };
157
+ return r.originalDetail === null ? new Event(n, i) : new CustomEvent(n, {
158
+ ...i,
159
+ detail: r.originalDetail
160
+ });
161
+ }
162
+ }), i = {
163
+ addEventListener: {
164
+ configurable: !0,
165
+ value: r.addEventListener
166
+ },
167
+ removeEventListener: {
168
+ configurable: !0,
169
+ value: r.removeEventListener
170
+ },
171
+ dispatchEvent: {
172
+ configurable: !0,
173
+ value: r.dispatchEvent
174
+ },
175
+ error: {
176
+ configurable: !0,
177
+ enumerable: !0,
178
+ get() {
179
+ return b(e.error);
180
+ }
181
+ },
182
+ play: {
183
+ configurable: !0,
184
+ value: () => t.call("play", [])
185
+ },
186
+ pause: {
187
+ configurable: !0,
188
+ value: () => {
189
+ t.call("pause", []).catch(() => {});
190
+ }
191
+ },
192
+ load: {
193
+ configurable: !0,
194
+ value: () => {
195
+ t.call("load", []).catch(() => {});
196
+ }
197
+ },
198
+ requestPictureInPicture: {
199
+ configurable: !0,
200
+ value: () => t.call("requestPictureInPicture", [])
201
+ },
202
+ exitPictureInPicture: {
203
+ configurable: !0,
204
+ value: () => t.call("exitPictureInPicture", [])
205
+ },
206
+ HAVE_FUTURE_DATA: {
207
+ enumerable: !0,
208
+ value: 3
209
+ },
210
+ HAVE_ENOUGH_DATA: {
211
+ enumerable: !0,
212
+ value: 4
213
+ }
214
+ };
215
+ for (let n of d) i[n] = {
216
+ configurable: !0,
217
+ enumerable: !0,
218
+ get() {
219
+ return e[n];
220
+ },
221
+ set(r) {
222
+ e[n] = r, t.set(n, r).then((t) => {
223
+ Object.assign(e, t);
224
+ }, () => {});
225
+ }
226
+ };
227
+ for (let t of f) i[t] = {
228
+ configurable: !0,
229
+ enumerable: !0,
230
+ get() {
231
+ return e[t];
232
+ }
233
+ };
234
+ for (let t of p) i[t] = {
235
+ configurable: !0,
236
+ enumerable: !0,
237
+ get() {
238
+ return y(e[t]);
239
+ }
240
+ };
241
+ return Object.defineProperties(n, i), n;
242
+ }, T = (e) => w(v(e), C(e)), E = (e) => typeof e == "object" && !!e && e[m] === !0, D = (n, r) => {
243
+ let i = n;
244
+ return {
245
+ ...e,
246
+ type: u,
247
+ initialState: i[h],
248
+ controller: t(i[g], r)
249
+ };
250
+ }, O = (e, t) => {
251
+ let r = n(e.controller, t);
252
+ return w({ ...e.initialState }, r);
253
+ }, ee = (e) => [l, ...e], k = (e) => typeof e == "object" && !!e, te = "PermissionDeniedError", ne = (e) => e instanceof Error ? e.name === te : k(e) && e.name === "PermissionDeniedError", re = 3e4, ie = 50, ae = (e) => {
254
+ let t = e[e.length - 1];
255
+ return typeof t == "object" && t ? t : void 0;
256
+ }, oe = (e) => {
257
+ let t = ae(e)?.timeout;
258
+ return typeof t == "number" ? t : re;
259
+ }, se = async (e, t, n, r, i) => {
260
+ i && await i(t, n, r);
261
+ let a = e, o = oe(r), s = Date.now() + o, c = /* @__PURE__ */ Error(`Locator timeout (${o}ms): ${n}`), { promise: l, reject: u } = Promise.withResolvers(), d = setTimeout(() => u(c), o), f = c;
262
+ try {
263
+ for (; Date.now() < s;) try {
264
+ return await Promise.race([a(t, n, r), l]);
265
+ } catch (e) {
266
+ if (e === c) break;
267
+ if (ne(e)) throw e;
268
+ f = e;
269
+ let t = s - Date.now();
270
+ if (t <= 0) break;
271
+ await new Promise((e) => setTimeout(e, Math.min(ie, t)));
272
+ }
273
+ } finally {
274
+ clearTimeout(d);
275
+ }
276
+ throw f;
277
+ }, A = /* @__PURE__ */ a({
278
+ render: () => ue,
279
+ resolve: () => le,
280
+ type: () => ce
281
+ }), ce = "locator", le = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(t)]), ue = (e) => ({
282
+ fragment: typeof e == "string" ? e : "?",
283
+ separator: "descend"
284
+ }), de = (e) => k(e) && e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY === !0 && typeof e.frameId == "string", j = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new Set(), fe = (e) => (N.add(e), () => N.delete(e));
285
+ typeof window < "u" && window.addEventListener("message", (e) => {
286
+ if (!de(e.data)) return;
287
+ e.stopImmediatePropagation();
288
+ let t = e.source;
289
+ if (!t || typeof t != "object") return;
290
+ let n = t, r = j.get(n), i = e.data.frameId;
291
+ if (j.set(n, i), r) for (let e of N) e(r);
292
+ let a = M.get(n);
293
+ if (a) {
294
+ M.delete(n);
295
+ for (let e of a) e(i);
296
+ }
297
+ }, { capture: !0 });
298
+ var pe = (e) => {
299
+ let t = e.contentWindow;
300
+ if (!t) return Promise.reject(/* @__PURE__ */ Error("frameLocator: <iframe> has no contentWindow"));
301
+ let n = j.get(t);
302
+ return n ? Promise.resolve(n) : new Promise((e) => {
303
+ let n = M.get(t) ?? [];
304
+ n.push(e), M.set(t, n);
305
+ });
306
+ }, P = /* @__PURE__ */ a({
307
+ render: () => _e,
308
+ resolve: () => he,
309
+ resolvePeer: () => ge,
310
+ type: () => me
311
+ }), me = "frameLocator", he = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(t)]).filter((e) => e instanceof HTMLIFrameElement), ge = async ({ parts: e, selfIndex: t, resolveLocal: n }) => {
312
+ let r = n(e.slice(0, t + 1))[0];
313
+ if (!r) throw Error("frameLocator: no <iframe> matched");
314
+ if (!(r instanceof HTMLIFrameElement)) throw Error(`frameLocator: expected <iframe>, got <${r.tagName.toLowerCase()}>`);
315
+ return pe(r);
316
+ }, _e = (e) => ({
317
+ fragment: typeof e == "string" ? e : "?",
318
+ separator: "frame-down"
319
+ }), ve = /* @__PURE__ */ a({
320
+ render: () => Se,
321
+ resolve: () => be,
322
+ resolvePeer: () => xe,
323
+ type: () => ye
324
+ }), ye = "owner", be = (e) => {
325
+ throw Error("owner: must be processed by the executor as an upward pivot");
326
+ }, xe = async () => {
327
+ let { backgroundResolvers: e } = await import("./background-DCdL9DVK.js"), t = await (await e).getParentFrameId();
328
+ if (!t) throw Error("owner: already at top frame");
329
+ return t;
330
+ }, Se = () => ({
331
+ fragment: "",
332
+ separator: "frame-up"
333
+ }), Ce = class extends Error {
334
+ reason;
335
+ filename;
336
+ line;
337
+ column;
338
+ source;
339
+ constructor(e, t, n, r, i) {
340
+ super(`${e}:${n}:${r}: ${t}`), this.reason = t, this.filename = e, this.line = n, this.column = r, this.source = i;
341
+ }
342
+ }, we = class {
343
+ start;
344
+ end;
345
+ source;
346
+ constructor(e, t, n) {
347
+ this.start = e, this.end = t, this.source = n;
348
+ }
349
+ }, F;
350
+ (function(e) {
351
+ e.stylesheet = "stylesheet", e.rule = "rule", e.declaration = "declaration", e.comment = "comment", e.atRule = "at-rule", e.container = "container", e.charset = "charset", e.counterStyle = "counter-style", e.document = "document", e.customMedia = "custom-media", e.fontFace = "font-face", e.fontFeatureValues = "font-feature-values", e.host = "host", e.import = "import", e.keyframes = "keyframes", e.keyframe = "keyframe", e.layer = "layer", e.media = "media", e.namespace = "namespace", e.page = "page", e.pageMarginBox = "page-margin-box", e.positionTry = "position-try", e.property = "property", e.scope = "scope", e.startingStyle = "starting-style", e.supports = "supports", e.viewTransition = "view-transition";
352
+ })(F ||= {});
353
+ var I = (e, t, n) => {
354
+ let r = n, i = 1e4;
355
+ do {
356
+ let n = t.map((t) => e.indexOf(t, r));
357
+ n.push(e.indexOf("\\", r));
358
+ let a = n.filter((e) => e !== -1);
359
+ if (a.length === 0) return -1;
360
+ let o = Math.min(...a);
361
+ if (e[o] !== "\\") return o;
362
+ r = o + 2, i--;
363
+ } while (i > 0);
364
+ throw Error("Too many escaping");
365
+ }, L = (e, t, n) => {
366
+ let r = n, i = 1e4;
367
+ do {
368
+ let n = t.map((t) => e.indexOf(t, r));
369
+ n.push(e.indexOf("(", r)), n.push(e.indexOf("\"", r)), n.push(e.indexOf("'", r)), n.push(e.indexOf("\\", r));
370
+ let a = n.filter((e) => e !== -1);
371
+ if (a.length === 0) return -1;
372
+ let o = Math.min(...a);
373
+ switch (e[o]) {
374
+ case "\\":
375
+ r = o + 2;
376
+ break;
377
+ case "(":
378
+ {
379
+ let t = L(e, [")"], o + 1);
380
+ if (t === -1) return -1;
381
+ r = t + 1;
382
+ }
383
+ break;
384
+ case "\"":
385
+ {
386
+ let t = I(e, ["\""], o + 1);
387
+ if (t === -1) return -1;
388
+ r = t + 1;
389
+ }
390
+ break;
391
+ case "'":
392
+ {
393
+ let t = I(e, ["'"], o + 1);
394
+ if (t === -1) return -1;
395
+ r = t + 1;
396
+ }
397
+ break;
398
+ default: return o;
399
+ }
400
+ i--;
401
+ } while (i > 0);
402
+ throw Error("Too many escaping");
403
+ }, R = /\/\*[^]*?(?:\*\/|$)/g;
404
+ function z(e) {
405
+ return e ? e.trim() : "";
406
+ }
407
+ function B(e, t) {
408
+ let n = e && typeof e.type == "string", r = n ? e : t;
409
+ for (let t in e) {
410
+ let n = e[t];
411
+ Array.isArray(n) ? n.forEach((e) => {
412
+ B(e, r);
413
+ }) : n && typeof n == "object" && B(n, r);
414
+ }
415
+ return n && Object.defineProperty(e, "parent", {
416
+ configurable: !0,
417
+ writable: !0,
418
+ enumerable: !1,
419
+ value: t || null
420
+ }), e;
421
+ }
422
+ var Te = class {
423
+ level = 0;
424
+ indentation = " ";
425
+ compress = !1;
426
+ constructor(e) {
427
+ typeof e?.indent == "string" && (this.indentation = e?.indent), e?.compress && (this.compress = !0);
428
+ }
429
+ emit(e, t) {
430
+ return e;
431
+ }
432
+ indent(e) {
433
+ return this.level = this.level || 1, e ? (this.level += e, "") : Array(this.level).join(this.indentation);
434
+ }
435
+ visit(e) {
436
+ switch (e.type) {
437
+ case F.stylesheet: return this.stylesheet(e);
438
+ case F.rule: return this.rule(e);
439
+ case F.declaration: return this.declaration(e);
440
+ case F.comment: return this.comment(e);
441
+ case F.container: return this.container(e);
442
+ case F.charset: return this.charset(e);
443
+ case F.counterStyle: return this.counterStyle(e);
444
+ case F.document: return this.document(e);
445
+ case F.customMedia: return this.customMedia(e);
446
+ case F.fontFace: return this.fontFace(e);
447
+ case F.fontFeatureValues: return this.fontFeatureValues(e);
448
+ case F.host: return this.host(e);
449
+ case F.import: return this.import(e);
450
+ case F.keyframes: return this.keyframes(e);
451
+ case F.keyframe: return this.keyframe(e);
452
+ case F.layer: return this.layer(e);
453
+ case F.media: return this.media(e);
454
+ case F.namespace: return this.namespace(e);
455
+ case F.page: return this.page(e);
456
+ case F.pageMarginBox: return this.pageMarginBox(e);
457
+ case F.positionTry: return this.positionTry(e);
458
+ case F.property: return this.property(e);
459
+ case F.scope: return this.scope(e);
460
+ case F.startingStyle: return this.startingStyle(e);
461
+ case F.supports: return this.supports(e);
462
+ case F.viewTransition: return this.viewTransition(e);
463
+ case F.atRule: return this.genericAtRule(e);
464
+ }
465
+ }
466
+ mapVisit(e, t) {
467
+ let n = "";
468
+ t ||= "";
469
+ for (let r = 0, i = e.length; r < i; r++) n += this.visit(e[r]), t && r < i - 1 && (n += this.emit(t));
470
+ return n;
471
+ }
472
+ compile(e) {
473
+ return this.compress ? e.stylesheet.rules.map(this.visit, this).join("") : this.stylesheet(e);
474
+ }
475
+ stylesheet(e) {
476
+ return this.mapVisit(e.stylesheet.rules, "\n\n");
477
+ }
478
+ comment(e) {
479
+ return this.compress ? this.emit("", e.position) : this.emit(`${this.indent()}/*${e.comment}*/`, e.position);
480
+ }
481
+ container(e) {
482
+ return this.compress ? this.emit(`@container ${e.container}`, e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(`${this.indent()}@container ${e.container}`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`);
483
+ }
484
+ layer(e) {
485
+ return this.compress ? this.emit(`@layer ${e.layer}`, e.position) + (e.rules ? this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : ";") : this.emit(`${this.indent()}@layer ${e.layer}`, e.position) + (e.rules ? this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`) : ";");
486
+ }
487
+ import(e) {
488
+ return this.emit(`@import ${e.import};`, e.position);
489
+ }
490
+ media(e) {
491
+ return this.compress ? this.emit(`@media ${e.media}`, e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(`${this.indent()}@media ${e.media}`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`);
492
+ }
493
+ document(e) {
494
+ let t = `@${e.vendor || ""}document ${e.document}`;
495
+ return this.compress ? this.emit(t, e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(t, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`${this.indent(-1)}\n}`);
496
+ }
497
+ charset(e) {
498
+ return this.emit(`@charset ${e.charset};`, e.position);
499
+ }
500
+ namespace(e) {
501
+ return this.emit(`@namespace ${e.namespace};`, e.position);
502
+ }
503
+ startingStyle(e) {
504
+ return this.compress ? this.emit("@starting-style", e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(`${this.indent()}@starting-style`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`);
505
+ }
506
+ supports(e) {
507
+ return this.compress ? this.emit(`@supports ${e.supports}`, e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(`${this.indent()}@supports ${e.supports}`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`);
508
+ }
509
+ keyframes(e) {
510
+ return this.compress ? this.emit(`@${e.vendor || ""}keyframes ${e.name}`, e.position) + this.emit("{") + this.mapVisit(e.keyframes) + this.emit("}") : this.emit(`@${e.vendor || ""}keyframes ${e.name}`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.keyframes, "\n") + this.emit(`${this.indent(-1)}}`);
511
+ }
512
+ keyframe(e) {
513
+ let t = e.declarations;
514
+ return this.compress ? this.emit(e.values.join(","), e.position) + this.emit("{") + this.mapVisit(t) + this.emit("}") : this.emit(this.indent()) + this.emit(e.values.join(", "), e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(t, "\n") + this.emit(`${this.indent(-1)}\n${this.indent()}}\n`);
515
+ }
516
+ page(e) {
517
+ if (this.compress) {
518
+ let t = e.selectors.length ? e.selectors.join(", ") : "";
519
+ return this.emit(`@page ${t}`, e.position) + this.emit("{") + this.mapVisit(e.declarations) + this.emit("}");
520
+ }
521
+ let t = e.selectors.length ? `${e.selectors.join(", ")} ` : "";
522
+ return this.emit(`@page ${t}`, e.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(e.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}");
523
+ }
524
+ pageMarginBox(e) {
525
+ return this.compress ? this.emit(`@${e.name}`, e.position) + this.emit("{") + this.mapVisit(e.declarations) + this.emit("}") : this.emit(`${this.indent()}@${e.name} `, e.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(e.declarations, "\n") + this.emit(this.indent(-1)) + this.emit(`\n${this.indent()}}`);
526
+ }
527
+ fontFace(e) {
528
+ return this.compress ? this.emit("@font-face", e.position) + this.emit("{") + this.mapVisit(e.declarations) + this.emit("}") : this.emit("@font-face ", e.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(e.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}");
529
+ }
530
+ host(e) {
531
+ return this.compress ? this.emit("@host", e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit("@host", e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`${this.indent(-1)}\n}`);
532
+ }
533
+ customMedia(e) {
534
+ return this.emit(`@custom-media ${e.name} ${e.media};`, e.position);
535
+ }
536
+ property(e) {
537
+ return this.compress ? this.emit(`@property ${e.name}`, e.position) + this.emit("{") + this.mapVisit(e.declarations) + this.emit("}") : this.emit(`@property ${e.name} `, e.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(e.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}");
538
+ }
539
+ counterStyle(e) {
540
+ return this.compress ? this.emit(`@counter-style ${e.name}`, e.position) + this.emit("{") + this.mapVisit(e.declarations) + this.emit("}") : this.emit(`@counter-style ${e.name} `, e.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(e.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}");
541
+ }
542
+ fontFeatureValues(e) {
543
+ return this.compress ? this.emit(`@font-feature-values ${e.fontFamily}`, e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(`${this.indent()}@font-feature-values ${e.fontFamily}`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`);
544
+ }
545
+ scope(e) {
546
+ let t = e.scope ? ` ${e.scope}` : "";
547
+ return this.compress ? this.emit(`@scope${t}`, e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(`${this.indent()}@scope${t}`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`);
548
+ }
549
+ viewTransition(e) {
550
+ return this.compress ? this.emit("@view-transition", e.position) + this.emit("{") + this.mapVisit(e.declarations) + this.emit("}") : this.emit("@view-transition ", e.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(e.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}");
551
+ }
552
+ positionTry(e) {
553
+ return this.compress ? this.emit(`@position-try ${e.name}`, e.position) + this.emit("{") + this.mapVisit(e.declarations) + this.emit("}") : this.emit(`@position-try ${e.name} `, e.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(e.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}");
554
+ }
555
+ genericAtRule(e) {
556
+ let t = e.prelude ? ` ${e.prelude}` : "";
557
+ if (this.compress) return this.emit(`@${e.name}${t}`, e.position) + (e.rules ? this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : ";");
558
+ if (!e.rules) return this.emit(`${this.indent()}@${e.name}${t};`, e.position);
559
+ let n = e.rules.some((e) => e.type !== F.declaration && e.type !== F.comment), r = n ? "\n\n" : "\n";
560
+ return this.emit(`${this.indent()}@${e.name}${t}`, e.position) + this.emit(n ? ` {\n${this.indent(1)}` : " {\n") + this.emit(n ? "" : this.indent(1)) + this.mapVisit(e.rules, r) + this.emit(n ? `\n${this.indent(-1)}${this.indent()}}` : `${this.indent(-1)}\n${this.indent()}}`);
561
+ }
562
+ rule(e) {
563
+ let t = e.declarations;
564
+ if (!t.length) return "";
565
+ if (this.compress) return this.emit(e.selectors.join(","), e.position) + this.emit("{") + this.mapVisit(t) + this.emit("}");
566
+ let n = this.indent();
567
+ return this.emit(e.selectors.map((e) => n + e).join(",\n"), e.position) + this.emit(" {\n") + this.emit(this.indent(1)) + this.mapVisit(t, "\n") + this.emit(this.indent(-1)) + this.emit(`\n${this.indent()}}`);
568
+ }
569
+ declaration(e) {
570
+ return this.compress ? this.emit(`${e.property}:${e.value}`, e.position) + this.emit(";") : e.property === "grid-template-areas" ? this.emit(this.indent()) + this.emit(e.property + ": " + e.value.split("\n").join("\n".padEnd(22) + this.indent()), e.position) + this.emit(";") : this.emit(this.indent()) + this.emit(`${e.property}: ${e.value}`, e.position) + this.emit(";");
571
+ }
572
+ }, Ee = (e, t) => {
573
+ t ||= {};
574
+ let n = 1, r = 1;
575
+ function i() {
576
+ let e = {
577
+ line: n,
578
+ column: r
579
+ };
580
+ return (i) => (i.position = new we(e, {
581
+ line: n,
582
+ column: r
583
+ }, t?.source || ""), u(), i);
584
+ }
585
+ let a = [];
586
+ function o(i) {
587
+ let o = new Ce(t?.source || "", i, n, r, e);
588
+ if (!t?.silent) throw o;
589
+ a.push(o);
590
+ }
591
+ function s() {
592
+ let t = /^{\s*/.exec(e);
593
+ return !!t && (l(t), !0);
594
+ }
595
+ function c() {
596
+ let t = /^}/.exec(e);
597
+ return !!t && (l(t), !0);
598
+ }
599
+ function l(t) {
600
+ let i = t[0];
601
+ return function(e) {
602
+ let t = e.match(/\n/g);
603
+ t && (n += t.length);
604
+ let i = e.lastIndexOf("\n");
605
+ r = ~i ? e.length - i : r + e.length;
606
+ }(i), e = e.slice(i.length), t;
607
+ }
608
+ function u() {
609
+ let t = /^\s*/.exec(e);
610
+ t && l(t);
611
+ }
612
+ function d(e) {
613
+ e ||= [];
614
+ let t = f();
615
+ for (; t;) e.push(t), t = f();
616
+ return e;
617
+ }
618
+ function f() {
619
+ let t = i();
620
+ if (e.charAt(0) !== "/" || e.charAt(1) !== "*") return;
621
+ let n = /^\/\*[^]*?\*\//.exec(e);
622
+ return n ? (l(n), t({
623
+ type: F.comment,
624
+ comment: n[0].slice(2, -2)
625
+ })) : o("End of comment missing");
626
+ }
627
+ function p() {
628
+ let t = L(e, ["{"]);
629
+ if (t === -1 || t === 0) return;
630
+ let n = e.substring(0, t);
631
+ return l([n]), ((e, t) => {
632
+ let n = [], r = 0;
633
+ for (; r < e.length;) {
634
+ let i = L(e, t, r);
635
+ if (i === -1) return n.push(e.substring(r)), n;
636
+ n.push(e.substring(r, i)), r = i + 1;
637
+ }
638
+ return n;
639
+ })(z(n).replace(R, ""), [","]).map((e) => z(e));
640
+ }
641
+ function m() {
642
+ let t = i(), n = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);
643
+ if (!n) return;
644
+ l(n);
645
+ let r = z(n[0]), a = /^:\s*/.exec(e);
646
+ if (!a) return o("property missing ':'");
647
+ l(a);
648
+ let s = "", c = L(e, [";", "}"]);
649
+ c !== -1 && (s = e.substring(0, c), l([s]), s = z(s).replace(R, ""));
650
+ let u = t({
651
+ type: F.declaration,
652
+ property: r.replace(R, ""),
653
+ value: s
654
+ }), d = /^[;\s]*/.exec(e);
655
+ return d && l(d), u;
656
+ }
657
+ function h() {
658
+ let n = [];
659
+ if (!s()) return o("missing '{'");
660
+ d(n);
661
+ let r = m();
662
+ for (; r;) n.push(r), d(n), r = m();
663
+ for (; t?.silent && e.length && e.charAt(0) !== "}";) {
664
+ let t = e.indexOf(";"), i = e.indexOf("}");
665
+ if (t === -1 || !(i === -1 || t < i)) break;
666
+ for (l([e.substring(0, t + 1)]), u(), d(n), r = m(); r;) n.push(r), d(n), r = m();
667
+ }
668
+ return c() ? n : o("missing '}'");
669
+ }
670
+ function g() {
671
+ let t = L(e, ["{"]);
672
+ if (t === -1) return !1;
673
+ let n = L(e, [";"]), r = L(e, ["}"]);
674
+ return !(n !== -1 && n < t) && !(r !== -1 && r < t);
675
+ }
676
+ function _() {
677
+ let n = [];
678
+ if (!s()) return o("missing '{'");
679
+ for (d(n); e.length && e.charAt(0) !== "}";) {
680
+ if (e.charAt(0) === "@") {
681
+ let e = T();
682
+ if (e) {
683
+ n.push(e), d(n);
684
+ continue;
685
+ }
686
+ }
687
+ if (g()) {
688
+ let e = E();
689
+ if (e) {
690
+ n.push(e), d(n);
691
+ continue;
692
+ }
693
+ }
694
+ let r = m();
695
+ if (!r) {
696
+ if (t?.silent) {
697
+ let t = e.indexOf(";"), r = e.indexOf("}");
698
+ if (t !== -1 && (r === -1 || t < r)) {
699
+ l([e.substring(0, t + 1)]), u(), d(n);
700
+ continue;
701
+ }
702
+ }
703
+ break;
704
+ }
705
+ n.push(r), d(n);
706
+ }
707
+ return c() ? n : o("missing '}'");
708
+ }
709
+ function v() {
710
+ let n = [];
711
+ for (u(), d(n); e.length && e.charAt(0) !== "}";) {
712
+ if (e.charAt(0) === "@") {
713
+ let e = T();
714
+ if (e) {
715
+ n.push(e), d(n);
716
+ continue;
717
+ }
718
+ }
719
+ if (g()) {
720
+ let e = E();
721
+ if (e) {
722
+ n.push(e), d(n);
723
+ continue;
724
+ }
725
+ }
726
+ let r = m();
727
+ if (!r) {
728
+ if (t?.silent) {
729
+ let t = e.indexOf(";"), r = e.indexOf("}");
730
+ if (t !== -1 && (r === -1 || t < r)) {
731
+ l([e.substring(0, t + 1)]), u(), d(n);
732
+ continue;
733
+ }
734
+ }
735
+ break;
736
+ }
737
+ n.push(r), d(n);
738
+ }
739
+ return n;
740
+ }
741
+ function y() {
742
+ let t = [], n = i(), r = /^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);
743
+ for (; r;) {
744
+ let n = l(r);
745
+ t.push(n[1]);
746
+ let i = /^,\s*/.exec(e);
747
+ i && l(i), r = /^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);
748
+ }
749
+ if (t.length) return n({
750
+ type: F.keyframe,
751
+ values: t,
752
+ declarations: h() || []
753
+ });
754
+ }
755
+ let b = RegExp(`^@(${[
756
+ "top-left-corner",
757
+ "top-left",
758
+ "top-center",
759
+ "top-right",
760
+ "top-right-corner",
761
+ "bottom-left-corner",
762
+ "bottom-left",
763
+ "bottom-center",
764
+ "bottom-right",
765
+ "bottom-right-corner",
766
+ "left-top",
767
+ "left-middle",
768
+ "left-bottom",
769
+ "right-top",
770
+ "right-middle",
771
+ "right-bottom"
772
+ ].join("|")})(?![\\w-])\\s*`), x = w("import"), S = w("charset"), C = w("namespace");
773
+ function w(t) {
774
+ let n = RegExp("^@" + t + "\\s*((?::?[^;'\"]|\"(?:\\\\\"|[^\"])*?\"|'(?:\\\\'|[^'])*?')+)(?:;|$)");
775
+ return () => {
776
+ let r = i(), a = n.exec(e);
777
+ if (!a) return;
778
+ let o = l(a), s = { type: t };
779
+ return s[t] = o[1].trim(), r(s);
780
+ };
781
+ }
782
+ function T() {
783
+ if (e[0] === "@") return function() {
784
+ let t = i(), n = /^@([-\w]+)?keyframes\s*/.exec(e);
785
+ if (!n) return;
786
+ let r = l(n)[1], a = /^([-\w]+)\s*/.exec(e);
787
+ if (!a) return o("@keyframes missing name");
788
+ let u = l(a)[1];
789
+ if (!s()) return o("@keyframes missing '{'");
790
+ let f = d(), p = y();
791
+ for (; p;) f.push(p), f = f.concat(d()), p = y();
792
+ return c() ? t({
793
+ type: F.keyframes,
794
+ name: u,
795
+ vendor: r,
796
+ keyframes: f
797
+ }) : o("@keyframes missing '}'");
798
+ }() || function() {
799
+ let t = i(), n = /^@media *([^{]+)/.exec(e);
800
+ if (!n) return;
801
+ let r = z(l(n)[1]);
802
+ if (!s()) return o("@media missing '{'");
803
+ let a = v();
804
+ return c() ? t({
805
+ type: F.media,
806
+ media: r,
807
+ rules: a
808
+ }) : o("@media missing '}'");
809
+ }() || function() {
810
+ let t = i(), n = /^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(e);
811
+ if (!n) return;
812
+ let r = l(n);
813
+ return t({
814
+ type: F.customMedia,
815
+ name: z(r[1]),
816
+ media: z(r[2])
817
+ });
818
+ }() || function() {
819
+ let t = i(), n = /^@supports *([^{]+)/.exec(e);
820
+ if (!n) return;
821
+ let r = z(l(n)[1]);
822
+ if (!s()) return o("@supports missing '{'");
823
+ let a = v();
824
+ return c() ? t({
825
+ type: F.supports,
826
+ supports: r,
827
+ rules: a
828
+ }) : o("@supports missing '}'");
829
+ }() || x() || S() || C() || function() {
830
+ let t = i(), n = /^@([-\w]+)?document *([^{]+)/.exec(e);
831
+ if (!n) return;
832
+ let r = l(n), a = z(r[1]), u = z(r[2]);
833
+ if (!s()) return o("@document missing '{'");
834
+ let d = v();
835
+ return c() ? t({
836
+ type: F.document,
837
+ document: u,
838
+ vendor: a,
839
+ rules: d
840
+ }) : o("@document missing '}'");
841
+ }() || function() {
842
+ let t = i(), n = /^@page */.exec(e);
843
+ if (!n) return;
844
+ l(n);
845
+ let r = p() || [];
846
+ if (!s()) return o("@page missing '{'");
847
+ let a = [];
848
+ for (d(a); e.length && e.charAt(0) !== "}";) {
849
+ if (e.charAt(0) === "@") {
850
+ let e = T();
851
+ if (e) {
852
+ a.push(e), d(a);
853
+ continue;
854
+ }
855
+ }
856
+ let t = m();
857
+ if (!t) break;
858
+ a.push(t), d(a);
859
+ }
860
+ return c() ? t({
861
+ type: F.page,
862
+ selectors: r,
863
+ declarations: a
864
+ }) : o("@page missing '}'");
865
+ }() || function() {
866
+ let t = i(), n = /^@host\s*/.exec(e);
867
+ if (!n) return;
868
+ if (l(n), !s()) return o("@host missing '{'");
869
+ let r = v();
870
+ return c() ? t({
871
+ type: F.host,
872
+ rules: r
873
+ }) : o("@host missing '}'");
874
+ }() || function() {
875
+ let t = i(), n = /^@font-face\s*/.exec(e);
876
+ if (!n) return;
877
+ if (l(n), !s()) return o("@font-face missing '{'");
878
+ let r = d(), a = m();
879
+ for (; a;) r.push(a), r = r.concat(d()), a = m();
880
+ return c() ? t({
881
+ type: F.fontFace,
882
+ declarations: r
883
+ }) : o("@font-face missing '}'");
884
+ }() || function() {
885
+ let t = i(), n = /^@font-feature-values\s+([^{]+)/.exec(e);
886
+ if (!n) return;
887
+ let r = z(l(n)[1]);
888
+ if (!s()) return o("@font-feature-values missing '{'");
889
+ let a = v();
890
+ return c() ? t({
891
+ type: F.fontFeatureValues,
892
+ fontFamily: r,
893
+ rules: a
894
+ }) : o("@font-feature-values missing '}'");
895
+ }() || function() {
896
+ let t = i(), n = /^@container *([^{]+)/.exec(e);
897
+ if (!n) return;
898
+ let r = z(l(n)[1]);
899
+ if (!s()) return o("@container missing '{'");
900
+ let a = v();
901
+ return c() ? t({
902
+ type: F.container,
903
+ container: r,
904
+ rules: a
905
+ }) : o("@container missing '}'");
906
+ }() || function() {
907
+ let t = i(), n = /^@starting-style\s*/.exec(e);
908
+ if (!n) return;
909
+ if (l(n), !s()) return o("@starting-style missing '{'");
910
+ let r = v();
911
+ return c() ? t({
912
+ type: F.startingStyle,
913
+ rules: r
914
+ }) : o("@starting-style missing '}'");
915
+ }() || function() {
916
+ let t = i(), n = /^@layer *([^{;@]+)/.exec(e);
917
+ if (!n) return;
918
+ let r = z(l(n)[1]);
919
+ if (!s()) {
920
+ let n = /^[;\s]*/.exec(e);
921
+ return n && l(n), t({
922
+ type: F.layer,
923
+ layer: r
924
+ });
925
+ }
926
+ let a = v();
927
+ return c() ? t({
928
+ type: F.layer,
929
+ layer: r,
930
+ rules: a
931
+ }) : o("@layer missing '}'");
932
+ }() || function() {
933
+ let t = i(), n = /^@property\s+(--[-\w]+)\s*/.exec(e);
934
+ if (!n) return;
935
+ let r = l(n)[1];
936
+ if (!s()) return o("@property missing '{'");
937
+ let a = d(), u = m();
938
+ for (; u;) a.push(u), a = a.concat(d()), u = m();
939
+ return c() ? t({
940
+ type: F.property,
941
+ name: r,
942
+ declarations: a
943
+ }) : o("@property missing '}'");
944
+ }() || function() {
945
+ let t = i(), n = /^@counter-style\s+([-\w]+)\s*/.exec(e);
946
+ if (!n) return;
947
+ let r = l(n)[1];
948
+ if (!s()) return o("@counter-style missing '{'");
949
+ let a = d(), u = m();
950
+ for (; u;) a.push(u), a = a.concat(d()), u = m();
951
+ return c() ? t({
952
+ type: F.counterStyle,
953
+ name: r,
954
+ declarations: a
955
+ }) : o("@counter-style missing '}'");
956
+ }() || function() {
957
+ let t = i(), n = /^@scope\s*([^{]*)/.exec(e);
958
+ if (!n) return;
959
+ let r = z(l(n)[1]);
960
+ if (!s()) return o("@scope missing '{'");
961
+ let a = v();
962
+ return c() ? t({
963
+ type: F.scope,
964
+ scope: r,
965
+ rules: a
966
+ }) : o("@scope missing '}'");
967
+ }() || function() {
968
+ let t = i(), n = /^@view-transition\s*/.exec(e);
969
+ if (!n) return;
970
+ if (l(n), !s()) return o("@view-transition missing '{'");
971
+ let r = d(), a = m();
972
+ for (; a;) r.push(a), r = r.concat(d()), a = m();
973
+ return c() ? t({
974
+ type: F.viewTransition,
975
+ declarations: r
976
+ }) : o("@view-transition missing '}'");
977
+ }() || function() {
978
+ let t = i(), n = /^@position-try\s+(--[-\w]+)\s*/.exec(e);
979
+ if (!n) return;
980
+ let r = l(n)[1];
981
+ if (!s()) return o("@position-try missing '{'");
982
+ let a = d(), u = m();
983
+ for (; u;) a.push(u), a = a.concat(d()), u = m();
984
+ return c() ? t({
985
+ type: F.positionTry,
986
+ name: r,
987
+ declarations: a
988
+ }) : o("@position-try missing '}'");
989
+ }() || function() {
990
+ let t = i(), n = b.exec(e);
991
+ if (!n) return;
992
+ let r = l(n)[1];
993
+ if (!s()) return o(`@${r} missing '{'`);
994
+ let a = d(), u = m();
995
+ for (; u;) a.push(u), a = a.concat(d()), u = m();
996
+ return c() ? t({
997
+ type: F.pageMarginBox,
998
+ name: r,
999
+ declarations: a
1000
+ }) : o(`@${r} missing '}'`);
1001
+ }() || function() {
1002
+ let t = i(), n = /^@([-\w]+)\s*/.exec(e);
1003
+ if (!n) return;
1004
+ let r = l(n)[1], a = "", u = L(e, ["{", ";"]);
1005
+ if (u !== -1 && u > 0 && (a = z(e.substring(0, u)), l([e.substring(0, u)])), s()) {
1006
+ let e = v();
1007
+ return c() ? t({
1008
+ type: F.atRule,
1009
+ name: r,
1010
+ prelude: a,
1011
+ rules: e
1012
+ }) : o(`@${r} missing '}'`);
1013
+ }
1014
+ let d = /^[;\s]*/.exec(e);
1015
+ return d && l(d), t({
1016
+ type: F.atRule,
1017
+ name: r,
1018
+ prelude: a
1019
+ });
1020
+ }();
1021
+ }
1022
+ function E() {
1023
+ let e = i(), t = p();
1024
+ return t ? (d(), e({
1025
+ type: F.rule,
1026
+ selectors: t,
1027
+ declarations: _() || []
1028
+ })) : o("selector missing");
1029
+ }
1030
+ return B(function() {
1031
+ let n = function() {
1032
+ let n, r = [];
1033
+ for (u(), d(r); e.length;) {
1034
+ if (e.charAt(0) === "}") {
1035
+ if (t?.silent) {
1036
+ o("extra '}'"), l(["}"]), u(), d(r);
1037
+ continue;
1038
+ }
1039
+ break;
1040
+ }
1041
+ if (n = T() || E(), !n) {
1042
+ if (t?.silent) {
1043
+ l([e.charAt(0)]), u(), d(r);
1044
+ continue;
1045
+ }
1046
+ break;
1047
+ }
1048
+ r.push(n), d(r);
1049
+ }
1050
+ return r;
1051
+ }();
1052
+ return {
1053
+ type: F.stylesheet,
1054
+ stylesheet: {
1055
+ source: t?.source,
1056
+ rules: n,
1057
+ parsingErrors: a
1058
+ }
1059
+ };
1060
+ }());
1061
+ }, De = (e, t) => new Te(t || {}).compile(e), Oe = /* @__PURE__ */ a({
1062
+ appearPermission: () => V,
1063
+ appearUnsafePermission: () => H,
1064
+ permission: () => Ae,
1065
+ resolve: () => Fe,
1066
+ setInjectedStylesDisabled: () => q,
1067
+ type: () => ke
1068
+ }), ke = "addStyleTag", V = {
1069
+ scope: "media.appear",
1070
+ category: "media",
1071
+ severity: 0,
1072
+ title: "Change page appearance",
1073
+ description: "Lets the app restyle parts of the page — safely filtered."
1074
+ }, H = {
1075
+ scope: "media.appearU",
1076
+ category: "media",
1077
+ severity: 2,
1078
+ unsafe: !0,
1079
+ title: "Change page appearance (unsafe)",
1080
+ description: "Lets the app restyle the page WITHOUT safety filtering — could be used to leak data over the network."
1081
+ }, Ae = (e) => e?.noSanitize ? H : V, je = /(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i, Me = (e) => e.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (e, t) => String.fromCodePoint(Number.parseInt(t, 16))).replace(/\\(.)/g, "$1"), U = (e) => !je.test(Me(e.value)), W = (e) => {
1082
+ let t = [];
1083
+ for (let n of e) switch (n.type) {
1084
+ case F.import:
1085
+ case F.fontFace:
1086
+ case F.namespace:
1087
+ case F.charset:
1088
+ case F.document:
1089
+ case F.comment: continue;
1090
+ case F.rule:
1091
+ case F.page:
1092
+ t.push({
1093
+ ...n,
1094
+ declarations: n.declarations.filter((e) => e.type !== F.declaration || U(e))
1095
+ });
1096
+ continue;
1097
+ case F.media:
1098
+ case F.supports:
1099
+ case F.container:
1100
+ case F.host:
1101
+ case F.startingStyle:
1102
+ t.push({
1103
+ ...n,
1104
+ rules: W(n.rules)
1105
+ });
1106
+ continue;
1107
+ case F.layer:
1108
+ t.push({
1109
+ ...n,
1110
+ rules: n.rules ? W(n.rules) : void 0
1111
+ });
1112
+ continue;
1113
+ case F.keyframes:
1114
+ t.push({
1115
+ ...n,
1116
+ keyframes: n.keyframes.map((e) => e.type === F.keyframe ? {
1117
+ ...e,
1118
+ declarations: e.declarations.filter((e) => e.type !== F.declaration || U(e))
1119
+ } : e)
1120
+ });
1121
+ continue;
1122
+ default: continue;
1123
+ }
1124
+ return t;
1125
+ }, Ne = (e) => {
1126
+ let t;
1127
+ try {
1128
+ t = Ee(e, { silent: !0 });
1129
+ } catch {
1130
+ return "";
1131
+ }
1132
+ return t.stylesheet.rules = W(t.stylesheet.rules), De(t);
1133
+ }, Pe = (e) => {
1134
+ let t = () => {
1135
+ e.parentNode || (document.head ?? document.documentElement).appendChild(e);
1136
+ };
1137
+ t();
1138
+ let n = new MutationObserver((n) => {
1139
+ for (let r of n) for (let n of r.removedNodes) if (n === e || n.contains?.(e)) {
1140
+ t();
1141
+ return;
1142
+ }
1143
+ });
1144
+ n.observe(document.documentElement, {
1145
+ childList: !0,
1146
+ subtree: !0
1147
+ }), window.addEventListener("load", () => n.disconnect(), { once: !0 });
1148
+ }, G = /* @__PURE__ */ new Set(), K = !1, q = (e) => {
1149
+ K = e;
1150
+ for (let t of G) t.disabled = e;
1151
+ }, Fe = async (e, t) => {
1152
+ let n = document.createElement("style");
1153
+ n.textContent = t.noSanitize ? t.content : Ne(t.content);
1154
+ try {
1155
+ Pe(n);
1156
+ } catch (e) {
1157
+ console.error(e);
1158
+ }
1159
+ G.add(n), K && (n.disabled = !0);
1160
+ }, J = "frameLocator", Y = [
1161
+ {
1162
+ ...A,
1163
+ nextLocatorType: "locator"
1164
+ },
1165
+ P,
1166
+ ve
1167
+ ], X = [Oe], Ie = {
1168
+ type: J,
1169
+ selectorModules: Y,
1170
+ operationModules: X
1171
+ }, Le = Re({
1172
+ ownType: J,
1173
+ selectorModules: Y,
1174
+ operationModules: X
1175
+ });
1176
+ //#endregion
1177
+ //#region node_modules/@mfkn/web-extension/lib/content-script/resolvers/locators/factory.js
1178
+ function Re(e) {
1179
+ return (t, n, r = []) => ({
1180
+ ...Object.fromEntries(e.selectorModules.map((i) => [i.type, (...a) => {
1181
+ let o = [...r, {
1182
+ locatorType: e.ownType,
1183
+ type: i.type,
1184
+ args: a
1185
+ }];
1186
+ return (i.nextLocatorType ?? e.ownType) === "locator" ? Gt(t, n, o) : Le(t, n, o);
1187
+ }])),
1188
+ ...Object.fromEntries(e.operationModules.map(({ type: e }) => [e, (...i) => se(t, r, e, i, n)])),
1189
+ ensure: (e, t = {}) => n ? n(r, e, [t]) : Promise.resolve()
1190
+ });
1191
+ }
1192
+ //#endregion
1193
+ //#region node_modules/@mfkn/web-extension/lib/content-script/resolvers/locators/selectors/get-by-role.js
1194
+ var ze = /* @__PURE__ */ a({
1195
+ render: () => He,
1196
+ resolve: () => Ve,
1197
+ type: () => Be
1198
+ }), Be = "getByRole", Ve = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(`[role="${CSS.escape(t)}"]`)]), He = (e) => ({ fragment: typeof e == "string" ? `[role="${e.replaceAll("\"", "\\\"")}"]` : "[role]" }), Ue = /* @__PURE__ */ a({
1199
+ render: () => Ke,
1200
+ resolve: () => Ge,
1201
+ type: () => We
1202
+ }), We = "getByText", Ge = (e, t) => e.elements.flatMap((e) => [e, ...e.querySelectorAll("*")]).filter((e) => e.textContent?.includes(t)), Ke = (e) => ({ fragment: typeof e == "string" ? `:has-text("${e.replaceAll("\"", "\\\"")}")` : ":has-text(...)" }), qe = /* @__PURE__ */ a({
1203
+ render: () => Xe,
1204
+ resolve: () => Ye,
1205
+ type: () => Je
1206
+ }), Je = "getByTestId", Ye = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(`[data-testid="${CSS.escape(t)}"]`)]), Xe = (e) => ({ fragment: typeof e == "string" ? `[data-testid="${e.replaceAll("\"", "\\\"")}"]` : "[data-testid]" }), Ze = /* @__PURE__ */ a({
1207
+ render: () => et,
1208
+ resolve: () => $e,
1209
+ type: () => Qe
1210
+ }), Qe = "first", $e = (e) => e.elements.slice(0, 1), et = () => ({ fragment: ":first" }), tt = /* @__PURE__ */ a({
1211
+ render: () => rt,
1212
+ resolve: () => nt,
1213
+ type: () => "nth"
1214
+ }), nt = (e, t) => {
1215
+ let n = e.elements.at(t);
1216
+ return n ? [n] : [];
1217
+ }, rt = (e) => ({ fragment: typeof e == "number" ? `:nth(${e})` : ":nth(?)" }), it = (e) => {
1218
+ let t = Error(e);
1219
+ return t.name = "LocatorError", t;
1220
+ }, Z = (e) => {
1221
+ if (e.length === 0) throw it("No elements found");
1222
+ if (e.length > 1) throw it(`Strict mode violation: locator resolved to ${e.length} elements`);
1223
+ return e[0];
1224
+ }, at = /* @__PURE__ */ a({
1225
+ permission: () => st,
1226
+ resolve: () => ct,
1227
+ type: () => ot
1228
+ }), ot = "click", st = {
1229
+ scope: "act.click",
1230
+ category: "act",
1231
+ severity: 3,
1232
+ title: "Click on the page",
1233
+ description: "Lets the app press buttons or links for you."
1234
+ }, ct = (e, t = {}) => {
1235
+ let n = Z(e.elements), r = n.getBoundingClientRect(), i = t.position?.x ?? .5, a = t.position?.y ?? .5, o = {
1236
+ bubbles: !0,
1237
+ cancelable: !0,
1238
+ composed: !0,
1239
+ clientX: r.left + r.width * i,
1240
+ clientY: r.top + r.height * a,
1241
+ button: 0
1242
+ }, s = {
1243
+ ...o,
1244
+ buttons: 1,
1245
+ pointerType: "mouse",
1246
+ pointerId: 1,
1247
+ isPrimary: !0
1248
+ }, c = {
1249
+ ...o,
1250
+ buttons: 1
1251
+ }, l = {
1252
+ ...o,
1253
+ buttons: 0
1254
+ };
1255
+ n.dispatchEvent(new PointerEvent("pointerdown", s)), n.dispatchEvent(new MouseEvent("mousedown", c)), n.dispatchEvent(new PointerEvent("pointerup", {
1256
+ ...s,
1257
+ buttons: 0
1258
+ })), n.dispatchEvent(new MouseEvent("mouseup", l)), n.dispatchEvent(new MouseEvent("click", l));
1259
+ }, lt = /* @__PURE__ */ a({
1260
+ permission: () => dt,
1261
+ resolve: () => mt,
1262
+ type: () => ut
1263
+ }), ut = "fill", dt = {
1264
+ scope: "act.type",
1265
+ category: "act",
1266
+ severity: 1,
1267
+ title: "Type into a text field",
1268
+ description: "Lets the app fill in form fields on your behalf."
1269
+ }, ft = (e, t) => {
1270
+ e._valueTracker?.setValue("");
1271
+ let n = e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype, r = Object.getOwnPropertyDescriptor(n, "value")?.set;
1272
+ r ? r.call(e, t) : e.value = t;
1273
+ }, pt = (e, t) => {
1274
+ if (e.type !== "range") return null;
1275
+ let n = Number(e.min || 0), r = Number(e.max || 100);
1276
+ if (!Number.isFinite(n) || !Number.isFinite(r) || r <= n) return null;
1277
+ let i = Number(t);
1278
+ if (!Number.isFinite(i)) return null;
1279
+ let a = Math.max(0, Math.min(1, (i - n) / (r - n))), o = e.getBoundingClientRect(), s = {
1280
+ bubbles: !0,
1281
+ cancelable: !0,
1282
+ composed: !0,
1283
+ clientX: o.left + o.width * a,
1284
+ clientY: o.top + o.height / 2,
1285
+ button: 0
1286
+ };
1287
+ return {
1288
+ pointerDown: {
1289
+ ...s,
1290
+ buttons: 1,
1291
+ pointerType: "mouse",
1292
+ pointerId: 1,
1293
+ isPrimary: !0
1294
+ },
1295
+ pointerUp: {
1296
+ ...s,
1297
+ buttons: 0,
1298
+ pointerType: "mouse",
1299
+ pointerId: 1,
1300
+ isPrimary: !0
1301
+ },
1302
+ mouseDown: {
1303
+ ...s,
1304
+ buttons: 1
1305
+ },
1306
+ mouseUp: {
1307
+ ...s,
1308
+ buttons: 0
1309
+ }
1310
+ };
1311
+ }, mt = (e, t, n = {}) => {
1312
+ let r = Z(e.elements);
1313
+ if (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement) {
1314
+ let e = r instanceof HTMLInputElement ? pt(r, t) : null;
1315
+ if (e) {
1316
+ r.dispatchEvent(new PointerEvent("pointerdown", e.pointerDown)), r.dispatchEvent(new MouseEvent("mousedown", e.mouseDown)), ft(r, t), r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new PointerEvent("pointerup", e.pointerUp)), r.dispatchEvent(new MouseEvent("mouseup", e.mouseUp)), r.dispatchEvent(new Event("change", { bubbles: !0 }));
1317
+ return;
1318
+ }
1319
+ ft(r, t), r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new Event("change", { bubbles: !0 }));
1320
+ return;
1321
+ }
1322
+ if (r instanceof HTMLElement && r.isContentEditable) {
1323
+ r.textContent = t, r.dispatchEvent(new Event("input", { bubbles: !0 }));
1324
+ return;
1325
+ }
1326
+ throw Error(`fill: element <${r.tagName.toLowerCase()}> is not fillable`);
1327
+ }, ht = /* @__PURE__ */ a({
1328
+ permission: () => _t,
1329
+ resolve: () => vt,
1330
+ type: () => gt
1331
+ }), gt = "hover", _t = {
1332
+ scope: "act.hover",
1333
+ category: "act",
1334
+ severity: 1,
1335
+ title: "Hover over the page",
1336
+ description: "Lets the app point at things to reveal menus or tooltips."
1337
+ }, vt = (e, t = {}) => {
1338
+ let n = Z(e.elements), r = n.getBoundingClientRect(), i = {
1339
+ bubbles: !0,
1340
+ cancelable: !0,
1341
+ composed: !0,
1342
+ clientX: r.left + r.width * (t.position?.x ?? .5),
1343
+ clientY: r.top + r.height * (t.position?.y ?? .5)
1344
+ }, a = {
1345
+ ...i,
1346
+ pointerType: "mouse",
1347
+ pointerId: 1,
1348
+ isPrimary: !0
1349
+ };
1350
+ n.dispatchEvent(new PointerEvent("pointerover", a)), n.dispatchEvent(new PointerEvent("pointerenter", {
1351
+ ...a,
1352
+ bubbles: !1
1353
+ })), n.dispatchEvent(new MouseEvent("mouseenter", {
1354
+ ...i,
1355
+ bubbles: !1
1356
+ })), n.dispatchEvent(new MouseEvent("mouseover", i)), n.dispatchEvent(new PointerEvent("pointermove", a)), n.dispatchEvent(new MouseEvent("mousemove", i));
1357
+ }, yt = /* @__PURE__ */ a({
1358
+ permission: () => xt,
1359
+ resolve: () => St,
1360
+ type: () => bt
1361
+ }), bt = "textContent", xt = {
1362
+ scope: "read.text",
1363
+ category: "read",
1364
+ severity: 1,
1365
+ title: "Read text from the page",
1366
+ description: "Lets the app see the text shown on this page."
1367
+ }, St = (e, t = {}) => Z(e.elements).textContent, Ct = /* @__PURE__ */ a({
1368
+ permission: () => Tt,
1369
+ resolve: () => Et,
1370
+ type: () => wt
1371
+ }), wt = "isVisible", Tt = {
1372
+ scope: "read.visible",
1373
+ category: "read",
1374
+ severity: 0,
1375
+ title: "See what’s visible on the page",
1376
+ description: "Lets the app check which elements are currently on screen."
1377
+ }, Et = (e, t = {}) => {
1378
+ let n = Z(e.elements);
1379
+ if (!(n instanceof HTMLElement)) return !0;
1380
+ let r = n.ownerDocument.defaultView?.getComputedStyle(n);
1381
+ if (r?.display === "none" || r?.visibility === "hidden") return !1;
1382
+ let i = n.getBoundingClientRect();
1383
+ return i.width > 0 && i.height > 0;
1384
+ }, Dt = /* @__PURE__ */ a({
1385
+ permission: () => kt,
1386
+ resolve: () => At,
1387
+ type: () => Ot
1388
+ }), Ot = "count", kt = {
1389
+ scope: "read.count",
1390
+ category: "read",
1391
+ severity: 0,
1392
+ title: "Count items on the page",
1393
+ description: "Lets the app count how many matching elements are present."
1394
+ }, At = (e, t = {}) => e.elements.length, jt = /* @__PURE__ */ a({
1395
+ permission: () => Nt,
1396
+ resolve: () => Pt,
1397
+ type: () => Mt
1398
+ }), Mt = "exists", Nt = {
1399
+ scope: "read.check",
1400
+ category: "read",
1401
+ severity: 0,
1402
+ title: "Check if something is on the page",
1403
+ description: "Lets the app test whether a specific element exists."
1404
+ }, Pt = (e, t = {}) => e.elements.length > 0, Ft = /* @__PURE__ */ a({
1405
+ permission: () => Lt,
1406
+ resolve: () => Rt,
1407
+ type: () => It
1408
+ }), It = "getAttribute", Lt = {
1409
+ scope: "read.info",
1410
+ category: "read",
1411
+ severity: 1,
1412
+ title: "Read info from the page",
1413
+ description: "Lets the app read the href value from a part of the page."
1414
+ }, Rt = (e, t, n = {}) => Z(e.elements).getAttribute(t), zt = /* @__PURE__ */ a({
1415
+ permission: () => Vt,
1416
+ resolve: () => Ht,
1417
+ type: () => Bt
1418
+ }), Bt = "videoElement", Vt = {
1419
+ scope: "media.video",
1420
+ category: "media",
1421
+ severity: 0,
1422
+ title: "Control video playback",
1423
+ description: "Lets the app play, pause, seek, and read the video on the page."
1424
+ }, Ht = (e, t = {}) => {
1425
+ let n = Z(e.elements);
1426
+ if (!(n instanceof HTMLVideoElement)) throw Error(`videoElement: expected <video>, got <${n.tagName.toLowerCase()}>`);
1427
+ return T(n);
1428
+ }, Q = "locator", Ut = [
1429
+ A,
1430
+ {
1431
+ ...P,
1432
+ nextLocatorType: "frameLocator"
1433
+ },
1434
+ ze,
1435
+ Ue,
1436
+ qe,
1437
+ Ze,
1438
+ tt
1439
+ ], $ = [
1440
+ at,
1441
+ lt,
1442
+ ht,
1443
+ yt,
1444
+ Ct,
1445
+ Dt,
1446
+ jt,
1447
+ Ft,
1448
+ zt
1449
+ ], Wt = {
1450
+ type: Q,
1451
+ selectorModules: Ut,
1452
+ operationModules: $
1453
+ }, Gt = Re({
1454
+ ownType: Q,
1455
+ selectorModules: Ut,
1456
+ operationModules: $
1457
+ });
1458
+ //#endregion
1459
+ export { J as a, k as c, T as d, E as f, a as g, i as h, Ie as i, ee as l, u as m, Q as n, q as o, O as p, Le as r, fe as s, Wt as t, D as u };