@fkn/lib 0.9.34 → 0.9.35
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.d.ts +6 -6
- package/account.js +3 -3
- package/{api-Bgsg9t9D.d.ts → api-CfmRAze5.d.ts} +1 -1
- package/{api-BdTgLphT.js → api-CtiKFcK3.js} +2 -2
- package/{api-MW-Lm0u8.cjs → api-Djf-XdZ4.cjs} +2 -2
- package/api.cjs +1 -1
- package/api.d.ts +2 -2
- package/api.js +1 -1
- package/attach-policy.d.ts +5 -5
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -1
- package/cloud/fs/promises.d.ts +3 -4
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +2 -2
- package/cloud/fs.js +2 -2
- package/cloud/net.d.ts +1 -1
- package/cloud-B9Sd7V1g.js +422 -0
- package/cloud-DCWD_0sd.cjs +1 -0
- package/{cloud-C40YCPuv.d.ts → cloud-DxitkM7z.d.ts} +9 -5
- package/cloud.cjs +1 -1
- package/cloud.d.ts +4 -4
- package/cloud.js +2 -2
- package/{contract-Gd543I6m.d.ts → contract-D37GGkou.d.ts} +126 -1
- package/contract.cjs +1 -0
- package/contract.d.ts +2 -2
- package/contract.js +28 -0
- package/desktop.d.ts +7 -7
- package/dgram.cjs +1 -1
- package/dgram.d.ts +5 -5
- package/dgram.js +1 -1
- package/dns.cjs +1 -1
- package/dns.d.ts +3 -3
- package/dns.js +1 -1
- package/extension-DJQ0oYdk.js +89 -0
- package/extension-DSrUjoLw.cjs +1 -0
- package/{extension-Bm-PwsD6.d.ts → extension-TRYu_aG-.d.ts} +16 -13
- 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.d.ts +3 -3
- package/fs/promises.js +1 -1
- package/{fs-CYcErwc4.d.ts → fs--NhtUyYa.d.ts} +1 -1
- package/{fs-O2bp9J0x.js → fs-BvNZePtN.js} +4 -4
- package/{fs-Bv3aFjqA.cjs → fs-D8RCGFNc.cjs} +1 -1
- package/fs.cjs +1 -1
- package/fs.d.ts +2 -2
- package/fs.js +1 -1
- package/http.d.ts +20 -20
- package/{index-DIK21kfh.d.ts → index-C_Lqta5o.d.ts} +110 -5
- package/{index-Cg6y_FTi.d.ts → index-kuPqkS_-.d.ts} +26 -3
- package/index.cjs +1 -1
- package/index.d.ts +25 -10
- package/index.js +51 -45
- package/{lib-C3f3XmGZ.js → lib-B-jGWfsv.js} +110 -60
- package/lib-Cjd91q7g.cjs +53 -0
- package/{net-BBtYFEzu.d.ts → net-0SlODFSM.d.ts} +2 -2
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +1 -1
- package/node-fs-BNTPsX5c.cjs +1 -0
- package/{node-fs-C9ECR_9H.js → node-fs-BZy9bzKd.js} +2 -2
- package/opfs/promises.d.ts +2 -2
- package/opfs.cjs +1 -1
- package/opfs.d.ts +2 -2
- package/opfs.js +1 -1
- package/package.json +1 -1
- package/packages.cjs +1 -1
- package/packages.d.ts +27 -27
- package/packages.js +1 -1
- package/{proxy-XeHtHIdZ.d.ts → proxy-Bmb2wxG1.d.ts} +2 -2
- package/{proxy-_m6Sqcr6.cjs → proxy-CYcaW5ew.cjs} +1 -1
- package/{proxy-fXckOcRn.js → proxy-DDwY3AVG.js} +1 -1
- package/react.d.ts +3 -3
- package/rooms.cjs +1 -1
- package/rooms.d.ts +8 -8
- package/rooms.js +1 -1
- package/{storage-C6Cd4J5E.js → storage-BbcnDCnc.js} +1 -1
- package/{storage-WZEvw3KN.d.ts → storage-ZrY4Y4L5.d.ts} +21 -2
- package/{storage-D2eBifiu.cjs → storage-dSi2dUKx.cjs} +1 -1
- package/cloud-DBNeXS9R.js +0 -272
- package/cloud-DHuqVKrl.cjs +0 -1
- package/extension-DALH11b4.js +0 -87
- package/extension-lR-cSs2P.cjs +0 -1
- package/lib-WiHTYaNP.cjs +0 -53
- package/node-fs-DZPGCYWg.cjs +0 -1
|
@@ -277,8 +277,8 @@ var ne = (e, t) => {
|
|
|
277
277
|
operation;
|
|
278
278
|
abi;
|
|
279
279
|
name = "ExtensionOperationUnsupportedError";
|
|
280
|
-
constructor(e, t) {
|
|
281
|
-
super(`The FKN WebExtension does not support "${e}" (ABI ${t}). Updating the extension may add it.`), this.operation = e, this.abi = t;
|
|
280
|
+
constructor(e, t, n) {
|
|
281
|
+
super(n ?? `The FKN WebExtension does not support "${e}" (ABI ${t}). Updating the extension may add it.`), this.operation = e, this.abi = t;
|
|
282
282
|
}
|
|
283
283
|
}, je = "FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY", Me = Se, Ne = h();
|
|
284
284
|
typeof document < "u" && document.addEventListener(je, () => {
|
|
@@ -335,13 +335,13 @@ var Pe = () => typeof document > "u" ? !1 : document.documentElement.dataset[Me]
|
|
|
335
335
|
], Ue = (e) => e.replace(/\.+$/, ""), We = (e) => {
|
|
336
336
|
let t = Ue(e);
|
|
337
337
|
return He.some((e) => t === e || t.endsWith(`.${e}`));
|
|
338
|
-
},
|
|
338
|
+
}, Ge = {
|
|
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
|
+
}, Ke = {
|
|
345
345
|
scope: "network.fetchCredentialed",
|
|
346
346
|
category: "network",
|
|
347
347
|
severity: 3,
|
|
@@ -349,7 +349,7 @@ var Pe = () => typeof document > "u" ? !1 : document.documentElement.dataset[Me]
|
|
|
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
|
+
}, qe = {
|
|
353
353
|
scope: "network.fetchLocal",
|
|
354
354
|
category: "network",
|
|
355
355
|
severity: 3,
|
|
@@ -357,12 +357,12 @@ var Pe = () => typeof document > "u" ? !1 : document.documentElement.dataset[Me]
|
|
|
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
|
+
}, Je = (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
|
+
}, Ye = (e) => {
|
|
366
366
|
let t;
|
|
367
367
|
try {
|
|
368
368
|
t = new URL(e);
|
|
@@ -370,8 +370,8 @@ var Pe = () => typeof document > "u" ? !1 : document.documentElement.dataset[Me]
|
|
|
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:") : Je(n);
|
|
374
|
+
}, Xe = (e) => {
|
|
375
375
|
let t;
|
|
376
376
|
try {
|
|
377
377
|
t = new URL(e);
|
|
@@ -379,18 +379,18 @@ var Pe = () => typeof document > "u" ? !1 : document.documentElement.dataset[Me]
|
|
|
379
379
|
return !1;
|
|
380
380
|
}
|
|
381
381
|
return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || We(t.hostname);
|
|
382
|
-
},
|
|
383
|
-
if (
|
|
384
|
-
},
|
|
382
|
+
}, A = (e) => {
|
|
383
|
+
if (Xe(e)) throw Error("fetch: refusing to target the extension's own pages or FKN platform domains");
|
|
384
|
+
}, Ze = (e) => {
|
|
385
385
|
if (!e?.headers) return;
|
|
386
386
|
let t = new Headers(e.headers), n = k.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
|
+
}, Qe = async (e, t) => {
|
|
392
392
|
let n = new Request(e, t);
|
|
393
|
-
|
|
393
|
+
A(n.url);
|
|
394
394
|
let r = n.body ? await n.arrayBuffer() : null;
|
|
395
395
|
return O.proxyFetch({
|
|
396
396
|
url: n.url,
|
|
@@ -399,11 +399,11 @@ var Pe = () => typeof document > "u" ? !1 : document.documentElement.dataset[Me]
|
|
|
399
399
|
body: r,
|
|
400
400
|
credentials: t?.credentials === "include" ? "include" : "omit",
|
|
401
401
|
redirect: n.redirect,
|
|
402
|
-
unsafeHeaders:
|
|
402
|
+
unsafeHeaders: Ze(t),
|
|
403
403
|
reason: t?.reason,
|
|
404
404
|
signal: t?.signal ?? void 0
|
|
405
405
|
});
|
|
406
|
-
},
|
|
406
|
+
}, j = {
|
|
407
407
|
scope: "network.readCookie",
|
|
408
408
|
category: "network",
|
|
409
409
|
severity: 3,
|
|
@@ -1208,24 +1208,24 @@ var dt = class {
|
|
|
1208
1208
|
}), xt = (e, t) => Object.assign(Error(e), {
|
|
1209
1209
|
name: _t,
|
|
1210
1210
|
operation: t
|
|
1211
|
-
}),
|
|
1211
|
+
}), V = (e) => z(e) === L, St = (e) => z(e) === R, Ct = (e) => z(e) === _t, wt = (e) => St(e) || V(e) || Ct(e), H = (e) => {
|
|
1212
1212
|
let t = (e.ownerDocument ?? e).defaultView;
|
|
1213
1213
|
if (!t) throw B("the resolved element belongs to a document with no window");
|
|
1214
1214
|
return t;
|
|
1215
|
-
},
|
|
1215
|
+
}, Tt = (e, t) => {
|
|
1216
1216
|
let n = e?.[t];
|
|
1217
1217
|
return typeof n == "function" ? n : null;
|
|
1218
1218
|
}, U = (e, t) => {
|
|
1219
1219
|
if (typeof e != "object" || !e) return null;
|
|
1220
1220
|
let n = (() => {
|
|
1221
1221
|
try {
|
|
1222
|
-
return H(
|
|
1222
|
+
return Tt(H(e), t);
|
|
1223
1223
|
} catch {
|
|
1224
1224
|
return null;
|
|
1225
1225
|
}
|
|
1226
1226
|
})();
|
|
1227
1227
|
if (n && e instanceof n) return n;
|
|
1228
|
-
let r =
|
|
1228
|
+
let r = Tt(globalThis, t);
|
|
1229
1229
|
return r && e instanceof r ? r : null;
|
|
1230
1230
|
}, W = (e, t) => U(e, t) !== null, G = (e) => {
|
|
1231
1231
|
if (e.length === 0) throw B("No elements found");
|
|
@@ -1300,7 +1300,7 @@ var dt = class {
|
|
|
1300
1300
|
ensureArgs: (e) => [void 0, e],
|
|
1301
1301
|
resolve: async (e, t, n = {}) => {
|
|
1302
1302
|
if (typeof t != "string") throw xt("fetch: url must be a string", "fetch");
|
|
1303
|
-
let r =
|
|
1303
|
+
let r = H(e.document), i;
|
|
1304
1304
|
try {
|
|
1305
1305
|
i = new r.URL(t, e.document.baseURI).href;
|
|
1306
1306
|
} catch {
|
|
@@ -1340,7 +1340,7 @@ var dt = class {
|
|
|
1340
1340
|
clientY: n.top + n.height * (t?.y ?? .5)
|
|
1341
1341
|
};
|
|
1342
1342
|
}, Vt = { resolve: (e, t = {}) => {
|
|
1343
|
-
let n = G(e.elements), r =
|
|
1343
|
+
let n = G(e.elements), r = H(n), i = {
|
|
1344
1344
|
bubbles: !0,
|
|
1345
1345
|
cancelable: !0,
|
|
1346
1346
|
composed: !0,
|
|
@@ -1369,7 +1369,7 @@ var dt = class {
|
|
|
1369
1369
|
buttons: 0
|
|
1370
1370
|
}));
|
|
1371
1371
|
} }, Ht = { resolve: (e, t = {}) => {
|
|
1372
|
-
let n = G(e.elements), r =
|
|
1372
|
+
let n = G(e.elements), r = H(n), i = {
|
|
1373
1373
|
bubbles: !0,
|
|
1374
1374
|
cancelable: !0,
|
|
1375
1375
|
composed: !0,
|
|
@@ -1429,7 +1429,7 @@ var dt = class {
|
|
|
1429
1429
|
}
|
|
1430
1430
|
};
|
|
1431
1431
|
}, Gt = { resolve: (e, t, n = {}) => {
|
|
1432
|
-
let r = G(e.elements), i =
|
|
1432
|
+
let r = G(e.elements), i = H(r), a = W(r, "HTMLInputElement");
|
|
1433
1433
|
if (a || W(r, "HTMLTextAreaElement")) {
|
|
1434
1434
|
let e = r, n = a ? Wt(e, t) : null;
|
|
1435
1435
|
n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))), Ut(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 }));
|
|
@@ -1443,7 +1443,7 @@ var dt = class {
|
|
|
1443
1443
|
} }, Kt = { resolve: (e, t = {}) => G(e.elements).textContent }, qt = { resolve: (e, t, n = {}) => G(e.elements).getAttribute(t) }, Jt = { resolve: (e, t = {}) => {
|
|
1444
1444
|
let n = G(e.elements);
|
|
1445
1445
|
if (!W(n, "HTMLElement")) return !0;
|
|
1446
|
-
let r =
|
|
1446
|
+
let r = H(n).getComputedStyle(n);
|
|
1447
1447
|
if (r?.display === "none" || r?.visibility === "hidden") return !1;
|
|
1448
1448
|
let i = n.getBoundingClientRect();
|
|
1449
1449
|
return i.width > 0 && i.height > 0;
|
|
@@ -1581,7 +1581,7 @@ var dt = class {
|
|
|
1581
1581
|
return await Promise.race([t.execute(r, i, a), l]);
|
|
1582
1582
|
} catch (e) {
|
|
1583
1583
|
if (e === c) break;
|
|
1584
|
-
if (
|
|
1584
|
+
if (wt(e)) throw e;
|
|
1585
1585
|
f = e;
|
|
1586
1586
|
let t = s - Date.now();
|
|
1587
1587
|
if (t <= 0) break;
|
|
@@ -1645,7 +1645,7 @@ var dt = class {
|
|
|
1645
1645
|
}, X = (e) => {
|
|
1646
1646
|
if (fn(e)) throw Error("attachFrame: refusing to target the extension's own pages or an FKN platform origin");
|
|
1647
1647
|
}, pn = ({ src: e, domains: t, lockdown: n }) => {
|
|
1648
|
-
if (
|
|
1648
|
+
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");
|
|
1649
1649
|
}, mn = {
|
|
1650
1650
|
scope: "embed.iframe",
|
|
1651
1651
|
category: "interaction",
|
|
@@ -1658,7 +1658,23 @@ var dt = class {
|
|
|
1658
1658
|
severity: 0,
|
|
1659
1659
|
title: "Open a website inside this app",
|
|
1660
1660
|
description: "Lets the app navigate to another site without leaving its window."
|
|
1661
|
-
}, gn =
|
|
1661
|
+
}, gn = class extends Error {
|
|
1662
|
+
name = "FrameWindowBlockedError";
|
|
1663
|
+
constructor() {
|
|
1664
|
+
super("attachFrame: the browser did not open the window. Call attachFrame directly in a click or key handler, and allow popups for this page");
|
|
1665
|
+
}
|
|
1666
|
+
}, _n = /* @__PURE__ */ new Set([
|
|
1667
|
+
"jar-unreachable",
|
|
1668
|
+
"bad-url",
|
|
1669
|
+
"opaque-opener"
|
|
1670
|
+
]), vn = class extends Error {
|
|
1671
|
+
name = "FrameWindowRefusedError";
|
|
1672
|
+
reason;
|
|
1673
|
+
constructor(e) {
|
|
1674
|
+
let t = _n.has(e) ? e : "unknown";
|
|
1675
|
+
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;
|
|
1676
|
+
}
|
|
1677
|
+
}, yn = (e) => {
|
|
1662
1678
|
let t = un({
|
|
1663
1679
|
executor: e.executor,
|
|
1664
1680
|
modules: dn,
|
|
@@ -1674,7 +1690,7 @@ var dt = class {
|
|
|
1674
1690
|
url: r,
|
|
1675
1691
|
request: i
|
|
1676
1692
|
};
|
|
1677
|
-
},
|
|
1693
|
+
}, bn = [
|
|
1678
1694
|
i,
|
|
1679
1695
|
a,
|
|
1680
1696
|
t,
|
|
@@ -1690,39 +1706,39 @@ var dt = class {
|
|
|
1690
1706
|
hn,
|
|
1691
1707
|
s,
|
|
1692
1708
|
m,
|
|
1693
|
-
A,
|
|
1694
|
-
j,
|
|
1695
1709
|
Ge,
|
|
1696
|
-
|
|
1710
|
+
Ke,
|
|
1711
|
+
qe,
|
|
1712
|
+
j,
|
|
1697
1713
|
et
|
|
1698
|
-
],
|
|
1714
|
+
], xn = st.map((e) => e.id), Sn = {
|
|
1699
1715
|
interaction: "act.click",
|
|
1700
1716
|
storage: "read.text",
|
|
1701
1717
|
network: "network.fetchCredentialed",
|
|
1702
1718
|
evaluation: "media.appearU"
|
|
1703
|
-
}, Z = (e) => e === 0 ? "auto" : e === 4 ? "critical" : "bundled", Q =
|
|
1719
|
+
}, Z = (e) => e === 0 ? "auto" : e === 4 ? "critical" : "bundled", Q = bn, $ = /* @__PURE__ */ new Map(), Cn = {};
|
|
1704
1720
|
(() => {
|
|
1705
|
-
$ = new Map(Q.map((e) => [e.scope, e])),
|
|
1721
|
+
$ = new Map(Q.map((e) => [e.scope, e])), Cn = Object.fromEntries($), Q.filter((e) => e.severity === 4).map((e) => e.scope);
|
|
1706
1722
|
let e = (e) => Q.filter((t) => t.category === e && Z(t.severity) === "bundled");
|
|
1707
|
-
Object.fromEntries(
|
|
1723
|
+
Object.fromEntries(xn.map((t) => [t, Math.max(0, ...e(t).map((e) => e.severity))])), Object.fromEntries(xn.map((t) => [t, e(t).some((e) => e.unsafe === !0)]));
|
|
1708
1724
|
})();
|
|
1709
|
-
var
|
|
1725
|
+
var wn = (e) => $.get(e)?.category, Tn = (e) => {
|
|
1710
1726
|
let t = $.get(e);
|
|
1711
1727
|
return t && Z(t.severity);
|
|
1712
|
-
},
|
|
1728
|
+
}, En = (e) => {
|
|
1713
1729
|
let t = $.get(e);
|
|
1714
1730
|
if (t) return Z(t.severity) === "critical" ? t.scope : t.category;
|
|
1715
|
-
},
|
|
1716
|
-
let n = t ?? (e &&
|
|
1717
|
-
return n !== void 0 &&
|
|
1718
|
-
},
|
|
1719
|
-
for (let { category: n, key: r } of t) if (
|
|
1731
|
+
}, Dn = (e) => Sn[e], On = ({ category: e, key: t }) => {
|
|
1732
|
+
let n = t ?? (e && Dn(e));
|
|
1733
|
+
return n !== void 0 && wn(n) !== void 0 ? n : void 0;
|
|
1734
|
+
}, kn = (e, t) => {
|
|
1735
|
+
for (let { category: n, key: r } of t) if (On({
|
|
1720
1736
|
category: n,
|
|
1721
1737
|
key: r
|
|
1722
1738
|
}) === 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}"`);
|
|
1723
|
-
},
|
|
1739
|
+
}, An = (e, t = {}) => {
|
|
1724
1740
|
let n = [], r = e.map((e) => {
|
|
1725
|
-
let r =
|
|
1741
|
+
let r = On(e), i = [];
|
|
1726
1742
|
if (r !== void 0) for (let a of e.hosts) i.push(n.length), n.push({
|
|
1727
1743
|
...t,
|
|
1728
1744
|
key: r,
|
|
@@ -1732,8 +1748,8 @@ var xn = (e) => $.get(e)?.category, Sn = (e) => {
|
|
|
1732
1748
|
reason: e.reason
|
|
1733
1749
|
});
|
|
1734
1750
|
return {
|
|
1735
|
-
key: r !== void 0 &&
|
|
1736
|
-
category: e.category ?? (r === void 0 ? "interaction" :
|
|
1751
|
+
key: r !== void 0 && Tn(r) === "critical" ? r : void 0,
|
|
1752
|
+
category: e.category ?? (r === void 0 ? "interaction" : Cn[r].category),
|
|
1737
1753
|
hosts: e.hosts,
|
|
1738
1754
|
indexes: i
|
|
1739
1755
|
};
|
|
@@ -1747,36 +1763,70 @@ var xn = (e) => $.get(e)?.category, Sn = (e) => {
|
|
|
1747
1763
|
allow: i.length > 0 && i.every((t) => e[t]?.allow === !0)
|
|
1748
1764
|
}))
|
|
1749
1765
|
};
|
|
1750
|
-
},
|
|
1751
|
-
|
|
1752
|
-
|
|
1766
|
+
}, jn = (e) => {
|
|
1767
|
+
let t = e;
|
|
1768
|
+
if (t.window === void 0) return "iframe";
|
|
1769
|
+
if (t.iframe !== void 0) throw TypeError("attachFrame: pass either iframe or window, not both");
|
|
1770
|
+
if (t.lockdown) throw TypeError("attachFrame: lockdown applies to an iframe, never to a window");
|
|
1771
|
+
if (typeof t.window != "object" || t.window === null) throw TypeError("attachFrame: window must be an object");
|
|
1772
|
+
return "window";
|
|
1773
|
+
}, Mn = (e, t, n) => {
|
|
1774
|
+
if (e === void 0) return t;
|
|
1775
|
+
if (typeof e != "number" || !Number.isFinite(e) || e <= 0) throw TypeError(`attachFrame: window.${n} must be a positive number of CSS pixels`);
|
|
1776
|
+
return Math.round(e);
|
|
1777
|
+
}, Nn = ({ url: e, width: t, height: n }) => {
|
|
1778
|
+
let r = (() => {
|
|
1779
|
+
if (e === void 0 || e === "" || e === "about:blank") return "";
|
|
1780
|
+
if (typeof e != "string") throw TypeError("attachFrame: window.url must be a string");
|
|
1781
|
+
let t = (() => {
|
|
1782
|
+
try {
|
|
1783
|
+
return new URL(e, location.href);
|
|
1784
|
+
} catch {
|
|
1785
|
+
throw TypeError(`attachFrame: window.url is not a valid URL: ${e}`);
|
|
1786
|
+
}
|
|
1787
|
+
})();
|
|
1788
|
+
if (t.protocol !== "http:" && t.protocol !== "https:") throw TypeError("attachFrame: window.url must be an http or https address");
|
|
1789
|
+
return t.href;
|
|
1790
|
+
})();
|
|
1791
|
+
return r && X(r), {
|
|
1792
|
+
url: r,
|
|
1793
|
+
width: Mn(t, 500, "width"),
|
|
1794
|
+
height: Mn(n, 700, "height")
|
|
1795
|
+
};
|
|
1796
|
+
}, Pn = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY", Fn = !1, In = () => {
|
|
1797
|
+
Fn || (Fn = !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."));
|
|
1798
|
+
}, Ln = async ({ iframe: e, domains: t = [], syncCookies: n = !0, lockdown: r = !1, permissions: i }) => {
|
|
1753
1799
|
let a = crypto.randomUUID();
|
|
1754
1800
|
if (X(e.src), pn({
|
|
1755
1801
|
src: e.src,
|
|
1756
1802
|
domains: t,
|
|
1757
1803
|
lockdown: r
|
|
1758
1804
|
}), await D(), !e.isConnected) throw Error("attachFrame: the iframe must be connected to the document before attaching");
|
|
1759
|
-
e.dispatchEvent(new CustomEvent(
|
|
1805
|
+
e.dispatchEvent(new CustomEvent(Pn, { detail: a }));
|
|
1760
1806
|
let { executeLocator: o, highlightLocator: s, ensureLocatorPermission: c, requestCategories: l, goto: u } = await O.attachFrame({
|
|
1761
1807
|
marker: a,
|
|
1762
1808
|
domains: t,
|
|
1763
1809
|
syncCookies: n,
|
|
1764
1810
|
lockdown: r
|
|
1765
|
-
}), d =
|
|
1811
|
+
}), d = yn({
|
|
1766
1812
|
executor: {
|
|
1767
1813
|
execute: o,
|
|
1768
1814
|
highlight: s
|
|
1769
1815
|
},
|
|
1770
1816
|
gate: (e) => c(e.parts, e.operation, e.args),
|
|
1771
|
-
request: async (e) => (
|
|
1817
|
+
request: async (e) => (kn("frame.request", e), await it(), l(e)),
|
|
1772
1818
|
goto: (e, t = {}) => u({
|
|
1773
1819
|
url: e,
|
|
1774
1820
|
...t
|
|
1775
1821
|
}),
|
|
1776
1822
|
url: () => e.src
|
|
1777
1823
|
});
|
|
1778
|
-
return i?.length && (rt() ? await d.request(i) :
|
|
1779
|
-
},
|
|
1824
|
+
return i?.length && (rt() ? await d.request(i) : In()), d;
|
|
1825
|
+
}, Rn = "attachFrame: window mode is served by the cloud backend for now, whatever extension is installed. Use cloud.attachFrame({ window })", zn = async (e) => {
|
|
1826
|
+
if (Nn(e.window), e.syncCookies === !1) throw TypeError("attachFrame: syncCookies false does not apply to an extension window, which is the site's own first-party tab");
|
|
1827
|
+
let t = T();
|
|
1828
|
+
throw new Ae("attachWindow", t.status === "absent" ? 0 : t.abi, Rn);
|
|
1829
|
+
}, Bn = (async (e) => jn(e) === "window" ? zn(e) : Ln(e)), Vn = "permissions.request: pass hosts, the sites the grant applies to", Hn = { request: async (e) => {
|
|
1780
1830
|
let t = e.map((e) => {
|
|
1781
1831
|
let { category: t, key: n, scope: r, reason: i, hosts: a } = e;
|
|
1782
1832
|
if (!("hosts" in e) && !("category" in e)) return { legacy: {
|
|
@@ -1785,7 +1835,7 @@ var xn = (e) => $.get(e)?.category, Sn = (e) => {
|
|
|
1785
1835
|
reason: i
|
|
1786
1836
|
} };
|
|
1787
1837
|
let o = p(a ?? [], { ipv6: !0 });
|
|
1788
|
-
if (!o.length) throw TypeError(
|
|
1838
|
+
if (!o.length) throw TypeError(Vn);
|
|
1789
1839
|
return { ask: {
|
|
1790
1840
|
category: t,
|
|
1791
1841
|
key: n,
|
|
@@ -1793,9 +1843,9 @@ var xn = (e) => $.get(e)?.category, Sn = (e) => {
|
|
|
1793
1843
|
hosts: o
|
|
1794
1844
|
} };
|
|
1795
1845
|
}), n = t.flatMap((e) => "ask" in e ? [e.ask] : []);
|
|
1796
|
-
|
|
1797
|
-
let { items: r, answer: i } =
|
|
1846
|
+
kn("permissions.request", n), n.length && await it();
|
|
1847
|
+
let { items: r, answer: i } = An(n), a = t.flatMap((e) => "legacy" in e ? [e.legacy] : []), o = [...r, ...a], s = o.length ? await O.requestPermissions(o) : [], c = i(s.slice(0, r.length)), l = s.slice(r.length), u = 0, d = 0;
|
|
1798
1848
|
return t.map((e) => "ask" in e ? c[u++] : l[d++]);
|
|
1799
|
-
} },
|
|
1849
|
+
} }, Un = (e) => typeof e == "object" && !!e, Wn = "PermissionDeniedError", Gn = (e) => e instanceof Error ? e.name === Wn : Un(e) && e.name === "PermissionDeniedError";
|
|
1800
1850
|
//#endregion
|
|
1801
|
-
export {
|
|
1851
|
+
export { ke as $, tt as A, k as B, R as C, st as D, gt as E, Ke as F, Pe as G, Be as H, qe as I, D as J, T as K, Ge as L, j as M, A as N, et as O, Qe as P, xe as Q, Xe as R, V as S, wt as T, ze as U, Ve as V, Ne as W, Ae as X, be as Y, w as Z, pn as _, Bn as a, y as at, L as b, wn as c, gn as d, ye as et, vn as f, X as g, hn as h, Pn as i, ve as it, $e as j, nt as k, En as l, yn as m, Gn as n, C as nt, jn as o, mn as p, Fe as q, Hn as r, ge as rt, Nn as s, Wn as t, _e as tt, Tn as u, fn as v, bt as w, yt as x, St as y, Ye as z };
|
package/lib-Cjd91q7g.cjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./hosts-DD4rDeQH.cjs");let n=require("osra");var r=(e,t)=>{let n=new EventTarget,r=new Map,i=EventTarget.prototype.addEventListener.bind(n),a=EventTarget.prototype.removeEventListener.bind(n);return Object.defineProperty(n,"addEventListener",{configurable:!0,value:(a,o,s)=>{if(o!==null){if(!r.has(a)){let i=r=>{n.dispatchEvent(new CustomEvent(a,{detail:t(r,e),bubbles:r.bubbles,cancelable:r.cancelable,composed:r.composed}))};e.addEventListener(a,i),r.set(a,i)}i(a,o,s)}}}),Object.defineProperty(n,"removeEventListener",{configurable:!0,value:(t,n,i)=>{if(n===null)return;a(t,n,i);let o=r.get(t);o&&(e.removeEventListener(t,o),r.delete(t))}}),n},i=e=>typeof e==`boolean`?+!!e:+!!e?.capture,a=e=>{let t=new WeakMap;return{addEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r);if(s||(s=new Map,t.set(r,s)),s.has(o))return;let c=typeof a==`object`&&!!a&&!!a.once,l=t=>{c&&s.delete(o);let i=e.unenrich(t,n);typeof r==`function`?r.call(e.target,i):r.handleEvent(i)};s.set(o,l),e.remoteEvents.addEventListener(n,l,a)},removeEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r),c=s?.get(o);c&&(e.remoteEvents.removeEventListener(n,c,a),s.delete(o))},dispatchEvent:t=>e.remoteEvents.dispatchEvent(t)}},o=e.t({box:()=>S,createVideoElementHandle:()=>b,isType:()=>x,revive:()=>C,type:()=>s}),s=`videoElement`,c=[`currentTime`,`volume`,`muted`,`playbackRate`,`src`,`loop`,`autoplay`,`preload`,`poster`,`disableRemotePlayback`],l=[`duration`,`paused`,`ended`,`seeking`,`readyState`,`currentSrc`],u=[`buffered`,`seekable`],d=Symbol.for(`fkn.remoteVideoElement`),f=Symbol.for(`fkn.remoteVideoElement.state`),p=Symbol.for(`fkn.remoteVideoElement.controller`),m=e=>e?Array.from({length:e.length},(t,n)=>[e.start(n),e.end(n)]):[],h=e=>{let t={};for(let n of[...c,...l])t[n]=e[n];for(let n of u)t[n]=m(e[n]);return t.error=e.error?{code:e.error.code,message:e.error.message}:null,t},g=e=>{let t=t=>{if(!Number.isInteger(t)||t<0||t>=e.length)throw new DOMException(`Index or size is negative or greater than the allowed amount`,`IndexSizeError`)};return{get length(){return e.length},start(n){return t(n),e[n][0]},end(n){return t(n),e[n][1]}}},ee=e=>e?{code:e.code,message:e.message,MEDIA_ERR_ABORTED:1,MEDIA_ERR_NETWORK:2,MEDIA_ERR_DECODE:3,MEDIA_ERR_SRC_NOT_SUPPORTED:4}:null,_=e=>r(e,(e,t)=>({originalDetail:e instanceof CustomEvent?e.detail:null,snapshot:h(t)})),v=async(e,t)=>{switch(t){case`play`:return await e.play(),null;case`pause`:return e.pause(),null;case`load`:return e.load(),null;case`requestPictureInPicture`:if(typeof e.requestPictureInPicture!=`function`)throw Error(`requestPictureInPicture is not supported in this environment`);return await e.requestPictureInPicture(),null;case`exitPictureInPicture`:{let t=e.ownerDocument;if(typeof t?.exitPictureInPicture!=`function`)throw Error(`exitPictureInPicture is not supported in this environment`);return await t.exitPictureInPicture(),null}default:throw Error(`videoElement: unknown method "${t}"`)}},te=e=>({call:async t=>v(e,t),set:async(t,n)=>{try{e[t]=n}catch{}return h(e)},events:_(e)}),y=(e,t)=>{let n=new EventTarget;Object.defineProperty(n,d,{value:!0}),Object.defineProperty(n,f,{value:e}),Object.defineProperty(n,p,{value:t});let r=a({target:n,remoteEvents:t.events,unenrich:(t,n)=>{if(!(t instanceof CustomEvent))return t;let r=t.detail;if(!r||!(`snapshot`in r))return t;Object.assign(e,r.snapshot);let i={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed};return r.originalDetail===null?new Event(n,i):new CustomEvent(n,{...i,detail:r.originalDetail})}}),i={addEventListener:{configurable:!0,value:r.addEventListener},removeEventListener:{configurable:!0,value:r.removeEventListener},dispatchEvent:{configurable:!0,value:r.dispatchEvent},error:{configurable:!0,enumerable:!0,get(){return ee(e.error)}},play:{configurable:!0,value:()=>t.call(`play`,[])},pause:{configurable:!0,value:()=>{t.call(`pause`,[]).catch(()=>{})}},load:{configurable:!0,value:()=>{t.call(`load`,[]).catch(()=>{})}},requestPictureInPicture:{configurable:!0,value:()=>t.call(`requestPictureInPicture`,[])},exitPictureInPicture:{configurable:!0,value:()=>t.call(`exitPictureInPicture`,[])},HAVE_FUTURE_DATA:{enumerable:!0,value:3},HAVE_ENOUGH_DATA:{enumerable:!0,value:4}};for(let n of c)i[n]={configurable:!0,enumerable:!0,get(){return e[n]},set(r){e[n]=r,t.set(n,r).then(t=>{Object.assign(e,t)},()=>{})}};for(let t of l)i[t]={configurable:!0,enumerable:!0,get(){return e[t]}};for(let t of u)i[t]={configurable:!0,enumerable:!0,get(){return g(e[t])}};return Object.defineProperties(n,i),n},b=e=>y(h(e),te(e)),x=e=>typeof e==`object`&&!!e&&e[d]===!0,S=(e,t)=>{let r=e;return{...n.BoxBase,type:s,initialState:r[f],controller:(0,n.recursiveBox)(r[p],t)}},C=(e,t)=>{let r=(0,n.recursiveRevive)(e.controller,t);return y({...e.initialState},r)},w=e=>[o,...e],ne=2,re=0,ie=`fknExtension`,ae=`fknExtensionAbi`,oe=`fknExtensionOps`,se=[`data-fkn-extension`,`data-fkn-extension-abi`,`data-fkn-extension-ops`],ce=e=>{if(e===void 0)return 0;let t=Number(e);return Number.isInteger(t)&&t>=0?t:0},le=e=>e===void 0?null:e.split(`,`).map(e=>e.trim()).filter(Boolean),ue=(e,t=0)=>{if(e.fknExtension!==`true`)return{status:`absent`};let n=ce(e[ae]),r=le(e[oe]);return n<t?{status:`outdated`,abi:n,required:t,operations:r}:{status:`ok`,abi:n,operations:r}},de=(e,t)=>e.status===`ok`?e.operations===null||e.operations.includes(t):!1,T=class extends Error{abi;required;name=`ExtensionOutdatedError`;constructor(e,t){super(`The FKN WebExtension is installed but too old for this page: it speaks ABI ${e} and this page needs at least ${t}. Updating the extension fixes this.`),this.abi=e,this.required=t}},fe=class extends Error{operation;abi;name=`ExtensionOperationUnsupportedError`;constructor(e,t,n){super(n??`The FKN WebExtension does not support "${e}" (ABI ${t}). Updating the extension may add it.`),this.operation=e,this.abi=t}},pe=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,me=ie,he=(0,n.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(pe,()=>{he.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:ge()}}))});var ge=()=>typeof document>`u`?!1:document.documentElement.dataset[me]===`true`,E=()=>typeof document>`u`?{status:`absent`}:ue(document.documentElement.dataset),D=null,_e=e=>{D=e},ve=150,O=(e=1e3)=>new Promise((t,n)=>{let r=()=>E().status===`ok`;if(r())return t();let i,a=e=>{clearTimeout(i),c.disconnect(),document.removeEventListener(`readystatechange`,l),e()},o=()=>a(async()=>{let e=E();if(e.status===`outdated`)return n(new T(e.abi,e.required));if(D){if(await D().catch(()=>{}),r())return t();let e=E();if(e.status===`outdated`)return n(new T(e.abi,e.required))}n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),s=()=>{clearTimeout(i),i=setTimeout(()=>r()?a(t):o(),ve)},c=new MutationObserver(()=>{r()&&a(t)}),l=()=>{document.readyState===`complete`&&!r()&&s()};if(i=setTimeout(o,e),c.observe(document.documentElement,{attributes:!0,attributeFilter:[...se]}),document.addEventListener(`readystatechange`,l),document.readyState===`complete`)return s();r()&&a(t)}),ye,k=new Proxy({},{get:(e,t)=>async(...e)=>{await O(),ye??=(0,n.expose)({},{transport:window,revivableModules:w});let r=(await ye)[t];return r(...e)}}),A=[`origin`,`referer`,`cookie`],be=(e,t)=>(e??[]).some(([e,n])=>e.trim().toLowerCase()===t&&n!==``),xe=e=>be(e,`cookie`),Se=(e,t)=>{if(t===`include`&&xe(e))throw Error(`fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other`)},Ce=e=>{let t=[...new Set((e??[]).map(([e])=>e.trim().toLowerCase()).filter(e=>!A.includes(e)))];if(t.length)throw Error(`fetch: refusing to forge request header(s): ${t.join(`, `)}`)},we=[`fkn.app`,`fkn.dev`,`sdbx.app`],Te=e=>e.replace(/\.+$/,``),Ee=e=>{let t=Te(e);return we.some(e=>t===e||t.endsWith(`.${e}`))},De={scope:`network.fetch`,category:`network`,severity:0,title:`Fetch data from other sites`,description:`Lets the app download public data from other websites directly, past the usual cross-origin limits.`},Oe={scope:`network.fetchCredentialed`,category:`network`,severity:3,chip:`load as you`,unsafe:!0,title:`Fetch from other sites, signed in as you`,description:`Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.`},ke={scope:`network.fetchLocal`,category:`network`,severity:3,chip:`local network`,unsafe:!0,title:`Access devices on your local network`,description:`Lets the app reach devices and services on your home or work network, which websites normally cannot touch.`},Ae=e=>{let t=e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);if(!t)return!1;let[n,r]=[Number(t[1]),Number(t[2])];return n===10||n===127||n===0||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168},je=e=>{let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.replace(/^\[|\]$/g,``).toLowerCase().replace(/\.$/,``);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:`):Ae(n)},Me=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||Ee(t.hostname)},Ne=e=>{if(Me(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},Pe=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=A.map(e=>{let n=t.get(e);return n===null||n===``?void 0:[e,n]}).filter(e=>e!==void 0);return n.length?n:void 0},Fe=async(e,t)=>{let n=new Request(e,t);Ne(n.url);let r=n.body?await n.arrayBuffer():null;return k.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:Pe(t),reason:t?.reason,signal:t?.signal??void 0})},j={scope:`network.readCookie`,category:`network`,severity:3,chip:`read cookie`,unsafe:!0,title:`Read a site’s cookie`,description:`Lets the app read a named cookie from another site, which can include the login token only that site should see.`},Ie={get:e=>k.getCookie(e)},Le={scope:`network.modifyRequestHeaders`,category:`network`,severity:2,chip:`rewrite headers`,unsafe:!0,title:`Rewrite request headers to other sites`,description:`Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites.`},Re=e=>k.setRequestHeaderRule(e),ze=e=>k.removeRequestHeaderRule({ruleId:e}),Be=()=>{let e=E();return e.status===`ok`&&e.abi>=2},Ve=async()=>{await O();let e=E();if(e.status===`ok`&&e.abi<2)throw new T(e.abi,2)},He=e=>`Read the text, links and details ${e} shows.`,Ue=e=>`Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`,We=[{id:`interaction`,heading:`Interaction`,summary:`Allow the app to interact with the website (clicks, type in text, etc.)`,title:e=>`Interact with ${e}`,description:(e,t)=>t?`Click, type and hover on ${e} for you. If you are signed in there, this happens as you.`:`Click, type and hover on ${e} for you, in a signed-out view.`,cloudTitle:e=>`Interact with ${e}`,cloudDescription:e=>`Click, type and hover on ${e} for you, through the session in this frame. If you signed in there, this happens as you.`},{id:`storage`,heading:`Site data`,summary:`Can read the website's data`,title:e=>`Read data from ${e}`,description:He,cloudTitle:e=>`Read data from ${e}`,cloudDescription:He},{id:`network`,heading:`Network`,summary:`Make requests on behalf of the website (using your cookies, etc.)`,title:e=>`Make requests to ${e} as you`,description:e=>`Load pages and data from ${e} and send changes there with your signed-in session.`,cloudTitle:e=>`Make requests to ${e}`,cloudDescription:e=>`Load pages and data from ${e} and send changes there through the session in this frame. If you signed in there, this happens as you.`},{id:`evaluation`,heading:`Evaluation`,summary:`Can execute arbitrary code on the website`,title:e=>`Run code on ${e}`,description:Ue,cloudTitle:e=>`Run code on ${e}`,cloudDescription:Ue}],Ge=class extends Error{reason;filename;line;column;source;constructor(e,t,n,r,i){super(`${e}:${n}:${r}: ${t}`),this.reason=t,this.filename=e,this.line=n,this.column=r,this.source=i}},Ke=class{start;end;source;constructor(e,t,n){this.start=e,this.end=t,this.source=n}},M;(function(e){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`})(M||={});var qe=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);if(e[o]!==`\\`)return o;r=o+2,i--}while(i>0);throw Error(`Too many escaping`)},N=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`(`,r)),n.push(e.indexOf(`"`,r)),n.push(e.indexOf(`'`,r)),n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);switch(e[o]){case`\\`:r=o+2;break;case`(`:{let t=N(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=qe(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=qe(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)},P=/\/\*[^]*?(?:\*\/|$)/g;function F(e){return e?e.trim():``}function I(e,t){let n=e&&typeof e.type==`string`,r=n?e:t;for(let t in e){let n=e[t];Array.isArray(n)?n.forEach(e=>{I(e,r)}):n&&typeof n==`object`&&I(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var Je=class{level=0;indentation=` `;compress=!1;constructor(e){typeof e?.indent==`string`&&(this.indentation=e?.indent),e?.compress&&(this.compress=!0)}emit(e,t){return e}indent(e){return this.level=this.level||1,e?(this.level+=e,``):Array(this.level).join(this.indentation)}visit(e){switch(e.type){case M.stylesheet:return this.stylesheet(e);case M.rule:return this.rule(e);case M.declaration:return this.declaration(e);case M.comment:return this.comment(e);case M.container:return this.container(e);case M.charset:return this.charset(e);case M.counterStyle:return this.counterStyle(e);case M.document:return this.document(e);case M.customMedia:return this.customMedia(e);case M.fontFace:return this.fontFace(e);case M.fontFeatureValues:return this.fontFeatureValues(e);case M.host:return this.host(e);case M.import:return this.import(e);case M.keyframes:return this.keyframes(e);case M.keyframe:return this.keyframe(e);case M.layer:return this.layer(e);case M.media:return this.media(e);case M.namespace:return this.namespace(e);case M.page:return this.page(e);case M.pageMarginBox:return this.pageMarginBox(e);case M.positionTry:return this.positionTry(e);case M.property:return this.property(e);case M.scope:return this.scope(e);case M.startingStyle:return this.startingStyle(e);case M.supports:return this.supports(e);case M.viewTransition:return this.viewTransition(e);case M.atRule:return this.genericAtRule(e)}}mapVisit(e,t){let n=``;t||=``;for(let r=0,i=e.length;r<i;r++)n+=this.visit(e[r]),t&&r<i-1&&(n+=this.emit(t));return n}compile(e){return this.compress?e.stylesheet.rules.map(this.visit,this).join(``):this.stylesheet(e)}stylesheet(e){return this.mapVisit(e.stylesheet.rules,`
|
|
2
|
+
|
|
3
|
+
`)}comment(e){return this.compress?this.emit(``,e.position):this.emit(`${this.indent()}/*${e.comment}*/`,e.position)}container(e){return this.compress?this.emit(`@container ${e.container}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@container ${e.container}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
4
|
+
|
|
5
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}layer(e){return this.compress?this.emit(`@layer ${e.layer}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`):this.emit(`${this.indent()}@layer ${e.layer}`,e.position)+(e.rules?this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
6
|
+
|
|
7
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`):`;`)}import(e){return this.emit(`@import ${e.import};`,e.position)}media(e){return this.compress?this.emit(`@media ${e.media}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@media ${e.media}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
8
|
+
|
|
9
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}document(e){let t=`@${e.vendor||``}document ${e.document}`;return this.compress?this.emit(t,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(t,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
10
|
+
|
|
11
|
+
`)+this.emit(`${this.indent(-1)}\n}`)}charset(e){return this.emit(`@charset ${e.charset};`,e.position)}namespace(e){return this.emit(`@namespace ${e.namespace};`,e.position)}startingStyle(e){return this.compress?this.emit(`@starting-style`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@starting-style`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
12
|
+
|
|
13
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}supports(e){return this.compress?this.emit(`@supports ${e.supports}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@supports ${e.supports}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
14
|
+
|
|
15
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}keyframes(e){return this.compress?this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.keyframes)+this.emit(`}`):this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.keyframes,`
|
|
16
|
+
`)+this.emit(`${this.indent(-1)}}`)}keyframe(e){let t=e.declarations;return this.compress?this.emit(e.values.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`):this.emit(this.indent())+this.emit(e.values.join(`, `),e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(t,`
|
|
17
|
+
`)+this.emit(`${this.indent(-1)}\n${this.indent()}}\n`)}page(e){if(this.compress){let t=e.selectors.length?e.selectors.join(`, `):``;return this.emit(`@page ${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`)}let t=e.selectors.length?`${e.selectors.join(`, `)} `:``;return this.emit(`@page ${t}`,e.position)+this.emit(`{
|
|
18
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
19
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
20
|
+
}`)}pageMarginBox(e){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(`{
|
|
21
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
22
|
+
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}fontFace(e){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(`{
|
|
23
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
24
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
25
|
+
}`)}host(e){return this.compress?this.emit(`@host`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`@host`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
26
|
+
|
|
27
|
+
`)+this.emit(`${this.indent(-1)}\n}`)}customMedia(e){return this.emit(`@custom-media ${e.name} ${e.media};`,e.position)}property(e){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(`{
|
|
28
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
29
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
30
|
+
}`)}counterStyle(e){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(`{
|
|
31
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
32
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
33
|
+
}`)}fontFeatureValues(e){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,`
|
|
34
|
+
|
|
35
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}scope(e){let t=e.scope?` ${e.scope}`:``;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,`
|
|
36
|
+
|
|
37
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}viewTransition(e){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(`{
|
|
38
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
39
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
40
|
+
}`)}positionTry(e){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(`{
|
|
41
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
42
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
43
|
+
}`)}genericAtRule(e){let t=e.prelude?` ${e.prelude}`:``;if(this.compress)return this.emit(`@${e.name}${t}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`);if(!e.rules)return this.emit(`${this.indent()}@${e.name}${t};`,e.position);let n=e.rules.some(e=>e.type!==M.declaration&&e.type!==M.comment),r=n?`
|
|
44
|
+
|
|
45
|
+
`:`
|
|
46
|
+
`;return this.emit(`${this.indent()}@${e.name}${t}`,e.position)+this.emit(n?` {\n${this.indent(1)}`:` {
|
|
47
|
+
`)+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()}}`)}rule(e){let t=e.declarations;if(!t.length)return``;if(this.compress)return this.emit(e.selectors.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`);let n=this.indent();return this.emit(e.selectors.map(e=>n+e).join(`,
|
|
48
|
+
`),e.position)+this.emit(` {
|
|
49
|
+
`)+this.emit(this.indent(1))+this.mapVisit(t,`
|
|
50
|
+
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}declaration(e){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(`
|
|
51
|
+
`).join(`
|
|
52
|
+
`.padEnd(22)+this.indent()),e.position)+this.emit(`;`):this.emit(this.indent())+this.emit(`${e.property}: ${e.value}`,e.position)+this.emit(`;`)}},Ye=(e,t)=>{t||={};let n=1,r=1;function i(){let e={line:n,column:r};return i=>(i.position=new Ke(e,{line:n,column:r},t?.source||``),u(),i)}let a=[];function o(i){let o=new Ge(t?.source||``,i,n,r,e);if(!t?.silent)throw o;a.push(o)}function s(){let t=/^{\s*/.exec(e);return!!t&&(l(t),!0)}function c(){let t=/^}/.exec(e);return!!t&&(l(t),!0)}function l(t){let i=t[0];return function(e){let t=e.match(/\n/g);t&&(n+=t.length);let i=e.lastIndexOf(`
|
|
53
|
+
`);r=~i?e.length-i:r+e.length}(i),e=e.slice(i.length),t}function u(){let t=/^\s*/.exec(e);t&&l(t)}function d(e){e||=[];let t=f();for(;t;)e.push(t),t=f();return e}function f(){let t=i();if(e.charAt(0)!==`/`||e.charAt(1)!==`*`)return;let n=/^\/\*[^]*?\*\//.exec(e);return n?(l(n),t({type:M.comment,comment:n[0].slice(2,-2)})):o(`End of comment missing`)}function p(){let t=N(e,[`{`]);if(t===-1||t===0)return;let n=e.substring(0,t);return l([n]),((e,t)=>{let n=[],r=0;for(;r<e.length;){let i=N(e,t,r);if(i===-1)return n.push(e.substring(r)),n;n.push(e.substring(r,i)),r=i+1}return n})(F(n).replace(P,``),[`,`]).map(e=>F(e))}function m(){let t=i(),n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);if(!n)return;l(n);let r=F(n[0]),a=/^:\s*/.exec(e);if(!a)return o(`property missing ':'`);l(a);let s=``,c=N(e,[`;`,`}`]);c!==-1&&(s=e.substring(0,c),l([s]),s=F(s).replace(P,``));let u=t({type:M.declaration,property:r.replace(P,``),value:s}),d=/^[;\s]*/.exec(e);return d&&l(d),u}function h(){let n=[];if(!s())return o(`missing '{'`);d(n);let r=m();for(;r;)n.push(r),d(n),r=m();for(;t?.silent&&e.length&&e.charAt(0)!==`}`;){let t=e.indexOf(`;`),i=e.indexOf(`}`);if(t===-1||!(i===-1||t<i))break;for(l([e.substring(0,t+1)]),u(),d(n),r=m();r;)n.push(r),d(n),r=m()}return c()?n:o(`missing '}'`)}function g(){let t=N(e,[`{`]);if(t===-1)return!1;let n=N(e,[`;`]),r=N(e,[`}`]);return!(n!==-1&&n<t)&&!(r!==-1&&r<t)}function ee(){let n=[];if(!s())return o(`missing '{'`);for(d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=C();if(e){n.push(e),d(n);continue}}if(g()){let e=w();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return c()?n:o(`missing '}'`)}function _(){let n=[];for(u(),d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=C();if(e){n.push(e),d(n);continue}}if(g()){let e=w();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return n}function v(){let t=[],n=i(),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);for(;r;){let n=l(r);t.push(n[1]);let i=/^,\s*/.exec(e);i&&l(i),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e)}if(t.length)return n({type:M.keyframe,values:t,declarations:h()||[]})}let te=RegExp(`^@(${[`top-left-corner`,`top-left`,`top-center`,`top-right`,`top-right-corner`,`bottom-left-corner`,`bottom-left`,`bottom-center`,`bottom-right`,`bottom-right-corner`,`left-top`,`left-middle`,`left-bottom`,`right-top`,`right-middle`,`right-bottom`].join(`|`)})(?![\\w-])\\s*`),y=S(`import`),b=S(`charset`),x=S(`namespace`);function S(t){let n=RegExp(`^@`+t+`\\s*((?::?[^;'"]|"(?:\\\\"|[^"])*?"|'(?:\\\\'|[^'])*?')+)(?:;|$)`);return()=>{let r=i(),a=n.exec(e);if(!a)return;let o=l(a),s={type:t};return s[t]=o[1].trim(),r(s)}}function C(){if(e[0]===`@`)return function(){let t=i(),n=/^@([-\w]+)?keyframes\s*/.exec(e);if(!n)return;let r=l(n)[1],a=/^([-\w]+)\s*/.exec(e);if(!a)return o(`@keyframes missing name`);let u=l(a)[1];if(!s())return o(`@keyframes missing '{'`);let f=d(),p=v();for(;p;)f.push(p),f=f.concat(d()),p=v();return c()?t({type:M.keyframes,name:u,vendor:r,keyframes:f}):o(`@keyframes missing '}'`)}()||function(){let t=i(),n=/^@media *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@media missing '{'`);let a=_();return c()?t({type:M.media,media:r,rules:a}):o(`@media missing '}'`)}()||function(){let t=i(),n=/^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(e);if(!n)return;let r=l(n);return t({type:M.customMedia,name:F(r[1]),media:F(r[2])})}()||function(){let t=i(),n=/^@supports *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@supports missing '{'`);let a=_();return c()?t({type:M.supports,supports:r,rules:a}):o(`@supports missing '}'`)}()||y()||b()||x()||function(){let t=i(),n=/^@([-\w]+)?document *([^{]+)/.exec(e);if(!n)return;let r=l(n),a=F(r[1]),u=F(r[2]);if(!s())return o(`@document missing '{'`);let d=_();return c()?t({type:M.document,document:u,vendor:a,rules:d}):o(`@document missing '}'`)}()||function(){let t=i(),n=/^@page */.exec(e);if(!n)return;l(n);let r=p()||[];if(!s())return o(`@page missing '{'`);let a=[];for(d(a);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=C();if(e){a.push(e),d(a);continue}}let t=m();if(!t)break;a.push(t),d(a)}return c()?t({type:M.page,selectors:r,declarations:a}):o(`@page missing '}'`)}()||function(){let t=i(),n=/^@host\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@host missing '{'`);let r=_();return c()?t({type:M.host,rules:r}):o(`@host missing '}'`)}()||function(){let t=i(),n=/^@font-face\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@font-face missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:M.fontFace,declarations:r}):o(`@font-face missing '}'`)}()||function(){let t=i(),n=/^@font-feature-values\s+([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@font-feature-values missing '{'`);let a=_();return c()?t({type:M.fontFeatureValues,fontFamily:r,rules:a}):o(`@font-feature-values missing '}'`)}()||function(){let t=i(),n=/^@container *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@container missing '{'`);let a=_();return c()?t({type:M.container,container:r,rules:a}):o(`@container missing '}'`)}()||function(){let t=i(),n=/^@starting-style\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@starting-style missing '{'`);let r=_();return c()?t({type:M.startingStyle,rules:r}):o(`@starting-style missing '}'`)}()||function(){let t=i(),n=/^@layer *([^{;@]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s()){let n=/^[;\s]*/.exec(e);return n&&l(n),t({type:M.layer,layer:r})}let a=_();return c()?t({type:M.layer,layer:r,rules:a}):o(`@layer missing '}'`)}()||function(){let t=i(),n=/^@property\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@property missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:M.property,name:r,declarations:a}):o(`@property missing '}'`)}()||function(){let t=i(),n=/^@counter-style\s+([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@counter-style missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:M.counterStyle,name:r,declarations:a}):o(`@counter-style missing '}'`)}()||function(){let t=i(),n=/^@scope\s*([^{]*)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@scope missing '{'`);let a=_();return c()?t({type:M.scope,scope:r,rules:a}):o(`@scope missing '}'`)}()||function(){let t=i(),n=/^@view-transition\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@view-transition missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:M.viewTransition,declarations:r}):o(`@view-transition missing '}'`)}()||function(){let t=i(),n=/^@position-try\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@position-try missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:M.positionTry,name:r,declarations:a}):o(`@position-try missing '}'`)}()||function(){let t=i(),n=te.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@${r} missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:M.pageMarginBox,name:r,declarations:a}):o(`@${r} missing '}'`)}()||function(){let t=i(),n=/^@([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1],a=``,u=N(e,[`{`,`;`]);if(u!==-1&&u>0&&(a=F(e.substring(0,u)),l([e.substring(0,u)])),s()){let e=_();return c()?t({type:M.atRule,name:r,prelude:a,rules:e}):o(`@${r} missing '}'`)}let d=/^[;\s]*/.exec(e);return d&&l(d),t({type:M.atRule,name:r,prelude:a})}()}function w(){let e=i(),t=p();return t?(d(),e({type:M.rule,selectors:t,declarations:ee()||[]})):o(`selector missing`)}return I(function(){let n=function(){let n,r=[];for(u(),d(r);e.length;){if(e.charAt(0)===`}`){if(t?.silent){o(`extra '}'`),l([`}`]),u(),d(r);continue}break}if(n=C()||w(),!n){if(t?.silent){l([e.charAt(0)]),u(),d(r);continue}break}r.push(n),d(r)}return r}();return{type:M.stylesheet,stylesheet:{source:t?.source,rules:n,parsingErrors:a}}}())},Xe=(e,t)=>new Je(t||{}).compile(e),Ze=Object.defineProperty,Qe=(e,t)=>{let n={};for(var r in e)Ze(n,r,{get:e[r],enumerable:!0});return t||Ze(n,Symbol.toStringTag,{value:`Module`}),n},$e=`LocatorError`,L=`LocatorUnsupportedError`,R=`LocatorDeniedError`,et=`LocatorInvalidError`,z=e=>typeof e==`object`&&e?e.name:void 0,B=e=>Object.assign(Error(e),{name:$e}),tt=(e,t=``,n)=>Object.assign(Error(e),{name:L,operation:t,backend:n}),nt=(e,t)=>tt(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),rt=(e,t)=>Object.assign(Error(e),{name:R,operation:t}),it=(e,t)=>Object.assign(Error(e),{name:et,operation:t}),at=e=>z(e)===L,ot=e=>z(e)===R,st=e=>z(e)===et,ct=e=>ot(e)||at(e)||st(e),V=e=>{let t=(e.ownerDocument??e).defaultView;if(!t)throw B(`the resolved element belongs to a document with no window`);return t},lt=(e,t)=>{let n=e?.[t];return typeof n==`function`?n:null},H=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=(()=>{try{return lt(V(e),t)}catch{return null}})();if(n&&e instanceof n)return n;let r=lt(globalThis,t);return r&&e instanceof r?r:null},U=(e,t)=>H(e,t)!==null,W=e=>{if(e.length===0)throw B(`No elements found`);if(e.length>1)throw B(`Strict mode violation: locator resolved to ${e.length} elements`);return e[0]},ut=(e,t)=>{if(!U(e,t))throw B(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);return e},dt=e=>e.tagName.toLowerCase(),ft=new Set,pt=e=>{ft.add(e)},mt=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,ht=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),gt=e=>!mt.test(ht(e.value)),_t=new Set([M.import,M.fontFace,M.namespace,M.charset,M.document,M.comment]),vt=e=>{if(_t.has(e.type))return null;if(e.type===M.declaration)return gt(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=yt(r))}return n},yt=e=>e.map(e=>vt(e)).filter(e=>e!==null),bt=e=>{let t;try{t=Ye(e,{silent:!0})}catch{return``}return t.stylesheet.rules=yt(t.stylesheet.rules),Xe(t)},xt=(e,t)=>{let n=()=>{t.parentNode||(e.head??e.documentElement).appendChild(t)};if(n(),e.readyState===`complete`)return;let r=new MutationObserver(e=>{for(let r of e)for(let e of r.removedNodes)if(e===t||e.contains?.(t)){n();return}});r.observe(e.documentElement,{childList:!0,subtree:!0});let i=()=>r.disconnect(),a=e.defaultView;a?a.addEventListener(`load`,i,{once:!0}):setTimeout(i,3e4)},St={resolve:(e,t)=>{let n=e.document.createElement(`style`);n.textContent=t.noSanitize?t.content:bt(t.content);try{xt(e.document,n)}catch(e){console.error(e)}pt(n)}},Ct=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},G={kind:`frame`,ensureArgs:e=>[void 0,e],resolve:async(e,t,n={})=>{if(typeof t!=`string`)throw it(`fetch: url must be a string`,`fetch`);let r=V(e.document),i;try{i=new r.URL(t,e.document.baseURI).href}catch{throw it(`fetch: not a valid url: ${t}`,`fetch`)}let a=await r.fetch(i,{method:n.method??`GET`,headers:n.headers,body:n.body??null,redirect:n.redirect??`follow`,credentials:n.credentials??`include`});return{status:a.status,statusText:a.statusText,ok:a.ok,url:a.url,redirected:a.redirected,type:a.type,headers:Ct(a.headers),body:await a.arrayBuffer()}}},K=Qe({click:()=>Tt,count:()=>Nt,exists:()=>Pt,fill:()=>kt,getAttribute:()=>jt,hover:()=>Et,isVisible:()=>Mt,textContent:()=>At}),wt=(e,t)=>{let n=e.getBoundingClientRect();return{clientX:n.left+n.width*(t?.x??.5),clientY:n.top+n.height*(t?.y??.5)}},Tt={resolve:(e,t={})=>{let n=W(e.elements),r=V(n),i={bubbles:!0,cancelable:!0,composed:!0,...wt(n,t.position),button:0},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerdown`,{...a,buttons:1})),n.dispatchEvent(new r.MouseEvent(`mousedown`,{...i,buttons:1})),n.dispatchEvent(new r.PointerEvent(`pointerup`,{...a,buttons:0})),n.dispatchEvent(new r.MouseEvent(`mouseup`,{...i,buttons:0})),n.dispatchEvent(new r.MouseEvent(`click`,{...i,buttons:0}))}},Et={resolve:(e,t={})=>{let n=W(e.elements),r=V(n),i={bubbles:!0,cancelable:!0,composed:!0,...wt(n,t.position)},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerover`,a)),n.dispatchEvent(new r.PointerEvent(`pointerenter`,{...a,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseenter`,{...i,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseover`,i)),n.dispatchEvent(new r.PointerEvent(`pointermove`,a)),n.dispatchEvent(new r.MouseEvent(`mousemove`,i))}},Dt=(e,t)=>{e._valueTracker?.setValue(``);let n=(H(e,`HTMLTextAreaElement`)??H(e,`HTMLInputElement`))?.prototype,r=n&&Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t},Ot=(e,t)=>{if(e.type!==`range`)return null;let n=Number(e.min||0),r=Number(e.max||100);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=n)return null;let i=Number(t);if(!Number.isFinite(i))return null;let a=Math.max(0,Math.min(1,(i-n)/(r-n))),o=e.getBoundingClientRect(),s={bubbles:!0,cancelable:!0,composed:!0,clientX:o.left+o.width*a,clientY:o.top+o.height/2,button:0},c={...s,pointerType:`mouse`,pointerId:1,isPrimary:!0};return{pointerDown:{...c,buttons:1},pointerUp:{...c,buttons:0},mouseDown:{...s,buttons:1},mouseUp:{...s,buttons:0}}},kt={resolve:(e,t,n={})=>{let r=W(e.elements),i=V(r),a=U(r,`HTMLInputElement`);if(a||U(r,`HTMLTextAreaElement`)){let e=r,n=a?Ot(e,t):null;n&&(r.dispatchEvent(new i.PointerEvent(`pointerdown`,n.pointerDown)),r.dispatchEvent(new i.MouseEvent(`mousedown`,n.mouseDown))),Dt(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}));return}if(U(r,`HTMLElement`)&&r.isContentEditable){r.textContent=t,r.dispatchEvent(new i.Event(`input`,{bubbles:!0}));return}throw Error(`fill: element <${dt(r)}> is not fillable`)}},At={resolve:(e,t={})=>W(e.elements).textContent},jt={resolve:(e,t,n={})=>W(e.elements).getAttribute(t)},Mt={resolve:(e,t={})=>{let n=W(e.elements);if(!U(n,`HTMLElement`))return!0;let r=V(n).getComputedStyle(n);if(r?.display===`none`||r?.visibility===`hidden`)return!1;let i=n.getBoundingClientRect();return i.width>0&&i.height>0}},Nt={resolve:(e,t={})=>e.elements.length},Pt={resolve:(e,t={})=>e.elements.length>0},q=(e,t)=>e.elements.flatMap(e=>[...e.querySelectorAll(t)]),J=e=>e.replaceAll(`"`,`\\"`),Ft={to:`element`,css:!0,resolve:(e,t)=>q(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`descend`})},It={to:`frame`,css:!0,barrier:`down`,resolve:(e,t)=>q(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`down`})},Lt={element:{selectors:{locator:Ft,frameLocator:It,getByRole:{to:`element`,resolve:(e,t)=>q(e,`[role="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[role="${J(e)}"]`:`[role]`})},getByText:{to:`element`,resolve:(e,t)=>e.elements.flatMap(e=>[e,...e.querySelectorAll(`*`)]).filter(e=>e.textContent?.includes(t)),render:e=>({fragment:typeof e==`string`?`:has-text("${J(e)}")`:`:has-text(...)`})},getByTestId:{to:`element`,resolve:(e,t)=>q(e,`[data-testid="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[data-testid="${J(e)}"]`:`[data-testid]`})},first:{to:`element`,resolve:e=>e.elements.slice(0,1),render:()=>({fragment:`:first`})},nth:{to:`element`,resolve:(e,t)=>{let n=e.elements.at(t);return n?[n]:[]},render:e=>({fragment:typeof e==`number`?`:nth(${e})`:`:nth(?)`})}},operations:{click:Tt,fill:kt,hover:Et,textContent:At,getAttribute:jt,isVisible:Mt,count:Nt,exists:Pt}},frame:{selectors:{locator:Ft,frameLocator:It,owner:{to:`frame`,barrier:`up`,resolve:e=>{throw Error(`owner: must be processed by the executor as an upward pivot`)},render:()=>({fragment:``,separator:`up`})}},operations:{addStyleTag:St,fetch:G}}},Rt=(e,t=Lt)=>({element:{selectors:{...t.element.selectors,...e.element?.selectors},operations:{...t.element.operations,...e.element?.operations}},frame:{selectors:{...t.frame.selectors,...e.frame?.selectors},operations:{...t.frame.operations,...e.frame?.operations}}}),zt=3e4,Bt=50,Vt=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},Ht=e=>{let t=Vt(e)?.timeout;return typeof t==`number`?t:zt},Ut=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),Wt=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,Ut(e))},Gt=async e=>{let{executor:t,gate:n,parts:r,operation:i,args:a}=e;n&&await n({parts:r,operation:i,args:a,phase:`execute`},Ut(e));let o=Ht(a),s=Date.now()+o,c=Error(`Locator timeout (${o}ms): ${i}`),{promise:l,reject:u}=Promise.withResolvers();l.catch(()=>{});let d=setTimeout(()=>u(c),o),f=c;try{for(;Date.now()<s;)try{return await Promise.race([t.execute(r,i,a),l])}catch(e){if(e===c)break;if(ct(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(Bt,t)))}}finally{clearTimeout(d)}throw f},Kt=(e,t,n,r)=>{let i={};for(let[a,o]of Object.entries(t[n].selectors))i[a]=(...i)=>Kt(e,t,o.to,[...r,{kind:n,name:a,args:i}]);for(let a of Object.keys(t[n].operations))i[a]=(...t)=>Gt({...e,parts:r,operation:a,args:t});return i.ensure=(i,a={})=>{let o=t[n].operations[i]?.ensureArgs;return Wt({...e,parts:r,operation:i,args:o?.(a)??[a]})},i},qt=e=>Kt(e,e.modules??Lt,`frame`,[]),Jt=Rt({element:{operations:{click:{resolve:(e,t={})=>K.click.resolve(e,t)},hover:{resolve:(e,t={})=>K.hover.resolve(e,t)},fill:{resolve:(e,t,n={})=>K.fill.resolve(e,t,n)},textContent:{resolve:(e,t={})=>K.textContent.resolve(e)},getAttribute:{resolve:(e,t,n={})=>K.getAttribute.resolve(e,t)},isVisible:{resolve:(e,t={})=>K.isVisible.resolve(e)},count:{resolve:(e,t={})=>K.count.resolve(e)},exists:{resolve:(e,t={})=>K.exists.resolve(e)},videoElement:{resolve:(e,t={})=>b(ut(W(e.elements),`HTMLVideoElement`))}}},frame:{operations:{addStyleTag:{resolve:(e,t)=>St.resolve(e,t)},fetch:{resolve:(e,t,n={})=>G.resolve(e,t,n),kind:G.kind,ensureArgs:G.ensureArgs}}}}),Yt=e=>{if(!e||e===`about:blank`)return!1;let t;try{t=new URL(e,location.href)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||t.protocol!==`about:`&&Ee(t.hostname)},Y=e=>{if(Yt(e))throw Error(`attachFrame: refusing to target the extension's own pages or an FKN platform origin`)},Xt=({src:e,domains:t,lockdown:n})=>{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`)},Zt={scope:`embed.iframe`,category:`interaction`,severity:0,title:`Load another website inside this app`,description:`Lets the app embed external pages directly inside its own view.`},Qt={scope:`embed.open`,category:`interaction`,severity:0,title:`Open a website inside this app`,description:`Lets the app navigate to another site without leaving its window.`},$t=class extends Error{name=`FrameWindowBlockedError`;constructor(){super(`attachFrame: the browser did not open the window. Call attachFrame directly in a click or key handler, and allow popups for this page`)}},en=new Set([`jar-unreachable`,`bad-url`,`opaque-opener`]),tn=class extends Error{name=`FrameWindowRefusedError`;reason;constructor(e){let t=en.has(e)?e:`unknown`;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}},nn=e=>{let t=qt({executor:e.executor,modules:Jt,gate:e.gate}),n=(t,n={})=>(Y(t),e.goto(t,n)),r=()=>e.url(),i=async t=>{let n=e.request;if(!n)throw Error(`frame.request: this backend cannot ask for permission categories`);return n(t)};return{...t,goto:n,url:r,request:i}},rn=[t.g,t.h,t._,t.p,t.m,t.n,t.i,t.r,t.d,t.a,t.o,Zt,Qt,t.l,t.u,De,Oe,ke,j,Le],an=We.map(e=>e.id),on={interaction:`act.click`,storage:`read.text`,network:`network.fetchCredentialed`,evaluation:`media.appearU`},X=e=>e===0?`auto`:e===4?`critical`:`bundled`,Z=rn,Q=new Map,sn={};(()=>{Q=new Map(Z.map(e=>[e.scope,e])),sn=Object.fromEntries(Q),Z.filter(e=>e.severity===4).map(e=>e.scope);let e=e=>Z.filter(t=>t.category===e&&X(t.severity)===`bundled`);Object.fromEntries(an.map(t=>[t,Math.max(0,...e(t).map(e=>e.severity))])),Object.fromEntries(an.map(t=>[t,e(t).some(e=>e.unsafe===!0)]))})();var cn=e=>Q.get(e)?.category,ln=e=>{let t=Q.get(e);return t&&X(t.severity)},un=e=>{let t=Q.get(e);if(t)return X(t.severity)===`critical`?t.scope:t.category},dn=e=>on[e],fn=({category:e,key:t})=>{let n=t??(e&&dn(e));return n!==void 0&&cn(n)!==void 0?n:void 0},pn=(e,t)=>{for(let{category:n,key:r}of t)if(fn({category:n,key:r})===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}"`)},mn=(e,t={})=>{let n=[],r=e.map(e=>{let r=fn(e),i=[];if(r!==void 0)for(let a of e.hosts)i.push(n.length),n.push({...t,key:r,scope:``,site:a,hosts:e.hosts,reason:e.reason});return{key:r!==void 0&&ln(r)===`critical`?r:void 0,category:e.category??(r===void 0?`interaction`:sn[r].category),hosts:e.hosts,indexes:i}});return{items:n,answer:e=>r.map(({key:t,category:n,hosts:r,indexes:i})=>({category:n,...t===void 0?{}:{key:t},hosts:r,allow:i.length>0&&i.every(t=>e[t]?.allow===!0)}))}},hn=e=>{let t=e;if(t.window===void 0)return`iframe`;if(t.iframe!==void 0)throw TypeError(`attachFrame: pass either iframe or window, not both`);if(t.lockdown)throw TypeError(`attachFrame: lockdown applies to an iframe, never to a window`);if(typeof t.window!=`object`||t.window===null)throw TypeError(`attachFrame: window must be an object`);return`window`},$=(e,t,n)=>{if(e===void 0)return t;if(typeof e!=`number`||!Number.isFinite(e)||e<=0)throw TypeError(`attachFrame: window.${n} must be a positive number of CSS pixels`);return Math.round(e)},gn=({url:e,width:t,height:n})=>{let r=(()=>{if(e===void 0||e===``||e===`about:blank`)return``;if(typeof e!=`string`)throw TypeError(`attachFrame: window.url must be a string`);let t=(()=>{try{return new URL(e,location.href)}catch{throw TypeError(`attachFrame: window.url is not a valid URL: ${e}`)}})();if(t.protocol!==`http:`&&t.protocol!==`https:`)throw TypeError(`attachFrame: window.url must be an http or https address`);return t.href})();return r&&Y(r),{url:r,width:$(t,500,`width`),height:$(n,700,`height`)}},_n=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,vn=!1,yn=()=>{vn||(vn=!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.`))},bn=async({iframe:e,domains:t=[],syncCookies:n=!0,lockdown:r=!1,permissions:i})=>{let a=crypto.randomUUID();if(Y(e.src),Xt({src:e.src,domains:t,lockdown:r}),await O(),!e.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);e.dispatchEvent(new CustomEvent(_n,{detail:a}));let{executeLocator:o,highlightLocator:s,ensureLocatorPermission:c,requestCategories:l,goto:u}=await k.attachFrame({marker:a,domains:t,syncCookies:n,lockdown:r}),d=nn({executor:{execute:o,highlight:s},gate:e=>c(e.parts,e.operation,e.args),request:async e=>(pn(`frame.request`,e),await Ve(),l(e)),goto:(e,t={})=>u({url:e,...t}),url:()=>e.src});return i?.length&&(Be()?await d.request(i):yn()),d},xn=`attachFrame: window mode is served by the cloud backend for now, whatever extension is installed. Use cloud.attachFrame({ window })`,Sn=async e=>{if(gn(e.window),e.syncCookies===!1)throw TypeError(`attachFrame: syncCookies false does not apply to an extension window, which is the site's own first-party tab`);let t=E();throw new fe(`attachWindow`,t.status===`absent`?0:t.abi,xn)},Cn=(async e=>hn(e)===`window`?Sn(e):bn(e)),wn=`permissions.request: pass hosts, the sites the grant applies to`,Tn={request:async e=>{let n=e.map(e=>{let{category:n,key:r,scope:i,reason:a,hosts:o}=e;if(!(`hosts`in e)&&!(`category`in e))return{legacy:{key:r,scope:i??``,reason:a}};let s=t.t(o??[],{ipv6:!0});if(!s.length)throw TypeError(wn);return{ask:{category:n,key:r,reason:a,hosts:s}}}),r=n.flatMap(e=>`ask`in e?[e.ask]:[]);pn(`permissions.request`,r),r.length&&await Ve();let{items:i,answer:a}=mn(r),o=n.flatMap(e=>`legacy`in e?[e.legacy]:[]),s=[...i,...o],c=s.length?await k.requestPermissions(s):[],l=a(c.slice(0,i.length)),u=c.slice(i.length),d=0,f=0;return n.map(e=>`ask`in e?l[d++]:u[f++])}},En=e=>typeof e==`object`&&!!e,Dn=`PermissionDeniedError`,On=e=>e instanceof Error?e.name===Dn:En(e)&&e.name===`PermissionDeniedError`;Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return un}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return On}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return je}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as TcpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import {
|
|
3
|
-
import "./api-
|
|
2
|
+
import { B as Resolvers, gt as TcpSocketResult, mt as TcpSocketListenerResult } from "./contract-D37GGkou.js";
|
|
3
|
+
import "./api-CfmRAze5.js";
|
|
4
4
|
import { AddressInfo, ListenOptions, Server, ServerOpts, Socket, SocketConnectOpts, SocketConstructorOpts } from "net";
|
|
5
5
|
import { DuplexOptions, Stream } from "stream";
|
|
6
6
|
import { EventEmitter } from "events";
|
package/net.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-Djf-XdZ4.cjs"),n=require("./busy-Dv8wzE5M.cjs"),r=require("./utils-BvgGdrgN.cjs");require("./wire.cjs");let i=require("stream"),a=require("events");var o=e.t({Server:()=>c,Socket:()=>s,_default:()=>f,connect:()=>l,createConnection:()=>u,createServer:()=>d,default:()=>f,isIP:()=>r.r,isIPv4:()=>r.i,isIPv6:()=>r.a}),s=class extends i.Stream.Duplex{_localAddress;_remoteAddress;_webVPNTcpSocketPromise;constructor(e){if(e?.fd!==void 0)throw Error(`FKN WebVPN does not support file descriptors`);super(e),e?.connection&&this.__webvpn_tcp_socket_init__(e.connection)}_busyRelease;__webvpn_tcp_socket_init__(e,t){if(this._busyRelease??=n.t(`tcp socket`),t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort},this._remoteAddress={address:t.remoteAddress,family:t.remoteFamily,port:t.remotePort}),this._webVPNTcpSocketPromise=e.then(e=>{let t=e.dataReadableStream.getReader(),n=e.dataWritableStream.getWriter();return this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},this._remoteAddress={address:e.remoteAddress,family:e.remoteFamily,port:e.remotePort},{...e,reader:t,writer:n}}).catch(e=>{this.emit(`error`,e)}),!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);return this._webVPNTcpSocketPromise.then(e=>{if(!e){this._busyRelease?.();return}this.emit(`connect`)}),this._webVPNTcpSocketPromise}_read(e){if(!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);this._webVPNTcpSocketPromise.then(e=>{if(!e){this.push(null);return}e.reader.read().then(({value:e,done:t})=>{if(t){this.push(null);return}this._restartTimeoutTimer(),this.push(e)}).catch(e=>{this.destroy(e)})})}_write(e,t,n){if(!this._webVPNTcpSocketPromise){n(Error(`Socket not connected`));return}this._webVPNTcpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not connected`);await t.writer.ready,await t.writer.write(e),this._restartTimeoutTimer(),n()}).catch(n)}connect(...e){let n=r.c(...e),i=this.__webvpn_tcp_socket_init__(t.o(`an outbound tcp socket`).then(e=>e.cloud.webvpn.tcpSocket({remoteAddress:n.host??`localhost`,remotePort:n.port})));return n.callback&&i.then(e=>{e&&n.callback.call(this)}),this}_final(e){if(!this._webVPNTcpSocketPromise){e();return}this._webVPNTcpSocketPromise.then(async e=>{e&&await e.writer.close()}).then(()=>e(),t=>e(t))}_destroy(e,t){if(this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._busyRelease?.(),!this._webVPNTcpSocketPromise){t(e);return}this._webVPNTcpSocketPromise.then(async e=>{e&&await(this._resetRequested?e.resetAndDestroy():e.destroy())}).then(()=>t(e),()=>t(e))}destroySoon(){if(this.writableFinished){this.destroy();return}this.once(`finish`,()=>this.destroy()),this.end()}_resetRequested=!1;resetAndDestroy(){return this._resetRequested=!0,this.destroy(),this}_timeoutMs;_timeoutTimer;_restartTimeoutTimer(){this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._timeoutMs&&(this._timeoutTimer=setTimeout(()=>this.emit(`timeout`),this._timeoutMs))}setTimeout(e,t){return t&&this.on(`timeout`,t),this._timeoutMs=e,this._restartTimeoutTimer(),this}setNoDelay(e){let t=e??!0;return this._setTcpOption({type:0,value:t}),this}setKeepAlive(e,t){let n=e??!1,r=t!==void 0&&t>0?Math.max(1,Math.round(t/1e3)):0;return this._setTcpOption({type:2,enabled:n,initialDelaySeconds:r}),this}setSendBufferSize(e){return this._setTcpOption({type:3,value:e}),this}setRecvBufferSize(e){return this._setTcpOption({type:4,value:e}),this}_typeOfService;getTypeOfService(){return this._typeOfService??0}setTypeOfService(e){return this._typeOfService=e,this}_setTcpOption(e){if(!this._webVPNTcpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before connect`));return}this._webVPNTcpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}write(e,t,...n){return super.write(e,t,...n)}address(){return this._localAddress??{}}unref(){return this}ref(){return this}autoSelectFamilyAttemptedAddresses;bufferSize;bytesRead;bytesWritten;connecting;pending;get localAddress(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.address}get localPort(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.port}get localFamily(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.family}readyState;get remoteAddress(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.address}get remotePort(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.port}get remoteFamily(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.family}timeout},c=class extends a.EventEmitter{_localAddress;_webVPNTcpSocketListenerPromise;constructor(e,t){super(e),t&&this.on(`connection`,t),e?.connection&&this.__webvpn_tcp_socket_listener_init__(e.connection)}_busyRelease;__webvpn_tcp_socket_listener_init__(e){return this._busyRelease??=n.t(`tcp server`),this._webVPNTcpSocketListenerPromise=e.then(e=>(this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e)).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketListenerPromise.then(e=>{if(!e){this._busyRelease?.();return}this.emit(`listening`)}),this._webVPNTcpSocketListenerPromise}listen(...e){let n=r.c(...e);this._closeEmitted=!1;let i=e=>{let t=new s;t.__webvpn_tcp_socket_init__(Promise.resolve(e),e),this.emit(`connection`,t)},a=e=>{this._localAddress=void 0;try{e&&this.listenerCount(`error`)>0&&this.emit(`error`,e)}finally{this._emitClose()}},o=e=>t.o(`a tcp listener`).then(t=>t.cloud.webvpn.tcpSocketListener({localAddress:e,localPort:n.port,onConnection:i,onClose:a})),c=n.host?o(n.host):o(`::`).catch(()=>o(`0.0.0.0`)),l=this.__webvpn_tcp_socket_listener_init__(c);return n.callback&&l.then(e=>{e&&n.callback.call(this)}),this}_closeEmitted=!1;_emitClose(){this._closeEmitted||(this._closeEmitted=!0,this._busyRelease?.(),this.emit(`close`))}close(e){return this._webVPNTcpSocketListenerPromise&&this._webVPNTcpSocketListenerPromise.then(async t=>{if(t)try{await t.close(),this._localAddress=void 0,this._emitClose(),e&&e()}catch(t){this._localAddress=void 0,this._emitClose(),e&&e(t)}}),this}address(){return this._localAddress??null}getConnections(e){throw Error(`Method not implemented.`)}ref(){return this}unref(){return this}maxConnections;connections;listening;async[Symbol.asyncDispose](){}},l=(e,t)=>new s().connect(e,t),u=(e,t)=>new s().connect(e,t),d=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new c(e);return t&&n.on(`connection`,t),n},f={Socket:s,Server:c,connect:l,createConnection:u,createServer:d,isIP:r.r,isIPv4:r.i,isIPv6:r.a};exports.Server=c,exports.Socket=s,exports._default=f,exports.default=f,exports.connect=l,exports.createConnection=u,exports.createServer=d,exports.isIP=r.r,exports.isIPv4=r.i,exports.isIPv6=r.a,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
package/net.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-
|
|
1
|
+
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-0SlODFSM.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
package/net.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { o as t } from "./api-
|
|
2
|
+
import { o as t } from "./api-CtiKFcK3.js";
|
|
3
3
|
import { t as n } from "./busy-B189uX--.js";
|
|
4
4
|
import { a as r, c as i, i as a, r as o } from "./utils-C-cAd4r4.js";
|
|
5
5
|
import "./wire.js";
|