@fkn/lib 0.9.41 → 0.9.42

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 (76) hide show
  1. package/{account-generation-CSnZiN18.cjs → account-generation-B-6Pn0b5.cjs} +1 -1
  2. package/{account-generation-D7TpIoKt.js → account-generation-XNWOvLea.js} +5 -5
  3. package/account.cjs +1 -1
  4. package/account.js +6 -6
  5. package/api--LOXTOpv.cjs +3 -0
  6. package/{api-Dp-2AT3u.js → api-DIgTslNb.js} +154 -114
  7. package/{api-Cbty0JUM.d.ts → api-SwxtiYVU.d.ts} +24 -2
  8. package/api.cjs +1 -1
  9. package/api.d.ts +3 -3
  10. package/api.js +2 -2
  11. package/attach-policy.cjs +1 -1
  12. package/attach-policy.js +2 -2
  13. package/cloud/dns.d.ts +1 -1
  14. package/cloud/fetch.cjs +1 -1
  15. package/cloud/fetch.d.ts +1 -1
  16. package/cloud/fetch.js +1 -1
  17. package/cloud/fs.cjs +1 -1
  18. package/cloud/fs.js +1 -1
  19. package/cloud/net.d.ts +1 -1
  20. package/cloud-868OlBKn.cjs +1 -0
  21. package/{cloud-4t1WoEZn.d.ts → cloud-DUH-v10C.d.ts} +5 -3
  22. package/cloud-f3j4s8yZ.js +545 -0
  23. package/cloud.cjs +1 -1
  24. package/cloud.d.ts +3 -3
  25. package/cloud.js +2 -2
  26. package/{contract-BRc2ptdC.d.ts → contract-CCxPKIC7.d.ts} +77 -7
  27. package/contract.d.ts +3 -2
  28. package/dgram.cjs +1 -1
  29. package/dgram.d.ts +2 -2
  30. package/dgram.js +1 -1
  31. package/dns.cjs +1 -1
  32. package/dns.d.ts +1 -1
  33. package/dns.js +1 -1
  34. package/extension-BOBuYwZc.js +92 -0
  35. package/extension-hoUs5yJ7.cjs +1 -0
  36. package/{extension-DMU-CwMw.d.ts → extension-yhwDSIiD.d.ts} +22 -3
  37. package/extension.cjs +1 -1
  38. package/extension.d.ts +3 -3
  39. package/extension.js +3 -3
  40. package/fs/promises.cjs +1 -1
  41. package/fs/promises.js +1 -1
  42. package/{fs-q7Kg51hq.js → fs-CVnmXRf7.js} +1 -1
  43. package/{fs-BTyRnUPI.cjs → fs-p0bOOj5n.cjs} +1 -1
  44. package/fs.cjs +1 -1
  45. package/fs.js +2 -2
  46. package/{hosts-9dYv63ud.cjs → hosts-GNBhZO3-.cjs} +1 -1
  47. package/{hosts-BzbzOhG8.js → hosts-t7CKGTRz.js} +4 -1
  48. package/http.d.ts +1 -1
  49. package/{index-D2CA-NX5.d.ts → index-BtFiGoVQ.d.ts} +465 -51
  50. package/index.cjs +1 -1
  51. package/index.d.ts +16 -16
  52. package/index.js +62 -59
  53. package/lib-CfdmsLoI.cjs +53 -0
  54. package/{lib-C4Eeg9eM.js → lib-DppqX10G.js} +470 -302
  55. package/{net-CcEZP6Bb.d.ts → net-DcLF-6E-.d.ts} +2 -2
  56. package/net.cjs +1 -1
  57. package/net.d.ts +1 -1
  58. package/net.js +1 -1
  59. package/package.json +1 -1
  60. package/packages.cjs +1 -1
  61. package/packages.d.ts +1 -1
  62. package/packages.js +14 -14
  63. package/{proxy-D6YtsO1g.d.ts → proxy-CE46SkyA.d.ts} +2 -2
  64. package/{proxy-DjoPtJH9.cjs → proxy-CFK-KiwE.cjs} +1 -1
  65. package/{proxy-DMTdQ4dN.js → proxy-Dixbk1WL.js} +1 -1
  66. package/rooms.cjs +1 -1
  67. package/rooms.d.ts +1 -1
  68. package/rooms.js +11 -11
  69. package/{storage-BS5WMO4f.cjs → storage-D2cUJlVH.cjs} +1 -1
  70. package/{storage-BWmGrO6a.js → storage-Dn1gTLSZ.js} +2 -2
  71. package/api-jOTOA-5n.cjs +0 -3
  72. package/cloud-BLv19j-W.js +0 -480
  73. package/cloud-D7aQY4GH.cjs +0 -1
  74. package/extension-B9v933cT.js +0 -89
  75. package/extension-D2zMdc2f.cjs +0 -1
  76. package/lib-BfAg9mHD.cjs +0 -53
package/cloud.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as e } from "./proxy-DMTdQ4dN.js";
2
- import { i as t, r as n, t as r } from "./cloud-BLv19j-W.js";
1
+ import { t as e } from "./proxy-Dixbk1WL.js";
2
+ import { i as t, r as n, t as r } from "./cloud-f3j4s8yZ.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";
@@ -1,4 +1,4 @@
1
- import { K as SelectorPart, v as GotoOptions } from "./index-D2CA-NX5.js";
1
+ import { $ as SelectorPart, u as ClearCookiesWire } from "./index-BtFiGoVQ.js";
2
2
  import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
3
3
  //#region src/contract.d.ts
4
4
  /**
@@ -221,9 +221,26 @@ declare const WINDOW_JAR_MODE_TIMEOUT_MS = 30000;
221
221
  * connect, or to say why it cannot.
222
222
  */
223
223
  declare const WINDOW_HANDSHAKE_TIMEOUT_MS: number;
224
- /** A goto on the shell's control channel. */
225
- type ShellGotoOptions = GotoOptions & {
224
+ /**
225
+ * A goto on the middle page's control channel, as a library sends it; the middle page hands it on to
226
+ * the shell as it came. Its own names, which never change with the public `GotoOptions`: the public
227
+ * `timeout` travels as `timeoutMs`.
228
+ */
229
+ type MiddleGotoOptions = {
230
+ /**
231
+ * `'load'`, the default, once the goto's document fired load. `'commit'`, the public value: the
232
+ * goto resolves once its document holds the frame, and rejects when none came by the deadline. A
233
+ * shell that predates it reads `'commit'` as `'load'`, which never resolves before commit.
234
+ * `'documentstart'`, which no current library sends, keeps its wire meaning for every library that
235
+ * predates `'commit'`: resolving as soon as the navigation starts.
236
+ */
237
+ waitUntil?: 'load' | 'commit' | 'documentstart';
238
+ /** The goto's deadline in milliseconds, 30000 when absent. */
226
239
  timeoutMs?: number;
240
+ domains?: string[];
241
+ };
242
+ /** A goto on the shell's control channel. */
243
+ type ShellGotoOptions = MiddleGotoOptions & {
227
244
  /**
228
245
  * For an attachment's first navigation: past its deadline, a document that committed but never
229
246
  * fired load counts as loaded, the rule the inline attachment's first load follows. Ignored by a
@@ -245,6 +262,32 @@ type ShellControl = {
245
262
  flushCookies?(): Promise<void>;
246
263
  /** Removes a window shell's own site storage; resolves at once for a shell whose storage is shared. */
247
264
  sweepStorage?(): Promise<void>;
265
+ /**
266
+ * The url this shell's empty page is armed for (`?blank=`), `''` when none: a shell mounted with
267
+ * `?url=` or nothing, or one whose first goto disarmed it. Absent from a shell that predates blank
268
+ * pages, which reads no target from `?blank=` and so loads nothing.
269
+ */
270
+ blank?(): Promise<string>;
271
+ /**
272
+ * Removes the cookies `filter` matches from this shell's jar, among the cookies of `scope.hosts`'
273
+ * sites only: a cookie is in reach when its domain's own registered domain is that of one of the
274
+ * hosts, or its domain is exactly a host that is itself a public suffix, so `amazonaws.com` reaches
275
+ * no `mybucket.s3.amazonaws.com` cookie, a site of its own under `s3.amazonaws.com`. Resolves
276
+ * `undefined` once its live realms dropped them (waiting at most 2000 ms) and the removal is
277
+ * committed, and takes the same steps when nothing matched, so neither its answer nor its time says
278
+ * whether the jar held a cookie there. That holds for `{ equals }` options, the only ones its
279
+ * middle page sends for now: a `{ pattern, flags }` one is still rebuilt and tested against every
280
+ * cookie in reach, so its running time on them would be part of the call's.
281
+ *
282
+ * Refuses, before anything is removed: a filter of any other shape (a TypeError
283
+ * `frame.clearCookies: malformed filter`), an empty `scope.hosts`, and a string `domain` whose
284
+ * registered domain is none of the hosts' (each a LocatorDeniedError naming why). Rejects with the
285
+ * library's own message when the jar's store did not take the removal. Absent from a shell that
286
+ * predates it.
287
+ */
288
+ clearCookies?(filter: ClearCookiesWire, scope: {
289
+ hosts: string[];
290
+ }): Promise<void>;
248
291
  };
249
292
  /**
250
293
  * What a middle page exposes to the library, inline (`ATTACH_FRAME_KEY`) and for a window
@@ -253,9 +296,7 @@ type ShellControl = {
253
296
  */
254
297
  type MiddleControl = {
255
298
  ready(): Promise<boolean>;
256
- goto(url: string, options?: GotoOptions & {
257
- timeoutMs?: number;
258
- }): Promise<void>;
299
+ goto(url: string, options?: MiddleGotoOptions): Promise<void>;
259
300
  executeLocator(parts: SelectorPart[], operation: string, args: unknown[]): Promise<unknown>;
260
301
  /**
261
302
  * The host of the document the frame holds now, as the render proxy last reported it, and `''`
@@ -269,6 +310,35 @@ type MiddleControl = {
269
310
  * (`FRAME_MESSAGE`). Absent from one deployed before messaging, which the library refuses by name.
270
311
  */
271
312
  messaging?(): Promise<true>;
313
+ /**
314
+ * The url the attachment's empty page is armed for while the frame still holds that page, `''`
315
+ * when none, once the first goto was sent, and once the frame reported any other url, even on the
316
+ * same host. The library sends a blank attach as `?blank=` and refuses it by name unless this
317
+ * echoes that url after `ready`, and reads it again before it skips the Evaluation card on a
318
+ * fresh jar, so it asks whenever this page's fresh-jar rule has ended. A middle page that serves
319
+ * it refuses `ready` when its shell does not answer `blank()` with the same url. Absent from a
320
+ * middle page that predates blank pages, which mounts its shell with no target.
321
+ */
322
+ blank?(): Promise<string>;
323
+ /**
324
+ * Removes the cookies `filter` matches from the attachment's jar, among the cookies of the sites
325
+ * the attachment reaches: the middle page hands its shell the boundary's hosts (declared, plus the
326
+ * host of the attach url and of every goto from its send) as `ShellControl.clearCookies`' scope.
327
+ * No options travel as `{}`, and each option is `{ equals }` for now. Resolves `undefined` whatever
328
+ * the shell answered, so nothing about the jar crosses back, and the shell takes the same steps
329
+ * when nothing matched, so neither its time nor its refusals say whether the jar held a cookie
330
+ * there. Never gated: it asks for no grant and draws no card, and a frame holding no document is
331
+ * served, since a no-src attachment is what a sign-out runs on.
332
+ *
333
+ * Refuses, each with the library's own message and before anything is sent to the shell: a
334
+ * `{ pattern, flags }` option (a TypeError `frame.clearCookies: <key> is a RegExp, and clearCookies
335
+ * takes strings for name, domain and path for now`), since the shell would test it against every
336
+ * cookie in reach; a filter of any other shape (a TypeError `frame.clearCookies: malformed
337
+ * filter`); an attachment that reaches no site (LocatorDeniedError); and a shell that predates it
338
+ * (LocatorUnsupportedError). The shell's own refusals reach the library as they came. Absent from
339
+ * a middle page that predates it, which the library refuses by name.
340
+ */
341
+ clearCookies?(filter: ClearCookiesWire): Promise<void>;
272
342
  };
273
343
  /** What a window's middle page adds to its channel. */
274
344
  type WindowMiddleControl = MiddleControl & {
@@ -887,4 +957,4 @@ type Resolvers = {
887
957
  hideInstallPrompt: () => void;
888
958
  };
889
959
  //#endregion
890
- export { RoomJoinOptions as $, MountDescriptor as A, WINDOW_JAR_MODE_TIMEOUT_MS as At, ProxyFetchInit as B, FrameMessageRelay as C, TcpSocketOptions as Ct, IpFamily as D, UdpSocketResult as Dt, InstalledPackage as E, UdpSocketOptions as Et, PackagesErrorCode as F, Resolvers as G, Quota as H, PackagesFail as I, RoomCreateOptions as J, RoomBacklog as K, PickOptions as L, OverlayState as M, WriteData as Mt, PackageQuery as N, JAR_ANCHOR_MESSAGE as O, WINDOW_HANDSHAKE_TIMEOUT_MS as Ot, PackageResult as P, RoomHandle as Q, Placement as R, FrameFetchScope as S, TcpSocketListenerResult as St, InstallOptions as T, UdpDatagram as Tt, ROOM_TEMPORARY_MS as U, ProxyFetchInput as V, Radii as W, RoomEnd as X, RoomDefaults as Y, RoomEvent as Z, DnsLookup as _, ShellJarUnreachable as _t, AccountChange as a, RoomPermissions as at, FrameConsentAnswer as b, SurfaceRect as bt, AdoptRequest as c, SHELL_ATTACH_ERROR as ct, ConflictRequest as d, SHELL_JAR_MESSAGE as dt, RoomMailbox as et, ConflictSide as f, SHELL_JAR_UNREACHABLE as ft, DisplayLevel as g, ShellGotoOptions as gt, DisplayCause as h, ShellFrameMessage as ht, Account as i, RoomPermission as it, OverlayRect as j, WindowMiddleControl as jt, MiddleControl as k, WINDOW_HELLO_TIMEOUT_MS as kt, AdoptState as l, SHELL_CONTROL_KEY as lt, ConnectOptions as m, ShellControl as mt, ATTACH_WINDOW_KEY as n, RoomMessage as nt, AccountPinOptions as o, RoomsErrorCode as ot, ConnectAvailability as p, SetOverlayHost as pt, RoomClaimOptions as q, ATTACH_WINDOW_MESSAGE as r, RoomOpenOptions as rt, AddressLookupResult as s, RoomsFail as st, ATTACH_FRAME_KEY as t, RoomMember as tt, ConflictChoice as u, SHELL_FRAME_MESSAGE as ut, EncryptionState as v, StorageEntry as vt, HiddenSurface as w, TcpSocketResult as wt, FrameConsentRequest as x, TcpSocketListenerOptions as xt, FRAME_MESSAGE as y, StorageQuota as yt, ProxyFetch as z };
960
+ export { RoomHandle as $, MiddleGotoOptions as A, WINDOW_HELLO_TIMEOUT_MS as At, ProxyFetch as B, FrameMessageRelay as C, TcpSocketListenerResult as Ct, IpFamily as D, UdpSocketOptions as Dt, InstalledPackage as E, UdpDatagram as Et, PackageResult as F, Radii as G, ProxyFetchInput as H, PackagesErrorCode as I, RoomClaimOptions as J, Resolvers as K, PackagesFail as L, OverlayRect as M, WindowMiddleControl as Mt, OverlayState as N, WriteData as Nt, JAR_ANCHOR_MESSAGE as O, UdpSocketResult as Ot, PackageQuery as P, RoomEvent as Q, PickOptions as R, FrameFetchScope as S, TcpSocketListenerOptions as St, InstallOptions as T, TcpSocketResult as Tt, Quota as U, ProxyFetchInit as V, ROOM_TEMPORARY_MS as W, RoomDefaults as X, RoomCreateOptions as Y, RoomEnd as Z, DnsLookup as _, ShellGotoOptions as _t, AccountChange as a, RoomPermission as at, FrameConsentAnswer as b, StorageQuota as bt, AdoptRequest as c, RoomsFail as ct, ConflictRequest as d, SHELL_FRAME_MESSAGE as dt, RoomJoinOptions as et, ConflictSide as f, SHELL_JAR_MESSAGE as ft, DisplayLevel as g, ShellFrameMessage as gt, DisplayCause as h, ShellControl as ht, Account as i, RoomOpenOptions as it, MountDescriptor as j, WINDOW_JAR_MODE_TIMEOUT_MS as jt, MiddleControl as k, WINDOW_HANDSHAKE_TIMEOUT_MS as kt, AdoptState as l, SHELL_ATTACH_ERROR as lt, ConnectOptions as m, SetOverlayHost as mt, ATTACH_WINDOW_KEY as n, RoomMember as nt, AccountPinOptions as o, RoomPermissions as ot, ConnectAvailability as p, SHELL_JAR_UNREACHABLE as pt, RoomBacklog as q, ATTACH_WINDOW_MESSAGE as r, RoomMessage as rt, AddressLookupResult as s, RoomsErrorCode as st, ATTACH_FRAME_KEY as t, RoomMailbox as tt, ConflictChoice as u, SHELL_CONTROL_KEY as ut, EncryptionState as v, ShellJarUnreachable as vt, HiddenSurface as w, TcpSocketOptions as wt, FrameConsentRequest as x, SurfaceRect as xt, FRAME_MESSAGE as y, StorageEntry as yt, Placement as z };
package/contract.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { d as CookieMatchWire, u as ClearCookiesWire } from "./index-BtFiGoVQ.js";
1
2
  import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
2
- import { $ as RoomJoinOptions, A as MountDescriptor, At as WINDOW_JAR_MODE_TIMEOUT_MS, B as ProxyFetchInit, C as FrameMessageRelay, Ct as TcpSocketOptions, D as IpFamily, Dt as UdpSocketResult, E as InstalledPackage, Et as UdpSocketOptions, F as PackagesErrorCode, G as Resolvers, H as Quota, I as PackagesFail, J as RoomCreateOptions, K as RoomBacklog, L as PickOptions, M as OverlayState, Mt as WriteData, N as PackageQuery, O as JAR_ANCHOR_MESSAGE, Ot as WINDOW_HANDSHAKE_TIMEOUT_MS, P as PackageResult, Q as RoomHandle, R as Placement, S as FrameFetchScope, St as TcpSocketListenerResult, T as InstallOptions, Tt as UdpDatagram, U as ROOM_TEMPORARY_MS, V as ProxyFetchInput, W as Radii, X as RoomEnd, Y as RoomDefaults, Z as RoomEvent, _ as DnsLookup, _t as ShellJarUnreachable, a as AccountChange, at as RoomPermissions, b as FrameConsentAnswer, bt as SurfaceRect, c as AdoptRequest, ct as SHELL_ATTACH_ERROR, d as ConflictRequest, dt as SHELL_JAR_MESSAGE, et as RoomMailbox, f as ConflictSide, ft as SHELL_JAR_UNREACHABLE, g as DisplayLevel, gt as ShellGotoOptions, h as DisplayCause, ht as ShellFrameMessage, i as Account, it as RoomPermission, j as OverlayRect, jt as WindowMiddleControl, k as MiddleControl, kt as WINDOW_HELLO_TIMEOUT_MS, l as AdoptState, lt as SHELL_CONTROL_KEY, m as ConnectOptions, mt as ShellControl, n as ATTACH_WINDOW_KEY, nt as RoomMessage, o as AccountPinOptions, ot as RoomsErrorCode, p as ConnectAvailability, pt as SetOverlayHost, q as RoomClaimOptions, r as ATTACH_WINDOW_MESSAGE, rt as RoomOpenOptions, s as AddressLookupResult, st as RoomsFail, t as ATTACH_FRAME_KEY, tt as RoomMember, u as ConflictChoice, ut as SHELL_FRAME_MESSAGE, v as EncryptionState, vt as StorageEntry, w as HiddenSurface, wt as TcpSocketResult, x as FrameConsentRequest, xt as TcpSocketListenerOptions, y as FRAME_MESSAGE, yt as StorageQuota, z as ProxyFetch } from "./contract-BRc2ptdC.js";
3
- export { ATTACH_FRAME_KEY, ATTACH_WINDOW_KEY, ATTACH_WINDOW_MESSAGE, Account, AccountChange, AccountPinOptions, AddressLookupResult, AdoptRequest, AdoptState, ConflictChoice, ConflictRequest, ConflictSide, ConnectAvailability, ConnectOptions, DisplayCause, DisplayLevel, DnsLookup, EncryptionState, FRAME_MESSAGE, FrameConsentAnswer, FrameConsentRequest, FrameFetchScope, FrameMessageRelay, HiddenSurface, InstallOptions, InstalledPackage, IpFamily, JAR_ANCHOR_MESSAGE, MiddleControl, MountDescriptor, OverlayRect, OverlayState, PackageQuery, PackageResult, PackagesErrorCode, PackagesFail, PickOptions, Placement, ProxyFetch, ProxyFetchInit, ProxyFetchInput, Quota, ROOM_TEMPORARY_MS, Radii, Resolvers, RoomBacklog, RoomClaimOptions, RoomCreateOptions, RoomDefaults, RoomEnd, RoomEvent, RoomHandle, RoomJoinOptions, RoomMailbox, RoomMember, RoomMessage, RoomOpenOptions, RoomPermission, RoomPermissions, RoomsErrorCode, RoomsFail, SHELL_ATTACH_ERROR, SHELL_CONTROL_KEY, SHELL_FRAME_MESSAGE, SHELL_JAR_MESSAGE, SHELL_JAR_UNREACHABLE, SetOverlayHost, ShellControl, ShellFrameMessage, ShellGotoOptions, ShellJarUnreachable, StorageEntry, StorageQuota, SurfaceRect, TcpSocketListenerOptions, TcpSocketListenerResult, type TcpSocketOption, TcpSocketOptions, TcpSocketResult, UdpDatagram, type UdpSocketOption, UdpSocketOptions, UdpSocketResult, WINDOW_HANDSHAKE_TIMEOUT_MS, WINDOW_HELLO_TIMEOUT_MS, WINDOW_JAR_MODE_TIMEOUT_MS, WindowMiddleControl, WriteData };
3
+ import { $ as RoomHandle, A as MiddleGotoOptions, At as WINDOW_HELLO_TIMEOUT_MS, B as ProxyFetch, C as FrameMessageRelay, Ct as TcpSocketListenerResult, D as IpFamily, Dt as UdpSocketOptions, E as InstalledPackage, Et as UdpDatagram, F as PackageResult, G as Radii, H as ProxyFetchInput, I as PackagesErrorCode, J as RoomClaimOptions, K as Resolvers, L as PackagesFail, M as OverlayRect, Mt as WindowMiddleControl, N as OverlayState, Nt as WriteData, O as JAR_ANCHOR_MESSAGE, Ot as UdpSocketResult, P as PackageQuery, Q as RoomEvent, R as PickOptions, S as FrameFetchScope, St as TcpSocketListenerOptions, T as InstallOptions, Tt as TcpSocketResult, U as Quota, V as ProxyFetchInit, W as ROOM_TEMPORARY_MS, X as RoomDefaults, Y as RoomCreateOptions, Z as RoomEnd, _ as DnsLookup, _t as ShellGotoOptions, a as AccountChange, at as RoomPermission, b as FrameConsentAnswer, bt as StorageQuota, c as AdoptRequest, ct as RoomsFail, d as ConflictRequest, dt as SHELL_FRAME_MESSAGE, et as RoomJoinOptions, f as ConflictSide, ft as SHELL_JAR_MESSAGE, g as DisplayLevel, gt as ShellFrameMessage, h as DisplayCause, ht as ShellControl, i as Account, it as RoomOpenOptions, j as MountDescriptor, jt as WINDOW_JAR_MODE_TIMEOUT_MS, k as MiddleControl, kt as WINDOW_HANDSHAKE_TIMEOUT_MS, l as AdoptState, lt as SHELL_ATTACH_ERROR, m as ConnectOptions, mt as SetOverlayHost, n as ATTACH_WINDOW_KEY, nt as RoomMember, o as AccountPinOptions, ot as RoomPermissions, p as ConnectAvailability, pt as SHELL_JAR_UNREACHABLE, q as RoomBacklog, r as ATTACH_WINDOW_MESSAGE, rt as RoomMessage, s as AddressLookupResult, st as RoomsErrorCode, t as ATTACH_FRAME_KEY, tt as RoomMailbox, u as ConflictChoice, ut as SHELL_CONTROL_KEY, v as EncryptionState, vt as ShellJarUnreachable, w as HiddenSurface, wt as TcpSocketOptions, x as FrameConsentRequest, xt as SurfaceRect, y as FRAME_MESSAGE, yt as StorageEntry, z as Placement } from "./contract-CCxPKIC7.js";
4
+ export { ATTACH_FRAME_KEY, ATTACH_WINDOW_KEY, ATTACH_WINDOW_MESSAGE, Account, AccountChange, AccountPinOptions, AddressLookupResult, AdoptRequest, AdoptState, type ClearCookiesWire, ConflictChoice, ConflictRequest, ConflictSide, ConnectAvailability, ConnectOptions, type CookieMatchWire, DisplayCause, DisplayLevel, DnsLookup, EncryptionState, FRAME_MESSAGE, FrameConsentAnswer, FrameConsentRequest, FrameFetchScope, FrameMessageRelay, HiddenSurface, InstallOptions, InstalledPackage, IpFamily, JAR_ANCHOR_MESSAGE, MiddleControl, MiddleGotoOptions, MountDescriptor, OverlayRect, OverlayState, PackageQuery, PackageResult, PackagesErrorCode, PackagesFail, PickOptions, Placement, ProxyFetch, ProxyFetchInit, ProxyFetchInput, Quota, ROOM_TEMPORARY_MS, Radii, Resolvers, RoomBacklog, RoomClaimOptions, RoomCreateOptions, RoomDefaults, RoomEnd, RoomEvent, RoomHandle, RoomJoinOptions, RoomMailbox, RoomMember, RoomMessage, RoomOpenOptions, RoomPermission, RoomPermissions, RoomsErrorCode, RoomsFail, SHELL_ATTACH_ERROR, SHELL_CONTROL_KEY, SHELL_FRAME_MESSAGE, SHELL_JAR_MESSAGE, SHELL_JAR_UNREACHABLE, SetOverlayHost, ShellControl, ShellFrameMessage, ShellGotoOptions, ShellJarUnreachable, StorageEntry, StorageQuota, SurfaceRect, TcpSocketListenerOptions, TcpSocketListenerResult, type TcpSocketOption, TcpSocketOptions, TcpSocketResult, UdpDatagram, type UdpSocketOption, UdpSocketOptions, UdpSocketResult, WINDOW_HANDSHAKE_TIMEOUT_MS, WINDOW_HELLO_TIMEOUT_MS, WINDOW_JAR_MODE_TIMEOUT_MS, WindowMiddleControl, WriteData };
package/dgram.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-jOTOA-5n.cjs"),n=require("./busy-Dv8wzE5M.cjs"),r=require("./utils-BvgGdrgN.cjs");require("./wire.cjs");let i=require("buffer"),a=require("events"),o=require("ip-address");var s=e.t({Socket:()=>c,createSocket:()=>m,default:()=>h}),c=class extends a.EventEmitter{_type;_localAddress;_remoteAddress;_connectedLocally;_connectGeneration=0;_destroyed=!1;_busyRelease;_webVPNUdpSocketPromise;_dataPort;_socketId;_sendQueue=[];_sendQueueBytes=0;_sendFlushScheduled=!1;_peerTailCache=new Map;constructor(e){if(super(e),!e)throw Error(`Missing options`);this._type=e.type,e.connection&&this.__webvpn_udp_socket_init__(e.connection)}_lastRecvBufferSize=0;_lastSendBufferSize=0;_lastTtl=64;_lastMulticastTtl=1;_lastMulticastLoopback=!0;_setUdpOption(e){if(!this._webVPNUdpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before bind`));return}this._webVPNUdpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}_dataPortAcks=!1;_dataPortConsumedBytes=0;_dataPortAckedBytes=0;_ackDataPortBatch(e){if(!this._dataPortAcks||!this._dataPort||(this._dataPortConsumedBytes+=e,this._dataPortAckedBytes!==0&&this._dataPortConsumedBytes-this._dataPortAckedBytes<524288))return;this._dataPortAckedBytes=this._dataPortConsumedBytes;let t={type:r.n,consumedBytes:this._dataPortConsumedBytes};this._dataPort.postMessage(t)}_onTransportClosed(e){this._destroyed||(this._destroyed=!0,this._busyRelease?.(),this._dataPort?.close(),this._dataPort=void 0,this.listenerCount(`error`)>0&&this.emit(`error`,Error(e||`WebVPN session closed`)),this.emit(`close`))}_onDataPortBatch(e){let t=new DataView(e),n=!1,r,a=0;for(;a+4<=e.byteLength;){let o=t.getUint32(a);a+=4;let s=a+o;if(s>e.byteLength)break;let c=a+4,l=t.getUint8(c);c+=1;let u,d,p;if(l===2){if(!this._remoteAddress){a=s;continue}u=this._remoteAddress.address,d=this._remoteAddress.family,p=this._remoteAddress.port}else{let n=new Uint8Array(e,c,l===0?4:16);l===0?(d=`IPv4`,u=`${n[0]}.${n[1]}.${n[2]}.${n[3]}`):(d=`IPv6`,u=f(n)),c+=n.byteLength,p=t.getUint16(c),c+=2}let m=t.getUint32(c);c+=4;try{this.emit(`message`,i.Buffer.from(e.slice(c,c+m)),{address:u,family:d,port:p,size:m})}catch(e){n||(n=!0,r=e)}a=s}if(n)throw r}_peerTail(e,t){if(e===void 0||t===void 0)return l;let n=`${e}|${t}`,r=this._peerTailCache.get(n);if(r)return r;let i=o.Address4.isValid(e)?d(e):p(e),a=new Uint8Array(1+i.byteLength+2);return a[0]=i.byteLength===4?0:1,a.set(i,1),new DataView(a.buffer).setUint16(1+i.byteLength,t),this._peerTailCache.size>=4096&&this._peerTailCache.clear(),this._peerTailCache.set(n,a),a}_portSend(e,t,n){let r=this._peerTail(t,n),i=new Uint8Array(8+r.byteLength+4+e.byteLength),a=new DataView(i.buffer);a.setUint32(0,i.byteLength-4),a.setUint32(4,this._socketId),i.set(r,8),a.setUint32(8+r.byteLength,e.byteLength),i.set(e,12+r.byteLength),this._sendQueue.push(i),this._sendQueueBytes+=i.byteLength,!this._sendFlushScheduled&&(this._sendFlushScheduled=!0,queueMicrotask(()=>{this._sendFlushScheduled=!1;let e=this._sendQueue,t=this._sendQueueBytes;if(this._sendQueue=[],this._sendQueueBytes=0,!e.length||!this._dataPort)return;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;this._dataPort.postMessage(n.buffer,[n.buffer])}))}addMembership(e,t){if(o.Address4.isValid(e)){let n=d(e),r=t&&o.Address4.isValid(t)?d(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=p(e);this._setUdpOption({type:7,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}address(){if(!this._localAddress)throw Error(`EBADF`);return this._localAddress}bind(...e){let n=r.o(...e),i=this._type===`udp6`?`::`:`0.0.0.0`,a=this.__webvpn_udp_socket_init__(t.o(`a udp socket`).then(e=>e.cloud.webvpn.udpSocket({type:this._type,address:n.address??i,port:n.port,dataPort:!0})));return n.callback&&a.then(e=>{e&&n.callback.call(this)}),this}__webvpn_udp_socket_init__(e,t){return t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort}),this._busyRelease??=n.t(`udp socket`),this._webVPNUdpSocketPromise=e.then(e=>{if(e.dataPort)this._socketId=e.socketId,this._dataPort=e.dataPort,this._dataPortAcks=e.dataPortAcks===!0,this._dataPort.onmessage=e=>{try{this._onDataPortBatch(e.data)}finally{this._ackDataPortBatch(e.data.byteLength)}};else{let t=e.dataReadableStream.getReader();(async()=>{for(;;){let{value:e,done:n}=await t.read();if(n)return;this.emit(`message`,i.Buffer.from(e.data),{address:e.address,family:e.family,port:e.port,size:e.size})}})().catch(e=>this._onTransportClosed(e instanceof Error?e.message:void 0))}return e.closed?.then(e=>this._onTransportClosed(e?.reason)).catch(()=>{}),this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e}).catch(e=>{this.emit(`error`,e)}),this._webVPNUdpSocketPromise.then(e=>{if(!e){this._busyRelease?.();return}this.emit(`listening`)}),this._webVPNUdpSocketPromise}close(e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);return this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=this._destroyed;this._destroyed=!0,this._busyRelease?.(),this._dataPort?.close(),this._dataPort=void 0;try{await t.close()}finally{try{e&&e()}finally{n||this.emit(`close`)}}}).catch(()=>{}),this}connect(...e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=e[0],r=this._type===`udp6`?`::1`:`127.0.0.1`,i=typeof e[1]==`string`?e[1]:r,a=typeof e.at(-1)==`function`?e.at(-1):void 0,o=await t.connect({remotePort:n,remoteAddress:i});this._connectedLocally=o?.local===!0,this._remoteAddress=o?.address?{address:o.address,family:o.family,port:o.port}:{address:i,family:this._type===`udp6`?`IPv6`:`IPv4`,port:n},this._connectGeneration+=1,a&&a()}).catch(e=>{this.emit(`error`,e)})}disconnect(){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);let e=this._remoteAddress,t=this._connectedLocally,n=this._connectGeneration;this._remoteAddress=void 0,this._connectedLocally=void 0,this._webVPNUdpSocketPromise.then(e=>e?.disconnect?.()).catch(r=>{this._connectGeneration===n&&(this._remoteAddress=e,this._connectedLocally=t),this.emit(`error`,r)})}dropMembership(e,t){if(o.Address4.isValid(e)){let n=d(e),r=t&&o.Address4.isValid(t)?d(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=p(e);this._setUdpOption({type:8,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}getRecvBufferSize(){return this._lastRecvBufferSize}getSendBufferSize(){return this._lastSendBufferSize}getSendQueueSize(){return 0}getSendQueueCount(){return 0}ref(){return this}remoteAddress(){if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);return{address:this._remoteAddress.address,family:this._remoteAddress.family,port:this._remoteAddress.port}}send(...e){this._webVPNUdpSocketPromise||this.bind();let t=r.s(...e),n=u(t.message),i=n;if(t.hasRange){let{offset:e,length:r}=t;if(!Number.isInteger(e)||e<0||e>n.byteLength)throw Object.assign(RangeError(`"offset" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});if(!Number.isInteger(r)||r<0||r>n.byteLength-e)throw Object.assign(RangeError(`"length" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});i=n.subarray(e,e+r)}let a=this._type===`udp6`?`::1`:`127.0.0.1`;if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(e=>{if(!e)throw Error(`Socket not bound`);let n=t.callback,r=t.address??a,s=this._remoteAddress!==void 0&&t.address===void 0;if(this._dataPort&&(s||o.Address4.isValid(r)||o.Address6.isValid(r))){this._portSend(i,s?void 0:r,s?void 0:t.port),n?.call(this,null,i.byteLength);return}e.send({port:t.port,address:r,message:i.byteOffset===0&&i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}).then(()=>n?.call(this,null,i.byteLength),e=>n?n.call(this,e,0):this.emit(`error`,e))})}setBroadcast(e){this._setUdpOption({type:0,value:e})}setMulticastInterface(e){}setMulticastLoopback(e){return this._setUdpOption({type:3,value:e}),this._setUdpOption({type:4,value:e}),this._lastMulticastLoopback=e,e}setMulticastTTL(e){return this._setUdpOption({type:2,value:e}),this._lastMulticastTtl=e,e}setRecvBufferSize(e){this._setUdpOption({type:10,value:e}),this._lastRecvBufferSize=e}setSendBufferSize(e){this._setUdpOption({type:9,value:e}),this._lastSendBufferSize=e}setTTL(e){return this._setUdpOption({type:1,value:e}),this._lastTtl=e,e}unref(){return this}addSourceSpecificMembership(e,t,n){}dropSourceSpecificMembership(e,t,n){}async[Symbol.asyncDispose](){await new Promise(e=>{this.close(e)})}},l=new Uint8Array([2]),u=e=>{if(typeof e==`string`)return r.l.encode(e);if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(Array.isArray(e)){let t=e.map(u),n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}return new Uint8Array(e)},d=e=>{let t=e.split(`.`).map(e=>parseInt(e,10));if(t.length!==4||t.some(e=>Number.isNaN(e)||e<0||e>255))throw Error(`Invalid IPv4 address: ${e}`);return new Uint8Array(t)},f=e=>{let t=[];for(let n=0;n<16;n+=2)t.push(e[n]<<8|e[n+1]);let n=-1,r=1;for(let e=0;e<8;){if(t[e]!==0){e++;continue}let i=e;for(;i<8&&t[i]===0;)i++;i-e>r&&(n=e,r=i-e),e=i}return n===-1?t.map(e=>e.toString(16)).join(`:`):`${t.slice(0,n).map(e=>e.toString(16)).join(`:`)}::${t.slice(n+r).map(e=>e.toString(16)).join(`:`)}`},p=e=>{let t=new o.Address6(e).getBitsBase16(0,128).match(/.{2}/g);if(!t||t.length!==16)throw Error(`Invalid IPv6 address: ${e}`);return new Uint8Array(t.map(e=>parseInt(e,16)))},m=(e,t)=>{let n=new c(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},h={Socket:c,createSocket:m};exports.Socket=c,exports.createSocket=m,exports.default=h,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api--LOXTOpv.cjs"),n=require("./busy-Dv8wzE5M.cjs"),r=require("./utils-BvgGdrgN.cjs");require("./wire.cjs");let i=require("buffer"),a=require("events"),o=require("ip-address");var s=e.t({Socket:()=>c,createSocket:()=>m,default:()=>h}),c=class extends a.EventEmitter{_type;_localAddress;_remoteAddress;_connectedLocally;_connectGeneration=0;_destroyed=!1;_busyRelease;_webVPNUdpSocketPromise;_dataPort;_socketId;_sendQueue=[];_sendQueueBytes=0;_sendFlushScheduled=!1;_peerTailCache=new Map;constructor(e){if(super(e),!e)throw Error(`Missing options`);this._type=e.type,e.connection&&this.__webvpn_udp_socket_init__(e.connection)}_lastRecvBufferSize=0;_lastSendBufferSize=0;_lastTtl=64;_lastMulticastTtl=1;_lastMulticastLoopback=!0;_setUdpOption(e){if(!this._webVPNUdpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before bind`));return}this._webVPNUdpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}_dataPortAcks=!1;_dataPortConsumedBytes=0;_dataPortAckedBytes=0;_ackDataPortBatch(e){if(!this._dataPortAcks||!this._dataPort||(this._dataPortConsumedBytes+=e,this._dataPortAckedBytes!==0&&this._dataPortConsumedBytes-this._dataPortAckedBytes<524288))return;this._dataPortAckedBytes=this._dataPortConsumedBytes;let t={type:r.n,consumedBytes:this._dataPortConsumedBytes};this._dataPort.postMessage(t)}_onTransportClosed(e){this._destroyed||(this._destroyed=!0,this._busyRelease?.(),this._dataPort?.close(),this._dataPort=void 0,this.listenerCount(`error`)>0&&this.emit(`error`,Error(e||`WebVPN session closed`)),this.emit(`close`))}_onDataPortBatch(e){let t=new DataView(e),n=!1,r,a=0;for(;a+4<=e.byteLength;){let o=t.getUint32(a);a+=4;let s=a+o;if(s>e.byteLength)break;let c=a+4,l=t.getUint8(c);c+=1;let u,d,p;if(l===2){if(!this._remoteAddress){a=s;continue}u=this._remoteAddress.address,d=this._remoteAddress.family,p=this._remoteAddress.port}else{let n=new Uint8Array(e,c,l===0?4:16);l===0?(d=`IPv4`,u=`${n[0]}.${n[1]}.${n[2]}.${n[3]}`):(d=`IPv6`,u=f(n)),c+=n.byteLength,p=t.getUint16(c),c+=2}let m=t.getUint32(c);c+=4;try{this.emit(`message`,i.Buffer.from(e.slice(c,c+m)),{address:u,family:d,port:p,size:m})}catch(e){n||(n=!0,r=e)}a=s}if(n)throw r}_peerTail(e,t){if(e===void 0||t===void 0)return l;let n=`${e}|${t}`,r=this._peerTailCache.get(n);if(r)return r;let i=o.Address4.isValid(e)?d(e):p(e),a=new Uint8Array(1+i.byteLength+2);return a[0]=i.byteLength===4?0:1,a.set(i,1),new DataView(a.buffer).setUint16(1+i.byteLength,t),this._peerTailCache.size>=4096&&this._peerTailCache.clear(),this._peerTailCache.set(n,a),a}_portSend(e,t,n){let r=this._peerTail(t,n),i=new Uint8Array(8+r.byteLength+4+e.byteLength),a=new DataView(i.buffer);a.setUint32(0,i.byteLength-4),a.setUint32(4,this._socketId),i.set(r,8),a.setUint32(8+r.byteLength,e.byteLength),i.set(e,12+r.byteLength),this._sendQueue.push(i),this._sendQueueBytes+=i.byteLength,!this._sendFlushScheduled&&(this._sendFlushScheduled=!0,queueMicrotask(()=>{this._sendFlushScheduled=!1;let e=this._sendQueue,t=this._sendQueueBytes;if(this._sendQueue=[],this._sendQueueBytes=0,!e.length||!this._dataPort)return;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;this._dataPort.postMessage(n.buffer,[n.buffer])}))}addMembership(e,t){if(o.Address4.isValid(e)){let n=d(e),r=t&&o.Address4.isValid(t)?d(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=p(e);this._setUdpOption({type:7,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}address(){if(!this._localAddress)throw Error(`EBADF`);return this._localAddress}bind(...e){let n=r.o(...e),i=this._type===`udp6`?`::`:`0.0.0.0`,a=this.__webvpn_udp_socket_init__(t.s(`a udp socket`).then(e=>e.cloud.webvpn.udpSocket({type:this._type,address:n.address??i,port:n.port,dataPort:!0})));return n.callback&&a.then(e=>{e&&n.callback.call(this)}),this}__webvpn_udp_socket_init__(e,t){return t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort}),this._busyRelease??=n.t(`udp socket`),this._webVPNUdpSocketPromise=e.then(e=>{if(e.dataPort)this._socketId=e.socketId,this._dataPort=e.dataPort,this._dataPortAcks=e.dataPortAcks===!0,this._dataPort.onmessage=e=>{try{this._onDataPortBatch(e.data)}finally{this._ackDataPortBatch(e.data.byteLength)}};else{let t=e.dataReadableStream.getReader();(async()=>{for(;;){let{value:e,done:n}=await t.read();if(n)return;this.emit(`message`,i.Buffer.from(e.data),{address:e.address,family:e.family,port:e.port,size:e.size})}})().catch(e=>this._onTransportClosed(e instanceof Error?e.message:void 0))}return e.closed?.then(e=>this._onTransportClosed(e?.reason)).catch(()=>{}),this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e}).catch(e=>{this.emit(`error`,e)}),this._webVPNUdpSocketPromise.then(e=>{if(!e){this._busyRelease?.();return}this.emit(`listening`)}),this._webVPNUdpSocketPromise}close(e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);return this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=this._destroyed;this._destroyed=!0,this._busyRelease?.(),this._dataPort?.close(),this._dataPort=void 0;try{await t.close()}finally{try{e&&e()}finally{n||this.emit(`close`)}}}).catch(()=>{}),this}connect(...e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=e[0],r=this._type===`udp6`?`::1`:`127.0.0.1`,i=typeof e[1]==`string`?e[1]:r,a=typeof e.at(-1)==`function`?e.at(-1):void 0,o=await t.connect({remotePort:n,remoteAddress:i});this._connectedLocally=o?.local===!0,this._remoteAddress=o?.address?{address:o.address,family:o.family,port:o.port}:{address:i,family:this._type===`udp6`?`IPv6`:`IPv4`,port:n},this._connectGeneration+=1,a&&a()}).catch(e=>{this.emit(`error`,e)})}disconnect(){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);let e=this._remoteAddress,t=this._connectedLocally,n=this._connectGeneration;this._remoteAddress=void 0,this._connectedLocally=void 0,this._webVPNUdpSocketPromise.then(e=>e?.disconnect?.()).catch(r=>{this._connectGeneration===n&&(this._remoteAddress=e,this._connectedLocally=t),this.emit(`error`,r)})}dropMembership(e,t){if(o.Address4.isValid(e)){let n=d(e),r=t&&o.Address4.isValid(t)?d(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=p(e);this._setUdpOption({type:8,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}getRecvBufferSize(){return this._lastRecvBufferSize}getSendBufferSize(){return this._lastSendBufferSize}getSendQueueSize(){return 0}getSendQueueCount(){return 0}ref(){return this}remoteAddress(){if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);return{address:this._remoteAddress.address,family:this._remoteAddress.family,port:this._remoteAddress.port}}send(...e){this._webVPNUdpSocketPromise||this.bind();let t=r.s(...e),n=u(t.message),i=n;if(t.hasRange){let{offset:e,length:r}=t;if(!Number.isInteger(e)||e<0||e>n.byteLength)throw Object.assign(RangeError(`"offset" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});if(!Number.isInteger(r)||r<0||r>n.byteLength-e)throw Object.assign(RangeError(`"length" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});i=n.subarray(e,e+r)}let a=this._type===`udp6`?`::1`:`127.0.0.1`;if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(e=>{if(!e)throw Error(`Socket not bound`);let n=t.callback,r=t.address??a,s=this._remoteAddress!==void 0&&t.address===void 0;if(this._dataPort&&(s||o.Address4.isValid(r)||o.Address6.isValid(r))){this._portSend(i,s?void 0:r,s?void 0:t.port),n?.call(this,null,i.byteLength);return}e.send({port:t.port,address:r,message:i.byteOffset===0&&i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}).then(()=>n?.call(this,null,i.byteLength),e=>n?n.call(this,e,0):this.emit(`error`,e))})}setBroadcast(e){this._setUdpOption({type:0,value:e})}setMulticastInterface(e){}setMulticastLoopback(e){return this._setUdpOption({type:3,value:e}),this._setUdpOption({type:4,value:e}),this._lastMulticastLoopback=e,e}setMulticastTTL(e){return this._setUdpOption({type:2,value:e}),this._lastMulticastTtl=e,e}setRecvBufferSize(e){this._setUdpOption({type:10,value:e}),this._lastRecvBufferSize=e}setSendBufferSize(e){this._setUdpOption({type:9,value:e}),this._lastSendBufferSize=e}setTTL(e){return this._setUdpOption({type:1,value:e}),this._lastTtl=e,e}unref(){return this}addSourceSpecificMembership(e,t,n){}dropSourceSpecificMembership(e,t,n){}async[Symbol.asyncDispose](){await new Promise(e=>{this.close(e)})}},l=new Uint8Array([2]),u=e=>{if(typeof e==`string`)return r.l.encode(e);if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(Array.isArray(e)){let t=e.map(u),n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}return new Uint8Array(e)},d=e=>{let t=e.split(`.`).map(e=>parseInt(e,10));if(t.length!==4||t.some(e=>Number.isNaN(e)||e<0||e>255))throw Error(`Invalid IPv4 address: ${e}`);return new Uint8Array(t)},f=e=>{let t=[];for(let n=0;n<16;n+=2)t.push(e[n]<<8|e[n+1]);let n=-1,r=1;for(let e=0;e<8;){if(t[e]!==0){e++;continue}let i=e;for(;i<8&&t[i]===0;)i++;i-e>r&&(n=e,r=i-e),e=i}return n===-1?t.map(e=>e.toString(16)).join(`:`):`${t.slice(0,n).map(e=>e.toString(16)).join(`:`)}::${t.slice(n+r).map(e=>e.toString(16)).join(`:`)}`},p=e=>{let t=new o.Address6(e).getBitsBase16(0,128).match(/.{2}/g);if(!t||t.length!==16)throw Error(`Invalid IPv6 address: ${e}`);return new Uint8Array(t.map(e=>parseInt(e,16)))},m=(e,t)=>{let n=new c(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},h={Socket:c,createSocket:m};exports.Socket=c,exports.createSocket=m,exports.default=h,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
package/dgram.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { v as UdpSocketOption } from "./wire-Gbo-D74t.js";
2
- import { Dt as UdpSocketResult, G as Resolvers } from "./contract-BRc2ptdC.js";
3
- import "./api-Cbty0JUM.js";
2
+ import { K as Resolvers, Ot as UdpSocketResult } from "./contract-CCxPKIC7.js";
3
+ import "./api-SwxtiYVU.js";
4
4
  import { Buffer } from "buffer";
5
5
  import { AddressInfo } from "net";
6
6
  import { EventEmitter } from "events";
package/dgram.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { o as t } from "./api-Dp-2AT3u.js";
2
+ import { s as t } from "./api-DIgTslNb.js";
3
3
  import { t as n } from "./busy-B189uX--.js";
4
4
  import { l as r, n as i, o as a, s as o } from "./utils-C-cAd4r4.js";
5
5
  import "./wire.js";
package/dns.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-jOTOA-5n.cjs");var n=e.t({lookup:()=>r}),r=(e,n)=>t.a.then(t=>t.cloud.dns.lookup(e,n));exports.lookup=r,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api--LOXTOpv.cjs");var n=e.t({lookup:()=>r}),r=(e,n)=>t.o.then(t=>t.cloud.dns.lookup(e,n));exports.lookup=r,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
package/dns.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { s as AddressLookupResult } from "./contract-BRc2ptdC.js";
1
+ import { s as AddressLookupResult } from "./contract-CCxPKIC7.js";
2
2
  declare namespace dns_d_exports {
3
3
  export { AddressLookupResult, lookup };
4
4
  }
package/dns.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { a as t } from "./api-Dp-2AT3u.js";
2
+ import { o as t } from "./api-DIgTslNb.js";
3
3
  //#region src/dns.ts
4
4
  var n = /* @__PURE__ */ e({ lookup: () => r }), r = (e, n) => t.then((t) => t.cloud.dns.lookup(e, n));
5
5
  //#endregion
@@ -0,0 +1,92 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { $ as t, A as n, B as r, C as i, E as a, F as o, G as s, H as c, I as l, J as ee, K as te, L as ne, M as re, N as u, O as d, P as f, Q as p, R as m, S as h, T as g, U as _, V as v, W as y, X as b, Y as x, Z as S, _ as C, a as w, at as T, b as E, ct as D, dt as O, et as k, ft as A, g as j, h as M, i as N, it as ie, lt as P, n as F, nt as I, pt as L, q as R, r as z, st as B, t as V, tt as H, ut as U, v as W, w as G, x as K, y as q, z as J } from "./lib-DppqX10G.js";
3
+ import { o as Y, p as ae } from "./api-DIgTslNb.js";
4
+ import { t as oe } from "./proxy-Dixbk1WL.js";
5
+ import { available as se, fetch as ce } from "./desktop.js";
6
+ //#region src/extension-prompt.ts
7
+ var X = async (e) => {
8
+ if (typeof window > "u") return !1;
9
+ if (t()) return !0;
10
+ let n = await Y, r = null, i = new Promise((e) => {
11
+ r = () => {
12
+ t() && e(!0);
13
+ }, p.addEventListener("statuschange", r);
14
+ }), a = n.installPrompt.show(e).then(() => !1), o = await Promise.race([i, a]);
15
+ return r && p.removeEventListener("statuschange", r), await n.installPrompt.hide().catch(() => {}), o;
16
+ }, Z = null;
17
+ H(() => (Z ||= X().then(() => void 0).finally(() => {
18
+ Z = null;
19
+ }), Z));
20
+ //#endregion
21
+ //#region src/auto.ts
22
+ var Q = () => typeof document < "u" && t(), le = async (e, t) => {
23
+ if (ae(e), t?.credentials === "include") {
24
+ if (typeof document > "u") throw Error("fetch with credentials needs the FKN extension, which only exists in window realms");
25
+ return c(e, t);
26
+ }
27
+ return Q() ? c(e, {
28
+ ...t,
29
+ credentials: "omit"
30
+ }) : se() ? ce(e, t) : oe(e, t);
31
+ }, $ = /* @__PURE__ */ e({
32
+ ATTACH_FRAME_EVENT_KEY: () => N,
33
+ CATEGORIES: () => i,
34
+ EXTENSION_ABI: () => 3,
35
+ ExtensionOperationUnsupportedError: () => ie,
36
+ ExtensionOutdatedError: () => T,
37
+ FORGEABLE_HEADERS: () => ee,
38
+ FrameWindowBlockedError: () => M,
39
+ FrameWindowRefusedError: () => j,
40
+ LOCATOR_DENIED: () => d,
41
+ LOCATOR_ERROR: () => u,
42
+ LOCATOR_INVALID: () => o,
43
+ LOCATOR_UNSUPPORTED: () => g,
44
+ PERMISSION_DENIED: () => V,
45
+ REQUIRED_EXTENSION_ABI: () => 0,
46
+ TimeoutError: () => G,
47
+ assertAttachableFrameUrl: () => E,
48
+ assertFetchableUrl: () => v,
49
+ assertForgeableHeaders: () => x,
50
+ assertLockdownApplicable: () => K,
51
+ assertOneCookieIdentity: () => b,
52
+ attachFrame: () => w,
53
+ attachFramePermission: () => C,
54
+ available: () => Q,
55
+ box: () => P,
56
+ cookies: () => J,
57
+ createFrame: () => W,
58
+ createVideoElementHandle: () => U,
59
+ events: () => p,
60
+ extension: () => p,
61
+ fetch: () => c,
62
+ fetchCredentialedPermission: () => _,
63
+ fetchLocalPermission: () => y,
64
+ fetchPermission: () => s,
65
+ gotoPermission: () => q,
66
+ handleRevivableModules: () => D,
67
+ hasForgedCookie: () => S,
68
+ isBlockedFetchUrl: () => te,
69
+ isBlockedFrameUrl: () => h,
70
+ isExtensionExposed: () => t,
71
+ isLocalNetworkUrl: () => R,
72
+ isLocatorDenied: () => f,
73
+ isLocatorInvalid: () => n,
74
+ isLocatorUnsupported: () => a,
75
+ isPermissionDenied: () => F,
76
+ isTerminalError: () => re,
77
+ isType: () => O,
78
+ modifyRequestHeadersPermission: () => l,
79
+ permissions: () => z,
80
+ promptInstall: () => X,
81
+ readCookiePermission: () => r,
82
+ readExtensionHandshake: () => k,
83
+ removeRequestHeaderRule: () => ne,
84
+ revive: () => A,
85
+ setMissingExtensionHandler: () => H,
86
+ setRequestHeaderRule: () => m,
87
+ supportsOperation: () => B,
88
+ type: () => L,
89
+ waitForExtensionExposure: () => I
90
+ });
91
+ //#endregion
92
+ export { X as i, le as n, Q as r, $ as t };
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-CfdmsLoI.cjs"),n=require("./api--LOXTOpv.cjs"),r=require("./proxy-CFK-KiwE.cjs"),i=require("./desktop.cjs");var a=async e=>{if(typeof window>`u`)return!1;if(t.$())return!0;let r=await n.o,i=null,a=new Promise(e=>{i=()=>{t.$()&&e(!0)},t.Q.addEventListener(`statuschange`,i)}),o=r.installPrompt.show(e).then(()=>!1),s=await Promise.race([a,o]);return i&&t.Q.removeEventListener(`statuschange`,i),await r.installPrompt.hide().catch(()=>{}),s},o=null;t.tt(()=>(o||=a().then(()=>void 0).finally(()=>{o=null}),o));var s=()=>typeof document<`u`&&t.$(),c=async(e,a)=>{if(n.p(e),a?.credentials===`include`){if(typeof document>`u`)throw Error(`fetch with credentials needs the FKN extension, which only exists in window realms`);return t.H(e,a)}return s()?t.H(e,{...a,credentials:`omit`}):i.available()?i.fetch(e,a):r.t(e,a)},l=e.t({ATTACH_FRAME_EVENT_KEY:()=>t.i,CATEGORIES:()=>t.C,EXTENSION_ABI:()=>3,ExtensionOperationUnsupportedError:()=>t.it,ExtensionOutdatedError:()=>t.at,FORGEABLE_HEADERS:()=>t.J,FrameWindowBlockedError:()=>t.h,FrameWindowRefusedError:()=>t.g,LOCATOR_DENIED:()=>t.O,LOCATOR_ERROR:()=>t.N,LOCATOR_INVALID:()=>t.F,LOCATOR_UNSUPPORTED:()=>t.T,PERMISSION_DENIED:()=>t.t,REQUIRED_EXTENSION_ABI:()=>0,TimeoutError:()=>t.w,assertAttachableFrameUrl:()=>t.b,assertFetchableUrl:()=>t.V,assertForgeableHeaders:()=>t.Y,assertLockdownApplicable:()=>t.x,assertOneCookieIdentity:()=>t.X,attachFrame:()=>t.a,attachFramePermission:()=>t._,available:()=>s,box:()=>t.lt,cookies:()=>t.z,createFrame:()=>t.v,createVideoElementHandle:()=>t.ut,events:()=>t.Q,extension:()=>t.Q,fetch:()=>t.H,fetchCredentialedPermission:()=>t.U,fetchLocalPermission:()=>t.W,fetchPermission:()=>t.G,gotoPermission:()=>t.y,handleRevivableModules:()=>t.ct,hasForgedCookie:()=>t.Z,isBlockedFetchUrl:()=>t.K,isBlockedFrameUrl:()=>t.S,isExtensionExposed:()=>t.$,isLocalNetworkUrl:()=>t.q,isLocatorDenied:()=>t.P,isLocatorInvalid:()=>t.A,isLocatorUnsupported:()=>t.E,isPermissionDenied:()=>t.n,isTerminalError:()=>t.M,isType:()=>t.dt,modifyRequestHeadersPermission:()=>t.I,permissions:()=>t.r,promptInstall:()=>a,readCookiePermission:()=>t.B,readExtensionHandshake:()=>t.et,removeRequestHeaderRule:()=>t.L,revive:()=>t.ft,setMissingExtensionHandler:()=>t.tt,setRequestHeaderRule:()=>t.R,supportsOperation:()=>t.st,type:()=>t.pt,waitForExtensionExposure:()=>t.nt});Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
@@ -1,10 +1,29 @@
1
- import { A as CATEGORIES, B as revive, C as gotoPermission, D as PermissionGrant, E as LegacyPermissionRequest, F as RemoteVideoElement, G as OperationRequest, H as Executor, I as VideoElementState, K as SelectorPart, L as box, M as PermissionCategory, N as handleRevivableModules, O as PermissionRequest, P as BoxedVideoElement, R as createVideoElementHandle, S as createFrame, T as CategoryRequest, U as Gate, V as type, W as GateTools, _ as FrameWindowRefusedError, a as AttachWindowOptions, b as WindowFrame, c as FrameBackendEvent, d as FrameEventMap, f as FrameMessageEvent, g as FrameWindowRefusal, h as FrameWindowOptions, i as AttachFrameOptions, j as CategoryMeta, k as permissions, l as FrameDocumentEvent, m as FrameWindowBlockedError, n as attachFrame, o as Frame, p as FramePostMessageOptions, s as FrameBackend, t as ATTACH_FRAME_EVENT_KEY, u as FrameEventListener, v as GotoOptions, w as CategoryGrant, x as attachFramePermission, y as Locator, z as isType } from "./index-D2CA-NX5.js";
1
+ import { $ as SelectorPart, A as gotoPermission, B as handleRevivableModules, C as FrameWindowRefusal, D as WindowFrame, E as Locator, F as PermissionRequest, G as createVideoElementHandle, H as RemoteVideoElement, I as permissions, J as type, K as isType, L as CATEGORIES, M as CategoryRequest, N as LegacyPermissionRequest, O as attachFramePermission, P as PermissionGrant, Q as OperationRequest, R as CategoryMeta, S as FrameWindowOptions, T as GotoOptions, U as VideoElementState, V as BoxedVideoElement, W as box, X as Gate, Y as Executor, Z as GateTools, _ as FrameEventMap, a as AttachCookies, b as FramePostMessageOptions, c as BlankPage, d as CookieMatchWire, f as Frame, g as FrameEventListener, h as FrameDocumentEvent, i as AddScriptTagOptions, j as CategoryGrant, k as createFrame, l as ClearCookiesOptions, m as FrameBackendEvent, n as attachFrame, o as AttachFrameOptions, p as FrameBackend, q as revive, s as AttachWindowOptions, t as ATTACH_FRAME_EVENT_KEY, u as ClearCookiesWire, v as FrameLocator, w as FrameWindowRefusedError, x as FrameWindowBlockedError, y as FrameMessageEvent, z as PermissionCategory } from "./index-BtFiGoVQ.js";
2
2
  //#region ../frame-locator/lib/errors.d.ts
3
3
  declare const LOCATOR_ERROR = "LocatorError";
4
4
  declare const LOCATOR_UNSUPPORTED = "LocatorUnsupportedError";
5
5
  declare const LOCATOR_DENIED = "LocatorDeniedError";
6
+ declare const LOCATOR_INVALID = "LocatorInvalidError";
7
+ /**
8
+ * A call that ran out of time: its deadline passed before it settled. One class for every call that
9
+ * has a deadline, as Playwright's `TimeoutError`, named `'TimeoutError'` so a check by name works as
10
+ * well as `instanceof`. It is minted where the call was made, never in the realm that ran it, so it
11
+ * is an instance of this class in the caller's realm.
12
+ *
13
+ * `message` is what the call reported at its deadline, unchanged from the error it replaces. `cause`
14
+ * is the last retryable error an attempt met before the deadline, so a locator call that never found
15
+ * its element says why; it is absent when no attempt failed (one never settled, or the call is not
16
+ * retried). Not terminal: nothing retries a call past its own deadline.
17
+ */
18
+ declare class TimeoutError extends Error {
19
+ readonly name = "TimeoutError";
20
+ constructor(message: string, options?: {
21
+ cause?: unknown;
22
+ });
23
+ }
6
24
  declare const isLocatorUnsupported: (error: unknown) => boolean;
7
25
  declare const isLocatorDenied: (error: unknown) => boolean;
26
+ declare const isLocatorInvalid: (error: unknown) => boolean;
8
27
  declare const isTerminalError: (error: unknown) => boolean;
9
28
  //#endregion
10
29
  //#region ../web-extension/lib/lib/forgeable-headers.d.ts
@@ -234,7 +253,7 @@ declare const fetch: (input: RequestInfo | URL, init?: RequestInit & {
234
253
  spread?: boolean;
235
254
  }) => Promise<Response>;
236
255
  declare namespace extension_d_exports {
237
- export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, AttachWindowOptions, BoxedVideoElement, CATEGORIES, CategoryGrant, CategoryMeta, CategoryRequest, CookieDetails, EXTENSION_ABI, Executor, ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, Gate, GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, OperationRequest, PERMISSION_DENIED, PermissionCategory, PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, SelectorPart, SiteCookie, VideoElementState, WindowFrame, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, isExtensionAvailable as available, box, cookies, createFrame, createVideoElementHandle, extension as events, extension, fetch$1 as fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, gotoPermission, handleRevivableModules, hasForgedCookie, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, supportsOperation, type, waitForExtensionExposure };
256
+ export { ATTACH_FRAME_EVENT_KEY, AddScriptTagOptions, AttachCookies, AttachFrameOptions, AttachWindowOptions, BlankPage, BoxedVideoElement, CATEGORIES, CategoryGrant, CategoryMeta, CategoryRequest, ClearCookiesOptions, ClearCookiesWire, CookieDetails, CookieMatchWire, EXTENSION_ABI, Executor, ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameLocator, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, Gate, GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_INVALID, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, OperationRequest, PERMISSION_DENIED, PermissionCategory, PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, SelectorPart, SiteCookie, TimeoutError, VideoElementState, WindowFrame, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, isExtensionAvailable as available, box, cookies, createFrame, createVideoElementHandle, extension as events, extension, fetch$1 as fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, gotoPermission, handleRevivableModules, hasForgedCookie, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorInvalid, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, supportsOperation, type, waitForExtensionExposure };
238
257
  }
239
258
  //#endregion
240
- export { readCookiePermission as A, FORGEABLE_HEADERS as B, RequestHeaderRule as C, CookieDetails as D, setRequestHeaderRule as E, fetchCredentialedPermission as F, LOCATOR_ERROR as G, assertOneCookieIdentity as H, fetchLocalPermission as I, isLocatorUnsupported as J, LOCATOR_UNSUPPORTED as K, fetchPermission as L, ProxyFetchRequest as M, assertFetchableUrl as N, SiteCookie as O, fetch$1 as P, isBlockedFetchUrl as R, HeaderOperation as S, removeRequestHeaderRule as T, hasForgedCookie as U, assertForgeableHeaders as V, LOCATOR_DENIED as W, isTerminalError as Y, PermissionDeniedError as _, extension as a, assertLockdownApplicable as b, setMissingExtensionHandler as c, ExtensionHandshake as d, ExtensionOperationUnsupportedError as f, PERMISSION_DENIED as g, supportsOperation as h, promptInstall as i, FetchInit as j, cookies as k, waitForExtensionExposure as l, REQUIRED_EXTENSION_ABI as m, fetch as n, isExtensionExposed as o, ExtensionOutdatedError as p, isLocatorDenied as q, isExtensionAvailable as r, readExtensionHandshake as s, extension_d_exports as t, EXTENSION_ABI as u, isPermissionDenied as v, modifyRequestHeadersPermission as w, isBlockedFrameUrl as x, assertAttachableFrameUrl as y, isLocalNetworkUrl as z };
259
+ export { readCookiePermission as A, FORGEABLE_HEADERS as B, RequestHeaderRule as C, CookieDetails as D, setRequestHeaderRule as E, fetchCredentialedPermission as F, LOCATOR_ERROR as G, assertOneCookieIdentity as H, fetchLocalPermission as I, TimeoutError as J, LOCATOR_INVALID as K, fetchPermission as L, ProxyFetchRequest as M, assertFetchableUrl as N, SiteCookie as O, fetch$1 as P, isTerminalError as Q, isBlockedFetchUrl as R, HeaderOperation as S, removeRequestHeaderRule as T, hasForgedCookie as U, assertForgeableHeaders as V, LOCATOR_DENIED as W, isLocatorInvalid as X, isLocatorDenied as Y, isLocatorUnsupported as Z, PermissionDeniedError as _, extension as a, assertLockdownApplicable as b, setMissingExtensionHandler as c, ExtensionHandshake as d, ExtensionOperationUnsupportedError as f, PERMISSION_DENIED as g, supportsOperation as h, promptInstall as i, FetchInit as j, cookies as k, waitForExtensionExposure as l, REQUIRED_EXTENSION_ABI as m, fetch as n, isExtensionExposed as o, ExtensionOutdatedError as p, LOCATOR_UNSUPPORTED as q, isExtensionAvailable as r, readExtensionHandshake as s, extension_d_exports as t, EXTENSION_ABI as u, isPermissionDenied as v, modifyRequestHeadersPermission as w, isBlockedFrameUrl as x, assertAttachableFrameUrl as y, isLocalNetworkUrl as z };
package/extension.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./lib-BfAg9mHD.cjs"),t=require("./extension-D2zMdc2f.cjs");exports.ATTACH_FRAME_EVENT_KEY=e.i,exports.CATEGORIES=e.b,exports.EXTENSION_ABI=e.Q,exports.ExtensionOperationUnsupportedError=e.$,exports.ExtensionOutdatedError=e.et,exports.FORGEABLE_HEADERS=e.U,exports.FrameWindowBlockedError=e.f,exports.FrameWindowRefusedError=e.p,exports.LOCATOR_DENIED=e.T,exports.LOCATOR_ERROR=e.k,exports.LOCATOR_UNSUPPORTED=e.x,exports.PERMISSION_DENIED=e.t,exports.REQUIRED_EXTENSION_ABI=e.tt,exports.assertAttachableFrameUrl=e._,exports.assertFetchableUrl=e.I,exports.assertForgeableHeaders=e.W,exports.assertLockdownApplicable=e.v,exports.assertOneCookieIdentity=e.G,exports.attachFrame=e.a,exports.attachFramePermission=e.m,exports.available=t.r,exports.box=e.it,exports.cookies=e.P,exports.createFrame=e.h,exports.createVideoElementHandle=e.at,exports.events=e.q,exports.extension=e.q,exports.fetch=e.L,exports.fetchCredentialedPermission=e.R,exports.fetchLocalPermission=e.z,exports.fetchPermission=e.B,exports.gotoPermission=e.g,exports.handleRevivableModules=e.rt,exports.hasForgedCookie=e.K,exports.isBlockedFetchUrl=e.V,exports.isBlockedFrameUrl=e.y,exports.isExtensionExposed=e.J,exports.isLocalNetworkUrl=e.H,exports.isLocatorDenied=e.A,exports.isLocatorUnsupported=e.S,exports.isPermissionDenied=e.n,exports.isTerminalError=e.O,exports.isType=e.ot,exports.modifyRequestHeadersPermission=e.j,exports.permissions=e.r,exports.promptInstall=t.i,exports.readCookiePermission=e.F,exports.readExtensionHandshake=e.Y,exports.removeRequestHeaderRule=e.M,exports.revive=e.st,exports.setMissingExtensionHandler=e.X,exports.setRequestHeaderRule=e.N,exports.supportsOperation=e.nt,exports.type=e.ct,exports.waitForExtensionExposure=e.Z;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./lib-CfdmsLoI.cjs"),t=require("./extension-hoUs5yJ7.cjs");exports.ATTACH_FRAME_EVENT_KEY=e.i,exports.CATEGORIES=e.C,exports.EXTENSION_ABI=e.rt,exports.ExtensionOperationUnsupportedError=e.it,exports.ExtensionOutdatedError=e.at,exports.FORGEABLE_HEADERS=e.J,exports.FrameWindowBlockedError=e.h,exports.FrameWindowRefusedError=e.g,exports.LOCATOR_DENIED=e.O,exports.LOCATOR_ERROR=e.N,exports.LOCATOR_INVALID=e.F,exports.LOCATOR_UNSUPPORTED=e.T,exports.PERMISSION_DENIED=e.t,exports.REQUIRED_EXTENSION_ABI=e.ot,exports.TimeoutError=e.w,exports.assertAttachableFrameUrl=e.b,exports.assertFetchableUrl=e.V,exports.assertForgeableHeaders=e.Y,exports.assertLockdownApplicable=e.x,exports.assertOneCookieIdentity=e.X,exports.attachFrame=e.a,exports.attachFramePermission=e._,exports.available=t.r,exports.box=e.lt,exports.cookies=e.z,exports.createFrame=e.v,exports.createVideoElementHandle=e.ut,exports.events=e.Q,exports.extension=e.Q,exports.fetch=e.H,exports.fetchCredentialedPermission=e.U,exports.fetchLocalPermission=e.W,exports.fetchPermission=e.G,exports.gotoPermission=e.y,exports.handleRevivableModules=e.ct,exports.hasForgedCookie=e.Z,exports.isBlockedFetchUrl=e.K,exports.isBlockedFrameUrl=e.S,exports.isExtensionExposed=e.$,exports.isLocalNetworkUrl=e.q,exports.isLocatorDenied=e.P,exports.isLocatorInvalid=e.A,exports.isLocatorUnsupported=e.E,exports.isPermissionDenied=e.n,exports.isTerminalError=e.M,exports.isType=e.dt,exports.modifyRequestHeadersPermission=e.I,exports.permissions=e.r,exports.promptInstall=t.i,exports.readCookiePermission=e.B,exports.readExtensionHandshake=e.et,exports.removeRequestHeaderRule=e.L,exports.revive=e.ft,exports.setMissingExtensionHandler=e.tt,exports.setRequestHeaderRule=e.R,exports.supportsOperation=e.st,exports.type=e.pt,exports.waitForExtensionExposure=e.nt;
package/extension.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { A as CATEGORIES, B as revive, C as gotoPermission, D as PermissionGrant, E as LegacyPermissionRequest, F as RemoteVideoElement, G as OperationRequest, H as Executor, I as VideoElementState, K as SelectorPart, L as box, M as PermissionCategory, N as handleRevivableModules, O as PermissionRequest, P as BoxedVideoElement, R as createVideoElementHandle, S as createFrame, T as CategoryRequest, U as Gate, V as type, W as GateTools, _ as FrameWindowRefusedError, a as AttachWindowOptions, b as WindowFrame, c as FrameBackendEvent, d as FrameEventMap, f as FrameMessageEvent, g as FrameWindowRefusal, h as FrameWindowOptions, i as AttachFrameOptions, j as CategoryMeta, k as permissions, l as FrameDocumentEvent, m as FrameWindowBlockedError, n as attachFrame, o as Frame, p as FramePostMessageOptions, s as FrameBackend, t as ATTACH_FRAME_EVENT_KEY, u as FrameEventListener, v as GotoOptions, w as CategoryGrant, x as attachFramePermission, y as Locator, z as isType } from "./index-D2CA-NX5.js";
2
- import { A as readCookiePermission, B as FORGEABLE_HEADERS, C as RequestHeaderRule, D as CookieDetails, E as setRequestHeaderRule, F as fetchCredentialedPermission, G as LOCATOR_ERROR, H as assertOneCookieIdentity, I as fetchLocalPermission, J as isLocatorUnsupported, K as LOCATOR_UNSUPPORTED, L as fetchPermission, M as ProxyFetchRequest, N as assertFetchableUrl, O as SiteCookie, P as fetch, R as isBlockedFetchUrl, S as HeaderOperation, T as removeRequestHeaderRule, U as hasForgedCookie, V as assertForgeableHeaders, W as LOCATOR_DENIED, Y as isTerminalError, _ as PermissionDeniedError, a as extension, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PERMISSION_DENIED, h as supportsOperation, i as promptInstall, j as FetchInit, k as cookies, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, o as isExtensionExposed, p as ExtensionOutdatedError, q as isLocatorDenied, r as isExtensionAvailable, s as readExtensionHandshake, u as EXTENSION_ABI, v as isPermissionDenied, w as modifyRequestHeadersPermission, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as isLocalNetworkUrl } from "./extension-DMU-CwMw.js";
3
- export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, AttachWindowOptions, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, WindowFrame, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, isExtensionAvailable as available, box, cookies, createFrame, createVideoElementHandle, extension as events, extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, gotoPermission, handleRevivableModules, hasForgedCookie, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, supportsOperation, type, waitForExtensionExposure };
1
+ import { $ as SelectorPart, A as gotoPermission, B as handleRevivableModules, C as FrameWindowRefusal, D as WindowFrame, E as Locator, F as PermissionRequest, G as createVideoElementHandle, H as RemoteVideoElement, I as permissions, J as type, K as isType, L as CATEGORIES, M as CategoryRequest, N as LegacyPermissionRequest, O as attachFramePermission, P as PermissionGrant, Q as OperationRequest, R as CategoryMeta, S as FrameWindowOptions, T as GotoOptions, U as VideoElementState, V as BoxedVideoElement, W as box, X as Gate, Y as Executor, Z as GateTools, _ as FrameEventMap, a as AttachCookies, b as FramePostMessageOptions, c as BlankPage, d as CookieMatchWire, f as Frame, g as FrameEventListener, h as FrameDocumentEvent, i as AddScriptTagOptions, j as CategoryGrant, k as createFrame, l as ClearCookiesOptions, m as FrameBackendEvent, n as attachFrame, o as AttachFrameOptions, p as FrameBackend, q as revive, s as AttachWindowOptions, t as ATTACH_FRAME_EVENT_KEY, u as ClearCookiesWire, v as FrameLocator, w as FrameWindowRefusedError, x as FrameWindowBlockedError, y as FrameMessageEvent, z as PermissionCategory } from "./index-BtFiGoVQ.js";
2
+ import { A as readCookiePermission, B as FORGEABLE_HEADERS, C as RequestHeaderRule, D as CookieDetails, E as setRequestHeaderRule, F as fetchCredentialedPermission, G as LOCATOR_ERROR, H as assertOneCookieIdentity, I as fetchLocalPermission, J as TimeoutError, K as LOCATOR_INVALID, L as fetchPermission, M as ProxyFetchRequest, N as assertFetchableUrl, O as SiteCookie, P as fetch, Q as isTerminalError, R as isBlockedFetchUrl, S as HeaderOperation, T as removeRequestHeaderRule, U as hasForgedCookie, V as assertForgeableHeaders, W as LOCATOR_DENIED, X as isLocatorInvalid, Y as isLocatorDenied, Z as isLocatorUnsupported, _ as PermissionDeniedError, a as extension, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PERMISSION_DENIED, h as supportsOperation, i as promptInstall, j as FetchInit, k as cookies, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, o as isExtensionExposed, p as ExtensionOutdatedError, q as LOCATOR_UNSUPPORTED, r as isExtensionAvailable, s as readExtensionHandshake, u as EXTENSION_ABI, v as isPermissionDenied, w as modifyRequestHeadersPermission, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as isLocalNetworkUrl } from "./extension-yhwDSIiD.js";
3
+ export { ATTACH_FRAME_EVENT_KEY, AddScriptTagOptions, AttachCookies, AttachFrameOptions, AttachWindowOptions, BlankPage, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, ClearCookiesOptions, ClearCookiesWire, CookieDetails, CookieMatchWire, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameLocator, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_INVALID, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, TimeoutError, VideoElementState, WindowFrame, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, isExtensionAvailable as available, box, cookies, createFrame, createVideoElementHandle, extension as events, extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, gotoPermission, handleRevivableModules, hasForgedCookie, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorInvalid, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, supportsOperation, type, waitForExtensionExposure };
package/extension.js CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as e, A as t, B as n, F as r, G as i, H as a, I as o, J as s, K as c, L as l, M as u, N as d, O as f, P as p, Q as m, R as h, S as g, T as _, U as v, V as y, W as b, X as x, Y as S, Z as C, _ as w, a as T, at as E, b as D, ct as O, et as k, f as A, g as j, h as M, i as N, it as P, j as F, k as I, m as L, n as R, nt as z, ot as B, p as V, q as H, r as U, rt as W, st as G, t as K, tt as q, v as J, x as Y, y as X, z as Z } from "./lib-C4Eeg9eM.js";
2
- import { i as Q, r as $ } from "./extension-B9v933cT.js";
3
- export { N as ATTACH_FRAME_EVENT_KEY, D as CATEGORIES, m as EXTENSION_ABI, e as ExtensionOperationUnsupportedError, k as ExtensionOutdatedError, v as FORGEABLE_HEADERS, A as FrameWindowBlockedError, V as FrameWindowRefusedError, _ as LOCATOR_DENIED, I as LOCATOR_ERROR, Y as LOCATOR_UNSUPPORTED, K as PERMISSION_DENIED, q as REQUIRED_EXTENSION_ABI, w as assertAttachableFrameUrl, o as assertFetchableUrl, b as assertForgeableHeaders, J as assertLockdownApplicable, i as assertOneCookieIdentity, T as attachFrame, L as attachFramePermission, $ as available, P as box, p as cookies, M as createFrame, E as createVideoElementHandle, H as events, H as extension, l as fetch, h as fetchCredentialedPermission, Z as fetchLocalPermission, n as fetchPermission, j as gotoPermission, W as handleRevivableModules, c as hasForgedCookie, y as isBlockedFetchUrl, X as isBlockedFrameUrl, s as isExtensionExposed, a as isLocalNetworkUrl, t as isLocatorDenied, g as isLocatorUnsupported, R as isPermissionDenied, f as isTerminalError, B as isType, F as modifyRequestHeadersPermission, U as permissions, Q as promptInstall, r as readCookiePermission, S as readExtensionHandshake, u as removeRequestHeaderRule, G as revive, x as setMissingExtensionHandler, d as setRequestHeaderRule, z as supportsOperation, O as type, C as waitForExtensionExposure };
1
+ import { $ as e, A as t, B as n, C as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, O as m, P as h, Q as g, R as _, S as v, T as y, U as b, V as x, W as S, X as C, Y as w, Z as T, _ as ee, a as E, at as D, b as O, ct as k, dt as A, et as j, ft as M, g as N, h as P, i as F, it as I, lt as L, n as R, nt as z, ot as B, pt as V, q as H, r as U, rt as W, st as G, t as K, tt as q, ut as J, v as Y, w as X, x as Z, y as Q, z as $ } from "./lib-DppqX10G.js";
2
+ import { i as te, r as ne } from "./extension-BOBuYwZc.js";
3
+ export { F as ATTACH_FRAME_EVENT_KEY, r as CATEGORIES, W as EXTENSION_ABI, I as ExtensionOperationUnsupportedError, D as ExtensionOutdatedError, l as FORGEABLE_HEADERS, P as FrameWindowBlockedError, N as FrameWindowRefusedError, m as LOCATOR_DENIED, p as LOCATOR_ERROR, a as LOCATOR_INVALID, y as LOCATOR_UNSUPPORTED, K as PERMISSION_DENIED, B as REQUIRED_EXTENSION_ABI, X as TimeoutError, O as assertAttachableFrameUrl, x as assertFetchableUrl, w as assertForgeableHeaders, Z as assertLockdownApplicable, C as assertOneCookieIdentity, E as attachFrame, ee as attachFramePermission, ne as available, L as box, $ as cookies, Y as createFrame, J as createVideoElementHandle, g as events, g as extension, s as fetch, b as fetchCredentialedPermission, S as fetchLocalPermission, o as fetchPermission, Q as gotoPermission, k as handleRevivableModules, T as hasForgedCookie, u as isBlockedFetchUrl, v as isBlockedFrameUrl, e as isExtensionExposed, H as isLocalNetworkUrl, h as isLocatorDenied, t as isLocatorInvalid, i as isLocatorUnsupported, R as isPermissionDenied, f as isTerminalError, A as isType, c as modifyRequestHeadersPermission, U as permissions, te as promptInstall, n as readCookiePermission, j as readExtensionHandshake, d as removeRequestHeaderRule, M as revive, q as setMissingExtensionHandler, _ as setRequestHeaderRule, G as supportsOperation, V as type, z as waitForExtensionExposure };
package/fs/promises.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../fs-BTyRnUPI.cjs");var{readFile:t,writeFile:n,appendFile:r,unlink:i,rename:a,readdir:o,mkdir:s,rm:c,rmdir:l,stat:u,lstat:d,access:f}=e.v,p=e.v;exports.access=f,exports.appendFile=r,exports.default=p,exports.lstat=d,exports.mkdir=s,exports.readFile=t,exports.readdir=o,exports.rename=a,exports.rm=c,exports.rmdir=l,exports.stat=u,exports.unlink=i,exports.writeFile=n;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../fs-p0bOOj5n.cjs");var{readFile:t,writeFile:n,appendFile:r,unlink:i,rename:a,readdir:o,mkdir:s,rm:c,rmdir:l,stat:u,lstat:d,access:f}=e.v,p=e.v;exports.access=f,exports.appendFile=r,exports.default=p,exports.lstat=d,exports.mkdir=s,exports.readFile=t,exports.readdir=o,exports.rename=a,exports.rm=c,exports.rmdir=l,exports.stat=u,exports.unlink=i,exports.writeFile=n;
package/fs/promises.js CHANGED
@@ -1,4 +1,4 @@
1
- import { v as e } from "../fs-q7Kg51hq.js";
1
+ import { v as e } from "../fs-CVnmXRf7.js";
2
2
  //#region src/fs/promises.ts
3
3
  var { readFile: t, writeFile: n, appendFile: r, unlink: i, rename: a, readdir: o, mkdir: s, rm: c, rmdir: l, stat: u, lstat: d, access: f } = e, p = e;
4
4
  //#endregion
@@ -2,7 +2,7 @@ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
2
  import { r as t } from "./busy-B189uX--.js";
3
3
  import { t as n } from "./node-fs-CK2wWIYS.js";
4
4
  import { STORAGE_ACCOUNT_CHANGED as r, STORAGE_ACCOUNT_PIN_UNSUPPORTED as i } from "./messages.js";
5
- import { _ as a, a as o, b as s, c, d as l, f as u, g as ee, h as d, l as te, n as ne, o as f, p as re, t as ie } from "./storage-BWmGrO6a.js";
5
+ import { _ as a, a as o, b as s, c, d as l, f as u, g as ee, h as d, l as te, n as ne, o as f, p as re, t as ie } from "./storage-Dn1gTLSZ.js";
6
6
  import { a as ae, i as p, n as m, o as h, t as oe } from "./opfs-D0goLAQW.js";
7
7
  //#region src/fs/hybrid.ts
8
8
  var se = /* @__PURE__ */ e({
@@ -1 +1 @@
1
- const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./busy-Dv8wzE5M.cjs"),n=require("./node-fs-nfX7wisL.cjs"),r=require("./messages.cjs"),i=require("./storage-BS5WMO4f.cjs"),a=require("./opfs-CXMESVLc.cjs");var o=e.t({adopt:()=>R,adoptable:()=>B,available:()=>f,captureAccount:()=>s,list:()=>ve,onConflict:()=>Se,pending:()=>ue,pendingDeletes:()=>de,pull:()=>P,readFile:()=>ye,readFileSealed:()=>N,remove:()=>xe,replicating:()=>fe,writeFile:()=>be}),s=i.o,c,l=async()=>await(c??=a.t().catch(()=>!1))?!0:(c=void 0,!1),u=()=>i.a().catch(()=>`unknown`),d=async()=>await u()===`connected`,f=async()=>await l()||await d(),ee=`fkn:fs:pending`,te=`fkn:fs:pending-delete`,p=`fkn:fs:adopt-declined`,m=!0,ne=new Map,re=null,ie=(e,t)=>{if(e===null)return!1;if(`generation`in e&&`generation`in t)return e.generation===t.generation;let n=e=>`pin`in e?e.pin:i.d(e),r=n(e);return r!==void 0&&r===n(t)},h=(e,t)=>ie(re,t)?ne.get(e)??null:null,g=e=>e===`write`?ee:te,_=e=>{try{let t=localStorage.getItem(g(e));if(!t)return{};let n=JSON.parse(t);if(Array.isArray(n))return Object.fromEntries(n.filter(e=>typeof e==`string`).map(e=>[e,{base:null,pin:null}]));if(!n||typeof n!=`object`)return{};let r={};for(let[e,t]of Object.entries(n))if(t===null||typeof t==`string`)r[e]={base:t,pin:null};else if(typeof t==`object`){let{base:n,pin:i}=t;r[e]={base:typeof n==`string`?n:null,pin:typeof i==`string`&&i?i:null}}return r}catch{return{}}},v=(e,t)=>{try{Object.keys(t).length?localStorage.setItem(g(e),JSON.stringify(t)):localStorage.removeItem(g(e))}catch{}},ae=()=>{try{let e=JSON.parse(localStorage.getItem(p)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}},y=new Map,oe=e=>`pin`in e?e.pin:i.d(e)??null,se=(e,t,n,r)=>{let i=_(e),a=i[t],o=oe(r);a&&o!==null&&a.pin===o||(i[t]={base:a?a.base:n,pin:o},v(e,i),o===null&&`generation`in r?y.set(`${e}:${t}`,r):y.delete(`${e}:${t}`))},ce=(e,t)=>{y.delete(`${e}:${t}`);let n=_(e);t in n&&(delete n[t],v(e,n),E()||(O=D))},b=(e,t,n)=>se(`write`,e,t,n),x=e=>ce(`write`,e),le=(e,t)=>se(`delete`,e,h(e,t),t),S=e=>ce(`delete`,e),ue=()=>Object.keys(_(`write`)),de=()=>Object.keys(_(`delete`)),fe=()=>m,C=new Map,pe=e=>C.get(e)===i.o().generation,me=(e,t,n)=>n.pin===null&&!y.has(`${e}:${t}`),w=null,T=!1;t.r(`storage replication`,()=>w!==null||V!==null);var E=()=>[`write`,`delete`].some(e=>Object.entries(_(e)).some(([t,n])=>n.pin===null?!me(e,t,n):!pe(n.pin))),D=6e4,he=6e5,O=D,k=null,A=()=>{!k&&typeof window<`u`&&E()&&(k=setTimeout(()=>{k=null,j()},O),O=Math.min(O*2,he))},j=()=>{if(w){T=!0;return}E()&&(w=Oe(!1,i.o()).then(e=>{if(!E()){O=D;return}e.failed.length&&A()}).catch(()=>{A()}).finally(()=>{w=null,ge()}))},ge=()=>{T&&(T=!1,j())},_e=null,M=()=>_e??=Promise.resolve().then(()=>require("./api.cjs")).then(e=>e.apiPromise),ve=async e=>{let t=e?.pin??i.o();W();let n=await u(),r=n===`connected`,[o,s]=await Promise.all([l().then(e=>e?a.n():[]).catch(()=>[]),r?i.f({pin:t}).then(e=>({ok:!0,entries:e}),e=>({ok:!1,entries:[],changed:i.c(e)?e:void 0})):Promise.resolve({ok:n===`disconnected`,entries:[]})]);if(n!==`unknown`&&(m=s.ok),s.ok&&n!==`unknown`&&(ne=new Map(s.entries.map(e=>[e.path,e.updatedAt])),re=t),s.changed)throw s.changed;let c=new Map,d=e=>{let t=Date.parse(e.updatedAt??``);return Number.isFinite(t)?t:0},f=e=>{let t=c.get(e.path);(!t||d(e)>=d(t))&&c.set(e.path,e)};for(let e of o)f(e);for(let e of s.entries)f(e);return s.ok&&r&&(Fe(o,s.entries).catch(()=>{}),E()?j():U({local:o,remote:s.entries,from:t}).catch(()=>{})),[...c.values()]},ye=async(e,t)=>{let n=t?.pin??i.o();if(await l())try{return await a.i(e)}catch(e){if(e?.name!==`NotFoundError`)throw e}let r=await i.h(e,{pin:n});return await l()&&a.o(e,r).catch(()=>{}),r},N=async(e,t)=>{let n=t?.pin??i.o();if(await l())try{let t=await a.i(e);return{data:new Uint8Array(await t.arrayBuffer()),sealedAt:null}}catch(e){if(e?.name!==`NotFoundError`)throw e}return i.g(e,{pin:n})},be=async(e,t,n)=>{let r=n?.pin??i.o(),o=n?.contentType,s=o?{contentType:o}:void 0,c=t instanceof Blob?t:new Blob([t],s?{type:s.contentType}:void 0);if(await l()){await a.o(e,c,s),W();let t=h(e,r),n=await u();if(n===`disconnected`)return;if(n===`unknown`||!m){b(e,t,r),A();return}i.b(e,c,{...s,pin:r}).then(()=>x(e)).catch(n=>{b(e,t,r),i.c(n)||A(),console.warn(`fs: cloud replicate failed, queued for adopt()`,n)});return}let d=await u();if(d===`connected`)return i.b(e,c,{...s,pin:r});throw Error(d===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`)},xe=async(e,t)=>{let n=t?.pin??i.o();W();let r=[];await l()&&r.push(a.a(e).catch(()=>{}));let o=await u();if(o===`connected`?r.push(i._(e,{pin:n}).then(()=>S(e)).catch(t=>{le(e,n),i.c(t)||A(),console.warn(`fs: cloud delete failed, queued for retry`,t)})):o===`unknown`&&r.length&&h(e,n)!==null&&(le(e,n),A()),!r.length)throw Error(o===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`);x(e),await Promise.all(r)},P=async e=>{let t=i.o(),n=await i.h(e,{pin:t});return await l()&&await a.o(e,n),n},F=null,Se=e=>(F=e,()=>{F===e&&(F=null)}),Ce=async e=>{let t=await(await M()).cloud.fs.promptConflict({path:e.path,local:e.local,cloud:e.cloud}).catch(()=>null);return t===`local`?e.readLocal():t===`cloud`?e.readCloud():null},we=async e=>{if(F)try{return await F(e)}catch{return null}return Ce(e)},I=class extends Error{},L=e=>e instanceof Error?e.message:String(e),Te=()=>{let e=new Map,t=t=>{let n=e.get(t);return n||e.set(t,n={writes:new Map,deletes:new Map}),n};for(let[e,n]of Object.entries(_(`write`)))t(n.pin).writes.set(e,n.base);for(let[e,n]of Object.entries(_(`delete`)))t(n.pin).deletes.set(e,n.base);return e},Ee=async()=>{for(let[e,t]of[...y]){let n=e.startsWith(`write:`)?`write`:`delete`,r=e.slice(n.length+1),a;try{a=await i.p(t)}catch(t){i.c(t)&&y.delete(e);continue}if(y.get(e)!==t)continue;y.delete(e);let o=_(n),s=o[r];s&&s.pin===null&&(o[r]={base:s.base,pin:a},v(n,o))}},De=async(e,t,n,r,o,s)=>{let c=new Map(t.map(e=>[e.path,e])),l=e=>{if(i.c(e))throw new I};for(let[t,a]of e.deletes){let e=c.get(t);if(!e){S(t);continue}if(r.some(e=>e.path===t)){S(t);continue}if(e.updatedAt!==a){S(t);continue}try{await i._(t,n),S(t),o.deleted.push(t)}catch(e){l(e),o.failed.push({path:t,error:L(e)})}}for(let t of r){let r=c.get(t.path),u=e.writes.has(t.path);if(!u){if(!s(t))continue;if(r){o.kept.push(t.path);continue}}let d=e.writes.get(t.path)??null;if(u&&r&&r.updatedAt!==d){let e=null,s=null,c=await we({path:t.path,local:{size:t.size,updatedAt:t.updatedAt},cloud:{size:r.size,updatedAt:r.updatedAt},readLocal:()=>e??=a.i(t.path),readCloud:()=>s??=i.h(t.path,n)});if(c==null){o.unresolved.push(t.path);continue}try{let r=e!==null&&c===await e,l=s!==null&&c===await s;l||await i.b(t.path,c,t.contentType?{contentType:t.contentType,...n}:n),r||await a.o(t.path,c),x(t.path),o.resolved.push({path:t.path,choice:r?`local`:l?`cloud`:`merged`})}catch(e){if(l(e),e?.code===`FKN_E2E_LOCKED`)throw e;o.failed.push({path:t.path,error:L(e)})}continue}try{let e=await a.i(t.path);await i.b(t.path,e,t.contentType?{contentType:t.contentType,...n}:n),x(t.path),o.uploaded.push(t.path)}catch(e){if(u||b(t.path,r?.updatedAt??null,n.pin),l(e),e?.code===`FKN_E2E_LOCKED`)throw e;o.failed.push({path:t.path,error:L(e)})}}},Oe=async(e,t)=>{let n={uploaded:[],kept:[],resolved:[],unresolved:[],deleted:[],failed:[]},r=await u();if(r===`unknown`)throw Error(`fs: cloud unreachable`);if(r!==`connected`)throw Error(`fs: this needs a signed-in account`);let o=await l(),s=o?await a.n():[];if(o)for(let e of Object.keys(_(`write`)))s.some(t=>t.path===e)||x(e);await Ee();for(let[e,r]of Te()){if(e===null||pe(e))continue;let a={pin:{pin:e}},o;try{o=await i.f(a)}catch(n){if(i.c(n)){C.set(e,t.generation);continue}if(i.l(n)){ke(e);continue}throw n}try{await De(r,o,a,s,n,()=>!1)}catch(n){if(!(n instanceof I))throw n;C.set(e,t.generation)}}if(e){let e={pin:t},r=await i.f(e),a=_(`write`),o=Te().get(null)??{writes:new Map,deletes:new Map},c=new Set([...n.uploaded,...n.resolved.map(({path:e})=>e),...n.unresolved,...n.failed.map(({path:e})=>e)]),l=e=>!(e.path in a)&&!c.has(e.path);try{await De(o,r,e,s,n,l)}catch(e){throw e instanceof I?new i.t:e}}return n},ke=e=>{for(let t of[`write`,`delete`]){let n=_(t),r=!1;for(let t of Object.values(n))t.pin===e&&(t.pin=null,r=!0);r&&v(t,n)}},Ae=async e=>{for(;w;)await w;let t=Oe(!0,e);w=t.then(()=>{},()=>{});try{return await t}finally{w=null,ge()}},R=()=>Ae(i.o()),z=(e,t)=>{let n=new Set(t.map(e=>e.path)),r=_(`write`);return e.filter(e=>{let t=r[e.path];return t?me(`write`,e.path,t):!n.has(e.path)})},B=async()=>{let e=i.o();if(!await d()||!await l())return{paths:[],bytes:0};let[t,n]=await Promise.all([a.n(),i.f({pin:e})]),r=z(t,n);return{paths:r.map(e=>e.path),bytes:r.reduce((e,t)=>e+t.size,0)}},je=()=>new Set(Object.keys(ae())),Me=e=>{let t=ae();for(let n of e)t[n]=null;try{localStorage.setItem(p,JSON.stringify(t))}catch{}},V=null,H=!1,U=e=>{if(V)return H=!0,V;let t=e?.from??i.o();return V=(async()=>{if(!await d())return;let n=e??(await l()?{local:await a.n(),remote:await i.f({pin:t})}:null);if(!n)return;let r=je(),o=z(n.local,n.remote).filter(e=>!r.has(e.path));if(!o.length)return;let s=await M(),c=o.reduce((e,t)=>e+t.size,0);if(!await s.cloud.fs.promptAdopt({files:o.length,bytes:c}).catch(()=>!1)){Me(o.map(e=>e.path));return}`generation`in t&&await Ae(t)})().catch(()=>{}).finally(()=>{V=null,H&&(H=!1,U())}),V},Ne=null,Pe=!1,Fe=async(e,t)=>{let n=z(e,t),r=await M(),i=async()=>{await R().catch(()=>{});let e=await B().catch(()=>({paths:[],bytes:0}));await r.cloud.fs.setAdoptSource({files:e.paths.length,bytes:e.bytes},i).catch(()=>{})},a={files:n.length,bytes:n.reduce((e,t)=>e+t.size,0)};Ne=()=>{r.cloud.fs.setAdoptSource(a,i).catch(()=>{})},Pe||(Pe=!0,Promise.resolve().then(()=>require("./api.cjs")).then(e=>e.onApiEpoch((e,t)=>{t>1&&Ne?.()})).catch(()=>{})),await r.cloud.fs.setAdoptSource(a,i)},Ie=!1,W=()=>{Ie||typeof window>`u`||(Ie=!0,window.addEventListener(`online`,()=>{j()}),Promise.resolve().then(()=>require("./account.cjs")).then(e=>e.onChange(()=>{U().catch(()=>{}),j()})).catch(()=>{}))},Le=e.t({STORAGE_ACCOUNT_CHANGED:()=>r.STORAGE_ACCOUNT_CHANGED,STORAGE_ACCOUNT_PIN_UNSUPPORTED:()=>r.STORAGE_ACCOUNT_PIN_UNSUPPORTED,StorageAccountChangedError:()=>i.t,StorageAccountPinUnsupportedError:()=>i.n,adopt:()=>J,adoptable:()=>Y,appendFile:()=>et,appendFileSync:()=>He,available:()=>ze,default:()=>dt,exists:()=>st,existsSync:()=>Ue,flush:()=>G,isAccountChanged:()=>i.c,lstatSync:()=>Ge,mkdir:()=>rt,mkdirSync:()=>qe,mount:()=>lt,onConflict:()=>$,pending:()=>X,pendingDeletes:()=>Z,promises:()=>ct,pull:()=>K,readFile:()=>Qe,readFileSealed:()=>q,readFileSync:()=>Be,readdir:()=>nt,readdirSync:()=>Ke,remount:()=>ut,rename:()=>ot,renameSync:()=>Ze,replicating:()=>Q,rm:()=>it,rmSync:()=>Je,rmdirSync:()=>Ye,stat:()=>tt,statSync:()=>We,unlink:()=>at,unlinkSync:()=>Xe,writeFile:()=>$e,writeFileSync:()=>Ve}),Re=n.t(o,{memfs:!0}),{available:ze,readFileSync:Be,writeFileSync:Ve,appendFileSync:He,existsSync:Ue,statSync:We,lstatSync:Ge,readdirSync:Ke,mkdirSync:qe,rmSync:Je,rmdirSync:Ye,unlinkSync:Xe,renameSync:Ze,readFile:Qe,writeFile:$e,appendFile:et,stat:tt,readdir:nt,mkdir:rt,rm:it,unlink:at,rename:ot,exists:st,promises:ct,mount:lt,flush:G,remount:ut}=Re,K=P,q=N,J=R,Y=B,X=ue,Z=de,Q=fe,$=Se,dt={...Re,pull:K,readFileSealed:q,adopt:J,adoptable:Y,pending:X,pendingDeletes:Z,replicating:Q,onConflict:$};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return st}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return K}});
1
+ const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./busy-Dv8wzE5M.cjs"),n=require("./node-fs-nfX7wisL.cjs"),r=require("./messages.cjs"),i=require("./storage-D2cUJlVH.cjs"),a=require("./opfs-CXMESVLc.cjs");var o=e.t({adopt:()=>R,adoptable:()=>B,available:()=>f,captureAccount:()=>s,list:()=>ve,onConflict:()=>Se,pending:()=>ue,pendingDeletes:()=>de,pull:()=>P,readFile:()=>ye,readFileSealed:()=>N,remove:()=>xe,replicating:()=>fe,writeFile:()=>be}),s=i.o,c,l=async()=>await(c??=a.t().catch(()=>!1))?!0:(c=void 0,!1),u=()=>i.a().catch(()=>`unknown`),d=async()=>await u()===`connected`,f=async()=>await l()||await d(),ee=`fkn:fs:pending`,te=`fkn:fs:pending-delete`,p=`fkn:fs:adopt-declined`,m=!0,ne=new Map,re=null,ie=(e,t)=>{if(e===null)return!1;if(`generation`in e&&`generation`in t)return e.generation===t.generation;let n=e=>`pin`in e?e.pin:i.d(e),r=n(e);return r!==void 0&&r===n(t)},h=(e,t)=>ie(re,t)?ne.get(e)??null:null,g=e=>e===`write`?ee:te,_=e=>{try{let t=localStorage.getItem(g(e));if(!t)return{};let n=JSON.parse(t);if(Array.isArray(n))return Object.fromEntries(n.filter(e=>typeof e==`string`).map(e=>[e,{base:null,pin:null}]));if(!n||typeof n!=`object`)return{};let r={};for(let[e,t]of Object.entries(n))if(t===null||typeof t==`string`)r[e]={base:t,pin:null};else if(typeof t==`object`){let{base:n,pin:i}=t;r[e]={base:typeof n==`string`?n:null,pin:typeof i==`string`&&i?i:null}}return r}catch{return{}}},v=(e,t)=>{try{Object.keys(t).length?localStorage.setItem(g(e),JSON.stringify(t)):localStorage.removeItem(g(e))}catch{}},ae=()=>{try{let e=JSON.parse(localStorage.getItem(p)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}},y=new Map,oe=e=>`pin`in e?e.pin:i.d(e)??null,se=(e,t,n,r)=>{let i=_(e),a=i[t],o=oe(r);a&&o!==null&&a.pin===o||(i[t]={base:a?a.base:n,pin:o},v(e,i),o===null&&`generation`in r?y.set(`${e}:${t}`,r):y.delete(`${e}:${t}`))},ce=(e,t)=>{y.delete(`${e}:${t}`);let n=_(e);t in n&&(delete n[t],v(e,n),E()||(O=D))},b=(e,t,n)=>se(`write`,e,t,n),x=e=>ce(`write`,e),le=(e,t)=>se(`delete`,e,h(e,t),t),S=e=>ce(`delete`,e),ue=()=>Object.keys(_(`write`)),de=()=>Object.keys(_(`delete`)),fe=()=>m,C=new Map,pe=e=>C.get(e)===i.o().generation,me=(e,t,n)=>n.pin===null&&!y.has(`${e}:${t}`),w=null,T=!1;t.r(`storage replication`,()=>w!==null||V!==null);var E=()=>[`write`,`delete`].some(e=>Object.entries(_(e)).some(([t,n])=>n.pin===null?!me(e,t,n):!pe(n.pin))),D=6e4,he=6e5,O=D,k=null,A=()=>{!k&&typeof window<`u`&&E()&&(k=setTimeout(()=>{k=null,j()},O),O=Math.min(O*2,he))},j=()=>{if(w){T=!0;return}E()&&(w=Oe(!1,i.o()).then(e=>{if(!E()){O=D;return}e.failed.length&&A()}).catch(()=>{A()}).finally(()=>{w=null,ge()}))},ge=()=>{T&&(T=!1,j())},_e=null,M=()=>_e??=Promise.resolve().then(()=>require("./api.cjs")).then(e=>e.apiPromise),ve=async e=>{let t=e?.pin??i.o();W();let n=await u(),r=n===`connected`,[o,s]=await Promise.all([l().then(e=>e?a.n():[]).catch(()=>[]),r?i.f({pin:t}).then(e=>({ok:!0,entries:e}),e=>({ok:!1,entries:[],changed:i.c(e)?e:void 0})):Promise.resolve({ok:n===`disconnected`,entries:[]})]);if(n!==`unknown`&&(m=s.ok),s.ok&&n!==`unknown`&&(ne=new Map(s.entries.map(e=>[e.path,e.updatedAt])),re=t),s.changed)throw s.changed;let c=new Map,d=e=>{let t=Date.parse(e.updatedAt??``);return Number.isFinite(t)?t:0},f=e=>{let t=c.get(e.path);(!t||d(e)>=d(t))&&c.set(e.path,e)};for(let e of o)f(e);for(let e of s.entries)f(e);return s.ok&&r&&(Fe(o,s.entries).catch(()=>{}),E()?j():U({local:o,remote:s.entries,from:t}).catch(()=>{})),[...c.values()]},ye=async(e,t)=>{let n=t?.pin??i.o();if(await l())try{return await a.i(e)}catch(e){if(e?.name!==`NotFoundError`)throw e}let r=await i.h(e,{pin:n});return await l()&&a.o(e,r).catch(()=>{}),r},N=async(e,t)=>{let n=t?.pin??i.o();if(await l())try{let t=await a.i(e);return{data:new Uint8Array(await t.arrayBuffer()),sealedAt:null}}catch(e){if(e?.name!==`NotFoundError`)throw e}return i.g(e,{pin:n})},be=async(e,t,n)=>{let r=n?.pin??i.o(),o=n?.contentType,s=o?{contentType:o}:void 0,c=t instanceof Blob?t:new Blob([t],s?{type:s.contentType}:void 0);if(await l()){await a.o(e,c,s),W();let t=h(e,r),n=await u();if(n===`disconnected`)return;if(n===`unknown`||!m){b(e,t,r),A();return}i.b(e,c,{...s,pin:r}).then(()=>x(e)).catch(n=>{b(e,t,r),i.c(n)||A(),console.warn(`fs: cloud replicate failed, queued for adopt()`,n)});return}let d=await u();if(d===`connected`)return i.b(e,c,{...s,pin:r});throw Error(d===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`)},xe=async(e,t)=>{let n=t?.pin??i.o();W();let r=[];await l()&&r.push(a.a(e).catch(()=>{}));let o=await u();if(o===`connected`?r.push(i._(e,{pin:n}).then(()=>S(e)).catch(t=>{le(e,n),i.c(t)||A(),console.warn(`fs: cloud delete failed, queued for retry`,t)})):o===`unknown`&&r.length&&h(e,n)!==null&&(le(e,n),A()),!r.length)throw Error(o===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`);x(e),await Promise.all(r)},P=async e=>{let t=i.o(),n=await i.h(e,{pin:t});return await l()&&await a.o(e,n),n},F=null,Se=e=>(F=e,()=>{F===e&&(F=null)}),Ce=async e=>{let t=await(await M()).cloud.fs.promptConflict({path:e.path,local:e.local,cloud:e.cloud}).catch(()=>null);return t===`local`?e.readLocal():t===`cloud`?e.readCloud():null},we=async e=>{if(F)try{return await F(e)}catch{return null}return Ce(e)},I=class extends Error{},L=e=>e instanceof Error?e.message:String(e),Te=()=>{let e=new Map,t=t=>{let n=e.get(t);return n||e.set(t,n={writes:new Map,deletes:new Map}),n};for(let[e,n]of Object.entries(_(`write`)))t(n.pin).writes.set(e,n.base);for(let[e,n]of Object.entries(_(`delete`)))t(n.pin).deletes.set(e,n.base);return e},Ee=async()=>{for(let[e,t]of[...y]){let n=e.startsWith(`write:`)?`write`:`delete`,r=e.slice(n.length+1),a;try{a=await i.p(t)}catch(t){i.c(t)&&y.delete(e);continue}if(y.get(e)!==t)continue;y.delete(e);let o=_(n),s=o[r];s&&s.pin===null&&(o[r]={base:s.base,pin:a},v(n,o))}},De=async(e,t,n,r,o,s)=>{let c=new Map(t.map(e=>[e.path,e])),l=e=>{if(i.c(e))throw new I};for(let[t,a]of e.deletes){let e=c.get(t);if(!e){S(t);continue}if(r.some(e=>e.path===t)){S(t);continue}if(e.updatedAt!==a){S(t);continue}try{await i._(t,n),S(t),o.deleted.push(t)}catch(e){l(e),o.failed.push({path:t,error:L(e)})}}for(let t of r){let r=c.get(t.path),u=e.writes.has(t.path);if(!u){if(!s(t))continue;if(r){o.kept.push(t.path);continue}}let d=e.writes.get(t.path)??null;if(u&&r&&r.updatedAt!==d){let e=null,s=null,c=await we({path:t.path,local:{size:t.size,updatedAt:t.updatedAt},cloud:{size:r.size,updatedAt:r.updatedAt},readLocal:()=>e??=a.i(t.path),readCloud:()=>s??=i.h(t.path,n)});if(c==null){o.unresolved.push(t.path);continue}try{let r=e!==null&&c===await e,l=s!==null&&c===await s;l||await i.b(t.path,c,t.contentType?{contentType:t.contentType,...n}:n),r||await a.o(t.path,c),x(t.path),o.resolved.push({path:t.path,choice:r?`local`:l?`cloud`:`merged`})}catch(e){if(l(e),e?.code===`FKN_E2E_LOCKED`)throw e;o.failed.push({path:t.path,error:L(e)})}continue}try{let e=await a.i(t.path);await i.b(t.path,e,t.contentType?{contentType:t.contentType,...n}:n),x(t.path),o.uploaded.push(t.path)}catch(e){if(u||b(t.path,r?.updatedAt??null,n.pin),l(e),e?.code===`FKN_E2E_LOCKED`)throw e;o.failed.push({path:t.path,error:L(e)})}}},Oe=async(e,t)=>{let n={uploaded:[],kept:[],resolved:[],unresolved:[],deleted:[],failed:[]},r=await u();if(r===`unknown`)throw Error(`fs: cloud unreachable`);if(r!==`connected`)throw Error(`fs: this needs a signed-in account`);let o=await l(),s=o?await a.n():[];if(o)for(let e of Object.keys(_(`write`)))s.some(t=>t.path===e)||x(e);await Ee();for(let[e,r]of Te()){if(e===null||pe(e))continue;let a={pin:{pin:e}},o;try{o=await i.f(a)}catch(n){if(i.c(n)){C.set(e,t.generation);continue}if(i.l(n)){ke(e);continue}throw n}try{await De(r,o,a,s,n,()=>!1)}catch(n){if(!(n instanceof I))throw n;C.set(e,t.generation)}}if(e){let e={pin:t},r=await i.f(e),a=_(`write`),o=Te().get(null)??{writes:new Map,deletes:new Map},c=new Set([...n.uploaded,...n.resolved.map(({path:e})=>e),...n.unresolved,...n.failed.map(({path:e})=>e)]),l=e=>!(e.path in a)&&!c.has(e.path);try{await De(o,r,e,s,n,l)}catch(e){throw e instanceof I?new i.t:e}}return n},ke=e=>{for(let t of[`write`,`delete`]){let n=_(t),r=!1;for(let t of Object.values(n))t.pin===e&&(t.pin=null,r=!0);r&&v(t,n)}},Ae=async e=>{for(;w;)await w;let t=Oe(!0,e);w=t.then(()=>{},()=>{});try{return await t}finally{w=null,ge()}},R=()=>Ae(i.o()),z=(e,t)=>{let n=new Set(t.map(e=>e.path)),r=_(`write`);return e.filter(e=>{let t=r[e.path];return t?me(`write`,e.path,t):!n.has(e.path)})},B=async()=>{let e=i.o();if(!await d()||!await l())return{paths:[],bytes:0};let[t,n]=await Promise.all([a.n(),i.f({pin:e})]),r=z(t,n);return{paths:r.map(e=>e.path),bytes:r.reduce((e,t)=>e+t.size,0)}},je=()=>new Set(Object.keys(ae())),Me=e=>{let t=ae();for(let n of e)t[n]=null;try{localStorage.setItem(p,JSON.stringify(t))}catch{}},V=null,H=!1,U=e=>{if(V)return H=!0,V;let t=e?.from??i.o();return V=(async()=>{if(!await d())return;let n=e??(await l()?{local:await a.n(),remote:await i.f({pin:t})}:null);if(!n)return;let r=je(),o=z(n.local,n.remote).filter(e=>!r.has(e.path));if(!o.length)return;let s=await M(),c=o.reduce((e,t)=>e+t.size,0);if(!await s.cloud.fs.promptAdopt({files:o.length,bytes:c}).catch(()=>!1)){Me(o.map(e=>e.path));return}`generation`in t&&await Ae(t)})().catch(()=>{}).finally(()=>{V=null,H&&(H=!1,U())}),V},Ne=null,Pe=!1,Fe=async(e,t)=>{let n=z(e,t),r=await M(),i=async()=>{await R().catch(()=>{});let e=await B().catch(()=>({paths:[],bytes:0}));await r.cloud.fs.setAdoptSource({files:e.paths.length,bytes:e.bytes},i).catch(()=>{})},a={files:n.length,bytes:n.reduce((e,t)=>e+t.size,0)};Ne=()=>{r.cloud.fs.setAdoptSource(a,i).catch(()=>{})},Pe||(Pe=!0,Promise.resolve().then(()=>require("./api.cjs")).then(e=>e.onApiEpoch((e,t)=>{t>1&&Ne?.()})).catch(()=>{})),await r.cloud.fs.setAdoptSource(a,i)},Ie=!1,W=()=>{Ie||typeof window>`u`||(Ie=!0,window.addEventListener(`online`,()=>{j()}),Promise.resolve().then(()=>require("./account.cjs")).then(e=>e.onChange(()=>{U().catch(()=>{}),j()})).catch(()=>{}))},Le=e.t({STORAGE_ACCOUNT_CHANGED:()=>r.STORAGE_ACCOUNT_CHANGED,STORAGE_ACCOUNT_PIN_UNSUPPORTED:()=>r.STORAGE_ACCOUNT_PIN_UNSUPPORTED,StorageAccountChangedError:()=>i.t,StorageAccountPinUnsupportedError:()=>i.n,adopt:()=>J,adoptable:()=>Y,appendFile:()=>et,appendFileSync:()=>He,available:()=>ze,default:()=>dt,exists:()=>st,existsSync:()=>Ue,flush:()=>G,isAccountChanged:()=>i.c,lstatSync:()=>Ge,mkdir:()=>rt,mkdirSync:()=>qe,mount:()=>lt,onConflict:()=>$,pending:()=>X,pendingDeletes:()=>Z,promises:()=>ct,pull:()=>K,readFile:()=>Qe,readFileSealed:()=>q,readFileSync:()=>Be,readdir:()=>nt,readdirSync:()=>Ke,remount:()=>ut,rename:()=>ot,renameSync:()=>Ze,replicating:()=>Q,rm:()=>it,rmSync:()=>Je,rmdirSync:()=>Ye,stat:()=>tt,statSync:()=>We,unlink:()=>at,unlinkSync:()=>Xe,writeFile:()=>$e,writeFileSync:()=>Ve}),Re=n.t(o,{memfs:!0}),{available:ze,readFileSync:Be,writeFileSync:Ve,appendFileSync:He,existsSync:Ue,statSync:We,lstatSync:Ge,readdirSync:Ke,mkdirSync:qe,rmSync:Je,rmdirSync:Ye,unlinkSync:Xe,renameSync:Ze,readFile:Qe,writeFile:$e,appendFile:et,stat:tt,readdir:nt,mkdir:rt,rm:it,unlink:at,rename:ot,exists:st,promises:ct,mount:lt,flush:G,remount:ut}=Re,K=P,q=N,J=R,Y=B,X=ue,Z=de,Q=fe,$=Se,dt={...Re,pull:K,readFileSealed:q,adopt:J,adoptable:Y,pending:X,pendingDeletes:Z,replicating:Q,onConflict:$};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return st}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return K}});
package/fs.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./messages.cjs"),t=require("./storage-BS5WMO4f.cjs"),n=require("./fs-BTyRnUPI.cjs");exports.STORAGE_ACCOUNT_CHANGED=e.STORAGE_ACCOUNT_CHANGED,exports.STORAGE_ACCOUNT_PIN_UNSUPPORTED=e.STORAGE_ACCOUNT_PIN_UNSUPPORTED,exports.StorageAccountChangedError=t.t,exports.StorageAccountPinUnsupportedError=t.n,exports.adopt=n.t,exports.adoptable=n.n,exports.appendFile=n.r,exports.appendFileSync=n.i,exports.available=n.a,exports.default=n.l,exports.exists=n.o,exports.existsSync=n.s,exports.flush=n.c,exports.isAccountChanged=t.c,exports.lstatSync=n.d,exports.mkdir=n.f,exports.mkdirSync=n.p,exports.mount=n.m,exports.onConflict=n.h,exports.pending=n.g,exports.pendingDeletes=n._,exports.promises=n.v,exports.pull=n.y,exports.readFile=n.b,exports.readFileSealed=n.x,exports.readFileSync=n.S,exports.readdir=n.C,exports.readdirSync=n.w,exports.remount=n.T,exports.rename=n.E,exports.renameSync=n.D,exports.replicating=n.O,exports.rm=n.k,exports.rmSync=n.A,exports.rmdirSync=n.j,exports.stat=n.M,exports.statSync=n.N,exports.unlink=n.P,exports.unlinkSync=n.F,exports.writeFile=n.I,exports.writeFileSync=n.L;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./messages.cjs"),t=require("./storage-D2cUJlVH.cjs"),n=require("./fs-p0bOOj5n.cjs");exports.STORAGE_ACCOUNT_CHANGED=e.STORAGE_ACCOUNT_CHANGED,exports.STORAGE_ACCOUNT_PIN_UNSUPPORTED=e.STORAGE_ACCOUNT_PIN_UNSUPPORTED,exports.StorageAccountChangedError=t.t,exports.StorageAccountPinUnsupportedError=t.n,exports.adopt=n.t,exports.adoptable=n.n,exports.appendFile=n.r,exports.appendFileSync=n.i,exports.available=n.a,exports.default=n.l,exports.exists=n.o,exports.existsSync=n.s,exports.flush=n.c,exports.isAccountChanged=t.c,exports.lstatSync=n.d,exports.mkdir=n.f,exports.mkdirSync=n.p,exports.mount=n.m,exports.onConflict=n.h,exports.pending=n.g,exports.pendingDeletes=n._,exports.promises=n.v,exports.pull=n.y,exports.readFile=n.b,exports.readFileSealed=n.x,exports.readFileSync=n.S,exports.readdir=n.C,exports.readdirSync=n.w,exports.remount=n.T,exports.rename=n.E,exports.renameSync=n.D,exports.replicating=n.O,exports.rm=n.k,exports.rmSync=n.A,exports.rmdirSync=n.j,exports.stat=n.M,exports.statSync=n.N,exports.unlink=n.P,exports.unlinkSync=n.F,exports.writeFile=n.I,exports.writeFileSync=n.L;
package/fs.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { STORAGE_ACCOUNT_CHANGED as e, STORAGE_ACCOUNT_PIN_UNSUPPORTED as t } from "./messages.js";
2
- import { c as n, n as r, t as i } from "./storage-BWmGrO6a.js";
3
- import { A as a, C as o, D as s, E as c, F as l, I as u, L as d, M as f, N as p, O as m, P as h, S as g, T as _, _ as v, a as y, b, c as x, d as S, f as C, g as w, h as T, i as E, j as D, k as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, v as L, w as R, x as z, y as B } from "./fs-q7Kg51hq.js";
2
+ import { c as n, n as r, t as i } from "./storage-Dn1gTLSZ.js";
3
+ import { A as a, C as o, D as s, E as c, F as l, I as u, L as d, M as f, N as p, O as m, P as h, S as g, T as _, _ as v, a as y, b, c as x, d as S, f as C, g as w, h as T, i as E, j as D, k as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, v as L, w as R, x as z, y as B } from "./fs-CVnmXRf7.js";
4
4
  export { e as STORAGE_ACCOUNT_CHANGED, t as STORAGE_ACCOUNT_PIN_UNSUPPORTED, i as StorageAccountChangedError, r as StorageAccountPinUnsupportedError, I as adopt, j as adoptable, P as appendFile, E as appendFileSync, y as available, k as default, M as exists, F as existsSync, x as flush, n as isAccountChanged, S as lstatSync, C as mkdir, N as mkdirSync, A as mount, T as onConflict, w as pending, v as pendingDeletes, L as promises, B as pull, b as readFile, z as readFileSealed, g as readFileSync, o as readdir, R as readdirSync, _ as remount, c as rename, s as renameSync, m as replicating, O as rm, a as rmSync, D as rmdirSync, f as stat, p as statSync, h as unlink, l as unlinkSync, u as writeFile, d as writeFileSync };