@ikonai/sdk-react-ui 1.0.2 → 1.0.3

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