@ikonai/sdk-react-ui 1.0.56 → 1.0.58

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