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