@levo-so/react 0.1.64 → 0.1.71

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/dist/index.js CHANGED
@@ -1,985 +1,351 @@
1
1
  "use client";
2
- import * as $ from "react";
3
- import D, { createContext as nt, useContext as Re, useState as N, useEffect as k, useRef as H, useCallback as Q, useMemo as fe } from "react";
4
- import { clsx as ot } from "clsx";
5
- import { twMerge as Ce } from "tailwind-merge";
6
- import { getLevoError as U } from "@levo-so/core";
7
- import { usePageLifecycle as st, LifecycleState as xe } from "use-page-lifecycle";
8
- import { Slot as it, Dialog as j, Tabs as W, Tooltip as z } from "radix-ui";
9
- import { cva as at } from "class-variance-authority";
10
- import { X as ct } from "lucide-react";
11
- import { Toaster as lt, toast as ue } from "sonner";
12
- import { toast as An } from "sonner";
13
- var q = { exports: {} }, V = {};
14
- var Te;
15
- function ut() {
16
- if (Te) return V;
17
- Te = 1;
2
+ import * as _ from "react";
3
+ import R, { createContext as Le, useContext as K, useState as P, useEffect as O, useMemo as fe, useRef as me, useCallback as X } from "react";
4
+ import { clsx as Ie } from "clsx";
5
+ import { twMerge as pe } from "tailwind-merge";
6
+ import { Slot as De, Dialog as y, Tabs as k, Tooltip as A } from "radix-ui";
7
+ import { cva as $e } from "class-variance-authority";
8
+ import { X as We } from "lucide-react";
9
+ import { Toaster as Me, toast as q } from "sonner";
10
+ import { toast as nr } from "sonner";
11
+ import { getLevoError as ge } from "@levo-so/core";
12
+ var M = { exports: {} }, I = {};
13
+ var ie;
14
+ function Be() {
15
+ if (ie) return I;
16
+ ie = 1;
18
17
  var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
19
- function r(n, o, i) {
20
- var c = null;
21
- if (i !== void 0 && (c = "" + i), o.key !== void 0 && (c = "" + o.key), "key" in o) {
22
- i = {};
23
- for (var l in o)
24
- l !== "key" && (i[l] = o[l]);
25
- } else i = o;
26
- return o = i.ref, {
18
+ function r(n, s, a) {
19
+ var l = null;
20
+ if (a !== void 0 && (l = "" + a), s.key !== void 0 && (l = "" + s.key), "key" in s) {
21
+ a = {};
22
+ for (var u in s)
23
+ u !== "key" && (a[u] = s[u]);
24
+ } else a = s;
25
+ return s = a.ref, {
27
26
  $$typeof: e,
28
27
  type: n,
29
- key: c,
30
- ref: o !== void 0 ? o : null,
31
- props: i
28
+ key: l,
29
+ ref: s !== void 0 ? s : null,
30
+ props: a
32
31
  };
33
32
  }
34
- return V.Fragment = t, V.jsx = r, V.jsxs = r, V;
35
- }
36
- var G = {};
37
- var Ee;
38
- function dt() {
39
- return Ee || (Ee = 1, process.env.NODE_ENV !== "production" && function() {
40
- function e(s) {
41
- if (s == null) return null;
42
- if (typeof s == "function")
43
- return s.$$typeof === et ? null : s.displayName || s.name || null;
44
- if (typeof s == "string") return s;
45
- switch (s) {
46
- case x:
33
+ return I.Fragment = t, I.jsx = r, I.jsxs = r, I;
34
+ }
35
+ var D = {};
36
+ var ce;
37
+ function Fe() {
38
+ return ce || (ce = 1, process.env.NODE_ENV !== "production" && (function() {
39
+ function e(o) {
40
+ if (o == null) return null;
41
+ if (typeof o == "function")
42
+ return o.$$typeof === Ce ? null : o.displayName || o.name || null;
43
+ if (typeof o == "string") return o;
44
+ switch (o) {
45
+ case N:
47
46
  return "Fragment";
48
- case w:
47
+ case h:
49
48
  return "Profiler";
50
- case R:
49
+ case L:
51
50
  return "StrictMode";
52
- case v:
51
+ case _e:
53
52
  return "Suspense";
54
- case L:
53
+ case Ne:
55
54
  return "SuspenseList";
56
- case Qe:
55
+ case ke:
57
56
  return "Activity";
58
57
  }
59
- if (typeof s == "object")
60
- switch (typeof s.tag == "number" && console.error(
58
+ if (typeof o == "object")
59
+ switch (typeof o.tag == "number" && console.error(
61
60
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
62
- ), s.$$typeof) {
63
- case O:
61
+ ), o.$$typeof) {
62
+ case C:
64
63
  return "Portal";
65
- case A:
66
- return s.displayName || "Context";
67
- case _:
68
- return (s._context.displayName || "Context") + ".Consumer";
69
- case M:
70
- var f = s.render;
71
- return s = s.displayName, s || (s = f.displayName || f.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
72
- case I:
73
- return f = s.displayName || null, f !== null ? f : e(s.type) || "Memo";
74
- case F:
75
- f = s._payload, s = s._init;
64
+ case $:
65
+ return o.displayName || "Context";
66
+ case x:
67
+ return (o._context.displayName || "Context") + ".Consumer";
68
+ case Re:
69
+ var i = o.render;
70
+ return o = o.displayName, o || (o = i.displayName || i.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
71
+ case Pe:
72
+ return i = o.displayName || null, i !== null ? i : e(o.type) || "Memo";
73
+ case Y:
74
+ i = o._payload, o = o._init;
76
75
  try {
77
- return e(s(f));
76
+ return e(o(i));
78
77
  } catch {
79
78
  }
80
79
  }
81
80
  return null;
82
81
  }
83
- function t(s) {
84
- return "" + s;
82
+ function t(o) {
83
+ return "" + o;
85
84
  }
86
- function r(s) {
85
+ function r(o) {
87
86
  try {
88
- t(s);
89
- var f = !1;
87
+ t(o);
88
+ var i = !1;
90
89
  } catch {
91
- f = !0;
90
+ i = !0;
92
91
  }
93
- if (f) {
94
- f = console;
95
- var y = f.error, T = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
96
- return y.call(
97
- f,
92
+ if (i) {
93
+ i = console;
94
+ var m = i.error, g = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
95
+ return m.call(
96
+ i,
98
97
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
99
- T
100
- ), t(s);
98
+ g
99
+ ), t(o);
101
100
  }
102
101
  }
103
- function n(s) {
104
- if (s === x) return "<>";
105
- if (typeof s == "object" && s !== null && s.$$typeof === F)
102
+ function n(o) {
103
+ if (o === N) return "<>";
104
+ if (typeof o == "object" && o !== null && o.$$typeof === Y)
106
105
  return "<...>";
107
106
  try {
108
- var f = e(s);
109
- return f ? "<" + f + ">" : "<...>";
107
+ var i = e(o);
108
+ return i ? "<" + i + ">" : "<...>";
110
109
  } catch {
111
110
  return "<...>";
112
111
  }
113
112
  }
114
- function o() {
115
- var s = oe.A;
116
- return s === null ? null : s.getOwner();
113
+ function s() {
114
+ var o = V.A;
115
+ return o === null ? null : o.getOwner();
117
116
  }
118
- function i() {
117
+ function a() {
119
118
  return Error("react-stack-top-frame");
120
119
  }
121
- function c(s) {
122
- if (pe.call(s, "key")) {
123
- var f = Object.getOwnPropertyDescriptor(s, "key").get;
124
- if (f && f.isReactWarning) return !1;
120
+ function l(o) {
121
+ if (te.call(o, "key")) {
122
+ var i = Object.getOwnPropertyDescriptor(o, "key").get;
123
+ if (i && i.isReactWarning) return !1;
125
124
  }
126
- return s.key !== void 0;
125
+ return o.key !== void 0;
127
126
  }
128
- function l(s, f) {
129
- function y() {
130
- be || (be = !0, console.error(
127
+ function u(o, i) {
128
+ function m() {
129
+ re || (re = !0, console.error(
131
130
  "%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)",
132
- f
131
+ i
133
132
  ));
134
133
  }
135
- y.isReactWarning = !0, Object.defineProperty(s, "key", {
136
- get: y,
134
+ m.isReactWarning = !0, Object.defineProperty(o, "key", {
135
+ get: m,
137
136
  configurable: !0
138
137
  });
139
138
  }
140
- function a() {
141
- var s = e(this.type);
142
- return he[s] || (he[s] = !0, console.error(
139
+ function f() {
140
+ var o = e(this.type);
141
+ return oe[o] || (oe[o] = !0, console.error(
143
142
  "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."
144
- )), s = this.props.ref, s !== void 0 ? s : null;
143
+ )), o = this.props.ref, o !== void 0 ? o : null;
145
144
  }
146
- function d(s, f, y, T, J, ie) {
147
- var E = y.ref;
148
- return s = {
149
- $$typeof: h,
150
- type: s,
151
- key: f,
152
- props: y,
153
- _owner: T
154
- }, (E !== void 0 ? E : null) !== null ? Object.defineProperty(s, "ref", {
145
+ function b(o, i, m, g, W, H) {
146
+ var v = m.ref;
147
+ return o = {
148
+ $$typeof: E,
149
+ type: o,
150
+ key: i,
151
+ props: m,
152
+ _owner: g
153
+ }, (v !== void 0 ? v : null) !== null ? Object.defineProperty(o, "ref", {
155
154
  enumerable: !1,
156
- get: a
157
- }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
155
+ get: f
156
+ }) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
158
157
  configurable: !1,
159
158
  enumerable: !1,
160
159
  writable: !0,
161
160
  value: 0
162
- }), Object.defineProperty(s, "_debugInfo", {
161
+ }), Object.defineProperty(o, "_debugInfo", {
163
162
  configurable: !1,
164
163
  enumerable: !1,
165
164
  writable: !0,
166
165
  value: null
167
- }), Object.defineProperty(s, "_debugStack", {
166
+ }), Object.defineProperty(o, "_debugStack", {
168
167
  configurable: !1,
169
168
  enumerable: !1,
170
169
  writable: !0,
171
- value: J
172
- }), Object.defineProperty(s, "_debugTask", {
170
+ value: W
171
+ }), Object.defineProperty(o, "_debugTask", {
173
172
  configurable: !1,
174
173
  enumerable: !1,
175
174
  writable: !0,
176
- value: ie
177
- }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
175
+ value: H
176
+ }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
178
177
  }
179
- function m(s, f, y, T, J, ie) {
180
- var E = f.children;
181
- if (E !== void 0)
182
- if (T)
183
- if (tt(E)) {
184
- for (T = 0; T < E.length; T++)
185
- u(E[T]);
186
- Object.freeze && Object.freeze(E);
178
+ function p(o, i, m, g, W, H) {
179
+ var v = i.children;
180
+ if (v !== void 0)
181
+ if (g)
182
+ if (Se(v)) {
183
+ for (g = 0; g < v.length; g++)
184
+ d(v[g]);
185
+ Object.freeze && Object.freeze(v);
187
186
  } else
188
187
  console.error(
189
188
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
190
189
  );
191
- else u(E);
192
- if (pe.call(f, "key")) {
193
- E = e(s);
194
- var B = Object.keys(f).filter(function(rt) {
195
- return rt !== "key";
190
+ else d(v);
191
+ if (te.call(i, "key")) {
192
+ v = e(o);
193
+ var S = Object.keys(i).filter(function(Ae) {
194
+ return Ae !== "key";
196
195
  });
197
- T = 0 < B.length ? "{key: someKey, " + B.join(": ..., ") + ": ...}" : "{key: someKey}", we[E + T] || (B = 0 < B.length ? "{" + B.join(": ..., ") + ": ...}" : "{}", console.error(
196
+ g = 0 < S.length ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}", ae[v + g] || (S = 0 < S.length ? "{" + S.join(": ..., ") + ": ...}" : "{}", console.error(
198
197
  `A props object containing a "key" prop is being spread into JSX:
199
198
  let props = %s;
200
199
  <%s {...props} />
201
200
  React keys must be passed directly to JSX without using spread:
202
201
  let props = %s;
203
202
  <%s key={someKey} {...props} />`,
204
- T,
205
- E,
206
- B,
207
- E
208
- ), we[E + T] = !0);
203
+ g,
204
+ v,
205
+ S,
206
+ v
207
+ ), ae[v + g] = !0);
209
208
  }
210
- if (E = null, y !== void 0 && (r(y), E = "" + y), c(f) && (r(f.key), E = "" + f.key), "key" in f) {
211
- y = {};
212
- for (var ae in f)
213
- ae !== "key" && (y[ae] = f[ae]);
214
- } else y = f;
215
- return E && l(
216
- y,
217
- typeof s == "function" ? s.displayName || s.name || "Unknown" : s
218
- ), d(
219
- s,
220
- E,
221
- y,
222
- o(),
223
- J,
224
- ie
209
+ if (v = null, m !== void 0 && (r(m), v = "" + m), l(i) && (r(i.key), v = "" + i.key), "key" in i) {
210
+ m = {};
211
+ for (var J in i)
212
+ J !== "key" && (m[J] = i[J]);
213
+ } else m = i;
214
+ return v && u(
215
+ m,
216
+ typeof o == "function" ? o.displayName || o.name || "Unknown" : o
217
+ ), b(
218
+ o,
219
+ v,
220
+ m,
221
+ s(),
222
+ W,
223
+ H
225
224
  );
226
225
  }
227
- function u(s) {
228
- p(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === F && (s._payload.status === "fulfilled" ? p(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
226
+ function d(o) {
227
+ T(o) ? o._store && (o._store.validated = 1) : typeof o == "object" && o !== null && o.$$typeof === Y && (o._payload.status === "fulfilled" ? T(o._payload.value) && o._payload.value._store && (o._payload.value._store.validated = 1) : o._store && (o._store.validated = 1));
229
228
  }
230
- function p(s) {
231
- return typeof s == "object" && s !== null && s.$$typeof === h;
229
+ function T(o) {
230
+ return typeof o == "object" && o !== null && o.$$typeof === E;
232
231
  }
233
- var b = D, h = Symbol.for("react.transitional.element"), O = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), R = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), A = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), L = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), Qe = Symbol.for("react.activity"), et = Symbol.for("react.client.reference"), oe = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, pe = Object.prototype.hasOwnProperty, tt = Array.isArray, se = console.createTask ? console.createTask : function() {
232
+ var w = R, E = Symbol.for("react.transitional.element"), C = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), L = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), Re = Symbol.for("react.forward_ref"), _e = Symbol.for("react.suspense"), Ne = Symbol.for("react.suspense_list"), Pe = Symbol.for("react.memo"), Y = Symbol.for("react.lazy"), ke = Symbol.for("react.activity"), Ce = Symbol.for("react.client.reference"), V = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, te = Object.prototype.hasOwnProperty, Se = Array.isArray, G = console.createTask ? console.createTask : function() {
234
233
  return null;
235
234
  };
236
- b = {
237
- react_stack_bottom_frame: function(s) {
238
- return s();
235
+ w = {
236
+ react_stack_bottom_frame: function(o) {
237
+ return o();
239
238
  }
240
239
  };
241
- var be, he = {}, ve = b.react_stack_bottom_frame.bind(
242
- b,
243
- i
244
- )(), ye = se(n(i)), we = {};
245
- G.Fragment = x, G.jsx = function(s, f, y) {
246
- var T = 1e4 > oe.recentlyCreatedOwnerStacks++;
247
- return m(
248
- s,
249
- f,
250
- y,
240
+ var re, oe = {}, ne = w.react_stack_bottom_frame.bind(
241
+ w,
242
+ a
243
+ )(), se = G(n(a)), ae = {};
244
+ D.Fragment = N, D.jsx = function(o, i, m) {
245
+ var g = 1e4 > V.recentlyCreatedOwnerStacks++;
246
+ return p(
247
+ o,
248
+ i,
249
+ m,
251
250
  !1,
252
- T ? Error("react-stack-top-frame") : ve,
253
- T ? se(n(s)) : ye
251
+ g ? Error("react-stack-top-frame") : ne,
252
+ g ? G(n(o)) : se
254
253
  );
255
- }, G.jsxs = function(s, f, y) {
256
- var T = 1e4 > oe.recentlyCreatedOwnerStacks++;
257
- return m(
258
- s,
259
- f,
260
- y,
254
+ }, D.jsxs = function(o, i, m) {
255
+ var g = 1e4 > V.recentlyCreatedOwnerStacks++;
256
+ return p(
257
+ o,
258
+ i,
259
+ m,
261
260
  !0,
262
- T ? Error("react-stack-top-frame") : ve,
263
- T ? se(n(s)) : ye
261
+ g ? Error("react-stack-top-frame") : ne,
262
+ g ? G(n(o)) : se
264
263
  );
265
264
  };
266
- }()), G;
265
+ })()), D;
267
266
  }
268
- var ke;
269
- function ft() {
270
- return ke || (ke = 1, process.env.NODE_ENV === "production" ? q.exports = ut() : q.exports = dt()), q.exports;
267
+ var le;
268
+ function ze() {
269
+ return le || (le = 1, process.env.NODE_ENV === "production" ? M.exports = Be() : M.exports = Fe()), M.exports;
271
270
  }
272
- var g = ft();
273
- const Le = nt({
271
+ var c = ze();
272
+ const Z = Le({
274
273
  client: null,
275
274
  insights: null
276
- }), gn = ({ children: e, client: t, insights: r = null }) => {
277
- const n = {
278
- client: t,
279
- insights: r
280
- };
281
- return /* @__PURE__ */ g.jsx(Le.Provider, { value: n, children: e });
282
- }, P = () => {
283
- const e = Re(Le);
275
+ }), $t = ({ children: e, client: t, insights: r = null }) => /* @__PURE__ */ c.jsx(Z.Provider, { value: { client: t, insights: r }, children: e }), Q = () => {
276
+ const e = K(Z);
284
277
  if (!e.client)
285
278
  throw new Error(
286
279
  "useLevo must be used within a LevoProvider. Please ensure you have wrapped your component tree with LevoProvider."
287
280
  );
288
- return e;
289
- }, mn = ({ id: e, properties: t = {} }) => {
290
- const { insights: r } = P(), [n, o] = N(!1);
291
- return k(() => {
281
+ return e.client;
282
+ }, ee = () => K(Z).insights, Wt = ({ id: e, properties: t = {} }) => {
283
+ const r = ee(), [n, s] = P(!1);
284
+ return O(() => {
292
285
  if (n || typeof r?.track != "function") return;
293
- const i = document.getElementById(e);
294
- if (!i) return;
295
- const c = () => {
286
+ const a = document.getElementById(e);
287
+ if (!a) return;
288
+ const l = () => {
296
289
  n || (r?.track("block.view", {
297
290
  ...t,
298
291
  resource: "block",
299
292
  identifier: e
300
- }), o(!0));
293
+ }), s(!0));
301
294
  };
302
- if (((d) => {
303
- const m = d.getBoundingClientRect();
304
- return m.top >= 0 && m.left >= 0 && m.bottom <= (window.innerHeight || document.documentElement.clientHeight) && m.right <= (window.innerWidth || document.documentElement.clientWidth);
305
- })(i)) {
306
- c();
295
+ if (((b) => {
296
+ const p = b.getBoundingClientRect();
297
+ return p.top >= 0 && p.left >= 0 && p.bottom <= (window.innerHeight || document.documentElement.clientHeight) && p.right <= (window.innerWidth || document.documentElement.clientWidth);
298
+ })(a)) {
299
+ l();
307
300
  return;
308
301
  }
309
- const a = new IntersectionObserver(
310
- (d) => {
311
- d.forEach((m) => {
312
- m.isIntersecting && (c(), a.disconnect());
302
+ const f = new IntersectionObserver(
303
+ (b) => {
304
+ b.forEach((p) => {
305
+ p.isIntersecting && (l(), f.disconnect());
313
306
  });
314
307
  },
315
308
  { threshold: 0 }
316
309
  );
317
- return a.observe(i), () => {
318
- a.disconnect();
310
+ return f.observe(a), () => {
311
+ f.disconnect();
319
312
  };
320
313
  }, [r, e, t, n]), null;
321
- }, pn = ({ event: e, properties: t }) => {
322
- const { insights: r } = P();
323
- return k(() => {
324
- r?.instance && r?.track(e, t);
314
+ }, Mt = ({ event: e, properties: t }) => {
315
+ const r = ee();
316
+ return O(() => {
317
+ r?.track(e, t);
325
318
  }, [r, e, t]), null;
326
- }, gt = ({ id: e }) => {
327
- const { client: t, insights: r } = P(), { logger: n } = t, o = H(!1), i = Q(
328
- (l) => {
329
- if (!o.current) {
330
- o.current = !0;
331
- try {
332
- r?.bounce({
333
- resource: "page",
334
- identifier: e,
335
- ...l
336
- });
337
- } catch (a) {
338
- n?.error("Failed to send bounce event", U(a));
339
- }
340
- }
341
- },
342
- [r, e, n]
343
- );
344
- k(() => {
345
- o.current = !1;
346
- const l = () => {
347
- const a = performance.getEntriesByType("navigation")?.[0];
348
- let d = !1;
349
- if (a)
350
- a.type === "navigate" && (d = !0);
351
- else
352
- try {
353
- const m = document.activeElement;
354
- m?.tagName === "A" && m.href && new URL(m.href).origin !== window.location.origin && (d = !0);
355
- } catch {
356
- }
357
- i({
358
- is_navigating_away: d,
359
- navigation_type: a?.type,
360
- trigger: "beforeunload"
361
- });
362
- };
363
- return window.addEventListener("beforeunload", l), () => {
364
- window.removeEventListener("beforeunload", l);
365
- };
366
- }, [i]);
367
- const [c] = st();
368
- k(() => {
369
- (c === xe.FROZEN || c === xe.TERMINATED) && i({
370
- state: c,
371
- trigger: "lifecycle"
319
+ }, Bt = ({ id: e }) => {
320
+ const t = Q(), r = ee();
321
+ return O(() => {
322
+ t && typeof window < "u" && (window.levo_client = t);
323
+ }, [t]), O(() => {
324
+ r && typeof window < "u" && (window.levo_insights = r);
325
+ }, [r]), O(() => {
326
+ r && e && r.init({
327
+ pageId: e
372
328
  });
373
- }, [c, i]);
374
- }, mt = () => {
375
- const { insights: e } = P(), [t, r] = N(null);
376
- return k(() => {
377
- if (!e) return;
378
- let n = sessionStorage.getItem(e.storage_keys.current_tab);
379
- const o = JSON.parse(localStorage.getItem(e.storage_keys.all_tabs) || "[]");
380
- n && o.includes(n) && (n = null), n || (n = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, sessionStorage.setItem(e.storage_keys.current_tab, n)), o.includes(n) || (o.push(n), localStorage.setItem(e.storage_keys.all_tabs, JSON.stringify(o))), r(n);
381
- const i = () => {
382
- const c = o.filter((l) => l !== n);
383
- localStorage.setItem(e.storage_keys.all_tabs, JSON.stringify(c));
384
- };
385
- return window.addEventListener("beforeunload", i), () => {
386
- window.removeEventListener("beforeunload", i);
387
- };
388
- }, [e]), t;
389
- }, pt = ({
390
- id: e,
391
- properties: t = {},
392
- href: r
393
- }) => {
394
- const { client: n, insights: o } = P();
395
- k(() => {
396
- (() => {
397
- o && n.workspace && r && (o?.instance ? o.instance.page({
398
- resource: "page",
399
- identifier: e
400
- }) : o?.initiate({
401
- ...t,
402
- id: e,
403
- created_at: (/* @__PURE__ */ new Date()).toISOString()
404
- }));
405
- })();
406
- }, [n, o, e, t, r]);
407
- }, bt = () => {
408
- const { insights: e } = P(), [t, r] = N(0);
409
- return k(() => {
410
- if (!e) return;
411
- const n = Number(localStorage.getItem(e.storage_keys.open_tabs)) || 0;
412
- r(n), localStorage.setItem(e.storage_keys.open_tabs, (n + 1).toString());
413
- const o = (c) => {
414
- c.key === e.storage_keys.open_tabs && r(Number(c.newValue) || 0);
415
- };
416
- window.addEventListener("storage", o);
417
- const i = () => {
418
- const c = Number(localStorage.getItem(e.storage_keys.open_tabs)) || 0;
419
- c > 0 && localStorage.setItem(e.storage_keys.open_tabs, (c - 1).toString());
420
- };
421
- return window.addEventListener("beforeunload", i), () => {
422
- window.removeEventListener("storage", o), window.removeEventListener("beforeunload", i);
423
- };
424
- }, [e]), t;
329
+ }, [r, e]), null;
425
330
  };
426
- function de(e) {
427
- var t = typeof e;
428
- return e != null && (t == "object" || t == "function");
429
- }
430
- var ht = typeof global == "object" && global && global.Object === Object && global, vt = typeof self == "object" && self && self.Object === Object && self, Pe = ht || vt || Function("return this")(), ce = function() {
431
- return Pe.Date.now();
432
- }, yt = /\s/;
433
- function wt(e) {
434
- for (var t = e.length; t-- && yt.test(e.charAt(t)); )
435
- ;
436
- return t;
437
- }
438
- var xt = /^\s+/;
439
- function Tt(e) {
440
- return e && e.slice(0, wt(e) + 1).replace(xt, "");
441
- }
442
- var ee = Pe.Symbol, Ae = Object.prototype, Et = Ae.hasOwnProperty, kt = Ae.toString, X = ee ? ee.toStringTag : void 0;
443
- function _t(e) {
444
- var t = Et.call(e, X), r = e[X];
445
- try {
446
- e[X] = void 0;
447
- var n = !0;
448
- } catch {
449
- }
450
- var o = kt.call(e);
451
- return n && (t ? e[X] = r : delete e[X]), o;
452
- }
453
- var St = Object.prototype, Ot = St.toString;
454
- function Nt(e) {
455
- return Ot.call(e);
456
- }
457
- var jt = "[object Null]", Rt = "[object Undefined]", _e = ee ? ee.toStringTag : void 0;
458
- function Ct(e) {
459
- return e == null ? e === void 0 ? Rt : jt : _e && _e in Object(e) ? _t(e) : Nt(e);
460
- }
461
- function Lt(e) {
462
- return e != null && typeof e == "object";
463
- }
464
- var Pt = "[object Symbol]";
465
- function At(e) {
466
- return typeof e == "symbol" || Lt(e) && Ct(e) == Pt;
467
- }
468
- var Se = NaN, It = /^[-+]0x[0-9a-f]+$/i, Dt = /^0b[01]+$/i, $t = /^0o[0-7]+$/i, Mt = parseInt;
469
- function Oe(e) {
470
- if (typeof e == "number")
471
- return e;
472
- if (At(e))
473
- return Se;
474
- if (de(e)) {
475
- var t = typeof e.valueOf == "function" ? e.valueOf() : e;
476
- e = de(t) ? t + "" : t;
477
- }
478
- if (typeof e != "string")
479
- return e === 0 ? e : +e;
480
- e = Tt(e);
481
- var r = Dt.test(e);
482
- return r || $t.test(e) ? Mt(e.slice(2), r ? 2 : 8) : It.test(e) ? Se : +e;
483
- }
484
- var Wt = "Expected a function", Ft = Math.max, Bt = Math.min;
485
- function Ut(e, t, r) {
486
- var n, o, i, c, l, a, d = 0, m = !1, u = !1, p = !0;
487
- if (typeof e != "function")
488
- throw new TypeError(Wt);
489
- t = Oe(t) || 0, de(r) && (m = !!r.leading, u = "maxWait" in r, i = u ? Ft(Oe(r.maxWait) || 0, t) : i, p = "trailing" in r ? !!r.trailing : p);
490
- function b(v) {
491
- var L = n, I = o;
492
- return n = o = void 0, d = v, c = e.apply(I, L), c;
493
- }
494
- function h(v) {
495
- return d = v, l = setTimeout(R, t), m ? b(v) : c;
496
- }
497
- function O(v) {
498
- var L = v - a, I = v - d, F = t - L;
499
- return u ? Bt(F, i - I) : F;
500
- }
501
- function x(v) {
502
- var L = v - a, I = v - d;
503
- return a === void 0 || L >= t || L < 0 || u && I >= i;
504
- }
505
- function R() {
506
- var v = ce();
507
- if (x(v))
508
- return w(v);
509
- l = setTimeout(R, O(v));
510
- }
511
- function w(v) {
512
- return l = void 0, p && n ? b(v) : (n = o = void 0, c);
513
- }
514
- function _() {
515
- l !== void 0 && clearTimeout(l), d = 0, n = a = o = l = void 0;
516
- }
517
- function A() {
518
- return l === void 0 ? c : w(ce());
519
- }
520
- function M() {
521
- var v = ce(), L = x(v);
522
- if (n = arguments, o = this, a = v, L) {
523
- if (l === void 0)
524
- return h(a);
525
- if (u)
526
- return clearTimeout(l), l = setTimeout(R, t), b(a);
527
- }
528
- return l === void 0 && (l = setTimeout(R, t)), c;
529
- }
530
- return M.cancel = _, M.flush = A, M;
531
- }
532
- const Yt = () => {
533
- const [e, t] = N(0), [r, n] = N("read"), [o, i] = N("down"), c = H({
534
- prevMilestone: 0,
535
- prevScrollY: 0,
536
- prevTime: Date.now()
537
- }), l = H({ setDepth: t, setSpeedCategory: n, setDirection: i });
538
- l.current = { setDepth: t, setSpeedCategory: n, setDirection: i };
539
- const a = fe(
540
- () => Ut(() => {
541
- const d = window.scrollY, m = document.documentElement.scrollHeight, u = window.innerHeight, p = m - u;
542
- if (p <= 0) return;
543
- const b = Math.round(d / p * 100), h = Math.max(0, Math.min(100, b)), O = Math.floor(h / 5) * 5, { prevMilestone: x, prevScrollY: R, prevTime: w } = c.current, _ = O > x ? "down" : "up";
544
- if (O === x)
545
- return;
546
- const A = Date.now(), M = (A - w) / 1e3, v = Math.abs(d - R), I = (M > 0 ? v / M : 0) > 300 ? "scan" : "read";
547
- c.current = {
548
- prevMilestone: O,
549
- prevScrollY: d,
550
- prevTime: A
551
- }, l.current.setDepth(O), l.current.setSpeedCategory(I), l.current.setDirection(_);
552
- }, 250),
553
- []
554
- );
555
- return k(() => (window.addEventListener("scroll", a), () => {
556
- window.removeEventListener("scroll", a), a.cancel();
557
- }), [a]), { depth: e, speedCategory: r, direction: o };
558
- }, te = (e) => Object.prototype.toString.call(e) == "[object String]", Ht = (e, t) => e.indexOf(t) !== -1, Y = (e) => e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), Ie = (e) => e === void 0, zt = (e) => e === null, De = (e) => Ie(e) || zt(e), $e = (e) => !!e && e?.nodeType === 3;
559
- function Vt(e) {
560
- return !!e && e?.nodeType === 1;
561
- }
562
- function Gt(e, t) {
563
- return !!e && !!e?.tagName && e?.tagName.toLowerCase() === t.toLowerCase();
564
- }
565
- function Xt(e) {
566
- return e ? Y(e).split(/\s+/) : [];
567
- }
568
- function Jt(e) {
569
- let t = "";
570
- switch (typeof e?.className) {
571
- case "string":
572
- t = e?.className;
573
- break;
574
- // TODO: when is this ever used?
575
- case "object":
576
- t = (e?.className && "baseVal" in e?.className ? (e?.className).baseVal : null) || e?.getAttribute("class") || "";
577
- break;
578
- default:
579
- t = "";
580
- }
581
- return Xt(t);
582
- }
583
- const S = (e, t = 255) => De(e) ? "" : Y(e).split(/(\s+)/).filter((r) => me(r)).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, t), Me = [
584
- "span",
585
- "strong",
586
- "em",
587
- "i",
588
- "b",
589
- "mark",
590
- "code",
591
- "small",
592
- "sub",
593
- "sup",
594
- "label"
595
- ], ge = (e) => {
596
- let t = "";
597
- if (Qt(e) && e?.childNodes && e?.childNodes.length) {
598
- for (const r of e?.childNodes)
599
- $e(r) && r.textContent && (t += S(r.textContent) ?? "");
600
- if (!Y(t)) {
601
- const r = e.querySelectorAll(Me.join(", "));
602
- for (const n of r) {
603
- const o = n.textContent;
604
- o && (t += `${S(o)} `);
605
- }
606
- }
607
- if (!Y(t) && e instanceof HTMLElement) {
608
- const r = e.innerText;
609
- r && (t = S(r.substring(0, 500)));
610
- }
611
- }
612
- return Y(t);
613
- }, qt = (e) => Ie(e.target) ? e?.srcElement || null : e?.target?.shadowRoot ? e?.composedPath()?.[0] || null : e?.target || null, Kt = (e, t) => {
614
- if (!window || !e || Gt(e, "html") || !Vt(e))
615
- return !1;
616
- const r = window.getComputedStyle(e);
617
- if (r && r.getPropertyValue("cursor") === "pointer" && t.type === "click")
618
- return !0;
619
- switch (e?.tagName.toLowerCase()) {
620
- case "html":
621
- return !1;
622
- case "form":
623
- return t.type === "submit";
624
- case "input":
625
- case "select":
626
- case "textarea":
627
- return ["change", "click"].includes(t.type);
628
- default:
629
- return t.type === "click";
630
- }
631
- }, Zt = /* @__PURE__ */ new Set([
632
- "password",
633
- "passwd",
634
- "pwd",
635
- "creditcard",
636
- "cardnumber",
637
- "ccnum",
638
- "ccnumber",
639
- "cvv",
640
- "cvc",
641
- "csc",
642
- "securitycode",
643
- "ssn",
644
- "socialsecurity",
645
- "routingnumber",
646
- "accountnumber",
647
- "bankaccount",
648
- "secretkey",
649
- "apikey",
650
- "accesstoken"
651
- ]);
652
- function Qt(e) {
653
- if (Ht(Jt(e), "ph-include"))
654
- return !0;
655
- const t = e.type || "";
656
- if (te(t))
657
- switch (t.toLowerCase()) {
658
- case "hidden":
659
- return !1;
660
- case "password":
661
- return !1;
662
- }
663
- const r = e.name || e?.id || "";
664
- if (te(r)) {
665
- const n = r.toLowerCase().replace(/[^a-z]/g, "");
666
- if (Zt.has(n))
667
- return !1;
668
- }
669
- return !0;
670
- }
671
- const We = "(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})", er = new RegExp(`^(?:${We})$`), tr = new RegExp(We), Fe = "\\d{3}-?\\d{2}-?\\d{4}", rr = new RegExp(`^(${Fe})$`), nr = new RegExp(`(${Fe})`), me = (e, t = !0) => !(De(e) || te(e) && (e = Y(e), (t ? er : tr).test((e || "").replace(/[- ]/g, "")) || (t ? rr : nr).test(e))), or = (e) => te(e) ? e.substring(0, 10) === "_ngcontent" || e.substring(0, 7) === "_nghost" : !1, sr = (e) => {
672
- let t = ge(e);
673
- return t = `${t} ${Be(e)}`.trim(), me(t) ? t : "";
674
- };
675
- function Be(e) {
676
- let t = "";
677
- if (e?.childNodes.length)
678
- for (const r of e.childNodes) {
679
- const n = r.tagName?.toLowerCase();
680
- if (r && n && Me.includes(n))
681
- try {
682
- const o = ge(r);
683
- t = `${t} ${o}`.trim(), r?.childNodes.length && (t = `${t} ${Be(r)}`.trim());
684
- } catch {
685
- }
686
- }
687
- return t;
688
- }
689
- const ir = (e) => {
690
- const t = e.tagName?.toLowerCase(), r = t === "a" || t === "button" ? sr(e) : ge(e);
691
- if (r) return { text: r, source: "text" };
692
- const n = e.getAttribute("aria-label");
693
- if (n) return { text: S(n), source: "aria-label" };
694
- const o = e.getAttribute("title");
695
- if (o) return { text: S(o), source: "title" };
696
- const i = e.getAttribute("data-track-label");
697
- if (i) return { text: S(i), source: "data-track-label" };
698
- const c = e.querySelector("img[alt], svg[aria-label]");
699
- if (c) {
700
- const a = c.getAttribute("alt") || c.getAttribute("aria-label");
701
- if (a) return { text: S(a), source: "alt" };
702
- }
703
- const l = e.getAttribute("placeholder");
704
- if (l) return { text: S(l), source: "placeholder" };
705
- if (e instanceof HTMLElement && e.innerText) {
706
- const a = e.innerText.substring(0, 500);
707
- if (a.trim())
708
- return { text: S(a), source: "innerText" };
709
- }
710
- return { text: "", source: "none" };
711
- }, ar = ["input", "textarea", "select"], Ue = (e) => {
712
- const t = e?.tagName?.toLowerCase(), r = {
713
- element: t
714
- }, n = ir(e);
715
- r.text = n.text, r.text_source = n.source;
716
- const o = e.getAttribute("aria-label");
717
- o && (r.aria_label = S(o));
718
- const i = e.getAttribute("role");
719
- i && (r.role = i);
720
- const c = {};
721
- for (const a of e.attributes)
722
- (a.name.startsWith("data-track-") || a.name.startsWith("data-analytics-")) && (c[a.name] = S(a.value));
723
- Object.keys(c).length && (r.tracking_data = c);
724
- const l = Array.from(e.attributes).reduce(
725
- (a, d) => {
726
- if (me(d.value) && !or(d.name)) {
727
- if (d.name === "class" || d.name.startsWith("data-track-") || d.name.startsWith("data-analytics-"))
728
- return a;
729
- a[d.name] = typeof d?.value == "string" ? S(d.value) : d.value;
730
- }
731
- return a;
732
- },
733
- {}
734
- );
735
- if (r.attributes = l, ar.includes(t) || e?.getAttribute("contenteditable") === "true") {
736
- let a;
737
- e.matches('input[type="checkbox"], input[type="radio"]') ? a = e.checked : e.matches("input, select, textarea") && !e.matches('input[type="password"]') && (a = e.value), a !== void 0 && (r.value = typeof a == "string" || a === null ? S(a, 1024) : a);
738
- let d = "";
739
- r?.attributes.id && (d = S(
740
- document.querySelector(`label[for="${r?.attributes.id}"]`)?.textContent?.trim() || ""
741
- ));
742
- const m = e.closest("label");
743
- d || (d = S(m?.textContent?.trim() || "")), d && (r.label = d);
744
- }
745
- return r;
746
- }, cr = (e, t) => {
747
- let r = qt(e);
748
- $e(r) && (r = r.parentNode || null);
749
- const n = ["copy", "cut"].includes(t);
750
- if (r && (n || Kt(r, e))) {
751
- const o = Ue(r);
752
- if (n) {
753
- const i = S(window?.getSelection()?.toString()), c = e?.type || "clipboard";
754
- o.copy_text = i ?? "", o.copy_type = c;
755
- }
756
- return o;
757
- }
758
- return null;
759
- }, lr = () => {
760
- const { insights: e } = P();
761
- k(() => {
762
- let t;
763
- const r = () => {
764
- clearTimeout(t), t = setTimeout(() => {
765
- const n = window.getSelection();
766
- if (n && n?.rangeCount > 0) {
767
- const o = n?.toString();
768
- o && e?.track("page.selection", {
769
- text: S(o)
770
- });
771
- }
772
- }, 1e3);
773
- };
774
- return document.addEventListener("selectionchange", r), () => {
775
- clearTimeout(t), document.removeEventListener("selectionchange", r);
776
- };
777
- }, [e]);
778
- }, ur = 30, dr = 1e3, fr = 3;
779
- class gr {
780
- clicks;
781
- constructor() {
782
- this.clicks = [];
783
- }
784
- /**
785
- * Check if the current click is part of a rage click sequence.
786
- * Returns true for 3+ consecutive clicks within threshold.
787
- */
788
- isRageClick(t, r, n) {
789
- const o = this.clicks[this.clicks.length - 1];
790
- if (o && Math.abs(t - o.x) + Math.abs(r - o.y) < ur && n - o.timestamp < dr) {
791
- if (this.clicks.push({ x: t, y: r, timestamp: n }), this.clicks.length >= fr)
792
- return !0;
793
- } else
794
- this.clicks = [{ x: t, y: r, timestamp: n }];
795
- return !1;
796
- }
797
- /**
798
- * Reset the click sequence (useful for testing)
799
- */
800
- reset() {
801
- this.clicks = [];
802
- }
803
- }
804
- const mr = new gr(), pr = (e) => {
805
- let t = e, r = 0;
806
- for (; t && r < 10; ) {
807
- const n = t.getAttribute?.("href");
808
- if (n)
809
- return n;
810
- t = t.parentElement, r++;
811
- }
812
- return null;
813
- }, le = (e) => {
814
- const t = e.closest("a[href]"), r = t?.getAttribute("href") || pr(e);
815
- if (!r) return { type: null, href: null };
816
- if (t?.hasAttribute("download"))
817
- return { type: "download", href: r };
818
- if (r.startsWith("tel:")) return { type: "tel", href: r };
819
- if (r.startsWith("mailto:")) return { type: "mailto", href: r };
820
- if (r.startsWith("#")) return { type: "anchor", href: r };
821
- try {
822
- return {
823
- type: new URL(r, window.location.origin).origin === window.location.origin ? "internal" : "external",
824
- href: r
825
- };
826
- } catch {
827
- return { type: "internal", href: r };
828
- }
829
- }, br = () => {
830
- const { client: e, insights: t } = P(), { logger: r } = e, n = H(0);
831
- k(() => {
832
- let o = null;
833
- const i = (u, p = !1) => {
834
- const b = u.target, h = "clientX" in u ? u.clientX : u.changedTouches?.[0]?.clientX ?? 0, O = "clientY" in u ? u.clientY : u.changedTouches?.[0]?.clientY ?? 0;
835
- let x = {
836
- hostname: window.location.hostname,
837
- pathname: window.location.pathname,
838
- page_title: document.title,
839
- url: window.location.href,
840
- created_at: (/* @__PURE__ */ new Date()).toISOString(),
841
- event_type: p ? "dblclick" : "click",
842
- button_type: "button" in u ? u.button : 0
843
- };
844
- return b instanceof HTMLElement && (x.rage_click = mr?.isRageClick(h, O, Date.now()), x = {
845
- ...x,
846
- ...Ue(b)
847
- }), x;
848
- }, c = (u, p) => {
849
- try {
850
- if (Date.now() - n.current < 300) return;
851
- const b = i(u);
852
- if (!t) {
853
- r?.warn("Cannot track navigation click: missing insights");
854
- return;
855
- }
856
- t?.track("page.click", {
857
- ...b,
858
- href: p.href || void 0,
859
- link_type: p.type,
860
- is_navigation: !0
861
- });
862
- } catch (b) {
863
- r?.error("Failed to track navigation click", U(b));
864
- }
865
- }, l = (u, p = !1) => {
866
- try {
867
- if (!(u.target instanceof HTMLElement) || Date.now() - n.current < 300) return;
868
- const b = i(u, p), h = le(u.target);
869
- t?.track("page.click", {
870
- ...b,
871
- href: h.href || void 0,
872
- link_type: h.type || void 0
873
- });
874
- } catch (b) {
875
- r?.error("Failed to track click", U(b));
876
- }
877
- }, a = (u) => {
878
- if (!(u.target instanceof HTMLElement)) return;
879
- const p = le(u.target);
880
- if (p.type === "external" || p.type === "download") {
881
- c(u, p);
882
- return;
883
- }
884
- if (o) {
885
- clearTimeout(o), o = null;
886
- return;
887
- }
888
- o = setTimeout(() => {
889
- l(u, !1), o = null;
890
- }, 250);
891
- }, d = (u) => {
892
- o && (clearTimeout(o), o = null), l(u, !0);
893
- }, m = (u) => {
894
- try {
895
- if (!(u.target instanceof HTMLElement)) return;
896
- n.current = Date.now();
897
- const p = le(u.target);
898
- if (p.type === "external" || p.type === "download") {
899
- const h = i(u);
900
- t?.track("page.click", {
901
- ...h,
902
- href: p.href || void 0,
903
- link_type: p.type,
904
- is_navigation: !0,
905
- is_touch: !0
906
- });
907
- return;
908
- }
909
- const b = i(u);
910
- t?.track("page.click", {
911
- ...b,
912
- href: p.href || void 0,
913
- link_type: p.type || void 0,
914
- is_touch: !0
915
- });
916
- } catch (p) {
917
- r?.error("Failed to track touch", U(p));
918
- }
919
- };
920
- return document.addEventListener("click", a), document.addEventListener("dblclick", d), document.addEventListener("touchend", m, { passive: !0 }), () => {
921
- document.removeEventListener("click", a), document.removeEventListener("dblclick", d), document.removeEventListener("touchend", m), o && clearTimeout(o);
922
- };
923
- }, [t, r]);
924
- }, bn = ({ id: e, properties: t = {} }) => {
925
- const r = typeof window < "u" ? window.location.href : "", { client: n, insights: o } = P();
926
- k(() => {
927
- n && typeof window < "u" && (window.levo_client = n);
928
- }, [n]), k(() => {
929
- o && typeof window < "u" && (window.levo_audience = o);
930
- }, [o]), bt(), mt(), br();
931
- const i = Yt();
932
- return k(() => {
933
- o?.instance && o.track("page.scroll", {
934
- resource: "page",
935
- identifier: e,
936
- percent: i.depth,
937
- speed_category: i.speedCategory
938
- });
939
- }, [o, i.depth, i.speedCategory, e]), lr(), pt({
940
- href: r,
941
- id: e,
942
- properties: t
943
- }), gt({ id: e }), k(() => {
944
- const c = {
945
- change: "form.change",
946
- submit: "form.submit",
947
- copy: "page.copy",
948
- cut: "page.copy"
949
- }, l = (d) => (m) => {
950
- const u = cr(m, d);
951
- u && c[d] && o?.track(c[d], u);
952
- }, a = {
953
- change: l("change"),
954
- copy: l("copy"),
955
- cut: l("cut"),
956
- submit: l("submit")
957
- };
958
- return document.addEventListener("change", a.change), document.addEventListener("copy", a.copy), document.addEventListener("cut", a.cut), document.addEventListener("submit", a.submit), () => {
959
- document.removeEventListener("change", a.change), document.removeEventListener("copy", a.copy), document.removeEventListener("cut", a.cut), document.removeEventListener("submit", a.submit);
960
- };
961
- }, []), (!o || !n.workspace || !n.workspace.startsWith("W")) && console.error(
962
- "[@levo-so/react] The utility could not be initialized, due to missing workspace, or endpoint for insights."
963
- ), null;
964
- };
965
- var Ye = {
331
+ var ve = {
966
332
  color: void 0,
967
333
  size: void 0,
968
334
  className: void 0,
969
335
  style: void 0,
970
336
  attr: void 0
971
- }, Ne = D.createContext && /* @__PURE__ */ D.createContext(Ye), hr = ["attr", "size", "title"];
972
- function vr(e, t) {
337
+ }, ue = R.createContext && /* @__PURE__ */ R.createContext(ve), Ue = ["attr", "size", "title"];
338
+ function Ye(e, t) {
973
339
  if (e == null) return {};
974
- var r = yr(e, t), n, o;
340
+ var r = Ve(e, t), n, s;
975
341
  if (Object.getOwnPropertySymbols) {
976
- var i = Object.getOwnPropertySymbols(e);
977
- for (o = 0; o < i.length; o++)
978
- n = i[o], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
342
+ var a = Object.getOwnPropertySymbols(e);
343
+ for (s = 0; s < a.length; s++)
344
+ n = a[s], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
979
345
  }
980
346
  return r;
981
347
  }
982
- function yr(e, t) {
348
+ function Ve(e, t) {
983
349
  if (e == null) return {};
984
350
  var r = {};
985
351
  for (var n in e)
@@ -989,45 +355,45 @@ function yr(e, t) {
989
355
  }
990
356
  return r;
991
357
  }
992
- function re() {
993
- return re = Object.assign ? Object.assign.bind() : function(e) {
358
+ function z() {
359
+ return z = Object.assign ? Object.assign.bind() : function(e) {
994
360
  for (var t = 1; t < arguments.length; t++) {
995
361
  var r = arguments[t];
996
362
  for (var n in r)
997
363
  Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
998
364
  }
999
365
  return e;
1000
- }, re.apply(this, arguments);
366
+ }, z.apply(this, arguments);
1001
367
  }
1002
- function je(e, t) {
368
+ function de(e, t) {
1003
369
  var r = Object.keys(e);
1004
370
  if (Object.getOwnPropertySymbols) {
1005
371
  var n = Object.getOwnPropertySymbols(e);
1006
- t && (n = n.filter(function(o) {
1007
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
372
+ t && (n = n.filter(function(s) {
373
+ return Object.getOwnPropertyDescriptor(e, s).enumerable;
1008
374
  })), r.push.apply(r, n);
1009
375
  }
1010
376
  return r;
1011
377
  }
1012
- function ne(e) {
378
+ function U(e) {
1013
379
  for (var t = 1; t < arguments.length; t++) {
1014
380
  var r = arguments[t] != null ? arguments[t] : {};
1015
- t % 2 ? je(Object(r), !0).forEach(function(n) {
1016
- wr(e, n, r[n]);
1017
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : je(Object(r)).forEach(function(n) {
381
+ t % 2 ? de(Object(r), !0).forEach(function(n) {
382
+ Ge(e, n, r[n]);
383
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : de(Object(r)).forEach(function(n) {
1018
384
  Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
1019
385
  });
1020
386
  }
1021
387
  return e;
1022
388
  }
1023
- function wr(e, t, r) {
1024
- return t = xr(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
389
+ function Ge(e, t, r) {
390
+ return t = He(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
1025
391
  }
1026
- function xr(e) {
1027
- var t = Tr(e, "string");
392
+ function He(e) {
393
+ var t = Je(e, "string");
1028
394
  return typeof t == "symbol" ? t : t + "";
1029
395
  }
1030
- function Tr(e, t) {
396
+ function Je(e, t) {
1031
397
  if (typeof e != "object" || !e) return e;
1032
398
  var r = e[Symbol.toPrimitive];
1033
399
  if (r !== void 0) {
@@ -1037,43 +403,43 @@ function Tr(e, t) {
1037
403
  }
1038
404
  return (t === "string" ? String : Number)(e);
1039
405
  }
1040
- function He(e) {
1041
- return e && e.map((t, r) => /* @__PURE__ */ D.createElement(t.tag, ne({
406
+ function be(e) {
407
+ return e && e.map((t, r) => /* @__PURE__ */ R.createElement(t.tag, U({
1042
408
  key: r
1043
- }, t.attr), He(t.child)));
409
+ }, t.attr), be(t.child)));
1044
410
  }
1045
- function Er(e) {
1046
- return (t) => /* @__PURE__ */ D.createElement(kr, re({
1047
- attr: ne({}, e.attr)
1048
- }, t), He(e.child));
411
+ function Xe(e) {
412
+ return (t) => /* @__PURE__ */ R.createElement(qe, z({
413
+ attr: U({}, e.attr)
414
+ }, t), be(e.child));
1049
415
  }
1050
- function kr(e) {
416
+ function qe(e) {
1051
417
  var t = (r) => {
1052
418
  var {
1053
419
  attr: n,
1054
- size: o,
1055
- title: i
1056
- } = e, c = vr(e, hr), l = o || r.size || "1em", a;
1057
- return r.className && (a = r.className), e.className && (a = (a ? a + " " : "") + e.className), /* @__PURE__ */ D.createElement("svg", re({
420
+ size: s,
421
+ title: a
422
+ } = e, l = Ye(e, Ue), u = s || r.size || "1em", f;
423
+ return r.className && (f = r.className), e.className && (f = (f ? f + " " : "") + e.className), /* @__PURE__ */ R.createElement("svg", z({
1058
424
  stroke: "currentColor",
1059
425
  fill: "currentColor",
1060
426
  strokeWidth: "0"
1061
- }, r.attr, n, c, {
1062
- className: a,
1063
- style: ne(ne({
427
+ }, r.attr, n, l, {
428
+ className: f,
429
+ style: U(U({
1064
430
  color: e.color || r.color
1065
431
  }, r.style), e.style),
1066
- height: l,
1067
- width: l,
432
+ height: u,
433
+ width: u,
1068
434
  xmlns: "http://www.w3.org/2000/svg"
1069
- }), i && /* @__PURE__ */ D.createElement("title", null, i), e.children);
435
+ }), a && /* @__PURE__ */ R.createElement("title", null, a), e.children);
1070
436
  };
1071
- return Ne !== void 0 ? /* @__PURE__ */ D.createElement(Ne.Consumer, null, (r) => t(r)) : t(Ye);
437
+ return ue !== void 0 ? /* @__PURE__ */ R.createElement(ue.Consumer, null, (r) => t(r)) : t(ve);
1072
438
  }
1073
- function ze(e) {
1074
- return Er({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M12 22c5.421 0 10-4.579 10-10h-2c0 4.337-3.663 8-8 8s-8-3.663-8-8c0-4.336 3.663-8 8-8V2C6.579 2 2 6.58 2 12c0 5.421 4.579 10 10 10z" }, child: [] }] })(e);
439
+ function he(e) {
440
+ return Xe({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M12 22c5.421 0 10-4.579 10-10h-2c0 4.337-3.663 8-8 8s-8-3.663-8-8c0-4.336 3.663-8 8-8V2C6.579 2 2 6.58 2 12c0 5.421 4.579 10 10 10z" }, child: [] }] })(e);
1075
441
  }
1076
- const C = (...e) => Ce(ot(e)), _r = at(
442
+ const j = (...e) => pe(Ie(e)), Ke = $e(
1077
443
  "inline-flex items-center justify-center font-medium text-sm ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
1078
444
  {
1079
445
  variants: {
@@ -1108,118 +474,118 @@ const C = (...e) => Ce(ot(e)), _r = at(
1108
474
  rounded: "default"
1109
475
  }
1110
476
  }
1111
- ), Sr = $.forwardRef(
477
+ ), Ze = _.forwardRef(
1112
478
  ({
1113
479
  className: e,
1114
480
  variant: t,
1115
481
  size: r,
1116
482
  rounded: n,
1117
- asChild: o = !1,
1118
- isLoading: i = !1,
1119
- loadingText: c,
1120
- disabled: l,
1121
- ...a
1122
- }, d) => {
1123
- const m = o ? it.Root : "button";
1124
- return /* @__PURE__ */ g.jsx(
1125
- m,
483
+ asChild: s = !1,
484
+ isLoading: a = !1,
485
+ loadingText: l,
486
+ disabled: u,
487
+ ...f
488
+ }, b) => {
489
+ const p = s ? De.Root : "button";
490
+ return /* @__PURE__ */ c.jsx(
491
+ p,
1126
492
  {
1127
- className: C(_r({ variant: t, size: r, rounded: n, className: e })),
1128
- ref: d,
1129
- disabled: l || i,
493
+ className: j(Ke({ variant: t, size: r, rounded: n, className: e })),
494
+ ref: b,
495
+ disabled: u || a,
1130
496
  type: "button",
1131
- ...a,
1132
- children: i ? /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
1133
- /* @__PURE__ */ g.jsx(ze, { className: Ce("h-4 w-4 animate-spin", c ? "mr-2" : "") }),
1134
- c
1135
- ] }) : a.children
497
+ ...f,
498
+ children: a ? /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
499
+ /* @__PURE__ */ c.jsx(he, { className: pe("h-4 w-4 animate-spin", l ? "mr-2" : "") }),
500
+ l
501
+ ] }) : f.children
1136
502
  }
1137
503
  );
1138
504
  }
1139
505
  );
1140
- Sr.displayName = "Button";
1141
- const Or = j.Root, hn = j.Trigger, Nr = j.Portal, vn = j.Close, Ve = $.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1142
- j.Overlay,
506
+ Ze.displayName = "Button";
507
+ const Qe = y.Root, Ft = y.Trigger, et = y.Portal, zt = y.Close, xe = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
508
+ y.Overlay,
1143
509
  {
1144
510
  ref: r,
1145
- className: C(
511
+ className: j(
1146
512
  "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 grid max-h-screen place-items-center overflow-y-auto bg-background/80 py-10 backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in",
1147
513
  e
1148
514
  ),
1149
515
  ...t
1150
516
  }
1151
517
  ));
1152
- Ve.displayName = j.Overlay.displayName;
1153
- const Ge = $.forwardRef(({ className: e, children: t, container: r, hideCloseButton: n, overlayStyles: o, ...i }, c) => /* @__PURE__ */ g.jsx(Nr, { container: r, children: /* @__PURE__ */ g.jsx(Ve, { className: o, children: /* @__PURE__ */ g.jsxs(
1154
- j.Content,
518
+ xe.displayName = y.Overlay.displayName;
519
+ const we = _.forwardRef(({ className: e, children: t, container: r, hideCloseButton: n, overlayStyles: s, ...a }, l) => /* @__PURE__ */ c.jsx(et, { container: r, children: /* @__PURE__ */ c.jsx(xe, { className: s, children: /* @__PURE__ */ c.jsxs(
520
+ y.Content,
1155
521
  {
1156
- ref: c,
1157
- className: C(
522
+ ref: l,
523
+ className: j(
1158
524
  "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-50 grid w-full max-w-lg gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:rounded-lg",
1159
525
  e
1160
526
  ),
1161
- ...i,
527
+ ...a,
1162
528
  children: [
1163
529
  t,
1164
- !n && /* @__PURE__ */ g.jsxs(
1165
- j.Close,
530
+ !n && /* @__PURE__ */ c.jsxs(
531
+ y.Close,
1166
532
  {
1167
533
  type: "button",
1168
534
  className: "absolute top-4 right-4 rounded-sm p-1 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
1169
535
  children: [
1170
- /* @__PURE__ */ g.jsx(ct, { className: "h-4 w-4" }),
1171
- /* @__PURE__ */ g.jsx("span", { className: "sr-only", children: "Close" })
536
+ /* @__PURE__ */ c.jsx(We, { className: "h-4 w-4" }),
537
+ /* @__PURE__ */ c.jsx("span", { className: "sr-only", children: "Close" })
1172
538
  ]
1173
539
  }
1174
540
  )
1175
541
  ]
1176
542
  }
1177
543
  ) }) }));
1178
- Ge.displayName = j.Content.displayName;
1179
- const Xe = ({ className: e, ...t }) => /* @__PURE__ */ g.jsx("div", { className: C("flex flex-col space-y-1.5 text-center sm:text-left", e), ...t });
1180
- Xe.displayName = "DialogHeader";
1181
- const jr = ({ className: e, ...t }) => /* @__PURE__ */ g.jsx(
544
+ we.displayName = y.Content.displayName;
545
+ const ye = ({ className: e, ...t }) => /* @__PURE__ */ c.jsx("div", { className: j("flex flex-col space-y-1.5 text-center sm:text-left", e), ...t });
546
+ ye.displayName = "DialogHeader";
547
+ const tt = ({ className: e, ...t }) => /* @__PURE__ */ c.jsx(
1182
548
  "div",
1183
549
  {
1184
- className: C("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
550
+ className: j("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
1185
551
  ...t
1186
552
  }
1187
553
  );
1188
- jr.displayName = "DialogFooter";
1189
- const Je = $.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1190
- j.Title,
554
+ tt.displayName = "DialogFooter";
555
+ const Ee = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
556
+ y.Title,
1191
557
  {
1192
558
  ref: r,
1193
- className: C("font-semibold text-lg leading-none tracking-tight", e),
559
+ className: j("font-semibold text-lg leading-none tracking-tight", e),
1194
560
  ...t
1195
561
  }
1196
562
  ));
1197
- Je.displayName = j.Title.displayName;
1198
- const qe = $.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1199
- j.Description,
563
+ Ee.displayName = y.Title.displayName;
564
+ const je = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
565
+ y.Description,
1200
566
  {
1201
567
  ref: r,
1202
- className: C("text-muted-foreground text-sm", e),
568
+ className: j("text-muted-foreground text-sm", e),
1203
569
  ...t
1204
570
  }
1205
571
  ));
1206
- qe.displayName = j.Description.displayName;
1207
- const yn = ({
572
+ je.displayName = y.Description.displayName;
573
+ const Ut = ({
1208
574
  isOpen: e,
1209
575
  onClose: t,
1210
576
  children: r,
1211
577
  title: n,
1212
- description: o = "",
1213
- contentClassName: i,
1214
- modal: c = !0
1215
- }) => /* @__PURE__ */ g.jsx(Or, { open: e, onOpenChange: t, modal: c, children: /* @__PURE__ */ g.jsxs(Ge, { className: i, children: [
1216
- n && /* @__PURE__ */ g.jsxs(Xe, { className: "flex-1 font-medium", children: [
1217
- /* @__PURE__ */ g.jsx(Je, { children: n }),
1218
- /* @__PURE__ */ g.jsx(qe, { children: o })
578
+ description: s = "",
579
+ contentClassName: a,
580
+ modal: l = !0
581
+ }) => /* @__PURE__ */ c.jsx(Qe, { open: e, onOpenChange: t, modal: l, children: /* @__PURE__ */ c.jsxs(we, { className: a, children: [
582
+ n && /* @__PURE__ */ c.jsxs(ye, { className: "flex-1 font-medium", children: [
583
+ /* @__PURE__ */ c.jsx(Ee, { children: n }),
584
+ /* @__PURE__ */ c.jsx(je, { children: s })
1219
585
  ] }),
1220
- /* @__PURE__ */ g.jsx("div", { className: "w-full", children: r })
1221
- ] }) }), wn = ({ ...e }) => /* @__PURE__ */ g.jsx(
1222
- lt,
586
+ /* @__PURE__ */ c.jsx("div", { className: "w-full", children: r })
587
+ ] }) }), Yt = ({ ...e }) => /* @__PURE__ */ c.jsx(
588
+ Me,
1223
589
  {
1224
590
  closeButton: !0,
1225
591
  richColors: !0,
@@ -1234,37 +600,37 @@ const yn = ({
1234
600
  },
1235
601
  ...e
1236
602
  }
1237
- ), Rr = (e, t = "Error", r = {}) => {
1238
- ue.error(t, {
603
+ ), rt = (e, t = "Error", r = {}) => {
604
+ q.error(t, {
1239
605
  description: e,
1240
606
  duration: 4e3,
1241
607
  position: "bottom-right",
1242
608
  ...r
1243
609
  });
1244
- }, xn = (e, t = "Success", r = {}) => {
1245
- r?.id && ue.dismiss(r?.id), ue.success(t, {
610
+ }, Vt = (e, t = "Success", r = {}) => {
611
+ r?.id && q.dismiss(r?.id), q.success(t, {
1246
612
  description: e,
1247
613
  duration: 4e3,
1248
614
  position: "bottom-right",
1249
615
  ...r
1250
616
  });
1251
- }, Cr = ({ className: e }) => /* @__PURE__ */ g.jsx(ze, { className: C("h-8 w-8 animate-spin font-light", e) }), Tn = W.Root, Lr = $.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1252
- W.List,
617
+ }, ot = ({ className: e }) => /* @__PURE__ */ c.jsx(he, { className: j("h-8 w-8 animate-spin font-light", e) }), Gt = k.Root, nt = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
618
+ k.List,
1253
619
  {
1254
620
  ref: r,
1255
- className: C(
621
+ className: j(
1256
622
  "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
1257
623
  e
1258
624
  ),
1259
625
  ...t
1260
626
  }
1261
627
  ));
1262
- Lr.displayName = W.List.displayName;
1263
- const Pr = $.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1264
- W.Trigger,
628
+ nt.displayName = k.List.displayName;
629
+ const st = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
630
+ k.Trigger,
1265
631
  {
1266
632
  ref: r,
1267
- className: C(
633
+ className: j(
1268
634
  "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
1269
635
  e
1270
636
  ),
@@ -1272,36 +638,36 @@ const Pr = $.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1272
638
  ...t
1273
639
  }
1274
640
  ));
1275
- Pr.displayName = W.Trigger.displayName;
1276
- const Ar = $.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1277
- W.Content,
641
+ st.displayName = k.Trigger.displayName;
642
+ const at = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
643
+ k.Content,
1278
644
  {
1279
645
  ref: r,
1280
- className: C(
646
+ className: j(
1281
647
  "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1282
648
  e
1283
649
  ),
1284
650
  ...t
1285
651
  }
1286
652
  ));
1287
- Ar.displayName = W.Content.displayName;
1288
- const En = z.Provider, Ir = z.Root, Dr = z.Trigger, $r = z.Portal, Ke = $.forwardRef(({ className: e, sideOffset: t = 4, ...r }, n) => /* @__PURE__ */ g.jsx(
1289
- z.Content,
653
+ at.displayName = k.Content.displayName;
654
+ const Ht = A.Provider, it = A.Root, ct = A.Trigger, lt = A.Portal, Oe = _.forwardRef(({ className: e, sideOffset: t = 4, ...r }, n) => /* @__PURE__ */ c.jsx(
655
+ A.Content,
1290
656
  {
1291
657
  ref: n,
1292
658
  sideOffset: t,
1293
- className: C(
659
+ className: j(
1294
660
  "fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 animate-in overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-popover-foreground text-xs shadow-md data-[state=closed]:animate-out",
1295
661
  e
1296
662
  ),
1297
663
  ...r
1298
664
  }
1299
665
  ));
1300
- Ke.displayName = z.Content.displayName;
1301
- const kn = ({ children: e, label: t, labelClassName: r, asChild: n = !0, contentProps: o = {}, side: i }) => /* @__PURE__ */ g.jsxs(Ir, { children: [
1302
- t && /* @__PURE__ */ g.jsx($r, { children: /* @__PURE__ */ g.jsx(Ke, { side: i, className: r, ...o, children: t }) }),
1303
- /* @__PURE__ */ g.jsx(Dr, { asChild: n, children: e })
1304
- ] }), Mr = [
666
+ Oe.displayName = A.Content.displayName;
667
+ const Jt = ({ children: e, label: t, labelClassName: r, asChild: n = !0, contentProps: s = {}, side: a }) => /* @__PURE__ */ c.jsxs(it, { children: [
668
+ t && /* @__PURE__ */ c.jsx(lt, { children: /* @__PURE__ */ c.jsx(Oe, { side: a, className: r, ...s, children: t }) }),
669
+ /* @__PURE__ */ c.jsx(ct, { asChild: n, children: e })
670
+ ] }), ut = [
1305
671
  "pdf",
1306
672
  "txt",
1307
673
  "xml",
@@ -1315,7 +681,7 @@ const kn = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1315
681
  "odp",
1316
682
  "ppt",
1317
683
  "pptx"
1318
- ], Wr = ["svg", "png", "jpg", "jpeg", "gif", "webp", "avif"], Fr = ["mp4", "ogv", "webm"], Br = ["mp3", "ogg", "opus"], Ur = {
684
+ ], dt = ["svg", "png", "jpg", "jpeg", "gif", "webp", "avif"], ft = ["mp4", "ogv", "webm"], mt = ["mp3", "ogg", "opus"], pt = {
1319
685
  "application/xml": [".xml"],
1320
686
  "text/plain": [".txt"],
1321
687
  "application/pdf": [".pdf"],
@@ -1324,7 +690,7 @@ const kn = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1324
690
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
1325
691
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
1326
692
  "text/csv": [".csv"]
1327
- }, Yr = {
693
+ }, gt = {
1328
694
  "image/jpeg": [".jpeg", ".jpg"],
1329
695
  "image/jpg": [".jpg"],
1330
696
  "image/png": [".png"],
@@ -1333,35 +699,35 @@ const kn = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1333
699
  "image/svg+xml": [".svg"],
1334
700
  "image/webp": [".webp"],
1335
701
  "image/avif": [".avif"]
1336
- }, Hr = {
702
+ }, vt = {
1337
703
  "video/mp4": [".mp4"],
1338
704
  "video/mpeg": [".mpeg"],
1339
705
  "video/webm": [".webm"]
1340
- }, zr = {
706
+ }, bt = {
1341
707
  "audio/mpeg": [".mp3"],
1342
708
  "audio/ogg": [".oga"],
1343
709
  "audio/opus": [".opus"]
1344
- }, K = {
1345
- audio: zr,
1346
- document: Ur,
1347
- image: Yr,
1348
- video: Hr
1349
- }, Z = {
1350
- audio: Br,
1351
- document: Mr,
1352
- image: Wr,
1353
- video: Fr
1354
- }, _n = [
1355
- ...Z.audio,
1356
- ...Z.document,
1357
- ...Z.image,
1358
- ...Z.video
1359
- ], Sn = {
1360
- ...K.audio,
1361
- ...K.document,
1362
- ...K.image,
1363
- ...K.video
1364
- }, Ze = D.createContext({
710
+ }, B = {
711
+ audio: bt,
712
+ document: pt,
713
+ image: gt,
714
+ video: vt
715
+ }, F = {
716
+ audio: mt,
717
+ document: ut,
718
+ image: dt,
719
+ video: ft
720
+ }, Xt = [
721
+ ...F.audio,
722
+ ...F.document,
723
+ ...F.image,
724
+ ...F.video
725
+ ], qt = {
726
+ ...B.audio,
727
+ ...B.document,
728
+ ...B.image,
729
+ ...B.video
730
+ }, Te = R.createContext({
1365
731
  urls: null,
1366
732
  title: "",
1367
733
  isLoading: !1,
@@ -1369,62 +735,62 @@ const kn = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1369
735
  },
1370
736
  onError: () => {
1371
737
  }
1372
- }), Vr = ({ title: e, onSuccess: t, onError: r, children: n }) => {
1373
- const { client: o } = P(), i = typeof window < "u" ? window.location.href : "", [c, l] = N(null), [a, d] = N(!1);
1374
- k(() => {
1375
- o.membership && (d(!0), o.membership?.getOAuthURL().then((u) => {
1376
- l(u);
1377
- }).catch((u) => {
738
+ }), ht = ({ title: e, onSuccess: t, onError: r, children: n }) => {
739
+ const s = Q(), a = typeof window < "u" ? window.location.href : "", [l, u] = P(null), [f, b] = P(!1);
740
+ O(() => {
741
+ s.membership && (b(!0), s.membership?.getOAuthURL().then((d) => {
742
+ u(d);
743
+ }).catch((d) => {
1378
744
  r({
1379
- code: u?.code || "SOMETHING_WENT_WRONG",
1380
- message: u?.message || "We could not connect with our service for your sign-in."
745
+ code: d?.code || "SOMETHING_WENT_WRONG",
746
+ message: d?.message || "We could not connect with our service for your sign-in."
1381
747
  });
1382
748
  }).finally(() => {
1383
- d(!1);
749
+ b(!1);
1384
750
  }));
1385
- }, [o]);
1386
- const m = fe(
1387
- () => ({ title: e, urls: c, isLoading: a, onSuccess: t, onError: r }),
1388
- [e, c, t, r, a]
751
+ }, []);
752
+ const p = fe(
753
+ () => ({ title: e, urls: l, isLoading: f, onSuccess: t, onError: r }),
754
+ [e, l, t, r, f]
1389
755
  );
1390
- return k(() => {
1391
- if (c && i) {
1392
- const u = {}, p = Object.keys(c);
1393
- for (const b of p)
756
+ return O(() => {
757
+ if (l && a) {
758
+ const d = {}, T = Object.keys(l);
759
+ for (const w of T)
1394
760
  try {
1395
- const h = c[b];
1396
- if (h) {
1397
- const O = new URL(h), x = O.searchParams;
1398
- x.set("redirect_uri", i);
1399
- const R = o.pageContext;
1400
- R && x.set("page_context", JSON.stringify(R)), u[b] = O.toString();
761
+ const E = l[w];
762
+ if (E) {
763
+ const C = new URL(E), N = C.searchParams;
764
+ N.set("redirect_uri", a);
765
+ const L = s.pageContext;
766
+ L && N.set("page_context", JSON.stringify(L)), d[w] = C.toString();
1401
767
  }
1402
768
  } catch {
1403
769
  }
1404
- l(u);
770
+ u(d);
1405
771
  }
1406
- }, [i]), /* @__PURE__ */ g.jsx(Ze.Provider, { value: m, children: n });
1407
- }, Gr = () => Re(Ze), Xr = ({ url: e, title: t, height: r, width: n }) => {
1408
- const o = window.screenX + (window.outerWidth - n) / 2, i = window.screenY + (window.outerHeight - r) / 2.5;
772
+ }, [a]), /* @__PURE__ */ c.jsx(Te.Provider, { value: p, children: n });
773
+ }, xt = () => K(Te), wt = ({ url: e, title: t, height: r, width: n }) => {
774
+ const s = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - r) / 2.5;
1409
775
  return window.open(
1410
776
  e,
1411
777
  t,
1412
- `width=${n},height=${r},left=${o},top=${i}`
778
+ `width=${n},height=${r},left=${s},top=${a}`
1413
779
  );
1414
- }, Jr = ({
780
+ }, yt = ({
1415
781
  title: e = "",
1416
782
  width: t = 500,
1417
783
  height: r = 500,
1418
784
  url: n,
1419
- children: o,
1420
- onCode: i,
1421
- onClose: c
785
+ children: s,
786
+ onCode: a,
787
+ onClose: l
1422
788
  }) => {
1423
- const [l, a] = N(), d = H(void 0), m = () => {
1424
- window.clearInterval(d.current);
1425
- }, u = () => {
1426
- a(
1427
- Xr({
789
+ const [u, f] = P(), b = me(void 0), p = () => {
790
+ window.clearInterval(b.current);
791
+ }, d = () => {
792
+ f(
793
+ wt({
1428
794
  url: n,
1429
795
  title: e,
1430
796
  width: t,
@@ -1432,107 +798,107 @@ const kn = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1432
798
  })
1433
799
  );
1434
800
  };
1435
- return k(() => (l && (d.current = window.setInterval(() => {
801
+ return O(() => (u && (b.current = window.setInterval(() => {
1436
802
  try {
1437
- const p = l.location.href, b = new URL(p).searchParams, h = b.get("code");
1438
- if (!h)
803
+ const T = u.location.href, w = new URL(T).searchParams, E = w.get("code");
804
+ if (!E)
1439
805
  return;
1440
- i(h, b), m(), l.close();
806
+ a(E, w), p(), u.close();
1441
807
  } catch {
1442
808
  } finally {
1443
- (!l || l.closed) && (c(), m());
809
+ (!u || u.closed) && (l(), p());
1444
810
  }
1445
811
  }, 700)), () => {
1446
- l && l.close(), c && c();
1447
- }), [l]), /* @__PURE__ */ g.jsx(
812
+ u && u.close(), l && l();
813
+ }), [u]), /* @__PURE__ */ c.jsx(
1448
814
  "div",
1449
815
  {
1450
816
  onClick: () => {
1451
- u();
817
+ d();
1452
818
  },
1453
- children: o
819
+ children: s
1454
820
  }
1455
821
  );
1456
- }, qr = ({
822
+ }, Et = ({
1457
823
  title: e = "Levo",
1458
824
  url: t,
1459
825
  children: r,
1460
826
  onSuccess: n,
1461
- onError: o,
1462
- width: i = 500,
1463
- height: c = 700
827
+ onError: s,
828
+ width: a = 500,
829
+ height: l = 700
1464
830
  }) => {
1465
- const l = Q((a, d) => {
1466
- a.toLowerCase() === "success" ? n(d) : o(d);
831
+ const u = X((f, b) => {
832
+ f.toLowerCase() === "success" ? n(b) : s(b);
1467
833
  }, []);
1468
- return /* @__PURE__ */ g.jsx(
1469
- Jr,
834
+ return /* @__PURE__ */ c.jsx(
835
+ yt,
1470
836
  {
1471
837
  title: e,
1472
- width: i,
1473
- height: c,
838
+ width: a,
839
+ height: l,
1474
840
  onClose: () => {
1475
841
  },
1476
842
  url: t,
1477
- onCode: l,
843
+ onCode: u,
1478
844
  children: r
1479
845
  }
1480
846
  );
1481
- }, Kr = ({ children: e, provider: t }) => {
1482
- const { title: r, urls: n, isLoading: o, onSuccess: i, onError: c } = Gr(), l = n?.[t];
1483
- return l ? /* @__PURE__ */ g.jsx(qr, { title: r, provider: t, url: l, onSuccess: i, onError: c, children: o ? /* @__PURE__ */ g.jsx("div", { className: "w-full items-center justify-center", children: /* @__PURE__ */ g.jsx(Cr, { className: "h-5 w-5 bg-brand" }) }) : e }) : null;
1484
- }, Zr = ({ url: e, title: t, height: r, width: n }) => {
1485
- const o = window.screenX + (window.outerWidth - n) / 2, i = window.screenY + (window.outerHeight - r) / 2.5;
847
+ }, jt = ({ children: e, provider: t }) => {
848
+ const { title: r, urls: n, isLoading: s, onSuccess: a, onError: l } = xt(), u = n?.[t];
849
+ return u ? /* @__PURE__ */ c.jsx(Et, { title: r, provider: t, url: u, onSuccess: a, onError: l, children: s ? /* @__PURE__ */ c.jsx("div", { className: "w-full items-center justify-center", children: /* @__PURE__ */ c.jsx(ot, { className: "h-5 w-5 bg-brand" }) }) : e }) : null;
850
+ }, Ot = ({ url: e, title: t, height: r, width: n }) => {
851
+ const s = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - r) / 2.5;
1486
852
  return window.open(
1487
853
  e,
1488
854
  t,
1489
- `width=${n},height=${r},left=${o},top=${i}`
855
+ `width=${n},height=${r},left=${s},top=${a}`
1490
856
  );
1491
- }, On = ({
857
+ }, Kt = ({
1492
858
  title: e = "Levo",
1493
859
  width: t = 500,
1494
860
  height: r = 700,
1495
861
  onSuccess: n
1496
862
  }) => {
1497
- const { client: o } = P(), [i, c] = N(!1), [l, a] = N(null), [d, m] = N(null), [u, p] = N(), b = H(void 0), h = () => {
1498
- window.clearInterval(b.current);
1499
- }, O = Q((w, _) => {
1500
- w.toLowerCase() === "success" ? (m(null), n(_)) : m(_);
863
+ const s = Q(), [a, l] = P(!1), [u, f] = P(null), [b, p] = P(null), [d, T] = P(), w = me(void 0), E = () => {
864
+ window.clearInterval(w.current);
865
+ }, C = X((h, x) => {
866
+ h.toLowerCase() === "success" ? (p(null), n(x)) : p(x);
1501
867
  }, []);
1502
- k(() => {
1503
- o.membership && (c(!0), o.membership?.getOAuthURL().then((w) => {
1504
- if (w)
1505
- return a(w), w;
868
+ O(() => {
869
+ s.membership && (l(!0), s.membership?.getOAuthURL().then((h) => {
870
+ if (h)
871
+ return f(h), h;
1506
872
  throw new Error();
1507
- }).catch((w) => {
1508
- const _ = U(w);
1509
- o.logger?.error("Failed to get OAuth URL", _.message), m({
1510
- code: _?.code || "SOMETHING_WENT_WRONG",
1511
- message: _?.message || "We could not connect with our service for your sign-in."
873
+ }).catch((h) => {
874
+ const x = ge(h);
875
+ s.logger?.error("Failed to get OAuth URL", x.message), p({
876
+ code: x?.code || "SOMETHING_WENT_WRONG",
877
+ message: x?.message || "We could not connect with our service for your sign-in."
1512
878
  });
1513
879
  }).finally(() => {
1514
- c(!1);
880
+ l(!1);
1515
881
  }));
1516
- }, []), k(() => (u && (b.current = window.setInterval(() => {
882
+ }, []), O(() => (d && (w.current = window.setInterval(() => {
1517
883
  try {
1518
- const w = u.location.href, _ = new URL(w).searchParams, A = _.get("code");
1519
- if (!A)
884
+ const h = d.location.href, x = new URL(h).searchParams, $ = x.get("code");
885
+ if (!$)
1520
886
  return;
1521
- O(A, _), h(), u.close();
887
+ C($, x), E(), d.close();
1522
888
  } catch {
1523
889
  } finally {
1524
- (!u || u.closed) && (h(), m(null));
890
+ (!d || d.closed) && (E(), p(null));
1525
891
  }
1526
892
  }, 700)), () => {
1527
- u && u.close();
1528
- }), [u]);
1529
- const x = Q(
1530
- (w) => {
1531
- if (w && l !== null) {
1532
- const _ = l?.[w];
1533
- _ && (u && u.close(), p(
1534
- Zr({
1535
- url: _,
893
+ d && d.close();
894
+ }), [d]);
895
+ const N = X(
896
+ (h) => {
897
+ if (h && u !== null) {
898
+ const x = u?.[h];
899
+ x && (d && d.close(), T(
900
+ Ot({
901
+ url: x,
1536
902
  title: e,
1537
903
  width: t,
1538
904
  height: r
@@ -1540,85 +906,86 @@ const kn = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1540
906
  ));
1541
907
  }
1542
908
  },
1543
- [l, u]
909
+ [u, d]
1544
910
  );
1545
911
  return {
1546
- providers: fe(() => l !== null ? Object.keys(l).filter(
1547
- (w) => !!l[w]
1548
- ) : [], [l]),
1549
- isLoading: i,
1550
- error: d,
1551
- launchPopup: x
912
+ providers: fe(() => u !== null ? Object.keys(u).filter(
913
+ (h) => !!u[h]
914
+ ) : [], [u]),
915
+ isLoading: a,
916
+ error: b,
917
+ launchPopup: N
1552
918
  };
1553
919
  };
1554
- class Nn {
1555
- static Container = Vr;
1556
- static Button = Kr;
920
+ class Zt {
921
+ static Container = ht;
922
+ static Button = jt;
1557
923
  }
1558
- const jn = (e, t = 2) => {
924
+ const Qt = (e, t = 2) => {
1559
925
  if (e === 0) return "0 B";
1560
- const r = 1024, n = t < 0 ? 0 : t, o = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], i = Math.floor(Math.log(e) / Math.log(r));
1561
- return `${Number.parseFloat((e / r ** i).toFixed(n))} ${o[i]}`;
1562
- }, Rn = (e) => {
1563
- const t = U(e);
1564
- return t?.code === "REQUEST_TIMEOUT" || t?.code === "NETWORK_ERROR" || t?.status === 408 || t?.status === 0 || Rr(t?.message || "", t?.title || "Error", {
926
+ const r = 1024, n = t < 0 ? 0 : t, s = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], a = Math.floor(Math.log(e) / Math.log(r));
927
+ return `${Number.parseFloat((e / r ** a).toFixed(n))} ${s[a]}`;
928
+ }, er = (e) => {
929
+ const t = ge(e);
930
+ return t?.code === "REQUEST_TIMEOUT" || t?.code === "NETWORK_ERROR" || t?.status === 408 || t?.status === 0 || rt(t?.message || "", t?.title || "Error", {
1565
931
  id: `${t?.title || ""}-${t?.message || ""}`
1566
932
  }), t;
1567
- }, Qr = (e) => e instanceof Date, en = (e) => e == null, tn = (e) => typeof e == "object", rn = (e) => !en(e) && !Array.isArray(e) && tn(e) && !Qr(e), Cn = (e) => rn(e) && !Object.keys(e).length;
933
+ }, Tt = (e) => e instanceof Date, Rt = (e) => e == null, _t = (e) => typeof e == "object", Nt = (e) => !Rt(e) && !Array.isArray(e) && _t(e) && !Tt(e), tr = (e) => Nt(e) && !Object.keys(e).length;
1568
934
  export {
1569
- Sr as Button,
1570
- Or as Dialog,
1571
- vn as DialogClose,
1572
- Ge as DialogContent,
1573
- qe as DialogDescription,
1574
- jr as DialogFooter,
1575
- Xe as DialogHeader,
1576
- Ve as DialogOverlay,
1577
- Nr as DialogPortal,
1578
- Je as DialogTitle,
1579
- hn as DialogTrigger,
1580
- yn as DialogWrapper,
1581
- mn as LevoInsightsBlock,
1582
- pn as LevoInsightsComponent,
1583
- bn as LevoInsightsPage,
1584
- Nn as LevoOAuth,
1585
- gn as LevoProvider,
1586
- kn as SimpleTooltipWrapper,
1587
- Cr as Spinner,
1588
- Tn as Tabs,
1589
- Ar as TabsContent,
1590
- Lr as TabsList,
1591
- Pr as TabsTrigger,
1592
- wn as Toaster,
1593
- Ir as Tooltip,
1594
- Ke as TooltipContent,
1595
- $r as TooltipPortal,
1596
- En as TooltipProvider,
1597
- Dr as TooltipTrigger,
1598
- _n as allMediaFileExtensions,
1599
- Sn as allMediaMimetypes,
1600
- Br as audioFileExtensions,
1601
- zr as audioMimetype,
1602
- _r as buttonVariants,
1603
- jn as byteToSize,
1604
- C as cn,
1605
- Mr as documentFileExtensions,
1606
- Ur as documentMimetype,
1607
- Rn as errorHandler,
1608
- Rr as errorToast,
1609
- Wr as imageFileExtensions,
1610
- Yr as imageMimetype,
1611
- Qr as isDateObject,
1612
- Cn as isEmptyObject,
1613
- en as isNullOrUndefined,
1614
- rn as isObject,
1615
- tn as isObjectType,
1616
- Z as mediaExtensionsByKind,
1617
- K as mediaMimetypeByKind,
1618
- xn as successToast,
1619
- An as toast,
1620
- P as useLevo,
1621
- On as useLevoOAuth,
1622
- Fr as videoFileExtensions,
1623
- Hr as videoMimetype
935
+ Ze as Button,
936
+ Qe as Dialog,
937
+ zt as DialogClose,
938
+ we as DialogContent,
939
+ je as DialogDescription,
940
+ tt as DialogFooter,
941
+ ye as DialogHeader,
942
+ xe as DialogOverlay,
943
+ et as DialogPortal,
944
+ Ee as DialogTitle,
945
+ Ft as DialogTrigger,
946
+ Ut as DialogWrapper,
947
+ Wt as LevoInsightsBlock,
948
+ Mt as LevoInsightsComponent,
949
+ Bt as LevoInsightsPage,
950
+ Zt as LevoOAuth,
951
+ $t as LevoProvider,
952
+ Jt as SimpleTooltipWrapper,
953
+ ot as Spinner,
954
+ Gt as Tabs,
955
+ at as TabsContent,
956
+ nt as TabsList,
957
+ st as TabsTrigger,
958
+ Yt as Toaster,
959
+ it as Tooltip,
960
+ Oe as TooltipContent,
961
+ lt as TooltipPortal,
962
+ Ht as TooltipProvider,
963
+ ct as TooltipTrigger,
964
+ Xt as allMediaFileExtensions,
965
+ qt as allMediaMimetypes,
966
+ mt as audioFileExtensions,
967
+ bt as audioMimetype,
968
+ Ke as buttonVariants,
969
+ Qt as byteToSize,
970
+ j as cn,
971
+ ut as documentFileExtensions,
972
+ pt as documentMimetype,
973
+ er as errorHandler,
974
+ rt as errorToast,
975
+ dt as imageFileExtensions,
976
+ gt as imageMimetype,
977
+ Tt as isDateObject,
978
+ tr as isEmptyObject,
979
+ Rt as isNullOrUndefined,
980
+ Nt as isObject,
981
+ _t as isObjectType,
982
+ F as mediaExtensionsByKind,
983
+ B as mediaMimetypeByKind,
984
+ Vt as successToast,
985
+ nr as toast,
986
+ Q as useLevo,
987
+ ee as useLevoInsights,
988
+ Kt as useLevoOAuth,
989
+ ft as videoFileExtensions,
990
+ vt as videoMimetype
1624
991
  };