@ikonai/sdk-react-ui 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth/auth-service.d.ts +9 -0
- package/index.js +771 -750
- package/package.json +1 -1
- package/theme/ikon-app.css +259 -250
- package/theme/ikon-auth.css +290 -271
- package/theme/ikon-surface.css +107 -94
- package/theme/ikon-tokens.css +97 -95
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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,
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { AccessDeniedError as o, AppStartupFailedError as s, AuthenticationError as c, DEFAULT_LOCAL_SERVER_HOST as l, DEFAULT_LOCAL_SERVER_PORT as u, DEFAULT_SLOW_CONNECTION_THRESHOLD_MS as d, IKON_INSPECT_MODE_CHANGED_EVENT as f, IKON_PARAM_OAUTH_CODE as p, IKON_PARAM_OAUTH_PKCE as m, IKON_PARAM_OAUTH_PROVIDER as h, IKON_PARAM_OAUTH_TOKEN as g, IkonClient as _, LogLevel as v, ProvisioningTimeoutError as y, ServerFullError as ee, ServerUnavailableError as te, SessionNotFoundError as b, abortSignalTimeout as x, adoptPkceVerifierFromUrl as ne, clearLoginPrompt as re, createLogger as S, createPkceChallenge as ie, deriveAuthUrl as C, deriveBackendType as ae, deriveCrossOriginAuthUrl as oe, extractUserIdFromToken as se, getDebugOverlayParam as w, getLangParam as ce, getLoginPromptState as T, getOrCreateDeviceId as le, getSameOriginAuthUrl as E, getSignedOutParam as ue, getUrlWithoutSession as de, isCloudEnvironment as fe, isDebugModeEnabled as pe, isEmbedded as me, isInspectModeEnabled as he, onEmbeddedOAuthResult as ge, parseUrlParams as _e, randomUuid as ve, reportConnectTimeline as ye, restorePkceVerifier as be, setLoginPromptRequired as xe, startEmbeddedOAuthSignIn as Se, subscribeLoginPrompt as Ce, subscribeToLogEvents as we, takePkceVerifier as Te } from "@ikonai/sdk";
|
|
3
|
+
import { Fragment as Ee, createContext as De, memo as D, use as Oe, useCallback as O, useEffect as k, useLayoutEffect as A, useMemo as j, useReducer as ke, useRef as M, useState as N, useSyncExternalStore as Ae } from "react";
|
|
4
|
+
import { Fragment as je, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
5
5
|
//#region src/renderer/use-root-view.ts
|
|
6
|
-
function
|
|
7
|
-
let n =
|
|
6
|
+
function Me(e, t) {
|
|
7
|
+
let n = Ae((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 ?? ""}`;
|
|
10
10
|
}, () => {
|
|
@@ -22,7 +22,7 @@ function ke(e, t) {
|
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/renderer/use-ui-node.ts
|
|
24
24
|
function I(e, t) {
|
|
25
|
-
let n =
|
|
25
|
+
let n = Ae((n) => e.subscribeNode(t, n), () => e.getNodeVersion(t), () => e.getNodeVersion(t));
|
|
26
26
|
return j(() => e.getNode(t), [
|
|
27
27
|
e,
|
|
28
28
|
t,
|
|
@@ -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 Ne = S("UIRenderer");
|
|
35
|
+
function Pe(e) {
|
|
36
36
|
if (e === void 0) return "{}";
|
|
37
37
|
if (typeof e == "string") return e;
|
|
38
38
|
try {
|
|
@@ -41,33 +41,35 @@ function je(e) {
|
|
|
41
41
|
return "{}";
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Fe(e) {
|
|
45
45
|
let t = e.styleIds;
|
|
46
46
|
return Array.isArray(t) ? t : [];
|
|
47
47
|
}
|
|
48
|
-
var
|
|
49
|
-
function
|
|
48
|
+
var Ie = 1500, Le = 8e3;
|
|
49
|
+
function Re(e) {
|
|
50
50
|
let [t, n] = N(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] = N(!1), o = I(n.store, t),
|
|
55
|
+
function ze({ nodeType: e, nodeId: t, context: n, className: r }) {
|
|
56
|
+
let [i, a] = N(!1), [o, s] = N(!1), c = I(n.store, t), l = Re(n.library), u = j(() => c ? n.library.resolve(c) : void 0, [
|
|
57
57
|
n.library,
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
c,
|
|
59
|
+
l
|
|
60
60
|
]);
|
|
61
61
|
return k(() => {
|
|
62
|
-
let e = setTimeout(() => a(!0),
|
|
63
|
-
return () =>
|
|
62
|
+
let e = setTimeout(() => a(!0), Ie), t = setTimeout(() => s(!0), Le);
|
|
63
|
+
return () => {
|
|
64
|
+
clearTimeout(e), clearTimeout(t);
|
|
65
|
+
};
|
|
64
66
|
}, [e]), k(() => {
|
|
65
|
-
!
|
|
67
|
+
!o || u || Ne.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
68
|
}, [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
o,
|
|
70
|
+
u,
|
|
69
71
|
e
|
|
70
|
-
]),
|
|
72
|
+
]), u ? /* @__PURE__ */ P(u, {
|
|
71
73
|
nodeId: t,
|
|
72
74
|
context: n,
|
|
73
75
|
className: r
|
|
@@ -87,50 +89,50 @@ function Fe({ nodeType: e, nodeId: t, context: n, className: r }) {
|
|
|
87
89
|
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
90
|
}) : null;
|
|
89
91
|
}
|
|
90
|
-
function
|
|
92
|
+
function Be(e) {
|
|
91
93
|
let t = e.children;
|
|
92
94
|
return Array.isArray(t) ? t : [];
|
|
93
95
|
}
|
|
94
|
-
function
|
|
96
|
+
function Ve(e, t) {
|
|
95
97
|
return e.nodeId === t.nodeId && e.context === t.context;
|
|
96
98
|
}
|
|
97
|
-
function
|
|
99
|
+
function He(e) {
|
|
98
100
|
if (e.length === 0) return "";
|
|
99
101
|
if (e.length === 1) return e[0].id;
|
|
100
102
|
let t = e[0].id;
|
|
101
103
|
for (let n = 1; n < e.length; n++) t += "," + e[n].id;
|
|
102
104
|
return t;
|
|
103
105
|
}
|
|
104
|
-
var
|
|
105
|
-
let r = I(n.store, t), i = r ?
|
|
106
|
+
var L = D(function e({ nodeId: t, context: n }) {
|
|
107
|
+
let r = I(n.store, t), i = r ? Be(r) : [], a = He(i), o = j(() => i.length === 0 ? null : i.map((t) => /* @__PURE__ */ P(e, {
|
|
106
108
|
nodeId: t.id,
|
|
107
109
|
context: n
|
|
108
110
|
}, t.id)), [a, n]);
|
|
109
111
|
if (!r) return null;
|
|
110
|
-
if (r.type === "root") return /* @__PURE__ */ P(
|
|
111
|
-
let s =
|
|
112
|
+
if (r.type === "root") return /* @__PURE__ */ P(Ee, { children: o }, r.id);
|
|
113
|
+
let s = Fe(r), c = s.length > 0 ? s.join(" ") : void 0, l = n.library.resolve(r);
|
|
112
114
|
return l ? /* @__PURE__ */ P(l, {
|
|
113
115
|
nodeId: t,
|
|
114
116
|
context: n,
|
|
115
117
|
className: c
|
|
116
|
-
}) : /* @__PURE__ */ P(
|
|
118
|
+
}) : /* @__PURE__ */ P(ze, {
|
|
117
119
|
nodeType: r.type,
|
|
118
120
|
nodeId: r.id,
|
|
119
121
|
context: n,
|
|
120
122
|
className: c
|
|
121
123
|
});
|
|
122
|
-
},
|
|
123
|
-
function
|
|
124
|
-
return !Array.isArray(e) || e.length === 0 ? null : e.map((e) => /* @__PURE__ */ P(
|
|
124
|
+
}, Ve);
|
|
125
|
+
function Ue(e, t) {
|
|
126
|
+
return !Array.isArray(e) || e.length === 0 ? null : e.map((e) => /* @__PURE__ */ P(L, {
|
|
125
127
|
nodeId: e.id,
|
|
126
128
|
context: t
|
|
127
129
|
}, e.id));
|
|
128
130
|
}
|
|
129
|
-
function
|
|
131
|
+
function We(e, t) {
|
|
130
132
|
return e.store === t.store && e.library === t.library && e.viewId === t.viewId && e.emptyFallback === t.emptyFallback;
|
|
131
133
|
}
|
|
132
|
-
var
|
|
133
|
-
let { rootViewId: s, rootNodeId: c } =
|
|
134
|
+
var Ge = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null, onAction: i, client: a, video: o }) {
|
|
135
|
+
let { rootViewId: s, rootNodeId: c } = Me(e, n), l = M(i);
|
|
134
136
|
l.current = i;
|
|
135
137
|
let u = M(a);
|
|
136
138
|
u.current = a;
|
|
@@ -138,7 +140,7 @@ var Ve = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
138
140
|
d.current = o;
|
|
139
141
|
let f = O((e, t) => {
|
|
140
142
|
if (!e) return;
|
|
141
|
-
let n =
|
|
143
|
+
let n = Pe(t);
|
|
142
144
|
l.current?.(e, n);
|
|
143
145
|
}, []), p = j(() => {
|
|
144
146
|
let n = {
|
|
@@ -146,10 +148,10 @@ var Ve = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
146
148
|
library: t,
|
|
147
149
|
handlerCache: e.handlerCache,
|
|
148
150
|
getPayload: (t) => e.getSnapshot().payloads.get(t),
|
|
149
|
-
renderChildren: (e) =>
|
|
151
|
+
renderChildren: (e) => Ue(e, n),
|
|
150
152
|
renderView: (t) => {
|
|
151
153
|
let r = e.getSnapshot().views.get(t);
|
|
152
|
-
return r ? /* @__PURE__ */ P(
|
|
154
|
+
return r ? /* @__PURE__ */ P(L, {
|
|
153
155
|
nodeId: r.id,
|
|
154
156
|
context: n
|
|
155
157
|
}) : null;
|
|
@@ -171,12 +173,12 @@ var Ve = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
171
173
|
return !s || !c ? r : /* @__PURE__ */ P("div", {
|
|
172
174
|
"data-ikon-view-id": s,
|
|
173
175
|
style: { display: "contents" },
|
|
174
|
-
children: /* @__PURE__ */ P(
|
|
176
|
+
children: /* @__PURE__ */ P(L, {
|
|
175
177
|
nodeId: c,
|
|
176
178
|
context: p
|
|
177
179
|
})
|
|
178
180
|
});
|
|
179
|
-
},
|
|
181
|
+
}, We), Ke = class {
|
|
180
182
|
fallback;
|
|
181
183
|
renderers = /* @__PURE__ */ new Map();
|
|
182
184
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -201,27 +203,27 @@ var Ve = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
201
203
|
for (let e of this.listeners) e();
|
|
202
204
|
}
|
|
203
205
|
};
|
|
204
|
-
function
|
|
205
|
-
return new
|
|
206
|
+
function qe(e, t) {
|
|
207
|
+
return new Ke(Object.entries(e), t);
|
|
206
208
|
}
|
|
207
209
|
//#endregion
|
|
208
210
|
//#region src/renderer/use-ui-store.ts
|
|
209
|
-
function
|
|
210
|
-
return
|
|
211
|
+
function Je(e) {
|
|
212
|
+
return Ae((t) => e.subscribe(t), () => e.getSnapshot(), () => e.getSnapshot());
|
|
211
213
|
}
|
|
212
214
|
//#endregion
|
|
213
215
|
//#region src/inspect/inspect-overlay.tsx
|
|
214
|
-
function
|
|
215
|
-
let [e, t] = N(
|
|
216
|
+
function Ye() {
|
|
217
|
+
let [e, t] = N(he), n = M(!1);
|
|
216
218
|
return k(() => {
|
|
217
219
|
if (e) return;
|
|
218
220
|
let r = () => {
|
|
219
|
-
|
|
221
|
+
he() && t(!0);
|
|
220
222
|
}, i = (e) => {
|
|
221
223
|
e.data?.type === "ikon-inspect-mode" && e.data.enabled && (n.current = !0, t(!0));
|
|
222
224
|
};
|
|
223
|
-
return window.addEventListener(
|
|
224
|
-
window.removeEventListener(
|
|
225
|
+
return window.addEventListener(f, r), window.addEventListener("message", i), () => {
|
|
226
|
+
window.removeEventListener(f, r), window.removeEventListener("message", i);
|
|
225
227
|
};
|
|
226
228
|
}, [e]), k(() => {
|
|
227
229
|
if (!e) return;
|
|
@@ -351,11 +353,11 @@ function Ge() {
|
|
|
351
353
|
}
|
|
352
354
|
//#endregion
|
|
353
355
|
//#region src/surface.tsx
|
|
354
|
-
var
|
|
355
|
-
function
|
|
356
|
+
var Xe = S("IkonUiSurface"), R = "ikon-ui";
|
|
357
|
+
function Ze(e, t) {
|
|
356
358
|
return e === t;
|
|
357
359
|
}
|
|
358
|
-
var
|
|
360
|
+
var z = D(function({ stores: e, registry: t, category: n = R, onAction: r, client: i }) {
|
|
359
361
|
let a = j(() => Array.from(e.keys()).sort().join(","), [e]), o = M(r);
|
|
360
362
|
o.current = r;
|
|
361
363
|
let s = M(i);
|
|
@@ -364,7 +366,7 @@ var Je = D(function({ stores: e, registry: t, category: n = qe, onAction: r, cli
|
|
|
364
366
|
let t = [];
|
|
365
367
|
for (let [r, i] of e) {
|
|
366
368
|
let e = i.store.getSnapshot();
|
|
367
|
-
|
|
369
|
+
Ze(i.category, n) && (!e.rootViewId || !e.views.has(e.rootViewId) || t.push({
|
|
368
370
|
key: r,
|
|
369
371
|
store: i.store
|
|
370
372
|
}));
|
|
@@ -376,15 +378,15 @@ var Je = D(function({ stores: e, registry: t, category: n = qe, onAction: r, cli
|
|
|
376
378
|
a
|
|
377
379
|
]), l = M(!1), u = c.length > 0;
|
|
378
380
|
return k(() => {
|
|
379
|
-
u && !l.current && (l.current = !0,
|
|
380
|
-
}, [u]), u ? /* @__PURE__ */ F(
|
|
381
|
+
u && !l.current && (l.current = !0, Xe.debug("First UI render"));
|
|
382
|
+
}, [u]), u ? /* @__PURE__ */ F(je, { children: [/* @__PURE__ */ P(Ye, {}), c.map(({ key: e, store: n }) => /* @__PURE__ */ P(Ge, {
|
|
381
383
|
store: n,
|
|
382
384
|
library: t,
|
|
383
385
|
onAction: o.current,
|
|
384
386
|
client: s.current,
|
|
385
387
|
video: s.current?.media?.video
|
|
386
388
|
}, e))] }) : null;
|
|
387
|
-
}),
|
|
389
|
+
}), Qe = class {
|
|
388
390
|
core;
|
|
389
391
|
ownsCore;
|
|
390
392
|
stores = /* @__PURE__ */ new Map();
|
|
@@ -456,7 +458,7 @@ var Je = D(function({ stores: e, registry: t, category: n = qe, onAction: r, cli
|
|
|
456
458
|
let t = this.stores.get(e);
|
|
457
459
|
if (t) return t;
|
|
458
460
|
let n = {
|
|
459
|
-
category:
|
|
461
|
+
category: R,
|
|
460
462
|
store: new r()
|
|
461
463
|
};
|
|
462
464
|
return this.stores.set(e, n), n;
|
|
@@ -476,13 +478,13 @@ var Je = D(function({ stores: e, registry: t, category: n = qe, onAction: r, cli
|
|
|
476
478
|
};
|
|
477
479
|
//#endregion
|
|
478
480
|
//#region src/base/base-div.tsx
|
|
479
|
-
function
|
|
481
|
+
function $e(e) {
|
|
480
482
|
if (typeof e == "string") {
|
|
481
483
|
let t = e.trim();
|
|
482
484
|
return t.length > 0 ? t : void 0;
|
|
483
485
|
}
|
|
484
486
|
}
|
|
485
|
-
function
|
|
487
|
+
function B(e) {
|
|
486
488
|
if (typeof e == "string") {
|
|
487
489
|
let t = e.trim();
|
|
488
490
|
return t.length > 0 ? t : void 0;
|
|
@@ -492,7 +494,7 @@ function z(e) {
|
|
|
492
494
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
493
495
|
}
|
|
494
496
|
}
|
|
495
|
-
function
|
|
497
|
+
function V(...e) {
|
|
496
498
|
let t = "";
|
|
497
499
|
for (let n of e) if (n) {
|
|
498
500
|
let e = n.trim();
|
|
@@ -500,8 +502,8 @@ function Ze(...e) {
|
|
|
500
502
|
}
|
|
501
503
|
return t || void 0;
|
|
502
504
|
}
|
|
503
|
-
var
|
|
504
|
-
function
|
|
505
|
+
var H = /* @__PURE__ */ new WeakMap(), et = {};
|
|
506
|
+
function tt(e) {
|
|
505
507
|
let t = {};
|
|
506
508
|
for (let n of e.split(";")) {
|
|
507
509
|
let e = n.indexOf(":");
|
|
@@ -513,28 +515,28 @@ function $e(e) {
|
|
|
513
515
|
}
|
|
514
516
|
return t;
|
|
515
517
|
}
|
|
516
|
-
function
|
|
518
|
+
function nt(e, t) {
|
|
517
519
|
let n = e && typeof e == "object" ? e : void 0;
|
|
518
520
|
return t ? {
|
|
519
521
|
...n ?? {},
|
|
520
522
|
cursor: t
|
|
521
523
|
} : n;
|
|
522
524
|
}
|
|
523
|
-
function
|
|
524
|
-
if (!e) return
|
|
525
|
-
let t =
|
|
525
|
+
function rt(e) {
|
|
526
|
+
if (!e) return et;
|
|
527
|
+
let t = H.get(e);
|
|
526
528
|
if (t) return t;
|
|
527
529
|
let n = {};
|
|
528
530
|
for (let [t, r] of Object.entries(e)) if (r != null) {
|
|
529
531
|
if (t === "style" && typeof r == "string") {
|
|
530
|
-
n[t] =
|
|
532
|
+
n[t] = tt(r);
|
|
531
533
|
continue;
|
|
532
534
|
}
|
|
533
535
|
(typeof r == "string" || typeof r == "number" || typeof r == "boolean") && (n[t] = r);
|
|
534
536
|
}
|
|
535
|
-
return
|
|
537
|
+
return H.set(e, n), n;
|
|
536
538
|
}
|
|
537
|
-
function
|
|
539
|
+
function U(e) {
|
|
538
540
|
let t = e.parentElement;
|
|
539
541
|
for (; t;) {
|
|
540
542
|
let e = window.getComputedStyle(t).overflowY;
|
|
@@ -543,18 +545,18 @@ function tt(e) {
|
|
|
543
545
|
}
|
|
544
546
|
return null;
|
|
545
547
|
}
|
|
546
|
-
var
|
|
547
|
-
function
|
|
548
|
+
var it = 1.5;
|
|
549
|
+
function at(e, t, n) {
|
|
548
550
|
requestAnimationFrame(() => {
|
|
549
|
-
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = e.scrollTop + (i.bottom - r.bottom) + 16, o = Math.abs(a - e.scrollTop), s = n ?? (o > e.clientHeight *
|
|
551
|
+
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = e.scrollTop + (i.bottom - r.bottom) + 16, o = Math.abs(a - e.scrollTop), s = n ?? (o > e.clientHeight * it ? "auto" : "smooth");
|
|
550
552
|
"scrollBehavior" in document.documentElement.style ? e.scrollTo({
|
|
551
553
|
top: a,
|
|
552
554
|
behavior: s
|
|
553
555
|
}) : e.scrollTop = a;
|
|
554
556
|
});
|
|
555
557
|
}
|
|
556
|
-
var
|
|
557
|
-
function
|
|
558
|
+
var ot = 3e3;
|
|
559
|
+
function st(e, t) {
|
|
558
560
|
if (typeof ResizeObserver > "u") return () => void 0;
|
|
559
561
|
let n = !1, r = () => {
|
|
560
562
|
n = !0;
|
|
@@ -562,32 +564,32 @@ function rt(e, t) {
|
|
|
562
564
|
e.addEventListener("wheel", r, i), e.addEventListener("touchmove", r, i), e.addEventListener("keydown", r, i);
|
|
563
565
|
let a = e.scrollHeight, o = new ResizeObserver(() => {
|
|
564
566
|
let r = e.scrollHeight > a;
|
|
565
|
-
a = e.scrollHeight, !(!r || n || !
|
|
567
|
+
a = e.scrollHeight, !(!r || n || !dt(e)) && at(e, t, "auto");
|
|
566
568
|
});
|
|
567
569
|
for (let t of Array.from(e.children)) o.observe(t);
|
|
568
|
-
let s = setTimeout(r,
|
|
570
|
+
let s = setTimeout(r, ot);
|
|
569
571
|
return () => {
|
|
570
572
|
clearTimeout(s), o.disconnect(), e.removeEventListener("wheel", r), e.removeEventListener("touchmove", r), e.removeEventListener("keydown", r);
|
|
571
573
|
};
|
|
572
574
|
}
|
|
573
|
-
var
|
|
574
|
-
function
|
|
575
|
-
return Math.max(e.clientHeight *
|
|
575
|
+
var W = "data-ikon-scroll-indicator", ct = .15, lt = "data-ikon-at-bottom";
|
|
576
|
+
function ut(e) {
|
|
577
|
+
return Math.max(e.clientHeight * ct, 20);
|
|
576
578
|
}
|
|
577
|
-
function
|
|
578
|
-
return e.getAttribute(
|
|
579
|
+
function dt(e) {
|
|
580
|
+
return e.getAttribute(lt) !== "false";
|
|
579
581
|
}
|
|
580
|
-
function
|
|
581
|
-
e.getAttribute(
|
|
582
|
-
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e, i = n - t - r <=
|
|
583
|
-
e.setAttribute(
|
|
582
|
+
function ft(e) {
|
|
583
|
+
e.getAttribute(lt) === null && (e.setAttribute(lt, "true"), e.addEventListener("scroll", () => {
|
|
584
|
+
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e, i = n - t - r <= ut(e);
|
|
585
|
+
e.setAttribute(lt, i ? "true" : "false");
|
|
584
586
|
}, { passive: !0 }));
|
|
585
587
|
}
|
|
586
|
-
function
|
|
587
|
-
let t = e.parentElement ?? e, n = t.querySelector(`[${
|
|
588
|
+
function pt(e) {
|
|
589
|
+
let t = e.parentElement ?? e, n = t.querySelector(`[${W}]`);
|
|
588
590
|
if (n) return n;
|
|
589
591
|
let r = document.createElement("button");
|
|
590
|
-
return r.setAttribute(
|
|
592
|
+
return r.setAttribute(W, "true"), r.setAttribute("aria-label", "Scroll to latest"), r.textContent = "↓", Object.assign(r.style, {
|
|
591
593
|
position: "absolute",
|
|
592
594
|
bottom: "12px",
|
|
593
595
|
left: "50%",
|
|
@@ -615,36 +617,37 @@ function ut(e) {
|
|
|
615
617
|
r.style.opacity = "0.9";
|
|
616
618
|
}), t.appendChild(r), r;
|
|
617
619
|
}
|
|
618
|
-
function
|
|
619
|
-
let n =
|
|
620
|
+
function mt(e, t) {
|
|
621
|
+
let n = pt(e);
|
|
620
622
|
n.style.display = "flex";
|
|
621
623
|
let r = () => {
|
|
622
|
-
|
|
624
|
+
at(e, t), n.style.display = "none";
|
|
623
625
|
}, i = () => {
|
|
624
626
|
let { scrollTop: t, scrollHeight: r, clientHeight: i } = e;
|
|
625
|
-
r - t - i <=
|
|
627
|
+
r - t - i <= ut(e) && (n.style.display = "none");
|
|
626
628
|
};
|
|
627
629
|
return n.addEventListener("click", r), e.addEventListener("scroll", i, { passive: !0 }), () => {
|
|
628
630
|
n.removeEventListener("click", r), e.removeEventListener("scroll", i);
|
|
629
631
|
};
|
|
630
632
|
}
|
|
631
|
-
function
|
|
633
|
+
function ht() {
|
|
632
634
|
let e = D(function({ nodeId: e, context: t }) {
|
|
633
|
-
let n = I(t.store, e), r = M(null), i =
|
|
635
|
+
let n = I(t.store, e), r = M(null), i = B(n?.props?.targetViewId), a = n?.props?.focusOnly, o = typeof a == "boolean" ? a : void 0, s = B(n?.props?.priority), c = B(n?.props?.key), l = n?.props?.preciseGeneratedAt;
|
|
634
636
|
return k(() => {
|
|
635
637
|
if (typeof document > "u") return;
|
|
636
638
|
let e = r.current;
|
|
637
639
|
if (!e || i && e.closest("[data-ikon-view-id]")?.getAttribute("data-ikon-view-id") !== i) return;
|
|
638
640
|
let t, n;
|
|
639
641
|
if (o !== !0) {
|
|
640
|
-
let r =
|
|
641
|
-
if (r)
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
642
|
+
let r = U(e);
|
|
643
|
+
if (r) {
|
|
644
|
+
if (ft(r), s === "Polite" && !dt(r)) t = mt(r, e);
|
|
645
|
+
else {
|
|
646
|
+
let t = (r.parentElement ?? r).querySelector(`[${W}]`);
|
|
647
|
+
t && (t.style.display = "none"), at(r, e), n = st(r, e);
|
|
648
|
+
}
|
|
649
|
+
} else typeof e.scrollIntoView == "function" && requestAnimationFrame(() => {
|
|
650
|
+
let t = e.getBoundingClientRect().top, n = typeof window < "u" ? window.innerHeight : 0, r = Math.abs(t) > n * it ? "auto" : "smooth";
|
|
648
651
|
try {
|
|
649
652
|
e.scrollIntoView({
|
|
650
653
|
behavior: r,
|
|
@@ -689,15 +692,15 @@ function ft() {
|
|
|
689
692
|
if (t === "std.focus-hint") return e;
|
|
690
693
|
};
|
|
691
694
|
}
|
|
692
|
-
function
|
|
695
|
+
function gt() {
|
|
693
696
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
694
|
-
let r = I(t.store, e), i =
|
|
697
|
+
let r = I(t.store, e), i = $e(r?.props?.onInvokeId), a = O(() => {
|
|
695
698
|
i && t.dispatchAction(i);
|
|
696
699
|
}, [i, t]);
|
|
697
700
|
if (!r) return null;
|
|
698
|
-
let o =
|
|
701
|
+
let o = rt(r.props);
|
|
699
702
|
delete o.onInvokeId;
|
|
700
|
-
let s =
|
|
703
|
+
let s = V(B(r.props?.className), n), c = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
701
704
|
return /* @__PURE__ */ P("div", {
|
|
702
705
|
...o,
|
|
703
706
|
"data-ikon-node-id": r.id,
|
|
@@ -709,7 +712,7 @@ function pt() {
|
|
|
709
712
|
onKeyDown: i ? (e) => {
|
|
710
713
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), a());
|
|
711
714
|
} : void 0,
|
|
712
|
-
style:
|
|
715
|
+
style: nt(o.style, i ? "pointer" : void 0),
|
|
713
716
|
children: c
|
|
714
717
|
});
|
|
715
718
|
});
|
|
@@ -717,11 +720,11 @@ function pt() {
|
|
|
717
720
|
if (t === "std.div") return e;
|
|
718
721
|
};
|
|
719
722
|
}
|
|
720
|
-
function
|
|
723
|
+
function _t() {
|
|
721
724
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
722
725
|
let r = I(t.store, e);
|
|
723
726
|
if (!r) return null;
|
|
724
|
-
let i =
|
|
727
|
+
let i = rt(r.props), a = V("relative", B(r.props?.className), n), o = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
725
728
|
return /* @__PURE__ */ P("div", {
|
|
726
729
|
...i,
|
|
727
730
|
"data-ikon-node-id": r.id,
|
|
@@ -734,11 +737,11 @@ function mt() {
|
|
|
734
737
|
if (t === "std.stack") return e;
|
|
735
738
|
};
|
|
736
739
|
}
|
|
737
|
-
function
|
|
740
|
+
function vt() {
|
|
738
741
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
739
742
|
let r = I(t.store, e);
|
|
740
743
|
if (!r) return null;
|
|
741
|
-
let i =
|
|
744
|
+
let i = rt(r.props), a = V("absolute", B(r.props?.className), n), o = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
742
745
|
return /* @__PURE__ */ P("div", {
|
|
743
746
|
...i,
|
|
744
747
|
"data-ikon-node-id": r.id,
|
|
@@ -751,23 +754,23 @@ function ht() {
|
|
|
751
754
|
if (t === "std.layer") return e;
|
|
752
755
|
};
|
|
753
756
|
}
|
|
754
|
-
function
|
|
757
|
+
function yt() {
|
|
755
758
|
return [
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
759
|
+
gt(),
|
|
760
|
+
_t(),
|
|
761
|
+
vt(),
|
|
762
|
+
ht()
|
|
760
763
|
];
|
|
761
764
|
}
|
|
762
765
|
//#endregion
|
|
763
766
|
//#region src/base/base-module.ts
|
|
764
|
-
var
|
|
765
|
-
function
|
|
766
|
-
e.registerModule(
|
|
767
|
+
var bt = "base", xt = async () => yt();
|
|
768
|
+
function St(e) {
|
|
769
|
+
e.registerModule(bt, xt);
|
|
767
770
|
}
|
|
768
771
|
//#endregion
|
|
769
772
|
//#region src/media/audio-player.tsx
|
|
770
|
-
function
|
|
773
|
+
function Ct(e) {
|
|
771
774
|
if (typeof e == "string") {
|
|
772
775
|
let t = e.trim();
|
|
773
776
|
return t.length > 0 ? t : void 0;
|
|
@@ -777,17 +780,17 @@ function bt(e) {
|
|
|
777
780
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
778
781
|
}
|
|
779
782
|
}
|
|
780
|
-
function
|
|
783
|
+
function wt(...e) {
|
|
781
784
|
let t = [];
|
|
782
785
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
783
786
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
784
787
|
}
|
|
785
|
-
function
|
|
788
|
+
function Tt(e) {
|
|
786
789
|
if (typeof e != "string") return;
|
|
787
790
|
let t = e.trim();
|
|
788
791
|
return t.length > 0 ? t : void 0;
|
|
789
792
|
}
|
|
790
|
-
function
|
|
793
|
+
function Et(e) {
|
|
791
794
|
if (typeof e == "boolean") return e;
|
|
792
795
|
if (typeof e == "string") {
|
|
793
796
|
let t = e.trim().toLowerCase();
|
|
@@ -795,13 +798,13 @@ function Ct(e) {
|
|
|
795
798
|
if (t === "false") return !1;
|
|
796
799
|
}
|
|
797
800
|
}
|
|
798
|
-
function
|
|
801
|
+
function Dt() {
|
|
799
802
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
800
|
-
let r = I(t.store, e), i = M(null), a = r ?
|
|
803
|
+
let r = I(t.store, e), i = M(null), a = r ? Et(r.props?.autoplay) : void 0, o = r ? Tt(r.props?.src) : void 0;
|
|
801
804
|
if (k(() => {
|
|
802
805
|
a && i.current && i.current.play().catch(() => {});
|
|
803
806
|
}, [a, o]), !r) return null;
|
|
804
|
-
let s =
|
|
807
|
+
let s = wt(Ct(r.props?.className), n), c = Tt(r.props?.preload), l = Et(r.props?.controls), u = Et(r.props?.loop), d = Et(r.props?.muted);
|
|
805
808
|
return /* @__PURE__ */ P("audio", {
|
|
806
809
|
ref: i,
|
|
807
810
|
src: o,
|
|
@@ -821,7 +824,7 @@ function wt() {
|
|
|
821
824
|
}
|
|
822
825
|
//#endregion
|
|
823
826
|
//#region src/media/video-stream-view.tsx
|
|
824
|
-
var
|
|
827
|
+
var Ot = S("IkonVideoStreamView"), kt = D(function({ client: e, streamId: t, className: n, style: r, width: i, height: a, attributes: o, getPlayback: s }) {
|
|
825
828
|
let c = M(null), l = M(null), [, u] = N(0);
|
|
826
829
|
k(() => {
|
|
827
830
|
if (e?.isWebRtcEnabled) return e.addWebRtcTrackMapListener((e) => {
|
|
@@ -837,14 +840,14 @@ var Tt = S("IkonVideoStreamView"), Et = D(function({ client: e, streamId: t, cla
|
|
|
837
840
|
let e = o();
|
|
838
841
|
if (!e) {
|
|
839
842
|
if (a++ >= 50) {
|
|
840
|
-
|
|
843
|
+
Ot.warn(`Gave up attaching the canvas for stream ${t}: video playback never became available`);
|
|
841
844
|
return;
|
|
842
845
|
}
|
|
843
846
|
i = setTimeout(l, 100);
|
|
844
847
|
return;
|
|
845
848
|
}
|
|
846
849
|
e.attachCanvas(t, n).catch((e) => {
|
|
847
|
-
|
|
850
|
+
Ot.error(`Failed to attach the canvas for stream ${t}, it will stay blank: ${String(e)}`);
|
|
848
851
|
});
|
|
849
852
|
};
|
|
850
853
|
return l(), () => {
|
|
@@ -882,7 +885,7 @@ var Tt = S("IkonVideoStreamView"), Et = D(function({ client: e, streamId: t, cla
|
|
|
882
885
|
});
|
|
883
886
|
//#endregion
|
|
884
887
|
//#region src/media/video-canvas.tsx
|
|
885
|
-
function
|
|
888
|
+
function At(e) {
|
|
886
889
|
if (typeof e == "string") {
|
|
887
890
|
let t = e.trim();
|
|
888
891
|
return t.length > 0 ? t : void 0;
|
|
@@ -892,52 +895,68 @@ function Dt(e) {
|
|
|
892
895
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
893
896
|
}
|
|
894
897
|
}
|
|
895
|
-
function
|
|
898
|
+
function jt(...e) {
|
|
896
899
|
let t = [];
|
|
897
900
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
898
901
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
899
902
|
}
|
|
900
|
-
function
|
|
903
|
+
function Mt(e) {
|
|
901
904
|
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
902
905
|
if (typeof e == "string" && e.trim().length > 0) {
|
|
903
906
|
let t = Number(e);
|
|
904
907
|
if (Number.isFinite(t)) return Math.floor(t);
|
|
905
908
|
}
|
|
906
909
|
}
|
|
907
|
-
function
|
|
910
|
+
function Nt(e) {
|
|
908
911
|
if (typeof e != "string") return;
|
|
909
912
|
let t = e.trim();
|
|
910
913
|
return t.length > 0 ? t : void 0;
|
|
911
914
|
}
|
|
912
|
-
var
|
|
913
|
-
function
|
|
915
|
+
var Pt = "std.video-canvas", Ft = "std.video-url-player";
|
|
916
|
+
function It() {
|
|
914
917
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
915
|
-
let r = I(t.store, e), i = r ?
|
|
916
|
-
|
|
918
|
+
let r = I(t.store, e), i = r ? Nt(r.props?.streamId) : void 0, a = r ? Nt(r.props?.onTapId) : void 0, o = r ? Mt(r.props?.width) : void 0, s = r ? Mt(r.props?.height) : void 0, c = r ? jt(At(r.props?.className), n) : n, l = O(() => t.video ?? t.client?.media?.video, [t]), u = O((e) => {
|
|
919
|
+
if (!a) return;
|
|
920
|
+
let n = e.target.getBoundingClientRect();
|
|
921
|
+
n.width <= 0 || n.height <= 0 || t.dispatchAction(a, {
|
|
922
|
+
x: Math.min(1, Math.max(0, (e.clientX - n.left) / n.width)),
|
|
923
|
+
y: Math.min(1, Math.max(0, (e.clientY - n.top) / n.height))
|
|
924
|
+
});
|
|
925
|
+
}, [a, t]);
|
|
926
|
+
if (!r) return null;
|
|
927
|
+
let d = /* @__PURE__ */ P(kt, {
|
|
917
928
|
client: t.client,
|
|
918
929
|
streamId: i,
|
|
919
|
-
className:
|
|
920
|
-
width:
|
|
921
|
-
height:
|
|
922
|
-
getPlayback:
|
|
930
|
+
className: c,
|
|
931
|
+
width: o,
|
|
932
|
+
height: s,
|
|
933
|
+
getPlayback: l,
|
|
923
934
|
attributes: {
|
|
924
935
|
"data-ikon-node-id": r.id,
|
|
925
936
|
...r.sourceMarker ? { "data-ikon-source": r.sourceMarker } : {}
|
|
926
937
|
}
|
|
927
|
-
})
|
|
938
|
+
});
|
|
939
|
+
return a ? /* @__PURE__ */ P("div", {
|
|
940
|
+
style: {
|
|
941
|
+
display: "contents",
|
|
942
|
+
cursor: "pointer"
|
|
943
|
+
},
|
|
944
|
+
onPointerUp: u,
|
|
945
|
+
children: d
|
|
946
|
+
}) : d;
|
|
928
947
|
});
|
|
929
948
|
return ({ type: t }) => {
|
|
930
949
|
if (t === "std.video-canvas") return e;
|
|
931
950
|
};
|
|
932
951
|
}
|
|
933
|
-
function
|
|
952
|
+
function Lt() {
|
|
934
953
|
return [
|
|
935
|
-
Nt(),
|
|
936
954
|
It(),
|
|
937
|
-
|
|
955
|
+
zt(),
|
|
956
|
+
Dt()
|
|
938
957
|
];
|
|
939
958
|
}
|
|
940
|
-
function
|
|
959
|
+
function Rt(e) {
|
|
941
960
|
if (typeof e == "boolean") return e;
|
|
942
961
|
if (typeof e == "string") {
|
|
943
962
|
let t = e.trim().toLowerCase();
|
|
@@ -945,13 +964,13 @@ function Ft(e) {
|
|
|
945
964
|
if (t === "false") return !1;
|
|
946
965
|
}
|
|
947
966
|
}
|
|
948
|
-
function
|
|
967
|
+
function zt() {
|
|
949
968
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
950
|
-
let r = I(t.store, e), i = M(null), a = r ?
|
|
969
|
+
let r = I(t.store, e), i = M(null), a = r ? Rt(r.props?.autoplay) : void 0, o = r ? Nt(r.props?.src) : void 0;
|
|
951
970
|
if (k(() => {
|
|
952
971
|
a && i.current && i.current.play().catch(() => {});
|
|
953
972
|
}, [a, o]), !r) return null;
|
|
954
|
-
let s =
|
|
973
|
+
let s = jt(At(r.props?.className), n), c = Nt(r.props?.poster), l = Rt(r.props?.controls), u = Rt(r.props?.loop), d = Rt(r.props?.muted), f = Rt(r.props?.playsInline), p = Mt(r.props?.width), m = Mt(r.props?.height), h = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
955
974
|
return /* @__PURE__ */ P("video", {
|
|
956
975
|
ref: i,
|
|
957
976
|
src: o,
|
|
@@ -975,20 +994,20 @@ function It() {
|
|
|
975
994
|
}
|
|
976
995
|
//#endregion
|
|
977
996
|
//#region src/media/media-module.ts
|
|
978
|
-
var
|
|
979
|
-
function
|
|
980
|
-
e.registerModule(
|
|
997
|
+
var Bt = "media", Vt = async () => Lt();
|
|
998
|
+
function Ht(e) {
|
|
999
|
+
e.registerModule(Bt, Vt);
|
|
981
1000
|
}
|
|
982
1001
|
//#endregion
|
|
983
1002
|
//#region src/shadertoy/shadertoy-gl.ts
|
|
984
|
-
var
|
|
985
|
-
function
|
|
1003
|
+
var Ut = "#version 300 es\nin vec4 a_position;\nvoid main() {\n gl_Position = a_position;\n}\n", Wt = 4;
|
|
1004
|
+
function Gt(e, t) {
|
|
986
1005
|
return RegExp(`\\buniform\\s+\\w+\\s+${t}\\s*;`, "g").test(e);
|
|
987
1006
|
}
|
|
988
|
-
function
|
|
1007
|
+
function Kt(e, t) {
|
|
989
1008
|
let n = [];
|
|
990
1009
|
for (let [r, i] of Object.entries(t)) {
|
|
991
|
-
if (
|
|
1010
|
+
if (Gt(e, r)) continue;
|
|
992
1011
|
let t;
|
|
993
1012
|
switch (i.type) {
|
|
994
1013
|
case "float":
|
|
@@ -1046,7 +1065,7 @@ void main() {
|
|
|
1046
1065
|
}
|
|
1047
1066
|
`;
|
|
1048
1067
|
}
|
|
1049
|
-
var
|
|
1068
|
+
var qt = class {
|
|
1050
1069
|
gl;
|
|
1051
1070
|
program = null;
|
|
1052
1071
|
positionBuffer = null;
|
|
@@ -1062,7 +1081,7 @@ var Wt = class {
|
|
|
1062
1081
|
mouseClickY = 0;
|
|
1063
1082
|
channels = [];
|
|
1064
1083
|
channelResolution = /* @__PURE__ */ new Float32Array(12);
|
|
1065
|
-
channelTime = new Float32Array(
|
|
1084
|
+
channelTime = new Float32Array(Wt);
|
|
1066
1085
|
lastError = null;
|
|
1067
1086
|
currentShaderSource = "";
|
|
1068
1087
|
constructor(e) {
|
|
@@ -1097,7 +1116,7 @@ var Wt = class {
|
|
|
1097
1116
|
}
|
|
1098
1117
|
initializeChannels() {
|
|
1099
1118
|
let e = this.gl;
|
|
1100
|
-
for (let t = 0; t <
|
|
1119
|
+
for (let t = 0; t < Wt; t++) {
|
|
1101
1120
|
let t = e.createTexture();
|
|
1102
1121
|
e.bindTexture(e.TEXTURE_2D, t), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, new Uint8Array([
|
|
1103
1122
|
0,
|
|
@@ -1114,7 +1133,7 @@ var Wt = class {
|
|
|
1114
1133
|
e.bindTexture(e.TEXTURE_2D, null);
|
|
1115
1134
|
}
|
|
1116
1135
|
setChannels(e) {
|
|
1117
|
-
for (let t = 0; t <
|
|
1136
|
+
for (let t = 0; t < Wt; t++) {
|
|
1118
1137
|
let n = e[t] ?? null, r = this.channels[t];
|
|
1119
1138
|
if (r.url !== n) {
|
|
1120
1139
|
if (r.url = n, !n) {
|
|
@@ -1145,9 +1164,9 @@ var Wt = class {
|
|
|
1145
1164
|
}
|
|
1146
1165
|
compile(e, t = {}) {
|
|
1147
1166
|
this.lastError = null, this.customUniforms = t, this.currentShaderSource = e;
|
|
1148
|
-
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER,
|
|
1167
|
+
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER, Ut);
|
|
1149
1168
|
if (!r) return !1;
|
|
1150
|
-
let i =
|
|
1169
|
+
let i = Kt(e, t), a = this.compileShader(n.FRAGMENT_SHADER, i);
|
|
1151
1170
|
if (!a) return n.deleteShader(r), !1;
|
|
1152
1171
|
let o = n.createProgram();
|
|
1153
1172
|
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);
|
|
@@ -1171,7 +1190,7 @@ var Wt = class {
|
|
|
1171
1190
|
"iMouse",
|
|
1172
1191
|
"iDate"
|
|
1173
1192
|
]) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
1174
|
-
for (let t = 0; t <
|
|
1193
|
+
for (let t = 0; t < Wt; t++) this.uniformLocations.set(`iChannel${t}`, e.getUniformLocation(this.program, `iChannel${t}`));
|
|
1175
1194
|
this.uniformLocations.set("iChannelResolution", e.getUniformLocation(this.program, "iChannelResolution[0]")), this.uniformLocations.set("iChannelTime", e.getUniformLocation(this.program, "iChannelTime[0]"));
|
|
1176
1195
|
for (let t of Object.keys(this.customUniforms)) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
1177
1196
|
}
|
|
@@ -1203,7 +1222,7 @@ var Wt = class {
|
|
|
1203
1222
|
let t = /* @__PURE__ */ new Date();
|
|
1204
1223
|
e.uniform4f(p, t.getFullYear(), t.getMonth(), t.getDate(), t.getHours() * 3600 + t.getMinutes() * 60 + t.getSeconds() + t.getMilliseconds() / 1e3);
|
|
1205
1224
|
}
|
|
1206
|
-
for (let t = 0; t <
|
|
1225
|
+
for (let t = 0; t < Wt; t++) {
|
|
1207
1226
|
e.activeTexture(e.TEXTURE0 + t), e.bindTexture(e.TEXTURE_2D, this.channels[t].texture);
|
|
1208
1227
|
let n = this.uniformLocations.get(`iChannel${t}`);
|
|
1209
1228
|
n && e.uniform1i(n, t);
|
|
@@ -1253,7 +1272,7 @@ var Wt = class {
|
|
|
1253
1272
|
};
|
|
1254
1273
|
//#endregion
|
|
1255
1274
|
//#region src/shadertoy/shadertoy-renderer.tsx
|
|
1256
|
-
function
|
|
1275
|
+
function Jt(e) {
|
|
1257
1276
|
if (typeof e == "string") {
|
|
1258
1277
|
let t = e.trim();
|
|
1259
1278
|
return t.length > 0 ? t : void 0;
|
|
@@ -1263,22 +1282,22 @@ function Gt(e) {
|
|
|
1263
1282
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1264
1283
|
}
|
|
1265
1284
|
}
|
|
1266
|
-
function
|
|
1285
|
+
function Yt(...e) {
|
|
1267
1286
|
let t = [];
|
|
1268
1287
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
1269
1288
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1270
1289
|
}
|
|
1271
|
-
function
|
|
1290
|
+
function Xt(e) {
|
|
1272
1291
|
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
1273
1292
|
if (typeof e == "string" && e.trim().length > 0) {
|
|
1274
1293
|
let t = Number(e);
|
|
1275
1294
|
if (Number.isFinite(t)) return Math.floor(t);
|
|
1276
1295
|
}
|
|
1277
1296
|
}
|
|
1278
|
-
function
|
|
1297
|
+
function Zt(e) {
|
|
1279
1298
|
return typeof e == "string" ? e : "";
|
|
1280
1299
|
}
|
|
1281
|
-
function
|
|
1300
|
+
function Qt(e) {
|
|
1282
1301
|
if (typeof e == "boolean") return e;
|
|
1283
1302
|
if (typeof e == "string") {
|
|
1284
1303
|
let t = e.trim().toLowerCase();
|
|
@@ -1286,7 +1305,7 @@ function Yt(e) {
|
|
|
1286
1305
|
if (t === "false") return !1;
|
|
1287
1306
|
}
|
|
1288
1307
|
}
|
|
1289
|
-
function
|
|
1308
|
+
function $t(e) {
|
|
1290
1309
|
if (!e || typeof e != "object") return {};
|
|
1291
1310
|
let t = {}, n = e;
|
|
1292
1311
|
for (let [e, r] of Object.entries(n)) {
|
|
@@ -1306,10 +1325,10 @@ function Xt(e) {
|
|
|
1306
1325
|
}
|
|
1307
1326
|
return t;
|
|
1308
1327
|
}
|
|
1309
|
-
function
|
|
1328
|
+
function en(e) {
|
|
1310
1329
|
return Array.isArray(e) ? e.map((e) => typeof e == "string" ? e : null) : [];
|
|
1311
1330
|
}
|
|
1312
|
-
function
|
|
1331
|
+
function tn(e, t) {
|
|
1313
1332
|
let n = Object.keys(e), r = Object.keys(t);
|
|
1314
1333
|
if (n.length !== r.length) return !1;
|
|
1315
1334
|
for (let r of n) {
|
|
@@ -1323,8 +1342,8 @@ function Qt(e, t) {
|
|
|
1323
1342
|
}
|
|
1324
1343
|
return !0;
|
|
1325
1344
|
}
|
|
1326
|
-
var
|
|
1327
|
-
function
|
|
1345
|
+
var nn = "std.shadertoy-canvas";
|
|
1346
|
+
function rn() {
|
|
1328
1347
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
1329
1348
|
let r = I(t.store, e), i = M(null), a = M(null), o = M(null), s = M(0), c = M(""), l = M({}), u = M({
|
|
1330
1349
|
x: 0,
|
|
@@ -1332,12 +1351,12 @@ function en() {
|
|
|
1332
1351
|
clickX: 0,
|
|
1333
1352
|
clickY: 0,
|
|
1334
1353
|
isDown: !1
|
|
1335
|
-
}), d = r ?
|
|
1354
|
+
}), d = r ? Zt(r.props?.shaderSource) : "", f = r ? Xt(r.props?.fps) ?? 60 : 60, p = r?.props?.uniforms, m = j(() => $t(p), [p]), h = r?.props?.channels, g = j(() => en(h), [h]), _ = r ? Qt(r.props?.enableMouse) ?? !0 : !0, v = r ? Xt(r.props?.width) : void 0, y = r ? Xt(r.props?.height) : void 0, ee = r ? Yt(Jt(r.props?.className), n) : n;
|
|
1336
1355
|
k(() => {
|
|
1337
1356
|
let e = i.current;
|
|
1338
1357
|
if (e) {
|
|
1339
1358
|
try {
|
|
1340
|
-
let t = new
|
|
1359
|
+
let t = new qt(e);
|
|
1341
1360
|
a.current = t;
|
|
1342
1361
|
} catch (e) {
|
|
1343
1362
|
console.error("[ShadertoyRenderer] Failed to create WebGL2 context:", e);
|
|
@@ -1348,14 +1367,16 @@ function en() {
|
|
|
1348
1367
|
}
|
|
1349
1368
|
}, []), k(() => {
|
|
1350
1369
|
let e = a.current;
|
|
1351
|
-
if (!(!e || !d) && c.current !== d)
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1370
|
+
if (!(!e || !d) && c.current !== d) {
|
|
1371
|
+
if (e.compile(d, m)) c.current = d, l.current = m;
|
|
1372
|
+
else {
|
|
1373
|
+
let t = e.getError();
|
|
1374
|
+
console.error("[ShadertoyRenderer] Shader compilation failed:", t);
|
|
1375
|
+
}
|
|
1355
1376
|
}
|
|
1356
1377
|
}, [d, m]), k(() => {
|
|
1357
1378
|
let e = a.current;
|
|
1358
|
-
!e || !c.current ||
|
|
1379
|
+
!e || !c.current || tn(l.current, m) || (e.setCustomUniforms(m), l.current = m);
|
|
1359
1380
|
}, [m]), k(() => {
|
|
1360
1381
|
let e = a.current;
|
|
1361
1382
|
e && e.setChannels(g);
|
|
@@ -1370,32 +1391,32 @@ function en() {
|
|
|
1370
1391
|
o.current !== null && (cancelAnimationFrame(o.current), o.current = null);
|
|
1371
1392
|
};
|
|
1372
1393
|
}, [f]);
|
|
1373
|
-
let
|
|
1394
|
+
let te = O((e) => {
|
|
1374
1395
|
if (!_) return;
|
|
1375
1396
|
let t = i.current, n = a.current;
|
|
1376
1397
|
if (!t || !n) return;
|
|
1377
1398
|
let r = window.devicePixelRatio || 1, o = t.getBoundingClientRect(), s = (e.clientX - o.left) * r, c = (o.height - (e.clientY - o.top)) * r;
|
|
1378
1399
|
u.current.x = s, u.current.y = c, n.setMouse(s, c, u.current.clickX, u.current.clickY);
|
|
1379
|
-
}, [_]),
|
|
1400
|
+
}, [_]), b = O((e) => {
|
|
1380
1401
|
if (!_) return;
|
|
1381
1402
|
let t = i.current, n = a.current;
|
|
1382
1403
|
if (!t || !n) return;
|
|
1383
1404
|
let r = window.devicePixelRatio || 1, o = t.getBoundingClientRect(), s = (e.clientX - o.left) * r, c = (o.height - (e.clientY - o.top)) * r;
|
|
1384
1405
|
u.current.isDown = !0, u.current.clickX = s, u.current.clickY = c, n.setMouse(s, c, s, c);
|
|
1385
|
-
}, [_]),
|
|
1406
|
+
}, [_]), x = O(() => {
|
|
1386
1407
|
_ && (u.current.isDown = !1, u.current.clickX = -Math.abs(u.current.clickX));
|
|
1387
1408
|
}, [_]);
|
|
1388
1409
|
return r ? /* @__PURE__ */ P("canvas", {
|
|
1389
1410
|
ref: i,
|
|
1390
1411
|
"data-ikon-node-id": r.id,
|
|
1391
1412
|
"data-ikon-source": r.sourceMarker,
|
|
1392
|
-
className:
|
|
1393
|
-
...
|
|
1394
|
-
...
|
|
1395
|
-
onMouseMove:
|
|
1396
|
-
onMouseDown:
|
|
1397
|
-
onMouseUp:
|
|
1398
|
-
onMouseLeave:
|
|
1413
|
+
className: ee,
|
|
1414
|
+
...v ? { width: v } : {},
|
|
1415
|
+
...y ? { height: y } : {},
|
|
1416
|
+
onMouseMove: te,
|
|
1417
|
+
onMouseDown: b,
|
|
1418
|
+
onMouseUp: x,
|
|
1419
|
+
onMouseLeave: x
|
|
1399
1420
|
}) : null;
|
|
1400
1421
|
});
|
|
1401
1422
|
return ({ type: t }) => {
|
|
@@ -1404,13 +1425,13 @@ function en() {
|
|
|
1404
1425
|
}
|
|
1405
1426
|
//#endregion
|
|
1406
1427
|
//#region src/shadertoy/shadertoy-module.ts
|
|
1407
|
-
var
|
|
1408
|
-
function
|
|
1409
|
-
e.registerModule(
|
|
1428
|
+
var an = "shadertoy", on = async () => rn();
|
|
1429
|
+
function sn(e) {
|
|
1430
|
+
e.registerModule(an, on);
|
|
1410
1431
|
}
|
|
1411
1432
|
//#endregion
|
|
1412
1433
|
//#region src/ikon-ui-registry.ts
|
|
1413
|
-
var
|
|
1434
|
+
var cn = S("UIRegistry"), ln = class {
|
|
1414
1435
|
baseResolvers = [];
|
|
1415
1436
|
moduleLoaders = /* @__PURE__ */ new Map();
|
|
1416
1437
|
moduleResolvers = /* @__PURE__ */ new Map();
|
|
@@ -1436,14 +1457,14 @@ var an = S("UIRegistry"), on = class {
|
|
|
1436
1457
|
async loadRegisteredModules() {
|
|
1437
1458
|
let e = !1;
|
|
1438
1459
|
for (let [t, n] of this.moduleLoaders.entries()) if (!this.moduleResolvers.has(t)) try {
|
|
1439
|
-
let r =
|
|
1460
|
+
let r = fn(await n());
|
|
1440
1461
|
this.moduleResolvers.set(t, r), e = !0;
|
|
1441
1462
|
} catch (e) {
|
|
1442
|
-
|
|
1463
|
+
cn.error(`[IkonUiRegistry] Failed to load module '${t}'.`, e);
|
|
1443
1464
|
}
|
|
1444
1465
|
let t = [];
|
|
1445
1466
|
for (let e of this.moduleLoaders.keys()) this.moduleResolvers.has(e) && t.push(e);
|
|
1446
|
-
return
|
|
1467
|
+
return pn(t, this.activeModuleOrder) || (this.activeModuleOrder = t, e = !0), e && this.notify(), e;
|
|
1447
1468
|
}
|
|
1448
1469
|
resolve(e) {
|
|
1449
1470
|
for (let t of this.baseResolvers) {
|
|
@@ -1453,7 +1474,7 @@ var an = S("UIRegistry"), on = class {
|
|
|
1453
1474
|
for (let t of this.activeModuleOrder) {
|
|
1454
1475
|
let n = this.moduleResolvers.get(t);
|
|
1455
1476
|
if (!n) {
|
|
1456
|
-
|
|
1477
|
+
cn.warn(`Missing resolvers for module ${t}`);
|
|
1457
1478
|
continue;
|
|
1458
1479
|
}
|
|
1459
1480
|
for (let t of n) {
|
|
@@ -1466,25 +1487,25 @@ var an = S("UIRegistry"), on = class {
|
|
|
1466
1487
|
for (let e of this.listeners) e();
|
|
1467
1488
|
}
|
|
1468
1489
|
};
|
|
1469
|
-
function
|
|
1470
|
-
let e = new
|
|
1471
|
-
return
|
|
1490
|
+
function un() {
|
|
1491
|
+
let e = new ln();
|
|
1492
|
+
return St(e), Ht(e), sn(e), e.loadRegisteredModules(), e;
|
|
1472
1493
|
}
|
|
1473
|
-
function
|
|
1494
|
+
function dn(e) {
|
|
1474
1495
|
return Array.isArray(e) ? e : [e];
|
|
1475
1496
|
}
|
|
1476
|
-
function
|
|
1477
|
-
return e ?
|
|
1497
|
+
function fn(e) {
|
|
1498
|
+
return e ? dn(e).flatMap((e) => e ? Array.isArray(e) ? e.filter(Boolean) : [e] : []) : [];
|
|
1478
1499
|
}
|
|
1479
|
-
function
|
|
1500
|
+
function pn(e, t) {
|
|
1480
1501
|
if (e.length !== t.length) return !1;
|
|
1481
1502
|
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
1482
1503
|
return !0;
|
|
1483
1504
|
}
|
|
1484
1505
|
//#endregion
|
|
1485
1506
|
//#region src/parallax-view.tsx
|
|
1486
|
-
function
|
|
1487
|
-
return /* @__PURE__ */ P(
|
|
1507
|
+
function mn({ mount: e, stores: t, registry: n, client: r, onAction: i }) {
|
|
1508
|
+
return /* @__PURE__ */ P(z, {
|
|
1488
1509
|
stores: t,
|
|
1489
1510
|
registry: n,
|
|
1490
1511
|
category: e,
|
|
@@ -1494,7 +1515,7 @@ function dn({ mount: e, stores: t, registry: n, client: r, onAction: i }) {
|
|
|
1494
1515
|
}
|
|
1495
1516
|
//#endregion
|
|
1496
1517
|
//#region src/motion/motion-controller.ts
|
|
1497
|
-
var
|
|
1518
|
+
var hn = S("MotionController"), gn = {
|
|
1498
1519
|
ease: [
|
|
1499
1520
|
.25,
|
|
1500
1521
|
.1,
|
|
@@ -1664,20 +1685,20 @@ var fn = S("MotionController"), pn = {
|
|
|
1664
1685
|
1.55
|
|
1665
1686
|
]
|
|
1666
1687
|
};
|
|
1667
|
-
function
|
|
1688
|
+
function G(e) {
|
|
1668
1689
|
return e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
1669
1690
|
}
|
|
1670
|
-
function
|
|
1691
|
+
function _n(e) {
|
|
1671
1692
|
if (e == null) return;
|
|
1672
1693
|
let t = e.trim();
|
|
1673
1694
|
if (!t) return;
|
|
1674
1695
|
let n = Number.parseFloat(t);
|
|
1675
1696
|
return Number.isFinite(n) ? n : void 0;
|
|
1676
1697
|
}
|
|
1677
|
-
function
|
|
1698
|
+
function vn(e) {
|
|
1678
1699
|
return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
1679
1700
|
}
|
|
1680
|
-
function
|
|
1701
|
+
function yn(e, t, n, r) {
|
|
1681
1702
|
let i = 1 / 10, a = /* @__PURE__ */ new Float32Array(11);
|
|
1682
1703
|
function o(e, t, n) {
|
|
1683
1704
|
return ((3 * t - 3 * n + 1) * e + (3 * n - 6 * t)) * e * e + 3 * t * e;
|
|
@@ -1711,34 +1732,34 @@ function gn(e, t, n, r) {
|
|
|
1711
1732
|
for (let t = 0; t < 11; t += 1) a[t] = o(t * i, e, n);
|
|
1712
1733
|
return (e) => e <= 0 ? 0 : e >= 1 ? 1 : o(u(e), t, r);
|
|
1713
1734
|
}
|
|
1714
|
-
function
|
|
1735
|
+
function bn(e) {
|
|
1715
1736
|
let t = /steps\(\s*([0-9]+)\s*(?:,\s*([a-z-]+)\s*)?\)/i.exec(e);
|
|
1716
|
-
if (!t) return (e) =>
|
|
1737
|
+
if (!t) return (e) => G(e);
|
|
1717
1738
|
let n = Math.max(1, parseInt(t[1], 10)), r = (t[2] ?? "end").toLowerCase();
|
|
1718
|
-
return r === "start" || r === "jump-start" ? (e) =>
|
|
1739
|
+
return r === "start" || r === "jump-start" ? (e) => G(Math.ceil(e * n) / n) : r === "none" || r === "jump-none" ? (e) => G(Math.round(e * n) / n) : r === "both" || r === "jump-both" ? (e) => G((Math.floor(e * n) + .5) / n) : (e) => G(Math.floor(e * n) / n);
|
|
1719
1740
|
}
|
|
1720
|
-
function
|
|
1721
|
-
if (!e) return (e) =>
|
|
1741
|
+
function xn(e) {
|
|
1742
|
+
if (!e) return (e) => G(e);
|
|
1722
1743
|
let t = e.trim().toLowerCase();
|
|
1723
|
-
if (!t || t === "linear") return (e) =>
|
|
1724
|
-
if (
|
|
1725
|
-
let [e, n, r, i] =
|
|
1726
|
-
return (e) =>
|
|
1744
|
+
if (!t || t === "linear") return (e) => G(e);
|
|
1745
|
+
if (gn[t]) {
|
|
1746
|
+
let [e, n, r, i] = gn[t], a = yn(e, n, r, i);
|
|
1747
|
+
return (e) => G(a(G(e)));
|
|
1727
1748
|
}
|
|
1728
1749
|
if (t.startsWith("cubic-bezier(") && t.endsWith(")")) {
|
|
1729
1750
|
let e = t.slice(13, -1).split(",").map((e) => Number.parseFloat(e.trim()));
|
|
1730
1751
|
if (e.length === 4 && e.every((e) => Number.isFinite(e))) {
|
|
1731
|
-
let [t, n, r, i] = e, a =
|
|
1732
|
-
return (e) =>
|
|
1752
|
+
let [t, n, r, i] = e, a = yn(t, n, r, i);
|
|
1753
|
+
return (e) => G(a(G(e)));
|
|
1733
1754
|
}
|
|
1734
1755
|
}
|
|
1735
1756
|
if (t.startsWith("steps(") && t.endsWith(")")) {
|
|
1736
|
-
let e =
|
|
1737
|
-
return (t) => e(
|
|
1757
|
+
let e = bn(t);
|
|
1758
|
+
return (t) => e(G(t));
|
|
1738
1759
|
}
|
|
1739
|
-
return (e) =>
|
|
1760
|
+
return (e) => G(e);
|
|
1740
1761
|
}
|
|
1741
|
-
function
|
|
1762
|
+
function Sn(e) {
|
|
1742
1763
|
if (!e) return;
|
|
1743
1764
|
let t = /(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)\s*->\s*(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)/.exec(e);
|
|
1744
1765
|
if (!t) return;
|
|
@@ -1755,7 +1776,7 @@ function yn(e) {
|
|
|
1755
1776
|
outEnd: a
|
|
1756
1777
|
};
|
|
1757
1778
|
}
|
|
1758
|
-
var
|
|
1779
|
+
var Cn = new class {
|
|
1759
1780
|
bindingsByStyle = /* @__PURE__ */ new Map();
|
|
1760
1781
|
observer;
|
|
1761
1782
|
observeScheduled = !1;
|
|
@@ -1780,7 +1801,7 @@ var bn = new class {
|
|
|
1780
1801
|
for (let e of Array.from(this.globalCleanups)) try {
|
|
1781
1802
|
e();
|
|
1782
1803
|
} catch (e) {
|
|
1783
|
-
|
|
1804
|
+
hn.warn("Failed to cleanup binding listener", e);
|
|
1784
1805
|
}
|
|
1785
1806
|
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);
|
|
1786
1807
|
}
|
|
@@ -1789,14 +1810,14 @@ var bn = new class {
|
|
|
1789
1810
|
let t = (JSON.parse(e).motionBindings ?? []).map((e) => this.parseBinding(e)).filter((e) => e !== void 0);
|
|
1790
1811
|
return t.length === 0 ? void 0 : { bindings: t };
|
|
1791
1812
|
} catch (e) {
|
|
1792
|
-
|
|
1813
|
+
hn.warn("Failed to parse motion metadata", e);
|
|
1793
1814
|
return;
|
|
1794
1815
|
}
|
|
1795
1816
|
}
|
|
1796
1817
|
parseBinding(e) {
|
|
1797
1818
|
let t = e.source?.trim();
|
|
1798
1819
|
if (!t) return;
|
|
1799
|
-
let n =
|
|
1820
|
+
let n = _n(e.min) ?? 0, r = _n(e.max), i = r === void 0 ? n + 100 : r, a = (e.clamp ?? "clamp").trim().toLowerCase(), o = !!e.reverse, s = xn(e.ease), c = Sn(e.map), l = e.targetId?.trim() || void 0;
|
|
1800
1821
|
if (!(Number.isNaN(n) || Number.isNaN(i))) return {
|
|
1801
1822
|
source: t.toLowerCase(),
|
|
1802
1823
|
min: n,
|
|
@@ -1842,7 +1863,7 @@ var bn = new class {
|
|
|
1842
1863
|
scanExistingNodes(e) {
|
|
1843
1864
|
let t = this.bindingsByStyle.get(e);
|
|
1844
1865
|
if (!t || typeof document > "u") return;
|
|
1845
|
-
let n = `.${
|
|
1866
|
+
let n = `.${vn(e)}`;
|
|
1846
1867
|
document.querySelectorAll(n).forEach((n) => this.applyStyleToElement(n, e, t));
|
|
1847
1868
|
}
|
|
1848
1869
|
applyStyleToElement(e, t, n) {
|
|
@@ -1878,7 +1899,7 @@ var bn = new class {
|
|
|
1878
1899
|
}
|
|
1879
1900
|
resolveScrollContainer(e, t) {
|
|
1880
1901
|
if (t.targetId) {
|
|
1881
|
-
let e = `[data-ikon-motion-source="${
|
|
1902
|
+
let e = `[data-ikon-motion-source="${vn(t.targetId)}"]`, n = typeof document < "u" ? document.querySelector(e) : null;
|
|
1882
1903
|
if (n) return n;
|
|
1883
1904
|
}
|
|
1884
1905
|
return e.closest("[data-ikon-view-type=\"scroll-view\"]");
|
|
@@ -1898,7 +1919,7 @@ var bn = new class {
|
|
|
1898
1919
|
case "freeze-start": return e < 0 ? 0 : e;
|
|
1899
1920
|
case "freeze-end": return e > 1 ? 1 : e;
|
|
1900
1921
|
case "unclamped": return e;
|
|
1901
|
-
default: return
|
|
1922
|
+
default: return G(e);
|
|
1902
1923
|
}
|
|
1903
1924
|
}
|
|
1904
1925
|
applyMap(e, t) {
|
|
@@ -1933,7 +1954,7 @@ var bn = new class {
|
|
|
1933
1954
|
try {
|
|
1934
1955
|
e();
|
|
1935
1956
|
} catch (e) {
|
|
1936
|
-
|
|
1957
|
+
hn.warn("Failed to cleanup listener", e);
|
|
1937
1958
|
}
|
|
1938
1959
|
this.globalCleanups.delete(e);
|
|
1939
1960
|
}
|
|
@@ -1973,26 +1994,26 @@ var bn = new class {
|
|
|
1973
1994
|
}();
|
|
1974
1995
|
//#endregion
|
|
1975
1996
|
//#region src/use-ikon-styles.ts
|
|
1976
|
-
function
|
|
1997
|
+
function wn(e) {
|
|
1977
1998
|
let t = M(/* @__PURE__ */ new Map()), n = O(({ styleId: e, css: n, common: r }) => {
|
|
1978
1999
|
if (!(!e || typeof document > "u")) {
|
|
1979
2000
|
if (n) {
|
|
1980
2001
|
let r = t.current.get(e);
|
|
1981
2002
|
r || (r = document.createElement("style"), r.setAttribute("data-ikon-style-id", e), document.head.appendChild(r), t.current.set(e, r)), r.textContent = n;
|
|
1982
2003
|
}
|
|
1983
|
-
|
|
2004
|
+
Cn.registerStyle(e, r);
|
|
1984
2005
|
}
|
|
1985
2006
|
}, []), r = O((e) => {
|
|
1986
2007
|
if (!(typeof document > "u")) for (let n of e) {
|
|
1987
2008
|
let e = t.current.get(n);
|
|
1988
|
-
e && (e.remove(), t.current.delete(n)),
|
|
2009
|
+
e && (e.remove(), t.current.delete(n)), Cn.unregisterStyle(n);
|
|
1989
2010
|
}
|
|
1990
2011
|
}, []), i = O(() => {
|
|
1991
2012
|
if (typeof document < "u") {
|
|
1992
2013
|
for (let e of t.current.values()) e.remove();
|
|
1993
2014
|
t.current.clear();
|
|
1994
2015
|
}
|
|
1995
|
-
|
|
2016
|
+
Cn.reset();
|
|
1996
2017
|
}, []);
|
|
1997
2018
|
return k(() => {
|
|
1998
2019
|
if (!e) return;
|
|
@@ -2014,7 +2035,7 @@ function xn(e) {
|
|
|
2014
2035
|
}
|
|
2015
2036
|
//#endregion
|
|
2016
2037
|
//#region src/use-ikon-ui-stores.ts
|
|
2017
|
-
function
|
|
2038
|
+
function Tn(e) {
|
|
2018
2039
|
let t = [];
|
|
2019
2040
|
for (let [n, r] of e) {
|
|
2020
2041
|
let e = r.store.getSnapshot(), i = e.rootViewId && e.views.has(e.rootViewId);
|
|
@@ -2022,7 +2043,7 @@ function Sn(e) {
|
|
|
2022
2043
|
}
|
|
2023
2044
|
return t.sort(), t.join(",");
|
|
2024
2045
|
}
|
|
2025
|
-
function
|
|
2046
|
+
function En(e) {
|
|
2026
2047
|
let [t, n] = N(), r = M("");
|
|
2027
2048
|
return k(() => {
|
|
2028
2049
|
if (!e) {
|
|
@@ -2030,7 +2051,7 @@ function Cn(e) {
|
|
|
2030
2051
|
return;
|
|
2031
2052
|
}
|
|
2032
2053
|
let t = () => {
|
|
2033
|
-
let t = e.getStores(), i =
|
|
2054
|
+
let t = e.getStores(), i = Tn(t);
|
|
2034
2055
|
i !== r.current && (r.current = i, n(t));
|
|
2035
2056
|
};
|
|
2036
2057
|
return t(), e.subscribe(t);
|
|
@@ -2038,7 +2059,7 @@ function Cn(e) {
|
|
|
2038
2059
|
}
|
|
2039
2060
|
//#endregion
|
|
2040
2061
|
//#region src/media/use-sibling-client.ts
|
|
2041
|
-
function
|
|
2062
|
+
function Dn(e, t, n) {
|
|
2042
2063
|
let [r, i] = N(null), [a, o] = N(null), s = M(n);
|
|
2043
2064
|
s.current = n;
|
|
2044
2065
|
let c = t ? JSON.stringify(Object.entries(t).sort(([e], [t]) => e < t ? -1 : +(e > t))) : null;
|
|
@@ -2059,8 +2080,8 @@ function wn(e, t, n) {
|
|
|
2059
2080
|
}
|
|
2060
2081
|
//#endregion
|
|
2061
2082
|
//#region src/media/use-media-capture.ts
|
|
2062
|
-
var
|
|
2063
|
-
function
|
|
2083
|
+
var On = S("IkonMediaCaptureHooks");
|
|
2084
|
+
function kn(e, t, n, r) {
|
|
2064
2085
|
let [i, a] = N(null), o = M(r);
|
|
2065
2086
|
return o.current = r, k(() => {
|
|
2066
2087
|
if (!e || !t) return;
|
|
@@ -2075,7 +2096,7 @@ function En(e, t, n, r) {
|
|
|
2075
2096
|
try {
|
|
2076
2097
|
i = await o.current(t);
|
|
2077
2098
|
} catch (e) {
|
|
2078
|
-
r || (
|
|
2099
|
+
r || (On.error(`${n} capture start failed: ${String(e)}`), a(e instanceof Error ? e : Error(String(e))));
|
|
2079
2100
|
return;
|
|
2080
2101
|
}
|
|
2081
2102
|
r && i.stop();
|
|
@@ -2089,30 +2110,30 @@ function En(e, t, n, r) {
|
|
|
2089
2110
|
n
|
|
2090
2111
|
]), { error: i };
|
|
2091
2112
|
}
|
|
2092
|
-
function
|
|
2113
|
+
function An(e, t, n) {
|
|
2093
2114
|
let r = M(n);
|
|
2094
|
-
return r.current = n,
|
|
2115
|
+
return r.current = n, kn(e, t, "microphone", O((e) => e.audio.startMic(r.current ?? {}), []));
|
|
2095
2116
|
}
|
|
2096
|
-
function
|
|
2117
|
+
function jn(e, t, n) {
|
|
2097
2118
|
let r = M(n);
|
|
2098
|
-
return r.current = n,
|
|
2119
|
+
return r.current = n, kn(e, t, "camera", O((e) => e.video.startCamera(r.current), []));
|
|
2099
2120
|
}
|
|
2100
|
-
function
|
|
2121
|
+
function Mn(e, t, n) {
|
|
2101
2122
|
let r = M(n);
|
|
2102
|
-
return r.current = n,
|
|
2123
|
+
return r.current = n, kn(e, t, "screen", O((e) => e.video.startScreen(r.current), []));
|
|
2103
2124
|
}
|
|
2104
2125
|
//#endregion
|
|
2105
2126
|
//#region src/shared/render-motion-letters.tsx
|
|
2106
|
-
var
|
|
2127
|
+
var K = {
|
|
2107
2128
|
None: 0,
|
|
2108
2129
|
Letter: 1,
|
|
2109
2130
|
Word: 2,
|
|
2110
2131
|
Line: 4,
|
|
2111
2132
|
Paragraph: 8,
|
|
2112
2133
|
Emoji: 16
|
|
2113
|
-
},
|
|
2134
|
+
}, Nn = [
|
|
2114
2135
|
{
|
|
2115
|
-
flag:
|
|
2136
|
+
flag: K.Letter,
|
|
2116
2137
|
hints: [
|
|
2117
2138
|
"[data-motion-letter]",
|
|
2118
2139
|
"[data-letter]",
|
|
@@ -2121,7 +2142,7 @@ var G = {
|
|
|
2121
2142
|
]
|
|
2122
2143
|
},
|
|
2123
2144
|
{
|
|
2124
|
-
flag:
|
|
2145
|
+
flag: K.Word,
|
|
2125
2146
|
hints: [
|
|
2126
2147
|
"[data-motion-word]",
|
|
2127
2148
|
"[data-word]",
|
|
@@ -2130,7 +2151,7 @@ var G = {
|
|
|
2130
2151
|
]
|
|
2131
2152
|
},
|
|
2132
2153
|
{
|
|
2133
|
-
flag:
|
|
2154
|
+
flag: K.Line,
|
|
2134
2155
|
hints: [
|
|
2135
2156
|
"[data-motion-line]",
|
|
2136
2157
|
"[data-line]",
|
|
@@ -2139,7 +2160,7 @@ var G = {
|
|
|
2139
2160
|
]
|
|
2140
2161
|
},
|
|
2141
2162
|
{
|
|
2142
|
-
flag:
|
|
2163
|
+
flag: K.Paragraph,
|
|
2143
2164
|
hints: [
|
|
2144
2165
|
"[data-motion-paragraph]",
|
|
2145
2166
|
"[data-paragraph]",
|
|
@@ -2150,7 +2171,7 @@ var G = {
|
|
|
2150
2171
|
]
|
|
2151
2172
|
},
|
|
2152
2173
|
{
|
|
2153
|
-
flag:
|
|
2174
|
+
flag: K.Emoji,
|
|
2154
2175
|
hints: [
|
|
2155
2176
|
":is([data-motion-emoji],[data-emoji],.tw-motion-emoji,.tw-emoji)",
|
|
2156
2177
|
"[data-motion-emoji]",
|
|
@@ -2159,16 +2180,16 @@ var G = {
|
|
|
2159
2180
|
"[data-emoji]"
|
|
2160
2181
|
]
|
|
2161
2182
|
}
|
|
2162
|
-
],
|
|
2163
|
-
function
|
|
2164
|
-
if (!e || e.length >
|
|
2165
|
-
let n =
|
|
2166
|
-
if (i ===
|
|
2183
|
+
], Pn = K.Letter | K.Word | K.Line | K.Paragraph | K.Emoji, Fn = K.Letter | K.Word | K.Line | K.Paragraph, In = /* @__PURE__ */ new Map(), Ln = 16384;
|
|
2184
|
+
function Rn(e, t) {
|
|
2185
|
+
if (!e || e.length > Ln) return e;
|
|
2186
|
+
let n = pr(t), r = lr(n, K.Emoji), i = n & Fn;
|
|
2187
|
+
if (i === K.None && !r) return e;
|
|
2167
2188
|
let a = e.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
2168
|
-
if (i ===
|
|
2169
|
-
let o =
|
|
2170
|
-
if (o.length === 0) return r ?
|
|
2171
|
-
let s =
|
|
2189
|
+
if (i === K.None) return dr(a);
|
|
2190
|
+
let o = sr(a);
|
|
2191
|
+
if (o.length === 0) return r ? dr(a) : e;
|
|
2192
|
+
let s = cr(o), c = {
|
|
2172
2193
|
letter: 0,
|
|
2173
2194
|
word: 0,
|
|
2174
2195
|
line: 0,
|
|
@@ -2177,58 +2198,58 @@ function Fn(e, t) {
|
|
|
2177
2198
|
emoji: 0
|
|
2178
2199
|
}, l = [];
|
|
2179
2200
|
for (let e of s) {
|
|
2180
|
-
let t =
|
|
2201
|
+
let t = zn(e, n, c);
|
|
2181
2202
|
l.push(...t);
|
|
2182
2203
|
}
|
|
2183
2204
|
return l;
|
|
2184
2205
|
}
|
|
2185
|
-
function
|
|
2206
|
+
function zn(e, t, n) {
|
|
2186
2207
|
let r = [];
|
|
2187
2208
|
for (let i of e) {
|
|
2188
|
-
let e =
|
|
2209
|
+
let e = Bn(i, t, n);
|
|
2189
2210
|
r.push(...e);
|
|
2190
2211
|
}
|
|
2191
|
-
if (
|
|
2212
|
+
if (lr(t, K.Paragraph)) {
|
|
2192
2213
|
let e = n.paragraph++;
|
|
2193
2214
|
return [/* @__PURE__ */ P("span", {
|
|
2194
2215
|
"data-motion-paragraph": !0,
|
|
2195
|
-
style:
|
|
2216
|
+
style: ur(e),
|
|
2196
2217
|
children: r
|
|
2197
2218
|
}, `motion-paragraph-${e}`)];
|
|
2198
2219
|
}
|
|
2199
2220
|
return r;
|
|
2200
2221
|
}
|
|
2201
|
-
function
|
|
2202
|
-
let r =
|
|
2203
|
-
if (
|
|
2222
|
+
function Bn(e, t, n) {
|
|
2223
|
+
let r = Vn(e.text, t, n), i = [];
|
|
2224
|
+
if (lr(t, K.Line)) {
|
|
2204
2225
|
let e = n.line++;
|
|
2205
2226
|
i.push(/* @__PURE__ */ P("span", {
|
|
2206
2227
|
"data-motion-line": !0,
|
|
2207
|
-
style:
|
|
2228
|
+
style: ur(e),
|
|
2208
2229
|
children: r
|
|
2209
2230
|
}, `motion-line-${e}`));
|
|
2210
2231
|
} else i.push(...r);
|
|
2211
2232
|
for (let t = 0; t < e.breaks; t++) i.push(/* @__PURE__ */ P("br", {}, `motion-break-${n.br++}`));
|
|
2212
2233
|
return i;
|
|
2213
2234
|
}
|
|
2214
|
-
function
|
|
2235
|
+
function Vn(e, t, n) {
|
|
2215
2236
|
if (!e) return [];
|
|
2216
|
-
let r =
|
|
2237
|
+
let r = lr(t, K.Word), i = [], a = /(\s+)/g, o = 0, s;
|
|
2217
2238
|
for (; (s = a.exec(e)) !== null;) {
|
|
2218
2239
|
if (s.index > o) {
|
|
2219
2240
|
let a = e.slice(o, s.index);
|
|
2220
|
-
i.push(
|
|
2241
|
+
i.push(Hn(a, n, t, r));
|
|
2221
2242
|
}
|
|
2222
2243
|
i.push(s[0]), o = s.index + s[0].length;
|
|
2223
2244
|
}
|
|
2224
2245
|
if (o < e.length) {
|
|
2225
2246
|
let a = e.slice(o);
|
|
2226
|
-
i.push(
|
|
2247
|
+
i.push(Hn(a, n, t, r));
|
|
2227
2248
|
}
|
|
2228
2249
|
return i;
|
|
2229
2250
|
}
|
|
2230
|
-
function
|
|
2231
|
-
let i = t.word++, a =
|
|
2251
|
+
function Hn(e, t, n, r) {
|
|
2252
|
+
let i = t.word++, a = Wn(e, n, t), o = `motion-word-${i}`, s = Un(i, r);
|
|
2232
2253
|
return r ? /* @__PURE__ */ P("span", {
|
|
2233
2254
|
"data-motion-word": !0,
|
|
2234
2255
|
style: s,
|
|
@@ -2238,25 +2259,25 @@ function zn(e, t, n, r) {
|
|
|
2238
2259
|
children: a
|
|
2239
2260
|
}, o);
|
|
2240
2261
|
}
|
|
2241
|
-
function
|
|
2262
|
+
function Un(e, t) {
|
|
2242
2263
|
return t ? {
|
|
2243
|
-
...
|
|
2264
|
+
...ur(e),
|
|
2244
2265
|
whiteSpace: "nowrap"
|
|
2245
2266
|
} : { whiteSpace: "nowrap" };
|
|
2246
2267
|
}
|
|
2247
|
-
function
|
|
2268
|
+
function Wn(e, t, n) {
|
|
2248
2269
|
if (!e) return [];
|
|
2249
|
-
let r =
|
|
2270
|
+
let r = lr(t, K.Letter), i = lr(t, K.Emoji);
|
|
2250
2271
|
if (!r) {
|
|
2251
2272
|
if (!i) return [e];
|
|
2252
|
-
let t =
|
|
2273
|
+
let t = Gn(e);
|
|
2253
2274
|
if (t.length === 0) return [e];
|
|
2254
|
-
let { nodes: r } =
|
|
2275
|
+
let { nodes: r } = fr(t, n);
|
|
2255
2276
|
return r;
|
|
2256
2277
|
}
|
|
2257
|
-
let a = [], o =
|
|
2278
|
+
let a = [], o = Gn(e);
|
|
2258
2279
|
for (let e of o) {
|
|
2259
|
-
let t = n.letter++, r = `motion-letter-${t}`, o =
|
|
2280
|
+
let t = n.letter++, r = `motion-letter-${t}`, o = ur(t);
|
|
2260
2281
|
if (e === "\n") {
|
|
2261
2282
|
a.push(/* @__PURE__ */ P("span", {
|
|
2262
2283
|
"data-motion-letter": !0,
|
|
@@ -2265,7 +2286,7 @@ function Vn(e, t, n) {
|
|
|
2265
2286
|
}, r));
|
|
2266
2287
|
continue;
|
|
2267
2288
|
}
|
|
2268
|
-
let s = i &&
|
|
2289
|
+
let s = i && ir(e) ? { "data-motion-emoji": !0 } : void 0, c = e === " " ? "\xA0" : e;
|
|
2269
2290
|
a.push(/* @__PURE__ */ P("span", {
|
|
2270
2291
|
"data-motion-letter": !0,
|
|
2271
2292
|
style: o,
|
|
@@ -2275,46 +2296,46 @@ function Vn(e, t, n) {
|
|
|
2275
2296
|
}
|
|
2276
2297
|
return a;
|
|
2277
2298
|
}
|
|
2278
|
-
function
|
|
2299
|
+
function Gn(e) {
|
|
2279
2300
|
if (!e) return [];
|
|
2280
|
-
let t =
|
|
2281
|
-
return t ? Array.from(t.segment(e), (e) => e.segment) :
|
|
2301
|
+
let t = qn();
|
|
2302
|
+
return t ? Array.from(t.segment(e), (e) => e.segment) : Jn(e);
|
|
2282
2303
|
}
|
|
2283
|
-
var
|
|
2284
|
-
function
|
|
2285
|
-
return
|
|
2304
|
+
var Kn;
|
|
2305
|
+
function qn() {
|
|
2306
|
+
return Kn === void 0 && (Kn = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null), Kn;
|
|
2286
2307
|
}
|
|
2287
|
-
function
|
|
2308
|
+
function Jn(e) {
|
|
2288
2309
|
let t = [], n = Array.from(e), r = "";
|
|
2289
2310
|
for (let e = 0; e < n.length; e++) {
|
|
2290
2311
|
let i = n[e], a = n[e + 1];
|
|
2291
|
-
r += i, !(a &&
|
|
2312
|
+
r += i, !(a && Yn(i, a)) && (t.push(r), r = "");
|
|
2292
2313
|
}
|
|
2293
2314
|
return r && t.push(r), t;
|
|
2294
2315
|
}
|
|
2295
|
-
function
|
|
2296
|
-
return t ? !!(
|
|
2316
|
+
function Yn(e, t) {
|
|
2317
|
+
return t ? !!(Xn(e) || Xn(t) || tr(t) || Zn(t) || Qn(t) || $n(e) && $n(t)) : !1;
|
|
2297
2318
|
}
|
|
2298
|
-
function
|
|
2319
|
+
function Xn(e) {
|
|
2299
2320
|
return e.codePointAt(0) === 8205;
|
|
2300
2321
|
}
|
|
2301
|
-
function
|
|
2322
|
+
function Zn(e) {
|
|
2302
2323
|
let t = e.codePointAt(0);
|
|
2303
2324
|
return t === void 0 ? !1 : t >= 65024 && t <= 65039 || t >= 917760 && t <= 917999;
|
|
2304
2325
|
}
|
|
2305
|
-
function
|
|
2326
|
+
function Qn(e) {
|
|
2306
2327
|
let t = e.codePointAt(0);
|
|
2307
2328
|
return t !== void 0 && t >= 127995 && t <= 127999;
|
|
2308
2329
|
}
|
|
2309
|
-
function
|
|
2330
|
+
function $n(e) {
|
|
2310
2331
|
let t = e.codePointAt(0);
|
|
2311
2332
|
return t !== void 0 && t >= 127462 && t <= 127487;
|
|
2312
2333
|
}
|
|
2313
|
-
var
|
|
2314
|
-
function
|
|
2315
|
-
return e ? (
|
|
2334
|
+
var er;
|
|
2335
|
+
function tr(e) {
|
|
2336
|
+
return e ? (er ||= nr(), er(e)) : !1;
|
|
2316
2337
|
}
|
|
2317
|
-
function
|
|
2338
|
+
function nr() {
|
|
2318
2339
|
try {
|
|
2319
2340
|
let e = /\p{Mark}/u;
|
|
2320
2341
|
return (t) => e.test(t);
|
|
@@ -2325,19 +2346,19 @@ function $n() {
|
|
|
2325
2346
|
};
|
|
2326
2347
|
}
|
|
2327
2348
|
}
|
|
2328
|
-
var
|
|
2329
|
-
function
|
|
2330
|
-
return e ? (
|
|
2349
|
+
var rr;
|
|
2350
|
+
function ir(e) {
|
|
2351
|
+
return e ? (rr ||= ar(), rr(e)) : !1;
|
|
2331
2352
|
}
|
|
2332
|
-
function
|
|
2353
|
+
function ar() {
|
|
2333
2354
|
try {
|
|
2334
2355
|
let e = /\p{Extended_Pictographic}/u;
|
|
2335
2356
|
return (t) => e.test(t);
|
|
2336
2357
|
} catch {
|
|
2337
|
-
return
|
|
2358
|
+
return or;
|
|
2338
2359
|
}
|
|
2339
2360
|
}
|
|
2340
|
-
function
|
|
2361
|
+
function or(e) {
|
|
2341
2362
|
if (!e) return !1;
|
|
2342
2363
|
for (let t of Array.from(e)) {
|
|
2343
2364
|
let e = t.codePointAt(0);
|
|
@@ -2345,7 +2366,7 @@ function rr(e) {
|
|
|
2345
2366
|
}
|
|
2346
2367
|
return !1;
|
|
2347
2368
|
}
|
|
2348
|
-
function
|
|
2369
|
+
function sr(e) {
|
|
2349
2370
|
let t = [], n = "", r = 0;
|
|
2350
2371
|
for (let i = 0; i < e.length; i++) {
|
|
2351
2372
|
let a = e[i];
|
|
@@ -2363,16 +2384,16 @@ function ir(e) {
|
|
|
2363
2384
|
breaks: r
|
|
2364
2385
|
}), t;
|
|
2365
2386
|
}
|
|
2366
|
-
function
|
|
2387
|
+
function cr(e) {
|
|
2367
2388
|
if (e.length === 0) return [];
|
|
2368
2389
|
let t = [], n = [];
|
|
2369
2390
|
for (let r of e) n.push(r), r.breaks >= 2 && (t.push(n), n = []);
|
|
2370
2391
|
return n.length > 0 && t.push(n), t;
|
|
2371
2392
|
}
|
|
2372
|
-
function
|
|
2393
|
+
function lr(e, t) {
|
|
2373
2394
|
return (e & t) === t;
|
|
2374
2395
|
}
|
|
2375
|
-
function
|
|
2396
|
+
function ur(e) {
|
|
2376
2397
|
return {
|
|
2377
2398
|
"--tw-motion-seq-index": e.toString(),
|
|
2378
2399
|
backgroundColor: "inherit",
|
|
@@ -2389,19 +2410,19 @@ function or(e) {
|
|
|
2389
2410
|
WebkitTextFillColor: "inherit"
|
|
2390
2411
|
};
|
|
2391
2412
|
}
|
|
2392
|
-
function
|
|
2413
|
+
function dr(e) {
|
|
2393
2414
|
if (!e) return e;
|
|
2394
|
-
let t =
|
|
2415
|
+
let t = Gn(e);
|
|
2395
2416
|
if (t.length === 0) return e;
|
|
2396
|
-
let { nodes: n, sawEmoji: r } =
|
|
2417
|
+
let { nodes: n, sawEmoji: r } = fr(t);
|
|
2397
2418
|
return r ? n.length === 1 ? n[0] ?? e : n : e;
|
|
2398
2419
|
}
|
|
2399
|
-
function
|
|
2420
|
+
function fr(e, t) {
|
|
2400
2421
|
let n = [], r = "", i = !1, a = t?.emoji ?? 0, o = () => {
|
|
2401
2422
|
r &&= (n.push(r), "");
|
|
2402
2423
|
};
|
|
2403
2424
|
for (let s of e) {
|
|
2404
|
-
if (
|
|
2425
|
+
if (ir(s)) {
|
|
2405
2426
|
i = !0, o();
|
|
2406
2427
|
let e = `motion-emoji-${t ? t.emoji++ : a++}`;
|
|
2407
2428
|
n.push(/* @__PURE__ */ P("span", {
|
|
@@ -2420,16 +2441,16 @@ function cr(e, t) {
|
|
|
2420
2441
|
sawEmoji: !1
|
|
2421
2442
|
};
|
|
2422
2443
|
}
|
|
2423
|
-
function
|
|
2424
|
-
if (!e) return
|
|
2444
|
+
function pr(e) {
|
|
2445
|
+
if (!e) return K.None;
|
|
2425
2446
|
let t = e.trim();
|
|
2426
|
-
if (!t) return
|
|
2427
|
-
let n =
|
|
2447
|
+
if (!t) return K.None;
|
|
2448
|
+
let n = In.get(t);
|
|
2428
2449
|
if (typeof n == "number") return n;
|
|
2429
|
-
if (typeof document > "u") return
|
|
2450
|
+
if (typeof document > "u") return K.None;
|
|
2430
2451
|
let r = t.split(/\s+/).filter(Boolean);
|
|
2431
|
-
if (r.length === 0) return
|
|
2432
|
-
let i = r.map((e) => `.${
|
|
2452
|
+
if (r.length === 0) return K.None;
|
|
2453
|
+
let i = r.map((e) => `.${hr(e)}`).map((e) => RegExp(`(^|[^a-zA-Z0-9_-])${gr(e)}(?![a-zA-Z0-9_-])`)), a = K.None, o = !1;
|
|
2433
2454
|
for (let e of Array.from(document.styleSheets)) {
|
|
2434
2455
|
let t;
|
|
2435
2456
|
try {
|
|
@@ -2437,18 +2458,18 @@ function lr(e) {
|
|
|
2437
2458
|
} catch {
|
|
2438
2459
|
continue;
|
|
2439
2460
|
}
|
|
2440
|
-
let n =
|
|
2441
|
-
if (n.mask && (a |= n.mask, a ===
|
|
2461
|
+
let n = mr(t, i);
|
|
2462
|
+
if (n.mask && (a |= n.mask, a === Pn)) break;
|
|
2442
2463
|
o ||= n.sawStyleRule;
|
|
2443
2464
|
}
|
|
2444
|
-
return (a !==
|
|
2465
|
+
return (a !== K.None || o) && In.set(t, a), a;
|
|
2445
2466
|
}
|
|
2446
|
-
function
|
|
2467
|
+
function mr(e, t) {
|
|
2447
2468
|
if (!e) return {
|
|
2448
|
-
mask:
|
|
2469
|
+
mask: K.None,
|
|
2449
2470
|
sawStyleRule: !1
|
|
2450
2471
|
};
|
|
2451
|
-
let n =
|
|
2472
|
+
let n = K.None, r = !1;
|
|
2452
2473
|
for (let i = 0; i < e.length; i++) {
|
|
2453
2474
|
let a = e[i];
|
|
2454
2475
|
if (a) {
|
|
@@ -2456,14 +2477,14 @@ function ur(e, t) {
|
|
|
2456
2477
|
let e = a.selectorText ?? "";
|
|
2457
2478
|
if (!e || !t.some((t) => t.test(e))) continue;
|
|
2458
2479
|
r = !0;
|
|
2459
|
-
for (let t of
|
|
2460
|
-
if (n ===
|
|
2480
|
+
for (let t of Nn) t.hints.some((t) => e.includes(t)) && (n |= t.flag);
|
|
2481
|
+
if (n === Pn) return {
|
|
2461
2482
|
mask: n,
|
|
2462
2483
|
sawStyleRule: !0
|
|
2463
2484
|
};
|
|
2464
2485
|
} else if ("cssRules" in a) {
|
|
2465
|
-
let e =
|
|
2466
|
-
if (e.mask && (n |= e.mask, n ===
|
|
2486
|
+
let e = mr(a.cssRules, t);
|
|
2487
|
+
if (e.mask && (n |= e.mask, n === Pn)) return {
|
|
2467
2488
|
mask: n,
|
|
2468
2489
|
sawStyleRule: !0
|
|
2469
2490
|
};
|
|
@@ -2476,16 +2497,16 @@ function ur(e, t) {
|
|
|
2476
2497
|
sawStyleRule: r
|
|
2477
2498
|
};
|
|
2478
2499
|
}
|
|
2479
|
-
function
|
|
2500
|
+
function hr(e) {
|
|
2480
2501
|
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
2481
2502
|
}
|
|
2482
|
-
function
|
|
2503
|
+
function gr(e) {
|
|
2483
2504
|
return e.replace(/[.*+?^${}()|[\]\\]/g, (e) => `\\${e}`);
|
|
2484
2505
|
}
|
|
2485
2506
|
//#endregion
|
|
2486
2507
|
//#region src/auth/storage.ts
|
|
2487
|
-
var
|
|
2488
|
-
function
|
|
2508
|
+
var _r = "ikon-auth-session", vr = "ikon-auth-refreshable", yr = "ikon-auth-auto-login-attempted-run", br = 6048e5, xr = 6e4;
|
|
2509
|
+
function Sr(e) {
|
|
2489
2510
|
try {
|
|
2490
2511
|
let t = e.split(".");
|
|
2491
2512
|
if (t.length !== 3) return;
|
|
@@ -2495,100 +2516,100 @@ function vr(e) {
|
|
|
2495
2516
|
return;
|
|
2496
2517
|
}
|
|
2497
2518
|
}
|
|
2498
|
-
function
|
|
2499
|
-
let t =
|
|
2500
|
-
return !t || typeof t.exp == "number" && Date.now() >= t.exp * 1e3 -
|
|
2519
|
+
function Cr(e) {
|
|
2520
|
+
let t = Sr(e);
|
|
2521
|
+
return !t || typeof t.exp == "number" && Date.now() >= t.exp * 1e3 - xr;
|
|
2501
2522
|
}
|
|
2502
|
-
function
|
|
2503
|
-
let t =
|
|
2523
|
+
function wr(e) {
|
|
2524
|
+
let t = Sr(e)?.exp;
|
|
2504
2525
|
return typeof t == "number" ? (/* @__PURE__ */ new Date(t * 1e3)).toISOString() : void 0;
|
|
2505
2526
|
}
|
|
2506
2527
|
function q(e) {
|
|
2507
2528
|
try {
|
|
2508
|
-
localStorage.setItem(
|
|
2529
|
+
localStorage.setItem(_r, JSON.stringify(e));
|
|
2509
2530
|
} catch {
|
|
2510
2531
|
console.warn("Failed to save auth session to localStorage");
|
|
2511
2532
|
}
|
|
2512
2533
|
}
|
|
2513
|
-
function
|
|
2534
|
+
function Tr() {
|
|
2514
2535
|
try {
|
|
2515
|
-
let e = localStorage.getItem(
|
|
2536
|
+
let e = localStorage.getItem(_r);
|
|
2516
2537
|
if (!e) return null;
|
|
2517
2538
|
let t = JSON.parse(e);
|
|
2518
|
-
return Date.now() - t.authenticatedAt >
|
|
2539
|
+
return Date.now() - t.authenticatedAt > br || Cr(t.token) ? (Nr(), null) : t;
|
|
2519
2540
|
} catch {
|
|
2520
2541
|
return console.warn("Failed to load auth session from localStorage"), null;
|
|
2521
2542
|
}
|
|
2522
2543
|
}
|
|
2523
|
-
function
|
|
2544
|
+
function Er() {
|
|
2524
2545
|
try {
|
|
2525
|
-
let e = localStorage.getItem(
|
|
2546
|
+
let e = localStorage.getItem(_r);
|
|
2526
2547
|
if (!e) return !1;
|
|
2527
2548
|
let t = JSON.parse(e);
|
|
2528
|
-
return t.provider === "dev" &&
|
|
2549
|
+
return t.provider === "dev" && Cr(t.token);
|
|
2529
2550
|
} catch {
|
|
2530
2551
|
return !1;
|
|
2531
2552
|
}
|
|
2532
2553
|
}
|
|
2533
|
-
function
|
|
2554
|
+
function Dr(e) {
|
|
2534
2555
|
try {
|
|
2535
|
-
localStorage.removeItem(
|
|
2556
|
+
localStorage.removeItem(_r), localStorage.setItem(vr, JSON.stringify(e));
|
|
2536
2557
|
} catch {
|
|
2537
2558
|
console.warn("Failed to save the auth session marker to localStorage");
|
|
2538
2559
|
}
|
|
2539
2560
|
}
|
|
2540
|
-
function
|
|
2561
|
+
function Or() {
|
|
2541
2562
|
try {
|
|
2542
|
-
let e = localStorage.getItem(
|
|
2563
|
+
let e = localStorage.getItem(vr);
|
|
2543
2564
|
if (!e) return null;
|
|
2544
2565
|
let t = JSON.parse(e);
|
|
2545
|
-
return Date.now() - t.renewedAt >
|
|
2566
|
+
return Date.now() - t.renewedAt > br ? (Ar(), null) : t;
|
|
2546
2567
|
} catch {
|
|
2547
2568
|
return console.warn("Failed to load the auth session marker from localStorage"), null;
|
|
2548
2569
|
}
|
|
2549
2570
|
}
|
|
2550
|
-
function
|
|
2551
|
-
let e =
|
|
2552
|
-
e &&
|
|
2571
|
+
function kr() {
|
|
2572
|
+
let e = Or();
|
|
2573
|
+
e && Dr({
|
|
2553
2574
|
...e,
|
|
2554
2575
|
renewedAt: Date.now()
|
|
2555
2576
|
});
|
|
2556
2577
|
}
|
|
2557
|
-
function
|
|
2578
|
+
function Ar() {
|
|
2558
2579
|
try {
|
|
2559
|
-
localStorage.removeItem(
|
|
2580
|
+
localStorage.removeItem(vr);
|
|
2560
2581
|
} catch {
|
|
2561
2582
|
console.warn("Failed to clear the auth session marker from localStorage");
|
|
2562
2583
|
}
|
|
2563
2584
|
}
|
|
2564
|
-
function
|
|
2565
|
-
|
|
2585
|
+
function jr() {
|
|
2586
|
+
Tr()?.provider === "anonymous" && Nr(), Or()?.provider === "anonymous" && Ar();
|
|
2566
2587
|
}
|
|
2567
|
-
function
|
|
2588
|
+
function Mr() {
|
|
2568
2589
|
try {
|
|
2569
2590
|
let e = typeof window < "u" ? new URLSearchParams(window.location.search) : void 0;
|
|
2570
2591
|
if (e?.get("ikon_token") || e?.get("ikon_code")) return !0;
|
|
2571
2592
|
} catch {}
|
|
2572
|
-
let e =
|
|
2593
|
+
let e = Tr()?.provider ?? Or()?.provider;
|
|
2573
2594
|
return e !== void 0 && e !== "anonymous";
|
|
2574
2595
|
}
|
|
2575
|
-
function
|
|
2596
|
+
function Nr() {
|
|
2576
2597
|
try {
|
|
2577
|
-
localStorage.removeItem(
|
|
2598
|
+
localStorage.removeItem(_r);
|
|
2578
2599
|
} catch {
|
|
2579
2600
|
console.warn("Failed to clear auth session from localStorage");
|
|
2580
2601
|
}
|
|
2581
2602
|
}
|
|
2582
|
-
function
|
|
2603
|
+
function Pr(e) {
|
|
2583
2604
|
if (e) try {
|
|
2584
|
-
sessionStorage.setItem(
|
|
2605
|
+
sessionStorage.setItem(yr, e);
|
|
2585
2606
|
} catch {
|
|
2586
2607
|
console.warn("Failed to record auto-login attempt in sessionStorage");
|
|
2587
2608
|
}
|
|
2588
2609
|
}
|
|
2589
|
-
function
|
|
2610
|
+
function Fr() {
|
|
2590
2611
|
try {
|
|
2591
|
-
return sessionStorage.getItem(
|
|
2612
|
+
return sessionStorage.getItem(yr);
|
|
2592
2613
|
} catch {
|
|
2593
2614
|
return null;
|
|
2594
2615
|
}
|
|
@@ -2604,8 +2625,8 @@ function J(e) {
|
|
|
2604
2625
|
}
|
|
2605
2626
|
//#endregion
|
|
2606
2627
|
//#region src/auth/auth-service.ts
|
|
2607
|
-
var
|
|
2608
|
-
async function
|
|
2628
|
+
var Ir = 15e3, Lr = 15e3, Y = S("AuthService");
|
|
2629
|
+
async function Rr(e) {
|
|
2609
2630
|
try {
|
|
2610
2631
|
return await fetch(e, {
|
|
2611
2632
|
method: "GET",
|
|
@@ -2615,35 +2636,35 @@ async function Pr(e) {
|
|
|
2615
2636
|
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)`;
|
|
2616
2637
|
}
|
|
2617
2638
|
}
|
|
2618
|
-
var
|
|
2619
|
-
function
|
|
2620
|
-
if (e.headers.get(
|
|
2639
|
+
var zr = "x-ikon-auth-service";
|
|
2640
|
+
function Br(e) {
|
|
2641
|
+
if (e.headers.get(zr) !== null) return !1;
|
|
2621
2642
|
if (e.status === 404 || e.status === 405) return !0;
|
|
2622
2643
|
let t = e.headers.get("content-type") ?? "";
|
|
2623
2644
|
return e.status === 200 && t.includes("text/html");
|
|
2624
2645
|
}
|
|
2625
2646
|
async function X(e, t, n) {
|
|
2626
|
-
let r = `${e}${t}`, i = E(), a = i !== null && e === i, o = a ? await
|
|
2647
|
+
let r = `${e}${t}`, i = E(), a = i !== null && e === i, o = a ? await oe() : i, s = o !== null && o !== e ? `${o}${t}` : null, c;
|
|
2627
2648
|
try {
|
|
2628
2649
|
c = await fetch(r, n);
|
|
2629
2650
|
} catch (i) {
|
|
2630
2651
|
let a = i instanceof Error ? `${i.name}: ${i.message}` : String(i);
|
|
2631
2652
|
if (!s) {
|
|
2632
|
-
let n = await
|
|
2653
|
+
let n = await Rr(e);
|
|
2633
2654
|
throw Y.error(`Auth request ${t} could not reach ${r} — ${a}. ${n}`), Error(`Auth request could not reach ${r} (${a}). ${n}`, { cause: i });
|
|
2634
2655
|
}
|
|
2635
2656
|
Y.warn(`Auth request ${t} could not reach ${r} (${a}); falling back to ${s}`);
|
|
2636
2657
|
try {
|
|
2637
2658
|
return await fetch(s, n);
|
|
2638
2659
|
} catch (n) {
|
|
2639
|
-
let i = n instanceof Error ? `${n.name}: ${n.message}` : String(n), o = await
|
|
2660
|
+
let i = n instanceof Error ? `${n.name}: ${n.message}` : String(n), o = await Rr(e);
|
|
2640
2661
|
throw Y.error(`Auth request ${t} failed on both ${r} (${a}) and ${s} (${i}). ${o}`), Error(`Auth request unreachable: ${r} (${a}) and ${s} (${i})`, { cause: n });
|
|
2641
2662
|
}
|
|
2642
2663
|
}
|
|
2643
|
-
return a && s !== null &&
|
|
2664
|
+
return a && s !== null && Br(c) ? (Y.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;
|
|
2644
2665
|
}
|
|
2645
|
-
async function
|
|
2646
|
-
let r =
|
|
2666
|
+
async function Vr(e, t, n) {
|
|
2667
|
+
let r = le(), i = n === "guest" ? "anonymous" : n, a = {
|
|
2647
2668
|
method: "POST",
|
|
2648
2669
|
headers: { "Content-Type": "application/json" },
|
|
2649
2670
|
body: JSON.stringify({
|
|
@@ -2665,7 +2686,7 @@ async function Lr(e, t, n) {
|
|
|
2665
2686
|
};
|
|
2666
2687
|
return q(l), l;
|
|
2667
2688
|
}
|
|
2668
|
-
async function
|
|
2689
|
+
async function Hr({ email: e, spaceId: t, authUrl: n }) {
|
|
2669
2690
|
let r = await X(n, "/email/send", {
|
|
2670
2691
|
method: "POST",
|
|
2671
2692
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2673,14 +2694,14 @@ async function Rr({ email: e, spaceId: t, authUrl: n }) {
|
|
|
2673
2694
|
email: e.trim(),
|
|
2674
2695
|
space: t
|
|
2675
2696
|
}),
|
|
2676
|
-
signal:
|
|
2697
|
+
signal: x(Ir)
|
|
2677
2698
|
});
|
|
2678
2699
|
if (!r.ok) {
|
|
2679
2700
|
let e = await r.text().catch(() => "Failed to send login code");
|
|
2680
2701
|
throw Error(e);
|
|
2681
2702
|
}
|
|
2682
2703
|
}
|
|
2683
|
-
async function
|
|
2704
|
+
async function Ur({ email: e, code: t, authUrl: n }) {
|
|
2684
2705
|
let r = await X(n, "/email/code", {
|
|
2685
2706
|
method: "POST",
|
|
2686
2707
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2688,7 +2709,7 @@ async function zr({ email: e, code: t, authUrl: n }) {
|
|
|
2688
2709
|
email: e.trim(),
|
|
2689
2710
|
code: t.trim()
|
|
2690
2711
|
}),
|
|
2691
|
-
signal:
|
|
2712
|
+
signal: x(Ir)
|
|
2692
2713
|
});
|
|
2693
2714
|
if (!r.ok) {
|
|
2694
2715
|
let e = await r.text().catch(() => "Invalid code");
|
|
@@ -2701,22 +2722,22 @@ async function zr({ email: e, code: t, authUrl: n }) {
|
|
|
2701
2722
|
};
|
|
2702
2723
|
return q(a), a;
|
|
2703
2724
|
}
|
|
2704
|
-
function
|
|
2705
|
-
let e = new URLSearchParams(window.location.search), t = e.get(
|
|
2725
|
+
function Wr() {
|
|
2726
|
+
let e = new URLSearchParams(window.location.search), t = e.get(g), n = e.get(h);
|
|
2706
2727
|
return t && n ? {
|
|
2707
2728
|
token: t,
|
|
2708
2729
|
provider: n
|
|
2709
2730
|
} : null;
|
|
2710
2731
|
}
|
|
2711
|
-
function
|
|
2712
|
-
let e = new URLSearchParams(window.location.search), t = e.get(
|
|
2732
|
+
function Gr() {
|
|
2733
|
+
let e = new URLSearchParams(window.location.search), t = e.get(p), n = e.get(h);
|
|
2713
2734
|
return t && n ? {
|
|
2714
2735
|
code: t,
|
|
2715
2736
|
provider: n
|
|
2716
2737
|
} : null;
|
|
2717
2738
|
}
|
|
2718
|
-
async function
|
|
2719
|
-
let r =
|
|
2739
|
+
async function Kr(e, t, n) {
|
|
2740
|
+
let r = Te();
|
|
2720
2741
|
if (!r) throw Error("This sign-in was started in a different browser or tab");
|
|
2721
2742
|
let i = await X(await C(n), "/oauth/exchange", {
|
|
2722
2743
|
method: "POST",
|
|
@@ -2726,7 +2747,7 @@ async function Hr(e, t, n) {
|
|
|
2726
2747
|
codeVerifier: r,
|
|
2727
2748
|
supportsRefresh: !0
|
|
2728
2749
|
}),
|
|
2729
|
-
signal:
|
|
2750
|
+
signal: x(Ir)
|
|
2730
2751
|
});
|
|
2731
2752
|
if (!i.ok) throw Error("Could not complete the sign-in");
|
|
2732
2753
|
let { token: a, expiresAt: o } = await i.json(), s = {
|
|
@@ -2735,20 +2756,20 @@ async function Hr(e, t, n) {
|
|
|
2735
2756
|
authenticatedAt: Date.now(),
|
|
2736
2757
|
expiresAt: o
|
|
2737
2758
|
};
|
|
2738
|
-
return o ?
|
|
2759
|
+
return o ? Dr({
|
|
2739
2760
|
provider: t,
|
|
2740
2761
|
authenticatedAt: s.authenticatedAt,
|
|
2741
2762
|
renewedAt: s.authenticatedAt
|
|
2742
2763
|
}) : q(s), s;
|
|
2743
2764
|
}
|
|
2744
|
-
async function
|
|
2765
|
+
async function qr(e) {
|
|
2745
2766
|
let t = E();
|
|
2746
2767
|
if (t === null) return null;
|
|
2747
2768
|
let n;
|
|
2748
2769
|
try {
|
|
2749
2770
|
n = await fetch(`${t}/session/refresh`, {
|
|
2750
2771
|
method: "POST",
|
|
2751
|
-
signal:
|
|
2772
|
+
signal: x(Lr)
|
|
2752
2773
|
});
|
|
2753
2774
|
} catch (e) {
|
|
2754
2775
|
let n = e instanceof Error ? `${e.name}: ${e.message}` : String(e);
|
|
@@ -2764,25 +2785,25 @@ async function Ur(e) {
|
|
|
2764
2785
|
expiresAt: i
|
|
2765
2786
|
};
|
|
2766
2787
|
}
|
|
2767
|
-
function
|
|
2788
|
+
function Jr() {
|
|
2768
2789
|
let e = new URLSearchParams(window.location.search), t = e.get("error");
|
|
2769
2790
|
return t ? {
|
|
2770
2791
|
code: t,
|
|
2771
|
-
provider: e.get(
|
|
2792
|
+
provider: e.get(h)
|
|
2772
2793
|
} : null;
|
|
2773
2794
|
}
|
|
2774
|
-
function
|
|
2775
|
-
return
|
|
2795
|
+
function Yr() {
|
|
2796
|
+
return ue();
|
|
2776
2797
|
}
|
|
2777
|
-
var
|
|
2798
|
+
var Xr = {
|
|
2778
2799
|
google: "Google",
|
|
2779
2800
|
facebook: "Facebook",
|
|
2780
2801
|
apple: "Apple",
|
|
2781
2802
|
microsoft: "Microsoft",
|
|
2782
2803
|
signicat: "eID"
|
|
2783
2804
|
};
|
|
2784
|
-
function
|
|
2785
|
-
let r = t ?
|
|
2805
|
+
function Zr(e, t, n) {
|
|
2806
|
+
let r = t ? Xr[t] ?? t : "this provider";
|
|
2786
2807
|
switch (e) {
|
|
2787
2808
|
case "account_exists_unverified_email": {
|
|
2788
2809
|
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.`;
|
|
@@ -2793,23 +2814,23 @@ function qr(e, t, n) {
|
|
|
2793
2814
|
default: return e;
|
|
2794
2815
|
}
|
|
2795
2816
|
}
|
|
2796
|
-
function
|
|
2817
|
+
function Qr() {
|
|
2797
2818
|
let e = new URLSearchParams(window.location.search);
|
|
2798
2819
|
for (let t of [
|
|
2820
|
+
g,
|
|
2799
2821
|
p,
|
|
2800
|
-
|
|
2801
|
-
f,
|
|
2822
|
+
h,
|
|
2802
2823
|
"error",
|
|
2803
|
-
|
|
2824
|
+
m
|
|
2804
2825
|
]) e.delete(t);
|
|
2805
2826
|
let t = e.toString();
|
|
2806
2827
|
window.history.replaceState({}, "", t.length > 0 ? `${window.location.pathname}?${t}` : window.location.pathname);
|
|
2807
2828
|
}
|
|
2808
|
-
async function
|
|
2809
|
-
let i = r ?? window.location.origin + window.location.pathname + window.location.search, a = await
|
|
2829
|
+
async function $r(e, t, n, r) {
|
|
2830
|
+
let i = r ?? window.location.origin + window.location.pathname + window.location.search, a = await ie(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
|
|
2810
2831
|
return `${n}/oauth/${e}?space=${encodeURIComponent(t)}&return=${encodeURIComponent(i)}${o}`;
|
|
2811
2832
|
}
|
|
2812
|
-
async function
|
|
2833
|
+
async function ei(e) {
|
|
2813
2834
|
let t = await X(e, "/passkey/registration/options", {
|
|
2814
2835
|
method: "POST",
|
|
2815
2836
|
headers: { "Content-Type": "application/json" }
|
|
@@ -2820,7 +2841,7 @@ async function Xr(e) {
|
|
|
2820
2841
|
}
|
|
2821
2842
|
return t.json();
|
|
2822
2843
|
}
|
|
2823
|
-
async function
|
|
2844
|
+
async function ti(e, t, n) {
|
|
2824
2845
|
let r = await X(e, "/passkey/registration/verify", {
|
|
2825
2846
|
method: "POST",
|
|
2826
2847
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2840,7 +2861,7 @@ async function Zr(e, t, n) {
|
|
|
2840
2861
|
};
|
|
2841
2862
|
return q(a), a;
|
|
2842
2863
|
}
|
|
2843
|
-
async function
|
|
2864
|
+
async function ni(e, t) {
|
|
2844
2865
|
let n = await X(e, "/passkey/authentication/options", {
|
|
2845
2866
|
method: "POST",
|
|
2846
2867
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2852,7 +2873,7 @@ async function Qr(e, t) {
|
|
|
2852
2873
|
}
|
|
2853
2874
|
return n.json();
|
|
2854
2875
|
}
|
|
2855
|
-
async function
|
|
2876
|
+
async function ri(e, t) {
|
|
2856
2877
|
let n = await X(e, "/passkey/authentication/verify", {
|
|
2857
2878
|
method: "POST",
|
|
2858
2879
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2869,12 +2890,12 @@ async function $r(e, t) {
|
|
|
2869
2890
|
};
|
|
2870
2891
|
return q(i), i;
|
|
2871
2892
|
}
|
|
2872
|
-
async function
|
|
2893
|
+
async function ii(e, t) {
|
|
2873
2894
|
try {
|
|
2874
2895
|
await X(await C(t), "/logout", {
|
|
2875
2896
|
method: "POST",
|
|
2876
2897
|
headers: { Authorization: `Bearer ${e}` },
|
|
2877
|
-
signal:
|
|
2898
|
+
signal: x(Ir)
|
|
2878
2899
|
});
|
|
2879
2900
|
} catch {}
|
|
2880
2901
|
}
|
|
@@ -2887,30 +2908,30 @@ function Z(e) {
|
|
|
2887
2908
|
}
|
|
2888
2909
|
//#endregion
|
|
2889
2910
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js
|
|
2890
|
-
function
|
|
2911
|
+
function ai(e) {
|
|
2891
2912
|
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);
|
|
2892
2913
|
for (let e = 0; e < i.length; e++) o[e] = i.charCodeAt(e);
|
|
2893
2914
|
return a;
|
|
2894
2915
|
}
|
|
2895
2916
|
//#endregion
|
|
2896
2917
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js
|
|
2897
|
-
function
|
|
2898
|
-
return
|
|
2918
|
+
function oi() {
|
|
2919
|
+
return si.stubThis(globalThis?.PublicKeyCredential !== void 0 && typeof globalThis.PublicKeyCredential == "function");
|
|
2899
2920
|
}
|
|
2900
|
-
var
|
|
2921
|
+
var si = { stubThis: (e) => e };
|
|
2901
2922
|
//#endregion
|
|
2902
2923
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js
|
|
2903
|
-
function
|
|
2924
|
+
function ci(e) {
|
|
2904
2925
|
let { id: t } = e;
|
|
2905
2926
|
return {
|
|
2906
2927
|
...e,
|
|
2907
|
-
id:
|
|
2928
|
+
id: ai(t),
|
|
2908
2929
|
transports: e.transports
|
|
2909
2930
|
};
|
|
2910
2931
|
}
|
|
2911
2932
|
//#endregion
|
|
2912
2933
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js
|
|
2913
|
-
function
|
|
2934
|
+
function li(e) {
|
|
2914
2935
|
return e === "localhost" || /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e);
|
|
2915
2936
|
}
|
|
2916
2937
|
//#endregion
|
|
@@ -2927,7 +2948,7 @@ var Q = class extends Error {
|
|
|
2927
2948
|
};
|
|
2928
2949
|
//#endregion
|
|
2929
2950
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js
|
|
2930
|
-
function
|
|
2951
|
+
function ui({ error: e, options: t }) {
|
|
2931
2952
|
let { publicKey: n } = t;
|
|
2932
2953
|
if (!n) throw Error("options was missing required publicKey property");
|
|
2933
2954
|
if (e.name === "AbortError") {
|
|
@@ -2973,7 +2994,7 @@ function oi({ error: e, options: t }) {
|
|
|
2973
2994
|
});
|
|
2974
2995
|
else if (e.name === "SecurityError") {
|
|
2975
2996
|
let t = globalThis.location.hostname;
|
|
2976
|
-
if (!
|
|
2997
|
+
if (!li(t)) return new Q({
|
|
2977
2998
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
2978
2999
|
code: "ERROR_INVALID_DOMAIN",
|
|
2979
3000
|
cause: e
|
|
@@ -2996,7 +3017,7 @@ function oi({ error: e, options: t }) {
|
|
|
2996
3017
|
});
|
|
2997
3018
|
return e;
|
|
2998
3019
|
}
|
|
2999
|
-
var
|
|
3020
|
+
var di = new class {
|
|
3000
3021
|
constructor() {
|
|
3001
3022
|
Object.defineProperty(this, "controller", {
|
|
3002
3023
|
enumerable: !0,
|
|
@@ -3019,31 +3040,31 @@ var si = new class {
|
|
|
3019
3040
|
e.name = "AbortError", this.controller.abort(e), this.controller = void 0;
|
|
3020
3041
|
}
|
|
3021
3042
|
}
|
|
3022
|
-
}(),
|
|
3023
|
-
function
|
|
3024
|
-
if (e && !(
|
|
3043
|
+
}(), fi = ["cross-platform", "platform"];
|
|
3044
|
+
function pi(e) {
|
|
3045
|
+
if (e && !(fi.indexOf(e) < 0)) return e;
|
|
3025
3046
|
}
|
|
3026
3047
|
//#endregion
|
|
3027
3048
|
//#region ../../node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js
|
|
3028
|
-
async function
|
|
3049
|
+
async function mi(e) {
|
|
3029
3050
|
!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 });
|
|
3030
3051
|
let { optionsJSON: t, useAutoRegister: n = !1 } = e;
|
|
3031
|
-
if (!
|
|
3052
|
+
if (!oi()) throw Error("WebAuthn is not supported in this browser");
|
|
3032
3053
|
let r = {
|
|
3033
3054
|
...t,
|
|
3034
|
-
challenge:
|
|
3055
|
+
challenge: ai(t.challenge),
|
|
3035
3056
|
user: {
|
|
3036
3057
|
...t.user,
|
|
3037
|
-
id:
|
|
3058
|
+
id: ai(t.user.id)
|
|
3038
3059
|
},
|
|
3039
|
-
excludeCredentials: t.excludeCredentials?.map(
|
|
3060
|
+
excludeCredentials: t.excludeCredentials?.map(ci)
|
|
3040
3061
|
}, i = {};
|
|
3041
|
-
n && (i.mediation = "conditional"), i.publicKey = r, i.signal =
|
|
3062
|
+
n && (i.mediation = "conditional"), i.publicKey = r, i.signal = di.createNewAbortSignal();
|
|
3042
3063
|
let a;
|
|
3043
3064
|
try {
|
|
3044
3065
|
a = await navigator.credentials.create(i);
|
|
3045
3066
|
} catch (e) {
|
|
3046
|
-
throw
|
|
3067
|
+
throw ui({
|
|
3047
3068
|
error: e,
|
|
3048
3069
|
options: i
|
|
3049
3070
|
});
|
|
@@ -3055,20 +3076,20 @@ async function ui(e) {
|
|
|
3055
3076
|
if (typeof c.getPublicKeyAlgorithm == "function") try {
|
|
3056
3077
|
d = c.getPublicKeyAlgorithm();
|
|
3057
3078
|
} catch (e) {
|
|
3058
|
-
|
|
3079
|
+
hi("getPublicKeyAlgorithm()", e);
|
|
3059
3080
|
}
|
|
3060
3081
|
let f;
|
|
3061
3082
|
if (typeof c.getPublicKey == "function") try {
|
|
3062
3083
|
let e = c.getPublicKey();
|
|
3063
3084
|
e !== null && (f = Z(e));
|
|
3064
3085
|
} catch (e) {
|
|
3065
|
-
|
|
3086
|
+
hi("getPublicKey()", e);
|
|
3066
3087
|
}
|
|
3067
3088
|
let p;
|
|
3068
3089
|
if (typeof c.getAuthenticatorData == "function") try {
|
|
3069
3090
|
p = Z(c.getAuthenticatorData());
|
|
3070
3091
|
} catch (e) {
|
|
3071
|
-
|
|
3092
|
+
hi("getAuthenticatorData()", e);
|
|
3072
3093
|
}
|
|
3073
3094
|
return {
|
|
3074
3095
|
id: o,
|
|
@@ -3083,23 +3104,23 @@ async function ui(e) {
|
|
|
3083
3104
|
},
|
|
3084
3105
|
type: l,
|
|
3085
3106
|
clientExtensionResults: a.getClientExtensionResults(),
|
|
3086
|
-
authenticatorAttachment:
|
|
3107
|
+
authenticatorAttachment: pi(a.authenticatorAttachment)
|
|
3087
3108
|
};
|
|
3088
3109
|
}
|
|
3089
|
-
function
|
|
3110
|
+
function hi(e, t) {
|
|
3090
3111
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`, t);
|
|
3091
3112
|
}
|
|
3092
3113
|
//#endregion
|
|
3093
3114
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js
|
|
3094
|
-
function
|
|
3095
|
-
if (!
|
|
3115
|
+
function gi() {
|
|
3116
|
+
if (!oi()) return _i.stubThis(new Promise((e) => e(!1)));
|
|
3096
3117
|
let e = globalThis.PublicKeyCredential;
|
|
3097
|
-
return e?.isConditionalMediationAvailable === void 0 ?
|
|
3118
|
+
return e?.isConditionalMediationAvailable === void 0 ? _i.stubThis(new Promise((e) => e(!1))) : _i.stubThis(e.isConditionalMediationAvailable());
|
|
3098
3119
|
}
|
|
3099
|
-
var
|
|
3120
|
+
var _i = { stubThis: (e) => e };
|
|
3100
3121
|
//#endregion
|
|
3101
3122
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js
|
|
3102
|
-
function
|
|
3123
|
+
function vi({ error: e, options: t }) {
|
|
3103
3124
|
let { publicKey: n } = t;
|
|
3104
3125
|
if (!n) throw Error("options was missing required publicKey property");
|
|
3105
3126
|
if (e.name === "AbortError") {
|
|
@@ -3115,7 +3136,7 @@ function mi({ error: e, options: t }) {
|
|
|
3115
3136
|
});
|
|
3116
3137
|
else if (e.name === "SecurityError") {
|
|
3117
3138
|
let t = globalThis.location.hostname;
|
|
3118
|
-
if (!
|
|
3139
|
+
if (!li(t)) return new Q({
|
|
3119
3140
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
3120
3141
|
code: "ERROR_INVALID_DOMAIN",
|
|
3121
3142
|
cause: e
|
|
@@ -3134,28 +3155,28 @@ function mi({ error: e, options: t }) {
|
|
|
3134
3155
|
}
|
|
3135
3156
|
//#endregion
|
|
3136
3157
|
//#region ../../node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js
|
|
3137
|
-
async function
|
|
3158
|
+
async function yi(e) {
|
|
3138
3159
|
!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 });
|
|
3139
3160
|
let { optionsJSON: t, useBrowserAutofill: n = !1, verifyBrowserAutofillInput: r = !0 } = e;
|
|
3140
|
-
if (!
|
|
3161
|
+
if (!oi()) throw Error("WebAuthn is not supported in this browser");
|
|
3141
3162
|
let i;
|
|
3142
|
-
t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(
|
|
3163
|
+
t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(ci));
|
|
3143
3164
|
let a = {
|
|
3144
3165
|
...t,
|
|
3145
|
-
challenge:
|
|
3166
|
+
challenge: ai(t.challenge),
|
|
3146
3167
|
allowCredentials: i
|
|
3147
3168
|
}, o = {};
|
|
3148
3169
|
if (n) {
|
|
3149
|
-
if (!await
|
|
3170
|
+
if (!await gi()) throw Error("Browser does not support WebAuthn autofill");
|
|
3150
3171
|
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");
|
|
3151
3172
|
o.mediation = "conditional", a.allowCredentials = [];
|
|
3152
3173
|
}
|
|
3153
|
-
o.publicKey = a, o.signal =
|
|
3174
|
+
o.publicKey = a, o.signal = di.createNewAbortSignal();
|
|
3154
3175
|
let s;
|
|
3155
3176
|
try {
|
|
3156
3177
|
s = await navigator.credentials.get(o);
|
|
3157
3178
|
} catch (e) {
|
|
3158
|
-
throw
|
|
3179
|
+
throw vi({
|
|
3159
3180
|
error: e,
|
|
3160
3181
|
options: o
|
|
3161
3182
|
});
|
|
@@ -3173,26 +3194,26 @@ async function hi(e) {
|
|
|
3173
3194
|
},
|
|
3174
3195
|
type: d,
|
|
3175
3196
|
clientExtensionResults: s.getClientExtensionResults(),
|
|
3176
|
-
authenticatorAttachment:
|
|
3197
|
+
authenticatorAttachment: pi(s.authenticatorAttachment)
|
|
3177
3198
|
};
|
|
3178
3199
|
}
|
|
3179
3200
|
//#endregion
|
|
3180
3201
|
//#region src/auth/auth-context.tsx
|
|
3181
|
-
var
|
|
3182
|
-
async function
|
|
3202
|
+
var bi = "/dev-login-token", xi = "X-Ikon-Dev-Login-Run";
|
|
3203
|
+
async function Si(e) {
|
|
3183
3204
|
let t = typeof window < "u" ? window.__IKON_LOCAL_IKON_SERVER_CONFIG__ : void 0;
|
|
3184
3205
|
if (!(!t?.enabled || !t.host || !t.port)) try {
|
|
3185
|
-
let n = await fetch(`https://${t.host}:${t.port}${
|
|
3206
|
+
let n = await fetch(`https://${t.host}:${t.port}${bi}`, {
|
|
3186
3207
|
cache: "no-store",
|
|
3187
|
-
headers: { [
|
|
3208
|
+
headers: { [xi]: e }
|
|
3188
3209
|
});
|
|
3189
3210
|
return n.ok && (await n.json()).token || void 0;
|
|
3190
3211
|
} catch {
|
|
3191
3212
|
return;
|
|
3192
3213
|
}
|
|
3193
3214
|
}
|
|
3194
|
-
var
|
|
3195
|
-
function
|
|
3215
|
+
var Ci = De(null), wi = 12e4, Ti = 6e4;
|
|
3216
|
+
function Ei({ children: e, config: n }) {
|
|
3196
3217
|
let [r, i] = N({
|
|
3197
3218
|
isAuthenticated: !1,
|
|
3198
3219
|
isLoading: !0,
|
|
@@ -3202,9 +3223,9 @@ function Si({ children: e, config: n }) {
|
|
|
3202
3223
|
if (!c.current) {
|
|
3203
3224
|
c.current = !0;
|
|
3204
3225
|
try {
|
|
3205
|
-
let t = await
|
|
3226
|
+
let t = await qr(e);
|
|
3206
3227
|
if (t === null) {
|
|
3207
|
-
|
|
3228
|
+
Ar(), i({
|
|
3208
3229
|
isAuthenticated: !1,
|
|
3209
3230
|
isLoading: !1,
|
|
3210
3231
|
user: null,
|
|
@@ -3212,7 +3233,7 @@ function Si({ children: e, config: n }) {
|
|
|
3212
3233
|
});
|
|
3213
3234
|
return;
|
|
3214
3235
|
}
|
|
3215
|
-
|
|
3236
|
+
kr(), i({
|
|
3216
3237
|
isAuthenticated: !0,
|
|
3217
3238
|
isLoading: !1,
|
|
3218
3239
|
user: J(t),
|
|
@@ -3226,24 +3247,24 @@ function Si({ children: e, config: n }) {
|
|
|
3226
3247
|
k(() => {
|
|
3227
3248
|
(() => {
|
|
3228
3249
|
if (s.current) return;
|
|
3229
|
-
let e = n.devLoginRunId, t = !!e &&
|
|
3230
|
-
e && !
|
|
3231
|
-
let r = !!n.devLoginToken && !!e && !t && !
|
|
3232
|
-
o ||
|
|
3233
|
-
let c =
|
|
3250
|
+
let e = n.devLoginRunId, t = !!e && Fr() === e && !Er();
|
|
3251
|
+
e && !Yr() && Pr(e);
|
|
3252
|
+
let r = !!n.devLoginToken && !!e && !t && !Yr();
|
|
3253
|
+
o || jr();
|
|
3254
|
+
let c = Jr();
|
|
3234
3255
|
if (c) {
|
|
3235
|
-
|
|
3256
|
+
Qr(), i({
|
|
3236
3257
|
isAuthenticated: !1,
|
|
3237
3258
|
isLoading: !1,
|
|
3238
3259
|
user: null,
|
|
3239
|
-
error:
|
|
3260
|
+
error: Zr(c.code, c.provider, { emailSignInAvailable: a })
|
|
3240
3261
|
});
|
|
3241
3262
|
return;
|
|
3242
3263
|
}
|
|
3243
|
-
|
|
3244
|
-
let l =
|
|
3264
|
+
ne();
|
|
3265
|
+
let l = Gr();
|
|
3245
3266
|
if (l) {
|
|
3246
|
-
s.current = !0,
|
|
3267
|
+
s.current = !0, Qr(), Kr(l.code, l.provider, n.authUrl).then((e) => {
|
|
3247
3268
|
i({
|
|
3248
3269
|
isAuthenticated: !0,
|
|
3249
3270
|
isLoading: !1,
|
|
@@ -3260,14 +3281,14 @@ function Si({ children: e, config: n }) {
|
|
|
3260
3281
|
});
|
|
3261
3282
|
return;
|
|
3262
3283
|
}
|
|
3263
|
-
let u =
|
|
3284
|
+
let u = Wr();
|
|
3264
3285
|
if (u) {
|
|
3265
3286
|
let e = {
|
|
3266
3287
|
token: u.token,
|
|
3267
3288
|
provider: u.provider,
|
|
3268
3289
|
authenticatedAt: Date.now()
|
|
3269
3290
|
};
|
|
3270
|
-
q(e),
|
|
3291
|
+
q(e), Qr(), i({
|
|
3271
3292
|
isAuthenticated: !0,
|
|
3272
3293
|
isLoading: !1,
|
|
3273
3294
|
user: J(e),
|
|
@@ -3275,11 +3296,11 @@ function Si({ children: e, config: n }) {
|
|
|
3275
3296
|
});
|
|
3276
3297
|
return;
|
|
3277
3298
|
}
|
|
3278
|
-
let d =
|
|
3299
|
+
let d = Or();
|
|
3279
3300
|
if (d) {
|
|
3280
|
-
s.current = !0,
|
|
3301
|
+
s.current = !0, qr(d).then((e) => {
|
|
3281
3302
|
if (e === null) {
|
|
3282
|
-
|
|
3303
|
+
Ar(), i({
|
|
3283
3304
|
isAuthenticated: !1,
|
|
3284
3305
|
isLoading: !1,
|
|
3285
3306
|
user: null,
|
|
@@ -3287,7 +3308,7 @@ function Si({ children: e, config: n }) {
|
|
|
3287
3308
|
});
|
|
3288
3309
|
return;
|
|
3289
3310
|
}
|
|
3290
|
-
|
|
3311
|
+
kr(), i({
|
|
3291
3312
|
isAuthenticated: !0,
|
|
3292
3313
|
isLoading: !1,
|
|
3293
3314
|
user: J(e),
|
|
@@ -3303,7 +3324,7 @@ function Si({ children: e, config: n }) {
|
|
|
3303
3324
|
});
|
|
3304
3325
|
return;
|
|
3305
3326
|
}
|
|
3306
|
-
let f =
|
|
3327
|
+
let f = Tr();
|
|
3307
3328
|
if (f && !(r && f.provider === "anonymous")) {
|
|
3308
3329
|
i({
|
|
3309
3330
|
isAuthenticated: !0,
|
|
@@ -3319,7 +3340,7 @@ function Si({ children: e, config: n }) {
|
|
|
3319
3340
|
token: e,
|
|
3320
3341
|
provider: "dev",
|
|
3321
3342
|
authenticatedAt: Date.now(),
|
|
3322
|
-
expiresAt:
|
|
3343
|
+
expiresAt: wr(e)
|
|
3323
3344
|
};
|
|
3324
3345
|
q(t), i({
|
|
3325
3346
|
isAuthenticated: !0,
|
|
@@ -3328,12 +3349,12 @@ function Si({ children: e, config: n }) {
|
|
|
3328
3349
|
error: null
|
|
3329
3350
|
});
|
|
3330
3351
|
};
|
|
3331
|
-
if (!
|
|
3352
|
+
if (!Cr(n.devLoginToken)) {
|
|
3332
3353
|
t(n.devLoginToken);
|
|
3333
3354
|
return;
|
|
3334
3355
|
}
|
|
3335
|
-
|
|
3336
|
-
if (e && !
|
|
3356
|
+
Si(e).then((e) => {
|
|
3357
|
+
if (e && !Cr(e)) {
|
|
3337
3358
|
t(e);
|
|
3338
3359
|
return;
|
|
3339
3360
|
}
|
|
@@ -3360,8 +3381,8 @@ function Si({ children: e, config: n }) {
|
|
|
3360
3381
|
a,
|
|
3361
3382
|
o
|
|
3362
3383
|
]), k(() => {
|
|
3363
|
-
if (n.spaceId) return
|
|
3364
|
-
s.current = !0, e.codeVerifier &&
|
|
3384
|
+
if (n.spaceId) return ge(n.spaceId, (e) => {
|
|
3385
|
+
s.current = !0, e.codeVerifier && be(e.codeVerifier), Kr(e.code, e.provider, n.authUrl).then((e) => {
|
|
3365
3386
|
i({
|
|
3366
3387
|
isAuthenticated: !0,
|
|
3367
3388
|
isLoading: !1,
|
|
@@ -3380,9 +3401,9 @@ function Si({ children: e, config: n }) {
|
|
|
3380
3401
|
}, [n.spaceId, n.authUrl]), k(() => {
|
|
3381
3402
|
let e = r.user?.expiresAt;
|
|
3382
3403
|
if (!e || r.user?.provider === "dev") return;
|
|
3383
|
-
let t =
|
|
3404
|
+
let t = Or();
|
|
3384
3405
|
if (!t) return;
|
|
3385
|
-
let n = Date.parse(e) -
|
|
3406
|
+
let n = Date.parse(e) - wi, i = setTimeout(() => void l(t), Math.max(0, n - Date.now())), a = () => {
|
|
3386
3407
|
document.visibilityState === "visible" && Date.now() >= n && l(t);
|
|
3387
3408
|
};
|
|
3388
3409
|
return document.addEventListener("visibilitychange", a), () => {
|
|
@@ -3398,20 +3419,20 @@ function Si({ children: e, config: n }) {
|
|
|
3398
3419
|
if (!e) return;
|
|
3399
3420
|
let t = r.user.expiresAt;
|
|
3400
3421
|
if (!t) return;
|
|
3401
|
-
let a = r.user.token, o = Date.parse(t) -
|
|
3422
|
+
let a = r.user.token, o = Date.parse(t) - wi, s, c = !1, l = !1, u = async () => {
|
|
3402
3423
|
if (c || l) return;
|
|
3403
3424
|
l = !0;
|
|
3404
|
-
let t = await
|
|
3425
|
+
let t = await Si(e);
|
|
3405
3426
|
if (l = !1, c) return;
|
|
3406
|
-
if (!t || t === a ||
|
|
3407
|
-
s = setTimeout(() => void u(),
|
|
3427
|
+
if (!t || t === a || Cr(t)) {
|
|
3428
|
+
s = setTimeout(() => void u(), Ti);
|
|
3408
3429
|
return;
|
|
3409
3430
|
}
|
|
3410
3431
|
let n = {
|
|
3411
3432
|
token: t,
|
|
3412
3433
|
provider: "dev",
|
|
3413
3434
|
authenticatedAt: Date.now(),
|
|
3414
|
-
expiresAt:
|
|
3435
|
+
expiresAt: wr(t)
|
|
3415
3436
|
};
|
|
3416
3437
|
q(n), i({
|
|
3417
3438
|
isAuthenticated: !0,
|
|
@@ -3458,7 +3479,7 @@ function Si({ children: e, config: n }) {
|
|
|
3458
3479
|
isLoading: !0
|
|
3459
3480
|
}));
|
|
3460
3481
|
try {
|
|
3461
|
-
let r = await
|
|
3482
|
+
let r = await Vr(n.spaceId, t, e);
|
|
3462
3483
|
i({
|
|
3463
3484
|
isAuthenticated: !0,
|
|
3464
3485
|
isLoading: !1,
|
|
@@ -3481,7 +3502,7 @@ function Si({ children: e, config: n }) {
|
|
|
3481
3502
|
error: null
|
|
3482
3503
|
}));
|
|
3483
3504
|
try {
|
|
3484
|
-
let e = await
|
|
3505
|
+
let e = await yi({ optionsJSON: await ni(t) }), n = await ri(t, e);
|
|
3485
3506
|
i({
|
|
3486
3507
|
isAuthenticated: !0,
|
|
3487
3508
|
isLoading: !1,
|
|
@@ -3498,22 +3519,22 @@ function Si({ children: e, config: n }) {
|
|
|
3498
3519
|
return;
|
|
3499
3520
|
}
|
|
3500
3521
|
if (e === "email") throw Error("login('email') is not supported. Use requestEmailCode()/submitEmailCode() from useAuth() instead.");
|
|
3501
|
-
if (
|
|
3502
|
-
await
|
|
3522
|
+
if (me()) {
|
|
3523
|
+
await Se(e, n.spaceId) || i((e) => ({
|
|
3503
3524
|
...e,
|
|
3504
3525
|
isLoading: !1,
|
|
3505
3526
|
error: "The sign-in window did not complete. Allow pop-ups for this site and try again."
|
|
3506
3527
|
}));
|
|
3507
3528
|
return;
|
|
3508
3529
|
}
|
|
3509
|
-
window.location.href = await
|
|
3530
|
+
window.location.href = await $r(e, n.spaceId, t);
|
|
3510
3531
|
}, [n.authUrl, n.spaceId]), d = O(async (e) => {
|
|
3511
3532
|
if (!n.spaceId) throw i((e) => ({
|
|
3512
3533
|
...e,
|
|
3513
3534
|
error: "Space ID is not configured"
|
|
3514
3535
|
})), Error("Space ID is not configured");
|
|
3515
3536
|
let t = await C(n.authUrl);
|
|
3516
|
-
await
|
|
3537
|
+
await Hr({
|
|
3517
3538
|
email: e,
|
|
3518
3539
|
spaceId: n.spaceId,
|
|
3519
3540
|
authUrl: t
|
|
@@ -3525,7 +3546,7 @@ function Si({ children: e, config: n }) {
|
|
|
3525
3546
|
error: null
|
|
3526
3547
|
}));
|
|
3527
3548
|
try {
|
|
3528
|
-
let r = await
|
|
3549
|
+
let r = await Ur({
|
|
3529
3550
|
email: e,
|
|
3530
3551
|
code: t,
|
|
3531
3552
|
authUrl: await C(n.authUrl)
|
|
@@ -3546,7 +3567,7 @@ function Si({ children: e, config: n }) {
|
|
|
3546
3567
|
}
|
|
3547
3568
|
}, [n.authUrl]), p = O(() => {
|
|
3548
3569
|
let e = r.user?.token;
|
|
3549
|
-
e &&
|
|
3570
|
+
e && ii(e, n.authUrl), Nr(), Ar(), t.clearAll(), i({
|
|
3550
3571
|
isAuthenticated: !1,
|
|
3551
3572
|
isLoading: !1,
|
|
3552
3573
|
user: null,
|
|
@@ -3560,7 +3581,7 @@ function Si({ children: e, config: n }) {
|
|
|
3560
3581
|
error: null
|
|
3561
3582
|
}));
|
|
3562
3583
|
try {
|
|
3563
|
-
let n = await
|
|
3584
|
+
let n = await ti(t, await mi({ optionsJSON: await ei(t) }), e);
|
|
3564
3585
|
i({
|
|
3565
3586
|
isAuthenticated: !0,
|
|
3566
3587
|
isLoading: !1,
|
|
@@ -3591,37 +3612,37 @@ function Si({ children: e, config: n }) {
|
|
|
3591
3612
|
d,
|
|
3592
3613
|
f
|
|
3593
3614
|
]);
|
|
3594
|
-
return /* @__PURE__ */ P(
|
|
3615
|
+
return /* @__PURE__ */ P(Ci, {
|
|
3595
3616
|
value: g,
|
|
3596
3617
|
children: e
|
|
3597
3618
|
});
|
|
3598
3619
|
}
|
|
3599
|
-
function
|
|
3600
|
-
let e =
|
|
3620
|
+
function Di() {
|
|
3621
|
+
let e = Oe(Ci);
|
|
3601
3622
|
if (!e) throw Error("useAuth must be used within an AuthProvider");
|
|
3602
3623
|
return e;
|
|
3603
3624
|
}
|
|
3604
|
-
function
|
|
3605
|
-
return
|
|
3625
|
+
function Oi() {
|
|
3626
|
+
return Oe(Ci);
|
|
3606
3627
|
}
|
|
3607
3628
|
//#endregion
|
|
3608
3629
|
//#region src/auth/oauth-continuation.ts
|
|
3609
|
-
var
|
|
3610
|
-
function
|
|
3630
|
+
var ki = "ikon-oauth", Ai = "ikon-oauth-continue", ji = "ikon-oauth-continue-attempts", Mi = 5, Ni = 6e5;
|
|
3631
|
+
function Pi() {
|
|
3611
3632
|
if (typeof window > "u") return !1;
|
|
3612
|
-
let e = new URL(window.location.href).searchParams.get(
|
|
3613
|
-
return e ? (
|
|
3633
|
+
let e = new URL(window.location.href).searchParams.get(ki);
|
|
3634
|
+
return e ? (Bi(e), !0) : zi() !== null;
|
|
3614
3635
|
}
|
|
3615
|
-
function
|
|
3616
|
-
return
|
|
3636
|
+
function Fi() {
|
|
3637
|
+
return Ii() !== null;
|
|
3617
3638
|
}
|
|
3618
|
-
function
|
|
3619
|
-
return typeof window > "u" ? null : new URL(window.location.href).searchParams.get("ikon-oauth") ??
|
|
3639
|
+
function Ii() {
|
|
3640
|
+
return typeof window > "u" ? null : new URL(window.location.href).searchParams.get("ikon-oauth") ?? zi();
|
|
3620
3641
|
}
|
|
3621
|
-
async function
|
|
3622
|
-
let t =
|
|
3642
|
+
async function Li(e) {
|
|
3643
|
+
let t = Ii();
|
|
3623
3644
|
if (!t) return !1;
|
|
3624
|
-
if (!e) return
|
|
3645
|
+
if (!e) return Ri() < Mi ? (console.warn("[ikon] Waiting for the signed-in session before continuing the authorization that sent you here."), !1) : (Vi(), 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);
|
|
3625
3646
|
try {
|
|
3626
3647
|
let n = await fetch("/ikon/oauth/continue", {
|
|
3627
3648
|
method: "POST",
|
|
@@ -3631,62 +3652,62 @@ async function Ni(e) {
|
|
|
3631
3652
|
},
|
|
3632
3653
|
body: JSON.stringify({ continueId: t })
|
|
3633
3654
|
});
|
|
3634
|
-
if (!n.ok) return
|
|
3655
|
+
if (!n.ok) return Vi(), console.warn(`[ikon] Could not continue the authorization that sent you here (${n.status}). Start the connection again from the application.`), !1;
|
|
3635
3656
|
let { consentUrl: r } = await n.json();
|
|
3636
|
-
return r ? (
|
|
3657
|
+
return r ? (Vi(), window.location.href = r, !0) : (Vi(), console.warn("[ikon] The authorization that sent you here returned no consent step. Start the connection again from the application."), !1);
|
|
3637
3658
|
} catch {
|
|
3638
3659
|
return !1;
|
|
3639
3660
|
}
|
|
3640
3661
|
}
|
|
3641
|
-
function
|
|
3662
|
+
function Ri() {
|
|
3642
3663
|
try {
|
|
3643
|
-
let e = Number(sessionStorage.getItem(
|
|
3644
|
-
return sessionStorage.setItem(
|
|
3664
|
+
let e = Number(sessionStorage.getItem(ji) ?? "0") + 1;
|
|
3665
|
+
return sessionStorage.setItem(ji, String(e)), e;
|
|
3645
3666
|
} catch {
|
|
3646
|
-
return
|
|
3667
|
+
return Mi;
|
|
3647
3668
|
}
|
|
3648
3669
|
}
|
|
3649
|
-
function
|
|
3670
|
+
function zi() {
|
|
3650
3671
|
try {
|
|
3651
|
-
let e = sessionStorage.getItem(
|
|
3672
|
+
let e = sessionStorage.getItem(Ai);
|
|
3652
3673
|
if (!e) return null;
|
|
3653
3674
|
let { id: t, at: n } = JSON.parse(e);
|
|
3654
|
-
return !t || typeof n != "number" || Date.now() - n >
|
|
3675
|
+
return !t || typeof n != "number" || Date.now() - n > Ni ? (Vi(), null) : t;
|
|
3655
3676
|
} catch {
|
|
3656
|
-
return
|
|
3677
|
+
return Vi(), null;
|
|
3657
3678
|
}
|
|
3658
3679
|
}
|
|
3659
|
-
function
|
|
3680
|
+
function Bi(e) {
|
|
3660
3681
|
try {
|
|
3661
|
-
sessionStorage.setItem(
|
|
3682
|
+
sessionStorage.setItem(Ai, JSON.stringify({
|
|
3662
3683
|
id: e,
|
|
3663
3684
|
at: Date.now()
|
|
3664
3685
|
}));
|
|
3665
3686
|
} catch {}
|
|
3666
3687
|
}
|
|
3667
|
-
function
|
|
3688
|
+
function Vi() {
|
|
3668
3689
|
try {
|
|
3669
|
-
sessionStorage.removeItem(
|
|
3690
|
+
sessionStorage.removeItem(Ai), sessionStorage.removeItem(ji);
|
|
3670
3691
|
} catch {}
|
|
3671
3692
|
try {
|
|
3672
3693
|
let e = new URL(window.location.href);
|
|
3673
|
-
e.searchParams.has("ikon-oauth") && (e.searchParams.delete(
|
|
3694
|
+
e.searchParams.has("ikon-oauth") && (e.searchParams.delete(ki), window.history.replaceState(null, "", e.toString()));
|
|
3674
3695
|
} catch {}
|
|
3675
3696
|
}
|
|
3676
3697
|
//#endregion
|
|
3677
3698
|
//#region src/auth/use-auth-guard.ts
|
|
3678
|
-
function
|
|
3679
|
-
let { config: t, guestUrlParam: n } = e, { state: r, login: i, getToken: a } =
|
|
3699
|
+
function Hi(e) {
|
|
3700
|
+
let { config: t, guestUrlParam: n } = e, { state: r, login: i, getToken: a } = Di(), o = M(!1), s = M(!1), c = Ae(Ce, T, T), l = c.required;
|
|
3680
3701
|
k(() => {
|
|
3681
|
-
|
|
3702
|
+
Pi() && xe("An application is asking to act as you. Sign in to review what it wants.");
|
|
3682
3703
|
}, []), k(() => {
|
|
3683
3704
|
if (!(!l || !r.isAuthenticated || !r.user || r.user.provider === "anonymous")) {
|
|
3684
|
-
if (!
|
|
3685
|
-
|
|
3705
|
+
if (!Fi()) {
|
|
3706
|
+
re();
|
|
3686
3707
|
return;
|
|
3687
3708
|
}
|
|
3688
|
-
s.current || (s.current = !0,
|
|
3689
|
-
(e || !
|
|
3709
|
+
s.current || (s.current = !0, Li(a()).then((e) => {
|
|
3710
|
+
(e || !Fi()) && re();
|
|
3690
3711
|
}).finally(() => {
|
|
3691
3712
|
s.current = !1;
|
|
3692
3713
|
}));
|
|
@@ -3701,7 +3722,7 @@ function Ri(e) {
|
|
|
3701
3722
|
let e = t.methods.includes("global") ? "global" : t.methods.includes("guest") ? "guest" : null;
|
|
3702
3723
|
if (!e) return;
|
|
3703
3724
|
let a = new URLSearchParams(window.location.search), s = a.get(n);
|
|
3704
|
-
if (s === "true" || s === "1" || s === "" ||
|
|
3725
|
+
if (s === "true" || s === "1" || s === "" || Yr()) {
|
|
3705
3726
|
a.delete(n);
|
|
3706
3727
|
let t = a.toString(), r = window.location.pathname + (t ? `?${t}` : "");
|
|
3707
3728
|
window.history.replaceState({}, "", r), o.current = !0, i(e);
|
|
@@ -3720,23 +3741,23 @@ function Ri(e) {
|
|
|
3720
3741
|
isAuthenticated: r.isAuthenticated,
|
|
3721
3742
|
error: r.error,
|
|
3722
3743
|
isLoginPrompt: l && !f,
|
|
3723
|
-
dismissLoginPrompt:
|
|
3744
|
+
dismissLoginPrompt: re,
|
|
3724
3745
|
loginPromptReason: l ? c.reason : null
|
|
3725
3746
|
};
|
|
3726
3747
|
}
|
|
3727
3748
|
//#endregion
|
|
3728
3749
|
//#region src/debug/debug-overlay.tsx
|
|
3729
|
-
var
|
|
3750
|
+
var Ui = (() => {
|
|
3730
3751
|
try {
|
|
3731
3752
|
return w();
|
|
3732
3753
|
} catch {
|
|
3733
3754
|
return !1;
|
|
3734
3755
|
}
|
|
3735
|
-
})(),
|
|
3736
|
-
function
|
|
3737
|
-
$.push(`[+${((Date.now() -
|
|
3756
|
+
})(), Wi = Date.now(), $ = [], Gi = 300;
|
|
3757
|
+
function Ki(e) {
|
|
3758
|
+
$.push(`[+${((Date.now() - Wi) / 1e3).toFixed(1)}s] ${e}`), $.length > Gi && $.shift();
|
|
3738
3759
|
}
|
|
3739
|
-
function
|
|
3760
|
+
function qi(e) {
|
|
3740
3761
|
if (typeof e == "string") return e;
|
|
3741
3762
|
if (e instanceof Error) return `${e.name}: ${e.message}`;
|
|
3742
3763
|
try {
|
|
@@ -3745,10 +3766,10 @@ function Ui(e) {
|
|
|
3745
3766
|
return String(e);
|
|
3746
3767
|
}
|
|
3747
3768
|
}
|
|
3748
|
-
var
|
|
3749
|
-
function
|
|
3750
|
-
if (
|
|
3751
|
-
|
|
3769
|
+
var Ji = !1;
|
|
3770
|
+
function Yi() {
|
|
3771
|
+
if (Ji || typeof window > "u") return;
|
|
3772
|
+
Ji = !0, window.addEventListener("error", (e) => Ki(`window.error: ${e.message} @ ${e.filename ?? "?"}:${e.lineno ?? "?"}:${e.colno ?? "?"}`)), window.addEventListener("unhandledrejection", (e) => Ki(`unhandledRejection: ${qi(e.reason)}`));
|
|
3752
3773
|
let e = console;
|
|
3753
3774
|
for (let t of [
|
|
3754
3775
|
"error",
|
|
@@ -3759,17 +3780,17 @@ function Gi() {
|
|
|
3759
3780
|
let n = e[t]?.bind(console) ?? (() => void 0);
|
|
3760
3781
|
e[t] = (...e) => {
|
|
3761
3782
|
try {
|
|
3762
|
-
|
|
3783
|
+
Ki(`console.${t}: ${e.map(qi).join(" ")}`);
|
|
3763
3784
|
} catch {}
|
|
3764
3785
|
n(...e);
|
|
3765
3786
|
};
|
|
3766
3787
|
}
|
|
3767
3788
|
try {
|
|
3768
|
-
|
|
3789
|
+
we((e) => Ki(`${e.levelName} [${e.component}] ${e.message}`), { minLevel: v.DEBUG });
|
|
3769
3790
|
} catch {}
|
|
3770
3791
|
}
|
|
3771
|
-
|
|
3772
|
-
function
|
|
3792
|
+
Ui && Yi();
|
|
3793
|
+
function Xi() {
|
|
3773
3794
|
let e = !1;
|
|
3774
3795
|
try {
|
|
3775
3796
|
let t = URL.createObjectURL(new Blob([""]));
|
|
@@ -3779,11 +3800,11 @@ function Ki() {
|
|
|
3779
3800
|
} catch {}
|
|
3780
3801
|
return e;
|
|
3781
3802
|
}
|
|
3782
|
-
function
|
|
3803
|
+
function Zi() {
|
|
3783
3804
|
let e = globalThis;
|
|
3784
3805
|
return [
|
|
3785
3806
|
`Worker=${typeof Worker < "u"}`,
|
|
3786
|
-
`moduleWorker=${
|
|
3807
|
+
`moduleWorker=${Xi()}`,
|
|
3787
3808
|
`WebSocket=${typeof WebSocket < "u"}`,
|
|
3788
3809
|
`WebTransport=${e.WebTransport !== void 0}`,
|
|
3789
3810
|
`RTCPeerConnection=${typeof RTCPeerConnection < "u"}`,
|
|
@@ -3796,14 +3817,14 @@ function qi() {
|
|
|
3796
3817
|
`online=${typeof navigator < "u" ? navigator.onLine : "?"}`
|
|
3797
3818
|
].join(" ");
|
|
3798
3819
|
}
|
|
3799
|
-
function
|
|
3820
|
+
function Qi(e) {
|
|
3800
3821
|
return /ERROR|error:|Rejection/.test(e) ? "#f88" : /WARN|warn:/.test(e) ? "#fc6" : "#9d9";
|
|
3801
3822
|
}
|
|
3802
|
-
function
|
|
3803
|
-
let n =
|
|
3823
|
+
function $i({ state: e = "", forceVisible: t = !1 }) {
|
|
3824
|
+
let n = Ui || t, r = e === "connected" || e === "reconnecting", [, i] = ke((e) => e + 1, 0), [a, o] = N(!0);
|
|
3804
3825
|
return k(() => {
|
|
3805
3826
|
if (!n) return;
|
|
3806
|
-
|
|
3827
|
+
Yi();
|
|
3807
3828
|
let e = setInterval(i, 1e3);
|
|
3808
3829
|
return () => clearInterval(e);
|
|
3809
3830
|
}, [n]), n ? r && a ? /* @__PURE__ */ F("button", {
|
|
@@ -3857,7 +3878,7 @@ function Yi({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3857
3878
|
"Ikon debug overlay — state: ",
|
|
3858
3879
|
e || "?",
|
|
3859
3880
|
", +",
|
|
3860
|
-
Math.round((Date.now() -
|
|
3881
|
+
Math.round((Date.now() - Wi) / 1e3),
|
|
3861
3882
|
"s, ",
|
|
3862
3883
|
$.length,
|
|
3863
3884
|
" entries",
|
|
@@ -3898,7 +3919,7 @@ function Yi({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3898
3919
|
color: "#8cf",
|
|
3899
3920
|
marginBottom: "4px"
|
|
3900
3921
|
},
|
|
3901
|
-
children:
|
|
3922
|
+
children: Zi()
|
|
3902
3923
|
}),
|
|
3903
3924
|
/* @__PURE__ */ P("div", {
|
|
3904
3925
|
style: {
|
|
@@ -3909,7 +3930,7 @@ function Yi({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3909
3930
|
}),
|
|
3910
3931
|
/* @__PURE__ */ P("div", { children: $.length === 0 ? "(nothing captured yet)" : $.map((e, t) => /* @__PURE__ */ P("div", {
|
|
3911
3932
|
style: {
|
|
3912
|
-
color:
|
|
3933
|
+
color: Qi(e),
|
|
3913
3934
|
wordBreak: "break-all"
|
|
3914
3935
|
},
|
|
3915
3936
|
children: e
|
|
@@ -3919,7 +3940,7 @@ function Yi({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3919
3940
|
}
|
|
3920
3941
|
//#endregion
|
|
3921
3942
|
//#region src/app/connection-state-renderer.tsx
|
|
3922
|
-
function
|
|
3943
|
+
function ea({ 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 }) {
|
|
3923
3944
|
let m = M(!1), h = (() => {
|
|
3924
3945
|
switch (e) {
|
|
3925
3946
|
case "waitingForExternalConnectUrl":
|
|
@@ -3945,252 +3966,252 @@ function Xi({ connectionState: e, error: t, isReady: n, isConnectingSlow: r, sto
|
|
|
3945
3966
|
default: return null;
|
|
3946
3967
|
}
|
|
3947
3968
|
})();
|
|
3948
|
-
return /* @__PURE__ */ F(
|
|
3969
|
+
return /* @__PURE__ */ F(je, { children: [h, /* @__PURE__ */ P($i, { state: e })] });
|
|
3949
3970
|
}
|
|
3950
3971
|
//#endregion
|
|
3951
3972
|
//#region src/app/boot-snapshot-variant.ts
|
|
3952
|
-
function
|
|
3973
|
+
function ta(e, t) {
|
|
3953
3974
|
return e === !1 ? !1 : t ? "signed-in" : "guest";
|
|
3954
3975
|
}
|
|
3955
3976
|
//#endregion
|
|
3956
3977
|
//#region src/app/use-ikon-app.ts
|
|
3957
|
-
var
|
|
3958
|
-
function
|
|
3978
|
+
var na = S("useIkonApp");
|
|
3979
|
+
function ra() {
|
|
3959
3980
|
if (typeof window < "u" && window.__IKON_AUTH_CONFIG__) return window.__IKON_AUTH_CONFIG__;
|
|
3960
3981
|
}
|
|
3961
|
-
function
|
|
3982
|
+
function ia() {
|
|
3962
3983
|
if (typeof window < "u" && window.__IKON_LOCAL_IKON_SERVER_CONFIG__) return window.__IKON_LOCAL_IKON_SERVER_CONFIG__;
|
|
3963
3984
|
}
|
|
3964
|
-
function
|
|
3985
|
+
function aa(e, t) {
|
|
3965
3986
|
return {
|
|
3966
3987
|
...e,
|
|
3967
3988
|
...t ?? {}
|
|
3968
3989
|
};
|
|
3969
3990
|
}
|
|
3970
|
-
function
|
|
3971
|
-
return e?.token ? `${e.provider}:${
|
|
3991
|
+
function oa(e) {
|
|
3992
|
+
return e?.token ? `${e.provider}:${se(e.token) ?? e.token}` : null;
|
|
3972
3993
|
}
|
|
3973
|
-
function
|
|
3974
|
-
let { authConfig: n, modules: r, parameters:
|
|
3975
|
-
|
|
3976
|
-
let [A,
|
|
3994
|
+
function sa(e) {
|
|
3995
|
+
let { authConfig: n, modules: r, parameters: f, timeouts: p, backgroundAudio: m, webRtc: h, audio: g, video: v, websocket: x, webtransport: ne, httpstream: re, proxy: S, liveSnapshot: ie, bootSnapshot: oe } = e, w = n === void 0 ? ra() ?? null : n, ce = ia(), T = Oi(), le = !!T && T.state.isLoading, E = M(null), ue = M(null), de = M(null), pe = M(!1), me = M(!1), he = M(m), ge = M(p), ve = M(h), be = M(g), xe = M(v), Se = M(x), Ce = M(ne), we = M(re), Te = M(S), Ee = M(ie), De = M(oe), D = M("local"), Oe = M(void 0);
|
|
3996
|
+
he.current = m, ge.current = p, ve.current = h, be.current = g, xe.current = v, Se.current = x, Ce.current = ne, we.current = re, Te.current = S, Ee.current = ie, De.current = oe;
|
|
3997
|
+
let [A, ke] = N("connecting"), [Ae, je] = N(!1), [P, F] = N(!1), [Me, I] = N(null), [Ne, Pe] = N(null), [Fe, Ie] = N(!1), [Le, Re] = N(!1), [ze, Be] = N(!1), [Ve, He] = N(null), [L, Ue] = N(null), [We, Ge] = N(!1), Ke = M(!1), [qe, Je] = N(0), [Ye, Xe] = N(0), R = j(() => {
|
|
3977
3998
|
try {
|
|
3978
|
-
return
|
|
3999
|
+
return _e();
|
|
3979
4000
|
} catch {
|
|
3980
4001
|
return { parameters: {} };
|
|
3981
4002
|
}
|
|
3982
|
-
}, []),
|
|
3983
|
-
|
|
3984
|
-
let
|
|
4003
|
+
}, []), Ze = JSON.stringify(f ?? {}), z = j(() => aa(R.parameters, f), [R.parameters, Ze]), $e = (w?.methods?.length ?? 0) > 0, B = ta(oe, $e && Mr());
|
|
4004
|
+
B !== !1 && !i() && a(B);
|
|
4005
|
+
let V = j(() => {
|
|
3985
4006
|
if (!w?.spaceId) return null;
|
|
3986
4007
|
let e = T?.state.user;
|
|
3987
4008
|
return e ? {
|
|
3988
4009
|
token: e.token,
|
|
3989
4010
|
provider: e.provider,
|
|
3990
4011
|
authenticatedAt: e.authenticatedAt
|
|
3991
|
-
} :
|
|
4012
|
+
} : Tr();
|
|
3992
4013
|
}, [
|
|
3993
4014
|
w?.spaceId,
|
|
3994
|
-
|
|
4015
|
+
qe,
|
|
3995
4016
|
T?.state.isLoading,
|
|
3996
4017
|
T?.state.isAuthenticated,
|
|
3997
4018
|
T?.state.user?.token
|
|
3998
|
-
]),
|
|
3999
|
-
|
|
4000
|
-
|
|
4019
|
+
]), H = ce?.enabled ?? !1, et = ce?.host ?? l, tt = ce?.port ?? u, nt = !le && !!w && !V && !w.requireSignIn && !!w.spaceId && (fe() || H);
|
|
4020
|
+
nt && !L && !We && !Ke.current && (Ke.current = !0, C(w.authUrl).then((e) => Vr(w.spaceId, e)).then((e) => {
|
|
4021
|
+
Ue(e.token), Ge(!0);
|
|
4001
4022
|
}).catch((e) => {
|
|
4002
|
-
|
|
4023
|
+
na.error("Anonymous auth failed:", e), Ke.current = !1, H ? Ge(!0) : I(e instanceof Error ? e.message : "Anonymous auth failed");
|
|
4003
4024
|
}));
|
|
4004
|
-
let
|
|
4005
|
-
|
|
4006
|
-
let
|
|
4007
|
-
if (
|
|
4008
|
-
if (
|
|
4009
|
-
if (
|
|
4010
|
-
let e =
|
|
4025
|
+
let rt = oa(V), U = M(void 0);
|
|
4026
|
+
U.current = V?.token ?? void 0;
|
|
4027
|
+
let it = j(() => {
|
|
4028
|
+
if (le) return null;
|
|
4029
|
+
if (H) {
|
|
4030
|
+
if (nt && !We) return null;
|
|
4031
|
+
let e = U.current ?? L ?? void 0, t = e ? se(e) ?? void 0 : void 0;
|
|
4011
4032
|
return { local: {
|
|
4012
|
-
host:
|
|
4013
|
-
httpsPort:
|
|
4033
|
+
host: et,
|
|
4034
|
+
httpsPort: tt,
|
|
4014
4035
|
userId: t,
|
|
4015
|
-
token:
|
|
4036
|
+
token: U.current,
|
|
4016
4037
|
identityToken: e,
|
|
4017
4038
|
spaceId: w?.spaceId,
|
|
4018
4039
|
backendUrl: w?.backendUrl,
|
|
4019
4040
|
authUrl: w?.authUrl,
|
|
4020
|
-
parameters:
|
|
4041
|
+
parameters: z
|
|
4021
4042
|
} };
|
|
4022
4043
|
}
|
|
4023
|
-
return
|
|
4024
|
-
token:
|
|
4044
|
+
return U.current && w?.spaceId ? { sessionToken: {
|
|
4045
|
+
token: U.current,
|
|
4025
4046
|
spaceId: w.spaceId,
|
|
4026
|
-
backendType:
|
|
4047
|
+
backendType: ae(),
|
|
4027
4048
|
sessionIdentityHash: R.sessionIdentityHash,
|
|
4028
|
-
parameters:
|
|
4049
|
+
parameters: z
|
|
4029
4050
|
} } : L && w?.spaceId ? { sessionToken: {
|
|
4030
4051
|
token: L,
|
|
4031
4052
|
spaceId: w.spaceId,
|
|
4032
|
-
backendType:
|
|
4053
|
+
backendType: ae(),
|
|
4033
4054
|
sessionIdentityHash: R.sessionIdentityHash,
|
|
4034
|
-
parameters:
|
|
4035
|
-
} } :
|
|
4036
|
-
host:
|
|
4037
|
-
httpsPort:
|
|
4055
|
+
parameters: z
|
|
4056
|
+
} } : fe() ? null : { local: {
|
|
4057
|
+
host: et,
|
|
4058
|
+
httpsPort: tt,
|
|
4038
4059
|
spaceId: w?.spaceId,
|
|
4039
4060
|
backendUrl: w?.backendUrl,
|
|
4040
4061
|
authUrl: w?.authUrl,
|
|
4041
|
-
parameters:
|
|
4062
|
+
parameters: z
|
|
4042
4063
|
} };
|
|
4043
4064
|
}, [
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
$e,
|
|
4065
|
+
le,
|
|
4066
|
+
H,
|
|
4047
4067
|
et,
|
|
4048
4068
|
tt,
|
|
4069
|
+
rt,
|
|
4049
4070
|
w?.spaceId,
|
|
4050
4071
|
w?.backendUrl,
|
|
4051
4072
|
w?.authUrl,
|
|
4052
4073
|
L,
|
|
4053
|
-
|
|
4054
|
-
|
|
4074
|
+
nt,
|
|
4075
|
+
We,
|
|
4055
4076
|
R.sessionIdentityHash,
|
|
4056
|
-
|
|
4077
|
+
z
|
|
4057
4078
|
]);
|
|
4058
|
-
D.current = w?.spaceId ?? "local",
|
|
4059
|
-
let
|
|
4079
|
+
D.current = w?.spaceId ?? "local", Oe.current = V?.token ?? L ?? void 0, wn(Ve);
|
|
4080
|
+
let at = En(Ve);
|
|
4060
4081
|
k(() => {
|
|
4061
|
-
if (!
|
|
4062
|
-
if (
|
|
4063
|
-
|
|
4064
|
-
|
|
4082
|
+
if (!pe.current) {
|
|
4083
|
+
if (pe.current = !0, de.current = un(), r) for (let e of r) e(de.current);
|
|
4084
|
+
de.current.loadRegisteredModules().catch((e) => {
|
|
4085
|
+
na.error("Failed to load UI modules", e);
|
|
4065
4086
|
});
|
|
4066
4087
|
}
|
|
4067
4088
|
}, []), k(() => {
|
|
4068
|
-
if (!
|
|
4069
|
-
let e = new
|
|
4070
|
-
...
|
|
4071
|
-
timeouts:
|
|
4072
|
-
audio:
|
|
4073
|
-
enabled:
|
|
4074
|
-
...
|
|
4089
|
+
if (!it) return;
|
|
4090
|
+
let e = new _({
|
|
4091
|
+
...it,
|
|
4092
|
+
timeouts: ge.current,
|
|
4093
|
+
audio: be.current !== void 0 || he.current ? {
|
|
4094
|
+
enabled: be.current,
|
|
4095
|
+
...he.current ? { background: {
|
|
4075
4096
|
allowOnDesktop: !0,
|
|
4076
4097
|
allowOnMobile: !0
|
|
4077
4098
|
} } : {}
|
|
4078
4099
|
} : void 0,
|
|
4079
|
-
video:
|
|
4100
|
+
video: xe.current === void 0 ? void 0 : { enabled: xe.current },
|
|
4080
4101
|
mediaSession: {
|
|
4081
4102
|
title: document.title || void 0,
|
|
4082
4103
|
artist: document.title || void 0
|
|
4083
4104
|
},
|
|
4084
|
-
webRtc:
|
|
4085
|
-
websocket:
|
|
4086
|
-
webtransport:
|
|
4087
|
-
httpstream:
|
|
4088
|
-
proxy:
|
|
4105
|
+
webRtc: ve.current === !1 ? { enabled: !1 } : void 0,
|
|
4106
|
+
websocket: Se.current,
|
|
4107
|
+
webtransport: Ce.current,
|
|
4108
|
+
httpstream: we.current,
|
|
4109
|
+
proxy: Te.current,
|
|
4089
4110
|
onConnectionStateChange: (e) => {
|
|
4090
|
-
|
|
4111
|
+
ke(e);
|
|
4091
4112
|
},
|
|
4092
4113
|
onError: (e) => {
|
|
4093
4114
|
I(e.message);
|
|
4094
4115
|
}
|
|
4095
4116
|
});
|
|
4096
4117
|
E.current = e;
|
|
4097
|
-
let n =
|
|
4118
|
+
let n = Ee.current ?? !0, r = Oe.current, i = r ? se(r) ?? null : null, a = n && i ? {
|
|
4098
4119
|
enabled: !0,
|
|
4099
4120
|
appId: D.current,
|
|
4100
4121
|
userId: i
|
|
4101
|
-
} : void 0, l =
|
|
4122
|
+
} : void 0, l = V != null && V.provider !== "anonymous", u = $e && (l || Mr()), d = new Qe({
|
|
4102
4123
|
client: e,
|
|
4103
4124
|
liveSnapshot: a,
|
|
4104
|
-
bootSnapshot:
|
|
4125
|
+
bootSnapshot: ta(De.current, u)
|
|
4105
4126
|
});
|
|
4106
|
-
|
|
4127
|
+
ue.current = d, He(d), F(!1);
|
|
4107
4128
|
let f = d.subscribeToUiUpdates(() => {
|
|
4108
|
-
F(!0),
|
|
4129
|
+
F(!0), ye();
|
|
4109
4130
|
});
|
|
4110
4131
|
return e.connect().catch((e) => {
|
|
4111
|
-
if (
|
|
4112
|
-
|
|
4132
|
+
if (na.error("Connection failed:", e), e instanceof o) {
|
|
4133
|
+
Pe(e.reason);
|
|
4113
4134
|
return;
|
|
4114
4135
|
}
|
|
4115
|
-
if (e instanceof
|
|
4116
|
-
|
|
4136
|
+
if (e instanceof ee) {
|
|
4137
|
+
Ie(!0);
|
|
4117
4138
|
return;
|
|
4118
4139
|
}
|
|
4119
|
-
if (e instanceof
|
|
4120
|
-
|
|
4140
|
+
if (e instanceof b) {
|
|
4141
|
+
Re(!0);
|
|
4121
4142
|
return;
|
|
4122
4143
|
}
|
|
4123
|
-
if (!(e instanceof
|
|
4144
|
+
if (!(e instanceof te)) {
|
|
4124
4145
|
if (e instanceof s) {
|
|
4125
|
-
|
|
4146
|
+
Be(!0);
|
|
4126
4147
|
return;
|
|
4127
4148
|
}
|
|
4128
|
-
e instanceof
|
|
4149
|
+
e instanceof y || e instanceof c && !me.current && (me.current = !0, na.warn("Auth session appears stale, clearing and retrying"), t.clearAll(), T ? T.logout() : (Nr(), Je((e) => e + 1)));
|
|
4129
4150
|
}
|
|
4130
4151
|
}), () => {
|
|
4131
|
-
f(), e.disconnect(), E.current = null, d.dispose(),
|
|
4152
|
+
f(), e.disconnect(), E.current = null, d.dispose(), ue.current = null;
|
|
4132
4153
|
};
|
|
4133
|
-
}, [
|
|
4134
|
-
let e =
|
|
4154
|
+
}, [it, Ye]), k(() => {
|
|
4155
|
+
let e = V?.token, t = E.current;
|
|
4135
4156
|
if (!(!e || !t)) {
|
|
4136
4157
|
if (t.connectionState === "offline" && !t.serverStopped) {
|
|
4137
|
-
|
|
4158
|
+
Xe((e) => e + 1);
|
|
4138
4159
|
return;
|
|
4139
4160
|
}
|
|
4140
4161
|
t.updateAuthToken(e);
|
|
4141
4162
|
}
|
|
4142
|
-
}, [
|
|
4143
|
-
let
|
|
4163
|
+
}, [V?.token]);
|
|
4164
|
+
let ot = O((e, t) => {
|
|
4144
4165
|
let n = typeof t == "string" ? t : JSON.stringify(t ?? {});
|
|
4145
4166
|
E.current?.sendActionCall(e, n);
|
|
4146
4167
|
}, []);
|
|
4147
4168
|
k(() => {
|
|
4148
4169
|
if (A !== "connecting") {
|
|
4149
|
-
|
|
4170
|
+
je(!1);
|
|
4150
4171
|
return;
|
|
4151
4172
|
}
|
|
4152
|
-
let e = E.current?.slowConnectionThresholdMs ??
|
|
4173
|
+
let e = E.current?.slowConnectionThresholdMs ?? d, t = setTimeout(() => je(!0), e);
|
|
4153
4174
|
return () => clearTimeout(t);
|
|
4154
4175
|
}, [A]);
|
|
4155
|
-
let
|
|
4176
|
+
let st = A === "connected" || A === "reconnecting", W = P && A !== "offline";
|
|
4156
4177
|
return k(() => {
|
|
4157
|
-
typeof document > "u" || (document.documentElement.dataset.ikonLive = String(
|
|
4158
|
-
}, [
|
|
4178
|
+
typeof document > "u" || (document.documentElement.dataset.ikonLive = String(W));
|
|
4179
|
+
}, [W]), {
|
|
4159
4180
|
connectionState: A,
|
|
4160
|
-
error:
|
|
4161
|
-
accessDeniedReason:
|
|
4162
|
-
isServerFull:
|
|
4163
|
-
isSessionExpired:
|
|
4164
|
-
isStartupFailed:
|
|
4165
|
-
stores:
|
|
4181
|
+
error: Me,
|
|
4182
|
+
accessDeniedReason: Ne,
|
|
4183
|
+
isServerFull: Fe,
|
|
4184
|
+
isSessionExpired: Le,
|
|
4185
|
+
isStartupFailed: ze,
|
|
4186
|
+
stores: at,
|
|
4166
4187
|
client: E.current,
|
|
4167
|
-
registry:
|
|
4188
|
+
registry: de.current,
|
|
4168
4189
|
clientRef: E,
|
|
4169
|
-
uiRef:
|
|
4170
|
-
registryRef:
|
|
4171
|
-
onAction:
|
|
4172
|
-
isReady:
|
|
4173
|
-
isLive:
|
|
4190
|
+
uiRef: ue,
|
|
4191
|
+
registryRef: de,
|
|
4192
|
+
onAction: ot,
|
|
4193
|
+
isReady: st,
|
|
4194
|
+
isLive: W,
|
|
4174
4195
|
brandingRequired: E.current?.brandingRequired ?? !1,
|
|
4175
|
-
isConnectingSlow:
|
|
4196
|
+
isConnectingSlow: Ae,
|
|
4176
4197
|
webRtcVideoStreams: E.current?.webRtcVideoStreams ?? /* @__PURE__ */ new Map(),
|
|
4177
4198
|
webRtcTrackMap: E.current?.webRtcTrackMap ?? /* @__PURE__ */ new Map()
|
|
4178
4199
|
};
|
|
4179
4200
|
}
|
|
4180
4201
|
//#endregion
|
|
4181
4202
|
//#region src/hooks/use-toasts.ts
|
|
4182
|
-
var
|
|
4183
|
-
function
|
|
4203
|
+
var ca = 0;
|
|
4204
|
+
function la(e = 5, t = 5e3) {
|
|
4184
4205
|
let [n, r] = N([]), i = M(/* @__PURE__ */ new Map()), a = O((e) => {
|
|
4185
4206
|
let t = i.current.get(e);
|
|
4186
4207
|
t && (clearTimeout(t), i.current.delete(e)), r((t) => t.filter((t) => t.id !== e));
|
|
4187
4208
|
}, []);
|
|
4188
4209
|
return k(() => {
|
|
4189
|
-
let n = i.current, o =
|
|
4190
|
-
if (!
|
|
4191
|
-
let o = `toast-${++
|
|
4210
|
+
let n = i.current, o = we((i) => {
|
|
4211
|
+
if (!pe()) return;
|
|
4212
|
+
let o = `toast-${++ca}`, s = {
|
|
4192
4213
|
id: o,
|
|
4193
|
-
level: i.level ===
|
|
4214
|
+
level: i.level === v.ERROR ? "error" : "warn",
|
|
4194
4215
|
message: i.message,
|
|
4195
4216
|
component: i.component
|
|
4196
4217
|
};
|
|
@@ -4199,7 +4220,7 @@ function aa(e = 5, t = 5e3) {
|
|
|
4199
4220
|
a(o);
|
|
4200
4221
|
}, t);
|
|
4201
4222
|
n.set(o, c);
|
|
4202
|
-
}, { minLevel:
|
|
4223
|
+
}, { minLevel: v.WARN });
|
|
4203
4224
|
return () => {
|
|
4204
4225
|
o();
|
|
4205
4226
|
for (let e of n.values()) clearTimeout(e);
|
|
@@ -4216,7 +4237,7 @@ function aa(e = 5, t = 5e3) {
|
|
|
4216
4237
|
}
|
|
4217
4238
|
//#endregion
|
|
4218
4239
|
//#region src/hooks/use-ikon-reactive.ts
|
|
4219
|
-
function
|
|
4240
|
+
function ua(e, t, n) {
|
|
4220
4241
|
let [r, i] = N(n);
|
|
4221
4242
|
return k(() => {
|
|
4222
4243
|
if (!e) return;
|
|
@@ -4234,7 +4255,7 @@ function oa(e, t, n) {
|
|
|
4234
4255
|
}
|
|
4235
4256
|
//#endregion
|
|
4236
4257
|
//#region src/hooks/use-reactive.ts
|
|
4237
|
-
function
|
|
4258
|
+
function da(e, t, n) {
|
|
4238
4259
|
let [r, i] = N(null);
|
|
4239
4260
|
return k(() => {
|
|
4240
4261
|
if (!e) return;
|
|
@@ -4246,48 +4267,48 @@ function sa(e, t, n) {
|
|
|
4246
4267
|
}), () => {
|
|
4247
4268
|
n = !1;
|
|
4248
4269
|
};
|
|
4249
|
-
}, [e, t]),
|
|
4270
|
+
}, [e, t]), ua(r ? e : null, r ?? "", n);
|
|
4250
4271
|
}
|
|
4251
4272
|
//#endregion
|
|
4252
4273
|
//#region src/app/use-ikon-debug.ts
|
|
4253
|
-
var
|
|
4274
|
+
var fa = S("IkonDebug"), pa = {
|
|
4254
4275
|
Digit1: "connecting",
|
|
4255
4276
|
Digit2: "connected",
|
|
4256
4277
|
Digit3: "reconnecting",
|
|
4257
4278
|
Digit4: "offline",
|
|
4258
4279
|
Digit5: "offline",
|
|
4259
4280
|
Digit0: "clear"
|
|
4260
|
-
},
|
|
4261
|
-
function
|
|
4262
|
-
let t =
|
|
4281
|
+
}, ma = "Digit5", ha = "Digit6", ga = "Synthetic debug error (Ctrl+Shift+5)", _a = "Synthetic debug access-denied (Ctrl+Shift+6)", va = 5e3;
|
|
4282
|
+
function ya(e) {
|
|
4283
|
+
let t = pe(), [n, r] = N(null), [i, a] = N(!1), [o, s] = N(null), [c, l] = N(null), [u, d] = N(!1), [f, p] = N(!1), [m, h] = N(!1);
|
|
4263
4284
|
return k(() => {
|
|
4264
4285
|
if (!t) return;
|
|
4265
4286
|
let e = (e) => {
|
|
4266
4287
|
if (!e.ctrlKey || !e.shiftKey) return;
|
|
4267
4288
|
if (e.code === "KeyE") {
|
|
4268
|
-
e.preventDefault(), d((e) => (
|
|
4289
|
+
e.preventDefault(), d((e) => (fa.warn(`Empty-stores override: ${e ? "off" : "on"}`), !e));
|
|
4269
4290
|
return;
|
|
4270
4291
|
}
|
|
4271
4292
|
if (e.code === "Digit7") {
|
|
4272
|
-
e.preventDefault(), p((e) => (
|
|
4293
|
+
e.preventDefault(), p((e) => (fa.warn(`Branding-banner override: ${e ? "off" : "on"}`), !e));
|
|
4273
4294
|
return;
|
|
4274
4295
|
}
|
|
4275
4296
|
if (e.code === "Digit8") {
|
|
4276
|
-
e.preventDefault(), h((e) => (
|
|
4297
|
+
e.preventDefault(), h((e) => (fa.warn(`Debug-overlay override: ${e ? "off" : "on"}`), !e));
|
|
4277
4298
|
return;
|
|
4278
4299
|
}
|
|
4279
|
-
if (e.code ===
|
|
4280
|
-
e.preventDefault(), l(
|
|
4300
|
+
if (e.code === ha) {
|
|
4301
|
+
e.preventDefault(), l(_a), r(null), s(null), fa.warn("Forced access denied");
|
|
4281
4302
|
return;
|
|
4282
4303
|
}
|
|
4283
|
-
let t =
|
|
4304
|
+
let t = pa[e.code];
|
|
4284
4305
|
if (t === void 0) return;
|
|
4285
4306
|
if (e.preventDefault(), t === "clear") {
|
|
4286
|
-
r(null), s(null), l(null),
|
|
4307
|
+
r(null), s(null), l(null), fa.warn("Cleared forced state");
|
|
4287
4308
|
return;
|
|
4288
4309
|
}
|
|
4289
|
-
let n = e.code ===
|
|
4290
|
-
r(t), s(n ?
|
|
4310
|
+
let n = e.code === ma;
|
|
4311
|
+
r(t), s(n ? ga : null), l(null), fa.warn(`Forced state: ${t}${n ? " (with error)" : ""}`);
|
|
4291
4312
|
};
|
|
4292
4313
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
4293
4314
|
}, [t]), k(() => {
|
|
@@ -4295,7 +4316,7 @@ function ha(e) {
|
|
|
4295
4316
|
a(!1);
|
|
4296
4317
|
return;
|
|
4297
4318
|
}
|
|
4298
|
-
let e = setTimeout(() => a(!0),
|
|
4319
|
+
let e = setTimeout(() => a(!0), va);
|
|
4299
4320
|
return () => clearTimeout(e);
|
|
4300
4321
|
}, [n]), !t || n === null && !u && c === null && !f && !m ? {
|
|
4301
4322
|
app: e,
|
|
@@ -4326,64 +4347,64 @@ function ha(e) {
|
|
|
4326
4347
|
}
|
|
4327
4348
|
//#endregion
|
|
4328
4349
|
//#region src/app/ikon-app.tsx
|
|
4329
|
-
function
|
|
4350
|
+
function ba(e, t) {
|
|
4330
4351
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4331
4352
|
}
|
|
4332
|
-
function
|
|
4353
|
+
function xa(e) {
|
|
4333
4354
|
return e === void 0 ? null : typeof e == "function" ? e() : e;
|
|
4334
4355
|
}
|
|
4335
|
-
function
|
|
4356
|
+
function Sa(e, t) {
|
|
4336
4357
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4337
4358
|
}
|
|
4338
|
-
function
|
|
4359
|
+
function Ca(e, t) {
|
|
4339
4360
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4340
4361
|
}
|
|
4341
|
-
function
|
|
4342
|
-
let { connectingOverlay: t, reconnectingOverlay: n, offlineOverlay: r, accessDeniedScreen: i, ...a } = e, o =
|
|
4343
|
-
u && d && (m || u.size > 0) && (
|
|
4362
|
+
function wa(e) {
|
|
4363
|
+
let { connectingOverlay: t, reconnectingOverlay: n, offlineOverlay: r, accessDeniedScreen: i, ...a } = e, o = ya(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 = M(null);
|
|
4364
|
+
u && d && (m || u.size > 0) && (y.current = {
|
|
4344
4365
|
stores: u,
|
|
4345
4366
|
registry: d,
|
|
4346
4367
|
client: f
|
|
4347
4368
|
});
|
|
4348
|
-
let
|
|
4369
|
+
let ee = y.current != null || !!g;
|
|
4349
4370
|
if (A(() => {
|
|
4350
|
-
!
|
|
4351
|
-
}, [
|
|
4352
|
-
let
|
|
4371
|
+
!ee || typeof document > "u" || document.querySelectorAll("[data-ikon-prerender]").forEach((e) => e.remove());
|
|
4372
|
+
}, [ee]), g) return Ca(i, g);
|
|
4373
|
+
let te = y.current, b;
|
|
4353
4374
|
switch (c) {
|
|
4354
4375
|
case "waitingForExternalConnectUrl":
|
|
4355
4376
|
case "connecting":
|
|
4356
|
-
|
|
4377
|
+
b = ba(t, l);
|
|
4357
4378
|
break;
|
|
4358
4379
|
case "reconnecting":
|
|
4359
|
-
|
|
4380
|
+
b = xa(n);
|
|
4360
4381
|
break;
|
|
4361
4382
|
case "offline":
|
|
4362
|
-
|
|
4383
|
+
b = Sa(r, h);
|
|
4363
4384
|
break;
|
|
4364
|
-
default:
|
|
4385
|
+
default: b = null;
|
|
4365
4386
|
}
|
|
4366
|
-
return /* @__PURE__ */ F(
|
|
4367
|
-
|
|
4368
|
-
stores:
|
|
4369
|
-
registry:
|
|
4370
|
-
client:
|
|
4387
|
+
return /* @__PURE__ */ F(je, { children: [
|
|
4388
|
+
te && /* @__PURE__ */ P(z, {
|
|
4389
|
+
stores: te.stores,
|
|
4390
|
+
registry: te.registry,
|
|
4391
|
+
client: te.client,
|
|
4371
4392
|
onAction: p
|
|
4372
4393
|
}),
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
/* @__PURE__ */ P(
|
|
4376
|
-
/* @__PURE__ */ P(
|
|
4394
|
+
b,
|
|
4395
|
+
v && /* @__PURE__ */ P(Ea, {}),
|
|
4396
|
+
/* @__PURE__ */ P(Da, {}),
|
|
4397
|
+
/* @__PURE__ */ P($i, {
|
|
4377
4398
|
state: c,
|
|
4378
4399
|
forceVisible: o.forcedDebugOverlay
|
|
4379
4400
|
})
|
|
4380
4401
|
] });
|
|
4381
4402
|
}
|
|
4382
|
-
var
|
|
4383
|
-
function
|
|
4403
|
+
var Ta = "https://ikonai.com";
|
|
4404
|
+
function Ea() {
|
|
4384
4405
|
return /* @__PURE__ */ F("a", {
|
|
4385
4406
|
className: "ikon-branding-banner",
|
|
4386
|
-
href:
|
|
4407
|
+
href: Ta,
|
|
4387
4408
|
target: "_blank",
|
|
4388
4409
|
rel: "noopener noreferrer",
|
|
4389
4410
|
style: {
|
|
@@ -4413,17 +4434,17 @@ function Sa() {
|
|
|
4413
4434
|
})]
|
|
4414
4435
|
});
|
|
4415
4436
|
}
|
|
4416
|
-
function
|
|
4417
|
-
let { toasts: e, dismissToast: t } =
|
|
4437
|
+
function Da() {
|
|
4438
|
+
let { toasts: e, dismissToast: t } = la();
|
|
4418
4439
|
return e.length === 0 ? null : /* @__PURE__ */ P("div", {
|
|
4419
4440
|
className: "ikon-toast-overlay",
|
|
4420
|
-
children: e.map((e) => /* @__PURE__ */ P(
|
|
4441
|
+
children: e.map((e) => /* @__PURE__ */ P(Oa, {
|
|
4421
4442
|
toast: e,
|
|
4422
4443
|
onDismiss: t
|
|
4423
4444
|
}, e.id))
|
|
4424
4445
|
});
|
|
4425
4446
|
}
|
|
4426
|
-
function
|
|
4447
|
+
function Oa({ toast: e, onDismiss: t }) {
|
|
4427
4448
|
return /* @__PURE__ */ F("div", {
|
|
4428
4449
|
className: `ikon-toast-overlay-chip ikon-toast-overlay-chip--${e.level}`,
|
|
4429
4450
|
onClick: () => t(e.id),
|
|
@@ -4449,9 +4470,9 @@ function wa({ toast: e, onDismiss: t }) {
|
|
|
4449
4470
|
}
|
|
4450
4471
|
//#endregion
|
|
4451
4472
|
//#region src/app/connection-recovery.ts
|
|
4452
|
-
function
|
|
4473
|
+
function ka({ isSessionExpired: e }) {
|
|
4453
4474
|
if (e) {
|
|
4454
|
-
let e =
|
|
4475
|
+
let e = de();
|
|
4455
4476
|
if (e) return {
|
|
4456
4477
|
kind: "freshSession",
|
|
4457
4478
|
run: () => {
|
|
@@ -4468,37 +4489,37 @@ function Ta({ isSessionExpired: e }) {
|
|
|
4468
4489
|
}
|
|
4469
4490
|
//#endregion
|
|
4470
4491
|
//#region src/i18n/i18n.tsx
|
|
4471
|
-
var
|
|
4472
|
-
function
|
|
4492
|
+
var Aa = De(null);
|
|
4493
|
+
function ja(e, t) {
|
|
4473
4494
|
return t ? e.replace(/\{(\w+)\}/g, (e, n) => t[n] ?? `{${n}}`) : e;
|
|
4474
4495
|
}
|
|
4475
|
-
function
|
|
4476
|
-
let n =
|
|
4496
|
+
function Ma(e, t) {
|
|
4497
|
+
let n = ce();
|
|
4477
4498
|
if (n && e.includes(n)) return n;
|
|
4478
4499
|
let r = navigator.language.split("-")[0];
|
|
4479
4500
|
return e.includes(r) ? r : t && e.includes(t) ? t : "en";
|
|
4480
4501
|
}
|
|
4481
|
-
function
|
|
4482
|
-
return t ?
|
|
4502
|
+
function Na(e, t, n) {
|
|
4503
|
+
return t ? Ma(e, n) : n && e.includes(n) ? n : "en";
|
|
4483
4504
|
}
|
|
4484
|
-
function
|
|
4485
|
-
let i =
|
|
4505
|
+
function Pa({ children: e, translations: t, defaultLanguage: n, detectLanguage: r = !1 }) {
|
|
4506
|
+
let i = Na(Object.keys(t), r, n), a = t[i] ?? t.en, o = j(() => ({
|
|
4486
4507
|
t: (e, t) => {
|
|
4487
4508
|
let n = a[e];
|
|
4488
|
-
return
|
|
4509
|
+
return ja(n, t);
|
|
4489
4510
|
},
|
|
4490
4511
|
locale: i,
|
|
4491
4512
|
translations: a
|
|
4492
4513
|
}), [a, i]);
|
|
4493
|
-
return /* @__PURE__ */ P(
|
|
4514
|
+
return /* @__PURE__ */ P(Aa, {
|
|
4494
4515
|
value: o,
|
|
4495
4516
|
children: e
|
|
4496
4517
|
});
|
|
4497
4518
|
}
|
|
4498
|
-
function
|
|
4499
|
-
let e =
|
|
4519
|
+
function Fa() {
|
|
4520
|
+
let e = Oe(Aa);
|
|
4500
4521
|
if (!e) throw Error("useI18n must be used within an I18nProvider");
|
|
4501
4522
|
return e;
|
|
4502
4523
|
}
|
|
4503
4524
|
//#endregion
|
|
4504
|
-
export {
|
|
4525
|
+
export { Ei as AuthProvider, ea as ConnectionStateRenderer, Ui as DEBUG_OVERLAY_ENABLED, $i as DebugOverlay, Pa as I18nProvider, bt as IKON_UI_BASE_MODULE, Bt as IKON_UI_MEDIA_MODULE, an as IKON_UI_SHADERTOY_MODULE, nn as IKON_UI_SHADERTOY_TYPE, R as IKON_UI_STREAM_CATEGORY, Pt as IKON_UI_VIDEO_CANVAS_TYPE, Ft as IKON_UI_VIDEO_URL_PLAYER_TYPE, wa as IkonApp, Qe as IkonUi, ln as IkonUiRegistry, z as IkonUiSurface, Ye as InspectOverlay, mn as ParallaxView, Ke as UiComponentRegistry, Ge as UiRenderer, n as UiStreamStore, kt as VideoStreamView, Vr as authenticateAnonymous, $r as buildOAuthRedirectUrl, Nr as clearAuthSession, Qr as clearOAuthParams, yt as createBaseResolvers, qe as createComponentLibrary, un as createIkonUiRegistry, Lt as createMediaResolvers, rn as createShadertoyRendererResolver, ka as getConnectionRecovery, Ze as isIkonUiCategoryMatch, Tr as loadAuthSession, xt as loadBaseModule, Vt as loadMediaModule, on as loadShadertoyModule, Wr as parseOAuthCallback, Jr as parseOAuthError, ve as randomUuid, St as registerBaseModule, Ht as registerMediaModule, sn as registerShadertoyModule, Ue as renderChildren, Rn as renderMotionLetters, q as saveAuthSession, Hr as sendLoginCode, J as sessionToUser, Di as useAuth, Hi as useAuthGuard, Oi as useAuthOptional, jn as useCameraCapture, Fa as useI18n, sa as useIkonApp, ya as useIkonDebug, ua as useIkonReactive, wn as useIkonStyles, En as useIkonUiStores, An as useMicrophoneCapture, da as useReactive, Mn as useScreenCapture, Dn as useSiblingClient, la as useToasts, I as useUiNode, Je as useUiStore, Ur as verifyLoginCode };
|