@ikonai/sdk 1.0.6 → 1.0.8
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/assets/{audio-capture-worker-kpORDYGU.js → audio-capture-worker-D0tD-mzj.js} +105 -80
- package/assets/{audio-playback-worker-DPybcm1k.js → audio-playback-worker-CM2aCt54.js} +295 -263
- package/assets/{protocol-worker-DIKCgk1A.js → protocol-worker-CH5R2dxZ.js} +116 -93
- package/assets/{video-capture-worker-DP3lFDjq.js → video-capture-worker-DZZ0ggvo.js} +32 -32
- package/assets/{video-playback-worker-qauTQ7Et.js → video-playback-worker-C7sQMgD-.js} +9 -9
- package/client/ikon-client-config.d.ts +0 -14
- package/functions/function-registry.d.ts +32 -1
- package/index.d.ts +4 -3
- package/index.js +1406 -1294
- package/package.json +1 -1
- package/utils/debug-mode.d.ts +14 -0
- package/utils/logger.d.ts +17 -0
|
@@ -10,7 +10,7 @@ function X(t) {
|
|
|
10
10
|
const e = Et(t), r = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
11
11
|
if (e.length < 27)
|
|
12
12
|
throw new Error("Protocol payload too short");
|
|
13
|
-
const s = r.getUint32(0, !0), n = r.getUint32(4, !0), i = r.getUint32(8, !0), o = r.getUint32(12, !0),
|
|
13
|
+
const s = r.getUint32(0, !0), n = r.getUint32(4, !0), i = r.getUint32(8, !0), o = r.getUint32(12, !0), h = r.getUint32(16, !0), a = r.getUint32(20, !0), l = r.getUint8(24), f = r.getUint8(25), _ = r.getUint8(26);
|
|
14
14
|
if (27 + a * 4 > e.length)
|
|
15
15
|
throw new Error("Protocol header exceeds payload length");
|
|
16
16
|
const I = [];
|
|
@@ -22,9 +22,9 @@ function X(t) {
|
|
|
22
22
|
opcode: n,
|
|
23
23
|
senderId: i,
|
|
24
24
|
trackId: o,
|
|
25
|
-
sequenceId:
|
|
25
|
+
sequenceId: h,
|
|
26
26
|
targetIds: I,
|
|
27
|
-
payloadVersion:
|
|
27
|
+
payloadVersion: l,
|
|
28
28
|
payloadType: f,
|
|
29
29
|
flags: _
|
|
30
30
|
};
|
|
@@ -69,7 +69,7 @@ class M {
|
|
|
69
69
|
this.writeFixedField(e, 2, () => this.buffer.writeByte(r ? 1 : 0));
|
|
70
70
|
}
|
|
71
71
|
writeGuidField(e, r) {
|
|
72
|
-
const s = r instanceof
|
|
72
|
+
const s = r instanceof E ? r.asBytes() : r;
|
|
73
73
|
if (s.length !== 16)
|
|
74
74
|
throw new Error("Guid payload must be 16 bytes");
|
|
75
75
|
this.writeFixedField(e, 14, () => this.buffer.writeBytes(s));
|
|
@@ -165,7 +165,7 @@ class W {
|
|
|
165
165
|
14
|
|
166
166
|
/* Guid */
|
|
167
167
|
), this.count++;
|
|
168
|
-
const r = e instanceof
|
|
168
|
+
const r = e instanceof E ? e.asBytes() : e;
|
|
169
169
|
if (r.length !== 16)
|
|
170
170
|
throw new Error("Guid payload must be 16 bytes");
|
|
171
171
|
this.payload.writeBytes(r);
|
|
@@ -298,7 +298,7 @@ class ot {
|
|
|
298
298
|
14
|
|
299
299
|
/* Guid */
|
|
300
300
|
);
|
|
301
|
-
const r = e instanceof
|
|
301
|
+
const r = e instanceof E ? e.asBytes() : e;
|
|
302
302
|
if (r.length !== 16)
|
|
303
303
|
throw new Error("Guid payload must be 16 bytes");
|
|
304
304
|
this.payload.writeBytes(r), this.keyWritten = !0;
|
|
@@ -364,7 +364,7 @@ class ot {
|
|
|
364
364
|
14
|
|
365
365
|
/* Guid */
|
|
366
366
|
);
|
|
367
|
-
const r = e instanceof
|
|
367
|
+
const r = e instanceof E ? e.asBytes() : e;
|
|
368
368
|
if (r.length !== 16)
|
|
369
369
|
throw new Error("Guid payload must be 16 bytes");
|
|
370
370
|
this.payload.writeBytes(r), this.valueWritten = !0;
|
|
@@ -435,7 +435,7 @@ class ot {
|
|
|
435
435
|
throw new Error(`Dictionary value type is ${g[this.valueType]}, expected ${g[e]}`);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
class
|
|
438
|
+
class E {
|
|
439
439
|
constructor(e) {
|
|
440
440
|
this.bytes = e;
|
|
441
441
|
}
|
|
@@ -445,19 +445,19 @@ class l {
|
|
|
445
445
|
const r = e.replace(/-/g, "");
|
|
446
446
|
if (r.length !== 32)
|
|
447
447
|
throw new Error("Guid string must be 32 hex characters");
|
|
448
|
-
const s = new Uint8Array(16), n =
|
|
449
|
-
|
|
450
|
-
for (let
|
|
451
|
-
s[8 +
|
|
452
|
-
return new
|
|
448
|
+
const s = new Uint8Array(16), n = E.parseHexSlice(r, 0, 8), i = E.parseHexSlice(r, 8, 4), o = E.parseHexSlice(r, 12, 4);
|
|
449
|
+
E.writeUInt32LE(s, 0, n), E.writeUInt16LE(s, 4, i), E.writeUInt16LE(s, 6, o);
|
|
450
|
+
for (let h = 0; h < 8; h++)
|
|
451
|
+
s[8 + h] = E.parseHexSlice(r, 16 + h * 2, 2);
|
|
452
|
+
return new E(s);
|
|
453
453
|
}
|
|
454
454
|
static fromBytes(e) {
|
|
455
455
|
if (e.length !== 16)
|
|
456
456
|
throw new Error("Guid byte array must be 16 bytes");
|
|
457
|
-
return new
|
|
457
|
+
return new E(Uint8Array.from(e));
|
|
458
458
|
}
|
|
459
459
|
static createZero() {
|
|
460
|
-
return new
|
|
460
|
+
return new E(new Uint8Array(16));
|
|
461
461
|
}
|
|
462
462
|
static createRandom() {
|
|
463
463
|
const e = new Uint8Array(16), r = globalThis.crypto;
|
|
@@ -466,14 +466,14 @@ class l {
|
|
|
466
466
|
else
|
|
467
467
|
for (let s = 0; s < e.length; s++)
|
|
468
468
|
e[s] = Math.floor(Math.random() * 256);
|
|
469
|
-
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new
|
|
469
|
+
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new E(e);
|
|
470
470
|
}
|
|
471
471
|
toString() {
|
|
472
472
|
const e = this.bytes;
|
|
473
473
|
return [
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
474
|
+
E.toHex(E.readUInt32LE(e, 0), 8),
|
|
475
|
+
E.toHex(E.readUInt16LE(e, 4), 4),
|
|
476
|
+
E.toHex(E.readUInt16LE(e, 6), 4),
|
|
477
477
|
j(e.subarray(8, 10)),
|
|
478
478
|
j(e.subarray(10, 16))
|
|
479
479
|
].join("-");
|
|
@@ -575,7 +575,7 @@ function j(t) {
|
|
|
575
575
|
function Et(t) {
|
|
576
576
|
return t instanceof Uint8Array ? t : new Uint8Array(t);
|
|
577
577
|
}
|
|
578
|
-
var U = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.WebSocket = 1] = "WebSocket", t[t.WebSocketProxy = 2] = "WebSocketProxy", t[t.WebTransport = 4] = "WebTransport", t[t.WebTransportProxy = 8] = "WebTransportProxy", t[t.Tcp = 16] = "Tcp", t[t.TcpProxy = 32] = "TcpProxy", t[t.Https = 64] = "Https", t))(U || {}), B = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(B || {});
|
|
578
|
+
var w = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.WebSocket = 1] = "WebSocket", t[t.WebSocketProxy = 2] = "WebSocketProxy", t[t.WebTransport = 4] = "WebTransport", t[t.WebTransportProxy = 8] = "WebTransportProxy", t[t.Tcp = 16] = "Tcp", t[t.TcpProxy = 32] = "TcpProxy", t[t.Https = 64] = "Https", t))(w || {}), B = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", t[t.ACTION_CUSTOM_USER_MESSAGE = 1048641] = "ACTION_CUSTOM_USER_MESSAGE", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(B || {});
|
|
579
579
|
const J = 1, _t = 131074;
|
|
580
580
|
function Z(t) {
|
|
581
581
|
return {};
|
|
@@ -622,24 +622,47 @@ function ct(t, e) {
|
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
624
|
let ut = 1;
|
|
625
|
-
|
|
625
|
+
const At = /* @__PURE__ */ new Map(), Nt = {
|
|
626
|
+
0: "DEBUG",
|
|
627
|
+
1: "INFO",
|
|
628
|
+
2: "WARN",
|
|
629
|
+
3: "ERROR",
|
|
630
|
+
4: "NONE"
|
|
631
|
+
};
|
|
632
|
+
function ft(t, e) {
|
|
626
633
|
return `[${t}] ${e}`;
|
|
627
634
|
}
|
|
628
|
-
function
|
|
629
|
-
|
|
630
|
-
|
|
635
|
+
function G(t, e, r, s) {
|
|
636
|
+
const n = (/* @__PURE__ */ new Date()).toISOString(), i = Nt[t], o = {
|
|
637
|
+
timestamp: n,
|
|
638
|
+
level: t,
|
|
639
|
+
levelName: i,
|
|
640
|
+
component: e,
|
|
641
|
+
message: r,
|
|
642
|
+
args: s
|
|
643
|
+
};
|
|
644
|
+
for (const [h, a] of At) {
|
|
645
|
+
const l = a?.minLevel ?? 2;
|
|
646
|
+
if (t >= l)
|
|
647
|
+
try {
|
|
648
|
+
h(o);
|
|
649
|
+
} catch {
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
if (ut <= t) {
|
|
653
|
+
const h = ft(e, r);
|
|
631
654
|
switch (t) {
|
|
632
655
|
case 0:
|
|
633
|
-
console.debug(
|
|
656
|
+
console.debug(h, ...s);
|
|
634
657
|
break;
|
|
635
658
|
case 1:
|
|
636
|
-
console.info(
|
|
659
|
+
console.info(h, ...s);
|
|
637
660
|
break;
|
|
638
661
|
case 2:
|
|
639
|
-
console.warn(
|
|
662
|
+
console.warn(h, ...s);
|
|
640
663
|
break;
|
|
641
664
|
case 3:
|
|
642
|
-
console.error(
|
|
665
|
+
console.error(h, ...s);
|
|
643
666
|
break;
|
|
644
667
|
}
|
|
645
668
|
}
|
|
@@ -647,21 +670,21 @@ function V(t, e, r, s) {
|
|
|
647
670
|
function F(t) {
|
|
648
671
|
return {
|
|
649
672
|
debug(e, ...r) {
|
|
650
|
-
|
|
673
|
+
G(0, t, e, r);
|
|
651
674
|
},
|
|
652
675
|
info(e, ...r) {
|
|
653
|
-
|
|
676
|
+
G(1, t, e, r);
|
|
654
677
|
},
|
|
655
678
|
warn(e, ...r) {
|
|
656
|
-
|
|
679
|
+
G(2, t, e, r);
|
|
657
680
|
},
|
|
658
681
|
error(e, ...r) {
|
|
659
|
-
|
|
682
|
+
G(3, t, e, r);
|
|
660
683
|
}
|
|
661
684
|
};
|
|
662
685
|
}
|
|
663
|
-
const
|
|
664
|
-
class
|
|
686
|
+
const V = F("WebSocketTransport"), Ct = 1e4;
|
|
687
|
+
class Rt {
|
|
665
688
|
ws = null;
|
|
666
689
|
keepaliveTimeout = null;
|
|
667
690
|
// Pre-allocated keepalive response message to avoid allocation per keepalive
|
|
@@ -679,34 +702,34 @@ class ft {
|
|
|
679
702
|
return new Promise((s, n) => {
|
|
680
703
|
try {
|
|
681
704
|
this.ws = new WebSocket(e), this.ws.binaryType = "arraybuffer";
|
|
682
|
-
} catch (
|
|
683
|
-
n(new L(`Failed to create WebSocket: ${
|
|
705
|
+
} catch (l) {
|
|
706
|
+
n(new L(`Failed to create WebSocket: ${l}`, l instanceof Error ? l : void 0));
|
|
684
707
|
return;
|
|
685
708
|
}
|
|
686
709
|
let i = !1, o = !1;
|
|
687
|
-
const
|
|
710
|
+
const h = () => {
|
|
688
711
|
clearTimeout(a), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
|
|
689
712
|
}, a = setTimeout(() => {
|
|
690
|
-
o || (o = !0,
|
|
691
|
-
},
|
|
713
|
+
o || (o = !0, h(), this.ws?.close(), n(new L("WebSocket connection timeout")));
|
|
714
|
+
}, Ct);
|
|
692
715
|
this.ws.onopen = () => {
|
|
693
716
|
i = !0, clearTimeout(a), this.ws.send(r), this.resetKeepaliveTimeout(), o || (o = !0, s());
|
|
694
717
|
}, this.ws.onerror = () => {
|
|
695
|
-
clearTimeout(a),
|
|
696
|
-
}, this.ws.onclose = (
|
|
718
|
+
clearTimeout(a), V.error("WebSocket error"), o || (o = !0, h(), n(new L("WebSocket connection failed")));
|
|
719
|
+
}, this.ws.onclose = (l) => {
|
|
697
720
|
if (this.clearKeepaliveTimeout(), !i && !o) {
|
|
698
|
-
o = !0,
|
|
721
|
+
o = !0, h(), n(new L("WebSocket connection closed before opening"));
|
|
699
722
|
return;
|
|
700
723
|
}
|
|
701
|
-
const f =
|
|
724
|
+
const f = l.wasClean && (l.code === 1e3 || l.code === 1001), _ = l.code === 1e3 || l.code === 1001, m = l.reason || `code=${l.code}`;
|
|
702
725
|
this.callbacks.onClose(m, f, _);
|
|
703
|
-
}, this.ws.onmessage = (
|
|
704
|
-
this.handleProtocolMessage(new Uint8Array(
|
|
726
|
+
}, this.ws.onmessage = (l) => {
|
|
727
|
+
this.handleProtocolMessage(new Uint8Array(l.data));
|
|
705
728
|
};
|
|
706
729
|
});
|
|
707
730
|
}
|
|
708
731
|
send(e) {
|
|
709
|
-
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) :
|
|
732
|
+
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) : V.warn("Cannot send: WebSocket not connected");
|
|
710
733
|
}
|
|
711
734
|
close() {
|
|
712
735
|
this.clearKeepaliveTimeout(), this.ws && (this.ws.close(1e3, "Client closing"), this.ws = null);
|
|
@@ -725,23 +748,23 @@ class ft {
|
|
|
725
748
|
}
|
|
726
749
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
|
|
727
750
|
} catch (r) {
|
|
728
|
-
|
|
751
|
+
V.error("Failed to process protocol message:", r), this.callbacks.onError(r instanceof Error ? r : new Error(String(r)));
|
|
729
752
|
}
|
|
730
753
|
}
|
|
731
754
|
resetKeepaliveTimeout() {
|
|
732
755
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
733
|
-
|
|
756
|
+
V.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new z(this.keepaliveTimeoutMs)), this.close();
|
|
734
757
|
}, this.keepaliveTimeoutMs);
|
|
735
758
|
}
|
|
736
759
|
clearKeepaliveTimeout() {
|
|
737
760
|
this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
|
|
738
761
|
}
|
|
739
762
|
}
|
|
740
|
-
const C = F("WebTransportTransport"), q = 4,
|
|
763
|
+
const C = F("WebTransportTransport"), q = 4, yt = 65536;
|
|
741
764
|
function rt() {
|
|
742
765
|
return typeof WebTransport < "u";
|
|
743
766
|
}
|
|
744
|
-
class
|
|
767
|
+
class Ut {
|
|
745
768
|
transport = null;
|
|
746
769
|
stream = null;
|
|
747
770
|
reader = null;
|
|
@@ -749,7 +772,7 @@ class Rt {
|
|
|
749
772
|
keepaliveTimeout = null;
|
|
750
773
|
readLoopActive = !1;
|
|
751
774
|
// Grow-only receive buffer with offset/length tracking to minimize allocations
|
|
752
|
-
receiveBuffer = new Uint8Array(
|
|
775
|
+
receiveBuffer = new Uint8Array(yt);
|
|
753
776
|
receiveBufferOffset = 0;
|
|
754
777
|
receiveBufferLength = 0;
|
|
755
778
|
// Cached DataView to avoid allocation per message
|
|
@@ -904,7 +927,7 @@ class Rt {
|
|
|
904
927
|
}
|
|
905
928
|
}
|
|
906
929
|
const b = F("Channel");
|
|
907
|
-
class
|
|
930
|
+
class wt {
|
|
908
931
|
state = "disconnected";
|
|
909
932
|
transport = null;
|
|
910
933
|
config;
|
|
@@ -979,18 +1002,18 @@ class yt {
|
|
|
979
1002
|
}
|
|
980
1003
|
};
|
|
981
1004
|
switch (e.Type) {
|
|
982
|
-
case
|
|
983
|
-
case
|
|
984
|
-
this.transport = new
|
|
1005
|
+
case w.WebSocket:
|
|
1006
|
+
case w.WebSocketProxy:
|
|
1007
|
+
this.transport = new Rt(r);
|
|
985
1008
|
break;
|
|
986
|
-
case
|
|
987
|
-
case
|
|
1009
|
+
case w.WebTransport:
|
|
1010
|
+
case w.WebTransportProxy:
|
|
988
1011
|
if (!rt())
|
|
989
1012
|
throw new Error("WebTransport is not supported in this browser");
|
|
990
|
-
this.transport = new
|
|
1013
|
+
this.transport = new Ut(r);
|
|
991
1014
|
break;
|
|
992
1015
|
default:
|
|
993
|
-
throw new Error(`Unsupported entrypoint type: ${
|
|
1016
|
+
throw new Error(`Unsupported entrypoint type: ${w[e.Type]}`);
|
|
994
1017
|
}
|
|
995
1018
|
await this.transport.connect(e.Uri, e.AuthTicket);
|
|
996
1019
|
}
|
|
@@ -1029,7 +1052,7 @@ class yt {
|
|
|
1029
1052
|
}
|
|
1030
1053
|
}
|
|
1031
1054
|
const R = F("ChannelManager");
|
|
1032
|
-
class
|
|
1055
|
+
class St {
|
|
1033
1056
|
channels = /* @__PURE__ */ new Map();
|
|
1034
1057
|
// keyed by opcode group
|
|
1035
1058
|
activeType = null;
|
|
@@ -1110,7 +1133,7 @@ class wt {
|
|
|
1110
1133
|
await this.connectAllChannels(i), this.config.endpointSelector?.rememberWorkingType(n), this.config.onRememberWorkingType?.(n), this.activeType = n, this.reconnectAttempts = 0, this.setState("connected");
|
|
1111
1134
|
return;
|
|
1112
1135
|
} catch (o) {
|
|
1113
|
-
R.warn(`Failed to connect using ${
|
|
1136
|
+
R.warn(`Failed to connect using ${w[n]}: ${o}`), this.disconnectAll();
|
|
1114
1137
|
}
|
|
1115
1138
|
}
|
|
1116
1139
|
throw R.error("All endpoint types failed"), e || this.setState("offline"), new Error("Failed to connect using any endpoint type");
|
|
@@ -1131,7 +1154,7 @@ class wt {
|
|
|
1131
1154
|
* Connect a single channel.
|
|
1132
1155
|
*/
|
|
1133
1156
|
async connectChannel(e) {
|
|
1134
|
-
const r = new
|
|
1157
|
+
const r = new wt({
|
|
1135
1158
|
entrypoint: e,
|
|
1136
1159
|
sessionId: this.config.sessionId,
|
|
1137
1160
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
@@ -1217,7 +1240,7 @@ const st = F("ProtocolWorker"), S = (t, e) => {
|
|
|
1217
1240
|
self.postMessage(t, e ?? []);
|
|
1218
1241
|
};
|
|
1219
1242
|
let N = null, H, c = null;
|
|
1220
|
-
const
|
|
1243
|
+
const U = [], u = [], D = /* @__PURE__ */ new Map(), A = [], T = [], y = /* @__PURE__ */ new Map(), x = [];
|
|
1221
1244
|
function Y() {
|
|
1222
1245
|
try {
|
|
1223
1246
|
N?.disconnect();
|
|
@@ -1230,7 +1253,7 @@ function Y() {
|
|
|
1230
1253
|
u[t].port.close();
|
|
1231
1254
|
} catch {
|
|
1232
1255
|
}
|
|
1233
|
-
|
|
1256
|
+
U.length = 0, u.length = 0, D.clear();
|
|
1234
1257
|
for (let t = 0; t < T.length; t++)
|
|
1235
1258
|
try {
|
|
1236
1259
|
T[t].port.close();
|
|
@@ -1242,22 +1265,22 @@ function v(t) {
|
|
|
1242
1265
|
const e = t instanceof Error ? t : new Error(String(t));
|
|
1243
1266
|
S({ type: "error", error: { name: e.name, message: e.message, stack: e.stack } });
|
|
1244
1267
|
}
|
|
1245
|
-
function
|
|
1268
|
+
function gt() {
|
|
1246
1269
|
let t = 0;
|
|
1247
1270
|
for (let e = 0; e < u.length; e++)
|
|
1248
1271
|
t |= u[e].opcodeGroupsMask;
|
|
1249
1272
|
return t;
|
|
1250
1273
|
}
|
|
1251
|
-
function
|
|
1274
|
+
function Lt(t) {
|
|
1252
1275
|
if (H === void 0)
|
|
1253
1276
|
return !0;
|
|
1254
1277
|
const e = K(t);
|
|
1255
1278
|
if ((e & H) !== 0)
|
|
1256
1279
|
return !0;
|
|
1257
|
-
const r =
|
|
1280
|
+
const r = gt();
|
|
1258
1281
|
return (e & r) !== 0;
|
|
1259
1282
|
}
|
|
1260
|
-
function
|
|
1283
|
+
function Pt(t) {
|
|
1261
1284
|
x.length = 0;
|
|
1262
1285
|
for (let e = 0; e < u.length; e++) {
|
|
1263
1286
|
const r = u[e];
|
|
@@ -1265,25 +1288,25 @@ function gt(t) {
|
|
|
1265
1288
|
}
|
|
1266
1289
|
return x;
|
|
1267
1290
|
}
|
|
1268
|
-
function
|
|
1291
|
+
function mt(t, e) {
|
|
1269
1292
|
return (K(t) & e) !== 0;
|
|
1270
1293
|
}
|
|
1271
|
-
function
|
|
1294
|
+
function dt(t, e) {
|
|
1272
1295
|
if (!N || !e || typeof e != "object")
|
|
1273
1296
|
return;
|
|
1274
1297
|
const r = e;
|
|
1275
1298
|
if (!(r.type !== "send" || !(r.message instanceof ArrayBuffer)))
|
|
1276
1299
|
try {
|
|
1277
1300
|
const s = new Uint8Array(r.message);
|
|
1278
|
-
if (!
|
|
1301
|
+
if (!mt(s, t))
|
|
1279
1302
|
return;
|
|
1280
1303
|
N.sendProtocolMessage(s), c && c.postMessage({ direction: "sent", message: Array.from(s) });
|
|
1281
1304
|
} catch (s) {
|
|
1282
1305
|
v(s);
|
|
1283
1306
|
}
|
|
1284
1307
|
}
|
|
1285
|
-
async function
|
|
1286
|
-
Y(), N = new
|
|
1308
|
+
async function Ot(t) {
|
|
1309
|
+
Y(), N = new St({
|
|
1287
1310
|
sessionId: t.sessionId,
|
|
1288
1311
|
keepaliveTimeoutMs: t.keepaliveTimeoutMs,
|
|
1289
1312
|
reconnectBackoffMs: t.reconnectBackoffMs,
|
|
@@ -1300,35 +1323,35 @@ async function mt(t) {
|
|
|
1300
1323
|
},
|
|
1301
1324
|
onProtocolMessage: (e) => {
|
|
1302
1325
|
c && (c.postMessage({ direction: "received", message: Array.from(e) }), $(e) === B.ANALYTICS_LOGS && c.postMessage({ type: "serverLogs", message: Array.from(e) }));
|
|
1303
|
-
const r = K(e), s =
|
|
1326
|
+
const r = K(e), s = Lt(e), n = Pt(r);
|
|
1304
1327
|
if (!(!s && n.length === 0))
|
|
1305
1328
|
try {
|
|
1306
|
-
const i = X(e), o = e.buffer instanceof ArrayBuffer && e.byteOffset === 0 && e.byteLength === e.buffer.byteLength,
|
|
1307
|
-
if (
|
|
1329
|
+
const i = X(e), o = e.buffer instanceof ArrayBuffer && e.byteOffset === 0 && e.byteLength === e.buffer.byteLength, h = n.length > 0;
|
|
1330
|
+
if (h && !s && n.length === 1 && o) {
|
|
1308
1331
|
const a = e.buffer;
|
|
1309
1332
|
n[0].postMessage({ type: "protocol", message: a, headers: i }, [a]);
|
|
1310
1333
|
return;
|
|
1311
1334
|
}
|
|
1312
|
-
if (!
|
|
1335
|
+
if (!h && s && o) {
|
|
1313
1336
|
const a = e.buffer;
|
|
1314
1337
|
S({ type: "protocol", message: a, headers: i }, [a]);
|
|
1315
1338
|
return;
|
|
1316
1339
|
}
|
|
1317
|
-
if (
|
|
1340
|
+
if (h && o) {
|
|
1318
1341
|
const a = [];
|
|
1319
1342
|
for (let _ = 1; _ < n.length; _++)
|
|
1320
1343
|
a.push(e.slice().buffer);
|
|
1321
|
-
const
|
|
1344
|
+
const l = s ? e.slice().buffer : null, f = e.buffer;
|
|
1322
1345
|
n[0].postMessage({ type: "protocol", message: f, headers: i }, [f]);
|
|
1323
1346
|
for (let _ = 1; _ < n.length; _++)
|
|
1324
1347
|
n[_].postMessage({ type: "protocol", message: a[_ - 1], headers: i }, [a[_ - 1]]);
|
|
1325
|
-
|
|
1348
|
+
l && S({ type: "protocol", message: l, headers: i }, [l]);
|
|
1326
1349
|
return;
|
|
1327
1350
|
}
|
|
1328
|
-
if (
|
|
1351
|
+
if (h)
|
|
1329
1352
|
for (const a of n) {
|
|
1330
|
-
const
|
|
1331
|
-
a.postMessage({ type: "protocol", message:
|
|
1353
|
+
const l = e.slice().buffer;
|
|
1354
|
+
a.postMessage({ type: "protocol", message: l, headers: i }, [l]);
|
|
1332
1355
|
}
|
|
1333
1356
|
if (s) {
|
|
1334
1357
|
const a = e.slice().buffer;
|
|
@@ -1343,7 +1366,7 @@ async function mt(t) {
|
|
|
1343
1366
|
self.addEventListener("message", (t) => {
|
|
1344
1367
|
const e = t.data;
|
|
1345
1368
|
if (e.type === "connect") {
|
|
1346
|
-
|
|
1369
|
+
Ot(e).catch((r) => {
|
|
1347
1370
|
st.error(`Failed to connect: ${r}`), v(r), Y();
|
|
1348
1371
|
});
|
|
1349
1372
|
return;
|
|
@@ -1376,8 +1399,8 @@ self.addEventListener("message", (t) => {
|
|
|
1376
1399
|
e.port.start?.();
|
|
1377
1400
|
} catch {
|
|
1378
1401
|
}
|
|
1379
|
-
const r =
|
|
1380
|
-
|
|
1402
|
+
const r = U.length;
|
|
1403
|
+
U.push(e.portId), u.push({ port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }), D.set(e.portId, r);
|
|
1381
1404
|
return;
|
|
1382
1405
|
}
|
|
1383
1406
|
if (e.type === "detachPort") {
|
|
@@ -1388,12 +1411,12 @@ self.addEventListener("message", (t) => {
|
|
|
1388
1411
|
s.port.close();
|
|
1389
1412
|
} catch {
|
|
1390
1413
|
}
|
|
1391
|
-
const n =
|
|
1414
|
+
const n = U.length - 1;
|
|
1392
1415
|
if (r !== n) {
|
|
1393
|
-
const i =
|
|
1394
|
-
|
|
1416
|
+
const i = U[n];
|
|
1417
|
+
U[r] = i, u[r] = u[n], D.set(i, r);
|
|
1395
1418
|
}
|
|
1396
|
-
|
|
1419
|
+
U.length--, u.length--, D.delete(e.portId);
|
|
1397
1420
|
}
|
|
1398
1421
|
return;
|
|
1399
1422
|
}
|
|
@@ -1407,8 +1430,8 @@ self.addEventListener("message", (t) => {
|
|
|
1407
1430
|
}
|
|
1408
1431
|
const o = A.length - 1;
|
|
1409
1432
|
if (r !== o) {
|
|
1410
|
-
const
|
|
1411
|
-
A[r] =
|
|
1433
|
+
const h = A[o];
|
|
1434
|
+
A[r] = h, T[r] = T[o], y.set(h, r);
|
|
1412
1435
|
}
|
|
1413
1436
|
A.length--, T.length--, y.delete(e.portId);
|
|
1414
1437
|
}
|
|
@@ -1419,7 +1442,7 @@ self.addEventListener("message", (t) => {
|
|
|
1419
1442
|
} catch {
|
|
1420
1443
|
}
|
|
1421
1444
|
s.port.addEventListener("message", (i) => {
|
|
1422
|
-
|
|
1445
|
+
dt(s.opcodeGroupsMask, i.data);
|
|
1423
1446
|
});
|
|
1424
1447
|
return;
|
|
1425
1448
|
}
|