@ikonai/sdk 1.3.11 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A as e, C as t, D as n, E as r, F as i, I as a, L as o, M as s, N as c, O as l, P as u, R as d, S as f, T as p, _ as m, a as h, b as g, c as ee, d as _, f as te, g as v, h as ne, i as re, j as y, k as b, l as ie, m as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as x, w as fe, x as S, y as pe } from "./ikon-media--ap3vpXf.js";
2
- import { _ as me, a as he, c as ge, d as C, f as w, g as _e, h as ve, l as ye, m as be, n as xe, p as Se, s as Ce, t as we, u as Te, v as T } from "./capabilities-7u4F63vq.js";
1
+ import { A as e, C as t, D as n, E as r, F as i, I as a, L as o, M as s, N as c, O as l, P as u, R as d, S as f, T as p, _ as m, a as h, b as g, c as ee, d as _, f as te, g as v, h as ne, i as re, j as y, k as b, l as ie, m as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as x, w as fe, x as pe, y as me } from "./ikon-media-DFsofNyM.js";
2
+ import { _ as he, a as ge, c as S, d as C, f as w, g as _e, h as ve, l as ye, m as be, n as xe, p as Se, s as Ce, t as we, u as Te, v as T } from "./capabilities-xDnE0vqq.js";
3
3
  //#region ../../shared/protocol/src/compression.ts
4
4
  var Ee;
5
5
  function De() {
@@ -102,7 +102,7 @@ function jt(e) {
102
102
  return Mt(t), e && Object.assign(t, e), t;
103
103
  }
104
104
  function Mt(e) {
105
- return e.Description = "", e.DeviceId = "", e.ProductId = "", e.VersionId = "", e.InstallId = "", e.Locale = "", e.UserAgent = "", e.ClientType = v.Unknown, e.SdkType = f.Unknown, e.SdkCapability = 0, e.ProtocolVersion = 0, e.PayloadType = S.Unknown, e.StyleFormat = fe.Css, e.SupportsCompression = !0, e.HasInput = !1, e.ReceiveAllMessages = !1, e.ViewportWidth = 0, e.ViewportHeight = 0, e.Theme = "", e.Timezone = "", e.IsTouchDevice = !1, e.InitialPath = "", e.InitialUrl = "", e.IsSnapshot = !1, e.SnapshotVariant = "", e;
105
+ return e.Description = "", e.DeviceId = "", e.ProductId = "", e.VersionId = "", e.InstallId = "", e.Locale = "", e.UserAgent = "", e.ClientType = v.Unknown, e.SdkType = f.Unknown, e.SdkCapability = 0, e.ProtocolVersion = 0, e.PayloadType = pe.Unknown, e.StyleFormat = fe.Css, e.SupportsCompression = !0, e.HasInput = !1, e.ReceiveAllMessages = !1, e.ViewportWidth = 0, e.ViewportHeight = 0, e.Theme = "", e.Timezone = "", e.IsTouchDevice = !1, e.InitialPath = "", e.InitialUrl = "", e.IsSnapshot = !1, e.SnapshotVariant = "", e;
106
106
  }
107
107
  function Nt(e) {
108
108
  let t = new b(1);
@@ -116,7 +116,7 @@ function Ft(e) {
116
116
  return It(t), e && Object.assign(t, e), t;
117
117
  }
118
118
  function It(e) {
119
- return e.ExpiresAt = 0, e.ContextType = m.Unknown, e.UserType = p.Unknown, e.IsInternal = !1, e.UserId = "", e.AuthSessionId = "", e.IsAnonymous = !1, e.IsGlobal = !1, e.OpcodeGroupsFromServer = T.NONE, e.OpcodeGroupsToServer = T.NONE, e.Parameters = Object.create(null), e.ServerSessionId = "", e.Description = "", e.DeviceId = "", e.ProductId = "", e.VersionId = "", e.InstallId = "", e.Locale = "", e.UserAgent = "", e.ClientType = v.Unknown, e.SdkType = f.Unknown, e.SdkCapability = 0, e.ProtocolVersion = 0, e.PayloadType = S.Unknown, e.StyleFormat = fe.Css, e.SupportsCompression = !0, e.HasInput = !1, e.ReceiveAllMessages = !1, e.ViewportWidth = 0, e.ViewportHeight = 0, e.Theme = "", e.Timezone = "", e.IsTouchDevice = !1, e.InitialPath = "", e.InitialUrl = "", e.IsSnapshot = !1, e.SnapshotVariant = "", e;
119
+ return e.ExpiresAt = 0, e.ContextType = m.Unknown, e.UserType = p.Unknown, e.IsInternal = !1, e.UserId = "", e.AuthSessionId = "", e.IsAnonymous = !1, e.IsGlobal = !1, e.OpcodeGroupsFromServer = T.NONE, e.OpcodeGroupsToServer = T.NONE, e.Parameters = Object.create(null), e.ServerSessionId = "", e.Description = "", e.DeviceId = "", e.ProductId = "", e.VersionId = "", e.InstallId = "", e.Locale = "", e.UserAgent = "", e.ClientType = v.Unknown, e.SdkType = f.Unknown, e.SdkCapability = 0, e.ProtocolVersion = 0, e.PayloadType = pe.Unknown, e.StyleFormat = fe.Css, e.SupportsCompression = !0, e.HasInput = !1, e.ReceiveAllMessages = !1, e.ViewportWidth = 0, e.ViewportHeight = 0, e.Theme = "", e.Timezone = "", e.IsTouchDevice = !1, e.InitialPath = "", e.InitialUrl = "", e.IsSnapshot = !1, e.SnapshotVariant = "", e;
120
120
  }
121
121
  var Lt = 746516514, Rt = 877841741, zt = 1175184220, Bt = 1368629611, Vt = 2341021724, Ht = 3167053791, Ut = 3632106223, Wt = 3686066300;
122
122
  function Gt(e) {
@@ -174,7 +174,7 @@ function Pn(e) {
174
174
  return Fn(t), e && Object.assign(t, e), t;
175
175
  }
176
176
  function Fn(e) {
177
- return e.ContextType = m.Unknown, e.UserType = p.Unknown, e.PayloadType = S.Unknown, e.Description = "", e.UserId = "", e.DeviceId = "", e.ProductId = "", e.VersionId = "", e.InstallId = "", e.Locale = "", e.SessionId = -1, e.IsInternal = !1, e.IsSnapshot = !1, e.SnapshotVariant = "", e.IsReady = !1, e.HasInput = !1, e.AuthSessionId = "", e.IsAnonymous = !1, e.IsGlobal = !1, e.ReceiveAllMessages = !1, e.PreciseJoinedAt = BigInt(0), e.UserAgent = "", e.ClientType = v.Unknown, e.UniqueSessionId = "", e.Parameters = Object.create(null), e.SdkType = f.Unknown, e.SdkCapability = 0, e.ViewportWidth = 0, e.ViewportHeight = 0, e.Theme = "", e.Timezone = "", e.IsTouchDevice = !1, e.InitialPath = "", e.InitialUrl = "", e.StyleFormat = fe.Css, e.SupportsCompression = !0, e.IsSoftDisconnected = !1, e.SoftDisconnectAt = BigInt(0), e;
177
+ return e.ContextType = m.Unknown, e.UserType = p.Unknown, e.PayloadType = pe.Unknown, e.Description = "", e.UserId = "", e.DeviceId = "", e.ProductId = "", e.VersionId = "", e.InstallId = "", e.Locale = "", e.SessionId = -1, e.IsInternal = !1, e.IsSnapshot = !1, e.SnapshotVariant = "", e.IsReady = !1, e.HasInput = !1, e.AuthSessionId = "", e.IsAnonymous = !1, e.IsGlobal = !1, e.ReceiveAllMessages = !1, e.PreciseJoinedAt = BigInt(0), e.UserAgent = "", e.ClientType = v.Unknown, e.UniqueSessionId = "", e.Parameters = Object.create(null), e.SdkType = f.Unknown, e.SdkCapability = 0, e.ViewportWidth = 0, e.ViewportHeight = 0, e.Theme = "", e.Timezone = "", e.IsTouchDevice = !1, e.InitialPath = "", e.InitialUrl = "", e.StyleFormat = fe.Css, e.SupportsCompression = !0, e.IsSoftDisconnected = !1, e.SoftDisconnectAt = BigInt(0), e;
178
178
  }
179
179
  function In(t, n) {
180
180
  n.writeStringField(Yt, t.DeviceId), n.writeStringField(Xt, t.InstallId), n.writeStringField(Zt, t.InitialUrl), n.writeStringField(Qt, t.Theme), n.writeStringField($t, t.UserAgent), n.writeInt32Field(en, t.ContextType), n.writeUInt64Field(tn, t.SoftDisconnectAt), n.writeBoolField(nn, t.HasInput), n.writeInt32Field(rn, t.UserType), n.writeStringField(an, t.InitialPath), n.writeBoolField(on, t.IsSoftDisconnected), n.writeBoolField(sn, t.SupportsCompression), n.writeStringField(cn, t.UserId), n.writeStringField(ln, t.ProductId), n.writeStringField(un, t.AuthSessionId), n.writeBoolField(dn, t.ReceiveAllMessages), n.writeInt32Field(fn, t.ViewportHeight | 0), n.writeStringField(pn, t.Description), n.writeInt32Field(mn, t.SdkCapability | 0), n.writeBoolField(hn, t.IsSnapshot), n.writeStringField(gn, t.Locale), n.writeBoolField(_n, t.IsAnonymous), n.writeInt32Field(vn, t.SdkType), n.writeInt32Field(yn, t.SessionId | 0), n.writeInt32Field(bn, t.ViewportWidth | 0), n.writeUInt64Field(xn, t.PreciseJoinedAt), n.writeInt32Field(Sn, t.PayloadType), n.writeInt32Field(Cn, t.StyleFormat), n.writeBoolField(wn, t.IsTouchDevice), n.writeBoolField(Tn, t.IsGlobal), n.writeStringField(En, t.SnapshotVariant), n.writeStringField(Dn, t.VersionId), n.writeStringField(On, t.UniqueSessionId), n.writeInt32Field(kn, t.ClientType), n.writeBoolField(An, t.IsReady), n.writeDictionaryField(jn, e.String, e.String, (e) => {
@@ -1772,34 +1772,34 @@ var tu = class extends Error {
1772
1772
  constructor(e) {
1773
1773
  super(`App session provisioning timeout after ${e}ms`), this.name = "ProvisioningTimeoutError";
1774
1774
  }
1775
- }, k = class extends E {
1775
+ }, au = class extends E {
1776
1776
  constructor(e = "The app failed to start") {
1777
1777
  super(e), this.name = "AppStartupFailedError";
1778
1778
  }
1779
- }, au = class extends E {
1779
+ }, ou = class extends E {
1780
1780
  constructor(e) {
1781
1781
  super(`Space not found for domain: ${e}`), this.name = "SpaceNotFoundError";
1782
1782
  }
1783
- }, ou = class extends E {
1783
+ }, su = class extends E {
1784
1784
  reason;
1785
1785
  constructor(e, t) {
1786
1786
  super(e), this.reason = t, this.name = "AccessDeniedError";
1787
1787
  }
1788
- }, su = class extends E {
1788
+ }, cu = class extends E {
1789
1789
  sessionIdentityHash;
1790
1790
  constructor(e) {
1791
1791
  super(`No live app session for sessionIdentityHash ${e}`), this.sessionIdentityHash = e, this.name = "SessionNotFoundError";
1792
1792
  }
1793
- }, cu = class extends E {
1793
+ }, lu = class extends E {
1794
1794
  constructor(e) {
1795
1795
  super(e), this.name = "ServerFullError";
1796
1796
  }
1797
- }, lu = class extends E {
1797
+ }, uu = class extends E {
1798
1798
  status;
1799
1799
  constructor(e, t) {
1800
1800
  super(e), this.status = t, this.name = "ServerUnavailableError";
1801
1801
  }
1802
- }, uu = class extends tu {
1802
+ }, du = class extends tu {
1803
1803
  missingFeatures;
1804
1804
  constructor(e) {
1805
1805
  super(`Browser is not supported: missing required features (${e.join(", ")})`), this.missingFeatures = e, this.name = "BrowserNotSupportedError";
@@ -1807,7 +1807,7 @@ var tu = class extends Error {
1807
1807
  };
1808
1808
  //#endregion
1809
1809
  //#region src/utils/delay.ts
1810
- function du(e, t) {
1810
+ function fu(e, t) {
1811
1811
  return new Promise((n, r) => {
1812
1812
  let i = () => {
1813
1813
  clearTimeout(a), r(new DOMException("Aborted", "AbortError"));
@@ -1823,89 +1823,89 @@ function du(e, t) {
1823
1823
  }
1824
1824
  //#endregion
1825
1825
  //#region src/utils/query-params.ts
1826
- var fu = "ikon-proxy", pu = "ikon-websocket", mu = "ikon-webtransport", hu = "ikon-debug", gu = "ikon-lang", _u = "ikon-server-url", vu = "ikon-connect", yu = "ikon-audio", bu = "ikon-video", xu = "ikon-webrtc", Su = "ikon-ice-transport", Cu = "ikon-inspect", wu = "ikon-debug-overlay", Tu = "ikon-auth", Eu = "ikon-retry", Du = "ikon-api", Ou = "ikon-snapshot", ku = "ikon-session";
1827
- function A(e, t) {
1826
+ var pu = "ikon-proxy", mu = "ikon-websocket", hu = "ikon-webtransport", gu = "ikon-debug", _u = "ikon-lang", vu = "ikon-server-url", yu = "ikon-connect", bu = "ikon-audio", xu = "ikon-video", Su = "ikon-webrtc", Cu = "ikon-ice-transport", wu = "ikon-inspect", Tu = "ikon-debug-overlay", Eu = "ikon-auth", Du = "ikon-retry", Ou = "ikon-api", ku = "ikon-snapshot", Au = "ikon-session";
1827
+ function k(e, t) {
1828
1828
  if (typeof window > "u") return null;
1829
1829
  let n = new URLSearchParams(window.location.search), r = n.get(e);
1830
1830
  if (r !== null) return r;
1831
1831
  let i = n.get(e.replace(/-/g, "_"));
1832
1832
  return i === null ? t ? n.get(t) : null : i;
1833
1833
  }
1834
- function j(e, t) {
1835
- let n = A(e, t);
1834
+ function A(e, t) {
1835
+ let n = k(e, t);
1836
1836
  return n === "true" || n !== "false" && null;
1837
1837
  }
1838
- function Au(e, t) {
1838
+ function ju(e, t) {
1839
1839
  if (typeof window > "u") return;
1840
1840
  let n = new URL(window.location.href);
1841
1841
  n.searchParams.get(e) !== t && (n.searchParams.set(e, t), window.history.replaceState(null, "", n.toString()));
1842
1842
  }
1843
- function ju() {
1844
- return j(fu);
1845
- }
1846
1843
  function Mu() {
1847
- let e = A(fu);
1848
- return e === "false" ? "direct" : e === "true" ? "proxy" : e === "lb" || e === "stream" ? "lb" : null;
1844
+ return A(pu);
1849
1845
  }
1850
1846
  function Nu() {
1851
- return j(pu);
1847
+ let e = k(pu);
1848
+ return e === "false" ? "direct" : e === "true" ? "proxy" : e === "lb" || e === "stream" ? "lb" : null;
1852
1849
  }
1853
1850
  function Pu() {
1854
- return j(mu);
1851
+ return A(mu);
1855
1852
  }
1856
1853
  function Fu() {
1857
- return j(hu) === !0;
1854
+ return A(hu);
1858
1855
  }
1859
1856
  function Iu() {
1860
- return A(gu);
1857
+ return A(gu) === !0;
1861
1858
  }
1862
1859
  function Lu() {
1863
- return A(_u);
1860
+ return k(_u);
1864
1861
  }
1865
1862
  function Ru() {
1866
- let e = A(vu);
1863
+ return k(vu);
1864
+ }
1865
+ function zu() {
1866
+ let e = k(yu);
1867
1867
  if (!e || typeof window > "u") return null;
1868
1868
  let t = e.indexOf("~"), n = t < 0 ? e : e.substring(t + 1), r = t < 0 ? window.location.port : e.substring(0, t), i = r ? `${window.location.hostname}:${r}` : window.location.hostname;
1869
1869
  return `${window.location.protocol}//${i}/connect?token=${encodeURIComponent(n)}`;
1870
1870
  }
1871
- function zu() {
1872
- return j(yu);
1873
- }
1874
1871
  function Bu() {
1875
- return j(bu);
1872
+ return A(bu);
1876
1873
  }
1877
1874
  function Vu() {
1878
- return j(xu);
1875
+ return A(xu);
1879
1876
  }
1880
1877
  function Hu() {
1881
- let e = A(Su);
1882
- return e === "relay" ? "relay" : e === "all" ? "all" : null;
1878
+ return A(Su);
1883
1879
  }
1884
1880
  function Uu() {
1885
- return j(Cu) === !0;
1881
+ let e = k(Cu);
1882
+ return e === "relay" ? "relay" : e === "all" ? "all" : null;
1886
1883
  }
1887
1884
  function Wu() {
1888
- return j(wu) === !0;
1885
+ return A(wu) === !0;
1889
1886
  }
1890
1887
  function Gu() {
1891
- let e = A(Tu);
1892
- return e === "true" || e === "same";
1893
- }
1894
- function M() {
1895
- return j(Eu) !== !1;
1888
+ return A(Tu) === !0;
1896
1889
  }
1897
1890
  function Ku() {
1898
- return j(Du);
1891
+ let e = k(Eu);
1892
+ return e === "true" || e === "same";
1893
+ }
1894
+ function j() {
1895
+ return A(Du) !== !1;
1899
1896
  }
1900
1897
  function qu() {
1901
- return j(Ou) === !0;
1898
+ return A(Ou);
1902
1899
  }
1903
1900
  function Ju() {
1904
- return A(ku);
1901
+ return A(ku) === !0;
1902
+ }
1903
+ function Yu() {
1904
+ return k(Au);
1905
1905
  }
1906
1906
  //#endregion
1907
1907
  //#region src/transport/web-socket-transport.ts
1908
- var N = w("WebSocketTransport"), Yu = 1e4, Xu = class {
1908
+ var M = w("WebSocketTransport"), Xu = 1e4, Zu = class {
1909
1909
  ws = null;
1910
1910
  keepaliveTimeout = null;
1911
1911
  isClosed = !1;
@@ -1916,7 +1916,7 @@ var N = w("WebSocketTransport"), Yu = 1e4, Xu = class {
1916
1916
  callbacks;
1917
1917
  sessionId;
1918
1918
  constructor(e) {
1919
- this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? Yu;
1919
+ this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? Xu;
1920
1920
  }
1921
1921
  get isConnected() {
1922
1922
  return this.ws?.readyState === WebSocket.OPEN;
@@ -1934,18 +1934,18 @@ var N = w("WebSocketTransport"), Yu = 1e4, Xu = class {
1934
1934
  let a = !1, o = !1, s = () => {
1935
1935
  clearTimeout(u), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
1936
1936
  }, c = () => {
1937
- o || (o = !0, clearTimeout(u), this.firstMessageResolver = null, N.debug(`WebSocket connected in ${Date.now() - n}ms`), r());
1937
+ o || (o = !0, clearTimeout(u), this.firstMessageResolver = null, M.debug(`WebSocket connected in ${Date.now() - n}ms`), r());
1938
1938
  }, l = (e) => {
1939
1939
  o || (o = !0, this.firstMessageResolver = null, s(), i(e));
1940
1940
  };
1941
1941
  this.firstMessageResolver = c;
1942
1942
  let u = setTimeout(() => {
1943
- this.ws?.close(), N.warn(`WebSocket connection timeout after ${this.connectionTimeoutMs}ms`), l(new D("WebSocket connection timeout"));
1943
+ this.ws?.close(), M.warn(`WebSocket connection timeout after ${this.connectionTimeoutMs}ms`), l(new D("WebSocket connection timeout"));
1944
1944
  }, this.connectionTimeoutMs);
1945
1945
  this.ws.onopen = () => {
1946
1946
  a = !0, this.ws.send(t), this.resetKeepaliveTimeout();
1947
1947
  }, this.ws.onerror = () => {
1948
- N.debug(`WebSocket connection failed after ${Date.now() - n}ms`), l(new D("WebSocket connection failed"));
1948
+ M.debug(`WebSocket connection failed after ${Date.now() - n}ms`), l(new D("WebSocket connection failed"));
1949
1949
  }, this.ws.onclose = (e) => {
1950
1950
  if (this.clearKeepaliveTimeout(), !o) {
1951
1951
  l(a ? new O("WebSocket closed before first server message") : new D("WebSocket connection closed before opening"));
@@ -1960,7 +1960,7 @@ var N = w("WebSocketTransport"), Yu = 1e4, Xu = class {
1960
1960
  });
1961
1961
  }
1962
1962
  send(e) {
1963
- this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) : N.warn("Cannot send: WebSocket not connected");
1963
+ this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) : M.warn("Cannot send: WebSocket not connected");
1964
1964
  }
1965
1965
  close() {
1966
1966
  this.isClosed = !0, this.clearKeepaliveTimeout(), this.ws &&= (this.ws.close(1e3, "Client closing"), null);
@@ -1977,22 +1977,22 @@ var N = w("WebSocketTransport"), Yu = 1e4, Xu = class {
1977
1977
  }
1978
1978
  this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
1979
1979
  } catch (e) {
1980
- N.error("Failed to process protocol message:", e), this.callbacks.onError(e instanceof Error ? e : Error(String(e)));
1980
+ M.error("Failed to process protocol message:", e), this.callbacks.onError(e instanceof Error ? e : Error(String(e)));
1981
1981
  }
1982
1982
  }
1983
1983
  resetKeepaliveTimeout() {
1984
1984
  this.clearKeepaliveTimeout(), !(this.keepaliveTimeoutMs <= 0) && (this.keepaliveTimeout = setTimeout(() => {
1985
- N.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new nu(this.keepaliveTimeoutMs)), this.close();
1985
+ M.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new nu(this.keepaliveTimeoutMs)), this.close();
1986
1986
  }, this.keepaliveTimeoutMs));
1987
1987
  }
1988
1988
  clearKeepaliveTimeout() {
1989
1989
  this.keepaliveTimeout &&= (clearTimeout(this.keepaliveTimeout), null);
1990
1990
  }
1991
- }, P = w("WebTransportTransport"), Zu = 1e4, Qu = 4, $u = 65536;
1992
- function ed() {
1991
+ }, N = w("WebTransportTransport"), Qu = 1e4, $u = 4, ed = 65536;
1992
+ function td() {
1993
1993
  return typeof WebTransport < "u";
1994
1994
  }
1995
- var td = class {
1995
+ var nd = class {
1996
1996
  transport = null;
1997
1997
  stream = null;
1998
1998
  reader = null;
@@ -2000,7 +2000,7 @@ var td = class {
2000
2000
  keepaliveTimeout = null;
2001
2001
  readLoopActive = !1;
2002
2002
  isClosed = !1;
2003
- receiveBuffer = new Uint8Array($u);
2003
+ receiveBuffer = new Uint8Array(ed);
2004
2004
  receiveBufferOffset = 0;
2005
2005
  receiveBufferLength = 0;
2006
2006
  receiveDataView = null;
@@ -2013,13 +2013,13 @@ var td = class {
2013
2013
  callbacks;
2014
2014
  sessionId;
2015
2015
  constructor(e) {
2016
- this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? Zu;
2016
+ this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? Qu;
2017
2017
  }
2018
2018
  get isConnected() {
2019
2019
  return this.transport !== null && this.writer !== null;
2020
2020
  }
2021
2021
  async connect(e, t) {
2022
- if (!ed()) throw new D("WebTransport is not supported in this browser");
2022
+ if (!td()) throw new D("WebTransport is not supported in this browser");
2023
2023
  this.isClosed = !1;
2024
2024
  let n = Date.now(), r = new Promise((e, t) => {
2025
2025
  this.firstMessageResolver = e, this.firstMessageRejecter = t;
@@ -2032,14 +2032,14 @@ var td = class {
2032
2032
  try {
2033
2033
  await Promise.race([this.transport.ready, a]);
2034
2034
  } catch (e) {
2035
- throw e instanceof D && P.warn(`WebTransport connection timeout after ${this.connectionTimeoutMs}ms`), e;
2035
+ throw e instanceof D && N.warn(`WebTransport connection timeout after ${this.connectionTimeoutMs}ms`), e;
2036
2036
  } finally {
2037
2037
  clearTimeout(i);
2038
2038
  }
2039
2039
  this.transport.closed.then(() => {
2040
2040
  this.handleClose("Connection closed", !0);
2041
2041
  }).catch((e) => {
2042
- P.error("WebTransport connection closed with error:", e), this.handleClose(e instanceof Error ? e.message : "Connection error", !1);
2042
+ N.error("WebTransport connection closed with error:", e), this.handleClose(e instanceof Error ? e.message : "Connection error", !1);
2043
2043
  }), this.stream = await this.transport.createBidirectionalStream(), this.reader = this.stream.readable.getReader(), this.writer = this.stream.writable.getWriter(), await this.writer.write(t), this.resetKeepaliveTimeout(), this.startReadLoop();
2044
2044
  let o = Math.max(this.connectionTimeoutMs - (Date.now() - n), 1), s, c = new Promise((e, t) => {
2045
2045
  s = setTimeout(() => t(new D("WebTransport closed before first server message")), o);
@@ -2049,20 +2049,20 @@ var td = class {
2049
2049
  } finally {
2050
2050
  clearTimeout(s);
2051
2051
  }
2052
- this.firstMessageResolver = null, this.firstMessageRejecter = null, P.info(`WebTransport connected in ${Date.now() - n}ms`);
2052
+ this.firstMessageResolver = null, this.firstMessageRejecter = null, N.info(`WebTransport connected in ${Date.now() - n}ms`);
2053
2053
  } catch (e) {
2054
2054
  this.firstMessageResolver = null, this.firstMessageRejecter = null, this.isClosed = !0, this.cleanup();
2055
2055
  let t = Date.now() - n;
2056
- throw P.warn(`WebTransport connection failed after ${t}ms: ${e}`), new D(`Failed to connect WebTransport: ${e}`, e instanceof Error ? e : void 0);
2056
+ throw N.warn(`WebTransport connection failed after ${t}ms: ${e}`), new D(`Failed to connect WebTransport: ${e}`, e instanceof Error ? e : void 0);
2057
2057
  }
2058
2058
  }
2059
2059
  send(e) {
2060
2060
  if (!this.writer) {
2061
- P.warn("Cannot send: WebTransport not connected");
2061
+ N.warn("Cannot send: WebTransport not connected");
2062
2062
  return;
2063
2063
  }
2064
2064
  this.writer.write(e).catch((e) => {
2065
- P.error("Failed to send protocol message:", e), this.callbacks.onError(e instanceof Error ? e : Error(String(e)));
2065
+ N.error("Failed to send protocol message:", e), this.callbacks.onError(e instanceof Error ? e : Error(String(e)));
2066
2066
  });
2067
2067
  }
2068
2068
  close() {
@@ -2079,7 +2079,7 @@ var td = class {
2079
2079
  }
2080
2080
  this.readLoopActive && this.handleClose("Stream ended", !1);
2081
2081
  } catch (e) {
2082
- this.readLoopActive && (P.error("Read loop error:", e), this.callbacks.onError(e instanceof Error ? e : Error(String(e))));
2082
+ this.readLoopActive && (N.error("Read loop error:", e), this.callbacks.onError(e instanceof Error ? e : Error(String(e))));
2083
2083
  }
2084
2084
  }
2085
2085
  }
@@ -2100,10 +2100,10 @@ var td = class {
2100
2100
  }
2101
2101
  processBufferedMessages() {
2102
2102
  let e = this.getReceiveDataView();
2103
- for (; this.receiveBufferLength >= Qu;) {
2103
+ for (; this.receiveBufferLength >= $u;) {
2104
2104
  let t = e.getUint32(this.receiveBufferOffset, !0);
2105
- if (t < Qu) {
2106
- P.error(`Invalid message length: ${t}`), this.callbacks.onError(/* @__PURE__ */ Error(`Invalid protocol message length: ${t}`)), this.receiveBufferOffset = 0, this.receiveBufferLength = 0;
2105
+ if (t < $u) {
2106
+ N.error(`Invalid message length: ${t}`), this.callbacks.onError(/* @__PURE__ */ Error(`Invalid protocol message length: ${t}`)), this.receiveBufferOffset = 0, this.receiveBufferLength = 0;
2107
2107
  return;
2108
2108
  }
2109
2109
  if (this.receiveBufferLength < t) return;
@@ -2121,7 +2121,7 @@ var td = class {
2121
2121
  }
2122
2122
  this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
2123
2123
  } catch (e) {
2124
- P.error("Failed to process protocol message:", e), this.callbacks.onError(e instanceof Error ? e : Error(String(e)));
2124
+ N.error("Failed to process protocol message:", e), this.callbacks.onError(e instanceof Error ? e : Error(String(e)));
2125
2125
  }
2126
2126
  }
2127
2127
  handleClose(e, t) {
@@ -2135,7 +2135,7 @@ var td = class {
2135
2135
  }
2136
2136
  resetKeepaliveTimeout() {
2137
2137
  this.clearKeepaliveTimeout(), !(this.keepaliveTimeoutMs <= 0) && (this.keepaliveTimeout = setTimeout(() => {
2138
- P.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new nu(this.keepaliveTimeoutMs)), this.close();
2138
+ N.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new nu(this.keepaliveTimeoutMs)), this.close();
2139
2139
  }, this.keepaliveTimeoutMs));
2140
2140
  }
2141
2141
  clearKeepaliveTimeout() {
@@ -2149,7 +2149,7 @@ var td = class {
2149
2149
  this.transport = null;
2150
2150
  }
2151
2151
  }
2152
- }, nd = w("Channel"), rd = class {
2152
+ }, rd = w("Channel"), id = class {
2153
2153
  state = "disconnected";
2154
2154
  transport = null;
2155
2155
  config;
@@ -2189,7 +2189,7 @@ var td = class {
2189
2189
  }
2190
2190
  send(e) {
2191
2191
  if (!this.transport?.isConnected) {
2192
- nd.warn("Cannot send: channel not connected");
2192
+ rd.warn("Cannot send: channel not connected");
2193
2193
  return;
2194
2194
  }
2195
2195
  this.transport.send(e);
@@ -2208,12 +2208,12 @@ var td = class {
2208
2208
  switch (e.Type) {
2209
2209
  case x.WebSocket:
2210
2210
  case x.WebSocketProxy:
2211
- this.transport = new Xu(t);
2211
+ this.transport = new Zu(t);
2212
2212
  break;
2213
2213
  case x.WebTransport:
2214
2214
  case x.WebTransportProxy:
2215
- if (!ed()) throw Error("WebTransport is not supported in this browser");
2216
- this.transport = new td(t);
2215
+ if (!td()) throw Error("WebTransport is not supported in this browser");
2216
+ this.transport = new nd(t);
2217
2217
  break;
2218
2218
  default: throw Error(`Unsupported entrypoint type: ${x[e.Type]}`);
2219
2219
  }
@@ -2223,12 +2223,12 @@ var td = class {
2223
2223
  try {
2224
2224
  let t = y(e);
2225
2225
  if (c(t) === T.CORE_ON_SERVER_STOPPING) {
2226
- nd.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
2226
+ rd.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
2227
2227
  return;
2228
2228
  }
2229
2229
  this.config.onProtocolMessage?.(t);
2230
2230
  } catch (e) {
2231
- nd.error("Failed to handle protocol message:", e), this.config.onError?.(e instanceof Error ? e : Error(String(e)));
2231
+ rd.error("Failed to handle protocol message:", e), this.config.onError?.(e instanceof Error ? e : Error(String(e)));
2232
2232
  }
2233
2233
  }
2234
2234
  handleClose(e, t) {
@@ -2240,7 +2240,7 @@ var td = class {
2240
2240
  setState(e) {
2241
2241
  this.state !== e && (this.state = e, this.config.onStateChange?.(e));
2242
2242
  }
2243
- }, F = w("ChannelManager"), id = 5e3, ad = class {
2243
+ }, P = w("ChannelManager"), ad = 5e3, od = class {
2244
2244
  channels = /* @__PURE__ */ new Map();
2245
2245
  activeType = null;
2246
2246
  state = "idle";
@@ -2277,7 +2277,7 @@ var td = class {
2277
2277
  r.send(e);
2278
2278
  return;
2279
2279
  }
2280
- this.state === "connected" && F.warn("No channel found for message");
2280
+ this.state === "connected" && P.warn("No channel found for message");
2281
2281
  }
2282
2282
  sendToAll(e) {
2283
2283
  for (let t of this.channels.values()) t.send(e);
@@ -2287,7 +2287,7 @@ var td = class {
2287
2287
  }
2288
2288
  triggerReconnect(e) {
2289
2289
  if (this.state === "connected") {
2290
- F.debug(`Forcing reconnect: ${e}`);
2290
+ P.debug(`Forcing reconnect: ${e}`);
2291
2291
  for (let t of this.channels.values()) t.triggerReconnect(e);
2292
2292
  }
2293
2293
  }
@@ -2300,26 +2300,26 @@ var td = class {
2300
2300
  let e = new Set(n.keys());
2301
2301
  r = this.config.orderedEndpointTypes.filter((t) => e.has(t));
2302
2302
  } else r = this.config.endpointSelector ? this.config.endpointSelector.getOrderedTypes(n) : Array.from(n.keys());
2303
- this.connectionTimeoutMs = r.length > 1 ? 5e3 : 1e4, F.debug(`Endpoint types to try: [${r.map((e) => x[e]).join(", ")}], transport timeout: ${this.connectionTimeoutMs}ms`);
2303
+ this.connectionTimeoutMs = r.length > 1 ? 5e3 : 1e4, P.debug(`Endpoint types to try: [${r.map((e) => x[e]).join(", ")}], transport timeout: ${this.connectionTimeoutMs}ms`);
2304
2304
  for (let e of r) {
2305
2305
  if (!this.shouldReconnect) return;
2306
2306
  let t = n.get(e), r = Date.now();
2307
- F.debug(`Trying ${x[e]} (${t.length} channel(s))`);
2307
+ P.debug(`Trying ${x[e]} (${t.length} channel(s))`);
2308
2308
  try {
2309
- await this.connectAllChannels(t), this.config.endpointSelector?.rememberWorkingType(e), this.config.onRememberWorkingType?.(e), this.activeType = e, F.debug(`Connected via ${x[e]} in ${Date.now() - r}ms`), this.setState("connected"), this.startStabilityTimer();
2309
+ await this.connectAllChannels(t), this.config.endpointSelector?.rememberWorkingType(e), this.config.onRememberWorkingType?.(e), this.activeType = e, P.debug(`Connected via ${x[e]} in ${Date.now() - r}ms`), this.setState("connected"), this.startStabilityTimer();
2310
2310
  return;
2311
2311
  } catch (t) {
2312
- F.warn(`Failed to connect using ${x[e]} after ${Date.now() - r}ms: ${t instanceof Error ? t.message : t}`);
2312
+ P.warn(`Failed to connect using ${x[e]} after ${Date.now() - r}ms: ${t instanceof Error ? t.message : t}`);
2313
2313
  let i = this.channels.size > 0;
2314
2314
  if (this.disconnectAll(), t instanceof O) throw t;
2315
2315
  if (i && this.config.onRefreshEntrypoints) try {
2316
- F.info("Partial connection detected, refreshing entrypoints");
2316
+ P.info("Partial connection detected, refreshing entrypoints");
2317
2317
  let e = await this.config.onRefreshEntrypoints();
2318
2318
  this.entrypoints = e.entrypoints, this.config.sessionId = e.sessionId;
2319
2319
  let t = e.entrypoints.filter((e) => e.Type !== x.WebRTC), r = this.groupByType(t);
2320
2320
  for (let [e, t] of r) n.set(e, t);
2321
2321
  } catch (e) {
2322
- F.warn(`Failed to refresh entrypoints: ${e}`);
2322
+ P.warn(`Failed to refresh entrypoints: ${e}`);
2323
2323
  }
2324
2324
  }
2325
2325
  }
@@ -2334,7 +2334,7 @@ var td = class {
2334
2334
  }
2335
2335
  }
2336
2336
  async connectChannel(e) {
2337
- let t = new rd({
2337
+ let t = new id({
2338
2338
  entrypoint: e,
2339
2339
  sessionId: this.config.sessionId,
2340
2340
  keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
@@ -2366,31 +2366,31 @@ var td = class {
2366
2366
  t === "stopped" && (this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped"));
2367
2367
  }
2368
2368
  handleChannelClose(e, t, n) {
2369
- this.state !== "idle" && this.state !== "stopped" && this.state !== "offline" && this.channels.has(e) && this.state === "connected" && (F.warn("Channel closed unexpectedly, attempting reconnect"), this.disconnectAll(), this.attemptReconnect());
2369
+ this.state !== "idle" && this.state !== "stopped" && this.state !== "offline" && this.channels.has(e) && this.state === "connected" && (P.warn("Channel closed unexpectedly, attempting reconnect"), this.disconnectAll(), this.attemptReconnect());
2370
2370
  }
2371
2371
  async attemptReconnect() {
2372
2372
  if (this.shouldReconnect) {
2373
- if (!M()) {
2374
- F.warn("Retry disabled via ikon-retry=false, skipping reconnect"), this.setState("offline"), this.config.onError?.(new ru(0));
2373
+ if (!j()) {
2374
+ P.warn("Retry disabled via ikon-retry=false, skipping reconnect"), this.setState("offline"), this.config.onError?.(new ru(0));
2375
2375
  return;
2376
2376
  }
2377
2377
  if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
2378
- F.warn(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new ru(this.config.maxReconnectAttempts));
2378
+ P.warn(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new ru(this.config.maxReconnectAttempts));
2379
2379
  return;
2380
2380
  }
2381
2381
  if (this.setState("reconnecting"), this.reconnectAttempts++, this.reconnectAttempts > 1) {
2382
- F.info(`Reconnecting in ${this.config.reconnectBackoffMs}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`);
2382
+ P.info(`Reconnecting in ${this.config.reconnectBackoffMs}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`);
2383
2383
  try {
2384
- await du(this.config.reconnectBackoffMs, this.abortController?.signal);
2384
+ await fu(this.config.reconnectBackoffMs, this.abortController?.signal);
2385
2385
  } catch {
2386
2386
  return;
2387
2387
  }
2388
- } else F.info(`Reconnecting immediately (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`);
2388
+ } else P.info(`Reconnecting immediately (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`);
2389
2389
  if (this.shouldReconnect) try {
2390
2390
  await this.connectInternal(!0);
2391
2391
  } catch (e) {
2392
2392
  if (e instanceof O) {
2393
- F.warn("Auth rejected during reconnect, stopping retries and signaling full re-auth"), this.config.onError?.(e), this.setState("offline");
2393
+ P.warn("Auth rejected during reconnect, stopping retries and signaling full re-auth"), this.config.onError?.(e), this.setState("offline");
2394
2394
  return;
2395
2395
  }
2396
2396
  await this.attemptReconnect();
@@ -2407,12 +2407,12 @@ var td = class {
2407
2407
  startStabilityTimer() {
2408
2408
  this.clearStabilityTimer(), this.stabilityTimer = setTimeout(() => {
2409
2409
  this.stabilityTimer = null, this.state === "connected" && (this.reconnectAttempts = 0);
2410
- }, id);
2410
+ }, ad);
2411
2411
  }
2412
2412
  clearStabilityTimer() {
2413
2413
  this.stabilityTimer &&= (clearTimeout(this.stabilityTimer), null);
2414
2414
  }
2415
- }, od = "opus", sd = 48e3, cd = 2, ld = 64e3, ud = 150, dd = "VP8", fd = 5e6, pd = 30, md = .05, hd = "max-bundle", gd = "require", _d = 5e3, vd = 8e3, yd = 16, bd = 16, xd = "ikon-data", Sd = !1, Cd = 0, I = w("WebRTCConnection"), wd = class {
2415
+ }, sd = "opus", cd = 48e3, ld = 2, ud = 64e3, dd = 150, fd = "VP8", pd = 5e6, md = 30, hd = .05, gd = "max-bundle", _d = "require", vd = 5e3, yd = 8e3, bd = 16, xd = 16, Sd = "ikon-data", Cd = !1, wd = 0, F = w("WebRTCConnection"), Td = class {
2416
2416
  pc = null;
2417
2417
  dataChannel = null;
2418
2418
  _state = "new";
@@ -2437,11 +2437,11 @@ var td = class {
2437
2437
  if (this.pc = new RTCPeerConnection({
2438
2438
  iceServers: this.config.iceServers ?? [],
2439
2439
  iceTransportPolicy: this.config.iceTransportPolicy,
2440
- bundlePolicy: hd,
2441
- rtcpMuxPolicy: gd
2440
+ bundlePolicy: gd,
2441
+ rtcpMuxPolicy: _d
2442
2442
  }), this.setupEventHandlers(), this.config.useAudioTrack) for (let e = 0; e < 16; e++) this.pc.addTransceiver("audio", { direction: "sendrecv" });
2443
2443
  if (this.config.useVideoTrack) for (let e = 0; e < 16; e++) this.pc.addTransceiver("video", { direction: "sendrecv" });
2444
- this.config.useDataChannel && (this.dataChannel = this.pc.createDataChannel(xd, {
2444
+ this.config.useDataChannel && (this.dataChannel = this.pc.createDataChannel(Sd, {
2445
2445
  ordered: !1,
2446
2446
  maxRetransmits: 0
2447
2447
  }), this.setupDataChannelHandlers(this.dataChannel));
@@ -2459,11 +2459,11 @@ var td = class {
2459
2459
  type: t
2460
2460
  };
2461
2461
  if (await this.pc.setRemoteDescription(n), this.hasRemoteDescription = !0, this.pendingCandidates.length > 0) {
2462
- I.debug(`Flushing ${this.pendingCandidates.length} queued ICE candidates`);
2462
+ F.debug(`Flushing ${this.pendingCandidates.length} queued ICE candidates`);
2463
2463
  for (let e of this.pendingCandidates) try {
2464
2464
  await this.pc.addIceCandidate(e);
2465
2465
  } catch (e) {
2466
- I.warn("Failed to add queued ICE candidate:", e);
2466
+ F.warn("Failed to add queued ICE candidate:", e);
2467
2467
  }
2468
2468
  this.pendingCandidates = [];
2469
2469
  }
@@ -2481,21 +2481,21 @@ var td = class {
2481
2481
  return this.pc.addTrack(e, t);
2482
2482
  }
2483
2483
  async replaceTrack(e, t, n) {
2484
- if (!this.pc) return I.warn(`replaceTrack(${e}): no peer connection`), null;
2484
+ if (!this.pc) return F.warn(`replaceTrack(${e}): no peer connection`), null;
2485
2485
  let r = this.pc.getTransceivers().filter((t) => t.receiver.track?.kind === e);
2486
2486
  if (n !== void 0) {
2487
2487
  let i = r[n];
2488
- return i ? (await i.sender.replaceTrack(t), i.sender) : (I.warn(`replaceTrack(${e}[${n}]): no transceiver at index`), null);
2488
+ return i ? (await i.sender.replaceTrack(t), i.sender) : (F.warn(`replaceTrack(${e}[${n}]): no transceiver at index`), null);
2489
2489
  }
2490
2490
  let i = r[0];
2491
- return i ? (await i.sender.replaceTrack(t), i.sender) : (I.warn(`replaceTrack(${e}): no matching transceiver found`), null);
2491
+ return i ? (await i.sender.replaceTrack(t), i.sender) : (F.warn(`replaceTrack(${e}): no matching transceiver found`), null);
2492
2492
  }
2493
2493
  removeTrack(e) {
2494
2494
  this.pc && this.pc.removeTrack(e);
2495
2495
  }
2496
2496
  sendDataChannelMessage(e) {
2497
2497
  if (!this.dataChannel || this.dataChannel.readyState !== "open") {
2498
- I.warn("DataChannel not open, cannot send message");
2498
+ F.warn("DataChannel not open, cannot send message");
2499
2499
  return;
2500
2500
  }
2501
2501
  this.dataChannel.send(e);
@@ -2525,38 +2525,38 @@ var td = class {
2525
2525
  try {
2526
2526
  e.receiver.jitterBufferTarget = 150;
2527
2527
  } catch (e) {
2528
- I.warn("Failed to set jitterBufferTarget:", e);
2528
+ F.warn("Failed to set jitterBufferTarget:", e);
2529
2529
  }
2530
2530
  let n = e.streams[0] ?? new MediaStream([t]), r = this.audioTrackCount++;
2531
2531
  this.config.onAudioTrack?.(r, t, n);
2532
2532
  } else if (t.kind === "video") {
2533
2533
  try {
2534
- e.receiver.playoutDelayHint = md;
2534
+ e.receiver.playoutDelayHint = hd;
2535
2535
  } catch (e) {
2536
- I.warn("Failed to set playoutDelayHint:", e);
2536
+ F.warn("Failed to set playoutDelayHint:", e);
2537
2537
  }
2538
2538
  let n = new MediaStream([t]), r = this.videoTrackCount;
2539
2539
  this.videoTrackCount++, this.config.onVideoTrack?.(r, t, n);
2540
2540
  }
2541
2541
  }, this.pc.ondatachannel = (e) => {
2542
- I.debug("Received data channel:", e.channel.label), this.setupDataChannelHandlers(e.channel);
2542
+ F.debug("Received data channel:", e.channel.label), this.setupDataChannelHandlers(e.channel);
2543
2543
  });
2544
2544
  }
2545
2545
  setupDataChannelHandlers(e) {
2546
2546
  e.binaryType = "arraybuffer", e.onopen = () => {
2547
- I.debug("DataChannel opened"), this.config.onDataChannelOpen?.();
2547
+ F.debug("DataChannel opened"), this.config.onDataChannelOpen?.();
2548
2548
  }, e.onclose = () => {
2549
- I.debug("DataChannel closed"), this.config.onDataChannelClose?.();
2549
+ F.debug("DataChannel closed"), this.config.onDataChannelClose?.();
2550
2550
  }, e.onmessage = (e) => {
2551
2551
  e.data instanceof ArrayBuffer && this.config.onDataChannelMessage?.(e.data);
2552
2552
  }, e.onerror = (e) => {
2553
- I.error("DataChannel error:", e);
2553
+ F.error("DataChannel error:", e);
2554
2554
  };
2555
2555
  }
2556
2556
  setState(e) {
2557
2557
  this._state !== e && (this._state = e, this.config.onStateChange?.(e));
2558
2558
  }
2559
- }, L = w("WebRTCSignaling"), Td = class {
2559
+ }, I = w("WebRTCSignaling"), Ed = class {
2560
2560
  config;
2561
2561
  connection = null;
2562
2562
  sendMessage = null;
@@ -2578,14 +2578,14 @@ var td = class {
2578
2578
  }
2579
2579
  async connect(e) {
2580
2580
  if (this.isConnecting || this.connection?.state === "connected") {
2581
- L.warn("WebRTC already connecting or connected");
2581
+ I.warn("WebRTC already connecting or connected");
2582
2582
  return;
2583
2583
  }
2584
- L.debug(`Starting WebRTC connection (audio=${this.config.useAudioTrack}, video=${this.config.useVideoTrack}, dataChannel=${this.config.useDataChannel})`), this.isConnecting = !0, this.audioTrackCount = 0, this.videoTrackCount = 0, this.sendMessage = e;
2584
+ I.debug(`Starting WebRTC connection (audio=${this.config.useAudioTrack}, video=${this.config.useVideoTrack}, dataChannel=${this.config.useDataChannel})`), this.isConnecting = !0, this.audioTrackCount = 0, this.videoTrackCount = 0, this.sendMessage = e;
2585
2585
  try {
2586
2586
  let e = await this.requestIceServers();
2587
2587
  if (e.length === 0 && this.config.shouldAttemptWithoutIceServers?.() === !1) {
2588
- L.debug("No ICE servers and no remembered direct success — abandoning WebRTC so media starts on the protocol channel"), this.isConnecting = !1, this.config.onStateChange?.("failed");
2588
+ I.debug("No ICE servers and no remembered direct success — abandoning WebRTC so media starts on the protocol channel"), this.isConnecting = !1, this.config.onStateChange?.("failed");
2589
2589
  return;
2590
2590
  }
2591
2591
  let t = {
@@ -2596,7 +2596,7 @@ var td = class {
2596
2596
  iceTransportPolicy: this.config.iceTransportPolicy,
2597
2597
  onIceCandidate: (e) => this.handleLocalIceCandidate(e),
2598
2598
  onStateChange: (e) => {
2599
- L.debug(`WebRTC connection state: ${e}`), e === "connected" && L.debug(`WebRTC tracks: ${this.audioTrackCount} audio, ${this.videoTrackCount} video`), this.config.onStateChange?.(e);
2599
+ I.debug(`WebRTC connection state: ${e}`), e === "connected" && I.debug(`WebRTC tracks: ${this.audioTrackCount} audio, ${this.videoTrackCount} video`), this.config.onStateChange?.(e);
2600
2600
  },
2601
2601
  onDataChannelMessage: this.config.onDataChannelMessage,
2602
2602
  onDataChannelOpen: this.config.onDataChannelOpen,
@@ -2608,11 +2608,11 @@ var td = class {
2608
2608
  this.videoTrackCount++, this.config.onVideoTrack?.(e, t, n);
2609
2609
  }
2610
2610
  };
2611
- this.connection = new wd(t), await this.connection.initialize();
2611
+ this.connection = new Td(t), await this.connection.initialize();
2612
2612
  let n = await this.connection.createOffer();
2613
2613
  this.sendOffer(n);
2614
2614
  } catch (e) {
2615
- throw L.error("Failed to start WebRTC connection:", e), this.isConnecting = !1, e;
2615
+ throw I.error("Failed to start WebRTC connection:", e), this.isConnecting = !1, e;
2616
2616
  }
2617
2617
  }
2618
2618
  handleProtocolMessage(e) {
@@ -2655,11 +2655,11 @@ var td = class {
2655
2655
  return r && r.active ? r : null;
2656
2656
  }
2657
2657
  async startAudioCapture(e) {
2658
- this.audioCaptureConstraints = e, await this.acquireAudioTrack(), L.debug("Started audio capture via WebRTC");
2658
+ this.audioCaptureConstraints = e, await this.acquireAudioTrack(), I.debug("Started audio capture via WebRTC");
2659
2659
  }
2660
2660
  startAudioSegment(e) {
2661
2661
  if (!this.sendMessage) {
2662
- L.warn("Cannot start audio segment: no send function");
2662
+ I.warn("Cannot start audio segment: no send function");
2663
2663
  return;
2664
2664
  }
2665
2665
  this.audioSegmentActive = !0;
@@ -2667,17 +2667,17 @@ var td = class {
2667
2667
  t && t.readyState === "live" ? t.enabled = !0 : this.acquireAudioTrack().then((e) => {
2668
2668
  e && (this.audioSegmentActive ? e.enabled = !0 : ye() && this.releaseAudioTrack());
2669
2669
  }).catch((e) => {
2670
- L.warn(`Failed to re-acquire microphone for audio segment: ${String(e)}`);
2670
+ I.warn(`Failed to re-acquire microphone for audio segment: ${String(e)}`);
2671
2671
  });
2672
2672
  let n = Ic(Mc({
2673
2673
  IsStart: !0,
2674
2674
  CorrelationId: e
2675
2675
  }), this.config.sessionId);
2676
- this.sendMessage(n), L.debug("Started audio segment");
2676
+ this.sendMessage(n), I.debug("Started audio segment");
2677
2677
  }
2678
2678
  endAudioSegment(e) {
2679
2679
  if (!this.sendMessage) {
2680
- L.warn("Cannot end audio segment: no send function");
2680
+ I.warn("Cannot end audio segment: no send function");
2681
2681
  return;
2682
2682
  }
2683
2683
  this.audioSegmentActive = !1;
@@ -2687,7 +2687,7 @@ var td = class {
2687
2687
  }), this.config.sessionId);
2688
2688
  this.sendMessage(t);
2689
2689
  let n = this.audioCaptureStream?.getAudioTracks()[0];
2690
- n && (n.enabled = !1, ye() && this.releaseAudioTrack()), L.debug("Ended audio segment");
2690
+ n && (n.enabled = !1, ye() && this.releaseAudioTrack()), I.debug("Ended audio segment");
2691
2691
  }
2692
2692
  async acquireAudioTrack() {
2693
2693
  let e = await navigator.mediaDevices.getUserMedia({
@@ -2721,7 +2721,7 @@ var td = class {
2721
2721
  let a = i.getVideoTracks()[0];
2722
2722
  if (a) {
2723
2723
  let e = a.getSettings();
2724
- L.debug(`Camera capture (track ${n}): ${e.width}x${e.height}@${e.frameRate}fps`);
2724
+ I.debug(`Camera capture (track ${n}): ${e.width}x${e.height}@${e.frameRate}fps`);
2725
2725
  let i = await this.connection?.replaceTrack("video", a, n);
2726
2726
  i && await this.applyEncodingParams(i, t), this.sendVideoStreamBegin("camera", n, e.width ?? 0, e.height ?? 0, e.frameRate ?? 30, r);
2727
2727
  }
@@ -2736,7 +2736,7 @@ var td = class {
2736
2736
  let a = i.getVideoTracks()[0];
2737
2737
  if (a) {
2738
2738
  let e = a.getSettings();
2739
- L.debug(`Screen capture (track ${n}): ${e.width}x${e.height}@${e.frameRate}fps`);
2739
+ I.debug(`Screen capture (track ${n}): ${e.width}x${e.height}@${e.frameRate}fps`);
2740
2740
  let i = await this.connection?.replaceTrack("video", a, n);
2741
2741
  i && await this.applyEncodingParams(i, t), this.sendVideoStreamBegin("screen", n, e.width ?? 0, e.height ?? 0, e.frameRate ?? 30, r);
2742
2742
  }
@@ -2749,7 +2749,7 @@ var td = class {
2749
2749
  for (let e of t.getTracks()) e.stop();
2750
2750
  this.videoCaptureStreams.delete(e), await this.connection?.replaceTrack("video", null, e);
2751
2751
  }
2752
- L.debug(`Stopped video capture (track ${e})`);
2752
+ I.debug(`Stopped video capture (track ${e})`);
2753
2753
  }
2754
2754
  sendVideoStreamBegin(e, t, n, i, a, o) {
2755
2755
  if (!this.sendMessage) return;
@@ -2772,7 +2772,7 @@ var td = class {
2772
2772
  this.sendMessage(de(t, this.config.sessionId, { trackId: e }));
2773
2773
  }
2774
2774
  stopAudioCapture() {
2775
- this.audioSegmentActive = !1, this.releaseAudioTrack(), this.audioCaptureConstraints = void 0, L.debug("Stopped audio capture");
2775
+ this.audioSegmentActive = !1, this.releaseAudioTrack(), this.audioCaptureConstraints = void 0, I.debug("Stopped audio capture");
2776
2776
  }
2777
2777
  async stopCapture() {
2778
2778
  for (let e of [...this.videoCaptureStreams.keys()]) await this.stopVideoCapture(e);
@@ -2780,19 +2780,19 @@ var td = class {
2780
2780
  for (let e of this.audioCaptureStream.getTracks()) e.stop();
2781
2781
  this.audioCaptureStream = null, await this.connection?.replaceTrack("audio", null);
2782
2782
  }
2783
- this.audioCaptureConstraints = void 0, L.debug("Stopped all capture");
2783
+ this.audioCaptureConstraints = void 0, I.debug("Stopped all capture");
2784
2784
  }
2785
2785
  async applyEncodingParams(e, t) {
2786
2786
  try {
2787
2787
  let n = t ?? 5e6, r = e.getParameters();
2788
2788
  r.encodings?.length || (r.encodings = [{}]), r.encodings[0].maxBitrate = n, r.degradationPreference = "balanced", await e.setParameters(r);
2789
2789
  } catch (e) {
2790
- L.warn("Failed to set encoding params:", e);
2790
+ I.warn("Failed to set encoding params:", e);
2791
2791
  }
2792
2792
  }
2793
2793
  sendOffer(e) {
2794
2794
  if (!this.sendMessage) {
2795
- L.error("Cannot send offer: no send function");
2795
+ I.error("Cannot send offer: no send function");
2796
2796
  return;
2797
2797
  }
2798
2798
  let t = Cl(yl({
@@ -2803,7 +2803,7 @@ var td = class {
2803
2803
  UseVideoTrack: this.config.useVideoTrack,
2804
2804
  UseDataChannel: this.config.useDataChannel
2805
2805
  }), this.config.sessionId);
2806
- this.sendMessage(t), L.debug("Sent WebRTC offer");
2806
+ this.sendMessage(t), I.debug("Sent WebRTC offer");
2807
2807
  }
2808
2808
  async requestIceServers() {
2809
2809
  let e = this.config.iceServers ?? [];
@@ -2812,8 +2812,8 @@ var td = class {
2812
2812
  this.iceServersResolve = e;
2813
2813
  }), n, r = new Promise((t) => {
2814
2814
  n = setTimeout(() => {
2815
- L.warn("Timed out waiting for ICE servers from server, proceeding without TURN"), t(e);
2816
- }, _d);
2815
+ I.warn("Timed out waiting for ICE servers from server, proceeding without TURN"), t(e);
2816
+ }, vd);
2817
2817
  }), i = tl();
2818
2818
  this.sendMessage(rl(i, this.config.sessionId));
2819
2819
  let a = await Promise.race([t, r]);
@@ -2824,9 +2824,9 @@ var td = class {
2824
2824
  let t = this.config.iceServers ?? [];
2825
2825
  try {
2826
2826
  let n = dl(e), r = n.IceServersJson ? JSON.parse(n.IceServersJson) : [];
2827
- L.debug(`Received ${r.length} ICE server(s) from server`), this.iceServersResolve([...t, ...r]);
2827
+ I.debug(`Received ${r.length} ICE server(s) from server`), this.iceServersResolve([...t, ...r]);
2828
2828
  } catch (e) {
2829
- L.warn("Failed to parse ICE servers response, proceeding with configured servers:", e), this.iceServersResolve(t);
2829
+ I.warn("Failed to parse ICE servers response, proceeding with configured servers:", e), this.iceServersResolve(t);
2830
2830
  }
2831
2831
  }
2832
2832
  async handleAnswer(e) {
@@ -2834,9 +2834,9 @@ var td = class {
2834
2834
  let t = Oc(e);
2835
2835
  await this.connection?.setRemoteDescription(t.Sdp, "answer");
2836
2836
  let n = this.parseVideoCodecFromSdp(t.Sdp);
2837
- L.debug(`WebRTC answer received and applied (video=${n})`);
2837
+ I.debug(`WebRTC answer received and applied (video=${n})`);
2838
2838
  } catch (e) {
2839
- L.error("Failed to handle WebRTC answer:", e);
2839
+ I.error("Failed to handle WebRTC answer:", e);
2840
2840
  }
2841
2841
  }
2842
2842
  parseVideoCodecFromSdp(e) {
@@ -2864,15 +2864,15 @@ var td = class {
2864
2864
  });
2865
2865
  }
2866
2866
  } catch (e) {
2867
- L.error("Failed to add ICE candidate:", e);
2867
+ I.error("Failed to add ICE candidate:", e);
2868
2868
  }
2869
2869
  }
2870
2870
  handleReady(e) {
2871
2871
  try {
2872
2872
  let t = Ml(e);
2873
- t.Success ? (L.debug("WebRTC connection ready"), this.isConnecting = !1) : (L.error(`WebRTC connection failed (server): ${t.ErrorMessage}`), this.config.onStateChange?.("failed"), this.disconnect());
2873
+ t.Success ? (I.debug("WebRTC connection ready"), this.isConnecting = !1) : (I.error(`WebRTC connection failed (server): ${t.ErrorMessage}`), this.config.onStateChange?.("failed"), this.disconnect());
2874
2874
  } catch (e) {
2875
- L.error("Failed to handle WebRTC ready:", e);
2875
+ I.error("Failed to handle WebRTC ready:", e);
2876
2876
  }
2877
2877
  }
2878
2878
  handleTrackMap(e) {
@@ -2880,19 +2880,19 @@ var td = class {
2880
2880
  let t = Kl(e);
2881
2881
  this.config.onTrackMap?.(t);
2882
2882
  } catch (e) {
2883
- L.error("Failed to handle WebRTC track map:", e);
2883
+ I.error("Failed to handle WebRTC track map:", e);
2884
2884
  }
2885
2885
  }
2886
- }, Ed = w("WebRtcReachability"), Dd = "ikon-webrtc-reachability", Od = /* @__PURE__ */ new Set([
2886
+ }, Dd = w("WebRtcReachability"), Od = "ikon-webrtc-reachability", kd = /* @__PURE__ */ new Set([
2887
2887
  "direct",
2888
2888
  "relay",
2889
2889
  "failed"
2890
- ]), kd = class {
2890
+ ]), Ad = class {
2891
2891
  _remembered = null;
2892
2892
  constructor() {
2893
2893
  try {
2894
- let e = localStorage.getItem(Dd);
2895
- e !== null && Od.has(e) && (this._remembered = e, Ed.debug(`Loaded remembered WebRTC reachability: ${e}`));
2894
+ let e = localStorage.getItem(Od);
2895
+ e !== null && kd.has(e) && (this._remembered = e, Dd.debug(`Loaded remembered WebRTC reachability: ${e}`));
2896
2896
  } catch {}
2897
2897
  }
2898
2898
  get remembered() {
@@ -2917,13 +2917,13 @@ var td = class {
2917
2917
  if (this._remembered !== e) {
2918
2918
  this._remembered = e;
2919
2919
  try {
2920
- localStorage.setItem(Dd, e);
2920
+ localStorage.setItem(Od, e);
2921
2921
  } catch {}
2922
- Ed.debug(`Remembered WebRTC reachability: ${e}`);
2922
+ Dd.debug(`Remembered WebRTC reachability: ${e}`);
2923
2923
  }
2924
2924
  }
2925
2925
  };
2926
- async function Ad(e) {
2926
+ async function jd(e) {
2927
2927
  let t;
2928
2928
  try {
2929
2929
  t = await e.getStats();
@@ -2943,27 +2943,27 @@ async function Ad(e) {
2943
2943
  let a = t.get(i.localCandidateId);
2944
2944
  return a?.candidateType === void 0 ? null : a.candidateType === "relay" || typeof a.relayProtocol == "string";
2945
2945
  }
2946
- var jd = 3e4, Md = 3e5, Nd = 1e4, R = [
2946
+ var Md = 3e4, Nd = .125, Pd = 3e4, Fd = 3e5, Id = 1e4, Ld = 1e4, L = [
2947
2947
  "direct",
2948
2948
  "proxy",
2949
2949
  "lb"
2950
- ], Pd = {
2950
+ ], Rd = {
2951
2951
  "force-direct": "direct",
2952
2952
  "force-proxy": "proxy",
2953
2953
  "force-lb": "lb"
2954
2954
  };
2955
- function Fd(e, t, n) {
2956
- let r = R.filter((t) => e.includes(t));
2957
- if (n !== "auto") return r.filter((e) => e === Pd[n]);
2958
- let i = R.indexOf(t), a = r.findIndex((e) => R.indexOf(e) >= i), o = a === -1 ? Math.max(0, r.length - 1) : a;
2955
+ function zd(e, t, n) {
2956
+ let r = L.filter((t) => e.includes(t));
2957
+ if (n !== "auto") return r.filter((e) => e === Rd[n]);
2958
+ let i = L.indexOf(t), a = r.findIndex((e) => L.indexOf(e) >= i), o = a === -1 ? Math.max(0, r.length - 1) : a;
2959
2959
  return [...r.slice(o), ...r.slice(0, o)];
2960
2960
  }
2961
- var Id = {
2961
+ var R = {
2962
2962
  [x.WebTransport]: 0,
2963
2963
  [x.WebSocket]: 1,
2964
2964
  [x.WebTransportProxy]: 2,
2965
2965
  [x.WebSocketProxy]: 3
2966
- }, Ld = /* @__PURE__ */ new Set([x.WebTransportProxy, x.WebSocketProxy]), Rd = /* @__PURE__ */ new Set([x.WebTransport, x.WebSocket]), zd = /* @__PURE__ */ new Set([x.WebSocket, x.WebSocketProxy]), Bd = /* @__PURE__ */ new Set([x.WebTransport, x.WebTransportProxy]), z = w("EndpointSelector"), Vd = "ikon-endpoint-type", Hd = "ikon-proxy-preferred", Ud = "ikon-connect-tier", Wd = "ikon-endpoint-timestamp", Gd = "ikon-endpoint-revalidated", Kd = 864e5, qd = class {
2966
+ }, Bd = /* @__PURE__ */ new Set([x.WebTransportProxy, x.WebSocketProxy]), Vd = /* @__PURE__ */ new Set([x.WebTransport, x.WebSocket]), Hd = /* @__PURE__ */ new Set([x.WebSocket, x.WebSocketProxy]), Ud = /* @__PURE__ */ new Set([x.WebTransport, x.WebTransportProxy]), z = w("EndpointSelector"), Wd = "ikon-endpoint-type", Gd = "ikon-proxy-preferred", Kd = "ikon-connect-tier", qd = "ikon-endpoint-timestamp", Jd = "ikon-endpoint-revalidated", Yd = 864e5, Xd = class {
2967
2967
  isLocal;
2968
2968
  _proxyMode;
2969
2969
  _websocket;
@@ -2992,7 +2992,7 @@ var Id = {
2992
2992
  z.debug(`Connect tier ${e} is reachable again, stepping back up to it`), this.setConnectTier(e);
2993
2993
  }
2994
2994
  getFasterConnectTiers(e) {
2995
- return R.slice(0, R.indexOf(e));
2995
+ return L.slice(0, L.indexOf(e));
2996
2996
  }
2997
2997
  clearProxyPreference() {
2998
2998
  this.setConnectTier("direct");
@@ -3001,13 +3001,13 @@ var Id = {
3001
3001
  let t = Array.from(e.keys());
3002
3002
  if (this.isLocal) return t;
3003
3003
  let n;
3004
- n = this._proxyMode === "force-proxy" || this._proxyMode === "force-lb" ? t.filter((e) => Ld.has(e)) : this._proxyMode === "force-direct" ? t.filter((e) => Rd.has(e)) : t, n = this.filterByTransport(n);
3005
- let r = [...n].sort((e, t) => (Id[e] ?? 999) - (Id[t] ?? 999));
3004
+ n = this._proxyMode === "force-proxy" || this._proxyMode === "force-lb" ? t.filter((e) => Bd.has(e)) : this._proxyMode === "force-direct" ? t.filter((e) => Vd.has(e)) : t, n = this.filterByTransport(n);
3005
+ let r = [...n].sort((e, t) => (R[e] ?? 999) - (R[t] ?? 999));
3006
3006
  if (this._proxyMode === "auto" && this.proxyPreferred) {
3007
- let e = r.filter((e) => Ld.has(e)), t = r.filter((e) => Rd.has(e));
3007
+ let e = r.filter((e) => Bd.has(e)), t = r.filter((e) => Vd.has(e));
3008
3008
  r.length = 0, r.push(...e, ...t);
3009
3009
  }
3010
- if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this.proxyPreferred || Ld.has(this.workingEndpointType))) {
3010
+ if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this.proxyPreferred || Bd.has(this.workingEndpointType))) {
3011
3011
  let e = r.indexOf(this.workingEndpointType);
3012
3012
  e > 0 && (r.splice(e, 1), r.unshift(this.workingEndpointType));
3013
3013
  }
@@ -3021,45 +3021,45 @@ var Id = {
3021
3021
  }
3022
3022
  this.workingEndpointType = e;
3023
3023
  try {
3024
- localStorage.setItem(Vd, String(e)), localStorage.setItem(Wd, String(Date.now())), localStorage.getItem(Gd) === null && localStorage.setItem(Gd, String(Date.now()));
3024
+ localStorage.setItem(Wd, String(e)), localStorage.setItem(qd, String(Date.now())), localStorage.getItem(Jd) === null && localStorage.setItem(Jd, String(Date.now()));
3025
3025
  } catch {}
3026
- Ld.has(e) ? this._connectTier === "direct" && this.setConnectTier("proxy") : Rd.has(e) && this.setConnectTier("direct"), z.debug(`Remembered working type: ${x[e]}`);
3026
+ Bd.has(e) ? this._connectTier === "direct" && this.setConnectTier("proxy") : Vd.has(e) && this.setConnectTier("direct"), z.debug(`Remembered working type: ${x[e]}`);
3027
3027
  }
3028
3028
  }
3029
3029
  clearRememberedType() {
3030
3030
  this.workingEndpointType = null;
3031
3031
  try {
3032
- localStorage.removeItem(Vd);
3032
+ localStorage.removeItem(Wd);
3033
3033
  } catch {}
3034
3034
  }
3035
3035
  needsRevalidation() {
3036
3036
  if (this.isLocal || this._proxyMode !== "auto" || this.workingEndpointType === null && this._connectTier === "direct") return !1;
3037
3037
  let e = this.revalidationAgeMs();
3038
- return e !== null && e > Kd;
3038
+ return e !== null && e > Yd;
3039
3039
  }
3040
3040
  getFasterTypes(e, t) {
3041
- let n = Id[e] ?? 999;
3042
- return this.filterByTransport(Array.from(t.keys())).filter((e) => (Id[e] ?? 999) < n).sort((e, t) => (Id[e] ?? 999) - (Id[t] ?? 999));
3041
+ let n = R[e] ?? 999;
3042
+ return this.filterByTransport(Array.from(t.keys())).filter((e) => (R[e] ?? 999) < n).sort((e, t) => (R[e] ?? 999) - (R[t] ?? 999));
3043
3043
  }
3044
3044
  recordFasterTypeReachable(e) {
3045
- z.debug(`Faster endpoint type ${x[e]} is reachable again, dropping learned preference`), this.clearRememberedType(), Rd.has(e) && this.clearProxyPreference();
3045
+ z.debug(`Faster endpoint type ${x[e]} is reachable again, dropping learned preference`), this.clearRememberedType(), Vd.has(e) && this.clearProxyPreference();
3046
3046
  try {
3047
- localStorage.removeItem(Wd), localStorage.removeItem(Gd);
3047
+ localStorage.removeItem(qd), localStorage.removeItem(Jd);
3048
3048
  } catch {}
3049
3049
  }
3050
3050
  recordFasterTypesUnreachable() {
3051
3051
  try {
3052
- localStorage.setItem(Gd, String(Date.now()));
3052
+ localStorage.setItem(Jd, String(Date.now()));
3053
3053
  } catch {}
3054
3054
  z.debug("Faster endpoint types still unreachable, keeping the learned preference");
3055
3055
  }
3056
3056
  filterByTransport(e) {
3057
3057
  let t = this._websocket, n = this._webtransport;
3058
- return t === void 0 && n === void 0 || t === !0 && n === !0 ? e : e.filter((e) => t === !0 && n === void 0 ? zd.has(e) : n === !0 && t === void 0 ? Bd.has(e) : t === !1 ? !zd.has(e) : n !== !1 || !Bd.has(e));
3058
+ return t === void 0 && n === void 0 || t === !0 && n === !0 ? e : e.filter((e) => t === !0 && n === void 0 ? Hd.has(e) : n === !0 && t === void 0 ? Ud.has(e) : t === !1 ? !Hd.has(e) : n !== !1 || !Ud.has(e));
3059
3059
  }
3060
3060
  revalidationAgeMs() {
3061
3061
  try {
3062
- let e = localStorage.getItem(Gd);
3062
+ let e = localStorage.getItem(Jd);
3063
3063
  if (e === null) return null;
3064
3064
  let t = Date.now() - Number(e);
3065
3065
  return Number.isFinite(t) ? t : null;
@@ -3069,12 +3069,12 @@ var Id = {
3069
3069
  }
3070
3070
  loadRememberedType() {
3071
3071
  try {
3072
- let e = localStorage.getItem(Vd);
3072
+ let e = localStorage.getItem(Wd);
3073
3073
  if (e !== null) {
3074
3074
  let t = Number(e);
3075
3075
  if (x[t] !== void 0) {
3076
3076
  this.workingEndpointType = t;
3077
- let e = localStorage.getItem(Wd), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
3077
+ let e = localStorage.getItem(qd), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
3078
3078
  z.debug(`Loaded remembered type: ${x[t]} (age: ${n}h)`);
3079
3079
  }
3080
3080
  }
@@ -3082,69 +3082,69 @@ var Id = {
3082
3082
  }
3083
3083
  loadConnectTier() {
3084
3084
  try {
3085
- let e = localStorage.getItem(Ud);
3086
- e !== null && R.includes(e) ? this._connectTier = e : localStorage.getItem(Hd) === "true" && (this._connectTier = "proxy"), this._connectTier !== "direct" && z.debug(`Loaded connect tier: ${this._connectTier}`);
3085
+ let e = localStorage.getItem(Kd);
3086
+ e !== null && L.includes(e) ? this._connectTier = e : localStorage.getItem(Gd) === "true" && (this._connectTier = "proxy"), this._connectTier !== "direct" && z.debug(`Loaded connect tier: ${this._connectTier}`);
3087
3087
  } catch {}
3088
3088
  }
3089
3089
  setConnectTier(e) {
3090
3090
  if (this._connectTier = e, !(this.isLocal || this._proxyMode !== "auto")) try {
3091
- localStorage.setItem(Ud, e), e === "direct" ? localStorage.removeItem(Hd) : localStorage.setItem(Hd, "true");
3091
+ localStorage.setItem(Kd, e), e === "direct" ? localStorage.removeItem(Gd) : localStorage.setItem(Gd, "true");
3092
3092
  } catch {}
3093
3093
  }
3094
- }, Jd = "ikon-login-pending-call", Yd = /* @__PURE__ */ new Set(), Xd = {
3094
+ }, Zd = "ikon-login-pending-call", Qd = /* @__PURE__ */ new Set(), $d = {
3095
3095
  required: !1,
3096
3096
  reason: null
3097
3097
  };
3098
- function Zd() {
3099
- for (let e of Yd) e();
3098
+ function ef() {
3099
+ for (let e of Qd) e();
3100
3100
  }
3101
- function Qd() {
3102
- return Xd;
3101
+ function tf() {
3102
+ return $d;
3103
3103
  }
3104
- function $d(e) {
3105
- Xd = {
3104
+ function nf(e) {
3105
+ $d = {
3106
3106
  required: !0,
3107
3107
  reason: e
3108
- }, Zd();
3108
+ }, ef();
3109
3109
  }
3110
- function ef() {
3111
- Xd = {
3110
+ function rf() {
3111
+ $d = {
3112
3112
  required: !1,
3113
3113
  reason: null
3114
- }, Zd();
3114
+ }, ef();
3115
3115
  }
3116
- function tf(e) {
3117
- return Yd.add(e), () => Yd.delete(e);
3116
+ function af(e) {
3117
+ return Qd.add(e), () => Qd.delete(e);
3118
3118
  }
3119
- function nf(e) {
3119
+ function of(e) {
3120
3120
  try {
3121
- sessionStorage.setItem(Jd, JSON.stringify(e));
3121
+ sessionStorage.setItem(Zd, JSON.stringify(e));
3122
3122
  } catch {}
3123
3123
  }
3124
- function rf() {
3124
+ function sf() {
3125
3125
  try {
3126
- let e = sessionStorage.getItem(Jd);
3127
- return sessionStorage.removeItem(Jd), e ? JSON.parse(e) : null;
3126
+ let e = sessionStorage.getItem(Zd);
3127
+ return sessionStorage.removeItem(Zd), e ? JSON.parse(e) : null;
3128
3128
  } catch {
3129
3129
  return null;
3130
3130
  }
3131
3131
  }
3132
3132
  //#endregion
3133
3133
  //#region src/utils/abort-signal.ts
3134
- function af() {
3134
+ function cf() {
3135
3135
  return globalThis.AbortSignal;
3136
3136
  }
3137
- function of() {
3137
+ function lf() {
3138
3138
  return typeof DOMException == "function" ? new DOMException("The operation timed out.", "TimeoutError") : /* @__PURE__ */ Error("The operation timed out.");
3139
3139
  }
3140
3140
  function B(e) {
3141
- let t = af();
3141
+ let t = cf();
3142
3142
  if (t && typeof t.timeout == "function") return t.timeout(e);
3143
3143
  let n = new AbortController();
3144
- return setTimeout(() => n.abort(of()), e), n.signal;
3144
+ return setTimeout(() => n.abort(lf()), e), n.signal;
3145
3145
  }
3146
- function sf(e) {
3147
- let t = af();
3146
+ function uf(e) {
3147
+ let t = cf();
3148
3148
  if (t && typeof t.any == "function") return t.any(e);
3149
3149
  let n = new AbortController(), r = (e) => {
3150
3150
  n.abort(e.reason);
@@ -3160,46 +3160,46 @@ function sf(e) {
3160
3160
  }
3161
3161
  //#endregion
3162
3162
  //#region src/connection/urls.ts
3163
- var cf = "https://api.prod.ikon.live", lf = "https://api.dev.ikon.live", uf = "https://auth.ikonai.com", df = "https://auth.dev.ikonai.com", ff = "https://auth.ikonai.com", pf = [
3163
+ var df = "https://api.prod.ikon.live", ff = "https://api.dev.ikon.live", pf = "https://auth.ikonai.com", mf = "https://auth.dev.ikonai.com", hf = "https://auth.ikonai.com", gf = [
3164
3164
  ".ikonai.app",
3165
3165
  ".ikonai.com",
3166
3166
  ".ikon.live"
3167
3167
  ];
3168
- function mf(e) {
3169
- return pf.some((t) => e.endsWith(t)) ? e.includes(".dev.") ? "development" : "production" : null;
3168
+ function _f(e) {
3169
+ return gf.some((t) => e.endsWith(t)) ? e.includes(".dev.") ? "development" : "production" : null;
3170
3170
  }
3171
- var hf = null, gf = null;
3172
- async function _f() {
3173
- return hf || (typeof window > "u" ? null : gf || (gf = (async () => {
3171
+ var vf = null, yf = null;
3172
+ async function bf() {
3173
+ return vf || (typeof window > "u" ? null : yf || (yf = (async () => {
3174
3174
  try {
3175
3175
  let e = await fetch(`${window.location.origin}/ikon/api/env`, { signal: B(5e3) });
3176
3176
  if (!e.ok) return null;
3177
3177
  let t = await e.json();
3178
- return t.env === "development" || t.env === "production" ? (hf = t.env, t.env) : null;
3178
+ return t.env === "development" || t.env === "production" ? (vf = t.env, t.env) : null;
3179
3179
  } catch {
3180
3180
  return null;
3181
3181
  } finally {
3182
- gf = null;
3182
+ yf = null;
3183
3183
  }
3184
- })(), gf));
3184
+ })(), yf));
3185
3185
  }
3186
- function vf() {
3187
- return typeof window > "u" || Ku() === !1 || !V() ? null : `${window.location.origin}/ikon/api`;
3186
+ function xf() {
3187
+ return typeof window > "u" || qu() === !1 || !V() ? null : `${window.location.origin}/ikon/api`;
3188
3188
  }
3189
- function yf() {
3189
+ function Sf() {
3190
3190
  return typeof window > "u" || !V() ? null : `${window.location.origin}/ikon/auth`;
3191
3191
  }
3192
- function bf(e) {
3192
+ function Cf(e) {
3193
3193
  return typeof window > "u" || !V() ? null : `${window.location.origin}${e}`;
3194
3194
  }
3195
- function xf(e) {
3196
- return e.startsWith("/") ? typeof window > "u" ? wf() === "development" ? lf : cf : `${window.location.origin}${e}` : e;
3195
+ function wf(e) {
3196
+ return e.startsWith("/") ? typeof window > "u" ? Df() === "development" ? ff : df : `${window.location.origin}${e}` : e;
3197
3197
  }
3198
- function Sf(e) {
3199
- return vf() || (e === "development" ? lf : cf);
3198
+ function Tf(e) {
3199
+ return xf() || (e === "development" ? ff : df);
3200
3200
  }
3201
- function Cf(e) {
3202
- if (e) return xf(e);
3201
+ function Ef(e) {
3202
+ if (e) return wf(e);
3203
3203
  let t = {
3204
3204
  BASE_URL: "./",
3205
3205
  DEV: !1,
@@ -3207,9 +3207,9 @@ function Cf(e) {
3207
3207
  PROD: !0,
3208
3208
  SSR: !1
3209
3209
  }.VITE_IKON_BACKEND_URL;
3210
- return t ? xf(t) : vf() || (typeof window > "u" ? cf : V() ? (mf(window.location.hostname) ?? hf ?? "production") === "development" ? lf : cf : lf);
3210
+ return t ? wf(t) : xf() || (typeof window > "u" ? df : V() ? (_f(window.location.hostname) ?? vf ?? "production") === "development" ? ff : df : ff);
3211
3211
  }
3212
- function wf() {
3212
+ function Df() {
3213
3213
  let e = {
3214
3214
  BASE_URL: "./",
3215
3215
  DEV: !1,
@@ -3225,17 +3225,17 @@ function wf() {
3225
3225
  PROD: !0,
3226
3226
  SSR: !1
3227
3227
  }.VITE_IKON_BACKEND_URL;
3228
- return t && !t.startsWith("/") ? t.includes(".dev.") ? "development" : "production" : typeof window > "u" ? "production" : V() ? mf(window.location.hostname) ?? hf ?? "production" : "development";
3228
+ return t && !t.startsWith("/") ? t.includes(".dev.") ? "development" : "production" : typeof window > "u" ? "production" : V() ? _f(window.location.hostname) ?? vf ?? "production" : "development";
3229
3229
  }
3230
- async function Tf(e) {
3231
- return e.startsWith("/") ? typeof window > "u" ? await Df() : `${window.location.origin}${e}` : e;
3230
+ async function Of(e) {
3231
+ return e.startsWith("/") ? typeof window > "u" ? await Af() : `${window.location.origin}${e}` : e;
3232
3232
  }
3233
- async function Ef(e) {
3234
- if (Gu()) {
3235
- let e = yf();
3233
+ async function kf(e) {
3234
+ if (Ku()) {
3235
+ let e = Sf();
3236
3236
  if (e) return e;
3237
3237
  }
3238
- if (e) return await Tf(e);
3238
+ if (e) return await Of(e);
3239
3239
  let t = {
3240
3240
  BASE_URL: "./",
3241
3241
  DEV: !1,
@@ -3243,44 +3243,44 @@ async function Ef(e) {
3243
3243
  PROD: !0,
3244
3244
  SSR: !1
3245
3245
  }.VITE_IKON_AUTH_URL;
3246
- if (t) return await Tf(t);
3246
+ if (t) return await Of(t);
3247
3247
  {
3248
- let e = yf();
3248
+ let e = Sf();
3249
3249
  if (e) return e;
3250
3250
  }
3251
- return Df();
3251
+ return Af();
3252
3252
  }
3253
- async function Df() {
3254
- if (typeof window > "u") return uf;
3255
- if (!V()) return df;
3256
- let e = mf(window.location.hostname);
3257
- return e ? e === "development" ? df : uf : await _f() === "development" ? df : uf;
3253
+ async function Af() {
3254
+ if (typeof window > "u") return pf;
3255
+ if (!V()) return mf;
3256
+ let e = _f(window.location.hostname);
3257
+ return e ? e === "development" ? mf : pf : await bf() === "development" ? mf : pf;
3258
3258
  }
3259
- function Of() {
3259
+ function jf() {
3260
3260
  if (typeof window > "u") return {};
3261
3261
  let e = new URLSearchParams(window.location.search), t = {};
3262
3262
  for (let [n, r] of e.entries()) t[n] = r;
3263
3263
  return t;
3264
3264
  }
3265
- var kf = [
3265
+ var Mf = [
3266
3266
  "ikon_token",
3267
3267
  "ikon_code",
3268
3268
  "ikon_provider",
3269
3269
  "error"
3270
- ], Af = [ku, ku.replace(/-/g, "_")];
3271
- function jf() {
3270
+ ], Nf = [Au, Au.replace(/-/g, "_")];
3271
+ function Pf() {
3272
3272
  let e = window.location.pathname.match(/^\/(s|c)\/([^/]+)(.*)$/);
3273
3273
  if (!e) return;
3274
3274
  let t = new URL(window.location.href);
3275
- t.pathname = e[3] || "/", t.searchParams.set(ku, decodeURIComponent(e[2])), window.history.replaceState(null, "", t.toString());
3275
+ t.pathname = e[3] || "/", t.searchParams.set(Au, decodeURIComponent(e[2])), window.history.replaceState(null, "", t.toString());
3276
3276
  }
3277
- function Mf() {
3277
+ function Ff() {
3278
3278
  if (typeof window > "u") return { parameters: {} };
3279
- jf();
3280
- let e = Of(), t = {};
3281
- for (let [n, r] of Object.entries(e)) !kf.includes(n) && !Af.includes(n) && (t[n] = r);
3279
+ Pf();
3280
+ let e = jf(), t = {};
3281
+ for (let [n, r] of Object.entries(e)) !Mf.includes(n) && !Nf.includes(n) && (t[n] = r);
3282
3282
  return {
3283
- sessionIdentityHash: Ju() ?? void 0,
3283
+ sessionIdentityHash: Yu() ?? void 0,
3284
3284
  parameters: t
3285
3285
  };
3286
3286
  }
@@ -3294,58 +3294,58 @@ function V() {
3294
3294
  }
3295
3295
  return !0;
3296
3296
  }
3297
- function Nf() {
3297
+ function If() {
3298
3298
  if (typeof window > "u") return "";
3299
- let e = window.location.pathname || "/", t = Ff(window.location.search);
3299
+ let e = window.location.pathname || "/", t = Rf(window.location.search);
3300
3300
  return t.length > 0 ? `${e}?${t}` : e;
3301
3301
  }
3302
- function Pf() {
3302
+ function Lf() {
3303
3303
  if (typeof window > "u") return "";
3304
3304
  let e = window.location.origin;
3305
- return !e || e === "null" ? "" : `${e}${Nf()}`;
3305
+ return !e || e === "null" ? "" : `${e}${If()}`;
3306
3306
  }
3307
- function Ff(e) {
3307
+ function Rf(e) {
3308
3308
  let t = new URLSearchParams(e);
3309
3309
  for (let e of [...t.keys()]) (e.startsWith("ikon-") || e.startsWith("ikon_")) && t.delete(e);
3310
3310
  return t.toString();
3311
3311
  }
3312
3312
  //#endregion
3313
3313
  //#region src/utils/pkce.ts
3314
- var If = "ikon-auth-pkce-verifier";
3315
- function Lf(e) {
3314
+ var zf = "ikon-auth-pkce-verifier";
3315
+ function Bf(e) {
3316
3316
  let t = e instanceof Uint8Array ? e : new Uint8Array(e), n = "";
3317
3317
  for (let e of t) n += String.fromCharCode(e);
3318
3318
  return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
3319
3319
  }
3320
- function Rf() {
3320
+ function Vf() {
3321
3321
  return typeof window < "u" && !!window.crypto?.subtle && !!window.sessionStorage;
3322
3322
  }
3323
- async function zf() {
3324
- if (!Rf()) return null;
3323
+ async function Hf() {
3324
+ if (!Vf()) return null;
3325
3325
  try {
3326
- let e = Lf(window.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32))), t = await window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(e));
3327
- return window.sessionStorage.setItem(If, e), Lf(t);
3326
+ let e = Bf(window.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32))), t = await window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(e));
3327
+ return window.sessionStorage.setItem(zf, e), Bf(t);
3328
3328
  } catch {
3329
3329
  return null;
3330
3330
  }
3331
3331
  }
3332
- function Bf(e) {
3332
+ function Uf(e) {
3333
3333
  try {
3334
- window.sessionStorage.setItem(If, e);
3334
+ window.sessionStorage.setItem(zf, e);
3335
3335
  } catch {}
3336
3336
  }
3337
- function Vf() {
3337
+ function Wf() {
3338
3338
  try {
3339
- let e = window.sessionStorage.getItem(If);
3340
- return window.sessionStorage.removeItem(If), e;
3339
+ let e = window.sessionStorage.getItem(zf);
3340
+ return window.sessionStorage.removeItem(zf), e;
3341
3341
  } catch {
3342
3342
  return null;
3343
3343
  }
3344
3344
  }
3345
3345
  //#endregion
3346
3346
  //#region src/utils/embedded-oauth.ts
3347
- var Hf = w("EmbeddedAuth"), Uf = "/oauth/popup-callback", Wf = "ikon-oauth-embedder-request", Gf = "ikon-oauth-embedder-claim", Kf = /* @__PURE__ */ new Set(), qf = "ikon_pkce", Jf = 800, Yf = 3e5;
3348
- function Xf() {
3347
+ var Gf = w("EmbeddedAuth"), Kf = "/oauth/popup-callback", qf = "ikon-oauth-embedder-request", Jf = "ikon-oauth-embedder-claim", Yf = /* @__PURE__ */ new Set(), Xf = "ikon_pkce", Zf = 800, Qf = 3e5;
3348
+ function $f() {
3349
3349
  if (typeof window > "u") return !1;
3350
3350
  try {
3351
3351
  return window.top !== window.self;
@@ -3353,8 +3353,8 @@ function Xf() {
3353
3353
  return !0;
3354
3354
  }
3355
3355
  }
3356
- async function Zf(e, t) {
3357
- let n = await zf(), r = Vf();
3356
+ async function ep(e, t) {
3357
+ let n = await Hf(), r = Wf();
3358
3358
  return await new Promise((i) => {
3359
3359
  let a = !1, o = (e) => {
3360
3360
  a || (a = !0, window.removeEventListener("message", s), window.clearTimeout(c), i(e));
@@ -3365,30 +3365,30 @@ async function Zf(e, t) {
3365
3365
  };
3366
3366
  window.addEventListener("message", s), window.parent.postMessage({
3367
3367
  source: "ikon-oauth",
3368
- type: Wf,
3368
+ type: qf,
3369
3369
  provider: e,
3370
3370
  spaceId: t,
3371
3371
  codeChallenge: n,
3372
3372
  codeVerifier: r
3373
3373
  }, "*");
3374
- let c = window.setTimeout(() => o(!1), Jf);
3374
+ let c = window.setTimeout(() => o(!1), Zf);
3375
3375
  });
3376
3376
  }
3377
- async function Qf(e, t) {
3378
- if (await Zf(e, t)) return !0;
3377
+ async function tp(e, t) {
3378
+ if (await ep(e, t)) return !0;
3379
3379
  try {
3380
- let { code: n, provider: r } = await $f(window.open("about:blank", "ikon-oauth", "popup,width=520,height=680"), e, t), i = new URL(window.location.href);
3380
+ let { code: n, provider: r } = await np(window.open("about:blank", "ikon-oauth", "popup,width=520,height=680"), e, t), i = new URL(window.location.href);
3381
3381
  return i.searchParams.set("ikon_code", n), i.searchParams.set("ikon_provider", r), window.location.replace(i.toString()), !0;
3382
3382
  } catch (t) {
3383
- return Hf.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
3383
+ return Gf.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
3384
3384
  }
3385
3385
  }
3386
- async function $f(e, t, n) {
3386
+ async function np(e, t, n) {
3387
3387
  if (!e) throw Error("The sign-in window was blocked. Allow pop-ups for this site and try again.");
3388
3388
  let r;
3389
3389
  try {
3390
- r = await Df();
3391
- let i = `${r}${Uf}`, a = await zf(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3390
+ r = await Af();
3391
+ let i = `${r}${Kf}`, a = await Hf(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3392
3392
  e.location.href = `${r}/oauth/${encodeURIComponent(t)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`;
3393
3393
  } catch (t) {
3394
3394
  throw e.close(), t;
@@ -3418,15 +3418,15 @@ async function $f(e, t, n) {
3418
3418
  o(() => {
3419
3419
  e.close(), r(/* @__PURE__ */ Error("The sign-in timed out"));
3420
3420
  });
3421
- }, Yf);
3421
+ }, Qf);
3422
3422
  });
3423
3423
  }
3424
- function ep(e, t) {
3425
- if (typeof window > "u" || !Xf()) return () => void 0;
3424
+ function rp(e, t) {
3425
+ if (typeof window > "u" || !$f()) return () => void 0;
3426
3426
  let n = (e) => {
3427
3427
  if (e.source !== window.parent) return;
3428
3428
  let n = e.data;
3429
- n?.source !== "ikon-oauth" || n.type !== "ikon-oauth-embedder-result" || typeof n.code != "string" || !n.code || Kf.has(n.code) || (Kf.add(n.code), t({
3429
+ n?.source !== "ikon-oauth" || n.type !== "ikon-oauth-embedder-result" || typeof n.code != "string" || !n.code || Yf.has(n.code) || (Yf.add(n.code), t({
3430
3430
  code: n.code,
3431
3431
  provider: typeof n.provider == "string" ? n.provider : "",
3432
3432
  codeVerifier: typeof n.codeVerifier == "string" ? n.codeVerifier : null
@@ -3434,48 +3434,48 @@ function ep(e, t) {
3434
3434
  };
3435
3435
  return window.addEventListener("message", n), window.parent.postMessage({
3436
3436
  source: "ikon-oauth",
3437
- type: Gf,
3437
+ type: Jf,
3438
3438
  spaceId: e
3439
3439
  }, "*"), () => window.removeEventListener("message", n);
3440
3440
  }
3441
- function tp() {
3441
+ function ip() {
3442
3442
  if (typeof window > "u") return;
3443
- let e = new URLSearchParams(window.location.search).get(qf);
3444
- e && Bf(e);
3443
+ let e = new URLSearchParams(window.location.search).get(Xf);
3444
+ e && Uf(e);
3445
3445
  }
3446
3446
  //#endregion
3447
3447
  //#region src/utils/user-gesture.ts
3448
- function np(e) {
3448
+ function ap(e) {
3449
3449
  if (!e || typeof e != "object") return !1;
3450
3450
  let t = e, n = typeof t.name == "string" ? t.name : "", r = typeof t.message == "string" ? t.message : "";
3451
3451
  return !!(n === "NotAllowedError" || n === "SecurityError" || r.toLowerCase().includes("permission") || r.toLowerCase().includes("user gesture"));
3452
3452
  }
3453
3453
  //#endregion
3454
3454
  //#region src/utils/app-routes.ts
3455
- var rp = ["/ikon", "/api"];
3456
- function ip(e) {
3455
+ var op = ["/ikon", "/api"];
3456
+ function sp(e) {
3457
3457
  if (!e) return !1;
3458
3458
  let t = e.split(/[?#]/)[0], n = t.startsWith("/") ? t : "/" + t;
3459
- return rp.some((e) => n === e || n.startsWith(e + "/"));
3459
+ return op.some((e) => n === e || n.startsWith(e + "/"));
3460
3460
  }
3461
3461
  //#endregion
3462
3462
  //#region src/functions/browser-functions.ts
3463
- var ap = "ikon-theme", op = "ikon-theme-user", sp = "ikon-theme-change", cp = "ikon-set-theme", lp = !1;
3464
- function up() {
3465
- lp || typeof window > "u" || window.parent === window || (lp = !0, window.addEventListener("message", (e) => {
3466
- e.data?.type === cp && yp((typeof e.data.theme == "string" ? e.data.theme.trim().toLowerCase() : "") || fp(), !1);
3463
+ var cp = "ikon-theme", lp = "ikon-theme-user", up = "ikon-theme-change", dp = "ikon-set-theme", fp = !1;
3464
+ function pp() {
3465
+ fp || typeof window > "u" || window.parent === window || (fp = !0, window.addEventListener("message", (e) => {
3466
+ e.data?.type === dp && Sp((typeof e.data.theme == "string" ? e.data.theme.trim().toLowerCase() : "") || hp(), !1);
3467
3467
  }));
3468
3468
  }
3469
- function dp(e) {
3469
+ function mp(e) {
3470
3470
  typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", e);
3471
3471
  }
3472
- function fp() {
3472
+ function hp() {
3473
3473
  return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
3474
3474
  }
3475
- function pp() {
3476
- return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(op) || window.localStorage.getItem(ap) || fp();
3475
+ function gp() {
3476
+ return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(lp) || window.localStorage.getItem(cp) || hp();
3477
3477
  }
3478
- function mp() {
3478
+ function _p() {
3479
3479
  return typeof window > "u" ? {
3480
3480
  width: 0,
3481
3481
  height: 0
@@ -3484,18 +3484,18 @@ function mp() {
3484
3484
  height: window.innerHeight
3485
3485
  };
3486
3486
  }
3487
- function hp() {
3487
+ function vp() {
3488
3488
  if (typeof window > "u" || !window.localStorage) return "light";
3489
- up();
3490
- let e = window.localStorage.getItem(op), t = window.localStorage.getItem(ap);
3489
+ pp();
3490
+ let e = window.localStorage.getItem(lp), t = window.localStorage.getItem(cp);
3491
3491
  if (e || t) {
3492
3492
  let n = e ?? t;
3493
- return dp(n), n;
3493
+ return mp(n), n;
3494
3494
  }
3495
- let n = fp();
3496
- return window.localStorage.setItem(ap, n), dp(n), n;
3495
+ let n = hp();
3496
+ return window.localStorage.setItem(cp, n), mp(n), n;
3497
3497
  }
3498
- var gp = {
3498
+ var yp = {
3499
3499
  name: "ikon.client.getTheme",
3500
3500
  description: "Get the currently selected client theme",
3501
3501
  returnType: {
@@ -3503,12 +3503,12 @@ var gp = {
3503
3503
  nullable: !0
3504
3504
  }
3505
3505
  };
3506
- function _p() {
3506
+ function bp() {
3507
3507
  if (typeof window > "u" || !window.localStorage) return null;
3508
- let e = window.localStorage.getItem(op), t = window.localStorage.getItem(ap);
3508
+ let e = window.localStorage.getItem(lp), t = window.localStorage.getItem(cp);
3509
3509
  return e ?? t ?? null;
3510
3510
  }
3511
- var vp = {
3511
+ var xp = {
3512
3512
  name: "ikon.client.setTheme",
3513
3513
  description: "Update the client UI theme",
3514
3514
  returnType: { kind: "boolean" },
@@ -3525,38 +3525,38 @@ var vp = {
3525
3525
  description: "Whether to persist as user preference"
3526
3526
  }]
3527
3527
  };
3528
- function yp(e, t) {
3528
+ function Sp(e, t) {
3529
3529
  if (typeof window > "u" || !window.localStorage || typeof e != "string") return !1;
3530
3530
  let n = e.trim().toLowerCase();
3531
3531
  if (!n) return !1;
3532
3532
  let r = t === void 0 || !!t, i = window.localStorage;
3533
- r ? i.setItem(op, n) : i.removeItem(op), i.setItem(ap, n);
3533
+ r ? i.setItem(lp, n) : i.removeItem(lp), i.setItem(cp, n);
3534
3534
  try {
3535
- window.dispatchEvent(new CustomEvent(sp, { detail: { mode: n } }));
3535
+ window.dispatchEvent(new CustomEvent(up, { detail: { mode: n } }));
3536
3536
  } catch {}
3537
- return dp(n), !0;
3537
+ return mp(n), !0;
3538
3538
  }
3539
- var bp = {
3539
+ var Cp = {
3540
3540
  name: "ikon.client.getLanguage",
3541
3541
  description: "Get the browser language preference",
3542
3542
  returnType: { kind: "string" }
3543
3543
  };
3544
- function xp() {
3544
+ function wp() {
3545
3545
  return typeof navigator > "u" ? "en-US" : navigator.language || "en-US";
3546
3546
  }
3547
- var Sp = {
3547
+ var Tp = {
3548
3548
  name: "ikon.client.getTimezone",
3549
3549
  description: "Get the browser timezone (IANA format)",
3550
3550
  returnType: { kind: "string" }
3551
3551
  };
3552
- function Cp() {
3552
+ function Ep() {
3553
3553
  try {
3554
3554
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
3555
3555
  } catch {
3556
3556
  return "UTC";
3557
3557
  }
3558
3558
  }
3559
- function wp() {
3559
+ function Dp() {
3560
3560
  if (typeof Intl > "u") return "";
3561
3561
  try {
3562
3562
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -3564,15 +3564,15 @@ function wp() {
3564
3564
  return "";
3565
3565
  }
3566
3566
  }
3567
- function Tp() {
3567
+ function Op() {
3568
3568
  return typeof navigator > "u" ? !1 : navigator.maxTouchPoints > 0;
3569
3569
  }
3570
- function Ep() {
3570
+ function kp() {
3571
3571
  if (typeof navigator > "u" || typeof window > "u") return v.Unknown;
3572
3572
  let e = navigator.maxTouchPoints > 0, t = window.innerWidth <= 1024;
3573
3573
  return e && t ? v.MobileWeb : v.DesktopWeb;
3574
3574
  }
3575
- var Dp = {
3575
+ var Ap = {
3576
3576
  name: "ikon.client.getUrl",
3577
3577
  description: "Get the current browser URL path and query string",
3578
3578
  returnType: {
@@ -3580,10 +3580,10 @@ var Dp = {
3580
3580
  nullable: !0
3581
3581
  }
3582
3582
  };
3583
- function Op() {
3583
+ function jp() {
3584
3584
  return typeof window > "u" ? null : window.location.pathname + window.location.search;
3585
3585
  }
3586
- var kp = {
3586
+ var Mp = {
3587
3587
  name: "ikon.client.setUrl",
3588
3588
  description: "Update the browser URL without triggering a page reload",
3589
3589
  returnType: { kind: "boolean" },
@@ -3611,10 +3611,10 @@ var kp = {
3611
3611
  }
3612
3612
  ]
3613
3613
  };
3614
- function Ap(e, t, n) {
3614
+ function Np(e, t, n) {
3615
3615
  if (typeof window > "u" || !window.history || typeof e != "string") return !1;
3616
3616
  let r = e.trim();
3617
- if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || ip(r)) return !1;
3617
+ if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || sp(r)) return !1;
3618
3618
  try {
3619
3619
  let e = !!t, i = n && !r.includes("?") ? r + window.location.search : r;
3620
3620
  return e ? window.history.replaceState(null, "", i) : window.history.pushState(null, "", i), !0;
@@ -3622,7 +3622,7 @@ function Ap(e, t, n) {
3622
3622
  return !1;
3623
3623
  }
3624
3624
  }
3625
- var jp = {
3625
+ var Pp = {
3626
3626
  name: "ikon.client.openExternalUrl",
3627
3627
  description: "Open an external URL in a new browser tab",
3628
3628
  returnType: { kind: "boolean" },
@@ -3632,7 +3632,7 @@ var jp = {
3632
3632
  description: "The URL to open. Must be absolute (e.g., starts with https://)."
3633
3633
  }]
3634
3634
  };
3635
- function Mp(e) {
3635
+ function Fp(e) {
3636
3636
  if (typeof window > "u" || typeof window.open != "function" || typeof e != "string") return !1;
3637
3637
  let t = e.trim();
3638
3638
  if (!t || /^javascript:/i.test(t)) return !1;
@@ -3642,7 +3642,7 @@ function Mp(e) {
3642
3642
  return !1;
3643
3643
  }
3644
3644
  }
3645
- var Np = {
3645
+ var Ip = {
3646
3646
  name: "ikon.client.vibrate",
3647
3647
  description: "Trigger haptic feedback on supported devices",
3648
3648
  returnType: { kind: "boolean" },
@@ -3652,7 +3652,7 @@ var Np = {
3652
3652
  description: "Duration in ms, or comma-separated pattern (e.g., \"200\" or \"100,50,100\")"
3653
3653
  }]
3654
3654
  };
3655
- function Pp(e) {
3655
+ function Lp(e) {
3656
3656
  if (typeof navigator > "u" || !navigator.vibrate || typeof e != "string") return !1;
3657
3657
  try {
3658
3658
  let t = e.split(",").map((e) => parseInt(e.trim(), 10));
@@ -3661,16 +3661,16 @@ function Pp(e) {
3661
3661
  return !1;
3662
3662
  }
3663
3663
  }
3664
- var H = null, Fp = !1, Ip = !1;
3665
- async function Lp() {
3664
+ var H = null, Rp = !1, zp = !1;
3665
+ async function Bp() {
3666
3666
  if (!(typeof navigator > "u" || !("wakeLock" in navigator))) try {
3667
3667
  H = await navigator.wakeLock.request("screen");
3668
3668
  } catch {}
3669
3669
  }
3670
- function Rp() {
3671
- document.visibilityState === "visible" && Fp && (!H || H.released) && Lp();
3670
+ function Vp() {
3671
+ document.visibilityState === "visible" && Rp && (!H || H.released) && Bp();
3672
3672
  }
3673
- var zp = {
3673
+ var Hp = {
3674
3674
  name: "ikon.client.keepScreenAwake",
3675
3675
  description: "Prevent or allow the screen to sleep",
3676
3676
  returnType: { kind: "boolean" },
@@ -3680,15 +3680,15 @@ var zp = {
3680
3680
  description: "Whether to keep the screen awake"
3681
3681
  }]
3682
3682
  };
3683
- async function Bp(e) {
3683
+ async function Up(e) {
3684
3684
  if (typeof navigator > "u" || !("wakeLock" in navigator)) return !1;
3685
3685
  try {
3686
- return e ? (Fp = !0, (!H || H.released) && (H = await navigator.wakeLock.request("screen")), Ip ||= (document.addEventListener("visibilitychange", Rp), !0)) : (Fp = !1, Ip &&= (document.removeEventListener("visibilitychange", Rp), !1), H &&= (await H.release(), null)), !0;
3686
+ return e ? (Rp = !0, (!H || H.released) && (H = await navigator.wakeLock.request("screen")), zp ||= (document.addEventListener("visibilitychange", Vp), !0)) : (Rp = !1, zp &&= (document.removeEventListener("visibilitychange", Vp), !1), H &&= (await H.release(), null)), !0;
3687
3687
  } catch {
3688
3688
  return !1;
3689
3689
  }
3690
3690
  }
3691
- var Vp = {
3691
+ var Wp = {
3692
3692
  name: "ikon.client.getVisibility",
3693
3693
  description: "Get the current page visibility state",
3694
3694
  returnType: {
@@ -3696,10 +3696,10 @@ var Vp = {
3696
3696
  nullable: !0
3697
3697
  }
3698
3698
  };
3699
- function Hp() {
3699
+ function Gp() {
3700
3700
  return typeof document > "u" ? null : document.visibilityState || null;
3701
3701
  }
3702
- var Up = {
3702
+ var Kp = {
3703
3703
  name: "ikon.client.scrollTo",
3704
3704
  description: "Scroll the page to a specific position",
3705
3705
  returnType: { kind: "boolean" },
@@ -3724,7 +3724,7 @@ var Up = {
3724
3724
  }
3725
3725
  ]
3726
3726
  };
3727
- function Wp(e, t, n) {
3727
+ function qp(e, t, n) {
3728
3728
  if (typeof window > "u" || typeof e != "number" || typeof t != "number") return !1;
3729
3729
  try {
3730
3730
  return window.scrollTo({
@@ -3736,7 +3736,7 @@ function Wp(e, t, n) {
3736
3736
  return !1;
3737
3737
  }
3738
3738
  }
3739
- var Gp = {
3739
+ var Jp = {
3740
3740
  name: "ikon.client.getBatteryLevel",
3741
3741
  description: "Get the current battery level (0-100)",
3742
3742
  returnType: {
@@ -3744,7 +3744,7 @@ var Gp = {
3744
3744
  nullable: !0
3745
3745
  }
3746
3746
  };
3747
- async function Kp() {
3747
+ async function Yp() {
3748
3748
  if (typeof navigator > "u" || !("getBattery" in navigator)) return null;
3749
3749
  try {
3750
3750
  let e = await navigator.getBattery();
@@ -3753,7 +3753,7 @@ async function Kp() {
3753
3753
  return null;
3754
3754
  }
3755
3755
  }
3756
- var qp = {
3756
+ var Xp = {
3757
3757
  name: "ikon.client.getNetworkType",
3758
3758
  description: "Get the current network connection type",
3759
3759
  returnType: {
@@ -3761,17 +3761,17 @@ var qp = {
3761
3761
  nullable: !0
3762
3762
  }
3763
3763
  };
3764
- function Jp() {
3764
+ function Zp() {
3765
3765
  if (typeof navigator > "u") return null;
3766
3766
  let e = navigator.connection;
3767
3767
  return e && (e.effectiveType || e.type) || null;
3768
3768
  }
3769
- var Yp = {
3769
+ var Qp = {
3770
3770
  name: "ikon.client.requestFullscreen",
3771
3771
  description: "Request the browser to enter fullscreen mode",
3772
3772
  returnType: { kind: "boolean" }
3773
3773
  };
3774
- async function Xp() {
3774
+ async function $p() {
3775
3775
  if (typeof document > "u" || !document.documentElement) return !1;
3776
3776
  try {
3777
3777
  let e = document.documentElement, t = e.requestFullscreen?.bind(e) ?? e.webkitRequestFullscreen?.bind(e);
@@ -3780,12 +3780,12 @@ async function Xp() {
3780
3780
  return !1;
3781
3781
  }
3782
3782
  }
3783
- var Zp = {
3783
+ var em = {
3784
3784
  name: "ikon.client.exitFullscreen",
3785
3785
  description: "Exit browser fullscreen mode",
3786
3786
  returnType: { kind: "boolean" }
3787
3787
  };
3788
- function Qp() {
3788
+ function tm() {
3789
3789
  if (typeof document > "u") return !1;
3790
3790
  try {
3791
3791
  let e = document.exitFullscreen?.bind(document) ?? document.webkitExitFullscreen?.bind(document);
@@ -3794,25 +3794,25 @@ function Qp() {
3794
3794
  return !1;
3795
3795
  }
3796
3796
  }
3797
- var $p = {
3797
+ var nm = {
3798
3798
  name: "ikon.client.logout",
3799
3799
  description: "Clear the auth session and return to the login screen at the site root",
3800
3800
  returnType: { kind: "boolean" }
3801
- }, em = ["ikon-auth-", "ikon-live-snapshot"];
3802
- function tm() {
3801
+ }, rm = ["ikon-auth-", "ikon-live-snapshot"];
3802
+ function im() {
3803
3803
  if (typeof window > "u" || !window.localStorage) return !1;
3804
3804
  try {
3805
3805
  let e = [];
3806
3806
  for (let t = 0; t < window.localStorage.length; t++) {
3807
3807
  let n = window.localStorage.key(t);
3808
- n && em.some((e) => n.startsWith(e)) && e.push(n);
3808
+ n && rm.some((e) => n.startsWith(e)) && e.push(n);
3809
3809
  }
3810
3810
  return e.forEach((e) => window.localStorage.removeItem(e)), setTimeout(() => window.location.replace(window.location.origin + "/"), 100), !0;
3811
3811
  } catch {
3812
3812
  return !1;
3813
3813
  }
3814
3814
  }
3815
- var nm = {
3815
+ var am = {
3816
3816
  name: "ikon.client.login",
3817
3817
  description: "Start the sign-in flow for an OAuth provider (e.g. google, microsoft)",
3818
3818
  parameters: [{
@@ -3821,15 +3821,15 @@ var nm = {
3821
3821
  }],
3822
3822
  returnType: { kind: "boolean" }
3823
3823
  };
3824
- async function rm(e) {
3824
+ async function om(e) {
3825
3825
  if (typeof window > "u" || typeof e != "string" || e.length === 0 || e === "guest" || e === "global" || e === "email" || e === "passkey") return !1;
3826
3826
  let t = window.__IKON_AUTH_CONFIG__, n = t?.spaceId;
3827
3827
  if (!n) return !1;
3828
- if (Xf()) return await Qf(e, n);
3829
- let r = await Ef(t?.authUrl), i = window.location.origin + window.location.pathname + window.location.search, a = await zf(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3828
+ if ($f()) return await tp(e, n);
3829
+ let r = await kf(t?.authUrl), i = window.location.origin + window.location.pathname + window.location.search, a = await Hf(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3830
3830
  return window.location.href = `${r}/oauth/${encodeURIComponent(e)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`, !0;
3831
3831
  }
3832
- var im = {
3832
+ var sm = {
3833
3833
  name: "ikon.client.loginShow",
3834
3834
  description: "Show the login UI with an optional reason",
3835
3835
  parameters: [{
@@ -3838,15 +3838,15 @@ var im = {
3838
3838
  }],
3839
3839
  returnType: { kind: "boolean" }
3840
3840
  };
3841
- function am(e) {
3842
- return typeof window > "u" ? !1 : ($d(typeof e == "string" ? e : null), !0);
3841
+ function cm(e) {
3842
+ return typeof window > "u" ? !1 : (nf(typeof e == "string" ? e : null), !0);
3843
3843
  }
3844
- var om = {
3844
+ var lm = {
3845
3845
  name: "ikon.client.getLocation",
3846
3846
  description: "Get the current GPS location",
3847
3847
  returnType: { kind: "string" }
3848
3848
  };
3849
- function sm() {
3849
+ function um() {
3850
3850
  return typeof navigator > "u" || !navigator.geolocation ? Promise.resolve(null) : new Promise((e) => {
3851
3851
  navigator.geolocation.getCurrentPosition((t) => {
3852
3852
  e({
@@ -3860,15 +3860,15 @@ function sm() {
3860
3860
  });
3861
3861
  });
3862
3862
  }
3863
- var cm = [], lm = !1;
3864
- function um() {
3863
+ var dm = [], fm = !1;
3864
+ function pm() {
3865
3865
  return typeof window < "u" && "Notification" in window;
3866
3866
  }
3867
- function dm(e, t, n, r) {
3867
+ function mm(e, t, n, r) {
3868
3868
  let i = {};
3869
3869
  return e?.trim() && (i.body = e.trim()), t?.trim() && (i.icon = t.trim()), n?.trim() && (i.tag = n.trim()), r && (i.data = r), i;
3870
3870
  }
3871
- function fm(e, t, n, r) {
3871
+ function hm(e, t, n, r) {
3872
3872
  try {
3873
3873
  let i = new Notification(e, t);
3874
3874
  i.onclick = () => {
@@ -3883,40 +3883,40 @@ function fm(e, t, n, r) {
3883
3883
  };
3884
3884
  } catch {}
3885
3885
  }
3886
- function pm() {
3886
+ function gm() {
3887
3887
  if (Notification.permission !== "granted") {
3888
- cm = [];
3888
+ dm = [];
3889
3889
  return;
3890
3890
  }
3891
- let e = cm;
3892
- cm = [];
3893
- for (let t of e) fm(t.title, t.options, t.launchUrl, t.data);
3891
+ let e = dm;
3892
+ dm = [];
3893
+ for (let t of e) hm(t.title, t.options, t.launchUrl, t.data);
3894
3894
  }
3895
- function mm() {
3896
- if (lm || typeof window > "u") return;
3897
- lm = !0;
3895
+ function _m() {
3896
+ if (fm || typeof window > "u") return;
3897
+ fm = !0;
3898
3898
  let e = async () => {
3899
3899
  try {
3900
3900
  if (await Notification.requestPermission() === "granted") {
3901
- pm();
3901
+ gm();
3902
3902
  return;
3903
3903
  }
3904
3904
  } catch {}
3905
- cm = [];
3905
+ dm = [];
3906
3906
  }, t = () => {
3907
- window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), lm = !1, e();
3907
+ window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), fm = !1, e();
3908
3908
  };
3909
3909
  window.addEventListener("pointerdown", t), window.addEventListener("keydown", t);
3910
3910
  }
3911
- var hm = {
3911
+ var vm = {
3912
3912
  name: "ikon.client.getNotificationPermission",
3913
3913
  description: "Get the current notification permission state (granted, denied, default, or unsupported)",
3914
3914
  returnType: { kind: "string" }
3915
3915
  };
3916
- function gm() {
3917
- return um() ? Notification.permission : "unsupported";
3916
+ function ym() {
3917
+ return pm() ? Notification.permission : "unsupported";
3918
3918
  }
3919
- var _m = {
3919
+ var bm = {
3920
3920
  name: "ikon.client.showNotification",
3921
3921
  description: "Show a notification, requesting permission lazily on the first send",
3922
3922
  returnType: { kind: "string" },
@@ -3962,33 +3962,33 @@ var _m = {
3962
3962
  }
3963
3963
  ]
3964
3964
  };
3965
- async function vm(e, t, n, r, i, a) {
3966
- if (!um() || typeof e != "string" || !e.trim()) return "unsupported";
3967
- let o = e.trim(), s = dm(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;
3968
- if (Notification.permission === "granted") return fm(o, s, c, l), "granted";
3965
+ async function xm(e, t, n, r, i, a) {
3966
+ if (!pm() || typeof e != "string" || !e.trim()) return "unsupported";
3967
+ let o = e.trim(), s = mm(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;
3968
+ if (Notification.permission === "granted") return hm(o, s, c, l), "granted";
3969
3969
  if (Notification.permission === "denied") return "denied";
3970
3970
  try {
3971
3971
  let e = await Notification.requestPermission();
3972
- return e === "granted" && fm(o, s, c, l), e;
3972
+ return e === "granted" && hm(o, s, c, l), e;
3973
3973
  } catch (e) {
3974
- return np(e) ? (cm.push({
3974
+ return ap(e) ? (dm.push({
3975
3975
  title: o,
3976
3976
  options: s,
3977
3977
  launchUrl: c,
3978
3978
  data: l
3979
- }), mm(), "default") : "denied";
3979
+ }), _m(), "default") : "denied";
3980
3980
  }
3981
3981
  }
3982
- var ym = null;
3983
- function bm(e) {
3984
- ym = e ?? null;
3982
+ var Sm = null;
3983
+ function Cm(e) {
3984
+ Sm = e ?? null;
3985
3985
  }
3986
- function xm(e) {
3986
+ function wm(e) {
3987
3987
  let t = (e + "=".repeat((4 - e.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"), n = atob(t), r = new Uint8Array(n.length);
3988
3988
  for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
3989
3989
  return r;
3990
3990
  }
3991
- var Sm = {
3991
+ var Tm = {
3992
3992
  name: "ikon.client.getPushSubscription",
3993
3993
  description: "Subscribe to Web Push and return the subscription, for offline push registration",
3994
3994
  returnType: {
@@ -3996,14 +3996,14 @@ var Sm = {
3996
3996
  nullable: !0
3997
3997
  }
3998
3998
  };
3999
- async function Cm() {
4000
- if (typeof window > "u" || !ym?.enabled || !ym.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !um() || Notification.permission !== "granted") return null;
3999
+ async function Em() {
4000
+ if (typeof window > "u" || !Sm?.enabled || !Sm.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !pm() || Notification.permission !== "granted") return null;
4001
4001
  try {
4002
4002
  let e = await navigator.serviceWorker.register("/push-service-worker.js");
4003
4003
  await navigator.serviceWorker.ready;
4004
4004
  let t = (await e.pushManager.getSubscription() ?? await e.pushManager.subscribe({
4005
4005
  userVisibleOnly: !0,
4006
- applicationServerKey: xm(ym.vapidPublicKey)
4006
+ applicationServerKey: wm(Sm.vapidPublicKey)
4007
4007
  })).toJSON();
4008
4008
  return !t.endpoint || !t.keys?.p256dh || !t.keys?.auth ? null : {
4009
4009
  Platform: "web",
@@ -4016,225 +4016,225 @@ async function Cm() {
4016
4016
  return null;
4017
4017
  }
4018
4018
  }
4019
- var wm = [
4019
+ var Dm = [
4020
4020
  {
4021
- definition: gp,
4022
- handler: _p
4021
+ definition: yp,
4022
+ handler: bp
4023
4023
  },
4024
4024
  {
4025
- definition: vp,
4026
- handler: yp
4025
+ definition: xp,
4026
+ handler: Sp
4027
4027
  },
4028
4028
  {
4029
- definition: bp,
4030
- handler: xp
4029
+ definition: Cp,
4030
+ handler: wp
4031
4031
  },
4032
4032
  {
4033
- definition: Sp,
4034
- handler: Cp
4033
+ definition: Tp,
4034
+ handler: Ep
4035
4035
  },
4036
4036
  {
4037
- definition: Dp,
4038
- handler: Op
4037
+ definition: Ap,
4038
+ handler: jp
4039
4039
  },
4040
4040
  {
4041
- definition: kp,
4042
- handler: Ap
4041
+ definition: Mp,
4042
+ handler: Np
4043
4043
  },
4044
4044
  {
4045
- definition: jp,
4046
- handler: Mp
4045
+ definition: Pp,
4046
+ handler: Fp
4047
4047
  },
4048
4048
  {
4049
- definition: Np,
4050
- handler: Pp
4049
+ definition: Ip,
4050
+ handler: Lp
4051
4051
  },
4052
4052
  {
4053
- definition: zp,
4054
- handler: Bp
4053
+ definition: Hp,
4054
+ handler: Up
4055
4055
  },
4056
4056
  {
4057
- definition: Vp,
4058
- handler: Hp
4057
+ definition: Wp,
4058
+ handler: Gp
4059
4059
  },
4060
4060
  {
4061
- definition: Up,
4062
- handler: Wp
4061
+ definition: Kp,
4062
+ handler: qp
4063
4063
  },
4064
4064
  {
4065
- definition: Gp,
4066
- handler: Kp
4065
+ definition: Jp,
4066
+ handler: Yp
4067
4067
  },
4068
4068
  {
4069
- definition: qp,
4070
- handler: Jp
4069
+ definition: Xp,
4070
+ handler: Zp
4071
4071
  },
4072
4072
  {
4073
- definition: Yp,
4074
- handler: Xp
4073
+ definition: Qp,
4074
+ handler: $p
4075
4075
  },
4076
4076
  {
4077
- definition: Zp,
4078
- handler: Qp
4079
- },
4080
- {
4081
- definition: $p,
4077
+ definition: em,
4082
4078
  handler: tm
4083
4079
  },
4084
4080
  {
4085
4081
  definition: nm,
4086
- handler: rm
4082
+ handler: im
4087
4083
  },
4088
4084
  {
4089
- definition: im,
4090
- handler: am
4085
+ definition: am,
4086
+ handler: om
4091
4087
  },
4092
4088
  {
4093
- definition: om,
4094
- handler: sm
4089
+ definition: sm,
4090
+ handler: cm
4095
4091
  },
4096
4092
  {
4097
- definition: hm,
4098
- handler: gm
4093
+ definition: lm,
4094
+ handler: um
4099
4095
  },
4100
4096
  {
4101
- definition: _m,
4102
- handler: vm
4097
+ definition: vm,
4098
+ handler: ym
4103
4099
  },
4104
4100
  {
4105
- definition: Sm,
4106
- handler: Cm
4101
+ definition: bm,
4102
+ handler: xm
4103
+ },
4104
+ {
4105
+ definition: Tm,
4106
+ handler: Em
4107
4107
  }
4108
4108
  ];
4109
- function Tm(e) {
4110
- let t = wm.map(({ definition: t, handler: n }) => e.register(t, n));
4109
+ function Om(e) {
4110
+ let t = Dm.map(({ definition: t, handler: n }) => e.register(t, n));
4111
4111
  return () => t.forEach((e) => e());
4112
4112
  }
4113
- function Em() {
4113
+ function U() {
4114
4114
  return typeof window < "u" && typeof navigator < "u";
4115
4115
  }
4116
4116
  //#endregion
4117
4117
  //#region src/utils/log-sink.ts
4118
- var Dm = 1e3, Om = C.INFO, U = [], km = Dm, Am = Om, jm = null;
4119
- function Mm(e) {
4120
- e.level < Am || (U.push(e), U.length > km && (U = U.slice(-km)));
4121
- }
4122
- function Nm(e) {
4123
- km = e?.maxBufferSize ?? Dm, Am = e?.minLevel ?? Om, U = [], _e(Mm);
4124
- }
4118
+ var km = 1e3, Am = C.INFO, W = [], jm = km, Mm = Am, Nm = null;
4125
4119
  function Pm(e) {
4126
- jm = e;
4120
+ e.level < Mm || (W.push(e), W.length > jm && (W = W.slice(-jm)));
4127
4121
  }
4128
- function Fm() {
4129
- return U;
4122
+ function Fm(e) {
4123
+ jm = e?.maxBufferSize ?? km, Mm = e?.minLevel ?? Am, W = [], _e(Pm);
4130
4124
  }
4131
- function Im() {
4132
- let e = U;
4133
- return U = [], e;
4125
+ function Im(e) {
4126
+ Nm = e;
4134
4127
  }
4135
4128
  function Lm() {
4136
- if (!jm || U.length === 0) return 0;
4137
- let e = Im();
4138
- return jm(e), e.length;
4129
+ return W;
4139
4130
  }
4140
4131
  function Rm() {
4141
- U = [];
4132
+ let e = W;
4133
+ return W = [], e;
4142
4134
  }
4143
4135
  function zm() {
4144
- return U.length;
4136
+ if (!Nm || W.length === 0) return 0;
4137
+ let e = Rm();
4138
+ return Nm(e), e.length;
4139
+ }
4140
+ function Bm() {
4141
+ W = [];
4145
4142
  }
4146
- Nm();
4143
+ function Vm() {
4144
+ return W.length;
4145
+ }
4146
+ Fm();
4147
4147
  //#endregion
4148
4148
  //#region src/utils/log-sender.ts
4149
- var Bm = w("LogSender"), Vm = 1e3, Hm = 6e4, Um = 15e3, Wm = 10240, Gm = 409600, Km = "…[truncated]", qm = {
4150
- [C.DEBUG]: pe.Debug,
4151
- [C.INFO]: pe.Info,
4152
- [C.WARN]: pe.Warning,
4153
- [C.ERROR]: pe.Error
4154
- }, W, Jm, G, K = [], Ym = 0, Xm;
4155
- function Zm(e) {
4156
- return e.length <= Wm ? e : e.slice(0, 10228) + Km;
4157
- }
4158
- function Qm(e) {
4149
+ var Hm = w("LogSender"), Um = 1e3, Wm = 6e4, Gm = 15e3, Km = 10240, qm = 409600, Jm = "…[truncated]", Ym = {
4150
+ [C.DEBUG]: me.Debug,
4151
+ [C.INFO]: me.Info,
4152
+ [C.WARN]: me.Warning,
4153
+ [C.ERROR]: me.Error
4154
+ }, G, Xm, K, q = [], Zm = 0, Qm;
4155
+ function $m(e) {
4156
+ return e.length <= Km ? e : e.slice(0, 10228) + Jm;
4157
+ }
4158
+ function eh(e) {
4159
4159
  return {
4160
4160
  Time: e.timestamp,
4161
- Type: qm[e.level] ?? pe.Info,
4162
- Message: Zm(`[${e.component}] ${e.message}`),
4161
+ Type: Ym[e.level] ?? me.Info,
4162
+ Message: $m(`[${e.component}] ${e.message}`),
4163
4163
  Parameters: "{}"
4164
4164
  };
4165
4165
  }
4166
- function $m(e) {
4166
+ function th(e) {
4167
4167
  return JSON.stringify({
4168
4168
  type: "sdk-typescript",
4169
4169
  event: { Logs: e }
4170
4170
  });
4171
4171
  }
4172
- function eh(e) {
4172
+ function nh(e) {
4173
4173
  if (e.length === 0) return [];
4174
- let t = Gm - $m([]).length, n = [], r = [], i = 0;
4174
+ let t = qm - th([]).length, n = [], r = [], i = 0;
4175
4175
  for (let a of e) {
4176
4176
  let e = JSON.stringify(a).length + 1;
4177
4177
  r.length > 0 && i + e > t && (n.push(r), r = [], i = 0), r.push(a), i += e;
4178
4178
  }
4179
4179
  return r.length > 0 && n.push(r), n;
4180
4180
  }
4181
- async function th(e) {
4182
- if (e.length === 0 || !W) return;
4183
- let t = `${W}/events/logs/json`, n = {
4181
+ async function rh(e) {
4182
+ if (e.length === 0 || !G) return;
4183
+ let t = `${G}/events/logs/json`, n = {
4184
4184
  "Content-Type": "application/json",
4185
- Authorization: `Bearer ${Jm}`
4185
+ Authorization: `Bearer ${Xm}`
4186
4186
  }, r = await fetch(t, {
4187
4187
  method: "POST",
4188
4188
  headers: n,
4189
- body: $m(e),
4190
- signal: B(Um)
4189
+ body: th(e),
4190
+ signal: B(Gm)
4191
4191
  });
4192
4192
  if (!r.ok) {
4193
4193
  if (r.status >= 400 && r.status < 500) {
4194
- Bm.warn(`Dropping ${e.length} log entries due to ${r.status}`);
4194
+ Hm.warn(`Dropping ${e.length} log entries due to ${r.status}`);
4195
4195
  return;
4196
4196
  }
4197
4197
  throw Error(`Failed to send logs: ${r.status}`);
4198
4198
  }
4199
4199
  }
4200
- function nh() {
4201
- if (Ym === 0) return Vm;
4202
- let e = Vm * (1 << Math.min(Ym, 6));
4203
- return Math.min(e, Hm);
4200
+ function ih() {
4201
+ if (Zm === 0) return Um;
4202
+ let e = Um * (1 << Math.min(Zm, 6));
4203
+ return Math.min(e, Wm);
4204
4204
  }
4205
- function rh(e) {
4206
- W && (G = setTimeout(() => void ih(), e));
4205
+ function ah(e) {
4206
+ G && (K = setTimeout(() => void oh(), e));
4207
4207
  }
4208
- async function ih() {
4209
- G = void 0;
4210
- let e = Im();
4211
- if (K = K.concat(e.map(Qm)), typeof navigator < "u" && navigator.onLine === !1) {
4212
- rh(Vm);
4208
+ async function oh() {
4209
+ K = void 0;
4210
+ let e = Rm();
4211
+ if (q = q.concat(e.map(eh)), typeof navigator < "u" && navigator.onLine === !1) {
4212
+ ah(Um);
4213
4213
  return;
4214
4214
  }
4215
- if (K.length === 0) {
4216
- rh(Vm);
4215
+ if (q.length === 0) {
4216
+ ah(Um);
4217
4217
  return;
4218
4218
  }
4219
- let t = K;
4220
- K = [];
4221
- let n = eh(t), r = !1;
4219
+ let t = q;
4220
+ q = [];
4221
+ let n = nh(t), r = !1;
4222
4222
  for (let e = 0; e < n.length; e++) try {
4223
- await th(n[e]);
4223
+ await rh(n[e]);
4224
4224
  } catch {
4225
- K = n.slice(e).flat().concat(K), r = !0;
4225
+ q = n.slice(e).flat().concat(q), r = !0;
4226
4226
  break;
4227
4227
  }
4228
- r ? Ym++ : Ym = 0, rh(nh());
4228
+ r ? Zm++ : Zm = 0, ah(ih());
4229
4229
  }
4230
- function ah() {
4231
- G !== void 0 && (clearTimeout(G), G = void 0), rh(0);
4230
+ function sh() {
4231
+ K !== void 0 && (clearTimeout(K), K = void 0), ah(0);
4232
4232
  }
4233
- function oh(e, t) {
4234
- ch(), W = e, Jm = t, Ym = 0, typeof window < "u" && (Xm = ah, window.addEventListener("online", Xm)), rh(Vm);
4233
+ function ch(e, t) {
4234
+ uh(), G = e, Xm = t, Zm = 0, typeof window < "u" && (Qm = sh, window.addEventListener("online", Qm)), ah(Um);
4235
4235
  }
4236
- function sh(e, t) {
4237
- if (!W || !Jm) return;
4236
+ function lh(e, t) {
4237
+ if (!G || !Xm) return;
4238
4238
  let n = { Events: [{
4239
4239
  Time: (/* @__PURE__ */ new Date()).toISOString(),
4240
4240
  EventName: e,
@@ -4244,47 +4244,47 @@ function sh(e, t) {
4244
4244
  type: "sdk-typescript",
4245
4245
  event: n
4246
4246
  });
4247
- fetch(`${W}/events/analytics/json`, {
4247
+ fetch(`${G}/events/analytics/json`, {
4248
4248
  method: "POST",
4249
4249
  headers: {
4250
4250
  "Content-Type": "application/json",
4251
- Authorization: `Bearer ${Jm}`
4251
+ Authorization: `Bearer ${Xm}`
4252
4252
  },
4253
4253
  body: r
4254
- }).catch((t) => Bm.warn(`Failed to send analytics event ${e}: ${t}`));
4254
+ }).catch((t) => Hm.warn(`Failed to send analytics event ${e}: ${t}`));
4255
4255
  }
4256
- function ch() {
4257
- G !== void 0 && (clearTimeout(G), G = void 0), Xm !== void 0 && typeof window < "u" && (window.removeEventListener("online", Xm), Xm = void 0), W = void 0, Jm = void 0, K = [], Ym = 0;
4256
+ function uh() {
4257
+ K !== void 0 && (clearTimeout(K), K = void 0), Qm !== void 0 && typeof window < "u" && (window.removeEventListener("online", Qm), Qm = void 0), G = void 0, Xm = void 0, q = [], Zm = 0;
4258
4258
  }
4259
4259
  //#endregion
4260
4260
  //#region src/utils/connect-timeline.ts
4261
- var lh = w("ConnectTimeline"), uh = "ikon-connect-trace-id", dh, fh = !1;
4262
- function ph() {
4261
+ var dh = w("ConnectTimeline"), fh = "ikon-connect-trace-id", ph, mh = !1;
4262
+ function hh() {
4263
4263
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`;
4264
4264
  }
4265
- function mh() {
4265
+ function gh() {
4266
4266
  try {
4267
- let e = sessionStorage.getItem(uh);
4267
+ let e = sessionStorage.getItem(fh);
4268
4268
  if (e) return e;
4269
- let t = ph();
4270
- return sessionStorage.setItem(uh, t), t;
4269
+ let t = hh();
4270
+ return sessionStorage.setItem(fh, t), t;
4271
4271
  } catch {
4272
- return dh ??= ph(), dh;
4272
+ return ph ??= hh(), ph;
4273
4273
  }
4274
4274
  }
4275
- function hh(e) {
4275
+ function _h(e) {
4276
4276
  if (typeof performance > "u" || typeof performance.getEntriesByType != "function") return;
4277
4277
  let t = performance.getEntriesByType("resource");
4278
4278
  for (let n = t.length - 1; n >= 0; n--) if (t[n].name.includes(e)) return Math.round(t[n].duration);
4279
4279
  }
4280
- var gh = [
4280
+ var vh = [
4281
4281
  "/anonymous",
4282
4282
  "/init",
4283
4283
  "/connect"
4284
4284
  ];
4285
- function _h() {
4285
+ function yh() {
4286
4286
  if (typeof performance > "u" || typeof performance.getEntriesByType != "function") return;
4287
- let e = performance.getEntriesByType("resource").filter((e) => !gh.some((t) => e.name.includes(t)));
4287
+ let e = performance.getEntriesByType("resource").filter((e) => !vh.some((t) => e.name.includes(t)));
4288
4288
  if (e.length === 0) return;
4289
4289
  let t = [], n = 0, r = 0, i = 0;
4290
4290
  for (let a of e) t.push(a.duration), a.transferSize === 0 && a.decodedBodySize === 0 ? i++ : a.transferSize === 0 ? r++ : n += a.transferSize;
@@ -4297,33 +4297,33 @@ function _h() {
4297
4297
  assetOpaqueCount: i
4298
4298
  };
4299
4299
  }
4300
- function vh(e = {}) {
4301
- if (fh) return;
4302
- fh = !0;
4303
- let t = { connectTraceId: mh() };
4300
+ function bh(e = {}) {
4301
+ if (mh) return;
4302
+ mh = !0;
4303
+ let t = { connectTraceId: gh() };
4304
4304
  e.snapshotSeeded !== void 0 && (t.snapshotSeeded = String(e.snapshotSeeded));
4305
4305
  try {
4306
4306
  if (typeof performance < "u") {
4307
4307
  t.firstPaintMs = String(Math.round(performance.now()));
4308
4308
  let e = performance.getEntriesByType("navigation")[0];
4309
4309
  e && (t.cdnHtmlMs = String(Math.round(e.responseEnd - e.fetchStart)), t.domContentLoadedMs = String(Math.round(e.domContentLoadedEventEnd)));
4310
- let n = hh("/anonymous");
4310
+ let n = _h("/anonymous");
4311
4311
  n !== void 0 && (t.authMs = String(n));
4312
- let r = hh("/init");
4312
+ let r = _h("/init");
4313
4313
  r !== void 0 && (t.initMs = String(r));
4314
- let i = hh("/connect");
4314
+ let i = _h("/connect");
4315
4315
  i !== void 0 && (t.connectMs = String(i));
4316
- let a = _h();
4316
+ let a = yh();
4317
4317
  if (a) for (let [e, n] of Object.entries(a)) t[e] = String(n);
4318
4318
  }
4319
4319
  } catch (e) {
4320
- lh.warn(`Failed to read performance timeline: ${e}`);
4320
+ dh.warn(`Failed to read performance timeline: ${e}`);
4321
4321
  }
4322
- sh("client_connect_timeline", t);
4322
+ lh("client_connect_timeline", t);
4323
4323
  }
4324
4324
  //#endregion
4325
4325
  //#region src/utils/uuid.ts
4326
- function yh() {
4326
+ function xh() {
4327
4327
  let e = globalThis.crypto;
4328
4328
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
4329
4329
  let t = /* @__PURE__ */ new Uint8Array(16);
@@ -4336,34 +4336,34 @@ function yh() {
4336
4336
  }
4337
4337
  //#endregion
4338
4338
  //#region src/storage.ts
4339
- var bh = "ikon-device-id";
4340
- function xh() {
4341
- if (typeof window > "u" || typeof localStorage > "u") return yh();
4339
+ var Sh = "ikon-device-id";
4340
+ function Ch() {
4341
+ if (typeof window > "u" || typeof localStorage > "u") return xh();
4342
4342
  try {
4343
- let e = localStorage.getItem(bh);
4344
- return e || (e = yh(), localStorage.setItem(bh, e)), e;
4343
+ let e = localStorage.getItem(Sh);
4344
+ return e || (e = xh(), localStorage.setItem(Sh, e)), e;
4345
4345
  } catch {
4346
- return yh();
4346
+ return xh();
4347
4347
  }
4348
4348
  }
4349
- function Sh() {
4349
+ function wh() {
4350
4350
  if (!(typeof localStorage > "u")) try {
4351
- localStorage.removeItem(bh);
4351
+ localStorage.removeItem(Sh);
4352
4352
  } catch {}
4353
4353
  }
4354
- function Ch(e) {
4355
- let t = Th(e);
4354
+ function Th(e) {
4355
+ let t = Dh(e);
4356
4356
  return typeof t?.id == "string" ? t.id : null;
4357
4357
  }
4358
- function wh(e) {
4359
- let t = Th(e);
4358
+ function Eh(e) {
4359
+ let t = Dh(e);
4360
4360
  return t ? {
4361
4361
  userId: typeof t.id == "string" ? t.id : null,
4362
4362
  authSession: typeof t.authSession == "string" ? t.authSession : null,
4363
4363
  role: typeof t.role == "string" ? t.role : null
4364
4364
  } : null;
4365
4365
  }
4366
- function Th(e) {
4366
+ function Dh(e) {
4367
4367
  try {
4368
4368
  let t = e.split(".");
4369
4369
  if (t.length !== 3) return null;
@@ -4375,16 +4375,16 @@ function Th(e) {
4375
4375
  }
4376
4376
  //#endregion
4377
4377
  //#region src/connection/authenticator.ts
4378
- var q = w("Authenticator"), Eh = T.GROUP_CORE | T.GROUP_KEEPALIVE | T.GROUP_EVENTS | T.GROUP_ACTIONS | T.GROUP_UI | T.GROUP_AUDIO | T.GROUP_VIDEO | T.GROUP_ANALYTICS | T.GROUP_APP_LOCAL, Dh = 2, Oh = 6e4, kh = 2e3, Ah = 1e4, jh = 3e3, Mh = 3e3, Nh = 3, Ph = "X-Ikon-Startup-Failed", Fh = "startup_failed", Ih = 1e3, Lh = 5, Rh = "env";
4379
- function zh(e) {
4380
- let t = e.streamPath ? bf(e.streamPath) : null;
4378
+ var J = w("Authenticator"), Oh = T.GROUP_CORE | T.GROUP_KEEPALIVE | T.GROUP_EVENTS | T.GROUP_ACTIONS | T.GROUP_UI | T.GROUP_AUDIO | T.GROUP_VIDEO | T.GROUP_ANALYTICS | T.GROUP_APP_LOCAL, kh = 2, Ah = 6e4, jh = 2e3, Mh = 1e4, Nh = 3e3, Ph = 3e3, Fh = 3, Ih = "X-Ikon-Startup-Failed", Lh = "startup_failed", Rh = 1e3, zh = 5, Bh = "env";
4379
+ function Vh(e) {
4380
+ let t = e.streamPath ? Cf(e.streamPath) : null;
4381
4381
  return {
4382
4382
  direct: e.url,
4383
4383
  proxy: e.proxyUrl,
4384
4384
  lb: t ?? void 0
4385
4385
  };
4386
4386
  }
4387
- async function Bh(e, t, n, r) {
4387
+ async function Hh(e, t, n, r) {
4388
4388
  if (e) try {
4389
4389
  let i = await fetch(`${n}/anonymous`, {
4390
4390
  method: "POST",
@@ -4397,17 +4397,17 @@ async function Bh(e, t, n, r) {
4397
4397
  });
4398
4398
  if (!i.ok) {
4399
4399
  let e = await i.text().catch(() => "");
4400
- q.warn(`Anonymous auth failed: ${i.status} ${e}`.trim());
4400
+ J.warn(`Anonymous auth failed: ${i.status} ${e}`.trim());
4401
4401
  return;
4402
4402
  }
4403
4403
  let a = await i.json();
4404
4404
  if (!a.token) {
4405
- q.warn("Anonymous auth returned no token");
4405
+ J.warn("Anonymous auth returned no token");
4406
4406
  return;
4407
4407
  }
4408
- let o = Ch(a.token);
4408
+ let o = Th(a.token);
4409
4409
  if (!o) {
4410
- q.warn("Anonymous auth token had no extractable userId");
4410
+ J.warn("Anonymous auth token had no extractable userId");
4411
4411
  return;
4412
4412
  }
4413
4413
  return {
@@ -4415,23 +4415,23 @@ async function Bh(e, t, n, r) {
4415
4415
  token: a.token
4416
4416
  };
4417
4417
  } catch (e) {
4418
- q.warn("Anonymous auth request failed:", e);
4418
+ J.warn("Anonymous auth request failed:", e);
4419
4419
  return;
4420
4420
  }
4421
4421
  }
4422
- async function Vh(e, t, n, r) {
4422
+ async function Uh(e, t, n, r) {
4423
4423
  try {
4424
4424
  let i = await fetch(`${e}/profiles/me?space=${encodeURIComponent(t)}`, {
4425
4425
  method: "GET",
4426
4426
  headers: { Authorization: `Bearer ${n}` },
4427
4427
  signal: r
4428
4428
  });
4429
- i.ok || q.warn(`Failed to ensure profile: ${i.status}`);
4429
+ i.ok || J.warn(`Failed to ensure profile: ${i.status}`);
4430
4430
  } catch (e) {
4431
- q.warn("Failed to ensure profile:", e);
4431
+ J.warn("Failed to ensure profile:", e);
4432
4432
  }
4433
4433
  }
4434
- async function Hh(e) {
4434
+ async function Wh(e) {
4435
4435
  let t = await e.text().catch(() => "Unknown error");
4436
4436
  try {
4437
4437
  let e = JSON.parse(t);
@@ -4439,16 +4439,16 @@ async function Hh(e) {
4439
4439
  } catch {}
4440
4440
  return t;
4441
4441
  }
4442
- async function Uh(e) {
4442
+ async function Gh(e) {
4443
4443
  if (e.ok) return;
4444
- let t = await Hh(e);
4445
- throw e.status === 403 ? new ou(`Access denied: ${t}`, t) : Wh("Failed to get or create profile", e.status, t);
4444
+ let t = await Wh(e);
4445
+ throw e.status === 403 ? new su(`Access denied: ${t}`, t) : Kh("Failed to get or create profile", e.status, t);
4446
4446
  }
4447
- function Wh(e, t, n) {
4447
+ function Kh(e, t, n) {
4448
4448
  let r = `${e}: ${t} ${n}`;
4449
- return t >= 500 ? new lu(r, t) : new E(r);
4449
+ return t >= 500 ? new uu(r, t) : new E(r);
4450
4450
  }
4451
- function Gh(e, t, n) {
4451
+ function qh(e, t, n) {
4452
4452
  let r = {
4453
4453
  method: "POST",
4454
4454
  headers: {
@@ -4460,110 +4460,110 @@ function Gh(e, t, n) {
4460
4460
  };
4461
4461
  return t || (r.credentials = "include"), r;
4462
4462
  }
4463
- async function Kh(e, t, n, r) {
4464
- let i = `${e}/init`, a = await fetch(i, Gh(t, n, r));
4463
+ async function Jh(e, t, n, r) {
4464
+ let i = `${e}/init`, a = await fetch(i, qh(t, n, r));
4465
4465
  if (!a.ok) {
4466
- let e = await Hh(a);
4467
- throw a.status === 403 ? new ou(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new su(t.sessionIdentityHash) : Wh("Backend init failed", a.status, e);
4466
+ let e = await Wh(a);
4467
+ throw a.status === 403 ? new su(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new cu(t.sessionIdentityHash) : Kh("Backend init failed", a.status, e);
4468
4468
  }
4469
4469
  return a.json();
4470
4470
  }
4471
- function qh(e, t) {
4472
- return e.startupFailed ? new k() : new iu(t);
4471
+ function Yh(e, t) {
4472
+ return e.startupFailed ? new au() : new iu(t);
4473
4473
  }
4474
- async function Jh(e, t, n, r) {
4475
- e = Qh(e, r);
4476
- let i = B(n ?? Ah), a = t ? sf([t, i]) : i, o = Date.now(), s = await fetch(e, { signal: a });
4474
+ async function Xh(e, t, n, r) {
4475
+ e = eg(e, r);
4476
+ let i = B(n ?? Mh), a = t ? uf([t, i]) : i, o = Date.now(), s = await fetch(e, { signal: a });
4477
4477
  if (!s.ok) {
4478
4478
  let e = await s.text().catch(() => "Unknown error");
4479
- throw s.status === 429 ? new cu(`Server is at capacity: ${e}`) : s.headers.get(Ph) || e.includes(Fh) ? new k() : Wh("Failed to connect", s.status, e);
4479
+ throw s.status === 429 ? new lu(`Server is at capacity: ${e}`) : s.headers.get(Ih) || e.includes(Lh) ? new au() : Kh("Failed to connect", s.status, e);
4480
4480
  }
4481
4481
  let c = await s.arrayBuffer(), l = await ir(new Uint8Array(c));
4482
- return q.debug(`Connect URL fetched in ${Date.now() - o}ms`), { authResponse: l };
4482
+ return J.debug(`Connect URL fetched in ${Date.now() - o}ms`), { authResponse: l };
4483
4483
  }
4484
- async function Yh(e, t) {
4484
+ async function Zh(e, t) {
4485
4485
  try {
4486
- let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = B(Mh), a = t ? sf([t, i]) : i;
4486
+ let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = B(Ph), a = t ? uf([t, i]) : i;
4487
4487
  return (await fetch(r, { signal: a })).ok;
4488
4488
  } catch {
4489
4489
  return !1;
4490
4490
  }
4491
4491
  }
4492
- async function Xh(e, t, n, r) {
4493
- let i = Fd(R.filter((t) => e[t]), n, t).map((t) => ({
4492
+ async function Qh(e, t, n, r) {
4493
+ let i = zd(L.filter((t) => e[t]), n, t).map((t) => ({
4494
4494
  tier: t,
4495
4495
  url: e[t]
4496
4496
  }));
4497
4497
  if (i.length === 0) throw new E("No connect URL available");
4498
- q.debug(`Auth URL order: [${i.map((e) => e.tier).join(", ")}], mode: ${t}, learned tier: ${n}`);
4498
+ J.debug(`Auth URL order: [${i.map((e) => e.tier).join(", ")}], mode: ${t}, learned tier: ${n}`);
4499
4499
  let a = t === "auto" && i.length > 1 && i[0].tier === "direct", o = Date.now(), s = 0;
4500
- for (; s < Dh || Date.now() - o < Oh;) {
4500
+ for (; s < kh || Date.now() - o < Ah;) {
4501
4501
  for (let t = 0; t < i.length; t++) {
4502
- let n = i[t], o = s === 0 && t === 0 && a ? jh : Ah;
4502
+ let n = i[t], o = s === 0 && t === 0 && a ? Nh : Mh;
4503
4503
  try {
4504
- let t = await Jh(n.url, r, o);
4505
- return t.usedProxyUrl = n.tier !== "direct", t.connectTier = n.tier, t.connectTierUrls = e, t.directUrl = e.direct, q.debug(`Auth succeeded via the ${n.tier} URL`), t;
4504
+ let t = await Xh(n.url, r, o);
4505
+ return t.usedProxyUrl = n.tier !== "direct", t.connectTier = n.tier, t.connectTierUrls = e, t.directUrl = e.direct, J.debug(`Auth succeeded via the ${n.tier} URL`), t;
4506
4506
  } catch (e) {
4507
- if (r?.aborted || e instanceof cu || e instanceof k) throw e;
4508
- q.warn(`Auth via the ${n.tier} URL failed (round ${s + 1}, timeout ${o}ms): ${e}`);
4507
+ if (r?.aborted || e instanceof lu || e instanceof au) throw e;
4508
+ J.warn(`Auth via the ${n.tier} URL failed (round ${s + 1}, timeout ${o}ms): ${e}`);
4509
4509
  }
4510
4510
  }
4511
- s++, await du(kh, r);
4511
+ s++, await fu(jh, r);
4512
4512
  }
4513
4513
  throw new E("Failed to connect after exhausting all URL attempts");
4514
4514
  }
4515
- function Zh(e = {}) {
4516
- let t = mp();
4515
+ function $h(e = {}) {
4516
+ let t = _p();
4517
4517
  return jt({
4518
4518
  Description: "Ikon SDK TypeScript",
4519
4519
  ProductId: "ikon-sdk",
4520
4520
  VersionId: "1.0.0",
4521
- DeviceId: xh(),
4521
+ DeviceId: Ch(),
4522
4522
  Locale: typeof navigator < "u" ? navigator.language : "en-US",
4523
4523
  UserAgent: typeof navigator < "u" ? navigator.userAgent : "",
4524
- ClientType: Ep(),
4525
- SdkCapability: Lh,
4524
+ ClientType: kp(),
4525
+ SdkCapability: zh,
4526
4526
  ProtocolVersion: 1,
4527
- PayloadType: S.Teleport,
4527
+ PayloadType: pe.Teleport,
4528
4528
  SupportsCompression: De(),
4529
4529
  ViewportWidth: t.width,
4530
4530
  ViewportHeight: t.height,
4531
- Theme: pp(),
4532
- Timezone: wp(),
4533
- IsTouchDevice: Tp(),
4534
- InitialPath: Nf(),
4535
- InitialUrl: Pf(),
4536
- IsSnapshot: qu(),
4531
+ Theme: gp(),
4532
+ Timezone: Dp(),
4533
+ IsTouchDevice: Op(),
4534
+ InitialPath: If(),
4535
+ InitialUrl: Lf(),
4536
+ IsSnapshot: Ju(),
4537
4537
  ...e
4538
4538
  });
4539
4539
  }
4540
- function Qh(e, t) {
4541
- if (e.includes(`${Rh}=`)) return e;
4542
- let n = $h(Nt(t ?? Zh()));
4543
- return `${e}${e.includes("?") ? "&" : "?"}${Rh}=${n}`;
4540
+ function eg(e, t) {
4541
+ if (e.includes(`${Bh}=`)) return e;
4542
+ let n = tg(Nt(t ?? $h()));
4543
+ return `${e}${e.includes("?") ? "&" : "?"}${Bh}=${n}`;
4544
4544
  }
4545
- function $h(e) {
4545
+ function tg(e) {
4546
4546
  let t = "";
4547
4547
  for (let n of e) t += String.fromCharCode(n);
4548
4548
  return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
4549
4549
  }
4550
- function eg(e, t, n = "", r = !0) {
4550
+ function ng(e, t, n = "", r = !0) {
4551
4551
  return Ft({
4552
4552
  ServerSessionId: "",
4553
4553
  ContextType: m.Browser,
4554
4554
  UserType: p.Human,
4555
4555
  IsInternal: !1,
4556
4556
  UserId: t,
4557
- OpcodeGroupsFromServer: e.opcodeGroupsFromServer ?? Eh,
4558
- OpcodeGroupsToServer: e.opcodeGroupsToServer ?? Eh,
4557
+ OpcodeGroupsFromServer: e.opcodeGroupsFromServer ?? Oh,
4558
+ OpcodeGroupsToServer: e.opcodeGroupsToServer ?? Oh,
4559
4559
  AuthSessionId: n,
4560
4560
  IsAnonymous: r,
4561
4561
  IsGlobal: !1,
4562
4562
  Parameters: e.parameters ?? {}
4563
4563
  });
4564
4564
  }
4565
- function tg(e) {
4566
- return Zh({
4565
+ function rg(e) {
4566
+ return $h({
4567
4567
  ...e.description === void 0 ? {} : { Description: e.description },
4568
4568
  ...e.deviceId === void 0 ? {} : { DeviceId: e.deviceId },
4569
4569
  ...e.productId === void 0 ? {} : { ProductId: e.productId },
@@ -4572,7 +4572,7 @@ function tg(e) {
4572
4572
  ...e.locale === void 0 ? {} : { Locale: e.locale }
4573
4573
  });
4574
4574
  }
4575
- function ng(e) {
4575
+ function ig(e) {
4576
4576
  return {
4577
4577
  ServerSessionId: e.ServerSessionId,
4578
4578
  ContextType: e.ContextType,
@@ -4587,26 +4587,26 @@ function ng(e) {
4587
4587
  Parameters: e.Parameters
4588
4588
  };
4589
4589
  }
4590
- async function rg(e, t) {
4590
+ async function ag(e, t) {
4591
4591
  let n = `https://${e.host}:${e.httpsPort}`;
4592
- q.debug(`Authenticating with local server: ${n}`);
4592
+ J.debug(`Authenticating with local server: ${n}`);
4593
4593
  let r = {
4594
- ...Of(),
4594
+ ...jf(),
4595
4595
  ...e.parameters
4596
- }, i = e.deviceId ?? xh(), a = e.userId, o = e.token;
4596
+ }, i = e.deviceId ?? Ch(), a = e.userId, o = e.token;
4597
4597
  if (!a) {
4598
- let n = await Bh(e.spaceId, i, await Ef(e.authUrl), t);
4598
+ let n = await Hh(e.spaceId, i, await kf(e.authUrl), t);
4599
4599
  n && (a = n.userId, o = n.token);
4600
4600
  }
4601
- if (a || (a = i, q.debug("Using deviceId as userId fallback")), e.spaceId && o) if (e.token) {
4602
- let n = Cf(e.backendUrl);
4603
- await Uh(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
4601
+ if (a || (a = i, J.debug("Using deviceId as userId fallback")), e.spaceId && o) if (e.token) {
4602
+ let n = Ef(e.backendUrl);
4603
+ await Gh(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
4604
4604
  method: "GET",
4605
4605
  headers: { Authorization: `Bearer ${o}` },
4606
4606
  signal: t
4607
4607
  }));
4608
- } else await Vh(Cf(e.backendUrl), e.spaceId, o, t);
4609
- let s = e.token ?? e.identityToken ?? o, c = s ? wh(s) : null, l = c?.authSession ?? (e.token ? "authenticated" : ""), u = c?.role ? c.role === "anonymous" : !e.token, d = ng(eg({
4608
+ } else await Uh(Ef(e.backendUrl), e.spaceId, o, t);
4609
+ let s = e.token ?? e.identityToken ?? o, c = s ? Eh(s) : null, l = c?.authSession ?? (e.token ? "authenticated" : ""), u = c?.role ? c.role === "anonymous" : !e.token, d = ig(ng({
4610
4610
  ...e,
4611
4611
  parameters: r
4612
4612
  }, a, l, u)), f = await fetch(`${n}/connect-token`, {
@@ -4617,16 +4617,16 @@ async function rg(e, t) {
4617
4617
  });
4618
4618
  if (!f.ok) {
4619
4619
  let e = await f.text().catch(() => "Unknown error");
4620
- throw Wh("Failed to get connect token", f.status, e);
4620
+ throw Kh("Failed to get connect token", f.status, e);
4621
4621
  }
4622
4622
  let p = (await f.json()).token;
4623
4623
  if (!p) throw new E("Server did not return a token");
4624
- let m = `${n}/connect?token=${encodeURIComponent(p)}`, h = await Jh(m, t, void 0, tg(e));
4625
- return h.directUrl = m, h.backendUrl = Cf(e.backendUrl), h.authToken = o, h;
4624
+ let m = `${n}/connect?token=${encodeURIComponent(p)}`, h = await Xh(m, t, void 0, rg(e));
4625
+ return h.directUrl = m, h.backendUrl = Ef(e.backendUrl), h.authToken = o, h;
4626
4626
  }
4627
- async function ig(e, t, n = "auto", r = "direct") {
4628
- let i = Sf(e.backendType);
4629
- q.debug(`Authenticating with cloud server: ${i}, space ID: ${e.spaceId}`);
4627
+ async function og(e, t, n = "auto", r = "direct") {
4628
+ let i = Tf(e.backendType);
4629
+ J.debug(`Authenticating with cloud server: ${i}, space ID: ${e.spaceId}`);
4630
4630
  let a = await fetch(`${i}/auth/api-key`, {
4631
4631
  method: "POST",
4632
4632
  headers: { "Content-Type": "application/json" },
@@ -4639,14 +4639,14 @@ async function ig(e, t, n = "auto", r = "direct") {
4639
4639
  });
4640
4640
  if (!a.ok) {
4641
4641
  let e = await a.text().catch(() => "Unknown error");
4642
- throw Wh("API key authentication failed", a.status, e);
4642
+ throw Kh("API key authentication failed", a.status, e);
4643
4643
  }
4644
4644
  let o = (await a.json()).token;
4645
4645
  if (!o) throw new E("Backend did not return a token");
4646
- let s = Of(), c = e.provisioningTimeoutMs ?? 6e4, l = {
4646
+ let s = jf(), c = e.provisioningTimeoutMs ?? 6e4, l = {
4647
4647
  ...s,
4648
4648
  ...e.parameters
4649
- }, u = mp(), d = M() ? Nh : 1;
4649
+ }, u = _p(), d = j() ? Fh : 1;
4650
4650
  for (let a = 0; a < d; a++) try {
4651
4651
  let a = {
4652
4652
  space: e.spaceId,
@@ -4654,50 +4654,50 @@ async function ig(e, t, n = "auto", r = "direct") {
4654
4654
  params: e.parameters,
4655
4655
  waitForRunning: !0,
4656
4656
  waitForRunningTimeoutMs: c,
4657
- connectTraceId: mh(),
4657
+ connectTraceId: gh(),
4658
4658
  contextType: m.Plugin,
4659
4659
  userType: e.userType ?? p.Human,
4660
- clientType: e.clientType ?? Ep(),
4661
- payloadType: S.Teleport,
4660
+ clientType: e.clientType ?? kp(),
4661
+ payloadType: pe.Teleport,
4662
4662
  description: e.description ?? "Ikon SDK TypeScript",
4663
- deviceId: e.deviceId ?? xh(),
4663
+ deviceId: e.deviceId ?? Ch(),
4664
4664
  productId: e.productId ?? "",
4665
4665
  versionId: e.versionId ?? "",
4666
4666
  installId: e.installId ?? "",
4667
4667
  locale: e.locale ?? (typeof navigator < "u" ? navigator.language : "en-US"),
4668
- opcodeGroupsFromServer: e.opcodeGroupsFromServer ?? Eh,
4669
- opcodeGroupsToServer: e.opcodeGroupsToServer ?? Eh,
4668
+ opcodeGroupsFromServer: e.opcodeGroupsFromServer ?? Oh,
4669
+ opcodeGroupsToServer: e.opcodeGroupsToServer ?? Oh,
4670
4670
  protocolVersion: 1,
4671
4671
  userAgent: typeof navigator < "u" ? navigator.userAgent : "",
4672
4672
  launchParams: l,
4673
4673
  viewportWidth: u.width,
4674
4674
  viewportHeight: u.height,
4675
- theme: pp(),
4676
- timezone: wp(),
4677
- isTouchDevice: Tp(),
4678
- initialPath: Nf(),
4679
- initialUrl: Pf(),
4675
+ theme: gp(),
4676
+ timezone: Dp(),
4677
+ isTouchDevice: Op(),
4678
+ initialPath: If(),
4679
+ initialUrl: Lf(),
4680
4680
  sdkType: 2,
4681
- sdkCapability: Lh,
4681
+ sdkCapability: zh,
4682
4682
  supportsCompression: De(),
4683
- isSnapshot: qu()
4684
- }, s = t ? sf([t, B(c)]) : B(c), d = await Kh(i, a, o, s);
4685
- if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw qh(d, c);
4686
- let f = await Xh(zh(d.configuration), n, r, s);
4687
- return f.backendUrl = i, f.authToken = o, f.brandingRequired = d.configuration.brandingRequired ?? !1, bm(d.configuration.push), f;
4683
+ isSnapshot: Ju()
4684
+ }, s = t ? uf([t, B(c)]) : B(c), d = await Jh(i, a, o, s);
4685
+ if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Yh(d, c);
4686
+ let f = await Qh(Vh(d.configuration), n, r, s);
4687
+ return f.backendUrl = i, f.authToken = o, f.brandingRequired = d.configuration.brandingRequired ?? !1, Cm(d.configuration.push), f;
4688
4688
  } catch (e) {
4689
- if (e instanceof ou || e instanceof cu || e instanceof su || e instanceof k || a === d - 1) throw e;
4690
- q.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await du(Ih * (a + 1), t);
4689
+ if (e instanceof su || e instanceof lu || e instanceof cu || e instanceof au || a === d - 1) throw e;
4690
+ J.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await fu(Rh * (a + 1), t);
4691
4691
  }
4692
4692
  throw new E("Failed to init after all attempts");
4693
4693
  }
4694
- async function ag(e, t, n = "auto", r = "direct") {
4695
- let i = Sf(e.backendType), a = e.token;
4696
- q.debug(`Authenticating with session token to: ${i}, space ID: ${e.spaceId}`);
4697
- let o = Of(), s = e.provisioningTimeoutMs ?? 6e4, c = {
4694
+ async function sg(e, t, n = "auto", r = "direct") {
4695
+ let i = Tf(e.backendType), a = e.token;
4696
+ J.debug(`Authenticating with session token to: ${i}, space ID: ${e.spaceId}`);
4697
+ let o = jf(), s = e.provisioningTimeoutMs ?? 6e4, c = {
4698
4698
  ...o,
4699
4699
  ...e.parameters
4700
- }, l = mp(), u = M() ? Nh : 1;
4700
+ }, l = _p(), u = j() ? Fh : 1;
4701
4701
  for (let o = 0; o < u; o++) try {
4702
4702
  let o = {
4703
4703
  space: e.spaceId,
@@ -4705,57 +4705,57 @@ async function ag(e, t, n = "auto", r = "direct") {
4705
4705
  params: e.parameters,
4706
4706
  waitForRunning: !0,
4707
4707
  waitForRunningTimeoutMs: s,
4708
- connectTraceId: mh(),
4708
+ connectTraceId: gh(),
4709
4709
  contextType: m.Browser,
4710
4710
  userType: p.Human,
4711
- clientType: Ep(),
4712
- payloadType: S.Teleport,
4711
+ clientType: kp(),
4712
+ payloadType: pe.Teleport,
4713
4713
  description: e.description ?? "Ikon SDK TypeScript",
4714
- deviceId: e.deviceId ?? xh(),
4714
+ deviceId: e.deviceId ?? Ch(),
4715
4715
  productId: e.productId ?? "",
4716
4716
  versionId: e.versionId ?? "",
4717
4717
  installId: e.installId ?? "",
4718
4718
  locale: e.locale ?? (typeof navigator < "u" ? navigator.language : "en-US"),
4719
- opcodeGroupsFromServer: e.opcodeGroupsFromServer ?? Eh,
4720
- opcodeGroupsToServer: e.opcodeGroupsToServer ?? Eh,
4719
+ opcodeGroupsFromServer: e.opcodeGroupsFromServer ?? Oh,
4720
+ opcodeGroupsToServer: e.opcodeGroupsToServer ?? Oh,
4721
4721
  protocolVersion: 1,
4722
4722
  userAgent: typeof navigator < "u" ? navigator.userAgent : "",
4723
4723
  launchParams: c,
4724
4724
  viewportWidth: l.width,
4725
4725
  viewportHeight: l.height,
4726
- theme: pp(),
4727
- timezone: wp(),
4728
- isTouchDevice: Tp(),
4729
- initialPath: Nf(),
4730
- initialUrl: Pf(),
4726
+ theme: gp(),
4727
+ timezone: Dp(),
4728
+ isTouchDevice: Op(),
4729
+ initialPath: If(),
4730
+ initialUrl: Lf(),
4731
4731
  sdkType: 2,
4732
- sdkCapability: Lh,
4732
+ sdkCapability: zh,
4733
4733
  supportsCompression: De(),
4734
- isSnapshot: qu()
4735
- }, u = t ? sf([t, B(s)]) : B(s), d = await Kh(i, o, a, u);
4736
- if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw qh(d, s);
4737
- let f = await Xh(zh(d.configuration), n, r, u);
4738
- return f.backendUrl = i, f.authToken = a, f.brandingRequired = d.configuration.brandingRequired ?? !1, bm(d.configuration.push), f;
4734
+ isSnapshot: Ju()
4735
+ }, u = t ? uf([t, B(s)]) : B(s), d = await Jh(i, o, a, u);
4736
+ if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Yh(d, s);
4737
+ let f = await Qh(Vh(d.configuration), n, r, u);
4738
+ return f.backendUrl = i, f.authToken = a, f.brandingRequired = d.configuration.brandingRequired ?? !1, Cm(d.configuration.push), f;
4739
4739
  } catch (e) {
4740
- if (e instanceof ou || e instanceof cu || e instanceof su || e instanceof k || o === u - 1) throw e;
4741
- q.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await du(Ih * (o + 1), t);
4740
+ if (e instanceof su || e instanceof lu || e instanceof cu || e instanceof au || o === u - 1) throw e;
4741
+ J.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await fu(Rh * (o + 1), t);
4742
4742
  }
4743
4743
  throw new E("Failed to init after all attempts");
4744
4744
  }
4745
4745
  //#endregion
4746
4746
  //#region src/functions/type-conversion.ts
4747
- var og = /* @__PURE__ */ new Uint8Array();
4748
- function sg(e) {
4747
+ var cg = /* @__PURE__ */ new Uint8Array();
4748
+ function lg(e) {
4749
4749
  switch (e.kind) {
4750
4750
  case "array": return {
4751
4751
  kind: "array",
4752
- element: sg(e.element),
4752
+ element: lg(e.element),
4753
4753
  nullable: e.nullable ?? !1
4754
4754
  };
4755
4755
  case "dictionary": return {
4756
4756
  kind: "dictionary",
4757
4757
  keyType: e.keyType ?? "string",
4758
- value: sg(e.value),
4758
+ value: lg(e.value),
4759
4759
  nullable: e.nullable ?? !1
4760
4760
  };
4761
4761
  default: return {
@@ -4764,17 +4764,17 @@ function sg(e) {
4764
4764
  };
4765
4765
  }
4766
4766
  }
4767
- function cg(e) {
4767
+ function ug(e) {
4768
4768
  switch (e.kind) {
4769
4769
  case "boolean": return "System.Boolean";
4770
4770
  case "number": return "System.Double";
4771
4771
  case "string": return "System.String";
4772
- case "array": return `System.Collections.Generic.List\`1[${cg(e.element)}]`;
4773
- case "dictionary": return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${cg(e.value)}]`;
4772
+ case "array": return `System.Collections.Generic.List\`1[${ug(e.element)}]`;
4773
+ case "dictionary": return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${ug(e.value)}]`;
4774
4774
  default: return e;
4775
4775
  }
4776
4776
  }
4777
- function lg(e, t) {
4777
+ function dg(e, t) {
4778
4778
  if (e === void 0 || e === "") return;
4779
4779
  let n = JSON.parse(e);
4780
4780
  if (n === null) {
@@ -4783,7 +4783,7 @@ function lg(e, t) {
4783
4783
  }
4784
4784
  return n;
4785
4785
  }
4786
- function ug(e, t) {
4786
+ function fg(e, t) {
4787
4787
  if (e === void 0) return "null";
4788
4788
  if (e === null) {
4789
4789
  if (!t.nullable) throw Error("Value cannot be null for non-nullable type");
@@ -4791,9 +4791,9 @@ function ug(e, t) {
4791
4791
  }
4792
4792
  return JSON.stringify(e);
4793
4793
  }
4794
- function dg(e, t) {
4794
+ function pg(e, t) {
4795
4795
  let r = (e.parameters ?? []).map((e) => {
4796
- let t = sg(e.type), n = Object.prototype.hasOwnProperty.call(e, "defaultValue"), r = n ? ug(e.defaultValue, t) : "";
4796
+ let t = lg(e.type), n = Object.prototype.hasOwnProperty.call(e, "defaultValue"), r = n ? fg(e.defaultValue, t) : "";
4797
4797
  return {
4798
4798
  name: e.name,
4799
4799
  descriptor: t,
@@ -4801,7 +4801,7 @@ function dg(e, t) {
4801
4801
  defaultValueJson: r,
4802
4802
  description: e.description
4803
4803
  };
4804
- }), i = sg(e.returnType);
4804
+ }), i = lg(e.returnType);
4805
4805
  return {
4806
4806
  definition: e,
4807
4807
  handler: t,
@@ -4811,7 +4811,7 @@ function dg(e, t) {
4811
4811
  Description: e.description ?? "",
4812
4812
  LlmInlineResult: e.llmInlineResult ?? !1,
4813
4813
  LlmCallOnlyOnce: e.llmCallOnlyOnce ?? !1,
4814
- ResultTypeName: cg(i),
4814
+ ResultTypeName: ug(i),
4815
4815
  IsEnumerable: !1,
4816
4816
  EnumerableItemTypeName: "",
4817
4817
  IsCancellable: !1,
@@ -4820,10 +4820,10 @@ function dg(e, t) {
4820
4820
  Parameters: r.map((e, t) => ({
4821
4821
  ParameterIndex: t,
4822
4822
  ParameterName: e.name,
4823
- TypeName: cg(e.descriptor),
4823
+ TypeName: ug(e.descriptor),
4824
4824
  HasDefaultValue: e.hasDefaultValue,
4825
4825
  DefaultValueJson: e.defaultValueJson,
4826
- DefaultValueData: og,
4826
+ DefaultValueData: cg,
4827
4827
  IsEnumerable: !1,
4828
4828
  EnumerableItemTypeName: "",
4829
4829
  Description: e.description ?? ""
@@ -4835,24 +4835,24 @@ function dg(e, t) {
4835
4835
  }
4836
4836
  //#endregion
4837
4837
  //#region src/functions/types.ts
4838
- function fg(e, t) {
4838
+ function mg(e, t) {
4839
4839
  return {
4840
4840
  value: e,
4841
4841
  data: t
4842
4842
  };
4843
4843
  }
4844
- var pg = class extends Error {
4844
+ var hg = class extends Error {
4845
4845
  remoteErrorType;
4846
4846
  remoteStackTrace;
4847
4847
  code;
4848
4848
  constructor(e, t, n, r = "") {
4849
4849
  super(e), this.remoteErrorType = t, this.remoteStackTrace = n, this.code = r, this.name = "FunctionCallError";
4850
4850
  }
4851
- }, mg = w("FunctionRegistry"), hg = /* @__PURE__ */ new Uint8Array(), gg = 3e4;
4852
- function _g(e) {
4851
+ }, gg = w("FunctionRegistry"), _g = /* @__PURE__ */ new Uint8Array(), vg = 3e4;
4852
+ function yg(e) {
4853
4853
  return !e || typeof e != "object" ? !1 : e.data instanceof Uint8Array;
4854
4854
  }
4855
- var vg = class {
4855
+ var bg = class {
4856
4856
  functions = /* @__PURE__ */ new Map();
4857
4857
  remoteFunctions = /* @__PURE__ */ new Map();
4858
4858
  pendingCalls = /* @__PURE__ */ new Map();
@@ -4874,7 +4874,7 @@ var vg = class {
4874
4874
  };
4875
4875
  }
4876
4876
  register(e, t) {
4877
- let n = dg(e, t);
4877
+ let n = pg(e, t);
4878
4878
  return this.functions.set(e.name, n), this.isConnected && this.config && this.sendRegistration(n), () => this.unregister(e.name);
4879
4879
  }
4880
4880
  unregister(e) {
@@ -4915,7 +4915,7 @@ var vg = class {
4915
4915
  ParameterIndex: t,
4916
4916
  TypeName: n ? n.TypeName : this.inferTypeName(e),
4917
4917
  ValueJson: JSON.stringify(e ?? null),
4918
- ValueData: hg
4918
+ ValueData: _g
4919
4919
  });
4920
4920
  }), c = r?.instanceId ? n.fromString(r.instanceId) : n.createZero(), l = jr(wr({
4921
4921
  FunctionId: n.fromString(i.id),
@@ -4928,8 +4928,8 @@ var vg = class {
4928
4928
  }), this.config.sessionId, { targetIds: [i.clientSessionId] });
4929
4929
  return new Promise((t, n) => {
4930
4930
  let r = setTimeout(() => {
4931
- this.pendingCalls.delete(o.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${gg}ms`));
4932
- }, gg);
4931
+ this.pendingCalls.delete(o.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${vg}ms`));
4932
+ }, vg);
4933
4933
  this.pendingCalls.set(o.toString(), {
4934
4934
  resolve: t,
4935
4935
  reject: n,
@@ -4996,7 +4996,7 @@ var vg = class {
4996
4996
  if (t === T.ACTION_FUNCTION_CALL) {
4997
4997
  let t = i(e);
4998
4998
  return this.handleFunctionCall(e, t.senderId).catch((e) => {
4999
- mg.error("Failed to handle function call:", e);
4999
+ gg.error("Failed to handle function call:", e);
5000
5000
  }), !0;
5001
5001
  }
5002
5002
  if (t === T.ACTION_FUNCTION_RESULT) return this.handleFunctionResult(e), !0;
@@ -5018,7 +5018,7 @@ var vg = class {
5018
5018
  handleFunctionResult(e) {
5019
5019
  let t = ja(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
5020
5020
  if (!r) {
5021
- mg.warn(`Received result for unknown call: ${n}`);
5021
+ gg.warn(`Received result for unknown call: ${n}`);
5022
5022
  return;
5023
5023
  }
5024
5024
  if (this.pendingCalls.delete(n), clearTimeout(r.timeout), t.ResultData && t.ResultData.length > 0 && !t.ResultJson) {
@@ -5031,11 +5031,11 @@ var vg = class {
5031
5031
  handleFunctionError(e) {
5032
5032
  let t = yi(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
5033
5033
  if (!r) {
5034
- mg.warn(`Received error for unknown call: ${n}`);
5034
+ gg.warn(`Received error for unknown call: ${n}`);
5035
5035
  return;
5036
5036
  }
5037
5037
  this.pendingCalls.delete(n), clearTimeout(r.timeout);
5038
- let i = new pg(t.ErrorMessage, t.ErrorTypeName, t.StackTrace, t.ErrorCode), a = {
5038
+ let i = new hg(t.ErrorMessage, t.ErrorTypeName, t.StackTrace, t.ErrorCode), a = {
5039
5039
  functionName: r.functionName,
5040
5040
  args: r.args
5041
5041
  };
@@ -5069,9 +5069,14 @@ var vg = class {
5069
5069
  this.config.sendProtocolMessage(t);
5070
5070
  }
5071
5071
  async handleFunctionCall(e, t) {
5072
- let n = await Mr(e), r = this.functions.get(n.FunctionName);
5072
+ let n = await Mr(e);
5073
+ if (!this.config) {
5074
+ gg.warn(`Dropping call to '${n.FunctionName}' CallId=${n.CallId.toString()}: the function registry is detached, so the session has not finished joining`);
5075
+ return;
5076
+ }
5077
+ let r = this.functions.get(n.FunctionName);
5073
5078
  if (!r) {
5074
- mg.warn(`Received call for unknown function: ${n.FunctionName}`), this.sendError(n.CallId, n.InstanceId, t, /* @__PURE__ */ Error(`Unknown function: ${n.FunctionName}`));
5079
+ gg.warn(`Received call for unknown function: ${n.FunctionName}`), this.sendError(n.CallId, n.InstanceId, t, /* @__PURE__ */ Error(`Unknown function: ${n.FunctionName}`));
5075
5080
  return;
5076
5081
  }
5077
5082
  this.sendAck(n.CallId, n.InstanceId, t), this.executeFunction(r, n, t);
@@ -5086,14 +5091,14 @@ var vg = class {
5086
5091
  continue;
5087
5092
  }
5088
5093
  let o = a?.ValueJson;
5089
- o === void 0 || o === "" ? i.hasDefaultValue ? r.push(lg(i.defaultValueJson, i.descriptor)) : r.push(void 0) : r.push(lg(o, i.descriptor));
5094
+ o === void 0 || o === "" ? i.hasDefaultValue ? r.push(dg(i.defaultValueJson, i.descriptor)) : r.push(void 0) : r.push(dg(o, i.descriptor));
5090
5095
  }
5091
- let i = await e.handler(...r), a = i, o = hg;
5092
- _g(i) && (a = i.value, o = new Uint8Array(i.data));
5093
- let s = ug(a, e.returnType);
5096
+ let i = await e.handler(...r), a = i, o = _g;
5097
+ yg(i) && (a = i.value, o = new Uint8Array(i.data));
5098
+ let s = fg(a, e.returnType);
5094
5099
  this.sendResult(t.CallId, t.InstanceId, n, e, s, o);
5095
5100
  } catch (e) {
5096
- mg.error(`Function ${t.FunctionName} execution failed:`, e), this.sendError(t.CallId, t.InstanceId, n, e instanceof Error ? e : Error(String(e)));
5101
+ gg.error(`Function ${t.FunctionName} execution failed:`, e), this.sendError(t.CallId, t.InstanceId, n, e instanceof Error ? e : Error(String(e)));
5097
5102
  }
5098
5103
  }
5099
5104
  sendAck(e, t, n) {
@@ -5109,7 +5114,7 @@ var vg = class {
5109
5114
  let o = Aa(Ca({
5110
5115
  CallId: e,
5111
5116
  InstanceId: t,
5112
- ResultTypeName: cg(r.returnType),
5117
+ ResultTypeName: ug(r.returnType),
5113
5118
  ResultJson: i,
5114
5119
  ResultData: a
5115
5120
  }), this.config.sessionId, { targetIds: [n] });
@@ -5126,7 +5131,7 @@ var vg = class {
5126
5131
  }), this.config.sessionId, { targetIds: [n] });
5127
5132
  this.config.sendProtocolMessage(i);
5128
5133
  }
5129
- }, yg = w("ReactiveRegistry"), bg = "Ikon.Reactive.Subscribe", xg = "Ikon.Reactive.Unsubscribe", Sg = {
5134
+ }, xg = w("ReactiveRegistry"), Sg = "Ikon.Reactive.Subscribe", Cg = "Ikon.Reactive.Unsubscribe", wg = {
5130
5135
  name: "Ikon.Reactive.Update",
5131
5136
  description: "Receives reactive value updates pushed from the server when a subscribed reactive changes",
5132
5137
  returnType: { kind: "string" },
@@ -5144,7 +5149,7 @@ var vg = class {
5144
5149
  type: { kind: "string" }
5145
5150
  }
5146
5151
  ]
5147
- }, Cg = class {
5152
+ }, Tg = class {
5148
5153
  subscribersByKey = /* @__PURE__ */ new Map();
5149
5154
  functionRegistry;
5150
5155
  updateHandlerUnregister = null;
@@ -5152,9 +5157,9 @@ var vg = class {
5152
5157
  this.functionRegistry = e, this.registerUpdateHandler();
5153
5158
  }
5154
5159
  async subscribe(e, t, n) {
5155
- let r = n?.mount ?? "", i = wg(e, r), a = t, o = this.subscribersByKey.get(i), s = !o;
5160
+ let r = n?.mount ?? "", i = Eg(e, r), a = t, o = this.subscribersByKey.get(i), s = !o;
5156
5161
  if (o || (o = /* @__PURE__ */ new Set(), this.subscribersByKey.set(i, o)), o.add(a), s) try {
5157
- t(Tg(await this.functionRegistry.call(bg, [e, r])));
5162
+ t(Dg(await this.functionRegistry.call(Sg, [e, r])));
5158
5163
  } catch (e) {
5159
5164
  throw o.delete(a), o.size === 0 && this.subscribersByKey.delete(i), e;
5160
5165
  }
@@ -5166,46 +5171,46 @@ var vg = class {
5166
5171
  this.subscribersByKey.clear(), this.updateHandlerUnregister &&= (this.updateHandlerUnregister(), null);
5167
5172
  }
5168
5173
  unsubscribeOne(e, t, n) {
5169
- let r = wg(e, t), i = this.subscribersByKey.get(r);
5170
- i && (i.delete(n), !(i.size > 0) && (this.subscribersByKey.delete(r), this.functionRegistry.call(xg, [e, t]).catch((n) => {
5171
- yg.warn(`Failed to unsubscribe from '${e}' (mount='${t}'):`, n);
5174
+ let r = Eg(e, t), i = this.subscribersByKey.get(r);
5175
+ i && (i.delete(n), !(i.size > 0) && (this.subscribersByKey.delete(r), this.functionRegistry.call(Cg, [e, t]).catch((n) => {
5176
+ xg.warn(`Failed to unsubscribe from '${e}' (mount='${t}'):`, n);
5172
5177
  })));
5173
5178
  }
5174
5179
  registerUpdateHandler() {
5175
5180
  let e = (...e) => {
5176
- let t = e[0], n = e[1] ?? "", r = e[2], i = wg(t, n), a = this.subscribersByKey.get(i);
5181
+ let t = e[0], n = e[1] ?? "", r = e[2], i = Eg(t, n), a = this.subscribersByKey.get(i);
5177
5182
  if (!a || a.size === 0) return "";
5178
- let o = Tg(r);
5183
+ let o = Dg(r);
5179
5184
  for (let e of a) try {
5180
5185
  e(o);
5181
5186
  } catch (e) {
5182
- yg.warn(`Reactive update callback for '${t}' (mount='${n}') threw:`, e);
5187
+ xg.warn(`Reactive update callback for '${t}' (mount='${n}') threw:`, e);
5183
5188
  }
5184
5189
  return "";
5185
5190
  };
5186
- this.updateHandlerUnregister = this.functionRegistry.register(Sg, e);
5191
+ this.updateHandlerUnregister = this.functionRegistry.register(wg, e);
5187
5192
  }
5188
5193
  };
5189
- function wg(e, t) {
5194
+ function Eg(e, t) {
5190
5195
  return t.length === 0 ? e : `${e}\0${t}`;
5191
5196
  }
5192
- function Tg(e) {
5197
+ function Dg(e) {
5193
5198
  if (e == null || e === "") return null;
5194
5199
  try {
5195
5200
  return JSON.parse(e);
5196
5201
  } catch (t) {
5197
- return yg.warn("Failed to parse reactive value JSON, returning raw string:", t), e;
5202
+ return xg.warn("Failed to parse reactive value JSON, returning raw string:", t), e;
5198
5203
  }
5199
5204
  }
5200
5205
  //#endregion
5201
5206
  //#region src/login/login-error-interceptor.ts
5202
- var Eg = "login_required", Dg = (e, t) => e.code === Eg ? (nf({
5207
+ var Og = "login_required", kg = (e, t) => e.code === Og ? (of({
5203
5208
  functionName: t.functionName,
5204
5209
  args: t.args
5205
- }), $d(e.message), null) : null;
5210
+ }), nf(e.message), null) : null;
5206
5211
  //#endregion
5207
5212
  //#region src/media/device-detection.ts
5208
- function Og() {
5213
+ function Ag() {
5209
5214
  if (typeof navigator > "u") return !1;
5210
5215
  let e = navigator.userAgentData;
5211
5216
  if (typeof e?.mobile == "boolean") return e.mobile;
@@ -5214,7 +5219,7 @@ function Og() {
5214
5219
  }
5215
5220
  //#endregion
5216
5221
  //#region src/functions/media-capture-functions.ts
5217
- function kg(e) {
5222
+ function jg(e) {
5218
5223
  let t = e?.facingMode;
5219
5224
  if (typeof t == "string") return t === "user" || t === "environment" ? t : void 0;
5220
5225
  if (Array.isArray(t)) return t.find((e) => typeof e == "string" && (e === "user" || e === "environment")) ?? void 0;
@@ -5224,21 +5229,21 @@ function kg(e) {
5224
5229
  if (Array.isArray(e)) return e.find((e) => e === "user" || e === "environment") ?? void 0;
5225
5230
  }
5226
5231
  }
5227
- function Ag(e) {
5232
+ function Mg(e) {
5228
5233
  if (!(typeof e != "string" || !e.trim())) try {
5229
5234
  return JSON.parse(e);
5230
5235
  } catch {
5231
5236
  return;
5232
5237
  }
5233
5238
  }
5234
- var jg = {
5239
+ var Ng = {
5235
5240
  StartVideoCapture: "ikon.client.startVideoCapture",
5236
5241
  StartAudioCapture: "ikon.client.startAudioCapture",
5237
5242
  StopCapture: "ikon.client.stopCapture",
5238
5243
  CaptureImage: "ikon.client.captureImage",
5239
5244
  GetMediaDevices: "ikon.client.getMediaDevices"
5240
- }, Mg = {
5241
- name: jg.StartVideoCapture,
5245
+ }, Pg = {
5246
+ name: Ng.StartVideoCapture,
5242
5247
  description: "Start camera or screen capture and stream video frames to the server",
5243
5248
  returnType: { kind: "string" },
5244
5249
  parameters: [{
@@ -5256,8 +5261,8 @@ var jg = {
5256
5261
  },
5257
5262
  description: "JSON encoded capture options"
5258
5263
  }]
5259
- }, Ng = {
5260
- name: jg.StartAudioCapture,
5264
+ }, Fg = {
5265
+ name: Ng.StartAudioCapture,
5261
5266
  description: "Start microphone capture and stream audio frames to the server",
5262
5267
  returnType: { kind: "string" },
5263
5268
  parameters: [{
@@ -5268,8 +5273,8 @@ var jg = {
5268
5273
  },
5269
5274
  description: "JSON encoded capture options"
5270
5275
  }]
5271
- }, Pg = {
5272
- name: jg.StopCapture,
5276
+ }, Ig = {
5277
+ name: Ng.StopCapture,
5273
5278
  description: "Stop a previously started capture by streamId",
5274
5279
  returnType: { kind: "boolean" },
5275
5280
  parameters: [{
@@ -5277,8 +5282,8 @@ var jg = {
5277
5282
  type: { kind: "string" },
5278
5283
  description: "Stream ID to stop"
5279
5284
  }]
5280
- }, Fg = {
5281
- name: jg.CaptureImage,
5285
+ }, Lg = {
5286
+ name: Ng.CaptureImage,
5282
5287
  description: "Capture a single image from the camera and return metadata (JSON) plus binary image data",
5283
5288
  returnType: { kind: "string" },
5284
5289
  parameters: [{
@@ -5289,24 +5294,24 @@ var jg = {
5289
5294
  },
5290
5295
  description: "JSON encoded capture options"
5291
5296
  }]
5292
- }, Ig = {
5293
- name: jg.GetMediaDevices,
5297
+ }, Rg = {
5298
+ name: Ng.GetMediaDevices,
5294
5299
  description: "Get list of available media input devices",
5295
5300
  returnType: { kind: "string" },
5296
5301
  parameters: []
5297
5302
  };
5298
- function Lg(e, t) {
5303
+ function zg(e, t) {
5299
5304
  let n = [];
5300
- return n.push(e.register(Mg, async (e, n) => {
5305
+ return n.push(e.register(Pg, async (e, n) => {
5301
5306
  if (t.isWebRtcCaptureAvailable) {
5302
5307
  let e = t.webRtcSignaling;
5303
5308
  if (!e) throw Error("WebRTC signaling is not connected");
5304
- let r = Ag(n);
5309
+ let r = Mg(n);
5305
5310
  return await e.startVideoCapture(r?.constraints), "webrtc-video";
5306
5311
  }
5307
5312
  let r = await t.ensureMediaCapture();
5308
5313
  if (!r) throw Error("Media capture is not available in this environment");
5309
- let i = Ag(n);
5314
+ let i = Mg(n);
5310
5315
  return ((typeof e == "string" && e.trim().toLowerCase() === "screen" ? "screen" : "camera") == "screen" ? await r.video.startScreen({
5311
5316
  userGesture: !1,
5312
5317
  options: i,
@@ -5316,22 +5321,22 @@ function Lg(e, t) {
5316
5321
  options: i,
5317
5322
  constraints: i?.constraints
5318
5323
  })).streamId;
5319
- })), n.push(e.register(Ng, async (e) => {
5324
+ })), n.push(e.register(Fg, async (e) => {
5320
5325
  if (t.isWebRtcCaptureAvailable) {
5321
5326
  let n = t.webRtcSignaling;
5322
5327
  if (!n) throw Error("WebRTC signaling is not connected");
5323
- let r = Ag(e);
5328
+ let r = Mg(e);
5324
5329
  return await n.startAudioCapture(r?.constraints), "webrtc-audio";
5325
5330
  }
5326
5331
  let n = await t.ensureMediaCapture();
5327
5332
  if (!n) throw Error("Media capture is not available in this environment");
5328
- let r = Ag(e);
5333
+ let r = Mg(e);
5329
5334
  return (await n.audio.startMic({
5330
5335
  userGesture: !1,
5331
5336
  options: r,
5332
5337
  constraints: r?.constraints
5333
5338
  })).streamId;
5334
- })), n.push(e.register(Pg, async (e) => {
5339
+ })), n.push(e.register(Ig, async (e) => {
5335
5340
  if (t.isWebRtcCaptureAvailable) {
5336
5341
  let e = t.webRtcSignaling;
5337
5342
  return e && await e.stopCapture(), !0;
@@ -5340,20 +5345,20 @@ function Lg(e, t) {
5340
5345
  if (!n || typeof e != "string" || !e.trim()) return !1;
5341
5346
  let r = await n.video.stop(e), i = await n.audio.stop(e);
5342
5347
  return r || i;
5343
- })), n.push(e.register(Fg, async (e) => {
5348
+ })), n.push(e.register(Lg, async (e) => {
5344
5349
  let n = await t.ensureMediaCapture();
5345
5350
  if (!n) throw Error("Media capture is not available in this environment");
5346
- let r = Ag(e) ?? {};
5347
- if (r.mode === "native" && Og()) {
5351
+ let r = Mg(e) ?? {};
5352
+ if (r.mode === "native" && Ag()) {
5348
5353
  let e = await n.image.captureFromNativeCamera({
5349
- facing: kg(r.constraints),
5354
+ facing: jg(r.constraints),
5350
5355
  mime: r.mime,
5351
5356
  quality: r.quality,
5352
5357
  width: r.width,
5353
5358
  height: r.height
5354
5359
  });
5355
5360
  if (!e) throw Error("Native camera capture was cancelled");
5356
- return fg(JSON.stringify({
5361
+ return mg(JSON.stringify({
5357
5362
  mime: e.mime,
5358
5363
  width: e.width,
5359
5364
  height: e.height
@@ -5374,12 +5379,12 @@ function Lg(e, t) {
5374
5379
  quality: r.quality,
5375
5380
  width: r.width,
5376
5381
  height: r.height
5377
- }), fg(JSON.stringify({
5382
+ }), mg(JSON.stringify({
5378
5383
  mime: a.mime,
5379
5384
  width: a.width,
5380
5385
  height: a.height
5381
5386
  }), a.data);
5382
- })), n.push(e.register(Ig, async () => {
5387
+ })), n.push(e.register(Rg, async () => {
5383
5388
  if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) return JSON.stringify([]);
5384
5389
  let e = (await navigator.mediaDevices.enumerateDevices()).filter((e) => e.kind === "audioinput" || e.kind === "videoinput").map((e) => ({
5385
5390
  deviceId: e.deviceId,
@@ -5394,45 +5399,45 @@ function Lg(e, t) {
5394
5399
  }
5395
5400
  //#endregion
5396
5401
  //#region src/functions/sound-functions.ts
5397
- var Rg = {
5402
+ var Bg = {
5398
5403
  PlaySound: "ikon.client.playSound",
5399
5404
  StopSound: "ikon.client.stopSound"
5400
- }, zg = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), Bg = 1, Vg = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", Hg = 8, Ug = [], Wg = !1, Y = null;
5401
- function Gg() {
5402
- if (!(Ug.length > 0 || typeof Audio > "u")) for (let e = 0; e < Hg; e++) {
5405
+ }, Vg = /* @__PURE__ */ new Map(), Hg = /* @__PURE__ */ new Map(), Ug = 1, Wg = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", Gg = 8, Kg = [], qg = !1, Y = null;
5406
+ function Jg() {
5407
+ if (!(Kg.length > 0 || typeof Audio > "u")) for (let e = 0; e < Gg; e++) {
5403
5408
  let e = new Audio();
5404
- e.preload = "auto", Ug.push(e);
5409
+ e.preload = "auto", Kg.push(e);
5405
5410
  }
5406
5411
  }
5407
- function Kg() {
5408
- if (!Wg) {
5409
- Gg();
5410
- for (let e of Ug) try {
5411
- e.src = Vg;
5412
+ function Yg() {
5413
+ if (!qg) {
5414
+ Jg();
5415
+ for (let e of Kg) try {
5416
+ e.src = Wg;
5412
5417
  let t = e.play();
5413
5418
  typeof t?.then == "function" ? t.then(() => {
5414
- e.pause(), e.currentTime = 0, Wg = !0, Jg();
5415
- }, () => {}) : Wg = !0;
5419
+ e.pause(), e.currentTime = 0, qg = !0, Zg();
5420
+ }, () => {}) : qg = !0;
5416
5421
  } catch {}
5417
- Wg && Jg();
5422
+ qg && Zg();
5418
5423
  }
5419
5424
  }
5420
- function qg() {
5425
+ function Xg() {
5421
5426
  if (Y || typeof window > "u") return;
5422
- let e = () => Kg();
5427
+ let e = () => Yg();
5423
5428
  Y = 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 });
5424
5429
  }
5425
- function Jg() {
5430
+ function Zg() {
5426
5431
  !Y || typeof window > "u" || (window.removeEventListener("pointerdown", Y, { capture: !0 }), window.removeEventListener("touchend", Y, { capture: !0 }), window.removeEventListener("mousedown", Y, { capture: !0 }), window.removeEventListener("keydown", Y, { capture: !0 }), Y = null);
5427
5432
  }
5428
- function Yg() {
5429
- Gg();
5430
- for (let e of Ug) if (e.paused || e.ended) return e;
5433
+ function Qg() {
5434
+ Jg();
5435
+ for (let e of Kg) if (e.paused || e.ended) return e;
5431
5436
  let e = new Audio();
5432
- return e.preload = "auto", Ug.push(e), e;
5437
+ return e.preload = "auto", Kg.push(e), e;
5433
5438
  }
5434
- var Xg = {
5435
- name: Rg.PlaySound,
5439
+ var $g = {
5440
+ name: Bg.PlaySound,
5436
5441
  description: "Play a sound effect",
5437
5442
  returnType: {
5438
5443
  kind: "string",
@@ -5470,22 +5475,22 @@ var Xg = {
5470
5475
  }
5471
5476
  ]
5472
5477
  };
5473
- function Zg(e, t, n, r) {
5478
+ function e_(e, t, n, r) {
5474
5479
  if (typeof window > "u" || typeof Audio > "u" || typeof e != "string" || !e.trim()) return Promise.resolve(null);
5475
5480
  let i = e;
5476
- if (typeof t == "string" && t && zg.set(t, e), e.startsWith("sound:")) {
5477
- let t = e.slice(6), n = zg.get(t);
5481
+ if (typeof t == "string" && t && Vg.set(t, e), e.startsWith("sound:")) {
5482
+ let t = e.slice(6), n = Vg.get(t);
5478
5483
  if (!n) return Promise.resolve(null);
5479
5484
  i = n;
5480
5485
  }
5481
5486
  return new Promise((e) => {
5482
5487
  try {
5483
- let t = Yg();
5488
+ let t = Qg();
5484
5489
  t.src = i, t.currentTime = 0, t.loop = r === !0, t.volume = typeof n == "number" ? Math.max(0, Math.min(1, n)) : 1;
5485
- let a = `sound-${Bg++}`, o = () => {
5486
- J.delete(a), t.removeEventListener("ended", o), t.removeEventListener("error", o);
5490
+ let a = `sound-${Ug++}`, o = () => {
5491
+ Hg.delete(a), t.removeEventListener("ended", o), t.removeEventListener("error", o);
5487
5492
  };
5488
- t.addEventListener("ended", o), t.addEventListener("error", o), J.set(a, t), t.play().then(() => e(a), () => {
5493
+ t.addEventListener("ended", o), t.addEventListener("error", o), Hg.set(a, t), t.play().then(() => e(a), () => {
5489
5494
  o(), e(null);
5490
5495
  });
5491
5496
  } catch {
@@ -5493,8 +5498,8 @@ function Zg(e, t, n, r) {
5493
5498
  }
5494
5499
  });
5495
5500
  }
5496
- var Qg = {
5497
- name: Rg.StopSound,
5501
+ var t_ = {
5502
+ name: Bg.StopSound,
5498
5503
  description: "Stop a playing sound by ID",
5499
5504
  returnType: { kind: "boolean" },
5500
5505
  parameters: [{
@@ -5503,51 +5508,51 @@ var Qg = {
5503
5508
  description: "Playback ID from playSound"
5504
5509
  }]
5505
5510
  };
5506
- function $g(e) {
5511
+ function n_(e) {
5507
5512
  if (typeof e != "string") return !1;
5508
- let t = J.get(e);
5513
+ let t = Hg.get(e);
5509
5514
  if (!t) return !1;
5510
5515
  try {
5511
- return t.pause(), t.currentTime = 0, J.delete(e), !0;
5516
+ return t.pause(), t.currentTime = 0, Hg.delete(e), !0;
5512
5517
  } catch {
5513
5518
  return !1;
5514
5519
  }
5515
5520
  }
5516
- function e_() {
5517
- zg.clear();
5518
- for (let [e, t] of J) {
5521
+ function r_() {
5522
+ Vg.clear();
5523
+ for (let [e, t] of Hg) {
5519
5524
  try {
5520
5525
  t.pause(), t.currentTime = 0;
5521
5526
  } catch {}
5522
- J.delete(e);
5527
+ Hg.delete(e);
5523
5528
  }
5524
- Jg();
5529
+ Zg();
5525
5530
  }
5526
- var t_ = [{
5527
- definition: Xg,
5528
- handler: Zg
5531
+ var i_ = [{
5532
+ definition: $g,
5533
+ handler: e_
5529
5534
  }, {
5530
- definition: Qg,
5531
- handler: $g
5535
+ definition: t_,
5536
+ handler: n_
5532
5537
  }];
5533
- function n_(e) {
5534
- qg();
5535
- let t = t_.map(({ definition: t, handler: n }) => e.register(t, n));
5538
+ function a_(e) {
5539
+ Xg();
5540
+ let t = i_.map(({ definition: t, handler: n }) => e.register(t, n));
5536
5541
  return () => {
5537
- t.forEach((e) => e()), e_();
5542
+ t.forEach((e) => e()), r_();
5538
5543
  };
5539
5544
  }
5540
5545
  //#endregion
5541
5546
  //#region src/worker/viseme-worker.ts?worker
5542
- function r_(e) {
5543
- return new Worker("" + new URL("assets/viseme-worker-TOrhAq2M.js", import.meta.url).href, {
5547
+ function o_(e) {
5548
+ return new Worker("" + new URL("assets/viseme-worker-D0AKWUTO.js", import.meta.url).href, {
5544
5549
  type: "module",
5545
5550
  name: e?.name
5546
5551
  });
5547
5552
  }
5548
5553
  //#endregion
5549
5554
  //#region src/media/viseme-tracker.ts
5550
- var i_ = w("VisemeTracker"), a_ = he * 2, o_ = class e {
5555
+ var s_ = w("VisemeTracker"), c_ = ge * 2, l_ = class e {
5551
5556
  static MAX_WORKER_REBUILD_ATTEMPTS = 3;
5552
5557
  client;
5553
5558
  worker = null;
@@ -5567,16 +5572,16 @@ var i_ = w("VisemeTracker"), a_ = he * 2, o_ = class e {
5567
5572
  enable() {
5568
5573
  if (this.worker) return;
5569
5574
  if (typeof Worker > "u") {
5570
- i_.warn("Viseme worker unavailable (Workers not supported)");
5575
+ s_.warn("Viseme worker unavailable (Workers not supported)");
5571
5576
  return;
5572
5577
  }
5573
5578
  let t = this.client.createProtocolMessagePort({ opcodeGroupsMask: T.GROUP_AUDIO });
5574
5579
  if (!t) return;
5575
5580
  this.protocolPort = t;
5576
5581
  try {
5577
- this.worker = new r_();
5582
+ this.worker = new o_();
5578
5583
  } catch (e) {
5579
- i_.warn(`Failed to create viseme worker: ${e}`), this.protocolPort.close(), this.protocolPort = null;
5584
+ s_.warn(`Failed to create viseme worker: ${e}`), this.protocolPort.close(), this.protocolPort = null;
5580
5585
  return;
5581
5586
  }
5582
5587
  let n = this.worker;
@@ -5587,7 +5592,7 @@ var i_ = w("VisemeTracker"), a_ = he * 2, o_ = class e {
5587
5592
  t.lineno,
5588
5593
  t.colno
5589
5594
  ].filter((e) => e != null && String(e).length > 0);
5590
- i_.error(`Viseme worker failed: ${n.join(" ")}`.trim()), this.dispose(), this.workerRebuildAttempts < e.MAX_WORKER_REBUILD_ATTEMPTS ? (this.workerRebuildAttempts++, this.enable()) : i_.error("Viseme worker crashed repeatedly, giving up on rebuilds");
5595
+ s_.error(`Viseme worker failed: ${n.join(" ")}`.trim()), this.dispose(), this.workerRebuildAttempts < e.MAX_WORKER_REBUILD_ATTEMPTS ? (this.workerRebuildAttempts++, this.enable()) : s_.error("Viseme worker crashed repeatedly, giving up on rebuilds");
5591
5596
  }), n.postMessage({
5592
5597
  type: "attachProtocolPort",
5593
5598
  port: t.port
@@ -5642,9 +5647,9 @@ var i_ = w("VisemeTracker"), a_ = he * 2, o_ = class e {
5642
5647
  if (!t.timingEstablished || t.count === 0) continue;
5643
5648
  let n = e - t.playbackStartTime;
5644
5649
  if (n < 0) continue;
5645
- let r = n * a_, i = t.frames, a = t.count, o = (t.head - a + ge) % ge, s = null, c = null;
5650
+ let r = n * c_, i = t.frames, a = t.count, o = (t.head - a + S) % S, s = null, c = null;
5646
5651
  for (let e = 0; e < a; e++) {
5647
- let t = i[(o + e) % ge], n = t.samplePosition + Math.max(t.frameSamples, 1);
5652
+ let t = i[(o + e) % S], n = t.samplePosition + Math.max(t.frameSamples, 1);
5648
5653
  if (t.samplePosition <= r && (s = t), n > r && !c && (c = t, t.samplePosition <= r)) break;
5649
5654
  }
5650
5655
  if (!s || r > s.samplePosition + Math.max(s.frameSamples, 1) && !c) continue;
@@ -5668,8 +5673,8 @@ var i_ = w("VisemeTracker"), a_ = he * 2, o_ = class e {
5668
5673
  if (e.type === "streamBegin") {
5669
5674
  if (this.streamShapeSets.has(e.streamId)) return;
5670
5675
  if (e.shapeSets && e.shapeSets.length > 0 && (this.streamShapeSets.set(e.streamId, e.shapeSets), this.currentShapeSetValues.set(e.streamId, /* @__PURE__ */ new Map()), e.shapeSets.some((e) => e.Name === "Viseme"))) {
5671
- let t = Array(ge);
5672
- for (let e = 0; e < ge; e++) t[e] = {
5676
+ let t = Array(S);
5677
+ for (let e = 0; e < S; e++) t[e] = {
5673
5678
  samplePosition: 0,
5674
5679
  frameSamples: 0,
5675
5680
  mouthOpenY: 0,
@@ -5712,39 +5717,39 @@ var i_ = w("VisemeTracker"), a_ = he * 2, o_ = class e {
5712
5717
  }
5713
5718
  if (r > 0) {
5714
5719
  let e = o.frames[o.head];
5715
- e.samplePosition = n - o.epochTimestampSamples, e.frameSamples = r, e.mouthOpenY = c.Values[0], e.mouthForm = c.Values[1], o.head = (o.head + 1) % ge, o.count < 1500 && o.count++;
5720
+ e.samplePosition = n - o.epochTimestampSamples, e.frameSamples = r, e.mouthOpenY = c.Values[0], e.mouthForm = c.Values[1], o.head = (o.head + 1) % S, o.count < 1500 && o.count++;
5716
5721
  }
5717
5722
  }
5718
5723
  }
5719
- }, s_ = w("DebugMode"), X = !1;
5720
- function c_() {
5721
- return X ? !0 : (X = Fu(), X && (ve(C.DEBUG), s_.info("Debug mode enabled")), X);
5724
+ }, u_ = w("DebugMode"), X = !1;
5725
+ function d_() {
5726
+ return X ? !0 : (X = Iu(), X && (ve(C.DEBUG), u_.info("Debug mode enabled")), X);
5722
5727
  }
5723
- function l_() {
5728
+ function f_() {
5724
5729
  return X;
5725
5730
  }
5726
- function u_() {
5727
- X || (X = !0, ve(C.DEBUG), s_.info("Debug mode enabled"), Au(hu, "true"));
5731
+ function p_() {
5732
+ X || (X = !0, ve(C.DEBUG), u_.info("Debug mode enabled"), ju(gu, "true"));
5728
5733
  }
5729
5734
  //#endregion
5730
5735
  //#region src/utils/inspect-mode.ts
5731
- var d_ = "ikon-inspect-mode-changed", f_ = !1;
5732
- function p_() {
5733
- typeof window < "u" && window.dispatchEvent(new Event(d_));
5736
+ var m_ = "ikon-inspect-mode-changed", h_ = !1;
5737
+ function g_() {
5738
+ typeof window < "u" && window.dispatchEvent(new Event(m_));
5734
5739
  }
5735
- function m_() {
5736
- let e = Uu();
5737
- return e !== f_ && (f_ = e, p_()), f_;
5740
+ function __() {
5741
+ let e = Wu();
5742
+ return e !== h_ && (h_ = e, g_()), h_;
5738
5743
  }
5739
- function h_() {
5740
- return f_;
5744
+ function v_() {
5745
+ return h_;
5741
5746
  }
5742
- function g_() {
5743
- f_ || (f_ = !0, Au(Cu, "true"), p_());
5747
+ function y_() {
5748
+ h_ || (h_ = !0, ju(wu, "true"), g_());
5744
5749
  }
5745
5750
  //#endregion
5746
5751
  //#region src/utils/external-link.ts
5747
- var __ = /* @__PURE__ */ new Set([
5752
+ var b_ = /* @__PURE__ */ new Set([
5748
5753
  "http",
5749
5754
  "https",
5750
5755
  "file",
@@ -5761,12 +5766,12 @@ var __ = /* @__PURE__ */ new Set([
5761
5766
  "edge",
5762
5767
  "moz-extension",
5763
5768
  "safari-web-extension"
5764
- ]), v_ = /^([a-z][a-z0-9+.-]*):/i;
5765
- function y_(e) {
5766
- let t = v_.exec(e.trim());
5767
- return t ? !__.has(t[1].toLowerCase()) : !1;
5769
+ ]), x_ = /^([a-z][a-z0-9+.-]*):/i;
5770
+ function S_(e) {
5771
+ let t = x_.exec(e.trim());
5772
+ return t ? !b_.has(t[1].toLowerCase()) : !1;
5768
5773
  }
5769
- function b_(e) {
5774
+ function C_(e) {
5770
5775
  if (typeof document > "u") return;
5771
5776
  let t = document.createElement("iframe");
5772
5777
  t.setAttribute("aria-hidden", "true"), t.style.display = "none", document.body.appendChild(t);
@@ -5780,7 +5785,7 @@ function b_(e) {
5780
5785
  }
5781
5786
  //#endregion
5782
5787
  //#region src/utils/browser-support.ts
5783
- var x_ = [
5788
+ var w_ = [
5784
5789
  {
5785
5790
  name: "WebSocket",
5786
5791
  isPresent: () => typeof WebSocket < "u"
@@ -5802,9 +5807,9 @@ var x_ = [
5802
5807
  isPresent: () => typeof Promise < "u" && typeof Promise.allSettled == "function"
5803
5808
  }
5804
5809
  ];
5805
- function S_() {
5810
+ function T_() {
5806
5811
  let e = [];
5807
- for (let t of x_) {
5812
+ for (let t of w_) {
5808
5813
  let n;
5809
5814
  try {
5810
5815
  n = t.isPresent();
@@ -5820,22 +5825,22 @@ function S_() {
5820
5825
  }
5821
5826
  //#endregion
5822
5827
  //#region src/transport/transport-probe.ts
5823
- var C_ = w("TransportProbe"), w_ = 3e3;
5824
- async function T_(e, t, n) {
5825
- let r = n?.timeoutMs ?? w_, i = n?.signal;
5828
+ var E_ = w("TransportProbe"), D_ = 3e3;
5829
+ async function O_(e, t, n) {
5830
+ let r = n?.timeoutMs ?? D_, i = n?.signal;
5826
5831
  if (i?.aborted) return !1;
5827
5832
  let a = Date.now();
5828
5833
  try {
5829
- let n = E_(e) ? await O_(t, r, i) : await D_(t, r, i);
5830
- return C_.debug(`Probe ${x[e]} ${t}: ${n ? "reachable" : "unreachable"} in ${Date.now() - a}ms`), n;
5834
+ let n = k_(e) ? await j_(t, r, i) : await A_(t, r, i);
5835
+ return E_.debug(`Probe ${x[e]} ${t}: ${n ? "reachable" : "unreachable"} in ${Date.now() - a}ms`), n;
5831
5836
  } catch (n) {
5832
- return C_.debug(`Probe ${x[e]} ${t} failed after ${Date.now() - a}ms: ${n instanceof Error ? n.message : n}`), !1;
5837
+ return E_.debug(`Probe ${x[e]} ${t} failed after ${Date.now() - a}ms: ${n instanceof Error ? n.message : n}`), !1;
5833
5838
  }
5834
5839
  }
5835
- function E_(e) {
5840
+ function k_(e) {
5836
5841
  return e === x.WebTransport || e === x.WebTransportProxy;
5837
5842
  }
5838
- function D_(e, t, n) {
5843
+ function A_(e, t, n) {
5839
5844
  return typeof WebSocket > "u" ? Promise.resolve(!1) : new Promise((r) => {
5840
5845
  let i = new WebSocket(e), a = !1, o = (e) => {
5841
5846
  if (!a) {
@@ -5849,8 +5854,8 @@ function D_(e, t, n) {
5849
5854
  n?.addEventListener("abort", s, { once: !0 }), i.onopen = () => o(!0), i.onerror = () => o(!1), i.onclose = () => o(!1);
5850
5855
  });
5851
5856
  }
5852
- async function O_(e, t, n) {
5853
- if (!ed()) return !1;
5857
+ async function j_(e, t, n) {
5858
+ if (!td()) return !1;
5854
5859
  let r = new WebTransport(e), i;
5855
5860
  try {
5856
5861
  let e = new Promise((e, r) => {
@@ -5868,19 +5873,19 @@ async function O_(e, t, n) {
5868
5873
  }
5869
5874
  //#endregion
5870
5875
  //#region src/worker/protocol-worker.ts?worker
5871
- function k_(e) {
5872
- return new Worker("" + new URL("assets/protocol-worker-sC4mqNcM.js", import.meta.url).href, {
5876
+ function M_(e) {
5877
+ return new Worker("" + new URL("assets/protocol-worker-CrtCRqQw.js", import.meta.url).href, {
5873
5878
  type: "module",
5874
5879
  name: e?.name
5875
5880
  });
5876
5881
  }
5877
5882
  //#endregion
5878
5883
  //#region src/client/ikon-client.ts
5879
- var Z = w("IkonClient"), A_ = [1e4, 3e4];
5880
- function j_() {
5884
+ var Z = w("IkonClient"), N_ = [1e4, 3e4];
5885
+ function P_() {
5881
5886
  return typeof __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__ < "u" && __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__;
5882
5887
  }
5883
- var M_ = class {
5888
+ var F_ = class {
5884
5889
  channelManager = null;
5885
5890
  protocolWorker = null;
5886
5891
  preloadedWorker = null;
@@ -5905,10 +5910,11 @@ var M_ = class {
5905
5910
  connectionTimeoutMs;
5906
5911
  actionAckTimeoutMs;
5907
5912
  _pendingActionAcks = /* @__PURE__ */ new Map();
5913
+ _ackRttMs = null;
5908
5914
  _actionIdByCallId = /* @__PURE__ */ new Map();
5909
5915
  _pendingActionResults = /* @__PURE__ */ new Map();
5910
5916
  endpointSelector;
5911
- _webRtcReachability = new kd();
5917
+ _webRtcReachability = new Ad();
5912
5918
  _connectedEntrypoints = [];
5913
5919
  _revalidationDone = !1;
5914
5920
  _isUnloading = !1;
@@ -5950,6 +5956,7 @@ var M_ = class {
5950
5956
  _webRtcAudioStreams = /* @__PURE__ */ new Map();
5951
5957
  _webRtcVideoStreams = /* @__PURE__ */ new Map();
5952
5958
  _webRtcTrackMap = /* @__PURE__ */ new Map();
5959
+ _webRtcTrackMapListeners = /* @__PURE__ */ new Set();
5953
5960
  _pendingActiveAudioTracks = /* @__PURE__ */ new Set();
5954
5961
  _keepaliveLockAbort = null;
5955
5962
  _fullReauthAttempted = !1;
@@ -5958,9 +5965,10 @@ var M_ = class {
5958
5965
  _reauthInProgress = !1;
5959
5966
  _disconnectedAt = null;
5960
5967
  _reconnectTimer = null;
5968
+ _joinWatchdogTimer = null;
5961
5969
  _serverStopped = !1;
5962
5970
  _hasBeenConnected = !1;
5963
- _waitForExternalConnectUrl = j_();
5971
+ _waitForExternalConnectUrl = P_();
5964
5972
  _externalConnectUrlCleanup = null;
5965
5973
  get media() {
5966
5974
  return this._media;
@@ -5977,10 +5985,10 @@ var M_ = class {
5977
5985
  return this._mediaCapture;
5978
5986
  }
5979
5987
  async ensureMediaCapture() {
5980
- return this._mediaCapture ? this._mediaCapture : Em() ? (this._mediaCapturePromise ||= Promise.resolve().then(() => fv).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture)), this._mediaCapturePromise) : null;
5988
+ return this._mediaCapture ? this._mediaCapture : U() ? (this._mediaCapturePromise ||= Promise.resolve().then(() => hv).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture)), this._mediaCapturePromise) : null;
5981
5989
  }
5982
5990
  async ensureMedia() {
5983
- 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);
5991
+ return this._media ? this._media : (this._mediaPromise ||= import("./ikon-media-DFsofNyM.js").then((e) => e.n).then(({ IkonMedia: e }) => (this._media = new e(this, this._mediaConfig), this._media)), this._mediaPromise);
5984
5992
  }
5985
5993
  get isAudioEnabled() {
5986
5994
  return this._audioEnabled;
@@ -5989,7 +5997,7 @@ var M_ = class {
5989
5997
  return this._videoEnabled;
5990
5998
  }
5991
5999
  get isWebRtcEnabled() {
5992
- return (Vu() ?? this.config.webRtc?.enabled ?? !0) && (this._audioEnabled || this._videoEnabled);
6000
+ return (Hu() ?? this.config.webRtc?.enabled ?? !0) && (this._audioEnabled || this._videoEnabled);
5993
6001
  }
5994
6002
  get isWebRtcMediaActive() {
5995
6003
  return this.isWebRtcEnabled && !this._webRtcFallbackActive;
@@ -6004,6 +6012,15 @@ var M_ = class {
6004
6012
  return this._webRtcTrackMap;
6005
6013
  }
6006
6014
  onWebRtcTrackMapChanged;
6015
+ addWebRtcTrackMapListener(e) {
6016
+ return this._webRtcTrackMapListeners.add(e), () => {
6017
+ this._webRtcTrackMapListeners.delete(e);
6018
+ };
6019
+ }
6020
+ notifyWebRtcTrackMapChanged(e) {
6021
+ this.onWebRtcTrackMapChanged?.(e);
6022
+ for (let t of [...this._webRtcTrackMapListeners]) t(e);
6023
+ }
6007
6024
  getWebRtcVideoStreamByStreamId(e) {
6008
6025
  for (let t of this._webRtcTrackMap.values()) if (t.kind === "video" && t.streamId === e && t.active) {
6009
6026
  let e = this._webRtcVideoStreams.get(t.trackIndex);
@@ -6023,15 +6040,15 @@ var M_ = class {
6023
6040
  ].filter(Boolean).length;
6024
6041
  if (t === 0) throw Error("IkonClient requires one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
6025
6042
  if (t > 1) throw Error("IkonClient accepts only one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
6026
- c_(), Em() && hp();
6027
- let n = e.proxy === !0 ? "proxy" : e.proxy === !1 ? "direct" : e.proxy ?? null, r = e.local ? null : Mu() ?? n, i = r === "proxy" ? "force-proxy" : r === "direct" ? "force-direct" : r === "lb" ? "force-lb" : "auto", a = e.local ? null : Nu(), o = e.local ? null : Pu(), s = a ?? e.websocket, c = o ?? e.webtransport ?? !1;
6028
- this.endpointSelector = new qd({
6043
+ d_(), U() && vp();
6044
+ let n = e.proxy === !0 ? "proxy" : e.proxy === !1 ? "direct" : e.proxy ?? null, r = e.local ? null : Nu() ?? n, i = r === "proxy" ? "force-proxy" : r === "direct" ? "force-direct" : r === "lb" ? "force-lb" : "auto", a = e.local ? null : Pu(), o = e.local ? null : Fu(), s = a ?? e.websocket, c = o ?? e.webtransport ?? !1;
6045
+ this.endpointSelector = new Xd({
6029
6046
  local: e.local,
6030
6047
  proxyMode: i,
6031
6048
  websocket: s,
6032
6049
  webtransport: c
6033
- }), i === "auto" ? this.endpointSelector.proxyPreferred && Z.debug("Proxy preferred (from previous session)") : Z.debug(`Proxy mode: ${i}`), (s !== void 0 || c !== void 0) && Z.debug(`Transport filter: websocket=${s ?? "auto"}, webtransport=${c ?? "auto"}`), this._functionRegistry = new vg(), this._reactiveRegistry = new Cg(this._functionRegistry), Em() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = Tm(this._functionRegistry), this.unregisterSoundFunctions = n_(this._functionRegistry)), Em() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(Dg));
6034
- let l = zu(), u = Bu();
6050
+ }), i === "auto" ? this.endpointSelector.proxyPreferred && Z.debug("Proxy preferred (from previous session)") : Z.debug(`Proxy mode: ${i}`), (s !== void 0 || c !== void 0) && Z.debug(`Transport filter: websocket=${s ?? "auto"}, webtransport=${c ?? "auto"}`), this._functionRegistry = new bg(), this._reactiveRegistry = new Tg(this._functionRegistry), U() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = Om(this._functionRegistry), this.unregisterSoundFunctions = a_(this._functionRegistry)), U() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(kg));
6051
+ let l = Bu(), u = Vu();
6035
6052
  this._audioEnabled = l ?? e.audio?.enabled ?? !0, this._videoEnabled = u ?? e.video?.enabled ?? !0;
6036
6053
  let d = e.audio ? {
6037
6054
  performance: e.audio.performance,
@@ -6042,7 +6059,7 @@ var M_ = class {
6042
6059
  audio: d,
6043
6060
  video: f,
6044
6061
  mediaSession: e.mediaSession
6045
- }, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, Em() && (this.unregisterMediaCaptureFunctions = Lg(this._functionRegistry, this));
6062
+ }, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, U() && (this.unregisterMediaCaptureFunctions = zg(this._functionRegistry, this));
6046
6063
  }
6047
6064
  _lastError = void 0;
6048
6065
  get lastError() {
@@ -6095,15 +6112,15 @@ var M_ = class {
6095
6112
  async connect() {
6096
6113
  if (this._connectStarted) throw Error(`Cannot connect: already started (state: ${this.currentState})`);
6097
6114
  this._connectStarted = !0;
6098
- let e = S_();
6115
+ let e = T_();
6099
6116
  if (!e.supported) {
6100
- this.setErrorState(new uu(e.missingFeatures));
6117
+ this.setErrorState(new du(e.missingFeatures));
6101
6118
  return;
6102
6119
  }
6103
6120
  this.setupLifecycleHandlers();
6104
- let t = Ru() ?? Lu();
6121
+ let t = zu() ?? Ru();
6105
6122
  if (t) {
6106
- Z.info("Found external connect URL in query parameter"), await this.executeConnection(() => Jh(t, this.abortController.signal));
6123
+ Z.info("Found external connect URL in query parameter"), await this.executeConnection(() => Xh(t, this.abortController.signal));
6107
6124
  return;
6108
6125
  }
6109
6126
  if (this._waitForExternalConnectUrl) {
@@ -6114,21 +6131,21 @@ var M_ = class {
6114
6131
  }
6115
6132
  async executeConnection(e) {
6116
6133
  if (this._lastError = void 0, this.abortController = new AbortController(), typeof Worker < "u" && !this.preloadedWorker) try {
6117
- this.preloadedWorker = new k_();
6134
+ this.preloadedWorker = new M_();
6118
6135
  } catch {}
6119
6136
  this.setState("connecting"), this.connectionTimer = setTimeout(() => {
6120
6137
  this.currentState === "connecting" && (Z.error("Connection timeout"), this.abortController?.abort("Connection timeout"), this.setState("offline"), this.config.onError?.(/* @__PURE__ */ Error("Connection timeout")));
6121
6138
  }, this.connectionTimeoutMs);
6122
6139
  try {
6123
6140
  let t = await e();
6124
- 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 && oh(t.backendUrl, t.authToken), this.probeFasterConnectTiers(t), await this.connectProtocol(this.authResponse.Entrypoints);
6141
+ 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 && ch(t.backendUrl, t.authToken), this.probeFasterConnectTiers(t), await this.connectProtocol(this.authResponse.Entrypoints);
6125
6142
  } catch (e) {
6126
6143
  if (e instanceof DOMException && e.name === "AbortError") return;
6127
6144
  throw Z.error("Connection failed:", e), this.clearTimers(), this.setState("offline"), this.config.onError?.(e instanceof Error ? e : Error(String(e))), e;
6128
6145
  }
6129
6146
  }
6130
6147
  disconnect() {
6131
- Z.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), ch(), 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;
6148
+ Z.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), uh(), 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;
6132
6149
  for (let e of this._webRtcAudioElements.values()) e.pause(), e.srcObject = null, e.remove();
6133
6150
  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");
6134
6151
  }
@@ -6162,21 +6179,43 @@ var M_ = class {
6162
6179
  }
6163
6180
  return this._actionIdByCallId.set(a, e), a;
6164
6181
  }
6182
+ getActionAckTimeoutMs() {
6183
+ if (this._ackRttMs === null) return this.actionAckTimeoutMs;
6184
+ let e = Math.round(this._ackRttMs * 3);
6185
+ return Math.min(Pd, Math.max(this.actionAckTimeoutMs, e));
6186
+ }
6187
+ recordAckRtt(e) {
6188
+ !Number.isFinite(e) || e < 0 || (this._ackRttMs = this._ackRttMs === null ? e : this._ackRttMs * (1 - Nd) + e * Nd);
6189
+ }
6165
6190
  trackPendingActionAck(e) {
6166
- if (this.currentState !== "connected") return;
6167
- let t = setTimeout(() => {
6168
- this._pendingActionAcks.delete(e), this.onActionAckTimeout(e);
6169
- }, this.actionAckTimeoutMs);
6170
- this._pendingActionAcks.set(e, t);
6171
- }
6172
- onActionAckTimeout(e) {
6173
- this.currentState === "connected" && (Z.warn(`No ActionCallAck received within ${this.actionAckTimeoutMs}ms for CallId ${e}, forcing reconnect`), this.clearPendingActionAcks(), this.protocolWorker ? this.protocolWorker.postMessage({
6174
- type: "triggerReconnect",
6175
- reason: "Action ack timeout"
6176
- }) : this.channelManager?.triggerReconnect("Action ack timeout"));
6191
+ this.currentState === "connected" && this.armActionAckTimer(e, this.getActionAckTimeoutMs(), Date.now(), !1);
6192
+ }
6193
+ armActionAckTimer(e, t, n, r) {
6194
+ let i = Math.max(0, t - (Date.now() - n)), a = setTimeout(() => {
6195
+ this._pendingActionAcks.delete(e), this.onActionAckTimeout(e, t, n, r);
6196
+ }, i);
6197
+ this._pendingActionAcks.set(e, {
6198
+ timer: a,
6199
+ sentAt: n
6200
+ });
6201
+ }
6202
+ onActionAckTimeout(e, t, n, r) {
6203
+ if (this.currentState === "connected") {
6204
+ if (!r) {
6205
+ let r = Math.min(Pd, t * 2);
6206
+ if (r > t) {
6207
+ Z.debug(`No ActionCallAck within ${t}ms for CallId ${e}, waiting up to ${r}ms before reconnecting`), this.armActionAckTimer(e, r, n, !0);
6208
+ return;
6209
+ }
6210
+ }
6211
+ Z.warn(`No ActionCallAck received within ${t}ms for CallId ${e}, forcing reconnect`), this.clearPendingActionAcks(), this.protocolWorker ? this.protocolWorker.postMessage({
6212
+ type: "triggerReconnect",
6213
+ reason: "Action ack timeout"
6214
+ }) : this.channelManager?.triggerReconnect("Action ack timeout");
6215
+ }
6177
6216
  }
6178
6217
  clearPendingActionAcks() {
6179
- for (let e of this._pendingActionAcks.values()) clearTimeout(e);
6218
+ for (let e of this._pendingActionAcks.values()) clearTimeout(e.timer);
6180
6219
  this._pendingActionAcks.clear(), this._actionIdByCallId.clear();
6181
6220
  for (let e of this._pendingActionResults.values()) clearTimeout(e.timer), e.reject(/* @__PURE__ */ Error("Connection reset before the action result arrived"));
6182
6221
  this._pendingActionResults.clear();
@@ -6339,10 +6378,10 @@ var M_ = class {
6339
6378
  }
6340
6379
  async authenticate() {
6341
6380
  let e = this.abortController?.signal;
6342
- if (this.config.local) return rg(this.config.local, e);
6381
+ if (this.config.local) return ag(this.config.local, e);
6343
6382
  let t = this.endpointSelector.proxyMode, n = this.endpointSelector.connectTier, r;
6344
- if (this.config.apiKey) r = await ig(this.config.apiKey, e, t, n);
6345
- else if (this.config.sessionToken) r = await ag(this.config.sessionToken, e, t, n);
6383
+ if (this.config.apiKey) r = await og(this.config.apiKey, e, t, n);
6384
+ else if (this.config.sessionToken) r = await sg(this.config.sessionToken, e, t, n);
6346
6385
  else throw Error("No connection configuration provided (need local, apiKey, or sessionToken)");
6347
6386
  return r.connectTier && t === "auto" && this.endpointSelector.recordWorkingConnectTier(r.connectTier), r;
6348
6387
  }
@@ -6352,7 +6391,7 @@ var M_ = class {
6352
6391
  for (let n of this.endpointSelector.getFasterConnectTiers(t)) {
6353
6392
  let t = e.connectTierUrls?.[n];
6354
6393
  if (t) try {
6355
- if (await Yh(t)) {
6394
+ if (await Zh(t)) {
6356
6395
  Z.debug(`Background probe: the ${n} tier is reachable, stepping up to it for the next connection`), this.endpointSelector.recordReachableConnectTier(n);
6357
6396
  return;
6358
6397
  }
@@ -6370,7 +6409,7 @@ var M_ = class {
6370
6409
  if (t === T.ACTION_CALL_ACK) {
6371
6410
  He(e).then((e) => {
6372
6411
  let t = e.CallId.toString(), n = this._pendingActionAcks.get(t);
6373
- n !== void 0 && (clearTimeout(n), this._pendingActionAcks.delete(t));
6412
+ n !== void 0 && (clearTimeout(n.timer), this._pendingActionAcks.delete(t), this.recordAckRtt(Date.now() - n.sentAt));
6374
6413
  }).catch((e) => {
6375
6414
  Z.warn("Failed to parse ActionCallAck:", e);
6376
6415
  });
@@ -6391,7 +6430,7 @@ var M_ = class {
6391
6430
  return;
6392
6431
  }
6393
6432
  if (t === T.CORE_GLOBAL_STATE && zo(e).then((e) => {
6394
- 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 && u_(), l_() && this.protocolWorker && (this.protocolWorker.postMessage({
6433
+ 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 && p_(), f_() && this.protocolWorker && (this.protocolWorker.postMessage({
6395
6434
  type: "enableDevtools",
6396
6435
  enabled: !0
6397
6436
  }), this.protocolWorker.postMessage({
@@ -6467,7 +6506,7 @@ var M_ = class {
6467
6506
  try {
6468
6507
  switch (e) {
6469
6508
  case "connected":
6470
- this.clearTimers(), this.setState("connected"), this._channelsConnected = !0, this._hasBeenConnected = !0, this.acquireKeepaliveLock(), this.tryHandleJoined(), this.revalidateEndpointPreference();
6509
+ this.clearTimers(), this.setState("connected"), this._channelsConnected = !0, this._hasBeenConnected = !0, this.acquireKeepaliveLock(), this.tryHandleJoined(), this.armJoinWatchdog(), this.revalidateEndpointPreference();
6471
6510
  break;
6472
6511
  case "reconnecting":
6473
6512
  this.currentState === "connected" && (this._channelsConnected = !1, this._globalStateReceived = !1, this._joinedHandled = !1, this._functionRegistry.detach(), this._reactiveRegistry.detach(), this.releaseKeepaliveLock(), this.setState("reconnecting"));
@@ -6478,7 +6517,7 @@ var M_ = class {
6478
6517
  break;
6479
6518
  case "offline":
6480
6519
  if (this._reauthInProgress) break;
6481
- if (this._hasBeenConnected && !this._serverStopped && M()) {
6520
+ if (this._hasBeenConnected && !this._serverStopped && j()) {
6482
6521
  this.currentState === "connected" && (this._channelsConnected = !1, this._globalStateReceived = !1, this._joinedHandled = !1, this._functionRegistry.detach(), this._reactiveRegistry.detach(), this.releaseKeepaliveLock(), this.setState("reconnecting")), this.attemptReconnect();
6483
6522
  break;
6484
6523
  }
@@ -6494,7 +6533,7 @@ var M_ = class {
6494
6533
  }
6495
6534
  setState(e) {
6496
6535
  if (!this._isUnloading) {
6497
- if (e === "offline" && this._hasBeenConnected && !this._serverStopped && M()) {
6536
+ if (e === "offline" && this._hasBeenConnected && !this._serverStopped && j()) {
6498
6537
  Z.error("Refusing to set offline state from connected session — scheduling reconnect retry instead. This is a bug; investigate the call site."), this.setState("reconnecting"), this.scheduleReconnectRetry();
6499
6538
  return;
6500
6539
  }
@@ -6529,7 +6568,7 @@ var M_ = class {
6529
6568
  let n;
6530
6569
  if (this.preloadedWorker) n = this.preloadedWorker, this.preloadedWorker = null;
6531
6570
  else try {
6532
- n = new k_();
6571
+ n = new M_();
6533
6572
  } catch (n) {
6534
6573
  Z.warn(`Failed to create protocol worker, falling back to main thread: ${n}`), await this.connectProtocolOnMainThread(e, t);
6535
6574
  return;
@@ -6554,7 +6593,7 @@ var M_ = class {
6554
6593
  return;
6555
6594
  }
6556
6595
  if (o?.type === "refreshEntrypoints") {
6557
- this._connectUrl ? Jh(this._connectUrl, this.abortController?.signal).then((e) => {
6596
+ this._connectUrl ? Xh(this._connectUrl, this.abortController?.signal).then((e) => {
6558
6597
  this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, n.postMessage({
6559
6598
  type: "refreshedEntrypoints",
6560
6599
  entrypoints: e.authResponse.Entrypoints,
@@ -6583,16 +6622,16 @@ var M_ = class {
6583
6622
  a(), t(Error(`Protocol worker failed: ${n.join(" ")}`.trim()));
6584
6623
  }), i = setTimeout(() => {
6585
6624
  r || (i = void 0, t(/* @__PURE__ */ Error("Protocol worker connect timed out")));
6586
- }, jd);
6625
+ }, Md);
6587
6626
  }), i = this.computeOrderedEndpointTypes(e), a = this.getServerKeepaliveTimeoutMs(), o = this.config.timeouts?.reconnectBackoffMs ?? 2e3, s = this.config.timeouts?.maxReconnectAttempts ?? 2;
6588
- this.updateWorkerInterestMask(), l_() && (n.postMessage({
6627
+ this.updateWorkerInterestMask(), f_() && (n.postMessage({
6589
6628
  type: "enableDevtools",
6590
6629
  enabled: !0
6591
6630
  }), n.postMessage({
6592
6631
  type: "setLogLevel",
6593
6632
  level: Se()
6594
- })), m_();
6595
- let c = Vu() ?? this.config.webRtc?.enabled ?? !0;
6633
+ })), __();
6634
+ let c = Hu() ?? this.config.webRtc?.enabled ?? !0;
6596
6635
  n.postMessage({
6597
6636
  type: "connect",
6598
6637
  sessionId: this._sessionId,
@@ -6619,7 +6658,7 @@ var M_ = class {
6619
6658
  }
6620
6659
  ensureVisemeTracker() {
6621
6660
  if (!this._visemeTracker) try {
6622
- this._visemeTracker = new o_(this), this._visemeTracker.enable();
6661
+ this._visemeTracker = new l_(this), this._visemeTracker.enable();
6623
6662
  } catch (e) {
6624
6663
  Z.warn(`Viseme tracker setup failed: ${e}`), this._visemeTracker = null;
6625
6664
  }
@@ -6643,7 +6682,7 @@ var M_ = class {
6643
6682
  useVideoTrack: this._videoEnabled,
6644
6683
  useDataChannel: !0,
6645
6684
  iceServers: this.config.webRtc?.iceServers,
6646
- iceTransportPolicy: Hu() ?? this.config.webRtc?.iceTransportPolicy ?? this._webRtcReachability.iceTransportPolicy,
6685
+ iceTransportPolicy: Uu() ?? this.config.webRtc?.iceTransportPolicy ?? this._webRtcReachability.iceTransportPolicy,
6647
6686
  shouldAttemptWithoutIceServers: () => this._webRtcReachability.shouldAttemptWithoutIceServers || this._webRtcRetryCount > 0,
6648
6687
  onStateChange: (e) => {
6649
6688
  e === "connected" ? (this.clearWebRtcConnectWatchdog(), this._webRtcRetryCount = 0, this.rememberWebRtcReachability(), this._media?.audio.setWebRtcActive(!0), this._media?.video.setWebRtcActive(!0)) : e === "failed" && this.fallbackToCustomPlayback(`webrtc connection ${e}`);
@@ -6667,15 +6706,15 @@ var M_ = class {
6667
6706
  sourceType: e.SourceType,
6668
6707
  active: e.Active
6669
6708
  }, n = `${e.Kind}:${e.TrackIndex}`;
6670
- if (e.Active ? this._webRtcTrackMap.set(n, t) : this._webRtcTrackMap.delete(n), this.onWebRtcTrackMapChanged?.(t), e.Kind === "audio" && this._audioEnabled) if (e.Active) {
6709
+ if (e.Active ? this._webRtcTrackMap.set(n, t) : this._webRtcTrackMap.delete(n), this.notifyWebRtcTrackMapChanged(t), e.Kind === "audio" && this._audioEnabled) if (e.Active) {
6671
6710
  let t = this._webRtcAudioStreams.get(e.TrackIndex);
6672
6711
  t ? this.createWebRtcAudioElement(e.TrackIndex, t) : this._pendingActiveAudioTracks.add(e.TrackIndex);
6673
6712
  } else this._pendingActiveAudioTracks.delete(e.TrackIndex), this.destroyWebRtcAudioElement(e.TrackIndex);
6674
6713
  }
6675
6714
  };
6676
- this._webRtcFallbackActive = !1, this._webRtcSignaling = new Td(t), this.clearWebRtcConnectWatchdog(), this._webRtcConnectWatchdog = setTimeout(() => {
6715
+ this._webRtcFallbackActive = !1, this._webRtcSignaling = new Ed(t), this.clearWebRtcConnectWatchdog(), this._webRtcConnectWatchdog = setTimeout(() => {
6677
6716
  this._webRtcSignaling?.state !== "connected" && this.fallbackToCustomPlayback("webrtc connection timed out");
6678
- }, vd);
6717
+ }, yd);
6679
6718
  try {
6680
6719
  await this._webRtcSignaling.connect((e) => {
6681
6720
  this.sendProtocolMessage(e);
@@ -6687,7 +6726,7 @@ var M_ = class {
6687
6726
  async rememberWebRtcReachability() {
6688
6727
  let e = this._webRtcSignaling?.peerConnection;
6689
6728
  if (!e) return;
6690
- let t = await Ad(e);
6729
+ let t = await jd(e);
6691
6730
  t !== null && this._webRtcReachability.recordConnected(t);
6692
6731
  }
6693
6732
  clearWebRtcConnectWatchdog() {
@@ -6697,9 +6736,9 @@ var M_ = class {
6697
6736
  this._webRtcRetryTimer &&= (clearTimeout(this._webRtcRetryTimer), null);
6698
6737
  }
6699
6738
  scheduleWebRtcRetry() {
6700
- if (this._webRtcRetryTimer || this._webRtcRetryCount >= A_.length) return;
6701
- let e = A_[this._webRtcRetryCount++];
6702
- Z.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${A_.length})`), this._webRtcRetryTimer = setTimeout(() => {
6739
+ if (this._webRtcRetryTimer || this._webRtcRetryCount >= N_.length) return;
6740
+ let e = N_[this._webRtcRetryCount++];
6741
+ Z.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${N_.length})`), this._webRtcRetryTimer = setTimeout(() => {
6703
6742
  this._webRtcRetryTimer = null, !(this.currentState !== "connected" || this._webRtcSignaling || !this.isWebRtcEnabled) && this.setupWebRtcSignaling();
6704
6743
  }, e);
6705
6744
  }
@@ -6709,14 +6748,14 @@ var M_ = class {
6709
6748
  this.teardownWebRtcPlayback();
6710
6749
  return;
6711
6750
  }
6712
- this._webRtcSignaling?.peerConnection != null && this._webRtcReachability.recordFailed(), this._webRtcFallbackActive = !0, Z.warn(`WebRTC unavailable, falling back to custom playback: ${e}`), this._webRtcSignaling?.notifyServerClose(), this.teardownWebRtcPlayback(), this._media?.audio.setWebRtcActive(!1), this._media?.video.setWebRtcActive(!1), this.enableCustomPlayback(), this.scheduleWebRtcRetry();
6751
+ this._webRtcSignaling?.peerConnection != null && this.currentState === "connected" && this._webRtcReachability.recordFailed(), this._webRtcFallbackActive = !0, Z.warn(`WebRTC unavailable, falling back to custom playback: ${e}`), this._webRtcSignaling?.notifyServerClose(), this.teardownWebRtcPlayback(), this._media?.audio.setWebRtcActive(!1), this._media?.video.setWebRtcActive(!1), this.enableCustomPlayback(), this.scheduleWebRtcRetry();
6713
6752
  }
6714
6753
  }
6715
6754
  teardownWebRtcPlayback() {
6716
6755
  this.clearWebRtcConnectWatchdog(), this.clearWebRtcRetry(), this._webRtcSignaling &&= (this._webRtcSignaling.disconnect(), null), this._mediaCapture?.audio.handleWebRtcTransportLost();
6717
6756
  for (let e of [...this._webRtcAudioElements.keys()]) this.destroyWebRtcAudioElement(e);
6718
6757
  this._webRtcAudioStreams.clear(), this._webRtcVideoStreams.clear(), this._pendingActiveAudioTracks.clear();
6719
- for (let e of this._webRtcTrackMap.values()) e.active && this.onWebRtcTrackMapChanged?.({
6758
+ for (let e of this._webRtcTrackMap.values()) e.active && this.notifyWebRtcTrackMapChanged({
6720
6759
  ...e,
6721
6760
  active: !1
6722
6761
  });
@@ -6831,8 +6870,8 @@ var M_ = class {
6831
6870
  }
6832
6871
  async connectProtocolOnMainThread(e, t = !1) {
6833
6872
  this.workerManagerState = null, this.protocolWorker = null;
6834
- let n = Vu() ?? this.config.webRtc?.enabled ?? !0;
6835
- Z.debug(`Connecting on main thread (webRtcEnabled=${n}, entrypoints=${e.length})`), this.channelManager = new ad({
6873
+ let n = Hu() ?? this.config.webRtc?.enabled ?? !0;
6874
+ Z.debug(`Connecting on main thread (webRtcEnabled=${n}, entrypoints=${e.length})`), this.channelManager = new od({
6836
6875
  sessionId: this._sessionId,
6837
6876
  keepaliveTimeoutMs: this.getServerKeepaliveTimeoutMs(),
6838
6877
  reconnectBackoffMs: this.config.timeouts?.reconnectBackoffMs ?? 2e3,
@@ -6849,7 +6888,7 @@ var M_ = class {
6849
6888
  this.config.onError?.(e);
6850
6889
  },
6851
6890
  onRefreshEntrypoints: this._connectUrl ? async () => {
6852
- let e = await Jh(this._connectUrl, this.abortController?.signal);
6891
+ let e = await Xh(this._connectUrl, this.abortController?.signal);
6853
6892
  return this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, {
6854
6893
  entrypoints: e.authResponse.Entrypoints,
6855
6894
  sessionId: this._sessionId
@@ -6891,7 +6930,7 @@ var M_ = class {
6891
6930
  let n = this.groupEntrypointsByType(this._connectedEntrypoints), r = this.abortController?.signal;
6892
6931
  for (let e of t) {
6893
6932
  let t = n.get(e)?.[0]?.Uri;
6894
- if (!(t === void 0 || r?.aborted) && await T_(e, t, { signal: r })) {
6933
+ if (!(t === void 0 || r?.aborted) && await O_(e, t, { signal: r })) {
6895
6934
  this.endpointSelector.recordFasterTypeReachable(e);
6896
6935
  return;
6897
6936
  }
@@ -6957,13 +6996,13 @@ var M_ = class {
6957
6996
  }
6958
6997
  }
6959
6998
  attemptReconnect() {
6960
- if (!M()) {
6999
+ if (!j()) {
6961
7000
  Z.warn("Retry disabled via ikon-retry=false, going offline"), this.clearTimers(), this.setState("offline");
6962
7001
  return;
6963
7002
  }
6964
7003
  if (this._reauthInProgress) return;
6965
7004
  this.clearReconnectTimer();
6966
- let e = this._disconnectedAt === null ? Infinity : Date.now() - this._disconnectedAt, t = e > Md;
7005
+ let e = this._disconnectedAt === null ? Infinity : Date.now() - this._disconnectedAt, t = e > Fd;
6967
7006
  if (Z.debug(`Reconnect decision: disconnected ${e === Infinity ? "?" : Math.round(e / 1e3)}s, softExpired=${t}, softAttempted=${this._softReconnectAttempted}, fullAttempted=${this._fullReauthAttempted}, authRejected=${this._lastFailureWasAuthRejected}`), this._lastFailureWasAuthRejected) Z.info("Skipping soft reconnect — last failure was auth-rejected, going straight to full re-auth"), this._lastFailureWasAuthRejected = !1, this._softReconnectAttempted = !0;
6968
7007
  else if (!t && !this._softReconnectAttempted && !this._fullReauthAttempted && this.authResponse) {
6969
7008
  Z.info("Attempting soft reconnect with cached entrypoints"), this._softReconnectAttempted = !0, this._channelsConnected = !1, this._globalStateReceived = !1, this._joinedHandled = !1, this.disconnectProtocol(), this.connectProtocol(this.authResponse.Entrypoints, !0);
@@ -6984,13 +7023,13 @@ var M_ = class {
6984
7023
  this.attemptFullReauth();
6985
7024
  }
6986
7025
  scheduleReconnectRetry() {
6987
- if (!M()) {
7026
+ if (!j()) {
6988
7027
  Z.warn("Retry disabled via ikon-retry=false, going offline instead of scheduling retry"), this.clearTimers(), this.setState("offline");
6989
7028
  return;
6990
7029
  }
6991
7030
  this.clearReconnectTimer(), Z.info("Scheduling reconnect retry in 10 seconds"), this._reconnectTimer = setTimeout(() => {
6992
7031
  this._reconnectTimer = null, this.attemptReconnect();
6993
- }, Nd);
7032
+ }, Id);
6994
7033
  }
6995
7034
  clearReconnectTimer() {
6996
7035
  this._reconnectTimer &&= (clearTimeout(this._reconnectTimer), null);
@@ -7008,7 +7047,7 @@ var M_ = class {
7008
7047
  }) : this.channelManager?.triggerReconnect("Browser offline event"));
7009
7048
  }
7010
7049
  clearTimers() {
7011
- this.connectionTimer &&= (clearTimeout(this.connectionTimer), null), this.clearReconnectTimer();
7050
+ this.connectionTimer &&= (clearTimeout(this.connectionTimer), null), this.clearReconnectTimer(), this.clearJoinWatchdog();
7012
7051
  }
7013
7052
  setupLifecycleHandlers() {
7014
7053
  typeof window > "u" || (this.boundBeforeUnload = () => this.handleBeforeUnload(), window.addEventListener("beforeunload", this.boundBeforeUnload), this.boundPageHide = (e) => this.handlePageHide(e), window.addEventListener("pagehide", this.boundPageHide), this.boundVisibilityChange = () => this.handleVisibilityChange(), document.addEventListener("visibilitychange", this.boundVisibilityChange), this.boundPopstate = () => this.handlePopstate(), window.addEventListener("popstate", this.boundPopstate), this.boundOnline = () => this.attemptReconnectOnVisible(), window.addEventListener("online", this.boundOnline), this.boundOffline = () => this.handleBrowserOffline(), window.addEventListener("offline", this.boundOffline), this.boundAnchorClick = (e) => this.handleAnchorClick(e), document.addEventListener("click", this.boundAnchorClick, !0));
@@ -7021,8 +7060,8 @@ var M_ = class {
7021
7060
  let t = e.target?.closest?.("a[href]");
7022
7061
  if (!t || t.target && t.target !== "_self") return;
7023
7062
  let n = t.getAttribute("href") ?? "";
7024
- if (y_(n)) {
7025
- e.preventDefault(), b_(n);
7063
+ if (S_(n)) {
7064
+ e.preventDefault(), C_(n);
7026
7065
  return;
7027
7066
  }
7028
7067
  let r = this.resolveInPlaceDestination(t, n);
@@ -7041,7 +7080,7 @@ var M_ = class {
7041
7080
  } catch {
7042
7081
  return null;
7043
7082
  }
7044
- return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search || ip(n.pathname) ? null : n;
7083
+ return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search || sp(n.pathname) ? null : n;
7045
7084
  }
7046
7085
  sendDisconnectSignal() {
7047
7086
  if (this._sessionId !== void 0 && this.currentState === "connected") try {
@@ -7089,7 +7128,15 @@ var M_ = class {
7089
7128
  this.channelManager && this.currentState === "connected" && this.channelManager.managerState !== "connected" && (Z.warn("Connection lost while page was backgrounded, reconnecting..."), this.setState("reconnecting"));
7090
7129
  }
7091
7130
  tryHandleJoined() {
7092
- this._joinedHandled || !this._channelsConnected || !this._globalStateReceived || (this._joinedHandled = !0, this._fullReauthAttempted = !1, this._softReconnectAttempted = !1, this._lastFailureWasAuthRejected = !1, this.handleJoined());
7131
+ this._joinedHandled || !this._channelsConnected || !this._globalStateReceived || (this.clearJoinWatchdog(), this._joinedHandled = !0, this._fullReauthAttempted = !1, this._softReconnectAttempted = !1, this._lastFailureWasAuthRejected = !1, this.handleJoined());
7132
+ }
7133
+ armJoinWatchdog() {
7134
+ this._joinedHandled || this._joinWatchdogTimer !== null || (this._joinWatchdogTimer = setTimeout(() => {
7135
+ this._joinWatchdogTimer = null, !(this._joinedHandled || this.currentState !== "connected") && (Z.warn(`Channels connected but the session never finished joining within ${Ld}ms, reconnecting`), this.setState("reconnecting"), this.attemptReconnect());
7136
+ }, Ld));
7137
+ }
7138
+ clearJoinWatchdog() {
7139
+ this._joinWatchdogTimer !== null && (clearTimeout(this._joinWatchdogTimer), this._joinWatchdogTimer = null);
7093
7140
  }
7094
7141
  async handleJoined() {
7095
7142
  try {
@@ -7117,14 +7164,14 @@ var M_ = class {
7117
7164
  });
7118
7165
  }, 150);
7119
7166
  }), window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
7120
- this.sendUpdateClientContext({ theme: pp() });
7167
+ this.sendUpdateClientContext({ theme: gp() });
7121
7168
  });
7122
7169
  }
7123
7170
  setupExternalConnectUrlListener() {
7124
7171
  let e = (e) => {
7125
7172
  e.data?.type === "IKON_EXTERNAL_CONNECT_URL" && typeof e.data.serverUrl == "string" && (Z.info("Received external connect URL from parent window"), this.handleExternalConnectUrl(e.data.serverUrl).catch((e) => {
7126
7173
  if (!(e instanceof DOMException && e.name === "AbortError")) {
7127
- if (this._hasBeenConnected && M()) {
7174
+ if (this._hasBeenConnected && j()) {
7128
7175
  Z.warn("External connect URL connection failed, scheduling retry:", e), this.scheduleReconnectRetry();
7129
7176
  return;
7130
7177
  }
@@ -7143,12 +7190,12 @@ var M_ = class {
7143
7190
  if (this.currentState !== "waitingForExternalConnectUrl") throw Error(`Cannot connect with external connect URL: already in state ${this.currentState}`);
7144
7191
  Z.info("Connecting with external connect URL");
7145
7192
  try {
7146
- await this.executeConnection(() => Jh(e, this.abortController.signal));
7193
+ await this.executeConnection(() => Xh(e, this.abortController.signal));
7147
7194
  } finally {
7148
7195
  this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null);
7149
7196
  }
7150
7197
  }
7151
- }, N_ = class {
7198
+ }, I_ = class {
7152
7199
  client;
7153
7200
  constructor(e) {
7154
7201
  this.client = e;
@@ -7166,54 +7213,54 @@ var M_ = class {
7166
7213
  }, { close: () => n.close() }) : { close: () => {} };
7167
7214
  }
7168
7215
  };
7169
- function P_(e) {
7170
- return new N_(e);
7216
+ function L_(e) {
7217
+ return new I_(e);
7171
7218
  }
7172
7219
  //#endregion
7173
7220
  //#region src/client/connection-state.ts
7174
- function F_(e) {
7221
+ function R_(e) {
7175
7222
  return e === "waitingForExternalConnectUrl" || e === "connecting" || e === "connectingSlow" || e === "reconnecting";
7176
7223
  }
7177
- function I_(e) {
7224
+ function z_(e) {
7178
7225
  return e === "connected";
7179
7226
  }
7180
- function L_(e) {
7227
+ function B_(e) {
7181
7228
  return e === "offline" || e === "offlineError";
7182
7229
  }
7183
- function R_(e) {
7230
+ function V_(e) {
7184
7231
  return e === "offlineError";
7185
7232
  }
7186
7233
  //#endregion
7187
7234
  //#region src/utils/opcode-names.ts
7188
- var z_ = /* @__PURE__ */ new Map();
7189
- for (let [e, t] of Object.entries(T)) typeof t == "number" && z_.set(t, e);
7190
- function B_(e) {
7191
- return z_.get(e) ?? `UNKNOWN_${e}`;
7235
+ var H_ = /* @__PURE__ */ new Map();
7236
+ for (let [e, t] of Object.entries(T)) typeof t == "number" && H_.set(t, e);
7237
+ function U_(e) {
7238
+ return H_.get(e) ?? `UNKNOWN_${e}`;
7192
7239
  }
7193
7240
  //#endregion
7194
7241
  //#region src/login/reprovision.ts
7195
- var V_ = "ikon-login-app-route";
7196
- function H_(e) {
7242
+ var W_ = "ikon-login-app-route";
7243
+ function G_(e) {
7197
7244
  if (typeof window > "u") return;
7198
7245
  try {
7199
- sessionStorage.setItem(V_, window.location.pathname);
7246
+ sessionStorage.setItem(W_, window.location.pathname);
7200
7247
  } catch {}
7201
7248
  let t = new URL(window.location.href);
7202
- t.searchParams.set(_u, e), window.location.href = t.toString();
7249
+ t.searchParams.set(vu, e), window.location.href = t.toString();
7203
7250
  }
7204
- function U_() {
7251
+ function K_() {
7205
7252
  let e = null;
7206
7253
  try {
7207
- e = sessionStorage.getItem(V_), sessionStorage.removeItem(V_);
7254
+ e = sessionStorage.getItem(W_), sessionStorage.removeItem(W_);
7208
7255
  } catch {}
7209
7256
  return {
7210
7257
  appRoute: e,
7211
- pendingCall: rf()
7258
+ pendingCall: sf()
7212
7259
  };
7213
7260
  }
7214
7261
  //#endregion
7215
7262
  //#region src/media/ring-buffer.ts
7216
- var W_ = class {
7263
+ var q_ = class {
7217
7264
  static getStorageForCapacity(e, t) {
7218
7265
  let n = Int32Array.BYTES_PER_ELEMENT * 2, r = t.BYTES_PER_ELEMENT * e;
7219
7266
  return new SharedArrayBuffer(n + r);
@@ -7264,7 +7311,7 @@ var W_ = class {
7264
7311
  };
7265
7312
  //#endregion
7266
7313
  //#region src/worker/audio-capture-worker.ts?worker
7267
- function G_(e) {
7314
+ function J_(e) {
7268
7315
  return new Worker("" + new URL("assets/audio-capture-worker-CJ5S-nQt.js", import.meta.url).href, {
7269
7316
  type: "module",
7270
7317
  name: e?.name
@@ -7272,11 +7319,11 @@ function G_(e) {
7272
7319
  }
7273
7320
  //#endregion
7274
7321
  //#region src/media/ikon-audio-capture.ts
7275
- var Q = w("IkonAudioCapture"), K_ = 3, q_ = 200, J_ = 2e3, Y_ = 5e3, X_ = 3e3;
7276
- function Z_(e) {
7322
+ var Q = w("IkonAudioCapture"), Y_ = 3, X_ = 200, Z_ = 2e3, Q_ = 5e3, $_ = 3e3;
7323
+ function ev(e) {
7277
7324
  return new Promise((t) => setTimeout(t, e));
7278
7325
  }
7279
- function Q_(e) {
7326
+ function tv(e) {
7280
7327
  switch (e.name) {
7281
7328
  case "NotReadableError": return {
7282
7329
  action: "retry",
@@ -7312,14 +7359,14 @@ function Q_(e) {
7312
7359
  };
7313
7360
  }
7314
7361
  }
7315
- function $_() {
7362
+ function nv() {
7316
7363
  let e = globalThis.crypto;
7317
7364
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
7318
7365
  }
7319
- function ev() {
7366
+ function rv() {
7320
7367
  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";
7321
7368
  }
7322
- var tv = class e {
7369
+ var iv = class e {
7323
7370
  client;
7324
7371
  static RESUME_TIMEOUT_MS = 3e3;
7325
7372
  worker = null;
@@ -7380,7 +7427,7 @@ var tv = class e {
7380
7427
  notifyError(e, t, n, r) {
7381
7428
  if (e.stopped) return;
7382
7429
  let i = Date.now(), a = t.name;
7383
- if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < Y_) return;
7430
+ if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < Q_) return;
7384
7431
  e.lastErrorTime = i, e.lastErrorReason = n, e.lastErrorName = a;
7385
7432
  let o = this.config.autoRestartPolicy;
7386
7433
  if (o?.enabled && r) {
@@ -7438,7 +7485,7 @@ var tv = class e {
7438
7485
  if (e.ctx.state === "running") return !0;
7439
7486
  if (e.ctx.state !== "suspended") return !1;
7440
7487
  let r = Date.now();
7441
- if (!n && r - e.lastResumeAttemptTime < X_) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
7488
+ if (!n && r - e.lastResumeAttemptTime < $_) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
7442
7489
  e.lastResumeAttemptTime = r, this.emitDiagnostic({
7443
7490
  event: "resume-attempt",
7444
7491
  captureId: e.captureId,
@@ -7474,7 +7521,7 @@ var tv = class e {
7474
7521
  attemptResume(e, t, n = !1) {
7475
7522
  if (e.stopped || e.ctx.state !== "suspended") return;
7476
7523
  let r = Date.now();
7477
- if (!n && r - e.lastResumeAttemptTime < X_) {
7524
+ if (!n && r - e.lastResumeAttemptTime < $_) {
7478
7525
  Q.debug(`Resume attempt from ${t} skipped (cooldown)`);
7479
7526
  return;
7480
7527
  }
@@ -7573,7 +7620,7 @@ var tv = class e {
7573
7620
  }
7574
7621
  ensureWorker() {
7575
7622
  if (this.worker) return this.worker;
7576
- let e = new G_();
7623
+ let e = new J_();
7577
7624
  return this.worker = e, e.addEventListener("message", (e) => {
7578
7625
  let t = e.data;
7579
7626
  if (t?.type === "error") {
@@ -7671,25 +7718,25 @@ var tv = class e {
7671
7718
  reason: "unknown",
7672
7719
  canRetry: !1
7673
7720
  };
7674
- for (let r = 0; r < K_; r++) try {
7721
+ for (let r = 0; r < Y_; r++) try {
7675
7722
  return {
7676
7723
  stream: await navigator.mediaDevices.getUserMedia({ audio: e }),
7677
7724
  error: t,
7678
7725
  errorInfo: n
7679
7726
  };
7680
7727
  } catch (e) {
7681
- if (t = e instanceof Error ? e : Error(String(e)), n = Q_(t), Q.debug(`getUserMedia attempt ${r + 1}/${K_} failed: ${t.name} (action: ${n.action})`), this.emitDiagnostic({
7728
+ if (t = e instanceof Error ? e : Error(String(e)), n = tv(t), Q.debug(`getUserMedia attempt ${r + 1}/${Y_} failed: ${t.name} (action: ${n.action})`), this.emitDiagnostic({
7682
7729
  event: "retry",
7683
7730
  details: {
7684
7731
  attempt: r + 1,
7685
- maxAttempts: K_,
7732
+ maxAttempts: Y_,
7686
7733
  errorName: t.name,
7687
7734
  action: n.action
7688
7735
  }
7689
7736
  }), n.action !== "retry") break;
7690
7737
  if (r < 2) {
7691
- let e = q_ * (r + 1);
7692
- Q.debug(`Retrying getUserMedia in ${e}ms`), await Z_(e);
7738
+ let e = X_ * (r + 1);
7739
+ Q.debug(`Retrying getUserMedia in ${e}ms`), await ev(e);
7693
7740
  }
7694
7741
  }
7695
7742
  return {
@@ -7700,7 +7747,7 @@ var tv = class e {
7700
7747
  }
7701
7748
  async ensureWorklet(e) {
7702
7749
  if (!we(e)) throw Error("AudioWorklet is not supported in this browser");
7703
- if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([ev()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
7750
+ if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([rv()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
7704
7751
  await this.workletReady;
7705
7752
  return;
7706
7753
  } catch {
@@ -7727,7 +7774,7 @@ var tv = class e {
7727
7774
  if (!t) throw Error("Cannot start audio capture before client is connected");
7728
7775
  if (this.client.isWebRtcCaptureAvailable) return this.startMicWebRtc(e);
7729
7776
  this.client.isWebRtcEnabled && Q.warn("WebRTC unavailable, capturing audio via protocol channel");
7730
- let n = $_(), r = {
7777
+ let n = nv(), r = {
7731
7778
  captureId: n,
7732
7779
  aborted: !1,
7733
7780
  stream: null,
@@ -7765,7 +7812,7 @@ var tv = class e {
7765
7812
  let f = xe() ? "sab" : "pcm", p;
7766
7813
  if (f === "sab") {
7767
7814
  let e = Math.floor(a.sampleRate * 10);
7768
- p = W_.getStorageForCapacity(e, Float32Array);
7815
+ p = q_.getStorageForCapacity(e, Float32Array);
7769
7816
  }
7770
7817
  let m = this.ensureWorker(), h = e.onStopped;
7771
7818
  m.postMessage({
@@ -7913,7 +7960,7 @@ var tv = class e {
7913
7960
  };
7914
7961
  this.setupAudioContextStateListener(a, _), this.setupVisibilityChangeListener(_), this.setupBFCacheHandlers(_), _.healthCheckTimer = setInterval(() => {
7915
7962
  this.performHealthCheck(_);
7916
- }, J_);
7963
+ }, Z_);
7917
7964
  let te = () => {
7918
7965
  _.stopped || (Q.warn(`Microphone track ended unexpectedly, captureId=${n.substring(0, 8)}`), this.handleRecoverableError(_, /* @__PURE__ */ Error("Microphone track ended unexpectedly"), "track-ended"));
7919
7966
  };
@@ -8062,8 +8109,8 @@ var tv = class e {
8062
8109
  let t = this.captures.get(e);
8063
8110
  return !t || t.stopped ? !1 : this.attemptResumeAsync(t, "userGesture", !0);
8064
8111
  }
8065
- }, nv = 3e3;
8066
- function rv(e, t, n, r) {
8112
+ }, av = 3e3;
8113
+ function ov(e, t, n, r) {
8067
8114
  if (!n && !r) return {
8068
8115
  width: e,
8069
8116
  height: t
@@ -8074,7 +8121,7 @@ function rv(e, t, n, r) {
8074
8121
  height: Math.max(1, Math.floor(t * o))
8075
8122
  };
8076
8123
  }
8077
- async function iv(e, t) {
8124
+ async function sv(e, t) {
8078
8125
  let n = t.mime ?? "image/jpeg", r = t.quality ?? .92;
8079
8126
  if (typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas) try {
8080
8127
  return await e.convertToBlob({
@@ -8089,7 +8136,7 @@ async function iv(e, t) {
8089
8136
  }, n, r);
8090
8137
  });
8091
8138
  }
8092
- var av = class {
8139
+ var cv = class {
8093
8140
  async captureFromStream(e, t = {}) {
8094
8141
  let n = e.getVideoTracks()[0];
8095
8142
  if (!n) throw Error("No video track available in the provided stream");
@@ -8100,7 +8147,7 @@ var av = class {
8100
8147
  } catch {}
8101
8148
  try {
8102
8149
  await new Promise((e, t) => {
8103
- let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), nv);
8150
+ let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), av);
8104
8151
  r.addEventListener("loadedmetadata", () => {
8105
8152
  clearTimeout(n), e();
8106
8153
  }, { once: !0 }), r.addEventListener("error", () => {
@@ -8110,7 +8157,7 @@ var av = class {
8110
8157
  try {
8111
8158
  await r.play();
8112
8159
  } catch {}
8113
- let { width: e, height: i } = rv(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
8160
+ let { width: e, height: i } = ov(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
8114
8161
  if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(e, i);
8115
8162
  else {
8116
8163
  let t = document.createElement("canvas");
@@ -8119,7 +8166,7 @@ var av = class {
8119
8166
  let o = a.getContext("2d", { alpha: !1 });
8120
8167
  if (!o) throw Error("2D canvas context unavailable");
8121
8168
  o.drawImage(r, 0, 0, e, i);
8122
- let s = await iv(a, t), c = await s.arrayBuffer();
8169
+ let s = await sv(a, t), c = await s.arrayBuffer();
8123
8170
  return {
8124
8171
  mime: s.type || t.mime || "image/jpeg",
8125
8172
  width: e,
@@ -8160,7 +8207,7 @@ var av = class {
8160
8207
  } catch {}
8161
8208
  try {
8162
8209
  await new Promise((e, t) => {
8163
- let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), nv);
8210
+ let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), av);
8164
8211
  r.addEventListener("loadedmetadata", () => {
8165
8212
  clearTimeout(n), e();
8166
8213
  }, { once: !0 }), r.addEventListener("error", () => {
@@ -8170,7 +8217,7 @@ var av = class {
8170
8217
  try {
8171
8218
  await r.play();
8172
8219
  } catch {}
8173
- let { width: t, height: i } = rv(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
8220
+ let { width: t, height: i } = ov(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
8174
8221
  if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(t, i);
8175
8222
  else {
8176
8223
  let e = document.createElement("canvas");
@@ -8179,7 +8226,7 @@ var av = class {
8179
8226
  let o = a.getContext("2d", { alpha: !1 });
8180
8227
  if (!o) throw Error("2D canvas context unavailable");
8181
8228
  o.drawImage(r, 0, 0, t, i);
8182
- let s = await iv(a, e), c = await s.arrayBuffer();
8229
+ let s = await sv(a, e), c = await s.arrayBuffer();
8183
8230
  return {
8184
8231
  mime: s.type || e.mime || "image/jpeg",
8185
8232
  width: t,
@@ -8203,11 +8250,11 @@ var av = class {
8203
8250
  }
8204
8251
  async captureFromNativeCamera(e = {}) {
8205
8252
  if (typeof document > "u") throw Error("Native camera capture requires a DOM environment");
8206
- let t = await ov(e.facing);
8207
- return t ? await sv(t, e) : null;
8253
+ let t = await lv(e.facing);
8254
+ return t ? await uv(t, e) : null;
8208
8255
  }
8209
8256
  };
8210
- function ov(e) {
8257
+ function lv(e) {
8211
8258
  return new Promise((t) => {
8212
8259
  let n = document.createElement("input");
8213
8260
  n.type = "file", n.accept = "image/*", n.setAttribute("capture", e ?? "environment"), n.style.position = "fixed", n.style.left = "-99999px", n.style.top = "0";
@@ -8233,7 +8280,7 @@ function ov(e) {
8233
8280
  n.click();
8234
8281
  });
8235
8282
  }
8236
- async function sv(e, t) {
8283
+ async function uv(e, t) {
8237
8284
  let n = URL.createObjectURL(e), r;
8238
8285
  try {
8239
8286
  r = await new Promise((e, t) => {
@@ -8243,7 +8290,7 @@ async function sv(e, t) {
8243
8290
  } finally {
8244
8291
  URL.revokeObjectURL(n);
8245
8292
  }
8246
- let i = r.naturalWidth || r.width, a = r.naturalHeight || r.height, { width: o, height: s } = rv(i, a, t.width, t.height), c = t.mime ?? (e.type === "image/png" ? "image/png" : "image/jpeg"), l = t.quality ?? .92;
8293
+ let i = r.naturalWidth || r.width, a = r.naturalHeight || r.height, { width: o, height: s } = ov(i, a, t.width, t.height), c = t.mime ?? (e.type === "image/png" ? "image/png" : "image/jpeg"), l = t.quality ?? .92;
8247
8294
  if (o === i && s === a && e.type === c) {
8248
8295
  let t = await e.arrayBuffer();
8249
8296
  return {
@@ -8270,8 +8317,8 @@ async function sv(e, t) {
8270
8317
  }
8271
8318
  //#endregion
8272
8319
  //#region src/worker/video-capture-worker.ts?worker
8273
- function cv(e) {
8274
- return new Worker("" + new URL("assets/video-capture-worker-D5jsT6I4.js", import.meta.url).href, {
8320
+ function dv(e) {
8321
+ return new Worker("" + new URL("assets/video-capture-worker-mvwKyjOn.js", import.meta.url).href, {
8275
8322
  type: "module",
8276
8323
  name: e?.name
8277
8324
  });
@@ -8279,16 +8326,16 @@ function cv(e) {
8279
8326
  //#endregion
8280
8327
  //#region src/media/ikon-video-capture.ts
8281
8328
  var $ = w("IkonVideoCapture");
8282
- function lv() {
8329
+ function fv() {
8283
8330
  let e = globalThis.crypto;
8284
8331
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
8285
8332
  }
8286
- function uv() {
8333
+ function pv() {
8287
8334
  let e = globalThis.MediaStreamTrackProcessor;
8288
8335
  if (!e) throw Error("MediaStreamTrackProcessor is not available in this browser");
8289
8336
  return e;
8290
8337
  }
8291
- var dv = class {
8338
+ var mv = class {
8292
8339
  client;
8293
8340
  worker = null;
8294
8341
  protocolPort = null;
@@ -8304,7 +8351,7 @@ var dv = class {
8304
8351
  }
8305
8352
  ensureWorker() {
8306
8353
  if (this.worker) return this.worker;
8307
- let e = new cv();
8354
+ let e = new dv();
8308
8355
  return this.worker = e, e.addEventListener("message", (e) => {
8309
8356
  let t = e.data;
8310
8357
  if (t?.type === "error") {
@@ -8414,10 +8461,10 @@ var dv = class {
8414
8461
  if (this.client.isWebRtcCaptureAvailable && e.sourceType === "camera") return this.startCameraWebRtc(e);
8415
8462
  if (this.client.isWebRtcCaptureAvailable && e.sourceType === "screen") return this.startScreenWebRtc(e);
8416
8463
  this.client.isWebRtcEnabled && $.warn("WebRTC unavailable, capturing video via protocol channel"), this.ensurePorts();
8417
- let n = lv(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
8464
+ let n = fv(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
8418
8465
  if (!i) throw r.getTracks().forEach((e) => e.stop()), Error("No video track available");
8419
8466
  e.sourceType === "screen" && await new Promise((e) => setTimeout(e, 200));
8420
- 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 (uv())({ track: i }).readable, l = this.allocateTrackId(), u = this.ensureWorker(), d = e.sourceType, f = e.onStopped;
8467
+ 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 (pv())({ track: i }).readable, l = this.allocateTrackId(), u = this.ensureWorker(), d = e.sourceType, f = e.onStopped;
8421
8468
  u.postMessage({
8422
8469
  type: "start",
8423
8470
  captureId: n,
@@ -8540,16 +8587,16 @@ var dv = class {
8540
8587
  }
8541
8588
  this.protocolPort?.close(), this.protocolPort = null, this.sendPort?.close(), this.sendPort = null;
8542
8589
  }
8543
- }, fv = /* @__PURE__ */ d({ IkonMediaCapture: () => pv }), pv = class {
8590
+ }, hv = /* @__PURE__ */ d({ IkonMediaCapture: () => gv }), gv = class {
8544
8591
  audio;
8545
8592
  video;
8546
8593
  image;
8547
8594
  constructor(e, t) {
8548
- this.audio = new tv(e, t?.audio), this.video = new dv(e), this.image = new av();
8595
+ this.audio = new iv(e, t?.audio), this.video = new mv(e), this.image = new cv();
8549
8596
  }
8550
8597
  dispose() {
8551
8598
  this.audio.dispose(), this.video.dispose();
8552
8599
  }
8553
8600
  };
8554
8601
  //#endregion
8555
- export { ou as AccessDeniedError, N_ as AppMessaging, k as AppStartupFailedError, O as AuthRejectedError, E as AuthenticationError, uu as BrowserNotSupportedError, R as CONNECT_TIER_LADDER, rd as Channel, ad as ChannelManager, v as ClientType, tu as ConnectionError, m as ContextType, qd as EndpointSelector, x as EntrypointType, pg as FunctionCallError, vg as FunctionRegistry, ff as IKON_AUTH_BASE_URL, df as IKON_AUTH_URL_DEV, uf as IKON_AUTH_URL_PROD, lf as IKON_BACKEND_URL_DEV, cf as IKON_BACKEND_URL_PROD, d_ as IKON_INSPECT_MODE_CHANGED_EVENT, yu as IKON_PARAM_AUDIO, Tu as IKON_PARAM_AUTH, vu as IKON_PARAM_CONNECT, hu as IKON_PARAM_DEBUG, wu as IKON_PARAM_DEBUG_OVERLAY, Cu as IKON_PARAM_INSPECT, gu as IKON_PARAM_LANG, fu as IKON_PARAM_PROXY, Eu as IKON_PARAM_RETRY, _u as IKON_PARAM_SERVER_URL, bu as IKON_PARAM_VIDEO, xu as IKON_PARAM_WEBRTC, pu as IKON_PARAM_WEBSOCKET, mu as IKON_PARAM_WEBTRANSPORT, tv as IkonAudioCapture, re as IkonAudioPlayback, M_ as IkonClient, av as IkonImageCapture, ue as IkonMedia, pv as IkonMediaCapture, dv as IkonVideoCapture, ce as IkonVideoPlayback, nu as KeepaliveTimeoutError, C as LogLevel, ru as MaxRetriesExceededError, T as Opcode, qf as PKCE_URL_PARAM, iu as ProvisioningTimeoutError, cu as ServerFullError, lu as ServerUnavailableError, su as SessionNotFoundError, au as SpaceNotFoundError, D as TransportError, p as UserType, o_ as VisemeTracker, ld as WEBRTC_AUDIO_BITRATE, cd as WEBRTC_AUDIO_CHANNELS, od as WEBRTC_AUDIO_CODEC, ud as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS, sd as WEBRTC_AUDIO_SAMPLE_RATE, hd as WEBRTC_BUNDLE_POLICY, xd as WEBRTC_DATA_CHANNEL_LABEL, Cd as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS, Sd as WEBRTC_DATA_CHANNEL_ORDERED, yd as WEBRTC_MAX_AUDIO_TRACKS, bd as WEBRTC_MAX_VIDEO_TRACKS, gd as WEBRTC_RTCP_MUX_POLICY, dd as WEBRTC_VIDEO_CODEC, fd as WEBRTC_VIDEO_MAX_BITRATE, pd as WEBRTC_VIDEO_MAX_FRAMERATE, wd as WebRTCConnection, Td as WebRTCSignaling, sf as abortSignalAny, B as abortSignalTimeout, tp as adoptPkceVerifierFromUrl, P_ as appMessaging, y as asProtocolMessage, S_ as checkBrowserSupport, Sh as clearDeviceId, Rm as clearLogBuffer, ef as clearLoginPrompt, U_ as consumeLoginHandoff, rf as consumeLoginPendingCall, w as createLogger, zf as createPkceChallenge, Ef as deriveAuthUrl, wf as deriveBackendType, Cf as deriveBackendUrl, Df as deriveCrossOriginAuthUrl, g_ as enableInspectMode, Ch as extractUserIdFromToken, Lm as flushLogs, zu as getAudioParam, Gu as getAuthSameOriginParam, Fm as getBufferedLogs, Ru as getConnectParam, mh as getConnectTraceId, Wu as getDebugOverlayParam, Fu as getDebugParam, Uu as getInspectParam, Iu as getLangParam, zm as getLogBufferSize, Se as getLogLevel, be as getLogSink, Qd as getLoginPromptState, B_ as getOpcodeName, xh as getOrCreateDeviceId, ju as getProxyParam, Mu as getProxyTierParam, M as getRetryParam, yf as getSameOriginAuthUrl, Lu as getServerUrlParam, Bu as getVideoParam, Vu as getWebRtcParam, Nu as getWebSocketParam, Pu as getWebTransportParam, c_ as initializeDebugMode, m_ as initializeInspectMode, Nm as initializeLogSink, we as isAudioWorkletSupported, Em as isBrowserEnvironment, V as isCloudEnvironment, I_ as isConnected, F_ as isConnecting, l_ as isDebugModeEnabled, Xf as isEmbedded, R_ as isError, h_ as isInspectModeEnabled, Og as isMobileBrowserLikely, L_ as isOffline, Rf as isPkceSupported, xe as isSharedArrayBufferSupported, ed as isWebTransportSupported, Dg as loginErrorInterceptor, ep as onEmbeddedOAuthResult, Fd as orderConnectTiers, Mf as parseUrlParams, yh as randomUuid, c as readOpcode, u as readOpcodeGroup, i as readProtocolMessageHeaders, Tm as registerBrowserFunctions, vh as reportConnectTimeline, H_ as reprovisionAfterLogin, Bf as restorePkceVerifier, ve as setLogLevel, _e as setLogSink, $d as setLoginPromptRequired, Au as setSdkUrlParam, Pm as setSendLogsCallback, Qf as startEmbeddedOAuthSignIn, oh as startLogSender, ch as stopLogSender, tf as subscribeLoginPrompt, me as subscribeToLogEvents, Im as takeBufferedLogs, Vf as takePkceVerifier, fg as withResultData };
8602
+ export { su as AccessDeniedError, I_ as AppMessaging, au as AppStartupFailedError, O as AuthRejectedError, E as AuthenticationError, du as BrowserNotSupportedError, L as CONNECT_TIER_LADDER, id as Channel, od as ChannelManager, v as ClientType, tu as ConnectionError, m as ContextType, Xd as EndpointSelector, x as EntrypointType, hg as FunctionCallError, bg as FunctionRegistry, hf as IKON_AUTH_BASE_URL, mf as IKON_AUTH_URL_DEV, pf as IKON_AUTH_URL_PROD, ff as IKON_BACKEND_URL_DEV, df as IKON_BACKEND_URL_PROD, m_ as IKON_INSPECT_MODE_CHANGED_EVENT, bu as IKON_PARAM_AUDIO, Eu as IKON_PARAM_AUTH, yu as IKON_PARAM_CONNECT, gu as IKON_PARAM_DEBUG, Tu as IKON_PARAM_DEBUG_OVERLAY, wu as IKON_PARAM_INSPECT, _u as IKON_PARAM_LANG, pu as IKON_PARAM_PROXY, Du as IKON_PARAM_RETRY, vu as IKON_PARAM_SERVER_URL, xu as IKON_PARAM_VIDEO, Su as IKON_PARAM_WEBRTC, mu as IKON_PARAM_WEBSOCKET, hu as IKON_PARAM_WEBTRANSPORT, iv as IkonAudioCapture, re as IkonAudioPlayback, F_ as IkonClient, cv as IkonImageCapture, ue as IkonMedia, gv as IkonMediaCapture, mv as IkonVideoCapture, ce as IkonVideoPlayback, nu as KeepaliveTimeoutError, C as LogLevel, ru as MaxRetriesExceededError, T as Opcode, Xf as PKCE_URL_PARAM, iu as ProvisioningTimeoutError, lu as ServerFullError, uu as ServerUnavailableError, cu as SessionNotFoundError, ou as SpaceNotFoundError, D as TransportError, p as UserType, l_ as VisemeTracker, ud as WEBRTC_AUDIO_BITRATE, ld as WEBRTC_AUDIO_CHANNELS, sd as WEBRTC_AUDIO_CODEC, dd as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS, cd as WEBRTC_AUDIO_SAMPLE_RATE, gd as WEBRTC_BUNDLE_POLICY, Sd as WEBRTC_DATA_CHANNEL_LABEL, wd as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS, Cd as WEBRTC_DATA_CHANNEL_ORDERED, bd as WEBRTC_MAX_AUDIO_TRACKS, xd as WEBRTC_MAX_VIDEO_TRACKS, _d as WEBRTC_RTCP_MUX_POLICY, fd as WEBRTC_VIDEO_CODEC, pd as WEBRTC_VIDEO_MAX_BITRATE, md as WEBRTC_VIDEO_MAX_FRAMERATE, Td as WebRTCConnection, Ed as WebRTCSignaling, uf as abortSignalAny, B as abortSignalTimeout, ip as adoptPkceVerifierFromUrl, L_ as appMessaging, y as asProtocolMessage, T_ as checkBrowserSupport, wh as clearDeviceId, Bm as clearLogBuffer, rf as clearLoginPrompt, K_ as consumeLoginHandoff, sf as consumeLoginPendingCall, w as createLogger, Hf as createPkceChallenge, kf as deriveAuthUrl, Df as deriveBackendType, Ef as deriveBackendUrl, Af as deriveCrossOriginAuthUrl, y_ as enableInspectMode, Th as extractUserIdFromToken, zm as flushLogs, Bu as getAudioParam, Ku as getAuthSameOriginParam, Lm as getBufferedLogs, zu as getConnectParam, gh as getConnectTraceId, Gu as getDebugOverlayParam, Iu as getDebugParam, Wu as getInspectParam, Lu as getLangParam, Vm as getLogBufferSize, Se as getLogLevel, be as getLogSink, tf as getLoginPromptState, U_ as getOpcodeName, Ch as getOrCreateDeviceId, Mu as getProxyParam, Nu as getProxyTierParam, j as getRetryParam, Sf as getSameOriginAuthUrl, Ru as getServerUrlParam, Vu as getVideoParam, Hu as getWebRtcParam, Pu as getWebSocketParam, Fu as getWebTransportParam, d_ as initializeDebugMode, __ as initializeInspectMode, Fm as initializeLogSink, we as isAudioWorkletSupported, U as isBrowserEnvironment, V as isCloudEnvironment, z_ as isConnected, R_ as isConnecting, f_ as isDebugModeEnabled, $f as isEmbedded, V_ as isError, v_ as isInspectModeEnabled, Ag as isMobileBrowserLikely, B_ as isOffline, Vf as isPkceSupported, xe as isSharedArrayBufferSupported, td as isWebTransportSupported, kg as loginErrorInterceptor, rp as onEmbeddedOAuthResult, zd as orderConnectTiers, Ff as parseUrlParams, xh as randomUuid, c as readOpcode, u as readOpcodeGroup, i as readProtocolMessageHeaders, Om as registerBrowserFunctions, bh as reportConnectTimeline, G_ as reprovisionAfterLogin, Uf as restorePkceVerifier, ve as setLogLevel, _e as setLogSink, nf as setLoginPromptRequired, ju as setSdkUrlParam, Im as setSendLogsCallback, tp as startEmbeddedOAuthSignIn, ch as startLogSender, uh as stopLogSender, af as subscribeLoginPrompt, he as subscribeToLogEvents, Rm as takeBufferedLogs, Wf as takePkceVerifier, mg as withResultData };