@fkn/lib 0.9.5 → 0.9.8
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/account.cjs +1 -1
- package/account.js +1 -1
- package/{api-Bhz3iB9m.js → api-BU8zNmQI.js} +54 -17
- package/{api-BFqrrvzI.d.ts → api-BdGpFv2D.d.ts} +161 -77
- package/{api-C75xqLFy.cjs → api-C9Mh5v0z.cjs} +1 -1
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.js +1 -1
- package/cloud/fetch.cjs +1 -0
- package/cloud/fetch.d.ts +2 -0
- package/cloud/fetch.js +2 -0
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.js +1 -1
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +1 -1
- package/{cloud-Bzjnrblb.d.ts → cloud-C002L8iN.d.ts} +4 -9
- package/cloud-DZzkfeQi.cjs +1 -0
- package/cloud-OAvwgd_r.js +283 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -2
- package/cloud.js +4 -4
- package/{dgram-D4JF_XW7.js → dgram-DNbgOMoK.js} +1 -1
- package/{dgram-C2LmoO0A.cjs → dgram-ocGNUMpo.cjs} +1 -1
- package/dgram.cjs +1 -1
- package/dgram.d.ts +1 -1
- package/dgram.js +1 -1
- package/dns.cjs +1 -1
- package/dns.js +1 -1
- package/{extension-XC1EtYP6.d.ts → extension-B0qU5XuR.d.ts} +2 -2
- package/extension-DQZmGSuX.js +78 -0
- package/extension-DmKxv-br.cjs +1 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/fs/promises.cjs +1 -1
- package/fs/promises.js +1 -1
- package/{fs-Bghx-1Hy.js → fs-BYMGoFir.js} +2 -2
- package/{fs-BXcz3BjJ.cjs → fs-D-pDr8fW.cjs} +1 -1
- package/fs.cjs +1 -1
- package/fs.js +1 -1
- package/http.cjs +1 -1
- package/http.d.ts +2 -1
- package/http.js +1 -1
- package/{index-BQdGI3d3.d.ts → index-DQfP-Uhy.d.ts} +24 -38
- package/index.cjs +1 -1
- package/index.d.ts +6 -6
- package/index.js +26 -25
- package/{proxy-DGVOk4Q8.js → lib-BcEnB4iV.js} +332 -639
- package/lib-CQqdCndr.cjs +31 -0
- package/{net-MbSFrO35.d.ts → net-BVC0ImHf.d.ts} +1 -3
- package/{net-BgQYnATG.js → net-Bi82weSE.js} +1 -1
- package/{net-zOx2OVGc.cjs → net-uN5eXX3L.cjs} +1 -1
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +1 -1
- package/package.json +7 -2
- package/{packages-CErlrrLB.d.ts → packages-DU1D-pr4.d.ts} +58 -8
- package/packages.cjs +1 -1
- package/packages.d.ts +2 -2
- package/packages.js +88 -24
- package/proxy-CMtPeuvd.js +43 -0
- package/proxy-CsFzuq-x.d.ts +8 -0
- package/proxy-DbcJMUcm.cjs +1 -0
- package/{storage-D01O3zky.js → storage-BVWaXq8X.js} +1 -1
- package/{storage-a3OhXFv2.cjs → storage-DG1Ac1FK.cjs} +1 -1
- package/cloud-CbNYpNK8.js +0 -129
- package/cloud-mWhpmEwZ.cjs +0 -1
- package/extension-C6xmQRHj.js +0 -78
- package/extension-dmTtpkT5.cjs +0 -1
- package/proxy-C67lCEBx.cjs +0 -53
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { t } from "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var s = (e, t) => {
|
|
2
|
+
import { BoxBase as t, createTypedEventTarget as n, expose as r, recursiveBox as i, recursiveRevive as a } from "osra";
|
|
3
|
+
//#region ../web-extension/lib/lib/revivables/event-proxy.js
|
|
4
|
+
var o = (e, t) => {
|
|
6
5
|
let n = new EventTarget(), r = /* @__PURE__ */ new Map(), i = EventTarget.prototype.addEventListener.bind(n), a = EventTarget.prototype.removeEventListener.bind(n);
|
|
7
6
|
return Object.defineProperty(n, "addEventListener", {
|
|
8
7
|
configurable: !0,
|
|
@@ -31,15 +30,15 @@ var s = (e, t) => {
|
|
|
31
30
|
o && (e.removeEventListener(t, o), r.delete(t));
|
|
32
31
|
}
|
|
33
32
|
}), n;
|
|
34
|
-
},
|
|
33
|
+
}, s = (e) => typeof e == "boolean" ? +!!e : +!!e?.capture, c = (e) => {
|
|
35
34
|
let t = /* @__PURE__ */ new WeakMap();
|
|
36
35
|
return {
|
|
37
36
|
addEventListener: (n, r, i) => {
|
|
38
37
|
if (r === null) return;
|
|
39
|
-
let a = `${n}|${
|
|
38
|
+
let a = `${n}|${s(i)}`, o = t.get(r);
|
|
40
39
|
if (o || (o = /* @__PURE__ */ new Map(), t.set(r, o)), o.has(a)) return;
|
|
41
|
-
let
|
|
42
|
-
|
|
40
|
+
let c = typeof i == "object" && !!i && !!i.once, l = (t) => {
|
|
41
|
+
c && o.delete(a);
|
|
43
42
|
let i = e.unenrich(t, n);
|
|
44
43
|
typeof r == "function" ? r.call(e.target, i) : r.handleEvent(i);
|
|
45
44
|
};
|
|
@@ -47,18 +46,18 @@ var s = (e, t) => {
|
|
|
47
46
|
},
|
|
48
47
|
removeEventListener: (n, r, i) => {
|
|
49
48
|
if (r === null) return;
|
|
50
|
-
let a = `${n}|${
|
|
51
|
-
|
|
49
|
+
let a = `${n}|${s(i)}`, o = t.get(r), c = o?.get(a);
|
|
50
|
+
c && (e.remoteEvents.removeEventListener(n, c, i), o.delete(a));
|
|
52
51
|
},
|
|
53
52
|
dispatchEvent: (t) => e.remoteEvents.dispatchEvent(t)
|
|
54
53
|
};
|
|
55
|
-
},
|
|
56
|
-
box: () =>
|
|
57
|
-
createVideoElementHandle: () =>
|
|
58
|
-
isType: () =>
|
|
59
|
-
revive: () =>
|
|
60
|
-
type: () =>
|
|
61
|
-
}),
|
|
54
|
+
}, l = /* @__PURE__ */ e({
|
|
55
|
+
box: () => S,
|
|
56
|
+
createVideoElementHandle: () => b,
|
|
57
|
+
isType: () => x,
|
|
58
|
+
revive: () => C,
|
|
59
|
+
type: () => u
|
|
60
|
+
}), u = "videoElement", d = [
|
|
62
61
|
"currentTime",
|
|
63
62
|
"volume",
|
|
64
63
|
"muted",
|
|
@@ -69,17 +68,17 @@ var s = (e, t) => {
|
|
|
69
68
|
"preload",
|
|
70
69
|
"poster",
|
|
71
70
|
"disableRemotePlayback"
|
|
72
|
-
],
|
|
71
|
+
], f = [
|
|
73
72
|
"duration",
|
|
74
73
|
"paused",
|
|
75
74
|
"ended",
|
|
76
75
|
"seeking",
|
|
77
76
|
"readyState",
|
|
78
77
|
"currentSrc"
|
|
79
|
-
],
|
|
78
|
+
], 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) => {
|
|
80
79
|
let t = {};
|
|
81
|
-
for (let n of [...
|
|
82
|
-
for (let n of
|
|
80
|
+
for (let n of [...d, ...f]) t[n] = e[n];
|
|
81
|
+
for (let n of p) t[n] = _(e[n]);
|
|
83
82
|
return t.error = e.error ? {
|
|
84
83
|
code: e.error.code,
|
|
85
84
|
message: e.error.message
|
|
@@ -106,10 +105,10 @@ var s = (e, t) => {
|
|
|
106
105
|
MEDIA_ERR_NETWORK: 2,
|
|
107
106
|
MEDIA_ERR_DECODE: 3,
|
|
108
107
|
MEDIA_ERR_SRC_NOT_SUPPORTED: 4
|
|
109
|
-
} : null,
|
|
108
|
+
} : null, y = (e) => o(e, (e, t) => ({
|
|
110
109
|
originalDetail: e instanceof CustomEvent ? e.detail : null,
|
|
111
|
-
snapshot:
|
|
112
|
-
})),
|
|
110
|
+
snapshot: v(t)
|
|
111
|
+
})), ne = async (e, t) => {
|
|
113
112
|
switch (t) {
|
|
114
113
|
case "play": return await e.play(), null;
|
|
115
114
|
case "pause": return e.pause(), null;
|
|
@@ -124,19 +123,19 @@ var s = (e, t) => {
|
|
|
124
123
|
}
|
|
125
124
|
default: throw Error(`videoElement: unknown method "${t}"`);
|
|
126
125
|
}
|
|
127
|
-
},
|
|
128
|
-
call: async (t) =>
|
|
126
|
+
}, re = (e) => ({
|
|
127
|
+
call: async (t) => ne(e, t),
|
|
129
128
|
set: async (t, n) => {
|
|
130
129
|
try {
|
|
131
130
|
e[t] = n;
|
|
132
131
|
} catch {}
|
|
133
|
-
return
|
|
132
|
+
return v(e);
|
|
134
133
|
},
|
|
135
|
-
events:
|
|
136
|
-
}),
|
|
134
|
+
events: y(e)
|
|
135
|
+
}), ie = (e, t) => {
|
|
137
136
|
let n = new EventTarget();
|
|
138
|
-
Object.defineProperty(n,
|
|
139
|
-
let r =
|
|
137
|
+
Object.defineProperty(n, m, { value: !0 }), Object.defineProperty(n, h, { value: e }), Object.defineProperty(n, g, { value: t });
|
|
138
|
+
let r = c({
|
|
140
139
|
target: n,
|
|
141
140
|
remoteEvents: t.events,
|
|
142
141
|
unenrich: (t, n) => {
|
|
@@ -207,7 +206,7 @@ var s = (e, t) => {
|
|
|
207
206
|
value: 4
|
|
208
207
|
}
|
|
209
208
|
};
|
|
210
|
-
for (let n of
|
|
209
|
+
for (let n of d) i[n] = {
|
|
211
210
|
configurable: !0,
|
|
212
211
|
enumerable: !0,
|
|
213
212
|
get() {
|
|
@@ -219,14 +218,14 @@ var s = (e, t) => {
|
|
|
219
218
|
}, () => {});
|
|
220
219
|
}
|
|
221
220
|
};
|
|
222
|
-
for (let t of
|
|
221
|
+
for (let t of f) i[t] = {
|
|
223
222
|
configurable: !0,
|
|
224
223
|
enumerable: !0,
|
|
225
224
|
get() {
|
|
226
225
|
return e[t];
|
|
227
226
|
}
|
|
228
227
|
};
|
|
229
|
-
for (let t of
|
|
228
|
+
for (let t of p) i[t] = {
|
|
230
229
|
configurable: !0,
|
|
231
230
|
enumerable: !0,
|
|
232
231
|
get() {
|
|
@@ -234,78 +233,71 @@ var s = (e, t) => {
|
|
|
234
233
|
}
|
|
235
234
|
};
|
|
236
235
|
return Object.defineProperties(n, i), n;
|
|
237
|
-
},
|
|
236
|
+
}, b = (e) => ie(v(e), re(e)), x = (e) => typeof e == "object" && !!e && e[m] === !0, S = (e, n) => {
|
|
238
237
|
let r = e;
|
|
239
238
|
return {
|
|
240
|
-
...
|
|
241
|
-
type:
|
|
242
|
-
initialState: r[
|
|
243
|
-
controller:
|
|
239
|
+
...t,
|
|
240
|
+
type: u,
|
|
241
|
+
initialState: r[h],
|
|
242
|
+
controller: i(r[g], n)
|
|
244
243
|
};
|
|
245
|
-
},
|
|
246
|
-
let n =
|
|
247
|
-
return
|
|
248
|
-
},
|
|
244
|
+
}, C = (e, t) => {
|
|
245
|
+
let n = a(e.controller, t);
|
|
246
|
+
return ie({ ...e.initialState }, n);
|
|
247
|
+
}, w = (e) => [l, ...e], ae = "FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY", oe = "fknExtension", se = n();
|
|
249
248
|
typeof document < "u" && document.addEventListener(ae, () => {
|
|
250
|
-
|
|
249
|
+
se.dispatchEvent(new CustomEvent("statuschange", { detail: { enabled: T() } }));
|
|
251
250
|
});
|
|
252
|
-
var
|
|
253
|
-
|
|
254
|
-
},
|
|
255
|
-
if (
|
|
251
|
+
var T = () => typeof document > "u" ? !1 : document.documentElement.dataset[oe] === "true", E = null, ce = (e) => {
|
|
252
|
+
E = e;
|
|
253
|
+
}, le = 150, D = (e = 1e3) => new Promise((t, n) => {
|
|
254
|
+
if (T()) return t();
|
|
256
255
|
let r, i = (e) => {
|
|
257
256
|
clearTimeout(r), s.disconnect(), document.removeEventListener("readystatechange", c), e();
|
|
258
257
|
}, a = () => i(async () => {
|
|
259
|
-
if (
|
|
258
|
+
if (E && (await E().catch(() => {}), T())) return t();
|
|
260
259
|
n(/* @__PURE__ */ Error("The FKN WebExtension is not installed, enabled or not exposed on this page."));
|
|
261
260
|
}), o = () => {
|
|
262
|
-
clearTimeout(r), r = setTimeout(() =>
|
|
261
|
+
clearTimeout(r), r = setTimeout(() => T() ? i(t) : a(), le);
|
|
263
262
|
}, s = new MutationObserver(() => {
|
|
264
|
-
|
|
263
|
+
T() && i(t);
|
|
265
264
|
}), c = () => {
|
|
266
|
-
document.readyState === "complete" && !
|
|
265
|
+
document.readyState === "complete" && !T() && o();
|
|
267
266
|
};
|
|
268
267
|
if (r = setTimeout(a, e), s.observe(document.documentElement, {
|
|
269
268
|
attributes: !0,
|
|
270
269
|
attributeFilter: ["data-fkn-extension"]
|
|
271
270
|
}), document.addEventListener("readystatechange", c), document.readyState === "complete") return o();
|
|
272
|
-
|
|
273
|
-
}),
|
|
274
|
-
await
|
|
271
|
+
T() && i(t);
|
|
272
|
+
}), ue, O = new Proxy({}, { get: (e, t) => async (...e) => {
|
|
273
|
+
await D(), ue ??= r({}, {
|
|
275
274
|
transport: window,
|
|
276
|
-
revivableModules:
|
|
275
|
+
revivableModules: w
|
|
277
276
|
});
|
|
278
|
-
let n = (await
|
|
277
|
+
let n = (await ue)[t];
|
|
279
278
|
return n(...e);
|
|
280
|
-
} }),
|
|
279
|
+
} }), k = [
|
|
281
280
|
"origin",
|
|
282
281
|
"referer",
|
|
283
282
|
"cookie"
|
|
284
|
-
],
|
|
285
|
-
if (t === "include" &&
|
|
286
|
-
},
|
|
287
|
-
let t = [...new Set((e ?? []).map(([e]) => e.trim().toLowerCase()).filter((e) => !
|
|
283
|
+
], de = (e, t) => (e ?? []).some(([e, n]) => e.trim().toLowerCase() === t && n !== ""), fe = (e) => de(e, "cookie"), pe = (e, t) => {
|
|
284
|
+
if (t === "include" && fe(e)) throw Error("fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other");
|
|
285
|
+
}, me = (e) => {
|
|
286
|
+
let t = [...new Set((e ?? []).map(([e]) => e.trim().toLowerCase()).filter((e) => !k.includes(e)))];
|
|
288
287
|
if (t.length) throw Error(`fetch: refusing to forge request header(s): ${t.join(", ")}`);
|
|
289
|
-
},
|
|
288
|
+
}, he = {
|
|
290
289
|
scope: "network.fetch",
|
|
291
290
|
category: "network",
|
|
292
291
|
severity: 0,
|
|
293
292
|
title: "Fetch data from other sites",
|
|
294
293
|
description: "Lets the app download public data from other websites directly, past the usual cross-origin limits."
|
|
295
|
-
},
|
|
294
|
+
}, ge = {
|
|
296
295
|
scope: "network.fetchCredentialed",
|
|
297
296
|
category: "network",
|
|
298
297
|
severity: 3,
|
|
299
298
|
unsafe: !0,
|
|
300
299
|
title: "Fetch from other sites, signed in as you",
|
|
301
300
|
description: "Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see."
|
|
302
|
-
}, ge = {
|
|
303
|
-
scope: "network.fetchForgedCookie",
|
|
304
|
-
category: "network",
|
|
305
|
-
severity: 2,
|
|
306
|
-
unsafe: !0,
|
|
307
|
-
title: "Send its own cookies to other sites",
|
|
308
|
-
description: "Lets the app attach cookies it already holds to its requests, so the other site answers as if signed in to the account the app is holding, not yours."
|
|
309
301
|
}, _e = {
|
|
310
302
|
scope: "network.fetchLocal",
|
|
311
303
|
category: "network",
|
|
@@ -327,7 +319,7 @@ var D = () => typeof document > "u" ? !1 : document.documentElement.dataset[oe]
|
|
|
327
319
|
}
|
|
328
320
|
let n = t.hostname.replace(/^\[|\]$/g, "").toLowerCase().replace(/\.$/, "");
|
|
329
321
|
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:") : ve(n);
|
|
330
|
-
}, be = ["fkn.app", "fkn.dev"],
|
|
322
|
+
}, be = ["fkn.app", "fkn.dev"], A = (e) => {
|
|
331
323
|
let t;
|
|
332
324
|
try {
|
|
333
325
|
t = new URL(e);
|
|
@@ -337,20 +329,20 @@ var D = () => typeof document > "u" ? !1 : document.documentElement.dataset[oe]
|
|
|
337
329
|
if (t.protocol === "chrome-extension:" || t.protocol === "moz-extension:") return !0;
|
|
338
330
|
let n = t.hostname;
|
|
339
331
|
return be.some((e) => n === e || n.endsWith(`.${e}`));
|
|
340
|
-
},
|
|
341
|
-
if (
|
|
332
|
+
}, j = (e) => {
|
|
333
|
+
if (A(e)) throw Error("fetch: refusing to target the extension's own pages or FKN platform domains");
|
|
342
334
|
}, xe = (e) => {
|
|
343
335
|
if (!e?.headers) return;
|
|
344
|
-
let t = new Headers(e.headers), n =
|
|
336
|
+
let t = new Headers(e.headers), n = k.map((e) => {
|
|
345
337
|
let n = t.get(e);
|
|
346
338
|
return n === null || n === "" ? void 0 : [e, n];
|
|
347
339
|
}).filter((e) => e !== void 0);
|
|
348
340
|
return n.length ? n : void 0;
|
|
349
341
|
}, Se = async (e, t) => {
|
|
350
342
|
let n = new Request(e, t);
|
|
351
|
-
|
|
343
|
+
j(n.url);
|
|
352
344
|
let r = n.body ? await n.arrayBuffer() : null;
|
|
353
|
-
return
|
|
345
|
+
return O.proxyFetch({
|
|
354
346
|
url: n.url,
|
|
355
347
|
method: n.method,
|
|
356
348
|
headers: [...n.headers],
|
|
@@ -368,14 +360,14 @@ var D = () => typeof document > "u" ? !1 : document.documentElement.dataset[oe]
|
|
|
368
360
|
unsafe: !0,
|
|
369
361
|
title: "Read a site’s cookie",
|
|
370
362
|
description: "Lets the app read a named cookie from another site, which can include the login token only that site should see."
|
|
371
|
-
}, we = { get: (e) =>
|
|
363
|
+
}, we = { get: (e) => O.getCookie(e) }, Te = {
|
|
372
364
|
scope: "network.modifyRequestHeaders",
|
|
373
365
|
category: "network",
|
|
374
366
|
severity: 2,
|
|
375
367
|
unsafe: !0,
|
|
376
368
|
title: "Rewrite request headers to other sites",
|
|
377
369
|
description: "Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites."
|
|
378
|
-
}, Ee = (e) =>
|
|
370
|
+
}, Ee = (e) => O.setRequestHeaderRule(e), De = (e) => O.removeRequestHeaderRule({ ruleId: e }), Oe = class extends Error {
|
|
379
371
|
reason;
|
|
380
372
|
filename;
|
|
381
373
|
line;
|
|
@@ -391,11 +383,11 @@ var D = () => typeof document > "u" ? !1 : document.documentElement.dataset[oe]
|
|
|
391
383
|
constructor(e, t, n) {
|
|
392
384
|
this.start = e, this.end = t, this.source = n;
|
|
393
385
|
}
|
|
394
|
-
},
|
|
386
|
+
}, M;
|
|
395
387
|
(function(e) {
|
|
396
|
-
e.stylesheet = "stylesheet", e.rule = "rule", e.declaration = "declaration", e.comment = "comment", e.
|
|
397
|
-
})(
|
|
398
|
-
var
|
|
388
|
+
e.stylesheet = "stylesheet", e.rule = "rule", e.declaration = "declaration", e.comment = "comment", e.container = "container", e.charset = "charset", e.document = "document", e.customMedia = "custom-media", e.fontFace = "font-face", 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.startingStyle = "starting-style", e.supports = "supports";
|
|
389
|
+
})(M ||= {});
|
|
390
|
+
var N = (e, t, n) => {
|
|
399
391
|
let r = n, i = 1e4;
|
|
400
392
|
do {
|
|
401
393
|
let n = t.map((t) => e.indexOf(t, r));
|
|
@@ -407,7 +399,7 @@ var F = (e, t, n) => {
|
|
|
407
399
|
r = o + 2, i--;
|
|
408
400
|
} while (i > 0);
|
|
409
401
|
throw Error("Too many escaping");
|
|
410
|
-
},
|
|
402
|
+
}, P = (e, t, n) => {
|
|
411
403
|
let r = n, i = 1e4;
|
|
412
404
|
do {
|
|
413
405
|
let n = t.map((t) => e.indexOf(t, r));
|
|
@@ -421,21 +413,21 @@ var F = (e, t, n) => {
|
|
|
421
413
|
break;
|
|
422
414
|
case "(":
|
|
423
415
|
{
|
|
424
|
-
let t =
|
|
416
|
+
let t = P(e, [")"], o + 1);
|
|
425
417
|
if (t === -1) return -1;
|
|
426
418
|
r = t + 1;
|
|
427
419
|
}
|
|
428
420
|
break;
|
|
429
421
|
case "\"":
|
|
430
422
|
{
|
|
431
|
-
let t =
|
|
423
|
+
let t = N(e, ["\""], o + 1);
|
|
432
424
|
if (t === -1) return -1;
|
|
433
425
|
r = t + 1;
|
|
434
426
|
}
|
|
435
427
|
break;
|
|
436
428
|
case "'":
|
|
437
429
|
{
|
|
438
|
-
let t =
|
|
430
|
+
let t = N(e, ["'"], o + 1);
|
|
439
431
|
if (t === -1) return -1;
|
|
440
432
|
r = t + 1;
|
|
441
433
|
}
|
|
@@ -445,17 +437,17 @@ var F = (e, t, n) => {
|
|
|
445
437
|
i--;
|
|
446
438
|
} while (i > 0);
|
|
447
439
|
throw Error("Too many escaping");
|
|
448
|
-
},
|
|
449
|
-
function
|
|
440
|
+
}, F = /\/\*[^]*?(?:\*\/|$)/g;
|
|
441
|
+
function I(e) {
|
|
450
442
|
return e ? e.trim() : "";
|
|
451
443
|
}
|
|
452
|
-
function
|
|
444
|
+
function L(e, t) {
|
|
453
445
|
let n = e && typeof e.type == "string", r = n ? e : t;
|
|
454
446
|
for (let t in e) {
|
|
455
447
|
let n = e[t];
|
|
456
448
|
Array.isArray(n) ? n.forEach((e) => {
|
|
457
|
-
|
|
458
|
-
}) : n && typeof n == "object" &&
|
|
449
|
+
L(e, r);
|
|
450
|
+
}) : n && typeof n == "object" && L(n, r);
|
|
459
451
|
}
|
|
460
452
|
return n && Object.defineProperty(e, "parent", {
|
|
461
453
|
configurable: !0,
|
|
@@ -479,33 +471,25 @@ var Ae = class {
|
|
|
479
471
|
}
|
|
480
472
|
visit(e) {
|
|
481
473
|
switch (e.type) {
|
|
482
|
-
case
|
|
483
|
-
case
|
|
484
|
-
case
|
|
485
|
-
case
|
|
486
|
-
case
|
|
487
|
-
case
|
|
488
|
-
case
|
|
489
|
-
case
|
|
490
|
-
case
|
|
491
|
-
case
|
|
492
|
-
case
|
|
493
|
-
case
|
|
494
|
-
case
|
|
495
|
-
case
|
|
496
|
-
case
|
|
497
|
-
case
|
|
498
|
-
case
|
|
499
|
-
case
|
|
500
|
-
case
|
|
501
|
-
case P.pageMarginBox: return this.pageMarginBox(e);
|
|
502
|
-
case P.positionTry: return this.positionTry(e);
|
|
503
|
-
case P.property: return this.property(e);
|
|
504
|
-
case P.scope: return this.scope(e);
|
|
505
|
-
case P.startingStyle: return this.startingStyle(e);
|
|
506
|
-
case P.supports: return this.supports(e);
|
|
507
|
-
case P.viewTransition: return this.viewTransition(e);
|
|
508
|
-
case P.atRule: return this.genericAtRule(e);
|
|
474
|
+
case M.stylesheet: return this.stylesheet(e);
|
|
475
|
+
case M.rule: return this.rule(e);
|
|
476
|
+
case M.declaration: return this.declaration(e);
|
|
477
|
+
case M.comment: return this.comment(e);
|
|
478
|
+
case M.container: return this.container(e);
|
|
479
|
+
case M.charset: return this.charset(e);
|
|
480
|
+
case M.document: return this.document(e);
|
|
481
|
+
case M.customMedia: return this.customMedia(e);
|
|
482
|
+
case M.fontFace: return this.fontFace(e);
|
|
483
|
+
case M.host: return this.host(e);
|
|
484
|
+
case M.import: return this.import(e);
|
|
485
|
+
case M.keyframes: return this.keyframes(e);
|
|
486
|
+
case M.keyframe: return this.keyframe(e);
|
|
487
|
+
case M.layer: return this.layer(e);
|
|
488
|
+
case M.media: return this.media(e);
|
|
489
|
+
case M.namespace: return this.namespace(e);
|
|
490
|
+
case M.page: return this.page(e);
|
|
491
|
+
case M.startingStyle: return this.startingStyle(e);
|
|
492
|
+
case M.supports: return this.supports(e);
|
|
509
493
|
}
|
|
510
494
|
}
|
|
511
495
|
mapVisit(e, t) {
|
|
@@ -566,9 +550,6 @@ var Ae = class {
|
|
|
566
550
|
let t = e.selectors.length ? `${e.selectors.join(", ")} ` : "";
|
|
567
551
|
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}");
|
|
568
552
|
}
|
|
569
|
-
pageMarginBox(e) {
|
|
570
|
-
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()}}`);
|
|
571
|
-
}
|
|
572
553
|
fontFace(e) {
|
|
573
554
|
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}");
|
|
574
555
|
}
|
|
@@ -578,32 +559,6 @@ var Ae = class {
|
|
|
578
559
|
customMedia(e) {
|
|
579
560
|
return this.emit(`@custom-media ${e.name} ${e.media};`, e.position);
|
|
580
561
|
}
|
|
581
|
-
property(e) {
|
|
582
|
-
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}");
|
|
583
|
-
}
|
|
584
|
-
counterStyle(e) {
|
|
585
|
-
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}");
|
|
586
|
-
}
|
|
587
|
-
fontFeatureValues(e) {
|
|
588
|
-
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()}}`);
|
|
589
|
-
}
|
|
590
|
-
scope(e) {
|
|
591
|
-
let t = e.scope ? ` ${e.scope}` : "";
|
|
592
|
-
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()}}`);
|
|
593
|
-
}
|
|
594
|
-
viewTransition(e) {
|
|
595
|
-
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}");
|
|
596
|
-
}
|
|
597
|
-
positionTry(e) {
|
|
598
|
-
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}");
|
|
599
|
-
}
|
|
600
|
-
genericAtRule(e) {
|
|
601
|
-
let t = e.prelude ? ` ${e.prelude}` : "";
|
|
602
|
-
if (this.compress) return this.emit(`@${e.name}${t}`, e.position) + (e.rules ? this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : ";");
|
|
603
|
-
if (!e.rules) return this.emit(`${this.indent()}@${e.name}${t};`, e.position);
|
|
604
|
-
let n = e.rules.some((e) => e.type !== P.declaration && e.type !== P.comment), r = n ? "\n\n" : "\n";
|
|
605
|
-
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()}}`);
|
|
606
|
-
}
|
|
607
562
|
rule(e) {
|
|
608
563
|
let t = e.declarations;
|
|
609
564
|
if (!t.length) return "";
|
|
@@ -625,7 +580,7 @@ var Ae = class {
|
|
|
625
580
|
return (i) => (i.position = new ke(e, {
|
|
626
581
|
line: n,
|
|
627
582
|
column: r
|
|
628
|
-
}, t?.source || ""),
|
|
583
|
+
}, t?.source || ""), d(), i);
|
|
629
584
|
}
|
|
630
585
|
let a = [];
|
|
631
586
|
function o(i) {
|
|
@@ -635,13 +590,18 @@ var Ae = class {
|
|
|
635
590
|
}
|
|
636
591
|
function s() {
|
|
637
592
|
let t = /^{\s*/.exec(e);
|
|
638
|
-
return !!t && (
|
|
593
|
+
return !!t && (u(t), !0);
|
|
639
594
|
}
|
|
640
595
|
function c() {
|
|
641
596
|
let t = /^}/.exec(e);
|
|
642
|
-
return !!t && (
|
|
597
|
+
return !!t && (u(t), !0);
|
|
598
|
+
}
|
|
599
|
+
function l() {
|
|
600
|
+
let t, n = [];
|
|
601
|
+
for (d(), f(n); e.length && e.charAt(0) !== "}" && (t = ne() || re(), t);) n.push(t), f(n);
|
|
602
|
+
return n;
|
|
643
603
|
}
|
|
644
|
-
function
|
|
604
|
+
function u(t) {
|
|
645
605
|
let i = t[0];
|
|
646
606
|
return function(e) {
|
|
647
607
|
let t = e.match(/\n/g);
|
|
@@ -650,501 +610,272 @@ var Ae = class {
|
|
|
650
610
|
r = ~i ? e.length - i : r + e.length;
|
|
651
611
|
}(i), e = e.slice(i.length), t;
|
|
652
612
|
}
|
|
653
|
-
function
|
|
613
|
+
function d() {
|
|
654
614
|
let t = /^\s*/.exec(e);
|
|
655
|
-
t &&
|
|
615
|
+
t && u(t);
|
|
656
616
|
}
|
|
657
|
-
function
|
|
617
|
+
function f(e) {
|
|
658
618
|
e ||= [];
|
|
659
|
-
let t =
|
|
660
|
-
for (; t;) e.push(t), t =
|
|
619
|
+
let t = p();
|
|
620
|
+
for (; t;) e.push(t), t = p();
|
|
661
621
|
return e;
|
|
662
622
|
}
|
|
663
|
-
function
|
|
623
|
+
function p() {
|
|
664
624
|
let t = i();
|
|
665
625
|
if (e.charAt(0) !== "/" || e.charAt(1) !== "*") return;
|
|
666
626
|
let n = /^\/\*[^]*?\*\//.exec(e);
|
|
667
|
-
return n ? (
|
|
668
|
-
type:
|
|
627
|
+
return n ? (u(n), t({
|
|
628
|
+
type: M.comment,
|
|
669
629
|
comment: n[0].slice(2, -2)
|
|
670
630
|
})) : o("End of comment missing");
|
|
671
631
|
}
|
|
672
|
-
function
|
|
673
|
-
let t =
|
|
674
|
-
if (t
|
|
675
|
-
let n = e.substring(0, t);
|
|
676
|
-
return l([n]), ((e, t) => {
|
|
632
|
+
function m() {
|
|
633
|
+
let t = /^([^{]+)/.exec(e);
|
|
634
|
+
if (t) return u(t), ((e, t) => {
|
|
677
635
|
let n = [], r = 0;
|
|
678
636
|
for (; r < e.length;) {
|
|
679
|
-
let i =
|
|
637
|
+
let i = P(e, t, r);
|
|
680
638
|
if (i === -1) return n.push(e.substring(r)), n;
|
|
681
639
|
n.push(e.substring(r, i)), r = i + 1;
|
|
682
640
|
}
|
|
683
641
|
return n;
|
|
684
|
-
})(
|
|
642
|
+
})(I(t[0]).replace(F, ""), [","]).map((e) => I(e));
|
|
685
643
|
}
|
|
686
|
-
function
|
|
644
|
+
function h() {
|
|
687
645
|
let t = i(), n = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);
|
|
688
646
|
if (!n) return;
|
|
689
|
-
|
|
690
|
-
let r =
|
|
647
|
+
u(n);
|
|
648
|
+
let r = I(n[0]), a = /^:\s*/.exec(e);
|
|
691
649
|
if (!a) return o("property missing ':'");
|
|
692
|
-
|
|
693
|
-
let s = "", c =
|
|
694
|
-
c !== -1 && (s = e.substring(0, c),
|
|
695
|
-
let
|
|
696
|
-
type:
|
|
697
|
-
property: r.replace(
|
|
650
|
+
u(a);
|
|
651
|
+
let s = "", c = P(e, [";", "}"]);
|
|
652
|
+
c !== -1 && (s = e.substring(0, c), u([s]), s = I(s).replace(F, ""));
|
|
653
|
+
let l = t({
|
|
654
|
+
type: M.declaration,
|
|
655
|
+
property: r.replace(F, ""),
|
|
698
656
|
value: s
|
|
699
657
|
}), d = /^[;\s]*/.exec(e);
|
|
700
|
-
return d &&
|
|
701
|
-
}
|
|
702
|
-
function h() {
|
|
703
|
-
let n = [];
|
|
704
|
-
if (!s()) return o("missing '{'");
|
|
705
|
-
d(n);
|
|
706
|
-
let r = m();
|
|
707
|
-
for (; r;) n.push(r), d(n), r = m();
|
|
708
|
-
for (; t?.silent && e.length && e.charAt(0) !== "}";) {
|
|
709
|
-
let t = e.indexOf(";"), i = e.indexOf("}");
|
|
710
|
-
if (t === -1 || !(i === -1 || t < i)) break;
|
|
711
|
-
for (l([e.substring(0, t + 1)]), u(), d(n), r = m(); r;) n.push(r), d(n), r = m();
|
|
712
|
-
}
|
|
713
|
-
return c() ? n : o("missing '}'");
|
|
658
|
+
return d && u(d), l;
|
|
714
659
|
}
|
|
715
660
|
function g() {
|
|
716
|
-
let
|
|
717
|
-
if (t === -1) return !1;
|
|
718
|
-
let n = I(e, [";"]), r = I(e, ["}"]);
|
|
719
|
-
return !(n !== -1 && n < t) && !(r !== -1 && r < t);
|
|
720
|
-
}
|
|
721
|
-
function _() {
|
|
722
|
-
let n = [];
|
|
661
|
+
let e = [];
|
|
723
662
|
if (!s()) return o("missing '{'");
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
n.push(e), d(n);
|
|
729
|
-
continue;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
if (g()) {
|
|
733
|
-
let e = S();
|
|
734
|
-
if (e) {
|
|
735
|
-
n.push(e), d(n);
|
|
736
|
-
continue;
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
let r = m();
|
|
740
|
-
if (!r) {
|
|
741
|
-
if (t?.silent) {
|
|
742
|
-
let t = e.indexOf(";"), r = e.indexOf("}");
|
|
743
|
-
if (t !== -1 && (r === -1 || t < r)) {
|
|
744
|
-
l([e.substring(0, t + 1)]), u(), d(n);
|
|
745
|
-
continue;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
break;
|
|
749
|
-
}
|
|
750
|
-
n.push(r), d(n);
|
|
751
|
-
}
|
|
752
|
-
return c() ? n : o("missing '}'");
|
|
753
|
-
}
|
|
754
|
-
function v() {
|
|
755
|
-
let n = [];
|
|
756
|
-
for (u(), d(n); e.length && e.charAt(0) !== "}";) {
|
|
757
|
-
if (e.charAt(0) === "@") {
|
|
758
|
-
let e = x();
|
|
759
|
-
if (e) {
|
|
760
|
-
n.push(e), d(n);
|
|
761
|
-
continue;
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
if (g()) {
|
|
765
|
-
let e = S();
|
|
766
|
-
if (e) {
|
|
767
|
-
n.push(e), d(n);
|
|
768
|
-
continue;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
let r = m();
|
|
772
|
-
if (!r) {
|
|
773
|
-
if (t?.silent) {
|
|
774
|
-
let t = e.indexOf(";"), r = e.indexOf("}");
|
|
775
|
-
if (t !== -1 && (r === -1 || t < r)) {
|
|
776
|
-
l([e.substring(0, t + 1)]), u(), d(n);
|
|
777
|
-
continue;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
break;
|
|
781
|
-
}
|
|
782
|
-
n.push(r), d(n);
|
|
783
|
-
}
|
|
784
|
-
return n;
|
|
663
|
+
f(e);
|
|
664
|
+
let t = h();
|
|
665
|
+
for (; t;) e.push(t), f(e), t = h();
|
|
666
|
+
return c() ? e : o("missing '}'");
|
|
785
667
|
}
|
|
786
|
-
function
|
|
668
|
+
function _() {
|
|
787
669
|
let t = [], n = i(), r = /^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);
|
|
788
670
|
for (; r;) {
|
|
789
|
-
let n =
|
|
671
|
+
let n = u(r);
|
|
790
672
|
t.push(n[1]);
|
|
791
673
|
let i = /^,\s*/.exec(e);
|
|
792
|
-
i &&
|
|
674
|
+
i && u(i), r = /^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);
|
|
793
675
|
}
|
|
794
676
|
if (t.length) return n({
|
|
795
|
-
type:
|
|
677
|
+
type: M.keyframe,
|
|
796
678
|
values: t,
|
|
797
|
-
declarations:
|
|
679
|
+
declarations: g() || []
|
|
798
680
|
});
|
|
799
681
|
}
|
|
800
|
-
let ee =
|
|
801
|
-
|
|
802
|
-
"top-left",
|
|
803
|
-
"top-center",
|
|
804
|
-
"top-right",
|
|
805
|
-
"top-right-corner",
|
|
806
|
-
"bottom-left-corner",
|
|
807
|
-
"bottom-left",
|
|
808
|
-
"bottom-center",
|
|
809
|
-
"bottom-right",
|
|
810
|
-
"bottom-right-corner",
|
|
811
|
-
"left-top",
|
|
812
|
-
"left-middle",
|
|
813
|
-
"left-bottom",
|
|
814
|
-
"right-top",
|
|
815
|
-
"right-middle",
|
|
816
|
-
"right-bottom"
|
|
817
|
-
].join("|")})(?![\\w-])\\s*`), te = b("import"), ne = b("charset"), re = b("namespace");
|
|
818
|
-
function b(t) {
|
|
682
|
+
let v = y("import"), ee = y("charset"), te = y("namespace");
|
|
683
|
+
function y(t) {
|
|
819
684
|
let n = RegExp("^@" + t + "\\s*((?::?[^;'\"]|\"(?:\\\\\"|[^\"])*?\"|'(?:\\\\'|[^'])*?')+)(?:;|$)");
|
|
820
685
|
return () => {
|
|
821
686
|
let r = i(), a = n.exec(e);
|
|
822
687
|
if (!a) return;
|
|
823
|
-
let o =
|
|
688
|
+
let o = u(a), s = { type: t };
|
|
824
689
|
return s[t] = o[1].trim(), r(s);
|
|
825
690
|
};
|
|
826
691
|
}
|
|
827
|
-
function
|
|
692
|
+
function ne() {
|
|
828
693
|
if (e[0] === "@") return function() {
|
|
829
694
|
let t = i(), n = /^@([-\w]+)?keyframes\s*/.exec(e);
|
|
830
695
|
if (!n) return;
|
|
831
|
-
let r =
|
|
696
|
+
let r = u(n)[1], a = /^([-\w]+)\s*/.exec(e);
|
|
832
697
|
if (!a) return o("@keyframes missing name");
|
|
833
|
-
let
|
|
698
|
+
let l = u(a)[1];
|
|
834
699
|
if (!s()) return o("@keyframes missing '{'");
|
|
835
|
-
let
|
|
836
|
-
for (; p;)
|
|
700
|
+
let d = f(), p = _();
|
|
701
|
+
for (; p;) d.push(p), d = d.concat(f()), p = _();
|
|
837
702
|
return c() ? t({
|
|
838
|
-
type:
|
|
839
|
-
name:
|
|
703
|
+
type: M.keyframes,
|
|
704
|
+
name: l,
|
|
840
705
|
vendor: r,
|
|
841
|
-
keyframes:
|
|
706
|
+
keyframes: d
|
|
842
707
|
}) : o("@keyframes missing '}'");
|
|
843
708
|
}() || function() {
|
|
844
709
|
let t = i(), n = /^@media *([^{]+)/.exec(e);
|
|
845
710
|
if (!n) return;
|
|
846
|
-
let r =
|
|
711
|
+
let r = I(u(n)[1]);
|
|
847
712
|
if (!s()) return o("@media missing '{'");
|
|
848
|
-
let a =
|
|
713
|
+
let a = f().concat(l());
|
|
849
714
|
return c() ? t({
|
|
850
|
-
type:
|
|
715
|
+
type: M.media,
|
|
851
716
|
media: r,
|
|
852
717
|
rules: a
|
|
853
718
|
}) : o("@media missing '}'");
|
|
854
719
|
}() || function() {
|
|
855
720
|
let t = i(), n = /^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(e);
|
|
856
721
|
if (!n) return;
|
|
857
|
-
let r =
|
|
722
|
+
let r = u(n);
|
|
858
723
|
return t({
|
|
859
|
-
type:
|
|
860
|
-
name:
|
|
861
|
-
media:
|
|
724
|
+
type: M.customMedia,
|
|
725
|
+
name: I(r[1]),
|
|
726
|
+
media: I(r[2])
|
|
862
727
|
});
|
|
863
728
|
}() || function() {
|
|
864
729
|
let t = i(), n = /^@supports *([^{]+)/.exec(e);
|
|
865
730
|
if (!n) return;
|
|
866
|
-
let r =
|
|
731
|
+
let r = I(u(n)[1]);
|
|
867
732
|
if (!s()) return o("@supports missing '{'");
|
|
868
|
-
let a =
|
|
733
|
+
let a = f().concat(l());
|
|
869
734
|
return c() ? t({
|
|
870
|
-
type:
|
|
735
|
+
type: M.supports,
|
|
871
736
|
supports: r,
|
|
872
737
|
rules: a
|
|
873
738
|
}) : o("@supports missing '}'");
|
|
874
|
-
}() ||
|
|
739
|
+
}() || v() || ee() || te() || function() {
|
|
875
740
|
let t = i(), n = /^@([-\w]+)?document *([^{]+)/.exec(e);
|
|
876
741
|
if (!n) return;
|
|
877
|
-
let r =
|
|
742
|
+
let r = u(n), a = I(r[1]), d = I(r[2]);
|
|
878
743
|
if (!s()) return o("@document missing '{'");
|
|
879
|
-
let
|
|
744
|
+
let p = f().concat(l());
|
|
880
745
|
return c() ? t({
|
|
881
|
-
type:
|
|
882
|
-
document:
|
|
746
|
+
type: M.document,
|
|
747
|
+
document: d,
|
|
883
748
|
vendor: a,
|
|
884
|
-
rules:
|
|
749
|
+
rules: p
|
|
885
750
|
}) : o("@document missing '}'");
|
|
886
751
|
}() || function() {
|
|
887
752
|
let t = i(), n = /^@page */.exec(e);
|
|
888
753
|
if (!n) return;
|
|
889
|
-
|
|
890
|
-
let r =
|
|
754
|
+
u(n);
|
|
755
|
+
let r = m() || [];
|
|
891
756
|
if (!s()) return o("@page missing '{'");
|
|
892
|
-
let a =
|
|
893
|
-
for (
|
|
894
|
-
if (e.charAt(0) === "@") {
|
|
895
|
-
let e = x();
|
|
896
|
-
if (e) {
|
|
897
|
-
a.push(e), d(a);
|
|
898
|
-
continue;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
let t = m();
|
|
902
|
-
if (!t) break;
|
|
903
|
-
a.push(t), d(a);
|
|
904
|
-
}
|
|
757
|
+
let a = f(), l = h();
|
|
758
|
+
for (; l;) a.push(l), a = a.concat(f()), l = h();
|
|
905
759
|
return c() ? t({
|
|
906
|
-
type:
|
|
760
|
+
type: M.page,
|
|
907
761
|
selectors: r,
|
|
908
762
|
declarations: a
|
|
909
763
|
}) : o("@page missing '}'");
|
|
910
764
|
}() || function() {
|
|
911
765
|
let t = i(), n = /^@host\s*/.exec(e);
|
|
912
766
|
if (!n) return;
|
|
913
|
-
if (
|
|
914
|
-
let r =
|
|
767
|
+
if (u(n), !s()) return o("@host missing '{'");
|
|
768
|
+
let r = f().concat(l());
|
|
915
769
|
return c() ? t({
|
|
916
|
-
type:
|
|
770
|
+
type: M.host,
|
|
917
771
|
rules: r
|
|
918
772
|
}) : o("@host missing '}'");
|
|
919
773
|
}() || function() {
|
|
920
774
|
let t = i(), n = /^@font-face\s*/.exec(e);
|
|
921
775
|
if (!n) return;
|
|
922
|
-
if (
|
|
923
|
-
let r =
|
|
924
|
-
for (; a;) r.push(a), r = r.concat(
|
|
776
|
+
if (u(n), !s()) return o("@font-face missing '{'");
|
|
777
|
+
let r = f(), a = h();
|
|
778
|
+
for (; a;) r.push(a), r = r.concat(f()), a = h();
|
|
925
779
|
return c() ? t({
|
|
926
|
-
type:
|
|
780
|
+
type: M.fontFace,
|
|
927
781
|
declarations: r
|
|
928
782
|
}) : o("@font-face missing '}'");
|
|
929
|
-
}() || function() {
|
|
930
|
-
let t = i(), n = /^@font-feature-values\s+([^{]+)/.exec(e);
|
|
931
|
-
if (!n) return;
|
|
932
|
-
let r = R(l(n)[1]);
|
|
933
|
-
if (!s()) return o("@font-feature-values missing '{'");
|
|
934
|
-
let a = v();
|
|
935
|
-
return c() ? t({
|
|
936
|
-
type: P.fontFeatureValues,
|
|
937
|
-
fontFamily: r,
|
|
938
|
-
rules: a
|
|
939
|
-
}) : o("@font-feature-values missing '}'");
|
|
940
783
|
}() || function() {
|
|
941
784
|
let t = i(), n = /^@container *([^{]+)/.exec(e);
|
|
942
785
|
if (!n) return;
|
|
943
|
-
let r =
|
|
786
|
+
let r = I(u(n)[1]);
|
|
944
787
|
if (!s()) return o("@container missing '{'");
|
|
945
|
-
let a =
|
|
788
|
+
let a = f().concat(l());
|
|
946
789
|
return c() ? t({
|
|
947
|
-
type:
|
|
790
|
+
type: M.container,
|
|
948
791
|
container: r,
|
|
949
792
|
rules: a
|
|
950
793
|
}) : o("@container missing '}'");
|
|
951
794
|
}() || function() {
|
|
952
795
|
let t = i(), n = /^@starting-style\s*/.exec(e);
|
|
953
796
|
if (!n) return;
|
|
954
|
-
if (
|
|
955
|
-
let r =
|
|
797
|
+
if (u(n), !s()) return o("@starting-style missing '{'");
|
|
798
|
+
let r = f().concat(l());
|
|
956
799
|
return c() ? t({
|
|
957
|
-
type:
|
|
800
|
+
type: M.startingStyle,
|
|
958
801
|
rules: r
|
|
959
802
|
}) : o("@starting-style missing '}'");
|
|
960
803
|
}() || function() {
|
|
961
804
|
let t = i(), n = /^@layer *([^{;@]+)/.exec(e);
|
|
962
805
|
if (!n) return;
|
|
963
|
-
let r =
|
|
806
|
+
let r = I(u(n)[1]);
|
|
964
807
|
if (!s()) {
|
|
965
808
|
let n = /^[;\s]*/.exec(e);
|
|
966
|
-
return n &&
|
|
967
|
-
type:
|
|
809
|
+
return n && u(n), t({
|
|
810
|
+
type: M.layer,
|
|
968
811
|
layer: r
|
|
969
812
|
});
|
|
970
813
|
}
|
|
971
|
-
let a =
|
|
814
|
+
let a = f().concat(l());
|
|
972
815
|
return c() ? t({
|
|
973
|
-
type:
|
|
816
|
+
type: M.layer,
|
|
974
817
|
layer: r,
|
|
975
818
|
rules: a
|
|
976
819
|
}) : o("@layer missing '}'");
|
|
977
|
-
}() || function() {
|
|
978
|
-
let t = i(), n = /^@property\s+(--[-\w]+)\s*/.exec(e);
|
|
979
|
-
if (!n) return;
|
|
980
|
-
let r = l(n)[1];
|
|
981
|
-
if (!s()) return o("@property 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: P.property,
|
|
986
|
-
name: r,
|
|
987
|
-
declarations: a
|
|
988
|
-
}) : o("@property missing '}'");
|
|
989
|
-
}() || function() {
|
|
990
|
-
let t = i(), n = /^@counter-style\s+([-\w]+)\s*/.exec(e);
|
|
991
|
-
if (!n) return;
|
|
992
|
-
let r = l(n)[1];
|
|
993
|
-
if (!s()) return o("@counter-style 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: P.counterStyle,
|
|
998
|
-
name: r,
|
|
999
|
-
declarations: a
|
|
1000
|
-
}) : o("@counter-style missing '}'");
|
|
1001
|
-
}() || function() {
|
|
1002
|
-
let t = i(), n = /^@scope\s*([^{]*)/.exec(e);
|
|
1003
|
-
if (!n) return;
|
|
1004
|
-
let r = R(l(n)[1]);
|
|
1005
|
-
if (!s()) return o("@scope missing '{'");
|
|
1006
|
-
let a = v();
|
|
1007
|
-
return c() ? t({
|
|
1008
|
-
type: P.scope,
|
|
1009
|
-
scope: r,
|
|
1010
|
-
rules: a
|
|
1011
|
-
}) : o("@scope missing '}'");
|
|
1012
|
-
}() || function() {
|
|
1013
|
-
let t = i(), n = /^@view-transition\s*/.exec(e);
|
|
1014
|
-
if (!n) return;
|
|
1015
|
-
if (l(n), !s()) return o("@view-transition missing '{'");
|
|
1016
|
-
let r = d(), a = m();
|
|
1017
|
-
for (; a;) r.push(a), r = r.concat(d()), a = m();
|
|
1018
|
-
return c() ? t({
|
|
1019
|
-
type: P.viewTransition,
|
|
1020
|
-
declarations: r
|
|
1021
|
-
}) : o("@view-transition missing '}'");
|
|
1022
|
-
}() || function() {
|
|
1023
|
-
let t = i(), n = /^@position-try\s+(--[-\w]+)\s*/.exec(e);
|
|
1024
|
-
if (!n) return;
|
|
1025
|
-
let r = l(n)[1];
|
|
1026
|
-
if (!s()) return o("@position-try missing '{'");
|
|
1027
|
-
let a = d(), u = m();
|
|
1028
|
-
for (; u;) a.push(u), a = a.concat(d()), u = m();
|
|
1029
|
-
return c() ? t({
|
|
1030
|
-
type: P.positionTry,
|
|
1031
|
-
name: r,
|
|
1032
|
-
declarations: a
|
|
1033
|
-
}) : o("@position-try missing '}'");
|
|
1034
|
-
}() || function() {
|
|
1035
|
-
let t = i(), n = ee.exec(e);
|
|
1036
|
-
if (!n) return;
|
|
1037
|
-
let r = l(n)[1];
|
|
1038
|
-
if (!s()) return o(`@${r} missing '{'`);
|
|
1039
|
-
let a = d(), u = m();
|
|
1040
|
-
for (; u;) a.push(u), a = a.concat(d()), u = m();
|
|
1041
|
-
return c() ? t({
|
|
1042
|
-
type: P.pageMarginBox,
|
|
1043
|
-
name: r,
|
|
1044
|
-
declarations: a
|
|
1045
|
-
}) : o(`@${r} missing '}'`);
|
|
1046
|
-
}() || function() {
|
|
1047
|
-
let t = i(), n = /^@([-\w]+)\s*/.exec(e);
|
|
1048
|
-
if (!n) return;
|
|
1049
|
-
let r = l(n)[1], a = "", u = I(e, ["{", ";"]);
|
|
1050
|
-
if (u !== -1 && u > 0 && (a = R(e.substring(0, u)), l([e.substring(0, u)])), s()) {
|
|
1051
|
-
let e = v();
|
|
1052
|
-
return c() ? t({
|
|
1053
|
-
type: P.atRule,
|
|
1054
|
-
name: r,
|
|
1055
|
-
prelude: a,
|
|
1056
|
-
rules: e
|
|
1057
|
-
}) : o(`@${r} missing '}'`);
|
|
1058
|
-
}
|
|
1059
|
-
let d = /^[;\s]*/.exec(e);
|
|
1060
|
-
return d && l(d), t({
|
|
1061
|
-
type: P.atRule,
|
|
1062
|
-
name: r,
|
|
1063
|
-
prelude: a
|
|
1064
|
-
});
|
|
1065
820
|
}();
|
|
1066
821
|
}
|
|
1067
|
-
function
|
|
1068
|
-
let e = i(), t =
|
|
1069
|
-
return t ? (
|
|
1070
|
-
type:
|
|
822
|
+
function re() {
|
|
823
|
+
let e = i(), t = m();
|
|
824
|
+
return t ? (f(), e({
|
|
825
|
+
type: M.rule,
|
|
1071
826
|
selectors: t,
|
|
1072
|
-
declarations:
|
|
827
|
+
declarations: g() || []
|
|
1073
828
|
})) : o("selector missing");
|
|
1074
829
|
}
|
|
1075
|
-
return
|
|
1076
|
-
let
|
|
1077
|
-
let n, r = [];
|
|
1078
|
-
for (u(), d(r); e.length;) {
|
|
1079
|
-
if (e.charAt(0) === "}") {
|
|
1080
|
-
if (t?.silent) {
|
|
1081
|
-
o("extra '}'"), l(["}"]), u(), d(r);
|
|
1082
|
-
continue;
|
|
1083
|
-
}
|
|
1084
|
-
break;
|
|
1085
|
-
}
|
|
1086
|
-
if (n = x() || S(), !n) {
|
|
1087
|
-
if (t?.silent) {
|
|
1088
|
-
l([e.charAt(0)]), u(), d(r);
|
|
1089
|
-
continue;
|
|
1090
|
-
}
|
|
1091
|
-
break;
|
|
1092
|
-
}
|
|
1093
|
-
r.push(n), d(r);
|
|
1094
|
-
}
|
|
1095
|
-
return r;
|
|
1096
|
-
}();
|
|
830
|
+
return L(function() {
|
|
831
|
+
let e = l();
|
|
1097
832
|
return {
|
|
1098
|
-
type:
|
|
833
|
+
type: M.stylesheet,
|
|
1099
834
|
stylesheet: {
|
|
1100
835
|
source: t?.source,
|
|
1101
|
-
rules:
|
|
836
|
+
rules: e,
|
|
1102
837
|
parsingErrors: a
|
|
1103
838
|
}
|
|
1104
839
|
};
|
|
1105
840
|
}());
|
|
1106
|
-
}, Me = (e, t) => new Ae(t || {}).compile(e),
|
|
1107
|
-
name: V,
|
|
1108
|
-
operation: t,
|
|
1109
|
-
backend: n
|
|
1110
|
-
}), Pe = (e, t) => Ne(`Locator operation not supported${t ? ` on the ${t} backend` : ""}: ${e}`, e, t), Fe = (e) => U(e) === V, Ie = (e) => U(e) === H, G = (e) => Ie(e) || Fe(e), K = (e) => {
|
|
841
|
+
}, Me = (e, t) => new Ae(t || {}).compile(e), R = "LocatorError", z = "LocatorUnsupportedError", B = "LocatorDeniedError", V = (e) => typeof e == "object" && e ? e.name : void 0, H = (e) => Object.assign(Error(e), { name: R }), U = (e) => V(e) === z, W = (e) => V(e) === B, Ne = (e) => W(e) || U(e), G = (e) => {
|
|
1111
842
|
let t = (e.ownerDocument ?? e).defaultView;
|
|
1112
|
-
if (!t) throw
|
|
843
|
+
if (!t) throw H("the resolved element belongs to a document with no window");
|
|
1113
844
|
return t;
|
|
1114
|
-
},
|
|
845
|
+
}, Pe = (e, t) => {
|
|
1115
846
|
let n = e?.[t];
|
|
1116
847
|
return typeof n == "function" ? n : null;
|
|
1117
|
-
},
|
|
848
|
+
}, K = (e, t) => {
|
|
1118
849
|
if (typeof e != "object" || !e) return null;
|
|
1119
850
|
let n = (() => {
|
|
1120
851
|
try {
|
|
1121
|
-
return
|
|
852
|
+
return Pe(G(e), t);
|
|
1122
853
|
} catch {
|
|
1123
854
|
return null;
|
|
1124
855
|
}
|
|
1125
856
|
})();
|
|
1126
857
|
if (n && e instanceof n) return n;
|
|
1127
|
-
let r =
|
|
858
|
+
let r = Pe(globalThis, t);
|
|
1128
859
|
return r && e instanceof r ? r : null;
|
|
1129
|
-
},
|
|
1130
|
-
if (e.length === 0) throw
|
|
1131
|
-
if (e.length > 1) throw
|
|
860
|
+
}, q = (e, t) => K(e, t) !== null, J = (e) => {
|
|
861
|
+
if (e.length === 0) throw H("No elements found");
|
|
862
|
+
if (e.length > 1) throw H(`Strict mode violation: locator resolved to ${e.length} elements`);
|
|
1132
863
|
return e[0];
|
|
1133
|
-
},
|
|
1134
|
-
if (!
|
|
864
|
+
}, Fe = (e, t) => {
|
|
865
|
+
if (!q(e, t)) throw H(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);
|
|
1135
866
|
return e;
|
|
1136
|
-
},
|
|
1137
|
-
|
|
1138
|
-
},
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
]),
|
|
1146
|
-
if (
|
|
1147
|
-
if (e.type ===
|
|
867
|
+
}, Ie = (e) => e.tagName.toLowerCase(), Le = /* @__PURE__ */ new Set(), Re = (e) => {
|
|
868
|
+
Le.add(e);
|
|
869
|
+
}, ze = /(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i, Be = (e) => e.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (e, t) => String.fromCodePoint(Number.parseInt(t, 16))).replace(/\\(.)/g, "$1"), Ve = (e) => !ze.test(Be(e.value)), He = /* @__PURE__ */ new Set([
|
|
870
|
+
M.import,
|
|
871
|
+
M.fontFace,
|
|
872
|
+
M.namespace,
|
|
873
|
+
M.charset,
|
|
874
|
+
M.document,
|
|
875
|
+
M.comment
|
|
876
|
+
]), Ue = (e) => {
|
|
877
|
+
if (He.has(e.type)) return null;
|
|
878
|
+
if (e.type === M.declaration) return Ve(e) ? e : null;
|
|
1148
879
|
let t = e, n = { ...t };
|
|
1149
880
|
for (let e of [
|
|
1150
881
|
"declarations",
|
|
@@ -1152,18 +883,18 @@ var Ae = class {
|
|
|
1152
883
|
"keyframes"
|
|
1153
884
|
]) {
|
|
1154
885
|
let r = t[e];
|
|
1155
|
-
Array.isArray(r) && (n[e] =
|
|
886
|
+
Array.isArray(r) && (n[e] = We(r));
|
|
1156
887
|
}
|
|
1157
888
|
return n;
|
|
1158
|
-
},
|
|
889
|
+
}, We = (e) => e.map((e) => Ue(e)).filter((e) => e !== null), Ge = (e) => {
|
|
1159
890
|
let t;
|
|
1160
891
|
try {
|
|
1161
892
|
t = je(e, { silent: !0 });
|
|
1162
893
|
} catch {
|
|
1163
894
|
return "";
|
|
1164
895
|
}
|
|
1165
|
-
return t.stylesheet.rules =
|
|
1166
|
-
},
|
|
896
|
+
return t.stylesheet.rules = We(t.stylesheet.rules), Me(t);
|
|
897
|
+
}, Ke = (e, t) => {
|
|
1167
898
|
let n = () => {
|
|
1168
899
|
t.parentNode || (e.head ?? e.documentElement).appendChild(t);
|
|
1169
900
|
};
|
|
@@ -1180,27 +911,27 @@ var Ae = class {
|
|
|
1180
911
|
});
|
|
1181
912
|
let i = () => r.disconnect(), a = e.defaultView;
|
|
1182
913
|
a ? a.addEventListener("load", i, { once: !0 }) : setTimeout(i, 3e4);
|
|
1183
|
-
},
|
|
914
|
+
}, qe = { resolve: (e, t) => {
|
|
1184
915
|
let n = e.document.createElement("style");
|
|
1185
|
-
n.textContent = t.noSanitize ? t.content :
|
|
916
|
+
n.textContent = t.noSanitize ? t.content : Ge(t.content);
|
|
1186
917
|
try {
|
|
1187
|
-
|
|
918
|
+
Ke(e.document, n);
|
|
1188
919
|
} catch (e) {
|
|
1189
920
|
console.error(e);
|
|
1190
921
|
}
|
|
1191
|
-
|
|
1192
|
-
} },
|
|
922
|
+
Re(n);
|
|
923
|
+
} }, Je = (e, t) => {
|
|
1193
924
|
let n = e.getBoundingClientRect();
|
|
1194
925
|
return {
|
|
1195
926
|
clientX: n.left + n.width * (t?.x ?? .5),
|
|
1196
927
|
clientY: n.top + n.height * (t?.y ?? .5)
|
|
1197
928
|
};
|
|
1198
|
-
},
|
|
1199
|
-
let n =
|
|
929
|
+
}, Ye = { resolve: (e, t = {}) => {
|
|
930
|
+
let n = J(e.elements), r = G(n), i = {
|
|
1200
931
|
bubbles: !0,
|
|
1201
932
|
cancelable: !0,
|
|
1202
933
|
composed: !0,
|
|
1203
|
-
...
|
|
934
|
+
...Je(n, t.position),
|
|
1204
935
|
button: 0
|
|
1205
936
|
}, a = {
|
|
1206
937
|
...i,
|
|
@@ -1224,12 +955,12 @@ var Ae = class {
|
|
|
1224
955
|
...i,
|
|
1225
956
|
buttons: 0
|
|
1226
957
|
}));
|
|
1227
|
-
} },
|
|
1228
|
-
let n =
|
|
958
|
+
} }, Xe = { resolve: (e, t = {}) => {
|
|
959
|
+
let n = J(e.elements), r = G(n), i = {
|
|
1229
960
|
bubbles: !0,
|
|
1230
961
|
cancelable: !0,
|
|
1231
962
|
composed: !0,
|
|
1232
|
-
...
|
|
963
|
+
...Je(n, t.position)
|
|
1233
964
|
}, a = {
|
|
1234
965
|
...i,
|
|
1235
966
|
pointerType: "mouse",
|
|
@@ -1243,11 +974,11 @@ var Ae = class {
|
|
|
1243
974
|
...i,
|
|
1244
975
|
bubbles: !1
|
|
1245
976
|
})), n.dispatchEvent(new r.MouseEvent("mouseover", i)), n.dispatchEvent(new r.PointerEvent("pointermove", a)), n.dispatchEvent(new r.MouseEvent("mousemove", i));
|
|
1246
|
-
} },
|
|
977
|
+
} }, Ze = (e, t) => {
|
|
1247
978
|
e._valueTracker?.setValue("");
|
|
1248
|
-
let n = (
|
|
979
|
+
let n = (K(e, "HTMLTextAreaElement") ?? K(e, "HTMLInputElement"))?.prototype, r = n && Object.getOwnPropertyDescriptor(n, "value")?.set;
|
|
1249
980
|
r ? r.call(e, t) : e.value = t;
|
|
1250
|
-
},
|
|
981
|
+
}, Qe = (e, t) => {
|
|
1251
982
|
if (e.type !== "range") return null;
|
|
1252
983
|
let n = Number(e.min || 0), r = Number(e.max || 100);
|
|
1253
984
|
if (!Number.isFinite(n) || !Number.isFinite(r) || r <= n) return null;
|
|
@@ -1284,71 +1015,71 @@ var Ae = class {
|
|
|
1284
1015
|
buttons: 0
|
|
1285
1016
|
}
|
|
1286
1017
|
};
|
|
1287
|
-
},
|
|
1288
|
-
let r =
|
|
1289
|
-
if (a ||
|
|
1290
|
-
let e = r, n = a ?
|
|
1291
|
-
n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))),
|
|
1018
|
+
}, $e = { resolve: (e, t, n = {}) => {
|
|
1019
|
+
let r = J(e.elements), i = G(r), a = q(r, "HTMLInputElement");
|
|
1020
|
+
if (a || q(r, "HTMLTextAreaElement")) {
|
|
1021
|
+
let e = r, n = a ? Qe(e, t) : null;
|
|
1022
|
+
n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))), Ze(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 }));
|
|
1292
1023
|
return;
|
|
1293
1024
|
}
|
|
1294
|
-
if (
|
|
1025
|
+
if (q(r, "HTMLElement") && r.isContentEditable) {
|
|
1295
1026
|
r.textContent = t, r.dispatchEvent(new i.Event("input", { bubbles: !0 }));
|
|
1296
1027
|
return;
|
|
1297
1028
|
}
|
|
1298
|
-
throw Error(`fill: element <${
|
|
1299
|
-
} },
|
|
1300
|
-
let n =
|
|
1301
|
-
if (!
|
|
1302
|
-
let r =
|
|
1029
|
+
throw Error(`fill: element <${Ie(r)}> is not fillable`);
|
|
1030
|
+
} }, et = { resolve: (e, t = {}) => J(e.elements).textContent }, tt = { resolve: (e, t, n = {}) => J(e.elements).getAttribute(t) }, nt = { resolve: (e, t = {}) => {
|
|
1031
|
+
let n = J(e.elements);
|
|
1032
|
+
if (!q(n, "HTMLElement")) return !0;
|
|
1033
|
+
let r = G(n).getComputedStyle(n);
|
|
1303
1034
|
if (r?.display === "none" || r?.visibility === "hidden") return !1;
|
|
1304
1035
|
let i = n.getBoundingClientRect();
|
|
1305
1036
|
return i.width > 0 && i.height > 0;
|
|
1306
|
-
} },
|
|
1037
|
+
} }, rt = { resolve: (e, t = {}) => e.elements.length }, it = { resolve: (e, t = {}) => e.elements.length > 0 }, Y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1307
1038
|
__proto__: null,
|
|
1308
|
-
click:
|
|
1309
|
-
count:
|
|
1310
|
-
exists:
|
|
1311
|
-
fill:
|
|
1312
|
-
getAttribute:
|
|
1313
|
-
hover:
|
|
1314
|
-
isVisible:
|
|
1315
|
-
textContent:
|
|
1316
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1039
|
+
click: Ye,
|
|
1040
|
+
count: rt,
|
|
1041
|
+
exists: it,
|
|
1042
|
+
fill: $e,
|
|
1043
|
+
getAttribute: tt,
|
|
1044
|
+
hover: Xe,
|
|
1045
|
+
isVisible: nt,
|
|
1046
|
+
textContent: et
|
|
1047
|
+
}, Symbol.toStringTag, { value: "Module" })), X = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(t)]), Z = (e) => e.replaceAll("\"", "\\\""), at = {
|
|
1317
1048
|
to: "element",
|
|
1318
1049
|
css: !0,
|
|
1319
|
-
resolve: (e, t) =>
|
|
1050
|
+
resolve: (e, t) => X(e, t),
|
|
1320
1051
|
render: (e) => ({
|
|
1321
1052
|
fragment: typeof e == "string" ? e : "?",
|
|
1322
1053
|
separator: "descend"
|
|
1323
1054
|
})
|
|
1324
|
-
},
|
|
1055
|
+
}, Q = {
|
|
1325
1056
|
to: "frame",
|
|
1326
1057
|
css: !0,
|
|
1327
1058
|
barrier: "down",
|
|
1328
|
-
resolve: (e, t) =>
|
|
1059
|
+
resolve: (e, t) => X(e, t),
|
|
1329
1060
|
render: (e) => ({
|
|
1330
1061
|
fragment: typeof e == "string" ? e : "?",
|
|
1331
1062
|
separator: "down"
|
|
1332
1063
|
})
|
|
1333
|
-
},
|
|
1064
|
+
}, ot = {
|
|
1334
1065
|
element: {
|
|
1335
1066
|
selectors: {
|
|
1336
|
-
locator:
|
|
1337
|
-
frameLocator:
|
|
1067
|
+
locator: at,
|
|
1068
|
+
frameLocator: Q,
|
|
1338
1069
|
getByRole: {
|
|
1339
1070
|
to: "element",
|
|
1340
|
-
resolve: (e, t) =>
|
|
1341
|
-
render: (e) => ({ fragment: typeof e == "string" ? `[role="${
|
|
1071
|
+
resolve: (e, t) => X(e, `[role="${CSS.escape(t)}"]`),
|
|
1072
|
+
render: (e) => ({ fragment: typeof e == "string" ? `[role="${Z(e)}"]` : "[role]" })
|
|
1342
1073
|
},
|
|
1343
1074
|
getByText: {
|
|
1344
1075
|
to: "element",
|
|
1345
1076
|
resolve: (e, t) => e.elements.flatMap((e) => [e, ...e.querySelectorAll("*")]).filter((e) => e.textContent?.includes(t)),
|
|
1346
|
-
render: (e) => ({ fragment: typeof e == "string" ? `:has-text("${
|
|
1077
|
+
render: (e) => ({ fragment: typeof e == "string" ? `:has-text("${Z(e)}")` : ":has-text(...)" })
|
|
1347
1078
|
},
|
|
1348
1079
|
getByTestId: {
|
|
1349
1080
|
to: "element",
|
|
1350
|
-
resolve: (e, t) =>
|
|
1351
|
-
render: (e) => ({ fragment: typeof e == "string" ? `[data-testid="${
|
|
1081
|
+
resolve: (e, t) => X(e, `[data-testid="${CSS.escape(t)}"]`),
|
|
1082
|
+
render: (e) => ({ fragment: typeof e == "string" ? `[data-testid="${Z(e)}"]` : "[data-testid]" })
|
|
1352
1083
|
},
|
|
1353
1084
|
first: {
|
|
1354
1085
|
to: "element",
|
|
@@ -1365,20 +1096,20 @@ var Ae = class {
|
|
|
1365
1096
|
}
|
|
1366
1097
|
},
|
|
1367
1098
|
operations: {
|
|
1368
|
-
click:
|
|
1369
|
-
fill:
|
|
1370
|
-
hover:
|
|
1371
|
-
textContent:
|
|
1372
|
-
getAttribute:
|
|
1373
|
-
isVisible:
|
|
1374
|
-
count:
|
|
1375
|
-
exists:
|
|
1099
|
+
click: Ye,
|
|
1100
|
+
fill: $e,
|
|
1101
|
+
hover: Xe,
|
|
1102
|
+
textContent: et,
|
|
1103
|
+
getAttribute: tt,
|
|
1104
|
+
isVisible: nt,
|
|
1105
|
+
count: rt,
|
|
1106
|
+
exists: it
|
|
1376
1107
|
}
|
|
1377
1108
|
},
|
|
1378
1109
|
frame: {
|
|
1379
1110
|
selectors: {
|
|
1380
|
-
locator:
|
|
1381
|
-
frameLocator:
|
|
1111
|
+
locator: at,
|
|
1112
|
+
frameLocator: Q,
|
|
1382
1113
|
owner: {
|
|
1383
1114
|
to: "frame",
|
|
1384
1115
|
barrier: "up",
|
|
@@ -1391,9 +1122,9 @@ var Ae = class {
|
|
|
1391
1122
|
})
|
|
1392
1123
|
}
|
|
1393
1124
|
},
|
|
1394
|
-
operations: { addStyleTag:
|
|
1125
|
+
operations: { addStyleTag: qe }
|
|
1395
1126
|
}
|
|
1396
|
-
},
|
|
1127
|
+
}, st = (e, t = ot) => ({
|
|
1397
1128
|
element: {
|
|
1398
1129
|
selectors: {
|
|
1399
1130
|
...t.element.selectors,
|
|
@@ -1414,29 +1145,29 @@ var Ae = class {
|
|
|
1414
1145
|
...e.frame?.operations
|
|
1415
1146
|
}
|
|
1416
1147
|
}
|
|
1417
|
-
}),
|
|
1148
|
+
}), ct = 3e4, lt = 50, ut = (e) => {
|
|
1418
1149
|
let t = e[e.length - 1];
|
|
1419
1150
|
return typeof t == "object" && t ? t : void 0;
|
|
1420
|
-
},
|
|
1421
|
-
let t =
|
|
1422
|
-
return typeof t == "number" ? t :
|
|
1423
|
-
},
|
|
1151
|
+
}, dt = (e) => {
|
|
1152
|
+
let t = ut(e)?.timeout;
|
|
1153
|
+
return typeof t == "number" ? t : ct;
|
|
1154
|
+
}, ft = ({ executor: e, parts: t }) => ({ highlight: (n) => e.highlight(t, n).then(() => {}, () => {}) }), pt = async (e) => {
|
|
1424
1155
|
let t = {
|
|
1425
1156
|
parts: e.parts,
|
|
1426
1157
|
operation: e.operation,
|
|
1427
1158
|
args: e.args,
|
|
1428
1159
|
phase: "ensure"
|
|
1429
1160
|
};
|
|
1430
|
-
await e.gate?.(t,
|
|
1431
|
-
},
|
|
1161
|
+
await e.gate?.(t, ft(e));
|
|
1162
|
+
}, mt = async (e) => {
|
|
1432
1163
|
let { executor: t, gate: n, parts: r, operation: i, args: a } = e;
|
|
1433
1164
|
n && await n({
|
|
1434
1165
|
parts: r,
|
|
1435
1166
|
operation: i,
|
|
1436
1167
|
args: a,
|
|
1437
1168
|
phase: "execute"
|
|
1438
|
-
},
|
|
1439
|
-
let o =
|
|
1169
|
+
}, ft(e));
|
|
1170
|
+
let o = dt(a), s = Date.now() + o, c = /* @__PURE__ */ Error(`Locator timeout (${o}ms): ${i}`), { promise: l, reject: u } = Promise.withResolvers();
|
|
1440
1171
|
l.catch(() => {});
|
|
1441
1172
|
let d = setTimeout(() => u(c), o), f = c;
|
|
1442
1173
|
try {
|
|
@@ -1444,49 +1175,49 @@ var Ae = class {
|
|
|
1444
1175
|
return await Promise.race([t.execute(r, i, a), l]);
|
|
1445
1176
|
} catch (e) {
|
|
1446
1177
|
if (e === c) break;
|
|
1447
|
-
if (
|
|
1178
|
+
if (Ne(e)) throw e;
|
|
1448
1179
|
f = e;
|
|
1449
1180
|
let t = s - Date.now();
|
|
1450
1181
|
if (t <= 0) break;
|
|
1451
|
-
await new Promise((e) => setTimeout(e, Math.min(
|
|
1182
|
+
await new Promise((e) => setTimeout(e, Math.min(lt, t)));
|
|
1452
1183
|
}
|
|
1453
1184
|
} finally {
|
|
1454
1185
|
clearTimeout(d);
|
|
1455
1186
|
}
|
|
1456
1187
|
throw f;
|
|
1457
|
-
},
|
|
1188
|
+
}, ht = (e, t, n, r) => {
|
|
1458
1189
|
let i = {};
|
|
1459
|
-
for (let [a, o] of Object.entries(t[n].selectors)) i[a] = (...i) =>
|
|
1190
|
+
for (let [a, o] of Object.entries(t[n].selectors)) i[a] = (...i) => ht(e, t, o.to, [...r, {
|
|
1460
1191
|
kind: n,
|
|
1461
1192
|
name: a,
|
|
1462
1193
|
args: i
|
|
1463
1194
|
}]);
|
|
1464
|
-
for (let a of Object.keys(t[n].operations)) i[a] = (...t) =>
|
|
1195
|
+
for (let a of Object.keys(t[n].operations)) i[a] = (...t) => mt({
|
|
1465
1196
|
...e,
|
|
1466
1197
|
parts: r,
|
|
1467
1198
|
operation: a,
|
|
1468
1199
|
args: t
|
|
1469
1200
|
});
|
|
1470
|
-
return i.ensure = (t, n = {}) =>
|
|
1201
|
+
return i.ensure = (t, n = {}) => pt({
|
|
1471
1202
|
...e,
|
|
1472
1203
|
parts: r,
|
|
1473
1204
|
operation: t,
|
|
1474
1205
|
args: [n]
|
|
1475
1206
|
}), i;
|
|
1476
|
-
},
|
|
1207
|
+
}, gt = (e) => ht(e, e.modules ?? ot, "frame", []), _t = st({
|
|
1477
1208
|
element: { operations: {
|
|
1478
|
-
click: { resolve: (e, t = {}) =>
|
|
1479
|
-
hover: { resolve: (e, t = {}) =>
|
|
1480
|
-
fill: { resolve: (e, t, n = {}) =>
|
|
1481
|
-
textContent: { resolve: (e, t = {}) =>
|
|
1482
|
-
getAttribute: { resolve: (e, t, n = {}) =>
|
|
1483
|
-
isVisible: { resolve: (e, t = {}) =>
|
|
1484
|
-
count: { resolve: (e, t = {}) =>
|
|
1485
|
-
exists: { resolve: (e, t = {}) =>
|
|
1486
|
-
videoElement: { resolve: (e, t = {}) =>
|
|
1209
|
+
click: { resolve: (e, t = {}) => Y.click.resolve(e, t) },
|
|
1210
|
+
hover: { resolve: (e, t = {}) => Y.hover.resolve(e, t) },
|
|
1211
|
+
fill: { resolve: (e, t, n = {}) => Y.fill.resolve(e, t, n) },
|
|
1212
|
+
textContent: { resolve: (e, t = {}) => Y.textContent.resolve(e) },
|
|
1213
|
+
getAttribute: { resolve: (e, t, n = {}) => Y.getAttribute.resolve(e, t) },
|
|
1214
|
+
isVisible: { resolve: (e, t = {}) => Y.isVisible.resolve(e) },
|
|
1215
|
+
count: { resolve: (e, t = {}) => Y.count.resolve(e) },
|
|
1216
|
+
exists: { resolve: (e, t = {}) => Y.exists.resolve(e) },
|
|
1217
|
+
videoElement: { resolve: (e, t = {}) => b(Fe(J(e.elements), "HTMLVideoElement")) }
|
|
1487
1218
|
} },
|
|
1488
|
-
frame: { operations: { addStyleTag: { resolve: (e, t) =>
|
|
1489
|
-
}),
|
|
1219
|
+
frame: { operations: { addStyleTag: { resolve: (e, t) => qe.resolve(e, t) } } }
|
|
1220
|
+
}), vt = (e) => {
|
|
1490
1221
|
if (!e || e === "about:blank") return !1;
|
|
1491
1222
|
let t;
|
|
1492
1223
|
try {
|
|
@@ -1499,25 +1230,25 @@ var Ae = class {
|
|
|
1499
1230
|
let n = t.hostname, r = (e) => n === e || n.endsWith(`.${e}`);
|
|
1500
1231
|
return r("fkn.app") || r("fkn.dev") || r("sdbx.app");
|
|
1501
1232
|
}, $ = (e) => {
|
|
1502
|
-
if (
|
|
1503
|
-
},
|
|
1233
|
+
if (vt(e)) throw Error("attachFrame: refusing to target the extension's own pages or an FKN platform origin");
|
|
1234
|
+
}, yt = ({ src: e, domains: t, lockdown: n }) => {
|
|
1504
1235
|
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");
|
|
1505
|
-
},
|
|
1236
|
+
}, bt = {
|
|
1506
1237
|
scope: "embed.iframe",
|
|
1507
1238
|
category: "embed",
|
|
1508
1239
|
severity: 0,
|
|
1509
1240
|
title: "Load another website inside this app",
|
|
1510
1241
|
description: "Lets the app embed external pages directly inside its own view."
|
|
1511
|
-
},
|
|
1242
|
+
}, xt = {
|
|
1512
1243
|
scope: "embed.open",
|
|
1513
1244
|
category: "embed",
|
|
1514
1245
|
severity: 0,
|
|
1515
1246
|
title: "Open a website inside this app",
|
|
1516
1247
|
description: "Lets the app navigate to another site without leaving its window."
|
|
1517
|
-
},
|
|
1518
|
-
let t =
|
|
1248
|
+
}, St = (e) => {
|
|
1249
|
+
let t = gt({
|
|
1519
1250
|
executor: e.executor,
|
|
1520
|
-
modules:
|
|
1251
|
+
modules: _t,
|
|
1521
1252
|
gate: e.gate
|
|
1522
1253
|
}), n = (t, n = {}) => ($(t), e.goto(t, n)), r = () => e.url();
|
|
1523
1254
|
return {
|
|
@@ -1525,21 +1256,21 @@ var Ae = class {
|
|
|
1525
1256
|
goto: n,
|
|
1526
1257
|
url: r
|
|
1527
1258
|
};
|
|
1528
|
-
},
|
|
1259
|
+
}, Ct = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY", wt = async ({ iframe: e, domains: t = [], syncCookies: n = !0, lockdown: r = !1 }) => {
|
|
1529
1260
|
let i = crypto.randomUUID();
|
|
1530
|
-
if ($(e.src),
|
|
1261
|
+
if ($(e.src), yt({
|
|
1531
1262
|
src: e.src,
|
|
1532
1263
|
domains: t,
|
|
1533
1264
|
lockdown: r
|
|
1534
|
-
}), await
|
|
1535
|
-
e.dispatchEvent(new CustomEvent(
|
|
1536
|
-
let { executeLocator: a, highlightLocator: o, ensureLocatorPermission: s, goto: c } = await
|
|
1265
|
+
}), await D(), !e.isConnected) throw Error("attachFrame: the iframe must be connected to the document before attaching");
|
|
1266
|
+
e.dispatchEvent(new CustomEvent(Ct, { detail: i }));
|
|
1267
|
+
let { executeLocator: a, highlightLocator: o, ensureLocatorPermission: s, goto: c } = await O.attachFrame({
|
|
1537
1268
|
marker: i,
|
|
1538
1269
|
domains: t,
|
|
1539
1270
|
syncCookies: n,
|
|
1540
1271
|
lockdown: r
|
|
1541
1272
|
});
|
|
1542
|
-
return
|
|
1273
|
+
return St({
|
|
1543
1274
|
executor: {
|
|
1544
1275
|
execute: a,
|
|
1545
1276
|
highlight: o
|
|
@@ -1551,48 +1282,10 @@ var Ae = class {
|
|
|
1551
1282
|
}),
|
|
1552
1283
|
url: () => e.src
|
|
1553
1284
|
});
|
|
1554
|
-
},
|
|
1285
|
+
}, Tt = { request: (e) => O.requestPermissions(e.map((e) => ({
|
|
1555
1286
|
key: e.key,
|
|
1556
1287
|
scope: e.scope ?? "",
|
|
1557
1288
|
reason: e.reason
|
|
1558
|
-
}))) }
|
|
1559
|
-
let t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, n;
|
|
1560
|
-
try {
|
|
1561
|
-
n = new URL(t);
|
|
1562
|
-
} catch {
|
|
1563
|
-
return;
|
|
1564
|
-
}
|
|
1565
|
-
let r = n.hostname;
|
|
1566
|
-
if (At.some((e) => r === e || r.endsWith(`.${e}`))) throw Error(`fetch refuses FKN platform domains (${r})`);
|
|
1567
|
-
}, Mt = async (e) => {
|
|
1568
|
-
if (e != null) return typeof e == "string" || e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? e : new Request("https://body.invalid/", {
|
|
1569
|
-
method: "POST",
|
|
1570
|
-
body: e,
|
|
1571
|
-
duplex: "half"
|
|
1572
|
-
}).arrayBuffer();
|
|
1573
|
-
}, Nt = async (e) => {
|
|
1574
|
-
if (e.method === "GET" || e.method === "HEAD") return;
|
|
1575
|
-
let t = await e.clone().arrayBuffer();
|
|
1576
|
-
return t.byteLength ? t : void 0;
|
|
1577
|
-
}, Pt = async (e, n) => {
|
|
1578
|
-
if (jt(e), typeof e == "object" && e && !(e instanceof URL) && typeof e.url == "string") {
|
|
1579
|
-
let r = e, i = {};
|
|
1580
|
-
r.headers.forEach((e, t) => {
|
|
1581
|
-
i[t] = e;
|
|
1582
|
-
});
|
|
1583
|
-
let a = await Mt(n?.body === void 0 ? await Nt(r) : n.body);
|
|
1584
|
-
return t.then((e) => e.cloud.fetch(r.url, {
|
|
1585
|
-
...n,
|
|
1586
|
-
method: n?.method ?? r.method,
|
|
1587
|
-
headers: n?.headers ?? i,
|
|
1588
|
-
body: a
|
|
1589
|
-
}));
|
|
1590
|
-
}
|
|
1591
|
-
let r = e instanceof URL ? e.href : e, i = await Mt(n?.body);
|
|
1592
|
-
return t.then((e) => e.cloud.fetch(r, n?.body === void 0 ? n : {
|
|
1593
|
-
...n,
|
|
1594
|
-
body: i
|
|
1595
|
-
}));
|
|
1596
|
-
};
|
|
1289
|
+
}))) };
|
|
1597
1290
|
//#endregion
|
|
1598
|
-
export {
|
|
1291
|
+
export { pe as A, C as B, ge as C, ye as D, A as E, D as F, w as I, S as L, se as M, T as N, k as O, ce as P, b as R, Se as S, he as T, u as V, De as _, St as a, Ce as b, yt as c, W as d, Ne as f, Te as g, B as h, bt as i, fe as j, me as k, vt as l, z as m, Ct as n, xt as o, U as p, wt as r, $ as s, Tt as t, R as u, Ee as v, _e as w, j as x, we as y, x as z };
|