@levo-so/site-runtime 0.3.19 → 0.3.20

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.
Files changed (28) hide show
  1. package/CollectionField-DCAXOmBN.js +270 -0
  2. package/DateTimeWidget-I0LvR-tO.js +255 -0
  3. package/{Dialog-dT7y641z.js → Dialog-D-vRkU9N.js} +1 -1
  4. package/{KBChatWidget-GRi6sLpp.js → KBChatWidget-BMuZ-VI3.js} +222 -222
  5. package/{LevoProvider-Bsjkcwc8.js → LevoProvider-BkbKrvrI.js} +8 -8
  6. package/PhoneWidget-DPECohGT.js +99 -0
  7. package/{Popover-C29yJ7rz.js → Popover-Cr0-X_ch.js} +1 -1
  8. package/{PopupBody-BI-MJqmd-DgTQEzda.js → PopupBody-BI-MJqmd-a-l3CaKZ.js} +23 -23
  9. package/{PopupRenderer-D66Gx63H-Cd9xJv33.js → PopupRenderer-D66Gx63H-DpcNpbtU.js} +47 -47
  10. package/{RichTextWidget-DfakML79.js → RichTextWidget-C1QECDcg.js} +127 -127
  11. package/{RteThemeProvider-BQmfSXSl.js → RteThemeProvider-CMbSaFRQ.js} +1 -1
  12. package/{ThemeProvider-DutrjSTF.js → ThemeProvider-DlFehjh1.js} +30 -30
  13. package/{Tooltip-CQB0LyxK.js → Tooltip-BKQ5rIDh.js} +1 -1
  14. package/{VerifyButton-BUT70lgz.js → VerifyButton-D0cj9Z5Q.js} +38 -38
  15. package/blog-content.js +67 -67
  16. package/{dist-CEdznbFW.js → dist-IxiGbP-3.js} +1254 -1139
  17. package/{dist-6AIgW_iB.js → dist-_lwl0kZw.js} +10 -10
  18. package/index.d.ts +21 -11
  19. package/index.js +1698 -1385
  20. package/{kbChat-a2dXSeRc.js → kbChat-DtZ4vuCZ.js} +26 -26
  21. package/package.json +3 -3
  22. package/popups.js +1 -1
  23. package/script.esm-wR2d7rrv.js +62 -0
  24. package/{usePopupRedirect-CAAdcpaW-Ddjyf4KK.js → usePopupRedirect-CAAdcpaW-BDa44PXN.js} +14 -14
  25. package/CollectionField-C-6a1ud4.js +0 -270
  26. package/DateTimeWidget-U3lD0q1q.js +0 -255
  27. package/PhoneWidget-DQQa4bL6.js +0 -99
  28. /package/{es-ByBbirnH.js → es-CGQflL9T.js} +0 -0
package/index.js CHANGED
@@ -1,39 +1,39 @@
1
1
  "use client";
2
- import { i as e, n as t } from "./dist-CEdznbFW.js";
3
- import { i as n, n as r, r as i } from "./LevoProvider-Bsjkcwc8.js";
2
+ import { i as e, n as t } from "./dist-IxiGbP-3.js";
3
+ import { i as n, n as r, r as i } from "./LevoProvider-BkbKrvrI.js";
4
4
  import { t as a } from "./inlineCollectionTheme-CWcMCUti.js";
5
5
  import { t as o } from "./inlineBaseTheme-BB9e6h5f.js";
6
6
  import { a as s, c, d as l, f as u, i as d, l as f, n as p, o as m, r as h, s as g, t as _, u as v } from "./routes-CyKmkoRM.js";
7
7
  import { createLevoClient as y, getLevoError as b } from "@levo-so/core";
8
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
9
- import * as w from "react";
10
- import { Suspense as T, createContext as E, lazy as D, useCallback as O, useContext as k, useEffect as A, useLayoutEffect as j, useMemo as M, useRef as N, useState as P, useSyncExternalStore as F } from "react";
11
- import { Dialog as I } from "@base-ui/react/dialog";
12
- import { keepPreviousData as L, useMutation as R, useQuery as z, useQueryClient as B } from "@tanstack/react-query";
13
- import { ScriptOnce as V, redirect as ee, useRouterState as H } from "@tanstack/react-router";
14
- import { createLevoInsights as te } from "@levo-so/insights";
15
- import { CheckIcon as ne, ChevronLeftIcon as U, ChevronRightIcon as re, LoaderCircle as ie, Tag as ae, X as oe, XIcon as se } from "lucide-react";
16
- import { useRazorpay as ce } from "react-razorpay";
17
- import { EmbeddedCheckout as le, EmbeddedCheckoutProvider as W } from "@stripe/react-stripe-js";
8
+ import { Suspense as x, createContext as S, lazy as C, useCallback as w, useContext as T, useEffect as E, useLayoutEffect as D, useMemo as O, useRef as k, useState as A, useSyncExternalStore as j } from "react";
9
+ import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
10
+ import { Dialog as F } from "@base-ui/react/dialog";
11
+ import { keepPreviousData as I, useMutation as L, useQuery as R, useQueryClient as z } from "@tanstack/react-query";
12
+ import { ScriptOnce as ee, redirect as te, useRouterState as B } from "@tanstack/react-router";
13
+ import { createLevoInsights as ne } from "@levo-so/insights";
14
+ import { CalendarPlusIcon as re, CheckIcon as ie, ChevronDownIcon as ae, DownloadIcon as oe, LoaderCircleIcon as se, XIcon as ce } from "lucide-react";
15
+ import { Popover as V } from "@base-ui/react/popover";
16
+ import { useRazorpay as le } from "react-razorpay";
17
+ import { EmbeddedCheckout as ue, EmbeddedCheckoutProvider as de } from "@stripe/react-stripe-js";
18
18
  //#region src/access/types.ts
19
- var ue = [
19
+ var H = [
20
20
  "otp",
21
21
  "magiclink",
22
22
  "whatsapp"
23
- ], G = [
23
+ ], fe = [
24
24
  "google",
25
25
  "microsoft",
26
26
  "linkedin"
27
- ], de = [...ue, ...G], fe = "otp", K = (e) => typeof e == "object" && !!e && !Array.isArray(e), pe = (e) => ue.includes(e), me = (e) => G.includes(e), he = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], ge = (e) => e, _e = (e) => {
28
- if (!K(e)) return null;
29
- let t = e.enabled === void 0 ? !0 : e.enabled === !0, n = K(e.options) ? e.options : {};
27
+ ], pe = [...H, ...fe], me = "otp", U = (e) => typeof e == "object" && !!e && !Array.isArray(e), he = (e) => H.includes(e), ge = (e) => fe.includes(e), _e = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], ve = (e) => e, ye = (e) => {
28
+ if (!U(e)) return null;
29
+ let t = e.enabled === void 0 ? !0 : e.enabled === !0, n = U(e.options) ? e.options : {};
30
30
  switch (e.kind) {
31
31
  case "authentication": return {
32
32
  kind: "authentication",
33
33
  enabled: t,
34
34
  options: {
35
- methods: he(n.methods).filter((e) => pe(e) || me(e)),
36
- ...pe(n.primary_method) ? { primary_method: n.primary_method } : {}
35
+ methods: _e(n.methods).filter((e) => he(e) || ge(e)),
36
+ ...he(n.primary_method) ? { primary_method: n.primary_method } : {}
37
37
  }
38
38
  };
39
39
  case "gating": return typeof n.collection != "string" || !n.collection.trim() ? null : {
@@ -41,71 +41,71 @@ var ue = [
41
41
  enabled: t,
42
42
  options: {
43
43
  collection: n.collection.trim(),
44
- ...K(n.condition) ? { condition: ge(n.condition) } : {},
45
- hidden: he(n.hidden)
44
+ ...U(n.condition) ? { condition: ve(n.condition) } : {},
45
+ hidden: _e(n.hidden)
46
46
  }
47
47
  };
48
48
  case "profile": return {
49
49
  kind: "profile",
50
50
  enabled: t,
51
51
  options: {
52
- ...K(n.condition) ? { condition: ge(n.condition) } : {},
53
- hidden: he(n.hidden)
52
+ ...U(n.condition) ? { condition: ve(n.condition) } : {},
53
+ hidden: _e(n.hidden)
54
54
  }
55
55
  };
56
56
  default: return null;
57
57
  }
58
- }, ve = (e) => {
58
+ }, be = (e) => {
59
59
  if (!Array.isArray(e) || e.length === 0) return {
60
60
  rules: [],
61
61
  invalid: !1
62
62
  };
63
- let t = e.map(_e).filter((e) => e !== null);
63
+ let t = e.map(ye).filter((e) => e !== null);
64
64
  return {
65
65
  rules: t.filter((e) => e.enabled !== !1),
66
66
  invalid: t.length === 0
67
67
  };
68
- }, ye = (e) => {
68
+ }, xe = (e) => {
69
69
  let t = e.find((e) => e.kind === "authentication"), n = t?.kind === "authentication" ? t.options?.methods ?? [] : [];
70
70
  return {
71
- primary: (t?.kind === "authentication" ? t.options?.primary_method : void 0) ?? n.find(pe) ?? fe,
72
- oauth: n.filter(me)
71
+ primary: (t?.kind === "authentication" ? t.options?.primary_method : void 0) ?? n.find(he) ?? me,
72
+ oauth: n.filter(ge)
73
73
  };
74
- }, be = (e = null) => ({
74
+ }, Se = (e = null) => ({
75
75
  state: "granted",
76
76
  code: e,
77
77
  message: null,
78
78
  rule: null
79
- }), xe = () => ({
79
+ }), Ce = () => ({
80
80
  state: "checking",
81
81
  code: null,
82
82
  message: null,
83
83
  rule: null
84
- }), q = (e, t, n = null) => ({
84
+ }), W = (e, t, n = null) => ({
85
85
  state: "blocked",
86
86
  code: e,
87
87
  message: t,
88
88
  rule: n
89
- }), Se = (e, t) => {
89
+ }), we = (e, t) => {
90
90
  let n = t?.split(".")[0];
91
91
  return e.find((e) => e.kind === n) ?? null;
92
- }, Ce = (e, t) => {
92
+ }, Te = (e, t) => {
93
93
  let n = (e) => t.find((t) => t.kind === e);
94
- if (e === "granted") return be();
95
- if (e === "signed_out") return q("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", n("authentication") ?? t[0] ?? null);
94
+ if (e === "granted") return Se();
95
+ if (e === "signed_out") return W("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", n("authentication") ?? t[0] ?? null);
96
96
  let r = n("gating");
97
- if (e === "entry_missing" && r) return q("gating.ENTRY_NOT_FOUND", null, r);
98
- if (e === "entry_under_review" && r) return q("gating.ENTRY_CONDITION_NOT_FULFILLED", "Your submission is being reviewed.", r);
97
+ if (e === "entry_missing" && r) return W("gating.ENTRY_NOT_FOUND", null, r);
98
+ if (e === "entry_under_review" && r) return W("gating.ENTRY_CONDITION_NOT_FULFILLED", "Your submission is being reviewed.", r);
99
99
  let i = n("profile");
100
- return e === "profile_incomplete" && i ? q("profile.CONDITION_NOT_FULFILLED", null, i) : null;
101
- }, we = ({ rules: e, invalid: t, pageId: n, hasClient: r, isReady: i, isLoggedIn: a, check: o, preview: s }) => {
102
- if (e.length === 0 && !t) return be();
100
+ return e === "profile_incomplete" && i ? W("profile.CONDITION_NOT_FULFILLED", null, i) : null;
101
+ }, Ee = ({ rules: e, invalid: t, pageId: n, hasClient: r, isReady: i, isLoggedIn: a, check: o, preview: s }) => {
102
+ if (e.length === 0 && !t) return Se();
103
103
  if (s) {
104
- let t = Ce(s, e);
104
+ let t = Te(s, e);
105
105
  if (t) return t;
106
106
  }
107
- return t ? q("access.CONFIG_INVALID", "This page's access rules could not be read.") : i ? r ? a ? n ? o.isError ? q("access.CHECK_FAILED", "We could not verify your access.") : o.isSuccess ? o.data ? o.data.has_access ? be(o.data.code ?? null) : q(o.data.code ?? "access.CHECK_FAILED", o.data.message ?? null, Se(e, o.data.code)) : q("access.CHECK_FAILED", "We could not verify your access.") : xe() : q("access.PAGE_NOT_IDENTIFIED", "This page is not linked to its access rules yet.") : q("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", e.find((e) => e.kind === "authentication") ?? e[0] ?? null) : q("access.UNWIRED", "This site is not connected to an account system.") : xe();
108
- }, Te = (e) => {
107
+ return t ? W("access.CONFIG_INVALID", "This page's access rules could not be read.") : i ? r ? a ? n ? o.isError ? W("access.CHECK_FAILED", "We could not verify your access.") : o.isSuccess ? o.data ? o.data.has_access ? Se(o.data.code ?? null) : W(o.data.code ?? "access.CHECK_FAILED", o.data.message ?? null, we(e, o.data.code)) : W("access.CHECK_FAILED", "We could not verify your access.") : Ce() : W("access.PAGE_NOT_IDENTIFIED", "This page is not linked to its access rules yet.") : W("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", e.find((e) => e.kind === "authentication") ?? e[0] ?? null) : W("access.UNWIRED", "This site is not connected to an account system.") : Ce();
108
+ }, De = (e) => {
109
109
  let t = (e?.apiUrl || "").replace(/\/$/, "");
110
110
  return t ? y({
111
111
  apiUrl: t,
@@ -114,39 +114,39 @@ var ue = [
114
114
  NODE_ENV: "",
115
115
  APP_MODE: e?.appMode || "production"
116
116
  }) : null;
117
- }, Ee = (e) => ({
117
+ }, Oe = (e) => ({
118
118
  apiUrl: e.levo?.api_url || "",
119
119
  workspace: e.workspace_id || "",
120
120
  siteId: e.id || "",
121
121
  insightsUrl: e.levo?.insights_url || null,
122
122
  appMode: e.levo?.app_mode || "production"
123
- }), De = (e) => [
123
+ }), ke = (e) => [
124
124
  "levo-source",
125
125
  "list",
126
126
  e.module,
127
127
  e.identifier,
128
128
  e.query ?? null,
129
129
  e.options ?? null
130
- ], Oe = (e, t) => [
130
+ ], Ae = (e, t) => [
131
131
  "levo-source",
132
132
  "record",
133
133
  e.module,
134
134
  e.identifier,
135
135
  t ?? null
136
- ], ke = (e) => [
136
+ ], je = (e) => [
137
137
  "levo-source",
138
138
  "form",
139
139
  e.module,
140
140
  e.identifier
141
- ], Ae = {
141
+ ], Me = {
142
142
  blog_author: "author",
143
143
  blog_category: "category",
144
144
  blog_tag: "tag"
145
- }, je = (e, t) => {
146
- let n = encodeURIComponent(e.identifier), r = t ? `${encodeURIComponent(t)}/get-single` : "list", i = Ae[e.module];
145
+ }, Ne = (e, t) => {
146
+ let n = encodeURIComponent(e.identifier), r = t ? `${encodeURIComponent(t)}/get-single` : "list", i = Me[e.module];
147
147
  return i ? `/v1/blog/${n}/${i}/${r}` : e.module === "community" ? `/v1/community/${n}/post/${r}` : null;
148
- }, Me = async (e, t) => {
149
- let n = je(t);
148
+ }, Pe = async (e, t) => {
149
+ let n = Ne(t);
150
150
  if (n) {
151
151
  let r = await e.fetch.url(n).post(t.query ?? {}).json();
152
152
  return {
@@ -162,16 +162,16 @@ var ue = [
162
162
  data: r.content.data ?? [],
163
163
  meta: r.content.meta ?? null
164
164
  };
165
- }, Ne = async (e, t, n) => {
166
- let r = je(t, n);
165
+ }, Fe = async (e, t, n) => {
166
+ let r = Ne(t, n);
167
167
  return r ? (await e.fetch.url(r).get().json()).content.data ?? null : (t.module === "collection" ? await e.collection.getCollectionContent({
168
168
  collection_key: t.identifier,
169
169
  slug: n
170
170
  }) : t.module === "blog" ? await e.blog.getSingleBlog(t.identifier, n, { workspace_id: e.workspace ?? "" }) : await e.event.getSingleEvent(n, { workspace_id: e.workspace ?? "" })).content.data ?? null;
171
- }, Pe = async (e, t) => (await e.collection.getCollectionByIDExpanded(t.identifier)).content.data ?? null, Fe = (e) => {
172
- let t = i(), n = z({
173
- queryKey: De(e),
174
- queryFn: () => Me(t, e),
171
+ }, Ie = async (e, t) => (await e.collection.getCollectionByIDExpanded(t.identifier)).content.data ?? null, Le = (e) => {
172
+ let t = i(), n = R({
173
+ queryKey: ke(e),
174
+ queryFn: () => Pe(t, e),
175
175
  enabled: !!t
176
176
  });
177
177
  return {
@@ -184,10 +184,10 @@ var ue = [
184
184
  ...e
185
185
  }) }
186
186
  };
187
- }, Ie = (e, t) => {
188
- let n = i(), r = z({
189
- queryKey: Oe(e, t),
190
- queryFn: () => Ne(n, e, t),
187
+ }, Re = (e, t) => {
188
+ let n = i(), r = R({
189
+ queryKey: Ae(e, t),
190
+ queryFn: () => Fe(n, e, t),
191
191
  enabled: !!n && !!t
192
192
  });
193
193
  return {
@@ -199,10 +199,10 @@ var ue = [
199
199
  ...e
200
200
  }) }
201
201
  };
202
- }, Le = (e) => {
203
- let t = i(), n = z({
204
- queryKey: ke(e),
205
- queryFn: () => Pe(t, e),
202
+ }, ze = (e) => {
203
+ let t = i(), n = R({
204
+ queryKey: je(e),
205
+ queryFn: () => Ie(t, e),
206
206
  enabled: !!t
207
207
  });
208
208
  return {
@@ -214,30 +214,30 @@ var ue = [
214
214
  ...e
215
215
  }) }
216
216
  };
217
- }, Re = (e) => {
217
+ }, Be = (e) => {
218
218
  let t = Object.values(e ?? {});
219
219
  return t.length === 1 ? t[0] : e?.slug;
220
- }, ze = async ({ queryClient: e, config: t, sources: n, params: r }) => {
221
- let i = Te(t);
220
+ }, Ve = async ({ queryClient: e, config: t, sources: n, params: r }) => {
221
+ let i = De(t);
222
222
  if (!i || !n) return {};
223
223
  let a = await Promise.all(Object.entries(n).map(async ([t, n]) => {
224
224
  if (n.mode === "record") {
225
- let a = n.param ? r?.[n.param] : Re(r);
225
+ let a = n.param ? r?.[n.param] : Be(r);
226
226
  return a ? [t, await e.ensureQueryData({
227
- queryKey: Oe(n, a),
228
- queryFn: () => Ne(i, n, a)
227
+ queryKey: Ae(n, a),
228
+ queryFn: () => Fe(i, n, a)
229
229
  }).catch(() => null)] : [t, null];
230
230
  }
231
231
  return n.mode === "form" ? [t, await e.ensureQueryData({
232
+ queryKey: je(n),
233
+ queryFn: () => Ie(i, n)
234
+ }).catch(() => null)] : [t, await e.ensureQueryData({
232
235
  queryKey: ke(n),
233
236
  queryFn: () => Pe(i, n)
234
- }).catch(() => null)] : [t, await e.ensureQueryData({
235
- queryKey: De(n),
236
- queryFn: () => Me(i, n)
237
237
  }).catch(() => null)];
238
238
  }));
239
239
  return Object.fromEntries(a);
240
- }, Be = {
240
+ }, He = {
241
241
  background: "var(--color-page)",
242
242
  foreground: "var(--color-ink)",
243
243
  text: "var(--color-ink)",
@@ -259,10 +259,10 @@ var ue = [
259
259
  input: "var(--color-background1)",
260
260
  inputForeground: "var(--color-ink)",
261
261
  ring: "var(--color-brand)"
262
- }, Ve = (e) => M(() => ({
262
+ }, Ue = (e) => O(() => ({
263
263
  ...o({
264
264
  colors: {
265
- ...Be,
265
+ ...He,
266
266
  ...e?.colors
267
267
  },
268
268
  radius: e?.radius ?? "var(--radius-token)",
@@ -275,15 +275,15 @@ var ue = [
275
275
  }), [e]);
276
276
  //#endregion
277
277
  //#region src/hooks/useMounted.ts
278
- function J() {
279
- let [e, t] = P(!1);
280
- return A(() => t(!0), []), e;
278
+ function G() {
279
+ let [e, t] = A(!1);
280
+ return E(() => t(!0), []), e;
281
281
  }
282
282
  //#endregion
283
283
  //#region src/access/useLevoAuth.ts
284
- var Y = ["levo-auth", "session"], He = () => {
285
- let e = i(), t = B(), n = J(), r = z({
286
- queryKey: Y,
284
+ var K = ["levo-auth", "session"], We = () => {
285
+ let e = i(), t = z(), n = G(), r = R({
286
+ queryKey: K,
287
287
  queryFn: async () => {
288
288
  try {
289
289
  return await e?.membership?.getMe() ?? null;
@@ -294,17 +294,17 @@ var Y = ["levo-auth", "session"], He = () => {
294
294
  enabled: n && !!e,
295
295
  staleTime: 3e4,
296
296
  retry: !1
297
- }), a = R({
297
+ }), a = L({
298
298
  mutationFn: async () => {
299
299
  await e?.membership?.signOut();
300
300
  },
301
- onSettled: () => t.invalidateQueries({ queryKey: Y }),
301
+ onSettled: () => t.invalidateQueries({ queryKey: K }),
302
302
  onError: (t) => {
303
303
  e?.logger?.error("Sign out failed", { exception: b(t) });
304
304
  }
305
- }), o = O(async () => {
306
- await t.invalidateQueries({ queryKey: Y });
307
- }, [t]), s = O(async () => {
305
+ }), o = w(async () => {
306
+ await t.invalidateQueries({ queryKey: K });
307
+ }, [t]), s = w(async () => {
308
308
  await a.mutateAsync().catch(() => void 0);
309
309
  }, [a]), c = r.data ?? null;
310
310
  return {
@@ -316,14 +316,14 @@ var Y = ["levo-auth", "session"], He = () => {
316
316
  signOut: s,
317
317
  isSigningOut: a.isPending
318
318
  };
319
- }, Ue = ({ collection: e, hidden: n, submitLabel: r = "Submit", onSuccess: a, theme: o, className: s }) => {
320
- let c = i(), { account: l } = He(), { schema: u, isLoading: d } = Le({
319
+ }, Ge = ({ collection: e, hidden: n, submitLabel: r = "Submit", onSuccess: a, theme: o, className: s }) => {
320
+ let c = i(), { account: l } = We(), { schema: u, isLoading: d } = ze({
321
321
  module: "collection",
322
322
  identifier: e
323
- }), f = Ve(o);
324
- return c ? /* @__PURE__ */ S("div", {
323
+ }), f = Ue(o);
324
+ return c ? /* @__PURE__ */ N("div", {
325
325
  className: s,
326
- children: /* @__PURE__ */ S(t, {
326
+ children: /* @__PURE__ */ N(t, {
327
327
  fetchedSchema: u,
328
328
  isLoading: d,
329
329
  submitButtonConfig: {
@@ -344,21 +344,21 @@ var Y = ["levo-auth", "session"], He = () => {
344
344
  onSuccess: () => a?.()
345
345
  })
346
346
  }) : null;
347
- }, We = "so_levo_membership_account", Ge = [
347
+ }, Ke = "so_levo_membership_account", qe = [
348
348
  "profile_picture",
349
349
  "first_name",
350
350
  "last_name",
351
351
  "email",
352
352
  "username",
353
353
  "socials"
354
- ], Ke = ["email", "username"], qe = (e) => Ge.includes(e.key) || e.editable === !0, Je = ({ hidden: t, submitLabel: n = "Save and continue", onSuccess: r, errorClassName: a = "text-sm text-[var(--color-danger)]", theme: o, className: s }) => {
355
- let c = i(), l = J(), { account: u } = He(), d = Ve(o), [f, p] = P(""), m = z({
354
+ ], Je = ["email", "username"], Ye = (e) => qe.includes(e.key) || e.editable === !0, Xe = ({ hidden: t, submitLabel: n = "Save and continue", onSuccess: r, errorClassName: a = "text-sm text-[var(--color-danger)]", theme: o, className: s }) => {
355
+ let c = i(), l = G(), { account: u } = We(), d = Ue(o), [f, p] = A(""), m = R({
356
356
  queryKey: ["levo-access", "profile-schema"],
357
- queryFn: async () => (await c?.collection?.getCollectionByIDExpanded(We))?.content?.data ?? null,
357
+ queryFn: async () => (await c?.collection?.getCollectionByIDExpanded(Ke))?.content?.data ?? null,
358
358
  enabled: l && !!c,
359
359
  staleTime: 5 * 6e4,
360
360
  retry: 1
361
- }), h = t?.join("|") ?? "", g = M(() => {
361
+ }), h = t?.join("|") ?? "", g = O(() => {
362
362
  let e = m.data;
363
363
  return e ? {
364
364
  ...e,
@@ -366,14 +366,14 @@ var Y = ["levo-auth", "session"], He = () => {
366
366
  ...e,
367
367
  fields: e.fields?.map((e) => ({
368
368
  ...e,
369
- hidden: !qe(e) || !!t?.includes(e.key),
370
- readonly: e.readonly || Ke.includes(e.key)
369
+ hidden: !Ye(e) || !!t?.includes(e.key),
370
+ readonly: e.readonly || Je.includes(e.key)
371
371
  }))
372
372
  }))
373
373
  } : null;
374
- }, [m.data, h]), _ = R({
374
+ }, [m.data, h]), _ = L({
375
375
  mutationFn: async (e) => {
376
- let n = g?.sections?.flatMap((e) => e?.fields ?? [])?.filter((e) => qe(e) && !Ke.includes(e.key) && !t?.includes(e.key))?.map((e) => e?.key) ?? [];
376
+ let n = g?.sections?.flatMap((e) => e?.fields ?? [])?.filter((e) => Ye(e) && !Je.includes(e.key) && !t?.includes(e.key))?.map((e) => e?.key) ?? [];
377
377
  await c?.membership?.updateMe(Object.fromEntries(Object.entries(e).filter(([e]) => n.includes(e))));
378
378
  },
379
379
  onMutate: () => p(""),
@@ -383,12 +383,12 @@ var Y = ["levo-auth", "session"], He = () => {
383
383
  c?.logger?.error("Failed to update profile", { exception: t }), p(t?.message || "Something went wrong. Please try again.");
384
384
  }
385
385
  });
386
- return c ? /* @__PURE__ */ C("div", {
386
+ return c ? /* @__PURE__ */ P("div", {
387
387
  className: s,
388
- children: [f ? /* @__PURE__ */ S("p", {
388
+ children: [f ? /* @__PURE__ */ N("p", {
389
389
  className: a,
390
390
  children: f
391
- }) : null, g ? /* @__PURE__ */ S(e, {
391
+ }) : null, g ? /* @__PURE__ */ N(e, {
392
392
  schema: g,
393
393
  initialValues: u ?? {},
394
394
  uiConfig: {
@@ -404,33 +404,33 @@ var Y = ["levo-auth", "session"], He = () => {
404
404
  onSubmit: (e) => _.mutate(e)
405
405
  }) : null]
406
406
  }) : null;
407
- }, Ye = null, Xe = /* @__PURE__ */ new Set(), Ze = (e) => {
408
- if (Ye !== e) {
409
- Ye = e;
410
- for (let e of Xe) e();
407
+ }, Ze = null, Qe = /* @__PURE__ */ new Set(), $e = (e) => {
408
+ if (Ze !== e) {
409
+ Ze = e;
410
+ for (let e of Qe) e();
411
411
  }
412
- }, Qe = (e) => (Xe.add(e), () => {
413
- Xe.delete(e);
414
- }), $e = () => F(Qe, () => Ye, () => null), et = (e) => {
415
- let t = i(), n = B(), r = J(), { isLoggedIn: a, isLoaded: o } = He(), s = $e(), c = e.id?.trim() || "", { rules: l, invalid: u } = M(() => ve(e.access), [e.access]), d = M(() => ye(l), [l]), f = r && !!t && l.length > 0 && !u && !!c && a && !s, p = z({
412
+ }, et = (e) => (Qe.add(e), () => {
413
+ Qe.delete(e);
414
+ }), tt = () => j(et, () => Ze, () => null), nt = (e) => {
415
+ let t = i(), n = z(), r = G(), { isLoggedIn: a, isLoaded: o } = We(), s = tt(), c = e.id?.trim() || "", { rules: l, invalid: u } = O(() => be(e.access), [e.access]), d = O(() => xe(l), [l]), f = r && !!t && l.length > 0 && !u && !!c && a && !s, p = R({
416
416
  queryKey: ["levo-access", c],
417
417
  queryFn: async () => (await t?.fetch.url(`/v1/builder/page/${c}/check-access`).post().json())?.content?.data ?? null,
418
418
  enabled: f,
419
419
  staleTime: 0,
420
420
  retry: 1
421
421
  });
422
- A(() => {
422
+ E(() => {
423
423
  p.isError && t?.logger?.error("Page access check failed", { exception: b(p.error) });
424
424
  }, [
425
425
  p.isError,
426
426
  p.error,
427
427
  t
428
428
  ]);
429
- let m = O(() => {
430
- n.invalidateQueries({ queryKey: Y }), n.invalidateQueries({ queryKey: ["levo-access", c] });
429
+ let m = w(() => {
430
+ n.invalidateQueries({ queryKey: K }), n.invalidateQueries({ queryKey: ["levo-access", c] });
431
431
  }, [n, c]);
432
432
  return {
433
- ...we({
433
+ ...Ee({
434
434
  rules: l,
435
435
  invalid: u,
436
436
  pageId: c,
@@ -448,26 +448,26 @@ var Y = ["levo-auth", "session"], He = () => {
448
448
  recheck: m,
449
449
  isChecking: p.isFetching
450
450
  };
451
- }, tt = "membership.account.ACCOUNT_PENDING_APPROVAL", nt = (e) => e ? e === "membership.account.ACCOUNT_PENDING_APPROVAL" || e.includes("ACCOUNT_PENDING_APPROVAL") : !1, rt = (e) => {
451
+ }, rt = "membership.account.ACCOUNT_PENDING_APPROVAL", it = (e) => e ? e === "membership.account.ACCOUNT_PENDING_APPROVAL" || e.includes("ACCOUNT_PENDING_APPROVAL") : !1, at = (e) => {
452
452
  let t = b(e);
453
453
  return {
454
454
  code: t?.code || "SOMETHING_WENT_WRONG",
455
455
  title: t?.title || "Something went wrong",
456
456
  message: t?.message || "Something went wrong. Please try again.",
457
457
  fieldErrors: Object.fromEntries((t?.fieldErrors ?? []).map((e) => [e.param, e.message])),
458
- isPendingApproval: nt(t?.code)
458
+ isPendingApproval: it(t?.code)
459
459
  };
460
- }, it = {
460
+ }, ot = {
461
461
  code: "site.NOT_CONNECTED",
462
462
  title: "Sign-in unavailable",
463
463
  message: "This site is not connected to an account system yet.",
464
464
  fieldErrors: {},
465
465
  isPendingApproval: !1
466
- }, at = () => {
467
- let e = i(), t = B(), n = O(async (t, n) => {
466
+ }, st = () => {
467
+ let e = i(), t = z(), n = w(async (t, n) => {
468
468
  if (!e?.membership) return {
469
469
  ok: !1,
470
- error: it
470
+ error: ot
471
471
  };
472
472
  try {
473
473
  return {
@@ -478,21 +478,21 @@ var Y = ["levo-auth", "session"], He = () => {
478
478
  let r = b(n);
479
479
  return e.logger?.error(t, { exception: r }), {
480
480
  ok: !1,
481
- error: rt(r)
481
+ error: at(r)
482
482
  };
483
483
  }
484
- }, [e]), r = O(async ({ identifier: t, medium: n }) => {
484
+ }, [e]), r = w(async ({ identifier: t, medium: n }) => {
485
485
  await e?.membership?.requestOtp({
486
486
  content: t,
487
487
  ...n === "whatsapp" ? { medium: "whatsapp" } : {}
488
488
  });
489
- }, [e]), a = R({ mutationFn: (e) => n("Failed to send verification code", () => r(e)) }), o = R({ mutationFn: (e) => n("Failed to resend verification code", () => r(e)) }), s = R({ mutationFn: ({ identifier: r, code: i }) => n("Verification failed", async () => {
489
+ }, [e]), a = L({ mutationFn: (e) => n("Failed to send verification code", () => r(e)) }), o = L({ mutationFn: (e) => n("Failed to resend verification code", () => r(e)) }), s = L({ mutationFn: ({ identifier: r, code: i }) => n("Verification failed", async () => {
490
490
  let n = await e?.membership?.signInWithOtp({
491
491
  content: r,
492
492
  code: i
493
493
  }) ?? null;
494
- return t.setQueryData(Y, n), t.invalidateQueries({ queryKey: Y }), n;
495
- }) }), c = R({ mutationFn: (t) => n("Failed to send magic link", async () => {
494
+ return t.setQueryData(K, n), t.invalidateQueries({ queryKey: K }), n;
495
+ }) }), c = L({ mutationFn: (t) => n("Failed to send magic link", async () => {
496
496
  await e?.membership?.requestMagicLink({ content: t });
497
497
  }) });
498
498
  return {
@@ -505,11 +505,11 @@ var Y = ["levo-auth", "session"], He = () => {
505
505
  isVerifying: s.isPending,
506
506
  isSendingMagicLink: c.isPending
507
507
  };
508
- }, ot = 700, st = 500, ct = 700, lt = (e, t) => {
509
- let n = window.screenX + (window.outerWidth - st) / 2, r = window.screenY + (window.outerHeight - ct) / 2.5;
510
- return window.open(e, t, `width=${st},height=${ct},left=${n},top=${r}`);
511
- }, ut = ({ methods: e, title: t = "Sign in", onSuccess: n, onError: r }) => {
512
- let a = i(), o = B(), s = J(), [c, l] = P(null), [u, d] = P(null), f = N(null), p = N(void 0), m = N({
508
+ }, ct = 700, lt = 500, ut = 700, dt = (e, t) => {
509
+ let n = window.screenX + (window.outerWidth - lt) / 2, r = window.screenY + (window.outerHeight - ut) / 2.5;
510
+ return window.open(e, t, `width=${lt},height=${ut},left=${n},top=${r}`);
511
+ }, ft = ({ methods: e, title: t = "Sign in", onSuccess: n, onError: r }) => {
512
+ let a = i(), o = z(), s = G(), [c, l] = A(null), [u, d] = A(null), f = k(null), p = k(void 0), m = k({
513
513
  onSuccess: n,
514
514
  onError: r
515
515
  });
@@ -517,14 +517,14 @@ var Y = ["levo-auth", "session"], He = () => {
517
517
  onSuccess: n,
518
518
  onError: r
519
519
  };
520
- let h = z({
520
+ let h = R({
521
521
  queryKey: ["levo-auth", "oauth-urls"],
522
522
  queryFn: async () => await a?.membership?.getOAuthURL() ?? null,
523
523
  enabled: s && !!a && e.length > 0,
524
524
  staleTime: 5 * 6e4,
525
525
  retry: !1
526
526
  });
527
- A(() => {
527
+ E(() => {
528
528
  if (!h.error) return;
529
529
  let e = b(h.error);
530
530
  a?.logger?.error("Failed to load OAuth URLs", { exception: e }), d({
@@ -535,13 +535,13 @@ var Y = ["levo-auth", "session"], He = () => {
535
535
  isPendingApproval: !1
536
536
  });
537
537
  }, [h.error, a]);
538
- let g = O(() => {
538
+ let g = w(() => {
539
539
  window.clearInterval(p.current), p.current = void 0, f.current?.close(), f.current = null, l(null);
540
540
  }, []);
541
- A(() => () => {
541
+ E(() => () => {
542
542
  window.clearInterval(p.current), f.current?.close();
543
543
  }, []);
544
- let _ = O(() => {
544
+ let _ = w(() => {
545
545
  window.clearInterval(p.current), p.current = window.setInterval(() => {
546
546
  let e = f.current;
547
547
  if (!e || e.closed) {
@@ -557,7 +557,7 @@ var Y = ["levo-auth", "session"], He = () => {
557
557
  let n = t.get("code");
558
558
  if (!n) return;
559
559
  if (g(), n.toLowerCase() === "success") {
560
- d(null), o.invalidateQueries({ queryKey: Y }), m.current.onSuccess?.();
560
+ d(null), o.invalidateQueries({ queryKey: K }), m.current.onSuccess?.();
561
561
  return;
562
562
  }
563
563
  let r = {
@@ -565,11 +565,11 @@ var Y = ["levo-auth", "session"], He = () => {
565
565
  title: t.get("title") || "Sign-in failed",
566
566
  message: t.get("message") || "We could not sign you in. Please try again.",
567
567
  fieldErrors: {},
568
- isPendingApproval: nt(t.get("code"))
568
+ isPendingApproval: it(t.get("code"))
569
569
  };
570
570
  r.isPendingApproval || d(r), m.current.onError?.(r);
571
- }, ot);
572
- }, [o, g]), v = M(() => {
571
+ }, ct);
572
+ }, [o, g]), v = O(() => {
573
573
  let e = h.data;
574
574
  if (!e || typeof window > "u") return {};
575
575
  let t = window.location.href, n = a?.pageContext;
@@ -584,12 +584,12 @@ var Y = ["levo-auth", "session"], He = () => {
584
584
  }));
585
585
  }, [h.data, a]);
586
586
  return {
587
- providers: M(() => e.filter((e) => !!v[e]).map((e) => ({
587
+ providers: O(() => e.filter((e) => !!v[e]).map((e) => ({
588
588
  provider: e,
589
589
  signIn: () => {
590
590
  let n = v[e];
591
591
  if (n) {
592
- if (d(null), f.current?.close(), f.current = lt(n, t), !f.current) {
592
+ if (d(null), f.current?.close(), f.current = dt(n, t), !f.current) {
593
593
  d({
594
594
  code: "POPUP_BLOCKED",
595
595
  title: "Popup blocked",
@@ -611,26 +611,26 @@ var Y = ["levo-auth", "session"], He = () => {
611
611
  isLoading: h.isFetching,
612
612
  pendingProvider: c,
613
613
  error: u,
614
- clearError: O(() => d(null), [])
614
+ clearError: w(() => d(null), [])
615
615
  };
616
- }, dt = 4, ft = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.trim()), pt = (e) => RegExp("^\\d{4}$").test(e.trim()), mt = (e) => {
616
+ }, pt = 4, mt = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.trim()), ht = (e) => RegExp("^\\d{4}$").test(e.trim()), gt = (e) => {
617
617
  let t = e.replace(/\D/g, "").replace(/^0+/, "");
618
618
  return t ? `+${t}` : "";
619
- }, ht = (e) => /^\+[1-9]\d{7,14}$/.test(mt(e)), gt = ({ value: e, onChange: t, length: n = 4, onComplete: r, autoFocus: i, disabled: a }) => {
620
- let o = N([]), [s, c] = P(null), l = N(r);
619
+ }, _t = (e) => /^\+[1-9]\d{7,14}$/.test(gt(e)), vt = ({ value: e, onChange: t, length: n = 4, onComplete: r, autoFocus: i, disabled: a }) => {
620
+ let o = k([]), [s, c] = A(null), l = k(r);
621
621
  l.current = r;
622
- let u = Array.from({ length: n }, (t, n) => e[n] ?? ""), d = O((e) => {
622
+ let u = Array.from({ length: n }, (t, n) => e[n] ?? ""), d = w((e) => {
623
623
  let t = Math.max(0, Math.min(n - 1, e)), r = o.current[t];
624
624
  r?.focus(), r?.select();
625
625
  }, [n]);
626
- A(() => {
626
+ E(() => {
627
627
  i && !a && d(0);
628
628
  }, [
629
629
  i,
630
630
  a,
631
631
  d
632
632
  ]);
633
- let f = O((e, r) => {
633
+ let f = w((e, r) => {
634
634
  let i = e.slice(0, n);
635
635
  t(i), d(r), i.length === n && l.current?.(i);
636
636
  }, [
@@ -698,13 +698,13 @@ var Y = ["levo-auth", "session"], He = () => {
698
698
  role: "group",
699
699
  "aria-label": `${n}-digit verification code`
700
700
  },
701
- clear: O(() => f("", 0), [f])
701
+ clear: w(() => f("", 0), [f])
702
702
  };
703
- }, _t = D(() => import("./kbChat-a2dXSeRc.js")), vt = ({ site: e, path: t }) => {
704
- let n = J(), r = e.workspace_id || void 0;
705
- return !n || !r ? null : /* @__PURE__ */ S(T, {
703
+ }, yt = C(() => import("./kbChat-DtZ4vuCZ.js")), bt = ({ site: e, path: t }) => {
704
+ let n = G(), r = e.workspace_id || void 0;
705
+ return !n || !r ? null : /* @__PURE__ */ N(x, {
706
706
  fallback: null,
707
- children: /* @__PURE__ */ S(_t, {
707
+ children: /* @__PURE__ */ N(yt, {
708
708
  workspaceId: r,
709
709
  siteName: e.name || void 0,
710
710
  siteLogo: void 0,
@@ -714,65 +714,65 @@ var Y = ["levo-auth", "session"], He = () => {
714
714
  path: t
715
715
  })
716
716
  });
717
- }, yt = "(prefers-color-scheme: dark)", bt = (e) => {
717
+ }, xt = "(prefers-color-scheme: dark)", St = (e) => {
718
718
  try {
719
719
  let t = localStorage.getItem(e);
720
720
  return t === "light" || t === "dark" || t === "system" ? t : null;
721
721
  } catch {
722
722
  return null;
723
723
  }
724
- }, xt = (e, t) => {
724
+ }, Ct = (e, t) => {
725
725
  try {
726
726
  localStorage.setItem(e, t);
727
727
  } catch {}
728
728
  };
729
- function St(e, t) {
730
- return `(function(){try{var t=localStorage.getItem(${JSON.stringify(e)});if(t!=='light'&&t!=='dark'&&t!=='system'){t=${JSON.stringify(t)}}var d=matchMedia('${yt}').matches;var r=t==='system'?(d?'dark':'light'):t;var e=document.documentElement;e.classList.remove('light','dark');e.classList.add(r);e.style.colorScheme=r}catch(e){}})();`;
729
+ function wt(e, t) {
730
+ return `(function(){try{var t=localStorage.getItem(${JSON.stringify(e)});if(t!=='light'&&t!=='dark'&&t!=='system'){t=${JSON.stringify(t)}}var d=matchMedia('${xt}').matches;var r=t==='system'?(d?'dark':'light'):t;var e=document.documentElement;e.classList.remove('light','dark');e.classList.add(r);e.style.colorScheme=r}catch(e){}})();`;
731
731
  }
732
- var Ct = E(void 0), wt = (e) => e === "system" ? window.matchMedia(yt).matches ? "dark" : "light" : e;
733
- function Tt(e) {
732
+ var Tt = S(void 0), Et = (e) => e === "system" ? window.matchMedia(xt).matches ? "dark" : "light" : e;
733
+ function Dt(e) {
734
734
  let t = document.documentElement;
735
735
  t.classList.remove("light", "dark"), t.classList.add(e), t.style.colorScheme = e;
736
736
  }
737
- var Et = ({ children: e, defaultMode: t = "system", storageKey: n = "color-mode" }) => {
738
- let [r, i] = P(t), [a, o] = P(t === "dark" ? "dark" : "light"), s = J();
739
- return A(() => {
740
- i(bt(n) ?? t);
741
- }, [t, n]), A(() => {
737
+ var Ot = ({ children: e, defaultMode: t = "system", storageKey: n = "color-mode" }) => {
738
+ let [r, i] = A(t), [a, o] = A(t === "dark" ? "dark" : "light"), s = G();
739
+ return E(() => {
740
+ i(St(n) ?? t);
741
+ }, [t, n]), E(() => {
742
742
  if (!s) return;
743
- let e = wt(r);
744
- Tt(e), o(e);
745
- }, [r, s]), A(() => {
743
+ let e = Et(r);
744
+ Dt(e), o(e);
745
+ }, [r, s]), E(() => {
746
746
  if (!s || r !== "system") return;
747
- let e = window.matchMedia(yt), t = () => {
747
+ let e = window.matchMedia(xt), t = () => {
748
748
  let t = e.matches ? "dark" : "light";
749
- Tt(t), o(t);
749
+ Dt(t), o(t);
750
750
  };
751
751
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
752
- }, [r, s]), /* @__PURE__ */ C(Ct.Provider, {
752
+ }, [r, s]), /* @__PURE__ */ P(Tt.Provider, {
753
753
  value: {
754
754
  mode: r,
755
755
  resolvedMode: a,
756
756
  setMode: (e) => {
757
- xt(n, e), i(e);
757
+ Ct(n, e), i(e);
758
758
  }
759
759
  },
760
- children: [/* @__PURE__ */ S(V, { children: St(n, t) }), e]
760
+ children: [/* @__PURE__ */ N(ee, { children: wt(n, t) }), e]
761
761
  });
762
762
  };
763
- function Dt() {
764
- let e = k(Ct);
763
+ function kt() {
764
+ let e = T(Tt);
765
765
  if (e === void 0) throw Error("useColorMode must be used within a ColorModeProvider");
766
766
  return e;
767
767
  }
768
768
  //#endregion
769
769
  //#region src/form/LevoForm.tsx
770
- var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant: a = "default", successConfig: o, theme: s, className: c, defaultValues: l, disabled: u, showSuccessScreen: d = !0, onSuccess: f, onError: p }) => {
771
- let m = i(), { schema: h, isLoading: g, bind: _ } = Le(e), v = Ve(s);
772
- return m ? /* @__PURE__ */ S("div", {
770
+ var At = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant: a = "default", successConfig: o, theme: s, className: c, defaultValues: l, disabled: u, showSuccessScreen: d = !0, onSuccess: f, onError: p }) => {
771
+ let m = i(), { schema: h, isLoading: g, bind: _ } = ze(e), v = Ue(s);
772
+ return m ? /* @__PURE__ */ N("div", {
773
773
  ..._,
774
774
  className: c,
775
- children: /* @__PURE__ */ S(t, {
775
+ children: /* @__PURE__ */ N(t, {
776
776
  fetchedSchema: h,
777
777
  isLoading: g,
778
778
  submitButtonConfig: {
@@ -798,28 +798,28 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
798
798
  onError: p
799
799
  })
800
800
  }) : null;
801
- }, kt = 1400, At = 12 * 1024 * 1024, jt = new Set(["transparent", "rgba(0, 0, 0, 0)"]), Mt = {
801
+ }, jt = 1400, Mt = 12 * 1024 * 1024, Nt = new Set(["transparent", "rgba(0, 0, 0, 0)"]), Pt = {
802
802
  imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",
803
803
  onImageErrorHandler: () => void 0
804
- }, Nt = (e) => {
804
+ }, Ft = (e) => {
805
805
  let t = getComputedStyle(e);
806
- return !jt.has(t.backgroundColor) || t.backgroundImage !== "none";
807
- }, Pt = (e) => {
806
+ return !Nt.has(t.backgroundColor) || t.backgroundImage !== "none";
807
+ }, It = (e) => {
808
808
  for (let t = e; t; t = t.parentElement) {
809
809
  let e = getComputedStyle(t).backgroundColor;
810
- if (!jt.has(e)) return e;
810
+ if (!Nt.has(e)) return e;
811
811
  }
812
812
  return "#ffffff";
813
- }, Ft = async (e, t) => {
814
- let { toPng: n } = await import("./es-ByBbirnH.js"), r = e.getBoundingClientRect(), i = Math.max(r.width, r.height, 1), a = Math.min(2, Math.max(.4, kt / i)), o = await n(e, {
815
- ...Mt,
813
+ }, Lt = async (e, t) => {
814
+ let { toPng: n } = await import("./es-CGQflL9T.js"), r = e.getBoundingClientRect(), i = Math.max(r.width, r.height, 1), a = Math.min(2, Math.max(.4, jt / i)), o = await n(e, {
815
+ ...Pt,
816
816
  pixelRatio: a,
817
- backgroundColor: Pt(e),
817
+ backgroundColor: It(e),
818
818
  filter: (e) => !t.includes(e)
819
819
  });
820
- if (o.length > At) throw Error("capture too large");
820
+ if (o.length > Mt) throw Error("capture too large");
821
821
  return o;
822
- }, It = 4, Lt = 4e3, Rt = (e, t) => {
822
+ }, Rt = 4, zt = 4e3, Bt = (e, t) => {
823
823
  let n = document.elementFromPoint(e.x + e.width / 2, e.y + e.height / 2);
824
824
  for (; n && t.includes(n);) n = n.parentElement;
825
825
  let r = document.body;
@@ -830,8 +830,8 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
830
830
  break;
831
831
  }
832
832
  }
833
- let i = window.innerWidth * window.innerHeight * It || 2 ** 53 - 1, a = r;
834
- for (; !Nt(a);) {
833
+ let i = window.innerWidth * window.innerHeight * Rt || 2 ** 53 - 1, a = r;
834
+ for (; !Ft(a);) {
835
835
  let e = a.parentElement;
836
836
  if (!e || e === document.documentElement) break;
837
837
  let t = e.getBoundingClientRect();
@@ -839,13 +839,13 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
839
839
  a = e;
840
840
  }
841
841
  return a;
842
- }, zt = async (e, t) => {
843
- let { toCanvas: n } = await import("./es-ByBbirnH.js"), r = Rt(e, t), i = r.getBoundingClientRect(), a = Math.max(e.width, e.height, 1), o = Math.min(2, Math.max(.4, kt / a)), s = Math.max(i.width, i.height, 1);
844
- o = Math.min(o, Lt / s);
842
+ }, Vt = async (e, t) => {
843
+ let { toCanvas: n } = await import("./es-CGQflL9T.js"), r = Bt(e, t), i = r.getBoundingClientRect(), a = Math.max(e.width, e.height, 1), o = Math.min(2, Math.max(.4, jt / a)), s = Math.max(i.width, i.height, 1);
844
+ o = Math.min(o, zt / s);
845
845
  let c = await n(r, {
846
- ...Mt,
846
+ ...Pt,
847
847
  pixelRatio: o,
848
- backgroundColor: Pt(r),
848
+ backgroundColor: It(r),
849
849
  filter: (e) => !t.includes(e)
850
850
  }), l = document.createElement("canvas");
851
851
  l.width = Math.max(1, Math.round(e.width * o)), l.height = Math.max(1, Math.round(e.height * o));
@@ -853,26 +853,26 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
853
853
  if (!u) throw Error("no 2d context");
854
854
  u.drawImage(c, (e.x - i.left) * o, (e.y - i.top) * o, e.width * o, e.height * o, 0, 0, l.width, l.height);
855
855
  let d = l.toDataURL("image/png");
856
- if (d.length > At) throw Error("capture too large");
856
+ if (d.length > Mt) throw Error("capture too large");
857
857
  return d;
858
- }, Bt = {
858
+ }, q = {
859
859
  ring: 99997,
860
860
  overlay: 99998,
861
861
  label: 99999
862
- }, X = {
862
+ }, J = {
863
863
  hover: "#3b82f6",
864
864
  hoverBg: "rgba(59,130,246,0.12)",
865
865
  hoverLabelBg: "#1d4ed8",
866
866
  select: "#16a34a",
867
867
  selectGlow: "rgba(22,163,74,0.18)"
868
- }, Z = (e) => {
868
+ }, Y = (e) => {
869
869
  let t = e?.getAttribute("data-tsd-source");
870
870
  return t ? t.replace(/^\//, "") : null;
871
- }, Vt = (e) => Array.from(document.querySelectorAll("[data-tsd-source]")).filter((t) => Z(t) === e), Ht = (e, t) => {
872
- let n = Vt(t).indexOf(e);
871
+ }, Ht = (e) => Array.from(document.querySelectorAll("[data-tsd-source]")).filter((t) => Y(t) === e), Ut = (e, t) => {
872
+ let n = Ht(t).indexOf(e);
873
873
  return n < 0 ? 0 : n;
874
- }, Ut = (e, t = 0) => {
875
- let n = Vt(e);
874
+ }, X = (e, t = 0) => {
875
+ let n = Ht(e);
876
876
  return n[t] ?? n[0] ?? null;
877
877
  }, Wt = (e, t) => {
878
878
  let n = (e.getAttribute("data-staged-key") || "").split(/\s+/).filter(Boolean);
@@ -936,13 +936,13 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
936
936
  return t.join(" > ");
937
937
  }, Zt = () => {
938
938
  let e = document.createElement("div");
939
- e.style.cssText = `position:fixed;pointer-events:none;z-index:${Bt.overlay};background:${X.hoverBg};outline:2px solid ${X.hover};border-radius:2px;display:none`;
939
+ e.style.cssText = `position:fixed;pointer-events:none;z-index:${q.overlay};background:${J.hoverBg};outline:2px solid ${J.hover};border-radius:2px;display:none`;
940
940
  let t = document.createElement("div");
941
- t.style.cssText = `position:fixed;pointer-events:none;z-index:${Bt.label};background:${X.hoverLabelBg};color:#fff;font:11px/1.6 ui-monospace,monospace;padding:1px 6px;border-radius:4px;display:none;max-width:70vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`;
941
+ t.style.cssText = `position:fixed;pointer-events:none;z-index:${q.label};background:${J.hoverLabelBg};color:#fff;font:11px/1.6 ui-monospace,monospace;padding:1px 6px;border-radius:4px;display:none;max-width:70vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`;
942
942
  let n = document.createElement("div");
943
- n.style.cssText = `position:fixed;pointer-events:none;z-index:${Bt.ring};outline:2px solid ${X.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 4px ${X.selectGlow};display:none`;
943
+ n.style.cssText = `position:fixed;pointer-events:none;z-index:${q.ring};outline:2px solid ${J.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 4px ${J.selectGlow};display:none`;
944
944
  let r = document.createElement("div");
945
- return r.style.cssText = `position:fixed;pointer-events:none;z-index:${Bt.label};background:${X.select};color:#fff;font:11px/1.6 ui-monospace,monospace;padding:1px 6px;border-radius:4px;display:none;max-width:70vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`, {
945
+ return r.style.cssText = `position:fixed;pointer-events:none;z-index:${q.label};background:${J.select};color:#fff;font:11px/1.6 ui-monospace,monospace;padding:1px 6px;border-radius:4px;display:none;max-width:70vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`, {
946
946
  overlay: e,
947
947
  label: t,
948
948
  ring: n,
@@ -976,7 +976,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
976
976
  }, nn = 2e3, rn = (e) => {
977
977
  let t = [], n = e;
978
978
  for (; n && n.nodeType === 1 && n !== document.body && t.length < 8;) {
979
- let e = Z(n);
979
+ let e = Y(n);
980
980
  e && t.unshift({
981
981
  tag: n.tagName.toLowerCase(),
982
982
  text: (n.textContent || "").trim().slice(0, 60),
@@ -985,7 +985,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
985
985
  }
986
986
  return t;
987
987
  }, an = (e) => {
988
- let t = Z(e), n = t ? Vt(t).length : 1, r = t ? Ht(e, t) : 0, i = t && tn(e) ? (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, nn) : void 0, a = on(e);
988
+ let t = Y(e), n = t ? Ht(t).length : 1, r = t ? Ut(e, t) : 0, i = t && tn(e) ? (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, nn) : void 0, a = on(e);
989
989
  return {
990
990
  tag: e.tagName.toLowerCase(),
991
991
  classes: typeof e.className == "string" ? e.className.trim() : "",
@@ -1002,7 +1002,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1002
1002
  }, on = (e) => {
1003
1003
  let t = e.closest("[data-levo-source]");
1004
1004
  if (!t) return;
1005
- let n = t.getAttribute("data-levo-source") ?? "", r = Z(t), i;
1005
+ let n = t.getAttribute("data-levo-source") ?? "", r = Y(t), i;
1006
1006
  try {
1007
1007
  i = JSON.parse(n);
1008
1008
  } catch {
@@ -1012,12 +1012,12 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1012
1012
  raw: n,
1013
1013
  element: {
1014
1014
  source: r ?? "",
1015
- index: r ? Ht(t, r) : 0
1015
+ index: r ? Ut(t, r) : 0
1016
1016
  },
1017
1017
  ...i === void 0 ? {} : { config: i }
1018
1018
  };
1019
1019
  }, sn = () => Array.from(document.querySelectorAll("[data-levo-source]")).map((e) => {
1020
- let t = e.getAttribute("data-levo-source") ?? "", n = Z(e), r;
1020
+ let t = e.getAttribute("data-levo-source") ?? "", n = Y(e), r;
1021
1021
  try {
1022
1022
  r = JSON.parse(t);
1023
1023
  } catch {
@@ -1027,7 +1027,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1027
1027
  raw: t,
1028
1028
  element: {
1029
1029
  source: n ?? "",
1030
- index: n ? Ht(e, n) : 0
1030
+ index: n ? Ut(e, n) : 0
1031
1031
  },
1032
1032
  tag: e.tagName.toLowerCase(),
1033
1033
  label: Yt(e),
@@ -1041,7 +1041,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1041
1041
  ]), pn = (e, t) => t.includes(e) || e.id === "studio-staged" || fn.has(e.tagName.toLowerCase()), mn = (e) => {
1042
1042
  let t = !1, n = 0, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1043
1043
  for (let e of Array.from(document.querySelectorAll("[data-tsd-source]"))) {
1044
- let t = Z(e);
1044
+ let t = Y(e);
1045
1045
  if (!t) continue;
1046
1046
  let n = i.get(t) ?? 0;
1047
1047
  r.set(e, n), i.set(t, n + 1);
@@ -1054,7 +1054,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1054
1054
  }
1055
1055
  }, o = (i, s) => {
1056
1056
  n++;
1057
- let c = Z(i), l = a(i), u = Array.from(i.children).filter((t) => !pn(t, e)), d = {
1057
+ let c = Y(i), l = a(i), u = Array.from(i.children).filter((t) => !pn(t, e)), d = {
1058
1058
  tag: i.tagName.toLowerCase(),
1059
1059
  ...c ? {
1060
1060
  source: c,
@@ -1121,16 +1121,16 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1121
1121
  }
1122
1122
  }, bn = (e) => (vn.add(e), () => {
1123
1123
  vn.delete(e);
1124
- }), xn = () => F(bn, () => _n, () => !1), Sn = (e) => {
1124
+ }), xn = () => j(bn, () => _n, () => !1), Sn = (e) => {
1125
1125
  let { channel: t, originals: n, staged: r } = e, i = t.send, a = null;
1126
1126
  return { onMessage: (o) => {
1127
1127
  let s = o.data;
1128
1128
  if (!(!s || s.source !== "web-chat") && t.acceptOrigin(o)) {
1129
- if (yn(), s.type === "set-access-preview") Ze(s.stage ?? null);
1129
+ if (yn(), s.type === "set-access-preview") $e(s.stage ?? null);
1130
1130
  else if (s.type === "set-inspect") e.setInspect(s.enabled);
1131
1131
  else if (s.type === "set-text-edit") e.setTextEdit(s.enabled);
1132
1132
  else if (s.type === "revert-text") {
1133
- let e = String(s.element?.source || ""), t = Number.isInteger(s.element?.index) ? s.element.index : 0, r = n.restore(`${e}#${t}`), i = r == null ? null : Ut(e, t);
1133
+ let e = String(s.element?.source || ""), t = Number.isInteger(s.element?.index) ? s.element.index : 0, r = n.restore(`${e}#${t}`), i = r == null ? null : X(e, t);
1134
1134
  i && r != null && (i.textContent = r);
1135
1135
  } else if (s.type === "stage-style") {
1136
1136
  let t = String(s.stageId || ""), n = String(s.element?.source || ""), a = Number.isInteger(s.element?.index) ? s.element.index : 0, o = s.styles && typeof s.styles == "object" ? s.styles : null;
@@ -1189,7 +1189,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1189
1189
  }
1190
1190
  e.syncDomObserver();
1191
1191
  } else if (s.type === "select-element") {
1192
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? Ut(t, n) : null;
1192
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? X(t, n) : null;
1193
1193
  if (!r) {
1194
1194
  i({
1195
1195
  type: "select-miss",
@@ -1208,7 +1208,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1208
1208
  element: an(r)
1209
1209
  });
1210
1210
  } else if (s.type === "edit-element") {
1211
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? Ut(t, n) : null;
1211
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? X(t, n) : null;
1212
1212
  if (!r) {
1213
1213
  i({
1214
1214
  type: "select-miss",
@@ -1229,7 +1229,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1229
1229
  let o = e.editableTarget(r);
1230
1230
  o && e.startEditAtEnd(o);
1231
1231
  } else if (s.type === "highlight-element") {
1232
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? Ut(t, n) : null;
1232
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? X(t, n) : null;
1233
1233
  if (!r) a = null, e.hideTextHover(), i({
1234
1234
  type: "highlight-miss",
1235
1235
  element: {
@@ -1270,7 +1270,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1270
1270
  });
1271
1271
  return;
1272
1272
  }
1273
- Ft(n, e.ownNodes).then((e) => {
1273
+ Lt(n, e.ownNodes).then((e) => {
1274
1274
  console.info(`[levo-inspector] element capture ok <${n.tagName.toLowerCase()}> (${Math.round(e.length / 1024)}kB)`), i({
1275
1275
  type: "capture-result",
1276
1276
  requestId: t,
@@ -1328,12 +1328,12 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1328
1328
  return !0;
1329
1329
  }), s = o.length > En, c = [], l = [];
1330
1330
  for (let e of o.slice(0, En)) {
1331
- let t = Z(e);
1331
+ let t = Y(e);
1332
1332
  if (!t) continue;
1333
1333
  let n = (e.innerText || "").replace(/\s+/g, " ").trim().slice(0, 80);
1334
1334
  c.push({
1335
1335
  source: t,
1336
- index: Ht(e, t),
1336
+ index: Ut(e, t),
1337
1337
  tag: e.tagName.toLowerCase(),
1338
1338
  label: Yt(e),
1339
1339
  ...n ? { text: n } : {}
@@ -1346,10 +1346,10 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1346
1346
  };
1347
1347
  }, An = () => Array.from({ length: En }, () => {
1348
1348
  let e = document.createElement("div");
1349
- return e.style.cssText = `position:fixed;pointer-events:none;z-index:${Bt.ring};outline:1.5px solid ${X.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 3px ${X.selectGlow};display:none`, e;
1349
+ return e.style.cssText = `position:fixed;pointer-events:none;z-index:${q.ring};outline:1.5px solid ${J.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 3px ${J.selectGlow};display:none`, e;
1350
1350
  }), jn = () => {
1351
1351
  let e = document.createElement("div");
1352
- e.style.cssText = `position:fixed;pointer-events:none;z-index:${Bt.overlay};border:1.5px dashed ${X.select};background:${X.selectGlow};border-radius:2px;display:none`;
1352
+ e.style.cssText = `position:fixed;pointer-events:none;z-index:${q.overlay};border:1.5px dashed ${J.select};background:${J.selectGlow};border-radius:2px;display:none`;
1353
1353
  let t = null, n = !1, r = 0, i = 0, a = () => {
1354
1354
  e.style.display = "none";
1355
1355
  };
@@ -1396,7 +1396,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1396
1396
  let n = i();
1397
1397
  n.textContent !== t && (n.textContent = t);
1398
1398
  }, o = (e, r) => {
1399
- let i = Ut(r.source, r.index);
1399
+ let i = X(r.source, r.index);
1400
1400
  if (i) if (r.kind === "style") Wt(i, e);
1401
1401
  else if (r.kind === "image") t.captureOnce(`${r.source}#${r.index}:src`, i.getAttribute("src") ?? ""), t.captureOnce(`${r.source}#${r.index}:srcset`, i.getAttribute("srcset") ?? ""), i.getAttribute("src") !== r.value && i.setAttribute("src", r.value), i.hasAttribute("srcset") && i.removeAttribute("srcset");
1402
1402
  else {
@@ -1410,7 +1410,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1410
1410
  let n = r.get(e);
1411
1411
  if (!n) return;
1412
1412
  r.delete(e);
1413
- let i = Ut(n.source, n.index);
1413
+ let i = X(n.source, n.index);
1414
1414
  if (n.kind === "style") i && Gt(i, e), a();
1415
1415
  else if (n.kind === "image") {
1416
1416
  let e = t.restore(`${n.source}#${n.index}:src`), r = t.restore(`${n.source}#${n.index}:srcset`);
@@ -1459,15 +1459,15 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1459
1459
  n.selectNodeContents(e), n.collapse(!1), t.removeAllRanges(), t.addRange(n);
1460
1460
  }, d = (e, t = !1) => {
1461
1461
  if (i === e) return;
1462
- i && p(i), i = e, a = Z(e) || "", o = Ht(e, a), r(), n.capture(`${a}#${o}`, e.textContent ?? ""), e.setAttribute("contenteditable", s ? "plaintext-only" : "true");
1462
+ i && p(i), i = e, a = Y(e) || "", o = Ut(e, a), r(), n.capture(`${a}#${o}`, e.textContent ?? ""), e.setAttribute("contenteditable", s ? "plaintext-only" : "true");
1463
1463
  let d = e;
1464
- d.style.outline = `2px solid ${X.hover}`, d.style.outlineOffset = "3px", d.style.borderRadius = "3px", d.focus(), t && u(e), d.addEventListener("blur", c, !0), d.addEventListener("keydown", l, !0);
1464
+ d.style.outline = `2px solid ${J.hover}`, d.style.outlineOffset = "3px", d.style.borderRadius = "3px", d.focus(), t && u(e), d.addEventListener("blur", c, !0), d.addEventListener("keydown", l, !0);
1465
1465
  }, f = (e) => {
1466
1466
  e.removeAttribute("contenteditable");
1467
1467
  let t = e;
1468
1468
  t.style.outline = "", t.style.outlineOffset = "", t.style.borderRadius = "", t.removeEventListener("blur", c, !0), t.removeEventListener("keydown", l, !0), i = null;
1469
1469
  }, p = (e) => {
1470
- let r = Z(e), i = o, s = n.get(`${a}#${o}`);
1470
+ let r = Y(e), i = o, s = n.get(`${a}#${o}`);
1471
1471
  f(e);
1472
1472
  let c = (e.textContent ?? "").replace(/\s+/g, " ").trim();
1473
1473
  t.send({
@@ -1478,7 +1478,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1478
1478
  tag: e.tagName.toLowerCase(),
1479
1479
  value: c,
1480
1480
  previous: s,
1481
- occurrences: r ? Vt(r).length : 1
1481
+ occurrences: r ? Ht(r).length : 1
1482
1482
  }
1483
1483
  });
1484
1484
  }, m = (e) => {
@@ -1499,7 +1499,7 @@ var Ot = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1499
1499
  };
1500
1500
  }, Pn = "2026-07-24g · element-capture + region-drag + region-highlights (stale-region guard)";
1501
1501
  function Fn() {
1502
- return A(() => In(), []), null;
1502
+ return E(() => In(), []), null;
1503
1503
  }
1504
1504
  function In() {
1505
1505
  let e = !1, t = null, n = null, r = !1, i = null, a = Cn(), o = hn(), { overlay: s, label: c, ring: l, ringLabel: u } = Zt();
@@ -1535,7 +1535,7 @@ function In() {
1535
1535
  e && !b ? (b = document.createElement("style"), b.id = "studio-pick-cursor", b.textContent = "*,*::before,*::after{cursor:crosshair !important}", document.head.appendChild(b)) : !e && b && (b.remove(), b = null);
1536
1536
  }, S = (e) => !e || p.includes(e) || e === document.body || e === document.documentElement, C = (e) => {
1537
1537
  if (!e || S(e)) return null;
1538
- let t = Z(e) ? e : e.closest("[data-tsd-source]");
1538
+ let t = Y(e) ? e : e.closest("[data-tsd-source]");
1539
1539
  return !t || S(t) || !tn(t) ? null : t;
1540
1540
  }, w = (e) => Qt(s, c, e), T = () => {
1541
1541
  if (n) {
@@ -1583,23 +1583,23 @@ function In() {
1583
1583
  editingNode: L.editingNode
1584
1584
  }), z = () => {
1585
1585
  n?.isConnected || R.count() ? j() : M();
1586
- }, B = (n) => {
1587
- n && r && V(!1), e = !!n, x(e), e || (t = null, s.style.display = "none", c.style.display = "none", W()), o.send({
1586
+ }, ee = (n) => {
1587
+ n && r && te(!1), e = !!n, x(e), e || (t = null, s.style.display = "none", c.style.display = "none", H()), o.send({
1588
1588
  type: "inspect-state",
1589
1589
  enabled: e
1590
1590
  });
1591
- }, V = (t) => {
1591
+ }, te = (t) => {
1592
1592
  if (r = !!t, r) {
1593
- e && B(!1), l.style.display = "none", u.style.display = "none";
1593
+ e && ee(!1), l.style.display = "none", u.style.display = "none";
1594
1594
  for (let e of f) e.style.display = "none";
1595
1595
  } else L.commitIfEditing(), I(), document.documentElement.style.cursor = "", n && T(), m.length > 0 && _();
1596
1596
  o.send({
1597
1597
  type: "text-edit-state",
1598
1598
  enabled: r
1599
1599
  });
1600
- }, ee = 0, H = 0, te = 0, ne = () => {
1601
- ee = 0;
1602
- let n = document.elementFromPoint(H, te);
1600
+ }, B = 0, ne = 0, re = 0, ie = () => {
1601
+ B = 0;
1602
+ let n = document.elementFromPoint(ne, re);
1603
1603
  if (!S(n)) {
1604
1604
  if (r) {
1605
1605
  let e = C(n);
@@ -1612,47 +1612,47 @@ function In() {
1612
1612
  }
1613
1613
  e && (d.isDragging() || (t = n, n && w(n)));
1614
1614
  }
1615
- }, U = (t) => {
1616
- !e && !r || (H = t.clientX, te = t.clientY, ee ||= requestAnimationFrame(ne));
1617
- }, re = 0, ie = () => {
1618
- re = 0, e && t && w(t), r && !L.editingNode() && i?.isConnected && F(i), n && !r && T(), m.length > 0 && !r && _();
1619
- }, ae = () => {
1620
- re ||= requestAnimationFrame(ie);
1621
- }, oe = (n) => {
1615
+ }, ae = (t) => {
1616
+ !e && !r || (ne = t.clientX, re = t.clientY, B ||= requestAnimationFrame(ie));
1617
+ }, oe = 0, se = () => {
1618
+ oe = 0, e && t && w(t), r && !L.editingNode() && i?.isConnected && F(i), n && !r && T(), m.length > 0 && !r && _();
1619
+ }, ce = () => {
1620
+ oe ||= requestAnimationFrame(se);
1621
+ }, V = (n) => {
1622
1622
  n.relatedTarget || (e ? (t = null, s.style.display = "none", c.style.display = "none") : r && !L.editingNode() && (i = null, I(), document.documentElement.style.cursor = ""));
1623
- }, se = !1, ce = null, le = () => {
1624
- if (ce != null) {
1623
+ }, le = !1, ue = null, de = () => {
1624
+ if (ue != null) {
1625
1625
  try {
1626
- document.documentElement.releasePointerCapture(ce);
1626
+ document.documentElement.releasePointerCapture(ue);
1627
1627
  } catch {}
1628
- ce = null;
1628
+ ue = null;
1629
1629
  }
1630
- }, W = () => {
1631
- le(), d.cancel();
1632
- }, ue = (t) => {
1633
- !e || t.button !== 0 || !t.isPrimary || (se = !1, d.pointerDown(t.clientX, t.clientY));
1634
- }, G = (n) => {
1630
+ }, H = () => {
1631
+ de(), d.cancel();
1632
+ }, fe = (t) => {
1633
+ !e || t.button !== 0 || !t.isPrimary || (le = !1, d.pointerDown(t.clientX, t.clientY));
1634
+ }, pe = (n) => {
1635
1635
  if (!e || !n.isPrimary) return;
1636
1636
  let r = d.isDragging();
1637
1637
  if (d.pointerMove(n.clientX, n.clientY), d.isDragging()) {
1638
1638
  if (!r) {
1639
- ce = n.pointerId;
1639
+ ue = n.pointerId;
1640
1640
  try {
1641
1641
  document.documentElement.setPointerCapture(n.pointerId);
1642
1642
  } catch {}
1643
1643
  }
1644
1644
  t = null, s.style.display = "none", c.style.display = "none";
1645
1645
  }
1646
- }, de = (t) => {
1646
+ }, me = (t) => {
1647
1647
  if (!e || !t.isPrimary) return;
1648
- le();
1648
+ de();
1649
1649
  let n = d.pointerUp();
1650
1650
  if (!n) return;
1651
- se = !0, P();
1651
+ le = !0, P();
1652
1652
  let { elements: r, nodes: i, truncated: a } = kn(n, p);
1653
1653
  console.info(`[levo-inspector] region drag: ${Math.round(n.width)}×${Math.round(n.height)} — ${r.length} element(s)${a ? " (truncated)" : ""}`), v(i);
1654
1654
  let s = ++h;
1655
- zt(n, p).then((e) => {
1655
+ Vt(n, p).then((e) => {
1656
1656
  s === h && (console.info(`[levo-inspector] region capture ok (${Math.round(e.length / 1024)}kB)`), o.send({
1657
1657
  type: "region-selected",
1658
1658
  rect: n,
@@ -1669,25 +1669,25 @@ function In() {
1669
1669
  dataUrl: null
1670
1670
  }));
1671
1671
  });
1672
- }, fe = () => W(), K = (e) => {
1672
+ }, U = () => H(), he = (e) => {
1673
1673
  let t = $t(e.target);
1674
1674
  return t ? (e.preventDefault(), e.stopPropagation(), window.open(t, "_blank", "noopener,noreferrer"), !0) : !1;
1675
- }, pe = (i) => {
1676
- if (se) {
1677
- se = !1, i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1675
+ }, ge = (i) => {
1676
+ if (le) {
1677
+ le = !1, i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1678
1678
  return;
1679
1679
  }
1680
1680
  if (r) {
1681
1681
  let e = C(document.elementFromPoint(i.clientX, i.clientY) || i.target);
1682
1682
  if (!e || e === L.editingNode()) {
1683
- K(i);
1683
+ he(i);
1684
1684
  return;
1685
1685
  }
1686
1686
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation(), L.startEdit(e);
1687
1687
  return;
1688
1688
  }
1689
1689
  if (!e) {
1690
- K(i);
1690
+ he(i);
1691
1691
  return;
1692
1692
  }
1693
1693
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
@@ -1698,12 +1698,12 @@ function In() {
1698
1698
  type: "element-selected",
1699
1699
  element: an(s)
1700
1700
  });
1701
- }, me = Sn({
1701
+ }, _e = Sn({
1702
1702
  channel: o,
1703
1703
  originals: a,
1704
1704
  staged: R,
1705
- setInspect: B,
1706
- setTextEdit: V,
1705
+ setInspect: ee,
1706
+ setTextEdit: te,
1707
1707
  isInspecting: () => e,
1708
1708
  isTextEditing: () => r,
1709
1709
  editingNode: L.editingNode,
@@ -1719,7 +1719,7 @@ function In() {
1719
1719
  startEditAtEnd: (e) => L.startEdit(e, !0),
1720
1720
  editableTarget: C,
1721
1721
  ownNodes: p
1722
- }), he = [
1722
+ }), ve = [
1723
1723
  "mousedown",
1724
1724
  "mouseup",
1725
1725
  "dblclick",
@@ -1737,38 +1737,38 @@ function In() {
1737
1737
  "touchstart",
1738
1738
  "touchend",
1739
1739
  "submit"
1740
- ], ge = (t) => {
1740
+ ], ye = (t) => {
1741
1741
  e && (t.cancelable && t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation());
1742
- }, _e = () => {
1742
+ }, be = () => {
1743
1743
  n && !r && T(), m.length > 0 && !r && _();
1744
- }, ve = () => {
1744
+ }, xe = () => {
1745
1745
  let e = location.pathname.replace(/\/$/, "") || "/";
1746
1746
  o.send({
1747
1747
  type: "route",
1748
1748
  route: e
1749
1749
  });
1750
- }, ye = gn({ onPathChange: () => {
1751
- P(), ve();
1752
- } }), be = (t) => {
1750
+ }, Se = gn({ onPathChange: () => {
1751
+ P(), xe();
1752
+ } }), Ce = (t) => {
1753
1753
  if (L.editingNode()) return;
1754
1754
  if (t.key === "Escape") {
1755
1755
  if (e && d.isDragging()) {
1756
- t.stopPropagation(), W();
1756
+ t.stopPropagation(), H();
1757
1757
  return;
1758
1758
  }
1759
- r ? (t.stopPropagation(), V(!1)) : e && (t.stopPropagation(), B(!1));
1759
+ r ? (t.stopPropagation(), te(!1)) : e && (t.stopPropagation(), ee(!1));
1760
1760
  return;
1761
1761
  }
1762
1762
  if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || t.repeat || en(document.activeElement)) return;
1763
1763
  let n = t.key.toLowerCase();
1764
- n === "s" ? (t.preventDefault(), t.stopPropagation(), B(!e)) : n === "t" && (t.preventDefault(), t.stopPropagation(), V(!r));
1764
+ n === "s" ? (t.preventDefault(), t.stopPropagation(), ee(!e)) : n === "t" && (t.preventDefault(), t.stopPropagation(), te(!r));
1765
1765
  };
1766
- window.addEventListener("mousemove", U, !0), window.addEventListener("scroll", ae, !0), window.addEventListener("resize", _e), window.addEventListener("click", pe, !0), window.addEventListener("keydown", be, !0), window.addEventListener("message", me.onMessage), window.addEventListener("mouseout", oe, !0), window.addEventListener("pointerdown", ue, !0), window.addEventListener("pointermove", G, !0), window.addEventListener("pointerup", de, !0), window.addEventListener("pointercancel", fe, !0);
1767
- for (let e of he) window.addEventListener(e, ge, !0);
1768
- return console.info(`[levo-inspector] build ${Pn} — runtime mounted`), ve(), o.send({ type: "ready" }), () => {
1769
- window.removeEventListener("mousemove", U, !0), window.removeEventListener("keydown", be, !0), window.removeEventListener("scroll", ae, !0), window.removeEventListener("resize", _e), window.removeEventListener("mouseout", oe, !0), window.removeEventListener("pointerdown", ue, !0), window.removeEventListener("pointermove", G, !0), window.removeEventListener("pointerup", de, !0), window.removeEventListener("pointercancel", fe, !0), window.removeEventListener("click", pe, !0), window.removeEventListener("message", me.onMessage);
1770
- for (let e of he) window.removeEventListener(e, ge, !0);
1771
- O.disconnect(), k.disconnect(), E && cancelAnimationFrame(E), ee && cancelAnimationFrame(ee), re && cancelAnimationFrame(re), R.teardown(), ye.teardown(), L.teardown(), document.documentElement.style.cursor = "", b?.remove(), s.remove(), c.remove(), l.remove(), u.remove(), W(), d.node.remove();
1766
+ window.addEventListener("mousemove", ae, !0), window.addEventListener("scroll", ce, !0), window.addEventListener("resize", be), window.addEventListener("click", ge, !0), window.addEventListener("keydown", Ce, !0), window.addEventListener("message", _e.onMessage), window.addEventListener("mouseout", V, !0), window.addEventListener("pointerdown", fe, !0), window.addEventListener("pointermove", pe, !0), window.addEventListener("pointerup", me, !0), window.addEventListener("pointercancel", U, !0);
1767
+ for (let e of ve) window.addEventListener(e, ye, !0);
1768
+ return console.info(`[levo-inspector] build ${Pn} — runtime mounted`), xe(), o.send({ type: "ready" }), () => {
1769
+ window.removeEventListener("mousemove", ae, !0), window.removeEventListener("keydown", Ce, !0), window.removeEventListener("scroll", ce, !0), window.removeEventListener("resize", be), window.removeEventListener("mouseout", V, !0), window.removeEventListener("pointerdown", fe, !0), window.removeEventListener("pointermove", pe, !0), window.removeEventListener("pointerup", me, !0), window.removeEventListener("pointercancel", U, !0), window.removeEventListener("click", ge, !0), window.removeEventListener("message", _e.onMessage);
1770
+ for (let e of ve) window.removeEventListener(e, ye, !0);
1771
+ O.disconnect(), k.disconnect(), E && cancelAnimationFrame(E), B && cancelAnimationFrame(B), oe && cancelAnimationFrame(oe), R.teardown(), Se.teardown(), L.teardown(), document.documentElement.style.cursor = "", b?.remove(), s.remove(), c.remove(), l.remove(), u.remove(), H(), d.node.remove();
1772
1772
  for (let e of f) e.remove();
1773
1773
  };
1774
1774
  }
@@ -1777,11 +1777,11 @@ function In() {
1777
1777
  var Ln = "levo-made-with", Rn = `.${Ln}{opacity:.2;transition:opacity 150ms,transform 150ms}
1778
1778
  .${Ln}:hover,.${Ln}:focus-visible{opacity:1;transform:translateY(-2px)}`, zn = ({ slug: e }) => {
1779
1779
  let t = `utm_source=${encodeURIComponent(e || "website")}&utm_term=Made%20With%20Levo&utm_campaign=footer_branding&utm_medium=organic_footer_branding`;
1780
- return /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("style", {
1780
+ return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("style", {
1781
1781
  href: "levo-made-with",
1782
1782
  precedence: "default",
1783
1783
  children: Rn
1784
- }), /* @__PURE__ */ C("a", {
1784
+ }), /* @__PURE__ */ P("a", {
1785
1785
  className: Ln,
1786
1786
  href: `https://levo.so/?${t}`,
1787
1787
  target: "_blank",
@@ -1802,7 +1802,7 @@ var Ln = "levo-made-with", Rn = `.${Ln}{opacity:.2;transition:opacity 150ms,tran
1802
1802
  textDecoration: "none",
1803
1803
  boxShadow: "0 4px 12px rgb(0 0 0 / 0.25)"
1804
1804
  },
1805
- children: [/* @__PURE__ */ S("img", {
1805
+ children: [/* @__PURE__ */ N("img", {
1806
1806
  alt: "",
1807
1807
  src: "https://static.levocdn.com/WLZ1TXTD/Levo-Logo-moxa93IxlVi0W.webp",
1808
1808
  width: 20,
@@ -1817,53 +1817,53 @@ var Ln = "levo-made-with", Rn = `.${Ln}{opacity:.2;transition:opacity 150ms,tran
1817
1817
  if (typeof document > "u") return null;
1818
1818
  let e = document.querySelectorAll(`meta[name="${Bn}"]`);
1819
1819
  return e[e.length - 1]?.getAttribute("content")?.trim() || null;
1820
- }, Hn = D(() => import("./dist-6AIgW_iB.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), Un = ({ siteId: e, pageId: t }) => {
1821
- let n = J(), r = i();
1822
- return !n || !r ? null : /* @__PURE__ */ S(T, {
1820
+ }, Hn = C(() => import("./dist-_lwl0kZw.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), Un = ({ siteId: e, pageId: t }) => {
1821
+ let n = G(), r = i();
1822
+ return !n || !r ? null : /* @__PURE__ */ N(x, {
1823
1823
  fallback: null,
1824
- children: /* @__PURE__ */ S(Hn, {
1824
+ children: /* @__PURE__ */ N(Hn, {
1825
1825
  pageId: t,
1826
1826
  siteId: e
1827
1827
  })
1828
1828
  });
1829
- }, Wn = E(null), Gn = Wn.Provider, Kn = () => k(Wn), qn = () => i(), Jn = () => n(), Yn = ({ site: e, analytics: t = !0, children: n }) => {
1830
- let [i] = P(() => {
1829
+ }, Wn = S(null), Gn = Wn.Provider, Kn = () => T(Wn), qn = () => i(), Jn = () => n(), Yn = ({ site: e, analytics: t = !0, children: n }) => {
1830
+ let [i] = A(() => {
1831
1831
  if (!e) return null;
1832
- let n = Ee(e), r = Te(n);
1832
+ let n = Oe(e), r = De(n);
1833
1833
  return r ? {
1834
1834
  client: r,
1835
- insights: te(r, {
1835
+ insights: ne(r, {
1836
1836
  insightsUrl: t && n.insightsUrl || null,
1837
1837
  site: n.siteId || null
1838
1838
  }),
1839
1839
  site: e
1840
1840
  } : null;
1841
- }), [a, o] = P(null), s = H({ select: (e) => e.location.pathname }), c = xn();
1842
- return A(() => {
1841
+ }), [a, o] = A(null), s = B({ select: (e) => e.location.pathname }), c = xn();
1842
+ return E(() => {
1843
1843
  i && (window.levo_client = i.client, window.levo_insights = i.insights);
1844
- }, [i]), j(() => {
1844
+ }, [i]), D(() => {
1845
1845
  if (!i) return;
1846
1846
  let e = Vn();
1847
1847
  o(e), i.insights.init({ pageId: e });
1848
- }, [i, s]), i ? /* @__PURE__ */ C(r, {
1848
+ }, [i, s]), i ? /* @__PURE__ */ P(r, {
1849
1849
  client: i.client,
1850
1850
  insights: i.insights,
1851
1851
  children: [
1852
- /* @__PURE__ */ S(Gn, {
1852
+ /* @__PURE__ */ N(Gn, {
1853
1853
  value: i.site,
1854
1854
  children: n
1855
1855
  }),
1856
- !c && /* @__PURE__ */ S(vt, {
1856
+ !c && /* @__PURE__ */ N(bt, {
1857
1857
  site: i.site,
1858
1858
  path: s
1859
1859
  }),
1860
- /* @__PURE__ */ S(Un, {
1860
+ /* @__PURE__ */ N(Un, {
1861
1861
  pageId: a ?? void 0,
1862
1862
  siteId: i.site.id
1863
1863
  }),
1864
- !c && !!i.site.feature_flag?.branding && /* @__PURE__ */ S(zn, { slug: i.site.slug })
1864
+ !c && !!i.site.feature_flag?.branding && /* @__PURE__ */ N(zn, { slug: i.site.slug })
1865
1865
  ]
1866
- }) : /* @__PURE__ */ S(x, { children: n });
1866
+ }) : /* @__PURE__ */ N(M, { children: n });
1867
1867
  }, Xn = (e, t) => {
1868
1868
  let n = h(t);
1869
1869
  return ({ location: t }) => {
@@ -1875,7 +1875,7 @@ var Ln = "levo-made-with", Rn = `.${Ln}{opacity:.2;transition:opacity 150ms,tran
1875
1875
  cookie: typeof document > "u" ? null : document.cookie,
1876
1876
  hasRoute: n
1877
1877
  });
1878
- if (r.kind === "redirect" && r.path !== t.pathname) throw ee({
1878
+ if (r.kind === "redirect" && r.path !== t.pathname) throw te({
1879
1879
  search: !0,
1880
1880
  to: r.path
1881
1881
  });
@@ -1912,21 +1912,21 @@ var Ln = "levo-made-with", Rn = `.${Ln}{opacity:.2;transition:opacity 150ms,tran
1912
1912
  href: o
1913
1913
  }), s;
1914
1914
  }, er = ({ config: e, routeTree: t }) => {
1915
- let n = H({ select: (e) => e.location.pathname });
1915
+ let n = B({ select: (e) => e.location.pathname });
1916
1916
  if (!e.isLocalized || !e.origin) return null;
1917
1917
  let { neutralPath: r } = f(n, e.locales);
1918
- return /* @__PURE__ */ S(x, { children: $n({
1918
+ return /* @__PURE__ */ N(M, { children: $n({
1919
1919
  neutralPath: r,
1920
1920
  origin: e.origin,
1921
1921
  locales: e.locales,
1922
1922
  hasRoute: t ? h(t) : void 0
1923
- }).filter((e) => e.rel === "alternate").map((e) => /* @__PURE__ */ S("link", {
1923
+ }).filter((e) => e.rel === "alternate").map((e) => /* @__PURE__ */ N("link", {
1924
1924
  href: e.href,
1925
1925
  hrefLang: e.hrefLang,
1926
1926
  rel: e.rel
1927
1927
  }, e.hrefLang ?? e.href)) });
1928
- }, tr = E(void 0), nr = ({ children: e, locale: t, locales: n, defaultLocale: r, source: i = "default", hasRoute: a }) => {
1929
- let o = M(() => {
1928
+ }, tr = S(void 0), nr = ({ children: e, locale: t, locales: n, defaultLocale: r, source: i = "default", hasRoute: a }) => {
1929
+ let o = O(() => {
1930
1930
  let e = n?.length ? n : [t];
1931
1931
  return {
1932
1932
  locale: t,
@@ -1949,13 +1949,13 @@ var Ln = "levo-made-with", Rn = `.${Ln}{opacity:.2;transition:opacity 150ms,tran
1949
1949
  i,
1950
1950
  a
1951
1951
  ]);
1952
- return /* @__PURE__ */ S(tr.Provider, {
1952
+ return /* @__PURE__ */ N(tr.Provider, {
1953
1953
  value: o,
1954
1954
  children: e
1955
1955
  });
1956
1956
  };
1957
1957
  function rr() {
1958
- return k(tr) || {
1958
+ return T(tr) || {
1959
1959
  locale: "en",
1960
1960
  locales: ["en"],
1961
1961
  defaultLocale: "en",
@@ -1966,12 +1966,12 @@ function rr() {
1966
1966
  };
1967
1967
  }
1968
1968
  function ir(e) {
1969
- let { prefix: t } = f(H({ select: (e) => e.location.pathname }), e.locales);
1969
+ let { prefix: t } = f(B({ select: (e) => e.location.pathname }), e.locales);
1970
1970
  return t ?? e.defaultLocale;
1971
1971
  }
1972
1972
  var ar = ({ config: e, children: t, routeTree: n }) => {
1973
- let { prefix: r } = f(H({ select: (e) => e.location.pathname }), e.locales);
1974
- return /* @__PURE__ */ S(nr, {
1973
+ let { prefix: r } = f(B({ select: (e) => e.location.pathname }), e.locales);
1974
+ return /* @__PURE__ */ N(nr, {
1975
1975
  defaultLocale: e.defaultLocale,
1976
1976
  hasRoute: n ? h(n) : void 0,
1977
1977
  locale: r ?? e.defaultLocale,
@@ -1981,8 +1981,8 @@ var ar = ({ config: e, children: t, routeTree: n }) => {
1981
1981
  });
1982
1982
  };
1983
1983
  function or() {
1984
- let { locale: e, locales: t, isMultiLocale: n, setLocale: r, pathFor: i, hasRoute: a } = rr(), o = H({ select: (e) => e.location.pathname });
1985
- return M(() => {
1984
+ let { locale: e, locales: t, isMultiLocale: n, setLocale: r, pathFor: i, hasRoute: a } = rr(), o = B({ select: (e) => e.location.pathname });
1985
+ return O(() => {
1986
1986
  if (!n) return [];
1987
1987
  let { neutralPath: s } = f(o, t), c = t.filter((e) => !a || a(i(s, e)));
1988
1988
  return c.length < 2 ? [] : c.map((t) => ({
@@ -2100,10 +2100,10 @@ var sr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), cr = (e) => {
2100
2100
  };
2101
2101
  function dr({ meta: e, site: t }) {
2102
2102
  let n = ur(e, t);
2103
- return /* @__PURE__ */ C(x, { children: [
2104
- n.meta.map((e, t) => e.title === void 0 ? /* @__PURE__ */ S("meta", { ...e }, `m${t}`) : /* @__PURE__ */ S("title", { children: e.title }, `t${t}`)),
2105
- n.links.map((e, t) => /* @__PURE__ */ S("link", { ...e }, `l${t}`)),
2106
- n.scripts.map(({ children: e, ...t }, n) => e === void 0 ? /* @__PURE__ */ S("script", { ...t }, `s${n}`) : /* @__PURE__ */ S("script", {
2103
+ return /* @__PURE__ */ P(M, { children: [
2104
+ n.meta.map((e, t) => e.title === void 0 ? /* @__PURE__ */ N("meta", { ...e }, `m${t}`) : /* @__PURE__ */ N("title", { children: e.title }, `t${t}`)),
2105
+ n.links.map((e, t) => /* @__PURE__ */ N("link", { ...e }, `l${t}`)),
2106
+ n.scripts.map(({ children: e, ...t }, n) => e === void 0 ? /* @__PURE__ */ N("script", { ...t }, `s${n}`) : /* @__PURE__ */ N("script", {
2107
2107
  ...t,
2108
2108
  dangerouslySetInnerHTML: { __html: e }
2109
2109
  }, `s${n}`))
@@ -2111,843 +2111,853 @@ function dr({ meta: e, site: t }) {
2111
2111
  }
2112
2112
  //#endregion
2113
2113
  //#region src/registration/ui.tsx
2114
- var fr = (...e) => e.filter(Boolean).join(" "), Q = w.forwardRef(({ className: e, isLoading: t, loadingText: n, children: r, type: i = "button", ...a }, o) => /* @__PURE__ */ S("button", {
2115
- ref: o,
2116
- type: i,
2117
- className: fr("inline-flex items-center justify-center", e),
2118
- ...a,
2119
- children: t ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(ie, { className: fr("h-4 w-4 animate-spin", n ? "mr-2" : "") }), n] }) : r
2120
- }));
2121
- Q.displayName = "Btn";
2122
- //#endregion
2123
- //#region src/registration/AttendeeForm.tsx
2124
- var pr = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, registerLoading: i, onBack: a, submitLabel: o, showBusinessBilling: s = !0 }) => /* @__PURE__ */ C("form", {
2125
- onSubmit: r,
2126
- className: "flex flex-col gap-4",
2127
- children: [
2128
- /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
2129
- htmlFor: "name",
2130
- className: "font-medium text-sm",
2131
- children: "Name"
2132
- }), /* @__PURE__ */ S("input", {
2133
- className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
2134
- placeholder: "Name",
2135
- name: "name",
2136
- value: e.name,
2137
- onChange: t,
2138
- onBlur: n,
2139
- required: !0
2140
- })] }),
2141
- /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
2142
- htmlFor: "email",
2143
- className: "font-medium text-sm",
2144
- children: "Email"
2145
- }), /* @__PURE__ */ S("input", {
2146
- className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
2147
- placeholder: "Email",
2148
- name: "email",
2149
- value: e.email,
2150
- onChange: t,
2151
- onBlur: n,
2152
- type: "email",
2153
- required: !0
2154
- })] }),
2155
- s && /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
2156
- htmlFor: "is_business_purchase",
2157
- className: "flex items-center gap-2 text-sm",
2158
- children: [/* @__PURE__ */ S("input", {
2159
- type: "checkbox",
2160
- name: "is_business_purchase",
2161
- checked: e.is_business_purchase || !1,
2162
- onChange: t,
2163
- className: "rounded border-gray-300"
2164
- }), /* @__PURE__ */ S("span", {
2165
- className: "font-medium",
2166
- children: "Tax for Business"
2167
- })]
2168
- }), /* @__PURE__ */ S("p", {
2169
- className: "mt-1 text-gray-500 text-xs",
2170
- children: "Check this if you're purchasing for a business and need a tax-compliant invoice"
2171
- })] }),
2172
- s && e.is_business_purchase && /* @__PURE__ */ C(x, { children: [
2173
- /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
2174
- htmlFor: "business_name",
2175
- className: "font-medium text-sm",
2176
- children: ["Company Name ", /* @__PURE__ */ S("span", {
2177
- className: "text-red-500",
2178
- children: "*"
2179
- })]
2180
- }), /* @__PURE__ */ S("input", {
2181
- className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
2182
- placeholder: "Acme Corporation",
2183
- name: "billing_details.name",
2184
- value: e.billing_details?.name || "",
2185
- onChange: t,
2186
- onBlur: n,
2187
- required: e.is_business_purchase
2188
- })] }),
2189
- /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
2190
- htmlFor: "business_tax_id",
2191
- className: "font-medium text-sm",
2192
- children: ["Tax ID / GST Number ", /* @__PURE__ */ S("span", {
2193
- className: "text-red-500",
2194
- children: "*"
2195
- })]
2196
- }), /* @__PURE__ */ S("input", {
2197
- className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
2198
- placeholder: "GST123456789",
2199
- name: "billing_details.tax_id",
2200
- value: e.billing_details?.tax_id || "",
2201
- onChange: t,
2202
- onBlur: n,
2203
- required: e.is_business_purchase
2204
- })] }),
2205
- /* @__PURE__ */ C("div", { children: [
2206
- /* @__PURE__ */ C("p", {
2207
- className: "mb-1 font-medium text-sm",
2208
- children: ["Business Address ", /* @__PURE__ */ S("span", {
2209
- className: "text-red-500",
2210
- children: "*"
2211
- })]
2212
- }),
2213
- /* @__PURE__ */ S("input", {
2214
- className: "mb-2 w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
2215
- placeholder: "Street Address Line 1",
2216
- name: "billing_details.address.line1",
2217
- value: e.billing_details?.address?.line1 || "",
2218
- onChange: t,
2219
- onBlur: n,
2220
- required: e.is_business_purchase
2221
- }),
2222
- /* @__PURE__ */ S("input", {
2223
- className: "mb-2 w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
2224
- placeholder: "Street Address Line 2 (Optional)",
2225
- name: "billing_details.address.line2",
2226
- value: e.billing_details?.address?.line2 || "",
2227
- onChange: t,
2228
- onBlur: n
2229
- }),
2230
- /* @__PURE__ */ C("div", {
2231
- className: "grid grid-cols-2 gap-2",
2232
- children: [/* @__PURE__ */ S("input", {
2233
- className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
2234
- placeholder: "City",
2235
- name: "billing_details.address.city",
2236
- value: e.billing_details?.address?.city || "",
2237
- onChange: t,
2238
- onBlur: n,
2239
- required: e.is_business_purchase
2240
- }), /* @__PURE__ */ S("input", {
2241
- className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
2242
- placeholder: "State/Province",
2243
- name: "billing_details.address.state",
2244
- value: e.billing_details?.address?.state || "",
2245
- onChange: t,
2246
- onBlur: n,
2247
- required: e.is_business_purchase
2248
- })]
2249
- }),
2250
- /* @__PURE__ */ C("div", {
2251
- className: "mt-2 grid grid-cols-2 gap-2",
2252
- children: [/* @__PURE__ */ S("input", {
2253
- className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
2254
- placeholder: "Postal Code",
2255
- name: "billing_details.address.postal_code",
2256
- value: e.billing_details?.address?.postal_code || "",
2257
- onChange: t,
2258
- onBlur: n,
2259
- required: e.is_business_purchase
2260
- }), /* @__PURE__ */ S("input", {
2261
- className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
2262
- placeholder: "Country",
2263
- name: "billing_details.address.country",
2264
- value: e.billing_details?.address?.country || "",
2265
- onChange: t,
2266
- onBlur: n,
2267
- required: e.is_business_purchase
2268
- })]
2269
- })
2270
- ] })
2271
- ] }),
2272
- /* @__PURE__ */ C("div", {
2273
- className: "flex flex-col-reverse justify-end gap-4 md:flex-row",
2274
- children: [/* @__PURE__ */ S(Q, {
2275
- className: "rounded-lg bg-gray-100 px-6 py-2 font-semibold text-black hover:bg-gray-200",
2276
- type: "button",
2277
- onClick: a,
2278
- disabled: i,
2279
- children: "Back"
2280
- }), /* @__PURE__ */ S(Q, {
2281
- className: "rounded-lg bg-brand px-6 py-2 font-semibold text-brand-foreground hover:opacity-90",
2282
- type: "submit",
2283
- isLoading: i,
2284
- loadingText: "Submitting...",
2285
- children: o
2286
- })]
2114
+ var Z = (...e) => e.filter(Boolean).join(" "), fr = ({ open: e, className: t, children: n }) => /* @__PURE__ */ N("div", {
2115
+ inert: !e,
2116
+ className: Z("grid transition-[grid-template-rows,opacity] duration-250 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none", e ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"),
2117
+ children: /* @__PURE__ */ N("div", {
2118
+ className: "overflow-hidden",
2119
+ children: /* @__PURE__ */ N("div", {
2120
+ className: t,
2121
+ children: n
2287
2122
  })
2288
- ]
2289
- }), mr = {
2123
+ })
2124
+ }), pr = [
2125
+ {
2126
+ key: "email",
2127
+ label: "Email",
2128
+ placeholder: "ada@example.com",
2129
+ type: "email",
2130
+ inputMode: "email",
2131
+ autoComplete: "email"
2132
+ },
2133
+ {
2134
+ key: "mobile",
2135
+ label: "Phone number",
2136
+ placeholder: "98765 43210",
2137
+ type: "tel",
2138
+ inputMode: "tel",
2139
+ autoComplete: "tel"
2140
+ },
2141
+ {
2142
+ key: "organization",
2143
+ label: "Organization",
2144
+ placeholder: "Acme Corporation",
2145
+ type: "text",
2146
+ inputMode: void 0,
2147
+ autoComplete: "organization"
2148
+ },
2149
+ {
2150
+ key: "designation",
2151
+ label: "Designation",
2152
+ placeholder: "Product Manager",
2153
+ type: "text",
2154
+ inputMode: void 0,
2155
+ autoComplete: "organization-title"
2156
+ }
2157
+ ], mr = [{
2158
+ key: "name",
2159
+ label: "Registered company name",
2160
+ placeholder: "Acme Corporation",
2161
+ autoComplete: "organization"
2162
+ }, {
2163
+ key: "tax_id",
2164
+ label: "Tax ID / GST number",
2165
+ placeholder: "22AAAAA0000A1Z5",
2166
+ autoComplete: "off"
2167
+ }], hr = [
2168
+ {
2169
+ key: "line1",
2170
+ label: "Billing address",
2171
+ placeholder: "Street address",
2172
+ autoComplete: "address-line1",
2173
+ wide: !0,
2174
+ optional: !1
2175
+ },
2176
+ {
2177
+ key: "line2",
2178
+ label: "Apartment, suite, floor",
2179
+ placeholder: "Optional",
2180
+ autoComplete: "address-line2",
2181
+ wide: !0,
2182
+ optional: !0
2183
+ },
2184
+ {
2185
+ key: "city",
2186
+ label: "City",
2187
+ placeholder: "Bengaluru",
2188
+ autoComplete: "address-level2",
2189
+ wide: !1,
2190
+ optional: !1
2191
+ },
2192
+ {
2193
+ key: "state",
2194
+ label: "State",
2195
+ placeholder: "Karnataka",
2196
+ autoComplete: "address-level1",
2197
+ wide: !1,
2198
+ optional: !1
2199
+ },
2200
+ {
2201
+ key: "postal_code",
2202
+ label: "Postal code",
2203
+ placeholder: "560001",
2204
+ autoComplete: "postal-code",
2205
+ wide: !1,
2206
+ optional: !1
2207
+ },
2208
+ {
2209
+ key: "country",
2210
+ label: "Country",
2211
+ placeholder: "India",
2212
+ autoComplete: "country-name",
2213
+ wide: !1,
2214
+ optional: !1
2215
+ }
2216
+ ], gr = (e) => Z("w-full rounded-xl border bg-page px-3.5 py-2.5 text-base text-ink outline-none transition placeholder:text-ink-muted/60", e ? "border-danger focus:ring-[3px] focus:ring-danger/15" : "border-border focus:border-brand focus:ring-[3px] focus:ring-brand/20"), _r = "flex items-baseline gap-1.5 font-medium text-ink text-sm", vr = () => /* @__PURE__ */ N("span", {
2217
+ "aria-hidden": !0,
2218
+ className: "text-danger",
2219
+ children: "*"
2220
+ }), yr = ({ values: e, errors: t, touched: n, onChange: r, onBlur: i, showBusinessBilling: a = !1, registrationFields: o, nameInputRef: s }) => {
2221
+ let c = (t, n) => r("billing_details", {
2222
+ ...e.billing_details,
2223
+ [t]: n
2224
+ }), l = (t, n) => r("billing_details", {
2225
+ ...e.billing_details,
2226
+ address: {
2227
+ ...e.billing_details.address,
2228
+ [t]: n
2229
+ }
2230
+ }), u = !!e.billing_details.name.trim() || !!e.billing_details.tax_id.trim() || Object.values(e.billing_details.address).some((e) => !!e.trim());
2231
+ return /* @__PURE__ */ P("div", {
2232
+ className: "flex flex-col gap-4",
2233
+ children: [
2234
+ /* @__PURE__ */ P("div", {
2235
+ className: "flex flex-col gap-1.5",
2236
+ children: [
2237
+ /* @__PURE__ */ P("label", {
2238
+ htmlFor: "attendee-name",
2239
+ className: _r,
2240
+ children: ["Your name", /* @__PURE__ */ N(vr, {})]
2241
+ }),
2242
+ /* @__PURE__ */ N("input", {
2243
+ ref: s,
2244
+ id: "attendee-name",
2245
+ name: "name",
2246
+ type: "text",
2247
+ autoComplete: "name",
2248
+ placeholder: "Ada Lovelace",
2249
+ value: e.name,
2250
+ onChange: (e) => r("name", e.target.value),
2251
+ onBlur: () => i("name"),
2252
+ className: gr(n.name && !!t.name),
2253
+ required: !0
2254
+ }),
2255
+ n.name && t.name && /* @__PURE__ */ N("p", {
2256
+ className: "m-0 text-danger text-xs",
2257
+ children: t.name
2258
+ })
2259
+ ]
2260
+ }),
2261
+ pr.map((a) => {
2262
+ let s = o[a.key];
2263
+ if (s === "off") return null;
2264
+ let c = n[a.key] ? t[a.key] : void 0, l = a.key === "email" || a.key === "mobile";
2265
+ return /* @__PURE__ */ P("div", {
2266
+ className: "flex flex-col gap-1.5",
2267
+ children: [
2268
+ /* @__PURE__ */ P("label", {
2269
+ htmlFor: `attendee-${a.key}`,
2270
+ className: _r,
2271
+ children: [a.label, s === "required" ? /* @__PURE__ */ N(vr, {}) : /* @__PURE__ */ N("span", {
2272
+ className: "font-normal text-ink-muted text-xs",
2273
+ children: "Optional"
2274
+ })]
2275
+ }),
2276
+ /* @__PURE__ */ N("input", {
2277
+ id: `attendee-${a.key}`,
2278
+ name: a.key,
2279
+ type: a.type,
2280
+ inputMode: a.inputMode,
2281
+ autoComplete: a.autoComplete,
2282
+ autoCapitalize: l ? "none" : void 0,
2283
+ autoCorrect: l ? "off" : void 0,
2284
+ spellCheck: l ? !1 : void 0,
2285
+ placeholder: a.placeholder,
2286
+ value: e[a.key],
2287
+ onChange: (e) => r(a.key, e.target.value),
2288
+ onBlur: () => i(a.key),
2289
+ className: gr(!!c),
2290
+ required: s === "required"
2291
+ }),
2292
+ c && /* @__PURE__ */ N("p", {
2293
+ className: "m-0 text-danger text-xs",
2294
+ children: c
2295
+ })
2296
+ ]
2297
+ }, a.key);
2298
+ }),
2299
+ a && /* @__PURE__ */ P("div", {
2300
+ className: "rounded-xl border border-border bg-ink/3",
2301
+ children: [
2302
+ /* @__PURE__ */ P("label", {
2303
+ htmlFor: "is_business_purchase",
2304
+ className: "flex w-full cursor-pointer items-center gap-2.5 px-3.5 py-3 text-ink text-sm",
2305
+ children: [/* @__PURE__ */ N("input", {
2306
+ id: "is_business_purchase",
2307
+ type: "checkbox",
2308
+ checked: e.is_business_purchase,
2309
+ onChange: (e) => r("is_business_purchase", e.target.checked),
2310
+ "aria-expanded": e.is_business_purchase,
2311
+ className: "size-4 shrink-0 cursor-pointer rounded accent-brand"
2312
+ }), "Bill this to a business — I need a GST invoice"]
2313
+ }),
2314
+ !e.is_business_purchase && u && /* @__PURE__ */ N("p", {
2315
+ className: "m-0 px-3.5 pb-3 text-amber-700 text-xs leading-relaxed starting:opacity-0 transition-opacity duration-200 dark:text-amber-400",
2316
+ children: "Your billing details are still saved — tick the box to apply them."
2317
+ }),
2318
+ /* @__PURE__ */ N(fr, {
2319
+ open: e.is_business_purchase,
2320
+ className: "px-3.5 pb-3.5",
2321
+ children: /* @__PURE__ */ P("div", {
2322
+ className: "flex flex-col gap-3",
2323
+ children: [
2324
+ /* @__PURE__ */ N("p", {
2325
+ className: "m-0 text-ink-muted text-xs leading-relaxed",
2326
+ children: "This booking will be billed to your business. The invoice is raised against the details below."
2327
+ }),
2328
+ mr.map((t) => /* @__PURE__ */ P("div", {
2329
+ className: "flex flex-col gap-1.5",
2330
+ children: [/* @__PURE__ */ P("label", {
2331
+ htmlFor: `billing-${t.key}`,
2332
+ className: _r,
2333
+ children: [t.label, /* @__PURE__ */ N(vr, {})]
2334
+ }), /* @__PURE__ */ N("input", {
2335
+ id: `billing-${t.key}`,
2336
+ className: gr(),
2337
+ placeholder: t.placeholder,
2338
+ autoComplete: t.autoComplete,
2339
+ value: e.billing_details[t.key],
2340
+ onChange: (e) => c(t.key, e.target.value),
2341
+ required: e.is_business_purchase
2342
+ })]
2343
+ }, t.key)),
2344
+ /* @__PURE__ */ N("div", {
2345
+ className: "grid grid-cols-2 gap-3",
2346
+ children: hr.map((t) => /* @__PURE__ */ P("div", {
2347
+ className: Z("flex flex-col gap-1.5", t.wide && "col-span-2"),
2348
+ children: [/* @__PURE__ */ P("label", {
2349
+ htmlFor: `billing-${t.key}`,
2350
+ className: _r,
2351
+ children: [t.label, !t.optional && /* @__PURE__ */ N(vr, {})]
2352
+ }), /* @__PURE__ */ N("input", {
2353
+ id: `billing-${t.key}`,
2354
+ className: gr(),
2355
+ placeholder: t.placeholder,
2356
+ autoComplete: t.autoComplete,
2357
+ inputMode: t.key === "postal_code" ? "numeric" : void 0,
2358
+ value: e.billing_details.address[t.key],
2359
+ onChange: (e) => l(t.key, e.target.value),
2360
+ required: e.is_business_purchase && !t.optional
2361
+ })]
2362
+ }, t.key))
2363
+ })
2364
+ ]
2365
+ })
2366
+ })
2367
+ ]
2368
+ })
2369
+ ]
2370
+ });
2371
+ }, br = {
2290
2372
  USD: "$",
2291
2373
  EUR: "€",
2292
2374
  GBP: "£",
2293
2375
  INR: "₹"
2294
- }, $ = (e) => e?.unit_amount ? `${mr[e.currency ?? "INR"]} ${(e.unit_amount ?? 0) / 100}` : "Free", hr = (e) => {
2376
+ }, Q = (e) => {
2377
+ let t = e?.unit_amount;
2378
+ if (t == null) return "";
2379
+ if (t === 0) return "Free";
2380
+ let n = e?.currency || "INR", r = t / 100;
2381
+ try {
2382
+ return new Intl.NumberFormat(void 0, {
2383
+ style: "currency",
2384
+ currency: n,
2385
+ minimumFractionDigits: t % 100 == 0 ? 0 : 2,
2386
+ maximumFractionDigits: 2
2387
+ }).format(r);
2388
+ } catch {
2389
+ return `${br[n] ?? n} ${r.toLocaleString()}`;
2390
+ }
2391
+ }, xr = (e) => !e.tax_enabled || !e.taxes?.length ? null : e.tax_inclusive ? "incl. taxes" : "+ taxes", Sr = (e) => !!e?.taxes?.length && e.tax_amount !== void 0, Cr = (e) => !!e && "subtotal" in e && e.tax_enabled === !0 && !!e.taxes?.length, wr = (e, t) => t ? t.total_amount ?? t.sale_amount ?? 0 : Cr(e) ? e.total ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Tr = (e, t) => {
2295
2392
  if (!e) return null;
2296
- let t = e.tax_enabled ?? !1, n = e.tax_inclusive ?? !1, r = e.taxes ?? [];
2297
- return !t || r.length === 0 ? null : n ? "(inclusive of taxes)" : "+ taxes";
2298
- }, gr = (e) => !!(e?.taxes && e.taxes.length > 0 && e.tax_amount !== void 0), _r = (e) => {
2299
- if (!e) return !1;
2300
- let t = e;
2301
- return t.tax_enabled === !0 && t.taxes !== void 0 && t.taxes.length > 0 && t.subtotal !== void 0;
2302
- }, vr = (e, t) => t ? t.total_amount ?? t.sale_amount ?? 0 : _r(e) ? e.total ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, yr = (e, t) => !t || e.tickets.length === 0 ? !0 : e.tickets.some((e) => typeof e == "string" ? e === t : e._id === t), br = ({ couponCode: e, onCouponCodeChange: t, couponError: n, couponLoading: r, onValidateCoupon: i, publicCoupons: a, onBack: o, selectedTicket: s }) => {
2303
- let c = [...a].sort((e, t) => {
2304
- let n = yr(e, s?._id), r = yr(t, s?._id);
2305
- return n && !r ? -1 : !n && r ? 1 : 0;
2306
- });
2307
- return /* @__PURE__ */ C("div", { children: [
2308
- /* @__PURE__ */ C("div", {
2309
- className: "flex items-center justify-between text-center",
2310
- children: [
2311
- /* @__PURE__ */ S("button", {
2312
- type: "button",
2313
- className: "rounded-md p-2 hover:bg-gray-50 focus:outline-none",
2314
- "aria-label": "Back",
2315
- onClick: o,
2316
- children: /* @__PURE__ */ S(U, { className: "size-4" })
2317
- }),
2318
- /* @__PURE__ */ C("p", {
2319
- className: "font-semibold text-md",
2320
- children: ["Apply Coupon for ", s?.title]
2321
- }),
2322
- /* @__PURE__ */ S("div", { className: "w-4" })
2323
- ]
2324
- }),
2325
- /* @__PURE__ */ C("div", {
2326
- className: "mt-2 flex gap-4",
2327
- children: [/* @__PURE__ */ C("div", {
2328
- className: "w-full",
2329
- children: [/* @__PURE__ */ S("input", {
2330
- className: "w-full rounded border border-gray-300 px-3 py-2 focus:border-brand focus:outline-none",
2331
- type: "text",
2332
- placeholder: "Enter Coupon Code",
2333
- value: e,
2334
- onChange: (e) => t(e.target.value)
2335
- }), n && /* @__PURE__ */ S("p", {
2336
- className: "mt-1 text-red-400 text-xs",
2337
- children: n
2338
- })]
2339
- }), /* @__PURE__ */ S(Q, {
2340
- "aria-label": "Apply Coupon",
2341
- onClick: () => i(),
2342
- className: "rounded-lg bg-brand px-3 text-brand-foreground hover:opacity-90",
2343
- style: {
2344
- marginLeft: e ? "0" : "-4rem",
2345
- zIndex: e ? 1 : -1
2346
- },
2347
- isLoading: r,
2348
- children: /* @__PURE__ */ S(ne, { className: "h-fit" })
2393
+ let n = wr(e, t);
2394
+ return {
2395
+ amount: n,
2396
+ currency: e.currency,
2397
+ isFree: n === 0
2398
+ };
2399
+ }, Er = (e, t) => t ? t.base_amount ?? 0 : Cr(e) ? e.subtotal ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Dr = (e, t) => Sr(t) ? t.taxes : !t && Cr(e) ? e.taxes : [], Or = (e, t) => !t || e.tickets.length === 0 ? !0 : e.tickets.some((e) => typeof e == "string" ? e === t : e._id === t), kr = (e) => e.kind === "percent" ? `${e.percent_off}% off` : `${br[e.currency ?? "INR"] ?? ""}${(e.amount_off ?? 0) / 100} off`, Ar = ({ couponCode: e, onCouponCodeChange: t, couponError: n, couponLoading: r, onValidateCoupon: i, onRemoveCoupon: a, publicCoupons: o, discount: s, selectedTicket: c }) => {
2400
+ let [l, u] = A(!1);
2401
+ if (s) return /* @__PURE__ */ P("div", {
2402
+ className: "flex starting:scale-95 items-center justify-between gap-2.5 rounded-xl border border-emerald-600/40 bg-emerald-500/10 px-3.5 py-2.5 text-[13px] text-emerald-800 starting:opacity-0 transition-[opacity,scale] duration-200 ease-out dark:bg-emerald-500/15 dark:text-emerald-300",
2403
+ children: [/* @__PURE__ */ P("span", {
2404
+ className: "min-w-0",
2405
+ children: [/* @__PURE__ */ N("span", {
2406
+ className: "font-semibold tracking-wide",
2407
+ children: e
2408
+ }), /* @__PURE__ */ P("span", {
2409
+ className: "ml-2 text-emerald-700 dark:text-emerald-400",
2410
+ children: [
2411
+ "saves",
2412
+ " ",
2413
+ Q({
2414
+ unit_amount: s.discount,
2415
+ currency: c?.currency
2416
+ })
2417
+ ]
2349
2418
  })]
2350
- }),
2351
- c.length > 0 && /* @__PURE__ */ C("div", {
2352
- className: "mt-4 flex flex-col gap-4",
2353
- children: [c.filter((e) => yr(e, s?._id)).length > 0 && /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
2354
- className: "mb-2 text-gray-600 text-sm",
2355
- children: "Available Coupons"
2356
- }), /* @__PURE__ */ S("div", {
2357
- className: "flex flex-col gap-2",
2358
- children: c.filter((e) => yr(e, s?._id)).map((e) => /* @__PURE__ */ C("button", {
2359
- type: "button",
2360
- className: "flex flex-col gap-1 rounded-md border border-gray-300 border-dashed px-3 py-2 text-left transition hover:border-gray-400 hover:bg-gray-50",
2361
- onClick: () => {
2362
- i(e.code), t(e.code);
2363
- },
2364
- children: [/* @__PURE__ */ C("div", {
2365
- className: "flex w-full items-center justify-between",
2366
- children: [/* @__PURE__ */ S("span", {
2367
- className: "font-medium",
2368
- children: e.code
2369
- }), /* @__PURE__ */ S("span", {
2370
- className: "text-gray-500 text-sm",
2371
- children: e.kind === "percent" ? `${e.percent_off}% off` : `${mr[e.currency ?? "INR"]} ${(e.amount_off ?? 0) / 100} off`
2372
- })]
2373
- }), e.description && /* @__PURE__ */ S("span", {
2374
- className: "text-gray-500 text-xs",
2375
- children: e.description
2376
- })]
2377
- }, e._id))
2378
- })] }), c.filter((e) => !yr(e, s?._id)).length > 0 && /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
2379
- className: "mb-2 text-gray-400 text-sm",
2380
- children: "Not Applicable"
2381
- }), /* @__PURE__ */ S("div", {
2382
- className: "flex flex-col gap-2",
2383
- children: c.filter((e) => !yr(e, s?._id)).map((e) => /* @__PURE__ */ C("button", {
2384
- type: "button",
2385
- disabled: !0,
2386
- className: "flex cursor-not-allowed flex-col gap-1 rounded-md border border-gray-200 border-dashed px-3 py-2 text-left opacity-50",
2387
- children: [/* @__PURE__ */ C("div", {
2388
- className: "flex w-full items-center justify-between",
2389
- children: [/* @__PURE__ */ S("span", {
2390
- className: "font-medium",
2391
- children: e.code
2392
- }), /* @__PURE__ */ S("span", {
2393
- className: "text-gray-500 text-sm",
2394
- children: e.kind === "percent" ? `${e.percent_off}% off` : `${mr[e.currency ?? "INR"]} ${(e.amount_off ?? 0) / 100} off`
2419
+ }), /* @__PURE__ */ N("button", {
2420
+ type: "button",
2421
+ onClick: () => {
2422
+ a(), u(!1);
2423
+ },
2424
+ "aria-label": "Remove coupon",
2425
+ className: "inline-flex shrink-0 rounded-md p-1 hover:bg-emerald-600/15",
2426
+ children: /* @__PURE__ */ N(ce, { className: "size-4" })
2427
+ })]
2428
+ });
2429
+ let d = o.filter((e) => Or(e, c?._id));
2430
+ return /* @__PURE__ */ P("div", {
2431
+ className: "flex flex-col",
2432
+ children: [/* @__PURE__ */ N("button", {
2433
+ type: "button",
2434
+ "aria-expanded": l,
2435
+ onClick: () => u((e) => !e),
2436
+ className: "self-start text-[13px] text-ink-soft underline underline-offset-[3px] hover:text-ink",
2437
+ children: "Have a code?"
2438
+ }), /* @__PURE__ */ N(fr, {
2439
+ open: l,
2440
+ children: /* @__PURE__ */ P("div", {
2441
+ className: "flex flex-col gap-2 pt-2",
2442
+ children: [
2443
+ /* @__PURE__ */ P("div", {
2444
+ className: "flex gap-2",
2445
+ children: [/* @__PURE__ */ N("input", {
2446
+ type: "text",
2447
+ value: e,
2448
+ placeholder: "Coupon code",
2449
+ "aria-label": "Coupon code",
2450
+ autoCapitalize: "characters",
2451
+ autoCorrect: "off",
2452
+ spellCheck: !1,
2453
+ onChange: (e) => t(e.target.value),
2454
+ onKeyDown: (t) => {
2455
+ t.key === "Enter" && (t.preventDefault(), e.trim() && i());
2456
+ },
2457
+ className: Z("w-full min-w-0 rounded-xl border bg-page px-3.5 py-2.5 text-base text-ink uppercase outline-none transition placeholder:text-ink-muted/60 placeholder:normal-case", n ? "border-danger focus:ring-[3px] focus:ring-danger/15" : "border-border focus:border-brand focus:ring-[3px] focus:ring-brand/20")
2458
+ }), /* @__PURE__ */ P("button", {
2459
+ type: "button",
2460
+ disabled: !e.trim() || r,
2461
+ onClick: () => i(),
2462
+ className: "inline-flex shrink-0 items-center gap-1.5 rounded-xl border border-border px-4 font-medium text-ink text-sm transition hover:border-brand disabled:opacity-50",
2463
+ children: [r && /* @__PURE__ */ N(se, { className: "size-3.5 animate-spin" }), "Apply"]
2395
2464
  })]
2396
- }), e.description && /* @__PURE__ */ S("span", {
2397
- className: "text-gray-500 text-xs",
2398
- children: e.description
2399
- })]
2400
- }, e._id))
2401
- })] })]
2402
- })
2403
- ] });
2404
- }, xr = (e) => {
2405
- let t = new Date(e);
2406
- return `${new Intl.DateTimeFormat("en-GB", {
2465
+ }),
2466
+ n && /* @__PURE__ */ N("p", {
2467
+ className: "m-0 text-danger text-xs",
2468
+ children: n
2469
+ }),
2470
+ d.length > 0 && /* @__PURE__ */ N("div", {
2471
+ className: "flex flex-wrap gap-1.5",
2472
+ children: d.map((e) => /* @__PURE__ */ P("button", {
2473
+ type: "button",
2474
+ onClick: () => {
2475
+ t(e.code), i(e.code);
2476
+ },
2477
+ title: e.description || void 0,
2478
+ className: "rounded-full border border-border border-dashed px-2.5 py-1 text-[12.5px] text-ink-soft transition hover:border-brand hover:text-ink",
2479
+ children: [
2480
+ e.code,
2481
+ " · ",
2482
+ kr(e)
2483
+ ]
2484
+ }, e._id))
2485
+ })
2486
+ ]
2487
+ })
2488
+ })]
2489
+ });
2490
+ }, jr = (e) => {
2491
+ if (e < 60) return `${e} min`;
2492
+ let t = Math.floor(e / 60), n = e % 60, r = `${t} hr`;
2493
+ return n ? `${r} ${n} min` : r;
2494
+ }, Mr = (e, t) => {
2495
+ if (!e) return null;
2496
+ let n = new Date(e);
2497
+ if (Number.isNaN(n.getTime())) return null;
2498
+ let r = new Intl.DateTimeFormat(void 0, {
2499
+ weekday: "short",
2407
2500
  day: "numeric",
2408
- month: "long",
2409
- year: "numeric"
2410
- }).format(t)}, ${new Intl.DateTimeFormat("en-US", {
2501
+ month: "short"
2502
+ }).format(n), i = new Intl.DateTimeFormat(void 0, {
2411
2503
  hour: "numeric",
2412
2504
  minute: "2-digit",
2413
2505
  hour12: !0
2414
- }).format(t)}`;
2415
- }, Sr = ({ ticketData: e, paymentData: t, type: n }) => {
2416
- let [r, i] = P(!0), a = (t.total_amount || t.unit_amount) / 100, o = t.unit_amount === 0, s = (e) => new Intl.NumberFormat("en-IN", {
2417
- style: "currency",
2418
- currency: t.currency || "INR",
2419
- minimumFractionDigits: 0
2420
- }).format(e);
2421
- return /* @__PURE__ */ S(I.Root, {
2422
- open: r,
2423
- onOpenChange: (e) => i(e),
2424
- children: /* @__PURE__ */ C(I.Portal, { children: [/* @__PURE__ */ S(I.Backdrop, { className: "fixed inset-0 z-50 bg-black/50" }), /* @__PURE__ */ C(I.Popup, {
2425
- className: "fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100vh-2rem)] w-full max-w-md -translate-x-1/2 -translate-y-1/2 flex-col overflow-y-auto rounded-2xl bg-white shadow-2xl",
2506
+ }).format(n), a = null;
2507
+ if (t) {
2508
+ let e = new Date(t), r = Math.round((e.getTime() - n.getTime()) / 6e4);
2509
+ !Number.isNaN(r) && r > 0 && (a = jr(r));
2510
+ }
2511
+ return {
2512
+ day: r,
2513
+ time: i,
2514
+ duration: a
2515
+ };
2516
+ }, Nr = 60, Pr = (e) => e.toISOString().replace(/[-:]/g, "").replace(/\.\d+/, ""), Fr = (e) => {
2517
+ if (!e.startsAt) return null;
2518
+ let t = new Date(e.startsAt);
2519
+ if (Number.isNaN(t.getTime())) return null;
2520
+ let n = e.endsAt ? new Date(e.endsAt) : null;
2521
+ return {
2522
+ start: t,
2523
+ end: n && !Number.isNaN(n.getTime()) && n > t ? n : new Date(t.getTime() + Nr * 6e4)
2524
+ };
2525
+ }, Ir = (e) => {
2526
+ let t = Fr(e);
2527
+ if (!t) return null;
2528
+ let n = Pr(t.start), r = Pr(t.end), i = [e.description, e.url].filter(Boolean).join("\n\n"), a = `https://calendar.google.com/calendar/render?${new URLSearchParams({
2529
+ action: "TEMPLATE",
2530
+ text: e.title,
2531
+ dates: `${n}/${r}`,
2532
+ details: i,
2533
+ location: e.url || ""
2534
+ }).toString()}`, o = `https://outlook.live.com/calendar/0/deeplink/compose?${new URLSearchParams({
2535
+ path: "/calendar/action/compose",
2536
+ rru: "addevent",
2537
+ subject: e.title,
2538
+ startdt: t.start.toISOString(),
2539
+ enddt: t.end.toISOString(),
2540
+ body: i,
2541
+ location: e.url || ""
2542
+ }).toString()}`, s = (e) => e.replace(/([,;\\])/g, "\\$1").replace(/\n/g, "\\n");
2543
+ return {
2544
+ google: a,
2545
+ outlook: o,
2546
+ ics: [
2547
+ "BEGIN:VCALENDAR",
2548
+ "VERSION:2.0",
2549
+ "PRODID:-//Levo//Event Registration//EN",
2550
+ "BEGIN:VEVENT",
2551
+ `UID:${n}-${encodeURIComponent(e.title)}@levo`,
2552
+ `DTSTAMP:${n}`,
2553
+ `DTSTART:${n}`,
2554
+ `DTEND:${r}`,
2555
+ `SUMMARY:${s(e.title)}`,
2556
+ i ? `DESCRIPTION:${s(i)}` : "",
2557
+ e.url ? `LOCATION:${s(e.url)}` : "",
2558
+ "END:VEVENT",
2559
+ "END:VCALENDAR"
2560
+ ].filter(Boolean).join("\r\n")
2561
+ };
2562
+ }, Lr = ({ selectedTicket: e, discount: t }) => {
2563
+ let [n, r] = A(!1), i = e?.currency, a = wr(e, t), o = Er(e, t), s = Dr(e, t), c = t?.discount ?? 0, l = s.length > 0 || c > 0 || o !== a, u = /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ P("span", {
2564
+ className: "inline-flex items-center gap-1.5",
2565
+ children: ["Total", l && /* @__PURE__ */ N(ae, { className: Z("size-4 text-ink-muted transition-transform", n && "rotate-180") })]
2566
+ }), /* @__PURE__ */ N("span", { children: Q({
2567
+ unit_amount: a,
2568
+ currency: i
2569
+ }) })] }), d = "flex w-full items-center justify-between gap-3 px-3.5 py-3 font-semibold text-[15px] text-ink";
2570
+ return /* @__PURE__ */ P("div", {
2571
+ className: "rounded-xl border border-border bg-ink/3",
2572
+ children: [l ? /* @__PURE__ */ N("button", {
2573
+ type: "button",
2574
+ onClick: () => r((e) => !e),
2575
+ "aria-expanded": n,
2576
+ className: d,
2577
+ children: u
2578
+ }) : /* @__PURE__ */ N("div", {
2579
+ className: d,
2580
+ children: u
2581
+ }), l && /* @__PURE__ */ N(fr, {
2582
+ open: n,
2583
+ children: /* @__PURE__ */ P("div", {
2584
+ className: "flex flex-col gap-1.5 px-3.5 pb-3 text-[13px] text-ink-soft",
2585
+ children: [
2586
+ /* @__PURE__ */ P("div", {
2587
+ className: "flex items-center justify-between gap-3",
2588
+ children: [/* @__PURE__ */ N("span", { children: "Subtotal" }), /* @__PURE__ */ N("span", { children: Q({
2589
+ unit_amount: o,
2590
+ currency: i
2591
+ }) })]
2592
+ }),
2593
+ c > 0 && /* @__PURE__ */ P("div", {
2594
+ className: "flex items-center justify-between gap-3 text-emerald-700 dark:text-emerald-400",
2595
+ children: [/* @__PURE__ */ N("span", { children: "Discount" }), /* @__PURE__ */ P("span", { children: ["-", Q({
2596
+ unit_amount: c,
2597
+ currency: i
2598
+ })] })]
2599
+ }),
2600
+ s.map((e, t) => /* @__PURE__ */ P("div", {
2601
+ className: "flex items-center justify-between gap-3",
2602
+ children: [/* @__PURE__ */ P("span", { children: [
2603
+ e.label,
2604
+ " (",
2605
+ e.percentage,
2606
+ "%)"
2607
+ ] }), /* @__PURE__ */ N("span", { children: Q({
2608
+ unit_amount: e.amount,
2609
+ currency: i
2610
+ }) })]
2611
+ }, e.id || e._id || t)),
2612
+ e?.tax_inclusive && /* @__PURE__ */ N("p", {
2613
+ className: "m-0 text-ink-muted text-xs",
2614
+ children: "Price is inclusive of taxes"
2615
+ })
2616
+ ]
2617
+ })
2618
+ })]
2619
+ });
2620
+ }, Rr = (e) => {
2621
+ let [t, n] = A(null);
2622
+ return E(() => {
2623
+ let t = e ? window.visualViewport : null;
2624
+ if (!t) return;
2625
+ let r = () => n({
2626
+ height: t.height,
2627
+ offsetTop: t.offsetTop
2628
+ });
2629
+ return r(), t.addEventListener("resize", r), t.addEventListener("scroll", r), () => {
2630
+ t.removeEventListener("resize", r), t.removeEventListener("scroll", r);
2631
+ };
2632
+ }, [e]), t;
2633
+ }, zr = ({ open: e, title: t, when: n, onClose: r, onClosed: i, onSubmit: a, footer: o, wide: s, initialFocusRef: c, layers: l, children: u }) => {
2634
+ let d = k(null), f = Rr(e), [p, m] = A(!1), h = /* @__PURE__ */ N("div", {
2635
+ onScroll: (e) => m(e.currentTarget.scrollTop > 2),
2636
+ className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain",
2637
+ children: /* @__PURE__ */ P("div", {
2638
+ className: "flex min-h-full flex-col",
2639
+ children: [/* @__PURE__ */ N("div", {
2640
+ className: "flex flex-1 flex-col px-5 pt-3 pb-3",
2641
+ children: u
2642
+ }), o && /* @__PURE__ */ N("div", {
2643
+ className: "border-border border-t bg-page px-5 pt-3 pb-[max(env(safe-area-inset-bottom),16px)] sm:sticky sm:bottom-0 sm:z-10",
2644
+ children: o
2645
+ })]
2646
+ })
2647
+ });
2648
+ return /* @__PURE__ */ N(F.Root, {
2649
+ open: e,
2650
+ onOpenChange: (e) => {
2651
+ e || r();
2652
+ },
2653
+ onOpenChangeComplete: (e) => {
2654
+ e || (m(!1), i());
2655
+ },
2656
+ children: /* @__PURE__ */ P(F.Portal, { children: [/* @__PURE__ */ N(F.Backdrop, { className: "fixed inset-0 z-[2147483000] bg-black/40 transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 data-[ending-style]:duration-150 motion-reduce:transition-none sm:backdrop-blur-[3px]" }), /* @__PURE__ */ P(F.Popup, {
2657
+ ref: d,
2658
+ initialFocus: (e) => {
2659
+ let t = c?.current;
2660
+ return t && e !== "touch" && window.matchMedia("(pointer: fine)").matches ? t : d.current;
2661
+ },
2662
+ style: {
2663
+ "--viewport-height": f ? `${f.height}px` : "100dvh",
2664
+ "--viewport-top": f ? `${f.offsetTop}px` : "0px"
2665
+ },
2666
+ className: Z("fixed inset-x-0 top-[var(--viewport-top)] z-[2147483000] flex h-[var(--viewport-height)] flex-col overflow-hidden bg-page font-body text-ink antialiased outline-none", "sm:inset-x-auto sm:top-[6vh] sm:left-1/2 sm:h-auto sm:max-h-[min(88dvh,var(--viewport-height))] sm:w-[calc(100%-2rem)] sm:-translate-x-1/2 sm:rounded-2xl sm:border sm:border-border sm:shadow-2xl", s ? "sm:max-w-[540px]" : "sm:max-w-[460px]", "transition-[opacity,translate] duration-200 ease-out data-[ending-style]:duration-150 motion-reduce:transition-none", "data-[ending-style]:translate-y-4 data-[starting-style]:translate-y-4 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0", "sm:data-[ending-style]:translate-y-2 sm:data-[starting-style]:translate-y-2"),
2426
2667
  children: [
2427
- /* @__PURE__ */ C("div", {
2428
- className: "bg-gradient-to-br from-green-50 to-emerald-50 px-6 py-6 text-center",
2429
- children: [
2430
- /* @__PURE__ */ S("div", {
2431
- className: "mx-auto mb-3 flex size-14 items-center justify-center rounded-full bg-green-100 ring-4 ring-green-50",
2432
- children: /* @__PURE__ */ C("svg", {
2433
- xmlns: "http://www.w3.org/2000/svg",
2434
- width: "28",
2435
- height: "28",
2436
- viewBox: "0 0 24 24",
2437
- fill: "none",
2438
- stroke: "currentColor",
2439
- strokeWidth: "2.5",
2440
- strokeLinecap: "round",
2441
- strokeLinejoin: "round",
2442
- className: "text-green-600",
2443
- "aria-hidden": "true",
2444
- children: [/* @__PURE__ */ S("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }), /* @__PURE__ */ S("polyline", { points: "22 4 12 14.01 9 11.01" })]
2445
- })
2446
- }),
2447
- /* @__PURE__ */ S(I.Title, {
2448
- className: "font-bold text-gray-900 text-lg",
2449
- children: n === "view" ? "Booking Details" : "Tickets Confirmed!"
2450
- }),
2451
- /* @__PURE__ */ S(I.Description, {
2452
- className: "mt-1 text-gray-600 text-sm",
2453
- children: n === "confirm" ? "Your tickets have been confirmed. A confirmation email is on its way." : "Here are the details about your booking."
2454
- })
2455
- ]
2456
- }),
2457
- /* @__PURE__ */ C("div", {
2458
- className: "px-6 py-5",
2459
- children: [/* @__PURE__ */ C("div", {
2460
- className: "relative overflow-hidden rounded-xl border border-gray-200 bg-white",
2668
+ /* @__PURE__ */ P("div", {
2669
+ className: Z("sticky top-0 z-10 shrink-0 border-b bg-page px-5 pt-[max(env(safe-area-inset-top),16px)] pb-2 transition-colors", p ? "border-border" : "border-transparent"),
2670
+ children: [/* @__PURE__ */ P("div", {
2671
+ className: "flex items-center justify-between gap-3",
2672
+ children: [/* @__PURE__ */ N(F.Title, {
2673
+ className: "m-0 line-clamp-2 font-heading font-semibold text-[19px] text-ink leading-snug tracking-[-0.011em] [overflow-wrap:anywhere]",
2674
+ children: t
2675
+ }), /* @__PURE__ */ N(F.Close, {
2676
+ "aria-label": "Close",
2677
+ className: "-mr-1.5 inline-flex size-8 shrink-0 items-center justify-center rounded-full text-ink-soft transition hover:bg-ink/5 hover:text-ink",
2678
+ children: /* @__PURE__ */ N(ce, { className: "size-4" })
2679
+ })]
2680
+ }), n && /* @__PURE__ */ P("p", {
2681
+ className: "m-0 mt-3.5 text-[13.5px] text-ink-soft",
2461
2682
  children: [
2462
- /* @__PURE__ */ S("div", { className: "absolute top-1/2 -left-3 size-6 -translate-y-1/2 rounded-full bg-gray-100" }),
2463
- /* @__PURE__ */ S("div", { className: "absolute top-1/2 -right-3 size-6 -translate-y-1/2 rounded-full bg-gray-100" }),
2464
- /* @__PURE__ */ C("div", {
2465
- className: "px-5 py-4",
2466
- children: [
2467
- t.qr_image && /* @__PURE__ */ S("div", {
2468
- className: "mb-4 flex flex-col items-center",
2469
- children: /* @__PURE__ */ S("div", {
2470
- className: "rounded-lg border border-gray-200 bg-white p-2",
2471
- children: /* @__PURE__ */ S("img", {
2472
- src: t.qr_image.location,
2473
- alt: "Booking QR Code",
2474
- className: "size-24"
2475
- })
2476
- })
2477
- }),
2478
- /* @__PURE__ */ C("div", {
2479
- className: "mb-4 flex items-center justify-between rounded-lg bg-gray-50 px-3 py-2.5",
2480
- children: [/* @__PURE__ */ S("span", {
2481
- className: "font-medium text-gray-500 text-xs uppercase tracking-wide",
2482
- children: "Booking ID"
2483
- }), /* @__PURE__ */ S("span", {
2484
- className: "font-mono font-semibold text-gray-900 text-sm",
2485
- children: t._id
2486
- })]
2487
- }),
2488
- /* @__PURE__ */ S("div", { className: "my-4 border-gray-200 border-t border-dashed" }),
2489
- /* @__PURE__ */ S("div", {
2490
- className: "space-y-3",
2491
- children: t.attendees.map((t) => {
2492
- let n = e.find((e) => e._id === t.ticket._id);
2493
- return n ? /* @__PURE__ */ C("div", {
2494
- className: "flex items-center justify-between",
2495
- children: [/* @__PURE__ */ C("div", {
2496
- className: "min-w-0 flex-1",
2497
- children: [/* @__PURE__ */ S("p", {
2498
- className: "truncate font-medium text-gray-900 text-sm",
2499
- children: t.name
2500
- }), /* @__PURE__ */ S("p", {
2501
- className: "truncate text-gray-500 text-xs",
2502
- children: t.email
2503
- })]
2504
- }), /* @__PURE__ */ C("div", {
2505
- className: "ml-3 shrink-0 text-right",
2506
- children: [/* @__PURE__ */ S("p", {
2507
- className: "font-medium text-gray-900 text-sm",
2508
- children: n.title
2509
- }), /* @__PURE__ */ S("p", {
2510
- className: "text-gray-500 text-xs",
2511
- children: s(t.ticket.unit_amount / 100)
2512
- })]
2513
- })]
2514
- }, t._id) : null;
2515
- })
2516
- }),
2517
- /* @__PURE__ */ S("div", { className: "my-4 border-gray-200 border-t border-dashed" }),
2518
- !o && /* @__PURE__ */ C("div", {
2519
- className: "space-y-1.5 text-sm",
2520
- children: [
2521
- /* @__PURE__ */ C("div", {
2522
- className: "flex justify-between",
2523
- children: [/* @__PURE__ */ S("span", {
2524
- className: "text-gray-500",
2525
- children: "Base Amount"
2526
- }), /* @__PURE__ */ S("span", {
2527
- className: "font-medium text-gray-700",
2528
- children: s(t.unit_amount / 100)
2529
- })]
2530
- }),
2531
- t.discount > 0 && /* @__PURE__ */ C("div", {
2532
- className: "flex justify-between text-green-600",
2533
- children: [/* @__PURE__ */ S("span", { children: "Discount" }), /* @__PURE__ */ C("span", {
2534
- className: "font-medium",
2535
- children: ["- ", s(t.discount / 100)]
2536
- })]
2537
- }),
2538
- t.taxes && Array.isArray(t.taxes) && t.taxes.length > 0 && t.taxes.map((e, t) => /* @__PURE__ */ C("div", {
2539
- className: "flex justify-between",
2540
- children: [/* @__PURE__ */ S("span", {
2541
- className: "text-gray-500",
2542
- children: e.label
2543
- }), /* @__PURE__ */ S("span", {
2544
- className: "font-medium text-gray-700",
2545
- children: s(e.amount / 100)
2546
- })]
2547
- }, t)),
2548
- /* @__PURE__ */ C("div", {
2549
- className: "flex justify-between border-gray-200 border-t pt-2 font-semibold text-gray-900",
2550
- children: [/* @__PURE__ */ S("span", { children: "Total Paid" }), /* @__PURE__ */ S("span", { children: s(a) })]
2551
- })
2552
- ]
2553
- }),
2554
- o && /* @__PURE__ */ C("div", {
2555
- className: "flex items-center justify-between font-semibold text-gray-900",
2556
- children: [/* @__PURE__ */ S("span", { children: "Total" }), /* @__PURE__ */ S("span", { children: "Free" })]
2557
- })
2558
- ]
2559
- })
2683
+ n.day,
2684
+ " · ",
2685
+ n.time,
2686
+ n.duration ? ` · ${n.duration}` : ""
2560
2687
  ]
2561
- }), /* @__PURE__ */ S("p", {
2562
- className: "mt-3 text-center text-gray-400 text-xs",
2563
- children: xr(t.created_at)
2564
2688
  })]
2565
2689
  }),
2566
- /* @__PURE__ */ C("div", {
2567
- className: "flex flex-col gap-2 px-6 pb-5",
2568
- children: [t.invoice?.location && /* @__PURE__ */ C("a", {
2569
- href: t.invoice.location,
2570
- target: "_blank",
2571
- rel: "noopener noreferrer",
2572
- className: "flex w-full items-center justify-center gap-2 rounded-lg border border-gray-200 px-4 py-2.5 font-medium text-gray-700 text-sm transition-colors hover:bg-gray-50",
2573
- children: [/* @__PURE__ */ C("svg", {
2574
- xmlns: "http://www.w3.org/2000/svg",
2575
- width: "16",
2576
- height: "16",
2577
- viewBox: "0 0 24 24",
2578
- fill: "none",
2579
- stroke: "currentColor",
2580
- strokeWidth: "2",
2581
- strokeLinecap: "round",
2582
- strokeLinejoin: "round",
2583
- "aria-hidden": "true",
2584
- children: [
2585
- /* @__PURE__ */ S("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
2586
- /* @__PURE__ */ S("polyline", { points: "7 10 12 15 17 10" }),
2587
- /* @__PURE__ */ S("line", {
2588
- x1: "12",
2589
- x2: "12",
2590
- y1: "15",
2591
- y2: "3"
2592
- })
2593
- ]
2594
- }), "Download Invoice"]
2595
- }), /* @__PURE__ */ S(I.Close, {
2596
- className: "w-full rounded-lg bg-gray-900 px-4 py-2.5 font-medium text-sm text-white transition-colors hover:bg-gray-800",
2597
- children: "Done"
2598
- })]
2599
- })
2690
+ a ? /* @__PURE__ */ N("form", {
2691
+ onSubmit: a,
2692
+ className: "flex min-h-0 flex-1 flex-col",
2693
+ children: h
2694
+ }) : h,
2695
+ l
2600
2696
  ]
2601
2697
  })] })
2602
2698
  });
2603
- }, Cr = ({ isOpen: e, onClose: t, stripePromise: n, clientSecret: r, onComplete: i }) => !n || !r ? null : /* @__PURE__ */ S(I.Root, {
2604
- open: e,
2605
- onOpenChange: (e) => {
2606
- e || t();
2607
- },
2608
- children: /* @__PURE__ */ C(I.Portal, { children: [/* @__PURE__ */ S(I.Backdrop, { className: "fixed inset-0 z-[100] bg-black/50" }), /* @__PURE__ */ C(I.Popup, {
2609
- className: "fixed top-8 left-1/2 z-[100] flex max-h-[calc(100vh-4rem)] min-h-[500px] w-[98vw] -translate-x-1/2 flex-col overflow-hidden rounded-2xl bg-white shadow-2xl md:top-10 md:w-auto md:max-w-[1000px] lg:max-w-[1100px]",
2610
- children: [/* @__PURE__ */ S(I.Close, {
2611
- className: "absolute top-4 right-4 z-10 rounded-full bg-white/90 p-2.5 text-gray-500 shadow-md backdrop-blur-sm transition-all hover:bg-white hover:text-gray-700",
2612
- children: /* @__PURE__ */ S(se, { className: "size-5" })
2613
- }), /* @__PURE__ */ S("div", {
2614
- className: "flex-1 overflow-y-auto rounded-2xl py-6",
2615
- children: /* @__PURE__ */ S(W, {
2616
- stripe: n,
2617
- options: {
2618
- clientSecret: r,
2619
- onComplete: i
2620
- },
2621
- children: /* @__PURE__ */ S(le, { className: "stripe-embedded-checkout h-full" })
2622
- })
2623
- })]
2624
- })] })
2625
- }), wr = ({ tickets: e, selectedTicket: t, onSelectTicket: n, discount: r, couponCode: i, publicCouponsCount: a, onApplyCouponClick: o, onRemoveCoupon: s, onNext: c }) => {
2626
- let l = _r(t), u = gr(r);
2627
- return /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("div", {
2628
- className: "flex max-h-[64dvh] w-full flex-col justify-between gap-6 overflow-y-auto md:max-h-[unset] md:flex-row",
2629
- children: [/* @__PURE__ */ S("div", {
2630
- className: "flex w-full flex-col gap-3 md:w-[55%]",
2631
- children: e.map((e) => /* @__PURE__ */ S("div", {
2632
- className: fr("flex cursor-pointer items-center justify-between rounded-md border border-gray-300 px-3 py-2 transition duration-300 hover:bg-gray-50", e._id === t?._id ? "border-brand bg-brand/10 hover:bg-brand/20" : ""),
2633
- onClick: () => n(e),
2634
- children: /* @__PURE__ */ C("div", { children: [
2635
- /* @__PURE__ */ S("p", {
2636
- className: "text-md",
2637
- children: e.title
2699
+ }, Br = "block w-full rounded-lg px-2.5 py-2 text-left text-ink text-sm no-underline hover:bg-ink/5", Vr = "transition-[opacity,translate] duration-300 ease-out starting:translate-y-2 starting:opacity-0 motion-reduce:transition-none", Hr = "inline-flex min-h-[46px] w-full items-center justify-center gap-2 rounded-xl border border-border font-medium text-[14.5px] text-ink no-underline transition hover:border-brand active:scale-[0.985]", Ur = ({ email: e, eventTitle: t, startsAt: n, endsAt: r, eventUrl: i, when: a, bookingRef: o, qrImageUrl: s, invoiceUrl: c, onClose: l, onRegisterAnother: u }) => {
2700
+ let d = Ir({
2701
+ title: t,
2702
+ startsAt: n,
2703
+ endsAt: r,
2704
+ url: i
2705
+ });
2706
+ return E(() => {
2707
+ navigator.vibrate?.(12);
2708
+ }, []), /* @__PURE__ */ P("div", {
2709
+ className: "flex flex-1 flex-col items-center justify-center px-6 py-9 text-center",
2710
+ children: [
2711
+ /* @__PURE__ */ N("div", {
2712
+ className: "flex size-[68px] starting:scale-50 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-700 starting:opacity-0 transition-[opacity,scale] duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none dark:bg-emerald-500/15 dark:text-emerald-400",
2713
+ children: /* @__PURE__ */ P("svg", {
2714
+ width: "30",
2715
+ height: "30",
2716
+ viewBox: "0 0 24 24",
2717
+ fill: "none",
2718
+ stroke: "currentColor",
2719
+ strokeWidth: "2.5",
2720
+ strokeLinecap: "round",
2721
+ strokeLinejoin: "round",
2722
+ "aria-hidden": "true",
2723
+ children: [/* @__PURE__ */ N("title", { children: "Registered" }), /* @__PURE__ */ N("path", {
2724
+ d: "M4 12.5 L9.5 18 L20 7",
2725
+ className: "transition-[stroke-dashoffset] delay-200 duration-[420ms] ease-[cubic-bezier(0.32,0.72,0,1)] [stroke-dasharray:30] starting:[stroke-dashoffset:30] motion-reduce:transition-none"
2726
+ })]
2727
+ })
2728
+ }),
2729
+ /* @__PURE__ */ N("h3", {
2730
+ className: Z(Vr, "m-0 mt-[18px] font-heading font-semibold text-[22px] text-ink tracking-[-0.016em] delay-[260ms]"),
2731
+ children: "You're in"
2732
+ }),
2733
+ a && /* @__PURE__ */ P("p", {
2734
+ className: Z(Vr, "m-0 mt-1.5 text-[14.5px] text-ink delay-[320ms]"),
2735
+ children: [
2736
+ a.day,
2737
+ " · ",
2738
+ a.time
2739
+ ]
2740
+ }),
2741
+ /* @__PURE__ */ P("p", {
2742
+ className: Z(Vr, "m-0 mt-1 max-w-[300px] text-[13.5px] text-ink-soft leading-relaxed delay-[360ms]"),
2743
+ children: ["Joining link sent to ", /* @__PURE__ */ N("span", {
2744
+ className: "text-ink [overflow-wrap:anywhere]",
2745
+ children: e
2746
+ })]
2747
+ }),
2748
+ /* @__PURE__ */ P("div", {
2749
+ className: Z(Vr, "relative mt-5 w-full max-w-[340px] overflow-hidden rounded-2xl border border-border bg-ink/3 px-4 py-3.5 delay-[420ms]"),
2750
+ children: [
2751
+ /* @__PURE__ */ N("span", {
2752
+ "aria-hidden": !0,
2753
+ className: "pointer-events-none absolute inset-0 starting:-translate-x-[140%] translate-x-[240%] bg-linear-to-r from-transparent via-white/45 to-transparent transition-transform delay-700 duration-900 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:hidden dark:via-white/10"
2638
2754
  }),
2639
- /* @__PURE__ */ S("p", {
2640
- className: "-mt-[2px] mb-1 text-gray-600 text-xs",
2641
- children: e.description
2755
+ s && /* @__PURE__ */ N("img", {
2756
+ src: s,
2757
+ alt: "Booking QR code",
2758
+ className: "mx-auto mb-3 block size-24 rounded-lg bg-white p-1.5"
2642
2759
  }),
2643
- /* @__PURE__ */ C("p", {
2644
- className: "text-md",
2645
- children: [$(e), hr(e) && /* @__PURE__ */ C("span", {
2646
- className: "text-gray-500 text-sm",
2647
- children: [" ", hr(e)]
2760
+ /* @__PURE__ */ P("div", {
2761
+ className: "flex items-center justify-between gap-3 text-[13.5px]",
2762
+ children: [/* @__PURE__ */ N("span", {
2763
+ className: "text-ink-soft",
2764
+ children: "Event"
2765
+ }), /* @__PURE__ */ N("span", {
2766
+ className: "min-w-0 truncate font-medium text-ink",
2767
+ children: t
2768
+ })]
2769
+ }),
2770
+ o && /* @__PURE__ */ P("div", {
2771
+ className: "mt-2 flex items-center justify-between gap-3 border-border border-t border-dashed pt-2 text-[13.5px]",
2772
+ children: [/* @__PURE__ */ N("span", {
2773
+ className: "text-ink-soft",
2774
+ children: "Booking ref"
2775
+ }), /* @__PURE__ */ N("span", {
2776
+ className: "min-w-0 truncate font-medium font-mono text-ink text-xs",
2777
+ children: o
2648
2778
  })]
2649
2779
  })
2650
- ] })
2651
- }, e._id))
2652
- }), /* @__PURE__ */ C("div", {
2653
- className: "w-full md:w-[45%]",
2654
- children: [/* @__PURE__ */ C("div", {
2655
- className: "mt-4 flex min-h-[250px] flex-col justify-between rounded-md border border-gray-300 p-4 md:mt-0",
2656
- children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
2657
- className: "border-b border-b-gray-200 pb-1 text-md",
2658
- children: "Confirm Details"
2659
- }), /* @__PURE__ */ S("div", {
2660
- className: "mt-2 flex flex-col gap-2",
2661
- children: t && /* @__PURE__ */ C("div", {
2662
- className: "flex justify-between",
2663
- children: [/* @__PURE__ */ S("span", {
2664
- className: "text-md",
2665
- children: t.title
2666
- }), /* @__PURE__ */ S("span", { children: $({
2667
- unit_amount: l ? t.subtotal : t.unit_amount,
2668
- currency: t.currency
2669
- }) })]
2670
- })
2671
- })] }), r && u ? /* @__PURE__ */ C("div", {
2672
- className: "mt-2",
2673
- children: [
2674
- /* @__PURE__ */ C("div", {
2675
- className: "flex items-center justify-between",
2676
- children: [/* @__PURE__ */ S("span", {
2677
- className: "text-md",
2678
- children: "Subtotal"
2679
- }), /* @__PURE__ */ S("span", {
2680
- className: "text-md",
2681
- children: $({
2682
- unit_amount: r.base_amount,
2683
- currency: t?.currency
2684
- })
2685
- })]
2686
- }),
2687
- /* @__PURE__ */ C("div", {
2688
- className: "flex items-center justify-between text-green-600",
2689
- children: [/* @__PURE__ */ S("span", {
2690
- className: "text-md",
2691
- children: "Discount"
2692
- }), /* @__PURE__ */ C("span", {
2693
- className: "text-md",
2694
- children: [
2695
- "-",
2696
- " ",
2697
- $({
2698
- unit_amount: r.discount,
2699
- currency: t?.currency
2700
- })
2701
- ]
2702
- })]
2703
- }),
2704
- /* @__PURE__ */ C("div", {
2705
- className: "flex items-center justify-between border-t border-t-gray-200 pt-1",
2706
- children: [/* @__PURE__ */ S("span", {
2707
- className: "text-md",
2708
- children: "Taxable Amount"
2709
- }), /* @__PURE__ */ S("span", {
2710
- className: "text-md",
2711
- children: $({
2712
- unit_amount: r.taxable_amount,
2713
- currency: t?.currency
2714
- })
2715
- })]
2716
- }),
2717
- r.taxes?.map((e, n) => /* @__PURE__ */ C("div", {
2718
- className: "flex items-center justify-between text-gray-600",
2719
- children: [/* @__PURE__ */ C("span", {
2720
- className: "text-sm",
2721
- children: [
2722
- e.label,
2723
- " (",
2724
- e.percentage,
2725
- "%)"
2726
- ]
2727
- }), /* @__PURE__ */ S("span", {
2728
- className: "text-sm",
2729
- children: $({
2730
- unit_amount: e.amount,
2731
- currency: t?.currency
2732
- })
2733
- })]
2734
- }, e.id || e._id || n)),
2735
- /* @__PURE__ */ C("div", {
2736
- className: "mt-1 flex items-center justify-between border-t border-t-gray-200 pt-1 font-medium",
2737
- children: [/* @__PURE__ */ S("span", {
2738
- className: "text-md",
2739
- children: "Payable"
2740
- }), /* @__PURE__ */ S("span", {
2741
- className: "text-md",
2742
- children: $({
2743
- unit_amount: r.total_amount,
2744
- currency: t?.currency
2745
- })
2746
- })]
2747
- })
2748
- ]
2749
- }) : r ? /* @__PURE__ */ C("div", {
2750
- className: "mt-2",
2751
- children: [
2752
- /* @__PURE__ */ C("div", {
2753
- className: "flex items-center justify-between",
2754
- children: [/* @__PURE__ */ S("span", {
2755
- className: "text-md",
2756
- children: "Subtotal"
2757
- }), /* @__PURE__ */ S("span", {
2758
- className: "text-md",
2759
- children: $({
2760
- unit_amount: r.base_amount,
2761
- currency: t?.currency
2762
- })
2763
- })]
2764
- }),
2765
- /* @__PURE__ */ C("div", {
2766
- className: "flex items-center justify-between text-green-600",
2767
- children: [/* @__PURE__ */ S("span", {
2768
- className: "text-md",
2769
- children: "Discount"
2770
- }), /* @__PURE__ */ C("span", {
2771
- className: "text-md",
2772
- children: [
2773
- "-",
2774
- " ",
2775
- $({
2776
- unit_amount: r.discount,
2777
- currency: t?.currency
2778
- })
2779
- ]
2780
- })]
2781
- }),
2782
- /* @__PURE__ */ C("div", {
2783
- className: "mt-1 flex items-center justify-between border-t border-t-gray-200 pt-1 font-medium",
2784
- children: [/* @__PURE__ */ S("span", {
2785
- className: "text-md",
2786
- children: "Payable"
2787
- }), /* @__PURE__ */ S("span", {
2788
- className: "text-md",
2789
- children: $({
2790
- unit_amount: r.sale_amount,
2791
- currency: t?.currency
2792
- })
2793
- })]
2794
- })
2795
- ]
2796
- }) : l ? /* @__PURE__ */ C("div", {
2797
- className: "mt-2",
2798
- children: [
2799
- /* @__PURE__ */ C("div", {
2800
- className: "flex items-center justify-between",
2801
- children: [/* @__PURE__ */ S("span", {
2802
- className: "text-md",
2803
- children: "Subtotal"
2804
- }), /* @__PURE__ */ S("span", {
2805
- className: "text-md",
2806
- children: $({
2807
- unit_amount: t.subtotal,
2808
- currency: t?.currency
2809
- })
2810
- })]
2811
- }),
2812
- t.taxes.map((e, n) => /* @__PURE__ */ C("div", {
2813
- className: "flex items-center justify-between text-gray-600",
2814
- children: [/* @__PURE__ */ C("span", {
2815
- className: "text-sm",
2816
- children: [
2817
- e.label,
2818
- " (",
2819
- e.percentage,
2820
- "%)"
2821
- ]
2822
- }), /* @__PURE__ */ S("span", {
2823
- className: "text-sm",
2824
- children: $({
2825
- unit_amount: e.amount,
2826
- currency: t?.currency
2827
- })
2828
- })]
2829
- }, e.id || e._id || n)),
2830
- /* @__PURE__ */ C("div", {
2831
- className: "mt-1 flex items-center justify-between border-t border-t-gray-200 pt-1 font-medium",
2832
- children: [/* @__PURE__ */ S("span", {
2833
- className: "text-md",
2834
- children: "Payable"
2835
- }), /* @__PURE__ */ S("span", {
2836
- className: "text-md",
2837
- children: $({
2838
- unit_amount: t.total,
2839
- currency: t?.currency
2780
+ ]
2781
+ }),
2782
+ /* @__PURE__ */ P("div", {
2783
+ className: Z(Vr, "mt-4 flex w-full max-w-[340px] flex-col gap-2 delay-[520ms]"),
2784
+ children: [
2785
+ d && /* @__PURE__ */ P(V.Root, { children: [/* @__PURE__ */ P(V.Trigger, {
2786
+ className: Hr,
2787
+ children: [/* @__PURE__ */ N(re, { className: "size-4" }), "Add to calendar"]
2788
+ }), /* @__PURE__ */ N(V.Portal, { children: /* @__PURE__ */ N(V.Positioner, {
2789
+ sideOffset: 6,
2790
+ className: "z-[2147483001]",
2791
+ children: /* @__PURE__ */ P(V.Popup, {
2792
+ className: "flex w-[220px] origin-[var(--transform-origin)] flex-col gap-0.5 rounded-2xl border border-border bg-page p-1.5 font-body text-ink shadow-xl outline-none transition-[opacity,scale] duration-150 ease-out data-[ending-style]:scale-95 data-[starting-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 motion-reduce:transition-none",
2793
+ children: [
2794
+ /* @__PURE__ */ N("a", {
2795
+ href: d.google,
2796
+ target: "_blank",
2797
+ rel: "noopener noreferrer",
2798
+ className: Br,
2799
+ children: "Google Calendar"
2800
+ }),
2801
+ /* @__PURE__ */ N("a", {
2802
+ href: d.outlook,
2803
+ target: "_blank",
2804
+ rel: "noopener noreferrer",
2805
+ className: Br,
2806
+ children: "Outlook"
2807
+ }),
2808
+ /* @__PURE__ */ N("button", {
2809
+ type: "button",
2810
+ onClick: () => {
2811
+ if (!d) return;
2812
+ let e = new Blob([d.ics], { type: "text/calendar;charset=utf-8" }), n = URL.createObjectURL(e), r = document.createElement("a");
2813
+ r.href = n, r.download = `${t.replace(/[^\w\s-]/g, "").trim() || "event"}.ics`, r.click(), URL.revokeObjectURL(n);
2814
+ },
2815
+ className: Br,
2816
+ children: "Apple Calendar / .ics"
2840
2817
  })
2841
- })]
2842
- }),
2843
- t.tax_inclusive && /* @__PURE__ */ S("p", {
2844
- className: "mt-1 text-gray-500 text-xs",
2845
- children: "* Price is inclusive of taxes"
2818
+ ]
2846
2819
  })
2847
- ]
2848
- }) : /* @__PURE__ */ S("div", {
2849
- className: "mt-2",
2850
- children: /* @__PURE__ */ C("div", {
2851
- className: "flex items-center justify-between font-medium",
2852
- children: [/* @__PURE__ */ S("span", {
2853
- className: "text-md",
2854
- children: "Payable"
2855
- }), /* @__PURE__ */ S("span", {
2856
- className: "text-md",
2857
- children: $(t)
2858
- })]
2820
+ }) })] }),
2821
+ c && /* @__PURE__ */ P("a", {
2822
+ href: c,
2823
+ target: "_blank",
2824
+ rel: "noopener noreferrer",
2825
+ className: Hr,
2826
+ children: [/* @__PURE__ */ N(oe, { className: "size-4" }), "Download invoice"]
2827
+ }),
2828
+ /* @__PURE__ */ N("button", {
2829
+ type: "button",
2830
+ onClick: l,
2831
+ className: "inline-flex min-h-[46px] w-full items-center justify-center rounded-xl bg-brand font-semibold text-[15px] text-brand-foreground transition active:scale-[0.985]",
2832
+ children: "Done"
2859
2833
  })
2860
- })]
2861
- }), r ? /* @__PURE__ */ S("div", {
2862
- className: "flex flex-col justify-between gap-1 py-2",
2863
- children: /* @__PURE__ */ C("div", {
2864
- className: "mt-2 mb-1 space-y-1 rounded-lg border border-green-200 bg-green-50 px-3 py-3",
2865
- children: [/* @__PURE__ */ C("div", {
2866
- className: "flex items-start justify-between gap-2",
2867
- children: [/* @__PURE__ */ C("div", {
2868
- className: "flex max-w-16 items-center gap-2",
2869
- children: [/* @__PURE__ */ S("div", {
2870
- className: "rounded bg-green-500 p-2",
2871
- children: /* @__PURE__ */ S(ae, {
2872
- size: 16,
2873
- className: "text-white"
2874
- })
2875
- }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("div", {
2876
- className: "font-medium text-green-700 text-xs uppercase opacity-60",
2877
- children: "Coupon Applied"
2878
- }), /* @__PURE__ */ S("div", {
2879
- className: "-mt-0.5 max-w-32 truncate font-bold text-green-900 text-sm tracking-wide",
2880
- children: i
2881
- })] })]
2882
- }), /* @__PURE__ */ S("button", {
2883
- type: "button",
2884
- onClick: s,
2885
- className: "rounded-md p-1 text-green-600 transition-colors hover:bg-green-100 hover:text-green-800",
2886
- "aria-label": "Remove coupon",
2887
- children: /* @__PURE__ */ S(oe, { size: 18 })
2888
- })]
2889
- }), /* @__PURE__ */ C("div", {
2890
- className: "text-green-700 text-xs",
2891
- children: [
2892
- "You are saving",
2893
- " ",
2894
- /* @__PURE__ */ S("span", {
2895
- className: "font-semibold",
2896
- children: $({
2897
- unit_amount: r.discount,
2898
- currency: t?.currency
2834
+ ]
2835
+ }),
2836
+ /* @__PURE__ */ N("button", {
2837
+ type: "button",
2838
+ onClick: u,
2839
+ className: "mt-4 text-[13px] text-ink-muted underline underline-offset-[3px] starting:opacity-0 transition-opacity delay-[600ms] duration-300 hover:text-ink motion-reduce:transition-none",
2840
+ children: "Register someone else"
2841
+ })
2842
+ ]
2843
+ });
2844
+ }, Wr = {
2845
+ email: "required",
2846
+ mobile: "off",
2847
+ organization: "off",
2848
+ designation: "off"
2849
+ }, Gr = (e) => e.replace(/[\s()-]/g, ""), Kr = (e) => /^\+?\d{7,15}$/.test(Gr(e)), qr = (e, t) => {
2850
+ let n = {}, r = [
2851
+ ["mobile", Gr(e.mobile)],
2852
+ ["organization", e.organization.trim()],
2853
+ ["designation", e.designation.trim()]
2854
+ ];
2855
+ for (let [e, i] of r) t[e] !== "off" && i && (n[e] = i);
2856
+ return n;
2857
+ }, Jr = (e, t) => {
2858
+ let n = {};
2859
+ e.name.trim() || (n.name = "Please enter your name"), t.email !== "off" && (e.email.trim() ? /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.email.trim()) || (n.email = "That email address doesn't look right") : t.email === "required" && (n.email = "Please enter your email")), t.mobile !== "off" && (e.mobile.trim() ? Kr(e.mobile) || (n.mobile = "That doesn't look like a valid phone number") : t.mobile === "required" && (n.mobile = "Please enter your phone number"));
2860
+ for (let r of ["organization", "designation"]) t[r] === "required" && !e[r].trim() && (n[r] = `Please enter your ${r}`);
2861
+ return n;
2862
+ }, Yr = (e) => `levo:event-registration:${e}`, Xr = (e) => {
2863
+ if (typeof window > "u") return null;
2864
+ try {
2865
+ let t = window.localStorage.getItem(Yr(e));
2866
+ return t ? JSON.parse(t) : null;
2867
+ } catch {
2868
+ return null;
2869
+ }
2870
+ }, Zr = (e, t) => {
2871
+ if (!(typeof window > "u")) try {
2872
+ window.localStorage.setItem(Yr(e), JSON.stringify(t));
2873
+ } catch {}
2874
+ }, Qr = (e) => {
2875
+ if (!(typeof window > "u")) try {
2876
+ window.localStorage.removeItem(Yr(e));
2877
+ } catch {}
2878
+ }, $r = ({ tickets: e, selectedTicket: t, onSelect: n, error: r }) => {
2879
+ let [i, a] = A(!t);
2880
+ return /* @__PURE__ */ P("fieldset", {
2881
+ className: "m-0 flex min-w-0 flex-col gap-2 border-0 p-0",
2882
+ children: [
2883
+ /* @__PURE__ */ N("legend", {
2884
+ className: "mb-2 p-0 font-medium text-ink text-sm",
2885
+ children: "Choose your ticket"
2886
+ }),
2887
+ /* @__PURE__ */ N("div", {
2888
+ className: "-mb-2 flex flex-col",
2889
+ children: e.map((r) => {
2890
+ let o = r._id === t?._id, s = i || o, c = xr(r);
2891
+ return /* @__PURE__ */ N(fr, {
2892
+ open: s,
2893
+ children: /* @__PURE__ */ P("label", {
2894
+ className: Z("mb-2 flex w-full cursor-pointer items-start gap-2.5 rounded-xl border px-3.5 py-3 transition", o ? "border-brand bg-brand/5" : "border-border hover:border-brand/50"),
2895
+ children: [
2896
+ /* @__PURE__ */ N("input", {
2897
+ type: "radio",
2898
+ name: "ticket",
2899
+ value: r._id,
2900
+ checked: o,
2901
+ onChange: () => {
2902
+ n(r), a(!1);
2903
+ },
2904
+ onClick: () => {
2905
+ i || a(!0);
2906
+ },
2907
+ className: "sr-only"
2908
+ }),
2909
+ /* @__PURE__ */ N("span", {
2910
+ "aria-hidden": !0,
2911
+ className: Z("mt-0.5 size-[17px] shrink-0 rounded-full border transition-all", o ? "border-[5px] border-brand" : "border-border")
2912
+ }),
2913
+ /* @__PURE__ */ P("span", {
2914
+ className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
2915
+ children: [/* @__PURE__ */ N("span", {
2916
+ className: "block font-medium text-[14.5px] text-ink leading-snug",
2917
+ children: r.title
2918
+ }), r.description && /* @__PURE__ */ N("span", {
2919
+ title: r.description,
2920
+ className: Z("mt-0.5 block text-[12.5px] text-ink-soft leading-snug", !i && "line-clamp-2"),
2921
+ children: r.description
2922
+ })]
2923
+ }),
2924
+ /* @__PURE__ */ P("span", {
2925
+ className: "flex shrink-0 flex-col items-end gap-1.5",
2926
+ children: [/* @__PURE__ */ P("span", {
2927
+ className: "text-right font-medium text-[14.5px] text-ink",
2928
+ children: [Q(r), c && /* @__PURE__ */ N("span", {
2929
+ className: "block font-normal text-[11.5px] text-ink-muted",
2930
+ children: c
2931
+ })]
2932
+ }), o && !i && e.length > 1 && /* @__PURE__ */ P("span", {
2933
+ className: "inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-brand/40 px-2.5 py-1 font-medium text-[12px] text-brand",
2934
+ children: [
2935
+ e.length - 1,
2936
+ " more",
2937
+ /* @__PURE__ */ N(ae, {
2938
+ "aria-hidden": !0,
2939
+ className: "size-3.5"
2940
+ })
2941
+ ]
2942
+ })]
2899
2943
  })
2900
- })
2901
- ]
2902
- })]
2944
+ ]
2945
+ })
2946
+ }, r._id);
2903
2947
  })
2904
- }) : /* @__PURE__ */ C("div", {
2905
- className: fr("flex cursor-pointer items-center justify-between border-b border-b-gray-300 pr-1 pl-4 transition-all duration-200 hover:bg-gray-50", t ? "h-[50px] py-3" : "py-3"),
2906
- onClick: () => t ? o() : null,
2907
- children: [/* @__PURE__ */ C("span", {
2908
- className: "flex items-center gap-2",
2909
- children: ["Apply Coupon", a > 0 && /* @__PURE__ */ S("span", {
2910
- className: "rounded-full bg-gray-200 px-2 py-0.5 text-gray-600 text-xs",
2911
- children: a
2912
- })]
2913
- }), /* @__PURE__ */ S("span", { children: /* @__PURE__ */ S(re, {}) })]
2914
- })]
2915
- })]
2916
- }), /* @__PURE__ */ S("div", {
2917
- className: "mt-3 flex justify-start",
2918
- children: /* @__PURE__ */ S(Q, {
2919
- onClick: c,
2920
- className: "rounded-lg bg-brand px-6 py-2 font-semibold text-brand-foreground hover:opacity-90",
2921
- children: "Continue for Payment"
2922
- })
2923
- })] });
2924
- }, Tr = () => {
2925
- let [e, t] = P(null), [n, r] = P(null), [i, a] = P(!1), [o, s] = P(null);
2926
- return {
2927
- stripePromise: e,
2928
- config: n,
2929
- isOpen: i,
2930
- openStripeCheckout: O(async (e) => {
2931
- try {
2932
- let { loadStripe: n } = await import("@stripe/stripe-js");
2933
- t(n(e.key)), r({ clientSecret: e.client_secret }), a(!0);
2934
- } catch (e) {
2935
- console.error("Failed to initialize Stripe checkout:", e);
2936
- }
2937
- }, []),
2938
- closeStripeCheckout: O(() => {
2939
- a(!1), setTimeout(() => {
2940
- r(null), t(null);
2941
- }, 300);
2942
- }, []),
2943
- onComplete: o,
2944
- setOnComplete: O((e) => {
2945
- s(() => e);
2946
- }, [])
2947
- };
2948
- }, Er = {
2948
+ }),
2949
+ r && /* @__PURE__ */ N("p", {
2950
+ className: "m-0 text-danger text-xs",
2951
+ children: r
2952
+ })
2953
+ ]
2954
+ });
2955
+ }, ei = {
2949
2956
  name: "",
2950
2957
  email: "",
2958
+ mobile: "",
2959
+ organization: "",
2960
+ designation: "",
2951
2961
  is_business_purchase: !1,
2952
2962
  billing_details: {
2953
2963
  name: "",
@@ -2961,257 +2971,560 @@ var pr = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2961
2971
  country: ""
2962
2972
  }
2963
2973
  }
2964
- }, Dr = (e, t, n) => {
2965
- let r = t.split("."), i = structuredClone(e), a = i, o = r.length - 1;
2966
- return r.forEach((e, t) => {
2967
- t === o ? a[e] = n : a = a[e];
2968
- }), i;
2969
- }, Or = async (e, t) => {
2970
- try {
2971
- let n = new URLSearchParams();
2972
- return n.append("query", JSON.stringify({ where: { status: "active" } })), (await e.fetch?.url(`/v1/event/event/${t}/ticket/query?${n.toString()}`).get().json())?.content?.data;
2973
- } catch (t) {
2974
- e.logger?.error("Failed to fetch event tickets", { exception: b(t) });
2975
- }
2976
- }, kr = ({ eventID: e, title: t, external: n, buttonText: r = "Register Now" }) => {
2977
- let a = i(), [o, s] = P([]), [c, l] = P(!0), [u, d] = P(!1), [f, p] = P(!1), [m, h] = P(null), [g, _] = P(void 0), [v, y] = P(""), [w, T] = P(null), [E, D] = P(!1), [k, j] = P(null), [M, F] = P(!1), [L, R] = P(1), [z, B] = P(null), [V, ee] = P([]), [H, te] = P(Er), ne = vr(m, w) === 0, U = N(null), re = () => te(Er), ie = () => {
2978
- T(null), _(void 0), j(null), D(!1), y(""), B(null), d(!1), R(1), re();
2979
- }, { Razorpay: ae } = ce(), { stripePromise: oe, config: le, isOpen: W, openStripeCheckout: ue, closeStripeCheckout: G, setOnComplete: de } = Tr(), fe = () => {
2980
- let e = U.current;
2981
- !e || !a || a.fetch?.url(`/v1/event/booking/${e.bookingId}/confirm-booking`)?.post({ session_id: e.sessionId })?.json().then((e) => {
2982
- e?.content?.data && _(e?.content?.data), G(), U.current = null;
2974
+ }, ti = {
2975
+ name: !0,
2976
+ email: !0,
2977
+ mobile: !0,
2978
+ organization: !0,
2979
+ designation: !0
2980
+ }, ni = (e, t) => {
2981
+ let [n, r] = A(ei), [i, a] = A({}), [o, s] = A(!1), c = k(!1);
2982
+ E(() => {
2983
+ c.current || !e || (c.current = !0, r((t) => ({
2984
+ ...t,
2985
+ name: t.name || [e.first_name, e.last_name].filter(Boolean).join(" ").trim(),
2986
+ email: t.email || e.email || ""
2987
+ })));
2988
+ }, [e]);
2989
+ let l = Jr(n, t), u = w((e, t) => r((n) => ({
2990
+ ...n,
2991
+ [e]: t
2992
+ })), []), d = w((e) => a((t) => ({
2993
+ ...t,
2994
+ [e]: !0
2995
+ })), []), f = w(() => {
2996
+ r(ei), a({}), s(!1), c.current = !0;
2997
+ }, []), p = w(() => {
2998
+ a({}), s(!1);
2999
+ }, []);
3000
+ return {
3001
+ values: n,
3002
+ errors: l,
3003
+ isValid: Object.keys(l).length === 0,
3004
+ submitAttempted: o,
3005
+ markSubmitted: () => s(!0),
3006
+ setField: u,
3007
+ touchField: d,
3008
+ reset: f,
3009
+ resetValidationDisplay: p,
3010
+ touched: o ? ti : i
3011
+ };
3012
+ }, ri = ({ eventID: e, selectedTicket: t, enabled: n }) => {
3013
+ let r = i(), [a, o] = A(""), [s, c] = A(null), [l, u] = A(!1), [d, f] = A(null), [p, m] = A([]);
3014
+ return E(() => {
3015
+ !n || !e || !r || r.fetch?.url(`/v1/event/event/${e}/coupon/list-public-coupons`)?.get().json().then((e) => {
3016
+ e?.status && e?.content?.data && m(e.content.data);
2983
3017
  }).catch((e) => {
2984
- a.logger?.error("Failed to confirm booking after Stripe payment", { exception: b(e) }), G(), U.current = null;
3018
+ r.logger?.error("Failed to fetch public coupons", { exception: b(e) });
2985
3019
  });
2986
- }, K = async () => {
2987
- if (!a) return;
2988
- p(!0), B(null);
2989
- let { name: t, email: n, is_business_purchase: r, billing_details: i } = H;
2990
- try {
2991
- let o = {
2992
- event: e,
2993
- coupon: v,
2994
- attendees: [{
2995
- name: t,
2996
- email: n,
2997
- ticket: m?._id,
2998
- details: {}
2999
- }]
3000
- };
3001
- r && !ne && (o.is_business_purchase = !0, o.billing_details = i);
3002
- let s = await a.fetch?.url(`/v1/event/event/${e}/booking/create-new-booking`)?.post(o).json();
3003
- if (!s?.status) B("Booking failed. Please try again.");
3004
- else {
3005
- ie();
3006
- let e = s?.content?.meta;
3007
- if (e?.key) {
3008
- let t = s?.content.data?._id;
3009
- e.provider === "stripe" && e.client_secret ? (U.current = t && e.session_id ? {
3010
- bookingId: t,
3011
- sessionId: e.session_id
3012
- } : null, de(fe), await ue({
3013
- key: e.key,
3014
- client_secret: e.client_secret,
3015
- amount: s?.content.data?.unit_amount || 0,
3016
- currency: e.currency || "USD",
3017
- provider: "stripe",
3018
- reference_id: e.reference_id || ""
3019
- })) : pe({
3020
- key: e.key,
3021
- amount: s?.content.data?.unit_amount,
3022
- currency: e.currency || "INR",
3023
- order_id: e.order_id,
3024
- booking_id: t
3025
- });
3026
- } else _(s?.content.data);
3020
+ }, [
3021
+ n,
3022
+ e,
3023
+ r
3024
+ ]), {
3025
+ code: a,
3026
+ setCode: o,
3027
+ discount: s,
3028
+ isLoading: l,
3029
+ error: d,
3030
+ publicCoupons: p,
3031
+ apply: w(async (n) => {
3032
+ let i = (n ?? a).trim();
3033
+ if (!(!i || !r)) {
3034
+ u(!0), f(null);
3035
+ try {
3036
+ let n = await r.fetch?.url(`/v1/event/event/${e}/coupon/validate-coupon-code`)?.post({
3037
+ coupon: i,
3038
+ event: e,
3039
+ attendees: [{
3040
+ name: "",
3041
+ email: "",
3042
+ ticket: t?._id
3043
+ }]
3044
+ }).json();
3045
+ n?.status && (c(n.content.data), o(i));
3046
+ } catch (e) {
3047
+ let t = b(e);
3048
+ f(t.message), r.logger?.error("Coupon validation failed", { exception: t });
3049
+ } finally {
3050
+ u(!1);
3051
+ }
3027
3052
  }
3053
+ }, [
3054
+ r,
3055
+ a,
3056
+ e,
3057
+ t?._id
3058
+ ]),
3059
+ reset: w(() => {
3060
+ o(""), c(null), f(null);
3061
+ }, [])
3062
+ };
3063
+ }, ii = async (e, t) => {
3064
+ let n = new URLSearchParams();
3065
+ return n.append("query", JSON.stringify({ where: { status: "active" } })), (await e.fetch?.url(`/v1/event/event/${t}/ticket/query?${n.toString()}`).get().json())?.content?.data ?? [];
3066
+ }, ai = ({ eventID: e, external: t }) => {
3067
+ let n = i(), [r, a] = A([]), [o, s] = A(!t), [c, l] = A(!1), [u, d] = A(null);
3068
+ return E(() => {
3069
+ t || !e || !n || (s(!0), l(!1), ii(n, e).then((e) => {
3070
+ a(e), e.length === 1 && d(e[0] ?? null);
3071
+ }).catch((e) => {
3072
+ l(!0), n.logger?.error("Failed to load event tickets", { exception: b(e) });
3073
+ }).finally(() => s(!1)));
3074
+ }, [
3075
+ e,
3076
+ t,
3077
+ n
3078
+ ]), {
3079
+ tickets: r,
3080
+ isLoading: o,
3081
+ hasFailed: c,
3082
+ selectedTicket: u,
3083
+ selectTicket: d
3084
+ };
3085
+ }, oi = async (e) => {
3086
+ let { payment_session_id: t, order_id: n } = e;
3087
+ if (!t || !n) throw Error("Cashfree payment session missing");
3088
+ let { load: r } = await import("./script.esm-wR2d7rrv.js"), i = await r({ mode: e.environment || "production" });
3089
+ if (!i) throw Error("Cashfree checkout failed to load");
3090
+ let a = await i.checkout({
3091
+ paymentSessionId: t,
3092
+ redirectTarget: "_modal"
3093
+ });
3094
+ return a.paymentDetails ? {
3095
+ status: "completed",
3096
+ confirmation: { order_id: n }
3097
+ } : a.redirect ? { status: "redirect" } : {
3098
+ status: "closed",
3099
+ message: a.error?.message
3100
+ };
3101
+ }, si = () => typeof window < "u" && "Razorpay" in window, ci = ({ order: e, onSettled: t, onError: n }) => {
3102
+ let { Razorpay: r, isLoading: i, error: a } = le(), o = k({
3103
+ onSettled: t,
3104
+ onError: n
3105
+ });
3106
+ o.current = {
3107
+ onSettled: t,
3108
+ onError: n
3109
+ };
3110
+ let s = k(!1);
3111
+ return E(() => {
3112
+ if (s.current) return;
3113
+ if (a) {
3114
+ s.current = !0, o.current.onError(Error(a));
3115
+ return;
3116
+ }
3117
+ if (!r || !si()) return;
3118
+ s.current = !0;
3119
+ let t;
3120
+ try {
3121
+ let n = new r({
3122
+ key: e.key,
3123
+ amount: e.amount,
3124
+ currency: e.currency,
3125
+ order_id: e.orderId,
3126
+ name: e.merchantName,
3127
+ description: e.description,
3128
+ prefill: e.prefill,
3129
+ theme: e.themeColor ? { color: e.themeColor } : void 0,
3130
+ handler: (e) => o.current.onSettled({
3131
+ status: "completed",
3132
+ confirmation: {
3133
+ order_id: e.razorpay_order_id,
3134
+ payment_id: e.razorpay_payment_id,
3135
+ signature: e.razorpay_signature
3136
+ }
3137
+ }),
3138
+ modal: { ondismiss: () => o.current.onSettled({
3139
+ status: "closed",
3140
+ message: t
3141
+ }) }
3142
+ });
3143
+ n.on("payment.failed", (e) => {
3144
+ t = e?.error?.description;
3145
+ }), n.open();
3028
3146
  } catch (e) {
3029
- B(b(e).message || "Something went wrong. Please try again.");
3147
+ o.current.onError(e instanceof Error ? e : /* @__PURE__ */ Error("Razorpay checkout failed to open"));
3030
3148
  }
3031
- p(!1);
3032
- }, pe = async (e) => {
3033
- if (!a) return;
3034
- let n = new ae({
3035
- key: e.key,
3036
- amount: e.amount ?? 0,
3037
- currency: e.currency,
3038
- order_id: e.order_id ?? "",
3039
- name: t ?? "",
3040
- description: "Event Registration",
3041
- handler: (t) => {
3042
- a.fetch?.url(`/v1/event/booking/${e.booking_id}/confirm-booking`)?.post({
3043
- order_id: t.razorpay_order_id,
3044
- payment_id: t.razorpay_payment_id,
3045
- signature: t.razorpay_signature
3046
- })?.json().then((e) => {
3047
- e?.content?.data?.status && _(e?.content?.data);
3048
- }).catch((e) => {
3049
- a.logger?.error("Failed to confirm Razorpay booking", { exception: b(e) });
3050
- });
3051
- },
3052
- prefill: {
3053
- name: "",
3054
- email: "",
3055
- phone: ""
3149
+ }, [
3150
+ r,
3151
+ i,
3152
+ a,
3153
+ e
3154
+ ]), null;
3155
+ }, li = ({ stripePromise: e, clientSecret: t, onClose: n, onComplete: r }) => {
3156
+ let i = k(r);
3157
+ i.current = r;
3158
+ let a = O(() => ({
3159
+ clientSecret: t,
3160
+ onComplete: () => i.current()
3161
+ }), [t]);
3162
+ return /* @__PURE__ */ N(F.Root, {
3163
+ open: !0,
3164
+ onOpenChange: (e) => {
3165
+ e || n();
3166
+ },
3167
+ children: /* @__PURE__ */ P(F.Portal, { children: [/* @__PURE__ */ N(F.Backdrop, { className: "fixed inset-0 z-[2147483001] bg-black/50" }), /* @__PURE__ */ P(F.Popup, {
3168
+ className: "fixed top-8 left-1/2 z-[2147483001] flex max-h-[calc(100dvh-4rem)] min-h-[500px] w-[98vw] -translate-x-1/2 flex-col overflow-hidden rounded-2xl bg-white shadow-2xl md:top-10 md:w-auto md:max-w-[1000px] lg:max-w-[1100px]",
3169
+ children: [/* @__PURE__ */ N(F.Close, {
3170
+ "aria-label": "Close payment",
3171
+ className: "absolute top-4 right-4 z-10 rounded-full bg-white/90 p-2.5 text-gray-500 shadow-md backdrop-blur-sm transition-all hover:bg-white hover:text-gray-700",
3172
+ children: /* @__PURE__ */ N(ce, { className: "size-5" })
3173
+ }), /* @__PURE__ */ N("div", {
3174
+ className: "flex-1 overflow-y-auto rounded-2xl py-6",
3175
+ children: /* @__PURE__ */ N(de, {
3176
+ stripe: e,
3177
+ options: a,
3178
+ children: /* @__PURE__ */ N(ue, { className: "stripe-embedded-checkout h-full" })
3179
+ })
3180
+ })]
3181
+ })] })
3182
+ });
3183
+ }, ui = () => {
3184
+ let [e, t] = A(null), n = w(async (e, n) => {
3185
+ if (e.provider === "cashfree") return oi(e);
3186
+ if (e.provider === "stripe") {
3187
+ let { client_secret: n, session_id: r } = e;
3188
+ if (!n || !r) throw Error("Stripe checkout session missing");
3189
+ let { loadStripe: i } = await import("@stripe/stripe-js"), a = i(e.key);
3190
+ return new Promise((e, i) => t({
3191
+ provider: "stripe",
3192
+ stripePromise: a,
3193
+ clientSecret: n,
3194
+ sessionId: r,
3195
+ settle: {
3196
+ resolve: e,
3197
+ reject: i
3198
+ }
3199
+ }));
3200
+ }
3201
+ let { order_id: r } = e;
3202
+ if (!r) throw Error("Razorpay order missing");
3203
+ return new Promise((i, a) => t({
3204
+ provider: "razorpay",
3205
+ order: {
3206
+ ...n,
3207
+ key: e.key,
3208
+ currency: e.currency || "INR",
3209
+ orderId: r
3056
3210
  },
3057
- theme: { color: "#FC751A" }
3211
+ settle: {
3212
+ resolve: i,
3213
+ reject: a
3214
+ }
3215
+ }));
3216
+ }, []), r = (e, n) => {
3217
+ t(null), n instanceof Error ? e.settle.reject(n) : e.settle.resolve(n);
3218
+ }, i = null;
3219
+ return e?.provider === "stripe" ? i = /* @__PURE__ */ N(li, {
3220
+ stripePromise: e.stripePromise,
3221
+ clientSecret: e.clientSecret,
3222
+ onComplete: () => r(e, {
3223
+ status: "completed",
3224
+ confirmation: { session_id: e.sessionId }
3225
+ }),
3226
+ onClose: () => r(e, { status: "closed" })
3227
+ }) : e?.provider === "razorpay" && (i = /* @__PURE__ */ N(ci, {
3228
+ order: e.order,
3229
+ onSettled: (t) => r(e, t),
3230
+ onError: (t) => r(e, t)
3231
+ })), {
3232
+ open: n,
3233
+ element: i
3234
+ };
3235
+ }, $ = {
3236
+ registrationFailed: "We couldn't complete your registration. Please try again.",
3237
+ paymentAbandoned: "Payment wasn't completed. Your details are saved — try again.",
3238
+ providerUnreachable: "We couldn't reach the payment provider. Check your connection and try again.",
3239
+ confirmationFailed: "We couldn't confirm your payment. Your details are saved — try again.",
3240
+ generic: "Something went wrong. Please try again."
3241
+ }, di = (e) => !!e && e.status !== "requires_payment", fi = ({ eventID: e, details: t, onConfirmed: n }) => {
3242
+ let r = i(), a = ui(), [o, s] = A({ kind: "idle" }), c = k({
3243
+ details: t,
3244
+ onConfirmed: n
3245
+ });
3246
+ c.current = {
3247
+ details: t,
3248
+ onConfirmed: n
3249
+ };
3250
+ let l = (e) => {
3251
+ s({ kind: "idle" }), c.current.onConfirmed(e);
3252
+ }, u = (e, t) => s({
3253
+ kind: "unpaid",
3254
+ bookingId: e,
3255
+ message: t
3256
+ }), d = async (e, t) => {
3257
+ if (!t?.key) {
3258
+ di(e) ? l(e) : s({
3259
+ kind: "failed",
3260
+ message: $.registrationFailed
3261
+ });
3262
+ return;
3263
+ }
3264
+ if (!e) {
3265
+ s({
3266
+ kind: "failed",
3267
+ message: $.registrationFailed
3268
+ });
3269
+ return;
3270
+ }
3271
+ s({
3272
+ kind: "busy",
3273
+ stage: "paying"
3058
3274
  });
3059
- n.on("payment.failed", (e) => {
3060
- a.logger?.error("Razorpay payment failed", { exception: b(e.error) });
3061
- }), n.open();
3062
- }, me = O(async () => {
3063
- if (a) try {
3064
- let t = await a.fetch?.url(`/v1/event/event/${e}/coupon/list-public-coupons`)?.get().json();
3065
- t?.status && t?.content?.data && ee(t.content.data);
3066
- } catch (e) {
3067
- a.logger?.error("Failed to fetch public coupons", { exception: b(e) });
3275
+ let n;
3276
+ try {
3277
+ n = await a.open(t, {
3278
+ ...c.current.details,
3279
+ amount: t.amount ?? e.total_amount ?? e.unit_amount
3280
+ });
3281
+ } catch (t) {
3282
+ r?.logger?.error("Checkout failed to open", { exception: b(t) }), u(e._id, $.providerUnreachable);
3283
+ return;
3068
3284
  }
3069
- }, [a, e]), he = async (t) => {
3070
- if (!a) return;
3071
- let n = t ?? v;
3072
- D(!0), j(null);
3285
+ if (n.status !== "redirect") {
3286
+ if (n.status === "closed") {
3287
+ u(e._id, n.message || $.paymentAbandoned);
3288
+ return;
3289
+ }
3290
+ try {
3291
+ let t = (await r?.fetch?.url(`/v1/event/booking/${e._id}/confirm-booking`)?.post(n.confirmation)?.json())?.content?.data;
3292
+ di(t) ? l(t) : u(e._id, $.paymentAbandoned);
3293
+ } catch (t) {
3294
+ r?.logger?.error("Failed to confirm booking after payment", { exception: b(t) }), u(e._id, $.confirmationFailed);
3295
+ }
3296
+ }
3297
+ }, f = async (e, t) => {
3298
+ s({
3299
+ kind: "busy",
3300
+ stage: "booking"
3301
+ });
3073
3302
  try {
3074
- let t = await a.fetch?.url(`/v1/event/event/${e}/coupon/validate-coupon-code`)?.post({
3075
- coupon: n,
3076
- event: e,
3077
- attendees: [{
3078
- name: "",
3079
- email: "",
3080
- ticket: m?._id
3081
- }]
3082
- }).json();
3083
- t?.status && (T(t.content.data), y(n)), F(!1), D(!1);
3084
- } catch (e) {
3085
- j(b(e).message), D(!1);
3303
+ let e = await t();
3304
+ if (!e?.status) {
3305
+ s({
3306
+ kind: "failed",
3307
+ message: $.registrationFailed
3308
+ });
3309
+ return;
3310
+ }
3311
+ await d(e.content?.data, e.content?.meta);
3312
+ } catch (t) {
3313
+ let n = b(t);
3314
+ r?.logger?.error(e === "retry" ? "Retry payment failed" : "Event registration failed", { exception: n }), s({
3315
+ kind: "failed",
3316
+ message: n.message || $.generic
3317
+ });
3086
3318
  }
3087
- }, ge = (e) => {
3088
- y(""), T(null), j(null), D(!1), B(null), h(e);
3089
- }, _e = () => {
3090
- T(null), j(null), y("");
3091
- }, ve = () => {
3092
- j(null), D(!1), y(""), F(!1);
3093
- }, ye = (e) => {
3094
- let { name: t, value: n, type: r, checked: i } = e.target;
3095
- te((e) => Dr(e, t, r === "checkbox" ? i : n));
3096
- }, be = () => {}, xe = (e) => {
3097
- e?.preventDefault(), K();
3098
3319
  };
3099
- if (A(() => {
3100
- if (n) {
3101
- l(!1);
3102
- return;
3320
+ return {
3321
+ state: o,
3322
+ checkoutElement: a.element,
3323
+ register: (t) => f("register", () => r?.fetch?.url(`/v1/event/event/${e}/booking/create-new-booking`)?.post(t).json()),
3324
+ retry: () => {
3325
+ if (o.kind !== "unpaid") return;
3326
+ let { bookingId: e } = o;
3327
+ return f("retry", () => r?.fetch?.url(`/v1/event/booking/${e}/retry-payment`)?.post({}).json());
3328
+ },
3329
+ reset: () => s({ kind: "idle" })
3330
+ };
3331
+ }, pi = "register", mi = () => {
3332
+ if (typeof window > "u") return !1;
3333
+ let e = new URLSearchParams(window.location.search).get(pi);
3334
+ return e !== null && e !== "0" && e !== "false";
3335
+ }, hi = ({ canAutoOpen: e }) => {
3336
+ let [t, n] = A(!1), r = k(!1), i = w(() => n(!0), []), a = w(() => n(!1), []);
3337
+ return E(() => {
3338
+ r.current || !e || !mi() || (r.current = !0, n(!0));
3339
+ }, [e]), {
3340
+ isOpen: t,
3341
+ open: i,
3342
+ close: a
3343
+ };
3344
+ }, gi = "inline-flex items-center justify-center rounded-lg bg-brand px-4 py-3 font-semibold text-brand-foreground transition hover:opacity-90", _i = ({ eventID: e, title: t, external: n, buttonText: r = "Register Now", startsAt: i, endsAt: a, eventUrl: o }) => {
3345
+ let { account: s } = We(), c = Kn(), l = ai({
3346
+ eventID: e,
3347
+ external: n
3348
+ }), u = l.selectedTicket?.registration_fields ?? Wr, d = ni(s, u), f = Tr(l.selectedTicket, null)?.isFree === !1, [p, m] = A(null), [h, g] = A(null);
3349
+ E(() => {
3350
+ let t = Xr(e);
3351
+ t && g({ email: t.email });
3352
+ }, [e]);
3353
+ let _ = hi({ canAutoOpen: !n && !l.isLoading && l.tickets.length > 0 && !h }), v = k(null), y = ri({
3354
+ eventID: e,
3355
+ selectedTicket: l.selectedTicket,
3356
+ enabled: _.isOpen && f
3357
+ }), b = Tr(l.selectedTicket, y.discount), x = !!b && !b.isFree, S = l.tickets.length > 1, C = O(() => Mr(i, a), [i, a]), w = t || "this event", T = S || x, D = fi({
3358
+ eventID: e,
3359
+ details: {
3360
+ merchantName: c?.name || t || "",
3361
+ description: "Event Registration",
3362
+ prefill: {
3363
+ name: d.values.name.trim(),
3364
+ email: d.values.email.trim(),
3365
+ contact: Gr(d.values.mobile)
3366
+ }
3367
+ },
3368
+ onConfirmed: (t) => {
3369
+ let n = d.values.email.trim();
3370
+ m(t), g({ email: n }), Zr(e, {
3371
+ bookingId: t._id,
3372
+ email: n,
3373
+ at: (/* @__PURE__ */ new Date()).toISOString()
3374
+ });
3103
3375
  }
3104
- e && a && (l(!0), Or(a, e).then((e) => {
3105
- s(e ?? []), e && e.length > 0 && h(e[0] || null), l(!1);
3106
- }));
3107
- }, [
3108
- e,
3109
- n,
3110
- a
3111
- ]), A(() => {
3112
- m?.unit_amount === 0 && o?.length === 1 && R(2);
3113
- }, [m, o]), A(() => {
3114
- u && e && me();
3115
- }, [
3116
- u,
3117
- e,
3118
- me
3119
- ]), n) return /* @__PURE__ */ S("div", {
3376
+ }), { state: j } = D, F = j.kind === "busy", I = (e) => {
3377
+ y.reset(), D.reset(), l.selectTicket(e);
3378
+ }, L = () => {
3379
+ Qr(e), g(null), m(null), D.reset(), d.reset();
3380
+ }, R = (t) => {
3381
+ t.preventDefault(), d.markSubmitted(), !(!l.selectedTicket || !d.isValid) && D.register({
3382
+ event: e,
3383
+ coupon: y.code,
3384
+ attendees: [{
3385
+ name: d.values.name.trim(),
3386
+ email: d.values.email.trim(),
3387
+ ...qr(d.values, u),
3388
+ ticket: l.selectedTicket._id,
3389
+ details: {}
3390
+ }],
3391
+ ...d.values.is_business_purchase && x ? {
3392
+ is_business_purchase: !0,
3393
+ billing_details: d.values.billing_details
3394
+ } : {}
3395
+ });
3396
+ };
3397
+ if (n) return /* @__PURE__ */ N("div", {
3120
3398
  className: "my-2",
3121
- children: /* @__PURE__ */ S(Q, {
3122
- className: "rounded-lg bg-brand px-4 py-3 font-semibold text-brand-foreground hover:opacity-90",
3399
+ children: /* @__PURE__ */ N("button", {
3400
+ type: "button",
3401
+ className: gi,
3123
3402
  onClick: () => window.open(n, "_blank", "noopener,noreferrer"),
3124
3403
  children: r
3125
3404
  })
3126
3405
  });
3127
- if (c) return /* @__PURE__ */ S("div", {
3406
+ if (!l.isLoading && l.tickets.length === 0) return /* @__PURE__ */ N("div", {
3128
3407
  className: "my-2",
3129
- children: /* @__PURE__ */ S(Q, {
3130
- className: "rounded-lg bg-brand px-4 py-2 font-bold text-brand-foreground",
3131
- children: "Loading..."
3408
+ children: /* @__PURE__ */ N("p", {
3409
+ className: "m-0 text-ink-soft text-sm",
3410
+ children: l.hasFailed ? "We couldn't load tickets for this event. Please refresh the page." : "Registration isn't open for this event yet."
3132
3411
  })
3133
3412
  });
3134
- let q = ne ? "Complete Registration" : "Pay";
3135
- return /* @__PURE__ */ C(x, { children: [
3136
- /* @__PURE__ */ S("div", {
3137
- className: "my-2",
3138
- children: o?.length ? /* @__PURE__ */ S(Q, {
3139
- onClick: () => d(!0),
3140
- className: "rounded-lg bg-brand px-4 py-3 font-semibold text-brand-foreground hover:opacity-90",
3141
- children: r
3142
- }) : /* @__PURE__ */ S("p", {
3143
- className: "text-red-500",
3144
- children: "No tickets available for this event."
3413
+ let z = b ? b.isFree ? "Save my spot" : `Pay ${Q({
3414
+ unit_amount: b.amount,
3415
+ currency: b.currency
3416
+ })}` : "Choose a ticket";
3417
+ return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("div", {
3418
+ className: "my-2",
3419
+ children: h && !_.isOpen ? /* @__PURE__ */ P("span", {
3420
+ className: "inline-flex flex-wrap items-center gap-2 rounded-xl border border-border bg-ink/3 px-3.5 py-2.5 text-ink text-sm",
3421
+ children: [
3422
+ /* @__PURE__ */ N(ie, { className: "size-4 text-emerald-600 dark:text-emerald-400" }),
3423
+ "You're registered as ",
3424
+ h.email,
3425
+ /* @__PURE__ */ N("button", {
3426
+ type: "button",
3427
+ onClick: L,
3428
+ className: "text-ink-soft underline underline-offset-[3px] hover:text-ink",
3429
+ children: "Register someone else"
3430
+ })
3431
+ ]
3432
+ }) : /* @__PURE__ */ N("button", {
3433
+ type: "button",
3434
+ onClick: _.open,
3435
+ disabled: l.isLoading,
3436
+ className: Z(gi, "disabled:opacity-60"),
3437
+ children: r
3438
+ })
3439
+ }), /* @__PURE__ */ N(zr, {
3440
+ open: _.isOpen,
3441
+ title: p ? w : `Register for ${w}`,
3442
+ when: C,
3443
+ wide: S,
3444
+ onClose: _.close,
3445
+ onClosed: () => {
3446
+ D.reset(), d.resetValidationDisplay();
3447
+ },
3448
+ initialFocusRef: S ? void 0 : v,
3449
+ layers: D.checkoutElement,
3450
+ onSubmit: p ? void 0 : R,
3451
+ footer: p ? void 0 : /* @__PURE__ */ P(M, { children: [
3452
+ (j.kind === "unpaid" || j.kind === "failed") && /* @__PURE__ */ P("p", {
3453
+ role: "alert",
3454
+ className: "m-0 mb-2.5 rounded-xl bg-danger/10 px-3 py-2.5 text-danger text-sm starting:opacity-0 transition-opacity duration-200 motion-reduce:transition-none",
3455
+ children: [j.message, j.kind === "unpaid" && /* @__PURE__ */ N("button", {
3456
+ type: "button",
3457
+ onClick: D.retry,
3458
+ className: "ml-1.5 inline-flex items-center gap-1 font-semibold underline underline-offset-[3px]",
3459
+ children: "Pay again"
3460
+ })]
3461
+ }),
3462
+ /* @__PURE__ */ P("button", {
3463
+ type: "submit",
3464
+ disabled: F,
3465
+ className: "inline-flex min-h-[50px] w-full items-center justify-center gap-2 rounded-xl bg-brand font-semibold text-[15.5px] text-brand-foreground transition active:scale-[0.985] disabled:opacity-55",
3466
+ children: [F && /* @__PURE__ */ N(se, { className: "size-4 animate-spin" }), F && j.stage === "paying" ? "Opening secure checkout" : z]
3467
+ }),
3468
+ /* @__PURE__ */ N("p", {
3469
+ className: "m-0 mt-2 text-center text-ink-muted text-xs",
3470
+ children: x ? "Secure payment · confirmation sent to your email" : "No card needed · joining link sent to your email"
3145
3471
  })
3146
- }),
3147
- /* @__PURE__ */ S(I.Root, {
3148
- open: u,
3149
- onOpenChange: (e) => {
3150
- e || ie();
3151
- },
3152
- children: /* @__PURE__ */ C(I.Portal, { children: [/* @__PURE__ */ S(I.Backdrop, { className: "fixed inset-0 z-[100] bg-black/50" }), /* @__PURE__ */ C(I.Popup, {
3153
- className: fr("fixed top-24 left-1/2 z-[100] flex max-h-[calc(100dvh-12rem)] w-[90%] -translate-x-1/2 flex-col overflow-y-auto rounded-lg bg-white p-4", M ? "md:w-[30%]" : "md:w-[40%]"),
3154
- children: [/* @__PURE__ */ C("div", {
3155
- className: `mb-4 flex w-full items-start justify-between ${M ? "" : "pb-[6px]"} `,
3156
- children: [/* @__PURE__ */ C(I.Title, {
3157
- className: "font-semibold text-lg",
3158
- children: [
3159
- "Register for ",
3160
- t,
3161
- "!"
3162
- ]
3163
- }), /* @__PURE__ */ S(I.Close, {
3164
- className: "rounded-md p-2 hover:bg-gray-100 focus:outline-none",
3165
- children: /* @__PURE__ */ S(se, { className: "size-4" })
3472
+ ] }),
3473
+ children: p ? /* @__PURE__ */ N(Ur, {
3474
+ email: d.values.email.trim(),
3475
+ eventTitle: w,
3476
+ startsAt: i,
3477
+ endsAt: a,
3478
+ eventUrl: o,
3479
+ when: C,
3480
+ bookingRef: p._id,
3481
+ qrImageUrl: p.qr_image?.location,
3482
+ invoiceUrl: p.invoice?.location,
3483
+ onClose: _.close,
3484
+ onRegisterAnother: L
3485
+ }) : /* @__PURE__ */ P("div", {
3486
+ className: "flex flex-col gap-4",
3487
+ children: [
3488
+ S && /* @__PURE__ */ N($r, {
3489
+ tickets: l.tickets,
3490
+ selectedTicket: l.selectedTicket,
3491
+ onSelect: I,
3492
+ error: d.submitAttempted && !l.selectedTicket ? "Choose a ticket to continue" : void 0
3493
+ }),
3494
+ x && /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(Lr, {
3495
+ selectedTicket: l.selectedTicket,
3496
+ discount: y.discount
3497
+ }), /* @__PURE__ */ N(Ar, {
3498
+ couponCode: y.code,
3499
+ onCouponCodeChange: y.setCode,
3500
+ couponError: y.error,
3501
+ couponLoading: y.isLoading,
3502
+ onValidateCoupon: y.apply,
3503
+ onRemoveCoupon: y.reset,
3504
+ publicCoupons: y.publicCoupons,
3505
+ discount: y.discount,
3506
+ selectedTicket: l.selectedTicket
3507
+ })] }),
3508
+ /* @__PURE__ */ P("div", {
3509
+ className: Z("flex flex-col gap-4", T && "border-border border-t pt-4"),
3510
+ children: [T && /* @__PURE__ */ N("span", {
3511
+ className: "font-medium text-ink text-sm",
3512
+ children: "Your details"
3513
+ }), /* @__PURE__ */ N(yr, {
3514
+ values: d.values,
3515
+ errors: d.errors,
3516
+ touched: d.touched,
3517
+ onChange: d.setField,
3518
+ onBlur: d.touchField,
3519
+ showBusinessBilling: x,
3520
+ registrationFields: u,
3521
+ nameInputRef: v
3166
3522
  })]
3167
- }), /* @__PURE__ */ C("div", { children: [z && /* @__PURE__ */ S("div", {
3168
- className: "mb-4 rounded-md bg-red-50 p-3 text-red-600 text-sm",
3169
- children: z
3170
- }), L === 1 ? /* @__PURE__ */ S("div", { children: M ? /* @__PURE__ */ S(br, {
3171
- couponCode: v,
3172
- onCouponCodeChange: y,
3173
- couponError: k,
3174
- couponLoading: E,
3175
- onValidateCoupon: he,
3176
- publicCoupons: V,
3177
- onBack: ve,
3178
- selectedTicket: m
3179
- }) : /* @__PURE__ */ S(wr, {
3180
- tickets: o,
3181
- selectedTicket: m,
3182
- onSelectTicket: ge,
3183
- discount: w,
3184
- couponCode: v,
3185
- publicCouponsCount: V.length,
3186
- onApplyCouponClick: () => F(!0),
3187
- onRemoveCoupon: _e,
3188
- onNext: () => R(2)
3189
- }) }) : /* @__PURE__ */ S(pr, {
3190
- values: H,
3191
- handleChange: ye,
3192
- handleBlur: be,
3193
- handleSubmit: xe,
3194
- registerLoading: f,
3195
- onBack: () => R(1),
3196
- submitLabel: q,
3197
- showBusinessBilling: !ne
3198
- })] })]
3199
- })] })
3200
- }),
3201
- g && /* @__PURE__ */ S(Sr, {
3202
- paymentData: g,
3203
- ticketData: o,
3204
- type: "confirm"
3205
- }),
3206
- W && le && /* @__PURE__ */ S(Cr, {
3207
- isOpen: W,
3208
- onClose: G,
3209
- stripePromise: oe,
3210
- clientSecret: le.clientSecret,
3211
- onComplete: fe
3523
+ })
3524
+ ]
3212
3525
  })
3213
- ] });
3214
- }, Ar = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, jr = (e) => typeof e == "string" && e.trim() ? e : void 0, Mr = (e) => typeof e == "string" ? e : e?.location ?? void 0, Nr = (e, t) => {
3526
+ })] });
3527
+ }, vi = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, yi = (e) => typeof e == "string" && e.trim() ? e : void 0, bi = (e) => typeof e == "string" ? e : e?.location ?? void 0, xi = (e, t) => {
3215
3528
  let n = e.meta ?? {}, r = e.title && t ? `${e.title} | ${t}` : e.title || t || void 0;
3216
3529
  return {
3217
3530
  title: n.meta_title || r,
@@ -3221,32 +3534,32 @@ var pr = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
3221
3534
  og: {
3222
3535
  title: n.og_title || void 0,
3223
3536
  description: n.og_description || void 0,
3224
- image: Mr(n.og_image),
3537
+ image: bi(n.og_image),
3225
3538
  url: n.og_url || void 0
3226
3539
  },
3227
3540
  twitter: { card: n.twitter_card || void 0 },
3228
3541
  ldJson: n.ld_json || void 0,
3229
3542
  customHead: n.head_code || void 0
3230
3543
  };
3231
- }, Pr = (e) => ({
3544
+ }, Si = (e) => ({
3232
3545
  description: e.description || void 0,
3233
3546
  customHead: e.settings?.head_code || void 0
3234
- }), Fr = (e) => (t = {}, n) => (r) => {
3235
- let i = Nr(t, e.name);
3547
+ }), Ci = (e) => (t = {}, n) => (r) => {
3548
+ let i = xi(t, e.name);
3236
3549
  if (n) {
3237
3550
  let t = r?.loaderData?.[n.source];
3238
3551
  if (t) {
3239
- let r = n.title ? jr(t[n.title]) : void 0;
3552
+ let r = n.title ? yi(t[n.title]) : void 0;
3240
3553
  r && (i.title = e.name ? `${r} | ${e.name}` : r, i.og = {
3241
3554
  ...i.og,
3242
3555
  title: r
3243
3556
  });
3244
- let a = n.description ? jr(t[n.description]) : void 0;
3557
+ let a = n.description ? yi(t[n.description]) : void 0;
3245
3558
  a && (i.description = a, i.og = {
3246
3559
  ...i.og,
3247
3560
  description: a
3248
3561
  });
3249
- let o = n.image ? Mr(t[n.image]) : void 0;
3562
+ let o = n.image ? bi(t[n.image]) : void 0;
3250
3563
  o && (i.og = {
3251
3564
  ...i.og,
3252
3565
  image: o
@@ -3255,31 +3568,31 @@ var pr = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
3255
3568
  }
3256
3569
  if (!i.canonical) {
3257
3570
  let t = r?.match?.pathname, n = (e.domain || "").trim();
3258
- n && t?.startsWith("/") && (i.canonical = (/^https?:\/\//.test(n) ? n : `https://${n}`).replace(/\/+$/, "") + Ar(t));
3571
+ n && t?.startsWith("/") && (i.canonical = (/^https?:\/\//.test(n) ? n : `https://${n}`).replace(/\/+$/, "") + vi(t));
3259
3572
  }
3260
- let a = ur(i, Pr(e)), o = t.id?.trim();
3573
+ let a = ur(i, Si(e)), o = t.id?.trim();
3261
3574
  return o && a.meta.push({
3262
3575
  name: Bn,
3263
3576
  content: o
3264
3577
  }), a;
3265
- }, Ir = (e) => {
3266
- let t = Ee(e);
3578
+ }, wi = (e) => {
3579
+ let t = Oe(e);
3267
3580
  return (e, n) => {
3268
- let { rules: r, invalid: i } = ve(n?.access), a = r.length > 0 || i;
3269
- return ({ context: n, params: r }) => a ? Promise.resolve({}) : ze({
3581
+ let { rules: r, invalid: i } = be(n?.access), a = r.length > 0 || i;
3582
+ return ({ context: n, params: r }) => a ? Promise.resolve({}) : Ve({
3270
3583
  queryClient: n.queryClient,
3271
3584
  config: t,
3272
3585
  sources: e,
3273
3586
  params: r
3274
3587
  });
3275
3588
  };
3276
- }, Lr = 2, Rr = (e) => {
3277
- let { limit: t = 20, debounceMs: n = 300, hotkey: r = !0 } = e ?? {}, a = i(), o = Kn(), s = J(), [c, l] = P(""), [u, d] = P(!1), [f, p] = P("");
3278
- A(() => {
3589
+ }, Ti = 2, Ei = (e) => {
3590
+ let { limit: t = 20, debounceMs: n = 300, hotkey: r = !0 } = e ?? {}, a = i(), o = Kn(), s = G(), [c, l] = A(""), [u, d] = A(!1), [f, p] = A("");
3591
+ E(() => {
3279
3592
  let e = setTimeout(() => p(c.trim()), n);
3280
3593
  return () => clearTimeout(e);
3281
3594
  }, [c, n]);
3282
- let m = f.length >= Lr, h = z({
3595
+ let m = f.length >= Ti, h = R({
3283
3596
  queryKey: [
3284
3597
  "levo-search",
3285
3598
  o?.id ?? null,
@@ -3299,12 +3612,12 @@ var pr = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
3299
3612
  }
3300
3613
  },
3301
3614
  enabled: s && !!a && !!o?.id && m,
3302
- placeholderData: L,
3615
+ placeholderData: I,
3303
3616
  staleTime: 3e4
3304
- }), g = O(() => {
3617
+ }), g = w(() => {
3305
3618
  l(""), p("");
3306
- }, []), _ = O(() => d(!0), []), v = O(() => d(!1), []);
3307
- A(() => {
3619
+ }, []), _ = w(() => d(!0), []), v = w(() => d(!1), []);
3620
+ E(() => {
3308
3621
  if (!r) return;
3309
3622
  let e = (e) => {
3310
3623
  e.key !== "k" || !(e.metaKey || e.ctrlKey) || (e.preventDefault(), d((e) => !e));
@@ -3328,4 +3641,4 @@ var pr = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
3328
3641
  };
3329
3642
  };
3330
3643
  //#endregion
3331
- export { Et as ColorModeProvider, Fn as Inspector, de as LEVO_AUTH_METHODS, Y as LEVO_AUTH_QUERY_KEY, G as LEVO_OAUTH_METHODS, dt as LEVO_OTP_LENGTH, tt as LEVO_PENDING_APPROVAL_CODE, ue as LEVO_PRIMARY_AUTH_METHODS, m as LOCALE_COOKIE, l as LOCALE_REDIRECT_CACHE_CONTROL, vt as LevoChat, Ue as LevoEntryForm, kr as LevoEventRegister, Ot as LevoForm, Un as LevoPopups, Je as LevoProfileForm, Yn as LevoSiteProvider, er as LocaleHreflang, nr as LocaleProvider, Bn as PAGE_ID_META, dr as PageHead, ar as SiteLocaleProvider, $n as buildHreflangLinks, Fr as createLevoHead, Ir as createLevoLoader, _ as createRouteTreeMatcher, Te as createSiteClient, we as decideAccess, v as extractGeoAndLanguageData, nt as isPendingApprovalError, ft as isValidEmail, pt as isValidOtp, ht as isValidPhone, Xn as localeBeforeLoad, p as localePath, d as localeRedirectResponse, mt as normalizePhone, ur as pageHead, ve as parseAccess, lr as parseRawHead, ze as prefetchLevoSources, Zn as readLocaleConfig, Vn as readPageId, ye as resolveAuthMethods, g as resolveLocale, u as resolveLocaleRedirect, s as resolveLocaleRequest, Ee as siteConfigFromJson, f as splitLocalePrefix, Dt as useColorMode, or as useLanguageOptions, et as useLevoAccess, He as useLevoAuth, Le as useLevoForm, Jn as useLevoInsights, at as useLevoLogin, ut as useLevoOAuth, gt as useLevoOtpInput, Ie as useLevoRecord, Rr as useLevoSearch, qn as useLevoSite, Fe as useLevoSource, rr as useLocale, ir as useUrlLocale };
3644
+ export { Ot as ColorModeProvider, Fn as Inspector, pe as LEVO_AUTH_METHODS, K as LEVO_AUTH_QUERY_KEY, fe as LEVO_OAUTH_METHODS, pt as LEVO_OTP_LENGTH, rt as LEVO_PENDING_APPROVAL_CODE, H as LEVO_PRIMARY_AUTH_METHODS, m as LOCALE_COOKIE, l as LOCALE_REDIRECT_CACHE_CONTROL, bt as LevoChat, Ge as LevoEntryForm, _i as LevoEventRegister, At as LevoForm, Un as LevoPopups, Xe as LevoProfileForm, Yn as LevoSiteProvider, er as LocaleHreflang, nr as LocaleProvider, Bn as PAGE_ID_META, dr as PageHead, ar as SiteLocaleProvider, $n as buildHreflangLinks, Ci as createLevoHead, wi as createLevoLoader, _ as createRouteTreeMatcher, De as createSiteClient, Ee as decideAccess, v as extractGeoAndLanguageData, it as isPendingApprovalError, mt as isValidEmail, ht as isValidOtp, _t as isValidPhone, Xn as localeBeforeLoad, p as localePath, d as localeRedirectResponse, gt as normalizePhone, ur as pageHead, be as parseAccess, lr as parseRawHead, Ve as prefetchLevoSources, Zn as readLocaleConfig, Vn as readPageId, xe as resolveAuthMethods, g as resolveLocale, u as resolveLocaleRedirect, s as resolveLocaleRequest, Oe as siteConfigFromJson, f as splitLocalePrefix, kt as useColorMode, or as useLanguageOptions, nt as useLevoAccess, We as useLevoAuth, ze as useLevoForm, Jn as useLevoInsights, st as useLevoLogin, ft as useLevoOAuth, vt as useLevoOtpInput, Re as useLevoRecord, Ei as useLevoSearch, qn as useLevoSite, Le as useLevoSource, rr as useLocale, ir as useUrlLocale };