@ikonai/sdk 1.3.2 → 1.3.4

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