@ikonai/sdk-react-ui 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth/oauth-continuation.d.ts +11 -3
- package/index.js +737 -712
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IkonUiCore as e, LiveSnapshotCache as t, UiStreamStore as n, UiStreamStore as r, isPrerenderVisible as i, prefetchBootSnapshot as a } from "@ikonai/sdk-ui";
|
|
2
|
-
import { AccessDeniedError as o, AppStartupFailedError as s, AuthenticationError as c, IKON_INSPECT_MODE_CHANGED_EVENT as l, IkonClient as u, LogLevel as d,
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { AccessDeniedError as o, AppStartupFailedError as s, AuthenticationError as c, IKON_INSPECT_MODE_CHANGED_EVENT as l, IkonClient as u, LogLevel as d, PKCE_URL_PARAM as f, ProvisioningTimeoutError as p, ServerFullError as m, ServerUnavailableError as h, SessionNotFoundError as g, abortSignalTimeout as _, adoptPkceVerifierFromUrl as v, clearLoginPrompt as y, createLogger as b, createPkceChallenge as x, deriveAuthUrl as S, deriveBackendType as ee, deriveCrossOriginAuthUrl as te, extractUserIdFromToken as ne, getDebugOverlayParam as re, getLangParam as ie, getLoginPromptState as C, getOrCreateDeviceId as ae, getSameOriginAuthUrl as w, isCloudEnvironment as oe, isDebugModeEnabled as se, isEmbedded as T, isInspectModeEnabled as ce, parseUrlParams as le, randomUuid as E, reportConnectTimeline as ue, setLoginPromptRequired as de, startEmbeddedOAuthSignIn as fe, subscribeLoginPrompt as pe, subscribeToLogEvents as me, takePkceVerifier as he } from "@ikonai/sdk";
|
|
3
|
+
import { Fragment as ge, createContext as _e, memo as D, use as ve, useCallback as O, useEffect as k, useLayoutEffect as ye, useMemo as A, useReducer as be, useRef as j, useState as M, useSyncExternalStore as N } from "react";
|
|
4
|
+
import { Fragment as xe, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
5
5
|
//#region src/renderer/use-root-view.ts
|
|
6
|
-
function
|
|
6
|
+
function Se(e, t) {
|
|
7
7
|
let n = N((t) => e.subscribe(t), () => {
|
|
8
8
|
let n = e.getSnapshot(), r = t ?? n.rootViewId, i = r ? n.views.get(r) : void 0;
|
|
9
9
|
return `${r ?? ""}:${i?.id ?? ""}`;
|
|
@@ -31,8 +31,8 @@ function I(e, t) {
|
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/renderer/ui-renderer.tsx
|
|
34
|
-
var
|
|
35
|
-
function
|
|
34
|
+
var Ce = b("UIRenderer");
|
|
35
|
+
function we(e) {
|
|
36
36
|
if (e === void 0) return "{}";
|
|
37
37
|
if (typeof e == "string") return e;
|
|
38
38
|
try {
|
|
@@ -41,28 +41,28 @@ function Se(e) {
|
|
|
41
41
|
return "{}";
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Te(e) {
|
|
45
45
|
let t = e.styleIds;
|
|
46
46
|
return Array.isArray(t) ? t : [];
|
|
47
47
|
}
|
|
48
|
-
var
|
|
49
|
-
function
|
|
48
|
+
var Ee = 1500;
|
|
49
|
+
function De(e) {
|
|
50
50
|
let [t, n] = M(0);
|
|
51
51
|
return k(() => {
|
|
52
52
|
if (e.subscribe) return e.subscribe(() => n((e) => e + 1));
|
|
53
53
|
}, [e]), t;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
let [i, a] = M(!1), o = I(n.store, t), s =
|
|
55
|
+
function Oe({ nodeType: e, nodeId: t, context: n, className: r }) {
|
|
56
|
+
let [i, a] = M(!1), o = I(n.store, t), s = De(n.library), c = A(() => o ? n.library.resolve(o) : void 0, [
|
|
57
57
|
n.library,
|
|
58
58
|
o,
|
|
59
59
|
s
|
|
60
60
|
]);
|
|
61
61
|
return k(() => {
|
|
62
|
-
let e = setTimeout(() => a(!0),
|
|
62
|
+
let e = setTimeout(() => a(!0), Ee);
|
|
63
63
|
return () => clearTimeout(e);
|
|
64
64
|
}, [e]), k(() => {
|
|
65
|
-
!i || c ||
|
|
65
|
+
!i || c || Ce.error(`No React resolver is registered for node type '${e}', so it renders as an error placeholder instead of the component you expected. A custom node needs all four parts: (1) the React component, (2) a resolver that matches '${e}', (3) a registerModule(...) call for it in app.tsx, and (4) the C# view.AddNode("${e}", ...) extension. Prefer native view.* components where they fit.`);
|
|
66
66
|
}, [
|
|
67
67
|
i,
|
|
68
68
|
c,
|
|
@@ -87,50 +87,50 @@ function Ee({ nodeType: e, nodeId: t, context: n, className: r }) {
|
|
|
87
87
|
children: `Unregistered node type: ${e}\nNo React resolver is registered for it — register the component's module in app.tsx (see the console for details).`
|
|
88
88
|
}) : null;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function ke(e) {
|
|
91
91
|
let t = e.children;
|
|
92
92
|
return Array.isArray(t) ? t : [];
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Ae(e, t) {
|
|
95
95
|
return e.nodeId === t.nodeId && e.context === t.context;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function je(e) {
|
|
98
98
|
if (e.length === 0) return "";
|
|
99
99
|
if (e.length === 1) return e[0].id;
|
|
100
100
|
let t = e[0].id;
|
|
101
101
|
for (let n = 1; n < e.length; n++) t += "," + e[n].id;
|
|
102
102
|
return t;
|
|
103
103
|
}
|
|
104
|
-
var
|
|
105
|
-
let r = I(n.store, t), i = r ?
|
|
104
|
+
var Me = D(function e({ nodeId: t, context: n }) {
|
|
105
|
+
let r = I(n.store, t), i = r ? ke(r) : [], a = je(i), o = A(() => i.length === 0 ? null : i.map((t) => /* @__PURE__ */ P(e, {
|
|
106
106
|
nodeId: t.id,
|
|
107
107
|
context: n
|
|
108
108
|
}, t.id)), [a, n]);
|
|
109
109
|
if (!r) return null;
|
|
110
|
-
if (r.type === "root") return /* @__PURE__ */ P(
|
|
111
|
-
let s =
|
|
110
|
+
if (r.type === "root") return /* @__PURE__ */ P(ge, { children: o }, r.id);
|
|
111
|
+
let s = Te(r), c = s.length > 0 ? s.join(" ") : void 0, l = n.library.resolve(r);
|
|
112
112
|
return l ? /* @__PURE__ */ P(l, {
|
|
113
113
|
nodeId: t,
|
|
114
114
|
context: n,
|
|
115
115
|
className: c
|
|
116
|
-
}) : /* @__PURE__ */ P(
|
|
116
|
+
}) : /* @__PURE__ */ P(Oe, {
|
|
117
117
|
nodeType: r.type,
|
|
118
118
|
nodeId: r.id,
|
|
119
119
|
context: n,
|
|
120
120
|
className: c
|
|
121
121
|
});
|
|
122
|
-
},
|
|
123
|
-
function
|
|
124
|
-
return !Array.isArray(e) || e.length === 0 ? null : e.map((e) => /* @__PURE__ */ P(
|
|
122
|
+
}, Ae);
|
|
123
|
+
function Ne(e, t) {
|
|
124
|
+
return !Array.isArray(e) || e.length === 0 ? null : e.map((e) => /* @__PURE__ */ P(Me, {
|
|
125
125
|
nodeId: e.id,
|
|
126
126
|
context: t
|
|
127
127
|
}, e.id));
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Pe(e, t) {
|
|
130
130
|
return e.store === t.store && e.library === t.library && e.viewId === t.viewId && e.emptyFallback === t.emptyFallback;
|
|
131
131
|
}
|
|
132
|
-
var
|
|
133
|
-
let { rootViewId: s, rootNodeId: c } =
|
|
132
|
+
var Fe = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null, onAction: i, client: a, video: o }) {
|
|
133
|
+
let { rootViewId: s, rootNodeId: c } = Se(e, n), l = j(i);
|
|
134
134
|
l.current = i;
|
|
135
135
|
let u = j(a);
|
|
136
136
|
u.current = a;
|
|
@@ -138,7 +138,7 @@ var Ne = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
138
138
|
d.current = o;
|
|
139
139
|
let f = O((e, t) => {
|
|
140
140
|
if (!e) return;
|
|
141
|
-
let n =
|
|
141
|
+
let n = we(t);
|
|
142
142
|
l.current?.(e, n);
|
|
143
143
|
}, []), p = A(() => {
|
|
144
144
|
let n = {
|
|
@@ -146,10 +146,10 @@ var Ne = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
146
146
|
library: t,
|
|
147
147
|
handlerCache: e.handlerCache,
|
|
148
148
|
getPayload: (t) => e.getSnapshot().payloads.get(t),
|
|
149
|
-
renderChildren: (e) =>
|
|
149
|
+
renderChildren: (e) => Ne(e, n),
|
|
150
150
|
renderView: (t) => {
|
|
151
151
|
let r = e.getSnapshot().views.get(t);
|
|
152
|
-
return r ? /* @__PURE__ */ P(
|
|
152
|
+
return r ? /* @__PURE__ */ P(Me, {
|
|
153
153
|
nodeId: r.id,
|
|
154
154
|
context: n
|
|
155
155
|
}) : null;
|
|
@@ -171,12 +171,12 @@ var Ne = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
171
171
|
return !s || !c ? r : /* @__PURE__ */ P("div", {
|
|
172
172
|
"data-ikon-view-id": s,
|
|
173
173
|
style: { display: "contents" },
|
|
174
|
-
children: /* @__PURE__ */ P(
|
|
174
|
+
children: /* @__PURE__ */ P(Me, {
|
|
175
175
|
nodeId: c,
|
|
176
176
|
context: p
|
|
177
177
|
})
|
|
178
178
|
});
|
|
179
|
-
},
|
|
179
|
+
}, Pe), Ie = class {
|
|
180
180
|
fallback;
|
|
181
181
|
renderers = /* @__PURE__ */ new Map();
|
|
182
182
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -201,22 +201,22 @@ var Ne = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
201
201
|
for (let e of this.listeners) e();
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
|
-
function
|
|
205
|
-
return new
|
|
204
|
+
function Le(e, t) {
|
|
205
|
+
return new Ie(Object.entries(e), t);
|
|
206
206
|
}
|
|
207
207
|
//#endregion
|
|
208
208
|
//#region src/renderer/use-ui-store.ts
|
|
209
|
-
function
|
|
209
|
+
function L(e) {
|
|
210
210
|
return N((t) => e.subscribe(t), () => e.getSnapshot(), () => e.getSnapshot());
|
|
211
211
|
}
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region src/inspect/inspect-overlay.tsx
|
|
214
|
-
function
|
|
215
|
-
let [e, t] = M(
|
|
214
|
+
function Re() {
|
|
215
|
+
let [e, t] = M(ce), n = j(!1);
|
|
216
216
|
return k(() => {
|
|
217
217
|
if (e) return;
|
|
218
218
|
let r = () => {
|
|
219
|
-
|
|
219
|
+
ce() && t(!0);
|
|
220
220
|
}, i = (e) => {
|
|
221
221
|
e.data?.type === "ikon-inspect-mode" && e.data.enabled && (n.current = !0, t(!0));
|
|
222
222
|
};
|
|
@@ -351,11 +351,11 @@ function Le() {
|
|
|
351
351
|
}
|
|
352
352
|
//#endregion
|
|
353
353
|
//#region src/surface.tsx
|
|
354
|
-
var
|
|
355
|
-
function
|
|
354
|
+
var ze = b("IkonUiSurface"), Be = "ikon-ui";
|
|
355
|
+
function Ve(e, t) {
|
|
356
356
|
return e === t;
|
|
357
357
|
}
|
|
358
|
-
var
|
|
358
|
+
var He = D(function({ stores: e, registry: t, category: n = Be, onAction: r, client: i }) {
|
|
359
359
|
let a = A(() => Array.from(e.keys()).sort().join(","), [e]), o = j(r);
|
|
360
360
|
o.current = r;
|
|
361
361
|
let s = j(i);
|
|
@@ -364,7 +364,7 @@ var Be = D(function({ stores: e, registry: t, category: n = Re, onAction: r, cli
|
|
|
364
364
|
let t = [];
|
|
365
365
|
for (let [r, i] of e) {
|
|
366
366
|
let e = i.store.getSnapshot();
|
|
367
|
-
|
|
367
|
+
Ve(i.category, n) && (!e.rootViewId || !e.views.has(e.rootViewId) || t.push({
|
|
368
368
|
key: r,
|
|
369
369
|
store: i.store
|
|
370
370
|
}));
|
|
@@ -376,15 +376,15 @@ var Be = D(function({ stores: e, registry: t, category: n = Re, onAction: r, cli
|
|
|
376
376
|
a
|
|
377
377
|
]), l = j(!1), u = c.length > 0;
|
|
378
378
|
return k(() => {
|
|
379
|
-
u && !l.current && (l.current = !0,
|
|
380
|
-
}, [u]), u ? /* @__PURE__ */ F(
|
|
379
|
+
u && !l.current && (l.current = !0, ze.debug("First UI render"));
|
|
380
|
+
}, [u]), u ? /* @__PURE__ */ F(xe, { children: [/* @__PURE__ */ P(Re, {}), c.map(({ key: e, store: n }) => /* @__PURE__ */ P(Fe, {
|
|
381
381
|
store: n,
|
|
382
382
|
library: t,
|
|
383
383
|
onAction: o.current,
|
|
384
384
|
client: s.current,
|
|
385
385
|
video: s.current?.media?.video
|
|
386
386
|
}, e))] }) : null;
|
|
387
|
-
}),
|
|
387
|
+
}), Ue = class {
|
|
388
388
|
core;
|
|
389
389
|
ownsCore;
|
|
390
390
|
stores = /* @__PURE__ */ new Map();
|
|
@@ -456,7 +456,7 @@ var Be = D(function({ stores: e, registry: t, category: n = Re, onAction: r, cli
|
|
|
456
456
|
let t = this.stores.get(e);
|
|
457
457
|
if (t) return t;
|
|
458
458
|
let n = {
|
|
459
|
-
category:
|
|
459
|
+
category: Be,
|
|
460
460
|
store: new r()
|
|
461
461
|
};
|
|
462
462
|
return this.stores.set(e, n), n;
|
|
@@ -476,7 +476,7 @@ var Be = D(function({ stores: e, registry: t, category: n = Re, onAction: r, cli
|
|
|
476
476
|
};
|
|
477
477
|
//#endregion
|
|
478
478
|
//#region src/base/base-div.tsx
|
|
479
|
-
function
|
|
479
|
+
function We(e) {
|
|
480
480
|
if (typeof e == "string") {
|
|
481
481
|
let t = e.trim();
|
|
482
482
|
return t.length > 0 ? t : void 0;
|
|
@@ -492,7 +492,7 @@ function R(e) {
|
|
|
492
492
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function Ge(...e) {
|
|
496
496
|
let t = "";
|
|
497
497
|
for (let n of e) if (n) {
|
|
498
498
|
let e = n.trim();
|
|
@@ -500,8 +500,8 @@ function Ue(...e) {
|
|
|
500
500
|
}
|
|
501
501
|
return t || void 0;
|
|
502
502
|
}
|
|
503
|
-
var z = /* @__PURE__ */ new WeakMap(),
|
|
504
|
-
function
|
|
503
|
+
var z = /* @__PURE__ */ new WeakMap(), Ke = {};
|
|
504
|
+
function qe(e) {
|
|
505
505
|
let t = {};
|
|
506
506
|
for (let n of e.split(";")) {
|
|
507
507
|
let e = n.indexOf(":");
|
|
@@ -513,28 +513,28 @@ function B(e) {
|
|
|
513
513
|
}
|
|
514
514
|
return t;
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function B(e, t) {
|
|
517
517
|
let n = e && typeof e == "object" ? e : void 0;
|
|
518
518
|
return t ? {
|
|
519
519
|
...n ?? {},
|
|
520
520
|
cursor: t
|
|
521
521
|
} : n;
|
|
522
522
|
}
|
|
523
|
-
function
|
|
524
|
-
if (!e) return
|
|
523
|
+
function V(e) {
|
|
524
|
+
if (!e) return Ke;
|
|
525
525
|
let t = z.get(e);
|
|
526
526
|
if (t) return t;
|
|
527
527
|
let n = {};
|
|
528
528
|
for (let [t, r] of Object.entries(e)) if (r != null) {
|
|
529
529
|
if (t === "style" && typeof r == "string") {
|
|
530
|
-
n[t] =
|
|
530
|
+
n[t] = qe(r);
|
|
531
531
|
continue;
|
|
532
532
|
}
|
|
533
533
|
(typeof r == "string" || typeof r == "number" || typeof r == "boolean") && (n[t] = r);
|
|
534
534
|
}
|
|
535
535
|
return z.set(e, n), n;
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function Je(e) {
|
|
538
538
|
let t = e.parentElement;
|
|
539
539
|
for (; t;) {
|
|
540
540
|
let e = window.getComputedStyle(t).overflowY;
|
|
@@ -543,34 +543,34 @@ function V(e) {
|
|
|
543
543
|
}
|
|
544
544
|
return null;
|
|
545
545
|
}
|
|
546
|
-
var
|
|
547
|
-
function
|
|
546
|
+
var Ye = 1.5;
|
|
547
|
+
function Xe(e, t) {
|
|
548
548
|
requestAnimationFrame(() => {
|
|
549
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = e.scrollTop + (r.bottom - n.bottom) + 16, a = Math.abs(i - e.scrollTop) > e.clientHeight *
|
|
549
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = e.scrollTop + (r.bottom - n.bottom) + 16, a = Math.abs(i - e.scrollTop) > e.clientHeight * Ye ? "auto" : "smooth";
|
|
550
550
|
"scrollBehavior" in document.documentElement.style ? e.scrollTo({
|
|
551
551
|
top: i,
|
|
552
552
|
behavior: a
|
|
553
553
|
}) : e.scrollTop = i;
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
|
-
var
|
|
557
|
-
function
|
|
558
|
-
return Math.max(e.clientHeight *
|
|
556
|
+
var H = "data-ikon-scroll-indicator", Ze = .15, Qe = "data-ikon-at-bottom";
|
|
557
|
+
function $e(e) {
|
|
558
|
+
return Math.max(e.clientHeight * Ze, 20);
|
|
559
559
|
}
|
|
560
|
-
function
|
|
561
|
-
return e.getAttribute(
|
|
560
|
+
function et(e) {
|
|
561
|
+
return e.getAttribute(Qe) !== "false";
|
|
562
562
|
}
|
|
563
|
-
function
|
|
564
|
-
e.getAttribute(
|
|
565
|
-
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e, i = n - t - r <=
|
|
566
|
-
e.setAttribute(
|
|
563
|
+
function tt(e) {
|
|
564
|
+
e.getAttribute(Qe) === null && (e.setAttribute(Qe, "true"), e.addEventListener("scroll", () => {
|
|
565
|
+
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e, i = n - t - r <= $e(e);
|
|
566
|
+
e.setAttribute(Qe, i ? "true" : "false");
|
|
567
567
|
}, { passive: !0 }));
|
|
568
568
|
}
|
|
569
|
-
function
|
|
570
|
-
let t = e.parentElement ?? e, n = t.querySelector(`[${
|
|
569
|
+
function nt(e) {
|
|
570
|
+
let t = e.parentElement ?? e, n = t.querySelector(`[${H}]`);
|
|
571
571
|
if (n) return n;
|
|
572
572
|
let r = document.createElement("button");
|
|
573
|
-
return r.setAttribute(
|
|
573
|
+
return r.setAttribute(H, "true"), r.setAttribute("aria-label", "Scroll to latest"), r.textContent = "↓", Object.assign(r.style, {
|
|
574
574
|
position: "absolute",
|
|
575
575
|
bottom: "12px",
|
|
576
576
|
left: "50%",
|
|
@@ -598,20 +598,20 @@ function Qe(e) {
|
|
|
598
598
|
r.style.opacity = "0.9";
|
|
599
599
|
}), t.appendChild(r), r;
|
|
600
600
|
}
|
|
601
|
-
function
|
|
602
|
-
let n =
|
|
601
|
+
function rt(e, t) {
|
|
602
|
+
let n = nt(e);
|
|
603
603
|
n.style.display = "flex";
|
|
604
604
|
let r = () => {
|
|
605
|
-
|
|
605
|
+
Xe(e, t), n.style.display = "none";
|
|
606
606
|
}, i = () => {
|
|
607
607
|
let { scrollTop: t, scrollHeight: r, clientHeight: i } = e;
|
|
608
|
-
r - t - i <=
|
|
608
|
+
r - t - i <= $e(e) && (n.style.display = "none");
|
|
609
609
|
};
|
|
610
610
|
return n.addEventListener("click", r), e.addEventListener("scroll", i, { passive: !0 }), () => {
|
|
611
611
|
n.removeEventListener("click", r), e.removeEventListener("scroll", i);
|
|
612
612
|
};
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function it() {
|
|
615
615
|
let e = D(function({ nodeId: e, context: t }) {
|
|
616
616
|
let n = I(t.store, e), r = j(null), i = R(n?.props?.targetViewId), a = n?.props?.focusOnly, o = typeof a == "boolean" ? a : void 0, s = R(n?.props?.priority), c = R(n?.props?.key), l = n?.props?.preciseGeneratedAt;
|
|
617
617
|
return k(() => {
|
|
@@ -620,14 +620,14 @@ function et() {
|
|
|
620
620
|
if (!e || i && e.closest("[data-ikon-view-id]")?.getAttribute("data-ikon-view-id") !== i) return;
|
|
621
621
|
let t;
|
|
622
622
|
if (o !== !0) {
|
|
623
|
-
let n =
|
|
624
|
-
if (n) if (
|
|
623
|
+
let n = Je(e);
|
|
624
|
+
if (n) if (tt(n), s === "Polite" && !et(n)) t = rt(n, e);
|
|
625
625
|
else {
|
|
626
|
-
let t = (n.parentElement ?? n).querySelector(`[${
|
|
627
|
-
t && (t.style.display = "none"),
|
|
626
|
+
let t = (n.parentElement ?? n).querySelector(`[${H}]`);
|
|
627
|
+
t && (t.style.display = "none"), Xe(n, e);
|
|
628
628
|
}
|
|
629
629
|
else typeof e.scrollIntoView == "function" && requestAnimationFrame(() => {
|
|
630
|
-
let t = e.getBoundingClientRect().top, n = typeof window < "u" ? window.innerHeight : 0, r = Math.abs(t) > n *
|
|
630
|
+
let t = e.getBoundingClientRect().top, n = typeof window < "u" ? window.innerHeight : 0, r = Math.abs(t) > n * Ye ? "auto" : "smooth";
|
|
631
631
|
try {
|
|
632
632
|
e.scrollIntoView({
|
|
633
633
|
behavior: r,
|
|
@@ -670,15 +670,15 @@ function et() {
|
|
|
670
670
|
if (t === "std.focus-hint") return e;
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function at() {
|
|
674
674
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
675
|
-
let r = I(t.store, e), i =
|
|
675
|
+
let r = I(t.store, e), i = We(r?.props?.onInvokeId), a = O(() => {
|
|
676
676
|
i && t.dispatchAction(i);
|
|
677
677
|
}, [i, t]);
|
|
678
678
|
if (!r) return null;
|
|
679
|
-
let o =
|
|
679
|
+
let o = V(r.props);
|
|
680
680
|
delete o.onInvokeId;
|
|
681
|
-
let s =
|
|
681
|
+
let s = Ge(R(r.props?.className), n), c = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
682
682
|
return /* @__PURE__ */ P("div", {
|
|
683
683
|
...o,
|
|
684
684
|
"data-ikon-node-id": r.id,
|
|
@@ -690,7 +690,7 @@ function tt() {
|
|
|
690
690
|
onKeyDown: i ? (e) => {
|
|
691
691
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), a());
|
|
692
692
|
} : void 0,
|
|
693
|
-
style:
|
|
693
|
+
style: B(o.style, i ? "pointer" : void 0),
|
|
694
694
|
children: c
|
|
695
695
|
});
|
|
696
696
|
});
|
|
@@ -698,11 +698,11 @@ function tt() {
|
|
|
698
698
|
if (t === "std.div") return e;
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function ot() {
|
|
702
702
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
703
703
|
let r = I(t.store, e);
|
|
704
704
|
if (!r) return null;
|
|
705
|
-
let i =
|
|
705
|
+
let i = V(r.props), a = Ge("relative", R(r.props?.className), n), o = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
706
706
|
return /* @__PURE__ */ P("div", {
|
|
707
707
|
...i,
|
|
708
708
|
"data-ikon-node-id": r.id,
|
|
@@ -715,11 +715,11 @@ function nt() {
|
|
|
715
715
|
if (t === "std.stack") return e;
|
|
716
716
|
};
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function st() {
|
|
719
719
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
720
720
|
let r = I(t.store, e);
|
|
721
721
|
if (!r) return null;
|
|
722
|
-
let i =
|
|
722
|
+
let i = V(r.props), a = Ge("absolute", R(r.props?.className), n), o = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
723
723
|
return /* @__PURE__ */ P("div", {
|
|
724
724
|
...i,
|
|
725
725
|
"data-ikon-node-id": r.id,
|
|
@@ -732,23 +732,23 @@ function rt() {
|
|
|
732
732
|
if (t === "std.layer") return e;
|
|
733
733
|
};
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function ct() {
|
|
736
736
|
return [
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
737
|
+
at(),
|
|
738
|
+
ot(),
|
|
739
|
+
st(),
|
|
740
|
+
it()
|
|
741
741
|
];
|
|
742
742
|
}
|
|
743
743
|
//#endregion
|
|
744
744
|
//#region src/base/base-module.ts
|
|
745
|
-
var
|
|
746
|
-
function
|
|
747
|
-
e.registerModule(
|
|
745
|
+
var lt = "base", ut = async () => ct();
|
|
746
|
+
function dt(e) {
|
|
747
|
+
e.registerModule(lt, ut);
|
|
748
748
|
}
|
|
749
749
|
//#endregion
|
|
750
750
|
//#region src/media/audio-player.tsx
|
|
751
|
-
function
|
|
751
|
+
function ft(e) {
|
|
752
752
|
if (typeof e == "string") {
|
|
753
753
|
let t = e.trim();
|
|
754
754
|
return t.length > 0 ? t : void 0;
|
|
@@ -758,17 +758,17 @@ function ct(e) {
|
|
|
758
758
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function pt(...e) {
|
|
762
762
|
let t = [];
|
|
763
763
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
764
764
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function mt(e) {
|
|
767
767
|
if (typeof e != "string") return;
|
|
768
768
|
let t = e.trim();
|
|
769
769
|
return t.length > 0 ? t : void 0;
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function ht(e) {
|
|
772
772
|
if (typeof e == "boolean") return e;
|
|
773
773
|
if (typeof e == "string") {
|
|
774
774
|
let t = e.trim().toLowerCase();
|
|
@@ -776,13 +776,13 @@ function dt(e) {
|
|
|
776
776
|
if (t === "false") return !1;
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function gt() {
|
|
780
780
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
781
|
-
let r = I(t.store, e), i = j(null), a = r ?
|
|
781
|
+
let r = I(t.store, e), i = j(null), a = r ? ht(r.props?.autoplay) : void 0, o = r ? mt(r.props?.src) : void 0;
|
|
782
782
|
if (k(() => {
|
|
783
783
|
a && i.current && i.current.play().catch(() => {});
|
|
784
784
|
}, [a, o]), !r) return null;
|
|
785
|
-
let s =
|
|
785
|
+
let s = pt(ft(r.props?.className), n), c = mt(r.props?.preload), l = ht(r.props?.controls), u = ht(r.props?.loop), d = ht(r.props?.muted);
|
|
786
786
|
return /* @__PURE__ */ P("audio", {
|
|
787
787
|
ref: i,
|
|
788
788
|
src: o,
|
|
@@ -802,7 +802,7 @@ function ft() {
|
|
|
802
802
|
}
|
|
803
803
|
//#endregion
|
|
804
804
|
//#region src/media/video-canvas.tsx
|
|
805
|
-
function
|
|
805
|
+
function _t(e) {
|
|
806
806
|
if (typeof e == "string") {
|
|
807
807
|
let t = e.trim();
|
|
808
808
|
return t.length > 0 ? t : void 0;
|
|
@@ -812,27 +812,27 @@ function pt(e) {
|
|
|
812
812
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function vt(...e) {
|
|
816
816
|
let t = [];
|
|
817
817
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
818
818
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
819
819
|
}
|
|
820
|
-
function
|
|
820
|
+
function yt(e) {
|
|
821
821
|
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
822
822
|
if (typeof e == "string" && e.trim().length > 0) {
|
|
823
823
|
let t = Number(e);
|
|
824
824
|
if (Number.isFinite(t)) return Math.floor(t);
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function bt(e) {
|
|
828
828
|
if (typeof e != "string") return;
|
|
829
829
|
let t = e.trim();
|
|
830
830
|
return t.length > 0 ? t : void 0;
|
|
831
831
|
}
|
|
832
|
-
var
|
|
833
|
-
function
|
|
832
|
+
var xt = b("IkonVideoCanvas"), St = 100, Ct = 50, wt = "std.video-canvas", Tt = "std.video-url-player";
|
|
833
|
+
function Et() {
|
|
834
834
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
835
|
-
let r = I(t.store, e), i = j(null), a = j(null), o = t.client, s = r ?
|
|
835
|
+
let r = I(t.store, e), i = j(null), a = j(null), o = t.client, s = r ? bt(r.props?.streamId) : void 0, c = r ? yt(r.props?.width) : void 0, l = r ? yt(r.props?.height) : void 0, u = r ? vt(_t(r.props?.className), n) : n, [, d] = M(0);
|
|
836
836
|
k(() => {
|
|
837
837
|
if (!o?.isWebRtcEnabled) return;
|
|
838
838
|
let e = o.onWebRtcTrackMapChanged;
|
|
@@ -850,15 +850,15 @@ function St() {
|
|
|
850
850
|
if (n) return;
|
|
851
851
|
let i = t.video ?? t.client?.media?.video;
|
|
852
852
|
if (!i) {
|
|
853
|
-
if (a++ >=
|
|
854
|
-
|
|
853
|
+
if (a++ >= Ct) {
|
|
854
|
+
xt.warn(`Gave up attaching the canvas for stream ${s}: video playback never became available`);
|
|
855
855
|
return;
|
|
856
856
|
}
|
|
857
|
-
r = setTimeout(o,
|
|
857
|
+
r = setTimeout(o, St);
|
|
858
858
|
return;
|
|
859
859
|
}
|
|
860
860
|
i.attachCanvas(s, e).catch((e) => {
|
|
861
|
-
|
|
861
|
+
xt.error(`Failed to attach the canvas for stream ${s}, it will stay blank: ${String(e)}`);
|
|
862
862
|
});
|
|
863
863
|
};
|
|
864
864
|
return o(), () => {
|
|
@@ -898,14 +898,14 @@ function St() {
|
|
|
898
898
|
if (t === "std.video-canvas") return e;
|
|
899
899
|
};
|
|
900
900
|
}
|
|
901
|
-
function
|
|
901
|
+
function Dt() {
|
|
902
902
|
return [
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
903
|
+
Et(),
|
|
904
|
+
kt(),
|
|
905
|
+
gt()
|
|
906
906
|
];
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function Ot(e) {
|
|
909
909
|
if (typeof e == "boolean") return e;
|
|
910
910
|
if (typeof e == "string") {
|
|
911
911
|
let t = e.trim().toLowerCase();
|
|
@@ -913,13 +913,13 @@ function wt(e) {
|
|
|
913
913
|
if (t === "false") return !1;
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function kt() {
|
|
917
917
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
918
|
-
let r = I(t.store, e), i = j(null), a = r ?
|
|
918
|
+
let r = I(t.store, e), i = j(null), a = r ? Ot(r.props?.autoplay) : void 0, o = r ? bt(r.props?.src) : void 0;
|
|
919
919
|
if (k(() => {
|
|
920
920
|
a && i.current && i.current.play().catch(() => {});
|
|
921
921
|
}, [a, o]), !r) return null;
|
|
922
|
-
let s =
|
|
922
|
+
let s = vt(_t(r.props?.className), n), c = bt(r.props?.poster), l = Ot(r.props?.controls), u = Ot(r.props?.loop), d = Ot(r.props?.muted), f = Ot(r.props?.playsInline), p = yt(r.props?.width), m = yt(r.props?.height), h = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
923
923
|
return /* @__PURE__ */ P("video", {
|
|
924
924
|
ref: i,
|
|
925
925
|
src: o,
|
|
@@ -943,20 +943,20 @@ function Tt() {
|
|
|
943
943
|
}
|
|
944
944
|
//#endregion
|
|
945
945
|
//#region src/media/media-module.ts
|
|
946
|
-
var
|
|
947
|
-
function
|
|
948
|
-
e.registerModule(
|
|
946
|
+
var At = "media", jt = async () => Dt();
|
|
947
|
+
function Mt(e) {
|
|
948
|
+
e.registerModule(At, jt);
|
|
949
949
|
}
|
|
950
950
|
//#endregion
|
|
951
951
|
//#region src/shadertoy/shadertoy-gl.ts
|
|
952
|
-
var
|
|
953
|
-
function
|
|
952
|
+
var Nt = "#version 300 es\nin vec4 a_position;\nvoid main() {\n gl_Position = a_position;\n}\n", Pt = 4;
|
|
953
|
+
function Ft(e, t) {
|
|
954
954
|
return RegExp(`\\buniform\\s+\\w+\\s+${t}\\s*;`, "g").test(e);
|
|
955
955
|
}
|
|
956
|
-
function
|
|
956
|
+
function It(e, t) {
|
|
957
957
|
let n = [];
|
|
958
958
|
for (let [r, i] of Object.entries(t)) {
|
|
959
|
-
if (
|
|
959
|
+
if (Ft(e, r)) continue;
|
|
960
960
|
let t;
|
|
961
961
|
switch (i.type) {
|
|
962
962
|
case "float":
|
|
@@ -1014,7 +1014,7 @@ void main() {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
`;
|
|
1016
1016
|
}
|
|
1017
|
-
var
|
|
1017
|
+
var Lt = class {
|
|
1018
1018
|
gl;
|
|
1019
1019
|
program = null;
|
|
1020
1020
|
positionBuffer = null;
|
|
@@ -1030,7 +1030,7 @@ var Nt = class {
|
|
|
1030
1030
|
mouseClickY = 0;
|
|
1031
1031
|
channels = [];
|
|
1032
1032
|
channelResolution = /* @__PURE__ */ new Float32Array(12);
|
|
1033
|
-
channelTime = new Float32Array(
|
|
1033
|
+
channelTime = new Float32Array(Pt);
|
|
1034
1034
|
lastError = null;
|
|
1035
1035
|
currentShaderSource = "";
|
|
1036
1036
|
constructor(e) {
|
|
@@ -1065,7 +1065,7 @@ var Nt = class {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
initializeChannels() {
|
|
1067
1067
|
let e = this.gl;
|
|
1068
|
-
for (let t = 0; t <
|
|
1068
|
+
for (let t = 0; t < Pt; t++) {
|
|
1069
1069
|
let t = e.createTexture();
|
|
1070
1070
|
e.bindTexture(e.TEXTURE_2D, t), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, new Uint8Array([
|
|
1071
1071
|
0,
|
|
@@ -1082,7 +1082,7 @@ var Nt = class {
|
|
|
1082
1082
|
e.bindTexture(e.TEXTURE_2D, null);
|
|
1083
1083
|
}
|
|
1084
1084
|
setChannels(e) {
|
|
1085
|
-
for (let t = 0; t <
|
|
1085
|
+
for (let t = 0; t < Pt; t++) {
|
|
1086
1086
|
let n = e[t] ?? null, r = this.channels[t];
|
|
1087
1087
|
if (r.url !== n) {
|
|
1088
1088
|
if (r.url = n, !n) {
|
|
@@ -1113,9 +1113,9 @@ var Nt = class {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
compile(e, t = {}) {
|
|
1115
1115
|
this.lastError = null, this.customUniforms = t, this.currentShaderSource = e;
|
|
1116
|
-
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER,
|
|
1116
|
+
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER, Nt);
|
|
1117
1117
|
if (!r) return !1;
|
|
1118
|
-
let i =
|
|
1118
|
+
let i = It(e, t), a = this.compileShader(n.FRAGMENT_SHADER, i);
|
|
1119
1119
|
if (!a) return n.deleteShader(r), !1;
|
|
1120
1120
|
let o = n.createProgram();
|
|
1121
1121
|
return o ? (n.attachShader(o, r), n.attachShader(o, a), n.linkProgram(o), n.deleteShader(r), n.deleteShader(a), n.getProgramParameter(o, n.LINK_STATUS) ? (this.program && n.deleteProgram(this.program), this.program = o, this.cacheUniformLocations(), !0) : (this.lastError = n.getProgramInfoLog(o) || "Program link failed", n.deleteProgram(o), !1)) : (this.lastError = "Failed to create program", n.deleteShader(r), n.deleteShader(a), !1);
|
|
@@ -1139,7 +1139,7 @@ var Nt = class {
|
|
|
1139
1139
|
"iMouse",
|
|
1140
1140
|
"iDate"
|
|
1141
1141
|
]) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
1142
|
-
for (let t = 0; t <
|
|
1142
|
+
for (let t = 0; t < Pt; t++) this.uniformLocations.set(`iChannel${t}`, e.getUniformLocation(this.program, `iChannel${t}`));
|
|
1143
1143
|
this.uniformLocations.set("iChannelResolution", e.getUniformLocation(this.program, "iChannelResolution[0]")), this.uniformLocations.set("iChannelTime", e.getUniformLocation(this.program, "iChannelTime[0]"));
|
|
1144
1144
|
for (let t of Object.keys(this.customUniforms)) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
1145
1145
|
}
|
|
@@ -1171,7 +1171,7 @@ var Nt = class {
|
|
|
1171
1171
|
let t = /* @__PURE__ */ new Date();
|
|
1172
1172
|
e.uniform4f(p, t.getFullYear(), t.getMonth(), t.getDate(), t.getHours() * 3600 + t.getMinutes() * 60 + t.getSeconds() + t.getMilliseconds() / 1e3);
|
|
1173
1173
|
}
|
|
1174
|
-
for (let t = 0; t <
|
|
1174
|
+
for (let t = 0; t < Pt; t++) {
|
|
1175
1175
|
e.activeTexture(e.TEXTURE0 + t), e.bindTexture(e.TEXTURE_2D, this.channels[t].texture);
|
|
1176
1176
|
let n = this.uniformLocations.get(`iChannel${t}`);
|
|
1177
1177
|
n && e.uniform1i(n, t);
|
|
@@ -1221,7 +1221,7 @@ var Nt = class {
|
|
|
1221
1221
|
};
|
|
1222
1222
|
//#endregion
|
|
1223
1223
|
//#region src/shadertoy/shadertoy-renderer.tsx
|
|
1224
|
-
function
|
|
1224
|
+
function Rt(e) {
|
|
1225
1225
|
if (typeof e == "string") {
|
|
1226
1226
|
let t = e.trim();
|
|
1227
1227
|
return t.length > 0 ? t : void 0;
|
|
@@ -1231,22 +1231,22 @@ function Pt(e) {
|
|
|
1231
1231
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
|
-
function
|
|
1234
|
+
function zt(...e) {
|
|
1235
1235
|
let t = [];
|
|
1236
1236
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
1237
1237
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function Bt(e) {
|
|
1240
1240
|
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
1241
1241
|
if (typeof e == "string" && e.trim().length > 0) {
|
|
1242
1242
|
let t = Number(e);
|
|
1243
1243
|
if (Number.isFinite(t)) return Math.floor(t);
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Vt(e) {
|
|
1247
1247
|
return typeof e == "string" ? e : "";
|
|
1248
1248
|
}
|
|
1249
|
-
function
|
|
1249
|
+
function Ht(e) {
|
|
1250
1250
|
if (typeof e == "boolean") return e;
|
|
1251
1251
|
if (typeof e == "string") {
|
|
1252
1252
|
let t = e.trim().toLowerCase();
|
|
@@ -1254,7 +1254,7 @@ function Rt(e) {
|
|
|
1254
1254
|
if (t === "false") return !1;
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
function
|
|
1257
|
+
function Ut(e) {
|
|
1258
1258
|
if (!e || typeof e != "object") return {};
|
|
1259
1259
|
let t = {}, n = e;
|
|
1260
1260
|
for (let [e, r] of Object.entries(n)) {
|
|
@@ -1274,10 +1274,10 @@ function zt(e) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
return t;
|
|
1276
1276
|
}
|
|
1277
|
-
function
|
|
1277
|
+
function Wt(e) {
|
|
1278
1278
|
return Array.isArray(e) ? e.map((e) => typeof e == "string" ? e : null) : [];
|
|
1279
1279
|
}
|
|
1280
|
-
function
|
|
1280
|
+
function Gt(e, t) {
|
|
1281
1281
|
let n = Object.keys(e), r = Object.keys(t);
|
|
1282
1282
|
if (n.length !== r.length) return !1;
|
|
1283
1283
|
for (let r of n) {
|
|
@@ -1291,8 +1291,8 @@ function Vt(e, t) {
|
|
|
1291
1291
|
}
|
|
1292
1292
|
return !0;
|
|
1293
1293
|
}
|
|
1294
|
-
var
|
|
1295
|
-
function
|
|
1294
|
+
var Kt = "std.shadertoy-canvas";
|
|
1295
|
+
function qt() {
|
|
1296
1296
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
1297
1297
|
let r = I(t.store, e), i = j(null), a = j(null), o = j(null), s = j(0), c = j(""), l = j({}), u = j({
|
|
1298
1298
|
x: 0,
|
|
@@ -1300,12 +1300,12 @@ function Ut() {
|
|
|
1300
1300
|
clickX: 0,
|
|
1301
1301
|
clickY: 0,
|
|
1302
1302
|
isDown: !1
|
|
1303
|
-
}), d = r ?
|
|
1303
|
+
}), d = r ? Vt(r.props?.shaderSource) : "", f = r ? Bt(r.props?.fps) ?? 60 : 60, p = r?.props?.uniforms, m = A(() => Ut(p), [p]), h = r?.props?.channels, g = A(() => Wt(h), [h]), _ = r ? Ht(r.props?.enableMouse) ?? !0 : !0, v = r ? Bt(r.props?.width) : void 0, y = r ? Bt(r.props?.height) : void 0, b = r ? zt(Rt(r.props?.className), n) : n;
|
|
1304
1304
|
k(() => {
|
|
1305
1305
|
let e = i.current;
|
|
1306
1306
|
if (e) {
|
|
1307
1307
|
try {
|
|
1308
|
-
let t = new
|
|
1308
|
+
let t = new Lt(e);
|
|
1309
1309
|
a.current = t;
|
|
1310
1310
|
} catch (e) {
|
|
1311
1311
|
console.error("[ShadertoyRenderer] Failed to create WebGL2 context:", e);
|
|
@@ -1323,7 +1323,7 @@ function Ut() {
|
|
|
1323
1323
|
}
|
|
1324
1324
|
}, [d, m]), k(() => {
|
|
1325
1325
|
let e = a.current;
|
|
1326
|
-
!e || !c.current ||
|
|
1326
|
+
!e || !c.current || Gt(l.current, m) || (e.setCustomUniforms(m), l.current = m);
|
|
1327
1327
|
}, [m]), k(() => {
|
|
1328
1328
|
let e = a.current;
|
|
1329
1329
|
e && e.setChannels(g);
|
|
@@ -1372,13 +1372,13 @@ function Ut() {
|
|
|
1372
1372
|
}
|
|
1373
1373
|
//#endregion
|
|
1374
1374
|
//#region src/shadertoy/shadertoy-module.ts
|
|
1375
|
-
var
|
|
1376
|
-
function
|
|
1377
|
-
e.registerModule(
|
|
1375
|
+
var Jt = "shadertoy", Yt = async () => qt();
|
|
1376
|
+
function Xt(e) {
|
|
1377
|
+
e.registerModule(Jt, Yt);
|
|
1378
1378
|
}
|
|
1379
1379
|
//#endregion
|
|
1380
1380
|
//#region src/ikon-ui-registry.ts
|
|
1381
|
-
var
|
|
1381
|
+
var Zt = b("UIRegistry"), Qt = class {
|
|
1382
1382
|
baseResolvers = [];
|
|
1383
1383
|
moduleLoaders = /* @__PURE__ */ new Map();
|
|
1384
1384
|
moduleResolvers = /* @__PURE__ */ new Map();
|
|
@@ -1404,14 +1404,14 @@ var qt = v("UIRegistry"), Jt = class {
|
|
|
1404
1404
|
async loadRegisteredModules() {
|
|
1405
1405
|
let e = !1;
|
|
1406
1406
|
for (let [t, n] of this.moduleLoaders.entries()) if (!this.moduleResolvers.has(t)) try {
|
|
1407
|
-
let r =
|
|
1407
|
+
let r = tn(await n());
|
|
1408
1408
|
this.moduleResolvers.set(t, r), e = !0;
|
|
1409
1409
|
} catch (e) {
|
|
1410
|
-
|
|
1410
|
+
Zt.error(`[IkonUiRegistry] Failed to load module '${t}'.`, e);
|
|
1411
1411
|
}
|
|
1412
1412
|
let t = [];
|
|
1413
1413
|
for (let e of this.moduleLoaders.keys()) this.moduleResolvers.has(e) && t.push(e);
|
|
1414
|
-
return
|
|
1414
|
+
return nn(t, this.activeModuleOrder) || (this.activeModuleOrder = t, e = !0), e && this.notify(), e;
|
|
1415
1415
|
}
|
|
1416
1416
|
resolve(e) {
|
|
1417
1417
|
for (let t of this.baseResolvers) {
|
|
@@ -1421,7 +1421,7 @@ var qt = v("UIRegistry"), Jt = class {
|
|
|
1421
1421
|
for (let t of this.activeModuleOrder) {
|
|
1422
1422
|
let n = this.moduleResolvers.get(t);
|
|
1423
1423
|
if (!n) {
|
|
1424
|
-
|
|
1424
|
+
Zt.warn(`Missing resolvers for module ${t}`);
|
|
1425
1425
|
continue;
|
|
1426
1426
|
}
|
|
1427
1427
|
for (let t of n) {
|
|
@@ -1434,25 +1434,25 @@ var qt = v("UIRegistry"), Jt = class {
|
|
|
1434
1434
|
for (let e of this.listeners) e();
|
|
1435
1435
|
}
|
|
1436
1436
|
};
|
|
1437
|
-
function
|
|
1438
|
-
let e = new
|
|
1439
|
-
return
|
|
1437
|
+
function $t() {
|
|
1438
|
+
let e = new Qt();
|
|
1439
|
+
return dt(e), Mt(e), Xt(e), e.loadRegisteredModules(), e;
|
|
1440
1440
|
}
|
|
1441
|
-
function
|
|
1441
|
+
function en(e) {
|
|
1442
1442
|
return Array.isArray(e) ? e : [e];
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1445
|
-
return e ?
|
|
1444
|
+
function tn(e) {
|
|
1445
|
+
return e ? en(e).flatMap((e) => e ? Array.isArray(e) ? e.filter(Boolean) : [e] : []) : [];
|
|
1446
1446
|
}
|
|
1447
|
-
function
|
|
1447
|
+
function nn(e, t) {
|
|
1448
1448
|
if (e.length !== t.length) return !1;
|
|
1449
1449
|
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
1450
1450
|
return !0;
|
|
1451
1451
|
}
|
|
1452
1452
|
//#endregion
|
|
1453
1453
|
//#region src/parallax-view.tsx
|
|
1454
|
-
function
|
|
1455
|
-
return /* @__PURE__ */ P(
|
|
1454
|
+
function rn({ mount: e, stores: t, registry: n, client: r, onAction: i }) {
|
|
1455
|
+
return /* @__PURE__ */ P(He, {
|
|
1456
1456
|
stores: t,
|
|
1457
1457
|
registry: n,
|
|
1458
1458
|
category: e,
|
|
@@ -1462,7 +1462,7 @@ function $t({ mount: e, stores: t, registry: n, client: r, onAction: i }) {
|
|
|
1462
1462
|
}
|
|
1463
1463
|
//#endregion
|
|
1464
1464
|
//#region src/motion/motion-controller.ts
|
|
1465
|
-
var
|
|
1465
|
+
var an = b("MotionController"), on = {
|
|
1466
1466
|
ease: [
|
|
1467
1467
|
.25,
|
|
1468
1468
|
.1,
|
|
@@ -1632,20 +1632,20 @@ var en = v("MotionController"), tn = {
|
|
|
1632
1632
|
1.55
|
|
1633
1633
|
]
|
|
1634
1634
|
};
|
|
1635
|
-
function
|
|
1635
|
+
function U(e) {
|
|
1636
1636
|
return e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
1637
1637
|
}
|
|
1638
|
-
function
|
|
1638
|
+
function sn(e) {
|
|
1639
1639
|
if (e == null) return;
|
|
1640
1640
|
let t = e.trim();
|
|
1641
1641
|
if (!t) return;
|
|
1642
1642
|
let n = Number.parseFloat(t);
|
|
1643
1643
|
return Number.isFinite(n) ? n : void 0;
|
|
1644
1644
|
}
|
|
1645
|
-
function
|
|
1645
|
+
function cn(e) {
|
|
1646
1646
|
return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1648
|
+
function ln(e, t, n, r) {
|
|
1649
1649
|
let i = 1 / 10, a = /* @__PURE__ */ new Float32Array(11);
|
|
1650
1650
|
function o(e, t, n) {
|
|
1651
1651
|
return ((3 * t - 3 * n + 1) * e + (3 * n - 6 * t)) * e * e + 3 * t * e;
|
|
@@ -1679,34 +1679,34 @@ function an(e, t, n, r) {
|
|
|
1679
1679
|
for (let t = 0; t < 11; t += 1) a[t] = o(t * i, e, n);
|
|
1680
1680
|
return (e) => e <= 0 ? 0 : e >= 1 ? 1 : o(u(e), t, r);
|
|
1681
1681
|
}
|
|
1682
|
-
function
|
|
1682
|
+
function un(e) {
|
|
1683
1683
|
let t = /steps\(\s*([0-9]+)\s*(?:,\s*([a-z-]+)\s*)?\)/i.exec(e);
|
|
1684
|
-
if (!t) return (e) =>
|
|
1684
|
+
if (!t) return (e) => U(e);
|
|
1685
1685
|
let n = Math.max(1, parseInt(t[1], 10)), r = (t[2] ?? "end").toLowerCase();
|
|
1686
|
-
return r === "start" || r === "jump-start" ? (e) =>
|
|
1686
|
+
return r === "start" || r === "jump-start" ? (e) => U(Math.ceil(e * n) / n) : r === "none" || r === "jump-none" ? (e) => U(Math.round(e * n) / n) : r === "both" || r === "jump-both" ? (e) => U((Math.floor(e * n) + .5) / n) : (e) => U(Math.floor(e * n) / n);
|
|
1687
1687
|
}
|
|
1688
|
-
function
|
|
1689
|
-
if (!e) return (e) =>
|
|
1688
|
+
function dn(e) {
|
|
1689
|
+
if (!e) return (e) => U(e);
|
|
1690
1690
|
let t = e.trim().toLowerCase();
|
|
1691
|
-
if (!t || t === "linear") return (e) =>
|
|
1692
|
-
if (
|
|
1693
|
-
let [e, n, r, i] =
|
|
1694
|
-
return (e) =>
|
|
1691
|
+
if (!t || t === "linear") return (e) => U(e);
|
|
1692
|
+
if (on[t]) {
|
|
1693
|
+
let [e, n, r, i] = on[t], a = ln(e, n, r, i);
|
|
1694
|
+
return (e) => U(a(U(e)));
|
|
1695
1695
|
}
|
|
1696
1696
|
if (t.startsWith("cubic-bezier(") && t.endsWith(")")) {
|
|
1697
1697
|
let e = t.slice(13, -1).split(",").map((e) => Number.parseFloat(e.trim()));
|
|
1698
1698
|
if (e.length === 4 && e.every((e) => Number.isFinite(e))) {
|
|
1699
|
-
let [t, n, r, i] = e, a =
|
|
1700
|
-
return (e) =>
|
|
1699
|
+
let [t, n, r, i] = e, a = ln(t, n, r, i);
|
|
1700
|
+
return (e) => U(a(U(e)));
|
|
1701
1701
|
}
|
|
1702
1702
|
}
|
|
1703
1703
|
if (t.startsWith("steps(") && t.endsWith(")")) {
|
|
1704
|
-
let e =
|
|
1705
|
-
return (t) => e(
|
|
1704
|
+
let e = un(t);
|
|
1705
|
+
return (t) => e(U(t));
|
|
1706
1706
|
}
|
|
1707
|
-
return (e) =>
|
|
1707
|
+
return (e) => U(e);
|
|
1708
1708
|
}
|
|
1709
|
-
function
|
|
1709
|
+
function fn(e) {
|
|
1710
1710
|
if (!e) return;
|
|
1711
1711
|
let t = /(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)\s*->\s*(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)/.exec(e);
|
|
1712
1712
|
if (!t) return;
|
|
@@ -1723,7 +1723,7 @@ function cn(e) {
|
|
|
1723
1723
|
outEnd: a
|
|
1724
1724
|
};
|
|
1725
1725
|
}
|
|
1726
|
-
var
|
|
1726
|
+
var pn = new class {
|
|
1727
1727
|
bindingsByStyle = /* @__PURE__ */ new Map();
|
|
1728
1728
|
observer;
|
|
1729
1729
|
observeScheduled = !1;
|
|
@@ -1748,7 +1748,7 @@ var ln = new class {
|
|
|
1748
1748
|
for (let e of Array.from(this.globalCleanups)) try {
|
|
1749
1749
|
e();
|
|
1750
1750
|
} catch (e) {
|
|
1751
|
-
|
|
1751
|
+
an.warn("Failed to cleanup binding listener", e);
|
|
1752
1752
|
}
|
|
1753
1753
|
this.globalCleanups.clear(), this.elementStates.clear(), this.styleToElements.clear(), this.bindingsByStyle.clear(), this.pendingScanStyles.clear(), this.scanScheduled = !1, this.observer &&= (this.observer.disconnect(), void 0);
|
|
1754
1754
|
}
|
|
@@ -1757,14 +1757,14 @@ var ln = new class {
|
|
|
1757
1757
|
let t = (JSON.parse(e).motionBindings ?? []).map((e) => this.parseBinding(e)).filter((e) => e !== void 0);
|
|
1758
1758
|
return t.length === 0 ? void 0 : { bindings: t };
|
|
1759
1759
|
} catch (e) {
|
|
1760
|
-
|
|
1760
|
+
an.warn("Failed to parse motion metadata", e);
|
|
1761
1761
|
return;
|
|
1762
1762
|
}
|
|
1763
1763
|
}
|
|
1764
1764
|
parseBinding(e) {
|
|
1765
1765
|
let t = e.source?.trim();
|
|
1766
1766
|
if (!t) return;
|
|
1767
|
-
let n =
|
|
1767
|
+
let n = sn(e.min) ?? 0, r = sn(e.max), i = r === void 0 ? n + 100 : r, a = (e.clamp ?? "clamp").trim().toLowerCase(), o = !!e.reverse, s = dn(e.ease), c = fn(e.map), l = e.targetId?.trim() || void 0;
|
|
1768
1768
|
if (!(Number.isNaN(n) || Number.isNaN(i))) return {
|
|
1769
1769
|
source: t.toLowerCase(),
|
|
1770
1770
|
min: n,
|
|
@@ -1810,7 +1810,7 @@ var ln = new class {
|
|
|
1810
1810
|
scanExistingNodes(e) {
|
|
1811
1811
|
let t = this.bindingsByStyle.get(e);
|
|
1812
1812
|
if (!t || typeof document > "u") return;
|
|
1813
|
-
let n = `.${
|
|
1813
|
+
let n = `.${cn(e)}`;
|
|
1814
1814
|
document.querySelectorAll(n).forEach((n) => this.applyStyleToElement(n, e, t));
|
|
1815
1815
|
}
|
|
1816
1816
|
applyStyleToElement(e, t, n) {
|
|
@@ -1846,7 +1846,7 @@ var ln = new class {
|
|
|
1846
1846
|
}
|
|
1847
1847
|
resolveScrollContainer(e, t) {
|
|
1848
1848
|
if (t.targetId) {
|
|
1849
|
-
let e = `[data-ikon-motion-source="${
|
|
1849
|
+
let e = `[data-ikon-motion-source="${cn(t.targetId)}"]`, n = typeof document < "u" ? document.querySelector(e) : null;
|
|
1850
1850
|
if (n) return n;
|
|
1851
1851
|
}
|
|
1852
1852
|
return e.closest("[data-ikon-view-type=\"scroll-view\"]");
|
|
@@ -1866,7 +1866,7 @@ var ln = new class {
|
|
|
1866
1866
|
case "freeze-start": return e < 0 ? 0 : e;
|
|
1867
1867
|
case "freeze-end": return e > 1 ? 1 : e;
|
|
1868
1868
|
case "unclamped": return e;
|
|
1869
|
-
default: return
|
|
1869
|
+
default: return U(e);
|
|
1870
1870
|
}
|
|
1871
1871
|
}
|
|
1872
1872
|
applyMap(e, t) {
|
|
@@ -1901,7 +1901,7 @@ var ln = new class {
|
|
|
1901
1901
|
try {
|
|
1902
1902
|
e();
|
|
1903
1903
|
} catch (e) {
|
|
1904
|
-
|
|
1904
|
+
an.warn("Failed to cleanup listener", e);
|
|
1905
1905
|
}
|
|
1906
1906
|
this.globalCleanups.delete(e);
|
|
1907
1907
|
}
|
|
@@ -1941,26 +1941,26 @@ var ln = new class {
|
|
|
1941
1941
|
}();
|
|
1942
1942
|
//#endregion
|
|
1943
1943
|
//#region src/use-ikon-styles.ts
|
|
1944
|
-
function
|
|
1944
|
+
function mn(e) {
|
|
1945
1945
|
let t = j(/* @__PURE__ */ new Map()), n = O(({ styleId: e, css: n, common: r }) => {
|
|
1946
1946
|
if (!(!e || typeof document > "u")) {
|
|
1947
1947
|
if (n) {
|
|
1948
1948
|
let r = t.current.get(e);
|
|
1949
1949
|
r || (r = document.createElement("style"), r.setAttribute("data-ikon-style-id", e), document.head.appendChild(r), t.current.set(e, r)), r.textContent = n;
|
|
1950
1950
|
}
|
|
1951
|
-
|
|
1951
|
+
pn.registerStyle(e, r);
|
|
1952
1952
|
}
|
|
1953
1953
|
}, []), r = O((e) => {
|
|
1954
1954
|
if (!(typeof document > "u")) for (let n of e) {
|
|
1955
1955
|
let e = t.current.get(n);
|
|
1956
|
-
e && (e.remove(), t.current.delete(n)),
|
|
1956
|
+
e && (e.remove(), t.current.delete(n)), pn.unregisterStyle(n);
|
|
1957
1957
|
}
|
|
1958
1958
|
}, []), i = O(() => {
|
|
1959
1959
|
if (typeof document < "u") {
|
|
1960
1960
|
for (let e of t.current.values()) e.remove();
|
|
1961
1961
|
t.current.clear();
|
|
1962
1962
|
}
|
|
1963
|
-
|
|
1963
|
+
pn.reset();
|
|
1964
1964
|
}, []);
|
|
1965
1965
|
return k(() => {
|
|
1966
1966
|
if (!e) return;
|
|
@@ -1982,7 +1982,7 @@ function un(e) {
|
|
|
1982
1982
|
}
|
|
1983
1983
|
//#endregion
|
|
1984
1984
|
//#region src/use-ikon-ui-stores.ts
|
|
1985
|
-
function
|
|
1985
|
+
function hn(e) {
|
|
1986
1986
|
let t = [];
|
|
1987
1987
|
for (let [n, r] of e) {
|
|
1988
1988
|
let e = r.store.getSnapshot(), i = e.rootViewId && e.views.has(e.rootViewId);
|
|
@@ -1990,7 +1990,7 @@ function dn(e) {
|
|
|
1990
1990
|
}
|
|
1991
1991
|
return t.sort(), t.join(",");
|
|
1992
1992
|
}
|
|
1993
|
-
function
|
|
1993
|
+
function gn(e) {
|
|
1994
1994
|
let [t, n] = M(), r = j("");
|
|
1995
1995
|
return k(() => {
|
|
1996
1996
|
if (!e) {
|
|
@@ -1998,7 +1998,7 @@ function fn(e) {
|
|
|
1998
1998
|
return;
|
|
1999
1999
|
}
|
|
2000
2000
|
let t = () => {
|
|
2001
|
-
let t = e.getStores(), i =
|
|
2001
|
+
let t = e.getStores(), i = hn(t);
|
|
2002
2002
|
i !== r.current && (r.current = i, n(t));
|
|
2003
2003
|
};
|
|
2004
2004
|
return t(), e.subscribe(t);
|
|
@@ -2006,16 +2006,16 @@ function fn(e) {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
//#endregion
|
|
2008
2008
|
//#region src/shared/render-motion-letters.tsx
|
|
2009
|
-
var
|
|
2009
|
+
var W = {
|
|
2010
2010
|
None: 0,
|
|
2011
2011
|
Letter: 1,
|
|
2012
2012
|
Word: 2,
|
|
2013
2013
|
Line: 4,
|
|
2014
2014
|
Paragraph: 8,
|
|
2015
2015
|
Emoji: 16
|
|
2016
|
-
},
|
|
2016
|
+
}, _n = [
|
|
2017
2017
|
{
|
|
2018
|
-
flag:
|
|
2018
|
+
flag: W.Letter,
|
|
2019
2019
|
hints: [
|
|
2020
2020
|
"[data-motion-letter]",
|
|
2021
2021
|
"[data-letter]",
|
|
@@ -2024,7 +2024,7 @@ var K = {
|
|
|
2024
2024
|
]
|
|
2025
2025
|
},
|
|
2026
2026
|
{
|
|
2027
|
-
flag:
|
|
2027
|
+
flag: W.Word,
|
|
2028
2028
|
hints: [
|
|
2029
2029
|
"[data-motion-word]",
|
|
2030
2030
|
"[data-word]",
|
|
@@ -2033,7 +2033,7 @@ var K = {
|
|
|
2033
2033
|
]
|
|
2034
2034
|
},
|
|
2035
2035
|
{
|
|
2036
|
-
flag:
|
|
2036
|
+
flag: W.Line,
|
|
2037
2037
|
hints: [
|
|
2038
2038
|
"[data-motion-line]",
|
|
2039
2039
|
"[data-line]",
|
|
@@ -2042,7 +2042,7 @@ var K = {
|
|
|
2042
2042
|
]
|
|
2043
2043
|
},
|
|
2044
2044
|
{
|
|
2045
|
-
flag:
|
|
2045
|
+
flag: W.Paragraph,
|
|
2046
2046
|
hints: [
|
|
2047
2047
|
"[data-motion-paragraph]",
|
|
2048
2048
|
"[data-paragraph]",
|
|
@@ -2053,7 +2053,7 @@ var K = {
|
|
|
2053
2053
|
]
|
|
2054
2054
|
},
|
|
2055
2055
|
{
|
|
2056
|
-
flag:
|
|
2056
|
+
flag: W.Emoji,
|
|
2057
2057
|
hints: [
|
|
2058
2058
|
":is([data-motion-emoji],[data-emoji],.tw-motion-emoji,.tw-emoji)",
|
|
2059
2059
|
"[data-motion-emoji]",
|
|
@@ -2062,16 +2062,16 @@ var K = {
|
|
|
2062
2062
|
"[data-emoji]"
|
|
2063
2063
|
]
|
|
2064
2064
|
}
|
|
2065
|
-
],
|
|
2066
|
-
function
|
|
2067
|
-
if (!e || e.length >
|
|
2068
|
-
let n =
|
|
2069
|
-
if (i ===
|
|
2065
|
+
], vn = W.Letter | W.Word | W.Line | W.Paragraph | W.Emoji, yn = W.Letter | W.Word | W.Line | W.Paragraph, bn = /* @__PURE__ */ new Map(), xn = 16384;
|
|
2066
|
+
function Sn(e, t) {
|
|
2067
|
+
if (!e || e.length > xn) return e;
|
|
2068
|
+
let n = Xn(t), r = G(n, W.Emoji), i = n & yn;
|
|
2069
|
+
if (i === W.None && !r) return e;
|
|
2070
2070
|
let a = e.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
2071
|
-
if (i ===
|
|
2072
|
-
let o =
|
|
2073
|
-
if (o.length === 0) return r ?
|
|
2074
|
-
let s =
|
|
2071
|
+
if (i === W.None) return Jn(a);
|
|
2072
|
+
let o = Gn(a);
|
|
2073
|
+
if (o.length === 0) return r ? Jn(a) : e;
|
|
2074
|
+
let s = Kn(o), c = {
|
|
2075
2075
|
letter: 0,
|
|
2076
2076
|
word: 0,
|
|
2077
2077
|
line: 0,
|
|
@@ -2080,58 +2080,58 @@ function vn(e, t) {
|
|
|
2080
2080
|
emoji: 0
|
|
2081
2081
|
}, l = [];
|
|
2082
2082
|
for (let e of s) {
|
|
2083
|
-
let t =
|
|
2083
|
+
let t = Cn(e, n, c);
|
|
2084
2084
|
l.push(...t);
|
|
2085
2085
|
}
|
|
2086
2086
|
return l;
|
|
2087
2087
|
}
|
|
2088
|
-
function
|
|
2088
|
+
function Cn(e, t, n) {
|
|
2089
2089
|
let r = [];
|
|
2090
2090
|
for (let i of e) {
|
|
2091
|
-
let e =
|
|
2091
|
+
let e = wn(i, t, n);
|
|
2092
2092
|
r.push(...e);
|
|
2093
2093
|
}
|
|
2094
|
-
if (
|
|
2094
|
+
if (G(t, W.Paragraph)) {
|
|
2095
2095
|
let e = n.paragraph++;
|
|
2096
2096
|
return [/* @__PURE__ */ P("span", {
|
|
2097
2097
|
"data-motion-paragraph": !0,
|
|
2098
|
-
style:
|
|
2098
|
+
style: qn(e),
|
|
2099
2099
|
children: r
|
|
2100
2100
|
}, `motion-paragraph-${e}`)];
|
|
2101
2101
|
}
|
|
2102
2102
|
return r;
|
|
2103
2103
|
}
|
|
2104
|
-
function
|
|
2105
|
-
let r =
|
|
2106
|
-
if (
|
|
2104
|
+
function wn(e, t, n) {
|
|
2105
|
+
let r = Tn(e.text, t, n), i = [];
|
|
2106
|
+
if (G(t, W.Line)) {
|
|
2107
2107
|
let e = n.line++;
|
|
2108
2108
|
i.push(/* @__PURE__ */ P("span", {
|
|
2109
2109
|
"data-motion-line": !0,
|
|
2110
|
-
style:
|
|
2110
|
+
style: qn(e),
|
|
2111
2111
|
children: r
|
|
2112
2112
|
}, `motion-line-${e}`));
|
|
2113
2113
|
} else i.push(...r);
|
|
2114
2114
|
for (let t = 0; t < e.breaks; t++) i.push(/* @__PURE__ */ P("br", {}, `motion-break-${n.br++}`));
|
|
2115
2115
|
return i;
|
|
2116
2116
|
}
|
|
2117
|
-
function
|
|
2117
|
+
function Tn(e, t, n) {
|
|
2118
2118
|
if (!e) return [];
|
|
2119
|
-
let r =
|
|
2119
|
+
let r = G(t, W.Word), i = [], a = /(\s+)/g, o = 0, s;
|
|
2120
2120
|
for (; (s = a.exec(e)) !== null;) {
|
|
2121
2121
|
if (s.index > o) {
|
|
2122
2122
|
let a = e.slice(o, s.index);
|
|
2123
|
-
i.push(
|
|
2123
|
+
i.push(En(a, n, t, r));
|
|
2124
2124
|
}
|
|
2125
2125
|
i.push(s[0]), o = s.index + s[0].length;
|
|
2126
2126
|
}
|
|
2127
2127
|
if (o < e.length) {
|
|
2128
2128
|
let a = e.slice(o);
|
|
2129
|
-
i.push(
|
|
2129
|
+
i.push(En(a, n, t, r));
|
|
2130
2130
|
}
|
|
2131
2131
|
return i;
|
|
2132
2132
|
}
|
|
2133
|
-
function
|
|
2134
|
-
let i = t.word++, a =
|
|
2133
|
+
function En(e, t, n, r) {
|
|
2134
|
+
let i = t.word++, a = On(e, n, t), o = `motion-word-${i}`, s = Dn(i, r);
|
|
2135
2135
|
return r ? /* @__PURE__ */ P("span", {
|
|
2136
2136
|
"data-motion-word": !0,
|
|
2137
2137
|
style: s,
|
|
@@ -2141,25 +2141,25 @@ function Sn(e, t, n, r) {
|
|
|
2141
2141
|
children: a
|
|
2142
2142
|
}, o);
|
|
2143
2143
|
}
|
|
2144
|
-
function
|
|
2144
|
+
function Dn(e, t) {
|
|
2145
2145
|
return t ? {
|
|
2146
|
-
...
|
|
2146
|
+
...qn(e),
|
|
2147
2147
|
whiteSpace: "nowrap"
|
|
2148
2148
|
} : { whiteSpace: "nowrap" };
|
|
2149
2149
|
}
|
|
2150
|
-
function
|
|
2150
|
+
function On(e, t, n) {
|
|
2151
2151
|
if (!e) return [];
|
|
2152
|
-
let r =
|
|
2152
|
+
let r = G(t, W.Letter), i = G(t, W.Emoji);
|
|
2153
2153
|
if (!r) {
|
|
2154
2154
|
if (!i) return [e];
|
|
2155
|
-
let t =
|
|
2155
|
+
let t = kn(e);
|
|
2156
2156
|
if (t.length === 0) return [e];
|
|
2157
|
-
let { nodes: r } =
|
|
2157
|
+
let { nodes: r } = Yn(t, n);
|
|
2158
2158
|
return r;
|
|
2159
2159
|
}
|
|
2160
|
-
let a = [], o =
|
|
2160
|
+
let a = [], o = kn(e);
|
|
2161
2161
|
for (let e of o) {
|
|
2162
|
-
let t = n.letter++, r = `motion-letter-${t}`, o =
|
|
2162
|
+
let t = n.letter++, r = `motion-letter-${t}`, o = qn(t);
|
|
2163
2163
|
if (e === "\n") {
|
|
2164
2164
|
a.push(/* @__PURE__ */ P("span", {
|
|
2165
2165
|
"data-motion-letter": !0,
|
|
@@ -2168,7 +2168,7 @@ function wn(e, t, n) {
|
|
|
2168
2168
|
}, r));
|
|
2169
2169
|
continue;
|
|
2170
2170
|
}
|
|
2171
|
-
let s = i &&
|
|
2171
|
+
let s = i && Hn(e) ? { "data-motion-emoji": !0 } : void 0, c = e === " " ? "\xA0" : e;
|
|
2172
2172
|
a.push(/* @__PURE__ */ P("span", {
|
|
2173
2173
|
"data-motion-letter": !0,
|
|
2174
2174
|
style: o,
|
|
@@ -2178,46 +2178,46 @@ function wn(e, t, n) {
|
|
|
2178
2178
|
}
|
|
2179
2179
|
return a;
|
|
2180
2180
|
}
|
|
2181
|
-
function
|
|
2181
|
+
function kn(e) {
|
|
2182
2182
|
if (!e) return [];
|
|
2183
|
-
let t =
|
|
2184
|
-
return t ? Array.from(t.segment(e), (e) => e.segment) :
|
|
2183
|
+
let t = jn();
|
|
2184
|
+
return t ? Array.from(t.segment(e), (e) => e.segment) : Mn(e);
|
|
2185
2185
|
}
|
|
2186
|
-
var
|
|
2187
|
-
function
|
|
2188
|
-
return
|
|
2186
|
+
var An;
|
|
2187
|
+
function jn() {
|
|
2188
|
+
return An === void 0 && (An = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null), An;
|
|
2189
2189
|
}
|
|
2190
|
-
function
|
|
2190
|
+
function Mn(e) {
|
|
2191
2191
|
let t = [], n = Array.from(e), r = "";
|
|
2192
2192
|
for (let e = 0; e < n.length; e++) {
|
|
2193
2193
|
let i = n[e], a = n[e + 1];
|
|
2194
|
-
r += i, !(a &&
|
|
2194
|
+
r += i, !(a && Nn(i, a)) && (t.push(r), r = "");
|
|
2195
2195
|
}
|
|
2196
2196
|
return r && t.push(r), t;
|
|
2197
2197
|
}
|
|
2198
|
-
function
|
|
2199
|
-
return t ? !!(
|
|
2198
|
+
function Nn(e, t) {
|
|
2199
|
+
return t ? !!(Pn(e) || Pn(t) || zn(t) || Fn(t) || In(t) || Ln(e) && Ln(t)) : !1;
|
|
2200
2200
|
}
|
|
2201
|
-
function
|
|
2201
|
+
function Pn(e) {
|
|
2202
2202
|
return e.codePointAt(0) === 8205;
|
|
2203
2203
|
}
|
|
2204
|
-
function
|
|
2204
|
+
function Fn(e) {
|
|
2205
2205
|
let t = e.codePointAt(0);
|
|
2206
2206
|
return t === void 0 ? !1 : t >= 65024 && t <= 65039 || t >= 917760 && t <= 917999;
|
|
2207
2207
|
}
|
|
2208
|
-
function
|
|
2208
|
+
function In(e) {
|
|
2209
2209
|
let t = e.codePointAt(0);
|
|
2210
2210
|
return t !== void 0 && t >= 127995 && t <= 127999;
|
|
2211
2211
|
}
|
|
2212
|
-
function
|
|
2212
|
+
function Ln(e) {
|
|
2213
2213
|
let t = e.codePointAt(0);
|
|
2214
2214
|
return t !== void 0 && t >= 127462 && t <= 127487;
|
|
2215
2215
|
}
|
|
2216
|
-
var
|
|
2217
|
-
function
|
|
2218
|
-
return e ? (
|
|
2216
|
+
var Rn;
|
|
2217
|
+
function zn(e) {
|
|
2218
|
+
return e ? (Rn ||= Bn(), Rn(e)) : !1;
|
|
2219
2219
|
}
|
|
2220
|
-
function
|
|
2220
|
+
function Bn() {
|
|
2221
2221
|
try {
|
|
2222
2222
|
let e = /\p{Mark}/u;
|
|
2223
2223
|
return (t) => e.test(t);
|
|
@@ -2228,19 +2228,19 @@ function In() {
|
|
|
2228
2228
|
};
|
|
2229
2229
|
}
|
|
2230
2230
|
}
|
|
2231
|
-
var
|
|
2232
|
-
function
|
|
2233
|
-
return e ? (
|
|
2231
|
+
var Vn;
|
|
2232
|
+
function Hn(e) {
|
|
2233
|
+
return e ? (Vn ||= Un(), Vn(e)) : !1;
|
|
2234
2234
|
}
|
|
2235
|
-
function
|
|
2235
|
+
function Un() {
|
|
2236
2236
|
try {
|
|
2237
2237
|
let e = /\p{Extended_Pictographic}/u;
|
|
2238
2238
|
return (t) => e.test(t);
|
|
2239
2239
|
} catch {
|
|
2240
|
-
return
|
|
2240
|
+
return Wn;
|
|
2241
2241
|
}
|
|
2242
2242
|
}
|
|
2243
|
-
function
|
|
2243
|
+
function Wn(e) {
|
|
2244
2244
|
if (!e) return !1;
|
|
2245
2245
|
for (let t of Array.from(e)) {
|
|
2246
2246
|
let e = t.codePointAt(0);
|
|
@@ -2248,7 +2248,7 @@ function Bn(e) {
|
|
|
2248
2248
|
}
|
|
2249
2249
|
return !1;
|
|
2250
2250
|
}
|
|
2251
|
-
function
|
|
2251
|
+
function Gn(e) {
|
|
2252
2252
|
let t = [], n = "", r = 0;
|
|
2253
2253
|
for (let i = 0; i < e.length; i++) {
|
|
2254
2254
|
let a = e[i];
|
|
@@ -2266,16 +2266,16 @@ function Vn(e) {
|
|
|
2266
2266
|
breaks: r
|
|
2267
2267
|
}), t;
|
|
2268
2268
|
}
|
|
2269
|
-
function
|
|
2269
|
+
function Kn(e) {
|
|
2270
2270
|
if (e.length === 0) return [];
|
|
2271
2271
|
let t = [], n = [];
|
|
2272
2272
|
for (let r of e) n.push(r), r.breaks >= 2 && (t.push(n), n = []);
|
|
2273
2273
|
return n.length > 0 && t.push(n), t;
|
|
2274
2274
|
}
|
|
2275
|
-
function
|
|
2275
|
+
function G(e, t) {
|
|
2276
2276
|
return (e & t) === t;
|
|
2277
2277
|
}
|
|
2278
|
-
function
|
|
2278
|
+
function qn(e) {
|
|
2279
2279
|
return {
|
|
2280
2280
|
"--tw-motion-seq-index": e.toString(),
|
|
2281
2281
|
backgroundColor: "inherit",
|
|
@@ -2292,19 +2292,19 @@ function Wn(e) {
|
|
|
2292
2292
|
WebkitTextFillColor: "inherit"
|
|
2293
2293
|
};
|
|
2294
2294
|
}
|
|
2295
|
-
function
|
|
2295
|
+
function Jn(e) {
|
|
2296
2296
|
if (!e) return e;
|
|
2297
|
-
let t =
|
|
2297
|
+
let t = kn(e);
|
|
2298
2298
|
if (t.length === 0) return e;
|
|
2299
|
-
let { nodes: n, sawEmoji: r } =
|
|
2299
|
+
let { nodes: n, sawEmoji: r } = Yn(t);
|
|
2300
2300
|
return r ? n.length === 1 ? n[0] ?? e : n : e;
|
|
2301
2301
|
}
|
|
2302
|
-
function
|
|
2302
|
+
function Yn(e, t) {
|
|
2303
2303
|
let n = [], r = "", i = !1, a = t?.emoji ?? 0, o = () => {
|
|
2304
2304
|
r &&= (n.push(r), "");
|
|
2305
2305
|
};
|
|
2306
2306
|
for (let s of e) {
|
|
2307
|
-
if (
|
|
2307
|
+
if (Hn(s)) {
|
|
2308
2308
|
i = !0, o();
|
|
2309
2309
|
let e = `motion-emoji-${t ? t.emoji++ : a++}`;
|
|
2310
2310
|
n.push(/* @__PURE__ */ P("span", {
|
|
@@ -2323,16 +2323,16 @@ function Kn(e, t) {
|
|
|
2323
2323
|
sawEmoji: !1
|
|
2324
2324
|
};
|
|
2325
2325
|
}
|
|
2326
|
-
function
|
|
2327
|
-
if (!e) return
|
|
2326
|
+
function Xn(e) {
|
|
2327
|
+
if (!e) return W.None;
|
|
2328
2328
|
let t = e.trim();
|
|
2329
|
-
if (!t) return
|
|
2330
|
-
let n =
|
|
2329
|
+
if (!t) return W.None;
|
|
2330
|
+
let n = bn.get(t);
|
|
2331
2331
|
if (typeof n == "number") return n;
|
|
2332
|
-
if (typeof document > "u") return
|
|
2332
|
+
if (typeof document > "u") return W.None;
|
|
2333
2333
|
let r = t.split(/\s+/).filter(Boolean);
|
|
2334
|
-
if (r.length === 0) return
|
|
2335
|
-
let i = r.map((e) => `.${
|
|
2334
|
+
if (r.length === 0) return W.None;
|
|
2335
|
+
let i = r.map((e) => `.${Qn(e)}`).map((e) => RegExp(`(^|[^a-zA-Z0-9_-])${$n(e)}(?![a-zA-Z0-9_-])`)), a = W.None, o = !1;
|
|
2336
2336
|
for (let e of Array.from(document.styleSheets)) {
|
|
2337
2337
|
let t;
|
|
2338
2338
|
try {
|
|
@@ -2340,18 +2340,18 @@ function qn(e) {
|
|
|
2340
2340
|
} catch {
|
|
2341
2341
|
continue;
|
|
2342
2342
|
}
|
|
2343
|
-
let n =
|
|
2344
|
-
if (n.mask && (a |= n.mask, a ===
|
|
2343
|
+
let n = Zn(t, i);
|
|
2344
|
+
if (n.mask && (a |= n.mask, a === vn)) break;
|
|
2345
2345
|
o ||= n.sawStyleRule;
|
|
2346
2346
|
}
|
|
2347
|
-
return (a !==
|
|
2347
|
+
return (a !== W.None || o) && bn.set(t, a), a;
|
|
2348
2348
|
}
|
|
2349
|
-
function
|
|
2349
|
+
function Zn(e, t) {
|
|
2350
2350
|
if (!e) return {
|
|
2351
|
-
mask:
|
|
2351
|
+
mask: W.None,
|
|
2352
2352
|
sawStyleRule: !1
|
|
2353
2353
|
};
|
|
2354
|
-
let n =
|
|
2354
|
+
let n = W.None, r = !1;
|
|
2355
2355
|
for (let i = 0; i < e.length; i++) {
|
|
2356
2356
|
let a = e[i];
|
|
2357
2357
|
if (a) {
|
|
@@ -2359,14 +2359,14 @@ function Jn(e, t) {
|
|
|
2359
2359
|
let e = a.selectorText ?? "";
|
|
2360
2360
|
if (!e || !t.some((t) => t.test(e))) continue;
|
|
2361
2361
|
r = !0;
|
|
2362
|
-
for (let t of
|
|
2363
|
-
if (n ===
|
|
2362
|
+
for (let t of _n) t.hints.some((t) => e.includes(t)) && (n |= t.flag);
|
|
2363
|
+
if (n === vn) return {
|
|
2364
2364
|
mask: n,
|
|
2365
2365
|
sawStyleRule: !0
|
|
2366
2366
|
};
|
|
2367
2367
|
} else if ("cssRules" in a) {
|
|
2368
|
-
let e =
|
|
2369
|
-
if (e.mask && (n |= e.mask, n ===
|
|
2368
|
+
let e = Zn(a.cssRules, t);
|
|
2369
|
+
if (e.mask && (n |= e.mask, n === vn)) return {
|
|
2370
2370
|
mask: n,
|
|
2371
2371
|
sawStyleRule: !0
|
|
2372
2372
|
};
|
|
@@ -2379,106 +2379,106 @@ function Jn(e, t) {
|
|
|
2379
2379
|
sawStyleRule: r
|
|
2380
2380
|
};
|
|
2381
2381
|
}
|
|
2382
|
-
function
|
|
2382
|
+
function Qn(e) {
|
|
2383
2383
|
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
2384
2384
|
}
|
|
2385
|
-
function
|
|
2385
|
+
function $n(e) {
|
|
2386
2386
|
return e.replace(/[.*+?^${}()|[\]\\]/g, (e) => `\\${e}`);
|
|
2387
2387
|
}
|
|
2388
2388
|
//#endregion
|
|
2389
2389
|
//#region src/auth/storage.ts
|
|
2390
|
-
var
|
|
2391
|
-
function
|
|
2390
|
+
var er = "ikon-auth-session", tr = "ikon-auth-refreshable", nr = "ikon-auth-auto-login-attempted-run", rr = 6048e5, ir = 6e4;
|
|
2391
|
+
function ar(e) {
|
|
2392
2392
|
try {
|
|
2393
2393
|
let t = e.split(".");
|
|
2394
2394
|
if (t.length !== 3) return !0;
|
|
2395
2395
|
let n = t[1].replace(/-/g, "+").replace(/_/g, "/"), r = n + "=".repeat((4 - n.length % 4) % 4), i = JSON.parse(atob(r));
|
|
2396
|
-
return typeof i.exp == "number" && Date.now() >= i.exp * 1e3 -
|
|
2396
|
+
return typeof i.exp == "number" && Date.now() >= i.exp * 1e3 - ir;
|
|
2397
2397
|
} catch {
|
|
2398
2398
|
return !0;
|
|
2399
2399
|
}
|
|
2400
2400
|
}
|
|
2401
|
-
function
|
|
2401
|
+
function K(e) {
|
|
2402
2402
|
try {
|
|
2403
|
-
localStorage.setItem(
|
|
2403
|
+
localStorage.setItem(er, JSON.stringify(e));
|
|
2404
2404
|
} catch {
|
|
2405
2405
|
console.warn("Failed to save auth session to localStorage");
|
|
2406
2406
|
}
|
|
2407
2407
|
}
|
|
2408
|
-
function
|
|
2408
|
+
function or() {
|
|
2409
2409
|
try {
|
|
2410
|
-
let e = localStorage.getItem(
|
|
2410
|
+
let e = localStorage.getItem(er);
|
|
2411
2411
|
if (!e) return null;
|
|
2412
2412
|
let t = JSON.parse(e);
|
|
2413
|
-
return Date.now() - t.authenticatedAt >
|
|
2413
|
+
return Date.now() - t.authenticatedAt > rr || ar(t.token) ? (pr(), null) : t;
|
|
2414
2414
|
} catch {
|
|
2415
2415
|
return console.warn("Failed to load auth session from localStorage"), null;
|
|
2416
2416
|
}
|
|
2417
2417
|
}
|
|
2418
|
-
function
|
|
2418
|
+
function sr(e) {
|
|
2419
2419
|
try {
|
|
2420
|
-
localStorage.removeItem(
|
|
2420
|
+
localStorage.removeItem(er), localStorage.setItem(tr, JSON.stringify(e));
|
|
2421
2421
|
} catch {
|
|
2422
2422
|
console.warn("Failed to save the auth session marker to localStorage");
|
|
2423
2423
|
}
|
|
2424
2424
|
}
|
|
2425
|
-
function
|
|
2425
|
+
function cr() {
|
|
2426
2426
|
try {
|
|
2427
|
-
let e = localStorage.getItem(
|
|
2427
|
+
let e = localStorage.getItem(tr);
|
|
2428
2428
|
if (!e) return null;
|
|
2429
2429
|
let t = JSON.parse(e);
|
|
2430
|
-
return Date.now() - t.renewedAt >
|
|
2430
|
+
return Date.now() - t.renewedAt > rr ? (ur(), null) : t;
|
|
2431
2431
|
} catch {
|
|
2432
2432
|
return console.warn("Failed to load the auth session marker from localStorage"), null;
|
|
2433
2433
|
}
|
|
2434
2434
|
}
|
|
2435
|
-
function
|
|
2436
|
-
let e =
|
|
2437
|
-
e &&
|
|
2435
|
+
function lr() {
|
|
2436
|
+
let e = cr();
|
|
2437
|
+
e && sr({
|
|
2438
2438
|
...e,
|
|
2439
2439
|
renewedAt: Date.now()
|
|
2440
2440
|
});
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function ur() {
|
|
2443
2443
|
try {
|
|
2444
|
-
localStorage.removeItem(
|
|
2444
|
+
localStorage.removeItem(tr);
|
|
2445
2445
|
} catch {
|
|
2446
2446
|
console.warn("Failed to clear the auth session marker from localStorage");
|
|
2447
2447
|
}
|
|
2448
2448
|
}
|
|
2449
|
-
function
|
|
2450
|
-
|
|
2449
|
+
function dr() {
|
|
2450
|
+
or()?.provider === "anonymous" && pr(), cr()?.provider === "anonymous" && ur();
|
|
2451
2451
|
}
|
|
2452
|
-
function
|
|
2452
|
+
function fr() {
|
|
2453
2453
|
try {
|
|
2454
2454
|
let e = typeof window < "u" ? new URLSearchParams(window.location.search) : void 0;
|
|
2455
2455
|
if (e?.get("ikon_token") || e?.get("ikon_code")) return !0;
|
|
2456
2456
|
} catch {}
|
|
2457
|
-
let e =
|
|
2457
|
+
let e = or()?.provider ?? cr()?.provider;
|
|
2458
2458
|
return e !== void 0 && e !== "anonymous";
|
|
2459
2459
|
}
|
|
2460
|
-
function
|
|
2460
|
+
function pr() {
|
|
2461
2461
|
try {
|
|
2462
|
-
localStorage.removeItem(
|
|
2462
|
+
localStorage.removeItem(er);
|
|
2463
2463
|
} catch {
|
|
2464
2464
|
console.warn("Failed to clear auth session from localStorage");
|
|
2465
2465
|
}
|
|
2466
2466
|
}
|
|
2467
|
-
function
|
|
2467
|
+
function mr(e) {
|
|
2468
2468
|
if (e) try {
|
|
2469
|
-
sessionStorage.setItem(
|
|
2469
|
+
sessionStorage.setItem(nr, e);
|
|
2470
2470
|
} catch {
|
|
2471
2471
|
console.warn("Failed to record auto-login attempt in sessionStorage");
|
|
2472
2472
|
}
|
|
2473
2473
|
}
|
|
2474
|
-
function
|
|
2474
|
+
function hr() {
|
|
2475
2475
|
try {
|
|
2476
|
-
return sessionStorage.getItem(
|
|
2476
|
+
return sessionStorage.getItem(nr);
|
|
2477
2477
|
} catch {
|
|
2478
2478
|
return null;
|
|
2479
2479
|
}
|
|
2480
2480
|
}
|
|
2481
|
-
function
|
|
2481
|
+
function q(e) {
|
|
2482
2482
|
return {
|
|
2483
2483
|
id: "",
|
|
2484
2484
|
provider: e.provider,
|
|
@@ -2489,8 +2489,8 @@ function J(e) {
|
|
|
2489
2489
|
}
|
|
2490
2490
|
//#endregion
|
|
2491
2491
|
//#region src/auth/auth-service.ts
|
|
2492
|
-
var
|
|
2493
|
-
async function
|
|
2492
|
+
var gr = 15e3, _r = 15e3, J = b("AuthService");
|
|
2493
|
+
async function vr(e) {
|
|
2494
2494
|
try {
|
|
2495
2495
|
return await fetch(e, {
|
|
2496
2496
|
method: "GET",
|
|
@@ -2500,35 +2500,35 @@ async function hr(e) {
|
|
|
2500
2500
|
return `no-cors probe ALSO FAILED (${e instanceof Error ? e.name : "Error"}) → origin is unreachable: TLS handshake / certificate, DNS, or network (old browser may not trust this host's cert)`;
|
|
2501
2501
|
}
|
|
2502
2502
|
}
|
|
2503
|
-
var
|
|
2504
|
-
function
|
|
2505
|
-
if (e.headers.get(
|
|
2503
|
+
var yr = "x-ikon-auth-service";
|
|
2504
|
+
function br(e) {
|
|
2505
|
+
if (e.headers.get(yr) !== null) return !1;
|
|
2506
2506
|
if (e.status === 404 || e.status === 405) return !0;
|
|
2507
2507
|
let t = e.headers.get("content-type") ?? "";
|
|
2508
2508
|
return e.status === 200 && t.includes("text/html");
|
|
2509
2509
|
}
|
|
2510
|
-
async function
|
|
2511
|
-
let r = `${e}${t}`, i =
|
|
2510
|
+
async function Y(e, t, n) {
|
|
2511
|
+
let r = `${e}${t}`, i = w(), a = i !== null && e === i, o = a ? await te() : i, s = o !== null && o !== e ? `${o}${t}` : null, c;
|
|
2512
2512
|
try {
|
|
2513
2513
|
c = await fetch(r, n);
|
|
2514
2514
|
} catch (i) {
|
|
2515
2515
|
let a = i instanceof Error ? `${i.name}: ${i.message}` : String(i);
|
|
2516
2516
|
if (!s) {
|
|
2517
|
-
let n = await
|
|
2518
|
-
throw
|
|
2517
|
+
let n = await vr(e);
|
|
2518
|
+
throw J.error(`Auth request ${t} could not reach ${r} — ${a}. ${n}`), Error(`Auth request could not reach ${r} (${a}). ${n}`, { cause: i });
|
|
2519
2519
|
}
|
|
2520
|
-
|
|
2520
|
+
J.warn(`Auth request ${t} could not reach ${r} (${a}); falling back to ${s}`);
|
|
2521
2521
|
try {
|
|
2522
2522
|
return await fetch(s, n);
|
|
2523
2523
|
} catch (n) {
|
|
2524
|
-
let i = n instanceof Error ? `${n.name}: ${n.message}` : String(n), o = await
|
|
2525
|
-
throw
|
|
2524
|
+
let i = n instanceof Error ? `${n.name}: ${n.message}` : String(n), o = await vr(e);
|
|
2525
|
+
throw J.error(`Auth request ${t} failed on both ${r} (${a}) and ${s} (${i}). ${o}`), Error(`Auth request unreachable: ${r} (${a}) and ${s} (${i})`, { cause: n });
|
|
2526
2526
|
}
|
|
2527
2527
|
}
|
|
2528
|
-
return a && s !== null &&
|
|
2528
|
+
return a && s !== null && br(c) ? (J.warn(`Auth request ${t} got a non-auth-service answer from ${r} (${c.status}); this LB has no /ikon/auth route, falling back to ${s}`), fetch(s, n)) : c;
|
|
2529
2529
|
}
|
|
2530
|
-
async function
|
|
2531
|
-
let r =
|
|
2530
|
+
async function xr(e, t, n) {
|
|
2531
|
+
let r = ae(), i = n === "guest" ? "anonymous" : n, a = {
|
|
2532
2532
|
method: "POST",
|
|
2533
2533
|
headers: { "Content-Type": "application/json" },
|
|
2534
2534
|
body: JSON.stringify({
|
|
@@ -2537,43 +2537,43 @@ async function vr(e, t, n) {
|
|
|
2537
2537
|
...i ? { method: i } : {}
|
|
2538
2538
|
})
|
|
2539
2539
|
}, o = typeof window < "u" ? window.location.origin : "?";
|
|
2540
|
-
|
|
2541
|
-
let s = await
|
|
2540
|
+
J.debug(`Anonymous auth: POST ${t}/anonymous (space=${e}, origin=${o})`);
|
|
2541
|
+
let s = await Y(t, "/anonymous", a);
|
|
2542
2542
|
if (!s.ok) {
|
|
2543
2543
|
let e = await s.text().catch(() => "Unknown error");
|
|
2544
|
-
throw
|
|
2544
|
+
throw J.error(`Anonymous auth HTTP ${s.status} from ${s.url}: ${e}`), Error(`Anonymous auth failed: ${s.status} ${e}`);
|
|
2545
2545
|
}
|
|
2546
2546
|
let { token: c } = await s.json(), l = {
|
|
2547
2547
|
token: c,
|
|
2548
2548
|
provider: "anonymous",
|
|
2549
2549
|
authenticatedAt: Date.now()
|
|
2550
2550
|
};
|
|
2551
|
-
return
|
|
2551
|
+
return K(l), l;
|
|
2552
2552
|
}
|
|
2553
|
-
async function
|
|
2554
|
-
let r = await
|
|
2553
|
+
async function Sr({ email: e, spaceId: t, authUrl: n }) {
|
|
2554
|
+
let r = await Y(n, "/email/send", {
|
|
2555
2555
|
method: "POST",
|
|
2556
2556
|
headers: { "Content-Type": "application/json" },
|
|
2557
2557
|
body: JSON.stringify({
|
|
2558
2558
|
email: e.trim(),
|
|
2559
2559
|
space: t
|
|
2560
2560
|
}),
|
|
2561
|
-
signal:
|
|
2561
|
+
signal: _(gr)
|
|
2562
2562
|
});
|
|
2563
2563
|
if (!r.ok) {
|
|
2564
2564
|
let e = await r.text().catch(() => "Failed to send login code");
|
|
2565
2565
|
throw Error(e);
|
|
2566
2566
|
}
|
|
2567
2567
|
}
|
|
2568
|
-
async function
|
|
2569
|
-
let r = await
|
|
2568
|
+
async function Cr({ email: e, code: t, authUrl: n }) {
|
|
2569
|
+
let r = await Y(n, "/email/code", {
|
|
2570
2570
|
method: "POST",
|
|
2571
2571
|
headers: { "Content-Type": "application/json" },
|
|
2572
2572
|
body: JSON.stringify({
|
|
2573
2573
|
email: e.trim(),
|
|
2574
2574
|
code: t.trim()
|
|
2575
2575
|
}),
|
|
2576
|
-
signal:
|
|
2576
|
+
signal: _(gr)
|
|
2577
2577
|
});
|
|
2578
2578
|
if (!r.ok) {
|
|
2579
2579
|
let e = await r.text().catch(() => "Invalid code");
|
|
@@ -2584,26 +2584,26 @@ async function br({ email: e, code: t, authUrl: n }) {
|
|
|
2584
2584
|
provider: "email",
|
|
2585
2585
|
authenticatedAt: Date.now()
|
|
2586
2586
|
};
|
|
2587
|
-
return
|
|
2587
|
+
return K(a), a;
|
|
2588
2588
|
}
|
|
2589
|
-
function
|
|
2589
|
+
function wr() {
|
|
2590
2590
|
let e = new URLSearchParams(window.location.search), t = e.get("ikon_token"), n = e.get("ikon_provider");
|
|
2591
2591
|
return t && n ? {
|
|
2592
2592
|
token: t,
|
|
2593
2593
|
provider: n
|
|
2594
2594
|
} : null;
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
2596
|
+
function Tr() {
|
|
2597
2597
|
let e = new URLSearchParams(window.location.search), t = e.get("ikon_code"), n = e.get("ikon_provider");
|
|
2598
2598
|
return t && n ? {
|
|
2599
2599
|
code: t,
|
|
2600
2600
|
provider: n
|
|
2601
2601
|
} : null;
|
|
2602
2602
|
}
|
|
2603
|
-
async function
|
|
2604
|
-
let r =
|
|
2603
|
+
async function Er(e, t, n) {
|
|
2604
|
+
let r = he();
|
|
2605
2605
|
if (!r) throw Error("This sign-in was started in a different browser or tab");
|
|
2606
|
-
let i = await
|
|
2606
|
+
let i = await Y(await S(n), "/oauth/exchange", {
|
|
2607
2607
|
method: "POST",
|
|
2608
2608
|
headers: { "Content-Type": "application/json" },
|
|
2609
2609
|
body: JSON.stringify({
|
|
@@ -2611,7 +2611,7 @@ async function Cr(e, t, n) {
|
|
|
2611
2611
|
codeVerifier: r,
|
|
2612
2612
|
supportsRefresh: !0
|
|
2613
2613
|
}),
|
|
2614
|
-
signal:
|
|
2614
|
+
signal: _(gr)
|
|
2615
2615
|
});
|
|
2616
2616
|
if (!i.ok) throw Error("Could not complete the sign-in");
|
|
2617
2617
|
let { token: a, expiresAt: o } = await i.json(), s = {
|
|
@@ -2620,24 +2620,24 @@ async function Cr(e, t, n) {
|
|
|
2620
2620
|
authenticatedAt: Date.now(),
|
|
2621
2621
|
expiresAt: o
|
|
2622
2622
|
};
|
|
2623
|
-
return o ?
|
|
2623
|
+
return o ? sr({
|
|
2624
2624
|
provider: t,
|
|
2625
2625
|
authenticatedAt: s.authenticatedAt,
|
|
2626
2626
|
renewedAt: s.authenticatedAt
|
|
2627
|
-
}) :
|
|
2627
|
+
}) : K(s), s;
|
|
2628
2628
|
}
|
|
2629
|
-
async function
|
|
2630
|
-
let t =
|
|
2629
|
+
async function Dr(e) {
|
|
2630
|
+
let t = w();
|
|
2631
2631
|
if (t === null) return null;
|
|
2632
2632
|
let n;
|
|
2633
2633
|
try {
|
|
2634
2634
|
n = await fetch(`${t}/session/refresh`, {
|
|
2635
2635
|
method: "POST",
|
|
2636
|
-
signal:
|
|
2636
|
+
signal: _(_r)
|
|
2637
2637
|
});
|
|
2638
2638
|
} catch (e) {
|
|
2639
2639
|
let n = e instanceof Error ? `${e.name}: ${e.message}` : String(e);
|
|
2640
|
-
throw
|
|
2640
|
+
throw J.warn(`Session renewal could not reach ${t}/session/refresh (${n})`), Error(`Session renewal could not reach the auth service (${n})`, { cause: e });
|
|
2641
2641
|
}
|
|
2642
2642
|
if (n.status === 401) return null;
|
|
2643
2643
|
if (!n.ok) throw Error(`Session renewal failed: ${n.status}`);
|
|
@@ -2649,25 +2649,25 @@ async function wr(e) {
|
|
|
2649
2649
|
expiresAt: i
|
|
2650
2650
|
};
|
|
2651
2651
|
}
|
|
2652
|
-
function
|
|
2652
|
+
function Or() {
|
|
2653
2653
|
let e = new URLSearchParams(window.location.search), t = e.get("error");
|
|
2654
2654
|
return t ? {
|
|
2655
2655
|
code: t,
|
|
2656
2656
|
provider: e.get("ikon_provider")
|
|
2657
2657
|
} : null;
|
|
2658
2658
|
}
|
|
2659
|
-
function
|
|
2659
|
+
function kr() {
|
|
2660
2660
|
return typeof window > "u" ? !1 : new URLSearchParams(window.location.search).has("ikon-signed-out");
|
|
2661
2661
|
}
|
|
2662
|
-
var
|
|
2662
|
+
var Ar = {
|
|
2663
2663
|
google: "Google",
|
|
2664
2664
|
facebook: "Facebook",
|
|
2665
2665
|
apple: "Apple",
|
|
2666
2666
|
microsoft: "Microsoft",
|
|
2667
2667
|
signicat: "eID"
|
|
2668
2668
|
};
|
|
2669
|
-
function
|
|
2670
|
-
let r = t ?
|
|
2669
|
+
function jr(e, t, n) {
|
|
2670
|
+
let r = t ? Ar[t] ?? t : "this provider";
|
|
2671
2671
|
switch (e) {
|
|
2672
2672
|
case "account_exists_unverified_email": {
|
|
2673
2673
|
let e = `This email address already has an account on this app that uses a different sign-in method. For security, ${r} sign-in can't be connected to it automatically.`;
|
|
@@ -2678,23 +2678,24 @@ function Or(e, t, n) {
|
|
|
2678
2678
|
default: return e;
|
|
2679
2679
|
}
|
|
2680
2680
|
}
|
|
2681
|
-
function
|
|
2681
|
+
function Mr() {
|
|
2682
2682
|
let e = new URLSearchParams(window.location.search);
|
|
2683
2683
|
for (let t of [
|
|
2684
2684
|
"ikon_token",
|
|
2685
2685
|
"ikon_code",
|
|
2686
2686
|
"ikon_provider",
|
|
2687
|
-
"error"
|
|
2687
|
+
"error",
|
|
2688
|
+
f
|
|
2688
2689
|
]) e.delete(t);
|
|
2689
2690
|
let t = e.toString();
|
|
2690
2691
|
window.history.replaceState({}, "", t.length > 0 ? `${window.location.pathname}?${t}` : window.location.pathname);
|
|
2691
2692
|
}
|
|
2692
|
-
async function
|
|
2693
|
-
let i = r ?? window.location.origin + window.location.pathname + window.location.search, a = await
|
|
2693
|
+
async function Nr(e, t, n, r) {
|
|
2694
|
+
let i = r ?? window.location.origin + window.location.pathname + window.location.search, a = await x(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
|
|
2694
2695
|
return `${n}/oauth/${e}?space=${encodeURIComponent(t)}&return=${encodeURIComponent(i)}${o}`;
|
|
2695
2696
|
}
|
|
2696
|
-
async function
|
|
2697
|
-
let t = await
|
|
2697
|
+
async function Pr(e) {
|
|
2698
|
+
let t = await Y(e, "/passkey/registration/options", {
|
|
2698
2699
|
method: "POST",
|
|
2699
2700
|
headers: { "Content-Type": "application/json" }
|
|
2700
2701
|
});
|
|
@@ -2704,8 +2705,8 @@ async function jr(e) {
|
|
|
2704
2705
|
}
|
|
2705
2706
|
return t.json();
|
|
2706
2707
|
}
|
|
2707
|
-
async function
|
|
2708
|
-
let r = await
|
|
2708
|
+
async function Fr(e, t, n) {
|
|
2709
|
+
let r = await Y(e, "/passkey/registration/verify", {
|
|
2709
2710
|
method: "POST",
|
|
2710
2711
|
headers: { "Content-Type": "application/json" },
|
|
2711
2712
|
body: JSON.stringify({
|
|
@@ -2722,10 +2723,10 @@ async function Mr(e, t, n) {
|
|
|
2722
2723
|
provider: "passkey",
|
|
2723
2724
|
authenticatedAt: Date.now()
|
|
2724
2725
|
};
|
|
2725
|
-
return
|
|
2726
|
+
return K(a), a;
|
|
2726
2727
|
}
|
|
2727
|
-
async function
|
|
2728
|
-
let n = await
|
|
2728
|
+
async function Ir(e, t) {
|
|
2729
|
+
let n = await Y(e, "/passkey/authentication/options", {
|
|
2729
2730
|
method: "POST",
|
|
2730
2731
|
headers: { "Content-Type": "application/json" },
|
|
2731
2732
|
body: JSON.stringify({ email: t })
|
|
@@ -2736,8 +2737,8 @@ async function Nr(e, t) {
|
|
|
2736
2737
|
}
|
|
2737
2738
|
return n.json();
|
|
2738
2739
|
}
|
|
2739
|
-
async function
|
|
2740
|
-
let n = await
|
|
2740
|
+
async function Lr(e, t) {
|
|
2741
|
+
let n = await Y(e, "/passkey/authentication/verify", {
|
|
2741
2742
|
method: "POST",
|
|
2742
2743
|
headers: { "Content-Type": "application/json" },
|
|
2743
2744
|
body: JSON.stringify({ response: t })
|
|
@@ -2751,55 +2752,55 @@ async function Pr(e, t) {
|
|
|
2751
2752
|
provider: "passkey",
|
|
2752
2753
|
authenticatedAt: Date.now()
|
|
2753
2754
|
};
|
|
2754
|
-
return
|
|
2755
|
+
return K(i), i;
|
|
2755
2756
|
}
|
|
2756
|
-
async function
|
|
2757
|
+
async function Rr(e, t) {
|
|
2757
2758
|
try {
|
|
2758
|
-
await
|
|
2759
|
+
await Y(await S(t), "/logout", {
|
|
2759
2760
|
method: "POST",
|
|
2760
2761
|
headers: { Authorization: `Bearer ${e}` },
|
|
2761
|
-
signal:
|
|
2762
|
+
signal: _(gr)
|
|
2762
2763
|
});
|
|
2763
2764
|
} catch {}
|
|
2764
2765
|
}
|
|
2765
2766
|
//#endregion
|
|
2766
2767
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/bufferToBase64URLString.js
|
|
2767
|
-
function
|
|
2768
|
+
function X(e) {
|
|
2768
2769
|
let t = new Uint8Array(e), n = "";
|
|
2769
2770
|
for (let e of t) n += String.fromCharCode(e);
|
|
2770
2771
|
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
2771
2772
|
}
|
|
2772
2773
|
//#endregion
|
|
2773
2774
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js
|
|
2774
|
-
function
|
|
2775
|
+
function zr(e) {
|
|
2775
2776
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = (4 - t.length % 4) % 4, r = t.padEnd(t.length + n, "="), i = atob(r), a = new ArrayBuffer(i.length), o = new Uint8Array(a);
|
|
2776
2777
|
for (let e = 0; e < i.length; e++) o[e] = i.charCodeAt(e);
|
|
2777
2778
|
return a;
|
|
2778
2779
|
}
|
|
2779
2780
|
//#endregion
|
|
2780
2781
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js
|
|
2781
|
-
function
|
|
2782
|
-
return
|
|
2782
|
+
function Br() {
|
|
2783
|
+
return Vr.stubThis(globalThis?.PublicKeyCredential !== void 0 && typeof globalThis.PublicKeyCredential == "function");
|
|
2783
2784
|
}
|
|
2784
|
-
var
|
|
2785
|
+
var Vr = { stubThis: (e) => e };
|
|
2785
2786
|
//#endregion
|
|
2786
2787
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js
|
|
2787
|
-
function
|
|
2788
|
+
function Hr(e) {
|
|
2788
2789
|
let { id: t } = e;
|
|
2789
2790
|
return {
|
|
2790
2791
|
...e,
|
|
2791
|
-
id:
|
|
2792
|
+
id: zr(t),
|
|
2792
2793
|
transports: e.transports
|
|
2793
2794
|
};
|
|
2794
2795
|
}
|
|
2795
2796
|
//#endregion
|
|
2796
2797
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js
|
|
2797
|
-
function
|
|
2798
|
+
function Ur(e) {
|
|
2798
2799
|
return e === "localhost" || /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e);
|
|
2799
2800
|
}
|
|
2800
2801
|
//#endregion
|
|
2801
2802
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/webAuthnError.js
|
|
2802
|
-
var
|
|
2803
|
+
var Z = class extends Error {
|
|
2803
2804
|
constructor({ message: e, code: t, cause: n, name: r }) {
|
|
2804
2805
|
super(e, { cause: n }), Object.defineProperty(this, "code", {
|
|
2805
2806
|
enumerable: !0,
|
|
@@ -2811,76 +2812,76 @@ var Q = class extends Error {
|
|
|
2811
2812
|
};
|
|
2812
2813
|
//#endregion
|
|
2813
2814
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js
|
|
2814
|
-
function
|
|
2815
|
+
function Wr({ error: e, options: t }) {
|
|
2815
2816
|
let { publicKey: n } = t;
|
|
2816
2817
|
if (!n) throw Error("options was missing required publicKey property");
|
|
2817
2818
|
if (e.name === "AbortError") {
|
|
2818
|
-
if (t.signal instanceof AbortSignal) return new
|
|
2819
|
+
if (t.signal instanceof AbortSignal) return new Z({
|
|
2819
2820
|
message: "Registration ceremony was sent an abort signal",
|
|
2820
2821
|
code: "ERROR_CEREMONY_ABORTED",
|
|
2821
2822
|
cause: e
|
|
2822
2823
|
});
|
|
2823
2824
|
} else if (e.name === "ConstraintError") {
|
|
2824
|
-
if (n.authenticatorSelection?.requireResidentKey === !0) return new
|
|
2825
|
+
if (n.authenticatorSelection?.requireResidentKey === !0) return new Z({
|
|
2825
2826
|
message: "Discoverable credentials were required but no available authenticator supported it",
|
|
2826
2827
|
code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
|
|
2827
2828
|
cause: e
|
|
2828
2829
|
});
|
|
2829
|
-
if (t.mediation === "conditional" && n.authenticatorSelection?.userVerification === "required") return new
|
|
2830
|
+
if (t.mediation === "conditional" && n.authenticatorSelection?.userVerification === "required") return new Z({
|
|
2830
2831
|
message: "User verification was required during automatic registration but it could not be performed",
|
|
2831
2832
|
code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
|
|
2832
2833
|
cause: e
|
|
2833
2834
|
});
|
|
2834
|
-
if (n.authenticatorSelection?.userVerification === "required") return new
|
|
2835
|
+
if (n.authenticatorSelection?.userVerification === "required") return new Z({
|
|
2835
2836
|
message: "User verification was required but no available authenticator supported it",
|
|
2836
2837
|
code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
|
|
2837
2838
|
cause: e
|
|
2838
2839
|
});
|
|
2839
|
-
} else if (e.name === "InvalidStateError") return new
|
|
2840
|
+
} else if (e.name === "InvalidStateError") return new Z({
|
|
2840
2841
|
message: "The authenticator was previously registered",
|
|
2841
2842
|
code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
|
|
2842
2843
|
cause: e
|
|
2843
2844
|
});
|
|
2844
|
-
else if (e.name === "NotAllowedError") return new
|
|
2845
|
+
else if (e.name === "NotAllowedError") return new Z({
|
|
2845
2846
|
message: e.message,
|
|
2846
2847
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
2847
2848
|
cause: e
|
|
2848
2849
|
});
|
|
2849
|
-
else if (e.name === "NotSupportedError") return n.pubKeyCredParams.filter((e) => e.type === "public-key").length === 0 ? new
|
|
2850
|
+
else if (e.name === "NotSupportedError") return n.pubKeyCredParams.filter((e) => e.type === "public-key").length === 0 ? new Z({
|
|
2850
2851
|
message: "No entry in pubKeyCredParams was of type \"public-key\"",
|
|
2851
2852
|
code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
|
|
2852
2853
|
cause: e
|
|
2853
|
-
}) : new
|
|
2854
|
+
}) : new Z({
|
|
2854
2855
|
message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
|
|
2855
2856
|
code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
|
|
2856
2857
|
cause: e
|
|
2857
2858
|
});
|
|
2858
2859
|
else if (e.name === "SecurityError") {
|
|
2859
2860
|
let t = globalThis.location.hostname;
|
|
2860
|
-
if (!
|
|
2861
|
+
if (!Ur(t)) return new Z({
|
|
2861
2862
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
2862
2863
|
code: "ERROR_INVALID_DOMAIN",
|
|
2863
2864
|
cause: e
|
|
2864
2865
|
});
|
|
2865
|
-
if (n.rp.id !== t) return new
|
|
2866
|
+
if (n.rp.id !== t) return new Z({
|
|
2866
2867
|
message: `The RP ID "${n.rp.id}" is invalid for this domain`,
|
|
2867
2868
|
code: "ERROR_INVALID_RP_ID",
|
|
2868
2869
|
cause: e
|
|
2869
2870
|
});
|
|
2870
2871
|
} else if (e.name === "TypeError") {
|
|
2871
|
-
if (n.user.id.byteLength < 1 || n.user.id.byteLength > 64) return new
|
|
2872
|
+
if (n.user.id.byteLength < 1 || n.user.id.byteLength > 64) return new Z({
|
|
2872
2873
|
message: "User ID was not between 1 and 64 characters",
|
|
2873
2874
|
code: "ERROR_INVALID_USER_ID_LENGTH",
|
|
2874
2875
|
cause: e
|
|
2875
2876
|
});
|
|
2876
|
-
} else if (e.name === "UnknownError") return new
|
|
2877
|
+
} else if (e.name === "UnknownError") return new Z({
|
|
2877
2878
|
message: "The authenticator was unable to process the specified options, or could not create a new credential",
|
|
2878
2879
|
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
2879
2880
|
cause: e
|
|
2880
2881
|
});
|
|
2881
2882
|
return e;
|
|
2882
2883
|
}
|
|
2883
|
-
var
|
|
2884
|
+
var Gr = new class {
|
|
2884
2885
|
constructor() {
|
|
2885
2886
|
Object.defineProperty(this, "controller", {
|
|
2886
2887
|
enumerable: !0,
|
|
@@ -2903,31 +2904,31 @@ var Hr = new class {
|
|
|
2903
2904
|
e.name = "AbortError", this.controller.abort(e), this.controller = void 0;
|
|
2904
2905
|
}
|
|
2905
2906
|
}
|
|
2906
|
-
}(),
|
|
2907
|
-
function
|
|
2908
|
-
if (e && !(
|
|
2907
|
+
}(), Kr = ["cross-platform", "platform"];
|
|
2908
|
+
function qr(e) {
|
|
2909
|
+
if (e && !(Kr.indexOf(e) < 0)) return e;
|
|
2909
2910
|
}
|
|
2910
2911
|
//#endregion
|
|
2911
2912
|
//#region ../../node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js
|
|
2912
|
-
async function
|
|
2913
|
+
async function Jr(e) {
|
|
2913
2914
|
!e.optionsJSON && e.challenge && (console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), e = { optionsJSON: e });
|
|
2914
2915
|
let { optionsJSON: t, useAutoRegister: n = !1 } = e;
|
|
2915
|
-
if (!
|
|
2916
|
+
if (!Br()) throw Error("WebAuthn is not supported in this browser");
|
|
2916
2917
|
let r = {
|
|
2917
2918
|
...t,
|
|
2918
|
-
challenge:
|
|
2919
|
+
challenge: zr(t.challenge),
|
|
2919
2920
|
user: {
|
|
2920
2921
|
...t.user,
|
|
2921
|
-
id:
|
|
2922
|
+
id: zr(t.user.id)
|
|
2922
2923
|
},
|
|
2923
|
-
excludeCredentials: t.excludeCredentials?.map(
|
|
2924
|
+
excludeCredentials: t.excludeCredentials?.map(Hr)
|
|
2924
2925
|
}, i = {};
|
|
2925
|
-
n && (i.mediation = "conditional"), i.publicKey = r, i.signal =
|
|
2926
|
+
n && (i.mediation = "conditional"), i.publicKey = r, i.signal = Gr.createNewAbortSignal();
|
|
2926
2927
|
let a;
|
|
2927
2928
|
try {
|
|
2928
2929
|
a = await navigator.credentials.create(i);
|
|
2929
2930
|
} catch (e) {
|
|
2930
|
-
throw
|
|
2931
|
+
throw Wr({
|
|
2931
2932
|
error: e,
|
|
2932
2933
|
options: i
|
|
2933
2934
|
});
|
|
@@ -2939,27 +2940,27 @@ async function Gr(e) {
|
|
|
2939
2940
|
if (typeof c.getPublicKeyAlgorithm == "function") try {
|
|
2940
2941
|
d = c.getPublicKeyAlgorithm();
|
|
2941
2942
|
} catch (e) {
|
|
2942
|
-
|
|
2943
|
+
Yr("getPublicKeyAlgorithm()", e);
|
|
2943
2944
|
}
|
|
2944
2945
|
let f;
|
|
2945
2946
|
if (typeof c.getPublicKey == "function") try {
|
|
2946
2947
|
let e = c.getPublicKey();
|
|
2947
|
-
e !== null && (f =
|
|
2948
|
+
e !== null && (f = X(e));
|
|
2948
2949
|
} catch (e) {
|
|
2949
|
-
|
|
2950
|
+
Yr("getPublicKey()", e);
|
|
2950
2951
|
}
|
|
2951
2952
|
let p;
|
|
2952
2953
|
if (typeof c.getAuthenticatorData == "function") try {
|
|
2953
|
-
p =
|
|
2954
|
+
p = X(c.getAuthenticatorData());
|
|
2954
2955
|
} catch (e) {
|
|
2955
|
-
|
|
2956
|
+
Yr("getAuthenticatorData()", e);
|
|
2956
2957
|
}
|
|
2957
2958
|
return {
|
|
2958
2959
|
id: o,
|
|
2959
|
-
rawId:
|
|
2960
|
+
rawId: X(s),
|
|
2960
2961
|
response: {
|
|
2961
|
-
attestationObject:
|
|
2962
|
-
clientDataJSON:
|
|
2962
|
+
attestationObject: X(c.attestationObject),
|
|
2963
|
+
clientDataJSON: X(c.clientDataJSON),
|
|
2963
2964
|
transports: u,
|
|
2964
2965
|
publicKeyAlgorithm: d,
|
|
2965
2966
|
publicKey: f,
|
|
@@ -2967,49 +2968,49 @@ async function Gr(e) {
|
|
|
2967
2968
|
},
|
|
2968
2969
|
type: l,
|
|
2969
2970
|
clientExtensionResults: a.getClientExtensionResults(),
|
|
2970
|
-
authenticatorAttachment:
|
|
2971
|
+
authenticatorAttachment: qr(a.authenticatorAttachment)
|
|
2971
2972
|
};
|
|
2972
2973
|
}
|
|
2973
|
-
function
|
|
2974
|
+
function Yr(e, t) {
|
|
2974
2975
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`, t);
|
|
2975
2976
|
}
|
|
2976
2977
|
//#endregion
|
|
2977
2978
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js
|
|
2978
|
-
function
|
|
2979
|
-
if (!
|
|
2979
|
+
function Xr() {
|
|
2980
|
+
if (!Br()) return Zr.stubThis(new Promise((e) => e(!1)));
|
|
2980
2981
|
let e = globalThis.PublicKeyCredential;
|
|
2981
|
-
return e?.isConditionalMediationAvailable === void 0 ?
|
|
2982
|
+
return e?.isConditionalMediationAvailable === void 0 ? Zr.stubThis(new Promise((e) => e(!1))) : Zr.stubThis(e.isConditionalMediationAvailable());
|
|
2982
2983
|
}
|
|
2983
|
-
var
|
|
2984
|
+
var Zr = { stubThis: (e) => e };
|
|
2984
2985
|
//#endregion
|
|
2985
2986
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js
|
|
2986
|
-
function
|
|
2987
|
+
function Qr({ error: e, options: t }) {
|
|
2987
2988
|
let { publicKey: n } = t;
|
|
2988
2989
|
if (!n) throw Error("options was missing required publicKey property");
|
|
2989
2990
|
if (e.name === "AbortError") {
|
|
2990
|
-
if (t.signal instanceof AbortSignal) return new
|
|
2991
|
+
if (t.signal instanceof AbortSignal) return new Z({
|
|
2991
2992
|
message: "Authentication ceremony was sent an abort signal",
|
|
2992
2993
|
code: "ERROR_CEREMONY_ABORTED",
|
|
2993
2994
|
cause: e
|
|
2994
2995
|
});
|
|
2995
|
-
} else if (e.name === "NotAllowedError") return new
|
|
2996
|
+
} else if (e.name === "NotAllowedError") return new Z({
|
|
2996
2997
|
message: e.message,
|
|
2997
2998
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
2998
2999
|
cause: e
|
|
2999
3000
|
});
|
|
3000
3001
|
else if (e.name === "SecurityError") {
|
|
3001
3002
|
let t = globalThis.location.hostname;
|
|
3002
|
-
if (!
|
|
3003
|
+
if (!Ur(t)) return new Z({
|
|
3003
3004
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
3004
3005
|
code: "ERROR_INVALID_DOMAIN",
|
|
3005
3006
|
cause: e
|
|
3006
3007
|
});
|
|
3007
|
-
if (n.rpId !== t) return new
|
|
3008
|
+
if (n.rpId !== t) return new Z({
|
|
3008
3009
|
message: `The RP ID "${n.rpId}" is invalid for this domain`,
|
|
3009
3010
|
code: "ERROR_INVALID_RP_ID",
|
|
3010
3011
|
cause: e
|
|
3011
3012
|
});
|
|
3012
|
-
} else if (e.name === "UnknownError") return new
|
|
3013
|
+
} else if (e.name === "UnknownError") return new Z({
|
|
3013
3014
|
message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
|
|
3014
3015
|
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
3015
3016
|
cause: e
|
|
@@ -3018,52 +3019,52 @@ function Yr({ error: e, options: t }) {
|
|
|
3018
3019
|
}
|
|
3019
3020
|
//#endregion
|
|
3020
3021
|
//#region ../../node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js
|
|
3021
|
-
async function
|
|
3022
|
+
async function $r(e) {
|
|
3022
3023
|
!e.optionsJSON && e.challenge && (console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), e = { optionsJSON: e });
|
|
3023
3024
|
let { optionsJSON: t, useBrowserAutofill: n = !1, verifyBrowserAutofillInput: r = !0 } = e;
|
|
3024
|
-
if (!
|
|
3025
|
+
if (!Br()) throw Error("WebAuthn is not supported in this browser");
|
|
3025
3026
|
let i;
|
|
3026
|
-
t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(
|
|
3027
|
+
t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(Hr));
|
|
3027
3028
|
let a = {
|
|
3028
3029
|
...t,
|
|
3029
|
-
challenge:
|
|
3030
|
+
challenge: zr(t.challenge),
|
|
3030
3031
|
allowCredentials: i
|
|
3031
3032
|
}, o = {};
|
|
3032
3033
|
if (n) {
|
|
3033
|
-
if (!await
|
|
3034
|
+
if (!await Xr()) throw Error("Browser does not support WebAuthn autofill");
|
|
3034
3035
|
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && r) throw Error("No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected");
|
|
3035
3036
|
o.mediation = "conditional", a.allowCredentials = [];
|
|
3036
3037
|
}
|
|
3037
|
-
o.publicKey = a, o.signal =
|
|
3038
|
+
o.publicKey = a, o.signal = Gr.createNewAbortSignal();
|
|
3038
3039
|
let s;
|
|
3039
3040
|
try {
|
|
3040
3041
|
s = await navigator.credentials.get(o);
|
|
3041
3042
|
} catch (e) {
|
|
3042
|
-
throw
|
|
3043
|
+
throw Qr({
|
|
3043
3044
|
error: e,
|
|
3044
3045
|
options: o
|
|
3045
3046
|
});
|
|
3046
3047
|
}
|
|
3047
3048
|
if (!s) throw Error("Authentication was not completed");
|
|
3048
3049
|
let { id: c, rawId: l, response: u, type: d } = s, f;
|
|
3049
|
-
return u.userHandle && (f =
|
|
3050
|
+
return u.userHandle && (f = X(u.userHandle)), {
|
|
3050
3051
|
id: c,
|
|
3051
|
-
rawId:
|
|
3052
|
+
rawId: X(l),
|
|
3052
3053
|
response: {
|
|
3053
|
-
authenticatorData:
|
|
3054
|
-
clientDataJSON:
|
|
3055
|
-
signature:
|
|
3054
|
+
authenticatorData: X(u.authenticatorData),
|
|
3055
|
+
clientDataJSON: X(u.clientDataJSON),
|
|
3056
|
+
signature: X(u.signature),
|
|
3056
3057
|
userHandle: f
|
|
3057
3058
|
},
|
|
3058
3059
|
type: d,
|
|
3059
3060
|
clientExtensionResults: s.getClientExtensionResults(),
|
|
3060
|
-
authenticatorAttachment:
|
|
3061
|
+
authenticatorAttachment: qr(s.authenticatorAttachment)
|
|
3061
3062
|
};
|
|
3062
3063
|
}
|
|
3063
3064
|
//#endregion
|
|
3064
3065
|
//#region src/auth/auth-context.tsx
|
|
3065
|
-
var
|
|
3066
|
-
function
|
|
3066
|
+
var ei = _e(null), ti = 12e4;
|
|
3067
|
+
function ni({ children: e, config: n }) {
|
|
3067
3068
|
let [r, i] = M({
|
|
3068
3069
|
isAuthenticated: !1,
|
|
3069
3070
|
isLoading: !0,
|
|
@@ -3073,9 +3074,9 @@ function $r({ children: e, config: n }) {
|
|
|
3073
3074
|
if (!c.current) {
|
|
3074
3075
|
c.current = !0;
|
|
3075
3076
|
try {
|
|
3076
|
-
let t = await
|
|
3077
|
+
let t = await Dr(e);
|
|
3077
3078
|
if (t === null) {
|
|
3078
|
-
|
|
3079
|
+
ur(), i({
|
|
3079
3080
|
isAuthenticated: !1,
|
|
3080
3081
|
isLoading: !1,
|
|
3081
3082
|
user: null,
|
|
@@ -3083,10 +3084,10 @@ function $r({ children: e, config: n }) {
|
|
|
3083
3084
|
});
|
|
3084
3085
|
return;
|
|
3085
3086
|
}
|
|
3086
|
-
|
|
3087
|
+
lr(), i({
|
|
3087
3088
|
isAuthenticated: !0,
|
|
3088
3089
|
isLoading: !1,
|
|
3089
|
-
user:
|
|
3090
|
+
user: q(t),
|
|
3090
3091
|
error: null
|
|
3091
3092
|
});
|
|
3092
3093
|
} catch {} finally {
|
|
@@ -3097,27 +3098,28 @@ function $r({ children: e, config: n }) {
|
|
|
3097
3098
|
k(() => {
|
|
3098
3099
|
(() => {
|
|
3099
3100
|
if (s.current) return;
|
|
3100
|
-
let e = n.devLoginRunId, t = !!e &&
|
|
3101
|
-
e && !
|
|
3102
|
-
let r = !!n.devLoginToken && !!e && !t && !
|
|
3103
|
-
o ||
|
|
3104
|
-
let c =
|
|
3101
|
+
let e = n.devLoginRunId, t = !!e && hr() === e;
|
|
3102
|
+
e && !kr() && mr(e);
|
|
3103
|
+
let r = !!n.devLoginToken && !!e && !t && !ar(n.devLoginToken) && !kr();
|
|
3104
|
+
o || dr();
|
|
3105
|
+
let c = Or();
|
|
3105
3106
|
if (c) {
|
|
3106
|
-
|
|
3107
|
+
Mr(), i({
|
|
3107
3108
|
isAuthenticated: !1,
|
|
3108
3109
|
isLoading: !1,
|
|
3109
3110
|
user: null,
|
|
3110
|
-
error:
|
|
3111
|
+
error: jr(c.code, c.provider, { emailSignInAvailable: a })
|
|
3111
3112
|
});
|
|
3112
3113
|
return;
|
|
3113
3114
|
}
|
|
3114
|
-
|
|
3115
|
+
v();
|
|
3116
|
+
let l = Tr();
|
|
3115
3117
|
if (l) {
|
|
3116
|
-
s.current = !0,
|
|
3118
|
+
s.current = !0, Mr(), Er(l.code, l.provider, n.authUrl).then((e) => {
|
|
3117
3119
|
i({
|
|
3118
3120
|
isAuthenticated: !0,
|
|
3119
3121
|
isLoading: !1,
|
|
3120
|
-
user:
|
|
3122
|
+
user: q(e),
|
|
3121
3123
|
error: null
|
|
3122
3124
|
});
|
|
3123
3125
|
}).catch((e) => {
|
|
@@ -3130,26 +3132,26 @@ function $r({ children: e, config: n }) {
|
|
|
3130
3132
|
});
|
|
3131
3133
|
return;
|
|
3132
3134
|
}
|
|
3133
|
-
let u =
|
|
3135
|
+
let u = wr();
|
|
3134
3136
|
if (u) {
|
|
3135
3137
|
let e = {
|
|
3136
3138
|
token: u.token,
|
|
3137
3139
|
provider: u.provider,
|
|
3138
3140
|
authenticatedAt: Date.now()
|
|
3139
3141
|
};
|
|
3140
|
-
|
|
3142
|
+
K(e), Mr(), i({
|
|
3141
3143
|
isAuthenticated: !0,
|
|
3142
3144
|
isLoading: !1,
|
|
3143
|
-
user:
|
|
3145
|
+
user: q(e),
|
|
3144
3146
|
error: null
|
|
3145
3147
|
});
|
|
3146
3148
|
return;
|
|
3147
3149
|
}
|
|
3148
|
-
let d =
|
|
3150
|
+
let d = cr();
|
|
3149
3151
|
if (d) {
|
|
3150
|
-
s.current = !0,
|
|
3152
|
+
s.current = !0, Dr(d).then((e) => {
|
|
3151
3153
|
if (e === null) {
|
|
3152
|
-
|
|
3154
|
+
ur(), i({
|
|
3153
3155
|
isAuthenticated: !1,
|
|
3154
3156
|
isLoading: !1,
|
|
3155
3157
|
user: null,
|
|
@@ -3157,10 +3159,10 @@ function $r({ children: e, config: n }) {
|
|
|
3157
3159
|
});
|
|
3158
3160
|
return;
|
|
3159
3161
|
}
|
|
3160
|
-
|
|
3162
|
+
lr(), i({
|
|
3161
3163
|
isAuthenticated: !0,
|
|
3162
3164
|
isLoading: !1,
|
|
3163
|
-
user:
|
|
3165
|
+
user: q(e),
|
|
3164
3166
|
error: null
|
|
3165
3167
|
});
|
|
3166
3168
|
}).catch(() => {
|
|
@@ -3173,12 +3175,12 @@ function $r({ children: e, config: n }) {
|
|
|
3173
3175
|
});
|
|
3174
3176
|
return;
|
|
3175
3177
|
}
|
|
3176
|
-
let f =
|
|
3178
|
+
let f = or();
|
|
3177
3179
|
if (f && !(r && f.provider === "anonymous")) {
|
|
3178
3180
|
i({
|
|
3179
3181
|
isAuthenticated: !0,
|
|
3180
3182
|
isLoading: !1,
|
|
3181
|
-
user:
|
|
3183
|
+
user: q(f),
|
|
3182
3184
|
error: null
|
|
3183
3185
|
});
|
|
3184
3186
|
return;
|
|
@@ -3189,10 +3191,10 @@ function $r({ children: e, config: n }) {
|
|
|
3189
3191
|
provider: "dev",
|
|
3190
3192
|
authenticatedAt: Date.now()
|
|
3191
3193
|
};
|
|
3192
|
-
|
|
3194
|
+
K(e), i({
|
|
3193
3195
|
isAuthenticated: !0,
|
|
3194
3196
|
isLoading: !1,
|
|
3195
|
-
user:
|
|
3197
|
+
user: q(e),
|
|
3196
3198
|
error: null
|
|
3197
3199
|
});
|
|
3198
3200
|
return;
|
|
@@ -3213,9 +3215,9 @@ function $r({ children: e, config: n }) {
|
|
|
3213
3215
|
]), k(() => {
|
|
3214
3216
|
let e = r.user?.expiresAt;
|
|
3215
3217
|
if (!e) return;
|
|
3216
|
-
let t =
|
|
3218
|
+
let t = cr();
|
|
3217
3219
|
if (!t) return;
|
|
3218
|
-
let n = Date.parse(e) -
|
|
3220
|
+
let n = Date.parse(e) - ti, i = setTimeout(() => void l(t), Math.max(0, n - Date.now())), a = () => {
|
|
3219
3221
|
document.visibilityState === "visible" && Date.now() >= n && l(t);
|
|
3220
3222
|
};
|
|
3221
3223
|
return document.addEventListener("visibilitychange", a), () => {
|
|
@@ -3232,7 +3234,7 @@ function $r({ children: e, config: n }) {
|
|
|
3232
3234
|
}
|
|
3233
3235
|
let t;
|
|
3234
3236
|
try {
|
|
3235
|
-
t = await
|
|
3237
|
+
t = await S(n.authUrl);
|
|
3236
3238
|
} catch (e) {
|
|
3237
3239
|
i((t) => ({
|
|
3238
3240
|
...t,
|
|
@@ -3247,11 +3249,11 @@ function $r({ children: e, config: n }) {
|
|
|
3247
3249
|
isLoading: !0
|
|
3248
3250
|
}));
|
|
3249
3251
|
try {
|
|
3250
|
-
let r = await
|
|
3252
|
+
let r = await xr(n.spaceId, t, e);
|
|
3251
3253
|
i({
|
|
3252
3254
|
isAuthenticated: !0,
|
|
3253
3255
|
isLoading: !1,
|
|
3254
|
-
user:
|
|
3256
|
+
user: q(r),
|
|
3255
3257
|
error: null
|
|
3256
3258
|
});
|
|
3257
3259
|
} catch (e) {
|
|
@@ -3270,11 +3272,11 @@ function $r({ children: e, config: n }) {
|
|
|
3270
3272
|
error: null
|
|
3271
3273
|
}));
|
|
3272
3274
|
try {
|
|
3273
|
-
let e = await
|
|
3275
|
+
let e = await $r({ optionsJSON: await Ir(t) }), n = await Lr(t, e);
|
|
3274
3276
|
i({
|
|
3275
3277
|
isAuthenticated: !0,
|
|
3276
3278
|
isLoading: !1,
|
|
3277
|
-
user:
|
|
3279
|
+
user: q(n),
|
|
3278
3280
|
error: null
|
|
3279
3281
|
});
|
|
3280
3282
|
} catch (e) {
|
|
@@ -3287,22 +3289,22 @@ function $r({ children: e, config: n }) {
|
|
|
3287
3289
|
return;
|
|
3288
3290
|
}
|
|
3289
3291
|
if (e === "email") throw Error("login('email') is not supported. Use requestEmailCode()/submitEmailCode() from useAuth() instead.");
|
|
3290
|
-
if (
|
|
3291
|
-
await
|
|
3292
|
+
if (T()) {
|
|
3293
|
+
await fe(e, n.spaceId) || i((e) => ({
|
|
3292
3294
|
...e,
|
|
3293
3295
|
isLoading: !1,
|
|
3294
3296
|
error: "The sign-in window did not complete. Allow pop-ups for this site and try again."
|
|
3295
3297
|
}));
|
|
3296
3298
|
return;
|
|
3297
3299
|
}
|
|
3298
|
-
window.location.href = await
|
|
3300
|
+
window.location.href = await Nr(e, n.spaceId, t);
|
|
3299
3301
|
}, [n.authUrl, n.spaceId]), d = O(async (e) => {
|
|
3300
3302
|
if (!n.spaceId) throw i((e) => ({
|
|
3301
3303
|
...e,
|
|
3302
3304
|
error: "Space ID is not configured"
|
|
3303
3305
|
})), Error("Space ID is not configured");
|
|
3304
|
-
let t = await
|
|
3305
|
-
await
|
|
3306
|
+
let t = await S(n.authUrl);
|
|
3307
|
+
await Sr({
|
|
3306
3308
|
email: e,
|
|
3307
3309
|
spaceId: n.spaceId,
|
|
3308
3310
|
authUrl: t
|
|
@@ -3314,15 +3316,15 @@ function $r({ children: e, config: n }) {
|
|
|
3314
3316
|
error: null
|
|
3315
3317
|
}));
|
|
3316
3318
|
try {
|
|
3317
|
-
let r = await
|
|
3319
|
+
let r = await Cr({
|
|
3318
3320
|
email: e,
|
|
3319
3321
|
code: t,
|
|
3320
|
-
authUrl: await
|
|
3322
|
+
authUrl: await S(n.authUrl)
|
|
3321
3323
|
});
|
|
3322
3324
|
i({
|
|
3323
3325
|
isAuthenticated: !0,
|
|
3324
3326
|
isLoading: !1,
|
|
3325
|
-
user:
|
|
3327
|
+
user: q(r),
|
|
3326
3328
|
error: null
|
|
3327
3329
|
});
|
|
3328
3330
|
} catch (e) {
|
|
@@ -3335,25 +3337,25 @@ function $r({ children: e, config: n }) {
|
|
|
3335
3337
|
}
|
|
3336
3338
|
}, [n.authUrl]), p = O(() => {
|
|
3337
3339
|
let e = r.user?.token;
|
|
3338
|
-
e &&
|
|
3340
|
+
e && Rr(e, n.authUrl), pr(), ur(), t.clearAll(), i({
|
|
3339
3341
|
isAuthenticated: !1,
|
|
3340
3342
|
isLoading: !1,
|
|
3341
3343
|
user: null,
|
|
3342
3344
|
error: null
|
|
3343
3345
|
});
|
|
3344
3346
|
}, [r.user?.token, n.authUrl]), m = O(async (e) => {
|
|
3345
|
-
let t = await
|
|
3347
|
+
let t = await S(n.authUrl);
|
|
3346
3348
|
i((e) => ({
|
|
3347
3349
|
...e,
|
|
3348
3350
|
isLoading: !0,
|
|
3349
3351
|
error: null
|
|
3350
3352
|
}));
|
|
3351
3353
|
try {
|
|
3352
|
-
let n = await
|
|
3354
|
+
let n = await Fr(t, await Jr({ optionsJSON: await Pr(t) }), e);
|
|
3353
3355
|
i({
|
|
3354
3356
|
isAuthenticated: !0,
|
|
3355
3357
|
isLoading: !1,
|
|
3356
|
-
user:
|
|
3358
|
+
user: q(n),
|
|
3357
3359
|
error: null
|
|
3358
3360
|
});
|
|
3359
3361
|
} catch (e) {
|
|
@@ -3380,97 +3382,120 @@ function $r({ children: e, config: n }) {
|
|
|
3380
3382
|
d,
|
|
3381
3383
|
f
|
|
3382
3384
|
]);
|
|
3383
|
-
return /* @__PURE__ */ P(
|
|
3385
|
+
return /* @__PURE__ */ P(ei, {
|
|
3384
3386
|
value: g,
|
|
3385
3387
|
children: e
|
|
3386
3388
|
});
|
|
3387
3389
|
}
|
|
3388
|
-
function
|
|
3389
|
-
let e =
|
|
3390
|
+
function ri() {
|
|
3391
|
+
let e = ve(ei);
|
|
3390
3392
|
if (!e) throw Error("useAuth must be used within an AuthProvider");
|
|
3391
3393
|
return e;
|
|
3392
3394
|
}
|
|
3393
|
-
function
|
|
3394
|
-
return
|
|
3395
|
+
function ii() {
|
|
3396
|
+
return ve(ei);
|
|
3395
3397
|
}
|
|
3396
3398
|
//#endregion
|
|
3397
3399
|
//#region src/auth/oauth-continuation.ts
|
|
3398
|
-
var
|
|
3399
|
-
function
|
|
3400
|
+
var ai = "ikon-oauth", oi = "ikon-oauth-continue", si = "ikon-oauth-continue-attempts", ci = 5, li = 6e5;
|
|
3401
|
+
function ui() {
|
|
3400
3402
|
if (typeof window > "u") return !1;
|
|
3401
|
-
let e = new URL(window.location.href).searchParams.get(
|
|
3402
|
-
return e ? (
|
|
3403
|
+
let e = new URL(window.location.href).searchParams.get(ai);
|
|
3404
|
+
return e ? (gi(e), !0) : hi() !== null;
|
|
3403
3405
|
}
|
|
3404
|
-
function
|
|
3405
|
-
return
|
|
3406
|
+
function di() {
|
|
3407
|
+
return fi() !== null;
|
|
3406
3408
|
}
|
|
3407
|
-
function
|
|
3408
|
-
return typeof window > "u" ? null : new URL(window.location.href).searchParams.get("ikon-oauth") ??
|
|
3409
|
+
function fi() {
|
|
3410
|
+
return typeof window > "u" ? null : new URL(window.location.href).searchParams.get("ikon-oauth") ?? hi();
|
|
3409
3411
|
}
|
|
3410
|
-
async function
|
|
3411
|
-
let
|
|
3412
|
-
if (!
|
|
3413
|
-
|
|
3412
|
+
async function pi(e) {
|
|
3413
|
+
let t = fi();
|
|
3414
|
+
if (!t) return !1;
|
|
3415
|
+
if (!e) return mi() < ci ? (console.warn("[ikon] Waiting for the signed-in session before continuing the authorization that sent you here."), !1) : (Q(), console.warn("[ikon] Gave up continuing the authorization that sent you here: no signed-in session became readable. Start the connection again from the application."), !1);
|
|
3414
3416
|
try {
|
|
3415
|
-
let t = rr();
|
|
3416
|
-
if (!t?.token) return !1;
|
|
3417
3417
|
let n = await fetch("/ikon/oauth/continue", {
|
|
3418
3418
|
method: "POST",
|
|
3419
3419
|
headers: {
|
|
3420
3420
|
"content-type": "application/json",
|
|
3421
|
-
authorization: `Bearer ${
|
|
3421
|
+
authorization: `Bearer ${e}`
|
|
3422
3422
|
},
|
|
3423
|
-
body: JSON.stringify({ continueId:
|
|
3423
|
+
body: JSON.stringify({ continueId: t })
|
|
3424
3424
|
});
|
|
3425
|
-
if (!n.ok) return !1;
|
|
3425
|
+
if (!n.ok) return Q(), console.warn(`[ikon] Could not continue the authorization that sent you here (${n.status}). Start the connection again from the application.`), !1;
|
|
3426
3426
|
let { consentUrl: r } = await n.json();
|
|
3427
|
-
return r ? (window.location.href = r, !0) : !1;
|
|
3427
|
+
return r ? (Q(), window.location.href = r, !0) : (Q(), console.warn("[ikon] The authorization that sent you here returned no consent step. Start the connection again from the application."), !1);
|
|
3428
3428
|
} catch {
|
|
3429
3429
|
return !1;
|
|
3430
3430
|
}
|
|
3431
3431
|
}
|
|
3432
|
-
function
|
|
3432
|
+
function mi() {
|
|
3433
3433
|
try {
|
|
3434
|
-
|
|
3434
|
+
let e = Number(sessionStorage.getItem(si) ?? "0") + 1;
|
|
3435
|
+
return sessionStorage.setItem(si, String(e)), e;
|
|
3435
3436
|
} catch {
|
|
3436
|
-
return
|
|
3437
|
+
return ci;
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3440
|
+
function hi() {
|
|
3441
|
+
try {
|
|
3442
|
+
let e = sessionStorage.getItem(oi);
|
|
3443
|
+
if (!e) return null;
|
|
3444
|
+
let { id: t, at: n } = JSON.parse(e);
|
|
3445
|
+
return !t || typeof n != "number" || Date.now() - n > li ? (Q(), null) : t;
|
|
3446
|
+
} catch {
|
|
3447
|
+
return Q(), null;
|
|
3437
3448
|
}
|
|
3438
3449
|
}
|
|
3439
|
-
function
|
|
3450
|
+
function gi(e) {
|
|
3440
3451
|
try {
|
|
3441
|
-
sessionStorage.setItem(
|
|
3452
|
+
sessionStorage.setItem(oi, JSON.stringify({
|
|
3453
|
+
id: e,
|
|
3454
|
+
at: Date.now()
|
|
3455
|
+
}));
|
|
3442
3456
|
} catch {}
|
|
3443
3457
|
}
|
|
3444
|
-
function
|
|
3458
|
+
function Q() {
|
|
3445
3459
|
try {
|
|
3446
|
-
sessionStorage.removeItem(
|
|
3460
|
+
sessionStorage.removeItem(oi), sessionStorage.removeItem(si);
|
|
3447
3461
|
} catch {}
|
|
3448
3462
|
try {
|
|
3449
3463
|
let e = new URL(window.location.href);
|
|
3450
|
-
e.searchParams.has("ikon-oauth") && (e.searchParams.delete(
|
|
3464
|
+
e.searchParams.has("ikon-oauth") && (e.searchParams.delete(ai), window.history.replaceState(null, "", e.toString()));
|
|
3451
3465
|
} catch {}
|
|
3452
3466
|
}
|
|
3453
3467
|
//#endregion
|
|
3454
3468
|
//#region src/auth/use-auth-guard.ts
|
|
3455
|
-
function
|
|
3456
|
-
let { config: t, guestUrlParam: n } = e, { state: r, login: i } =
|
|
3469
|
+
function _i(e) {
|
|
3470
|
+
let { config: t, guestUrlParam: n } = e, { state: r, login: i, getToken: a } = ri(), o = j(!1), s = j(!1), c = N(pe, C, C), l = c.required;
|
|
3457
3471
|
k(() => {
|
|
3458
|
-
|
|
3472
|
+
ui() && de("An application is asking to act as you. Sign in to review what it wants.");
|
|
3459
3473
|
}, []), k(() => {
|
|
3460
|
-
|
|
3474
|
+
if (!(!l || !r.isAuthenticated || !r.user || r.user.provider === "anonymous")) {
|
|
3475
|
+
if (!di()) {
|
|
3476
|
+
y();
|
|
3477
|
+
return;
|
|
3478
|
+
}
|
|
3479
|
+
s.current || (s.current = !0, pi(a()).then((e) => {
|
|
3480
|
+
(e || !di()) && y();
|
|
3481
|
+
}).finally(() => {
|
|
3482
|
+
s.current = !1;
|
|
3483
|
+
}));
|
|
3484
|
+
}
|
|
3461
3485
|
}, [
|
|
3462
|
-
|
|
3486
|
+
l,
|
|
3463
3487
|
r.isAuthenticated,
|
|
3464
|
-
r.user
|
|
3488
|
+
r.user,
|
|
3489
|
+
a
|
|
3465
3490
|
]), k(() => {
|
|
3466
|
-
if (!n || r.isAuthenticated || r.isLoading ||
|
|
3491
|
+
if (!n || r.isAuthenticated || r.isLoading || o.current) return;
|
|
3467
3492
|
let e = t.methods.includes("global") ? "global" : t.methods.includes("guest") ? "guest" : null;
|
|
3468
3493
|
if (!e) return;
|
|
3469
|
-
let
|
|
3470
|
-
if (s === "true" || s === "1" || s === "" ||
|
|
3471
|
-
|
|
3472
|
-
let t =
|
|
3473
|
-
window.history.replaceState({}, "", r),
|
|
3494
|
+
let a = new URLSearchParams(window.location.search), s = a.get(n);
|
|
3495
|
+
if (s === "true" || s === "1" || s === "" || kr()) {
|
|
3496
|
+
a.delete(n);
|
|
3497
|
+
let t = a.toString(), r = window.location.pathname + (t ? `?${t}` : "");
|
|
3498
|
+
window.history.replaceState({}, "", r), o.current = !0, i(e);
|
|
3474
3499
|
}
|
|
3475
3500
|
}, [
|
|
3476
3501
|
n,
|
|
@@ -3479,30 +3504,30 @@ function di(e) {
|
|
|
3479
3504
|
t.methods,
|
|
3480
3505
|
i
|
|
3481
3506
|
]);
|
|
3482
|
-
let
|
|
3507
|
+
let u = t.methods.includes("guest") || t.methods.includes("global"), d = r.isAuthenticated && (u || r.user?.provider !== "anonymous"), f = !!t.requireSignIn && !d;
|
|
3483
3508
|
return {
|
|
3484
|
-
shouldRenderChildren: !
|
|
3509
|
+
shouldRenderChildren: !f && !l,
|
|
3485
3510
|
isCheckingAuth: r.isLoading,
|
|
3486
3511
|
isAuthenticated: r.isAuthenticated,
|
|
3487
3512
|
error: r.error,
|
|
3488
|
-
isLoginPrompt:
|
|
3489
|
-
dismissLoginPrompt:
|
|
3490
|
-
loginPromptReason:
|
|
3513
|
+
isLoginPrompt: l && !f,
|
|
3514
|
+
dismissLoginPrompt: y,
|
|
3515
|
+
loginPromptReason: l ? c.reason : null
|
|
3491
3516
|
};
|
|
3492
3517
|
}
|
|
3493
3518
|
//#endregion
|
|
3494
3519
|
//#region src/debug/debug-overlay.tsx
|
|
3495
|
-
var
|
|
3520
|
+
var vi = (() => {
|
|
3496
3521
|
try {
|
|
3497
|
-
return
|
|
3522
|
+
return re();
|
|
3498
3523
|
} catch {
|
|
3499
3524
|
return !1;
|
|
3500
3525
|
}
|
|
3501
|
-
})(),
|
|
3502
|
-
function
|
|
3503
|
-
$.push(`[+${((Date.now() -
|
|
3526
|
+
})(), yi = Date.now(), $ = [], bi = 300;
|
|
3527
|
+
function xi(e) {
|
|
3528
|
+
$.push(`[+${((Date.now() - yi) / 1e3).toFixed(1)}s] ${e}`), $.length > bi && $.shift();
|
|
3504
3529
|
}
|
|
3505
|
-
function
|
|
3530
|
+
function Si(e) {
|
|
3506
3531
|
if (typeof e == "string") return e;
|
|
3507
3532
|
if (e instanceof Error) return `${e.name}: ${e.message}`;
|
|
3508
3533
|
try {
|
|
@@ -3511,10 +3536,10 @@ function gi(e) {
|
|
|
3511
3536
|
return String(e);
|
|
3512
3537
|
}
|
|
3513
3538
|
}
|
|
3514
|
-
var
|
|
3515
|
-
function
|
|
3516
|
-
if (
|
|
3517
|
-
|
|
3539
|
+
var Ci = !1;
|
|
3540
|
+
function wi() {
|
|
3541
|
+
if (Ci || typeof window > "u") return;
|
|
3542
|
+
Ci = !0, window.addEventListener("error", (e) => xi(`window.error: ${e.message} @ ${e.filename ?? "?"}:${e.lineno ?? "?"}:${e.colno ?? "?"}`)), window.addEventListener("unhandledrejection", (e) => xi(`unhandledRejection: ${Si(e.reason)}`));
|
|
3518
3543
|
let e = console;
|
|
3519
3544
|
for (let t of [
|
|
3520
3545
|
"error",
|
|
@@ -3525,17 +3550,17 @@ function vi() {
|
|
|
3525
3550
|
let n = e[t]?.bind(console) ?? (() => void 0);
|
|
3526
3551
|
e[t] = (...e) => {
|
|
3527
3552
|
try {
|
|
3528
|
-
|
|
3553
|
+
xi(`console.${t}: ${e.map(Si).join(" ")}`);
|
|
3529
3554
|
} catch {}
|
|
3530
3555
|
n(...e);
|
|
3531
3556
|
};
|
|
3532
3557
|
}
|
|
3533
3558
|
try {
|
|
3534
|
-
|
|
3559
|
+
me((e) => xi(`${e.levelName} [${e.component}] ${e.message}`), { minLevel: d.DEBUG });
|
|
3535
3560
|
} catch {}
|
|
3536
3561
|
}
|
|
3537
|
-
|
|
3538
|
-
function
|
|
3562
|
+
vi && wi();
|
|
3563
|
+
function Ti() {
|
|
3539
3564
|
let e = !1;
|
|
3540
3565
|
try {
|
|
3541
3566
|
let t = URL.createObjectURL(new Blob([""]));
|
|
@@ -3545,11 +3570,11 @@ function yi() {
|
|
|
3545
3570
|
} catch {}
|
|
3546
3571
|
return e;
|
|
3547
3572
|
}
|
|
3548
|
-
function
|
|
3573
|
+
function Ei() {
|
|
3549
3574
|
let e = globalThis;
|
|
3550
3575
|
return [
|
|
3551
3576
|
`Worker=${typeof Worker < "u"}`,
|
|
3552
|
-
`moduleWorker=${
|
|
3577
|
+
`moduleWorker=${Ti()}`,
|
|
3553
3578
|
`WebSocket=${typeof WebSocket < "u"}`,
|
|
3554
3579
|
`WebTransport=${e.WebTransport !== void 0}`,
|
|
3555
3580
|
`RTCPeerConnection=${typeof RTCPeerConnection < "u"}`,
|
|
@@ -3562,14 +3587,14 @@ function bi() {
|
|
|
3562
3587
|
`online=${typeof navigator < "u" ? navigator.onLine : "?"}`
|
|
3563
3588
|
].join(" ");
|
|
3564
3589
|
}
|
|
3565
|
-
function
|
|
3590
|
+
function Di(e) {
|
|
3566
3591
|
return /ERROR|error:|Rejection/.test(e) ? "#f88" : /WARN|warn:/.test(e) ? "#fc6" : "#9d9";
|
|
3567
3592
|
}
|
|
3568
|
-
function
|
|
3569
|
-
let n =
|
|
3593
|
+
function Oi({ state: e = "", forceVisible: t = !1 }) {
|
|
3594
|
+
let n = vi || t, r = e === "connected" || e === "reconnecting", [, i] = be((e) => e + 1, 0), [a, o] = M(!0);
|
|
3570
3595
|
return k(() => {
|
|
3571
3596
|
if (!n) return;
|
|
3572
|
-
|
|
3597
|
+
wi();
|
|
3573
3598
|
let e = setInterval(i, 1e3);
|
|
3574
3599
|
return () => clearInterval(e);
|
|
3575
3600
|
}, [n]), n ? r && a ? /* @__PURE__ */ F("button", {
|
|
@@ -3623,7 +3648,7 @@ function Si({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3623
3648
|
"Ikon debug overlay — state: ",
|
|
3624
3649
|
e || "?",
|
|
3625
3650
|
", +",
|
|
3626
|
-
Math.round((Date.now() -
|
|
3651
|
+
Math.round((Date.now() - yi) / 1e3),
|
|
3627
3652
|
"s, ",
|
|
3628
3653
|
$.length,
|
|
3629
3654
|
" entries",
|
|
@@ -3664,7 +3689,7 @@ function Si({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3664
3689
|
color: "#8cf",
|
|
3665
3690
|
marginBottom: "4px"
|
|
3666
3691
|
},
|
|
3667
|
-
children:
|
|
3692
|
+
children: Ei()
|
|
3668
3693
|
}),
|
|
3669
3694
|
/* @__PURE__ */ P("div", {
|
|
3670
3695
|
style: {
|
|
@@ -3675,7 +3700,7 @@ function Si({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3675
3700
|
}),
|
|
3676
3701
|
/* @__PURE__ */ P("div", { children: $.length === 0 ? "(nothing captured yet)" : $.map((e, t) => /* @__PURE__ */ P("div", {
|
|
3677
3702
|
style: {
|
|
3678
|
-
color:
|
|
3703
|
+
color: Di(e),
|
|
3679
3704
|
wordBreak: "break-all"
|
|
3680
3705
|
},
|
|
3681
3706
|
children: e
|
|
@@ -3685,7 +3710,7 @@ function Si({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3685
3710
|
}
|
|
3686
3711
|
//#endregion
|
|
3687
3712
|
//#region src/app/connection-state-renderer.tsx
|
|
3688
|
-
function
|
|
3713
|
+
function ki({ connectionState: e, error: t, isReady: n, isConnectingSlow: r, stores: i, registry: a, client: o, onAction: s, renderIdle: c, renderConnecting: l, renderConnectingSlow: u, renderConnected: d, renderOffline: f, renderError: p }) {
|
|
3689
3714
|
let m = j(!1), h = (() => {
|
|
3690
3715
|
switch (e) {
|
|
3691
3716
|
case "waitingForExternalConnectUrl":
|
|
@@ -3711,235 +3736,235 @@ function Ci({ connectionState: e, error: t, isReady: n, isConnectingSlow: r, sto
|
|
|
3711
3736
|
default: return null;
|
|
3712
3737
|
}
|
|
3713
3738
|
})();
|
|
3714
|
-
return /* @__PURE__ */ F(
|
|
3739
|
+
return /* @__PURE__ */ F(xe, { children: [h, /* @__PURE__ */ P(Oi, { state: e })] });
|
|
3715
3740
|
}
|
|
3716
3741
|
//#endregion
|
|
3717
3742
|
//#region src/app/boot-snapshot-variant.ts
|
|
3718
|
-
function
|
|
3743
|
+
function Ai(e, t) {
|
|
3719
3744
|
return e === !1 ? !1 : t ? "signed-in" : "guest";
|
|
3720
3745
|
}
|
|
3721
3746
|
//#endregion
|
|
3722
3747
|
//#region src/app/use-ikon-app.ts
|
|
3723
|
-
var
|
|
3724
|
-
function
|
|
3748
|
+
var ji = b("useIkonApp");
|
|
3749
|
+
function Mi() {
|
|
3725
3750
|
if (typeof window < "u" && window.__IKON_AUTH_CONFIG__) return window.__IKON_AUTH_CONFIG__;
|
|
3726
3751
|
}
|
|
3727
|
-
function
|
|
3752
|
+
function Ni() {
|
|
3728
3753
|
if (typeof window < "u" && window.__IKON_LOCAL_IKON_SERVER_CONFIG__) return window.__IKON_LOCAL_IKON_SERVER_CONFIG__;
|
|
3729
3754
|
}
|
|
3730
|
-
function
|
|
3755
|
+
function Pi(e, t) {
|
|
3731
3756
|
return {
|
|
3732
3757
|
...e,
|
|
3733
3758
|
...t ?? {}
|
|
3734
3759
|
};
|
|
3735
3760
|
}
|
|
3736
|
-
function
|
|
3737
|
-
let { authConfig: n, modules: r, parameters: l, timeouts: d, backgroundAudio:
|
|
3738
|
-
pe.current =
|
|
3739
|
-
let [
|
|
3761
|
+
function Fi(e) {
|
|
3762
|
+
let { authConfig: n, modules: r, parameters: l, timeouts: d, backgroundAudio: f, webRtc: _, audio: v, video: y, websocket: b, webtransport: x, proxy: te, liveSnapshot: re, bootSnapshot: ie } = e, C = n === void 0 ? Mi() ?? null : n, ae = Ni(), w = ii(), se = !!w && w.state.isLoading, T = j(null), ce = j(null), E = j(null), de = j(!1), fe = j(!1), pe = j(f), me = j(d), he = j(_), ge = j(v), _e = j(y), D = j(b), ve = j(x), ye = j(te), be = j(re), N = j(ie), xe = j("local"), P = j(void 0);
|
|
3763
|
+
pe.current = f, me.current = d, he.current = _, ge.current = v, _e.current = y, D.current = b, ve.current = x, ye.current = te, be.current = re, N.current = ie;
|
|
3764
|
+
let [F, Se] = M("connecting"), [I, Ce] = M(!1), [we, Te] = M(!1), [Ee, De] = M(null), [Oe, ke] = M(null), [Ae, je] = M(!1), [Me, Ne] = M(!1), [Pe, Fe] = M(!1), [Ie, Le] = M(null), [L, Re] = M(null), [ze, Be] = M(!1), Ve = j(!1), [He, We] = M(0), R = A(() => {
|
|
3740
3765
|
try {
|
|
3741
|
-
return
|
|
3766
|
+
return le();
|
|
3742
3767
|
} catch {
|
|
3743
3768
|
return { parameters: {} };
|
|
3744
3769
|
}
|
|
3745
|
-
}, []),
|
|
3746
|
-
|
|
3747
|
-
let
|
|
3770
|
+
}, []), Ge = JSON.stringify(l ?? {}), z = A(() => Pi(R.parameters, l), [R.parameters, Ge]), Ke = (C?.methods?.length ?? 0) > 0, qe = Ai(ie, Ke && fr());
|
|
3771
|
+
qe !== !1 && !i() && a(qe);
|
|
3772
|
+
let B = A(() => {
|
|
3748
3773
|
if (!C?.spaceId) return null;
|
|
3749
3774
|
let e = w?.state.user;
|
|
3750
3775
|
return e ? {
|
|
3751
3776
|
token: e.token,
|
|
3752
3777
|
provider: e.provider,
|
|
3753
3778
|
authenticatedAt: e.authenticatedAt
|
|
3754
|
-
} :
|
|
3779
|
+
} : or();
|
|
3755
3780
|
}, [
|
|
3756
3781
|
C?.spaceId,
|
|
3757
|
-
|
|
3782
|
+
He,
|
|
3758
3783
|
w?.state.isLoading,
|
|
3759
3784
|
w?.state.isAuthenticated,
|
|
3760
3785
|
w?.state.user?.token
|
|
3761
|
-
]),
|
|
3762
|
-
|
|
3786
|
+
]), V = ae?.enabled ?? !1, Je = ae?.host ?? "localhost", Ye = ae?.port ?? 8443, Xe = !se && !!C && !B && !C.requireSignIn && !!C.spaceId && (oe() || V);
|
|
3787
|
+
Xe && !L && !ze && !Ve.current && (Ve.current = !0, S(C.authUrl).then((e) => xr(C.spaceId, e)).then((e) => {
|
|
3763
3788
|
Re(e.token), Be(!0);
|
|
3764
3789
|
}).catch((e) => {
|
|
3765
|
-
|
|
3790
|
+
ji.error("Anonymous auth failed:", e), Ve.current = !1, V ? Be(!0) : De(e instanceof Error ? e.message : "Anonymous auth failed");
|
|
3766
3791
|
}));
|
|
3767
|
-
let
|
|
3792
|
+
let H = A(() => {
|
|
3768
3793
|
if (se) return null;
|
|
3769
|
-
if (
|
|
3770
|
-
if (
|
|
3771
|
-
let e =
|
|
3794
|
+
if (V) {
|
|
3795
|
+
if (Xe && !ze) return null;
|
|
3796
|
+
let e = B?.token ?? L ?? void 0, t = e ? ne(e) ?? void 0 : void 0;
|
|
3772
3797
|
return { local: {
|
|
3773
|
-
host:
|
|
3774
|
-
httpsPort:
|
|
3798
|
+
host: Je,
|
|
3799
|
+
httpsPort: Ye,
|
|
3775
3800
|
userId: t,
|
|
3776
|
-
token:
|
|
3801
|
+
token: B?.token ?? void 0,
|
|
3777
3802
|
identityToken: e,
|
|
3778
3803
|
spaceId: C?.spaceId,
|
|
3779
3804
|
backendUrl: C?.backendUrl,
|
|
3780
3805
|
authUrl: C?.authUrl,
|
|
3781
|
-
parameters:
|
|
3806
|
+
parameters: z
|
|
3782
3807
|
} };
|
|
3783
3808
|
}
|
|
3784
|
-
return
|
|
3785
|
-
token:
|
|
3809
|
+
return B?.token && C?.spaceId ? { sessionToken: {
|
|
3810
|
+
token: B.token,
|
|
3786
3811
|
spaceId: C.spaceId,
|
|
3787
|
-
backendType:
|
|
3788
|
-
sessionIdentityHash:
|
|
3789
|
-
parameters:
|
|
3812
|
+
backendType: ee(),
|
|
3813
|
+
sessionIdentityHash: R.sessionIdentityHash,
|
|
3814
|
+
parameters: z
|
|
3790
3815
|
} } : L && C?.spaceId ? { sessionToken: {
|
|
3791
3816
|
token: L,
|
|
3792
3817
|
spaceId: C.spaceId,
|
|
3793
|
-
backendType:
|
|
3794
|
-
sessionIdentityHash:
|
|
3795
|
-
parameters:
|
|
3796
|
-
} } :
|
|
3797
|
-
host:
|
|
3798
|
-
httpsPort:
|
|
3818
|
+
backendType: ee(),
|
|
3819
|
+
sessionIdentityHash: R.sessionIdentityHash,
|
|
3820
|
+
parameters: z
|
|
3821
|
+
} } : oe() ? null : { local: {
|
|
3822
|
+
host: Je,
|
|
3823
|
+
httpsPort: Ye,
|
|
3799
3824
|
spaceId: C?.spaceId,
|
|
3800
3825
|
backendUrl: C?.backendUrl,
|
|
3801
3826
|
authUrl: C?.authUrl,
|
|
3802
|
-
parameters:
|
|
3827
|
+
parameters: z
|
|
3803
3828
|
} };
|
|
3804
3829
|
}, [
|
|
3805
3830
|
se,
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3831
|
+
V,
|
|
3832
|
+
Je,
|
|
3833
|
+
Ye,
|
|
3834
|
+
B?.token,
|
|
3810
3835
|
C?.spaceId,
|
|
3811
3836
|
C?.backendUrl,
|
|
3812
3837
|
C?.authUrl,
|
|
3813
3838
|
L,
|
|
3814
|
-
|
|
3839
|
+
Xe,
|
|
3815
3840
|
ze,
|
|
3816
|
-
|
|
3817
|
-
|
|
3841
|
+
R.sessionIdentityHash,
|
|
3842
|
+
z
|
|
3818
3843
|
]);
|
|
3819
|
-
|
|
3820
|
-
let
|
|
3844
|
+
xe.current = C?.spaceId ?? "local", P.current = B?.token ?? L ?? void 0, mn(Ie);
|
|
3845
|
+
let Ze = gn(Ie);
|
|
3821
3846
|
k(() => {
|
|
3822
3847
|
if (!de.current) {
|
|
3823
|
-
if (de.current = !0, E.current =
|
|
3848
|
+
if (de.current = !0, E.current = $t(), r) for (let e of r) e(E.current);
|
|
3824
3849
|
E.current.loadRegisteredModules().catch((e) => {
|
|
3825
|
-
|
|
3850
|
+
ji.error("Failed to load UI modules", e);
|
|
3826
3851
|
});
|
|
3827
3852
|
}
|
|
3828
3853
|
}, []), k(() => {
|
|
3829
|
-
if (!
|
|
3854
|
+
if (!H) return;
|
|
3830
3855
|
let e = new u({
|
|
3831
|
-
...
|
|
3856
|
+
...H,
|
|
3832
3857
|
timeouts: me.current,
|
|
3833
|
-
audio:
|
|
3834
|
-
enabled:
|
|
3858
|
+
audio: ge.current !== void 0 || pe.current ? {
|
|
3859
|
+
enabled: ge.current,
|
|
3835
3860
|
...pe.current ? { background: {
|
|
3836
3861
|
allowOnDesktop: !0,
|
|
3837
3862
|
allowOnMobile: !0
|
|
3838
3863
|
} } : {}
|
|
3839
3864
|
} : void 0,
|
|
3840
|
-
video:
|
|
3865
|
+
video: _e.current === void 0 ? void 0 : { enabled: _e.current },
|
|
3841
3866
|
mediaSession: {
|
|
3842
3867
|
title: document.title || void 0,
|
|
3843
3868
|
artist: document.title || void 0
|
|
3844
3869
|
},
|
|
3845
3870
|
webRtc: he.current === !1 ? { enabled: !1 } : void 0,
|
|
3846
|
-
websocket:
|
|
3871
|
+
websocket: D.current,
|
|
3847
3872
|
webtransport: ve.current,
|
|
3848
|
-
proxy:
|
|
3873
|
+
proxy: ye.current,
|
|
3849
3874
|
onConnectionStateChange: (e) => {
|
|
3850
|
-
|
|
3875
|
+
Se(e);
|
|
3851
3876
|
},
|
|
3852
3877
|
onError: (e) => {
|
|
3853
3878
|
De(e.message);
|
|
3854
3879
|
}
|
|
3855
3880
|
});
|
|
3856
3881
|
T.current = e;
|
|
3857
|
-
let n =
|
|
3882
|
+
let n = be.current ?? !0, r = P.current, i = r ? ne(r) ?? null : null, a = n && i ? {
|
|
3858
3883
|
enabled: !0,
|
|
3859
|
-
appId:
|
|
3884
|
+
appId: xe.current,
|
|
3860
3885
|
userId: i
|
|
3861
|
-
} : void 0, l =
|
|
3886
|
+
} : void 0, l = B != null && B.provider !== "anonymous", d = Ke && (l || fr()), f = new Ue({
|
|
3862
3887
|
client: e,
|
|
3863
3888
|
liveSnapshot: a,
|
|
3864
|
-
bootSnapshot:
|
|
3889
|
+
bootSnapshot: Ai(N.current, d)
|
|
3865
3890
|
});
|
|
3866
|
-
|
|
3867
|
-
let _ =
|
|
3868
|
-
Te(!0),
|
|
3891
|
+
ce.current = f, Le(f), Te(!1);
|
|
3892
|
+
let _ = f.subscribeToUiUpdates(() => {
|
|
3893
|
+
Te(!0), ue();
|
|
3869
3894
|
});
|
|
3870
3895
|
return e.connect().catch((e) => {
|
|
3871
|
-
if (
|
|
3896
|
+
if (ji.error("Connection failed:", e), e instanceof o) {
|
|
3872
3897
|
ke(e.reason);
|
|
3873
3898
|
return;
|
|
3874
3899
|
}
|
|
3875
|
-
if (e instanceof
|
|
3900
|
+
if (e instanceof m) {
|
|
3876
3901
|
je(!0);
|
|
3877
3902
|
return;
|
|
3878
3903
|
}
|
|
3879
|
-
if (e instanceof
|
|
3904
|
+
if (e instanceof g) {
|
|
3880
3905
|
Ne(!0);
|
|
3881
3906
|
return;
|
|
3882
3907
|
}
|
|
3883
|
-
if (!(e instanceof
|
|
3908
|
+
if (!(e instanceof h)) {
|
|
3884
3909
|
if (e instanceof s) {
|
|
3885
3910
|
Fe(!0);
|
|
3886
3911
|
return;
|
|
3887
3912
|
}
|
|
3888
|
-
e instanceof
|
|
3913
|
+
e instanceof p || e instanceof c && !fe.current && (fe.current = !0, ji.warn("Auth session appears stale, clearing and retrying"), t.clearAll(), w ? w.logout() : (pr(), We((e) => e + 1)));
|
|
3889
3914
|
}
|
|
3890
3915
|
}), () => {
|
|
3891
|
-
_(), e.disconnect(), T.current = null,
|
|
3916
|
+
_(), e.disconnect(), T.current = null, f.dispose(), ce.current = null;
|
|
3892
3917
|
};
|
|
3893
|
-
}, [
|
|
3894
|
-
let
|
|
3918
|
+
}, [H]);
|
|
3919
|
+
let Qe = O((e, t) => {
|
|
3895
3920
|
let n = typeof t == "string" ? t : JSON.stringify(t ?? {});
|
|
3896
3921
|
T.current?.sendActionCall(e, n);
|
|
3897
3922
|
}, []);
|
|
3898
3923
|
k(() => {
|
|
3899
|
-
if (
|
|
3924
|
+
if (F !== "connecting") {
|
|
3900
3925
|
Ce(!1);
|
|
3901
3926
|
return;
|
|
3902
3927
|
}
|
|
3903
3928
|
let e = T.current?.slowConnectionThresholdMs ?? 5e3, t = setTimeout(() => Ce(!0), e);
|
|
3904
3929
|
return () => clearTimeout(t);
|
|
3905
|
-
}, [
|
|
3906
|
-
let
|
|
3930
|
+
}, [F]);
|
|
3931
|
+
let $e = F === "connected" || F === "reconnecting", et = we && F !== "offline";
|
|
3907
3932
|
return k(() => {
|
|
3908
|
-
typeof document > "u" || (document.documentElement.dataset.ikonLive = String(
|
|
3909
|
-
}, [
|
|
3910
|
-
connectionState:
|
|
3933
|
+
typeof document > "u" || (document.documentElement.dataset.ikonLive = String(et));
|
|
3934
|
+
}, [et]), {
|
|
3935
|
+
connectionState: F,
|
|
3911
3936
|
error: Ee,
|
|
3912
3937
|
accessDeniedReason: Oe,
|
|
3913
3938
|
isServerFull: Ae,
|
|
3914
3939
|
isSessionExpired: Me,
|
|
3915
3940
|
isStartupFailed: Pe,
|
|
3916
|
-
stores:
|
|
3941
|
+
stores: Ze,
|
|
3917
3942
|
client: T.current,
|
|
3918
3943
|
registry: E.current,
|
|
3919
3944
|
clientRef: T,
|
|
3920
|
-
uiRef:
|
|
3945
|
+
uiRef: ce,
|
|
3921
3946
|
registryRef: E,
|
|
3922
|
-
onAction:
|
|
3923
|
-
isReady:
|
|
3924
|
-
isLive:
|
|
3947
|
+
onAction: Qe,
|
|
3948
|
+
isReady: $e,
|
|
3949
|
+
isLive: et,
|
|
3925
3950
|
brandingRequired: T.current?.brandingRequired ?? !1,
|
|
3926
|
-
isConnectingSlow:
|
|
3951
|
+
isConnectingSlow: I,
|
|
3927
3952
|
webRtcVideoStreams: T.current?.webRtcVideoStreams ?? /* @__PURE__ */ new Map(),
|
|
3928
3953
|
webRtcTrackMap: T.current?.webRtcTrackMap ?? /* @__PURE__ */ new Map()
|
|
3929
3954
|
};
|
|
3930
3955
|
}
|
|
3931
3956
|
//#endregion
|
|
3932
3957
|
//#region src/hooks/use-toasts.ts
|
|
3933
|
-
var
|
|
3934
|
-
function
|
|
3958
|
+
var Ii = 0;
|
|
3959
|
+
function Li(e = 5, t = 5e3) {
|
|
3935
3960
|
let [n, r] = M([]), i = j(/* @__PURE__ */ new Map()), a = O((e) => {
|
|
3936
3961
|
let t = i.current.get(e);
|
|
3937
3962
|
t && (clearTimeout(t), i.current.delete(e)), r((t) => t.filter((t) => t.id !== e));
|
|
3938
3963
|
}, []);
|
|
3939
3964
|
return k(() => {
|
|
3940
|
-
let n = i.current, o =
|
|
3941
|
-
if (!
|
|
3942
|
-
let o = `toast-${++
|
|
3965
|
+
let n = i.current, o = me((i) => {
|
|
3966
|
+
if (!se()) return;
|
|
3967
|
+
let o = `toast-${++Ii}`, s = {
|
|
3943
3968
|
id: o,
|
|
3944
3969
|
level: i.level === d.ERROR ? "error" : "warn",
|
|
3945
3970
|
message: i.message,
|
|
@@ -3967,7 +3992,7 @@ function ji(e = 5, t = 5e3) {
|
|
|
3967
3992
|
}
|
|
3968
3993
|
//#endregion
|
|
3969
3994
|
//#region src/hooks/use-ikon-reactive.ts
|
|
3970
|
-
function
|
|
3995
|
+
function Ri(e, t, n) {
|
|
3971
3996
|
let [r, i] = M(n);
|
|
3972
3997
|
return k(() => {
|
|
3973
3998
|
if (!e) return;
|
|
@@ -3985,7 +4010,7 @@ function Mi(e, t, n) {
|
|
|
3985
4010
|
}
|
|
3986
4011
|
//#endregion
|
|
3987
4012
|
//#region src/hooks/use-reactive.ts
|
|
3988
|
-
function
|
|
4013
|
+
function zi(e, t, n) {
|
|
3989
4014
|
let [r, i] = M(null);
|
|
3990
4015
|
return k(() => {
|
|
3991
4016
|
if (!e) return;
|
|
@@ -3997,48 +4022,48 @@ function Ni(e, t, n) {
|
|
|
3997
4022
|
}), () => {
|
|
3998
4023
|
n = !1;
|
|
3999
4024
|
};
|
|
4000
|
-
}, [e, t]),
|
|
4025
|
+
}, [e, t]), Ri(r ? e : null, r ?? "", n);
|
|
4001
4026
|
}
|
|
4002
4027
|
//#endregion
|
|
4003
4028
|
//#region src/app/use-ikon-debug.ts
|
|
4004
|
-
var
|
|
4029
|
+
var Bi = b("IkonDebug"), Vi = {
|
|
4005
4030
|
Digit1: "connecting",
|
|
4006
4031
|
Digit2: "connected",
|
|
4007
4032
|
Digit3: "reconnecting",
|
|
4008
4033
|
Digit4: "offline",
|
|
4009
4034
|
Digit5: "offline",
|
|
4010
4035
|
Digit0: "clear"
|
|
4011
|
-
},
|
|
4012
|
-
function
|
|
4013
|
-
let t =
|
|
4036
|
+
}, Hi = "Digit5", Ui = "Digit6", Wi = "Synthetic debug error (Ctrl+Shift+5)", Gi = "Synthetic debug access-denied (Ctrl+Shift+6)", Ki = 5e3;
|
|
4037
|
+
function qi(e) {
|
|
4038
|
+
let t = se(), [n, r] = M(null), [i, a] = M(!1), [o, s] = M(null), [c, l] = M(null), [u, d] = M(!1), [f, p] = M(!1), [m, h] = M(!1);
|
|
4014
4039
|
return k(() => {
|
|
4015
4040
|
if (!t) return;
|
|
4016
4041
|
let e = (e) => {
|
|
4017
4042
|
if (!e.ctrlKey || !e.shiftKey) return;
|
|
4018
4043
|
if (e.code === "KeyE") {
|
|
4019
|
-
e.preventDefault(), d((e) => (
|
|
4044
|
+
e.preventDefault(), d((e) => (Bi.warn(`Empty-stores override: ${e ? "off" : "on"}`), !e));
|
|
4020
4045
|
return;
|
|
4021
4046
|
}
|
|
4022
4047
|
if (e.code === "Digit7") {
|
|
4023
|
-
e.preventDefault(), p((e) => (
|
|
4048
|
+
e.preventDefault(), p((e) => (Bi.warn(`Branding-banner override: ${e ? "off" : "on"}`), !e));
|
|
4024
4049
|
return;
|
|
4025
4050
|
}
|
|
4026
4051
|
if (e.code === "Digit8") {
|
|
4027
|
-
e.preventDefault(), h((e) => (
|
|
4052
|
+
e.preventDefault(), h((e) => (Bi.warn(`Debug-overlay override: ${e ? "off" : "on"}`), !e));
|
|
4028
4053
|
return;
|
|
4029
4054
|
}
|
|
4030
|
-
if (e.code ===
|
|
4031
|
-
e.preventDefault(), l(
|
|
4055
|
+
if (e.code === Ui) {
|
|
4056
|
+
e.preventDefault(), l(Gi), r(null), s(null), Bi.warn("Forced access denied");
|
|
4032
4057
|
return;
|
|
4033
4058
|
}
|
|
4034
|
-
let t =
|
|
4059
|
+
let t = Vi[e.code];
|
|
4035
4060
|
if (t === void 0) return;
|
|
4036
4061
|
if (e.preventDefault(), t === "clear") {
|
|
4037
|
-
r(null), s(null), l(null),
|
|
4062
|
+
r(null), s(null), l(null), Bi.warn("Cleared forced state");
|
|
4038
4063
|
return;
|
|
4039
4064
|
}
|
|
4040
|
-
let n = e.code ===
|
|
4041
|
-
r(t), s(n ?
|
|
4065
|
+
let n = e.code === Hi;
|
|
4066
|
+
r(t), s(n ? Wi : null), l(null), Bi.warn(`Forced state: ${t}${n ? " (with error)" : ""}`);
|
|
4042
4067
|
};
|
|
4043
4068
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
4044
4069
|
}, [t]), k(() => {
|
|
@@ -4046,7 +4071,7 @@ function Vi(e) {
|
|
|
4046
4071
|
a(!1);
|
|
4047
4072
|
return;
|
|
4048
4073
|
}
|
|
4049
|
-
let e = setTimeout(() => a(!0),
|
|
4074
|
+
let e = setTimeout(() => a(!0), Ki);
|
|
4050
4075
|
return () => clearTimeout(e);
|
|
4051
4076
|
}, [n]), !t || n === null && !u && c === null && !f && !m ? {
|
|
4052
4077
|
app: e,
|
|
@@ -4077,64 +4102,64 @@ function Vi(e) {
|
|
|
4077
4102
|
}
|
|
4078
4103
|
//#endregion
|
|
4079
4104
|
//#region src/app/ikon-app.tsx
|
|
4080
|
-
function
|
|
4105
|
+
function Ji(e, t) {
|
|
4081
4106
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4082
4107
|
}
|
|
4083
|
-
function
|
|
4108
|
+
function Yi(e) {
|
|
4084
4109
|
return e === void 0 ? null : typeof e == "function" ? e() : e;
|
|
4085
4110
|
}
|
|
4086
|
-
function
|
|
4111
|
+
function Xi(e, t) {
|
|
4087
4112
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4088
4113
|
}
|
|
4089
|
-
function
|
|
4114
|
+
function Zi(e, t) {
|
|
4090
4115
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4091
4116
|
}
|
|
4092
|
-
function
|
|
4093
|
-
let { connectingOverlay: t, reconnectingOverlay: n, offlineOverlay: r, accessDeniedScreen: i, ...a } = e, o =
|
|
4117
|
+
function Qi(e) {
|
|
4118
|
+
let { connectingOverlay: t, reconnectingOverlay: n, offlineOverlay: r, accessDeniedScreen: i, ...a } = e, o = qi(a), { app: s } = o, { connectionState: c, isConnectingSlow: l, stores: u, registry: d, client: f, onAction: p, isReady: m, error: h, accessDeniedReason: g, brandingRequired: _ } = s, v = _ || o.forcedBranding, y = j(null);
|
|
4094
4119
|
u && d && (m || u.size > 0) && (y.current = {
|
|
4095
4120
|
stores: u,
|
|
4096
4121
|
registry: d,
|
|
4097
4122
|
client: f
|
|
4098
4123
|
});
|
|
4099
4124
|
let b = y.current != null || !!g;
|
|
4100
|
-
if (
|
|
4125
|
+
if (ye(() => {
|
|
4101
4126
|
!b || typeof document > "u" || document.querySelectorAll("[data-ikon-prerender]").forEach((e) => e.remove());
|
|
4102
|
-
}, [b]), g) return
|
|
4127
|
+
}, [b]), g) return Zi(i, g);
|
|
4103
4128
|
let x = y.current, S;
|
|
4104
4129
|
switch (c) {
|
|
4105
4130
|
case "waitingForExternalConnectUrl":
|
|
4106
4131
|
case "connecting":
|
|
4107
|
-
S =
|
|
4132
|
+
S = Ji(t, l);
|
|
4108
4133
|
break;
|
|
4109
4134
|
case "reconnecting":
|
|
4110
|
-
S =
|
|
4135
|
+
S = Yi(n);
|
|
4111
4136
|
break;
|
|
4112
4137
|
case "offline":
|
|
4113
|
-
S =
|
|
4138
|
+
S = Xi(r, h);
|
|
4114
4139
|
break;
|
|
4115
4140
|
default: S = null;
|
|
4116
4141
|
}
|
|
4117
|
-
return /* @__PURE__ */ F(
|
|
4118
|
-
x && /* @__PURE__ */ P(
|
|
4142
|
+
return /* @__PURE__ */ F(xe, { children: [
|
|
4143
|
+
x && /* @__PURE__ */ P(He, {
|
|
4119
4144
|
stores: x.stores,
|
|
4120
4145
|
registry: x.registry,
|
|
4121
4146
|
client: x.client,
|
|
4122
4147
|
onAction: p
|
|
4123
4148
|
}),
|
|
4124
4149
|
S,
|
|
4125
|
-
v && /* @__PURE__ */ P(
|
|
4126
|
-
/* @__PURE__ */ P(
|
|
4127
|
-
/* @__PURE__ */ P(
|
|
4150
|
+
v && /* @__PURE__ */ P(ea, {}),
|
|
4151
|
+
/* @__PURE__ */ P(ta, {}),
|
|
4152
|
+
/* @__PURE__ */ P(Oi, {
|
|
4128
4153
|
state: c,
|
|
4129
4154
|
forceVisible: o.forcedDebugOverlay
|
|
4130
4155
|
})
|
|
4131
4156
|
] });
|
|
4132
4157
|
}
|
|
4133
|
-
var
|
|
4134
|
-
function
|
|
4158
|
+
var $i = "https://ikonai.com";
|
|
4159
|
+
function ea() {
|
|
4135
4160
|
return /* @__PURE__ */ F("a", {
|
|
4136
4161
|
className: "ikon-branding-banner",
|
|
4137
|
-
href:
|
|
4162
|
+
href: $i,
|
|
4138
4163
|
target: "_blank",
|
|
4139
4164
|
rel: "noopener noreferrer",
|
|
4140
4165
|
style: {
|
|
@@ -4164,17 +4189,17 @@ function Ji() {
|
|
|
4164
4189
|
})]
|
|
4165
4190
|
});
|
|
4166
4191
|
}
|
|
4167
|
-
function
|
|
4168
|
-
let { toasts: e, dismissToast: t } =
|
|
4192
|
+
function ta() {
|
|
4193
|
+
let { toasts: e, dismissToast: t } = Li();
|
|
4169
4194
|
return e.length === 0 ? null : /* @__PURE__ */ P("div", {
|
|
4170
4195
|
className: "ikon-toast-overlay",
|
|
4171
|
-
children: e.map((e) => /* @__PURE__ */ P(
|
|
4196
|
+
children: e.map((e) => /* @__PURE__ */ P(na, {
|
|
4172
4197
|
toast: e,
|
|
4173
4198
|
onDismiss: t
|
|
4174
4199
|
}, e.id))
|
|
4175
4200
|
});
|
|
4176
4201
|
}
|
|
4177
|
-
function
|
|
4202
|
+
function na({ toast: e, onDismiss: t }) {
|
|
4178
4203
|
return /* @__PURE__ */ F("div", {
|
|
4179
4204
|
className: `ikon-toast-overlay-chip ikon-toast-overlay-chip--${e.level}`,
|
|
4180
4205
|
onClick: () => t(e.id),
|
|
@@ -4200,37 +4225,37 @@ function Xi({ toast: e, onDismiss: t }) {
|
|
|
4200
4225
|
}
|
|
4201
4226
|
//#endregion
|
|
4202
4227
|
//#region src/i18n/i18n.tsx
|
|
4203
|
-
var
|
|
4204
|
-
function
|
|
4228
|
+
var ra = _e(null);
|
|
4229
|
+
function ia(e, t) {
|
|
4205
4230
|
return t ? e.replace(/\{(\w+)\}/g, (e, n) => t[n] ?? `{${n}}`) : e;
|
|
4206
4231
|
}
|
|
4207
|
-
function
|
|
4208
|
-
let n =
|
|
4232
|
+
function aa(e, t) {
|
|
4233
|
+
let n = ie();
|
|
4209
4234
|
if (n && e.includes(n)) return n;
|
|
4210
4235
|
let r = navigator.language.split("-")[0];
|
|
4211
4236
|
return e.includes(r) ? r : t && e.includes(t) ? t : "en";
|
|
4212
4237
|
}
|
|
4213
|
-
function
|
|
4214
|
-
return t ?
|
|
4238
|
+
function oa(e, t, n) {
|
|
4239
|
+
return t ? aa(e, n) : n && e.includes(n) ? n : "en";
|
|
4215
4240
|
}
|
|
4216
|
-
function
|
|
4217
|
-
let i =
|
|
4241
|
+
function sa({ children: e, translations: t, defaultLanguage: n, detectLanguage: r = !1 }) {
|
|
4242
|
+
let i = oa(Object.keys(t), r, n), a = t[i] ?? t.en, o = A(() => ({
|
|
4218
4243
|
t: (e, t) => {
|
|
4219
4244
|
let n = a[e];
|
|
4220
|
-
return
|
|
4245
|
+
return ia(n, t);
|
|
4221
4246
|
},
|
|
4222
4247
|
locale: i,
|
|
4223
4248
|
translations: a
|
|
4224
4249
|
}), [a, i]);
|
|
4225
|
-
return /* @__PURE__ */ P(
|
|
4250
|
+
return /* @__PURE__ */ P(ra, {
|
|
4226
4251
|
value: o,
|
|
4227
4252
|
children: e
|
|
4228
4253
|
});
|
|
4229
4254
|
}
|
|
4230
|
-
function
|
|
4231
|
-
let e =
|
|
4255
|
+
function ca() {
|
|
4256
|
+
let e = ve(ra);
|
|
4232
4257
|
if (!e) throw Error("useI18n must be used within an I18nProvider");
|
|
4233
4258
|
return e;
|
|
4234
4259
|
}
|
|
4235
4260
|
//#endregion
|
|
4236
|
-
export {
|
|
4261
|
+
export { ni as AuthProvider, ki as ConnectionStateRenderer, vi as DEBUG_OVERLAY_ENABLED, Oi as DebugOverlay, sa as I18nProvider, lt as IKON_UI_BASE_MODULE, At as IKON_UI_MEDIA_MODULE, Jt as IKON_UI_SHADERTOY_MODULE, Kt as IKON_UI_SHADERTOY_TYPE, Be as IKON_UI_STREAM_CATEGORY, wt as IKON_UI_VIDEO_CANVAS_TYPE, Tt as IKON_UI_VIDEO_URL_PLAYER_TYPE, Qi as IkonApp, Ue as IkonUi, Qt as IkonUiRegistry, He as IkonUiSurface, Re as InspectOverlay, rn as ParallaxView, Ie as UiComponentRegistry, Fe as UiRenderer, n as UiStreamStore, xr as authenticateAnonymous, Nr as buildOAuthRedirectUrl, pr as clearAuthSession, Mr as clearOAuthParams, ct as createBaseResolvers, Le as createComponentLibrary, $t as createIkonUiRegistry, Dt as createMediaResolvers, qt as createShadertoyRendererResolver, Ve as isIkonUiCategoryMatch, or as loadAuthSession, ut as loadBaseModule, jt as loadMediaModule, Yt as loadShadertoyModule, wr as parseOAuthCallback, Or as parseOAuthError, E as randomUuid, dt as registerBaseModule, Mt as registerMediaModule, Xt as registerShadertoyModule, Ne as renderChildren, Sn as renderMotionLetters, K as saveAuthSession, Sr as sendLoginCode, q as sessionToUser, ri as useAuth, _i as useAuthGuard, ii as useAuthOptional, ca as useI18n, Fi as useIkonApp, qi as useIkonDebug, Ri as useIkonReactive, mn as useIkonStyles, gn as useIkonUiStores, zi as useReactive, Li as useToasts, I as useUiNode, L as useUiStore, Cr as verifyLoginCode };
|