@levo-so/site-runtime 0.3.19 → 0.3.21

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