@ikonai/sdk 1.3.9 → 1.3.11
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/client/endpoint-selector.d.ts +66 -7
- package/client/ikon-client-config.d.ts +4 -3
- package/client/ikon-client.d.ts +12 -0
- package/connection/authenticator.d.ts +7 -3
- package/connection/urls.d.ts +10 -0
- package/index.d.ts +2 -2
- package/index.js +1058 -1011
- package/package.json +1 -1
- package/utils/query-params.d.ts +11 -1
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
|
|
2
|
-
import { _ as
|
|
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";
|
|
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 =
|
|
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;
|
|
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 =
|
|
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;
|
|
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 =
|
|
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;
|
|
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) => {
|
|
@@ -1844,64 +1844,68 @@ function ju() {
|
|
|
1844
1844
|
return j(fu);
|
|
1845
1845
|
}
|
|
1846
1846
|
function Mu() {
|
|
1847
|
-
|
|
1847
|
+
let e = A(fu);
|
|
1848
|
+
return e === "false" ? "direct" : e === "true" ? "proxy" : e === "lb" || e === "stream" ? "lb" : null;
|
|
1848
1849
|
}
|
|
1849
1850
|
function Nu() {
|
|
1850
|
-
return j(
|
|
1851
|
+
return j(pu);
|
|
1851
1852
|
}
|
|
1852
1853
|
function Pu() {
|
|
1853
|
-
return j(
|
|
1854
|
+
return j(mu);
|
|
1854
1855
|
}
|
|
1855
1856
|
function Fu() {
|
|
1856
|
-
return
|
|
1857
|
+
return j(hu) === !0;
|
|
1857
1858
|
}
|
|
1858
1859
|
function Iu() {
|
|
1859
|
-
return A(
|
|
1860
|
+
return A(gu);
|
|
1860
1861
|
}
|
|
1861
1862
|
function Lu() {
|
|
1863
|
+
return A(_u);
|
|
1864
|
+
}
|
|
1865
|
+
function Ru() {
|
|
1862
1866
|
let e = A(vu);
|
|
1863
1867
|
if (!e || typeof window > "u") return null;
|
|
1864
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;
|
|
1865
1869
|
return `${window.location.protocol}//${i}/connect?token=${encodeURIComponent(n)}`;
|
|
1866
1870
|
}
|
|
1867
|
-
function
|
|
1871
|
+
function zu() {
|
|
1868
1872
|
return j(yu);
|
|
1869
1873
|
}
|
|
1870
|
-
function
|
|
1874
|
+
function Bu() {
|
|
1871
1875
|
return j(bu);
|
|
1872
1876
|
}
|
|
1873
|
-
function
|
|
1877
|
+
function Vu() {
|
|
1874
1878
|
return j(xu);
|
|
1875
1879
|
}
|
|
1876
|
-
function
|
|
1880
|
+
function Hu() {
|
|
1877
1881
|
let e = A(Su);
|
|
1878
1882
|
return e === "relay" ? "relay" : e === "all" ? "all" : null;
|
|
1879
1883
|
}
|
|
1880
|
-
function
|
|
1884
|
+
function Uu() {
|
|
1881
1885
|
return j(Cu) === !0;
|
|
1882
1886
|
}
|
|
1883
|
-
function
|
|
1887
|
+
function Wu() {
|
|
1884
1888
|
return j(wu) === !0;
|
|
1885
1889
|
}
|
|
1886
|
-
function
|
|
1890
|
+
function Gu() {
|
|
1887
1891
|
let e = A(Tu);
|
|
1888
1892
|
return e === "true" || e === "same";
|
|
1889
1893
|
}
|
|
1890
1894
|
function M() {
|
|
1891
1895
|
return j(Eu) !== !1;
|
|
1892
1896
|
}
|
|
1893
|
-
function
|
|
1897
|
+
function Ku() {
|
|
1894
1898
|
return j(Du);
|
|
1895
1899
|
}
|
|
1896
|
-
function
|
|
1900
|
+
function qu() {
|
|
1897
1901
|
return j(Ou) === !0;
|
|
1898
1902
|
}
|
|
1899
|
-
function
|
|
1903
|
+
function Ju() {
|
|
1900
1904
|
return A(ku);
|
|
1901
1905
|
}
|
|
1902
1906
|
//#endregion
|
|
1903
1907
|
//#region src/transport/web-socket-transport.ts
|
|
1904
|
-
var N = w("WebSocketTransport"),
|
|
1908
|
+
var N = w("WebSocketTransport"), Yu = 1e4, Xu = class {
|
|
1905
1909
|
ws = null;
|
|
1906
1910
|
keepaliveTimeout = null;
|
|
1907
1911
|
isClosed = !1;
|
|
@@ -1912,7 +1916,7 @@ var N = w("WebSocketTransport"), Ju = 1e4, Yu = class {
|
|
|
1912
1916
|
callbacks;
|
|
1913
1917
|
sessionId;
|
|
1914
1918
|
constructor(e) {
|
|
1915
|
-
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ??
|
|
1919
|
+
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? Yu;
|
|
1916
1920
|
}
|
|
1917
1921
|
get isConnected() {
|
|
1918
1922
|
return this.ws?.readyState === WebSocket.OPEN;
|
|
@@ -1984,11 +1988,11 @@ var N = w("WebSocketTransport"), Ju = 1e4, Yu = class {
|
|
|
1984
1988
|
clearKeepaliveTimeout() {
|
|
1985
1989
|
this.keepaliveTimeout &&= (clearTimeout(this.keepaliveTimeout), null);
|
|
1986
1990
|
}
|
|
1987
|
-
}, P = w("WebTransportTransport"),
|
|
1988
|
-
function
|
|
1991
|
+
}, P = w("WebTransportTransport"), Zu = 1e4, Qu = 4, $u = 65536;
|
|
1992
|
+
function ed() {
|
|
1989
1993
|
return typeof WebTransport < "u";
|
|
1990
1994
|
}
|
|
1991
|
-
var
|
|
1995
|
+
var td = class {
|
|
1992
1996
|
transport = null;
|
|
1993
1997
|
stream = null;
|
|
1994
1998
|
reader = null;
|
|
@@ -1996,7 +2000,7 @@ var ed = class {
|
|
|
1996
2000
|
keepaliveTimeout = null;
|
|
1997
2001
|
readLoopActive = !1;
|
|
1998
2002
|
isClosed = !1;
|
|
1999
|
-
receiveBuffer = new Uint8Array(
|
|
2003
|
+
receiveBuffer = new Uint8Array($u);
|
|
2000
2004
|
receiveBufferOffset = 0;
|
|
2001
2005
|
receiveBufferLength = 0;
|
|
2002
2006
|
receiveDataView = null;
|
|
@@ -2009,13 +2013,13 @@ var ed = class {
|
|
|
2009
2013
|
callbacks;
|
|
2010
2014
|
sessionId;
|
|
2011
2015
|
constructor(e) {
|
|
2012
|
-
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ??
|
|
2016
|
+
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? Zu;
|
|
2013
2017
|
}
|
|
2014
2018
|
get isConnected() {
|
|
2015
2019
|
return this.transport !== null && this.writer !== null;
|
|
2016
2020
|
}
|
|
2017
2021
|
async connect(e, t) {
|
|
2018
|
-
if (
|
|
2022
|
+
if (!ed()) throw new D("WebTransport is not supported in this browser");
|
|
2019
2023
|
this.isClosed = !1;
|
|
2020
2024
|
let n = Date.now(), r = new Promise((e, t) => {
|
|
2021
2025
|
this.firstMessageResolver = e, this.firstMessageRejecter = t;
|
|
@@ -2096,9 +2100,9 @@ var ed = class {
|
|
|
2096
2100
|
}
|
|
2097
2101
|
processBufferedMessages() {
|
|
2098
2102
|
let e = this.getReceiveDataView();
|
|
2099
|
-
for (; this.receiveBufferLength >=
|
|
2103
|
+
for (; this.receiveBufferLength >= Qu;) {
|
|
2100
2104
|
let t = e.getUint32(this.receiveBufferOffset, !0);
|
|
2101
|
-
if (t <
|
|
2105
|
+
if (t < Qu) {
|
|
2102
2106
|
P.error(`Invalid message length: ${t}`), this.callbacks.onError(/* @__PURE__ */ Error(`Invalid protocol message length: ${t}`)), this.receiveBufferOffset = 0, this.receiveBufferLength = 0;
|
|
2103
2107
|
return;
|
|
2104
2108
|
}
|
|
@@ -2145,7 +2149,7 @@ var ed = class {
|
|
|
2145
2149
|
this.transport = null;
|
|
2146
2150
|
}
|
|
2147
2151
|
}
|
|
2148
|
-
},
|
|
2152
|
+
}, nd = w("Channel"), rd = class {
|
|
2149
2153
|
state = "disconnected";
|
|
2150
2154
|
transport = null;
|
|
2151
2155
|
config;
|
|
@@ -2185,7 +2189,7 @@ var ed = class {
|
|
|
2185
2189
|
}
|
|
2186
2190
|
send(e) {
|
|
2187
2191
|
if (!this.transport?.isConnected) {
|
|
2188
|
-
|
|
2192
|
+
nd.warn("Cannot send: channel not connected");
|
|
2189
2193
|
return;
|
|
2190
2194
|
}
|
|
2191
2195
|
this.transport.send(e);
|
|
@@ -2204,12 +2208,12 @@ var ed = class {
|
|
|
2204
2208
|
switch (e.Type) {
|
|
2205
2209
|
case x.WebSocket:
|
|
2206
2210
|
case x.WebSocketProxy:
|
|
2207
|
-
this.transport = new
|
|
2211
|
+
this.transport = new Xu(t);
|
|
2208
2212
|
break;
|
|
2209
2213
|
case x.WebTransport:
|
|
2210
2214
|
case x.WebTransportProxy:
|
|
2211
|
-
if (
|
|
2212
|
-
this.transport = new
|
|
2215
|
+
if (!ed()) throw Error("WebTransport is not supported in this browser");
|
|
2216
|
+
this.transport = new td(t);
|
|
2213
2217
|
break;
|
|
2214
2218
|
default: throw Error(`Unsupported entrypoint type: ${x[e.Type]}`);
|
|
2215
2219
|
}
|
|
@@ -2219,12 +2223,12 @@ var ed = class {
|
|
|
2219
2223
|
try {
|
|
2220
2224
|
let t = y(e);
|
|
2221
2225
|
if (c(t) === T.CORE_ON_SERVER_STOPPING) {
|
|
2222
|
-
|
|
2226
|
+
nd.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
|
|
2223
2227
|
return;
|
|
2224
2228
|
}
|
|
2225
2229
|
this.config.onProtocolMessage?.(t);
|
|
2226
2230
|
} catch (e) {
|
|
2227
|
-
|
|
2231
|
+
nd.error("Failed to handle protocol message:", e), this.config.onError?.(e instanceof Error ? e : Error(String(e)));
|
|
2228
2232
|
}
|
|
2229
2233
|
}
|
|
2230
2234
|
handleClose(e, t) {
|
|
@@ -2236,7 +2240,7 @@ var ed = class {
|
|
|
2236
2240
|
setState(e) {
|
|
2237
2241
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
2238
2242
|
}
|
|
2239
|
-
}, F = w("ChannelManager"),
|
|
2243
|
+
}, F = w("ChannelManager"), id = 5e3, ad = class {
|
|
2240
2244
|
channels = /* @__PURE__ */ new Map();
|
|
2241
2245
|
activeType = null;
|
|
2242
2246
|
state = "idle";
|
|
@@ -2330,7 +2334,7 @@ var ed = class {
|
|
|
2330
2334
|
}
|
|
2331
2335
|
}
|
|
2332
2336
|
async connectChannel(e) {
|
|
2333
|
-
let t = new
|
|
2337
|
+
let t = new rd({
|
|
2334
2338
|
entrypoint: e,
|
|
2335
2339
|
sessionId: this.config.sessionId,
|
|
2336
2340
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
@@ -2403,12 +2407,12 @@ var ed = class {
|
|
|
2403
2407
|
startStabilityTimer() {
|
|
2404
2408
|
this.clearStabilityTimer(), this.stabilityTimer = setTimeout(() => {
|
|
2405
2409
|
this.stabilityTimer = null, this.state === "connected" && (this.reconnectAttempts = 0);
|
|
2406
|
-
},
|
|
2410
|
+
}, id);
|
|
2407
2411
|
}
|
|
2408
2412
|
clearStabilityTimer() {
|
|
2409
2413
|
this.stabilityTimer &&= (clearTimeout(this.stabilityTimer), null);
|
|
2410
2414
|
}
|
|
2411
|
-
},
|
|
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 {
|
|
2412
2416
|
pc = null;
|
|
2413
2417
|
dataChannel = null;
|
|
2414
2418
|
_state = "new";
|
|
@@ -2433,11 +2437,11 @@ var ed = class {
|
|
|
2433
2437
|
if (this.pc = new RTCPeerConnection({
|
|
2434
2438
|
iceServers: this.config.iceServers ?? [],
|
|
2435
2439
|
iceTransportPolicy: this.config.iceTransportPolicy,
|
|
2436
|
-
bundlePolicy:
|
|
2437
|
-
rtcpMuxPolicy:
|
|
2440
|
+
bundlePolicy: hd,
|
|
2441
|
+
rtcpMuxPolicy: gd
|
|
2438
2442
|
}), this.setupEventHandlers(), this.config.useAudioTrack) for (let e = 0; e < 16; e++) this.pc.addTransceiver("audio", { direction: "sendrecv" });
|
|
2439
2443
|
if (this.config.useVideoTrack) for (let e = 0; e < 16; e++) this.pc.addTransceiver("video", { direction: "sendrecv" });
|
|
2440
|
-
this.config.useDataChannel && (this.dataChannel = this.pc.createDataChannel(
|
|
2444
|
+
this.config.useDataChannel && (this.dataChannel = this.pc.createDataChannel(xd, {
|
|
2441
2445
|
ordered: !1,
|
|
2442
2446
|
maxRetransmits: 0
|
|
2443
2447
|
}), this.setupDataChannelHandlers(this.dataChannel));
|
|
@@ -2527,7 +2531,7 @@ var ed = class {
|
|
|
2527
2531
|
this.config.onAudioTrack?.(r, t, n);
|
|
2528
2532
|
} else if (t.kind === "video") {
|
|
2529
2533
|
try {
|
|
2530
|
-
e.receiver.playoutDelayHint =
|
|
2534
|
+
e.receiver.playoutDelayHint = md;
|
|
2531
2535
|
} catch (e) {
|
|
2532
2536
|
I.warn("Failed to set playoutDelayHint:", e);
|
|
2533
2537
|
}
|
|
@@ -2552,7 +2556,7 @@ var ed = class {
|
|
|
2552
2556
|
setState(e) {
|
|
2553
2557
|
this._state !== e && (this._state = e, this.config.onStateChange?.(e));
|
|
2554
2558
|
}
|
|
2555
|
-
}, L = w("WebRTCSignaling"),
|
|
2559
|
+
}, L = w("WebRTCSignaling"), Td = class {
|
|
2556
2560
|
config;
|
|
2557
2561
|
connection = null;
|
|
2558
2562
|
sendMessage = null;
|
|
@@ -2604,7 +2608,7 @@ var ed = class {
|
|
|
2604
2608
|
this.videoTrackCount++, this.config.onVideoTrack?.(e, t, n);
|
|
2605
2609
|
}
|
|
2606
2610
|
};
|
|
2607
|
-
this.connection = new
|
|
2611
|
+
this.connection = new wd(t), await this.connection.initialize();
|
|
2608
2612
|
let n = await this.connection.createOffer();
|
|
2609
2613
|
this.sendOffer(n);
|
|
2610
2614
|
} catch (e) {
|
|
@@ -2809,7 +2813,7 @@ var ed = class {
|
|
|
2809
2813
|
}), n, r = new Promise((t) => {
|
|
2810
2814
|
n = setTimeout(() => {
|
|
2811
2815
|
L.warn("Timed out waiting for ICE servers from server, proceeding without TURN"), t(e);
|
|
2812
|
-
},
|
|
2816
|
+
}, _d);
|
|
2813
2817
|
}), i = tl();
|
|
2814
2818
|
this.sendMessage(rl(i, this.config.sessionId));
|
|
2815
2819
|
let a = await Promise.race([t, r]);
|
|
@@ -2879,16 +2883,16 @@ var ed = class {
|
|
|
2879
2883
|
L.error("Failed to handle WebRTC track map:", e);
|
|
2880
2884
|
}
|
|
2881
2885
|
}
|
|
2882
|
-
},
|
|
2886
|
+
}, Ed = w("WebRtcReachability"), Dd = "ikon-webrtc-reachability", Od = /* @__PURE__ */ new Set([
|
|
2883
2887
|
"direct",
|
|
2884
2888
|
"relay",
|
|
2885
2889
|
"failed"
|
|
2886
|
-
]),
|
|
2890
|
+
]), kd = class {
|
|
2887
2891
|
_remembered = null;
|
|
2888
2892
|
constructor() {
|
|
2889
2893
|
try {
|
|
2890
|
-
let e = localStorage.getItem(
|
|
2891
|
-
e !== null &&
|
|
2894
|
+
let e = localStorage.getItem(Dd);
|
|
2895
|
+
e !== null && Od.has(e) && (this._remembered = e, Ed.debug(`Loaded remembered WebRTC reachability: ${e}`));
|
|
2892
2896
|
} catch {}
|
|
2893
2897
|
}
|
|
2894
2898
|
get remembered() {
|
|
@@ -2913,13 +2917,13 @@ var ed = class {
|
|
|
2913
2917
|
if (this._remembered !== e) {
|
|
2914
2918
|
this._remembered = e;
|
|
2915
2919
|
try {
|
|
2916
|
-
localStorage.setItem(
|
|
2920
|
+
localStorage.setItem(Dd, e);
|
|
2917
2921
|
} catch {}
|
|
2918
|
-
|
|
2922
|
+
Ed.debug(`Remembered WebRTC reachability: ${e}`);
|
|
2919
2923
|
}
|
|
2920
2924
|
}
|
|
2921
2925
|
};
|
|
2922
|
-
async function
|
|
2926
|
+
async function Ad(e) {
|
|
2923
2927
|
let t;
|
|
2924
2928
|
try {
|
|
2925
2929
|
t = await e.getStats();
|
|
@@ -2939,60 +2943,208 @@ async function kd(e) {
|
|
|
2939
2943
|
let a = t.get(i.localCandidateId);
|
|
2940
2944
|
return a?.candidateType === void 0 ? null : a.candidateType === "relay" || typeof a.relayProtocol == "string";
|
|
2941
2945
|
}
|
|
2942
|
-
var
|
|
2946
|
+
var jd = 3e4, Md = 3e5, Nd = 1e4, R = [
|
|
2947
|
+
"direct",
|
|
2948
|
+
"proxy",
|
|
2949
|
+
"lb"
|
|
2950
|
+
], Pd = {
|
|
2951
|
+
"force-direct": "direct",
|
|
2952
|
+
"force-proxy": "proxy",
|
|
2953
|
+
"force-lb": "lb"
|
|
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;
|
|
2959
|
+
return [...r.slice(o), ...r.slice(0, o)];
|
|
2960
|
+
}
|
|
2961
|
+
var Id = {
|
|
2962
|
+
[x.WebTransport]: 0,
|
|
2963
|
+
[x.WebSocket]: 1,
|
|
2964
|
+
[x.WebTransportProxy]: 2,
|
|
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 {
|
|
2967
|
+
isLocal;
|
|
2968
|
+
_proxyMode;
|
|
2969
|
+
_websocket;
|
|
2970
|
+
_webtransport;
|
|
2971
|
+
_connectTier = "direct";
|
|
2972
|
+
workingEndpointType = null;
|
|
2973
|
+
constructor(e) {
|
|
2974
|
+
this.isLocal = !!e.local, this._proxyMode = e.proxyMode ?? "auto", this._websocket = e.websocket, this._webtransport = e.webtransport, this.isLocal || (this.loadRememberedType(), this._proxyMode === "auto" && this.loadConnectTier());
|
|
2975
|
+
}
|
|
2976
|
+
get proxyMode() {
|
|
2977
|
+
return this._proxyMode;
|
|
2978
|
+
}
|
|
2979
|
+
get connectTier() {
|
|
2980
|
+
return this._connectTier;
|
|
2981
|
+
}
|
|
2982
|
+
get proxyPreferred() {
|
|
2983
|
+
return this._connectTier !== "direct";
|
|
2984
|
+
}
|
|
2985
|
+
get rememberedType() {
|
|
2986
|
+
return this.workingEndpointType;
|
|
2987
|
+
}
|
|
2988
|
+
recordWorkingConnectTier(e) {
|
|
2989
|
+
this._connectTier !== e && (this.setConnectTier(e), z.debug(`Learned connect tier: ${e}`));
|
|
2990
|
+
}
|
|
2991
|
+
recordReachableConnectTier(e) {
|
|
2992
|
+
z.debug(`Connect tier ${e} is reachable again, stepping back up to it`), this.setConnectTier(e);
|
|
2993
|
+
}
|
|
2994
|
+
getFasterConnectTiers(e) {
|
|
2995
|
+
return R.slice(0, R.indexOf(e));
|
|
2996
|
+
}
|
|
2997
|
+
clearProxyPreference() {
|
|
2998
|
+
this.setConnectTier("direct");
|
|
2999
|
+
}
|
|
3000
|
+
getOrderedTypes(e) {
|
|
3001
|
+
let t = Array.from(e.keys());
|
|
3002
|
+
if (this.isLocal) return t;
|
|
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));
|
|
3006
|
+
if (this._proxyMode === "auto" && this.proxyPreferred) {
|
|
3007
|
+
let e = r.filter((e) => Ld.has(e)), t = r.filter((e) => Rd.has(e));
|
|
3008
|
+
r.length = 0, r.push(...e, ...t);
|
|
3009
|
+
}
|
|
3010
|
+
if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this.proxyPreferred || Ld.has(this.workingEndpointType))) {
|
|
3011
|
+
let e = r.indexOf(this.workingEndpointType);
|
|
3012
|
+
e > 0 && (r.splice(e, 1), r.unshift(this.workingEndpointType));
|
|
3013
|
+
}
|
|
3014
|
+
return z.debug(`Ordered types: [${r.map((e) => x[e]).join(", ")}] (remembered: ${this.workingEndpointType === null ? "none" : x[this.workingEndpointType]}, tier: ${this._connectTier})`), r;
|
|
3015
|
+
}
|
|
3016
|
+
rememberWorkingType(e) {
|
|
3017
|
+
if (!this.isLocal) {
|
|
3018
|
+
if (this._proxyMode !== "auto") {
|
|
3019
|
+
this.workingEndpointType = e;
|
|
3020
|
+
return;
|
|
3021
|
+
}
|
|
3022
|
+
this.workingEndpointType = e;
|
|
3023
|
+
try {
|
|
3024
|
+
localStorage.setItem(Vd, String(e)), localStorage.setItem(Wd, String(Date.now())), localStorage.getItem(Gd) === null && localStorage.setItem(Gd, String(Date.now()));
|
|
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]}`);
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
clearRememberedType() {
|
|
3030
|
+
this.workingEndpointType = null;
|
|
3031
|
+
try {
|
|
3032
|
+
localStorage.removeItem(Vd);
|
|
3033
|
+
} catch {}
|
|
3034
|
+
}
|
|
3035
|
+
needsRevalidation() {
|
|
3036
|
+
if (this.isLocal || this._proxyMode !== "auto" || this.workingEndpointType === null && this._connectTier === "direct") return !1;
|
|
3037
|
+
let e = this.revalidationAgeMs();
|
|
3038
|
+
return e !== null && e > Kd;
|
|
3039
|
+
}
|
|
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));
|
|
3043
|
+
}
|
|
3044
|
+
recordFasterTypeReachable(e) {
|
|
3045
|
+
z.debug(`Faster endpoint type ${x[e]} is reachable again, dropping learned preference`), this.clearRememberedType(), Rd.has(e) && this.clearProxyPreference();
|
|
3046
|
+
try {
|
|
3047
|
+
localStorage.removeItem(Wd), localStorage.removeItem(Gd);
|
|
3048
|
+
} catch {}
|
|
3049
|
+
}
|
|
3050
|
+
recordFasterTypesUnreachable() {
|
|
3051
|
+
try {
|
|
3052
|
+
localStorage.setItem(Gd, String(Date.now()));
|
|
3053
|
+
} catch {}
|
|
3054
|
+
z.debug("Faster endpoint types still unreachable, keeping the learned preference");
|
|
3055
|
+
}
|
|
3056
|
+
filterByTransport(e) {
|
|
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));
|
|
3059
|
+
}
|
|
3060
|
+
revalidationAgeMs() {
|
|
3061
|
+
try {
|
|
3062
|
+
let e = localStorage.getItem(Gd);
|
|
3063
|
+
if (e === null) return null;
|
|
3064
|
+
let t = Date.now() - Number(e);
|
|
3065
|
+
return Number.isFinite(t) ? t : null;
|
|
3066
|
+
} catch {
|
|
3067
|
+
return null;
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
loadRememberedType() {
|
|
3071
|
+
try {
|
|
3072
|
+
let e = localStorage.getItem(Vd);
|
|
3073
|
+
if (e !== null) {
|
|
3074
|
+
let t = Number(e);
|
|
3075
|
+
if (x[t] !== void 0) {
|
|
3076
|
+
this.workingEndpointType = t;
|
|
3077
|
+
let e = localStorage.getItem(Wd), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
|
|
3078
|
+
z.debug(`Loaded remembered type: ${x[t]} (age: ${n}h)`);
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
} catch {}
|
|
3082
|
+
}
|
|
3083
|
+
loadConnectTier() {
|
|
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}`);
|
|
3087
|
+
} catch {}
|
|
3088
|
+
}
|
|
3089
|
+
setConnectTier(e) {
|
|
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");
|
|
3092
|
+
} catch {}
|
|
3093
|
+
}
|
|
3094
|
+
}, Jd = "ikon-login-pending-call", Yd = /* @__PURE__ */ new Set(), Xd = {
|
|
2943
3095
|
required: !1,
|
|
2944
3096
|
reason: null
|
|
2945
3097
|
};
|
|
2946
|
-
function
|
|
2947
|
-
for (let e of
|
|
3098
|
+
function Zd() {
|
|
3099
|
+
for (let e of Yd) e();
|
|
2948
3100
|
}
|
|
2949
|
-
function
|
|
2950
|
-
return
|
|
3101
|
+
function Qd() {
|
|
3102
|
+
return Xd;
|
|
2951
3103
|
}
|
|
2952
|
-
function
|
|
2953
|
-
|
|
3104
|
+
function $d(e) {
|
|
3105
|
+
Xd = {
|
|
2954
3106
|
required: !0,
|
|
2955
3107
|
reason: e
|
|
2956
|
-
},
|
|
3108
|
+
}, Zd();
|
|
2957
3109
|
}
|
|
2958
|
-
function
|
|
2959
|
-
|
|
3110
|
+
function ef() {
|
|
3111
|
+
Xd = {
|
|
2960
3112
|
required: !1,
|
|
2961
3113
|
reason: null
|
|
2962
|
-
},
|
|
3114
|
+
}, Zd();
|
|
2963
3115
|
}
|
|
2964
|
-
function
|
|
2965
|
-
return
|
|
3116
|
+
function tf(e) {
|
|
3117
|
+
return Yd.add(e), () => Yd.delete(e);
|
|
2966
3118
|
}
|
|
2967
|
-
function
|
|
3119
|
+
function nf(e) {
|
|
2968
3120
|
try {
|
|
2969
|
-
sessionStorage.setItem(
|
|
3121
|
+
sessionStorage.setItem(Jd, JSON.stringify(e));
|
|
2970
3122
|
} catch {}
|
|
2971
3123
|
}
|
|
2972
|
-
function
|
|
3124
|
+
function rf() {
|
|
2973
3125
|
try {
|
|
2974
|
-
let e = sessionStorage.getItem(
|
|
2975
|
-
return sessionStorage.removeItem(
|
|
3126
|
+
let e = sessionStorage.getItem(Jd);
|
|
3127
|
+
return sessionStorage.removeItem(Jd), e ? JSON.parse(e) : null;
|
|
2976
3128
|
} catch {
|
|
2977
3129
|
return null;
|
|
2978
3130
|
}
|
|
2979
3131
|
}
|
|
2980
3132
|
//#endregion
|
|
2981
3133
|
//#region src/utils/abort-signal.ts
|
|
2982
|
-
function
|
|
3134
|
+
function af() {
|
|
2983
3135
|
return globalThis.AbortSignal;
|
|
2984
3136
|
}
|
|
2985
|
-
function
|
|
3137
|
+
function of() {
|
|
2986
3138
|
return typeof DOMException == "function" ? new DOMException("The operation timed out.", "TimeoutError") : /* @__PURE__ */ Error("The operation timed out.");
|
|
2987
3139
|
}
|
|
2988
|
-
function
|
|
2989
|
-
let t =
|
|
3140
|
+
function B(e) {
|
|
3141
|
+
let t = af();
|
|
2990
3142
|
if (t && typeof t.timeout == "function") return t.timeout(e);
|
|
2991
3143
|
let n = new AbortController();
|
|
2992
|
-
return setTimeout(() => n.abort(
|
|
3144
|
+
return setTimeout(() => n.abort(of()), e), n.signal;
|
|
2993
3145
|
}
|
|
2994
|
-
function
|
|
2995
|
-
let t =
|
|
3146
|
+
function sf(e) {
|
|
3147
|
+
let t = af();
|
|
2996
3148
|
if (t && typeof t.any == "function") return t.any(e);
|
|
2997
3149
|
let n = new AbortController(), r = (e) => {
|
|
2998
3150
|
n.abort(e.reason);
|
|
@@ -3008,43 +3160,46 @@ function Gd(e) {
|
|
|
3008
3160
|
}
|
|
3009
3161
|
//#endregion
|
|
3010
3162
|
//#region src/connection/urls.ts
|
|
3011
|
-
var
|
|
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 = [
|
|
3012
3164
|
".ikonai.app",
|
|
3013
3165
|
".ikonai.com",
|
|
3014
3166
|
".ikon.live"
|
|
3015
3167
|
];
|
|
3016
|
-
function
|
|
3017
|
-
return
|
|
3168
|
+
function mf(e) {
|
|
3169
|
+
return pf.some((t) => e.endsWith(t)) ? e.includes(".dev.") ? "development" : "production" : null;
|
|
3018
3170
|
}
|
|
3019
|
-
var
|
|
3020
|
-
async function
|
|
3021
|
-
return
|
|
3171
|
+
var hf = null, gf = null;
|
|
3172
|
+
async function _f() {
|
|
3173
|
+
return hf || (typeof window > "u" ? null : gf || (gf = (async () => {
|
|
3022
3174
|
try {
|
|
3023
|
-
let e = await fetch(`${window.location.origin}/ikon/api/env`, { signal:
|
|
3175
|
+
let e = await fetch(`${window.location.origin}/ikon/api/env`, { signal: B(5e3) });
|
|
3024
3176
|
if (!e.ok) return null;
|
|
3025
3177
|
let t = await e.json();
|
|
3026
|
-
return t.env === "development" || t.env === "production" ? (
|
|
3178
|
+
return t.env === "development" || t.env === "production" ? (hf = t.env, t.env) : null;
|
|
3027
3179
|
} catch {
|
|
3028
3180
|
return null;
|
|
3029
3181
|
} finally {
|
|
3030
|
-
|
|
3182
|
+
gf = null;
|
|
3031
3183
|
}
|
|
3032
|
-
})(),
|
|
3184
|
+
})(), gf));
|
|
3033
3185
|
}
|
|
3034
|
-
function
|
|
3035
|
-
return typeof window > "u" ||
|
|
3186
|
+
function vf() {
|
|
3187
|
+
return typeof window > "u" || Ku() === !1 || !V() ? null : `${window.location.origin}/ikon/api`;
|
|
3036
3188
|
}
|
|
3037
|
-
function
|
|
3038
|
-
return typeof window > "u" || !
|
|
3189
|
+
function yf() {
|
|
3190
|
+
return typeof window > "u" || !V() ? null : `${window.location.origin}/ikon/auth`;
|
|
3039
3191
|
}
|
|
3040
|
-
function
|
|
3041
|
-
return
|
|
3192
|
+
function bf(e) {
|
|
3193
|
+
return typeof window > "u" || !V() ? null : `${window.location.origin}${e}`;
|
|
3042
3194
|
}
|
|
3043
|
-
function
|
|
3044
|
-
return
|
|
3195
|
+
function xf(e) {
|
|
3196
|
+
return e.startsWith("/") ? typeof window > "u" ? wf() === "development" ? lf : cf : `${window.location.origin}${e}` : e;
|
|
3045
3197
|
}
|
|
3046
|
-
function
|
|
3047
|
-
|
|
3198
|
+
function Sf(e) {
|
|
3199
|
+
return vf() || (e === "development" ? lf : cf);
|
|
3200
|
+
}
|
|
3201
|
+
function Cf(e) {
|
|
3202
|
+
if (e) return xf(e);
|
|
3048
3203
|
let t = {
|
|
3049
3204
|
BASE_URL: "./",
|
|
3050
3205
|
DEV: !1,
|
|
@@ -3052,9 +3207,9 @@ function sf(e) {
|
|
|
3052
3207
|
PROD: !0,
|
|
3053
3208
|
SSR: !1
|
|
3054
3209
|
}.VITE_IKON_BACKEND_URL;
|
|
3055
|
-
return t ?
|
|
3210
|
+
return t ? xf(t) : vf() || (typeof window > "u" ? cf : V() ? (mf(window.location.hostname) ?? hf ?? "production") === "development" ? lf : cf : lf);
|
|
3056
3211
|
}
|
|
3057
|
-
function
|
|
3212
|
+
function wf() {
|
|
3058
3213
|
let e = {
|
|
3059
3214
|
BASE_URL: "./",
|
|
3060
3215
|
DEV: !1,
|
|
@@ -3070,17 +3225,17 @@ function cf() {
|
|
|
3070
3225
|
PROD: !0,
|
|
3071
3226
|
SSR: !1
|
|
3072
3227
|
}.VITE_IKON_BACKEND_URL;
|
|
3073
|
-
return t && !t.startsWith("/") ? t.includes(".dev.") ? "development" : "production" : typeof window > "u" ? "production" :
|
|
3228
|
+
return t && !t.startsWith("/") ? t.includes(".dev.") ? "development" : "production" : typeof window > "u" ? "production" : V() ? mf(window.location.hostname) ?? hf ?? "production" : "development";
|
|
3074
3229
|
}
|
|
3075
|
-
async function
|
|
3076
|
-
return e.startsWith("/") ? typeof window > "u" ? await
|
|
3230
|
+
async function Tf(e) {
|
|
3231
|
+
return e.startsWith("/") ? typeof window > "u" ? await Df() : `${window.location.origin}${e}` : e;
|
|
3077
3232
|
}
|
|
3078
|
-
async function
|
|
3079
|
-
if (
|
|
3080
|
-
let e =
|
|
3233
|
+
async function Ef(e) {
|
|
3234
|
+
if (Gu()) {
|
|
3235
|
+
let e = yf();
|
|
3081
3236
|
if (e) return e;
|
|
3082
3237
|
}
|
|
3083
|
-
if (e) return await
|
|
3238
|
+
if (e) return await Tf(e);
|
|
3084
3239
|
let t = {
|
|
3085
3240
|
BASE_URL: "./",
|
|
3086
3241
|
DEV: !1,
|
|
@@ -3088,48 +3243,48 @@ async function uf(e) {
|
|
|
3088
3243
|
PROD: !0,
|
|
3089
3244
|
SSR: !1
|
|
3090
3245
|
}.VITE_IKON_AUTH_URL;
|
|
3091
|
-
if (t) return await
|
|
3246
|
+
if (t) return await Tf(t);
|
|
3092
3247
|
{
|
|
3093
|
-
let e =
|
|
3248
|
+
let e = yf();
|
|
3094
3249
|
if (e) return e;
|
|
3095
3250
|
}
|
|
3096
|
-
return
|
|
3251
|
+
return Df();
|
|
3097
3252
|
}
|
|
3098
|
-
async function
|
|
3099
|
-
if (typeof window > "u") return
|
|
3100
|
-
if (!
|
|
3101
|
-
let e =
|
|
3102
|
-
return e ? e === "development" ?
|
|
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;
|
|
3103
3258
|
}
|
|
3104
|
-
function
|
|
3259
|
+
function Of() {
|
|
3105
3260
|
if (typeof window > "u") return {};
|
|
3106
3261
|
let e = new URLSearchParams(window.location.search), t = {};
|
|
3107
3262
|
for (let [n, r] of e.entries()) t[n] = r;
|
|
3108
3263
|
return t;
|
|
3109
3264
|
}
|
|
3110
|
-
var
|
|
3265
|
+
var kf = [
|
|
3111
3266
|
"ikon_token",
|
|
3112
3267
|
"ikon_code",
|
|
3113
3268
|
"ikon_provider",
|
|
3114
3269
|
"error"
|
|
3115
|
-
],
|
|
3116
|
-
function
|
|
3270
|
+
], Af = [ku, ku.replace(/-/g, "_")];
|
|
3271
|
+
function jf() {
|
|
3117
3272
|
let e = window.location.pathname.match(/^\/(s|c)\/([^/]+)(.*)$/);
|
|
3118
3273
|
if (!e) return;
|
|
3119
3274
|
let t = new URL(window.location.href);
|
|
3120
3275
|
t.pathname = e[3] || "/", t.searchParams.set(ku, decodeURIComponent(e[2])), window.history.replaceState(null, "", t.toString());
|
|
3121
3276
|
}
|
|
3122
|
-
function
|
|
3277
|
+
function Mf() {
|
|
3123
3278
|
if (typeof window > "u") return { parameters: {} };
|
|
3124
|
-
|
|
3125
|
-
let e =
|
|
3126
|
-
for (let [n, r] of Object.entries(e)) !
|
|
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);
|
|
3127
3282
|
return {
|
|
3128
|
-
sessionIdentityHash:
|
|
3283
|
+
sessionIdentityHash: Ju() ?? void 0,
|
|
3129
3284
|
parameters: t
|
|
3130
3285
|
};
|
|
3131
3286
|
}
|
|
3132
|
-
function
|
|
3287
|
+
function V() {
|
|
3133
3288
|
if (typeof window > "u") return !1;
|
|
3134
3289
|
let e = window.location.hostname;
|
|
3135
3290
|
if (e === "localhost" || e === "127.0.0.1" || e === "::1" || e.startsWith("10.") || e.startsWith("192.168.")) return !1;
|
|
@@ -3139,58 +3294,58 @@ function z() {
|
|
|
3139
3294
|
}
|
|
3140
3295
|
return !0;
|
|
3141
3296
|
}
|
|
3142
|
-
function
|
|
3297
|
+
function Nf() {
|
|
3143
3298
|
if (typeof window > "u") return "";
|
|
3144
|
-
let e = window.location.pathname || "/", t =
|
|
3299
|
+
let e = window.location.pathname || "/", t = Ff(window.location.search);
|
|
3145
3300
|
return t.length > 0 ? `${e}?${t}` : e;
|
|
3146
3301
|
}
|
|
3147
|
-
function
|
|
3302
|
+
function Pf() {
|
|
3148
3303
|
if (typeof window > "u") return "";
|
|
3149
3304
|
let e = window.location.origin;
|
|
3150
|
-
return !e || e === "null" ? "" : `${e}${
|
|
3305
|
+
return !e || e === "null" ? "" : `${e}${Nf()}`;
|
|
3151
3306
|
}
|
|
3152
|
-
function
|
|
3307
|
+
function Ff(e) {
|
|
3153
3308
|
let t = new URLSearchParams(e);
|
|
3154
3309
|
for (let e of [...t.keys()]) (e.startsWith("ikon-") || e.startsWith("ikon_")) && t.delete(e);
|
|
3155
3310
|
return t.toString();
|
|
3156
3311
|
}
|
|
3157
3312
|
//#endregion
|
|
3158
3313
|
//#region src/utils/pkce.ts
|
|
3159
|
-
var
|
|
3160
|
-
function
|
|
3314
|
+
var If = "ikon-auth-pkce-verifier";
|
|
3315
|
+
function Lf(e) {
|
|
3161
3316
|
let t = e instanceof Uint8Array ? e : new Uint8Array(e), n = "";
|
|
3162
3317
|
for (let e of t) n += String.fromCharCode(e);
|
|
3163
3318
|
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
3164
3319
|
}
|
|
3165
|
-
function
|
|
3320
|
+
function Rf() {
|
|
3166
3321
|
return typeof window < "u" && !!window.crypto?.subtle && !!window.sessionStorage;
|
|
3167
3322
|
}
|
|
3168
|
-
async function
|
|
3169
|
-
if (!
|
|
3323
|
+
async function zf() {
|
|
3324
|
+
if (!Rf()) return null;
|
|
3170
3325
|
try {
|
|
3171
|
-
let e =
|
|
3172
|
-
return window.sessionStorage.setItem(
|
|
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);
|
|
3173
3328
|
} catch {
|
|
3174
3329
|
return null;
|
|
3175
3330
|
}
|
|
3176
3331
|
}
|
|
3177
|
-
function
|
|
3332
|
+
function Bf(e) {
|
|
3178
3333
|
try {
|
|
3179
|
-
window.sessionStorage.setItem(
|
|
3334
|
+
window.sessionStorage.setItem(If, e);
|
|
3180
3335
|
} catch {}
|
|
3181
3336
|
}
|
|
3182
|
-
function
|
|
3337
|
+
function Vf() {
|
|
3183
3338
|
try {
|
|
3184
|
-
let e = window.sessionStorage.getItem(
|
|
3185
|
-
return window.sessionStorage.removeItem(
|
|
3339
|
+
let e = window.sessionStorage.getItem(If);
|
|
3340
|
+
return window.sessionStorage.removeItem(If), e;
|
|
3186
3341
|
} catch {
|
|
3187
3342
|
return null;
|
|
3188
3343
|
}
|
|
3189
3344
|
}
|
|
3190
3345
|
//#endregion
|
|
3191
3346
|
//#region src/utils/embedded-oauth.ts
|
|
3192
|
-
var
|
|
3193
|
-
function
|
|
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() {
|
|
3194
3349
|
if (typeof window > "u") return !1;
|
|
3195
3350
|
try {
|
|
3196
3351
|
return window.top !== window.self;
|
|
@@ -3198,8 +3353,8 @@ function Pf() {
|
|
|
3198
3353
|
return !0;
|
|
3199
3354
|
}
|
|
3200
3355
|
}
|
|
3201
|
-
async function
|
|
3202
|
-
let n = await
|
|
3356
|
+
async function Zf(e, t) {
|
|
3357
|
+
let n = await zf(), r = Vf();
|
|
3203
3358
|
return await new Promise((i) => {
|
|
3204
3359
|
let a = !1, o = (e) => {
|
|
3205
3360
|
a || (a = !0, window.removeEventListener("message", s), window.clearTimeout(c), i(e));
|
|
@@ -3210,30 +3365,30 @@ async function Ff(e, t) {
|
|
|
3210
3365
|
};
|
|
3211
3366
|
window.addEventListener("message", s), window.parent.postMessage({
|
|
3212
3367
|
source: "ikon-oauth",
|
|
3213
|
-
type:
|
|
3368
|
+
type: Wf,
|
|
3214
3369
|
provider: e,
|
|
3215
3370
|
spaceId: t,
|
|
3216
3371
|
codeChallenge: n,
|
|
3217
3372
|
codeVerifier: r
|
|
3218
3373
|
}, "*");
|
|
3219
|
-
let c = window.setTimeout(() => o(!1),
|
|
3374
|
+
let c = window.setTimeout(() => o(!1), Jf);
|
|
3220
3375
|
});
|
|
3221
3376
|
}
|
|
3222
|
-
async function
|
|
3223
|
-
if (await
|
|
3377
|
+
async function Qf(e, t) {
|
|
3378
|
+
if (await Zf(e, t)) return !0;
|
|
3224
3379
|
try {
|
|
3225
|
-
let { code: n, provider: r } = await
|
|
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);
|
|
3226
3381
|
return i.searchParams.set("ikon_code", n), i.searchParams.set("ikon_provider", r), window.location.replace(i.toString()), !0;
|
|
3227
3382
|
} catch (t) {
|
|
3228
|
-
return
|
|
3383
|
+
return Hf.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
|
|
3229
3384
|
}
|
|
3230
3385
|
}
|
|
3231
|
-
async function
|
|
3386
|
+
async function $f(e, t, n) {
|
|
3232
3387
|
if (!e) throw Error("The sign-in window was blocked. Allow pop-ups for this site and try again.");
|
|
3233
3388
|
let r;
|
|
3234
3389
|
try {
|
|
3235
|
-
r = await
|
|
3236
|
-
let i = `${r}${
|
|
3390
|
+
r = await Df();
|
|
3391
|
+
let i = `${r}${Uf}`, a = await zf(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
|
|
3237
3392
|
e.location.href = `${r}/oauth/${encodeURIComponent(t)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`;
|
|
3238
3393
|
} catch (t) {
|
|
3239
3394
|
throw e.close(), t;
|
|
@@ -3263,15 +3418,15 @@ async function Lf(e, t, n) {
|
|
|
3263
3418
|
o(() => {
|
|
3264
3419
|
e.close(), r(/* @__PURE__ */ Error("The sign-in timed out"));
|
|
3265
3420
|
});
|
|
3266
|
-
},
|
|
3421
|
+
}, Yf);
|
|
3267
3422
|
});
|
|
3268
3423
|
}
|
|
3269
|
-
function
|
|
3270
|
-
if (typeof window > "u" || !
|
|
3424
|
+
function ep(e, t) {
|
|
3425
|
+
if (typeof window > "u" || !Xf()) return () => void 0;
|
|
3271
3426
|
let n = (e) => {
|
|
3272
3427
|
if (e.source !== window.parent) return;
|
|
3273
3428
|
let n = e.data;
|
|
3274
|
-
n?.source !== "ikon-oauth" || n.type !== "ikon-oauth-embedder-result" || typeof n.code != "string" || !n.code ||
|
|
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({
|
|
3275
3430
|
code: n.code,
|
|
3276
3431
|
provider: typeof n.provider == "string" ? n.provider : "",
|
|
3277
3432
|
codeVerifier: typeof n.codeVerifier == "string" ? n.codeVerifier : null
|
|
@@ -3279,43 +3434,48 @@ function Rf(e, t) {
|
|
|
3279
3434
|
};
|
|
3280
3435
|
return window.addEventListener("message", n), window.parent.postMessage({
|
|
3281
3436
|
source: "ikon-oauth",
|
|
3282
|
-
type:
|
|
3437
|
+
type: Gf,
|
|
3283
3438
|
spaceId: e
|
|
3284
3439
|
}, "*"), () => window.removeEventListener("message", n);
|
|
3285
3440
|
}
|
|
3286
|
-
function
|
|
3441
|
+
function tp() {
|
|
3287
3442
|
if (typeof window > "u") return;
|
|
3288
|
-
let e = new URLSearchParams(window.location.search).get(
|
|
3289
|
-
e &&
|
|
3443
|
+
let e = new URLSearchParams(window.location.search).get(qf);
|
|
3444
|
+
e && Bf(e);
|
|
3290
3445
|
}
|
|
3291
3446
|
//#endregion
|
|
3292
3447
|
//#region src/utils/user-gesture.ts
|
|
3293
|
-
function
|
|
3448
|
+
function np(e) {
|
|
3294
3449
|
if (!e || typeof e != "object") return !1;
|
|
3295
3450
|
let t = e, n = typeof t.name == "string" ? t.name : "", r = typeof t.message == "string" ? t.message : "";
|
|
3296
3451
|
return !!(n === "NotAllowedError" || n === "SecurityError" || r.toLowerCase().includes("permission") || r.toLowerCase().includes("user gesture"));
|
|
3297
3452
|
}
|
|
3298
3453
|
//#endregion
|
|
3299
3454
|
//#region src/utils/app-routes.ts
|
|
3300
|
-
var
|
|
3301
|
-
function
|
|
3455
|
+
var rp = ["/ikon", "/api"];
|
|
3456
|
+
function ip(e) {
|
|
3302
3457
|
if (!e) return !1;
|
|
3303
3458
|
let t = e.split(/[?#]/)[0], n = t.startsWith("/") ? t : "/" + t;
|
|
3304
|
-
return
|
|
3459
|
+
return rp.some((e) => n === e || n.startsWith(e + "/"));
|
|
3305
3460
|
}
|
|
3306
3461
|
//#endregion
|
|
3307
3462
|
//#region src/functions/browser-functions.ts
|
|
3308
|
-
var
|
|
3309
|
-
function
|
|
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);
|
|
3467
|
+
}));
|
|
3468
|
+
}
|
|
3469
|
+
function dp(e) {
|
|
3310
3470
|
typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", e);
|
|
3311
3471
|
}
|
|
3312
|
-
function
|
|
3472
|
+
function fp() {
|
|
3313
3473
|
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
3314
3474
|
}
|
|
3315
|
-
function
|
|
3316
|
-
return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(
|
|
3475
|
+
function pp() {
|
|
3476
|
+
return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(op) || window.localStorage.getItem(ap) || fp();
|
|
3317
3477
|
}
|
|
3318
|
-
function
|
|
3478
|
+
function mp() {
|
|
3319
3479
|
return typeof window > "u" ? {
|
|
3320
3480
|
width: 0,
|
|
3321
3481
|
height: 0
|
|
@@ -3324,17 +3484,18 @@ function Yf() {
|
|
|
3324
3484
|
height: window.innerHeight
|
|
3325
3485
|
};
|
|
3326
3486
|
}
|
|
3327
|
-
function
|
|
3487
|
+
function hp() {
|
|
3328
3488
|
if (typeof window > "u" || !window.localStorage) return "light";
|
|
3329
|
-
|
|
3489
|
+
up();
|
|
3490
|
+
let e = window.localStorage.getItem(op), t = window.localStorage.getItem(ap);
|
|
3330
3491
|
if (e || t) {
|
|
3331
3492
|
let n = e ?? t;
|
|
3332
|
-
return
|
|
3493
|
+
return dp(n), n;
|
|
3333
3494
|
}
|
|
3334
|
-
let n =
|
|
3335
|
-
return window.localStorage.setItem(
|
|
3495
|
+
let n = fp();
|
|
3496
|
+
return window.localStorage.setItem(ap, n), dp(n), n;
|
|
3336
3497
|
}
|
|
3337
|
-
var
|
|
3498
|
+
var gp = {
|
|
3338
3499
|
name: "ikon.client.getTheme",
|
|
3339
3500
|
description: "Get the currently selected client theme",
|
|
3340
3501
|
returnType: {
|
|
@@ -3342,12 +3503,12 @@ var Zf = {
|
|
|
3342
3503
|
nullable: !0
|
|
3343
3504
|
}
|
|
3344
3505
|
};
|
|
3345
|
-
function
|
|
3506
|
+
function _p() {
|
|
3346
3507
|
if (typeof window > "u" || !window.localStorage) return null;
|
|
3347
|
-
let e = window.localStorage.getItem(
|
|
3508
|
+
let e = window.localStorage.getItem(op), t = window.localStorage.getItem(ap);
|
|
3348
3509
|
return e ?? t ?? null;
|
|
3349
3510
|
}
|
|
3350
|
-
var
|
|
3511
|
+
var vp = {
|
|
3351
3512
|
name: "ikon.client.setTheme",
|
|
3352
3513
|
description: "Update the client UI theme",
|
|
3353
3514
|
returnType: { kind: "boolean" },
|
|
@@ -3364,38 +3525,38 @@ var $f = {
|
|
|
3364
3525
|
description: "Whether to persist as user preference"
|
|
3365
3526
|
}]
|
|
3366
3527
|
};
|
|
3367
|
-
function
|
|
3528
|
+
function yp(e, t) {
|
|
3368
3529
|
if (typeof window > "u" || !window.localStorage || typeof e != "string") return !1;
|
|
3369
3530
|
let n = e.trim().toLowerCase();
|
|
3370
3531
|
if (!n) return !1;
|
|
3371
3532
|
let r = t === void 0 || !!t, i = window.localStorage;
|
|
3372
|
-
r ? i.setItem(
|
|
3533
|
+
r ? i.setItem(op, n) : i.removeItem(op), i.setItem(ap, n);
|
|
3373
3534
|
try {
|
|
3374
|
-
window.dispatchEvent(new CustomEvent(
|
|
3535
|
+
window.dispatchEvent(new CustomEvent(sp, { detail: { mode: n } }));
|
|
3375
3536
|
} catch {}
|
|
3376
|
-
return
|
|
3537
|
+
return dp(n), !0;
|
|
3377
3538
|
}
|
|
3378
|
-
var
|
|
3539
|
+
var bp = {
|
|
3379
3540
|
name: "ikon.client.getLanguage",
|
|
3380
3541
|
description: "Get the browser language preference",
|
|
3381
3542
|
returnType: { kind: "string" }
|
|
3382
3543
|
};
|
|
3383
|
-
function
|
|
3544
|
+
function xp() {
|
|
3384
3545
|
return typeof navigator > "u" ? "en-US" : navigator.language || "en-US";
|
|
3385
3546
|
}
|
|
3386
|
-
var
|
|
3547
|
+
var Sp = {
|
|
3387
3548
|
name: "ikon.client.getTimezone",
|
|
3388
3549
|
description: "Get the browser timezone (IANA format)",
|
|
3389
3550
|
returnType: { kind: "string" }
|
|
3390
3551
|
};
|
|
3391
|
-
function
|
|
3552
|
+
function Cp() {
|
|
3392
3553
|
try {
|
|
3393
3554
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
3394
3555
|
} catch {
|
|
3395
3556
|
return "UTC";
|
|
3396
3557
|
}
|
|
3397
3558
|
}
|
|
3398
|
-
function
|
|
3559
|
+
function wp() {
|
|
3399
3560
|
if (typeof Intl > "u") return "";
|
|
3400
3561
|
try {
|
|
3401
3562
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
@@ -3403,15 +3564,15 @@ function ap() {
|
|
|
3403
3564
|
return "";
|
|
3404
3565
|
}
|
|
3405
3566
|
}
|
|
3406
|
-
function
|
|
3567
|
+
function Tp() {
|
|
3407
3568
|
return typeof navigator > "u" ? !1 : navigator.maxTouchPoints > 0;
|
|
3408
3569
|
}
|
|
3409
|
-
function
|
|
3570
|
+
function Ep() {
|
|
3410
3571
|
if (typeof navigator > "u" || typeof window > "u") return v.Unknown;
|
|
3411
3572
|
let e = navigator.maxTouchPoints > 0, t = window.innerWidth <= 1024;
|
|
3412
3573
|
return e && t ? v.MobileWeb : v.DesktopWeb;
|
|
3413
3574
|
}
|
|
3414
|
-
var
|
|
3575
|
+
var Dp = {
|
|
3415
3576
|
name: "ikon.client.getUrl",
|
|
3416
3577
|
description: "Get the current browser URL path and query string",
|
|
3417
3578
|
returnType: {
|
|
@@ -3419,10 +3580,10 @@ var cp = {
|
|
|
3419
3580
|
nullable: !0
|
|
3420
3581
|
}
|
|
3421
3582
|
};
|
|
3422
|
-
function
|
|
3583
|
+
function Op() {
|
|
3423
3584
|
return typeof window > "u" ? null : window.location.pathname + window.location.search;
|
|
3424
3585
|
}
|
|
3425
|
-
var
|
|
3586
|
+
var kp = {
|
|
3426
3587
|
name: "ikon.client.setUrl",
|
|
3427
3588
|
description: "Update the browser URL without triggering a page reload",
|
|
3428
3589
|
returnType: { kind: "boolean" },
|
|
@@ -3450,10 +3611,10 @@ var up = {
|
|
|
3450
3611
|
}
|
|
3451
3612
|
]
|
|
3452
3613
|
};
|
|
3453
|
-
function
|
|
3614
|
+
function Ap(e, t, n) {
|
|
3454
3615
|
if (typeof window > "u" || !window.history || typeof e != "string") return !1;
|
|
3455
3616
|
let r = e.trim();
|
|
3456
|
-
if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") ||
|
|
3617
|
+
if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || ip(r)) return !1;
|
|
3457
3618
|
try {
|
|
3458
3619
|
let e = !!t, i = n && !r.includes("?") ? r + window.location.search : r;
|
|
3459
3620
|
return e ? window.history.replaceState(null, "", i) : window.history.pushState(null, "", i), !0;
|
|
@@ -3461,7 +3622,7 @@ function dp(e, t, n) {
|
|
|
3461
3622
|
return !1;
|
|
3462
3623
|
}
|
|
3463
3624
|
}
|
|
3464
|
-
var
|
|
3625
|
+
var jp = {
|
|
3465
3626
|
name: "ikon.client.openExternalUrl",
|
|
3466
3627
|
description: "Open an external URL in a new browser tab",
|
|
3467
3628
|
returnType: { kind: "boolean" },
|
|
@@ -3471,7 +3632,7 @@ var fp = {
|
|
|
3471
3632
|
description: "The URL to open. Must be absolute (e.g., starts with https://)."
|
|
3472
3633
|
}]
|
|
3473
3634
|
};
|
|
3474
|
-
function
|
|
3635
|
+
function Mp(e) {
|
|
3475
3636
|
if (typeof window > "u" || typeof window.open != "function" || typeof e != "string") return !1;
|
|
3476
3637
|
let t = e.trim();
|
|
3477
3638
|
if (!t || /^javascript:/i.test(t)) return !1;
|
|
@@ -3481,7 +3642,7 @@ function pp(e) {
|
|
|
3481
3642
|
return !1;
|
|
3482
3643
|
}
|
|
3483
3644
|
}
|
|
3484
|
-
var
|
|
3645
|
+
var Np = {
|
|
3485
3646
|
name: "ikon.client.vibrate",
|
|
3486
3647
|
description: "Trigger haptic feedback on supported devices",
|
|
3487
3648
|
returnType: { kind: "boolean" },
|
|
@@ -3491,7 +3652,7 @@ var mp = {
|
|
|
3491
3652
|
description: "Duration in ms, or comma-separated pattern (e.g., \"200\" or \"100,50,100\")"
|
|
3492
3653
|
}]
|
|
3493
3654
|
};
|
|
3494
|
-
function
|
|
3655
|
+
function Pp(e) {
|
|
3495
3656
|
if (typeof navigator > "u" || !navigator.vibrate || typeof e != "string") return !1;
|
|
3496
3657
|
try {
|
|
3497
3658
|
let t = e.split(",").map((e) => parseInt(e.trim(), 10));
|
|
@@ -3500,16 +3661,16 @@ function hp(e) {
|
|
|
3500
3661
|
return !1;
|
|
3501
3662
|
}
|
|
3502
3663
|
}
|
|
3503
|
-
var
|
|
3504
|
-
async function
|
|
3664
|
+
var H = null, Fp = !1, Ip = !1;
|
|
3665
|
+
async function Lp() {
|
|
3505
3666
|
if (!(typeof navigator > "u" || !("wakeLock" in navigator))) try {
|
|
3506
|
-
|
|
3667
|
+
H = await navigator.wakeLock.request("screen");
|
|
3507
3668
|
} catch {}
|
|
3508
3669
|
}
|
|
3509
|
-
function
|
|
3510
|
-
document.visibilityState === "visible" &&
|
|
3670
|
+
function Rp() {
|
|
3671
|
+
document.visibilityState === "visible" && Fp && (!H || H.released) && Lp();
|
|
3511
3672
|
}
|
|
3512
|
-
var
|
|
3673
|
+
var zp = {
|
|
3513
3674
|
name: "ikon.client.keepScreenAwake",
|
|
3514
3675
|
description: "Prevent or allow the screen to sleep",
|
|
3515
3676
|
returnType: { kind: "boolean" },
|
|
@@ -3519,15 +3680,15 @@ var bp = {
|
|
|
3519
3680
|
description: "Whether to keep the screen awake"
|
|
3520
3681
|
}]
|
|
3521
3682
|
};
|
|
3522
|
-
async function
|
|
3683
|
+
async function Bp(e) {
|
|
3523
3684
|
if (typeof navigator > "u" || !("wakeLock" in navigator)) return !1;
|
|
3524
3685
|
try {
|
|
3525
|
-
return e ? (
|
|
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;
|
|
3526
3687
|
} catch {
|
|
3527
3688
|
return !1;
|
|
3528
3689
|
}
|
|
3529
3690
|
}
|
|
3530
|
-
var
|
|
3691
|
+
var Vp = {
|
|
3531
3692
|
name: "ikon.client.getVisibility",
|
|
3532
3693
|
description: "Get the current page visibility state",
|
|
3533
3694
|
returnType: {
|
|
@@ -3535,10 +3696,10 @@ var Sp = {
|
|
|
3535
3696
|
nullable: !0
|
|
3536
3697
|
}
|
|
3537
3698
|
};
|
|
3538
|
-
function
|
|
3699
|
+
function Hp() {
|
|
3539
3700
|
return typeof document > "u" ? null : document.visibilityState || null;
|
|
3540
3701
|
}
|
|
3541
|
-
var
|
|
3702
|
+
var Up = {
|
|
3542
3703
|
name: "ikon.client.scrollTo",
|
|
3543
3704
|
description: "Scroll the page to a specific position",
|
|
3544
3705
|
returnType: { kind: "boolean" },
|
|
@@ -3563,7 +3724,7 @@ var wp = {
|
|
|
3563
3724
|
}
|
|
3564
3725
|
]
|
|
3565
3726
|
};
|
|
3566
|
-
function
|
|
3727
|
+
function Wp(e, t, n) {
|
|
3567
3728
|
if (typeof window > "u" || typeof e != "number" || typeof t != "number") return !1;
|
|
3568
3729
|
try {
|
|
3569
3730
|
return window.scrollTo({
|
|
@@ -3575,7 +3736,7 @@ function Tp(e, t, n) {
|
|
|
3575
3736
|
return !1;
|
|
3576
3737
|
}
|
|
3577
3738
|
}
|
|
3578
|
-
var
|
|
3739
|
+
var Gp = {
|
|
3579
3740
|
name: "ikon.client.getBatteryLevel",
|
|
3580
3741
|
description: "Get the current battery level (0-100)",
|
|
3581
3742
|
returnType: {
|
|
@@ -3583,7 +3744,7 @@ var Ep = {
|
|
|
3583
3744
|
nullable: !0
|
|
3584
3745
|
}
|
|
3585
3746
|
};
|
|
3586
|
-
async function
|
|
3747
|
+
async function Kp() {
|
|
3587
3748
|
if (typeof navigator > "u" || !("getBattery" in navigator)) return null;
|
|
3588
3749
|
try {
|
|
3589
3750
|
let e = await navigator.getBattery();
|
|
@@ -3592,7 +3753,7 @@ async function Dp() {
|
|
|
3592
3753
|
return null;
|
|
3593
3754
|
}
|
|
3594
3755
|
}
|
|
3595
|
-
var
|
|
3756
|
+
var qp = {
|
|
3596
3757
|
name: "ikon.client.getNetworkType",
|
|
3597
3758
|
description: "Get the current network connection type",
|
|
3598
3759
|
returnType: {
|
|
@@ -3600,17 +3761,17 @@ var Op = {
|
|
|
3600
3761
|
nullable: !0
|
|
3601
3762
|
}
|
|
3602
3763
|
};
|
|
3603
|
-
function
|
|
3764
|
+
function Jp() {
|
|
3604
3765
|
if (typeof navigator > "u") return null;
|
|
3605
3766
|
let e = navigator.connection;
|
|
3606
3767
|
return e && (e.effectiveType || e.type) || null;
|
|
3607
3768
|
}
|
|
3608
|
-
var
|
|
3769
|
+
var Yp = {
|
|
3609
3770
|
name: "ikon.client.requestFullscreen",
|
|
3610
3771
|
description: "Request the browser to enter fullscreen mode",
|
|
3611
3772
|
returnType: { kind: "boolean" }
|
|
3612
3773
|
};
|
|
3613
|
-
async function
|
|
3774
|
+
async function Xp() {
|
|
3614
3775
|
if (typeof document > "u" || !document.documentElement) return !1;
|
|
3615
3776
|
try {
|
|
3616
3777
|
let e = document.documentElement, t = e.requestFullscreen?.bind(e) ?? e.webkitRequestFullscreen?.bind(e);
|
|
@@ -3619,12 +3780,12 @@ async function jp() {
|
|
|
3619
3780
|
return !1;
|
|
3620
3781
|
}
|
|
3621
3782
|
}
|
|
3622
|
-
var
|
|
3783
|
+
var Zp = {
|
|
3623
3784
|
name: "ikon.client.exitFullscreen",
|
|
3624
3785
|
description: "Exit browser fullscreen mode",
|
|
3625
3786
|
returnType: { kind: "boolean" }
|
|
3626
3787
|
};
|
|
3627
|
-
function
|
|
3788
|
+
function Qp() {
|
|
3628
3789
|
if (typeof document > "u") return !1;
|
|
3629
3790
|
try {
|
|
3630
3791
|
let e = document.exitFullscreen?.bind(document) ?? document.webkitExitFullscreen?.bind(document);
|
|
@@ -3633,25 +3794,25 @@ function Np() {
|
|
|
3633
3794
|
return !1;
|
|
3634
3795
|
}
|
|
3635
3796
|
}
|
|
3636
|
-
var
|
|
3797
|
+
var $p = {
|
|
3637
3798
|
name: "ikon.client.logout",
|
|
3638
3799
|
description: "Clear the auth session and return to the login screen at the site root",
|
|
3639
3800
|
returnType: { kind: "boolean" }
|
|
3640
|
-
},
|
|
3641
|
-
function
|
|
3801
|
+
}, em = ["ikon-auth-", "ikon-live-snapshot"];
|
|
3802
|
+
function tm() {
|
|
3642
3803
|
if (typeof window > "u" || !window.localStorage) return !1;
|
|
3643
3804
|
try {
|
|
3644
3805
|
let e = [];
|
|
3645
3806
|
for (let t = 0; t < window.localStorage.length; t++) {
|
|
3646
3807
|
let n = window.localStorage.key(t);
|
|
3647
|
-
n &&
|
|
3808
|
+
n && em.some((e) => n.startsWith(e)) && e.push(n);
|
|
3648
3809
|
}
|
|
3649
3810
|
return e.forEach((e) => window.localStorage.removeItem(e)), setTimeout(() => window.location.replace(window.location.origin + "/"), 100), !0;
|
|
3650
3811
|
} catch {
|
|
3651
3812
|
return !1;
|
|
3652
3813
|
}
|
|
3653
3814
|
}
|
|
3654
|
-
var
|
|
3815
|
+
var nm = {
|
|
3655
3816
|
name: "ikon.client.login",
|
|
3656
3817
|
description: "Start the sign-in flow for an OAuth provider (e.g. google, microsoft)",
|
|
3657
3818
|
parameters: [{
|
|
@@ -3660,15 +3821,15 @@ var Lp = {
|
|
|
3660
3821
|
}],
|
|
3661
3822
|
returnType: { kind: "boolean" }
|
|
3662
3823
|
};
|
|
3663
|
-
async function
|
|
3824
|
+
async function rm(e) {
|
|
3664
3825
|
if (typeof window > "u" || typeof e != "string" || e.length === 0 || e === "guest" || e === "global" || e === "email" || e === "passkey") return !1;
|
|
3665
3826
|
let t = window.__IKON_AUTH_CONFIG__, n = t?.spaceId;
|
|
3666
3827
|
if (!n) return !1;
|
|
3667
|
-
if (
|
|
3668
|
-
let r = await
|
|
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)}` : "";
|
|
3669
3830
|
return window.location.href = `${r}/oauth/${encodeURIComponent(e)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`, !0;
|
|
3670
3831
|
}
|
|
3671
|
-
var
|
|
3832
|
+
var im = {
|
|
3672
3833
|
name: "ikon.client.loginShow",
|
|
3673
3834
|
description: "Show the login UI with an optional reason",
|
|
3674
3835
|
parameters: [{
|
|
@@ -3677,15 +3838,15 @@ var zp = {
|
|
|
3677
3838
|
}],
|
|
3678
3839
|
returnType: { kind: "boolean" }
|
|
3679
3840
|
};
|
|
3680
|
-
function
|
|
3681
|
-
return typeof window > "u" ? !1 : (
|
|
3841
|
+
function am(e) {
|
|
3842
|
+
return typeof window > "u" ? !1 : ($d(typeof e == "string" ? e : null), !0);
|
|
3682
3843
|
}
|
|
3683
|
-
var
|
|
3844
|
+
var om = {
|
|
3684
3845
|
name: "ikon.client.getLocation",
|
|
3685
3846
|
description: "Get the current GPS location",
|
|
3686
3847
|
returnType: { kind: "string" }
|
|
3687
3848
|
};
|
|
3688
|
-
function
|
|
3849
|
+
function sm() {
|
|
3689
3850
|
return typeof navigator > "u" || !navigator.geolocation ? Promise.resolve(null) : new Promise((e) => {
|
|
3690
3851
|
navigator.geolocation.getCurrentPosition((t) => {
|
|
3691
3852
|
e({
|
|
@@ -3699,15 +3860,15 @@ function Hp() {
|
|
|
3699
3860
|
});
|
|
3700
3861
|
});
|
|
3701
3862
|
}
|
|
3702
|
-
var
|
|
3703
|
-
function
|
|
3863
|
+
var cm = [], lm = !1;
|
|
3864
|
+
function um() {
|
|
3704
3865
|
return typeof window < "u" && "Notification" in window;
|
|
3705
3866
|
}
|
|
3706
|
-
function
|
|
3867
|
+
function dm(e, t, n, r) {
|
|
3707
3868
|
let i = {};
|
|
3708
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;
|
|
3709
3870
|
}
|
|
3710
|
-
function
|
|
3871
|
+
function fm(e, t, n, r) {
|
|
3711
3872
|
try {
|
|
3712
3873
|
let i = new Notification(e, t);
|
|
3713
3874
|
i.onclick = () => {
|
|
@@ -3722,40 +3883,40 @@ function qp(e, t, n, r) {
|
|
|
3722
3883
|
};
|
|
3723
3884
|
} catch {}
|
|
3724
3885
|
}
|
|
3725
|
-
function
|
|
3886
|
+
function pm() {
|
|
3726
3887
|
if (Notification.permission !== "granted") {
|
|
3727
|
-
|
|
3888
|
+
cm = [];
|
|
3728
3889
|
return;
|
|
3729
3890
|
}
|
|
3730
|
-
let e =
|
|
3731
|
-
|
|
3732
|
-
for (let t of e)
|
|
3891
|
+
let e = cm;
|
|
3892
|
+
cm = [];
|
|
3893
|
+
for (let t of e) fm(t.title, t.options, t.launchUrl, t.data);
|
|
3733
3894
|
}
|
|
3734
|
-
function
|
|
3735
|
-
if (
|
|
3736
|
-
|
|
3895
|
+
function mm() {
|
|
3896
|
+
if (lm || typeof window > "u") return;
|
|
3897
|
+
lm = !0;
|
|
3737
3898
|
let e = async () => {
|
|
3738
3899
|
try {
|
|
3739
3900
|
if (await Notification.requestPermission() === "granted") {
|
|
3740
|
-
|
|
3901
|
+
pm();
|
|
3741
3902
|
return;
|
|
3742
3903
|
}
|
|
3743
3904
|
} catch {}
|
|
3744
|
-
|
|
3905
|
+
cm = [];
|
|
3745
3906
|
}, t = () => {
|
|
3746
|
-
window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t),
|
|
3907
|
+
window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), lm = !1, e();
|
|
3747
3908
|
};
|
|
3748
3909
|
window.addEventListener("pointerdown", t), window.addEventListener("keydown", t);
|
|
3749
3910
|
}
|
|
3750
|
-
var
|
|
3911
|
+
var hm = {
|
|
3751
3912
|
name: "ikon.client.getNotificationPermission",
|
|
3752
3913
|
description: "Get the current notification permission state (granted, denied, default, or unsupported)",
|
|
3753
3914
|
returnType: { kind: "string" }
|
|
3754
3915
|
};
|
|
3755
|
-
function
|
|
3756
|
-
return
|
|
3916
|
+
function gm() {
|
|
3917
|
+
return um() ? Notification.permission : "unsupported";
|
|
3757
3918
|
}
|
|
3758
|
-
var
|
|
3919
|
+
var _m = {
|
|
3759
3920
|
name: "ikon.client.showNotification",
|
|
3760
3921
|
description: "Show a notification, requesting permission lazily on the first send",
|
|
3761
3922
|
returnType: { kind: "string" },
|
|
@@ -3801,33 +3962,33 @@ var Qp = {
|
|
|
3801
3962
|
}
|
|
3802
3963
|
]
|
|
3803
3964
|
};
|
|
3804
|
-
async function
|
|
3805
|
-
if (!
|
|
3806
|
-
let o = e.trim(), s =
|
|
3807
|
-
if (Notification.permission === "granted") return
|
|
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";
|
|
3808
3969
|
if (Notification.permission === "denied") return "denied";
|
|
3809
3970
|
try {
|
|
3810
3971
|
let e = await Notification.requestPermission();
|
|
3811
|
-
return e === "granted" &&
|
|
3972
|
+
return e === "granted" && fm(o, s, c, l), e;
|
|
3812
3973
|
} catch (e) {
|
|
3813
|
-
return
|
|
3974
|
+
return np(e) ? (cm.push({
|
|
3814
3975
|
title: o,
|
|
3815
3976
|
options: s,
|
|
3816
3977
|
launchUrl: c,
|
|
3817
3978
|
data: l
|
|
3818
|
-
}),
|
|
3979
|
+
}), mm(), "default") : "denied";
|
|
3819
3980
|
}
|
|
3820
3981
|
}
|
|
3821
|
-
var
|
|
3822
|
-
function
|
|
3823
|
-
|
|
3982
|
+
var ym = null;
|
|
3983
|
+
function bm(e) {
|
|
3984
|
+
ym = e ?? null;
|
|
3824
3985
|
}
|
|
3825
|
-
function
|
|
3986
|
+
function xm(e) {
|
|
3826
3987
|
let t = (e + "=".repeat((4 - e.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"), n = atob(t), r = new Uint8Array(n.length);
|
|
3827
3988
|
for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
|
|
3828
3989
|
return r;
|
|
3829
3990
|
}
|
|
3830
|
-
var
|
|
3991
|
+
var Sm = {
|
|
3831
3992
|
name: "ikon.client.getPushSubscription",
|
|
3832
3993
|
description: "Subscribe to Web Push and return the subscription, for offline push registration",
|
|
3833
3994
|
returnType: {
|
|
@@ -3835,14 +3996,14 @@ var rm = {
|
|
|
3835
3996
|
nullable: !0
|
|
3836
3997
|
}
|
|
3837
3998
|
};
|
|
3838
|
-
async function
|
|
3839
|
-
if (typeof window > "u" || !
|
|
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;
|
|
3840
4001
|
try {
|
|
3841
4002
|
let e = await navigator.serviceWorker.register("/push-service-worker.js");
|
|
3842
4003
|
await navigator.serviceWorker.ready;
|
|
3843
4004
|
let t = (await e.pushManager.getSubscription() ?? await e.pushManager.subscribe({
|
|
3844
4005
|
userVisibleOnly: !0,
|
|
3845
|
-
applicationServerKey:
|
|
4006
|
+
applicationServerKey: xm(ym.vapidPublicKey)
|
|
3846
4007
|
})).toJSON();
|
|
3847
4008
|
return !t.endpoint || !t.keys?.p256dh || !t.keys?.auth ? null : {
|
|
3848
4009
|
Platform: "web",
|
|
@@ -3855,225 +4016,225 @@ async function im() {
|
|
|
3855
4016
|
return null;
|
|
3856
4017
|
}
|
|
3857
4018
|
}
|
|
3858
|
-
var
|
|
4019
|
+
var wm = [
|
|
3859
4020
|
{
|
|
3860
|
-
definition:
|
|
3861
|
-
handler:
|
|
4021
|
+
definition: gp,
|
|
4022
|
+
handler: _p
|
|
3862
4023
|
},
|
|
3863
4024
|
{
|
|
3864
|
-
definition:
|
|
3865
|
-
handler:
|
|
4025
|
+
definition: vp,
|
|
4026
|
+
handler: yp
|
|
3866
4027
|
},
|
|
3867
4028
|
{
|
|
3868
|
-
definition:
|
|
3869
|
-
handler:
|
|
4029
|
+
definition: bp,
|
|
4030
|
+
handler: xp
|
|
3870
4031
|
},
|
|
3871
4032
|
{
|
|
3872
|
-
definition:
|
|
3873
|
-
handler:
|
|
4033
|
+
definition: Sp,
|
|
4034
|
+
handler: Cp
|
|
3874
4035
|
},
|
|
3875
4036
|
{
|
|
3876
|
-
definition:
|
|
3877
|
-
handler:
|
|
4037
|
+
definition: Dp,
|
|
4038
|
+
handler: Op
|
|
3878
4039
|
},
|
|
3879
4040
|
{
|
|
3880
|
-
definition:
|
|
3881
|
-
handler:
|
|
4041
|
+
definition: kp,
|
|
4042
|
+
handler: Ap
|
|
3882
4043
|
},
|
|
3883
4044
|
{
|
|
3884
|
-
definition:
|
|
3885
|
-
handler:
|
|
4045
|
+
definition: jp,
|
|
4046
|
+
handler: Mp
|
|
3886
4047
|
},
|
|
3887
4048
|
{
|
|
3888
|
-
definition:
|
|
3889
|
-
handler:
|
|
4049
|
+
definition: Np,
|
|
4050
|
+
handler: Pp
|
|
3890
4051
|
},
|
|
3891
4052
|
{
|
|
3892
|
-
definition:
|
|
3893
|
-
handler:
|
|
4053
|
+
definition: zp,
|
|
4054
|
+
handler: Bp
|
|
3894
4055
|
},
|
|
3895
4056
|
{
|
|
3896
|
-
definition:
|
|
3897
|
-
handler:
|
|
4057
|
+
definition: Vp,
|
|
4058
|
+
handler: Hp
|
|
3898
4059
|
},
|
|
3899
4060
|
{
|
|
3900
|
-
definition:
|
|
3901
|
-
handler:
|
|
4061
|
+
definition: Up,
|
|
4062
|
+
handler: Wp
|
|
3902
4063
|
},
|
|
3903
4064
|
{
|
|
3904
|
-
definition:
|
|
3905
|
-
handler:
|
|
4065
|
+
definition: Gp,
|
|
4066
|
+
handler: Kp
|
|
3906
4067
|
},
|
|
3907
4068
|
{
|
|
3908
|
-
definition:
|
|
3909
|
-
handler:
|
|
4069
|
+
definition: qp,
|
|
4070
|
+
handler: Jp
|
|
3910
4071
|
},
|
|
3911
4072
|
{
|
|
3912
|
-
definition:
|
|
3913
|
-
handler:
|
|
4073
|
+
definition: Yp,
|
|
4074
|
+
handler: Xp
|
|
3914
4075
|
},
|
|
3915
4076
|
{
|
|
3916
|
-
definition:
|
|
3917
|
-
handler:
|
|
4077
|
+
definition: Zp,
|
|
4078
|
+
handler: Qp
|
|
3918
4079
|
},
|
|
3919
4080
|
{
|
|
3920
|
-
definition:
|
|
3921
|
-
handler:
|
|
4081
|
+
definition: $p,
|
|
4082
|
+
handler: tm
|
|
3922
4083
|
},
|
|
3923
4084
|
{
|
|
3924
|
-
definition:
|
|
3925
|
-
handler:
|
|
4085
|
+
definition: nm,
|
|
4086
|
+
handler: rm
|
|
3926
4087
|
},
|
|
3927
4088
|
{
|
|
3928
|
-
definition:
|
|
3929
|
-
handler:
|
|
4089
|
+
definition: im,
|
|
4090
|
+
handler: am
|
|
3930
4091
|
},
|
|
3931
4092
|
{
|
|
3932
|
-
definition:
|
|
3933
|
-
handler:
|
|
4093
|
+
definition: om,
|
|
4094
|
+
handler: sm
|
|
3934
4095
|
},
|
|
3935
4096
|
{
|
|
3936
|
-
definition:
|
|
3937
|
-
handler:
|
|
4097
|
+
definition: hm,
|
|
4098
|
+
handler: gm
|
|
3938
4099
|
},
|
|
3939
4100
|
{
|
|
3940
|
-
definition:
|
|
3941
|
-
handler:
|
|
4101
|
+
definition: _m,
|
|
4102
|
+
handler: vm
|
|
3942
4103
|
},
|
|
3943
4104
|
{
|
|
3944
|
-
definition:
|
|
3945
|
-
handler:
|
|
4105
|
+
definition: Sm,
|
|
4106
|
+
handler: Cm
|
|
3946
4107
|
}
|
|
3947
4108
|
];
|
|
3948
|
-
function
|
|
3949
|
-
let t =
|
|
4109
|
+
function Tm(e) {
|
|
4110
|
+
let t = wm.map(({ definition: t, handler: n }) => e.register(t, n));
|
|
3950
4111
|
return () => t.forEach((e) => e());
|
|
3951
4112
|
}
|
|
3952
|
-
function
|
|
4113
|
+
function Em() {
|
|
3953
4114
|
return typeof window < "u" && typeof navigator < "u";
|
|
3954
4115
|
}
|
|
3955
4116
|
//#endregion
|
|
3956
4117
|
//#region src/utils/log-sink.ts
|
|
3957
|
-
var
|
|
3958
|
-
function
|
|
3959
|
-
e.level <
|
|
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)));
|
|
3960
4121
|
}
|
|
3961
|
-
function
|
|
3962
|
-
|
|
4122
|
+
function Nm(e) {
|
|
4123
|
+
km = e?.maxBufferSize ?? Dm, Am = e?.minLevel ?? Om, U = [], _e(Mm);
|
|
3963
4124
|
}
|
|
3964
|
-
function
|
|
3965
|
-
|
|
4125
|
+
function Pm(e) {
|
|
4126
|
+
jm = e;
|
|
3966
4127
|
}
|
|
3967
|
-
function
|
|
3968
|
-
return
|
|
4128
|
+
function Fm() {
|
|
4129
|
+
return U;
|
|
3969
4130
|
}
|
|
3970
|
-
function
|
|
3971
|
-
let e =
|
|
3972
|
-
return
|
|
4131
|
+
function Im() {
|
|
4132
|
+
let e = U;
|
|
4133
|
+
return U = [], e;
|
|
3973
4134
|
}
|
|
3974
|
-
function
|
|
3975
|
-
if (!
|
|
3976
|
-
let e =
|
|
3977
|
-
return
|
|
4135
|
+
function Lm() {
|
|
4136
|
+
if (!jm || U.length === 0) return 0;
|
|
4137
|
+
let e = Im();
|
|
4138
|
+
return jm(e), e.length;
|
|
3978
4139
|
}
|
|
3979
|
-
function
|
|
3980
|
-
|
|
4140
|
+
function Rm() {
|
|
4141
|
+
U = [];
|
|
3981
4142
|
}
|
|
3982
|
-
function
|
|
3983
|
-
return
|
|
4143
|
+
function zm() {
|
|
4144
|
+
return U.length;
|
|
3984
4145
|
}
|
|
3985
|
-
|
|
4146
|
+
Nm();
|
|
3986
4147
|
//#endregion
|
|
3987
4148
|
//#region src/utils/log-sender.ts
|
|
3988
|
-
var
|
|
3989
|
-
[C.DEBUG]:
|
|
3990
|
-
[C.INFO]:
|
|
3991
|
-
[C.WARN]:
|
|
3992
|
-
[C.ERROR]:
|
|
3993
|
-
},
|
|
3994
|
-
function
|
|
3995
|
-
return e.length <=
|
|
3996
|
-
}
|
|
3997
|
-
function
|
|
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) {
|
|
3998
4159
|
return {
|
|
3999
4160
|
Time: e.timestamp,
|
|
4000
|
-
Type:
|
|
4001
|
-
Message:
|
|
4161
|
+
Type: qm[e.level] ?? pe.Info,
|
|
4162
|
+
Message: Zm(`[${e.component}] ${e.message}`),
|
|
4002
4163
|
Parameters: "{}"
|
|
4003
4164
|
};
|
|
4004
4165
|
}
|
|
4005
|
-
function
|
|
4166
|
+
function $m(e) {
|
|
4006
4167
|
return JSON.stringify({
|
|
4007
4168
|
type: "sdk-typescript",
|
|
4008
4169
|
event: { Logs: e }
|
|
4009
4170
|
});
|
|
4010
4171
|
}
|
|
4011
|
-
function
|
|
4172
|
+
function eh(e) {
|
|
4012
4173
|
if (e.length === 0) return [];
|
|
4013
|
-
let t =
|
|
4174
|
+
let t = Gm - $m([]).length, n = [], r = [], i = 0;
|
|
4014
4175
|
for (let a of e) {
|
|
4015
4176
|
let e = JSON.stringify(a).length + 1;
|
|
4016
4177
|
r.length > 0 && i + e > t && (n.push(r), r = [], i = 0), r.push(a), i += e;
|
|
4017
4178
|
}
|
|
4018
4179
|
return r.length > 0 && n.push(r), n;
|
|
4019
4180
|
}
|
|
4020
|
-
async function
|
|
4021
|
-
if (e.length === 0 || !
|
|
4022
|
-
let t = `${
|
|
4181
|
+
async function th(e) {
|
|
4182
|
+
if (e.length === 0 || !W) return;
|
|
4183
|
+
let t = `${W}/events/logs/json`, n = {
|
|
4023
4184
|
"Content-Type": "application/json",
|
|
4024
|
-
Authorization: `Bearer ${
|
|
4185
|
+
Authorization: `Bearer ${Jm}`
|
|
4025
4186
|
}, r = await fetch(t, {
|
|
4026
4187
|
method: "POST",
|
|
4027
4188
|
headers: n,
|
|
4028
|
-
body:
|
|
4029
|
-
signal:
|
|
4189
|
+
body: $m(e),
|
|
4190
|
+
signal: B(Um)
|
|
4030
4191
|
});
|
|
4031
4192
|
if (!r.ok) {
|
|
4032
4193
|
if (r.status >= 400 && r.status < 500) {
|
|
4033
|
-
|
|
4194
|
+
Bm.warn(`Dropping ${e.length} log entries due to ${r.status}`);
|
|
4034
4195
|
return;
|
|
4035
4196
|
}
|
|
4036
4197
|
throw Error(`Failed to send logs: ${r.status}`);
|
|
4037
4198
|
}
|
|
4038
4199
|
}
|
|
4039
|
-
function
|
|
4040
|
-
if (
|
|
4041
|
-
let e =
|
|
4042
|
-
return Math.min(e,
|
|
4043
|
-
}
|
|
4044
|
-
function
|
|
4045
|
-
|
|
4046
|
-
}
|
|
4047
|
-
async function
|
|
4048
|
-
|
|
4049
|
-
let e =
|
|
4050
|
-
if (
|
|
4051
|
-
|
|
4200
|
+
function nh() {
|
|
4201
|
+
if (Ym === 0) return Vm;
|
|
4202
|
+
let e = Vm * (1 << Math.min(Ym, 6));
|
|
4203
|
+
return Math.min(e, Hm);
|
|
4204
|
+
}
|
|
4205
|
+
function rh(e) {
|
|
4206
|
+
W && (G = setTimeout(() => void ih(), e));
|
|
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);
|
|
4052
4213
|
return;
|
|
4053
4214
|
}
|
|
4054
|
-
if (
|
|
4055
|
-
|
|
4215
|
+
if (K.length === 0) {
|
|
4216
|
+
rh(Vm);
|
|
4056
4217
|
return;
|
|
4057
4218
|
}
|
|
4058
|
-
let t =
|
|
4059
|
-
|
|
4060
|
-
let n =
|
|
4219
|
+
let t = K;
|
|
4220
|
+
K = [];
|
|
4221
|
+
let n = eh(t), r = !1;
|
|
4061
4222
|
for (let e = 0; e < n.length; e++) try {
|
|
4062
|
-
await
|
|
4223
|
+
await th(n[e]);
|
|
4063
4224
|
} catch {
|
|
4064
|
-
|
|
4225
|
+
K = n.slice(e).flat().concat(K), r = !0;
|
|
4065
4226
|
break;
|
|
4066
4227
|
}
|
|
4067
|
-
r ?
|
|
4228
|
+
r ? Ym++ : Ym = 0, rh(nh());
|
|
4068
4229
|
}
|
|
4069
|
-
function
|
|
4070
|
-
|
|
4230
|
+
function ah() {
|
|
4231
|
+
G !== void 0 && (clearTimeout(G), G = void 0), rh(0);
|
|
4071
4232
|
}
|
|
4072
|
-
function
|
|
4073
|
-
|
|
4233
|
+
function oh(e, t) {
|
|
4234
|
+
ch(), W = e, Jm = t, Ym = 0, typeof window < "u" && (Xm = ah, window.addEventListener("online", Xm)), rh(Vm);
|
|
4074
4235
|
}
|
|
4075
|
-
function
|
|
4076
|
-
if (!
|
|
4236
|
+
function sh(e, t) {
|
|
4237
|
+
if (!W || !Jm) return;
|
|
4077
4238
|
let n = { Events: [{
|
|
4078
4239
|
Time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4079
4240
|
EventName: e,
|
|
@@ -4083,64 +4244,86 @@ function Vm(e, t) {
|
|
|
4083
4244
|
type: "sdk-typescript",
|
|
4084
4245
|
event: n
|
|
4085
4246
|
});
|
|
4086
|
-
fetch(`${
|
|
4247
|
+
fetch(`${W}/events/analytics/json`, {
|
|
4087
4248
|
method: "POST",
|
|
4088
4249
|
headers: {
|
|
4089
4250
|
"Content-Type": "application/json",
|
|
4090
|
-
Authorization: `Bearer ${
|
|
4251
|
+
Authorization: `Bearer ${Jm}`
|
|
4091
4252
|
},
|
|
4092
4253
|
body: r
|
|
4093
|
-
}).catch((t) =>
|
|
4254
|
+
}).catch((t) => Bm.warn(`Failed to send analytics event ${e}: ${t}`));
|
|
4094
4255
|
}
|
|
4095
|
-
function
|
|
4096
|
-
|
|
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;
|
|
4097
4258
|
}
|
|
4098
4259
|
//#endregion
|
|
4099
4260
|
//#region src/utils/connect-timeline.ts
|
|
4100
|
-
var
|
|
4101
|
-
function
|
|
4261
|
+
var lh = w("ConnectTimeline"), uh = "ikon-connect-trace-id", dh, fh = !1;
|
|
4262
|
+
function ph() {
|
|
4102
4263
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`;
|
|
4103
4264
|
}
|
|
4104
|
-
function
|
|
4265
|
+
function mh() {
|
|
4105
4266
|
try {
|
|
4106
|
-
let e = sessionStorage.getItem(
|
|
4267
|
+
let e = sessionStorage.getItem(uh);
|
|
4107
4268
|
if (e) return e;
|
|
4108
|
-
let t =
|
|
4109
|
-
return sessionStorage.setItem(
|
|
4269
|
+
let t = ph();
|
|
4270
|
+
return sessionStorage.setItem(uh, t), t;
|
|
4110
4271
|
} catch {
|
|
4111
|
-
return
|
|
4272
|
+
return dh ??= ph(), dh;
|
|
4112
4273
|
}
|
|
4113
4274
|
}
|
|
4114
|
-
function
|
|
4275
|
+
function hh(e) {
|
|
4115
4276
|
if (typeof performance > "u" || typeof performance.getEntriesByType != "function") return;
|
|
4116
4277
|
let t = performance.getEntriesByType("resource");
|
|
4117
4278
|
for (let n = t.length - 1; n >= 0; n--) if (t[n].name.includes(e)) return Math.round(t[n].duration);
|
|
4118
4279
|
}
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4280
|
+
var gh = [
|
|
4281
|
+
"/anonymous",
|
|
4282
|
+
"/init",
|
|
4283
|
+
"/connect"
|
|
4284
|
+
];
|
|
4285
|
+
function _h() {
|
|
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)));
|
|
4288
|
+
if (e.length === 0) return;
|
|
4289
|
+
let t = [], n = 0, r = 0, i = 0;
|
|
4290
|
+
for (let a of e) t.push(a.duration), a.transferSize === 0 && a.decodedBodySize === 0 ? i++ : a.transferSize === 0 ? r++ : n += a.transferSize;
|
|
4291
|
+
return t.sort((e, t) => e - t), {
|
|
4292
|
+
assetCount: e.length,
|
|
4293
|
+
assetBytes: Math.round(n),
|
|
4294
|
+
assetSlowestMs: Math.round(t[t.length - 1]),
|
|
4295
|
+
assetP95Ms: Math.round(t[Math.min(t.length - 1, Math.ceil(t.length * .95) - 1)]),
|
|
4296
|
+
assetCachedCount: r,
|
|
4297
|
+
assetOpaqueCount: i
|
|
4298
|
+
};
|
|
4299
|
+
}
|
|
4300
|
+
function vh(e = {}) {
|
|
4301
|
+
if (fh) return;
|
|
4302
|
+
fh = !0;
|
|
4303
|
+
let t = { connectTraceId: mh() };
|
|
4123
4304
|
e.snapshotSeeded !== void 0 && (t.snapshotSeeded = String(e.snapshotSeeded));
|
|
4124
4305
|
try {
|
|
4125
4306
|
if (typeof performance < "u") {
|
|
4126
4307
|
t.firstPaintMs = String(Math.round(performance.now()));
|
|
4127
4308
|
let e = performance.getEntriesByType("navigation")[0];
|
|
4128
4309
|
e && (t.cdnHtmlMs = String(Math.round(e.responseEnd - e.fetchStart)), t.domContentLoadedMs = String(Math.round(e.domContentLoadedEventEnd)));
|
|
4129
|
-
let n =
|
|
4310
|
+
let n = hh("/anonymous");
|
|
4130
4311
|
n !== void 0 && (t.authMs = String(n));
|
|
4131
|
-
let r =
|
|
4312
|
+
let r = hh("/init");
|
|
4132
4313
|
r !== void 0 && (t.initMs = String(r));
|
|
4133
|
-
let i =
|
|
4314
|
+
let i = hh("/connect");
|
|
4134
4315
|
i !== void 0 && (t.connectMs = String(i));
|
|
4316
|
+
let a = _h();
|
|
4317
|
+
if (a) for (let [e, n] of Object.entries(a)) t[e] = String(n);
|
|
4135
4318
|
}
|
|
4136
4319
|
} catch (e) {
|
|
4137
|
-
|
|
4320
|
+
lh.warn(`Failed to read performance timeline: ${e}`);
|
|
4138
4321
|
}
|
|
4139
|
-
|
|
4322
|
+
sh("client_connect_timeline", t);
|
|
4140
4323
|
}
|
|
4141
4324
|
//#endregion
|
|
4142
4325
|
//#region src/utils/uuid.ts
|
|
4143
|
-
function
|
|
4326
|
+
function yh() {
|
|
4144
4327
|
let e = globalThis.crypto;
|
|
4145
4328
|
if (e && typeof e.randomUUID == "function") return e.randomUUID();
|
|
4146
4329
|
let t = /* @__PURE__ */ new Uint8Array(16);
|
|
@@ -4153,34 +4336,34 @@ function Zm() {
|
|
|
4153
4336
|
}
|
|
4154
4337
|
//#endregion
|
|
4155
4338
|
//#region src/storage.ts
|
|
4156
|
-
var
|
|
4157
|
-
function
|
|
4158
|
-
if (typeof window > "u" || typeof localStorage > "u") return
|
|
4339
|
+
var bh = "ikon-device-id";
|
|
4340
|
+
function xh() {
|
|
4341
|
+
if (typeof window > "u" || typeof localStorage > "u") return yh();
|
|
4159
4342
|
try {
|
|
4160
|
-
let e = localStorage.getItem(
|
|
4161
|
-
return e || (e =
|
|
4343
|
+
let e = localStorage.getItem(bh);
|
|
4344
|
+
return e || (e = yh(), localStorage.setItem(bh, e)), e;
|
|
4162
4345
|
} catch {
|
|
4163
|
-
return
|
|
4346
|
+
return yh();
|
|
4164
4347
|
}
|
|
4165
4348
|
}
|
|
4166
|
-
function
|
|
4349
|
+
function Sh() {
|
|
4167
4350
|
if (!(typeof localStorage > "u")) try {
|
|
4168
|
-
localStorage.removeItem(
|
|
4351
|
+
localStorage.removeItem(bh);
|
|
4169
4352
|
} catch {}
|
|
4170
4353
|
}
|
|
4171
|
-
function
|
|
4172
|
-
let t =
|
|
4354
|
+
function Ch(e) {
|
|
4355
|
+
let t = Th(e);
|
|
4173
4356
|
return typeof t?.id == "string" ? t.id : null;
|
|
4174
4357
|
}
|
|
4175
|
-
function
|
|
4176
|
-
let t =
|
|
4358
|
+
function wh(e) {
|
|
4359
|
+
let t = Th(e);
|
|
4177
4360
|
return t ? {
|
|
4178
4361
|
userId: typeof t.id == "string" ? t.id : null,
|
|
4179
4362
|
authSession: typeof t.authSession == "string" ? t.authSession : null,
|
|
4180
4363
|
role: typeof t.role == "string" ? t.role : null
|
|
4181
4364
|
} : null;
|
|
4182
4365
|
}
|
|
4183
|
-
function
|
|
4366
|
+
function Th(e) {
|
|
4184
4367
|
try {
|
|
4185
4368
|
let t = e.split(".");
|
|
4186
4369
|
if (t.length !== 3) return null;
|
|
@@ -4192,8 +4375,16 @@ function rh(e) {
|
|
|
4192
4375
|
}
|
|
4193
4376
|
//#endregion
|
|
4194
4377
|
//#region src/connection/authenticator.ts
|
|
4195
|
-
var
|
|
4196
|
-
|
|
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;
|
|
4381
|
+
return {
|
|
4382
|
+
direct: e.url,
|
|
4383
|
+
proxy: e.proxyUrl,
|
|
4384
|
+
lb: t ?? void 0
|
|
4385
|
+
};
|
|
4386
|
+
}
|
|
4387
|
+
async function Bh(e, t, n, r) {
|
|
4197
4388
|
if (e) try {
|
|
4198
4389
|
let i = await fetch(`${n}/anonymous`, {
|
|
4199
4390
|
method: "POST",
|
|
@@ -4206,17 +4397,17 @@ async function _h(e, t, n, r) {
|
|
|
4206
4397
|
});
|
|
4207
4398
|
if (!i.ok) {
|
|
4208
4399
|
let e = await i.text().catch(() => "");
|
|
4209
|
-
|
|
4400
|
+
q.warn(`Anonymous auth failed: ${i.status} ${e}`.trim());
|
|
4210
4401
|
return;
|
|
4211
4402
|
}
|
|
4212
4403
|
let a = await i.json();
|
|
4213
4404
|
if (!a.token) {
|
|
4214
|
-
|
|
4405
|
+
q.warn("Anonymous auth returned no token");
|
|
4215
4406
|
return;
|
|
4216
4407
|
}
|
|
4217
|
-
let o =
|
|
4408
|
+
let o = Ch(a.token);
|
|
4218
4409
|
if (!o) {
|
|
4219
|
-
|
|
4410
|
+
q.warn("Anonymous auth token had no extractable userId");
|
|
4220
4411
|
return;
|
|
4221
4412
|
}
|
|
4222
4413
|
return {
|
|
@@ -4224,23 +4415,23 @@ async function _h(e, t, n, r) {
|
|
|
4224
4415
|
token: a.token
|
|
4225
4416
|
};
|
|
4226
4417
|
} catch (e) {
|
|
4227
|
-
|
|
4418
|
+
q.warn("Anonymous auth request failed:", e);
|
|
4228
4419
|
return;
|
|
4229
4420
|
}
|
|
4230
4421
|
}
|
|
4231
|
-
async function
|
|
4422
|
+
async function Vh(e, t, n, r) {
|
|
4232
4423
|
try {
|
|
4233
4424
|
let i = await fetch(`${e}/profiles/me?space=${encodeURIComponent(t)}`, {
|
|
4234
4425
|
method: "GET",
|
|
4235
4426
|
headers: { Authorization: `Bearer ${n}` },
|
|
4236
4427
|
signal: r
|
|
4237
4428
|
});
|
|
4238
|
-
i.ok ||
|
|
4429
|
+
i.ok || q.warn(`Failed to ensure profile: ${i.status}`);
|
|
4239
4430
|
} catch (e) {
|
|
4240
|
-
|
|
4431
|
+
q.warn("Failed to ensure profile:", e);
|
|
4241
4432
|
}
|
|
4242
4433
|
}
|
|
4243
|
-
async function
|
|
4434
|
+
async function Hh(e) {
|
|
4244
4435
|
let t = await e.text().catch(() => "Unknown error");
|
|
4245
4436
|
try {
|
|
4246
4437
|
let e = JSON.parse(t);
|
|
@@ -4248,16 +4439,16 @@ async function yh(e) {
|
|
|
4248
4439
|
} catch {}
|
|
4249
4440
|
return t;
|
|
4250
4441
|
}
|
|
4251
|
-
async function
|
|
4442
|
+
async function Uh(e) {
|
|
4252
4443
|
if (e.ok) return;
|
|
4253
|
-
let t = await
|
|
4254
|
-
throw e.status === 403 ? new ou(`Access denied: ${t}`, t) :
|
|
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);
|
|
4255
4446
|
}
|
|
4256
|
-
function
|
|
4447
|
+
function Wh(e, t, n) {
|
|
4257
4448
|
let r = `${e}: ${t} ${n}`;
|
|
4258
4449
|
return t >= 500 ? new lu(r, t) : new E(r);
|
|
4259
4450
|
}
|
|
4260
|
-
function
|
|
4451
|
+
function Gh(e, t, n) {
|
|
4261
4452
|
let r = {
|
|
4262
4453
|
method: "POST",
|
|
4263
4454
|
headers: {
|
|
@@ -4269,125 +4460,110 @@ function Sh(e, t, n) {
|
|
|
4269
4460
|
};
|
|
4270
4461
|
return t || (r.credentials = "include"), r;
|
|
4271
4462
|
}
|
|
4272
|
-
async function
|
|
4273
|
-
let i = `${e}/init`, a = await fetch(i,
|
|
4463
|
+
async function Kh(e, t, n, r) {
|
|
4464
|
+
let i = `${e}/init`, a = await fetch(i, Gh(t, n, r));
|
|
4274
4465
|
if (!a.ok) {
|
|
4275
|
-
let e = await
|
|
4276
|
-
throw a.status === 403 ? new ou(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new su(t.sessionIdentityHash) :
|
|
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);
|
|
4277
4468
|
}
|
|
4278
4469
|
return a.json();
|
|
4279
4470
|
}
|
|
4280
|
-
function
|
|
4471
|
+
function qh(e, t) {
|
|
4281
4472
|
return e.startupFailed ? new k() : new iu(t);
|
|
4282
4473
|
}
|
|
4283
|
-
async function
|
|
4284
|
-
e =
|
|
4285
|
-
let i =
|
|
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 });
|
|
4286
4477
|
if (!s.ok) {
|
|
4287
4478
|
let e = await s.text().catch(() => "Unknown error");
|
|
4288
|
-
throw s.status === 429 ? new cu(`Server is at capacity: ${e}`) : s.headers.get(
|
|
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);
|
|
4289
4480
|
}
|
|
4290
4481
|
let c = await s.arrayBuffer(), l = await ir(new Uint8Array(c));
|
|
4291
|
-
return
|
|
4482
|
+
return q.debug(`Connect URL fetched in ${Date.now() - o}ms`), { authResponse: l };
|
|
4292
4483
|
}
|
|
4293
|
-
async function
|
|
4484
|
+
async function Yh(e, t) {
|
|
4294
4485
|
try {
|
|
4295
|
-
let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i =
|
|
4486
|
+
let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = B(Mh), a = t ? sf([t, i]) : i;
|
|
4296
4487
|
return (await fetch(r, { signal: a })).ok;
|
|
4297
4488
|
} catch {
|
|
4298
4489
|
return !1;
|
|
4299
4490
|
}
|
|
4300
4491
|
}
|
|
4301
|
-
async function
|
|
4302
|
-
let
|
|
4303
|
-
|
|
4304
|
-
url: t
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
}), a.push({
|
|
4313
|
-
url: e,
|
|
4314
|
-
isProxy: !1
|
|
4315
|
-
})) : (a.push({
|
|
4316
|
-
url: e,
|
|
4317
|
-
isProxy: !1
|
|
4318
|
-
}), t && a.push({
|
|
4319
|
-
url: t,
|
|
4320
|
-
isProxy: !0
|
|
4321
|
-
})), a.length === 0) throw new E("No connect URL available");
|
|
4322
|
-
K.debug(`Auth URL order: [${a.map((e) => e.isProxy ? "proxy" : "direct").join(", ")}], mode: ${n}, proxyPreferred: ${r}`);
|
|
4323
|
-
let o = n === "auto" && a.length > 1 && !a[0].isProxy, s = Date.now(), c = 0;
|
|
4324
|
-
for (; c < ah || Date.now() - s < oh;) {
|
|
4325
|
-
for (let t = 0; t < a.length; t++) {
|
|
4326
|
-
let n = a[t], r = c === 0 && t === 0 && o ? lh : ch;
|
|
4492
|
+
async function Xh(e, t, n, r) {
|
|
4493
|
+
let i = Fd(R.filter((t) => e[t]), n, t).map((t) => ({
|
|
4494
|
+
tier: t,
|
|
4495
|
+
url: e[t]
|
|
4496
|
+
}));
|
|
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}`);
|
|
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;) {
|
|
4501
|
+
for (let t = 0; t < i.length; t++) {
|
|
4502
|
+
let n = i[t], o = s === 0 && t === 0 && a ? jh : Ah;
|
|
4327
4503
|
try {
|
|
4328
|
-
let t = await
|
|
4329
|
-
return t.usedProxyUrl = n.
|
|
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;
|
|
4330
4506
|
} catch (e) {
|
|
4331
|
-
if (
|
|
4332
|
-
|
|
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}`);
|
|
4333
4509
|
}
|
|
4334
4510
|
}
|
|
4335
|
-
|
|
4511
|
+
s++, await du(kh, r);
|
|
4336
4512
|
}
|
|
4337
4513
|
throw new E("Failed to connect after exhausting all URL attempts");
|
|
4338
4514
|
}
|
|
4339
|
-
function
|
|
4340
|
-
let t =
|
|
4515
|
+
function Zh(e = {}) {
|
|
4516
|
+
let t = mp();
|
|
4341
4517
|
return jt({
|
|
4342
4518
|
Description: "Ikon SDK TypeScript",
|
|
4343
4519
|
ProductId: "ikon-sdk",
|
|
4344
4520
|
VersionId: "1.0.0",
|
|
4345
|
-
DeviceId:
|
|
4521
|
+
DeviceId: xh(),
|
|
4346
4522
|
Locale: typeof navigator < "u" ? navigator.language : "en-US",
|
|
4347
4523
|
UserAgent: typeof navigator < "u" ? navigator.userAgent : "",
|
|
4348
|
-
ClientType:
|
|
4349
|
-
SdkCapability:
|
|
4524
|
+
ClientType: Ep(),
|
|
4525
|
+
SdkCapability: Lh,
|
|
4350
4526
|
ProtocolVersion: 1,
|
|
4351
|
-
PayloadType:
|
|
4527
|
+
PayloadType: S.Teleport,
|
|
4352
4528
|
SupportsCompression: De(),
|
|
4353
4529
|
ViewportWidth: t.width,
|
|
4354
4530
|
ViewportHeight: t.height,
|
|
4355
|
-
Theme:
|
|
4356
|
-
Timezone:
|
|
4357
|
-
IsTouchDevice:
|
|
4358
|
-
InitialPath:
|
|
4359
|
-
InitialUrl:
|
|
4360
|
-
IsSnapshot:
|
|
4531
|
+
Theme: pp(),
|
|
4532
|
+
Timezone: wp(),
|
|
4533
|
+
IsTouchDevice: Tp(),
|
|
4534
|
+
InitialPath: Nf(),
|
|
4535
|
+
InitialUrl: Pf(),
|
|
4536
|
+
IsSnapshot: qu(),
|
|
4361
4537
|
...e
|
|
4362
4538
|
});
|
|
4363
4539
|
}
|
|
4364
|
-
function
|
|
4365
|
-
if (e.includes(`${
|
|
4366
|
-
let n =
|
|
4367
|
-
return `${e}${e.includes("?") ? "&" : "?"}${
|
|
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}`;
|
|
4368
4544
|
}
|
|
4369
|
-
function
|
|
4545
|
+
function $h(e) {
|
|
4370
4546
|
let t = "";
|
|
4371
4547
|
for (let n of e) t += String.fromCharCode(n);
|
|
4372
4548
|
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
4373
4549
|
}
|
|
4374
|
-
function
|
|
4550
|
+
function eg(e, t, n = "", r = !0) {
|
|
4375
4551
|
return Ft({
|
|
4376
4552
|
ServerSessionId: "",
|
|
4377
4553
|
ContextType: m.Browser,
|
|
4378
4554
|
UserType: p.Human,
|
|
4379
4555
|
IsInternal: !1,
|
|
4380
4556
|
UserId: t,
|
|
4381
|
-
OpcodeGroupsFromServer: e.opcodeGroupsFromServer ??
|
|
4382
|
-
OpcodeGroupsToServer: e.opcodeGroupsToServer ??
|
|
4557
|
+
OpcodeGroupsFromServer: e.opcodeGroupsFromServer ?? Eh,
|
|
4558
|
+
OpcodeGroupsToServer: e.opcodeGroupsToServer ?? Eh,
|
|
4383
4559
|
AuthSessionId: n,
|
|
4384
4560
|
IsAnonymous: r,
|
|
4385
4561
|
IsGlobal: !1,
|
|
4386
4562
|
Parameters: e.parameters ?? {}
|
|
4387
4563
|
});
|
|
4388
4564
|
}
|
|
4389
|
-
function
|
|
4390
|
-
return
|
|
4565
|
+
function tg(e) {
|
|
4566
|
+
return Zh({
|
|
4391
4567
|
...e.description === void 0 ? {} : { Description: e.description },
|
|
4392
4568
|
...e.deviceId === void 0 ? {} : { DeviceId: e.deviceId },
|
|
4393
4569
|
...e.productId === void 0 ? {} : { ProductId: e.productId },
|
|
@@ -4396,7 +4572,7 @@ function Mh(e) {
|
|
|
4396
4572
|
...e.locale === void 0 ? {} : { Locale: e.locale }
|
|
4397
4573
|
});
|
|
4398
4574
|
}
|
|
4399
|
-
function
|
|
4575
|
+
function ng(e) {
|
|
4400
4576
|
return {
|
|
4401
4577
|
ServerSessionId: e.ServerSessionId,
|
|
4402
4578
|
ContextType: e.ContextType,
|
|
@@ -4411,26 +4587,26 @@ function Nh(e) {
|
|
|
4411
4587
|
Parameters: e.Parameters
|
|
4412
4588
|
};
|
|
4413
4589
|
}
|
|
4414
|
-
async function
|
|
4590
|
+
async function rg(e, t) {
|
|
4415
4591
|
let n = `https://${e.host}:${e.httpsPort}`;
|
|
4416
|
-
|
|
4592
|
+
q.debug(`Authenticating with local server: ${n}`);
|
|
4417
4593
|
let r = {
|
|
4418
|
-
...
|
|
4594
|
+
...Of(),
|
|
4419
4595
|
...e.parameters
|
|
4420
|
-
}, i = e.deviceId ??
|
|
4596
|
+
}, i = e.deviceId ?? xh(), a = e.userId, o = e.token;
|
|
4421
4597
|
if (!a) {
|
|
4422
|
-
let n = await
|
|
4598
|
+
let n = await Bh(e.spaceId, i, await Ef(e.authUrl), t);
|
|
4423
4599
|
n && (a = n.userId, o = n.token);
|
|
4424
4600
|
}
|
|
4425
|
-
if (a || (a = i,
|
|
4426
|
-
let n =
|
|
4427
|
-
await
|
|
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)}`, {
|
|
4428
4604
|
method: "GET",
|
|
4429
4605
|
headers: { Authorization: `Bearer ${o}` },
|
|
4430
4606
|
signal: t
|
|
4431
4607
|
}));
|
|
4432
|
-
} else await
|
|
4433
|
-
let s = e.token ?? e.identityToken ?? o, c = s ?
|
|
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({
|
|
4434
4610
|
...e,
|
|
4435
4611
|
parameters: r
|
|
4436
4612
|
}, a, l, u)), f = await fetch(`${n}/connect-token`, {
|
|
@@ -4441,16 +4617,16 @@ async function Ph(e, t) {
|
|
|
4441
4617
|
});
|
|
4442
4618
|
if (!f.ok) {
|
|
4443
4619
|
let e = await f.text().catch(() => "Unknown error");
|
|
4444
|
-
throw
|
|
4620
|
+
throw Wh("Failed to get connect token", f.status, e);
|
|
4445
4621
|
}
|
|
4446
4622
|
let p = (await f.json()).token;
|
|
4447
4623
|
if (!p) throw new E("Server did not return a token");
|
|
4448
|
-
let m = `${n}/connect?token=${encodeURIComponent(p)}`, h = await
|
|
4449
|
-
return h.directUrl = m, h.backendUrl =
|
|
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;
|
|
4450
4626
|
}
|
|
4451
|
-
async function
|
|
4452
|
-
let i =
|
|
4453
|
-
|
|
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}`);
|
|
4454
4630
|
let a = await fetch(`${i}/auth/api-key`, {
|
|
4455
4631
|
method: "POST",
|
|
4456
4632
|
headers: { "Content-Type": "application/json" },
|
|
@@ -4463,14 +4639,14 @@ async function Fh(e, t, n = "auto", r = !1) {
|
|
|
4463
4639
|
});
|
|
4464
4640
|
if (!a.ok) {
|
|
4465
4641
|
let e = await a.text().catch(() => "Unknown error");
|
|
4466
|
-
throw
|
|
4642
|
+
throw Wh("API key authentication failed", a.status, e);
|
|
4467
4643
|
}
|
|
4468
4644
|
let o = (await a.json()).token;
|
|
4469
4645
|
if (!o) throw new E("Backend did not return a token");
|
|
4470
|
-
let s =
|
|
4646
|
+
let s = Of(), c = e.provisioningTimeoutMs ?? 6e4, l = {
|
|
4471
4647
|
...s,
|
|
4472
4648
|
...e.parameters
|
|
4473
|
-
}, u =
|
|
4649
|
+
}, u = mp(), d = M() ? Nh : 1;
|
|
4474
4650
|
for (let a = 0; a < d; a++) try {
|
|
4475
4651
|
let a = {
|
|
4476
4652
|
space: e.spaceId,
|
|
@@ -4478,50 +4654,50 @@ async function Fh(e, t, n = "auto", r = !1) {
|
|
|
4478
4654
|
params: e.parameters,
|
|
4479
4655
|
waitForRunning: !0,
|
|
4480
4656
|
waitForRunningTimeoutMs: c,
|
|
4481
|
-
connectTraceId:
|
|
4657
|
+
connectTraceId: mh(),
|
|
4482
4658
|
contextType: m.Plugin,
|
|
4483
4659
|
userType: e.userType ?? p.Human,
|
|
4484
|
-
clientType: e.clientType ??
|
|
4485
|
-
payloadType:
|
|
4660
|
+
clientType: e.clientType ?? Ep(),
|
|
4661
|
+
payloadType: S.Teleport,
|
|
4486
4662
|
description: e.description ?? "Ikon SDK TypeScript",
|
|
4487
|
-
deviceId: e.deviceId ??
|
|
4663
|
+
deviceId: e.deviceId ?? xh(),
|
|
4488
4664
|
productId: e.productId ?? "",
|
|
4489
4665
|
versionId: e.versionId ?? "",
|
|
4490
4666
|
installId: e.installId ?? "",
|
|
4491
4667
|
locale: e.locale ?? (typeof navigator < "u" ? navigator.language : "en-US"),
|
|
4492
|
-
opcodeGroupsFromServer: e.opcodeGroupsFromServer ??
|
|
4493
|
-
opcodeGroupsToServer: e.opcodeGroupsToServer ??
|
|
4668
|
+
opcodeGroupsFromServer: e.opcodeGroupsFromServer ?? Eh,
|
|
4669
|
+
opcodeGroupsToServer: e.opcodeGroupsToServer ?? Eh,
|
|
4494
4670
|
protocolVersion: 1,
|
|
4495
4671
|
userAgent: typeof navigator < "u" ? navigator.userAgent : "",
|
|
4496
4672
|
launchParams: l,
|
|
4497
4673
|
viewportWidth: u.width,
|
|
4498
4674
|
viewportHeight: u.height,
|
|
4499
|
-
theme:
|
|
4500
|
-
timezone:
|
|
4501
|
-
isTouchDevice:
|
|
4502
|
-
initialPath:
|
|
4503
|
-
initialUrl:
|
|
4675
|
+
theme: pp(),
|
|
4676
|
+
timezone: wp(),
|
|
4677
|
+
isTouchDevice: Tp(),
|
|
4678
|
+
initialPath: Nf(),
|
|
4679
|
+
initialUrl: Pf(),
|
|
4504
4680
|
sdkType: 2,
|
|
4505
|
-
sdkCapability:
|
|
4681
|
+
sdkCapability: Lh,
|
|
4506
4682
|
supportsCompression: De(),
|
|
4507
|
-
isSnapshot:
|
|
4508
|
-
}, s = t ?
|
|
4509
|
-
if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw
|
|
4510
|
-
let f = await
|
|
4511
|
-
return f.backendUrl = i, f.authToken = o, f.brandingRequired = d.configuration.brandingRequired ?? !1,
|
|
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;
|
|
4512
4688
|
} catch (e) {
|
|
4513
4689
|
if (e instanceof ou || e instanceof cu || e instanceof su || e instanceof k || a === d - 1) throw e;
|
|
4514
|
-
|
|
4690
|
+
q.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await du(Ih * (a + 1), t);
|
|
4515
4691
|
}
|
|
4516
4692
|
throw new E("Failed to init after all attempts");
|
|
4517
4693
|
}
|
|
4518
|
-
async function
|
|
4519
|
-
let i =
|
|
4520
|
-
|
|
4521
|
-
let o =
|
|
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 = {
|
|
4522
4698
|
...o,
|
|
4523
4699
|
...e.parameters
|
|
4524
|
-
}, l =
|
|
4700
|
+
}, l = mp(), u = M() ? Nh : 1;
|
|
4525
4701
|
for (let o = 0; o < u; o++) try {
|
|
4526
4702
|
let o = {
|
|
4527
4703
|
space: e.spaceId,
|
|
@@ -4529,57 +4705,57 @@ async function Ih(e, t, n = "auto", r = !1) {
|
|
|
4529
4705
|
params: e.parameters,
|
|
4530
4706
|
waitForRunning: !0,
|
|
4531
4707
|
waitForRunningTimeoutMs: s,
|
|
4532
|
-
connectTraceId:
|
|
4708
|
+
connectTraceId: mh(),
|
|
4533
4709
|
contextType: m.Browser,
|
|
4534
4710
|
userType: p.Human,
|
|
4535
|
-
clientType:
|
|
4536
|
-
payloadType:
|
|
4711
|
+
clientType: Ep(),
|
|
4712
|
+
payloadType: S.Teleport,
|
|
4537
4713
|
description: e.description ?? "Ikon SDK TypeScript",
|
|
4538
|
-
deviceId: e.deviceId ??
|
|
4714
|
+
deviceId: e.deviceId ?? xh(),
|
|
4539
4715
|
productId: e.productId ?? "",
|
|
4540
4716
|
versionId: e.versionId ?? "",
|
|
4541
4717
|
installId: e.installId ?? "",
|
|
4542
4718
|
locale: e.locale ?? (typeof navigator < "u" ? navigator.language : "en-US"),
|
|
4543
|
-
opcodeGroupsFromServer: e.opcodeGroupsFromServer ??
|
|
4544
|
-
opcodeGroupsToServer: e.opcodeGroupsToServer ??
|
|
4719
|
+
opcodeGroupsFromServer: e.opcodeGroupsFromServer ?? Eh,
|
|
4720
|
+
opcodeGroupsToServer: e.opcodeGroupsToServer ?? Eh,
|
|
4545
4721
|
protocolVersion: 1,
|
|
4546
4722
|
userAgent: typeof navigator < "u" ? navigator.userAgent : "",
|
|
4547
4723
|
launchParams: c,
|
|
4548
4724
|
viewportWidth: l.width,
|
|
4549
4725
|
viewportHeight: l.height,
|
|
4550
|
-
theme:
|
|
4551
|
-
timezone:
|
|
4552
|
-
isTouchDevice:
|
|
4553
|
-
initialPath:
|
|
4554
|
-
initialUrl:
|
|
4726
|
+
theme: pp(),
|
|
4727
|
+
timezone: wp(),
|
|
4728
|
+
isTouchDevice: Tp(),
|
|
4729
|
+
initialPath: Nf(),
|
|
4730
|
+
initialUrl: Pf(),
|
|
4555
4731
|
sdkType: 2,
|
|
4556
|
-
sdkCapability:
|
|
4732
|
+
sdkCapability: Lh,
|
|
4557
4733
|
supportsCompression: De(),
|
|
4558
|
-
isSnapshot:
|
|
4559
|
-
}, u = t ?
|
|
4560
|
-
if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw
|
|
4561
|
-
let f = await
|
|
4562
|
-
return f.backendUrl = i, f.authToken = a, f.brandingRequired = d.configuration.brandingRequired ?? !1,
|
|
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;
|
|
4563
4739
|
} catch (e) {
|
|
4564
4740
|
if (e instanceof ou || e instanceof cu || e instanceof su || e instanceof k || o === u - 1) throw e;
|
|
4565
|
-
|
|
4741
|
+
q.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await du(Ih * (o + 1), t);
|
|
4566
4742
|
}
|
|
4567
4743
|
throw new E("Failed to init after all attempts");
|
|
4568
4744
|
}
|
|
4569
4745
|
//#endregion
|
|
4570
4746
|
//#region src/functions/type-conversion.ts
|
|
4571
|
-
var
|
|
4572
|
-
function
|
|
4747
|
+
var og = /* @__PURE__ */ new Uint8Array();
|
|
4748
|
+
function sg(e) {
|
|
4573
4749
|
switch (e.kind) {
|
|
4574
4750
|
case "array": return {
|
|
4575
4751
|
kind: "array",
|
|
4576
|
-
element:
|
|
4752
|
+
element: sg(e.element),
|
|
4577
4753
|
nullable: e.nullable ?? !1
|
|
4578
4754
|
};
|
|
4579
4755
|
case "dictionary": return {
|
|
4580
4756
|
kind: "dictionary",
|
|
4581
4757
|
keyType: e.keyType ?? "string",
|
|
4582
|
-
value:
|
|
4758
|
+
value: sg(e.value),
|
|
4583
4759
|
nullable: e.nullable ?? !1
|
|
4584
4760
|
};
|
|
4585
4761
|
default: return {
|
|
@@ -4588,17 +4764,17 @@ function Rh(e) {
|
|
|
4588
4764
|
};
|
|
4589
4765
|
}
|
|
4590
4766
|
}
|
|
4591
|
-
function
|
|
4767
|
+
function cg(e) {
|
|
4592
4768
|
switch (e.kind) {
|
|
4593
4769
|
case "boolean": return "System.Boolean";
|
|
4594
4770
|
case "number": return "System.Double";
|
|
4595
4771
|
case "string": return "System.String";
|
|
4596
|
-
case "array": return `System.Collections.Generic.List\`1[${
|
|
4597
|
-
case "dictionary": return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "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)}]`;
|
|
4598
4774
|
default: return e;
|
|
4599
4775
|
}
|
|
4600
4776
|
}
|
|
4601
|
-
function
|
|
4777
|
+
function lg(e, t) {
|
|
4602
4778
|
if (e === void 0 || e === "") return;
|
|
4603
4779
|
let n = JSON.parse(e);
|
|
4604
4780
|
if (n === null) {
|
|
@@ -4607,7 +4783,7 @@ function Bh(e, t) {
|
|
|
4607
4783
|
}
|
|
4608
4784
|
return n;
|
|
4609
4785
|
}
|
|
4610
|
-
function
|
|
4786
|
+
function ug(e, t) {
|
|
4611
4787
|
if (e === void 0) return "null";
|
|
4612
4788
|
if (e === null) {
|
|
4613
4789
|
if (!t.nullable) throw Error("Value cannot be null for non-nullable type");
|
|
@@ -4615,9 +4791,9 @@ function Vh(e, t) {
|
|
|
4615
4791
|
}
|
|
4616
4792
|
return JSON.stringify(e);
|
|
4617
4793
|
}
|
|
4618
|
-
function
|
|
4794
|
+
function dg(e, t) {
|
|
4619
4795
|
let r = (e.parameters ?? []).map((e) => {
|
|
4620
|
-
let t =
|
|
4796
|
+
let t = sg(e.type), n = Object.prototype.hasOwnProperty.call(e, "defaultValue"), r = n ? ug(e.defaultValue, t) : "";
|
|
4621
4797
|
return {
|
|
4622
4798
|
name: e.name,
|
|
4623
4799
|
descriptor: t,
|
|
@@ -4625,7 +4801,7 @@ function Hh(e, t) {
|
|
|
4625
4801
|
defaultValueJson: r,
|
|
4626
4802
|
description: e.description
|
|
4627
4803
|
};
|
|
4628
|
-
}), i =
|
|
4804
|
+
}), i = sg(e.returnType);
|
|
4629
4805
|
return {
|
|
4630
4806
|
definition: e,
|
|
4631
4807
|
handler: t,
|
|
@@ -4635,7 +4811,7 @@ function Hh(e, t) {
|
|
|
4635
4811
|
Description: e.description ?? "",
|
|
4636
4812
|
LlmInlineResult: e.llmInlineResult ?? !1,
|
|
4637
4813
|
LlmCallOnlyOnce: e.llmCallOnlyOnce ?? !1,
|
|
4638
|
-
ResultTypeName:
|
|
4814
|
+
ResultTypeName: cg(i),
|
|
4639
4815
|
IsEnumerable: !1,
|
|
4640
4816
|
EnumerableItemTypeName: "",
|
|
4641
4817
|
IsCancellable: !1,
|
|
@@ -4644,10 +4820,10 @@ function Hh(e, t) {
|
|
|
4644
4820
|
Parameters: r.map((e, t) => ({
|
|
4645
4821
|
ParameterIndex: t,
|
|
4646
4822
|
ParameterName: e.name,
|
|
4647
|
-
TypeName:
|
|
4823
|
+
TypeName: cg(e.descriptor),
|
|
4648
4824
|
HasDefaultValue: e.hasDefaultValue,
|
|
4649
4825
|
DefaultValueJson: e.defaultValueJson,
|
|
4650
|
-
DefaultValueData:
|
|
4826
|
+
DefaultValueData: og,
|
|
4651
4827
|
IsEnumerable: !1,
|
|
4652
4828
|
EnumerableItemTypeName: "",
|
|
4653
4829
|
Description: e.description ?? ""
|
|
@@ -4659,24 +4835,24 @@ function Hh(e, t) {
|
|
|
4659
4835
|
}
|
|
4660
4836
|
//#endregion
|
|
4661
4837
|
//#region src/functions/types.ts
|
|
4662
|
-
function
|
|
4838
|
+
function fg(e, t) {
|
|
4663
4839
|
return {
|
|
4664
4840
|
value: e,
|
|
4665
4841
|
data: t
|
|
4666
4842
|
};
|
|
4667
4843
|
}
|
|
4668
|
-
var
|
|
4844
|
+
var pg = class extends Error {
|
|
4669
4845
|
remoteErrorType;
|
|
4670
4846
|
remoteStackTrace;
|
|
4671
4847
|
code;
|
|
4672
4848
|
constructor(e, t, n, r = "") {
|
|
4673
4849
|
super(e), this.remoteErrorType = t, this.remoteStackTrace = n, this.code = r, this.name = "FunctionCallError";
|
|
4674
4850
|
}
|
|
4675
|
-
},
|
|
4676
|
-
function
|
|
4851
|
+
}, mg = w("FunctionRegistry"), hg = /* @__PURE__ */ new Uint8Array(), gg = 3e4;
|
|
4852
|
+
function _g(e) {
|
|
4677
4853
|
return !e || typeof e != "object" ? !1 : e.data instanceof Uint8Array;
|
|
4678
4854
|
}
|
|
4679
|
-
var
|
|
4855
|
+
var vg = class {
|
|
4680
4856
|
functions = /* @__PURE__ */ new Map();
|
|
4681
4857
|
remoteFunctions = /* @__PURE__ */ new Map();
|
|
4682
4858
|
pendingCalls = /* @__PURE__ */ new Map();
|
|
@@ -4698,7 +4874,7 @@ var Yh = class {
|
|
|
4698
4874
|
};
|
|
4699
4875
|
}
|
|
4700
4876
|
register(e, t) {
|
|
4701
|
-
let n =
|
|
4877
|
+
let n = dg(e, t);
|
|
4702
4878
|
return this.functions.set(e.name, n), this.isConnected && this.config && this.sendRegistration(n), () => this.unregister(e.name);
|
|
4703
4879
|
}
|
|
4704
4880
|
unregister(e) {
|
|
@@ -4739,7 +4915,7 @@ var Yh = class {
|
|
|
4739
4915
|
ParameterIndex: t,
|
|
4740
4916
|
TypeName: n ? n.TypeName : this.inferTypeName(e),
|
|
4741
4917
|
ValueJson: JSON.stringify(e ?? null),
|
|
4742
|
-
ValueData:
|
|
4918
|
+
ValueData: hg
|
|
4743
4919
|
});
|
|
4744
4920
|
}), c = r?.instanceId ? n.fromString(r.instanceId) : n.createZero(), l = jr(wr({
|
|
4745
4921
|
FunctionId: n.fromString(i.id),
|
|
@@ -4752,8 +4928,8 @@ var Yh = class {
|
|
|
4752
4928
|
}), this.config.sessionId, { targetIds: [i.clientSessionId] });
|
|
4753
4929
|
return new Promise((t, n) => {
|
|
4754
4930
|
let r = setTimeout(() => {
|
|
4755
|
-
this.pendingCalls.delete(o.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${
|
|
4756
|
-
},
|
|
4931
|
+
this.pendingCalls.delete(o.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${gg}ms`));
|
|
4932
|
+
}, gg);
|
|
4757
4933
|
this.pendingCalls.set(o.toString(), {
|
|
4758
4934
|
resolve: t,
|
|
4759
4935
|
reject: n,
|
|
@@ -4820,7 +4996,7 @@ var Yh = class {
|
|
|
4820
4996
|
if (t === T.ACTION_FUNCTION_CALL) {
|
|
4821
4997
|
let t = i(e);
|
|
4822
4998
|
return this.handleFunctionCall(e, t.senderId).catch((e) => {
|
|
4823
|
-
|
|
4999
|
+
mg.error("Failed to handle function call:", e);
|
|
4824
5000
|
}), !0;
|
|
4825
5001
|
}
|
|
4826
5002
|
if (t === T.ACTION_FUNCTION_RESULT) return this.handleFunctionResult(e), !0;
|
|
@@ -4842,7 +5018,7 @@ var Yh = class {
|
|
|
4842
5018
|
handleFunctionResult(e) {
|
|
4843
5019
|
let t = ja(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
|
|
4844
5020
|
if (!r) {
|
|
4845
|
-
|
|
5021
|
+
mg.warn(`Received result for unknown call: ${n}`);
|
|
4846
5022
|
return;
|
|
4847
5023
|
}
|
|
4848
5024
|
if (this.pendingCalls.delete(n), clearTimeout(r.timeout), t.ResultData && t.ResultData.length > 0 && !t.ResultJson) {
|
|
@@ -4855,11 +5031,11 @@ var Yh = class {
|
|
|
4855
5031
|
handleFunctionError(e) {
|
|
4856
5032
|
let t = yi(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
|
|
4857
5033
|
if (!r) {
|
|
4858
|
-
|
|
5034
|
+
mg.warn(`Received error for unknown call: ${n}`);
|
|
4859
5035
|
return;
|
|
4860
5036
|
}
|
|
4861
5037
|
this.pendingCalls.delete(n), clearTimeout(r.timeout);
|
|
4862
|
-
let i = new
|
|
5038
|
+
let i = new pg(t.ErrorMessage, t.ErrorTypeName, t.StackTrace, t.ErrorCode), a = {
|
|
4863
5039
|
functionName: r.functionName,
|
|
4864
5040
|
args: r.args
|
|
4865
5041
|
};
|
|
@@ -4895,7 +5071,7 @@ var Yh = class {
|
|
|
4895
5071
|
async handleFunctionCall(e, t) {
|
|
4896
5072
|
let n = await Mr(e), r = this.functions.get(n.FunctionName);
|
|
4897
5073
|
if (!r) {
|
|
4898
|
-
|
|
5074
|
+
mg.warn(`Received call for unknown function: ${n.FunctionName}`), this.sendError(n.CallId, n.InstanceId, t, /* @__PURE__ */ Error(`Unknown function: ${n.FunctionName}`));
|
|
4899
5075
|
return;
|
|
4900
5076
|
}
|
|
4901
5077
|
this.sendAck(n.CallId, n.InstanceId, t), this.executeFunction(r, n, t);
|
|
@@ -4910,14 +5086,14 @@ var Yh = class {
|
|
|
4910
5086
|
continue;
|
|
4911
5087
|
}
|
|
4912
5088
|
let o = a?.ValueJson;
|
|
4913
|
-
o === void 0 || o === "" ? i.hasDefaultValue ? r.push(
|
|
5089
|
+
o === void 0 || o === "" ? i.hasDefaultValue ? r.push(lg(i.defaultValueJson, i.descriptor)) : r.push(void 0) : r.push(lg(o, i.descriptor));
|
|
4914
5090
|
}
|
|
4915
|
-
let i = await e.handler(...r), a = i, o =
|
|
4916
|
-
|
|
4917
|
-
let s =
|
|
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);
|
|
4918
5094
|
this.sendResult(t.CallId, t.InstanceId, n, e, s, o);
|
|
4919
5095
|
} catch (e) {
|
|
4920
|
-
|
|
5096
|
+
mg.error(`Function ${t.FunctionName} execution failed:`, e), this.sendError(t.CallId, t.InstanceId, n, e instanceof Error ? e : Error(String(e)));
|
|
4921
5097
|
}
|
|
4922
5098
|
}
|
|
4923
5099
|
sendAck(e, t, n) {
|
|
@@ -4933,7 +5109,7 @@ var Yh = class {
|
|
|
4933
5109
|
let o = Aa(Ca({
|
|
4934
5110
|
CallId: e,
|
|
4935
5111
|
InstanceId: t,
|
|
4936
|
-
ResultTypeName:
|
|
5112
|
+
ResultTypeName: cg(r.returnType),
|
|
4937
5113
|
ResultJson: i,
|
|
4938
5114
|
ResultData: a
|
|
4939
5115
|
}), this.config.sessionId, { targetIds: [n] });
|
|
@@ -4950,7 +5126,7 @@ var Yh = class {
|
|
|
4950
5126
|
}), this.config.sessionId, { targetIds: [n] });
|
|
4951
5127
|
this.config.sendProtocolMessage(i);
|
|
4952
5128
|
}
|
|
4953
|
-
},
|
|
5129
|
+
}, yg = w("ReactiveRegistry"), bg = "Ikon.Reactive.Subscribe", xg = "Ikon.Reactive.Unsubscribe", Sg = {
|
|
4954
5130
|
name: "Ikon.Reactive.Update",
|
|
4955
5131
|
description: "Receives reactive value updates pushed from the server when a subscribed reactive changes",
|
|
4956
5132
|
returnType: { kind: "string" },
|
|
@@ -4968,7 +5144,7 @@ var Yh = class {
|
|
|
4968
5144
|
type: { kind: "string" }
|
|
4969
5145
|
}
|
|
4970
5146
|
]
|
|
4971
|
-
},
|
|
5147
|
+
}, Cg = class {
|
|
4972
5148
|
subscribersByKey = /* @__PURE__ */ new Map();
|
|
4973
5149
|
functionRegistry;
|
|
4974
5150
|
updateHandlerUnregister = null;
|
|
@@ -4976,9 +5152,9 @@ var Yh = class {
|
|
|
4976
5152
|
this.functionRegistry = e, this.registerUpdateHandler();
|
|
4977
5153
|
}
|
|
4978
5154
|
async subscribe(e, t, n) {
|
|
4979
|
-
let r = n?.mount ?? "", i =
|
|
5155
|
+
let r = n?.mount ?? "", i = wg(e, r), a = t, o = this.subscribersByKey.get(i), s = !o;
|
|
4980
5156
|
if (o || (o = /* @__PURE__ */ new Set(), this.subscribersByKey.set(i, o)), o.add(a), s) try {
|
|
4981
|
-
t(
|
|
5157
|
+
t(Tg(await this.functionRegistry.call(bg, [e, r])));
|
|
4982
5158
|
} catch (e) {
|
|
4983
5159
|
throw o.delete(a), o.size === 0 && this.subscribersByKey.delete(i), e;
|
|
4984
5160
|
}
|
|
@@ -4990,46 +5166,46 @@ var Yh = class {
|
|
|
4990
5166
|
this.subscribersByKey.clear(), this.updateHandlerUnregister &&= (this.updateHandlerUnregister(), null);
|
|
4991
5167
|
}
|
|
4992
5168
|
unsubscribeOne(e, t, n) {
|
|
4993
|
-
let r =
|
|
4994
|
-
i && (i.delete(n), !(i.size > 0) && (this.subscribersByKey.delete(r), this.functionRegistry.call(
|
|
4995
|
-
|
|
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);
|
|
4996
5172
|
})));
|
|
4997
5173
|
}
|
|
4998
5174
|
registerUpdateHandler() {
|
|
4999
5175
|
let e = (...e) => {
|
|
5000
|
-
let t = e[0], n = e[1] ?? "", r = e[2], i =
|
|
5176
|
+
let t = e[0], n = e[1] ?? "", r = e[2], i = wg(t, n), a = this.subscribersByKey.get(i);
|
|
5001
5177
|
if (!a || a.size === 0) return "";
|
|
5002
|
-
let o =
|
|
5178
|
+
let o = Tg(r);
|
|
5003
5179
|
for (let e of a) try {
|
|
5004
5180
|
e(o);
|
|
5005
5181
|
} catch (e) {
|
|
5006
|
-
|
|
5182
|
+
yg.warn(`Reactive update callback for '${t}' (mount='${n}') threw:`, e);
|
|
5007
5183
|
}
|
|
5008
5184
|
return "";
|
|
5009
5185
|
};
|
|
5010
|
-
this.updateHandlerUnregister = this.functionRegistry.register(
|
|
5186
|
+
this.updateHandlerUnregister = this.functionRegistry.register(Sg, e);
|
|
5011
5187
|
}
|
|
5012
5188
|
};
|
|
5013
|
-
function
|
|
5189
|
+
function wg(e, t) {
|
|
5014
5190
|
return t.length === 0 ? e : `${e}\0${t}`;
|
|
5015
5191
|
}
|
|
5016
|
-
function
|
|
5192
|
+
function Tg(e) {
|
|
5017
5193
|
if (e == null || e === "") return null;
|
|
5018
5194
|
try {
|
|
5019
5195
|
return JSON.parse(e);
|
|
5020
5196
|
} catch (t) {
|
|
5021
|
-
return
|
|
5197
|
+
return yg.warn("Failed to parse reactive value JSON, returning raw string:", t), e;
|
|
5022
5198
|
}
|
|
5023
5199
|
}
|
|
5024
5200
|
//#endregion
|
|
5025
5201
|
//#region src/login/login-error-interceptor.ts
|
|
5026
|
-
var
|
|
5202
|
+
var Eg = "login_required", Dg = (e, t) => e.code === Eg ? (nf({
|
|
5027
5203
|
functionName: t.functionName,
|
|
5028
5204
|
args: t.args
|
|
5029
|
-
}),
|
|
5205
|
+
}), $d(e.message), null) : null;
|
|
5030
5206
|
//#endregion
|
|
5031
5207
|
//#region src/media/device-detection.ts
|
|
5032
|
-
function
|
|
5208
|
+
function Og() {
|
|
5033
5209
|
if (typeof navigator > "u") return !1;
|
|
5034
5210
|
let e = navigator.userAgentData;
|
|
5035
5211
|
if (typeof e?.mobile == "boolean") return e.mobile;
|
|
@@ -5038,7 +5214,7 @@ function ag() {
|
|
|
5038
5214
|
}
|
|
5039
5215
|
//#endregion
|
|
5040
5216
|
//#region src/functions/media-capture-functions.ts
|
|
5041
|
-
function
|
|
5217
|
+
function kg(e) {
|
|
5042
5218
|
let t = e?.facingMode;
|
|
5043
5219
|
if (typeof t == "string") return t === "user" || t === "environment" ? t : void 0;
|
|
5044
5220
|
if (Array.isArray(t)) return t.find((e) => typeof e == "string" && (e === "user" || e === "environment")) ?? void 0;
|
|
@@ -5048,21 +5224,21 @@ function og(e) {
|
|
|
5048
5224
|
if (Array.isArray(e)) return e.find((e) => e === "user" || e === "environment") ?? void 0;
|
|
5049
5225
|
}
|
|
5050
5226
|
}
|
|
5051
|
-
function
|
|
5227
|
+
function Ag(e) {
|
|
5052
5228
|
if (!(typeof e != "string" || !e.trim())) try {
|
|
5053
5229
|
return JSON.parse(e);
|
|
5054
5230
|
} catch {
|
|
5055
5231
|
return;
|
|
5056
5232
|
}
|
|
5057
5233
|
}
|
|
5058
|
-
var
|
|
5234
|
+
var jg = {
|
|
5059
5235
|
StartVideoCapture: "ikon.client.startVideoCapture",
|
|
5060
5236
|
StartAudioCapture: "ikon.client.startAudioCapture",
|
|
5061
5237
|
StopCapture: "ikon.client.stopCapture",
|
|
5062
5238
|
CaptureImage: "ikon.client.captureImage",
|
|
5063
5239
|
GetMediaDevices: "ikon.client.getMediaDevices"
|
|
5064
|
-
},
|
|
5065
|
-
name:
|
|
5240
|
+
}, Mg = {
|
|
5241
|
+
name: jg.StartVideoCapture,
|
|
5066
5242
|
description: "Start camera or screen capture and stream video frames to the server",
|
|
5067
5243
|
returnType: { kind: "string" },
|
|
5068
5244
|
parameters: [{
|
|
@@ -5080,8 +5256,8 @@ var cg = {
|
|
|
5080
5256
|
},
|
|
5081
5257
|
description: "JSON encoded capture options"
|
|
5082
5258
|
}]
|
|
5083
|
-
},
|
|
5084
|
-
name:
|
|
5259
|
+
}, Ng = {
|
|
5260
|
+
name: jg.StartAudioCapture,
|
|
5085
5261
|
description: "Start microphone capture and stream audio frames to the server",
|
|
5086
5262
|
returnType: { kind: "string" },
|
|
5087
5263
|
parameters: [{
|
|
@@ -5092,8 +5268,8 @@ var cg = {
|
|
|
5092
5268
|
},
|
|
5093
5269
|
description: "JSON encoded capture options"
|
|
5094
5270
|
}]
|
|
5095
|
-
},
|
|
5096
|
-
name:
|
|
5271
|
+
}, Pg = {
|
|
5272
|
+
name: jg.StopCapture,
|
|
5097
5273
|
description: "Stop a previously started capture by streamId",
|
|
5098
5274
|
returnType: { kind: "boolean" },
|
|
5099
5275
|
parameters: [{
|
|
@@ -5101,8 +5277,8 @@ var cg = {
|
|
|
5101
5277
|
type: { kind: "string" },
|
|
5102
5278
|
description: "Stream ID to stop"
|
|
5103
5279
|
}]
|
|
5104
|
-
},
|
|
5105
|
-
name:
|
|
5280
|
+
}, Fg = {
|
|
5281
|
+
name: jg.CaptureImage,
|
|
5106
5282
|
description: "Capture a single image from the camera and return metadata (JSON) plus binary image data",
|
|
5107
5283
|
returnType: { kind: "string" },
|
|
5108
5284
|
parameters: [{
|
|
@@ -5113,24 +5289,24 @@ var cg = {
|
|
|
5113
5289
|
},
|
|
5114
5290
|
description: "JSON encoded capture options"
|
|
5115
5291
|
}]
|
|
5116
|
-
},
|
|
5117
|
-
name:
|
|
5292
|
+
}, Ig = {
|
|
5293
|
+
name: jg.GetMediaDevices,
|
|
5118
5294
|
description: "Get list of available media input devices",
|
|
5119
5295
|
returnType: { kind: "string" },
|
|
5120
5296
|
parameters: []
|
|
5121
5297
|
};
|
|
5122
|
-
function
|
|
5298
|
+
function Lg(e, t) {
|
|
5123
5299
|
let n = [];
|
|
5124
|
-
return n.push(e.register(
|
|
5300
|
+
return n.push(e.register(Mg, async (e, n) => {
|
|
5125
5301
|
if (t.isWebRtcCaptureAvailable) {
|
|
5126
5302
|
let e = t.webRtcSignaling;
|
|
5127
5303
|
if (!e) throw Error("WebRTC signaling is not connected");
|
|
5128
|
-
let r =
|
|
5304
|
+
let r = Ag(n);
|
|
5129
5305
|
return await e.startVideoCapture(r?.constraints), "webrtc-video";
|
|
5130
5306
|
}
|
|
5131
5307
|
let r = await t.ensureMediaCapture();
|
|
5132
5308
|
if (!r) throw Error("Media capture is not available in this environment");
|
|
5133
|
-
let i =
|
|
5309
|
+
let i = Ag(n);
|
|
5134
5310
|
return ((typeof e == "string" && e.trim().toLowerCase() === "screen" ? "screen" : "camera") == "screen" ? await r.video.startScreen({
|
|
5135
5311
|
userGesture: !1,
|
|
5136
5312
|
options: i,
|
|
@@ -5140,22 +5316,22 @@ function mg(e, t) {
|
|
|
5140
5316
|
options: i,
|
|
5141
5317
|
constraints: i?.constraints
|
|
5142
5318
|
})).streamId;
|
|
5143
|
-
})), n.push(e.register(
|
|
5319
|
+
})), n.push(e.register(Ng, async (e) => {
|
|
5144
5320
|
if (t.isWebRtcCaptureAvailable) {
|
|
5145
5321
|
let n = t.webRtcSignaling;
|
|
5146
5322
|
if (!n) throw Error("WebRTC signaling is not connected");
|
|
5147
|
-
let r =
|
|
5323
|
+
let r = Ag(e);
|
|
5148
5324
|
return await n.startAudioCapture(r?.constraints), "webrtc-audio";
|
|
5149
5325
|
}
|
|
5150
5326
|
let n = await t.ensureMediaCapture();
|
|
5151
5327
|
if (!n) throw Error("Media capture is not available in this environment");
|
|
5152
|
-
let r =
|
|
5328
|
+
let r = Ag(e);
|
|
5153
5329
|
return (await n.audio.startMic({
|
|
5154
5330
|
userGesture: !1,
|
|
5155
5331
|
options: r,
|
|
5156
5332
|
constraints: r?.constraints
|
|
5157
5333
|
})).streamId;
|
|
5158
|
-
})), n.push(e.register(
|
|
5334
|
+
})), n.push(e.register(Pg, async (e) => {
|
|
5159
5335
|
if (t.isWebRtcCaptureAvailable) {
|
|
5160
5336
|
let e = t.webRtcSignaling;
|
|
5161
5337
|
return e && await e.stopCapture(), !0;
|
|
@@ -5164,20 +5340,20 @@ function mg(e, t) {
|
|
|
5164
5340
|
if (!n || typeof e != "string" || !e.trim()) return !1;
|
|
5165
5341
|
let r = await n.video.stop(e), i = await n.audio.stop(e);
|
|
5166
5342
|
return r || i;
|
|
5167
|
-
})), n.push(e.register(
|
|
5343
|
+
})), n.push(e.register(Fg, async (e) => {
|
|
5168
5344
|
let n = await t.ensureMediaCapture();
|
|
5169
5345
|
if (!n) throw Error("Media capture is not available in this environment");
|
|
5170
|
-
let r =
|
|
5171
|
-
if (r.mode === "native" &&
|
|
5346
|
+
let r = Ag(e) ?? {};
|
|
5347
|
+
if (r.mode === "native" && Og()) {
|
|
5172
5348
|
let e = await n.image.captureFromNativeCamera({
|
|
5173
|
-
facing:
|
|
5349
|
+
facing: kg(r.constraints),
|
|
5174
5350
|
mime: r.mime,
|
|
5175
5351
|
quality: r.quality,
|
|
5176
5352
|
width: r.width,
|
|
5177
5353
|
height: r.height
|
|
5178
5354
|
});
|
|
5179
5355
|
if (!e) throw Error("Native camera capture was cancelled");
|
|
5180
|
-
return
|
|
5356
|
+
return fg(JSON.stringify({
|
|
5181
5357
|
mime: e.mime,
|
|
5182
5358
|
width: e.width,
|
|
5183
5359
|
height: e.height
|
|
@@ -5198,12 +5374,12 @@ function mg(e, t) {
|
|
|
5198
5374
|
quality: r.quality,
|
|
5199
5375
|
width: r.width,
|
|
5200
5376
|
height: r.height
|
|
5201
|
-
}),
|
|
5377
|
+
}), fg(JSON.stringify({
|
|
5202
5378
|
mime: a.mime,
|
|
5203
5379
|
width: a.width,
|
|
5204
5380
|
height: a.height
|
|
5205
5381
|
}), a.data);
|
|
5206
|
-
})), n.push(e.register(
|
|
5382
|
+
})), n.push(e.register(Ig, async () => {
|
|
5207
5383
|
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) return JSON.stringify([]);
|
|
5208
5384
|
let e = (await navigator.mediaDevices.enumerateDevices()).filter((e) => e.kind === "audioinput" || e.kind === "videoinput").map((e) => ({
|
|
5209
5385
|
deviceId: e.deviceId,
|
|
@@ -5218,45 +5394,45 @@ function mg(e, t) {
|
|
|
5218
5394
|
}
|
|
5219
5395
|
//#endregion
|
|
5220
5396
|
//#region src/functions/sound-functions.ts
|
|
5221
|
-
var
|
|
5397
|
+
var Rg = {
|
|
5222
5398
|
PlaySound: "ikon.client.playSound",
|
|
5223
5399
|
StopSound: "ikon.client.stopSound"
|
|
5224
|
-
},
|
|
5225
|
-
function
|
|
5226
|
-
if (!(
|
|
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++) {
|
|
5227
5403
|
let e = new Audio();
|
|
5228
|
-
e.preload = "auto",
|
|
5404
|
+
e.preload = "auto", Ug.push(e);
|
|
5229
5405
|
}
|
|
5230
5406
|
}
|
|
5231
|
-
function
|
|
5232
|
-
if (!
|
|
5233
|
-
|
|
5234
|
-
for (let e of
|
|
5235
|
-
e.src =
|
|
5407
|
+
function Kg() {
|
|
5408
|
+
if (!Wg) {
|
|
5409
|
+
Gg();
|
|
5410
|
+
for (let e of Ug) try {
|
|
5411
|
+
e.src = Vg;
|
|
5236
5412
|
let t = e.play();
|
|
5237
5413
|
typeof t?.then == "function" ? t.then(() => {
|
|
5238
|
-
e.pause(), e.currentTime = 0,
|
|
5239
|
-
}, () => {}) :
|
|
5414
|
+
e.pause(), e.currentTime = 0, Wg = !0, Jg();
|
|
5415
|
+
}, () => {}) : Wg = !0;
|
|
5240
5416
|
} catch {}
|
|
5241
|
-
|
|
5417
|
+
Wg && Jg();
|
|
5242
5418
|
}
|
|
5243
5419
|
}
|
|
5244
|
-
function
|
|
5245
|
-
if (
|
|
5246
|
-
let e = () =>
|
|
5247
|
-
|
|
5420
|
+
function qg() {
|
|
5421
|
+
if (Y || typeof window > "u") return;
|
|
5422
|
+
let e = () => Kg();
|
|
5423
|
+
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 });
|
|
5248
5424
|
}
|
|
5249
|
-
function
|
|
5250
|
-
!
|
|
5425
|
+
function Jg() {
|
|
5426
|
+
!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);
|
|
5251
5427
|
}
|
|
5252
|
-
function
|
|
5253
|
-
|
|
5254
|
-
for (let e of
|
|
5428
|
+
function Yg() {
|
|
5429
|
+
Gg();
|
|
5430
|
+
for (let e of Ug) if (e.paused || e.ended) return e;
|
|
5255
5431
|
let e = new Audio();
|
|
5256
|
-
return e.preload = "auto",
|
|
5432
|
+
return e.preload = "auto", Ug.push(e), e;
|
|
5257
5433
|
}
|
|
5258
|
-
var
|
|
5259
|
-
name:
|
|
5434
|
+
var Xg = {
|
|
5435
|
+
name: Rg.PlaySound,
|
|
5260
5436
|
description: "Play a sound effect",
|
|
5261
5437
|
returnType: {
|
|
5262
5438
|
kind: "string",
|
|
@@ -5294,22 +5470,22 @@ var Og = {
|
|
|
5294
5470
|
}
|
|
5295
5471
|
]
|
|
5296
5472
|
};
|
|
5297
|
-
function
|
|
5473
|
+
function Zg(e, t, n, r) {
|
|
5298
5474
|
if (typeof window > "u" || typeof Audio > "u" || typeof e != "string" || !e.trim()) return Promise.resolve(null);
|
|
5299
5475
|
let i = e;
|
|
5300
|
-
if (typeof t == "string" && t &&
|
|
5301
|
-
let t = e.slice(6), n =
|
|
5476
|
+
if (typeof t == "string" && t && zg.set(t, e), e.startsWith("sound:")) {
|
|
5477
|
+
let t = e.slice(6), n = zg.get(t);
|
|
5302
5478
|
if (!n) return Promise.resolve(null);
|
|
5303
5479
|
i = n;
|
|
5304
5480
|
}
|
|
5305
5481
|
return new Promise((e) => {
|
|
5306
5482
|
try {
|
|
5307
|
-
let t =
|
|
5483
|
+
let t = Yg();
|
|
5308
5484
|
t.src = i, t.currentTime = 0, t.loop = r === !0, t.volume = typeof n == "number" ? Math.max(0, Math.min(1, n)) : 1;
|
|
5309
|
-
let a = `sound-${
|
|
5310
|
-
|
|
5485
|
+
let a = `sound-${Bg++}`, o = () => {
|
|
5486
|
+
J.delete(a), t.removeEventListener("ended", o), t.removeEventListener("error", o);
|
|
5311
5487
|
};
|
|
5312
|
-
t.addEventListener("ended", o), t.addEventListener("error", o),
|
|
5488
|
+
t.addEventListener("ended", o), t.addEventListener("error", o), J.set(a, t), t.play().then(() => e(a), () => {
|
|
5313
5489
|
o(), e(null);
|
|
5314
5490
|
});
|
|
5315
5491
|
} catch {
|
|
@@ -5317,8 +5493,8 @@ function kg(e, t, n, r) {
|
|
|
5317
5493
|
}
|
|
5318
5494
|
});
|
|
5319
5495
|
}
|
|
5320
|
-
var
|
|
5321
|
-
name:
|
|
5496
|
+
var Qg = {
|
|
5497
|
+
name: Rg.StopSound,
|
|
5322
5498
|
description: "Stop a playing sound by ID",
|
|
5323
5499
|
returnType: { kind: "boolean" },
|
|
5324
5500
|
parameters: [{
|
|
@@ -5327,43 +5503,43 @@ var Ag = {
|
|
|
5327
5503
|
description: "Playback ID from playSound"
|
|
5328
5504
|
}]
|
|
5329
5505
|
};
|
|
5330
|
-
function
|
|
5506
|
+
function $g(e) {
|
|
5331
5507
|
if (typeof e != "string") return !1;
|
|
5332
|
-
let t =
|
|
5508
|
+
let t = J.get(e);
|
|
5333
5509
|
if (!t) return !1;
|
|
5334
5510
|
try {
|
|
5335
|
-
return t.pause(), t.currentTime = 0,
|
|
5511
|
+
return t.pause(), t.currentTime = 0, J.delete(e), !0;
|
|
5336
5512
|
} catch {
|
|
5337
5513
|
return !1;
|
|
5338
5514
|
}
|
|
5339
5515
|
}
|
|
5340
|
-
function
|
|
5341
|
-
|
|
5342
|
-
for (let [e, t] of
|
|
5516
|
+
function e_() {
|
|
5517
|
+
zg.clear();
|
|
5518
|
+
for (let [e, t] of J) {
|
|
5343
5519
|
try {
|
|
5344
5520
|
t.pause(), t.currentTime = 0;
|
|
5345
5521
|
} catch {}
|
|
5346
|
-
|
|
5522
|
+
J.delete(e);
|
|
5347
5523
|
}
|
|
5348
|
-
|
|
5524
|
+
Jg();
|
|
5349
5525
|
}
|
|
5350
|
-
var
|
|
5351
|
-
definition:
|
|
5352
|
-
handler:
|
|
5526
|
+
var t_ = [{
|
|
5527
|
+
definition: Xg,
|
|
5528
|
+
handler: Zg
|
|
5353
5529
|
}, {
|
|
5354
|
-
definition:
|
|
5355
|
-
handler:
|
|
5530
|
+
definition: Qg,
|
|
5531
|
+
handler: $g
|
|
5356
5532
|
}];
|
|
5357
|
-
function
|
|
5358
|
-
|
|
5359
|
-
let t =
|
|
5533
|
+
function n_(e) {
|
|
5534
|
+
qg();
|
|
5535
|
+
let t = t_.map(({ definition: t, handler: n }) => e.register(t, n));
|
|
5360
5536
|
return () => {
|
|
5361
|
-
t.forEach((e) => e()),
|
|
5537
|
+
t.forEach((e) => e()), e_();
|
|
5362
5538
|
};
|
|
5363
5539
|
}
|
|
5364
5540
|
//#endregion
|
|
5365
5541
|
//#region src/worker/viseme-worker.ts?worker
|
|
5366
|
-
function
|
|
5542
|
+
function r_(e) {
|
|
5367
5543
|
return new Worker("" + new URL("assets/viseme-worker-TOrhAq2M.js", import.meta.url).href, {
|
|
5368
5544
|
type: "module",
|
|
5369
5545
|
name: e?.name
|
|
@@ -5371,7 +5547,7 @@ function Fg(e) {
|
|
|
5371
5547
|
}
|
|
5372
5548
|
//#endregion
|
|
5373
5549
|
//#region src/media/viseme-tracker.ts
|
|
5374
|
-
var
|
|
5550
|
+
var i_ = w("VisemeTracker"), a_ = he * 2, o_ = class e {
|
|
5375
5551
|
static MAX_WORKER_REBUILD_ATTEMPTS = 3;
|
|
5376
5552
|
client;
|
|
5377
5553
|
worker = null;
|
|
@@ -5391,16 +5567,16 @@ var Ig = w("VisemeTracker"), Lg = ge * 2, Rg = class e {
|
|
|
5391
5567
|
enable() {
|
|
5392
5568
|
if (this.worker) return;
|
|
5393
5569
|
if (typeof Worker > "u") {
|
|
5394
|
-
|
|
5570
|
+
i_.warn("Viseme worker unavailable (Workers not supported)");
|
|
5395
5571
|
return;
|
|
5396
5572
|
}
|
|
5397
5573
|
let t = this.client.createProtocolMessagePort({ opcodeGroupsMask: T.GROUP_AUDIO });
|
|
5398
5574
|
if (!t) return;
|
|
5399
5575
|
this.protocolPort = t;
|
|
5400
5576
|
try {
|
|
5401
|
-
this.worker = new
|
|
5577
|
+
this.worker = new r_();
|
|
5402
5578
|
} catch (e) {
|
|
5403
|
-
|
|
5579
|
+
i_.warn(`Failed to create viseme worker: ${e}`), this.protocolPort.close(), this.protocolPort = null;
|
|
5404
5580
|
return;
|
|
5405
5581
|
}
|
|
5406
5582
|
let n = this.worker;
|
|
@@ -5411,7 +5587,7 @@ var Ig = w("VisemeTracker"), Lg = ge * 2, Rg = class e {
|
|
|
5411
5587
|
t.lineno,
|
|
5412
5588
|
t.colno
|
|
5413
5589
|
].filter((e) => e != null && String(e).length > 0);
|
|
5414
|
-
|
|
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");
|
|
5415
5591
|
}), n.postMessage({
|
|
5416
5592
|
type: "attachProtocolPort",
|
|
5417
5593
|
port: t.port
|
|
@@ -5466,9 +5642,9 @@ var Ig = w("VisemeTracker"), Lg = ge * 2, Rg = class e {
|
|
|
5466
5642
|
if (!t.timingEstablished || t.count === 0) continue;
|
|
5467
5643
|
let n = e - t.playbackStartTime;
|
|
5468
5644
|
if (n < 0) continue;
|
|
5469
|
-
let r = n *
|
|
5645
|
+
let r = n * a_, i = t.frames, a = t.count, o = (t.head - a + ge) % ge, s = null, c = null;
|
|
5470
5646
|
for (let e = 0; e < a; e++) {
|
|
5471
|
-
let t = i[(o + e) %
|
|
5647
|
+
let t = i[(o + e) % ge], n = t.samplePosition + Math.max(t.frameSamples, 1);
|
|
5472
5648
|
if (t.samplePosition <= r && (s = t), n > r && !c && (c = t, t.samplePosition <= r)) break;
|
|
5473
5649
|
}
|
|
5474
5650
|
if (!s || r > s.samplePosition + Math.max(s.frameSamples, 1) && !c) continue;
|
|
@@ -5492,8 +5668,8 @@ var Ig = w("VisemeTracker"), Lg = ge * 2, Rg = class e {
|
|
|
5492
5668
|
if (e.type === "streamBegin") {
|
|
5493
5669
|
if (this.streamShapeSets.has(e.streamId)) return;
|
|
5494
5670
|
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"))) {
|
|
5495
|
-
let t = Array(
|
|
5496
|
-
for (let e = 0; e <
|
|
5671
|
+
let t = Array(ge);
|
|
5672
|
+
for (let e = 0; e < ge; e++) t[e] = {
|
|
5497
5673
|
samplePosition: 0,
|
|
5498
5674
|
frameSamples: 0,
|
|
5499
5675
|
mouthOpenY: 0,
|
|
@@ -5536,39 +5712,39 @@ var Ig = w("VisemeTracker"), Lg = ge * 2, Rg = class e {
|
|
|
5536
5712
|
}
|
|
5537
5713
|
if (r > 0) {
|
|
5538
5714
|
let e = o.frames[o.head];
|
|
5539
|
-
e.samplePosition = n - o.epochTimestampSamples, e.frameSamples = r, e.mouthOpenY = c.Values[0], e.mouthForm = c.Values[1], o.head = (o.head + 1) %
|
|
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++;
|
|
5540
5716
|
}
|
|
5541
5717
|
}
|
|
5542
5718
|
}
|
|
5543
|
-
},
|
|
5544
|
-
function
|
|
5545
|
-
return
|
|
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);
|
|
5546
5722
|
}
|
|
5547
|
-
function
|
|
5548
|
-
return
|
|
5723
|
+
function l_() {
|
|
5724
|
+
return X;
|
|
5549
5725
|
}
|
|
5550
|
-
function
|
|
5551
|
-
|
|
5726
|
+
function u_() {
|
|
5727
|
+
X || (X = !0, ve(C.DEBUG), s_.info("Debug mode enabled"), Au(hu, "true"));
|
|
5552
5728
|
}
|
|
5553
5729
|
//#endregion
|
|
5554
5730
|
//#region src/utils/inspect-mode.ts
|
|
5555
|
-
var
|
|
5556
|
-
function
|
|
5557
|
-
typeof window < "u" && window.dispatchEvent(new Event(
|
|
5731
|
+
var d_ = "ikon-inspect-mode-changed", f_ = !1;
|
|
5732
|
+
function p_() {
|
|
5733
|
+
typeof window < "u" && window.dispatchEvent(new Event(d_));
|
|
5558
5734
|
}
|
|
5559
|
-
function
|
|
5560
|
-
let e =
|
|
5561
|
-
return e !==
|
|
5735
|
+
function m_() {
|
|
5736
|
+
let e = Uu();
|
|
5737
|
+
return e !== f_ && (f_ = e, p_()), f_;
|
|
5562
5738
|
}
|
|
5563
|
-
function
|
|
5564
|
-
return
|
|
5739
|
+
function h_() {
|
|
5740
|
+
return f_;
|
|
5565
5741
|
}
|
|
5566
|
-
function
|
|
5567
|
-
|
|
5742
|
+
function g_() {
|
|
5743
|
+
f_ || (f_ = !0, Au(Cu, "true"), p_());
|
|
5568
5744
|
}
|
|
5569
5745
|
//#endregion
|
|
5570
5746
|
//#region src/utils/external-link.ts
|
|
5571
|
-
var
|
|
5747
|
+
var __ = /* @__PURE__ */ new Set([
|
|
5572
5748
|
"http",
|
|
5573
5749
|
"https",
|
|
5574
5750
|
"file",
|
|
@@ -5585,12 +5761,12 @@ var Yg = /* @__PURE__ */ new Set([
|
|
|
5585
5761
|
"edge",
|
|
5586
5762
|
"moz-extension",
|
|
5587
5763
|
"safari-web-extension"
|
|
5588
|
-
]),
|
|
5589
|
-
function
|
|
5590
|
-
let t =
|
|
5591
|
-
return t ? !
|
|
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;
|
|
5592
5768
|
}
|
|
5593
|
-
function
|
|
5769
|
+
function b_(e) {
|
|
5594
5770
|
if (typeof document > "u") return;
|
|
5595
5771
|
let t = document.createElement("iframe");
|
|
5596
5772
|
t.setAttribute("aria-hidden", "true"), t.style.display = "none", document.body.appendChild(t);
|
|
@@ -5604,7 +5780,7 @@ function Qg(e) {
|
|
|
5604
5780
|
}
|
|
5605
5781
|
//#endregion
|
|
5606
5782
|
//#region src/utils/browser-support.ts
|
|
5607
|
-
var
|
|
5783
|
+
var x_ = [
|
|
5608
5784
|
{
|
|
5609
5785
|
name: "WebSocket",
|
|
5610
5786
|
isPresent: () => typeof WebSocket < "u"
|
|
@@ -5626,9 +5802,9 @@ var $g = [
|
|
|
5626
5802
|
isPresent: () => typeof Promise < "u" && typeof Promise.allSettled == "function"
|
|
5627
5803
|
}
|
|
5628
5804
|
];
|
|
5629
|
-
function
|
|
5805
|
+
function S_() {
|
|
5630
5806
|
let e = [];
|
|
5631
|
-
for (let t of
|
|
5807
|
+
for (let t of x_) {
|
|
5632
5808
|
let n;
|
|
5633
5809
|
try {
|
|
5634
5810
|
n = t.isPresent();
|
|
@@ -5644,22 +5820,22 @@ function e_() {
|
|
|
5644
5820
|
}
|
|
5645
5821
|
//#endregion
|
|
5646
5822
|
//#region src/transport/transport-probe.ts
|
|
5647
|
-
var
|
|
5648
|
-
async function
|
|
5649
|
-
let r = n?.timeoutMs ??
|
|
5823
|
+
var C_ = w("TransportProbe"), w_ = 3e3;
|
|
5824
|
+
async function T_(e, t, n) {
|
|
5825
|
+
let r = n?.timeoutMs ?? w_, i = n?.signal;
|
|
5650
5826
|
if (i?.aborted) return !1;
|
|
5651
5827
|
let a = Date.now();
|
|
5652
5828
|
try {
|
|
5653
|
-
let n =
|
|
5654
|
-
return
|
|
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;
|
|
5655
5831
|
} catch (n) {
|
|
5656
|
-
return
|
|
5832
|
+
return C_.debug(`Probe ${x[e]} ${t} failed after ${Date.now() - a}ms: ${n instanceof Error ? n.message : n}`), !1;
|
|
5657
5833
|
}
|
|
5658
5834
|
}
|
|
5659
|
-
function
|
|
5835
|
+
function E_(e) {
|
|
5660
5836
|
return e === x.WebTransport || e === x.WebTransportProxy;
|
|
5661
5837
|
}
|
|
5662
|
-
function
|
|
5838
|
+
function D_(e, t, n) {
|
|
5663
5839
|
return typeof WebSocket > "u" ? Promise.resolve(!1) : new Promise((r) => {
|
|
5664
5840
|
let i = new WebSocket(e), a = !1, o = (e) => {
|
|
5665
5841
|
if (!a) {
|
|
@@ -5673,8 +5849,8 @@ function a_(e, t, n) {
|
|
|
5673
5849
|
n?.addEventListener("abort", s, { once: !0 }), i.onopen = () => o(!0), i.onerror = () => o(!1), i.onclose = () => o(!1);
|
|
5674
5850
|
});
|
|
5675
5851
|
}
|
|
5676
|
-
async function
|
|
5677
|
-
if (
|
|
5852
|
+
async function O_(e, t, n) {
|
|
5853
|
+
if (!ed()) return !1;
|
|
5678
5854
|
let r = new WebTransport(e), i;
|
|
5679
5855
|
try {
|
|
5680
5856
|
let e = new Promise((e, r) => {
|
|
@@ -5692,155 +5868,19 @@ async function o_(e, t, n) {
|
|
|
5692
5868
|
}
|
|
5693
5869
|
//#endregion
|
|
5694
5870
|
//#region src/worker/protocol-worker.ts?worker
|
|
5695
|
-
function
|
|
5871
|
+
function k_(e) {
|
|
5696
5872
|
return new Worker("" + new URL("assets/protocol-worker-sC4mqNcM.js", import.meta.url).href, {
|
|
5697
5873
|
type: "module",
|
|
5698
5874
|
name: e?.name
|
|
5699
5875
|
});
|
|
5700
5876
|
}
|
|
5701
5877
|
//#endregion
|
|
5702
|
-
//#region src/client/
|
|
5703
|
-
var
|
|
5704
|
-
|
|
5705
|
-
[x.WebSocket]: 1,
|
|
5706
|
-
[x.WebTransportProxy]: 2,
|
|
5707
|
-
[x.WebSocketProxy]: 3
|
|
5708
|
-
}, c_ = /* @__PURE__ */ new Set([x.WebTransportProxy, x.WebSocketProxy]), l_ = /* @__PURE__ */ new Set([x.WebTransport, x.WebSocket]), u_ = /* @__PURE__ */ new Set([x.WebSocket, x.WebSocketProxy]), d_ = /* @__PURE__ */ new Set([x.WebTransport, x.WebTransportProxy]), X = w("EndpointSelector"), f_ = "ikon-endpoint-type", p_ = "ikon-proxy-preferred", m_ = "ikon-endpoint-timestamp", h_ = "ikon-endpoint-revalidated", g_ = 864e5, __ = class {
|
|
5709
|
-
isLocal;
|
|
5710
|
-
_proxyMode;
|
|
5711
|
-
_websocket;
|
|
5712
|
-
_webtransport;
|
|
5713
|
-
_proxyPreferred = !1;
|
|
5714
|
-
workingEndpointType = null;
|
|
5715
|
-
constructor(e) {
|
|
5716
|
-
this.isLocal = !!e.local, this._proxyMode = e.proxyMode ?? "auto", this._websocket = e.websocket, this._webtransport = e.webtransport, this.isLocal || (this.loadRememberedType(), this._proxyMode === "auto" && this.loadProxyPreference());
|
|
5717
|
-
}
|
|
5718
|
-
get proxyMode() {
|
|
5719
|
-
return this._proxyMode;
|
|
5720
|
-
}
|
|
5721
|
-
get proxyPreferred() {
|
|
5722
|
-
return this._proxyPreferred;
|
|
5723
|
-
}
|
|
5724
|
-
get rememberedType() {
|
|
5725
|
-
return this.workingEndpointType;
|
|
5726
|
-
}
|
|
5727
|
-
markProxyPreferred() {
|
|
5728
|
-
this._proxyPreferred = !0;
|
|
5729
|
-
try {
|
|
5730
|
-
localStorage.setItem(p_, "true"), localStorage.setItem(m_, String(Date.now()));
|
|
5731
|
-
} catch {}
|
|
5732
|
-
X.debug("Marked proxy as preferred");
|
|
5733
|
-
}
|
|
5734
|
-
clearProxyPreference() {
|
|
5735
|
-
this._proxyPreferred = !1;
|
|
5736
|
-
try {
|
|
5737
|
-
localStorage.removeItem(p_);
|
|
5738
|
-
} catch {}
|
|
5739
|
-
}
|
|
5740
|
-
getOrderedTypes(e) {
|
|
5741
|
-
let t = Array.from(e.keys());
|
|
5742
|
-
if (this.isLocal) return t;
|
|
5743
|
-
let n;
|
|
5744
|
-
n = this._proxyMode === "force-proxy" ? t.filter((e) => c_.has(e)) : this._proxyMode === "force-direct" ? t.filter((e) => l_.has(e)) : t, n = this.filterByTransport(n);
|
|
5745
|
-
let r = [...n].sort((e, t) => (Y[e] ?? 999) - (Y[t] ?? 999));
|
|
5746
|
-
if (this._proxyMode === "auto" && this._proxyPreferred) {
|
|
5747
|
-
let e = r.filter((e) => c_.has(e)), t = r.filter((e) => l_.has(e));
|
|
5748
|
-
r.length = 0, r.push(...e, ...t);
|
|
5749
|
-
}
|
|
5750
|
-
if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this._proxyPreferred || c_.has(this.workingEndpointType))) {
|
|
5751
|
-
let e = r.indexOf(this.workingEndpointType);
|
|
5752
|
-
e > 0 && (r.splice(e, 1), r.unshift(this.workingEndpointType));
|
|
5753
|
-
}
|
|
5754
|
-
return X.debug(`Ordered types: [${r.map((e) => x[e]).join(", ")}] (remembered: ${this.workingEndpointType === null ? "none" : x[this.workingEndpointType]}, proxyPreferred: ${this._proxyPreferred})`), r;
|
|
5755
|
-
}
|
|
5756
|
-
rememberWorkingType(e) {
|
|
5757
|
-
if (!this.isLocal) {
|
|
5758
|
-
if (this._proxyMode !== "auto") {
|
|
5759
|
-
this.workingEndpointType = e;
|
|
5760
|
-
return;
|
|
5761
|
-
}
|
|
5762
|
-
this.workingEndpointType = e;
|
|
5763
|
-
try {
|
|
5764
|
-
localStorage.setItem(f_, String(e)), localStorage.setItem(m_, String(Date.now())), localStorage.getItem(h_) === null && localStorage.setItem(h_, String(Date.now()));
|
|
5765
|
-
} catch {}
|
|
5766
|
-
if (c_.has(e)) {
|
|
5767
|
-
this._proxyPreferred = !0;
|
|
5768
|
-
try {
|
|
5769
|
-
localStorage.setItem(p_, "true");
|
|
5770
|
-
} catch {}
|
|
5771
|
-
} else if (l_.has(e)) {
|
|
5772
|
-
this._proxyPreferred = !1;
|
|
5773
|
-
try {
|
|
5774
|
-
localStorage.removeItem(p_);
|
|
5775
|
-
} catch {}
|
|
5776
|
-
}
|
|
5777
|
-
X.debug(`Remembered working type: ${x[e]}`);
|
|
5778
|
-
}
|
|
5779
|
-
}
|
|
5780
|
-
clearRememberedType() {
|
|
5781
|
-
this.workingEndpointType = null;
|
|
5782
|
-
try {
|
|
5783
|
-
localStorage.removeItem(f_);
|
|
5784
|
-
} catch {}
|
|
5785
|
-
}
|
|
5786
|
-
needsRevalidation() {
|
|
5787
|
-
if (this.isLocal || this._proxyMode !== "auto" || this.workingEndpointType === null && !this._proxyPreferred) return !1;
|
|
5788
|
-
let e = this.revalidationAgeMs();
|
|
5789
|
-
return e !== null && e > g_;
|
|
5790
|
-
}
|
|
5791
|
-
getFasterTypes(e, t) {
|
|
5792
|
-
let n = Y[e] ?? 999;
|
|
5793
|
-
return this.filterByTransport(Array.from(t.keys())).filter((e) => (Y[e] ?? 999) < n).sort((e, t) => (Y[e] ?? 999) - (Y[t] ?? 999));
|
|
5794
|
-
}
|
|
5795
|
-
recordFasterTypeReachable(e) {
|
|
5796
|
-
X.debug(`Faster endpoint type ${x[e]} is reachable again, dropping learned preference`), this.clearRememberedType(), this.clearProxyPreference();
|
|
5797
|
-
try {
|
|
5798
|
-
localStorage.removeItem(m_), localStorage.removeItem(h_);
|
|
5799
|
-
} catch {}
|
|
5800
|
-
}
|
|
5801
|
-
recordFasterTypesUnreachable() {
|
|
5802
|
-
try {
|
|
5803
|
-
localStorage.setItem(h_, String(Date.now()));
|
|
5804
|
-
} catch {}
|
|
5805
|
-
X.debug("Faster endpoint types still unreachable, keeping the learned preference");
|
|
5806
|
-
}
|
|
5807
|
-
filterByTransport(e) {
|
|
5808
|
-
let t = this._websocket, n = this._webtransport;
|
|
5809
|
-
return t === void 0 && n === void 0 || t === !0 && n === !0 ? e : e.filter((e) => t === !0 && n === void 0 ? u_.has(e) : n === !0 && t === void 0 ? d_.has(e) : t === !1 ? !u_.has(e) : n !== !1 || !d_.has(e));
|
|
5810
|
-
}
|
|
5811
|
-
revalidationAgeMs() {
|
|
5812
|
-
try {
|
|
5813
|
-
let e = localStorage.getItem(h_);
|
|
5814
|
-
if (e === null) return null;
|
|
5815
|
-
let t = Date.now() - Number(e);
|
|
5816
|
-
return Number.isFinite(t) ? t : null;
|
|
5817
|
-
} catch {
|
|
5818
|
-
return null;
|
|
5819
|
-
}
|
|
5820
|
-
}
|
|
5821
|
-
loadRememberedType() {
|
|
5822
|
-
try {
|
|
5823
|
-
let e = localStorage.getItem(f_);
|
|
5824
|
-
if (e !== null) {
|
|
5825
|
-
let t = Number(e);
|
|
5826
|
-
if (x[t] !== void 0) {
|
|
5827
|
-
this.workingEndpointType = t;
|
|
5828
|
-
let e = localStorage.getItem(m_), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
|
|
5829
|
-
X.debug(`Loaded remembered type: ${x[t]} (age: ${n}h)`);
|
|
5830
|
-
}
|
|
5831
|
-
}
|
|
5832
|
-
} catch {}
|
|
5833
|
-
}
|
|
5834
|
-
loadProxyPreference() {
|
|
5835
|
-
try {
|
|
5836
|
-
this._proxyPreferred = localStorage.getItem(p_) === "true", this._proxyPreferred && X.debug("Loaded proxy preference: preferred");
|
|
5837
|
-
} catch {}
|
|
5838
|
-
}
|
|
5839
|
-
}, Z = w("IkonClient"), v_ = [1e4, 3e4];
|
|
5840
|
-
function y_() {
|
|
5878
|
+
//#region src/client/ikon-client.ts
|
|
5879
|
+
var Z = w("IkonClient"), A_ = [1e4, 3e4];
|
|
5880
|
+
function j_() {
|
|
5841
5881
|
return typeof __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__ < "u" && __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__;
|
|
5842
5882
|
}
|
|
5843
|
-
var
|
|
5883
|
+
var M_ = class {
|
|
5844
5884
|
channelManager = null;
|
|
5845
5885
|
protocolWorker = null;
|
|
5846
5886
|
preloadedWorker = null;
|
|
@@ -5868,7 +5908,7 @@ var b_ = class {
|
|
|
5868
5908
|
_actionIdByCallId = /* @__PURE__ */ new Map();
|
|
5869
5909
|
_pendingActionResults = /* @__PURE__ */ new Map();
|
|
5870
5910
|
endpointSelector;
|
|
5871
|
-
_webRtcReachability = new
|
|
5911
|
+
_webRtcReachability = new kd();
|
|
5872
5912
|
_connectedEntrypoints = [];
|
|
5873
5913
|
_revalidationDone = !1;
|
|
5874
5914
|
_isUnloading = !1;
|
|
@@ -5920,7 +5960,7 @@ var b_ = class {
|
|
|
5920
5960
|
_reconnectTimer = null;
|
|
5921
5961
|
_serverStopped = !1;
|
|
5922
5962
|
_hasBeenConnected = !1;
|
|
5923
|
-
_waitForExternalConnectUrl =
|
|
5963
|
+
_waitForExternalConnectUrl = j_();
|
|
5924
5964
|
_externalConnectUrlCleanup = null;
|
|
5925
5965
|
get media() {
|
|
5926
5966
|
return this._media;
|
|
@@ -5937,7 +5977,7 @@ var b_ = class {
|
|
|
5937
5977
|
return this._mediaCapture;
|
|
5938
5978
|
}
|
|
5939
5979
|
async ensureMediaCapture() {
|
|
5940
|
-
return this._mediaCapture ? this._mediaCapture :
|
|
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;
|
|
5941
5981
|
}
|
|
5942
5982
|
async ensureMedia() {
|
|
5943
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);
|
|
@@ -5949,7 +5989,7 @@ var b_ = class {
|
|
|
5949
5989
|
return this._videoEnabled;
|
|
5950
5990
|
}
|
|
5951
5991
|
get isWebRtcEnabled() {
|
|
5952
|
-
return (
|
|
5992
|
+
return (Vu() ?? this.config.webRtc?.enabled ?? !0) && (this._audioEnabled || this._videoEnabled);
|
|
5953
5993
|
}
|
|
5954
5994
|
get isWebRtcMediaActive() {
|
|
5955
5995
|
return this.isWebRtcEnabled && !this._webRtcFallbackActive;
|
|
@@ -5983,26 +6023,26 @@ var b_ = class {
|
|
|
5983
6023
|
].filter(Boolean).length;
|
|
5984
6024
|
if (t === 0) throw Error("IkonClient requires one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
|
|
5985
6025
|
if (t > 1) throw Error("IkonClient accepts only one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
|
|
5986
|
-
|
|
5987
|
-
let n = e.
|
|
5988
|
-
this.endpointSelector = new
|
|
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({
|
|
5989
6029
|
local: e.local,
|
|
5990
|
-
proxyMode:
|
|
5991
|
-
websocket:
|
|
5992
|
-
webtransport:
|
|
5993
|
-
}),
|
|
5994
|
-
let
|
|
5995
|
-
this._audioEnabled =
|
|
5996
|
-
let
|
|
6030
|
+
proxyMode: i,
|
|
6031
|
+
websocket: s,
|
|
6032
|
+
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();
|
|
6035
|
+
this._audioEnabled = l ?? e.audio?.enabled ?? !0, this._videoEnabled = u ?? e.video?.enabled ?? !0;
|
|
6036
|
+
let d = e.audio ? {
|
|
5997
6037
|
performance: e.audio.performance,
|
|
5998
6038
|
background: e.audio.background,
|
|
5999
6039
|
diagnostics: e.audio.diagnostics
|
|
6000
|
-
} : void 0,
|
|
6040
|
+
} : void 0, f = e.video ? { performance: e.video.performance } : void 0;
|
|
6001
6041
|
this._mediaConfig = {
|
|
6002
|
-
audio:
|
|
6003
|
-
video:
|
|
6042
|
+
audio: d,
|
|
6043
|
+
video: f,
|
|
6004
6044
|
mediaSession: e.mediaSession
|
|
6005
|
-
}, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } },
|
|
6045
|
+
}, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, Em() && (this.unregisterMediaCaptureFunctions = Lg(this._functionRegistry, this));
|
|
6006
6046
|
}
|
|
6007
6047
|
_lastError = void 0;
|
|
6008
6048
|
get lastError() {
|
|
@@ -6055,15 +6095,15 @@ var b_ = class {
|
|
|
6055
6095
|
async connect() {
|
|
6056
6096
|
if (this._connectStarted) throw Error(`Cannot connect: already started (state: ${this.currentState})`);
|
|
6057
6097
|
this._connectStarted = !0;
|
|
6058
|
-
let e =
|
|
6098
|
+
let e = S_();
|
|
6059
6099
|
if (!e.supported) {
|
|
6060
6100
|
this.setErrorState(new uu(e.missingFeatures));
|
|
6061
6101
|
return;
|
|
6062
6102
|
}
|
|
6063
6103
|
this.setupLifecycleHandlers();
|
|
6064
|
-
let t =
|
|
6104
|
+
let t = Ru() ?? Lu();
|
|
6065
6105
|
if (t) {
|
|
6066
|
-
Z.info("Found external connect URL in query parameter"), await this.executeConnection(() =>
|
|
6106
|
+
Z.info("Found external connect URL in query parameter"), await this.executeConnection(() => Jh(t, this.abortController.signal));
|
|
6067
6107
|
return;
|
|
6068
6108
|
}
|
|
6069
6109
|
if (this._waitForExternalConnectUrl) {
|
|
@@ -6074,28 +6114,21 @@ var b_ = class {
|
|
|
6074
6114
|
}
|
|
6075
6115
|
async executeConnection(e) {
|
|
6076
6116
|
if (this._lastError = void 0, this.abortController = new AbortController(), typeof Worker < "u" && !this.preloadedWorker) try {
|
|
6077
|
-
this.preloadedWorker = new
|
|
6117
|
+
this.preloadedWorker = new k_();
|
|
6078
6118
|
} catch {}
|
|
6079
6119
|
this.setState("connecting"), this.connectionTimer = setTimeout(() => {
|
|
6080
6120
|
this.currentState === "connecting" && (Z.error("Connection timeout"), this.abortController?.abort("Connection timeout"), this.setState("offline"), this.config.onError?.(/* @__PURE__ */ Error("Connection timeout")));
|
|
6081
6121
|
}, this.connectionTimeoutMs);
|
|
6082
6122
|
try {
|
|
6083
6123
|
let t = await e();
|
|
6084
|
-
|
|
6085
|
-
Z.debug("Auth fell back to proxy, marking proxy preferred");
|
|
6086
|
-
let e = t.directUrl;
|
|
6087
|
-
Eh(e).then((e) => {
|
|
6088
|
-
e && (Z.debug("Background probe: direct server reachable, clearing proxy preference for next connection"), this.endpointSelector.clearProxyPreference());
|
|
6089
|
-
}).catch(() => {});
|
|
6090
|
-
}
|
|
6091
|
-
await this.connectProtocol(this.authResponse.Entrypoints);
|
|
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);
|
|
6092
6125
|
} catch (e) {
|
|
6093
6126
|
if (e instanceof DOMException && e.name === "AbortError") return;
|
|
6094
6127
|
throw Z.error("Connection failed:", e), this.clearTimers(), this.setState("offline"), this.config.onError?.(e instanceof Error ? e : Error(String(e))), e;
|
|
6095
6128
|
}
|
|
6096
6129
|
}
|
|
6097
6130
|
disconnect() {
|
|
6098
|
-
Z.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(),
|
|
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;
|
|
6099
6132
|
for (let e of this._webRtcAudioElements.values()) e.pause(), e.srcObject = null, e.remove();
|
|
6100
6133
|
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");
|
|
6101
6134
|
}
|
|
@@ -6306,12 +6339,26 @@ var b_ = class {
|
|
|
6306
6339
|
}
|
|
6307
6340
|
async authenticate() {
|
|
6308
6341
|
let e = this.abortController?.signal;
|
|
6309
|
-
if (this.config.local) return
|
|
6310
|
-
let t = this.endpointSelector.proxyMode, n = this.endpointSelector.
|
|
6311
|
-
if (this.config.apiKey) r = await
|
|
6312
|
-
else if (this.config.sessionToken) r = await
|
|
6342
|
+
if (this.config.local) return rg(this.config.local, e);
|
|
6343
|
+
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);
|
|
6313
6346
|
else throw Error("No connection configuration provided (need local, apiKey, or sessionToken)");
|
|
6314
|
-
return r.
|
|
6347
|
+
return r.connectTier && t === "auto" && this.endpointSelector.recordWorkingConnectTier(r.connectTier), r;
|
|
6348
|
+
}
|
|
6349
|
+
probeFasterConnectTiers(e) {
|
|
6350
|
+
let t = e.connectTier;
|
|
6351
|
+
!t || t === "direct" || this.endpointSelector.proxyMode !== "auto" || (Z.debug(`Auth settled on the ${t} tier, probing the faster ones`), (async () => {
|
|
6352
|
+
for (let n of this.endpointSelector.getFasterConnectTiers(t)) {
|
|
6353
|
+
let t = e.connectTierUrls?.[n];
|
|
6354
|
+
if (t) try {
|
|
6355
|
+
if (await Yh(t)) {
|
|
6356
|
+
Z.debug(`Background probe: the ${n} tier is reachable, stepping up to it for the next connection`), this.endpointSelector.recordReachableConnectTier(n);
|
|
6357
|
+
return;
|
|
6358
|
+
}
|
|
6359
|
+
} catch {}
|
|
6360
|
+
}
|
|
6361
|
+
})());
|
|
6315
6362
|
}
|
|
6316
6363
|
handleProtocolMessage(e) {
|
|
6317
6364
|
if (this._webRtcSignaling?.handleProtocolMessage(e)) return;
|
|
@@ -6344,7 +6391,7 @@ var b_ = class {
|
|
|
6344
6391
|
return;
|
|
6345
6392
|
}
|
|
6346
6393
|
if (t === T.CORE_GLOBAL_STATE && zo(e).then((e) => {
|
|
6347
|
-
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 &&
|
|
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({
|
|
6348
6395
|
type: "enableDevtools",
|
|
6349
6396
|
enabled: !0
|
|
6350
6397
|
}), this.protocolWorker.postMessage({
|
|
@@ -6482,7 +6529,7 @@ var b_ = class {
|
|
|
6482
6529
|
let n;
|
|
6483
6530
|
if (this.preloadedWorker) n = this.preloadedWorker, this.preloadedWorker = null;
|
|
6484
6531
|
else try {
|
|
6485
|
-
n = new
|
|
6532
|
+
n = new k_();
|
|
6486
6533
|
} catch (n) {
|
|
6487
6534
|
Z.warn(`Failed to create protocol worker, falling back to main thread: ${n}`), await this.connectProtocolOnMainThread(e, t);
|
|
6488
6535
|
return;
|
|
@@ -6507,7 +6554,7 @@ var b_ = class {
|
|
|
6507
6554
|
return;
|
|
6508
6555
|
}
|
|
6509
6556
|
if (o?.type === "refreshEntrypoints") {
|
|
6510
|
-
this._connectUrl ?
|
|
6557
|
+
this._connectUrl ? Jh(this._connectUrl, this.abortController?.signal).then((e) => {
|
|
6511
6558
|
this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, n.postMessage({
|
|
6512
6559
|
type: "refreshedEntrypoints",
|
|
6513
6560
|
entrypoints: e.authResponse.Entrypoints,
|
|
@@ -6536,16 +6583,16 @@ var b_ = class {
|
|
|
6536
6583
|
a(), t(Error(`Protocol worker failed: ${n.join(" ")}`.trim()));
|
|
6537
6584
|
}), i = setTimeout(() => {
|
|
6538
6585
|
r || (i = void 0, t(/* @__PURE__ */ Error("Protocol worker connect timed out")));
|
|
6539
|
-
},
|
|
6586
|
+
}, jd);
|
|
6540
6587
|
}), i = this.computeOrderedEndpointTypes(e), a = this.getServerKeepaliveTimeoutMs(), o = this.config.timeouts?.reconnectBackoffMs ?? 2e3, s = this.config.timeouts?.maxReconnectAttempts ?? 2;
|
|
6541
|
-
this.updateWorkerInterestMask(),
|
|
6588
|
+
this.updateWorkerInterestMask(), l_() && (n.postMessage({
|
|
6542
6589
|
type: "enableDevtools",
|
|
6543
6590
|
enabled: !0
|
|
6544
6591
|
}), n.postMessage({
|
|
6545
6592
|
type: "setLogLevel",
|
|
6546
6593
|
level: Se()
|
|
6547
|
-
})),
|
|
6548
|
-
let c =
|
|
6594
|
+
})), m_();
|
|
6595
|
+
let c = Vu() ?? this.config.webRtc?.enabled ?? !0;
|
|
6549
6596
|
n.postMessage({
|
|
6550
6597
|
type: "connect",
|
|
6551
6598
|
sessionId: this._sessionId,
|
|
@@ -6572,7 +6619,7 @@ var b_ = class {
|
|
|
6572
6619
|
}
|
|
6573
6620
|
ensureVisemeTracker() {
|
|
6574
6621
|
if (!this._visemeTracker) try {
|
|
6575
|
-
this._visemeTracker = new
|
|
6622
|
+
this._visemeTracker = new o_(this), this._visemeTracker.enable();
|
|
6576
6623
|
} catch (e) {
|
|
6577
6624
|
Z.warn(`Viseme tracker setup failed: ${e}`), this._visemeTracker = null;
|
|
6578
6625
|
}
|
|
@@ -6596,7 +6643,7 @@ var b_ = class {
|
|
|
6596
6643
|
useVideoTrack: this._videoEnabled,
|
|
6597
6644
|
useDataChannel: !0,
|
|
6598
6645
|
iceServers: this.config.webRtc?.iceServers,
|
|
6599
|
-
iceTransportPolicy:
|
|
6646
|
+
iceTransportPolicy: Hu() ?? this.config.webRtc?.iceTransportPolicy ?? this._webRtcReachability.iceTransportPolicy,
|
|
6600
6647
|
shouldAttemptWithoutIceServers: () => this._webRtcReachability.shouldAttemptWithoutIceServers || this._webRtcRetryCount > 0,
|
|
6601
6648
|
onStateChange: (e) => {
|
|
6602
6649
|
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}`);
|
|
@@ -6626,9 +6673,9 @@ var b_ = class {
|
|
|
6626
6673
|
} else this._pendingActiveAudioTracks.delete(e.TrackIndex), this.destroyWebRtcAudioElement(e.TrackIndex);
|
|
6627
6674
|
}
|
|
6628
6675
|
};
|
|
6629
|
-
this._webRtcFallbackActive = !1, this._webRtcSignaling = new
|
|
6676
|
+
this._webRtcFallbackActive = !1, this._webRtcSignaling = new Td(t), this.clearWebRtcConnectWatchdog(), this._webRtcConnectWatchdog = setTimeout(() => {
|
|
6630
6677
|
this._webRtcSignaling?.state !== "connected" && this.fallbackToCustomPlayback("webrtc connection timed out");
|
|
6631
|
-
},
|
|
6678
|
+
}, vd);
|
|
6632
6679
|
try {
|
|
6633
6680
|
await this._webRtcSignaling.connect((e) => {
|
|
6634
6681
|
this.sendProtocolMessage(e);
|
|
@@ -6640,7 +6687,7 @@ var b_ = class {
|
|
|
6640
6687
|
async rememberWebRtcReachability() {
|
|
6641
6688
|
let e = this._webRtcSignaling?.peerConnection;
|
|
6642
6689
|
if (!e) return;
|
|
6643
|
-
let t = await
|
|
6690
|
+
let t = await Ad(e);
|
|
6644
6691
|
t !== null && this._webRtcReachability.recordConnected(t);
|
|
6645
6692
|
}
|
|
6646
6693
|
clearWebRtcConnectWatchdog() {
|
|
@@ -6650,9 +6697,9 @@ var b_ = class {
|
|
|
6650
6697
|
this._webRtcRetryTimer &&= (clearTimeout(this._webRtcRetryTimer), null);
|
|
6651
6698
|
}
|
|
6652
6699
|
scheduleWebRtcRetry() {
|
|
6653
|
-
if (this._webRtcRetryTimer || this._webRtcRetryCount >=
|
|
6654
|
-
let e =
|
|
6655
|
-
Z.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${
|
|
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(() => {
|
|
6656
6703
|
this._webRtcRetryTimer = null, !(this.currentState !== "connected" || this._webRtcSignaling || !this.isWebRtcEnabled) && this.setupWebRtcSignaling();
|
|
6657
6704
|
}, e);
|
|
6658
6705
|
}
|
|
@@ -6784,8 +6831,8 @@ var b_ = class {
|
|
|
6784
6831
|
}
|
|
6785
6832
|
async connectProtocolOnMainThread(e, t = !1) {
|
|
6786
6833
|
this.workerManagerState = null, this.protocolWorker = null;
|
|
6787
|
-
let n =
|
|
6788
|
-
Z.debug(`Connecting on main thread (webRtcEnabled=${n}, entrypoints=${e.length})`), this.channelManager = new
|
|
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({
|
|
6789
6836
|
sessionId: this._sessionId,
|
|
6790
6837
|
keepaliveTimeoutMs: this.getServerKeepaliveTimeoutMs(),
|
|
6791
6838
|
reconnectBackoffMs: this.config.timeouts?.reconnectBackoffMs ?? 2e3,
|
|
@@ -6802,7 +6849,7 @@ var b_ = class {
|
|
|
6802
6849
|
this.config.onError?.(e);
|
|
6803
6850
|
},
|
|
6804
6851
|
onRefreshEntrypoints: this._connectUrl ? async () => {
|
|
6805
|
-
let e = await
|
|
6852
|
+
let e = await Jh(this._connectUrl, this.abortController?.signal);
|
|
6806
6853
|
return this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, {
|
|
6807
6854
|
entrypoints: e.authResponse.Entrypoints,
|
|
6808
6855
|
sessionId: this._sessionId
|
|
@@ -6844,7 +6891,7 @@ var b_ = class {
|
|
|
6844
6891
|
let n = this.groupEntrypointsByType(this._connectedEntrypoints), r = this.abortController?.signal;
|
|
6845
6892
|
for (let e of t) {
|
|
6846
6893
|
let t = n.get(e)?.[0]?.Uri;
|
|
6847
|
-
if (!(t === void 0 || r?.aborted) && await
|
|
6894
|
+
if (!(t === void 0 || r?.aborted) && await T_(e, t, { signal: r })) {
|
|
6848
6895
|
this.endpointSelector.recordFasterTypeReachable(e);
|
|
6849
6896
|
return;
|
|
6850
6897
|
}
|
|
@@ -6916,7 +6963,7 @@ var b_ = class {
|
|
|
6916
6963
|
}
|
|
6917
6964
|
if (this._reauthInProgress) return;
|
|
6918
6965
|
this.clearReconnectTimer();
|
|
6919
|
-
let e = this._disconnectedAt === null ? Infinity : Date.now() - this._disconnectedAt, t = e >
|
|
6966
|
+
let e = this._disconnectedAt === null ? Infinity : Date.now() - this._disconnectedAt, t = e > Md;
|
|
6920
6967
|
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;
|
|
6921
6968
|
else if (!t && !this._softReconnectAttempted && !this._fullReauthAttempted && this.authResponse) {
|
|
6922
6969
|
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);
|
|
@@ -6943,7 +6990,7 @@ var b_ = class {
|
|
|
6943
6990
|
}
|
|
6944
6991
|
this.clearReconnectTimer(), Z.info("Scheduling reconnect retry in 10 seconds"), this._reconnectTimer = setTimeout(() => {
|
|
6945
6992
|
this._reconnectTimer = null, this.attemptReconnect();
|
|
6946
|
-
},
|
|
6993
|
+
}, Nd);
|
|
6947
6994
|
}
|
|
6948
6995
|
clearReconnectTimer() {
|
|
6949
6996
|
this._reconnectTimer &&= (clearTimeout(this._reconnectTimer), null);
|
|
@@ -6974,8 +7021,8 @@ var b_ = class {
|
|
|
6974
7021
|
let t = e.target?.closest?.("a[href]");
|
|
6975
7022
|
if (!t || t.target && t.target !== "_self") return;
|
|
6976
7023
|
let n = t.getAttribute("href") ?? "";
|
|
6977
|
-
if (
|
|
6978
|
-
e.preventDefault(),
|
|
7024
|
+
if (y_(n)) {
|
|
7025
|
+
e.preventDefault(), b_(n);
|
|
6979
7026
|
return;
|
|
6980
7027
|
}
|
|
6981
7028
|
let r = this.resolveInPlaceDestination(t, n);
|
|
@@ -6994,7 +7041,7 @@ var b_ = class {
|
|
|
6994
7041
|
} catch {
|
|
6995
7042
|
return null;
|
|
6996
7043
|
}
|
|
6997
|
-
return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search ||
|
|
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;
|
|
6998
7045
|
}
|
|
6999
7046
|
sendDisconnectSignal() {
|
|
7000
7047
|
if (this._sessionId !== void 0 && this.currentState === "connected") try {
|
|
@@ -7070,7 +7117,7 @@ var b_ = class {
|
|
|
7070
7117
|
});
|
|
7071
7118
|
}, 150);
|
|
7072
7119
|
}), window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
7073
|
-
this.sendUpdateClientContext({ theme:
|
|
7120
|
+
this.sendUpdateClientContext({ theme: pp() });
|
|
7074
7121
|
});
|
|
7075
7122
|
}
|
|
7076
7123
|
setupExternalConnectUrlListener() {
|
|
@@ -7096,12 +7143,12 @@ var b_ = class {
|
|
|
7096
7143
|
if (this.currentState !== "waitingForExternalConnectUrl") throw Error(`Cannot connect with external connect URL: already in state ${this.currentState}`);
|
|
7097
7144
|
Z.info("Connecting with external connect URL");
|
|
7098
7145
|
try {
|
|
7099
|
-
await this.executeConnection(() =>
|
|
7146
|
+
await this.executeConnection(() => Jh(e, this.abortController.signal));
|
|
7100
7147
|
} finally {
|
|
7101
7148
|
this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null);
|
|
7102
7149
|
}
|
|
7103
7150
|
}
|
|
7104
|
-
},
|
|
7151
|
+
}, N_ = class {
|
|
7105
7152
|
client;
|
|
7106
7153
|
constructor(e) {
|
|
7107
7154
|
this.client = e;
|
|
@@ -7119,54 +7166,54 @@ var b_ = class {
|
|
|
7119
7166
|
}, { close: () => n.close() }) : { close: () => {} };
|
|
7120
7167
|
}
|
|
7121
7168
|
};
|
|
7122
|
-
function
|
|
7123
|
-
return new
|
|
7169
|
+
function P_(e) {
|
|
7170
|
+
return new N_(e);
|
|
7124
7171
|
}
|
|
7125
7172
|
//#endregion
|
|
7126
7173
|
//#region src/client/connection-state.ts
|
|
7127
|
-
function
|
|
7174
|
+
function F_(e) {
|
|
7128
7175
|
return e === "waitingForExternalConnectUrl" || e === "connecting" || e === "connectingSlow" || e === "reconnecting";
|
|
7129
7176
|
}
|
|
7130
|
-
function
|
|
7177
|
+
function I_(e) {
|
|
7131
7178
|
return e === "connected";
|
|
7132
7179
|
}
|
|
7133
|
-
function
|
|
7180
|
+
function L_(e) {
|
|
7134
7181
|
return e === "offline" || e === "offlineError";
|
|
7135
7182
|
}
|
|
7136
|
-
function
|
|
7183
|
+
function R_(e) {
|
|
7137
7184
|
return e === "offlineError";
|
|
7138
7185
|
}
|
|
7139
7186
|
//#endregion
|
|
7140
7187
|
//#region src/utils/opcode-names.ts
|
|
7141
|
-
var
|
|
7142
|
-
for (let [e, t] of Object.entries(T)) typeof t == "number" &&
|
|
7143
|
-
function
|
|
7144
|
-
return
|
|
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}`;
|
|
7145
7192
|
}
|
|
7146
7193
|
//#endregion
|
|
7147
7194
|
//#region src/login/reprovision.ts
|
|
7148
|
-
var
|
|
7149
|
-
function
|
|
7195
|
+
var V_ = "ikon-login-app-route";
|
|
7196
|
+
function H_(e) {
|
|
7150
7197
|
if (typeof window > "u") return;
|
|
7151
7198
|
try {
|
|
7152
|
-
sessionStorage.setItem(
|
|
7199
|
+
sessionStorage.setItem(V_, window.location.pathname);
|
|
7153
7200
|
} catch {}
|
|
7154
7201
|
let t = new URL(window.location.href);
|
|
7155
7202
|
t.searchParams.set(_u, e), window.location.href = t.toString();
|
|
7156
7203
|
}
|
|
7157
|
-
function
|
|
7204
|
+
function U_() {
|
|
7158
7205
|
let e = null;
|
|
7159
7206
|
try {
|
|
7160
|
-
e = sessionStorage.getItem(
|
|
7207
|
+
e = sessionStorage.getItem(V_), sessionStorage.removeItem(V_);
|
|
7161
7208
|
} catch {}
|
|
7162
7209
|
return {
|
|
7163
7210
|
appRoute: e,
|
|
7164
|
-
pendingCall:
|
|
7211
|
+
pendingCall: rf()
|
|
7165
7212
|
};
|
|
7166
7213
|
}
|
|
7167
7214
|
//#endregion
|
|
7168
7215
|
//#region src/media/ring-buffer.ts
|
|
7169
|
-
var
|
|
7216
|
+
var W_ = class {
|
|
7170
7217
|
static getStorageForCapacity(e, t) {
|
|
7171
7218
|
let n = Int32Array.BYTES_PER_ELEMENT * 2, r = t.BYTES_PER_ELEMENT * e;
|
|
7172
7219
|
return new SharedArrayBuffer(n + r);
|
|
@@ -7217,7 +7264,7 @@ var M_ = class {
|
|
|
7217
7264
|
};
|
|
7218
7265
|
//#endregion
|
|
7219
7266
|
//#region src/worker/audio-capture-worker.ts?worker
|
|
7220
|
-
function
|
|
7267
|
+
function G_(e) {
|
|
7221
7268
|
return new Worker("" + new URL("assets/audio-capture-worker-CJ5S-nQt.js", import.meta.url).href, {
|
|
7222
7269
|
type: "module",
|
|
7223
7270
|
name: e?.name
|
|
@@ -7225,11 +7272,11 @@ function N_(e) {
|
|
|
7225
7272
|
}
|
|
7226
7273
|
//#endregion
|
|
7227
7274
|
//#region src/media/ikon-audio-capture.ts
|
|
7228
|
-
var Q = w("IkonAudioCapture"),
|
|
7229
|
-
function
|
|
7275
|
+
var Q = w("IkonAudioCapture"), K_ = 3, q_ = 200, J_ = 2e3, Y_ = 5e3, X_ = 3e3;
|
|
7276
|
+
function Z_(e) {
|
|
7230
7277
|
return new Promise((t) => setTimeout(t, e));
|
|
7231
7278
|
}
|
|
7232
|
-
function
|
|
7279
|
+
function Q_(e) {
|
|
7233
7280
|
switch (e.name) {
|
|
7234
7281
|
case "NotReadableError": return {
|
|
7235
7282
|
action: "retry",
|
|
@@ -7265,14 +7312,14 @@ function B_(e) {
|
|
|
7265
7312
|
};
|
|
7266
7313
|
}
|
|
7267
7314
|
}
|
|
7268
|
-
function
|
|
7315
|
+
function $_() {
|
|
7269
7316
|
let e = globalThis.crypto;
|
|
7270
7317
|
return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
|
|
7271
7318
|
}
|
|
7272
|
-
function
|
|
7319
|
+
function ev() {
|
|
7273
7320
|
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";
|
|
7274
7321
|
}
|
|
7275
|
-
var
|
|
7322
|
+
var tv = class e {
|
|
7276
7323
|
client;
|
|
7277
7324
|
static RESUME_TIMEOUT_MS = 3e3;
|
|
7278
7325
|
worker = null;
|
|
@@ -7333,7 +7380,7 @@ var U_ = class e {
|
|
|
7333
7380
|
notifyError(e, t, n, r) {
|
|
7334
7381
|
if (e.stopped) return;
|
|
7335
7382
|
let i = Date.now(), a = t.name;
|
|
7336
|
-
if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime <
|
|
7383
|
+
if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < Y_) return;
|
|
7337
7384
|
e.lastErrorTime = i, e.lastErrorReason = n, e.lastErrorName = a;
|
|
7338
7385
|
let o = this.config.autoRestartPolicy;
|
|
7339
7386
|
if (o?.enabled && r) {
|
|
@@ -7391,7 +7438,7 @@ var U_ = class e {
|
|
|
7391
7438
|
if (e.ctx.state === "running") return !0;
|
|
7392
7439
|
if (e.ctx.state !== "suspended") return !1;
|
|
7393
7440
|
let r = Date.now();
|
|
7394
|
-
if (!n && r - e.lastResumeAttemptTime <
|
|
7441
|
+
if (!n && r - e.lastResumeAttemptTime < X_) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
|
|
7395
7442
|
e.lastResumeAttemptTime = r, this.emitDiagnostic({
|
|
7396
7443
|
event: "resume-attempt",
|
|
7397
7444
|
captureId: e.captureId,
|
|
@@ -7427,7 +7474,7 @@ var U_ = class e {
|
|
|
7427
7474
|
attemptResume(e, t, n = !1) {
|
|
7428
7475
|
if (e.stopped || e.ctx.state !== "suspended") return;
|
|
7429
7476
|
let r = Date.now();
|
|
7430
|
-
if (!n && r - e.lastResumeAttemptTime <
|
|
7477
|
+
if (!n && r - e.lastResumeAttemptTime < X_) {
|
|
7431
7478
|
Q.debug(`Resume attempt from ${t} skipped (cooldown)`);
|
|
7432
7479
|
return;
|
|
7433
7480
|
}
|
|
@@ -7526,7 +7573,7 @@ var U_ = class e {
|
|
|
7526
7573
|
}
|
|
7527
7574
|
ensureWorker() {
|
|
7528
7575
|
if (this.worker) return this.worker;
|
|
7529
|
-
let e = new
|
|
7576
|
+
let e = new G_();
|
|
7530
7577
|
return this.worker = e, e.addEventListener("message", (e) => {
|
|
7531
7578
|
let t = e.data;
|
|
7532
7579
|
if (t?.type === "error") {
|
|
@@ -7624,25 +7671,25 @@ var U_ = class e {
|
|
|
7624
7671
|
reason: "unknown",
|
|
7625
7672
|
canRetry: !1
|
|
7626
7673
|
};
|
|
7627
|
-
for (let r = 0; r <
|
|
7674
|
+
for (let r = 0; r < K_; r++) try {
|
|
7628
7675
|
return {
|
|
7629
7676
|
stream: await navigator.mediaDevices.getUserMedia({ audio: e }),
|
|
7630
7677
|
error: t,
|
|
7631
7678
|
errorInfo: n
|
|
7632
7679
|
};
|
|
7633
7680
|
} catch (e) {
|
|
7634
|
-
if (t = e instanceof Error ? e : Error(String(e)), n =
|
|
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({
|
|
7635
7682
|
event: "retry",
|
|
7636
7683
|
details: {
|
|
7637
7684
|
attempt: r + 1,
|
|
7638
|
-
maxAttempts:
|
|
7685
|
+
maxAttempts: K_,
|
|
7639
7686
|
errorName: t.name,
|
|
7640
7687
|
action: n.action
|
|
7641
7688
|
}
|
|
7642
7689
|
}), n.action !== "retry") break;
|
|
7643
7690
|
if (r < 2) {
|
|
7644
|
-
let e =
|
|
7645
|
-
Q.debug(`Retrying getUserMedia in ${e}ms`), await
|
|
7691
|
+
let e = q_ * (r + 1);
|
|
7692
|
+
Q.debug(`Retrying getUserMedia in ${e}ms`), await Z_(e);
|
|
7646
7693
|
}
|
|
7647
7694
|
}
|
|
7648
7695
|
return {
|
|
@@ -7653,7 +7700,7 @@ var U_ = class e {
|
|
|
7653
7700
|
}
|
|
7654
7701
|
async ensureWorklet(e) {
|
|
7655
7702
|
if (!we(e)) throw Error("AudioWorklet is not supported in this browser");
|
|
7656
|
-
if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([
|
|
7703
|
+
if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([ev()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
|
|
7657
7704
|
await this.workletReady;
|
|
7658
7705
|
return;
|
|
7659
7706
|
} catch {
|
|
@@ -7680,7 +7727,7 @@ var U_ = class e {
|
|
|
7680
7727
|
if (!t) throw Error("Cannot start audio capture before client is connected");
|
|
7681
7728
|
if (this.client.isWebRtcCaptureAvailable) return this.startMicWebRtc(e);
|
|
7682
7729
|
this.client.isWebRtcEnabled && Q.warn("WebRTC unavailable, capturing audio via protocol channel");
|
|
7683
|
-
let n =
|
|
7730
|
+
let n = $_(), r = {
|
|
7684
7731
|
captureId: n,
|
|
7685
7732
|
aborted: !1,
|
|
7686
7733
|
stream: null,
|
|
@@ -7718,7 +7765,7 @@ var U_ = class e {
|
|
|
7718
7765
|
let f = xe() ? "sab" : "pcm", p;
|
|
7719
7766
|
if (f === "sab") {
|
|
7720
7767
|
let e = Math.floor(a.sampleRate * 10);
|
|
7721
|
-
p =
|
|
7768
|
+
p = W_.getStorageForCapacity(e, Float32Array);
|
|
7722
7769
|
}
|
|
7723
7770
|
let m = this.ensureWorker(), h = e.onStopped;
|
|
7724
7771
|
m.postMessage({
|
|
@@ -7866,7 +7913,7 @@ var U_ = class e {
|
|
|
7866
7913
|
};
|
|
7867
7914
|
this.setupAudioContextStateListener(a, _), this.setupVisibilityChangeListener(_), this.setupBFCacheHandlers(_), _.healthCheckTimer = setInterval(() => {
|
|
7868
7915
|
this.performHealthCheck(_);
|
|
7869
|
-
},
|
|
7916
|
+
}, J_);
|
|
7870
7917
|
let te = () => {
|
|
7871
7918
|
_.stopped || (Q.warn(`Microphone track ended unexpectedly, captureId=${n.substring(0, 8)}`), this.handleRecoverableError(_, /* @__PURE__ */ Error("Microphone track ended unexpectedly"), "track-ended"));
|
|
7872
7919
|
};
|
|
@@ -8015,8 +8062,8 @@ var U_ = class e {
|
|
|
8015
8062
|
let t = this.captures.get(e);
|
|
8016
8063
|
return !t || t.stopped ? !1 : this.attemptResumeAsync(t, "userGesture", !0);
|
|
8017
8064
|
}
|
|
8018
|
-
},
|
|
8019
|
-
function
|
|
8065
|
+
}, nv = 3e3;
|
|
8066
|
+
function rv(e, t, n, r) {
|
|
8020
8067
|
if (!n && !r) return {
|
|
8021
8068
|
width: e,
|
|
8022
8069
|
height: t
|
|
@@ -8027,7 +8074,7 @@ function G_(e, t, n, r) {
|
|
|
8027
8074
|
height: Math.max(1, Math.floor(t * o))
|
|
8028
8075
|
};
|
|
8029
8076
|
}
|
|
8030
|
-
async function
|
|
8077
|
+
async function iv(e, t) {
|
|
8031
8078
|
let n = t.mime ?? "image/jpeg", r = t.quality ?? .92;
|
|
8032
8079
|
if (typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas) try {
|
|
8033
8080
|
return await e.convertToBlob({
|
|
@@ -8042,7 +8089,7 @@ async function K_(e, t) {
|
|
|
8042
8089
|
}, n, r);
|
|
8043
8090
|
});
|
|
8044
8091
|
}
|
|
8045
|
-
var
|
|
8092
|
+
var av = class {
|
|
8046
8093
|
async captureFromStream(e, t = {}) {
|
|
8047
8094
|
let n = e.getVideoTracks()[0];
|
|
8048
8095
|
if (!n) throw Error("No video track available in the provided stream");
|
|
@@ -8053,7 +8100,7 @@ var q_ = class {
|
|
|
8053
8100
|
} catch {}
|
|
8054
8101
|
try {
|
|
8055
8102
|
await new Promise((e, t) => {
|
|
8056
|
-
let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")),
|
|
8103
|
+
let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), nv);
|
|
8057
8104
|
r.addEventListener("loadedmetadata", () => {
|
|
8058
8105
|
clearTimeout(n), e();
|
|
8059
8106
|
}, { once: !0 }), r.addEventListener("error", () => {
|
|
@@ -8063,7 +8110,7 @@ var q_ = class {
|
|
|
8063
8110
|
try {
|
|
8064
8111
|
await r.play();
|
|
8065
8112
|
} catch {}
|
|
8066
|
-
let { width: e, height: i } =
|
|
8113
|
+
let { width: e, height: i } = rv(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
|
|
8067
8114
|
if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(e, i);
|
|
8068
8115
|
else {
|
|
8069
8116
|
let t = document.createElement("canvas");
|
|
@@ -8072,7 +8119,7 @@ var q_ = class {
|
|
|
8072
8119
|
let o = a.getContext("2d", { alpha: !1 });
|
|
8073
8120
|
if (!o) throw Error("2D canvas context unavailable");
|
|
8074
8121
|
o.drawImage(r, 0, 0, e, i);
|
|
8075
|
-
let s = await
|
|
8122
|
+
let s = await iv(a, t), c = await s.arrayBuffer();
|
|
8076
8123
|
return {
|
|
8077
8124
|
mime: s.type || t.mime || "image/jpeg",
|
|
8078
8125
|
width: e,
|
|
@@ -8113,7 +8160,7 @@ var q_ = class {
|
|
|
8113
8160
|
} catch {}
|
|
8114
8161
|
try {
|
|
8115
8162
|
await new Promise((e, t) => {
|
|
8116
|
-
let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")),
|
|
8163
|
+
let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), nv);
|
|
8117
8164
|
r.addEventListener("loadedmetadata", () => {
|
|
8118
8165
|
clearTimeout(n), e();
|
|
8119
8166
|
}, { once: !0 }), r.addEventListener("error", () => {
|
|
@@ -8123,7 +8170,7 @@ var q_ = class {
|
|
|
8123
8170
|
try {
|
|
8124
8171
|
await r.play();
|
|
8125
8172
|
} catch {}
|
|
8126
|
-
let { width: t, height: i } =
|
|
8173
|
+
let { width: t, height: i } = rv(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
|
|
8127
8174
|
if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(t, i);
|
|
8128
8175
|
else {
|
|
8129
8176
|
let e = document.createElement("canvas");
|
|
@@ -8132,7 +8179,7 @@ var q_ = class {
|
|
|
8132
8179
|
let o = a.getContext("2d", { alpha: !1 });
|
|
8133
8180
|
if (!o) throw Error("2D canvas context unavailable");
|
|
8134
8181
|
o.drawImage(r, 0, 0, t, i);
|
|
8135
|
-
let s = await
|
|
8182
|
+
let s = await iv(a, e), c = await s.arrayBuffer();
|
|
8136
8183
|
return {
|
|
8137
8184
|
mime: s.type || e.mime || "image/jpeg",
|
|
8138
8185
|
width: t,
|
|
@@ -8156,11 +8203,11 @@ var q_ = class {
|
|
|
8156
8203
|
}
|
|
8157
8204
|
async captureFromNativeCamera(e = {}) {
|
|
8158
8205
|
if (typeof document > "u") throw Error("Native camera capture requires a DOM environment");
|
|
8159
|
-
let t = await
|
|
8160
|
-
return t ? await
|
|
8206
|
+
let t = await ov(e.facing);
|
|
8207
|
+
return t ? await sv(t, e) : null;
|
|
8161
8208
|
}
|
|
8162
8209
|
};
|
|
8163
|
-
function
|
|
8210
|
+
function ov(e) {
|
|
8164
8211
|
return new Promise((t) => {
|
|
8165
8212
|
let n = document.createElement("input");
|
|
8166
8213
|
n.type = "file", n.accept = "image/*", n.setAttribute("capture", e ?? "environment"), n.style.position = "fixed", n.style.left = "-99999px", n.style.top = "0";
|
|
@@ -8186,7 +8233,7 @@ function J_(e) {
|
|
|
8186
8233
|
n.click();
|
|
8187
8234
|
});
|
|
8188
8235
|
}
|
|
8189
|
-
async function
|
|
8236
|
+
async function sv(e, t) {
|
|
8190
8237
|
let n = URL.createObjectURL(e), r;
|
|
8191
8238
|
try {
|
|
8192
8239
|
r = await new Promise((e, t) => {
|
|
@@ -8196,7 +8243,7 @@ async function Y_(e, t) {
|
|
|
8196
8243
|
} finally {
|
|
8197
8244
|
URL.revokeObjectURL(n);
|
|
8198
8245
|
}
|
|
8199
|
-
let i = r.naturalWidth || r.width, a = r.naturalHeight || r.height, { width: o, height: s } =
|
|
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;
|
|
8200
8247
|
if (o === i && s === a && e.type === c) {
|
|
8201
8248
|
let t = await e.arrayBuffer();
|
|
8202
8249
|
return {
|
|
@@ -8223,7 +8270,7 @@ async function Y_(e, t) {
|
|
|
8223
8270
|
}
|
|
8224
8271
|
//#endregion
|
|
8225
8272
|
//#region src/worker/video-capture-worker.ts?worker
|
|
8226
|
-
function
|
|
8273
|
+
function cv(e) {
|
|
8227
8274
|
return new Worker("" + new URL("assets/video-capture-worker-D5jsT6I4.js", import.meta.url).href, {
|
|
8228
8275
|
type: "module",
|
|
8229
8276
|
name: e?.name
|
|
@@ -8232,16 +8279,16 @@ function X_(e) {
|
|
|
8232
8279
|
//#endregion
|
|
8233
8280
|
//#region src/media/ikon-video-capture.ts
|
|
8234
8281
|
var $ = w("IkonVideoCapture");
|
|
8235
|
-
function
|
|
8282
|
+
function lv() {
|
|
8236
8283
|
let e = globalThis.crypto;
|
|
8237
8284
|
return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
|
|
8238
8285
|
}
|
|
8239
|
-
function
|
|
8286
|
+
function uv() {
|
|
8240
8287
|
let e = globalThis.MediaStreamTrackProcessor;
|
|
8241
8288
|
if (!e) throw Error("MediaStreamTrackProcessor is not available in this browser");
|
|
8242
8289
|
return e;
|
|
8243
8290
|
}
|
|
8244
|
-
var
|
|
8291
|
+
var dv = class {
|
|
8245
8292
|
client;
|
|
8246
8293
|
worker = null;
|
|
8247
8294
|
protocolPort = null;
|
|
@@ -8257,7 +8304,7 @@ var $_ = class {
|
|
|
8257
8304
|
}
|
|
8258
8305
|
ensureWorker() {
|
|
8259
8306
|
if (this.worker) return this.worker;
|
|
8260
|
-
let e = new
|
|
8307
|
+
let e = new cv();
|
|
8261
8308
|
return this.worker = e, e.addEventListener("message", (e) => {
|
|
8262
8309
|
let t = e.data;
|
|
8263
8310
|
if (t?.type === "error") {
|
|
@@ -8367,10 +8414,10 @@ var $_ = class {
|
|
|
8367
8414
|
if (this.client.isWebRtcCaptureAvailable && e.sourceType === "camera") return this.startCameraWebRtc(e);
|
|
8368
8415
|
if (this.client.isWebRtcCaptureAvailable && e.sourceType === "screen") return this.startScreenWebRtc(e);
|
|
8369
8416
|
this.client.isWebRtcEnabled && $.warn("WebRTC unavailable, capturing video via protocol channel"), this.ensurePorts();
|
|
8370
|
-
let n =
|
|
8417
|
+
let n = lv(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
|
|
8371
8418
|
if (!i) throw r.getTracks().forEach((e) => e.stop()), Error("No video track available");
|
|
8372
8419
|
e.sourceType === "screen" && await new Promise((e) => setTimeout(e, 200));
|
|
8373
|
-
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 (
|
|
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;
|
|
8374
8421
|
u.postMessage({
|
|
8375
8422
|
type: "start",
|
|
8376
8423
|
captureId: n,
|
|
@@ -8493,16 +8540,16 @@ var $_ = class {
|
|
|
8493
8540
|
}
|
|
8494
8541
|
this.protocolPort?.close(), this.protocolPort = null, this.sendPort?.close(), this.sendPort = null;
|
|
8495
8542
|
}
|
|
8496
|
-
},
|
|
8543
|
+
}, fv = /* @__PURE__ */ d({ IkonMediaCapture: () => pv }), pv = class {
|
|
8497
8544
|
audio;
|
|
8498
8545
|
video;
|
|
8499
8546
|
image;
|
|
8500
8547
|
constructor(e, t) {
|
|
8501
|
-
this.audio = new
|
|
8548
|
+
this.audio = new tv(e, t?.audio), this.video = new dv(e), this.image = new av();
|
|
8502
8549
|
}
|
|
8503
8550
|
dispose() {
|
|
8504
8551
|
this.audio.dispose(), this.video.dispose();
|
|
8505
8552
|
}
|
|
8506
8553
|
};
|
|
8507
8554
|
//#endregion
|
|
8508
|
-
export { ou as AccessDeniedError,
|
|
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 };
|