@ikonai/sdk 1.3.2 → 1.3.3

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
@@ -3165,8 +3165,8 @@ function Yd() {
3165
3165
  }
3166
3166
  //#endregion
3167
3167
  //#region src/utils/embedded-oauth.ts
3168
- var Xd = "/oauth/popup-callback", Zd = 3e5;
3169
- function Qd() {
3168
+ var Xd = C("EmbeddedAuth"), Zd = "/oauth/popup-callback", Qd = 3e5;
3169
+ function $d() {
3170
3170
  if (typeof window > "u") return !1;
3171
3171
  try {
3172
3172
  return window.top !== window.self;
@@ -3174,21 +3174,43 @@ function Qd() {
3174
3174
  return !0;
3175
3175
  }
3176
3176
  }
3177
- async function $d(e, t) {
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) => {
3184
+ if (e.source !== window.parent) return;
3185
+ let t = e.data;
3186
+ t?.source === "ikon-oauth" && t.type === "ikon-oauth-embedder-accepted" && a(!0);
3187
+ };
3188
+ window.addEventListener("message", o), window.parent.postMessage({
3189
+ source: "ikon-oauth",
3190
+ type: ef,
3191
+ provider: e,
3192
+ spaceId: t,
3193
+ codeChallenge: n
3194
+ }, "*");
3195
+ let s = window.setTimeout(() => a(!1), tf);
3196
+ });
3197
+ }
3198
+ async function rf(e, t) {
3199
+ if (await nf(e, t)) return !0;
3178
3200
  try {
3179
- let { code: n, provider: r } = await ef(e, t), i = new URL(window.location.href);
3201
+ let { code: n, provider: r } = await af(e, t), i = new URL(window.location.href);
3180
3202
  return i.searchParams.set("ikon_code", n), i.searchParams.set("ikon_provider", r), window.location.replace(i.toString()), !0;
3181
- } catch {
3182
- return !1;
3203
+ } catch (t) {
3204
+ return Xd.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
3183
3205
  }
3184
3206
  }
3185
- async function ef(e, t) {
3207
+ async function af(e, t) {
3186
3208
  let n = window.open("about:blank", "ikon-oauth", "popup,width=520,height=680");
3187
3209
  if (!n) throw Error("The sign-in window was blocked. Allow pop-ups for this site and try again.");
3188
3210
  let r;
3189
3211
  try {
3190
3212
  r = await Fd();
3191
- let i = `${r}${Xd}`, a = await Jd(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3213
+ let i = `${r}${Zd}`, a = await Jd(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3192
3214
  n.location.href = `${r}/oauth/${encodeURIComponent(e)}?space=${encodeURIComponent(t)}&return=${encodeURIComponent(i)}${o}`;
3193
3215
  } catch (e) {
3194
3216
  throw n.close(), e;
@@ -3218,37 +3240,37 @@ async function ef(e, t) {
3218
3240
  o(() => {
3219
3241
  n.close(), r(/* @__PURE__ */ Error("The sign-in timed out"));
3220
3242
  });
3221
- }, Zd);
3243
+ }, Qd);
3222
3244
  });
3223
3245
  }
3224
3246
  //#endregion
3225
3247
  //#region src/utils/user-gesture.ts
3226
- function tf(e) {
3248
+ function of(e) {
3227
3249
  if (!e || typeof e != "object") return !1;
3228
3250
  let t = e, n = typeof t.name == "string" ? t.name : "", r = typeof t.message == "string" ? t.message : "";
3229
3251
  return !!(n === "NotAllowedError" || n === "SecurityError" || r.toLowerCase().includes("permission") || r.toLowerCase().includes("user gesture"));
3230
3252
  }
3231
3253
  //#endregion
3232
3254
  //#region src/utils/app-routes.ts
3233
- var nf = ["/ikon", "/api"];
3234
- function rf(e) {
3255
+ var sf = ["/ikon", "/api"];
3256
+ function cf(e) {
3235
3257
  if (!e) return !1;
3236
3258
  let t = e.split(/[?#]/)[0], n = t.startsWith("/") ? t : "/" + t;
3237
- return nf.some((e) => n === e || n.startsWith(e + "/"));
3259
+ return sf.some((e) => n === e || n.startsWith(e + "/"));
3238
3260
  }
3239
3261
  //#endregion
3240
3262
  //#region src/functions/browser-functions.ts
3241
- var af = "ikon-theme", of = "ikon-theme-user", sf = "ikon-theme-change";
3242
- function cf(e) {
3263
+ var lf = "ikon-theme", uf = "ikon-theme-user", df = "ikon-theme-change";
3264
+ function ff(e) {
3243
3265
  typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", e);
3244
3266
  }
3245
- function lf() {
3267
+ function pf() {
3246
3268
  return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
3247
3269
  }
3248
- function uf() {
3249
- return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(of) || window.localStorage.getItem(af) || lf();
3270
+ function mf() {
3271
+ return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(uf) || window.localStorage.getItem(lf) || pf();
3250
3272
  }
3251
- function df() {
3273
+ function hf() {
3252
3274
  return typeof window > "u" ? {
3253
3275
  width: 0,
3254
3276
  height: 0
@@ -3257,17 +3279,17 @@ function df() {
3257
3279
  height: window.innerHeight
3258
3280
  };
3259
3281
  }
3260
- function ff() {
3282
+ function gf() {
3261
3283
  if (typeof window > "u" || !window.localStorage) return "light";
3262
- let e = window.localStorage.getItem(of), t = window.localStorage.getItem(af);
3284
+ let e = window.localStorage.getItem(uf), t = window.localStorage.getItem(lf);
3263
3285
  if (e || t) {
3264
3286
  let n = e ?? t;
3265
- return cf(n), n;
3287
+ return ff(n), n;
3266
3288
  }
3267
- let n = lf();
3268
- return window.localStorage.setItem(af, n), cf(n), n;
3289
+ let n = pf();
3290
+ return window.localStorage.setItem(lf, n), ff(n), n;
3269
3291
  }
3270
- var pf = {
3292
+ var _f = {
3271
3293
  name: "ikon.client.getTheme",
3272
3294
  description: "Get the currently selected client theme",
3273
3295
  returnType: {
@@ -3275,12 +3297,12 @@ var pf = {
3275
3297
  nullable: !0
3276
3298
  }
3277
3299
  };
3278
- function mf() {
3300
+ function vf() {
3279
3301
  if (typeof window > "u" || !window.localStorage) return null;
3280
- let e = window.localStorage.getItem(of), t = window.localStorage.getItem(af);
3302
+ let e = window.localStorage.getItem(uf), t = window.localStorage.getItem(lf);
3281
3303
  return e ?? t ?? null;
3282
3304
  }
3283
- var hf = {
3305
+ var yf = {
3284
3306
  name: "ikon.client.setTheme",
3285
3307
  description: "Update the client UI theme",
3286
3308
  returnType: { kind: "boolean" },
@@ -3297,38 +3319,38 @@ var hf = {
3297
3319
  description: "Whether to persist as user preference"
3298
3320
  }]
3299
3321
  };
3300
- function gf(e, t) {
3322
+ function bf(e, t) {
3301
3323
  if (typeof window > "u" || !window.localStorage || typeof e != "string") return !1;
3302
3324
  let n = e.trim().toLowerCase();
3303
3325
  if (!n) return !1;
3304
3326
  let r = t === void 0 || !!t, i = window.localStorage;
3305
- r ? i.setItem(of, n) : i.removeItem(of), i.setItem(af, n);
3327
+ r ? i.setItem(uf, n) : i.removeItem(uf), i.setItem(lf, n);
3306
3328
  try {
3307
- window.dispatchEvent(new CustomEvent(sf, { detail: { mode: n } }));
3329
+ window.dispatchEvent(new CustomEvent(df, { detail: { mode: n } }));
3308
3330
  } catch {}
3309
- return cf(n), !0;
3331
+ return ff(n), !0;
3310
3332
  }
3311
- var _f = {
3333
+ var xf = {
3312
3334
  name: "ikon.client.getLanguage",
3313
3335
  description: "Get the browser language preference",
3314
3336
  returnType: { kind: "string" }
3315
3337
  };
3316
- function vf() {
3338
+ function Sf() {
3317
3339
  return typeof navigator > "u" ? "en-US" : navigator.language || "en-US";
3318
3340
  }
3319
- var yf = {
3341
+ var Cf = {
3320
3342
  name: "ikon.client.getTimezone",
3321
3343
  description: "Get the browser timezone (IANA format)",
3322
3344
  returnType: { kind: "string" }
3323
3345
  };
3324
- function bf() {
3346
+ function wf() {
3325
3347
  try {
3326
3348
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
3327
3349
  } catch {
3328
3350
  return "UTC";
3329
3351
  }
3330
3352
  }
3331
- function xf() {
3353
+ function Tf() {
3332
3354
  if (typeof Intl > "u") return "";
3333
3355
  try {
3334
3356
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -3336,15 +3358,15 @@ function xf() {
3336
3358
  return "";
3337
3359
  }
3338
3360
  }
3339
- function Sf() {
3361
+ function Ef() {
3340
3362
  return typeof navigator > "u" ? !1 : navigator.maxTouchPoints > 0;
3341
3363
  }
3342
- function Cf() {
3364
+ function Df() {
3343
3365
  if (typeof navigator > "u" || typeof window > "u") return ne.Unknown;
3344
3366
  let e = navigator.maxTouchPoints > 0, t = window.innerWidth <= 1024;
3345
3367
  return e && t ? ne.MobileWeb : ne.DesktopWeb;
3346
3368
  }
3347
- var wf = {
3369
+ var Of = {
3348
3370
  name: "ikon.client.getUrl",
3349
3371
  description: "Get the current browser URL path and query string",
3350
3372
  returnType: {
@@ -3352,10 +3374,10 @@ var wf = {
3352
3374
  nullable: !0
3353
3375
  }
3354
3376
  };
3355
- function Tf() {
3377
+ function kf() {
3356
3378
  return typeof window > "u" ? null : window.location.pathname + window.location.search;
3357
3379
  }
3358
- var Ef = {
3380
+ var Af = {
3359
3381
  name: "ikon.client.setUrl",
3360
3382
  description: "Update the browser URL without triggering a page reload",
3361
3383
  returnType: { kind: "boolean" },
@@ -3383,10 +3405,10 @@ var Ef = {
3383
3405
  }
3384
3406
  ]
3385
3407
  };
3386
- function Df(e, t, n) {
3408
+ function jf(e, t, n) {
3387
3409
  if (typeof window > "u" || !window.history || typeof e != "string") return !1;
3388
3410
  let r = e.trim();
3389
- if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || rf(r)) return !1;
3411
+ if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || cf(r)) return !1;
3390
3412
  try {
3391
3413
  let e = !!t, i = n && !r.includes("?") ? r + window.location.search : r;
3392
3414
  return e ? window.history.replaceState(null, "", i) : window.history.pushState(null, "", i), !0;
@@ -3394,7 +3416,7 @@ function Df(e, t, n) {
3394
3416
  return !1;
3395
3417
  }
3396
3418
  }
3397
- var Of = {
3419
+ var Mf = {
3398
3420
  name: "ikon.client.openExternalUrl",
3399
3421
  description: "Open an external URL in a new browser tab",
3400
3422
  returnType: { kind: "boolean" },
@@ -3404,7 +3426,7 @@ var Of = {
3404
3426
  description: "The URL to open. Must be absolute (e.g., starts with https://)."
3405
3427
  }]
3406
3428
  };
3407
- function kf(e) {
3429
+ function Nf(e) {
3408
3430
  if (typeof window > "u" || typeof window.open != "function" || typeof e != "string") return !1;
3409
3431
  let t = e.trim();
3410
3432
  if (!t || /^javascript:/i.test(t)) return !1;
@@ -3414,7 +3436,7 @@ function kf(e) {
3414
3436
  return !1;
3415
3437
  }
3416
3438
  }
3417
- var Af = {
3439
+ var Pf = {
3418
3440
  name: "ikon.client.vibrate",
3419
3441
  description: "Trigger haptic feedback on supported devices",
3420
3442
  returnType: { kind: "boolean" },
@@ -3424,7 +3446,7 @@ var Af = {
3424
3446
  description: "Duration in ms, or comma-separated pattern (e.g., \"200\" or \"100,50,100\")"
3425
3447
  }]
3426
3448
  };
3427
- function jf(e) {
3449
+ function Ff(e) {
3428
3450
  if (typeof navigator > "u" || !navigator.vibrate || typeof e != "string") return !1;
3429
3451
  try {
3430
3452
  let t = e.split(",").map((e) => parseInt(e.trim(), 10));
@@ -3433,16 +3455,16 @@ function jf(e) {
3433
3455
  return !1;
3434
3456
  }
3435
3457
  }
3436
- var L = null, Mf = !1, Nf = !1;
3437
- async function Pf() {
3458
+ var L = null, If = !1, Lf = !1;
3459
+ async function Rf() {
3438
3460
  if (!(typeof navigator > "u" || !("wakeLock" in navigator))) try {
3439
3461
  L = await navigator.wakeLock.request("screen");
3440
3462
  } catch {}
3441
3463
  }
3442
- function Ff() {
3443
- document.visibilityState === "visible" && Mf && (!L || L.released) && Pf();
3464
+ function zf() {
3465
+ document.visibilityState === "visible" && If && (!L || L.released) && Rf();
3444
3466
  }
3445
- var If = {
3467
+ var Bf = {
3446
3468
  name: "ikon.client.keepScreenAwake",
3447
3469
  description: "Prevent or allow the screen to sleep",
3448
3470
  returnType: { kind: "boolean" },
@@ -3452,15 +3474,15 @@ var If = {
3452
3474
  description: "Whether to keep the screen awake"
3453
3475
  }]
3454
3476
  };
3455
- async function Lf(e) {
3477
+ async function Vf(e) {
3456
3478
  if (typeof navigator > "u" || !("wakeLock" in navigator)) return !1;
3457
3479
  try {
3458
- return e ? (Mf = !0, (!L || L.released) && (L = await navigator.wakeLock.request("screen")), Nf ||= (document.addEventListener("visibilitychange", Ff), !0)) : (Mf = !1, Nf &&= (document.removeEventListener("visibilitychange", Ff), !1), L &&= (await L.release(), null)), !0;
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;
3459
3481
  } catch {
3460
3482
  return !1;
3461
3483
  }
3462
3484
  }
3463
- var Rf = {
3485
+ var Hf = {
3464
3486
  name: "ikon.client.getVisibility",
3465
3487
  description: "Get the current page visibility state",
3466
3488
  returnType: {
@@ -3468,10 +3490,10 @@ var Rf = {
3468
3490
  nullable: !0
3469
3491
  }
3470
3492
  };
3471
- function zf() {
3493
+ function Uf() {
3472
3494
  return typeof document > "u" ? null : document.visibilityState || null;
3473
3495
  }
3474
- var Bf = {
3496
+ var Wf = {
3475
3497
  name: "ikon.client.scrollTo",
3476
3498
  description: "Scroll the page to a specific position",
3477
3499
  returnType: { kind: "boolean" },
@@ -3496,7 +3518,7 @@ var Bf = {
3496
3518
  }
3497
3519
  ]
3498
3520
  };
3499
- function Vf(e, t, n) {
3521
+ function Gf(e, t, n) {
3500
3522
  if (typeof window > "u" || typeof e != "number" || typeof t != "number") return !1;
3501
3523
  try {
3502
3524
  return window.scrollTo({
@@ -3508,7 +3530,7 @@ function Vf(e, t, n) {
3508
3530
  return !1;
3509
3531
  }
3510
3532
  }
3511
- var Hf = {
3533
+ var Kf = {
3512
3534
  name: "ikon.client.getBatteryLevel",
3513
3535
  description: "Get the current battery level (0-100)",
3514
3536
  returnType: {
@@ -3516,7 +3538,7 @@ var Hf = {
3516
3538
  nullable: !0
3517
3539
  }
3518
3540
  };
3519
- async function Uf() {
3541
+ async function qf() {
3520
3542
  if (typeof navigator > "u" || !("getBattery" in navigator)) return null;
3521
3543
  try {
3522
3544
  let e = await navigator.getBattery();
@@ -3525,7 +3547,7 @@ async function Uf() {
3525
3547
  return null;
3526
3548
  }
3527
3549
  }
3528
- var Wf = {
3550
+ var Jf = {
3529
3551
  name: "ikon.client.getNetworkType",
3530
3552
  description: "Get the current network connection type",
3531
3553
  returnType: {
@@ -3533,17 +3555,17 @@ var Wf = {
3533
3555
  nullable: !0
3534
3556
  }
3535
3557
  };
3536
- function Gf() {
3558
+ function Yf() {
3537
3559
  if (typeof navigator > "u") return null;
3538
3560
  let e = navigator.connection;
3539
3561
  return e && (e.effectiveType || e.type) || null;
3540
3562
  }
3541
- var Kf = {
3563
+ var Xf = {
3542
3564
  name: "ikon.client.requestFullscreen",
3543
3565
  description: "Request the browser to enter fullscreen mode",
3544
3566
  returnType: { kind: "boolean" }
3545
3567
  };
3546
- async function qf() {
3568
+ async function Zf() {
3547
3569
  if (typeof document > "u" || !document.documentElement) return !1;
3548
3570
  try {
3549
3571
  let e = document.documentElement, t = e.requestFullscreen?.bind(e) ?? e.webkitRequestFullscreen?.bind(e);
@@ -3552,12 +3574,12 @@ async function qf() {
3552
3574
  return !1;
3553
3575
  }
3554
3576
  }
3555
- var Jf = {
3577
+ var Qf = {
3556
3578
  name: "ikon.client.exitFullscreen",
3557
3579
  description: "Exit browser fullscreen mode",
3558
3580
  returnType: { kind: "boolean" }
3559
3581
  };
3560
- function Yf() {
3582
+ function $f() {
3561
3583
  if (typeof document > "u") return !1;
3562
3584
  try {
3563
3585
  let e = document.exitFullscreen?.bind(document) ?? document.webkitExitFullscreen?.bind(document);
@@ -3566,25 +3588,25 @@ function Yf() {
3566
3588
  return !1;
3567
3589
  }
3568
3590
  }
3569
- var Xf = {
3591
+ var ep = {
3570
3592
  name: "ikon.client.logout",
3571
3593
  description: "Clear the auth session and return to the login screen at the site root",
3572
3594
  returnType: { kind: "boolean" }
3573
- }, Zf = ["ikon-auth-", "ikon-live-snapshot"];
3574
- function Qf() {
3595
+ }, tp = ["ikon-auth-", "ikon-live-snapshot"];
3596
+ function np() {
3575
3597
  if (typeof window > "u" || !window.localStorage) return !1;
3576
3598
  try {
3577
3599
  let e = [];
3578
3600
  for (let t = 0; t < window.localStorage.length; t++) {
3579
3601
  let n = window.localStorage.key(t);
3580
- n && Zf.some((e) => n.startsWith(e)) && e.push(n);
3602
+ n && tp.some((e) => n.startsWith(e)) && e.push(n);
3581
3603
  }
3582
3604
  return e.forEach((e) => window.localStorage.removeItem(e)), setTimeout(() => window.location.replace(window.location.origin + "/"), 100), !0;
3583
3605
  } catch {
3584
3606
  return !1;
3585
3607
  }
3586
3608
  }
3587
- var $f = {
3609
+ var rp = {
3588
3610
  name: "ikon.client.login",
3589
3611
  description: "Start the sign-in flow for an OAuth provider (e.g. google, microsoft)",
3590
3612
  parameters: [{
@@ -3593,15 +3615,15 @@ var $f = {
3593
3615
  }],
3594
3616
  returnType: { kind: "boolean" }
3595
3617
  };
3596
- async function ep(e) {
3618
+ async function ip(e) {
3597
3619
  if (typeof window > "u" || typeof e != "string" || e.length === 0 || e === "guest" || e === "global" || e === "email" || e === "passkey") return !1;
3598
3620
  let t = window.__IKON_AUTH_CONFIG__, n = t?.spaceId;
3599
3621
  if (!n) return !1;
3600
- if (Qd()) return await $d(e, n);
3622
+ if ($d()) return await rf(e, n);
3601
3623
  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)}` : "";
3602
3624
  return window.location.href = `${r}/oauth/${encodeURIComponent(e)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`, !0;
3603
3625
  }
3604
- var tp = {
3626
+ var ap = {
3605
3627
  name: "ikon.client.loginShow",
3606
3628
  description: "Show the login UI with an optional reason",
3607
3629
  parameters: [{
@@ -3610,15 +3632,15 @@ var tp = {
3610
3632
  }],
3611
3633
  returnType: { kind: "boolean" }
3612
3634
  };
3613
- function np(e) {
3635
+ function op(e) {
3614
3636
  return typeof window > "u" ? !1 : (ld(typeof e == "string" ? e : null), !0);
3615
3637
  }
3616
- var rp = {
3638
+ var sp = {
3617
3639
  name: "ikon.client.getLocation",
3618
3640
  description: "Get the current GPS location",
3619
3641
  returnType: { kind: "string" }
3620
3642
  };
3621
- function ip() {
3643
+ function cp() {
3622
3644
  return typeof navigator > "u" || !navigator.geolocation ? Promise.resolve(null) : new Promise((e) => {
3623
3645
  navigator.geolocation.getCurrentPosition((t) => {
3624
3646
  e({
@@ -3632,15 +3654,15 @@ function ip() {
3632
3654
  });
3633
3655
  });
3634
3656
  }
3635
- var ap = [], op = !1;
3636
- function sp() {
3657
+ var lp = [], up = !1;
3658
+ function dp() {
3637
3659
  return typeof window < "u" && "Notification" in window;
3638
3660
  }
3639
- function cp(e, t, n, r) {
3661
+ function fp(e, t, n, r) {
3640
3662
  let i = {};
3641
3663
  return e?.trim() && (i.body = e.trim()), t?.trim() && (i.icon = t.trim()), n?.trim() && (i.tag = n.trim()), r && (i.data = r), i;
3642
3664
  }
3643
- function lp(e, t, n, r) {
3665
+ function pp(e, t, n, r) {
3644
3666
  try {
3645
3667
  let i = new Notification(e, t);
3646
3668
  i.onclick = () => {
@@ -3655,40 +3677,40 @@ function lp(e, t, n, r) {
3655
3677
  };
3656
3678
  } catch {}
3657
3679
  }
3658
- function up() {
3680
+ function mp() {
3659
3681
  if (Notification.permission !== "granted") {
3660
- ap = [];
3682
+ lp = [];
3661
3683
  return;
3662
3684
  }
3663
- let e = ap;
3664
- ap = [];
3665
- for (let t of e) lp(t.title, t.options, t.launchUrl, t.data);
3685
+ let e = lp;
3686
+ lp = [];
3687
+ for (let t of e) pp(t.title, t.options, t.launchUrl, t.data);
3666
3688
  }
3667
- function dp() {
3668
- if (op || typeof window > "u") return;
3669
- op = !0;
3689
+ function hp() {
3690
+ if (up || typeof window > "u") return;
3691
+ up = !0;
3670
3692
  let e = async () => {
3671
3693
  try {
3672
3694
  if (await Notification.requestPermission() === "granted") {
3673
- up();
3695
+ mp();
3674
3696
  return;
3675
3697
  }
3676
3698
  } catch {}
3677
- ap = [];
3699
+ lp = [];
3678
3700
  }, t = () => {
3679
- window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), op = !1, e();
3701
+ window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), up = !1, e();
3680
3702
  };
3681
3703
  window.addEventListener("pointerdown", t), window.addEventListener("keydown", t);
3682
3704
  }
3683
- var fp = {
3705
+ var gp = {
3684
3706
  name: "ikon.client.getNotificationPermission",
3685
3707
  description: "Get the current notification permission state (granted, denied, default, or unsupported)",
3686
3708
  returnType: { kind: "string" }
3687
3709
  };
3688
- function pp() {
3689
- return sp() ? Notification.permission : "unsupported";
3710
+ function _p() {
3711
+ return dp() ? Notification.permission : "unsupported";
3690
3712
  }
3691
- var mp = {
3713
+ var vp = {
3692
3714
  name: "ikon.client.showNotification",
3693
3715
  description: "Show a notification, requesting permission lazily on the first send",
3694
3716
  returnType: { kind: "string" },
@@ -3734,33 +3756,33 @@ var mp = {
3734
3756
  }
3735
3757
  ]
3736
3758
  };
3737
- async function hp(e, t, n, r, i, a) {
3738
- if (!sp() || typeof e != "string" || !e.trim()) return "unsupported";
3739
- let o = e.trim(), s = cp(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;
3740
- if (Notification.permission === "granted") return lp(o, s, c, l), "granted";
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";
3741
3763
  if (Notification.permission === "denied") return "denied";
3742
3764
  try {
3743
3765
  let e = await Notification.requestPermission();
3744
- return e === "granted" && lp(o, s, c, l), e;
3766
+ return e === "granted" && pp(o, s, c, l), e;
3745
3767
  } catch (e) {
3746
- return tf(e) ? (ap.push({
3768
+ return of(e) ? (lp.push({
3747
3769
  title: o,
3748
3770
  options: s,
3749
3771
  launchUrl: c,
3750
3772
  data: l
3751
- }), dp(), "default") : "denied";
3773
+ }), hp(), "default") : "denied";
3752
3774
  }
3753
3775
  }
3754
- var gp = null;
3755
- function _p(e) {
3756
- gp = e ?? null;
3776
+ var bp = null;
3777
+ function xp(e) {
3778
+ bp = e ?? null;
3757
3779
  }
3758
- function vp(e) {
3780
+ function Sp(e) {
3759
3781
  let t = (e + "=".repeat((4 - e.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"), n = atob(t), r = new Uint8Array(n.length);
3760
3782
  for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
3761
3783
  return r;
3762
3784
  }
3763
- var yp = {
3785
+ var Cp = {
3764
3786
  name: "ikon.client.getPushSubscription",
3765
3787
  description: "Subscribe to Web Push and return the subscription, for offline push registration",
3766
3788
  returnType: {
@@ -3768,14 +3790,14 @@ var yp = {
3768
3790
  nullable: !0
3769
3791
  }
3770
3792
  };
3771
- async function bp() {
3772
- if (typeof window > "u" || !gp?.enabled || !gp.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !sp() || Notification.permission !== "granted") return null;
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;
3773
3795
  try {
3774
3796
  let e = await navigator.serviceWorker.register("/push-service-worker.js");
3775
3797
  await navigator.serviceWorker.ready;
3776
3798
  let t = (await e.pushManager.getSubscription() ?? await e.pushManager.subscribe({
3777
3799
  userVisibleOnly: !0,
3778
- applicationServerKey: vp(gp.vapidPublicKey)
3800
+ applicationServerKey: Sp(bp.vapidPublicKey)
3779
3801
  })).toJSON();
3780
3802
  return !t.endpoint || !t.keys?.p256dh || !t.keys?.auth ? null : {
3781
3803
  Platform: "web",
@@ -3788,15 +3810,7 @@ async function bp() {
3788
3810
  return null;
3789
3811
  }
3790
3812
  }
3791
- var xp = [
3792
- {
3793
- definition: pf,
3794
- handler: mf
3795
- },
3796
- {
3797
- definition: hf,
3798
- handler: gf
3799
- },
3813
+ var Tp = [
3800
3814
  {
3801
3815
  definition: _f,
3802
3816
  handler: vf
@@ -3806,12 +3820,12 @@ var xp = [
3806
3820
  handler: bf
3807
3821
  },
3808
3822
  {
3809
- definition: wf,
3810
- handler: Tf
3823
+ definition: xf,
3824
+ handler: Sf
3811
3825
  },
3812
3826
  {
3813
- definition: Ef,
3814
- handler: Df
3827
+ definition: Cf,
3828
+ handler: wf
3815
3829
  },
3816
3830
  {
3817
3831
  definition: Of,
@@ -3822,12 +3836,12 @@ var xp = [
3822
3836
  handler: jf
3823
3837
  },
3824
3838
  {
3825
- definition: If,
3826
- handler: Lf
3839
+ definition: Mf,
3840
+ handler: Nf
3827
3841
  },
3828
3842
  {
3829
- definition: Rf,
3830
- handler: zf
3843
+ definition: Pf,
3844
+ handler: Ff
3831
3845
  },
3832
3846
  {
3833
3847
  definition: Bf,
@@ -3851,14 +3865,14 @@ var xp = [
3851
3865
  },
3852
3866
  {
3853
3867
  definition: Xf,
3854
- handler: Qf
3868
+ handler: Zf
3855
3869
  },
3856
3870
  {
3857
- definition: $f,
3858
- handler: ep
3871
+ definition: Qf,
3872
+ handler: $f
3859
3873
  },
3860
3874
  {
3861
- definition: tp,
3875
+ definition: ep,
3862
3876
  handler: np
3863
3877
  },
3864
3878
  {
@@ -3866,20 +3880,28 @@ var xp = [
3866
3880
  handler: ip
3867
3881
  },
3868
3882
  {
3869
- definition: fp,
3870
- handler: pp
3883
+ definition: ap,
3884
+ handler: op
3885
+ },
3886
+ {
3887
+ definition: sp,
3888
+ handler: cp
3871
3889
  },
3872
3890
  {
3873
- definition: mp,
3874
- handler: hp
3891
+ definition: gp,
3892
+ handler: _p
3875
3893
  },
3876
3894
  {
3877
- definition: yp,
3878
- handler: bp
3895
+ definition: vp,
3896
+ handler: yp
3897
+ },
3898
+ {
3899
+ definition: Cp,
3900
+ handler: wp
3879
3901
  }
3880
3902
  ];
3881
- function Sp(e) {
3882
- let t = xp.map(({ definition: t, handler: n }) => e.register(t, n));
3903
+ function Ep(e) {
3904
+ let t = Tp.map(({ definition: t, handler: n }) => e.register(t, n));
3883
3905
  return () => t.forEach((e) => e());
3884
3906
  }
3885
3907
  function R() {
@@ -3887,126 +3909,126 @@ function R() {
3887
3909
  }
3888
3910
  //#endregion
3889
3911
  //#region src/utils/log-sink.ts
3890
- var Cp = 1e3, wp = S.INFO, z = [], Tp = Cp, Ep = wp, Dp = null;
3891
- function Op(e) {
3892
- e.level < Ep || (z.push(e), z.length > Tp && (z = z.slice(-Tp)));
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)));
3893
3915
  }
3894
- function kp(e) {
3895
- Tp = e?.maxBufferSize ?? Cp, Ep = e?.minLevel ?? wp, z = [], ve(Op);
3916
+ function Np(e) {
3917
+ kp = e?.maxBufferSize ?? Dp, Ap = e?.minLevel ?? Op, z = [], ve(Mp);
3896
3918
  }
3897
- function Ap(e) {
3898
- Dp = e;
3919
+ function Pp(e) {
3920
+ jp = e;
3899
3921
  }
3900
- function jp() {
3922
+ function Fp() {
3901
3923
  return z;
3902
3924
  }
3903
- function Mp() {
3925
+ function Ip() {
3904
3926
  let e = z;
3905
3927
  return z = [], e;
3906
3928
  }
3907
- function Np() {
3908
- if (!Dp || z.length === 0) return 0;
3909
- let e = Mp();
3910
- return Dp(e), e.length;
3929
+ function Lp() {
3930
+ if (!jp || z.length === 0) return 0;
3931
+ let e = Ip();
3932
+ return jp(e), e.length;
3911
3933
  }
3912
- function Pp() {
3934
+ function Rp() {
3913
3935
  z = [];
3914
3936
  }
3915
- function Fp() {
3937
+ function zp() {
3916
3938
  return z.length;
3917
3939
  }
3918
- kp();
3940
+ Np();
3919
3941
  //#endregion
3920
3942
  //#region src/utils/log-sender.ts
3921
- var Ip = C("LogSender"), Lp = 1e3, Rp = 6e4, zp = 15e3, Bp = 10240, Vp = 409600, Hp = "…[truncated]", Up = {
3943
+ var Bp = C("LogSender"), Vp = 1e3, Hp = 6e4, Up = 15e3, Wp = 10240, Gp = 409600, Kp = "…[truncated]", qp = {
3922
3944
  [S.DEBUG]: he.Debug,
3923
3945
  [S.INFO]: he.Info,
3924
3946
  [S.WARN]: he.Warning,
3925
3947
  [S.ERROR]: he.Error
3926
- }, B, Wp, V, H = [], Gp = 0, Kp;
3927
- function qp(e) {
3928
- return e.length <= Bp ? e : e.slice(0, 10228) + Hp;
3948
+ }, B, Jp, V, H = [], Yp = 0, Xp;
3949
+ function Zp(e) {
3950
+ return e.length <= Wp ? e : e.slice(0, 10228) + Kp;
3929
3951
  }
3930
- function Jp(e) {
3952
+ function Qp(e) {
3931
3953
  return {
3932
3954
  Time: e.timestamp,
3933
- Type: Up[e.level] ?? he.Info,
3934
- Message: qp(`[${e.component}] ${e.message}`),
3955
+ Type: qp[e.level] ?? he.Info,
3956
+ Message: Zp(`[${e.component}] ${e.message}`),
3935
3957
  Parameters: "{}"
3936
3958
  };
3937
3959
  }
3938
- function Yp(e) {
3960
+ function $p(e) {
3939
3961
  return JSON.stringify({
3940
3962
  type: "sdk-typescript",
3941
3963
  event: { Logs: e }
3942
3964
  });
3943
3965
  }
3944
- function Xp(e) {
3966
+ function em(e) {
3945
3967
  if (e.length === 0) return [];
3946
- let t = Vp - Yp([]).length, n = [], r = [], i = 0;
3968
+ let t = Gp - $p([]).length, n = [], r = [], i = 0;
3947
3969
  for (let a of e) {
3948
3970
  let e = JSON.stringify(a).length + 1;
3949
3971
  r.length > 0 && i + e > t && (n.push(r), r = [], i = 0), r.push(a), i += e;
3950
3972
  }
3951
3973
  return r.length > 0 && n.push(r), n;
3952
3974
  }
3953
- async function Zp(e) {
3975
+ async function tm(e) {
3954
3976
  if (e.length === 0 || !B) return;
3955
3977
  let t = `${B}/events/logs/json`, n = {
3956
3978
  "Content-Type": "application/json",
3957
- Authorization: `Bearer ${Wp}`
3979
+ Authorization: `Bearer ${Jp}`
3958
3980
  }, r = await fetch(t, {
3959
3981
  method: "POST",
3960
3982
  headers: n,
3961
- body: Yp(e),
3962
- signal: I(zp)
3983
+ body: $p(e),
3984
+ signal: I(Up)
3963
3985
  });
3964
3986
  if (!r.ok) {
3965
3987
  if (r.status >= 400 && r.status < 500) {
3966
- Ip.warn(`Dropping ${e.length} log entries due to ${r.status}`);
3988
+ Bp.warn(`Dropping ${e.length} log entries due to ${r.status}`);
3967
3989
  return;
3968
3990
  }
3969
3991
  throw Error(`Failed to send logs: ${r.status}`);
3970
3992
  }
3971
3993
  }
3972
- function Qp() {
3973
- if (Gp === 0) return Lp;
3974
- let e = Lp * (1 << Math.min(Gp, 6));
3975
- return Math.min(e, Rp);
3994
+ function nm() {
3995
+ if (Yp === 0) return Vp;
3996
+ let e = Vp * (1 << Math.min(Yp, 6));
3997
+ return Math.min(e, Hp);
3976
3998
  }
3977
- function $p(e) {
3978
- B && (V = setTimeout(() => void em(), e));
3999
+ function rm(e) {
4000
+ B && (V = setTimeout(() => void im(), e));
3979
4001
  }
3980
- async function em() {
4002
+ async function im() {
3981
4003
  V = void 0;
3982
- let e = Mp();
3983
- if (H = H.concat(e.map(Jp)), typeof navigator < "u" && navigator.onLine === !1) {
3984
- $p(Lp);
4004
+ let e = Ip();
4005
+ if (H = H.concat(e.map(Qp)), typeof navigator < "u" && navigator.onLine === !1) {
4006
+ rm(Vp);
3985
4007
  return;
3986
4008
  }
3987
4009
  if (H.length === 0) {
3988
- $p(Lp);
4010
+ rm(Vp);
3989
4011
  return;
3990
4012
  }
3991
4013
  let t = H;
3992
4014
  H = [];
3993
- let n = Xp(t), r = !1;
4015
+ let n = em(t), r = !1;
3994
4016
  for (let e = 0; e < n.length; e++) try {
3995
- await Zp(n[e]);
4017
+ await tm(n[e]);
3996
4018
  } catch {
3997
4019
  H = n.slice(e).flat().concat(H), r = !0;
3998
4020
  break;
3999
4021
  }
4000
- r ? Gp++ : Gp = 0, $p(Qp());
4022
+ r ? Yp++ : Yp = 0, rm(nm());
4001
4023
  }
4002
- function tm() {
4003
- V !== void 0 && (clearTimeout(V), V = void 0), $p(0);
4024
+ function am() {
4025
+ V !== void 0 && (clearTimeout(V), V = void 0), rm(0);
4004
4026
  }
4005
- function nm(e, t) {
4006
- im(), B = e, Wp = t, Gp = 0, typeof window < "u" && (Kp = tm, window.addEventListener("online", Kp)), $p(Lp);
4027
+ function om(e, t) {
4028
+ cm(), B = e, Jp = t, Yp = 0, typeof window < "u" && (Xp = am, window.addEventListener("online", Xp)), rm(Vp);
4007
4029
  }
4008
- function rm(e, t) {
4009
- if (!B || !Wp) return;
4030
+ function sm(e, t) {
4031
+ if (!B || !Jp) return;
4010
4032
  let n = { Events: [{
4011
4033
  Time: (/* @__PURE__ */ new Date()).toISOString(),
4012
4034
  EventName: e,
@@ -4020,60 +4042,60 @@ function rm(e, t) {
4020
4042
  method: "POST",
4021
4043
  headers: {
4022
4044
  "Content-Type": "application/json",
4023
- Authorization: `Bearer ${Wp}`
4045
+ Authorization: `Bearer ${Jp}`
4024
4046
  },
4025
4047
  body: r
4026
- }).catch((t) => Ip.warn(`Failed to send analytics event ${e}: ${t}`));
4048
+ }).catch((t) => Bp.warn(`Failed to send analytics event ${e}: ${t}`));
4027
4049
  }
4028
- function im() {
4029
- V !== void 0 && (clearTimeout(V), V = void 0), Kp !== void 0 && typeof window < "u" && (window.removeEventListener("online", Kp), Kp = void 0), B = void 0, Wp = void 0, H = [], Gp = 0;
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;
4030
4052
  }
4031
4053
  //#endregion
4032
4054
  //#region src/utils/connect-timeline.ts
4033
- var am = C("ConnectTimeline"), om = "ikon-connect-trace-id", sm, cm = !1;
4034
- function lm() {
4055
+ var lm = C("ConnectTimeline"), um = "ikon-connect-trace-id", dm, fm = !1;
4056
+ function pm() {
4035
4057
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`;
4036
4058
  }
4037
- function um() {
4059
+ function mm() {
4038
4060
  try {
4039
- let e = sessionStorage.getItem(om);
4061
+ let e = sessionStorage.getItem(um);
4040
4062
  if (e) return e;
4041
- let t = lm();
4042
- return sessionStorage.setItem(om, t), t;
4063
+ let t = pm();
4064
+ return sessionStorage.setItem(um, t), t;
4043
4065
  } catch {
4044
- return sm ??= lm(), sm;
4066
+ return dm ??= pm(), dm;
4045
4067
  }
4046
4068
  }
4047
- function dm(e) {
4069
+ function hm(e) {
4048
4070
  if (typeof performance > "u" || typeof performance.getEntriesByType != "function") return;
4049
4071
  let t = performance.getEntriesByType("resource");
4050
4072
  for (let n = t.length - 1; n >= 0; n--) if (t[n].name.includes(e)) return Math.round(t[n].duration);
4051
4073
  }
4052
- function fm(e = {}) {
4053
- if (cm) return;
4054
- cm = !0;
4055
- let t = { connectTraceId: um() };
4074
+ function gm(e = {}) {
4075
+ if (fm) return;
4076
+ fm = !0;
4077
+ let t = { connectTraceId: mm() };
4056
4078
  e.snapshotSeeded !== void 0 && (t.snapshotSeeded = String(e.snapshotSeeded));
4057
4079
  try {
4058
4080
  if (typeof performance < "u") {
4059
4081
  t.firstPaintMs = String(Math.round(performance.now()));
4060
4082
  let e = performance.getEntriesByType("navigation")[0];
4061
4083
  e && (t.cdnHtmlMs = String(Math.round(e.responseEnd - e.fetchStart)), t.domContentLoadedMs = String(Math.round(e.domContentLoadedEventEnd)));
4062
- let n = dm("/anonymous");
4084
+ let n = hm("/anonymous");
4063
4085
  n !== void 0 && (t.authMs = String(n));
4064
- let r = dm("/init");
4086
+ let r = hm("/init");
4065
4087
  r !== void 0 && (t.initMs = String(r));
4066
- let i = dm("/connect");
4088
+ let i = hm("/connect");
4067
4089
  i !== void 0 && (t.connectMs = String(i));
4068
4090
  }
4069
4091
  } catch (e) {
4070
- am.warn(`Failed to read performance timeline: ${e}`);
4092
+ lm.warn(`Failed to read performance timeline: ${e}`);
4071
4093
  }
4072
- rm("client_connect_timeline", t);
4094
+ sm("client_connect_timeline", t);
4073
4095
  }
4074
4096
  //#endregion
4075
4097
  //#region src/utils/uuid.ts
4076
- function pm() {
4098
+ function _m() {
4077
4099
  let e = globalThis.crypto;
4078
4100
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
4079
4101
  let t = /* @__PURE__ */ new Uint8Array(16);
@@ -4086,34 +4108,34 @@ function pm() {
4086
4108
  }
4087
4109
  //#endregion
4088
4110
  //#region src/storage.ts
4089
- var mm = "ikon-device-id";
4090
- function hm() {
4091
- if (typeof window > "u" || typeof localStorage > "u") return pm();
4111
+ var vm = "ikon-device-id";
4112
+ function ym() {
4113
+ if (typeof window > "u" || typeof localStorage > "u") return _m();
4092
4114
  try {
4093
- let e = localStorage.getItem(mm);
4094
- return e || (e = pm(), localStorage.setItem(mm, e)), e;
4115
+ let e = localStorage.getItem(vm);
4116
+ return e || (e = _m(), localStorage.setItem(vm, e)), e;
4095
4117
  } catch {
4096
- return pm();
4118
+ return _m();
4097
4119
  }
4098
4120
  }
4099
- function gm() {
4121
+ function bm() {
4100
4122
  if (!(typeof localStorage > "u")) try {
4101
- localStorage.removeItem(mm);
4123
+ localStorage.removeItem(vm);
4102
4124
  } catch {}
4103
4125
  }
4104
- function _m(e) {
4105
- let t = ym(e);
4126
+ function xm(e) {
4127
+ let t = Cm(e);
4106
4128
  return typeof t?.id == "string" ? t.id : null;
4107
4129
  }
4108
- function vm(e) {
4109
- let t = ym(e);
4130
+ function Sm(e) {
4131
+ let t = Cm(e);
4110
4132
  return t ? {
4111
4133
  userId: typeof t.id == "string" ? t.id : null,
4112
4134
  authSession: typeof t.authSession == "string" ? t.authSession : null,
4113
4135
  role: typeof t.role == "string" ? t.role : null
4114
4136
  } : null;
4115
4137
  }
4116
- function ym(e) {
4138
+ function Cm(e) {
4117
4139
  try {
4118
4140
  let t = e.split(".");
4119
4141
  if (t.length !== 3) return null;
@@ -4125,8 +4147,8 @@ function ym(e) {
4125
4147
  }
4126
4148
  //#endregion
4127
4149
  //#region src/connection/authenticator.ts
4128
- 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, bm = 2, xm = 6e4, Sm = 2e3, Cm = 1e4, wm = 3e3, Tm = 3e3, Em = 3, Dm = "X-Ikon-Startup-Failed", Om = "startup_failed", km = 1e3, Am = 4;
4129
- async function jm(e, t, n, r) {
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) {
4130
4152
  if (e) try {
4131
4153
  let i = await fetch(`${n}/anonymous`, {
4132
4154
  method: "POST",
@@ -4147,7 +4169,7 @@ async function jm(e, t, n, r) {
4147
4169
  U.warn("Anonymous auth returned no token");
4148
4170
  return;
4149
4171
  }
4150
- let o = _m(a.token);
4172
+ let o = xm(a.token);
4151
4173
  if (!o) {
4152
4174
  U.warn("Anonymous auth token had no extractable userId");
4153
4175
  return;
@@ -4161,7 +4183,7 @@ async function jm(e, t, n, r) {
4161
4183
  return;
4162
4184
  }
4163
4185
  }
4164
- async function Mm(e, t, n, r) {
4186
+ async function Im(e, t, n, r) {
4165
4187
  try {
4166
4188
  let i = await fetch(`${e}/profiles/me?space=${encodeURIComponent(t)}`, {
4167
4189
  method: "GET",
@@ -4173,7 +4195,7 @@ async function Mm(e, t, n, r) {
4173
4195
  U.warn("Failed to ensure profile:", e);
4174
4196
  }
4175
4197
  }
4176
- async function Nm(e) {
4198
+ async function Lm(e) {
4177
4199
  let t = await e.text().catch(() => "Unknown error");
4178
4200
  try {
4179
4201
  let e = JSON.parse(t);
@@ -4181,16 +4203,16 @@ async function Nm(e) {
4181
4203
  } catch {}
4182
4204
  return t;
4183
4205
  }
4184
- async function Pm(e) {
4206
+ async function Rm(e) {
4185
4207
  if (e.ok) return;
4186
- let t = await Nm(e);
4187
- throw e.status === 403 ? new Ml(`Access denied: ${t}`, t) : Fm("Failed to get or create profile", e.status, t);
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);
4188
4210
  }
4189
- function Fm(e, t, n) {
4211
+ function zm(e, t, n) {
4190
4212
  let r = `${e}: ${t} ${n}`;
4191
4213
  return t >= 500 ? new Fl(r, t) : new T(r);
4192
4214
  }
4193
- function Im(e, t, n) {
4215
+ function Bm(e, t, n) {
4194
4216
  let r = {
4195
4217
  method: "POST",
4196
4218
  headers: {
@@ -4202,35 +4224,35 @@ function Im(e, t, n) {
4202
4224
  };
4203
4225
  return t || (r.credentials = "include"), r;
4204
4226
  }
4205
- async function Lm(e, t, n, r) {
4206
- let i = `${e}/init`, a = await fetch(i, Im(t, n, r));
4227
+ async function Vm(e, t, n, r) {
4228
+ let i = `${e}/init`, a = await fetch(i, Bm(t, n, r));
4207
4229
  if (!a.ok) {
4208
- let e = await Nm(a);
4209
- throw a.status === 403 ? new Ml(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new Nl(t.sessionIdentityHash) : Fm("Backend init failed", a.status, e);
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);
4210
4232
  }
4211
4233
  return a.json();
4212
4234
  }
4213
- function Rm(e, t) {
4235
+ function Hm(e, t) {
4214
4236
  return e.startupFailed ? new O() : new Al(t);
4215
4237
  }
4216
4238
  async function G(e, t, n) {
4217
- let r = I(n ?? Cm), i = t ? gd([t, r]) : r, a = Date.now(), o = await fetch(e, { signal: i });
4239
+ let r = I(n ?? Dm), i = t ? gd([t, r]) : r, a = Date.now(), o = await fetch(e, { signal: i });
4218
4240
  if (!o.ok) {
4219
4241
  let e = await o.text().catch(() => "Unknown error");
4220
- throw o.status === 429 ? new Pl(`Server is at capacity: ${e}`) : o.headers.get(Dm) || e.includes(Om) ? new O() : Fm("Failed to connect", o.status, e);
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);
4221
4243
  }
4222
4244
  let s = await o.arrayBuffer(), c = await An(new Uint8Array(s));
4223
4245
  return U.debug(`Connect URL fetched in ${Date.now() - a}ms`), { authResponse: c };
4224
4246
  }
4225
- async function zm(e, t) {
4247
+ async function Um(e, t) {
4226
4248
  try {
4227
- let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = I(Tm), a = t ? gd([t, i]) : i;
4249
+ let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = I(km), a = t ? gd([t, i]) : i;
4228
4250
  return (await fetch(r, { signal: a })).ok;
4229
4251
  } catch {
4230
4252
  return !1;
4231
4253
  }
4232
4254
  }
4233
- async function Bm(e, t, n, r, i) {
4255
+ async function Wm(e, t, n, r, i) {
4234
4256
  let a = [];
4235
4257
  if (n === "force-proxy" ? t && a.push({
4236
4258
  url: t,
@@ -4253,9 +4275,9 @@ async function Bm(e, t, n, r, i) {
4253
4275
  })), a.length === 0) throw new T("No connect URL available");
4254
4276
  U.debug(`Auth URL order: [${a.map((e) => e.isProxy ? "proxy" : "direct").join(", ")}], mode: ${n}, proxyPreferred: ${r}`);
4255
4277
  let o = n === "auto" && a.length > 1 && !a[0].isProxy, s = Date.now(), c = 0;
4256
- for (; c < bm || Date.now() - s < xm;) {
4278
+ for (; c < wm || Date.now() - s < Tm;) {
4257
4279
  for (let t = 0; t < a.length; t++) {
4258
- let n = a[t], r = c === 0 && t === 0 && o ? wm : Cm;
4280
+ let n = a[t], r = c === 0 && t === 0 && o ? Om : Dm;
4259
4281
  try {
4260
4282
  let t = await G(n.url, i, r);
4261
4283
  return t.usedProxyUrl = n.isProxy, t.directUrl = e, U.debug(`Auth succeeded via ${n.isProxy ? "proxy" : "direct"} URL`), t;
@@ -4264,12 +4286,12 @@ async function Bm(e, t, n, r, i) {
4264
4286
  U.warn(`Auth via ${n.isProxy ? "proxy" : "direct"} URL failed (round ${c + 1}, timeout ${r}ms): ${e}`);
4265
4287
  }
4266
4288
  }
4267
- c++, await Ll(Sm, i);
4289
+ c++, await Ll(Em, i);
4268
4290
  }
4269
4291
  throw new T("Failed to connect after exhausting all URL attempts");
4270
4292
  }
4271
- function Vm(e, t, n = "", r = !0) {
4272
- let i = df();
4293
+ function Gm(e, t, n = "", r = !0) {
4294
+ let i = hf();
4273
4295
  return Zt({
4274
4296
  ServerSessionId: "",
4275
4297
  ContextType: m.Browser,
@@ -4279,7 +4301,7 @@ function Vm(e, t, n = "", r = !0) {
4279
4301
  IsSnapshot: gu(),
4280
4302
  Description: e.description ?? "Ikon SDK TypeScript",
4281
4303
  UserId: t,
4282
- DeviceId: e.deviceId ?? hm(),
4304
+ DeviceId: e.deviceId ?? ym(),
4283
4305
  ProductId: e.productId ?? "ikon-sdk",
4284
4306
  VersionId: e.versionId ?? "1.0.0",
4285
4307
  InstallId: e.installId ?? "",
@@ -4287,26 +4309,26 @@ function Vm(e, t, n = "", r = !0) {
4287
4309
  OpcodeGroupsFromServer: e.opcodeGroupsFromServer ?? W,
4288
4310
  OpcodeGroupsToServer: e.opcodeGroupsToServer ?? W,
4289
4311
  ProtocolVersion: 1,
4290
- SdkCapability: Am,
4312
+ SdkCapability: Pm,
4291
4313
  HasInput: !1,
4292
4314
  AuthSessionId: n,
4293
4315
  IsAnonymous: r,
4294
4316
  IsGlobal: !1,
4295
4317
  ReceiveAllMessages: !1,
4296
4318
  UserAgent: typeof navigator < "u" ? navigator.userAgent : "",
4297
- ClientType: Cf(),
4319
+ ClientType: Df(),
4298
4320
  Parameters: e.parameters ?? {},
4299
4321
  ViewportWidth: i.width,
4300
4322
  ViewportHeight: i.height,
4301
- Theme: uf(),
4302
- Timezone: xf(),
4303
- IsTouchDevice: Sf(),
4323
+ Theme: mf(),
4324
+ Timezone: Tf(),
4325
+ IsTouchDevice: Ef(),
4304
4326
  InitialPath: Hd(),
4305
4327
  InitialUrl: Ud(),
4306
4328
  SupportsCompression: Oe()
4307
4329
  });
4308
4330
  }
4309
- function Hm(e) {
4331
+ function Km(e) {
4310
4332
  return {
4311
4333
  ServerSessionId: e.ServerSessionId,
4312
4334
  ContextType: e.ContextType,
@@ -4343,26 +4365,26 @@ function Hm(e) {
4343
4365
  SupportsCompression: e.SupportsCompression
4344
4366
  };
4345
4367
  }
4346
- async function Um(e, t) {
4368
+ async function qm(e, t) {
4347
4369
  let n = `https://${e.host}:${e.httpsPort}`;
4348
4370
  U.debug(`Authenticating with local server: ${n}`);
4349
4371
  let r = {
4350
4372
  ...Id(),
4351
4373
  ...e.parameters
4352
- }, i = e.deviceId ?? hm(), a = e.userId, o = e.token;
4374
+ }, i = e.deviceId ?? ym(), a = e.userId, o = e.token;
4353
4375
  if (!a) {
4354
- let n = await jm(e.spaceId, i, await Pd(e.authUrl), t);
4376
+ let n = await Fm(e.spaceId, i, await Pd(e.authUrl), t);
4355
4377
  n && (a = n.userId, o = n.token);
4356
4378
  }
4357
4379
  if (a || (a = i, U.debug("Using deviceId as userId fallback")), e.spaceId && o) if (e.token) {
4358
4380
  let n = jd(e.backendUrl);
4359
- await Pm(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
4381
+ await Rm(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
4360
4382
  method: "GET",
4361
4383
  headers: { Authorization: `Bearer ${o}` },
4362
4384
  signal: t
4363
4385
  }));
4364
- } else await Mm(jd(e.backendUrl), e.spaceId, o, t);
4365
- let s = e.token ?? e.identityToken ?? o, c = s ? vm(s) : null, l = c?.authSession ?? (e.token ? "authenticated" : ""), u = c?.role ? c.role === "anonymous" : !e.token, d = Hm(Vm({
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({
4366
4388
  ...e,
4367
4389
  parameters: r
4368
4390
  }, a, l, u)), f = await fetch(`${n}/connect-token`, {
@@ -4373,14 +4395,14 @@ async function Um(e, t) {
4373
4395
  });
4374
4396
  if (!f.ok) {
4375
4397
  let e = await f.text().catch(() => "Unknown error");
4376
- throw Fm("Failed to get connect token", f.status, e);
4398
+ throw zm("Failed to get connect token", f.status, e);
4377
4399
  }
4378
4400
  let p = (await f.json()).token;
4379
4401
  if (!p) throw new T("Server did not return a token");
4380
4402
  let m = `${n}/connect?token=${encodeURIComponent(p)}`, h = await G(m, t);
4381
4403
  return h.directUrl = m, h.backendUrl = jd(e.backendUrl), h.authToken = o, h;
4382
4404
  }
4383
- async function Wm(e, t, n = "auto", r = !1) {
4405
+ async function Jm(e, t, n = "auto", r = !1) {
4384
4406
  let i = Ad(e.backendType);
4385
4407
  U.debug(`Authenticating with cloud server: ${i}, space ID: ${e.spaceId}`);
4386
4408
  let a = await fetch(`${i}/auth/api-key`, {
@@ -4395,14 +4417,14 @@ async function Wm(e, t, n = "auto", r = !1) {
4395
4417
  });
4396
4418
  if (!a.ok) {
4397
4419
  let e = await a.text().catch(() => "Unknown error");
4398
- throw Fm("API key authentication failed", a.status, e);
4420
+ throw zm("API key authentication failed", a.status, e);
4399
4421
  }
4400
4422
  let o = (await a.json()).token;
4401
4423
  if (!o) throw new T("Backend did not return a token");
4402
4424
  let s = Id(), c = e.provisioningTimeoutMs ?? 6e4, l = {
4403
4425
  ...s,
4404
4426
  ...e.parameters
4405
- }, u = df(), d = j() ? Em : 1;
4427
+ }, u = hf(), d = j() ? Am : 1;
4406
4428
  for (let a = 0; a < d; a++) try {
4407
4429
  let a = {
4408
4430
  space: e.spaceId,
@@ -4410,13 +4432,13 @@ async function Wm(e, t, n = "auto", r = !1) {
4410
4432
  params: e.parameters,
4411
4433
  waitForRunning: !0,
4412
4434
  waitForRunningTimeoutMs: c,
4413
- connectTraceId: um(),
4435
+ connectTraceId: mm(),
4414
4436
  contextType: m.Plugin,
4415
4437
  userType: e.userType ?? p.Human,
4416
- clientType: e.clientType ?? Cf(),
4438
+ clientType: e.clientType ?? Df(),
4417
4439
  payloadType: me.Teleport,
4418
4440
  description: e.description ?? "Ikon SDK TypeScript",
4419
- deviceId: e.deviceId ?? hm(),
4441
+ deviceId: e.deviceId ?? ym(),
4420
4442
  productId: e.productId ?? "",
4421
4443
  versionId: e.versionId ?? "",
4422
4444
  installId: e.installId ?? "",
@@ -4428,32 +4450,32 @@ async function Wm(e, t, n = "auto", r = !1) {
4428
4450
  launchParams: l,
4429
4451
  viewportWidth: u.width,
4430
4452
  viewportHeight: u.height,
4431
- theme: uf(),
4432
- timezone: xf(),
4433
- isTouchDevice: Sf(),
4453
+ theme: mf(),
4454
+ timezone: Tf(),
4455
+ isTouchDevice: Ef(),
4434
4456
  initialPath: Hd(),
4435
4457
  initialUrl: Ud(),
4436
4458
  sdkType: 2,
4437
- sdkCapability: Am,
4459
+ sdkCapability: Pm,
4438
4460
  supportsCompression: Oe(),
4439
4461
  isSnapshot: gu()
4440
- }, s = t ? gd([t, I(c)]) : I(c), d = await Lm(i, a, o, s);
4441
- if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Rm(d, c);
4442
- let f = await Bm(d.configuration.url, d.configuration.proxyUrl, n, r, s);
4443
- return f.backendUrl = i, f.authToken = o, f.brandingRequired = d.configuration.brandingRequired ?? !1, _p(d.configuration.push), f;
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;
4444
4466
  } catch (e) {
4445
4467
  if (e instanceof Ml || e instanceof Pl || e instanceof Nl || e instanceof O || a === d - 1) throw e;
4446
- U.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await Ll(km * (a + 1), t);
4468
+ U.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await Ll(Nm * (a + 1), t);
4447
4469
  }
4448
4470
  throw new T("Failed to init after all attempts");
4449
4471
  }
4450
- async function Gm(e, t, n = "auto", r = !1) {
4472
+ async function Ym(e, t, n = "auto", r = !1) {
4451
4473
  let i = Ad(e.backendType), a = e.token;
4452
4474
  U.debug(`Authenticating with session token to: ${i}, space ID: ${e.spaceId}`);
4453
4475
  let o = Id(), s = e.provisioningTimeoutMs ?? 6e4, c = {
4454
4476
  ...o,
4455
4477
  ...e.parameters
4456
- }, l = df(), u = j() ? Em : 1;
4478
+ }, l = hf(), u = j() ? Am : 1;
4457
4479
  for (let o = 0; o < u; o++) try {
4458
4480
  let o = {
4459
4481
  space: e.spaceId,
@@ -4461,13 +4483,13 @@ async function Gm(e, t, n = "auto", r = !1) {
4461
4483
  params: e.parameters,
4462
4484
  waitForRunning: !0,
4463
4485
  waitForRunningTimeoutMs: s,
4464
- connectTraceId: um(),
4486
+ connectTraceId: mm(),
4465
4487
  contextType: m.Browser,
4466
4488
  userType: p.Human,
4467
- clientType: Cf(),
4489
+ clientType: Df(),
4468
4490
  payloadType: me.Teleport,
4469
4491
  description: e.description ?? "Ikon SDK TypeScript",
4470
- deviceId: e.deviceId ?? hm(),
4492
+ deviceId: e.deviceId ?? ym(),
4471
4493
  productId: e.productId ?? "",
4472
4494
  versionId: e.versionId ?? "",
4473
4495
  installId: e.installId ?? "",
@@ -4479,39 +4501,39 @@ async function Gm(e, t, n = "auto", r = !1) {
4479
4501
  launchParams: c,
4480
4502
  viewportWidth: l.width,
4481
4503
  viewportHeight: l.height,
4482
- theme: uf(),
4483
- timezone: xf(),
4484
- isTouchDevice: Sf(),
4504
+ theme: mf(),
4505
+ timezone: Tf(),
4506
+ isTouchDevice: Ef(),
4485
4507
  initialPath: Hd(),
4486
4508
  initialUrl: Ud(),
4487
4509
  sdkType: 2,
4488
- sdkCapability: Am,
4510
+ sdkCapability: Pm,
4489
4511
  supportsCompression: Oe(),
4490
4512
  isSnapshot: gu()
4491
- }, u = t ? gd([t, I(s)]) : I(s), d = await Lm(i, o, a, u);
4492
- if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Rm(d, s);
4493
- let f = await Bm(d.configuration.url, d.configuration.proxyUrl, n, r, u);
4494
- return f.backendUrl = i, f.authToken = a, f.brandingRequired = d.configuration.brandingRequired ?? !1, _p(d.configuration.push), f;
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;
4495
4517
  } catch (e) {
4496
4518
  if (e instanceof Ml || e instanceof Pl || e instanceof Nl || e instanceof O || o === u - 1) throw e;
4497
- U.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await Ll(km * (o + 1), t);
4519
+ U.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await Ll(Nm * (o + 1), t);
4498
4520
  }
4499
4521
  throw new T("Failed to init after all attempts");
4500
4522
  }
4501
4523
  //#endregion
4502
4524
  //#region src/functions/type-conversion.ts
4503
- var Km = /* @__PURE__ */ new Uint8Array();
4504
- function qm(e) {
4525
+ var Xm = /* @__PURE__ */ new Uint8Array();
4526
+ function Zm(e) {
4505
4527
  switch (e.kind) {
4506
4528
  case "array": return {
4507
4529
  kind: "array",
4508
- element: qm(e.element),
4530
+ element: Zm(e.element),
4509
4531
  nullable: e.nullable ?? !1
4510
4532
  };
4511
4533
  case "dictionary": return {
4512
4534
  kind: "dictionary",
4513
4535
  keyType: e.keyType ?? "string",
4514
- value: qm(e.value),
4536
+ value: Zm(e.value),
4515
4537
  nullable: e.nullable ?? !1
4516
4538
  };
4517
4539
  default: return {
@@ -4520,17 +4542,17 @@ function qm(e) {
4520
4542
  };
4521
4543
  }
4522
4544
  }
4523
- function Jm(e) {
4545
+ function Qm(e) {
4524
4546
  switch (e.kind) {
4525
4547
  case "boolean": return "System.Boolean";
4526
4548
  case "number": return "System.Double";
4527
4549
  case "string": return "System.String";
4528
- case "array": return `System.Collections.Generic.List\`1[${Jm(e.element)}]`;
4529
- case "dictionary": return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${Jm(e.value)}]`;
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)}]`;
4530
4552
  default: return e;
4531
4553
  }
4532
4554
  }
4533
- function Ym(e, t) {
4555
+ function $m(e, t) {
4534
4556
  if (e === void 0 || e === "") return;
4535
4557
  let n = JSON.parse(e);
4536
4558
  if (n === null) {
@@ -4539,7 +4561,7 @@ function Ym(e, t) {
4539
4561
  }
4540
4562
  return n;
4541
4563
  }
4542
- function Xm(e, t) {
4564
+ function eh(e, t) {
4543
4565
  if (e === void 0) return "null";
4544
4566
  if (e === null) {
4545
4567
  if (!t.nullable) throw Error("Value cannot be null for non-nullable type");
@@ -4547,9 +4569,9 @@ function Xm(e, t) {
4547
4569
  }
4548
4570
  return JSON.stringify(e);
4549
4571
  }
4550
- function Zm(e, t) {
4572
+ function th(e, t) {
4551
4573
  let r = (e.parameters ?? []).map((e) => {
4552
- let t = qm(e.type), n = Object.prototype.hasOwnProperty.call(e, "defaultValue"), r = n ? Xm(e.defaultValue, t) : "";
4574
+ let t = Zm(e.type), n = Object.prototype.hasOwnProperty.call(e, "defaultValue"), r = n ? eh(e.defaultValue, t) : "";
4553
4575
  return {
4554
4576
  name: e.name,
4555
4577
  descriptor: t,
@@ -4557,7 +4579,7 @@ function Zm(e, t) {
4557
4579
  defaultValueJson: r,
4558
4580
  description: e.description
4559
4581
  };
4560
- }), i = qm(e.returnType);
4582
+ }), i = Zm(e.returnType);
4561
4583
  return {
4562
4584
  definition: e,
4563
4585
  handler: t,
@@ -4567,7 +4589,7 @@ function Zm(e, t) {
4567
4589
  Description: e.description ?? "",
4568
4590
  LlmInlineResult: e.llmInlineResult ?? !1,
4569
4591
  LlmCallOnlyOnce: e.llmCallOnlyOnce ?? !1,
4570
- ResultTypeName: Jm(i),
4592
+ ResultTypeName: Qm(i),
4571
4593
  IsEnumerable: !1,
4572
4594
  EnumerableItemTypeName: "",
4573
4595
  IsCancellable: !1,
@@ -4576,10 +4598,10 @@ function Zm(e, t) {
4576
4598
  Parameters: r.map((e, t) => ({
4577
4599
  ParameterIndex: t,
4578
4600
  ParameterName: e.name,
4579
- TypeName: Jm(e.descriptor),
4601
+ TypeName: Qm(e.descriptor),
4580
4602
  HasDefaultValue: e.hasDefaultValue,
4581
4603
  DefaultValueJson: e.defaultValueJson,
4582
- DefaultValueData: Km,
4604
+ DefaultValueData: Xm,
4583
4605
  IsEnumerable: !1,
4584
4606
  EnumerableItemTypeName: "",
4585
4607
  Description: e.description ?? ""
@@ -4591,24 +4613,24 @@ function Zm(e, t) {
4591
4613
  }
4592
4614
  //#endregion
4593
4615
  //#region src/functions/types.ts
4594
- function Qm(e, t) {
4616
+ function nh(e, t) {
4595
4617
  return {
4596
4618
  value: e,
4597
4619
  data: t
4598
4620
  };
4599
4621
  }
4600
- var $m = class extends Error {
4622
+ var rh = class extends Error {
4601
4623
  remoteErrorType;
4602
4624
  remoteStackTrace;
4603
4625
  code;
4604
4626
  constructor(e, t, n, r = "") {
4605
4627
  super(e), this.remoteErrorType = t, this.remoteStackTrace = n, this.code = r, this.name = "FunctionCallError";
4606
4628
  }
4607
- }, eh = C("FunctionRegistry"), th = /* @__PURE__ */ new Uint8Array(), nh = 3e4;
4608
- function rh(e) {
4629
+ }, ih = C("FunctionRegistry"), ah = /* @__PURE__ */ new Uint8Array(), oh = 3e4;
4630
+ function sh(e) {
4609
4631
  return !e || typeof e != "object" ? !1 : e.data instanceof Uint8Array;
4610
4632
  }
4611
- var ih = class {
4633
+ var ch = class {
4612
4634
  functions = /* @__PURE__ */ new Map();
4613
4635
  remoteFunctions = /* @__PURE__ */ new Map();
4614
4636
  pendingCalls = /* @__PURE__ */ new Map();
@@ -4630,7 +4652,7 @@ var ih = class {
4630
4652
  };
4631
4653
  }
4632
4654
  register(e, t) {
4633
- let n = Zm(e, t);
4655
+ let n = th(e, t);
4634
4656
  return this.functions.set(e.name, n), this.isConnected && this.config && this.sendRegistration(n), () => this.unregister(e.name);
4635
4657
  }
4636
4658
  unregister(e) {
@@ -4671,7 +4693,7 @@ var ih = class {
4671
4693
  ParameterIndex: t,
4672
4694
  TypeName: n ? n.TypeName : this.inferTypeName(e),
4673
4695
  ValueJson: JSON.stringify(e ?? null),
4674
- ValueData: th
4696
+ ValueData: ah
4675
4697
  });
4676
4698
  }), c = r?.instanceId ? n.fromString(r.instanceId) : n.createZero(), l = rr(Xn({
4677
4699
  FunctionId: n.fromString(i.id),
@@ -4684,8 +4706,8 @@ var ih = class {
4684
4706
  }), this.config.sessionId, { targetIds: [i.clientSessionId] });
4685
4707
  return new Promise((t, n) => {
4686
4708
  let r = setTimeout(() => {
4687
- this.pendingCalls.delete(o.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${nh}ms`));
4688
- }, nh);
4709
+ this.pendingCalls.delete(o.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${oh}ms`));
4710
+ }, oh);
4689
4711
  this.pendingCalls.set(o.toString(), {
4690
4712
  resolve: t,
4691
4713
  reject: n,
@@ -4752,7 +4774,7 @@ var ih = class {
4752
4774
  if (t === w.ACTION_FUNCTION_CALL) {
4753
4775
  let t = i(e);
4754
4776
  return this.handleFunctionCall(e, t.senderId).catch((e) => {
4755
- eh.error("Failed to handle function call:", e);
4777
+ ih.error("Failed to handle function call:", e);
4756
4778
  }), !0;
4757
4779
  }
4758
4780
  if (t === w.ACTION_FUNCTION_RESULT) return this.handleFunctionResult(e), !0;
@@ -4774,7 +4796,7 @@ var ih = class {
4774
4796
  handleFunctionResult(e) {
4775
4797
  let t = ra(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
4776
4798
  if (!r) {
4777
- eh.warn(`Received result for unknown call: ${n}`);
4799
+ ih.warn(`Received result for unknown call: ${n}`);
4778
4800
  return;
4779
4801
  }
4780
4802
  if (this.pendingCalls.delete(n), clearTimeout(r.timeout), t.ResultData && t.ResultData.length > 0 && !t.ResultJson) {
@@ -4787,11 +4809,11 @@ var ih = class {
4787
4809
  handleFunctionError(e) {
4788
4810
  let t = Gr(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
4789
4811
  if (!r) {
4790
- eh.warn(`Received error for unknown call: ${n}`);
4812
+ ih.warn(`Received error for unknown call: ${n}`);
4791
4813
  return;
4792
4814
  }
4793
4815
  this.pendingCalls.delete(n), clearTimeout(r.timeout);
4794
- let i = new $m(t.ErrorMessage, t.ErrorTypeName, t.StackTrace, t.ErrorCode), a = {
4816
+ let i = new rh(t.ErrorMessage, t.ErrorTypeName, t.StackTrace, t.ErrorCode), a = {
4795
4817
  functionName: r.functionName,
4796
4818
  args: r.args
4797
4819
  };
@@ -4827,7 +4849,7 @@ var ih = class {
4827
4849
  async handleFunctionCall(e, t) {
4828
4850
  let n = await ir(e), r = this.functions.get(n.FunctionName);
4829
4851
  if (!r) {
4830
- eh.warn(`Received call for unknown function: ${n.FunctionName}`), this.sendError(n.CallId, n.InstanceId, t, /* @__PURE__ */ Error(`Unknown function: ${n.FunctionName}`));
4852
+ ih.warn(`Received call for unknown function: ${n.FunctionName}`), this.sendError(n.CallId, n.InstanceId, t, /* @__PURE__ */ Error(`Unknown function: ${n.FunctionName}`));
4831
4853
  return;
4832
4854
  }
4833
4855
  this.sendAck(n.CallId, n.InstanceId, t), this.executeFunction(r, n, t);
@@ -4842,14 +4864,14 @@ var ih = class {
4842
4864
  continue;
4843
4865
  }
4844
4866
  let o = a?.ValueJson;
4845
- o === void 0 || o === "" ? i.hasDefaultValue ? r.push(Ym(i.defaultValueJson, i.descriptor)) : r.push(void 0) : r.push(Ym(o, i.descriptor));
4867
+ o === void 0 || o === "" ? i.hasDefaultValue ? r.push($m(i.defaultValueJson, i.descriptor)) : r.push(void 0) : r.push($m(o, i.descriptor));
4846
4868
  }
4847
- let i = await e.handler(...r), a = i, o = th;
4848
- rh(i) && (a = i.value, o = new Uint8Array(i.data));
4849
- let s = Xm(a, e.returnType);
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);
4850
4872
  this.sendResult(t.CallId, t.InstanceId, n, e, s, o);
4851
4873
  } catch (e) {
4852
- eh.error(`Function ${t.FunctionName} execution failed:`, e), this.sendError(t.CallId, t.InstanceId, n, e instanceof Error ? e : Error(String(e)));
4874
+ ih.error(`Function ${t.FunctionName} execution failed:`, e), this.sendError(t.CallId, t.InstanceId, n, e instanceof Error ? e : Error(String(e)));
4853
4875
  }
4854
4876
  }
4855
4877
  sendAck(e, t, n) {
@@ -4865,7 +4887,7 @@ var ih = class {
4865
4887
  let o = na(Yi({
4866
4888
  CallId: e,
4867
4889
  InstanceId: t,
4868
- ResultTypeName: Jm(r.returnType),
4890
+ ResultTypeName: Qm(r.returnType),
4869
4891
  ResultJson: i,
4870
4892
  ResultData: a
4871
4893
  }), this.config.sessionId, { targetIds: [n] });
@@ -4882,7 +4904,7 @@ var ih = class {
4882
4904
  }), this.config.sessionId, { targetIds: [n] });
4883
4905
  this.config.sendProtocolMessage(i);
4884
4906
  }
4885
- }, ah = C("ReactiveRegistry"), oh = "Ikon.Reactive.Subscribe", sh = "Ikon.Reactive.Unsubscribe", ch = {
4907
+ }, lh = C("ReactiveRegistry"), uh = "Ikon.Reactive.Subscribe", dh = "Ikon.Reactive.Unsubscribe", fh = {
4886
4908
  name: "Ikon.Reactive.Update",
4887
4909
  description: "Receives reactive value updates pushed from the server when a subscribed reactive changes",
4888
4910
  returnType: { kind: "string" },
@@ -4900,7 +4922,7 @@ var ih = class {
4900
4922
  type: { kind: "string" }
4901
4923
  }
4902
4924
  ]
4903
- }, lh = class {
4925
+ }, ph = class {
4904
4926
  subscribersByKey = /* @__PURE__ */ new Map();
4905
4927
  functionRegistry;
4906
4928
  updateHandlerUnregister = null;
@@ -4908,9 +4930,9 @@ var ih = class {
4908
4930
  this.functionRegistry = e, this.registerUpdateHandler();
4909
4931
  }
4910
4932
  async subscribe(e, t, n) {
4911
- let r = n?.mount ?? "", i = uh(e, r), a = t, o = this.subscribersByKey.get(i), s = !o;
4933
+ let r = n?.mount ?? "", i = mh(e, r), a = t, o = this.subscribersByKey.get(i), s = !o;
4912
4934
  if (o || (o = /* @__PURE__ */ new Set(), this.subscribersByKey.set(i, o)), o.add(a), s) try {
4913
- t(dh(await this.functionRegistry.call(oh, [e, r])));
4935
+ t(hh(await this.functionRegistry.call(uh, [e, r])));
4914
4936
  } catch (e) {
4915
4937
  throw o.delete(a), o.size === 0 && this.subscribersByKey.delete(i), e;
4916
4938
  }
@@ -4922,46 +4944,46 @@ var ih = class {
4922
4944
  this.subscribersByKey.clear(), this.updateHandlerUnregister &&= (this.updateHandlerUnregister(), null);
4923
4945
  }
4924
4946
  unsubscribeOne(e, t, n) {
4925
- let r = uh(e, t), i = this.subscribersByKey.get(r);
4926
- i && (i.delete(n), !(i.size > 0) && (this.subscribersByKey.delete(r), this.functionRegistry.call(sh, [e, t]).catch((n) => {
4927
- ah.warn(`Failed to unsubscribe from '${e}' (mount='${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);
4928
4950
  })));
4929
4951
  }
4930
4952
  registerUpdateHandler() {
4931
4953
  let e = (...e) => {
4932
- let t = e[0], n = e[1] ?? "", r = e[2], i = uh(t, n), a = this.subscribersByKey.get(i);
4954
+ let t = e[0], n = e[1] ?? "", r = e[2], i = mh(t, n), a = this.subscribersByKey.get(i);
4933
4955
  if (!a || a.size === 0) return "";
4934
- let o = dh(r);
4956
+ let o = hh(r);
4935
4957
  for (let e of a) try {
4936
4958
  e(o);
4937
4959
  } catch (e) {
4938
- ah.warn(`Reactive update callback for '${t}' (mount='${n}') threw:`, e);
4960
+ lh.warn(`Reactive update callback for '${t}' (mount='${n}') threw:`, e);
4939
4961
  }
4940
4962
  return "";
4941
4963
  };
4942
- this.updateHandlerUnregister = this.functionRegistry.register(ch, e);
4964
+ this.updateHandlerUnregister = this.functionRegistry.register(fh, e);
4943
4965
  }
4944
4966
  };
4945
- function uh(e, t) {
4967
+ function mh(e, t) {
4946
4968
  return t.length === 0 ? e : `${e}\0${t}`;
4947
4969
  }
4948
- function dh(e) {
4970
+ function hh(e) {
4949
4971
  if (e == null || e === "") return null;
4950
4972
  try {
4951
4973
  return JSON.parse(e);
4952
4974
  } catch (t) {
4953
- return ah.warn("Failed to parse reactive value JSON, returning raw string:", t), e;
4975
+ return lh.warn("Failed to parse reactive value JSON, returning raw string:", t), e;
4954
4976
  }
4955
4977
  }
4956
4978
  //#endregion
4957
4979
  //#region src/login/login-error-interceptor.ts
4958
- var fh = "login_required", ph = (e, t) => e.code === fh ? (fd({
4980
+ var gh = "login_required", _h = (e, t) => e.code === gh ? (fd({
4959
4981
  functionName: t.functionName,
4960
4982
  args: t.args
4961
4983
  }), ld(e.message), null) : null;
4962
4984
  //#endregion
4963
4985
  //#region src/media/device-detection.ts
4964
- function mh() {
4986
+ function vh() {
4965
4987
  if (typeof navigator > "u") return !1;
4966
4988
  let e = navigator.userAgentData;
4967
4989
  if (typeof e?.mobile == "boolean") return e.mobile;
@@ -4970,7 +4992,7 @@ function mh() {
4970
4992
  }
4971
4993
  //#endregion
4972
4994
  //#region src/functions/media-capture-functions.ts
4973
- function hh(e) {
4995
+ function yh(e) {
4974
4996
  let t = e?.facingMode;
4975
4997
  if (typeof t == "string") return t === "user" || t === "environment" ? t : void 0;
4976
4998
  if (Array.isArray(t)) return t.find((e) => typeof e == "string" && (e === "user" || e === "environment")) ?? void 0;
@@ -4980,21 +5002,21 @@ function hh(e) {
4980
5002
  if (Array.isArray(e)) return e.find((e) => e === "user" || e === "environment") ?? void 0;
4981
5003
  }
4982
5004
  }
4983
- function gh(e) {
5005
+ function bh(e) {
4984
5006
  if (!(typeof e != "string" || !e.trim())) try {
4985
5007
  return JSON.parse(e);
4986
5008
  } catch {
4987
5009
  return;
4988
5010
  }
4989
5011
  }
4990
- var _h = {
5012
+ var xh = {
4991
5013
  StartVideoCapture: "ikon.client.startVideoCapture",
4992
5014
  StartAudioCapture: "ikon.client.startAudioCapture",
4993
5015
  StopCapture: "ikon.client.stopCapture",
4994
5016
  CaptureImage: "ikon.client.captureImage",
4995
5017
  GetMediaDevices: "ikon.client.getMediaDevices"
4996
- }, vh = {
4997
- name: _h.StartVideoCapture,
5018
+ }, Sh = {
5019
+ name: xh.StartVideoCapture,
4998
5020
  description: "Start camera or screen capture and stream video frames to the server",
4999
5021
  returnType: { kind: "string" },
5000
5022
  parameters: [{
@@ -5012,8 +5034,8 @@ var _h = {
5012
5034
  },
5013
5035
  description: "JSON encoded capture options"
5014
5036
  }]
5015
- }, yh = {
5016
- name: _h.StartAudioCapture,
5037
+ }, Ch = {
5038
+ name: xh.StartAudioCapture,
5017
5039
  description: "Start microphone capture and stream audio frames to the server",
5018
5040
  returnType: { kind: "string" },
5019
5041
  parameters: [{
@@ -5024,8 +5046,8 @@ var _h = {
5024
5046
  },
5025
5047
  description: "JSON encoded capture options"
5026
5048
  }]
5027
- }, bh = {
5028
- name: _h.StopCapture,
5049
+ }, wh = {
5050
+ name: xh.StopCapture,
5029
5051
  description: "Stop a previously started capture by streamId",
5030
5052
  returnType: { kind: "boolean" },
5031
5053
  parameters: [{
@@ -5033,8 +5055,8 @@ var _h = {
5033
5055
  type: { kind: "string" },
5034
5056
  description: "Stream ID to stop"
5035
5057
  }]
5036
- }, xh = {
5037
- name: _h.CaptureImage,
5058
+ }, Th = {
5059
+ name: xh.CaptureImage,
5038
5060
  description: "Capture a single image from the camera and return metadata (JSON) plus binary image data",
5039
5061
  returnType: { kind: "string" },
5040
5062
  parameters: [{
@@ -5045,24 +5067,24 @@ var _h = {
5045
5067
  },
5046
5068
  description: "JSON encoded capture options"
5047
5069
  }]
5048
- }, Sh = {
5049
- name: _h.GetMediaDevices,
5070
+ }, Eh = {
5071
+ name: xh.GetMediaDevices,
5050
5072
  description: "Get list of available media input devices",
5051
5073
  returnType: { kind: "string" },
5052
5074
  parameters: []
5053
5075
  };
5054
- function Ch(e, t) {
5076
+ function Dh(e, t) {
5055
5077
  let n = [];
5056
- return n.push(e.register(vh, async (e, n) => {
5078
+ return n.push(e.register(Sh, async (e, n) => {
5057
5079
  if (t.isWebRtcCaptureAvailable) {
5058
5080
  let e = t.webRtcSignaling;
5059
5081
  if (!e) throw Error("WebRTC signaling is not connected");
5060
- let r = gh(n);
5082
+ let r = bh(n);
5061
5083
  return await e.startVideoCapture(r?.constraints), "webrtc-video";
5062
5084
  }
5063
5085
  let r = await t.ensureMediaCapture();
5064
5086
  if (!r) throw Error("Media capture is not available in this environment");
5065
- let i = gh(n);
5087
+ let i = bh(n);
5066
5088
  return ((typeof e == "string" && e.trim().toLowerCase() === "screen" ? "screen" : "camera") == "screen" ? await r.video.startScreen({
5067
5089
  userGesture: !1,
5068
5090
  options: i,
@@ -5072,22 +5094,22 @@ function Ch(e, t) {
5072
5094
  options: i,
5073
5095
  constraints: i?.constraints
5074
5096
  })).streamId;
5075
- })), n.push(e.register(yh, async (e) => {
5097
+ })), n.push(e.register(Ch, async (e) => {
5076
5098
  if (t.isWebRtcCaptureAvailable) {
5077
5099
  let n = t.webRtcSignaling;
5078
5100
  if (!n) throw Error("WebRTC signaling is not connected");
5079
- let r = gh(e);
5101
+ let r = bh(e);
5080
5102
  return await n.startAudioCapture(r?.constraints), "webrtc-audio";
5081
5103
  }
5082
5104
  let n = await t.ensureMediaCapture();
5083
5105
  if (!n) throw Error("Media capture is not available in this environment");
5084
- let r = gh(e);
5106
+ let r = bh(e);
5085
5107
  return (await n.audio.startMic({
5086
5108
  userGesture: !1,
5087
5109
  options: r,
5088
5110
  constraints: r?.constraints
5089
5111
  })).streamId;
5090
- })), n.push(e.register(bh, async (e) => {
5112
+ })), n.push(e.register(wh, async (e) => {
5091
5113
  if (t.isWebRtcCaptureAvailable) {
5092
5114
  let e = t.webRtcSignaling;
5093
5115
  return e && await e.stopCapture(), !0;
@@ -5096,20 +5118,20 @@ function Ch(e, t) {
5096
5118
  if (!n || typeof e != "string" || !e.trim()) return !1;
5097
5119
  let r = await n.video.stop(e), i = await n.audio.stop(e);
5098
5120
  return r || i;
5099
- })), n.push(e.register(xh, async (e) => {
5121
+ })), n.push(e.register(Th, async (e) => {
5100
5122
  let n = await t.ensureMediaCapture();
5101
5123
  if (!n) throw Error("Media capture is not available in this environment");
5102
- let r = gh(e) ?? {};
5103
- if (r.mode === "native" && mh()) {
5124
+ let r = bh(e) ?? {};
5125
+ if (r.mode === "native" && vh()) {
5104
5126
  let e = await n.image.captureFromNativeCamera({
5105
- facing: hh(r.constraints),
5127
+ facing: yh(r.constraints),
5106
5128
  mime: r.mime,
5107
5129
  quality: r.quality,
5108
5130
  width: r.width,
5109
5131
  height: r.height
5110
5132
  });
5111
5133
  if (!e) throw Error("Native camera capture was cancelled");
5112
- return Qm(JSON.stringify({
5134
+ return nh(JSON.stringify({
5113
5135
  mime: e.mime,
5114
5136
  width: e.width,
5115
5137
  height: e.height
@@ -5130,12 +5152,12 @@ function Ch(e, t) {
5130
5152
  quality: r.quality,
5131
5153
  width: r.width,
5132
5154
  height: r.height
5133
- }), Qm(JSON.stringify({
5155
+ }), nh(JSON.stringify({
5134
5156
  mime: a.mime,
5135
5157
  width: a.width,
5136
5158
  height: a.height
5137
5159
  }), a.data);
5138
- })), n.push(e.register(Sh, async () => {
5160
+ })), n.push(e.register(Eh, async () => {
5139
5161
  if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) return JSON.stringify([]);
5140
5162
  let e = (await navigator.mediaDevices.enumerateDevices()).filter((e) => e.kind === "audioinput" || e.kind === "videoinput").map((e) => ({
5141
5163
  deviceId: e.deviceId,
@@ -5150,45 +5172,45 @@ function Ch(e, t) {
5150
5172
  }
5151
5173
  //#endregion
5152
5174
  //#region src/functions/sound-functions.ts
5153
- var wh = {
5175
+ var Oh = {
5154
5176
  PlaySound: "ikon.client.playSound",
5155
5177
  StopSound: "ikon.client.stopSound"
5156
- }, Th = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), Eh = 1, Dh = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", Oh = 8, kh = [], Ah = !1, q = null;
5157
- function jh() {
5158
- if (!(kh.length > 0 || typeof Audio > "u")) for (let e = 0; e < Oh; e++) {
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++) {
5159
5181
  let e = new Audio();
5160
- e.preload = "auto", kh.push(e);
5182
+ e.preload = "auto", Nh.push(e);
5161
5183
  }
5162
5184
  }
5163
- function Mh() {
5164
- if (!Ah) {
5165
- jh();
5166
- for (let e of kh) try {
5167
- e.src = Dh;
5185
+ function Ih() {
5186
+ if (!Ph) {
5187
+ Fh();
5188
+ for (let e of Nh) try {
5189
+ e.src = jh;
5168
5190
  let t = e.play();
5169
5191
  typeof t?.then == "function" ? t.then(() => {
5170
- e.pause(), e.currentTime = 0, Ah = !0, Ph();
5171
- }, () => {}) : Ah = !0;
5192
+ e.pause(), e.currentTime = 0, Ph = !0, Rh();
5193
+ }, () => {}) : Ph = !0;
5172
5194
  } catch {}
5173
- Ah && Ph();
5195
+ Ph && Rh();
5174
5196
  }
5175
5197
  }
5176
- function Nh() {
5198
+ function Lh() {
5177
5199
  if (q || typeof window > "u") return;
5178
- let e = () => Mh();
5200
+ let e = () => Ih();
5179
5201
  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 });
5180
5202
  }
5181
- function Ph() {
5203
+ function Rh() {
5182
5204
  !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);
5183
5205
  }
5184
- function Fh() {
5185
- jh();
5186
- for (let e of kh) if (e.paused || e.ended) return e;
5206
+ function zh() {
5207
+ Fh();
5208
+ for (let e of Nh) if (e.paused || e.ended) return e;
5187
5209
  let e = new Audio();
5188
- return e.preload = "auto", kh.push(e), e;
5210
+ return e.preload = "auto", Nh.push(e), e;
5189
5211
  }
5190
- var Ih = {
5191
- name: wh.PlaySound,
5212
+ var Bh = {
5213
+ name: Oh.PlaySound,
5192
5214
  description: "Play a sound effect",
5193
5215
  returnType: {
5194
5216
  kind: "string",
@@ -5226,19 +5248,19 @@ var Ih = {
5226
5248
  }
5227
5249
  ]
5228
5250
  };
5229
- function Lh(e, t, n, r) {
5251
+ function Vh(e, t, n, r) {
5230
5252
  if (typeof window > "u" || typeof Audio > "u" || typeof e != "string" || !e.trim()) return Promise.resolve(null);
5231
5253
  let i = e;
5232
- if (typeof t == "string" && t && Th.set(t, e), e.startsWith("sound:")) {
5233
- let t = e.slice(6), n = Th.get(t);
5254
+ if (typeof t == "string" && t && kh.set(t, e), e.startsWith("sound:")) {
5255
+ let t = e.slice(6), n = kh.get(t);
5234
5256
  if (!n) return Promise.resolve(null);
5235
5257
  i = n;
5236
5258
  }
5237
5259
  return new Promise((e) => {
5238
5260
  try {
5239
- let t = Fh();
5261
+ let t = zh();
5240
5262
  t.src = i, t.currentTime = 0, t.loop = r === !0, t.volume = typeof n == "number" ? Math.max(0, Math.min(1, n)) : 1;
5241
- let a = `sound-${Eh++}`, o = () => {
5263
+ let a = `sound-${Ah++}`, o = () => {
5242
5264
  K.delete(a), t.removeEventListener("ended", o), t.removeEventListener("error", o);
5243
5265
  };
5244
5266
  t.addEventListener("ended", o), t.addEventListener("error", o), K.set(a, t), t.play().then(() => e(a), () => {
@@ -5249,8 +5271,8 @@ function Lh(e, t, n, r) {
5249
5271
  }
5250
5272
  });
5251
5273
  }
5252
- var Rh = {
5253
- name: wh.StopSound,
5274
+ var Hh = {
5275
+ name: Oh.StopSound,
5254
5276
  description: "Stop a playing sound by ID",
5255
5277
  returnType: { kind: "boolean" },
5256
5278
  parameters: [{
@@ -5259,7 +5281,7 @@ var Rh = {
5259
5281
  description: "Playback ID from playSound"
5260
5282
  }]
5261
5283
  };
5262
- function zh(e) {
5284
+ function Uh(e) {
5263
5285
  if (typeof e != "string") return !1;
5264
5286
  let t = K.get(e);
5265
5287
  if (!t) return !1;
@@ -5269,33 +5291,33 @@ function zh(e) {
5269
5291
  return !1;
5270
5292
  }
5271
5293
  }
5272
- function Bh() {
5273
- Th.clear();
5294
+ function Wh() {
5295
+ kh.clear();
5274
5296
  for (let [e, t] of K) {
5275
5297
  try {
5276
5298
  t.pause(), t.currentTime = 0;
5277
5299
  } catch {}
5278
5300
  K.delete(e);
5279
5301
  }
5280
- Ph();
5302
+ Rh();
5281
5303
  }
5282
- var Vh = [{
5283
- definition: Ih,
5284
- handler: Lh
5304
+ var Gh = [{
5305
+ definition: Bh,
5306
+ handler: Vh
5285
5307
  }, {
5286
- definition: Rh,
5287
- handler: zh
5308
+ definition: Hh,
5309
+ handler: Uh
5288
5310
  }];
5289
- function Hh(e) {
5290
- Nh();
5291
- let t = Vh.map(({ definition: t, handler: n }) => e.register(t, n));
5311
+ function Kh(e) {
5312
+ Lh();
5313
+ let t = Gh.map(({ definition: t, handler: n }) => e.register(t, n));
5292
5314
  return () => {
5293
- t.forEach((e) => e()), Bh();
5315
+ t.forEach((e) => e()), Wh();
5294
5316
  };
5295
5317
  }
5296
5318
  //#endregion
5297
5319
  //#region src/worker/viseme-worker.ts?worker
5298
- function Uh(e) {
5320
+ function qh(e) {
5299
5321
  return new Worker("" + new URL("assets/viseme-worker-TOrhAq2M.js", import.meta.url).href, {
5300
5322
  type: "module",
5301
5323
  name: e?.name
@@ -5303,7 +5325,7 @@ function Uh(e) {
5303
5325
  }
5304
5326
  //#endregion
5305
5327
  //#region src/media/viseme-tracker.ts
5306
- var Wh = C("VisemeTracker"), Gh = _e * 2, Kh = class e {
5328
+ var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5307
5329
  static MAX_WORKER_REBUILD_ATTEMPTS = 3;
5308
5330
  client;
5309
5331
  worker = null;
@@ -5323,16 +5345,16 @@ var Wh = C("VisemeTracker"), Gh = _e * 2, Kh = class e {
5323
5345
  enable() {
5324
5346
  if (this.worker) return;
5325
5347
  if (typeof Worker > "u") {
5326
- Wh.warn("Viseme worker unavailable (Workers not supported)");
5348
+ Jh.warn("Viseme worker unavailable (Workers not supported)");
5327
5349
  return;
5328
5350
  }
5329
5351
  let t = this.client.createProtocolMessagePort({ opcodeGroupsMask: w.GROUP_AUDIO });
5330
5352
  if (!t) return;
5331
5353
  this.protocolPort = t;
5332
5354
  try {
5333
- this.worker = new Uh();
5355
+ this.worker = new qh();
5334
5356
  } catch (e) {
5335
- Wh.warn(`Failed to create viseme worker: ${e}`), this.protocolPort.close(), this.protocolPort = null;
5357
+ Jh.warn(`Failed to create viseme worker: ${e}`), this.protocolPort.close(), this.protocolPort = null;
5336
5358
  return;
5337
5359
  }
5338
5360
  let n = this.worker;
@@ -5343,7 +5365,7 @@ var Wh = C("VisemeTracker"), Gh = _e * 2, Kh = class e {
5343
5365
  t.lineno,
5344
5366
  t.colno
5345
5367
  ].filter((e) => e != null && String(e).length > 0);
5346
- Wh.error(`Viseme worker failed: ${n.join(" ")}`.trim()), this.dispose(), this.workerRebuildAttempts < e.MAX_WORKER_REBUILD_ATTEMPTS ? (this.workerRebuildAttempts++, this.enable()) : Wh.error("Viseme worker crashed repeatedly, giving up on rebuilds");
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");
5347
5369
  }), n.postMessage({
5348
5370
  type: "attachProtocolPort",
5349
5371
  port: t.port
@@ -5398,7 +5420,7 @@ var Wh = C("VisemeTracker"), Gh = _e * 2, Kh = class e {
5398
5420
  if (!t.timingEstablished || t.count === 0) continue;
5399
5421
  let n = e - t.playbackStartTime;
5400
5422
  if (n < 0) continue;
5401
- let r = n * Gh, i = t.frames, a = t.count, o = (t.head - a + x) % x, s = null, c = null;
5423
+ let r = n * Yh, i = t.frames, a = t.count, o = (t.head - a + x) % x, s = null, c = null;
5402
5424
  for (let e = 0; e < a; e++) {
5403
5425
  let t = i[(o + e) % x], n = t.samplePosition + Math.max(t.frameSamples, 1);
5404
5426
  if (t.samplePosition <= r && (s = t), n > r && !c && (c = t, t.samplePosition <= r)) break;
@@ -5472,35 +5494,35 @@ var Wh = C("VisemeTracker"), Gh = _e * 2, Kh = class e {
5472
5494
  }
5473
5495
  }
5474
5496
  }
5475
- }, qh = C("DebugMode"), J = !1;
5476
- function Jh() {
5477
- return J ? !0 : (J = au(), J && (ye(S.DEBUG), qh.info("Debug mode enabled")), J);
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);
5478
5500
  }
5479
- function Yh() {
5501
+ function $h() {
5480
5502
  return J;
5481
5503
  }
5482
- function Xh() {
5483
- J || (J = !0, ye(S.DEBUG), qh.info("Debug mode enabled"), tu(Vl, "true"));
5504
+ function eg() {
5505
+ J || (J = !0, ye(S.DEBUG), Zh.info("Debug mode enabled"), tu(Vl, "true"));
5484
5506
  }
5485
5507
  //#endregion
5486
5508
  //#region src/utils/inspect-mode.ts
5487
- var Zh = "ikon-inspect-mode-changed", Y = !1;
5488
- function Qh() {
5489
- typeof window < "u" && window.dispatchEvent(new Event(Zh));
5509
+ var tg = "ikon-inspect-mode-changed", Y = !1;
5510
+ function ng() {
5511
+ typeof window < "u" && window.dispatchEvent(new Event(tg));
5490
5512
  }
5491
- function $h() {
5513
+ function rg() {
5492
5514
  let e = fu();
5493
- return e !== Y && (Y = e, Qh()), Y;
5515
+ return e !== Y && (Y = e, ng()), Y;
5494
5516
  }
5495
- function eg() {
5517
+ function ig() {
5496
5518
  return Y;
5497
5519
  }
5498
- function tg() {
5499
- Y || (Y = !0, tu(Jl, "true"), Qh());
5520
+ function ag() {
5521
+ Y || (Y = !0, tu(Jl, "true"), ng());
5500
5522
  }
5501
5523
  //#endregion
5502
5524
  //#region src/utils/external-link.ts
5503
- var ng = /* @__PURE__ */ new Set([
5525
+ var og = /* @__PURE__ */ new Set([
5504
5526
  "http",
5505
5527
  "https",
5506
5528
  "file",
@@ -5517,12 +5539,12 @@ var ng = /* @__PURE__ */ new Set([
5517
5539
  "edge",
5518
5540
  "moz-extension",
5519
5541
  "safari-web-extension"
5520
- ]), rg = /^([a-z][a-z0-9+.-]*):/i;
5521
- function ig(e) {
5522
- let t = rg.exec(e.trim());
5523
- return t ? !ng.has(t[1].toLowerCase()) : !1;
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;
5524
5546
  }
5525
- function ag(e) {
5547
+ function lg(e) {
5526
5548
  if (typeof document > "u") return;
5527
5549
  let t = document.createElement("iframe");
5528
5550
  t.setAttribute("aria-hidden", "true"), t.style.display = "none", document.body.appendChild(t);
@@ -5536,7 +5558,7 @@ function ag(e) {
5536
5558
  }
5537
5559
  //#endregion
5538
5560
  //#region src/utils/browser-support.ts
5539
- var og = [
5561
+ var ug = [
5540
5562
  {
5541
5563
  name: "WebSocket",
5542
5564
  isPresent: () => typeof WebSocket < "u"
@@ -5558,9 +5580,9 @@ var og = [
5558
5580
  isPresent: () => typeof Promise < "u" && typeof Promise.allSettled == "function"
5559
5581
  }
5560
5582
  ];
5561
- function sg() {
5583
+ function dg() {
5562
5584
  let e = [];
5563
- for (let t of og) {
5585
+ for (let t of ug) {
5564
5586
  let n;
5565
5587
  try {
5566
5588
  n = t.isPresent();
@@ -5576,22 +5598,22 @@ function sg() {
5576
5598
  }
5577
5599
  //#endregion
5578
5600
  //#region src/transport/transport-probe.ts
5579
- var cg = C("TransportProbe"), lg = 3e3;
5580
- async function ug(e, t, n) {
5581
- let r = n?.timeoutMs ?? lg, i = n?.signal;
5601
+ var fg = C("TransportProbe"), pg = 3e3;
5602
+ async function mg(e, t, n) {
5603
+ let r = n?.timeoutMs ?? pg, i = n?.signal;
5582
5604
  if (i?.aborted) return !1;
5583
5605
  let a = Date.now();
5584
5606
  try {
5585
- let n = dg(e) ? await pg(t, r, i) : await fg(t, r, i);
5586
- return cg.debug(`Probe ${b[e]} ${t}: ${n ? "reachable" : "unreachable"} in ${Date.now() - a}ms`), n;
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;
5587
5609
  } catch (n) {
5588
- return cg.debug(`Probe ${b[e]} ${t} failed after ${Date.now() - a}ms: ${n instanceof Error ? n.message : n}`), !1;
5610
+ return fg.debug(`Probe ${b[e]} ${t} failed after ${Date.now() - a}ms: ${n instanceof Error ? n.message : n}`), !1;
5589
5611
  }
5590
5612
  }
5591
- function dg(e) {
5613
+ function hg(e) {
5592
5614
  return e === b.WebTransport || e === b.WebTransportProxy;
5593
5615
  }
5594
- function fg(e, t, n) {
5616
+ function gg(e, t, n) {
5595
5617
  return typeof WebSocket > "u" ? Promise.resolve(!1) : new Promise((r) => {
5596
5618
  let i = new WebSocket(e), a = !1, o = (e) => {
5597
5619
  if (!a) {
@@ -5605,7 +5627,7 @@ function fg(e, t, n) {
5605
5627
  n?.addEventListener("abort", s, { once: !0 }), i.onopen = () => o(!0), i.onerror = () => o(!1), i.onclose = () => o(!1);
5606
5628
  });
5607
5629
  }
5608
- async function pg(e, t, n) {
5630
+ async function _g(e, t, n) {
5609
5631
  if (!wu()) return !1;
5610
5632
  let r = new WebTransport(e), i;
5611
5633
  try {
@@ -5624,7 +5646,7 @@ async function pg(e, t, n) {
5624
5646
  }
5625
5647
  //#endregion
5626
5648
  //#region src/worker/protocol-worker.ts?worker
5627
- function mg(e) {
5649
+ function vg(e) {
5628
5650
  return new Worker("" + new URL("assets/protocol-worker-sC4mqNcM.js", import.meta.url).href, {
5629
5651
  type: "module",
5630
5652
  name: e?.name
@@ -5632,12 +5654,12 @@ function mg(e) {
5632
5654
  }
5633
5655
  //#endregion
5634
5656
  //#region src/client/endpoint-selector.ts
5635
- var hg = {
5657
+ var yg = {
5636
5658
  [b.WebTransport]: 0,
5637
5659
  [b.WebSocket]: 1,
5638
5660
  [b.WebTransportProxy]: 2,
5639
5661
  [b.WebSocketProxy]: 3
5640
- }, gg = /* @__PURE__ */ new Set([b.WebTransportProxy, b.WebSocketProxy]), _g = /* @__PURE__ */ new Set([b.WebTransport, b.WebSocket]), vg = /* @__PURE__ */ new Set([b.WebSocket, b.WebSocketProxy]), yg = /* @__PURE__ */ new Set([b.WebTransport, b.WebTransportProxy]), X = C("EndpointSelector"), bg = "ikon-endpoint-type", xg = "ikon-proxy-preferred", Sg = "ikon-endpoint-timestamp", Cg = "ikon-endpoint-revalidated", wg = 864e5, Tg = class {
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 {
5641
5663
  isLocal;
5642
5664
  _proxyMode;
5643
5665
  _websocket;
@@ -5659,27 +5681,27 @@ var hg = {
5659
5681
  markProxyPreferred() {
5660
5682
  this._proxyPreferred = !0;
5661
5683
  try {
5662
- localStorage.setItem(xg, "true"), localStorage.setItem(Sg, String(Date.now()));
5684
+ localStorage.setItem(Tg, "true"), localStorage.setItem(Eg, String(Date.now()));
5663
5685
  } catch {}
5664
5686
  X.debug("Marked proxy as preferred");
5665
5687
  }
5666
5688
  clearProxyPreference() {
5667
5689
  this._proxyPreferred = !1;
5668
5690
  try {
5669
- localStorage.removeItem(xg);
5691
+ localStorage.removeItem(Tg);
5670
5692
  } catch {}
5671
5693
  }
5672
5694
  getOrderedTypes(e) {
5673
5695
  let t = Array.from(e.keys());
5674
5696
  if (this.isLocal) return t;
5675
5697
  let n;
5676
- n = this._proxyMode === "force-proxy" ? t.filter((e) => gg.has(e)) : this._proxyMode === "force-direct" ? t.filter((e) => _g.has(e)) : t, n = this.filterByTransport(n);
5677
- let r = [...n].sort((e, t) => (hg[e] ?? 999) - (hg[t] ?? 999));
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));
5678
5700
  if (this._proxyMode === "auto" && this._proxyPreferred) {
5679
- let e = r.filter((e) => gg.has(e)), t = r.filter((e) => _g.has(e));
5701
+ let e = r.filter((e) => bg.has(e)), t = r.filter((e) => xg.has(e));
5680
5702
  r.length = 0, r.push(...e, ...t);
5681
5703
  }
5682
- if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this._proxyPreferred || gg.has(this.workingEndpointType))) {
5704
+ if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this._proxyPreferred || bg.has(this.workingEndpointType))) {
5683
5705
  let e = r.indexOf(this.workingEndpointType);
5684
5706
  e > 0 && (r.splice(e, 1), r.unshift(this.workingEndpointType));
5685
5707
  }
@@ -5693,17 +5715,17 @@ var hg = {
5693
5715
  }
5694
5716
  this.workingEndpointType = e;
5695
5717
  try {
5696
- localStorage.setItem(bg, String(e)), localStorage.setItem(Sg, String(Date.now())), localStorage.getItem(Cg) === null && localStorage.setItem(Cg, String(Date.now()));
5718
+ localStorage.setItem(wg, String(e)), localStorage.setItem(Eg, String(Date.now())), localStorage.getItem(Dg) === null && localStorage.setItem(Dg, String(Date.now()));
5697
5719
  } catch {}
5698
- if (gg.has(e)) {
5720
+ if (bg.has(e)) {
5699
5721
  this._proxyPreferred = !0;
5700
5722
  try {
5701
- localStorage.setItem(xg, "true");
5723
+ localStorage.setItem(Tg, "true");
5702
5724
  } catch {}
5703
- } else if (_g.has(e)) {
5725
+ } else if (xg.has(e)) {
5704
5726
  this._proxyPreferred = !1;
5705
5727
  try {
5706
- localStorage.removeItem(xg);
5728
+ localStorage.removeItem(Tg);
5707
5729
  } catch {}
5708
5730
  }
5709
5731
  X.debug(`Remembered working type: ${b[e]}`);
@@ -5712,37 +5734,37 @@ var hg = {
5712
5734
  clearRememberedType() {
5713
5735
  this.workingEndpointType = null;
5714
5736
  try {
5715
- localStorage.removeItem(bg);
5737
+ localStorage.removeItem(wg);
5716
5738
  } catch {}
5717
5739
  }
5718
5740
  needsRevalidation() {
5719
5741
  if (this.isLocal || this._proxyMode !== "auto" || this.workingEndpointType === null && !this._proxyPreferred) return !1;
5720
5742
  let e = this.revalidationAgeMs();
5721
- return e !== null && e > wg;
5743
+ return e !== null && e > Og;
5722
5744
  }
5723
5745
  getFasterTypes(e, t) {
5724
- let n = hg[e] ?? 999;
5725
- return this.filterByTransport(Array.from(t.keys())).filter((e) => (hg[e] ?? 999) < n).sort((e, t) => (hg[e] ?? 999) - (hg[t] ?? 999));
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));
5726
5748
  }
5727
5749
  recordFasterTypeReachable(e) {
5728
5750
  X.debug(`Faster endpoint type ${b[e]} is reachable again, dropping learned preference`), this.clearRememberedType(), this.clearProxyPreference();
5729
5751
  try {
5730
- localStorage.removeItem(Sg), localStorage.removeItem(Cg);
5752
+ localStorage.removeItem(Eg), localStorage.removeItem(Dg);
5731
5753
  } catch {}
5732
5754
  }
5733
5755
  recordFasterTypesUnreachable() {
5734
5756
  try {
5735
- localStorage.setItem(Cg, String(Date.now()));
5757
+ localStorage.setItem(Dg, String(Date.now()));
5736
5758
  } catch {}
5737
5759
  X.debug("Faster endpoint types still unreachable, keeping the learned preference");
5738
5760
  }
5739
5761
  filterByTransport(e) {
5740
5762
  let t = this._websocket, n = this._webtransport;
5741
- return t === void 0 && n === void 0 || t === !0 && n === !0 ? e : e.filter((e) => t === !0 && n === void 0 ? vg.has(e) : n === !0 && t === void 0 ? yg.has(e) : t === !1 ? !vg.has(e) : n !== !1 || !yg.has(e));
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));
5742
5764
  }
5743
5765
  revalidationAgeMs() {
5744
5766
  try {
5745
- let e = localStorage.getItem(Cg);
5767
+ let e = localStorage.getItem(Dg);
5746
5768
  if (e === null) return null;
5747
5769
  let t = Date.now() - Number(e);
5748
5770
  return Number.isFinite(t) ? t : null;
@@ -5752,12 +5774,12 @@ var hg = {
5752
5774
  }
5753
5775
  loadRememberedType() {
5754
5776
  try {
5755
- let e = localStorage.getItem(bg);
5777
+ let e = localStorage.getItem(wg);
5756
5778
  if (e !== null) {
5757
5779
  let t = Number(e);
5758
5780
  if (b[t] !== void 0) {
5759
5781
  this.workingEndpointType = t;
5760
- let e = localStorage.getItem(Sg), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
5782
+ let e = localStorage.getItem(Eg), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
5761
5783
  X.debug(`Loaded remembered type: ${b[t]} (age: ${n}h)`);
5762
5784
  }
5763
5785
  }
@@ -5765,14 +5787,14 @@ var hg = {
5765
5787
  }
5766
5788
  loadProxyPreference() {
5767
5789
  try {
5768
- this._proxyPreferred = localStorage.getItem(xg) === "true", this._proxyPreferred && X.debug("Loaded proxy preference: preferred");
5790
+ this._proxyPreferred = localStorage.getItem(Tg) === "true", this._proxyPreferred && X.debug("Loaded proxy preference: preferred");
5769
5791
  } catch {}
5770
5792
  }
5771
- }, Z = C("IkonClient"), Eg = [1e4, 3e4];
5772
- function Dg() {
5793
+ }, Z = C("IkonClient"), Ag = [1e4, 3e4];
5794
+ function jg() {
5773
5795
  return typeof __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__ < "u" && __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__;
5774
5796
  }
5775
- var Og = class {
5797
+ var Mg = class {
5776
5798
  channelManager = null;
5777
5799
  protocolWorker = null;
5778
5800
  preloadedWorker = null;
@@ -5852,7 +5874,7 @@ var Og = class {
5852
5874
  _reconnectTimer = null;
5853
5875
  _serverStopped = !1;
5854
5876
  _hasBeenConnected = !1;
5855
- _waitForExternalConnectUrl = Dg();
5877
+ _waitForExternalConnectUrl = jg();
5856
5878
  _externalConnectUrlCleanup = null;
5857
5879
  get media() {
5858
5880
  return this._media;
@@ -5869,7 +5891,7 @@ var Og = class {
5869
5891
  return this._mediaCapture;
5870
5892
  }
5871
5893
  async ensureMediaCapture() {
5872
- return this._mediaCapture ? this._mediaCapture : R() ? (this._mediaCapturePromise ||= Promise.resolve().then(() => c_).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture)), this._mediaCapturePromise) : null;
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;
5873
5895
  }
5874
5896
  async ensureMedia() {
5875
5897
  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);
@@ -5915,14 +5937,14 @@ var Og = class {
5915
5937
  ].filter(Boolean).length;
5916
5938
  if (t === 0) throw Error("IkonClient requires one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
5917
5939
  if (t > 1) throw Error("IkonClient accepts only one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
5918
- Jh(), R() && ff();
5940
+ Qh(), R() && gf();
5919
5941
  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;
5920
- this.endpointSelector = new Tg({
5942
+ this.endpointSelector = new kg({
5921
5943
  local: e.local,
5922
5944
  proxyMode: r,
5923
5945
  websocket: o,
5924
5946
  webtransport: s
5925
- }), 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 ih(), this._reactiveRegistry = new lh(this._functionRegistry), R() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = Sp(this._functionRegistry), this.unregisterSoundFunctions = Hh(this._functionRegistry)), R() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(ph));
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));
5926
5948
  let c = cu(), l = lu();
5927
5949
  this._audioEnabled = c ?? e.audio?.enabled ?? !0, this._videoEnabled = l ?? e.video?.enabled ?? !0;
5928
5950
  let u = e.audio ? {
@@ -5934,7 +5956,7 @@ var Og = class {
5934
5956
  audio: u,
5935
5957
  video: d,
5936
5958
  mediaSession: e.mediaSession
5937
- }, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, R() && (this.unregisterMediaCaptureFunctions = Ch(this._functionRegistry, this));
5959
+ }, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, R() && (this.unregisterMediaCaptureFunctions = Dh(this._functionRegistry, this));
5938
5960
  }
5939
5961
  _lastError = void 0;
5940
5962
  get lastError() {
@@ -5987,7 +6009,7 @@ var Og = class {
5987
6009
  async connect() {
5988
6010
  if (this._connectStarted) throw Error(`Cannot connect: already started (state: ${this.currentState})`);
5989
6011
  this._connectStarted = !0;
5990
- let e = sg();
6012
+ let e = dg();
5991
6013
  if (!e.supported) {
5992
6014
  this.setErrorState(new Il(e.missingFeatures));
5993
6015
  return;
@@ -6006,17 +6028,17 @@ var Og = class {
6006
6028
  }
6007
6029
  async executeConnection(e) {
6008
6030
  if (this._lastError = void 0, this.abortController = new AbortController(), typeof Worker < "u" && !this.preloadedWorker) try {
6009
- this.preloadedWorker = new mg();
6031
+ this.preloadedWorker = new vg();
6010
6032
  } catch {}
6011
6033
  this.setState("connecting"), this.connectionTimer = setTimeout(() => {
6012
6034
  this.currentState === "connecting" && (Z.error("Connection timeout"), this.abortController?.abort("Connection timeout"), this.setState("offline"), this.config.onError?.(/* @__PURE__ */ Error("Connection timeout")));
6013
6035
  }, this.connectionTimeoutMs);
6014
6036
  try {
6015
6037
  let t = await e();
6016
- 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 && nm(t.backendUrl, t.authToken), t.usedProxyUrl && t.directUrl && this.endpointSelector.proxyMode === "auto") {
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") {
6017
6039
  Z.debug("Auth fell back to proxy, marking proxy preferred");
6018
6040
  let e = t.directUrl;
6019
- zm(e).then((e) => {
6041
+ Um(e).then((e) => {
6020
6042
  e && (Z.debug("Background probe: direct server reachable, clearing proxy preference for next connection"), this.endpointSelector.clearProxyPreference());
6021
6043
  }).catch(() => {});
6022
6044
  }
@@ -6027,7 +6049,7 @@ var Og = class {
6027
6049
  }
6028
6050
  }
6029
6051
  disconnect() {
6030
- Z.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), im(), 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;
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;
6031
6053
  for (let e of this._webRtcAudioElements.values()) e.pause(), e.srcObject = null, e.remove();
6032
6054
  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");
6033
6055
  }
@@ -6238,10 +6260,10 @@ var Og = class {
6238
6260
  }
6239
6261
  async authenticate() {
6240
6262
  let e = this.abortController?.signal;
6241
- if (this.config.local) return Um(this.config.local, e);
6263
+ if (this.config.local) return qm(this.config.local, e);
6242
6264
  let t = this.endpointSelector.proxyMode, n = this.endpointSelector.proxyPreferred, r;
6243
- if (this.config.apiKey) r = await Wm(this.config.apiKey, e, t, n);
6244
- else if (this.config.sessionToken) r = await Gm(this.config.sessionToken, e, t, n);
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);
6245
6267
  else throw Error("No connection configuration provided (need local, apiKey, or sessionToken)");
6246
6268
  return r.usedProxyUrl && t === "auto" && this.endpointSelector.markProxyPreferred(), r;
6247
6269
  }
@@ -6276,7 +6298,7 @@ var Og = class {
6276
6298
  return;
6277
6299
  }
6278
6300
  if (t === w.CORE_GLOBAL_STATE && uo(e).then((e) => {
6279
- 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 && Xh(), Yh() && this.protocolWorker && (this.protocolWorker.postMessage({
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({
6280
6302
  type: "enableDevtools",
6281
6303
  enabled: !0
6282
6304
  }), this.protocolWorker.postMessage({
@@ -6414,7 +6436,7 @@ var Og = class {
6414
6436
  let n;
6415
6437
  if (this.preloadedWorker) n = this.preloadedWorker, this.preloadedWorker = null;
6416
6438
  else try {
6417
- n = new mg();
6439
+ n = new vg();
6418
6440
  } catch (n) {
6419
6441
  Z.warn(`Failed to create protocol worker, falling back to main thread: ${n}`), await this.connectProtocolOnMainThread(e, t);
6420
6442
  return;
@@ -6470,13 +6492,13 @@ var Og = class {
6470
6492
  r || (i = void 0, t(/* @__PURE__ */ Error("Protocol worker connect timed out")));
6471
6493
  }, td);
6472
6494
  }), i = this.computeOrderedEndpointTypes(e), a = this.getServerKeepaliveTimeoutMs(), o = this.config.timeouts?.reconnectBackoffMs ?? 2e3, s = this.config.timeouts?.maxReconnectAttempts ?? 2;
6473
- this.updateWorkerInterestMask(), Yh() && (n.postMessage({
6495
+ this.updateWorkerInterestMask(), $h() && (n.postMessage({
6474
6496
  type: "enableDevtools",
6475
6497
  enabled: !0
6476
6498
  }), n.postMessage({
6477
6499
  type: "setLogLevel",
6478
6500
  level: Ce()
6479
- })), $h();
6501
+ })), rg();
6480
6502
  let c = uu() ?? this.config.webRtc?.enabled ?? !0;
6481
6503
  n.postMessage({
6482
6504
  type: "connect",
@@ -6504,7 +6526,7 @@ var Og = class {
6504
6526
  }
6505
6527
  ensureVisemeTracker() {
6506
6528
  if (!this._visemeTracker) try {
6507
- this._visemeTracker = new Kh(this), this._visemeTracker.enable();
6529
+ this._visemeTracker = new Xh(this), this._visemeTracker.enable();
6508
6530
  } catch (e) {
6509
6531
  Z.warn(`Viseme tracker setup failed: ${e}`), this._visemeTracker = null;
6510
6532
  }
@@ -6582,9 +6604,9 @@ var Og = class {
6582
6604
  this._webRtcRetryTimer &&= (clearTimeout(this._webRtcRetryTimer), null);
6583
6605
  }
6584
6606
  scheduleWebRtcRetry() {
6585
- if (this._webRtcRetryTimer || this._webRtcRetryCount >= Eg.length) return;
6586
- let e = Eg[this._webRtcRetryCount++];
6587
- Z.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${Eg.length})`), this._webRtcRetryTimer = setTimeout(() => {
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(() => {
6588
6610
  this._webRtcRetryTimer = null, !(this.currentState !== "connected" || this._webRtcSignaling || !this.isWebRtcEnabled) && this.setupWebRtcSignaling();
6589
6611
  }, e);
6590
6612
  }
@@ -6776,7 +6798,7 @@ var Og = class {
6776
6798
  let n = this.groupEntrypointsByType(this._connectedEntrypoints), r = this.abortController?.signal;
6777
6799
  for (let e of t) {
6778
6800
  let t = n.get(e)?.[0]?.Uri;
6779
- if (!(t === void 0 || r?.aborted) && await ug(e, t, { signal: r })) {
6801
+ if (!(t === void 0 || r?.aborted) && await mg(e, t, { signal: r })) {
6780
6802
  this.endpointSelector.recordFasterTypeReachable(e);
6781
6803
  return;
6782
6804
  }
@@ -6906,8 +6928,8 @@ var Og = class {
6906
6928
  let t = e.target?.closest?.("a[href]");
6907
6929
  if (!t || t.target && t.target !== "_self") return;
6908
6930
  let n = t.getAttribute("href") ?? "";
6909
- if (ig(n)) {
6910
- e.preventDefault(), ag(n);
6931
+ if (cg(n)) {
6932
+ e.preventDefault(), lg(n);
6911
6933
  return;
6912
6934
  }
6913
6935
  let r = this.resolveInPlaceDestination(t, n);
@@ -6926,7 +6948,7 @@ var Og = class {
6926
6948
  } catch {
6927
6949
  return null;
6928
6950
  }
6929
- return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search || rf(n.pathname) ? null : n;
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;
6930
6952
  }
6931
6953
  sendDisconnectSignal() {
6932
6954
  if (this._sessionId !== void 0 && this.currentState === "connected") try {
@@ -7002,7 +7024,7 @@ var Og = class {
7002
7024
  });
7003
7025
  }, 150);
7004
7026
  }), window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
7005
- this.sendUpdateClientContext({ theme: uf() });
7027
+ this.sendUpdateClientContext({ theme: mf() });
7006
7028
  });
7007
7029
  }
7008
7030
  setupExternalConnectUrlListener() {
@@ -7033,7 +7055,7 @@ var Og = class {
7033
7055
  this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null);
7034
7056
  }
7035
7057
  }
7036
- }, kg = class {
7058
+ }, Ng = class {
7037
7059
  client;
7038
7060
  constructor(e) {
7039
7061
  this.client = e;
@@ -7051,45 +7073,45 @@ var Og = class {
7051
7073
  }, { close: () => n.close() }) : { close: () => {} };
7052
7074
  }
7053
7075
  };
7054
- function Ag(e) {
7055
- return new kg(e);
7076
+ function Pg(e) {
7077
+ return new Ng(e);
7056
7078
  }
7057
7079
  //#endregion
7058
7080
  //#region src/client/connection-state.ts
7059
- function jg(e) {
7081
+ function Fg(e) {
7060
7082
  return e === "waitingForExternalConnectUrl" || e === "connecting" || e === "connectingSlow" || e === "reconnecting";
7061
7083
  }
7062
- function Mg(e) {
7084
+ function Ig(e) {
7063
7085
  return e === "connected";
7064
7086
  }
7065
- function Ng(e) {
7087
+ function Lg(e) {
7066
7088
  return e === "offline" || e === "offlineError";
7067
7089
  }
7068
- function Pg(e) {
7090
+ function Rg(e) {
7069
7091
  return e === "offlineError";
7070
7092
  }
7071
7093
  //#endregion
7072
7094
  //#region src/utils/opcode-names.ts
7073
- var Fg = /* @__PURE__ */ new Map();
7074
- for (let [e, t] of Object.entries(w)) typeof t == "number" && Fg.set(t, e);
7075
- function Ig(e) {
7076
- return Fg.get(e) ?? `UNKNOWN_${e}`;
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}`;
7077
7099
  }
7078
7100
  //#endregion
7079
7101
  //#region src/login/reprovision.ts
7080
- var Lg = "ikon-login-app-route";
7081
- function Rg(e) {
7102
+ var Vg = "ikon-login-app-route";
7103
+ function Hg(e) {
7082
7104
  if (typeof window > "u") return;
7083
7105
  try {
7084
- sessionStorage.setItem(Lg, window.location.pathname);
7106
+ sessionStorage.setItem(Vg, window.location.pathname);
7085
7107
  } catch {}
7086
7108
  let t = new URL(window.location.href);
7087
7109
  t.searchParams.set(Ul, e), window.location.href = t.toString();
7088
7110
  }
7089
- function zg() {
7111
+ function Ug() {
7090
7112
  let e = null;
7091
7113
  try {
7092
- e = sessionStorage.getItem(Lg), sessionStorage.removeItem(Lg);
7114
+ e = sessionStorage.getItem(Vg), sessionStorage.removeItem(Vg);
7093
7115
  } catch {}
7094
7116
  return {
7095
7117
  appRoute: e,
@@ -7098,7 +7120,7 @@ function zg() {
7098
7120
  }
7099
7121
  //#endregion
7100
7122
  //#region src/media/ring-buffer.ts
7101
- var Bg = class {
7123
+ var Wg = class {
7102
7124
  static getStorageForCapacity(e, t) {
7103
7125
  let n = Int32Array.BYTES_PER_ELEMENT * 2, r = t.BYTES_PER_ELEMENT * e;
7104
7126
  return new SharedArrayBuffer(n + r);
@@ -7149,7 +7171,7 @@ var Bg = class {
7149
7171
  };
7150
7172
  //#endregion
7151
7173
  //#region src/worker/audio-capture-worker.ts?worker
7152
- function Vg(e) {
7174
+ function Gg(e) {
7153
7175
  return new Worker("" + new URL("assets/audio-capture-worker-CJ5S-nQt.js", import.meta.url).href, {
7154
7176
  type: "module",
7155
7177
  name: e?.name
@@ -7157,11 +7179,11 @@ function Vg(e) {
7157
7179
  }
7158
7180
  //#endregion
7159
7181
  //#region src/media/ikon-audio-capture.ts
7160
- var Q = C("IkonAudioCapture"), Hg = 3, Ug = 200, Wg = 2e3, Gg = 5e3, Kg = 3e3;
7161
- function qg(e) {
7182
+ var Q = C("IkonAudioCapture"), Kg = 3, qg = 200, Jg = 2e3, Yg = 5e3, Xg = 3e3;
7183
+ function Zg(e) {
7162
7184
  return new Promise((t) => setTimeout(t, e));
7163
7185
  }
7164
- function Jg(e) {
7186
+ function Qg(e) {
7165
7187
  switch (e.name) {
7166
7188
  case "NotReadableError": return {
7167
7189
  action: "retry",
@@ -7197,14 +7219,14 @@ function Jg(e) {
7197
7219
  };
7198
7220
  }
7199
7221
  }
7200
- function Yg() {
7222
+ function $g() {
7201
7223
  let e = globalThis.crypto;
7202
7224
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
7203
7225
  }
7204
- function Xg() {
7226
+ function e_() {
7205
7227
  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";
7206
7228
  }
7207
- var Zg = class e {
7229
+ var t_ = class e {
7208
7230
  client;
7209
7231
  static RESUME_TIMEOUT_MS = 3e3;
7210
7232
  worker = null;
@@ -7265,7 +7287,7 @@ var Zg = class e {
7265
7287
  notifyError(e, t, n, r) {
7266
7288
  if (e.stopped) return;
7267
7289
  let i = Date.now(), a = t.name;
7268
- if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < Gg) return;
7290
+ if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < Yg) return;
7269
7291
  e.lastErrorTime = i, e.lastErrorReason = n, e.lastErrorName = a;
7270
7292
  let o = this.config.autoRestartPolicy;
7271
7293
  if (o?.enabled && r) {
@@ -7323,7 +7345,7 @@ var Zg = class e {
7323
7345
  if (e.ctx.state === "running") return !0;
7324
7346
  if (e.ctx.state !== "suspended") return !1;
7325
7347
  let r = Date.now();
7326
- if (!n && r - e.lastResumeAttemptTime < Kg) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
7348
+ if (!n && r - e.lastResumeAttemptTime < Xg) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
7327
7349
  e.lastResumeAttemptTime = r, this.emitDiagnostic({
7328
7350
  event: "resume-attempt",
7329
7351
  captureId: e.captureId,
@@ -7359,7 +7381,7 @@ var Zg = class e {
7359
7381
  attemptResume(e, t, n = !1) {
7360
7382
  if (e.stopped || e.ctx.state !== "suspended") return;
7361
7383
  let r = Date.now();
7362
- if (!n && r - e.lastResumeAttemptTime < Kg) {
7384
+ if (!n && r - e.lastResumeAttemptTime < Xg) {
7363
7385
  Q.debug(`Resume attempt from ${t} skipped (cooldown)`);
7364
7386
  return;
7365
7387
  }
@@ -7458,7 +7480,7 @@ var Zg = class e {
7458
7480
  }
7459
7481
  ensureWorker() {
7460
7482
  if (this.worker) return this.worker;
7461
- let e = new Vg();
7483
+ let e = new Gg();
7462
7484
  return this.worker = e, e.addEventListener("message", (e) => {
7463
7485
  let t = e.data;
7464
7486
  if (t?.type === "error") {
@@ -7556,25 +7578,25 @@ var Zg = class e {
7556
7578
  reason: "unknown",
7557
7579
  canRetry: !1
7558
7580
  };
7559
- for (let r = 0; r < Hg; r++) try {
7581
+ for (let r = 0; r < Kg; r++) try {
7560
7582
  return {
7561
7583
  stream: await navigator.mediaDevices.getUserMedia({ audio: e }),
7562
7584
  error: t,
7563
7585
  errorInfo: n
7564
7586
  };
7565
7587
  } catch (e) {
7566
- if (t = e instanceof Error ? e : Error(String(e)), n = Jg(t), Q.debug(`getUserMedia attempt ${r + 1}/${Hg} failed: ${t.name} (action: ${n.action})`), this.emitDiagnostic({
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({
7567
7589
  event: "retry",
7568
7590
  details: {
7569
7591
  attempt: r + 1,
7570
- maxAttempts: Hg,
7592
+ maxAttempts: Kg,
7571
7593
  errorName: t.name,
7572
7594
  action: n.action
7573
7595
  }
7574
7596
  }), n.action !== "retry") break;
7575
7597
  if (r < 2) {
7576
- let e = Ug * (r + 1);
7577
- Q.debug(`Retrying getUserMedia in ${e}ms`), await qg(e);
7598
+ let e = qg * (r + 1);
7599
+ Q.debug(`Retrying getUserMedia in ${e}ms`), await Zg(e);
7578
7600
  }
7579
7601
  }
7580
7602
  return {
@@ -7585,7 +7607,7 @@ var Zg = class e {
7585
7607
  }
7586
7608
  async ensureWorklet(e) {
7587
7609
  if (!Te(e)) throw Error("AudioWorklet is not supported in this browser");
7588
- if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([Xg()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
7610
+ if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([e_()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
7589
7611
  await this.workletReady;
7590
7612
  return;
7591
7613
  } catch {
@@ -7612,7 +7634,7 @@ var Zg = class e {
7612
7634
  if (!t) throw Error("Cannot start audio capture before client is connected");
7613
7635
  if (this.client.isWebRtcCaptureAvailable) return this.startMicWebRtc(e);
7614
7636
  this.client.isWebRtcEnabled && Q.warn("WebRTC unavailable, capturing audio via protocol channel");
7615
- let n = Yg(), r = {
7637
+ let n = $g(), r = {
7616
7638
  captureId: n,
7617
7639
  aborted: !1,
7618
7640
  stream: null,
@@ -7650,7 +7672,7 @@ var Zg = class e {
7650
7672
  let f = Se() ? "sab" : "pcm", p;
7651
7673
  if (f === "sab") {
7652
7674
  let e = Math.floor(a.sampleRate * 10);
7653
- p = Bg.getStorageForCapacity(e, Float32Array);
7675
+ p = Wg.getStorageForCapacity(e, Float32Array);
7654
7676
  }
7655
7677
  let m = this.ensureWorker(), h = e.onStopped;
7656
7678
  m.postMessage({
@@ -7798,7 +7820,7 @@ var Zg = class e {
7798
7820
  };
7799
7821
  this.setupAudioContextStateListener(a, _), this.setupVisibilityChangeListener(_), this.setupBFCacheHandlers(_), _.healthCheckTimer = setInterval(() => {
7800
7822
  this.performHealthCheck(_);
7801
- }, Wg);
7823
+ }, Jg);
7802
7824
  let te = () => {
7803
7825
  _.stopped || (Q.warn(`Microphone track ended unexpectedly, captureId=${n.substring(0, 8)}`), this.handleRecoverableError(_, /* @__PURE__ */ Error("Microphone track ended unexpectedly"), "track-ended"));
7804
7826
  };
@@ -7947,8 +7969,8 @@ var Zg = class e {
7947
7969
  let t = this.captures.get(e);
7948
7970
  return !t || t.stopped ? !1 : this.attemptResumeAsync(t, "userGesture", !0);
7949
7971
  }
7950
- }, Qg = 3e3;
7951
- function $g(e, t, n, r) {
7972
+ }, n_ = 3e3;
7973
+ function r_(e, t, n, r) {
7952
7974
  if (!n && !r) return {
7953
7975
  width: e,
7954
7976
  height: t
@@ -7959,7 +7981,7 @@ function $g(e, t, n, r) {
7959
7981
  height: Math.max(1, Math.floor(t * o))
7960
7982
  };
7961
7983
  }
7962
- async function e_(e, t) {
7984
+ async function i_(e, t) {
7963
7985
  let n = t.mime ?? "image/jpeg", r = t.quality ?? .92;
7964
7986
  if (typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas) try {
7965
7987
  return await e.convertToBlob({
@@ -7974,7 +7996,7 @@ async function e_(e, t) {
7974
7996
  }, n, r);
7975
7997
  });
7976
7998
  }
7977
- var t_ = class {
7999
+ var a_ = class {
7978
8000
  async captureFromStream(e, t = {}) {
7979
8001
  let n = e.getVideoTracks()[0];
7980
8002
  if (!n) throw Error("No video track available in the provided stream");
@@ -7985,7 +8007,7 @@ var t_ = class {
7985
8007
  } catch {}
7986
8008
  try {
7987
8009
  await new Promise((e, t) => {
7988
- let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), Qg);
8010
+ let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), n_);
7989
8011
  r.addEventListener("loadedmetadata", () => {
7990
8012
  clearTimeout(n), e();
7991
8013
  }, { once: !0 }), r.addEventListener("error", () => {
@@ -7995,7 +8017,7 @@ var t_ = class {
7995
8017
  try {
7996
8018
  await r.play();
7997
8019
  } catch {}
7998
- let { width: e, height: i } = $g(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
8020
+ let { width: e, height: i } = r_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
7999
8021
  if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(e, i);
8000
8022
  else {
8001
8023
  let t = document.createElement("canvas");
@@ -8004,7 +8026,7 @@ var t_ = class {
8004
8026
  let o = a.getContext("2d", { alpha: !1 });
8005
8027
  if (!o) throw Error("2D canvas context unavailable");
8006
8028
  o.drawImage(r, 0, 0, e, i);
8007
- let s = await e_(a, t), c = await s.arrayBuffer();
8029
+ let s = await i_(a, t), c = await s.arrayBuffer();
8008
8030
  return {
8009
8031
  mime: s.type || t.mime || "image/jpeg",
8010
8032
  width: e,
@@ -8045,7 +8067,7 @@ var t_ = class {
8045
8067
  } catch {}
8046
8068
  try {
8047
8069
  await new Promise((e, t) => {
8048
- let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), Qg);
8070
+ let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), n_);
8049
8071
  r.addEventListener("loadedmetadata", () => {
8050
8072
  clearTimeout(n), e();
8051
8073
  }, { once: !0 }), r.addEventListener("error", () => {
@@ -8055,7 +8077,7 @@ var t_ = class {
8055
8077
  try {
8056
8078
  await r.play();
8057
8079
  } catch {}
8058
- let { width: t, height: i } = $g(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
8080
+ let { width: t, height: i } = r_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
8059
8081
  if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(t, i);
8060
8082
  else {
8061
8083
  let e = document.createElement("canvas");
@@ -8064,7 +8086,7 @@ var t_ = class {
8064
8086
  let o = a.getContext("2d", { alpha: !1 });
8065
8087
  if (!o) throw Error("2D canvas context unavailable");
8066
8088
  o.drawImage(r, 0, 0, t, i);
8067
- let s = await e_(a, e), c = await s.arrayBuffer();
8089
+ let s = await i_(a, e), c = await s.arrayBuffer();
8068
8090
  return {
8069
8091
  mime: s.type || e.mime || "image/jpeg",
8070
8092
  width: t,
@@ -8088,11 +8110,11 @@ var t_ = class {
8088
8110
  }
8089
8111
  async captureFromNativeCamera(e = {}) {
8090
8112
  if (typeof document > "u") throw Error("Native camera capture requires a DOM environment");
8091
- let t = await n_(e.facing);
8092
- return t ? await r_(t, e) : null;
8113
+ let t = await o_(e.facing);
8114
+ return t ? await s_(t, e) : null;
8093
8115
  }
8094
8116
  };
8095
- function n_(e) {
8117
+ function o_(e) {
8096
8118
  return new Promise((t) => {
8097
8119
  let n = document.createElement("input");
8098
8120
  n.type = "file", n.accept = "image/*", n.setAttribute("capture", e ?? "environment"), n.style.position = "fixed", n.style.left = "-99999px", n.style.top = "0";
@@ -8118,7 +8140,7 @@ function n_(e) {
8118
8140
  n.click();
8119
8141
  });
8120
8142
  }
8121
- async function r_(e, t) {
8143
+ async function s_(e, t) {
8122
8144
  let n = URL.createObjectURL(e), r;
8123
8145
  try {
8124
8146
  r = await new Promise((e, t) => {
@@ -8128,7 +8150,7 @@ async function r_(e, t) {
8128
8150
  } finally {
8129
8151
  URL.revokeObjectURL(n);
8130
8152
  }
8131
- let i = r.naturalWidth || r.width, a = r.naturalHeight || r.height, { width: o, height: s } = $g(i, a, t.width, t.height), c = t.mime ?? (e.type === "image/png" ? "image/png" : "image/jpeg"), l = t.quality ?? .92;
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;
8132
8154
  if (o === i && s === a && e.type === c) {
8133
8155
  let t = await e.arrayBuffer();
8134
8156
  return {
@@ -8155,7 +8177,7 @@ async function r_(e, t) {
8155
8177
  }
8156
8178
  //#endregion
8157
8179
  //#region src/worker/video-capture-worker.ts?worker
8158
- function i_(e) {
8180
+ function c_(e) {
8159
8181
  return new Worker("" + new URL("assets/video-capture-worker-D5jsT6I4.js", import.meta.url).href, {
8160
8182
  type: "module",
8161
8183
  name: e?.name
@@ -8164,16 +8186,16 @@ function i_(e) {
8164
8186
  //#endregion
8165
8187
  //#region src/media/ikon-video-capture.ts
8166
8188
  var $ = C("IkonVideoCapture");
8167
- function a_() {
8189
+ function l_() {
8168
8190
  let e = globalThis.crypto;
8169
8191
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
8170
8192
  }
8171
- function o_() {
8193
+ function u_() {
8172
8194
  let e = globalThis.MediaStreamTrackProcessor;
8173
8195
  if (!e) throw Error("MediaStreamTrackProcessor is not available in this browser");
8174
8196
  return e;
8175
8197
  }
8176
- var s_ = class {
8198
+ var d_ = class {
8177
8199
  client;
8178
8200
  worker = null;
8179
8201
  protocolPort = null;
@@ -8189,7 +8211,7 @@ var s_ = class {
8189
8211
  }
8190
8212
  ensureWorker() {
8191
8213
  if (this.worker) return this.worker;
8192
- let e = new i_();
8214
+ let e = new c_();
8193
8215
  return this.worker = e, e.addEventListener("message", (e) => {
8194
8216
  let t = e.data;
8195
8217
  if (t?.type === "error") {
@@ -8299,10 +8321,10 @@ var s_ = class {
8299
8321
  if (this.client.isWebRtcCaptureAvailable && e.sourceType === "camera") return this.startCameraWebRtc(e);
8300
8322
  if (this.client.isWebRtcCaptureAvailable && e.sourceType === "screen") return this.startScreenWebRtc(e);
8301
8323
  this.client.isWebRtcEnabled && $.warn("WebRTC unavailable, capturing video via protocol channel"), this.ensurePorts();
8302
- let n = a_(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
8324
+ let n = l_(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
8303
8325
  if (!i) throw r.getTracks().forEach((e) => e.stop()), Error("No video track available");
8304
8326
  e.sourceType === "screen" && await new Promise((e) => setTimeout(e, 200));
8305
- 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 (o_())({ track: i }).readable, l = this.allocateTrackId(), u = this.ensureWorker(), d = e.sourceType, f = e.onStopped;
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;
8306
8328
  u.postMessage({
8307
8329
  type: "start",
8308
8330
  captureId: n,
@@ -8425,16 +8447,16 @@ var s_ = class {
8425
8447
  }
8426
8448
  this.protocolPort?.close(), this.protocolPort = null, this.sendPort?.close(), this.sendPort = null;
8427
8449
  }
8428
- }, c_ = /* @__PURE__ */ d({ IkonMediaCapture: () => l_ }), l_ = class {
8450
+ }, f_ = /* @__PURE__ */ d({ IkonMediaCapture: () => p_ }), p_ = class {
8429
8451
  audio;
8430
8452
  video;
8431
8453
  image;
8432
8454
  constructor(e, t) {
8433
- this.audio = new Zg(e, t?.audio), this.video = new s_(e), this.image = new t_();
8455
+ this.audio = new t_(e, t?.audio), this.video = new d_(e), this.image = new a_();
8434
8456
  }
8435
8457
  dispose() {
8436
8458
  this.audio.dispose(), this.video.dispose();
8437
8459
  }
8438
8460
  };
8439
8461
  //#endregion
8440
- export { Ml as AccessDeniedError, kg 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, Tg as EndpointSelector, b as EntrypointType, $m as FunctionCallError, ih 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, Zh 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, Zg as IkonAudioCapture, ie as IkonAudioPlayback, Og as IkonClient, t_ as IkonImageCapture, de as IkonMedia, l_ as IkonMediaCapture, s_ 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, Kh 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, Ag as appMessaging, v as asProtocolMessage, sg as checkBrowserSupport, gm as clearDeviceId, Pp as clearLogBuffer, ud as clearLoginPrompt, zg as consumeLoginHandoff, pd as consumeLoginPendingCall, C as createLogger, Jd as createPkceChallenge, Pd as deriveAuthUrl, Md as deriveBackendType, jd as deriveBackendUrl, Fd as deriveCrossOriginAuthUrl, tg as enableInspectMode, _m as extractUserIdFromToken, Np as flushLogs, cu as getAudioParam, mu as getAuthSameOriginParam, jp as getBufferedLogs, um as getConnectTraceId, pu as getDebugOverlayParam, au as getDebugParam, fu as getInspectParam, ou as getLangParam, Fp as getLogBufferSize, Ce as getLogLevel, xe as getLogSink, cd as getLoginPromptState, Ig as getOpcodeName, hm 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, Jh as initializeDebugMode, $h as initializeInspectMode, kp as initializeLogSink, Te as isAudioWorkletSupported, R as isBrowserEnvironment, Vd as isCloudEnvironment, Mg as isConnected, jg as isConnecting, Yh as isDebugModeEnabled, Qd as isEmbedded, Pg as isError, eg as isInspectModeEnabled, mh as isMobileBrowserLikely, Ng as isOffline, qd as isPkceSupported, Se as isSharedArrayBufferSupported, wu as isWebTransportSupported, ph as loginErrorInterceptor, Bd as parseUrlParams, pm as randomUuid, c as readOpcode, u as readOpcodeGroup, i as readProtocolMessageHeaders, Sp as registerBrowserFunctions, fm as reportConnectTimeline, Rg as reprovisionAfterLogin, ye as setLogLevel, ve as setLogSink, ld as setLoginPromptRequired, tu as setSdkUrlParam, Ap as setSendLogsCallback, $d as startEmbeddedOAuthSignIn, nm as startLogSender, im as stopLogSender, dd as subscribeLoginPrompt, ge as subscribeToLogEvents, Mp as takeBufferedLogs, Yd as takePkceVerifier, Qm as withResultData };
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 };