@fkn/lib 0.9.64 → 0.9.66

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 (165) hide show
  1. package/README.md +1 -2
  2. package/account-Bm7uIcQo.d.ts +39 -0
  3. package/account-Uh0-1Cbp.js +22 -0
  4. package/{account-generation-BiZxPztj.cjs → account-generation-ACCBzaI-.cjs} +1 -1
  5. package/{account-generation-DvRuJDa2.js → account-generation-BKHNe-jL.js} +2 -3
  6. package/account-m2iCmNui.cjs +1 -0
  7. package/{account-storage-D8CBG1cv.js → account-storage-BmCVutNL.js} +4 -5
  8. package/{account-storage-Co9IvkPr.d.ts → account-storage-UmSfF63A.d.ts} +1 -66
  9. package/{account-storage-DpHBgeX5.cjs → account-storage-dYWDpqsr.cjs} +1 -1
  10. package/account.cjs +1 -1
  11. package/account.d.ts +3 -40
  12. package/account.js +1 -23
  13. package/{api-xh6lzApn.d.ts → api-0Yp9uZcV.d.ts} +3 -7
  14. package/{api-BvJu2X1L.js → api-DRglK7ft.js} +19 -21
  15. package/{api-CrUO33y-.cjs → api-DrvhPN56.cjs} +1 -1
  16. package/api.cjs +1 -1
  17. package/api.d.ts +2 -2
  18. package/api.js +1 -2
  19. package/attach-policy.d.ts +0 -4
  20. package/attach-policy.js +2 -3
  21. package/{broker-frame-B31OXcnH.js → broker-frame-vjSpBa8d.js} +1 -2
  22. package/broker-frame.d.ts +1 -3
  23. package/broker-frame.js +1 -2
  24. package/{busy-DsMWrSzc.js → busy-C1JPjoZ_.js} +1 -2
  25. package/cloud/dgram.cjs +1 -1
  26. package/cloud/dgram.d.ts +1 -1
  27. package/cloud/dgram.js +1 -2
  28. package/cloud/dns.cjs +1 -1
  29. package/cloud/dns.d.ts +2 -2
  30. package/cloud/dns.js +1 -2
  31. package/cloud/fetch.cjs +1 -1
  32. package/cloud/fetch.d.ts +1 -1
  33. package/cloud/fetch.js +1 -2
  34. package/cloud/fs/promises.cjs +1 -1
  35. package/cloud/fs/promises.d.ts +3 -5
  36. package/cloud/fs/promises.js +2 -3
  37. package/cloud/fs.cjs +1 -1
  38. package/cloud/fs.d.ts +4 -4
  39. package/cloud/fs.js +4 -34
  40. package/cloud/http.cjs +1 -1
  41. package/cloud/http.d.ts +1 -1
  42. package/cloud/http.js +1 -2
  43. package/cloud/net.cjs +1 -1
  44. package/cloud/net.d.ts +1 -1
  45. package/cloud/net.js +3 -3
  46. package/{cloud-CI7FFRMC.d.ts → cloud-BoH54gaM.d.ts} +7 -11
  47. package/{cloud-FW59_g8F.js → cloud-C7StNncS.js} +15 -16
  48. package/cloud-TN0eDUy3.cjs +1 -0
  49. package/cloud.cjs +1 -1
  50. package/cloud.d.ts +7 -7
  51. package/cloud.js +7 -7
  52. package/connect-button-2FmOM8ai.d.ts +2 -0
  53. package/{connect-button-DtsN3X1J.js → connect-button-C1wKkIhh.js} +1 -2
  54. package/{contract-BGMJVvTg.d.ts → contract-0rua6Wsh.d.ts} +11 -6
  55. package/contract.d.ts +3 -3
  56. package/contract.js +1 -2
  57. package/desktop-DOubT4ES.d.ts +57 -0
  58. package/desktop-vXKU4wEK.cjs +1 -0
  59. package/desktop-xTT7ciGX.js +50 -0
  60. package/desktop.cjs +1 -1
  61. package/desktop.d.ts +2 -58
  62. package/desktop.js +1 -51
  63. package/dgram-BBbLokVF.js +397 -0
  64. package/dgram-BYk-QDHW.d.ts +118 -0
  65. package/dgram-D9ljiUFh.cjs +1 -0
  66. package/dgram.cjs +1 -1
  67. package/dgram.d.ts +2 -119
  68. package/dgram.js +1 -410
  69. package/dns-2v96zoEh.cjs +1 -0
  70. package/dns-DyB4K2oE.d.ts +9 -0
  71. package/dns-o8DLFjP1.js +5 -0
  72. package/dns.cjs +1 -1
  73. package/dns.d.ts +3 -10
  74. package/dns.js +1 -6
  75. package/extension-BXBjpypy.cjs +1 -0
  76. package/{extension-Chmpunqf.js → extension-D5UMnEmQ.js} +9 -11
  77. package/{extension-C1bcizcn.d.ts → extension-D98KM8W7.d.ts} +1 -27
  78. package/extension.cjs +1 -1
  79. package/extension.d.ts +2 -2
  80. package/extension.js +2 -2
  81. package/fs/promises.cjs +1 -1
  82. package/fs/promises.d.ts +2 -4
  83. package/fs/promises.js +2 -3
  84. package/fs--MLHvMW-.cjs +1 -0
  85. package/fs-BX_ghRy0.cjs +1 -0
  86. package/fs-BnWXGRik.js +33 -0
  87. package/{fs-DCJAYoYy.d.ts → fs-ChOYC6VD.d.ts} +3 -4
  88. package/{fs-Djuaj5pQ.js → fs-Cw7CcUhx.js} +17 -41
  89. package/fs.cjs +1 -1
  90. package/fs.d.ts +4 -4
  91. package/fs.js +2 -2
  92. package/{hosts-t7CKGTRz.js → hosts-HUfgMimI.js} +1 -2
  93. package/http-BE3UBktN.cjs +9 -0
  94. package/http-CDhG4bUc.d.ts +187 -0
  95. package/http-DIDjdm08.js +523 -0
  96. package/http.cjs +1 -9
  97. package/http.d.ts +2 -188
  98. package/http.js +1 -542
  99. package/index-CUWTpQKP.d.ts +87 -0
  100. package/{index-BQgZVQl7.d.ts → index-CcVwh9yz.d.ts} +0 -2
  101. package/{index-C5DdoMGo.d.ts → index-Cu5EcdK0.d.ts} +0 -59
  102. package/{index-57lTXnoe.d.ts → index-D6GPJ4Ow.d.ts} +29 -26
  103. package/index.cjs +1 -1
  104. package/index.d.ts +17 -25
  105. package/index.js +22 -27
  106. package/lib-Bs-g5jyp.cjs +53 -0
  107. package/{lib-BrsqpUkv.js → lib-CtJaID_y.js} +7 -31
  108. package/{messages-AdPfdoLV.d.ts → messages-B9dOXntM.d.ts} +0 -2
  109. package/messages.d.ts +1 -1
  110. package/messages.js +1 -2
  111. package/net-COkJw8lV.js +286 -0
  112. package/net-Dk2kqtgE.cjs +1 -0
  113. package/{net-BpyIeQ8r.d.ts → net-mVAYXs8e.d.ts} +5 -7
  114. package/net.cjs +1 -1
  115. package/net.d.ts +1 -1
  116. package/net.js +3 -323
  117. package/{node-fs-DY2fO5zd.js → node-fs-B4pY08Kc.js} +3 -10
  118. package/node-fs-DN0ejGTL.cjs +1 -0
  119. package/opfs/promises.cjs +1 -1
  120. package/opfs/promises.d.ts +2 -4
  121. package/opfs/promises.js +2 -3
  122. package/{opfs-D0goLAQW.js → opfs-CzCfVam3.js} +2 -3
  123. package/opfs-D3pYzYRc.js +35 -0
  124. package/opfs-DuXvTgIl.cjs +1 -0
  125. package/opfs.cjs +1 -1
  126. package/opfs.d.ts +3 -88
  127. package/opfs.js +1 -36
  128. package/package.json +1 -1
  129. package/packages-BEadIy_h.d.ts +155 -0
  130. package/packages-Cws_rcgf.js +346 -0
  131. package/packages-DT8vPB5_.cjs +1 -0
  132. package/packages.cjs +1 -1
  133. package/packages.d.ts +3 -156
  134. package/packages.js +1 -347
  135. package/{proxy-C4sYkxB5.js → proxy-BBAQxJmP.js} +5 -6
  136. package/{proxy-Dz60YyYy.d.ts → proxy-BP40IXYD.d.ts} +2 -4
  137. package/{proxy-jdE5tCwz.cjs → proxy-DVgGp6A8.cjs} +1 -1
  138. package/react.cjs +1 -1
  139. package/react.d.ts +16 -4
  140. package/react.js +96 -7
  141. package/{relay-choice-BGwXRC5d.js → relay-choice-Bb3oP2gw.js} +1 -2
  142. package/{relay-choice-5yUPI-tJ.d.ts → relay-choice-DOUttUnL.d.ts} +2 -4
  143. package/{rolldown-runtime-Dy4uBu1J.js → rolldown-runtime-CGnMp29N.js} +1 -2
  144. package/rooms-C6mbannC.d.ts +227 -0
  145. package/rooms-DHFS9cwA.cjs +1 -0
  146. package/rooms-DP5stTEr.js +300 -0
  147. package/rooms.cjs +1 -1
  148. package/rooms.d.ts +3 -228
  149. package/rooms.js +1 -301
  150. package/storage-BCjYihUO.cjs +1 -0
  151. package/storage-BhfImh_2.js +136 -0
  152. package/storage-DpCLksAa.d.ts +68 -0
  153. package/storage.cjs +1 -1
  154. package/storage.d.ts +3 -69
  155. package/storage.js +1 -137
  156. package/{utils-Cyq8uJiy.js → utils-DtWP-E9x.js} +1 -2
  157. package/{wire-Fk5pJaoy.d.ts → wire-DhmLnYEU.d.ts} +0 -2
  158. package/wire.d.ts +1 -1
  159. package/wire.js +1 -2
  160. package/cloud-DcgY8Xfp.cjs +0 -1
  161. package/connect-button-Cp0NS95-.d.ts +0 -4
  162. package/extension-I2Ziv2pk.cjs +0 -1
  163. package/fs-DeyJwJ3w.cjs +0 -1
  164. package/lib-C_X3WR4G.cjs +0 -53
  165. package/node-fs-vsWuoMGa.cjs +0 -1
package/README.md CHANGED
@@ -29,7 +29,6 @@ With anything else, write `<script>${brokerFrameScript}</script>` as the first t
29
29
  the installed version.
30
30
 
31
31
  - In a framed page, the script mounts nothing: inside fkn.app the lib uses fkn.app's own broker.
32
- - Use the script, not a hand-written iframe of fkn.app's `/api`, which loads a second broker inside fkn.app
33
- and misses the frame's `allow` list.
32
+ - Use the script, not a hand-written iframe of fkn.app's `/api`, which misses the frame's `allow` list.
34
33
  - A `Content-Security-Policy` that blocks inline scripts needs the script's hash in `script-src`. Without it, the lib
35
34
  mounts the frame itself, as before.
@@ -0,0 +1,39 @@
1
+ import { a as AccountChange } from "./contract-0rua6Wsh.js";
2
+ declare namespace account_d_exports {
3
+ export { AccountChange, AccountInfo, info, login, logout, onChange };
4
+ }
5
+ type AccountInfo = {
6
+ /** the account's display name (a username, not necessarily a real name) */
7
+ name: string;
8
+ /** profile image URL, or null if none is set */
9
+ image: string | null;
10
+ /** the account has an active paid subscription */
11
+ premium: boolean;
12
+ /** when the current subscription lapses, as a ms epoch, or null when not subscribed */
13
+ premiumUntil: number | null;
14
+ };
15
+ declare const login: () => Promise<boolean>;
16
+ declare const logout: () => Promise<void>;
17
+ declare const info: () => Promise<AccountInfo | null>;
18
+ /**
19
+ * Calls `callback` whenever the account this page acts as may have changed (a switch, a sign-in or a
20
+ * sign-out, in this tab or another), and when the connection is renewed without one. Works in a window
21
+ * and in a worker bridged with `relayWorker`; resolves to a no-op where there is no FKN transport at all.
22
+ *
23
+ * `change.switched` says which. True: this page may now act as another account, or as none, so drop
24
+ * what the old account put in memory (its lists, any open work) and read again; a storage call made
25
+ * before this callback never lands in the new account (it is refused with `StorageAccountChangedError`).
26
+ * It is also true when fkn.app is too old to tell (before 2026-10-02) and when the library moved on its
27
+ * own after a refusal, so treating true as a switch is always safe. False: fkn.app saw the same account.
28
+ * Its connect token was renewed, or an app in this browser signed in or out of FKN on its own, this one
29
+ * included, so read `info()` again to learn whether this page is still signed in. Calls made before it
30
+ * still land. A switch fkn.app could not see, because its document was replaced in between, reaches you
31
+ * as true once a storage call is refused for it.
32
+ *
33
+ * Storage moves to the new account BEFORE any callback runs. Work the app started before a switch and
34
+ * resumes after it is the app's to check: keep a counter this callback bumps when `switched` is true,
35
+ * and compare it synchronously right before the storage call, which captures the account in the same
36
+ * synchronous step, so the check and the call are atomic.
37
+ */
38
+ declare const onChange: (callback: (change: AccountChange) => void) => Promise<() => void>;
39
+ export { logout as a, login as i, account_d_exports as n, onChange as o, info as r, AccountInfo as t };
@@ -0,0 +1,22 @@
1
+ import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
+ import { l as t, o as n } from "./api-DRglK7ft.js";
3
+ import { i as r } from "./account-generation-BKHNe-jL.js";
4
+ // src/account.ts
5
+ var i = /* @__PURE__ */ e({
6
+ info: () => s,
7
+ login: () => a,
8
+ logout: () => o,
9
+ onChange: () => c
10
+ }), a = async () => typeof window > "u" ? !1 : (await n).account.login(location.origin).catch(() => !1), o = async () => {
11
+ typeof window < "u" && await (await n).account.logout().catch(() => {});
12
+ }, s = async () => {
13
+ if (typeof window > "u") return null;
14
+ let e = await n.then((e) => e.account.info()).catch(() => null);
15
+ return e ? {
16
+ name: e.name,
17
+ image: e.image,
18
+ premium: e.premium,
19
+ premiumUntil: e.premiumUntil ? Date.parse(e.premiumUntil) : null
20
+ } : null;
21
+ }, c = async (e) => t ? r(e) : () => {};
22
+ export { c as a, o as i, s as n, a as r, i as t };
@@ -1 +1 @@
1
- const e=require("./api-CrUO33y-.cjs");var t=0,n=new Set,r=2e3,i=null,a=e=>{let r=e?.switched!==!1;r&&(t+=1,i&&=(clearTimeout(i.timer),null));for(let e of[...n])try{e({switched:r})}catch{}},o=!1,s=0,c=()=>{let t=e.c();t&&s!==t.epoch&&(s=t.epoch,Promise.resolve(t.remote.account.onChange(a)).catch(()=>{s===t.epoch&&(s=0)}))},l=()=>{!o&&e.l&&(o=!0,e.u(c))},u=()=>t,d=e=>(n.add(e),l(),()=>{n.delete(e)}),f=e=>{if(e!==t||i?.generation===e)return;let n=setTimeout(()=>{i?.timer===n&&(i=null,t===e&&a({switched:!0}))},r);i={generation:e,timer:n}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
1
+ const e=require("./api-DrvhPN56.cjs");var t=0,n=new Set,r=2e3,i=null,a=e=>{let r=e?.switched!==!1;r&&(t+=1,i&&=(clearTimeout(i.timer),null));for(let e of[...n])try{e({switched:r})}catch{}},o=!1,s=0,c=()=>{let t=e.c();t&&s!==t.epoch&&(s=t.epoch,Promise.resolve(t.remote.account.onChange(a)).catch(()=>{s===t.epoch&&(s=0)}))},l=()=>{!o&&e.l&&(o=!0,e.u(c))},u=()=>t,d=e=>(n.add(e),l(),()=>{n.delete(e)}),f=e=>{if(e!==t||i?.generation===e)return;let n=setTimeout(()=>{i?.timer===n&&(i=null,t===e&&a({switched:!0}))},r);i={generation:e,timer:n}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
@@ -1,5 +1,5 @@
1
- import { c as e, l as t, u as n } from "./api-BvJu2X1L.js";
2
- //#region src/account-generation.ts
1
+ import { c as e, l as t, u as n } from "./api-DRglK7ft.js";
2
+ // src/account-generation.ts
3
3
  var r = 0, i = /* @__PURE__ */ new Set(), a = 2e3, o = null, s = (e) => {
4
4
  let t = e?.switched !== !1;
5
5
  t && (r += 1, o &&= (clearTimeout(o.timer), null));
@@ -25,5 +25,4 @@ var r = 0, i = /* @__PURE__ */ new Set(), a = 2e3, o = null, s = (e) => {
25
25
  timer: t
26
26
  };
27
27
  };
28
- //#endregion
29
28
  export { p as i, d as n, m as r, f as t };
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-DrvhPN56.cjs"),n=require("./account-generation-ACCBzaI-.cjs");var r=e.t({info:()=>o,login:()=>i,logout:()=>a,onChange:()=>s}),i=async()=>typeof window>`u`?!1:(await t.o).account.login(location.origin).catch(()=>!1),a=async()=>{typeof window<`u`&&await(await t.o).account.logout().catch(()=>{})},o=async()=>{if(typeof window>`u`)return null;let e=await t.o.then(e=>e.account.info()).catch(()=>null);return e?{name:e.name,image:e.image,premium:e.premium,premiumUntil:e.premiumUntil?Date.parse(e.premiumUntil):null}:null},s=async e=>t.l?n.i(e):()=>{};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
@@ -1,8 +1,8 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { o as t } from "./api-BvJu2X1L.js";
1
+ import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
+ import { o as t } from "./api-DRglK7ft.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 { n as a, r as o, t as s } from "./account-generation-DvRuJDa2.js";
5
- //#region src/account-storage.ts
4
+ import { n as a, r as o, t as s } from "./account-generation-BKHNe-jL.js";
5
+ // src/account-storage.ts
6
6
  var c = /* @__PURE__ */ e({
7
7
  StorageAccountChangedError: () => f,
8
8
  StorageAccountPinUnsupportedError: () => p,
@@ -119,5 +119,4 @@ var c = /* @__PURE__ */ e({
119
119
  }, B = async (e, t) => {
120
120
  await D(E(t), (t, n) => t.remove(e, n));
121
121
  }, V = () => t.then((e) => e.cloud.fs.encryption()), H = () => t.then((e) => e.cloud.fs.unlock());
122
- //#endregion
123
122
  export { R as _, c as a, z as b, V as c, d, C as f, I as g, F as h, u as i, m as l, w as m, p as n, N as o, P as p, l as r, _ as s, f as t, h as u, B as v, H as y };
@@ -1,39 +1,3 @@
1
- //#region src/fs/types.d.ts
2
- type FileEntry$1 = {
3
- path: string;
4
- size: number;
5
- contentType: string | null;
6
- updatedAt: string | null;
7
- };
8
- type WriteData = Blob | ArrayBuffer | Uint8Array | string;
9
- /**
10
- * Which account a cloud call belongs to; library plumbing app code never passes. A multi-call
11
- * operation (a rename, a mount, a queue drain) captures one at its start so no call lands in an
12
- * account the realm switched to meanwhile. `{ generation }` is a ticket from `captureAccount()`;
13
- * `{ pin }` is the pin a queued entry was stamped with, sent as is.
14
- */
15
- type PinFrom = {
16
- readonly generation: number;
17
- } | {
18
- readonly pin: string;
19
- };
20
- type PinOptions = {
21
- pin?: PinFrom;
22
- };
23
- type FileSystem = {
24
- available: () => Promise<boolean>;
25
- list: (opts?: PinOptions) => Promise<FileEntry$1[]>;
26
- readFile: (path: string, opts?: PinOptions) => Promise<Blob>;
27
- writeFile: (path: string, data: WriteData, opts?: {
28
- contentType?: string;
29
- } & PinOptions) => Promise<void>;
30
- remove: (path: string, opts?: PinOptions) => Promise<void>;
31
- /** Captures the account generation this realm is on now; absent on a backing with no account. */
32
- captureAccount?: () => PinFrom;
33
- };
34
- declare namespace account_storage_d_exports {
35
- export { AccountTicket, CloudAvailability, EncryptionStatus, FileEntry, SealedRead, StorageAccountChangedError, StorageAccountPinUnsupportedError, StorageLockedError, StorageNotFoundError, StorageQuota, availability, available, captureAccount, encryption, isAccountChanged, isInvalidPin, isNotFound, knownPin, list, pinFor, quota, readFile, readFileSealed, remove, unlock, writeFile };
36
- }
37
1
  type FileEntry = {
38
2
  path: string;
39
3
  size: number;
@@ -103,18 +67,6 @@ declare class StorageAccountPinUnsupportedError extends Error {
103
67
  }
104
68
  /** Whether an error from this module means the account changed under the call, which was not made. */
105
69
  declare const isAccountChanged: (error: unknown) => boolean;
106
- /** Whether the api could not read a pin at all (a queued entry's record damaged on the device). */
107
- declare const isInvalidPin: (error: unknown) => boolean;
108
- type AccountTicket = {
109
- readonly generation: number;
110
- };
111
- /** The account generation this realm is on now. Synchronous, so it is captured before any await. */
112
- declare const captureAccount: () => AccountTicket;
113
- /** The pin a ticket's generation carries, if it was already taken. */
114
- declare const knownPin: (ticket: AccountTicket) => string | undefined;
115
- /** The pin a ticket's generation carries, taking it if need be; refused once the generation has moved. */
116
- declare const pinFor: (ticket: AccountTicket) => Promise<string>;
117
- declare const available: () => Promise<boolean>;
118
70
  type CloudAvailability = 'connected' | 'disconnected' | 'unknown';
119
71
  /**
120
72
  * Whether the cloud half is backed by an account, as three answers rather than two:
@@ -124,29 +76,12 @@ type CloudAvailability = 'connected' | 'disconnected' | 'unknown';
124
76
  * 'disconnected'; treating 'unknown' the same silently loses the write.
125
77
  */
126
78
  declare const availability: () => Promise<CloudAvailability>;
127
- declare const list: (opts?: PinOptions) => Promise<FileEntry[]>;
128
79
  declare const quota: () => Promise<StorageQuota>;
129
- declare const readFile: (path: string, opts?: PinOptions) => Promise<Blob>;
130
80
  /** The bytes of a cloud object and the seal time they carry, as an ISO string or null. */
131
81
  type SealedRead = {
132
82
  data: Uint8Array;
133
83
  sealedAt: string | null;
134
84
  };
135
- /**
136
- * A cloud read that also reports when the copy was sealed.
137
- *
138
- * `sealedAt` is an ISO string, or null for an envelope written before the seal time existed or a
139
- * data plane older than this call. It is authenticated, so the server can neither forge nor alter
140
- * it, but it is the WRITER's claim: it does not prove this copy is the newest, so an app that needs
141
- * that keeps a high-water mark per path. The listing's `updatedAt` is a server hint, for display only.
142
- * The bytes and the stamp come from one read of one envelope.
143
- */
144
- declare const readFileSealed: (path: string, opts?: PinOptions) => Promise<SealedRead>;
145
- declare const writeFile: (path: string, data: WriteData, opts?: {
146
- contentType?: string;
147
- } & PinOptions) => Promise<void>;
148
- declare const remove: (path: string, opts?: PinOptions) => Promise<void>;
149
85
  declare const encryption: () => Promise<EncryptionStatus>;
150
86
  declare const unlock: () => Promise<boolean>;
151
- //#endregion
152
- export { unlock as _, StorageAccountChangedError as a, PinOptions as b, StorageNotFoundError as c, availability as d, captureAccount as f, quota as g, isNotFound as h, SealedRead as i, StorageQuota as l, isAccountChanged as m, EncryptionStatus as n, StorageAccountPinUnsupportedError as o, encryption as p, FileEntry as r, StorageLockedError as s, CloudAvailability as t, account_storage_d_exports as u, FileEntry$1 as v, WriteData as x, FileSystem as y };
87
+ export { StorageAccountChangedError as a, StorageNotFoundError as c, encryption as d, isAccountChanged as f, unlock as h, SealedRead as i, StorageQuota as l, quota as m, EncryptionStatus as n, StorageAccountPinUnsupportedError as o, isNotFound as p, FileEntry as r, StorageLockedError as s, CloudAvailability as t, availability as u };
@@ -1 +1 @@
1
- const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-CrUO33y-.cjs"),n=require("./messages.cjs"),r=require("./account-generation-BiZxPztj.cjs");var i=e.t({StorageAccountChangedError:()=>c,StorageAccountPinUnsupportedError:()=>l,StorageLockedError:()=>a,StorageNotFoundError:()=>o,availability:()=>k,available:()=>w,captureAccount:()=>p,encryption:()=>L,isAccountChanged:()=>u,isInvalidPin:()=>d,isNotFound:()=>s,knownPin:()=>y,list:()=>A,pinFor:()=>b,quota:()=>j,readFile:()=>M,readFileSealed:()=>P,remove:()=>I,unlock:()=>R,writeFile:()=>F}),a=class extends Error{code=`FKN_E2E_LOCKED`;constructor(){super(`storage locked: connect the app again to open encrypted data`)}},o=class extends Error{code=n.STORAGE_NOT_FOUND;constructor(e=`storage: no object at that path`){super(e)}},s=e=>e?.code===n.STORAGE_NOT_FOUND,c=class extends Error{code=n.STORAGE_ACCOUNT_CHANGED;constructor(e=`storage: the signed-in account changed, so this call was not made`){super(e)}},l=class extends Error{code=n.STORAGE_ACCOUNT_PIN_UNSUPPORTED;constructor(e=`storage: the FKN broker cannot pin calls to an account yet, so nothing was sent`){super(e)}},u=e=>e?.code===`FKN_ACCOUNT_CHANGED`||e instanceof Error&&e.message.startsWith(`fkn:account-changed`),d=e=>e instanceof Error&&e.message.startsWith(`fkn:account-pin-invalid`),f=e=>{throw e instanceof Error&&e.message.startsWith(`fkn:e2e-locked`)?new a:s(e)?new o(e.message):u(e)?new c:e instanceof Error&&e.message.startsWith(`fkn:account-pin-unsupported`)?new l:e instanceof Error&&(/^not found$/i.test(e.message)||/\(404\)$/.test(e.message))?new o(e.message):e},p=()=>(r.n(),{generation:r.t()}),m=new Map,h=null,g=e=>typeof e?.accountPin==`function`,_=(e,t)=>{let n=Promise.resolve(t.accountPin()).then(t=>{if(typeof t!=`string`||!t)throw Error(`storage: the broker answered no account pin`);return r.t()===e&&m.set(e,t),t});return h={generation:e,pin:n},n.catch(()=>{h?.pin===n&&(h=null)}),n},v=async(e,t)=>{let n=m.get(e.generation);if(n!==void 0)return n;if(e.generation!==r.t())throw new c;let i=await(h?.generation===e.generation?h.pin:_(e.generation,t)).catch(f);if(e.generation!==r.t())throw new c;return i},y=e=>m.get(e.generation),b=async e=>{let n=(await t.o).cloud.fs;if(!g(n))throw new l;return v(e,n)},x=e=>{for(let[t,n]of m)if(n===e)return t},S=e=>e?.pin??p(),C=async(e,n)=>{let i=(await t.o).cloud.fs;if(!g(i))throw new l;let a=`pin`in e?e.pin:await v(e,i);if(!g(i))throw new l;return n(i,{accountPin:a}).catch(t=>{if(u(t)){let t=`generation`in e?e.generation:x(a);t!==void 0&&r.r(t)}return f(t)})},w=()=>t.o.then(e=>e.cloud.fs.available()).catch(()=>!1),T=8e3,E=1e3,D=!1,O=async()=>{let e=(await t.o).cloud.fs;return typeof e.availability==`function`?e.availability():await e.available()?`connected`:`disconnected`},k=async()=>{let e=D?E:T,t=await new Promise(t=>{let n=setTimeout(()=>t(`timeout`),e);O().then(e=>{clearTimeout(n),t(e)},()=>{clearTimeout(n),t(`unknown`)})});return t===`timeout`?(D=!0,`unknown`):(D=!1,t)},A=e=>C(S(e),(e,t)=>e.list(t)),j=()=>t.o.then(e=>e.cloud.fs.quota()),M=async(e,t)=>{let n=await C(S(t),(t,n)=>t.readFile(e,n));return new Blob([n])},N=e=>{if(e===null||!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()},P=async(e,t)=>C(S(t),async(t,n)=>{let r=t;if(typeof r.readFileSealed!=`function`)return{data:await t.readFile(e,n),sealedAt:null};let i=await r.readFileSealed(e,n);return{data:i.bytes,sealedAt:N(i.sealedAt)}}),F=async(e,t,n)=>{let r=S(n),i=t instanceof Blob?new Uint8Array(await t.arrayBuffer()):t;await C(r,(t,r)=>t.writeFile(e,i,n?.contentType??null,r))},I=async(e,t)=>{await C(S(t),(t,n)=>t.remove(e,n))},L=()=>t.o.then(e=>e.cloud.fs.encryption()),R=()=>t.o.then(e=>e.cloud.fs.unlock());Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return R}});
1
+ const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-DrvhPN56.cjs"),n=require("./messages.cjs"),r=require("./account-generation-ACCBzaI-.cjs");var i=e.t({StorageAccountChangedError:()=>c,StorageAccountPinUnsupportedError:()=>l,StorageLockedError:()=>a,StorageNotFoundError:()=>o,availability:()=>k,available:()=>w,captureAccount:()=>p,encryption:()=>L,isAccountChanged:()=>u,isInvalidPin:()=>d,isNotFound:()=>s,knownPin:()=>y,list:()=>A,pinFor:()=>b,quota:()=>j,readFile:()=>M,readFileSealed:()=>P,remove:()=>I,unlock:()=>R,writeFile:()=>F}),a=class extends Error{code=`FKN_E2E_LOCKED`;constructor(){super(`storage locked: connect the app again to open encrypted data`)}},o=class extends Error{code=n.STORAGE_NOT_FOUND;constructor(e=`storage: no object at that path`){super(e)}},s=e=>e?.code===n.STORAGE_NOT_FOUND,c=class extends Error{code=n.STORAGE_ACCOUNT_CHANGED;constructor(e=`storage: the signed-in account changed, so this call was not made`){super(e)}},l=class extends Error{code=n.STORAGE_ACCOUNT_PIN_UNSUPPORTED;constructor(e=`storage: the FKN broker cannot pin calls to an account yet, so nothing was sent`){super(e)}},u=e=>e?.code===`FKN_ACCOUNT_CHANGED`||e instanceof Error&&e.message.startsWith(`fkn:account-changed`),d=e=>e instanceof Error&&e.message.startsWith(`fkn:account-pin-invalid`),f=e=>{throw e instanceof Error&&e.message.startsWith(`fkn:e2e-locked`)?new a:s(e)?new o(e.message):u(e)?new c:e instanceof Error&&e.message.startsWith(`fkn:account-pin-unsupported`)?new l:e instanceof Error&&(/^not found$/i.test(e.message)||/\(404\)$/.test(e.message))?new o(e.message):e},p=()=>(r.n(),{generation:r.t()}),m=new Map,h=null,g=e=>typeof e?.accountPin==`function`,_=(e,t)=>{let n=Promise.resolve(t.accountPin()).then(t=>{if(typeof t!=`string`||!t)throw Error(`storage: the broker answered no account pin`);return r.t()===e&&m.set(e,t),t});return h={generation:e,pin:n},n.catch(()=>{h?.pin===n&&(h=null)}),n},v=async(e,t)=>{let n=m.get(e.generation);if(n!==void 0)return n;if(e.generation!==r.t())throw new c;let i=await(h?.generation===e.generation?h.pin:_(e.generation,t)).catch(f);if(e.generation!==r.t())throw new c;return i},y=e=>m.get(e.generation),b=async e=>{let n=(await t.o).cloud.fs;if(!g(n))throw new l;return v(e,n)},x=e=>{for(let[t,n]of m)if(n===e)return t},S=e=>e?.pin??p(),C=async(e,n)=>{let i=(await t.o).cloud.fs;if(!g(i))throw new l;let a=`pin`in e?e.pin:await v(e,i);if(!g(i))throw new l;return n(i,{accountPin:a}).catch(t=>{if(u(t)){let t=`generation`in e?e.generation:x(a);t!==void 0&&r.r(t)}return f(t)})},w=()=>t.o.then(e=>e.cloud.fs.available()).catch(()=>!1),T=8e3,E=1e3,D=!1,O=async()=>{let e=(await t.o).cloud.fs;return typeof e.availability==`function`?e.availability():await e.available()?`connected`:`disconnected`},k=async()=>{let e=D?E:T,t=await new Promise(t=>{let n=setTimeout(()=>t(`timeout`),e);O().then(e=>{clearTimeout(n),t(e)},()=>{clearTimeout(n),t(`unknown`)})});return t===`timeout`?(D=!0,`unknown`):(D=!1,t)},A=e=>C(S(e),(e,t)=>e.list(t)),j=()=>t.o.then(e=>e.cloud.fs.quota()),M=async(e,t)=>{let n=await C(S(t),(t,n)=>t.readFile(e,n));return new Blob([n])},N=e=>{if(e===null||!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()},P=async(e,t)=>C(S(t),async(t,n)=>{let r=t;if(typeof r.readFileSealed!=`function`)return{data:await t.readFile(e,n),sealedAt:null};let i=await r.readFileSealed(e,n);return{data:i.bytes,sealedAt:N(i.sealedAt)}}),F=async(e,t,n)=>{let r=S(n),i=t instanceof Blob?new Uint8Array(await t.arrayBuffer()):t;await C(r,(t,r)=>t.writeFile(e,i,n?.contentType??null,r))},I=async(e,t)=>{await C(S(t),(t,n)=>t.remove(e,n))},L=()=>t.o.then(e=>e.cloud.fs.encryption()),R=()=>t.o.then(e=>e.cloud.fs.unlock());Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return R}});
package/account.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-CrUO33y-.cjs"),n=require("./account-generation-BiZxPztj.cjs");var r=e.t({info:()=>o,login:()=>i,logout:()=>a,onChange:()=>s}),i=async()=>typeof window>`u`?!1:(await t.o).account.login(location.origin).catch(()=>!1),a=async()=>{typeof window<`u`&&await(await t.o).account.logout().catch(()=>{})},o=async()=>{if(typeof window>`u`)return null;let e=await t.o.then(e=>e.account.info()).catch(()=>null);return e?{name:e.name,image:e.image,premium:e.premium,premiumUntil:e.premiumUntil?Date.parse(e.premiumUntil):null}:null},s=async e=>t.l?n.i(e):()=>{};exports.info=o,exports.login=i,exports.logout=a,exports.onChange=s,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./account-m2iCmNui.cjs");exports.info=e.n,exports.login=e.r,exports.logout=e.i,exports.onChange=e.a;
package/account.d.ts CHANGED
@@ -1,40 +1,3 @@
1
- import { a as AccountChange } from "./contract-BGMJVvTg.js";
2
- declare namespace account_d_exports {
3
- export { AccountChange, AccountInfo, info, login, logout, onChange };
4
- }
5
- export type AccountInfo = {
6
- /** the account's display name (a username, not necessarily a real name) */
7
- name: string;
8
- /** profile image URL, or null if none is set */
9
- image: string | null;
10
- /** the account has an active paid subscription */
11
- premium: boolean;
12
- /** when the current subscription lapses, as a ms epoch, or null when not subscribed */
13
- premiumUntil: number | null;
14
- };
15
- export declare const login: () => Promise<boolean>;
16
- export declare const logout: () => Promise<void>;
17
- export declare const info: () => Promise<AccountInfo | null>;
18
- /**
19
- * Calls `callback` whenever the account this page acts as may have changed (a switch, a sign-in or a
20
- * sign-out, in this tab or another), and when the connection is renewed without one. Works in a window
21
- * and in a worker bridged with `relayWorker`; resolves to a no-op where there is no FKN transport at all.
22
- *
23
- * `change.switched` says which. True: this page may now act as another account, or as none, so drop
24
- * what the old account put in memory (its lists, any open work) and read again; a storage call made
25
- * before this callback never lands in the new account (it is refused with `StorageAccountChangedError`).
26
- * It is also true when fkn.app is too old to tell (before 2026-10-02) and when the library moved on its
27
- * own after a refusal, so treating true as a switch is always safe. False: fkn.app saw the same account.
28
- * Its connect token was renewed, or an app in this browser signed in or out of FKN on its own, this one
29
- * included, so read `info()` again to learn whether this page is still signed in. Calls made before it
30
- * still land. A switch fkn.app could not see, because its document was replaced in between, reaches you
31
- * as true once a storage call is refused for it.
32
- *
33
- * Storage moves to the new account BEFORE any callback runs. Work the app started before a switch and
34
- * resumes after it is the app's to check: keep a counter this callback bumps when `switched` is true,
35
- * and compare it synchronously right before the storage call, which captures the account in the same
36
- * synchronous step, so the check and the call are atomic.
37
- */
38
- export declare const onChange: (callback: (change: AccountChange) => void) => Promise<() => void>;
39
- //#endregion
40
- export { type AccountChange, account_d_exports as t };
1
+ import { a as AccountChange } from "./contract-0rua6Wsh.js";
2
+ import { a as logout, i as login, o as onChange, r as info, t as AccountInfo } from "./account-Bm7uIcQo.js";
3
+ export { type AccountChange, AccountInfo, info, login, logout, onChange };
package/account.js CHANGED
@@ -1,23 +1 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { l as t, o as n } from "./api-BvJu2X1L.js";
3
- import { i as r } from "./account-generation-DvRuJDa2.js";
4
- //#region src/account.ts
5
- var i = /* @__PURE__ */ e({
6
- info: () => s,
7
- login: () => a,
8
- logout: () => o,
9
- onChange: () => c
10
- }), a = async () => typeof window > "u" ? !1 : (await n).account.login(location.origin).catch(() => !1), o = async () => {
11
- typeof window < "u" && await (await n).account.logout().catch(() => {});
12
- }, s = async () => {
13
- if (typeof window > "u") return null;
14
- let e = await n.then((e) => e.account.info()).catch(() => null);
15
- return e ? {
16
- name: e.name,
17
- image: e.image,
18
- premium: e.premium,
19
- premiumUntil: e.premiumUntil ? Date.parse(e.premiumUntil) : null
20
- } : null;
21
- }, c = async (e) => t ? r(e) : () => {};
22
- //#endregion
23
- export { s as info, a as login, o as logout, c as onChange, i as t };
1
+ export { n as info, r as login, i as logout, a as onChange } from "./account-Uh0-1Cbp.js";
@@ -1,11 +1,8 @@
1
- import { D as RelayChoice } from "./index-C5DdoMGo.js";
2
- import { D as IpFamily, H as ProxyFetchInput, I as PackagesErrorCode, N as OverlayState, Nt as StoragePutWire, P as PackageQuery, Q as RoomClaimOptions, R as PickOptions, T as InstallOptions, Ut as UdpDatagram, V as ProxyFetchInit, Vt as TcpSocketOptions, Wt as UdpSocketOptions, X as Resolvers, Xt as WriteData, a as AccountChange, at as RoomJoinOptions, b as FrameConsentAnswer, c as AdoptRequest, d as ConflictRequest, dt as RoomPermission, ht as RoomsErrorCode, kt as StorageErrorCode, l as AdoptState, m as ConnectOptions, mt as RoomType, o as AccountPinOptions, p as ConnectAvailability, rt as RoomEvent, st as RoomMailbox, u as ConflictChoice, ut as RoomOpenOptions, x as FrameConsentRequest, z as Placement, zt as TcpSocketListenerOptions } from "./contract-BGMJVvTg.js";
3
- import { o as TcpSocketOption, x as UdpSocketOption } from "./wire-Fk5pJaoy.js";
1
+ import { D as RelayChoice } from "./index-Cu5EcdK0.js";
2
+ import { D as IpFamily, H as ProxyFetchInput, I as PackagesErrorCode, N as OverlayState, Nt as StoragePutWire, P as PackageQuery, Q as RoomClaimOptions, R as PickOptions, T as InstallOptions, Ut as UdpDatagram, V as ProxyFetchInit, Vt as TcpSocketOptions, Wt as UdpSocketOptions, X as Resolvers, Xt as WriteData, a as AccountChange, at as RoomJoinOptions, b as FrameConsentAnswer, c as AdoptRequest, d as ConflictRequest, dt as RoomPermission, ht as RoomsErrorCode, kt as StorageErrorCode, l as AdoptState, m as ConnectOptions, mt as RoomType, o as AccountPinOptions, p as ConnectAvailability, rt as RoomEvent, st as RoomMailbox, u as ConflictChoice, ut as RoomOpenOptions, x as FrameConsentRequest, z as Placement, zt as TcpSocketListenerOptions } from "./contract-0rua6Wsh.js";
3
+ import { o as TcpSocketOption, x as UdpSocketOption } from "./wire-DhmLnYEU.js";
4
4
  import { Remote } from "osra";
5
- //#region src/api-epochs.d.ts
6
5
  type EpochListener<T> = (remote: T, epoch: number) => void;
7
- //#endregion
8
- //#region src/api.d.ts
9
6
  declare const hasTransport: boolean;
10
7
  type Api = Remote<Resolvers>;
11
8
  /**
@@ -2828,5 +2825,4 @@ declare const currentApiEpoch: () => {
2828
2825
  /** Activity on the broker connection: every call flows through the facade, so these see all of it. */
2829
2826
  declare const apiLastCall: () => number;
2830
2827
  declare const apiInFlight: () => number;
2831
- //#endregion
2832
2828
  export { apiLastCall as a, currentApiEpoch as c, apiInFlight as i, hasTransport as l, BrokerUnreachableError as n, apiPromise as o, OwnChannelUnavailableError as r, apiWithin as s, API_DEADLINE_MS as t, onApiEpoch as u };
@@ -1,6 +1,6 @@
1
- import { i as e, n as t } from "./broker-frame-B31OXcnH.js";
1
+ import { i as e, n as t } from "./broker-frame-vjSpBa8d.js";
2
2
  import { checkOsraMessageKey as n, expose as r } from "osra";
3
- //#region src/frame-ready.ts
3
+ // src/frame-ready.ts
4
4
  var i = 1e4, a = 16, o = (e) => {
5
5
  let t;
6
6
  try {
@@ -320,26 +320,25 @@ var i = 1e4, a = 16, o = (e) => {
320
320
  };
321
321
  }, U = "fkn-api", Ae = "fkn-api-window", je = { async *[Symbol.asyncIterator]() {
322
322
  let e = await H();
323
- if (!e) {
324
- await new Promise(() => {});
325
- return;
326
- }
327
- if (!B()) {
328
- let t = new AbortController();
329
- V(() => t.abort());
330
- for await (let n of r({}, {
331
- key: U,
332
- transport: e,
333
- unregisterSignal: t.signal
334
- })) {
335
- if (t.signal.aborted) break;
336
- yield n;
323
+ if (!e) await new Promise(() => {});
324
+ else {
325
+ if (!B()) {
326
+ let t = new AbortController();
327
+ V(() => t.abort());
328
+ for await (let n of r({}, {
329
+ key: U,
330
+ transport: e,
331
+ unregisterSignal: t.signal
332
+ })) {
333
+ if (t.signal.aborted) break;
334
+ yield n;
335
+ }
337
336
  }
337
+ yield* r({}, {
338
+ key: Ae,
339
+ transport: e
340
+ });
338
341
  }
339
- yield* r({}, {
340
- key: Ae,
341
- transport: e
342
- });
343
342
  } }, W = !1, G = H().then((e) => new Promise((t) => {
344
343
  if (!e) return;
345
344
  let { receive: r } = e, i = (e) => {
@@ -375,5 +374,4 @@ $((e) => {
375
374
  colorScheme: g
376
375
  }).catch(() => {});
377
376
  });
378
- //#endregion
379
377
  export { Fe as a, Pe as c, Oe as d, L as f, Ie as i, ke as l, X as n, q as o, Z as r, Ne as s, J as t, $ as u };
@@ -1,3 +1,3 @@
1
1
  const e=require("./broker-frame-CF4-yXtj.cjs");let t=require("osra");var n=1e4,r=16,i=e=>{let t;try{t=e.contentWindow}catch{return!0}if(!t)return!0;try{let e=t.location.href;return e!==``&&e!==`about:blank`}catch{return!0}},a=(e,t=n)=>new Promise(n=>{if(i(e))return n();let a=()=>{clearInterval(o),clearTimeout(s),e.removeEventListener(`load`,a),n()},o=setInterval(()=>{i(e)&&a()},r),s=setTimeout(a,t);e.addEventListener(`load`,a)}),o=5e3,s=9e4,c=(e,t,r)=>{let a=1,c,l=e.ownerDocument.defaultView,u=()=>{clearTimeout(c),l?.removeEventListener(`message`,m),e.removeEventListener(`load`,p)},d=()=>{if(e.isConnected){if(a>=4)return u(),console.error(`FKN @fkn/lib: ${t} did not load in ${a} tries; reload the page`);a+=1,e.contentWindow?.location.replace(t),f(s)}},f=e=>{clearTimeout(c),c=setTimeout(d,e)},p=()=>f(o),m=t=>{t.source===e.contentWindow&&t.origin===r&&u()};if(l?.addEventListener(`message`,m),e.addEventListener(`load`,p),i(e))return f(o);c=setTimeout(()=>i(e)?f(8e4):d(),n)},l=32,u=8,d=120,f=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),p=typeof CSS<`u`&&CSS.supports(`clip-path`,`polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)`),m=`light dark`,h=e=>{let t=e.style;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`,m),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},g=({x:e,y:t,width:n,height:r,radius:i})=>{if(!i)return`M${e} ${t}h${n}v${r}h${-n}Z`;let a=Math.min(n,r)/2,[o,s,c,l]=i.map(e=>Math.max(0,Math.min(e,a)));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`},ee=()=>f&&p,_=({x:e,y:t,width:n,height:r})=>[[e,t],[e+n,t],[e+n,t+r],[e,t+r],[e,t]],te=e=>{let t=e[0];if(!t)return[];let n=_(t)[0],r=[];return e.forEach((t,i)=>{r.push(..._(t)),i>0&&i<e.length-1&&r.push(n)}),r},ne=e=>`polygon(nonzero, ${te(e).map(([e,t])=>`${e}px ${t}px`).join(`, `)})`,re=({x:e,y:t,width:n,height:r,radius:i},a)=>{let o=`${t}px ${a.width-e-n}px ${a.height-t-r}px ${e}px`;return i?`inset(${o} round ${i.map(e=>`${e}px`).join(` `)})`:`inset(${o})`},ie=(e,t,n)=>{if(t)return`none`;if(e.length===0)return`inset(100%)`;let r=e.length===1?e[0]:void 0;return r?re(r,n):p&&e.length<=5&&!e.some(e=>e.radius)?ne(e):`path('${e.map(g).join(``)}')`},ae=e=>{if(e.length<2)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:Math.max(...e.map(e=>e.x+e.width))-t,height:Math.max(...e.map(e=>e.y+e.height))-n}},oe=(e,t,n)=>t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height,se=16,v=(e,t,n)=>t===1?e*se:t===2?e*n:e,ce=(e,t,n)=>{let r=getComputedStyle(e);return n!==0&&/auto|scroll/.test(r.overflowY)&&e.scrollHeight>e.clientHeight?!0:t!==0&&/auto|scroll/.test(r.overflowX)&&e.scrollWidth>e.clientWidth},le=(e,t,n)=>{for(let r=e;r;r=r.parentElement)if(ce(r,t,n))return r;return document.scrollingElement},y=null,b=null,x=e=>({width:e.offsetWidth||window.innerWidth,height:e.offsetHeight||window.innerHeight}),S=e=>{if(!b||!y||!oe(b,e.clientX,e.clientY))return;let t=document.elementFromPoint(e.clientX,e.clientY);if(!t||t===y)return;let n=v(e.deltaX,e.deltaMode,window.innerWidth),r=v(e.deltaY,e.deltaMode,window.innerHeight),i=le(t,n,r);i&&(i.scrollBy({left:n,top:r,behavior:`instant`}),e.cancelable&&e.preventDefault())},ue=e=>{let t=b!==null;b=e,t!==(e!==null)&&(e?window.addEventListener(`wheel`,S,{capture:!0,passive:!1}):window.removeEventListener(`wheel`,S,{capture:!0}))},C=0,de=e=>{if(e===C)return;C=e;let t=document.documentElement.style;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`))},w=(e,{modal:t,rects:n,inset:r},i)=>{if(de(r),!f){let r=t||n.length>0;e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let a=ie(n,t,i),o=a===`none`||CSS.supports(`clip-path`,a)?a:`inset(100%)`;e.style.setProperty(`clip-path`,o,`important`),ue(t||o!==a?null:ae(n))},fe=e=>{if(typeof e!=`object`||!e)return 0;let{top:t}=e;return typeof t!=`number`||!Number.isFinite(t)||t<=0?0:Math.min(Math.round(t),d)},pe=e=>{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},me=(e,t)=>{if(typeof e!=`object`||!e)return null;let{x:n,y:r,width:i,height:a}=e;if(![n,r,i,a].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;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=pe(e.radius);return{x:c,y:l,width:u-c,height:d-l,...f?{radius:f}:{}}},T={"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`,clipped:`it is clipped away or positioned outside the viewport`,"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`},E=e=>Array.isArray(e)?e.slice(0,u).flatMap(e=>{if(typeof e!=`object`||!e)return[];let{kind:t,cause:n,level:r}=e;return typeof t!=`string`||t.length>40||typeof n!=`string`||!(n in T)||r!==`full`&&r!==`liveness`?[]:[{kind:t,cause:n,level:r}]}):[],D=new Set,he=e=>{for(let{kind:t,cause:n,level:r}of e)D.has(t)||(D.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.
2
2
  @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`?`
3
- This browser reports limited detail, so the cause above is a best guess.`:``)))},O=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=e,r=(Array.isArray(n.rects)?n.rects.slice(0,l):[]).map(e=>me(e,t)).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:n.modal===!0,rects:r,hidden:E(n.hidden),inset:fe(n.inset)}},ge=()=>y!==null,k=null,A=null,_e=()=>{if(!y||k===null)return;let e=x(y),t=O(k,e);t&&w(y,t,e)},ve=e=>{typeof ResizeObserver<`u`&&(A??=new ResizeObserver(_e),A.disconnect(),A.observe(e))},ye=e=>{h(e),w(e,{modal:!1,rects:[],hidden:[],inset:0},x(e)),y=e,ve(e)},be=e=>{if(!y)return;let t=x(y),n=O(e,t);n&&(k=e,w(y,n,t),he(n.hidden))},j=`https://fkn.app`,M=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,N=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,P=e.n(N),xe=`fkn-api-port`,Se=`fkn-api-port-ack`,Ce=2e3,F=()=>{if(!M||typeof window>`u`||window.parent===window)return Promise.resolve(void 0);let e;try{e=window.parent}catch{return Promise.resolve(void 0)}let t=new MessageChannel;return new Promise(n=>{let r=e=>{if(clearTimeout(a),t.port1.removeEventListener(`message`,i),!e)try{t.port1.close()}catch{}n(e)},i=e=>{e.data?.type===Se&&r(t.port1)},a=setTimeout(()=>r(void 0),Ce);t.port1.addEventListener(`message`,i),t.port1.start();try{e.postMessage({type:xe},j,[t.port2])}catch{r(void 0)}})},I,we=()=>{if(I||!M)return I;let t=M.querySelector(`iframe[src="${P}"]`);if(t)I=t;else{let t=M.createElement(`iframe`);t.setAttribute(`allow`,e.i(N)),t.src=P,M.body.appendChild(t),I=t}return c(I,P,j),ye(I),I},L=(async()=>{if(!M)return;let e=await F();if(e)return{receive:e,emit:e};let t=we();if(!t)return;await a(t);let n=t.contentWindow;return n?{receive:window,emit:n}:void 0})(),Te=(e,{boundRetired:t=e=>e}={})=>{let n,r=0,i=!1,a=()=>{},o=()=>new Promise(e=>{a=e}),s=o(),c=s,l=new Set,u=new Set,d=0,f=0,p=()=>{let e=[...u];u.clear();let t=Error(`FKN: the broker was replaced while this call was pending; retry it`);for(let n of e)try{n(t)}catch{}};(async()=>{for await(let t of e){let e=++r;n={remote:t,epoch:e};let i=a;s=o(),i(t),p();for(let n of[...l])try{n(t,e)}catch{}}})().catch(()=>{});let m=async(e,r)=>{let a=n?.remote??await(i?t(s):s);for(let t of e.slice(0,-1))a=a[t];let o=a[e[e.length-1]??``];d=Date.now(),f+=1;let c=()=>{},l=new Promise((e,t)=>{c=t});u.add(c);try{return await Promise.race([Promise.resolve(o.apply(a,r)),l])}finally{--f,u.delete(c),d=Date.now()}},h=new Map,g=e=>{let t=e.join(`\0`),r=h.get(t);if(r)return r;let i=new Proxy(function(){},{get:(t,r)=>{if(typeof r!=`string`||r===`then`)return;let i=n;if(i){let t=i.remote;for(let n of e)t=t?.[n];if(t?.[r]===void 0)return}return g([...e,r])},apply:(t,n,r)=>m(e,r)});return h.set(t,i),i};return{facade:g([]),first:c.then(()=>{}),current:()=>n,onEpoch:e=>{if(l.add(e),n)try{e(n.remote,n.epoch)}catch{}return()=>{l.delete(e)}},lastCall:()=>d,inFlight:()=>f,routable:()=>n?Promise.resolve():s.then(()=>{}),retire:()=>{i=!0,n=void 0,p()}}},R=!1,z=new Set,B=()=>R,Ee=()=>{if(!R){R=!0;for(let e of[...z])try{e()}catch{}z.clear()}},V=e=>{R?e():z.add(e)},De=typeof window<`u`||typeof self<`u`,H=async()=>{if(typeof window<`u`)return L;if(typeof self<`u`)return{receive:self,emit:self}},U=`fkn-api`,Oe=`fkn-api-window`,ke={async*[Symbol.asyncIterator](){let e=await H();if(!e){await new Promise(()=>{});return}if(!B()){let n=new AbortController;V(()=>n.abort());for await(let r of(0,t.expose)({},{key:U,transport:e,unregisterSignal:n.signal})){if(n.signal.aborted)break;yield r}}yield*(0,t.expose)({},{key:Oe,transport:e})}},W=!1,G=H().then(e=>new Promise(n=>{if(!e)return;let{receive:r}=e,i=e=>{(0,t.checkOsraMessageKey)(e.data,U)&&(r.removeEventListener(`message`,i),W=!0,n())};r.addEventListener(`message`,i)})),K=Te(ke,{boundRetired:e=>Promise.race([e,G.then(()=>Q(e,()=>new Z))])});V(()=>K.retire());var q=Promise.race([K.first,new Promise(e=>V(e))]).then(()=>K.facade),J=8e3,Ae=1e3,Y=!1,X=class extends Error{constructor(e,t){super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`),this.name=`BrokerUnreachableError`}},Z=class extends Error{constructor(){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`}},Q=(e,t)=>{let n=Y?Ae:J;return Promise.race([e,new Promise((e,r)=>setTimeout(()=>{Y=!0,r(t(n))},n))])},je=e=>B()?Q(K.routable().then(()=>K.facade),t=>W?new Z:new X(e,t)):Q(q,t=>new X(e,t));V(()=>{G.then(()=>{let e=setTimeout(()=>console.error(new Z),J);K.routable().then(()=>clearTimeout(e))})});var $=K.onEpoch,Me=K.current,Ne=K.lastCall,Pe=K.inFlight;$(e=>{ge()&&e.overlay.setHost(be,{exactClips:ee(),colorScheme:m}).catch(()=>{})}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return $}});
3
+ This browser reports limited detail, so the cause above is a best guess.`:``)))},O=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=e,r=(Array.isArray(n.rects)?n.rects.slice(0,l):[]).map(e=>me(e,t)).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:n.modal===!0,rects:r,hidden:E(n.hidden),inset:fe(n.inset)}},ge=()=>y!==null,k=null,A=null,_e=()=>{if(!y||k===null)return;let e=x(y),t=O(k,e);t&&w(y,t,e)},ve=e=>{typeof ResizeObserver<`u`&&(A??=new ResizeObserver(_e),A.disconnect(),A.observe(e))},ye=e=>{h(e),w(e,{modal:!1,rects:[],hidden:[],inset:0},x(e)),y=e,ve(e)},be=e=>{if(!y)return;let t=x(y),n=O(e,t);n&&(k=e,w(y,n,t),he(n.hidden))},j=`https://fkn.app`,M=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,N=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,P=e.n(N),xe=`fkn-api-port`,Se=`fkn-api-port-ack`,Ce=2e3,F=()=>{if(!M||typeof window>`u`||window.parent===window)return Promise.resolve(void 0);let e;try{e=window.parent}catch{return Promise.resolve(void 0)}let t=new MessageChannel;return new Promise(n=>{let r=e=>{if(clearTimeout(a),t.port1.removeEventListener(`message`,i),!e)try{t.port1.close()}catch{}n(e)},i=e=>{e.data?.type===Se&&r(t.port1)},a=setTimeout(()=>r(void 0),Ce);t.port1.addEventListener(`message`,i),t.port1.start();try{e.postMessage({type:xe},j,[t.port2])}catch{r(void 0)}})},I,we=()=>{if(I||!M)return I;let t=M.querySelector(`iframe[src="${P}"]`);if(t)I=t;else{let t=M.createElement(`iframe`);t.setAttribute(`allow`,e.i(N)),t.src=P,M.body.appendChild(t),I=t}return c(I,P,j),ye(I),I},L=(async()=>{if(!M)return;let e=await F();if(e)return{receive:e,emit:e};let t=we();if(!t)return;await a(t);let n=t.contentWindow;return n?{receive:window,emit:n}:void 0})(),Te=(e,{boundRetired:t=e=>e}={})=>{let n,r=0,i=!1,a=()=>{},o=()=>new Promise(e=>{a=e}),s=o(),c=s,l=new Set,u=new Set,d=0,f=0,p=()=>{let e=[...u];u.clear();let t=Error(`FKN: the broker was replaced while this call was pending; retry it`);for(let n of e)try{n(t)}catch{}};(async()=>{for await(let t of e){let e=++r;n={remote:t,epoch:e};let i=a;s=o(),i(t),p();for(let n of[...l])try{n(t,e)}catch{}}})().catch(()=>{});let m=async(e,r)=>{let a=n?.remote??await(i?t(s):s);for(let t of e.slice(0,-1))a=a[t];let o=a[e[e.length-1]??``];d=Date.now(),f+=1;let c=()=>{},l=new Promise((e,t)=>{c=t});u.add(c);try{return await Promise.race([Promise.resolve(o.apply(a,r)),l])}finally{--f,u.delete(c),d=Date.now()}},h=new Map,g=e=>{let t=e.join(`\0`),r=h.get(t);if(r)return r;let i=new Proxy(function(){},{get:(t,r)=>{if(typeof r!=`string`||r===`then`)return;let i=n;if(i){let t=i.remote;for(let n of e)t=t?.[n];if(t?.[r]===void 0)return}return g([...e,r])},apply:(t,n,r)=>m(e,r)});return h.set(t,i),i};return{facade:g([]),first:c.then(()=>{}),current:()=>n,onEpoch:e=>{if(l.add(e),n)try{e(n.remote,n.epoch)}catch{}return()=>{l.delete(e)}},lastCall:()=>d,inFlight:()=>f,routable:()=>n?Promise.resolve():s.then(()=>{}),retire:()=>{i=!0,n=void 0,p()}}},R=!1,z=new Set,B=()=>R,Ee=()=>{if(!R){R=!0;for(let e of[...z])try{e()}catch{}z.clear()}},V=e=>{R?e():z.add(e)},De=typeof window<`u`||typeof self<`u`,H=async()=>{if(typeof window<`u`)return L;if(typeof self<`u`)return{receive:self,emit:self}},U=`fkn-api`,Oe=`fkn-api-window`,ke={async*[Symbol.asyncIterator](){let e=await H();if(!e)await new Promise(()=>{});else{if(!B()){let n=new AbortController;V(()=>n.abort());for await(let r of(0,t.expose)({},{key:U,transport:e,unregisterSignal:n.signal})){if(n.signal.aborted)break;yield r}}yield*(0,t.expose)({},{key:Oe,transport:e})}}},W=!1,G=H().then(e=>new Promise(n=>{if(!e)return;let{receive:r}=e,i=e=>{(0,t.checkOsraMessageKey)(e.data,U)&&(r.removeEventListener(`message`,i),W=!0,n())};r.addEventListener(`message`,i)})),K=Te(ke,{boundRetired:e=>Promise.race([e,G.then(()=>Q(e,()=>new Z))])});V(()=>K.retire());var q=Promise.race([K.first,new Promise(e=>V(e))]).then(()=>K.facade),J=8e3,Ae=1e3,Y=!1,X=class extends Error{constructor(e,t){super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`),this.name=`BrokerUnreachableError`}},Z=class extends Error{constructor(){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`}},Q=(e,t)=>{let n=Y?Ae:J;return Promise.race([e,new Promise((e,r)=>setTimeout(()=>{Y=!0,r(t(n))},n))])},je=e=>B()?Q(K.routable().then(()=>K.facade),t=>W?new Z:new X(e,t)):Q(q,t=>new X(e,t));V(()=>{G.then(()=>{let e=setTimeout(()=>console.error(new Z),J);K.routable().then(()=>clearTimeout(e))})});var $=K.onEpoch,Me=K.current,Ne=K.lastCall,Pe=K.inFlight;$(e=>{ge()&&e.overlay.setHost(be,{exactClips:ee(),colorScheme:m}).catch(()=>{})}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return $}});
package/api.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./api-CrUO33y-.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-DrvhPN56.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 { X as Resolvers } from "./contract-BGMJVvTg.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-xh6lzApn.js";
1
+ import { X as Resolvers } from "./contract-0rua6Wsh.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-0Yp9uZcV.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 @@
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-BvJu2X1L.js";
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 };
1
+ export { t as API_DEADLINE_MS, n as BrokerUnreachableError, r as OwnChannelUnavailableError, i as apiInFlight, a as apiLastCall, o as apiPromise, s as apiWithin, c as currentApiEpoch, l as hasTransport, u as onApiEpoch } from "./api-DRglK7ft.js";
@@ -1,4 +1,3 @@
1
- //#region ../web-extension/lib/permission/shared/hosts.d.ts
2
1
  /** What `normalizeHosts` keeps beyond a bare hostname. */
3
2
  type NormalizeHostsOptions = {
4
3
  /**
@@ -14,8 +13,6 @@ type NormalizeHostsOptions = {
14
13
  * and the middle page all run this one function.
15
14
  */
16
15
  declare const normalizeHosts: (raw: readonly string[], { ipv6 }?: NormalizeHostsOptions) => string[];
17
- //#endregion
18
- //#region src/attach-policy.d.ts
19
16
  /**
20
17
  * The pure half of the middle page's frame.fetch gate: what can be decided from the attachment's own
21
18
  * facts, with no broker and no UI. The middle page enforces it on EVERY fetch call, because any app
@@ -52,5 +49,4 @@ export type FrameFetchClassifier = 'no-base' | 'fetchTarget';
52
49
  export declare const frameFetchVerdict: (policy: FrameFetchPolicy, url: unknown, { classifier }?: {
53
50
  classifier?: FrameFetchClassifier;
54
51
  }) => FrameFetchVerdict;
55
- //#endregion
56
52
  export { normalizeHosts as normalizeDeclaredHosts };
package/attach-policy.js CHANGED
@@ -1,5 +1,5 @@
1
- import { l as e, t } from "./hosts-t7CKGTRz.js";
2
- //#region src/attach-policy.ts
1
+ import { l as e, t } from "./hosts-HUfgMimI.js";
2
+ // src/attach-policy.ts
3
3
  var n = (t, n, { classifier: r = "no-base" } = {}) => {
4
4
  if (!t.session) return {
5
5
  kind: "refuse",
@@ -37,5 +37,4 @@ var n = (t, n, { classifier: r = "no-base" } = {}) => {
37
37
  promptHosts: a
38
38
  };
39
39
  };
40
- //#endregion
41
40
  export { n as frameFetchVerdict, t as normalizeDeclaredHosts };
@@ -1,4 +1,4 @@
1
- //#region ../platform-policy/src/index.ts
1
+ // ../platform-policy/src/index.ts
2
2
  var e = /* @__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(","), t = (e) => e.toLowerCase().replace(/\.+$/, ""), n = ["79.127.204.69", "152.233.49.59"], r = (e) => {
3
3
  let t;
4
4
  try {
@@ -48,5 +48,4 @@ var e = /* @__PURE__ */ "fkn.app,fkn.dev,sdbx.app,horionsoftware.com,webvpn.dev,
48
48
  frame.style.cssText = 'position:fixed!important;top:0!important;left:0!important;width:100%!important;height:100%!important;border:none!important;clip-path:inset(100%)!important'
49
49
  document.body.appendChild(frame)
50
50
  }`;
51
- //#endregion
52
51
  export { l as i, d as n, o as r, f as t };
package/broker-frame.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/broker-frame.d.ts
2
1
  /** The broker frame's address. `/api?coi=1` is the variant that sends COEP and CORP, which a cross-origin isolated page needs to embed at all. */
3
2
  export declare const brokerFrameSrc: (isolated: boolean) => string;
4
3
  /**
@@ -10,5 +9,4 @@ export declare const brokerFrameSrc: (isolated: boolean) => string;
10
9
  * in a framed page, which asks its parent for a broker first. Every step that fails leaves the
11
10
  * mount to the lib, as without it.
12
11
  */
13
- export declare const brokerFrameScript: string;
14
- //#endregion
12
+ export declare const brokerFrameScript: string;
package/broker-frame.js CHANGED
@@ -1,2 +1 @@
1
- import { n as e, t } from "./broker-frame-B31OXcnH.js";
2
- export { t as brokerFrameScript, e as brokerFrameSrc };
1
+ export { t as brokerFrameScript, n as brokerFrameSrc } from "./broker-frame-vjSpBa8d.js";
@@ -1,4 +1,4 @@
1
- //#region src/busy.ts
1
+ // src/busy.ts
2
2
  var e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), n = (t) => {
3
3
  e.set(t, (e.get(t) ?? 0) + 1);
4
4
  let n = !1;
@@ -23,5 +23,4 @@ var e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), n = (t) => {
23
23
  }
24
24
  return [...n];
25
25
  };
26
- //#endregion
27
26
  export { i, a as n, r, n as t };
package/cloud/dgram.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../dgram.cjs");exports.Socket=e.Socket,exports.createSocket=e.createSocket,exports.default=e.default;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../dgram-D9ljiUFh.cjs");exports.Socket=e.t,exports.createSocket=e.n,exports.default=e.r;
package/cloud/dgram.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import _default, { Socket, createSocket } from "../dgram.js";
1
+ import { n as _default, r as createSocket, t as Socket } from "../dgram-BYk-QDHW.js";
2
2
  export { Socket, createSocket, _default as default };
package/cloud/dgram.js CHANGED
@@ -1,2 +1 @@
1
- import e, { Socket as t, createSocket as n } from "../dgram.js";
2
- export { t as Socket, n as createSocket, e as default };
1
+ export { t as Socket, n as createSocket, r as default } from "../dgram-BBbLokVF.js";
package/cloud/dns.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../dns.cjs");exports.lookup=e.lookup;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../dns-2v96zoEh.cjs");exports.lookup=e.n;
package/cloud/dns.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { s as AddressLookupResult } from "../contract-BGMJVvTg.js";
2
- import { lookup } from "../dns.js";
1
+ import { s as AddressLookupResult } from "../contract-0rua6Wsh.js";
2
+ import { n as lookup } from "../dns-DyB4K2oE.js";
3
3
  export { type AddressLookupResult, lookup };
package/cloud/dns.js CHANGED
@@ -1,2 +1 @@
1
- import { lookup as e } from "../dns.js";
2
- export { e as lookup };
1
+ export { n as lookup } from "../dns-o8DLFjP1.js";
package/cloud/fetch.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../proxy-jdE5tCwz.cjs");exports.fetch=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../proxy-DVgGp6A8.cjs");exports.fetch=e.t;
package/cloud/fetch.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { t as cloudFetch } from "../proxy-Dz60YyYy.js";
1
+ import { t as cloudFetch } from "../proxy-BP40IXYD.js";
2
2
  export { cloudFetch as fetch };
package/cloud/fetch.js CHANGED
@@ -1,2 +1 @@
1
- import { t as e } from "../proxy-C4sYkxB5.js";
2
- export { e as fetch };
1
+ export { t as fetch } from "../proxy-BBAQxJmP.js";
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var{readFile:e,writeFile:t,unlink:n,rename:r,readdir:i,mkdir:a,rm:o,rmdir:s,stat:c,lstat:l,access:u}=require("../fs.cjs").promises;exports.access=u,exports.lstat=l,exports.mkdir=a,exports.readFile=e,exports.readdir=i,exports.rename=r,exports.rm=o,exports.rmdir=s,exports.stat=c,exports.unlink=n,exports.writeFile=t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var{readFile:e,writeFile:t,unlink:n,rename:r,readdir:i,mkdir:a,rm:o,rmdir:s,stat:c,lstat:l,access:u}=require("../../fs-BX_ghRy0.cjs").a;exports.access=u,exports.lstat=l,exports.mkdir=a,exports.readFile=e,exports.readdir=i,exports.rename=r,exports.rm=o,exports.rmdir=s,exports.stat=c,exports.unlink=n,exports.writeFile=t;
@@ -1,9 +1,7 @@
1
- import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions } from "../../index-BQgZVQl7.js";
2
- import "../../fs-DCJAYoYy.js";
3
- //#region src/cloud/fs-promises.d.ts
1
+ import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions } from "../../index-CcVwh9yz.js";
2
+ import "../../fs-ChOYC6VD.js";
4
3
  export declare const readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>, writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>, unlink: (path: import("node:fs").PathLike) => Promise<void>, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>, readdir: (path: import("node:fs").PathLike) => Promise<string[]>, mkdir: (_path?: import("node:fs").PathLike, _options?: MakeOptions) => Promise<void>, rm: (path: import("node:fs").PathLike, options?: {
5
4
  recursive?: boolean;
6
5
  }) => Promise<void>, rmdir: (path: import("node:fs").PathLike, options?: {
7
6
  recursive?: boolean;
8
- }) => Promise<void>, stat: (path: import("node:fs").PathLike) => Promise<Stats>, lstat: (path: import("node:fs").PathLike) => Promise<Stats>, access: (path: import("node:fs").PathLike) => Promise<void>;
9
- //#endregion
7
+ }) => Promise<void>, stat: (path: import("node:fs").PathLike) => Promise<Stats>, lstat: (path: import("node:fs").PathLike) => Promise<Stats>, access: (path: import("node:fs").PathLike) => Promise<void>;