@ikonai/sdk-react-ui 1.1.0 → 1.2.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/index.js +722 -900
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,22 +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, AuthenticationError as s, IKON_INSPECT_MODE_CHANGED_EVENT as c, IkonClient as l, LogLevel as u, ProvisioningTimeoutError as d, ServerFullError as f, ServerUnavailableError as p, SessionNotFoundError as m, abortSignalTimeout as h, clearLoginPrompt as g, createLogger as _, deriveAuthUrl as v, deriveBackendType as y, extractUserIdFromToken as
|
|
3
|
-
import { Fragment as
|
|
4
|
-
|
|
5
|
-
var L = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), le = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
6
|
-
if (typeof require < "u") return require.apply(this, arguments);
|
|
7
|
-
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
8
|
-
});
|
|
9
|
-
//#endregion
|
|
2
|
+
import { AccessDeniedError as o, AuthenticationError as s, IKON_INSPECT_MODE_CHANGED_EVENT as c, IkonClient as l, LogLevel as u, ProvisioningTimeoutError as d, ServerFullError as f, ServerUnavailableError as p, SessionNotFoundError as m, abortSignalTimeout as h, clearLoginPrompt as g, createLogger as _, deriveAuthUrl as v, deriveBackendType as y, extractUserIdFromToken as ee, getDebugOverlayParam as b, getLangParam as x, getLoginPromptState as S, getOrCreateDeviceId as te, getSameOriginAuthUrl as ne, isCloudEnvironment as re, isDebugModeEnabled as C, isInspectModeEnabled as ie, parseUrlParams as ae, randomUuid as w, reportConnectTimeline as oe, subscribeLoginPrompt as se, subscribeToLogEvents as T } from "@ikonai/sdk";
|
|
3
|
+
import { Fragment as ce, createContext as E, memo as D, use as le, useCallback as O, useEffect as k, useLayoutEffect as ue, useMemo as A, useReducer as de, useRef as j, useState as M, useSyncExternalStore as N } from "react";
|
|
4
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
10
5
|
//#region src/renderer/use-root-view.ts
|
|
11
|
-
function
|
|
12
|
-
let n =
|
|
6
|
+
function fe(e, t) {
|
|
7
|
+
let n = N((t) => e.subscribe(t), () => {
|
|
13
8
|
let n = e.getSnapshot(), r = t ?? n.rootViewId, i = r ? n.views.get(r) : void 0;
|
|
14
9
|
return `${r ?? ""}:${i?.id ?? ""}`;
|
|
15
10
|
}, () => {
|
|
16
11
|
let n = e.getSnapshot(), r = t ?? n.rootViewId, i = r ? n.views.get(r) : void 0;
|
|
17
12
|
return `${r ?? ""}:${i?.id ?? ""}`;
|
|
18
13
|
});
|
|
19
|
-
return
|
|
14
|
+
return A(() => {
|
|
20
15
|
let [e, t] = n.split(":");
|
|
21
16
|
return {
|
|
22
17
|
rootViewId: e || void 0,
|
|
@@ -26,192 +21,18 @@ function ue(e, t) {
|
|
|
26
21
|
}
|
|
27
22
|
//#endregion
|
|
28
23
|
//#region src/renderer/use-ui-node.ts
|
|
29
|
-
function
|
|
30
|
-
|
|
24
|
+
function L(e, t) {
|
|
25
|
+
let n = N((n) => e.subscribeNode(t, n), () => e.getNodeVersion(t), () => e.getNodeVersion(t));
|
|
26
|
+
return A(() => e.getNode(t), [
|
|
31
27
|
e,
|
|
32
28
|
t,
|
|
33
|
-
|
|
29
|
+
n
|
|
34
30
|
]);
|
|
35
31
|
}
|
|
36
32
|
//#endregion
|
|
37
|
-
//#region
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
function r(e, n, r) {
|
|
41
|
-
var i = null;
|
|
42
|
-
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
43
|
-
else r = n;
|
|
44
|
-
return n = r.ref, {
|
|
45
|
-
$$typeof: t,
|
|
46
|
-
type: e,
|
|
47
|
-
key: i,
|
|
48
|
-
ref: n === void 0 ? null : n,
|
|
49
|
-
props: r
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
53
|
-
})), fe = /* @__PURE__ */ L(((e) => {
|
|
54
|
-
process.env.NODE_ENV !== "production" && (function() {
|
|
55
|
-
function t(e) {
|
|
56
|
-
if (e == null) return null;
|
|
57
|
-
if (typeof e == "function") return e.$$typeof === re ? null : e.displayName || e.name || null;
|
|
58
|
-
if (typeof e == "string") return e;
|
|
59
|
-
switch (e) {
|
|
60
|
-
case _: return "Fragment";
|
|
61
|
-
case y: return "Profiler";
|
|
62
|
-
case v: return "StrictMode";
|
|
63
|
-
case C: return "Suspense";
|
|
64
|
-
case ee: return "SuspenseList";
|
|
65
|
-
case w: return "Activity";
|
|
66
|
-
}
|
|
67
|
-
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
68
|
-
case g: return "Portal";
|
|
69
|
-
case x: return e.displayName || "Context";
|
|
70
|
-
case b: return (e._context.displayName || "Context") + ".Consumer";
|
|
71
|
-
case S:
|
|
72
|
-
var n = e.render;
|
|
73
|
-
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
74
|
-
case te: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
75
|
-
case ne:
|
|
76
|
-
n = e._payload, e = e._init;
|
|
77
|
-
try {
|
|
78
|
-
return t(e(n));
|
|
79
|
-
} catch {}
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
function n(e) {
|
|
84
|
-
return "" + e;
|
|
85
|
-
}
|
|
86
|
-
function r(e) {
|
|
87
|
-
try {
|
|
88
|
-
n(e);
|
|
89
|
-
var t = !1;
|
|
90
|
-
} catch {
|
|
91
|
-
t = !0;
|
|
92
|
-
}
|
|
93
|
-
if (t) {
|
|
94
|
-
t = console;
|
|
95
|
-
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
96
|
-
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function i(e) {
|
|
100
|
-
if (e === _) return "<>";
|
|
101
|
-
if (typeof e == "object" && e && e.$$typeof === ne) return "<...>";
|
|
102
|
-
try {
|
|
103
|
-
var n = t(e);
|
|
104
|
-
return n ? "<" + n + ">" : "<...>";
|
|
105
|
-
} catch {
|
|
106
|
-
return "<...>";
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function a() {
|
|
110
|
-
var e = ie.A;
|
|
111
|
-
return e === null ? null : e.getOwner();
|
|
112
|
-
}
|
|
113
|
-
function o() {
|
|
114
|
-
return Error("react-stack-top-frame");
|
|
115
|
-
}
|
|
116
|
-
function s(e) {
|
|
117
|
-
if (ae.call(e, "key")) {
|
|
118
|
-
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
119
|
-
if (t && t.isReactWarning) return !1;
|
|
120
|
-
}
|
|
121
|
-
return e.key !== void 0;
|
|
122
|
-
}
|
|
123
|
-
function c(e, t) {
|
|
124
|
-
function n() {
|
|
125
|
-
E || (E = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
126
|
-
}
|
|
127
|
-
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
128
|
-
get: n,
|
|
129
|
-
configurable: !0
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function l() {
|
|
133
|
-
var e = t(this.type);
|
|
134
|
-
return D[e] || (D[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
135
|
-
}
|
|
136
|
-
function u(e, t, n, r, i, a) {
|
|
137
|
-
var o = n.ref;
|
|
138
|
-
return e = {
|
|
139
|
-
$$typeof: h,
|
|
140
|
-
type: e,
|
|
141
|
-
key: t,
|
|
142
|
-
props: n,
|
|
143
|
-
_owner: r
|
|
144
|
-
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
145
|
-
enumerable: !1,
|
|
146
|
-
value: null
|
|
147
|
-
}) : Object.defineProperty(e, "ref", {
|
|
148
|
-
enumerable: !1,
|
|
149
|
-
get: l
|
|
150
|
-
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
151
|
-
configurable: !1,
|
|
152
|
-
enumerable: !1,
|
|
153
|
-
writable: !0,
|
|
154
|
-
value: 0
|
|
155
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
156
|
-
configurable: !1,
|
|
157
|
-
enumerable: !1,
|
|
158
|
-
writable: !0,
|
|
159
|
-
value: null
|
|
160
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
161
|
-
configurable: !1,
|
|
162
|
-
enumerable: !1,
|
|
163
|
-
writable: !0,
|
|
164
|
-
value: i
|
|
165
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
166
|
-
configurable: !1,
|
|
167
|
-
enumerable: !1,
|
|
168
|
-
writable: !0,
|
|
169
|
-
value: a
|
|
170
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
171
|
-
}
|
|
172
|
-
function d(e, n, i, o, l, d) {
|
|
173
|
-
var p = n.children;
|
|
174
|
-
if (p !== void 0) if (o) if (oe(p)) {
|
|
175
|
-
for (o = 0; o < p.length; o++) f(p[o]);
|
|
176
|
-
Object.freeze && Object.freeze(p);
|
|
177
|
-
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
178
|
-
else f(p);
|
|
179
|
-
if (ae.call(n, "key")) {
|
|
180
|
-
p = t(e);
|
|
181
|
-
var m = Object.keys(n).filter(function(e) {
|
|
182
|
-
return e !== "key";
|
|
183
|
-
});
|
|
184
|
-
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", A[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), A[p + o] = !0);
|
|
185
|
-
}
|
|
186
|
-
if (p = null, i !== void 0 && (r(i), p = "" + i), s(n) && (r(n.key), p = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
187
|
-
else i = n;
|
|
188
|
-
return p && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), u(e, p, i, a(), l, d);
|
|
189
|
-
}
|
|
190
|
-
function f(e) {
|
|
191
|
-
p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === ne && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
192
|
-
}
|
|
193
|
-
function p(e) {
|
|
194
|
-
return typeof e == "object" && !!e && e.$$typeof === h;
|
|
195
|
-
}
|
|
196
|
-
var m = le("react"), h = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), x = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), ee = Symbol.for("react.suspense_list"), te = Symbol.for("react.memo"), ne = Symbol.for("react.lazy"), w = Symbol.for("react.activity"), re = Symbol.for("react.client.reference"), ie = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ae = Object.prototype.hasOwnProperty, oe = Array.isArray, T = console.createTask ? console.createTask : function() {
|
|
197
|
-
return null;
|
|
198
|
-
};
|
|
199
|
-
m = { react_stack_bottom_frame: function(e) {
|
|
200
|
-
return e();
|
|
201
|
-
} };
|
|
202
|
-
var E, D = {}, O = m.react_stack_bottom_frame.bind(m, o)(), k = T(i(o)), A = {};
|
|
203
|
-
e.Fragment = _, e.jsx = function(e, t, n) {
|
|
204
|
-
var r = 1e4 > ie.recentlyCreatedOwnerStacks++;
|
|
205
|
-
return d(e, t, n, !1, r ? Error("react-stack-top-frame") : O, r ? T(i(e)) : k);
|
|
206
|
-
}, e.jsxs = function(e, t, n) {
|
|
207
|
-
var r = 1e4 > ie.recentlyCreatedOwnerStacks++;
|
|
208
|
-
return d(e, t, n, !0, r ? Error("react-stack-top-frame") : O, r ? T(i(e)) : k);
|
|
209
|
-
};
|
|
210
|
-
})();
|
|
211
|
-
})), z = (/* @__PURE__ */ L(((e, t) => {
|
|
212
|
-
process.env.NODE_ENV === "production" ? t.exports = de() : t.exports = fe();
|
|
213
|
-
})))(), pe = _("UIRenderer");
|
|
214
|
-
function B(e) {
|
|
33
|
+
//#region src/renderer/ui-renderer.tsx
|
|
34
|
+
var pe = _("UIRenderer");
|
|
35
|
+
function me(e) {
|
|
215
36
|
if (e === void 0) return "{}";
|
|
216
37
|
if (typeof e == "string") return e;
|
|
217
38
|
try {
|
|
@@ -220,37 +41,37 @@ function B(e) {
|
|
|
220
41
|
return "{}";
|
|
221
42
|
}
|
|
222
43
|
}
|
|
223
|
-
function
|
|
44
|
+
function he(e) {
|
|
224
45
|
let t = e.styleIds;
|
|
225
46
|
return Array.isArray(t) ? t : [];
|
|
226
47
|
}
|
|
227
|
-
var
|
|
228
|
-
function
|
|
229
|
-
let [t, n] =
|
|
230
|
-
return
|
|
48
|
+
var ge = 1500;
|
|
49
|
+
function R(e) {
|
|
50
|
+
let [t, n] = M(0);
|
|
51
|
+
return k(() => {
|
|
231
52
|
if (e.subscribe) return e.subscribe(() => n((e) => e + 1));
|
|
232
53
|
}, [e]), t;
|
|
233
54
|
}
|
|
234
55
|
function _e({ nodeType: e, nodeId: t, context: n, className: r }) {
|
|
235
|
-
let [i, a] =
|
|
56
|
+
let [i, a] = M(!1), o = L(n.store, t), s = R(n.library), c = A(() => o ? n.library.resolve(o) : void 0, [
|
|
236
57
|
n.library,
|
|
237
58
|
o,
|
|
238
59
|
s
|
|
239
60
|
]);
|
|
240
|
-
return
|
|
241
|
-
let e = setTimeout(() => a(!0),
|
|
61
|
+
return k(() => {
|
|
62
|
+
let e = setTimeout(() => a(!0), ge);
|
|
242
63
|
return () => clearTimeout(e);
|
|
243
|
-
}, [e]),
|
|
64
|
+
}, [e]), k(() => {
|
|
244
65
|
!i || c || pe.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.`);
|
|
245
66
|
}, [
|
|
246
67
|
i,
|
|
247
68
|
c,
|
|
248
69
|
e
|
|
249
|
-
]), c ? /* @__PURE__ */ (
|
|
70
|
+
]), c ? /* @__PURE__ */ F(c, {
|
|
250
71
|
nodeId: t,
|
|
251
72
|
context: n,
|
|
252
73
|
className: r
|
|
253
|
-
}) : i ? /* @__PURE__ */ (
|
|
74
|
+
}) : i ? /* @__PURE__ */ F("div", {
|
|
254
75
|
"data-ikon-node-id": t,
|
|
255
76
|
"data-ikon-unresolved-node": e,
|
|
256
77
|
role: "alert",
|
|
@@ -280,27 +101,27 @@ function be(e) {
|
|
|
280
101
|
for (let n = 1; n < e.length; n++) t += "," + e[n].id;
|
|
281
102
|
return t;
|
|
282
103
|
}
|
|
283
|
-
var xe =
|
|
284
|
-
let r =
|
|
104
|
+
var xe = D(function e({ nodeId: t, context: n }) {
|
|
105
|
+
let r = L(n.store, t), i = r ? ve(r) : [], a = be(i), o = A(() => i.length === 0 ? null : i.map((t) => /* @__PURE__ */ F(e, {
|
|
285
106
|
nodeId: t.id,
|
|
286
107
|
context: n
|
|
287
|
-
}, t.id)), [
|
|
108
|
+
}, t.id)), [a, n]);
|
|
288
109
|
if (!r) return null;
|
|
289
|
-
if (r.type === "root") return /* @__PURE__ */ (
|
|
290
|
-
let
|
|
291
|
-
return
|
|
110
|
+
if (r.type === "root") return /* @__PURE__ */ F(ce, { children: o }, r.id);
|
|
111
|
+
let s = he(r), c = s.length > 0 ? s.join(" ") : void 0, l = n.library.resolve(r);
|
|
112
|
+
return l ? /* @__PURE__ */ F(l, {
|
|
292
113
|
nodeId: t,
|
|
293
114
|
context: n,
|
|
294
|
-
className:
|
|
295
|
-
}) : /* @__PURE__ */ (
|
|
115
|
+
className: c
|
|
116
|
+
}) : /* @__PURE__ */ F(_e, {
|
|
296
117
|
nodeType: r.type,
|
|
297
118
|
nodeId: r.id,
|
|
298
119
|
context: n,
|
|
299
|
-
className:
|
|
120
|
+
className: c
|
|
300
121
|
});
|
|
301
122
|
}, ye);
|
|
302
123
|
function Se(e, t) {
|
|
303
|
-
return !Array.isArray(e) || e.length === 0 ? null : e.map((e) => /* @__PURE__ */ (
|
|
124
|
+
return !Array.isArray(e) || e.length === 0 ? null : e.map((e) => /* @__PURE__ */ F(xe, {
|
|
304
125
|
nodeId: e.id,
|
|
305
126
|
context: t
|
|
306
127
|
}, e.id));
|
|
@@ -308,18 +129,18 @@ function Se(e, t) {
|
|
|
308
129
|
function Ce(e, t) {
|
|
309
130
|
return e.store === t.store && e.library === t.library && e.viewId === t.viewId && e.emptyFallback === t.emptyFallback;
|
|
310
131
|
}
|
|
311
|
-
var we =
|
|
312
|
-
let { rootViewId: s, rootNodeId: c } =
|
|
132
|
+
var we = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null, onAction: i, client: a, video: o }) {
|
|
133
|
+
let { rootViewId: s, rootNodeId: c } = fe(e, n), l = j(i);
|
|
313
134
|
l.current = i;
|
|
314
|
-
let u =
|
|
135
|
+
let u = j(a);
|
|
315
136
|
u.current = a;
|
|
316
|
-
let d =
|
|
137
|
+
let d = j(o);
|
|
317
138
|
d.current = o;
|
|
318
|
-
let f =
|
|
139
|
+
let f = O((e, t) => {
|
|
319
140
|
if (!e) return;
|
|
320
|
-
let n =
|
|
141
|
+
let n = me(t);
|
|
321
142
|
l.current?.(e, n);
|
|
322
|
-
}, []), p =
|
|
143
|
+
}, []), p = A(() => {
|
|
323
144
|
let n = {
|
|
324
145
|
store: e,
|
|
325
146
|
library: t,
|
|
@@ -328,7 +149,7 @@ var we = k(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
328
149
|
renderChildren: (e) => Se(e, n),
|
|
329
150
|
renderView: (t) => {
|
|
330
151
|
let r = e.getSnapshot().views.get(t);
|
|
331
|
-
return r ? /* @__PURE__ */ (
|
|
152
|
+
return r ? /* @__PURE__ */ F(xe, {
|
|
332
153
|
nodeId: r.id,
|
|
333
154
|
context: n
|
|
334
155
|
}) : null;
|
|
@@ -347,10 +168,10 @@ var we = k(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
347
168
|
t,
|
|
348
169
|
f
|
|
349
170
|
]);
|
|
350
|
-
return !s || !c ? r : /* @__PURE__ */ (
|
|
171
|
+
return !s || !c ? r : /* @__PURE__ */ F("div", {
|
|
351
172
|
"data-ikon-view-id": s,
|
|
352
173
|
style: { display: "contents" },
|
|
353
|
-
children: /* @__PURE__ */ (
|
|
174
|
+
children: /* @__PURE__ */ F(xe, {
|
|
354
175
|
nodeId: c,
|
|
355
176
|
context: p
|
|
356
177
|
})
|
|
@@ -386,23 +207,23 @@ function Ee(e, t) {
|
|
|
386
207
|
//#endregion
|
|
387
208
|
//#region src/renderer/use-ui-store.ts
|
|
388
209
|
function De(e) {
|
|
389
|
-
return
|
|
210
|
+
return N((t) => e.subscribe(t), () => e.getSnapshot(), () => e.getSnapshot());
|
|
390
211
|
}
|
|
391
212
|
//#endregion
|
|
392
213
|
//#region src/inspect/inspect-overlay.tsx
|
|
393
214
|
function Oe() {
|
|
394
|
-
let [e, t] =
|
|
395
|
-
return
|
|
215
|
+
let [e, t] = M(ie), n = j(!1);
|
|
216
|
+
return k(() => {
|
|
396
217
|
if (e) return;
|
|
397
218
|
let r = () => {
|
|
398
|
-
|
|
219
|
+
ie() && t(!0);
|
|
399
220
|
}, i = (e) => {
|
|
400
221
|
e.data?.type === "ikon-inspect-mode" && e.data.enabled && (n.current = !0, t(!0));
|
|
401
222
|
};
|
|
402
223
|
return window.addEventListener(c, r), window.addEventListener("message", i), () => {
|
|
403
224
|
window.removeEventListener(c, r), window.removeEventListener("message", i);
|
|
404
225
|
};
|
|
405
|
-
}, [e]),
|
|
226
|
+
}, [e]), k(() => {
|
|
406
227
|
if (!e) return;
|
|
407
228
|
let t = window.parent === window || n.current, r = null, i = [], a = document.createElement("div");
|
|
408
229
|
a.style.cssText = "position:fixed;z-index:99999;pointer-events:none;padding:2px 6px;background:#1e1e2e;color:#cdd6f4;font-size:11px;border-radius:4px;border:1px solid #45475a;white-space:nowrap;display:none;font-family:monospace;", document.body.appendChild(a);
|
|
@@ -530,20 +351,20 @@ function Oe() {
|
|
|
530
351
|
}
|
|
531
352
|
//#endregion
|
|
532
353
|
//#region src/surface.tsx
|
|
533
|
-
var
|
|
534
|
-
function
|
|
354
|
+
var ke = _("IkonUiSurface"), Ae = "ikon-ui";
|
|
355
|
+
function je(e, t) {
|
|
535
356
|
return e === t;
|
|
536
357
|
}
|
|
537
|
-
var
|
|
538
|
-
let a =
|
|
358
|
+
var z = D(function({ stores: e, registry: t, category: n = Ae, onAction: r, client: i }) {
|
|
359
|
+
let a = A(() => Array.from(e.keys()).sort().join(","), [e]), o = j(r);
|
|
539
360
|
o.current = r;
|
|
540
|
-
let s =
|
|
361
|
+
let s = j(i);
|
|
541
362
|
s.current = i;
|
|
542
|
-
let c =
|
|
363
|
+
let c = A(() => {
|
|
543
364
|
let t = [];
|
|
544
365
|
for (let [r, i] of e) {
|
|
545
366
|
let e = i.store.getSnapshot();
|
|
546
|
-
|
|
367
|
+
je(i.category, n) && (!e.rootViewId || !e.views.has(e.rootViewId) || t.push({
|
|
547
368
|
key: r,
|
|
548
369
|
store: i.store
|
|
549
370
|
}));
|
|
@@ -553,10 +374,10 @@ var je = k(function({ stores: e, registry: t, category: n = ke, onAction: r, cli
|
|
|
553
374
|
e,
|
|
554
375
|
n,
|
|
555
376
|
a
|
|
556
|
-
]), l =
|
|
557
|
-
return
|
|
558
|
-
u && !l.current && (l.current = !0,
|
|
559
|
-
}, [u]), u ? /* @__PURE__ */ (
|
|
377
|
+
]), l = j(!1), u = c.length > 0;
|
|
378
|
+
return k(() => {
|
|
379
|
+
u && !l.current && (l.current = !0, ke.debug("First UI render"));
|
|
380
|
+
}, [u]), u ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(Oe, {}), c.map(({ key: e, store: n }) => /* @__PURE__ */ F(we, {
|
|
560
381
|
store: n,
|
|
561
382
|
library: t,
|
|
562
383
|
onAction: o.current,
|
|
@@ -635,7 +456,7 @@ var je = k(function({ stores: e, registry: t, category: n = ke, onAction: r, cli
|
|
|
635
456
|
let t = this.stores.get(e);
|
|
636
457
|
if (t) return t;
|
|
637
458
|
let n = {
|
|
638
|
-
category:
|
|
459
|
+
category: Ae,
|
|
639
460
|
store: new r()
|
|
640
461
|
};
|
|
641
462
|
return this.stores.set(e, n), n;
|
|
@@ -644,7 +465,7 @@ var je = k(function({ stores: e, registry: t, category: n = ke, onAction: r, cli
|
|
|
644
465
|
let n = this.stores.get(e);
|
|
645
466
|
if (!n) return !1;
|
|
646
467
|
let r = t ?? this.core.uiStore.getSnapshot(e)?.category ?? "ikon-ui";
|
|
647
|
-
return n.category
|
|
468
|
+
return n.category !== r && (this.stores.set(e, {
|
|
648
469
|
...n,
|
|
649
470
|
category: r
|
|
650
471
|
}), !0);
|
|
@@ -661,7 +482,7 @@ function Ne(e) {
|
|
|
661
482
|
return t.length > 0 ? t : void 0;
|
|
662
483
|
}
|
|
663
484
|
}
|
|
664
|
-
function
|
|
485
|
+
function B(e) {
|
|
665
486
|
if (typeof e == "string") {
|
|
666
487
|
let t = e.trim();
|
|
667
488
|
return t.length > 0 ? t : void 0;
|
|
@@ -679,8 +500,8 @@ function Pe(...e) {
|
|
|
679
500
|
}
|
|
680
501
|
return t || void 0;
|
|
681
502
|
}
|
|
682
|
-
var
|
|
683
|
-
function
|
|
503
|
+
var Fe = /* @__PURE__ */ new WeakMap(), Ie = {};
|
|
504
|
+
function Le(e) {
|
|
684
505
|
let t = {};
|
|
685
506
|
for (let n of e.split(";")) {
|
|
686
507
|
let e = n.indexOf(":");
|
|
@@ -692,28 +513,28 @@ function Ie(e) {
|
|
|
692
513
|
}
|
|
693
514
|
return t;
|
|
694
515
|
}
|
|
695
|
-
function
|
|
516
|
+
function V(e, t) {
|
|
696
517
|
let n = e && typeof e == "object" ? e : void 0;
|
|
697
518
|
return t ? {
|
|
698
519
|
...n ?? {},
|
|
699
520
|
cursor: t
|
|
700
521
|
} : n;
|
|
701
522
|
}
|
|
702
|
-
function
|
|
703
|
-
if (!e) return
|
|
704
|
-
let t =
|
|
523
|
+
function Re(e) {
|
|
524
|
+
if (!e) return Ie;
|
|
525
|
+
let t = Fe.get(e);
|
|
705
526
|
if (t) return t;
|
|
706
527
|
let n = {};
|
|
707
528
|
for (let [t, r] of Object.entries(e)) if (r != null) {
|
|
708
529
|
if (t === "style" && typeof r == "string") {
|
|
709
|
-
n[t] =
|
|
530
|
+
n[t] = Le(r);
|
|
710
531
|
continue;
|
|
711
532
|
}
|
|
712
533
|
(typeof r == "string" || typeof r == "number" || typeof r == "boolean") && (n[t] = r);
|
|
713
534
|
}
|
|
714
|
-
return
|
|
535
|
+
return Fe.set(e, n), n;
|
|
715
536
|
}
|
|
716
|
-
function
|
|
537
|
+
function ze(e) {
|
|
717
538
|
let t = e.parentElement;
|
|
718
539
|
for (; t;) {
|
|
719
540
|
let e = window.getComputedStyle(t).overflowY;
|
|
@@ -722,34 +543,34 @@ function Le(e) {
|
|
|
722
543
|
}
|
|
723
544
|
return null;
|
|
724
545
|
}
|
|
725
|
-
var
|
|
726
|
-
function
|
|
546
|
+
var H = 1.5;
|
|
547
|
+
function U(e, t) {
|
|
727
548
|
requestAnimationFrame(() => {
|
|
728
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = e.scrollTop + (r.bottom - n.bottom) + 16, a = Math.abs(i - e.scrollTop) > e.clientHeight *
|
|
549
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = e.scrollTop + (r.bottom - n.bottom) + 16, a = Math.abs(i - e.scrollTop) > e.clientHeight * H ? "auto" : "smooth";
|
|
729
550
|
"scrollBehavior" in document.documentElement.style ? e.scrollTo({
|
|
730
551
|
top: i,
|
|
731
552
|
behavior: a
|
|
732
553
|
}) : e.scrollTop = i;
|
|
733
554
|
});
|
|
734
555
|
}
|
|
735
|
-
var
|
|
736
|
-
function
|
|
556
|
+
var W = "data-ikon-scroll-indicator", Be = .15, G = "data-ikon-at-bottom";
|
|
557
|
+
function Ve(e) {
|
|
737
558
|
return Math.max(e.clientHeight * Be, 20);
|
|
738
559
|
}
|
|
739
|
-
function
|
|
740
|
-
return e.getAttribute(
|
|
560
|
+
function He(e) {
|
|
561
|
+
return e.getAttribute(G) !== "false";
|
|
741
562
|
}
|
|
742
|
-
function
|
|
743
|
-
e.getAttribute(
|
|
744
|
-
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e, i = n - t - r <=
|
|
745
|
-
e.setAttribute(
|
|
563
|
+
function Ue(e) {
|
|
564
|
+
e.getAttribute(G) === null && (e.setAttribute(G, "true"), e.addEventListener("scroll", () => {
|
|
565
|
+
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e, i = n - t - r <= Ve(e);
|
|
566
|
+
e.setAttribute(G, i ? "true" : "false");
|
|
746
567
|
}, { passive: !0 }));
|
|
747
568
|
}
|
|
748
|
-
function
|
|
749
|
-
let t = e.parentElement ?? e, n = t.querySelector(`[${
|
|
569
|
+
function We(e) {
|
|
570
|
+
let t = e.parentElement ?? e, n = t.querySelector(`[${W}]`);
|
|
750
571
|
if (n) return n;
|
|
751
572
|
let r = document.createElement("button");
|
|
752
|
-
return r.setAttribute(
|
|
573
|
+
return r.setAttribute(W, "true"), r.setAttribute("aria-label", "Scroll to latest"), r.textContent = "↓", Object.assign(r.style, {
|
|
753
574
|
position: "absolute",
|
|
754
575
|
bottom: "12px",
|
|
755
576
|
left: "50%",
|
|
@@ -777,36 +598,36 @@ function Ge(e) {
|
|
|
777
598
|
r.style.opacity = "0.9";
|
|
778
599
|
}), t.appendChild(r), r;
|
|
779
600
|
}
|
|
780
|
-
function
|
|
781
|
-
let n =
|
|
601
|
+
function Ge(e, t) {
|
|
602
|
+
let n = We(e);
|
|
782
603
|
n.style.display = "flex";
|
|
783
604
|
let r = () => {
|
|
784
|
-
|
|
605
|
+
U(e, t), n.style.display = "none";
|
|
785
606
|
}, i = () => {
|
|
786
607
|
let { scrollTop: t, scrollHeight: r, clientHeight: i } = e;
|
|
787
|
-
r - t - i <=
|
|
608
|
+
r - t - i <= Ve(e) && (n.style.display = "none");
|
|
788
609
|
};
|
|
789
610
|
return n.addEventListener("click", r), e.addEventListener("scroll", i, { passive: !0 }), () => {
|
|
790
611
|
n.removeEventListener("click", r), e.removeEventListener("scroll", i);
|
|
791
612
|
};
|
|
792
613
|
}
|
|
793
|
-
function
|
|
794
|
-
let e =
|
|
795
|
-
let n =
|
|
796
|
-
return
|
|
614
|
+
function Ke() {
|
|
615
|
+
let e = D(function({ nodeId: e, context: t }) {
|
|
616
|
+
let n = L(t.store, e), r = j(null), i = B(n?.props?.targetViewId), a = n?.props?.focusOnly, o = typeof a == "boolean" ? a : void 0, s = B(n?.props?.priority), c = B(n?.props?.key), l = n?.props?.preciseGeneratedAt;
|
|
617
|
+
return k(() => {
|
|
797
618
|
if (typeof document > "u") return;
|
|
798
619
|
let e = r.current;
|
|
799
620
|
if (!e || i && e.closest("[data-ikon-view-id]")?.getAttribute("data-ikon-view-id") !== i) return;
|
|
800
621
|
let t;
|
|
801
622
|
if (o !== !0) {
|
|
802
|
-
let n =
|
|
803
|
-
if (n) if (
|
|
623
|
+
let n = ze(e);
|
|
624
|
+
if (n) if (Ue(n), s === "Polite" && !He(n)) t = Ge(n, e);
|
|
804
625
|
else {
|
|
805
|
-
let t = (n.parentElement ?? n).querySelector(`[${
|
|
806
|
-
t && (t.style.display = "none"),
|
|
626
|
+
let t = (n.parentElement ?? n).querySelector(`[${W}]`);
|
|
627
|
+
t && (t.style.display = "none"), U(n, e);
|
|
807
628
|
}
|
|
808
629
|
else typeof e.scrollIntoView == "function" && requestAnimationFrame(() => {
|
|
809
|
-
let t = e.getBoundingClientRect().top, n = typeof window < "u" ? window.innerHeight : 0, r = Math.abs(t) > n *
|
|
630
|
+
let t = e.getBoundingClientRect().top, n = typeof window < "u" ? window.innerHeight : 0, r = Math.abs(t) > n * H ? "auto" : "smooth";
|
|
810
631
|
try {
|
|
811
632
|
e.scrollIntoView({
|
|
812
633
|
behavior: r,
|
|
@@ -831,7 +652,7 @@ function qe() {
|
|
|
831
652
|
i,
|
|
832
653
|
c,
|
|
833
654
|
l
|
|
834
|
-
]), n ? /* @__PURE__ */ (
|
|
655
|
+
]), n ? /* @__PURE__ */ F("span", {
|
|
835
656
|
ref: r,
|
|
836
657
|
"data-ikon-node-id": n.id,
|
|
837
658
|
"data-ikon-source": n.sourceMarker,
|
|
@@ -849,16 +670,16 @@ function qe() {
|
|
|
849
670
|
if (t === "std.focus-hint") return e;
|
|
850
671
|
};
|
|
851
672
|
}
|
|
852
|
-
function
|
|
853
|
-
let e =
|
|
854
|
-
let r =
|
|
673
|
+
function qe() {
|
|
674
|
+
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
675
|
+
let r = L(t.store, e), i = Ne(r?.props?.onInvokeId), a = O(() => {
|
|
855
676
|
i && t.dispatchAction(i);
|
|
856
677
|
}, [i, t]);
|
|
857
678
|
if (!r) return null;
|
|
858
|
-
let o =
|
|
679
|
+
let o = Re(r.props);
|
|
859
680
|
delete o.onInvokeId;
|
|
860
|
-
let s = Pe(
|
|
861
|
-
return /* @__PURE__ */ (
|
|
681
|
+
let s = Pe(B(r.props?.className), n), c = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
682
|
+
return /* @__PURE__ */ F("div", {
|
|
862
683
|
...o,
|
|
863
684
|
"data-ikon-node-id": r.id,
|
|
864
685
|
"data-ikon-source": r.sourceMarker,
|
|
@@ -869,7 +690,7 @@ function Je() {
|
|
|
869
690
|
onKeyDown: i ? (e) => {
|
|
870
691
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), a());
|
|
871
692
|
} : void 0,
|
|
872
|
-
style:
|
|
693
|
+
style: V(o.style, i ? "pointer" : void 0),
|
|
873
694
|
children: c
|
|
874
695
|
});
|
|
875
696
|
});
|
|
@@ -877,12 +698,12 @@ function Je() {
|
|
|
877
698
|
if (t === "std.div") return e;
|
|
878
699
|
};
|
|
879
700
|
}
|
|
880
|
-
function
|
|
881
|
-
let e =
|
|
882
|
-
let r =
|
|
701
|
+
function Je() {
|
|
702
|
+
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
703
|
+
let r = L(t.store, e);
|
|
883
704
|
if (!r) return null;
|
|
884
|
-
let i =
|
|
885
|
-
return /* @__PURE__ */ (
|
|
705
|
+
let i = Re(r.props), a = Pe("relative", B(r.props?.className), n), o = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
706
|
+
return /* @__PURE__ */ F("div", {
|
|
886
707
|
...i,
|
|
887
708
|
"data-ikon-node-id": r.id,
|
|
888
709
|
"data-ikon-source": r.sourceMarker,
|
|
@@ -894,12 +715,12 @@ function Ye() {
|
|
|
894
715
|
if (t === "std.stack") return e;
|
|
895
716
|
};
|
|
896
717
|
}
|
|
897
|
-
function
|
|
898
|
-
let e =
|
|
899
|
-
let r =
|
|
718
|
+
function Ye() {
|
|
719
|
+
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
720
|
+
let r = L(t.store, e);
|
|
900
721
|
if (!r) return null;
|
|
901
|
-
let i =
|
|
902
|
-
return /* @__PURE__ */ (
|
|
722
|
+
let i = Re(r.props), a = Pe("absolute", B(r.props?.className), n), o = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
723
|
+
return /* @__PURE__ */ F("div", {
|
|
903
724
|
...i,
|
|
904
725
|
"data-ikon-node-id": r.id,
|
|
905
726
|
"data-ikon-source": r.sourceMarker,
|
|
@@ -911,23 +732,23 @@ function Xe() {
|
|
|
911
732
|
if (t === "std.layer") return e;
|
|
912
733
|
};
|
|
913
734
|
}
|
|
914
|
-
function
|
|
735
|
+
function Xe() {
|
|
915
736
|
return [
|
|
737
|
+
qe(),
|
|
916
738
|
Je(),
|
|
917
739
|
Ye(),
|
|
918
|
-
|
|
919
|
-
qe()
|
|
740
|
+
Ke()
|
|
920
741
|
];
|
|
921
742
|
}
|
|
922
743
|
//#endregion
|
|
923
744
|
//#region src/base/base-module.ts
|
|
924
|
-
var
|
|
925
|
-
function
|
|
926
|
-
e.registerModule(
|
|
745
|
+
var Ze = "base", Qe = async () => Xe();
|
|
746
|
+
function $e(e) {
|
|
747
|
+
e.registerModule(Ze, Qe);
|
|
927
748
|
}
|
|
928
749
|
//#endregion
|
|
929
750
|
//#region src/media/audio-player.tsx
|
|
930
|
-
function
|
|
751
|
+
function et(e) {
|
|
931
752
|
if (typeof e == "string") {
|
|
932
753
|
let t = e.trim();
|
|
933
754
|
return t.length > 0 ? t : void 0;
|
|
@@ -937,17 +758,17 @@ function tt(e) {
|
|
|
937
758
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
938
759
|
}
|
|
939
760
|
}
|
|
940
|
-
function
|
|
761
|
+
function tt(...e) {
|
|
941
762
|
let t = [];
|
|
942
763
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
943
764
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
944
765
|
}
|
|
945
|
-
function
|
|
766
|
+
function nt(e) {
|
|
946
767
|
if (typeof e != "string") return;
|
|
947
768
|
let t = e.trim();
|
|
948
769
|
return t.length > 0 ? t : void 0;
|
|
949
770
|
}
|
|
950
|
-
function
|
|
771
|
+
function rt(e) {
|
|
951
772
|
if (typeof e == "boolean") return e;
|
|
952
773
|
if (typeof e == "string") {
|
|
953
774
|
let t = e.trim().toLowerCase();
|
|
@@ -955,14 +776,14 @@ function it(e) {
|
|
|
955
776
|
if (t === "false") return !1;
|
|
956
777
|
}
|
|
957
778
|
}
|
|
958
|
-
function
|
|
959
|
-
let e =
|
|
960
|
-
let r =
|
|
961
|
-
if (
|
|
779
|
+
function it() {
|
|
780
|
+
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
781
|
+
let r = L(t.store, e), i = j(null), a = r ? rt(r.props?.autoplay) : void 0, o = r ? nt(r.props?.src) : void 0;
|
|
782
|
+
if (k(() => {
|
|
962
783
|
a && i.current && i.current.play().catch(() => {});
|
|
963
784
|
}, [a, o]), !r) return null;
|
|
964
|
-
let s =
|
|
965
|
-
return /* @__PURE__ */ (
|
|
785
|
+
let s = tt(et(r.props?.className), n), c = nt(r.props?.preload), l = rt(r.props?.controls), u = rt(r.props?.loop), d = rt(r.props?.muted);
|
|
786
|
+
return /* @__PURE__ */ F("audio", {
|
|
966
787
|
ref: i,
|
|
967
788
|
src: o,
|
|
968
789
|
...c === void 0 ? {} : { preload: c },
|
|
@@ -981,7 +802,7 @@ function at() {
|
|
|
981
802
|
}
|
|
982
803
|
//#endregion
|
|
983
804
|
//#region src/media/video-canvas.tsx
|
|
984
|
-
function
|
|
805
|
+
function at(e) {
|
|
985
806
|
if (typeof e == "string") {
|
|
986
807
|
let t = e.trim();
|
|
987
808
|
return t.length > 0 ? t : void 0;
|
|
@@ -991,28 +812,28 @@ function ot(e) {
|
|
|
991
812
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
992
813
|
}
|
|
993
814
|
}
|
|
994
|
-
function
|
|
815
|
+
function ot(...e) {
|
|
995
816
|
let t = [];
|
|
996
817
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
997
818
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
998
819
|
}
|
|
999
|
-
function
|
|
820
|
+
function st(e) {
|
|
1000
821
|
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
1001
822
|
if (typeof e == "string" && e.trim().length > 0) {
|
|
1002
823
|
let t = Number(e);
|
|
1003
824
|
if (Number.isFinite(t)) return Math.floor(t);
|
|
1004
825
|
}
|
|
1005
826
|
}
|
|
1006
|
-
function
|
|
827
|
+
function ct(e) {
|
|
1007
828
|
if (typeof e != "string") return;
|
|
1008
829
|
let t = e.trim();
|
|
1009
830
|
return t.length > 0 ? t : void 0;
|
|
1010
831
|
}
|
|
1011
|
-
var
|
|
1012
|
-
function
|
|
1013
|
-
let e =
|
|
1014
|
-
let r =
|
|
1015
|
-
|
|
832
|
+
var lt = _("IkonVideoCanvas"), ut = 100, dt = 50, ft = "std.video-canvas", pt = "std.video-url-player";
|
|
833
|
+
function mt() {
|
|
834
|
+
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
835
|
+
let r = L(t.store, e), i = j(null), a = j(null), o = t.client, s = r ? ct(r.props?.streamId) : void 0, c = r ? st(r.props?.width) : void 0, l = r ? st(r.props?.height) : void 0, u = r ? ot(at(r.props?.className), n) : n, [, d] = M(0);
|
|
836
|
+
k(() => {
|
|
1016
837
|
if (!o?.isWebRtcEnabled) return;
|
|
1017
838
|
let e = o.onWebRtcTrackMapChanged;
|
|
1018
839
|
return o.onWebRtcTrackMapChanged = (t) => {
|
|
@@ -1022,22 +843,22 @@ function ht() {
|
|
|
1022
843
|
};
|
|
1023
844
|
}, [o]);
|
|
1024
845
|
let f = o?.isWebRtcEnabled && s ? o.getWebRtcVideoStreamByStreamId(s) : null;
|
|
1025
|
-
return
|
|
846
|
+
return k(() => {
|
|
1026
847
|
let e = i.current;
|
|
1027
848
|
if (!e || !s || f) return;
|
|
1028
849
|
let n = !1, r, a = 0, o = () => {
|
|
1029
850
|
if (n) return;
|
|
1030
851
|
let i = t.video ?? t.client?.media?.video;
|
|
1031
852
|
if (!i) {
|
|
1032
|
-
if (a++ >=
|
|
1033
|
-
|
|
853
|
+
if (a++ >= dt) {
|
|
854
|
+
lt.warn(`Gave up attaching the canvas for stream ${s}: video playback never became available`);
|
|
1034
855
|
return;
|
|
1035
856
|
}
|
|
1036
|
-
r = setTimeout(o,
|
|
857
|
+
r = setTimeout(o, ut);
|
|
1037
858
|
return;
|
|
1038
859
|
}
|
|
1039
860
|
i.attachCanvas(s, e).catch((e) => {
|
|
1040
|
-
|
|
861
|
+
lt.error(`Failed to attach the canvas for stream ${s}, it will stay blank: ${String(e)}`);
|
|
1041
862
|
});
|
|
1042
863
|
};
|
|
1043
864
|
return o(), () => {
|
|
@@ -1047,12 +868,12 @@ function ht() {
|
|
|
1047
868
|
t,
|
|
1048
869
|
s,
|
|
1049
870
|
f
|
|
1050
|
-
]),
|
|
871
|
+
]), k(() => {
|
|
1051
872
|
let e = a.current;
|
|
1052
873
|
if (!(!e || !f)) return e.srcObject = f, () => {
|
|
1053
874
|
e.srcObject = null;
|
|
1054
875
|
};
|
|
1055
|
-
}, [f]), r ? f ? /* @__PURE__ */ (
|
|
876
|
+
}, [f]), r ? f ? /* @__PURE__ */ F("video", {
|
|
1056
877
|
ref: a,
|
|
1057
878
|
autoPlay: !0,
|
|
1058
879
|
playsInline: !0,
|
|
@@ -1063,7 +884,7 @@ function ht() {
|
|
|
1063
884
|
className: u,
|
|
1064
885
|
...c ? { width: c } : {},
|
|
1065
886
|
...l ? { height: l } : {}
|
|
1066
|
-
}, s) : /* @__PURE__ */ (
|
|
887
|
+
}, s) : /* @__PURE__ */ F("canvas", {
|
|
1067
888
|
ref: i,
|
|
1068
889
|
"data-ikon-node-id": r.id,
|
|
1069
890
|
"data-ikon-source": r.sourceMarker,
|
|
@@ -1077,14 +898,14 @@ function ht() {
|
|
|
1077
898
|
if (t === "std.video-canvas") return e;
|
|
1078
899
|
};
|
|
1079
900
|
}
|
|
1080
|
-
function
|
|
901
|
+
function ht() {
|
|
1081
902
|
return [
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
903
|
+
mt(),
|
|
904
|
+
_t(),
|
|
905
|
+
it()
|
|
1085
906
|
];
|
|
1086
907
|
}
|
|
1087
|
-
function
|
|
908
|
+
function gt(e) {
|
|
1088
909
|
if (typeof e == "boolean") return e;
|
|
1089
910
|
if (typeof e == "string") {
|
|
1090
911
|
let t = e.trim().toLowerCase();
|
|
@@ -1092,14 +913,14 @@ function _t(e) {
|
|
|
1092
913
|
if (t === "false") return !1;
|
|
1093
914
|
}
|
|
1094
915
|
}
|
|
1095
|
-
function
|
|
1096
|
-
let e =
|
|
1097
|
-
let r =
|
|
1098
|
-
if (
|
|
916
|
+
function _t() {
|
|
917
|
+
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
918
|
+
let r = L(t.store, e), i = j(null), a = r ? gt(r.props?.autoplay) : void 0, o = r ? ct(r.props?.src) : void 0;
|
|
919
|
+
if (k(() => {
|
|
1099
920
|
a && i.current && i.current.play().catch(() => {});
|
|
1100
921
|
}, [a, o]), !r) return null;
|
|
1101
|
-
let s =
|
|
1102
|
-
return /* @__PURE__ */ (
|
|
922
|
+
let s = ot(at(r.props?.className), n), c = ct(r.props?.poster), l = gt(r.props?.controls), u = gt(r.props?.loop), d = gt(r.props?.muted), f = gt(r.props?.playsInline), p = st(r.props?.width), m = st(r.props?.height), h = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
923
|
+
return /* @__PURE__ */ F("video", {
|
|
1103
924
|
ref: i,
|
|
1104
925
|
src: o,
|
|
1105
926
|
poster: c,
|
|
@@ -1122,20 +943,20 @@ function vt() {
|
|
|
1122
943
|
}
|
|
1123
944
|
//#endregion
|
|
1124
945
|
//#region src/media/media-module.ts
|
|
1125
|
-
var
|
|
1126
|
-
function
|
|
1127
|
-
e.registerModule(
|
|
946
|
+
var vt = "media", yt = async () => ht();
|
|
947
|
+
function bt(e) {
|
|
948
|
+
e.registerModule(vt, yt);
|
|
1128
949
|
}
|
|
1129
950
|
//#endregion
|
|
1130
951
|
//#region src/shadertoy/shadertoy-gl.ts
|
|
1131
|
-
var
|
|
1132
|
-
function
|
|
952
|
+
var xt = "#version 300 es\nin vec4 a_position;\nvoid main() {\n gl_Position = a_position;\n}\n", St = 4;
|
|
953
|
+
function Ct(e, t) {
|
|
1133
954
|
return RegExp(`\\buniform\\s+\\w+\\s+${t}\\s*;`, "g").test(e);
|
|
1134
955
|
}
|
|
1135
|
-
function
|
|
956
|
+
function wt(e, t) {
|
|
1136
957
|
let n = [];
|
|
1137
958
|
for (let [r, i] of Object.entries(t)) {
|
|
1138
|
-
if (
|
|
959
|
+
if (Ct(e, r)) continue;
|
|
1139
960
|
let t;
|
|
1140
961
|
switch (i.type) {
|
|
1141
962
|
case "float":
|
|
@@ -1193,7 +1014,7 @@ void main() {
|
|
|
1193
1014
|
}
|
|
1194
1015
|
`;
|
|
1195
1016
|
}
|
|
1196
|
-
var
|
|
1017
|
+
var Tt = class {
|
|
1197
1018
|
gl;
|
|
1198
1019
|
program = null;
|
|
1199
1020
|
positionBuffer = null;
|
|
@@ -1208,8 +1029,8 @@ var Et = class {
|
|
|
1208
1029
|
mouseClickX = 0;
|
|
1209
1030
|
mouseClickY = 0;
|
|
1210
1031
|
channels = [];
|
|
1211
|
-
channelResolution = new Float32Array(
|
|
1212
|
-
channelTime = new Float32Array(
|
|
1032
|
+
channelResolution = /* @__PURE__ */ new Float32Array(12);
|
|
1033
|
+
channelTime = new Float32Array(St);
|
|
1213
1034
|
lastError = null;
|
|
1214
1035
|
currentShaderSource = "";
|
|
1215
1036
|
constructor(e) {
|
|
@@ -1244,7 +1065,7 @@ var Et = class {
|
|
|
1244
1065
|
}
|
|
1245
1066
|
initializeChannels() {
|
|
1246
1067
|
let e = this.gl;
|
|
1247
|
-
for (let t = 0; t <
|
|
1068
|
+
for (let t = 0; t < St; t++) {
|
|
1248
1069
|
let t = e.createTexture();
|
|
1249
1070
|
e.bindTexture(e.TEXTURE_2D, t), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, new Uint8Array([
|
|
1250
1071
|
0,
|
|
@@ -1261,7 +1082,7 @@ var Et = class {
|
|
|
1261
1082
|
e.bindTexture(e.TEXTURE_2D, null);
|
|
1262
1083
|
}
|
|
1263
1084
|
setChannels(e) {
|
|
1264
|
-
for (let t = 0; t <
|
|
1085
|
+
for (let t = 0; t < St; t++) {
|
|
1265
1086
|
let n = e[t] ?? null, r = this.channels[t];
|
|
1266
1087
|
if (r.url !== n) {
|
|
1267
1088
|
if (r.url = n, !n) {
|
|
@@ -1292,9 +1113,9 @@ var Et = class {
|
|
|
1292
1113
|
}
|
|
1293
1114
|
compile(e, t = {}) {
|
|
1294
1115
|
this.lastError = null, this.customUniforms = t, this.currentShaderSource = e;
|
|
1295
|
-
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER,
|
|
1116
|
+
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER, xt);
|
|
1296
1117
|
if (!r) return !1;
|
|
1297
|
-
let i =
|
|
1118
|
+
let i = wt(e, t), a = this.compileShader(n.FRAGMENT_SHADER, i);
|
|
1298
1119
|
if (!a) return n.deleteShader(r), !1;
|
|
1299
1120
|
let o = n.createProgram();
|
|
1300
1121
|
return o ? (n.attachShader(o, r), n.attachShader(o, a), n.linkProgram(o), n.deleteShader(r), n.deleteShader(a), n.getProgramParameter(o, n.LINK_STATUS) ? (this.program && n.deleteProgram(this.program), this.program = o, this.cacheUniformLocations(), !0) : (this.lastError = n.getProgramInfoLog(o) || "Program link failed", n.deleteProgram(o), !1)) : (this.lastError = "Failed to create program", n.deleteShader(r), n.deleteShader(a), !1);
|
|
@@ -1318,7 +1139,7 @@ var Et = class {
|
|
|
1318
1139
|
"iMouse",
|
|
1319
1140
|
"iDate"
|
|
1320
1141
|
]) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
1321
|
-
for (let t = 0; t <
|
|
1142
|
+
for (let t = 0; t < St; t++) this.uniformLocations.set(`iChannel${t}`, e.getUniformLocation(this.program, `iChannel${t}`));
|
|
1322
1143
|
this.uniformLocations.set("iChannelResolution", e.getUniformLocation(this.program, "iChannelResolution[0]")), this.uniformLocations.set("iChannelTime", e.getUniformLocation(this.program, "iChannelTime[0]"));
|
|
1323
1144
|
for (let t of Object.keys(this.customUniforms)) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
1324
1145
|
}
|
|
@@ -1350,7 +1171,7 @@ var Et = class {
|
|
|
1350
1171
|
let t = /* @__PURE__ */ new Date();
|
|
1351
1172
|
e.uniform4f(p, t.getFullYear(), t.getMonth(), t.getDate(), t.getHours() * 3600 + t.getMinutes() * 60 + t.getSeconds() + t.getMilliseconds() / 1e3);
|
|
1352
1173
|
}
|
|
1353
|
-
for (let t = 0; t <
|
|
1174
|
+
for (let t = 0; t < St; t++) {
|
|
1354
1175
|
e.activeTexture(e.TEXTURE0 + t), e.bindTexture(e.TEXTURE_2D, this.channels[t].texture);
|
|
1355
1176
|
let n = this.uniformLocations.get(`iChannel${t}`);
|
|
1356
1177
|
n && e.uniform1i(n, t);
|
|
@@ -1383,9 +1204,7 @@ var Et = class {
|
|
|
1383
1204
|
case "int":
|
|
1384
1205
|
e.uniform1i(r, n.value);
|
|
1385
1206
|
break;
|
|
1386
|
-
case "bool":
|
|
1387
|
-
e.uniform1i(r, +!!n.value);
|
|
1388
|
-
break;
|
|
1207
|
+
case "bool": e.uniform1i(r, +!!n.value);
|
|
1389
1208
|
}
|
|
1390
1209
|
}
|
|
1391
1210
|
e.drawArrays(e.TRIANGLES, 0, 6), e.bindVertexArray(null);
|
|
@@ -1402,7 +1221,7 @@ var Et = class {
|
|
|
1402
1221
|
};
|
|
1403
1222
|
//#endregion
|
|
1404
1223
|
//#region src/shadertoy/shadertoy-renderer.tsx
|
|
1405
|
-
function
|
|
1224
|
+
function Et(e) {
|
|
1406
1225
|
if (typeof e == "string") {
|
|
1407
1226
|
let t = e.trim();
|
|
1408
1227
|
return t.length > 0 ? t : void 0;
|
|
@@ -1412,22 +1231,22 @@ function Dt(e) {
|
|
|
1412
1231
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1413
1232
|
}
|
|
1414
1233
|
}
|
|
1415
|
-
function
|
|
1234
|
+
function Dt(...e) {
|
|
1416
1235
|
let t = [];
|
|
1417
1236
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
1418
1237
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1419
1238
|
}
|
|
1420
|
-
function
|
|
1239
|
+
function Ot(e) {
|
|
1421
1240
|
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
1422
1241
|
if (typeof e == "string" && e.trim().length > 0) {
|
|
1423
1242
|
let t = Number(e);
|
|
1424
1243
|
if (Number.isFinite(t)) return Math.floor(t);
|
|
1425
1244
|
}
|
|
1426
1245
|
}
|
|
1427
|
-
function
|
|
1246
|
+
function kt(e) {
|
|
1428
1247
|
return typeof e == "string" ? e : "";
|
|
1429
1248
|
}
|
|
1430
|
-
function
|
|
1249
|
+
function At(e) {
|
|
1431
1250
|
if (typeof e == "boolean") return e;
|
|
1432
1251
|
if (typeof e == "string") {
|
|
1433
1252
|
let t = e.trim().toLowerCase();
|
|
@@ -1435,13 +1254,13 @@ function jt(e) {
|
|
|
1435
1254
|
if (t === "false") return !1;
|
|
1436
1255
|
}
|
|
1437
1256
|
}
|
|
1438
|
-
function
|
|
1257
|
+
function jt(e) {
|
|
1439
1258
|
if (!e || typeof e != "object") return {};
|
|
1440
1259
|
let t = {}, n = e;
|
|
1441
1260
|
for (let [e, r] of Object.entries(n)) {
|
|
1442
1261
|
if (!r || typeof r != "object") continue;
|
|
1443
1262
|
let n = r, i = n.value, a = n.type;
|
|
1444
|
-
i
|
|
1263
|
+
i !== void 0 && typeof a == "string" && [
|
|
1445
1264
|
"float",
|
|
1446
1265
|
"vec2",
|
|
1447
1266
|
"vec3",
|
|
@@ -1455,10 +1274,10 @@ function Mt(e) {
|
|
|
1455
1274
|
}
|
|
1456
1275
|
return t;
|
|
1457
1276
|
}
|
|
1458
|
-
function
|
|
1277
|
+
function Mt(e) {
|
|
1459
1278
|
return Array.isArray(e) ? e.map((e) => typeof e == "string" ? e : null) : [];
|
|
1460
1279
|
}
|
|
1461
|
-
function
|
|
1280
|
+
function Nt(e, t) {
|
|
1462
1281
|
let n = Object.keys(e), r = Object.keys(t);
|
|
1463
1282
|
if (n.length !== r.length) return !1;
|
|
1464
1283
|
for (let r of n) {
|
|
@@ -1472,21 +1291,21 @@ function Pt(e, t) {
|
|
|
1472
1291
|
}
|
|
1473
1292
|
return !0;
|
|
1474
1293
|
}
|
|
1475
|
-
var
|
|
1476
|
-
function
|
|
1477
|
-
let e =
|
|
1478
|
-
let r =
|
|
1294
|
+
var Pt = "std.shadertoy-canvas";
|
|
1295
|
+
function Ft() {
|
|
1296
|
+
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
1297
|
+
let r = L(t.store, e), i = j(null), a = j(null), o = j(null), s = j(0), c = j(""), l = j({}), u = j({
|
|
1479
1298
|
x: 0,
|
|
1480
1299
|
y: 0,
|
|
1481
1300
|
clickX: 0,
|
|
1482
1301
|
clickY: 0,
|
|
1483
1302
|
isDown: !1
|
|
1484
|
-
}), d = r ?
|
|
1485
|
-
|
|
1303
|
+
}), d = r ? kt(r.props?.shaderSource) : "", f = r ? Ot(r.props?.fps) ?? 60 : 60, p = r?.props?.uniforms, m = A(() => jt(p), [p]), h = r?.props?.channels, g = A(() => Mt(h), [h]), _ = r ? At(r.props?.enableMouse) ?? !0 : !0, v = r ? Ot(r.props?.width) : void 0, y = r ? Ot(r.props?.height) : void 0, ee = r ? Dt(Et(r.props?.className), n) : n;
|
|
1304
|
+
k(() => {
|
|
1486
1305
|
let e = i.current;
|
|
1487
1306
|
if (e) {
|
|
1488
1307
|
try {
|
|
1489
|
-
let t = new
|
|
1308
|
+
let t = new Tt(e);
|
|
1490
1309
|
a.current = t;
|
|
1491
1310
|
} catch (e) {
|
|
1492
1311
|
console.error("[ShadertoyRenderer] Failed to create WebGL2 context:", e);
|
|
@@ -1495,20 +1314,20 @@ function It() {
|
|
|
1495
1314
|
a.current &&= (a.current.destroy(), null);
|
|
1496
1315
|
};
|
|
1497
1316
|
}
|
|
1498
|
-
}, []),
|
|
1317
|
+
}, []), k(() => {
|
|
1499
1318
|
let e = a.current;
|
|
1500
1319
|
if (!(!e || !d) && c.current !== d) if (e.compile(d, m)) c.current = d, l.current = m;
|
|
1501
1320
|
else {
|
|
1502
1321
|
let t = e.getError();
|
|
1503
1322
|
console.error("[ShadertoyRenderer] Shader compilation failed:", t);
|
|
1504
1323
|
}
|
|
1505
|
-
}, [d, m]),
|
|
1324
|
+
}, [d, m]), k(() => {
|
|
1506
1325
|
let e = a.current;
|
|
1507
|
-
!e || !c.current ||
|
|
1508
|
-
}, [m]),
|
|
1326
|
+
!e || !c.current || Nt(l.current, m) || (e.setCustomUniforms(m), l.current = m);
|
|
1327
|
+
}, [m]), k(() => {
|
|
1509
1328
|
let e = a.current;
|
|
1510
1329
|
e && e.setChannels(g);
|
|
1511
|
-
}, [g]),
|
|
1330
|
+
}, [g]), k(() => {
|
|
1512
1331
|
let e = a.current;
|
|
1513
1332
|
if (!e || !c.current) return;
|
|
1514
1333
|
let t = 1e3 / f, n = (r) => {
|
|
@@ -1519,32 +1338,32 @@ function It() {
|
|
|
1519
1338
|
o.current !== null && (cancelAnimationFrame(o.current), o.current = null);
|
|
1520
1339
|
};
|
|
1521
1340
|
}, [f]);
|
|
1522
|
-
let
|
|
1341
|
+
let b = O((e) => {
|
|
1523
1342
|
if (!_) return;
|
|
1524
1343
|
let t = i.current, n = a.current;
|
|
1525
1344
|
if (!t || !n) return;
|
|
1526
1345
|
let r = window.devicePixelRatio || 1, o = t.getBoundingClientRect(), s = (e.clientX - o.left) * r, c = (o.height - (e.clientY - o.top)) * r;
|
|
1527
1346
|
u.current.x = s, u.current.y = c, n.setMouse(s, c, u.current.clickX, u.current.clickY);
|
|
1528
|
-
}, [_]),
|
|
1347
|
+
}, [_]), x = O((e) => {
|
|
1529
1348
|
if (!_) return;
|
|
1530
1349
|
let t = i.current, n = a.current;
|
|
1531
1350
|
if (!t || !n) return;
|
|
1532
1351
|
let r = window.devicePixelRatio || 1, o = t.getBoundingClientRect(), s = (e.clientX - o.left) * r, c = (o.height - (e.clientY - o.top)) * r;
|
|
1533
1352
|
u.current.isDown = !0, u.current.clickX = s, u.current.clickY = c, n.setMouse(s, c, s, c);
|
|
1534
|
-
}, [_]),
|
|
1353
|
+
}, [_]), S = O(() => {
|
|
1535
1354
|
_ && (u.current.isDown = !1, u.current.clickX = -Math.abs(u.current.clickX));
|
|
1536
1355
|
}, [_]);
|
|
1537
|
-
return r ? /* @__PURE__ */ (
|
|
1356
|
+
return r ? /* @__PURE__ */ F("canvas", {
|
|
1538
1357
|
ref: i,
|
|
1539
1358
|
"data-ikon-node-id": r.id,
|
|
1540
1359
|
"data-ikon-source": r.sourceMarker,
|
|
1541
|
-
className:
|
|
1360
|
+
className: ee,
|
|
1542
1361
|
...v ? { width: v } : {},
|
|
1543
1362
|
...y ? { height: y } : {},
|
|
1544
|
-
onMouseMove:
|
|
1545
|
-
onMouseDown:
|
|
1546
|
-
onMouseUp:
|
|
1547
|
-
onMouseLeave:
|
|
1363
|
+
onMouseMove: b,
|
|
1364
|
+
onMouseDown: x,
|
|
1365
|
+
onMouseUp: S,
|
|
1366
|
+
onMouseLeave: S
|
|
1548
1367
|
}) : null;
|
|
1549
1368
|
});
|
|
1550
1369
|
return ({ type: t }) => {
|
|
@@ -1553,13 +1372,13 @@ function It() {
|
|
|
1553
1372
|
}
|
|
1554
1373
|
//#endregion
|
|
1555
1374
|
//#region src/shadertoy/shadertoy-module.ts
|
|
1556
|
-
var
|
|
1557
|
-
function
|
|
1558
|
-
e.registerModule(
|
|
1375
|
+
var It = "shadertoy", Lt = async () => Ft();
|
|
1376
|
+
function Rt(e) {
|
|
1377
|
+
e.registerModule(It, Lt);
|
|
1559
1378
|
}
|
|
1560
1379
|
//#endregion
|
|
1561
1380
|
//#region src/ikon-ui-registry.ts
|
|
1562
|
-
var
|
|
1381
|
+
var zt = _("UIRegistry"), Bt = class {
|
|
1563
1382
|
baseResolvers = [];
|
|
1564
1383
|
moduleLoaders = /* @__PURE__ */ new Map();
|
|
1565
1384
|
moduleResolvers = /* @__PURE__ */ new Map();
|
|
@@ -1585,14 +1404,14 @@ var Bt = _("UIRegistry"), Vt = class {
|
|
|
1585
1404
|
async loadRegisteredModules() {
|
|
1586
1405
|
let e = !1;
|
|
1587
1406
|
for (let [t, n] of this.moduleLoaders.entries()) if (!this.moduleResolvers.has(t)) try {
|
|
1588
|
-
let r =
|
|
1407
|
+
let r = Ut(await n());
|
|
1589
1408
|
this.moduleResolvers.set(t, r), e = !0;
|
|
1590
1409
|
} catch (e) {
|
|
1591
|
-
|
|
1410
|
+
zt.error(`[IkonUiRegistry] Failed to load module '${t}'.`, e);
|
|
1592
1411
|
}
|
|
1593
1412
|
let t = [];
|
|
1594
1413
|
for (let e of this.moduleLoaders.keys()) this.moduleResolvers.has(e) && t.push(e);
|
|
1595
|
-
return
|
|
1414
|
+
return Wt(t, this.activeModuleOrder) || (this.activeModuleOrder = t, e = !0), e && this.notify(), e;
|
|
1596
1415
|
}
|
|
1597
1416
|
resolve(e) {
|
|
1598
1417
|
for (let t of this.baseResolvers) {
|
|
@@ -1602,7 +1421,7 @@ var Bt = _("UIRegistry"), Vt = class {
|
|
|
1602
1421
|
for (let t of this.activeModuleOrder) {
|
|
1603
1422
|
let n = this.moduleResolvers.get(t);
|
|
1604
1423
|
if (!n) {
|
|
1605
|
-
|
|
1424
|
+
zt.warn(`Missing resolvers for module ${t}`);
|
|
1606
1425
|
continue;
|
|
1607
1426
|
}
|
|
1608
1427
|
for (let t of n) {
|
|
@@ -1615,25 +1434,25 @@ var Bt = _("UIRegistry"), Vt = class {
|
|
|
1615
1434
|
for (let e of this.listeners) e();
|
|
1616
1435
|
}
|
|
1617
1436
|
};
|
|
1618
|
-
function
|
|
1619
|
-
let e = new
|
|
1620
|
-
return
|
|
1437
|
+
function Vt() {
|
|
1438
|
+
let e = new Bt();
|
|
1439
|
+
return $e(e), bt(e), Rt(e), e.loadRegisteredModules(), e;
|
|
1621
1440
|
}
|
|
1622
|
-
function
|
|
1441
|
+
function Ht(e) {
|
|
1623
1442
|
return Array.isArray(e) ? e : [e];
|
|
1624
1443
|
}
|
|
1625
|
-
function
|
|
1626
|
-
return e ?
|
|
1444
|
+
function Ut(e) {
|
|
1445
|
+
return e ? Ht(e).flatMap((e) => e ? Array.isArray(e) ? e.filter(Boolean) : [e] : []) : [];
|
|
1627
1446
|
}
|
|
1628
|
-
function
|
|
1447
|
+
function Wt(e, t) {
|
|
1629
1448
|
if (e.length !== t.length) return !1;
|
|
1630
1449
|
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
1631
1450
|
return !0;
|
|
1632
1451
|
}
|
|
1633
1452
|
//#endregion
|
|
1634
1453
|
//#region src/parallax-view.tsx
|
|
1635
|
-
function
|
|
1636
|
-
return /* @__PURE__ */ (
|
|
1454
|
+
function Gt({ mount: e, stores: t, registry: n, client: r, onAction: i }) {
|
|
1455
|
+
return /* @__PURE__ */ F(z, {
|
|
1637
1456
|
stores: t,
|
|
1638
1457
|
registry: n,
|
|
1639
1458
|
category: e,
|
|
@@ -1643,7 +1462,7 @@ function Kt({ mount: e, stores: t, registry: n, client: r, onAction: i }) {
|
|
|
1643
1462
|
}
|
|
1644
1463
|
//#endregion
|
|
1645
1464
|
//#region src/motion/motion-controller.ts
|
|
1646
|
-
var
|
|
1465
|
+
var Kt = _("MotionController"), qt = {
|
|
1647
1466
|
ease: [
|
|
1648
1467
|
.25,
|
|
1649
1468
|
.1,
|
|
@@ -1813,20 +1632,20 @@ var qt = _("MotionController"), Jt = {
|
|
|
1813
1632
|
1.55
|
|
1814
1633
|
]
|
|
1815
1634
|
};
|
|
1816
|
-
function
|
|
1635
|
+
function K(e) {
|
|
1817
1636
|
return e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
1818
1637
|
}
|
|
1819
|
-
function
|
|
1638
|
+
function Jt(e) {
|
|
1820
1639
|
if (e == null) return;
|
|
1821
1640
|
let t = e.trim();
|
|
1822
1641
|
if (!t) return;
|
|
1823
1642
|
let n = Number.parseFloat(t);
|
|
1824
1643
|
return Number.isFinite(n) ? n : void 0;
|
|
1825
1644
|
}
|
|
1826
|
-
function
|
|
1645
|
+
function Yt(e) {
|
|
1827
1646
|
return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
1828
1647
|
}
|
|
1829
|
-
function
|
|
1648
|
+
function Xt(e, t, n, r) {
|
|
1830
1649
|
let i = 1 / 10, a = /* @__PURE__ */ new Float32Array(11);
|
|
1831
1650
|
function o(e, t, n) {
|
|
1832
1651
|
return ((3 * t - 3 * n + 1) * e + (3 * n - 6 * t)) * e * e + 3 * t * e;
|
|
@@ -1860,34 +1679,34 @@ function Zt(e, t, n, r) {
|
|
|
1860
1679
|
for (let t = 0; t < 11; t += 1) a[t] = o(t * i, e, n);
|
|
1861
1680
|
return (e) => e <= 0 ? 0 : e >= 1 ? 1 : o(u(e), t, r);
|
|
1862
1681
|
}
|
|
1863
|
-
function
|
|
1682
|
+
function Zt(e) {
|
|
1864
1683
|
let t = /steps\(\s*([0-9]+)\s*(?:,\s*([a-z-]+)\s*)?\)/i.exec(e);
|
|
1865
|
-
if (!t) return (e) =>
|
|
1684
|
+
if (!t) return (e) => K(e);
|
|
1866
1685
|
let n = Math.max(1, parseInt(t[1], 10)), r = (t[2] ?? "end").toLowerCase();
|
|
1867
|
-
return r === "start" || r === "jump-start" ? (e) =>
|
|
1686
|
+
return r === "start" || r === "jump-start" ? (e) => K(Math.ceil(e * n) / n) : r === "none" || r === "jump-none" ? (e) => K(Math.round(e * n) / n) : r === "both" || r === "jump-both" ? (e) => K((Math.floor(e * n) + .5) / n) : (e) => K(Math.floor(e * n) / n);
|
|
1868
1687
|
}
|
|
1869
|
-
function
|
|
1870
|
-
if (!e) return (e) =>
|
|
1688
|
+
function Qt(e) {
|
|
1689
|
+
if (!e) return (e) => K(e);
|
|
1871
1690
|
let t = e.trim().toLowerCase();
|
|
1872
|
-
if (!t || t === "linear") return (e) =>
|
|
1873
|
-
if (
|
|
1874
|
-
let [e, n, r, i] =
|
|
1875
|
-
return (e) =>
|
|
1691
|
+
if (!t || t === "linear") return (e) => K(e);
|
|
1692
|
+
if (qt[t]) {
|
|
1693
|
+
let [e, n, r, i] = qt[t], a = Xt(e, n, r, i);
|
|
1694
|
+
return (e) => K(a(K(e)));
|
|
1876
1695
|
}
|
|
1877
1696
|
if (t.startsWith("cubic-bezier(") && t.endsWith(")")) {
|
|
1878
1697
|
let e = t.slice(13, -1).split(",").map((e) => Number.parseFloat(e.trim()));
|
|
1879
1698
|
if (e.length === 4 && e.every((e) => Number.isFinite(e))) {
|
|
1880
|
-
let [t, n, r, i] = e, a =
|
|
1881
|
-
return (e) =>
|
|
1699
|
+
let [t, n, r, i] = e, a = Xt(t, n, r, i);
|
|
1700
|
+
return (e) => K(a(K(e)));
|
|
1882
1701
|
}
|
|
1883
1702
|
}
|
|
1884
1703
|
if (t.startsWith("steps(") && t.endsWith(")")) {
|
|
1885
|
-
let e =
|
|
1886
|
-
return (t) => e(
|
|
1704
|
+
let e = Zt(t);
|
|
1705
|
+
return (t) => e(K(t));
|
|
1887
1706
|
}
|
|
1888
|
-
return (e) =>
|
|
1707
|
+
return (e) => K(e);
|
|
1889
1708
|
}
|
|
1890
|
-
function
|
|
1709
|
+
function $t(e) {
|
|
1891
1710
|
if (!e) return;
|
|
1892
1711
|
let t = /(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)\s*->\s*(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)/.exec(e);
|
|
1893
1712
|
if (!t) return;
|
|
@@ -1904,7 +1723,7 @@ function en(e) {
|
|
|
1904
1723
|
outEnd: a
|
|
1905
1724
|
};
|
|
1906
1725
|
}
|
|
1907
|
-
var
|
|
1726
|
+
var en = new class {
|
|
1908
1727
|
bindingsByStyle = /* @__PURE__ */ new Map();
|
|
1909
1728
|
observer;
|
|
1910
1729
|
observeScheduled = !1;
|
|
@@ -1929,7 +1748,7 @@ var tn = new class {
|
|
|
1929
1748
|
for (let e of Array.from(this.globalCleanups)) try {
|
|
1930
1749
|
e();
|
|
1931
1750
|
} catch (e) {
|
|
1932
|
-
|
|
1751
|
+
Kt.warn("Failed to cleanup binding listener", e);
|
|
1933
1752
|
}
|
|
1934
1753
|
this.globalCleanups.clear(), this.elementStates.clear(), this.styleToElements.clear(), this.bindingsByStyle.clear(), this.pendingScanStyles.clear(), this.scanScheduled = !1, this.observer &&= (this.observer.disconnect(), void 0);
|
|
1935
1754
|
}
|
|
@@ -1938,14 +1757,14 @@ var tn = new class {
|
|
|
1938
1757
|
let t = (JSON.parse(e).motionBindings ?? []).map((e) => this.parseBinding(e)).filter((e) => e !== void 0);
|
|
1939
1758
|
return t.length === 0 ? void 0 : { bindings: t };
|
|
1940
1759
|
} catch (e) {
|
|
1941
|
-
|
|
1760
|
+
Kt.warn("Failed to parse motion metadata", e);
|
|
1942
1761
|
return;
|
|
1943
1762
|
}
|
|
1944
1763
|
}
|
|
1945
1764
|
parseBinding(e) {
|
|
1946
1765
|
let t = e.source?.trim();
|
|
1947
1766
|
if (!t) return;
|
|
1948
|
-
let n =
|
|
1767
|
+
let n = Jt(e.min) ?? 0, r = Jt(e.max), i = r === void 0 ? n + 100 : r, a = (e.clamp ?? "clamp").trim().toLowerCase(), o = !!e.reverse, s = Qt(e.ease), c = $t(e.map), l = e.targetId?.trim() || void 0;
|
|
1949
1768
|
if (!(Number.isNaN(n) || Number.isNaN(i))) return {
|
|
1950
1769
|
source: t.toLowerCase(),
|
|
1951
1770
|
min: n,
|
|
@@ -1991,7 +1810,7 @@ var tn = new class {
|
|
|
1991
1810
|
scanExistingNodes(e) {
|
|
1992
1811
|
let t = this.bindingsByStyle.get(e);
|
|
1993
1812
|
if (!t || typeof document > "u") return;
|
|
1994
|
-
let n = `.${
|
|
1813
|
+
let n = `.${Yt(e)}`;
|
|
1995
1814
|
document.querySelectorAll(n).forEach((n) => this.applyStyleToElement(n, e, t));
|
|
1996
1815
|
}
|
|
1997
1816
|
applyStyleToElement(e, t, n) {
|
|
@@ -2008,12 +1827,7 @@ var tn = new class {
|
|
|
2008
1827
|
for (let r of n.bindings) this.attachBinding(e, t, r);
|
|
2009
1828
|
}
|
|
2010
1829
|
attachBinding(e, t, n) {
|
|
2011
|
-
|
|
2012
|
-
case "scrolly":
|
|
2013
|
-
this.attachScrollBinding(e, t, n);
|
|
2014
|
-
break;
|
|
2015
|
-
default: break;
|
|
2016
|
-
}
|
|
1830
|
+
n.source === "scrolly" && this.attachScrollBinding(e, t, n);
|
|
2017
1831
|
}
|
|
2018
1832
|
attachScrollBinding(e, t, n) {
|
|
2019
1833
|
let r = this.resolveScrollContainer(e, n);
|
|
@@ -2032,7 +1846,7 @@ var tn = new class {
|
|
|
2032
1846
|
}
|
|
2033
1847
|
resolveScrollContainer(e, t) {
|
|
2034
1848
|
if (t.targetId) {
|
|
2035
|
-
let e = `[data-ikon-motion-source="${
|
|
1849
|
+
let e = `[data-ikon-motion-source="${Yt(t.targetId)}"]`, n = typeof document < "u" ? document.querySelector(e) : null;
|
|
2036
1850
|
if (n) return n;
|
|
2037
1851
|
}
|
|
2038
1852
|
return e.closest("[data-ikon-view-type=\"scroll-view\"]");
|
|
@@ -2052,7 +1866,7 @@ var tn = new class {
|
|
|
2052
1866
|
case "freeze-start": return e < 0 ? 0 : e;
|
|
2053
1867
|
case "freeze-end": return e > 1 ? 1 : e;
|
|
2054
1868
|
case "unclamped": return e;
|
|
2055
|
-
default: return
|
|
1869
|
+
default: return K(e);
|
|
2056
1870
|
}
|
|
2057
1871
|
}
|
|
2058
1872
|
applyMap(e, t) {
|
|
@@ -2087,7 +1901,7 @@ var tn = new class {
|
|
|
2087
1901
|
try {
|
|
2088
1902
|
e();
|
|
2089
1903
|
} catch (e) {
|
|
2090
|
-
|
|
1904
|
+
Kt.warn("Failed to cleanup listener", e);
|
|
2091
1905
|
}
|
|
2092
1906
|
this.globalCleanups.delete(e);
|
|
2093
1907
|
}
|
|
@@ -2127,28 +1941,28 @@ var tn = new class {
|
|
|
2127
1941
|
}();
|
|
2128
1942
|
//#endregion
|
|
2129
1943
|
//#region src/use-ikon-styles.ts
|
|
2130
|
-
function
|
|
2131
|
-
let t =
|
|
1944
|
+
function tn(e) {
|
|
1945
|
+
let t = j(/* @__PURE__ */ new Map()), n = O(({ styleId: e, css: n, common: r }) => {
|
|
2132
1946
|
if (!(!e || typeof document > "u")) {
|
|
2133
1947
|
if (n) {
|
|
2134
1948
|
let r = t.current.get(e);
|
|
2135
1949
|
r || (r = document.createElement("style"), r.setAttribute("data-ikon-style-id", e), document.head.appendChild(r), t.current.set(e, r)), r.textContent = n;
|
|
2136
1950
|
}
|
|
2137
|
-
|
|
1951
|
+
en.registerStyle(e, r);
|
|
2138
1952
|
}
|
|
2139
|
-
}, []), r =
|
|
1953
|
+
}, []), r = O((e) => {
|
|
2140
1954
|
if (!(typeof document > "u")) for (let n of e) {
|
|
2141
1955
|
let e = t.current.get(n);
|
|
2142
|
-
e && (e.remove(), t.current.delete(n)),
|
|
1956
|
+
e && (e.remove(), t.current.delete(n)), en.unregisterStyle(n);
|
|
2143
1957
|
}
|
|
2144
|
-
}, []), i =
|
|
1958
|
+
}, []), i = O(() => {
|
|
2145
1959
|
if (typeof document < "u") {
|
|
2146
1960
|
for (let e of t.current.values()) e.remove();
|
|
2147
1961
|
t.current.clear();
|
|
2148
1962
|
}
|
|
2149
|
-
|
|
1963
|
+
en.reset();
|
|
2150
1964
|
}, []);
|
|
2151
|
-
return
|
|
1965
|
+
return k(() => {
|
|
2152
1966
|
if (!e) return;
|
|
2153
1967
|
for (let t of e.getUiStyles()) n(t);
|
|
2154
1968
|
let t = e.subscribeToStyles(n), a = e.subscribeToStyleDeletes?.(r);
|
|
@@ -2160,7 +1974,7 @@ function nn(e) {
|
|
|
2160
1974
|
i,
|
|
2161
1975
|
n,
|
|
2162
1976
|
r
|
|
2163
|
-
]),
|
|
1977
|
+
]), k(() => () => i(), [i]), {
|
|
2164
1978
|
setStyle: n,
|
|
2165
1979
|
deleteStyles: r,
|
|
2166
1980
|
reset: i
|
|
@@ -2168,7 +1982,7 @@ function nn(e) {
|
|
|
2168
1982
|
}
|
|
2169
1983
|
//#endregion
|
|
2170
1984
|
//#region src/use-ikon-ui-stores.ts
|
|
2171
|
-
function
|
|
1985
|
+
function nn(e) {
|
|
2172
1986
|
let t = [];
|
|
2173
1987
|
for (let [n, r] of e) {
|
|
2174
1988
|
let e = r.store.getSnapshot(), i = e.rootViewId && e.views.has(e.rootViewId);
|
|
@@ -2176,15 +1990,15 @@ function rn(e) {
|
|
|
2176
1990
|
}
|
|
2177
1991
|
return t.sort(), t.join(",");
|
|
2178
1992
|
}
|
|
2179
|
-
function
|
|
2180
|
-
let [t, n] =
|
|
2181
|
-
return
|
|
1993
|
+
function rn(e) {
|
|
1994
|
+
let [t, n] = M(), r = j("");
|
|
1995
|
+
return k(() => {
|
|
2182
1996
|
if (!e) {
|
|
2183
1997
|
n(void 0), r.current = "";
|
|
2184
1998
|
return;
|
|
2185
1999
|
}
|
|
2186
2000
|
let t = () => {
|
|
2187
|
-
let t = e.getStores(), i =
|
|
2001
|
+
let t = e.getStores(), i = nn(t);
|
|
2188
2002
|
i !== r.current && (r.current = i, n(t));
|
|
2189
2003
|
};
|
|
2190
2004
|
return t(), e.subscribe(t);
|
|
@@ -2192,16 +2006,16 @@ function an(e) {
|
|
|
2192
2006
|
}
|
|
2193
2007
|
//#endregion
|
|
2194
2008
|
//#region src/shared/render-motion-letters.tsx
|
|
2195
|
-
var
|
|
2009
|
+
var q = {
|
|
2196
2010
|
None: 0,
|
|
2197
2011
|
Letter: 1,
|
|
2198
2012
|
Word: 2,
|
|
2199
2013
|
Line: 4,
|
|
2200
2014
|
Paragraph: 8,
|
|
2201
2015
|
Emoji: 16
|
|
2202
|
-
},
|
|
2016
|
+
}, an = [
|
|
2203
2017
|
{
|
|
2204
|
-
flag:
|
|
2018
|
+
flag: q.Letter,
|
|
2205
2019
|
hints: [
|
|
2206
2020
|
"[data-motion-letter]",
|
|
2207
2021
|
"[data-letter]",
|
|
@@ -2210,7 +2024,7 @@ var J = {
|
|
|
2210
2024
|
]
|
|
2211
2025
|
},
|
|
2212
2026
|
{
|
|
2213
|
-
flag:
|
|
2027
|
+
flag: q.Word,
|
|
2214
2028
|
hints: [
|
|
2215
2029
|
"[data-motion-word]",
|
|
2216
2030
|
"[data-word]",
|
|
@@ -2219,7 +2033,7 @@ var J = {
|
|
|
2219
2033
|
]
|
|
2220
2034
|
},
|
|
2221
2035
|
{
|
|
2222
|
-
flag:
|
|
2036
|
+
flag: q.Line,
|
|
2223
2037
|
hints: [
|
|
2224
2038
|
"[data-motion-line]",
|
|
2225
2039
|
"[data-line]",
|
|
@@ -2228,7 +2042,7 @@ var J = {
|
|
|
2228
2042
|
]
|
|
2229
2043
|
},
|
|
2230
2044
|
{
|
|
2231
|
-
flag:
|
|
2045
|
+
flag: q.Paragraph,
|
|
2232
2046
|
hints: [
|
|
2233
2047
|
"[data-motion-paragraph]",
|
|
2234
2048
|
"[data-paragraph]",
|
|
@@ -2239,7 +2053,7 @@ var J = {
|
|
|
2239
2053
|
]
|
|
2240
2054
|
},
|
|
2241
2055
|
{
|
|
2242
|
-
flag:
|
|
2056
|
+
flag: q.Emoji,
|
|
2243
2057
|
hints: [
|
|
2244
2058
|
":is([data-motion-emoji],[data-emoji],.tw-motion-emoji,.tw-emoji)",
|
|
2245
2059
|
"[data-motion-emoji]",
|
|
@@ -2248,16 +2062,16 @@ var J = {
|
|
|
2248
2062
|
"[data-emoji]"
|
|
2249
2063
|
]
|
|
2250
2064
|
}
|
|
2251
|
-
],
|
|
2252
|
-
function
|
|
2253
|
-
if (!e || e.length >
|
|
2254
|
-
let n =
|
|
2255
|
-
if (i ===
|
|
2065
|
+
], on = q.Letter | q.Word | q.Line | q.Paragraph | q.Emoji, sn = q.Letter | q.Word | q.Line | q.Paragraph, cn = /* @__PURE__ */ new Map(), ln = 16384;
|
|
2066
|
+
function un(e, t) {
|
|
2067
|
+
if (!e || e.length > ln) return e;
|
|
2068
|
+
let n = Rn(t), r = J(n, q.Emoji), i = n & sn;
|
|
2069
|
+
if (i === q.None && !r) return e;
|
|
2256
2070
|
let a = e.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
2257
|
-
if (i ===
|
|
2258
|
-
let o =
|
|
2259
|
-
if (o.length === 0) return r ?
|
|
2260
|
-
let s =
|
|
2071
|
+
if (i === q.None) return In(a);
|
|
2072
|
+
let o = Nn(a);
|
|
2073
|
+
if (o.length === 0) return r ? In(a) : e;
|
|
2074
|
+
let s = Pn(o), c = {
|
|
2261
2075
|
letter: 0,
|
|
2262
2076
|
word: 0,
|
|
2263
2077
|
line: 0,
|
|
@@ -2266,96 +2080,96 @@ function dn(e, t) {
|
|
|
2266
2080
|
emoji: 0
|
|
2267
2081
|
}, l = [];
|
|
2268
2082
|
for (let e of s) {
|
|
2269
|
-
let t =
|
|
2083
|
+
let t = dn(e, n, c);
|
|
2270
2084
|
l.push(...t);
|
|
2271
2085
|
}
|
|
2272
2086
|
return l;
|
|
2273
2087
|
}
|
|
2274
|
-
function
|
|
2088
|
+
function dn(e, t, n) {
|
|
2275
2089
|
let r = [];
|
|
2276
2090
|
for (let i of e) {
|
|
2277
|
-
let e =
|
|
2091
|
+
let e = fn(i, t, n);
|
|
2278
2092
|
r.push(...e);
|
|
2279
2093
|
}
|
|
2280
|
-
if (
|
|
2094
|
+
if (J(t, q.Paragraph)) {
|
|
2281
2095
|
let e = n.paragraph++;
|
|
2282
|
-
return [/* @__PURE__ */ (
|
|
2096
|
+
return [/* @__PURE__ */ F("span", {
|
|
2283
2097
|
"data-motion-paragraph": !0,
|
|
2284
|
-
style:
|
|
2098
|
+
style: Fn(e),
|
|
2285
2099
|
children: r
|
|
2286
2100
|
}, `motion-paragraph-${e}`)];
|
|
2287
2101
|
}
|
|
2288
2102
|
return r;
|
|
2289
2103
|
}
|
|
2290
|
-
function
|
|
2291
|
-
let r =
|
|
2292
|
-
if (
|
|
2104
|
+
function fn(e, t, n) {
|
|
2105
|
+
let r = pn(e.text, t, n), i = [];
|
|
2106
|
+
if (J(t, q.Line)) {
|
|
2293
2107
|
let e = n.line++;
|
|
2294
|
-
i.push(/* @__PURE__ */ (
|
|
2108
|
+
i.push(/* @__PURE__ */ F("span", {
|
|
2295
2109
|
"data-motion-line": !0,
|
|
2296
|
-
style:
|
|
2110
|
+
style: Fn(e),
|
|
2297
2111
|
children: r
|
|
2298
2112
|
}, `motion-line-${e}`));
|
|
2299
2113
|
} else i.push(...r);
|
|
2300
|
-
for (let t = 0; t < e.breaks; t++) i.push(/* @__PURE__ */ (
|
|
2114
|
+
for (let t = 0; t < e.breaks; t++) i.push(/* @__PURE__ */ F("br", {}, `motion-break-${n.br++}`));
|
|
2301
2115
|
return i;
|
|
2302
2116
|
}
|
|
2303
|
-
function
|
|
2117
|
+
function pn(e, t, n) {
|
|
2304
2118
|
if (!e) return [];
|
|
2305
|
-
let r =
|
|
2119
|
+
let r = J(t, q.Word), i = [], a = /(\s+)/g, o = 0, s;
|
|
2306
2120
|
for (; (s = a.exec(e)) !== null;) {
|
|
2307
2121
|
if (s.index > o) {
|
|
2308
2122
|
let a = e.slice(o, s.index);
|
|
2309
|
-
i.push(
|
|
2123
|
+
i.push(mn(a, n, t, r));
|
|
2310
2124
|
}
|
|
2311
2125
|
i.push(s[0]), o = s.index + s[0].length;
|
|
2312
2126
|
}
|
|
2313
2127
|
if (o < e.length) {
|
|
2314
2128
|
let a = e.slice(o);
|
|
2315
|
-
i.push(
|
|
2129
|
+
i.push(mn(a, n, t, r));
|
|
2316
2130
|
}
|
|
2317
2131
|
return i;
|
|
2318
2132
|
}
|
|
2319
|
-
function
|
|
2320
|
-
let i = t.word++, a =
|
|
2321
|
-
return r ? /* @__PURE__ */ (
|
|
2133
|
+
function mn(e, t, n, r) {
|
|
2134
|
+
let i = t.word++, a = gn(e, n, t), o = `motion-word-${i}`, s = hn(i, r);
|
|
2135
|
+
return r ? /* @__PURE__ */ F("span", {
|
|
2322
2136
|
"data-motion-word": !0,
|
|
2323
2137
|
style: s,
|
|
2324
2138
|
children: a
|
|
2325
|
-
}, o) : /* @__PURE__ */ (
|
|
2139
|
+
}, o) : /* @__PURE__ */ F("span", {
|
|
2326
2140
|
style: s,
|
|
2327
2141
|
children: a
|
|
2328
2142
|
}, o);
|
|
2329
2143
|
}
|
|
2330
|
-
function
|
|
2144
|
+
function hn(e, t) {
|
|
2331
2145
|
return t ? {
|
|
2332
|
-
...
|
|
2146
|
+
...Fn(e),
|
|
2333
2147
|
whiteSpace: "nowrap"
|
|
2334
2148
|
} : { whiteSpace: "nowrap" };
|
|
2335
2149
|
}
|
|
2336
|
-
function
|
|
2150
|
+
function gn(e, t, n) {
|
|
2337
2151
|
if (!e) return [];
|
|
2338
|
-
let r =
|
|
2152
|
+
let r = J(t, q.Letter), i = J(t, q.Emoji);
|
|
2339
2153
|
if (!r) {
|
|
2340
2154
|
if (!i) return [e];
|
|
2341
|
-
let t =
|
|
2155
|
+
let t = _n(e);
|
|
2342
2156
|
if (t.length === 0) return [e];
|
|
2343
|
-
let { nodes: r } =
|
|
2157
|
+
let { nodes: r } = Ln(t, n);
|
|
2344
2158
|
return r;
|
|
2345
2159
|
}
|
|
2346
|
-
let a = [], o =
|
|
2160
|
+
let a = [], o = _n(e);
|
|
2347
2161
|
for (let e of o) {
|
|
2348
|
-
let t = n.letter++, r = `motion-letter-${t}`, o =
|
|
2162
|
+
let t = n.letter++, r = `motion-letter-${t}`, o = Fn(t);
|
|
2349
2163
|
if (e === "\n") {
|
|
2350
|
-
a.push(/* @__PURE__ */ (
|
|
2164
|
+
a.push(/* @__PURE__ */ F("span", {
|
|
2351
2165
|
"data-motion-letter": !0,
|
|
2352
2166
|
style: o,
|
|
2353
|
-
children: /* @__PURE__ */ (
|
|
2167
|
+
children: /* @__PURE__ */ F("br", {})
|
|
2354
2168
|
}, r));
|
|
2355
2169
|
continue;
|
|
2356
2170
|
}
|
|
2357
|
-
let s = i &&
|
|
2358
|
-
a.push(/* @__PURE__ */ (
|
|
2171
|
+
let s = i && An(e) ? { "data-motion-emoji": !0 } : void 0, c = e === " " ? "\xA0" : e;
|
|
2172
|
+
a.push(/* @__PURE__ */ F("span", {
|
|
2359
2173
|
"data-motion-letter": !0,
|
|
2360
2174
|
style: o,
|
|
2361
2175
|
...s,
|
|
@@ -2364,46 +2178,46 @@ function _n(e, t, n) {
|
|
|
2364
2178
|
}
|
|
2365
2179
|
return a;
|
|
2366
2180
|
}
|
|
2367
|
-
function
|
|
2181
|
+
function _n(e) {
|
|
2368
2182
|
if (!e) return [];
|
|
2369
|
-
let t =
|
|
2370
|
-
return t ? Array.from(t.segment(e), (e) => e.segment) :
|
|
2183
|
+
let t = yn();
|
|
2184
|
+
return t ? Array.from(t.segment(e), (e) => e.segment) : bn(e);
|
|
2371
2185
|
}
|
|
2372
|
-
var
|
|
2373
|
-
function
|
|
2374
|
-
return
|
|
2186
|
+
var vn;
|
|
2187
|
+
function yn() {
|
|
2188
|
+
return vn === void 0 && (vn = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null), vn;
|
|
2375
2189
|
}
|
|
2376
|
-
function
|
|
2190
|
+
function bn(e) {
|
|
2377
2191
|
let t = [], n = Array.from(e), r = "";
|
|
2378
2192
|
for (let e = 0; e < n.length; e++) {
|
|
2379
2193
|
let i = n[e], a = n[e + 1];
|
|
2380
|
-
r += i, !(a &&
|
|
2194
|
+
r += i, !(a && xn(i, a)) && (t.push(r), r = "");
|
|
2381
2195
|
}
|
|
2382
2196
|
return r && t.push(r), t;
|
|
2383
2197
|
}
|
|
2384
|
-
function
|
|
2385
|
-
return t ? !!(
|
|
2198
|
+
function xn(e, t) {
|
|
2199
|
+
return t ? !!(Sn(e) || Sn(t) || Dn(t) || Cn(t) || wn(t) || Tn(e) && Tn(t)) : !1;
|
|
2386
2200
|
}
|
|
2387
|
-
function
|
|
2201
|
+
function Sn(e) {
|
|
2388
2202
|
return e.codePointAt(0) === 8205;
|
|
2389
2203
|
}
|
|
2390
|
-
function
|
|
2204
|
+
function Cn(e) {
|
|
2391
2205
|
let t = e.codePointAt(0);
|
|
2392
2206
|
return t === void 0 ? !1 : t >= 65024 && t <= 65039 || t >= 917760 && t <= 917999;
|
|
2393
2207
|
}
|
|
2394
|
-
function
|
|
2208
|
+
function wn(e) {
|
|
2395
2209
|
let t = e.codePointAt(0);
|
|
2396
2210
|
return t !== void 0 && t >= 127995 && t <= 127999;
|
|
2397
2211
|
}
|
|
2398
|
-
function
|
|
2212
|
+
function Tn(e) {
|
|
2399
2213
|
let t = e.codePointAt(0);
|
|
2400
2214
|
return t !== void 0 && t >= 127462 && t <= 127487;
|
|
2401
2215
|
}
|
|
2402
|
-
var
|
|
2403
|
-
function
|
|
2404
|
-
return e ? (
|
|
2216
|
+
var En;
|
|
2217
|
+
function Dn(e) {
|
|
2218
|
+
return e ? (En ||= On(), En(e)) : !1;
|
|
2405
2219
|
}
|
|
2406
|
-
function
|
|
2220
|
+
function On() {
|
|
2407
2221
|
try {
|
|
2408
2222
|
let e = /\p{Mark}/u;
|
|
2409
2223
|
return (t) => e.test(t);
|
|
@@ -2414,19 +2228,19 @@ function kn() {
|
|
|
2414
2228
|
};
|
|
2415
2229
|
}
|
|
2416
2230
|
}
|
|
2417
|
-
var
|
|
2418
|
-
function
|
|
2419
|
-
return e ? (
|
|
2231
|
+
var kn;
|
|
2232
|
+
function An(e) {
|
|
2233
|
+
return e ? (kn ||= jn(), kn(e)) : !1;
|
|
2420
2234
|
}
|
|
2421
|
-
function
|
|
2235
|
+
function jn() {
|
|
2422
2236
|
try {
|
|
2423
2237
|
let e = /\p{Extended_Pictographic}/u;
|
|
2424
2238
|
return (t) => e.test(t);
|
|
2425
2239
|
} catch {
|
|
2426
|
-
return
|
|
2240
|
+
return Mn;
|
|
2427
2241
|
}
|
|
2428
2242
|
}
|
|
2429
|
-
function
|
|
2243
|
+
function Mn(e) {
|
|
2430
2244
|
if (!e) return !1;
|
|
2431
2245
|
for (let t of Array.from(e)) {
|
|
2432
2246
|
let e = t.codePointAt(0);
|
|
@@ -2434,7 +2248,7 @@ function Nn(e) {
|
|
|
2434
2248
|
}
|
|
2435
2249
|
return !1;
|
|
2436
2250
|
}
|
|
2437
|
-
function
|
|
2251
|
+
function Nn(e) {
|
|
2438
2252
|
let t = [], n = "", r = 0;
|
|
2439
2253
|
for (let i = 0; i < e.length; i++) {
|
|
2440
2254
|
let a = e[i];
|
|
@@ -2452,16 +2266,16 @@ function Pn(e) {
|
|
|
2452
2266
|
breaks: r
|
|
2453
2267
|
}), t;
|
|
2454
2268
|
}
|
|
2455
|
-
function
|
|
2269
|
+
function Pn(e) {
|
|
2456
2270
|
if (e.length === 0) return [];
|
|
2457
2271
|
let t = [], n = [];
|
|
2458
2272
|
for (let r of e) n.push(r), r.breaks >= 2 && (t.push(n), n = []);
|
|
2459
2273
|
return n.length > 0 && t.push(n), t;
|
|
2460
2274
|
}
|
|
2461
|
-
function
|
|
2275
|
+
function J(e, t) {
|
|
2462
2276
|
return (e & t) === t;
|
|
2463
2277
|
}
|
|
2464
|
-
function
|
|
2278
|
+
function Fn(e) {
|
|
2465
2279
|
return {
|
|
2466
2280
|
"--tw-motion-seq-index": e.toString(),
|
|
2467
2281
|
backgroundColor: "inherit",
|
|
@@ -2478,22 +2292,22 @@ function Ln(e) {
|
|
|
2478
2292
|
WebkitTextFillColor: "inherit"
|
|
2479
2293
|
};
|
|
2480
2294
|
}
|
|
2481
|
-
function
|
|
2295
|
+
function In(e) {
|
|
2482
2296
|
if (!e) return e;
|
|
2483
|
-
let t =
|
|
2297
|
+
let t = _n(e);
|
|
2484
2298
|
if (t.length === 0) return e;
|
|
2485
|
-
let { nodes: n, sawEmoji: r } =
|
|
2299
|
+
let { nodes: n, sawEmoji: r } = Ln(t);
|
|
2486
2300
|
return r ? n.length === 1 ? n[0] ?? e : n : e;
|
|
2487
2301
|
}
|
|
2488
|
-
function
|
|
2302
|
+
function Ln(e, t) {
|
|
2489
2303
|
let n = [], r = "", i = !1, a = t?.emoji ?? 0, o = () => {
|
|
2490
2304
|
r &&= (n.push(r), "");
|
|
2491
2305
|
};
|
|
2492
2306
|
for (let s of e) {
|
|
2493
|
-
if (
|
|
2307
|
+
if (An(s)) {
|
|
2494
2308
|
i = !0, o();
|
|
2495
2309
|
let e = `motion-emoji-${t ? t.emoji++ : a++}`;
|
|
2496
|
-
n.push(/* @__PURE__ */ (
|
|
2310
|
+
n.push(/* @__PURE__ */ F("span", {
|
|
2497
2311
|
"data-motion-emoji": !0,
|
|
2498
2312
|
children: s
|
|
2499
2313
|
}, e));
|
|
@@ -2509,16 +2323,16 @@ function zn(e, t) {
|
|
|
2509
2323
|
sawEmoji: !1
|
|
2510
2324
|
};
|
|
2511
2325
|
}
|
|
2512
|
-
function
|
|
2513
|
-
if (!e) return
|
|
2326
|
+
function Rn(e) {
|
|
2327
|
+
if (!e) return q.None;
|
|
2514
2328
|
let t = e.trim();
|
|
2515
|
-
if (!t) return
|
|
2516
|
-
let n =
|
|
2329
|
+
if (!t) return q.None;
|
|
2330
|
+
let n = cn.get(t);
|
|
2517
2331
|
if (typeof n == "number") return n;
|
|
2518
|
-
if (typeof document > "u") return
|
|
2332
|
+
if (typeof document > "u") return q.None;
|
|
2519
2333
|
let r = t.split(/\s+/).filter(Boolean);
|
|
2520
|
-
if (r.length === 0) return
|
|
2521
|
-
let i = r.map((e) => `.${
|
|
2334
|
+
if (r.length === 0) return q.None;
|
|
2335
|
+
let i = r.map((e) => `.${Bn(e)}`).map((e) => RegExp(`(^|[^a-zA-Z0-9_-])${Vn(e)}(?![a-zA-Z0-9_-])`)), a = q.None, o = !1;
|
|
2522
2336
|
for (let e of Array.from(document.styleSheets)) {
|
|
2523
2337
|
let t;
|
|
2524
2338
|
try {
|
|
@@ -2526,18 +2340,18 @@ function Bn(e) {
|
|
|
2526
2340
|
} catch {
|
|
2527
2341
|
continue;
|
|
2528
2342
|
}
|
|
2529
|
-
let n =
|
|
2530
|
-
if (n.mask && (a |= n.mask, a ===
|
|
2343
|
+
let n = zn(t, i);
|
|
2344
|
+
if (n.mask && (a |= n.mask, a === on)) break;
|
|
2531
2345
|
o ||= n.sawStyleRule;
|
|
2532
2346
|
}
|
|
2533
|
-
return (a !==
|
|
2347
|
+
return (a !== q.None || o) && cn.set(t, a), a;
|
|
2534
2348
|
}
|
|
2535
|
-
function
|
|
2349
|
+
function zn(e, t) {
|
|
2536
2350
|
if (!e) return {
|
|
2537
|
-
mask:
|
|
2351
|
+
mask: q.None,
|
|
2538
2352
|
sawStyleRule: !1
|
|
2539
2353
|
};
|
|
2540
|
-
let n =
|
|
2354
|
+
let n = q.None, r = !1;
|
|
2541
2355
|
for (let i = 0; i < e.length; i++) {
|
|
2542
2356
|
let a = e[i];
|
|
2543
2357
|
if (a) {
|
|
@@ -2545,14 +2359,14 @@ function Vn(e, t) {
|
|
|
2545
2359
|
let e = a.selectorText ?? "";
|
|
2546
2360
|
if (!e || !t.some((t) => t.test(e))) continue;
|
|
2547
2361
|
r = !0;
|
|
2548
|
-
for (let t of
|
|
2549
|
-
if (n ===
|
|
2362
|
+
for (let t of an) t.hints.some((t) => e.includes(t)) && (n |= t.flag);
|
|
2363
|
+
if (n === on) return {
|
|
2550
2364
|
mask: n,
|
|
2551
2365
|
sawStyleRule: !0
|
|
2552
2366
|
};
|
|
2553
2367
|
} else if ("cssRules" in a) {
|
|
2554
|
-
let e =
|
|
2555
|
-
if (e.mask && (n |= e.mask, n ===
|
|
2368
|
+
let e = zn(a.cssRules, t);
|
|
2369
|
+
if (e.mask && (n |= e.mask, n === on)) return {
|
|
2556
2370
|
mask: n,
|
|
2557
2371
|
sawStyleRule: !0
|
|
2558
2372
|
};
|
|
@@ -2565,66 +2379,66 @@ function Vn(e, t) {
|
|
|
2565
2379
|
sawStyleRule: r
|
|
2566
2380
|
};
|
|
2567
2381
|
}
|
|
2568
|
-
function
|
|
2382
|
+
function Bn(e) {
|
|
2569
2383
|
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
2570
2384
|
}
|
|
2571
|
-
function
|
|
2385
|
+
function Vn(e) {
|
|
2572
2386
|
return e.replace(/[.*+?^${}()|[\]\\]/g, (e) => `\\${e}`);
|
|
2573
2387
|
}
|
|
2574
2388
|
//#endregion
|
|
2575
2389
|
//#region src/auth/storage.ts
|
|
2576
|
-
var
|
|
2577
|
-
function
|
|
2390
|
+
var Hn = "ikon-auth-session", Un = "ikon-auth-auto-login-attempted-run", Wn = 6048e5, Gn = 6e4;
|
|
2391
|
+
function Kn(e) {
|
|
2578
2392
|
try {
|
|
2579
2393
|
let t = e.split(".");
|
|
2580
2394
|
if (t.length !== 3) return !0;
|
|
2581
2395
|
let n = t[1].replace(/-/g, "+").replace(/_/g, "/"), r = n + "=".repeat((4 - n.length % 4) % 4), i = JSON.parse(atob(r));
|
|
2582
|
-
return typeof i.exp == "number" && Date.now() >= i.exp * 1e3 -
|
|
2396
|
+
return typeof i.exp == "number" && Date.now() >= i.exp * 1e3 - Gn;
|
|
2583
2397
|
} catch {
|
|
2584
2398
|
return !0;
|
|
2585
2399
|
}
|
|
2586
2400
|
}
|
|
2587
2401
|
function Y(e) {
|
|
2588
2402
|
try {
|
|
2589
|
-
localStorage.setItem(
|
|
2403
|
+
localStorage.setItem(Hn, JSON.stringify(e));
|
|
2590
2404
|
} catch {
|
|
2591
2405
|
console.warn("Failed to save auth session to localStorage");
|
|
2592
2406
|
}
|
|
2593
2407
|
}
|
|
2594
|
-
function
|
|
2408
|
+
function qn() {
|
|
2595
2409
|
try {
|
|
2596
|
-
let e = localStorage.getItem(
|
|
2410
|
+
let e = localStorage.getItem(Hn);
|
|
2597
2411
|
if (!e) return null;
|
|
2598
2412
|
let t = JSON.parse(e);
|
|
2599
|
-
return Date.now() - t.authenticatedAt >
|
|
2413
|
+
return Date.now() - t.authenticatedAt > Wn || Kn(t.token) ? (Yn(), null) : t;
|
|
2600
2414
|
} catch {
|
|
2601
2415
|
return console.warn("Failed to load auth session from localStorage"), null;
|
|
2602
2416
|
}
|
|
2603
2417
|
}
|
|
2604
|
-
function
|
|
2418
|
+
function Jn() {
|
|
2605
2419
|
try {
|
|
2606
2420
|
if (typeof window < "u" && new URLSearchParams(window.location.search).get("ikon_token")) return !0;
|
|
2607
2421
|
} catch {}
|
|
2608
|
-
let e =
|
|
2422
|
+
let e = qn()?.provider;
|
|
2609
2423
|
return e !== void 0 && e !== "anonymous";
|
|
2610
2424
|
}
|
|
2611
|
-
function
|
|
2425
|
+
function Yn() {
|
|
2612
2426
|
try {
|
|
2613
|
-
localStorage.removeItem(
|
|
2427
|
+
localStorage.removeItem(Hn);
|
|
2614
2428
|
} catch {
|
|
2615
2429
|
console.warn("Failed to clear auth session from localStorage");
|
|
2616
2430
|
}
|
|
2617
2431
|
}
|
|
2618
|
-
function
|
|
2432
|
+
function Xn(e) {
|
|
2619
2433
|
if (e) try {
|
|
2620
|
-
sessionStorage.setItem(
|
|
2434
|
+
sessionStorage.setItem(Un, e);
|
|
2621
2435
|
} catch {
|
|
2622
2436
|
console.warn("Failed to record auto-login attempt in sessionStorage");
|
|
2623
2437
|
}
|
|
2624
2438
|
}
|
|
2625
|
-
function
|
|
2439
|
+
function Zn() {
|
|
2626
2440
|
try {
|
|
2627
|
-
return sessionStorage.getItem(
|
|
2441
|
+
return sessionStorage.getItem(Un);
|
|
2628
2442
|
} catch {
|
|
2629
2443
|
return null;
|
|
2630
2444
|
}
|
|
@@ -2639,8 +2453,8 @@ function X(e) {
|
|
|
2639
2453
|
}
|
|
2640
2454
|
//#endregion
|
|
2641
2455
|
//#region src/auth/auth-service.ts
|
|
2642
|
-
var
|
|
2643
|
-
async function
|
|
2456
|
+
var Qn = 15e3, $n = _("AuthService");
|
|
2457
|
+
async function er(e) {
|
|
2644
2458
|
try {
|
|
2645
2459
|
return await fetch(e, {
|
|
2646
2460
|
method: "GET",
|
|
@@ -2650,8 +2464,8 @@ async function nr(e) {
|
|
|
2650
2464
|
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)`;
|
|
2651
2465
|
}
|
|
2652
2466
|
}
|
|
2653
|
-
async function
|
|
2654
|
-
let r =
|
|
2467
|
+
async function tr(e, t, n) {
|
|
2468
|
+
let r = te(), i = n === "guest" ? "anonymous" : n, a = {
|
|
2655
2469
|
method: "POST",
|
|
2656
2470
|
headers: { "Content-Type": "application/json" },
|
|
2657
2471
|
body: JSON.stringify({
|
|
@@ -2660,28 +2474,28 @@ async function rr(e, t, n) {
|
|
|
2660
2474
|
...i ? { method: i } : {}
|
|
2661
2475
|
})
|
|
2662
2476
|
}, o = typeof window < "u" ? window.location.origin : "?", s = `${t}/anonymous`;
|
|
2663
|
-
|
|
2477
|
+
$n.debug(`Anonymous auth: POST ${s} (space=${e}, origin=${o})`);
|
|
2664
2478
|
let c;
|
|
2665
2479
|
try {
|
|
2666
2480
|
c = await fetch(s, a);
|
|
2667
2481
|
} catch (e) {
|
|
2668
|
-
let n = e instanceof Error ? `${e.name}: ${e.message}` : String(e), r =
|
|
2482
|
+
let n = e instanceof Error ? `${e.name}: ${e.message}` : String(e), r = ne(), i = r ? `${r}/anonymous` : null;
|
|
2669
2483
|
if (i && i !== s) {
|
|
2670
|
-
|
|
2484
|
+
$n.warn(`Anonymous auth could not reach ${s} (${n}); falling back to same-origin ${i}`);
|
|
2671
2485
|
try {
|
|
2672
2486
|
c = await fetch(i, a);
|
|
2673
2487
|
} catch (e) {
|
|
2674
|
-
let r = e instanceof Error ? `${e.name}: ${e.message}` : String(e), a = await
|
|
2675
|
-
throw
|
|
2488
|
+
let r = e instanceof Error ? `${e.name}: ${e.message}` : String(e), a = await er(t);
|
|
2489
|
+
throw $n.error(`Anonymous auth failed on both direct (${s}: ${n}) and same-origin (${i}: ${r}). ${a}`), Error(`Anonymous auth unreachable: direct ${s} (${n}) and same-origin ${i} (${r})`, { cause: e });
|
|
2676
2490
|
}
|
|
2677
2491
|
} else {
|
|
2678
|
-
let r = await
|
|
2679
|
-
throw
|
|
2492
|
+
let r = await er(t);
|
|
2493
|
+
throw $n.error(`Anonymous auth fetch threw for ${s} — ${n}. ${r}`), Error(`Anonymous auth could not reach ${s} (${n}). ${r}`, { cause: e });
|
|
2680
2494
|
}
|
|
2681
2495
|
}
|
|
2682
2496
|
if (!c.ok) {
|
|
2683
2497
|
let e = await c.text().catch(() => "Unknown error");
|
|
2684
|
-
throw
|
|
2498
|
+
throw $n.error(`Anonymous auth HTTP ${c.status} from ${c.url}: ${e}`), Error(`Anonymous auth failed: ${c.status} ${e}`);
|
|
2685
2499
|
}
|
|
2686
2500
|
let { token: l } = await c.json(), u = {
|
|
2687
2501
|
token: l,
|
|
@@ -2690,7 +2504,7 @@ async function rr(e, t, n) {
|
|
|
2690
2504
|
};
|
|
2691
2505
|
return Y(u), u;
|
|
2692
2506
|
}
|
|
2693
|
-
async function
|
|
2507
|
+
async function nr({ email: e, spaceId: t, authUrl: n }) {
|
|
2694
2508
|
let r = await fetch(`${n}/email/send`, {
|
|
2695
2509
|
method: "POST",
|
|
2696
2510
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2698,14 +2512,14 @@ async function ir({ email: e, spaceId: t, authUrl: n }) {
|
|
|
2698
2512
|
email: e.trim(),
|
|
2699
2513
|
space: t
|
|
2700
2514
|
}),
|
|
2701
|
-
signal: h(
|
|
2515
|
+
signal: h(Qn)
|
|
2702
2516
|
});
|
|
2703
2517
|
if (!r.ok) {
|
|
2704
2518
|
let e = await r.text().catch(() => "Failed to send login code");
|
|
2705
2519
|
throw Error(e);
|
|
2706
2520
|
}
|
|
2707
2521
|
}
|
|
2708
|
-
async function
|
|
2522
|
+
async function rr({ email: e, code: t, authUrl: n }) {
|
|
2709
2523
|
let r = await fetch(`${n}/email/code`, {
|
|
2710
2524
|
method: "POST",
|
|
2711
2525
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2713,7 +2527,7 @@ async function ar({ email: e, code: t, authUrl: n }) {
|
|
|
2713
2527
|
email: e.trim(),
|
|
2714
2528
|
code: t.trim()
|
|
2715
2529
|
}),
|
|
2716
|
-
signal: h(
|
|
2530
|
+
signal: h(Qn)
|
|
2717
2531
|
});
|
|
2718
2532
|
if (!r.ok) {
|
|
2719
2533
|
let e = await r.text().catch(() => "Invalid code");
|
|
@@ -2726,24 +2540,24 @@ async function ar({ email: e, code: t, authUrl: n }) {
|
|
|
2726
2540
|
};
|
|
2727
2541
|
return Y(a), a;
|
|
2728
2542
|
}
|
|
2729
|
-
function
|
|
2543
|
+
function ir() {
|
|
2730
2544
|
let e = new URLSearchParams(window.location.search), t = e.get("ikon_token"), n = e.get("ikon_provider");
|
|
2731
2545
|
return t && n ? {
|
|
2732
2546
|
token: t,
|
|
2733
2547
|
provider: n
|
|
2734
2548
|
} : null;
|
|
2735
2549
|
}
|
|
2736
|
-
function
|
|
2550
|
+
function ar() {
|
|
2737
2551
|
return new URLSearchParams(window.location.search).get("error");
|
|
2738
2552
|
}
|
|
2739
|
-
function
|
|
2553
|
+
function or() {
|
|
2740
2554
|
window.history.replaceState({}, "", window.location.pathname);
|
|
2741
2555
|
}
|
|
2742
|
-
function
|
|
2556
|
+
function sr(e, t, n, r) {
|
|
2743
2557
|
let i = r ?? window.location.origin + window.location.pathname + window.location.search;
|
|
2744
2558
|
return `${n}/oauth/${e}?space=${encodeURIComponent(t)}&return=${encodeURIComponent(i)}`;
|
|
2745
2559
|
}
|
|
2746
|
-
async function
|
|
2560
|
+
async function cr(e) {
|
|
2747
2561
|
let t = await fetch(`${e}/passkey/registration/options`, {
|
|
2748
2562
|
method: "POST",
|
|
2749
2563
|
headers: { "Content-Type": "application/json" }
|
|
@@ -2754,7 +2568,7 @@ async function ur(e) {
|
|
|
2754
2568
|
}
|
|
2755
2569
|
return t.json();
|
|
2756
2570
|
}
|
|
2757
|
-
async function
|
|
2571
|
+
async function lr(e, t, n) {
|
|
2758
2572
|
let r = await fetch(`${e}/passkey/registration/verify`, {
|
|
2759
2573
|
method: "POST",
|
|
2760
2574
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2774,7 +2588,7 @@ async function dr(e, t, n) {
|
|
|
2774
2588
|
};
|
|
2775
2589
|
return Y(a), a;
|
|
2776
2590
|
}
|
|
2777
|
-
async function
|
|
2591
|
+
async function ur(e, t) {
|
|
2778
2592
|
let n = await fetch(`${e}/passkey/authentication/options`, {
|
|
2779
2593
|
method: "POST",
|
|
2780
2594
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2786,7 +2600,7 @@ async function fr(e, t) {
|
|
|
2786
2600
|
}
|
|
2787
2601
|
return n.json();
|
|
2788
2602
|
}
|
|
2789
|
-
async function
|
|
2603
|
+
async function dr(e, t) {
|
|
2790
2604
|
let n = await fetch(`${e}/passkey/authentication/verify`, {
|
|
2791
2605
|
method: "POST",
|
|
2792
2606
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2812,30 +2626,30 @@ function Z(e) {
|
|
|
2812
2626
|
}
|
|
2813
2627
|
//#endregion
|
|
2814
2628
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js
|
|
2815
|
-
function
|
|
2629
|
+
function fr(e) {
|
|
2816
2630
|
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);
|
|
2817
2631
|
for (let e = 0; e < i.length; e++) o[e] = i.charCodeAt(e);
|
|
2818
2632
|
return a;
|
|
2819
2633
|
}
|
|
2820
2634
|
//#endregion
|
|
2821
2635
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js
|
|
2822
|
-
function
|
|
2823
|
-
return
|
|
2636
|
+
function pr() {
|
|
2637
|
+
return mr.stubThis(globalThis?.PublicKeyCredential !== void 0 && typeof globalThis.PublicKeyCredential == "function");
|
|
2824
2638
|
}
|
|
2825
|
-
var
|
|
2639
|
+
var mr = { stubThis: (e) => e };
|
|
2826
2640
|
//#endregion
|
|
2827
2641
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js
|
|
2828
|
-
function
|
|
2642
|
+
function hr(e) {
|
|
2829
2643
|
let { id: t } = e;
|
|
2830
2644
|
return {
|
|
2831
2645
|
...e,
|
|
2832
|
-
id:
|
|
2646
|
+
id: fr(t),
|
|
2833
2647
|
transports: e.transports
|
|
2834
2648
|
};
|
|
2835
2649
|
}
|
|
2836
2650
|
//#endregion
|
|
2837
2651
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js
|
|
2838
|
-
function
|
|
2652
|
+
function gr(e) {
|
|
2839
2653
|
return e === "localhost" || /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e);
|
|
2840
2654
|
}
|
|
2841
2655
|
//#endregion
|
|
@@ -2852,7 +2666,7 @@ var Q = class extends Error {
|
|
|
2852
2666
|
};
|
|
2853
2667
|
//#endregion
|
|
2854
2668
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js
|
|
2855
|
-
function
|
|
2669
|
+
function _r({ error: e, options: t }) {
|
|
2856
2670
|
let { publicKey: n } = t;
|
|
2857
2671
|
if (!n) throw Error("options was missing required publicKey property");
|
|
2858
2672
|
if (e.name === "AbortError") {
|
|
@@ -2898,7 +2712,7 @@ function yr({ error: e, options: t }) {
|
|
|
2898
2712
|
});
|
|
2899
2713
|
else if (e.name === "SecurityError") {
|
|
2900
2714
|
let t = globalThis.location.hostname;
|
|
2901
|
-
if (!
|
|
2715
|
+
if (!gr(t)) return new Q({
|
|
2902
2716
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
2903
2717
|
code: "ERROR_INVALID_DOMAIN",
|
|
2904
2718
|
cause: e
|
|
@@ -2921,7 +2735,7 @@ function yr({ error: e, options: t }) {
|
|
|
2921
2735
|
});
|
|
2922
2736
|
return e;
|
|
2923
2737
|
}
|
|
2924
|
-
var
|
|
2738
|
+
var vr = new class {
|
|
2925
2739
|
constructor() {
|
|
2926
2740
|
Object.defineProperty(this, "controller", {
|
|
2927
2741
|
enumerable: !0,
|
|
@@ -2944,31 +2758,31 @@ var br = new class {
|
|
|
2944
2758
|
e.name = "AbortError", this.controller.abort(e), this.controller = void 0;
|
|
2945
2759
|
}
|
|
2946
2760
|
}
|
|
2947
|
-
}(),
|
|
2948
|
-
function
|
|
2949
|
-
if (e && !(
|
|
2761
|
+
}(), yr = ["cross-platform", "platform"];
|
|
2762
|
+
function br(e) {
|
|
2763
|
+
if (e && !(yr.indexOf(e) < 0)) return e;
|
|
2950
2764
|
}
|
|
2951
2765
|
//#endregion
|
|
2952
2766
|
//#region ../../node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js
|
|
2953
|
-
async function
|
|
2767
|
+
async function xr(e) {
|
|
2954
2768
|
!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 });
|
|
2955
2769
|
let { optionsJSON: t, useAutoRegister: n = !1 } = e;
|
|
2956
|
-
if (!
|
|
2770
|
+
if (!pr()) throw Error("WebAuthn is not supported in this browser");
|
|
2957
2771
|
let r = {
|
|
2958
2772
|
...t,
|
|
2959
|
-
challenge:
|
|
2773
|
+
challenge: fr(t.challenge),
|
|
2960
2774
|
user: {
|
|
2961
2775
|
...t.user,
|
|
2962
|
-
id:
|
|
2776
|
+
id: fr(t.user.id)
|
|
2963
2777
|
},
|
|
2964
|
-
excludeCredentials: t.excludeCredentials?.map(
|
|
2778
|
+
excludeCredentials: t.excludeCredentials?.map(hr)
|
|
2965
2779
|
}, i = {};
|
|
2966
|
-
n && (i.mediation = "conditional"), i.publicKey = r, i.signal =
|
|
2780
|
+
n && (i.mediation = "conditional"), i.publicKey = r, i.signal = vr.createNewAbortSignal();
|
|
2967
2781
|
let a;
|
|
2968
2782
|
try {
|
|
2969
2783
|
a = await navigator.credentials.create(i);
|
|
2970
2784
|
} catch (e) {
|
|
2971
|
-
throw
|
|
2785
|
+
throw _r({
|
|
2972
2786
|
error: e,
|
|
2973
2787
|
options: i
|
|
2974
2788
|
});
|
|
@@ -2980,20 +2794,20 @@ async function Cr(e) {
|
|
|
2980
2794
|
if (typeof c.getPublicKeyAlgorithm == "function") try {
|
|
2981
2795
|
d = c.getPublicKeyAlgorithm();
|
|
2982
2796
|
} catch (e) {
|
|
2983
|
-
|
|
2797
|
+
Sr("getPublicKeyAlgorithm()", e);
|
|
2984
2798
|
}
|
|
2985
2799
|
let f;
|
|
2986
2800
|
if (typeof c.getPublicKey == "function") try {
|
|
2987
2801
|
let e = c.getPublicKey();
|
|
2988
2802
|
e !== null && (f = Z(e));
|
|
2989
2803
|
} catch (e) {
|
|
2990
|
-
|
|
2804
|
+
Sr("getPublicKey()", e);
|
|
2991
2805
|
}
|
|
2992
2806
|
let p;
|
|
2993
2807
|
if (typeof c.getAuthenticatorData == "function") try {
|
|
2994
2808
|
p = Z(c.getAuthenticatorData());
|
|
2995
2809
|
} catch (e) {
|
|
2996
|
-
|
|
2810
|
+
Sr("getAuthenticatorData()", e);
|
|
2997
2811
|
}
|
|
2998
2812
|
return {
|
|
2999
2813
|
id: o,
|
|
@@ -3008,23 +2822,23 @@ async function Cr(e) {
|
|
|
3008
2822
|
},
|
|
3009
2823
|
type: l,
|
|
3010
2824
|
clientExtensionResults: a.getClientExtensionResults(),
|
|
3011
|
-
authenticatorAttachment:
|
|
2825
|
+
authenticatorAttachment: br(a.authenticatorAttachment)
|
|
3012
2826
|
};
|
|
3013
2827
|
}
|
|
3014
|
-
function
|
|
2828
|
+
function Sr(e, t) {
|
|
3015
2829
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`, t);
|
|
3016
2830
|
}
|
|
3017
2831
|
//#endregion
|
|
3018
2832
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js
|
|
3019
|
-
function
|
|
3020
|
-
if (!
|
|
2833
|
+
function Cr() {
|
|
2834
|
+
if (!pr()) return wr.stubThis(new Promise((e) => e(!1)));
|
|
3021
2835
|
let e = globalThis.PublicKeyCredential;
|
|
3022
|
-
return e?.isConditionalMediationAvailable === void 0 ?
|
|
2836
|
+
return e?.isConditionalMediationAvailable === void 0 ? wr.stubThis(new Promise((e) => e(!1))) : wr.stubThis(e.isConditionalMediationAvailable());
|
|
3023
2837
|
}
|
|
3024
|
-
var
|
|
2838
|
+
var wr = { stubThis: (e) => e };
|
|
3025
2839
|
//#endregion
|
|
3026
2840
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js
|
|
3027
|
-
function
|
|
2841
|
+
function Tr({ error: e, options: t }) {
|
|
3028
2842
|
let { publicKey: n } = t;
|
|
3029
2843
|
if (!n) throw Error("options was missing required publicKey property");
|
|
3030
2844
|
if (e.name === "AbortError") {
|
|
@@ -3040,7 +2854,7 @@ function Dr({ error: e, options: t }) {
|
|
|
3040
2854
|
});
|
|
3041
2855
|
else if (e.name === "SecurityError") {
|
|
3042
2856
|
let t = globalThis.location.hostname;
|
|
3043
|
-
if (!
|
|
2857
|
+
if (!gr(t)) return new Q({
|
|
3044
2858
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
3045
2859
|
code: "ERROR_INVALID_DOMAIN",
|
|
3046
2860
|
cause: e
|
|
@@ -3059,28 +2873,28 @@ function Dr({ error: e, options: t }) {
|
|
|
3059
2873
|
}
|
|
3060
2874
|
//#endregion
|
|
3061
2875
|
//#region ../../node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js
|
|
3062
|
-
async function
|
|
2876
|
+
async function Er(e) {
|
|
3063
2877
|
!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 });
|
|
3064
2878
|
let { optionsJSON: t, useBrowserAutofill: n = !1, verifyBrowserAutofillInput: r = !0 } = e;
|
|
3065
|
-
if (!
|
|
2879
|
+
if (!pr()) throw Error("WebAuthn is not supported in this browser");
|
|
3066
2880
|
let i;
|
|
3067
|
-
t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(
|
|
2881
|
+
t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(hr));
|
|
3068
2882
|
let a = {
|
|
3069
2883
|
...t,
|
|
3070
|
-
challenge:
|
|
2884
|
+
challenge: fr(t.challenge),
|
|
3071
2885
|
allowCredentials: i
|
|
3072
2886
|
}, o = {};
|
|
3073
2887
|
if (n) {
|
|
3074
|
-
if (!await
|
|
2888
|
+
if (!await Cr()) throw Error("Browser does not support WebAuthn autofill");
|
|
3075
2889
|
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");
|
|
3076
2890
|
o.mediation = "conditional", a.allowCredentials = [];
|
|
3077
2891
|
}
|
|
3078
|
-
o.publicKey = a, o.signal =
|
|
2892
|
+
o.publicKey = a, o.signal = vr.createNewAbortSignal();
|
|
3079
2893
|
let s;
|
|
3080
2894
|
try {
|
|
3081
2895
|
s = await navigator.credentials.get(o);
|
|
3082
2896
|
} catch (e) {
|
|
3083
|
-
throw
|
|
2897
|
+
throw Tr({
|
|
3084
2898
|
error: e,
|
|
3085
2899
|
options: o
|
|
3086
2900
|
});
|
|
@@ -3098,26 +2912,26 @@ async function Or(e) {
|
|
|
3098
2912
|
},
|
|
3099
2913
|
type: d,
|
|
3100
2914
|
clientExtensionResults: s.getClientExtensionResults(),
|
|
3101
|
-
authenticatorAttachment:
|
|
2915
|
+
authenticatorAttachment: br(s.authenticatorAttachment)
|
|
3102
2916
|
};
|
|
3103
2917
|
}
|
|
3104
2918
|
//#endregion
|
|
3105
2919
|
//#region src/auth/auth-context.tsx
|
|
3106
|
-
var
|
|
3107
|
-
function
|
|
3108
|
-
let [r, i] =
|
|
2920
|
+
var Dr = E(null);
|
|
2921
|
+
function Or({ children: e, config: n }) {
|
|
2922
|
+
let [r, i] = M({
|
|
3109
2923
|
isAuthenticated: !1,
|
|
3110
2924
|
isLoading: !0,
|
|
3111
2925
|
user: null,
|
|
3112
2926
|
error: null
|
|
3113
2927
|
});
|
|
3114
|
-
|
|
2928
|
+
k(() => {
|
|
3115
2929
|
(() => {
|
|
3116
|
-
let e = n.devLoginRunId, t = !!e &&
|
|
3117
|
-
e &&
|
|
3118
|
-
let r = !!n.devLoginToken && !!e && !t && !
|
|
2930
|
+
let e = n.devLoginRunId, t = !!e && Zn() === e;
|
|
2931
|
+
e && Xn(e);
|
|
2932
|
+
let r = !!n.devLoginToken && !!e && !t && !Kn(n.devLoginToken), a = ar();
|
|
3119
2933
|
if (a) {
|
|
3120
|
-
|
|
2934
|
+
or(), i({
|
|
3121
2935
|
isAuthenticated: !1,
|
|
3122
2936
|
isLoading: !1,
|
|
3123
2937
|
user: null,
|
|
@@ -3125,14 +2939,14 @@ function Ar({ children: e, config: n }) {
|
|
|
3125
2939
|
});
|
|
3126
2940
|
return;
|
|
3127
2941
|
}
|
|
3128
|
-
let o =
|
|
2942
|
+
let o = ir();
|
|
3129
2943
|
if (o) {
|
|
3130
2944
|
let e = {
|
|
3131
2945
|
token: o.token,
|
|
3132
2946
|
provider: o.provider,
|
|
3133
2947
|
authenticatedAt: Date.now()
|
|
3134
2948
|
};
|
|
3135
|
-
Y(e),
|
|
2949
|
+
Y(e), or(), i({
|
|
3136
2950
|
isAuthenticated: !0,
|
|
3137
2951
|
isLoading: !1,
|
|
3138
2952
|
user: X(e),
|
|
@@ -3140,7 +2954,7 @@ function Ar({ children: e, config: n }) {
|
|
|
3140
2954
|
});
|
|
3141
2955
|
return;
|
|
3142
2956
|
}
|
|
3143
|
-
let s =
|
|
2957
|
+
let s = qn();
|
|
3144
2958
|
if (s && !(r && s.provider === "anonymous")) {
|
|
3145
2959
|
i({
|
|
3146
2960
|
isAuthenticated: !0,
|
|
@@ -3172,7 +2986,7 @@ function Ar({ children: e, config: n }) {
|
|
|
3172
2986
|
});
|
|
3173
2987
|
})();
|
|
3174
2988
|
}, [n.devLoginToken, n.devLoginRunId]);
|
|
3175
|
-
let a =
|
|
2989
|
+
let a = O(async (e) => {
|
|
3176
2990
|
if (!n.spaceId) {
|
|
3177
2991
|
i((e) => ({
|
|
3178
2992
|
...e,
|
|
@@ -3197,7 +3011,7 @@ function Ar({ children: e, config: n }) {
|
|
|
3197
3011
|
isLoading: !0
|
|
3198
3012
|
}));
|
|
3199
3013
|
try {
|
|
3200
|
-
let r = await
|
|
3014
|
+
let r = await tr(n.spaceId, t, e);
|
|
3201
3015
|
i({
|
|
3202
3016
|
isAuthenticated: !0,
|
|
3203
3017
|
isLoading: !1,
|
|
@@ -3220,7 +3034,7 @@ function Ar({ children: e, config: n }) {
|
|
|
3220
3034
|
error: null
|
|
3221
3035
|
}));
|
|
3222
3036
|
try {
|
|
3223
|
-
let e = await
|
|
3037
|
+
let e = await Er({ optionsJSON: await ur(t) }), n = await dr(t, e);
|
|
3224
3038
|
i({
|
|
3225
3039
|
isAuthenticated: !0,
|
|
3226
3040
|
isLoading: !1,
|
|
@@ -3237,26 +3051,26 @@ function Ar({ children: e, config: n }) {
|
|
|
3237
3051
|
return;
|
|
3238
3052
|
}
|
|
3239
3053
|
if (e === "email") throw Error("login('email') is not supported. Use requestEmailCode()/submitEmailCode() from useAuth() instead.");
|
|
3240
|
-
window.location.href =
|
|
3241
|
-
}, [n.authUrl, n.spaceId]), o =
|
|
3054
|
+
window.location.href = sr(e, n.spaceId, t);
|
|
3055
|
+
}, [n.authUrl, n.spaceId]), o = O(async (e) => {
|
|
3242
3056
|
if (!n.spaceId) throw i((e) => ({
|
|
3243
3057
|
...e,
|
|
3244
3058
|
error: "Space ID is not configured"
|
|
3245
3059
|
})), Error("Space ID is not configured");
|
|
3246
3060
|
let t = await v(n.authUrl);
|
|
3247
|
-
await
|
|
3061
|
+
await nr({
|
|
3248
3062
|
email: e,
|
|
3249
3063
|
spaceId: n.spaceId,
|
|
3250
3064
|
authUrl: t
|
|
3251
3065
|
});
|
|
3252
|
-
}, [n.authUrl, n.spaceId]), s =
|
|
3066
|
+
}, [n.authUrl, n.spaceId]), s = O(async (e, t) => {
|
|
3253
3067
|
i((e) => ({
|
|
3254
3068
|
...e,
|
|
3255
3069
|
isLoading: !0,
|
|
3256
3070
|
error: null
|
|
3257
3071
|
}));
|
|
3258
3072
|
try {
|
|
3259
|
-
let r = await
|
|
3073
|
+
let r = await rr({
|
|
3260
3074
|
email: e,
|
|
3261
3075
|
code: t,
|
|
3262
3076
|
authUrl: await v(n.authUrl)
|
|
@@ -3275,14 +3089,14 @@ function Ar({ children: e, config: n }) {
|
|
|
3275
3089
|
error: t
|
|
3276
3090
|
})), e;
|
|
3277
3091
|
}
|
|
3278
|
-
}, [n.authUrl]), c =
|
|
3279
|
-
|
|
3092
|
+
}, [n.authUrl]), c = O(() => {
|
|
3093
|
+
Yn(), t.clearAll(), i({
|
|
3280
3094
|
isAuthenticated: !1,
|
|
3281
3095
|
isLoading: !1,
|
|
3282
3096
|
user: null,
|
|
3283
3097
|
error: null
|
|
3284
3098
|
});
|
|
3285
|
-
}, []), l =
|
|
3099
|
+
}, []), l = O(async (e) => {
|
|
3286
3100
|
let t = await v(n.authUrl);
|
|
3287
3101
|
i((e) => ({
|
|
3288
3102
|
...e,
|
|
@@ -3290,7 +3104,7 @@ function Ar({ children: e, config: n }) {
|
|
|
3290
3104
|
error: null
|
|
3291
3105
|
}));
|
|
3292
3106
|
try {
|
|
3293
|
-
let n = await
|
|
3107
|
+
let n = await lr(t, await xr({ optionsJSON: await cr(t) }), e);
|
|
3294
3108
|
i({
|
|
3295
3109
|
isAuthenticated: !0,
|
|
3296
3110
|
isLoading: !1,
|
|
@@ -3304,7 +3118,7 @@ function Ar({ children: e, config: n }) {
|
|
|
3304
3118
|
error: e instanceof Error ? e.message : "Passkey registration failed"
|
|
3305
3119
|
}));
|
|
3306
3120
|
}
|
|
3307
|
-
}, [n.authUrl]), u =
|
|
3121
|
+
}, [n.authUrl]), u = O(() => r.user?.token ?? null, [r.user]), d = A(() => ({
|
|
3308
3122
|
state: r,
|
|
3309
3123
|
login: a,
|
|
3310
3124
|
logout: c,
|
|
@@ -3321,30 +3135,30 @@ function Ar({ children: e, config: n }) {
|
|
|
3321
3135
|
o,
|
|
3322
3136
|
s
|
|
3323
3137
|
]);
|
|
3324
|
-
return /* @__PURE__ */ (
|
|
3138
|
+
return /* @__PURE__ */ F(Dr, {
|
|
3325
3139
|
value: d,
|
|
3326
3140
|
children: e
|
|
3327
3141
|
});
|
|
3328
3142
|
}
|
|
3329
|
-
function
|
|
3330
|
-
let e =
|
|
3143
|
+
function kr() {
|
|
3144
|
+
let e = le(Dr);
|
|
3331
3145
|
if (!e) throw Error("useAuth must be used within an AuthProvider");
|
|
3332
3146
|
return e;
|
|
3333
3147
|
}
|
|
3334
|
-
function
|
|
3335
|
-
return
|
|
3148
|
+
function Ar() {
|
|
3149
|
+
return le(Dr);
|
|
3336
3150
|
}
|
|
3337
3151
|
//#endregion
|
|
3338
3152
|
//#region src/auth/use-auth-guard.ts
|
|
3339
|
-
function
|
|
3340
|
-
let { config: t, guestUrlParam: n } = e, { state: r, login: i } =
|
|
3341
|
-
|
|
3153
|
+
function jr(e) {
|
|
3154
|
+
let { config: t, guestUrlParam: n } = e, { state: r, login: i } = kr(), a = j(!1), o = N(se, S, S).required;
|
|
3155
|
+
k(() => {
|
|
3342
3156
|
o && r.isAuthenticated && r.user && r.user.provider !== "anonymous" && g();
|
|
3343
3157
|
}, [
|
|
3344
3158
|
o,
|
|
3345
3159
|
r.isAuthenticated,
|
|
3346
3160
|
r.user
|
|
3347
|
-
]),
|
|
3161
|
+
]), k(() => {
|
|
3348
3162
|
if (!n || r.isAuthenticated || r.isLoading || a.current) return;
|
|
3349
3163
|
let e = t.methods.includes("global") ? "global" : t.methods.includes("guest") ? "guest" : null;
|
|
3350
3164
|
if (!e) return;
|
|
@@ -3373,17 +3187,17 @@ function Nr(e) {
|
|
|
3373
3187
|
}
|
|
3374
3188
|
//#endregion
|
|
3375
3189
|
//#region src/debug/debug-overlay.tsx
|
|
3376
|
-
var
|
|
3190
|
+
var Mr = (() => {
|
|
3377
3191
|
try {
|
|
3378
|
-
return
|
|
3192
|
+
return b();
|
|
3379
3193
|
} catch {
|
|
3380
3194
|
return !1;
|
|
3381
3195
|
}
|
|
3382
|
-
})(),
|
|
3383
|
-
function
|
|
3384
|
-
$.push(`[+${((Date.now() -
|
|
3196
|
+
})(), Nr = Date.now(), $ = [], Pr = 300;
|
|
3197
|
+
function Fr(e) {
|
|
3198
|
+
$.push(`[+${((Date.now() - Nr) / 1e3).toFixed(1)}s] ${e}`), $.length > Pr && $.shift();
|
|
3385
3199
|
}
|
|
3386
|
-
function
|
|
3200
|
+
function Ir(e) {
|
|
3387
3201
|
if (typeof e == "string") return e;
|
|
3388
3202
|
if (e instanceof Error) return `${e.name}: ${e.message}`;
|
|
3389
3203
|
try {
|
|
@@ -3392,10 +3206,10 @@ function Rr(e) {
|
|
|
3392
3206
|
return String(e);
|
|
3393
3207
|
}
|
|
3394
3208
|
}
|
|
3395
|
-
var
|
|
3396
|
-
function
|
|
3397
|
-
if (
|
|
3398
|
-
|
|
3209
|
+
var Lr = !1;
|
|
3210
|
+
function Rr() {
|
|
3211
|
+
if (Lr || typeof window > "u") return;
|
|
3212
|
+
Lr = !0, window.addEventListener("error", (e) => Fr(`window.error: ${e.message} @ ${e.filename ?? "?"}:${e.lineno ?? "?"}:${e.colno ?? "?"}`)), window.addEventListener("unhandledrejection", (e) => Fr(`unhandledRejection: ${Ir(e.reason)}`));
|
|
3399
3213
|
let e = console;
|
|
3400
3214
|
for (let t of [
|
|
3401
3215
|
"error",
|
|
@@ -3406,17 +3220,17 @@ function Br() {
|
|
|
3406
3220
|
let n = e[t]?.bind(console) ?? (() => void 0);
|
|
3407
3221
|
e[t] = (...e) => {
|
|
3408
3222
|
try {
|
|
3409
|
-
|
|
3223
|
+
Fr(`console.${t}: ${e.map(Ir).join(" ")}`);
|
|
3410
3224
|
} catch {}
|
|
3411
3225
|
n(...e);
|
|
3412
3226
|
};
|
|
3413
3227
|
}
|
|
3414
3228
|
try {
|
|
3415
|
-
|
|
3229
|
+
T((e) => Fr(`${e.levelName} [${e.component}] ${e.message}`), { minLevel: u.DEBUG });
|
|
3416
3230
|
} catch {}
|
|
3417
3231
|
}
|
|
3418
|
-
|
|
3419
|
-
function
|
|
3232
|
+
Mr && Rr();
|
|
3233
|
+
function zr() {
|
|
3420
3234
|
let e = !1;
|
|
3421
3235
|
try {
|
|
3422
3236
|
let t = URL.createObjectURL(new Blob([""]));
|
|
@@ -3426,11 +3240,11 @@ function Vr() {
|
|
|
3426
3240
|
} catch {}
|
|
3427
3241
|
return e;
|
|
3428
3242
|
}
|
|
3429
|
-
function
|
|
3243
|
+
function Br() {
|
|
3430
3244
|
let e = globalThis;
|
|
3431
3245
|
return [
|
|
3432
3246
|
`Worker=${typeof Worker < "u"}`,
|
|
3433
|
-
`moduleWorker=${
|
|
3247
|
+
`moduleWorker=${zr()}`,
|
|
3434
3248
|
`WebSocket=${typeof WebSocket < "u"}`,
|
|
3435
3249
|
`WebTransport=${e.WebTransport !== void 0}`,
|
|
3436
3250
|
`RTCPeerConnection=${typeof RTCPeerConnection < "u"}`,
|
|
@@ -3443,17 +3257,17 @@ function Hr() {
|
|
|
3443
3257
|
`online=${typeof navigator < "u" ? navigator.onLine : "?"}`
|
|
3444
3258
|
].join(" ");
|
|
3445
3259
|
}
|
|
3446
|
-
function
|
|
3260
|
+
function Vr(e) {
|
|
3447
3261
|
return /ERROR|error:|Rejection/.test(e) ? "#f88" : /WARN|warn:/.test(e) ? "#fc6" : "#9d9";
|
|
3448
3262
|
}
|
|
3449
|
-
function
|
|
3450
|
-
let n =
|
|
3451
|
-
return
|
|
3263
|
+
function Hr({ state: e = "", forceVisible: t = !1 }) {
|
|
3264
|
+
let n = Mr || t, r = e === "connected" || e === "reconnecting", [, i] = de((e) => e + 1, 0), [a, o] = M(!0);
|
|
3265
|
+
return k(() => {
|
|
3452
3266
|
if (!n) return;
|
|
3453
|
-
|
|
3267
|
+
Rr();
|
|
3454
3268
|
let e = setInterval(i, 1e3);
|
|
3455
3269
|
return () => clearInterval(e);
|
|
3456
|
-
}, [n]), n ? r && a ? /* @__PURE__ */ (
|
|
3270
|
+
}, [n]), n ? r && a ? /* @__PURE__ */ I("button", {
|
|
3457
3271
|
type: "button",
|
|
3458
3272
|
onClick: () => o(!1),
|
|
3459
3273
|
style: {
|
|
@@ -3473,7 +3287,7 @@ function Wr({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3473
3287
|
$.length,
|
|
3474
3288
|
")"
|
|
3475
3289
|
]
|
|
3476
|
-
}) : /* @__PURE__ */ (
|
|
3290
|
+
}) : /* @__PURE__ */ I("div", {
|
|
3477
3291
|
style: {
|
|
3478
3292
|
...r ? {
|
|
3479
3293
|
position: "fixed",
|
|
@@ -3494,7 +3308,7 @@ function Wr({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3494
3308
|
zIndex: 2147483647
|
|
3495
3309
|
},
|
|
3496
3310
|
children: [
|
|
3497
|
-
/* @__PURE__ */ (
|
|
3311
|
+
/* @__PURE__ */ I("div", {
|
|
3498
3312
|
style: {
|
|
3499
3313
|
color: "#fff",
|
|
3500
3314
|
fontSize: "18px",
|
|
@@ -3504,11 +3318,11 @@ function Wr({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3504
3318
|
"Ikon debug overlay — state: ",
|
|
3505
3319
|
e || "?",
|
|
3506
3320
|
", +",
|
|
3507
|
-
Math.round((Date.now() -
|
|
3321
|
+
Math.round((Date.now() - Nr) / 1e3),
|
|
3508
3322
|
"s, ",
|
|
3509
3323
|
$.length,
|
|
3510
3324
|
" entries",
|
|
3511
|
-
r && /* @__PURE__ */ (
|
|
3325
|
+
r && /* @__PURE__ */ F("button", {
|
|
3512
3326
|
type: "button",
|
|
3513
3327
|
onClick: () => o(!0),
|
|
3514
3328
|
style: {
|
|
@@ -3524,7 +3338,7 @@ function Wr({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3524
3338
|
})
|
|
3525
3339
|
]
|
|
3526
3340
|
}),
|
|
3527
|
-
/* @__PURE__ */ (
|
|
3341
|
+
/* @__PURE__ */ F("div", {
|
|
3528
3342
|
style: {
|
|
3529
3343
|
color: "#9cf",
|
|
3530
3344
|
wordBreak: "break-all",
|
|
@@ -3532,7 +3346,7 @@ function Wr({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3532
3346
|
},
|
|
3533
3347
|
children: typeof window < "u" ? window.location.href : ""
|
|
3534
3348
|
}),
|
|
3535
|
-
/* @__PURE__ */ (
|
|
3349
|
+
/* @__PURE__ */ F("div", {
|
|
3536
3350
|
style: {
|
|
3537
3351
|
color: "#ff0",
|
|
3538
3352
|
wordBreak: "break-all",
|
|
@@ -3540,23 +3354,23 @@ function Wr({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3540
3354
|
},
|
|
3541
3355
|
children: typeof navigator < "u" ? navigator.userAgent : "no navigator"
|
|
3542
3356
|
}),
|
|
3543
|
-
/* @__PURE__ */ (
|
|
3357
|
+
/* @__PURE__ */ F("div", {
|
|
3544
3358
|
style: {
|
|
3545
3359
|
color: "#8cf",
|
|
3546
3360
|
marginBottom: "4px"
|
|
3547
3361
|
},
|
|
3548
|
-
children:
|
|
3362
|
+
children: Br()
|
|
3549
3363
|
}),
|
|
3550
|
-
/* @__PURE__ */ (
|
|
3364
|
+
/* @__PURE__ */ F("div", {
|
|
3551
3365
|
style: {
|
|
3552
3366
|
color: "#8cf",
|
|
3553
3367
|
marginBottom: "10px"
|
|
3554
3368
|
},
|
|
3555
3369
|
children: typeof window < "u" ? `viewport=${window.innerWidth}x${window.innerHeight} dpr=${window.devicePixelRatio}` : ""
|
|
3556
3370
|
}),
|
|
3557
|
-
/* @__PURE__ */ (
|
|
3371
|
+
/* @__PURE__ */ F("div", { children: $.length === 0 ? "(nothing captured yet)" : $.map((e, t) => /* @__PURE__ */ F("div", {
|
|
3558
3372
|
style: {
|
|
3559
|
-
color:
|
|
3373
|
+
color: Vr(e),
|
|
3560
3374
|
wordBreak: "break-all"
|
|
3561
3375
|
},
|
|
3562
3376
|
children: e
|
|
@@ -3566,9 +3380,8 @@ function Wr({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3566
3380
|
}
|
|
3567
3381
|
//#endregion
|
|
3568
3382
|
//#region src/app/connection-state-renderer.tsx
|
|
3569
|
-
function
|
|
3570
|
-
let m =
|
|
3571
|
-
return /* @__PURE__ */ (0, z.jsxs)(z.Fragment, { children: [(() => {
|
|
3383
|
+
function Ur({ 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 }) {
|
|
3384
|
+
let m = j(!1), h = (() => {
|
|
3572
3385
|
switch (e) {
|
|
3573
3386
|
case "waitingForExternalConnectUrl":
|
|
3574
3387
|
case "connecting": return r ? u() : l();
|
|
@@ -3592,199 +3405,208 @@ function Gr({ connectionState: e, error: t, isReady: n, isConnectingSlow: r, sto
|
|
|
3592
3405
|
}
|
|
3593
3406
|
default: return null;
|
|
3594
3407
|
}
|
|
3595
|
-
})()
|
|
3408
|
+
})();
|
|
3409
|
+
return /* @__PURE__ */ I(P, { children: [h, /* @__PURE__ */ F(Hr, { state: e })] });
|
|
3596
3410
|
}
|
|
3597
3411
|
//#endregion
|
|
3598
3412
|
//#region src/app/boot-snapshot-variant.ts
|
|
3599
|
-
function
|
|
3413
|
+
function Wr(e, t) {
|
|
3600
3414
|
return e === !1 ? !1 : t ? "signed-in" : "guest";
|
|
3601
3415
|
}
|
|
3602
3416
|
//#endregion
|
|
3603
3417
|
//#region src/app/use-ikon-app.ts
|
|
3604
|
-
var
|
|
3605
|
-
function
|
|
3418
|
+
var Gr = _("useIkonApp");
|
|
3419
|
+
function Kr() {
|
|
3606
3420
|
if (typeof window < "u" && window.__IKON_AUTH_CONFIG__) return window.__IKON_AUTH_CONFIG__;
|
|
3607
3421
|
}
|
|
3608
|
-
function
|
|
3422
|
+
function qr() {
|
|
3609
3423
|
if (typeof window < "u" && window.__IKON_LOCAL_IKON_SERVER_CONFIG__) return window.__IKON_LOCAL_IKON_SERVER_CONFIG__;
|
|
3610
3424
|
}
|
|
3611
|
-
function
|
|
3612
|
-
let { authConfig: n, modules: r, timeouts: c, backgroundAudio: u, webRtc: h, audio: g, video: _, websocket:
|
|
3613
|
-
|
|
3614
|
-
let [
|
|
3425
|
+
function Jr(e) {
|
|
3426
|
+
let { authConfig: n, modules: r, timeouts: c, backgroundAudio: u, webRtc: h, audio: g, video: _, websocket: b, webtransport: x, proxy: S, liveSnapshot: te, bootSnapshot: ne } = e, C = n === void 0 ? Kr() ?? null : n, ie = qr(), w = Ar(), se = !!w && w.state.isLoading, T = j(null), ce = j(null), E = j(null), D = j(!1), le = j(!1), ue = j(u), de = j(c), N = j(h), P = j(g), F = j(_), I = j(b), fe = j(x), L = j(S), pe = j(te), me = j(ne), he = j("local"), ge = j(void 0);
|
|
3427
|
+
ue.current = u, de.current = c, N.current = h, P.current = g, F.current = _, I.current = b, fe.current = x, L.current = S, pe.current = te, me.current = ne;
|
|
3428
|
+
let [R, _e] = M("connecting"), [ve, ye] = M(!1), [be, xe] = M(!1), [Se, Ce] = M(null), [we, Te] = M(null), [Ee, De] = M(!1), [Oe, ke] = M(!1), [Ae, je] = M(null), [z, Ne] = M(null), [B, Pe] = M(!1), Fe = j(!1), [Ie, Le] = M(0), V = A(() => {
|
|
3615
3429
|
try {
|
|
3616
|
-
return
|
|
3430
|
+
return ae();
|
|
3617
3431
|
} catch {
|
|
3618
3432
|
return { parameters: {} };
|
|
3619
3433
|
}
|
|
3620
|
-
}, []),
|
|
3621
|
-
|
|
3622
|
-
let
|
|
3623
|
-
|
|
3624
|
-
|
|
3434
|
+
}, []), Re = (C?.methods?.length ?? 0) > 0, ze = Wr(ne, Re && Jn());
|
|
3435
|
+
ze !== !1 && !i() && a(ze);
|
|
3436
|
+
let H = A(() => C?.spaceId ? qn() : null, [
|
|
3437
|
+
C?.spaceId,
|
|
3438
|
+
Ie,
|
|
3439
|
+
w?.state.isLoading,
|
|
3440
|
+
w?.state.isAuthenticated,
|
|
3441
|
+
w?.state.user?.token
|
|
3442
|
+
]), U = ie?.enabled ?? !1, W = ie?.host ?? "localhost", Be = ie?.port ?? 8443, G = !se && !!C && !H && !C.requireSignIn && !!C.spaceId && (re() || U);
|
|
3443
|
+
G && !z && !B && !Fe.current && (Fe.current = !0, v(C.authUrl).then((e) => tr(C.spaceId, e)).then((e) => {
|
|
3444
|
+
Ne(e.token), Pe(!0);
|
|
3625
3445
|
}).catch((e) => {
|
|
3626
|
-
|
|
3446
|
+
Gr.error("Anonymous auth failed:", e), Fe.current = !1, U ? Pe(!0) : Ce(e instanceof Error ? e.message : "Anonymous auth failed");
|
|
3627
3447
|
}));
|
|
3628
|
-
let
|
|
3629
|
-
if (
|
|
3630
|
-
|
|
3631
|
-
|
|
3448
|
+
let Ve = A(() => {
|
|
3449
|
+
if (se) return null;
|
|
3450
|
+
if (U) {
|
|
3451
|
+
if (G && !B) return null;
|
|
3452
|
+
let e = H?.token ?? z ?? void 0, t = e ? ee(e) ?? void 0 : void 0;
|
|
3632
3453
|
return { local: {
|
|
3633
|
-
host:
|
|
3634
|
-
httpsPort:
|
|
3454
|
+
host: W,
|
|
3455
|
+
httpsPort: Be,
|
|
3635
3456
|
userId: t,
|
|
3636
|
-
token:
|
|
3457
|
+
token: H?.token ?? void 0,
|
|
3637
3458
|
identityToken: e,
|
|
3638
|
-
spaceId:
|
|
3639
|
-
backendUrl:
|
|
3640
|
-
authUrl:
|
|
3641
|
-
parameters:
|
|
3459
|
+
spaceId: C?.spaceId,
|
|
3460
|
+
backendUrl: C?.backendUrl,
|
|
3461
|
+
authUrl: C?.authUrl,
|
|
3462
|
+
parameters: V.parameters
|
|
3642
3463
|
} };
|
|
3643
3464
|
}
|
|
3644
|
-
return
|
|
3645
|
-
token:
|
|
3646
|
-
spaceId:
|
|
3465
|
+
return H?.token && C?.spaceId ? { sessionToken: {
|
|
3466
|
+
token: H.token,
|
|
3467
|
+
spaceId: C.spaceId,
|
|
3647
3468
|
backendType: y(),
|
|
3648
|
-
sessionIdentityHash:
|
|
3649
|
-
parameters:
|
|
3650
|
-
} } :
|
|
3651
|
-
token:
|
|
3652
|
-
spaceId:
|
|
3469
|
+
sessionIdentityHash: V.sessionIdentityHash,
|
|
3470
|
+
parameters: V.parameters
|
|
3471
|
+
} } : z && C?.spaceId ? { sessionToken: {
|
|
3472
|
+
token: z,
|
|
3473
|
+
spaceId: C.spaceId,
|
|
3653
3474
|
backendType: y(),
|
|
3654
|
-
sessionIdentityHash:
|
|
3655
|
-
parameters:
|
|
3656
|
-
} } :
|
|
3657
|
-
host:
|
|
3658
|
-
httpsPort:
|
|
3659
|
-
spaceId:
|
|
3660
|
-
backendUrl:
|
|
3661
|
-
authUrl:
|
|
3662
|
-
parameters:
|
|
3475
|
+
sessionIdentityHash: V.sessionIdentityHash,
|
|
3476
|
+
parameters: V.parameters
|
|
3477
|
+
} } : re() ? null : { local: {
|
|
3478
|
+
host: W,
|
|
3479
|
+
httpsPort: Be,
|
|
3480
|
+
spaceId: C?.spaceId,
|
|
3481
|
+
backendUrl: C?.backendUrl,
|
|
3482
|
+
authUrl: C?.authUrl,
|
|
3483
|
+
parameters: V.parameters
|
|
3663
3484
|
} };
|
|
3664
3485
|
}, [
|
|
3486
|
+
se,
|
|
3487
|
+
U,
|
|
3488
|
+
W,
|
|
3489
|
+
Be,
|
|
3490
|
+
H?.token,
|
|
3491
|
+
C?.spaceId,
|
|
3492
|
+
C?.backendUrl,
|
|
3493
|
+
C?.authUrl,
|
|
3494
|
+
z,
|
|
3665
3495
|
G,
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
w?.spaceId,
|
|
3670
|
-
w?.backendUrl,
|
|
3671
|
-
w?.authUrl,
|
|
3672
|
-
V,
|
|
3673
|
-
ze,
|
|
3674
|
-
Ae,
|
|
3675
|
-
U.sessionIdentityHash,
|
|
3676
|
-
U.parameters
|
|
3496
|
+
B,
|
|
3497
|
+
V.sessionIdentityHash,
|
|
3498
|
+
V.parameters
|
|
3677
3499
|
]);
|
|
3678
|
-
|
|
3679
|
-
let
|
|
3680
|
-
|
|
3681
|
-
if (!
|
|
3682
|
-
if (
|
|
3683
|
-
|
|
3684
|
-
|
|
3500
|
+
he.current = C?.spaceId ?? "local", ge.current = H?.token ?? z ?? void 0, tn(Ae);
|
|
3501
|
+
let He = rn(Ae);
|
|
3502
|
+
k(() => {
|
|
3503
|
+
if (!D.current) {
|
|
3504
|
+
if (D.current = !0, E.current = Vt(), r) for (let e of r) e(E.current);
|
|
3505
|
+
E.current.loadRegisteredModules().catch((e) => {
|
|
3506
|
+
Gr.error("Failed to load UI modules", e);
|
|
3685
3507
|
});
|
|
3686
3508
|
}
|
|
3687
|
-
}, []),
|
|
3688
|
-
if (!
|
|
3509
|
+
}, []), k(() => {
|
|
3510
|
+
if (!Ve) return;
|
|
3689
3511
|
let e = new l({
|
|
3690
|
-
...
|
|
3691
|
-
timeouts:
|
|
3692
|
-
audio:
|
|
3693
|
-
enabled:
|
|
3694
|
-
...
|
|
3512
|
+
...Ve,
|
|
3513
|
+
timeouts: de.current,
|
|
3514
|
+
audio: P.current !== void 0 || ue.current ? {
|
|
3515
|
+
enabled: P.current,
|
|
3516
|
+
...ue.current ? { background: {
|
|
3695
3517
|
allowOnDesktop: !0,
|
|
3696
3518
|
allowOnMobile: !0
|
|
3697
3519
|
} } : {}
|
|
3698
3520
|
} : void 0,
|
|
3699
|
-
video:
|
|
3521
|
+
video: F.current === void 0 ? void 0 : { enabled: F.current },
|
|
3700
3522
|
mediaSession: {
|
|
3701
3523
|
title: document.title || void 0,
|
|
3702
3524
|
artist: document.title || void 0
|
|
3703
3525
|
},
|
|
3704
|
-
webRtc:
|
|
3705
|
-
websocket:
|
|
3706
|
-
webtransport:
|
|
3707
|
-
proxy:
|
|
3526
|
+
webRtc: N.current === !1 ? { enabled: !1 } : void 0,
|
|
3527
|
+
websocket: I.current,
|
|
3528
|
+
webtransport: fe.current,
|
|
3529
|
+
proxy: L.current,
|
|
3708
3530
|
onConnectionStateChange: (e) => {
|
|
3709
|
-
|
|
3531
|
+
_e(e);
|
|
3710
3532
|
},
|
|
3711
3533
|
onError: (e) => {
|
|
3712
|
-
|
|
3534
|
+
Ce(e.message);
|
|
3713
3535
|
}
|
|
3714
3536
|
});
|
|
3715
3537
|
T.current = e;
|
|
3716
|
-
let n =
|
|
3538
|
+
let n = pe.current ?? !0, r = ge.current, i = r ? ee(r) ?? null : null, a = n && i ? {
|
|
3717
3539
|
enabled: !0,
|
|
3718
|
-
appId:
|
|
3540
|
+
appId: he.current,
|
|
3719
3541
|
userId: i
|
|
3720
|
-
} : void 0, c =
|
|
3542
|
+
} : void 0, c = H != null && H.provider !== "anonymous", u = Re && (c || Jn()), h = new Me({
|
|
3721
3543
|
client: e,
|
|
3722
3544
|
liveSnapshot: a,
|
|
3723
|
-
bootSnapshot:
|
|
3545
|
+
bootSnapshot: Wr(me.current, u)
|
|
3724
3546
|
});
|
|
3725
|
-
|
|
3547
|
+
ce.current = h, je(h), xe(!1);
|
|
3726
3548
|
let g = h.subscribeToUiUpdates(() => {
|
|
3727
|
-
|
|
3549
|
+
xe(!0), oe();
|
|
3728
3550
|
});
|
|
3729
3551
|
return e.connect().catch((e) => {
|
|
3730
|
-
if (
|
|
3731
|
-
|
|
3552
|
+
if (Gr.error("Connection failed:", e), e instanceof o) {
|
|
3553
|
+
Te(e.reason);
|
|
3732
3554
|
return;
|
|
3733
3555
|
}
|
|
3734
3556
|
if (e instanceof f) {
|
|
3735
|
-
|
|
3557
|
+
De(!0);
|
|
3736
3558
|
return;
|
|
3737
3559
|
}
|
|
3738
3560
|
if (e instanceof m) {
|
|
3739
|
-
|
|
3561
|
+
ke(!0);
|
|
3740
3562
|
return;
|
|
3741
3563
|
}
|
|
3742
|
-
e instanceof p || e instanceof d || e instanceof s && !
|
|
3564
|
+
e instanceof p || e instanceof d || e instanceof s && !le.current && (le.current = !0, Gr.warn("Auth session appears stale, clearing and retrying"), t.clearAll(), w ? w.logout() : (Yn(), Le((e) => e + 1)));
|
|
3743
3565
|
}), () => {
|
|
3744
|
-
g(), e.disconnect(), T.current = null, h.dispose(),
|
|
3566
|
+
g(), e.disconnect(), T.current = null, h.dispose(), ce.current = null;
|
|
3745
3567
|
};
|
|
3746
|
-
}, [
|
|
3747
|
-
let
|
|
3568
|
+
}, [Ve]);
|
|
3569
|
+
let Ue = O((e, t) => {
|
|
3748
3570
|
let n = typeof t == "string" ? t : JSON.stringify(t ?? {});
|
|
3749
3571
|
T.current?.sendActionCall(e, n);
|
|
3750
3572
|
}, []);
|
|
3751
|
-
|
|
3752
|
-
if (
|
|
3753
|
-
|
|
3573
|
+
k(() => {
|
|
3574
|
+
if (R !== "connecting") {
|
|
3575
|
+
ye(!1);
|
|
3754
3576
|
return;
|
|
3755
3577
|
}
|
|
3756
|
-
let e = T.current?.slowConnectionThresholdMs ?? 5e3, t = setTimeout(() =>
|
|
3578
|
+
let e = T.current?.slowConnectionThresholdMs ?? 5e3, t = setTimeout(() => ye(!0), e);
|
|
3757
3579
|
return () => clearTimeout(t);
|
|
3758
|
-
}, [
|
|
3759
|
-
let
|
|
3760
|
-
return
|
|
3761
|
-
typeof document > "u" || (document.documentElement.dataset.ikonLive = String(
|
|
3762
|
-
}, [
|
|
3763
|
-
connectionState:
|
|
3764
|
-
error:
|
|
3765
|
-
accessDeniedReason:
|
|
3766
|
-
isServerFull:
|
|
3767
|
-
isSessionExpired:
|
|
3768
|
-
stores:
|
|
3580
|
+
}, [R]);
|
|
3581
|
+
let We = R === "connected" || R === "reconnecting", Ge = be && R !== "offline";
|
|
3582
|
+
return k(() => {
|
|
3583
|
+
typeof document > "u" || (document.documentElement.dataset.ikonLive = String(Ge));
|
|
3584
|
+
}, [Ge]), {
|
|
3585
|
+
connectionState: R,
|
|
3586
|
+
error: Se,
|
|
3587
|
+
accessDeniedReason: we,
|
|
3588
|
+
isServerFull: Ee,
|
|
3589
|
+
isSessionExpired: Oe,
|
|
3590
|
+
stores: He,
|
|
3769
3591
|
client: T.current,
|
|
3770
|
-
registry:
|
|
3592
|
+
registry: E.current,
|
|
3771
3593
|
clientRef: T,
|
|
3772
|
-
uiRef:
|
|
3773
|
-
registryRef:
|
|
3774
|
-
onAction:
|
|
3775
|
-
isReady:
|
|
3776
|
-
isLive:
|
|
3594
|
+
uiRef: ce,
|
|
3595
|
+
registryRef: E,
|
|
3596
|
+
onAction: Ue,
|
|
3597
|
+
isReady: We,
|
|
3598
|
+
isLive: Ge,
|
|
3777
3599
|
brandingRequired: T.current?.brandingRequired ?? !1,
|
|
3778
|
-
isConnectingSlow:
|
|
3600
|
+
isConnectingSlow: ve,
|
|
3779
3601
|
webRtcVideoStreams: T.current?.webRtcVideoStreams ?? /* @__PURE__ */ new Map(),
|
|
3780
3602
|
webRtcTrackMap: T.current?.webRtcTrackMap ?? /* @__PURE__ */ new Map()
|
|
3781
3603
|
};
|
|
3782
3604
|
}
|
|
3783
3605
|
//#endregion
|
|
3784
3606
|
//#region src/hooks/use-lazy-font.ts
|
|
3785
|
-
function
|
|
3786
|
-
let t =
|
|
3787
|
-
return
|
|
3607
|
+
function Yr(e) {
|
|
3608
|
+
let t = j(!1);
|
|
3609
|
+
return O(() => {
|
|
3788
3610
|
if (t.current) return;
|
|
3789
3611
|
t.current = !0;
|
|
3790
3612
|
let n = document.createElement("link");
|
|
@@ -3793,16 +3615,16 @@ function Zr(e) {
|
|
|
3793
3615
|
}
|
|
3794
3616
|
//#endregion
|
|
3795
3617
|
//#region src/hooks/use-toasts.ts
|
|
3796
|
-
var
|
|
3797
|
-
function
|
|
3798
|
-
let [n, r] =
|
|
3618
|
+
var Xr = 0;
|
|
3619
|
+
function Zr(e = 5, t = 5e3) {
|
|
3620
|
+
let [n, r] = M([]), i = j(/* @__PURE__ */ new Map()), a = O((e) => {
|
|
3799
3621
|
let t = i.current.get(e);
|
|
3800
3622
|
t && (clearTimeout(t), i.current.delete(e)), r((t) => t.filter((t) => t.id !== e));
|
|
3801
3623
|
}, []);
|
|
3802
|
-
return
|
|
3803
|
-
let n = i.current, o =
|
|
3804
|
-
if (!
|
|
3805
|
-
let o = `toast-${++
|
|
3624
|
+
return k(() => {
|
|
3625
|
+
let n = i.current, o = T((i) => {
|
|
3626
|
+
if (!C()) return;
|
|
3627
|
+
let o = `toast-${++Xr}`, s = {
|
|
3806
3628
|
id: o,
|
|
3807
3629
|
level: i.level === u.ERROR ? "error" : "warn",
|
|
3808
3630
|
message: i.message,
|
|
@@ -3830,9 +3652,9 @@ function $r(e = 5, t = 5e3) {
|
|
|
3830
3652
|
}
|
|
3831
3653
|
//#endregion
|
|
3832
3654
|
//#region src/hooks/use-ikon-reactive.ts
|
|
3833
|
-
function
|
|
3834
|
-
let [r, i] =
|
|
3835
|
-
return
|
|
3655
|
+
function Qr(e, t, n) {
|
|
3656
|
+
let [r, i] = M(n);
|
|
3657
|
+
return k(() => {
|
|
3836
3658
|
if (!e) return;
|
|
3837
3659
|
let n = !0, r = null;
|
|
3838
3660
|
return e.reactiveRegistry.subscribe(t, (e) => {
|
|
@@ -3848,9 +3670,9 @@ function ei(e, t, n) {
|
|
|
3848
3670
|
}
|
|
3849
3671
|
//#endregion
|
|
3850
3672
|
//#region src/hooks/use-reactive.ts
|
|
3851
|
-
function
|
|
3852
|
-
let [r, i] =
|
|
3853
|
-
return
|
|
3673
|
+
function $r(e, t, n) {
|
|
3674
|
+
let [r, i] = M(null);
|
|
3675
|
+
return k(() => {
|
|
3854
3676
|
if (!e) return;
|
|
3855
3677
|
let n = !0;
|
|
3856
3678
|
return e.call("Ikon.Reactive.GetStableIdByName", [t]).then((e) => {
|
|
@@ -3860,56 +3682,56 @@ function ti(e, t, n) {
|
|
|
3860
3682
|
}), () => {
|
|
3861
3683
|
n = !1;
|
|
3862
3684
|
};
|
|
3863
|
-
}, [e, t]),
|
|
3685
|
+
}, [e, t]), Qr(r ? e : null, r ?? "", n);
|
|
3864
3686
|
}
|
|
3865
3687
|
//#endregion
|
|
3866
3688
|
//#region src/app/use-ikon-debug.ts
|
|
3867
|
-
var
|
|
3689
|
+
var ei = _("IkonDebug"), ti = {
|
|
3868
3690
|
Digit1: "connecting",
|
|
3869
3691
|
Digit2: "connected",
|
|
3870
3692
|
Digit3: "reconnecting",
|
|
3871
3693
|
Digit4: "offline",
|
|
3872
3694
|
Digit5: "offline",
|
|
3873
3695
|
Digit0: "clear"
|
|
3874
|
-
},
|
|
3875
|
-
function
|
|
3876
|
-
let t =
|
|
3877
|
-
return
|
|
3696
|
+
}, ni = "Digit5", ri = "Digit6", ii = "Synthetic debug error (Ctrl+Shift+5)", ai = "Synthetic debug access-denied (Ctrl+Shift+6)", oi = 5e3;
|
|
3697
|
+
function si(e) {
|
|
3698
|
+
let t = C(), [n, r] = M(null), [i, a] = M(!1), [o, s] = M(null), [c, l] = M(null), [u, d] = M(!1), [f, p] = M(!1), [m, h] = M(!1);
|
|
3699
|
+
return k(() => {
|
|
3878
3700
|
if (!t) return;
|
|
3879
3701
|
let e = (e) => {
|
|
3880
3702
|
if (!e.ctrlKey || !e.shiftKey) return;
|
|
3881
3703
|
if (e.code === "KeyE") {
|
|
3882
|
-
e.preventDefault(), d((e) => (
|
|
3704
|
+
e.preventDefault(), d((e) => (ei.warn(`Empty-stores override: ${e ? "off" : "on"}`), !e));
|
|
3883
3705
|
return;
|
|
3884
3706
|
}
|
|
3885
3707
|
if (e.code === "Digit7") {
|
|
3886
|
-
e.preventDefault(), p((e) => (
|
|
3708
|
+
e.preventDefault(), p((e) => (ei.warn(`Branding-banner override: ${e ? "off" : "on"}`), !e));
|
|
3887
3709
|
return;
|
|
3888
3710
|
}
|
|
3889
3711
|
if (e.code === "Digit8") {
|
|
3890
|
-
e.preventDefault(), h((e) => (
|
|
3712
|
+
e.preventDefault(), h((e) => (ei.warn(`Debug-overlay override: ${e ? "off" : "on"}`), !e));
|
|
3891
3713
|
return;
|
|
3892
3714
|
}
|
|
3893
|
-
if (e.code ===
|
|
3894
|
-
e.preventDefault(), l(
|
|
3715
|
+
if (e.code === ri) {
|
|
3716
|
+
e.preventDefault(), l(ai), r(null), s(null), ei.warn("Forced access denied");
|
|
3895
3717
|
return;
|
|
3896
3718
|
}
|
|
3897
|
-
let t =
|
|
3719
|
+
let t = ti[e.code];
|
|
3898
3720
|
if (t === void 0) return;
|
|
3899
3721
|
if (e.preventDefault(), t === "clear") {
|
|
3900
|
-
r(null), s(null), l(null),
|
|
3722
|
+
r(null), s(null), l(null), ei.warn("Cleared forced state");
|
|
3901
3723
|
return;
|
|
3902
3724
|
}
|
|
3903
|
-
let n = e.code ===
|
|
3904
|
-
r(t), s(n ?
|
|
3725
|
+
let n = e.code === ni;
|
|
3726
|
+
r(t), s(n ? ii : null), l(null), ei.warn(`Forced state: ${t}${n ? " (with error)" : ""}`);
|
|
3905
3727
|
};
|
|
3906
3728
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
3907
|
-
}, [t]),
|
|
3729
|
+
}, [t]), k(() => {
|
|
3908
3730
|
if (n !== "connecting") {
|
|
3909
3731
|
a(!1);
|
|
3910
3732
|
return;
|
|
3911
3733
|
}
|
|
3912
|
-
let e = setTimeout(() => a(!0),
|
|
3734
|
+
let e = setTimeout(() => a(!0), oi);
|
|
3913
3735
|
return () => clearTimeout(e);
|
|
3914
3736
|
}, [n]), !t || n === null && !u && c === null && !f && !m ? {
|
|
3915
3737
|
app: e,
|
|
@@ -3940,64 +3762,64 @@ function li(e) {
|
|
|
3940
3762
|
}
|
|
3941
3763
|
//#endregion
|
|
3942
3764
|
//#region src/app/ikon-app.tsx
|
|
3943
|
-
function
|
|
3765
|
+
function ci(e, t) {
|
|
3944
3766
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
3945
3767
|
}
|
|
3946
|
-
function
|
|
3768
|
+
function li(e) {
|
|
3947
3769
|
return e === void 0 ? null : typeof e == "function" ? e() : e;
|
|
3948
3770
|
}
|
|
3949
|
-
function
|
|
3771
|
+
function ui(e, t) {
|
|
3950
3772
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
3951
3773
|
}
|
|
3952
|
-
function
|
|
3774
|
+
function di(e, t) {
|
|
3953
3775
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
3954
3776
|
}
|
|
3955
|
-
function
|
|
3956
|
-
let { connectingOverlay: t, reconnectingOverlay: n, offlineOverlay: r, accessDeniedScreen: i, ...a } = e, o =
|
|
3777
|
+
function fi(e) {
|
|
3778
|
+
let { connectingOverlay: t, reconnectingOverlay: n, offlineOverlay: r, accessDeniedScreen: i, ...a } = e, o = si(a), { app: s } = o, { connectionState: c, isConnectingSlow: l, stores: u, registry: d, client: f, onAction: p, isReady: m, error: h, accessDeniedReason: g, brandingRequired: _ } = s, v = _ || o.forcedBranding, y = j(null);
|
|
3957
3779
|
u && d && (m || u.size > 0) && (y.current = {
|
|
3958
3780
|
stores: u,
|
|
3959
3781
|
registry: d,
|
|
3960
3782
|
client: f
|
|
3961
3783
|
});
|
|
3962
|
-
let
|
|
3963
|
-
if (
|
|
3964
|
-
!
|
|
3965
|
-
}, [
|
|
3966
|
-
let
|
|
3784
|
+
let ee = y.current != null || !!g;
|
|
3785
|
+
if (ue(() => {
|
|
3786
|
+
!ee || typeof document > "u" || document.querySelectorAll("[data-ikon-prerender]").forEach((e) => e.remove());
|
|
3787
|
+
}, [ee]), g) return di(i, g);
|
|
3788
|
+
let b = y.current, x;
|
|
3967
3789
|
switch (c) {
|
|
3968
3790
|
case "waitingForExternalConnectUrl":
|
|
3969
3791
|
case "connecting":
|
|
3970
|
-
|
|
3792
|
+
x = ci(t, l);
|
|
3971
3793
|
break;
|
|
3972
3794
|
case "reconnecting":
|
|
3973
|
-
|
|
3795
|
+
x = li(n);
|
|
3974
3796
|
break;
|
|
3975
3797
|
case "offline":
|
|
3976
|
-
|
|
3798
|
+
x = ui(r, h);
|
|
3977
3799
|
break;
|
|
3978
|
-
default:
|
|
3800
|
+
default: x = null;
|
|
3979
3801
|
}
|
|
3980
|
-
return /* @__PURE__ */ (
|
|
3981
|
-
|
|
3982
|
-
stores:
|
|
3983
|
-
registry:
|
|
3984
|
-
client:
|
|
3802
|
+
return /* @__PURE__ */ I(P, { children: [
|
|
3803
|
+
b && /* @__PURE__ */ F(z, {
|
|
3804
|
+
stores: b.stores,
|
|
3805
|
+
registry: b.registry,
|
|
3806
|
+
client: b.client,
|
|
3985
3807
|
onAction: p
|
|
3986
3808
|
}),
|
|
3987
|
-
|
|
3988
|
-
v && /* @__PURE__ */ (
|
|
3989
|
-
/* @__PURE__ */ (
|
|
3990
|
-
/* @__PURE__ */ (
|
|
3809
|
+
x,
|
|
3810
|
+
v && /* @__PURE__ */ F(mi, {}),
|
|
3811
|
+
/* @__PURE__ */ F(hi, {}),
|
|
3812
|
+
/* @__PURE__ */ F(Hr, {
|
|
3991
3813
|
state: c,
|
|
3992
3814
|
forceVisible: o.forcedDebugOverlay
|
|
3993
3815
|
})
|
|
3994
3816
|
] });
|
|
3995
3817
|
}
|
|
3996
|
-
var
|
|
3997
|
-
function
|
|
3998
|
-
return /* @__PURE__ */ (
|
|
3818
|
+
var pi = "https://ikonai.com";
|
|
3819
|
+
function mi() {
|
|
3820
|
+
return /* @__PURE__ */ I("a", {
|
|
3999
3821
|
className: "ikon-branding-banner",
|
|
4000
|
-
href:
|
|
3822
|
+
href: pi,
|
|
4001
3823
|
target: "_blank",
|
|
4002
3824
|
rel: "noopener noreferrer",
|
|
4003
3825
|
style: {
|
|
@@ -4018,43 +3840,43 @@ function gi() {
|
|
|
4018
3840
|
boxShadow: "0 -1px 8px rgba(0, 0, 0, 0.25)",
|
|
4019
3841
|
pointerEvents: "auto"
|
|
4020
3842
|
},
|
|
4021
|
-
children: [/* @__PURE__ */ (
|
|
3843
|
+
children: [/* @__PURE__ */ F("span", {
|
|
4022
3844
|
style: { opacity: .75 },
|
|
4023
3845
|
children: "Powered by"
|
|
4024
|
-
}), /* @__PURE__ */ (
|
|
3846
|
+
}), /* @__PURE__ */ F("span", {
|
|
4025
3847
|
style: { fontWeight: 700 },
|
|
4026
3848
|
children: "Ikon"
|
|
4027
3849
|
})]
|
|
4028
3850
|
});
|
|
4029
3851
|
}
|
|
4030
|
-
function
|
|
4031
|
-
let { toasts: e, dismissToast: t } =
|
|
4032
|
-
return e.length === 0 ? null : /* @__PURE__ */ (
|
|
3852
|
+
function hi() {
|
|
3853
|
+
let { toasts: e, dismissToast: t } = Zr();
|
|
3854
|
+
return e.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
4033
3855
|
className: "ikon-toast-overlay",
|
|
4034
|
-
children: e.map((e) => /* @__PURE__ */ (
|
|
3856
|
+
children: e.map((e) => /* @__PURE__ */ F(gi, {
|
|
4035
3857
|
toast: e,
|
|
4036
3858
|
onDismiss: t
|
|
4037
3859
|
}, e.id))
|
|
4038
3860
|
});
|
|
4039
3861
|
}
|
|
4040
|
-
function
|
|
4041
|
-
return /* @__PURE__ */ (
|
|
3862
|
+
function gi({ toast: e, onDismiss: t }) {
|
|
3863
|
+
return /* @__PURE__ */ I("div", {
|
|
4042
3864
|
className: `ikon-toast-overlay-chip ikon-toast-overlay-chip--${e.level}`,
|
|
4043
3865
|
onClick: () => t(e.id),
|
|
4044
3866
|
role: "alert",
|
|
4045
|
-
children: [/* @__PURE__ */ (
|
|
3867
|
+
children: [/* @__PURE__ */ F("span", {
|
|
4046
3868
|
className: "ikon-toast-overlay-icon",
|
|
4047
3869
|
children: e.level === "error" ? "🚨" : "⚠️"
|
|
4048
|
-
}), /* @__PURE__ */ (
|
|
3870
|
+
}), /* @__PURE__ */ I("div", {
|
|
4049
3871
|
className: "ikon-toast-overlay-content",
|
|
4050
|
-
children: [/* @__PURE__ */ (
|
|
3872
|
+
children: [/* @__PURE__ */ I("span", {
|
|
4051
3873
|
className: "ikon-toast-overlay-component",
|
|
4052
3874
|
children: [
|
|
4053
3875
|
"[",
|
|
4054
3876
|
e.component,
|
|
4055
3877
|
"]"
|
|
4056
3878
|
]
|
|
4057
|
-
}), /* @__PURE__ */ (
|
|
3879
|
+
}), /* @__PURE__ */ F("span", {
|
|
4058
3880
|
className: "ikon-toast-overlay-message",
|
|
4059
3881
|
children: e.message
|
|
4060
3882
|
})]
|
|
@@ -4063,37 +3885,37 @@ function vi({ toast: e, onDismiss: t }) {
|
|
|
4063
3885
|
}
|
|
4064
3886
|
//#endregion
|
|
4065
3887
|
//#region src/i18n/i18n.tsx
|
|
4066
|
-
var
|
|
4067
|
-
function
|
|
3888
|
+
var _i = E(null);
|
|
3889
|
+
function vi(e, t) {
|
|
4068
3890
|
return t ? e.replace(/\{(\w+)\}/g, (e, n) => t[n] ?? `{${n}}`) : e;
|
|
4069
3891
|
}
|
|
4070
|
-
function
|
|
4071
|
-
let n =
|
|
3892
|
+
function yi(e, t) {
|
|
3893
|
+
let n = x();
|
|
4072
3894
|
if (n && e.includes(n)) return n;
|
|
4073
3895
|
let r = navigator.language.split("-")[0];
|
|
4074
3896
|
return e.includes(r) ? r : t && e.includes(t) ? t : "en";
|
|
4075
3897
|
}
|
|
4076
|
-
function
|
|
4077
|
-
return t ?
|
|
3898
|
+
function bi(e, t, n) {
|
|
3899
|
+
return t ? yi(e, n) : n && e.includes(n) ? n : "en";
|
|
4078
3900
|
}
|
|
4079
|
-
function
|
|
4080
|
-
let i =
|
|
3901
|
+
function xi({ children: e, translations: t, defaultLanguage: n, detectLanguage: r = !1 }) {
|
|
3902
|
+
let i = bi(Object.keys(t), r, n), a = t[i] ?? t.en, o = A(() => ({
|
|
4081
3903
|
t: (e, t) => {
|
|
4082
3904
|
let n = a[e];
|
|
4083
|
-
return
|
|
3905
|
+
return vi(n, t);
|
|
4084
3906
|
},
|
|
4085
3907
|
locale: i,
|
|
4086
3908
|
translations: a
|
|
4087
3909
|
}), [a, i]);
|
|
4088
|
-
return /* @__PURE__ */ (
|
|
3910
|
+
return /* @__PURE__ */ F(_i, {
|
|
4089
3911
|
value: o,
|
|
4090
3912
|
children: e
|
|
4091
3913
|
});
|
|
4092
3914
|
}
|
|
4093
|
-
function
|
|
4094
|
-
let e =
|
|
3915
|
+
function Si() {
|
|
3916
|
+
let e = le(_i);
|
|
4095
3917
|
if (!e) throw Error("useI18n must be used within an I18nProvider");
|
|
4096
3918
|
return e;
|
|
4097
3919
|
}
|
|
4098
3920
|
//#endregion
|
|
4099
|
-
export {
|
|
3921
|
+
export { Or as AuthProvider, Ur as ConnectionStateRenderer, Mr as DEBUG_OVERLAY_ENABLED, Hr as DebugOverlay, xi as I18nProvider, Ze as IKON_UI_BASE_MODULE, vt as IKON_UI_MEDIA_MODULE, It as IKON_UI_SHADERTOY_MODULE, Pt as IKON_UI_SHADERTOY_TYPE, Ae as IKON_UI_STREAM_CATEGORY, ft as IKON_UI_VIDEO_CANVAS_TYPE, pt as IKON_UI_VIDEO_URL_PLAYER_TYPE, fi as IkonApp, Me as IkonUi, Bt as IkonUiRegistry, z as IkonUiSurface, Oe as InspectOverlay, Gt as ParallaxView, Te as UiComponentRegistry, we as UiRenderer, n as UiStreamStore, tr as authenticateAnonymous, sr as buildOAuthRedirectUrl, Yn as clearAuthSession, or as clearOAuthParams, Xe as createBaseResolvers, Ee as createComponentLibrary, Vt as createIkonUiRegistry, ht as createMediaResolvers, Ft as createShadertoyRendererResolver, je as isIkonUiCategoryMatch, qn as loadAuthSession, Qe as loadBaseModule, yt as loadMediaModule, Lt as loadShadertoyModule, ir as parseOAuthCallback, ar as parseOAuthError, w as randomUuid, $e as registerBaseModule, bt as registerMediaModule, Rt as registerShadertoyModule, Se as renderChildren, un as renderMotionLetters, Y as saveAuthSession, nr as sendLoginCode, X as sessionToUser, kr as useAuth, jr as useAuthGuard, Ar as useAuthOptional, Si as useI18n, Jr as useIkonApp, si as useIkonDebug, Qr as useIkonReactive, tn as useIkonStyles, rn as useIkonUiStores, Yr as useLazyFont, $r as useReactive, Zr as useToasts, L as useUiNode, De as useUiStore, rr as verifyLoginCode };
|