@fkn/lib 0.9.23 → 0.9.25

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 (121) hide show
  1. package/account.cjs +1 -1
  2. package/account.d.ts +7 -3
  3. package/account.js +7 -7
  4. package/api-BCJO3EWi.cjs +3 -0
  5. package/api-CesI0aMl.d.ts +677 -0
  6. package/{api-Jq4OSTp1.js → api-DLvscoll.js} +99 -96
  7. package/api.cjs +1 -0
  8. package/api.d.ts +3 -0
  9. package/api.js +2 -0
  10. package/attach-policy.cjs +1 -0
  11. package/attach-policy.d.ts +35 -0
  12. package/attach-policy.js +43 -0
  13. package/{busy-Bp1E3JPT.js → busy-B189uX--.js} +1 -1
  14. package/cloud/dgram.cjs +1 -1
  15. package/cloud/dgram.js +2 -2
  16. package/cloud/dns.d.ts +1 -1
  17. package/cloud/fetch.cjs +1 -1
  18. package/cloud/fetch.d.ts +1 -1
  19. package/cloud/fetch.js +1 -1
  20. package/cloud/fs/promises.d.ts +7 -6
  21. package/cloud/fs/promises.js +1 -1
  22. package/cloud/fs.cjs +1 -1
  23. package/cloud/fs.d.ts +3 -3
  24. package/cloud/fs.js +10 -9
  25. package/cloud/net.cjs +1 -1
  26. package/cloud/net.d.ts +1 -1
  27. package/cloud/net.js +3 -3
  28. package/cloud-B2ZG-0MF.cjs +1 -0
  29. package/cloud-B7pI3pp1.d.ts +37 -0
  30. package/{cloud-7rfQ2BRH.js → cloud-DolBoNvR.js} +59 -97
  31. package/cloud.cjs +1 -1
  32. package/cloud.d.ts +4 -4
  33. package/cloud.js +4 -4
  34. package/{connect-button-Ds9KpXHe.js → connect-button-CN4ZJwT6.js} +1 -1
  35. package/{connect-button-D8KXSL6s.d.ts → connect-button-DdoEikEd.d.ts} +1 -1
  36. package/contract-D6ksmIm6.d.ts +394 -0
  37. package/contract.cjs +0 -0
  38. package/contract.d.ts +3 -0
  39. package/contract.js +0 -0
  40. package/desktop.js +1 -1
  41. package/dgram.cjs +1 -1
  42. package/dgram.d.ts +6 -47
  43. package/dgram.js +406 -2
  44. package/dns.cjs +1 -1
  45. package/dns.d.ts +1 -3
  46. package/dns.js +2 -2
  47. package/extension-CJUeVRXf.d.ts +361 -0
  48. package/extension-DBazc3ff.cjs +1 -0
  49. package/extension-Dw9gzvei.js +84 -0
  50. package/extension.cjs +1 -1
  51. package/extension.d.ts +3 -3
  52. package/extension.js +3 -3
  53. package/fs/promises.cjs +1 -1
  54. package/fs/promises.d.ts +8 -9
  55. package/fs/promises.js +2 -2
  56. package/fs-DYP7utdw.cjs +1 -0
  57. package/{fs-CUmugp10.d.ts → fs-DlGE0ZNu.d.ts} +20 -21
  58. package/{fs-pOQSZfuf.js → fs-d2ANVBkm.js} +8 -8
  59. package/fs.cjs +1 -1
  60. package/fs.d.ts +2 -2
  61. package/fs.js +1 -1
  62. package/http.cjs +3 -3
  63. package/http.d.ts +4 -6
  64. package/http.js +8 -8
  65. package/{index-CJ0vHTcS.d.ts → index-BQgZVQl7.d.ts} +4 -7
  66. package/{index-DY8WjklJ.d.ts → index-BhO-wymH.d.ts} +15 -293
  67. package/{index-BIZeEsNu.d.ts → index-CGJTVju4.d.ts} +52 -46
  68. package/index.cjs +1 -1
  69. package/index.d.ts +12 -13
  70. package/index.js +60 -49
  71. package/lib-DLM2M3_i.cjs +53 -0
  72. package/{lib-k3lstfa4.js → lib-duLPF_WZ.js} +328 -277
  73. package/messages-DvpKMTsY.d.ts +28 -0
  74. package/messages.cjs +1 -0
  75. package/messages.d.ts +2 -0
  76. package/messages.js +4 -0
  77. package/{net-DaWv81tQ.d.ts → net-DAOcF3Eb.d.ts} +12 -16
  78. package/net.cjs +1 -1
  79. package/net.d.ts +1 -1
  80. package/net.js +318 -3
  81. package/{node-fs-BZCQUmeE.js → node-fs-C9ECR_9H.js} +2 -2
  82. package/opfs/promises.d.ts +7 -8
  83. package/opfs/promises.js +1 -1
  84. package/{opfs-BibrNGF0.js → opfs-D0goLAQW.js} +1 -1
  85. package/opfs.d.ts +24 -26
  86. package/opfs.js +3 -3
  87. package/package.json +27 -2
  88. package/packages.cjs +1 -1
  89. package/packages.d.ts +143 -2
  90. package/packages.js +15 -15
  91. package/{proxy-DmMu2_1z.d.ts → proxy-BubvP9sg.d.ts} +3 -3
  92. package/{proxy-BNdvRifw.cjs → proxy-CefKCs-i.cjs} +1 -1
  93. package/{proxy-CRbkWS4E.js → proxy-KUfE4cEQ.js} +3 -3
  94. package/react.d.ts +3 -7
  95. package/react.js +2 -2
  96. package/{storage-BNjLc1FV.js → storage-BjGr_vC4.js} +5 -5
  97. package/storage-DLB4ciMf.cjs +1 -0
  98. package/utils-BvgGdrgN.cjs +1 -0
  99. package/{utils-DVlbuXmW.js → utils-C-cAd4r4.js} +2 -3
  100. package/wire-Gbo-D74t.d.ts +91 -0
  101. package/wire.cjs +1 -0
  102. package/wire.d.ts +2 -0
  103. package/wire.js +4 -0
  104. package/api-BGYSJVvR.d.ts +0 -789
  105. package/api-C-TpWHAU.cjs +0 -3
  106. package/cloud-BqjwL5KM.cjs +0 -1
  107. package/cloud-DMTkzfcf.d.ts +0 -36
  108. package/dgram-BLN-mfgq.cjs +0 -1
  109. package/dgram-DHQcHefn.js +0 -405
  110. package/extension-B8Y0sUwC.js +0 -78
  111. package/extension-CMPZjuaV.d.ts +0 -16
  112. package/extension-CgSGjcSl.cjs +0 -1
  113. package/fs-BNnozBMU.cjs +0 -1
  114. package/lib-DbiVHPXE.cjs +0 -53
  115. package/lookup-BtwWaCZJ.d.ts +0 -7
  116. package/net-B6RHtWwe.cjs +0 -1
  117. package/net-yBkobZqK.js +0 -317
  118. package/packages-Cn8S-Hkn.d.ts +0 -217
  119. package/storage-qxXFLgTM.d.ts +0 -44
  120. package/storage-xAeRQQiz.cjs +0 -1
  121. package/utils-QfNXtEhb.cjs +0 -1
package/dgram.js CHANGED
@@ -1,2 +1,406 @@
1
- import { n as e, r as t, t as n } from "./dgram-DHQcHefn.js";
2
- export { n as Socket, e as createSocket, t as default };
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { o as t } from "./api-DLvscoll.js";
3
+ import { t as n } from "./busy-B189uX--.js";
4
+ import { l as r, n as i, o as a, s as o } from "./utils-C-cAd4r4.js";
5
+ import "./wire.js";
6
+ import { Buffer as s } from "buffer";
7
+ import { EventEmitter as c } from "events";
8
+ import { Address4 as l, Address6 as u } from "ip-address";
9
+ //#region src/webvpn/dgram.ts
10
+ var d = /* @__PURE__ */ e({
11
+ Socket: () => f,
12
+ createSocket: () => v,
13
+ default: () => y
14
+ }), f = class extends c {
15
+ _type;
16
+ _localAddress;
17
+ _remoteAddress;
18
+ _connectedLocally;
19
+ _connectGeneration = 0;
20
+ _destroyed = !1;
21
+ _busyRelease;
22
+ _webVPNUdpSocketPromise;
23
+ _dataPort;
24
+ _socketId;
25
+ _sendQueue = [];
26
+ _sendQueueBytes = 0;
27
+ _sendFlushScheduled = !1;
28
+ _peerTailCache = /* @__PURE__ */ new Map();
29
+ constructor(e) {
30
+ if (super(e), !e) throw Error("Missing options");
31
+ this._type = e.type, e.connection && this.__webvpn_udp_socket_init__(e.connection);
32
+ }
33
+ _lastRecvBufferSize = 0;
34
+ _lastSendBufferSize = 0;
35
+ _lastTtl = 64;
36
+ _lastMulticastTtl = 1;
37
+ _lastMulticastLoopback = !0;
38
+ _setUdpOption(e) {
39
+ if (!this._webVPNUdpSocketPromise) {
40
+ this.emit("error", /* @__PURE__ */ Error("Cannot set socket option before bind"));
41
+ return;
42
+ }
43
+ this._webVPNUdpSocketPromise.then(async (t) => {
44
+ if (t) try {
45
+ await t.setOption(e);
46
+ } catch (e) {
47
+ this.emit("error", e);
48
+ }
49
+ });
50
+ }
51
+ _dataPortAcks = !1;
52
+ _dataPortConsumedBytes = 0;
53
+ _dataPortAckedBytes = 0;
54
+ _ackDataPortBatch(e) {
55
+ if (!this._dataPortAcks || !this._dataPort || (this._dataPortConsumedBytes += e, this._dataPortAckedBytes !== 0 && this._dataPortConsumedBytes - this._dataPortAckedBytes < 524288)) return;
56
+ this._dataPortAckedBytes = this._dataPortConsumedBytes;
57
+ let t = {
58
+ type: i,
59
+ consumedBytes: this._dataPortConsumedBytes
60
+ };
61
+ this._dataPort.postMessage(t);
62
+ }
63
+ _onTransportClosed(e) {
64
+ 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"));
65
+ }
66
+ _onDataPortBatch(e) {
67
+ let t = new DataView(e), n = !1, r, i = 0;
68
+ for (; i + 4 <= e.byteLength;) {
69
+ let a = t.getUint32(i);
70
+ i += 4;
71
+ let o = i + a;
72
+ if (o > e.byteLength) break;
73
+ let c = i + 4, l = t.getUint8(c);
74
+ c += 1;
75
+ let u, d, f;
76
+ if (l === 2) {
77
+ if (!this._remoteAddress) {
78
+ i = o;
79
+ continue;
80
+ }
81
+ u = this._remoteAddress.address, d = this._remoteAddress.family, f = this._remoteAddress.port;
82
+ } else {
83
+ let n = new Uint8Array(e, c, l === 0 ? 4 : 16);
84
+ l === 0 ? (d = "IPv4", u = `${n[0]}.${n[1]}.${n[2]}.${n[3]}`) : (d = "IPv6", u = g(n)), c += n.byteLength, f = t.getUint16(c), c += 2;
85
+ }
86
+ let p = t.getUint32(c);
87
+ c += 4;
88
+ try {
89
+ this.emit("message", s.from(e.slice(c, c + p)), {
90
+ address: u,
91
+ family: d,
92
+ port: f,
93
+ size: p
94
+ });
95
+ } catch (e) {
96
+ n || (n = !0, r = e);
97
+ }
98
+ i = o;
99
+ }
100
+ if (n) throw r;
101
+ }
102
+ _peerTail(e, t) {
103
+ if (e === void 0 || t === void 0) return p;
104
+ let n = `${e}|${t}`, r = this._peerTailCache.get(n);
105
+ if (r) return r;
106
+ let i = l.isValid(e) ? h(e) : _(e), a = new Uint8Array(1 + i.byteLength + 2);
107
+ 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;
108
+ }
109
+ _portSend(e, t, n) {
110
+ let r = this._peerTail(t, n), i = new Uint8Array(8 + r.byteLength + 4 + e.byteLength), a = new DataView(i.buffer);
111
+ 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(() => {
112
+ this._sendFlushScheduled = !1;
113
+ let e = this._sendQueue, t = this._sendQueueBytes;
114
+ if (this._sendQueue = [], this._sendQueueBytes = 0, !e.length || !this._dataPort) return;
115
+ let n = new Uint8Array(t), r = 0;
116
+ for (let t of e) n.set(t, r), r += t.byteLength;
117
+ this._dataPort.postMessage(n.buffer, [n.buffer]);
118
+ }));
119
+ }
120
+ addMembership(e, t) {
121
+ if (l.isValid(e)) {
122
+ let n = h(e), r = t && l.isValid(t) ? h(t) : new Uint8Array([
123
+ 0,
124
+ 0,
125
+ 0,
126
+ 0
127
+ ]);
128
+ this._setUdpOption({
129
+ type: 5,
130
+ group: n,
131
+ interface: r
132
+ });
133
+ } else if (u.isValid(e)) {
134
+ let t = _(e);
135
+ this._setUdpOption({
136
+ type: 7,
137
+ group: t,
138
+ ifIndex: 0
139
+ });
140
+ } else this.emit("error", /* @__PURE__ */ Error(`Invalid multicast address: ${e}`));
141
+ }
142
+ address() {
143
+ if (!this._localAddress) throw Error("EBADF");
144
+ return this._localAddress;
145
+ }
146
+ bind(...e) {
147
+ let n = a(...e), r = this._type === "udp6" ? "::" : "0.0.0.0", i = this.__webvpn_udp_socket_init__(t("a udp socket").then((e) => e.cloud.webvpn.udpSocket({
148
+ type: this._type,
149
+ address: n.address ?? r,
150
+ port: n.port,
151
+ dataPort: !0
152
+ })));
153
+ return n.callback && i.then((e) => {
154
+ e && n.callback.call(this);
155
+ }), this;
156
+ }
157
+ __webvpn_udp_socket_init__(e, t) {
158
+ return t && (this._localAddress = {
159
+ address: t.localAddress,
160
+ family: t.localFamily,
161
+ port: t.localPort
162
+ }), this._busyRelease ??= n("udp socket"), this._webVPNUdpSocketPromise = e.then((e) => {
163
+ if (e.dataPort) this._socketId = e.socketId, this._dataPort = e.dataPort, this._dataPortAcks = e.dataPortAcks === !0, this._dataPort.onmessage = (e) => {
164
+ try {
165
+ this._onDataPortBatch(e.data);
166
+ } finally {
167
+ this._ackDataPortBatch(e.data.byteLength);
168
+ }
169
+ };
170
+ else {
171
+ let t = e.dataReadableStream.getReader();
172
+ (async () => {
173
+ for (;;) {
174
+ let { value: e, done: n } = await t.read();
175
+ if (n) return;
176
+ this.emit("message", s.from(e.data), {
177
+ address: e.address,
178
+ family: e.family,
179
+ port: e.port,
180
+ size: e.size
181
+ });
182
+ }
183
+ })().catch((e) => this._onTransportClosed(e instanceof Error ? e.message : void 0));
184
+ }
185
+ return e.closed?.then((e) => this._onTransportClosed(e?.reason)).catch(() => {}), this._localAddress = {
186
+ address: e.localAddress,
187
+ family: e.localFamily,
188
+ port: e.localPort
189
+ }, e;
190
+ }).catch((e) => {
191
+ this.emit("error", e);
192
+ }), this._webVPNUdpSocketPromise.then((e) => {
193
+ if (!e) {
194
+ this._busyRelease?.();
195
+ return;
196
+ }
197
+ this.emit("listening");
198
+ }), this._webVPNUdpSocketPromise;
199
+ }
200
+ close(e) {
201
+ if (!this._webVPNUdpSocketPromise) throw Error("Socket not bound");
202
+ return this._webVPNUdpSocketPromise.then(async (t) => {
203
+ if (!t) throw Error("Socket not bound");
204
+ let n = this._destroyed;
205
+ this._destroyed = !0, this._busyRelease?.(), this._dataPort?.close(), this._dataPort = void 0;
206
+ try {
207
+ await t.close();
208
+ } finally {
209
+ try {
210
+ e && e();
211
+ } finally {
212
+ n || this.emit("close");
213
+ }
214
+ }
215
+ }).catch(() => {}), this;
216
+ }
217
+ connect(...e) {
218
+ if (!this._webVPNUdpSocketPromise) throw Error("Socket not bound");
219
+ this._webVPNUdpSocketPromise.then(async (t) => {
220
+ if (!t) throw Error("Socket not bound");
221
+ 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({
222
+ remotePort: n,
223
+ remoteAddress: i
224
+ });
225
+ this._connectedLocally = o?.local === !0, this._remoteAddress = o?.address ? {
226
+ address: o.address,
227
+ family: o.family,
228
+ port: o.port
229
+ } : {
230
+ address: i,
231
+ family: this._type === "udp6" ? "IPv6" : "IPv4",
232
+ port: n
233
+ }, this._connectGeneration += 1, a && a();
234
+ }).catch((e) => {
235
+ this.emit("error", e);
236
+ });
237
+ }
238
+ disconnect() {
239
+ if (!this._webVPNUdpSocketPromise) throw Error("Socket not bound");
240
+ if (!this._remoteAddress) throw Error("ERR_SOCKET_DGRAM_NOT_CONNECTED");
241
+ let e = this._remoteAddress, t = this._connectedLocally, n = this._connectGeneration;
242
+ this._remoteAddress = void 0, this._connectedLocally = void 0, this._webVPNUdpSocketPromise.then((e) => e?.disconnect?.()).catch((r) => {
243
+ this._connectGeneration === n && (this._remoteAddress = e, this._connectedLocally = t), this.emit("error", r);
244
+ });
245
+ }
246
+ dropMembership(e, t) {
247
+ if (l.isValid(e)) {
248
+ let n = h(e), r = t && l.isValid(t) ? h(t) : new Uint8Array([
249
+ 0,
250
+ 0,
251
+ 0,
252
+ 0
253
+ ]);
254
+ this._setUdpOption({
255
+ type: 6,
256
+ group: n,
257
+ interface: r
258
+ });
259
+ } else if (u.isValid(e)) {
260
+ let t = _(e);
261
+ this._setUdpOption({
262
+ type: 8,
263
+ group: t,
264
+ ifIndex: 0
265
+ });
266
+ } else this.emit("error", /* @__PURE__ */ Error(`Invalid multicast address: ${e}`));
267
+ }
268
+ getRecvBufferSize() {
269
+ return this._lastRecvBufferSize;
270
+ }
271
+ getSendBufferSize() {
272
+ return this._lastSendBufferSize;
273
+ }
274
+ getSendQueueSize() {
275
+ return 0;
276
+ }
277
+ getSendQueueCount() {
278
+ return 0;
279
+ }
280
+ ref() {
281
+ return this;
282
+ }
283
+ remoteAddress() {
284
+ if (!this._remoteAddress) throw Error("ERR_SOCKET_DGRAM_NOT_CONNECTED");
285
+ return {
286
+ address: this._remoteAddress.address,
287
+ family: this._remoteAddress.family,
288
+ port: this._remoteAddress.port
289
+ };
290
+ }
291
+ send(...e) {
292
+ this._webVPNUdpSocketPromise || this.bind();
293
+ let t = o(...e), n = m(t.message), r = n;
294
+ if (t.hasRange) {
295
+ let { offset: e, length: i } = t;
296
+ if (!Number.isInteger(e) || e < 0 || e > n.byteLength) throw Object.assign(/* @__PURE__ */ RangeError("\"offset\" is outside of buffer bounds"), { code: "ERR_BUFFER_OUT_OF_BOUNDS" });
297
+ if (!Number.isInteger(i) || i < 0 || i > n.byteLength - e) throw Object.assign(/* @__PURE__ */ RangeError("\"length\" is outside of buffer bounds"), { code: "ERR_BUFFER_OUT_OF_BOUNDS" });
298
+ r = n.subarray(e, e + i);
299
+ }
300
+ let i = this._type === "udp6" ? "::1" : "127.0.0.1";
301
+ if (!this._webVPNUdpSocketPromise) throw Error("Socket not bound");
302
+ this._webVPNUdpSocketPromise.then((e) => {
303
+ if (!e) throw Error("Socket not bound");
304
+ let n = t.callback, a = t.address ?? i, o = this._remoteAddress !== void 0 && t.address === void 0;
305
+ if (this._dataPort && (o || l.isValid(a) || u.isValid(a))) {
306
+ this._portSend(r, o ? void 0 : a, o ? void 0 : t.port), n?.call(this, null, r.byteLength);
307
+ return;
308
+ }
309
+ e.send({
310
+ port: t.port,
311
+ address: a,
312
+ message: r.byteOffset === 0 && r.byteLength === r.buffer.byteLength ? r.buffer : r.buffer.slice(r.byteOffset, r.byteOffset + r.byteLength)
313
+ }).then(() => n?.call(this, null, r.byteLength), (e) => n ? n.call(this, e, 0) : this.emit("error", e));
314
+ });
315
+ }
316
+ setBroadcast(e) {
317
+ this._setUdpOption({
318
+ type: 0,
319
+ value: e
320
+ });
321
+ }
322
+ setMulticastInterface(e) {}
323
+ setMulticastLoopback(e) {
324
+ return this._setUdpOption({
325
+ type: 3,
326
+ value: e
327
+ }), this._setUdpOption({
328
+ type: 4,
329
+ value: e
330
+ }), this._lastMulticastLoopback = e, e;
331
+ }
332
+ setMulticastTTL(e) {
333
+ return this._setUdpOption({
334
+ type: 2,
335
+ value: e
336
+ }), this._lastMulticastTtl = e, e;
337
+ }
338
+ setRecvBufferSize(e) {
339
+ this._setUdpOption({
340
+ type: 10,
341
+ value: e
342
+ }), this._lastRecvBufferSize = e;
343
+ }
344
+ setSendBufferSize(e) {
345
+ this._setUdpOption({
346
+ type: 9,
347
+ value: e
348
+ }), this._lastSendBufferSize = e;
349
+ }
350
+ setTTL(e) {
351
+ return this._setUdpOption({
352
+ type: 1,
353
+ value: e
354
+ }), this._lastTtl = e, e;
355
+ }
356
+ unref() {
357
+ return this;
358
+ }
359
+ addSourceSpecificMembership(e, t, n) {}
360
+ dropSourceSpecificMembership(e, t, n) {}
361
+ async [Symbol.asyncDispose]() {
362
+ await new Promise((e) => {
363
+ this.close(e);
364
+ });
365
+ }
366
+ }, p = new Uint8Array([2]), m = (e) => {
367
+ if (typeof e == "string") return r.encode(e);
368
+ if (e instanceof Uint8Array) return e;
369
+ if (ArrayBuffer.isView(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
370
+ if (Array.isArray(e)) {
371
+ let t = e.map(m), n = new Uint8Array(t.reduce((e, t) => e + t.byteLength, 0)), r = 0;
372
+ for (let e of t) n.set(e, r), r += e.byteLength;
373
+ return n;
374
+ }
375
+ return new Uint8Array(e);
376
+ }, h = (e) => {
377
+ let t = e.split(".").map((e) => parseInt(e, 10));
378
+ if (t.length !== 4 || t.some((e) => Number.isNaN(e) || e < 0 || e > 255)) throw Error(`Invalid IPv4 address: ${e}`);
379
+ return new Uint8Array(t);
380
+ }, g = (e) => {
381
+ let t = [];
382
+ for (let n = 0; n < 16; n += 2) t.push(e[n] << 8 | e[n + 1]);
383
+ let n = -1, r = 1;
384
+ for (let e = 0; e < 8;) {
385
+ if (t[e] !== 0) {
386
+ e++;
387
+ continue;
388
+ }
389
+ let i = e;
390
+ for (; i < 8 && t[i] === 0;) i++;
391
+ i - e > r && (n = e, r = i - e), e = i;
392
+ }
393
+ 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(":")}`;
394
+ }, _ = (e) => {
395
+ let t = new u(e).getBitsBase16(0, 128).match(/.{2}/g);
396
+ if (!t || t.length !== 16) throw Error(`Invalid IPv6 address: ${e}`);
397
+ return new Uint8Array(t.map((e) => parseInt(e, 16)));
398
+ }, v = (e, t) => {
399
+ let n = new f(typeof e == "string" ? { type: e } : e);
400
+ return t && n.on("message", t), n;
401
+ }, y = {
402
+ Socket: f,
403
+ createSocket: v
404
+ };
405
+ //#endregion
406
+ export { f as Socket, v as createSocket, y as default, d as t };
package/dns.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-C-TpWHAU.cjs");var n=e.t({lookup:()=>r}),r=(e,n)=>t.t.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-BCJO3EWi.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}});
package/dns.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- import { t as AddressLookupResult } from "./lookup-BtwWaCZJ.js";
2
-
3
- //#region src/lib/dns.d.ts
1
+ import { n as AddressLookupResult } from "./contract-D6ksmIm6.js";
4
2
  declare namespace dns_d_exports {
5
3
  export { AddressLookupResult, lookup };
6
4
  }
package/dns.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { t } from "./api-Jq4OSTp1.js";
3
- //#region src/lib/dns.ts
2
+ import { a as t } from "./api-DLvscoll.js";
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
6
6
  export { r as lookup, n as t };