@ikonai/sdk 1.10.0 → 1.11.2
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.
- package/app-messaging.d.ts +3 -2
- package/app-messaging.d.ts.map +1 -0
- package/assets/audio-playback-worker-BA5LbdyM.js +1 -0
- package/assets/protocol-worker-Byc-OmNW.js +3 -0
- package/assets/video-capture-worker-DRYxkwR0.js +1 -0
- package/assets/video-playback-worker-v179IJ-C.js +1 -0
- package/assets/viseme-worker-CmvzHAbf.js +1 -0
- package/audio-constants-0i9B4zLJ.js +4 -0
- package/backend/account-functions.d.ts +22 -0
- package/backend/account-functions.d.ts.map +1 -0
- package/backend/user-account.d.ts +58 -0
- package/backend/user-account.d.ts.map +1 -0
- package/capabilities-ljRyAKpA.js +248 -0
- package/capture/capture-functions.d.ts +34 -0
- package/capture/capture-functions.d.ts.map +1 -0
- package/capture/view-capture.d.ts +35 -0
- package/capture/view-capture.d.ts.map +1 -0
- package/channel/channel-manager.d.ts +3 -2
- package/channel/channel-manager.d.ts.map +1 -0
- package/channel/channel.d.ts +6 -2
- package/channel/channel.d.ts.map +1 -0
- package/channel/index.d.ts +1 -0
- package/channel/index.d.ts.map +1 -0
- package/channel-manager-ehgy3BJp.js +878 -0
- package/client/connection-state.d.ts +1 -0
- package/client/connection-state.d.ts.map +1 -0
- package/client/endpoint-selector.d.ts +2 -1
- package/client/endpoint-selector.d.ts.map +1 -0
- package/client/ikon-client-config.d.ts +14 -1
- package/client/ikon-client-config.d.ts.map +1 -0
- package/client/ikon-client.d.ts +135 -6
- package/client/ikon-client.d.ts.map +1 -0
- package/connection/authenticator.d.ts +6 -1
- package/connection/authenticator.d.ts.map +1 -0
- package/connection/urls.d.ts +9 -0
- package/connection/urls.d.ts.map +1 -0
- package/consent/consent-api.d.ts +61 -0
- package/consent/consent-api.d.ts.map +1 -0
- package/dist-BrkppKKs.js +801 -0
- package/errors/index.d.ts +11 -0
- package/errors/index.d.ts.map +1 -0
- package/feedback/feedback-api.d.ts +63 -0
- package/feedback/feedback-api.d.ts.map +1 -0
- package/functions/browser-functions.d.ts +2 -1
- package/functions/browser-functions.d.ts.map +1 -0
- package/functions/download-functions.d.ts +12 -0
- package/functions/download-functions.d.ts.map +1 -0
- package/functions/function-registry.d.ts +2 -1
- package/functions/function-registry.d.ts.map +1 -0
- package/functions/index.d.ts +2 -1
- package/functions/index.d.ts.map +1 -0
- package/functions/media-capture-functions.d.ts +1 -0
- package/functions/media-capture-functions.d.ts.map +1 -0
- package/functions/sound-functions.d.ts +3 -1
- package/functions/sound-functions.d.ts.map +1 -0
- package/functions/type-conversion.d.ts +1 -0
- package/functions/type-conversion.d.ts.map +1 -0
- package/functions/types.d.ts +2 -1
- package/functions/types.d.ts.map +1 -0
- package/ikon-media-BQjL59S_.js +2074 -0
- package/ikon-media-capture-4aEsbGgC.js +1422 -0
- package/index.d.ts +23 -10
- package/index.d.ts.map +1 -0
- package/index.js +6774 -10104
- package/log-type-DewKVFaU.js +832 -0
- package/logger-gjegmH6K.js +80 -0
- package/login/index.d.ts +1 -0
- package/login/index.d.ts.map +1 -0
- package/login/login-error-interceptor.d.ts +1 -0
- package/login/login-error-interceptor.d.ts.map +1 -0
- package/login/login-store.d.ts +1 -0
- package/login/login-store.d.ts.map +1 -0
- package/login/reprovision.d.ts +1 -0
- package/login/reprovision.d.ts.map +1 -0
- package/media/audio-constants.d.ts +1 -0
- package/media/audio-constants.d.ts.map +1 -0
- package/media/capabilities.d.ts +1 -0
- package/media/capabilities.d.ts.map +1 -0
- package/media/device-detection.d.ts +1 -0
- package/media/device-detection.d.ts.map +1 -0
- package/media/ikon-audio-capture.d.ts +1 -0
- package/media/ikon-audio-capture.d.ts.map +1 -0
- package/media/ikon-audio-playback.d.ts +2 -1
- package/media/ikon-audio-playback.d.ts.map +1 -0
- package/media/ikon-image-capture.d.ts +1 -0
- package/media/ikon-image-capture.d.ts.map +1 -0
- package/media/ikon-media-capture.d.ts +1 -0
- package/media/ikon-media-capture.d.ts.map +1 -0
- package/media/ikon-media.d.ts +1 -0
- package/media/ikon-media.d.ts.map +1 -0
- package/media/ikon-video-capture.d.ts +1 -0
- package/media/ikon-video-capture.d.ts.map +1 -0
- package/media/ikon-video-playback.d.ts +2 -1
- package/media/ikon-video-playback.d.ts.map +1 -0
- package/media/index.d.ts +1 -0
- package/media/index.d.ts.map +1 -0
- package/media/media-permission.d.ts +1 -0
- package/media/media-permission.d.ts.map +1 -0
- package/media/media-session-helper.d.ts +1 -0
- package/media/media-session-helper.d.ts.map +1 -0
- package/media/ring-buffer.d.ts +1 -0
- package/media/ring-buffer.d.ts.map +1 -0
- package/media/video-constants.d.ts +1 -0
- package/media/video-constants.d.ts.map +1 -0
- package/media/viseme-tracker.d.ts +2 -1
- package/media/viseme-tracker.d.ts.map +1 -0
- package/media-session-helper-Do-OxyU6.js +51 -0
- package/package.json +1 -1
- package/reactive/reactive-registry.d.ts +1 -0
- package/reactive/reactive-registry.d.ts.map +1 -0
- package/sha2-DPTGfEM2.js +261 -0
- package/storage.d.ts +1 -0
- package/storage.d.ts.map +1 -0
- package/transport/http-stream-transport.d.ts +16 -1
- package/transport/http-stream-transport.d.ts.map +1 -0
- package/transport/keepalive-watchdog.d.ts +19 -0
- package/transport/keepalive-watchdog.d.ts.map +1 -0
- package/transport/message-framer.d.ts +1 -0
- package/transport/message-framer.d.ts.map +1 -0
- package/transport/transport-probe.d.ts +2 -1
- package/transport/transport-probe.d.ts.map +1 -0
- package/transport/transport.d.ts +9 -1
- package/transport/transport.d.ts.map +1 -0
- package/transport/web-socket-transport.d.ts +3 -1
- package/transport/web-socket-transport.d.ts.map +1 -0
- package/transport/web-transport-support.d.ts +5 -0
- package/transport/web-transport-support.d.ts.map +1 -0
- package/transport/web-transport-transport.d.ts +3 -8
- package/transport/web-transport-transport.d.ts.map +1 -0
- package/upload/file-upload.d.ts +62 -0
- package/upload/file-upload.d.ts.map +1 -0
- package/utils/abort-signal.d.ts +1 -0
- package/utils/abort-signal.d.ts.map +1 -0
- package/utils/app-routes.d.ts +1 -0
- package/utils/app-routes.d.ts.map +1 -0
- package/utils/boot-signal.d.ts +1 -0
- package/utils/boot-signal.d.ts.map +1 -0
- package/utils/browser-compat.d.ts +1 -0
- package/utils/browser-compat.d.ts.map +1 -0
- package/utils/browser-support.d.ts +1 -0
- package/utils/browser-support.d.ts.map +1 -0
- package/utils/client-identity.d.ts +1 -0
- package/utils/client-identity.d.ts.map +1 -0
- package/utils/connect-timeline.d.ts +1 -0
- package/utils/connect-timeline.d.ts.map +1 -0
- package/utils/debug-mode.d.ts +1 -0
- package/utils/debug-mode.d.ts.map +1 -0
- package/utils/deferred.d.ts +1 -0
- package/utils/deferred.d.ts.map +1 -0
- package/utils/delay.d.ts +1 -0
- package/utils/delay.d.ts.map +1 -0
- package/utils/embedded-oauth.d.ts +1 -0
- package/utils/embedded-oauth.d.ts.map +1 -0
- package/utils/external-link.d.ts +1 -0
- package/utils/external-link.d.ts.map +1 -0
- package/utils/inspect-mode.d.ts +1 -0
- package/utils/inspect-mode.d.ts.map +1 -0
- package/utils/log-sender.d.ts +1 -0
- package/utils/log-sender.d.ts.map +1 -0
- package/utils/log-sink.d.ts +1 -0
- package/utils/log-sink.d.ts.map +1 -0
- package/utils/logger.d.ts +1 -0
- package/utils/logger.d.ts.map +1 -0
- package/utils/oauth-start-url.d.ts +22 -0
- package/utils/oauth-start-url.d.ts.map +1 -0
- package/utils/opcode-names.d.ts +1 -0
- package/utils/opcode-names.d.ts.map +1 -0
- package/utils/parent-log-forward.d.ts +1 -0
- package/utils/parent-log-forward.d.ts.map +1 -0
- package/utils/pkce.d.ts +1 -0
- package/utils/pkce.d.ts.map +1 -0
- package/utils/platform.d.ts +1 -0
- package/utils/platform.d.ts.map +1 -0
- package/utils/query-params.d.ts +21 -0
- package/utils/query-params.d.ts.map +1 -0
- package/utils/user-gesture.d.ts +1 -0
- package/utils/user-gesture.d.ts.map +1 -0
- package/utils/uuid.d.ts +1 -0
- package/utils/uuid.d.ts.map +1 -0
- package/viseme-tracker-CAtczW00.js +183 -0
- package/web-transport-support-Cdyk4mQe.js +229 -0
- package/webrtc/index.d.ts +1 -0
- package/webrtc/index.d.ts.map +1 -0
- package/webrtc/webrtc-config.d.ts +1 -0
- package/webrtc/webrtc-config.d.ts.map +1 -0
- package/webrtc/webrtc-connection.d.ts +10 -0
- package/webrtc/webrtc-connection.d.ts.map +1 -0
- package/webrtc/webrtc-reachability.d.ts +1 -0
- package/webrtc/webrtc-reachability.d.ts.map +1 -0
- package/webrtc/webrtc-signaling.d.ts +12 -1
- package/webrtc/webrtc-signaling.d.ts.map +1 -0
- package/worker/audio-capture-worker.d.ts +1 -0
- package/worker/audio-capture-worker.d.ts.map +1 -0
- package/worker/audio-playback-worker.d.ts +2 -1
- package/worker/audio-playback-worker.d.ts.map +1 -0
- package/worker/protocol-worker.d.ts +1 -0
- package/worker/protocol-worker.d.ts.map +1 -0
- package/worker/video-capture-worker.d.ts +1 -0
- package/worker/video-capture-worker.d.ts.map +1 -0
- package/worker/video-playback-worker.d.ts +2 -1
- package/worker/video-playback-worker.d.ts.map +1 -0
- package/worker/viseme-worker.d.ts +2 -1
- package/worker/viseme-worker.d.ts.map +1 -0
- package/assets/audio-playback-worker-D9_GcJw4.js +0 -1
- package/assets/protocol-worker-DA6wieqV.js +0 -3
- package/assets/video-capture-worker-DLndrZf8.js +0 -1
- package/assets/video-playback-worker-DAAVfeBm.js +0 -1
- package/assets/viseme-worker-Bfd95xP6.js +0 -1
- package/capabilities-lcsAlVUh.js +0 -1146
- package/vite.config.d.ts +0 -2
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
var e = 20971520, t = {
|
|
2
|
+
None: 0,
|
|
3
|
+
SendBackToSender: 1,
|
|
4
|
+
Delayable: 2,
|
|
5
|
+
SendToUser: 4,
|
|
6
|
+
Compressed: 8,
|
|
7
|
+
Unreliable: 16
|
|
8
|
+
};
|
|
9
|
+
function n(e) {
|
|
10
|
+
return e;
|
|
11
|
+
}
|
|
12
|
+
function r(e) {
|
|
13
|
+
if (e.length < 8) throw Error("Protocol message too short");
|
|
14
|
+
return (e[4] | e[5] << 8 | e[6] << 16 | e[7] << 24) >>> 0;
|
|
15
|
+
}
|
|
16
|
+
function i(e) {
|
|
17
|
+
return r(e) & 4294901760;
|
|
18
|
+
}
|
|
19
|
+
function a(e) {
|
|
20
|
+
let t = V(e), n = new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
21
|
+
if (t.length < 27) throw Error("Protocol payload too short");
|
|
22
|
+
let r = n.getUint32(0, !0), i = n.getUint32(4, !0), a = n.getUint32(8, !0), o = n.getUint32(12, !0), s = n.getUint32(16, !0), c = n.getUint32(20, !0), l = n.getUint8(24), u = n.getUint8(25), d = n.getUint8(26);
|
|
23
|
+
if (r > t.length) throw Error(`Protocol message declares ${r} bytes but carries ${t.length}`);
|
|
24
|
+
if (27 + c * 4 > t.length) throw Error("Protocol header exceeds payload length");
|
|
25
|
+
let f = [], p = 27;
|
|
26
|
+
for (let e = 0; e < c; e++) f.push(n.getUint32(p, !0)), p += 4;
|
|
27
|
+
return {
|
|
28
|
+
length: r,
|
|
29
|
+
opcode: i,
|
|
30
|
+
senderId: a,
|
|
31
|
+
trackId: o,
|
|
32
|
+
sequenceId: s,
|
|
33
|
+
targetIds: f,
|
|
34
|
+
payloadVersion: l,
|
|
35
|
+
payloadType: u,
|
|
36
|
+
flags: d
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function o(e, t, n) {
|
|
40
|
+
let r = V(e), i = a(r);
|
|
41
|
+
if (t !== void 0 && i.opcode !== t) throw Error(`Unexpected opcode ${i.opcode}`);
|
|
42
|
+
if (i.payloadType !== 8) throw Error(`Unexpected payload type ${i.payloadType}`);
|
|
43
|
+
let o = 27 + i.targetIds.length * 4;
|
|
44
|
+
return r.subarray(o, i.length);
|
|
45
|
+
}
|
|
46
|
+
async function s(e, n, r) {
|
|
47
|
+
let i = V(e), o = a(i);
|
|
48
|
+
if (n !== void 0 && o.opcode !== n) throw Error(`Unexpected opcode ${o.opcode}`);
|
|
49
|
+
if (o.payloadType !== 8) throw Error(`Unexpected payload type ${o.payloadType}`);
|
|
50
|
+
let s = 27 + o.targetIds.length * 4, c = i.subarray(s, o.length);
|
|
51
|
+
return (o.flags & t.Compressed) !== 0 && (c = await l(c)), c;
|
|
52
|
+
}
|
|
53
|
+
function c(e, t, r, i, a) {
|
|
54
|
+
let o = a?.trackId ?? 0, s = a?.sequenceId ?? 0, c = a?.flags ?? 0, l = a?.targetIds ?? [], u = a?.payloadType ?? 8, d = 27 + l.length * 4, f = d + t.length, p = new Uint8Array(f), m = new DataView(p.buffer);
|
|
55
|
+
m.setUint32(0, f, !0), m.setUint32(4, e >>> 0, !0), m.setUint32(8, i >>> 0, !0), m.setUint32(12, o >>> 0, !0), m.setUint32(16, s >>> 0, !0), m.setUint32(20, l.length >>> 0, !0), m.setUint8(24, r & 255), m.setUint8(25, u & 255), m.setUint8(26, c & 255);
|
|
56
|
+
let h = 27;
|
|
57
|
+
for (let e = 0; e < l.length; e++) m.setUint32(h, l[e] >>> 0, !0), h += 4;
|
|
58
|
+
return p.set(t, d), n(p);
|
|
59
|
+
}
|
|
60
|
+
async function l(t) {
|
|
61
|
+
if (typeof DecompressionStream > "u") throw Error("DecompressionStream not supported");
|
|
62
|
+
let n = new DecompressionStream("gzip"), r = n.writable.getWriter(), i = new Uint8Array(t);
|
|
63
|
+
r.write(i).then(() => r.close()).catch(() => void 0);
|
|
64
|
+
let a = n.readable.getReader(), o = [], s = 0;
|
|
65
|
+
for (;;) {
|
|
66
|
+
let { done: t, value: n } = await a.read();
|
|
67
|
+
if (t) break;
|
|
68
|
+
if (o.push(n), s += n.length, s > 20971520) throw await a.cancel().catch(() => void 0), Error(`Decompressed payload exceeds the maximum of ${e} bytes`);
|
|
69
|
+
}
|
|
70
|
+
let c = new Uint8Array(s), l = 0;
|
|
71
|
+
for (let e = 0; e < o.length; e++) c.set(o[e], l), l += o[e].length;
|
|
72
|
+
return c;
|
|
73
|
+
}
|
|
74
|
+
var u = /* @__PURE__ */ function(e) {
|
|
75
|
+
return e[e.Null = 1] = "Null", e[e.Bool = 2] = "Bool", e[e.Int32 = 3] = "Int32", e[e.Int64 = 4] = "Int64", e[e.UInt32 = 5] = "UInt32", e[e.UInt64 = 6] = "UInt64", e[e.Float32 = 7] = "Float32", e[e.Float64 = 8] = "Float64", e[e.Array = 9] = "Array", e[e.Dict = 10] = "Dict", e[e.Object = 11] = "Object", e[e.String = 12] = "String", e[e.Binary = 13] = "Binary", e[e.Guid = 14] = "Guid", e;
|
|
76
|
+
}({}), d = 161, f = 162, p = new TextEncoder(), m = new TextDecoder("utf-8", { fatal: !0 }), h = class e {
|
|
77
|
+
buffer = new D();
|
|
78
|
+
cached;
|
|
79
|
+
constructor(e = 1) {
|
|
80
|
+
this.buffer.writeByte(d), this.buffer.writeVarUInt(e >>> 0);
|
|
81
|
+
}
|
|
82
|
+
writeInt32Field(e, t) {
|
|
83
|
+
this.writeFixedField(e, 3, () => this.buffer.writeInt32(t | 0));
|
|
84
|
+
}
|
|
85
|
+
writeUInt32Field(e, t) {
|
|
86
|
+
this.writeFixedField(e, 5, () => this.buffer.writeUInt32(t >>> 0));
|
|
87
|
+
}
|
|
88
|
+
writeInt64Field(e, t) {
|
|
89
|
+
this.writeFixedField(e, 4, () => this.buffer.writeBigInt64(t));
|
|
90
|
+
}
|
|
91
|
+
writeUInt64Field(e, t) {
|
|
92
|
+
this.writeFixedField(e, 6, () => this.buffer.writeBigUInt64(t));
|
|
93
|
+
}
|
|
94
|
+
writeFloat32Field(e, t) {
|
|
95
|
+
this.writeFixedField(e, 7, () => this.buffer.writeFloat32(t));
|
|
96
|
+
}
|
|
97
|
+
writeFloat64Field(e, t) {
|
|
98
|
+
this.writeFixedField(e, 8, () => this.buffer.writeFloat64(t));
|
|
99
|
+
}
|
|
100
|
+
writeBoolField(e, t) {
|
|
101
|
+
this.writeFixedField(e, 2, () => this.buffer.writeByte(+!!t));
|
|
102
|
+
}
|
|
103
|
+
writeGuidField(e, t) {
|
|
104
|
+
let n = t instanceof E ? t.asBytes() : t;
|
|
105
|
+
if (n.length !== 16) throw Error("Guid payload must be 16 bytes");
|
|
106
|
+
this.writeFixedField(e, 14, () => this.buffer.writeBytes(n));
|
|
107
|
+
}
|
|
108
|
+
writeStringField(e, t) {
|
|
109
|
+
let n = p.encode(t ?? "");
|
|
110
|
+
this.writeVariableField(e, 12, n);
|
|
111
|
+
}
|
|
112
|
+
writeBinaryField(e, t) {
|
|
113
|
+
this.writeVariableField(e, 13, t);
|
|
114
|
+
}
|
|
115
|
+
writeObjectField(t, n, r) {
|
|
116
|
+
let i = new e(n);
|
|
117
|
+
r(i);
|
|
118
|
+
let a = i.finish();
|
|
119
|
+
this.writeVariableField(t, 11, a);
|
|
120
|
+
}
|
|
121
|
+
writeArrayField(e, t, n) {
|
|
122
|
+
let r = new g(t);
|
|
123
|
+
n(r);
|
|
124
|
+
let i = r.finish();
|
|
125
|
+
this.writeVariableField(e, 9, i);
|
|
126
|
+
}
|
|
127
|
+
writeDictionaryField(e, t, n, r) {
|
|
128
|
+
let i = new _(t, n);
|
|
129
|
+
r(i);
|
|
130
|
+
let a = i.finish();
|
|
131
|
+
this.writeVariableField(e, 10, a);
|
|
132
|
+
}
|
|
133
|
+
finish() {
|
|
134
|
+
return this.cached ||= (this.buffer.writeByte(f), this.buffer.toUint8Array()), this.cached;
|
|
135
|
+
}
|
|
136
|
+
writeFixedField(e, t, n) {
|
|
137
|
+
this.writeFieldHeader(e, t, 0), n();
|
|
138
|
+
}
|
|
139
|
+
writeVariableField(e, t, n) {
|
|
140
|
+
this.writeFieldHeader(e, t, n.length), this.buffer.writeBytes(n);
|
|
141
|
+
}
|
|
142
|
+
writeFieldHeader(e, t, n) {
|
|
143
|
+
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(A(t)), j(t) && this.buffer.writeVarUInt(n >>> 0);
|
|
144
|
+
}
|
|
145
|
+
}, g = class e {
|
|
146
|
+
elementType;
|
|
147
|
+
payload = new D();
|
|
148
|
+
count = 0;
|
|
149
|
+
constructor(e) {
|
|
150
|
+
this.elementType = e;
|
|
151
|
+
}
|
|
152
|
+
writeInt32(e) {
|
|
153
|
+
this.ensureElementType(3), this.count++, this.payload.writeInt32(e | 0);
|
|
154
|
+
}
|
|
155
|
+
writeUInt32(e) {
|
|
156
|
+
this.ensureElementType(5), this.count++, this.payload.writeUInt32(e >>> 0);
|
|
157
|
+
}
|
|
158
|
+
writeInt64(e) {
|
|
159
|
+
this.ensureElementType(4), this.count++, this.payload.writeBigInt64(e);
|
|
160
|
+
}
|
|
161
|
+
writeUInt64(e) {
|
|
162
|
+
this.ensureElementType(6), this.count++, this.payload.writeBigUInt64(e);
|
|
163
|
+
}
|
|
164
|
+
writeFloat32(e) {
|
|
165
|
+
this.ensureElementType(7), this.count++, this.payload.writeFloat32(e);
|
|
166
|
+
}
|
|
167
|
+
writeFloat64(e) {
|
|
168
|
+
this.ensureElementType(8), this.count++, this.payload.writeFloat64(e);
|
|
169
|
+
}
|
|
170
|
+
writeBool(e) {
|
|
171
|
+
this.ensureElementType(2), this.count++, this.payload.writeByte(+!!e);
|
|
172
|
+
}
|
|
173
|
+
writeGuid(e) {
|
|
174
|
+
this.ensureElementType(14), this.count++;
|
|
175
|
+
let t = e instanceof E ? e.asBytes() : e;
|
|
176
|
+
if (t.length !== 16) throw Error("Guid payload must be 16 bytes");
|
|
177
|
+
this.payload.writeBytes(t);
|
|
178
|
+
}
|
|
179
|
+
writeString(e) {
|
|
180
|
+
this.ensureElementType(12), this.count++;
|
|
181
|
+
let t = p.encode(e ?? "");
|
|
182
|
+
this.payload.writeVarUInt(t.length), this.payload.writeBytes(t);
|
|
183
|
+
}
|
|
184
|
+
writeBinary(e) {
|
|
185
|
+
this.ensureElementType(13), this.count++, this.payload.writeVarUInt(e.length), this.payload.writeBytes(e);
|
|
186
|
+
}
|
|
187
|
+
writeObject(e, t) {
|
|
188
|
+
this.ensureElementType(11), this.count++;
|
|
189
|
+
let n = new h(e);
|
|
190
|
+
t(n);
|
|
191
|
+
let r = n.finish();
|
|
192
|
+
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r);
|
|
193
|
+
}
|
|
194
|
+
writeArray(t, n) {
|
|
195
|
+
this.ensureElementType(9), this.count++;
|
|
196
|
+
let r = new e(t);
|
|
197
|
+
n(r);
|
|
198
|
+
let i = r.finish();
|
|
199
|
+
this.payload.writeBytes(i);
|
|
200
|
+
}
|
|
201
|
+
writeDictionary(e, t, n) {
|
|
202
|
+
this.ensureElementType(10), this.count++;
|
|
203
|
+
let r = new _(e, t);
|
|
204
|
+
n(r);
|
|
205
|
+
let i = r.finish();
|
|
206
|
+
this.payload.writeBytes(i);
|
|
207
|
+
}
|
|
208
|
+
finish() {
|
|
209
|
+
let e = new D();
|
|
210
|
+
return e.writeByte(A(this.elementType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
211
|
+
}
|
|
212
|
+
ensureElementType(e) {
|
|
213
|
+
if (this.elementType !== e) throw Error(`Array element type is ${u[this.elementType]}, expected ${u[e]}`);
|
|
214
|
+
}
|
|
215
|
+
}, _ = class {
|
|
216
|
+
keyType;
|
|
217
|
+
valueType;
|
|
218
|
+
payload = new D();
|
|
219
|
+
count = 0;
|
|
220
|
+
entryOpen = !1;
|
|
221
|
+
constructor(e, t) {
|
|
222
|
+
this.keyType = e, this.valueType = t, N(e);
|
|
223
|
+
}
|
|
224
|
+
beginEntry() {
|
|
225
|
+
if (this.entryOpen) throw Error("Previous dictionary entry not completed");
|
|
226
|
+
return this.count++, this.entryOpen = !0, new v(this.keyType, this.valueType, this.payload, () => {
|
|
227
|
+
this.entryOpen = !1;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
finish() {
|
|
231
|
+
if (this.entryOpen) throw Error("Dictionary entry not completed");
|
|
232
|
+
let e = new D();
|
|
233
|
+
return e.writeByte(A(this.keyType)), e.writeByte(A(this.valueType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
234
|
+
}
|
|
235
|
+
}, v = class {
|
|
236
|
+
keyType;
|
|
237
|
+
valueType;
|
|
238
|
+
payload;
|
|
239
|
+
onComplete;
|
|
240
|
+
keyWritten = !1;
|
|
241
|
+
valueWritten = !1;
|
|
242
|
+
completed = !1;
|
|
243
|
+
constructor(e, t, n, r) {
|
|
244
|
+
this.keyType = e, this.valueType = t, this.payload = n, this.onComplete = r;
|
|
245
|
+
}
|
|
246
|
+
writeKeyInt32(e) {
|
|
247
|
+
this.ensureKeyType(3), this.payload.writeInt32(e | 0), this.keyWritten = !0;
|
|
248
|
+
}
|
|
249
|
+
writeKeyUInt32(e) {
|
|
250
|
+
this.ensureKeyType(5), this.payload.writeUInt32(e >>> 0), this.keyWritten = !0;
|
|
251
|
+
}
|
|
252
|
+
writeKeyInt64(e) {
|
|
253
|
+
this.ensureKeyType(4), this.payload.writeBigInt64(e), this.keyWritten = !0;
|
|
254
|
+
}
|
|
255
|
+
writeKeyUInt64(e) {
|
|
256
|
+
this.ensureKeyType(6), this.payload.writeBigUInt64(e), this.keyWritten = !0;
|
|
257
|
+
}
|
|
258
|
+
writeKeyFloat32(e) {
|
|
259
|
+
this.ensureKeyType(7), this.payload.writeFloat32(e), this.keyWritten = !0;
|
|
260
|
+
}
|
|
261
|
+
writeKeyFloat64(e) {
|
|
262
|
+
this.ensureKeyType(8), this.payload.writeFloat64(e), this.keyWritten = !0;
|
|
263
|
+
}
|
|
264
|
+
writeKeyBool(e) {
|
|
265
|
+
this.ensureKeyType(2), this.payload.writeByte(+!!e), this.keyWritten = !0;
|
|
266
|
+
}
|
|
267
|
+
writeKeyGuid(e) {
|
|
268
|
+
this.ensureKeyType(14);
|
|
269
|
+
let t = e instanceof E ? e.asBytes() : e;
|
|
270
|
+
if (t.length !== 16) throw Error("Guid payload must be 16 bytes");
|
|
271
|
+
this.payload.writeBytes(t), this.keyWritten = !0;
|
|
272
|
+
}
|
|
273
|
+
writeKeyString(e) {
|
|
274
|
+
this.ensureKeyType(12);
|
|
275
|
+
let t = p.encode(e ?? "");
|
|
276
|
+
this.payload.writeVarUInt(t.length), this.payload.writeBytes(t), this.keyWritten = !0;
|
|
277
|
+
}
|
|
278
|
+
writeKeyBinary(e) {
|
|
279
|
+
this.ensureKeyType(13), this.payload.writeVarUInt(e.length), this.payload.writeBytes(e), this.keyWritten = !0;
|
|
280
|
+
}
|
|
281
|
+
writeValueInt32(e) {
|
|
282
|
+
this.ensureValueType(3), this.payload.writeInt32(e | 0), this.valueWritten = !0;
|
|
283
|
+
}
|
|
284
|
+
writeValueUInt32(e) {
|
|
285
|
+
this.ensureValueType(5), this.payload.writeUInt32(e >>> 0), this.valueWritten = !0;
|
|
286
|
+
}
|
|
287
|
+
writeValueInt64(e) {
|
|
288
|
+
this.ensureValueType(4), this.payload.writeBigInt64(e), this.valueWritten = !0;
|
|
289
|
+
}
|
|
290
|
+
writeValueUInt64(e) {
|
|
291
|
+
this.ensureValueType(6), this.payload.writeBigUInt64(e), this.valueWritten = !0;
|
|
292
|
+
}
|
|
293
|
+
writeValueFloat32(e) {
|
|
294
|
+
this.ensureValueType(7), this.payload.writeFloat32(e), this.valueWritten = !0;
|
|
295
|
+
}
|
|
296
|
+
writeValueFloat64(e) {
|
|
297
|
+
this.ensureValueType(8), this.payload.writeFloat64(e), this.valueWritten = !0;
|
|
298
|
+
}
|
|
299
|
+
writeValueBool(e) {
|
|
300
|
+
this.ensureValueType(2), this.payload.writeByte(+!!e), this.valueWritten = !0;
|
|
301
|
+
}
|
|
302
|
+
writeValueGuid(e) {
|
|
303
|
+
this.ensureValueType(14);
|
|
304
|
+
let t = e instanceof E ? e.asBytes() : e;
|
|
305
|
+
if (t.length !== 16) throw Error("Guid payload must be 16 bytes");
|
|
306
|
+
this.payload.writeBytes(t), this.valueWritten = !0;
|
|
307
|
+
}
|
|
308
|
+
writeNullValue() {
|
|
309
|
+
this.ensureValueType(1), this.valueWritten = !0;
|
|
310
|
+
}
|
|
311
|
+
writeValueBinary(e) {
|
|
312
|
+
this.ensureValueType(13), this.payload.writeVarUInt(e.length), this.payload.writeBytes(e), this.valueWritten = !0;
|
|
313
|
+
}
|
|
314
|
+
writeValueString(e) {
|
|
315
|
+
this.ensureValueType(12);
|
|
316
|
+
let t = p.encode(e ?? "");
|
|
317
|
+
this.payload.writeVarUInt(t.length), this.payload.writeBytes(t), this.valueWritten = !0;
|
|
318
|
+
}
|
|
319
|
+
writeValueObject(e, t) {
|
|
320
|
+
this.ensureValueType(11);
|
|
321
|
+
let n = new h(e);
|
|
322
|
+
t(n);
|
|
323
|
+
let r = n.finish();
|
|
324
|
+
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r), this.valueWritten = !0;
|
|
325
|
+
}
|
|
326
|
+
writeValueArray(e, t) {
|
|
327
|
+
this.ensureValueType(9);
|
|
328
|
+
let n = new g(e);
|
|
329
|
+
t(n);
|
|
330
|
+
let r = n.finish();
|
|
331
|
+
this.payload.writeBytes(r), this.valueWritten = !0;
|
|
332
|
+
}
|
|
333
|
+
writeValueDictionary(e, t, n) {
|
|
334
|
+
this.ensureValueType(10);
|
|
335
|
+
let r = new _(e, t);
|
|
336
|
+
n(r);
|
|
337
|
+
let i = r.finish();
|
|
338
|
+
this.payload.writeBytes(i), this.valueWritten = !0;
|
|
339
|
+
}
|
|
340
|
+
complete() {
|
|
341
|
+
if (!this.completed) {
|
|
342
|
+
if (!this.keyWritten || !this.valueWritten) throw Error("Dictionary entry must write both key and value");
|
|
343
|
+
this.completed = !0, this.onComplete();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
ensureKeyType(e) {
|
|
347
|
+
if (this.keyType !== e) throw Error(`Dictionary key type is ${u[this.keyType]}, expected ${u[e]}`);
|
|
348
|
+
}
|
|
349
|
+
ensureValueType(e) {
|
|
350
|
+
if (this.valueType !== e) throw Error(`Dictionary value type is ${u[this.valueType]}, expected ${u[e]}`);
|
|
351
|
+
}
|
|
352
|
+
}, y = class e {
|
|
353
|
+
buffer;
|
|
354
|
+
version;
|
|
355
|
+
offset;
|
|
356
|
+
end;
|
|
357
|
+
constructor(e, t, n) {
|
|
358
|
+
this.buffer = e, this.version = t, this.offset = n, this.end = e.length - 1;
|
|
359
|
+
}
|
|
360
|
+
static create(t) {
|
|
361
|
+
let n = V(t);
|
|
362
|
+
if (n.length < 2) throw Error("Teleport payload too short");
|
|
363
|
+
if (n[0] !== d || n[n.length - 1] !== f) throw Error("Teleport object missing markers");
|
|
364
|
+
let r = { offset: 1 }, i = O(n, r, "InvalidLength");
|
|
365
|
+
return new e(n, i, r.offset);
|
|
366
|
+
}
|
|
367
|
+
next() {
|
|
368
|
+
if (this.offset >= this.end) return null;
|
|
369
|
+
if (this.offset + 5 > this.buffer.length) throw Error("Teleport object truncated");
|
|
370
|
+
let e = F(this.buffer, this.offset);
|
|
371
|
+
this.offset += 4;
|
|
372
|
+
let t = this.buffer[this.offset++], n = t >> 4 & 15;
|
|
373
|
+
if (t & 15) throw Error("Teleport field flags must be zero");
|
|
374
|
+
let r = M(n), i;
|
|
375
|
+
if (r >= 0) P(this.buffer, this.offset, r), i = this.buffer.subarray(this.offset, this.offset + r), this.offset += r;
|
|
376
|
+
else {
|
|
377
|
+
let e = { offset: this.offset }, t = O(this.buffer, e, "InvalidLength");
|
|
378
|
+
P(this.buffer, e.offset, t), i = this.buffer.subarray(e.offset, e.offset + t), this.offset = e.offset + t;
|
|
379
|
+
}
|
|
380
|
+
return new x(e, n, i);
|
|
381
|
+
}
|
|
382
|
+
}, b = class {
|
|
383
|
+
type;
|
|
384
|
+
payload;
|
|
385
|
+
constructor(e, t) {
|
|
386
|
+
this.type = e, this.payload = t;
|
|
387
|
+
}
|
|
388
|
+
asInt32() {
|
|
389
|
+
return this.ensureType(3), new DataView(this.payload.buffer, this.payload.byteOffset, 4).getInt32(0, !0);
|
|
390
|
+
}
|
|
391
|
+
asUInt32() {
|
|
392
|
+
return this.ensureType(5), new DataView(this.payload.buffer, this.payload.byteOffset, 4).getUint32(0, !0);
|
|
393
|
+
}
|
|
394
|
+
asInt64() {
|
|
395
|
+
return this.ensureType(4), new DataView(this.payload.buffer, this.payload.byteOffset, 8).getBigInt64(0, !0);
|
|
396
|
+
}
|
|
397
|
+
asUInt64() {
|
|
398
|
+
return this.ensureType(6), new DataView(this.payload.buffer, this.payload.byteOffset, 8).getBigUint64(0, !0);
|
|
399
|
+
}
|
|
400
|
+
asFloat32() {
|
|
401
|
+
return this.ensureType(7), new DataView(this.payload.buffer, this.payload.byteOffset, 4).getFloat32(0, !0);
|
|
402
|
+
}
|
|
403
|
+
asFloat64() {
|
|
404
|
+
return this.ensureType(8), new DataView(this.payload.buffer, this.payload.byteOffset, 8).getFloat64(0, !0);
|
|
405
|
+
}
|
|
406
|
+
asBool() {
|
|
407
|
+
return this.ensureType(2), this.payload.length > 0 && this.payload[0] !== 0;
|
|
408
|
+
}
|
|
409
|
+
asBinary() {
|
|
410
|
+
return this.ensureType(13), this.payload;
|
|
411
|
+
}
|
|
412
|
+
asUtf8() {
|
|
413
|
+
return this.ensureType(12), this.payload;
|
|
414
|
+
}
|
|
415
|
+
asString() {
|
|
416
|
+
return this.ensureType(12), m.decode(this.payload);
|
|
417
|
+
}
|
|
418
|
+
asGuid() {
|
|
419
|
+
return this.ensureType(14), E.fromBytes(this.payload);
|
|
420
|
+
}
|
|
421
|
+
asObject() {
|
|
422
|
+
return this.ensureType(11), y.create(this.payload);
|
|
423
|
+
}
|
|
424
|
+
asArray() {
|
|
425
|
+
return this.ensureType(9), S.create(this.payload);
|
|
426
|
+
}
|
|
427
|
+
asDictionary() {
|
|
428
|
+
return this.ensureType(10), w.create(this.payload);
|
|
429
|
+
}
|
|
430
|
+
ensureType(e) {
|
|
431
|
+
if (this.type !== e) throw Error(`Teleport value has type ${u[this.type]}, expected ${u[e]}`);
|
|
432
|
+
}
|
|
433
|
+
}, x = class extends b {
|
|
434
|
+
fieldId;
|
|
435
|
+
constructor(e, t, n) {
|
|
436
|
+
super(t, n), this.fieldId = e;
|
|
437
|
+
}
|
|
438
|
+
get isNull() {
|
|
439
|
+
return this.type === 1;
|
|
440
|
+
}
|
|
441
|
+
}, S = class e {
|
|
442
|
+
payload;
|
|
443
|
+
elementType;
|
|
444
|
+
count;
|
|
445
|
+
offset;
|
|
446
|
+
index = 0;
|
|
447
|
+
constructor(e) {
|
|
448
|
+
if (this.payload = e, e.length === 0) throw Error("Array payload too short");
|
|
449
|
+
let t = e[0];
|
|
450
|
+
if (this.elementType = t >> 4 & 15, t & 15) throw Error("Array flags must be zero");
|
|
451
|
+
let n = { offset: 1 };
|
|
452
|
+
this.count = O(e, n, "ArrayMalformed"), this.offset = n.offset;
|
|
453
|
+
}
|
|
454
|
+
static create(t) {
|
|
455
|
+
return new e(V(t));
|
|
456
|
+
}
|
|
457
|
+
next() {
|
|
458
|
+
if (this.index >= this.count) {
|
|
459
|
+
if (this.offset !== this.payload.length) throw Error("Array payload contains trailing data");
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
let e = this.readValue();
|
|
463
|
+
return this.index++, e;
|
|
464
|
+
}
|
|
465
|
+
readValue() {
|
|
466
|
+
switch (this.elementType) {
|
|
467
|
+
case 3:
|
|
468
|
+
case 5:
|
|
469
|
+
case 7:
|
|
470
|
+
case 8:
|
|
471
|
+
case 2:
|
|
472
|
+
case 4:
|
|
473
|
+
case 6:
|
|
474
|
+
case 14: {
|
|
475
|
+
let e = M(this.elementType);
|
|
476
|
+
P(this.payload, this.offset, e);
|
|
477
|
+
let t = this.payload.subarray(this.offset, this.offset + e);
|
|
478
|
+
return this.offset += e, new C(this.elementType, t);
|
|
479
|
+
}
|
|
480
|
+
case 12:
|
|
481
|
+
case 13: {
|
|
482
|
+
let e = { offset: this.offset }, t = O(this.payload, e, "ArrayMalformed");
|
|
483
|
+
P(this.payload, e.offset, t);
|
|
484
|
+
let n = this.payload.subarray(e.offset, e.offset + t);
|
|
485
|
+
return this.offset = e.offset + t, new C(this.elementType, n);
|
|
486
|
+
}
|
|
487
|
+
case 11: {
|
|
488
|
+
let e = { offset: this.offset }, t = O(this.payload, e, "ArrayMalformed");
|
|
489
|
+
P(this.payload, e.offset, t);
|
|
490
|
+
let n = this.payload.subarray(e.offset, e.offset + t);
|
|
491
|
+
return this.offset = e.offset + t, new C(11, n);
|
|
492
|
+
}
|
|
493
|
+
case 9: {
|
|
494
|
+
let e = L(this.payload, this.offset, 0), t = this.payload.subarray(this.offset, this.offset + e);
|
|
495
|
+
return this.offset += e, new C(9, t);
|
|
496
|
+
}
|
|
497
|
+
case 10: {
|
|
498
|
+
let e = R(this.payload, this.offset, 0), t = this.payload.subarray(this.offset, this.offset + e);
|
|
499
|
+
return this.offset += e, new C(10, t);
|
|
500
|
+
}
|
|
501
|
+
default: throw Error(`Unsupported array element type ${u[this.elementType]}`);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}, C = class extends b {
|
|
505
|
+
constructor(e, t) {
|
|
506
|
+
super(e, t);
|
|
507
|
+
}
|
|
508
|
+
}, w = class e {
|
|
509
|
+
payload;
|
|
510
|
+
keyType;
|
|
511
|
+
valueType;
|
|
512
|
+
count;
|
|
513
|
+
offset;
|
|
514
|
+
index = 0;
|
|
515
|
+
constructor(e) {
|
|
516
|
+
if (this.payload = e, e.length < 2) throw Error("Dictionary payload too short");
|
|
517
|
+
if (this.keyType = e[0] >> 4 & 15, this.valueType = e[1] >> 4 & 15, e[0] & 15 || e[1] & 15) throw Error("Dictionary key/value flags must be zero");
|
|
518
|
+
N(this.keyType);
|
|
519
|
+
let t = { offset: 2 };
|
|
520
|
+
this.count = O(e, t, "DictMalformed"), this.offset = t.offset;
|
|
521
|
+
}
|
|
522
|
+
static create(t) {
|
|
523
|
+
return new e(V(t));
|
|
524
|
+
}
|
|
525
|
+
next() {
|
|
526
|
+
if (this.index >= this.count) {
|
|
527
|
+
if (this.offset !== this.payload.length) throw Error("Dictionary payload contains trailing data");
|
|
528
|
+
return null;
|
|
529
|
+
}
|
|
530
|
+
let e = this.readKey(), t = this.readValue();
|
|
531
|
+
return this.index++, new T(e, t);
|
|
532
|
+
}
|
|
533
|
+
readKey() {
|
|
534
|
+
let e = M(this.keyType);
|
|
535
|
+
if (e >= 0) {
|
|
536
|
+
P(this.payload, this.offset, e);
|
|
537
|
+
let t = this.payload.subarray(this.offset, this.offset + e);
|
|
538
|
+
return this.offset += e, new b(this.keyType, t);
|
|
539
|
+
}
|
|
540
|
+
if (this.keyType === 12 || this.keyType === 13) {
|
|
541
|
+
let e = { offset: this.offset }, t = O(this.payload, e, "DictMalformed");
|
|
542
|
+
P(this.payload, e.offset, t);
|
|
543
|
+
let n = this.payload.subarray(e.offset, e.offset + t);
|
|
544
|
+
return this.offset = e.offset + t, new b(this.keyType, n);
|
|
545
|
+
}
|
|
546
|
+
throw Error("Unsupported dictionary key type");
|
|
547
|
+
}
|
|
548
|
+
readValue() {
|
|
549
|
+
switch (this.valueType) {
|
|
550
|
+
case 12:
|
|
551
|
+
case 13: {
|
|
552
|
+
let e = { offset: this.offset }, t = O(this.payload, e, "DictMalformed");
|
|
553
|
+
P(this.payload, e.offset, t);
|
|
554
|
+
let n = this.payload.subarray(e.offset, e.offset + t);
|
|
555
|
+
return this.offset = e.offset + t, new b(this.valueType, n);
|
|
556
|
+
}
|
|
557
|
+
case 11: {
|
|
558
|
+
let e = { offset: this.offset }, t = O(this.payload, e, "DictMalformed");
|
|
559
|
+
P(this.payload, e.offset, t);
|
|
560
|
+
let n = this.payload.subarray(e.offset, e.offset + t);
|
|
561
|
+
return this.offset = e.offset + t, new b(11, n);
|
|
562
|
+
}
|
|
563
|
+
case 9: {
|
|
564
|
+
let e = L(this.payload, this.offset, 0), t = this.payload.subarray(this.offset, this.offset + e);
|
|
565
|
+
return this.offset += e, new b(9, t);
|
|
566
|
+
}
|
|
567
|
+
case 10: {
|
|
568
|
+
let e = R(this.payload, this.offset, 0), t = this.payload.subarray(this.offset, this.offset + e);
|
|
569
|
+
return this.offset += e, new b(10, t);
|
|
570
|
+
}
|
|
571
|
+
case 3:
|
|
572
|
+
case 5:
|
|
573
|
+
case 7:
|
|
574
|
+
case 8:
|
|
575
|
+
case 2:
|
|
576
|
+
case 4:
|
|
577
|
+
case 6:
|
|
578
|
+
case 14:
|
|
579
|
+
case 1: {
|
|
580
|
+
let e = M(this.valueType);
|
|
581
|
+
P(this.payload, this.offset, e);
|
|
582
|
+
let t = this.payload.subarray(this.offset, this.offset + e);
|
|
583
|
+
return this.offset += e, new b(this.valueType, t);
|
|
584
|
+
}
|
|
585
|
+
default: throw Error(`Unsupported dictionary value type ${u[this.valueType]}`);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}, T = class {
|
|
589
|
+
key;
|
|
590
|
+
value;
|
|
591
|
+
constructor(e, t) {
|
|
592
|
+
this.key = e, this.value = t;
|
|
593
|
+
}
|
|
594
|
+
}, E = class e {
|
|
595
|
+
bytes;
|
|
596
|
+
constructor(e) {
|
|
597
|
+
this.bytes = e;
|
|
598
|
+
}
|
|
599
|
+
static fromString(t) {
|
|
600
|
+
if (!t) throw Error("Guid string is empty");
|
|
601
|
+
let n = t.replace(/-/g, "");
|
|
602
|
+
if (n.length !== 32) throw Error("Guid string must be 32 hex characters");
|
|
603
|
+
let r = /* @__PURE__ */ new Uint8Array(16), i = e.parseHexSlice(n, 0, 8), a = e.parseHexSlice(n, 8, 4), o = e.parseHexSlice(n, 12, 4);
|
|
604
|
+
e.writeUInt32LE(r, 0, i), e.writeUInt16LE(r, 4, a), e.writeUInt16LE(r, 6, o);
|
|
605
|
+
for (let t = 0; t < 8; t++) r[8 + t] = e.parseHexSlice(n, 16 + t * 2, 2);
|
|
606
|
+
return new e(r);
|
|
607
|
+
}
|
|
608
|
+
static fromBytes(t) {
|
|
609
|
+
if (t.length !== 16) throw Error("Guid byte array must be 16 bytes");
|
|
610
|
+
return new e(Uint8Array.from(t));
|
|
611
|
+
}
|
|
612
|
+
static createZero() {
|
|
613
|
+
return new e(/* @__PURE__ */ new Uint8Array(16));
|
|
614
|
+
}
|
|
615
|
+
static createRandom() {
|
|
616
|
+
let t = /* @__PURE__ */ new Uint8Array(16), n = globalThis.crypto;
|
|
617
|
+
if (n?.getRandomValues) n.getRandomValues(t);
|
|
618
|
+
else for (let e = 0; e < t.length; e++) t[e] = Math.floor(Math.random() * 256);
|
|
619
|
+
return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, new e(t);
|
|
620
|
+
}
|
|
621
|
+
toString() {
|
|
622
|
+
let t = this.bytes;
|
|
623
|
+
return [
|
|
624
|
+
e.toHex(e.readUInt32LE(t, 0), 8),
|
|
625
|
+
e.toHex(e.readUInt16LE(t, 4), 4),
|
|
626
|
+
e.toHex(e.readUInt16LE(t, 6), 4),
|
|
627
|
+
B(t.subarray(8, 10)),
|
|
628
|
+
B(t.subarray(10, 16))
|
|
629
|
+
].join("-");
|
|
630
|
+
}
|
|
631
|
+
asBytes() {
|
|
632
|
+
return this.bytes.slice();
|
|
633
|
+
}
|
|
634
|
+
static parseHexSlice(e, t, n) {
|
|
635
|
+
let r = e.substr(t, n), i = Number.parseInt(r, 16);
|
|
636
|
+
if (Number.isNaN(i)) throw Error("Guid string contains invalid characters");
|
|
637
|
+
return i >>> 0;
|
|
638
|
+
}
|
|
639
|
+
static writeUInt32LE(e, t, n) {
|
|
640
|
+
let r = n >>> 0;
|
|
641
|
+
e[t] = r & 255, e[t + 1] = r >>> 8 & 255, e[t + 2] = r >>> 16 & 255, e[t + 3] = r >>> 24 & 255;
|
|
642
|
+
}
|
|
643
|
+
static writeUInt16LE(e, t, n) {
|
|
644
|
+
let r = n & 65535;
|
|
645
|
+
e[t] = r & 255, e[t + 1] = r >>> 8 & 255;
|
|
646
|
+
}
|
|
647
|
+
static readUInt32LE(e, t) {
|
|
648
|
+
return (e[t] | e[t + 1] << 8 | e[t + 2] << 16 | e[t + 3] << 24) >>> 0;
|
|
649
|
+
}
|
|
650
|
+
static readUInt16LE(e, t) {
|
|
651
|
+
return (e[t] | e[t + 1] << 8) & 65535;
|
|
652
|
+
}
|
|
653
|
+
static toHex(e, t) {
|
|
654
|
+
return (e >>> 0).toString(16).padStart(t, "0");
|
|
655
|
+
}
|
|
656
|
+
}, D = class e {
|
|
657
|
+
static INITIAL_CAPACITY = 256;
|
|
658
|
+
buffer;
|
|
659
|
+
dataView;
|
|
660
|
+
length = 0;
|
|
661
|
+
constructor() {
|
|
662
|
+
this.buffer = new Uint8Array(e.INITIAL_CAPACITY), this.dataView = new DataView(this.buffer.buffer);
|
|
663
|
+
}
|
|
664
|
+
ensureCapacity(e) {
|
|
665
|
+
let t = this.length + e;
|
|
666
|
+
if (t <= this.buffer.length) return;
|
|
667
|
+
let n = this.buffer.length;
|
|
668
|
+
for (; n < t;) n *= 2;
|
|
669
|
+
let r = new Uint8Array(n);
|
|
670
|
+
r.set(this.buffer.subarray(0, this.length)), this.buffer = r, this.dataView = new DataView(this.buffer.buffer);
|
|
671
|
+
}
|
|
672
|
+
writeByte(e) {
|
|
673
|
+
this.ensureCapacity(1), this.buffer[this.length++] = e & 255;
|
|
674
|
+
}
|
|
675
|
+
writeBytes(e) {
|
|
676
|
+
this.ensureCapacity(e.length), this.buffer.set(e, this.length), this.length += e.length;
|
|
677
|
+
}
|
|
678
|
+
writeUInt32(e) {
|
|
679
|
+
this.ensureCapacity(4), this.dataView.setUint32(this.length, e >>> 0, !0), this.length += 4;
|
|
680
|
+
}
|
|
681
|
+
writeInt32(e) {
|
|
682
|
+
this.ensureCapacity(4), this.dataView.setInt32(this.length, e | 0, !0), this.length += 4;
|
|
683
|
+
}
|
|
684
|
+
writeFloat32(e) {
|
|
685
|
+
this.ensureCapacity(4), this.dataView.setFloat32(this.length, e, !0), this.length += 4;
|
|
686
|
+
}
|
|
687
|
+
writeFloat64(e) {
|
|
688
|
+
this.ensureCapacity(8), this.dataView.setFloat64(this.length, e, !0), this.length += 8;
|
|
689
|
+
}
|
|
690
|
+
writeBigInt64(e) {
|
|
691
|
+
this.ensureCapacity(8), this.dataView.setBigInt64(this.length, e, !0), this.length += 8;
|
|
692
|
+
}
|
|
693
|
+
writeBigUInt64(e) {
|
|
694
|
+
this.ensureCapacity(8), this.dataView.setBigUint64(this.length, e, !0), this.length += 8;
|
|
695
|
+
}
|
|
696
|
+
writeVarUInt(e) {
|
|
697
|
+
let t = e >>> 0;
|
|
698
|
+
for (; t >= 128;) this.ensureCapacity(1), this.buffer[this.length++] = t & 127 | 128, t >>>= 7;
|
|
699
|
+
this.ensureCapacity(1), this.buffer[this.length++] = t & 127;
|
|
700
|
+
}
|
|
701
|
+
toUint8Array() {
|
|
702
|
+
return this.buffer.slice(0, this.length);
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
function O(e, t, n) {
|
|
706
|
+
if (t.offset >= e.length) throw Error(n);
|
|
707
|
+
let r = 0, i = 0, a = 0;
|
|
708
|
+
for (; t.offset < e.length;) {
|
|
709
|
+
let n = e[t.offset++];
|
|
710
|
+
if (a++, i === 28 && n & 112) throw Error("Teleport VarUInt exceeds 32-bit range");
|
|
711
|
+
if (r |= (n & 127) << i, !(n & 128)) {
|
|
712
|
+
let e = r >>> 0;
|
|
713
|
+
if (a !== k(e)) throw Error("Teleport VarUInt is not canonical");
|
|
714
|
+
return e;
|
|
715
|
+
}
|
|
716
|
+
if (i += 7, i >= 35) throw Error("Teleport VarUInt exceeds 32-bit range");
|
|
717
|
+
}
|
|
718
|
+
throw Error(n);
|
|
719
|
+
}
|
|
720
|
+
function k(e) {
|
|
721
|
+
return e < 128 ? 1 : e < 16384 ? 2 : e < 2097152 ? 3 : e < 268435456 ? 4 : 5;
|
|
722
|
+
}
|
|
723
|
+
function A(e, t = 0) {
|
|
724
|
+
if (t & 240) throw Error("Teleport flags must fit into 4 bits");
|
|
725
|
+
return (e & 15) << 4 | t & 15;
|
|
726
|
+
}
|
|
727
|
+
function j(e) {
|
|
728
|
+
return e === 12 || e === 13 || e === 9 || e === 11 || e === 10;
|
|
729
|
+
}
|
|
730
|
+
function M(e) {
|
|
731
|
+
switch (e) {
|
|
732
|
+
case 3:
|
|
733
|
+
case 5:
|
|
734
|
+
case 7: return 4;
|
|
735
|
+
case 4:
|
|
736
|
+
case 6:
|
|
737
|
+
case 8: return 8;
|
|
738
|
+
case 14: return 16;
|
|
739
|
+
case 2: return 1;
|
|
740
|
+
case 1: return 0;
|
|
741
|
+
default: return -1;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
function N(e) {
|
|
745
|
+
if (e === 9 || e === 11 || e === 10 || e === 1) throw Error("Dictionary keys must be primitive Teleport types");
|
|
746
|
+
}
|
|
747
|
+
function P(e, t, n) {
|
|
748
|
+
if (t < 0 || n < 0 || t + n > e.length) throw Error("Teleport payload exceeds bounds");
|
|
749
|
+
}
|
|
750
|
+
function F(e, t) {
|
|
751
|
+
return (e[t] | e[t + 1] << 8 | e[t + 2] << 16 | e[t + 3] << 24) >>> 0;
|
|
752
|
+
}
|
|
753
|
+
var I = 128;
|
|
754
|
+
function L(e, t, n) {
|
|
755
|
+
if (n >= I) throw Error("Teleport nesting depth exceeded");
|
|
756
|
+
if (t >= e.length) throw Error("Array payload exceeds bounds");
|
|
757
|
+
let r = e[t], i = r >> 4 & 15;
|
|
758
|
+
if (r & 15) throw Error("Array flags must be zero");
|
|
759
|
+
let a = { offset: t + 1 }, o = O(e, a, "ArrayMalformed"), s = M(i);
|
|
760
|
+
if (s >= 0) {
|
|
761
|
+
let n = s * o;
|
|
762
|
+
return P(e, a.offset, n), a.offset + n - t;
|
|
763
|
+
}
|
|
764
|
+
let c = a.offset;
|
|
765
|
+
for (let t = 0; t < o; t++) c = z(i, e, c, "ArrayMalformed", n + 1);
|
|
766
|
+
return c - t;
|
|
767
|
+
}
|
|
768
|
+
function R(e, t, n) {
|
|
769
|
+
if (n >= I) throw Error("Teleport nesting depth exceeded");
|
|
770
|
+
if (t + 2 > e.length) throw Error("Dictionary payload too short");
|
|
771
|
+
let r = e[t] >> 4 & 15, i = e[t + 1] >> 4 & 15;
|
|
772
|
+
if (e[t] & 15 || e[t + 1] & 15) throw Error("Dictionary key/value flags must be zero");
|
|
773
|
+
N(r);
|
|
774
|
+
let a = { offset: t + 2 }, o = O(e, a, "DictMalformed"), s = a.offset;
|
|
775
|
+
for (let t = 0; t < o; t++) s = z(r, e, s, "DictMalformed", n + 1), s = z(i, e, s, "DictMalformed", n + 1);
|
|
776
|
+
return s - t;
|
|
777
|
+
}
|
|
778
|
+
function z(e, t, n, r, i) {
|
|
779
|
+
let a = M(e);
|
|
780
|
+
if (a >= 0) return P(t, n, a), n + a;
|
|
781
|
+
switch (e) {
|
|
782
|
+
case 12:
|
|
783
|
+
case 13: {
|
|
784
|
+
let e = { offset: n }, i = O(t, e, r);
|
|
785
|
+
return P(t, e.offset, i), e.offset + i;
|
|
786
|
+
}
|
|
787
|
+
case 11: {
|
|
788
|
+
let e = { offset: n }, i = O(t, e, r);
|
|
789
|
+
return P(t, e.offset, i), e.offset + i;
|
|
790
|
+
}
|
|
791
|
+
case 9: return n + L(t, n, i);
|
|
792
|
+
case 10: return n + R(t, n, i);
|
|
793
|
+
default: throw Error(`Unsupported Teleport type ${u[e]}`);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
function B(e) {
|
|
797
|
+
return Array.from(e).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
798
|
+
}
|
|
799
|
+
function V(e) {
|
|
800
|
+
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
801
|
+
}
|
|
802
|
+
//#endregion
|
|
803
|
+
//#region ../../shared/protocol/src/enums/log-type.ts
|
|
804
|
+
var H = /* @__PURE__ */ function(e) {
|
|
805
|
+
return e[e.None = 0] = "None", e[e.Trace = 1] = "Trace", e[e.Debug = 2] = "Debug", e[e.Info = 4] = "Info", e[e.Warning = 8] = "Warning", e[e.Error = 16] = "Error", e[e.Critical = 32] = "Critical", e[e.Event = 64] = "Event", e[e.Usage = 128] = "Usage", e[e.Exception = 256] = "Exception", e;
|
|
806
|
+
}({}), U = /* @__PURE__ */ function(e) {
|
|
807
|
+
return e[e.Unknown = 0] = "Unknown", e[e.Playing = 1] = "Playing", e[e.Blocked = 2] = "Blocked", e[e.Hidden = 3] = "Hidden", e;
|
|
808
|
+
}({}), W = /* @__PURE__ */ function(e) {
|
|
809
|
+
return e[e.Unknown = 0] = "Unknown", e[e.Opus = 1] = "Opus", e[e.Mp3 = 2] = "Mp3", e[e.RawPcm16 = 3] = "RawPcm16", e;
|
|
810
|
+
}({}), G = /* @__PURE__ */ function(e) {
|
|
811
|
+
return e[e.Unknown = 0] = "Unknown", e[e.MobileWeb = 1] = "MobileWeb", e[e.MobileApp = 2] = "MobileApp", e[e.DesktopWeb = 3] = "DesktopWeb", e[e.DesktopApp = 4] = "DesktopApp", e;
|
|
812
|
+
}({}), K = /* @__PURE__ */ function(e) {
|
|
813
|
+
return e[e.Unknown = 0] = "Unknown", e[e.Backend = 2] = "Backend", e[e.Server = 4] = "Server", e[e.Plugin = 8] = "Plugin", e[e.Browser = 16] = "Browser", e[e.Native = 32] = "Native", e;
|
|
814
|
+
}({}), q = /* @__PURE__ */ function(e) {
|
|
815
|
+
return e[e.None = 0] = "None", e[e.WebSocket = 1] = "WebSocket", e[e.WebSocketProxy = 2] = "WebSocketProxy", e[e.WebTransport = 4] = "WebTransport", e[e.WebTransportProxy = 8] = "WebTransportProxy", e[e.Tcp = 16] = "Tcp", e[e.TcpProxy = 32] = "TcpProxy", e[e.Https = 64] = "Https", e[e.WebRTC = 128] = "WebRTC", e[e.TcpTls = 256] = "TcpTls", e[e.Udp = 512] = "Udp", e[e.UdpDtls = 1024] = "UdpDtls", e[e.HttpStream = 2048] = "HttpStream", e[e.HttpStreamProxy = 4096] = "HttpStreamProxy", e;
|
|
816
|
+
}({}), J = /* @__PURE__ */ function(e) {
|
|
817
|
+
return e[e.None = 0] = "None", e[e.SendBackToSender = 1] = "SendBackToSender", e[e.Delayable = 2] = "Delayable", e[e.SendToUser = 4] = "SendToUser", e[e.Compressed = 8] = "Compressed", e[e.Unreliable = 16] = "Unreliable", e;
|
|
818
|
+
}({}), Y = /* @__PURE__ */ function(e) {
|
|
819
|
+
return e[e.Unknown = 0] = "Unknown", e[e.MessagePack = 1] = "MessagePack", e[e.MemoryPack = 2] = "MemoryPack", e[e.Json = 4] = "Json", e[e.Teleport = 8] = "Teleport", e[e.All = 15] = "All", e;
|
|
820
|
+
}({}), X = /* @__PURE__ */ function(e) {
|
|
821
|
+
return e[e.Css = 0] = "Css", e[e.Flutter = 1] = "Flutter", e;
|
|
822
|
+
}({}), Z = /* @__PURE__ */ function(e) {
|
|
823
|
+
return e[e.Unknown = 0] = "Unknown", e[e.Machine = 1] = "Machine", e[e.Human = 2] = "Human", e;
|
|
824
|
+
}({}), Q = /* @__PURE__ */ function(e) {
|
|
825
|
+
return e[e.Unknown = 0] = "Unknown", e[e.H264 = 1] = "H264", e[e.Vp8 = 2] = "Vp8", e[e.Vp9 = 3] = "Vp9", e[e.Av1 = 4] = "Av1", e;
|
|
826
|
+
}({}), $ = /* @__PURE__ */ function(e) {
|
|
827
|
+
return e[e.Unknown = 0] = "Unknown", e[e.DotNet = 1] = "DotNet", e[e.TypeScript = 2] = "TypeScript", e[e.Cpp = 3] = "Cpp", e[e.Dart = 4] = "Dart", e[e.Rust = 5] = "Rust", e;
|
|
828
|
+
}({}), ee = /* @__PURE__ */ function(e) {
|
|
829
|
+
return e[e.Local = 0] = "Local", e[e.Cloud = 1] = "Cloud", e;
|
|
830
|
+
}({});
|
|
831
|
+
//#endregion
|
|
832
|
+
export { a as C, i as S, s as T, h as _, q as a, c as b, Y as c, X as d, Z as f, y as g, E as h, K as i, $ as l, e as m, U as n, H as o, Q as p, G as r, J as s, W as t, ee as u, u as v, o as w, r as x, n as y };
|