@levo-so/site-runtime 0.3.18 → 0.3.20

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