@fkn/lib 0.9.54 → 0.9.56

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.
Files changed (68) hide show
  1. package/{account-generation-CTB1J33G.js → account-generation-D3jlXBbM.js} +1 -1
  2. package/{account-generation-DOuApHq5.cjs → account-generation-DkrSMafa.cjs} +1 -1
  3. package/{account-storage-D1RiskV6.js → account-storage-BBL440_m.js} +2 -2
  4. package/{account-storage-CL0wLuQw.cjs → account-storage-C1VL6fpb.cjs} +1 -1
  5. package/account.cjs +1 -1
  6. package/account.d.ts +1 -1
  7. package/account.js +2 -2
  8. package/{api-C-VvG5P-.d.ts → api-BSpQkgnM.d.ts} +361 -25
  9. package/api-BmaUJUUp.cjs +3 -0
  10. package/{api-BYtMzj8u.js → api-DEfkbHGB.js} +93 -81
  11. package/api.cjs +1 -1
  12. package/api.d.ts +2 -2
  13. package/api.js +1 -1
  14. package/cloud/dns.d.ts +1 -1
  15. package/cloud/fetch.cjs +1 -1
  16. package/cloud/fetch.d.ts +1 -1
  17. package/cloud/fetch.js +1 -1
  18. package/cloud/fs.cjs +1 -1
  19. package/cloud/fs.js +1 -1
  20. package/cloud/net.d.ts +1 -1
  21. package/{cloud-S8hQywqV.d.ts → cloud-BslRIoKs.d.ts} +2 -2
  22. package/{cloud-CI6WMBPa.cjs → cloud-C_EPPfe_.cjs} +1 -1
  23. package/{cloud-8sJ1Sg8n.js → cloud-DTpFBbBH.js} +2 -2
  24. package/cloud.cjs +1 -1
  25. package/cloud.d.ts +3 -3
  26. package/cloud.js +2 -2
  27. package/{contract-CMQOic3K.d.ts → contract-DFycgFJK.d.ts} +131 -8
  28. package/contract.d.ts +2 -2
  29. package/dgram.cjs +1 -1
  30. package/dgram.d.ts +2 -2
  31. package/dgram.js +1 -1
  32. package/dns.cjs +1 -1
  33. package/dns.d.ts +1 -1
  34. package/dns.js +1 -1
  35. package/{extension-BmqjgSIQ.js → extension-C13d41tq.js} +2 -2
  36. package/{extension-BXI3MVXw.cjs → extension-DA_Fx3Lx.cjs} +1 -1
  37. package/extension.cjs +1 -1
  38. package/extension.js +1 -1
  39. package/fs/promises.cjs +1 -1
  40. package/fs/promises.js +1 -1
  41. package/{fs-CPU00CI3.cjs → fs-C7ByWYF9.cjs} +1 -1
  42. package/{fs-ohcMNiu2.js → fs-gryDP9qw.js} +2 -2
  43. package/fs.cjs +1 -1
  44. package/fs.js +2 -2
  45. package/http.d.ts +1 -1
  46. package/index.cjs +1 -1
  47. package/index.d.ts +2 -2
  48. package/index.js +4 -4
  49. package/{net-B8YQuB9E.d.ts → net-eEjhJ0AE.d.ts} +2 -2
  50. package/net.cjs +1 -1
  51. package/net.d.ts +1 -1
  52. package/net.js +1 -1
  53. package/package.json +1 -1
  54. package/packages.cjs +1 -1
  55. package/packages.d.ts +1 -1
  56. package/packages.js +1 -1
  57. package/{proxy-ClDBa5il.d.ts → proxy-8hIHeEHD.d.ts} +2 -2
  58. package/{proxy-CL8j00ao.cjs → proxy-Blzm-Dc1.cjs} +1 -1
  59. package/{proxy-vAsYHMIa.js → proxy-C2HY5Ybc.js} +1 -1
  60. package/react.cjs +1 -1
  61. package/react.js +1 -1
  62. package/rooms.cjs +1 -1
  63. package/rooms.d.ts +43 -9
  64. package/rooms.js +154 -92
  65. package/storage.cjs +1 -1
  66. package/storage.d.ts +1 -1
  67. package/storage.js +3 -3
  68. package/api-Csb5b8dE.cjs +0 -3
@@ -22,35 +22,47 @@ var n = 1e4, r = 16, i = (e) => {
22
22
  i(e) && a();
23
23
  }, r), s = setTimeout(a, t);
24
24
  e.addEventListener("load", a);
25
- }), o = 32, s = 8, c = 120, l = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0H1V1H0Z')"), u = typeof CSS < "u" && CSS.supports("clip-path", "polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)"), d = (e) => {
25
+ }), o = 5e3, s = (e, t, n) => {
26
+ let r = 1, a, s = () => {
27
+ clearTimeout(a), a = setTimeout(() => {
28
+ if (e.isConnected) {
29
+ if (r >= 4) return console.error(`FKN @fkn/lib: ${t} did not load in ${r} tries; reload the page`);
30
+ r += 1, e.contentWindow?.location.replace(t);
31
+ }
32
+ }, o);
33
+ }, c = (t) => {
34
+ t.source === e.contentWindow && t.origin === n && (clearTimeout(a), removeEventListener("message", c), e.removeEventListener("load", s));
35
+ };
36
+ addEventListener("message", c), e.addEventListener("load", s), i(e) && s();
37
+ }, c = 32, l = 8, u = 120, d = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0H1V1H0Z')"), f = typeof CSS < "u" && CSS.supports("clip-path", "polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)"), p = (e) => {
26
38
  let t = e.style;
27
39
  t.setProperty("display", "block", "important"), t.setProperty("position", "fixed", "important"), t.setProperty("top", "0", "important"), t.setProperty("left", "0", "important"), t.setProperty("width", "100%", "important"), t.setProperty("height", "100%", "important"), t.setProperty("border", "none", "important"), t.setProperty("padding", "0", "important"), t.setProperty("box-sizing", "border-box", "important"), t.setProperty("clip-path", "inset(100%)", "important"), t.setProperty("background", "transparent"), t.setProperty("color-scheme", "normal"), t.setProperty("z-index", "2147483647"), e.setAttribute("title", "FKN");
28
- }, f = ({ x: e, y: t, width: n, height: r, radius: i }) => {
40
+ }, m = ({ x: e, y: t, width: n, height: r, radius: i }) => {
29
41
  if (!i) return `M${e} ${t}h${n}v${r}h${-n}Z`;
30
42
  let a = Math.min(n, r) / 2, [o, s, c, l] = i.map((e) => Math.max(0, Math.min(e, a)));
31
43
  return `M${e + o} ${t}h${n - o - s}a${s} ${s} 0 0 1 ${s} ${s}v${r - s - c}a${c} ${c} 0 0 1 ${-c} ${c}h${-(n - c - l)}a${l} ${l} 0 0 1 ${-l} ${-l}v${-(r - l - o)}a${o} ${o} 0 0 1 ${o} ${-o}Z`;
32
- }, p = () => l && u, m = ({ x: e, y: t, width: n, height: r }) => [
44
+ }, h = () => d && f, g = ({ x: e, y: t, width: n, height: r }) => [
33
45
  [e, t],
34
46
  [e + n, t],
35
47
  [e + n, t + r],
36
48
  [e, t + r],
37
49
  [e, t]
38
- ], h = (e) => {
50
+ ], ee = (e) => {
39
51
  let t = e[0];
40
52
  if (!t) return [];
41
- let n = m(t)[0], r = [];
53
+ let n = g(t)[0], r = [];
42
54
  return e.forEach((t, i) => {
43
- r.push(...m(t)), i > 0 && i < e.length - 1 && r.push(n);
55
+ r.push(...g(t)), i > 0 && i < e.length - 1 && r.push(n);
44
56
  }), r;
45
- }, g = (e) => `polygon(nonzero, ${h(e).map(([e, t]) => `${e}px ${t}px`).join(", ")})`, ee = ({ x: e, y: t, width: n, height: r, radius: i }, a) => {
57
+ }, te = (e) => `polygon(nonzero, ${ee(e).map(([e, t]) => `${e}px ${t}px`).join(", ")})`, ne = ({ x: e, y: t, width: n, height: r, radius: i }, a) => {
46
58
  let o = `${t}px ${a.width - e - n}px ${a.height - t - r}px ${e}px`;
47
59
  return i ? `inset(${o} round ${i.map((e) => `${e}px`).join(" ")})` : `inset(${o})`;
48
- }, te = (e, t, n) => {
60
+ }, re = (e, t, n) => {
49
61
  if (t) return "none";
50
62
  if (e.length === 0) return "inset(100%)";
51
63
  let r = e.length === 1 ? e[0] : void 0;
52
- return r ? ee(r, n) : u && e.length <= 5 && !e.some((e) => e.radius) ? g(e) : `path('${e.map(f).join("")}')`;
53
- }, ne = (e) => {
64
+ return r ? ne(r, n) : f && e.length <= 5 && !e.some((e) => e.radius) ? te(e) : `path('${e.map(m).join("")}')`;
65
+ }, ie = (e) => {
54
66
  if (e.length < 2) return null;
55
67
  let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y));
56
68
  return {
@@ -59,51 +71,51 @@ var n = 1e4, r = 16, i = (e) => {
59
71
  width: Math.max(...e.map((e) => e.x + e.width)) - t,
60
72
  height: Math.max(...e.map((e) => e.y + e.height)) - n
61
73
  };
62
- }, re = (e, t, n) => t >= e.x && t < e.x + e.width && n >= e.y && n < e.y + e.height, ie = 16, _ = (e, t, n) => t === 1 ? e * ie : t === 2 ? e * n : e, ae = (e, t, n) => {
74
+ }, ae = (e, t, n) => t >= e.x && t < e.x + e.width && n >= e.y && n < e.y + e.height, oe = 16, _ = (e, t, n) => t === 1 ? e * oe : t === 2 ? e * n : e, se = (e, t, n) => {
63
75
  let r = getComputedStyle(e);
64
76
  return n !== 0 && /auto|scroll/.test(r.overflowY) && e.scrollHeight > e.clientHeight ? !0 : t !== 0 && /auto|scroll/.test(r.overflowX) && e.scrollWidth > e.clientWidth;
65
- }, oe = (e, t, n) => {
66
- for (let r = e; r; r = r.parentElement) if (ae(r, t, n)) return r;
77
+ }, ce = (e, t, n) => {
78
+ for (let r = e; r; r = r.parentElement) if (se(r, t, n)) return r;
67
79
  return document.scrollingElement;
68
80
  }, v = null, y = null, b = (e) => ({
69
81
  width: e.offsetWidth || window.innerWidth,
70
82
  height: e.offsetHeight || window.innerHeight
71
83
  }), x = (e) => {
72
- if (!y || !v || !re(y, e.clientX, e.clientY)) return;
84
+ if (!y || !v || !ae(y, e.clientX, e.clientY)) return;
73
85
  let t = document.elementFromPoint(e.clientX, e.clientY);
74
86
  if (!t || t === v) return;
75
- let n = _(e.deltaX, e.deltaMode, window.innerWidth), r = _(e.deltaY, e.deltaMode, window.innerHeight), i = oe(t, n, r);
87
+ let n = _(e.deltaX, e.deltaMode, window.innerWidth), r = _(e.deltaY, e.deltaMode, window.innerHeight), i = ce(t, n, r);
76
88
  i && (i.scrollBy({
77
89
  left: n,
78
90
  top: r,
79
91
  behavior: "instant"
80
92
  }), e.cancelable && e.preventDefault());
81
- }, se = (e) => {
93
+ }, le = (e) => {
82
94
  let t = y !== null;
83
95
  y = e, t !== (e !== null) && (e ? window.addEventListener("wheel", x, {
84
96
  capture: !0,
85
97
  passive: !1
86
98
  }) : window.removeEventListener("wheel", x, { capture: !0 }));
87
- }, S = 0, ce = (e) => {
99
+ }, S = 0, C = (e) => {
88
100
  if (e === S) return;
89
101
  S = e;
90
102
  let t = document.documentElement.style;
91
103
  e > 0 ? (t.setProperty("margin-top", `${e}px`, "important"), t.setProperty("--fkn-inset-top", `${e}px`)) : (t.removeProperty("margin-top"), t.removeProperty("--fkn-inset-top"));
92
- }, C = (e, { modal: t, rects: n, inset: r }, i) => {
93
- if (ce(r), !l) {
104
+ }, w = (e, { modal: t, rects: n, inset: r }, i) => {
105
+ if (C(r), !d) {
94
106
  let r = t || n.length > 0;
95
107
  e.style.setProperty("pointer-events", r ? "auto" : "none", "important"), e.style.setProperty("visibility", r ? "visible" : "hidden", "important");
96
108
  return;
97
109
  }
98
- let a = te(n, t, i), o = a === "none" || CSS.supports("clip-path", a) ? a : "inset(100%)";
99
- e.style.setProperty("clip-path", o, "important"), se(t || o !== a ? null : ne(n));
100
- }, le = (e) => {
110
+ let a = re(n, t, i), o = a === "none" || CSS.supports("clip-path", a) ? a : "inset(100%)";
111
+ e.style.setProperty("clip-path", o, "important"), le(t || o !== a ? null : ie(n));
112
+ }, ue = (e) => {
101
113
  if (typeof e != "object" || !e) return 0;
102
114
  let { top: t } = e;
103
- return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 0 : Math.min(Math.round(t), c);
104
- }, ue = (e) => {
115
+ return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 0 : Math.min(Math.round(t), u);
116
+ }, de = (e) => {
105
117
  if (Array.isArray(e) && e.length === 4 && e.every((e) => typeof e == "number" && Number.isFinite(e) && e >= 0)) return e.some((e) => e > 0) ? e : void 0;
106
- }, de = (e, t) => {
118
+ }, fe = (e, t) => {
107
119
  if (typeof e != "object" || !e) return null;
108
120
  let { x: n, y: r, width: i, height: a } = e;
109
121
  if (![
@@ -112,7 +124,7 @@ var n = 1e4, r = 16, i = (e) => {
112
124
  i,
113
125
  a
114
126
  ].every((e) => typeof e == "number" && Number.isFinite(e))) return null;
115
- let o = t.width, s = t.height, c = Math.max(0, Math.min(Math.round(n), o)), l = Math.max(0, Math.min(Math.round(r), s)), u = Math.max(c, Math.min(Math.round(n + i), o)), d = Math.max(l, Math.min(Math.round(r + a), s)), f = ue(e.radius);
127
+ let o = t.width, s = t.height, c = Math.max(0, Math.min(Math.round(n), o)), l = Math.max(0, Math.min(Math.round(r), s)), u = Math.max(c, Math.min(Math.round(n + i), o)), d = Math.max(l, Math.min(Math.round(r + a), s)), f = de(e.radius);
116
128
  return {
117
129
  x: c,
118
130
  y: l,
@@ -120,48 +132,48 @@ var n = 1e4, r = 16, i = (e) => {
120
132
  height: d - l,
121
133
  ...f ? { radius: f } : {}
122
134
  };
123
- }, w = {
135
+ }, T = {
124
136
  "not-rendered": "this page is not painting it at all, so it or an ancestor is display:none, or the frame was moved out of the layout",
125
137
  clipped: "it is clipped away or positioned outside the viewport",
126
138
  "not-shown": "it is rendered but would not be seen, so either something is drawn over it, or it or an ancestor has opacity below 1, visibility:hidden, or a filter"
127
- }, fe = (e) => Array.isArray(e) ? e.slice(0, s).flatMap((e) => {
139
+ }, pe = (e) => Array.isArray(e) ? e.slice(0, l).flatMap((e) => {
128
140
  if (typeof e != "object" || !e) return [];
129
141
  let { kind: t, cause: n, level: r } = e;
130
- return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in w) || r !== "full" && r !== "liveness" ? [] : [{
142
+ return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in T) || r !== "full" && r !== "liveness" ? [] : [{
131
143
  kind: t,
132
144
  cause: n,
133
145
  level: r
134
146
  }];
135
- }) : [], T = /* @__PURE__ */ new Set(), pe = (e) => {
136
- for (let { kind: t, cause: n, level: r } of e) T.has(t) || (T.add(t), console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${w[n]}. Nobody using this page can see or answer it.
147
+ }) : [], E = /* @__PURE__ */ new Set(), me = (e) => {
148
+ for (let { kind: t, cause: n, level: r } of e) E.has(t) || (E.add(t), console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${T[n]}. Nobody using this page can see or answer it.
137
149
  @fkn/lib draws its UI inside <iframe title="FKN"> and sets display, position, top, left, width, height, border, padding, box-sizing, clip-path and z-index on that element. Leave those as they are, then check for an ancestor with opacity, visibility, display or a clipping transform, and for an element stacked above it.` + (r === "liveness" ? "\nThis browser reports limited detail, so the cause above is a best guess." : "")));
138
- }, E = (e, t) => {
150
+ }, D = (e, t) => {
139
151
  if (typeof e != "object" || !e) return null;
140
- let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0, o) : []).map((e) => de(e, t)).filter((e) => e !== null && e.width > 0 && e.height > 0);
152
+ let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0, c) : []).map((e) => fe(e, t)).filter((e) => e !== null && e.width > 0 && e.height > 0);
141
153
  return {
142
154
  modal: n.modal === !0,
143
155
  rects: r,
144
- hidden: fe(n.hidden),
145
- inset: le(n.inset)
156
+ hidden: pe(n.hidden),
157
+ inset: ue(n.inset)
146
158
  };
147
- }, me = () => v !== null, D = null, O = null, he = () => {
148
- if (!v || D === null) return;
149
- let e = b(v), t = E(D, e);
150
- t && C(v, t, e);
151
- }, ge = (e) => {
152
- typeof ResizeObserver < "u" && (O ??= new ResizeObserver(he), O.disconnect(), O.observe(e));
159
+ }, he = () => v !== null, O = null, k = null, ge = () => {
160
+ if (!v || O === null) return;
161
+ let e = b(v), t = D(O, e);
162
+ t && w(v, t, e);
153
163
  }, _e = (e) => {
154
- d(e), C(e, {
164
+ typeof ResizeObserver < "u" && (k ??= new ResizeObserver(ge), k.disconnect(), k.observe(e));
165
+ }, ve = (e) => {
166
+ p(e), w(e, {
155
167
  modal: !1,
156
168
  rects: [],
157
169
  hidden: [],
158
170
  inset: 0
159
- }, b(e)), v = e, ge(e);
160
- }, ve = (e) => {
171
+ }, b(e)), v = e, _e(e);
172
+ }, ye = (e) => {
161
173
  if (!v) return;
162
- let t = b(v), n = E(e, t);
163
- n && (D = e, C(v, n, t), pe(n.hidden));
164
- }, ye = /* @__PURE__ */ "fkn.app,fkn.dev,sdbx.app,horionsoftware.com,webvpn.dev,fknmail.app,clairv.app,fkn.cloudflareaccess.com,me-62e.workers.dev,62e9d4fbf21d90ebd4342e54b4babbd3.r2.cloudflarestorage.com,62e9d4fbf21d90ebd4342e54b4babbd3.eu.r2.cloudflarestorage.com,62e9d4fbf21d90ebd4342e54b4babbd3.fedramp.r2.cloudflarestorage.com,pub-8a3dc68041874c7e9c9a54bde972605a.r2.dev,pub-3d97d79220b94243812e60b0e742f2c5.r2.dev,pub-f8bd4876cc3c4b4a951715da5958e49c.r2.dev,web-b3z.pages.dev,fkn-console.pages.dev,dev-dms.pages.dev,fkn-www.pages.dev,fkn-homepage.pages.dev,fkn-sandbox.pages.dev,internal-3ar.pages.dev,stub-ben.pages.dev,ripple-3t3.pages.dev,media-player-e3s.pages.dev,youtube-3c4.pages.dev,horionsoftware.pages.dev,container-ckf.pages.dev,stub-plugin.pages.dev,social-3n2.pages.dev,plugins.banou.dev".split(","), k = (e) => e.toLowerCase().replace(/\.+$/, ""), be = ["79.127.204.69", "152.233.49.59"], xe = (e) => {
174
+ let t = b(v), n = D(e, t);
175
+ n && (O = e, w(v, n, t), me(n.hidden));
176
+ }, be = /* @__PURE__ */ "fkn.app,fkn.dev,sdbx.app,horionsoftware.com,webvpn.dev,fknmail.app,clairv.app,fkn.cloudflareaccess.com,me-62e.workers.dev,62e9d4fbf21d90ebd4342e54b4babbd3.r2.cloudflarestorage.com,62e9d4fbf21d90ebd4342e54b4babbd3.eu.r2.cloudflarestorage.com,62e9d4fbf21d90ebd4342e54b4babbd3.fedramp.r2.cloudflarestorage.com,pub-8a3dc68041874c7e9c9a54bde972605a.r2.dev,pub-3d97d79220b94243812e60b0e742f2c5.r2.dev,pub-f8bd4876cc3c4b4a951715da5958e49c.r2.dev,web-b3z.pages.dev,fkn-console.pages.dev,dev-dms.pages.dev,fkn-www.pages.dev,fkn-homepage.pages.dev,fkn-sandbox.pages.dev,internal-3ar.pages.dev,stub-ben.pages.dev,ripple-3t3.pages.dev,media-player-e3s.pages.dev,youtube-3c4.pages.dev,horionsoftware.pages.dev,container-ckf.pages.dev,stub-plugin.pages.dev,social-3n2.pages.dev,plugins.banou.dev".split(","), A = (e) => e.toLowerCase().replace(/\.+$/, ""), xe = ["79.127.204.69", "152.233.49.59"], Se = (e) => {
165
177
  let t;
166
178
  try {
167
179
  t = new URL(`http://${e.includes(":") && !e.startsWith("[") ? `[${e}]` : e}/`).hostname;
@@ -179,30 +191,30 @@ var n = 1e4, r = 16, i = (e) => {
179
191
  ].join(".");
180
192
  }
181
193
  return /^\d+\.\d+\.\d+\.\d+$/.test(t) ? t : void 0;
182
- }, Se = (e) => {
183
- let t = k(e);
184
- return ye.some((e) => t === e || t.endsWith(`.${e}`));
185
194
  }, Ce = (e) => {
186
- if (Se(e)) return !0;
187
- let t = xe(k(e));
188
- return t !== void 0 && be.includes(t);
195
+ let t = A(e);
196
+ return be.some((e) => t === e || t.endsWith(`.${e}`));
189
197
  }, we = (e) => {
198
+ if (Ce(e)) return !0;
199
+ let t = Se(A(e));
200
+ return t !== void 0 && xe.includes(t);
201
+ }, Te = (e) => {
190
202
  let t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, n;
191
203
  try {
192
204
  n = new URL(t);
193
205
  } catch {
194
206
  return;
195
207
  }
196
- if (Ce(n.hostname)) throw Error(`fetch refuses FKN platform domains (${n.hostname})`);
197
- }, Te = /* @__PURE__ */ "autoplay.fullscreen.picture-in-picture.encrypted-media.screen-wake-lock.speaker-selection.captured-surface-control.camera.microphone.display-capture.geolocation.midi.usb.serial.hid.bluetooth.gamepad.keyboard-map.xr-spatial-tracking.accelerometer.gyroscope.magnetometer.ambient-light-sensor.compute-pressure.clipboard-read.clipboard-write.storage-access.window-management.local-fonts.idle-detection.web-share.sync-xhr.unload.payment.publickey-credentials-get.publickey-credentials-create.otp-credentials.identity-credentials-get.digital-credentials-get.local-network.local-network-access.loopback-network".split("."), Ee = () => {
208
+ if (we(n.hostname)) throw Error(`fetch refuses FKN platform domains (${n.hostname})`);
209
+ }, Ee = /* @__PURE__ */ "autoplay.fullscreen.picture-in-picture.encrypted-media.screen-wake-lock.speaker-selection.captured-surface-control.camera.microphone.display-capture.geolocation.midi.usb.serial.hid.bluetooth.gamepad.keyboard-map.xr-spatial-tracking.accelerometer.gyroscope.magnetometer.ambient-light-sensor.compute-pressure.clipboard-read.clipboard-write.storage-access.window-management.local-fonts.idle-detection.web-share.sync-xhr.unload.payment.publickey-credentials-get.publickey-credentials-create.otp-credentials.identity-credentials-get.digital-credentials-get.local-network.local-network-access.loopback-network".split("."), De = () => {
198
210
  try {
199
211
  let e = globalThis.document?.featurePolicy?.features?.();
200
212
  return e === void 0 ? void 0 : new Set(e);
201
213
  } catch {
202
214
  return;
203
215
  }
204
- }, A = (e = !0, t = Ee()) => [...Te, ...e ? ["cross-origin-isolated"] : []].filter((e) => t === void 0 || t.has(e)).join("; "), j = "https://fkn.app", M = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, N = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, P = `${j}/api${N ? "?coi=1" : ""}`, F = "fkn-api-port", De = "fkn-api-port-ack", Oe = 2e3, ke = () => {
205
- if (!M || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
216
+ }, j = (e = !0, t = De()) => [...Ee, ...e ? ["cross-origin-isolated"] : []].filter((e) => t === void 0 || t.has(e)).join("; "), M = "https://fkn.app", N = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, P = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, F = `${M}/api${P ? "?coi=1" : ""}`, Oe = "fkn-api-port", ke = "fkn-api-port-ack", Ae = 2e3, je = () => {
217
+ if (!N || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
206
218
  let e;
207
219
  try {
208
220
  e = window.parent;
@@ -217,32 +229,32 @@ var n = 1e4, r = 16, i = (e) => {
217
229
  } catch {}
218
230
  n(e);
219
231
  }, i = (e) => {
220
- e.data?.type === De && r(t.port1);
221
- }, a = setTimeout(() => r(void 0), Oe);
232
+ e.data?.type === ke && r(t.port1);
233
+ }, a = setTimeout(() => r(void 0), Ae);
222
234
  t.port1.addEventListener("message", i), t.port1.start();
223
235
  try {
224
- e.postMessage({ type: F }, j, [t.port2]);
236
+ e.postMessage({ type: Oe }, M, [t.port2]);
225
237
  } catch {
226
238
  r(void 0);
227
239
  }
228
240
  });
229
- }, I, Ae = () => {
230
- if (I || !M) return I;
231
- let e = M.querySelector(`iframe[src="${P}"]`);
241
+ }, I, Me = () => {
242
+ if (I || !N) return I;
243
+ let e = N.querySelector(`iframe[src="${F}"]`);
232
244
  if (e) I = e;
233
245
  else {
234
- let e = M.createElement("iframe");
235
- e.setAttribute("allow", A(N)), e.src = P, M.body.appendChild(e), I = e;
246
+ let e = N.createElement("iframe");
247
+ e.setAttribute("allow", j(P)), e.src = F, N.body.appendChild(e), I = e;
236
248
  }
237
- return _e(I), I;
249
+ return s(I, F, M), ve(I), I;
238
250
  }, L = (async () => {
239
- if (!M) return;
240
- let e = await ke();
251
+ if (!N) return;
252
+ let e = await je();
241
253
  if (e) return {
242
254
  receive: e,
243
255
  emit: e
244
256
  };
245
- let t = Ae();
257
+ let t = Me();
246
258
  if (!t) return;
247
259
  await a(t);
248
260
  let n = t.contentWindow;
@@ -250,7 +262,7 @@ var n = 1e4, r = 16, i = (e) => {
250
262
  receive: window,
251
263
  emit: n
252
264
  } : void 0;
253
- })(), je = (e, { boundRetired: t = (e) => e } = {}) => {
265
+ })(), Ne = (e, { boundRetired: t = (e) => e } = {}) => {
254
266
  let n, r = 0, i = !1, a = () => {}, o = () => new Promise((e) => {
255
267
  a = e;
256
268
  }), s = o(), c = s, l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), d = 0, f = 0, p = () => {
@@ -326,7 +338,7 @@ var n = 1e4, r = 16, i = (e) => {
326
338
  i = !0, n = void 0, p();
327
339
  }
328
340
  };
329
- }, R = !1, z = /* @__PURE__ */ new Set(), B = () => R, Me = () => {
341
+ }, R = !1, z = /* @__PURE__ */ new Set(), B = () => R, Pe = () => {
330
342
  if (!R) {
331
343
  R = !0;
332
344
  for (let e of [...z]) try {
@@ -336,13 +348,13 @@ var n = 1e4, r = 16, i = (e) => {
336
348
  }
337
349
  }, V = (e) => {
338
350
  R ? e() : z.add(e);
339
- }, Ne = typeof window < "u" || typeof self < "u", H = async () => {
351
+ }, Fe = typeof window < "u" || typeof self < "u", H = async () => {
340
352
  if (typeof window < "u") return L;
341
353
  if (typeof self < "u") return {
342
354
  receive: self,
343
355
  emit: self
344
356
  };
345
- }, U = "fkn-api", Pe = "fkn-api-window", Fe = { async *[Symbol.asyncIterator]() {
357
+ }, U = "fkn-api", Ie = "fkn-api-window", Le = { async *[Symbol.asyncIterator]() {
346
358
  let e = await H();
347
359
  if (!e) {
348
360
  await new Promise(() => {});
@@ -361,7 +373,7 @@ var n = 1e4, r = 16, i = (e) => {
361
373
  }
362
374
  }
363
375
  yield* t({}, {
364
- key: Pe,
376
+ key: Ie,
365
377
  transport: e
366
378
  });
367
379
  } }, W = !1, G = H().then((t) => new Promise((n) => {
@@ -370,9 +382,9 @@ var n = 1e4, r = 16, i = (e) => {
370
382
  e(t.data, U) && (r.removeEventListener("message", i), W = !0, n());
371
383
  };
372
384
  r.addEventListener("message", i);
373
- })), K = je(Fe, { boundRetired: (e) => Promise.race([e, G.then(() => Q(e, () => new Z()))]) });
385
+ })), K = Ne(Le, { boundRetired: (e) => Promise.race([e, G.then(() => Q(e, () => new Z()))]) });
374
386
  V(() => K.retire());
375
- var q = Promise.race([K.first, new Promise((e) => V(e))]).then(() => K.facade), J = 8e3, Ie = 1e3, Y = !1, X = class extends Error {
387
+ var q = Promise.race([K.first, new Promise((e) => V(e))]).then(() => K.facade), J = 8e3, Re = 1e3, Y = !1, X = class extends Error {
376
388
  constructor(e, t) {
377
389
  super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`), this.name = "BrokerUnreachableError";
378
390
  }
@@ -381,20 +393,20 @@ var q = Promise.race([K.first, new Promise((e) => V(e))]).then(() => K.facade),
381
393
  super("FKN @fkn/lib: this page relays its FKN channel to a worker, and the FKN page it reached predates a channel of the page's own; reload"), this.name = "OwnChannelUnavailableError";
382
394
  }
383
395
  }, Q = (e, t) => {
384
- let n = Y ? Ie : J;
396
+ let n = Y ? Re : J;
385
397
  return Promise.race([e, new Promise((e, r) => setTimeout(() => {
386
398
  Y = !0, r(t(n));
387
399
  }, n))]);
388
- }, Le = (e) => B() ? Q(K.routable().then(() => K.facade), (t) => W ? new Z() : new X(e, t)) : Q(q, (t) => new X(e, t));
400
+ }, ze = (e) => B() ? Q(K.routable().then(() => K.facade), (t) => W ? new Z() : new X(e, t)) : Q(q, (t) => new X(e, t));
389
401
  V(() => {
390
402
  G.then(() => {
391
403
  let e = setTimeout(() => console.error(new Z()), J);
392
404
  K.routable().then(() => clearTimeout(e));
393
405
  });
394
406
  });
395
- var $ = K.onEpoch, Re = K.current, ze = K.lastCall, Be = K.inFlight;
407
+ var $ = K.onEpoch, Be = K.current, Ve = K.lastCall, He = K.inFlight;
396
408
  $((e) => {
397
- me() && e.overlay.setHost(ve, { exactClips: p() }).catch(() => {});
409
+ he() && e.overlay.setHost(ye, { exactClips: h() }).catch(() => {});
398
410
  });
399
411
  //#endregion
400
- export { ze as a, Re as c, Me as d, L as f, Be as i, Ne as l, A as m, X as n, q as o, we as p, Z as r, Le as s, J as t, $ as u };
412
+ export { Ve as a, Be as c, Pe as d, L as f, He as i, Fe as l, j as m, X as n, q as o, Te as p, Z as r, ze as s, J as t, $ as u };
package/api.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./api-Csb5b8dE.cjs");exports.API_DEADLINE_MS=e.t,exports.BrokerUnreachableError=e.n,exports.OwnChannelUnavailableError=e.r,exports.apiInFlight=e.i,exports.apiLastCall=e.a,exports.apiPromise=e.o,exports.apiWithin=e.s,exports.currentApiEpoch=e.c,exports.hasTransport=e.l,exports.onApiEpoch=e.u;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./api-BmaUJUUp.cjs");exports.API_DEADLINE_MS=e.t,exports.BrokerUnreachableError=e.n,exports.OwnChannelUnavailableError=e.r,exports.apiInFlight=e.i,exports.apiLastCall=e.a,exports.apiPromise=e.o,exports.apiWithin=e.s,exports.currentApiEpoch=e.c,exports.hasTransport=e.l,exports.onApiEpoch=e.u;
package/api.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { K as Resolvers } from "./contract-CMQOic3K.js";
2
- import { a as apiLastCall, c as currentApiEpoch, i as apiInFlight, l as hasTransport, n as BrokerUnreachableError, o as apiPromise, r as OwnChannelUnavailableError, s as apiWithin, t as API_DEADLINE_MS, u as onApiEpoch } from "./api-C-VvG5P-.js";
1
+ import { K as Resolvers } from "./contract-DFycgFJK.js";
2
+ import { a as apiLastCall, c as currentApiEpoch, i as apiInFlight, l as hasTransport, n as BrokerUnreachableError, o as apiPromise, r as OwnChannelUnavailableError, s as apiWithin, t as API_DEADLINE_MS, u as onApiEpoch } from "./api-BSpQkgnM.js";
3
3
  export { API_DEADLINE_MS, BrokerUnreachableError, OwnChannelUnavailableError, type Resolvers, apiInFlight, apiLastCall, apiPromise, apiWithin, currentApiEpoch, hasTransport, onApiEpoch };
package/api.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./api-BYtMzj8u.js";
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./api-DEfkbHGB.js";
2
2
  export { c as API_DEADLINE_MS, i as BrokerUnreachableError, o as OwnChannelUnavailableError, n as apiInFlight, e as apiLastCall, a as apiPromise, s as apiWithin, t as currentApiEpoch, r as hasTransport, l as onApiEpoch };
package/cloud/dns.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { s as AddressLookupResult } from "../contract-CMQOic3K.js";
1
+ import { s as AddressLookupResult } from "../contract-DFycgFJK.js";
2
2
  import { lookup } from "../dns.js";
3
3
  export { type AddressLookupResult, lookup };
package/cloud/fetch.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../proxy-CL8j00ao.cjs");exports.fetch=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../proxy-Blzm-Dc1.cjs");exports.fetch=e.t;
package/cloud/fetch.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { t as cloudFetch } from "../proxy-ClDBa5il.js";
1
+ import { t as cloudFetch } from "../proxy-8hIHeEHD.js";
2
2
  export { cloudFetch as fetch };
package/cloud/fetch.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "../proxy-vAsYHMIa.js";
1
+ import { t as e } from "../proxy-C2HY5Ybc.js";
2
2
  export { e as fetch };
package/cloud/fs.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-vsWuoMGa.cjs"),n=require("../messages.cjs"),r=require("../account-storage-CL0wLuQw.cjs");var i=e.t({STORAGE_ACCOUNT_CHANGED:()=>n.STORAGE_ACCOUNT_CHANGED,STORAGE_ACCOUNT_PIN_UNSUPPORTED:()=>n.STORAGE_ACCOUNT_PIN_UNSUPPORTED,STORAGE_NOT_FOUND:()=>n.STORAGE_NOT_FOUND,StorageAccountChangedError:()=>r.t,StorageAccountPinUnsupportedError:()=>r.n,StorageLockedError:()=>r.r,StorageNotFoundError:()=>r.i,availability:()=>r.o,available:()=>a,encryption:()=>r.c,isAccountChanged:()=>r.l,isNotFound:()=>r.d,list:()=>h,mkdir:()=>d,promises:()=>m,quota:()=>r.h,readFile:()=>o,readFileSealed:()=>g,readdir:()=>u,rename:()=>l,rm:()=>f,stat:()=>p,unlink:()=>c,unlock:()=>r.y,writeFile:()=>s}),{available:a,readFile:o,writeFile:s,unlink:c,rename:l,readdir:u,mkdir:d,rm:f,stat:p,promises:m}=t.t(r.a,{memfs:!1}),h=()=>r.p(),g=e=>r._(e);exports.STORAGE_ACCOUNT_CHANGED=n.STORAGE_ACCOUNT_CHANGED,exports.STORAGE_ACCOUNT_PIN_UNSUPPORTED=n.STORAGE_ACCOUNT_PIN_UNSUPPORTED,exports.STORAGE_NOT_FOUND=n.STORAGE_NOT_FOUND,exports.StorageAccountChangedError=r.t,exports.StorageAccountPinUnsupportedError=r.n,exports.StorageLockedError=r.r,exports.StorageNotFoundError=r.i,exports.availability=r.o,exports.available=a,exports.encryption=r.c,exports.isAccountChanged=r.l,exports.isNotFound=r.d,exports.list=h,exports.mkdir=d,exports.promises=m,exports.quota=r.h,exports.readFile=o,exports.readFileSealed=g,exports.readdir=u,exports.rename=l,exports.rm=f,exports.stat=p,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),exports.unlink=c,exports.unlock=r.y,exports.writeFile=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-vsWuoMGa.cjs"),n=require("../messages.cjs"),r=require("../account-storage-C1VL6fpb.cjs");var i=e.t({STORAGE_ACCOUNT_CHANGED:()=>n.STORAGE_ACCOUNT_CHANGED,STORAGE_ACCOUNT_PIN_UNSUPPORTED:()=>n.STORAGE_ACCOUNT_PIN_UNSUPPORTED,STORAGE_NOT_FOUND:()=>n.STORAGE_NOT_FOUND,StorageAccountChangedError:()=>r.t,StorageAccountPinUnsupportedError:()=>r.n,StorageLockedError:()=>r.r,StorageNotFoundError:()=>r.i,availability:()=>r.o,available:()=>a,encryption:()=>r.c,isAccountChanged:()=>r.l,isNotFound:()=>r.d,list:()=>h,mkdir:()=>d,promises:()=>m,quota:()=>r.h,readFile:()=>o,readFileSealed:()=>g,readdir:()=>u,rename:()=>l,rm:()=>f,stat:()=>p,unlink:()=>c,unlock:()=>r.y,writeFile:()=>s}),{available:a,readFile:o,writeFile:s,unlink:c,rename:l,readdir:u,mkdir:d,rm:f,stat:p,promises:m}=t.t(r.a,{memfs:!1}),h=()=>r.p(),g=e=>r._(e);exports.STORAGE_ACCOUNT_CHANGED=n.STORAGE_ACCOUNT_CHANGED,exports.STORAGE_ACCOUNT_PIN_UNSUPPORTED=n.STORAGE_ACCOUNT_PIN_UNSUPPORTED,exports.STORAGE_NOT_FOUND=n.STORAGE_NOT_FOUND,exports.StorageAccountChangedError=r.t,exports.StorageAccountPinUnsupportedError=r.n,exports.StorageLockedError=r.r,exports.StorageNotFoundError=r.i,exports.availability=r.o,exports.available=a,exports.encryption=r.c,exports.isAccountChanged=r.l,exports.isNotFound=r.d,exports.list=h,exports.mkdir=d,exports.promises=m,exports.quota=r.h,exports.readFile=o,exports.readFileSealed=g,exports.readdir=u,exports.rename=l,exports.rm=f,exports.stat=p,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),exports.unlink=c,exports.unlock=r.y,exports.writeFile=s;
package/cloud/fs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "../rolldown-runtime-Dy4uBu1J.js";
2
2
  import { t } from "../node-fs-DY2fO5zd.js";
3
3
  import { STORAGE_ACCOUNT_CHANGED as n, STORAGE_ACCOUNT_PIN_UNSUPPORTED as r, STORAGE_NOT_FOUND as i } from "../messages.js";
4
- import { _ as a, a as o, c as s, d as c, h as l, i as u, l as d, n as f, o as p, p as m, r as h, t as g, y as _ } from "../account-storage-D1RiskV6.js";
4
+ import { _ as a, a as o, c as s, d as c, h as l, i as u, l as d, n as f, o as p, p as m, r as h, t as g, y as _ } from "../account-storage-BBL440_m.js";
5
5
  //#region src/cloud/fs.ts
6
6
  var v = /* @__PURE__ */ e({
7
7
  STORAGE_ACCOUNT_CHANGED: () => n,
package/cloud/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-B8YQuB9E.js";
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-eEjhJ0AE.js";
2
2
  export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
@@ -1,8 +1,8 @@
1
1
  import { r as AttachFrameFunction } from "./index-BQ5OZQhf.js";
2
- import { t as cloudFetch } from "./proxy-ClDBa5il.js";
2
+ import { t as cloudFetch } from "./proxy-8hIHeEHD.js";
3
3
  import { t as dns_d_exports } from "./dns.js";
4
4
  import { n as fs_d_exports } from "./fs-DCJAYoYy.js";
5
- import { s as net_d_exports } from "./net-B8YQuB9E.js";
5
+ import { s as net_d_exports } from "./net-eEjhJ0AE.js";
6
6
  import { t as dgram_d_exports } from "./dgram.js";
7
7
  import { t as http_d_exports } from "./http.js";
8
8
  //#region src/cloud/frame.d.ts
@@ -1 +1 @@
1
- const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-BiQ6cOZ7.cjs"),n=require("./hosts-GNBhZO3-.cjs"),r=require("./api-Csb5b8dE.cjs"),i=require("./busy-BXbVH595.cjs"),a=require("./proxy-CL8j00ao.cjs"),o=require("./attach-policy.cjs"),s=require("./contract.cjs"),c=require("./dns.cjs"),l=require("./cloud/fs.cjs"),u=require("./net.cjs"),d=require("./dgram.cjs"),f=require("./http.cjs");let p=require("osra");var m=async()=>{let e=()=>r.s(`frame consent`);try{let t=await e();return{request:typeof t.frameConsent.request==`function`?t.frameConsent.request:void 0,ensure:t.frameConsent.ensure}}catch(t){if(!(t instanceof r.n))throw t;return{request:void 0,ensure:t=>e().then(e=>e.frameConsent.ensure(t))}}},h=`frame: this frame no longer holds the document the app attached it to`,g=!1,_=()=>{g||(g=!0,console.warn(`[fkn-frame] this FKN broker is too old to ask for permission categories, so nothing was asked for upfront and each capability is asked for as it is first used. Reloading the page picks up the current broker.`))},v=e=>[...e].flatMap(e=>{try{return[new URL(e).hostname]}catch{return[]}}),y=e=>typeof e?.reason==`string`?{reason:e.reason}:{},b=(e,t,n)=>n===null?`frame.${e}: the user did not grant ${t} here`:`frame.${e}: the user did not grant ${t} on ${n}`,x=e=>{let{assertLive:r,attach:i,consent:a,current:s,declaredHosts:c,documentHost:l,freshBlank:u,session:d,approvedOrigins:f}=e,p=new Set,m=()=>{try{return new URL(s()).hostname}catch{return``}},g=async()=>l?await l():m(),x=()=>n.t([...c,...v(f)]),S=async(e,t)=>(await e([t]))[0]??!1;return{gate:async({operation:e,args:s,phase:l})=>{r();let _=n.m(e,s);if(_===null)return;let v=t.h(_);if(v===void 0||v===`auto`)return;if(e===`fetch`){let e=o.frameFetchVerdict({session:d,declaredHosts:c,approvedOrigins:f},l===`ensure`?void 0:s[0],{classifier:`fetchTarget`});if(l===`ensure`&&!d)throw t.k(e.kind===`refuse`?e.reason:``,`fetch`);if(l!==`ensure`&&e.kind===`refuse`)throw t.k(e.reason,`fetch`);let{request:r,ensure:i}=await a();if(!r){if(e.kind===`refuse`)throw t.k(e.reason,`fetch`);if(!await i({scope:n.c(s[0],s[1]).scope,hosts:e.promptHosts}))throw t.k(`frame.fetch: the user did not grant this`,`fetch`);return}let u=e.kind===`consent`?e.targetHost:await g(),p=n.t([u,...c]);if(!p.length)throw t.k(`frame: navigate the frame before fetch`,`fetch`);if(await S(r,{category:`network`,hosts:p,...y(t.T(s))})===!1)throw t.k(b(`fetch`,`network`,u||null),`fetch`);return}let C=await g();if(!C)throw t.k(`frame: navigate the frame before ${e}`,e);if(!x().includes(C))throw t.k(h,e);let w=t.m(_);if(w===void 0||w===`evaluation`&&C===m()&&await u?.()||v===`critical`&&p.has(`${_} ${C}`))return;let{request:T}=await a();if(!T)return;let E=n.t([C,...c]),D=y(t.T(s)),O=v===`critical`?{key:_,hosts:E,attach:i,...D}:{category:w,hosts:E,...D},k=await S(T,O);if(k===!1)throw t.k(b(e,w,null),e);if(k===`once`&&l!==`ensure`)for(let e of E)p.add(`${_} ${e}`)},requestCategories:async e=>{r(),t.f(`frame.requestPermissions`,e);let o=await g(),s=n.t(o?[o,...c]:c);if(!s.length)throw TypeError(`frame.requestPermissions: navigate the frame or declare domains first`);let l=e.map(e=>{let n=e.key;return n===void 0?{named:void 0,critical:!1,category:e.category}:{named:n,critical:t.h(n)===`critical`,category:t.p(n)}}),u=({named:e,critical:t,category:n},r)=>({category:n,...t?{key:e}:{},hosts:s,allow:r}),{request:d}=await a();if(!d)return _(),l.map(e=>u(e,!1));let f=await d(l.map(({named:t,critical:n,category:r},a)=>{let o=y(e[a]);return n?{key:t,hosts:s,attach:i,...o}:{category:r,hosts:s,...o}}));return l.map((e,t)=>u(e,f[t]!==void 0&&f[t]!==!1))},boundary:x}},S=e=>e,C=5e3,w=new Set([]),T=()=>`https://fkn.app`,E=e=>e===`persistent`?``:`incognito-${crypto.randomUUID()}`,D=(e,n,r)=>{let i,a=new Promise((e,a)=>{i=setTimeout(()=>a(typeof r==`string`?new t.E(r):r()),n)});return Promise.race([e,a]).finally(()=>clearTimeout(i))},O=e=>Object.assign(Error(e),{name:t.D}),k=`frame.postMessage: this FKN page predates frame messaging; reload the app to load the current one`,A=`frame.addScriptTag: this render proxy predates addScriptTag; reload the app`,j=`frame.addScriptTag: no answer within ${t.l}ms; the script may or may not have run`,M=`frame.clearCookies: this FKN page predates clearCookies; reload the app to load the current one`,N=`frame.clearCookies: this attachment reaches no site yet; attach a url, goto one, or declare it in domains`,P=3e4,F=`attachFrame: this FKN page predates storageState; reload the app to load the current one`,I=2e4,L=async(e,n)=>{if(typeof e.seed!=`function`)throw t.N(F,`storageState`,`cloud`);try{await D(e.seed(n),I,`attachFrame: the render proxy did not take the storageState seed`)}catch(e){throw t.O(e)?t.N(F,`storageState`,`cloud`):e}},ee=`frame.clearCookies: the render proxy did not answer within ${P}ms; the cookies may or may not be gone, and calling it again is safe`,R=e=>t.O(e)&&e.message===t.j(`addScriptTag`).message,z=!1,te=()=>{z||(z=!0,console.warn(`[fkn-frame] this FKN page predates frame messaging, so the page's messages and documents are never reported. Reloading the app loads the current one.`))},B=({from:e,origin:t,attach:n,signal:r})=>i=>{let a=r=>{if(r.source===null||r.source!==e()||r.origin!==t)return;let a=r.data;typeof a==`object`&&a&&a.type===`fkn-frame-message`&&a.attach===n&&typeof a.origin==`string`&&(a.kind===`message`?i({type:`message`,data:a.data,origin:a.origin,ports:r.ports}):a.kind===`document`&&i({type:`document`,origin:a.origin}))};return window.addEventListener(`message`,a,{signal:r}),()=>window.removeEventListener(`message`,a)},ne=e=>{if(typeof e!=`function`)return()=>Promise.resolve(e);let t=null;return()=>t??=e().catch(e=>{throw t=null,e})},V=({control:e,target:n,blank:r=!1,session:i,declaredHosts:a,approvedOrigins:o,attach:s,assertLive:c,guard:l,consent:u,onNavigated:d,relay:f})=>{let p=n,m=r&&i!==``,g=async()=>{if(!m)return!1;let t=typeof e.blank==`function`?await l(()=>e.blank()):``;return(typeof t!=`string`||t.split(`#`)[0]!==n.split(`#`)[0])&&(m=!1),m},_=Promise.resolve(),{gate:v,requestCategories:y,boundary:b}=x({session:i,declaredHosts:a,approvedOrigins:o,attach:s,assertLive:c,documentHost:typeof e.documentHost==`function`?()=>l(()=>e.documentHost()):void 0,current:()=>p,consent:ne(u),freshBlank:g});return t.y({backend:`cloud`,executor:{execute:(n,r,i)=>w.has(r)?Promise.reject(t.j(r,`cloud`)):(c(),l(()=>e.executeLocator(n,r,i))),highlight:async()=>{}},gate:v,requestPermissions:y,evaluate:async(n,r)=>(c(),await v({parts:[],operation:`evaluate`,args:[n],phase:`execute`}),D(l(()=>e.executeLocator([],`evaluate`,[n,r])),t.l,t.u)),addScriptTag:async(n,r)=>{c();let i=[n,r];await v({parts:[],operation:`addScriptTag`,args:i,phase:`execute`});try{await D(l(()=>e.executeLocator([],`addScriptTag`,i)),t.l,j)}catch(e){throw R(e)?t.N(A,`addScriptTag`,`cloud`):e}},clearCookies:async n=>{if(c(),typeof e.clearCookies!=`function`)throw t.N(M,`clearCookies`,`cloud`);if(b().length===0)throw t.k(N,`clearCookies`);await D(l(()=>e.clearCookies(n)),P,ee)},postMessage:(n,r,i)=>{if(c(),typeof e.messaging!=`function`)throw t.N(k,`postMessage`,`cloud`);if(r!==`*`&&!b().includes(new URL(r).hostname))throw t.k(h,`postMessage`);let{port1:a,port2:o}=new MessageChannel;a.postMessage({data:n,transfer:i},i);let s=[o,r],u=_.then(async()=>(await v({parts:[],operation:`postMessage`,args:s,phase:`execute`}),{answer:l(()=>e.executeLocator([],`postMessage`,s))}));return _=u.catch(()=>{}),u.then(async({answer:e})=>{await e})},listen:t=>(typeof e.messaging!=`function`&&te(),f(t)),goto:async(n,{timeout:r,...i}={})=>{let a=new URL(n,location.href).href;c(),m=!1;let s=(()=>{try{return new URL(a).origin}catch{return``}})(),u=s!==``&&!o.has(s);u&&o.add(s);try{await D(l(()=>e.goto(a,r===void 0?i:{...i,timeoutMs:r})),(r??3e4)+C,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`)}catch(e){throw u&&o.delete(s),t.c(e)}p=a,d()},url:()=>p})},re=250,ie=500,ae=65e3,oe=2e3,se=2e3,ce=2,le=2e3,ue=2e3,H=({origin:e,target:t,session:n,domains:r,attach:i})=>{let a=new URL(`/attach-window`,e);return a.searchParams.set(`attach`,i),t&&a.searchParams.set(`url`,t),n&&a.searchParams.set(`session`,n),r.length&&a.searchParams.set(`domains`,r.join(`,`)),a.href},de=(e,t)=>{let n=document.createElement(`iframe`),r=new URL(`/attach-jar`,e);return r.searchParams.set(`attach`,t),n.src=r.href,n.tabIndex=-1,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`style`,`display:none`),(document.body??document.documentElement).appendChild(n),n},fe=(e,t)=>{let n=new MutationObserver(()=>{e.isConnected||t.aborted||(n.disconnect(),console.warn(`cloud.attachFrame: the window's jar anchor was removed from this page, so a sign-in in the window no longer reaches this app's cookie jar`))});e.parentNode&&n.observe(e.parentNode,{childList:!0}),n.observe(document.documentElement,{childList:!0}),t.addEventListener(`abort`,()=>n.disconnect(),{once:!0})},U=()=>O(`cloud.attachFrame: the attached window closed, reloaded or left the page FKN attached; attach a fresh window`),W=()=>O(`cloud.attachFrame: the attached window stopped answering; attach a fresh window`),G=()=>O(`cloud.attachFrame: the window went away before it connected; attach a fresh window`),pe=()=>O(`cloud.attachFrame: the window closed before it connected. Either the user closed it, or this page's Cross-Origin-Opener-Policy cut its link to the window`),me=async(e,r,a)=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);let{domains:o=[],permissions:c}=e,{url:l,width:u,height:d}=t.s(e.window);if(window.origin===`null`)throw new t._(`opaque-opener`);let f=T(),m=crypto.randomUUID(),h=E(r),g=n.t(o),_=new Set;l&&_.add(new URL(l).origin);let v=r===`persistent`?de(f,m):null,y=window.open(H({origin:f,target:a===void 0?l:``,session:h,domains:g,attach:m}),`_blank`,`popup,width=${u},height=${d}`);if(!y)throw v?.remove(),new t.g;let b=new AbortController,x=!1,C=null,w=(e,t=!1)=>{if(C===null){C=e,b.abort(t?W():U());try{y.closed||y.postMessage({type:s.ATTACH_WINDOW_MESSAGE.detach,attach:m,...t?{unanswered:t}:{}},f)}catch{}v&&setTimeout(()=>v.remove(),ue)}};v&&fe(v,b.signal);let O=new Promise((e,t)=>{b.signal.addEventListener(`abort`,()=>t(b.signal.reason),{once:!0})});O.catch(()=>{});let k=O.then(()=>{},()=>{}),A=()=>{if(b.signal.aborted)throw b.signal.reason},j=e=>b.signal.aborted?Promise.reject(b.signal.reason):Promise.race([e(),O]),M=e=>e.source===y&&e.origin===f;window.addEventListener(`message`,e=>{if(!M(e))return;let n=e.data;typeof n==`object`&&n&&n.attach===m&&(n.type===s.ATTACH_WINDOW_MESSAGE.refused?w(new t._(n.reason)):n.type===s.ATTACH_WINDOW_MESSAGE.gone&&w(x?U():G()))},{signal:b.signal}),window.addEventListener(`pagehide`,()=>w(U()),{signal:b.signal});let N=()=>{try{y.postMessage({type:s.ATTACH_WINDOW_MESSAGE.hello,attach:m},f)}catch{}};N();let P=setInterval(N,re),F=setInterval(()=>{y.closed&&w(x?U():pe())},ie);b.signal.addEventListener(`abort`,()=>{clearInterval(P),clearInterval(F)},{once:!0});let I=async e=>{try{return await Promise.race([e,O])}catch(e){throw C??e}};try{let e=await I(D((0,p.expose)({},{key:s.ATTACH_WINDOW_KEY,transport:{emit:(e,t)=>y.postMessage(e,f,t??[]),receive:e=>{let t=t=>{M(t)&&e(t.data,{source:t.source,origin:t.origin})};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)}},unregisterSignal:b.signal,revivableModules:S(t.ft)}),s.WINDOW_HANDSHAKE_TIMEOUT_MS,`cloud.attachFrame: timed out connecting to the window`));x=!0,clearInterval(P);let n=0,r=setInterval(()=>{D(j(()=>e.ping()),se,`ping`).then(()=>{n=0},()=>{b.signal.aborted||(document.visibilityState===`hidden`?n=0:++n>=ce&&w(W(),!0))})},oe);b.signal.addEventListener(`abort`,()=>clearInterval(r),{once:!0}),await I(D(e.ready(),ae,`cloud.attachFrame: the window never became ready`)),a!==void 0&&await I(L(e,a)),i.r(`attached frame`,b.signal);let o=V({control:e,target:l,session:h,declaredHosts:g,approvedOrigins:_,attach:m,assertLive:A,guard:j,consent:{request:t=>j(()=>e.requestConsent(t)),ensure:t=>j(()=>e.requestConsent([t])).then(([e])=>e!==void 0&&e!==!1)},onNavigated:()=>{},relay:B({from:()=>y,origin:f,attach:m,signal:b.signal})}),u=null,d=Object.assign(o,{close:()=>u??=(async()=>{b.signal.aborted||await D(Promise.allSettled([j(()=>e.flushCookies()),j(()=>e.sweepStorage())]),le,`close`).catch(()=>{});try{y.close()}catch{}w(U())})(),closed:k});return a!==void 0&&l&&await I(d.goto(l)),c?.length&&await I(d.requestPermissions(c)),d}catch(e){let n=C??e;if(!(n instanceof t._))try{y.close()}catch{}throw w(n),n}},he=2e4,K=65e3,q=e=>!e||e===`about:blank`,ge=`cloud.attachFrame: this FKN page predates blank pages; reload the app to load the current one`,_e=`cloud.attachFrame: cookies: 'native' needs the FKN browser extension; the cloud render proxy has no browser cookies`,J=e=>e.split(`#`)[0]??``,Y=({iframe:e,lockdown:n,cookies:r,blank:i})=>{if(i===void 0)return``;if(typeof i!=`object`||!i)throw TypeError(`attachFrame: blank must be an object { url }`);let a=Object.keys(i).find(e=>e!==`url`);if(a!==void 0)throw TypeError(`attachFrame: blank takes { url }, not "${a}"`);let{url:o}=i,s=(()=>{try{return typeof o==`string`?new URL(o):null}catch{return null}})();if(!s||s.protocol!==`http:`&&s.protocol!==`https:`)throw TypeError(`attachFrame: blank.url must be an absolute http or https url, not "${String(o)}"`);let c=e.getAttribute(`src`)??``;if(!q(c))throw TypeError(`attachFrame: blank needs an iframe with no src; this one has "${c}"`);if(n)throw TypeError(`attachFrame: blank does not combine with lockdown`);if(r===`native`)throw TypeError(`attachFrame: blank runs on the cloud render proxy, which has no browser cookies; pass cookies: 'persistent' or 'ephemeral'`);if(t.x(s.href),!Ee())throw Error(`attachFrame: a blank page is served by the cloud render proxy, which this build does not configure`);return s.href},ve=({target:e,blank:t,session:n,domains:r,attach:i})=>{let a=new URL(`/attach-frame`,T());return t?a.searchParams.set(`blank`,t):e&&a.searchParams.set(`url`,e),n&&a.searchParams.set(`session`,n),r.length&&a.searchParams.set(`domains`,r.join(`,`)),a.searchParams.set(`attach`,i),a.href},ye=(e,t)=>{let n=()=>{a(),t()},r=e.parentNode,i=new MutationObserver(()=>{(!e.isConnected||e.parentNode!==r)&&(a(),t())}),a=()=>{window.removeEventListener(`pagehide`,n),i.disconnect()};window.addEventListener(`pagehide`,n,{once:!0}),r&&i.observe(r,{childList:!0}),e.isConnected||(a(),t())},be=()=>O(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),xe=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},Se=[300,1200,4e3],X=e=>{let t=()=>{if(!e.isConnected)return;let t=e.style.height,n=e.getBoundingClientRect();n.height&&(e.style.height=`${n.height-1}px`,setTimeout(()=>{e.style.height=t},50))};t();for(let e of Se)setTimeout(t,e)},Ce=e=>{let t=e.getAttribute(`sandbox`);if(t===null)return;let n=new Set(t.toLowerCase().split(/\s+/).filter(Boolean)),r=[`allow-scripts`,`allow-same-origin`].filter(e=>!n.has(e));if(r.length)throw Error(`cloud.attachFrame: the iframe's sandbox attribute must include ${r.join(` and `)} for the render proxy to load`)},we=async(e,n)=>{let r=typeof e.blank==`function`?await D(e.blank(),K,`cloud.attachFrame: the render proxy never became ready`):``;if(typeof r!=`string`||J(r)!==J(n))throw t.N(ge,`blank`,`cloud`)},Te=async(e,a,o)=>{let c=Y(e),{iframe:l,domains:u=[],permissions:d}=e;if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(!l.isConnected)throw Error(`cloud.attachFrame: the iframe must be connected to the document before attaching`);Ce(l);let f=l.getAttribute(`src`)??``,h=(()=>{if(q(f))return null;try{return new URL(l.src||f,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${f}`)}})();if(h){let e=new URL(`/attach-frame`,T());if(h.origin===e.origin&&h.pathname===e.pathname)throw Error(`cloud.attachFrame: this iframe is already attached; navigate with the Frame returned by that attach or use a fresh iframe`)}let g=h?.href??``;g&&t.x(g);let _=o===void 0?g:``,v=E(a),y=n.t(u),b=new Set;try{b.add(new URL(c||g).origin)}catch{}let x=new AbortController,C=l.referrerPolicy,w=l.allow,O=crypto.randomUUID();if(l.referrerPolicy=`origin`,l.allow=xe(r.m(),l.allow),l.src=ve({target:_,blank:c,session:v,domains:y,attach:O}),!l.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let e=await D((0,p.expose)({},{key:s.ATTACH_FRAME_KEY,origin:T(),transport:{receive:window,emit:l.contentWindow},unregisterSignal:x.signal,revivableModules:S(t.ft)}),he,`cloud.attachFrame: timed out connecting to the render proxy page`);await D(e.ready(),K,`cloud.attachFrame: the render proxy never became ready`),c&&await we(e,c),o!==void 0&&await L(e,o),(g||c)&&X(l),ye(l,()=>x.abort()),i.r(`attached frame`,x.signal);let n=l.contentWindow,r=V({control:e,target:c||g,blank:c!==``,session:v,declaredHosts:y,approvedOrigins:b,attach:O,assertLive:()=>{if(x.signal.aborted||!l.isConnected||l.contentWindow!==n)throw x.abort(),be()},guard:e=>e(),consent:m,onNavigated:()=>X(l),relay:B({from:()=>n,origin:T(),attach:O,signal:x.signal})});return o!==void 0&&g&&await r.goto(g),d?.length&&await r.requestPermissions(d),r}catch(e){throw x.abort(),l.referrerPolicy=C,l.allow=w,l.src=_||`about:blank`,e}},Z=(async e=>{let{kind:n,cookies:r,storageState:i}=t.o(e);if(r===`native`)throw TypeError(_e);return n===`window`?me(e,r,i):Te(e,r,i)}),Ee=()=>typeof window<`u`&&!0,Q=async()=>{let e=await r.o.then(e=>e.cloud.quota());return{premium:e.premium,overQuota:e.overQuota,throttled:e.overQuota&&!e.premium,usedBytes:e.usedBytes,limitBytes:e.limitBytes,remainingBytes:e.remaining,bytesPerSecond:e.bytesPerSecond,bitsPerSecond:e.bytesPerSecond*8}},De=e.t({attachFrame:()=>Z,available:()=>$,dgram:()=>d.t,dns:()=>c.t,fetch:()=>a.t,fs:()=>l.t,http:()=>f.t,net:()=>u.t,quota:()=>Q}),$=()=>r.l;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
1
+ const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-BiQ6cOZ7.cjs"),n=require("./hosts-GNBhZO3-.cjs"),r=require("./api-BmaUJUUp.cjs"),i=require("./busy-BXbVH595.cjs"),a=require("./proxy-Blzm-Dc1.cjs"),o=require("./attach-policy.cjs"),s=require("./contract.cjs"),c=require("./dns.cjs"),l=require("./cloud/fs.cjs"),u=require("./net.cjs"),d=require("./dgram.cjs"),f=require("./http.cjs");let p=require("osra");var m=async()=>{let e=()=>r.s(`frame consent`);try{let t=await e();return{request:typeof t.frameConsent.request==`function`?t.frameConsent.request:void 0,ensure:t.frameConsent.ensure}}catch(t){if(!(t instanceof r.n))throw t;return{request:void 0,ensure:t=>e().then(e=>e.frameConsent.ensure(t))}}},h=`frame: this frame no longer holds the document the app attached it to`,g=!1,_=()=>{g||(g=!0,console.warn(`[fkn-frame] this FKN broker is too old to ask for permission categories, so nothing was asked for upfront and each capability is asked for as it is first used. Reloading the page picks up the current broker.`))},v=e=>[...e].flatMap(e=>{try{return[new URL(e).hostname]}catch{return[]}}),y=e=>typeof e?.reason==`string`?{reason:e.reason}:{},b=(e,t,n)=>n===null?`frame.${e}: the user did not grant ${t} here`:`frame.${e}: the user did not grant ${t} on ${n}`,x=e=>{let{assertLive:r,attach:i,consent:a,current:s,declaredHosts:c,documentHost:l,freshBlank:u,session:d,approvedOrigins:f}=e,p=new Set,m=()=>{try{return new URL(s()).hostname}catch{return``}},g=async()=>l?await l():m(),x=()=>n.t([...c,...v(f)]),S=async(e,t)=>(await e([t]))[0]??!1;return{gate:async({operation:e,args:s,phase:l})=>{r();let _=n.m(e,s);if(_===null)return;let v=t.h(_);if(v===void 0||v===`auto`)return;if(e===`fetch`){let e=o.frameFetchVerdict({session:d,declaredHosts:c,approvedOrigins:f},l===`ensure`?void 0:s[0],{classifier:`fetchTarget`});if(l===`ensure`&&!d)throw t.k(e.kind===`refuse`?e.reason:``,`fetch`);if(l!==`ensure`&&e.kind===`refuse`)throw t.k(e.reason,`fetch`);let{request:r,ensure:i}=await a();if(!r){if(e.kind===`refuse`)throw t.k(e.reason,`fetch`);if(!await i({scope:n.c(s[0],s[1]).scope,hosts:e.promptHosts}))throw t.k(`frame.fetch: the user did not grant this`,`fetch`);return}let u=e.kind===`consent`?e.targetHost:await g(),p=n.t([u,...c]);if(!p.length)throw t.k(`frame: navigate the frame before fetch`,`fetch`);if(await S(r,{category:`network`,hosts:p,...y(t.T(s))})===!1)throw t.k(b(`fetch`,`network`,u||null),`fetch`);return}let C=await g();if(!C)throw t.k(`frame: navigate the frame before ${e}`,e);if(!x().includes(C))throw t.k(h,e);let w=t.m(_);if(w===void 0||w===`evaluation`&&C===m()&&await u?.()||v===`critical`&&p.has(`${_} ${C}`))return;let{request:T}=await a();if(!T)return;let E=n.t([C,...c]),D=y(t.T(s)),O=v===`critical`?{key:_,hosts:E,attach:i,...D}:{category:w,hosts:E,...D},k=await S(T,O);if(k===!1)throw t.k(b(e,w,null),e);if(k===`once`&&l!==`ensure`)for(let e of E)p.add(`${_} ${e}`)},requestCategories:async e=>{r(),t.f(`frame.requestPermissions`,e);let o=await g(),s=n.t(o?[o,...c]:c);if(!s.length)throw TypeError(`frame.requestPermissions: navigate the frame or declare domains first`);let l=e.map(e=>{let n=e.key;return n===void 0?{named:void 0,critical:!1,category:e.category}:{named:n,critical:t.h(n)===`critical`,category:t.p(n)}}),u=({named:e,critical:t,category:n},r)=>({category:n,...t?{key:e}:{},hosts:s,allow:r}),{request:d}=await a();if(!d)return _(),l.map(e=>u(e,!1));let f=await d(l.map(({named:t,critical:n,category:r},a)=>{let o=y(e[a]);return n?{key:t,hosts:s,attach:i,...o}:{category:r,hosts:s,...o}}));return l.map((e,t)=>u(e,f[t]!==void 0&&f[t]!==!1))},boundary:x}},S=e=>e,C=5e3,w=new Set([]),T=()=>`https://fkn.app`,E=e=>e===`persistent`?``:`incognito-${crypto.randomUUID()}`,D=(e,n,r)=>{let i,a=new Promise((e,a)=>{i=setTimeout(()=>a(typeof r==`string`?new t.E(r):r()),n)});return Promise.race([e,a]).finally(()=>clearTimeout(i))},O=e=>Object.assign(Error(e),{name:t.D}),k=`frame.postMessage: this FKN page predates frame messaging; reload the app to load the current one`,A=`frame.addScriptTag: this render proxy predates addScriptTag; reload the app`,j=`frame.addScriptTag: no answer within ${t.l}ms; the script may or may not have run`,M=`frame.clearCookies: this FKN page predates clearCookies; reload the app to load the current one`,N=`frame.clearCookies: this attachment reaches no site yet; attach a url, goto one, or declare it in domains`,P=3e4,F=`attachFrame: this FKN page predates storageState; reload the app to load the current one`,I=2e4,L=async(e,n)=>{if(typeof e.seed!=`function`)throw t.N(F,`storageState`,`cloud`);try{await D(e.seed(n),I,`attachFrame: the render proxy did not take the storageState seed`)}catch(e){throw t.O(e)?t.N(F,`storageState`,`cloud`):e}},ee=`frame.clearCookies: the render proxy did not answer within ${P}ms; the cookies may or may not be gone, and calling it again is safe`,R=e=>t.O(e)&&e.message===t.j(`addScriptTag`).message,z=!1,te=()=>{z||(z=!0,console.warn(`[fkn-frame] this FKN page predates frame messaging, so the page's messages and documents are never reported. Reloading the app loads the current one.`))},B=({from:e,origin:t,attach:n,signal:r})=>i=>{let a=r=>{if(r.source===null||r.source!==e()||r.origin!==t)return;let a=r.data;typeof a==`object`&&a&&a.type===`fkn-frame-message`&&a.attach===n&&typeof a.origin==`string`&&(a.kind===`message`?i({type:`message`,data:a.data,origin:a.origin,ports:r.ports}):a.kind===`document`&&i({type:`document`,origin:a.origin}))};return window.addEventListener(`message`,a,{signal:r}),()=>window.removeEventListener(`message`,a)},ne=e=>{if(typeof e!=`function`)return()=>Promise.resolve(e);let t=null;return()=>t??=e().catch(e=>{throw t=null,e})},V=({control:e,target:n,blank:r=!1,session:i,declaredHosts:a,approvedOrigins:o,attach:s,assertLive:c,guard:l,consent:u,onNavigated:d,relay:f})=>{let p=n,m=r&&i!==``,g=async()=>{if(!m)return!1;let t=typeof e.blank==`function`?await l(()=>e.blank()):``;return(typeof t!=`string`||t.split(`#`)[0]!==n.split(`#`)[0])&&(m=!1),m},_=Promise.resolve(),{gate:v,requestCategories:y,boundary:b}=x({session:i,declaredHosts:a,approvedOrigins:o,attach:s,assertLive:c,documentHost:typeof e.documentHost==`function`?()=>l(()=>e.documentHost()):void 0,current:()=>p,consent:ne(u),freshBlank:g});return t.y({backend:`cloud`,executor:{execute:(n,r,i)=>w.has(r)?Promise.reject(t.j(r,`cloud`)):(c(),l(()=>e.executeLocator(n,r,i))),highlight:async()=>{}},gate:v,requestPermissions:y,evaluate:async(n,r)=>(c(),await v({parts:[],operation:`evaluate`,args:[n],phase:`execute`}),D(l(()=>e.executeLocator([],`evaluate`,[n,r])),t.l,t.u)),addScriptTag:async(n,r)=>{c();let i=[n,r];await v({parts:[],operation:`addScriptTag`,args:i,phase:`execute`});try{await D(l(()=>e.executeLocator([],`addScriptTag`,i)),t.l,j)}catch(e){throw R(e)?t.N(A,`addScriptTag`,`cloud`):e}},clearCookies:async n=>{if(c(),typeof e.clearCookies!=`function`)throw t.N(M,`clearCookies`,`cloud`);if(b().length===0)throw t.k(N,`clearCookies`);await D(l(()=>e.clearCookies(n)),P,ee)},postMessage:(n,r,i)=>{if(c(),typeof e.messaging!=`function`)throw t.N(k,`postMessage`,`cloud`);if(r!==`*`&&!b().includes(new URL(r).hostname))throw t.k(h,`postMessage`);let{port1:a,port2:o}=new MessageChannel;a.postMessage({data:n,transfer:i},i);let s=[o,r],u=_.then(async()=>(await v({parts:[],operation:`postMessage`,args:s,phase:`execute`}),{answer:l(()=>e.executeLocator([],`postMessage`,s))}));return _=u.catch(()=>{}),u.then(async({answer:e})=>{await e})},listen:t=>(typeof e.messaging!=`function`&&te(),f(t)),goto:async(n,{timeout:r,...i}={})=>{let a=new URL(n,location.href).href;c(),m=!1;let s=(()=>{try{return new URL(a).origin}catch{return``}})(),u=s!==``&&!o.has(s);u&&o.add(s);try{await D(l(()=>e.goto(a,r===void 0?i:{...i,timeoutMs:r})),(r??3e4)+C,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`)}catch(e){throw u&&o.delete(s),t.c(e)}p=a,d()},url:()=>p})},re=250,ie=500,ae=65e3,oe=2e3,se=2e3,ce=2,le=2e3,ue=2e3,H=({origin:e,target:t,session:n,domains:r,attach:i})=>{let a=new URL(`/attach-window`,e);return a.searchParams.set(`attach`,i),t&&a.searchParams.set(`url`,t),n&&a.searchParams.set(`session`,n),r.length&&a.searchParams.set(`domains`,r.join(`,`)),a.href},de=(e,t)=>{let n=document.createElement(`iframe`),r=new URL(`/attach-jar`,e);return r.searchParams.set(`attach`,t),n.src=r.href,n.tabIndex=-1,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`style`,`display:none`),(document.body??document.documentElement).appendChild(n),n},fe=(e,t)=>{let n=new MutationObserver(()=>{e.isConnected||t.aborted||(n.disconnect(),console.warn(`cloud.attachFrame: the window's jar anchor was removed from this page, so a sign-in in the window no longer reaches this app's cookie jar`))});e.parentNode&&n.observe(e.parentNode,{childList:!0}),n.observe(document.documentElement,{childList:!0}),t.addEventListener(`abort`,()=>n.disconnect(),{once:!0})},U=()=>O(`cloud.attachFrame: the attached window closed, reloaded or left the page FKN attached; attach a fresh window`),W=()=>O(`cloud.attachFrame: the attached window stopped answering; attach a fresh window`),G=()=>O(`cloud.attachFrame: the window went away before it connected; attach a fresh window`),pe=()=>O(`cloud.attachFrame: the window closed before it connected. Either the user closed it, or this page's Cross-Origin-Opener-Policy cut its link to the window`),me=async(e,r,a)=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);let{domains:o=[],permissions:c}=e,{url:l,width:u,height:d}=t.s(e.window);if(window.origin===`null`)throw new t._(`opaque-opener`);let f=T(),m=crypto.randomUUID(),h=E(r),g=n.t(o),_=new Set;l&&_.add(new URL(l).origin);let v=r===`persistent`?de(f,m):null,y=window.open(H({origin:f,target:a===void 0?l:``,session:h,domains:g,attach:m}),`_blank`,`popup,width=${u},height=${d}`);if(!y)throw v?.remove(),new t.g;let b=new AbortController,x=!1,C=null,w=(e,t=!1)=>{if(C===null){C=e,b.abort(t?W():U());try{y.closed||y.postMessage({type:s.ATTACH_WINDOW_MESSAGE.detach,attach:m,...t?{unanswered:t}:{}},f)}catch{}v&&setTimeout(()=>v.remove(),ue)}};v&&fe(v,b.signal);let O=new Promise((e,t)=>{b.signal.addEventListener(`abort`,()=>t(b.signal.reason),{once:!0})});O.catch(()=>{});let k=O.then(()=>{},()=>{}),A=()=>{if(b.signal.aborted)throw b.signal.reason},j=e=>b.signal.aborted?Promise.reject(b.signal.reason):Promise.race([e(),O]),M=e=>e.source===y&&e.origin===f;window.addEventListener(`message`,e=>{if(!M(e))return;let n=e.data;typeof n==`object`&&n&&n.attach===m&&(n.type===s.ATTACH_WINDOW_MESSAGE.refused?w(new t._(n.reason)):n.type===s.ATTACH_WINDOW_MESSAGE.gone&&w(x?U():G()))},{signal:b.signal}),window.addEventListener(`pagehide`,()=>w(U()),{signal:b.signal});let N=()=>{try{y.postMessage({type:s.ATTACH_WINDOW_MESSAGE.hello,attach:m},f)}catch{}};N();let P=setInterval(N,re),F=setInterval(()=>{y.closed&&w(x?U():pe())},ie);b.signal.addEventListener(`abort`,()=>{clearInterval(P),clearInterval(F)},{once:!0});let I=async e=>{try{return await Promise.race([e,O])}catch(e){throw C??e}};try{let e=await I(D((0,p.expose)({},{key:s.ATTACH_WINDOW_KEY,transport:{emit:(e,t)=>y.postMessage(e,f,t??[]),receive:e=>{let t=t=>{M(t)&&e(t.data,{source:t.source,origin:t.origin})};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)}},unregisterSignal:b.signal,revivableModules:S(t.ft)}),s.WINDOW_HANDSHAKE_TIMEOUT_MS,`cloud.attachFrame: timed out connecting to the window`));x=!0,clearInterval(P);let n=0,r=setInterval(()=>{D(j(()=>e.ping()),se,`ping`).then(()=>{n=0},()=>{b.signal.aborted||(document.visibilityState===`hidden`?n=0:++n>=ce&&w(W(),!0))})},oe);b.signal.addEventListener(`abort`,()=>clearInterval(r),{once:!0}),await I(D(e.ready(),ae,`cloud.attachFrame: the window never became ready`)),a!==void 0&&await I(L(e,a)),i.r(`attached frame`,b.signal);let o=V({control:e,target:l,session:h,declaredHosts:g,approvedOrigins:_,attach:m,assertLive:A,guard:j,consent:{request:t=>j(()=>e.requestConsent(t)),ensure:t=>j(()=>e.requestConsent([t])).then(([e])=>e!==void 0&&e!==!1)},onNavigated:()=>{},relay:B({from:()=>y,origin:f,attach:m,signal:b.signal})}),u=null,d=Object.assign(o,{close:()=>u??=(async()=>{b.signal.aborted||await D(Promise.allSettled([j(()=>e.flushCookies()),j(()=>e.sweepStorage())]),le,`close`).catch(()=>{});try{y.close()}catch{}w(U())})(),closed:k});return a!==void 0&&l&&await I(d.goto(l)),c?.length&&await I(d.requestPermissions(c)),d}catch(e){let n=C??e;if(!(n instanceof t._))try{y.close()}catch{}throw w(n),n}},he=2e4,K=65e3,q=e=>!e||e===`about:blank`,ge=`cloud.attachFrame: this FKN page predates blank pages; reload the app to load the current one`,_e=`cloud.attachFrame: cookies: 'native' needs the FKN browser extension; the cloud render proxy has no browser cookies`,J=e=>e.split(`#`)[0]??``,Y=({iframe:e,lockdown:n,cookies:r,blank:i})=>{if(i===void 0)return``;if(typeof i!=`object`||!i)throw TypeError(`attachFrame: blank must be an object { url }`);let a=Object.keys(i).find(e=>e!==`url`);if(a!==void 0)throw TypeError(`attachFrame: blank takes { url }, not "${a}"`);let{url:o}=i,s=(()=>{try{return typeof o==`string`?new URL(o):null}catch{return null}})();if(!s||s.protocol!==`http:`&&s.protocol!==`https:`)throw TypeError(`attachFrame: blank.url must be an absolute http or https url, not "${String(o)}"`);let c=e.getAttribute(`src`)??``;if(!q(c))throw TypeError(`attachFrame: blank needs an iframe with no src; this one has "${c}"`);if(n)throw TypeError(`attachFrame: blank does not combine with lockdown`);if(r===`native`)throw TypeError(`attachFrame: blank runs on the cloud render proxy, which has no browser cookies; pass cookies: 'persistent' or 'ephemeral'`);if(t.x(s.href),!Ee())throw Error(`attachFrame: a blank page is served by the cloud render proxy, which this build does not configure`);return s.href},ve=({target:e,blank:t,session:n,domains:r,attach:i})=>{let a=new URL(`/attach-frame`,T());return t?a.searchParams.set(`blank`,t):e&&a.searchParams.set(`url`,e),n&&a.searchParams.set(`session`,n),r.length&&a.searchParams.set(`domains`,r.join(`,`)),a.searchParams.set(`attach`,i),a.href},ye=(e,t)=>{let n=()=>{a(),t()},r=e.parentNode,i=new MutationObserver(()=>{(!e.isConnected||e.parentNode!==r)&&(a(),t())}),a=()=>{window.removeEventListener(`pagehide`,n),i.disconnect()};window.addEventListener(`pagehide`,n,{once:!0}),r&&i.observe(r,{childList:!0}),e.isConnected||(a(),t())},be=()=>O(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),xe=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},Se=[300,1200,4e3],X=e=>{let t=()=>{if(!e.isConnected)return;let t=e.style.height,n=e.getBoundingClientRect();n.height&&(e.style.height=`${n.height-1}px`,setTimeout(()=>{e.style.height=t},50))};t();for(let e of Se)setTimeout(t,e)},Ce=e=>{let t=e.getAttribute(`sandbox`);if(t===null)return;let n=new Set(t.toLowerCase().split(/\s+/).filter(Boolean)),r=[`allow-scripts`,`allow-same-origin`].filter(e=>!n.has(e));if(r.length)throw Error(`cloud.attachFrame: the iframe's sandbox attribute must include ${r.join(` and `)} for the render proxy to load`)},we=async(e,n)=>{let r=typeof e.blank==`function`?await D(e.blank(),K,`cloud.attachFrame: the render proxy never became ready`):``;if(typeof r!=`string`||J(r)!==J(n))throw t.N(ge,`blank`,`cloud`)},Te=async(e,a,o)=>{let c=Y(e),{iframe:l,domains:u=[],permissions:d}=e;if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(!l.isConnected)throw Error(`cloud.attachFrame: the iframe must be connected to the document before attaching`);Ce(l);let f=l.getAttribute(`src`)??``,h=(()=>{if(q(f))return null;try{return new URL(l.src||f,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${f}`)}})();if(h){let e=new URL(`/attach-frame`,T());if(h.origin===e.origin&&h.pathname===e.pathname)throw Error(`cloud.attachFrame: this iframe is already attached; navigate with the Frame returned by that attach or use a fresh iframe`)}let g=h?.href??``;g&&t.x(g);let _=o===void 0?g:``,v=E(a),y=n.t(u),b=new Set;try{b.add(new URL(c||g).origin)}catch{}let x=new AbortController,C=l.referrerPolicy,w=l.allow,O=crypto.randomUUID();if(l.referrerPolicy=`origin`,l.allow=xe(r.m(),l.allow),l.src=ve({target:_,blank:c,session:v,domains:y,attach:O}),!l.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let e=await D((0,p.expose)({},{key:s.ATTACH_FRAME_KEY,origin:T(),transport:{receive:window,emit:l.contentWindow},unregisterSignal:x.signal,revivableModules:S(t.ft)}),he,`cloud.attachFrame: timed out connecting to the render proxy page`);await D(e.ready(),K,`cloud.attachFrame: the render proxy never became ready`),c&&await we(e,c),o!==void 0&&await L(e,o),(g||c)&&X(l),ye(l,()=>x.abort()),i.r(`attached frame`,x.signal);let n=l.contentWindow,r=V({control:e,target:c||g,blank:c!==``,session:v,declaredHosts:y,approvedOrigins:b,attach:O,assertLive:()=>{if(x.signal.aborted||!l.isConnected||l.contentWindow!==n)throw x.abort(),be()},guard:e=>e(),consent:m,onNavigated:()=>X(l),relay:B({from:()=>n,origin:T(),attach:O,signal:x.signal})});return o!==void 0&&g&&await r.goto(g),d?.length&&await r.requestPermissions(d),r}catch(e){throw x.abort(),l.referrerPolicy=C,l.allow=w,l.src=_||`about:blank`,e}},Z=(async e=>{let{kind:n,cookies:r,storageState:i}=t.o(e);if(r===`native`)throw TypeError(_e);return n===`window`?me(e,r,i):Te(e,r,i)}),Ee=()=>typeof window<`u`&&!0,Q=async()=>{let e=await r.o.then(e=>e.cloud.quota());return{premium:e.premium,overQuota:e.overQuota,throttled:e.overQuota&&!e.premium,usedBytes:e.usedBytes,limitBytes:e.limitBytes,remainingBytes:e.remaining,bytesPerSecond:e.bytesPerSecond,bitsPerSecond:e.bytesPerSecond*8}},De=e.t({attachFrame:()=>Z,available:()=>$,dgram:()=>d.t,dns:()=>c.t,fetch:()=>a.t,fs:()=>l.t,http:()=>f.t,net:()=>u.t,quota:()=>Q}),$=()=>r.l;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
@@ -1,9 +1,9 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
2
  import { D as t, E as n, N as r, O as i, T as a, _ as o, c as s, f as c, ft as l, g as u, h as d, j as f, k as p, l as m, m as h, o as g, p as _, s as v, u as y, x as b, y as x } from "./lib-BGAmzIcU.js";
3
3
  import { c as S, m as C, t as w } from "./hosts-t7CKGTRz.js";
4
- import { l as T, m as E, n as D, o as O, s as k } from "./api-BYtMzj8u.js";
4
+ import { l as T, m as E, n as D, o as O, s as k } from "./api-DEfkbHGB.js";
5
5
  import { r as A } from "./busy-DsMWrSzc.js";
6
- import { t as j } from "./proxy-vAsYHMIa.js";
6
+ import { t as j } from "./proxy-C2HY5Ybc.js";
7
7
  import { frameFetchVerdict as M } from "./attach-policy.js";
8
8
  import { ATTACH_FRAME_KEY as N, ATTACH_WINDOW_KEY as ee, ATTACH_WINDOW_MESSAGE as P, WINDOW_HANDSHAKE_TIMEOUT_MS as te } from "./contract.js";
9
9
  import { t as ne } from "./dns.js";
package/cloud.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./proxy-CL8j00ao.cjs"),t=require("./cloud-CI6WMBPa.cjs"),n=require("./dns.cjs"),r=require("./cloud/fs.cjs"),i=require("./net.cjs"),a=require("./dgram.cjs"),o=require("./http.cjs");exports.attachFrame=t.i,exports.available=t.t,Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return n.t}}),exports.fetch=e.t,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return r.t}}),Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return i.t}}),exports.quota=t.r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./proxy-Blzm-Dc1.cjs"),t=require("./cloud-C_EPPfe_.cjs"),n=require("./dns.cjs"),r=require("./cloud/fs.cjs"),i=require("./net.cjs"),a=require("./dgram.cjs"),o=require("./http.cjs");exports.attachFrame=t.i,exports.available=t.t,Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return n.t}}),exports.fetch=e.t,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return r.t}}),Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return i.t}}),exports.quota=t.r;
package/cloud.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { t as cloudFetch } from "./proxy-ClDBa5il.js";
2
- import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-S8hQywqV.js";
1
+ import { t as cloudFetch } from "./proxy-8hIHeEHD.js";
2
+ import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-BslRIoKs.js";
3
3
  import { t as dns_d_exports } from "./dns.js";
4
4
  import { n as fs_d_exports } from "./fs-DCJAYoYy.js";
5
- import { s as net_d_exports } from "./net-B8YQuB9E.js";
5
+ import { s as net_d_exports } from "./net-eEjhJ0AE.js";
6
6
  import { t as dgram_d_exports } from "./dgram.js";
7
7
  import { t as http_d_exports } from "./http.js";
8
8
  export { type QuotaStatus, attachFrame, available, dgram_d_exports as dgram, dns_d_exports as dns, cloudFetch as fetch, fs_d_exports as fs, http_d_exports as http, net_d_exports as net, quota };
package/cloud.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as e } from "./proxy-vAsYHMIa.js";
2
- import { i as t, r as n, t as r } from "./cloud-8sJ1Sg8n.js";
1
+ import { t as e } from "./proxy-C2HY5Ybc.js";
2
+ import { i as t, r as n, t as r } from "./cloud-DTpFBbBH.js";
3
3
  import { t as i } from "./dns.js";
4
4
  import { t as a } from "./cloud/fs.js";
5
5
  import { t as o } from "./net.js";