@fkn/lib 0.9.42 → 0.9.43

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/index.js CHANGED
@@ -1,90 +1,90 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { $ as t, A as n, B as r, C as i, E as a, F as o, G as s, I as ee, J as te, K as ne, L as re, M as ie, N as c, O as ae, P as oe, R as se, S as l, T as ce, U as le, V as ue, W as de, X as u, Y as d, Z as f, _ as p, a as m, at as h, b as g, ct as _, dt as v, et as y, ft as b, g as x, h as S, i as C, it as w, lt as T, n as E, nt as D, o as O, ot as k, pt as A, q as j, r as M, rt as N, st as P, t as F, tt as I, ut as L, v as R, w as z, x as B, y as V, z as H } from "./lib-DppqX10G.js";
3
- import { c as U, d as fe, f as pe, o as W, u as G } from "./api-DIgTslNb.js";
4
- import { n as me, t as he } from "./busy-B189uX--.js";
5
- import { a as ge, i as K, n as _e } from "./cloud-f3j4s8yZ.js";
6
- import { t as ve } from "./dns.js";
7
- import { t as ye } from "./net.js";
8
- import { t as be } from "./dgram.js";
9
- import { t as xe } from "./http.js";
10
- import { i as Se, n as Ce, t as we } from "./extension-BOBuYwZc.js";
11
- import { t as Te } from "./desktop.js";
12
- import { u as Ee } from "./fs-CVnmXRf7.js";
13
- import { t as De } from "./opfs.js";
14
- import { t as Oe } from "./packages.js";
15
- import { t as ke } from "./rooms.js";
16
- import { t as Ae } from "./account.js";
17
- import { t as je } from "./connect-button-DtsN3X1J.js";
18
- import { relay as Me } from "osra";
2
+ import { B as t, C as n, D as r, E as i, F as a, G as o, H as ee, I as te, J as ne, K as s, L as re, N as ie, P as ae, Q as c, R as l, S as oe, T as se, V as ce, W as le, X as ue, Y as de, Z as u, _ as d, a as f, at as p, b as m, ct as h, dt as g, et as _, ft as v, g as y, i as b, it as x, j as S, k as C, lt as w, mt as T, n as E, nt as D, o as O, ot as k, pt as A, q as j, r as M, rt as N, st as P, t as F, tt as I, ut as L, v as R, w as z, x as B, y as V, z as H } from "./lib-C3UwxjVs.js";
3
+ import { a as fe, i as pe, n as me, o as he, t as ge } from "./extension-CzZn0bY2.js";
4
+ import { c as U, d as _e, f as ve, o as W, u as G } from "./api-DIgTslNb.js";
5
+ import { n as ye, t as be } from "./busy-B189uX--.js";
6
+ import { a as xe, i as K, n as Se } from "./cloud-D-vDUzzx.js";
7
+ import { t as Ce } from "./dns.js";
8
+ import { t as we } from "./net.js";
9
+ import { t as Te } from "./dgram.js";
10
+ import { t as Ee } from "./http.js";
11
+ import { t as De } from "./desktop.js";
12
+ import { u as Oe } from "./fs-CVnmXRf7.js";
13
+ import { t as ke } from "./opfs.js";
14
+ import { t as Ae } from "./packages.js";
15
+ import { t as je } from "./rooms.js";
16
+ import { t as Me } from "./account.js";
17
+ import { t as Ne } from "./connect-button-DtsN3X1J.js";
18
+ import { relay as Pe } from "osra";
19
19
  //#region src/frame.ts
20
- var Ne = 1e4, Pe = 150, Fe = () => new Promise((e) => {
21
- if (t()) return e(!0);
22
- let n, r = setTimeout(() => i(t()), Ne), i = (t) => {
23
- clearTimeout(n), clearTimeout(r), o.disconnect(), document.removeEventListener("readystatechange", s), e(t);
24
- }, a = () => {
25
- clearTimeout(n), n = setTimeout(() => i(t()), Pe);
26
- }, o = new MutationObserver(() => {
27
- t() && i(!0);
28
- }), s = () => {
29
- document.readyState === "complete" && !t() && a();
20
+ var Fe = 1e4, Ie = 150, Le = () => new Promise((e) => {
21
+ if (_()) return e(!0);
22
+ let t, n = setTimeout(() => r(_()), Fe), r = (r) => {
23
+ clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", o), e(r);
24
+ }, i = () => {
25
+ clearTimeout(t), t = setTimeout(() => r(_()), Ie);
26
+ }, a = new MutationObserver(() => {
27
+ _() && r(!0);
28
+ }), o = () => {
29
+ document.readyState === "complete" && !_() && i();
30
30
  };
31
- o.observe(document.documentElement, {
31
+ a.observe(document.documentElement, {
32
32
  attributes: !0,
33
33
  attributeFilter: ["data-fkn-extension"]
34
- }), document.addEventListener("readystatechange", s), document.readyState === "complete" && a();
35
- }), Ie = (async (e) => {
34
+ }), document.addEventListener("readystatechange", o), document.readyState === "complete" && i();
35
+ }), Re = (async (e) => {
36
36
  let { kind: t, cookies: n } = O(e);
37
37
  if (t === "window") {
38
38
  let t = e;
39
- return n === "native" ? m(t) : K(t);
39
+ return n === "native" ? f(t) : K(t);
40
40
  }
41
41
  let r = e;
42
- return n === "native" ? Le(r) : K(r);
43
- }), Le = async (e) => (ge(e), await Fe(), m(e)), Re = "https://fkn.app", ze = async (e, t) => {
42
+ return n === "native" ? ze(r) : K(r);
43
+ }), ze = async (e) => (xe(e), await Le(), f(e)), Be = "https://fkn.app", Ve = async (e, t) => {
44
44
  if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
45
- let n = await pe;
45
+ let n = await ve;
46
46
  if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
47
- fe();
48
- let r = he("relayed worker");
47
+ _e();
48
+ let r = be("relayed worker");
49
49
  t?.unregisterSignal?.aborted ? r() : t?.unregisterSignal?.addEventListener("abort", r, { once: !0 });
50
50
  let i = n.emit instanceof MessagePort ? {} : {
51
- originA: t?.originA ?? Re,
51
+ originA: t?.originA ?? Be,
52
52
  originB: t?.originB ?? "*"
53
53
  };
54
- Me(n, e, {
54
+ Pe(n, e, {
55
55
  key: "fkn-api",
56
56
  ...i,
57
57
  unregisterSignal: t?.unregisterSignal
58
58
  });
59
- }, Be = async () => typeof window > "u" ? !1 : (await W).connect.prompt(location.origin).catch(() => !1), Ve = async () => typeof window > "u" ? null : (await W).relay.prompt().catch(() => null), q = /* @__PURE__ */ new Set(), He = (e) => (q.add(e), () => {
59
+ }, He = async () => typeof window > "u" ? !1 : (await W).connect.prompt(location.origin).catch(() => !1), Ue = async () => typeof window > "u" ? null : (await W).relay.prompt().catch(() => null), q = /* @__PURE__ */ new Set(), We = (e) => (q.add(e), () => {
60
60
  q.delete(e);
61
- }), Ue = () => {
61
+ }), Ge = () => {
62
62
  if (q.size === 0) return !1;
63
63
  for (let e of [...q]) try {
64
64
  e();
65
65
  } catch {}
66
66
  return !0;
67
- }, We = (e, t) => {
67
+ }, Ke = (e, t) => {
68
68
  if (typeof e?.onUpdateTaken == "function") return Promise.resolve(e.onUpdateTaken(t));
69
- }, Ge = /* @__PURE__ */ e({
70
- applyUpdate: () => Qe,
71
- busyReasons: () => Ze,
72
- onUpdate: () => Je,
73
- onUpdateTaken: () => Ye,
74
- updateReady: () => Ke
75
- }), Ke = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, qe = () => {
69
+ }, qe = /* @__PURE__ */ e({
70
+ applyUpdate: () => et,
71
+ busyReasons: () => $e,
72
+ onUpdate: () => Xe,
73
+ onUpdateTaken: () => Ze,
74
+ updateReady: () => Je
75
+ }), Je = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, Ye = () => {
76
76
  Y = !0;
77
77
  for (let e of [...J]) try {
78
78
  e();
79
79
  } catch {}
80
80
  }, X = 0, Z = () => {
81
81
  let e = U();
82
- e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(qe)).catch(() => {
82
+ e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(Ye)).catch(() => {
83
83
  X === e.epoch && (X = 0);
84
84
  }));
85
85
  };
86
86
  typeof window < "u" && G(Z);
87
- var Je = async (e) => {
87
+ var Xe = async (e) => {
88
88
  if (typeof window > "u") return () => {};
89
89
  if (J.add(e), Y) try {
90
90
  e();
@@ -92,8 +92,8 @@ var Je = async (e) => {
92
92
  return Z(), () => {
93
93
  J.delete(e);
94
94
  };
95
- }, Ye = (e) => typeof window > "u" ? () => {} : He(e), Q = 0, $ = !1, Xe = () => {
96
- if (!Ue() && !$) {
95
+ }, Ze = (e) => typeof window > "u" ? () => {} : We(e), Q = 0, $ = !1, Qe = () => {
96
+ if (!Ge() && !$) {
97
97
  $ = !0;
98
98
  try {
99
99
  location.reload();
@@ -104,7 +104,7 @@ typeof window < "u" && G(() => {
104
104
  let e = U();
105
105
  if (!e || Q === e.epoch) return;
106
106
  Q = e.epoch;
107
- let t = We(e.remote.shell, Xe);
107
+ let t = Ke(e.remote.shell, Qe);
108
108
  if (!t) {
109
109
  Q = 0;
110
110
  return;
@@ -113,6 +113,6 @@ typeof window < "u" && G(() => {
113
113
  Q === e.epoch && (Q = 0);
114
114
  });
115
115
  });
116
- var Ze = () => me(), Qe = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
116
+ var $e = () => ye(), et = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
117
117
  //#endregion
118
- export { C as ATTACH_FRAME_EVENT_KEY, i as CATEGORIES, N as EXTENSION_ABI, w as ExtensionOperationUnsupportedError, h as ExtensionOutdatedError, te as FORGEABLE_HEADERS, S as FrameWindowBlockedError, x as FrameWindowRefusedError, ae as LOCATOR_DENIED, c as LOCATOR_ERROR, o as LOCATOR_INVALID, ce as LOCATOR_UNSUPPORTED, F as PERMISSION_DENIED, k as REQUIRED_EXTENSION_ABI, z as TimeoutError, Ae as account, g as assertAttachableFrameUrl, ue as assertFetchableUrl, d as assertForgeableHeaders, B as assertLockdownApplicable, u as assertOneCookieIdentity, Ie as attachFrame, p as attachFramePermission, T as box, _e as cloud, Be as connect, je as connectButtonUrl, H as cookies, R as createFrame, L as createVideoElementHandle, Te as desktop, be as dgram, ve as dns, we as extension, Ce as fetch, le as fetchCredentialedPermission, de as fetchLocalPermission, s as fetchPermission, Ee as fs, V as gotoPermission, _ as handleRevivableModules, f as hasForgedCookie, xe as http, ne as isBlockedFetchUrl, l as isBlockedFrameUrl, t as isExtensionExposed, j as isLocalNetworkUrl, oe as isLocatorDenied, n as isLocatorInvalid, a as isLocatorUnsupported, E as isPermissionDenied, ie as isTerminalError, v as isType, ee as modifyRequestHeadersPermission, ye as net, De as opfs, Oe as packages, M as permissions, Se as promptInstall, Ve as promptRelay, r as readCookiePermission, y as readExtensionHandshake, ze as relayWorker, re as removeRequestHeaderRule, b as revive, ke as rooms, I as setMissingExtensionHandler, se as setRequestHeaderRule, Ge as shell, P as supportsOperation, A as type, D as waitForExtensionExposure };
118
+ export { b as ATTACH_FRAME_EVENT_KEY, fe as BACKGROUND_STOPPED, z as CATEGORIES, x as EXTENSION_ABI, p as ExtensionOperationUnsupportedError, k as ExtensionOutdatedError, de as FORGEABLE_HEADERS, y as FrameWindowBlockedError, d as FrameWindowRefusedError, C as LOCATOR_DENIED, ae as LOCATOR_ERROR, te as LOCATOR_INVALID, i as LOCATOR_UNSUPPORTED, F as PERMISSION_DENIED, P as REQUIRED_EXTENSION_ABI, se as TimeoutError, Me as account, B as assertAttachableFrameUrl, ee as assertFetchableUrl, ue as assertForgeableHeaders, oe as assertLockdownApplicable, u as assertOneCookieIdentity, Re as attachFrame, R as attachFramePermission, L as box, Se as cloud, He as connect, Ne as connectButtonUrl, t as cookies, V as createFrame, g as createVideoElementHandle, De as desktop, Te as dgram, Ce as dns, ge as extension, me as fetch, le as fetchCredentialedPermission, o as fetchLocalPermission, s as fetchPermission, Oe as fs, m as gotoPermission, w as handleRevivableModules, c as hasForgedCookie, Ee as http, he as isBackgroundStopped, j as isBlockedFetchUrl, n as isBlockedFrameUrl, _ as isExtensionExposed, ne as isLocalNetworkUrl, a as isLocatorDenied, S as isLocatorInvalid, r as isLocatorUnsupported, E as isPermissionDenied, ie as isTerminalError, v as isType, re as modifyRequestHeadersPermission, we as net, ke as opfs, Ae as packages, M as permissions, pe as promptInstall, Ue as promptRelay, ce as readCookiePermission, I as readExtensionHandshake, Ve as relayWorker, l as removeRequestHeaderRule, A as revive, je as rooms, D as setMissingExtensionHandler, H as setRequestHeaderRule, qe as shell, h as supportsOperation, T as type, N as waitForExtensionExposure };