@ikonai/sdk 1.0.56 → 1.0.58
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/app-messaging.d.ts +51 -0
- package/client/connection-state.d.ts +19 -3
- package/client/ikon-client.d.ts +15 -7
- package/index.d.ts +1 -0
- package/index.js +244 -196
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const to = {
|
|
2
2
|
Compressed: 8
|
|
3
3
|
};
|
|
4
|
-
function
|
|
4
|
+
function rm(t) {
|
|
5
5
|
return t;
|
|
6
6
|
}
|
|
7
7
|
function Pe(t) {
|
|
@@ -21,7 +21,7 @@ function ge(t) {
|
|
|
21
21
|
throw new Error("Protocol header exceeds payload length");
|
|
22
22
|
const E = [];
|
|
23
23
|
let T = 27;
|
|
24
|
-
for (let
|
|
24
|
+
for (let I = 0; I < c; I++)
|
|
25
25
|
E.push(n.getUint32(T, !0)), T += 4;
|
|
26
26
|
return {
|
|
27
27
|
length: r,
|
|
@@ -58,8 +58,8 @@ function O(t, e, n, r, s) {
|
|
|
58
58
|
const i = s?.trackId ?? 0, o = s?.sequenceId ?? 0, a = s?.flags ?? 0, c = s?.targetIds ?? [], l = s?.payloadType ?? 8, d = 27 + c.length * 4, h = d + e.length, u = new Uint8Array(h), E = new DataView(u.buffer);
|
|
59
59
|
E.setUint32(0, h, !0), E.setUint32(4, t >>> 0, !0), E.setUint32(8, r >>> 0, !0), E.setUint32(12, i >>> 0, !0), E.setUint32(16, o >>> 0, !0), E.setUint32(20, c.length >>> 0, !0), E.setUint8(24, n & 255), E.setUint8(25, l & 255), E.setUint8(26, a & 255);
|
|
60
60
|
let T = 27;
|
|
61
|
-
for (let
|
|
62
|
-
E.setUint32(T, c[
|
|
61
|
+
for (let I = 0; I < c.length; I++)
|
|
62
|
+
E.setUint32(T, c[I] >>> 0, !0), T += 4;
|
|
63
63
|
return u.set(e, d), u;
|
|
64
64
|
}
|
|
65
65
|
async function no(t) {
|
|
@@ -2970,17 +2970,17 @@ class _i extends M {
|
|
|
2970
2970
|
super(`Channel provisioning timeout after ${e}ms`), this.name = "ProvisioningTimeoutError";
|
|
2971
2971
|
}
|
|
2972
2972
|
}
|
|
2973
|
-
class
|
|
2973
|
+
class sm extends M {
|
|
2974
2974
|
constructor(e) {
|
|
2975
2975
|
super(`Channel not found: ${e}`), this.name = "ChannelNotFoundError";
|
|
2976
2976
|
}
|
|
2977
2977
|
}
|
|
2978
|
-
class
|
|
2978
|
+
class im extends M {
|
|
2979
2979
|
constructor(e) {
|
|
2980
2980
|
super(`Space not found for domain: ${e}`), this.name = "SpaceNotFoundError";
|
|
2981
2981
|
}
|
|
2982
2982
|
}
|
|
2983
|
-
class
|
|
2983
|
+
class om extends M {
|
|
2984
2984
|
constructor() {
|
|
2985
2985
|
super("No channels available in this space"), this.name = "NoChannelsError";
|
|
2986
2986
|
}
|
|
@@ -3016,10 +3016,10 @@ function Sn() {
|
|
|
3016
3016
|
function Ah(t) {
|
|
3017
3017
|
rt = t;
|
|
3018
3018
|
}
|
|
3019
|
-
function
|
|
3019
|
+
function am() {
|
|
3020
3020
|
return rt;
|
|
3021
3021
|
}
|
|
3022
|
-
function
|
|
3022
|
+
function cm(t, e) {
|
|
3023
3023
|
return Rt.set(t, e ?? {
|
|
3024
3024
|
minLevel: 2
|
|
3025
3025
|
/* WARN */
|
|
@@ -3089,7 +3089,7 @@ function L(t) {
|
|
|
3089
3089
|
}
|
|
3090
3090
|
};
|
|
3091
3091
|
}
|
|
3092
|
-
const Rh = "ikon-proxy", bh = "ikon-websocket", Nh = "ikon-webtransport", gi = "ikon-debug", kh = "ikon-lang", wi = "ikon-server-url",
|
|
3092
|
+
const Rh = "ikon-proxy", bh = "ikon-websocket", Nh = "ikon-webtransport", gi = "ikon-debug", kh = "ikon-lang", wi = "ikon-server-url", lm = "ikon-git-source", um = "ikon-git-branch", Dh = "ikon-audio", vh = "ikon-video", Oh = "ikon-webrtc", Si = "ikon-inspect", Uh = "ikon-retry", Mh = "ikon-api";
|
|
3093
3093
|
function nn(t, e) {
|
|
3094
3094
|
if (typeof window > "u")
|
|
3095
3095
|
return null;
|
|
@@ -3121,7 +3121,7 @@ function Fh() {
|
|
|
3121
3121
|
function Bh() {
|
|
3122
3122
|
return j(gi) === !0;
|
|
3123
3123
|
}
|
|
3124
|
-
function
|
|
3124
|
+
function dm() {
|
|
3125
3125
|
return nn(kh);
|
|
3126
3126
|
}
|
|
3127
3127
|
function xh() {
|
|
@@ -3841,7 +3841,7 @@ class Qh {
|
|
|
3841
3841
|
this.stabilityTimer && (clearTimeout(this.stabilityTimer), this.stabilityTimer = null);
|
|
3842
3842
|
}
|
|
3843
3843
|
}
|
|
3844
|
-
const
|
|
3844
|
+
const hm = "opus", fm = 48e3, pm = 2, Em = 64e3, Zh = 150, mm = "VP8", qh = 5e6, _m = 30, ef = 0.05, tf = "max-bundle", nf = "require", rf = 16, sf = 16, of = "ikon-data", af = !1, cf = 0, V = L("WebRTCConnection");
|
|
3845
3845
|
class lf {
|
|
3846
3846
|
pc = null;
|
|
3847
3847
|
dataChannel = null;
|
|
@@ -4301,16 +4301,16 @@ function Ri() {
|
|
|
4301
4301
|
for (const t of Nt)
|
|
4302
4302
|
t();
|
|
4303
4303
|
}
|
|
4304
|
-
function
|
|
4304
|
+
function Im() {
|
|
4305
4305
|
return rn;
|
|
4306
4306
|
}
|
|
4307
4307
|
function bi(t) {
|
|
4308
4308
|
rn = { required: !0, reason: t }, Ri();
|
|
4309
4309
|
}
|
|
4310
|
-
function
|
|
4310
|
+
function Tm() {
|
|
4311
4311
|
rn = { required: !1, reason: null }, Ri();
|
|
4312
4312
|
}
|
|
4313
|
-
function
|
|
4313
|
+
function gm(t) {
|
|
4314
4314
|
return Nt.add(t), () => Nt.delete(t);
|
|
4315
4315
|
}
|
|
4316
4316
|
function mf(t) {
|
|
@@ -4474,7 +4474,7 @@ function Uf(t) {
|
|
|
4474
4474
|
if (!e || /^javascript:/i.test(e))
|
|
4475
4475
|
return !1;
|
|
4476
4476
|
try {
|
|
4477
|
-
return window.open(e, "_blank", "noopener,noreferrer")
|
|
4477
|
+
return window.open(e, "_blank", "noopener,noreferrer"), !0;
|
|
4478
4478
|
} catch {
|
|
4479
4479
|
return !1;
|
|
4480
4480
|
}
|
|
@@ -4689,7 +4689,7 @@ function dt() {
|
|
|
4689
4689
|
return crypto.randomUUID();
|
|
4690
4690
|
}
|
|
4691
4691
|
}
|
|
4692
|
-
function
|
|
4692
|
+
function wm() {
|
|
4693
4693
|
if (!(typeof localStorage > "u"))
|
|
4694
4694
|
try {
|
|
4695
4695
|
localStorage.removeItem(vt);
|
|
@@ -4706,7 +4706,7 @@ function ip(t) {
|
|
|
4706
4706
|
return null;
|
|
4707
4707
|
}
|
|
4708
4708
|
}
|
|
4709
|
-
const st = {}, Ot = "https://api.prod.ikon.live", Ut = "https://api.dev.ikon.live", mt = "https://auth.ikonai.com", _t = "https://auth.dev.ikonai.com",
|
|
4709
|
+
const st = {}, Ot = "https://api.prod.ikon.live", Ut = "https://api.dev.ikon.live", mt = "https://auth.ikonai.com", _t = "https://auth.dev.ikonai.com", Sm = "https://auth.ikonai.com", op = [".ikonai.app", ".ikonai.com", ".ikonai.run", ".ikon.live"];
|
|
4710
4710
|
function ln(t) {
|
|
4711
4711
|
return op.some((n) => t.endsWith(n)) ? t.includes(".dev.") ? "development" : "production" : null;
|
|
4712
4712
|
}
|
|
@@ -4741,7 +4741,7 @@ function It(t) {
|
|
|
4741
4741
|
const n = ki();
|
|
4742
4742
|
return n || (typeof window > "u" ? Ot : ft() ? (ln(window.location.hostname) ?? Ue ?? "production") === "development" ? Ut : Ot : Ut);
|
|
4743
4743
|
}
|
|
4744
|
-
function
|
|
4744
|
+
function Am() {
|
|
4745
4745
|
const t = typeof import.meta < "u" ? st.VITE_IKON_BACKEND_TYPE : void 0;
|
|
4746
4746
|
if (t === "development" || t === "production")
|
|
4747
4747
|
return t;
|
|
@@ -4768,7 +4768,7 @@ function ht() {
|
|
|
4768
4768
|
return e;
|
|
4769
4769
|
}
|
|
4770
4770
|
const lp = ["ikon_token", "ikon_provider", "error"];
|
|
4771
|
-
function
|
|
4771
|
+
function Cm() {
|
|
4772
4772
|
if (typeof window > "u")
|
|
4773
4773
|
return { parameters: {} };
|
|
4774
4774
|
const t = window.location.pathname;
|
|
@@ -4798,7 +4798,7 @@ function ft() {
|
|
|
4798
4798
|
function un() {
|
|
4799
4799
|
return typeof window > "u" ? "" : window.location.pathname.replace(/^\/(s|c)\/[^/]+/, "") || "/";
|
|
4800
4800
|
}
|
|
4801
|
-
function
|
|
4801
|
+
function ym() {
|
|
4802
4802
|
if (typeof window > "u") return;
|
|
4803
4803
|
const t = window.location.pathname, e = t.match(/^\/s\/[^/]+/), n = t.match(/^\/c\/[^/]+/);
|
|
4804
4804
|
if (e || n) {
|
|
@@ -4806,7 +4806,7 @@ function Cm() {
|
|
|
4806
4806
|
window.history.replaceState(null, "", r + window.location.search);
|
|
4807
4807
|
}
|
|
4808
4808
|
}
|
|
4809
|
-
const H = L("Authenticator"), _e = S.GROUP_CORE | S.GROUP_KEEPALIVE | S.GROUP_EVENTS | S.GROUP_ACTIONS | S.GROUP_UI | S.GROUP_AUDIO | S.GROUP_VIDEO | S.GROUP_ANALYTICS, up = 2, dp = 6e4, hp = 2e3, vi = 1e4, fp = 3e3, pp = 3e3, Oi = 3;
|
|
4809
|
+
const H = L("Authenticator"), _e = S.GROUP_CORE | S.GROUP_KEEPALIVE | S.GROUP_EVENTS | S.GROUP_ACTIONS | S.GROUP_UI | S.GROUP_AUDIO | S.GROUP_VIDEO | S.GROUP_ANALYTICS | S.GROUP_APP_LOCAL, up = 2, dp = 6e4, hp = 2e3, vi = 1e4, fp = 3e3, pp = 3e3, Oi = 3;
|
|
4810
4810
|
async function Ep(t, e, n, r) {
|
|
4811
4811
|
if (t)
|
|
4812
4812
|
try {
|
|
@@ -4988,12 +4988,12 @@ async function Sp(t, e) {
|
|
|
4988
4988
|
const s = { ...ht(), ...t.parameters }, i = t.deviceId ?? dt();
|
|
4989
4989
|
let o = t.userId, a = t.token;
|
|
4990
4990
|
if (!o) {
|
|
4991
|
-
const
|
|
4992
|
-
|
|
4991
|
+
const I = await Ep(t.spaceId, i, await cp(t.authUrl), e);
|
|
4992
|
+
I && (o = I.userId, a = I.token);
|
|
4993
4993
|
}
|
|
4994
4994
|
if (o || (o = i, H.debug("Using deviceId as userId fallback")), t.spaceId && a)
|
|
4995
4995
|
if (t.token) {
|
|
4996
|
-
const
|
|
4996
|
+
const I = It(t.backendUrl), m = await fetch(`${I}/profiles/me?space=${encodeURIComponent(t.spaceId)}`, {
|
|
4997
4997
|
method: "GET",
|
|
4998
4998
|
headers: { Authorization: `Bearer ${a}` },
|
|
4999
4999
|
signal: e
|
|
@@ -5010,8 +5010,8 @@ async function Sp(t, e) {
|
|
|
5010
5010
|
signal: e
|
|
5011
5011
|
});
|
|
5012
5012
|
if (!d.ok) {
|
|
5013
|
-
const
|
|
5014
|
-
throw new M(`Failed to get connect token: ${d.status} ${
|
|
5013
|
+
const I = await d.text().catch(() => "Unknown error");
|
|
5014
|
+
throw new M(`Failed to get connect token: ${d.status} ${I}`);
|
|
5015
5015
|
}
|
|
5016
5016
|
const u = (await d.json()).token;
|
|
5017
5017
|
if (!u)
|
|
@@ -5075,10 +5075,10 @@ async function Ap(t, e, n = "auto", r = !1) {
|
|
|
5075
5075
|
isTouchDevice: an(),
|
|
5076
5076
|
initialPath: un(),
|
|
5077
5077
|
sdkType: 2
|
|
5078
|
-
},
|
|
5078
|
+
}, I = e ? AbortSignal.any([e, AbortSignal.timeout(l)]) : AbortSignal.timeout(l), m = await Mi(s, T, a, I);
|
|
5079
5079
|
if (m.state?.toLowerCase() !== "running" || !m.configuration?.url)
|
|
5080
5080
|
throw new _i(l);
|
|
5081
|
-
const p = await Li(m.configuration.url, m.configuration.proxyUrl, n, r,
|
|
5081
|
+
const p = await Li(m.configuration.url, m.configuration.proxyUrl, n, r, I);
|
|
5082
5082
|
return p.backendUrl = s, p.authToken = a, p;
|
|
5083
5083
|
} catch (T) {
|
|
5084
5084
|
if (T instanceof lt || E === u - 1)
|
|
@@ -5127,8 +5127,8 @@ async function Cp(t, e, n = "auto", r = !1) {
|
|
|
5127
5127
|
}, E = e ? AbortSignal.any([e, AbortSignal.timeout(a)]) : AbortSignal.timeout(a), T = await Mi(s, u, i, E);
|
|
5128
5128
|
if (T.state?.toLowerCase() !== "running" || !T.configuration?.url)
|
|
5129
5129
|
throw new _i(a);
|
|
5130
|
-
const
|
|
5131
|
-
return
|
|
5130
|
+
const I = await Li(T.configuration.url, T.configuration.proxyUrl, n, r, E);
|
|
5131
|
+
return I.backendUrl = s, I.authToken = i, I;
|
|
5132
5132
|
} catch (u) {
|
|
5133
5133
|
if (u instanceof lt || h === d - 1)
|
|
5134
5134
|
throw u;
|
|
@@ -5734,8 +5734,8 @@ class xp {
|
|
|
5734
5734
|
}
|
|
5735
5735
|
try {
|
|
5736
5736
|
await new Promise((E, T) => {
|
|
5737
|
-
const
|
|
5738
|
-
s.addEventListener("loadedmetadata",
|
|
5737
|
+
const I = () => E(), m = () => T(new Error("Failed to load video element"));
|
|
5738
|
+
s.addEventListener("loadedmetadata", I, { once: !0 }), s.addEventListener("error", m, { once: !0 });
|
|
5739
5739
|
});
|
|
5740
5740
|
try {
|
|
5741
5741
|
await s.play();
|
|
@@ -5797,8 +5797,8 @@ class xp {
|
|
|
5797
5797
|
}
|
|
5798
5798
|
try {
|
|
5799
5799
|
await new Promise((E, T) => {
|
|
5800
|
-
const
|
|
5801
|
-
s.addEventListener("loadedmetadata",
|
|
5800
|
+
const I = () => E(), m = () => T(new Error("Failed to load video element"));
|
|
5801
|
+
s.addEventListener("loadedmetadata", I, { once: !0 }), s.addEventListener("error", m, { once: !0 });
|
|
5802
5802
|
});
|
|
5803
5803
|
try {
|
|
5804
5804
|
await s.play();
|
|
@@ -5887,17 +5887,17 @@ async function Gp(t, e) {
|
|
|
5887
5887
|
const n = URL.createObjectURL(t);
|
|
5888
5888
|
let r;
|
|
5889
5889
|
try {
|
|
5890
|
-
r = await new Promise((
|
|
5890
|
+
r = await new Promise((I, m) => {
|
|
5891
5891
|
const p = new Image();
|
|
5892
|
-
p.onload = () =>
|
|
5892
|
+
p.onload = () => I(p), p.onerror = () => m(new Error("Failed to decode image")), p.src = n;
|
|
5893
5893
|
});
|
|
5894
5894
|
} finally {
|
|
5895
5895
|
URL.revokeObjectURL(n);
|
|
5896
5896
|
}
|
|
5897
5897
|
const s = r.naturalWidth || r.width, i = r.naturalHeight || r.height, { width: o, height: a } = Lt(s, i, e.width, e.height), c = e.mime ?? (t.type === "image/png" ? "image/png" : ot), l = e.quality ?? Fi;
|
|
5898
5898
|
if (o === s && a === i && t.type === c) {
|
|
5899
|
-
const
|
|
5900
|
-
return { mime: t.type, width: s, height: i, data: new Uint8Array(
|
|
5899
|
+
const I = await t.arrayBuffer();
|
|
5900
|
+
return { mime: t.type, width: s, height: i, data: new Uint8Array(I) };
|
|
5901
5901
|
}
|
|
5902
5902
|
const h = document.createElement("canvas");
|
|
5903
5903
|
h.width = o, h.height = a;
|
|
@@ -5905,9 +5905,9 @@ async function Gp(t, e) {
|
|
|
5905
5905
|
if (!u)
|
|
5906
5906
|
throw new Error("2D canvas context unavailable");
|
|
5907
5907
|
u.drawImage(r, 0, 0, o, a);
|
|
5908
|
-
const E = await new Promise((
|
|
5908
|
+
const E = await new Promise((I, m) => {
|
|
5909
5909
|
h.toBlob(
|
|
5910
|
-
(p) => p ?
|
|
5910
|
+
(p) => p ? I(p) : m(new Error("Canvas toBlob returned null")),
|
|
5911
5911
|
c,
|
|
5912
5912
|
l
|
|
5913
5913
|
);
|
|
@@ -7448,9 +7448,9 @@ class dn {
|
|
|
7448
7448
|
continue;
|
|
7449
7449
|
if (!E)
|
|
7450
7450
|
return this._visemeResult.mouthOpenY = u.mouthOpenY, this._visemeResult.mouthForm = u.mouthForm, this._visemeResult;
|
|
7451
|
-
const
|
|
7452
|
-
if (u !== E && E.samplePosition > u.samplePosition && p >
|
|
7453
|
-
const f = Math.min(1, Math.max(0, (a -
|
|
7451
|
+
const I = u.samplePosition, m = Math.max(u.frameSamples, 1), p = I + m;
|
|
7452
|
+
if (u !== E && E.samplePosition > u.samplePosition && p > I) {
|
|
7453
|
+
const f = Math.min(1, Math.max(0, (a - I) / (p - I)));
|
|
7454
7454
|
this._visemeResult.mouthOpenY = u.mouthOpenY + f * (E.mouthOpenY - u.mouthOpenY), this._visemeResult.mouthForm = u.mouthForm + f * (E.mouthForm - u.mouthForm);
|
|
7455
7455
|
} else
|
|
7456
7456
|
this._visemeResult.mouthOpenY = u.mouthOpenY, this._visemeResult.mouthForm = u.mouthForm;
|
|
@@ -7716,7 +7716,7 @@ class dn {
|
|
|
7716
7716
|
this.stopAudioWorklet(), this.pendingWorkletMessages = [];
|
|
7717
7717
|
const r = 1024, s = new Float32Array(r * x), i = Math.round(this.outputSampleRateHz * Hi / 1e3), o = Math.round(this.outputSampleRateHz * Ft / 1e3), a = 1 / i, c = 1 / o, l = new Array(x), d = [], h = e.createScriptProcessor(r, 0, x);
|
|
7718
7718
|
h.onaudioprocess = (u) => {
|
|
7719
|
-
const E = u.outputBuffer, T = E.numberOfChannels,
|
|
7719
|
+
const E = u.outputBuffer, T = E.numberOfChannels, I = E.length;
|
|
7720
7720
|
for (let p = 0; p < T; p++) {
|
|
7721
7721
|
const f = E.getChannelData(p);
|
|
7722
7722
|
f.fill(0), l[p] = f;
|
|
@@ -7725,7 +7725,7 @@ class dn {
|
|
|
7725
7725
|
d.length = 0;
|
|
7726
7726
|
for (const [p, f] of this.fallbackQueues.entries()) {
|
|
7727
7727
|
f.totalSamples > 0 && (m += 1), (f.ending || f.inputDrained) && f.fadeDirection !== "out" && f.totalSamples / T * 1e3 / this.outputSampleRateHz <= Ft * 2 && (f.fadeDirection = "out"), this.readFromFallbackQueue(f, s), (f.totalSamples > 0 || !f.hasLastOut) && ((!f.lastOut || f.lastOut.length !== s.length) && (f.lastOut = new Float32Array(s.length)), f.lastOut.set(s), f.hasLastOut = !0);
|
|
7728
|
-
for (let C = 0; C <
|
|
7728
|
+
for (let C = 0; C < I; C++) {
|
|
7729
7729
|
f.fadeDirection === "in" ? (f.fadeGain = Math.min(1, f.fadeGain + a), f.fadeGain >= 1 && (f.fadeDirection = "none")) : f.fadeDirection === "out" && (f.fadeGain = Math.max(0, f.fadeGain - c), f.fadeGain <= 0 && (f.fadeDirection = "none"));
|
|
7730
7730
|
for (let k = 0; k < T; k++) {
|
|
7731
7731
|
const g = s[C * T + k];
|
|
@@ -7735,7 +7735,7 @@ class dn {
|
|
|
7735
7735
|
const D = f.ending || f.inputDrained;
|
|
7736
7736
|
if (D && f.totalSamples <= 0) {
|
|
7737
7737
|
if (f.fadeDirection === "out" && f.fadeGain > 1e-3) {
|
|
7738
|
-
for (let C = 0; C <
|
|
7738
|
+
for (let C = 0; C < I; C++)
|
|
7739
7739
|
if (f.fadeGain = Math.max(0, f.fadeGain - c), f.fadeGain <= 1e-3) {
|
|
7740
7740
|
f.fadeGain = 0, f.fadeDirection = "none";
|
|
7741
7741
|
break;
|
|
@@ -7744,8 +7744,8 @@ class dn {
|
|
|
7744
7744
|
f.fadeGain <= 1e-3 && f.ending && d.push(p);
|
|
7745
7745
|
} else if (!D && f.totalSamples <= 0 && f.hasLastOut && f.lastOut && f.fadeGain > 1e-3) {
|
|
7746
7746
|
f.fadeDirection = "out", f.underrunPending = !0;
|
|
7747
|
-
const C = f.lastOut, k =
|
|
7748
|
-
for (let g = 0; g <
|
|
7747
|
+
const C = f.lastOut, k = I - 1;
|
|
7748
|
+
for (let g = 0; g < I; g++) {
|
|
7749
7749
|
f.fadeGain = Math.max(0, f.fadeGain - c), f.fadeGain <= 0 && (f.fadeDirection = "none");
|
|
7750
7750
|
for (let te = 0; te < T; te++) {
|
|
7751
7751
|
const En = C[k * T + te];
|
|
@@ -7761,11 +7761,11 @@ class dn {
|
|
|
7761
7761
|
}
|
|
7762
7762
|
if (m > 1) {
|
|
7763
7763
|
const p = 1 / Math.sqrt(m);
|
|
7764
|
-
for (let f = 0; f <
|
|
7764
|
+
for (let f = 0; f < I; f++)
|
|
7765
7765
|
for (let D = 0; D < T; D++)
|
|
7766
7766
|
l[D][f] *= p;
|
|
7767
7767
|
}
|
|
7768
|
-
for (let p = 0; p <
|
|
7768
|
+
for (let p = 0; p < I; p++)
|
|
7769
7769
|
for (let f = 0; f < T; f++) {
|
|
7770
7770
|
const D = l[f][p];
|
|
7771
7771
|
l[f][p] = D > 1 ? 1 : D < -1 ? -1 : D;
|
|
@@ -8680,7 +8680,7 @@ class DE {
|
|
|
8680
8680
|
} catch {
|
|
8681
8681
|
}
|
|
8682
8682
|
e.pendingRestartTimer && clearTimeout(e.pendingRestartTimer);
|
|
8683
|
-
const E = e.restartCount, T = e.onError,
|
|
8683
|
+
const E = e.restartCount, T = e.onError, I = {
|
|
8684
8684
|
...e.originalRequest,
|
|
8685
8685
|
constraints: e.currentConstraints,
|
|
8686
8686
|
options: e.currentOptions,
|
|
@@ -8688,7 +8688,7 @@ class DE {
|
|
|
8688
8688
|
onStateChange: e.onStateChange
|
|
8689
8689
|
};
|
|
8690
8690
|
e.pendingRestartTimer = setTimeout(() => {
|
|
8691
|
-
e.pendingRestartTimer = null, !(!e.stopped || e.stoppedReason !== "recoverable-error") && this.startMic(
|
|
8691
|
+
e.pendingRestartTimer = null, !(!e.stopped || e.stoppedReason !== "recoverable-error") && this.startMic(I).then((m) => {
|
|
8692
8692
|
const p = this.captures.get(m.captureId);
|
|
8693
8693
|
p && (p.restartCount = E, p.lastStableTime = Date.now());
|
|
8694
8694
|
}).catch((m) => {
|
|
@@ -9064,9 +9064,9 @@ class DE {
|
|
|
9064
9064
|
s.source = h;
|
|
9065
9065
|
const u = o.createGain();
|
|
9066
9066
|
u.gain.value = 0, u.connect(o.destination), s.gain = u;
|
|
9067
|
-
const
|
|
9067
|
+
const I = et() ? "sab" : "pcm";
|
|
9068
9068
|
let m;
|
|
9069
|
-
if (
|
|
9069
|
+
if (I === "sab") {
|
|
9070
9070
|
const y = Math.floor(o.sampleRate * 10);
|
|
9071
9071
|
m = wE.getStorageForCapacity(y, Float32Array);
|
|
9072
9072
|
}
|
|
@@ -9084,7 +9084,7 @@ class DE {
|
|
|
9084
9084
|
...e.options,
|
|
9085
9085
|
preferWebCodecs: this.config.performance?.preferWebCodecs
|
|
9086
9086
|
},
|
|
9087
|
-
transport:
|
|
9087
|
+
transport: I,
|
|
9088
9088
|
sharedArrayBuffer: m,
|
|
9089
9089
|
correlationId: e.correlationId
|
|
9090
9090
|
}), await new Promise((y, B) => {
|
|
@@ -9107,12 +9107,12 @@ class DE {
|
|
|
9107
9107
|
numberOfOutputs: 1,
|
|
9108
9108
|
outputChannelCount: [1],
|
|
9109
9109
|
processorOptions: {
|
|
9110
|
-
transport:
|
|
9110
|
+
transport: I,
|
|
9111
9111
|
channels: 1,
|
|
9112
9112
|
sharedArrayBuffer: m
|
|
9113
9113
|
}
|
|
9114
9114
|
});
|
|
9115
|
-
s.worklet = C, h.connect(C), C.connect(u),
|
|
9115
|
+
s.worklet = C, h.connect(C), C.connect(u), I === "pcm" && (C.port.onmessage = (y) => {
|
|
9116
9116
|
const B = y.data;
|
|
9117
9117
|
if (!(!B || typeof B != "object") && B.type === "pcm" && B.pcm instanceof Float32Array) {
|
|
9118
9118
|
const z = B.pcm;
|
|
@@ -9567,7 +9567,7 @@ class ME {
|
|
|
9567
9567
|
if (!i)
|
|
9568
9568
|
throw s.getTracks().forEach((p) => p.stop()), new Error("No video track available");
|
|
9569
9569
|
e.sourceType === "screen" && await new Promise((p) => setTimeout(p, 200));
|
|
9570
|
-
const o = i.getSettings(), a = e.sourceType === "screen" ? o.width ?? pe : e.options?.width ?? o.width ?? pe, c = e.sourceType === "screen" ? o.height ?? Ee : e.options?.height ?? o.height ?? Ee, l = UE(), h = new l({ track: i }).readable, u = this.allocateTrackId(), E = this.ensureWorker(), T = e.sourceType,
|
|
9570
|
+
const o = i.getSettings(), a = e.sourceType === "screen" ? o.width ?? pe : e.options?.width ?? o.width ?? pe, c = e.sourceType === "screen" ? o.height ?? Ee : e.options?.height ?? o.height ?? Ee, l = UE(), h = new l({ track: i }).readable, u = this.allocateTrackId(), E = this.ensureWorker(), T = e.sourceType, I = e.onStopped;
|
|
9571
9571
|
E.postMessage(
|
|
9572
9572
|
{
|
|
9573
9573
|
type: "start",
|
|
@@ -9605,9 +9605,9 @@ class ME {
|
|
|
9605
9605
|
s.getTracks().forEach((p) => p.stop());
|
|
9606
9606
|
} catch {
|
|
9607
9607
|
}
|
|
9608
|
-
if (E.postMessage({ type: "stop", captureId: r }),
|
|
9608
|
+
if (E.postMessage({ type: "stop", captureId: r }), I)
|
|
9609
9609
|
try {
|
|
9610
|
-
|
|
9610
|
+
I();
|
|
9611
9611
|
} catch {
|
|
9612
9612
|
}
|
|
9613
9613
|
}
|
|
@@ -9719,10 +9719,10 @@ let We = !1;
|
|
|
9719
9719
|
function BE() {
|
|
9720
9720
|
return We = Vh(), We;
|
|
9721
9721
|
}
|
|
9722
|
-
function
|
|
9722
|
+
function Rm() {
|
|
9723
9723
|
return We;
|
|
9724
9724
|
}
|
|
9725
|
-
function
|
|
9725
|
+
function bm() {
|
|
9726
9726
|
We || (We = !0, Ai(Si, "true"));
|
|
9727
9727
|
}
|
|
9728
9728
|
const Yi = 1e3, ji = q.INFO;
|
|
@@ -9733,26 +9733,26 @@ function xE(t) {
|
|
|
9733
9733
|
function WE(t) {
|
|
9734
9734
|
Bt = t?.maxBufferSize ?? Yi, zi = t?.minLevel ?? ji, K = [], Ah(xE);
|
|
9735
9735
|
}
|
|
9736
|
-
function
|
|
9736
|
+
function Nm(t) {
|
|
9737
9737
|
xt = t;
|
|
9738
9738
|
}
|
|
9739
|
-
function
|
|
9739
|
+
function km() {
|
|
9740
9740
|
return K;
|
|
9741
9741
|
}
|
|
9742
9742
|
function Xi() {
|
|
9743
9743
|
const t = K;
|
|
9744
9744
|
return K = [], t;
|
|
9745
9745
|
}
|
|
9746
|
-
function
|
|
9746
|
+
function Dm() {
|
|
9747
9747
|
if (!xt || K.length === 0)
|
|
9748
9748
|
return 0;
|
|
9749
9749
|
const t = Xi();
|
|
9750
9750
|
return xt(t), t.length;
|
|
9751
9751
|
}
|
|
9752
|
-
function
|
|
9752
|
+
function vm() {
|
|
9753
9753
|
K = [];
|
|
9754
9754
|
}
|
|
9755
|
-
function
|
|
9755
|
+
function Om() {
|
|
9756
9756
|
return K.length;
|
|
9757
9757
|
}
|
|
9758
9758
|
WE();
|
|
@@ -10005,19 +10005,19 @@ class em {
|
|
|
10005
10005
|
}
|
|
10006
10006
|
}
|
|
10007
10007
|
}
|
|
10008
|
-
const
|
|
10008
|
+
const _ = L("IkonClient");
|
|
10009
10009
|
function tm() {
|
|
10010
10010
|
return typeof __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__ < "u" && __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__;
|
|
10011
10011
|
}
|
|
10012
|
-
class
|
|
10012
|
+
class Um {
|
|
10013
10013
|
channelManager = null;
|
|
10014
10014
|
protocolWorker = null;
|
|
10015
10015
|
preloadedWorker = null;
|
|
10016
10016
|
workerManagerState = null;
|
|
10017
10017
|
authResponse = null;
|
|
10018
10018
|
_connectUrl;
|
|
10019
|
-
currentState = "
|
|
10020
|
-
|
|
10019
|
+
currentState = "connecting";
|
|
10020
|
+
_connectStarted = !1;
|
|
10021
10021
|
connectionTimer = null;
|
|
10022
10022
|
messageSubscribers = /* @__PURE__ */ new Map();
|
|
10023
10023
|
// Indexed arrays for O(1) subscriber iteration in hot path (parallel to messageSubscribers Map)
|
|
@@ -10027,7 +10027,16 @@ class Om {
|
|
|
10027
10027
|
stateSubscribers = /* @__PURE__ */ new Set();
|
|
10028
10028
|
abortController = null;
|
|
10029
10029
|
config;
|
|
10030
|
-
|
|
10030
|
+
_slowConnectionThresholdMs;
|
|
10031
|
+
/**
|
|
10032
|
+
* Time (ms) after which a still-`connecting` session should be considered "slow"
|
|
10033
|
+
* by the React layer (see `useIkonApp().isConnectingSlow`). The SDK no longer
|
|
10034
|
+
* transitions state for it — exposed here so the React timer can honor the
|
|
10035
|
+
* config value if the host overrides it.
|
|
10036
|
+
*/
|
|
10037
|
+
get slowConnectionThresholdMs() {
|
|
10038
|
+
return this._slowConnectionThresholdMs;
|
|
10039
|
+
}
|
|
10031
10040
|
connectionTimeoutMs;
|
|
10032
10041
|
actionAckTimeoutMs;
|
|
10033
10042
|
_pendingActionAcks = /* @__PURE__ */ new Map();
|
|
@@ -10160,7 +10169,7 @@ class Om {
|
|
|
10160
10169
|
return this._webRtcSignaling;
|
|
10161
10170
|
}
|
|
10162
10171
|
constructor(e) {
|
|
10163
|
-
this.config = e, this.
|
|
10172
|
+
this.config = e, this._slowConnectionThresholdMs = e.timeouts?.slowConnectionThresholdMs ?? df, this.connectionTimeoutMs = e.timeouts?.connectionTimeoutMs ?? hf, this.actionAckTimeoutMs = e.timeouts?.actionAckTimeoutMs ?? ff;
|
|
10164
10173
|
const n = [e.local, e.apiKey, e.sessionToken].filter(Boolean).length;
|
|
10165
10174
|
if (n === 0)
|
|
10166
10175
|
throw new Error('IkonClient requires one of: "local", "apiKey", or "sessionToken" configuration');
|
|
@@ -10173,7 +10182,7 @@ class Om {
|
|
|
10173
10182
|
proxyMode: s,
|
|
10174
10183
|
websocket: a,
|
|
10175
10184
|
webtransport: c
|
|
10176
|
-
}), s !== "auto" ?
|
|
10185
|
+
}), s !== "auto" ? _.info(`Proxy mode: ${s}`) : this.endpointSelector.proxyPreferred && _.info("Proxy preferred (from previous session)"), (a !== void 0 || c !== void 0) && _.debug(`Transport filter: websocket=${a ?? "auto"}, webtransport=${c ?? "auto"}`), this._functionRegistry = new kp(), this._reactiveRegistry = new Mp(this._functionRegistry), je() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = sp(this._functionRegistry), this.unregisterSoundFunctions = nE(this._functionRegistry)), je() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(Pp));
|
|
10177
10186
|
const l = Wh(), d = Gh();
|
|
10178
10187
|
this._audioEnabled = l ?? e.audio?.enabled ?? !0, this._videoEnabled = d ?? e.video?.enabled ?? !0;
|
|
10179
10188
|
const h = e.audio ? {
|
|
@@ -10191,8 +10200,8 @@ class Om {
|
|
|
10191
10200
|
}
|
|
10192
10201
|
_lastError = void 0;
|
|
10193
10202
|
/**
|
|
10194
|
-
* Get the error that
|
|
10195
|
-
* Returns undefined
|
|
10203
|
+
* Get the error that drove the client into the `offline` state, if any.
|
|
10204
|
+
* Returns undefined when offline-without-error or when not in offline state.
|
|
10196
10205
|
*/
|
|
10197
10206
|
get lastError() {
|
|
10198
10207
|
return this._lastError;
|
|
@@ -10244,19 +10253,19 @@ class Om {
|
|
|
10244
10253
|
* Returns when connected or throws if connection fails.
|
|
10245
10254
|
*/
|
|
10246
10255
|
async connect() {
|
|
10247
|
-
if (this.
|
|
10248
|
-
throw new Error(`Cannot connect: already
|
|
10249
|
-
this.setupLifecycleHandlers();
|
|
10256
|
+
if (this._connectStarted)
|
|
10257
|
+
throw new Error(`Cannot connect: already started (state: ${this.currentState})`);
|
|
10258
|
+
this._connectStarted = !0, this.setupLifecycleHandlers();
|
|
10250
10259
|
const e = xh();
|
|
10251
10260
|
if (e) {
|
|
10252
|
-
|
|
10261
|
+
_.info("Found external connect URL in query parameter"), await this.executeConnection(() => he(e, this.abortController.signal));
|
|
10253
10262
|
return;
|
|
10254
10263
|
}
|
|
10255
10264
|
if (this._waitForExternalConnectUrl) {
|
|
10256
|
-
|
|
10265
|
+
_.info("Waiting for external connect URL from parent window"), this.setState("waitingForExternalConnectUrl"), this._externalConnectUrlCleanup = this.setupExternalConnectUrlListener();
|
|
10257
10266
|
return;
|
|
10258
10267
|
}
|
|
10259
|
-
|
|
10268
|
+
_.info("Connecting to Ikon server"), await this.executeConnection(() => this.authenticate());
|
|
10260
10269
|
}
|
|
10261
10270
|
/**
|
|
10262
10271
|
* Execute the connection flow with the provided authentication function.
|
|
@@ -10267,18 +10276,16 @@ class Om {
|
|
|
10267
10276
|
this.preloadedWorker = new Hn();
|
|
10268
10277
|
} catch {
|
|
10269
10278
|
}
|
|
10270
|
-
this.setState("connecting"), this.
|
|
10271
|
-
this.currentState === "connecting" && this.setState("
|
|
10272
|
-
}, this.slowConnectionThresholdMs), this.connectionTimer = setTimeout(() => {
|
|
10273
|
-
(this.currentState === "connecting" || this.currentState === "connectingSlow") && (I.error("Connection timeout"), this.abortController?.abort("Connection timeout"), this.setState("offline"), this.config.onError?.(new Error("Connection timeout")));
|
|
10279
|
+
this.setState("connecting"), this.connectionTimer = setTimeout(() => {
|
|
10280
|
+
this.currentState === "connecting" && (_.error("Connection timeout"), this.abortController?.abort("Connection timeout"), this.setState("offline"), this.config.onError?.(new Error("Connection timeout")));
|
|
10274
10281
|
}, this.connectionTimeoutMs);
|
|
10275
10282
|
try {
|
|
10276
10283
|
const n = await e();
|
|
10277
|
-
if (this.authResponse = n.authResponse, this._sessionId = n.authResponse.ClientContext.SessionId, this._connectUrl = n.directUrl,
|
|
10278
|
-
|
|
10284
|
+
if (this.authResponse = n.authResponse, this._sessionId = n.authResponse.ClientContext.SessionId, this._connectUrl = n.directUrl, _.info(`Authenticated to Ikon server (${n.authResponse.ServerSessionId})`), !this.config.local && n.backendUrl && n.authToken && ZE(n.backendUrl, n.authToken, n.authResponse.ServerSessionId, n.authResponse.ChannelInstanceId), n.usedProxyUrl && n.directUrl) {
|
|
10285
|
+
_.info("Auth fell back to proxy, marking proxy preferred");
|
|
10279
10286
|
const r = n.directUrl;
|
|
10280
10287
|
Tp(r).then((s) => {
|
|
10281
|
-
s && (
|
|
10288
|
+
s && (_.info("Background probe: direct server reachable, clearing proxy preference for next connection"), this.endpointSelector.clearProxyPreference());
|
|
10282
10289
|
}).catch(() => {
|
|
10283
10290
|
});
|
|
10284
10291
|
}
|
|
@@ -10286,17 +10293,17 @@ class Om {
|
|
|
10286
10293
|
} catch (n) {
|
|
10287
10294
|
if (n instanceof DOMException && n.name === "AbortError")
|
|
10288
10295
|
return;
|
|
10289
|
-
throw
|
|
10296
|
+
throw _.error("Connection failed:", n), this.clearTimers(), this.setState("offline"), this.config.onError?.(n instanceof Error ? n : new Error(String(n))), n;
|
|
10290
10297
|
}
|
|
10291
10298
|
}
|
|
10292
10299
|
/**
|
|
10293
10300
|
* Disconnect from the server.
|
|
10294
10301
|
*/
|
|
10295
10302
|
disconnect() {
|
|
10296
|
-
|
|
10303
|
+
_.info("Disconnecting from Ikon server"), Qi(), this.clearTimers(), this.cleanupLifecycleHandlers(), this._externalConnectUrlCleanup && (this._externalConnectUrlCleanup(), this._externalConnectUrlCleanup = null), this._mediaCapture?.dispose(), this.unregisterMediaCaptureFunctions && (this.unregisterMediaCaptureFunctions(), this.unregisterMediaCaptureFunctions = null), this.unregisterSoundFunctions && (this.unregisterSoundFunctions(), this.unregisterSoundFunctions = null), this.unregisterBrowserFunctions && (this.unregisterBrowserFunctions(), this.unregisterBrowserFunctions = null), this.unregisterLoginInterceptor && (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;
|
|
10297
10304
|
for (const e of this._webRtcAudioElements.values())
|
|
10298
10305
|
e.pause(), e.srcObject = null, e.remove();
|
|
10299
|
-
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("
|
|
10306
|
+
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");
|
|
10300
10307
|
}
|
|
10301
10308
|
sendActionCall(e, n) {
|
|
10302
10309
|
const r = w.createRandom(), s = _o(
|
|
@@ -10323,7 +10330,7 @@ class Om {
|
|
|
10323
10330
|
this._pendingActionAcks.set(e, n);
|
|
10324
10331
|
}
|
|
10325
10332
|
onActionAckTimeout(e) {
|
|
10326
|
-
this.currentState === "connected" && (
|
|
10333
|
+
this.currentState === "connected" && (_.warn(`No ActionCallAck received within ${this.actionAckTimeoutMs}ms for CallId ${e}, forcing reconnect`), this.clearPendingActionAcks(), this.protocolWorker ? this.protocolWorker.postMessage({ type: "triggerReconnect", reason: "Action ack timeout" }) : this.channelManager?.triggerReconnect("Action ack timeout"));
|
|
10327
10334
|
}
|
|
10328
10335
|
clearPendingActionAcks() {
|
|
10329
10336
|
for (const e of this._pendingActionAcks.values())
|
|
@@ -10349,7 +10356,7 @@ class Om {
|
|
|
10349
10356
|
this.channelManager.sendProtocolMessage(e);
|
|
10350
10357
|
return;
|
|
10351
10358
|
}
|
|
10352
|
-
|
|
10359
|
+
_.warn("Cannot send: not connected");
|
|
10353
10360
|
}
|
|
10354
10361
|
/**
|
|
10355
10362
|
* Send a client context update to the server.
|
|
@@ -10357,7 +10364,7 @@ class Om {
|
|
|
10357
10364
|
*/
|
|
10358
10365
|
sendUpdateClientContext(e) {
|
|
10359
10366
|
if (!this._sessionId) {
|
|
10360
|
-
|
|
10367
|
+
_.warn("Cannot send UpdateClientContext: not connected");
|
|
10361
10368
|
return;
|
|
10362
10369
|
}
|
|
10363
10370
|
const n = _d(
|
|
@@ -10466,7 +10473,7 @@ class Om {
|
|
|
10466
10473
|
return;
|
|
10467
10474
|
this.channelManager?.sendProtocolMessage(c);
|
|
10468
10475
|
} catch (c) {
|
|
10469
|
-
|
|
10476
|
+
_.warn(`Failed to forward protocol send port message: ${c}`);
|
|
10470
10477
|
}
|
|
10471
10478
|
};
|
|
10472
10479
|
try {
|
|
@@ -10549,14 +10556,14 @@ class Om {
|
|
|
10549
10556
|
const i = s.CallId.toString(), o = this._pendingActionAcks.get(i);
|
|
10550
10557
|
o !== void 0 && (clearTimeout(o), this._pendingActionAcks.delete(i));
|
|
10551
10558
|
}).catch((s) => {
|
|
10552
|
-
|
|
10559
|
+
_.warn("Failed to parse ActionCallAck:", s);
|
|
10553
10560
|
});
|
|
10554
10561
|
return;
|
|
10555
10562
|
}
|
|
10556
10563
|
n === S.CORE_GLOBAL_STATE && Cu(e).then((s) => {
|
|
10557
10564
|
this._globalState = s, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(s, this._sessionId), this._globalState.DebugMode && FE(), Wn() && this.protocolWorker && (this.protocolWorker.postMessage({ type: "enableDevtools", enabled: !0 }), this.protocolWorker.postMessage({ type: "setLogLevel", level: Sn() })), this._globalStateReceived || (this._globalStateReceived = !0, this.tryHandleJoined());
|
|
10558
10565
|
}).catch((s) => {
|
|
10559
|
-
|
|
10566
|
+
_.error("Failed to parse GlobalState:", s);
|
|
10560
10567
|
}), this.notifyMessageSubscribers(e, n, r);
|
|
10561
10568
|
}
|
|
10562
10569
|
handleDataChannelMessage(e) {
|
|
@@ -10568,7 +10575,7 @@ class Om {
|
|
|
10568
10575
|
}
|
|
10569
10576
|
this.handleProtocolMessage(n);
|
|
10570
10577
|
} catch (n) {
|
|
10571
|
-
|
|
10578
|
+
_.warn("Failed to parse DataChannel message:", n);
|
|
10572
10579
|
}
|
|
10573
10580
|
}
|
|
10574
10581
|
/**
|
|
@@ -10592,7 +10599,7 @@ class Om {
|
|
|
10592
10599
|
}
|
|
10593
10600
|
s[a](e);
|
|
10594
10601
|
} catch (l) {
|
|
10595
|
-
|
|
10602
|
+
_.error("Message subscriber error:", l);
|
|
10596
10603
|
}
|
|
10597
10604
|
}
|
|
10598
10605
|
}
|
|
@@ -10611,7 +10618,7 @@ class Om {
|
|
|
10611
10618
|
case "stopped":
|
|
10612
10619
|
if (this._serverStopped)
|
|
10613
10620
|
break;
|
|
10614
|
-
|
|
10621
|
+
_.info("Server signaled shutdown"), this._serverStopped = !0, this.clearReconnectTimer(), this.clearTimers(), this.setState("offline");
|
|
10615
10622
|
break;
|
|
10616
10623
|
case "offline":
|
|
10617
10624
|
if (this._reauthInProgress)
|
|
@@ -10620,12 +10627,12 @@ class Om {
|
|
|
10620
10627
|
this.currentState === "connected" && (this._channelsConnected = !1, this._globalStateReceived = !1, this._joinedHandled = !1, this._functionRegistry.detach(), this._reactiveRegistry.detach(), this.releaseKeepaliveLock(), this.setState("reconnecting")), this.attemptReconnect();
|
|
10621
10628
|
break;
|
|
10622
10629
|
}
|
|
10623
|
-
this.
|
|
10630
|
+
this.clearTimers(), this.setState("offline");
|
|
10624
10631
|
break;
|
|
10625
10632
|
case "idle":
|
|
10626
10633
|
if (this._reauthInProgress)
|
|
10627
10634
|
break;
|
|
10628
|
-
|
|
10635
|
+
this.currentState === "connecting" && (this.clearTimers(), this.setState("offline"));
|
|
10629
10636
|
break;
|
|
10630
10637
|
case "connecting":
|
|
10631
10638
|
break;
|
|
@@ -10646,26 +10653,37 @@ class Om {
|
|
|
10646
10653
|
*/
|
|
10647
10654
|
setState(e) {
|
|
10648
10655
|
if (e === "offline" && this._hasBeenConnected && !this._serverStopped && se()) {
|
|
10649
|
-
|
|
10656
|
+
_.error("Refusing to set offline state from connected session — scheduling reconnect retry instead. This is a bug; investigate the call site."), this.setState("reconnecting"), this.scheduleReconnectRetry();
|
|
10650
10657
|
return;
|
|
10651
10658
|
}
|
|
10652
10659
|
if (this.currentState !== e) {
|
|
10653
|
-
this.currentState = e, e !== "
|
|
10660
|
+
this.currentState = e, e !== "offline" && (this._lastError = void 0), e === "reconnecting" ? this._disconnectedAt === null && (this._disconnectedAt = Date.now()) : this._disconnectedAt = null, e !== "connected" && this.clearPendingActionAcks();
|
|
10654
10661
|
for (const n of this.stateSubscribers)
|
|
10655
10662
|
try {
|
|
10656
10663
|
n(e);
|
|
10657
10664
|
} catch (r) {
|
|
10658
|
-
|
|
10665
|
+
_.error("State subscriber error:", r);
|
|
10659
10666
|
}
|
|
10660
10667
|
this.config.onConnectionStateChange?.(e);
|
|
10661
10668
|
}
|
|
10662
10669
|
}
|
|
10663
10670
|
/**
|
|
10664
|
-
*
|
|
10665
|
-
*
|
|
10671
|
+
* Go offline with an associated error message stored on `lastError`.
|
|
10672
|
+
* Used for unrecoverable SDK internal errors. The state itself is `offline`; the error
|
|
10673
|
+
* is surfaced via the companion field so consumers don't need a separate state to handle.
|
|
10666
10674
|
*/
|
|
10667
10675
|
setErrorState(e) {
|
|
10668
|
-
|
|
10676
|
+
if (_.error("SDK error, going offline:", e), this._lastError = e, this.clearReconnectTimer(), this.clearTimers(), this.cleanupLifecycleHandlers(), this.disconnectProtocol(), this.currentState !== "offline") {
|
|
10677
|
+
this.currentState = "offline";
|
|
10678
|
+
for (const n of this.stateSubscribers)
|
|
10679
|
+
try {
|
|
10680
|
+
n("offline");
|
|
10681
|
+
} catch (r) {
|
|
10682
|
+
_.error("State subscriber error:", r);
|
|
10683
|
+
}
|
|
10684
|
+
this.config.onConnectionStateChange?.("offline");
|
|
10685
|
+
}
|
|
10686
|
+
this.config.onError?.(e);
|
|
10669
10687
|
}
|
|
10670
10688
|
async connectProtocol(e, n = !1) {
|
|
10671
10689
|
if (typeof Worker > "u") {
|
|
@@ -10679,14 +10697,14 @@ class Om {
|
|
|
10679
10697
|
try {
|
|
10680
10698
|
r = new Hn();
|
|
10681
10699
|
} catch (h) {
|
|
10682
|
-
|
|
10700
|
+
_.warn(`Failed to create protocol worker, falling back to main thread: ${h}`), await this.connectProtocolOnMainThread(e, n);
|
|
10683
10701
|
return;
|
|
10684
10702
|
}
|
|
10685
10703
|
this.channelManager = null, this.protocolWorker = r, this.workerManagerState = "idle";
|
|
10686
10704
|
const s = new Promise((h, u) => {
|
|
10687
10705
|
let E = !1;
|
|
10688
|
-
const T = (
|
|
10689
|
-
const m =
|
|
10706
|
+
const T = (I) => {
|
|
10707
|
+
const m = I.data;
|
|
10690
10708
|
if (m?.type === "protocol" && m.message instanceof ArrayBuffer) {
|
|
10691
10709
|
const p = new Uint8Array(m.message);
|
|
10692
10710
|
this.handleProtocolMessage(p);
|
|
@@ -10707,7 +10725,7 @@ class Om {
|
|
|
10707
10725
|
sessionId: this._sessionId
|
|
10708
10726
|
});
|
|
10709
10727
|
}).catch((p) => {
|
|
10710
|
-
|
|
10728
|
+
_.warn(`Failed to refresh entrypoints for worker: ${p}`), r.postMessage({ type: "refreshEntrypointsFailed" });
|
|
10711
10729
|
}) : r.postMessage({ type: "refreshEntrypointsFailed" });
|
|
10712
10730
|
return;
|
|
10713
10731
|
}
|
|
@@ -10716,10 +10734,10 @@ class Om {
|
|
|
10716
10734
|
f.name = String(p?.name ?? "Error"), f.name === "AuthRejectedError" && (this._lastFailureWasAuthRejected = !0), u(f);
|
|
10717
10735
|
}
|
|
10718
10736
|
};
|
|
10719
|
-
r.addEventListener("message", T), r.addEventListener("error", (
|
|
10720
|
-
const m = [
|
|
10737
|
+
r.addEventListener("message", T), r.addEventListener("error", (I) => {
|
|
10738
|
+
const m = [I.message, I.filename, I.lineno, I.colno].filter((p) => p != null && String(p).length > 0);
|
|
10721
10739
|
if (E) {
|
|
10722
|
-
|
|
10740
|
+
_.error("Protocol worker crashed after connect, attempting reconnect"), this.workerManagerState = "offline", this.handleChannelManagerStateChange("reconnecting"), this.attemptReconnect();
|
|
10723
10741
|
return;
|
|
10724
10742
|
}
|
|
10725
10743
|
u(new Error(`Protocol worker failed: ${m.join(" ")}`.trim()));
|
|
@@ -10745,10 +10763,10 @@ class Om {
|
|
|
10745
10763
|
this.disconnectProtocol(), this.handleChannelManagerStateChange("offline");
|
|
10746
10764
|
return;
|
|
10747
10765
|
}
|
|
10748
|
-
|
|
10766
|
+
_.warn(`Protocol worker connect failed, falling back to main thread: ${h}`), this.disconnectProtocol(), await this.connectProtocolOnMainThread(e, n);
|
|
10749
10767
|
}
|
|
10750
10768
|
d && (this._audioEnabled || this._videoEnabled) && this.setupWebRtcSignaling().catch((h) => {
|
|
10751
|
-
|
|
10769
|
+
_.warn(`WebRTC signaling setup failed: ${h}`);
|
|
10752
10770
|
});
|
|
10753
10771
|
}
|
|
10754
10772
|
async setupWebRtcSignaling() {
|
|
@@ -10793,9 +10811,9 @@ class Om {
|
|
|
10793
10811
|
try {
|
|
10794
10812
|
await this._webRtcSignaling.connect((r) => {
|
|
10795
10813
|
this.sendProtocolMessage(r);
|
|
10796
|
-
}),
|
|
10814
|
+
}), _.debug("WebRTC signaling started");
|
|
10797
10815
|
} catch (r) {
|
|
10798
|
-
|
|
10816
|
+
_.error("Failed to setup WebRTC signaling:", r), this._webRtcSignaling = null;
|
|
10799
10817
|
}
|
|
10800
10818
|
}
|
|
10801
10819
|
_webRtcAudioUnlockHandler = null;
|
|
@@ -10822,7 +10840,7 @@ class Om {
|
|
|
10822
10840
|
}, 300);
|
|
10823
10841
|
}).catch(() => {
|
|
10824
10842
|
this.ensureWebRtcAudioUnlockHandler();
|
|
10825
|
-
}),
|
|
10843
|
+
}), _.debug(`WebRTC audio track ${e} created`), this._webRtcAudioElements.size === 1 && this.setupWebRtcMediaSession();
|
|
10826
10844
|
}
|
|
10827
10845
|
destroyWebRtcAudioElement(e) {
|
|
10828
10846
|
const n = this._webRtcAudioElements.get(e);
|
|
@@ -10833,7 +10851,7 @@ class Om {
|
|
|
10833
10851
|
let a = 0;
|
|
10834
10852
|
const c = setInterval(() => {
|
|
10835
10853
|
if (a++, a >= s) {
|
|
10836
|
-
clearInterval(c), n.pause(), n.srcObject = null, n.remove(),
|
|
10854
|
+
clearInterval(c), n.pause(), n.srcObject = null, n.remove(), _.debug(`WebRTC audio track ${e} destroyed`);
|
|
10837
10855
|
return;
|
|
10838
10856
|
}
|
|
10839
10857
|
n.volume = Math.max(0, n.volume - o);
|
|
@@ -10878,7 +10896,7 @@ class Om {
|
|
|
10878
10896
|
async connectProtocolOnMainThread(e, n = !1) {
|
|
10879
10897
|
this.workerManagerState = null, this.protocolWorker = null;
|
|
10880
10898
|
const r = pt() ?? this.config.webRtc?.enabled ?? !0;
|
|
10881
|
-
|
|
10899
|
+
_.info(`Connecting on main thread (webRtcEnabled=${r}, entrypoints=${e.length})`), this.channelManager = new Qh({
|
|
10882
10900
|
sessionId: this._sessionId,
|
|
10883
10901
|
keepaliveTimeoutMs: this.config.timeouts?.keepaliveTimeoutMs ?? Cn,
|
|
10884
10902
|
reconnectBackoffMs: this.config.timeouts?.reconnectBackoffMs ?? yn,
|
|
@@ -10960,52 +10978,52 @@ class Om {
|
|
|
10960
10978
|
}
|
|
10961
10979
|
async attemptFullReauth() {
|
|
10962
10980
|
if (this._reauthInProgress) {
|
|
10963
|
-
|
|
10981
|
+
_.warn("Full re-authentication already in progress, skipping");
|
|
10964
10982
|
return;
|
|
10965
10983
|
}
|
|
10966
|
-
this._fullReauthAttempted = !0, this._reauthInProgress = !0,
|
|
10984
|
+
this._fullReauthAttempted = !0, this._reauthInProgress = !0, _.info("Fast reconnect exhausted, attempting full re-authentication"), this.endpointSelector.clearRememberedType(), this.disconnectProtocol(), this._channelsConnected = !1, this._globalStateReceived = !1, this._joinedHandled = !1;
|
|
10967
10985
|
try {
|
|
10968
10986
|
const e = await this.authenticate();
|
|
10969
|
-
this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, this._connectUrl = e.directUrl,
|
|
10987
|
+
this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, this._connectUrl = e.directUrl, _.info("Re-authenticated, connecting to new server"), await this.connectProtocol(this.authResponse.Entrypoints);
|
|
10970
10988
|
} catch (e) {
|
|
10971
10989
|
if (e instanceof DOMException && e.name === "AbortError")
|
|
10972
10990
|
return;
|
|
10973
|
-
|
|
10991
|
+
_.error("Full re-authentication failed:", e), this.config.onError?.(e instanceof Error ? e : new Error(String(e))), this._hasBeenConnected ? this.scheduleReconnectRetry() : (this.clearTimers(), this.setState("offline"));
|
|
10974
10992
|
} finally {
|
|
10975
10993
|
this._reauthInProgress = !1;
|
|
10976
10994
|
}
|
|
10977
10995
|
}
|
|
10978
10996
|
attemptReconnect() {
|
|
10979
10997
|
if (!se()) {
|
|
10980
|
-
|
|
10998
|
+
_.warn("Retry disabled via ikon-retry=false, going offline"), this.clearTimers(), this.setState("offline");
|
|
10981
10999
|
return;
|
|
10982
11000
|
}
|
|
10983
11001
|
if (this._reauthInProgress)
|
|
10984
11002
|
return;
|
|
10985
11003
|
this.clearReconnectTimer();
|
|
10986
11004
|
const e = this._disconnectedAt !== null ? Date.now() - this._disconnectedAt : 1 / 0, n = e > pf;
|
|
10987
|
-
if (
|
|
10988
|
-
|
|
11005
|
+
if (_.info(`Reconnect decision: disconnected ${e === 1 / 0 ? "?" : Math.round(e / 1e3)}s, softExpired=${n}, softAttempted=${this._softReconnectAttempted}, fullAttempted=${this._fullReauthAttempted}, authRejected=${this._lastFailureWasAuthRejected}`), this._lastFailureWasAuthRejected)
|
|
11006
|
+
_.info("Skipping soft reconnect — last failure was auth-rejected, going straight to full re-auth"), this._lastFailureWasAuthRejected = !1, this._softReconnectAttempted = !0;
|
|
10989
11007
|
else if (!n && !this._softReconnectAttempted && !this._fullReauthAttempted && this.authResponse) {
|
|
10990
|
-
|
|
11008
|
+
_.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);
|
|
10991
11009
|
return;
|
|
10992
11010
|
}
|
|
10993
|
-
if (n &&
|
|
11011
|
+
if (n && _.info("Disconnected for more than 5 minutes, skipping soft retry"), !this.canAttemptFullReauth()) {
|
|
10994
11012
|
if (this._hasBeenConnected) {
|
|
10995
|
-
|
|
11013
|
+
_.warn("Cannot attempt reconnection right now, scheduling retry"), this.scheduleReconnectRetry();
|
|
10996
11014
|
return;
|
|
10997
11015
|
}
|
|
10998
|
-
|
|
11016
|
+
_.warn("Cannot attempt reconnection, going offline"), this.clearTimers(), this.setState("offline");
|
|
10999
11017
|
return;
|
|
11000
11018
|
}
|
|
11001
11019
|
this.attemptFullReauth();
|
|
11002
11020
|
}
|
|
11003
11021
|
scheduleReconnectRetry() {
|
|
11004
11022
|
if (!se()) {
|
|
11005
|
-
|
|
11023
|
+
_.warn("Retry disabled via ikon-retry=false, going offline instead of scheduling retry"), this.clearTimers(), this.setState("offline");
|
|
11006
11024
|
return;
|
|
11007
11025
|
}
|
|
11008
|
-
this.clearReconnectTimer(),
|
|
11026
|
+
this.clearReconnectTimer(), _.info("Scheduling reconnect retry in 10 seconds"), this._reconnectTimer = setTimeout(() => {
|
|
11009
11027
|
this._reconnectTimer = null, this.attemptReconnect();
|
|
11010
11028
|
}, Ef);
|
|
11011
11029
|
}
|
|
@@ -11013,16 +11031,16 @@ class Om {
|
|
|
11013
11031
|
this._reconnectTimer && (clearTimeout(this._reconnectTimer), this._reconnectTimer = null);
|
|
11014
11032
|
}
|
|
11015
11033
|
attemptReconnectOnVisible() {
|
|
11016
|
-
this.currentState === "reconnecting" && this._reconnectTimer && (
|
|
11034
|
+
this.currentState === "reconnecting" && this._reconnectTimer && (_.info("Page became visible/online while reconnecting, retrying now"), this.attemptReconnect());
|
|
11017
11035
|
}
|
|
11018
11036
|
handleBrowserOffline() {
|
|
11019
|
-
this.currentState === "connected" && (
|
|
11037
|
+
this.currentState === "connected" && (_.info("Browser reports offline, triggering reconnect"), this.protocolWorker ? this.protocolWorker.postMessage({ type: "triggerReconnect", reason: "Browser offline event" }) : this.channelManager?.triggerReconnect("Browser offline event"));
|
|
11020
11038
|
}
|
|
11021
11039
|
/**
|
|
11022
11040
|
* Clear all timers.
|
|
11023
11041
|
*/
|
|
11024
11042
|
clearTimers() {
|
|
11025
|
-
this.
|
|
11043
|
+
this.connectionTimer && (clearTimeout(this.connectionTimer), this.connectionTimer = null), this.clearReconnectTimer();
|
|
11026
11044
|
}
|
|
11027
11045
|
/**
|
|
11028
11046
|
* Set up browser lifecycle event handlers.
|
|
@@ -11041,14 +11059,14 @@ class Om {
|
|
|
11041
11059
|
* Close connection cleanly to avoid orphaned connections on the server.
|
|
11042
11060
|
*/
|
|
11043
11061
|
handleBeforeUnload() {
|
|
11044
|
-
|
|
11062
|
+
_.debug("Page unloading, closing connection..."), this.disconnect();
|
|
11045
11063
|
}
|
|
11046
11064
|
/**
|
|
11047
11065
|
* Handle page hide event (mobile-friendly, bfcache compatible).
|
|
11048
11066
|
* Only disconnect if page is actually being unloaded (not persisted).
|
|
11049
11067
|
*/
|
|
11050
11068
|
handlePageHide(e) {
|
|
11051
|
-
e.persisted || (
|
|
11069
|
+
e.persisted || (_.debug("Page hidden (not persisted), closing connection..."), this.disconnect());
|
|
11052
11070
|
}
|
|
11053
11071
|
/**
|
|
11054
11072
|
* Handle visibility change event.
|
|
@@ -11077,10 +11095,10 @@ class Om {
|
|
|
11077
11095
|
*/
|
|
11078
11096
|
checkConnectionHealth() {
|
|
11079
11097
|
if (this.protocolWorker) {
|
|
11080
|
-
this.currentState === "connected" && this.workerManagerState !== "connected" && (
|
|
11098
|
+
this.currentState === "connected" && this.workerManagerState !== "connected" && (_.warn("Connection lost while page was backgrounded, reconnecting..."), this.setState("reconnecting"));
|
|
11081
11099
|
return;
|
|
11082
11100
|
}
|
|
11083
|
-
this.channelManager && this.currentState === "connected" && this.channelManager.managerState !== "connected" && (
|
|
11101
|
+
this.channelManager && this.currentState === "connected" && this.channelManager.managerState !== "connected" && (_.warn("Connection lost while page was backgrounded, reconnecting..."), this.setState("reconnecting"));
|
|
11084
11102
|
}
|
|
11085
11103
|
/**
|
|
11086
11104
|
* Try to handle joined state - only proceeds if both channels are connected and GlobalState is received.
|
|
@@ -11101,7 +11119,7 @@ class Om {
|
|
|
11101
11119
|
const e = In(_n(), this._sessionId ?? 0);
|
|
11102
11120
|
this.sendProtocolMessage(e);
|
|
11103
11121
|
} catch (e) {
|
|
11104
|
-
|
|
11122
|
+
_.error("onJoined callback error:", e);
|
|
11105
11123
|
const n = In(_n(), this._sessionId ?? 0);
|
|
11106
11124
|
this.sendProtocolMessage(n);
|
|
11107
11125
|
}
|
|
@@ -11137,17 +11155,17 @@ class Om {
|
|
|
11137
11155
|
*/
|
|
11138
11156
|
setupExternalConnectUrlListener() {
|
|
11139
11157
|
const e = (n) => {
|
|
11140
|
-
n.data?.type === "IKON_EXTERNAL_CONNECT_URL" && typeof n.data.serverUrl == "string" && (
|
|
11141
|
-
|
|
11158
|
+
n.data?.type === "IKON_EXTERNAL_CONNECT_URL" && typeof n.data.serverUrl == "string" && (_.info("Received external connect URL from parent window"), this.handleExternalConnectUrl(n.data.serverUrl).catch((r) => {
|
|
11159
|
+
_.error("Failed to connect with external connect URL:", r), this.setErrorState(r instanceof Error ? r : new Error(String(r)));
|
|
11142
11160
|
}));
|
|
11143
11161
|
};
|
|
11144
|
-
if (window.addEventListener("message", e),
|
|
11162
|
+
if (window.addEventListener("message", e), _.debug("External connect URL listener registered"), window.parent && window.parent !== window)
|
|
11145
11163
|
try {
|
|
11146
|
-
window.parent.postMessage({ type: "IKON_CLIENT_READY_FOR_CONNECT_URL" }, "*"),
|
|
11164
|
+
window.parent.postMessage({ type: "IKON_CLIENT_READY_FOR_CONNECT_URL" }, "*"), _.debug("Posted IKON_CLIENT_READY_FOR_CONNECT_URL to parent window");
|
|
11147
11165
|
} catch {
|
|
11148
11166
|
}
|
|
11149
11167
|
return () => {
|
|
11150
|
-
window.removeEventListener("message", e),
|
|
11168
|
+
window.removeEventListener("message", e), _.debug("External connect URL listener removed");
|
|
11151
11169
|
};
|
|
11152
11170
|
}
|
|
11153
11171
|
/**
|
|
@@ -11156,7 +11174,7 @@ class Om {
|
|
|
11156
11174
|
async handleExternalConnectUrl(e) {
|
|
11157
11175
|
if (this.currentState !== "waitingForExternalConnectUrl")
|
|
11158
11176
|
throw new Error(`Cannot connect with external connect URL: already in state ${this.currentState}`);
|
|
11159
|
-
|
|
11177
|
+
_.info("Connecting with external connect URL");
|
|
11160
11178
|
try {
|
|
11161
11179
|
await this.executeConnection(() => he(e, this.abortController.signal));
|
|
11162
11180
|
} finally {
|
|
@@ -11164,26 +11182,54 @@ class Om {
|
|
|
11164
11182
|
}
|
|
11165
11183
|
}
|
|
11166
11184
|
}
|
|
11167
|
-
|
|
11168
|
-
|
|
11185
|
+
class nm {
|
|
11186
|
+
constructor(e) {
|
|
11187
|
+
this.client = e;
|
|
11188
|
+
}
|
|
11189
|
+
/** Send a typed app message to the server. */
|
|
11190
|
+
send(e, n) {
|
|
11191
|
+
this.client.sendProtocolMessage(e.toProtocolMessage(n, this.client.sessionId ?? 0));
|
|
11192
|
+
}
|
|
11193
|
+
/**
|
|
11194
|
+
* Subscribe to inbound app messages of one type (filtered by its opcode).
|
|
11195
|
+
* The handler receives the decoded native payload and the sender's session id.
|
|
11196
|
+
* Dispose the returned handle to unsubscribe.
|
|
11197
|
+
*/
|
|
11198
|
+
on(e, n) {
|
|
11199
|
+
const r = this.client.createProtocolMessagePort({ opcodeGroupsMask: S.GROUP_APP_LOCAL });
|
|
11200
|
+
return r ? (r.port.onmessage = async (s) => {
|
|
11201
|
+
const i = s.data;
|
|
11202
|
+
if (i?.type !== "protocol" || i.headers?.opcode !== e.opcode)
|
|
11203
|
+
return;
|
|
11204
|
+
const o = new Uint8Array(i.message);
|
|
11205
|
+
n(await e.fromProtocolMessage(o), i.headers.senderId);
|
|
11206
|
+
}, { close: () => r.close() }) : { close: () => {
|
|
11207
|
+
} };
|
|
11208
|
+
}
|
|
11169
11209
|
}
|
|
11170
11210
|
function Mm(t) {
|
|
11171
|
-
return t
|
|
11211
|
+
return new nm(t);
|
|
11172
11212
|
}
|
|
11173
11213
|
function Lm(t) {
|
|
11174
|
-
return t === "
|
|
11214
|
+
return t === "waitingForExternalConnectUrl" || t === "connecting" || t === "connectingSlow" || t === "reconnecting";
|
|
11175
11215
|
}
|
|
11176
11216
|
function Pm(t) {
|
|
11217
|
+
return t === "connected";
|
|
11218
|
+
}
|
|
11219
|
+
function Fm(t) {
|
|
11220
|
+
return t === "offline" || t === "offlineError";
|
|
11221
|
+
}
|
|
11222
|
+
function Bm(t) {
|
|
11177
11223
|
return t === "offlineError";
|
|
11178
11224
|
}
|
|
11179
11225
|
const Zi = /* @__PURE__ */ new Map();
|
|
11180
11226
|
for (const [t, e] of Object.entries(S))
|
|
11181
11227
|
typeof e == "number" && Zi.set(e, t);
|
|
11182
|
-
function
|
|
11228
|
+
function xm(t) {
|
|
11183
11229
|
return Zi.get(t) ?? `UNKNOWN_${t}`;
|
|
11184
11230
|
}
|
|
11185
11231
|
const Wt = "ikon.login.appRoute";
|
|
11186
|
-
function
|
|
11232
|
+
function Wm(t) {
|
|
11187
11233
|
if (typeof window > "u")
|
|
11188
11234
|
return;
|
|
11189
11235
|
try {
|
|
@@ -11193,7 +11239,7 @@ function Bm(t) {
|
|
|
11193
11239
|
const e = new URL(window.location.href);
|
|
11194
11240
|
e.searchParams.set(wi, t), window.location.href = e.toString();
|
|
11195
11241
|
}
|
|
11196
|
-
function
|
|
11242
|
+
function Gm() {
|
|
11197
11243
|
let t = null;
|
|
11198
11244
|
try {
|
|
11199
11245
|
t = sessionStorage.getItem(Wt), sessionStorage.removeItem(Wt);
|
|
@@ -11203,11 +11249,12 @@ function xm() {
|
|
|
11203
11249
|
}
|
|
11204
11250
|
export {
|
|
11205
11251
|
lt as AccessDeniedError,
|
|
11252
|
+
nm as AppMessaging,
|
|
11206
11253
|
de as AuthRejectedError,
|
|
11207
11254
|
M as AuthenticationError,
|
|
11208
11255
|
Xh as Channel,
|
|
11209
11256
|
Qh as ChannelManager,
|
|
11210
|
-
|
|
11257
|
+
sm as ChannelNotFoundError,
|
|
11211
11258
|
fe as ClientType,
|
|
11212
11259
|
qt as ConnectionError,
|
|
11213
11260
|
Ae as ContextType,
|
|
@@ -11215,15 +11262,15 @@ export {
|
|
|
11215
11262
|
A as EntrypointType,
|
|
11216
11263
|
bp as FunctionCallError,
|
|
11217
11264
|
kp as FunctionRegistry,
|
|
11218
|
-
|
|
11265
|
+
Sm as IKON_AUTH_BASE_URL,
|
|
11219
11266
|
_t as IKON_AUTH_URL_DEV,
|
|
11220
11267
|
mt as IKON_AUTH_URL_PROD,
|
|
11221
11268
|
Ut as IKON_BACKEND_URL_DEV,
|
|
11222
11269
|
Ot as IKON_BACKEND_URL_PROD,
|
|
11223
11270
|
Dh as IKON_PARAM_AUDIO,
|
|
11224
11271
|
gi as IKON_PARAM_DEBUG,
|
|
11225
|
-
|
|
11226
|
-
|
|
11272
|
+
um as IKON_PARAM_GIT_BRANCH,
|
|
11273
|
+
lm as IKON_PARAM_GIT_SOURCE,
|
|
11227
11274
|
Si as IKON_PARAM_INSPECT,
|
|
11228
11275
|
kh as IKON_PARAM_LANG,
|
|
11229
11276
|
Rh as IKON_PARAM_PROXY,
|
|
@@ -11235,7 +11282,7 @@ export {
|
|
|
11235
11282
|
Nh as IKON_PARAM_WEBTRANSPORT,
|
|
11236
11283
|
DE as IkonAudioCapture,
|
|
11237
11284
|
dn as IkonAudioPlayback,
|
|
11238
|
-
|
|
11285
|
+
Um as IkonClient,
|
|
11239
11286
|
xp as IkonImageCapture,
|
|
11240
11287
|
gE as IkonMedia,
|
|
11241
11288
|
LE as IkonMediaCapture,
|
|
@@ -11244,17 +11291,17 @@ export {
|
|
|
11244
11291
|
en as KeepaliveTimeoutError,
|
|
11245
11292
|
q as LogLevel,
|
|
11246
11293
|
wn as MaxRetriesExceededError,
|
|
11247
|
-
|
|
11294
|
+
om as NoChannelsError,
|
|
11248
11295
|
S as Opcode,
|
|
11249
11296
|
_i as ProvisioningTimeoutError,
|
|
11250
|
-
|
|
11297
|
+
im as SpaceNotFoundError,
|
|
11251
11298
|
$ as TransportError,
|
|
11252
11299
|
ye as UserType,
|
|
11253
|
-
|
|
11254
|
-
|
|
11255
|
-
|
|
11300
|
+
Em as WEBRTC_AUDIO_BITRATE,
|
|
11301
|
+
pm as WEBRTC_AUDIO_CHANNELS,
|
|
11302
|
+
hm as WEBRTC_AUDIO_CODEC,
|
|
11256
11303
|
Zh as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS,
|
|
11257
|
-
|
|
11304
|
+
fm as WEBRTC_AUDIO_SAMPLE_RATE,
|
|
11258
11305
|
tf as WEBRTC_BUNDLE_POLICY,
|
|
11259
11306
|
of as WEBRTC_DATA_CHANNEL_LABEL,
|
|
11260
11307
|
cf as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS,
|
|
@@ -11262,35 +11309,36 @@ export {
|
|
|
11262
11309
|
rf as WEBRTC_MAX_AUDIO_TRACKS,
|
|
11263
11310
|
sf as WEBRTC_MAX_VIDEO_TRACKS,
|
|
11264
11311
|
nf as WEBRTC_RTCP_MUX_POLICY,
|
|
11265
|
-
|
|
11312
|
+
mm as WEBRTC_VIDEO_CODEC,
|
|
11266
11313
|
qh as WEBRTC_VIDEO_MAX_BITRATE,
|
|
11267
|
-
|
|
11314
|
+
_m as WEBRTC_VIDEO_MAX_FRAMERATE,
|
|
11268
11315
|
lf as WebRTCConnection,
|
|
11269
11316
|
uf as WebRTCSignaling,
|
|
11270
|
-
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
|
|
11317
|
+
Mm as appMessaging,
|
|
11318
|
+
rm as asProtocolMessage,
|
|
11319
|
+
wm as clearDeviceId,
|
|
11320
|
+
vm as clearLogBuffer,
|
|
11321
|
+
Tm as clearLoginPrompt,
|
|
11322
|
+
ym as clearSessionParamsFromUrl,
|
|
11323
|
+
Gm as consumeLoginHandoff,
|
|
11276
11324
|
_f as consumeLoginPendingCall,
|
|
11277
11325
|
L as createLogger,
|
|
11278
11326
|
cp as deriveAuthUrl,
|
|
11279
|
-
|
|
11327
|
+
Am as deriveBackendType,
|
|
11280
11328
|
It as deriveBackendUrl,
|
|
11281
|
-
|
|
11329
|
+
bm as enableInspectMode,
|
|
11282
11330
|
ip as extractUserIdFromToken,
|
|
11283
|
-
|
|
11331
|
+
Dm as flushLogs,
|
|
11284
11332
|
Wh as getAudioParam,
|
|
11285
|
-
|
|
11333
|
+
km as getBufferedLogs,
|
|
11286
11334
|
Bh as getDebugParam,
|
|
11287
11335
|
Vh as getInspectParam,
|
|
11288
|
-
|
|
11289
|
-
|
|
11336
|
+
dm as getLangParam,
|
|
11337
|
+
Om as getLogBufferSize,
|
|
11290
11338
|
Sn as getLogLevel,
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11339
|
+
am as getLogSink,
|
|
11340
|
+
Im as getLoginPromptState,
|
|
11341
|
+
xm as getOpcodeName,
|
|
11294
11342
|
dt as getOrCreateDeviceId,
|
|
11295
11343
|
Lh as getProxyParam,
|
|
11296
11344
|
se as getRetryParam,
|
|
@@ -11305,30 +11353,30 @@ export {
|
|
|
11305
11353
|
Wi as isAudioWorkletSupported,
|
|
11306
11354
|
je as isBrowserEnvironment,
|
|
11307
11355
|
ft as isCloudEnvironment,
|
|
11308
|
-
|
|
11309
|
-
|
|
11356
|
+
Pm as isConnected,
|
|
11357
|
+
Lm as isConnecting,
|
|
11310
11358
|
Wn as isDebugModeEnabled,
|
|
11311
|
-
|
|
11312
|
-
|
|
11359
|
+
Bm as isError,
|
|
11360
|
+
Rm as isInspectModeEnabled,
|
|
11313
11361
|
Bp as isMobileBrowserLikely,
|
|
11314
|
-
|
|
11362
|
+
Fm as isOffline,
|
|
11315
11363
|
et as isSharedArrayBufferSupported,
|
|
11316
11364
|
Ci as isWebTransportSupported,
|
|
11317
11365
|
Pp as loginErrorInterceptor,
|
|
11318
|
-
|
|
11366
|
+
Cm as parseUrlParams,
|
|
11319
11367
|
Pe as readOpcode,
|
|
11320
11368
|
qe as readOpcodeGroup,
|
|
11321
11369
|
ge as readProtocolMessageHeaders,
|
|
11322
11370
|
sp as registerBrowserFunctions,
|
|
11323
|
-
|
|
11371
|
+
Wm as reprovisionAfterLogin,
|
|
11324
11372
|
Ti as setLogLevel,
|
|
11325
11373
|
Ah as setLogSink,
|
|
11326
11374
|
Ai as setSdkUrlParam,
|
|
11327
|
-
|
|
11375
|
+
Nm as setSendLogsCallback,
|
|
11328
11376
|
ZE as startLogSender,
|
|
11329
11377
|
Qi as stopLogSender,
|
|
11330
|
-
|
|
11331
|
-
|
|
11378
|
+
gm as subscribeLoginPrompt,
|
|
11379
|
+
cm as subscribeToLogEvents,
|
|
11332
11380
|
Xi as takeBufferedLogs,
|
|
11333
11381
|
kn as withResultData
|
|
11334
11382
|
};
|