@ikonai/sdk-react-ui 1.0.59 → 1.0.61

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