@ikonai/sdk 1.3.3 → 1.3.5

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
@@ -3155,7 +3155,12 @@ async function Jd() {
3155
3155
  return null;
3156
3156
  }
3157
3157
  }
3158
- function Yd() {
3158
+ function Yd(e) {
3159
+ try {
3160
+ window.sessionStorage.setItem(Gd, e);
3161
+ } catch {}
3162
+ }
3163
+ function Xd() {
3159
3164
  try {
3160
3165
  let e = window.sessionStorage.getItem(Gd);
3161
3166
  return window.sessionStorage.removeItem(Gd), e;
@@ -3165,8 +3170,8 @@ function Yd() {
3165
3170
  }
3166
3171
  //#endregion
3167
3172
  //#region src/utils/embedded-oauth.ts
3168
- var Xd = C("EmbeddedAuth"), Zd = "/oauth/popup-callback", Qd = 3e5;
3169
- function $d() {
3173
+ var Zd = C("EmbeddedAuth"), Qd = "/oauth/popup-callback", $d = "ikon-oauth-embedder-request", ef = "ikon_pkce", tf = 800, nf = 3e5;
3174
+ function rf() {
3170
3175
  if (typeof window > "u") return !1;
3171
3176
  try {
3172
3177
  return window.top !== window.self;
@@ -3174,103 +3179,107 @@ function $d() {
3174
3179
  return !0;
3175
3180
  }
3176
3181
  }
3177
- var ef = "ikon-oauth-embedder-request", tf = 1500;
3178
- async function nf(e, t) {
3179
- let n = await Jd();
3180
- return await new Promise((r) => {
3181
- let i = !1, a = (e) => {
3182
- i || (i = !0, window.removeEventListener("message", o), window.clearTimeout(s), r(e));
3183
- }, o = (e) => {
3182
+ async function af(e, t) {
3183
+ let n = await Jd(), r = Xd();
3184
+ return await new Promise((i) => {
3185
+ let a = !1, o = (e) => {
3186
+ a || (a = !0, window.removeEventListener("message", s), window.clearTimeout(c), i(e));
3187
+ }, s = (e) => {
3184
3188
  if (e.source !== window.parent) return;
3185
3189
  let t = e.data;
3186
- t?.source === "ikon-oauth" && t.type === "ikon-oauth-embedder-accepted" && a(!0);
3190
+ t?.source === "ikon-oauth" && t.type === "ikon-oauth-embedder-accepted" && o(!0);
3187
3191
  };
3188
- window.addEventListener("message", o), window.parent.postMessage({
3192
+ window.addEventListener("message", s), window.parent.postMessage({
3189
3193
  source: "ikon-oauth",
3190
- type: ef,
3194
+ type: $d,
3191
3195
  provider: e,
3192
3196
  spaceId: t,
3193
- codeChallenge: n
3197
+ codeChallenge: n,
3198
+ codeVerifier: r
3194
3199
  }, "*");
3195
- let s = window.setTimeout(() => a(!1), tf);
3200
+ let c = window.setTimeout(() => o(!1), tf);
3196
3201
  });
3197
3202
  }
3198
- async function rf(e, t) {
3199
- if (await nf(e, t)) return !0;
3203
+ async function of(e, t) {
3204
+ if (await af(e, t)) return !0;
3200
3205
  try {
3201
- let { code: n, provider: r } = await af(e, t), i = new URL(window.location.href);
3206
+ let { code: n, provider: r } = await sf(window.open("about:blank", "ikon-oauth", "popup,width=520,height=680"), e, t), i = new URL(window.location.href);
3202
3207
  return i.searchParams.set("ikon_code", n), i.searchParams.set("ikon_provider", r), window.location.replace(i.toString()), !0;
3203
3208
  } catch (t) {
3204
- return Xd.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
3209
+ return Zd.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
3205
3210
  }
3206
3211
  }
3207
- async function af(e, t) {
3208
- let n = window.open("about:blank", "ikon-oauth", "popup,width=520,height=680");
3209
- if (!n) throw Error("The sign-in window was blocked. Allow pop-ups for this site and try again.");
3212
+ async function sf(e, t, n) {
3213
+ if (!e) throw Error("The sign-in window was blocked. Allow pop-ups for this site and try again.");
3210
3214
  let r;
3211
3215
  try {
3212
3216
  r = await Fd();
3213
- let i = `${r}${Zd}`, a = await Jd(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3214
- n.location.href = `${r}/oauth/${encodeURIComponent(e)}?space=${encodeURIComponent(t)}&return=${encodeURIComponent(i)}${o}`;
3215
- } catch (e) {
3216
- throw n.close(), e;
3217
+ let i = `${r}${Qd}`, a = await Jd(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3218
+ e.location.href = `${r}/oauth/${encodeURIComponent(t)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`;
3219
+ } catch (t) {
3220
+ throw e.close(), t;
3217
3221
  }
3218
3222
  let i = r;
3219
- return await new Promise((t, r) => {
3223
+ return await new Promise((n, r) => {
3220
3224
  let a = !1, o = (e) => {
3221
3225
  a || (a = !0, window.removeEventListener("message", s), window.clearInterval(c), window.clearTimeout(l), e());
3222
- }, s = (n) => {
3223
- if (n.origin !== i) return;
3224
- let a = n.data;
3226
+ }, s = (e) => {
3227
+ if (e.origin !== i) return;
3228
+ let a = e.data;
3225
3229
  if (!a || a.source !== "ikon-oauth-popup") return;
3226
3230
  if (a.error || !a.code) {
3227
3231
  o(() => r(Error(a.error || "The sign-in did not complete")));
3228
3232
  return;
3229
3233
  }
3230
- let s = a.code, c = a.provider ?? e;
3231
- o(() => t({
3234
+ let s = a.code, c = a.provider ?? t;
3235
+ o(() => n({
3232
3236
  code: s,
3233
3237
  provider: c
3234
3238
  }));
3235
3239
  };
3236
3240
  window.addEventListener("message", s);
3237
3241
  let c = window.setInterval(() => {
3238
- n.closed && o(() => r(/* @__PURE__ */ Error("The sign-in window was closed before it finished")));
3242
+ e.closed && o(() => r(/* @__PURE__ */ Error("The sign-in window was closed before it finished")));
3239
3243
  }, 500), l = window.setTimeout(() => {
3240
3244
  o(() => {
3241
- n.close(), r(/* @__PURE__ */ Error("The sign-in timed out"));
3245
+ e.close(), r(/* @__PURE__ */ Error("The sign-in timed out"));
3242
3246
  });
3243
- }, Qd);
3247
+ }, nf);
3244
3248
  });
3245
3249
  }
3250
+ function cf() {
3251
+ if (typeof window > "u") return;
3252
+ let e = new URLSearchParams(window.location.search).get(ef);
3253
+ e && Yd(e);
3254
+ }
3246
3255
  //#endregion
3247
3256
  //#region src/utils/user-gesture.ts
3248
- function of(e) {
3257
+ function lf(e) {
3249
3258
  if (!e || typeof e != "object") return !1;
3250
3259
  let t = e, n = typeof t.name == "string" ? t.name : "", r = typeof t.message == "string" ? t.message : "";
3251
3260
  return !!(n === "NotAllowedError" || n === "SecurityError" || r.toLowerCase().includes("permission") || r.toLowerCase().includes("user gesture"));
3252
3261
  }
3253
3262
  //#endregion
3254
3263
  //#region src/utils/app-routes.ts
3255
- var sf = ["/ikon", "/api"];
3256
- function cf(e) {
3264
+ var uf = ["/ikon", "/api"];
3265
+ function df(e) {
3257
3266
  if (!e) return !1;
3258
3267
  let t = e.split(/[?#]/)[0], n = t.startsWith("/") ? t : "/" + t;
3259
- return sf.some((e) => n === e || n.startsWith(e + "/"));
3268
+ return uf.some((e) => n === e || n.startsWith(e + "/"));
3260
3269
  }
3261
3270
  //#endregion
3262
3271
  //#region src/functions/browser-functions.ts
3263
- var lf = "ikon-theme", uf = "ikon-theme-user", df = "ikon-theme-change";
3264
- function ff(e) {
3272
+ var ff = "ikon-theme", pf = "ikon-theme-user", mf = "ikon-theme-change";
3273
+ function hf(e) {
3265
3274
  typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", e);
3266
3275
  }
3267
- function pf() {
3276
+ function gf() {
3268
3277
  return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
3269
3278
  }
3270
- function mf() {
3271
- return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(uf) || window.localStorage.getItem(lf) || pf();
3279
+ function _f() {
3280
+ return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(pf) || window.localStorage.getItem(ff) || gf();
3272
3281
  }
3273
- function hf() {
3282
+ function vf() {
3274
3283
  return typeof window > "u" ? {
3275
3284
  width: 0,
3276
3285
  height: 0
@@ -3279,17 +3288,17 @@ function hf() {
3279
3288
  height: window.innerHeight
3280
3289
  };
3281
3290
  }
3282
- function gf() {
3291
+ function yf() {
3283
3292
  if (typeof window > "u" || !window.localStorage) return "light";
3284
- let e = window.localStorage.getItem(uf), t = window.localStorage.getItem(lf);
3293
+ let e = window.localStorage.getItem(pf), t = window.localStorage.getItem(ff);
3285
3294
  if (e || t) {
3286
3295
  let n = e ?? t;
3287
- return ff(n), n;
3296
+ return hf(n), n;
3288
3297
  }
3289
- let n = pf();
3290
- return window.localStorage.setItem(lf, n), ff(n), n;
3298
+ let n = gf();
3299
+ return window.localStorage.setItem(ff, n), hf(n), n;
3291
3300
  }
3292
- var _f = {
3301
+ var bf = {
3293
3302
  name: "ikon.client.getTheme",
3294
3303
  description: "Get the currently selected client theme",
3295
3304
  returnType: {
@@ -3297,12 +3306,12 @@ var _f = {
3297
3306
  nullable: !0
3298
3307
  }
3299
3308
  };
3300
- function vf() {
3309
+ function xf() {
3301
3310
  if (typeof window > "u" || !window.localStorage) return null;
3302
- let e = window.localStorage.getItem(uf), t = window.localStorage.getItem(lf);
3311
+ let e = window.localStorage.getItem(pf), t = window.localStorage.getItem(ff);
3303
3312
  return e ?? t ?? null;
3304
3313
  }
3305
- var yf = {
3314
+ var Sf = {
3306
3315
  name: "ikon.client.setTheme",
3307
3316
  description: "Update the client UI theme",
3308
3317
  returnType: { kind: "boolean" },
@@ -3319,38 +3328,38 @@ var yf = {
3319
3328
  description: "Whether to persist as user preference"
3320
3329
  }]
3321
3330
  };
3322
- function bf(e, t) {
3331
+ function Cf(e, t) {
3323
3332
  if (typeof window > "u" || !window.localStorage || typeof e != "string") return !1;
3324
3333
  let n = e.trim().toLowerCase();
3325
3334
  if (!n) return !1;
3326
3335
  let r = t === void 0 || !!t, i = window.localStorage;
3327
- r ? i.setItem(uf, n) : i.removeItem(uf), i.setItem(lf, n);
3336
+ r ? i.setItem(pf, n) : i.removeItem(pf), i.setItem(ff, n);
3328
3337
  try {
3329
- window.dispatchEvent(new CustomEvent(df, { detail: { mode: n } }));
3338
+ window.dispatchEvent(new CustomEvent(mf, { detail: { mode: n } }));
3330
3339
  } catch {}
3331
- return ff(n), !0;
3340
+ return hf(n), !0;
3332
3341
  }
3333
- var xf = {
3342
+ var wf = {
3334
3343
  name: "ikon.client.getLanguage",
3335
3344
  description: "Get the browser language preference",
3336
3345
  returnType: { kind: "string" }
3337
3346
  };
3338
- function Sf() {
3347
+ function Tf() {
3339
3348
  return typeof navigator > "u" ? "en-US" : navigator.language || "en-US";
3340
3349
  }
3341
- var Cf = {
3350
+ var Ef = {
3342
3351
  name: "ikon.client.getTimezone",
3343
3352
  description: "Get the browser timezone (IANA format)",
3344
3353
  returnType: { kind: "string" }
3345
3354
  };
3346
- function wf() {
3355
+ function Df() {
3347
3356
  try {
3348
3357
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
3349
3358
  } catch {
3350
3359
  return "UTC";
3351
3360
  }
3352
3361
  }
3353
- function Tf() {
3362
+ function Of() {
3354
3363
  if (typeof Intl > "u") return "";
3355
3364
  try {
3356
3365
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -3358,15 +3367,15 @@ function Tf() {
3358
3367
  return "";
3359
3368
  }
3360
3369
  }
3361
- function Ef() {
3370
+ function kf() {
3362
3371
  return typeof navigator > "u" ? !1 : navigator.maxTouchPoints > 0;
3363
3372
  }
3364
- function Df() {
3373
+ function Af() {
3365
3374
  if (typeof navigator > "u" || typeof window > "u") return ne.Unknown;
3366
3375
  let e = navigator.maxTouchPoints > 0, t = window.innerWidth <= 1024;
3367
3376
  return e && t ? ne.MobileWeb : ne.DesktopWeb;
3368
3377
  }
3369
- var Of = {
3378
+ var jf = {
3370
3379
  name: "ikon.client.getUrl",
3371
3380
  description: "Get the current browser URL path and query string",
3372
3381
  returnType: {
@@ -3374,10 +3383,10 @@ var Of = {
3374
3383
  nullable: !0
3375
3384
  }
3376
3385
  };
3377
- function kf() {
3386
+ function Mf() {
3378
3387
  return typeof window > "u" ? null : window.location.pathname + window.location.search;
3379
3388
  }
3380
- var Af = {
3389
+ var Nf = {
3381
3390
  name: "ikon.client.setUrl",
3382
3391
  description: "Update the browser URL without triggering a page reload",
3383
3392
  returnType: { kind: "boolean" },
@@ -3405,10 +3414,10 @@ var Af = {
3405
3414
  }
3406
3415
  ]
3407
3416
  };
3408
- function jf(e, t, n) {
3417
+ function Pf(e, t, n) {
3409
3418
  if (typeof window > "u" || !window.history || typeof e != "string") return !1;
3410
3419
  let r = e.trim();
3411
- if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || cf(r)) return !1;
3420
+ if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || df(r)) return !1;
3412
3421
  try {
3413
3422
  let e = !!t, i = n && !r.includes("?") ? r + window.location.search : r;
3414
3423
  return e ? window.history.replaceState(null, "", i) : window.history.pushState(null, "", i), !0;
@@ -3416,7 +3425,7 @@ function jf(e, t, n) {
3416
3425
  return !1;
3417
3426
  }
3418
3427
  }
3419
- var Mf = {
3428
+ var Ff = {
3420
3429
  name: "ikon.client.openExternalUrl",
3421
3430
  description: "Open an external URL in a new browser tab",
3422
3431
  returnType: { kind: "boolean" },
@@ -3426,7 +3435,7 @@ var Mf = {
3426
3435
  description: "The URL to open. Must be absolute (e.g., starts with https://)."
3427
3436
  }]
3428
3437
  };
3429
- function Nf(e) {
3438
+ function If(e) {
3430
3439
  if (typeof window > "u" || typeof window.open != "function" || typeof e != "string") return !1;
3431
3440
  let t = e.trim();
3432
3441
  if (!t || /^javascript:/i.test(t)) return !1;
@@ -3436,7 +3445,7 @@ function Nf(e) {
3436
3445
  return !1;
3437
3446
  }
3438
3447
  }
3439
- var Pf = {
3448
+ var Lf = {
3440
3449
  name: "ikon.client.vibrate",
3441
3450
  description: "Trigger haptic feedback on supported devices",
3442
3451
  returnType: { kind: "boolean" },
@@ -3446,7 +3455,7 @@ var Pf = {
3446
3455
  description: "Duration in ms, or comma-separated pattern (e.g., \"200\" or \"100,50,100\")"
3447
3456
  }]
3448
3457
  };
3449
- function Ff(e) {
3458
+ function Rf(e) {
3450
3459
  if (typeof navigator > "u" || !navigator.vibrate || typeof e != "string") return !1;
3451
3460
  try {
3452
3461
  let t = e.split(",").map((e) => parseInt(e.trim(), 10));
@@ -3455,16 +3464,16 @@ function Ff(e) {
3455
3464
  return !1;
3456
3465
  }
3457
3466
  }
3458
- var L = null, If = !1, Lf = !1;
3459
- async function Rf() {
3467
+ var L = null, zf = !1, Bf = !1;
3468
+ async function Vf() {
3460
3469
  if (!(typeof navigator > "u" || !("wakeLock" in navigator))) try {
3461
3470
  L = await navigator.wakeLock.request("screen");
3462
3471
  } catch {}
3463
3472
  }
3464
- function zf() {
3465
- document.visibilityState === "visible" && If && (!L || L.released) && Rf();
3473
+ function Hf() {
3474
+ document.visibilityState === "visible" && zf && (!L || L.released) && Vf();
3466
3475
  }
3467
- var Bf = {
3476
+ var Uf = {
3468
3477
  name: "ikon.client.keepScreenAwake",
3469
3478
  description: "Prevent or allow the screen to sleep",
3470
3479
  returnType: { kind: "boolean" },
@@ -3474,15 +3483,15 @@ var Bf = {
3474
3483
  description: "Whether to keep the screen awake"
3475
3484
  }]
3476
3485
  };
3477
- async function Vf(e) {
3486
+ async function Wf(e) {
3478
3487
  if (typeof navigator > "u" || !("wakeLock" in navigator)) return !1;
3479
3488
  try {
3480
- return e ? (If = !0, (!L || L.released) && (L = await navigator.wakeLock.request("screen")), Lf ||= (document.addEventListener("visibilitychange", zf), !0)) : (If = !1, Lf &&= (document.removeEventListener("visibilitychange", zf), !1), L &&= (await L.release(), null)), !0;
3489
+ return e ? (zf = !0, (!L || L.released) && (L = await navigator.wakeLock.request("screen")), Bf ||= (document.addEventListener("visibilitychange", Hf), !0)) : (zf = !1, Bf &&= (document.removeEventListener("visibilitychange", Hf), !1), L &&= (await L.release(), null)), !0;
3481
3490
  } catch {
3482
3491
  return !1;
3483
3492
  }
3484
3493
  }
3485
- var Hf = {
3494
+ var Gf = {
3486
3495
  name: "ikon.client.getVisibility",
3487
3496
  description: "Get the current page visibility state",
3488
3497
  returnType: {
@@ -3490,10 +3499,10 @@ var Hf = {
3490
3499
  nullable: !0
3491
3500
  }
3492
3501
  };
3493
- function Uf() {
3502
+ function Kf() {
3494
3503
  return typeof document > "u" ? null : document.visibilityState || null;
3495
3504
  }
3496
- var Wf = {
3505
+ var qf = {
3497
3506
  name: "ikon.client.scrollTo",
3498
3507
  description: "Scroll the page to a specific position",
3499
3508
  returnType: { kind: "boolean" },
@@ -3518,7 +3527,7 @@ var Wf = {
3518
3527
  }
3519
3528
  ]
3520
3529
  };
3521
- function Gf(e, t, n) {
3530
+ function Jf(e, t, n) {
3522
3531
  if (typeof window > "u" || typeof e != "number" || typeof t != "number") return !1;
3523
3532
  try {
3524
3533
  return window.scrollTo({
@@ -3530,7 +3539,7 @@ function Gf(e, t, n) {
3530
3539
  return !1;
3531
3540
  }
3532
3541
  }
3533
- var Kf = {
3542
+ var Yf = {
3534
3543
  name: "ikon.client.getBatteryLevel",
3535
3544
  description: "Get the current battery level (0-100)",
3536
3545
  returnType: {
@@ -3538,7 +3547,7 @@ var Kf = {
3538
3547
  nullable: !0
3539
3548
  }
3540
3549
  };
3541
- async function qf() {
3550
+ async function Xf() {
3542
3551
  if (typeof navigator > "u" || !("getBattery" in navigator)) return null;
3543
3552
  try {
3544
3553
  let e = await navigator.getBattery();
@@ -3547,7 +3556,7 @@ async function qf() {
3547
3556
  return null;
3548
3557
  }
3549
3558
  }
3550
- var Jf = {
3559
+ var Zf = {
3551
3560
  name: "ikon.client.getNetworkType",
3552
3561
  description: "Get the current network connection type",
3553
3562
  returnType: {
@@ -3555,17 +3564,17 @@ var Jf = {
3555
3564
  nullable: !0
3556
3565
  }
3557
3566
  };
3558
- function Yf() {
3567
+ function Qf() {
3559
3568
  if (typeof navigator > "u") return null;
3560
3569
  let e = navigator.connection;
3561
3570
  return e && (e.effectiveType || e.type) || null;
3562
3571
  }
3563
- var Xf = {
3572
+ var $f = {
3564
3573
  name: "ikon.client.requestFullscreen",
3565
3574
  description: "Request the browser to enter fullscreen mode",
3566
3575
  returnType: { kind: "boolean" }
3567
3576
  };
3568
- async function Zf() {
3577
+ async function ep() {
3569
3578
  if (typeof document > "u" || !document.documentElement) return !1;
3570
3579
  try {
3571
3580
  let e = document.documentElement, t = e.requestFullscreen?.bind(e) ?? e.webkitRequestFullscreen?.bind(e);
@@ -3574,12 +3583,12 @@ async function Zf() {
3574
3583
  return !1;
3575
3584
  }
3576
3585
  }
3577
- var Qf = {
3586
+ var tp = {
3578
3587
  name: "ikon.client.exitFullscreen",
3579
3588
  description: "Exit browser fullscreen mode",
3580
3589
  returnType: { kind: "boolean" }
3581
3590
  };
3582
- function $f() {
3591
+ function np() {
3583
3592
  if (typeof document > "u") return !1;
3584
3593
  try {
3585
3594
  let e = document.exitFullscreen?.bind(document) ?? document.webkitExitFullscreen?.bind(document);
@@ -3588,25 +3597,25 @@ function $f() {
3588
3597
  return !1;
3589
3598
  }
3590
3599
  }
3591
- var ep = {
3600
+ var rp = {
3592
3601
  name: "ikon.client.logout",
3593
3602
  description: "Clear the auth session and return to the login screen at the site root",
3594
3603
  returnType: { kind: "boolean" }
3595
- }, tp = ["ikon-auth-", "ikon-live-snapshot"];
3596
- function np() {
3604
+ }, ip = ["ikon-auth-", "ikon-live-snapshot"];
3605
+ function ap() {
3597
3606
  if (typeof window > "u" || !window.localStorage) return !1;
3598
3607
  try {
3599
3608
  let e = [];
3600
3609
  for (let t = 0; t < window.localStorage.length; t++) {
3601
3610
  let n = window.localStorage.key(t);
3602
- n && tp.some((e) => n.startsWith(e)) && e.push(n);
3611
+ n && ip.some((e) => n.startsWith(e)) && e.push(n);
3603
3612
  }
3604
3613
  return e.forEach((e) => window.localStorage.removeItem(e)), setTimeout(() => window.location.replace(window.location.origin + "/"), 100), !0;
3605
3614
  } catch {
3606
3615
  return !1;
3607
3616
  }
3608
3617
  }
3609
- var rp = {
3618
+ var op = {
3610
3619
  name: "ikon.client.login",
3611
3620
  description: "Start the sign-in flow for an OAuth provider (e.g. google, microsoft)",
3612
3621
  parameters: [{
@@ -3615,15 +3624,15 @@ var rp = {
3615
3624
  }],
3616
3625
  returnType: { kind: "boolean" }
3617
3626
  };
3618
- async function ip(e) {
3627
+ async function sp(e) {
3619
3628
  if (typeof window > "u" || typeof e != "string" || e.length === 0 || e === "guest" || e === "global" || e === "email" || e === "passkey") return !1;
3620
3629
  let t = window.__IKON_AUTH_CONFIG__, n = t?.spaceId;
3621
3630
  if (!n) return !1;
3622
- if ($d()) return await rf(e, n);
3631
+ if (rf()) return await of(e, n);
3623
3632
  let r = await Pd(t?.authUrl), i = window.location.origin + window.location.pathname + window.location.search, a = await Jd(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3624
3633
  return window.location.href = `${r}/oauth/${encodeURIComponent(e)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`, !0;
3625
3634
  }
3626
- var ap = {
3635
+ var cp = {
3627
3636
  name: "ikon.client.loginShow",
3628
3637
  description: "Show the login UI with an optional reason",
3629
3638
  parameters: [{
@@ -3632,15 +3641,15 @@ var ap = {
3632
3641
  }],
3633
3642
  returnType: { kind: "boolean" }
3634
3643
  };
3635
- function op(e) {
3644
+ function lp(e) {
3636
3645
  return typeof window > "u" ? !1 : (ld(typeof e == "string" ? e : null), !0);
3637
3646
  }
3638
- var sp = {
3647
+ var up = {
3639
3648
  name: "ikon.client.getLocation",
3640
3649
  description: "Get the current GPS location",
3641
3650
  returnType: { kind: "string" }
3642
3651
  };
3643
- function cp() {
3652
+ function dp() {
3644
3653
  return typeof navigator > "u" || !navigator.geolocation ? Promise.resolve(null) : new Promise((e) => {
3645
3654
  navigator.geolocation.getCurrentPosition((t) => {
3646
3655
  e({
@@ -3654,15 +3663,15 @@ function cp() {
3654
3663
  });
3655
3664
  });
3656
3665
  }
3657
- var lp = [], up = !1;
3658
- function dp() {
3666
+ var fp = [], pp = !1;
3667
+ function mp() {
3659
3668
  return typeof window < "u" && "Notification" in window;
3660
3669
  }
3661
- function fp(e, t, n, r) {
3670
+ function hp(e, t, n, r) {
3662
3671
  let i = {};
3663
3672
  return e?.trim() && (i.body = e.trim()), t?.trim() && (i.icon = t.trim()), n?.trim() && (i.tag = n.trim()), r && (i.data = r), i;
3664
3673
  }
3665
- function pp(e, t, n, r) {
3674
+ function gp(e, t, n, r) {
3666
3675
  try {
3667
3676
  let i = new Notification(e, t);
3668
3677
  i.onclick = () => {
@@ -3677,40 +3686,40 @@ function pp(e, t, n, r) {
3677
3686
  };
3678
3687
  } catch {}
3679
3688
  }
3680
- function mp() {
3689
+ function _p() {
3681
3690
  if (Notification.permission !== "granted") {
3682
- lp = [];
3691
+ fp = [];
3683
3692
  return;
3684
3693
  }
3685
- let e = lp;
3686
- lp = [];
3687
- for (let t of e) pp(t.title, t.options, t.launchUrl, t.data);
3694
+ let e = fp;
3695
+ fp = [];
3696
+ for (let t of e) gp(t.title, t.options, t.launchUrl, t.data);
3688
3697
  }
3689
- function hp() {
3690
- if (up || typeof window > "u") return;
3691
- up = !0;
3698
+ function vp() {
3699
+ if (pp || typeof window > "u") return;
3700
+ pp = !0;
3692
3701
  let e = async () => {
3693
3702
  try {
3694
3703
  if (await Notification.requestPermission() === "granted") {
3695
- mp();
3704
+ _p();
3696
3705
  return;
3697
3706
  }
3698
3707
  } catch {}
3699
- lp = [];
3708
+ fp = [];
3700
3709
  }, t = () => {
3701
- window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), up = !1, e();
3710
+ window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), pp = !1, e();
3702
3711
  };
3703
3712
  window.addEventListener("pointerdown", t), window.addEventListener("keydown", t);
3704
3713
  }
3705
- var gp = {
3714
+ var yp = {
3706
3715
  name: "ikon.client.getNotificationPermission",
3707
3716
  description: "Get the current notification permission state (granted, denied, default, or unsupported)",
3708
3717
  returnType: { kind: "string" }
3709
3718
  };
3710
- function _p() {
3711
- return dp() ? Notification.permission : "unsupported";
3719
+ function bp() {
3720
+ return mp() ? Notification.permission : "unsupported";
3712
3721
  }
3713
- var vp = {
3722
+ var xp = {
3714
3723
  name: "ikon.client.showNotification",
3715
3724
  description: "Show a notification, requesting permission lazily on the first send",
3716
3725
  returnType: { kind: "string" },
@@ -3756,33 +3765,33 @@ var vp = {
3756
3765
  }
3757
3766
  ]
3758
3767
  };
3759
- async function yp(e, t, n, r, i, a) {
3760
- if (!dp() || typeof e != "string" || !e.trim()) return "unsupported";
3761
- let o = e.trim(), s = fp(typeof t == "string" ? t : void 0, typeof n == "string" ? n : void 0, typeof r == "string" ? r : void 0, typeof a == "string" ? a : void 0), c = typeof i == "string" && i.trim() ? i.trim() : void 0, l = typeof a == "string" && a ? a : void 0;
3762
- if (Notification.permission === "granted") return pp(o, s, c, l), "granted";
3768
+ async function Sp(e, t, n, r, i, a) {
3769
+ if (!mp() || typeof e != "string" || !e.trim()) return "unsupported";
3770
+ let o = e.trim(), s = hp(typeof t == "string" ? t : void 0, typeof n == "string" ? n : void 0, typeof r == "string" ? r : void 0, typeof a == "string" ? a : void 0), c = typeof i == "string" && i.trim() ? i.trim() : void 0, l = typeof a == "string" && a ? a : void 0;
3771
+ if (Notification.permission === "granted") return gp(o, s, c, l), "granted";
3763
3772
  if (Notification.permission === "denied") return "denied";
3764
3773
  try {
3765
3774
  let e = await Notification.requestPermission();
3766
- return e === "granted" && pp(o, s, c, l), e;
3775
+ return e === "granted" && gp(o, s, c, l), e;
3767
3776
  } catch (e) {
3768
- return of(e) ? (lp.push({
3777
+ return lf(e) ? (fp.push({
3769
3778
  title: o,
3770
3779
  options: s,
3771
3780
  launchUrl: c,
3772
3781
  data: l
3773
- }), hp(), "default") : "denied";
3782
+ }), vp(), "default") : "denied";
3774
3783
  }
3775
3784
  }
3776
- var bp = null;
3777
- function xp(e) {
3778
- bp = e ?? null;
3785
+ var Cp = null;
3786
+ function wp(e) {
3787
+ Cp = e ?? null;
3779
3788
  }
3780
- function Sp(e) {
3789
+ function Tp(e) {
3781
3790
  let t = (e + "=".repeat((4 - e.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"), n = atob(t), r = new Uint8Array(n.length);
3782
3791
  for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
3783
3792
  return r;
3784
3793
  }
3785
- var Cp = {
3794
+ var Ep = {
3786
3795
  name: "ikon.client.getPushSubscription",
3787
3796
  description: "Subscribe to Web Push and return the subscription, for offline push registration",
3788
3797
  returnType: {
@@ -3790,14 +3799,14 @@ var Cp = {
3790
3799
  nullable: !0
3791
3800
  }
3792
3801
  };
3793
- async function wp() {
3794
- if (typeof window > "u" || !bp?.enabled || !bp.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !dp() || Notification.permission !== "granted") return null;
3802
+ async function Dp() {
3803
+ if (typeof window > "u" || !Cp?.enabled || !Cp.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !mp() || Notification.permission !== "granted") return null;
3795
3804
  try {
3796
3805
  let e = await navigator.serviceWorker.register("/push-service-worker.js");
3797
3806
  await navigator.serviceWorker.ready;
3798
3807
  let t = (await e.pushManager.getSubscription() ?? await e.pushManager.subscribe({
3799
3808
  userVisibleOnly: !0,
3800
- applicationServerKey: Sp(bp.vapidPublicKey)
3809
+ applicationServerKey: Tp(Cp.vapidPublicKey)
3801
3810
  })).toJSON();
3802
3811
  return !t.endpoint || !t.keys?.p256dh || !t.keys?.auth ? null : {
3803
3812
  Platform: "web",
@@ -3810,98 +3819,98 @@ async function wp() {
3810
3819
  return null;
3811
3820
  }
3812
3821
  }
3813
- var Tp = [
3822
+ var Op = [
3814
3823
  {
3815
- definition: _f,
3816
- handler: vf
3824
+ definition: bf,
3825
+ handler: xf
3817
3826
  },
3818
3827
  {
3819
- definition: yf,
3820
- handler: bf
3828
+ definition: Sf,
3829
+ handler: Cf
3821
3830
  },
3822
3831
  {
3823
- definition: xf,
3824
- handler: Sf
3832
+ definition: wf,
3833
+ handler: Tf
3825
3834
  },
3826
3835
  {
3827
- definition: Cf,
3828
- handler: wf
3836
+ definition: Ef,
3837
+ handler: Df
3829
3838
  },
3830
3839
  {
3831
- definition: Of,
3832
- handler: kf
3840
+ definition: jf,
3841
+ handler: Mf
3833
3842
  },
3834
3843
  {
3835
- definition: Af,
3836
- handler: jf
3844
+ definition: Nf,
3845
+ handler: Pf
3837
3846
  },
3838
3847
  {
3839
- definition: Mf,
3840
- handler: Nf
3848
+ definition: Ff,
3849
+ handler: If
3841
3850
  },
3842
3851
  {
3843
- definition: Pf,
3844
- handler: Ff
3852
+ definition: Lf,
3853
+ handler: Rf
3845
3854
  },
3846
3855
  {
3847
- definition: Bf,
3848
- handler: Vf
3856
+ definition: Uf,
3857
+ handler: Wf
3849
3858
  },
3850
3859
  {
3851
- definition: Hf,
3852
- handler: Uf
3860
+ definition: Gf,
3861
+ handler: Kf
3853
3862
  },
3854
3863
  {
3855
- definition: Wf,
3856
- handler: Gf
3864
+ definition: qf,
3865
+ handler: Jf
3857
3866
  },
3858
3867
  {
3859
- definition: Kf,
3860
- handler: qf
3868
+ definition: Yf,
3869
+ handler: Xf
3861
3870
  },
3862
3871
  {
3863
- definition: Jf,
3864
- handler: Yf
3872
+ definition: Zf,
3873
+ handler: Qf
3865
3874
  },
3866
3875
  {
3867
- definition: Xf,
3868
- handler: Zf
3876
+ definition: $f,
3877
+ handler: ep
3869
3878
  },
3870
3879
  {
3871
- definition: Qf,
3872
- handler: $f
3873
- },
3874
- {
3875
- definition: ep,
3880
+ definition: tp,
3876
3881
  handler: np
3877
3882
  },
3878
3883
  {
3879
3884
  definition: rp,
3880
- handler: ip
3885
+ handler: ap
3881
3886
  },
3882
3887
  {
3883
- definition: ap,
3884
- handler: op
3888
+ definition: op,
3889
+ handler: sp
3885
3890
  },
3886
3891
  {
3887
- definition: sp,
3888
- handler: cp
3892
+ definition: cp,
3893
+ handler: lp
3889
3894
  },
3890
3895
  {
3891
- definition: gp,
3892
- handler: _p
3896
+ definition: up,
3897
+ handler: dp
3893
3898
  },
3894
3899
  {
3895
- definition: vp,
3896
- handler: yp
3900
+ definition: yp,
3901
+ handler: bp
3897
3902
  },
3898
3903
  {
3899
- definition: Cp,
3900
- handler: wp
3904
+ definition: xp,
3905
+ handler: Sp
3906
+ },
3907
+ {
3908
+ definition: Ep,
3909
+ handler: Dp
3901
3910
  }
3902
3911
  ];
3903
- function Ep(e) {
3904
- let t = Tp.map(({ definition: t, handler: n }) => e.register(t, n));
3912
+ function kp(e) {
3913
+ let t = Op.map(({ definition: t, handler: n }) => e.register(t, n));
3905
3914
  return () => t.forEach((e) => e());
3906
3915
  }
3907
3916
  function R() {
@@ -3909,126 +3918,126 @@ function R() {
3909
3918
  }
3910
3919
  //#endregion
3911
3920
  //#region src/utils/log-sink.ts
3912
- var Dp = 1e3, Op = S.INFO, z = [], kp = Dp, Ap = Op, jp = null;
3913
- function Mp(e) {
3914
- e.level < Ap || (z.push(e), z.length > kp && (z = z.slice(-kp)));
3921
+ var Ap = 1e3, jp = S.INFO, z = [], Mp = Ap, Np = jp, Pp = null;
3922
+ function Fp(e) {
3923
+ e.level < Np || (z.push(e), z.length > Mp && (z = z.slice(-Mp)));
3915
3924
  }
3916
- function Np(e) {
3917
- kp = e?.maxBufferSize ?? Dp, Ap = e?.minLevel ?? Op, z = [], ve(Mp);
3925
+ function Ip(e) {
3926
+ Mp = e?.maxBufferSize ?? Ap, Np = e?.minLevel ?? jp, z = [], ve(Fp);
3918
3927
  }
3919
- function Pp(e) {
3920
- jp = e;
3928
+ function Lp(e) {
3929
+ Pp = e;
3921
3930
  }
3922
- function Fp() {
3931
+ function Rp() {
3923
3932
  return z;
3924
3933
  }
3925
- function Ip() {
3934
+ function zp() {
3926
3935
  let e = z;
3927
3936
  return z = [], e;
3928
3937
  }
3929
- function Lp() {
3930
- if (!jp || z.length === 0) return 0;
3931
- let e = Ip();
3932
- return jp(e), e.length;
3938
+ function Bp() {
3939
+ if (!Pp || z.length === 0) return 0;
3940
+ let e = zp();
3941
+ return Pp(e), e.length;
3933
3942
  }
3934
- function Rp() {
3943
+ function Vp() {
3935
3944
  z = [];
3936
3945
  }
3937
- function zp() {
3946
+ function Hp() {
3938
3947
  return z.length;
3939
3948
  }
3940
- Np();
3949
+ Ip();
3941
3950
  //#endregion
3942
3951
  //#region src/utils/log-sender.ts
3943
- var Bp = C("LogSender"), Vp = 1e3, Hp = 6e4, Up = 15e3, Wp = 10240, Gp = 409600, Kp = "…[truncated]", qp = {
3952
+ var Up = C("LogSender"), Wp = 1e3, Gp = 6e4, Kp = 15e3, qp = 10240, Jp = 409600, Yp = "…[truncated]", Xp = {
3944
3953
  [S.DEBUG]: he.Debug,
3945
3954
  [S.INFO]: he.Info,
3946
3955
  [S.WARN]: he.Warning,
3947
3956
  [S.ERROR]: he.Error
3948
- }, B, Jp, V, H = [], Yp = 0, Xp;
3949
- function Zp(e) {
3950
- return e.length <= Wp ? e : e.slice(0, 10228) + Kp;
3957
+ }, B, Zp, V, H = [], Qp = 0, $p;
3958
+ function em(e) {
3959
+ return e.length <= qp ? e : e.slice(0, 10228) + Yp;
3951
3960
  }
3952
- function Qp(e) {
3961
+ function tm(e) {
3953
3962
  return {
3954
3963
  Time: e.timestamp,
3955
- Type: qp[e.level] ?? he.Info,
3956
- Message: Zp(`[${e.component}] ${e.message}`),
3964
+ Type: Xp[e.level] ?? he.Info,
3965
+ Message: em(`[${e.component}] ${e.message}`),
3957
3966
  Parameters: "{}"
3958
3967
  };
3959
3968
  }
3960
- function $p(e) {
3969
+ function nm(e) {
3961
3970
  return JSON.stringify({
3962
3971
  type: "sdk-typescript",
3963
3972
  event: { Logs: e }
3964
3973
  });
3965
3974
  }
3966
- function em(e) {
3975
+ function rm(e) {
3967
3976
  if (e.length === 0) return [];
3968
- let t = Gp - $p([]).length, n = [], r = [], i = 0;
3977
+ let t = Jp - nm([]).length, n = [], r = [], i = 0;
3969
3978
  for (let a of e) {
3970
3979
  let e = JSON.stringify(a).length + 1;
3971
3980
  r.length > 0 && i + e > t && (n.push(r), r = [], i = 0), r.push(a), i += e;
3972
3981
  }
3973
3982
  return r.length > 0 && n.push(r), n;
3974
3983
  }
3975
- async function tm(e) {
3984
+ async function im(e) {
3976
3985
  if (e.length === 0 || !B) return;
3977
3986
  let t = `${B}/events/logs/json`, n = {
3978
3987
  "Content-Type": "application/json",
3979
- Authorization: `Bearer ${Jp}`
3988
+ Authorization: `Bearer ${Zp}`
3980
3989
  }, r = await fetch(t, {
3981
3990
  method: "POST",
3982
3991
  headers: n,
3983
- body: $p(e),
3984
- signal: I(Up)
3992
+ body: nm(e),
3993
+ signal: I(Kp)
3985
3994
  });
3986
3995
  if (!r.ok) {
3987
3996
  if (r.status >= 400 && r.status < 500) {
3988
- Bp.warn(`Dropping ${e.length} log entries due to ${r.status}`);
3997
+ Up.warn(`Dropping ${e.length} log entries due to ${r.status}`);
3989
3998
  return;
3990
3999
  }
3991
4000
  throw Error(`Failed to send logs: ${r.status}`);
3992
4001
  }
3993
4002
  }
3994
- function nm() {
3995
- if (Yp === 0) return Vp;
3996
- let e = Vp * (1 << Math.min(Yp, 6));
3997
- return Math.min(e, Hp);
4003
+ function am() {
4004
+ if (Qp === 0) return Wp;
4005
+ let e = Wp * (1 << Math.min(Qp, 6));
4006
+ return Math.min(e, Gp);
3998
4007
  }
3999
- function rm(e) {
4000
- B && (V = setTimeout(() => void im(), e));
4008
+ function om(e) {
4009
+ B && (V = setTimeout(() => void sm(), e));
4001
4010
  }
4002
- async function im() {
4011
+ async function sm() {
4003
4012
  V = void 0;
4004
- let e = Ip();
4005
- if (H = H.concat(e.map(Qp)), typeof navigator < "u" && navigator.onLine === !1) {
4006
- rm(Vp);
4013
+ let e = zp();
4014
+ if (H = H.concat(e.map(tm)), typeof navigator < "u" && navigator.onLine === !1) {
4015
+ om(Wp);
4007
4016
  return;
4008
4017
  }
4009
4018
  if (H.length === 0) {
4010
- rm(Vp);
4019
+ om(Wp);
4011
4020
  return;
4012
4021
  }
4013
4022
  let t = H;
4014
4023
  H = [];
4015
- let n = em(t), r = !1;
4024
+ let n = rm(t), r = !1;
4016
4025
  for (let e = 0; e < n.length; e++) try {
4017
- await tm(n[e]);
4026
+ await im(n[e]);
4018
4027
  } catch {
4019
4028
  H = n.slice(e).flat().concat(H), r = !0;
4020
4029
  break;
4021
4030
  }
4022
- r ? Yp++ : Yp = 0, rm(nm());
4031
+ r ? Qp++ : Qp = 0, om(am());
4023
4032
  }
4024
- function am() {
4025
- V !== void 0 && (clearTimeout(V), V = void 0), rm(0);
4033
+ function cm() {
4034
+ V !== void 0 && (clearTimeout(V), V = void 0), om(0);
4026
4035
  }
4027
- function om(e, t) {
4028
- cm(), B = e, Jp = t, Yp = 0, typeof window < "u" && (Xp = am, window.addEventListener("online", Xp)), rm(Vp);
4036
+ function lm(e, t) {
4037
+ dm(), B = e, Zp = t, Qp = 0, typeof window < "u" && ($p = cm, window.addEventListener("online", $p)), om(Wp);
4029
4038
  }
4030
- function sm(e, t) {
4031
- if (!B || !Jp) return;
4039
+ function um(e, t) {
4040
+ if (!B || !Zp) return;
4032
4041
  let n = { Events: [{
4033
4042
  Time: (/* @__PURE__ */ new Date()).toISOString(),
4034
4043
  EventName: e,
@@ -4042,60 +4051,60 @@ function sm(e, t) {
4042
4051
  method: "POST",
4043
4052
  headers: {
4044
4053
  "Content-Type": "application/json",
4045
- Authorization: `Bearer ${Jp}`
4054
+ Authorization: `Bearer ${Zp}`
4046
4055
  },
4047
4056
  body: r
4048
- }).catch((t) => Bp.warn(`Failed to send analytics event ${e}: ${t}`));
4057
+ }).catch((t) => Up.warn(`Failed to send analytics event ${e}: ${t}`));
4049
4058
  }
4050
- function cm() {
4051
- V !== void 0 && (clearTimeout(V), V = void 0), Xp !== void 0 && typeof window < "u" && (window.removeEventListener("online", Xp), Xp = void 0), B = void 0, Jp = void 0, H = [], Yp = 0;
4059
+ function dm() {
4060
+ V !== void 0 && (clearTimeout(V), V = void 0), $p !== void 0 && typeof window < "u" && (window.removeEventListener("online", $p), $p = void 0), B = void 0, Zp = void 0, H = [], Qp = 0;
4052
4061
  }
4053
4062
  //#endregion
4054
4063
  //#region src/utils/connect-timeline.ts
4055
- var lm = C("ConnectTimeline"), um = "ikon-connect-trace-id", dm, fm = !1;
4056
- function pm() {
4064
+ var fm = C("ConnectTimeline"), pm = "ikon-connect-trace-id", mm, hm = !1;
4065
+ function gm() {
4057
4066
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`;
4058
4067
  }
4059
- function mm() {
4068
+ function _m() {
4060
4069
  try {
4061
- let e = sessionStorage.getItem(um);
4070
+ let e = sessionStorage.getItem(pm);
4062
4071
  if (e) return e;
4063
- let t = pm();
4064
- return sessionStorage.setItem(um, t), t;
4072
+ let t = gm();
4073
+ return sessionStorage.setItem(pm, t), t;
4065
4074
  } catch {
4066
- return dm ??= pm(), dm;
4075
+ return mm ??= gm(), mm;
4067
4076
  }
4068
4077
  }
4069
- function hm(e) {
4078
+ function vm(e) {
4070
4079
  if (typeof performance > "u" || typeof performance.getEntriesByType != "function") return;
4071
4080
  let t = performance.getEntriesByType("resource");
4072
4081
  for (let n = t.length - 1; n >= 0; n--) if (t[n].name.includes(e)) return Math.round(t[n].duration);
4073
4082
  }
4074
- function gm(e = {}) {
4075
- if (fm) return;
4076
- fm = !0;
4077
- let t = { connectTraceId: mm() };
4083
+ function ym(e = {}) {
4084
+ if (hm) return;
4085
+ hm = !0;
4086
+ let t = { connectTraceId: _m() };
4078
4087
  e.snapshotSeeded !== void 0 && (t.snapshotSeeded = String(e.snapshotSeeded));
4079
4088
  try {
4080
4089
  if (typeof performance < "u") {
4081
4090
  t.firstPaintMs = String(Math.round(performance.now()));
4082
4091
  let e = performance.getEntriesByType("navigation")[0];
4083
4092
  e && (t.cdnHtmlMs = String(Math.round(e.responseEnd - e.fetchStart)), t.domContentLoadedMs = String(Math.round(e.domContentLoadedEventEnd)));
4084
- let n = hm("/anonymous");
4093
+ let n = vm("/anonymous");
4085
4094
  n !== void 0 && (t.authMs = String(n));
4086
- let r = hm("/init");
4095
+ let r = vm("/init");
4087
4096
  r !== void 0 && (t.initMs = String(r));
4088
- let i = hm("/connect");
4097
+ let i = vm("/connect");
4089
4098
  i !== void 0 && (t.connectMs = String(i));
4090
4099
  }
4091
4100
  } catch (e) {
4092
- lm.warn(`Failed to read performance timeline: ${e}`);
4101
+ fm.warn(`Failed to read performance timeline: ${e}`);
4093
4102
  }
4094
- sm("client_connect_timeline", t);
4103
+ um("client_connect_timeline", t);
4095
4104
  }
4096
4105
  //#endregion
4097
4106
  //#region src/utils/uuid.ts
4098
- function _m() {
4107
+ function bm() {
4099
4108
  let e = globalThis.crypto;
4100
4109
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
4101
4110
  let t = /* @__PURE__ */ new Uint8Array(16);
@@ -4108,34 +4117,34 @@ function _m() {
4108
4117
  }
4109
4118
  //#endregion
4110
4119
  //#region src/storage.ts
4111
- var vm = "ikon-device-id";
4112
- function ym() {
4113
- if (typeof window > "u" || typeof localStorage > "u") return _m();
4120
+ var xm = "ikon-device-id";
4121
+ function Sm() {
4122
+ if (typeof window > "u" || typeof localStorage > "u") return bm();
4114
4123
  try {
4115
- let e = localStorage.getItem(vm);
4116
- return e || (e = _m(), localStorage.setItem(vm, e)), e;
4124
+ let e = localStorage.getItem(xm);
4125
+ return e || (e = bm(), localStorage.setItem(xm, e)), e;
4117
4126
  } catch {
4118
- return _m();
4127
+ return bm();
4119
4128
  }
4120
4129
  }
4121
- function bm() {
4130
+ function Cm() {
4122
4131
  if (!(typeof localStorage > "u")) try {
4123
- localStorage.removeItem(vm);
4132
+ localStorage.removeItem(xm);
4124
4133
  } catch {}
4125
4134
  }
4126
- function xm(e) {
4127
- let t = Cm(e);
4135
+ function wm(e) {
4136
+ let t = Em(e);
4128
4137
  return typeof t?.id == "string" ? t.id : null;
4129
4138
  }
4130
- function Sm(e) {
4131
- let t = Cm(e);
4139
+ function Tm(e) {
4140
+ let t = Em(e);
4132
4141
  return t ? {
4133
4142
  userId: typeof t.id == "string" ? t.id : null,
4134
4143
  authSession: typeof t.authSession == "string" ? t.authSession : null,
4135
4144
  role: typeof t.role == "string" ? t.role : null
4136
4145
  } : null;
4137
4146
  }
4138
- function Cm(e) {
4147
+ function Em(e) {
4139
4148
  try {
4140
4149
  let t = e.split(".");
4141
4150
  if (t.length !== 3) return null;
@@ -4147,8 +4156,8 @@ function Cm(e) {
4147
4156
  }
4148
4157
  //#endregion
4149
4158
  //#region src/connection/authenticator.ts
4150
- var U = C("Authenticator"), W = w.GROUP_CORE | w.GROUP_KEEPALIVE | w.GROUP_EVENTS | w.GROUP_ACTIONS | w.GROUP_UI | w.GROUP_AUDIO | w.GROUP_VIDEO | w.GROUP_ANALYTICS | w.GROUP_APP_LOCAL, wm = 2, Tm = 6e4, Em = 2e3, Dm = 1e4, Om = 3e3, km = 3e3, Am = 3, jm = "X-Ikon-Startup-Failed", Mm = "startup_failed", Nm = 1e3, Pm = 4;
4151
- async function Fm(e, t, n, r) {
4159
+ var U = C("Authenticator"), W = w.GROUP_CORE | w.GROUP_KEEPALIVE | w.GROUP_EVENTS | w.GROUP_ACTIONS | w.GROUP_UI | w.GROUP_AUDIO | w.GROUP_VIDEO | w.GROUP_ANALYTICS | w.GROUP_APP_LOCAL, Dm = 2, Om = 6e4, km = 2e3, Am = 1e4, jm = 3e3, Mm = 3e3, Nm = 3, Pm = "X-Ikon-Startup-Failed", Fm = "startup_failed", Im = 1e3, Lm = 4;
4160
+ async function Rm(e, t, n, r) {
4152
4161
  if (e) try {
4153
4162
  let i = await fetch(`${n}/anonymous`, {
4154
4163
  method: "POST",
@@ -4169,7 +4178,7 @@ async function Fm(e, t, n, r) {
4169
4178
  U.warn("Anonymous auth returned no token");
4170
4179
  return;
4171
4180
  }
4172
- let o = xm(a.token);
4181
+ let o = wm(a.token);
4173
4182
  if (!o) {
4174
4183
  U.warn("Anonymous auth token had no extractable userId");
4175
4184
  return;
@@ -4183,7 +4192,7 @@ async function Fm(e, t, n, r) {
4183
4192
  return;
4184
4193
  }
4185
4194
  }
4186
- async function Im(e, t, n, r) {
4195
+ async function zm(e, t, n, r) {
4187
4196
  try {
4188
4197
  let i = await fetch(`${e}/profiles/me?space=${encodeURIComponent(t)}`, {
4189
4198
  method: "GET",
@@ -4195,7 +4204,7 @@ async function Im(e, t, n, r) {
4195
4204
  U.warn("Failed to ensure profile:", e);
4196
4205
  }
4197
4206
  }
4198
- async function Lm(e) {
4207
+ async function Bm(e) {
4199
4208
  let t = await e.text().catch(() => "Unknown error");
4200
4209
  try {
4201
4210
  let e = JSON.parse(t);
@@ -4203,16 +4212,16 @@ async function Lm(e) {
4203
4212
  } catch {}
4204
4213
  return t;
4205
4214
  }
4206
- async function Rm(e) {
4215
+ async function Vm(e) {
4207
4216
  if (e.ok) return;
4208
- let t = await Lm(e);
4209
- throw e.status === 403 ? new Ml(`Access denied: ${t}`, t) : zm("Failed to get or create profile", e.status, t);
4217
+ let t = await Bm(e);
4218
+ throw e.status === 403 ? new Ml(`Access denied: ${t}`, t) : Hm("Failed to get or create profile", e.status, t);
4210
4219
  }
4211
- function zm(e, t, n) {
4220
+ function Hm(e, t, n) {
4212
4221
  let r = `${e}: ${t} ${n}`;
4213
4222
  return t >= 500 ? new Fl(r, t) : new T(r);
4214
4223
  }
4215
- function Bm(e, t, n) {
4224
+ function Um(e, t, n) {
4216
4225
  let r = {
4217
4226
  method: "POST",
4218
4227
  headers: {
@@ -4224,35 +4233,35 @@ function Bm(e, t, n) {
4224
4233
  };
4225
4234
  return t || (r.credentials = "include"), r;
4226
4235
  }
4227
- async function Vm(e, t, n, r) {
4228
- let i = `${e}/init`, a = await fetch(i, Bm(t, n, r));
4236
+ async function Wm(e, t, n, r) {
4237
+ let i = `${e}/init`, a = await fetch(i, Um(t, n, r));
4229
4238
  if (!a.ok) {
4230
- let e = await Lm(a);
4231
- throw a.status === 403 ? new Ml(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new Nl(t.sessionIdentityHash) : zm("Backend init failed", a.status, e);
4239
+ let e = await Bm(a);
4240
+ throw a.status === 403 ? new Ml(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new Nl(t.sessionIdentityHash) : Hm("Backend init failed", a.status, e);
4232
4241
  }
4233
4242
  return a.json();
4234
4243
  }
4235
- function Hm(e, t) {
4244
+ function Gm(e, t) {
4236
4245
  return e.startupFailed ? new O() : new Al(t);
4237
4246
  }
4238
4247
  async function G(e, t, n) {
4239
- let r = I(n ?? Dm), i = t ? gd([t, r]) : r, a = Date.now(), o = await fetch(e, { signal: i });
4248
+ let r = I(n ?? Am), i = t ? gd([t, r]) : r, a = Date.now(), o = await fetch(e, { signal: i });
4240
4249
  if (!o.ok) {
4241
4250
  let e = await o.text().catch(() => "Unknown error");
4242
- throw o.status === 429 ? new Pl(`Server is at capacity: ${e}`) : o.headers.get(jm) || e.includes(Mm) ? new O() : zm("Failed to connect", o.status, e);
4251
+ throw o.status === 429 ? new Pl(`Server is at capacity: ${e}`) : o.headers.get(Pm) || e.includes(Fm) ? new O() : Hm("Failed to connect", o.status, e);
4243
4252
  }
4244
4253
  let s = await o.arrayBuffer(), c = await An(new Uint8Array(s));
4245
4254
  return U.debug(`Connect URL fetched in ${Date.now() - a}ms`), { authResponse: c };
4246
4255
  }
4247
- async function Um(e, t) {
4256
+ async function Km(e, t) {
4248
4257
  try {
4249
- let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = I(km), a = t ? gd([t, i]) : i;
4258
+ let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = I(Mm), a = t ? gd([t, i]) : i;
4250
4259
  return (await fetch(r, { signal: a })).ok;
4251
4260
  } catch {
4252
4261
  return !1;
4253
4262
  }
4254
4263
  }
4255
- async function Wm(e, t, n, r, i) {
4264
+ async function qm(e, t, n, r, i) {
4256
4265
  let a = [];
4257
4266
  if (n === "force-proxy" ? t && a.push({
4258
4267
  url: t,
@@ -4275,9 +4284,9 @@ async function Wm(e, t, n, r, i) {
4275
4284
  })), a.length === 0) throw new T("No connect URL available");
4276
4285
  U.debug(`Auth URL order: [${a.map((e) => e.isProxy ? "proxy" : "direct").join(", ")}], mode: ${n}, proxyPreferred: ${r}`);
4277
4286
  let o = n === "auto" && a.length > 1 && !a[0].isProxy, s = Date.now(), c = 0;
4278
- for (; c < wm || Date.now() - s < Tm;) {
4287
+ for (; c < Dm || Date.now() - s < Om;) {
4279
4288
  for (let t = 0; t < a.length; t++) {
4280
- let n = a[t], r = c === 0 && t === 0 && o ? Om : Dm;
4289
+ let n = a[t], r = c === 0 && t === 0 && o ? jm : Am;
4281
4290
  try {
4282
4291
  let t = await G(n.url, i, r);
4283
4292
  return t.usedProxyUrl = n.isProxy, t.directUrl = e, U.debug(`Auth succeeded via ${n.isProxy ? "proxy" : "direct"} URL`), t;
@@ -4286,12 +4295,12 @@ async function Wm(e, t, n, r, i) {
4286
4295
  U.warn(`Auth via ${n.isProxy ? "proxy" : "direct"} URL failed (round ${c + 1}, timeout ${r}ms): ${e}`);
4287
4296
  }
4288
4297
  }
4289
- c++, await Ll(Em, i);
4298
+ c++, await Ll(km, i);
4290
4299
  }
4291
4300
  throw new T("Failed to connect after exhausting all URL attempts");
4292
4301
  }
4293
- function Gm(e, t, n = "", r = !0) {
4294
- let i = hf();
4302
+ function Jm(e, t, n = "", r = !0) {
4303
+ let i = vf();
4295
4304
  return Zt({
4296
4305
  ServerSessionId: "",
4297
4306
  ContextType: m.Browser,
@@ -4301,7 +4310,7 @@ function Gm(e, t, n = "", r = !0) {
4301
4310
  IsSnapshot: gu(),
4302
4311
  Description: e.description ?? "Ikon SDK TypeScript",
4303
4312
  UserId: t,
4304
- DeviceId: e.deviceId ?? ym(),
4313
+ DeviceId: e.deviceId ?? Sm(),
4305
4314
  ProductId: e.productId ?? "ikon-sdk",
4306
4315
  VersionId: e.versionId ?? "1.0.0",
4307
4316
  InstallId: e.installId ?? "",
@@ -4309,26 +4318,26 @@ function Gm(e, t, n = "", r = !0) {
4309
4318
  OpcodeGroupsFromServer: e.opcodeGroupsFromServer ?? W,
4310
4319
  OpcodeGroupsToServer: e.opcodeGroupsToServer ?? W,
4311
4320
  ProtocolVersion: 1,
4312
- SdkCapability: Pm,
4321
+ SdkCapability: Lm,
4313
4322
  HasInput: !1,
4314
4323
  AuthSessionId: n,
4315
4324
  IsAnonymous: r,
4316
4325
  IsGlobal: !1,
4317
4326
  ReceiveAllMessages: !1,
4318
4327
  UserAgent: typeof navigator < "u" ? navigator.userAgent : "",
4319
- ClientType: Df(),
4328
+ ClientType: Af(),
4320
4329
  Parameters: e.parameters ?? {},
4321
4330
  ViewportWidth: i.width,
4322
4331
  ViewportHeight: i.height,
4323
- Theme: mf(),
4324
- Timezone: Tf(),
4325
- IsTouchDevice: Ef(),
4332
+ Theme: _f(),
4333
+ Timezone: Of(),
4334
+ IsTouchDevice: kf(),
4326
4335
  InitialPath: Hd(),
4327
4336
  InitialUrl: Ud(),
4328
4337
  SupportsCompression: Oe()
4329
4338
  });
4330
4339
  }
4331
- function Km(e) {
4340
+ function Ym(e) {
4332
4341
  return {
4333
4342
  ServerSessionId: e.ServerSessionId,
4334
4343
  ContextType: e.ContextType,
@@ -4365,26 +4374,26 @@ function Km(e) {
4365
4374
  SupportsCompression: e.SupportsCompression
4366
4375
  };
4367
4376
  }
4368
- async function qm(e, t) {
4377
+ async function Xm(e, t) {
4369
4378
  let n = `https://${e.host}:${e.httpsPort}`;
4370
4379
  U.debug(`Authenticating with local server: ${n}`);
4371
4380
  let r = {
4372
4381
  ...Id(),
4373
4382
  ...e.parameters
4374
- }, i = e.deviceId ?? ym(), a = e.userId, o = e.token;
4383
+ }, i = e.deviceId ?? Sm(), a = e.userId, o = e.token;
4375
4384
  if (!a) {
4376
- let n = await Fm(e.spaceId, i, await Pd(e.authUrl), t);
4385
+ let n = await Rm(e.spaceId, i, await Pd(e.authUrl), t);
4377
4386
  n && (a = n.userId, o = n.token);
4378
4387
  }
4379
4388
  if (a || (a = i, U.debug("Using deviceId as userId fallback")), e.spaceId && o) if (e.token) {
4380
4389
  let n = jd(e.backendUrl);
4381
- await Rm(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
4390
+ await Vm(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
4382
4391
  method: "GET",
4383
4392
  headers: { Authorization: `Bearer ${o}` },
4384
4393
  signal: t
4385
4394
  }));
4386
- } else await Im(jd(e.backendUrl), e.spaceId, o, t);
4387
- let s = e.token ?? e.identityToken ?? o, c = s ? Sm(s) : null, l = c?.authSession ?? (e.token ? "authenticated" : ""), u = c?.role ? c.role === "anonymous" : !e.token, d = Km(Gm({
4395
+ } else await zm(jd(e.backendUrl), e.spaceId, o, t);
4396
+ let s = e.token ?? e.identityToken ?? o, c = s ? Tm(s) : null, l = c?.authSession ?? (e.token ? "authenticated" : ""), u = c?.role ? c.role === "anonymous" : !e.token, d = Ym(Jm({
4388
4397
  ...e,
4389
4398
  parameters: r
4390
4399
  }, a, l, u)), f = await fetch(`${n}/connect-token`, {
@@ -4395,14 +4404,14 @@ async function qm(e, t) {
4395
4404
  });
4396
4405
  if (!f.ok) {
4397
4406
  let e = await f.text().catch(() => "Unknown error");
4398
- throw zm("Failed to get connect token", f.status, e);
4407
+ throw Hm("Failed to get connect token", f.status, e);
4399
4408
  }
4400
4409
  let p = (await f.json()).token;
4401
4410
  if (!p) throw new T("Server did not return a token");
4402
4411
  let m = `${n}/connect?token=${encodeURIComponent(p)}`, h = await G(m, t);
4403
4412
  return h.directUrl = m, h.backendUrl = jd(e.backendUrl), h.authToken = o, h;
4404
4413
  }
4405
- async function Jm(e, t, n = "auto", r = !1) {
4414
+ async function Zm(e, t, n = "auto", r = !1) {
4406
4415
  let i = Ad(e.backendType);
4407
4416
  U.debug(`Authenticating with cloud server: ${i}, space ID: ${e.spaceId}`);
4408
4417
  let a = await fetch(`${i}/auth/api-key`, {
@@ -4417,14 +4426,14 @@ async function Jm(e, t, n = "auto", r = !1) {
4417
4426
  });
4418
4427
  if (!a.ok) {
4419
4428
  let e = await a.text().catch(() => "Unknown error");
4420
- throw zm("API key authentication failed", a.status, e);
4429
+ throw Hm("API key authentication failed", a.status, e);
4421
4430
  }
4422
4431
  let o = (await a.json()).token;
4423
4432
  if (!o) throw new T("Backend did not return a token");
4424
4433
  let s = Id(), c = e.provisioningTimeoutMs ?? 6e4, l = {
4425
4434
  ...s,
4426
4435
  ...e.parameters
4427
- }, u = hf(), d = j() ? Am : 1;
4436
+ }, u = vf(), d = j() ? Nm : 1;
4428
4437
  for (let a = 0; a < d; a++) try {
4429
4438
  let a = {
4430
4439
  space: e.spaceId,
@@ -4432,13 +4441,13 @@ async function Jm(e, t, n = "auto", r = !1) {
4432
4441
  params: e.parameters,
4433
4442
  waitForRunning: !0,
4434
4443
  waitForRunningTimeoutMs: c,
4435
- connectTraceId: mm(),
4444
+ connectTraceId: _m(),
4436
4445
  contextType: m.Plugin,
4437
4446
  userType: e.userType ?? p.Human,
4438
- clientType: e.clientType ?? Df(),
4447
+ clientType: e.clientType ?? Af(),
4439
4448
  payloadType: me.Teleport,
4440
4449
  description: e.description ?? "Ikon SDK TypeScript",
4441
- deviceId: e.deviceId ?? ym(),
4450
+ deviceId: e.deviceId ?? Sm(),
4442
4451
  productId: e.productId ?? "",
4443
4452
  versionId: e.versionId ?? "",
4444
4453
  installId: e.installId ?? "",
@@ -4450,32 +4459,32 @@ async function Jm(e, t, n = "auto", r = !1) {
4450
4459
  launchParams: l,
4451
4460
  viewportWidth: u.width,
4452
4461
  viewportHeight: u.height,
4453
- theme: mf(),
4454
- timezone: Tf(),
4455
- isTouchDevice: Ef(),
4462
+ theme: _f(),
4463
+ timezone: Of(),
4464
+ isTouchDevice: kf(),
4456
4465
  initialPath: Hd(),
4457
4466
  initialUrl: Ud(),
4458
4467
  sdkType: 2,
4459
- sdkCapability: Pm,
4468
+ sdkCapability: Lm,
4460
4469
  supportsCompression: Oe(),
4461
4470
  isSnapshot: gu()
4462
- }, s = t ? gd([t, I(c)]) : I(c), d = await Vm(i, a, o, s);
4463
- if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Hm(d, c);
4464
- let f = await Wm(d.configuration.url, d.configuration.proxyUrl, n, r, s);
4465
- return f.backendUrl = i, f.authToken = o, f.brandingRequired = d.configuration.brandingRequired ?? !1, xp(d.configuration.push), f;
4471
+ }, s = t ? gd([t, I(c)]) : I(c), d = await Wm(i, a, o, s);
4472
+ if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Gm(d, c);
4473
+ let f = await qm(d.configuration.url, d.configuration.proxyUrl, n, r, s);
4474
+ return f.backendUrl = i, f.authToken = o, f.brandingRequired = d.configuration.brandingRequired ?? !1, wp(d.configuration.push), f;
4466
4475
  } catch (e) {
4467
4476
  if (e instanceof Ml || e instanceof Pl || e instanceof Nl || e instanceof O || a === d - 1) throw e;
4468
- U.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await Ll(Nm * (a + 1), t);
4477
+ U.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await Ll(Im * (a + 1), t);
4469
4478
  }
4470
4479
  throw new T("Failed to init after all attempts");
4471
4480
  }
4472
- async function Ym(e, t, n = "auto", r = !1) {
4481
+ async function Qm(e, t, n = "auto", r = !1) {
4473
4482
  let i = Ad(e.backendType), a = e.token;
4474
4483
  U.debug(`Authenticating with session token to: ${i}, space ID: ${e.spaceId}`);
4475
4484
  let o = Id(), s = e.provisioningTimeoutMs ?? 6e4, c = {
4476
4485
  ...o,
4477
4486
  ...e.parameters
4478
- }, l = hf(), u = j() ? Am : 1;
4487
+ }, l = vf(), u = j() ? Nm : 1;
4479
4488
  for (let o = 0; o < u; o++) try {
4480
4489
  let o = {
4481
4490
  space: e.spaceId,
@@ -4483,13 +4492,13 @@ async function Ym(e, t, n = "auto", r = !1) {
4483
4492
  params: e.parameters,
4484
4493
  waitForRunning: !0,
4485
4494
  waitForRunningTimeoutMs: s,
4486
- connectTraceId: mm(),
4495
+ connectTraceId: _m(),
4487
4496
  contextType: m.Browser,
4488
4497
  userType: p.Human,
4489
- clientType: Df(),
4498
+ clientType: Af(),
4490
4499
  payloadType: me.Teleport,
4491
4500
  description: e.description ?? "Ikon SDK TypeScript",
4492
- deviceId: e.deviceId ?? ym(),
4501
+ deviceId: e.deviceId ?? Sm(),
4493
4502
  productId: e.productId ?? "",
4494
4503
  versionId: e.versionId ?? "",
4495
4504
  installId: e.installId ?? "",
@@ -4501,39 +4510,39 @@ async function Ym(e, t, n = "auto", r = !1) {
4501
4510
  launchParams: c,
4502
4511
  viewportWidth: l.width,
4503
4512
  viewportHeight: l.height,
4504
- theme: mf(),
4505
- timezone: Tf(),
4506
- isTouchDevice: Ef(),
4513
+ theme: _f(),
4514
+ timezone: Of(),
4515
+ isTouchDevice: kf(),
4507
4516
  initialPath: Hd(),
4508
4517
  initialUrl: Ud(),
4509
4518
  sdkType: 2,
4510
- sdkCapability: Pm,
4519
+ sdkCapability: Lm,
4511
4520
  supportsCompression: Oe(),
4512
4521
  isSnapshot: gu()
4513
- }, u = t ? gd([t, I(s)]) : I(s), d = await Vm(i, o, a, u);
4514
- if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Hm(d, s);
4515
- let f = await Wm(d.configuration.url, d.configuration.proxyUrl, n, r, u);
4516
- return f.backendUrl = i, f.authToken = a, f.brandingRequired = d.configuration.brandingRequired ?? !1, xp(d.configuration.push), f;
4522
+ }, u = t ? gd([t, I(s)]) : I(s), d = await Wm(i, o, a, u);
4523
+ if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Gm(d, s);
4524
+ let f = await qm(d.configuration.url, d.configuration.proxyUrl, n, r, u);
4525
+ return f.backendUrl = i, f.authToken = a, f.brandingRequired = d.configuration.brandingRequired ?? !1, wp(d.configuration.push), f;
4517
4526
  } catch (e) {
4518
4527
  if (e instanceof Ml || e instanceof Pl || e instanceof Nl || e instanceof O || o === u - 1) throw e;
4519
- U.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await Ll(Nm * (o + 1), t);
4528
+ U.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await Ll(Im * (o + 1), t);
4520
4529
  }
4521
4530
  throw new T("Failed to init after all attempts");
4522
4531
  }
4523
4532
  //#endregion
4524
4533
  //#region src/functions/type-conversion.ts
4525
- var Xm = /* @__PURE__ */ new Uint8Array();
4526
- function Zm(e) {
4534
+ var $m = /* @__PURE__ */ new Uint8Array();
4535
+ function eh(e) {
4527
4536
  switch (e.kind) {
4528
4537
  case "array": return {
4529
4538
  kind: "array",
4530
- element: Zm(e.element),
4539
+ element: eh(e.element),
4531
4540
  nullable: e.nullable ?? !1
4532
4541
  };
4533
4542
  case "dictionary": return {
4534
4543
  kind: "dictionary",
4535
4544
  keyType: e.keyType ?? "string",
4536
- value: Zm(e.value),
4545
+ value: eh(e.value),
4537
4546
  nullable: e.nullable ?? !1
4538
4547
  };
4539
4548
  default: return {
@@ -4542,17 +4551,17 @@ function Zm(e) {
4542
4551
  };
4543
4552
  }
4544
4553
  }
4545
- function Qm(e) {
4554
+ function th(e) {
4546
4555
  switch (e.kind) {
4547
4556
  case "boolean": return "System.Boolean";
4548
4557
  case "number": return "System.Double";
4549
4558
  case "string": return "System.String";
4550
- case "array": return `System.Collections.Generic.List\`1[${Qm(e.element)}]`;
4551
- case "dictionary": return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${Qm(e.value)}]`;
4559
+ case "array": return `System.Collections.Generic.List\`1[${th(e.element)}]`;
4560
+ case "dictionary": return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${th(e.value)}]`;
4552
4561
  default: return e;
4553
4562
  }
4554
4563
  }
4555
- function $m(e, t) {
4564
+ function nh(e, t) {
4556
4565
  if (e === void 0 || e === "") return;
4557
4566
  let n = JSON.parse(e);
4558
4567
  if (n === null) {
@@ -4561,7 +4570,7 @@ function $m(e, t) {
4561
4570
  }
4562
4571
  return n;
4563
4572
  }
4564
- function eh(e, t) {
4573
+ function rh(e, t) {
4565
4574
  if (e === void 0) return "null";
4566
4575
  if (e === null) {
4567
4576
  if (!t.nullable) throw Error("Value cannot be null for non-nullable type");
@@ -4569,9 +4578,9 @@ function eh(e, t) {
4569
4578
  }
4570
4579
  return JSON.stringify(e);
4571
4580
  }
4572
- function th(e, t) {
4581
+ function ih(e, t) {
4573
4582
  let r = (e.parameters ?? []).map((e) => {
4574
- let t = Zm(e.type), n = Object.prototype.hasOwnProperty.call(e, "defaultValue"), r = n ? eh(e.defaultValue, t) : "";
4583
+ let t = eh(e.type), n = Object.prototype.hasOwnProperty.call(e, "defaultValue"), r = n ? rh(e.defaultValue, t) : "";
4575
4584
  return {
4576
4585
  name: e.name,
4577
4586
  descriptor: t,
@@ -4579,7 +4588,7 @@ function th(e, t) {
4579
4588
  defaultValueJson: r,
4580
4589
  description: e.description
4581
4590
  };
4582
- }), i = Zm(e.returnType);
4591
+ }), i = eh(e.returnType);
4583
4592
  return {
4584
4593
  definition: e,
4585
4594
  handler: t,
@@ -4589,7 +4598,7 @@ function th(e, t) {
4589
4598
  Description: e.description ?? "",
4590
4599
  LlmInlineResult: e.llmInlineResult ?? !1,
4591
4600
  LlmCallOnlyOnce: e.llmCallOnlyOnce ?? !1,
4592
- ResultTypeName: Qm(i),
4601
+ ResultTypeName: th(i),
4593
4602
  IsEnumerable: !1,
4594
4603
  EnumerableItemTypeName: "",
4595
4604
  IsCancellable: !1,
@@ -4598,10 +4607,10 @@ function th(e, t) {
4598
4607
  Parameters: r.map((e, t) => ({
4599
4608
  ParameterIndex: t,
4600
4609
  ParameterName: e.name,
4601
- TypeName: Qm(e.descriptor),
4610
+ TypeName: th(e.descriptor),
4602
4611
  HasDefaultValue: e.hasDefaultValue,
4603
4612
  DefaultValueJson: e.defaultValueJson,
4604
- DefaultValueData: Xm,
4613
+ DefaultValueData: $m,
4605
4614
  IsEnumerable: !1,
4606
4615
  EnumerableItemTypeName: "",
4607
4616
  Description: e.description ?? ""
@@ -4613,24 +4622,24 @@ function th(e, t) {
4613
4622
  }
4614
4623
  //#endregion
4615
4624
  //#region src/functions/types.ts
4616
- function nh(e, t) {
4625
+ function ah(e, t) {
4617
4626
  return {
4618
4627
  value: e,
4619
4628
  data: t
4620
4629
  };
4621
4630
  }
4622
- var rh = class extends Error {
4631
+ var oh = class extends Error {
4623
4632
  remoteErrorType;
4624
4633
  remoteStackTrace;
4625
4634
  code;
4626
4635
  constructor(e, t, n, r = "") {
4627
4636
  super(e), this.remoteErrorType = t, this.remoteStackTrace = n, this.code = r, this.name = "FunctionCallError";
4628
4637
  }
4629
- }, ih = C("FunctionRegistry"), ah = /* @__PURE__ */ new Uint8Array(), oh = 3e4;
4630
- function sh(e) {
4638
+ }, sh = C("FunctionRegistry"), ch = /* @__PURE__ */ new Uint8Array(), lh = 3e4;
4639
+ function uh(e) {
4631
4640
  return !e || typeof e != "object" ? !1 : e.data instanceof Uint8Array;
4632
4641
  }
4633
- var ch = class {
4642
+ var dh = class {
4634
4643
  functions = /* @__PURE__ */ new Map();
4635
4644
  remoteFunctions = /* @__PURE__ */ new Map();
4636
4645
  pendingCalls = /* @__PURE__ */ new Map();
@@ -4652,7 +4661,7 @@ var ch = class {
4652
4661
  };
4653
4662
  }
4654
4663
  register(e, t) {
4655
- let n = th(e, t);
4664
+ let n = ih(e, t);
4656
4665
  return this.functions.set(e.name, n), this.isConnected && this.config && this.sendRegistration(n), () => this.unregister(e.name);
4657
4666
  }
4658
4667
  unregister(e) {
@@ -4693,7 +4702,7 @@ var ch = class {
4693
4702
  ParameterIndex: t,
4694
4703
  TypeName: n ? n.TypeName : this.inferTypeName(e),
4695
4704
  ValueJson: JSON.stringify(e ?? null),
4696
- ValueData: ah
4705
+ ValueData: ch
4697
4706
  });
4698
4707
  }), c = r?.instanceId ? n.fromString(r.instanceId) : n.createZero(), l = rr(Xn({
4699
4708
  FunctionId: n.fromString(i.id),
@@ -4706,8 +4715,8 @@ var ch = class {
4706
4715
  }), this.config.sessionId, { targetIds: [i.clientSessionId] });
4707
4716
  return new Promise((t, n) => {
4708
4717
  let r = setTimeout(() => {
4709
- this.pendingCalls.delete(o.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${oh}ms`));
4710
- }, oh);
4718
+ this.pendingCalls.delete(o.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${lh}ms`));
4719
+ }, lh);
4711
4720
  this.pendingCalls.set(o.toString(), {
4712
4721
  resolve: t,
4713
4722
  reject: n,
@@ -4774,7 +4783,7 @@ var ch = class {
4774
4783
  if (t === w.ACTION_FUNCTION_CALL) {
4775
4784
  let t = i(e);
4776
4785
  return this.handleFunctionCall(e, t.senderId).catch((e) => {
4777
- ih.error("Failed to handle function call:", e);
4786
+ sh.error("Failed to handle function call:", e);
4778
4787
  }), !0;
4779
4788
  }
4780
4789
  if (t === w.ACTION_FUNCTION_RESULT) return this.handleFunctionResult(e), !0;
@@ -4796,7 +4805,7 @@ var ch = class {
4796
4805
  handleFunctionResult(e) {
4797
4806
  let t = ra(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
4798
4807
  if (!r) {
4799
- ih.warn(`Received result for unknown call: ${n}`);
4808
+ sh.warn(`Received result for unknown call: ${n}`);
4800
4809
  return;
4801
4810
  }
4802
4811
  if (this.pendingCalls.delete(n), clearTimeout(r.timeout), t.ResultData && t.ResultData.length > 0 && !t.ResultJson) {
@@ -4809,11 +4818,11 @@ var ch = class {
4809
4818
  handleFunctionError(e) {
4810
4819
  let t = Gr(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
4811
4820
  if (!r) {
4812
- ih.warn(`Received error for unknown call: ${n}`);
4821
+ sh.warn(`Received error for unknown call: ${n}`);
4813
4822
  return;
4814
4823
  }
4815
4824
  this.pendingCalls.delete(n), clearTimeout(r.timeout);
4816
- let i = new rh(t.ErrorMessage, t.ErrorTypeName, t.StackTrace, t.ErrorCode), a = {
4825
+ let i = new oh(t.ErrorMessage, t.ErrorTypeName, t.StackTrace, t.ErrorCode), a = {
4817
4826
  functionName: r.functionName,
4818
4827
  args: r.args
4819
4828
  };
@@ -4849,7 +4858,7 @@ var ch = class {
4849
4858
  async handleFunctionCall(e, t) {
4850
4859
  let n = await ir(e), r = this.functions.get(n.FunctionName);
4851
4860
  if (!r) {
4852
- ih.warn(`Received call for unknown function: ${n.FunctionName}`), this.sendError(n.CallId, n.InstanceId, t, /* @__PURE__ */ Error(`Unknown function: ${n.FunctionName}`));
4861
+ sh.warn(`Received call for unknown function: ${n.FunctionName}`), this.sendError(n.CallId, n.InstanceId, t, /* @__PURE__ */ Error(`Unknown function: ${n.FunctionName}`));
4853
4862
  return;
4854
4863
  }
4855
4864
  this.sendAck(n.CallId, n.InstanceId, t), this.executeFunction(r, n, t);
@@ -4864,14 +4873,14 @@ var ch = class {
4864
4873
  continue;
4865
4874
  }
4866
4875
  let o = a?.ValueJson;
4867
- o === void 0 || o === "" ? i.hasDefaultValue ? r.push($m(i.defaultValueJson, i.descriptor)) : r.push(void 0) : r.push($m(o, i.descriptor));
4876
+ o === void 0 || o === "" ? i.hasDefaultValue ? r.push(nh(i.defaultValueJson, i.descriptor)) : r.push(void 0) : r.push(nh(o, i.descriptor));
4868
4877
  }
4869
- let i = await e.handler(...r), a = i, o = ah;
4870
- sh(i) && (a = i.value, o = new Uint8Array(i.data));
4871
- let s = eh(a, e.returnType);
4878
+ let i = await e.handler(...r), a = i, o = ch;
4879
+ uh(i) && (a = i.value, o = new Uint8Array(i.data));
4880
+ let s = rh(a, e.returnType);
4872
4881
  this.sendResult(t.CallId, t.InstanceId, n, e, s, o);
4873
4882
  } catch (e) {
4874
- ih.error(`Function ${t.FunctionName} execution failed:`, e), this.sendError(t.CallId, t.InstanceId, n, e instanceof Error ? e : Error(String(e)));
4883
+ sh.error(`Function ${t.FunctionName} execution failed:`, e), this.sendError(t.CallId, t.InstanceId, n, e instanceof Error ? e : Error(String(e)));
4875
4884
  }
4876
4885
  }
4877
4886
  sendAck(e, t, n) {
@@ -4887,7 +4896,7 @@ var ch = class {
4887
4896
  let o = na(Yi({
4888
4897
  CallId: e,
4889
4898
  InstanceId: t,
4890
- ResultTypeName: Qm(r.returnType),
4899
+ ResultTypeName: th(r.returnType),
4891
4900
  ResultJson: i,
4892
4901
  ResultData: a
4893
4902
  }), this.config.sessionId, { targetIds: [n] });
@@ -4904,7 +4913,7 @@ var ch = class {
4904
4913
  }), this.config.sessionId, { targetIds: [n] });
4905
4914
  this.config.sendProtocolMessage(i);
4906
4915
  }
4907
- }, lh = C("ReactiveRegistry"), uh = "Ikon.Reactive.Subscribe", dh = "Ikon.Reactive.Unsubscribe", fh = {
4916
+ }, fh = C("ReactiveRegistry"), ph = "Ikon.Reactive.Subscribe", mh = "Ikon.Reactive.Unsubscribe", hh = {
4908
4917
  name: "Ikon.Reactive.Update",
4909
4918
  description: "Receives reactive value updates pushed from the server when a subscribed reactive changes",
4910
4919
  returnType: { kind: "string" },
@@ -4922,7 +4931,7 @@ var ch = class {
4922
4931
  type: { kind: "string" }
4923
4932
  }
4924
4933
  ]
4925
- }, ph = class {
4934
+ }, gh = class {
4926
4935
  subscribersByKey = /* @__PURE__ */ new Map();
4927
4936
  functionRegistry;
4928
4937
  updateHandlerUnregister = null;
@@ -4930,9 +4939,9 @@ var ch = class {
4930
4939
  this.functionRegistry = e, this.registerUpdateHandler();
4931
4940
  }
4932
4941
  async subscribe(e, t, n) {
4933
- let r = n?.mount ?? "", i = mh(e, r), a = t, o = this.subscribersByKey.get(i), s = !o;
4942
+ let r = n?.mount ?? "", i = _h(e, r), a = t, o = this.subscribersByKey.get(i), s = !o;
4934
4943
  if (o || (o = /* @__PURE__ */ new Set(), this.subscribersByKey.set(i, o)), o.add(a), s) try {
4935
- t(hh(await this.functionRegistry.call(uh, [e, r])));
4944
+ t(vh(await this.functionRegistry.call(ph, [e, r])));
4936
4945
  } catch (e) {
4937
4946
  throw o.delete(a), o.size === 0 && this.subscribersByKey.delete(i), e;
4938
4947
  }
@@ -4944,46 +4953,46 @@ var ch = class {
4944
4953
  this.subscribersByKey.clear(), this.updateHandlerUnregister &&= (this.updateHandlerUnregister(), null);
4945
4954
  }
4946
4955
  unsubscribeOne(e, t, n) {
4947
- let r = mh(e, t), i = this.subscribersByKey.get(r);
4948
- i && (i.delete(n), !(i.size > 0) && (this.subscribersByKey.delete(r), this.functionRegistry.call(dh, [e, t]).catch((n) => {
4949
- lh.warn(`Failed to unsubscribe from '${e}' (mount='${t}'):`, n);
4956
+ let r = _h(e, t), i = this.subscribersByKey.get(r);
4957
+ i && (i.delete(n), !(i.size > 0) && (this.subscribersByKey.delete(r), this.functionRegistry.call(mh, [e, t]).catch((n) => {
4958
+ fh.warn(`Failed to unsubscribe from '${e}' (mount='${t}'):`, n);
4950
4959
  })));
4951
4960
  }
4952
4961
  registerUpdateHandler() {
4953
4962
  let e = (...e) => {
4954
- let t = e[0], n = e[1] ?? "", r = e[2], i = mh(t, n), a = this.subscribersByKey.get(i);
4963
+ let t = e[0], n = e[1] ?? "", r = e[2], i = _h(t, n), a = this.subscribersByKey.get(i);
4955
4964
  if (!a || a.size === 0) return "";
4956
- let o = hh(r);
4965
+ let o = vh(r);
4957
4966
  for (let e of a) try {
4958
4967
  e(o);
4959
4968
  } catch (e) {
4960
- lh.warn(`Reactive update callback for '${t}' (mount='${n}') threw:`, e);
4969
+ fh.warn(`Reactive update callback for '${t}' (mount='${n}') threw:`, e);
4961
4970
  }
4962
4971
  return "";
4963
4972
  };
4964
- this.updateHandlerUnregister = this.functionRegistry.register(fh, e);
4973
+ this.updateHandlerUnregister = this.functionRegistry.register(hh, e);
4965
4974
  }
4966
4975
  };
4967
- function mh(e, t) {
4976
+ function _h(e, t) {
4968
4977
  return t.length === 0 ? e : `${e}\0${t}`;
4969
4978
  }
4970
- function hh(e) {
4979
+ function vh(e) {
4971
4980
  if (e == null || e === "") return null;
4972
4981
  try {
4973
4982
  return JSON.parse(e);
4974
4983
  } catch (t) {
4975
- return lh.warn("Failed to parse reactive value JSON, returning raw string:", t), e;
4984
+ return fh.warn("Failed to parse reactive value JSON, returning raw string:", t), e;
4976
4985
  }
4977
4986
  }
4978
4987
  //#endregion
4979
4988
  //#region src/login/login-error-interceptor.ts
4980
- var gh = "login_required", _h = (e, t) => e.code === gh ? (fd({
4989
+ var yh = "login_required", bh = (e, t) => e.code === yh ? (fd({
4981
4990
  functionName: t.functionName,
4982
4991
  args: t.args
4983
4992
  }), ld(e.message), null) : null;
4984
4993
  //#endregion
4985
4994
  //#region src/media/device-detection.ts
4986
- function vh() {
4995
+ function xh() {
4987
4996
  if (typeof navigator > "u") return !1;
4988
4997
  let e = navigator.userAgentData;
4989
4998
  if (typeof e?.mobile == "boolean") return e.mobile;
@@ -4992,7 +5001,7 @@ function vh() {
4992
5001
  }
4993
5002
  //#endregion
4994
5003
  //#region src/functions/media-capture-functions.ts
4995
- function yh(e) {
5004
+ function Sh(e) {
4996
5005
  let t = e?.facingMode;
4997
5006
  if (typeof t == "string") return t === "user" || t === "environment" ? t : void 0;
4998
5007
  if (Array.isArray(t)) return t.find((e) => typeof e == "string" && (e === "user" || e === "environment")) ?? void 0;
@@ -5002,21 +5011,21 @@ function yh(e) {
5002
5011
  if (Array.isArray(e)) return e.find((e) => e === "user" || e === "environment") ?? void 0;
5003
5012
  }
5004
5013
  }
5005
- function bh(e) {
5014
+ function Ch(e) {
5006
5015
  if (!(typeof e != "string" || !e.trim())) try {
5007
5016
  return JSON.parse(e);
5008
5017
  } catch {
5009
5018
  return;
5010
5019
  }
5011
5020
  }
5012
- var xh = {
5021
+ var wh = {
5013
5022
  StartVideoCapture: "ikon.client.startVideoCapture",
5014
5023
  StartAudioCapture: "ikon.client.startAudioCapture",
5015
5024
  StopCapture: "ikon.client.stopCapture",
5016
5025
  CaptureImage: "ikon.client.captureImage",
5017
5026
  GetMediaDevices: "ikon.client.getMediaDevices"
5018
- }, Sh = {
5019
- name: xh.StartVideoCapture,
5027
+ }, Th = {
5028
+ name: wh.StartVideoCapture,
5020
5029
  description: "Start camera or screen capture and stream video frames to the server",
5021
5030
  returnType: { kind: "string" },
5022
5031
  parameters: [{
@@ -5034,8 +5043,8 @@ var xh = {
5034
5043
  },
5035
5044
  description: "JSON encoded capture options"
5036
5045
  }]
5037
- }, Ch = {
5038
- name: xh.StartAudioCapture,
5046
+ }, Eh = {
5047
+ name: wh.StartAudioCapture,
5039
5048
  description: "Start microphone capture and stream audio frames to the server",
5040
5049
  returnType: { kind: "string" },
5041
5050
  parameters: [{
@@ -5046,8 +5055,8 @@ var xh = {
5046
5055
  },
5047
5056
  description: "JSON encoded capture options"
5048
5057
  }]
5049
- }, wh = {
5050
- name: xh.StopCapture,
5058
+ }, Dh = {
5059
+ name: wh.StopCapture,
5051
5060
  description: "Stop a previously started capture by streamId",
5052
5061
  returnType: { kind: "boolean" },
5053
5062
  parameters: [{
@@ -5055,8 +5064,8 @@ var xh = {
5055
5064
  type: { kind: "string" },
5056
5065
  description: "Stream ID to stop"
5057
5066
  }]
5058
- }, Th = {
5059
- name: xh.CaptureImage,
5067
+ }, Oh = {
5068
+ name: wh.CaptureImage,
5060
5069
  description: "Capture a single image from the camera and return metadata (JSON) plus binary image data",
5061
5070
  returnType: { kind: "string" },
5062
5071
  parameters: [{
@@ -5067,24 +5076,24 @@ var xh = {
5067
5076
  },
5068
5077
  description: "JSON encoded capture options"
5069
5078
  }]
5070
- }, Eh = {
5071
- name: xh.GetMediaDevices,
5079
+ }, kh = {
5080
+ name: wh.GetMediaDevices,
5072
5081
  description: "Get list of available media input devices",
5073
5082
  returnType: { kind: "string" },
5074
5083
  parameters: []
5075
5084
  };
5076
- function Dh(e, t) {
5085
+ function Ah(e, t) {
5077
5086
  let n = [];
5078
- return n.push(e.register(Sh, async (e, n) => {
5087
+ return n.push(e.register(Th, async (e, n) => {
5079
5088
  if (t.isWebRtcCaptureAvailable) {
5080
5089
  let e = t.webRtcSignaling;
5081
5090
  if (!e) throw Error("WebRTC signaling is not connected");
5082
- let r = bh(n);
5091
+ let r = Ch(n);
5083
5092
  return await e.startVideoCapture(r?.constraints), "webrtc-video";
5084
5093
  }
5085
5094
  let r = await t.ensureMediaCapture();
5086
5095
  if (!r) throw Error("Media capture is not available in this environment");
5087
- let i = bh(n);
5096
+ let i = Ch(n);
5088
5097
  return ((typeof e == "string" && e.trim().toLowerCase() === "screen" ? "screen" : "camera") == "screen" ? await r.video.startScreen({
5089
5098
  userGesture: !1,
5090
5099
  options: i,
@@ -5094,22 +5103,22 @@ function Dh(e, t) {
5094
5103
  options: i,
5095
5104
  constraints: i?.constraints
5096
5105
  })).streamId;
5097
- })), n.push(e.register(Ch, async (e) => {
5106
+ })), n.push(e.register(Eh, async (e) => {
5098
5107
  if (t.isWebRtcCaptureAvailable) {
5099
5108
  let n = t.webRtcSignaling;
5100
5109
  if (!n) throw Error("WebRTC signaling is not connected");
5101
- let r = bh(e);
5110
+ let r = Ch(e);
5102
5111
  return await n.startAudioCapture(r?.constraints), "webrtc-audio";
5103
5112
  }
5104
5113
  let n = await t.ensureMediaCapture();
5105
5114
  if (!n) throw Error("Media capture is not available in this environment");
5106
- let r = bh(e);
5115
+ let r = Ch(e);
5107
5116
  return (await n.audio.startMic({
5108
5117
  userGesture: !1,
5109
5118
  options: r,
5110
5119
  constraints: r?.constraints
5111
5120
  })).streamId;
5112
- })), n.push(e.register(wh, async (e) => {
5121
+ })), n.push(e.register(Dh, async (e) => {
5113
5122
  if (t.isWebRtcCaptureAvailable) {
5114
5123
  let e = t.webRtcSignaling;
5115
5124
  return e && await e.stopCapture(), !0;
@@ -5118,20 +5127,20 @@ function Dh(e, t) {
5118
5127
  if (!n || typeof e != "string" || !e.trim()) return !1;
5119
5128
  let r = await n.video.stop(e), i = await n.audio.stop(e);
5120
5129
  return r || i;
5121
- })), n.push(e.register(Th, async (e) => {
5130
+ })), n.push(e.register(Oh, async (e) => {
5122
5131
  let n = await t.ensureMediaCapture();
5123
5132
  if (!n) throw Error("Media capture is not available in this environment");
5124
- let r = bh(e) ?? {};
5125
- if (r.mode === "native" && vh()) {
5133
+ let r = Ch(e) ?? {};
5134
+ if (r.mode === "native" && xh()) {
5126
5135
  let e = await n.image.captureFromNativeCamera({
5127
- facing: yh(r.constraints),
5136
+ facing: Sh(r.constraints),
5128
5137
  mime: r.mime,
5129
5138
  quality: r.quality,
5130
5139
  width: r.width,
5131
5140
  height: r.height
5132
5141
  });
5133
5142
  if (!e) throw Error("Native camera capture was cancelled");
5134
- return nh(JSON.stringify({
5143
+ return ah(JSON.stringify({
5135
5144
  mime: e.mime,
5136
5145
  width: e.width,
5137
5146
  height: e.height
@@ -5152,12 +5161,12 @@ function Dh(e, t) {
5152
5161
  quality: r.quality,
5153
5162
  width: r.width,
5154
5163
  height: r.height
5155
- }), nh(JSON.stringify({
5164
+ }), ah(JSON.stringify({
5156
5165
  mime: a.mime,
5157
5166
  width: a.width,
5158
5167
  height: a.height
5159
5168
  }), a.data);
5160
- })), n.push(e.register(Eh, async () => {
5169
+ })), n.push(e.register(kh, async () => {
5161
5170
  if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) return JSON.stringify([]);
5162
5171
  let e = (await navigator.mediaDevices.enumerateDevices()).filter((e) => e.kind === "audioinput" || e.kind === "videoinput").map((e) => ({
5163
5172
  deviceId: e.deviceId,
@@ -5172,45 +5181,45 @@ function Dh(e, t) {
5172
5181
  }
5173
5182
  //#endregion
5174
5183
  //#region src/functions/sound-functions.ts
5175
- var Oh = {
5184
+ var jh = {
5176
5185
  PlaySound: "ikon.client.playSound",
5177
5186
  StopSound: "ikon.client.stopSound"
5178
- }, kh = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), Ah = 1, jh = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", Mh = 8, Nh = [], Ph = !1, q = null;
5179
- function Fh() {
5180
- if (!(Nh.length > 0 || typeof Audio > "u")) for (let e = 0; e < Mh; e++) {
5187
+ }, Mh = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), Nh = 1, Ph = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", Fh = 8, Ih = [], Lh = !1, q = null;
5188
+ function Rh() {
5189
+ if (!(Ih.length > 0 || typeof Audio > "u")) for (let e = 0; e < Fh; e++) {
5181
5190
  let e = new Audio();
5182
- e.preload = "auto", Nh.push(e);
5191
+ e.preload = "auto", Ih.push(e);
5183
5192
  }
5184
5193
  }
5185
- function Ih() {
5186
- if (!Ph) {
5187
- Fh();
5188
- for (let e of Nh) try {
5189
- e.src = jh;
5194
+ function zh() {
5195
+ if (!Lh) {
5196
+ Rh();
5197
+ for (let e of Ih) try {
5198
+ e.src = Ph;
5190
5199
  let t = e.play();
5191
5200
  typeof t?.then == "function" ? t.then(() => {
5192
- e.pause(), e.currentTime = 0, Ph = !0, Rh();
5193
- }, () => {}) : Ph = !0;
5201
+ e.pause(), e.currentTime = 0, Lh = !0, Vh();
5202
+ }, () => {}) : Lh = !0;
5194
5203
  } catch {}
5195
- Ph && Rh();
5204
+ Lh && Vh();
5196
5205
  }
5197
5206
  }
5198
- function Lh() {
5207
+ function Bh() {
5199
5208
  if (q || typeof window > "u") return;
5200
- let e = () => Ih();
5209
+ let e = () => zh();
5201
5210
  q = e, window.addEventListener("pointerdown", e, { capture: !0 }), window.addEventListener("touchend", e, { capture: !0 }), window.addEventListener("mousedown", e, { capture: !0 }), window.addEventListener("keydown", e, { capture: !0 });
5202
5211
  }
5203
- function Rh() {
5212
+ function Vh() {
5204
5213
  !q || typeof window > "u" || (window.removeEventListener("pointerdown", q, { capture: !0 }), window.removeEventListener("touchend", q, { capture: !0 }), window.removeEventListener("mousedown", q, { capture: !0 }), window.removeEventListener("keydown", q, { capture: !0 }), q = null);
5205
5214
  }
5206
- function zh() {
5207
- Fh();
5208
- for (let e of Nh) if (e.paused || e.ended) return e;
5215
+ function Hh() {
5216
+ Rh();
5217
+ for (let e of Ih) if (e.paused || e.ended) return e;
5209
5218
  let e = new Audio();
5210
- return e.preload = "auto", Nh.push(e), e;
5219
+ return e.preload = "auto", Ih.push(e), e;
5211
5220
  }
5212
- var Bh = {
5213
- name: Oh.PlaySound,
5221
+ var Uh = {
5222
+ name: jh.PlaySound,
5214
5223
  description: "Play a sound effect",
5215
5224
  returnType: {
5216
5225
  kind: "string",
@@ -5248,19 +5257,19 @@ var Bh = {
5248
5257
  }
5249
5258
  ]
5250
5259
  };
5251
- function Vh(e, t, n, r) {
5260
+ function Wh(e, t, n, r) {
5252
5261
  if (typeof window > "u" || typeof Audio > "u" || typeof e != "string" || !e.trim()) return Promise.resolve(null);
5253
5262
  let i = e;
5254
- if (typeof t == "string" && t && kh.set(t, e), e.startsWith("sound:")) {
5255
- let t = e.slice(6), n = kh.get(t);
5263
+ if (typeof t == "string" && t && Mh.set(t, e), e.startsWith("sound:")) {
5264
+ let t = e.slice(6), n = Mh.get(t);
5256
5265
  if (!n) return Promise.resolve(null);
5257
5266
  i = n;
5258
5267
  }
5259
5268
  return new Promise((e) => {
5260
5269
  try {
5261
- let t = zh();
5270
+ let t = Hh();
5262
5271
  t.src = i, t.currentTime = 0, t.loop = r === !0, t.volume = typeof n == "number" ? Math.max(0, Math.min(1, n)) : 1;
5263
- let a = `sound-${Ah++}`, o = () => {
5272
+ let a = `sound-${Nh++}`, o = () => {
5264
5273
  K.delete(a), t.removeEventListener("ended", o), t.removeEventListener("error", o);
5265
5274
  };
5266
5275
  t.addEventListener("ended", o), t.addEventListener("error", o), K.set(a, t), t.play().then(() => e(a), () => {
@@ -5271,8 +5280,8 @@ function Vh(e, t, n, r) {
5271
5280
  }
5272
5281
  });
5273
5282
  }
5274
- var Hh = {
5275
- name: Oh.StopSound,
5283
+ var Gh = {
5284
+ name: jh.StopSound,
5276
5285
  description: "Stop a playing sound by ID",
5277
5286
  returnType: { kind: "boolean" },
5278
5287
  parameters: [{
@@ -5281,7 +5290,7 @@ var Hh = {
5281
5290
  description: "Playback ID from playSound"
5282
5291
  }]
5283
5292
  };
5284
- function Uh(e) {
5293
+ function Kh(e) {
5285
5294
  if (typeof e != "string") return !1;
5286
5295
  let t = K.get(e);
5287
5296
  if (!t) return !1;
@@ -5291,33 +5300,33 @@ function Uh(e) {
5291
5300
  return !1;
5292
5301
  }
5293
5302
  }
5294
- function Wh() {
5295
- kh.clear();
5303
+ function qh() {
5304
+ Mh.clear();
5296
5305
  for (let [e, t] of K) {
5297
5306
  try {
5298
5307
  t.pause(), t.currentTime = 0;
5299
5308
  } catch {}
5300
5309
  K.delete(e);
5301
5310
  }
5302
- Rh();
5311
+ Vh();
5303
5312
  }
5304
- var Gh = [{
5305
- definition: Bh,
5306
- handler: Vh
5313
+ var Jh = [{
5314
+ definition: Uh,
5315
+ handler: Wh
5307
5316
  }, {
5308
- definition: Hh,
5309
- handler: Uh
5317
+ definition: Gh,
5318
+ handler: Kh
5310
5319
  }];
5311
- function Kh(e) {
5312
- Lh();
5313
- let t = Gh.map(({ definition: t, handler: n }) => e.register(t, n));
5320
+ function Yh(e) {
5321
+ Bh();
5322
+ let t = Jh.map(({ definition: t, handler: n }) => e.register(t, n));
5314
5323
  return () => {
5315
- t.forEach((e) => e()), Wh();
5324
+ t.forEach((e) => e()), qh();
5316
5325
  };
5317
5326
  }
5318
5327
  //#endregion
5319
5328
  //#region src/worker/viseme-worker.ts?worker
5320
- function qh(e) {
5329
+ function Xh(e) {
5321
5330
  return new Worker("" + new URL("assets/viseme-worker-TOrhAq2M.js", import.meta.url).href, {
5322
5331
  type: "module",
5323
5332
  name: e?.name
@@ -5325,7 +5334,7 @@ function qh(e) {
5325
5334
  }
5326
5335
  //#endregion
5327
5336
  //#region src/media/viseme-tracker.ts
5328
- var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5337
+ var Zh = C("VisemeTracker"), Qh = _e * 2, $h = class e {
5329
5338
  static MAX_WORKER_REBUILD_ATTEMPTS = 3;
5330
5339
  client;
5331
5340
  worker = null;
@@ -5345,16 +5354,16 @@ var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5345
5354
  enable() {
5346
5355
  if (this.worker) return;
5347
5356
  if (typeof Worker > "u") {
5348
- Jh.warn("Viseme worker unavailable (Workers not supported)");
5357
+ Zh.warn("Viseme worker unavailable (Workers not supported)");
5349
5358
  return;
5350
5359
  }
5351
5360
  let t = this.client.createProtocolMessagePort({ opcodeGroupsMask: w.GROUP_AUDIO });
5352
5361
  if (!t) return;
5353
5362
  this.protocolPort = t;
5354
5363
  try {
5355
- this.worker = new qh();
5364
+ this.worker = new Xh();
5356
5365
  } catch (e) {
5357
- Jh.warn(`Failed to create viseme worker: ${e}`), this.protocolPort.close(), this.protocolPort = null;
5366
+ Zh.warn(`Failed to create viseme worker: ${e}`), this.protocolPort.close(), this.protocolPort = null;
5358
5367
  return;
5359
5368
  }
5360
5369
  let n = this.worker;
@@ -5365,7 +5374,7 @@ var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5365
5374
  t.lineno,
5366
5375
  t.colno
5367
5376
  ].filter((e) => e != null && String(e).length > 0);
5368
- Jh.error(`Viseme worker failed: ${n.join(" ")}`.trim()), this.dispose(), this.workerRebuildAttempts < e.MAX_WORKER_REBUILD_ATTEMPTS ? (this.workerRebuildAttempts++, this.enable()) : Jh.error("Viseme worker crashed repeatedly, giving up on rebuilds");
5377
+ Zh.error(`Viseme worker failed: ${n.join(" ")}`.trim()), this.dispose(), this.workerRebuildAttempts < e.MAX_WORKER_REBUILD_ATTEMPTS ? (this.workerRebuildAttempts++, this.enable()) : Zh.error("Viseme worker crashed repeatedly, giving up on rebuilds");
5369
5378
  }), n.postMessage({
5370
5379
  type: "attachProtocolPort",
5371
5380
  port: t.port
@@ -5420,7 +5429,7 @@ var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5420
5429
  if (!t.timingEstablished || t.count === 0) continue;
5421
5430
  let n = e - t.playbackStartTime;
5422
5431
  if (n < 0) continue;
5423
- let r = n * Yh, i = t.frames, a = t.count, o = (t.head - a + x) % x, s = null, c = null;
5432
+ let r = n * Qh, i = t.frames, a = t.count, o = (t.head - a + x) % x, s = null, c = null;
5424
5433
  for (let e = 0; e < a; e++) {
5425
5434
  let t = i[(o + e) % x], n = t.samplePosition + Math.max(t.frameSamples, 1);
5426
5435
  if (t.samplePosition <= r && (s = t), n > r && !c && (c = t, t.samplePosition <= r)) break;
@@ -5494,35 +5503,35 @@ var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5494
5503
  }
5495
5504
  }
5496
5505
  }
5497
- }, Zh = C("DebugMode"), J = !1;
5498
- function Qh() {
5499
- return J ? !0 : (J = au(), J && (ye(S.DEBUG), Zh.info("Debug mode enabled")), J);
5506
+ }, eg = C("DebugMode"), J = !1;
5507
+ function tg() {
5508
+ return J ? !0 : (J = au(), J && (ye(S.DEBUG), eg.info("Debug mode enabled")), J);
5500
5509
  }
5501
- function $h() {
5510
+ function ng() {
5502
5511
  return J;
5503
5512
  }
5504
- function eg() {
5505
- J || (J = !0, ye(S.DEBUG), Zh.info("Debug mode enabled"), tu(Vl, "true"));
5513
+ function rg() {
5514
+ J || (J = !0, ye(S.DEBUG), eg.info("Debug mode enabled"), tu(Vl, "true"));
5506
5515
  }
5507
5516
  //#endregion
5508
5517
  //#region src/utils/inspect-mode.ts
5509
- var tg = "ikon-inspect-mode-changed", Y = !1;
5510
- function ng() {
5511
- typeof window < "u" && window.dispatchEvent(new Event(tg));
5518
+ var ig = "ikon-inspect-mode-changed", Y = !1;
5519
+ function ag() {
5520
+ typeof window < "u" && window.dispatchEvent(new Event(ig));
5512
5521
  }
5513
- function rg() {
5522
+ function og() {
5514
5523
  let e = fu();
5515
- return e !== Y && (Y = e, ng()), Y;
5524
+ return e !== Y && (Y = e, ag()), Y;
5516
5525
  }
5517
- function ig() {
5526
+ function sg() {
5518
5527
  return Y;
5519
5528
  }
5520
- function ag() {
5521
- Y || (Y = !0, tu(Jl, "true"), ng());
5529
+ function cg() {
5530
+ Y || (Y = !0, tu(Jl, "true"), ag());
5522
5531
  }
5523
5532
  //#endregion
5524
5533
  //#region src/utils/external-link.ts
5525
- var og = /* @__PURE__ */ new Set([
5534
+ var lg = /* @__PURE__ */ new Set([
5526
5535
  "http",
5527
5536
  "https",
5528
5537
  "file",
@@ -5539,12 +5548,12 @@ var og = /* @__PURE__ */ new Set([
5539
5548
  "edge",
5540
5549
  "moz-extension",
5541
5550
  "safari-web-extension"
5542
- ]), sg = /^([a-z][a-z0-9+.-]*):/i;
5543
- function cg(e) {
5544
- let t = sg.exec(e.trim());
5545
- return t ? !og.has(t[1].toLowerCase()) : !1;
5551
+ ]), ug = /^([a-z][a-z0-9+.-]*):/i;
5552
+ function dg(e) {
5553
+ let t = ug.exec(e.trim());
5554
+ return t ? !lg.has(t[1].toLowerCase()) : !1;
5546
5555
  }
5547
- function lg(e) {
5556
+ function fg(e) {
5548
5557
  if (typeof document > "u") return;
5549
5558
  let t = document.createElement("iframe");
5550
5559
  t.setAttribute("aria-hidden", "true"), t.style.display = "none", document.body.appendChild(t);
@@ -5558,7 +5567,7 @@ function lg(e) {
5558
5567
  }
5559
5568
  //#endregion
5560
5569
  //#region src/utils/browser-support.ts
5561
- var ug = [
5570
+ var pg = [
5562
5571
  {
5563
5572
  name: "WebSocket",
5564
5573
  isPresent: () => typeof WebSocket < "u"
@@ -5580,9 +5589,9 @@ var ug = [
5580
5589
  isPresent: () => typeof Promise < "u" && typeof Promise.allSettled == "function"
5581
5590
  }
5582
5591
  ];
5583
- function dg() {
5592
+ function mg() {
5584
5593
  let e = [];
5585
- for (let t of ug) {
5594
+ for (let t of pg) {
5586
5595
  let n;
5587
5596
  try {
5588
5597
  n = t.isPresent();
@@ -5598,22 +5607,22 @@ function dg() {
5598
5607
  }
5599
5608
  //#endregion
5600
5609
  //#region src/transport/transport-probe.ts
5601
- var fg = C("TransportProbe"), pg = 3e3;
5602
- async function mg(e, t, n) {
5603
- let r = n?.timeoutMs ?? pg, i = n?.signal;
5610
+ var hg = C("TransportProbe"), gg = 3e3;
5611
+ async function _g(e, t, n) {
5612
+ let r = n?.timeoutMs ?? gg, i = n?.signal;
5604
5613
  if (i?.aborted) return !1;
5605
5614
  let a = Date.now();
5606
5615
  try {
5607
- let n = hg(e) ? await _g(t, r, i) : await gg(t, r, i);
5608
- return fg.debug(`Probe ${b[e]} ${t}: ${n ? "reachable" : "unreachable"} in ${Date.now() - a}ms`), n;
5616
+ let n = vg(e) ? await bg(t, r, i) : await yg(t, r, i);
5617
+ return hg.debug(`Probe ${b[e]} ${t}: ${n ? "reachable" : "unreachable"} in ${Date.now() - a}ms`), n;
5609
5618
  } catch (n) {
5610
- return fg.debug(`Probe ${b[e]} ${t} failed after ${Date.now() - a}ms: ${n instanceof Error ? n.message : n}`), !1;
5619
+ return hg.debug(`Probe ${b[e]} ${t} failed after ${Date.now() - a}ms: ${n instanceof Error ? n.message : n}`), !1;
5611
5620
  }
5612
5621
  }
5613
- function hg(e) {
5622
+ function vg(e) {
5614
5623
  return e === b.WebTransport || e === b.WebTransportProxy;
5615
5624
  }
5616
- function gg(e, t, n) {
5625
+ function yg(e, t, n) {
5617
5626
  return typeof WebSocket > "u" ? Promise.resolve(!1) : new Promise((r) => {
5618
5627
  let i = new WebSocket(e), a = !1, o = (e) => {
5619
5628
  if (!a) {
@@ -5627,7 +5636,7 @@ function gg(e, t, n) {
5627
5636
  n?.addEventListener("abort", s, { once: !0 }), i.onopen = () => o(!0), i.onerror = () => o(!1), i.onclose = () => o(!1);
5628
5637
  });
5629
5638
  }
5630
- async function _g(e, t, n) {
5639
+ async function bg(e, t, n) {
5631
5640
  if (!wu()) return !1;
5632
5641
  let r = new WebTransport(e), i;
5633
5642
  try {
@@ -5646,7 +5655,7 @@ async function _g(e, t, n) {
5646
5655
  }
5647
5656
  //#endregion
5648
5657
  //#region src/worker/protocol-worker.ts?worker
5649
- function vg(e) {
5658
+ function xg(e) {
5650
5659
  return new Worker("" + new URL("assets/protocol-worker-sC4mqNcM.js", import.meta.url).href, {
5651
5660
  type: "module",
5652
5661
  name: e?.name
@@ -5654,12 +5663,12 @@ function vg(e) {
5654
5663
  }
5655
5664
  //#endregion
5656
5665
  //#region src/client/endpoint-selector.ts
5657
- var yg = {
5666
+ var Sg = {
5658
5667
  [b.WebTransport]: 0,
5659
5668
  [b.WebSocket]: 1,
5660
5669
  [b.WebTransportProxy]: 2,
5661
5670
  [b.WebSocketProxy]: 3
5662
- }, bg = /* @__PURE__ */ new Set([b.WebTransportProxy, b.WebSocketProxy]), xg = /* @__PURE__ */ new Set([b.WebTransport, b.WebSocket]), Sg = /* @__PURE__ */ new Set([b.WebSocket, b.WebSocketProxy]), Cg = /* @__PURE__ */ new Set([b.WebTransport, b.WebTransportProxy]), X = C("EndpointSelector"), wg = "ikon-endpoint-type", Tg = "ikon-proxy-preferred", Eg = "ikon-endpoint-timestamp", Dg = "ikon-endpoint-revalidated", Og = 864e5, kg = class {
5671
+ }, Cg = /* @__PURE__ */ new Set([b.WebTransportProxy, b.WebSocketProxy]), wg = /* @__PURE__ */ new Set([b.WebTransport, b.WebSocket]), Tg = /* @__PURE__ */ new Set([b.WebSocket, b.WebSocketProxy]), Eg = /* @__PURE__ */ new Set([b.WebTransport, b.WebTransportProxy]), X = C("EndpointSelector"), Dg = "ikon-endpoint-type", Og = "ikon-proxy-preferred", kg = "ikon-endpoint-timestamp", Ag = "ikon-endpoint-revalidated", jg = 864e5, Mg = class {
5663
5672
  isLocal;
5664
5673
  _proxyMode;
5665
5674
  _websocket;
@@ -5681,27 +5690,27 @@ var yg = {
5681
5690
  markProxyPreferred() {
5682
5691
  this._proxyPreferred = !0;
5683
5692
  try {
5684
- localStorage.setItem(Tg, "true"), localStorage.setItem(Eg, String(Date.now()));
5693
+ localStorage.setItem(Og, "true"), localStorage.setItem(kg, String(Date.now()));
5685
5694
  } catch {}
5686
5695
  X.debug("Marked proxy as preferred");
5687
5696
  }
5688
5697
  clearProxyPreference() {
5689
5698
  this._proxyPreferred = !1;
5690
5699
  try {
5691
- localStorage.removeItem(Tg);
5700
+ localStorage.removeItem(Og);
5692
5701
  } catch {}
5693
5702
  }
5694
5703
  getOrderedTypes(e) {
5695
5704
  let t = Array.from(e.keys());
5696
5705
  if (this.isLocal) return t;
5697
5706
  let n;
5698
- n = this._proxyMode === "force-proxy" ? t.filter((e) => bg.has(e)) : this._proxyMode === "force-direct" ? t.filter((e) => xg.has(e)) : t, n = this.filterByTransport(n);
5699
- let r = [...n].sort((e, t) => (yg[e] ?? 999) - (yg[t] ?? 999));
5707
+ n = this._proxyMode === "force-proxy" ? t.filter((e) => Cg.has(e)) : this._proxyMode === "force-direct" ? t.filter((e) => wg.has(e)) : t, n = this.filterByTransport(n);
5708
+ let r = [...n].sort((e, t) => (Sg[e] ?? 999) - (Sg[t] ?? 999));
5700
5709
  if (this._proxyMode === "auto" && this._proxyPreferred) {
5701
- let e = r.filter((e) => bg.has(e)), t = r.filter((e) => xg.has(e));
5710
+ let e = r.filter((e) => Cg.has(e)), t = r.filter((e) => wg.has(e));
5702
5711
  r.length = 0, r.push(...e, ...t);
5703
5712
  }
5704
- if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this._proxyPreferred || bg.has(this.workingEndpointType))) {
5713
+ if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this._proxyPreferred || Cg.has(this.workingEndpointType))) {
5705
5714
  let e = r.indexOf(this.workingEndpointType);
5706
5715
  e > 0 && (r.splice(e, 1), r.unshift(this.workingEndpointType));
5707
5716
  }
@@ -5715,17 +5724,17 @@ var yg = {
5715
5724
  }
5716
5725
  this.workingEndpointType = e;
5717
5726
  try {
5718
- localStorage.setItem(wg, String(e)), localStorage.setItem(Eg, String(Date.now())), localStorage.getItem(Dg) === null && localStorage.setItem(Dg, String(Date.now()));
5727
+ localStorage.setItem(Dg, String(e)), localStorage.setItem(kg, String(Date.now())), localStorage.getItem(Ag) === null && localStorage.setItem(Ag, String(Date.now()));
5719
5728
  } catch {}
5720
- if (bg.has(e)) {
5729
+ if (Cg.has(e)) {
5721
5730
  this._proxyPreferred = !0;
5722
5731
  try {
5723
- localStorage.setItem(Tg, "true");
5732
+ localStorage.setItem(Og, "true");
5724
5733
  } catch {}
5725
- } else if (xg.has(e)) {
5734
+ } else if (wg.has(e)) {
5726
5735
  this._proxyPreferred = !1;
5727
5736
  try {
5728
- localStorage.removeItem(Tg);
5737
+ localStorage.removeItem(Og);
5729
5738
  } catch {}
5730
5739
  }
5731
5740
  X.debug(`Remembered working type: ${b[e]}`);
@@ -5734,37 +5743,37 @@ var yg = {
5734
5743
  clearRememberedType() {
5735
5744
  this.workingEndpointType = null;
5736
5745
  try {
5737
- localStorage.removeItem(wg);
5746
+ localStorage.removeItem(Dg);
5738
5747
  } catch {}
5739
5748
  }
5740
5749
  needsRevalidation() {
5741
5750
  if (this.isLocal || this._proxyMode !== "auto" || this.workingEndpointType === null && !this._proxyPreferred) return !1;
5742
5751
  let e = this.revalidationAgeMs();
5743
- return e !== null && e > Og;
5752
+ return e !== null && e > jg;
5744
5753
  }
5745
5754
  getFasterTypes(e, t) {
5746
- let n = yg[e] ?? 999;
5747
- return this.filterByTransport(Array.from(t.keys())).filter((e) => (yg[e] ?? 999) < n).sort((e, t) => (yg[e] ?? 999) - (yg[t] ?? 999));
5755
+ let n = Sg[e] ?? 999;
5756
+ return this.filterByTransport(Array.from(t.keys())).filter((e) => (Sg[e] ?? 999) < n).sort((e, t) => (Sg[e] ?? 999) - (Sg[t] ?? 999));
5748
5757
  }
5749
5758
  recordFasterTypeReachable(e) {
5750
5759
  X.debug(`Faster endpoint type ${b[e]} is reachable again, dropping learned preference`), this.clearRememberedType(), this.clearProxyPreference();
5751
5760
  try {
5752
- localStorage.removeItem(Eg), localStorage.removeItem(Dg);
5761
+ localStorage.removeItem(kg), localStorage.removeItem(Ag);
5753
5762
  } catch {}
5754
5763
  }
5755
5764
  recordFasterTypesUnreachable() {
5756
5765
  try {
5757
- localStorage.setItem(Dg, String(Date.now()));
5766
+ localStorage.setItem(Ag, String(Date.now()));
5758
5767
  } catch {}
5759
5768
  X.debug("Faster endpoint types still unreachable, keeping the learned preference");
5760
5769
  }
5761
5770
  filterByTransport(e) {
5762
5771
  let t = this._websocket, n = this._webtransport;
5763
- return t === void 0 && n === void 0 || t === !0 && n === !0 ? e : e.filter((e) => t === !0 && n === void 0 ? Sg.has(e) : n === !0 && t === void 0 ? Cg.has(e) : t === !1 ? !Sg.has(e) : n !== !1 || !Cg.has(e));
5772
+ return t === void 0 && n === void 0 || t === !0 && n === !0 ? e : e.filter((e) => t === !0 && n === void 0 ? Tg.has(e) : n === !0 && t === void 0 ? Eg.has(e) : t === !1 ? !Tg.has(e) : n !== !1 || !Eg.has(e));
5764
5773
  }
5765
5774
  revalidationAgeMs() {
5766
5775
  try {
5767
- let e = localStorage.getItem(Dg);
5776
+ let e = localStorage.getItem(Ag);
5768
5777
  if (e === null) return null;
5769
5778
  let t = Date.now() - Number(e);
5770
5779
  return Number.isFinite(t) ? t : null;
@@ -5774,12 +5783,12 @@ var yg = {
5774
5783
  }
5775
5784
  loadRememberedType() {
5776
5785
  try {
5777
- let e = localStorage.getItem(wg);
5786
+ let e = localStorage.getItem(Dg);
5778
5787
  if (e !== null) {
5779
5788
  let t = Number(e);
5780
5789
  if (b[t] !== void 0) {
5781
5790
  this.workingEndpointType = t;
5782
- let e = localStorage.getItem(Eg), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
5791
+ let e = localStorage.getItem(kg), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
5783
5792
  X.debug(`Loaded remembered type: ${b[t]} (age: ${n}h)`);
5784
5793
  }
5785
5794
  }
@@ -5787,14 +5796,14 @@ var yg = {
5787
5796
  }
5788
5797
  loadProxyPreference() {
5789
5798
  try {
5790
- this._proxyPreferred = localStorage.getItem(Tg) === "true", this._proxyPreferred && X.debug("Loaded proxy preference: preferred");
5799
+ this._proxyPreferred = localStorage.getItem(Og) === "true", this._proxyPreferred && X.debug("Loaded proxy preference: preferred");
5791
5800
  } catch {}
5792
5801
  }
5793
- }, Z = C("IkonClient"), Ag = [1e4, 3e4];
5794
- function jg() {
5802
+ }, Z = C("IkonClient"), Ng = [1e4, 3e4];
5803
+ function Pg() {
5795
5804
  return typeof __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__ < "u" && __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__;
5796
5805
  }
5797
- var Mg = class {
5806
+ var Fg = class {
5798
5807
  channelManager = null;
5799
5808
  protocolWorker = null;
5800
5809
  preloadedWorker = null;
@@ -5874,7 +5883,7 @@ var Mg = class {
5874
5883
  _reconnectTimer = null;
5875
5884
  _serverStopped = !1;
5876
5885
  _hasBeenConnected = !1;
5877
- _waitForExternalConnectUrl = jg();
5886
+ _waitForExternalConnectUrl = Pg();
5878
5887
  _externalConnectUrlCleanup = null;
5879
5888
  get media() {
5880
5889
  return this._media;
@@ -5891,7 +5900,7 @@ var Mg = class {
5891
5900
  return this._mediaCapture;
5892
5901
  }
5893
5902
  async ensureMediaCapture() {
5894
- return this._mediaCapture ? this._mediaCapture : R() ? (this._mediaCapturePromise ||= Promise.resolve().then(() => f_).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture)), this._mediaCapturePromise) : null;
5903
+ return this._mediaCapture ? this._mediaCapture : R() ? (this._mediaCapturePromise ||= Promise.resolve().then(() => h_).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture)), this._mediaCapturePromise) : null;
5895
5904
  }
5896
5905
  async ensureMedia() {
5897
5906
  return this._media ? this._media : (this._mediaPromise ||= import("./ikon-media--ap3vpXf.js").then((e) => e.n).then(({ IkonMedia: e }) => (this._media = new e(this, this._mediaConfig), this._media)), this._mediaPromise);
@@ -5937,14 +5946,14 @@ var Mg = class {
5937
5946
  ].filter(Boolean).length;
5938
5947
  if (t === 0) throw Error("IkonClient requires one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
5939
5948
  if (t > 1) throw Error("IkonClient accepts only one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
5940
- Qh(), R() && gf();
5949
+ tg(), R() && yf();
5941
5950
  let n = e.local ? null : nu() ?? e.proxy ?? null, r = n === !0 ? "force-proxy" : n === !1 ? "force-direct" : "auto", i = e.local ? null : ru(), a = e.local ? null : iu(), o = i ?? e.websocket, s = a ?? e.webtransport ?? !1;
5942
- this.endpointSelector = new kg({
5951
+ this.endpointSelector = new Mg({
5943
5952
  local: e.local,
5944
5953
  proxyMode: r,
5945
5954
  websocket: o,
5946
5955
  webtransport: s
5947
- }), r === "auto" ? this.endpointSelector.proxyPreferred && Z.debug("Proxy preferred (from previous session)") : Z.debug(`Proxy mode: ${r}`), (o !== void 0 || s !== void 0) && Z.debug(`Transport filter: websocket=${o ?? "auto"}, webtransport=${s ?? "auto"}`), this._functionRegistry = new ch(), this._reactiveRegistry = new ph(this._functionRegistry), R() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = Ep(this._functionRegistry), this.unregisterSoundFunctions = Kh(this._functionRegistry)), R() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(_h));
5956
+ }), r === "auto" ? this.endpointSelector.proxyPreferred && Z.debug("Proxy preferred (from previous session)") : Z.debug(`Proxy mode: ${r}`), (o !== void 0 || s !== void 0) && Z.debug(`Transport filter: websocket=${o ?? "auto"}, webtransport=${s ?? "auto"}`), this._functionRegistry = new dh(), this._reactiveRegistry = new gh(this._functionRegistry), R() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = kp(this._functionRegistry), this.unregisterSoundFunctions = Yh(this._functionRegistry)), R() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(bh));
5948
5957
  let c = cu(), l = lu();
5949
5958
  this._audioEnabled = c ?? e.audio?.enabled ?? !0, this._videoEnabled = l ?? e.video?.enabled ?? !0;
5950
5959
  let u = e.audio ? {
@@ -5956,7 +5965,7 @@ var Mg = class {
5956
5965
  audio: u,
5957
5966
  video: d,
5958
5967
  mediaSession: e.mediaSession
5959
- }, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, R() && (this.unregisterMediaCaptureFunctions = Dh(this._functionRegistry, this));
5968
+ }, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, R() && (this.unregisterMediaCaptureFunctions = Ah(this._functionRegistry, this));
5960
5969
  }
5961
5970
  _lastError = void 0;
5962
5971
  get lastError() {
@@ -6009,7 +6018,7 @@ var Mg = class {
6009
6018
  async connect() {
6010
6019
  if (this._connectStarted) throw Error(`Cannot connect: already started (state: ${this.currentState})`);
6011
6020
  this._connectStarted = !0;
6012
- let e = dg();
6021
+ let e = mg();
6013
6022
  if (!e.supported) {
6014
6023
  this.setErrorState(new Il(e.missingFeatures));
6015
6024
  return;
@@ -6028,17 +6037,17 @@ var Mg = class {
6028
6037
  }
6029
6038
  async executeConnection(e) {
6030
6039
  if (this._lastError = void 0, this.abortController = new AbortController(), typeof Worker < "u" && !this.preloadedWorker) try {
6031
- this.preloadedWorker = new vg();
6040
+ this.preloadedWorker = new xg();
6032
6041
  } catch {}
6033
6042
  this.setState("connecting"), this.connectionTimer = setTimeout(() => {
6034
6043
  this.currentState === "connecting" && (Z.error("Connection timeout"), this.abortController?.abort("Connection timeout"), this.setState("offline"), this.config.onError?.(/* @__PURE__ */ Error("Connection timeout")));
6035
6044
  }, this.connectionTimeoutMs);
6036
6045
  try {
6037
6046
  let t = await e();
6038
- if (this.authResponse = t.authResponse, this._sessionId = t.authResponse.ClientContext.SessionId, this._connectUrl = t.directUrl, this._brandingRequired = t.brandingRequired ?? !1, Z.info(`Authenticated to Ikon server (ikonServerId=${t.authResponse.IkonServerId}, appSessionId=${t.authResponse.AppSessionId})`), !this.config.local && t.backendUrl && t.authToken && om(t.backendUrl, t.authToken), t.usedProxyUrl && t.directUrl && this.endpointSelector.proxyMode === "auto") {
6047
+ if (this.authResponse = t.authResponse, this._sessionId = t.authResponse.ClientContext.SessionId, this._connectUrl = t.directUrl, this._brandingRequired = t.brandingRequired ?? !1, Z.info(`Authenticated to Ikon server (ikonServerId=${t.authResponse.IkonServerId}, appSessionId=${t.authResponse.AppSessionId})`), !this.config.local && t.backendUrl && t.authToken && lm(t.backendUrl, t.authToken), t.usedProxyUrl && t.directUrl && this.endpointSelector.proxyMode === "auto") {
6039
6048
  Z.debug("Auth fell back to proxy, marking proxy preferred");
6040
6049
  let e = t.directUrl;
6041
- Um(e).then((e) => {
6050
+ Km(e).then((e) => {
6042
6051
  e && (Z.debug("Background probe: direct server reachable, clearing proxy preference for next connection"), this.endpointSelector.clearProxyPreference());
6043
6052
  }).catch(() => {});
6044
6053
  }
@@ -6049,7 +6058,7 @@ var Mg = class {
6049
6058
  }
6050
6059
  }
6051
6060
  disconnect() {
6052
- Z.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), cm(), this.clearTimers(), this.cleanupLifecycleHandlers(), this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null), this._media?.dispose(), this._mediaCapture?.dispose(), this.unregisterMediaCaptureFunctions &&= (this.unregisterMediaCaptureFunctions(), null), this.unregisterSoundFunctions &&= (this.unregisterSoundFunctions(), null), this.unregisterBrowserFunctions &&= (this.unregisterBrowserFunctions(), null), this.unregisterLoginInterceptor &&= (this.unregisterLoginInterceptor(), null), this.abortController?.abort(), this.abortController = null, this._fullReauthAttempted = !1, this._softReconnectAttempted = !1, this._lastFailureWasAuthRejected = !1, this._reauthInProgress = !1, this._disconnectedAt = null, this._serverStopped = !1, this._hasBeenConnected = !1, this.releaseKeepaliveLock(), this.disconnectProtocol(), this.authResponse = null, this._sessionId = void 0, this._globalState = null, this._globalStateReceived = !1, this._channelsConnected = !1, this._joinedHandled = !1, this._environmentTrackingSetup = !1;
6061
+ Z.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), dm(), this.clearTimers(), this.cleanupLifecycleHandlers(), this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null), this._media?.dispose(), this._mediaCapture?.dispose(), this.unregisterMediaCaptureFunctions &&= (this.unregisterMediaCaptureFunctions(), null), this.unregisterSoundFunctions &&= (this.unregisterSoundFunctions(), null), this.unregisterBrowserFunctions &&= (this.unregisterBrowserFunctions(), null), this.unregisterLoginInterceptor &&= (this.unregisterLoginInterceptor(), null), this.abortController?.abort(), this.abortController = null, this._fullReauthAttempted = !1, this._softReconnectAttempted = !1, this._lastFailureWasAuthRejected = !1, this._reauthInProgress = !1, this._disconnectedAt = null, this._serverStopped = !1, this._hasBeenConnected = !1, this.releaseKeepaliveLock(), this.disconnectProtocol(), this.authResponse = null, this._sessionId = void 0, this._globalState = null, this._globalStateReceived = !1, this._channelsConnected = !1, this._joinedHandled = !1, this._environmentTrackingSetup = !1;
6053
6062
  for (let e of this._webRtcAudioElements.values()) e.pause(), e.srcObject = null, e.remove();
6054
6063
  this._webRtcAudioElements.clear(), this._webRtcAudioStreams.clear(), this._webRtcVideoStreams.clear(), this._webRtcTrackMap.clear(), this._pendingActiveAudioTracks.clear(), this.removeWebRtcAudioUnlockHandler(), this._webRtcMediaSession.cleanup(), this._functionRegistry.detach(), this._reactiveRegistry.detach(), this.setState("offline");
6055
6064
  }
@@ -6260,10 +6269,10 @@ var Mg = class {
6260
6269
  }
6261
6270
  async authenticate() {
6262
6271
  let e = this.abortController?.signal;
6263
- if (this.config.local) return qm(this.config.local, e);
6272
+ if (this.config.local) return Xm(this.config.local, e);
6264
6273
  let t = this.endpointSelector.proxyMode, n = this.endpointSelector.proxyPreferred, r;
6265
- if (this.config.apiKey) r = await Jm(this.config.apiKey, e, t, n);
6266
- else if (this.config.sessionToken) r = await Ym(this.config.sessionToken, e, t, n);
6274
+ if (this.config.apiKey) r = await Zm(this.config.apiKey, e, t, n);
6275
+ else if (this.config.sessionToken) r = await Qm(this.config.sessionToken, e, t, n);
6267
6276
  else throw Error("No connection configuration provided (need local, apiKey, or sessionToken)");
6268
6277
  return r.usedProxyUrl && t === "auto" && this.endpointSelector.markProxyPreferred(), r;
6269
6278
  }
@@ -6298,7 +6307,7 @@ var Mg = class {
6298
6307
  return;
6299
6308
  }
6300
6309
  if (t === w.CORE_GLOBAL_STATE && uo(e).then((e) => {
6301
- this._globalState = e, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(e, this._sessionId), this._media?.audio.syncStreamsFromGlobalState(e), this._media?.video.syncStreamsFromGlobalState(e), this._visemeTracker?.syncStreamsFromGlobalState(e), this._globalState.DebugMode && eg(), $h() && this.protocolWorker && (this.protocolWorker.postMessage({
6310
+ this._globalState = e, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(e, this._sessionId), this._media?.audio.syncStreamsFromGlobalState(e), this._media?.video.syncStreamsFromGlobalState(e), this._visemeTracker?.syncStreamsFromGlobalState(e), this._globalState.DebugMode && rg(), ng() && this.protocolWorker && (this.protocolWorker.postMessage({
6302
6311
  type: "enableDevtools",
6303
6312
  enabled: !0
6304
6313
  }), this.protocolWorker.postMessage({
@@ -6436,7 +6445,7 @@ var Mg = class {
6436
6445
  let n;
6437
6446
  if (this.preloadedWorker) n = this.preloadedWorker, this.preloadedWorker = null;
6438
6447
  else try {
6439
- n = new vg();
6448
+ n = new xg();
6440
6449
  } catch (n) {
6441
6450
  Z.warn(`Failed to create protocol worker, falling back to main thread: ${n}`), await this.connectProtocolOnMainThread(e, t);
6442
6451
  return;
@@ -6492,13 +6501,13 @@ var Mg = class {
6492
6501
  r || (i = void 0, t(/* @__PURE__ */ Error("Protocol worker connect timed out")));
6493
6502
  }, td);
6494
6503
  }), i = this.computeOrderedEndpointTypes(e), a = this.getServerKeepaliveTimeoutMs(), o = this.config.timeouts?.reconnectBackoffMs ?? 2e3, s = this.config.timeouts?.maxReconnectAttempts ?? 2;
6495
- this.updateWorkerInterestMask(), $h() && (n.postMessage({
6504
+ this.updateWorkerInterestMask(), ng() && (n.postMessage({
6496
6505
  type: "enableDevtools",
6497
6506
  enabled: !0
6498
6507
  }), n.postMessage({
6499
6508
  type: "setLogLevel",
6500
6509
  level: Ce()
6501
- })), rg();
6510
+ })), og();
6502
6511
  let c = uu() ?? this.config.webRtc?.enabled ?? !0;
6503
6512
  n.postMessage({
6504
6513
  type: "connect",
@@ -6526,7 +6535,7 @@ var Mg = class {
6526
6535
  }
6527
6536
  ensureVisemeTracker() {
6528
6537
  if (!this._visemeTracker) try {
6529
- this._visemeTracker = new Xh(this), this._visemeTracker.enable();
6538
+ this._visemeTracker = new $h(this), this._visemeTracker.enable();
6530
6539
  } catch (e) {
6531
6540
  Z.warn(`Viseme tracker setup failed: ${e}`), this._visemeTracker = null;
6532
6541
  }
@@ -6604,9 +6613,9 @@ var Mg = class {
6604
6613
  this._webRtcRetryTimer &&= (clearTimeout(this._webRtcRetryTimer), null);
6605
6614
  }
6606
6615
  scheduleWebRtcRetry() {
6607
- if (this._webRtcRetryTimer || this._webRtcRetryCount >= Ag.length) return;
6608
- let e = Ag[this._webRtcRetryCount++];
6609
- Z.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${Ag.length})`), this._webRtcRetryTimer = setTimeout(() => {
6616
+ if (this._webRtcRetryTimer || this._webRtcRetryCount >= Ng.length) return;
6617
+ let e = Ng[this._webRtcRetryCount++];
6618
+ Z.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${Ng.length})`), this._webRtcRetryTimer = setTimeout(() => {
6610
6619
  this._webRtcRetryTimer = null, !(this.currentState !== "connected" || this._webRtcSignaling || !this.isWebRtcEnabled) && this.setupWebRtcSignaling();
6611
6620
  }, e);
6612
6621
  }
@@ -6798,7 +6807,7 @@ var Mg = class {
6798
6807
  let n = this.groupEntrypointsByType(this._connectedEntrypoints), r = this.abortController?.signal;
6799
6808
  for (let e of t) {
6800
6809
  let t = n.get(e)?.[0]?.Uri;
6801
- if (!(t === void 0 || r?.aborted) && await mg(e, t, { signal: r })) {
6810
+ if (!(t === void 0 || r?.aborted) && await _g(e, t, { signal: r })) {
6802
6811
  this.endpointSelector.recordFasterTypeReachable(e);
6803
6812
  return;
6804
6813
  }
@@ -6928,8 +6937,8 @@ var Mg = class {
6928
6937
  let t = e.target?.closest?.("a[href]");
6929
6938
  if (!t || t.target && t.target !== "_self") return;
6930
6939
  let n = t.getAttribute("href") ?? "";
6931
- if (cg(n)) {
6932
- e.preventDefault(), lg(n);
6940
+ if (dg(n)) {
6941
+ e.preventDefault(), fg(n);
6933
6942
  return;
6934
6943
  }
6935
6944
  let r = this.resolveInPlaceDestination(t, n);
@@ -6948,7 +6957,7 @@ var Mg = class {
6948
6957
  } catch {
6949
6958
  return null;
6950
6959
  }
6951
- return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search || cf(n.pathname) ? null : n;
6960
+ return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search || df(n.pathname) ? null : n;
6952
6961
  }
6953
6962
  sendDisconnectSignal() {
6954
6963
  if (this._sessionId !== void 0 && this.currentState === "connected") try {
@@ -7024,7 +7033,7 @@ var Mg = class {
7024
7033
  });
7025
7034
  }, 150);
7026
7035
  }), window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
7027
- this.sendUpdateClientContext({ theme: mf() });
7036
+ this.sendUpdateClientContext({ theme: _f() });
7028
7037
  });
7029
7038
  }
7030
7039
  setupExternalConnectUrlListener() {
@@ -7055,7 +7064,7 @@ var Mg = class {
7055
7064
  this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null);
7056
7065
  }
7057
7066
  }
7058
- }, Ng = class {
7067
+ }, Ig = class {
7059
7068
  client;
7060
7069
  constructor(e) {
7061
7070
  this.client = e;
@@ -7073,45 +7082,45 @@ var Mg = class {
7073
7082
  }, { close: () => n.close() }) : { close: () => {} };
7074
7083
  }
7075
7084
  };
7076
- function Pg(e) {
7077
- return new Ng(e);
7085
+ function Lg(e) {
7086
+ return new Ig(e);
7078
7087
  }
7079
7088
  //#endregion
7080
7089
  //#region src/client/connection-state.ts
7081
- function Fg(e) {
7090
+ function Rg(e) {
7082
7091
  return e === "waitingForExternalConnectUrl" || e === "connecting" || e === "connectingSlow" || e === "reconnecting";
7083
7092
  }
7084
- function Ig(e) {
7093
+ function zg(e) {
7085
7094
  return e === "connected";
7086
7095
  }
7087
- function Lg(e) {
7096
+ function Bg(e) {
7088
7097
  return e === "offline" || e === "offlineError";
7089
7098
  }
7090
- function Rg(e) {
7099
+ function Vg(e) {
7091
7100
  return e === "offlineError";
7092
7101
  }
7093
7102
  //#endregion
7094
7103
  //#region src/utils/opcode-names.ts
7095
- var zg = /* @__PURE__ */ new Map();
7096
- for (let [e, t] of Object.entries(w)) typeof t == "number" && zg.set(t, e);
7097
- function Bg(e) {
7098
- return zg.get(e) ?? `UNKNOWN_${e}`;
7104
+ var Hg = /* @__PURE__ */ new Map();
7105
+ for (let [e, t] of Object.entries(w)) typeof t == "number" && Hg.set(t, e);
7106
+ function Ug(e) {
7107
+ return Hg.get(e) ?? `UNKNOWN_${e}`;
7099
7108
  }
7100
7109
  //#endregion
7101
7110
  //#region src/login/reprovision.ts
7102
- var Vg = "ikon-login-app-route";
7103
- function Hg(e) {
7111
+ var Wg = "ikon-login-app-route";
7112
+ function Gg(e) {
7104
7113
  if (typeof window > "u") return;
7105
7114
  try {
7106
- sessionStorage.setItem(Vg, window.location.pathname);
7115
+ sessionStorage.setItem(Wg, window.location.pathname);
7107
7116
  } catch {}
7108
7117
  let t = new URL(window.location.href);
7109
7118
  t.searchParams.set(Ul, e), window.location.href = t.toString();
7110
7119
  }
7111
- function Ug() {
7120
+ function Kg() {
7112
7121
  let e = null;
7113
7122
  try {
7114
- e = sessionStorage.getItem(Vg), sessionStorage.removeItem(Vg);
7123
+ e = sessionStorage.getItem(Wg), sessionStorage.removeItem(Wg);
7115
7124
  } catch {}
7116
7125
  return {
7117
7126
  appRoute: e,
@@ -7120,7 +7129,7 @@ function Ug() {
7120
7129
  }
7121
7130
  //#endregion
7122
7131
  //#region src/media/ring-buffer.ts
7123
- var Wg = class {
7132
+ var qg = class {
7124
7133
  static getStorageForCapacity(e, t) {
7125
7134
  let n = Int32Array.BYTES_PER_ELEMENT * 2, r = t.BYTES_PER_ELEMENT * e;
7126
7135
  return new SharedArrayBuffer(n + r);
@@ -7171,7 +7180,7 @@ var Wg = class {
7171
7180
  };
7172
7181
  //#endregion
7173
7182
  //#region src/worker/audio-capture-worker.ts?worker
7174
- function Gg(e) {
7183
+ function Jg(e) {
7175
7184
  return new Worker("" + new URL("assets/audio-capture-worker-CJ5S-nQt.js", import.meta.url).href, {
7176
7185
  type: "module",
7177
7186
  name: e?.name
@@ -7179,11 +7188,11 @@ function Gg(e) {
7179
7188
  }
7180
7189
  //#endregion
7181
7190
  //#region src/media/ikon-audio-capture.ts
7182
- var Q = C("IkonAudioCapture"), Kg = 3, qg = 200, Jg = 2e3, Yg = 5e3, Xg = 3e3;
7183
- function Zg(e) {
7191
+ var Q = C("IkonAudioCapture"), Yg = 3, Xg = 200, Zg = 2e3, Qg = 5e3, $g = 3e3;
7192
+ function e_(e) {
7184
7193
  return new Promise((t) => setTimeout(t, e));
7185
7194
  }
7186
- function Qg(e) {
7195
+ function t_(e) {
7187
7196
  switch (e.name) {
7188
7197
  case "NotReadableError": return {
7189
7198
  action: "retry",
@@ -7219,14 +7228,14 @@ function Qg(e) {
7219
7228
  };
7220
7229
  }
7221
7230
  }
7222
- function $g() {
7231
+ function n_() {
7223
7232
  let e = globalThis.crypto;
7224
7233
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
7225
7234
  }
7226
- function e_() {
7235
+ function r_() {
7227
7236
  return "\nclass RingBuffer {\n static getStorageForCapacity(capacity, type) {\n const indexBytes = Int32Array.BYTES_PER_ELEMENT * 2;\n const dataBytes = type.BYTES_PER_ELEMENT * capacity;\n return new SharedArrayBuffer(indexBytes + dataBytes);\n }\n\n constructor(sharedArrayBuffer, type) {\n this.buf = sharedArrayBuffer;\n this.readWrite = new Int32Array(sharedArrayBuffer, 0, 2);\n const dataOffset = Int32Array.BYTES_PER_ELEMENT * 2;\n const dataLength = (sharedArrayBuffer.byteLength - dataOffset) / Float32Array.BYTES_PER_ELEMENT;\n this.storage = new type(sharedArrayBuffer, dataOffset, dataLength);\n }\n\n get capacity() {\n return this.storage.length;\n }\n\n available_read() {\n const read = Atomics.load(this.readWrite, 0);\n const write = Atomics.load(this.readWrite, 1);\n if (write >= read) return write - read;\n return this.capacity - (read - write);\n }\n\n available_write() {\n return this.capacity - this.available_read() - 1;\n }\n\n push(input) {\n const writable = Math.min(this.available_write(), input.length);\n if (writable <= 0) return 0;\n\n const read = Atomics.load(this.readWrite, 0);\n let write = Atomics.load(this.readWrite, 1);\n\n const firstPart = Math.min(writable, this.capacity - write);\n this.storage.set(input.subarray(0, firstPart), write);\n const remaining = writable - firstPart;\n if (remaining > 0) {\n this.storage.set(input.subarray(firstPart, firstPart + remaining), 0);\n }\n\n write = (write + writable) % this.capacity;\n Atomics.store(this.readWrite, 1, write);\n Atomics.notify(this.readWrite, 1);\n if (this.available_read() > this.capacity - 2) {\n Atomics.store(this.readWrite, 0, read);\n }\n\n return writable;\n }\n}\n\nconst RENDER_QUANTUM_SIZE = 128;\n\nclass IkonAudioCaptureProcessor extends AudioWorkletProcessor {\n constructor(options) {\n super();\n const cfg = options?.processorOptions || {};\n this.channels = cfg.channels || 1;\n this.transport = cfg.transport || 'pcm';\n this.ring = null;\n this.temp = new Float32Array(RENDER_QUANTUM_SIZE * this.channels);\n\n if (this.transport === 'sab' && cfg.sharedArrayBuffer) {\n this.ring = new RingBuffer(cfg.sharedArrayBuffer, Float32Array);\n }\n\n // Pre-allocated rotating transfer buffers for PCM mode\n // We use two buffers and alternate between them since postMessage transfers ownership\n this.transferBuffers = [\n new Float32Array(RENDER_QUANTUM_SIZE),\n new Float32Array(RENDER_QUANTUM_SIZE)\n ];\n this.transferBufferIndex = 0;\n\n this.port.postMessage({ type: 'ready' });\n }\n\n process(inputs) {\n const input = inputs[0];\n if (!input || input.length === 0) {\n return true;\n }\n\n const frames = input[0]?.length || 0;\n if (frames === 0) {\n return true;\n }\n\n const channelCount = input.length;\n for (let i = 0; i < frames; i++) {\n let sum = 0;\n for (let ch = 0; ch < channelCount; ch++) {\n const channel = input[ch];\n sum += channel ? (channel[i] || 0) : 0;\n }\n this.temp[i] = sum / channelCount;\n }\n\n const out = this.temp.subarray(0, frames);\n if (this.transport === 'sab' && this.ring) {\n this.ring.push(out);\n return true;\n }\n\n // Use rotating pre-allocated transfer buffer\n let buffer = this.transferBuffers[this.transferBufferIndex];\n // If buffer was transferred (detached), recreate it\n if (buffer.byteLength === 0) {\n buffer = new Float32Array(RENDER_QUANTUM_SIZE);\n this.transferBuffers[this.transferBufferIndex] = buffer;\n }\n buffer.set(out);\n const toSend = buffer.subarray(0, frames);\n this.port.postMessage({ type: 'pcm', pcm: toSend }, [buffer.buffer]);\n // Flip to next buffer for next call\n this.transferBufferIndex = (this.transferBufferIndex + 1) % 2;\n return true;\n }\n}\n\nregisterProcessor('ikon-audio-capture', IkonAudioCaptureProcessor);\n";
7228
7237
  }
7229
- var t_ = class e {
7238
+ var i_ = class e {
7230
7239
  client;
7231
7240
  static RESUME_TIMEOUT_MS = 3e3;
7232
7241
  worker = null;
@@ -7287,7 +7296,7 @@ var t_ = class e {
7287
7296
  notifyError(e, t, n, r) {
7288
7297
  if (e.stopped) return;
7289
7298
  let i = Date.now(), a = t.name;
7290
- if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < Yg) return;
7299
+ if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < Qg) return;
7291
7300
  e.lastErrorTime = i, e.lastErrorReason = n, e.lastErrorName = a;
7292
7301
  let o = this.config.autoRestartPolicy;
7293
7302
  if (o?.enabled && r) {
@@ -7345,7 +7354,7 @@ var t_ = class e {
7345
7354
  if (e.ctx.state === "running") return !0;
7346
7355
  if (e.ctx.state !== "suspended") return !1;
7347
7356
  let r = Date.now();
7348
- if (!n && r - e.lastResumeAttemptTime < Xg) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
7357
+ if (!n && r - e.lastResumeAttemptTime < $g) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
7349
7358
  e.lastResumeAttemptTime = r, this.emitDiagnostic({
7350
7359
  event: "resume-attempt",
7351
7360
  captureId: e.captureId,
@@ -7381,7 +7390,7 @@ var t_ = class e {
7381
7390
  attemptResume(e, t, n = !1) {
7382
7391
  if (e.stopped || e.ctx.state !== "suspended") return;
7383
7392
  let r = Date.now();
7384
- if (!n && r - e.lastResumeAttemptTime < Xg) {
7393
+ if (!n && r - e.lastResumeAttemptTime < $g) {
7385
7394
  Q.debug(`Resume attempt from ${t} skipped (cooldown)`);
7386
7395
  return;
7387
7396
  }
@@ -7480,7 +7489,7 @@ var t_ = class e {
7480
7489
  }
7481
7490
  ensureWorker() {
7482
7491
  if (this.worker) return this.worker;
7483
- let e = new Gg();
7492
+ let e = new Jg();
7484
7493
  return this.worker = e, e.addEventListener("message", (e) => {
7485
7494
  let t = e.data;
7486
7495
  if (t?.type === "error") {
@@ -7578,25 +7587,25 @@ var t_ = class e {
7578
7587
  reason: "unknown",
7579
7588
  canRetry: !1
7580
7589
  };
7581
- for (let r = 0; r < Kg; r++) try {
7590
+ for (let r = 0; r < Yg; r++) try {
7582
7591
  return {
7583
7592
  stream: await navigator.mediaDevices.getUserMedia({ audio: e }),
7584
7593
  error: t,
7585
7594
  errorInfo: n
7586
7595
  };
7587
7596
  } catch (e) {
7588
- if (t = e instanceof Error ? e : Error(String(e)), n = Qg(t), Q.debug(`getUserMedia attempt ${r + 1}/${Kg} failed: ${t.name} (action: ${n.action})`), this.emitDiagnostic({
7597
+ if (t = e instanceof Error ? e : Error(String(e)), n = t_(t), Q.debug(`getUserMedia attempt ${r + 1}/${Yg} failed: ${t.name} (action: ${n.action})`), this.emitDiagnostic({
7589
7598
  event: "retry",
7590
7599
  details: {
7591
7600
  attempt: r + 1,
7592
- maxAttempts: Kg,
7601
+ maxAttempts: Yg,
7593
7602
  errorName: t.name,
7594
7603
  action: n.action
7595
7604
  }
7596
7605
  }), n.action !== "retry") break;
7597
7606
  if (r < 2) {
7598
- let e = qg * (r + 1);
7599
- Q.debug(`Retrying getUserMedia in ${e}ms`), await Zg(e);
7607
+ let e = Xg * (r + 1);
7608
+ Q.debug(`Retrying getUserMedia in ${e}ms`), await e_(e);
7600
7609
  }
7601
7610
  }
7602
7611
  return {
@@ -7607,7 +7616,7 @@ var t_ = class e {
7607
7616
  }
7608
7617
  async ensureWorklet(e) {
7609
7618
  if (!Te(e)) throw Error("AudioWorklet is not supported in this browser");
7610
- if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([e_()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
7619
+ if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([r_()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
7611
7620
  await this.workletReady;
7612
7621
  return;
7613
7622
  } catch {
@@ -7634,7 +7643,7 @@ var t_ = class e {
7634
7643
  if (!t) throw Error("Cannot start audio capture before client is connected");
7635
7644
  if (this.client.isWebRtcCaptureAvailable) return this.startMicWebRtc(e);
7636
7645
  this.client.isWebRtcEnabled && Q.warn("WebRTC unavailable, capturing audio via protocol channel");
7637
- let n = $g(), r = {
7646
+ let n = n_(), r = {
7638
7647
  captureId: n,
7639
7648
  aborted: !1,
7640
7649
  stream: null,
@@ -7672,7 +7681,7 @@ var t_ = class e {
7672
7681
  let f = Se() ? "sab" : "pcm", p;
7673
7682
  if (f === "sab") {
7674
7683
  let e = Math.floor(a.sampleRate * 10);
7675
- p = Wg.getStorageForCapacity(e, Float32Array);
7684
+ p = qg.getStorageForCapacity(e, Float32Array);
7676
7685
  }
7677
7686
  let m = this.ensureWorker(), h = e.onStopped;
7678
7687
  m.postMessage({
@@ -7820,7 +7829,7 @@ var t_ = class e {
7820
7829
  };
7821
7830
  this.setupAudioContextStateListener(a, _), this.setupVisibilityChangeListener(_), this.setupBFCacheHandlers(_), _.healthCheckTimer = setInterval(() => {
7822
7831
  this.performHealthCheck(_);
7823
- }, Jg);
7832
+ }, Zg);
7824
7833
  let te = () => {
7825
7834
  _.stopped || (Q.warn(`Microphone track ended unexpectedly, captureId=${n.substring(0, 8)}`), this.handleRecoverableError(_, /* @__PURE__ */ Error("Microphone track ended unexpectedly"), "track-ended"));
7826
7835
  };
@@ -7969,8 +7978,8 @@ var t_ = class e {
7969
7978
  let t = this.captures.get(e);
7970
7979
  return !t || t.stopped ? !1 : this.attemptResumeAsync(t, "userGesture", !0);
7971
7980
  }
7972
- }, n_ = 3e3;
7973
- function r_(e, t, n, r) {
7981
+ }, a_ = 3e3;
7982
+ function o_(e, t, n, r) {
7974
7983
  if (!n && !r) return {
7975
7984
  width: e,
7976
7985
  height: t
@@ -7981,7 +7990,7 @@ function r_(e, t, n, r) {
7981
7990
  height: Math.max(1, Math.floor(t * o))
7982
7991
  };
7983
7992
  }
7984
- async function i_(e, t) {
7993
+ async function s_(e, t) {
7985
7994
  let n = t.mime ?? "image/jpeg", r = t.quality ?? .92;
7986
7995
  if (typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas) try {
7987
7996
  return await e.convertToBlob({
@@ -7996,7 +8005,7 @@ async function i_(e, t) {
7996
8005
  }, n, r);
7997
8006
  });
7998
8007
  }
7999
- var a_ = class {
8008
+ var c_ = class {
8000
8009
  async captureFromStream(e, t = {}) {
8001
8010
  let n = e.getVideoTracks()[0];
8002
8011
  if (!n) throw Error("No video track available in the provided stream");
@@ -8007,7 +8016,7 @@ var a_ = class {
8007
8016
  } catch {}
8008
8017
  try {
8009
8018
  await new Promise((e, t) => {
8010
- let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), n_);
8019
+ let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), a_);
8011
8020
  r.addEventListener("loadedmetadata", () => {
8012
8021
  clearTimeout(n), e();
8013
8022
  }, { once: !0 }), r.addEventListener("error", () => {
@@ -8017,7 +8026,7 @@ var a_ = class {
8017
8026
  try {
8018
8027
  await r.play();
8019
8028
  } catch {}
8020
- let { width: e, height: i } = r_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
8029
+ let { width: e, height: i } = o_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
8021
8030
  if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(e, i);
8022
8031
  else {
8023
8032
  let t = document.createElement("canvas");
@@ -8026,7 +8035,7 @@ var a_ = class {
8026
8035
  let o = a.getContext("2d", { alpha: !1 });
8027
8036
  if (!o) throw Error("2D canvas context unavailable");
8028
8037
  o.drawImage(r, 0, 0, e, i);
8029
- let s = await i_(a, t), c = await s.arrayBuffer();
8038
+ let s = await s_(a, t), c = await s.arrayBuffer();
8030
8039
  return {
8031
8040
  mime: s.type || t.mime || "image/jpeg",
8032
8041
  width: e,
@@ -8067,7 +8076,7 @@ var a_ = class {
8067
8076
  } catch {}
8068
8077
  try {
8069
8078
  await new Promise((e, t) => {
8070
- let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), n_);
8079
+ let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), a_);
8071
8080
  r.addEventListener("loadedmetadata", () => {
8072
8081
  clearTimeout(n), e();
8073
8082
  }, { once: !0 }), r.addEventListener("error", () => {
@@ -8077,7 +8086,7 @@ var a_ = class {
8077
8086
  try {
8078
8087
  await r.play();
8079
8088
  } catch {}
8080
- let { width: t, height: i } = r_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
8089
+ let { width: t, height: i } = o_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
8081
8090
  if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(t, i);
8082
8091
  else {
8083
8092
  let e = document.createElement("canvas");
@@ -8086,7 +8095,7 @@ var a_ = class {
8086
8095
  let o = a.getContext("2d", { alpha: !1 });
8087
8096
  if (!o) throw Error("2D canvas context unavailable");
8088
8097
  o.drawImage(r, 0, 0, t, i);
8089
- let s = await i_(a, e), c = await s.arrayBuffer();
8098
+ let s = await s_(a, e), c = await s.arrayBuffer();
8090
8099
  return {
8091
8100
  mime: s.type || e.mime || "image/jpeg",
8092
8101
  width: t,
@@ -8110,11 +8119,11 @@ var a_ = class {
8110
8119
  }
8111
8120
  async captureFromNativeCamera(e = {}) {
8112
8121
  if (typeof document > "u") throw Error("Native camera capture requires a DOM environment");
8113
- let t = await o_(e.facing);
8114
- return t ? await s_(t, e) : null;
8122
+ let t = await l_(e.facing);
8123
+ return t ? await u_(t, e) : null;
8115
8124
  }
8116
8125
  };
8117
- function o_(e) {
8126
+ function l_(e) {
8118
8127
  return new Promise((t) => {
8119
8128
  let n = document.createElement("input");
8120
8129
  n.type = "file", n.accept = "image/*", n.setAttribute("capture", e ?? "environment"), n.style.position = "fixed", n.style.left = "-99999px", n.style.top = "0";
@@ -8140,7 +8149,7 @@ function o_(e) {
8140
8149
  n.click();
8141
8150
  });
8142
8151
  }
8143
- async function s_(e, t) {
8152
+ async function u_(e, t) {
8144
8153
  let n = URL.createObjectURL(e), r;
8145
8154
  try {
8146
8155
  r = await new Promise((e, t) => {
@@ -8150,7 +8159,7 @@ async function s_(e, t) {
8150
8159
  } finally {
8151
8160
  URL.revokeObjectURL(n);
8152
8161
  }
8153
- let i = r.naturalWidth || r.width, a = r.naturalHeight || r.height, { width: o, height: s } = r_(i, a, t.width, t.height), c = t.mime ?? (e.type === "image/png" ? "image/png" : "image/jpeg"), l = t.quality ?? .92;
8162
+ let i = r.naturalWidth || r.width, a = r.naturalHeight || r.height, { width: o, height: s } = o_(i, a, t.width, t.height), c = t.mime ?? (e.type === "image/png" ? "image/png" : "image/jpeg"), l = t.quality ?? .92;
8154
8163
  if (o === i && s === a && e.type === c) {
8155
8164
  let t = await e.arrayBuffer();
8156
8165
  return {
@@ -8177,7 +8186,7 @@ async function s_(e, t) {
8177
8186
  }
8178
8187
  //#endregion
8179
8188
  //#region src/worker/video-capture-worker.ts?worker
8180
- function c_(e) {
8189
+ function d_(e) {
8181
8190
  return new Worker("" + new URL("assets/video-capture-worker-D5jsT6I4.js", import.meta.url).href, {
8182
8191
  type: "module",
8183
8192
  name: e?.name
@@ -8186,16 +8195,16 @@ function c_(e) {
8186
8195
  //#endregion
8187
8196
  //#region src/media/ikon-video-capture.ts
8188
8197
  var $ = C("IkonVideoCapture");
8189
- function l_() {
8198
+ function f_() {
8190
8199
  let e = globalThis.crypto;
8191
8200
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
8192
8201
  }
8193
- function u_() {
8202
+ function p_() {
8194
8203
  let e = globalThis.MediaStreamTrackProcessor;
8195
8204
  if (!e) throw Error("MediaStreamTrackProcessor is not available in this browser");
8196
8205
  return e;
8197
8206
  }
8198
- var d_ = class {
8207
+ var m_ = class {
8199
8208
  client;
8200
8209
  worker = null;
8201
8210
  protocolPort = null;
@@ -8211,7 +8220,7 @@ var d_ = class {
8211
8220
  }
8212
8221
  ensureWorker() {
8213
8222
  if (this.worker) return this.worker;
8214
- let e = new c_();
8223
+ let e = new d_();
8215
8224
  return this.worker = e, e.addEventListener("message", (e) => {
8216
8225
  let t = e.data;
8217
8226
  if (t?.type === "error") {
@@ -8321,10 +8330,10 @@ var d_ = class {
8321
8330
  if (this.client.isWebRtcCaptureAvailable && e.sourceType === "camera") return this.startCameraWebRtc(e);
8322
8331
  if (this.client.isWebRtcCaptureAvailable && e.sourceType === "screen") return this.startScreenWebRtc(e);
8323
8332
  this.client.isWebRtcEnabled && $.warn("WebRTC unavailable, capturing video via protocol channel"), this.ensurePorts();
8324
- let n = l_(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
8333
+ let n = f_(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
8325
8334
  if (!i) throw r.getTracks().forEach((e) => e.stop()), Error("No video track available");
8326
8335
  e.sourceType === "screen" && await new Promise((e) => setTimeout(e, 200));
8327
- let a = i.getSettings(), o = e.sourceType === "screen" ? a.width ?? 1280 : e.options?.width ?? a.width ?? 1280, s = e.sourceType === "screen" ? a.height ?? 720 : e.options?.height ?? a.height ?? 720, c = new (u_())({ track: i }).readable, l = this.allocateTrackId(), u = this.ensureWorker(), d = e.sourceType, f = e.onStopped;
8336
+ let a = i.getSettings(), o = e.sourceType === "screen" ? a.width ?? 1280 : e.options?.width ?? a.width ?? 1280, s = e.sourceType === "screen" ? a.height ?? 720 : e.options?.height ?? a.height ?? 720, c = new (p_())({ track: i }).readable, l = this.allocateTrackId(), u = this.ensureWorker(), d = e.sourceType, f = e.onStopped;
8328
8337
  u.postMessage({
8329
8338
  type: "start",
8330
8339
  captureId: n,
@@ -8447,16 +8456,16 @@ var d_ = class {
8447
8456
  }
8448
8457
  this.protocolPort?.close(), this.protocolPort = null, this.sendPort?.close(), this.sendPort = null;
8449
8458
  }
8450
- }, f_ = /* @__PURE__ */ d({ IkonMediaCapture: () => p_ }), p_ = class {
8459
+ }, h_ = /* @__PURE__ */ d({ IkonMediaCapture: () => g_ }), g_ = class {
8451
8460
  audio;
8452
8461
  video;
8453
8462
  image;
8454
8463
  constructor(e, t) {
8455
- this.audio = new t_(e, t?.audio), this.video = new d_(e), this.image = new a_();
8464
+ this.audio = new i_(e, t?.audio), this.video = new m_(e), this.image = new c_();
8456
8465
  }
8457
8466
  dispose() {
8458
8467
  this.audio.dispose(), this.video.dispose();
8459
8468
  }
8460
8469
  };
8461
8470
  //#endregion
8462
- export { Ml as AccessDeniedError, Ng as AppMessaging, O as AppStartupFailedError, D as AuthRejectedError, T as AuthenticationError, Il as BrowserNotSupportedError, Du as Channel, ku as ChannelManager, ne as ClientType, Dl as ConnectionError, m as ContextType, kg as EndpointSelector, b as EntrypointType, rh as FunctionCallError, ch as FunctionRegistry, xd as IKON_AUTH_BASE_URL, bd as IKON_AUTH_URL_DEV, yd as IKON_AUTH_URL_PROD, vd as IKON_BACKEND_URL_DEV, _d as IKON_BACKEND_URL_PROD, tg as IKON_INSPECT_MODE_CHANGED_EVENT, Wl as IKON_PARAM_AUDIO, Xl as IKON_PARAM_AUTH, Vl as IKON_PARAM_DEBUG, Yl as IKON_PARAM_DEBUG_OVERLAY, Jl as IKON_PARAM_INSPECT, Hl as IKON_PARAM_LANG, Rl as IKON_PARAM_PROXY, Zl as IKON_PARAM_RETRY, Ul as IKON_PARAM_SERVER_URL, Gl as IKON_PARAM_VIDEO, Kl as IKON_PARAM_WEBRTC, zl as IKON_PARAM_WEBSOCKET, Bl as IKON_PARAM_WEBTRANSPORT, t_ as IkonAudioCapture, ie as IkonAudioPlayback, Mg as IkonClient, a_ as IkonImageCapture, de as IkonMedia, p_ as IkonMediaCapture, d_ as IkonVideoCapture, le as IkonVideoPlayback, Ol as KeepaliveTimeoutError, S as LogLevel, kl as MaxRetriesExceededError, w as Opcode, Al as ProvisioningTimeoutError, Pl as ServerFullError, Fl as ServerUnavailableError, Nl as SessionNotFoundError, jl as SpaceNotFoundError, E as TransportError, p as UserType, Xh as VisemeTracker, Nu as WEBRTC_AUDIO_BITRATE, Mu as WEBRTC_AUDIO_CHANNELS, Au as WEBRTC_AUDIO_CODEC, Pu as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS, ju as WEBRTC_AUDIO_SAMPLE_RATE, zu as WEBRTC_BUNDLE_POLICY, Gu as WEBRTC_DATA_CHANNEL_LABEL, qu as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS, Ku as WEBRTC_DATA_CHANNEL_ORDERED, Uu as WEBRTC_MAX_AUDIO_TRACKS, Wu as WEBRTC_MAX_VIDEO_TRACKS, Bu as WEBRTC_RTCP_MUX_POLICY, Fu as WEBRTC_VIDEO_CODEC, Iu as WEBRTC_VIDEO_MAX_BITRATE, Lu as WEBRTC_VIDEO_MAX_FRAMERATE, Ju as WebRTCConnection, Yu as WebRTCSignaling, gd as abortSignalAny, I as abortSignalTimeout, Pg as appMessaging, v as asProtocolMessage, dg as checkBrowserSupport, bm as clearDeviceId, Rp as clearLogBuffer, ud as clearLoginPrompt, Ug as consumeLoginHandoff, pd as consumeLoginPendingCall, C as createLogger, Jd as createPkceChallenge, Pd as deriveAuthUrl, Md as deriveBackendType, jd as deriveBackendUrl, Fd as deriveCrossOriginAuthUrl, ag as enableInspectMode, xm as extractUserIdFromToken, Lp as flushLogs, cu as getAudioParam, mu as getAuthSameOriginParam, Fp as getBufferedLogs, mm as getConnectTraceId, pu as getDebugOverlayParam, au as getDebugParam, fu as getInspectParam, ou as getLangParam, zp as getLogBufferSize, Ce as getLogLevel, xe as getLogSink, cd as getLoginPromptState, Bg as getOpcodeName, ym as getOrCreateDeviceId, nu as getProxyParam, j as getRetryParam, Od as getSameOriginAuthUrl, su as getServerUrlParam, lu as getVideoParam, uu as getWebRtcParam, ru as getWebSocketParam, iu as getWebTransportParam, Qh as initializeDebugMode, rg as initializeInspectMode, Np as initializeLogSink, Te as isAudioWorkletSupported, R as isBrowserEnvironment, Vd as isCloudEnvironment, Ig as isConnected, Fg as isConnecting, $h as isDebugModeEnabled, $d as isEmbedded, Rg as isError, ig as isInspectModeEnabled, vh as isMobileBrowserLikely, Lg as isOffline, qd as isPkceSupported, Se as isSharedArrayBufferSupported, wu as isWebTransportSupported, _h as loginErrorInterceptor, Bd as parseUrlParams, _m as randomUuid, c as readOpcode, u as readOpcodeGroup, i as readProtocolMessageHeaders, Ep as registerBrowserFunctions, gm as reportConnectTimeline, Hg as reprovisionAfterLogin, ye as setLogLevel, ve as setLogSink, ld as setLoginPromptRequired, tu as setSdkUrlParam, Pp as setSendLogsCallback, rf as startEmbeddedOAuthSignIn, om as startLogSender, cm as stopLogSender, dd as subscribeLoginPrompt, ge as subscribeToLogEvents, Ip as takeBufferedLogs, Yd as takePkceVerifier, nh as withResultData };
8471
+ export { Ml as AccessDeniedError, Ig as AppMessaging, O as AppStartupFailedError, D as AuthRejectedError, T as AuthenticationError, Il as BrowserNotSupportedError, Du as Channel, ku as ChannelManager, ne as ClientType, Dl as ConnectionError, m as ContextType, Mg as EndpointSelector, b as EntrypointType, oh as FunctionCallError, dh as FunctionRegistry, xd as IKON_AUTH_BASE_URL, bd as IKON_AUTH_URL_DEV, yd as IKON_AUTH_URL_PROD, vd as IKON_BACKEND_URL_DEV, _d as IKON_BACKEND_URL_PROD, ig as IKON_INSPECT_MODE_CHANGED_EVENT, Wl as IKON_PARAM_AUDIO, Xl as IKON_PARAM_AUTH, Vl as IKON_PARAM_DEBUG, Yl as IKON_PARAM_DEBUG_OVERLAY, Jl as IKON_PARAM_INSPECT, Hl as IKON_PARAM_LANG, Rl as IKON_PARAM_PROXY, Zl as IKON_PARAM_RETRY, Ul as IKON_PARAM_SERVER_URL, Gl as IKON_PARAM_VIDEO, Kl as IKON_PARAM_WEBRTC, zl as IKON_PARAM_WEBSOCKET, Bl as IKON_PARAM_WEBTRANSPORT, i_ as IkonAudioCapture, ie as IkonAudioPlayback, Fg as IkonClient, c_ as IkonImageCapture, de as IkonMedia, g_ as IkonMediaCapture, m_ as IkonVideoCapture, le as IkonVideoPlayback, Ol as KeepaliveTimeoutError, S as LogLevel, kl as MaxRetriesExceededError, w as Opcode, ef as PKCE_URL_PARAM, Al as ProvisioningTimeoutError, Pl as ServerFullError, Fl as ServerUnavailableError, Nl as SessionNotFoundError, jl as SpaceNotFoundError, E as TransportError, p as UserType, $h as VisemeTracker, Nu as WEBRTC_AUDIO_BITRATE, Mu as WEBRTC_AUDIO_CHANNELS, Au as WEBRTC_AUDIO_CODEC, Pu as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS, ju as WEBRTC_AUDIO_SAMPLE_RATE, zu as WEBRTC_BUNDLE_POLICY, Gu as WEBRTC_DATA_CHANNEL_LABEL, qu as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS, Ku as WEBRTC_DATA_CHANNEL_ORDERED, Uu as WEBRTC_MAX_AUDIO_TRACKS, Wu as WEBRTC_MAX_VIDEO_TRACKS, Bu as WEBRTC_RTCP_MUX_POLICY, Fu as WEBRTC_VIDEO_CODEC, Iu as WEBRTC_VIDEO_MAX_BITRATE, Lu as WEBRTC_VIDEO_MAX_FRAMERATE, Ju as WebRTCConnection, Yu as WebRTCSignaling, gd as abortSignalAny, I as abortSignalTimeout, cf as adoptPkceVerifierFromUrl, Lg as appMessaging, v as asProtocolMessage, mg as checkBrowserSupport, Cm as clearDeviceId, Vp as clearLogBuffer, ud as clearLoginPrompt, Kg as consumeLoginHandoff, pd as consumeLoginPendingCall, C as createLogger, Jd as createPkceChallenge, Pd as deriveAuthUrl, Md as deriveBackendType, jd as deriveBackendUrl, Fd as deriveCrossOriginAuthUrl, cg as enableInspectMode, wm as extractUserIdFromToken, Bp as flushLogs, cu as getAudioParam, mu as getAuthSameOriginParam, Rp as getBufferedLogs, _m as getConnectTraceId, pu as getDebugOverlayParam, au as getDebugParam, fu as getInspectParam, ou as getLangParam, Hp as getLogBufferSize, Ce as getLogLevel, xe as getLogSink, cd as getLoginPromptState, Ug as getOpcodeName, Sm as getOrCreateDeviceId, nu as getProxyParam, j as getRetryParam, Od as getSameOriginAuthUrl, su as getServerUrlParam, lu as getVideoParam, uu as getWebRtcParam, ru as getWebSocketParam, iu as getWebTransportParam, tg as initializeDebugMode, og as initializeInspectMode, Ip as initializeLogSink, Te as isAudioWorkletSupported, R as isBrowserEnvironment, Vd as isCloudEnvironment, zg as isConnected, Rg as isConnecting, ng as isDebugModeEnabled, rf as isEmbedded, Vg as isError, sg as isInspectModeEnabled, xh as isMobileBrowserLikely, Bg as isOffline, qd as isPkceSupported, Se as isSharedArrayBufferSupported, wu as isWebTransportSupported, bh as loginErrorInterceptor, Bd as parseUrlParams, bm as randomUuid, c as readOpcode, u as readOpcodeGroup, i as readProtocolMessageHeaders, kp as registerBrowserFunctions, ym as reportConnectTimeline, Gg as reprovisionAfterLogin, Yd as restorePkceVerifier, ye as setLogLevel, ve as setLogSink, ld as setLoginPromptRequired, tu as setSdkUrlParam, Lp as setSendLogsCallback, of as startEmbeddedOAuthSignIn, lm as startLogSender, dm as stopLogSender, dd as subscribeLoginPrompt, ge as subscribeToLogEvents, zp as takeBufferedLogs, Xd as takePkceVerifier, ah as withResultData };