@fkn/lib 0.9.45 → 0.9.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{api-Cuf3ynZX.d.ts → api-DOXb_WrB.d.ts} +1 -1
- package/api.d.ts +2 -2
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud-CUzZFzG3.cjs +1 -0
- package/{cloud-KBzjWzt1.d.ts → cloud-DSx-jDFk.d.ts} +3 -3
- package/cloud-v5x4uhDC.js +552 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -3
- package/cloud.js +1 -1
- package/{contract-DP_jc5pZ.d.ts → contract-BmLpSueo.d.ts} +3 -10
- package/contract.d.ts +2 -2
- package/dgram.d.ts +2 -2
- package/dns.d.ts +1 -1
- package/extension-3bxlAW8M.cjs +1 -0
- package/extension-BnVG0YL4.js +94 -0
- package/{extension-X8cnvZej.d.ts → extension-C2tBRE9i.d.ts} +20 -2
- package/extension.cjs +1 -1
- package/extension.d.ts +2 -2
- package/extension.js +3 -3
- package/http.d.ts +1 -1
- package/{index-C8Y-YHrU.d.ts → index-B98wvTaI.d.ts} +6 -1
- package/index.cjs +1 -1
- package/index.d.ts +4 -4
- package/index.js +12 -12
- package/lib-47LPHYgB.cjs +53 -0
- package/{lib-H5-e2A1h.js → lib-BFwrzgpu.js} +439 -436
- package/{net-eyWUIVn2.d.ts → net-BFjtzAK0.d.ts} +2 -2
- package/net.d.ts +1 -1
- package/package.json +1 -1
- package/packages.d.ts +1 -1
- package/{proxy-8Zp-G5da.d.ts → proxy-BrsMJmiK.d.ts} +2 -2
- package/rooms.d.ts +1 -1
- package/cloud-CKCrMMB_.cjs +0 -1
- package/cloud-CVWGyZRT.js +0 -559
- package/extension-Dmnh5pcs.js +0 -94
- package/extension-YBe6Q6r_.cjs +0 -1
- package/lib-D4uqe_rb.cjs +0 -53
|
@@ -31,12 +31,12 @@ var ne = (e, t) => {
|
|
|
31
31
|
o && (e.removeEventListener(t, o), r.delete(t));
|
|
32
32
|
}
|
|
33
33
|
}), n;
|
|
34
|
-
},
|
|
34
|
+
}, b = (e) => typeof e == "boolean" ? +!!e : +!!e?.capture, x = (e) => {
|
|
35
35
|
let t = /* @__PURE__ */ new WeakMap();
|
|
36
36
|
return {
|
|
37
37
|
addEventListener: (n, r, i) => {
|
|
38
38
|
if (r === null) return;
|
|
39
|
-
let a = `${n}|${
|
|
39
|
+
let a = `${n}|${b(i)}`, o = t.get(r);
|
|
40
40
|
if (o || (o = /* @__PURE__ */ new Map(), t.set(r, o)), o.has(a)) return;
|
|
41
41
|
let s = typeof i == "object" && !!i && !!i.once, c = (t) => {
|
|
42
42
|
s && o.delete(a);
|
|
@@ -47,18 +47,18 @@ var ne = (e, t) => {
|
|
|
47
47
|
},
|
|
48
48
|
removeEventListener: (n, r, i) => {
|
|
49
49
|
if (r === null) return;
|
|
50
|
-
let a = `${n}|${
|
|
50
|
+
let a = `${n}|${b(i)}`, o = t.get(r), s = o?.get(a);
|
|
51
51
|
s && (e.remoteEvents.removeEventListener(n, s, i), o.delete(a));
|
|
52
52
|
},
|
|
53
53
|
dispatchEvent: (t) => e.remoteEvents.dispatchEvent(t)
|
|
54
54
|
};
|
|
55
|
-
},
|
|
55
|
+
}, S = /* @__PURE__ */ e({
|
|
56
56
|
box: () => ye,
|
|
57
57
|
createVideoElementHandle: () => _e,
|
|
58
58
|
isType: () => ve,
|
|
59
59
|
revive: () => be,
|
|
60
|
-
type: () =>
|
|
61
|
-
}),
|
|
60
|
+
type: () => C
|
|
61
|
+
}), C = "videoElement", re = [
|
|
62
62
|
"currentTime",
|
|
63
63
|
"volume",
|
|
64
64
|
"muted",
|
|
@@ -69,17 +69,17 @@ var ne = (e, t) => {
|
|
|
69
69
|
"preload",
|
|
70
70
|
"poster",
|
|
71
71
|
"disableRemotePlayback"
|
|
72
|
-
],
|
|
72
|
+
], ie = [
|
|
73
73
|
"duration",
|
|
74
74
|
"paused",
|
|
75
75
|
"ended",
|
|
76
76
|
"seeking",
|
|
77
77
|
"readyState",
|
|
78
78
|
"currentSrc"
|
|
79
|
-
],
|
|
79
|
+
], ae = ["buffered", "seekable"], oe = Symbol.for("fkn.remoteVideoElement"), se = Symbol.for("fkn.remoteVideoElement.state"), ce = Symbol.for("fkn.remoteVideoElement.controller"), le = (e) => e ? Array.from({ length: e.length }, (t, n) => [e.start(n), e.end(n)]) : [], ue = (e) => {
|
|
80
80
|
let t = {};
|
|
81
|
-
for (let n of [...
|
|
82
|
-
for (let n of
|
|
81
|
+
for (let n of [...re, ...ie]) t[n] = e[n];
|
|
82
|
+
for (let n of ae) t[n] = le(e[n]);
|
|
83
83
|
return t.error = e.error ? {
|
|
84
84
|
code: e.error.code,
|
|
85
85
|
message: e.error.message
|
|
@@ -108,7 +108,7 @@ var ne = (e, t) => {
|
|
|
108
108
|
MEDIA_ERR_SRC_NOT_SUPPORTED: 4
|
|
109
109
|
} : null, pe = (e) => ne(e, (e, t) => ({
|
|
110
110
|
originalDetail: e instanceof CustomEvent ? e.detail : null,
|
|
111
|
-
snapshot:
|
|
111
|
+
snapshot: ue(t)
|
|
112
112
|
})), me = async (e, t) => {
|
|
113
113
|
switch (t) {
|
|
114
114
|
case "play": return await e.play(), null;
|
|
@@ -130,13 +130,13 @@ var ne = (e, t) => {
|
|
|
130
130
|
try {
|
|
131
131
|
e[t] = n;
|
|
132
132
|
} catch {}
|
|
133
|
-
return
|
|
133
|
+
return ue(e);
|
|
134
134
|
},
|
|
135
135
|
events: pe(e)
|
|
136
136
|
}), ge = (e, t) => {
|
|
137
137
|
let n = new EventTarget();
|
|
138
|
-
Object.defineProperty(n,
|
|
139
|
-
let r =
|
|
138
|
+
Object.defineProperty(n, oe, { value: !0 }), Object.defineProperty(n, se, { value: e }), Object.defineProperty(n, ce, { value: t });
|
|
139
|
+
let r = x({
|
|
140
140
|
target: n,
|
|
141
141
|
remoteEvents: t.events,
|
|
142
142
|
unenrich: (t, n) => {
|
|
@@ -207,7 +207,7 @@ var ne = (e, t) => {
|
|
|
207
207
|
value: 4
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
|
-
for (let n of
|
|
210
|
+
for (let n of re) i[n] = {
|
|
211
211
|
configurable: !0,
|
|
212
212
|
enumerable: !0,
|
|
213
213
|
get() {
|
|
@@ -219,14 +219,14 @@ var ne = (e, t) => {
|
|
|
219
219
|
}, () => {});
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
|
-
for (let t of
|
|
222
|
+
for (let t of ie) i[t] = {
|
|
223
223
|
configurable: !0,
|
|
224
224
|
enumerable: !0,
|
|
225
225
|
get() {
|
|
226
226
|
return e[t];
|
|
227
227
|
}
|
|
228
228
|
};
|
|
229
|
-
for (let t of
|
|
229
|
+
for (let t of ae) i[t] = {
|
|
230
230
|
configurable: !0,
|
|
231
231
|
enumerable: !0,
|
|
232
232
|
get() {
|
|
@@ -234,18 +234,18 @@ var ne = (e, t) => {
|
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
236
|
return Object.defineProperties(n, i), n;
|
|
237
|
-
}, _e = (e) => ge(
|
|
237
|
+
}, _e = (e) => ge(ue(e), he(e)), ve = (e) => typeof e == "object" && !!e && e[oe] === !0, ye = (e, t) => {
|
|
238
238
|
let n = e;
|
|
239
239
|
return {
|
|
240
240
|
..._,
|
|
241
|
-
type:
|
|
242
|
-
initialState: n[
|
|
243
|
-
controller: ee(n[
|
|
241
|
+
type: C,
|
|
242
|
+
initialState: n[se],
|
|
243
|
+
controller: ee(n[ce], t)
|
|
244
244
|
};
|
|
245
245
|
}, be = (e, t) => {
|
|
246
246
|
let n = te(e.controller, t);
|
|
247
247
|
return ge({ ...e.initialState }, n);
|
|
248
|
-
}, xe = (e) => [
|
|
248
|
+
}, xe = (e) => [S, ...e], Se = 4, Ce = 0, we = "fknExtension", Te = "fknExtensionAbi", Ee = "fknExtensionOps", De = [
|
|
249
249
|
"data-fkn-extension",
|
|
250
250
|
"data-fkn-extension-abi",
|
|
251
251
|
"data-fkn-extension-ops"
|
|
@@ -332,16 +332,16 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
|
|
|
332
332
|
"fkn.app",
|
|
333
333
|
"fkn.dev",
|
|
334
334
|
"sdbx.app"
|
|
335
|
-
], Ke = (e) => e.replace(/\.+$/, ""),
|
|
335
|
+
], Ke = (e) => e.replace(/\.+$/, ""), A = (e) => {
|
|
336
336
|
let t = Ke(e);
|
|
337
337
|
return Ge.some((e) => t === e || t.endsWith(`.${e}`));
|
|
338
|
-
},
|
|
338
|
+
}, qe = {
|
|
339
339
|
scope: "network.fetch",
|
|
340
340
|
category: "network",
|
|
341
341
|
severity: 0,
|
|
342
342
|
title: "Fetch data from other sites",
|
|
343
343
|
description: "Lets the app download public data from other websites directly, past the usual cross-origin limits."
|
|
344
|
-
},
|
|
344
|
+
}, Je = {
|
|
345
345
|
scope: "network.fetchCredentialed",
|
|
346
346
|
category: "network",
|
|
347
347
|
severity: 3,
|
|
@@ -349,7 +349,7 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
|
|
|
349
349
|
unsafe: !0,
|
|
350
350
|
title: "Fetch from other sites, signed in as you",
|
|
351
351
|
description: "Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see."
|
|
352
|
-
},
|
|
352
|
+
}, Ye = {
|
|
353
353
|
scope: "network.fetchLocal",
|
|
354
354
|
category: "network",
|
|
355
355
|
severity: 3,
|
|
@@ -357,12 +357,12 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
|
|
|
357
357
|
unsafe: !0,
|
|
358
358
|
title: "Access devices on your local network",
|
|
359
359
|
description: "Lets the app reach devices and services on your home or work network, which websites normally cannot touch."
|
|
360
|
-
},
|
|
360
|
+
}, Xe = (e) => {
|
|
361
361
|
let t = e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);
|
|
362
362
|
if (!t) return !1;
|
|
363
363
|
let [n, r] = [Number(t[1]), Number(t[2])];
|
|
364
364
|
return n === 10 || n === 127 || n === 0 || n === 169 && r === 254 || n === 172 && r >= 16 && r <= 31 || n === 192 && r === 168;
|
|
365
|
-
},
|
|
365
|
+
}, Ze = (e) => {
|
|
366
366
|
let t;
|
|
367
367
|
try {
|
|
368
368
|
t = new URL(e);
|
|
@@ -370,27 +370,27 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
|
|
|
370
370
|
return !1;
|
|
371
371
|
}
|
|
372
372
|
let n = t.hostname.replace(/^\[|\]$/g, "").toLowerCase().replace(/\.$/, "");
|
|
373
|
-
return n === "localhost" || n.endsWith(".localhost") || n.endsWith(".local") || n.endsWith(".internal") || n.endsWith(".home.arpa") ? !0 : n.includes(":") ? n === "::" || n === "::1" || n.startsWith("fc") || n.startsWith("fd") || /^fe[89ab]/.test(n) || n.startsWith("::ffff:") :
|
|
374
|
-
},
|
|
373
|
+
return n === "localhost" || n.endsWith(".localhost") || n.endsWith(".local") || n.endsWith(".internal") || n.endsWith(".home.arpa") ? !0 : n.includes(":") ? n === "::" || n === "::1" || n.startsWith("fc") || n.startsWith("fd") || /^fe[89ab]/.test(n) || n.startsWith("::ffff:") : Xe(n);
|
|
374
|
+
}, Qe = (e) => {
|
|
375
375
|
let t;
|
|
376
376
|
try {
|
|
377
377
|
t = new URL(e);
|
|
378
378
|
} catch {
|
|
379
379
|
return !1;
|
|
380
380
|
}
|
|
381
|
-
return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" ||
|
|
381
|
+
return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || A(t.hostname);
|
|
382
|
+
}, $e = (e) => {
|
|
383
|
+
if (Qe(e)) throw Error("fetch: refusing to target the extension's own pages or FKN platform domains");
|
|
382
384
|
}, et = (e) => {
|
|
383
|
-
if ($e(e)) throw Error("fetch: refusing to target the extension's own pages or FKN platform domains");
|
|
384
|
-
}, tt = (e) => {
|
|
385
385
|
if (!e?.headers) return;
|
|
386
386
|
let t = new Headers(e.headers), n = Be.map((e) => {
|
|
387
387
|
let n = t.get(e);
|
|
388
388
|
return n === null || n === "" ? void 0 : [e, n];
|
|
389
389
|
}).filter((e) => e !== void 0);
|
|
390
390
|
return n.length ? n : void 0;
|
|
391
|
-
},
|
|
391
|
+
}, tt = async (e, t) => {
|
|
392
392
|
let n = new Request(e, t);
|
|
393
|
-
|
|
393
|
+
$e(n.url);
|
|
394
394
|
let r = n.body ? await n.arrayBuffer() : null;
|
|
395
395
|
return k.proxyFetch({
|
|
396
396
|
url: n.url,
|
|
@@ -399,11 +399,28 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
|
|
|
399
399
|
body: r,
|
|
400
400
|
credentials: t?.credentials === "include" ? "include" : "omit",
|
|
401
401
|
redirect: n.redirect,
|
|
402
|
-
unsafeHeaders:
|
|
402
|
+
unsafeHeaders: et(t),
|
|
403
403
|
reason: t?.reason,
|
|
404
404
|
signal: t?.signal ?? void 0
|
|
405
405
|
});
|
|
406
|
-
},
|
|
406
|
+
}, nt = (e) => {
|
|
407
|
+
for (let t of e) if (typeof t == "string" && A(t.trim().toLowerCase())) return t;
|
|
408
|
+
}, rt = (e) => {
|
|
409
|
+
let t = e.trim().toLowerCase().replace(/^\.+|\.+$/g, "");
|
|
410
|
+
return t !== "" && (A(t) || Ge.some((e) => e.endsWith(`.${t}`)));
|
|
411
|
+
}, it = (e) => {
|
|
412
|
+
for (let t of e) if (typeof t == "string" && rt(t)) return t;
|
|
413
|
+
}, at = (e) => `${e}: refusing to target FKN platform domains`, ot = (e, t) => {
|
|
414
|
+
if (nt(t) !== void 0) throw Error(at(e));
|
|
415
|
+
}, st = (e) => {
|
|
416
|
+
try {
|
|
417
|
+
return new URL(String(e)).hostname;
|
|
418
|
+
} catch {
|
|
419
|
+
return "";
|
|
420
|
+
}
|
|
421
|
+
}, ct = (e, t) => {
|
|
422
|
+
if (it(t) !== void 0) throw Error(at(e));
|
|
423
|
+
}, lt = {
|
|
407
424
|
scope: "network.readCookie",
|
|
408
425
|
category: "network",
|
|
409
426
|
severity: 3,
|
|
@@ -411,7 +428,7 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
|
|
|
411
428
|
unsafe: !0,
|
|
412
429
|
title: "Read a site’s cookie",
|
|
413
430
|
description: "Lets the app read a named cookie from another site, which can include the login token only that site should see."
|
|
414
|
-
},
|
|
431
|
+
}, ut = { get: async (e) => (ot("cookies.get", [st(e.url)]), k.getCookie(e)) }, dt = {
|
|
415
432
|
scope: "network.modifyRequestHeaders",
|
|
416
433
|
category: "network",
|
|
417
434
|
severity: 2,
|
|
@@ -419,7 +436,7 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
|
|
|
419
436
|
unsafe: !0,
|
|
420
437
|
title: "Rewrite request headers to other sites",
|
|
421
438
|
description: "Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites."
|
|
422
|
-
},
|
|
439
|
+
}, ft = async (e) => (ct("setRequestHeaderRule", e.domains), k.setRequestHeaderRule(e)), pt = (e) => k.removeRequestHeaderRule({ ruleId: e }), mt = class extends Error {
|
|
423
440
|
reason;
|
|
424
441
|
filename;
|
|
425
442
|
line;
|
|
@@ -428,18 +445,18 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
|
|
|
428
445
|
constructor(e, t, n, r, i) {
|
|
429
446
|
super(`${e}:${n}:${r}: ${t}`), this.reason = t, this.filename = e, this.line = n, this.column = r, this.source = i;
|
|
430
447
|
}
|
|
431
|
-
},
|
|
448
|
+
}, ht = class {
|
|
432
449
|
start;
|
|
433
450
|
end;
|
|
434
451
|
source;
|
|
435
452
|
constructor(e, t, n) {
|
|
436
453
|
this.start = e, this.end = t, this.source = n;
|
|
437
454
|
}
|
|
438
|
-
},
|
|
455
|
+
}, j;
|
|
439
456
|
(function(e) {
|
|
440
457
|
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";
|
|
441
|
-
})(
|
|
442
|
-
var
|
|
458
|
+
})(j ||= {});
|
|
459
|
+
var gt = (e, t, n) => {
|
|
443
460
|
let r = n, i = 1e4;
|
|
444
461
|
do {
|
|
445
462
|
let n = t.map((t) => e.indexOf(t, r));
|
|
@@ -451,7 +468,7 @@ var ut = (e, t, n) => {
|
|
|
451
468
|
r = o + 2, i--;
|
|
452
469
|
} while (i > 0);
|
|
453
470
|
throw Error("Too many escaping");
|
|
454
|
-
},
|
|
471
|
+
}, M = (e, t, n) => {
|
|
455
472
|
let r = n, i = 1e4;
|
|
456
473
|
do {
|
|
457
474
|
let n = t.map((t) => e.indexOf(t, r));
|
|
@@ -465,21 +482,21 @@ var ut = (e, t, n) => {
|
|
|
465
482
|
break;
|
|
466
483
|
case "(":
|
|
467
484
|
{
|
|
468
|
-
let t =
|
|
485
|
+
let t = M(e, [")"], o + 1);
|
|
469
486
|
if (t === -1) return -1;
|
|
470
487
|
r = t + 1;
|
|
471
488
|
}
|
|
472
489
|
break;
|
|
473
490
|
case "\"":
|
|
474
491
|
{
|
|
475
|
-
let t =
|
|
492
|
+
let t = gt(e, ["\""], o + 1);
|
|
476
493
|
if (t === -1) return -1;
|
|
477
494
|
r = t + 1;
|
|
478
495
|
}
|
|
479
496
|
break;
|
|
480
497
|
case "'":
|
|
481
498
|
{
|
|
482
|
-
let t =
|
|
499
|
+
let t = gt(e, ["'"], o + 1);
|
|
483
500
|
if (t === -1) return -1;
|
|
484
501
|
r = t + 1;
|
|
485
502
|
}
|
|
@@ -489,17 +506,17 @@ var ut = (e, t, n) => {
|
|
|
489
506
|
i--;
|
|
490
507
|
} while (i > 0);
|
|
491
508
|
throw Error("Too many escaping");
|
|
492
|
-
},
|
|
493
|
-
function
|
|
509
|
+
}, N = /\/\*[^]*?(?:\*\/|$)/g;
|
|
510
|
+
function P(e) {
|
|
494
511
|
return e ? e.trim() : "";
|
|
495
512
|
}
|
|
496
|
-
function
|
|
513
|
+
function F(e, t) {
|
|
497
514
|
let n = e && typeof e.type == "string", r = n ? e : t;
|
|
498
515
|
for (let t in e) {
|
|
499
516
|
let n = e[t];
|
|
500
517
|
Array.isArray(n) ? n.forEach((e) => {
|
|
501
|
-
|
|
502
|
-
}) : n && typeof n == "object" &&
|
|
518
|
+
F(e, r);
|
|
519
|
+
}) : n && typeof n == "object" && F(n, r);
|
|
503
520
|
}
|
|
504
521
|
return n && Object.defineProperty(e, "parent", {
|
|
505
522
|
configurable: !0,
|
|
@@ -508,7 +525,7 @@ function P(e, t) {
|
|
|
508
525
|
value: t || null
|
|
509
526
|
}), e;
|
|
510
527
|
}
|
|
511
|
-
var
|
|
528
|
+
var _t = class {
|
|
512
529
|
level = 0;
|
|
513
530
|
indentation = " ";
|
|
514
531
|
compress = !1;
|
|
@@ -523,33 +540,33 @@ var dt = class {
|
|
|
523
540
|
}
|
|
524
541
|
visit(e) {
|
|
525
542
|
switch (e.type) {
|
|
526
|
-
case
|
|
527
|
-
case
|
|
528
|
-
case
|
|
529
|
-
case
|
|
530
|
-
case
|
|
531
|
-
case
|
|
532
|
-
case
|
|
533
|
-
case
|
|
534
|
-
case
|
|
535
|
-
case
|
|
536
|
-
case
|
|
537
|
-
case
|
|
538
|
-
case
|
|
539
|
-
case
|
|
540
|
-
case
|
|
541
|
-
case
|
|
542
|
-
case
|
|
543
|
-
case
|
|
544
|
-
case
|
|
545
|
-
case
|
|
546
|
-
case
|
|
547
|
-
case
|
|
548
|
-
case
|
|
549
|
-
case
|
|
550
|
-
case
|
|
551
|
-
case
|
|
552
|
-
case
|
|
543
|
+
case j.stylesheet: return this.stylesheet(e);
|
|
544
|
+
case j.rule: return this.rule(e);
|
|
545
|
+
case j.declaration: return this.declaration(e);
|
|
546
|
+
case j.comment: return this.comment(e);
|
|
547
|
+
case j.container: return this.container(e);
|
|
548
|
+
case j.charset: return this.charset(e);
|
|
549
|
+
case j.counterStyle: return this.counterStyle(e);
|
|
550
|
+
case j.document: return this.document(e);
|
|
551
|
+
case j.customMedia: return this.customMedia(e);
|
|
552
|
+
case j.fontFace: return this.fontFace(e);
|
|
553
|
+
case j.fontFeatureValues: return this.fontFeatureValues(e);
|
|
554
|
+
case j.host: return this.host(e);
|
|
555
|
+
case j.import: return this.import(e);
|
|
556
|
+
case j.keyframes: return this.keyframes(e);
|
|
557
|
+
case j.keyframe: return this.keyframe(e);
|
|
558
|
+
case j.layer: return this.layer(e);
|
|
559
|
+
case j.media: return this.media(e);
|
|
560
|
+
case j.namespace: return this.namespace(e);
|
|
561
|
+
case j.page: return this.page(e);
|
|
562
|
+
case j.pageMarginBox: return this.pageMarginBox(e);
|
|
563
|
+
case j.positionTry: return this.positionTry(e);
|
|
564
|
+
case j.property: return this.property(e);
|
|
565
|
+
case j.scope: return this.scope(e);
|
|
566
|
+
case j.startingStyle: return this.startingStyle(e);
|
|
567
|
+
case j.supports: return this.supports(e);
|
|
568
|
+
case j.viewTransition: return this.viewTransition(e);
|
|
569
|
+
case j.atRule: return this.genericAtRule(e);
|
|
553
570
|
}
|
|
554
571
|
}
|
|
555
572
|
mapVisit(e, t) {
|
|
@@ -645,7 +662,7 @@ var dt = class {
|
|
|
645
662
|
let t = e.prelude ? ` ${e.prelude}` : "";
|
|
646
663
|
if (this.compress) return this.emit(`@${e.name}${t}`, e.position) + (e.rules ? this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : ";");
|
|
647
664
|
if (!e.rules) return this.emit(`${this.indent()}@${e.name}${t};`, e.position);
|
|
648
|
-
let n = e.rules.some((e) => e.type !==
|
|
665
|
+
let n = e.rules.some((e) => e.type !== j.declaration && e.type !== j.comment), r = n ? "\n\n" : "\n";
|
|
649
666
|
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()}}`);
|
|
650
667
|
}
|
|
651
668
|
rule(e) {
|
|
@@ -658,7 +675,7 @@ var dt = class {
|
|
|
658
675
|
declaration(e) {
|
|
659
676
|
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(";");
|
|
660
677
|
}
|
|
661
|
-
},
|
|
678
|
+
}, vt = (e, t) => {
|
|
662
679
|
t ||= {};
|
|
663
680
|
let n = 1, r = 1;
|
|
664
681
|
function i() {
|
|
@@ -666,14 +683,14 @@ var dt = class {
|
|
|
666
683
|
line: n,
|
|
667
684
|
column: r
|
|
668
685
|
};
|
|
669
|
-
return (i) => (i.position = new
|
|
686
|
+
return (i) => (i.position = new ht(e, {
|
|
670
687
|
line: n,
|
|
671
688
|
column: r
|
|
672
689
|
}, t?.source || ""), u(), i);
|
|
673
690
|
}
|
|
674
691
|
let a = [];
|
|
675
692
|
function o(i) {
|
|
676
|
-
let o = new
|
|
693
|
+
let o = new mt(t?.source || "", i, n, r, e);
|
|
677
694
|
if (!t?.silent) throw o;
|
|
678
695
|
a.push(o);
|
|
679
696
|
}
|
|
@@ -709,36 +726,36 @@ var dt = class {
|
|
|
709
726
|
if (e.charAt(0) !== "/" || e.charAt(1) !== "*") return;
|
|
710
727
|
let n = /^\/\*[^]*?\*\//.exec(e);
|
|
711
728
|
return n ? (l(n), t({
|
|
712
|
-
type:
|
|
729
|
+
type: j.comment,
|
|
713
730
|
comment: n[0].slice(2, -2)
|
|
714
731
|
})) : o("End of comment missing");
|
|
715
732
|
}
|
|
716
733
|
function p() {
|
|
717
|
-
let t =
|
|
734
|
+
let t = M(e, ["{"]);
|
|
718
735
|
if (t === -1 || t === 0) return;
|
|
719
736
|
let n = e.substring(0, t);
|
|
720
737
|
return l([n]), ((e, t) => {
|
|
721
738
|
let n = [], r = 0;
|
|
722
739
|
for (; r < e.length;) {
|
|
723
|
-
let i =
|
|
740
|
+
let i = M(e, t, r);
|
|
724
741
|
if (i === -1) return n.push(e.substring(r)), n;
|
|
725
742
|
n.push(e.substring(r, i)), r = i + 1;
|
|
726
743
|
}
|
|
727
744
|
return n;
|
|
728
|
-
})(
|
|
745
|
+
})(P(n).replace(N, ""), [","]).map((e) => P(e));
|
|
729
746
|
}
|
|
730
747
|
function m() {
|
|
731
748
|
let t = i(), n = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);
|
|
732
749
|
if (!n) return;
|
|
733
750
|
l(n);
|
|
734
|
-
let r =
|
|
751
|
+
let r = P(n[0]), a = /^:\s*/.exec(e);
|
|
735
752
|
if (!a) return o("property missing ':'");
|
|
736
753
|
l(a);
|
|
737
|
-
let s = "", c =
|
|
738
|
-
c !== -1 && (s = e.substring(0, c), l([s]), s =
|
|
754
|
+
let s = "", c = M(e, [";", "}"]);
|
|
755
|
+
c !== -1 && (s = e.substring(0, c), l([s]), s = P(s).replace(N, ""));
|
|
739
756
|
let u = t({
|
|
740
|
-
type:
|
|
741
|
-
property: r.replace(
|
|
757
|
+
type: j.declaration,
|
|
758
|
+
property: r.replace(N, ""),
|
|
742
759
|
value: s
|
|
743
760
|
}), d = /^[;\s]*/.exec(e);
|
|
744
761
|
return d && l(d), u;
|
|
@@ -757,9 +774,9 @@ var dt = class {
|
|
|
757
774
|
return c() ? n : o("missing '}'");
|
|
758
775
|
}
|
|
759
776
|
function g() {
|
|
760
|
-
let t =
|
|
777
|
+
let t = M(e, ["{"]);
|
|
761
778
|
if (t === -1) return !1;
|
|
762
|
-
let n =
|
|
779
|
+
let n = M(e, [";"]), r = M(e, ["}"]);
|
|
763
780
|
return !(n !== -1 && n < t) && !(r !== -1 && r < t);
|
|
764
781
|
}
|
|
765
782
|
function _() {
|
|
@@ -767,14 +784,14 @@ var dt = class {
|
|
|
767
784
|
if (!s()) return o("missing '{'");
|
|
768
785
|
for (d(n); e.length && e.charAt(0) !== "}";) {
|
|
769
786
|
if (e.charAt(0) === "@") {
|
|
770
|
-
let e =
|
|
787
|
+
let e = S();
|
|
771
788
|
if (e) {
|
|
772
789
|
n.push(e), d(n);
|
|
773
790
|
continue;
|
|
774
791
|
}
|
|
775
792
|
}
|
|
776
793
|
if (g()) {
|
|
777
|
-
let e =
|
|
794
|
+
let e = C();
|
|
778
795
|
if (e) {
|
|
779
796
|
n.push(e), d(n);
|
|
780
797
|
continue;
|
|
@@ -799,14 +816,14 @@ var dt = class {
|
|
|
799
816
|
let n = [];
|
|
800
817
|
for (u(), d(n); e.length && e.charAt(0) !== "}";) {
|
|
801
818
|
if (e.charAt(0) === "@") {
|
|
802
|
-
let e =
|
|
819
|
+
let e = S();
|
|
803
820
|
if (e) {
|
|
804
821
|
n.push(e), d(n);
|
|
805
822
|
continue;
|
|
806
823
|
}
|
|
807
824
|
}
|
|
808
825
|
if (g()) {
|
|
809
|
-
let e =
|
|
826
|
+
let e = C();
|
|
810
827
|
if (e) {
|
|
811
828
|
n.push(e), d(n);
|
|
812
829
|
continue;
|
|
@@ -836,7 +853,7 @@ var dt = class {
|
|
|
836
853
|
i && l(i), r = /^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);
|
|
837
854
|
}
|
|
838
855
|
if (t.length) return n({
|
|
839
|
-
type:
|
|
856
|
+
type: j.keyframe,
|
|
840
857
|
values: t,
|
|
841
858
|
declarations: h() || []
|
|
842
859
|
});
|
|
@@ -858,8 +875,8 @@ var dt = class {
|
|
|
858
875
|
"right-top",
|
|
859
876
|
"right-middle",
|
|
860
877
|
"right-bottom"
|
|
861
|
-
].join("|")})(?![\\w-])\\s*`), te =
|
|
862
|
-
function
|
|
878
|
+
].join("|")})(?![\\w-])\\s*`), te = x("import"), ne = x("charset"), b = x("namespace");
|
|
879
|
+
function x(t) {
|
|
863
880
|
let n = RegExp("^@" + t + "\\s*((?::?[^;'\"]|\"(?:\\\\\"|[^\"])*?\"|'(?:\\\\'|[^'])*?')+)(?:;|$)");
|
|
864
881
|
return () => {
|
|
865
882
|
let r = i(), a = n.exec(e);
|
|
@@ -868,7 +885,7 @@ var dt = class {
|
|
|
868
885
|
return s[t] = o[1].trim(), r(s);
|
|
869
886
|
};
|
|
870
887
|
}
|
|
871
|
-
function
|
|
888
|
+
function S() {
|
|
872
889
|
if (e[0] === "@") return function() {
|
|
873
890
|
let t = i(), n = /^@([-\w]+)?keyframes\s*/.exec(e);
|
|
874
891
|
if (!n) return;
|
|
@@ -879,7 +896,7 @@ var dt = class {
|
|
|
879
896
|
let f = d(), p = y();
|
|
880
897
|
for (; p;) f.push(p), f = f.concat(d()), p = y();
|
|
881
898
|
return c() ? t({
|
|
882
|
-
type:
|
|
899
|
+
type: j.keyframes,
|
|
883
900
|
name: u,
|
|
884
901
|
vendor: r,
|
|
885
902
|
keyframes: f
|
|
@@ -887,11 +904,11 @@ var dt = class {
|
|
|
887
904
|
}() || function() {
|
|
888
905
|
let t = i(), n = /^@media *([^{]+)/.exec(e);
|
|
889
906
|
if (!n) return;
|
|
890
|
-
let r =
|
|
907
|
+
let r = P(l(n)[1]);
|
|
891
908
|
if (!s()) return o("@media missing '{'");
|
|
892
909
|
let a = v();
|
|
893
910
|
return c() ? t({
|
|
894
|
-
type:
|
|
911
|
+
type: j.media,
|
|
895
912
|
media: r,
|
|
896
913
|
rules: a
|
|
897
914
|
}) : o("@media missing '}'");
|
|
@@ -900,29 +917,29 @@ var dt = class {
|
|
|
900
917
|
if (!n) return;
|
|
901
918
|
let r = l(n);
|
|
902
919
|
return t({
|
|
903
|
-
type:
|
|
904
|
-
name:
|
|
905
|
-
media:
|
|
920
|
+
type: j.customMedia,
|
|
921
|
+
name: P(r[1]),
|
|
922
|
+
media: P(r[2])
|
|
906
923
|
});
|
|
907
924
|
}() || function() {
|
|
908
925
|
let t = i(), n = /^@supports *([^{]+)/.exec(e);
|
|
909
926
|
if (!n) return;
|
|
910
|
-
let r =
|
|
927
|
+
let r = P(l(n)[1]);
|
|
911
928
|
if (!s()) return o("@supports missing '{'");
|
|
912
929
|
let a = v();
|
|
913
930
|
return c() ? t({
|
|
914
|
-
type:
|
|
931
|
+
type: j.supports,
|
|
915
932
|
supports: r,
|
|
916
933
|
rules: a
|
|
917
934
|
}) : o("@supports missing '}'");
|
|
918
|
-
}() || te() || ne() ||
|
|
935
|
+
}() || te() || ne() || b() || function() {
|
|
919
936
|
let t = i(), n = /^@([-\w]+)?document *([^{]+)/.exec(e);
|
|
920
937
|
if (!n) return;
|
|
921
|
-
let r = l(n), a =
|
|
938
|
+
let r = l(n), a = P(r[1]), u = P(r[2]);
|
|
922
939
|
if (!s()) return o("@document missing '{'");
|
|
923
940
|
let d = v();
|
|
924
941
|
return c() ? t({
|
|
925
|
-
type:
|
|
942
|
+
type: j.document,
|
|
926
943
|
document: u,
|
|
927
944
|
vendor: a,
|
|
928
945
|
rules: d
|
|
@@ -936,7 +953,7 @@ var dt = class {
|
|
|
936
953
|
let a = [];
|
|
937
954
|
for (d(a); e.length && e.charAt(0) !== "}";) {
|
|
938
955
|
if (e.charAt(0) === "@") {
|
|
939
|
-
let e =
|
|
956
|
+
let e = S();
|
|
940
957
|
if (e) {
|
|
941
958
|
a.push(e), d(a);
|
|
942
959
|
continue;
|
|
@@ -947,7 +964,7 @@ var dt = class {
|
|
|
947
964
|
a.push(t), d(a);
|
|
948
965
|
}
|
|
949
966
|
return c() ? t({
|
|
950
|
-
type:
|
|
967
|
+
type: j.page,
|
|
951
968
|
selectors: r,
|
|
952
969
|
declarations: a
|
|
953
970
|
}) : o("@page missing '}'");
|
|
@@ -957,7 +974,7 @@ var dt = class {
|
|
|
957
974
|
if (l(n), !s()) return o("@host missing '{'");
|
|
958
975
|
let r = v();
|
|
959
976
|
return c() ? t({
|
|
960
|
-
type:
|
|
977
|
+
type: j.host,
|
|
961
978
|
rules: r
|
|
962
979
|
}) : o("@host missing '}'");
|
|
963
980
|
}() || function() {
|
|
@@ -967,28 +984,28 @@ var dt = class {
|
|
|
967
984
|
let r = d(), a = m();
|
|
968
985
|
for (; a;) r.push(a), r = r.concat(d()), a = m();
|
|
969
986
|
return c() ? t({
|
|
970
|
-
type:
|
|
987
|
+
type: j.fontFace,
|
|
971
988
|
declarations: r
|
|
972
989
|
}) : o("@font-face missing '}'");
|
|
973
990
|
}() || function() {
|
|
974
991
|
let t = i(), n = /^@font-feature-values\s+([^{]+)/.exec(e);
|
|
975
992
|
if (!n) return;
|
|
976
|
-
let r =
|
|
993
|
+
let r = P(l(n)[1]);
|
|
977
994
|
if (!s()) return o("@font-feature-values missing '{'");
|
|
978
995
|
let a = v();
|
|
979
996
|
return c() ? t({
|
|
980
|
-
type:
|
|
997
|
+
type: j.fontFeatureValues,
|
|
981
998
|
fontFamily: r,
|
|
982
999
|
rules: a
|
|
983
1000
|
}) : o("@font-feature-values missing '}'");
|
|
984
1001
|
}() || function() {
|
|
985
1002
|
let t = i(), n = /^@container *([^{]+)/.exec(e);
|
|
986
1003
|
if (!n) return;
|
|
987
|
-
let r =
|
|
1004
|
+
let r = P(l(n)[1]);
|
|
988
1005
|
if (!s()) return o("@container missing '{'");
|
|
989
1006
|
let a = v();
|
|
990
1007
|
return c() ? t({
|
|
991
|
-
type:
|
|
1008
|
+
type: j.container,
|
|
992
1009
|
container: r,
|
|
993
1010
|
rules: a
|
|
994
1011
|
}) : o("@container missing '}'");
|
|
@@ -998,23 +1015,23 @@ var dt = class {
|
|
|
998
1015
|
if (l(n), !s()) return o("@starting-style missing '{'");
|
|
999
1016
|
let r = v();
|
|
1000
1017
|
return c() ? t({
|
|
1001
|
-
type:
|
|
1018
|
+
type: j.startingStyle,
|
|
1002
1019
|
rules: r
|
|
1003
1020
|
}) : o("@starting-style missing '}'");
|
|
1004
1021
|
}() || function() {
|
|
1005
1022
|
let t = i(), n = /^@layer *([^{;@]+)/.exec(e);
|
|
1006
1023
|
if (!n) return;
|
|
1007
|
-
let r =
|
|
1024
|
+
let r = P(l(n)[1]);
|
|
1008
1025
|
if (!s()) {
|
|
1009
1026
|
let n = /^[;\s]*/.exec(e);
|
|
1010
1027
|
return n && l(n), t({
|
|
1011
|
-
type:
|
|
1028
|
+
type: j.layer,
|
|
1012
1029
|
layer: r
|
|
1013
1030
|
});
|
|
1014
1031
|
}
|
|
1015
1032
|
let a = v();
|
|
1016
1033
|
return c() ? t({
|
|
1017
|
-
type:
|
|
1034
|
+
type: j.layer,
|
|
1018
1035
|
layer: r,
|
|
1019
1036
|
rules: a
|
|
1020
1037
|
}) : o("@layer missing '}'");
|
|
@@ -1026,7 +1043,7 @@ var dt = class {
|
|
|
1026
1043
|
let a = d(), u = m();
|
|
1027
1044
|
for (; u;) a.push(u), a = a.concat(d()), u = m();
|
|
1028
1045
|
return c() ? t({
|
|
1029
|
-
type:
|
|
1046
|
+
type: j.property,
|
|
1030
1047
|
name: r,
|
|
1031
1048
|
declarations: a
|
|
1032
1049
|
}) : o("@property missing '}'");
|
|
@@ -1038,18 +1055,18 @@ var dt = class {
|
|
|
1038
1055
|
let a = d(), u = m();
|
|
1039
1056
|
for (; u;) a.push(u), a = a.concat(d()), u = m();
|
|
1040
1057
|
return c() ? t({
|
|
1041
|
-
type:
|
|
1058
|
+
type: j.counterStyle,
|
|
1042
1059
|
name: r,
|
|
1043
1060
|
declarations: a
|
|
1044
1061
|
}) : o("@counter-style missing '}'");
|
|
1045
1062
|
}() || function() {
|
|
1046
1063
|
let t = i(), n = /^@scope\s*([^{]*)/.exec(e);
|
|
1047
1064
|
if (!n) return;
|
|
1048
|
-
let r =
|
|
1065
|
+
let r = P(l(n)[1]);
|
|
1049
1066
|
if (!s()) return o("@scope missing '{'");
|
|
1050
1067
|
let a = v();
|
|
1051
1068
|
return c() ? t({
|
|
1052
|
-
type:
|
|
1069
|
+
type: j.scope,
|
|
1053
1070
|
scope: r,
|
|
1054
1071
|
rules: a
|
|
1055
1072
|
}) : o("@scope missing '}'");
|
|
@@ -1060,7 +1077,7 @@ var dt = class {
|
|
|
1060
1077
|
let r = d(), a = m();
|
|
1061
1078
|
for (; a;) r.push(a), r = r.concat(d()), a = m();
|
|
1062
1079
|
return c() ? t({
|
|
1063
|
-
type:
|
|
1080
|
+
type: j.viewTransition,
|
|
1064
1081
|
declarations: r
|
|
1065
1082
|
}) : o("@view-transition missing '}'");
|
|
1066
1083
|
}() || function() {
|
|
@@ -1071,7 +1088,7 @@ var dt = class {
|
|
|
1071
1088
|
let a = d(), u = m();
|
|
1072
1089
|
for (; u;) a.push(u), a = a.concat(d()), u = m();
|
|
1073
1090
|
return c() ? t({
|
|
1074
|
-
type:
|
|
1091
|
+
type: j.positionTry,
|
|
1075
1092
|
name: r,
|
|
1076
1093
|
declarations: a
|
|
1077
1094
|
}) : o("@position-try missing '}'");
|
|
@@ -1083,18 +1100,18 @@ var dt = class {
|
|
|
1083
1100
|
let a = d(), u = m();
|
|
1084
1101
|
for (; u;) a.push(u), a = a.concat(d()), u = m();
|
|
1085
1102
|
return c() ? t({
|
|
1086
|
-
type:
|
|
1103
|
+
type: j.pageMarginBox,
|
|
1087
1104
|
name: r,
|
|
1088
1105
|
declarations: a
|
|
1089
1106
|
}) : o(`@${r} missing '}'`);
|
|
1090
1107
|
}() || function() {
|
|
1091
1108
|
let t = i(), n = /^@([-\w]+)\s*/.exec(e);
|
|
1092
1109
|
if (!n) return;
|
|
1093
|
-
let r = l(n)[1], a = "", u =
|
|
1094
|
-
if (u !== -1 && u > 0 && (a =
|
|
1110
|
+
let r = l(n)[1], a = "", u = M(e, ["{", ";"]);
|
|
1111
|
+
if (u !== -1 && u > 0 && (a = P(e.substring(0, u)), l([e.substring(0, u)])), s()) {
|
|
1095
1112
|
let e = v();
|
|
1096
1113
|
return c() ? t({
|
|
1097
|
-
type:
|
|
1114
|
+
type: j.atRule,
|
|
1098
1115
|
name: r,
|
|
1099
1116
|
prelude: a,
|
|
1100
1117
|
rules: e
|
|
@@ -1102,21 +1119,21 @@ var dt = class {
|
|
|
1102
1119
|
}
|
|
1103
1120
|
let d = /^[;\s]*/.exec(e);
|
|
1104
1121
|
return d && l(d), t({
|
|
1105
|
-
type:
|
|
1122
|
+
type: j.atRule,
|
|
1106
1123
|
name: r,
|
|
1107
1124
|
prelude: a
|
|
1108
1125
|
});
|
|
1109
1126
|
}();
|
|
1110
1127
|
}
|
|
1111
|
-
function
|
|
1128
|
+
function C() {
|
|
1112
1129
|
let e = i(), t = p();
|
|
1113
1130
|
return t ? (d(), e({
|
|
1114
|
-
type:
|
|
1131
|
+
type: j.rule,
|
|
1115
1132
|
selectors: t,
|
|
1116
1133
|
declarations: _() || []
|
|
1117
1134
|
})) : o("selector missing");
|
|
1118
1135
|
}
|
|
1119
|
-
return
|
|
1136
|
+
return F(function() {
|
|
1120
1137
|
let n = function() {
|
|
1121
1138
|
let n, r = [];
|
|
1122
1139
|
for (u(), d(r); e.length;) {
|
|
@@ -1127,7 +1144,7 @@ var dt = class {
|
|
|
1127
1144
|
}
|
|
1128
1145
|
break;
|
|
1129
1146
|
}
|
|
1130
|
-
if (n =
|
|
1147
|
+
if (n = S() || C(), !n) {
|
|
1131
1148
|
if (t?.silent) {
|
|
1132
1149
|
l([e.charAt(0)]), u(), d(r);
|
|
1133
1150
|
continue;
|
|
@@ -1139,7 +1156,7 @@ var dt = class {
|
|
|
1139
1156
|
return r;
|
|
1140
1157
|
}();
|
|
1141
1158
|
return {
|
|
1142
|
-
type:
|
|
1159
|
+
type: j.stylesheet,
|
|
1143
1160
|
stylesheet: {
|
|
1144
1161
|
source: t?.source,
|
|
1145
1162
|
rules: n,
|
|
@@ -1147,66 +1164,66 @@ var dt = class {
|
|
|
1147
1164
|
}
|
|
1148
1165
|
};
|
|
1149
1166
|
}());
|
|
1150
|
-
},
|
|
1167
|
+
}, yt = (e, t) => new _t(t || {}).compile(e), bt = Object.defineProperty, xt = (e, t) => {
|
|
1151
1168
|
let n = {};
|
|
1152
|
-
for (var r in e)
|
|
1169
|
+
for (var r in e) bt(n, r, {
|
|
1153
1170
|
get: e[r],
|
|
1154
1171
|
enumerable: !0
|
|
1155
1172
|
});
|
|
1156
|
-
return t ||
|
|
1157
|
-
},
|
|
1158
|
-
name:
|
|
1173
|
+
return t || bt(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
1174
|
+
}, St = "LocatorError", I = "LocatorUnsupportedError", L = "LocatorDeniedError", Ct = "LocatorInvalidError", wt = (e) => typeof e == "object" && e ? e.name : void 0, R = (e) => Object.assign(Error(e), { name: St }), Tt = (e, t = "", n) => Object.assign(Error(e), {
|
|
1175
|
+
name: I,
|
|
1159
1176
|
operation: t,
|
|
1160
1177
|
backend: n
|
|
1161
|
-
}),
|
|
1162
|
-
name:
|
|
1178
|
+
}), Et = (e, t) => Tt(`Locator operation not supported${t ? ` on the ${t} backend` : ""}: ${e}`, e, t), Dt = (e, t) => Object.assign(Error(e), {
|
|
1179
|
+
name: L,
|
|
1163
1180
|
operation: t
|
|
1164
|
-
}),
|
|
1165
|
-
name:
|
|
1181
|
+
}), Ot = (e, t) => Object.assign(Error(e), {
|
|
1182
|
+
name: Ct,
|
|
1166
1183
|
operation: t
|
|
1167
|
-
}),
|
|
1184
|
+
}), z = class extends Error {
|
|
1168
1185
|
name = "TimeoutError";
|
|
1169
1186
|
constructor(e, t) {
|
|
1170
1187
|
super(e, t?.cause === void 0 ? void 0 : { cause: t.cause });
|
|
1171
1188
|
}
|
|
1172
|
-
},
|
|
1189
|
+
}, kt = (e) => wt(e) === I, At = (e) => wt(e) === L, B = (e) => wt(e) === Ct, jt = (e) => At(e) || kt(e) || B(e), V = (e) => {
|
|
1173
1190
|
let t = (e.ownerDocument ?? e).defaultView;
|
|
1174
|
-
if (!t) throw
|
|
1191
|
+
if (!t) throw R("the resolved element belongs to a document with no window");
|
|
1175
1192
|
return t;
|
|
1176
|
-
},
|
|
1193
|
+
}, Mt = (e, t) => {
|
|
1177
1194
|
let n = e?.[t];
|
|
1178
1195
|
return typeof n == "function" ? n : null;
|
|
1179
|
-
},
|
|
1196
|
+
}, H = (e, t) => {
|
|
1180
1197
|
if (typeof e != "object" || !e) return null;
|
|
1181
1198
|
let n = (() => {
|
|
1182
1199
|
try {
|
|
1183
|
-
return
|
|
1200
|
+
return Mt(V(e), t);
|
|
1184
1201
|
} catch {
|
|
1185
1202
|
return null;
|
|
1186
1203
|
}
|
|
1187
1204
|
})();
|
|
1188
1205
|
if (n && e instanceof n) return n;
|
|
1189
|
-
let r =
|
|
1206
|
+
let r = Mt(globalThis, t);
|
|
1190
1207
|
return r && e instanceof r ? r : null;
|
|
1191
|
-
},
|
|
1192
|
-
if (e.length === 0) throw
|
|
1193
|
-
if (e.length > 1) throw
|
|
1208
|
+
}, U = (e, t) => H(e, t) !== null, W = (e) => {
|
|
1209
|
+
if (e.length === 0) throw R("No elements found");
|
|
1210
|
+
if (e.length > 1) throw R(`Strict mode violation: locator resolved to ${e.length} elements`);
|
|
1194
1211
|
return e[0];
|
|
1195
|
-
},
|
|
1196
|
-
if (!
|
|
1212
|
+
}, Nt = (e, t) => {
|
|
1213
|
+
if (!U(e, t)) throw R(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);
|
|
1197
1214
|
return e;
|
|
1198
|
-
},
|
|
1199
|
-
|
|
1200
|
-
},
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
]),
|
|
1208
|
-
if (
|
|
1209
|
-
if (e.type ===
|
|
1215
|
+
}, Pt = (e) => e.tagName.toLowerCase(), Ft = /* @__PURE__ */ new Set(), It = (e) => {
|
|
1216
|
+
Ft.add(e);
|
|
1217
|
+
}, Lt = /(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i, Rt = (e) => e.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (e, t) => String.fromCodePoint(Number.parseInt(t, 16))).replace(/\\(.)/g, "$1"), zt = (e) => !Lt.test(Rt(e.value)), Bt = /* @__PURE__ */ new Set([
|
|
1218
|
+
j.import,
|
|
1219
|
+
j.fontFace,
|
|
1220
|
+
j.namespace,
|
|
1221
|
+
j.charset,
|
|
1222
|
+
j.document,
|
|
1223
|
+
j.comment
|
|
1224
|
+
]), Vt = (e) => {
|
|
1225
|
+
if (Bt.has(e.type)) return null;
|
|
1226
|
+
if (e.type === j.declaration) return zt(e) ? e : null;
|
|
1210
1227
|
let t = e, n = { ...t };
|
|
1211
1228
|
for (let e of [
|
|
1212
1229
|
"declarations",
|
|
@@ -1214,18 +1231,18 @@ var dt = class {
|
|
|
1214
1231
|
"keyframes"
|
|
1215
1232
|
]) {
|
|
1216
1233
|
let r = t[e];
|
|
1217
|
-
Array.isArray(r) && (n[e] =
|
|
1234
|
+
Array.isArray(r) && (n[e] = Ht(r));
|
|
1218
1235
|
}
|
|
1219
1236
|
return n;
|
|
1220
|
-
},
|
|
1237
|
+
}, Ht = (e) => e.map((e) => Vt(e)).filter((e) => e !== null), Ut = (e) => {
|
|
1221
1238
|
let t;
|
|
1222
1239
|
try {
|
|
1223
|
-
t =
|
|
1240
|
+
t = vt(e, { silent: !0 });
|
|
1224
1241
|
} catch {
|
|
1225
1242
|
return "";
|
|
1226
1243
|
}
|
|
1227
|
-
return t.stylesheet.rules =
|
|
1228
|
-
},
|
|
1244
|
+
return t.stylesheet.rules = Ht(t.stylesheet.rules), yt(t);
|
|
1245
|
+
}, Wt = (e, t) => {
|
|
1229
1246
|
let n = () => {
|
|
1230
1247
|
t.parentNode || (e.head ?? e.documentElement).appendChild(t);
|
|
1231
1248
|
};
|
|
@@ -1242,30 +1259,30 @@ var dt = class {
|
|
|
1242
1259
|
});
|
|
1243
1260
|
let i = () => r.disconnect(), a = e.defaultView;
|
|
1244
1261
|
a ? a.addEventListener("load", i, { once: !0 }) : setTimeout(i, 3e4);
|
|
1245
|
-
},
|
|
1262
|
+
}, Gt = { resolve: (e, t) => {
|
|
1246
1263
|
let n = e.document.createElement("style");
|
|
1247
|
-
n.textContent = t.noSanitize ? t.content :
|
|
1264
|
+
n.textContent = t.noSanitize ? t.content : Ut(t.content);
|
|
1248
1265
|
try {
|
|
1249
|
-
|
|
1266
|
+
Wt(e.document, n);
|
|
1250
1267
|
} catch (e) {
|
|
1251
1268
|
console.error(e);
|
|
1252
1269
|
}
|
|
1253
|
-
|
|
1254
|
-
} },
|
|
1270
|
+
It(n);
|
|
1271
|
+
} }, Kt = (e) => {
|
|
1255
1272
|
let t = [];
|
|
1256
1273
|
return e.forEach((e, n) => {
|
|
1257
1274
|
t.push([n, e]);
|
|
1258
1275
|
}), t;
|
|
1259
|
-
},
|
|
1276
|
+
}, G = {
|
|
1260
1277
|
kind: "frame",
|
|
1261
1278
|
ensureArgs: (e) => [void 0, e],
|
|
1262
1279
|
resolve: async (e, t, n = {}) => {
|
|
1263
|
-
if (typeof t != "string") throw
|
|
1264
|
-
let r =
|
|
1280
|
+
if (typeof t != "string") throw Ot("fetch: url must be a string", "fetch");
|
|
1281
|
+
let r = V(e.document), i;
|
|
1265
1282
|
try {
|
|
1266
1283
|
i = new r.URL(t, e.document.baseURI).href;
|
|
1267
1284
|
} catch {
|
|
1268
|
-
throw
|
|
1285
|
+
throw Ot(`fetch: not a valid url: ${t}`, "fetch");
|
|
1269
1286
|
}
|
|
1270
1287
|
let a = await r.fetch(i, {
|
|
1271
1288
|
method: n.method ?? "GET",
|
|
@@ -1281,31 +1298,31 @@ var dt = class {
|
|
|
1281
1298
|
url: a.url,
|
|
1282
1299
|
redirected: a.redirected,
|
|
1283
1300
|
type: a.type,
|
|
1284
|
-
headers:
|
|
1301
|
+
headers: Kt(a.headers),
|
|
1285
1302
|
body: await a.arrayBuffer()
|
|
1286
1303
|
};
|
|
1287
1304
|
}
|
|
1288
|
-
},
|
|
1289
|
-
click: () =>
|
|
1290
|
-
count: () =>
|
|
1291
|
-
exists: () =>
|
|
1292
|
-
fill: () =>
|
|
1293
|
-
getAttribute: () =>
|
|
1294
|
-
hover: () =>
|
|
1295
|
-
isVisible: () =>
|
|
1296
|
-
textContent: () =>
|
|
1297
|
-
}),
|
|
1305
|
+
}, K = /* @__PURE__ */ xt({
|
|
1306
|
+
click: () => Jt,
|
|
1307
|
+
count: () => nn,
|
|
1308
|
+
exists: () => rn,
|
|
1309
|
+
fill: () => Qt,
|
|
1310
|
+
getAttribute: () => en,
|
|
1311
|
+
hover: () => Yt,
|
|
1312
|
+
isVisible: () => tn,
|
|
1313
|
+
textContent: () => $t
|
|
1314
|
+
}), qt = (e, t) => {
|
|
1298
1315
|
let n = e.getBoundingClientRect();
|
|
1299
1316
|
return {
|
|
1300
1317
|
clientX: n.left + n.width * (t?.x ?? .5),
|
|
1301
1318
|
clientY: n.top + n.height * (t?.y ?? .5)
|
|
1302
1319
|
};
|
|
1303
|
-
},
|
|
1304
|
-
let n =
|
|
1320
|
+
}, Jt = { resolve: (e, t = {}) => {
|
|
1321
|
+
let n = W(e.elements), r = V(n), i = {
|
|
1305
1322
|
bubbles: !0,
|
|
1306
1323
|
cancelable: !0,
|
|
1307
1324
|
composed: !0,
|
|
1308
|
-
...
|
|
1325
|
+
...qt(n, t.position),
|
|
1309
1326
|
button: 0
|
|
1310
1327
|
}, a = {
|
|
1311
1328
|
...i,
|
|
@@ -1329,12 +1346,12 @@ var dt = class {
|
|
|
1329
1346
|
...i,
|
|
1330
1347
|
buttons: 0
|
|
1331
1348
|
}));
|
|
1332
|
-
} },
|
|
1333
|
-
let n =
|
|
1349
|
+
} }, Yt = { resolve: (e, t = {}) => {
|
|
1350
|
+
let n = W(e.elements), r = V(n), i = {
|
|
1334
1351
|
bubbles: !0,
|
|
1335
1352
|
cancelable: !0,
|
|
1336
1353
|
composed: !0,
|
|
1337
|
-
...
|
|
1354
|
+
...qt(n, t.position)
|
|
1338
1355
|
}, a = {
|
|
1339
1356
|
...i,
|
|
1340
1357
|
pointerType: "mouse",
|
|
@@ -1348,11 +1365,11 @@ var dt = class {
|
|
|
1348
1365
|
...i,
|
|
1349
1366
|
bubbles: !1
|
|
1350
1367
|
})), n.dispatchEvent(new r.MouseEvent("mouseover", i)), n.dispatchEvent(new r.PointerEvent("pointermove", a)), n.dispatchEvent(new r.MouseEvent("mousemove", i));
|
|
1351
|
-
} },
|
|
1368
|
+
} }, Xt = (e, t) => {
|
|
1352
1369
|
e._valueTracker?.setValue("");
|
|
1353
|
-
let n = (
|
|
1370
|
+
let n = (H(e, "HTMLTextAreaElement") ?? H(e, "HTMLInputElement"))?.prototype, r = n && Object.getOwnPropertyDescriptor(n, "value")?.set;
|
|
1354
1371
|
r ? r.call(e, t) : e.value = t;
|
|
1355
|
-
},
|
|
1372
|
+
}, Zt = (e, t) => {
|
|
1356
1373
|
if (e.type !== "range") return null;
|
|
1357
1374
|
let n = Number(e.min || 0), r = Number(e.max || 100);
|
|
1358
1375
|
if (!Number.isFinite(n) || !Number.isFinite(r) || r <= n) return null;
|
|
@@ -1389,61 +1406,61 @@ var dt = class {
|
|
|
1389
1406
|
buttons: 0
|
|
1390
1407
|
}
|
|
1391
1408
|
};
|
|
1392
|
-
},
|
|
1393
|
-
let r =
|
|
1394
|
-
if (a ||
|
|
1395
|
-
let e = r, n = a ?
|
|
1396
|
-
n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))),
|
|
1409
|
+
}, Qt = { resolve: (e, t, n = {}) => {
|
|
1410
|
+
let r = W(e.elements), i = V(r), a = U(r, "HTMLInputElement");
|
|
1411
|
+
if (a || U(r, "HTMLTextAreaElement")) {
|
|
1412
|
+
let e = r, n = a ? Zt(e, t) : null;
|
|
1413
|
+
n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))), Xt(e, t), r.dispatchEvent(new i.Event("input", { bubbles: !0 })), n && (r.dispatchEvent(new i.PointerEvent("pointerup", n.pointerUp)), r.dispatchEvent(new i.MouseEvent("mouseup", n.mouseUp))), r.dispatchEvent(new i.Event("change", { bubbles: !0 }));
|
|
1397
1414
|
return;
|
|
1398
1415
|
}
|
|
1399
|
-
if (
|
|
1416
|
+
if (U(r, "HTMLElement") && r.isContentEditable) {
|
|
1400
1417
|
r.textContent = t, r.dispatchEvent(new i.Event("input", { bubbles: !0 }));
|
|
1401
1418
|
return;
|
|
1402
1419
|
}
|
|
1403
|
-
throw Error(`fill: element <${
|
|
1404
|
-
} },
|
|
1405
|
-
let n =
|
|
1406
|
-
if (!
|
|
1407
|
-
let r =
|
|
1420
|
+
throw Error(`fill: element <${Pt(r)}> is not fillable`);
|
|
1421
|
+
} }, $t = { resolve: (e, t = {}) => W(e.elements).textContent }, en = { resolve: (e, t, n = {}) => W(e.elements).getAttribute(t) }, tn = { resolve: (e, t = {}) => {
|
|
1422
|
+
let n = W(e.elements);
|
|
1423
|
+
if (!U(n, "HTMLElement")) return !0;
|
|
1424
|
+
let r = V(n).getComputedStyle(n);
|
|
1408
1425
|
if (r?.display === "none" || r?.visibility === "hidden") return !1;
|
|
1409
1426
|
let i = n.getBoundingClientRect();
|
|
1410
1427
|
return i.width > 0 && i.height > 0;
|
|
1411
|
-
} },
|
|
1428
|
+
} }, nn = { resolve: (e, t = {}) => e.elements.length }, rn = { resolve: (e, t = {}) => e.elements.length > 0 }, q = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(t)]), an = (e) => e.replaceAll("\"", "\\\""), on = {
|
|
1412
1429
|
to: "element",
|
|
1413
1430
|
css: !0,
|
|
1414
|
-
resolve: (e, t) =>
|
|
1431
|
+
resolve: (e, t) => q(e, t),
|
|
1415
1432
|
render: (e) => ({
|
|
1416
1433
|
fragment: typeof e == "string" ? e : "?",
|
|
1417
1434
|
separator: "descend"
|
|
1418
1435
|
})
|
|
1419
|
-
},
|
|
1436
|
+
}, sn = {
|
|
1420
1437
|
to: "frame",
|
|
1421
1438
|
css: !0,
|
|
1422
1439
|
barrier: "down",
|
|
1423
|
-
resolve: (e, t) =>
|
|
1440
|
+
resolve: (e, t) => q(e, t),
|
|
1424
1441
|
render: (e) => ({
|
|
1425
1442
|
fragment: typeof e == "string" ? e : "?",
|
|
1426
1443
|
separator: "down"
|
|
1427
1444
|
})
|
|
1428
|
-
},
|
|
1445
|
+
}, cn = {
|
|
1429
1446
|
element: {
|
|
1430
1447
|
selectors: {
|
|
1431
|
-
locator:
|
|
1432
|
-
frameLocator:
|
|
1448
|
+
locator: on,
|
|
1449
|
+
frameLocator: sn,
|
|
1433
1450
|
getByRole: {
|
|
1434
1451
|
to: "element",
|
|
1435
|
-
resolve: (e, t) =>
|
|
1436
|
-
render: (e) => ({ fragment: typeof e == "string" ? `[role="${
|
|
1452
|
+
resolve: (e, t) => q(e, `[role="${CSS.escape(t)}"]`),
|
|
1453
|
+
render: (e) => ({ fragment: typeof e == "string" ? `[role="${an(e)}"]` : "[role]" })
|
|
1437
1454
|
},
|
|
1438
1455
|
getByText: {
|
|
1439
1456
|
to: "element",
|
|
1440
1457
|
resolve: (e, t) => e.elements.flatMap((e) => [e, ...e.querySelectorAll("*")]).filter((e) => e.textContent?.includes(t)),
|
|
1441
|
-
render: (e) => ({ fragment: typeof e == "string" ? `:has-text("${
|
|
1458
|
+
render: (e) => ({ fragment: typeof e == "string" ? `:has-text("${an(e)}")` : ":has-text(...)" })
|
|
1442
1459
|
},
|
|
1443
1460
|
getByTestId: {
|
|
1444
1461
|
to: "element",
|
|
1445
|
-
resolve: (e, t) =>
|
|
1446
|
-
render: (e) => ({ fragment: typeof e == "string" ? `[data-testid="${
|
|
1462
|
+
resolve: (e, t) => q(e, `[data-testid="${CSS.escape(t)}"]`),
|
|
1463
|
+
render: (e) => ({ fragment: typeof e == "string" ? `[data-testid="${an(e)}"]` : "[data-testid]" })
|
|
1447
1464
|
},
|
|
1448
1465
|
first: {
|
|
1449
1466
|
to: "element",
|
|
@@ -1460,20 +1477,20 @@ var dt = class {
|
|
|
1460
1477
|
}
|
|
1461
1478
|
},
|
|
1462
1479
|
operations: {
|
|
1463
|
-
click:
|
|
1464
|
-
fill:
|
|
1465
|
-
hover:
|
|
1466
|
-
textContent:
|
|
1467
|
-
getAttribute:
|
|
1468
|
-
isVisible:
|
|
1469
|
-
count:
|
|
1470
|
-
exists:
|
|
1480
|
+
click: Jt,
|
|
1481
|
+
fill: Qt,
|
|
1482
|
+
hover: Yt,
|
|
1483
|
+
textContent: $t,
|
|
1484
|
+
getAttribute: en,
|
|
1485
|
+
isVisible: tn,
|
|
1486
|
+
count: nn,
|
|
1487
|
+
exists: rn
|
|
1471
1488
|
}
|
|
1472
1489
|
},
|
|
1473
1490
|
frame: {
|
|
1474
1491
|
selectors: {
|
|
1475
|
-
locator:
|
|
1476
|
-
frameLocator:
|
|
1492
|
+
locator: on,
|
|
1493
|
+
frameLocator: sn,
|
|
1477
1494
|
owner: {
|
|
1478
1495
|
to: "frame",
|
|
1479
1496
|
barrier: "up",
|
|
@@ -1487,11 +1504,11 @@ var dt = class {
|
|
|
1487
1504
|
}
|
|
1488
1505
|
},
|
|
1489
1506
|
operations: {
|
|
1490
|
-
addStyleTag:
|
|
1491
|
-
fetch:
|
|
1507
|
+
addStyleTag: Gt,
|
|
1508
|
+
fetch: G
|
|
1492
1509
|
}
|
|
1493
1510
|
}
|
|
1494
|
-
},
|
|
1511
|
+
}, ln = (e, t = cn) => ({
|
|
1495
1512
|
element: {
|
|
1496
1513
|
selectors: {
|
|
1497
1514
|
...t.element.selectors,
|
|
@@ -1512,31 +1529,31 @@ var dt = class {
|
|
|
1512
1529
|
...e.frame?.operations
|
|
1513
1530
|
}
|
|
1514
1531
|
}
|
|
1515
|
-
}),
|
|
1532
|
+
}), un = 3e4, dn = 50, fn = (e) => {
|
|
1516
1533
|
let t = e[e.length - 1];
|
|
1517
1534
|
return typeof t == "object" && t ? t : void 0;
|
|
1518
|
-
},
|
|
1519
|
-
let t =
|
|
1520
|
-
return typeof t == "number" ? t :
|
|
1521
|
-
},
|
|
1535
|
+
}, pn = (e) => {
|
|
1536
|
+
let t = fn(e)?.timeout;
|
|
1537
|
+
return typeof t == "number" ? t : un;
|
|
1538
|
+
}, mn = ({ executor: e, parts: t }) => ({ highlight: (n) => e.highlight(t, n).then(() => {}, () => {}) }), hn = async (e) => {
|
|
1522
1539
|
let t = {
|
|
1523
1540
|
parts: e.parts,
|
|
1524
1541
|
operation: e.operation,
|
|
1525
1542
|
args: e.args,
|
|
1526
1543
|
phase: "ensure"
|
|
1527
1544
|
};
|
|
1528
|
-
await e.gate?.(t,
|
|
1529
|
-
},
|
|
1545
|
+
await e.gate?.(t, mn(e));
|
|
1546
|
+
}, gn = (e, t) => {
|
|
1530
1547
|
if (t !== void 0 && typeof t == "number" && !(Number.isFinite(t) && t > 0)) throw TypeError(`${e}: timeout must be a positive number of milliseconds, not ${t}; every call ends at its deadline, so 0 does not turn it off`);
|
|
1531
|
-
},
|
|
1548
|
+
}, _n = (e) => typeof e == "object" && e && typeof e.message == "string" ? e.message : String(e), vn = async (e) => {
|
|
1532
1549
|
let { executor: t, gate: n, parts: r, operation: i, args: a } = e;
|
|
1533
|
-
|
|
1550
|
+
gn(i, fn(a)?.timeout), n && await n({
|
|
1534
1551
|
parts: r,
|
|
1535
1552
|
operation: i,
|
|
1536
1553
|
args: a,
|
|
1537
1554
|
phase: "execute"
|
|
1538
|
-
},
|
|
1539
|
-
let o =
|
|
1555
|
+
}, mn(e));
|
|
1556
|
+
let o = pn(a), s = Date.now() + o, c = /* @__PURE__ */ Error(`Locator timeout (${o}ms): ${i}`), { promise: l, reject: u } = Promise.withResolvers();
|
|
1540
1557
|
l.catch(() => {});
|
|
1541
1558
|
let d = setTimeout(() => u(c), o), f = c;
|
|
1542
1559
|
try {
|
|
@@ -1544,62 +1561,47 @@ var dt = class {
|
|
|
1544
1561
|
return await Promise.race([t.execute(r, i, a), l]);
|
|
1545
1562
|
} catch (e) {
|
|
1546
1563
|
if (e === c) break;
|
|
1547
|
-
if (
|
|
1564
|
+
if (jt(e)) throw e;
|
|
1548
1565
|
f = e;
|
|
1549
1566
|
let t = s - Date.now();
|
|
1550
1567
|
if (t <= 0) break;
|
|
1551
|
-
await new Promise((e) => setTimeout(e, Math.min(
|
|
1568
|
+
await new Promise((e) => setTimeout(e, Math.min(dn, t)));
|
|
1552
1569
|
}
|
|
1553
1570
|
} finally {
|
|
1554
1571
|
clearTimeout(d);
|
|
1555
1572
|
}
|
|
1556
|
-
throw f === c ? new
|
|
1557
|
-
},
|
|
1573
|
+
throw f === c ? new z(c.message) : new z(_n(f), { cause: f });
|
|
1574
|
+
}, yn = (e, t, n, r, i) => {
|
|
1558
1575
|
let a = {};
|
|
1559
|
-
for (let [o, s] of Object.entries(t[r].selectors)) a[o] = (...a) =>
|
|
1576
|
+
for (let [o, s] of Object.entries(t[r].selectors)) a[o] = (...a) => yn(e, t, n, s.to, [...i, {
|
|
1560
1577
|
kind: r,
|
|
1561
1578
|
name: o,
|
|
1562
1579
|
args: a
|
|
1563
1580
|
}]);
|
|
1564
|
-
for (let [n, o] of Object.entries(t[r].operations)) a[n] = async (...t) =>
|
|
1581
|
+
for (let [n, o] of Object.entries(t[r].operations)) a[n] = async (...t) => vn({
|
|
1565
1582
|
...e,
|
|
1566
1583
|
parts: i,
|
|
1567
1584
|
operation: n,
|
|
1568
1585
|
args: o.send ? o.send(...t) : t
|
|
1569
1586
|
});
|
|
1570
|
-
for (let [o, { to: s, rewrite: c }] of Object.entries(n[r] ?? {})) a[o] = (...r) =>
|
|
1587
|
+
for (let [o, { to: s, rewrite: c }] of Object.entries(n[r] ?? {})) a[o] = (...r) => yn(e, t, n, s, c(i, ...r));
|
|
1571
1588
|
return a.ensure = (n, a = {}) => {
|
|
1572
1589
|
let o = t[r].operations[n]?.ensureArgs;
|
|
1573
|
-
return
|
|
1590
|
+
return hn({
|
|
1574
1591
|
...e,
|
|
1575
1592
|
parts: i,
|
|
1576
1593
|
operation: n,
|
|
1577
1594
|
args: o?.(a) ?? [a]
|
|
1578
1595
|
});
|
|
1579
1596
|
}, a;
|
|
1580
|
-
},
|
|
1581
|
-
let n = e[t.kind];
|
|
1582
|
-
if (!n) throw L(`Unknown locator kind: "${t.kind}"`, t.name);
|
|
1583
|
-
let r = n.selectors[t.name];
|
|
1584
|
-
if (!r) throw L(`Unknown selector: "${t.kind}.${t.name}"`, t.name);
|
|
1585
|
-
return r;
|
|
1586
|
-
}, hn = (e, t) => {
|
|
1587
|
-
for (let n = 0; n < t.length; n++) {
|
|
1588
|
-
let r = mn(e, t[n]);
|
|
1589
|
-
if (r.barrier) return {
|
|
1590
|
-
module: r,
|
|
1591
|
-
index: n
|
|
1592
|
-
};
|
|
1593
|
-
}
|
|
1594
|
-
return null;
|
|
1595
|
-
}, gn = () => {
|
|
1597
|
+
}, bn = (e) => yn(e, e.modules ?? cn, e.rewrites ?? {}, "frame", []), xn = () => {
|
|
1596
1598
|
let e = E();
|
|
1597
1599
|
return e.status === "ok" && e.abi >= 2;
|
|
1598
|
-
},
|
|
1600
|
+
}, Sn = async () => {
|
|
1599
1601
|
await O();
|
|
1600
1602
|
let e = E();
|
|
1601
1603
|
if (e.status === "ok" && e.abi < 2) throw new w(e.abi, 2);
|
|
1602
|
-
},
|
|
1604
|
+
}, Cn = (e) => `Read the text, links and details ${e} shows.`, wn = (e) => `Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`, Tn = [
|
|
1603
1605
|
{
|
|
1604
1606
|
id: "interaction",
|
|
1605
1607
|
heading: "Interaction",
|
|
@@ -1614,9 +1616,9 @@ var dt = class {
|
|
|
1614
1616
|
heading: "Site data",
|
|
1615
1617
|
summary: "Can read the website's data",
|
|
1616
1618
|
title: (e) => `Read data from ${e}`,
|
|
1617
|
-
description:
|
|
1619
|
+
description: Cn,
|
|
1618
1620
|
cloudTitle: (e) => `Read what's on ${e}`,
|
|
1619
|
-
cloudDescription:
|
|
1621
|
+
cloudDescription: Cn
|
|
1620
1622
|
},
|
|
1621
1623
|
{
|
|
1622
1624
|
id: "network",
|
|
@@ -1632,11 +1634,11 @@ var dt = class {
|
|
|
1632
1634
|
heading: "Evaluation",
|
|
1633
1635
|
summary: "Can execute arbitrary code on the website",
|
|
1634
1636
|
title: (e) => `Run code on ${e}`,
|
|
1635
|
-
description:
|
|
1637
|
+
description: wn,
|
|
1636
1638
|
cloudTitle: (e) => `Run its own code on ${e}`,
|
|
1637
|
-
cloudDescription:
|
|
1639
|
+
cloudDescription: wn
|
|
1638
1640
|
}
|
|
1639
|
-
],
|
|
1641
|
+
], En = (e) => (t) => {
|
|
1640
1642
|
if (typeof t != "object" || !t) return t === void 0 ? [] : [t];
|
|
1641
1643
|
if (t.position !== void 0) throw TypeError(`${e}: position is Playwright's offset in pixels, which no backend serves yet; pass relativePosition, a 0..1 fraction of the box`);
|
|
1642
1644
|
let { relativePosition: n, ...r } = t;
|
|
@@ -1644,40 +1646,40 @@ var dt = class {
|
|
|
1644
1646
|
...r,
|
|
1645
1647
|
position: n
|
|
1646
1648
|
}];
|
|
1647
|
-
},
|
|
1649
|
+
}, Dn = ln({
|
|
1648
1650
|
element: { operations: {
|
|
1649
1651
|
click: {
|
|
1650
|
-
resolve: (e, t = {}) =>
|
|
1651
|
-
send:
|
|
1652
|
+
resolve: (e, t = {}) => K.click.resolve(e, t),
|
|
1653
|
+
send: En("click")
|
|
1652
1654
|
},
|
|
1653
1655
|
hover: {
|
|
1654
|
-
resolve: (e, t = {}) =>
|
|
1655
|
-
send:
|
|
1656
|
+
resolve: (e, t = {}) => K.hover.resolve(e, t),
|
|
1657
|
+
send: En("hover")
|
|
1656
1658
|
},
|
|
1657
|
-
fill: { resolve: (e, t, n = {}) =>
|
|
1658
|
-
textContent: { resolve: (e, t = {}) =>
|
|
1659
|
-
getAttribute: { resolve: (e, t, n = {}) =>
|
|
1660
|
-
isVisible: { resolve: (e, t = {}) =>
|
|
1661
|
-
count: { resolve: (e, t = {}) =>
|
|
1662
|
-
exists: { resolve: (e, t = {}) =>
|
|
1663
|
-
videoElement: { resolve: (e, t = {}) => _e(
|
|
1659
|
+
fill: { resolve: (e, t, n = {}) => K.fill.resolve(e, t, n) },
|
|
1660
|
+
textContent: { resolve: (e, t = {}) => K.textContent.resolve(e) },
|
|
1661
|
+
getAttribute: { resolve: (e, t, n = {}) => K.getAttribute.resolve(e, t) },
|
|
1662
|
+
isVisible: { resolve: (e, t = {}) => K.isVisible.resolve(e) },
|
|
1663
|
+
count: { resolve: (e, t = {}) => K.count.resolve(e) },
|
|
1664
|
+
exists: { resolve: (e, t = {}) => K.exists.resolve(e) },
|
|
1665
|
+
videoElement: { resolve: (e, t = {}) => _e(Nt(W(e.elements), "HTMLVideoElement")) }
|
|
1664
1666
|
} },
|
|
1665
1667
|
frame: { operations: {
|
|
1666
|
-
addStyleTag: { resolve: (e, t) =>
|
|
1668
|
+
addStyleTag: { resolve: (e, t) => Gt.resolve(e, t) },
|
|
1667
1669
|
fetch: {
|
|
1668
|
-
resolve: (e, t, n = {}) =>
|
|
1669
|
-
kind:
|
|
1670
|
-
ensureArgs:
|
|
1670
|
+
resolve: (e, t, n = {}) => G.resolve(e, t, n),
|
|
1671
|
+
kind: G.kind,
|
|
1672
|
+
ensureArgs: G.ensureArgs
|
|
1671
1673
|
},
|
|
1672
1674
|
evaluate: {
|
|
1673
1675
|
kind: "frame",
|
|
1674
1676
|
typed: !1,
|
|
1675
1677
|
resolve: (e, t, n) => {
|
|
1676
|
-
throw
|
|
1678
|
+
throw Et("evaluate", "this realm");
|
|
1677
1679
|
}
|
|
1678
1680
|
}
|
|
1679
1681
|
} }
|
|
1680
|
-
}),
|
|
1682
|
+
}), On = (e) => e[e.length - 1], kn = {
|
|
1681
1683
|
element: {
|
|
1682
1684
|
last: {
|
|
1683
1685
|
to: "element",
|
|
@@ -1690,7 +1692,7 @@ var dt = class {
|
|
|
1690
1692
|
contentFrame: {
|
|
1691
1693
|
to: "frame",
|
|
1692
1694
|
rewrite: (e) => {
|
|
1693
|
-
let t =
|
|
1695
|
+
let t = On(e);
|
|
1694
1696
|
if (t?.name !== "locator") throw TypeError("locator.contentFrame: only a locator that ends in locator(selector) can enter its frame; use frameLocator(selector)");
|
|
1695
1697
|
return [...e.slice(0, -1), {
|
|
1696
1698
|
...t,
|
|
@@ -1703,7 +1705,7 @@ var dt = class {
|
|
|
1703
1705
|
owner: {
|
|
1704
1706
|
to: "element",
|
|
1705
1707
|
rewrite: (e) => {
|
|
1706
|
-
let t =
|
|
1708
|
+
let t = On(e);
|
|
1707
1709
|
if (t?.name !== "frameLocator") throw TypeError("frameLocator.owner: this frame was not entered through frameLocator(selector)");
|
|
1708
1710
|
return [...e.slice(0, -1), {
|
|
1709
1711
|
...t,
|
|
@@ -1720,7 +1722,7 @@ var dt = class {
|
|
|
1720
1722
|
}]
|
|
1721
1723
|
}
|
|
1722
1724
|
}
|
|
1723
|
-
},
|
|
1725
|
+
}, An = (e) => {
|
|
1724
1726
|
if (!e || e === "about:blank") return !1;
|
|
1725
1727
|
let t;
|
|
1726
1728
|
try {
|
|
@@ -1728,46 +1730,46 @@ var dt = class {
|
|
|
1728
1730
|
} catch {
|
|
1729
1731
|
return !1;
|
|
1730
1732
|
}
|
|
1731
|
-
return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || t.protocol !== "about:" &&
|
|
1733
|
+
return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || t.protocol !== "about:" && A(t.hostname);
|
|
1732
1734
|
}, J = (e) => {
|
|
1733
|
-
if (
|
|
1734
|
-
},
|
|
1735
|
+
if (An(e)) throw Error("attachFrame: refusing to target the extension's own pages or an FKN platform origin");
|
|
1736
|
+
}, jn = ({ src: e, domains: t, lockdown: n }) => {
|
|
1735
1737
|
if (n && !t.length && e && e !== "about:blank") throw Error("attachFrame: lockdown needs domains when the frame already has a src; pass domains or load it via goto");
|
|
1736
|
-
},
|
|
1738
|
+
}, Mn = {
|
|
1737
1739
|
scope: "embed.iframe",
|
|
1738
1740
|
category: "interaction",
|
|
1739
1741
|
severity: 0,
|
|
1740
1742
|
title: "Load another website inside this app",
|
|
1741
1743
|
description: "Lets the app embed external pages directly inside its own view."
|
|
1742
|
-
},
|
|
1744
|
+
}, Nn = {
|
|
1743
1745
|
scope: "embed.open",
|
|
1744
1746
|
category: "interaction",
|
|
1745
1747
|
severity: 0,
|
|
1746
1748
|
title: "Open a website inside this app",
|
|
1747
1749
|
description: "Lets the app navigate to another site without leaving its window."
|
|
1748
|
-
},
|
|
1750
|
+
}, Pn = ["load", "commit"], Fn = (e) => {
|
|
1749
1751
|
if ("timeoutMs" in e) throw TypeError("frame.goto: pass timeout, in milliseconds; timeoutMs is not an option");
|
|
1750
1752
|
let { waitUntil: t, timeout: n } = e;
|
|
1751
|
-
if (t !== void 0 && !
|
|
1753
|
+
if (t !== void 0 && !Pn.includes(t)) throw TypeError(`frame.goto: waitUntil must be 'load' or 'commit', not ${JSON.stringify(t)}`);
|
|
1752
1754
|
if (n !== void 0 && typeof n != "number") throw TypeError("frame.goto: timeout must be a number of milliseconds");
|
|
1753
|
-
|
|
1754
|
-
},
|
|
1755
|
+
gn("frame.goto", n);
|
|
1756
|
+
}, In = class extends Error {
|
|
1755
1757
|
name = "FrameWindowBlockedError";
|
|
1756
1758
|
constructor() {
|
|
1757
1759
|
super("attachFrame: the browser did not open the window. Call attachFrame directly in a click or key handler, and allow popups for this page");
|
|
1758
1760
|
}
|
|
1759
|
-
},
|
|
1761
|
+
}, Ln = /* @__PURE__ */ new Set([
|
|
1760
1762
|
"jar-unreachable",
|
|
1761
1763
|
"bad-url",
|
|
1762
1764
|
"opaque-opener"
|
|
1763
|
-
]),
|
|
1765
|
+
]), Rn = class extends Error {
|
|
1764
1766
|
name = "FrameWindowRefusedError";
|
|
1765
1767
|
reason;
|
|
1766
1768
|
constructor(e) {
|
|
1767
|
-
let t =
|
|
1769
|
+
let t = Ln.has(e) ? e : "unknown";
|
|
1768
1770
|
super(t === "opaque-opener" ? "attachFrame: this page has an opaque origin, which a window can never answer, so no window was opened" : `attachFrame: the window refused to attach (${t}), and loaded nothing`), this.reason = t;
|
|
1769
1771
|
}
|
|
1770
|
-
},
|
|
1772
|
+
}, zn = ["message", "document"], Bn = (e) => {
|
|
1771
1773
|
if (e === "*") return "*";
|
|
1772
1774
|
let t = () => /* @__PURE__ */ TypeError(`frame.postMessage: targetOrigin must be '*' or an origin, not ${JSON.stringify(e)}`);
|
|
1773
1775
|
if (typeof e != "string") throw t();
|
|
@@ -1779,48 +1781,48 @@ var dt = class {
|
|
|
1779
1781
|
}
|
|
1780
1782
|
if (n === "null") throw t();
|
|
1781
1783
|
return n;
|
|
1782
|
-
},
|
|
1784
|
+
}, Vn = (e, t) => {
|
|
1783
1785
|
let n = typeof e == "object" && !!e;
|
|
1784
1786
|
if (n && t !== void 0) throw TypeError("frame.postMessage: pass transfer inside the options object, not after it");
|
|
1785
1787
|
let r = n ? e.targetOrigin ?? "*" : e ?? "*", i = n ? e.transfer : t;
|
|
1786
1788
|
if (i !== void 0 && !Array.isArray(i)) throw TypeError("frame.postMessage: transfer must be an array");
|
|
1787
1789
|
return {
|
|
1788
|
-
targetOrigin:
|
|
1790
|
+
targetOrigin: Bn(r),
|
|
1789
1791
|
transfer: i === void 0 ? [] : [...i]
|
|
1790
1792
|
};
|
|
1791
|
-
},
|
|
1793
|
+
}, Hn = [
|
|
1792
1794
|
"url",
|
|
1793
1795
|
"path",
|
|
1794
1796
|
"type"
|
|
1795
|
-
],
|
|
1797
|
+
], Un = ["content", "sourceUrl"], Wn = /[\n\r\u2028\u2029]/, Gn = (e) => {
|
|
1796
1798
|
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("frame.addScriptTag: options must be an object { content }");
|
|
1797
|
-
let t = Object.keys(e), n = t.find((e) =>
|
|
1799
|
+
let t = Object.keys(e), n = t.find((e) => Hn.includes(e));
|
|
1798
1800
|
if (n !== void 0) throw TypeError(`frame.addScriptTag: "${n}" is not served; it runs content as a classic inline script`);
|
|
1799
|
-
let r = t.find((e) => !
|
|
1801
|
+
let r = t.find((e) => !Un.includes(e));
|
|
1800
1802
|
if (r !== void 0) throw TypeError(`frame.addScriptTag: unknown option "${r}"`);
|
|
1801
1803
|
let { content: i, sourceUrl: a } = e;
|
|
1802
1804
|
if (typeof i != "string") throw TypeError("frame.addScriptTag: content must be a string");
|
|
1803
|
-
if (a !== void 0 && (typeof a != "string" || a === "" ||
|
|
1805
|
+
if (a !== void 0 && (typeof a != "string" || a === "" || Wn.test(a))) throw TypeError("frame.addScriptTag: sourceUrl must be a non-empty string with no line break");
|
|
1804
1806
|
return a === void 0 ? { content: i } : {
|
|
1805
1807
|
content: i,
|
|
1806
1808
|
sourceUrl: a
|
|
1807
1809
|
};
|
|
1808
|
-
},
|
|
1810
|
+
}, Kn = [
|
|
1809
1811
|
"name",
|
|
1810
1812
|
"domain",
|
|
1811
1813
|
"path"
|
|
1812
|
-
],
|
|
1814
|
+
], qn = (e) => e instanceof RegExp || Object.prototype.toString.call(e) === "[object RegExp]", Jn = (e) => {
|
|
1813
1815
|
if (e === void 0) return {};
|
|
1814
1816
|
if (Object.prototype.toString.call(e) !== "[object Object]") throw TypeError("frame.clearCookies: options must be an object");
|
|
1815
|
-
let t = e, n = Object.keys(t).find((e) => !
|
|
1817
|
+
let t = e, n = Object.keys(t).find((e) => !Kn.includes(e));
|
|
1816
1818
|
if (n !== void 0) throw TypeError(`frame.clearCookies: unknown option "${n}"`);
|
|
1817
|
-
let r =
|
|
1819
|
+
let r = Kn.flatMap((e) => {
|
|
1818
1820
|
let n = t[e];
|
|
1819
1821
|
return n === void 0 ? [] : [{
|
|
1820
1822
|
key: e,
|
|
1821
1823
|
value: n
|
|
1822
1824
|
}];
|
|
1823
|
-
}), i = r.find(({ value: e }) =>
|
|
1825
|
+
}), i = r.find(({ value: e }) => qn(e));
|
|
1824
1826
|
if (i !== void 0) throw TypeError(`frame.clearCookies: ${i.key} is a RegExp, and clearCookies takes strings for name, domain and path for now`);
|
|
1825
1827
|
let a = r.find(({ value: e }) => typeof e != "string");
|
|
1826
1828
|
if (a !== void 0) throw TypeError(`frame.clearCookies: ${a.key} must be a string`);
|
|
@@ -1829,15 +1831,15 @@ var dt = class {
|
|
|
1829
1831
|
let s = {};
|
|
1830
1832
|
for (let { key: e, value: t } of r) s[e] = { equals: t };
|
|
1831
1833
|
return s;
|
|
1832
|
-
},
|
|
1834
|
+
}, Yn = (e) => {
|
|
1833
1835
|
typeof globalThis.reportError == "function" ? globalThis.reportError(e) : console.error(e);
|
|
1834
|
-
},
|
|
1835
|
-
let { owner: t, ...n } =
|
|
1836
|
+
}, Xn = (e) => {
|
|
1837
|
+
let { owner: t, ...n } = bn({
|
|
1836
1838
|
executor: e.executor,
|
|
1837
|
-
modules:
|
|
1838
|
-
rewrites:
|
|
1839
|
+
modules: Dn,
|
|
1840
|
+
rewrites: kn,
|
|
1839
1841
|
gate: e.gate
|
|
1840
|
-
}), r = async (t, n = {}) => (J(t),
|
|
1842
|
+
}), r = async (t, n = {}) => (J(t), Fn(n), e.goto(t, n)), i = () => e.url(), a = async (t) => {
|
|
1841
1843
|
let n = e.requestPermissions;
|
|
1842
1844
|
if (!n) throw Error("frame.requestPermissions: this backend cannot ask for permission categories");
|
|
1843
1845
|
return n(t);
|
|
@@ -1848,18 +1850,18 @@ var dt = class {
|
|
|
1848
1850
|
if (typeof i != "string") throw TypeError("frame.evaluate: pass a function or a source string");
|
|
1849
1851
|
return r(i, structuredClone(n));
|
|
1850
1852
|
}, s = async (t) => {
|
|
1851
|
-
let { content: n, ...r } =
|
|
1853
|
+
let { content: n, ...r } = Gn(t), i = e.addScriptTag;
|
|
1852
1854
|
if (!i) throw Error("frame.addScriptTag: this backend cannot run scripts in the attached frame");
|
|
1853
1855
|
await i(n, r);
|
|
1854
1856
|
}, c = async (t) => {
|
|
1855
|
-
let n =
|
|
1857
|
+
let n = Jn(t), r = e.clearCookies;
|
|
1856
1858
|
if (!r) throw Error("frame.clearCookies: this backend cannot clear cookies");
|
|
1857
1859
|
await r(n);
|
|
1858
1860
|
}, l = ((t, n, r) => {
|
|
1859
1861
|
try {
|
|
1860
1862
|
let i = e.postMessage;
|
|
1861
1863
|
if (!i) throw Error("frame.postMessage: this backend cannot message the attached frame");
|
|
1862
|
-
let a =
|
|
1864
|
+
let a = Vn(n, r);
|
|
1863
1865
|
return i(t, a.targetOrigin, a.transfer);
|
|
1864
1866
|
} catch (e) {
|
|
1865
1867
|
return Promise.reject(e);
|
|
@@ -1868,7 +1870,7 @@ var dt = class {
|
|
|
1868
1870
|
message: /* @__PURE__ */ new Set(),
|
|
1869
1871
|
document: /* @__PURE__ */ new Set()
|
|
1870
1872
|
}, d = null, f = (e, t) => {
|
|
1871
|
-
if (!
|
|
1873
|
+
if (!zn.includes(e)) throw TypeError(`frame.${t}: the event type must be ${zn.map((e) => `'${e}'`).join(" or ")}, not ${JSON.stringify(e)}`);
|
|
1872
1874
|
return u[e];
|
|
1873
1875
|
}, p = (e) => {
|
|
1874
1876
|
let t = e.type === "message" ? Object.freeze({
|
|
@@ -1884,7 +1886,7 @@ var dt = class {
|
|
|
1884
1886
|
for (let n of [...u[e.type]]) try {
|
|
1885
1887
|
n(t);
|
|
1886
1888
|
} catch (e) {
|
|
1887
|
-
|
|
1889
|
+
Yn(e);
|
|
1888
1890
|
}
|
|
1889
1891
|
}, m = (e, t) => {
|
|
1890
1892
|
if (f(e, "off").delete(t), d !== null && !u.message.size && !u.document.size) {
|
|
@@ -1917,7 +1919,7 @@ var dt = class {
|
|
|
1917
1919
|
off: m
|
|
1918
1920
|
};
|
|
1919
1921
|
return _;
|
|
1920
|
-
},
|
|
1922
|
+
}, Zn = [
|
|
1921
1923
|
h,
|
|
1922
1924
|
t,
|
|
1923
1925
|
g,
|
|
@@ -1931,43 +1933,43 @@ var dt = class {
|
|
|
1931
1933
|
l,
|
|
1932
1934
|
f,
|
|
1933
1935
|
u,
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
+
Mn,
|
|
1937
|
+
Nn,
|
|
1936
1938
|
m,
|
|
1937
1939
|
r,
|
|
1940
|
+
qe,
|
|
1938
1941
|
Je,
|
|
1939
1942
|
Ye,
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
], qn = bn.map((e) => e.id), Jn = {
|
|
1943
|
+
lt,
|
|
1944
|
+
dt
|
|
1945
|
+
], Qn = Tn.map((e) => e.id), $n = {
|
|
1944
1946
|
interaction: "act.click",
|
|
1945
1947
|
storage: "read.text",
|
|
1946
1948
|
network: "network.fetchCredentialed",
|
|
1947
1949
|
evaluation: "media.appearU"
|
|
1948
|
-
},
|
|
1950
|
+
}, er = (e) => e === 0 ? "auto" : e === 4 ? "critical" : "bundled", tr = Zn, Y = /* @__PURE__ */ new Map(), nr = {};
|
|
1949
1951
|
(() => {
|
|
1950
|
-
Y = new Map(
|
|
1951
|
-
let e = (e) =>
|
|
1952
|
-
Object.fromEntries(
|
|
1952
|
+
Y = new Map(tr.map((e) => [e.scope, e])), nr = Object.fromEntries(Y), tr.filter((e) => e.severity === 4).map((e) => e.scope);
|
|
1953
|
+
let e = (e) => tr.filter((t) => t.category === e && er(t.severity) === "bundled");
|
|
1954
|
+
Object.fromEntries(Qn.map((t) => [t, Math.max(0, ...e(t).map((e) => e.severity))])), Object.fromEntries(Qn.map((t) => [t, e(t).some((e) => e.unsafe === !0)]));
|
|
1953
1955
|
})();
|
|
1954
|
-
var
|
|
1956
|
+
var rr = (e) => Y.get(e)?.category, ir = (e) => {
|
|
1955
1957
|
let t = Y.get(e);
|
|
1956
|
-
return t &&
|
|
1957
|
-
},
|
|
1958
|
+
return t && er(t.severity);
|
|
1959
|
+
}, ar = (e) => {
|
|
1958
1960
|
let t = Y.get(e);
|
|
1959
|
-
if (t) return
|
|
1960
|
-
},
|
|
1961
|
-
let n = t ?? (e &&
|
|
1962
|
-
return n !== void 0 &&
|
|
1963
|
-
},
|
|
1964
|
-
for (let { category: n, key: r } of t) if (
|
|
1961
|
+
if (t) return er(t.severity) === "critical" ? t.scope : t.category;
|
|
1962
|
+
}, or = (e) => $n[e], sr = ({ category: e, key: t }) => {
|
|
1963
|
+
let n = t ?? (e && or(e));
|
|
1964
|
+
return n !== void 0 && rr(n) !== void 0 ? n : void 0;
|
|
1965
|
+
}, cr = (e, t) => {
|
|
1966
|
+
for (let { category: n, key: r } of t) if (sr({
|
|
1965
1967
|
category: n,
|
|
1966
1968
|
key: r
|
|
1967
1969
|
}) === void 0) throw TypeError(r === void 0 ? n === void 0 ? `${e}: name a category or a permission key` : `${e}: unknown permission category "${n}"` : `${e}: unknown permission key "${r}"`);
|
|
1968
|
-
},
|
|
1970
|
+
}, lr = (e, t = {}) => {
|
|
1969
1971
|
let n = [], r = e.map((e) => {
|
|
1970
|
-
let r =
|
|
1972
|
+
let r = sr(e), i = [];
|
|
1971
1973
|
if (r !== void 0) for (let a of e.hosts) i.push(n.length), n.push({
|
|
1972
1974
|
...t,
|
|
1973
1975
|
key: r,
|
|
@@ -1977,8 +1979,8 @@ var Qn = (e) => Y.get(e)?.category, $n = (e) => {
|
|
|
1977
1979
|
reason: e.reason
|
|
1978
1980
|
});
|
|
1979
1981
|
return {
|
|
1980
|
-
key: r !== void 0 &&
|
|
1981
|
-
category: r === void 0 ? e.category ?? "interaction" :
|
|
1982
|
+
key: r !== void 0 && ir(r) === "critical" ? r : void 0,
|
|
1983
|
+
category: r === void 0 ? e.category ?? "interaction" : nr[r].category,
|
|
1982
1984
|
hosts: e.hosts,
|
|
1983
1985
|
indexes: i
|
|
1984
1986
|
};
|
|
@@ -1992,31 +1994,31 @@ var Qn = (e) => Y.get(e)?.category, $n = (e) => {
|
|
|
1992
1994
|
allow: i.length > 0 && i.every((t) => e[t]?.allow === !0)
|
|
1993
1995
|
}))
|
|
1994
1996
|
};
|
|
1995
|
-
},
|
|
1996
|
-
typeof window < "u" &&
|
|
1997
|
-
if (!
|
|
1997
|
+
}, ur = (e) => typeof e == "object" && !!e, dr = typeof chrome < "u" && !!chrome.runtime?.id, fr = (e) => ur(e) && e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY === !0 && typeof e.frameId == "string" && typeof e.document == "string", pr = /* @__PURE__ */ new WeakMap(), mr = /* @__PURE__ */ new WeakMap(), hr = /* @__PURE__ */ new WeakMap(), gr = /* @__PURE__ */ new Set();
|
|
1998
|
+
typeof window < "u" && dr && window.addEventListener("message", (e) => {
|
|
1999
|
+
if (!fr(e.data)) return;
|
|
1998
2000
|
e.stopImmediatePropagation();
|
|
1999
2001
|
let t = e.source;
|
|
2000
2002
|
if (!t || typeof t != "object") return;
|
|
2001
|
-
let n = t, r =
|
|
2002
|
-
if (
|
|
2003
|
-
let o =
|
|
2003
|
+
let n = t, r = pr.get(n), i = e.data.frameId, a = e.data.document;
|
|
2004
|
+
if (pr.set(n, i), mr.set(n, a), r) for (let e of gr) e(r);
|
|
2005
|
+
let o = hr.get(n);
|
|
2004
2006
|
if (o) {
|
|
2005
2007
|
for (let e of [...o]) (e.notDocument === void 0 || e.notDocument !== a) && (o.delete(e), e.resolve(i));
|
|
2006
|
-
o.size ||
|
|
2008
|
+
o.size || hr.delete(n);
|
|
2007
2009
|
}
|
|
2008
2010
|
}, { capture: !0 });
|
|
2009
2011
|
//#endregion
|
|
2010
2012
|
//#region ../web-extension/lib/lib/evaluate-deadline.js
|
|
2011
|
-
var
|
|
2013
|
+
var _r = 3e4, vr = `frame.evaluate: the code did not settle within ${_r}ms`, yr = () => new z(vr), br = (e) => B(e) && e.message === vr ? yr() : e, xr = [
|
|
2012
2014
|
/^frame load timed out after \d+ms for /,
|
|
2013
2015
|
/^frame goto: documentstart timed out$/,
|
|
2014
2016
|
/^navigation to .+ did not commit a document within \d+ms$/s
|
|
2015
|
-
],
|
|
2016
|
-
if (e instanceof
|
|
2017
|
+
], Sr = (e) => {
|
|
2018
|
+
if (e instanceof z) return e;
|
|
2017
2019
|
let t = typeof e?.message == "string" ? e.message : "";
|
|
2018
|
-
return
|
|
2019
|
-
},
|
|
2020
|
+
return xr.some((e) => e.test(t)) ? new z(t) : e;
|
|
2021
|
+
}, Cr = (e) => {
|
|
2020
2022
|
let t = e;
|
|
2021
2023
|
if (t.window === void 0) return "iframe";
|
|
2022
2024
|
if (t.iframe !== void 0) throw TypeError("attachFrame: pass either iframe or window, not both");
|
|
@@ -2024,11 +2026,11 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2024
2026
|
if (t.blank !== void 0) throw TypeError("attachFrame: blank does not apply to a window");
|
|
2025
2027
|
if (typeof t.window != "object" || t.window === null) throw TypeError("attachFrame: window must be an object");
|
|
2026
2028
|
return "window";
|
|
2027
|
-
},
|
|
2029
|
+
}, wr = (e, t, n) => {
|
|
2028
2030
|
if (e === void 0) return t;
|
|
2029
2031
|
if (typeof e != "number" || !Number.isFinite(e) || e <= 0) throw TypeError(`attachFrame: window.${n} must be a positive number of CSS pixels`);
|
|
2030
2032
|
return Math.round(e);
|
|
2031
|
-
},
|
|
2033
|
+
}, Tr = ({ url: e, width: t, height: n }) => {
|
|
2032
2034
|
let r = (() => {
|
|
2033
2035
|
if (e === void 0 || e === "" || e === "about:blank") return "";
|
|
2034
2036
|
if (typeof e != "string") throw TypeError("attachFrame: window.url must be a string");
|
|
@@ -2044,10 +2046,10 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2044
2046
|
})();
|
|
2045
2047
|
return r && J(r), {
|
|
2046
2048
|
url: r,
|
|
2047
|
-
width:
|
|
2048
|
-
height:
|
|
2049
|
+
width: wr(t, 500, "width"),
|
|
2050
|
+
height: wr(n, 700, "height")
|
|
2049
2051
|
};
|
|
2050
|
-
},
|
|
2052
|
+
}, Er = "attachFrame: storageState seeds a fresh jar, so it needs cookies: 'ephemeral'", Dr = 1e11, Or = [
|
|
2051
2053
|
"name",
|
|
2052
2054
|
"value",
|
|
2053
2055
|
"domain",
|
|
@@ -2056,11 +2058,11 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2056
2058
|
"httpOnly",
|
|
2057
2059
|
"secure",
|
|
2058
2060
|
"sameSite"
|
|
2059
|
-
],
|
|
2061
|
+
], kr = [
|
|
2060
2062
|
"Strict",
|
|
2061
2063
|
"Lax",
|
|
2062
2064
|
"None"
|
|
2063
|
-
], X = /[;\x00-\x1f\x7f]/, Z = (e, t) => /* @__PURE__ */ TypeError(`attachFrame: storageState${e} ${t}`), Q = (e) => Object.prototype.toString.call(e) === "[object Object]",
|
|
2065
|
+
], X = /[;\x00-\x1f\x7f]/, Z = (e, t) => /* @__PURE__ */ TypeError(`attachFrame: storageState${e} ${t}`), Q = (e) => Object.prototype.toString.call(e) === "[object Object]", Ar = (e) => {
|
|
2064
2066
|
let t = e.startsWith(".") ? e.slice(1) : e;
|
|
2065
2067
|
if (t === "") return null;
|
|
2066
2068
|
try {
|
|
@@ -2068,19 +2070,19 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2068
2070
|
} catch {
|
|
2069
2071
|
return null;
|
|
2070
2072
|
}
|
|
2071
|
-
},
|
|
2073
|
+
}, jr = (e, t) => {
|
|
2072
2074
|
if (!Q(e)) throw Z(t, "must be an object");
|
|
2073
|
-
let n = Object.keys(e).find((e) => !
|
|
2075
|
+
let n = Object.keys(e).find((e) => !Or.includes(e));
|
|
2074
2076
|
if (n !== void 0) throw Z(`${t}.${n}`, "is not a cookie field");
|
|
2075
2077
|
let { name: r, value: i, domain: a, path: o, expires: s, httpOnly: c, secure: l, sameSite: u } = e;
|
|
2076
2078
|
if (typeof r != "string" || r === "" || r.includes("=") || X.test(r)) throw Z(`${t}.name`, "must be a non-empty string with no \"=\", \";\" or control character");
|
|
2077
2079
|
if (typeof i != "string" || X.test(i)) throw Z(`${t}.value`, "must be a string with no \";\" or control character");
|
|
2078
|
-
if (typeof a != "string" ||
|
|
2080
|
+
if (typeof a != "string" || Ar(a) === null) throw Z(`${t}.domain`, "must be a host: \".youtube.com\" for a cookie its subdomains also receive, \"www.youtube.com\" for a host-only one");
|
|
2079
2081
|
if (o !== void 0 && (typeof o != "string" || !o.startsWith("/") || X.test(o))) throw Z(`${t}.path`, "must be a string starting with \"/\"");
|
|
2080
2082
|
if (s !== void 0 && (typeof s != "number" || !Number.isFinite(s) || s <= 0 && s !== -1)) throw Z(`${t}.expires`, "must be -1 for a session cookie, or milliseconds since the epoch");
|
|
2081
2083
|
if (c !== void 0 && typeof c != "boolean") throw Z(`${t}.httpOnly`, "must be a boolean");
|
|
2082
2084
|
if (l !== void 0 && typeof l != "boolean") throw Z(`${t}.secure`, "must be a boolean");
|
|
2083
|
-
if (u !== void 0 && !
|
|
2085
|
+
if (u !== void 0 && !kr.includes(u)) throw Z(`${t}.sameSite`, `must be 'Strict', 'Lax' or 'None', not ${JSON.stringify(u)}`);
|
|
2084
2086
|
let d = r.toLowerCase();
|
|
2085
2087
|
if (u === "None" && l !== !0) throw Z(t, "is SameSite=None, which needs secure: true");
|
|
2086
2088
|
if (d.startsWith("__secure-") && l !== !0) throw Z(t, "is a __Secure- cookie, which needs secure: true");
|
|
@@ -2091,7 +2093,7 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2091
2093
|
domain: a
|
|
2092
2094
|
};
|
|
2093
2095
|
return o !== void 0 && (f.path = o), s !== void 0 && (f.expires = s), c !== void 0 && (f.httpOnly = c), l !== void 0 && (f.secure = l), u !== void 0 && (f.sameSite = u), f;
|
|
2094
|
-
},
|
|
2096
|
+
}, Mr = (e, t) => {
|
|
2095
2097
|
if (!Q(e)) throw Z(t, "must be an object { origin, localStorage }");
|
|
2096
2098
|
let n = Object.keys(e).find((e) => e !== "origin" && e !== "localStorage");
|
|
2097
2099
|
if (n !== void 0) throw Z(`${t}.${n}`, "is not an origin field");
|
|
@@ -2115,30 +2117,30 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2115
2117
|
};
|
|
2116
2118
|
})
|
|
2117
2119
|
};
|
|
2118
|
-
},
|
|
2120
|
+
}, Nr = (e) => {
|
|
2119
2121
|
if (!Q(e)) throw Z("", "must be an object { cookies?, origins? }");
|
|
2120
2122
|
let t = Object.keys(e).find((e) => e !== "cookies" && e !== "origins");
|
|
2121
2123
|
if (t !== void 0) throw Z(`.${t}`, "is not a storageState key; it takes cookies and origins");
|
|
2122
2124
|
let { cookies: n = [], origins: r = [] } = e;
|
|
2123
2125
|
if (!Array.isArray(n)) throw Z(".cookies", "must be an array");
|
|
2124
2126
|
if (!Array.isArray(r)) throw Z(".origins", "must be an array");
|
|
2125
|
-
let i = n.map((e, t) =>
|
|
2127
|
+
let i = n.map((e, t) => jr(e, `.cookies[${t}]`)), a = r.map((e, t) => Mr(e, `.origins[${t}]`));
|
|
2126
2128
|
return i.forEach(({ expires: e }, t) => {
|
|
2127
|
-
if (e !== void 0 && e > 0 && e <
|
|
2129
|
+
if (e !== void 0 && e > 0 && e < Dr) throw Z(`.cookies[${t}].expires`, `is milliseconds since the epoch, and ${e} reads as a date before 1974; a Playwright storageState gives seconds, so multiply it by 1000`);
|
|
2128
2130
|
}), {
|
|
2129
2131
|
cookies: i,
|
|
2130
2132
|
origins: a
|
|
2131
2133
|
};
|
|
2132
|
-
},
|
|
2134
|
+
}, Pr = [
|
|
2133
2135
|
"persistent",
|
|
2134
2136
|
"ephemeral",
|
|
2135
2137
|
"native"
|
|
2136
|
-
],
|
|
2137
|
-
if ("syncCookies" in e) throw TypeError(
|
|
2138
|
+
], Fr = "attachFrame: syncCookies was replaced by cookies. true is cookies: 'persistent', or 'native' for the person's own browser cookies on the extension; false is cookies: 'ephemeral'", Ir = (e) => {
|
|
2139
|
+
if ("syncCookies" in e) throw TypeError(Fr);
|
|
2138
2140
|
let { cookies: t = "persistent" } = e;
|
|
2139
|
-
if (!
|
|
2140
|
-
if (e.storageState !== void 0 && t !== "ephemeral") throw TypeError(
|
|
2141
|
-
let n = e.storageState === void 0 ? void 0 :
|
|
2141
|
+
if (!Pr.includes(t)) throw TypeError(`attachFrame: cookies must be 'persistent', 'ephemeral' or 'native', not ${JSON.stringify(t)}`);
|
|
2142
|
+
if (e.storageState !== void 0 && t !== "ephemeral") throw TypeError(Er);
|
|
2143
|
+
let n = e.storageState === void 0 ? void 0 : Nr(e.storageState), r = Cr(e);
|
|
2142
2144
|
if (r === "iframe" && e.lockdown && t !== "native") throw TypeError("attachFrame: lockdown runs on the extension, which serves only cookies: 'native'");
|
|
2143
2145
|
return n === void 0 ? {
|
|
2144
2146
|
kind: r,
|
|
@@ -2148,20 +2150,20 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2148
2150
|
cookies: t,
|
|
2149
2151
|
storageState: n
|
|
2150
2152
|
};
|
|
2151
|
-
},
|
|
2153
|
+
}, Lr = (e) => {
|
|
2152
2154
|
try {
|
|
2153
2155
|
return new URL(e).hostname;
|
|
2154
2156
|
} catch {
|
|
2155
2157
|
return "";
|
|
2156
2158
|
}
|
|
2157
|
-
},
|
|
2158
|
-
|
|
2159
|
-
},
|
|
2159
|
+
}, Rr = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY", zr = !1, Br = () => {
|
|
2160
|
+
zr || (zr = !0, console.warn("[fkn-frame] the installed FKN WebExtension is too old to ask for permission categories upfront, so each capability will be asked for as it is first used. Updating the extension fixes this."));
|
|
2161
|
+
}, Vr = "frame: this frame no longer holds the document the app attached it to", Hr = "frame.postMessage: '*' is not served on the extension yet, since this extension does not report the frame's origin; pass the page's origin as targetOrigin", Ur = () => {
|
|
2160
2162
|
let e = E();
|
|
2161
2163
|
if (e.status === "ok" && e.abi >= 1) return;
|
|
2162
2164
|
let t = e.status === "absent" ? 0 : e.abi;
|
|
2163
2165
|
throw new T("lockdown", t, `attachFrame: the installed FKN WebExtension (ABI ${t}) may predate lockdown, and one that does attaches the frame with its CSP removed rather than locked down. Updating the extension fixes this.`);
|
|
2164
|
-
},
|
|
2166
|
+
}, Wr = (e) => {
|
|
2165
2167
|
try {
|
|
2166
2168
|
return new URL(e, location.href).hostname;
|
|
2167
2169
|
} catch {
|
|
@@ -2170,28 +2172,28 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2170
2172
|
}, $ = () => {
|
|
2171
2173
|
let e = E();
|
|
2172
2174
|
return e.status === "absent" ? 0 : e.abi;
|
|
2173
|
-
},
|
|
2174
|
-
if (i !== void 0) throw new T("blank", $(),
|
|
2175
|
+
}, Gr = "attachFrame: a blank page is served by the cloud render proxy only; call cloud.attachFrame", Kr = "frame.addScriptTag: an extension frame does not run scripts through mirage yet; attach with cloud.attachFrame", qr = "frame.clearCookies: an extension frame runs on the browser's own cookies (cookies: 'native'), which FKN does not clear; attach with cookies: 'persistent' to clear the app's jar", Jr = async ({ iframe: e, domains: t = [], lockdown: n = !1, permissions: r, blank: i }) => {
|
|
2176
|
+
if (i !== void 0) throw new T("blank", $(), Gr);
|
|
2175
2177
|
let a = crypto.randomUUID();
|
|
2176
|
-
if (J(e.src),
|
|
2178
|
+
if (J(e.src), jn({
|
|
2177
2179
|
src: e.src,
|
|
2178
2180
|
domains: t,
|
|
2179
2181
|
lockdown: n
|
|
2180
|
-
}), await O(), n &&
|
|
2181
|
-
e.dispatchEvent(new CustomEvent(
|
|
2182
|
+
}), ct("attachFrame", t), await O(), n && Ur(), !e.isConnected) throw Error("attachFrame: the iframe must be connected to the document before attaching");
|
|
2183
|
+
e.dispatchEvent(new CustomEvent(Rr, { detail: a }));
|
|
2182
2184
|
let { executeLocator: o, highlightLocator: s, ensureLocatorPermission: c, requestCategories: l, evaluateFrame: u, goto: d } = await k.attachFrame({
|
|
2183
2185
|
marker: a,
|
|
2184
2186
|
domains: t,
|
|
2185
2187
|
syncCookies: !0,
|
|
2186
2188
|
lockdown: n
|
|
2187
|
-
}), f = new Set(p([...t,
|
|
2189
|
+
}), f = new Set(p([...t, Wr(e.src)], { ipv6: !0 })), m = (e) => f.has(p([Lr(e)], { ipv6: !0 })[0] ?? ""), h = Xn({
|
|
2188
2190
|
backend: "extension",
|
|
2189
2191
|
executor: {
|
|
2190
2192
|
execute: o,
|
|
2191
2193
|
highlight: s
|
|
2192
2194
|
},
|
|
2193
2195
|
gate: (e) => c(e.parts, e.operation, e.args),
|
|
2194
|
-
requestPermissions: async (e) => (
|
|
2196
|
+
requestPermissions: async (e) => (cr("frame.requestPermissions", e), await Sn(), l(e)),
|
|
2195
2197
|
evaluate: async (e, t) => {
|
|
2196
2198
|
if (!Me(E(), "evaluate")) {
|
|
2197
2199
|
let e = E();
|
|
@@ -2201,25 +2203,25 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2201
2203
|
source: e,
|
|
2202
2204
|
arg: t
|
|
2203
2205
|
}).catch((e) => {
|
|
2204
|
-
throw
|
|
2206
|
+
throw br(e);
|
|
2205
2207
|
});
|
|
2206
2208
|
},
|
|
2207
2209
|
addScriptTag: async () => {
|
|
2208
|
-
throw new T("addScriptTag", $(),
|
|
2210
|
+
throw new T("addScriptTag", $(), Kr);
|
|
2209
2211
|
},
|
|
2210
2212
|
clearCookies: async () => {
|
|
2211
|
-
throw new T("clearCookies", $(),
|
|
2213
|
+
throw new T("clearCookies", $(), qr);
|
|
2212
2214
|
},
|
|
2213
2215
|
postMessage: (t, n, r) => {
|
|
2214
|
-
if (n === "*") throw
|
|
2215
|
-
if (!m(n)) throw
|
|
2216
|
+
if (n === "*") throw Tt(Hr, "postMessage", "extension");
|
|
2217
|
+
if (!m(n)) throw Dt(Vr, "postMessage");
|
|
2216
2218
|
let i = e.contentWindow;
|
|
2217
|
-
if (i === null) throw
|
|
2219
|
+
if (i === null) throw Dt("frame: navigate the frame before postMessage", "postMessage");
|
|
2218
2220
|
return i.postMessage(t, n, r), Promise.resolve();
|
|
2219
2221
|
},
|
|
2220
2222
|
listen: (t) => {
|
|
2221
2223
|
let n = (n) => {
|
|
2222
|
-
n.source !== null && n.source === e.contentWindow && !
|
|
2224
|
+
n.source !== null && n.source === e.contentWindow && !fr(n.data) && m(n.origin) && t({
|
|
2223
2225
|
type: "message",
|
|
2224
2226
|
data: n.data,
|
|
2225
2227
|
origin: n.origin,
|
|
@@ -2234,26 +2236,27 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2234
2236
|
};
|
|
2235
2237
|
},
|
|
2236
2238
|
goto: (e, { waitUntil: t, timeout: n, ...r } = {}) => {
|
|
2237
|
-
|
|
2239
|
+
ct("frame.goto", [Wr(e), ...r.domains ?? []]);
|
|
2240
|
+
for (let t of p([Wr(e)], { ipv6: !0 })) f.add(t);
|
|
2238
2241
|
return d({
|
|
2239
2242
|
url: e,
|
|
2240
2243
|
...r,
|
|
2241
2244
|
...t === void 0 ? {} : { waitUntil: t === "commit" ? "documentstart" : t },
|
|
2242
2245
|
...n === void 0 ? {} : { timeoutMs: n }
|
|
2243
2246
|
}).catch((e) => {
|
|
2244
|
-
throw
|
|
2247
|
+
throw Sr(e);
|
|
2245
2248
|
});
|
|
2246
2249
|
},
|
|
2247
2250
|
url: () => e.src
|
|
2248
2251
|
});
|
|
2249
|
-
return r?.length && (
|
|
2250
|
-
},
|
|
2251
|
-
throw
|
|
2252
|
-
},
|
|
2253
|
-
let { kind: t, cookies: n } =
|
|
2254
|
-
if (n !== "native") throw new T("cookies", $(),
|
|
2255
|
-
return t === "window" ?
|
|
2256
|
-
}),
|
|
2252
|
+
return r?.length && (xn() ? await h.requestPermissions(r) : Br()), h;
|
|
2253
|
+
}, Yr = "attachFrame: a window on cookies: 'native' is not served yet; a window runs on the cloud render proxy, which has no browser cookies", Xr = (e) => `attachFrame: cookies: '${e}' runs on the cloud render proxy; call cloud.attachFrame or the top-level attachFrame`, Zr = async (e) => {
|
|
2254
|
+
throw Tr(e.window), new T("attachWindow", $(), Yr);
|
|
2255
|
+
}, Qr = (async (e) => {
|
|
2256
|
+
let { kind: t, cookies: n } = Ir(e);
|
|
2257
|
+
if (n !== "native") throw new T("cookies", $(), Xr(n));
|
|
2258
|
+
return t === "window" ? Zr(e) : Jr(e);
|
|
2259
|
+
}), $r = "permissions.request: pass hosts, the sites the grant applies to", ei = { request: async (e) => {
|
|
2257
2260
|
let t = e.map((e) => {
|
|
2258
2261
|
let { category: t, key: n, scope: r, reason: i, hosts: a } = e;
|
|
2259
2262
|
if (!("hosts" in e) && !("category" in e)) return { legacy: {
|
|
@@ -2262,17 +2265,17 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
|
|
|
2262
2265
|
reason: i
|
|
2263
2266
|
} };
|
|
2264
2267
|
let o = p(a ?? [], { ipv6: !0 });
|
|
2265
|
-
if (!o.length) throw TypeError(
|
|
2266
|
-
return { ask: {
|
|
2268
|
+
if (!o.length) throw TypeError($r);
|
|
2269
|
+
return ot("permissions.request", o), { ask: {
|
|
2267
2270
|
category: t,
|
|
2268
2271
|
key: n,
|
|
2269
2272
|
reason: i,
|
|
2270
2273
|
hosts: o
|
|
2271
2274
|
} };
|
|
2272
2275
|
}), n = t.flatMap((e) => "ask" in e ? [e.ask] : []);
|
|
2273
|
-
|
|
2274
|
-
let { items: r, answer: i } =
|
|
2276
|
+
cr("permissions.request", n), n.length && await Sn();
|
|
2277
|
+
let { items: r, answer: i } = lr(n), a = t.flatMap((e) => "legacy" in e ? [e.legacy] : []), o = [...r, ...a], s = o.length ? await k.requestPermissions(o) : [], c = i(s.slice(0, r.length)), l = s.slice(r.length), u = 0, d = 0;
|
|
2275
2278
|
return t.map((e) => "ask" in e ? c[u++] : l[d++]);
|
|
2276
|
-
} },
|
|
2279
|
+
} }, ti = "PermissionDeniedError", ni = (e) => e instanceof Error ? e.name === ti : ur(e) && e.name === "PermissionDeniedError";
|
|
2277
2280
|
//#endregion
|
|
2278
|
-
export {
|
|
2281
|
+
export { Fe as $, Et as A, ut as B, An as C, kt as D, I as E, At as F, Ye as G, $e as H, Ct as I, Ze as J, qe as K, dt as L, Tt as M, jt as N, Dt as O, St as P, He as Q, pt as R, jn as S, z as T, tt as U, lt as V, Je as W, We as X, Be as Y, Ue as Z, Rn as _, Qr as a, T as at, Nn as b, Sr as c, je as ct, ur as d, _e as dt, Ie as et, cr as f, ve as ft, In as g, ir as h, Rr as i, Se as it, B as j, L as k, _r as l, xe as lt, ar as m, C as mt, ni as n, Le as nt, Ir as o, w as ot, rr as p, be as pt, Qe as q, ei as r, O as rt, Tr as s, Ce as st, ti as t, E as tt, yr as u, ye as ut, Mn as v, Tn as w, J as x, Xn as y, ft as z };
|