@ikonai/sdk 1.0.69 → 1.0.71

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const wa = {
2
2
  Compressed: 8
3
3
  };
4
- function AI(t) {
4
+ function yI(t) {
5
5
  return t;
6
6
  }
7
7
  function We(t) {
@@ -3253,17 +3253,17 @@ class Uo extends L {
3253
3253
  super(`Channel provisioning timeout after ${e}ms`), this.name = "ProvisioningTimeoutError";
3254
3254
  }
3255
3255
  }
3256
- class yI extends L {
3256
+ class RI extends L {
3257
3257
  constructor(e) {
3258
3258
  super(`Channel not found: ${e}`), this.name = "ChannelNotFoundError";
3259
3259
  }
3260
3260
  }
3261
- class RI extends L {
3261
+ class bI extends L {
3262
3262
  constructor(e) {
3263
3263
  super(`Space not found for domain: ${e}`), this.name = "SpaceNotFoundError";
3264
3264
  }
3265
3265
  }
3266
- class bI extends L {
3266
+ class NI extends L {
3267
3267
  constructor() {
3268
3268
  super("No channels available in this space"), this.name = "NoChannelsError";
3269
3269
  }
@@ -3309,10 +3309,10 @@ function Vn() {
3309
3309
  function hp(t) {
3310
3310
  Et = t;
3311
3311
  }
3312
- function NI() {
3312
+ function kI() {
3313
3313
  return Et;
3314
3314
  }
3315
- function kI(t, e) {
3315
+ function DI(t, e) {
3316
3316
  return Vt.set(t, e ?? {
3317
3317
  minLevel: 2
3318
3318
  /* WARN */
@@ -3382,7 +3382,7 @@ function M(t) {
3382
3382
  }
3383
3383
  };
3384
3384
  }
3385
- const Ep = "ikon-proxy", mp = "ikon-websocket", _p = "ikon-webtransport", Po = "ikon-debug", Ip = "ikon-lang", Fo = "ikon-server-url", DI = "ikon-git-source", vI = "ikon-git-branch", Tp = "ikon-audio", wp = "ikon-video", gp = "ikon-webrtc", Bo = "ikon-inspect", Sp = "ikon-debug-overlay", Cp = "ikon-auth", Ap = "ikon-retry", yp = "ikon-api", Rp = "ikon-snapshot";
3385
+ const Ep = "ikon-proxy", mp = "ikon-websocket", _p = "ikon-webtransport", Po = "ikon-debug", Ip = "ikon-lang", Fo = "ikon-server-url", vI = "ikon-git-source", OI = "ikon-git-branch", Tp = "ikon-audio", wp = "ikon-video", gp = "ikon-webrtc", Bo = "ikon-inspect", Sp = "ikon-debug-overlay", Cp = "ikon-auth", Ap = "ikon-retry", yp = "ikon-api", Rp = "ikon-snapshot";
3386
3386
  function At(t, e) {
3387
3387
  if (typeof window > "u")
3388
3388
  return null;
@@ -3414,7 +3414,7 @@ function kp() {
3414
3414
  function Dp() {
3415
3415
  return $(Po) === !0;
3416
3416
  }
3417
- function OI() {
3417
+ function UI() {
3418
3418
  return At(Ip);
3419
3419
  }
3420
3420
  function vp() {
@@ -3432,7 +3432,7 @@ function Dt() {
3432
3432
  function Lp() {
3433
3433
  return $(Bo) === !0;
3434
3434
  }
3435
- function UI() {
3435
+ function LI() {
3436
3436
  return $(Sp) === !0;
3437
3437
  }
3438
3438
  function Mp() {
@@ -4144,7 +4144,7 @@ class $p {
4144
4144
  this.stabilityTimer && (clearTimeout(this.stabilityTimer), this.stabilityTimer = null);
4145
4145
  }
4146
4146
  }
4147
- const LI = "opus", MI = 48e3, PI = 2, FI = 64e3, Kp = 150, BI = "VP8", Yp = 5e6, xI = 30, jp = 0.05, zp = "max-bundle", Xp = "require", Jp = 16, Qp = 16, Zp = "ikon-data", qp = !1, eE = 0, H = M("WebRTCConnection");
4147
+ const MI = "opus", PI = 48e3, FI = 2, BI = 64e3, Kp = 150, xI = "VP8", Yp = 5e6, WI = 30, jp = 0.05, zp = "max-bundle", Xp = "require", Jp = 16, Qp = 16, Zp = "ikon-data", qp = !1, eE = 0, H = M("WebRTCConnection");
4148
4148
  class tE {
4149
4149
  pc = null;
4150
4150
  dataChannel = null;
@@ -4598,22 +4598,22 @@ class nE {
4598
4598
  }
4599
4599
  }
4600
4600
  }
4601
- const rE = 5e3, iE = 18e4, sE = 3e4, $n = 2e3, Kn = 2, oE = 5e3, Go = 6e4, aE = 300 * 1e3, cE = 10 * 1e3, Ht = "ikon.login.pendingCall", $t = /* @__PURE__ */ new Set();
4601
+ const rE = 5e3, iE = 18e4, sE = 3e4, $n = 2e3, Kn = 2, oE = 5e3, Go = 6e4, aE = 300 * 1e3, cE = 10 * 1e3, Ht = "ikon-login-pending-call", $t = /* @__PURE__ */ new Set();
4602
4602
  let Sn = { required: !1, reason: null };
4603
4603
  function Vo() {
4604
4604
  for (const t of $t)
4605
4605
  t();
4606
4606
  }
4607
- function WI() {
4607
+ function GI() {
4608
4608
  return Sn;
4609
4609
  }
4610
4610
  function Ho(t) {
4611
4611
  Sn = { required: !0, reason: t }, Vo();
4612
4612
  }
4613
- function GI() {
4613
+ function VI() {
4614
4614
  Sn = { required: !1, reason: null }, Vo();
4615
4615
  }
4616
- function VI(t) {
4616
+ function HI(t) {
4617
4617
  return $t.add(t), () => $t.delete(t);
4618
4618
  }
4619
4619
  function lE(t) {
@@ -4636,7 +4636,7 @@ function dE(t) {
4636
4636
  const e = t, n = typeof e.name == "string" ? e.name : "", r = typeof e.message == "string" ? e.message : "";
4637
4637
  return !!(n === "NotAllowedError" || n === "SecurityError" || r.toLowerCase().includes("permission") || r.toLowerCase().includes("user gesture"));
4638
4638
  }
4639
- const Ge = "ikon.theme", Ve = "ikon.theme-user", hE = "ikon.theme-change";
4639
+ const Ge = "ikon-theme", Ve = "ikon-theme-user", hE = "ikon-theme-change";
4640
4640
  function Kt(t) {
4641
4641
  typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", t);
4642
4642
  }
@@ -4924,31 +4924,36 @@ const KE = {
4924
4924
  name: "ikon.client.logout",
4925
4925
  description: "Clear the auth session and return to the login screen at the site root",
4926
4926
  returnType: { kind: "boolean" }
4927
- };
4928
- function YE() {
4927
+ }, YE = ["ikon-auth-", "ikon-live-snapshot"];
4928
+ function jE() {
4929
4929
  if (typeof window > "u" || !window.localStorage)
4930
4930
  return !1;
4931
4931
  try {
4932
- return window.localStorage.clear(), setTimeout(() => window.location.replace(window.location.origin + "/"), 100), !0;
4932
+ const t = [];
4933
+ for (let e = 0; e < window.localStorage.length; e++) {
4934
+ const n = window.localStorage.key(e);
4935
+ n && YE.some((r) => n.startsWith(r)) && t.push(n);
4936
+ }
4937
+ return t.forEach((e) => window.localStorage.removeItem(e)), setTimeout(() => window.location.replace(window.location.origin + "/"), 100), !0;
4933
4938
  } catch {
4934
4939
  return !1;
4935
4940
  }
4936
4941
  }
4937
- const jE = {
4942
+ const zE = {
4938
4943
  name: "ikon.client.loginShow",
4939
4944
  description: "Show the login UI with an optional reason",
4940
4945
  parameters: [{ name: "reason", type: { kind: "string" } }],
4941
4946
  returnType: { kind: "boolean" }
4942
4947
  };
4943
- function zE(t) {
4948
+ function XE(t) {
4944
4949
  return typeof window > "u" ? !1 : (Ho(typeof t == "string" ? t : null), !0);
4945
4950
  }
4946
- const XE = {
4951
+ const JE = {
4947
4952
  name: "ikon.client.getLocation",
4948
4953
  description: "Get the current GPS location",
4949
4954
  returnType: { kind: "string" }
4950
4955
  };
4951
- function JE() {
4956
+ function QE() {
4952
4957
  return typeof navigator > "u" || !navigator.geolocation ? Promise.resolve(null) : new Promise((t) => {
4953
4958
  navigator.geolocation.getCurrentPosition(
4954
4959
  (e) => {
@@ -4967,7 +4972,7 @@ let Pe = [], Ot = !1;
4967
4972
  function bn() {
4968
4973
  return typeof window < "u" && "Notification" in window;
4969
4974
  }
4970
- function QE(t, e, n, r) {
4975
+ function ZE(t, e, n, r) {
4971
4976
  const i = {};
4972
4977
  return t?.trim() && (i.body = t.trim()), e?.trim() && (i.icon = e.trim()), n?.trim() && (i.tag = n.trim()), r && (i.data = r), i;
4973
4978
  }
@@ -4988,7 +4993,7 @@ function jt(t, e, n, r) {
4988
4993
  } catch {
4989
4994
  }
4990
4995
  }
4991
- function ZE() {
4996
+ function qE() {
4992
4997
  if (Notification.permission !== "granted") {
4993
4998
  Pe = [];
4994
4999
  return;
@@ -4998,7 +5003,7 @@ function ZE() {
4998
5003
  for (const e of t)
4999
5004
  jt(e.title, e.options, e.launchUrl, e.data);
5000
5005
  }
5001
- function qE() {
5006
+ function em() {
5002
5007
  if (Ot || typeof window > "u")
5003
5008
  return;
5004
5009
  Ot = !0;
@@ -5006,7 +5011,7 @@ function qE() {
5006
5011
  window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), Ot = !1;
5007
5012
  try {
5008
5013
  if (await Notification.requestPermission() === "granted") {
5009
- ZE();
5014
+ qE();
5010
5015
  return;
5011
5016
  }
5012
5017
  } catch {
@@ -5015,15 +5020,15 @@ function qE() {
5015
5020
  };
5016
5021
  window.addEventListener("pointerdown", t), window.addEventListener("keydown", t);
5017
5022
  }
5018
- const em = {
5023
+ const tm = {
5019
5024
  name: "ikon.client.getNotificationPermission",
5020
5025
  description: "Get the current notification permission state (granted, denied, default, or unsupported)",
5021
5026
  returnType: { kind: "string" }
5022
5027
  };
5023
- function tm() {
5028
+ function nm() {
5024
5029
  return bn() ? Notification.permission : "unsupported";
5025
5030
  }
5026
- const nm = {
5031
+ const rm = {
5027
5032
  name: "ikon.client.showNotification",
5028
5033
  description: "Show a notification, requesting permission lazily on the first send",
5029
5034
  returnType: { kind: "string" },
@@ -5036,10 +5041,10 @@ const nm = {
5036
5041
  { name: "data", type: { kind: "string", nullable: !0 } }
5037
5042
  ]
5038
5043
  };
5039
- async function rm(t, e, n, r, i, s) {
5044
+ async function im(t, e, n, r, i, s) {
5040
5045
  if (!bn() || typeof t != "string" || !t.trim())
5041
5046
  return "unsupported";
5042
- const o = t.trim(), a = QE(
5047
+ const o = t.trim(), a = ZE(
5043
5048
  typeof e == "string" ? e : void 0,
5044
5049
  typeof n == "string" ? n : void 0,
5045
5050
  typeof r == "string" ? r : void 0,
@@ -5053,25 +5058,25 @@ async function rm(t, e, n, r, i, s) {
5053
5058
  const d = await Notification.requestPermission();
5054
5059
  return d === "granted" && jt(o, a, c, l), d;
5055
5060
  } catch (d) {
5056
- return dE(d) ? (Pe.push({ title: o, options: a, launchUrl: c, data: l }), qE(), "default") : "denied";
5061
+ return dE(d) ? (Pe.push({ title: o, options: a, launchUrl: c, data: l }), em(), "default") : "denied";
5057
5062
  }
5058
5063
  }
5059
5064
  let lt = null;
5060
5065
  function Ko(t) {
5061
5066
  lt = t ?? null;
5062
5067
  }
5063
- function im(t) {
5068
+ function sm(t) {
5064
5069
  const e = "=".repeat((4 - t.length % 4) % 4), n = (t + e).replace(/-/g, "+").replace(/_/g, "/"), r = atob(n), i = new Uint8Array(r.length);
5065
5070
  for (let s = 0; s < r.length; s++)
5066
5071
  i[s] = r.charCodeAt(s);
5067
5072
  return i;
5068
5073
  }
5069
- const sm = {
5074
+ const om = {
5070
5075
  name: "ikon.client.getPushSubscription",
5071
5076
  description: "Subscribe to Web Push and return the subscription, for offline push registration",
5072
5077
  returnType: { kind: "string", nullable: !0 }
5073
5078
  };
5074
- async function om() {
5079
+ async function am() {
5075
5080
  if (typeof window > "u" || !lt?.enabled || !lt.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !bn() || Notification.permission !== "granted")
5076
5081
  return null;
5077
5082
  try {
@@ -5079,14 +5084,14 @@ async function om() {
5079
5084
  await navigator.serviceWorker.ready;
5080
5085
  const r = (await t.pushManager.getSubscription() ?? await t.pushManager.subscribe({
5081
5086
  userVisibleOnly: !0,
5082
- applicationServerKey: im(lt.vapidPublicKey)
5087
+ applicationServerKey: sm(lt.vapidPublicKey)
5083
5088
  })).toJSON();
5084
5089
  return !r.endpoint || !r.keys?.p256dh || !r.keys?.auth ? null : { Platform: "web", Endpoint: r.endpoint, P256dh: r.keys.p256dh, Auth: r.keys.auth, DeviceId: null };
5085
5090
  } catch {
5086
5091
  return null;
5087
5092
  }
5088
5093
  }
5089
- const am = [
5094
+ const cm = [
5090
5095
  { definition: pE, handler: EE },
5091
5096
  { definition: mE, handler: _E },
5092
5097
  { definition: IE, handler: TE },
@@ -5102,15 +5107,15 @@ const am = [
5102
5107
  { definition: xE, handler: WE },
5103
5108
  { definition: GE, handler: VE },
5104
5109
  { definition: HE, handler: $E },
5105
- { definition: KE, handler: YE },
5106
- { definition: jE, handler: zE },
5107
- { definition: XE, handler: JE },
5108
- { definition: em, handler: tm },
5109
- { definition: nm, handler: rm },
5110
- { definition: sm, handler: om }
5110
+ { definition: KE, handler: jE },
5111
+ { definition: zE, handler: XE },
5112
+ { definition: JE, handler: QE },
5113
+ { definition: tm, handler: nm },
5114
+ { definition: rm, handler: im },
5115
+ { definition: om, handler: am }
5111
5116
  ];
5112
- function cm(t) {
5113
- const e = am.map(({ definition: n, handler: r }) => t.register(n, r));
5117
+ function lm(t) {
5118
+ const e = cm.map(({ definition: n, handler: r }) => t.register(n, r));
5114
5119
  return () => e.forEach((n) => n());
5115
5120
  }
5116
5121
  function De() {
@@ -5119,7 +5124,7 @@ function De() {
5119
5124
  function Yo() {
5120
5125
  return globalThis.AbortSignal;
5121
5126
  }
5122
- function lm() {
5127
+ function um() {
5123
5128
  return typeof DOMException == "function" ? new DOMException("The operation timed out.", "TimeoutError") : new Error("The operation timed out.");
5124
5129
  }
5125
5130
  function ue(t) {
@@ -5127,7 +5132,7 @@ function ue(t) {
5127
5132
  if (e && typeof e.timeout == "function")
5128
5133
  return e.timeout(t);
5129
5134
  const n = new AbortController();
5130
- return setTimeout(() => n.abort(lm()), t), n.signal;
5135
+ return setTimeout(() => n.abort(um()), t), n.signal;
5131
5136
  }
5132
5137
  function Rt(t) {
5133
5138
  const e = Yo();
@@ -5161,7 +5166,7 @@ function Ut() {
5161
5166
  n.push(e[r].toString(16).padStart(2, "0"));
5162
5167
  return `${n[0]}${n[1]}${n[2]}${n[3]}-${n[4]}${n[5]}-${n[6]}${n[7]}-${n[8]}${n[9]}-${n[10]}${n[11]}${n[12]}${n[13]}${n[14]}${n[15]}`;
5163
5168
  }
5164
- const zt = "ikon_device_id";
5169
+ const zt = "ikon-device-id";
5165
5170
  function bt() {
5166
5171
  if (typeof window > "u" || typeof localStorage > "u")
5167
5172
  return Ut();
@@ -5172,14 +5177,14 @@ function bt() {
5172
5177
  return Ut();
5173
5178
  }
5174
5179
  }
5175
- function HI() {
5180
+ function $I() {
5176
5181
  if (!(typeof localStorage > "u"))
5177
5182
  try {
5178
5183
  localStorage.removeItem(zt);
5179
5184
  } catch {
5180
5185
  }
5181
5186
  }
5182
- function um(t) {
5187
+ function dm(t) {
5183
5188
  try {
5184
5189
  const e = t.split(".");
5185
5190
  if (e.length !== 3) return null;
@@ -5189,12 +5194,12 @@ function um(t) {
5189
5194
  return null;
5190
5195
  }
5191
5196
  }
5192
- const mt = {}, Xt = "https://api.prod.ikon.live", Jt = "https://api.dev.ikon.live", Lt = "https://auth.ikonai.com", Mt = "https://auth.dev.ikonai.com", $I = "https://auth.ikonai.com", dm = [".ikonai.app", ".ikonai.com", ".ikonai.run", ".ikon.live"];
5197
+ const mt = {}, Xt = "https://api.prod.ikon.live", Jt = "https://api.dev.ikon.live", Lt = "https://auth.ikonai.com", Mt = "https://auth.dev.ikonai.com", KI = "https://auth.ikonai.com", hm = [".ikonai.app", ".ikonai.com", ".ikonai.run", ".ikon.live"];
5193
5198
  function Nn(t) {
5194
- return dm.some((n) => t.endsWith(n)) ? t.includes(".dev.") ? "development" : "production" : null;
5199
+ return hm.some((n) => t.endsWith(n)) ? t.includes(".dev.") ? "development" : "production" : null;
5195
5200
  }
5196
5201
  let Fe = null, ve = null;
5197
- async function hm() {
5202
+ async function fm() {
5198
5203
  return Fe || (typeof window > "u" ? null : ve || (ve = (async () => {
5199
5204
  try {
5200
5205
  const t = await fetch(`${window.location.origin}/ikon/api/env`, {
@@ -5213,12 +5218,12 @@ async function hm() {
5213
5218
  function jo() {
5214
5219
  return typeof window > "u" || Pp() === !1 || !Qe() ? null : `${window.location.origin}/ikon/api`;
5215
5220
  }
5216
- function fm() {
5221
+ function pm() {
5217
5222
  return typeof window > "u" || !Qe() ? null : `${window.location.origin}/ikon/auth`;
5218
5223
  }
5219
- const pm = !1;
5220
- function Em() {
5221
- return Mp() || pm;
5224
+ const Em = !1;
5225
+ function mm() {
5226
+ return Mp() || Em;
5222
5227
  }
5223
5228
  function zo(t) {
5224
5229
  const e = jo();
@@ -5231,16 +5236,16 @@ function Pt(t) {
5231
5236
  const n = jo();
5232
5237
  return n || (typeof window > "u" ? Xt : Qe() ? (Nn(window.location.hostname) ?? Fe ?? "production") === "development" ? Jt : Xt : Jt);
5233
5238
  }
5234
- function KI() {
5239
+ function YI() {
5235
5240
  const t = typeof import.meta < "u" ? mt.VITE_IKON_BACKEND_TYPE : void 0;
5236
5241
  if (t === "development" || t === "production")
5237
5242
  return t;
5238
5243
  const e = typeof import.meta < "u" ? mt.VITE_IKON_BACKEND_URL : void 0;
5239
5244
  return e ? e.includes(".dev.") ? "development" : "production" : typeof window > "u" ? "production" : Qe() ? Nn(window.location.hostname) ?? Fe ?? "production" : "development";
5240
5245
  }
5241
- async function mm(t) {
5242
- if (Em()) {
5243
- const i = fm();
5246
+ async function _m(t) {
5247
+ if (mm()) {
5248
+ const i = pm();
5244
5249
  if (i) return i;
5245
5250
  }
5246
5251
  if (t) return t;
@@ -5251,7 +5256,7 @@ async function mm(t) {
5251
5256
  if (!Qe())
5252
5257
  return Mt;
5253
5258
  const n = Nn(window.location.hostname);
5254
- return n ? n === "development" ? Mt : Lt : await hm() === "development" ? Mt : Lt;
5259
+ return n ? n === "development" ? Mt : Lt : await fm() === "development" ? Mt : Lt;
5255
5260
  }
5256
5261
  function Nt() {
5257
5262
  if (typeof window > "u")
@@ -5261,8 +5266,8 @@ function Nt() {
5261
5266
  e[n] = r;
5262
5267
  return e;
5263
5268
  }
5264
- const _m = ["ikon_token", "ikon_provider", "error"];
5265
- function YI() {
5269
+ const Im = ["ikon_token", "ikon_provider", "error"];
5270
+ function jI() {
5266
5271
  if (typeof window > "u")
5267
5272
  return { parameters: {} };
5268
5273
  const t = window.location.pathname;
@@ -5274,7 +5279,7 @@ function YI() {
5274
5279
  throw new Error("URL cannot contain both /s/[sessionId] and /c/[channelKey]");
5275
5280
  const s = Nt(), o = {};
5276
5281
  for (const [a, c] of Object.entries(s))
5277
- _m.includes(a) || (o[a] = c);
5282
+ Im.includes(a) || (o[a] = c);
5278
5283
  return { sessionId: e, channelKey: n, parameters: o };
5279
5284
  }
5280
5285
  function Qe() {
@@ -5292,7 +5297,7 @@ function Qe() {
5292
5297
  function kn() {
5293
5298
  return typeof window > "u" ? "" : window.location.pathname.replace(/^\/(s|c)\/[^/]+/, "") || "/";
5294
5299
  }
5295
- function jI() {
5300
+ function zI() {
5296
5301
  if (typeof window > "u") return;
5297
5302
  const t = window.location.pathname, e = t.match(/^\/s\/[^/]+/), n = t.match(/^\/c\/[^/]+/);
5298
5303
  if (e || n) {
@@ -5300,8 +5305,8 @@ function jI() {
5300
5305
  window.history.replaceState(null, "", r + window.location.search);
5301
5306
  }
5302
5307
  }
5303
- const F = M("Authenticator"), ge = S.GROUP_CORE | S.GROUP_KEEPALIVE | S.GROUP_EVENTS | S.GROUP_ACTIONS | S.GROUP_UI | S.GROUP_AUDIO | S.GROUP_VIDEO | S.GROUP_ANALYTICS | S.GROUP_APP_LOCAL, Im = 2, Tm = 6e4, wm = 2e3, Xo = 1e4, gm = 3e3, Sm = 3e3, Jo = 3, Dn = 4;
5304
- async function Cm(t, e, n, r) {
5308
+ const F = M("Authenticator"), ge = S.GROUP_CORE | S.GROUP_KEEPALIVE | S.GROUP_EVENTS | S.GROUP_ACTIONS | S.GROUP_UI | S.GROUP_AUDIO | S.GROUP_VIDEO | S.GROUP_ANALYTICS | S.GROUP_APP_LOCAL, Tm = 2, wm = 6e4, gm = 2e3, Xo = 1e4, Sm = 3e3, Cm = 3e3, Jo = 3, Dn = 4;
5309
+ async function Am(t, e, n, r) {
5305
5310
  if (t)
5306
5311
  try {
5307
5312
  const i = await fetch(`${n}/anonymous`, {
@@ -5320,7 +5325,7 @@ async function Cm(t, e, n, r) {
5320
5325
  F.warn("Anonymous auth returned no token");
5321
5326
  return;
5322
5327
  }
5323
- const o = um(s.token);
5328
+ const o = dm(s.token);
5324
5329
  if (!o) {
5325
5330
  F.warn("Anonymous auth token had no extractable userId");
5326
5331
  return;
@@ -5331,7 +5336,7 @@ async function Cm(t, e, n, r) {
5331
5336
  return;
5332
5337
  }
5333
5338
  }
5334
- async function Am(t, e, n, r) {
5339
+ async function ym(t, e, n, r) {
5335
5340
  try {
5336
5341
  const i = await fetch(`${t}/profiles/me?space=${encodeURIComponent(e)}`, {
5337
5342
  method: "GET",
@@ -5353,12 +5358,12 @@ async function Qo(t) {
5353
5358
  }
5354
5359
  return e;
5355
5360
  }
5356
- async function ym(t) {
5361
+ async function Rm(t) {
5357
5362
  if (t.ok) return;
5358
5363
  const e = await Qo(t);
5359
5364
  throw t.status === 403 ? new St(`Access denied: ${e}`, e) : new L(`Failed to get or create profile: ${t.status} ${e}`);
5360
5365
  }
5361
- function Rm(t, e, n) {
5366
+ function bm(t, e, n) {
5362
5367
  const r = {
5363
5368
  method: "POST",
5364
5369
  headers: {
@@ -5371,7 +5376,7 @@ function Rm(t, e, n) {
5371
5376
  return e || (r.credentials = "include"), r;
5372
5377
  }
5373
5378
  async function Zo(t, e, n, r) {
5374
- const i = `${t}/init`, s = await fetch(i, Rm(e, n, r));
5379
+ const i = `${t}/init`, s = await fetch(i, bm(e, n, r));
5375
5380
  if (!s.ok) {
5376
5381
  const o = await Qo(s);
5377
5382
  throw s.status === 403 ? new St(`Access denied: ${o}`, o) : new L(`Backend init failed: ${s.status} ${o}`);
@@ -5387,9 +5392,9 @@ async function me(t, e, n) {
5387
5392
  const c = await a.arrayBuffer(), l = new Uint8Array(c), d = await jc(l);
5388
5393
  return F.debug(`Connect URL fetched in ${Date.now() - o}ms`), { authResponse: d };
5389
5394
  }
5390
- async function bm(t, e) {
5395
+ async function Nm(t, e) {
5391
5396
  try {
5392
- const n = new URL(t), r = `${n.protocol}//${n.host}/health`, i = ue(Sm), s = e ? Rt([e, i]) : i;
5397
+ const n = new URL(t), r = `${n.protocol}//${n.host}/health`, i = ue(Cm), s = e ? Rt([e, i]) : i;
5393
5398
  return (await fetch(r, { signal: s })).ok;
5394
5399
  } catch {
5395
5400
  return !1;
@@ -5402,9 +5407,9 @@ async function qo(t, e, n, r, i) {
5402
5407
  F.info(`Auth URL order: [${s.map((l) => l.isProxy ? "proxy" : "direct").join(", ")}], mode: ${n}, proxyPreferred: ${r}`);
5403
5408
  const o = n === "auto" && s.length > 1 && !s[0].isProxy, a = Date.now();
5404
5409
  let c = 0;
5405
- for (; c < Im || Date.now() - a < Tm; ) {
5410
+ for (; c < Tm || Date.now() - a < wm; ) {
5406
5411
  for (let l = 0; l < s.length; l++) {
5407
- const d = s[l], h = c === 0 && l === 0 && o ? gm : Xo;
5412
+ const d = s[l], h = c === 0 && l === 0 && o ? Sm : Xo;
5408
5413
  try {
5409
5414
  const u = await me(d.url, i, h);
5410
5415
  return u.usedProxyUrl = d.isProxy, u.directUrl = t, F.info(`Auth succeeded via ${d.isProxy ? "proxy" : "direct"} URL`), u;
@@ -5414,11 +5419,11 @@ async function qo(t, e, n, r, i) {
5414
5419
  F.warn(`Auth via ${d.isProxy ? "proxy" : "direct"} URL failed (round ${c + 1}, timeout ${h}ms): ${u}`);
5415
5420
  }
5416
5421
  }
5417
- c++, await Lo(wm, i);
5422
+ c++, await Lo(gm, i);
5418
5423
  }
5419
5424
  throw new L("Failed to connect after exhausting all URL attempts");
5420
5425
  }
5421
- function Nm(t, e, n = "") {
5426
+ function km(t, e, n = "") {
5422
5427
  const r = Cn();
5423
5428
  return _c({
5424
5429
  ServerSessionId: "",
@@ -5456,7 +5461,7 @@ function Nm(t, e, n = "") {
5456
5461
  SupportsCompression: hn()
5457
5462
  });
5458
5463
  }
5459
- function km(t) {
5464
+ function Dm(t) {
5460
5465
  return {
5461
5466
  ServerSessionId: t.ServerSessionId,
5462
5467
  ContextType: t.ContextType,
@@ -5492,13 +5497,13 @@ function km(t) {
5492
5497
  SupportsCompression: t.SupportsCompression
5493
5498
  };
5494
5499
  }
5495
- async function Dm(t, e) {
5500
+ async function vm(t, e) {
5496
5501
  const n = `https://${t.host}:${t.httpsPort}`;
5497
5502
  F.debug(`Authenticating with local server: ${n}`);
5498
5503
  const i = { ...Nt(), ...t.parameters }, s = t.deviceId ?? bt();
5499
5504
  let o = t.userId, a = t.token;
5500
5505
  if (!o) {
5501
- const I = await Cm(t.spaceId, s, await mm(t.authUrl), e);
5506
+ const I = await Am(t.spaceId, s, await _m(t.authUrl), e);
5502
5507
  I && (o = I.userId, a = I.token);
5503
5508
  }
5504
5509
  if (o || (o = s, F.debug("Using deviceId as userId fallback")), t.spaceId && a)
@@ -5508,10 +5513,10 @@ async function Dm(t, e) {
5508
5513
  headers: { Authorization: `Bearer ${a}` },
5509
5514
  signal: e
5510
5515
  });
5511
- await ym(T);
5516
+ await Rm(T);
5512
5517
  } else
5513
- await Am(Pt(t.backendUrl), t.spaceId, a, e);
5514
- const c = Nm({ ...t, parameters: i }, o, t.token ? "authenticated" : ""), l = km(c), d = await fetch(`${n}/connect-token`, {
5518
+ await ym(Pt(t.backendUrl), t.spaceId, a, e);
5519
+ const c = km({ ...t, parameters: i }, o, t.token ? "authenticated" : ""), l = Dm(c), d = await fetch(`${n}/connect-token`, {
5515
5520
  method: "POST",
5516
5521
  headers: {
5517
5522
  "Content-Type": "application/json"
@@ -5529,7 +5534,7 @@ async function Dm(t, e) {
5529
5534
  const p = `${n}/connect?token=${encodeURIComponent(u)}`, _ = await me(p, e);
5530
5535
  return _.directUrl = p, _.backendUrl = Pt(t.backendUrl), _.authToken = a, _;
5531
5536
  }
5532
- async function vm(t, e, n = "auto", r = !1) {
5537
+ async function Om(t, e, n = "auto", r = !1) {
5533
5538
  if (t.sessionId && t.channelKey)
5534
5539
  throw new L("Cannot specify both sessionId and channelKey. Use sessionId for precomputed sessions or channelKey to select a channel.");
5535
5540
  const i = zo(t.backendType);
@@ -5600,7 +5605,7 @@ async function vm(t, e, n = "auto", r = !1) {
5600
5605
  }
5601
5606
  throw new L("Failed to init after all attempts");
5602
5607
  }
5603
- async function Om(t, e, n = "auto", r = !1) {
5608
+ async function Um(t, e, n = "auto", r = !1) {
5604
5609
  if (t.sessionId && t.channelKey)
5605
5610
  throw new L("Cannot specify both sessionId and channelKey. Use sessionId for precomputed sessions or channelKey to select a channel.");
5606
5611
  const i = zo(t.backendType), s = t.token;
@@ -5652,7 +5657,7 @@ async function Om(t, e, n = "auto", r = !1) {
5652
5657
  }
5653
5658
  throw new L("Failed to init after all attempts");
5654
5659
  }
5655
- const Um = new Uint8Array(0);
5660
+ const Lm = new Uint8Array(0);
5656
5661
  function _t(t) {
5657
5662
  switch (t.kind) {
5658
5663
  case "array":
@@ -5712,7 +5717,7 @@ function ea(t, e) {
5712
5717
  }
5713
5718
  return JSON.stringify(t);
5714
5719
  }
5715
- function Lm(t, e) {
5720
+ function Mm(t, e) {
5716
5721
  const n = (t.parameters ?? []).map((s) => {
5717
5722
  const o = _t(s.type), a = Object.prototype.hasOwnProperty.call(s, "defaultValue"), c = a ? ea(s.defaultValue, o) : "";
5718
5723
  return {
@@ -5740,7 +5745,7 @@ function Lm(t, e) {
5740
5745
  TypeName: He(s.descriptor),
5741
5746
  HasDefaultValue: s.hasDefaultValue,
5742
5747
  DefaultValueJson: s.defaultValueJson,
5743
- DefaultValueData: Um,
5748
+ DefaultValueData: Lm,
5744
5749
  IsEnumerable: !1,
5745
5750
  EnumerableItemTypeName: "",
5746
5751
  Description: s.description ?? ""
@@ -5757,16 +5762,16 @@ function Lm(t, e) {
5757
5762
  function zn(t, e) {
5758
5763
  return { value: t, data: e };
5759
5764
  }
5760
- class Mm extends Error {
5765
+ class Pm extends Error {
5761
5766
  constructor(e, n, r, i = "") {
5762
5767
  super(e), this.remoteErrorType = n, this.remoteStackTrace = r, this.code = i, this.name = "FunctionCallError";
5763
5768
  }
5764
5769
  }
5765
5770
  const Oe = M("FunctionRegistry"), Xn = new Uint8Array(0), Jn = 3e4;
5766
- function Pm(t) {
5771
+ function Fm(t) {
5767
5772
  return !t || typeof t != "object" ? !1 : t.data instanceof Uint8Array;
5768
5773
  }
5769
- class Fm {
5774
+ class Bm {
5770
5775
  functions = /* @__PURE__ */ new Map();
5771
5776
  remoteFunctions = /* @__PURE__ */ new Map();
5772
5777
  pendingCalls = /* @__PURE__ */ new Map();
@@ -5804,7 +5809,7 @@ class Fm {
5804
5809
  * If already connected, sends registration to server immediately.
5805
5810
  */
5806
5811
  register(e, n) {
5807
- const r = Lm(e, n);
5812
+ const r = Mm(e, n);
5808
5813
  return this.functions.set(e.name, r), this.isConnected && this.config && this.sendRegistration(r), () => this.unregister(e.name);
5809
5814
  }
5810
5815
  /**
@@ -6022,7 +6027,7 @@ class Fm {
6022
6027
  return;
6023
6028
  }
6024
6029
  this.pendingCalls.delete(r), clearTimeout(i.timeout);
6025
- const s = new Mm(n.ErrorMessage, n.ErrorTypeName, n.StackTrace, n.ErrorCode), o = { functionName: i.functionName, args: i.args };
6030
+ const s = new Pm(n.ErrorMessage, n.ErrorTypeName, n.StackTrace, n.ErrorCode), o = { functionName: i.functionName, args: i.args };
6026
6031
  for (const a of this.errorInterceptors) {
6027
6032
  const c = a(s, o);
6028
6033
  if (c !== null) {
@@ -6095,7 +6100,7 @@ class Fm {
6095
6100
  }
6096
6101
  const s = await e.handler(...i);
6097
6102
  let o = s, a = Xn;
6098
- Pm(s) && (o = s.value, a = new Uint8Array(s.data));
6103
+ Fm(s) && (o = s.value, a = new Uint8Array(s.data));
6099
6104
  const c = ea(o, e.returnType);
6100
6105
  this.sendResult(n.CallId, n.InstanceId, r, e, c, a);
6101
6106
  } catch (i) {
@@ -6150,8 +6155,8 @@ class Fm {
6150
6155
  this.config.sendProtocolMessage(s);
6151
6156
  }
6152
6157
  }
6153
- const Qt = M("ReactiveRegistry"), Bm = "Ikon.Reactive.Subscribe", xm = "Ikon.Reactive.Unsubscribe", Wm = "Ikon.Reactive.Update", Gm = {
6154
- name: Wm,
6158
+ const Qt = M("ReactiveRegistry"), xm = "Ikon.Reactive.Subscribe", Wm = "Ikon.Reactive.Unsubscribe", Gm = "Ikon.Reactive.Update", Vm = {
6159
+ name: Gm,
6155
6160
  description: "Receives reactive value updates pushed from the server when a subscribed reactive changes",
6156
6161
  returnType: { kind: "string" },
6157
6162
  parameters: [
@@ -6160,7 +6165,7 @@ const Qt = M("ReactiveRegistry"), Bm = "Ikon.Reactive.Subscribe", xm = "Ikon.Rea
6160
6165
  { name: "valueJson", type: { kind: "string" } }
6161
6166
  ]
6162
6167
  };
6163
- class Vm {
6168
+ class Hm {
6164
6169
  subscribersByKey = /* @__PURE__ */ new Map();
6165
6170
  functionRegistry;
6166
6171
  updateHandlerUnregister = null;
@@ -6180,7 +6185,7 @@ class Vm {
6180
6185
  const c = !a;
6181
6186
  if (a || (a = /* @__PURE__ */ new Set(), this.subscribersByKey.set(s, a)), a.add(o), c)
6182
6187
  try {
6183
- const l = await this.functionRegistry.call(Bm, [e, i]), d = Qn(l);
6188
+ const l = await this.functionRegistry.call(xm, [e, i]), d = Qn(l);
6184
6189
  n(d);
6185
6190
  } catch (l) {
6186
6191
  throw a.delete(o), a.size === 0 && this.subscribersByKey.delete(s), l;
@@ -6199,7 +6204,7 @@ class Vm {
6199
6204
  }
6200
6205
  unsubscribeOne(e, n, r) {
6201
6206
  const i = Ft(e, n), s = this.subscribersByKey.get(i);
6202
- s && (s.delete(r), !(s.size > 0) && (this.subscribersByKey.delete(i), this.functionRegistry.call(xm, [e, n]).catch((o) => {
6207
+ s && (s.delete(r), !(s.size > 0) && (this.subscribersByKey.delete(i), this.functionRegistry.call(Wm, [e, n]).catch((o) => {
6203
6208
  Qt.warn(`Failed to unsubscribe from '${e}' (mount='${n}'):`, o);
6204
6209
  })));
6205
6210
  }
@@ -6217,7 +6222,7 @@ class Vm {
6217
6222
  }
6218
6223
  return "";
6219
6224
  };
6220
- this.updateHandlerUnregister = this.functionRegistry.register(Gm, e);
6225
+ this.updateHandlerUnregister = this.functionRegistry.register(Vm, e);
6221
6226
  }
6222
6227
  }
6223
6228
  function Ft(t, e) {
@@ -6232,8 +6237,8 @@ function Qn(t) {
6232
6237
  return Qt.warn("Failed to parse reactive value JSON, returning raw string:", e), t;
6233
6238
  }
6234
6239
  }
6235
- const Hm = "login_required", $m = (t, e) => (t.code !== Hm || (lE({ functionName: e.functionName, args: e.args }), Ho(t.message)), null);
6236
- function Km() {
6240
+ const $m = "login_required", Km = (t, e) => (t.code !== $m || (lE({ functionName: e.functionName, args: e.args }), Ho(t.message)), null);
6241
+ function Ym() {
6237
6242
  if (typeof navigator > "u")
6238
6243
  return !1;
6239
6244
  const t = navigator.userAgentData;
@@ -6242,7 +6247,7 @@ function Km() {
6242
6247
  const e = navigator.userAgent ?? "";
6243
6248
  return /Android|iPhone|iPad|iPod|Mobile|Mobi/i.test(e);
6244
6249
  }
6245
- function Ym(t) {
6250
+ function jm(t) {
6246
6251
  const e = t?.facingMode;
6247
6252
  if (typeof e == "string")
6248
6253
  return e === "user" || e === "environment" ? e : void 0;
@@ -6270,7 +6275,7 @@ const Ze = {
6270
6275
  StopCapture: "ikon.client.stopCapture",
6271
6276
  CaptureImage: "ikon.client.captureImage",
6272
6277
  GetMediaDevices: "ikon.client.getMediaDevices"
6273
- }, jm = {
6278
+ }, zm = {
6274
6279
  name: Ze.StartVideoCapture,
6275
6280
  description: "Start camera or screen capture and stream video frames to the server",
6276
6281
  returnType: { kind: "string" },
@@ -6278,31 +6283,31 @@ const Ze = {
6278
6283
  { name: "source", type: { kind: "string", nullable: !0 }, description: "camera or screen" },
6279
6284
  { name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }
6280
6285
  ]
6281
- }, zm = {
6286
+ }, Xm = {
6282
6287
  name: Ze.StartAudioCapture,
6283
6288
  description: "Start microphone capture and stream audio frames to the server",
6284
6289
  returnType: { kind: "string" },
6285
6290
  parameters: [{ name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }]
6286
- }, Xm = {
6291
+ }, Jm = {
6287
6292
  name: Ze.StopCapture,
6288
6293
  description: "Stop a previously started capture by streamId",
6289
6294
  returnType: { kind: "boolean" },
6290
6295
  parameters: [{ name: "streamId", type: { kind: "string" }, description: "Stream ID to stop" }]
6291
- }, Jm = {
6296
+ }, Qm = {
6292
6297
  name: Ze.CaptureImage,
6293
6298
  description: "Capture a single image from the camera and return metadata (JSON) plus binary image data",
6294
6299
  returnType: { kind: "string" },
6295
6300
  parameters: [{ name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }]
6296
- }, Qm = {
6301
+ }, Zm = {
6297
6302
  name: Ze.GetMediaDevices,
6298
6303
  description: "Get list of available media input devices",
6299
6304
  returnType: { kind: "string" },
6300
6305
  parameters: []
6301
6306
  };
6302
- function Zm(t, e) {
6307
+ function qm(t, e) {
6303
6308
  const n = [];
6304
6309
  return n.push(
6305
- t.register(jm, async (r, i) => {
6310
+ t.register(zm, async (r, i) => {
6306
6311
  if (e.isWebRtcEnabled) {
6307
6312
  const l = e.webRtcSignaling;
6308
6313
  if (!l)
@@ -6317,7 +6322,7 @@ function Zm(t, e) {
6317
6322
  return ((typeof r == "string" && r.trim().toLowerCase() === "screen" ? "screen" : "camera") === "screen" ? await s.video.startScreen({ userGesture: !1, options: o, constraints: o?.constraints }) : await s.video.startCamera({ userGesture: !1, options: o, constraints: o?.constraints })).streamId;
6318
6323
  })
6319
6324
  ), n.push(
6320
- t.register(zm, async (r) => {
6325
+ t.register(Xm, async (r) => {
6321
6326
  if (e.isWebRtcEnabled) {
6322
6327
  const a = e.webRtcSignaling;
6323
6328
  if (!a)
@@ -6332,7 +6337,7 @@ function Zm(t, e) {
6332
6337
  return (await i.audio.startMic({ userGesture: !1, options: s, constraints: s?.constraints })).streamId;
6333
6338
  })
6334
6339
  ), n.push(
6335
- t.register(Xm, async (r) => {
6340
+ t.register(Jm, async (r) => {
6336
6341
  if (e.isWebRtcEnabled) {
6337
6342
  const a = e.webRtcSignaling;
6338
6343
  return a && await a.stopCapture(), !0;
@@ -6344,14 +6349,14 @@ function Zm(t, e) {
6344
6349
  return s || o;
6345
6350
  })
6346
6351
  ), n.push(
6347
- t.register(Jm, async (r) => {
6352
+ t.register(Qm, async (r) => {
6348
6353
  const i = await e.ensureMediaCapture();
6349
6354
  if (!i)
6350
6355
  throw new Error("Media capture is not available in this environment");
6351
6356
  const s = Ue(r) ?? {};
6352
- if (s.mode === "native" && Km()) {
6357
+ if (s.mode === "native" && Ym()) {
6353
6358
  const l = await i.image.captureFromNativeCamera({
6354
- facing: Ym(s.constraints),
6359
+ facing: jm(s.constraints),
6355
6360
  mime: s.mime,
6356
6361
  quality: s.quality,
6357
6362
  width: s.width,
@@ -6382,7 +6387,7 @@ function Zm(t, e) {
6382
6387
  return zn(c, a.data);
6383
6388
  })
6384
6389
  ), n.push(
6385
- t.register(Qm, async () => {
6390
+ t.register(Zm, async () => {
6386
6391
  if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices)
6387
6392
  return JSON.stringify([]);
6388
6393
  const i = (await navigator.mediaDevices.enumerateDevices()).filter((s) => s.kind === "audioinput" || s.kind === "videoinput").map((s) => ({
@@ -6402,22 +6407,22 @@ const ta = {
6402
6407
  PlaySound: "ikon.client.playSound",
6403
6408
  StopSound: "ikon.client.stopSound"
6404
6409
  }, Zt = /* @__PURE__ */ new Map(), Se = /* @__PURE__ */ new Map();
6405
- let qm = 1;
6406
- const e_ = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", t_ = 8, $e = [];
6410
+ let e_ = 1;
6411
+ const t_ = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", n_ = 8, $e = [];
6407
6412
  let nt = !1, te = null;
6408
6413
  function na() {
6409
6414
  if (!($e.length > 0 || typeof Audio > "u"))
6410
- for (let t = 0; t < t_; t++) {
6415
+ for (let t = 0; t < n_; t++) {
6411
6416
  const e = new Audio();
6412
6417
  e.preload = "auto", $e.push(e);
6413
6418
  }
6414
6419
  }
6415
- function n_() {
6420
+ function r_() {
6416
6421
  if (!nt) {
6417
6422
  na();
6418
6423
  for (const t of $e)
6419
6424
  try {
6420
- t.src = e_;
6425
+ t.src = t_;
6421
6426
  const e = t.play();
6422
6427
  e && typeof e.then == "function" ? e.then(
6423
6428
  () => {
@@ -6431,16 +6436,16 @@ function n_() {
6431
6436
  nt && qt();
6432
6437
  }
6433
6438
  }
6434
- function r_() {
6439
+ function i_() {
6435
6440
  if (te || typeof window > "u")
6436
6441
  return;
6437
- const t = () => n_();
6442
+ const t = () => r_();
6438
6443
  te = t, window.addEventListener("pointerdown", t, { capture: !0 }), window.addEventListener("touchend", t, { capture: !0 }), window.addEventListener("mousedown", t, { capture: !0 }), window.addEventListener("keydown", t, { capture: !0 });
6439
6444
  }
6440
6445
  function qt() {
6441
6446
  !te || typeof window > "u" || (window.removeEventListener("pointerdown", te, { capture: !0 }), window.removeEventListener("touchend", te, { capture: !0 }), window.removeEventListener("mousedown", te, { capture: !0 }), window.removeEventListener("keydown", te, { capture: !0 }), te = null);
6442
6447
  }
6443
- function i_() {
6448
+ function s_() {
6444
6449
  na();
6445
6450
  for (const e of $e)
6446
6451
  if (e.paused || e.ended)
@@ -6448,7 +6453,7 @@ function i_() {
6448
6453
  const t = new Audio();
6449
6454
  return t.preload = "auto", $e.push(t), t;
6450
6455
  }
6451
- const s_ = {
6456
+ const o_ = {
6452
6457
  name: ta.PlaySound,
6453
6458
  description: "Play a sound effect",
6454
6459
  returnType: { kind: "string", nullable: !0 },
@@ -6459,7 +6464,7 @@ const s_ = {
6459
6464
  { name: "loop", type: { kind: "boolean", nullable: !0 }, description: "Loop the sound" }
6460
6465
  ]
6461
6466
  };
6462
- function o_(t, e, n, r) {
6467
+ function a_(t, e, n, r) {
6463
6468
  if (typeof window > "u" || typeof Audio > "u" || typeof t != "string" || !t.trim())
6464
6469
  return Promise.resolve(null);
6465
6470
  let i = t;
@@ -6471,11 +6476,11 @@ function o_(t, e, n, r) {
6471
6476
  }
6472
6477
  return new Promise((s) => {
6473
6478
  try {
6474
- const o = i_();
6479
+ const o = s_();
6475
6480
  o.src = i, o.currentTime = 0, o.loop = r === !0;
6476
6481
  const a = typeof n == "number" ? Math.max(0, Math.min(1, n)) : 1;
6477
6482
  o.volume = a;
6478
- const c = `sound-${qm++}`, l = () => {
6483
+ const c = `sound-${e_++}`, l = () => {
6479
6484
  Se.delete(c), o.removeEventListener("ended", l), o.removeEventListener("error", l);
6480
6485
  };
6481
6486
  o.addEventListener("ended", l), o.addEventListener("error", l), Se.set(c, o), o.play().then(
@@ -6489,13 +6494,13 @@ function o_(t, e, n, r) {
6489
6494
  }
6490
6495
  });
6491
6496
  }
6492
- const a_ = {
6497
+ const c_ = {
6493
6498
  name: ta.StopSound,
6494
6499
  description: "Stop a playing sound by ID",
6495
6500
  returnType: { kind: "boolean" },
6496
6501
  parameters: [{ name: "playbackId", type: { kind: "string" }, description: "Playback ID from playSound" }]
6497
6502
  };
6498
- function c_(t) {
6503
+ function l_(t) {
6499
6504
  if (typeof t != "string")
6500
6505
  return !1;
6501
6506
  const e = Se.get(t);
@@ -6507,7 +6512,7 @@ function c_(t) {
6507
6512
  return !1;
6508
6513
  }
6509
6514
  }
6510
- function l_() {
6515
+ function u_() {
6511
6516
  Zt.clear();
6512
6517
  for (const [t, e] of Se) {
6513
6518
  try {
@@ -6518,18 +6523,18 @@ function l_() {
6518
6523
  }
6519
6524
  qt();
6520
6525
  }
6521
- const u_ = [
6522
- { definition: s_, handler: o_ },
6523
- { definition: a_, handler: c_ }
6526
+ const d_ = [
6527
+ { definition: o_, handler: a_ },
6528
+ { definition: c_, handler: l_ }
6524
6529
  ];
6525
- function d_(t) {
6526
- r_();
6527
- const e = u_.map(({ definition: n, handler: r }) => t.register(n, r));
6530
+ function h_(t) {
6531
+ i_();
6532
+ const e = d_.map(({ definition: n, handler: r }) => t.register(n, r));
6528
6533
  return () => {
6529
- e.forEach((n) => n()), l_();
6534
+ e.forEach((n) => n()), u_();
6530
6535
  };
6531
6536
  }
6532
- function h_() {
6537
+ function f_() {
6533
6538
  const r = new ArrayBuffer(882044), i = new DataView(r), s = (a, c) => {
6534
6539
  for (let l = 0; l < c.length; l++)
6535
6540
  i.setUint8(a + l, c.charCodeAt(l));
@@ -6544,7 +6549,7 @@ class ra {
6544
6549
  return this._silentAudioElement;
6545
6550
  }
6546
6551
  setup(e, n) {
6547
- if (!(typeof document > "u") && (this._silentAudioElement || (this._silentAudioElement = document.createElement("audio"), this._silentAudioElement.src = h_(), this._silentAudioElement.loop = !0, this._silentAudioElement.volume = 0.01, this._silentAudioElement.play().catch(() => {
6552
+ if (!(typeof document > "u") && (this._silentAudioElement || (this._silentAudioElement = document.createElement("audio"), this._silentAudioElement.src = f_(), this._silentAudioElement.loop = !0, this._silentAudioElement.volume = 0.01, this._silentAudioElement.play().catch(() => {
6548
6553
  })), typeof navigator < "u" && "mediaSession" in navigator)) {
6549
6554
  const r = e ?? {};
6550
6555
  navigator.mediaSession.metadata = new MediaMetadata({
@@ -6584,26 +6589,26 @@ class ra {
6584
6589
  }
6585
6590
  const ia = M("DebugMode");
6586
6591
  let ce = !1;
6587
- function f_() {
6592
+ function p_() {
6588
6593
  return ce ? !0 : (ce = Dp(), ce && (Mo(re.DEBUG), ia.info("Debug mode enabled")), ce);
6589
6594
  }
6590
6595
  function Zn() {
6591
6596
  return ce;
6592
6597
  }
6593
- function p_() {
6598
+ function E_() {
6594
6599
  ce || (ce = !0, Mo(re.DEBUG), ia.info("Debug mode enabled"), xo(Po, "true"));
6595
6600
  }
6596
6601
  let Ke = !1;
6597
- function E_() {
6602
+ function m_() {
6598
6603
  return Ke = Lp(), Ke;
6599
6604
  }
6600
- function zI() {
6605
+ function XI() {
6601
6606
  return Ke;
6602
6607
  }
6603
- function XI() {
6608
+ function JI() {
6604
6609
  Ke || (Ke = !0, xo(Bo, "true"));
6605
6610
  }
6606
- const m_ = /* @__PURE__ */ new Set([
6611
+ const __ = /* @__PURE__ */ new Set([
6607
6612
  "http",
6608
6613
  "https",
6609
6614
  "file",
@@ -6620,12 +6625,12 @@ const m_ = /* @__PURE__ */ new Set([
6620
6625
  "edge",
6621
6626
  "moz-extension",
6622
6627
  "safari-web-extension"
6623
- ]), __ = /^([a-z][a-z0-9+.-]*):/i;
6624
- function I_(t) {
6625
- const e = __.exec(t.trim());
6626
- return e ? !m_.has(e[1].toLowerCase()) : !1;
6627
- }
6628
+ ]), I_ = /^([a-z][a-z0-9+.-]*):/i;
6628
6629
  function T_(t) {
6630
+ const e = I_.exec(t.trim());
6631
+ return e ? !__.has(e[1].toLowerCase()) : !1;
6632
+ }
6633
+ function w_(t) {
6629
6634
  if (typeof document > "u")
6630
6635
  return;
6631
6636
  const e = document.createElement("iframe");
@@ -6640,60 +6645,60 @@ function T_(t) {
6640
6645
  }
6641
6646
  const sa = 1e3, oa = re.INFO;
6642
6647
  let Y = [], en = sa, aa = oa, tn = null;
6643
- function w_(t) {
6648
+ function g_(t) {
6644
6649
  t.level < aa || (Y.push(t), Y.length > en && (Y = Y.slice(-en)));
6645
6650
  }
6646
- function g_(t) {
6647
- en = t?.maxBufferSize ?? sa, aa = t?.minLevel ?? oa, Y = [], hp(w_);
6651
+ function S_(t) {
6652
+ en = t?.maxBufferSize ?? sa, aa = t?.minLevel ?? oa, Y = [], hp(g_);
6648
6653
  }
6649
- function JI(t) {
6654
+ function QI(t) {
6650
6655
  tn = t;
6651
6656
  }
6652
- function QI() {
6657
+ function ZI() {
6653
6658
  return Y;
6654
6659
  }
6655
6660
  function ca() {
6656
6661
  const t = Y;
6657
6662
  return Y = [], t;
6658
6663
  }
6659
- function ZI() {
6664
+ function qI() {
6660
6665
  if (!tn || Y.length === 0)
6661
6666
  return 0;
6662
6667
  const t = ca();
6663
6668
  return tn(t), t.length;
6664
6669
  }
6665
- function qI() {
6670
+ function eT() {
6666
6671
  Y = [];
6667
6672
  }
6668
- function eT() {
6673
+ function tT() {
6669
6674
  return Y.length;
6670
6675
  }
6671
- g_();
6672
- const S_ = M("LogSender"), Ye = 1e3, C_ = 6e4, qn = 10 * 1024, A_ = 400 * 1024, er = "…[truncated]", y_ = {
6676
+ S_();
6677
+ const C_ = M("LogSender"), Ye = 1e3, A_ = 6e4, qn = 10 * 1024, y_ = 400 * 1024, er = "…[truncated]", R_ = {
6673
6678
  [re.DEBUG]: pe.Debug,
6674
6679
  [re.INFO]: pe.Info,
6675
6680
  [re.WARN]: pe.Warning,
6676
6681
  [re.ERROR]: pe.Error
6677
6682
  };
6678
6683
  let je, vn, On, Un, ie, ee = [], Ce = 0, Be;
6679
- function R_(t) {
6684
+ function b_(t) {
6680
6685
  return t.length <= qn ? t : t.slice(0, qn - er.length) + er;
6681
6686
  }
6682
- function b_(t) {
6687
+ function N_(t) {
6683
6688
  return {
6684
6689
  Time: t.timestamp,
6685
- Type: y_[t.level] ?? pe.Info,
6686
- Message: R_(`[${t.component}] ${t.message}`),
6690
+ Type: R_[t.level] ?? pe.Info,
6691
+ Message: b_(`[${t.component}] ${t.message}`),
6687
6692
  Parameters: "{}"
6688
6693
  };
6689
6694
  }
6690
6695
  function la(t) {
6691
6696
  return JSON.stringify({ type: "sdk-typescript", event: { Logs: t }, session: On, room: Un });
6692
6697
  }
6693
- function N_(t) {
6698
+ function k_(t) {
6694
6699
  if (t.length === 0)
6695
6700
  return [];
6696
- const e = la([]).length, n = A_ - e, r = [];
6701
+ const e = la([]).length, n = y_ - e, r = [];
6697
6702
  let i = [], s = 0;
6698
6703
  for (const o of t) {
6699
6704
  const a = JSON.stringify(o).length + 1;
@@ -6701,7 +6706,7 @@ function N_(t) {
6701
6706
  }
6702
6707
  return i.length > 0 && r.push(i), r;
6703
6708
  }
6704
- async function k_(t) {
6709
+ async function D_(t) {
6705
6710
  if (t.length === 0 || !je)
6706
6711
  return;
6707
6712
  const e = `${je}/events/logs/json`, n = {
@@ -6714,25 +6719,25 @@ async function k_(t) {
6714
6719
  });
6715
6720
  if (!r.ok) {
6716
6721
  if (r.status >= 400 && r.status < 500) {
6717
- S_.warn(`Dropping ${t.length} log entries due to ${r.status}`);
6722
+ C_.warn(`Dropping ${t.length} log entries due to ${r.status}`);
6718
6723
  return;
6719
6724
  }
6720
6725
  throw new Error(`Failed to send logs: ${r.status}`);
6721
6726
  }
6722
6727
  }
6723
- function D_() {
6728
+ function v_() {
6724
6729
  if (Ce === 0)
6725
6730
  return Ye;
6726
6731
  const t = Ye * (1 << Math.min(Ce, 6));
6727
- return Math.min(t, C_);
6732
+ return Math.min(t, A_);
6728
6733
  }
6729
6734
  function xe(t) {
6730
- je && (ie = setTimeout(() => void v_(), t));
6735
+ je && (ie = setTimeout(() => void O_(), t));
6731
6736
  }
6732
- async function v_() {
6737
+ async function O_() {
6733
6738
  ie = void 0;
6734
6739
  const t = ca();
6735
- if (ee = ee.concat(t.map(b_)), typeof navigator < "u" && navigator.onLine === !1) {
6740
+ if (ee = ee.concat(t.map(N_)), typeof navigator < "u" && navigator.onLine === !1) {
6736
6741
  xe(Ye);
6737
6742
  return;
6738
6743
  }
@@ -6742,36 +6747,36 @@ async function v_() {
6742
6747
  }
6743
6748
  const e = ee;
6744
6749
  ee = [];
6745
- const n = N_(e);
6750
+ const n = k_(e);
6746
6751
  let r = !1;
6747
6752
  for (let i = 0; i < n.length; i++)
6748
6753
  try {
6749
- await k_(n[i]);
6754
+ await D_(n[i]);
6750
6755
  } catch {
6751
6756
  ee = n.slice(i).flat().concat(ee), r = !0;
6752
6757
  break;
6753
6758
  }
6754
- r ? Ce++ : Ce = 0, xe(D_());
6759
+ r ? Ce++ : Ce = 0, xe(v_());
6755
6760
  }
6756
- function O_() {
6761
+ function U_() {
6757
6762
  ie !== void 0 && (clearTimeout(ie), ie = void 0), xe(0);
6758
6763
  }
6759
- function U_(t, e, n, r) {
6760
- ua(), je = t, vn = e, On = n, Un = r, Ce = 0, typeof window < "u" && (Be = O_, window.addEventListener("online", Be)), xe(Ye);
6764
+ function L_(t, e, n, r) {
6765
+ ua(), je = t, vn = e, On = n, Un = r, Ce = 0, typeof window < "u" && (Be = U_, window.addEventListener("online", Be)), xe(Ye);
6761
6766
  }
6762
6767
  function ua() {
6763
6768
  ie !== void 0 && (clearTimeout(ie), ie = void 0), Be !== void 0 && typeof window < "u" && (window.removeEventListener("online", Be), Be = void 0), je = void 0, vn = void 0, On = void 0, Un = void 0, ee = [], Ce = 0;
6764
6769
  }
6765
- const L_ = [
6770
+ const M_ = [
6766
6771
  { name: "WebSocket", isPresent: () => typeof WebSocket < "u" },
6767
6772
  { name: "fetch", isPresent: () => typeof fetch < "u" },
6768
6773
  { name: "BigInt", isPresent: () => typeof BigInt < "u" },
6769
6774
  { name: "globalThis", isPresent: () => typeof globalThis < "u" },
6770
6775
  { name: "Promise.allSettled", isPresent: () => typeof Promise < "u" && typeof Promise.allSettled == "function" }
6771
6776
  ];
6772
- function M_() {
6777
+ function P_() {
6773
6778
  const t = [];
6774
- for (const e of L_) {
6779
+ for (const e of M_) {
6775
6780
  let n;
6776
6781
  try {
6777
6782
  n = e.isPresent();
@@ -6796,8 +6801,8 @@ const nr = {
6796
6801
  [y.WebSocket]: 1,
6797
6802
  [y.WebTransportProxy]: 2,
6798
6803
  [y.WebSocketProxy]: 3
6799
- }, rt = /* @__PURE__ */ new Set([y.WebTransportProxy, y.WebSocketProxy]), Bt = /* @__PURE__ */ new Set([y.WebTransport, y.WebSocket]), rr = /* @__PURE__ */ new Set([y.WebSocket, y.WebSocketProxy]), ir = /* @__PURE__ */ new Set([y.WebTransport, y.WebTransportProxy]), he = M("EndpointSelector"), it = "ikon_endpoint_type", fe = "ikon_proxy_preferred", Le = "ikon_endpoint_ts", P_ = 1440 * 60 * 1e3;
6800
- class F_ {
6804
+ }, rt = /* @__PURE__ */ new Set([y.WebTransportProxy, y.WebSocketProxy]), Bt = /* @__PURE__ */ new Set([y.WebTransport, y.WebSocket]), rr = /* @__PURE__ */ new Set([y.WebSocket, y.WebSocketProxy]), ir = /* @__PURE__ */ new Set([y.WebTransport, y.WebTransportProxy]), he = M("EndpointSelector"), it = "ikon-endpoint-type", fe = "ikon-proxy-preferred", Le = "ikon-endpoint-timestamp", F_ = 1440 * 60 * 1e3;
6805
+ class B_ {
6801
6806
  isLocal;
6802
6807
  _proxyMode;
6803
6808
  _websocket;
@@ -6909,7 +6914,7 @@ class F_ {
6909
6914
  const e = localStorage.getItem(Le);
6910
6915
  if (e !== null) {
6911
6916
  const n = Date.now() - Number(e);
6912
- if (n > P_)
6917
+ if (n > F_)
6913
6918
  return he.warn(`Preferences expired (age: ${Math.round(n / 36e5)}h), clearing`), localStorage.removeItem(it), localStorage.removeItem(fe), localStorage.removeItem(Le), !0;
6914
6919
  }
6915
6920
  } catch {
@@ -6939,10 +6944,10 @@ class F_ {
6939
6944
  }
6940
6945
  }
6941
6946
  const m = M("IkonClient");
6942
- function B_() {
6947
+ function x_() {
6943
6948
  return typeof __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__ < "u" && __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__;
6944
6949
  }
6945
- class tT {
6950
+ class nT {
6946
6951
  channelManager = null;
6947
6952
  protocolWorker = null;
6948
6953
  preloadedWorker = null;
@@ -7039,7 +7044,7 @@ class tT {
7039
7044
  _serverStopped = !1;
7040
7045
  _hasBeenConnected = !1;
7041
7046
  // External connect URL mode
7042
- _waitForExternalConnectUrl = B_();
7047
+ _waitForExternalConnectUrl = x_();
7043
7048
  _externalConnectUrlCleanup = null;
7044
7049
  /**
7045
7050
  * SDK-provided custom (non-WebRTC) media playback pipeline.
@@ -7068,10 +7073,10 @@ class tT {
7068
7073
  * later user-gesture click resolves instantly (keeping the gesture intact for iOS).
7069
7074
  */
7070
7075
  async ensureMediaCapture() {
7071
- return this._mediaCapture ? this._mediaCapture : De() ? (this._mediaCapturePromise || (this._mediaCapturePromise = Promise.resolve().then(() => CI).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture))), this._mediaCapturePromise) : null;
7076
+ return this._mediaCapture ? this._mediaCapture : De() ? (this._mediaCapturePromise || (this._mediaCapturePromise = Promise.resolve().then(() => AI).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture))), this._mediaCapturePromise) : null;
7072
7077
  }
7073
7078
  async ensureMedia() {
7074
- return this._media ? this._media : (this._mediaPromise || (this._mediaPromise = Promise.resolve().then(() => rI).then(({ IkonMedia: e }) => (this._media = new e(this, this._mediaConfig), this._media))), this._mediaPromise);
7079
+ return this._media ? this._media : (this._mediaPromise || (this._mediaPromise = Promise.resolve().then(() => iI).then(({ IkonMedia: e }) => (this._media = new e(this, this._mediaConfig), this._media))), this._mediaPromise);
7075
7080
  }
7076
7081
  /**
7077
7082
  * Whether audio playback is enabled.
@@ -7137,14 +7142,14 @@ class tT {
7137
7142
  throw new Error('IkonClient requires one of: "local", "apiKey", or "sessionToken" configuration');
7138
7143
  if (n > 1)
7139
7144
  throw new Error('IkonClient accepts only one of: "local", "apiKey", or "sessionToken" configuration');
7140
- f_(), De() && fE();
7145
+ p_(), De() && fE();
7141
7146
  const r = e.local ? null : bp() ?? e.proxy ?? null, i = r === !0 ? "force-proxy" : r === !1 ? "force-direct" : "auto", s = e.local ? null : Np(), o = e.local ? null : kp(), a = s ?? e.websocket, c = o ?? e.webtransport ?? !1;
7142
- this.endpointSelector = new F_({
7147
+ this.endpointSelector = new B_({
7143
7148
  local: e.local,
7144
7149
  proxyMode: i,
7145
7150
  websocket: a,
7146
7151
  webtransport: c
7147
- }), i !== "auto" ? m.info(`Proxy mode: ${i}`) : this.endpointSelector.proxyPreferred && m.info("Proxy preferred (from previous session)"), (a !== void 0 || c !== void 0) && m.debug(`Transport filter: websocket=${a ?? "auto"}, webtransport=${c ?? "auto"}`), this._functionRegistry = new Fm(), this._reactiveRegistry = new Vm(this._functionRegistry), De() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = cm(this._functionRegistry), this.unregisterSoundFunctions = d_(this._functionRegistry)), De() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor($m));
7152
+ }), i !== "auto" ? m.info(`Proxy mode: ${i}`) : this.endpointSelector.proxyPreferred && m.info("Proxy preferred (from previous session)"), (a !== void 0 || c !== void 0) && m.debug(`Transport filter: websocket=${a ?? "auto"}, webtransport=${c ?? "auto"}`), this._functionRegistry = new Bm(), this._reactiveRegistry = new Hm(this._functionRegistry), De() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = lm(this._functionRegistry), this.unregisterSoundFunctions = h_(this._functionRegistry)), De() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(Km));
7148
7153
  const l = Op(), d = Up();
7149
7154
  this._audioEnabled = l ?? e.audio?.enabled ?? !0, this._videoEnabled = d ?? e.video?.enabled ?? !0;
7150
7155
  const h = e.audio ? {
@@ -7158,7 +7163,7 @@ class tT {
7158
7163
  preferWebCodecs: e.audio?.performance?.preferWebCodecs
7159
7164
  }
7160
7165
  }
7161
- }, De() && (this.unregisterMediaCaptureFunctions = Zm(this._functionRegistry, this));
7166
+ }, De() && (this.unregisterMediaCaptureFunctions = qm(this._functionRegistry, this));
7162
7167
  }
7163
7168
  _lastError = void 0;
7164
7169
  /**
@@ -7225,7 +7230,7 @@ class tT {
7225
7230
  if (this._connectStarted)
7226
7231
  throw new Error(`Cannot connect: already started (state: ${this.currentState})`);
7227
7232
  this._connectStarted = !0;
7228
- const e = M_();
7233
+ const e = P_();
7229
7234
  if (!e.supported) {
7230
7235
  this.setErrorState(new dp(e.missingFeatures));
7231
7236
  return;
@@ -7256,10 +7261,10 @@ class tT {
7256
7261
  }, this.connectionTimeoutMs);
7257
7262
  try {
7258
7263
  const n = await e();
7259
- if (this.authResponse = n.authResponse, this._sessionId = n.authResponse.ClientContext.SessionId, this._connectUrl = n.directUrl, this._brandingRequired = n.brandingRequired ?? !1, m.info(`Authenticated to Ikon server (${n.authResponse.ServerSessionId})`), !this.config.local && n.backendUrl && n.authToken && U_(n.backendUrl, n.authToken, n.authResponse.ServerSessionId, n.authResponse.ChannelInstanceId), n.usedProxyUrl && n.directUrl) {
7264
+ if (this.authResponse = n.authResponse, this._sessionId = n.authResponse.ClientContext.SessionId, this._connectUrl = n.directUrl, this._brandingRequired = n.brandingRequired ?? !1, m.info(`Authenticated to Ikon server (${n.authResponse.ServerSessionId})`), !this.config.local && n.backendUrl && n.authToken && L_(n.backendUrl, n.authToken, n.authResponse.ServerSessionId, n.authResponse.ChannelInstanceId), n.usedProxyUrl && n.directUrl) {
7260
7265
  m.info("Auth fell back to proxy, marking proxy preferred");
7261
7266
  const r = n.directUrl;
7262
- bm(r).then((i) => {
7267
+ Nm(r).then((i) => {
7263
7268
  i && (m.info("Background probe: direct server reachable, clearing proxy preference for next connection"), this.endpointSelector.clearProxyPreference());
7264
7269
  }).catch(() => {
7265
7270
  });
@@ -7504,13 +7509,13 @@ class tT {
7504
7509
  async authenticate() {
7505
7510
  const e = this.abortController?.signal;
7506
7511
  if (this.config.local)
7507
- return Dm(this.config.local, e);
7512
+ return vm(this.config.local, e);
7508
7513
  const n = this.endpointSelector.proxyMode, r = this.endpointSelector.proxyPreferred;
7509
7514
  let i;
7510
7515
  if (this.config.apiKey)
7511
- i = await vm(this.config.apiKey, e, n, r);
7516
+ i = await Om(this.config.apiKey, e, n, r);
7512
7517
  else if (this.config.sessionToken)
7513
- i = await Om(this.config.sessionToken, e, n, r);
7518
+ i = await Um(this.config.sessionToken, e, n, r);
7514
7519
  else
7515
7520
  throw new Error("No connection configuration provided (need local, apiKey, or sessionToken)");
7516
7521
  return i.usedProxyUrl && n === "auto" && this.endpointSelector.markProxyPreferred(), i;
@@ -7536,7 +7541,7 @@ class tT {
7536
7541
  return;
7537
7542
  }
7538
7543
  if (n === S.CORE_GLOBAL_STATE && Cd(e).then((i) => {
7539
- this._globalState = i, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(i, this._sessionId), this._globalState.DebugMode && p_(), Zn() && this.protocolWorker && (this.protocolWorker.postMessage({ type: "enableDevtools", enabled: !0 }), this.protocolWorker.postMessage({ type: "setLogLevel", level: Vn() })), this._globalStateReceived || (this._globalStateReceived = !0, this.tryHandleJoined());
7544
+ this._globalState = i, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(i, this._sessionId), this._globalState.DebugMode && E_(), Zn() && this.protocolWorker && (this.protocolWorker.postMessage({ type: "enableDevtools", enabled: !0 }), this.protocolWorker.postMessage({ type: "setLogLevel", level: Vn() })), this._globalStateReceived || (this._globalStateReceived = !0, this.tryHandleJoined());
7540
7545
  }).catch((i) => {
7541
7546
  m.error("Failed to parse GlobalState:", i);
7542
7547
  }), n === S.CORE_CLIENT_INITIALIZATION && Cu(e).then((i) => {
@@ -7758,7 +7763,7 @@ class tT {
7758
7763
  p || (_ = void 0, u(new Error("Protocol worker connect timed out")));
7759
7764
  }, sE);
7760
7765
  }), s = this.computeOrderedEndpointTypes(e), o = this.getServerKeepaliveTimeoutMs(), a = this.config.timeouts?.reconnectBackoffMs ?? $n, c = this.config.timeouts?.maxReconnectAttempts ?? Kn;
7761
- this.updateWorkerInterestMask(), Zn() && (r.postMessage({ type: "enableDevtools", enabled: !0 }), r.postMessage({ type: "setLogLevel", level: Vn() })), E_();
7766
+ this.updateWorkerInterestMask(), Zn() && (r.postMessage({ type: "enableDevtools", enabled: !0 }), r.postMessage({ type: "setLogLevel", level: Vn() })), m_();
7762
7767
  const d = Dt() ?? this.config.webRtc?.enabled ?? !0;
7763
7768
  r.postMessage({
7764
7769
  type: "connect",
@@ -8116,7 +8121,7 @@ class tT {
8116
8121
  if (!r || r.target && r.target !== "_self")
8117
8122
  return;
8118
8123
  const i = r.getAttribute("href") ?? "";
8119
- I_(i) && (e.preventDefault(), T_(i));
8124
+ T_(i) && (e.preventDefault(), w_(i));
8120
8125
  }
8121
8126
  /**
8122
8127
  * Send an in-band "I'm leaving" signal over the live channel. Best-effort: reliable on a
@@ -8286,7 +8291,7 @@ class tT {
8286
8291
  }
8287
8292
  }
8288
8293
  }
8289
- class x_ {
8294
+ class W_ {
8290
8295
  constructor(e) {
8291
8296
  this.client = e;
8292
8297
  }
@@ -8311,29 +8316,29 @@ class x_ {
8311
8316
  } };
8312
8317
  }
8313
8318
  }
8314
- function nT(t) {
8315
- return new x_(t);
8316
- }
8317
8319
  function rT(t) {
8318
- return t === "waitingForExternalConnectUrl" || t === "connecting" || t === "connectingSlow" || t === "reconnecting";
8320
+ return new W_(t);
8319
8321
  }
8320
8322
  function iT(t) {
8321
- return t === "connected";
8323
+ return t === "waitingForExternalConnectUrl" || t === "connecting" || t === "connectingSlow" || t === "reconnecting";
8322
8324
  }
8323
8325
  function sT(t) {
8324
- return t === "offline" || t === "offlineError";
8326
+ return t === "connected";
8325
8327
  }
8326
8328
  function oT(t) {
8329
+ return t === "offline" || t === "offlineError";
8330
+ }
8331
+ function aT(t) {
8327
8332
  return t === "offlineError";
8328
8333
  }
8329
8334
  const da = /* @__PURE__ */ new Map();
8330
8335
  for (const [t, e] of Object.entries(S))
8331
8336
  typeof e == "number" && da.set(e, t);
8332
- function aT(t) {
8337
+ function cT(t) {
8333
8338
  return da.get(t) ?? `UNKNOWN_${t}`;
8334
8339
  }
8335
- const nn = "ikon.login.appRoute";
8336
- function cT(t) {
8340
+ const nn = "ikon-login-app-route";
8341
+ function lT(t) {
8337
8342
  if (typeof window > "u")
8338
8343
  return;
8339
8344
  try {
@@ -8343,7 +8348,7 @@ function cT(t) {
8343
8348
  const e = new URL(window.location.href);
8344
8349
  e.searchParams.set(Fo, t), window.location.href = e.toString();
8345
8350
  }
8346
- function lT() {
8351
+ function uT() {
8347
8352
  let t = null;
8348
8353
  try {
8349
8354
  t = sessionStorage.getItem(nn), sessionStorage.removeItem(nn);
@@ -8356,13 +8361,13 @@ const ha = () => {
8356
8361
  return !1;
8357
8362
  const t = navigator.userAgent, e = /iPad|iPhone|iPod/.test(t), n = t.includes("Macintosh") && typeof navigator.maxTouchPoints == "number" && navigator.maxTouchPoints > 1;
8358
8363
  return e || n;
8359
- }, st = M("Capabilities"), W_ = globalThis;
8364
+ }, st = M("Capabilities"), G_ = globalThis;
8360
8365
  function ut() {
8361
8366
  if (typeof SharedArrayBuffer > "u")
8362
8367
  return st.debug("SharedArrayBuffer not supported: SharedArrayBuffer is undefined"), !1;
8363
8368
  if (typeof Atomics > "u")
8364
8369
  return st.debug("SharedArrayBuffer not supported: Atomics is undefined"), !1;
8365
- if (W_.crossOriginIsolated === !1)
8370
+ if (G_.crossOriginIsolated === !1)
8366
8371
  return st.debug("SharedArrayBuffer not supported: crossOriginIsolated is false (missing COOP/COEP headers)"), !1;
8367
8372
  try {
8368
8373
  new SharedArrayBuffer(1);
@@ -8374,7 +8379,7 @@ function ut() {
8374
8379
  function fa(t) {
8375
8380
  return typeof AudioWorkletNode != "function" ? !1 : typeof t.audioWorklet?.addModule == "function";
8376
8381
  }
8377
- function G_(t) {
8382
+ function V_(t) {
8378
8383
  return new Worker(
8379
8384
  "" + new URL("assets/audio-playback-worker-CC2FKp8X.js", import.meta.url).href,
8380
8385
  {
@@ -8383,7 +8388,7 @@ function G_(t) {
8383
8388
  }
8384
8389
  );
8385
8390
  }
8386
- const ot = 48e3, G = 2, pa = 1500, sr = 512, or = "playback", V_ = 120, H_ = 300, $_ = 4, K_ = 200, Y_ = 100, j_ = 8e3, z_ = 10, Ea = 100, rn = 50, ma = 128, X_ = 20, J_ = !0, oe = 1500, Q_ = -20, ar = -100, cr = 200, O = M("IkonAudioPlayback"), Z_ = () => {
8391
+ const ot = 48e3, G = 2, pa = 1500, sr = 512, or = "playback", H_ = 120, $_ = 300, K_ = 4, Y_ = 200, j_ = 100, z_ = 8e3, X_ = 10, Ea = 100, rn = 50, ma = 128, J_ = 20, Q_ = !0, oe = 1500, Z_ = -20, ar = -100, cr = 200, O = M("IkonAudioPlayback"), q_ = () => {
8387
8392
  if (typeof navigator > "u" || typeof window > "u")
8388
8393
  return !1;
8389
8394
  const t = navigator.userAgent, e = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t), n = t.includes("Macintosh") && typeof navigator.maxTouchPoints == "number" && navigator.maxTouchPoints > 1;
@@ -8395,19 +8400,19 @@ const ot = 48e3, G = 2, pa = 1500, sr = 512, or = "playback", V_ = 120, H_ = 300
8395
8400
  function ae(t) {
8396
8401
  return t instanceof Error ? `${t.name}: ${t.message}` : String(t);
8397
8402
  }
8398
- function q_(t) {
8403
+ function eI(t) {
8399
8404
  return `
8400
8405
  // Audio buffer constants
8401
8406
  const OUTPUT_SAMPLE_RATE_HZ = ${t.outputSampleRateHz};
8402
8407
  const DEFAULT_FRAME_SAMPLES_PER_CHANNEL = Math.max(1, Math.round(OUTPUT_SAMPLE_RATE_HZ * 0.02));
8403
- const BUFFER_TARGET_MIN_MS = ${V_};
8404
- const BUFFER_TARGET_MAX_MS = ${H_};
8405
- const JITTER_MULTIPLIER = ${$_};
8408
+ const BUFFER_TARGET_MIN_MS = ${H_};
8409
+ const BUFFER_TARGET_MAX_MS = ${$_};
8410
+ const JITTER_MULTIPLIER = ${K_};
8406
8411
  const LOCAL_BUFFER_MAX_MS = ${pa};
8407
- const CONTROL_PERIOD_MS = ${K_};
8408
- const UNDERRUN_JUMP_MS = ${Y_};
8409
- const STABLE_TIME_TO_DECREASE_MS = ${j_};
8410
- const DECREASE_STEP_MS = ${z_};
8412
+ const CONTROL_PERIOD_MS = ${Y_};
8413
+ const UNDERRUN_JUMP_MS = ${j_};
8414
+ const STABLE_TIME_TO_DECREASE_MS = ${z_};
8415
+ const DECREASE_STEP_MS = ${X_};
8411
8416
  const DEFAULT_STATS_INTERVAL_SAMPLES = OUTPUT_SAMPLE_RATE_HZ;
8412
8417
 
8413
8418
  // Pre-computed reciprocals for division-free calculations
@@ -8426,7 +8431,7 @@ const FADE_OUT_INCREMENT = 1.0 / FADE_OUT_DURATION_SAMPLES;
8426
8431
  const RENDER_QUANTUM_SIZE = ${ma};
8427
8432
 
8428
8433
  // Buffer reduction crossfade constants (align to quantum boundary to avoid partial quanta)
8429
- const BUFFER_REDUCTION_CROSSFADE_MS = ${X_};
8434
+ const BUFFER_REDUCTION_CROSSFADE_MS = ${J_};
8430
8435
  const BUFFER_REDUCTION_CROSSFADE_SAMPLES_RAW = Math.round(OUTPUT_SAMPLE_RATE_HZ * BUFFER_REDUCTION_CROSSFADE_MS / 1000);
8431
8436
  const BUFFER_REDUCTION_CROSSFADE_SAMPLES = Math.ceil(BUFFER_REDUCTION_CROSSFADE_SAMPLES_RAW / RENDER_QUANTUM_SIZE) * RENDER_QUANTUM_SIZE;
8432
8437
 
@@ -8637,7 +8642,7 @@ class IkonAudioPlayerProcessor extends AudioWorkletProcessor {
8637
8642
  this.statsIntervalSamples = Math.max(1, Math.round((OUTPUT_SAMPLE_RATE_HZ * statusIntervalMs) / 1000));
8638
8643
 
8639
8644
  // Normalization config (hardcoded)
8640
- this.normalizationEnabled = ${J_};
8645
+ this.normalizationEnabled = ${Q_};
8641
8646
 
8642
8647
  // Stream states for audio buffer
8643
8648
  this.streams = new Map();
@@ -9367,7 +9372,7 @@ class Ln {
9367
9372
  config;
9368
9373
  enabled = !1;
9369
9374
  stateUnsubscribe = null;
9370
- isMobile = Z_();
9375
+ isMobile = q_();
9371
9376
  boundVisibilityChange = null;
9372
9377
  boundPageHide = null;
9373
9378
  unlockHandler = null;
@@ -9396,7 +9401,7 @@ class Ln {
9396
9401
  // Viseme buffering for time-synchronized lip sync
9397
9402
  // Each stream has a circular buffer of viseme keyframes with sample-based timestamps
9398
9403
  visemeBuffers = /* @__PURE__ */ new Map();
9399
- visemeDelayMs = Q_;
9404
+ visemeDelayMs = Z_;
9400
9405
  // Pre-allocated result object for getCurrentVisemeValues to avoid hot-path allocations
9401
9406
  _visemeResult = { mouthOpenY: 0, mouthForm: 0 };
9402
9407
  constructor(e, n) {
@@ -9806,7 +9811,7 @@ class Ln {
9806
9811
  URL.revokeObjectURL(this.workletModuleUrl);
9807
9812
  } catch {
9808
9813
  }
9809
- this.workletModuleKey = s, this.workletReady = null, this.workletModuleUrl = URL.createObjectURL(new Blob([q_({ outputSampleRateHz: this.outputSampleRateHz, outputChannels: G })], { type: "text/javascript" }));
9814
+ this.workletModuleKey = s, this.workletReady = null, this.workletModuleUrl = URL.createObjectURL(new Blob([eI({ outputSampleRateHz: this.outputSampleRateHz, outputChannels: G })], { type: "text/javascript" }));
9810
9815
  }
9811
9816
  this.workletReady || (this.workletReady = e.audioWorklet.addModule(this.workletModuleUrl).catch((d) => {
9812
9817
  throw O.warn(`Failed to load AudioWorklet module, falling back: ${ae(d)}`), d;
@@ -10055,7 +10060,7 @@ class Ln {
10055
10060
  return;
10056
10061
  this.protocolPort = e;
10057
10062
  try {
10058
- this.audioWorker = new G_();
10063
+ this.audioWorker = new V_();
10059
10064
  } catch (u) {
10060
10065
  O.warn(`Failed to create audio worker: ${ae(u)}`), this.protocolPort.close(), this.protocolPort = null;
10061
10066
  return;
@@ -10245,7 +10250,7 @@ class Ln {
10245
10250
  }));
10246
10251
  }
10247
10252
  }
10248
- function eI(t) {
10253
+ function tI(t) {
10249
10254
  return new Worker(
10250
10255
  "" + new URL("assets/video-playback-worker-BTMuFG90.js", import.meta.url).href,
10251
10256
  {
@@ -10258,7 +10263,7 @@ const q = M("IkonVideoPlayback");
10258
10263
  function xt(t) {
10259
10264
  return t instanceof Error ? `${t.name}: ${t.message}` : String(t);
10260
10265
  }
10261
- class tI {
10266
+ class nI {
10262
10267
  client;
10263
10268
  config;
10264
10269
  enabled = !0;
@@ -10333,7 +10338,7 @@ class tI {
10333
10338
  }
10334
10339
  let e;
10335
10340
  try {
10336
- e = new eI();
10341
+ e = new tI();
10337
10342
  } catch (n) {
10338
10343
  q.warn(`Failed to create video worker: ${xt(n)}`);
10339
10344
  return;
@@ -10472,11 +10477,11 @@ class tI {
10472
10477
  }));
10473
10478
  }
10474
10479
  }
10475
- class nI {
10480
+ class rI {
10476
10481
  audio;
10477
10482
  video;
10478
10483
  constructor(e, n) {
10479
- this.audio = new Ln(e, n?.audio), this.video = new tI(e, n?.video), n?.mediaSession && this.audio.setMediaSession(n.mediaSession);
10484
+ this.audio = new Ln(e, n?.audio), this.video = new nI(e, n?.video), n?.mediaSession && this.audio.setMediaSession(n.mediaSession);
10480
10485
  }
10481
10486
  /**
10482
10487
  * Releases media resources (workers, audio graph, decoders).
@@ -10487,11 +10492,11 @@ class nI {
10487
10492
  this.audio.dispose(), this.video.dispose();
10488
10493
  }
10489
10494
  }
10490
- const rI = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10495
+ const iI = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10491
10496
  __proto__: null,
10492
- IkonMedia: nI
10497
+ IkonMedia: rI
10493
10498
  }, Symbol.toStringTag, { value: "Module" }));
10494
- class iI {
10499
+ class sI {
10495
10500
  static getStorageForCapacity(e, n) {
10496
10501
  const r = Int32Array.BYTES_PER_ELEMENT * 2, i = n.BYTES_PER_ELEMENT * e;
10497
10502
  return new SharedArrayBuffer(r + i);
@@ -10545,7 +10550,7 @@ class iI {
10545
10550
  return r = (r + n) % this.capacity, Atomics.store(this.readWrite, 0, r), n;
10546
10551
  }
10547
10552
  }
10548
- function sI(t) {
10553
+ function oI(t) {
10549
10554
  return new Worker(
10550
10555
  "" + new URL("assets/audio-capture-worker-Brmt2Z7a.js", import.meta.url).href,
10551
10556
  {
@@ -10554,11 +10559,11 @@ function sI(t) {
10554
10559
  }
10555
10560
  );
10556
10561
  }
10557
- const D = M("IkonAudioCapture"), at = 3, oI = 200, aI = 2e3, cI = 5e3, ur = 3e3;
10558
- function lI(t) {
10562
+ const D = M("IkonAudioCapture"), at = 3, aI = 200, cI = 2e3, lI = 5e3, ur = 3e3;
10563
+ function uI(t) {
10559
10564
  return new Promise((e) => setTimeout(e, t));
10560
10565
  }
10561
- function uI(t) {
10566
+ function dI(t) {
10562
10567
  switch (t.name) {
10563
10568
  // Transient errors - worth retrying
10564
10569
  case "NotReadableError":
@@ -10583,11 +10588,11 @@ function uI(t) {
10583
10588
  return { action: "fail", reason: "unknown", canRetry: !1 };
10584
10589
  }
10585
10590
  }
10586
- function dI() {
10591
+ function hI() {
10587
10592
  const t = globalThis.crypto;
10588
10593
  return t?.randomUUID ? t.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
10589
10594
  }
10590
- function hI() {
10595
+ function fI() {
10591
10596
  return `
10592
10597
  class RingBuffer {
10593
10598
  static getStorageForCapacity(capacity, type) {
@@ -10716,7 +10721,7 @@ class IkonAudioCaptureProcessor extends AudioWorkletProcessor {
10716
10721
  registerProcessor('ikon-audio-capture', IkonAudioCaptureProcessor);
10717
10722
  `;
10718
10723
  }
10719
- class fI {
10724
+ class pI {
10720
10725
  constructor(e, n) {
10721
10726
  this.client = e, this.config = n ?? {}, this.setupDeviceChangeListener();
10722
10727
  }
@@ -10807,7 +10812,7 @@ class fI {
10807
10812
  if (e.stopped)
10808
10813
  return;
10809
10814
  const s = Date.now(), o = n.name;
10810
- if (e.lastErrorReason === r && e.lastErrorName === o && s - e.lastErrorTime < cI)
10815
+ if (e.lastErrorReason === r && e.lastErrorName === o && s - e.lastErrorTime < lI)
10811
10816
  return;
10812
10817
  e.lastErrorTime = s, e.lastErrorReason = r, e.lastErrorName = o;
10813
10818
  const a = this.config.autoRestartPolicy;
@@ -11043,7 +11048,7 @@ class fI {
11043
11048
  ensureWorker() {
11044
11049
  if (this.worker)
11045
11050
  return this.worker;
11046
- const e = new sI();
11051
+ const e = new oI();
11047
11052
  return this.worker = e, e.addEventListener("message", (n) => {
11048
11053
  const r = n.data;
11049
11054
  if (r?.type === "error") {
@@ -11127,7 +11132,7 @@ class fI {
11127
11132
  try {
11128
11133
  return { stream: await navigator.mediaDevices.getUserMedia({ audio: e }), error: n, errorInfo: r };
11129
11134
  } catch (s) {
11130
- if (n = s instanceof Error ? s : new Error(String(s)), r = uI(n), D.debug(
11135
+ if (n = s instanceof Error ? s : new Error(String(s)), r = dI(n), D.debug(
11131
11136
  `getUserMedia attempt ${i + 1}/${at} failed: ${n.name} (action: ${r.action})`
11132
11137
  ), this.emitDiagnostic({
11133
11138
  event: "retry",
@@ -11140,8 +11145,8 @@ class fI {
11140
11145
  }), r.action !== "retry")
11141
11146
  break;
11142
11147
  if (i < at - 1) {
11143
- const o = oI * (i + 1);
11144
- D.debug(`Retrying getUserMedia in ${o}ms`), await lI(o);
11148
+ const o = aI * (i + 1);
11149
+ D.debug(`Retrying getUserMedia in ${o}ms`), await uI(o);
11145
11150
  }
11146
11151
  }
11147
11152
  return { stream: null, error: n, errorInfo: r };
@@ -11153,7 +11158,7 @@ class fI {
11153
11158
  async ensureWorklet(e) {
11154
11159
  if (!fa(e))
11155
11160
  throw new Error("AudioWorklet is not supported in this browser");
11156
- if (this.workletModuleUrl || (this.workletModuleUrl = URL.createObjectURL(new Blob([hI()], { type: "text/javascript" }))), this.workletReady && this.workletContext === e)
11161
+ if (this.workletModuleUrl || (this.workletModuleUrl = URL.createObjectURL(new Blob([fI()], { type: "text/javascript" }))), this.workletReady && this.workletContext === e)
11157
11162
  try {
11158
11163
  await this.workletReady;
11159
11164
  return;
@@ -11175,7 +11180,7 @@ class fI {
11175
11180
  throw new Error("Cannot start audio capture before client is connected");
11176
11181
  if (this.client.isWebRtcEnabled)
11177
11182
  return this.startMicWebRtc(e);
11178
- const r = dI(), i = {
11183
+ const r = hI(), i = {
11179
11184
  captureId: r,
11180
11185
  aborted: !1,
11181
11186
  stream: null,
@@ -11218,7 +11223,7 @@ class fI {
11218
11223
  let T;
11219
11224
  if (I === "sab") {
11220
11225
  const b = Math.floor(o.sampleRate * 10);
11221
- T = iI.getStorageForCapacity(b, Float32Array);
11226
+ T = sI.getStorageForCapacity(b, Float32Array);
11222
11227
  }
11223
11228
  const E = "microphone", f = this.ensureWorker(), C = e.onStopped;
11224
11229
  f.postMessage({
@@ -11356,7 +11361,7 @@ class fI {
11356
11361
  };
11357
11362
  this.setupAudioContextStateListener(o, w), this.setupVisibilityChangeListener(w), this.setupBFCacheHandlers(w), w.healthCheckTimer = setInterval(() => {
11358
11363
  this.performHealthCheck(w);
11359
- }, aI);
11364
+ }, cI);
11360
11365
  const se = () => {
11361
11366
  w.stopped || (D.warn(`Microphone track ended unexpectedly, captureId=${r.substring(0, 8)}`), this.handleRecoverableError(w, new Error("Microphone track ended unexpectedly"), "track-ended"));
11362
11367
  };
@@ -11567,7 +11572,7 @@ class fI {
11567
11572
  return !n || n.stopped ? !1 : this.attemptResumeAsync(n, "userGesture", !0);
11568
11573
  }
11569
11574
  }
11570
- const Ie = 1280, Te = 720, pI = 30, It = "image/jpeg", _a = 0.92;
11575
+ const Ie = 1280, Te = 720, EI = 30, It = "image/jpeg", _a = 0.92;
11571
11576
  function sn(t, e, n, r) {
11572
11577
  if (!n && !r)
11573
11578
  return { width: t, height: e };
@@ -11595,7 +11600,7 @@ async function dr(t, e) {
11595
11600
  );
11596
11601
  });
11597
11602
  }
11598
- class EI {
11603
+ class mI {
11599
11604
  /**
11600
11605
  * Capture a single frame from an existing MediaStream (e.g., from an active screen share).
11601
11606
  * The caller is responsible for managing the stream lifecycle.
@@ -11729,11 +11734,11 @@ class EI {
11729
11734
  async captureFromNativeCamera(e = {}) {
11730
11735
  if (typeof document > "u")
11731
11736
  throw new Error("Native camera capture requires a DOM environment");
11732
- const n = await mI(e.facing);
11733
- return n ? await _I(n, e) : null;
11737
+ const n = await _I(e.facing);
11738
+ return n ? await II(n, e) : null;
11734
11739
  }
11735
11740
  }
11736
- function mI(t) {
11741
+ function _I(t) {
11737
11742
  return new Promise((e) => {
11738
11743
  const n = document.createElement("input");
11739
11744
  n.type = "file", n.accept = "image/*", n.setAttribute("capture", t ?? "environment"), n.style.position = "fixed", n.style.left = "-99999px", n.style.top = "0";
@@ -11761,7 +11766,7 @@ function mI(t) {
11761
11766
  n.click();
11762
11767
  });
11763
11768
  }
11764
- async function _I(t, e) {
11769
+ async function II(t, e) {
11765
11770
  const n = URL.createObjectURL(t);
11766
11771
  let r;
11767
11772
  try {
@@ -11792,7 +11797,7 @@ async function _I(t, e) {
11792
11797
  }), _ = await p.arrayBuffer();
11793
11798
  return { mime: p.type || c, width: o, height: a, data: new Uint8Array(_) };
11794
11799
  }
11795
- function II(t) {
11800
+ function TI(t) {
11796
11801
  return new Worker(
11797
11802
  "" + new URL("assets/video-capture-worker-CzOnKSIv.js", import.meta.url).href,
11798
11803
  {
@@ -11802,17 +11807,17 @@ function II(t) {
11802
11807
  );
11803
11808
  }
11804
11809
  const Me = M("IkonVideoCapture");
11805
- function TI() {
11810
+ function wI() {
11806
11811
  const t = globalThis.crypto;
11807
11812
  return t?.randomUUID ? t.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
11808
11813
  }
11809
- function wI() {
11814
+ function gI() {
11810
11815
  const t = globalThis.MediaStreamTrackProcessor;
11811
11816
  if (!t)
11812
11817
  throw new Error("MediaStreamTrackProcessor is not available in this browser");
11813
11818
  return t;
11814
11819
  }
11815
- class gI {
11820
+ class SI {
11816
11821
  constructor(e) {
11817
11822
  this.client = e;
11818
11823
  }
@@ -11828,7 +11833,7 @@ class gI {
11828
11833
  ensureWorker() {
11829
11834
  if (this.worker)
11830
11835
  return this.worker;
11831
- const e = new II();
11836
+ const e = new TI();
11832
11837
  return this.worker = e, e.addEventListener("message", (n) => {
11833
11838
  const r = n.data;
11834
11839
  if (r?.type === "error") {
@@ -11855,7 +11860,7 @@ class gI {
11855
11860
  async getMediaStream(e) {
11856
11861
  if (!navigator.mediaDevices)
11857
11862
  throw new Error("Media devices are not available in this environment");
11858
- const n = e.constraints ?? {}, r = e.options?.framerate ?? pI;
11863
+ const n = e.constraints ?? {}, r = e.options?.framerate ?? EI;
11859
11864
  if (e.sourceType === "screen") {
11860
11865
  const a = {
11861
11866
  ...n,
@@ -11938,11 +11943,11 @@ class gI {
11938
11943
  if (this.client.isWebRtcEnabled && e.sourceType === "screen")
11939
11944
  return this.startScreenWebRtc(e);
11940
11945
  this.ensurePorts();
11941
- const r = TI(), i = await this.getMediaStream(e), s = i.getVideoTracks()[0];
11946
+ const r = wI(), i = await this.getMediaStream(e), s = i.getVideoTracks()[0];
11942
11947
  if (!s)
11943
11948
  throw i.getTracks().forEach((E) => E.stop()), new Error("No video track available");
11944
11949
  e.sourceType === "screen" && await new Promise((E) => setTimeout(E, 200));
11945
- const o = s.getSettings(), a = e.sourceType === "screen" ? o.width ?? Ie : e.options?.width ?? o.width ?? Ie, c = e.sourceType === "screen" ? o.height ?? Te : e.options?.height ?? o.height ?? Te, l = wI(), h = new l({ track: s }).readable, u = this.allocateTrackId(), p = this.ensureWorker(), _ = e.sourceType, I = e.onStopped;
11950
+ const o = s.getSettings(), a = e.sourceType === "screen" ? o.width ?? Ie : e.options?.width ?? o.width ?? Ie, c = e.sourceType === "screen" ? o.height ?? Te : e.options?.height ?? o.height ?? Te, l = gI(), h = new l({ track: s }).readable, u = this.allocateTrackId(), p = this.ensureWorker(), _ = e.sourceType, I = e.onStopped;
11946
11951
  p.postMessage(
11947
11952
  {
11948
11953
  type: "start",
@@ -12068,38 +12073,38 @@ class gI {
12068
12073
  this.protocolPort?.close(), this.protocolPort = null, this.sendPort?.close(), this.sendPort = null;
12069
12074
  }
12070
12075
  }
12071
- class SI {
12076
+ class CI {
12072
12077
  audio;
12073
12078
  video;
12074
12079
  image;
12075
12080
  constructor(e, n) {
12076
- this.audio = new fI(e, n?.audio), this.video = new gI(e), this.image = new EI();
12081
+ this.audio = new pI(e, n?.audio), this.video = new SI(e), this.image = new mI();
12077
12082
  }
12078
12083
  dispose() {
12079
12084
  this.audio.dispose(), this.video.dispose();
12080
12085
  }
12081
12086
  }
12082
- const CI = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12087
+ const AI = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12083
12088
  __proto__: null,
12084
- IkonMediaCapture: SI
12089
+ IkonMediaCapture: CI
12085
12090
  }, Symbol.toStringTag, { value: "Module" }));
12086
12091
  export {
12087
12092
  St as AccessDeniedError,
12088
- x_ as AppMessaging,
12093
+ W_ as AppMessaging,
12089
12094
  Ee as AuthRejectedError,
12090
12095
  L as AuthenticationError,
12091
12096
  dp as BrowserNotSupportedError,
12092
12097
  Vp as Channel,
12093
12098
  $p as ChannelManager,
12094
- yI as ChannelNotFoundError,
12099
+ RI as ChannelNotFoundError,
12095
12100
  _e as ClientType,
12096
12101
  gt as ConnectionError,
12097
12102
  ye as ContextType,
12098
- F_ as EndpointSelector,
12103
+ B_ as EndpointSelector,
12099
12104
  y as EntrypointType,
12100
- Mm as FunctionCallError,
12101
- Fm as FunctionRegistry,
12102
- $I as IKON_AUTH_BASE_URL,
12105
+ Pm as FunctionCallError,
12106
+ Bm as FunctionRegistry,
12107
+ KI as IKON_AUTH_BASE_URL,
12103
12108
  Mt as IKON_AUTH_URL_DEV,
12104
12109
  Lt as IKON_AUTH_URL_PROD,
12105
12110
  Jt as IKON_BACKEND_URL_DEV,
@@ -12108,8 +12113,8 @@ export {
12108
12113
  Cp as IKON_PARAM_AUTH,
12109
12114
  Po as IKON_PARAM_DEBUG,
12110
12115
  Sp as IKON_PARAM_DEBUG_OVERLAY,
12111
- vI as IKON_PARAM_GIT_BRANCH,
12112
- DI as IKON_PARAM_GIT_SOURCE,
12116
+ OI as IKON_PARAM_GIT_BRANCH,
12117
+ vI as IKON_PARAM_GIT_SOURCE,
12113
12118
  Bo as IKON_PARAM_INSPECT,
12114
12119
  Ip as IKON_PARAM_LANG,
12115
12120
  Ep as IKON_PARAM_PROXY,
@@ -12119,29 +12124,29 @@ export {
12119
12124
  gp as IKON_PARAM_WEBRTC,
12120
12125
  mp as IKON_PARAM_WEBSOCKET,
12121
12126
  _p as IKON_PARAM_WEBTRANSPORT,
12122
- fI as IkonAudioCapture,
12127
+ pI as IkonAudioCapture,
12123
12128
  Ln as IkonAudioPlayback,
12124
- tT as IkonClient,
12125
- EI as IkonImageCapture,
12126
- nI as IkonMedia,
12127
- SI as IkonMediaCapture,
12128
- gI as IkonVideoCapture,
12129
- tI as IkonVideoPlayback,
12129
+ nT as IkonClient,
12130
+ mI as IkonImageCapture,
12131
+ rI as IkonMedia,
12132
+ CI as IkonMediaCapture,
12133
+ SI as IkonVideoCapture,
12134
+ nI as IkonVideoPlayback,
12130
12135
  Tn as KeepaliveTimeoutError,
12131
12136
  re as LogLevel,
12132
12137
  Gn as MaxRetriesExceededError,
12133
- bI as NoChannelsError,
12138
+ NI as NoChannelsError,
12134
12139
  S as Opcode,
12135
12140
  Uo as ProvisioningTimeoutError,
12136
12141
  Ct as ServerFullError,
12137
- RI as SpaceNotFoundError,
12142
+ bI as SpaceNotFoundError,
12138
12143
  K as TransportError,
12139
12144
  be as UserType,
12140
- FI as WEBRTC_AUDIO_BITRATE,
12141
- PI as WEBRTC_AUDIO_CHANNELS,
12142
- LI as WEBRTC_AUDIO_CODEC,
12145
+ BI as WEBRTC_AUDIO_BITRATE,
12146
+ FI as WEBRTC_AUDIO_CHANNELS,
12147
+ MI as WEBRTC_AUDIO_CODEC,
12143
12148
  Kp as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS,
12144
- MI as WEBRTC_AUDIO_SAMPLE_RATE,
12149
+ PI as WEBRTC_AUDIO_SAMPLE_RATE,
12145
12150
  zp as WEBRTC_BUNDLE_POLICY,
12146
12151
  Zp as WEBRTC_DATA_CHANNEL_LABEL,
12147
12152
  eE as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS,
@@ -12149,81 +12154,81 @@ export {
12149
12154
  Jp as WEBRTC_MAX_AUDIO_TRACKS,
12150
12155
  Qp as WEBRTC_MAX_VIDEO_TRACKS,
12151
12156
  Xp as WEBRTC_RTCP_MUX_POLICY,
12152
- BI as WEBRTC_VIDEO_CODEC,
12157
+ xI as WEBRTC_VIDEO_CODEC,
12153
12158
  Yp as WEBRTC_VIDEO_MAX_BITRATE,
12154
- xI as WEBRTC_VIDEO_MAX_FRAMERATE,
12159
+ WI as WEBRTC_VIDEO_MAX_FRAMERATE,
12155
12160
  tE as WebRTCConnection,
12156
12161
  nE as WebRTCSignaling,
12157
12162
  Rt as abortSignalAny,
12158
12163
  ue as abortSignalTimeout,
12159
- nT as appMessaging,
12160
- AI as asProtocolMessage,
12161
- M_ as checkBrowserSupport,
12162
- HI as clearDeviceId,
12163
- qI as clearLogBuffer,
12164
- GI as clearLoginPrompt,
12165
- jI as clearSessionParamsFromUrl,
12166
- lT as consumeLoginHandoff,
12164
+ rT as appMessaging,
12165
+ yI as asProtocolMessage,
12166
+ P_ as checkBrowserSupport,
12167
+ $I as clearDeviceId,
12168
+ eT as clearLogBuffer,
12169
+ VI as clearLoginPrompt,
12170
+ zI as clearSessionParamsFromUrl,
12171
+ uT as consumeLoginHandoff,
12167
12172
  uE as consumeLoginPendingCall,
12168
12173
  M as createLogger,
12169
- mm as deriveAuthUrl,
12170
- KI as deriveBackendType,
12174
+ _m as deriveAuthUrl,
12175
+ YI as deriveBackendType,
12171
12176
  Pt as deriveBackendUrl,
12172
- XI as enableInspectMode,
12173
- um as extractUserIdFromToken,
12174
- ZI as flushLogs,
12177
+ JI as enableInspectMode,
12178
+ dm as extractUserIdFromToken,
12179
+ qI as flushLogs,
12175
12180
  Op as getAudioParam,
12176
12181
  Mp as getAuthSameOriginParam,
12177
- QI as getBufferedLogs,
12178
- UI as getDebugOverlayParam,
12182
+ ZI as getBufferedLogs,
12183
+ LI as getDebugOverlayParam,
12179
12184
  Dp as getDebugParam,
12180
12185
  Lp as getInspectParam,
12181
- OI as getLangParam,
12182
- eT as getLogBufferSize,
12186
+ UI as getLangParam,
12187
+ tT as getLogBufferSize,
12183
12188
  Vn as getLogLevel,
12184
- NI as getLogSink,
12185
- WI as getLoginPromptState,
12186
- aT as getOpcodeName,
12189
+ kI as getLogSink,
12190
+ GI as getLoginPromptState,
12191
+ cT as getOpcodeName,
12187
12192
  bt as getOrCreateDeviceId,
12188
12193
  bp as getProxyParam,
12189
12194
  ne as getRetryParam,
12190
- fm as getSameOriginAuthUrl,
12195
+ pm as getSameOriginAuthUrl,
12191
12196
  vp as getServerUrlParam,
12192
12197
  Up as getVideoParam,
12193
12198
  Dt as getWebRtcParam,
12194
12199
  Np as getWebSocketParam,
12195
12200
  kp as getWebTransportParam,
12196
- f_ as initializeDebugMode,
12197
- E_ as initializeInspectMode,
12198
- g_ as initializeLogSink,
12201
+ p_ as initializeDebugMode,
12202
+ m_ as initializeInspectMode,
12203
+ S_ as initializeLogSink,
12199
12204
  fa as isAudioWorkletSupported,
12200
12205
  De as isBrowserEnvironment,
12201
12206
  Qe as isCloudEnvironment,
12202
- iT as isConnected,
12203
- rT as isConnecting,
12207
+ sT as isConnected,
12208
+ iT as isConnecting,
12204
12209
  Zn as isDebugModeEnabled,
12205
- oT as isError,
12206
- zI as isInspectModeEnabled,
12207
- Km as isMobileBrowserLikely,
12208
- sT as isOffline,
12210
+ aT as isError,
12211
+ XI as isInspectModeEnabled,
12212
+ Ym as isMobileBrowserLikely,
12213
+ oT as isOffline,
12209
12214
  ut as isSharedArrayBufferSupported,
12210
12215
  Wo as isWebTransportSupported,
12211
- $m as loginErrorInterceptor,
12212
- YI as parseUrlParams,
12216
+ Km as loginErrorInterceptor,
12217
+ jI as parseUrlParams,
12213
12218
  Ut as randomUuid,
12214
12219
  We as readOpcode,
12215
12220
  ct as readOpcodeGroup,
12216
12221
  Q as readProtocolMessageHeaders,
12217
- cm as registerBrowserFunctions,
12218
- cT as reprovisionAfterLogin,
12222
+ lm as registerBrowserFunctions,
12223
+ lT as reprovisionAfterLogin,
12219
12224
  Mo as setLogLevel,
12220
12225
  hp as setLogSink,
12221
12226
  xo as setSdkUrlParam,
12222
- JI as setSendLogsCallback,
12223
- U_ as startLogSender,
12227
+ QI as setSendLogsCallback,
12228
+ L_ as startLogSender,
12224
12229
  ua as stopLogSender,
12225
- VI as subscribeLoginPrompt,
12226
- kI as subscribeToLogEvents,
12230
+ HI as subscribeLoginPrompt,
12231
+ DI as subscribeToLogEvents,
12227
12232
  ca as takeBufferedLogs,
12228
12233
  zn as withResultData
12229
12234
  };