@fkn/lib 0.9.72 → 0.9.74

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 (122) hide show
  1. package/{account-Czik26yc.js → account-CTOhAc2x.js} +2 -2
  2. package/{account-CZYGFU5m.cjs → account-DO7KokEs.cjs} +1 -1
  3. package/{account-generation-BTxZWNQz.cjs → account-generation-6F54U_B3.cjs} +1 -1
  4. package/{account-generation-D2hoQYXp.js → account-generation-Cq_xRcUr.js} +1 -1
  5. package/{account-CXUwroRM.d.ts → account-kRplShh-.d.ts} +1 -1
  6. package/{account-storage-DcbJCOvI.js → account-storage-DQryXWDZ.js} +2 -2
  7. package/{account-storage-CIfiAHa1.cjs → account-storage-f0HN_zgo.cjs} +1 -1
  8. package/account.cjs +1 -1
  9. package/account.d.ts +2 -2
  10. package/account.js +1 -1
  11. package/{api-DhwJz0vo.d.ts → api-CXvE64Jr.d.ts} +26 -2
  12. package/{api-e82hhULK.js → api-DR6y3Q0Y.js} +153 -136
  13. package/api-RuHgAkxf.cjs +3 -0
  14. package/api.cjs +1 -1
  15. package/api.d.ts +2 -2
  16. package/api.js +1 -1
  17. package/{broker-frame-BClLp2ZV.js → broker-frame-AQDD3D9E.js} +1 -1
  18. package/{broker-frame-BKHtDSjv.cjs → broker-frame-cVEhez7A.cjs} +1 -1
  19. package/broker-frame.cjs +1 -1
  20. package/broker-frame.js +1 -1
  21. package/cloud/dgram.cjs +1 -1
  22. package/cloud/dgram.d.ts +1 -1
  23. package/cloud/dgram.js +1 -1
  24. package/cloud/dns.cjs +1 -1
  25. package/cloud/dns.d.ts +2 -2
  26. package/cloud/dns.js +1 -1
  27. package/cloud/fetch.cjs +1 -1
  28. package/cloud/fetch.d.ts +1 -1
  29. package/cloud/fetch.js +1 -1
  30. package/cloud/fs/promises.cjs +1 -1
  31. package/cloud/fs/promises.js +1 -1
  32. package/cloud/fs.cjs +1 -1
  33. package/cloud/fs.js +2 -2
  34. package/cloud/http.cjs +1 -1
  35. package/cloud/http.d.ts +1 -1
  36. package/cloud/http.js +1 -1
  37. package/cloud/net.cjs +1 -1
  38. package/cloud/net.d.ts +1 -1
  39. package/cloud/net.js +1 -1
  40. package/{cloud-DRfcPLdB.d.ts → cloud-C9alQ9TA.d.ts} +5 -5
  41. package/{cloud-BV96BYFR.js → cloud-Cn27x6RK.js} +9 -9
  42. package/{cloud-6ddOLS37.cjs → cloud-CrKxBmgy.cjs} +1 -1
  43. package/cloud.cjs +1 -1
  44. package/cloud.d.ts +6 -6
  45. package/cloud.js +7 -7
  46. package/{contract-CDdIE_Es.d.ts → contract-B-iUk1mJ.d.ts} +36 -2
  47. package/contract.cjs +1 -1
  48. package/contract.d.ts +3 -3
  49. package/contract.js +2 -2
  50. package/{dgram-CTcHo7BL.js → dgram-Cj1vkCE9.js} +1 -1
  51. package/{dgram-wTKAuRI3.cjs → dgram-D7I5nP9w.cjs} +1 -1
  52. package/{dgram-CPQqam5Z.d.ts → dgram-D9DiXmhU.d.ts} +4 -4
  53. package/dgram.cjs +1 -1
  54. package/dgram.d.ts +1 -1
  55. package/dgram.js +1 -1
  56. package/{dns-Cdmp7tw4.js → dns-43gybmwY.js} +1 -1
  57. package/{dns-_NCe2YLS.d.ts → dns-CfUsfETG.d.ts} +1 -1
  58. package/{dns-OXiS-nXH.cjs → dns-D8cfGYaF.cjs} +1 -1
  59. package/dns.cjs +1 -1
  60. package/dns.d.ts +2 -2
  61. package/dns.js +1 -1
  62. package/{extension-eA0r72hp.cjs → extension-D8Kj6rRT.cjs} +1 -1
  63. package/{extension-DlPOuZum.js → extension-DFeaP0Ou.js} +4 -4
  64. package/extension.cjs +1 -1
  65. package/extension.js +2 -2
  66. package/fs/promises.cjs +1 -1
  67. package/fs/promises.js +1 -1
  68. package/{fs-BHfRf_xt.js → fs-BnCWJ-jg.js} +1 -1
  69. package/{fs-CLvS_YSq.cjs → fs-COtIapGm.cjs} +1 -1
  70. package/{fs-9LWii1mp.js → fs-DXz_TgC8.js} +3 -3
  71. package/{fs-CiZZf0ne.cjs → fs-Dp_8uaZe.cjs} +1 -1
  72. package/fs.cjs +1 -1
  73. package/fs.js +2 -2
  74. package/{http-KKqCypOh.cjs → http-B72t08kn.cjs} +2 -2
  75. package/{http-rzQOrCmq.d.ts → http-D1qvoYf6.d.ts} +1 -1
  76. package/{http-Cg5aK6Jn.js → http-DLMUTBb4.js} +2 -2
  77. package/http.cjs +1 -1
  78. package/http.d.ts +1 -1
  79. package/http.js +1 -1
  80. package/index.cjs +1 -1
  81. package/index.d.ts +13 -14
  82. package/index.js +32 -38
  83. package/{lib-B895LZTn.js → lib-DIxvhbhf.js} +1 -1
  84. package/{lib-BJzKHh4X.cjs → lib-uND2BvAa.cjs} +1 -1
  85. package/{net-B4IqLeN8.d.ts → net-B0N6hTWu.d.ts} +4 -4
  86. package/net-D7oBrZbA.cjs +1 -0
  87. package/{net-BUeelrnH.js → net-wirsgKVa.js} +26 -25
  88. package/net.cjs +1 -1
  89. package/net.d.ts +1 -1
  90. package/net.js +1 -1
  91. package/package.json +6 -1
  92. package/{packages-C27FhPmh.js → packages-BAc5K4BQ.js} +1 -1
  93. package/{packages-SwO4CxMl.d.ts → packages-DTs-fy67.d.ts} +1 -1
  94. package/{packages-Bw1OE9Ra.cjs → packages-DkKru6li.cjs} +1 -1
  95. package/packages.cjs +1 -1
  96. package/packages.d.ts +2 -2
  97. package/packages.js +1 -1
  98. package/{proxy-CzP07me0.d.ts → proxy-1E6vjFKx.d.ts} +2 -2
  99. package/{proxy-BET3xNJw.js → proxy-BmptuWKa.js} +2 -2
  100. package/{proxy-khQQJbGw.cjs → proxy-CLsTNt40.cjs} +1 -1
  101. package/{relay-choice-DB1F7bcn.d.ts → relay-choice-BeNCw3ba.d.ts} +1 -1
  102. package/{rooms-3XplwXzb.d.ts → rooms-APVrHbvL.d.ts} +1 -1
  103. package/{rooms-C8FW4mDY.cjs → rooms-BJ5MQq-S.cjs} +1 -1
  104. package/{rooms-r09iUhIA.js → rooms-a1_jHEhL.js} +1 -1
  105. package/rooms.cjs +1 -1
  106. package/rooms.d.ts +2 -2
  107. package/rooms.js +1 -1
  108. package/{storage-CFk2AT4V.js → storage-ChE9vSDe.js} +3 -3
  109. package/{storage-BINUKDl1.cjs → storage-D9_L4Coi.cjs} +1 -1
  110. package/{storage-C38adB-z.d.ts → storage-YQNVOwp8.d.ts} +1 -1
  111. package/storage.cjs +1 -1
  112. package/storage.d.ts +2 -2
  113. package/storage.js +1 -1
  114. package/websocket.cjs +1 -0
  115. package/websocket.d.ts +48 -0
  116. package/websocket.js +179 -0
  117. package/{wire-DhmLnYEU.d.ts → wire-Cddfpu2U.d.ts} +12 -1
  118. package/wire.cjs +1 -1
  119. package/wire.d.ts +2 -2
  120. package/wire.js +6 -2
  121. package/api-oE2v5tpj.cjs +0 -3
  122. package/net-i4BzwpoN.cjs +0 -1
package/websocket.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ type Handler<E extends Event> = ((event: E) => unknown) | null;
2
+ /**
3
+ * The platform's `WebSocket`, opened by FKN's proxy on the node the session uses: the server sees that node's address,
4
+ * never the person's, and the proxy applies its egress validation, fair-use limits and metering as for a fetch. Its
5
+ * messages pass through the proxy's memory, so it is for servers the browser should not reach from its own address.
6
+ *
7
+ * It behaves as the platform's, events and their order included, with what the platform also refuses: a url that is
8
+ * not `ws:`, `wss:`, `http:` or `https:`, a fragment, a protocol that is not a token or is offered twice. It also
9
+ * refuses FKN's own hosts and a protocol named `fkn-proxy` or starting `fkn-proxy.`, which carry the target to the
10
+ * proxy. Nothing reconnects by itself. A Worker needs `relayWorker` from its page first; without it the socket fails
11
+ * once the broker has not answered within the deadline of `apiWithin`. `extensions` is always empty.
12
+ */
13
+ export declare class WebSocket extends EventTarget {
14
+ #private;
15
+ static readonly CONNECTING = 0;
16
+ static readonly OPEN = 1;
17
+ static readonly CLOSING = 2;
18
+ static readonly CLOSED = 3;
19
+ readonly CONNECTING: 0;
20
+ readonly OPEN: 1;
21
+ readonly CLOSING: 2;
22
+ readonly CLOSED: 3;
23
+ readonly url: string;
24
+ readonly extensions = "";
25
+ constructor(url: string | URL, protocols?: string | string[]);
26
+ get readyState(): 0 | 1 | 2 | 3;
27
+ get protocol(): string;
28
+ get bufferedAmount(): number;
29
+ get binaryType(): BinaryType;
30
+ set binaryType(type: BinaryType);
31
+ send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
32
+ close(code?: number, reason?: string): void;
33
+ get onopen(): Handler<Event>;
34
+ set onopen(handler: Handler<Event>);
35
+ get onmessage(): Handler<MessageEvent>;
36
+ set onmessage(handler: Handler<MessageEvent>);
37
+ get onerror(): Handler<Event>;
38
+ set onerror(handler: Handler<Event>);
39
+ get onclose(): Handler<CloseEvent>;
40
+ set onclose(handler: Handler<CloseEvent>);
41
+ }
42
+ export interface WebSocket {
43
+ addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
44
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
45
+ removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
46
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
47
+ }
48
+ export {};
package/websocket.js ADDED
@@ -0,0 +1,179 @@
1
+ import { i as e } from "./broker-frame-AQDD3D9E.js";
2
+ import { s as t } from "./api-DR6y3Q0Y.js";
3
+ import { t as n } from "./busy-C1JPjoZ_.js";
4
+ import { PROXY_WEBSOCKET_ENTRY as r, PROXY_WEBSOCKET_MARKER as i } from "./contract.js";
5
+ // src/websocket.ts
6
+ var a = 0, o = 1, s = 2, c = 3, l = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/, u = new TextEncoder(), d = {
7
+ code: 1006,
8
+ reason: "",
9
+ wasClean: !1,
10
+ error: !1
11
+ }, f = (e) => {
12
+ let t;
13
+ try {
14
+ t = new URL(e, globalThis.document?.baseURI ?? globalThis.location?.href);
15
+ } catch {
16
+ throw new DOMException(`The URL '${e}' is invalid.`, "SyntaxError");
17
+ }
18
+ if (t.protocol === "http:" ? t.protocol = "ws:" : t.protocol === "https:" && (t.protocol = "wss:"), t.protocol !== "ws:" && t.protocol !== "wss:") throw new DOMException(`The URL's scheme must be either 'http', 'https', 'ws', or 'wss'. '${t.protocol}' is not allowed.`, "SyntaxError");
19
+ if (t.hash || t.href.endsWith("#")) throw new DOMException("The URL contains a fragment identifier.", "SyntaxError");
20
+ return t;
21
+ }, p = (e) => {
22
+ if (typeof e == "string") return [e, u.encode(e).byteLength];
23
+ if (e instanceof Blob) return [e, e.size];
24
+ let t = ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);
25
+ return [t.slice().buffer, t.byteLength];
26
+ }, m = class extends EventTarget {
27
+ static CONNECTING = a;
28
+ static OPEN = o;
29
+ static CLOSING = s;
30
+ static CLOSED = c;
31
+ url;
32
+ extensions = "";
33
+ #e = "blob";
34
+ #t = a;
35
+ #n = "";
36
+ #r = 0;
37
+ #i;
38
+ #a;
39
+ #o;
40
+ #s;
41
+ #c = /* @__PURE__ */ new Map();
42
+ constructor(a, o = []) {
43
+ super();
44
+ let s = f(a), c = typeof o == "string" ? [o] : [...o];
45
+ if (new Set(c).size !== c.length || c.some((e) => !l.test(e))) throw new DOMException("The subprotocols are not unique tokens.", "SyntaxError");
46
+ if (c.some((e) => e === "fkn-proxy" || e.startsWith("fkn-proxy."))) throw new DOMException(`The subprotocol '${i}' and those starting '${r}' are FKN's.`, "SyntaxError");
47
+ if (e(s.hostname)) throw Error(`websocket refuses FKN platform domains (${s.hostname})`);
48
+ this.url = s.href, this.#i = s.origin, this.#s = n("websocket"), t("a websocket").then((e) => e.cloud.websocket({
49
+ url: this.url,
50
+ protocols: c
51
+ })).then((e) => this.#l(e)).catch(() => this.#u({
52
+ ...d,
53
+ error: !0
54
+ }));
55
+ }
56
+ get readyState() {
57
+ return this.#t;
58
+ }
59
+ get protocol() {
60
+ return this.#n;
61
+ }
62
+ get bufferedAmount() {
63
+ return this.#r;
64
+ }
65
+ get binaryType() {
66
+ return this.#e;
67
+ }
68
+ set binaryType(e) {
69
+ (e === "blob" || e === "arraybuffer") && (this.#e = e);
70
+ }
71
+ send(e) {
72
+ if (this.#t === a) throw new DOMException("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.", "InvalidStateError");
73
+ let [t, n] = p(e);
74
+ this.#r += n, this.#t === o && this.#o.write(t).then(() => {
75
+ this.#r -= n;
76
+ }, () => {});
77
+ }
78
+ close(e, t) {
79
+ if (e !== void 0 && e !== 1e3 && (e < 3e3 || e > 4999)) throw new DOMException(`The close code must be either 1000, or between 3000 and 4999. ${e} is neither.`, "InvalidAccessError");
80
+ if (t !== void 0 && u.encode(t).byteLength > 123) throw new DOMException("The close reason must not be greater than 123 UTF-8 bytes.", "SyntaxError");
81
+ if (this.#t === s || this.#t === c) return;
82
+ if (e === void 0 && t !== void 0 && (e = 1e3), this.#t === a) {
83
+ this.#t = s, setTimeout(() => this.#u({
84
+ ...d,
85
+ error: !0
86
+ }), 0);
87
+ return;
88
+ }
89
+ this.#t = s;
90
+ let n = this.#a;
91
+ this.#o.close().catch(() => {}).then(() => n.close(e, t)).catch(() => {});
92
+ }
93
+ async #l(e) {
94
+ if (this.#t !== a) {
95
+ e.close().catch(() => {});
96
+ return;
97
+ }
98
+ this.#a = e, this.#n = e.protocol, this.#o = e.writable.getWriter(), this.#t = o, this.dispatchEvent(new Event("open"));
99
+ let t = e.readable.getReader();
100
+ try {
101
+ for (;;) {
102
+ let { value: e, done: n } = await t.read();
103
+ if (n) break;
104
+ if (this.#t !== o) continue;
105
+ let r = typeof e == "string" || this.#e === "arraybuffer" ? e : new Blob([e]);
106
+ this.dispatchEvent(new MessageEvent("message", {
107
+ data: r,
108
+ origin: this.#i
109
+ }));
110
+ }
111
+ } catch {
112
+ return this.#u(d);
113
+ }
114
+ let n = await e.closed.then((e) => typeof e?.code == "number" ? e : d, () => d);
115
+ this.#u(n);
116
+ }
117
+ #u({ code: e, reason: t, wasClean: n, error: r }) {
118
+ this.#t !== c && (this.#t = c, this.#s(), r && this.dispatchEvent(new Event("error")), this.dispatchEvent(new CloseEvent("close", {
119
+ code: e,
120
+ reason: t,
121
+ wasClean: n
122
+ })));
123
+ }
124
+ #d(e) {
125
+ return this.#c.get(e)?.handler ?? null;
126
+ }
127
+ #f(e, t) {
128
+ let n = this.#c.get(e);
129
+ if (typeof t != "function") {
130
+ n && this.removeEventListener(e, n.listener), this.#c.delete(e);
131
+ return;
132
+ }
133
+ if (n) {
134
+ n.handler = t;
135
+ return;
136
+ }
137
+ let r = {
138
+ handler: t,
139
+ listener: (e) => {
140
+ r.handler.call(this, e);
141
+ }
142
+ };
143
+ this.#c.set(e, r), this.addEventListener(e, r.listener);
144
+ }
145
+ get onopen() {
146
+ return this.#d("open");
147
+ }
148
+ set onopen(e) {
149
+ this.#f("open", e);
150
+ }
151
+ get onmessage() {
152
+ return this.#d("message");
153
+ }
154
+ set onmessage(e) {
155
+ this.#f("message", e);
156
+ }
157
+ get onerror() {
158
+ return this.#d("error");
159
+ }
160
+ set onerror(e) {
161
+ this.#f("error", e);
162
+ }
163
+ get onclose() {
164
+ return this.#d("close");
165
+ }
166
+ set onclose(e) {
167
+ this.#f("close", e);
168
+ }
169
+ };
170
+ for (let [e, t] of Object.entries({
171
+ CONNECTING: a,
172
+ OPEN: o,
173
+ CLOSING: s,
174
+ CLOSED: c
175
+ })) Object.defineProperty(m.prototype, e, {
176
+ value: t,
177
+ enumerable: !0
178
+ });
179
+ export { m as WebSocket };
@@ -87,4 +87,15 @@ type UdpPortAckMessage = {
87
87
  type: typeof UDP_PORT_ACK_TYPE;
88
88
  consumedBytes: number;
89
89
  };
90
- export { UDP_OPTION_TTL as _, TCP_OPTION_TTL as a, UdpPortAckMessage as b, UDP_OPTION_ADD_MEMBERSHIP_V6 as c, UDP_OPTION_DROP_MEMBERSHIP_V6 as d, UDP_OPTION_MULTICAST_LOOP_V4 as f, UDP_OPTION_SEND_BUFFER_SIZE as g, UDP_OPTION_RECV_BUFFER_SIZE as h, TCP_OPTION_SEND_BUFFER_SIZE as i, UDP_OPTION_BROADCAST as l, UDP_OPTION_MULTICAST_TTL_V4 as m, TCP_OPTION_NODELAY as n, TcpSocketOption as o, UDP_OPTION_MULTICAST_LOOP_V6 as p, TCP_OPTION_RECV_BUFFER_SIZE as r, UDP_OPTION_ADD_MEMBERSHIP_V4 as s, TCP_OPTION_KEEPALIVE as t, UDP_OPTION_DROP_MEMBERSHIP_V4 as u, UDP_PORT_ACK_INTERVAL_BYTES as v, UdpSocketOption as x, UDP_PORT_ACK_TYPE as y };
90
+ /**
91
+ * What a socket fails with when its site resets the connection: Node's own error for it on Linux (Node 26.12.1 against
92
+ * a site that resets, measured 2026-11-11). The data plane fails the socket's stream with it, and since an error
93
+ * crossing realms keeps only its name and message, the library gives back the rest by the message.
94
+ */
95
+ declare const SITE_RESET_MESSAGE = "read ECONNRESET";
96
+ declare const siteResetError: () => Error & {
97
+ code: string;
98
+ errno: number;
99
+ syscall: string;
100
+ };
101
+ export { siteResetError as C, UdpSocketOption as S, UDP_OPTION_SEND_BUFFER_SIZE as _, TCP_OPTION_SEND_BUFFER_SIZE as a, UDP_PORT_ACK_TYPE as b, UDP_OPTION_ADD_MEMBERSHIP_V4 as c, UDP_OPTION_DROP_MEMBERSHIP_V4 as d, UDP_OPTION_DROP_MEMBERSHIP_V6 as f, UDP_OPTION_RECV_BUFFER_SIZE as g, UDP_OPTION_MULTICAST_TTL_V4 as h, TCP_OPTION_RECV_BUFFER_SIZE as i, UDP_OPTION_ADD_MEMBERSHIP_V6 as l, UDP_OPTION_MULTICAST_LOOP_V6 as m, TCP_OPTION_KEEPALIVE as n, TCP_OPTION_TTL as o, UDP_OPTION_MULTICAST_LOOP_V4 as p, TCP_OPTION_NODELAY as r, TcpSocketOption as s, SITE_RESET_MESSAGE as t, UDP_OPTION_BROADCAST as u, UDP_OPTION_TTL as v, UdpPortAckMessage as x, UDP_PORT_ACK_INTERVAL_BYTES as y };
package/wire.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=0,t=1,n=2,r=3,i=4,a=0,o=1,s=2,c=3,l=4,u=5,d=6,f=7,p=8,m=9,h=10,g=`webvpn-udp-port-ack`,_=524288;exports.TCP_OPTION_KEEPALIVE=n,exports.TCP_OPTION_NODELAY=e,exports.TCP_OPTION_RECV_BUFFER_SIZE=i,exports.TCP_OPTION_SEND_BUFFER_SIZE=r,exports.TCP_OPTION_TTL=t,exports.UDP_OPTION_ADD_MEMBERSHIP_V4=u,exports.UDP_OPTION_ADD_MEMBERSHIP_V6=f,exports.UDP_OPTION_BROADCAST=a,exports.UDP_OPTION_DROP_MEMBERSHIP_V4=d,exports.UDP_OPTION_DROP_MEMBERSHIP_V6=p,exports.UDP_OPTION_MULTICAST_LOOP_V4=c,exports.UDP_OPTION_MULTICAST_LOOP_V6=l,exports.UDP_OPTION_MULTICAST_TTL_V4=s,exports.UDP_OPTION_RECV_BUFFER_SIZE=h,exports.UDP_OPTION_SEND_BUFFER_SIZE=m,exports.UDP_OPTION_TTL=o,exports.UDP_PORT_ACK_INTERVAL_BYTES=_,exports.UDP_PORT_ACK_TYPE=g;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=0,t=1,n=2,r=3,i=4,a=0,o=1,s=2,c=3,l=4,u=5,d=6,f=7,p=8,m=9,h=10,g=`webvpn-udp-port-ack`,_=524288,v=`read ECONNRESET`,y=()=>Object.assign(Error(v),{code:`ECONNRESET`,errno:-104,syscall:`read`});exports.SITE_RESET_MESSAGE=v,exports.TCP_OPTION_KEEPALIVE=n,exports.TCP_OPTION_NODELAY=e,exports.TCP_OPTION_RECV_BUFFER_SIZE=i,exports.TCP_OPTION_SEND_BUFFER_SIZE=r,exports.TCP_OPTION_TTL=t,exports.UDP_OPTION_ADD_MEMBERSHIP_V4=u,exports.UDP_OPTION_ADD_MEMBERSHIP_V6=f,exports.UDP_OPTION_BROADCAST=a,exports.UDP_OPTION_DROP_MEMBERSHIP_V4=d,exports.UDP_OPTION_DROP_MEMBERSHIP_V6=p,exports.UDP_OPTION_MULTICAST_LOOP_V4=c,exports.UDP_OPTION_MULTICAST_LOOP_V6=l,exports.UDP_OPTION_MULTICAST_TTL_V4=s,exports.UDP_OPTION_RECV_BUFFER_SIZE=h,exports.UDP_OPTION_SEND_BUFFER_SIZE=m,exports.UDP_OPTION_TTL=o,exports.UDP_PORT_ACK_INTERVAL_BYTES=_,exports.UDP_PORT_ACK_TYPE=g,exports.siteResetError=y;
package/wire.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as UDP_OPTION_TTL, a as TCP_OPTION_TTL, b as UdpPortAckMessage, c as UDP_OPTION_ADD_MEMBERSHIP_V6, d as UDP_OPTION_DROP_MEMBERSHIP_V6, f as UDP_OPTION_MULTICAST_LOOP_V4, g as UDP_OPTION_SEND_BUFFER_SIZE, h as UDP_OPTION_RECV_BUFFER_SIZE, i as TCP_OPTION_SEND_BUFFER_SIZE, l as UDP_OPTION_BROADCAST, m as UDP_OPTION_MULTICAST_TTL_V4, n as TCP_OPTION_NODELAY, o as TcpSocketOption, p as UDP_OPTION_MULTICAST_LOOP_V6, r as TCP_OPTION_RECV_BUFFER_SIZE, s as UDP_OPTION_ADD_MEMBERSHIP_V4, t as TCP_OPTION_KEEPALIVE, u as UDP_OPTION_DROP_MEMBERSHIP_V4, v as UDP_PORT_ACK_INTERVAL_BYTES, x as UdpSocketOption, y as UDP_PORT_ACK_TYPE } from "./wire-DhmLnYEU.js";
2
- export { TCP_OPTION_KEEPALIVE, TCP_OPTION_NODELAY, TCP_OPTION_RECV_BUFFER_SIZE, TCP_OPTION_SEND_BUFFER_SIZE, TCP_OPTION_TTL, TcpSocketOption, UDP_OPTION_ADD_MEMBERSHIP_V4, UDP_OPTION_ADD_MEMBERSHIP_V6, UDP_OPTION_BROADCAST, UDP_OPTION_DROP_MEMBERSHIP_V4, UDP_OPTION_DROP_MEMBERSHIP_V6, UDP_OPTION_MULTICAST_LOOP_V4, UDP_OPTION_MULTICAST_LOOP_V6, UDP_OPTION_MULTICAST_TTL_V4, UDP_OPTION_RECV_BUFFER_SIZE, UDP_OPTION_SEND_BUFFER_SIZE, UDP_OPTION_TTL, UDP_PORT_ACK_INTERVAL_BYTES, UDP_PORT_ACK_TYPE, UdpPortAckMessage, UdpSocketOption };
1
+ import { C as siteResetError, S as UdpSocketOption, _ as UDP_OPTION_SEND_BUFFER_SIZE, a as TCP_OPTION_SEND_BUFFER_SIZE, b as UDP_PORT_ACK_TYPE, c as UDP_OPTION_ADD_MEMBERSHIP_V4, d as UDP_OPTION_DROP_MEMBERSHIP_V4, f as UDP_OPTION_DROP_MEMBERSHIP_V6, g as UDP_OPTION_RECV_BUFFER_SIZE, h as UDP_OPTION_MULTICAST_TTL_V4, i as TCP_OPTION_RECV_BUFFER_SIZE, l as UDP_OPTION_ADD_MEMBERSHIP_V6, m as UDP_OPTION_MULTICAST_LOOP_V6, n as TCP_OPTION_KEEPALIVE, o as TCP_OPTION_TTL, p as UDP_OPTION_MULTICAST_LOOP_V4, r as TCP_OPTION_NODELAY, s as TcpSocketOption, t as SITE_RESET_MESSAGE, u as UDP_OPTION_BROADCAST, v as UDP_OPTION_TTL, x as UdpPortAckMessage, y as UDP_PORT_ACK_INTERVAL_BYTES } from "./wire-Cddfpu2U.js";
2
+ export { SITE_RESET_MESSAGE, TCP_OPTION_KEEPALIVE, TCP_OPTION_NODELAY, TCP_OPTION_RECV_BUFFER_SIZE, TCP_OPTION_SEND_BUFFER_SIZE, TCP_OPTION_TTL, TcpSocketOption, UDP_OPTION_ADD_MEMBERSHIP_V4, UDP_OPTION_ADD_MEMBERSHIP_V6, UDP_OPTION_BROADCAST, UDP_OPTION_DROP_MEMBERSHIP_V4, UDP_OPTION_DROP_MEMBERSHIP_V6, UDP_OPTION_MULTICAST_LOOP_V4, UDP_OPTION_MULTICAST_LOOP_V6, UDP_OPTION_MULTICAST_TTL_V4, UDP_OPTION_RECV_BUFFER_SIZE, UDP_OPTION_SEND_BUFFER_SIZE, UDP_OPTION_TTL, UDP_PORT_ACK_INTERVAL_BYTES, UDP_PORT_ACK_TYPE, UdpPortAckMessage, UdpSocketOption, siteResetError };
package/wire.js CHANGED
@@ -1,3 +1,7 @@
1
1
  // src/wire.ts
2
- var e = 0, t = 1, n = 2, r = 3, i = 4, a = 0, o = 1, s = 2, c = 3, l = 4, u = 5, d = 6, f = 7, p = 8, m = 9, h = 10, g = "webvpn-udp-port-ack", _ = 524288;
3
- export { n as TCP_OPTION_KEEPALIVE, e as TCP_OPTION_NODELAY, i as TCP_OPTION_RECV_BUFFER_SIZE, r as TCP_OPTION_SEND_BUFFER_SIZE, t as TCP_OPTION_TTL, u as UDP_OPTION_ADD_MEMBERSHIP_V4, f as UDP_OPTION_ADD_MEMBERSHIP_V6, a as UDP_OPTION_BROADCAST, d as UDP_OPTION_DROP_MEMBERSHIP_V4, p as UDP_OPTION_DROP_MEMBERSHIP_V6, c as UDP_OPTION_MULTICAST_LOOP_V4, l as UDP_OPTION_MULTICAST_LOOP_V6, s as UDP_OPTION_MULTICAST_TTL_V4, h as UDP_OPTION_RECV_BUFFER_SIZE, m as UDP_OPTION_SEND_BUFFER_SIZE, o as UDP_OPTION_TTL, _ as UDP_PORT_ACK_INTERVAL_BYTES, g as UDP_PORT_ACK_TYPE };
2
+ var e = 0, t = 1, n = 2, r = 3, i = 4, a = 0, o = 1, s = 2, c = 3, l = 4, u = 5, d = 6, f = 7, p = 8, m = 9, h = 10, g = "webvpn-udp-port-ack", _ = 524288, v = "read ECONNRESET", y = () => Object.assign(/* @__PURE__ */ Error(v), {
3
+ code: "ECONNRESET",
4
+ errno: -104,
5
+ syscall: "read"
6
+ });
7
+ export { v as SITE_RESET_MESSAGE, n as TCP_OPTION_KEEPALIVE, e as TCP_OPTION_NODELAY, i as TCP_OPTION_RECV_BUFFER_SIZE, r as TCP_OPTION_SEND_BUFFER_SIZE, t as TCP_OPTION_TTL, u as UDP_OPTION_ADD_MEMBERSHIP_V4, f as UDP_OPTION_ADD_MEMBERSHIP_V6, a as UDP_OPTION_BROADCAST, d as UDP_OPTION_DROP_MEMBERSHIP_V4, p as UDP_OPTION_DROP_MEMBERSHIP_V6, c as UDP_OPTION_MULTICAST_LOOP_V4, l as UDP_OPTION_MULTICAST_LOOP_V6, s as UDP_OPTION_MULTICAST_TTL_V4, h as UDP_OPTION_RECV_BUFFER_SIZE, m as UDP_OPTION_SEND_BUFFER_SIZE, o as UDP_OPTION_TTL, _ as UDP_PORT_ACK_INTERVAL_BYTES, g as UDP_PORT_ACK_TYPE, y as siteResetError };
package/api-oE2v5tpj.cjs DELETED
@@ -1,3 +0,0 @@
1
- const e=require("./broker-frame-BKHtDSjv.cjs");let t=require("osra");var n=1e4,r=16,i=e=>{let t;try{t=e.contentWindow}catch{return!0}if(!t)return!0;try{let e=t.location.href;return e!==``&&e!==`about:blank`}catch{return!0}},a=(e,t=n)=>new Promise(n=>{if(i(e))return n();let a=()=>{clearInterval(o),clearTimeout(s),e.removeEventListener(`load`,a),n()},o=setInterval(()=>{i(e)&&a()},r),s=setTimeout(a,t);e.addEventListener(`load`,a)}),o=5e3,s=9e4,c=(e,t,r)=>{let a=1,c,l=e.ownerDocument.defaultView,u=()=>{clearTimeout(c),l?.removeEventListener(`message`,m),e.removeEventListener(`load`,p)},d=()=>{if(e.isConnected){if(a>=4)return u(),console.error(`FKN @fkn/lib: ${t} did not load in ${a} tries; reload the page`);a+=1,e.contentWindow?.location.replace(t),f(s)}},f=e=>{clearTimeout(c),c=setTimeout(d,e)},p=()=>f(o),m=t=>{t.source===e.contentWindow&&t.origin===r&&u()};if(l?.addEventListener(`message`,m),e.addEventListener(`load`,p),i(e))return f(o);c=setTimeout(()=>i(e)?f(8e4):d(),n)},l=32,u=8,d=120,f=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),p=typeof CSS<`u`&&CSS.supports(`clip-path`,`polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)`),m=`light dark`,h=e=>{let t=e.style;t.setProperty(`display`,`block`,`important`),t.setProperty(`position`,`fixed`,`important`),t.setProperty(`top`,`0`,`important`),t.setProperty(`left`,`0`,`important`),t.setProperty(`width`,`100%`,`important`),t.setProperty(`height`,`100%`,`important`),t.setProperty(`border`,`none`,`important`),t.setProperty(`padding`,`0`,`important`),t.setProperty(`box-sizing`,`border-box`,`important`),t.setProperty(`clip-path`,`inset(100%)`,`important`),t.setProperty(`background`,`transparent`),t.setProperty(`color-scheme`,m),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},g=({x:e,y:t,width:n,height:r,radius:i})=>{if(!i)return`M${e} ${t}h${n}v${r}h${-n}Z`;let a=Math.min(n,r)/2,[o,s,c,l]=i.map(e=>Math.max(0,Math.min(e,a)));return`M${e+o} ${t}h${n-o-s}a${s} ${s} 0 0 1 ${s} ${s}v${r-s-c}a${c} ${c} 0 0 1 ${-c} ${c}h${-(n-c-l)}a${l} ${l} 0 0 1 ${-l} ${-l}v${-(r-l-o)}a${o} ${o} 0 0 1 ${o} ${-o}Z`},ee=()=>f&&p,_=({x:e,y:t,width:n,height:r})=>[[e,t],[e+n,t],[e+n,t+r],[e,t+r],[e,t]],te=e=>{let t=e[0];if(!t)return[];let n=_(t)[0],r=[];return e.forEach((t,i)=>{r.push(..._(t)),i>0&&i<e.length-1&&r.push(n)}),r},ne=e=>`polygon(nonzero, ${te(e).map(([e,t])=>`${e}px ${t}px`).join(`, `)})`,re=({x:e,y:t,width:n,height:r,radius:i},a)=>{let o=`${t}px ${a.width-e-n}px ${a.height-t-r}px ${e}px`;return i?`inset(${o} round ${i.map(e=>`${e}px`).join(` `)})`:`inset(${o})`},ie=(e,t,n)=>{if(t)return`none`;if(e.length===0)return`inset(100%)`;let r=e.length===1?e[0]:void 0;return r?re(r,n):p&&e.length<=5&&!e.some(e=>e.radius)?ne(e):`path('${e.map(g).join(``)}')`},ae=e=>{if(e.length<2)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:Math.max(...e.map(e=>e.x+e.width))-t,height:Math.max(...e.map(e=>e.y+e.height))-n}},oe=(e,t,n)=>t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height,se=16,v=(e,t,n)=>t===1?e*se:t===2?e*n:e,y=(e,t,n,r,i)=>{let a=t?r:0,o=n?i:0;return a||o?{target:e,left:a,top:o}:null},ce=(e,t,n)=>{let r=document.documentElement,i=getComputedStyle(r),a=i.overflowX===`visible`&&i.overflowY===`visible`&&document.body?document.body:r;for(let r=e;r&&r!==a;r=r.parentElement){let e=getComputedStyle(r),i=/auto|scroll/.test(e.overflowX)&&r.scrollWidth>r.clientWidth,a=/auto|scroll/.test(e.overflowY)&&r.scrollHeight>r.clientHeight,o=y(r,i,a,t,n);if(o)return o}let o=document.scrollingElement,s=a===r?i:getComputedStyle(a);return o&&y(o,!/hidden|clip/.test(s.overflowX),!/hidden|clip/.test(s.overflowY),t,n)},b=null,x=null,S=e=>({width:e.offsetWidth||window.innerWidth,height:e.offsetHeight||window.innerHeight}),C=e=>{if(!x||!b||!oe(x,e.clientX,e.clientY))return;let t=document.fullscreenElement;if(t&&!t.contains(b))return;let n=document.elementFromPoint(e.clientX,e.clientY);if(!n||n===b)return;let r=n.closest(`:is(:modal, :popover-open)`);if(r&&!r.contains(b))return;let i=ce(n,v(e.deltaX,e.deltaMode,window.innerWidth),v(e.deltaY,e.deltaMode,window.innerHeight));i&&(i.target.scrollBy({left:i.left,top:i.top,behavior:`instant`}),e.cancelable&&e.preventDefault())},le=e=>{let t=x!==null;x=e,t!==(e!==null)&&(e?window.addEventListener(`wheel`,C,{capture:!0,passive:!1}):window.removeEventListener(`wheel`,C,{capture:!0}))},w=0,ue=e=>{if(e===w)return;w=e;let t=document.documentElement.style;e>0?(t.setProperty(`margin-top`,`${e}px`,`important`),t.setProperty(`--fkn-inset-top`,`${e}px`)):(t.removeProperty(`margin-top`),t.removeProperty(`--fkn-inset-top`))},T=(e,t)=>{t?(e.removeAttribute(`tabindex`),e.removeAttribute(`aria-hidden`)):(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`aria-hidden`,`true`))},E=(e,{modal:t,rects:n,inset:r},i)=>{if(ue(r),!f){let r=t||n.length>0;T(e,r),e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let a=ie(n,t,i),o=a===`none`||CSS.supports(`clip-path`,a)?a:`inset(100%)`;e.style.setProperty(`clip-path`,o,`important`),T(e,o!==`inset(100%)`),le(t||o!==a?null:ae(n))},de=e=>{if(typeof e!=`object`||!e)return 0;let{top:t}=e;return typeof t!=`number`||!Number.isFinite(t)||t<=0?0:Math.min(Math.round(t),d)},fe=e=>{if(Array.isArray(e)&&e.length===4&&e.every(e=>typeof e==`number`&&Number.isFinite(e)&&e>=0))return e.some(e=>e>0)?e:void 0},pe=(e,t)=>{if(typeof e!=`object`||!e)return null;let{x:n,y:r,width:i,height:a}=e;if(![n,r,i,a].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;let o=t.width,s=t.height,c=Math.max(0,Math.min(Math.round(n),o)),l=Math.max(0,Math.min(Math.round(r),s)),u=Math.max(c,Math.min(Math.round(n+i),o)),d=Math.max(l,Math.min(Math.round(r+a),s)),f=fe(e.radius);return{x:c,y:l,width:u-c,height:d-l,...f?{radius:f}:{}}},D={"not-rendered":`this page is not painting it at all, so it or an ancestor is display:none, or the frame was moved out of the layout`,clipped:`it is clipped away or positioned outside the viewport`,"not-shown":`it is rendered but would not be seen, so either something is drawn over it, or it or an ancestor has opacity below 1, visibility:hidden, or a filter`},me=e=>Array.isArray(e)?e.slice(0,u).flatMap(e=>{if(typeof e!=`object`||!e)return[];let{kind:t,cause:n,level:r}=e;return typeof t!=`string`||t.length>40||typeof n!=`string`||!(n in D)||r!==`full`&&r!==`liveness`?[]:[{kind:t,cause:n,level:r}]}):[],O=new Set,he=e=>{for(let{kind:t,cause:n,level:r}of e)O.has(t)||(O.add(t),console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${D[n]}. Nobody using this page can see or answer it.
2
- @fkn/lib draws its UI inside <iframe title="FKN"> and sets display, position, top, left, width, height, border, padding, box-sizing, clip-path and z-index on that element. Leave those as they are, then check for an ancestor with opacity, visibility, display or a clipping transform, and for an element stacked above it.`+(r===`liveness`?`
3
- This browser reports limited detail, so the cause above is a best guess.`:``)))},k=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=e,r=(Array.isArray(n.rects)?n.rects.slice(0,l):[]).map(e=>pe(e,t)).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:n.modal===!0,rects:r,hidden:me(n.hidden),inset:de(n.inset)}},ge=()=>b!==null,A=null,j=null,_e=()=>{if(!b||A===null)return;let e=S(b),t=k(A,e);t&&E(b,t,e)},ve=e=>{typeof ResizeObserver<`u`&&(j??=new ResizeObserver(_e),j.disconnect(),j.observe(e))},ye=e=>{h(e),E(e,{modal:!1,rects:[],hidden:[],inset:0},S(e)),b=e,ve(e)},be=e=>{if(!b)return;let t=S(b),n=k(e,t);n&&(A=e,E(b,n,t),he(n.hidden))},M=`https://fkn.app`,N=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,P=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,F=e.n(P),xe=`fkn-api-port`,Se=`fkn-api-port-ack`,Ce=2e3,we=()=>{if(!N||typeof window>`u`||window.parent===window)return Promise.resolve(void 0);let e;try{e=window.parent}catch{return Promise.resolve(void 0)}let t=new MessageChannel;return new Promise(n=>{let r=e=>{if(clearTimeout(a),t.port1.removeEventListener(`message`,i),!e)try{t.port1.close()}catch{}n(e)},i=e=>{e.data?.type===Se&&r(t.port1)},a=setTimeout(()=>r(void 0),Ce);t.port1.addEventListener(`message`,i),t.port1.start();try{e.postMessage({type:xe},M,[t.port2])}catch{r(void 0)}})},I,Te=()=>{if(I||!N)return I;let t=N.querySelector(`iframe[src="${F}"]`);if(t)I=t;else{let t=N.createElement(`iframe`);t.setAttribute(`allow`,e.i(P)),t.src=F,N.body.appendChild(t),I=t}return c(I,F,M),ye(I),I},L=(async()=>{if(!N)return;let e=await we();if(e)return{receive:e,emit:e};let t=Te();if(t&&(await a(t),t.contentWindow))return{receive:window,emit:(e,n)=>t.contentWindow?.postMessage(e,M,n)}})(),Ee=(e,{boundRetired:t=e=>e}={})=>{let n,r=0,i=!1,a=()=>{},o=()=>new Promise(e=>{a=e}),s=o(),c=s,l=new Set,u=new Set,d=0,f=0,p=()=>{let e=[...u];u.clear();let t=Error(`FKN: the broker was replaced while this call was pending; retry it`);for(let n of e)try{n(t)}catch{}};(async()=>{for await(let t of e){let e=++r;n={remote:t,epoch:e};let i=a;s=o(),i(t),p();for(let n of[...l])try{n(t,e)}catch{}}})().catch(()=>{});let m=async(e,r)=>{let a=n?.remote??await(i?t(s):s);for(let t of e.slice(0,-1))a=a[t];let o=a[e[e.length-1]??``];d=Date.now(),f+=1;let c=()=>{},l=new Promise((e,t)=>{c=t});u.add(c);try{return await Promise.race([Promise.resolve(o.apply(a,r)),l])}finally{--f,u.delete(c),d=Date.now()}},h=new Map,g=e=>{let t=e.join(`\0`),r=h.get(t);if(r)return r;let i=new Proxy(function(){},{get:(t,r)=>{if(typeof r!=`string`||r===`then`)return;let i=n;if(i){let t=i.remote;for(let n of e)t=t?.[n];if(t?.[r]===void 0)return}return g([...e,r])},apply:(t,n,r)=>m(e,r)});return h.set(t,i),i};return{facade:g([]),first:c.then(()=>{}),current:()=>n,onEpoch:e=>{if(l.add(e),n)try{e(n.remote,n.epoch)}catch{}return()=>{l.delete(e)}},lastCall:()=>d,inFlight:()=>f,routable:()=>n?Promise.resolve():s.then(()=>{}),retire:()=>{i=!0,n=void 0,p()}}},R=!1,z=new Set,B=()=>R,De=()=>{if(!R){R=!0;for(let e of[...z])try{e()}catch{}z.clear()}},V=e=>{R?e():z.add(e)},Oe=typeof window<`u`||typeof self<`u`,H=async()=>{if(typeof window<`u`)return L;if(typeof self<`u`)return{receive:self,emit:self}},U=`fkn-api`,ke=`fkn-api-window`,Ae={async*[Symbol.asyncIterator](){let e=await H();if(!e)await new Promise(()=>{});else{if(!B()){let n=new AbortController;V(()=>n.abort());for await(let r of(0,t.expose)({},{key:U,transport:e,unregisterSignal:n.signal})){if(n.signal.aborted)break;yield r}}yield*(0,t.expose)({},{key:ke,transport:e})}}},W=!1,G=H().then(e=>new Promise(n=>{if(!e)return;let{receive:r}=e,i=e=>{(0,t.checkOsraMessageKey)(e.data,U)&&(r.removeEventListener(`message`,i),W=!0,n())};r.addEventListener(`message`,i)})),K=Ee(Ae,{boundRetired:e=>Promise.race([e,G.then(()=>Q(e,()=>new Z))])});V(()=>K.retire());var q=Promise.race([K.first,new Promise(e=>V(e))]).then(()=>K.facade),J=8e3,je=1e3,Y=!1,X=class extends Error{constructor(e,t){super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`),this.name=`BrokerUnreachableError`}},Z=class extends Error{constructor(){super(`FKN @fkn/lib: this page relays its FKN channel to a worker, and the FKN page it reached predates a channel of the page's own; reload`),this.name=`OwnChannelUnavailableError`}},Q=(e,t)=>{let n=Y?je:J;return Promise.race([e,new Promise((e,r)=>setTimeout(()=>{Y=!0,r(t(n))},n))])},Me=e=>B()?Q(K.routable().then(()=>K.facade),t=>W?new Z:new X(e,t)):Q(q,t=>new X(e,t));V(()=>{G.then(()=>{let e=setTimeout(()=>console.error(new Z),J);K.routable().then(()=>clearTimeout(e))})});var $=K.onEpoch,Ne=K.current,Pe=K.lastCall,Fe=K.inFlight;$(e=>{ge()&&e.overlay.setHost(be,{exactClips:ee(),colorScheme:m}).catch(()=>{})}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return $}});
package/net-i4BzwpoN.cjs DELETED
@@ -1 +0,0 @@
1
- const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-oE2v5tpj.cjs"),n=require("./busy-BXbVH595.cjs"),r=require("./relay-choice-JC_JJY_M.cjs"),i=require("./utils-BpHmMkIR.cjs");require("./wire.cjs");let a=require("stream"),o=require("events");var s=e.t({Server:()=>l,Socket:()=>c,_default:()=>p,connect:()=>u,createConnection:()=>d,createServer:()=>f,default:()=>p,isIP:()=>i.t,isIPv4:()=>i.n,isIPv6:()=>i.r}),c=class extends a.Stream.Duplex{_localAddress;_remoteAddress;_webVPNTcpSocketPromise;_relay;constructor(e){if(e?.fd!==void 0)throw Error(`FKN WebVPN does not support file descriptors`);super({...e,allowHalfOpen:!!e?.allowHalfOpen,autoDestroy:!0}),e?.connection&&this.__webvpn_tcp_socket_init__(e.connection)}_busyRelease;__webvpn_tcp_socket_init__(e,t){return this._busyRelease??=n.t(`tcp socket`),t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort},this._remoteAddress={address:t.remoteAddress,family:t.remoteFamily,port:t.remotePort},this._relay=t.relay,this._connected=!0),this._webVPNTcpSocketPromise=e.then(e=>{let t=e.dataReadableStream.getReader(),n=e.dataWritableStream.getWriter();return this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},this._remoteAddress={address:e.remoteAddress,family:e.remoteFamily,port:e.remotePort},this._relay=e.relay,{...e,reader:t,writer:n}}).catch(e=>{this.destroyed||this.destroy(e)}),this._webVPNTcpSocketPromise.then(e=>{e&&!this.destroyed&&(this._connected=!0,this.emit(`connect`),this.isPaused()||this.read(0))}),this._webVPNTcpSocketPromise}_connected=!1;_read(e){if(!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);this._webVPNTcpSocketPromise.then(e=>{e?e.reader.read().then(({value:e,done:t})=>{t?(this.push(null),this.read(0)):(this._restartTimeoutTimer(),this.push(e))}).catch(e=>{this.destroy(e)}):this.push(null)})}_write(e,t,n){this._webVPNTcpSocketPromise?this._webVPNTcpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not connected`);await t.writer.ready,await t.writer.write(e)}).then(()=>{this.destroyed||(this._restartTimeoutTimer(),n())},e=>this._fail(e)):n(Error(`Socket not connected`))}_fail(e){if(!this.destroyed){for(let t of this._pendingCallbacks)t(e);this.destroy(e)}}connect(...e){let n=i.o(...e),{relay:a}=n,o=this.__webvpn_tcp_socket_init__(t.s(`an outbound tcp socket`).then(e=>(a!==void 0&&r.t(e,`net.connect`),e.cloud.webvpn.tcpSocket({remoteAddress:n.host??`localhost`,remotePort:n.port,relay:a}))));return n.callback&&o.then(e=>{e&&!this.destroyed&&n.callback.call(this)}),this}_final(e){this._webVPNTcpSocketPromise?this._webVPNTcpSocketPromise.then(async e=>{e&&await e.writer.close()}).then(()=>{this.destroyed||e()},e=>this._fail(e)):e()}_destroyError;_destroy(e,t){this._destroyError=e??void 0,this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._busyRelease?.(),this._webVPNTcpSocketPromise?this._webVPNTcpSocketPromise.then(async t=>{t&&(this._resetRequested?await t.resetAndDestroy():!e&&this._writableState.finished&&this._readableState.ended?await t.end():await t.destroy())}).then(()=>t(e),()=>t(e)):t(e)}destroy(e,t){return this.destroyed&&!t?this:(Object.assign(this,{readable:!1,writable:!1}),Reflect.apply(super.destroy,this,[e,t]))}emit(e,...t){if(e===`finish`)for(let e of this._endCallbacks.splice(0))e();if(e!==`close`||!this.destroyed)return super.emit(e,...t);let n=this._destroyError!==void 0;if(!this._connected){let e=super.emit(`close`,n);return this._settlePending(Object.assign(Error(`Socket closed before the connection was established`),{code:`ERR_SOCKET_CLOSED_BEFORE_CONNECTION`})),e}return this._settlePending(Object.assign(Error(`write ECANCELED`),{code:`ECANCELED`,syscall:`write`})),super.emit(`close`,n)}_settlePending(e){let t=e;for(let e of this._pendingCallbacks)e(t),t=this._destroyError??t}destroySoon(){this._writableState.finished?this.destroy():(this.once(`finish`,()=>this.destroy()),this.end())}_resetRequested=!1;resetAndDestroy(){return this._resetRequested=!0,this.destroy(),this}_timeoutMs;_timeoutTimer;_restartTimeoutTimer(){this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._timeoutMs&&!this.destroyed&&(this._timeoutTimer=setTimeout(()=>this.emit(`timeout`),this._timeoutMs))}setTimeout(e,t){return t&&this.on(`timeout`,t),this._timeoutMs=e,this._restartTimeoutTimer(),this}setNoDelay(e){let t=e??!0;return this._setTcpOption({type:0,value:t}),this}setKeepAlive(e,t){let n=e??!1,r=t!==void 0&&t>0?Math.max(1,Math.round(t/1e3)):0;return this._setTcpOption({type:2,enabled:n,initialDelaySeconds:r}),this}setSendBufferSize(e){return this._setTcpOption({type:3,value:e}),this}setRecvBufferSize(e){return this._setTcpOption({type:4,value:e}),this}_typeOfService;getTypeOfService(){return this._typeOfService??0}setTypeOfService(e){return this._typeOfService=e,this}_setTcpOption(e){this._webVPNTcpSocketPromise?this._webVPNTcpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.destroyed||this.emit(`error`,e)}}):this.emit(`error`,Error(`Cannot set socket option before connect`))}_pendingCallbacks=new Set;_settleOnClose(e){let t=n=>{this._pendingCallbacks.delete(t)&&e(n)};return this._pendingCallbacks.add(t),t}end(e,t,n){if(typeof t==`function`&&(n=t,t=void 0),typeof e==`function`&&(n=e,e=void 0),e==null&&this._writableState.finished){let e=Object.assign(Error(`Cannot call end after a stream was finished`),{code:`ERR_STREAM_ALREADY_FINISHED`});return n&&queueMicrotask(()=>n(e)),this}return this.destroyed?(e!=null&&this.write(e,t,n),this):(n&&this._endCallbacks.push(this._settleOnClose(n)),Reflect.apply(super.end,this,[e,t]))}_endCallbacks=[];write(e,t,n){if(typeof t==`function`&&(n=t,t=void 0),this.destroyed){let e=Object.assign(Error(`Cannot call write after a stream was destroyed`),{code:`ERR_STREAM_DESTROYED`});return n&&queueMicrotask(()=>n(e)),!1}if(!n)return t?super.write(e,t):super.write(e);let r=this._settleOnClose(n);return t?super.write(e,t,r):super.write(e,r)}address(){return this._localAddress??{}}unref(){return this}ref(){return this}autoSelectFamilyAttemptedAddresses;bufferSize;bytesRead;bytesWritten;connecting;pending;get localAddress(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.address}get localPort(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.port}get localFamily(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.family}readyState;get remoteAddress(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.address}get remotePort(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.port}get remoteFamily(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.family}timeout},l=class extends o.EventEmitter{_localAddress;_webVPNTcpSocketListenerPromise;_relayChoice;_allowHalfOpen;_relay;constructor(e,t){super(e),this._relayChoice=e?.relay,this._allowHalfOpen=!!e?.allowHalfOpen,t&&this.on(`connection`,t),e?.connection&&this.__webvpn_tcp_socket_listener_init__(e.connection)}_busyRelease;__webvpn_tcp_socket_listener_init__(e){return this._busyRelease??=n.t(`tcp server`),this._webVPNTcpSocketListenerPromise=e.then(e=>(this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},this._relay=e.relay,e)).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketListenerPromise.then(e=>{e?this.emit(`listening`):this._busyRelease?.()}),this._webVPNTcpSocketListenerPromise}listen(...e){let n=i.o(...e);this._closeEmitted=!1;let a=e=>{let t=new c({allowHalfOpen:this._allowHalfOpen});t.__webvpn_tcp_socket_init__(Promise.resolve(e),e),this.emit(`connection`,t)},o=e=>{this._localAddress=void 0;try{e&&this.listenerCount(`error`)>0&&this.emit(`error`,e)}finally{this._emitClose()}},s=this._relayChoice,l=e=>t.s(`a tcp listener`).then(t=>(s!==void 0&&r.t(t,`net.createServer`),t.cloud.webvpn.tcpSocketListener({localAddress:e,localPort:n.port,onConnection:a,onClose:o,relay:s}))),u=n.host?l(n.host):l(`::`).catch(()=>l(`0.0.0.0`)),d=this.__webvpn_tcp_socket_listener_init__(u);return n.callback&&d.then(e=>{e&&n.callback.call(this)}),this}_closeEmitted=!1;_emitClose(){this._closeEmitted||(this._closeEmitted=!0,this._busyRelease?.(),this.emit(`close`))}close(e){return this._webVPNTcpSocketListenerPromise&&this._webVPNTcpSocketListenerPromise.then(async t=>{if(t)try{await t.close(),this._localAddress=void 0,this._emitClose(),e&&e()}catch(t){this._localAddress=void 0,this._emitClose(),e&&e(t)}}),this}address(){return this._localAddress??null}getConnections(e){throw Error(`Method not implemented.`)}ref(){return this}unref(){return this}maxConnections;connections;listening;async[Symbol.asyncDispose](){}},u=(e,t)=>new c({allowHalfOpen:e?.allowHalfOpen}).connect(e,t),d=u,f=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new l(e);return t&&n.on(`connection`,t),n},p={Socket:c,Server:l,connect:u,createConnection:d,createServer:f,isIP:i.t,isIPv4:i.n,isIPv6:i.r};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});