@ikonai/sdk-react-ui 1.0.43 → 1.0.45

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 CHANGED
@@ -1,8 +1,8 @@
1
- import { IkonUiCore as jt, UiStreamStore as Ut } from "@ikonai/sdk-ui";
2
- import { UiStreamStore as Jo } from "@ikonai/sdk-ui";
3
- import Dt, { useSyncExternalStore as Ke, useMemo as K, memo as z, useRef as v, useCallback as D, Fragment as Bt, useEffect as N, useState as Y, createContext as yt, use as Ye } from "react";
4
- import { createLogger as ke, isInspectModeEnabled as Ft, getOrCreateDeviceId as $t, deriveAuthUrl as xe, parseUrlParams as Vt, clearSessionParamsFromUrl as Kt, isCloudEnvironment as Je, extractUserIdFromToken as Yt, deriveBackendType as Xe, IkonClient as zt, AccessDeniedError as Wt, AuthenticationError as qt, subscribeToLogEvents as Ht, isDebugModeEnabled as Gt, LogLevel as Ze, getLangParam as Jt } from "@ikonai/sdk";
5
- var ge = { exports: {} }, ae = {};
1
+ import { IkonUiCore as jt, UiStreamStore as Dt } from "@ikonai/sdk-ui";
2
+ import { UiStreamStore as Qo } from "@ikonai/sdk-ui";
3
+ import Bt, { useSyncExternalStore as Ve, useMemo as $, memo as z, useRef as v, useCallback as U, Fragment as Ft, useEffect as P, useState as q, use as Ke, createContext as gt } from "react";
4
+ import { createLogger as fe, isInspectModeEnabled as $t, getOrCreateDeviceId as Vt, deriveAuthUrl as de, parseUrlParams as Kt, clearSessionParamsFromUrl as zt, isCloudEnvironment as Ge, extractUserIdFromToken as Yt, deriveBackendType as Je, IkonClient as Wt, AccessDeniedError as qt, AuthenticationError as Ht, subscribeToLogEvents as Gt, isDebugModeEnabled as Jt, LogLevel as Xe, getLangParam as Xt } from "@ikonai/sdk";
5
+ var Se = { exports: {} }, ie = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
@@ -12,12 +12,12 @@ var ge = { exports: {} }, ae = {};
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
14
  */
15
- var Qe;
16
- function Xt() {
17
- if (Qe) return ae;
18
- Qe = 1;
15
+ var Ze;
16
+ function Zt() {
17
+ if (Ze) return ie;
18
+ Ze = 1;
19
19
  var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
20
- function n(r, o, s) {
20
+ function r(n, o, s) {
21
21
  var i = null;
22
22
  if (s !== void 0 && (i = "" + s), o.key !== void 0 && (i = "" + o.key), "key" in o) {
23
23
  s = {};
@@ -26,15 +26,15 @@ function Xt() {
26
26
  } else s = o;
27
27
  return o = s.ref, {
28
28
  $$typeof: t,
29
- type: r,
29
+ type: n,
30
30
  key: i,
31
31
  ref: o !== void 0 ? o : null,
32
32
  props: s
33
33
  };
34
34
  }
35
- return ae.Fragment = e, ae.jsx = n, ae.jsxs = n, ae;
35
+ return ie.Fragment = e, ie.jsx = r, ie.jsxs = r, ie;
36
36
  }
37
- var ce = {};
37
+ var ae = {};
38
38
  /**
39
39
  * @license React
40
40
  * react-jsx-runtime.development.js
@@ -44,274 +44,272 @@ var ce = {};
44
44
  * This source code is licensed under the MIT license found in the
45
45
  * LICENSE file in the root directory of this source tree.
46
46
  */
47
- var et;
48
- function Zt() {
49
- return et || (et = 1, process.env.NODE_ENV !== "production" && function() {
50
- function t(h) {
51
- if (h == null) return null;
52
- if (typeof h == "function")
53
- return h.$$typeof === U ? null : h.displayName || h.name || null;
54
- if (typeof h == "string") return h;
55
- switch (h) {
56
- case b:
47
+ var Qe;
48
+ function Qt() {
49
+ return Qe || (Qe = 1, process.env.NODE_ENV !== "production" && (function() {
50
+ function t(d) {
51
+ if (d == null) return null;
52
+ if (typeof d == "function")
53
+ return d.$$typeof === j ? null : d.displayName || d.name || null;
54
+ if (typeof d == "string") return d;
55
+ switch (d) {
56
+ case g:
57
57
  return "Fragment";
58
- case y:
58
+ case S:
59
59
  return "Profiler";
60
- case g:
60
+ case b:
61
61
  return "StrictMode";
62
- case _:
62
+ case L:
63
63
  return "Suspense";
64
- case B:
64
+ case G:
65
65
  return "SuspenseList";
66
- case P:
66
+ case D:
67
67
  return "Activity";
68
68
  }
69
- if (typeof h == "object")
70
- switch (typeof h.tag == "number" && console.error(
69
+ if (typeof d == "object")
70
+ switch (typeof d.tag == "number" && console.error(
71
71
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
- ), h.$$typeof) {
72
+ ), d.$$typeof) {
73
73
  case m:
74
74
  return "Portal";
75
+ case _:
76
+ return d.displayName || "Context";
77
+ case O:
78
+ return (d._context.displayName || "Context") + ".Consumer";
79
+ case M:
80
+ var w = d.render;
81
+ return d = d.displayName, d || (d = w.displayName || w.name || "", d = d !== "" ? "ForwardRef(" + d + ")" : "ForwardRef"), d;
75
82
  case T:
76
- return (h.displayName || "Context") + ".Provider";
77
- case w:
78
- return (h._context.displayName || "Context") + ".Consumer";
79
- case C:
80
- var S = h.render;
81
- return h = h.displayName, h || (h = S.displayName || S.name || "", h = h !== "" ? "ForwardRef(" + h + ")" : "ForwardRef"), h;
82
- case Q:
83
- return S = h.displayName || null, S !== null ? S : t(h.type) || "Memo";
84
- case A:
85
- S = h._payload, h = h._init;
83
+ return w = d.displayName || null, w !== null ? w : t(d.type) || "Memo";
84
+ case N:
85
+ w = d._payload, d = d._init;
86
86
  try {
87
- return t(h(S));
87
+ return t(d(w));
88
88
  } catch {
89
89
  }
90
90
  }
91
91
  return null;
92
92
  }
93
- function e(h) {
94
- return "" + h;
93
+ function e(d) {
94
+ return "" + d;
95
95
  }
96
- function n(h) {
96
+ function r(d) {
97
97
  try {
98
- e(h);
99
- var S = !1;
98
+ e(d);
99
+ var w = !1;
100
100
  } catch {
101
- S = !0;
101
+ w = !0;
102
102
  }
103
- if (S) {
104
- S = console;
105
- var k = S.error, L = typeof Symbol == "function" && Symbol.toStringTag && h[Symbol.toStringTag] || h.constructor.name || "Object";
106
- return k.call(
107
- S,
103
+ if (w) {
104
+ w = console;
105
+ var A = w.error, E = typeof Symbol == "function" && Symbol.toStringTag && d[Symbol.toStringTag] || d.constructor.name || "Object";
106
+ return A.call(
107
+ w,
108
108
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
- L
110
- ), e(h);
109
+ E
110
+ ), e(d);
111
111
  }
112
112
  }
113
- function r(h) {
114
- if (h === b) return "<>";
115
- if (typeof h == "object" && h !== null && h.$$typeof === A)
113
+ function n(d) {
114
+ if (d === g) return "<>";
115
+ if (typeof d == "object" && d !== null && d.$$typeof === N)
116
116
  return "<...>";
117
117
  try {
118
- var S = t(h);
119
- return S ? "<" + S + ">" : "<...>";
118
+ var w = t(d);
119
+ return w ? "<" + w + ">" : "<...>";
120
120
  } catch {
121
121
  return "<...>";
122
122
  }
123
123
  }
124
124
  function o() {
125
- var h = M.A;
126
- return h === null ? null : h.getOwner();
125
+ var d = B.A;
126
+ return d === null ? null : d.getOwner();
127
127
  }
128
128
  function s() {
129
129
  return Error("react-stack-top-frame");
130
130
  }
131
- function i(h) {
132
- if (F.call(h, "key")) {
133
- var S = Object.getOwnPropertyDescriptor(h, "key").get;
134
- if (S && S.isReactWarning) return !1;
131
+ function i(d) {
132
+ if (V.call(d, "key")) {
133
+ var w = Object.getOwnPropertyDescriptor(d, "key").get;
134
+ if (w && w.isReactWarning) return !1;
135
135
  }
136
- return h.key !== void 0;
136
+ return d.key !== void 0;
137
137
  }
138
- function a(h, S) {
139
- function k() {
140
- pe || (pe = !0, console.error(
138
+ function a(d, w) {
139
+ function A() {
140
+ me || (me = !0, console.error(
141
141
  "%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)",
142
- S
142
+ w
143
143
  ));
144
144
  }
145
- k.isReactWarning = !0, Object.defineProperty(h, "key", {
146
- get: k,
145
+ A.isReactWarning = !0, Object.defineProperty(d, "key", {
146
+ get: A,
147
147
  configurable: !0
148
148
  });
149
149
  }
150
- function c() {
151
- var h = t(this.type);
152
- return he[h] || (he[h] = !0, console.error(
150
+ function u() {
151
+ var d = t(this.type);
152
+ return oe[d] || (oe[d] = !0, console.error(
153
153
  "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."
154
- )), h = this.props.ref, h !== void 0 ? h : null;
154
+ )), d = this.props.ref, d !== void 0 ? d : null;
155
155
  }
156
- function p(h, S, k, L, q, I, H, te) {
157
- return k = I.ref, h = {
158
- $$typeof: d,
159
- type: h,
160
- key: S,
161
- props: I,
162
- _owner: q
163
- }, (k !== void 0 ? k : null) !== null ? Object.defineProperty(h, "ref", {
156
+ function f(d, w, A, E, K, Z) {
157
+ var C = A.ref;
158
+ return d = {
159
+ $$typeof: l,
160
+ type: d,
161
+ key: w,
162
+ props: A,
163
+ _owner: E
164
+ }, (C !== void 0 ? C : null) !== null ? Object.defineProperty(d, "ref", {
164
165
  enumerable: !1,
165
- get: c
166
- }) : Object.defineProperty(h, "ref", { enumerable: !1, value: null }), h._store = {}, Object.defineProperty(h._store, "validated", {
166
+ get: u
167
+ }) : Object.defineProperty(d, "ref", { enumerable: !1, value: null }), d._store = {}, Object.defineProperty(d._store, "validated", {
167
168
  configurable: !1,
168
169
  enumerable: !1,
169
170
  writable: !0,
170
171
  value: 0
171
- }), Object.defineProperty(h, "_debugInfo", {
172
+ }), Object.defineProperty(d, "_debugInfo", {
172
173
  configurable: !1,
173
174
  enumerable: !1,
174
175
  writable: !0,
175
176
  value: null
176
- }), Object.defineProperty(h, "_debugStack", {
177
+ }), Object.defineProperty(d, "_debugStack", {
177
178
  configurable: !1,
178
179
  enumerable: !1,
179
180
  writable: !0,
180
- value: H
181
- }), Object.defineProperty(h, "_debugTask", {
181
+ value: K
182
+ }), Object.defineProperty(d, "_debugTask", {
182
183
  configurable: !1,
183
184
  enumerable: !1,
184
185
  writable: !0,
185
- value: te
186
- }), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
186
+ value: Z
187
+ }), Object.freeze && (Object.freeze(d.props), Object.freeze(d)), d;
187
188
  }
188
- function f(h, S, k, L, q, I, H, te) {
189
- var O = S.children;
190
- if (O !== void 0)
191
- if (L)
192
- if (W(O)) {
193
- for (L = 0; L < O.length; L++)
194
- l(O[L]);
195
- Object.freeze && Object.freeze(O);
189
+ function h(d, w, A, E, K, Z) {
190
+ var C = w.children;
191
+ if (C !== void 0)
192
+ if (E)
193
+ if (he(C)) {
194
+ for (E = 0; E < C.length; E++)
195
+ p(C[E]);
196
+ Object.freeze && Object.freeze(C);
196
197
  } else
197
198
  console.error(
198
199
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
199
200
  );
200
- else l(O);
201
- if (F.call(S, "key")) {
202
- O = t(h);
203
- var G = Object.keys(S).filter(function(Ce) {
204
- return Ce !== "key";
201
+ else p(C);
202
+ if (V.call(w, "key")) {
203
+ C = t(d);
204
+ var Y = Object.keys(w).filter(function(se) {
205
+ return se !== "key";
205
206
  });
206
- L = 0 < G.length ? "{key: someKey, " + G.join(": ..., ") + ": ...}" : "{key: someKey}", ee[O + L] || (G = 0 < G.length ? "{" + G.join(": ..., ") + ": ...}" : "{}", console.error(
207
+ E = 0 < Y.length ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}", ye[C + E] || (Y = 0 < Y.length ? "{" + Y.join(": ..., ") + ": ...}" : "{}", console.error(
207
208
  `A props object containing a "key" prop is being spread into JSX:
208
209
  let props = %s;
209
210
  <%s {...props} />
210
211
  React keys must be passed directly to JSX without using spread:
211
212
  let props = %s;
212
213
  <%s key={someKey} {...props} />`,
213
- L,
214
- O,
215
- G,
216
- O
217
- ), ee[O + L] = !0);
214
+ E,
215
+ C,
216
+ Y,
217
+ C
218
+ ), ye[C + E] = !0);
218
219
  }
219
- if (O = null, k !== void 0 && (n(k), O = "" + k), i(S) && (n(S.key), O = "" + S.key), "key" in S) {
220
- k = {};
221
- for (var ne in S)
222
- ne !== "key" && (k[ne] = S[ne]);
223
- } else k = S;
224
- return O && a(
225
- k,
226
- typeof h == "function" ? h.displayName || h.name || "Unknown" : h
227
- ), p(
228
- h,
229
- O,
230
- I,
231
- q,
220
+ if (C = null, A !== void 0 && (r(A), C = "" + A), i(w) && (r(w.key), C = "" + w.key), "key" in w) {
221
+ A = {};
222
+ for (var be in w)
223
+ be !== "key" && (A[be] = w[be]);
224
+ } else A = w;
225
+ return C && a(
226
+ A,
227
+ typeof d == "function" ? d.displayName || d.name || "Unknown" : d
228
+ ), f(
229
+ d,
230
+ C,
231
+ A,
232
232
  o(),
233
- k,
234
- H,
235
- te
233
+ K,
234
+ Z
236
235
  );
237
236
  }
238
- function l(h) {
239
- typeof h == "object" && h !== null && h.$$typeof === d && h._store && (h._store.validated = 1);
237
+ function p(d) {
238
+ y(d) ? d._store && (d._store.validated = 1) : typeof d == "object" && d !== null && d.$$typeof === N && (d._payload.status === "fulfilled" ? y(d._payload.value) && d._payload.value._store && (d._payload.value._store.validated = 1) : d._store && (d._store.validated = 1));
239
+ }
240
+ function y(d) {
241
+ return typeof d == "object" && d !== null && d.$$typeof === l;
240
242
  }
241
- var u = Dt, d = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), T = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), Q = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), P = Symbol.for("react.activity"), U = Symbol.for("react.client.reference"), M = u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, F = Object.prototype.hasOwnProperty, W = Array.isArray, re = console.createTask ? console.createTask : function() {
243
+ var c = Bt, l = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), O = Symbol.for("react.consumer"), _ = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), L = Symbol.for("react.suspense"), G = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), D = Symbol.for("react.activity"), j = Symbol.for("react.client.reference"), B = c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, he = Array.isArray, ne = console.createTask ? console.createTask : function() {
242
244
  return null;
243
245
  };
244
- u = {
245
- "react-stack-bottom-frame": function(h) {
246
- return h();
246
+ c = {
247
+ react_stack_bottom_frame: function(d) {
248
+ return d();
247
249
  }
248
250
  };
249
- var pe, he = {}, ie = u["react-stack-bottom-frame"].bind(
250
- u,
251
+ var me, oe = {}, ge = c.react_stack_bottom_frame.bind(
252
+ c,
251
253
  s
252
- )(), me = re(r(s)), ee = {};
253
- ce.Fragment = b, ce.jsx = function(h, S, k, L, q) {
254
- var I = 1e4 > M.recentlyCreatedOwnerStacks++;
255
- return f(
256
- h,
257
- S,
258
- k,
254
+ )(), X = ne(n(s)), ye = {};
255
+ ae.Fragment = g, ae.jsx = function(d, w, A) {
256
+ var E = 1e4 > B.recentlyCreatedOwnerStacks++;
257
+ return h(
258
+ d,
259
+ w,
260
+ A,
259
261
  !1,
260
- L,
261
- q,
262
- I ? Error("react-stack-top-frame") : ie,
263
- I ? re(r(h)) : me
262
+ E ? Error("react-stack-top-frame") : ge,
263
+ E ? ne(n(d)) : X
264
264
  );
265
- }, ce.jsxs = function(h, S, k, L, q) {
266
- var I = 1e4 > M.recentlyCreatedOwnerStacks++;
267
- return f(
268
- h,
269
- S,
270
- k,
265
+ }, ae.jsxs = function(d, w, A) {
266
+ var E = 1e4 > B.recentlyCreatedOwnerStacks++;
267
+ return h(
268
+ d,
269
+ w,
270
+ A,
271
271
  !0,
272
- L,
273
- q,
274
- I ? Error("react-stack-top-frame") : ie,
275
- I ? re(r(h)) : me
272
+ E ? Error("react-stack-top-frame") : ge,
273
+ E ? ne(n(d)) : X
276
274
  );
277
275
  };
278
- }()), ce;
276
+ })()), ae;
279
277
  }
280
- var tt;
281
- function Qt() {
282
- return tt || (tt = 1, process.env.NODE_ENV === "production" ? ge.exports = Xt() : ge.exports = Zt()), ge.exports;
278
+ var et;
279
+ function er() {
280
+ return et || (et = 1, process.env.NODE_ENV === "production" ? Se.exports = Zt() : Se.exports = Qt()), Se.exports;
283
281
  }
284
- var E = Qt();
285
- function en(t, e) {
286
- const n = Ke(
287
- (r) => t.subscribe(r),
282
+ var R = er();
283
+ function tr(t, e) {
284
+ const r = Ve(
285
+ (n) => t.subscribe(n),
288
286
  () => {
289
- const r = t.getSnapshot(), o = e ?? r.rootViewId, s = o ? r.views.get(o) : void 0;
287
+ const n = t.getSnapshot(), o = e ?? n.rootViewId, s = o ? n.views.get(o) : void 0;
290
288
  return `${o ?? ""}:${s?.id ?? ""}`;
291
289
  },
292
290
  () => {
293
- const r = t.getSnapshot(), o = e ?? r.rootViewId, s = o ? r.views.get(o) : void 0;
291
+ const n = t.getSnapshot(), o = e ?? n.rootViewId, s = o ? n.views.get(o) : void 0;
294
292
  return `${o ?? ""}:${s?.id ?? ""}`;
295
293
  }
296
294
  );
297
- return K(() => {
298
- const [r, o] = n.split(":");
295
+ return $(() => {
296
+ const [n, o] = r.split(":");
299
297
  return {
300
- rootViewId: r || void 0,
298
+ rootViewId: n || void 0,
301
299
  rootNodeId: o || void 0
302
300
  };
303
- }, [n]);
301
+ }, [r]);
304
302
  }
305
- function Z(t, e) {
306
- const n = Ke(
307
- (r) => t.subscribeNode(e, r),
303
+ function J(t, e) {
304
+ const r = Ve(
305
+ (n) => t.subscribeNode(e, n),
308
306
  () => t.getNodeVersion(e),
309
307
  () => t.getNodeVersion(e)
310
308
  );
311
- return K(() => t.getNode(e), [t, e, n]);
309
+ return $(() => t.getNode(e), [t, e, r]);
312
310
  }
313
- const tn = ke("UIRenderer");
314
- function nn(t) {
311
+ const rr = fe("UIRenderer");
312
+ function nr(t) {
315
313
  if (t === void 0)
316
314
  return "{}";
317
315
  if (typeof t == "string")
@@ -322,93 +320,93 @@ function nn(t) {
322
320
  return "{}";
323
321
  }
324
322
  }
325
- function rn(t) {
323
+ function or(t) {
326
324
  const e = t.styleIds;
327
325
  return Array.isArray(e) ? e : [];
328
326
  }
329
- function on(t) {
327
+ function sr(t) {
330
328
  const e = t.children;
331
329
  return Array.isArray(e) ? e : [];
332
330
  }
333
- function sn(t, e) {
331
+ function ir(t, e) {
334
332
  return t.nodeId === e.nodeId && t.context === e.context;
335
333
  }
336
- function an(t) {
334
+ function ar(t) {
337
335
  if (t.length === 0) return "";
338
336
  if (t.length === 1) return t[0].id;
339
337
  let e = t[0].id;
340
- for (let n = 1; n < t.length; n++)
341
- e += "," + t[n].id;
338
+ for (let r = 1; r < t.length; r++)
339
+ e += "," + t[r].id;
342
340
  return e;
343
341
  }
344
- const je = z(function t({ nodeId: e, context: n }) {
345
- const r = Z(n.store, e), o = r ? on(r) : [], s = an(o), i = K(
346
- () => o.length === 0 ? null : o.map((l) => /* @__PURE__ */ E.jsx(t, { nodeId: l.id, context: n }, l.id)),
342
+ const xe = z(function t({ nodeId: e, context: r }) {
343
+ const n = J(r.store, e), o = n ? sr(n) : [], s = ar(o), i = $(
344
+ () => o.length === 0 ? null : o.map((p) => /* @__PURE__ */ R.jsx(t, { nodeId: p.id, context: r }, p.id)),
347
345
  // eslint-disable-next-line react-hooks/exhaustive-deps
348
- [s, n]
346
+ [s, r]
349
347
  );
350
- if (!r)
348
+ if (!n)
351
349
  return null;
352
- if (r.type === "root")
353
- return /* @__PURE__ */ E.jsx(Bt, { children: i }, r.id);
354
- const a = n.library.resolve(r);
350
+ if (n.type === "root")
351
+ return /* @__PURE__ */ R.jsx(Ft, { children: i }, n.id);
352
+ const a = r.library.resolve(n);
355
353
  if (!a)
356
- return tn.warn(`No renderer for node type ${r.type}`), null;
357
- const c = rn(r), p = c.length > 0 ? c.join(" ") : void 0, f = a;
358
- return /* @__PURE__ */ E.jsx(f, { nodeId: e, context: n, className: p });
359
- }, sn);
360
- function cn(t, e) {
361
- return !Array.isArray(t) || t.length === 0 ? null : t.map((n) => /* @__PURE__ */ E.jsx(je, { nodeId: n.id, context: e }, n.id));
362
- }
363
- function un(t, e) {
354
+ return rr.warn(`No renderer for node type ${n.type}`), null;
355
+ const u = or(n), f = u.length > 0 ? u.join(" ") : void 0, h = a;
356
+ return /* @__PURE__ */ R.jsx(h, { nodeId: e, context: r, className: f });
357
+ }, ir);
358
+ function cr(t, e) {
359
+ return !Array.isArray(t) || t.length === 0 ? null : t.map((r) => /* @__PURE__ */ R.jsx(xe, { nodeId: r.id, context: e }, r.id));
360
+ }
361
+ function ur(t, e) {
364
362
  return t.store === e.store && t.library === e.library && t.viewId === e.viewId && t.emptyFallback === e.emptyFallback;
365
363
  }
366
- const ln = z(function({ store: e, library: n, viewId: r, emptyFallback: o = null, onAction: s, client: i, video: a }) {
367
- const { rootViewId: c, rootNodeId: p } = en(e, r), f = v(s);
368
- f.current = s;
369
- const l = v(i);
370
- l.current = i;
371
- const u = v(a);
372
- u.current = a;
373
- const d = D((b, g) => {
374
- if (!b)
364
+ const lr = z(function({ store: e, library: r, viewId: n, emptyFallback: o = null, onAction: s, client: i, video: a }) {
365
+ const { rootViewId: u, rootNodeId: f } = tr(e, n), h = v(s);
366
+ h.current = s;
367
+ const p = v(i);
368
+ p.current = i;
369
+ const y = v(a);
370
+ y.current = a;
371
+ const c = U((m, g) => {
372
+ if (!m)
375
373
  return;
376
- const y = nn(g);
377
- f.current?.(b, y);
378
- }, []), m = K(() => {
379
- const b = {
374
+ const b = nr(g);
375
+ h.current?.(m, b);
376
+ }, []), l = $(() => {
377
+ const m = {
380
378
  store: e,
381
- library: n,
379
+ library: r,
382
380
  handlerCache: e.handlerCache,
383
381
  // Access payloads from store at call time, not captured snapshot
384
382
  getPayload: (g) => e.getSnapshot().payloads.get(g),
385
- renderChildren: (g) => cn(g, b),
383
+ renderChildren: (g) => cr(g, m),
386
384
  renderView: (g) => {
387
- const y = e.getSnapshot().views.get(g);
388
- return y ? /* @__PURE__ */ E.jsx(je, { nodeId: y.id, context: b }) : null;
385
+ const b = e.getSnapshot().views.get(g);
386
+ return b ? /* @__PURE__ */ R.jsx(xe, { nodeId: b.id, context: m }) : null;
389
387
  },
390
- dispatchAction: d,
388
+ dispatchAction: c,
391
389
  // Access client/video via refs to avoid context recreation
392
390
  get client() {
393
- return l.current;
391
+ return p.current;
394
392
  },
395
393
  get video() {
396
- return u.current;
394
+ return y.current;
397
395
  }
398
396
  };
399
- return b;
400
- }, [e, n, d]);
401
- return !c || !p ? o : /* @__PURE__ */ E.jsx("div", { "data-ikon-view-id": c, style: { display: "contents" }, children: /* @__PURE__ */ E.jsx(je, { nodeId: p, context: m }) });
402
- }, un);
403
- class dn {
404
- constructor(e, n) {
405
- if (this.fallback = n, e)
406
- for (const [r, o] of e)
407
- this.renderers.set(r, o);
397
+ return m;
398
+ }, [e, r, c]);
399
+ return !u || !f ? o : /* @__PURE__ */ R.jsx("div", { "data-ikon-view-id": u, style: { display: "contents" }, children: /* @__PURE__ */ R.jsx(xe, { nodeId: f, context: l }) });
400
+ }, ur);
401
+ class dr {
402
+ constructor(e, r) {
403
+ if (this.fallback = r, e)
404
+ for (const [n, o] of e)
405
+ this.renderers.set(n, o);
408
406
  }
409
407
  renderers = /* @__PURE__ */ new Map();
410
- register(e, n) {
411
- this.renderers.set(e, n);
408
+ register(e, r) {
409
+ this.renderers.set(e, r);
412
410
  }
413
411
  setFallback(e) {
414
412
  this.fallback = e;
@@ -417,103 +415,114 @@ class dn {
417
415
  return this.renderers.get(e.type) ?? this.fallback;
418
416
  }
419
417
  }
420
- function Po(t, e) {
421
- const n = Object.entries(t);
422
- return new dn(n, e);
418
+ function Uo(t, e) {
419
+ const r = Object.entries(t);
420
+ return new dr(r, e);
423
421
  }
424
- function Mo(t) {
425
- return Ke(
422
+ function jo(t) {
423
+ return Ve(
426
424
  (e) => t.subscribe(e),
427
425
  () => t.getSnapshot(),
428
426
  () => t.getSnapshot()
429
427
  );
430
428
  }
431
- function fn() {
432
- const t = Ft();
433
- return N(() => {
429
+ function fr() {
430
+ const t = $t();
431
+ return P(() => {
434
432
  if (!t)
435
433
  return;
436
- let e = null, n = [];
437
- const r = document.createElement("div");
438
- r.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(r);
439
- function o() {
440
- e && !n.includes(e) && (e.style.outline = "", e.style.outlineOffset = ""), e = null, r.style.display = "none";
434
+ let e = window.parent === window, r = null, n = [];
435
+ const o = document.createElement("div");
436
+ o.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(o);
437
+ function s() {
438
+ r && !n.includes(r) && (r.style.outline = "", r.style.outlineOffset = ""), r = null, o.style.display = "none";
441
439
  }
442
- function s(u) {
440
+ function i(c) {
443
441
  for (const m of n)
444
- m !== e && (m.style.outline = "", m.style.outlineOffset = "");
442
+ m !== r && (m.style.outline = "", m.style.outlineOffset = "");
445
443
  n = [];
446
- const d = new Set(u);
444
+ const l = new Set(c);
447
445
  for (const m of document.querySelectorAll("[data-ikon-source]")) {
448
- const b = m.getAttribute("data-ikon-source") ?? "";
449
- d.has(b) && (m.style.outline = "2px solid #a6e3a1", m.style.outlineOffset = "1px", n.push(m));
446
+ const g = m.getAttribute("data-ikon-source") ?? "";
447
+ l.has(g) && (m.style.outline = "2px solid #a6e3a1", m.style.outlineOffset = "1px", n.push(m));
450
448
  }
451
449
  }
452
- function i(u) {
453
- const d = u.target.closest?.("[data-ikon-source]");
454
- if (!d || d === e)
450
+ function a(c) {
451
+ if (!e)
452
+ return;
453
+ const l = c.target.closest?.("[data-ikon-source]");
454
+ if (!l || l === r)
455
455
  return;
456
- o(), e = d, e.style.outline = "2px solid #89b4fa", e.style.outlineOffset = "1px";
457
- const m = d.getAttribute("data-ikon-source") ?? "";
458
- r.textContent = m, r.style.display = "block";
459
- const b = d.getBoundingClientRect();
460
- r.style.left = `${b.left}px`, r.style.top = `${Math.max(0, b.top - 24)}px`;
456
+ s(), r = l, r.style.outline = "2px solid #89b4fa", r.style.outlineOffset = "1px";
457
+ const m = l.getAttribute("data-ikon-source") ?? "";
458
+ o.textContent = m, o.style.display = "block";
459
+ const g = l.getBoundingClientRect();
460
+ o.style.left = `${g.left}px`, o.style.top = `${Math.max(0, g.top - 24)}px`;
461
461
  }
462
- function a(u) {
463
- u.relatedTarget?.closest?.("[data-ikon-source]") !== e && o();
462
+ function u(c) {
463
+ if (!e)
464
+ return;
465
+ c.relatedTarget?.closest?.("[data-ikon-source]") !== r && s();
464
466
  }
465
- function c(u) {
466
- const d = u.target.closest?.("[data-ikon-source]");
467
- if (!d)
467
+ function f(c) {
468
+ if (!e)
469
+ return;
470
+ const l = c.target.closest?.("[data-ikon-source]");
471
+ if (!l)
468
472
  return;
469
- u.preventDefault(), u.stopPropagation();
473
+ c.preventDefault(), c.stopPropagation();
470
474
  const m = {
471
- sourceMarker: d.getAttribute("data-ikon-source") ?? "",
472
- tagName: d.tagName.toLowerCase(),
473
- textContent: (d.textContent ?? "").trim().substring(0, 200)
475
+ sourceMarker: l.getAttribute("data-ikon-source") ?? "",
476
+ tagName: l.tagName.toLowerCase(),
477
+ textContent: (l.textContent ?? "").trim().substring(0, 200)
474
478
  };
475
479
  window.dispatchEvent(new CustomEvent("ikon-inspect-select", { detail: m })), window.parent.postMessage({ type: "ikon-element-selected", payload: m }, "*");
476
480
  }
477
- function p(u, d) {
478
- return document.elementFromPoint(u, d)?.closest?.("[data-ikon-source]");
481
+ function h(c, l) {
482
+ return document.elementFromPoint(c, l)?.closest?.("[data-ikon-source]");
479
483
  }
480
- function f(u) {
481
- if (u === e || (o(), !u))
484
+ function p(c) {
485
+ if (c === r || (s(), !c))
482
486
  return;
483
- e = u, e.style.outline = `2px solid ${n.includes(u) ? "#a6e3a1" : "#89b4fa"}`, e.style.outlineOffset = "1px";
484
- const d = u.getAttribute("data-ikon-source") ?? "";
485
- r.textContent = d, r.style.display = "block";
486
- const m = u.getBoundingClientRect();
487
- r.style.left = `${m.left}px`, r.style.top = `${Math.max(0, m.top - 24)}px`;
487
+ r = c, r.style.outline = `2px solid ${n.includes(c) ? "#a6e3a1" : "#89b4fa"}`, r.style.outlineOffset = "1px";
488
+ const l = c.getAttribute("data-ikon-source") ?? "";
489
+ o.textContent = l, o.style.display = "block";
490
+ const m = c.getBoundingClientRect();
491
+ o.style.left = `${m.left}px`, o.style.top = `${Math.max(0, m.top - 24)}px`;
488
492
  }
489
- function l(u) {
490
- if (u.data?.type === "ikon-inspect-at") {
491
- const d = p(u.data.x, u.data.y);
492
- f(d);
493
- const m = d?.getAttribute("data-ikon-source") ?? "";
493
+ function y(c) {
494
+ if (c.data?.type === "ikon-inspect-mode") {
495
+ const l = !!c.data.enabled;
496
+ !l && e && s(), e = l;
497
+ return;
498
+ }
499
+ if (c.data?.type === "ikon-inspect-at") {
500
+ const l = h(c.data.x, c.data.y);
501
+ p(l);
502
+ const m = l?.getAttribute("data-ikon-source") ?? "";
494
503
  window.parent.postMessage({
495
504
  type: "ikon-inspect-hover-result",
496
505
  payload: { sourceMarker: m }
497
506
  }, "*");
498
507
  }
499
- if (u.data?.type === "ikon-inspect-click") {
500
- const d = p(u.data.x, u.data.y);
501
- if (d) {
508
+ if (c.data?.type === "ikon-inspect-click") {
509
+ const l = h(c.data.x, c.data.y);
510
+ if (l) {
502
511
  const m = {
503
- sourceMarker: d.getAttribute("data-ikon-source") ?? "",
504
- tagName: d.tagName.toLowerCase(),
505
- textContent: (d.textContent ?? "").trim().substring(0, 200)
512
+ sourceMarker: l.getAttribute("data-ikon-source") ?? "",
513
+ tagName: l.tagName.toLowerCase(),
514
+ textContent: (l.textContent ?? "").trim().substring(0, 200)
506
515
  };
507
516
  window.dispatchEvent(new CustomEvent("ikon-inspect-select", { detail: m })), window.parent.postMessage({ type: "ikon-element-selected", payload: m }, "*");
508
517
  }
509
518
  }
510
- if (u.data?.type === "ikon-inspect-click-add") {
511
- const d = p(u.data.x, u.data.y);
512
- if (d) {
519
+ if (c.data?.type === "ikon-inspect-click-add") {
520
+ const l = h(c.data.x, c.data.y);
521
+ if (l) {
513
522
  const m = {
514
- sourceMarker: d.getAttribute("data-ikon-source") ?? "",
515
- tagName: d.tagName.toLowerCase(),
516
- textContent: (d.textContent ?? "").trim().substring(0, 200)
523
+ sourceMarker: l.getAttribute("data-ikon-source") ?? "",
524
+ tagName: l.tagName.toLowerCase(),
525
+ textContent: (l.textContent ?? "").trim().substring(0, 200)
517
526
  };
518
527
  window.parent.postMessage({
519
528
  type: "ikon-inspect-rect-result",
@@ -521,55 +530,57 @@ function fn() {
521
530
  }, "*");
522
531
  }
523
532
  }
524
- if (u.data?.type === "ikon-inspect-rect") {
525
- const { x1: d, y1: m, x2: b, y2: g, append: y } = u.data, w = document.querySelectorAll("[data-ikon-source]"), T = [];
526
- for (const C of w) {
527
- const _ = C.getBoundingClientRect();
528
- _.right > d && _.left < b && _.bottom > m && _.top < g && T.push({
529
- sourceMarker: C.getAttribute("data-ikon-source") ?? "",
530
- tagName: C.tagName.toLowerCase(),
531
- textContent: (C.textContent ?? "").trim().substring(0, 200)
533
+ if (c.data?.type === "ikon-inspect-rect") {
534
+ const { x1: l, y1: m, x2: g, y2: b, append: S } = c.data, O = document.querySelectorAll("[data-ikon-source]"), _ = [];
535
+ for (const M of O) {
536
+ const L = M.getBoundingClientRect();
537
+ L.right > l && L.left < g && L.bottom > m && L.top < b && _.push({
538
+ sourceMarker: M.getAttribute("data-ikon-source") ?? "",
539
+ tagName: M.tagName.toLowerCase(),
540
+ textContent: (M.textContent ?? "").trim().substring(0, 200)
532
541
  });
533
542
  }
534
- T.length > 0 && window.parent.postMessage({
543
+ _.length > 0 && window.parent.postMessage({
535
544
  type: "ikon-inspect-rect-result",
536
- payload: { elements: T, append: y ?? !1 }
545
+ payload: { elements: _, append: S ?? !1 }
537
546
  }, "*");
538
547
  }
539
- u.data?.type === "ikon-inspect-highlight" && s(u.data.markers ?? []), u.data?.type === "ikon-inspect-clear" && o();
548
+ c.data?.type === "ikon-inspect-highlight" && i(c.data.markers ?? []), c.data?.type === "ikon-inspect-clear" && s();
540
549
  }
541
- return document.addEventListener("mouseover", i, !0), document.addEventListener("mouseout", a, !0), document.addEventListener("click", c, !0), window.addEventListener("message", l), () => {
542
- document.removeEventListener("mouseover", i, !0), document.removeEventListener("mouseout", a, !0), document.removeEventListener("click", c, !0), window.removeEventListener("message", l), o(), s([]), r.remove();
550
+ return document.addEventListener("mouseover", a, !0), document.addEventListener("mouseout", u, !0), document.addEventListener("click", f, !0), window.addEventListener("message", y), () => {
551
+ document.removeEventListener("mouseover", a, !0), document.removeEventListener("mouseout", u, !0), document.removeEventListener("click", f, !0), window.removeEventListener("message", y), s(), i([]), o.remove();
543
552
  };
544
553
  }, [t]), null;
545
554
  }
546
- const Ue = "ikon-ui";
547
- function pn(t, e) {
555
+ const pr = fe("IkonUiSurface"), Ue = "ikon-ui";
556
+ function hr(t, e) {
548
557
  return t === e;
549
558
  }
550
- const Lo = z(function({ stores: e, registry: n, category: r = Ue, onAction: o, client: s }) {
551
- const i = K(() => Array.from(e.keys()).sort().join(","), [e]), a = v(o);
559
+ const Do = z(function({ stores: e, registry: r, category: n = Ue, onAction: o, client: s }) {
560
+ const i = $(() => Array.from(e.keys()).sort().join(","), [e]), a = v(o);
552
561
  a.current = o;
553
- const c = v(s);
554
- c.current = s;
555
- const p = K(
562
+ const u = v(s);
563
+ u.current = s;
564
+ const f = $(
556
565
  () => {
557
- const f = [];
558
- for (const [l, u] of e) {
559
- const d = u.store.getSnapshot();
560
- pn(u.category, r) && (!d.rootViewId || !d.views.has(d.rootViewId) || f.push({ key: l, store: u.store }));
566
+ const y = [];
567
+ for (const [c, l] of e) {
568
+ const m = l.store.getSnapshot();
569
+ hr(l.category, n) && (!m.rootViewId || !m.views.has(m.rootViewId) || y.push({ key: c, store: l.store }));
561
570
  }
562
- return f;
571
+ return y;
563
572
  },
564
573
  // eslint-disable-next-line react-hooks/exhaustive-deps
565
- [e, r, i]
566
- );
567
- return p.length === 0 ? null : /* @__PURE__ */ E.jsxs(E.Fragment, { children: [
568
- /* @__PURE__ */ E.jsx(fn, {}),
569
- p.map(({ key: f, store: l }) => /* @__PURE__ */ E.jsx(ln, { store: l, library: n, onAction: a.current, client: c.current, video: c.current?.media?.video }, f))
570
- ] });
574
+ [e, n, i]
575
+ ), h = v(!1), p = f.length > 0;
576
+ return P(() => {
577
+ p && !h.current && (h.current = !0, pr.info("First UI render"));
578
+ }, [p]), p ? /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
579
+ /* @__PURE__ */ R.jsx(fr, {}),
580
+ f.map(({ key: y, store: c }) => /* @__PURE__ */ R.jsx(lr, { store: c, library: r, onAction: a.current, client: u.current, video: u.current?.media?.video }, y))
581
+ ] }) : null;
571
582
  });
572
- class hn {
583
+ class mr {
573
584
  core;
574
585
  ownsCore;
575
586
  stores = /* @__PURE__ */ new Map();
@@ -603,119 +614,119 @@ class hn {
603
614
  this.stores.delete(e) && this.notify(e);
604
615
  };
605
616
  syncStreamSnapshot = (e) => {
606
- const n = this.core.uiStore.getSnapshot(e);
607
- if (!n || !n.rootViewId) {
617
+ const r = this.core.uiStore.getSnapshot(e);
618
+ if (!r || !r.rootViewId) {
608
619
  this.handleUiStreamCleared(e);
609
620
  return;
610
621
  }
611
- if (!n.views.get(n.rootViewId)) {
622
+ if (!r.views.get(r.rootViewId)) {
612
623
  this.handleUiStreamCleared(e);
613
624
  return;
614
625
  }
615
- const s = this.ensureStoreEntry(e).store.replaceSnapshot(n), i = this.updateCategory(e, n.category);
626
+ const s = this.ensureStoreEntry(e).store.replaceSnapshot(r), i = this.updateCategory(e, r.category);
616
627
  (s || i) && this.notify(e);
617
628
  };
618
629
  syncAllStreams() {
619
- const e = this.core.uiStore.getSnapshots(), n = /* @__PURE__ */ new Set();
620
- for (const r of e)
621
- this.syncStreamSnapshot(r.streamId), n.add(r.streamId);
622
- for (const r of this.stores.keys())
623
- n.has(r) || (this.stores.delete(r), this.notify(r));
630
+ const e = this.core.uiStore.getSnapshots(), r = /* @__PURE__ */ new Set();
631
+ for (const n of e)
632
+ this.syncStreamSnapshot(n.streamId), r.add(n.streamId);
633
+ for (const n of this.stores.keys())
634
+ r.has(n) || (this.stores.delete(n), this.notify(n));
624
635
  }
625
636
  ensureStoreEntry(e) {
626
- const n = this.stores.get(e);
627
- if (n)
628
- return n;
629
- const r = {
637
+ const r = this.stores.get(e);
638
+ if (r)
639
+ return r;
640
+ const n = {
630
641
  category: Ue,
631
- store: new Ut()
642
+ store: new Dt()
632
643
  };
633
- return this.stores.set(e, r), r;
644
+ return this.stores.set(e, n), n;
634
645
  }
635
- updateCategory(e, n) {
636
- const r = this.stores.get(e);
637
- if (!r)
646
+ updateCategory(e, r) {
647
+ const n = this.stores.get(e);
648
+ if (!n)
638
649
  return !1;
639
- const o = n ?? this.core.uiStore.getSnapshot(e)?.category ?? Ue;
640
- return r.category === o ? !1 : (this.stores.set(e, { ...r, category: o }), !0);
650
+ const o = r ?? this.core.uiStore.getSnapshot(e)?.category ?? Ue;
651
+ return n.category === o ? !1 : (this.stores.set(e, { ...n, category: o }), !0);
641
652
  }
642
653
  notify(e) {
643
- for (const n of this.listeners)
644
- n(e);
654
+ for (const r of this.listeners)
655
+ r(e);
645
656
  }
646
657
  }
647
- function mn(t) {
658
+ function gr(t) {
648
659
  if (typeof t == "string") {
649
660
  const e = t.trim();
650
661
  return e.length > 0 ? e : void 0;
651
662
  }
652
663
  }
653
- function oe(t) {
664
+ function te(t) {
654
665
  if (typeof t == "string") {
655
666
  const e = t.trim();
656
667
  return e.length > 0 ? e : void 0;
657
668
  }
658
669
  if (Array.isArray(t)) {
659
- const e = t.filter((n) => typeof n == "string").map((n) => n.trim()).filter(Boolean);
670
+ const e = t.filter((r) => typeof r == "string").map((r) => r.trim()).filter(Boolean);
660
671
  return e.length > 0 ? e.join(" ") : void 0;
661
672
  }
662
673
  }
663
674
  function ze(...t) {
664
675
  let e = "";
665
- for (const n of t)
666
- if (n) {
667
- const r = n.trim();
668
- r && (e = e ? e + " " + r : r);
676
+ for (const r of t)
677
+ if (r) {
678
+ const n = r.trim();
679
+ n && (e = e ? e + " " + n : n);
669
680
  }
670
681
  return e || void 0;
671
682
  }
672
- const nt = /* @__PURE__ */ new WeakMap(), gn = {};
673
- function We(t) {
683
+ const tt = /* @__PURE__ */ new WeakMap(), yr = {};
684
+ function Ye(t) {
674
685
  if (!t)
675
- return gn;
676
- const e = nt.get(t);
686
+ return yr;
687
+ const e = tt.get(t);
677
688
  if (e)
678
689
  return e;
679
- const n = {};
680
- for (const [r, o] of Object.entries(t))
681
- o != null && (typeof o == "string" || typeof o == "number" || typeof o == "boolean") && (n[r] = o);
682
- return nt.set(t, n), n;
690
+ const r = {};
691
+ for (const [n, o] of Object.entries(t))
692
+ o != null && (typeof o == "string" || typeof o == "number" || typeof o == "boolean") && (r[n] = o);
693
+ return tt.set(t, r), r;
683
694
  }
684
- function yn(t) {
695
+ function br(t) {
685
696
  let e = t.parentElement;
686
697
  for (; e; ) {
687
- const r = window.getComputedStyle(e).overflowY;
688
- if (r === "auto" || r === "scroll" || e.hasAttribute("data-radix-scroll-area-viewport"))
698
+ const n = window.getComputedStyle(e).overflowY;
699
+ if (n === "auto" || n === "scroll" || e.hasAttribute("data-radix-scroll-area-viewport"))
689
700
  return e;
690
701
  e = e.parentElement;
691
702
  }
692
703
  return null;
693
704
  }
694
- function bt(t, e) {
705
+ function yt(t, e) {
695
706
  requestAnimationFrame(() => {
696
- const n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), o = t.scrollTop + (r.bottom - n.bottom) + 16;
707
+ const r = t.getBoundingClientRect(), n = e.getBoundingClientRect(), o = t.scrollTop + (n.bottom - r.bottom) + 16;
697
708
  "scrollBehavior" in document.documentElement.style ? t.scrollTo({ top: o, behavior: "smooth" }) : t.scrollTop = o;
698
709
  });
699
710
  }
700
- const De = "data-ikon-scroll-indicator", bn = 0.15, Se = "data-ikon-at-bottom";
701
- function St(t) {
702
- return Math.max(t.clientHeight * bn, 20);
711
+ const je = "data-ikon-scroll-indicator", Sr = 0.15, Ee = "data-ikon-at-bottom";
712
+ function bt(t) {
713
+ return Math.max(t.clientHeight * Sr, 20);
703
714
  }
704
- function Sn(t) {
705
- return t.getAttribute(Se) !== "false";
715
+ function wr(t) {
716
+ return t.getAttribute(Ee) !== "false";
706
717
  }
707
- function wn(t) {
708
- t.getAttribute(Se) === null && (t.setAttribute(Se, "true"), t.addEventListener("scroll", () => {
709
- const { scrollTop: e, scrollHeight: n, clientHeight: r } = t, s = n - e - r <= St(t);
710
- t.setAttribute(Se, s ? "true" : "false");
718
+ function vr(t) {
719
+ t.getAttribute(Ee) === null && (t.setAttribute(Ee, "true"), t.addEventListener("scroll", () => {
720
+ const { scrollTop: e, scrollHeight: r, clientHeight: n } = t, s = r - e - n <= bt(t);
721
+ t.setAttribute(Ee, s ? "true" : "false");
711
722
  }, { passive: !0 }));
712
723
  }
713
- function vn(t) {
714
- const e = t.parentElement ?? t, n = e.querySelector(`[${De}]`);
715
- if (n)
716
- return n;
717
- const r = document.createElement("button");
718
- return r.setAttribute(De, "true"), r.setAttribute("aria-label", "Scroll to latest"), r.textContent = "↓", Object.assign(r.style, {
724
+ function Er(t) {
725
+ const e = t.parentElement ?? t, r = e.querySelector(`[${je}]`);
726
+ if (r)
727
+ return r;
728
+ const n = document.createElement("button");
729
+ return n.setAttribute(je, "true"), n.setAttribute("aria-label", "Scroll to latest"), n.textContent = "↓", Object.assign(n.style, {
719
730
  position: "absolute",
720
731
  bottom: "12px",
721
732
  left: "50%",
@@ -737,65 +748,64 @@ function vn(t) {
737
748
  transition: "opacity 150ms",
738
749
  opacity: "1",
739
750
  padding: "0"
740
- }), r.addEventListener("mouseenter", () => {
741
- r.style.opacity = "1";
742
- }), r.addEventListener("mouseleave", () => {
743
- r.style.opacity = "0.9";
744
- }), e.appendChild(r), r;
745
- }
746
- function En(t, e) {
747
- const n = vn(t);
748
- n.style.display = "flex";
749
- const r = () => {
750
- bt(t, e), n.style.display = "none";
751
+ }), n.addEventListener("mouseenter", () => {
752
+ n.style.opacity = "1";
753
+ }), n.addEventListener("mouseleave", () => {
754
+ n.style.opacity = "0.9";
755
+ }), e.appendChild(n), n;
756
+ }
757
+ function Rr(t, e) {
758
+ const r = Er(t);
759
+ r.style.display = "flex";
760
+ const n = () => {
761
+ yt(t, e), r.style.display = "none";
751
762
  }, o = () => {
752
763
  const { scrollTop: s, scrollHeight: i, clientHeight: a } = t;
753
- i - s - a <= St(t) && (n.style.display = "none");
764
+ i - s - a <= bt(t) && (r.style.display = "none");
754
765
  };
755
- return n.addEventListener("click", r), t.addEventListener("scroll", o, { passive: !0 }), () => {
756
- n.removeEventListener("click", r), t.removeEventListener("scroll", o);
766
+ return r.addEventListener("click", n), t.addEventListener("scroll", o, { passive: !0 }), () => {
767
+ r.removeEventListener("click", n), t.removeEventListener("scroll", o);
757
768
  };
758
769
  }
759
- function Rn() {
760
- const t = z(function({ nodeId: n, context: r }) {
761
- const o = Z(r.store, n), s = v(null), i = oe(o?.props?.targetViewId), a = o?.props?.focusOnly, c = typeof a == "boolean" ? a : void 0, p = oe(o?.props?.priority), f = oe(o?.props?.key), l = o?.props?.preciseGeneratedAt;
762
- return N(() => {
770
+ function kr() {
771
+ const t = z(function({ nodeId: r, context: n }) {
772
+ const o = J(n.store, r), s = v(null), i = te(o?.props?.targetViewId), a = o?.props?.focusOnly, u = typeof a == "boolean" ? a : void 0, f = te(o?.props?.priority), h = te(o?.props?.key), p = o?.props?.preciseGeneratedAt;
773
+ return P(() => {
763
774
  if (typeof document > "u")
764
775
  return;
765
- const d = s.current;
766
- if (!d || i && d.closest("[data-ikon-view-id]")?.getAttribute("data-ikon-view-id") !== i)
776
+ const c = s.current;
777
+ if (!c || i && c.closest("[data-ikon-view-id]")?.getAttribute("data-ikon-view-id") !== i)
767
778
  return;
768
- let m;
769
- if (c !== !0) {
770
- const w = yn(d);
771
- if (w)
772
- if (wn(w), p === "Polite" && !Sn(w))
773
- m = En(w, d);
779
+ let l;
780
+ if (u !== !0) {
781
+ const S = br(c);
782
+ if (S)
783
+ if (vr(S), f === "Polite" && !wr(S))
784
+ l = Rr(S, c);
774
785
  else {
775
- const B = (w.parentElement ?? w).querySelector(`[${De}]`);
776
- B && (B.style.display = "none"), bt(w, d);
786
+ const L = (S.parentElement ?? S).querySelector(`[${je}]`);
787
+ L && (L.style.display = "none"), yt(S, c);
777
788
  }
778
- else typeof d.scrollIntoView == "function" && requestAnimationFrame(() => {
789
+ else typeof c.scrollIntoView == "function" && requestAnimationFrame(() => {
779
790
  try {
780
- d.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" });
791
+ c.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" });
781
792
  } catch {
782
- d.scrollIntoView(!1);
793
+ c.scrollIntoView(!1);
783
794
  }
784
795
  });
785
796
  }
786
797
  const g = document.activeElement;
787
- if (!(g instanceof HTMLInputElement || g instanceof HTMLTextAreaElement || g?.getAttribute("contenteditable") === "true") && typeof d.focus == "function")
798
+ if (!(g instanceof HTMLInputElement || g instanceof HTMLTextAreaElement || g?.getAttribute("contenteditable") === "true") && typeof c.focus == "function")
788
799
  try {
789
- d.focus({ preventScroll: !0 });
800
+ c.focus({ preventScroll: !0 });
790
801
  } catch {
791
- d.focus();
802
+ c.focus();
792
803
  }
793
- return m;
794
- }, [c, p, i, f, l]), o ? /* @__PURE__ */ E.jsx(
804
+ return l;
805
+ }, [u, f, i, h, p]), o ? /* @__PURE__ */ R.jsx(
795
806
  "span",
796
807
  {
797
808
  ref: s,
798
- "aria-hidden": "true",
799
809
  "data-ikon-node-id": o.id,
800
810
  "data-ikon-source": o.sourceMarker,
801
811
  "data-ikon-focus-hint": "true",
@@ -809,26 +819,26 @@ function Rn() {
809
819
  return t;
810
820
  };
811
821
  }
812
- function kn() {
813
- const t = z(function({ nodeId: n, context: r, className: o }) {
814
- const s = Z(r.store, n), i = mn(s?.props?.onInvokeId), a = D(() => {
815
- i && r.dispatchAction(i);
816
- }, [i, r]);
822
+ function Ar() {
823
+ const t = z(function({ nodeId: r, context: n, className: o }) {
824
+ const s = J(n.store, r), i = gr(s?.props?.onInvokeId), a = U(() => {
825
+ i && n.dispatchAction(i);
826
+ }, [i, n]);
817
827
  if (!s)
818
828
  return null;
819
- const c = We(s.props);
820
- delete c.onInvokeId;
821
- const p = ze(oe(s.props?.className), o), f = s.children?.length ? r.renderChildren(s.children) : void 0;
822
- return /* @__PURE__ */ E.jsx(
829
+ const u = Ye(s.props);
830
+ delete u.onInvokeId;
831
+ const f = ze(te(s.props?.className), o), h = s.children?.length ? n.renderChildren(s.children) : void 0;
832
+ return /* @__PURE__ */ R.jsx(
823
833
  "div",
824
834
  {
825
- ...c,
835
+ ...u,
826
836
  "data-ikon-node-id": s.id,
827
837
  "data-ikon-source": s.sourceMarker,
828
- className: p,
838
+ className: f,
829
839
  onClick: i ? a : void 0,
830
840
  style: i ? { cursor: "pointer" } : void 0,
831
- children: f
841
+ children: h
832
842
  }
833
843
  );
834
844
  });
@@ -837,58 +847,58 @@ function kn() {
837
847
  return t;
838
848
  };
839
849
  }
840
- function An() {
841
- const t = z(function({ nodeId: n, context: r, className: o }) {
842
- const s = Z(r.store, n);
850
+ function Tr() {
851
+ const t = z(function({ nodeId: r, context: n, className: o }) {
852
+ const s = J(n.store, r);
843
853
  if (!s)
844
854
  return null;
845
- const i = We(s.props), a = ze("relative", oe(s.props?.className), o), c = s.children?.length ? r.renderChildren(s.children) : void 0;
846
- return /* @__PURE__ */ E.jsx("div", { ...i, "data-ikon-node-id": s.id, "data-ikon-source": s.sourceMarker, className: a, children: c });
855
+ const i = Ye(s.props), a = ze("relative", te(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
856
+ return /* @__PURE__ */ R.jsx("div", { ...i, "data-ikon-node-id": s.id, "data-ikon-source": s.sourceMarker, className: a, children: u });
847
857
  });
848
858
  return ({ type: e }) => {
849
859
  if (e === "std.stack")
850
860
  return t;
851
861
  };
852
862
  }
853
- function Tn() {
854
- const t = z(function({ nodeId: n, context: r, className: o }) {
855
- const s = Z(r.store, n);
863
+ function Cr() {
864
+ const t = z(function({ nodeId: r, context: n, className: o }) {
865
+ const s = J(n.store, r);
856
866
  if (!s)
857
867
  return null;
858
- const i = We(s.props), a = ze("absolute", oe(s.props?.className), o), c = s.children?.length ? r.renderChildren(s.children) : void 0;
859
- return /* @__PURE__ */ E.jsx("div", { ...i, "data-ikon-node-id": s.id, "data-ikon-source": s.sourceMarker, className: a, children: c });
868
+ const i = Ye(s.props), a = ze("absolute", te(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
869
+ return /* @__PURE__ */ R.jsx("div", { ...i, "data-ikon-node-id": s.id, "data-ikon-source": s.sourceMarker, className: a, children: u });
860
870
  });
861
871
  return ({ type: e }) => {
862
872
  if (e === "std.layer")
863
873
  return t;
864
874
  };
865
875
  }
866
- function Cn() {
876
+ function Ir() {
867
877
  return [
868
- kn(),
869
- An(),
870
- Tn(),
871
- Rn()
878
+ Ar(),
879
+ Tr(),
880
+ Cr(),
881
+ kr()
872
882
  ];
873
883
  }
874
- const In = "base", On = async () => Cn();
875
- function Nn(t) {
876
- t.registerModule(In, On);
884
+ const _r = "base", Or = async () => Ir();
885
+ function Nr(t) {
886
+ t.registerModule(_r, Or);
877
887
  }
878
- function _n(t) {
888
+ function Pr(t) {
879
889
  if (typeof t == "string") {
880
890
  const e = t.trim();
881
891
  return e.length > 0 ? e : void 0;
882
892
  }
883
893
  if (Array.isArray(t)) {
884
- const e = t.filter((n) => typeof n == "string").map((n) => n.trim()).filter(Boolean);
894
+ const e = t.filter((r) => typeof r == "string").map((r) => r.trim()).filter(Boolean);
885
895
  return e.length > 0 ? e.join(" ") : void 0;
886
896
  }
887
897
  }
888
- function Pn(...t) {
898
+ function Mr(...t) {
889
899
  const e = [];
890
- for (const n of t)
891
- n && n.trim() && e.push(n.trim());
900
+ for (const r of t)
901
+ r && r.trim() && e.push(r.trim());
892
902
  return e.length > 0 ? e.join(" ") : void 0;
893
903
  }
894
904
  function rt(t) {
@@ -897,7 +907,7 @@ function rt(t) {
897
907
  const e = t.trim();
898
908
  return e.length > 0 ? e : void 0;
899
909
  }
900
- function ye(t) {
910
+ function we(t) {
901
911
  if (typeof t == "boolean")
902
912
  return t;
903
913
  if (typeof t == "string") {
@@ -906,58 +916,58 @@ function ye(t) {
906
916
  if (e === "false") return !1;
907
917
  }
908
918
  }
909
- const Mn = "std.audio-url-player";
910
- function Ln() {
919
+ const Lr = "std.audio-url-player";
920
+ function xr() {
911
921
  const t = z(function({
912
- nodeId: n,
913
- context: r,
922
+ nodeId: r,
923
+ context: n,
914
924
  className: o
915
925
  }) {
916
- const s = Z(r.store, n), i = v(null), a = s ? ye(s.props?.autoplay) : void 0, c = s ? rt(s.props?.src) : void 0;
917
- if (N(() => {
926
+ const s = J(n.store, r), i = v(null), a = s ? we(s.props?.autoplay) : void 0, u = s ? rt(s.props?.src) : void 0;
927
+ if (P(() => {
918
928
  a && i.current && i.current.play().catch(() => {
919
929
  });
920
- }, [a, c]), !s)
930
+ }, [a, u]), !s)
921
931
  return null;
922
- const p = Pn(_n(s.props?.className), o), f = rt(s.props?.preload), l = ye(s.props?.controls), u = ye(s.props?.loop), d = ye(s.props?.muted);
923
- return /* @__PURE__ */ E.jsx(
932
+ const f = Mr(Pr(s.props?.className), o), h = rt(s.props?.preload), p = we(s.props?.controls), y = we(s.props?.loop), c = we(s.props?.muted);
933
+ return /* @__PURE__ */ R.jsx(
924
934
  "audio",
925
935
  {
926
936
  ref: i,
927
- src: c,
928
- ...f !== void 0 ? { preload: f } : {},
929
- ...l !== void 0 ? { controls: l } : {},
937
+ src: u,
938
+ ...h !== void 0 ? { preload: h } : {},
939
+ ...p !== void 0 ? { controls: p } : {},
930
940
  ...a !== void 0 ? { autoPlay: a } : {},
931
- ...u !== void 0 ? { loop: u } : {},
932
- ...d !== void 0 ? { muted: d } : {},
941
+ ...y !== void 0 ? { loop: y } : {},
942
+ ...c !== void 0 ? { muted: c } : {},
933
943
  "data-ikon-node-id": s.id,
934
944
  "data-ikon-source": s.sourceMarker,
935
- className: p
945
+ className: f
936
946
  }
937
947
  );
938
948
  });
939
949
  return ({ type: e }) => {
940
- if (e === Mn)
950
+ if (e === Lr)
941
951
  return t;
942
952
  };
943
953
  }
944
- function wt(t) {
954
+ function St(t) {
945
955
  if (typeof t == "string") {
946
956
  const e = t.trim();
947
957
  return e.length > 0 ? e : void 0;
948
958
  }
949
959
  if (Array.isArray(t)) {
950
- const e = t.filter((n) => typeof n == "string").map((n) => n.trim()).filter(Boolean);
960
+ const e = t.filter((r) => typeof r == "string").map((r) => r.trim()).filter(Boolean);
951
961
  return e.length > 0 ? e.join(" ") : void 0;
952
962
  }
953
963
  }
954
- function vt(...t) {
964
+ function wt(...t) {
955
965
  const e = [];
956
- for (const n of t)
957
- n && n.trim() && e.push(n.trim());
966
+ for (const r of t)
967
+ r && r.trim() && e.push(r.trim());
958
968
  return e.length > 0 ? e.join(" ") : void 0;
959
969
  }
960
- function we(t) {
970
+ function Re(t) {
961
971
  if (typeof t == "number" && Number.isFinite(t))
962
972
  return Math.floor(t);
963
973
  if (typeof t == "string" && t.trim().length > 0) {
@@ -966,39 +976,39 @@ function we(t) {
966
976
  return Math.floor(e);
967
977
  }
968
978
  }
969
- function Be(t) {
979
+ function De(t) {
970
980
  if (typeof t != "string")
971
981
  return;
972
982
  const e = t.trim();
973
983
  return e.length > 0 ? e : void 0;
974
984
  }
975
- const xn = "std.video-canvas", jn = "std.video-url-player";
976
- function Un() {
977
- const t = z(function({ nodeId: n, context: r, className: o }) {
978
- const s = Z(r.store, n), i = v(null), a = v(null), c = r.video, p = r.client, f = s ? Be(s.props?.streamId) : void 0, l = s ? we(s.props?.width) : void 0, u = s ? we(s.props?.height) : void 0, d = s ? vt(wt(s.props?.className), o) : o, [, m] = Y(0);
979
- N(() => {
980
- if (!p?.isWebRtcEnabled) return;
981
- const g = p.onWebRtcTrackMapChanged;
982
- return p.onWebRtcTrackMapChanged = (y) => {
983
- g?.(y), y.kind === "video" && m((w) => w + 1);
985
+ const Ur = "std.video-canvas", jr = "std.video-url-player";
986
+ function Dr() {
987
+ const t = z(function({ nodeId: r, context: n, className: o }) {
988
+ const s = J(n.store, r), i = v(null), a = v(null), u = n.video, f = n.client, h = s ? De(s.props?.streamId) : void 0, p = s ? Re(s.props?.width) : void 0, y = s ? Re(s.props?.height) : void 0, c = s ? wt(St(s.props?.className), o) : o, [, l] = q(0);
989
+ P(() => {
990
+ if (!f?.isWebRtcEnabled) return;
991
+ const g = f.onWebRtcTrackMapChanged;
992
+ return f.onWebRtcTrackMapChanged = (b) => {
993
+ g?.(b), b.kind === "video" && l((S) => S + 1);
984
994
  }, () => {
985
- p.onWebRtcTrackMapChanged = g;
995
+ f.onWebRtcTrackMapChanged = g;
986
996
  };
987
- }, [p]);
988
- const b = p?.isWebRtcEnabled && f ? p.getWebRtcVideoStreamByStreamId(f) : null;
989
- return N(() => {
997
+ }, [f]);
998
+ const m = f?.isWebRtcEnabled && h ? f.getWebRtcVideoStreamByStreamId(h) : null;
999
+ return P(() => {
990
1000
  const g = i.current;
991
- if (!(!c || !g || !f || b))
992
- return c.attachCanvas(f, g), () => {
993
- c.detachCanvas(f);
1001
+ if (!(!u || !g || !h || m))
1002
+ return u.attachCanvas(h, g), () => {
1003
+ u.detachCanvas(h);
994
1004
  };
995
- }, [c, f, b]), N(() => {
1005
+ }, [u, h, m]), P(() => {
996
1006
  const g = a.current;
997
- if (!(!g || !b))
998
- return g.srcObject = b, () => {
1007
+ if (!(!g || !m))
1008
+ return g.srcObject = m, () => {
999
1009
  g.srcObject = null;
1000
1010
  };
1001
- }, [b]), s ? b ? /* @__PURE__ */ E.jsx(
1011
+ }, [m]), s ? m ? /* @__PURE__ */ R.jsx(
1002
1012
  "video",
1003
1013
  {
1004
1014
  ref: a,
@@ -1007,35 +1017,35 @@ function Un() {
1007
1017
  muted: !0,
1008
1018
  "data-ikon-node-id": s.id,
1009
1019
  "data-ikon-source": s.sourceMarker,
1010
- "data-ikon-video-stream-id": f,
1011
- className: d,
1012
- ...l ? { width: l } : {},
1013
- ...u ? { height: u } : {}
1020
+ "data-ikon-video-stream-id": h,
1021
+ className: c,
1022
+ ...p ? { width: p } : {},
1023
+ ...y ? { height: y } : {}
1014
1024
  },
1015
- f
1016
- ) : /* @__PURE__ */ E.jsx(
1025
+ h
1026
+ ) : /* @__PURE__ */ R.jsx(
1017
1027
  "canvas",
1018
1028
  {
1019
1029
  ref: i,
1020
1030
  "data-ikon-node-id": s.id,
1021
1031
  "data-ikon-source": s.sourceMarker,
1022
- "data-ikon-video-stream-id": f,
1023
- className: d,
1024
- ...l ? { width: l } : {},
1025
- ...u ? { height: u } : {}
1032
+ "data-ikon-video-stream-id": h,
1033
+ className: c,
1034
+ ...p ? { width: p } : {},
1035
+ ...y ? { height: y } : {}
1026
1036
  },
1027
- f
1037
+ h
1028
1038
  ) : null;
1029
1039
  });
1030
1040
  return ({ type: e }) => {
1031
- if (e === xn)
1041
+ if (e === Ur)
1032
1042
  return t;
1033
1043
  };
1034
1044
  }
1035
- function Dn() {
1036
- return [Un(), Bn(), Ln()];
1045
+ function Br() {
1046
+ return [Dr(), Fr(), xr()];
1037
1047
  }
1038
- function ue(t) {
1048
+ function ce(t) {
1039
1049
  if (typeof t == "boolean")
1040
1050
  return t;
1041
1051
  if (typeof t == "string") {
@@ -1044,61 +1054,61 @@ function ue(t) {
1044
1054
  if (e === "false") return !1;
1045
1055
  }
1046
1056
  }
1047
- function Bn() {
1057
+ function Fr() {
1048
1058
  const t = z(function({
1049
- nodeId: n,
1050
- context: r,
1059
+ nodeId: r,
1060
+ context: n,
1051
1061
  className: o
1052
1062
  }) {
1053
- const s = Z(r.store, n), i = v(null), a = s ? ue(s.props?.autoplay) : void 0, c = s ? Be(s.props?.src) : void 0;
1054
- if (N(() => {
1063
+ const s = J(n.store, r), i = v(null), a = s ? ce(s.props?.autoplay) : void 0, u = s ? De(s.props?.src) : void 0;
1064
+ if (P(() => {
1055
1065
  a && i.current && i.current.play().catch(() => {
1056
1066
  });
1057
- }, [a, c]), !s)
1067
+ }, [a, u]), !s)
1058
1068
  return null;
1059
- const p = vt(wt(s.props?.className), o), f = Be(s.props?.poster), l = ue(s.props?.controls), u = ue(s.props?.loop), d = ue(s.props?.muted), m = ue(s.props?.playsInline), b = we(s.props?.width), g = we(s.props?.height), y = s.children?.length ? r.renderChildren(s.children) : void 0;
1060
- return /* @__PURE__ */ E.jsx(
1069
+ const f = wt(St(s.props?.className), o), h = De(s.props?.poster), p = ce(s.props?.controls), y = ce(s.props?.loop), c = ce(s.props?.muted), l = ce(s.props?.playsInline), m = Re(s.props?.width), g = Re(s.props?.height), b = s.children?.length ? n.renderChildren(s.children) : void 0;
1070
+ return /* @__PURE__ */ R.jsx(
1061
1071
  "video",
1062
1072
  {
1063
1073
  ref: i,
1064
- src: c,
1065
- poster: f,
1066
- ...l !== void 0 ? { controls: l } : {},
1074
+ src: u,
1075
+ poster: h,
1076
+ ...p !== void 0 ? { controls: p } : {},
1067
1077
  ...a !== void 0 ? { autoPlay: a } : {},
1068
- ...u !== void 0 ? { loop: u } : {},
1069
- ...d !== void 0 ? { muted: d } : {},
1070
- ...m !== void 0 ? { playsInline: m } : {},
1071
- ...b ? { width: b } : {},
1078
+ ...y !== void 0 ? { loop: y } : {},
1079
+ ...c !== void 0 ? { muted: c } : {},
1080
+ ...l !== void 0 ? { playsInline: l } : {},
1081
+ ...m ? { width: m } : {},
1072
1082
  ...g ? { height: g } : {},
1073
1083
  "data-ikon-node-id": s.id,
1074
1084
  "data-ikon-source": s.sourceMarker,
1075
- className: p,
1076
- children: y
1085
+ className: f,
1086
+ children: b
1077
1087
  }
1078
1088
  );
1079
1089
  });
1080
1090
  return ({ type: e }) => {
1081
- if (e === jn)
1091
+ if (e === jr)
1082
1092
  return t;
1083
1093
  };
1084
1094
  }
1085
- const Fn = "media", $n = async () => Dn();
1086
- function Vn(t) {
1087
- t.registerModule(Fn, $n);
1095
+ const $r = "media", Vr = async () => Br();
1096
+ function Kr(t) {
1097
+ t.registerModule($r, Vr);
1088
1098
  }
1089
- const Kn = `#version 300 es
1099
+ const zr = `#version 300 es
1090
1100
  in vec4 a_position;
1091
1101
  void main() {
1092
1102
  gl_Position = a_position;
1093
1103
  }
1094
1104
  `;
1095
- function Yn(t, e) {
1105
+ function Yr(t, e) {
1096
1106
  return new RegExp(`\\buniform\\s+\\w+\\s+${e}\\s*;`, "g").test(t);
1097
1107
  }
1098
- function zn(t, e) {
1099
- const n = [];
1100
- for (const [r, o] of Object.entries(e)) {
1101
- if (Yn(t, r))
1108
+ function Wr(t, e) {
1109
+ const r = [];
1110
+ for (const [n, o] of Object.entries(e)) {
1111
+ if (Yr(t, n))
1102
1112
  continue;
1103
1113
  let s;
1104
1114
  switch (o.type) {
@@ -1123,7 +1133,7 @@ function zn(t, e) {
1123
1133
  default:
1124
1134
  s = "float";
1125
1135
  }
1126
- n.push(`uniform ${s} ${r};`);
1136
+ r.push(`uniform ${s} ${n};`);
1127
1137
  }
1128
1138
  return `#version 300 es
1129
1139
  precision highp float;
@@ -1137,7 +1147,7 @@ uniform vec4 iMouse;
1137
1147
  uniform vec4 iDate;
1138
1148
 
1139
1149
  // Custom uniforms
1140
- ${n.join(`
1150
+ ${r.join(`
1141
1151
  `)}
1142
1152
 
1143
1153
  out vec4 frag_out_color;
@@ -1151,7 +1161,7 @@ void main() {
1151
1161
  }
1152
1162
  `;
1153
1163
  }
1154
- class Wn {
1164
+ class qr {
1155
1165
  gl;
1156
1166
  program = null;
1157
1167
  positionBuffer = null;
@@ -1168,106 +1178,106 @@ class Wn {
1168
1178
  lastError = null;
1169
1179
  currentShaderSource = "";
1170
1180
  constructor(e) {
1171
- const n = e.getContext("webgl2", {
1181
+ const r = e.getContext("webgl2", {
1172
1182
  alpha: !1,
1173
1183
  antialias: !1,
1174
1184
  depth: !1,
1175
1185
  stencil: !1,
1176
1186
  preserveDrawingBuffer: !1
1177
1187
  });
1178
- if (!n)
1188
+ if (!r)
1179
1189
  throw new Error("WebGL2 is not supported");
1180
- this.gl = n, this.initializeGeometry();
1190
+ this.gl = r, this.initializeGeometry();
1181
1191
  }
1182
1192
  initializeGeometry() {
1183
1193
  const e = this.gl;
1184
1194
  this.vao = e.createVertexArray(), e.bindVertexArray(this.vao), this.positionBuffer = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, this.positionBuffer);
1185
- const n = new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]);
1186
- e.bufferData(e.ARRAY_BUFFER, n, e.STATIC_DRAW), e.enableVertexAttribArray(0), e.vertexAttribPointer(0, 2, e.FLOAT, !1, 0, 0), e.bindVertexArray(null);
1195
+ const r = new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]);
1196
+ e.bufferData(e.ARRAY_BUFFER, r, e.STATIC_DRAW), e.enableVertexAttribArray(0), e.vertexAttribPointer(0, 2, e.FLOAT, !1, 0, 0), e.bindVertexArray(null);
1187
1197
  }
1188
- compile(e, n = {}) {
1189
- this.lastError = null, this.customUniforms = n, this.currentShaderSource = e;
1190
- const r = this.gl, o = this.compileShader(r.VERTEX_SHADER, Kn);
1198
+ compile(e, r = {}) {
1199
+ this.lastError = null, this.customUniforms = r, this.currentShaderSource = e;
1200
+ const n = this.gl, o = this.compileShader(n.VERTEX_SHADER, zr);
1191
1201
  if (!o)
1192
1202
  return !1;
1193
- const s = zn(e, n), i = this.compileShader(r.FRAGMENT_SHADER, s);
1203
+ const s = Wr(e, r), i = this.compileShader(n.FRAGMENT_SHADER, s);
1194
1204
  if (!i)
1195
- return r.deleteShader(o), !1;
1196
- const a = r.createProgram();
1197
- return a ? (r.attachShader(a, o), r.attachShader(a, i), r.linkProgram(a), r.deleteShader(o), r.deleteShader(i), r.getProgramParameter(a, r.LINK_STATUS) ? (this.program && r.deleteProgram(this.program), this.program = a, this.cacheUniformLocations(), !0) : (this.lastError = r.getProgramInfoLog(a) || "Program link failed", r.deleteProgram(a), !1)) : (this.lastError = "Failed to create program", r.deleteShader(o), r.deleteShader(i), !1);
1205
+ return n.deleteShader(o), !1;
1206
+ const a = n.createProgram();
1207
+ return a ? (n.attachShader(a, o), n.attachShader(a, i), n.linkProgram(a), n.deleteShader(o), n.deleteShader(i), n.getProgramParameter(a, n.LINK_STATUS) ? (this.program && n.deleteProgram(this.program), this.program = a, this.cacheUniformLocations(), !0) : (this.lastError = n.getProgramInfoLog(a) || "Program link failed", n.deleteProgram(a), !1)) : (this.lastError = "Failed to create program", n.deleteShader(o), n.deleteShader(i), !1);
1198
1208
  }
1199
1209
  recompileWithUniforms(e) {
1200
1210
  return this.currentShaderSource ? this.compile(this.currentShaderSource, e) : !1;
1201
1211
  }
1202
- compileShader(e, n) {
1203
- const r = this.gl, o = r.createShader(e);
1204
- return o ? (r.shaderSource(o, n), r.compileShader(o), r.getShaderParameter(o, r.COMPILE_STATUS) ? o : (this.lastError = r.getShaderInfoLog(o) || "Shader compilation failed", r.deleteShader(o), null)) : (this.lastError = "Failed to create shader", null);
1212
+ compileShader(e, r) {
1213
+ const n = this.gl, o = n.createShader(e);
1214
+ return o ? (n.shaderSource(o, r), n.compileShader(o), n.getShaderParameter(o, n.COMPILE_STATUS) ? o : (this.lastError = n.getShaderInfoLog(o) || "Shader compilation failed", n.deleteShader(o), null)) : (this.lastError = "Failed to create shader", null);
1205
1215
  }
1206
1216
  cacheUniformLocations() {
1207
1217
  if (!this.program) return;
1208
1218
  const e = this.gl;
1209
1219
  this.uniformLocations.clear();
1210
- const n = ["iResolution", "iTime", "iTimeDelta", "iFrame", "iMouse", "iDate"];
1211
- for (const r of n)
1212
- this.uniformLocations.set(r, e.getUniformLocation(this.program, r));
1213
- for (const r of Object.keys(this.customUniforms))
1214
- this.uniformLocations.set(r, e.getUniformLocation(this.program, r));
1220
+ const r = ["iResolution", "iTime", "iTimeDelta", "iFrame", "iMouse", "iDate"];
1221
+ for (const n of r)
1222
+ this.uniformLocations.set(n, e.getUniformLocation(this.program, n));
1223
+ for (const n of Object.keys(this.customUniforms))
1224
+ this.uniformLocations.set(n, e.getUniformLocation(this.program, n));
1215
1225
  }
1216
1226
  setCustomUniforms(e) {
1217
- const n = Object.keys(e).some((o) => !(o in this.customUniforms)), r = Object.keys(this.customUniforms).some((o) => !(o in e));
1218
- n || r ? this.recompileWithUniforms(e) : this.customUniforms = e;
1227
+ const r = Object.keys(e).some((o) => !(o in this.customUniforms)), n = Object.keys(this.customUniforms).some((o) => !(o in e));
1228
+ r || n ? this.recompileWithUniforms(e) : this.customUniforms = e;
1219
1229
  }
1220
- setMouse(e, n, r, o) {
1221
- this.mouseX = e, this.mouseY = n, this.mouseClickX = r, this.mouseClickY = o;
1230
+ setMouse(e, r, n, o) {
1231
+ this.mouseX = e, this.mouseY = r, this.mouseClickX = n, this.mouseClickY = o;
1222
1232
  }
1223
1233
  draw() {
1224
1234
  if (!this.program) return;
1225
- const e = this.gl, n = e.canvas, r = n.clientWidth, o = n.clientHeight;
1226
- (n.width !== r || n.height !== o) && (n.width = r, n.height = o, e.viewport(0, 0, r, o));
1235
+ const e = this.gl, r = e.canvas, n = r.clientWidth, o = r.clientHeight;
1236
+ (r.width !== n || r.height !== o) && (r.width = n, r.height = o, e.viewport(0, 0, n, o));
1227
1237
  const s = performance.now(), i = (s - this.startTime) / 1e3, a = (s - this.lastFrameTime) / 1e3;
1228
1238
  this.lastFrameTime = s, this.frameCount++, e.clearColor(0, 0, 0, 1), e.clear(e.COLOR_BUFFER_BIT), e.useProgram(this.program), e.bindVertexArray(this.vao);
1229
- const c = this.uniformLocations.get("iResolution");
1230
- c && e.uniform3f(c, r, o, 1);
1231
- const p = this.uniformLocations.get("iTime");
1232
- p && e.uniform1f(p, i);
1233
- const f = this.uniformLocations.get("iTimeDelta");
1234
- f && e.uniform1f(f, a);
1235
- const l = this.uniformLocations.get("iFrame");
1236
- l && e.uniform1i(l, this.frameCount);
1237
- const u = this.uniformLocations.get("iMouse");
1238
- u && e.uniform4f(u, this.mouseX, this.mouseY, this.mouseClickX, this.mouseClickY);
1239
- const d = this.uniformLocations.get("iDate");
1240
- if (d) {
1241
- const m = /* @__PURE__ */ new Date();
1242
- e.uniform4f(d, m.getFullYear(), m.getMonth(), m.getDate(), m.getHours() * 3600 + m.getMinutes() * 60 + m.getSeconds() + m.getMilliseconds() / 1e3);
1239
+ const u = this.uniformLocations.get("iResolution");
1240
+ u && e.uniform3f(u, n, o, 1);
1241
+ const f = this.uniformLocations.get("iTime");
1242
+ f && e.uniform1f(f, i);
1243
+ const h = this.uniformLocations.get("iTimeDelta");
1244
+ h && e.uniform1f(h, a);
1245
+ const p = this.uniformLocations.get("iFrame");
1246
+ p && e.uniform1i(p, this.frameCount);
1247
+ const y = this.uniformLocations.get("iMouse");
1248
+ y && e.uniform4f(y, this.mouseX, this.mouseY, this.mouseClickX, this.mouseClickY);
1249
+ const c = this.uniformLocations.get("iDate");
1250
+ if (c) {
1251
+ const l = /* @__PURE__ */ new Date();
1252
+ e.uniform4f(c, l.getFullYear(), l.getMonth(), l.getDate(), l.getHours() * 3600 + l.getMinutes() * 60 + l.getSeconds() + l.getMilliseconds() / 1e3);
1243
1253
  }
1244
- for (const [m, b] of Object.entries(this.customUniforms)) {
1245
- const g = this.uniformLocations.get(m);
1254
+ for (const [l, m] of Object.entries(this.customUniforms)) {
1255
+ const g = this.uniformLocations.get(l);
1246
1256
  if (g)
1247
- switch (b.type) {
1257
+ switch (m.type) {
1248
1258
  case "float":
1249
- e.uniform1f(g, b.value);
1259
+ e.uniform1f(g, m.value);
1250
1260
  break;
1251
1261
  case "vec2": {
1252
- const y = b.value;
1253
- e.uniform2f(g, y[0], y[1]);
1262
+ const b = m.value;
1263
+ e.uniform2f(g, b[0], b[1]);
1254
1264
  break;
1255
1265
  }
1256
1266
  case "vec3": {
1257
- const y = b.value;
1258
- e.uniform3f(g, y[0], y[1], y[2]);
1267
+ const b = m.value;
1268
+ e.uniform3f(g, b[0], b[1], b[2]);
1259
1269
  break;
1260
1270
  }
1261
1271
  case "vec4": {
1262
- const y = b.value;
1263
- e.uniform4f(g, y[0], y[1], y[2], y[3]);
1272
+ const b = m.value;
1273
+ e.uniform4f(g, b[0], b[1], b[2], b[3]);
1264
1274
  break;
1265
1275
  }
1266
1276
  case "int":
1267
- e.uniform1i(g, b.value);
1277
+ e.uniform1i(g, m.value);
1268
1278
  break;
1269
1279
  case "bool":
1270
- e.uniform1i(g, b.value ? 1 : 0);
1280
+ e.uniform1i(g, m.value ? 1 : 0);
1271
1281
  break;
1272
1282
  }
1273
1283
  }
@@ -1281,20 +1291,20 @@ class Wn {
1281
1291
  this.program && (e.deleteProgram(this.program), this.program = null), this.positionBuffer && (e.deleteBuffer(this.positionBuffer), this.positionBuffer = null), this.vao && (e.deleteVertexArray(this.vao), this.vao = null), this.uniformLocations.clear();
1282
1292
  }
1283
1293
  }
1284
- function qn(t) {
1294
+ function Hr(t) {
1285
1295
  if (typeof t == "string") {
1286
1296
  const e = t.trim();
1287
1297
  return e.length > 0 ? e : void 0;
1288
1298
  }
1289
1299
  if (Array.isArray(t)) {
1290
- const e = t.filter((n) => typeof n == "string").map((n) => n.trim()).filter(Boolean);
1300
+ const e = t.filter((r) => typeof r == "string").map((r) => r.trim()).filter(Boolean);
1291
1301
  return e.length > 0 ? e.join(" ") : void 0;
1292
1302
  }
1293
1303
  }
1294
- function Hn(...t) {
1304
+ function Gr(...t) {
1295
1305
  const e = [];
1296
- for (const n of t)
1297
- n && n.trim() && e.push(n.trim());
1306
+ for (const r of t)
1307
+ r && r.trim() && e.push(r.trim());
1298
1308
  return e.length > 0 ? e.join(" ") : void 0;
1299
1309
  }
1300
1310
  function Ie(t) {
@@ -1306,10 +1316,10 @@ function Ie(t) {
1306
1316
  return Math.floor(e);
1307
1317
  }
1308
1318
  }
1309
- function Gn(t) {
1319
+ function Jr(t) {
1310
1320
  return typeof t == "string" ? t : "";
1311
1321
  }
1312
- function Jn(t) {
1322
+ function Xr(t) {
1313
1323
  if (typeof t == "boolean")
1314
1324
  return t;
1315
1325
  if (typeof t == "string") {
@@ -1318,26 +1328,26 @@ function Jn(t) {
1318
1328
  if (e === "false") return !1;
1319
1329
  }
1320
1330
  }
1321
- function Xn(t) {
1331
+ function Zr(t) {
1322
1332
  if (!t || typeof t != "object")
1323
1333
  return {};
1324
- const e = {}, n = t;
1325
- for (const [r, o] of Object.entries(n)) {
1334
+ const e = {}, r = t;
1335
+ for (const [n, o] of Object.entries(r)) {
1326
1336
  if (!o || typeof o != "object")
1327
1337
  continue;
1328
1338
  const s = o, i = s.value, a = s.type;
1329
- i === void 0 || typeof a != "string" || !["float", "vec2", "vec3", "vec4", "int", "bool"].includes(a) || (e[r] = {
1339
+ i === void 0 || typeof a != "string" || !["float", "vec2", "vec3", "vec4", "int", "bool"].includes(a) || (e[n] = {
1330
1340
  value: i,
1331
1341
  type: a
1332
1342
  });
1333
1343
  }
1334
1344
  return e;
1335
1345
  }
1336
- function Zn(t, e) {
1337
- const n = Object.keys(t), r = Object.keys(e);
1338
- if (n.length !== r.length)
1346
+ function Qr(t, e) {
1347
+ const r = Object.keys(t), n = Object.keys(e);
1348
+ if (r.length !== n.length)
1339
1349
  return !1;
1340
- for (const o of n) {
1350
+ for (const o of r) {
1341
1351
  if (!(o in e))
1342
1352
  return !1;
1343
1353
  const s = t[o], i = e[o];
@@ -1354,168 +1364,168 @@ function Zn(t, e) {
1354
1364
  }
1355
1365
  return !0;
1356
1366
  }
1357
- const Qn = "std.shadertoy-canvas";
1358
- function er() {
1359
- const t = z(function({ nodeId: n, context: r, className: o }) {
1360
- const s = Z(r.store, n), i = v(null), a = v(null), c = v(null), p = v(0), f = v(""), l = v({}), u = v({
1367
+ const en = "std.shadertoy-canvas";
1368
+ function tn() {
1369
+ const t = z(function({ nodeId: r, context: n, className: o }) {
1370
+ const s = J(n.store, r), i = v(null), a = v(null), u = v(null), f = v(0), h = v(""), p = v({}), y = v({
1361
1371
  x: 0,
1362
1372
  y: 0,
1363
1373
  clickX: 0,
1364
1374
  clickY: 0,
1365
1375
  isDown: !1
1366
- }), d = s ? Gn(s.props?.shaderSource) : "", m = s ? Ie(s.props?.fps) ?? 60 : 60, b = s?.props?.uniforms, g = K(() => Xn(b), [b]), y = s ? Jn(s.props?.enableMouse) ?? !0 : !0, w = s ? Ie(s.props?.width) : void 0, T = s ? Ie(s.props?.height) : void 0, C = s ? Hn(qn(s.props?.className), o) : o;
1367
- N(() => {
1368
- const A = i.current;
1369
- if (A) {
1376
+ }), c = s ? Jr(s.props?.shaderSource) : "", l = s ? Ie(s.props?.fps) ?? 60 : 60, m = s?.props?.uniforms, g = $(() => Zr(m), [m]), b = s ? Xr(s.props?.enableMouse) ?? !0 : !0, S = s ? Ie(s.props?.width) : void 0, O = s ? Ie(s.props?.height) : void 0, _ = s ? Gr(Hr(s.props?.className), o) : o;
1377
+ P(() => {
1378
+ const T = i.current;
1379
+ if (T) {
1370
1380
  try {
1371
- const P = new Wn(A);
1372
- a.current = P;
1373
- } catch (P) {
1374
- console.error("[ShadertoyRenderer] Failed to create WebGL2 context:", P);
1381
+ const N = new qr(T);
1382
+ a.current = N;
1383
+ } catch (N) {
1384
+ console.error("[ShadertoyRenderer] Failed to create WebGL2 context:", N);
1375
1385
  }
1376
1386
  return () => {
1377
1387
  a.current && (a.current.destroy(), a.current = null);
1378
1388
  };
1379
1389
  }
1380
- }, []), N(() => {
1381
- const A = a.current;
1382
- if (!(!A || !d) && f.current !== d)
1383
- if (A.compile(d, g))
1384
- f.current = d, l.current = g;
1390
+ }, []), P(() => {
1391
+ const T = a.current;
1392
+ if (!(!T || !c) && h.current !== c)
1393
+ if (T.compile(c, g))
1394
+ h.current = c, p.current = g;
1385
1395
  else {
1386
- const U = A.getError();
1387
- console.error("[ShadertoyRenderer] Shader compilation failed:", U);
1396
+ const D = T.getError();
1397
+ console.error("[ShadertoyRenderer] Shader compilation failed:", D);
1388
1398
  }
1389
- }, [d, g]), N(() => {
1390
- const A = a.current;
1391
- !A || !f.current || Zn(l.current, g) || (A.setCustomUniforms(g), l.current = g);
1392
- }, [g]), N(() => {
1393
- const A = a.current;
1394
- if (!A || !f.current) return;
1395
- const P = 1e3 / m, U = (M) => {
1396
- const F = M - p.current;
1397
- F >= P && (p.current = M - F % P, A.draw()), c.current = requestAnimationFrame(U);
1399
+ }, [c, g]), P(() => {
1400
+ const T = a.current;
1401
+ !T || !h.current || Qr(p.current, g) || (T.setCustomUniforms(g), p.current = g);
1402
+ }, [g]), P(() => {
1403
+ const T = a.current;
1404
+ if (!T || !h.current) return;
1405
+ const N = 1e3 / l, D = (j) => {
1406
+ const B = j - f.current;
1407
+ B >= N && (f.current = j - B % N, T.draw()), u.current = requestAnimationFrame(D);
1398
1408
  };
1399
- return c.current = requestAnimationFrame(U), () => {
1400
- c.current !== null && (cancelAnimationFrame(c.current), c.current = null);
1409
+ return u.current = requestAnimationFrame(D), () => {
1410
+ u.current !== null && (cancelAnimationFrame(u.current), u.current = null);
1401
1411
  };
1402
- }, [m]);
1403
- const _ = D(
1404
- (A) => {
1405
- if (!y) return;
1406
- const P = i.current, U = a.current;
1407
- if (!P || !U) return;
1408
- const M = P.getBoundingClientRect(), F = A.clientX - M.left, W = M.height - (A.clientY - M.top);
1409
- u.current.x = F, u.current.y = W, U.setMouse(F, W, u.current.clickX, u.current.clickY);
1412
+ }, [l]);
1413
+ const M = U(
1414
+ (T) => {
1415
+ if (!b) return;
1416
+ const N = i.current, D = a.current;
1417
+ if (!N || !D) return;
1418
+ const j = N.getBoundingClientRect(), B = T.clientX - j.left, V = j.height - (T.clientY - j.top);
1419
+ y.current.x = B, y.current.y = V, D.setMouse(B, V, y.current.clickX, y.current.clickY);
1410
1420
  },
1411
- [y]
1412
- ), B = D(
1413
- (A) => {
1414
- if (!y) return;
1415
- const P = i.current, U = a.current;
1416
- if (!P || !U) return;
1417
- const M = P.getBoundingClientRect(), F = A.clientX - M.left, W = M.height - (A.clientY - M.top);
1418
- u.current.isDown = !0, u.current.clickX = F, u.current.clickY = W, U.setMouse(F, W, F, W);
1421
+ [b]
1422
+ ), L = U(
1423
+ (T) => {
1424
+ if (!b) return;
1425
+ const N = i.current, D = a.current;
1426
+ if (!N || !D) return;
1427
+ const j = N.getBoundingClientRect(), B = T.clientX - j.left, V = j.height - (T.clientY - j.top);
1428
+ y.current.isDown = !0, y.current.clickX = B, y.current.clickY = V, D.setMouse(B, V, B, V);
1419
1429
  },
1420
- [y]
1421
- ), Q = D(() => {
1422
- y && (u.current.isDown = !1, u.current.clickX = -Math.abs(u.current.clickX));
1423
- }, [y]);
1424
- return s ? /* @__PURE__ */ E.jsx(
1430
+ [b]
1431
+ ), G = U(() => {
1432
+ b && (y.current.isDown = !1, y.current.clickX = -Math.abs(y.current.clickX));
1433
+ }, [b]);
1434
+ return s ? /* @__PURE__ */ R.jsx(
1425
1435
  "canvas",
1426
1436
  {
1427
1437
  ref: i,
1428
1438
  "data-ikon-node-id": s.id,
1429
1439
  "data-ikon-source": s.sourceMarker,
1430
- className: C,
1431
- ...w ? { width: w } : {},
1432
- ...T ? { height: T } : {},
1433
- onMouseMove: _,
1434
- onMouseDown: B,
1435
- onMouseUp: Q,
1436
- onMouseLeave: Q
1440
+ className: _,
1441
+ ...S ? { width: S } : {},
1442
+ ...O ? { height: O } : {},
1443
+ onMouseMove: M,
1444
+ onMouseDown: L,
1445
+ onMouseUp: G,
1446
+ onMouseLeave: G
1437
1447
  }
1438
1448
  ) : null;
1439
1449
  });
1440
1450
  return ({ type: e }) => {
1441
- if (e === Qn)
1451
+ if (e === en)
1442
1452
  return t;
1443
1453
  };
1444
1454
  }
1445
- const tr = "shadertoy", nr = async () => er();
1446
- function rr(t) {
1447
- t.registerModule(tr, nr);
1455
+ const rn = "shadertoy", nn = async () => tn();
1456
+ function on(t) {
1457
+ t.registerModule(rn, nn);
1448
1458
  }
1449
- const ot = ke("UIRegistry");
1450
- class or {
1459
+ const nt = fe("UIRegistry");
1460
+ class sn {
1451
1461
  baseResolvers = [];
1452
1462
  moduleLoaders = /* @__PURE__ */ new Map();
1453
1463
  moduleResolvers = /* @__PURE__ */ new Map();
1454
1464
  activeModuleOrder = [];
1455
1465
  registerResolvers(e) {
1456
- const n = Array.isArray(e) ? e : [e];
1457
- this.baseResolvers.push(...n.filter(Boolean));
1466
+ const r = Array.isArray(e) ? e : [e];
1467
+ this.baseResolvers.push(...r.filter(Boolean));
1458
1468
  }
1459
- registerModule(e, n) {
1460
- const r = this.moduleLoaders.get(e);
1461
- if (!r) {
1462
- this.moduleLoaders.set(e, n);
1469
+ registerModule(e, r) {
1470
+ const n = this.moduleLoaders.get(e);
1471
+ if (!n) {
1472
+ this.moduleLoaders.set(e, r);
1463
1473
  return;
1464
1474
  }
1465
- r !== n && (this.moduleLoaders.set(e, n), this.moduleResolvers.delete(e));
1475
+ n !== r && (this.moduleLoaders.set(e, r), this.moduleResolvers.delete(e));
1466
1476
  }
1467
1477
  async loadRegisteredModules() {
1468
1478
  let e = !1;
1469
- for (const [r, o] of this.moduleLoaders.entries())
1470
- if (!this.moduleResolvers.has(r))
1479
+ for (const [n, o] of this.moduleLoaders.entries())
1480
+ if (!this.moduleResolvers.has(n))
1471
1481
  try {
1472
- const s = await o(), i = ar(s);
1473
- this.moduleResolvers.set(r, i), e = !0;
1482
+ const s = await o(), i = un(s);
1483
+ this.moduleResolvers.set(n, i), e = !0;
1474
1484
  } catch (s) {
1475
- ot.error(`[IkonUiRegistry] Failed to load module '${r}'.`, s);
1485
+ nt.error(`[IkonUiRegistry] Failed to load module '${n}'.`, s);
1476
1486
  }
1477
- const n = [];
1478
- for (const r of this.moduleLoaders.keys())
1479
- this.moduleResolvers.has(r) && n.push(r);
1480
- return cr(n, this.activeModuleOrder) || (this.activeModuleOrder = n, e = !0), e;
1487
+ const r = [];
1488
+ for (const n of this.moduleLoaders.keys())
1489
+ this.moduleResolvers.has(n) && r.push(n);
1490
+ return ln(r, this.activeModuleOrder) || (this.activeModuleOrder = r, e = !0), e;
1481
1491
  }
1482
1492
  resolve(e) {
1483
- for (const n of this.baseResolvers) {
1484
- const r = n(e);
1485
- if (r) return r;
1493
+ for (const r of this.baseResolvers) {
1494
+ const n = r(e);
1495
+ if (n) return n;
1486
1496
  }
1487
- for (const n of this.activeModuleOrder) {
1488
- const r = this.moduleResolvers.get(n);
1489
- if (!r) {
1490
- ot.warn(`Missing resolvers for module ${n}`);
1497
+ for (const r of this.activeModuleOrder) {
1498
+ const n = this.moduleResolvers.get(r);
1499
+ if (!n) {
1500
+ nt.warn(`Missing resolvers for module ${r}`);
1491
1501
  continue;
1492
1502
  }
1493
- for (const o of r) {
1503
+ for (const o of n) {
1494
1504
  const s = o(e);
1495
1505
  if (s) return s;
1496
1506
  }
1497
1507
  }
1498
1508
  }
1499
1509
  }
1500
- function sr() {
1501
- const t = new or();
1502
- return Nn(t), Vn(t), rr(t), t.loadRegisteredModules(), t;
1510
+ function an() {
1511
+ const t = new sn();
1512
+ return Nr(t), Kr(t), on(t), t.loadRegisteredModules(), t;
1503
1513
  }
1504
- function ir(t) {
1514
+ function cn(t) {
1505
1515
  return Array.isArray(t) ? t : [t];
1506
1516
  }
1507
- function ar(t) {
1508
- return t ? ir(t).flatMap((e) => e ? Array.isArray(e) ? e.filter(Boolean) : [e] : []) : [];
1517
+ function un(t) {
1518
+ return t ? cn(t).flatMap((e) => e ? Array.isArray(e) ? e.filter(Boolean) : [e] : []) : [];
1509
1519
  }
1510
- function cr(t, e) {
1520
+ function ln(t, e) {
1511
1521
  if (t.length !== e.length)
1512
1522
  return !1;
1513
- for (let n = 0; n < t.length; n += 1)
1514
- if (t[n] !== e[n])
1523
+ for (let r = 0; r < t.length; r += 1)
1524
+ if (t[r] !== e[r])
1515
1525
  return !1;
1516
1526
  return !0;
1517
1527
  }
1518
- const Oe = ke("MotionController"), st = {
1528
+ const _e = fe("MotionController"), ot = {
1519
1529
  ease: [0.25, 0.1, 0.25, 1],
1520
1530
  "ease-in": [0.42, 0, 1, 1],
1521
1531
  "ease-out": [0, 0, 0.58, 1],
@@ -1545,98 +1555,98 @@ const Oe = ke("MotionController"), st = {
1545
1555
  "ease-out-back": [0.175, 0.885, 0.32, 1.275],
1546
1556
  "ease-in-out-back": [0.68, -0.55, 0.265, 1.55]
1547
1557
  };
1548
- function $(t) {
1558
+ function F(t) {
1549
1559
  return t <= 0 ? 0 : t >= 1 ? 1 : t;
1550
1560
  }
1551
- function it(t) {
1561
+ function st(t) {
1552
1562
  if (t == null) return;
1553
1563
  const e = `${t}`.trim();
1554
1564
  if (!e) return;
1555
- const n = Number.parseFloat(e);
1556
- return Number.isFinite(n) ? n : void 0;
1565
+ const r = Number.parseFloat(e);
1566
+ return Number.isFinite(r) ? r : void 0;
1557
1567
  }
1558
- function at(t) {
1568
+ function it(t) {
1559
1569
  return typeof CSS < "u" && CSS.escape ? CSS.escape(t) : t.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
1560
1570
  }
1561
- function ct(t, e, n, r) {
1562
- const f = new Float32Array(11);
1563
- function l(g, y, w) {
1564
- return ((3 * y - 3 * w + 1) * g + (3 * w - 6 * y)) * g * g + 3 * y * g;
1565
- }
1566
- function u(g, y, w) {
1567
- return 3 * (3 * y - 3 * w + 1) * g * g + 2 * (3 * w - 6 * y) * g + 3 * y;
1568
- }
1569
- function d(g, y) {
1570
- for (let w = 0; w < 4; w += 1) {
1571
- const T = u(y, t, n);
1572
- if (T === 0)
1573
- return y;
1574
- const C = l(y, t, n) - g;
1575
- y -= C / T;
1571
+ function at(t, e, r, n) {
1572
+ const h = new Float32Array(11);
1573
+ function p(g, b, S) {
1574
+ return ((3 * b - 3 * S + 1) * g + (3 * S - 6 * b)) * g * g + 3 * b * g;
1575
+ }
1576
+ function y(g, b, S) {
1577
+ return 3 * (3 * b - 3 * S + 1) * g * g + 2 * (3 * S - 6 * b) * g + 3 * b;
1578
+ }
1579
+ function c(g, b) {
1580
+ for (let S = 0; S < 4; S += 1) {
1581
+ const O = y(b, t, r);
1582
+ if (O === 0)
1583
+ return b;
1584
+ const _ = p(b, t, r) - g;
1585
+ b -= _ / O;
1576
1586
  }
1577
- return y;
1587
+ return b;
1578
1588
  }
1579
- function m(g, y, w) {
1580
- let T = 0, C = 0, _ = 0;
1589
+ function l(g, b, S) {
1590
+ let O = 0, _ = 0, M = 0;
1581
1591
  do
1582
- C = y + (w - y) / 2, T = l(C, t, n) - g, T > 0 ? w = C : y = C;
1583
- while (Math.abs(T) > 1e-7 && ++_ < 10);
1584
- return C;
1585
- }
1586
- function b(g) {
1587
- let y = 0, w = 1;
1588
- const T = 10;
1589
- for (; w !== T && f[w] <= g; w += 1)
1590
- y += 0.1;
1591
- w -= 1;
1592
- const C = (g - f[w]) / (f[w + 1] - f[w]), _ = y + C * 0.1, B = u(_, t, n);
1593
- return B >= 1e-3 ? d(g, _) : B === 0 ? _ : m(g, y, y + 0.1);
1592
+ _ = b + (S - b) / 2, O = p(_, t, r) - g, O > 0 ? S = _ : b = _;
1593
+ while (Math.abs(O) > 1e-7 && ++M < 10);
1594
+ return _;
1595
+ }
1596
+ function m(g) {
1597
+ let b = 0, S = 1;
1598
+ const O = 10;
1599
+ for (; S !== O && h[S] <= g; S += 1)
1600
+ b += 0.1;
1601
+ S -= 1;
1602
+ const _ = (g - h[S]) / (h[S + 1] - h[S]), M = b + _ * 0.1, L = y(M, t, r);
1603
+ return L >= 1e-3 ? c(g, M) : L === 0 ? M : l(g, b, b + 0.1);
1594
1604
  }
1595
1605
  for (let g = 0; g < 11; g += 1)
1596
- f[g] = l(g * 0.1, t, n);
1597
- return (g) => g <= 0 ? 0 : g >= 1 ? 1 : l(b(g), e, r);
1606
+ h[g] = p(g * 0.1, t, r);
1607
+ return (g) => g <= 0 ? 0 : g >= 1 ? 1 : p(m(g), e, n);
1598
1608
  }
1599
- function ur(t) {
1609
+ function dn(t) {
1600
1610
  const e = /steps\(\s*([0-9]+)\s*(?:,\s*([a-z-]+)\s*)?\)/i.exec(t);
1601
1611
  if (!e)
1602
- return (o) => $(o);
1603
- const n = Math.max(1, parseInt(e[1], 10)), r = (e[2] ?? "end").toLowerCase();
1604
- return r === "start" || r === "jump-start" ? (o) => $(Math.ceil(o * n) / n) : r === "none" || r === "jump-none" ? (o) => $(Math.round(o * n) / n) : r === "both" || r === "jump-both" ? (o) => $((Math.floor(o * n) + 0.5) / n) : (o) => $(Math.floor(o * n) / n);
1612
+ return (o) => F(o);
1613
+ const r = Math.max(1, parseInt(e[1], 10)), n = (e[2] ?? "end").toLowerCase();
1614
+ return n === "start" || n === "jump-start" ? (o) => F(Math.ceil(o * r) / r) : n === "none" || n === "jump-none" ? (o) => F(Math.round(o * r) / r) : n === "both" || n === "jump-both" ? (o) => F((Math.floor(o * r) + 0.5) / r) : (o) => F(Math.floor(o * r) / r);
1605
1615
  }
1606
- function lr(t) {
1616
+ function fn(t) {
1607
1617
  if (!t)
1608
- return (n) => $(n);
1618
+ return (r) => F(r);
1609
1619
  const e = t.trim().toLowerCase();
1610
1620
  if (!e || e === "linear")
1611
- return (n) => $(n);
1612
- if (st[e]) {
1613
- const [n, r, o, s] = st[e], i = ct(n, r, o, s);
1614
- return (a) => $(i($(a)));
1621
+ return (r) => F(r);
1622
+ if (ot[e]) {
1623
+ const [r, n, o, s] = ot[e], i = at(r, n, o, s);
1624
+ return (a) => F(i(F(a)));
1615
1625
  }
1616
1626
  if (e.startsWith("cubic-bezier(") && e.endsWith(")")) {
1617
- const r = e.slice(13, -1).split(",").map((o) => Number.parseFloat(o.trim()));
1618
- if (r.length === 4 && r.every((o) => Number.isFinite(o))) {
1619
- const [o, s, i, a] = r, c = ct(o, s, i, a);
1620
- return (p) => $(c($(p)));
1627
+ const n = e.slice(13, -1).split(",").map((o) => Number.parseFloat(o.trim()));
1628
+ if (n.length === 4 && n.every((o) => Number.isFinite(o))) {
1629
+ const [o, s, i, a] = n, u = at(o, s, i, a);
1630
+ return (f) => F(u(F(f)));
1621
1631
  }
1622
1632
  }
1623
1633
  if (e.startsWith("steps(") && e.endsWith(")")) {
1624
- const n = ur(e);
1625
- return (r) => n($(r));
1634
+ const r = dn(e);
1635
+ return (n) => r(F(n));
1626
1636
  }
1627
- return (n) => $(n);
1637
+ return (r) => F(r);
1628
1638
  }
1629
- function dr(t) {
1639
+ function pn(t) {
1630
1640
  if (!t)
1631
1641
  return;
1632
1642
  const e = /(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)\s*->\s*(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)/.exec(t);
1633
1643
  if (!e)
1634
1644
  return;
1635
- const [n, r, o, s] = e.slice(1).map((i) => Number.parseFloat(i));
1636
- if (![n, r, o, s].some((i) => !Number.isFinite(i)))
1637
- return { inStart: n, inEnd: r, outStart: o, outEnd: s };
1645
+ const [r, n, o, s] = e.slice(1).map((i) => Number.parseFloat(i));
1646
+ if (![r, n, o, s].some((i) => !Number.isFinite(i)))
1647
+ return { inStart: r, inEnd: n, outStart: o, outEnd: s };
1638
1648
  }
1639
- class fr {
1649
+ class hn {
1640
1650
  bindingsByStyle = /* @__PURE__ */ new Map();
1641
1651
  observer;
1642
1652
  observeScheduled = !1;
@@ -1645,15 +1655,15 @@ class fr {
1645
1655
  elementStates = /* @__PURE__ */ new Map();
1646
1656
  styleToElements = /* @__PURE__ */ new Map();
1647
1657
  globalCleanups = /* @__PURE__ */ new Set();
1648
- registerStyle(e, n) {
1658
+ registerStyle(e, r) {
1649
1659
  if (!e)
1650
1660
  return;
1651
- const r = this.parseMetadata(n);
1652
- if (!r) {
1661
+ const n = this.parseMetadata(r);
1662
+ if (!n) {
1653
1663
  this.bindingsByStyle.delete(e), this.cleanupStyle(e);
1654
1664
  return;
1655
1665
  }
1656
- this.bindingsByStyle.set(e, r), this.cleanupStyle(e), this.ensureObserver(), this.scheduleScan(e);
1666
+ this.bindingsByStyle.set(e, n), this.cleanupStyle(e), this.ensureObserver(), this.scheduleScan(e);
1657
1667
  }
1658
1668
  unregisterStyle(e) {
1659
1669
  e && (this.bindingsByStyle.delete(e), this.cleanupStyle(e), this.pendingScanStyles.delete(e));
@@ -1662,42 +1672,42 @@ class fr {
1662
1672
  for (const e of Array.from(this.globalCleanups))
1663
1673
  try {
1664
1674
  e();
1665
- } catch (n) {
1666
- Oe.warn("Failed to cleanup binding listener", n);
1675
+ } catch (r) {
1676
+ _e.warn("Failed to cleanup binding listener", r);
1667
1677
  }
1668
1678
  this.globalCleanups.clear(), this.elementStates.clear(), this.styleToElements.clear(), this.bindingsByStyle.clear(), this.pendingScanStyles.clear(), this.scanScheduled = !1, this.observer && (this.observer.disconnect(), this.observer = void 0);
1669
1679
  }
1670
1680
  parseMetadata(e) {
1671
1681
  if (e)
1672
1682
  try {
1673
- const r = (JSON.parse(e).motionBindings ?? []).map((o) => this.parseBinding(o)).filter((o) => o !== void 0);
1674
- return r.length === 0 ? void 0 : { bindings: r };
1675
- } catch (n) {
1676
- Oe.warn("Failed to parse motion metadata", n);
1683
+ const n = (JSON.parse(e).motionBindings ?? []).map((o) => this.parseBinding(o)).filter((o) => o !== void 0);
1684
+ return n.length === 0 ? void 0 : { bindings: n };
1685
+ } catch (r) {
1686
+ _e.warn("Failed to parse motion metadata", r);
1677
1687
  return;
1678
1688
  }
1679
1689
  }
1680
1690
  parseBinding(e) {
1681
- const n = e.source?.trim();
1682
- if (!n)
1691
+ const r = e.source?.trim();
1692
+ if (!r)
1683
1693
  return;
1684
- const r = it(e.min) ?? 0, o = it(e.max), s = o === void 0 ? r + 100 : o, i = (e.clamp ?? "clamp").trim().toLowerCase(), a = !!e.reverse, c = lr(e.ease), p = dr(e.map), f = e.targetId?.trim() || void 0;
1685
- return Number.isNaN(r) || Number.isNaN(s) ? void 0 : {
1686
- source: n.toLowerCase(),
1687
- min: r,
1694
+ const n = st(e.min) ?? 0, o = st(e.max), s = o === void 0 ? n + 100 : o, i = (e.clamp ?? "clamp").trim().toLowerCase(), a = !!e.reverse, u = fn(e.ease), f = pn(e.map), h = e.targetId?.trim() || void 0;
1695
+ return Number.isNaN(n) || Number.isNaN(s) ? void 0 : {
1696
+ source: r.toLowerCase(),
1697
+ min: n,
1688
1698
  max: s,
1689
1699
  clamp: i === "freeze-start" || i === "freeze-end" || i === "unclamped" ? i : "clamp",
1690
1700
  reverse: a,
1691
- ease: c,
1692
- map: p,
1693
- targetId: f
1701
+ ease: u,
1702
+ map: f,
1703
+ targetId: h
1694
1704
  };
1695
1705
  }
1696
1706
  ensureObserver() {
1697
1707
  if (typeof document > "u" || this.observer)
1698
1708
  return;
1699
1709
  const e = () => {
1700
- this.observer || typeof document > "u" || (this.observer = new MutationObserver((n) => this.handleMutations(n)), this.observer.observe(document.body, {
1710
+ this.observer || typeof document > "u" || (this.observer = new MutationObserver((r) => this.handleMutations(r)), this.observer.observe(document.body, {
1701
1711
  childList: !0,
1702
1712
  subtree: !0,
1703
1713
  attributes: !0,
@@ -1715,7 +1725,7 @@ class fr {
1715
1725
  scheduleScan(e) {
1716
1726
  if (typeof document > "u" || (this.pendingScanStyles.add(e), this.scanScheduled))
1717
1727
  return;
1718
- const n = () => {
1728
+ const r = () => {
1719
1729
  if (this.pendingScanStyles.size === 0) {
1720
1730
  this.scanScheduled = !1;
1721
1731
  return;
@@ -1724,82 +1734,82 @@ class fr {
1724
1734
  this.pendingScanStyles.clear(), this.scanScheduled = !1;
1725
1735
  for (const s of o)
1726
1736
  this.scanExistingNodes(s);
1727
- }, r = () => {
1728
- this.scanScheduled = !0, typeof queueMicrotask == "function" ? queueMicrotask(n) : setTimeout(n, 0);
1737
+ }, n = () => {
1738
+ this.scanScheduled = !0, typeof queueMicrotask == "function" ? queueMicrotask(r) : setTimeout(r, 0);
1729
1739
  };
1730
1740
  document.readyState === "loading" ? document.addEventListener(
1731
1741
  "DOMContentLoaded",
1732
1742
  () => {
1733
- r();
1743
+ n();
1734
1744
  },
1735
1745
  { once: !0 }
1736
- ) : r();
1746
+ ) : n();
1737
1747
  }
1738
1748
  scanExistingNodes(e) {
1739
- const n = this.bindingsByStyle.get(e);
1740
- if (!n || typeof document > "u")
1749
+ const r = this.bindingsByStyle.get(e);
1750
+ if (!r || typeof document > "u")
1741
1751
  return;
1742
- const r = `.${at(e)}`;
1743
- document.querySelectorAll(r).forEach((s) => this.applyStyleToElement(s, e, n));
1752
+ const n = `.${it(e)}`;
1753
+ document.querySelectorAll(n).forEach((s) => this.applyStyleToElement(s, e, r));
1744
1754
  }
1745
- applyStyleToElement(e, n, r) {
1746
- this.ensureStyleState(e, n) && this.attachBindings(e, n, r);
1755
+ applyStyleToElement(e, r, n) {
1756
+ this.ensureStyleState(e, r) && this.attachBindings(e, r, n);
1747
1757
  }
1748
- ensureStyleState(e, n) {
1749
- let r = this.elementStates.get(e);
1750
- if (r || (r = /* @__PURE__ */ new Map(), this.elementStates.set(e, r)), r.has(n))
1758
+ ensureStyleState(e, r) {
1759
+ let n = this.elementStates.get(e);
1760
+ if (n || (n = /* @__PURE__ */ new Map(), this.elementStates.set(e, n)), n.has(r))
1751
1761
  return !1;
1752
- r.set(n, /* @__PURE__ */ new Set());
1753
- let o = this.styleToElements.get(n);
1754
- return o || (o = /* @__PURE__ */ new Set(), this.styleToElements.set(n, o)), o.add(e), !0;
1762
+ n.set(r, /* @__PURE__ */ new Set());
1763
+ let o = this.styleToElements.get(r);
1764
+ return o || (o = /* @__PURE__ */ new Set(), this.styleToElements.set(r, o)), o.add(e), !0;
1755
1765
  }
1756
- attachBindings(e, n, r) {
1757
- for (const o of r.bindings)
1758
- this.attachBinding(e, n, o);
1766
+ attachBindings(e, r, n) {
1767
+ for (const o of n.bindings)
1768
+ this.attachBinding(e, r, o);
1759
1769
  }
1760
- attachBinding(e, n, r) {
1761
- switch (r.source) {
1770
+ attachBinding(e, r, n) {
1771
+ switch (n.source) {
1762
1772
  case "scrolly":
1763
- this.attachScrollBinding(e, n, r);
1773
+ this.attachScrollBinding(e, r, n);
1764
1774
  break;
1765
1775
  }
1766
1776
  }
1767
- attachScrollBinding(e, n, r) {
1768
- const o = this.resolveScrollContainer(e, r);
1777
+ attachScrollBinding(e, r, n) {
1778
+ const o = this.resolveScrollContainer(e, n);
1769
1779
  if (!o)
1770
1780
  return;
1771
1781
  const s = () => {
1772
- this.applyBindingValues(e, r, o.scrollTop);
1782
+ this.applyBindingValues(e, n, o.scrollTop);
1773
1783
  };
1774
1784
  s();
1775
1785
  const i = new AbortController();
1776
- o.addEventListener("scroll", s, { passive: !0, signal: i.signal }), this.registerCleanup(e, n, () => i.abort());
1786
+ o.addEventListener("scroll", s, { passive: !0, signal: i.signal }), this.registerCleanup(e, r, () => i.abort());
1777
1787
  const a = () => s();
1778
- window.addEventListener("resize", a), this.registerCleanup(e, n, () => window.removeEventListener("resize", a));
1788
+ window.addEventListener("resize", a), this.registerCleanup(e, r, () => window.removeEventListener("resize", a));
1779
1789
  }
1780
- resolveScrollContainer(e, n) {
1781
- if (n.targetId) {
1782
- const r = `[data-ikon-motion-source="${at(n.targetId)}"]`, o = typeof document < "u" ? document.querySelector(r) : null;
1790
+ resolveScrollContainer(e, r) {
1791
+ if (r.targetId) {
1792
+ const n = `[data-ikon-motion-source="${it(r.targetId)}"]`, o = typeof document < "u" ? document.querySelector(n) : null;
1783
1793
  if (o)
1784
1794
  return o;
1785
1795
  }
1786
1796
  return e.closest('[data-ikon-view-type="scroll-view"]');
1787
1797
  }
1788
- applyBindingValues(e, n, r) {
1789
- const o = n.max - n.min, s = o === 0 ? r > n.min ? 1 : 0 : (r - n.min) / o;
1790
- let i = this.applyClamp(s, n.clamp);
1791
- n.reverse && (i = 1 - i);
1792
- const a = n.ease(i), c = Number.isFinite(a) ? a : 0, p = c * 100;
1793
- if (e.style.setProperty("--tw-motion-bind-source-value", `${r}`), e.style.setProperty("--tw-motion-bind-progress-ratio", `${c}`), e.style.setProperty("--tw-motion-bind-progress", `${p}`), n.map) {
1794
- const f = this.applyMap(p, n.map);
1795
- f !== void 0 && e.style.setProperty("--tw-motion-bind-value", `${f}`);
1798
+ applyBindingValues(e, r, n) {
1799
+ const o = r.max - r.min, s = o === 0 ? n > r.min ? 1 : 0 : (n - r.min) / o;
1800
+ let i = this.applyClamp(s, r.clamp);
1801
+ r.reverse && (i = 1 - i);
1802
+ const a = r.ease(i), u = Number.isFinite(a) ? a : 0, f = u * 100;
1803
+ if (e.style.setProperty("--tw-motion-bind-source-value", `${n}`), e.style.setProperty("--tw-motion-bind-progress-ratio", `${u}`), e.style.setProperty("--tw-motion-bind-progress", `${f}`), r.map) {
1804
+ const h = this.applyMap(f, r.map);
1805
+ h !== void 0 && e.style.setProperty("--tw-motion-bind-value", `${h}`);
1796
1806
  } else
1797
1807
  e.style.removeProperty("--tw-motion-bind-value");
1798
1808
  }
1799
- applyClamp(e, n) {
1809
+ applyClamp(e, r) {
1800
1810
  if (!Number.isFinite(e))
1801
1811
  return 0;
1802
- switch (n) {
1812
+ switch (r) {
1803
1813
  case "freeze-start":
1804
1814
  return e < 0 ? 0 : e;
1805
1815
  case "freeze-end":
@@ -1807,265 +1817,265 @@ class fr {
1807
1817
  case "unclamped":
1808
1818
  return e;
1809
1819
  default:
1810
- return $(e);
1820
+ return F(e);
1811
1821
  }
1812
1822
  }
1813
- applyMap(e, n) {
1814
- const r = n.inEnd - n.inStart;
1815
- if (r === 0)
1816
- return n.outEnd;
1817
- const o = (e - n.inStart) / r;
1818
- return n.outStart + o * (n.outEnd - n.outStart);
1823
+ applyMap(e, r) {
1824
+ const n = r.inEnd - r.inStart;
1825
+ if (n === 0)
1826
+ return r.outEnd;
1827
+ const o = (e - r.inStart) / n;
1828
+ return r.outStart + o * (r.outEnd - r.outStart);
1819
1829
  }
1820
- registerCleanup(e, n, r) {
1821
- const s = this.elementStates.get(e)?.get(n);
1822
- s && (s.add(r), this.globalCleanups.add(r));
1830
+ registerCleanup(e, r, n) {
1831
+ const s = this.elementStates.get(e)?.get(r);
1832
+ s && (s.add(n), this.globalCleanups.add(n));
1823
1833
  }
1824
1834
  cleanupStyle(e) {
1825
- const n = this.styleToElements.get(e);
1826
- if (!n)
1835
+ const r = this.styleToElements.get(e);
1836
+ if (!r)
1827
1837
  return;
1828
- const r = Array.from(n);
1829
- for (const o of r)
1838
+ const n = Array.from(r);
1839
+ for (const o of n)
1830
1840
  this.cleanupElementStyle(o, e);
1831
1841
  this.styleToElements.delete(e);
1832
1842
  }
1833
1843
  cleanupElement(e) {
1834
- const n = this.elementStates.get(e);
1835
- if (!n)
1844
+ const r = this.elementStates.get(e);
1845
+ if (!r)
1836
1846
  return;
1837
- const r = Array.from(n.keys());
1838
- for (const o of r)
1847
+ const n = Array.from(r.keys());
1848
+ for (const o of n)
1839
1849
  this.cleanupElementStyle(e, o);
1840
1850
  }
1841
- cleanupElementStyle(e, n) {
1842
- const r = this.elementStates.get(e);
1843
- if (!r)
1851
+ cleanupElementStyle(e, r) {
1852
+ const n = this.elementStates.get(e);
1853
+ if (!n)
1844
1854
  return;
1845
- const o = r.get(n);
1855
+ const o = n.get(r);
1846
1856
  if (!o)
1847
1857
  return;
1848
1858
  for (const i of o) {
1849
1859
  try {
1850
1860
  i();
1851
1861
  } catch (a) {
1852
- Oe.warn("Failed to cleanup listener", a);
1862
+ _e.warn("Failed to cleanup listener", a);
1853
1863
  }
1854
1864
  this.globalCleanups.delete(i);
1855
1865
  }
1856
- o.clear(), r.delete(n);
1857
- const s = this.styleToElements.get(n);
1858
- s && (s.delete(e), s.size === 0 && this.styleToElements.delete(n)), r.size === 0 && (this.elementStates.delete(e), this.clearBindingProperties(e));
1866
+ o.clear(), n.delete(r);
1867
+ const s = this.styleToElements.get(r);
1868
+ s && (s.delete(e), s.size === 0 && this.styleToElements.delete(r)), n.size === 0 && (this.elementStates.delete(e), this.clearBindingProperties(e));
1859
1869
  }
1860
1870
  clearBindingProperties(e) {
1861
1871
  e.style.removeProperty("--tw-motion-bind-source-value"), e.style.removeProperty("--tw-motion-bind-progress"), e.style.removeProperty("--tw-motion-bind-progress-ratio"), e.style.removeProperty("--tw-motion-bind-value");
1862
1872
  }
1863
1873
  handleMutations(e) {
1864
- for (const n of e)
1865
- n.type === "childList" ? (n.addedNodes.forEach((r) => this.scanNode(r)), n.removedNodes.forEach((r) => this.cleanupNode(r))) : n.type === "attributes" && n.target instanceof HTMLElement && this.handleClassMutation(n.target);
1874
+ for (const r of e)
1875
+ r.type === "childList" ? (r.addedNodes.forEach((n) => this.scanNode(n)), r.removedNodes.forEach((n) => this.cleanupNode(n))) : r.type === "attributes" && r.target instanceof HTMLElement && this.handleClassMutation(r.target);
1866
1876
  }
1867
1877
  handleClassMutation(e) {
1868
- const n = this.elementStates.get(e);
1869
- if (!n) {
1878
+ const r = this.elementStates.get(e);
1879
+ if (!r) {
1870
1880
  this.processElement(e);
1871
1881
  return;
1872
1882
  }
1873
- for (const r of n.keys())
1874
- e.classList.contains(r) || this.cleanupElementStyle(e, r);
1883
+ for (const n of r.keys())
1884
+ e.classList.contains(n) || this.cleanupElementStyle(e, n);
1875
1885
  this.processElement(e);
1876
1886
  }
1877
1887
  scanNode(e) {
1878
1888
  if (!(e instanceof HTMLElement))
1879
1889
  return;
1880
- this.processElement(e), e.querySelectorAll("[class]").forEach((r) => this.processElement(r));
1890
+ this.processElement(e), e.querySelectorAll("[class]").forEach((n) => this.processElement(n));
1881
1891
  }
1882
1892
  cleanupNode(e) {
1883
1893
  if (!(e instanceof HTMLElement))
1884
1894
  return;
1885
- this.cleanupElement(e), e.querySelectorAll("[class]").forEach((r) => this.cleanupElement(r));
1895
+ this.cleanupElement(e), e.querySelectorAll("[class]").forEach((n) => this.cleanupElement(n));
1886
1896
  }
1887
1897
  processElement(e) {
1888
1898
  if (!e.classList || e.classList.length === 0)
1889
1899
  return;
1890
- const n = e.classList;
1891
- for (let r = 0; r < n.length; r++) {
1892
- const o = n[r], s = this.bindingsByStyle.get(o);
1900
+ const r = e.classList;
1901
+ for (let n = 0; n < r.length; n++) {
1902
+ const o = r[n], s = this.bindingsByStyle.get(o);
1893
1903
  s && this.ensureStyleState(e, o) && this.attachBindings(e, o, s);
1894
1904
  }
1895
1905
  }
1896
1906
  }
1897
- const Ne = new fr();
1898
- function pr(t) {
1899
- const e = v(/* @__PURE__ */ new Map()), n = D(({ styleId: s, css: i, common: a }) => {
1907
+ const Oe = new hn();
1908
+ function mn(t) {
1909
+ const e = v(/* @__PURE__ */ new Map()), r = U(({ styleId: s, css: i, common: a }) => {
1900
1910
  if (!(!s || typeof document > "u")) {
1901
1911
  if (i) {
1902
- let c = e.current.get(s);
1903
- c || (c = document.createElement("style"), c.setAttribute("data-ikon-style-id", s), document.head.appendChild(c), e.current.set(s, c)), c.textContent = i;
1912
+ let u = e.current.get(s);
1913
+ u || (u = document.createElement("style"), u.setAttribute("data-ikon-style-id", s), document.head.appendChild(u), e.current.set(s, u)), u.textContent = i;
1904
1914
  }
1905
- Ne.registerStyle(s, a);
1915
+ Oe.registerStyle(s, a);
1906
1916
  }
1907
- }, []), r = D((s) => {
1917
+ }, []), n = U((s) => {
1908
1918
  if (!(typeof document > "u"))
1909
1919
  for (const i of s) {
1910
1920
  const a = e.current.get(i);
1911
- a && (a.remove(), e.current.delete(i)), Ne.unregisterStyle(i);
1921
+ a && (a.remove(), e.current.delete(i)), Oe.unregisterStyle(i);
1912
1922
  }
1913
- }, []), o = D(() => {
1923
+ }, []), o = U(() => {
1914
1924
  if (typeof document < "u") {
1915
1925
  for (const s of e.current.values())
1916
1926
  s.remove();
1917
1927
  e.current.clear();
1918
1928
  }
1919
- Ne.reset();
1929
+ Oe.reset();
1920
1930
  }, []);
1921
- return N(() => {
1931
+ return P(() => {
1922
1932
  if (!t) return;
1923
1933
  for (const a of t.getUiStyles())
1924
- n(a);
1925
- const s = t.subscribeToStyles(n), i = t.subscribeToStyleDeletes?.(r);
1934
+ r(a);
1935
+ const s = t.subscribeToStyles(r), i = t.subscribeToStyleDeletes?.(n);
1926
1936
  return () => {
1927
1937
  s?.(), i?.(), o();
1928
1938
  };
1929
- }, [t, o, n, r]), N(() => () => o(), [o]), { setStyle: n, deleteStyles: r, reset: o };
1939
+ }, [t, o, r, n]), P(() => () => o(), [o]), { setStyle: r, deleteStyles: n, reset: o };
1930
1940
  }
1931
- function hr(t) {
1941
+ function gn(t) {
1932
1942
  const e = [];
1933
- for (const [n, r] of t) {
1934
- const o = r.store.getSnapshot(), s = o.rootViewId && o.views.has(o.rootViewId);
1935
- e.push(`${n}:${s ? "1" : "0"}`);
1943
+ for (const [r, n] of t) {
1944
+ const o = n.store.getSnapshot(), s = o.rootViewId && o.views.has(o.rootViewId);
1945
+ e.push(`${r}:${s ? "1" : "0"}`);
1936
1946
  }
1937
1947
  return e.sort(), e.join(",");
1938
1948
  }
1939
- function mr(t) {
1940
- const [e, n] = Y(), r = v("");
1941
- return N(() => {
1949
+ function yn(t) {
1950
+ const [e, r] = q(), n = v("");
1951
+ return P(() => {
1942
1952
  if (!t) {
1943
- n(void 0), r.current = "";
1953
+ r(void 0), n.current = "";
1944
1954
  return;
1945
1955
  }
1946
1956
  const o = () => {
1947
- const s = t.getStores(), i = hr(s);
1948
- i !== r.current && (r.current = i, n(s));
1957
+ const s = t.getStores(), i = gn(s);
1958
+ i !== n.current && (n.current = i, r(s));
1949
1959
  };
1950
1960
  return o(), t.subscribe(o);
1951
1961
  }, [t]), e;
1952
1962
  }
1953
- var gr = typeof global == "object" && global && global.Object === Object && global, yr = typeof self == "object" && self && self.Object === Object && self, br = gr || yr || Function("return this")(), ve = br.Symbol, Et = Object.prototype, Sr = Et.hasOwnProperty, wr = Et.toString, le = ve ? ve.toStringTag : void 0;
1954
- function vr(t) {
1955
- var e = Sr.call(t, le), n = t[le];
1963
+ var bn = typeof global == "object" && global && global.Object === Object && global, Sn = typeof self == "object" && self && self.Object === Object && self, wn = bn || Sn || Function("return this")(), ke = wn.Symbol, vt = Object.prototype, vn = vt.hasOwnProperty, En = vt.toString, ue = ke ? ke.toStringTag : void 0;
1964
+ function Rn(t) {
1965
+ var e = vn.call(t, ue), r = t[ue];
1956
1966
  try {
1957
- t[le] = void 0;
1958
- var r = !0;
1967
+ t[ue] = void 0;
1968
+ var n = !0;
1959
1969
  } catch {
1960
1970
  }
1961
- var o = wr.call(t);
1962
- return r && (e ? t[le] = n : delete t[le]), o;
1971
+ var o = En.call(t);
1972
+ return n && (e ? t[ue] = r : delete t[ue]), o;
1963
1973
  }
1964
- var Er = Object.prototype, Rr = Er.toString;
1965
- function kr(t) {
1966
- return Rr.call(t);
1974
+ var kn = Object.prototype, An = kn.toString;
1975
+ function Tn(t) {
1976
+ return An.call(t);
1967
1977
  }
1968
- var Ar = "[object Null]", Tr = "[object Undefined]", ut = ve ? ve.toStringTag : void 0;
1969
- function Cr(t) {
1970
- return t == null ? t === void 0 ? Tr : Ar : ut && ut in Object(t) ? vr(t) : kr(t);
1978
+ var Cn = "[object Null]", In = "[object Undefined]", ct = ke ? ke.toStringTag : void 0;
1979
+ function _n(t) {
1980
+ return t == null ? t === void 0 ? In : Cn : ct && ct in Object(t) ? Rn(t) : Tn(t);
1971
1981
  }
1972
- function Ir(t) {
1982
+ function On(t) {
1973
1983
  return t != null && typeof t == "object";
1974
1984
  }
1975
- var Or = Array.isArray, Nr = "[object String]";
1976
- function _r(t) {
1977
- return typeof t == "string" || !Or(t) && Ir(t) && Cr(t) == Nr;
1985
+ var Nn = Array.isArray, Pn = "[object String]";
1986
+ function Mn(t) {
1987
+ return typeof t == "string" || !Nn(t) && On(t) && _n(t) == Pn;
1978
1988
  }
1979
- const lt = "ikonUiModules";
1980
- function Fe(t) {
1989
+ const ut = "ikonUiModules";
1990
+ function Be(t) {
1981
1991
  return typeof t == "object" && t !== null && !Array.isArray(t);
1982
1992
  }
1983
- function Pr(t) {
1993
+ function Ln(t) {
1984
1994
  if (!Array.isArray(t))
1985
1995
  return;
1986
1996
  const e = /* @__PURE__ */ new Set();
1987
- for (const n of t) {
1988
- if (!_r(n)) continue;
1989
- const r = n.trim();
1990
- r && (e.has(r) || e.add(r));
1997
+ for (const r of t) {
1998
+ if (!Mn(r)) continue;
1999
+ const n = r.trim();
2000
+ n && (e.has(n) || e.add(n));
1991
2001
  }
1992
2002
  return Array.from(e);
1993
2003
  }
1994
- function xo(t, e) {
2004
+ function Bo(t, e) {
1995
2005
  if (t === e)
1996
2006
  return !0;
1997
2007
  if (!t || !e)
1998
2008
  return !t && !e;
1999
2009
  if (t.length !== e.length)
2000
2010
  return !1;
2001
- for (let n = 0; n < t.length; n += 1)
2002
- if (t[n] !== e[n])
2011
+ for (let r = 0; r < t.length; r += 1)
2012
+ if (t[r] !== e[r])
2003
2013
  return !1;
2004
2014
  return !0;
2005
2015
  }
2006
- function Mr(t) {
2007
- if (!(!Fe(t) || !Object.prototype.hasOwnProperty.call(t, lt)))
2008
- return Pr(t[lt]);
2016
+ function xn(t) {
2017
+ if (!(!Be(t) || !Object.prototype.hasOwnProperty.call(t, ut)))
2018
+ return Ln(t[ut]);
2009
2019
  }
2010
- function jo(...t) {
2020
+ function Fo(...t) {
2011
2021
  for (const e of t) {
2012
- const n = Mr(e);
2013
- if (n !== void 0)
2014
- return n;
2022
+ const r = xn(e);
2023
+ if (r !== void 0)
2024
+ return r;
2015
2025
  }
2016
2026
  }
2017
- function Uo(t) {
2018
- if (!Fe(t))
2027
+ function $o(t) {
2028
+ if (!Be(t))
2019
2029
  return;
2020
- const e = t, n = Object.keys(e).find((c) => c.toLowerCase() === "modules");
2021
- if (!n)
2030
+ const e = t, r = Object.keys(e).find((u) => u.toLowerCase() === "modules");
2031
+ if (!r)
2022
2032
  return;
2023
- const r = e[n];
2024
- if (r === null)
2033
+ const n = e[r];
2034
+ if (n === null)
2025
2035
  return { resetToDefault: !0 };
2026
- if (!Array.isArray(r))
2036
+ if (!Array.isArray(n))
2027
2037
  return;
2028
2038
  const o = [], s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
2029
- for (const c of r) {
2030
- if (typeof c == "string") {
2031
- const b = c.trim();
2032
- if (!b || i.has(b))
2039
+ for (const u of n) {
2040
+ if (typeof u == "string") {
2041
+ const m = u.trim();
2042
+ if (!m || i.has(m))
2033
2043
  continue;
2034
- o.push(b), i.add(b);
2044
+ o.push(m), i.add(m);
2035
2045
  continue;
2036
2046
  }
2037
- if (!Fe(c))
2047
+ if (!Be(u))
2038
2048
  continue;
2039
- const p = c, f = Object.keys(p).find((b) => b.toLowerCase() === "name");
2040
- if (!f)
2049
+ const f = u, h = Object.keys(f).find((m) => m.toLowerCase() === "name");
2050
+ if (!h)
2041
2051
  continue;
2042
- const l = p[f];
2043
- if (typeof l != "string")
2052
+ const p = f[h];
2053
+ if (typeof p != "string")
2044
2054
  continue;
2045
- const u = l.trim();
2046
- if (!u)
2055
+ const y = p.trim();
2056
+ if (!y)
2047
2057
  continue;
2048
- const d = Object.keys(p).find((b) => b.toLowerCase() === "javascript"), m = d ? p[d] : void 0;
2049
- typeof m == "string" && s.set(u, m), i.has(u) || (o.push(u), i.add(u));
2058
+ const c = Object.keys(f).find((m) => m.toLowerCase() === "javascript"), l = c ? f[c] : void 0;
2059
+ typeof l == "string" && s.set(y, l), i.has(y) || (o.push(y), i.add(y));
2050
2060
  }
2051
2061
  if (!o.length && s.size === 0)
2052
2062
  return { modules: [] };
2053
- const a = Array.from(s.entries()).map(([c, p]) => ({
2054
- name: c,
2055
- javascript: p
2063
+ const a = Array.from(s.entries()).map(([u, f]) => ({
2064
+ name: u,
2065
+ javascript: f
2056
2066
  }));
2057
2067
  return a.length > 0 ? { modules: o, inlineModules: a } : { modules: o };
2058
2068
  }
2059
- const R = {
2069
+ const k = {
2060
2070
  None: 0,
2061
2071
  Letter: 1,
2062
2072
  Word: 2,
2063
2073
  Line: 4,
2064
2074
  Paragraph: 8,
2065
2075
  Emoji: 16
2066
- }, Lr = [
2076
+ }, Un = [
2067
2077
  {
2068
- flag: R.Letter,
2078
+ flag: k.Letter,
2069
2079
  hints: [
2070
2080
  "[data-motion-letter]",
2071
2081
  "[data-letter]",
@@ -2074,7 +2084,7 @@ const R = {
2074
2084
  ]
2075
2085
  },
2076
2086
  {
2077
- flag: R.Word,
2087
+ flag: k.Word,
2078
2088
  hints: [
2079
2089
  "[data-motion-word]",
2080
2090
  "[data-word]",
@@ -2083,7 +2093,7 @@ const R = {
2083
2093
  ]
2084
2094
  },
2085
2095
  {
2086
- flag: R.Line,
2096
+ flag: k.Line,
2087
2097
  hints: [
2088
2098
  "[data-motion-line]",
2089
2099
  "[data-line]",
@@ -2092,7 +2102,7 @@ const R = {
2092
2102
  ]
2093
2103
  },
2094
2104
  {
2095
- flag: R.Paragraph,
2105
+ flag: k.Paragraph,
2096
2106
  hints: [
2097
2107
  "[data-motion-paragraph]",
2098
2108
  "[data-paragraph]",
@@ -2103,7 +2113,7 @@ const R = {
2103
2113
  ]
2104
2114
  },
2105
2115
  {
2106
- flag: R.Emoji,
2116
+ flag: k.Emoji,
2107
2117
  hints: [
2108
2118
  ":is([data-motion-emoji],[data-emoji],.tw-motion-emoji,.tw-emoji)",
2109
2119
  "[data-motion-emoji]",
@@ -2112,160 +2122,160 @@ const R = {
2112
2122
  "[data-emoji]"
2113
2123
  ]
2114
2124
  }
2115
- ], $e = R.Letter | R.Word | R.Line | R.Paragraph | R.Emoji, xr = R.Letter | R.Word | R.Line | R.Paragraph, dt = /* @__PURE__ */ new Map(), jr = 16384;
2116
- function Do(t, e) {
2117
- if (!t || t.length > jr)
2125
+ ], Fe = k.Letter | k.Word | k.Line | k.Paragraph | k.Emoji, jn = k.Letter | k.Word | k.Line | k.Paragraph, lt = /* @__PURE__ */ new Map(), Dn = 16384;
2126
+ function Vo(t, e) {
2127
+ if (!t || t.length > Dn)
2118
2128
  return t;
2119
- const n = Qr(e), r = se(n, R.Emoji), o = n & xr;
2120
- if (o === R.None && !r)
2129
+ const r = to(e), n = re(r, k.Emoji), o = r & jn;
2130
+ if (o === k.None && !n)
2121
2131
  return t;
2122
2132
  const s = t.replace(/\r\n/g, `
2123
2133
  `).replace(/\r/g, `
2124
2134
  `);
2125
- if (o === R.None)
2126
- return mt(s);
2127
- const i = Xr(s);
2135
+ if (o === k.None)
2136
+ return ht(s);
2137
+ const i = Qn(s);
2128
2138
  if (i.length === 0)
2129
- return r ? mt(s) : t;
2130
- const a = Zr(i), c = { letter: 0, word: 0, line: 0, paragraph: 0, br: 0, emoji: 0 }, p = [];
2131
- for (const f of a) {
2132
- const l = Ur(f, n, c);
2133
- p.push(...l);
2139
+ return n ? ht(s) : t;
2140
+ const a = eo(i), u = { letter: 0, word: 0, line: 0, paragraph: 0, br: 0, emoji: 0 }, f = [];
2141
+ for (const h of a) {
2142
+ const p = Bn(h, r, u);
2143
+ f.push(...p);
2134
2144
  }
2135
- return p;
2145
+ return f;
2136
2146
  }
2137
- function Ur(t, e, n) {
2138
- const r = [];
2147
+ function Bn(t, e, r) {
2148
+ const n = [];
2139
2149
  for (const o of t) {
2140
- const s = Dr(o, e, n);
2141
- r.push(...s);
2150
+ const s = Fn(o, e, r);
2151
+ n.push(...s);
2142
2152
  }
2143
- if (se(e, R.Paragraph)) {
2144
- const o = n.paragraph++;
2153
+ if (re(e, k.Paragraph)) {
2154
+ const o = r.paragraph++;
2145
2155
  return [
2146
- /* @__PURE__ */ E.jsx(
2156
+ /* @__PURE__ */ R.jsx(
2147
2157
  "span",
2148
2158
  {
2149
2159
  "data-motion-paragraph": !0,
2150
- style: Ae(o),
2151
- children: r
2160
+ style: Ce(o),
2161
+ children: n
2152
2162
  },
2153
2163
  `motion-paragraph-${o}`
2154
2164
  )
2155
2165
  ];
2156
2166
  }
2157
- return r;
2167
+ return n;
2158
2168
  }
2159
- function Dr(t, e, n) {
2160
- const r = Br(t.text, e, n), o = [];
2161
- if (se(e, R.Line)) {
2162
- const s = n.line++;
2169
+ function Fn(t, e, r) {
2170
+ const n = $n(t.text, e, r), o = [];
2171
+ if (re(e, k.Line)) {
2172
+ const s = r.line++;
2163
2173
  o.push(
2164
- /* @__PURE__ */ E.jsx("span", { "data-motion-line": !0, style: Ae(s), children: r }, `motion-line-${s}`)
2174
+ /* @__PURE__ */ R.jsx("span", { "data-motion-line": !0, style: Ce(s), children: n }, `motion-line-${s}`)
2165
2175
  );
2166
2176
  } else
2167
- o.push(...r);
2177
+ o.push(...n);
2168
2178
  for (let s = 0; s < t.breaks; s++)
2169
- o.push(/* @__PURE__ */ E.jsx("br", {}, `motion-break-${n.br++}`));
2179
+ o.push(/* @__PURE__ */ R.jsx("br", {}, `motion-break-${r.br++}`));
2170
2180
  return o;
2171
2181
  }
2172
- function Br(t, e, n) {
2182
+ function $n(t, e, r) {
2173
2183
  if (!t)
2174
2184
  return [];
2175
- const r = se(e, R.Word), o = [], s = /(\s+)/g;
2185
+ const n = re(e, k.Word), o = [], s = /(\s+)/g;
2176
2186
  let i = 0, a;
2177
2187
  for (; (a = s.exec(t)) !== null; ) {
2178
2188
  if (a.index > i) {
2179
- const c = t.slice(i, a.index);
2180
- o.push(ft(c, n, e, r));
2189
+ const u = t.slice(i, a.index);
2190
+ o.push(dt(u, r, e, n));
2181
2191
  }
2182
2192
  o.push(a[0]), i = a.index + a[0].length;
2183
2193
  }
2184
2194
  if (i < t.length) {
2185
- const c = t.slice(i);
2186
- o.push(ft(c, n, e, r));
2195
+ const u = t.slice(i);
2196
+ o.push(dt(u, r, e, n));
2187
2197
  }
2188
2198
  return o;
2189
2199
  }
2190
- function ft(t, e, n, r) {
2191
- const o = e.word++, s = $r(t, n, e), i = `motion-word-${o}`, a = Fr(o, r);
2192
- return r ? /* @__PURE__ */ E.jsx("span", { "data-motion-word": !0, style: a, children: s }, i) : /* @__PURE__ */ E.jsx("span", { style: a, children: s }, i);
2200
+ function dt(t, e, r, n) {
2201
+ const o = e.word++, s = Kn(t, r, e), i = `motion-word-${o}`, a = Vn(o, n);
2202
+ return n ? /* @__PURE__ */ R.jsx("span", { "data-motion-word": !0, style: a, children: s }, i) : /* @__PURE__ */ R.jsx("span", { style: a, children: s }, i);
2193
2203
  }
2194
- function Fr(t, e) {
2195
- return e ? { ...Ae(t), whiteSpace: "nowrap" } : { whiteSpace: "nowrap" };
2204
+ function Vn(t, e) {
2205
+ return e ? { ...Ce(t), whiteSpace: "nowrap" } : { whiteSpace: "nowrap" };
2196
2206
  }
2197
- function $r(t, e, n) {
2207
+ function Kn(t, e, r) {
2198
2208
  if (!t)
2199
2209
  return [];
2200
- const r = se(e, R.Letter), o = se(e, R.Emoji);
2201
- if (!r) {
2210
+ const n = re(e, k.Letter), o = re(e, k.Emoji);
2211
+ if (!n) {
2202
2212
  if (!o)
2203
2213
  return [t];
2204
- const a = Ve(t);
2214
+ const a = $e(t);
2205
2215
  if (a.length === 0)
2206
2216
  return [t];
2207
- const { nodes: c } = kt(a, n);
2208
- return c;
2217
+ const { nodes: u } = Rt(a, r);
2218
+ return u;
2209
2219
  }
2210
- const s = [], i = Ve(t);
2220
+ const s = [], i = $e(t);
2211
2221
  for (const a of i) {
2212
- const c = n.letter++, p = `motion-letter-${c}`, f = Ae(c);
2222
+ const u = r.letter++, f = `motion-letter-${u}`, h = Ce(u);
2213
2223
  if (a === `
2214
2224
  `) {
2215
2225
  s.push(
2216
- /* @__PURE__ */ E.jsx("span", { "data-motion-letter": !0, style: f, children: /* @__PURE__ */ E.jsx("br", {}) }, p)
2226
+ /* @__PURE__ */ R.jsx("span", { "data-motion-letter": !0, style: h, children: /* @__PURE__ */ R.jsx("br", {}) }, f)
2217
2227
  );
2218
2228
  continue;
2219
2229
  }
2220
- const u = o && Rt(a) ? { "data-motion-emoji": !0 } : void 0, d = a === " " ? " " : a;
2230
+ const y = o && Et(a) ? { "data-motion-emoji": !0 } : void 0, c = a === " " ? " " : a;
2221
2231
  s.push(
2222
- /* @__PURE__ */ E.jsx("span", { "data-motion-letter": !0, style: f, ...u, children: d }, p)
2232
+ /* @__PURE__ */ R.jsx("span", { "data-motion-letter": !0, style: h, ...y, children: c }, f)
2223
2233
  );
2224
2234
  }
2225
2235
  return s;
2226
2236
  }
2227
- function Ve(t) {
2237
+ function $e(t) {
2228
2238
  if (!t)
2229
2239
  return [];
2230
- const e = Vr();
2231
- return e ? Array.from(e.segment(t), (n) => n.segment) : Kr(t);
2240
+ const e = zn();
2241
+ return e ? Array.from(e.segment(t), (r) => r.segment) : Yn(t);
2232
2242
  }
2233
- let de;
2234
- function Vr() {
2235
- return de !== void 0 || (typeof Intl < "u" && typeof Intl.Segmenter == "function" ? de = new Intl.Segmenter(void 0, { granularity: "grapheme" }) : de = null), de;
2243
+ let le;
2244
+ function zn() {
2245
+ return le !== void 0 || (typeof Intl < "u" && typeof Intl.Segmenter == "function" ? le = new Intl.Segmenter(void 0, { granularity: "grapheme" }) : le = null), le;
2236
2246
  }
2237
- function Kr(t) {
2238
- const e = [], n = Array.from(t);
2239
- let r = "";
2240
- for (let o = 0; o < n.length; o++) {
2241
- const s = n[o], i = n[o + 1];
2242
- r += s, !(i && Yr(s, i)) && (e.push(r), r = "");
2247
+ function Yn(t) {
2248
+ const e = [], r = Array.from(t);
2249
+ let n = "";
2250
+ for (let o = 0; o < r.length; o++) {
2251
+ const s = r[o], i = r[o + 1];
2252
+ n += s, !(i && Wn(s, i)) && (e.push(n), n = "");
2243
2253
  }
2244
- return r && e.push(r), e;
2254
+ return n && e.push(n), e;
2245
2255
  }
2246
- function Yr(t, e) {
2247
- return e ? !!(pt(t) || pt(e) || qr(e) || zr(e) || Wr(e) || ht(t) && ht(e)) : !1;
2256
+ function Wn(t, e) {
2257
+ return e ? !!(ft(t) || ft(e) || Gn(e) || qn(e) || Hn(e) || pt(t) && pt(e)) : !1;
2248
2258
  }
2249
- function pt(t) {
2259
+ function ft(t) {
2250
2260
  return t.codePointAt(0) === 8205;
2251
2261
  }
2252
- function zr(t) {
2262
+ function qn(t) {
2253
2263
  const e = t.codePointAt(0);
2254
2264
  return e === void 0 ? !1 : e >= 65024 && e <= 65039 || e >= 917760 && e <= 917999;
2255
2265
  }
2256
- function Wr(t) {
2266
+ function Hn(t) {
2257
2267
  const e = t.codePointAt(0);
2258
2268
  return e === void 0 ? !1 : e >= 127995 && e <= 127999;
2259
2269
  }
2260
- function ht(t) {
2270
+ function pt(t) {
2261
2271
  const e = t.codePointAt(0);
2262
2272
  return e === void 0 ? !1 : e >= 127462 && e <= 127487;
2263
2273
  }
2264
- let _e;
2265
- function qr(t) {
2266
- return t ? (_e || (_e = Hr()), _e(t)) : !1;
2274
+ let Ne;
2275
+ function Gn(t) {
2276
+ return t ? (Ne || (Ne = Jn()), Ne(t)) : !1;
2267
2277
  }
2268
- function Hr() {
2278
+ function Jn() {
2269
2279
  try {
2270
2280
  const t = new RegExp("\\p{Mark}", "u");
2271
2281
  return (e) => t.test(e);
@@ -2277,54 +2287,54 @@ function Hr() {
2277
2287
  }
2278
2288
  }
2279
2289
  let Pe;
2280
- function Rt(t) {
2281
- return t ? (Pe || (Pe = Gr()), Pe(t)) : !1;
2290
+ function Et(t) {
2291
+ return t ? (Pe || (Pe = Xn()), Pe(t)) : !1;
2282
2292
  }
2283
- function Gr() {
2293
+ function Xn() {
2284
2294
  try {
2285
2295
  const t = new RegExp("\\p{Extended_Pictographic}", "u");
2286
2296
  return (e) => t.test(e);
2287
2297
  } catch {
2288
- return Jr;
2298
+ return Zn;
2289
2299
  }
2290
2300
  }
2291
- function Jr(t) {
2301
+ function Zn(t) {
2292
2302
  if (!t)
2293
2303
  return !1;
2294
2304
  for (const e of Array.from(t)) {
2295
- const n = e.codePointAt(0);
2296
- if (n !== void 0 && (n >= 126976 && n <= 127231 || n >= 127232 && n <= 127487 || n >= 127488 && n <= 127743 || n >= 127744 && n <= 128511 || n >= 128512 && n <= 128591 || n >= 128640 && n <= 128767 || n >= 128768 && n <= 128895 || n >= 128896 && n <= 129023 || n >= 129024 && n <= 129279 || n >= 129280 && n <= 129535 || n >= 129536 && n <= 129791 || n >= 9728 && n <= 9983 || n >= 9984 && n <= 10175 || n === 8205 || n === 65039 || n === 8419))
2305
+ const r = e.codePointAt(0);
2306
+ if (r !== void 0 && (r >= 126976 && r <= 127231 || r >= 127232 && r <= 127487 || r >= 127488 && r <= 127743 || r >= 127744 && r <= 128511 || r >= 128512 && r <= 128591 || r >= 128640 && r <= 128767 || r >= 128768 && r <= 128895 || r >= 128896 && r <= 129023 || r >= 129024 && r <= 129279 || r >= 129280 && r <= 129535 || r >= 129536 && r <= 129791 || r >= 9728 && r <= 9983 || r >= 9984 && r <= 10175 || r === 8205 || r === 65039 || r === 8419))
2297
2307
  return !0;
2298
2308
  }
2299
2309
  return !1;
2300
2310
  }
2301
- function Xr(t) {
2311
+ function Qn(t) {
2302
2312
  const e = [];
2303
- let n = "", r = 0;
2313
+ let r = "", n = 0;
2304
2314
  for (let o = 0; o < t.length; o++) {
2305
2315
  const s = t[o];
2306
2316
  if (s === `
2307
2317
  `) {
2308
- r += 1;
2318
+ n += 1;
2309
2319
  continue;
2310
2320
  }
2311
- r > 0 && (e.push({ text: n, breaks: r }), n = "", r = 0), n += s;
2321
+ n > 0 && (e.push({ text: r, breaks: n }), r = "", n = 0), r += s;
2312
2322
  }
2313
- return (r > 0 || n.length > 0) && e.push({ text: n, breaks: r }), e;
2323
+ return (n > 0 || r.length > 0) && e.push({ text: r, breaks: n }), e;
2314
2324
  }
2315
- function Zr(t) {
2325
+ function eo(t) {
2316
2326
  if (t.length === 0)
2317
2327
  return [];
2318
2328
  const e = [];
2319
- let n = [];
2320
- for (const r of t)
2321
- n.push(r), r.breaks >= 2 && (e.push(n), n = []);
2322
- return n.length > 0 && e.push(n), e;
2329
+ let r = [];
2330
+ for (const n of t)
2331
+ r.push(n), n.breaks >= 2 && (e.push(r), r = []);
2332
+ return r.length > 0 && e.push(r), e;
2323
2333
  }
2324
- function se(t, e) {
2334
+ function re(t, e) {
2325
2335
  return (t & e) === e;
2326
2336
  }
2327
- function Ae(t) {
2337
+ function Ce(t) {
2328
2338
  return {
2329
2339
  "--tw-motion-seq-index": t.toString(),
2330
2340
  backgroundColor: "inherit",
@@ -2341,133 +2351,133 @@ function Ae(t) {
2341
2351
  WebkitTextFillColor: "inherit"
2342
2352
  };
2343
2353
  }
2344
- function mt(t) {
2354
+ function ht(t) {
2345
2355
  if (!t)
2346
2356
  return t;
2347
- const e = Ve(t);
2357
+ const e = $e(t);
2348
2358
  if (e.length === 0)
2349
2359
  return t;
2350
- const { nodes: n, sawEmoji: r } = kt(e);
2351
- return r ? n.length === 1 ? n[0] ?? t : n : t;
2360
+ const { nodes: r, sawEmoji: n } = Rt(e);
2361
+ return n ? r.length === 1 ? r[0] ?? t : r : t;
2352
2362
  }
2353
- function kt(t, e) {
2354
- const n = [];
2355
- let r = "", o = !1, s = e?.emoji ?? 0;
2363
+ function Rt(t, e) {
2364
+ const r = [];
2365
+ let n = "", o = !1, s = e?.emoji ?? 0;
2356
2366
  const i = () => {
2357
- r && (n.push(r), r = "");
2367
+ n && (r.push(n), n = "");
2358
2368
  };
2359
2369
  for (const a of t) {
2360
- if (Rt(a)) {
2370
+ if (Et(a)) {
2361
2371
  o = !0, i();
2362
- const p = `motion-emoji-${e ? e.emoji++ : s++}`;
2363
- n.push(
2364
- /* @__PURE__ */ E.jsx("span", { "data-motion-emoji": !0, children: a }, p)
2372
+ const f = `motion-emoji-${e ? e.emoji++ : s++}`;
2373
+ r.push(
2374
+ /* @__PURE__ */ R.jsx("span", { "data-motion-emoji": !0, children: a }, f)
2365
2375
  );
2366
2376
  continue;
2367
2377
  }
2368
- r += a;
2378
+ n += a;
2369
2379
  }
2370
- return i(), o ? { nodes: n, sawEmoji: !0 } : { nodes: [t.join("")], sawEmoji: !1 };
2380
+ return i(), o ? { nodes: r, sawEmoji: !0 } : { nodes: [t.join("")], sawEmoji: !1 };
2371
2381
  }
2372
- function Qr(t) {
2382
+ function to(t) {
2373
2383
  if (!t)
2374
- return R.None;
2384
+ return k.None;
2375
2385
  const e = t.trim();
2376
2386
  if (!e)
2377
- return R.None;
2378
- const n = dt.get(e);
2379
- if (typeof n == "number")
2380
- return n;
2387
+ return k.None;
2388
+ const r = lt.get(e);
2389
+ if (typeof r == "number")
2390
+ return r;
2381
2391
  if (typeof document > "u")
2382
- return R.None;
2383
- const r = e.split(/\s+/).filter(Boolean);
2384
- if (r.length === 0)
2385
- return R.None;
2386
- const s = r.map((c) => `.${eo(c)}`).map(
2387
- (c) => new RegExp(`(^|[^a-zA-Z0-9_-])${to(c)}(?![a-zA-Z0-9_-])`)
2392
+ return k.None;
2393
+ const n = e.split(/\s+/).filter(Boolean);
2394
+ if (n.length === 0)
2395
+ return k.None;
2396
+ const s = n.map((u) => `.${ro(u)}`).map(
2397
+ (u) => new RegExp(`(^|[^a-zA-Z0-9_-])${no(u)}(?![a-zA-Z0-9_-])`)
2388
2398
  );
2389
- let i = R.None, a = !1;
2390
- for (const c of Array.from(document.styleSheets)) {
2391
- let p;
2399
+ let i = k.None, a = !1;
2400
+ for (const u of Array.from(document.styleSheets)) {
2401
+ let f;
2392
2402
  try {
2393
- p = c.cssRules;
2403
+ f = u.cssRules;
2394
2404
  } catch {
2395
2405
  continue;
2396
2406
  }
2397
- const f = At(p, s);
2398
- if (f.mask && (i |= f.mask, i === $e))
2407
+ const h = kt(f, s);
2408
+ if (h.mask && (i |= h.mask, i === Fe))
2399
2409
  break;
2400
- a ||= f.sawStyleRule;
2410
+ a ||= h.sawStyleRule;
2401
2411
  }
2402
- return (i !== R.None || a) && dt.set(e, i), i;
2412
+ return (i !== k.None || a) && lt.set(e, i), i;
2403
2413
  }
2404
- function At(t, e) {
2414
+ function kt(t, e) {
2405
2415
  if (!t)
2406
- return { mask: R.None, sawStyleRule: !1 };
2407
- let n = R.None, r = !1;
2416
+ return { mask: k.None, sawStyleRule: !1 };
2417
+ let r = k.None, n = !1;
2408
2418
  for (let o = 0; o < t.length; o++) {
2409
2419
  const s = t[o];
2410
2420
  if (s) {
2411
2421
  if (s.type === CSSRule.STYLE_RULE) {
2412
2422
  const a = s.selectorText ?? "";
2413
- if (!a || !e.some((p) => p.test(a))) continue;
2414
- r = !0;
2415
- for (const p of Lr)
2416
- p.hints.some((f) => a.includes(f)) && (n |= p.flag);
2417
- if (n === $e)
2418
- return { mask: n, sawStyleRule: !0 };
2423
+ if (!a || !e.some((f) => f.test(a))) continue;
2424
+ n = !0;
2425
+ for (const f of Un)
2426
+ f.hints.some((h) => a.includes(h)) && (r |= f.flag);
2427
+ if (r === Fe)
2428
+ return { mask: r, sawStyleRule: !0 };
2419
2429
  } else if ("cssRules" in s) {
2420
- const i = At(s.cssRules, e);
2421
- if (i.mask && (n |= i.mask, n === $e))
2422
- return { mask: n, sawStyleRule: !0 };
2423
- r ||= i.sawStyleRule;
2430
+ const i = kt(s.cssRules, e);
2431
+ if (i.mask && (r |= i.mask, r === Fe))
2432
+ return { mask: r, sawStyleRule: !0 };
2433
+ n ||= i.sawStyleRule;
2424
2434
  }
2425
2435
  }
2426
2436
  }
2427
- return { mask: n, sawStyleRule: r };
2437
+ return { mask: r, sawStyleRule: n };
2428
2438
  }
2429
- function eo(t) {
2439
+ function ro(t) {
2430
2440
  return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
2431
2441
  }
2432
- function to(t) {
2442
+ function no(t) {
2433
2443
  return t.replace(/[.*+?^${}()|[\]\\]/g, (e) => `\\${e}`);
2434
2444
  }
2435
- const qe = "ikon_auth_session", no = 7 * 24 * 60 * 60 * 1e3, ro = 60 * 1e3;
2436
- function oo(t) {
2445
+ const We = "ikon_auth_session", oo = 10080 * 60 * 1e3, so = 60 * 1e3;
2446
+ function io(t) {
2437
2447
  try {
2438
2448
  const e = t.split(".");
2439
2449
  if (e.length !== 3) return !0;
2440
- const n = JSON.parse(atob(e[1]));
2441
- return typeof n.exp != "number" ? !1 : Date.now() >= n.exp * 1e3 - ro;
2450
+ const r = JSON.parse(atob(e[1]));
2451
+ return typeof r.exp != "number" ? !1 : Date.now() >= r.exp * 1e3 - so;
2442
2452
  } catch {
2443
2453
  return !0;
2444
2454
  }
2445
2455
  }
2446
- function Te(t) {
2456
+ function pe(t) {
2447
2457
  try {
2448
- localStorage.setItem(qe, JSON.stringify(t));
2458
+ localStorage.setItem(We, JSON.stringify(t));
2449
2459
  } catch {
2450
2460
  console.warn("Failed to save auth session to localStorage");
2451
2461
  }
2452
2462
  }
2453
- function Tt() {
2463
+ function At() {
2454
2464
  try {
2455
- const t = localStorage.getItem(qe);
2465
+ const t = localStorage.getItem(We);
2456
2466
  if (!t) return null;
2457
2467
  const e = JSON.parse(t);
2458
- return Date.now() - e.authenticatedAt > no || oo(e.token) ? (Ee(), null) : e;
2468
+ return Date.now() - e.authenticatedAt > oo || io(e.token) ? (Ae(), null) : e;
2459
2469
  } catch {
2460
2470
  return console.warn("Failed to load auth session from localStorage"), null;
2461
2471
  }
2462
2472
  }
2463
- function Ee() {
2473
+ function Ae() {
2464
2474
  try {
2465
- localStorage.removeItem(qe);
2475
+ localStorage.removeItem(We);
2466
2476
  } catch {
2467
2477
  console.warn("Failed to clear auth session from localStorage");
2468
2478
  }
2469
2479
  }
2470
- function fe(t) {
2480
+ function ee(t) {
2471
2481
  return {
2472
2482
  id: "",
2473
2483
  provider: t.provider,
@@ -2475,134 +2485,156 @@ function fe(t) {
2475
2485
  authenticatedAt: t.authenticatedAt
2476
2486
  };
2477
2487
  }
2488
+ const Tt = 15e3;
2478
2489
  async function Ct(t, e) {
2479
- const n = $t(), r = await fetch(`${e}/anonymous`, {
2490
+ const r = Vt(), n = await fetch(`${e}/anonymous`, {
2480
2491
  method: "POST",
2481
2492
  headers: { "Content-Type": "application/json" },
2482
- body: JSON.stringify({ deviceId: n, space: t })
2493
+ body: JSON.stringify({ deviceId: r, space: t })
2483
2494
  });
2484
- if (!r.ok) {
2485
- const i = await r.text().catch(() => "Unknown error");
2486
- throw new Error(`Anonymous auth failed: ${r.status} ${i}`);
2495
+ if (!n.ok) {
2496
+ const i = await n.text().catch(() => "Unknown error");
2497
+ throw new Error(`Anonymous auth failed: ${n.status} ${i}`);
2487
2498
  }
2488
- const { token: o } = await r.json(), s = {
2499
+ const { token: o } = await n.json(), s = {
2489
2500
  token: o,
2490
2501
  provider: "anonymous",
2491
2502
  authenticatedAt: Date.now()
2492
2503
  };
2493
- return Te(s), s;
2504
+ return pe(s), s;
2505
+ }
2506
+ async function ao({ email: t, spaceId: e, authUrl: r }) {
2507
+ const n = await fetch(`${r}/email/send`, {
2508
+ method: "POST",
2509
+ headers: { "Content-Type": "application/json" },
2510
+ body: JSON.stringify({
2511
+ email: t.trim(),
2512
+ space: e
2513
+ }),
2514
+ signal: AbortSignal.timeout(Tt)
2515
+ });
2516
+ if (!n.ok) {
2517
+ const o = await n.text().catch(() => "Failed to send login code");
2518
+ throw new Error(o);
2519
+ }
2494
2520
  }
2495
- async function Bo(t) {
2496
- const { email: e, spaceId: n, authUrl: r, returnUrl: o = window.location.origin + window.location.pathname } = t, s = await fetch(`${r}/email/send`, {
2521
+ async function co({ email: t, code: e, authUrl: r }) {
2522
+ const n = await fetch(`${r}/email/code`, {
2497
2523
  method: "POST",
2498
2524
  headers: { "Content-Type": "application/json" },
2499
2525
  body: JSON.stringify({
2500
- email: e.trim(),
2501
- space: n,
2502
- return: o
2503
- })
2526
+ email: t.trim(),
2527
+ code: e.trim()
2528
+ }),
2529
+ signal: AbortSignal.timeout(Tt)
2504
2530
  });
2505
- if (!s.ok) {
2506
- const i = await s.text().catch(() => "Failed to send email");
2531
+ if (!n.ok) {
2532
+ const i = await n.text().catch(() => "Invalid code");
2507
2533
  throw new Error(i);
2508
2534
  }
2535
+ const { token: o } = await n.json(), s = {
2536
+ token: o,
2537
+ provider: "email",
2538
+ authenticatedAt: Date.now()
2539
+ };
2540
+ return pe(s), s;
2509
2541
  }
2510
- function so() {
2511
- const t = new URLSearchParams(window.location.search), e = t.get("ikon_token"), n = t.get("ikon_provider");
2512
- return e && n ? { token: e, provider: n } : null;
2542
+ function uo() {
2543
+ const t = new URLSearchParams(window.location.search), e = t.get("ikon_token"), r = t.get("ikon_provider");
2544
+ return e && r ? { token: e, provider: r } : null;
2513
2545
  }
2514
- function io() {
2546
+ function lo() {
2515
2547
  const e = new URLSearchParams(window.location.search).get("error");
2516
2548
  return e ? decodeURIComponent(e) : null;
2517
2549
  }
2518
- function gt() {
2550
+ function mt() {
2519
2551
  window.history.replaceState({}, "", window.location.pathname);
2520
2552
  }
2521
- function ao(t, e, n, r) {
2522
- const o = r ?? window.location.origin + window.location.pathname + window.location.search;
2523
- return `${n}/oauth/${t}?space=${encodeURIComponent(e)}&return=${encodeURIComponent(o)}`;
2553
+ function fo(t, e, r, n) {
2554
+ const o = n ?? window.location.origin + window.location.pathname + window.location.search;
2555
+ return `${r}/oauth/${t}?space=${encodeURIComponent(e)}&return=${encodeURIComponent(o)}`;
2524
2556
  }
2525
- async function co(t) {
2557
+ async function po(t) {
2526
2558
  const e = await fetch(`${t}/passkey/registration/options`, {
2527
2559
  method: "POST",
2528
2560
  headers: { "Content-Type": "application/json" }
2529
2561
  });
2530
2562
  if (!e.ok) {
2531
- const n = await e.text().catch(() => "Failed to get registration options");
2532
- throw new Error(n);
2563
+ const r = await e.text().catch(() => "Failed to get registration options");
2564
+ throw new Error(r);
2533
2565
  }
2534
2566
  return e.json();
2535
2567
  }
2536
- async function uo(t, e, n) {
2537
- const r = await fetch(`${t}/passkey/registration/verify`, {
2568
+ async function ho(t, e, r) {
2569
+ const n = await fetch(`${t}/passkey/registration/verify`, {
2538
2570
  method: "POST",
2539
2571
  headers: { "Content-Type": "application/json" },
2540
- body: JSON.stringify({ response: e, name: n })
2572
+ body: JSON.stringify({ response: e, name: r })
2541
2573
  });
2542
- if (!r.ok) {
2543
- const i = await r.text().catch(() => "Registration verification failed");
2574
+ if (!n.ok) {
2575
+ const i = await n.text().catch(() => "Registration verification failed");
2544
2576
  throw new Error(i);
2545
2577
  }
2546
- const { token: o } = await r.json(), s = {
2578
+ const { token: o } = await n.json(), s = {
2547
2579
  token: o,
2548
2580
  provider: "passkey",
2549
2581
  authenticatedAt: Date.now()
2550
2582
  };
2551
- return Te(s), s;
2583
+ return pe(s), s;
2552
2584
  }
2553
- async function lo(t, e) {
2554
- const n = await fetch(`${t}/passkey/authentication/options`, {
2585
+ async function mo(t, e) {
2586
+ const r = await fetch(`${t}/passkey/authentication/options`, {
2555
2587
  method: "POST",
2556
2588
  headers: { "Content-Type": "application/json" },
2557
2589
  body: JSON.stringify({ email: e })
2558
2590
  });
2559
- if (!n.ok) {
2560
- const r = await n.text().catch(() => "Failed to get authentication options");
2561
- throw new Error(r);
2591
+ if (!r.ok) {
2592
+ const n = await r.text().catch(() => "Failed to get authentication options");
2593
+ throw new Error(n);
2562
2594
  }
2563
- return n.json();
2595
+ return r.json();
2564
2596
  }
2565
- async function fo(t, e) {
2566
- const n = await fetch(`${t}/passkey/authentication/verify`, {
2597
+ async function go(t, e) {
2598
+ const r = await fetch(`${t}/passkey/authentication/verify`, {
2567
2599
  method: "POST",
2568
2600
  headers: { "Content-Type": "application/json" },
2569
2601
  body: JSON.stringify({ response: e })
2570
2602
  });
2571
- if (!n.ok) {
2572
- const s = await n.text().catch(() => "Authentication verification failed");
2603
+ if (!r.ok) {
2604
+ const s = await r.text().catch(() => "Authentication verification failed");
2573
2605
  throw new Error(s);
2574
2606
  }
2575
- const { token: r } = await n.json(), o = {
2576
- token: r,
2607
+ const { token: n } = await r.json(), o = {
2608
+ token: n,
2577
2609
  provider: "passkey",
2578
2610
  authenticatedAt: Date.now()
2579
2611
  };
2580
- return Te(o), o;
2612
+ return pe(o), o;
2581
2613
  }
2582
- function X(t) {
2614
+ function H(t) {
2583
2615
  const e = new Uint8Array(t);
2584
- let n = "";
2616
+ let r = "";
2585
2617
  for (const o of e)
2586
- n += String.fromCharCode(o);
2587
- return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
2618
+ r += String.fromCharCode(o);
2619
+ return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
2588
2620
  }
2589
- function Re(t) {
2590
- const e = t.replace(/-/g, "+").replace(/_/g, "/"), n = (4 - e.length % 4) % 4, r = e.padEnd(e.length + n, "="), o = atob(r), s = new ArrayBuffer(o.length), i = new Uint8Array(s);
2621
+ function Te(t) {
2622
+ const e = t.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - e.length % 4) % 4, n = e.padEnd(e.length + r, "="), o = atob(n), s = new ArrayBuffer(o.length), i = new Uint8Array(s);
2591
2623
  for (let a = 0; a < o.length; a++)
2592
2624
  i[a] = o.charCodeAt(a);
2593
2625
  return s;
2594
2626
  }
2595
- function He() {
2596
- return po.stubThis(globalThis?.PublicKeyCredential !== void 0 && typeof globalThis.PublicKeyCredential == "function");
2627
+ function qe() {
2628
+ return yo.stubThis(globalThis?.PublicKeyCredential !== void 0 && typeof globalThis.PublicKeyCredential == "function");
2597
2629
  }
2598
- const po = {
2630
+ const yo = {
2599
2631
  stubThis: (t) => t
2600
2632
  };
2601
2633
  function It(t) {
2602
2634
  const { id: e } = t;
2603
2635
  return {
2604
2636
  ...t,
2605
- id: Re(e),
2637
+ id: Te(e),
2606
2638
  /**
2607
2639
  * `descriptor.transports` is an array of our `AuthenticatorTransportFuture` that includes newer
2608
2640
  * transports that TypeScript's DOM lib is ignorant of. Convince TS that our list of transports
@@ -2611,101 +2643,102 @@ function It(t) {
2611
2643
  transports: t.transports
2612
2644
  };
2613
2645
  }
2614
- function Ot(t) {
2646
+ function _t(t) {
2615
2647
  return (
2616
2648
  // Consider localhost valid as well since it's okay wrt Secure Contexts
2617
- t === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)
2649
+ t === "localhost" || // Support punycode (ACE) or ascii labels and domains
2650
+ /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(t)
2618
2651
  );
2619
2652
  }
2620
- class j extends Error {
2621
- constructor({ message: e, code: n, cause: r, name: o }) {
2622
- super(e, { cause: r }), Object.defineProperty(this, "code", {
2653
+ class x extends Error {
2654
+ constructor({ message: e, code: r, cause: n, name: o }) {
2655
+ super(e, { cause: n }), Object.defineProperty(this, "code", {
2623
2656
  enumerable: !0,
2624
2657
  configurable: !0,
2625
2658
  writable: !0,
2626
2659
  value: void 0
2627
- }), this.name = o ?? r.name, this.code = n;
2660
+ }), this.name = o ?? n.name, this.code = r;
2628
2661
  }
2629
2662
  }
2630
- function ho({ error: t, options: e }) {
2631
- const { publicKey: n } = e;
2632
- if (!n)
2663
+ function bo({ error: t, options: e }) {
2664
+ const { publicKey: r } = e;
2665
+ if (!r)
2633
2666
  throw Error("options was missing required publicKey property");
2634
2667
  if (t.name === "AbortError") {
2635
2668
  if (e.signal instanceof AbortSignal)
2636
- return new j({
2669
+ return new x({
2637
2670
  message: "Registration ceremony was sent an abort signal",
2638
2671
  code: "ERROR_CEREMONY_ABORTED",
2639
2672
  cause: t
2640
2673
  });
2641
2674
  } else if (t.name === "ConstraintError") {
2642
- if (n.authenticatorSelection?.requireResidentKey === !0)
2643
- return new j({
2675
+ if (r.authenticatorSelection?.requireResidentKey === !0)
2676
+ return new x({
2644
2677
  message: "Discoverable credentials were required but no available authenticator supported it",
2645
2678
  code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
2646
2679
  cause: t
2647
2680
  });
2648
2681
  if (
2649
2682
  // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024
2650
- e.mediation === "conditional" && n.authenticatorSelection?.userVerification === "required"
2683
+ e.mediation === "conditional" && r.authenticatorSelection?.userVerification === "required"
2651
2684
  )
2652
- return new j({
2685
+ return new x({
2653
2686
  message: "User verification was required during automatic registration but it could not be performed",
2654
2687
  code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
2655
2688
  cause: t
2656
2689
  });
2657
- if (n.authenticatorSelection?.userVerification === "required")
2658
- return new j({
2690
+ if (r.authenticatorSelection?.userVerification === "required")
2691
+ return new x({
2659
2692
  message: "User verification was required but no available authenticator supported it",
2660
2693
  code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
2661
2694
  cause: t
2662
2695
  });
2663
2696
  } else {
2664
2697
  if (t.name === "InvalidStateError")
2665
- return new j({
2698
+ return new x({
2666
2699
  message: "The authenticator was previously registered",
2667
2700
  code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
2668
2701
  cause: t
2669
2702
  });
2670
2703
  if (t.name === "NotAllowedError")
2671
- return new j({
2704
+ return new x({
2672
2705
  message: t.message,
2673
2706
  code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
2674
2707
  cause: t
2675
2708
  });
2676
2709
  if (t.name === "NotSupportedError")
2677
- return n.pubKeyCredParams.filter((o) => o.type === "public-key").length === 0 ? new j({
2710
+ return r.pubKeyCredParams.filter((o) => o.type === "public-key").length === 0 ? new x({
2678
2711
  message: 'No entry in pubKeyCredParams was of type "public-key"',
2679
2712
  code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
2680
2713
  cause: t
2681
- }) : new j({
2714
+ }) : new x({
2682
2715
  message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
2683
2716
  code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
2684
2717
  cause: t
2685
2718
  });
2686
2719
  if (t.name === "SecurityError") {
2687
- const r = globalThis.location.hostname;
2688
- if (Ot(r)) {
2689
- if (n.rp.id !== r)
2690
- return new j({
2691
- message: `The RP ID "${n.rp.id}" is invalid for this domain`,
2720
+ const n = globalThis.location.hostname;
2721
+ if (_t(n)) {
2722
+ if (r.rp.id !== n)
2723
+ return new x({
2724
+ message: `The RP ID "${r.rp.id}" is invalid for this domain`,
2692
2725
  code: "ERROR_INVALID_RP_ID",
2693
2726
  cause: t
2694
2727
  });
2695
- } else return new j({
2728
+ } else return new x({
2696
2729
  message: `${globalThis.location.hostname} is an invalid domain`,
2697
2730
  code: "ERROR_INVALID_DOMAIN",
2698
2731
  cause: t
2699
2732
  });
2700
2733
  } else if (t.name === "TypeError") {
2701
- if (n.user.id.byteLength < 1 || n.user.id.byteLength > 64)
2702
- return new j({
2734
+ if (r.user.id.byteLength < 1 || r.user.id.byteLength > 64)
2735
+ return new x({
2703
2736
  message: "User ID was not between 1 and 64 characters",
2704
2737
  code: "ERROR_INVALID_USER_ID_LENGTH",
2705
2738
  cause: t
2706
2739
  });
2707
2740
  } else if (t.name === "UnknownError")
2708
- return new j({
2741
+ return new x({
2709
2742
  message: "The authenticator was unable to process the specified options, or could not create a new credential",
2710
2743
  code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
2711
2744
  cause: t
@@ -2713,7 +2746,7 @@ function ho({ error: t, options: e }) {
2713
2746
  }
2714
2747
  return t;
2715
2748
  }
2716
- class mo {
2749
+ class So {
2717
2750
  constructor() {
2718
2751
  Object.defineProperty(this, "controller", {
2719
2752
  enumerable: !0,
@@ -2724,8 +2757,8 @@ class mo {
2724
2757
  }
2725
2758
  createNewAbortSignal() {
2726
2759
  if (this.controller) {
2727
- const n = new Error("Cancelling existing WebAuthn API call for new one");
2728
- n.name = "AbortError", this.controller.abort(n);
2760
+ const r = new Error("Cancelling existing WebAuthn API call for new one");
2761
+ r.name = "AbortError", this.controller.abort(r);
2729
2762
  }
2730
2763
  const e = new AbortController();
2731
2764
  return this.controller = e, e.signal;
@@ -2737,81 +2770,81 @@ class mo {
2737
2770
  }
2738
2771
  }
2739
2772
  }
2740
- const Nt = new mo(), go = ["cross-platform", "platform"];
2741
- function _t(t) {
2742
- if (t && !(go.indexOf(t) < 0))
2773
+ const Ot = new So(), wo = ["cross-platform", "platform"];
2774
+ function Nt(t) {
2775
+ if (t && !(wo.indexOf(t) < 0))
2743
2776
  return t;
2744
2777
  }
2745
- async function yo(t) {
2778
+ async function vo(t) {
2746
2779
  !t.optionsJSON && t.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."), t = { optionsJSON: t });
2747
- const { optionsJSON: e, useAutoRegister: n = !1 } = t;
2748
- if (!He())
2780
+ const { optionsJSON: e, useAutoRegister: r = !1 } = t;
2781
+ if (!qe())
2749
2782
  throw new Error("WebAuthn is not supported in this browser");
2750
- const r = {
2783
+ const n = {
2751
2784
  ...e,
2752
- challenge: Re(e.challenge),
2785
+ challenge: Te(e.challenge),
2753
2786
  user: {
2754
2787
  ...e.user,
2755
- id: Re(e.user.id)
2788
+ id: Te(e.user.id)
2756
2789
  },
2757
2790
  excludeCredentials: e.excludeCredentials?.map(It)
2758
2791
  }, o = {};
2759
- n && (o.mediation = "conditional"), o.publicKey = r, o.signal = Nt.createNewAbortSignal();
2792
+ r && (o.mediation = "conditional"), o.publicKey = n, o.signal = Ot.createNewAbortSignal();
2760
2793
  let s;
2761
2794
  try {
2762
2795
  s = await navigator.credentials.create(o);
2763
- } catch (m) {
2764
- throw ho({ error: m, options: o });
2796
+ } catch (l) {
2797
+ throw bo({ error: l, options: o });
2765
2798
  }
2766
2799
  if (!s)
2767
2800
  throw new Error("Registration was not completed");
2768
- const { id: i, rawId: a, response: c, type: p } = s;
2769
- let f;
2770
- typeof c.getTransports == "function" && (f = c.getTransports());
2771
- let l;
2772
- if (typeof c.getPublicKeyAlgorithm == "function")
2801
+ const { id: i, rawId: a, response: u, type: f } = s;
2802
+ let h;
2803
+ typeof u.getTransports == "function" && (h = u.getTransports());
2804
+ let p;
2805
+ if (typeof u.getPublicKeyAlgorithm == "function")
2773
2806
  try {
2774
- l = c.getPublicKeyAlgorithm();
2775
- } catch (m) {
2776
- Me("getPublicKeyAlgorithm()", m);
2807
+ p = u.getPublicKeyAlgorithm();
2808
+ } catch (l) {
2809
+ Me("getPublicKeyAlgorithm()", l);
2777
2810
  }
2778
- let u;
2779
- if (typeof c.getPublicKey == "function")
2811
+ let y;
2812
+ if (typeof u.getPublicKey == "function")
2780
2813
  try {
2781
- const m = c.getPublicKey();
2782
- m !== null && (u = X(m));
2783
- } catch (m) {
2784
- Me("getPublicKey()", m);
2814
+ const l = u.getPublicKey();
2815
+ l !== null && (y = H(l));
2816
+ } catch (l) {
2817
+ Me("getPublicKey()", l);
2785
2818
  }
2786
- let d;
2787
- if (typeof c.getAuthenticatorData == "function")
2819
+ let c;
2820
+ if (typeof u.getAuthenticatorData == "function")
2788
2821
  try {
2789
- d = X(c.getAuthenticatorData());
2790
- } catch (m) {
2791
- Me("getAuthenticatorData()", m);
2822
+ c = H(u.getAuthenticatorData());
2823
+ } catch (l) {
2824
+ Me("getAuthenticatorData()", l);
2792
2825
  }
2793
2826
  return {
2794
2827
  id: i,
2795
- rawId: X(a),
2828
+ rawId: H(a),
2796
2829
  response: {
2797
- attestationObject: X(c.attestationObject),
2798
- clientDataJSON: X(c.clientDataJSON),
2799
- transports: f,
2800
- publicKeyAlgorithm: l,
2801
- publicKey: u,
2802
- authenticatorData: d
2830
+ attestationObject: H(u.attestationObject),
2831
+ clientDataJSON: H(u.clientDataJSON),
2832
+ transports: h,
2833
+ publicKeyAlgorithm: p,
2834
+ publicKey: y,
2835
+ authenticatorData: c
2803
2836
  },
2804
- type: p,
2837
+ type: f,
2805
2838
  clientExtensionResults: s.getClientExtensionResults(),
2806
- authenticatorAttachment: _t(s.authenticatorAttachment)
2839
+ authenticatorAttachment: Nt(s.authenticatorAttachment)
2807
2840
  };
2808
2841
  }
2809
2842
  function Me(t, e) {
2810
2843
  console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${t}. You should report this error to them.
2811
2844
  `, e);
2812
2845
  }
2813
- function bo() {
2814
- if (!He())
2846
+ function Eo() {
2847
+ if (!qe())
2815
2848
  return Le.stubThis(new Promise((e) => e(!1)));
2816
2849
  const t = globalThis.PublicKeyCredential;
2817
2850
  return t?.isConditionalMediationAvailable === void 0 ? Le.stubThis(new Promise((e) => e(!1))) : Le.stubThis(t.isConditionalMediationAvailable());
@@ -2819,40 +2852,40 @@ function bo() {
2819
2852
  const Le = {
2820
2853
  stubThis: (t) => t
2821
2854
  };
2822
- function So({ error: t, options: e }) {
2823
- const { publicKey: n } = e;
2824
- if (!n)
2855
+ function Ro({ error: t, options: e }) {
2856
+ const { publicKey: r } = e;
2857
+ if (!r)
2825
2858
  throw Error("options was missing required publicKey property");
2826
2859
  if (t.name === "AbortError") {
2827
2860
  if (e.signal instanceof AbortSignal)
2828
- return new j({
2861
+ return new x({
2829
2862
  message: "Authentication ceremony was sent an abort signal",
2830
2863
  code: "ERROR_CEREMONY_ABORTED",
2831
2864
  cause: t
2832
2865
  });
2833
2866
  } else {
2834
2867
  if (t.name === "NotAllowedError")
2835
- return new j({
2868
+ return new x({
2836
2869
  message: t.message,
2837
2870
  code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
2838
2871
  cause: t
2839
2872
  });
2840
2873
  if (t.name === "SecurityError") {
2841
- const r = globalThis.location.hostname;
2842
- if (Ot(r)) {
2843
- if (n.rpId !== r)
2844
- return new j({
2845
- message: `The RP ID "${n.rpId}" is invalid for this domain`,
2874
+ const n = globalThis.location.hostname;
2875
+ if (_t(n)) {
2876
+ if (r.rpId !== n)
2877
+ return new x({
2878
+ message: `The RP ID "${r.rpId}" is invalid for this domain`,
2846
2879
  code: "ERROR_INVALID_RP_ID",
2847
2880
  cause: t
2848
2881
  });
2849
- } else return new j({
2882
+ } else return new x({
2850
2883
  message: `${globalThis.location.hostname} is an invalid domain`,
2851
2884
  code: "ERROR_INVALID_DOMAIN",
2852
2885
  cause: t
2853
2886
  });
2854
2887
  } else if (t.name === "UnknownError")
2855
- return new j({
2888
+ return new x({
2856
2889
  message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
2857
2890
  code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
2858
2891
  cause: t
@@ -2860,96 +2893,96 @@ function So({ error: t, options: e }) {
2860
2893
  }
2861
2894
  return t;
2862
2895
  }
2863
- async function wo(t) {
2896
+ async function ko(t) {
2864
2897
  !t.optionsJSON && t.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."), t = { optionsJSON: t });
2865
- const { optionsJSON: e, useBrowserAutofill: n = !1, verifyBrowserAutofillInput: r = !0 } = t;
2866
- if (!He())
2898
+ const { optionsJSON: e, useBrowserAutofill: r = !1, verifyBrowserAutofillInput: n = !0 } = t;
2899
+ if (!qe())
2867
2900
  throw new Error("WebAuthn is not supported in this browser");
2868
2901
  let o;
2869
2902
  e.allowCredentials?.length !== 0 && (o = e.allowCredentials?.map(It));
2870
2903
  const s = {
2871
2904
  ...e,
2872
- challenge: Re(e.challenge),
2905
+ challenge: Te(e.challenge),
2873
2906
  allowCredentials: o
2874
2907
  }, i = {};
2875
- if (n) {
2876
- if (!await bo())
2908
+ if (r) {
2909
+ if (!await Eo())
2877
2910
  throw Error("Browser does not support WebAuthn autofill");
2878
- if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && r)
2911
+ if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && n)
2879
2912
  throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
2880
2913
  i.mediation = "conditional", s.allowCredentials = [];
2881
2914
  }
2882
- i.publicKey = s, i.signal = Nt.createNewAbortSignal();
2915
+ i.publicKey = s, i.signal = Ot.createNewAbortSignal();
2883
2916
  let a;
2884
2917
  try {
2885
2918
  a = await navigator.credentials.get(i);
2886
- } catch (d) {
2887
- throw So({ error: d, options: i });
2919
+ } catch (c) {
2920
+ throw Ro({ error: c, options: i });
2888
2921
  }
2889
2922
  if (!a)
2890
2923
  throw new Error("Authentication was not completed");
2891
- const { id: c, rawId: p, response: f, type: l } = a;
2892
- let u;
2893
- return f.userHandle && (u = X(f.userHandle)), {
2894
- id: c,
2895
- rawId: X(p),
2924
+ const { id: u, rawId: f, response: h, type: p } = a;
2925
+ let y;
2926
+ return h.userHandle && (y = H(h.userHandle)), {
2927
+ id: u,
2928
+ rawId: H(f),
2896
2929
  response: {
2897
- authenticatorData: X(f.authenticatorData),
2898
- clientDataJSON: X(f.clientDataJSON),
2899
- signature: X(f.signature),
2900
- userHandle: u
2930
+ authenticatorData: H(h.authenticatorData),
2931
+ clientDataJSON: H(h.clientDataJSON),
2932
+ signature: H(h.signature),
2933
+ userHandle: y
2901
2934
  },
2902
- type: l,
2935
+ type: p,
2903
2936
  clientExtensionResults: a.getClientExtensionResults(),
2904
- authenticatorAttachment: _t(a.authenticatorAttachment)
2937
+ authenticatorAttachment: Nt(a.authenticatorAttachment)
2905
2938
  };
2906
2939
  }
2907
- const Ge = yt(null);
2908
- function Fo({ children: t, config: e }) {
2909
- const [n, r] = Y({
2940
+ const He = gt(null);
2941
+ function Ko({ children: t, config: e }) {
2942
+ const [r, n] = q({
2910
2943
  isAuthenticated: !1,
2911
2944
  isLoading: !0,
2912
2945
  user: null,
2913
2946
  error: null
2914
2947
  });
2915
- N(() => {
2948
+ P(() => {
2916
2949
  (() => {
2917
- const f = io();
2918
- if (f) {
2919
- gt(), r({
2950
+ const y = lo();
2951
+ if (y) {
2952
+ mt(), n({
2920
2953
  isAuthenticated: !1,
2921
2954
  isLoading: !1,
2922
2955
  user: null,
2923
- error: f
2956
+ error: y
2924
2957
  });
2925
2958
  return;
2926
2959
  }
2927
- const l = so();
2928
- if (l) {
2929
- const d = {
2930
- token: l.token,
2931
- provider: l.provider,
2960
+ const c = uo();
2961
+ if (c) {
2962
+ const m = {
2963
+ token: c.token,
2964
+ provider: c.provider,
2932
2965
  authenticatedAt: Date.now()
2933
2966
  };
2934
- Te(d), gt(), r({
2967
+ pe(m), mt(), n({
2935
2968
  isAuthenticated: !0,
2936
2969
  isLoading: !1,
2937
- user: fe(d),
2970
+ user: ee(m),
2938
2971
  error: null
2939
2972
  });
2940
2973
  return;
2941
2974
  }
2942
- const u = Tt();
2943
- if (u) {
2944
- r({
2975
+ const l = At();
2976
+ if (l) {
2977
+ n({
2945
2978
  isAuthenticated: !0,
2946
2979
  isLoading: !1,
2947
- user: fe(u),
2980
+ user: ee(l),
2948
2981
  error: null
2949
2982
  });
2950
2983
  return;
2951
2984
  }
2952
- r({
2985
+ n({
2953
2986
  isAuthenticated: !1,
2954
2987
  isLoading: !1,
2955
2988
  user: null,
@@ -2957,444 +2990,470 @@ function Fo({ children: t, config: e }) {
2957
2990
  });
2958
2991
  })();
2959
2992
  }, []);
2960
- const o = D(
2993
+ const o = U(
2961
2994
  async (p) => {
2962
2995
  if (!e.spaceId) {
2963
- r((l) => ({
2964
- ...l,
2996
+ n((c) => ({
2997
+ ...c,
2965
2998
  error: "Space ID is not configured"
2966
2999
  }));
2967
3000
  return;
2968
3001
  }
2969
- const f = xe(e.authUrl);
3002
+ const y = de(e.authUrl);
2970
3003
  if (p === "guest") {
2971
- r((l) => ({ ...l, isLoading: !0 }));
3004
+ n((c) => ({ ...c, isLoading: !0 }));
2972
3005
  try {
2973
- const l = await Ct(e.spaceId, f);
2974
- r({
3006
+ const c = await Ct(e.spaceId, y);
3007
+ n({
2975
3008
  isAuthenticated: !0,
2976
3009
  isLoading: !1,
2977
- user: fe(l),
3010
+ user: ee(c),
2978
3011
  error: null
2979
3012
  });
2980
- } catch (l) {
2981
- r((u) => ({
2982
- ...u,
3013
+ } catch (c) {
3014
+ n((l) => ({
3015
+ ...l,
2983
3016
  isLoading: !1,
2984
- error: l instanceof Error ? l.message : "Guest login failed"
3017
+ error: c instanceof Error ? c.message : "Guest login failed"
2985
3018
  }));
2986
3019
  }
2987
3020
  return;
2988
3021
  }
2989
3022
  if (p === "passkey") {
2990
- r((l) => ({ ...l, isLoading: !0, error: null }));
3023
+ n((c) => ({ ...c, isLoading: !0, error: null }));
2991
3024
  try {
2992
- const l = await lo(f), u = await wo({ optionsJSON: l }), d = await fo(f, u);
2993
- r({
3025
+ const c = await mo(y), l = await ko({ optionsJSON: c }), m = await go(y, l);
3026
+ n({
2994
3027
  isAuthenticated: !0,
2995
3028
  isLoading: !1,
2996
- user: fe(d),
3029
+ user: ee(m),
2997
3030
  error: null
2998
3031
  });
2999
- } catch (l) {
3000
- r((u) => ({
3001
- ...u,
3032
+ } catch (c) {
3033
+ n((l) => ({
3034
+ ...l,
3002
3035
  isLoading: !1,
3003
- error: l instanceof Error ? l.message : "Passkey login failed"
3036
+ error: c instanceof Error ? c.message : "Passkey login failed"
3004
3037
  }));
3005
3038
  }
3006
3039
  return;
3007
3040
  }
3008
- window.location.href = ao(p, e.spaceId, f);
3041
+ if (p === "email")
3042
+ throw new Error("login('email') is not supported. Use requestEmailCode()/submitEmailCode() from useAuth() instead.");
3043
+ window.location.href = fo(p, e.spaceId, y);
3044
+ },
3045
+ [e.authUrl, e.spaceId]
3046
+ ), s = U(
3047
+ async (p) => {
3048
+ if (!e.spaceId)
3049
+ throw n((c) => ({ ...c, error: "Space ID is not configured" })), new Error("Space ID is not configured");
3050
+ const y = de(e.authUrl);
3051
+ await ao({ email: p, spaceId: e.spaceId, authUrl: y });
3009
3052
  },
3010
3053
  [e.authUrl, e.spaceId]
3011
- ), s = D(() => {
3012
- Ee(), r({
3054
+ ), i = U(
3055
+ async (p, y) => {
3056
+ n((c) => ({ ...c, isLoading: !0, error: null }));
3057
+ try {
3058
+ const c = de(e.authUrl), l = await co({ email: p, code: y, authUrl: c });
3059
+ n({
3060
+ isAuthenticated: !0,
3061
+ isLoading: !1,
3062
+ user: ee(l),
3063
+ error: null
3064
+ });
3065
+ } catch (c) {
3066
+ const l = c instanceof Error ? c.message : "Code verification failed";
3067
+ throw n((m) => ({ ...m, isLoading: !1, error: l })), c;
3068
+ }
3069
+ },
3070
+ [e.authUrl]
3071
+ ), a = U(() => {
3072
+ Ae(), n({
3013
3073
  isAuthenticated: !1,
3014
3074
  isLoading: !1,
3015
3075
  user: null,
3016
3076
  error: null
3017
3077
  });
3018
- }, []), i = D(
3078
+ }, []), u = U(
3019
3079
  async (p) => {
3020
- const f = xe(e.authUrl);
3021
- r((l) => ({ ...l, isLoading: !0, error: null }));
3080
+ const y = de(e.authUrl);
3081
+ n((c) => ({ ...c, isLoading: !0, error: null }));
3022
3082
  try {
3023
- const l = await co(f), u = await yo({ optionsJSON: l }), d = await uo(f, u, p);
3024
- r({
3083
+ const c = await po(y), l = await vo({ optionsJSON: c }), m = await ho(y, l, p);
3084
+ n({
3025
3085
  isAuthenticated: !0,
3026
3086
  isLoading: !1,
3027
- user: fe(d),
3087
+ user: ee(m),
3028
3088
  error: null
3029
3089
  });
3030
- } catch (l) {
3031
- r((u) => ({
3032
- ...u,
3090
+ } catch (c) {
3091
+ n((l) => ({
3092
+ ...l,
3033
3093
  isLoading: !1,
3034
- error: l instanceof Error ? l.message : "Passkey registration failed"
3094
+ error: c instanceof Error ? c.message : "Passkey registration failed"
3035
3095
  }));
3036
3096
  }
3037
3097
  },
3038
3098
  [e.authUrl]
3039
- ), a = D(() => n.user?.token ?? null, [n.user]), c = K(
3099
+ ), f = U(() => r.user?.token ?? null, [r.user]), h = $(
3040
3100
  () => ({
3041
- state: n,
3101
+ state: r,
3042
3102
  login: o,
3043
- logout: s,
3044
- getToken: a,
3045
- registerPasskey: i
3103
+ logout: a,
3104
+ getToken: f,
3105
+ registerPasskey: u,
3106
+ requestEmailCode: s,
3107
+ submitEmailCode: i
3046
3108
  }),
3047
- [n, o, s, a, i]
3109
+ [r, o, a, f, u, s, i]
3048
3110
  );
3049
- return /* @__PURE__ */ E.jsx(Ge, { value: c, children: t });
3111
+ return /* @__PURE__ */ R.jsx(He, { value: h, children: t });
3050
3112
  }
3051
- function vo() {
3052
- const t = Ye(Ge);
3113
+ function Ao() {
3114
+ const t = Ke(He);
3053
3115
  if (!t)
3054
3116
  throw new Error("useAuth must be used within an AuthProvider");
3055
3117
  return t;
3056
3118
  }
3057
- function Eo() {
3058
- return Ye(Ge);
3119
+ function To() {
3120
+ return Ke(He);
3059
3121
  }
3060
- function $o(t) {
3061
- const { config: e, guestUrlParam: n } = t, { state: r, login: o } = vo(), s = v(!1);
3062
- return N(() => {
3063
- if (!n || r.isAuthenticated || r.isLoading || s.current || !e.methods.includes("guest"))
3122
+ function zo(t) {
3123
+ const { config: e, guestUrlParam: r } = t, { state: n, login: o } = Ao(), s = v(!1);
3124
+ return P(() => {
3125
+ if (!r || n.isAuthenticated || n.isLoading || s.current || !e.methods.includes("guest"))
3064
3126
  return;
3065
- const i = new URLSearchParams(window.location.search), a = i.get(n);
3127
+ const i = new URLSearchParams(window.location.search), a = i.get(r);
3066
3128
  if (a === "true" || a === "1" || a === "") {
3067
- i.delete(n);
3068
- const c = i.toString(), p = window.location.pathname + (c ? `?${c}` : "");
3069
- window.history.replaceState({}, "", p), s.current = !0, o("guest");
3129
+ i.delete(r);
3130
+ const u = i.toString(), f = window.location.pathname + (u ? `?${u}` : "");
3131
+ window.history.replaceState({}, "", f), s.current = !0, o("guest");
3070
3132
  }
3071
- }, [n, r.isAuthenticated, r.isLoading, e.methods, o]), {
3072
- shouldRenderChildren: r.isAuthenticated,
3073
- isCheckingAuth: r.isLoading,
3074
- isAuthenticated: r.isAuthenticated,
3075
- error: r.error
3133
+ }, [r, n.isAuthenticated, n.isLoading, e.methods, o]), {
3134
+ shouldRenderChildren: n.isAuthenticated,
3135
+ isCheckingAuth: n.isLoading,
3136
+ isAuthenticated: n.isAuthenticated,
3137
+ error: n.error
3076
3138
  };
3077
3139
  }
3078
- function Vo({
3140
+ function Yo({
3079
3141
  connectionState: t,
3080
3142
  error: e,
3081
- isReady: n,
3082
- stores: r,
3143
+ isReady: r,
3144
+ stores: n,
3083
3145
  registry: o,
3084
3146
  client: s,
3085
3147
  onAction: i,
3086
3148
  renderIdle: a,
3087
- renderConnecting: c,
3088
- renderConnectingSlow: p,
3089
- renderConnected: f,
3090
- renderOffline: l,
3091
- renderError: u
3149
+ renderConnecting: u,
3150
+ renderConnectingSlow: f,
3151
+ renderConnected: h,
3152
+ renderOffline: p,
3153
+ renderError: y
3092
3154
  }) {
3093
- const d = v(!1);
3155
+ const c = v(!1);
3094
3156
  switch (t) {
3095
3157
  case "idle":
3096
3158
  return a();
3097
3159
  case "connecting":
3098
- return c();
3160
+ return u();
3099
3161
  case "connectingSlow":
3100
- return p();
3162
+ return f();
3101
3163
  case "connected":
3102
3164
  case "reconnecting": {
3103
- if (!n || !r || !o) return null;
3104
- t === "reconnecting" && (d.current = !0);
3105
- const m = r.size > 0;
3106
- return m && (d.current = !1), f({
3107
- stores: r,
3165
+ if (!r || !n || !o) return null;
3166
+ t === "reconnecting" && (c.current = !0);
3167
+ const l = n.size > 0;
3168
+ return l && (c.current = !1), h({
3169
+ stores: n,
3108
3170
  registry: o,
3109
3171
  client: s,
3110
3172
  onAction: i,
3111
- isReconnecting: t === "reconnecting" || d.current && !m
3173
+ isReconnecting: t === "reconnecting" || c.current && !l
3112
3174
  });
3113
3175
  }
3114
3176
  case "offline":
3115
- return d.current = !1, l();
3177
+ return c.current = !1, p();
3116
3178
  case "offlineError":
3117
- return d.current = !1, u(e ?? s?.lastError?.message ?? null);
3179
+ return c.current = !1, y(e ?? s?.lastError?.message ?? null);
3118
3180
  default:
3119
3181
  return null;
3120
3182
  }
3121
3183
  }
3122
- const be = ke("useIkonApp");
3123
- function Ro() {
3184
+ const ve = fe("useIkonApp");
3185
+ function Co() {
3124
3186
  if (typeof window < "u" && window.__IKON_AUTH_CONFIG__)
3125
3187
  return window.__IKON_AUTH_CONFIG__;
3126
3188
  }
3127
- function ko() {
3189
+ function Io() {
3128
3190
  if (typeof window < "u" && window.__IKON_LOCAL_IKON_SERVER_CONFIG__)
3129
3191
  return window.__IKON_LOCAL_IKON_SERVER_CONFIG__;
3130
3192
  }
3131
- function Ko(t) {
3132
- const { authConfig: e, modules: n, timeouts: r, backgroundAudio: o, webRtc: s, audio: i, video: a, websocket: c, webtransport: p, proxy: f } = t, l = e === void 0 ? Ro() ?? null : e, u = ko(), d = Eo(), m = v(null), b = v(null), g = v(null), y = v(!1), w = v(!1), T = v(o), C = v(r), _ = v(s), B = v(i), Q = v(a), A = v(c), P = v(p), U = v(f);
3133
- T.current = o, C.current = r, _.current = s, B.current = i, Q.current = a, A.current = c, P.current = p, U.current = f;
3134
- const [M, F] = Y("idle"), [W, re] = Y(null), [pe, he] = Y(null), [ie, me] = Y(null), [ee, h] = Y(null), [S, k] = Y(!1), [L, q] = Y(0), I = K(() => {
3193
+ function Wo(t) {
3194
+ const { authConfig: e, modules: r, timeouts: n, backgroundAudio: o, webRtc: s, audio: i, video: a, websocket: u, webtransport: f, proxy: h } = t, p = e === void 0 ? Co() ?? null : e, y = Io(), c = To(), l = v(null), m = v(null), g = v(null), b = v(!1), S = v(!1), O = v(o), _ = v(n), M = v(s), L = v(i), G = v(a), T = v(u), N = v(f), D = v(h);
3195
+ O.current = o, _.current = n, M.current = s, L.current = i, G.current = a, T.current = u, N.current = f, D.current = h;
3196
+ const [j, B] = q("idle"), [V, he] = q(null), [ne, me] = q(null), [oe, ge] = q(null), [X, ye] = q(null), d = v(!1), [w, A] = q(0), E = $(() => {
3135
3197
  try {
3136
- const x = Vt();
3137
- return (x.sessionId || x.channelKey) && Kt(), x;
3198
+ const I = Kt();
3199
+ return (I.sessionId || I.channelKey) && zt(), I;
3138
3200
  } catch {
3139
3201
  return { parameters: {} };
3140
3202
  }
3141
- }, []), H = K(() => l?.enabled ? Tt() : null, [l?.enabled, L]), te = u?.enabled ?? !1, O = u?.host ?? "localhost", G = u?.port ?? 8443;
3142
- N(() => {
3143
- !te && Je() && l && !l.enabled && l.spaceId && !ee && !S && (k(!0), Ct(l.spaceId, xe(l.authUrl)).then((V) => {
3144
- h(V.token);
3145
- }).catch((V) => {
3146
- be.error("Anonymous auth failed:", V), re(V instanceof Error ? V.message : "Anonymous auth failed");
3147
- }).finally(() => {
3148
- k(!1);
3149
- }));
3150
- }, [te, l, ee, S]);
3151
- const ne = K(() => {
3152
- if (te) {
3153
- const x = H?.token ? Yt(H.token) ?? void 0 : void 0;
3203
+ }, []), K = $(() => p?.enabled ? At() : null, [p?.enabled, w]), Z = y?.enabled ?? !1, C = y?.host ?? "localhost", Y = y?.port ?? 8443;
3204
+ !Z && Ge() && p && !p.enabled && p.spaceId && !X && !d.current && (d.current = !0, Ct(p.spaceId, de(p.authUrl)).then((I) => {
3205
+ ye(I.token);
3206
+ }).catch((I) => {
3207
+ ve.error("Anonymous auth failed:", I), he(I instanceof Error ? I.message : "Anonymous auth failed"), d.current = !1;
3208
+ }));
3209
+ const se = $(() => {
3210
+ if (Z) {
3211
+ const I = K?.token ? Yt(K.token) ?? void 0 : void 0;
3154
3212
  return {
3155
3213
  local: {
3156
- host: O,
3157
- httpsPort: G,
3158
- userId: x,
3159
- token: H?.token ?? void 0,
3160
- spaceId: l?.spaceId,
3161
- backendUrl: l?.backendUrl,
3162
- authUrl: l?.authUrl,
3163
- parameters: I.parameters
3214
+ host: C,
3215
+ httpsPort: Y,
3216
+ userId: I,
3217
+ token: K?.token ?? void 0,
3218
+ spaceId: p?.spaceId,
3219
+ backendUrl: p?.backendUrl,
3220
+ authUrl: p?.authUrl,
3221
+ parameters: E.parameters
3164
3222
  }
3165
3223
  };
3166
3224
  }
3167
- return H?.token && l?.spaceId ? {
3225
+ return K?.token && p?.spaceId ? {
3168
3226
  sessionToken: {
3169
- token: H.token,
3170
- spaceId: l.spaceId,
3171
- backendType: Xe(),
3172
- sessionId: I.sessionId,
3173
- channelKey: I.channelKey,
3174
- parameters: I.parameters
3227
+ token: K.token,
3228
+ spaceId: p.spaceId,
3229
+ backendType: Je(),
3230
+ sessionId: E.sessionId,
3231
+ channelKey: E.channelKey,
3232
+ parameters: E.parameters
3175
3233
  }
3176
- } : ee && l?.spaceId ? {
3234
+ } : X && p?.spaceId ? {
3177
3235
  sessionToken: {
3178
- token: ee,
3179
- spaceId: l.spaceId,
3180
- backendType: Xe(),
3181
- sessionId: I.sessionId,
3182
- channelKey: I.channelKey,
3183
- parameters: I.parameters
3236
+ token: X,
3237
+ spaceId: p.spaceId,
3238
+ backendType: Je(),
3239
+ sessionId: E.sessionId,
3240
+ channelKey: E.channelKey,
3241
+ parameters: E.parameters
3184
3242
  }
3185
- } : Je() ? null : {
3243
+ } : Ge() ? null : {
3186
3244
  local: {
3187
- host: O,
3188
- httpsPort: G,
3189
- spaceId: l?.spaceId,
3190
- backendUrl: l?.backendUrl,
3191
- authUrl: l?.authUrl,
3192
- parameters: I.parameters
3245
+ host: C,
3246
+ httpsPort: Y,
3247
+ spaceId: p?.spaceId,
3248
+ backendUrl: p?.backendUrl,
3249
+ authUrl: p?.authUrl,
3250
+ parameters: E.parameters
3193
3251
  }
3194
3252
  };
3195
- }, [te, O, G, H?.token, l?.spaceId, l?.backendUrl, l?.authUrl, ee, I.sessionId, I.channelKey, I.parameters]);
3196
- pr(ie);
3197
- const Ce = mr(ie);
3198
- N(() => {
3199
- if (!y.current) {
3200
- if (y.current = !0, g.current = sr(), n)
3201
- for (const x of n)
3202
- x(g.current);
3203
- g.current.loadRegisteredModules().catch((x) => {
3204
- be.error("Failed to load UI modules", x);
3253
+ }, [Z, C, Y, K?.token, p?.spaceId, p?.backendUrl, p?.authUrl, X, E.sessionId, E.channelKey, E.parameters]);
3254
+ mn(oe);
3255
+ const Mt = yn(oe);
3256
+ P(() => {
3257
+ if (!b.current) {
3258
+ if (b.current = !0, g.current = an(), r)
3259
+ for (const I of r)
3260
+ I(g.current);
3261
+ g.current.loadRegisteredModules().catch((I) => {
3262
+ ve.error("Failed to load UI modules", I);
3205
3263
  });
3206
3264
  }
3207
- }, []), N(() => {
3208
- if (!ne) return;
3209
- const x = new zt({
3210
- ...ne,
3211
- timeouts: C.current,
3212
- audio: B.current !== void 0 || T.current ? {
3213
- enabled: B.current,
3214
- ...T.current ? { background: { allowOnDesktop: !0, allowOnMobile: !0 } } : {}
3265
+ }, []), P(() => {
3266
+ if (!se) return;
3267
+ const I = new Wt({
3268
+ ...se,
3269
+ timeouts: _.current,
3270
+ audio: L.current !== void 0 || O.current ? {
3271
+ enabled: L.current,
3272
+ ...O.current ? { background: { allowOnDesktop: !0, allowOnMobile: !0 } } : {}
3215
3273
  } : void 0,
3216
- video: Q.current !== void 0 ? { enabled: Q.current } : void 0,
3274
+ video: G.current !== void 0 ? { enabled: G.current } : void 0,
3217
3275
  mediaSession: { title: document.title || void 0, artist: document.title || void 0 },
3218
- webRtc: _.current === !1 ? { enabled: !1 } : void 0,
3219
- websocket: A.current,
3220
- webtransport: P.current,
3221
- proxy: U.current,
3222
- onConnectionStateChange: (J) => {
3223
- F(J);
3276
+ webRtc: M.current === !1 ? { enabled: !1 } : void 0,
3277
+ websocket: T.current,
3278
+ webtransport: N.current,
3279
+ proxy: D.current,
3280
+ onConnectionStateChange: (W) => {
3281
+ B(W);
3224
3282
  },
3225
- onError: (J) => {
3226
- re(J.message);
3283
+ onError: (W) => {
3284
+ he(W.message);
3227
3285
  }
3228
3286
  });
3229
- m.current = x;
3230
- const V = new hn({ client: x });
3231
- return b.current = V, me(V), x.connect().catch((J) => {
3232
- if (be.error("Connection failed:", J), J instanceof Wt) {
3233
- he(J.reason);
3287
+ l.current = I;
3288
+ const Q = new mr({ client: I });
3289
+ return m.current = Q, ge(Q), I.connect().catch((W) => {
3290
+ if (ve.error("Connection failed:", W), W instanceof qt) {
3291
+ me(W.reason);
3234
3292
  return;
3235
3293
  }
3236
- J instanceof qt && !w.current && (w.current = !0, be.warn("Auth session appears stale, clearing and retrying"), d ? d.logout() : (Ee(), q((xt) => xt + 1)));
3294
+ W instanceof Ht && !S.current && (S.current = !0, ve.warn("Auth session appears stale, clearing and retrying"), c ? c.logout() : (Ae(), A((Ut) => Ut + 1)));
3237
3295
  }), () => {
3238
- x.disconnect(), m.current = null, V.dispose(), b.current = null;
3296
+ I.disconnect(), l.current = null, Q.dispose(), m.current = null;
3239
3297
  };
3240
- }, [ne]);
3241
- const Mt = D((x, V) => {
3242
- const J = typeof V == "string" ? V : JSON.stringify(V ?? {});
3243
- m.current?.sendActionCall(x, J);
3244
- }, []), Lt = M === "connected" || M === "reconnecting";
3298
+ }, [se]);
3299
+ const Lt = U((I, Q) => {
3300
+ const W = typeof Q == "string" ? Q : JSON.stringify(Q ?? {});
3301
+ l.current?.sendActionCall(I, W);
3302
+ }, []), xt = j === "connected" || j === "reconnecting";
3245
3303
  return {
3246
- connectionState: M,
3247
- error: W,
3248
- accessDeniedReason: pe,
3249
- stores: Ce,
3250
- client: m.current,
3304
+ connectionState: j,
3305
+ error: V,
3306
+ accessDeniedReason: ne,
3307
+ stores: Mt,
3308
+ client: l.current,
3251
3309
  registry: g.current,
3252
- clientRef: m,
3253
- uiRef: b,
3310
+ clientRef: l,
3311
+ uiRef: m,
3254
3312
  registryRef: g,
3255
- onAction: Mt,
3256
- isReady: Lt,
3257
- webRtcVideoStreams: m.current?.webRtcVideoStreams ?? /* @__PURE__ */ new Map(),
3258
- webRtcTrackMap: m.current?.webRtcTrackMap ?? /* @__PURE__ */ new Map()
3313
+ onAction: Lt,
3314
+ isReady: xt,
3315
+ webRtcVideoStreams: l.current?.webRtcVideoStreams ?? /* @__PURE__ */ new Map(),
3316
+ webRtcTrackMap: l.current?.webRtcTrackMap ?? /* @__PURE__ */ new Map()
3259
3317
  };
3260
3318
  }
3261
- function Yo(t) {
3319
+ function qo(t) {
3262
3320
  const e = v(!1);
3263
- return D(() => {
3321
+ return U(() => {
3264
3322
  if (e.current) return;
3265
3323
  e.current = !0;
3266
- const n = document.createElement("link");
3267
- n.rel = "stylesheet", n.href = t, document.head.appendChild(n);
3324
+ const r = document.createElement("link");
3325
+ r.rel = "stylesheet", r.href = t, document.head.appendChild(r);
3268
3326
  }, [t]);
3269
3327
  }
3270
- let Ao = 0;
3271
- function zo(t = 5, e = 5e3) {
3272
- const [n, r] = Y([]), o = v(/* @__PURE__ */ new Map()), s = D((i) => {
3328
+ let _o = 0;
3329
+ function Ho(t = 5, e = 5e3) {
3330
+ const [r, n] = q([]), o = v(/* @__PURE__ */ new Map()), s = U((i) => {
3273
3331
  const a = o.current.get(i);
3274
- a && (clearTimeout(a), o.current.delete(i)), r((c) => c.filter((p) => p.id !== i));
3332
+ a && (clearTimeout(a), o.current.delete(i)), n((u) => u.filter((f) => f.id !== i));
3275
3333
  }, []);
3276
- return N(() => {
3277
- const i = o.current, a = Ht(
3278
- (c) => {
3279
- if (!Gt())
3334
+ return P(() => {
3335
+ const i = o.current, a = Gt(
3336
+ (u) => {
3337
+ if (!Jt())
3280
3338
  return;
3281
- const p = `toast-${++Ao}`, f = c.level === Ze.ERROR ? "error" : "warn", l = {
3282
- id: p,
3283
- level: f,
3284
- message: c.message,
3285
- component: c.component
3339
+ const f = `toast-${++_o}`, h = u.level === Xe.ERROR ? "error" : "warn", p = {
3340
+ id: f,
3341
+ level: h,
3342
+ message: u.message,
3343
+ component: u.component
3286
3344
  };
3287
- r((d) => [...d, l].slice(-t));
3288
- const u = setTimeout(() => {
3289
- s(p);
3345
+ n((c) => [...c, p].slice(-t));
3346
+ const y = setTimeout(() => {
3347
+ s(f);
3290
3348
  }, e);
3291
- i.set(p, u);
3349
+ i.set(f, y);
3292
3350
  },
3293
- { minLevel: Ze.WARN }
3351
+ { minLevel: Xe.WARN }
3294
3352
  );
3295
3353
  return () => {
3296
3354
  a();
3297
- for (const c of i.values())
3298
- clearTimeout(c);
3355
+ for (const u of i.values())
3356
+ clearTimeout(u);
3299
3357
  i.clear();
3300
3358
  };
3301
- }, [t, e, s]), { toasts: n, dismissToast: s };
3359
+ }, [t, e, s]), { toasts: r, dismissToast: s };
3302
3360
  }
3303
- const Pt = yt(null);
3304
- function To(t, e) {
3305
- return e ? t.replace(/\{(\w+)\}/g, (n, r) => e[r] ?? `{${r}}`) : t;
3361
+ const Pt = gt(null);
3362
+ function Oo(t, e) {
3363
+ return e ? t.replace(/\{(\w+)\}/g, (r, n) => e[n] ?? `{${n}}`) : t;
3306
3364
  }
3307
- function Co(t, e) {
3308
- const n = Jt();
3309
- if (n && t.includes(n))
3310
- return n;
3311
- const r = navigator.language.split("-")[0];
3312
- return t.includes(r) ? r : e && t.includes(e) ? e : "en";
3365
+ function No(t, e) {
3366
+ const r = Xt();
3367
+ if (r && t.includes(r))
3368
+ return r;
3369
+ const n = navigator.language.split("-")[0];
3370
+ return t.includes(n) ? n : e && t.includes(e) ? e : "en";
3313
3371
  }
3314
- function Io(t, e, n) {
3315
- return e ? Co(t, n) : n && t.includes(n) ? n : "en";
3372
+ function Po(t, e, r) {
3373
+ return e ? No(t, r) : r && t.includes(r) ? r : "en";
3316
3374
  }
3317
- function Wo({
3375
+ function Go({
3318
3376
  children: t,
3319
3377
  translations: e,
3320
- defaultLanguage: n,
3321
- detectLanguage: r = !1
3378
+ defaultLanguage: r,
3379
+ detectLanguage: n = !1
3322
3380
  }) {
3323
- const o = Object.keys(e), s = Io(o, r, n), i = e[s] ?? e.en, a = K(
3381
+ const o = Object.keys(e), s = Po(o, n, r), i = e[s] ?? e.en, a = $(
3324
3382
  () => ({
3325
- t: (c, p) => {
3326
- const f = i[c];
3327
- return To(f, p);
3383
+ t: (u, f) => {
3384
+ const h = i[u];
3385
+ return Oo(h, f);
3328
3386
  },
3329
3387
  locale: s,
3330
3388
  translations: i
3331
3389
  }),
3332
3390
  [i, s]
3333
3391
  );
3334
- return /* @__PURE__ */ E.jsx(Pt, { value: a, children: t });
3392
+ return /* @__PURE__ */ R.jsx(Pt, { value: a, children: t });
3335
3393
  }
3336
- function qo() {
3337
- const t = Ye(Pt);
3394
+ function Jo() {
3395
+ const t = Ke(Pt);
3338
3396
  if (!t)
3339
3397
  throw new Error("useI18n must be used within an I18nProvider");
3340
3398
  return t;
3341
3399
  }
3342
3400
  export {
3343
- Fo as AuthProvider,
3344
- Vo as ConnectionStateRenderer,
3345
- Wo as I18nProvider,
3346
- In as IKON_UI_BASE_MODULE,
3347
- Fn as IKON_UI_MEDIA_MODULE,
3348
- tr as IKON_UI_SHADERTOY_MODULE,
3349
- Qn as IKON_UI_SHADERTOY_TYPE,
3401
+ Ko as AuthProvider,
3402
+ Yo as ConnectionStateRenderer,
3403
+ Go as I18nProvider,
3404
+ _r as IKON_UI_BASE_MODULE,
3405
+ $r as IKON_UI_MEDIA_MODULE,
3406
+ rn as IKON_UI_SHADERTOY_MODULE,
3407
+ en as IKON_UI_SHADERTOY_TYPE,
3350
3408
  Ue as IKON_UI_STREAM_CATEGORY,
3351
- xn as IKON_UI_VIDEO_CANVAS_TYPE,
3352
- jn as IKON_UI_VIDEO_URL_PLAYER_TYPE,
3353
- hn as IkonUi,
3354
- or as IkonUiRegistry,
3355
- Lo as IkonUiSurface,
3356
- fn as InspectOverlay,
3357
- dn as UiComponentRegistry,
3358
- ln as UiRenderer,
3359
- Jo as UiStreamStore,
3360
- xo as areIkonUiModuleListsEqual,
3409
+ Ur as IKON_UI_VIDEO_CANVAS_TYPE,
3410
+ jr as IKON_UI_VIDEO_URL_PLAYER_TYPE,
3411
+ mr as IkonUi,
3412
+ sn as IkonUiRegistry,
3413
+ Do as IkonUiSurface,
3414
+ fr as InspectOverlay,
3415
+ dr as UiComponentRegistry,
3416
+ lr as UiRenderer,
3417
+ Qo as UiStreamStore,
3418
+ Bo as areIkonUiModuleListsEqual,
3361
3419
  Ct as authenticateAnonymous,
3362
- ao as buildOAuthRedirectUrl,
3363
- Ee as clearAuthSession,
3364
- gt as clearOAuthParams,
3365
- Cn as createBaseResolvers,
3366
- Po as createComponentLibrary,
3367
- sr as createIkonUiRegistry,
3368
- Dn as createMediaResolvers,
3369
- er as createShadertoyRendererResolver,
3370
- pn as isIkonUiCategoryMatch,
3371
- Tt as loadAuthSession,
3372
- On as loadBaseModule,
3373
- $n as loadMediaModule,
3374
- nr as loadShadertoyModule,
3375
- Pr as normalizeIkonUiModuleList,
3376
- Uo as parseIkonUiInitPayload,
3377
- so as parseOAuthCallback,
3378
- io as parseOAuthError,
3379
- Mr as readIkonUiModules,
3380
- jo as readIkonUiModulesFromSources,
3381
- Nn as registerBaseModule,
3382
- Vn as registerMediaModule,
3383
- rr as registerShadertoyModule,
3384
- cn as renderChildren,
3385
- Do as renderMotionLetters,
3386
- Te as saveAuthSession,
3387
- Bo as sendMagicLink,
3388
- fe as sessionToUser,
3389
- vo as useAuth,
3390
- $o as useAuthGuard,
3391
- Eo as useAuthOptional,
3392
- qo as useI18n,
3393
- Ko as useIkonApp,
3394
- pr as useIkonStyles,
3395
- mr as useIkonUiStores,
3396
- Yo as useLazyFont,
3397
- zo as useToasts,
3398
- Z as useUiNode,
3399
- Mo as useUiStore
3420
+ fo as buildOAuthRedirectUrl,
3421
+ Ae as clearAuthSession,
3422
+ mt as clearOAuthParams,
3423
+ Ir as createBaseResolvers,
3424
+ Uo as createComponentLibrary,
3425
+ an as createIkonUiRegistry,
3426
+ Br as createMediaResolvers,
3427
+ tn as createShadertoyRendererResolver,
3428
+ hr as isIkonUiCategoryMatch,
3429
+ At as loadAuthSession,
3430
+ Or as loadBaseModule,
3431
+ Vr as loadMediaModule,
3432
+ nn as loadShadertoyModule,
3433
+ Ln as normalizeIkonUiModuleList,
3434
+ $o as parseIkonUiInitPayload,
3435
+ uo as parseOAuthCallback,
3436
+ lo as parseOAuthError,
3437
+ xn as readIkonUiModules,
3438
+ Fo as readIkonUiModulesFromSources,
3439
+ Nr as registerBaseModule,
3440
+ Kr as registerMediaModule,
3441
+ on as registerShadertoyModule,
3442
+ cr as renderChildren,
3443
+ Vo as renderMotionLetters,
3444
+ pe as saveAuthSession,
3445
+ ao as sendLoginCode,
3446
+ ee as sessionToUser,
3447
+ Ao as useAuth,
3448
+ zo as useAuthGuard,
3449
+ To as useAuthOptional,
3450
+ Jo as useI18n,
3451
+ Wo as useIkonApp,
3452
+ mn as useIkonStyles,
3453
+ yn as useIkonUiStores,
3454
+ qo as useLazyFont,
3455
+ Ho as useToasts,
3456
+ J as useUiNode,
3457
+ jo as useUiStore,
3458
+ co as verifyLoginCode
3400
3459
  };