@fkn/lib 0.9.38 → 0.9.40
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-DF4nHz2Q.d.ts → api-BE5zPvFZ.d.ts} +7 -1
- package/{api-CtiKFcK3.js → api-Dp-2AT3u.js} +84 -77
- package/api-jOTOA-5n.cjs +3 -0
- package/api.cjs +1 -1
- package/api.d.ts +2 -2
- package/api.js +1 -1
- 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.cjs +1 -1
- package/cloud/fs.js +1 -1
- package/cloud/net.d.ts +1 -1
- package/{cloud-Bfc6rkF2.d.ts → cloud-5eldoFxK.d.ts} +3 -3
- package/{cloud-EfyYfgVT.js → cloud-BLv19j-W.js} +210 -206
- package/cloud-D7aQY4GH.cjs +1 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -3
- package/cloud.js +2 -2
- package/{contract-InuLU8bI.d.ts → contract-Cvr_8gCL.d.ts} +48 -5
- package/contract.cjs +1 -1
- package/contract.d.ts +2 -2
- package/contract.js +6 -2
- package/dgram.cjs +1 -1
- package/dgram.d.ts +2 -2
- package/dgram.js +1 -1
- package/dns.cjs +1 -1
- package/dns.d.ts +1 -1
- package/dns.js +1 -1
- package/extension-B9v933cT.js +89 -0
- package/extension-D2zMdc2f.cjs +1 -0
- package/{extension-Bm5x5R4R.d.ts → extension-DMU-CwMw.d.ts} +1 -1
- package/extension.cjs +1 -1
- package/extension.d.ts +2 -2
- package/extension.js +3 -3
- package/fs/promises.cjs +1 -1
- package/fs/promises.js +1 -1
- package/{fs-D8RCGFNc.cjs → fs-CaQFRiIT.cjs} +1 -1
- package/{fs-BvNZePtN.js → fs-D3IsGdnN.js} +1 -1
- package/fs.cjs +1 -1
- package/fs.js +1 -1
- package/http.d.ts +1 -1
- package/{index-DiOxvYoa.d.ts → index-D2CA-NX5.d.ts} +6 -0
- package/index.cjs +1 -1
- package/index.d.ts +4 -4
- package/index.js +14 -14
- package/lib-BfAg9mHD.cjs +53 -0
- package/{lib-FD1Ssqjt.js → lib-C4Eeg9eM.js} +17 -12
- package/{net-DnXxFGm8.d.ts → net-zThwNoA8.d.ts} +2 -2
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +1 -1
- package/package.json +1 -1
- package/packages.cjs +1 -1
- package/packages.d.ts +1 -1
- package/packages.js +1 -1
- package/{proxy-DDwY3AVG.js → proxy-DMTdQ4dN.js} +1 -1
- package/{proxy-BkaVTZAf.d.ts → proxy-Dc0gDOxz.d.ts} +2 -2
- package/{proxy-CYcaW5ew.cjs → proxy-DjoPtJH9.cjs} +1 -1
- package/rooms.cjs +1 -1
- package/rooms.d.ts +16 -3
- package/rooms.js +111 -97
- package/{storage-dSi2dUKx.cjs → storage-BJd-mWHE.cjs} +1 -1
- package/{storage-BbcnDCnc.js → storage-DSvL-t80.js} +1 -1
- package/api-Djf-XdZ4.cjs +0 -3
- package/cloud-Beg4iCRU.cjs +0 -1
- package/extension-B7jDaJVp.cjs +0 -1
- package/extension-sNRjVbET.js +0 -89
- package/lib-DYKLnpWs.cjs +0 -53
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-BfAg9mHD.cjs"),n=require("./api-jOTOA-5n.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-D7aQY4GH.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-D2zMdc2f.cjs"),u=require("./desktop.cjs"),d=require("./fs-CaQFRiIT.cjs"),f=require("./opfs.cjs"),p=require("./packages.cjs"),m=require("./rooms.cjs"),h=require("./account.cjs"),g=require("./connect-button-BpXDs7tw.cjs");let _=require("osra");var v=1e4,y=150,b=()=>new Promise(e=>{if(t.J())return e(!0);let n,r=setTimeout(()=>i(t.J()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.J()),y)},o=new MutationObserver(()=>{t.J()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.J()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),x=(async e=>{if(t.o(e)===`window`){let n=e;return l.r()?t.a(n):i.a()?i.i(n):t.a(n)}return S(e)}),S=async e=>l.r()||e.lockdown||!i.a()||await b()?t.a(e):i.i(e),C=`https://fkn.app`,w=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let i=await n.u;if(!i)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);let a=r.t(`relayed worker`);t?.unregisterSignal?.aborted?a():t?.unregisterSignal?.addEventListener(`abort`,a,{once:!0});let o=i.emit instanceof MessagePort?{}:{originA:t?.originA??C,originB:t?.originB??`*`};(0,_.relay)(i,e,{key:`fkn-api`,...o,unregisterSignal:t?.unregisterSignal})},T=async()=>typeof window>`u`?!1:(await n.a).connect.prompt(location.origin).catch(()=>!1),E=async()=>typeof window>`u`?null:(await n.a).relay.prompt().catch(()=>null),D=new Set,O=e=>(D.add(e),()=>{D.delete(e)}),k=()=>{if(D.size===0)return!1;for(let e of[...D])try{e()}catch{}return!0},A=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},j=e.t({applyUpdate:()=>W,busyReasons:()=>U,onUpdate:()=>R,onUpdateTaken:()=>z,updateReady:()=>M}),M=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),N=new Set,P=!1,F=()=>{P=!0;for(let e of[...N])try{e()}catch{}},I=0,L=()=>{let e=n.s();e&&N.size!==0&&I!==e.epoch&&(I=e.epoch,P=!1,Promise.resolve(e.remote.shell?.onUpdate(F)).catch(()=>{I===e.epoch&&(I=0)}))};typeof window<`u`&&n.l(L);var R=async e=>{if(typeof window>`u`)return()=>{};if(N.add(e),P)try{e()}catch{}return L(),()=>{N.delete(e)}},z=e=>typeof window>`u`?()=>{}:O(e),B=0,V=!1,H=()=>{if(!k()&&!V){V=!0;try{location.reload()}catch{}}};typeof window<`u`&&n.l(()=>{let e=n.s();if(!e||B===e.epoch)return;B=e.epoch;let t=A(e.remote.shell,H);if(!t){B=0;return}t.catch(()=>{B===e.epoch&&(B=0)})});var U=()=>r.n(),W=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.CATEGORIES=t.b,exports.EXTENSION_ABI=t.Q,exports.ExtensionOperationUnsupportedError=t.$,exports.ExtensionOutdatedError=t.et,exports.FORGEABLE_HEADERS=t.U,exports.FrameWindowBlockedError=t.f,exports.FrameWindowRefusedError=t.p,exports.LOCATOR_DENIED=t.T,exports.LOCATOR_ERROR=t.k,exports.LOCATOR_UNSUPPORTED=t.x,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.tt,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t._,exports.assertFetchableUrl=t.I,exports.assertForgeableHeaders=t.W,exports.assertLockdownApplicable=t.v,exports.assertOneCookieIdentity=t.G,exports.attachFrame=x,exports.attachFramePermission=t.m,exports.box=t.it,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.P,exports.createFrame=t.h,exports.createVideoElementHandle=t.at,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return s.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return l.t}}),exports.fetch=l.n,exports.fetchCredentialedPermission=t.R,exports.fetchLocalPermission=t.z,exports.fetchPermission=t.B,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.g,exports.handleRevivableModules=t.rt,exports.hasForgedCookie=t.K,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.V,exports.isBlockedFrameUrl=t.y,exports.isExtensionExposed=t.J,exports.isLocalNetworkUrl=t.H,exports.isLocatorDenied=t.A,exports.isLocatorUnsupported=t.S,exports.isPermissionDenied=t.n,exports.isTerminalError=t.O,exports.isType=t.ot,exports.modifyRequestHeadersPermission=t.j,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return f.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return p.t}}),exports.permissions=t.r,exports.promptInstall=l.i,exports.promptRelay=E,exports.readCookiePermission=t.F,exports.readExtensionHandshake=t.Y,exports.relayWorker=w,exports.removeRequestHeaderRule=t.M,exports.revive=t.st,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.X,exports.setRequestHeaderRule=t.N,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.nt,exports.type=t.ct,exports.waitForExtensionExposure=t.Z;
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as account_d_exports } from "./account.js";
|
|
2
|
-
import { A as CATEGORIES, B as revive, C as gotoPermission, D as PermissionGrant, E as LegacyPermissionRequest, F as RemoteVideoElement, G as OperationRequest, H as Executor, I as VideoElementState, K as SelectorPart, L as box, M as PermissionCategory, N as handleRevivableModules, O as PermissionRequest, P as BoxedVideoElement, R as createVideoElementHandle, S as createFrame, T as CategoryRequest, U as Gate, V as type, W as GateTools, _ as FrameWindowRefusedError, a as AttachWindowOptions, b as WindowFrame, c as FrameBackendEvent, d as FrameEventMap, f as FrameMessageEvent, g as FrameWindowRefusal, h as FrameWindowOptions, i as AttachFrameOptions, j as CategoryMeta, k as permissions, l as FrameDocumentEvent, m as FrameWindowBlockedError, o as Frame, p as FramePostMessageOptions, r as AttachFrameFunction, s as FrameBackend, t as ATTACH_FRAME_EVENT_KEY, u as FrameEventListener, v as GotoOptions, w as CategoryGrant, x as attachFramePermission, y as Locator, z as isType } from "./index-
|
|
3
|
-
import { A as readCookiePermission, B as FORGEABLE_HEADERS, C as RequestHeaderRule, D as CookieDetails, E as setRequestHeaderRule, F as fetchCredentialedPermission, G as LOCATOR_ERROR, H as assertOneCookieIdentity, I as fetchLocalPermission, J as isLocatorUnsupported, K as LOCATOR_UNSUPPORTED, L as fetchPermission, M as ProxyFetchRequest, N as assertFetchableUrl, O as SiteCookie, R as isBlockedFetchUrl, S as HeaderOperation, T as removeRequestHeaderRule, U as hasForgedCookie, V as assertForgeableHeaders, W as LOCATOR_DENIED, Y as isTerminalError, _ as PermissionDeniedError, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PERMISSION_DENIED, h as supportsOperation, i as promptInstall, j as FetchInit, k as cookies, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as isLocatorDenied, s as readExtensionHandshake, t as extension_d_exports, u as EXTENSION_ABI, v as isPermissionDenied, w as modifyRequestHeadersPermission, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as isLocalNetworkUrl } from "./extension-
|
|
4
|
-
import { n as cloud_d_exports } from "./cloud-
|
|
2
|
+
import { A as CATEGORIES, B as revive, C as gotoPermission, D as PermissionGrant, E as LegacyPermissionRequest, F as RemoteVideoElement, G as OperationRequest, H as Executor, I as VideoElementState, K as SelectorPart, L as box, M as PermissionCategory, N as handleRevivableModules, O as PermissionRequest, P as BoxedVideoElement, R as createVideoElementHandle, S as createFrame, T as CategoryRequest, U as Gate, V as type, W as GateTools, _ as FrameWindowRefusedError, a as AttachWindowOptions, b as WindowFrame, c as FrameBackendEvent, d as FrameEventMap, f as FrameMessageEvent, g as FrameWindowRefusal, h as FrameWindowOptions, i as AttachFrameOptions, j as CategoryMeta, k as permissions, l as FrameDocumentEvent, m as FrameWindowBlockedError, o as Frame, p as FramePostMessageOptions, r as AttachFrameFunction, s as FrameBackend, t as ATTACH_FRAME_EVENT_KEY, u as FrameEventListener, v as GotoOptions, w as CategoryGrant, x as attachFramePermission, y as Locator, z as isType } from "./index-D2CA-NX5.js";
|
|
3
|
+
import { A as readCookiePermission, B as FORGEABLE_HEADERS, C as RequestHeaderRule, D as CookieDetails, E as setRequestHeaderRule, F as fetchCredentialedPermission, G as LOCATOR_ERROR, H as assertOneCookieIdentity, I as fetchLocalPermission, J as isLocatorUnsupported, K as LOCATOR_UNSUPPORTED, L as fetchPermission, M as ProxyFetchRequest, N as assertFetchableUrl, O as SiteCookie, R as isBlockedFetchUrl, S as HeaderOperation, T as removeRequestHeaderRule, U as hasForgedCookie, V as assertForgeableHeaders, W as LOCATOR_DENIED, Y as isTerminalError, _ as PermissionDeniedError, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PERMISSION_DENIED, h as supportsOperation, i as promptInstall, j as FetchInit, k as cookies, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as isLocatorDenied, s as readExtensionHandshake, t as extension_d_exports, u as EXTENSION_ABI, v as isPermissionDenied, w as modifyRequestHeadersPermission, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as isLocalNetworkUrl } from "./extension-DMU-CwMw.js";
|
|
4
|
+
import { n as cloud_d_exports } from "./cloud-5eldoFxK.js";
|
|
5
5
|
import { t as dns_d_exports } from "./dns.js";
|
|
6
6
|
import { u as index_d_exports } from "./index-kuPqkS_-.js";
|
|
7
|
-
import { s as net_d_exports } from "./net-
|
|
7
|
+
import { s as net_d_exports } from "./net-zThwNoA8.js";
|
|
8
8
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
9
9
|
import { t as http_d_exports } from "./http.js";
|
|
10
10
|
import { t as desktop_d_exports } from "./desktop.js";
|
package/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { $ as t, A as n, B as r,
|
|
3
|
-
import { a as B, l as V, s as H, u as fe } from "./api-
|
|
2
|
+
import { $ as t, A as n, B as r, F as i, G as a, H as o, I as s, J as c, K as l, M as ee, N as te, O as ne, P as re, Q as ie, R as ae, S as oe, T as se, U as u, V as d, W as ce, X as le, Y as ue, Z as de, _ as f, a as p, at as m, b as h, ct as g, et as _, f as v, g as y, h as b, i as x, it as S, j as C, k as w, m as T, n as E, nt as D, o as O, ot as k, p as A, r as j, rt as M, st as N, t as P, tt as F, v as I, x as L, y as R, z } from "./lib-C4Eeg9eM.js";
|
|
3
|
+
import { a as B, l as V, s as H, u as fe } from "./api-Dp-2AT3u.js";
|
|
4
4
|
import { n as pe, t as me } from "./busy-B189uX--.js";
|
|
5
|
-
import { a as U, i as W, n as he } from "./cloud-
|
|
5
|
+
import { a as U, i as W, n as he } from "./cloud-BLv19j-W.js";
|
|
6
6
|
import { t as ge } from "./dns.js";
|
|
7
7
|
import { t as _e } from "./net.js";
|
|
8
8
|
import { t as ve } from "./dgram.js";
|
|
9
9
|
import { t as G } from "./http.js";
|
|
10
|
-
import { i as ye, n as be, r as K, t as xe } from "./extension-
|
|
10
|
+
import { i as ye, n as be, r as K, t as xe } from "./extension-B9v933cT.js";
|
|
11
11
|
import { t as Se } from "./desktop.js";
|
|
12
|
-
import { u as Ce } from "./fs-
|
|
12
|
+
import { u as Ce } from "./fs-D3IsGdnN.js";
|
|
13
13
|
import { t as we } from "./opfs.js";
|
|
14
14
|
import { t as Te } from "./packages.js";
|
|
15
15
|
import { t as Ee } from "./rooms.js";
|
|
@@ -18,27 +18,27 @@ import { t as Oe } from "./connect-button-DtsN3X1J.js";
|
|
|
18
18
|
import { relay as ke } from "osra";
|
|
19
19
|
//#region src/frame.ts
|
|
20
20
|
var Ae = 1e4, je = 150, Me = () => new Promise((e) => {
|
|
21
|
-
if (
|
|
22
|
-
let t, n = setTimeout(() => r(
|
|
21
|
+
if (c()) return e(!0);
|
|
22
|
+
let t, n = setTimeout(() => r(c()), Ae), r = (r) => {
|
|
23
23
|
clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", o), e(r);
|
|
24
24
|
}, i = () => {
|
|
25
|
-
clearTimeout(t), t = setTimeout(() => r(
|
|
25
|
+
clearTimeout(t), t = setTimeout(() => r(c()), je);
|
|
26
26
|
}, a = new MutationObserver(() => {
|
|
27
|
-
|
|
27
|
+
c() && r(!0);
|
|
28
28
|
}), o = () => {
|
|
29
|
-
document.readyState === "complete" && !
|
|
29
|
+
document.readyState === "complete" && !c() && i();
|
|
30
30
|
};
|
|
31
31
|
a.observe(document.documentElement, {
|
|
32
32
|
attributes: !0,
|
|
33
33
|
attributeFilter: ["data-fkn-extension"]
|
|
34
34
|
}), document.addEventListener("readystatechange", o), document.readyState === "complete" && i();
|
|
35
35
|
}), Ne = (async (e) => {
|
|
36
|
-
if (
|
|
36
|
+
if (O(e) === "window") {
|
|
37
37
|
let t = e;
|
|
38
|
-
return K() ?
|
|
38
|
+
return K() ? p(t) : U() ? W(t) : p(t);
|
|
39
39
|
}
|
|
40
40
|
return Pe(e);
|
|
41
|
-
}), Pe = async (e) => K() || e.lockdown || !U() || await Me() ?
|
|
41
|
+
}), Pe = async (e) => K() || e.lockdown || !U() || await Me() ? p(e) : W(e), Fe = "https://fkn.app", Ie = async (e, t) => {
|
|
42
42
|
if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
|
|
43
43
|
let n = await fe;
|
|
44
44
|
if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
|
|
@@ -112,4 +112,4 @@ typeof window < "u" && V(() => {
|
|
|
112
112
|
});
|
|
113
113
|
var Je = () => pe(), Ye = async () => typeof window > "u" ? !1 : B.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
|
|
114
114
|
//#endregion
|
|
115
|
-
export {
|
|
115
|
+
export { x as ATTACH_FRAME_EVENT_KEY, h as CATEGORIES, ie as EXTENSION_ABI, t as ExtensionOperationUnsupportedError, _ as ExtensionOutdatedError, u as FORGEABLE_HEADERS, v as FrameWindowBlockedError, A as FrameWindowRefusedError, se as LOCATOR_DENIED, w as LOCATOR_ERROR, L as LOCATOR_UNSUPPORTED, P as PERMISSION_DENIED, F as REQUIRED_EXTENSION_ABI, De as account, f as assertAttachableFrameUrl, s as assertFetchableUrl, ce as assertForgeableHeaders, I as assertLockdownApplicable, a as assertOneCookieIdentity, Ne as attachFrame, T as attachFramePermission, S as box, he as cloud, Le as connect, Oe as connectButtonUrl, re as cookies, b as createFrame, m as createVideoElementHandle, Se as desktop, ve as dgram, ge as dns, xe as extension, be as fetch, ae as fetchCredentialedPermission, z as fetchLocalPermission, r as fetchPermission, Ce as fs, y as gotoPermission, M as handleRevivableModules, l as hasForgedCookie, G as http, d as isBlockedFetchUrl, R as isBlockedFrameUrl, c as isExtensionExposed, o as isLocalNetworkUrl, n as isLocatorDenied, oe as isLocatorUnsupported, E as isPermissionDenied, ne as isTerminalError, k as isType, C as modifyRequestHeadersPermission, _e as net, we as opfs, Te as packages, j as permissions, ye as promptInstall, Re as promptRelay, i as readCookiePermission, ue as readExtensionHandshake, Ie as relayWorker, ee as removeRequestHeaderRule, N as revive, Ee as rooms, le as setMissingExtensionHandler, te as setRequestHeaderRule, He as shell, D as supportsOperation, g as type, de as waitForExtensionExposure };
|
package/lib-BfAg9mHD.cjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./hosts-9dYv63ud.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=3,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,fe=(e,t)=>e.status===`ok`&&e.operations!==null&&e.operations.includes(t),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}},E=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`,D=()=>typeof document>`u`?{status:`absent`}:ue(document.documentElement.dataset),O=null,_e=e=>{O=e},ve=150,k=(e=1e3)=>new Promise((t,n)=>{let r=()=>D().status===`ok`;if(r())return t();let i,a=e=>{clearTimeout(i),c.disconnect(),document.removeEventListener(`readystatechange`,l),e()},o=()=>a(async()=>{let e=D();if(e.status===`outdated`)return n(new T(e.abi,e.required));if(O){if(await O().catch(()=>{}),r())return t();let e=D();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,A=new Proxy({},{get:(e,t)=>async(...e)=>{await k(),ye??=(0,n.expose)({},{transport:window,revivableModules:w});let r=(await ye)[t];return r(...e)}}),j=[`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=>!j.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=j.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 A.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})},Ie={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.`},Le={get:e=>A.getCookie(e)},Re={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.`},ze=e=>A.setRequestHeaderRule(e),Be=e=>A.removeRequestHeaderRule({ruleId:e}),Ve=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}},He=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 Ue=(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=Ue(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=Ue(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 We=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(`;`)}},Ge=(e,t)=>{t||={};let n=1,r=1;function i(){let e={line:n,column:r};return i=>(i.position=new He(e,{line:n,column:r},t?.source||``),u(),i)}let a=[];function o(i){let o=new Ve(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}}}())},Ke=(e,t)=>new We(t||{}).compile(e),qe=Object.defineProperty,Je=(e,t)=>{let n={};for(var r in e)qe(n,r,{get:e[r],enumerable:!0});return t||qe(n,Symbol.toStringTag,{value:`Module`}),n},Ye=`LocatorError`,L=`LocatorUnsupportedError`,R=`LocatorDeniedError`,Xe=`LocatorInvalidError`,z=e=>typeof e==`object`&&e?e.name:void 0,B=e=>Object.assign(Error(e),{name:Ye}),V=(e,t=``,n)=>Object.assign(Error(e),{name:L,operation:t,backend:n}),Ze=(e,t)=>V(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),H=(e,t)=>Object.assign(Error(e),{name:R,operation:t}),U=(e,t)=>Object.assign(Error(e),{name:Xe,operation:t}),Qe=e=>z(e)===L,$e=e=>z(e)===R,et=e=>z(e)===Xe,tt=e=>$e(e)||Qe(e)||et(e),W=e=>{let t=(e.ownerDocument??e).defaultView;if(!t)throw B(`the resolved element belongs to a document with no window`);return t},nt=(e,t)=>{let n=e?.[t];return typeof n==`function`?n:null},G=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=(()=>{try{return nt(W(e),t)}catch{return null}})();if(n&&e instanceof n)return n;let r=nt(globalThis,t);return r&&e instanceof r?r:null},K=(e,t)=>G(e,t)!==null,q=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]},rt=(e,t)=>{if(!K(e,t))throw B(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);return e},it=e=>e.tagName.toLowerCase(),at=new Set,ot=e=>{at.add(e)},st=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,ct=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),lt=e=>!st.test(ct(e.value)),ut=new Set([M.import,M.fontFace,M.namespace,M.charset,M.document,M.comment]),dt=e=>{if(ut.has(e.type))return null;if(e.type===M.declaration)return lt(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=ft(r))}return n},ft=e=>e.map(e=>dt(e)).filter(e=>e!==null),pt=e=>{let t;try{t=Ge(e,{silent:!0})}catch{return``}return t.stylesheet.rules=ft(t.stylesheet.rules),Ke(t)},mt=(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)},ht={resolve:(e,t)=>{let n=e.document.createElement(`style`);n.textContent=t.noSanitize?t.content:pt(t.content);try{mt(e.document,n)}catch(e){console.error(e)}ot(n)}},gt=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},J={kind:`frame`,ensureArgs:e=>[void 0,e],resolve:async(e,t,n={})=>{if(typeof t!=`string`)throw U(`fetch: url must be a string`,`fetch`);let r=W(e.document),i;try{i=new r.URL(t,e.document.baseURI).href}catch{throw U(`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:gt(a.headers),body:await a.arrayBuffer()}}},Y=Je({click:()=>vt,count:()=>Et,exists:()=>Dt,fill:()=>St,getAttribute:()=>wt,hover:()=>yt,isVisible:()=>Tt,textContent:()=>Ct}),_t=(e,t)=>{let n=e.getBoundingClientRect();return{clientX:n.left+n.width*(t?.x??.5),clientY:n.top+n.height*(t?.y??.5)}},vt={resolve:(e,t={})=>{let n=q(e.elements),r=W(n),i={bubbles:!0,cancelable:!0,composed:!0,..._t(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}))}},yt={resolve:(e,t={})=>{let n=q(e.elements),r=W(n),i={bubbles:!0,cancelable:!0,composed:!0,..._t(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))}},bt=(e,t)=>{e._valueTracker?.setValue(``);let n=(G(e,`HTMLTextAreaElement`)??G(e,`HTMLInputElement`))?.prototype,r=n&&Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t},xt=(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}}},St={resolve:(e,t,n={})=>{let r=q(e.elements),i=W(r),a=K(r,`HTMLInputElement`);if(a||K(r,`HTMLTextAreaElement`)){let e=r,n=a?xt(e,t):null;n&&(r.dispatchEvent(new i.PointerEvent(`pointerdown`,n.pointerDown)),r.dispatchEvent(new i.MouseEvent(`mousedown`,n.mouseDown))),bt(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(K(r,`HTMLElement`)&&r.isContentEditable){r.textContent=t,r.dispatchEvent(new i.Event(`input`,{bubbles:!0}));return}throw Error(`fill: element <${it(r)}> is not fillable`)}},Ct={resolve:(e,t={})=>q(e.elements).textContent},wt={resolve:(e,t,n={})=>q(e.elements).getAttribute(t)},Tt={resolve:(e,t={})=>{let n=q(e.elements);if(!K(n,`HTMLElement`))return!0;let r=W(n).getComputedStyle(n);if(r?.display===`none`||r?.visibility===`hidden`)return!1;let i=n.getBoundingClientRect();return i.width>0&&i.height>0}},Et={resolve:(e,t={})=>e.elements.length},Dt={resolve:(e,t={})=>e.elements.length>0},X=(e,t)=>e.elements.flatMap(e=>[...e.querySelectorAll(t)]),Z=e=>e.replaceAll(`"`,`\\"`),Ot={to:`element`,css:!0,resolve:(e,t)=>X(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`descend`})},kt={to:`frame`,css:!0,barrier:`down`,resolve:(e,t)=>X(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`down`})},At={element:{selectors:{locator:Ot,frameLocator:kt,getByRole:{to:`element`,resolve:(e,t)=>X(e,`[role="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[role="${Z(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("${Z(e)}")`:`:has-text(...)`})},getByTestId:{to:`element`,resolve:(e,t)=>X(e,`[data-testid="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[data-testid="${Z(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:vt,fill:St,hover:yt,textContent:Ct,getAttribute:wt,isVisible:Tt,count:Et,exists:Dt}},frame:{selectors:{locator:Ot,frameLocator:kt,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:ht,fetch:J}}},jt=(e,t=At)=>({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}}}),Mt=3e4,Nt=50,Pt=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},Ft=e=>{let t=Pt(e)?.timeout;return typeof t==`number`?t:Mt},It=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),Lt=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,It(e))},Rt=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`},It(e));let o=Ft(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(tt(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(Nt,t)))}}finally{clearTimeout(d)}throw f},zt=(e,t,n,r)=>{let i={};for(let[a,o]of Object.entries(t[n].selectors))i[a]=(...i)=>zt(e,t,o.to,[...r,{kind:n,name:a,args:i}]);for(let a of Object.keys(t[n].operations))i[a]=(...t)=>Rt({...e,parts:r,operation:a,args:t});return i.ensure=(i,a={})=>{let o=t[n].operations[i]?.ensureArgs;return Lt({...e,parts:r,operation:i,args:o?.(a)??[a]})},i},Bt=e=>zt(e,e.modules??At,`frame`,[]),Vt=()=>{let e=D();return e.status===`ok`&&e.abi>=2},Ht=async()=>{await k();let e=D();if(e.status===`ok`&&e.abi<2)throw new T(e.abi,2)},Ut=e=>`Read the text, links and details ${e} shows.`,Wt=e=>`Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`,Gt=[{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=>`Click and type on ${e}`,cloudDescription:e=>`Clicks, types and scrolls on ${e} for you.`},{id:`storage`,heading:`Site data`,summary:`Can read the website's data`,title:e=>`Read data from ${e}`,description:Ut,cloudTitle:e=>`Read what's on ${e}`,cloudDescription:Ut},{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=>`Load and send data on ${e}`,cloudDescription:e=>`Loads pages and data from ${e} and sends changes there.`},{id:`evaluation`,heading:`Evaluation`,summary:`Can execute arbitrary code on the website`,title:e=>`Run code on ${e}`,description:Wt,cloudTitle:e=>`Run its own code on ${e}`,cloudDescription:Wt}],Kt=jt({element:{operations:{click:{resolve:(e,t={})=>Y.click.resolve(e,t)},hover:{resolve:(e,t={})=>Y.hover.resolve(e,t)},fill:{resolve:(e,t,n={})=>Y.fill.resolve(e,t,n)},textContent:{resolve:(e,t={})=>Y.textContent.resolve(e)},getAttribute:{resolve:(e,t,n={})=>Y.getAttribute.resolve(e,t)},isVisible:{resolve:(e,t={})=>Y.isVisible.resolve(e)},count:{resolve:(e,t={})=>Y.count.resolve(e)},exists:{resolve:(e,t={})=>Y.exists.resolve(e)},videoElement:{resolve:(e,t={})=>b(rt(q(e.elements),`HTMLVideoElement`))}}},frame:{operations:{addStyleTag:{resolve:(e,t)=>ht.resolve(e,t)},fetch:{resolve:(e,t,n={})=>J.resolve(e,t,n),kind:J.kind,ensureArgs:J.ensureArgs},evaluate:{kind:`frame`,resolve:(e,t,n)=>{throw Ze(`evaluate`,`this realm`)}}}}}),qt=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)},Q=e=>{if(qt(e))throw Error(`attachFrame: refusing to target the extension's own pages or an FKN platform origin`)},Jt=({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`)},Yt={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.`},Xt={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.`},Zt=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`)}},Qt=new Set([`jar-unreachable`,`bad-url`,`opaque-opener`]),$t=class extends Error{name=`FrameWindowRefusedError`;reason;constructor(e){let t=Qt.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}},en=[`message`,`document`],tn=e=>{if(e===`*`)return`*`;let t=()=>TypeError(`frame.postMessage: targetOrigin must be '*' or an origin, not ${JSON.stringify(e)}`);if(typeof e!=`string`)throw t();let n;try{n=new URL(e).origin}catch{throw t()}if(n===`null`)throw t();return n},nn=(e,t)=>{let n=typeof e==`object`&&!!e;if(n&&t!==void 0)throw TypeError(`frame.postMessage: pass transfer inside the options object, not after it`);let r=n?e.targetOrigin??`*`:e??`*`,i=n?e.transfer:t;if(i!==void 0&&!Array.isArray(i))throw TypeError(`frame.postMessage: transfer must be an array`);return{targetOrigin:tn(r),transfer:i===void 0?[]:[...i]}},rn=e=>{typeof globalThis.reportError==`function`?globalThis.reportError(e):console.error(e)},an=e=>{let t=Bt({executor:e.executor,modules:Kt,gate:e.gate}),n=(t,n={})=>(Q(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)},a=async(t,n)=>{let r=e.evaluate;if(!r)throw Error(`frame.evaluate: this backend cannot run code in the attached frame`);let i=typeof t==`function`?t.toString():t;if(typeof i!=`string`)throw TypeError(`frame.evaluate: pass a function or a source string`);return r(i,n)},o=((t,n,r)=>{try{let i=e.postMessage;if(!i)throw Error(`frame.postMessage: this backend cannot message the attached frame`);let a=nn(n,r);return i(t,a.targetOrigin,a.transfer)}catch(e){return Promise.reject(e)}}),s={message:new Set,document:new Set},c=null,l=(e,t)=>{if(!en.includes(e))throw TypeError(`frame.${t}: the event type must be ${en.map(e=>`'${e}'`).join(` or `)}, not ${JSON.stringify(e)}`);return s[e]},u=e=>{let t=e.type===`message`?Object.freeze({type:`message`,data:e.data,origin:e.origin,ports:Object.freeze([...e.ports]),source:p}):Object.freeze({type:`document`,origin:e.origin});for(let n of[...s[e.type]])try{n(t)}catch(e){rn(e)}},d=(e,t)=>{if(l(e,`removeEventListener`).delete(t),c!==null&&!s.message.size&&!s.document.size){let e=c;c=null,e()}},f=(t,n,r={})=>{let i=l(t,`addEventListener`);if(typeof n!=`function`)throw TypeError(`frame.addEventListener: the listener must be a function`);let{signal:a}=r;if(!(a?.aborted||i.has(n))){if(c===null){let t=e.listen;if(!t)throw Error(`frame.addEventListener: this backend cannot relay the page's messages`);c=t(u)}i.add(n),a?.addEventListener(`abort`,()=>d(t,n),{once:!0})}},p={...t,goto:n,url:r,request:i,evaluate:a,postMessage:o,addEventListener:f,removeEventListener:d};return p},on=[t.v,t._,t.y,t.h,t.g,t.n,t.i,t.r,t.f,t.a,t.o,t.s,t.p,Yt,Xt,t.u,t.d,De,Oe,ke,Ie,Re],sn=Gt.map(e=>e.id),cn={interaction:`act.click`,storage:`read.text`,network:`network.fetchCredentialed`,evaluation:`media.appearU`},ln=e=>e===0?`auto`:e===4?`critical`:`bundled`,un=on,$=new Map,dn={};(()=>{$=new Map(un.map(e=>[e.scope,e])),dn=Object.fromEntries($),un.filter(e=>e.severity===4).map(e=>e.scope);let e=e=>un.filter(t=>t.category===e&&ln(t.severity)===`bundled`);Object.fromEntries(sn.map(t=>[t,Math.max(0,...e(t).map(e=>e.severity))])),Object.fromEntries(sn.map(t=>[t,e(t).some(e=>e.unsafe===!0)]))})();var fn=e=>$.get(e)?.category,pn=e=>{let t=$.get(e);return t&&ln(t.severity)},mn=e=>{let t=$.get(e);if(t)return ln(t.severity)===`critical`?t.scope:t.category},hn=e=>cn[e],gn=({category:e,key:t})=>{let n=t??(e&&hn(e));return n!==void 0&&fn(n)!==void 0?n:void 0},_n=(e,t)=>{for(let{category:n,key:r}of t)if(gn({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}"`)},vn=(e,t={})=>{let n=[],r=e.map(e=>{let r=gn(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&&pn(r)===`critical`?r:void 0,category:r===void 0?e.category??`interaction`:dn[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)}))}},yn=e=>typeof e==`object`&&!!e,bn=typeof chrome<`u`&&!!chrome.runtime?.id,xn=e=>yn(e)&&e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY===!0&&typeof e.frameId==`string`&&typeof e.document==`string`,Sn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,Tn=new Set;typeof window<`u`&&bn&&window.addEventListener(`message`,e=>{if(!xn(e.data))return;e.stopImmediatePropagation();let t=e.source;if(!t||typeof t!=`object`)return;let n=t,r=Sn.get(n),i=e.data.frameId,a=e.data.document;if(Sn.set(n,i),Cn.set(n,a),r)for(let e of Tn)e(r);let o=wn.get(n);if(o){for(let e of[...o])(e.notDocument===void 0||e.notDocument!==a)&&(o.delete(e),e.resolve(i));o.size||wn.delete(n)}},{capture:!0});var En=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`},Dn=(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)},On=({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&&Q(r),{url:r,width:Dn(t,500,`width`),height:Dn(n,700,`height`)}},kn=e=>{try{return new URL(e).hostname}catch{return``}},An=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,jn=!1,Mn=()=>{jn||(jn=!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.`))},Nn=`frame: this frame no longer holds the document the app attached it to`,Pn=`frame.postMessage: '*' is not served on the extension yet, since this extension does not report the frame's origin; pass the page's origin as targetOrigin`,Fn=()=>{let e=D();if(e.status===`ok`&&e.abi>=1)return;let t=e.status===`absent`?0:e.abi;throw new E(`lockdown`,t,`attachFrame: the installed FKN WebExtension (ABI ${t}) may predate lockdown, and one that does attaches the frame with its CSP removed rather than locked down. Updating the extension fixes this.`)},In=e=>{try{return new URL(e,location.href).hostname}catch{return``}},Ln=async({iframe:e,domains:n=[],syncCookies:r=!0,lockdown:i=!1,permissions:a})=>{let o=crypto.randomUUID();if(Q(e.src),Jt({src:e.src,domains:n,lockdown:i}),await k(),i&&Fn(),!e.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);e.dispatchEvent(new CustomEvent(An,{detail:o}));let{executeLocator:s,highlightLocator:c,ensureLocatorPermission:l,requestCategories:u,evaluateFrame:d,goto:f}=await A.attachFrame({marker:o,domains:n,syncCookies:r,lockdown:i}),p=new Set(t.t([...n,In(e.src)],{ipv6:!0})),m=e=>p.has(t.t([kn(e)],{ipv6:!0})[0]??``),h=an({executor:{execute:s,highlight:c},gate:e=>l(e.parts,e.operation,e.args),request:async e=>(_n(`frame.request`,e),await Ht(),u(e)),evaluate:async(e,t)=>{if(!fe(D(),`evaluate`)){let e=D();throw new E(`evaluate`,e.status===`ok`?e.abi:0)}return d({source:e,arg:t})},postMessage:(t,n,r)=>{if(n===`*`)throw V(Pn,`postMessage`,`extension`);if(!m(n))throw H(Nn,`postMessage`);let i=e.contentWindow;if(i===null)throw H(`frame: navigate the frame before postMessage`,`postMessage`);return i.postMessage(t,n,r),Promise.resolve()},listen:t=>{let n=n=>{n.source!==null&&n.source===e.contentWindow&&!xn(n.data)&&m(n.origin)&&t({type:`message`,data:n.data,origin:n.origin,ports:n.ports})},r=()=>t({type:`document`,origin:``});return window.addEventListener(`message`,n),e.addEventListener(`load`,r),()=>{window.removeEventListener(`message`,n),e.removeEventListener(`load`,r)}},goto:(e,n={})=>{for(let n of t.t([In(e)],{ipv6:!0}))p.add(n);return f({url:e,...n})},url:()=>e.src});return a?.length&&(Vt()?await h.request(a):Mn()),h},Rn=`attachFrame: window mode is served by the cloud backend for now, whatever extension is installed. Use cloud.attachFrame({ window })`,zn=async e=>{if(On(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=D();throw new E(`attachWindow`,t.status===`absent`?0:t.abi,Rn)},Bn=(async e=>En(e)===`window`?zn(e):Ln(e)),Vn=`permissions.request: pass hosts, the sites the grant applies to`,Hn={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(Vn);return{ask:{category:n,key:r,reason:a,hosts:s}}}),r=n.flatMap(e=>`ask`in e?[e.ask]:[]);_n(`permissions.request`,r),r.length&&await Ht();let{items:i,answer:a}=vn(r),o=n.flatMap(e=>`legacy`in e?[e.legacy]:[]),s=[...i,...o],c=s.length?await A.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++])}},Un=`PermissionDeniedError`,Wn=e=>e instanceof Error?e.name===Un:yn(e)&&e.name===`PermissionDeniedError`;Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Bn}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return an}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return An}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Wn}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return En}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Hn}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return On}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Un}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return ke}});
|
|
@@ -1838,7 +1838,7 @@ var jn = (e) => $.get(e)?.category, Mn = (e) => {
|
|
|
1838
1838
|
});
|
|
1839
1839
|
return {
|
|
1840
1840
|
key: r !== void 0 && Mn(r) === "critical" ? r : void 0,
|
|
1841
|
-
category:
|
|
1841
|
+
category: r === void 0 ? e.category ?? "interaction" : An[r].category,
|
|
1842
1842
|
hosts: e.hosts,
|
|
1843
1843
|
indexes: i
|
|
1844
1844
|
};
|
|
@@ -1906,26 +1906,31 @@ var Gn = (e) => {
|
|
|
1906
1906
|
}
|
|
1907
1907
|
}, Yn = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY", Xn = !1, Zn = () => {
|
|
1908
1908
|
Xn || (Xn = !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."));
|
|
1909
|
-
}, Qn = "frame: this frame no longer holds the document the app attached it to", $n = "frame.postMessage: '*' is not served on the extension yet, since this extension does not report the frame's origin; pass the page's origin as targetOrigin", er = (
|
|
1909
|
+
}, Qn = "frame: this frame no longer holds the document the app attached it to", $n = "frame.postMessage: '*' is not served on the extension yet, since this extension does not report the frame's origin; pass the page's origin as targetOrigin", er = () => {
|
|
1910
|
+
let e = D();
|
|
1911
|
+
if (e.status === "ok" && e.abi >= 1) return;
|
|
1912
|
+
let t = e.status === "absent" ? 0 : e.abi;
|
|
1913
|
+
throw new E("lockdown", t, `attachFrame: the installed FKN WebExtension (ABI ${t}) may predate lockdown, and one that does attaches the frame with its CSP removed rather than locked down. Updating the extension fixes this.`);
|
|
1914
|
+
}, tr = (e) => {
|
|
1910
1915
|
try {
|
|
1911
1916
|
return new URL(e, location.href).hostname;
|
|
1912
1917
|
} catch {
|
|
1913
1918
|
return "";
|
|
1914
1919
|
}
|
|
1915
|
-
},
|
|
1920
|
+
}, nr = async ({ iframe: e, domains: t = [], syncCookies: n = !0, lockdown: r = !1, permissions: i }) => {
|
|
1916
1921
|
let a = crypto.randomUUID();
|
|
1917
1922
|
if (Z(e.src), hn({
|
|
1918
1923
|
src: e.src,
|
|
1919
1924
|
domains: t,
|
|
1920
1925
|
lockdown: r
|
|
1921
|
-
}), await O(), !e.isConnected) throw Error("attachFrame: the iframe must be connected to the document before attaching");
|
|
1926
|
+
}), await O(), r && er(), !e.isConnected) throw Error("attachFrame: the iframe must be connected to the document before attaching");
|
|
1922
1927
|
e.dispatchEvent(new CustomEvent(Yn, { detail: a }));
|
|
1923
1928
|
let { executeLocator: o, highlightLocator: s, ensureLocatorPermission: c, requestCategories: l, evaluateFrame: u, goto: d } = await k.attachFrame({
|
|
1924
1929
|
marker: a,
|
|
1925
1930
|
domains: t,
|
|
1926
1931
|
syncCookies: n,
|
|
1927
1932
|
lockdown: r
|
|
1928
|
-
}), f = new Set(p([...t,
|
|
1933
|
+
}), f = new Set(p([...t, tr(e.src)], { ipv6: !0 })), m = (e) => f.has(p([Jn(e)], { ipv6: !0 })[0] ?? ""), h = Tn({
|
|
1929
1934
|
executor: {
|
|
1930
1935
|
execute: o,
|
|
1931
1936
|
highlight: s
|
|
@@ -1966,7 +1971,7 @@ var Gn = (e) => {
|
|
|
1966
1971
|
};
|
|
1967
1972
|
},
|
|
1968
1973
|
goto: (e, t = {}) => {
|
|
1969
|
-
for (let t of p([
|
|
1974
|
+
for (let t of p([tr(e)], { ipv6: !0 })) f.add(t);
|
|
1970
1975
|
return d({
|
|
1971
1976
|
url: e,
|
|
1972
1977
|
...t
|
|
@@ -1975,11 +1980,11 @@ var Gn = (e) => {
|
|
|
1975
1980
|
url: () => e.src
|
|
1976
1981
|
});
|
|
1977
1982
|
return i?.length && (cn() ? await h.request(i) : Zn()), h;
|
|
1978
|
-
},
|
|
1983
|
+
}, rr = "attachFrame: window mode is served by the cloud backend for now, whatever extension is installed. Use cloud.attachFrame({ window })", ir = async (e) => {
|
|
1979
1984
|
if (qn(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");
|
|
1980
1985
|
let t = D();
|
|
1981
|
-
throw new E("attachWindow", t.status === "absent" ? 0 : t.abi,
|
|
1982
|
-
},
|
|
1986
|
+
throw new E("attachWindow", t.status === "absent" ? 0 : t.abi, rr);
|
|
1987
|
+
}, ar = (async (e) => Gn(e) === "window" ? ir(e) : nr(e)), or = "permissions.request: pass hosts, the sites the grant applies to", sr = { request: async (e) => {
|
|
1983
1988
|
let t = e.map((e) => {
|
|
1984
1989
|
let { category: t, key: n, scope: r, reason: i, hosts: a } = e;
|
|
1985
1990
|
if (!("hosts" in e) && !("category" in e)) return { legacy: {
|
|
@@ -1988,7 +1993,7 @@ var Gn = (e) => {
|
|
|
1988
1993
|
reason: i
|
|
1989
1994
|
} };
|
|
1990
1995
|
let o = p(a ?? [], { ipv6: !0 });
|
|
1991
|
-
if (!o.length) throw TypeError(
|
|
1996
|
+
if (!o.length) throw TypeError(or);
|
|
1992
1997
|
return { ask: {
|
|
1993
1998
|
category: t,
|
|
1994
1999
|
key: n,
|
|
@@ -1999,6 +2004,6 @@ var Gn = (e) => {
|
|
|
1999
2004
|
In("permissions.request", n), n.length && await ln();
|
|
2000
2005
|
let { items: r, answer: i } = Ln(n), a = t.flatMap((e) => "legacy" in e ? [e.legacy] : []), o = [...r, ...a], s = o.length ? await k.requestPermissions(o) : [], c = i(s.slice(0, r.length)), l = s.slice(r.length), u = 0, d = 0;
|
|
2001
2006
|
return t.map((e) => "ask" in e ? c[u++] : l[d++]);
|
|
2002
|
-
} },
|
|
2007
|
+
} }, cr = "PermissionDeniedError", lr = (e) => e instanceof Error ? e.name === cr : Rn(e) && e.name === "PermissionDeniedError";
|
|
2003
2008
|
//#endregion
|
|
2004
|
-
export {
|
|
2009
|
+
export { E as $, yt as A, qe as B, H as C, B as D, _t as E, nt as F, He as G, Ze as H, $e as I, Fe as J, Ve as K, tt as L, ot as M, at as N, xt as O, rt as P, xe as Q, Je as R, vt as S, L as T, A as U, Qe as V, Ue as W, Le as X, D as Y, O as Z, Z as _, ar as a, w as at, fn as b, In as c, S as ct, Mn as d, T as et, vn as f, _n as g, Tn as h, Yn as i, ve as it, it as j, ht as k, jn as l, gn as m, lr as n, Ae as nt, Gn as o, _e as ot, bn as p, Pe as q, sr as r, be as rt, qn as s, ye as st, cr as t, Se as tt, Nn as u, hn as v, V as w, I as x, mn as y, Ye as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as TcpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import {
|
|
3
|
-
import "./api-
|
|
2
|
+
import { St as TcpSocketResult, U as Resolvers, bt as TcpSocketListenerResult } from "./contract-Cvr_8gCL.js";
|
|
3
|
+
import "./api-BE5zPvFZ.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-jOTOA-5n.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-zThwNoA8.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-Dp-2AT3u.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";
|
package/package.json
CHANGED
package/packages.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-jOTOA-5n.cjs"),n=require("./busy-Dv8wzE5M.cjs");let r=require("osra");var i=e.t({attach:()=>j,connect:()=>T,hide:()=>w,install:()=>p,isVisible:()=>G,list:()=>m,mount:()=>A,onConnect:()=>W,onVisibilityChange:()=>K,pick:()=>f,search:()=>d,show:()=>C,uninstall:()=>h}),a=`fkn-packages-connection`,o=3e4,s=(e,t)=>Object.assign(Error(t),{code:e}),c=async()=>{if(!t.c)throw s(`unavailable`,`packages: no FKN transport in this realm - use relayWorker to bridge workers`);return t.a},l=(e,t,n)=>(0,r.expose)(e??{},{transport:t,key:a,unregisterSignal:n}),u=async(e,t,n={})=>{let{signal:r,closed:i}=n;if(r?.aborted)throw s(`unavailable`,`packages.connect: aborted before connecting`);let a=new AbortController;r&&r.addEventListener(`abort`,()=>a.abort(r.reason),{once:!0});let c=new AbortController,u=new Promise((e,n)=>{let a=setTimeout(()=>n(s(`timeout`,`packages.connect: the package did not complete the connection`)),o);c.signal.addEventListener(`abort`,()=>clearTimeout(a),{once:!0}),t.addEventListener(`message`,e=>{if(e.data?.type===`fkn-packages-nack`){let t=e.data.message;n(s(`unavailable`,typeof t==`string`&&t?t:`packages.connect: the package refused the connection`))}},{signal:c.signal}),t.start(),r&&r.addEventListener(`abort`,()=>n(s(`unavailable`,`packages.connect: aborted before connecting`)),{once:!0,signal:c.signal}),i?.then(()=>n(s(`unavailable`,`packages.connect: the package closed before connecting`)))});try{return await Promise.race([l(e,t,a.signal),u])}catch(e){a.abort(e);try{t.close()}catch{}throw e}finally{c.abort()}},d=async e=>{let t=await(await c()).packages.search(e);if(`error`in t)throw s(t.error,t.message);return t.results},f=async(e,t)=>{let n=await(await c()).packages.pick(e,t);if(`error`in n)throw s(n.error,n.message);return`declined`in n?[]:n.results},p=async(e,t)=>{let n=await(await c()).packages.install(e,t);if(`error`in n)throw s(n.error,n.message);return`declined`in n?null:n.installed},m=async()=>(await(await c()).packages.list()).results,h=async e=>{let t=await(await c()).packages.uninstall(e);if(`error`in t)throw s(t.error,t.message)},g=({x:e,y:t,width:n,height:r})=>({x:Math.round(e),y:Math.round(t),width:Math.round(n),height:Math.round(r)}),_=(e,t)=>{let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y);return{x:n,y:r,width:Math.max(0,Math.min(e.x+e.width,t.x+t.width)-n),height:Math.max(0,Math.min(e.y+e.height,t.y+t.height)-r)}},v=(e,t)=>{let n=t;for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t);if((e.overflowX!==`visible`||e.overflowY!==`visible`)&&(n=_(n,g(t.getBoundingClientRect())),n.width===0||n.height===0))break}return n},y=e=>{let t=getComputedStyle(e),n=[t.borderTopLeftRadius,t.borderTopRightRadius,t.borderBottomRightRadius,t.borderBottomLeftRadius];if(n.some(e=>e.includes(`%`)||e.includes(` `)))return;let r=n.map(e=>{let t=Number.parseFloat(e);return Number.isFinite(t)&&t>0?t:0});return r.some(e=>e>0)?r:void 0},b=(e,t)=>{if(!e)return!1;let n=(e,t)=>e===t||!!e&&!!t&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;return n(e.rect,t.rect)&&n(e.clip,t.clip)&&((e,t)=>e===t||!!e&&!!t&&e.every((e,n)=>e===t[n]))(e.radius,t.radius)},x=new Map;n.r(`package view`,()=>x.size>0);var S=async(e,t)=>{let n=x.get(e);if(n){for(let e of n)t&&e.element!==t||(e.stop(),n.delete(e));if(n.size>0)return;x.delete(e)}let r=await(await c()).packages.hide(e);if(`error`in r)throw s(r.error,r.message)},C=async(e,t)=>{let{element:n,rect:r}=t;if(!n&&!r)throw s(`invalid`,`packages.show: pass an element or a rect`);let i=(await c()).packages,a=()=>{if(!n)return{rect:g(r)};let e=g(n.getBoundingClientRect());return{rect:e,clip:v(n,e),radius:y(n)}},o=!0,l,u=0,d=async t=>{l=t;let n=await i.show(e,t);if(`error`in n)throw o=!1,s(n.error,n.message)};await d(a());let f=()=>{if(!o)return;let e=a();b(l,e)||d(e).catch(()=>{}),u=requestAnimationFrame(f)};n&&(u=requestAnimationFrame(f));let p={element:n,stop:()=>{o=!1,cancelAnimationFrame(u)}},m=x.get(e)??new Set;return m.add(p),x.set(e,m),{hide:()=>{S(e,n).catch(()=>{})},refresh:()=>{if(!o)return;let e=a();b(l,e)||d(e).catch(()=>{})}}},w=async(e,t={})=>S(e,t.element),T=(async(e,r={})=>{let i=await(await c()).packages.connect(e,{protocol:r.protocol,...r.path===void 0?{}:{path:r.path}});if(`error`in i)throw s(i.error,i.message);let a=n.t(`package connection`),o=t.s()?.epoch??0,l=t.l((e,t)=>{t!==o&&(a(),l())});Promise.resolve(i.closed).then(()=>{a(),l()},()=>{a(),l()});let{port:d,closed:f}=i;if(r.raw)return{closed:f,port:d};let p=await u(r.payload,d,{signal:r.signal,closed:f});return r.signal&&r.signal.addEventListener(`abort`,()=>{try{d.postMessage({type:`fkn-packages-disconnect`})}catch{}},{once:!0}),{remote:p,closed:f,port:d}}),E=[`allow-scripts`,`allow-same-origin`],D=e=>{let t=e.getAttribute(`sandbox`);if(t!==null){let e=new Set(t.toLowerCase().split(/\s+/).filter(Boolean)),n=E.filter(t=>!e.has(t));if(n.length)throw s(`invalid`,`packages.mount: the iframe's sandbox attribute must include ${n.join(` and `)}, or the package cannot start`)}if(globalThis.crossOriginIsolated&&!new Set((e.getAttribute(`allow`)??``).toLowerCase().split(`;`).map(e=>e.trim().split(/\s+/)[0]).filter(Boolean)).has(`cross-origin-isolated`))throw s(`invalid`,`packages.mount: this page is cross-origin isolated, so the iframe's allow attribute must include 'cross-origin-isolated' to hand that down to the package`)},O=3e4,k=(e,t)=>new Promise((n,r)=>{let i=e=>{clearTimeout(o),window.removeEventListener(`message`,a),e?r(e):n()},a=n=>{if(n.source!==e.contentWindow||n.origin!==t)return;let r=n.data;if(r?.type===`fkn-packages-ready`)return i();r?.type===`fkn-packages-failed`&&i(s(`unavailable`,typeof r.message==`string`&&r.message?r.message:`packages.mount: the package failed to boot`))},o=setTimeout(()=>i(s(`timeout`,`packages.mount: the package did not register a connection handler`)),O);window.addEventListener(`message`,a)}),A=async(e,t)=>{let{iframe:r}=t;if(!(r instanceof HTMLIFrameElement))throw s(`invalid`,`packages.mount: pass the iframe to load the package into`);if(!r.isConnected)throw s(`invalid`,`packages.mount: the iframe must be in the document before mounting into it`);D(r);let i=await(await c()).packages.frame(e);if(`error`in i)throw s(i.error,i.message);r.src=i.url;let a={done:!1},o=()=>{},l=new Promise(e=>{o=e}),d=n.t(`mounted package`),f=()=>{if(!a.done){a.done=!0,d();try{r.contentWindow?.postMessage({type:`fkn-packages-close`},i.origin)}catch{}r.src=`about:blank`,o()}};try{await k(r,i.origin)}catch(e){throw f(),e}let p=new MessageChannel,m=r.contentWindow;if(!m)throw f(),s(`unavailable`,`packages.mount: the frame was detached before it could connect`);m.postMessage({type:`fkn-packages-port`,from:i.from,protocol:t.protocol,uri:i.uri,name:i.name,version:i.version},i.origin,[p.port2]);try{m.postMessage({type:`fkn-packages-visibility`,visible:!0},i.origin)}catch{}if(t.raw)return{closed:l,port:p.port1,frame:r,unmount:f};try{return{remote:await u(t.payload,p.port1,{signal:t.signal,closed:l}),closed:l,port:p.port1,frame:r,unmount:f}}catch(e){throw f(),e}},j=(e,t,n)=>u(t,e,{signal:n?.signal}),M=null,N=!1,P=new Set,F=[],I=new Map,L=!1,R=!1,z=e=>{let t=I.get(e);t&&(I.delete(e),t())},B=(e,t)=>{try{e.postMessage({type:`fkn-packages-nack`,message:t})}catch{}try{e.close()}catch{}},V=async(e,t)=>{let{port:n,...r}=e;e.port.addEventListener(`message`,t=>{t.data?.type===`fkn-packages-disconnect`&&z(e.port)});let i;try{i=await t.createPayload(r)}catch(t){throw B(e.port,t instanceof Error?t.message:`the package failed to produce a connection`),t}let a=new Promise(t=>I.set(e.port,t)),o=await l(i,e.port);t.handler?.({...r,remote:o,closed:a,port:e.port})},H=()=>{L||typeof window>`u`||window.parent===window||(L=!0,window.addEventListener(`message`,e=>{if(e.source!==window.parent)return;let t=e.data;if(t?.type===`fkn-packages-port`){let n=e.ports[0];if(!n)return;let r={port:n,from:typeof t.from==`string`?t.from:``,protocol:typeof t.protocol==`string`?t.protocol:null,uri:typeof t.uri==`string`?t.uri:``,name:typeof t.name==`string`?t.name:``,version:typeof t.version==`string`?t.version:``};M?V(r,M).catch(e=>console.warn(`packages.onConnect:`,e)):F.push(r)}if(t?.type===`fkn-packages-close`)for(let e of[...I.keys()])z(e);if(t?.type===`fkn-packages-visibility`){N=t.visible===!0;for(let e of P)try{e(N)}catch{}}}))},U=()=>{R||typeof window>`u`||window.parent===window||(R=!0,window.parent.postMessage({type:`fkn-packages-ready`},`*`))},W=(e,t)=>{if(typeof window>`u`)return{unsubscribe:()=>{}};H();let n={createPayload:e,handler:t};for(M=n,U();F.length&&M===n;)V(F.shift(),n).catch(e=>console.warn(`packages.onConnect:`,e));return{unsubscribe:()=>{M===n&&(M=null)}}},G=()=>N,K=e=>{if(typeof window>`u`)return{unsubscribe:()=>{}};H(),P.add(e);try{e(N)}catch{}return{unsubscribe:()=>{P.delete(e)}}};exports.attach=j,exports.connect=T,exports.hide=w,exports.install=p,exports.isVisible=G,exports.list=m,exports.mount=A,exports.onConnect=W,exports.onVisibilityChange=K,exports.pick=f,exports.search=d,exports.show=C,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),exports.uninstall=h;
|
package/packages.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as InstallOptions, F as PickOptions, I as Placement, M as PackageResult, N as PackagesErrorCode,
|
|
1
|
+
import { C as InstallOptions, F as PickOptions, H as Radii, I as Placement, M as PackageResult, N as PackagesErrorCode, f as ConnectOptions, j as PackageQuery, vt as SurfaceRect, w as InstalledPackage } from "./contract-Cvr_8gCL.js";
|
|
2
2
|
import { Remote } from "osra";
|
|
3
3
|
declare namespace packages_d_exports {
|
|
4
4
|
export { AppConnectOptions, Connect, ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, InstallOptions, InstalledPackage, MountOptions, MountedPackage, PackageConnection, PackageQuery, PackageResult, PackageView, PackagesError, PackagesErrorCode, PickOptions, Placement, Radii, RawPackageConnection, ShowOptions, SurfaceRect, attach, connect, hide, install, isVisible, list, mount, onConnect, onVisibilityChange, pick, search, show, uninstall };
|
package/packages.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { a as t, c as n, l as r, s as i } from "./api-
|
|
2
|
+
import { a as t, c as n, l as r, s as i } from "./api-Dp-2AT3u.js";
|
|
3
3
|
import { r as a, t as o } from "./busy-B189uX--.js";
|
|
4
4
|
import { expose as s } from "osra";
|
|
5
5
|
//#region src/packages.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, d as t } from "./api-
|
|
1
|
+
import { a as e, d as t } from "./api-Dp-2AT3u.js";
|
|
2
2
|
import { t as n } from "./busy-B189uX--.js";
|
|
3
3
|
//#region src/proxy.ts
|
|
4
4
|
var r = typeof FinalizationRegistry > "u" ? void 0 : new FinalizationRegistry((e) => e()), i = (e) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./api-
|
|
1
|
+
import { U as Resolvers } from "./contract-Cvr_8gCL.js";
|
|
2
|
+
import "./api-BE5zPvFZ.js";
|
|
3
3
|
//#region src/proxy.d.ts
|
|
4
4
|
type ProxyFetch = Resolvers['cloud']['fetch'];
|
|
5
5
|
type FetchParameters = Parameters<ProxyFetch>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./api-
|
|
1
|
+
const e=require("./api-jOTOA-5n.cjs"),t=require("./busy-Dv8wzE5M.cjs");var n=typeof FinalizationRegistry>`u`?void 0:new FinalizationRegistry(e=>e()),r=e=>{let r=e.body;if(!r)return e;let i=t.t(`streamed response`),a=r.getReader(),o=new ReadableStream({pull:async e=>{try{let{done:t,value:n}=await a.read();if(t){i(),e.close();return}e.enqueue(n)}catch(t){i(),e.error(t)}},cancel:async e=>{i(),await a.cancel(e).catch(()=>{})}}),s=new Response(o,{status:e.status,statusText:e.statusText,headers:e.headers});return n?.register(s,i),s},i=async e=>{if(e!=null)return typeof e==`string`||e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e:new Request(`https://body.invalid/`,{method:`POST`,body:e,duplex:`half`}).arrayBuffer()},a=async e=>{if(e.method===`GET`||e.method===`HEAD`)return;let t=await e.clone().arrayBuffer();return t.byteLength?t:void 0},o=async(t,n)=>{if(e.d(t),typeof t==`object`&&t&&!(t instanceof URL)&&typeof t.url==`string`){let o=t,s={};o.headers.forEach((e,t)=>{s[t]=e});let c=await i(n?.body===void 0?await a(o):n.body);return e.a.then(e=>e.cloud.fetch(o.url,{...n,method:n?.method??o.method,headers:n?.headers??s,body:c})).then(r)}let o=t instanceof URL?t.href:t,s=await i(n?.body);return e.a.then(e=>e.cloud.fetch(o,n?.body===void 0?n:{...n,body:s})).then(r)};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|