@ikonai/sdk 1.0.3 → 1.0.4

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.
@@ -5,17 +5,17 @@ function J(t) {
5
5
  const n = e.getUint32(0, !0), s = e.getUint32(4, !0), E = e.getUint32(8, !0), _ = e.getUint32(12, !0), I = e.getUint32(16, !0), f = e.getUint32(20, !0), q = e.getUint8(24), j = e.getUint8(25), Q = e.getUint8(26);
6
6
  if (27 + f * 4 > r.length)
7
7
  throw new Error("Protocol header exceeds payload length");
8
- const G = [];
8
+ const M = [];
9
9
  let B = 27;
10
10
  for (let b = 0; b < f; b++)
11
- G.push(e.getUint32(B, !0)), B += 4;
11
+ M.push(e.getUint32(B, !0)), B += 4;
12
12
  return {
13
13
  length: n,
14
14
  opcode: s,
15
15
  senderId: E,
16
16
  trackId: _,
17
17
  sequenceId: I,
18
- targetIds: G,
18
+ targetIds: M,
19
19
  payloadVersion: q,
20
20
  payloadType: j,
21
21
  flags: Q
@@ -25,8 +25,6 @@ function K(t, r, e) {
25
25
  const n = O(t), s = J(n);
26
26
  if (r !== void 0 && s.opcode !== r)
27
27
  throw new Error(`Unexpected opcode ${s.opcode}`);
28
- if (s.payloadVersion !== e)
29
- throw new Error(`Unexpected payload version ${s.payloadVersion}`);
30
28
  if (s.payloadType !== 8)
31
29
  throw new Error(`Unexpected payload type ${s.payloadType}`);
32
30
  const E = 27 + s.targetIds.length * 4;
@@ -233,7 +231,7 @@ class m {
233
231
  return this.offset += r, new D(9, e);
234
232
  }
235
233
  case 10: {
236
- const r = M(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
234
+ const r = G(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
237
235
  return this.offset += r, new D(10, e);
238
236
  }
239
237
  default:
@@ -309,7 +307,7 @@ class F {
309
307
  return this.offset += r, new N(9, e);
310
308
  }
311
309
  case 10: {
312
- const r = M(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
310
+ const r = G(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
313
311
  return this.offset += r, new N(10, e);
314
312
  }
315
313
  case 3:
@@ -375,8 +373,8 @@ class i {
375
373
  i.toHex(i.readUInt32LE(r, 0), 8),
376
374
  i.toHex(i.readUInt16LE(r, 4), 4),
377
375
  i.toHex(i.readUInt16LE(r, 6), 4),
378
- d(r.subarray(8, 10)),
379
- d(r.subarray(10, 16))
376
+ H(r.subarray(8, 10)),
377
+ H(r.subarray(10, 16))
380
378
  ].join("-");
381
379
  }
382
380
  asBytes() {
@@ -472,7 +470,7 @@ function V(t, r) {
472
470
  I = g(n, t, I, "ArrayMalformed");
473
471
  return I - r;
474
472
  }
475
- function M(t, r) {
473
+ function G(t, r) {
476
474
  if (r + 2 > t.length)
477
475
  throw new Error("Dictionary payload too short");
478
476
  const e = t[r] >> 4 & 15, n = t[r + 1] >> 4 & 15;
@@ -502,131 +500,131 @@ function g(t, r, e, n) {
502
500
  case 9:
503
501
  return e + V(r, e);
504
502
  case 10:
505
- return e + M(r, e);
503
+ return e + G(r, e);
506
504
  default:
507
505
  throw new Error(`Unsupported Teleport type ${R[t]}`);
508
506
  }
509
507
  }
510
- function d(t) {
508
+ function H(t) {
511
509
  return Array.from(t).map((r) => r.toString(16).padStart(2, "0")).join("");
512
510
  }
513
511
  function O(t) {
514
512
  return t instanceof Uint8Array ? t : new Uint8Array(t);
515
513
  }
516
514
  var u = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.H264 = 1] = "H264", t[t.Vp8 = 2] = "Vp8", t[t.Vp9 = 3] = "Vp9", t[t.Av1 = 4] = "Av1", t))(u || {}), L = /* @__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.ANALYTICS_DEVTOOLS_CONSOLE_OUTPUT = 524297] = "ANALYTICS_DEVTOOLS_CONSOLE_OUTPUT", 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.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))(L || {});
517
- const Et = 1, _t = 8388609, it = 164808083, It = 1368629611, at = 2739413426, Tt = 2768375929, At = 2950031986, Nt = 3284746250, ft = 4065070594;
518
- function ot(t) {
515
+ const Et = 8388609, _t = 164808083, it = 1368629611, It = 2739413426, at = 2768375929, Tt = 2950031986, At = 3284746250, Nt = 4065070594;
516
+ function ft(t) {
519
517
  const r = {};
520
518
  return v(r), r;
521
519
  }
522
520
  function v(t) {
523
521
  return t.Description = "", t.Codec = u.H264, t.Width = 0, t.Height = 0, t.Framerate = 30, t.Bitrate = 0, t.IsHardwareAccelerated = !1, t;
524
522
  }
525
- function Ct(t, r) {
523
+ function ot(t, r) {
526
524
  const e = w.create(t);
527
- return ut(e, r);
525
+ return Ct(e, r);
528
526
  }
529
- function ut(t, r) {
530
- const e = r ?? ot();
531
- return v(e), ht(t, e), e;
527
+ function Ct(t, r) {
528
+ const e = r ?? ft();
529
+ return v(e), ut(t, e), e;
532
530
  }
533
- function ht(t, r) {
531
+ function ut(t, r) {
534
532
  let e;
535
533
  for (; (e = t.next()) !== null; )
536
534
  switch (e.fieldId) {
537
- case it: {
535
+ case _t: {
538
536
  if (e.isNull) throw new Error();
539
537
  r.Framerate = e.asInt32();
540
538
  break;
541
539
  }
542
- case It: {
540
+ case it: {
543
541
  if (e.isNull) throw new Error();
544
542
  r.Description = e.asString();
545
543
  break;
546
544
  }
547
- case at: {
545
+ case It: {
548
546
  if (e.isNull) throw new Error();
549
547
  r.IsHardwareAccelerated = e.asBool();
550
548
  break;
551
549
  }
552
- case Tt: {
550
+ case at: {
553
551
  if (e.isNull) throw new Error();
554
552
  r.Bitrate = e.asInt32();
555
553
  break;
556
554
  }
557
- case At: {
555
+ case Tt: {
558
556
  if (e.isNull) throw new Error();
559
557
  r.Height = e.asInt32();
560
558
  break;
561
559
  }
562
- case Nt: {
560
+ case At: {
563
561
  if (e.isNull) throw new Error();
564
562
  r.Codec = e.asInt32();
565
563
  break;
566
564
  }
567
- case ft: {
565
+ case Nt: {
568
566
  if (e.isNull) throw new Error();
569
567
  r.Width = e.asInt32();
570
568
  break;
571
569
  }
572
570
  }
573
571
  }
574
- function Rt(t, r) {
575
- const e = K(t, _t, Et);
576
- return Ct(e, r);
572
+ function ht(t, r) {
573
+ const e = K(t, Et);
574
+ return ot(e, r);
577
575
  }
578
- const Ut = 1, lt = 8388611, St = 271275304, Dt = 2541432218, Lt = 2986785889, ct = 3105403172, yt = 3456383222;
579
- function wt(t) {
576
+ const Rt = 8388611, Ut = 271275304, lt = 2541432218, St = 2986785889, Dt = 3105403172, Lt = 3456383222;
577
+ function ct(t) {
580
578
  const r = {};
581
579
  return Y(r), r;
582
580
  }
583
581
  function Y(t) {
584
582
  return t.Data = new Uint8Array(0), t.FrameNumber = 0, t.IsKey = !1, t.TimestampInUs = 0n, t.DurationInUs = 0, t;
585
583
  }
586
- function Ot(t, r) {
584
+ function yt(t, r) {
587
585
  const e = w.create(t);
588
- return Pt(e, r);
586
+ return wt(e, r);
589
587
  }
590
- function Pt(t, r) {
591
- const e = r ?? wt();
592
- return Y(e), gt(t, e), e;
588
+ function wt(t, r) {
589
+ const e = r ?? ct();
590
+ return Y(e), Ot(t, e), e;
593
591
  }
594
- function gt(t, r) {
592
+ function Ot(t, r) {
595
593
  let e;
596
594
  for (; (e = t.next()) !== null; )
597
595
  switch (e.fieldId) {
598
- case St: {
596
+ case Ut: {
599
597
  if (e.isNull) throw new Error();
600
598
  r.TimestampInUs = e.asUInt64();
601
599
  break;
602
600
  }
603
- case Dt: {
601
+ case lt: {
604
602
  if (e.isNull) throw new Error();
605
603
  r.DurationInUs = e.asUInt32();
606
604
  break;
607
605
  }
608
- case Lt: {
606
+ case St: {
609
607
  if (e.isNull) throw new Error();
610
608
  r.Data = e.asBinary();
611
609
  break;
612
610
  }
613
- case ct: {
611
+ case Dt: {
614
612
  if (e.isNull) throw new Error();
615
613
  r.IsKey = e.asBool();
616
614
  break;
617
615
  }
618
- case yt: {
616
+ case Lt: {
619
617
  if (e.isNull) throw new Error();
620
618
  r.FrameNumber = e.asInt32();
621
619
  break;
622
620
  }
623
621
  }
624
622
  }
625
- function mt(t, r) {
626
- const e = K(t, lt, Ut);
627
- return Ot(e, r);
623
+ function Pt(t, r) {
624
+ const e = K(t, Rt);
625
+ return yt(e, r);
628
626
  }
629
- const Ft = "avc1.42E01E", Vt = "vp8", Mt = "vp09.00.10.08", Gt = "av01.0.04M.08", Bt = 3, l = (t, r) => self.postMessage(t, r ?? []);
627
+ const gt = "avc1.42E01E", mt = "vp8", Ft = "vp09.00.10.08", Vt = "av01.0.04M.08", Gt = 3, l = (t, r) => self.postMessage(t, r ?? []);
630
628
  let h = null, y = !0;
631
629
  const A = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
632
630
  function o(t) {
@@ -661,7 +659,7 @@ function X(t, r) {
661
659
  };
662
660
  return A.set(t, n), S.set(r, t), n;
663
661
  }
664
- function H(t) {
662
+ function d(t) {
665
663
  const r = S.get(t);
666
664
  if (r !== void 0) {
667
665
  const _ = A.get(r);
@@ -671,17 +669,17 @@ function H(t) {
671
669
  const e = t.split("_"), n = Number(e[0]) || 0, s = Number(e[1]) || 0, E = P(n, s);
672
670
  return X(E, t);
673
671
  }
674
- function bt(t) {
675
- if (t === u.H264) return Ft;
676
- if (t === u.Vp8) return Vt;
677
- if (t === u.Vp9) return Mt;
678
- if (t === u.Av1) return Gt;
672
+ function Mt(t) {
673
+ if (t === u.H264) return gt;
674
+ if (t === u.Vp8) return mt;
675
+ if (t === u.Vp9) return Ft;
676
+ if (t === u.Av1) return Vt;
679
677
  throw new Error(`Unknown codec: ${t}`);
680
678
  }
681
679
  function C(t) {
682
680
  l({ type: "requestIdr", streamId: t });
683
681
  }
684
- async function dt(t, r) {
682
+ async function Bt(t, r) {
685
683
  try {
686
684
  if (!y || !t.watched)
687
685
  return;
@@ -699,7 +697,7 @@ async function dt(t, r) {
699
697
  }
700
698
  }
701
699
  }
702
- async function Ht(t, r, e) {
700
+ async function bt(t, r, e) {
703
701
  const n = {
704
702
  codec: t,
705
703
  codedWidth: r > 0 ? r : void 0,
@@ -726,7 +724,7 @@ async function Ht(t, r, e) {
726
724
  async function c(t) {
727
725
  if (t.codec == null)
728
726
  return;
729
- const r = bt(t.codec);
727
+ const r = Mt(t.codec);
730
728
  if (t.decoder || (t.decoder = new VideoDecoder({
731
729
  output: (e) => {
732
730
  if (t.pendingDecodeCount++, !y || !t.watched) {
@@ -737,7 +735,7 @@ async function c(t) {
737
735
  }
738
736
  return;
739
737
  }
740
- if (t.pendingDecodeCount > Bt) {
738
+ if (t.pendingDecodeCount > Gt) {
741
739
  t.pendingDecodeCount--;
742
740
  try {
743
741
  e.close();
@@ -760,13 +758,13 @@ async function c(t) {
760
758
  }
761
759
  return;
762
760
  }
763
- dt(t, e);
761
+ Bt(t, e);
764
762
  },
765
763
  error: (e) => {
766
764
  o(e), t.isKeyFrameRequired = !0, C(t.streamId);
767
765
  }
768
766
  })), t.decoderCodec !== r) {
769
- const e = await Ht(r, t.width, t.height);
767
+ const e = await bt(r, t.width, t.height);
770
768
  if (!e) {
771
769
  o(new Error(`Decoder not supported for codec ${r}`));
772
770
  return;
@@ -782,11 +780,11 @@ async function c(t) {
782
780
  t.surface && t.ctx2d && t.width > 0 && t.height > 0 && (t.surface.width !== t.width || t.surface.height !== t.height) && (t.surface.width = t.width, t.surface.height = t.height);
783
781
  }
784
782
  }
785
- function Kt(t, r) {
786
- const e = P(r.senderId, r.trackId), n = k(r.senderId, r.trackId), s = Rt(t), E = X(e, n);
783
+ function Ht(t, r) {
784
+ const e = P(r.senderId, r.trackId), n = k(r.senderId, r.trackId), s = ht(t), E = X(e, n);
787
785
  E.codec = s.Codec, E.width = s.Width, E.height = s.Height, E.framerate = s.Framerate, E.bitrate = s.Bitrate, l({ type: "streamBegin", streamId: n, width: s.Width, height: s.Height, codec: s.Codec }), E.watched && (E.surface && E.ctx2d && s.Width > 0 && s.Height > 0 && (E.surface.width !== s.Width || E.surface.height !== s.Height) && (E.surface.width = s.Width, E.surface.height = s.Height), c(E));
788
786
  }
789
- function xt(t) {
787
+ function dt(t) {
790
788
  const r = P(t.senderId, t.trackId), e = k(t.senderId, t.trackId);
791
789
  l({ type: "streamEnd", streamId: e });
792
790
  const n = A.get(r);
@@ -819,11 +817,11 @@ function z(t) {
819
817
  e.decoder = null, e.decoderCodec = null;
820
818
  }
821
819
  }
822
- function vt(t, r) {
820
+ function Kt(t, r) {
823
821
  const e = P(r.senderId, r.trackId), n = A.get(e);
824
822
  if (!n || !y || !n.watched || ((!n.decoder || !n.decoderCodec) && c(n), !n.decoder || !n.decoderCodec))
825
823
  return;
826
- const s = mt(t);
824
+ const s = Pt(t);
827
825
  if (n.isKeyFrameRequired) {
828
826
  if (!s.IsKey)
829
827
  return;
@@ -842,23 +840,23 @@ function vt(t, r) {
842
840
  n.isKeyFrameRequired = !0, C(n.streamId), o(E);
843
841
  }
844
842
  }
845
- function Yt(t) {
843
+ function xt(t) {
846
844
  const r = P(t.senderId, t.trackId), e = A.get(r);
847
845
  e && (e.isKeyFrameRequired = !0, e.watched && C(e.streamId));
848
846
  }
849
- function kt(t, r) {
847
+ function vt(t, r) {
850
848
  switch (r.opcode) {
851
849
  case L.VIDEO_STREAM_BEGIN:
852
- Kt(t, r);
850
+ Ht(t, r);
853
851
  return;
854
852
  case L.VIDEO_STREAM_END:
855
- xt(r);
853
+ dt(r);
856
854
  return;
857
855
  case L.VIDEO_FRAME:
858
- vt(t, r);
856
+ Kt(t, r);
859
857
  return;
860
858
  case L.VIDEO_INVALIDATE_FRAME:
861
- Yt(r);
859
+ xt(r);
862
860
  return;
863
861
  default:
864
862
  return;
@@ -873,7 +871,7 @@ function $() {
873
871
  h = null;
874
872
  }
875
873
  }
876
- function Xt() {
874
+ function Yt() {
877
875
  $();
878
876
  for (const t of A.values())
879
877
  z(t.streamId);
@@ -883,7 +881,7 @@ self.addEventListener("message", (t) => {
883
881
  const r = t.data;
884
882
  if (r.type !== "configure") {
885
883
  if (r.type === "attachSurface") {
886
- const e = r.streamId, n = H(e);
884
+ const e = r.streamId, n = d(e);
887
885
  n.watched = !0, n.surface = r.canvas;
888
886
  try {
889
887
  n.ctx2d = n.surface.getContext("2d", { alpha: !1, desynchronized: !0 });
@@ -900,12 +898,12 @@ self.addEventListener("message", (t) => {
900
898
  if (r.type === "attachProtocolPort") {
901
899
  $(), h = r.port, h.addEventListener("message", (e) => {
902
900
  const n = e.data;
903
- n?.type === "protocol" && n.message instanceof ArrayBuffer && n.headers && kt(new Uint8Array(n.message), n.headers);
901
+ n?.type === "protocol" && n.message instanceof ArrayBuffer && n.headers && vt(new Uint8Array(n.message), n.headers);
904
902
  }), h.start?.();
905
903
  return;
906
904
  }
907
905
  if (r.type === "watchStream") {
908
- const e = H(r.streamId);
906
+ const e = d(r.streamId);
909
907
  e.watched = !0, e.isKeyFrameRequired = !0, c(e), C(e.streamId);
910
908
  return;
911
909
  }
@@ -919,6 +917,6 @@ self.addEventListener("message", (t) => {
919
917
  e.watched && (e.isKeyFrameRequired = !0, c(e), C(e.streamId));
920
918
  return;
921
919
  }
922
- r.type === "dispose" && Xt();
920
+ r.type === "dispose" && Yt();
923
921
  }
924
922
  });