@levo-so/site-runtime 0.3.24 → 0.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a as e, n as t } from "./dist-BVFCdirT.js";
2
+ import { a as e, n as t } from "./dist-B_29IiED.js";
3
3
  import { c as n, o as r, s as i, t as a } from "./inlineBaseTheme-DcNdMEYp.js";
4
4
  import { t as o } from "./inlineCollectionTheme-DjXuH3bK.js";
5
5
  import { a as s, c, d as l, f as u, i as d, l as f, n as p, o as m, r as h, s as g, t as _, u as v } from "./routes-DO1BLfh9.js";
@@ -8,31 +8,32 @@ import { Suspense as x, createContext as S, lazy as C, useCallback as w, useCont
8
8
  import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
9
9
  import { Dialog as F } from "@base-ui/react/dialog";
10
10
  import { keepPreviousData as I, useMutation as L, useQuery as R, useQueryClient as z } from "@tanstack/react-query";
11
- import { ScriptOnce as ee, redirect as te, useRouterState as B } from "@tanstack/react-router";
11
+ import { Link as ee, ScriptOnce as B, redirect as te, useRouterState as V } from "@tanstack/react-router";
12
12
  import { createLevoInsights as ne } from "@levo-so/insights";
13
- import { CalendarPlusIcon as re, CheckIcon as ie, ChevronDownIcon as ae, DownloadIcon as oe, LoaderCircleIcon as se, XIcon as ce } from "lucide-react";
14
- import { Popover as V } from "@base-ui/react/popover";
15
- import { useRazorpay as le } from "react-razorpay";
16
- import { EmbeddedCheckout as ue, EmbeddedCheckoutProvider as de } from "@stripe/react-stripe-js";
13
+ import { ArrowLeftIcon as re, CalendarPlusIcon as ie, CheckIcon as H, ChevronDownIcon as ae, DownloadIcon as oe, LoaderCircleIcon as se, MinusIcon as ce, PlusIcon as le, XIcon as ue } from "lucide-react";
14
+ import { Accordion as U } from "@base-ui/react/accordion";
15
+ import { Popover as W } from "@base-ui/react/popover";
16
+ import { useRazorpay as de } from "react-razorpay";
17
+ import { EmbeddedCheckout as fe, EmbeddedCheckoutProvider as pe } from "@stripe/react-stripe-js";
17
18
  //#region src/access/types.ts
18
- var H = [
19
+ var me = [
19
20
  "otp",
20
21
  "magiclink",
21
22
  "whatsapp"
22
- ], fe = [
23
+ ], he = [
23
24
  "google",
24
25
  "microsoft",
25
26
  "linkedin"
26
- ], pe = [...H, ...fe], me = "otp", U = (e) => typeof e == "object" && !!e && !Array.isArray(e), he = (e) => H.includes(e), ge = (e) => fe.includes(e), _e = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], ve = (e) => e, ye = (e) => {
27
- if (!U(e)) return null;
28
- let t = e.enabled === void 0 ? !0 : e.enabled === !0, n = U(e.options) ? e.options : {};
27
+ ], ge = [...me, ...he], _e = "otp", ve = (e) => typeof e == "object" && !!e && !Array.isArray(e), ye = (e) => me.includes(e), be = (e) => he.includes(e), xe = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], Se = (e) => e, Ce = (e) => {
28
+ if (!ve(e)) return null;
29
+ let t = e.enabled === void 0 ? !0 : e.enabled === !0, n = ve(e.options) ? e.options : {};
29
30
  switch (e.kind) {
30
31
  case "authentication": return {
31
32
  kind: "authentication",
32
33
  enabled: t,
33
34
  options: {
34
- methods: _e(n.methods).filter((e) => he(e) || ge(e)),
35
- ...he(n.primary_method) ? { primary_method: n.primary_method } : {}
35
+ methods: xe(n.methods).filter((e) => ye(e) || be(e)),
36
+ ...ye(n.primary_method) ? { primary_method: n.primary_method } : {}
36
37
  }
37
38
  };
38
39
  case "gating": return typeof n.collection != "string" || !n.collection.trim() ? null : {
@@ -40,71 +41,71 @@ var H = [
40
41
  enabled: t,
41
42
  options: {
42
43
  collection: n.collection.trim(),
43
- ...U(n.condition) ? { condition: ve(n.condition) } : {},
44
- hidden: _e(n.hidden)
44
+ ...ve(n.condition) ? { condition: Se(n.condition) } : {},
45
+ hidden: xe(n.hidden)
45
46
  }
46
47
  };
47
48
  case "profile": return {
48
49
  kind: "profile",
49
50
  enabled: t,
50
51
  options: {
51
- ...U(n.condition) ? { condition: ve(n.condition) } : {},
52
- hidden: _e(n.hidden)
52
+ ...ve(n.condition) ? { condition: Se(n.condition) } : {},
53
+ hidden: xe(n.hidden)
53
54
  }
54
55
  };
55
56
  default: return null;
56
57
  }
57
- }, be = (e) => {
58
+ }, we = (e) => {
58
59
  if (!Array.isArray(e) || e.length === 0) return {
59
60
  rules: [],
60
61
  invalid: !1
61
62
  };
62
- let t = e.map(ye).filter((e) => e !== null);
63
+ let t = e.map(Ce).filter((e) => e !== null);
63
64
  return {
64
65
  rules: t.filter((e) => e.enabled !== !1),
65
66
  invalid: t.length === 0
66
67
  };
67
- }, xe = (e) => {
68
+ }, Te = (e) => {
68
69
  let t = e.find((e) => e.kind === "authentication"), n = t?.kind === "authentication" ? t.options?.methods ?? [] : [];
69
70
  return {
70
- primary: (t?.kind === "authentication" ? t.options?.primary_method : void 0) ?? n.find(he) ?? me,
71
- oauth: n.filter(ge)
71
+ primary: (t?.kind === "authentication" ? t.options?.primary_method : void 0) ?? n.find(ye) ?? _e,
72
+ oauth: n.filter(be)
72
73
  };
73
- }, Se = (e = null) => ({
74
+ }, Ee = (e = null) => ({
74
75
  state: "granted",
75
76
  code: e,
76
77
  message: null,
77
78
  rule: null
78
- }), Ce = () => ({
79
+ }), De = () => ({
79
80
  state: "checking",
80
81
  code: null,
81
82
  message: null,
82
83
  rule: null
83
- }), W = (e, t, n = null) => ({
84
+ }), G = (e, t, n = null) => ({
84
85
  state: "blocked",
85
86
  code: e,
86
87
  message: t,
87
88
  rule: n
88
- }), we = (e, t) => {
89
+ }), Oe = (e, t) => {
89
90
  let n = t?.split(".")[0];
90
91
  return e.find((e) => e.kind === n) ?? null;
91
- }, Te = (e, t) => {
92
+ }, ke = (e, t) => {
92
93
  let n = (e) => t.find((t) => t.kind === e);
93
- if (e === "granted") return Se();
94
- if (e === "signed_out") return W("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", n("authentication") ?? t[0] ?? null);
94
+ if (e === "granted") return Ee();
95
+ if (e === "signed_out") return G("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", n("authentication") ?? t[0] ?? null);
95
96
  let r = n("gating");
96
- if (e === "entry_missing" && r) return W("gating.ENTRY_NOT_FOUND", null, r);
97
- if (e === "entry_under_review" && r) return W("gating.ENTRY_CONDITION_NOT_FULFILLED", "Your submission is being reviewed.", r);
97
+ if (e === "entry_missing" && r) return G("gating.ENTRY_NOT_FOUND", null, r);
98
+ if (e === "entry_under_review" && r) return G("gating.ENTRY_CONDITION_NOT_FULFILLED", "Your submission is being reviewed.", r);
98
99
  let i = n("profile");
99
- return e === "profile_incomplete" && i ? W("profile.CONDITION_NOT_FULFILLED", null, i) : null;
100
- }, Ee = ({ rules: e, invalid: t, pageId: n, hasClient: r, isReady: i, isLoggedIn: a, check: o, preview: s }) => {
101
- if (e.length === 0 && !t) return Se();
100
+ return e === "profile_incomplete" && i ? G("profile.CONDITION_NOT_FULFILLED", null, i) : null;
101
+ }, Ae = ({ rules: e, invalid: t, pageId: n, hasClient: r, isReady: i, isLoggedIn: a, check: o, preview: s }) => {
102
+ if (e.length === 0 && !t) return Ee();
102
103
  if (s) {
103
- let t = Te(s, e);
104
+ let t = ke(s, e);
104
105
  if (t) return t;
105
106
  }
106
- return t ? W("access.CONFIG_INVALID", "This page's access rules could not be read.") : i ? r ? a ? n ? o.isError ? W("access.CHECK_FAILED", "We could not verify your access.") : o.isSuccess ? o.data ? o.data.has_access ? Se(o.data.code ?? null) : W(o.data.code ?? "access.CHECK_FAILED", o.data.message ?? null, we(e, o.data.code)) : W("access.CHECK_FAILED", "We could not verify your access.") : Ce() : W("access.PAGE_NOT_IDENTIFIED", "This page is not linked to its access rules yet.") : W("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", e.find((e) => e.kind === "authentication") ?? e[0] ?? null) : W("access.UNWIRED", "This site is not connected to an account system.") : Ce();
107
- }, De = (e) => {
107
+ return t ? G("access.CONFIG_INVALID", "This page's access rules could not be read.") : i ? r ? a ? n ? o.isError ? G("access.CHECK_FAILED", "We could not verify your access.") : o.isSuccess ? o.data ? o.data.has_access ? Ee(o.data.code ?? null) : G(o.data.code ?? "access.CHECK_FAILED", o.data.message ?? null, Oe(e, o.data.code)) : G("access.CHECK_FAILED", "We could not verify your access.") : De() : G("access.PAGE_NOT_IDENTIFIED", "This page is not linked to its access rules yet.") : G("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", e.find((e) => e.kind === "authentication") ?? e[0] ?? null) : G("access.UNWIRED", "This site is not connected to an account system.") : De();
108
+ }, je = (e) => {
108
109
  let t = (e?.apiUrl || "").replace(/\/$/, "");
109
110
  return t ? y({
110
111
  apiUrl: t,
@@ -113,15 +114,15 @@ var H = [
113
114
  NODE_ENV: "",
114
115
  APP_MODE: e?.appMode || "production"
115
116
  }) : null;
116
- }, Oe = (e) => ({
117
+ }, Me = (e) => ({
117
118
  apiUrl: e.levo?.api_url || "",
118
119
  workspace: e.workspace_id || "",
119
120
  siteId: e.id || "",
120
121
  insightsUrl: e.levo?.insights_url || null,
121
122
  appMode: e.levo?.app_mode || "production"
122
- }), ke = /\{\$([A-Za-z0-9_]+)\}/g, Ae = (e) => {
123
+ }), Ne = /\{\$([A-Za-z0-9_]+)\}/g, Pe = (e) => {
123
124
  let t = [], n = [], r = 0;
124
- for (let i of e.matchAll(ke)) n.push(e.slice(r, i.index)), t.push(i[1]), r = i.index + i[0].length;
125
+ for (let i of e.matchAll(Ne)) n.push(e.slice(r, i.index)), t.push(i[1]), r = i.index + i[0].length;
125
126
  n.push(e.slice(r));
126
127
  let i = (t) => /* @__PURE__ */ Error(`Levo pattern "${e}" ${t}`);
127
128
  if (t.length === 0) throw i("names no variable: write each record as {$name}");
@@ -132,10 +133,10 @@ var H = [
132
133
  names: t,
133
134
  literals: n
134
135
  };
135
- }, je = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), Me = ({ literals: e }) => RegExp(`^${e.map(je).join("([^/]+)")}$`), Ne = /* @__PURE__ */ new Set(), Pe = (e, t, n) => {
136
- let r = Ae(t), i = Me(r), a = (e) => {
136
+ }, Fe = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), Ie = ({ literals: e }) => RegExp(`^${e.map(Fe).join("([^/]+)")}$`), Le = /* @__PURE__ */ new Set(), Re = (e, t, n) => {
137
+ let r = Pe(t), i = Ie(r), a = (e) => {
137
138
  let n = e;
138
- return t.replace(ke, (e, r) => {
139
+ return t.replace(Ne, (e, r) => {
139
140
  let i = n[r];
140
141
  if (!i) throw Error(`Levo pattern "${t}" has no value for {$${r}}`);
141
142
  return i;
@@ -143,9 +144,9 @@ var H = [
143
144
  };
144
145
  return {
145
146
  parse: (t) => {
146
- if (!(e in t)) {
147
+ if (!Object.hasOwn(t, e)) {
147
148
  let n = Object.keys(t).join(", ") || "none";
148
- return Ne.has(e) || (Ne.add(e), console.error(`levoParams("${e}", …) names a param this route does not have. Its params are: ${n}. The first argument must be the file's $param name.`)), !1;
149
+ return Le.has(e) || (Le.add(e), console.error(`levoParams("${e}", …) names a param this route does not have. Its params are: ${n}. The first argument must be the file's $param name.`)), !1;
149
150
  }
150
151
  let n = t[e], a = n ? i.exec(n) : null;
151
152
  if (!a) return !1;
@@ -161,33 +162,33 @@ var H = [
161
162
  [e]: a(t)
162
163
  })
163
164
  };
164
- }, Fe = (e, t, n) => t in n ? null : `Record binding "${e}" reads param "${t}", but this route has no such param. Its params are: ${Object.keys(n).join(", ") || "none"}. On a levoParams page, param names a pattern variable (packages, cities), never the segment.`, Ie = (e) => [
165
+ }, ze = (e, t, n) => Object.prototype.hasOwnProperty.call(n, t) ? null : `Record binding "${e}" reads param "${t}", but this route has no such param. Its params are: ${Object.keys(n).join(", ") || "none"}. On a levoParams page, param names a pattern variable (packages, cities), never the segment.`, Be = (e) => [
165
166
  "levo-source",
166
167
  "list",
167
168
  e.module,
168
169
  e.identifier,
169
170
  e.query ?? null,
170
171
  e.options ?? null
171
- ], Le = (e, t) => [
172
+ ], Ve = (e, t) => [
172
173
  "levo-source",
173
174
  "record",
174
175
  e.module,
175
176
  e.identifier,
176
177
  t ?? null
177
- ], Re = (e) => [
178
+ ], He = (e) => [
178
179
  "levo-source",
179
180
  "form",
180
181
  e.module,
181
182
  e.identifier
182
- ], ze = {
183
+ ], Ue = {
183
184
  blog_author: "author",
184
185
  blog_category: "category",
185
186
  blog_tag: "tag"
186
- }, Be = (e, t) => {
187
- let n = encodeURIComponent(e.identifier), r = t ? `${encodeURIComponent(t)}/get-single` : "list", i = ze[e.module];
187
+ }, We = (e, t) => {
188
+ let n = encodeURIComponent(e.identifier), r = t ? `${encodeURIComponent(t)}/get-single` : "list", i = Ue[e.module];
188
189
  return i ? `/v1/blog/${n}/${i}/${r}` : e.module === "community" ? `/v1/community/${n}/post/${r}` : null;
189
- }, Ve = async (e, t) => {
190
- let n = Be(t);
190
+ }, Ge = async (e, t) => {
191
+ let n = We(t);
191
192
  if (n) {
192
193
  let r = await e.fetch.url(n).post(t.query ?? {}).json();
193
194
  return {
@@ -203,16 +204,16 @@ var H = [
203
204
  data: r.content.data ?? [],
204
205
  meta: r.content.meta ?? null
205
206
  };
206
- }, He = async (e, t, n) => {
207
- let r = Be(t, n);
207
+ }, Ke = async (e, t, n) => {
208
+ let r = We(t, n);
208
209
  return r ? (await e.fetch.url(r).get().json()).content.data ?? null : (t.module === "collection" ? await e.collection.getCollectionContent({
209
210
  collection_key: t.identifier,
210
211
  slug: n
211
212
  }) : 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;
212
- }, Ue = async (e, t) => (await e.collection.getCollectionByIDExpanded(t.identifier)).content.data ?? null, We = (e) => {
213
+ }, qe = async (e, t) => (await e.collection.getCollectionByIDExpanded(t.identifier)).content.data ?? null, Je = (e) => {
213
214
  let t = i(), n = R({
214
- queryKey: Ie(e),
215
- queryFn: () => Ve(t, e),
215
+ queryKey: Be(e),
216
+ queryFn: () => Ge(t, e),
216
217
  enabled: !!t
217
218
  });
218
219
  return {
@@ -225,10 +226,10 @@ var H = [
225
226
  ...e
226
227
  }) }
227
228
  };
228
- }, Ge = (e, t) => {
229
+ }, Ye = (e, t) => {
229
230
  let n = i(), r = R({
230
- queryKey: Le(e, t),
231
- queryFn: () => He(n, e, t),
231
+ queryKey: Ve(e, t),
232
+ queryFn: () => Ke(n, e, t),
232
233
  enabled: !!n && !!t
233
234
  });
234
235
  return {
@@ -240,10 +241,10 @@ var H = [
240
241
  ...e
241
242
  }) }
242
243
  };
243
- }, Ke = (e) => {
244
+ }, Xe = (e) => {
244
245
  let t = i(), n = R({
245
- queryKey: Re(e),
246
- queryFn: () => Ue(t, e),
246
+ queryKey: He(e),
247
+ queryFn: () => qe(t, e),
247
248
  enabled: !!t
248
249
  });
249
250
  return {
@@ -255,35 +256,35 @@ var H = [
255
256
  ...e
256
257
  }) }
257
258
  };
258
- }, qe = (e) => {
259
+ }, Ze = (e) => {
259
260
  let t = Object.values(e ?? {});
260
261
  return t.length === 1 ? t[0] : e?.slug;
261
- }, Je = async ({ queryClient: e, config: t, sources: n, params: r }) => {
262
- let i = De(t);
262
+ }, Qe = async ({ queryClient: e, config: t, sources: n, params: r }) => {
263
+ let i = je(t);
263
264
  if (!i || !n) return {};
264
265
  let a = await Promise.all(Object.entries(n).map(async ([t, n]) => {
265
266
  if (n.mode === "record") {
266
- let a = n.param ? Fe(t, n.param, r ?? {}) : null;
267
+ let a = n.param ? ze(t, n.param, r ?? {}) : null;
267
268
  if (a) {
268
269
  if (i.APP_MODE !== "production") throw Error(a);
269
270
  return i.logger.error(a), [t, null];
270
271
  }
271
- let o = n.param ? r?.[n.param] : qe(r);
272
+ let o = n.param ? r?.[n.param] : Ze(r);
272
273
  return o ? [t, await e.ensureQueryData({
273
- queryKey: Le(n, o),
274
- queryFn: () => He(i, n, o)
274
+ queryKey: Ve(n, o),
275
+ queryFn: () => Ke(i, n, o)
275
276
  }).catch(() => null)] : [t, null];
276
277
  }
277
278
  return n.mode === "form" ? [t, await e.ensureQueryData({
278
- queryKey: Re(n),
279
- queryFn: () => Ue(i, n)
279
+ queryKey: He(n),
280
+ queryFn: () => qe(i, n)
280
281
  }).catch(() => null)] : [t, await e.ensureQueryData({
281
- queryKey: Ie(n),
282
- queryFn: () => Ve(i, n)
282
+ queryKey: Be(n),
283
+ queryFn: () => Ge(i, n)
283
284
  }).catch(() => null)];
284
285
  }));
285
286
  return Object.fromEntries(a);
286
- }, Ye = {
287
+ }, $e = {
287
288
  background: "var(--color-page)",
288
289
  foreground: "var(--color-ink)",
289
290
  text: "var(--color-ink)",
@@ -305,10 +306,10 @@ var H = [
305
306
  input: "var(--color-background1)",
306
307
  inputForeground: "var(--color-ink)",
307
308
  ring: "var(--color-brand)"
308
- }, Xe = (e) => O(() => ({
309
+ }, et = (e) => O(() => ({
309
310
  ...a({
310
311
  colors: {
311
- ...Ye,
312
+ ...$e,
312
313
  ...e?.colors
313
314
  },
314
315
  radius: e?.radius ?? "var(--radius-token)",
@@ -321,15 +322,15 @@ var H = [
321
322
  }), [e]);
322
323
  //#endregion
323
324
  //#region src/hooks/useMounted.ts
324
- function G() {
325
+ function K() {
325
326
  let [e, t] = A(!1);
326
327
  return E(() => t(!0), []), e;
327
328
  }
328
329
  //#endregion
329
330
  //#region src/access/useLevoAuth.ts
330
- var K = ["levo-auth", "session"], Ze = () => {
331
- let e = i(), t = z(), n = G(), r = R({
332
- queryKey: K,
331
+ var q = ["levo-auth", "session"], tt = () => {
332
+ let e = i(), t = z(), n = K(), r = R({
333
+ queryKey: q,
333
334
  queryFn: async () => {
334
335
  try {
335
336
  return await e?.membership?.getMe() ?? null;
@@ -344,12 +345,12 @@ var K = ["levo-auth", "session"], Ze = () => {
344
345
  mutationFn: async () => {
345
346
  await e?.membership?.signOut();
346
347
  },
347
- onSettled: () => t.invalidateQueries({ queryKey: K }),
348
+ onSettled: () => t.invalidateQueries({ queryKey: q }),
348
349
  onError: (t) => {
349
350
  e?.logger?.error("Sign out failed", { exception: b(t) });
350
351
  }
351
352
  }), o = w(async () => {
352
- await t.invalidateQueries({ queryKey: K });
353
+ await t.invalidateQueries({ queryKey: q });
353
354
  }, [t]), s = w(async () => {
354
355
  await a.mutateAsync().catch(() => void 0);
355
356
  }, [a]), c = r.data ?? null;
@@ -362,11 +363,11 @@ var K = ["levo-auth", "session"], Ze = () => {
362
363
  signOut: s,
363
364
  isSigningOut: a.isPending
364
365
  };
365
- }, Qe = ({ collection: e, hidden: n, submitLabel: r = "Submit", onSuccess: a, theme: o, className: s }) => {
366
- let c = i(), { account: l } = Ze(), { schema: u, isLoading: d } = Ke({
366
+ }, nt = ({ collection: e, hidden: n, submitLabel: r = "Submit", onSuccess: a, theme: o, className: s }) => {
367
+ let c = i(), { account: l } = tt(), { schema: u, isLoading: d } = Xe({
367
368
  module: "collection",
368
369
  identifier: e
369
- }), f = Xe(o);
370
+ }), f = et(o);
370
371
  return c ? /* @__PURE__ */ N("div", {
371
372
  className: s,
372
373
  children: /* @__PURE__ */ N(t, {
@@ -390,17 +391,17 @@ var K = ["levo-auth", "session"], Ze = () => {
390
391
  onSuccess: () => a?.()
391
392
  })
392
393
  }) : null;
393
- }, $e = "so_levo_membership_account", et = [
394
+ }, rt = "so_levo_membership_account", it = [
394
395
  "profile_picture",
395
396
  "first_name",
396
397
  "last_name",
397
398
  "email",
398
399
  "username",
399
400
  "socials"
400
- ], tt = ["email", "username"], nt = (e) => et.includes(e.key) || e.editable === !0, rt = ({ hidden: t, submitLabel: n = "Save and continue", onSuccess: r, errorClassName: a = "text-sm text-[var(--color-danger)]", theme: o, className: s }) => {
401
- let c = i(), l = G(), { account: u } = Ze(), d = Xe(o), [f, p] = A(""), m = R({
401
+ ], at = ["email", "username"], ot = (e) => it.includes(e.key) || e.editable === !0, st = ({ hidden: t, submitLabel: n = "Save and continue", onSuccess: r, errorClassName: a = "text-sm text-[var(--color-danger)]", theme: o, className: s }) => {
402
+ let c = i(), l = K(), { account: u } = tt(), d = et(o), [f, p] = A(""), m = R({
402
403
  queryKey: ["levo-access", "profile-schema"],
403
- queryFn: async () => (await c?.collection?.getCollectionByIDExpanded($e))?.content?.data ?? null,
404
+ queryFn: async () => (await c?.collection?.getCollectionByIDExpanded(rt))?.content?.data ?? null,
404
405
  enabled: l && !!c,
405
406
  staleTime: 5 * 6e4,
406
407
  retry: 1
@@ -412,14 +413,14 @@ var K = ["levo-auth", "session"], Ze = () => {
412
413
  ...e,
413
414
  fields: e.fields?.map((e) => ({
414
415
  ...e,
415
- hidden: !nt(e) || !!t?.includes(e.key),
416
- readonly: e.readonly || tt.includes(e.key)
416
+ hidden: !ot(e) || !!t?.includes(e.key),
417
+ readonly: e.readonly || at.includes(e.key)
417
418
  }))
418
419
  }))
419
420
  } : null;
420
421
  }, [m.data, h]), _ = L({
421
422
  mutationFn: async (e) => {
422
- let n = g?.sections?.flatMap((e) => e?.fields ?? [])?.filter((e) => nt(e) && !tt.includes(e.key) && !t?.includes(e.key))?.map((e) => e?.key) ?? [];
423
+ let n = g?.sections?.flatMap((e) => e?.fields ?? [])?.filter((e) => ot(e) && !at.includes(e.key) && !t?.includes(e.key))?.map((e) => e?.key) ?? [];
423
424
  await c?.membership?.updateMe(Object.fromEntries(Object.entries(e).filter(([e]) => n.includes(e))));
424
425
  },
425
426
  onMutate: () => p(""),
@@ -450,15 +451,15 @@ var K = ["levo-auth", "session"], Ze = () => {
450
451
  onSubmit: (e) => _.mutate(e)
451
452
  }) : null]
452
453
  }) : null;
453
- }, it = null, at = /* @__PURE__ */ new Set(), ot = (e) => {
454
- if (it !== e) {
455
- it = e;
456
- for (let e of at) e();
454
+ }, ct = null, lt = /* @__PURE__ */ new Set(), ut = (e) => {
455
+ if (ct !== e) {
456
+ ct = e;
457
+ for (let e of lt) e();
457
458
  }
458
- }, st = (e) => (at.add(e), () => {
459
- at.delete(e);
460
- }), ct = () => j(st, () => it, () => null), lt = (e) => {
461
- let t = i(), n = z(), r = G(), { isLoggedIn: a, isLoaded: o } = Ze(), s = ct(), 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({
459
+ }, dt = (e) => (lt.add(e), () => {
460
+ lt.delete(e);
461
+ }), ft = () => j(dt, () => ct, () => null), pt = (e) => {
462
+ let t = i(), n = z(), r = K(), { isLoggedIn: a, isLoaded: o } = tt(), s = ft(), c = e.id?.trim() || "", { rules: l, invalid: u } = O(() => we(e.access), [e.access]), d = O(() => Te(l), [l]), f = r && !!t && l.length > 0 && !u && !!c && a && !s, p = R({
462
463
  queryKey: ["levo-access", c],
463
464
  queryFn: async () => (await t?.fetch.url(`/v1/builder/page/${c}/check-access`).post().json())?.content?.data ?? null,
464
465
  enabled: f,
@@ -473,10 +474,10 @@ var K = ["levo-auth", "session"], Ze = () => {
473
474
  t
474
475
  ]);
475
476
  let m = w(() => {
476
- n.invalidateQueries({ queryKey: K }), n.invalidateQueries({ queryKey: ["levo-access", c] });
477
+ n.invalidateQueries({ queryKey: q }), n.invalidateQueries({ queryKey: ["levo-access", c] });
477
478
  }, [n, c]);
478
479
  return {
479
- ...Ee({
480
+ ...Ae({
480
481
  rules: l,
481
482
  invalid: u,
482
483
  pageId: c,
@@ -494,26 +495,26 @@ var K = ["levo-auth", "session"], Ze = () => {
494
495
  recheck: m,
495
496
  isChecking: p.isFetching
496
497
  };
497
- }, ut = "membership.account.ACCOUNT_PENDING_APPROVAL", dt = (e) => e ? e === "membership.account.ACCOUNT_PENDING_APPROVAL" || e.includes("ACCOUNT_PENDING_APPROVAL") : !1, ft = (e) => {
498
+ }, mt = "membership.account.ACCOUNT_PENDING_APPROVAL", ht = (e) => e ? e === "membership.account.ACCOUNT_PENDING_APPROVAL" || e.includes("ACCOUNT_PENDING_APPROVAL") : !1, gt = (e) => {
498
499
  let t = b(e);
499
500
  return {
500
501
  code: t?.code || "SOMETHING_WENT_WRONG",
501
502
  title: t?.title || "Something went wrong",
502
503
  message: t?.message || "Something went wrong. Please try again.",
503
504
  fieldErrors: Object.fromEntries((t?.fieldErrors ?? []).map((e) => [e.param, e.message])),
504
- isPendingApproval: dt(t?.code)
505
+ isPendingApproval: ht(t?.code)
505
506
  };
506
- }, pt = {
507
+ }, _t = {
507
508
  code: "site.NOT_CONNECTED",
508
509
  title: "Sign-in unavailable",
509
510
  message: "This site is not connected to an account system yet.",
510
511
  fieldErrors: {},
511
512
  isPendingApproval: !1
512
- }, mt = () => {
513
+ }, vt = () => {
513
514
  let e = i(), t = z(), n = w(async (t, n) => {
514
515
  if (!e?.membership) return {
515
516
  ok: !1,
516
- error: pt
517
+ error: _t
517
518
  };
518
519
  try {
519
520
  return {
@@ -524,7 +525,7 @@ var K = ["levo-auth", "session"], Ze = () => {
524
525
  let r = b(n);
525
526
  return e.logger?.error(t, { exception: r }), {
526
527
  ok: !1,
527
- error: ft(r)
528
+ error: gt(r)
528
529
  };
529
530
  }
530
531
  }, [e]), r = w(async ({ identifier: t, medium: n }) => {
@@ -537,7 +538,7 @@ var K = ["levo-auth", "session"], Ze = () => {
537
538
  content: r,
538
539
  code: i
539
540
  }) ?? null;
540
- return t.setQueryData(K, n), t.invalidateQueries({ queryKey: K }), n;
541
+ return t.setQueryData(q, n), t.invalidateQueries({ queryKey: q }), n;
541
542
  }) }), c = L({ mutationFn: (t) => n("Failed to send magic link", async () => {
542
543
  await e?.membership?.requestMagicLink({ content: t });
543
544
  }) });
@@ -551,11 +552,11 @@ var K = ["levo-auth", "session"], Ze = () => {
551
552
  isVerifying: s.isPending,
552
553
  isSendingMagicLink: c.isPending
553
554
  };
554
- }, ht = 700, gt = 500, _t = 700, vt = (e, t) => {
555
- let n = window.screenX + (window.outerWidth - gt) / 2, r = window.screenY + (window.outerHeight - _t) / 2.5;
556
- return window.open(e, t, `width=${gt},height=${_t},left=${n},top=${r}`);
557
- }, yt = ({ methods: e, title: t = "Sign in", onSuccess: n, onError: r }) => {
558
- let a = i(), o = z(), s = G(), [c, l] = A(null), [u, d] = A(null), f = k(null), p = k(void 0), m = k({
555
+ }, yt = 700, bt = 500, xt = 700, St = (e, t) => {
556
+ let n = window.screenX + (window.outerWidth - bt) / 2, r = window.screenY + (window.outerHeight - xt) / 2.5;
557
+ return window.open(e, t, `width=${bt},height=${xt},left=${n},top=${r}`);
558
+ }, Ct = ({ methods: e, title: t = "Sign in", onSuccess: n, onError: r }) => {
559
+ let a = i(), o = z(), s = K(), [c, l] = A(null), [u, d] = A(null), f = k(null), p = k(void 0), m = k({
559
560
  onSuccess: n,
560
561
  onError: r
561
562
  });
@@ -603,7 +604,7 @@ var K = ["levo-auth", "session"], Ze = () => {
603
604
  let n = t.get("code");
604
605
  if (!n) return;
605
606
  if (g(), n.toLowerCase() === "success") {
606
- d(null), o.invalidateQueries({ queryKey: K }), m.current.onSuccess?.();
607
+ d(null), o.invalidateQueries({ queryKey: q }), m.current.onSuccess?.();
607
608
  return;
608
609
  }
609
610
  let r = {
@@ -611,10 +612,10 @@ var K = ["levo-auth", "session"], Ze = () => {
611
612
  title: t.get("title") || "Sign-in failed",
612
613
  message: t.get("message") || "We could not sign you in. Please try again.",
613
614
  fieldErrors: {},
614
- isPendingApproval: dt(t.get("code"))
615
+ isPendingApproval: ht(t.get("code"))
615
616
  };
616
617
  r.isPendingApproval || d(r), m.current.onError?.(r);
617
- }, ht);
618
+ }, yt);
618
619
  }, [o, g]), v = O(() => {
619
620
  let e = h.data;
620
621
  if (!e || typeof window > "u") return {};
@@ -635,7 +636,7 @@ var K = ["levo-auth", "session"], Ze = () => {
635
636
  signIn: () => {
636
637
  let n = v[e];
637
638
  if (n) {
638
- if (d(null), f.current?.close(), f.current = vt(n, t), !f.current) {
639
+ if (d(null), f.current?.close(), f.current = St(n, t), !f.current) {
639
640
  d({
640
641
  code: "POPUP_BLOCKED",
641
642
  title: "Popup blocked",
@@ -659,10 +660,10 @@ var K = ["levo-auth", "session"], Ze = () => {
659
660
  error: u,
660
661
  clearError: w(() => d(null), [])
661
662
  };
662
- }, bt = 4, xt = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.trim()), St = (e) => (/* @__PURE__ */ RegExp("^\\d{4}$")).test(e.trim()), Ct = (e) => {
663
+ }, wt = 4, Tt = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.trim()), Et = (e) => (/* @__PURE__ */ RegExp("^\\d{4}$")).test(e.trim()), Dt = (e) => {
663
664
  let t = e.replace(/\D/g, "").replace(/^0+/, "");
664
665
  return t ? `+${t}` : "";
665
- }, wt = (e) => /^\+[1-9]\d{7,14}$/.test(Ct(e)), Tt = ({ value: e, onChange: t, length: n = 4, onComplete: r, autoFocus: i, disabled: a }) => {
666
+ }, Ot = (e) => /^\+[1-9]\d{7,14}$/.test(Dt(e)), kt = ({ value: e, onChange: t, length: n = 4, onComplete: r, autoFocus: i, disabled: a }) => {
666
667
  let o = k([]), [s, c] = A(null), l = k(r);
667
668
  l.current = r;
668
669
  let u = Array.from({ length: n }, (t, n) => e[n] ?? ""), d = w((e) => {
@@ -746,11 +747,11 @@ var K = ["levo-auth", "session"], Ze = () => {
746
747
  },
747
748
  clear: w(() => f("", 0), [f])
748
749
  };
749
- }, Et = C(() => import("./kbChat-eFsau7hG.js")), Dt = ({ site: e, path: t }) => {
750
- let n = G(), r = e.workspace_id || void 0;
750
+ }, At = C(() => import("./kbChat-eFsau7hG.js")), jt = ({ site: e, path: t }) => {
751
+ let n = K(), r = e.workspace_id || void 0;
751
752
  return !n || !r ? null : /* @__PURE__ */ N(x, {
752
753
  fallback: null,
753
- children: /* @__PURE__ */ N(Et, {
754
+ children: /* @__PURE__ */ N(At, {
754
755
  workspaceId: r,
755
756
  siteName: e.name || void 0,
756
757
  siteLogo: void 0,
@@ -760,61 +761,94 @@ var K = ["levo-auth", "session"], Ze = () => {
760
761
  path: t
761
762
  })
762
763
  });
763
- }, Ot = "(prefers-color-scheme: dark)", kt = (e) => {
764
+ }, Mt = "(prefers-color-scheme: dark)", Nt = (e) => {
764
765
  try {
765
766
  let t = localStorage.getItem(e);
766
767
  return t === "light" || t === "dark" || t === "system" ? t : null;
767
768
  } catch {
768
769
  return null;
769
770
  }
770
- }, At = (e, t) => {
771
+ }, Pt = (e, t) => {
771
772
  try {
772
773
  localStorage.setItem(e, t);
773
774
  } catch {}
774
775
  };
775
- function jt(e, t) {
776
- return `(function(){try{var t=localStorage.getItem(${JSON.stringify(e)});if(t!=='light'&&t!=='dark'&&t!=='system'){t=${JSON.stringify(t)}}var d=matchMedia('${Ot}').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){}})();`;
776
+ function Ft(e, t) {
777
+ return `(function(){try{var t=localStorage.getItem(${JSON.stringify(e)});if(t!=='light'&&t!=='dark'&&t!=='system'){t=${JSON.stringify(t)}}var d=matchMedia('${Mt}').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){}})();`;
777
778
  }
778
- var Mt = S(void 0), Nt = (e) => e === "system" ? window.matchMedia(Ot).matches ? "dark" : "light" : e;
779
- function Pt(e) {
779
+ var It = S(void 0), Lt = (e) => e === "system" ? window.matchMedia(Mt).matches ? "dark" : "light" : e;
780
+ function Rt(e) {
780
781
  let t = document.documentElement;
781
782
  t.classList.remove("light", "dark"), t.classList.add(e), t.style.colorScheme = e;
782
783
  }
783
- var Ft = ({ children: e, defaultMode: t = "system", storageKey: n = "color-mode" }) => {
784
- let [r, i] = A(t), [a, o] = A(t === "dark" ? "dark" : "light"), s = G();
784
+ var zt = ({ children: e, defaultMode: t = "system", storageKey: n = "color-mode" }) => {
785
+ let [r, i] = A(t), [a, o] = A(t === "dark" ? "dark" : "light"), s = K();
785
786
  return E(() => {
786
- i(kt(n) ?? t);
787
+ i(Nt(n) ?? t);
787
788
  }, [t, n]), E(() => {
788
789
  if (!s) return;
789
- let e = Nt(r);
790
- Pt(e), o(e);
790
+ let e = Lt(r);
791
+ Rt(e), o(e);
791
792
  }, [r, s]), E(() => {
792
793
  if (!s || r !== "system") return;
793
- let e = window.matchMedia(Ot), t = () => {
794
+ let e = window.matchMedia(Mt), t = () => {
794
795
  let t = e.matches ? "dark" : "light";
795
- Pt(t), o(t);
796
+ Rt(t), o(t);
796
797
  };
797
798
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
798
- }, [r, s]), /* @__PURE__ */ P(Mt.Provider, {
799
+ }, [r, s]), /* @__PURE__ */ P(It.Provider, {
799
800
  value: {
800
801
  mode: r,
801
802
  resolvedMode: a,
802
803
  setMode: (e) => {
803
- At(n, e), i(e);
804
+ Pt(n, e), i(e);
804
805
  }
805
806
  },
806
- children: [/* @__PURE__ */ N(ee, { children: jt(n, t) }), e]
807
+ children: [/* @__PURE__ */ N(B, { children: Ft(n, t) }), e]
807
808
  });
808
809
  };
809
- function It() {
810
- let e = T(Mt);
810
+ function Bt() {
811
+ let e = T(It);
811
812
  if (e === void 0) throw Error("useColorMode must be used within a ColorModeProvider");
812
813
  return e;
813
814
  }
814
815
  //#endregion
815
- //#region src/form/LevoForm.tsx
816
- var Lt = ({ 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 }) => {
817
- let m = i(), { schema: h, isLoading: g, bind: _ } = Ke(e), v = Xe(s);
816
+ //#region src/form/LevoEditForm.tsx
817
+ var Vt = (e, t) => !e.hidden && !t?.includes(e.key) && !t?.includes(e.id) && e.allow_public_view !== !1 && e.allow_public_submit !== !1, Ht = ({ source: t, initialValues: n, onSubmit: r, isLoading: i, hiddenFields: a, submitLabel: o = "Save changes", theme: s, className: c }) => {
818
+ let { schema: l, bind: u } = Xe(t), d = et(s), f = O(() => l ? {
819
+ ...l,
820
+ sections: l.sections?.map((e) => ({
821
+ ...e,
822
+ fields: e.fields?.map((e) => ({
823
+ ...e,
824
+ hidden: !Vt(e, a)
825
+ }))
826
+ }))
827
+ } : null, [l, a?.join("|") ?? ""]), p = (e) => {
828
+ let t = l?.sections?.flatMap((e) => e?.fields ?? []).filter((e) => Vt(e, a)).map((e) => e.key) ?? [];
829
+ r(Object.fromEntries(Object.entries(e).filter(([e]) => t.includes(e))));
830
+ };
831
+ return /* @__PURE__ */ N("div", {
832
+ ...u,
833
+ className: c,
834
+ children: f ? /* @__PURE__ */ N(e, {
835
+ schema: f,
836
+ initialValues: n ?? {},
837
+ uiConfig: {
838
+ hideFormHeading: !0,
839
+ hideSectionHeadings: !0
840
+ },
841
+ submitButtonConfig: {
842
+ show: !0,
843
+ text: o
844
+ },
845
+ theme: { style: d },
846
+ isLoading: i,
847
+ onSubmit: (e) => p(e)
848
+ }) : null
849
+ });
850
+ }, Ut = ({ 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 }) => {
851
+ let m = i(), { schema: h, isLoading: g, bind: _ } = Xe(e), v = et(s);
818
852
  return m ? /* @__PURE__ */ N("div", {
819
853
  ..._,
820
854
  className: c,
@@ -844,28 +878,28 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
844
878
  onError: p
845
879
  })
846
880
  }) : null;
847
- }, Rt = 1400, zt = 12 * 1024 * 1024, Bt = new Set(["transparent", "rgba(0, 0, 0, 0)"]), Vt = {
881
+ }, Wt = 1400, Gt = 12 * 1024 * 1024, Kt = new Set(["transparent", "rgba(0, 0, 0, 0)"]), qt = {
848
882
  imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",
849
883
  onImageErrorHandler: () => void 0
850
- }, Ht = (e) => {
884
+ }, Jt = (e) => {
851
885
  let t = getComputedStyle(e);
852
- return !Bt.has(t.backgroundColor) || t.backgroundImage !== "none";
853
- }, Ut = (e) => {
886
+ return !Kt.has(t.backgroundColor) || t.backgroundImage !== "none";
887
+ }, Yt = (e) => {
854
888
  for (let t = e; t; t = t.parentElement) {
855
889
  let e = getComputedStyle(t).backgroundColor;
856
- if (!Bt.has(e)) return e;
890
+ if (!Kt.has(e)) return e;
857
891
  }
858
892
  return "#ffffff";
859
- }, Wt = async (e, t) => {
860
- let { toPng: n } = await import("./es-CK20DkgT.js"), r = e.getBoundingClientRect(), i = Math.max(r.width, r.height, 1), a = Math.min(2, Math.max(.4, Rt / i)), o = await n(e, {
861
- ...Vt,
893
+ }, Xt = async (e, t) => {
894
+ let { toPng: n } = await import("./es-CK20DkgT.js"), r = e.getBoundingClientRect(), i = Math.max(r.width, r.height, 1), a = Math.min(2, Math.max(.4, Wt / i)), o = await n(e, {
895
+ ...qt,
862
896
  pixelRatio: a,
863
- backgroundColor: Ut(e),
897
+ backgroundColor: Yt(e),
864
898
  filter: (e) => !t.includes(e)
865
899
  });
866
- if (o.length > zt) throw Error("capture too large");
900
+ if (o.length > Gt) throw Error("capture too large");
867
901
  return o;
868
- }, Gt = 4, Kt = 4e3, qt = (e, t) => {
902
+ }, Zt = 4, Qt = 4e3, $t = (e, t) => {
869
903
  let n = document.elementFromPoint(e.x + e.width / 2, e.y + e.height / 2);
870
904
  for (; n && t.includes(n);) n = n.parentElement;
871
905
  let r = document.body;
@@ -876,8 +910,8 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
876
910
  break;
877
911
  }
878
912
  }
879
- let i = window.innerWidth * window.innerHeight * Gt || 2 ** 53 - 1, a = r;
880
- for (; !Ht(a);) {
913
+ let i = window.innerWidth * window.innerHeight * Zt || 2 ** 53 - 1, a = r;
914
+ for (; !Jt(a);) {
881
915
  let e = a.parentElement;
882
916
  if (!e || e === document.documentElement) break;
883
917
  let t = e.getBoundingClientRect();
@@ -885,13 +919,13 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
885
919
  a = e;
886
920
  }
887
921
  return a;
888
- }, Jt = async (e, t) => {
889
- let { toCanvas: n } = await import("./es-CK20DkgT.js"), r = qt(e, t), i = r.getBoundingClientRect(), a = Math.max(e.width, e.height, 1), o = Math.min(2, Math.max(.4, Rt / a)), s = Math.max(i.width, i.height, 1);
890
- o = Math.min(o, Kt / s);
922
+ }, en = async (e, t) => {
923
+ let { toCanvas: n } = await import("./es-CK20DkgT.js"), r = $t(e, t), i = r.getBoundingClientRect(), a = Math.max(e.width, e.height, 1), o = Math.min(2, Math.max(.4, Wt / a)), s = Math.max(i.width, i.height, 1);
924
+ o = Math.min(o, Qt / s);
891
925
  let c = await n(r, {
892
- ...Vt,
926
+ ...qt,
893
927
  pixelRatio: o,
894
- backgroundColor: Ut(r),
928
+ backgroundColor: Yt(r),
895
929
  filter: (e) => !t.includes(e)
896
930
  }), l = document.createElement("canvas");
897
931
  l.width = Math.max(1, Math.round(e.width * o)), l.height = Math.max(1, Math.round(e.height * o));
@@ -899,9 +933,9 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
899
933
  if (!u) throw Error("no 2d context");
900
934
  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);
901
935
  let d = l.toDataURL("image/png");
902
- if (d.length > zt) throw Error("capture too large");
936
+ if (d.length > Gt) throw Error("capture too large");
903
937
  return d;
904
- }, q = {
938
+ }, tn = {
905
939
  ring: 99997,
906
940
  overlay: 99998,
907
941
  label: 99999
@@ -914,24 +948,24 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
914
948
  }, Y = (e) => {
915
949
  let t = e?.getAttribute("data-tsd-source");
916
950
  return t ? t.replace(/^\//, "") : null;
917
- }, Yt = (e) => Array.from(document.querySelectorAll("[data-tsd-source]")).filter((t) => Y(t) === e), Xt = (e, t) => {
918
- let n = Yt(t).indexOf(e);
951
+ }, nn = (e) => Array.from(document.querySelectorAll("[data-tsd-source]")).filter((t) => Y(t) === e), rn = (e, t) => {
952
+ let n = nn(t).indexOf(e);
919
953
  return n < 0 ? 0 : n;
920
- }, X = (e, t = 0) => {
921
- let n = Yt(e);
954
+ }, an = (e, t = 0) => {
955
+ let n = nn(e);
922
956
  return n[t] ?? n[0] ?? null;
923
- }, Zt = (e, t) => {
957
+ }, on = (e, t) => {
924
958
  let n = (e.getAttribute("data-staged-key") || "").split(/\s+/).filter(Boolean);
925
959
  n.includes(t) || e.setAttribute("data-staged-key", [...n, t].join(" "));
926
- }, Qt = (e, t) => {
960
+ }, sn = (e, t) => {
927
961
  let n = (e.getAttribute("data-staged-key") || "").split(/\s+/).filter((e) => e && e !== t);
928
962
  n.length ? e.setAttribute("data-staged-key", n.join(" ")) : e.removeAttribute("data-staged-key");
929
- }, $t = (e, t) => {
963
+ }, cn = (e, t) => {
930
964
  let n = Object.entries(t.styles).filter(([e]) => /^-?[a-zA-Z][a-zA-Z0-9-]*$/.test(e)).map(([e, t]) => `${e}:${String(t).replace(/[;{}]/g, "")} !important;`).join("");
931
965
  if (!n) return "";
932
966
  let r = `[data-staged-key~="${CSS.escape(e)}"]{${n}}`, i = t.media?.replace(/[;{}]/g, "").trim();
933
967
  return i ? `@media ${i}{${r}}` : r;
934
- }, en = (e) => {
968
+ }, ln = (e) => {
935
969
  let t = e.tagName.toLowerCase();
936
970
  return t === "input" ? {
937
971
  checkbox: "Checkbox",
@@ -973,31 +1007,31 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
973
1007
  aside: "Sidebar",
974
1008
  div: "Container"
975
1009
  }[t] || `${t.charAt(0).toUpperCase()}${t.slice(1)}`;
976
- }, tn = 36, nn = (e) => {
977
- let t = en(e), n = ((e) => e.replace(/\s+/g, " ").trim())(e.getAttribute("aria-label") || e.getAttribute("alt") || e.getAttribute("title") || e.getAttribute("name") || "");
978
- return n ? `${t} · ${n.length > tn ? `${n.slice(0, tn - 1).trimEnd()}…` : n}` : t;
979
- }, rn = (e) => {
1010
+ }, un = 36, dn = (e) => {
1011
+ let t = ln(e), n = ((e) => e.replace(/\s+/g, " ").trim())(e.getAttribute("aria-label") || e.getAttribute("alt") || e.getAttribute("title") || e.getAttribute("name") || "");
1012
+ return n ? `${t} · ${n.length > un ? `${n.slice(0, un - 1).trimEnd()}…` : n}` : t;
1013
+ }, fn = (e) => {
980
1014
  let t = [], n = e;
981
1015
  for (; n && n.nodeType === 1 && n !== document.body && t.length < 8;) t.unshift(n.tagName.toLowerCase()), n = n.parentElement;
982
1016
  return t.join(" > ");
983
- }, an = () => {
1017
+ }, pn = () => {
984
1018
  let e = document.createElement("div");
985
- 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`;
1019
+ e.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.overlay};background:${J.hoverBg};outline:2px solid ${J.hover};border-radius:2px;display:none`;
986
1020
  let t = document.createElement("div");
987
- 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`;
1021
+ t.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.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`;
988
1022
  let n = document.createElement("div");
989
- 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`;
1023
+ n.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.ring};outline:2px solid ${J.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 4px ${J.selectGlow};display:none`;
990
1024
  let r = document.createElement("div");
991
- 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`, {
1025
+ return r.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.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`, {
992
1026
  overlay: e,
993
1027
  label: t,
994
1028
  ring: n,
995
1029
  ringLabel: r
996
1030
  };
997
- }, on = (e, t, n) => {
1031
+ }, mn = (e, t, n) => {
998
1032
  let r = n.getBoundingClientRect();
999
- e.style.display = "block", e.style.left = `${r.left}px`, e.style.top = `${r.top}px`, e.style.width = `${r.width}px`, e.style.height = `${r.height}px`, t.style.display = "block", t.textContent = nn(n), t.style.left = `${Math.max(4, r.left)}px`, t.style.top = `${r.top > 26 ? r.top - 22 : r.bottom + 4}px`;
1000
- }, sn = (e) => {
1033
+ e.style.display = "block", e.style.left = `${r.left}px`, e.style.top = `${r.top}px`, e.style.width = `${r.width}px`, e.style.height = `${r.height}px`, t.style.display = "block", t.textContent = dn(n), t.style.left = `${Math.max(4, r.left)}px`, t.style.top = `${r.top > 26 ? r.top - 22 : r.bottom + 4}px`;
1034
+ }, hn = (e) => {
1001
1035
  let t = (e instanceof Element ? e : null)?.closest("a[href]");
1002
1036
  if (!t || t.target === "_blank") return null;
1003
1037
  let n;
@@ -1007,11 +1041,11 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1007
1041
  return null;
1008
1042
  }
1009
1043
  return n.protocol !== "http:" && n.protocol !== "https:" || n.origin === location.origin ? null : n.href;
1010
- }, cn = (e) => {
1044
+ }, gn = (e) => {
1011
1045
  if (!e) return !1;
1012
1046
  let t = e.tagName;
1013
1047
  return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || e.isContentEditable === !0;
1014
- }, ln = (e) => {
1048
+ }, _n = (e) => {
1015
1049
  if (!e.childNodes.length) return !1;
1016
1050
  let t = !1;
1017
1051
  for (let n of e.childNodes) {
@@ -1019,7 +1053,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1019
1053
  (n.textContent ?? "").trim() && (t = !0);
1020
1054
  }
1021
1055
  return t;
1022
- }, un = 2e3, dn = (e) => {
1056
+ }, vn = 2e3, yn = (e) => {
1023
1057
  let t = [], n = e;
1024
1058
  for (; n && n.nodeType === 1 && n !== document.body && t.length < 8;) {
1025
1059
  let e = Y(n);
@@ -1030,22 +1064,22 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1030
1064
  }), n = n.parentElement;
1031
1065
  }
1032
1066
  return t;
1033
- }, fn = (e) => {
1034
- let t = Y(e), n = t ? Yt(t).length : 1, r = t ? Xt(e, t) : 0, i = t && ln(e) ? (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, un) : void 0, a = pn(e);
1067
+ }, bn = (e) => {
1068
+ let t = Y(e), n = t ? nn(t).length : 1, r = t ? rn(e, t) : 0, i = t && _n(e) ? (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, vn) : void 0, a = xn(e);
1035
1069
  return {
1036
1070
  tag: e.tagName.toLowerCase(),
1037
1071
  classes: typeof e.className == "string" ? e.className.trim() : "",
1038
1072
  text: (e.innerText || "").trim().slice(0, 120),
1039
- label: nn(e),
1040
- path: rn(e),
1073
+ label: dn(e),
1074
+ path: fn(e),
1041
1075
  source: t,
1042
1076
  index: r,
1043
1077
  occurrences: n,
1044
- ancestors: dn(e),
1078
+ ancestors: yn(e),
1045
1079
  ...i === void 0 ? {} : { fullText: i },
1046
1080
  ...a ? { sourceBinding: a } : {}
1047
1081
  };
1048
- }, pn = (e) => {
1082
+ }, xn = (e) => {
1049
1083
  let t = e.closest("[data-levo-source]");
1050
1084
  if (!t) return;
1051
1085
  let n = t.getAttribute("data-levo-source") ?? "", r = Y(t), i;
@@ -1058,11 +1092,11 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1058
1092
  raw: n,
1059
1093
  element: {
1060
1094
  source: r ?? "",
1061
- index: r ? Xt(t, r) : 0
1095
+ index: r ? rn(t, r) : 0
1062
1096
  },
1063
1097
  ...i === void 0 ? {} : { config: i }
1064
1098
  };
1065
- }, mn = () => Array.from(document.querySelectorAll("[data-levo-source]")).map((e) => {
1099
+ }, Sn = () => Array.from(document.querySelectorAll("[data-levo-source]")).map((e) => {
1066
1100
  let t = e.getAttribute("data-levo-source") ?? "", n = Y(e), r;
1067
1101
  try {
1068
1102
  r = JSON.parse(t);
@@ -1073,18 +1107,18 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1073
1107
  raw: t,
1074
1108
  element: {
1075
1109
  source: n ?? "",
1076
- index: n ? Xt(e, n) : 0
1110
+ index: n ? rn(e, n) : 0
1077
1111
  },
1078
1112
  tag: e.tagName.toLowerCase(),
1079
- label: nn(e),
1113
+ label: dn(e),
1080
1114
  ...r === void 0 ? {} : { config: r }
1081
1115
  };
1082
- }), hn = 14, gn = 2e3, _n = 100, vn = 48, yn = new Set([
1116
+ }), Cn = 14, wn = 2e3, Tn = 100, En = 48, Dn = new Set([
1083
1117
  "script",
1084
1118
  "style",
1085
1119
  "template",
1086
1120
  "noscript"
1087
- ]), bn = (e, t) => t.includes(e) || e.id === "studio-staged" || yn.has(e.tagName.toLowerCase()), xn = (e) => {
1121
+ ]), On = (e, t) => t.includes(e) || e.id === "studio-staged" || Dn.has(e.tagName.toLowerCase()), kn = (e) => {
1088
1122
  let t = !1, n = 0, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1089
1123
  for (let e of Array.from(document.querySelectorAll("[data-tsd-source]"))) {
1090
1124
  let t = Y(e);
@@ -1096,11 +1130,11 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1096
1130
  for (let t of e.childNodes) {
1097
1131
  if (t.nodeType !== 3) continue;
1098
1132
  let e = (t.textContent ?? "").replace(/\s+/g, " ").trim();
1099
- if (e) return e.length > vn ? `${e.slice(0, vn).trimEnd()}…` : e;
1133
+ if (e) return e.length > En ? `${e.slice(0, En).trimEnd()}…` : e;
1100
1134
  }
1101
1135
  }, o = (i, s) => {
1102
1136
  n++;
1103
- let c = Y(i), l = a(i), u = Array.from(i.children).filter((t) => !bn(t, e)), d = {
1137
+ let c = Y(i), l = a(i), u = Array.from(i.children).filter((t) => !On(t, e)), d = {
1104
1138
  tag: i.tagName.toLowerCase(),
1105
1139
  ...c ? {
1106
1140
  source: c,
@@ -1111,9 +1145,9 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1111
1145
  childCount: u.length,
1112
1146
  children: []
1113
1147
  };
1114
- if (s >= hn) return u.length && (t = !0), d;
1148
+ if (s >= Cn) return u.length && (t = !0), d;
1115
1149
  for (let e of u) {
1116
- if (d.children.length >= _n || n >= gn) {
1150
+ if (d.children.length >= Tn || n >= wn) {
1117
1151
  t = !0;
1118
1152
  break;
1119
1153
  }
@@ -1125,7 +1159,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1125
1159
  tree: o(document.body, 0),
1126
1160
  truncated: t
1127
1161
  };
1128
- }, Sn = () => {
1162
+ }, An = () => {
1129
1163
  let e = null;
1130
1164
  return {
1131
1165
  send: (t) => {
@@ -1140,7 +1174,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1140
1174
  return !0;
1141
1175
  }
1142
1176
  };
1143
- }, Cn = (e) => {
1177
+ }, jn = (e) => {
1144
1178
  let t = location.pathname, n = () => {
1145
1179
  location.pathname !== t && (t = location.pathname, e.onPathChange());
1146
1180
  }, r = !1;
@@ -1160,23 +1194,23 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1160
1194
  e.__inspectorPatched && e.__orig && (history.pushState = e.__orig), t.__inspectorPatched && t.__orig && (history.replaceState = t.__orig);
1161
1195
  }
1162
1196
  } };
1163
- }, wn = !1, Tn = /* @__PURE__ */ new Set(), En = () => {
1164
- if (!wn) {
1165
- wn = !0;
1166
- for (let e of Tn) e();
1197
+ }, Mn = !1, Nn = /* @__PURE__ */ new Set(), Pn = () => {
1198
+ if (!Mn) {
1199
+ Mn = !0;
1200
+ for (let e of Nn) e();
1167
1201
  }
1168
- }, Dn = (e) => (Tn.add(e), () => {
1169
- Tn.delete(e);
1170
- }), On = () => j(Dn, () => wn, () => !1), kn = (e) => {
1202
+ }, Fn = (e) => (Nn.add(e), () => {
1203
+ Nn.delete(e);
1204
+ }), In = () => j(Fn, () => Mn, () => !1), Ln = (e) => {
1171
1205
  let { channel: t, originals: n, staged: r } = e, i = t.send, a = null;
1172
1206
  return { onMessage: (o) => {
1173
1207
  let s = o.data;
1174
1208
  if (!(!s || s.source !== "web-chat") && t.acceptOrigin(o)) {
1175
- if (En(), s.type === "set-access-preview") ot(s.stage ?? null);
1209
+ if (Pn(), s.type === "set-access-preview") ut(s.stage ?? null);
1176
1210
  else if (s.type === "set-inspect") e.setInspect(s.enabled);
1177
1211
  else if (s.type === "set-text-edit") e.setTextEdit(s.enabled);
1178
1212
  else if (s.type === "revert-text") {
1179
- 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);
1213
+ 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 : an(e, t);
1180
1214
  i && r != null && (i.textContent = r);
1181
1215
  } else if (s.type === "stage-style") {
1182
1216
  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;
@@ -1235,7 +1269,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1235
1269
  }
1236
1270
  e.syncDomObserver();
1237
1271
  } else if (s.type === "select-element") {
1238
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? X(t, n) : null;
1272
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? an(t, n) : null;
1239
1273
  if (!r) {
1240
1274
  i({
1241
1275
  type: "select-miss",
@@ -1251,10 +1285,10 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1251
1285
  behavior: "smooth"
1252
1286
  }), i({
1253
1287
  type: "element-selected",
1254
- element: fn(r)
1288
+ element: bn(r)
1255
1289
  });
1256
1290
  } else if (s.type === "edit-element") {
1257
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? X(t, n) : null;
1291
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? an(t, n) : null;
1258
1292
  if (!r) {
1259
1293
  i({
1260
1294
  type: "select-miss",
@@ -1270,12 +1304,12 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1270
1304
  behavior: "smooth"
1271
1305
  }), i({
1272
1306
  type: "element-selected",
1273
- element: fn(r)
1307
+ element: bn(r)
1274
1308
  }), e.isTextEditing() || e.setTextEdit(!0);
1275
1309
  let o = e.editableTarget(r);
1276
1310
  o && e.startEditAtEnd(o);
1277
1311
  } else if (s.type === "highlight-element") {
1278
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? X(t, n) : null;
1312
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? an(t, n) : null;
1279
1313
  if (!r) a = null, e.hideTextHover(), i({
1280
1314
  type: "highlight-miss",
1281
1315
  element: {
@@ -1293,7 +1327,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1293
1327
  }
1294
1328
  } else if (s.type === "clear-highlight") a && (a = null, !e.isInspecting() && !e.editingNode() && e.hideTextHover());
1295
1329
  else if (s.type === "request-layers") {
1296
- let { tree: t, truncated: n } = xn(e.ownNodes);
1330
+ let { tree: t, truncated: n } = kn(e.ownNodes);
1297
1331
  i({
1298
1332
  type: "layers-tree",
1299
1333
  tree: t,
@@ -1301,7 +1335,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1301
1335
  });
1302
1336
  } else if (s.type === "request-sources") i({
1303
1337
  type: "sources-list",
1304
- sources: mn()
1338
+ sources: Sn()
1305
1339
  });
1306
1340
  else if (s.type === "capture-selected") {
1307
1341
  let t = String(s.requestId || "");
@@ -1316,7 +1350,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1316
1350
  });
1317
1351
  return;
1318
1352
  }
1319
- Wt(n, e.ownNodes).then((e) => {
1353
+ Xt(n, e.ownNodes).then((e) => {
1320
1354
  console.info(`[levo-inspector] element capture ok <${n.tagName.toLowerCase()}> (${Math.round(e.length / 1024)}kB)`), i({
1321
1355
  type: "capture-result",
1322
1356
  requestId: t,
@@ -1337,7 +1371,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1337
1371
  }
1338
1372
  }
1339
1373
  } };
1340
- }, An = () => {
1374
+ }, Rn = () => {
1341
1375
  let e = /* @__PURE__ */ new Map(), t = () => {
1342
1376
  if (e.size > 50) {
1343
1377
  let t = e.keys().next().value;
@@ -1357,31 +1391,31 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1357
1391
  return e.delete(t), n;
1358
1392
  }
1359
1393
  };
1360
- }, jn = 6, Mn = 12, Nn = 12, Pn = .6, Fn = (e, t, n, r) => ({
1394
+ }, zn = 6, Bn = 12, Vn = 12, Hn = .6, Un = (e, t, n, r) => ({
1361
1395
  x: Math.min(e, n),
1362
1396
  y: Math.min(t, r),
1363
1397
  width: Math.abs(n - e),
1364
1398
  height: Math.abs(r - t)
1365
- }), In = (e, t) => {
1399
+ }), Wn = (e, t) => {
1366
1400
  let n = e.x + e.width, r = e.y + e.height, i = [];
1367
1401
  for (let a of Array.from(document.querySelectorAll("[data-tsd-source]"))) {
1368
1402
  if (t.includes(a)) continue;
1369
1403
  let o = a.getBoundingClientRect(), s = o.width * o.height;
1370
- s <= 0 || Math.max(0, Math.min(n, o.right) - Math.max(e.x, o.left)) * Math.max(0, Math.min(r, o.bottom) - Math.max(e.y, o.top)) / s >= Pn && i.push(a);
1404
+ s <= 0 || Math.max(0, Math.min(n, o.right) - Math.max(e.x, o.left)) * Math.max(0, Math.min(r, o.bottom) - Math.max(e.y, o.top)) / s >= Hn && i.push(a);
1371
1405
  }
1372
1406
  let a = new Set(i), o = i.filter((e) => {
1373
1407
  for (let t = e.parentElement; t; t = t.parentElement) if (a.has(t)) return !1;
1374
1408
  return !0;
1375
- }), s = o.length > Nn, c = [], l = [];
1376
- for (let e of o.slice(0, Nn)) {
1409
+ }), s = o.length > Vn, c = [], l = [];
1410
+ for (let e of o.slice(0, Vn)) {
1377
1411
  let t = Y(e);
1378
1412
  if (!t) continue;
1379
1413
  let n = (e.innerText || "").replace(/\s+/g, " ").trim().slice(0, 80);
1380
1414
  c.push({
1381
1415
  source: t,
1382
- index: Xt(e, t),
1416
+ index: rn(e, t),
1383
1417
  tag: e.tagName.toLowerCase(),
1384
- label: nn(e),
1418
+ label: dn(e),
1385
1419
  ...n ? { text: n } : {}
1386
1420
  }), l.push(e);
1387
1421
  }
@@ -1390,12 +1424,12 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1390
1424
  nodes: l,
1391
1425
  truncated: s
1392
1426
  };
1393
- }, Ln = () => Array.from({ length: Nn }, () => {
1427
+ }, Gn = () => Array.from({ length: Vn }, () => {
1394
1428
  let e = document.createElement("div");
1395
- 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;
1396
- }), Rn = () => {
1429
+ return e.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.ring};outline:1.5px solid ${J.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 3px ${J.selectGlow};display:none`, e;
1430
+ }), Kn = () => {
1397
1431
  let e = document.createElement("div");
1398
- 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`;
1432
+ e.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.overlay};border:1.5px dashed ${J.select};background:${J.selectGlow};border-radius:2px;display:none`;
1399
1433
  let t = null, n = !1, r = 0, i = 0, a = () => {
1400
1434
  e.style.display = "none";
1401
1435
  };
@@ -1410,31 +1444,31 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1410
1444
  pointerMove: (a, o) => {
1411
1445
  if (!t) return;
1412
1446
  if (a = Math.min(Math.max(0, a), window.innerWidth), o = Math.min(Math.max(0, o), window.innerHeight), r = a, i = o, !n) {
1413
- if (Math.abs(a - t.x) < jn && Math.abs(o - t.y) < jn) return;
1447
+ if (Math.abs(a - t.x) < zn && Math.abs(o - t.y) < zn) return;
1414
1448
  n = !0;
1415
1449
  }
1416
- let s = Fn(t.x, t.y, a, o);
1450
+ let s = Un(t.x, t.y, a, o);
1417
1451
  e.style.display = "block", e.style.left = `${s.x}px`, e.style.top = `${s.y}px`, e.style.width = `${s.width}px`, e.style.height = `${s.height}px`;
1418
1452
  },
1419
1453
  pointerUp: () => {
1420
1454
  let e = n, o = t;
1421
1455
  if (t = null, n = !1, a(), !e || !o) return null;
1422
- let s = Fn(o.x, o.y, r, i);
1423
- return s.width < Mn || s.height < Mn ? null : s;
1456
+ let s = Un(o.x, o.y, r, i);
1457
+ return s.width < Bn || s.height < Bn ? null : s;
1424
1458
  },
1425
1459
  cancel: () => {
1426
1460
  t = null, n = !1, a();
1427
1461
  },
1428
1462
  isDragging: () => n
1429
1463
  };
1430
- }, zn = (e) => {
1464
+ }, qn = (e) => {
1431
1465
  let { originals: t, editingNode: n } = e, r = /* @__PURE__ */ new Map(), i = () => {
1432
1466
  let e = document.getElementById("studio-staged");
1433
1467
  return e || (e = document.createElement("style"), e.id = "studio-staged", document.head.appendChild(e)), e;
1434
1468
  }, a = () => {
1435
1469
  let e = [];
1436
1470
  for (let [t, n] of r) if (n.kind === "style") {
1437
- let r = $t(t, n);
1471
+ let r = cn(t, n);
1438
1472
  r && e.push(r);
1439
1473
  }
1440
1474
  let t = e.join("\n");
@@ -1442,8 +1476,8 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1442
1476
  let n = i();
1443
1477
  n.textContent !== t && (n.textContent = t);
1444
1478
  }, o = (e, r) => {
1445
- let i = X(r.source, r.index);
1446
- if (i) if (r.kind === "style") Zt(i, e);
1479
+ let i = an(r.source, r.index);
1480
+ if (i) if (r.kind === "style") on(i, e);
1447
1481
  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");
1448
1482
  else {
1449
1483
  if (i === n()) return;
@@ -1456,8 +1490,8 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1456
1490
  let n = r.get(e);
1457
1491
  if (!n) return;
1458
1492
  r.delete(e);
1459
- let i = X(n.source, n.index);
1460
- if (n.kind === "style") i && Qt(i, e), a();
1493
+ let i = an(n.source, n.index);
1494
+ if (n.kind === "style") i && sn(i, e), a();
1461
1495
  else if (n.kind === "image") {
1462
1496
  let e = t.restore(`${n.source}#${n.index}:src`), r = t.restore(`${n.source}#${n.index}:srcset`);
1463
1497
  i && (e != null && (e ? i.setAttribute("src", e) : i.removeAttribute("src")), r != null && (r ? i.setAttribute("srcset", r) : i.removeAttribute("srcset")));
@@ -1486,7 +1520,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1486
1520
  for (let e of Array.from(document.querySelectorAll("[data-staged-key]"))) e.removeAttribute("data-staged-key");
1487
1521
  }
1488
1522
  };
1489
- }, Bn = (e) => {
1523
+ }, Jn = (e) => {
1490
1524
  let { channel: t, originals: n, clearTextHover: r } = e, i = null, a = "", o = 0, s = (() => {
1491
1525
  try {
1492
1526
  let e = document.createElement("div");
@@ -1505,7 +1539,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1505
1539
  n.selectNodeContents(e), n.collapse(!1), t.removeAllRanges(), t.addRange(n);
1506
1540
  }, d = (e, t = !1) => {
1507
1541
  if (i === e) return;
1508
- i && p(i), i = e, a = Y(e) || "", o = Xt(e, a), r(), n.capture(`${a}#${o}`, e.textContent ?? ""), e.setAttribute("contenteditable", s ? "plaintext-only" : "true");
1542
+ i && p(i), i = e, a = Y(e) || "", o = rn(e, a), r(), n.capture(`${a}#${o}`, e.textContent ?? ""), e.setAttribute("contenteditable", s ? "plaintext-only" : "true");
1509
1543
  let d = e;
1510
1544
  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);
1511
1545
  }, f = (e) => {
@@ -1524,7 +1558,7 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1524
1558
  tag: e.tagName.toLowerCase(),
1525
1559
  value: c,
1526
1560
  previous: s,
1527
- occurrences: r ? Yt(r).length : 1
1561
+ occurrences: r ? nn(r).length : 1
1528
1562
  }
1529
1563
  });
1530
1564
  }, m = (e) => {
@@ -1543,16 +1577,16 @@ var Lt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1543
1577
  i && f(i);
1544
1578
  }
1545
1579
  };
1546
- }, Vn = "2026-07-24g · element-capture + region-drag + region-highlights (stale-region guard)";
1547
- function Hn() {
1548
- return E(() => Un(), []), null;
1580
+ }, Yn = "2026-07-24g · element-capture + region-drag + region-highlights (stale-region guard)";
1581
+ function Xn() {
1582
+ return E(() => Zn(), []), null;
1549
1583
  }
1550
- function Un() {
1551
- let e = !1, t = null, n = null, r = !1, i = null, a = An(), o = Sn(), { overlay: s, label: c, ring: l, ringLabel: u } = an();
1584
+ function Zn() {
1585
+ let e = !1, t = null, n = null, r = !1, i = null, a = Rn(), o = An(), { overlay: s, label: c, ring: l, ringLabel: u } = pn();
1552
1586
  document.body.append(s, c, l, u);
1553
- let d = Rn();
1587
+ let d = Kn();
1554
1588
  document.body.append(d.node);
1555
- let f = Ln();
1589
+ let f = Gn();
1556
1590
  document.body.append(...f);
1557
1591
  let p = [
1558
1592
  s,
@@ -1582,14 +1616,14 @@ function Un() {
1582
1616
  }, S = (e) => !e || p.includes(e) || e === document.body || e === document.documentElement, C = (e) => {
1583
1617
  if (!e || S(e)) return null;
1584
1618
  let t = Y(e) ? e : e.closest("[data-tsd-source]");
1585
- return !t || S(t) || !ln(t) ? null : t;
1586
- }, w = (e) => on(s, c, e), T = () => {
1619
+ return !t || S(t) || !_n(t) ? null : t;
1620
+ }, w = (e) => mn(s, c, e), T = () => {
1587
1621
  if (n) {
1588
1622
  if (!n.isConnected) {
1589
1623
  P();
1590
1624
  return;
1591
1625
  }
1592
- on(l, u, n);
1626
+ mn(l, u, n);
1593
1627
  }
1594
1628
  }, E = 0, D = () => {
1595
1629
  E || !n || r || (E = requestAnimationFrame(() => {
@@ -1618,23 +1652,23 @@ function Un() {
1618
1652
  n = null, O.disconnect(), z(), E &&= (cancelAnimationFrame(E), 0), l.style.display = "none", u.style.display = "none", y(), g();
1619
1653
  }, F = (e) => w(e), I = () => {
1620
1654
  s.style.display = "none", c.style.display = "none";
1621
- }, L = Bn({
1655
+ }, L = Jn({
1622
1656
  channel: o,
1623
1657
  originals: a,
1624
1658
  clearTextHover: () => {
1625
1659
  i = null, I();
1626
1660
  }
1627
- }), R = zn({
1661
+ }), R = qn({
1628
1662
  originals: a,
1629
1663
  editingNode: L.editingNode
1630
1664
  }), z = () => {
1631
1665
  n?.isConnected || R.count() ? j() : M();
1632
1666
  }, ee = (n) => {
1633
- n && r && te(!1), e = !!n, x(e), e || (t = null, s.style.display = "none", c.style.display = "none", H()), o.send({
1667
+ n && r && B(!1), e = !!n, x(e), e || (t = null, s.style.display = "none", c.style.display = "none", U()), o.send({
1634
1668
  type: "inspect-state",
1635
1669
  enabled: e
1636
1670
  });
1637
- }, te = (t) => {
1671
+ }, B = (t) => {
1638
1672
  if (r = !!t, r) {
1639
1673
  e && ee(!1), l.style.display = "none", u.style.display = "none";
1640
1674
  for (let e of f) e.style.display = "none";
@@ -1643,9 +1677,9 @@ function Un() {
1643
1677
  type: "text-edit-state",
1644
1678
  enabled: r
1645
1679
  });
1646
- }, B = 0, ne = 0, re = 0, ie = () => {
1647
- B = 0;
1648
- let n = document.elementFromPoint(ne, re);
1680
+ }, te = 0, V = 0, ne = 0, re = () => {
1681
+ te = 0;
1682
+ let n = document.elementFromPoint(V, ne);
1649
1683
  if (!S(n)) {
1650
1684
  if (r) {
1651
1685
  let e = C(n);
@@ -1658,47 +1692,47 @@ function Un() {
1658
1692
  }
1659
1693
  e && (d.isDragging() || (t = n, n && w(n)));
1660
1694
  }
1661
- }, ae = (t) => {
1662
- !e && !r || (ne = t.clientX, re = t.clientY, B ||= requestAnimationFrame(ie));
1663
- }, oe = 0, se = () => {
1664
- oe = 0, e && t && w(t), r && !L.editingNode() && i?.isConnected && F(i), n && !r && T(), m.length > 0 && !r && _();
1665
- }, ce = () => {
1666
- oe ||= requestAnimationFrame(se);
1667
- }, V = (n) => {
1695
+ }, ie = (t) => {
1696
+ !e && !r || (V = t.clientX, ne = t.clientY, te ||= requestAnimationFrame(re));
1697
+ }, H = 0, ae = () => {
1698
+ H = 0, e && t && w(t), r && !L.editingNode() && i?.isConnected && F(i), n && !r && T(), m.length > 0 && !r && _();
1699
+ }, oe = () => {
1700
+ H ||= requestAnimationFrame(ae);
1701
+ }, se = (n) => {
1668
1702
  n.relatedTarget || (e ? (t = null, s.style.display = "none", c.style.display = "none") : r && !L.editingNode() && (i = null, I(), document.documentElement.style.cursor = ""));
1669
- }, le = !1, ue = null, de = () => {
1670
- if (ue != null) {
1703
+ }, ce = !1, le = null, ue = () => {
1704
+ if (le != null) {
1671
1705
  try {
1672
- document.documentElement.releasePointerCapture(ue);
1706
+ document.documentElement.releasePointerCapture(le);
1673
1707
  } catch {}
1674
- ue = null;
1708
+ le = null;
1675
1709
  }
1676
- }, H = () => {
1677
- de(), d.cancel();
1678
- }, fe = (t) => {
1679
- !e || t.button !== 0 || !t.isPrimary || (le = !1, d.pointerDown(t.clientX, t.clientY));
1680
- }, pe = (n) => {
1710
+ }, U = () => {
1711
+ ue(), d.cancel();
1712
+ }, W = (t) => {
1713
+ !e || t.button !== 0 || !t.isPrimary || (ce = !1, d.pointerDown(t.clientX, t.clientY));
1714
+ }, de = (n) => {
1681
1715
  if (!e || !n.isPrimary) return;
1682
1716
  let r = d.isDragging();
1683
1717
  if (d.pointerMove(n.clientX, n.clientY), d.isDragging()) {
1684
1718
  if (!r) {
1685
- ue = n.pointerId;
1719
+ le = n.pointerId;
1686
1720
  try {
1687
1721
  document.documentElement.setPointerCapture(n.pointerId);
1688
1722
  } catch {}
1689
1723
  }
1690
1724
  t = null, s.style.display = "none", c.style.display = "none";
1691
1725
  }
1692
- }, me = (t) => {
1726
+ }, fe = (t) => {
1693
1727
  if (!e || !t.isPrimary) return;
1694
- de();
1728
+ ue();
1695
1729
  let n = d.pointerUp();
1696
1730
  if (!n) return;
1697
- le = !0, P();
1698
- let { elements: r, nodes: i, truncated: a } = In(n, p);
1731
+ ce = !0, P();
1732
+ let { elements: r, nodes: i, truncated: a } = Wn(n, p);
1699
1733
  console.info(`[levo-inspector] region drag: ${Math.round(n.width)}×${Math.round(n.height)} — ${r.length} element(s)${a ? " (truncated)" : ""}`), v(i);
1700
1734
  let s = ++h;
1701
- Jt(n, p).then((e) => {
1735
+ en(n, p).then((e) => {
1702
1736
  s === h && (console.info(`[levo-inspector] region capture ok (${Math.round(e.length / 1024)}kB)`), o.send({
1703
1737
  type: "region-selected",
1704
1738
  rect: n,
@@ -1715,25 +1749,25 @@ function Un() {
1715
1749
  dataUrl: null
1716
1750
  }));
1717
1751
  });
1718
- }, U = () => H(), he = (e) => {
1719
- let t = sn(e.target);
1752
+ }, pe = () => U(), me = (e) => {
1753
+ let t = hn(e.target);
1720
1754
  return t ? (e.preventDefault(), e.stopPropagation(), window.open(t, "_blank", "noopener,noreferrer"), !0) : !1;
1721
- }, ge = (i) => {
1722
- if (le) {
1723
- le = !1, i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1755
+ }, he = (i) => {
1756
+ if (ce) {
1757
+ ce = !1, i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1724
1758
  return;
1725
1759
  }
1726
1760
  if (r) {
1727
1761
  let e = C(document.elementFromPoint(i.clientX, i.clientY) || i.target);
1728
1762
  if (!e || e === L.editingNode()) {
1729
- he(i);
1763
+ me(i);
1730
1764
  return;
1731
1765
  }
1732
1766
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation(), L.startEdit(e);
1733
1767
  return;
1734
1768
  }
1735
1769
  if (!e) {
1736
- he(i);
1770
+ me(i);
1737
1771
  return;
1738
1772
  }
1739
1773
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
@@ -1742,14 +1776,14 @@ function Un() {
1742
1776
  let s = a.closest("[data-tsd-source]") || a;
1743
1777
  y(), g(), n = s, T(), N(), o.send({
1744
1778
  type: "element-selected",
1745
- element: fn(s)
1779
+ element: bn(s)
1746
1780
  });
1747
- }, _e = kn({
1781
+ }, ge = Ln({
1748
1782
  channel: o,
1749
1783
  originals: a,
1750
1784
  staged: R,
1751
1785
  setInspect: ee,
1752
- setTextEdit: te,
1786
+ setTextEdit: B,
1753
1787
  isInspecting: () => e,
1754
1788
  isTextEditing: () => r,
1755
1789
  editingNode: L.editingNode,
@@ -1765,7 +1799,7 @@ function Un() {
1765
1799
  startEditAtEnd: (e) => L.startEdit(e, !0),
1766
1800
  editableTarget: C,
1767
1801
  ownNodes: p
1768
- }), ve = [
1802
+ }), _e = [
1769
1803
  "mousedown",
1770
1804
  "mouseup",
1771
1805
  "dblclick",
@@ -1783,52 +1817,52 @@ function Un() {
1783
1817
  "touchstart",
1784
1818
  "touchend",
1785
1819
  "submit"
1786
- ], ye = (t) => {
1820
+ ], ve = (t) => {
1787
1821
  e && (t.cancelable && t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation());
1788
- }, be = () => {
1822
+ }, ye = () => {
1789
1823
  n && !r && T(), m.length > 0 && !r && _();
1790
- }, xe = () => {
1824
+ }, be = () => {
1791
1825
  let e = location.pathname.replace(/\/$/, "") || "/";
1792
1826
  o.send({
1793
1827
  type: "route",
1794
1828
  route: e
1795
1829
  });
1796
- }, Se = Cn({ onPathChange: () => {
1797
- P(), xe();
1798
- } }), Ce = (t) => {
1830
+ }, xe = jn({ onPathChange: () => {
1831
+ P(), be();
1832
+ } }), Se = (t) => {
1799
1833
  if (L.editingNode()) return;
1800
1834
  if (t.key === "Escape") {
1801
1835
  if (e && d.isDragging()) {
1802
- t.stopPropagation(), H();
1836
+ t.stopPropagation(), U();
1803
1837
  return;
1804
1838
  }
1805
- r ? (t.stopPropagation(), te(!1)) : e && (t.stopPropagation(), ee(!1));
1839
+ r ? (t.stopPropagation(), B(!1)) : e && (t.stopPropagation(), ee(!1));
1806
1840
  return;
1807
1841
  }
1808
- if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || t.repeat || cn(document.activeElement)) return;
1842
+ if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || t.repeat || gn(document.activeElement)) return;
1809
1843
  let n = t.key.toLowerCase();
1810
- n === "s" ? (t.preventDefault(), t.stopPropagation(), ee(!e)) : n === "t" && (t.preventDefault(), t.stopPropagation(), te(!r));
1844
+ n === "s" ? (t.preventDefault(), t.stopPropagation(), ee(!e)) : n === "t" && (t.preventDefault(), t.stopPropagation(), B(!r));
1811
1845
  };
1812
- 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);
1813
- for (let e of ve) window.addEventListener(e, ye, !0);
1814
- return console.info(`[levo-inspector] build ${Vn} — runtime mounted`), xe(), o.send({ type: "ready" }), () => {
1815
- 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);
1816
- for (let e of ve) window.removeEventListener(e, ye, !0);
1817
- 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();
1846
+ window.addEventListener("mousemove", ie, !0), window.addEventListener("scroll", oe, !0), window.addEventListener("resize", ye), window.addEventListener("click", he, !0), window.addEventListener("keydown", Se, !0), window.addEventListener("message", ge.onMessage), window.addEventListener("mouseout", se, !0), window.addEventListener("pointerdown", W, !0), window.addEventListener("pointermove", de, !0), window.addEventListener("pointerup", fe, !0), window.addEventListener("pointercancel", pe, !0);
1847
+ for (let e of _e) window.addEventListener(e, ve, !0);
1848
+ return console.info(`[levo-inspector] build ${Yn} — runtime mounted`), be(), o.send({ type: "ready" }), () => {
1849
+ window.removeEventListener("mousemove", ie, !0), window.removeEventListener("keydown", Se, !0), window.removeEventListener("scroll", oe, !0), window.removeEventListener("resize", ye), window.removeEventListener("mouseout", se, !0), window.removeEventListener("pointerdown", W, !0), window.removeEventListener("pointermove", de, !0), window.removeEventListener("pointerup", fe, !0), window.removeEventListener("pointercancel", pe, !0), window.removeEventListener("click", he, !0), window.removeEventListener("message", ge.onMessage);
1850
+ for (let e of _e) window.removeEventListener(e, ve, !0);
1851
+ O.disconnect(), k.disconnect(), E && cancelAnimationFrame(E), te && cancelAnimationFrame(te), H && cancelAnimationFrame(H), R.teardown(), xe.teardown(), L.teardown(), document.documentElement.style.cursor = "", b?.remove(), s.remove(), c.remove(), l.remove(), u.remove(), U(), d.node.remove();
1818
1852
  for (let e of f) e.remove();
1819
1853
  };
1820
1854
  }
1821
1855
  //#endregion
1822
1856
  //#region src/branding/MadeWithLevo.tsx
1823
- var Wn = "levo-made-with", Gn = `.${Wn}{opacity:.2;transition:opacity 150ms,transform 150ms}
1824
- .${Wn}:hover,.${Wn}:focus-visible{opacity:1;transform:translateY(-2px)}`, Kn = ({ slug: e }) => {
1857
+ var Qn = "levo-made-with", $n = `.${Qn}{opacity:.2;transition:opacity 150ms,transform 150ms}
1858
+ .${Qn}:hover,.${Qn}:focus-visible{opacity:1;transform:translateY(-2px)}`, er = ({ slug: e }) => {
1825
1859
  let t = `utm_source=${encodeURIComponent(e || "website")}&utm_term=Made%20With%20Levo&utm_campaign=footer_branding&utm_medium=organic_footer_branding`;
1826
1860
  return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("style", {
1827
1861
  href: "levo-made-with",
1828
1862
  precedence: "default",
1829
- children: Gn
1863
+ children: $n
1830
1864
  }), /* @__PURE__ */ P("a", {
1831
- className: Wn,
1865
+ className: Qn,
1832
1866
  href: `https://levo.so/?${t}`,
1833
1867
  target: "_blank",
1834
1868
  rel: "noopener noreferrer",
@@ -1859,23 +1893,23 @@ var Wn = "levo-made-with", Gn = `.${Wn}{opacity:.2;transition:opacity 150ms,tran
1859
1893
  }
1860
1894
  }), "Made with Levo"]
1861
1895
  })] });
1862
- }, qn = "levo:page-id", Jn = () => {
1896
+ }, tr = "levo:page-id", nr = () => {
1863
1897
  if (typeof document > "u") return null;
1864
- let e = document.querySelectorAll(`meta[name="${qn}"]`);
1898
+ let e = document.querySelectorAll(`meta[name="${tr}"]`);
1865
1899
  return e[e.length - 1]?.getAttribute("content")?.trim() || null;
1866
- }, Yn = C(() => import("./dist-DEXGyFeH.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), Xn = ({ siteId: e, pageId: t }) => {
1867
- let n = G(), r = i();
1900
+ }, rr = C(() => import("./dist-DTszGV-P.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), ir = ({ siteId: e, pageId: t }) => {
1901
+ let n = K(), r = i();
1868
1902
  return !n || !r ? null : /* @__PURE__ */ N(x, {
1869
1903
  fallback: null,
1870
- children: /* @__PURE__ */ N(Yn, {
1904
+ children: /* @__PURE__ */ N(rr, {
1871
1905
  pageId: t,
1872
1906
  siteId: e
1873
1907
  })
1874
1908
  });
1875
- }, Zn = S(null), Qn = Zn.Provider, $n = () => T(Zn), er = () => i(), tr = () => n(), nr = ({ site: e, analytics: t = !0, children: n }) => {
1909
+ }, ar = S(null), or = ar.Provider, sr = () => T(ar), cr = () => i(), lr = () => n(), ur = ({ site: e, analytics: t = !0, children: n }) => {
1876
1910
  let [i] = A(() => {
1877
1911
  if (!e) return null;
1878
- let n = Oe(e), r = De(n);
1912
+ let n = Me(e), r = je(n);
1879
1913
  return r ? {
1880
1914
  client: r,
1881
1915
  insights: ne(r, {
@@ -1884,33 +1918,33 @@ var Wn = "levo-made-with", Gn = `.${Wn}{opacity:.2;transition:opacity 150ms,tran
1884
1918
  }),
1885
1919
  site: e
1886
1920
  } : null;
1887
- }), [a, o] = A(null), s = B({ select: (e) => e.location.pathname }), c = On();
1921
+ }), [a, o] = A(null), s = V({ select: (e) => e.location.pathname }), c = In();
1888
1922
  return E(() => {
1889
1923
  i && (window.levo_client = i.client, window.levo_insights = i.insights);
1890
1924
  }, [i]), D(() => {
1891
1925
  if (!i) return;
1892
- let e = Jn();
1926
+ let e = nr();
1893
1927
  o(e), i.insights.init({ pageId: e });
1894
1928
  }, [i, s]), i ? /* @__PURE__ */ P(r, {
1895
1929
  client: i.client,
1896
1930
  insights: i.insights,
1897
1931
  children: [
1898
- /* @__PURE__ */ N(Qn, {
1932
+ /* @__PURE__ */ N(or, {
1899
1933
  value: i.site,
1900
1934
  children: n
1901
1935
  }),
1902
- !c && /* @__PURE__ */ N(Dt, {
1936
+ !c && /* @__PURE__ */ N(jt, {
1903
1937
  site: i.site,
1904
1938
  path: s
1905
1939
  }),
1906
- /* @__PURE__ */ N(Xn, {
1940
+ /* @__PURE__ */ N(ir, {
1907
1941
  pageId: a ?? void 0,
1908
1942
  siteId: i.site.id
1909
1943
  }),
1910
- !c && !!i.site.feature_flag?.branding && /* @__PURE__ */ N(Kn, { slug: i.site.slug })
1944
+ !c && !!i.site.feature_flag?.branding && /* @__PURE__ */ N(er, { slug: i.site.slug })
1911
1945
  ]
1912
1946
  }) : /* @__PURE__ */ N(M, { children: n });
1913
- }, rr = (e, t) => {
1947
+ }, dr = (e, t) => {
1914
1948
  let n = h(t);
1915
1949
  return ({ location: t }) => {
1916
1950
  if (!e.isLocalized) return;
@@ -1926,7 +1960,7 @@ var Wn = "levo-made-with", Gn = `.${Wn}{opacity:.2;transition:opacity 150ms,tran
1926
1960
  to: r.path
1927
1961
  });
1928
1962
  };
1929
- }, ir = (e) => {
1963
+ }, fr = (e) => {
1930
1964
  let t = e.locales ?? [], n = e.domain?.trim().replace(/^https?:\/\//, "").replace(/\/+$/, "");
1931
1965
  return {
1932
1966
  locales: t,
@@ -1934,8 +1968,8 @@ var Wn = "levo-made-with", Gn = `.${Wn}{opacity:.2;transition:opacity 150ms,tran
1934
1968
  isLocalized: t.length > 1,
1935
1969
  origin: n ? `https://${n}` : null
1936
1970
  };
1937
- }, ar = (e) => e.replace(/\/$/, ""), or = (e) => {
1938
- let { neutralPath: t, locales: n, activePrefix: r, hasRoute: i } = e, a = ar(e.origin), o = `${a}${t}`;
1971
+ }, pr = (e) => e.replace(/\/$/, ""), mr = (e) => {
1972
+ let { neutralPath: t, locales: n, activePrefix: r, hasRoute: i } = e, a = pr(e.origin), o = `${a}${t}`;
1939
1973
  if (n.length <= 1) return [{
1940
1974
  rel: "canonical",
1941
1975
  href: o
@@ -1957,11 +1991,14 @@ var Wn = "levo-made-with", Gn = `.${Wn}{opacity:.2;transition:opacity 150ms,tran
1957
1991
  hrefLang: "x-default",
1958
1992
  href: o
1959
1993
  }), s;
1960
- }, sr = ({ config: e, routeTree: t }) => {
1961
- let n = B({ select: (e) => e.location.pathname });
1994
+ }, hr = ({ to: e, ...t }) => /* @__PURE__ */ N(ee, {
1995
+ ...t,
1996
+ to: e
1997
+ }), gr = ({ config: e, routeTree: t }) => {
1998
+ let n = V({ select: (e) => e.location.pathname });
1962
1999
  if (!e.isLocalized || !e.origin) return null;
1963
2000
  let { neutralPath: r } = f(n, e.locales);
1964
- return /* @__PURE__ */ N(M, { children: or({
2001
+ return /* @__PURE__ */ N(M, { children: mr({
1965
2002
  neutralPath: r,
1966
2003
  origin: e.origin,
1967
2004
  locales: e.locales,
@@ -1971,7 +2008,7 @@ var Wn = "levo-made-with", Gn = `.${Wn}{opacity:.2;transition:opacity 150ms,tran
1971
2008
  hrefLang: e.hrefLang,
1972
2009
  rel: e.rel
1973
2010
  }, e.hrefLang ?? e.href)) });
1974
- }, cr = S(void 0), lr = ({ children: e, locale: t, locales: n, defaultLocale: r, source: i = "default", hasRoute: a }) => {
2011
+ }, _r = S(void 0), vr = ({ children: e, locale: t, locales: n, defaultLocale: r, source: i = "default", hasRoute: a }) => {
1975
2012
  let o = O(() => {
1976
2013
  let e = n?.length ? n : [t];
1977
2014
  return {
@@ -1995,13 +2032,13 @@ var Wn = "levo-made-with", Gn = `.${Wn}{opacity:.2;transition:opacity 150ms,tran
1995
2032
  i,
1996
2033
  a
1997
2034
  ]);
1998
- return /* @__PURE__ */ N(cr.Provider, {
2035
+ return /* @__PURE__ */ N(_r.Provider, {
1999
2036
  value: o,
2000
2037
  children: e
2001
2038
  });
2002
2039
  };
2003
- function ur() {
2004
- return T(cr) || {
2040
+ function yr() {
2041
+ return T(_r) || {
2005
2042
  locale: "en",
2006
2043
  locales: ["en"],
2007
2044
  defaultLocale: "en",
@@ -2011,13 +2048,13 @@ function ur() {
2011
2048
  pathFor: (e) => e
2012
2049
  };
2013
2050
  }
2014
- function dr(e) {
2015
- let { prefix: t } = f(B({ select: (e) => e.location.pathname }), e.locales);
2051
+ function br(e) {
2052
+ let { prefix: t } = f(V({ select: (e) => e.location.pathname }), e.locales);
2016
2053
  return t ?? e.defaultLocale;
2017
2054
  }
2018
- var fr = ({ config: e, children: t, routeTree: n }) => {
2019
- let { prefix: r } = f(B({ select: (e) => e.location.pathname }), e.locales);
2020
- return /* @__PURE__ */ N(lr, {
2055
+ var xr = ({ config: e, children: t, routeTree: n }) => {
2056
+ let { prefix: r } = f(V({ select: (e) => e.location.pathname }), e.locales);
2057
+ return /* @__PURE__ */ N(vr, {
2021
2058
  defaultLocale: e.defaultLocale,
2022
2059
  hasRoute: n ? h(n) : void 0,
2023
2060
  locale: r ?? e.defaultLocale,
@@ -2026,8 +2063,8 @@ var fr = ({ config: e, children: t, routeTree: n }) => {
2026
2063
  children: t
2027
2064
  });
2028
2065
  };
2029
- function pr() {
2030
- let { locale: e, locales: t, isMultiLocale: n, setLocale: r, pathFor: i, hasRoute: a } = ur(), o = B({ select: (e) => e.location.pathname });
2066
+ function Sr() {
2067
+ let { locale: e, locales: t, isMultiLocale: n, setLocale: r, pathFor: i, hasRoute: a } = yr(), o = V({ select: (e) => e.location.pathname });
2031
2068
  return O(() => {
2032
2069
  if (!n) return [];
2033
2070
  let { neutralPath: s } = f(o, t), c = t.filter((e) => !a || a(i(s, e)));
@@ -2054,14 +2091,14 @@ function pr() {
2054
2091
  }
2055
2092
  //#endregion
2056
2093
  //#region src/pageHead.tsx
2057
- var mr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), hr = (e) => {
2094
+ var Cr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), wr = (e) => {
2058
2095
  let t = {}, n = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("([^"]*)"|'([^']*)'|[^\s"'>]+))?/g;
2059
2096
  for (let r = n.exec(e); r; r = n.exec(e)) {
2060
2097
  let e = r[1];
2061
2098
  !e || /^on/i.test(e) || (t[e] = r[3] ?? r[4] ?? (r[2] ? r[2] : ""));
2062
2099
  }
2063
2100
  return t;
2064
- }, gr = (e) => {
2101
+ }, Tr = (e) => {
2065
2102
  let t = {
2066
2103
  meta: [],
2067
2104
  links: [],
@@ -2069,11 +2106,11 @@ var mr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), hr = (e) => {
2069
2106
  };
2070
2107
  if (!e?.trim()) return t;
2071
2108
  let n = e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi, (e, n, r) => {
2072
- let i = hr(n), a = r.trim();
2109
+ let i = wr(n), a = r.trim();
2073
2110
  return a && (i.children = a), t.scripts.push(i), "";
2074
2111
  });
2075
- return n = n.replace(/<(meta|link)\b([^>]*?)\/?>/gi, (e, n, r) => ((n.toLowerCase() === "meta" ? t.meta : t.links).push(hr(r)), "")), t;
2076
- }, _r = (e = {}, t = {}) => {
2112
+ return n = n.replace(/<(meta|link)\b([^>]*?)\/?>/gi, (e, n, r) => ((n.toLowerCase() === "meta" ? t.meta : t.links).push(wr(r)), "")), t;
2113
+ }, Er = (e = {}, t = {}) => {
2077
2114
  let n = {
2078
2115
  meta: [],
2079
2116
  links: [],
@@ -2135,17 +2172,17 @@ var mr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), hr = (e) => {
2135
2172
  let y = e.ldJson ? Array.isArray(e.ldJson) ? e.ldJson : [e.ldJson] : [];
2136
2173
  for (let e of y) n.scripts.push({
2137
2174
  type: "application/ld+json",
2138
- children: mr(e)
2175
+ children: Cr(e)
2139
2176
  });
2140
2177
  for (let r of [t.customHead, e.customHead]) {
2141
2178
  if (!r) continue;
2142
- let e = gr(r);
2179
+ let e = Tr(r);
2143
2180
  n.meta.push(...e.meta), n.links.push(...e.links), n.scripts.push(...e.scripts);
2144
2181
  }
2145
2182
  return n;
2146
2183
  };
2147
- function vr({ meta: e, site: t }) {
2148
- let n = _r(e, t);
2184
+ function Dr({ meta: e, site: t }) {
2185
+ let n = Er(e, t);
2149
2186
  return /* @__PURE__ */ P(M, { children: [
2150
2187
  n.meta.map((e, t) => e.title === void 0 ? /* @__PURE__ */ N("meta", { ...e }, `m${t}`) : /* @__PURE__ */ N("title", { children: e.title }, `t${t}`)),
2151
2188
  n.links.map((e, t) => /* @__PURE__ */ N("link", { ...e }, `l${t}`)),
@@ -2157,9 +2194,9 @@ function vr({ meta: e, site: t }) {
2157
2194
  }
2158
2195
  //#endregion
2159
2196
  //#region src/registration/ui.tsx
2160
- var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, children: n }) => /* @__PURE__ */ N("div", {
2197
+ var X = (...e) => e.filter(Boolean).join(" "), Or = ({ open: e, className: t, children: n }) => /* @__PURE__ */ N("div", {
2161
2198
  inert: !e,
2162
- 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"),
2199
+ className: X("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"),
2163
2200
  children: /* @__PURE__ */ N("div", {
2164
2201
  className: "overflow-hidden",
2165
2202
  children: /* @__PURE__ */ N("div", {
@@ -2167,7 +2204,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2167
2204
  children: n
2168
2205
  })
2169
2206
  })
2170
- }), br = [
2207
+ }), kr = [
2171
2208
  {
2172
2209
  key: "email",
2173
2210
  label: "Email",
@@ -2200,7 +2237,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2200
2237
  inputMode: void 0,
2201
2238
  autoComplete: "organization-title"
2202
2239
  }
2203
- ], xr = [{
2240
+ ], Ar = [{
2204
2241
  key: "name",
2205
2242
  label: "Registered company name",
2206
2243
  placeholder: "Acme Corporation",
@@ -2210,7 +2247,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2210
2247
  label: "Tax ID / GST number",
2211
2248
  placeholder: "22AAAAA0000A1Z5",
2212
2249
  autoComplete: "off"
2213
- }], Sr = [
2250
+ }], jr = [
2214
2251
  {
2215
2252
  key: "line1",
2216
2253
  label: "Billing address",
@@ -2259,167 +2296,251 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2259
2296
  wide: !1,
2260
2297
  optional: !1
2261
2298
  }
2262
- ], Cr = (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"), wr = "flex items-baseline gap-1.5 font-medium text-ink text-sm", Tr = () => /* @__PURE__ */ N("span", {
2299
+ ], Mr = (e) => X("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"), Nr = "flex items-baseline gap-1.5 font-medium text-ink text-sm", Pr = () => /* @__PURE__ */ N("span", {
2263
2300
  "aria-hidden": !0,
2264
2301
  className: "text-danger",
2265
2302
  children: "*"
2266
- }), Er = ({ values: e, errors: t, touched: n, onChange: r, onBlur: i, showBusinessBilling: a = !1, registrationFields: o, nameInputRef: s }) => {
2267
- let c = (t, n) => r("billing_details", {
2268
- ...e.billing_details,
2269
- [t]: n
2270
- }), l = (t, n) => r("billing_details", {
2271
- ...e.billing_details,
2272
- address: {
2273
- ...e.billing_details.address,
2274
- [t]: n
2275
- }
2276
- }), u = !!e.billing_details.name.trim() || !!e.billing_details.tax_id.trim() || Object.values(e.billing_details.address).some((e) => !!e.trim());
2277
- return /* @__PURE__ */ P("div", {
2278
- className: "flex flex-col gap-4",
2279
- children: [
2280
- /* @__PURE__ */ P("div", {
2303
+ }), Fr = ({ values: e, errors: t, touched: n, onChange: r, onBlur: i, showBusinessBilling: a = !1, registrationFields: o, nameInputRef: s, idPrefix: c = "attendee", nameLabel: l = "Your name" }) => /* @__PURE__ */ P("div", {
2304
+ className: "flex flex-col gap-4",
2305
+ children: [
2306
+ /* @__PURE__ */ P("div", {
2307
+ className: "flex flex-col gap-1.5",
2308
+ children: [
2309
+ /* @__PURE__ */ P("label", {
2310
+ htmlFor: `${c}-name`,
2311
+ className: Nr,
2312
+ children: [l, /* @__PURE__ */ N(Pr, {})]
2313
+ }),
2314
+ /* @__PURE__ */ N("input", {
2315
+ ref: s,
2316
+ id: `${c}-name`,
2317
+ name: "name",
2318
+ type: "text",
2319
+ autoComplete: "name",
2320
+ placeholder: "John Doe",
2321
+ value: e.name,
2322
+ onChange: (e) => r("name", e.target.value),
2323
+ onBlur: () => i("name"),
2324
+ className: Mr(n.name && !!t.name),
2325
+ required: !0
2326
+ }),
2327
+ n.name && t.name && /* @__PURE__ */ N("p", {
2328
+ className: "m-0 text-danger text-xs",
2329
+ children: t.name
2330
+ })
2331
+ ]
2332
+ }),
2333
+ kr.map((a) => {
2334
+ let s = o[a.key];
2335
+ if (s === "off") return null;
2336
+ let l = n[a.key] ? t[a.key] : void 0, u = a.key === "email" || a.key === "mobile";
2337
+ return /* @__PURE__ */ P("div", {
2281
2338
  className: "flex flex-col gap-1.5",
2282
2339
  children: [
2283
2340
  /* @__PURE__ */ P("label", {
2284
- htmlFor: "attendee-name",
2285
- className: wr,
2286
- children: ["Your name", /* @__PURE__ */ N(Tr, {})]
2341
+ htmlFor: `${c}-${a.key}`,
2342
+ className: Nr,
2343
+ children: [a.label, s === "required" ? /* @__PURE__ */ N(Pr, {}) : /* @__PURE__ */ N("span", {
2344
+ className: "font-normal text-ink-muted text-xs",
2345
+ children: "Optional"
2346
+ })]
2287
2347
  }),
2288
2348
  /* @__PURE__ */ N("input", {
2289
- ref: s,
2290
- id: "attendee-name",
2291
- name: "name",
2292
- type: "text",
2293
- autoComplete: "name",
2294
- placeholder: "John Doe",
2295
- value: e.name,
2296
- onChange: (e) => r("name", e.target.value),
2297
- onBlur: () => i("name"),
2298
- className: Cr(n.name && !!t.name),
2299
- required: !0
2349
+ id: `${c}-${a.key}`,
2350
+ name: a.key,
2351
+ type: a.type,
2352
+ inputMode: a.inputMode,
2353
+ autoComplete: a.autoComplete,
2354
+ autoCapitalize: u ? "none" : void 0,
2355
+ autoCorrect: u ? "off" : void 0,
2356
+ spellCheck: u ? !1 : void 0,
2357
+ placeholder: a.placeholder,
2358
+ value: e[a.key],
2359
+ onChange: (e) => r(a.key, e.target.value),
2360
+ onBlur: () => i(a.key),
2361
+ className: Mr(!!l),
2362
+ required: s === "required"
2300
2363
  }),
2301
- n.name && t.name && /* @__PURE__ */ N("p", {
2364
+ l && /* @__PURE__ */ N("p", {
2302
2365
  className: "m-0 text-danger text-xs",
2303
- children: t.name
2366
+ children: l
2304
2367
  })
2305
2368
  ]
2369
+ }, a.key);
2370
+ }),
2371
+ a && /* @__PURE__ */ N(Ir, {
2372
+ values: e,
2373
+ onChange: r
2374
+ })
2375
+ ]
2376
+ }), Ir = ({ values: e, onChange: t }) => {
2377
+ let n = (n, r) => t("billing_details", {
2378
+ ...e.billing_details,
2379
+ [n]: r
2380
+ }), r = (n, r) => t("billing_details", {
2381
+ ...e.billing_details,
2382
+ address: {
2383
+ ...e.billing_details.address,
2384
+ [n]: r
2385
+ }
2386
+ }), i = !!e.billing_details.name.trim() || !!e.billing_details.tax_id.trim() || Object.values(e.billing_details.address).some((e) => !!e.trim());
2387
+ return /* @__PURE__ */ P("div", {
2388
+ className: "rounded-xl border border-border bg-ink/3",
2389
+ children: [
2390
+ /* @__PURE__ */ P("label", {
2391
+ htmlFor: "is_business_purchase",
2392
+ className: "flex w-full cursor-pointer items-center gap-2.5 px-3.5 py-3 text-ink text-sm",
2393
+ children: [/* @__PURE__ */ N("input", {
2394
+ id: "is_business_purchase",
2395
+ type: "checkbox",
2396
+ checked: e.is_business_purchase,
2397
+ onChange: (e) => t("is_business_purchase", e.target.checked),
2398
+ "aria-expanded": e.is_business_purchase,
2399
+ className: "size-4 shrink-0 cursor-pointer rounded accent-brand"
2400
+ }), "Bill this to a business — I need a GST invoice"]
2401
+ }),
2402
+ !e.is_business_purchase && i && /* @__PURE__ */ N("p", {
2403
+ 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",
2404
+ children: "Your billing details are still saved — tick the box to apply them."
2306
2405
  }),
2307
- br.map((a) => {
2308
- let s = o[a.key];
2309
- if (s === "off") return null;
2310
- let c = n[a.key] ? t[a.key] : void 0, l = a.key === "email" || a.key === "mobile";
2311
- return /* @__PURE__ */ P("div", {
2312
- className: "flex flex-col gap-1.5",
2406
+ /* @__PURE__ */ N(Or, {
2407
+ open: e.is_business_purchase,
2408
+ className: "px-3.5 pb-3.5",
2409
+ children: /* @__PURE__ */ P("div", {
2410
+ className: "flex flex-col gap-3",
2313
2411
  children: [
2314
- /* @__PURE__ */ P("label", {
2315
- htmlFor: `attendee-${a.key}`,
2316
- className: wr,
2317
- children: [a.label, s === "required" ? /* @__PURE__ */ N(Tr, {}) : /* @__PURE__ */ N("span", {
2318
- className: "font-normal text-ink-muted text-xs",
2319
- children: "Optional"
2320
- })]
2321
- }),
2322
- /* @__PURE__ */ N("input", {
2323
- id: `attendee-${a.key}`,
2324
- name: a.key,
2325
- type: a.type,
2326
- inputMode: a.inputMode,
2327
- autoComplete: a.autoComplete,
2328
- autoCapitalize: l ? "none" : void 0,
2329
- autoCorrect: l ? "off" : void 0,
2330
- spellCheck: l ? !1 : void 0,
2331
- placeholder: a.placeholder,
2332
- value: e[a.key],
2333
- onChange: (e) => r(a.key, e.target.value),
2334
- onBlur: () => i(a.key),
2335
- className: Cr(!!c),
2336
- required: s === "required"
2412
+ /* @__PURE__ */ N("p", {
2413
+ className: "m-0 text-ink-muted text-xs leading-relaxed",
2414
+ children: "This booking will be billed to your business. The invoice is raised against the details below."
2337
2415
  }),
2338
- c && /* @__PURE__ */ N("p", {
2339
- className: "m-0 text-danger text-xs",
2340
- children: c
2416
+ Ar.map((t) => /* @__PURE__ */ P("div", {
2417
+ className: "flex flex-col gap-1.5",
2418
+ children: [/* @__PURE__ */ P("label", {
2419
+ htmlFor: `billing-${t.key}`,
2420
+ className: Nr,
2421
+ children: [t.label, /* @__PURE__ */ N(Pr, {})]
2422
+ }), /* @__PURE__ */ N("input", {
2423
+ id: `billing-${t.key}`,
2424
+ className: Mr(),
2425
+ placeholder: t.placeholder,
2426
+ autoComplete: t.autoComplete,
2427
+ value: e.billing_details[t.key],
2428
+ onChange: (e) => n(t.key, e.target.value),
2429
+ required: e.is_business_purchase
2430
+ })]
2431
+ }, t.key)),
2432
+ /* @__PURE__ */ N("div", {
2433
+ className: "grid grid-cols-2 gap-3",
2434
+ children: jr.map((t) => /* @__PURE__ */ P("div", {
2435
+ className: X("flex flex-col gap-1.5", t.wide && "col-span-2"),
2436
+ children: [/* @__PURE__ */ P("label", {
2437
+ htmlFor: `billing-${t.key}`,
2438
+ className: Nr,
2439
+ children: [t.label, !t.optional && /* @__PURE__ */ N(Pr, {})]
2440
+ }), /* @__PURE__ */ N("input", {
2441
+ id: `billing-${t.key}`,
2442
+ className: Mr(),
2443
+ placeholder: t.placeholder,
2444
+ autoComplete: t.autoComplete,
2445
+ inputMode: t.key === "postal_code" ? "numeric" : void 0,
2446
+ value: e.billing_details.address[t.key],
2447
+ onChange: (e) => r(t.key, e.target.value),
2448
+ required: e.is_business_purchase && !t.optional
2449
+ })]
2450
+ }, t.key))
2341
2451
  })
2342
2452
  ]
2343
- }, a.key);
2344
- }),
2345
- a && /* @__PURE__ */ P("div", {
2346
- className: "rounded-xl border border-border bg-ink/3",
2347
- children: [
2348
- /* @__PURE__ */ P("label", {
2349
- htmlFor: "is_business_purchase",
2350
- className: "flex w-full cursor-pointer items-center gap-2.5 px-3.5 py-3 text-ink text-sm",
2351
- children: [/* @__PURE__ */ N("input", {
2352
- id: "is_business_purchase",
2353
- type: "checkbox",
2354
- checked: e.is_business_purchase,
2355
- onChange: (e) => r("is_business_purchase", e.target.checked),
2356
- "aria-expanded": e.is_business_purchase,
2357
- className: "size-4 shrink-0 cursor-pointer rounded accent-brand"
2358
- }), "Bill this to a business — I need a GST invoice"]
2359
- }),
2360
- !e.is_business_purchase && u && /* @__PURE__ */ N("p", {
2361
- 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",
2362
- children: "Your billing details are still saved — tick the box to apply them."
2363
- }),
2364
- /* @__PURE__ */ N(yr, {
2365
- open: e.is_business_purchase,
2366
- className: "px-3.5 pb-3.5",
2367
- children: /* @__PURE__ */ P("div", {
2368
- className: "flex flex-col gap-3",
2453
+ })
2454
+ })
2455
+ ]
2456
+ });
2457
+ }, Lr = ({ attendees: e, openKey: t, onOpenChange: n }) => {
2458
+ let { slots: r } = e, i = [];
2459
+ for (let e of r) {
2460
+ let t = i.at(-1);
2461
+ t?.ticketId === e.ticket._id ? t.slots.push(e) : i.push({
2462
+ ticketId: e.ticket._id,
2463
+ title: e.ticket.title,
2464
+ slots: [e]
2465
+ });
2466
+ }
2467
+ let a = (t) => {
2468
+ e.touchSlot(t), e.isSlotValid(t) && n(r[r.findIndex((e) => e.key === t) + 1]?.key ?? null);
2469
+ };
2470
+ return /* @__PURE__ */ N(U.Root, {
2471
+ value: t ? [t] : [],
2472
+ onValueChange: (e) => n(e[0] ?? null),
2473
+ className: "flex flex-col gap-5",
2474
+ children: i.map((n) => /* @__PURE__ */ P("section", {
2475
+ className: "flex flex-col gap-2",
2476
+ children: [/* @__PURE__ */ P("h4", {
2477
+ className: "m-0 font-semibold text-[15px] text-ink leading-snug [overflow-wrap:anywhere]",
2478
+ children: [n.title, n.slots.length > 1 && /* @__PURE__ */ P("span", {
2479
+ className: "ml-1.5 font-normal text-ink-muted tabular-nums",
2480
+ children: ["× ", n.slots.length]
2481
+ })]
2482
+ }), n.slots.map((n, i) => {
2483
+ let o = n.key === t, s = n.key === r.at(-1)?.key, c = e.getValues(n.key), l = e.isSlotValid(n.key), u = !l && e.isSlotVisited(n.key), d = n.key === r[0]?.key;
2484
+ return /* @__PURE__ */ P(U.Item, {
2485
+ value: n.key,
2486
+ className: X("rounded-xl border transition-colors", o ? "border-brand/60" : u ? "border-danger/50" : "border-border"),
2487
+ children: [/* @__PURE__ */ N(U.Header, {
2488
+ className: "m-0",
2489
+ children: /* @__PURE__ */ P(U.Trigger, {
2490
+ className: "group flex w-full items-center gap-3 px-3.5 py-3 text-left",
2369
2491
  children: [
2370
- /* @__PURE__ */ N("p", {
2371
- className: "m-0 text-ink-muted text-xs leading-relaxed",
2372
- children: "This booking will be billed to your business. The invoice is raised against the details below."
2492
+ /* @__PURE__ */ N("span", {
2493
+ "aria-hidden": !0,
2494
+ className: X("inline-flex size-7 shrink-0 items-center justify-center rounded-full font-semibold text-[12.5px] tabular-nums transition-colors", l ? "bg-emerald-500/10 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400" : u ? "bg-danger/10 text-danger" : "bg-ink/5 text-ink-soft"),
2495
+ children: l ? /* @__PURE__ */ N(H, { className: "size-3.5" }) : i + 1
2373
2496
  }),
2374
- xr.map((t) => /* @__PURE__ */ P("div", {
2375
- className: "flex flex-col gap-1.5",
2376
- children: [/* @__PURE__ */ P("label", {
2377
- htmlFor: `billing-${t.key}`,
2378
- className: wr,
2379
- children: [t.label, /* @__PURE__ */ N(Tr, {})]
2380
- }), /* @__PURE__ */ N("input", {
2381
- id: `billing-${t.key}`,
2382
- className: Cr(),
2383
- placeholder: t.placeholder,
2384
- autoComplete: t.autoComplete,
2385
- value: e.billing_details[t.key],
2386
- onChange: (e) => c(t.key, e.target.value),
2387
- required: e.is_business_purchase
2497
+ /* @__PURE__ */ P("span", {
2498
+ className: "min-w-0 flex-1",
2499
+ children: [/* @__PURE__ */ P("span", {
2500
+ className: "block font-medium text-[14.5px] text-ink",
2501
+ children: ["Attendee ", i + 1]
2502
+ }), !o && /* @__PURE__ */ N("span", {
2503
+ className: X("mt-0.5 block truncate text-[12.5px]", u ? "text-danger" : "text-ink-muted"),
2504
+ children: u ? "Details missing" : c.name.trim() || (d ? "Your details" : "Add details")
2388
2505
  })]
2389
- }, t.key)),
2390
- /* @__PURE__ */ N("div", {
2391
- className: "grid grid-cols-2 gap-3",
2392
- children: Sr.map((t) => /* @__PURE__ */ P("div", {
2393
- className: Z("flex flex-col gap-1.5", t.wide && "col-span-2"),
2394
- children: [/* @__PURE__ */ P("label", {
2395
- htmlFor: `billing-${t.key}`,
2396
- className: wr,
2397
- children: [t.label, !t.optional && /* @__PURE__ */ N(Tr, {})]
2398
- }), /* @__PURE__ */ N("input", {
2399
- id: `billing-${t.key}`,
2400
- className: Cr(),
2401
- placeholder: t.placeholder,
2402
- autoComplete: t.autoComplete,
2403
- inputMode: t.key === "postal_code" ? "numeric" : void 0,
2404
- value: e.billing_details.address[t.key],
2405
- onChange: (e) => l(t.key, e.target.value),
2406
- required: e.is_business_purchase && !t.optional
2407
- })]
2408
- }, t.key))
2506
+ }),
2507
+ /* @__PURE__ */ N(ae, {
2508
+ "aria-hidden": !0,
2509
+ className: "size-4 shrink-0 text-ink-muted transition-transform group-data-[panel-open]:rotate-180"
2409
2510
  })
2410
2511
  ]
2411
2512
  })
2412
- })
2413
- ]
2414
- })
2415
- ]
2513
+ }), /* @__PURE__ */ N(U.Panel, {
2514
+ className: "h-[var(--accordion-panel-height)] overflow-hidden transition-[height] duration-250 ease-[cubic-bezier(0.32,0.72,0,1)] data-[ending-style]:h-0 data-[starting-style]:h-0 motion-reduce:transition-none",
2515
+ children: /* @__PURE__ */ P("div", {
2516
+ className: "flex flex-col gap-4 px-3.5 pb-3.5",
2517
+ children: [/* @__PURE__ */ N(Fr, {
2518
+ idPrefix: `attendee-${n.key.replace(":", "-")}`,
2519
+ nameLabel: "Full name",
2520
+ values: c,
2521
+ errors: e.errors[n.key] ?? {},
2522
+ touched: e.getTouched(n.key),
2523
+ onChange: (t, r) => e.setField(n.key, t, r),
2524
+ onBlur: (t) => e.touchField(n.key, t),
2525
+ registrationFields: n.rules
2526
+ }), !s && /* @__PURE__ */ N("button", {
2527
+ type: "button",
2528
+ onClick: () => a(n.key),
2529
+ className: "inline-flex min-h-[42px] items-center justify-center rounded-xl border border-border font-medium text-[14px] text-ink transition hover:border-brand active:scale-[0.985]",
2530
+ children: "Next attendee"
2531
+ })]
2532
+ })
2533
+ })]
2534
+ }, n.key);
2535
+ })]
2536
+ }, n.ticketId))
2416
2537
  });
2417
- }, Dr = {
2538
+ }, Rr = {
2418
2539
  USD: "$",
2419
2540
  EUR: "€",
2420
2541
  GBP: "£",
2421
2542
  INR: "₹"
2422
- }, Q = (e) => {
2543
+ }, Z = (e) => {
2423
2544
  let t = e?.unit_amount;
2424
2545
  if (t == null) return "";
2425
2546
  if (t === 0) return "Free";
@@ -2432,17 +2553,102 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2432
2553
  maximumFractionDigits: 2
2433
2554
  }).format(r);
2434
2555
  } catch {
2435
- return `${Dr[n] ?? n} ${r.toLocaleString()}`;
2556
+ return `${Rr[n] ?? n} ${r.toLocaleString()}`;
2436
2557
  }
2437
- }, Or = (e) => !e.tax_enabled || !e.taxes?.length ? null : e.tax_inclusive ? "incl. taxes" : "+ taxes", kr = (e) => !!e?.taxes?.length && e.tax_amount !== void 0, Ar = (e) => !!e && "subtotal" in e && e.tax_enabled === !0 && !!e.taxes?.length, jr = (e, t) => t ? t.total_amount ?? t.sale_amount ?? 0 : Ar(e) ? e.total ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Mr = (e, t) => {
2558
+ }, zr = (e) => !e.tax_enabled || !e.taxes?.length ? null : e.tax_inclusive ? "incl. taxes" : "+ taxes", Br = (e) => !!e?.taxes?.length && e.tax_amount !== void 0, Vr = (e) => !!e && "subtotal" in e && e.tax_enabled === !0 && !!e.taxes?.length, Hr = (e, t) => t ? t.total_amount ?? t.sale_amount ?? 0 : Vr(e) ? e.total ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Ur = (e, t) => {
2438
2559
  if (!e) return null;
2439
- let n = jr(e, t);
2560
+ let n = Hr(e, t);
2440
2561
  return {
2441
2562
  amount: n,
2442
2563
  currency: e.currency,
2443
2564
  isFree: n === 0
2444
2565
  };
2445
- }, Nr = (e, t) => t ? t.base_amount ?? 0 : Ar(e) ? e.subtotal ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Pr = (e, t) => kr(t) ? t.taxes : !t && Ar(e) ? e.taxes : [], Fr = (e, t) => !t || e.tickets.length === 0 ? !0 : e.tickets.some((e) => typeof e == "string" ? e === t : e._id === t), Ir = (e) => e.kind === "percent" ? `${e.percent_off}% off` : `${Dr[e.currency ?? "INR"] ?? ""}${(e.amount_off ?? 0) / 100} off`, Lr = ({ couponCode: e, onCouponCodeChange: t, couponError: n, couponLoading: r, onValidateCoupon: i, onRemoveCoupon: a, publicCoupons: o, discount: s, selectedTicket: c }) => {
2566
+ }, Wr = (e, t) => t ? t.base_amount ?? 0 : Vr(e) ? e.subtotal ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Gr = (e, t) => Br(t) ? t.taxes : !t && Vr(e) ? e.taxes : [], Kr = ({ ticket: e, count: t }) => Hr(e, null) * t, qr = (e, t) => {
2567
+ if (e.length === 0) return null;
2568
+ let n = t ? Hr(null, t) : e.reduce((e, t) => e + Kr(t), 0);
2569
+ return {
2570
+ amount: n,
2571
+ currency: e[0]?.ticket.currency,
2572
+ isFree: n === 0
2573
+ };
2574
+ }, Jr = ({ lines: e, discount: t, pricing: n }) => {
2575
+ let r = n?.currency, i = e.some((e) => zr(e.ticket));
2576
+ return /* @__PURE__ */ P("div", {
2577
+ className: "rounded-xl border border-border bg-ink/3 px-3.5 py-3",
2578
+ children: [/* @__PURE__ */ P("div", {
2579
+ className: "flex flex-col gap-1.5 text-[13.5px] text-ink-soft",
2580
+ children: [
2581
+ e.map((e) => /* @__PURE__ */ P("div", {
2582
+ className: "flex items-baseline justify-between gap-3",
2583
+ children: [/* @__PURE__ */ P("span", {
2584
+ className: "min-w-0 [overflow-wrap:anywhere]",
2585
+ children: [
2586
+ /* @__PURE__ */ P("span", {
2587
+ className: "text-ink tabular-nums",
2588
+ children: [e.count, " ×"]
2589
+ }),
2590
+ " ",
2591
+ e.ticket.title
2592
+ ]
2593
+ }), /* @__PURE__ */ N("span", {
2594
+ className: "shrink-0 tabular-nums",
2595
+ children: Z({
2596
+ unit_amount: Kr(e),
2597
+ currency: r
2598
+ })
2599
+ })]
2600
+ }, e.ticket._id)),
2601
+ t && t.discount > 0 && /* @__PURE__ */ P("div", {
2602
+ className: "flex items-center justify-between gap-3 text-emerald-700 dark:text-emerald-400",
2603
+ children: [/* @__PURE__ */ N("span", { children: "Discount" }), /* @__PURE__ */ P("span", {
2604
+ className: "tabular-nums",
2605
+ children: ["-", Z({
2606
+ unit_amount: t.discount,
2607
+ currency: r
2608
+ })]
2609
+ })]
2610
+ }),
2611
+ i && /* @__PURE__ */ N("p", {
2612
+ className: "m-0 text-ink-muted text-xs",
2613
+ children: "Prices include applicable taxes"
2614
+ })
2615
+ ]
2616
+ }), /* @__PURE__ */ P("div", {
2617
+ className: "mt-2.5 flex items-center justify-between gap-3 border-border border-t pt-2.5 font-semibold text-[15px] text-ink",
2618
+ children: [/* @__PURE__ */ N("span", { children: "Total" }), /* @__PURE__ */ N("span", {
2619
+ className: "tabular-nums",
2620
+ children: Z({
2621
+ unit_amount: n?.amount,
2622
+ currency: r
2623
+ })
2624
+ })]
2625
+ })]
2626
+ });
2627
+ }, Yr = ({ payment: e, label: t, isPaid: n, blockedReason: r }) => {
2628
+ let { state: i } = e, a = i.kind === "busy";
2629
+ return /* @__PURE__ */ P(M, { children: [
2630
+ (i.kind === "unpaid" || i.kind === "failed") && /* @__PURE__ */ P("p", {
2631
+ role: "alert",
2632
+ 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",
2633
+ children: [i.message, i.kind === "unpaid" && /* @__PURE__ */ N("button", {
2634
+ type: "button",
2635
+ onClick: e.retry,
2636
+ className: "ml-1.5 inline-flex items-center gap-1 font-semibold underline underline-offset-[3px]",
2637
+ children: "Pay again"
2638
+ })]
2639
+ }),
2640
+ /* @__PURE__ */ P("button", {
2641
+ type: "submit",
2642
+ disabled: a || !!r,
2643
+ 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",
2644
+ children: [a && /* @__PURE__ */ N(se, { className: "size-4 animate-spin" }), a && i.stage === "paying" ? "Opening secure checkout" : t]
2645
+ }),
2646
+ /* @__PURE__ */ N("p", {
2647
+ className: "m-0 mt-2 text-center text-ink-muted text-xs",
2648
+ children: r ?? (n ? "Secure payment · confirmation sent to your email" : "No card needed · joining link sent to your email")
2649
+ })
2650
+ ] });
2651
+ }, Xr = (e, t) => t.length === 0 || e.tickets.length === 0 ? !0 : e.tickets.some((e) => t.includes(typeof e == "string" ? e : e._id)), Zr = (e) => e.kind === "percent" ? `${e.percent_off}% off` : `${Rr[e.currency ?? "INR"] ?? ""}${(e.amount_off ?? 0) / 100} off`, Qr = ({ couponCode: e, onCouponCodeChange: t, couponError: n, couponLoading: r, onValidateCoupon: i, onRemoveCoupon: a, publicCoupons: o, discount: s, tickets: c }) => {
2446
2652
  let [l, u] = A(!1);
2447
2653
  if (s) return /* @__PURE__ */ P("div", {
2448
2654
  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",
@@ -2456,9 +2662,9 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2456
2662
  children: [
2457
2663
  "saves",
2458
2664
  " ",
2459
- Q({
2665
+ Z({
2460
2666
  unit_amount: s.discount,
2461
- currency: c?.currency
2667
+ currency: c[0]?.currency
2462
2668
  })
2463
2669
  ]
2464
2670
  })]
@@ -2469,10 +2675,10 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2469
2675
  },
2470
2676
  "aria-label": "Remove coupon",
2471
2677
  className: "inline-flex shrink-0 rounded-md p-1 hover:bg-emerald-600/15",
2472
- children: /* @__PURE__ */ N(ce, { className: "size-4" })
2678
+ children: /* @__PURE__ */ N(ue, { className: "size-4" })
2473
2679
  })]
2474
2680
  });
2475
- let d = o.filter((e) => Fr(e, c?._id));
2681
+ let d = o.filter((e) => Xr(e, c.map((e) => e._id)));
2476
2682
  return /* @__PURE__ */ P("div", {
2477
2683
  className: "flex flex-col",
2478
2684
  children: [/* @__PURE__ */ N("button", {
@@ -2481,7 +2687,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2481
2687
  onClick: () => u((e) => !e),
2482
2688
  className: "self-start text-[13px] text-ink-soft underline underline-offset-[3px] hover:text-ink",
2483
2689
  children: "Have a code?"
2484
- }), /* @__PURE__ */ N(yr, {
2690
+ }), /* @__PURE__ */ N(Or, {
2485
2691
  open: l,
2486
2692
  children: /* @__PURE__ */ P("div", {
2487
2693
  className: "flex flex-col gap-2 pt-2",
@@ -2500,7 +2706,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2500
2706
  onKeyDown: (t) => {
2501
2707
  t.key === "Enter" && (t.preventDefault(), e.trim() && i());
2502
2708
  },
2503
- 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")
2709
+ className: X("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")
2504
2710
  }), /* @__PURE__ */ P("button", {
2505
2711
  type: "button",
2506
2712
  disabled: !e.trim() || r,
@@ -2525,7 +2731,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2525
2731
  children: [
2526
2732
  e.code,
2527
2733
  " · ",
2528
- Ir(e)
2734
+ Zr(e)
2529
2735
  ]
2530
2736
  }, e._id))
2531
2737
  })
@@ -2533,11 +2739,11 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2533
2739
  })
2534
2740
  })]
2535
2741
  });
2536
- }, Rr = (e) => {
2742
+ }, $r = (e) => {
2537
2743
  if (e < 60) return `${e} min`;
2538
2744
  let t = Math.floor(e / 60), n = e % 60, r = `${t} hr`;
2539
2745
  return n ? `${r} ${n} min` : r;
2540
- }, zr = (e, t) => {
2746
+ }, ei = (e, t) => {
2541
2747
  if (!e) return null;
2542
2748
  let n = new Date(e);
2543
2749
  if (Number.isNaN(n.getTime())) return null;
@@ -2552,26 +2758,26 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2552
2758
  }).format(n), a = null;
2553
2759
  if (t) {
2554
2760
  let e = new Date(t), r = Math.round((e.getTime() - n.getTime()) / 6e4);
2555
- !Number.isNaN(r) && r > 0 && (a = Rr(r));
2761
+ !Number.isNaN(r) && r > 0 && (a = $r(r));
2556
2762
  }
2557
2763
  return {
2558
2764
  day: r,
2559
2765
  time: i,
2560
2766
  duration: a
2561
2767
  };
2562
- }, Br = 60, Vr = (e) => e.toISOString().replace(/[-:]/g, "").replace(/\.\d+/, ""), Hr = (e) => {
2768
+ }, ti = 60, ni = (e) => e.toISOString().replace(/[-:]/g, "").replace(/\.\d+/, ""), ri = (e) => {
2563
2769
  if (!e.startsAt) return null;
2564
2770
  let t = new Date(e.startsAt);
2565
2771
  if (Number.isNaN(t.getTime())) return null;
2566
2772
  let n = e.endsAt ? new Date(e.endsAt) : null;
2567
2773
  return {
2568
2774
  start: t,
2569
- end: n && !Number.isNaN(n.getTime()) && n > t ? n : new Date(t.getTime() + Br * 6e4)
2775
+ end: n && !Number.isNaN(n.getTime()) && n > t ? n : new Date(t.getTime() + ti * 6e4)
2570
2776
  };
2571
- }, Ur = (e) => {
2572
- let t = Hr(e);
2777
+ }, ii = (e) => {
2778
+ let t = ri(e);
2573
2779
  if (!t) return null;
2574
- let n = Vr(t.start), r = Vr(t.end), i = [e.description, e.url].filter(Boolean).join("\n\n"), a = `https://calendar.google.com/calendar/render?${new URLSearchParams({
2780
+ let n = ni(t.start), r = ni(t.end), i = [e.description, e.url].filter(Boolean).join("\n\n"), a = `https://calendar.google.com/calendar/render?${new URLSearchParams({
2575
2781
  action: "TEMPLATE",
2576
2782
  text: e.title,
2577
2783
  dates: `${n}/${r}`,
@@ -2605,65 +2811,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2605
2811
  "END:VCALENDAR"
2606
2812
  ].filter(Boolean).join("\r\n")
2607
2813
  };
2608
- }, Wr = ({ selectedTicket: e, discount: t }) => {
2609
- let [n, r] = A(!1), i = e?.currency, a = jr(e, t), o = Nr(e, t), s = Pr(e, t), c = t?.discount ?? 0, l = s.length > 0 || c > 0 || o !== a, u = /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ P("span", {
2610
- className: "inline-flex items-center gap-1.5",
2611
- children: ["Total", l && /* @__PURE__ */ N(ae, { className: Z("size-4 text-ink-muted transition-transform", n && "rotate-180") })]
2612
- }), /* @__PURE__ */ N("span", { children: Q({
2613
- unit_amount: a,
2614
- currency: i
2615
- }) })] }), d = "flex w-full items-center justify-between gap-3 px-3.5 py-3 font-semibold text-[15px] text-ink";
2616
- return /* @__PURE__ */ P("div", {
2617
- className: "rounded-xl border border-border bg-ink/3",
2618
- children: [l ? /* @__PURE__ */ N("button", {
2619
- type: "button",
2620
- onClick: () => r((e) => !e),
2621
- "aria-expanded": n,
2622
- className: d,
2623
- children: u
2624
- }) : /* @__PURE__ */ N("div", {
2625
- className: d,
2626
- children: u
2627
- }), l && /* @__PURE__ */ N(yr, {
2628
- open: n,
2629
- children: /* @__PURE__ */ P("div", {
2630
- className: "flex flex-col gap-1.5 px-3.5 pb-3 text-[13px] text-ink-soft",
2631
- children: [
2632
- /* @__PURE__ */ P("div", {
2633
- className: "flex items-center justify-between gap-3",
2634
- children: [/* @__PURE__ */ N("span", { children: "Subtotal" }), /* @__PURE__ */ N("span", { children: Q({
2635
- unit_amount: o,
2636
- currency: i
2637
- }) })]
2638
- }),
2639
- c > 0 && /* @__PURE__ */ P("div", {
2640
- className: "flex items-center justify-between gap-3 text-emerald-700 dark:text-emerald-400",
2641
- children: [/* @__PURE__ */ N("span", { children: "Discount" }), /* @__PURE__ */ P("span", { children: ["-", Q({
2642
- unit_amount: c,
2643
- currency: i
2644
- })] })]
2645
- }),
2646
- s.map((e, t) => /* @__PURE__ */ P("div", {
2647
- className: "flex items-center justify-between gap-3",
2648
- children: [/* @__PURE__ */ P("span", { children: [
2649
- e.label,
2650
- " (",
2651
- e.percentage,
2652
- "%)"
2653
- ] }), /* @__PURE__ */ N("span", { children: Q({
2654
- unit_amount: e.amount,
2655
- currency: i
2656
- }) })]
2657
- }, e.id || e._id || t)),
2658
- e?.tax_inclusive && /* @__PURE__ */ N("p", {
2659
- className: "m-0 text-ink-muted text-xs",
2660
- children: "Price is inclusive of taxes"
2661
- })
2662
- ]
2663
- })
2664
- })]
2665
- });
2666
- }, Gr = (e) => {
2814
+ }, ai = (e) => {
2667
2815
  let [t, n] = A(null);
2668
2816
  return E(() => {
2669
2817
  let t = e ? window.visualViewport : null;
@@ -2676,8 +2824,8 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2676
2824
  t.removeEventListener("resize", r), t.removeEventListener("scroll", r);
2677
2825
  };
2678
2826
  }, [e]), t;
2679
- }, Kr = ({ open: e, title: t, when: n, onClose: r, onClosed: i, onSubmit: a, footer: o, wide: s, initialFocusRef: c, layers: l, children: u }) => {
2680
- let d = k(null), f = Gr(e), [p, m] = A(!1), h = /* @__PURE__ */ N("div", {
2827
+ }, oi = ({ open: e, title: t, when: n, onClose: r, onClosed: i, onSubmit: a, footer: o, wide: s, initialFocusRef: c, layers: l, children: u }) => {
2828
+ let d = k(null), f = ai(e), [p, m] = A(!1), h = /* @__PURE__ */ N("div", {
2681
2829
  onScroll: (e) => m(e.currentTarget.scrollTop > 2),
2682
2830
  className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain",
2683
2831
  children: /* @__PURE__ */ P("div", {
@@ -2709,10 +2857,10 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2709
2857
  "--viewport-height": f ? `${f.height}px` : "100dvh",
2710
2858
  "--viewport-top": f ? `${f.offsetTop}px` : "0px"
2711
2859
  },
2712
- 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"),
2860
+ className: X("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"),
2713
2861
  children: [
2714
2862
  /* @__PURE__ */ P("div", {
2715
- 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"),
2863
+ className: X("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"),
2716
2864
  children: [/* @__PURE__ */ P("div", {
2717
2865
  className: "flex items-center justify-between gap-3",
2718
2866
  children: [/* @__PURE__ */ N(F.Title, {
@@ -2721,7 +2869,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2721
2869
  }), /* @__PURE__ */ N(F.Close, {
2722
2870
  "aria-label": "Close",
2723
2871
  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",
2724
- children: /* @__PURE__ */ N(ce, { className: "size-4" })
2872
+ children: /* @__PURE__ */ N(ue, { className: "size-4" })
2725
2873
  })]
2726
2874
  }), n && /* @__PURE__ */ P("p", {
2727
2875
  className: "m-0 mt-3.5 text-[13.5px] text-ink-soft",
@@ -2742,8 +2890,36 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2742
2890
  ]
2743
2891
  })] })
2744
2892
  });
2745
- }, qr = "block w-full rounded-lg px-2.5 py-2 text-left text-ink text-sm no-underline hover:bg-ink/5", Jr = "transition-[opacity,translate] duration-300 ease-out starting:translate-y-2 starting:opacity-0 motion-reduce:transition-none", Yr = "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]", Xr = ({ email: e, eventTitle: t, startsAt: n, endsAt: r, eventUrl: i, when: a, bookingRef: o, qrImageUrl: s, invoiceUrl: c, onClose: l, onRegisterAnother: u }) => {
2746
- let d = Ur({
2893
+ }, si = "inline-flex items-center justify-center rounded-lg bg-brand px-4 py-3 font-semibold text-brand-foreground transition hover:opacity-90", ci = ({ buttonText: e, registeredEmail: t, isSheetOpen: n, isLoading: r, onOpen: i, onRegisterAnother: a }) => /* @__PURE__ */ N("div", {
2894
+ className: "my-2",
2895
+ children: t && !n ? /* @__PURE__ */ P("span", {
2896
+ 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",
2897
+ children: [
2898
+ /* @__PURE__ */ N(H, { className: "size-4 text-emerald-600 dark:text-emerald-400" }),
2899
+ "You're registered as ",
2900
+ t,
2901
+ /* @__PURE__ */ N("button", {
2902
+ type: "button",
2903
+ onClick: a,
2904
+ className: "text-ink-soft underline underline-offset-[3px] hover:text-ink",
2905
+ children: "Register someone else"
2906
+ })
2907
+ ]
2908
+ }) : /* @__PURE__ */ N("button", {
2909
+ type: "button",
2910
+ onClick: i,
2911
+ disabled: r,
2912
+ className: X(si, "disabled:opacity-60"),
2913
+ children: e
2914
+ })
2915
+ }), li = ({ hasFailed: e }) => /* @__PURE__ */ N("div", {
2916
+ className: "my-2",
2917
+ children: /* @__PURE__ */ N("p", {
2918
+ className: "m-0 text-ink-soft text-sm",
2919
+ children: e ? "We couldn't load tickets for this event. Please refresh the page." : "Registration isn't open for this event yet."
2920
+ })
2921
+ }), ui = "block w-full rounded-lg px-2.5 py-2 text-left text-ink text-sm no-underline hover:bg-ink/5", di = "transition-[opacity,translate] duration-300 ease-out starting:translate-y-2 starting:opacity-0 motion-reduce:transition-none", fi = "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]", pi = ({ email: e, eventTitle: t, startsAt: n, endsAt: r, eventUrl: i, when: a, bookingRef: o, qrImageUrl: s, invoiceUrl: c, attendeeCount: l = 1, onClose: u, onRegisterAnother: d }) => {
2922
+ let f = ii({
2747
2923
  title: t,
2748
2924
  startsAt: n,
2749
2925
  endsAt: r,
@@ -2773,11 +2949,11 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2773
2949
  })
2774
2950
  }),
2775
2951
  /* @__PURE__ */ N("h3", {
2776
- className: Z(Jr, "m-0 mt-[18px] font-heading font-semibold text-[22px] text-ink tracking-[-0.016em] delay-[260ms]"),
2952
+ className: X(di, "m-0 mt-[18px] font-heading font-semibold text-[22px] text-ink tracking-[-0.016em] delay-[260ms]"),
2777
2953
  children: "You're in"
2778
2954
  }),
2779
2955
  a && /* @__PURE__ */ P("p", {
2780
- className: Z(Jr, "m-0 mt-1.5 text-[14.5px] text-ink delay-[320ms]"),
2956
+ className: X(di, "m-0 mt-1.5 text-[14.5px] text-ink delay-[320ms]"),
2781
2957
  children: [
2782
2958
  a.day,
2783
2959
  " · ",
@@ -2785,14 +2961,14 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2785
2961
  ]
2786
2962
  }),
2787
2963
  /* @__PURE__ */ P("p", {
2788
- className: Z(Jr, "m-0 mt-1 max-w-[300px] text-[13.5px] text-ink-soft leading-relaxed delay-[360ms]"),
2789
- children: ["Joining link sent to ", /* @__PURE__ */ N("span", {
2964
+ className: X(di, "m-0 mt-1 max-w-[300px] text-[13.5px] text-ink-soft leading-relaxed delay-[360ms]"),
2965
+ children: [l > 1 ? `${l} spots booked · confirmation sent to ` : "Joining link sent to ", /* @__PURE__ */ N("span", {
2790
2966
  className: "text-ink [overflow-wrap:anywhere]",
2791
2967
  children: e
2792
2968
  })]
2793
2969
  }),
2794
2970
  /* @__PURE__ */ P("div", {
2795
- className: Z(Jr, "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]"),
2971
+ className: X(di, "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]"),
2796
2972
  children: [
2797
2973
  /* @__PURE__ */ N("span", {
2798
2974
  "aria-hidden": !0,
@@ -2826,39 +3002,39 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2826
3002
  ]
2827
3003
  }),
2828
3004
  /* @__PURE__ */ P("div", {
2829
- className: Z(Jr, "mt-4 flex w-full max-w-[340px] flex-col gap-2 delay-[520ms]"),
3005
+ className: X(di, "mt-4 flex w-full max-w-[340px] flex-col gap-2 delay-[520ms]"),
2830
3006
  children: [
2831
- d && /* @__PURE__ */ P(V.Root, { children: [/* @__PURE__ */ P(V.Trigger, {
2832
- className: Yr,
2833
- children: [/* @__PURE__ */ N(re, { className: "size-4" }), "Add to calendar"]
2834
- }), /* @__PURE__ */ N(V.Portal, { children: /* @__PURE__ */ N(V.Positioner, {
3007
+ f && /* @__PURE__ */ P(W.Root, { children: [/* @__PURE__ */ P(W.Trigger, {
3008
+ className: fi,
3009
+ children: [/* @__PURE__ */ N(ie, { className: "size-4" }), "Add to calendar"]
3010
+ }), /* @__PURE__ */ N(W.Portal, { children: /* @__PURE__ */ N(W.Positioner, {
2835
3011
  sideOffset: 6,
2836
3012
  className: "z-[2147483001]",
2837
- children: /* @__PURE__ */ P(V.Popup, {
3013
+ children: /* @__PURE__ */ P(W.Popup, {
2838
3014
  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",
2839
3015
  children: [
2840
3016
  /* @__PURE__ */ N("a", {
2841
- href: d.google,
3017
+ href: f.google,
2842
3018
  target: "_blank",
2843
3019
  rel: "noopener noreferrer",
2844
- className: qr,
3020
+ className: ui,
2845
3021
  children: "Google Calendar"
2846
3022
  }),
2847
3023
  /* @__PURE__ */ N("a", {
2848
- href: d.outlook,
3024
+ href: f.outlook,
2849
3025
  target: "_blank",
2850
3026
  rel: "noopener noreferrer",
2851
- className: qr,
3027
+ className: ui,
2852
3028
  children: "Outlook"
2853
3029
  }),
2854
3030
  /* @__PURE__ */ N("button", {
2855
3031
  type: "button",
2856
3032
  onClick: () => {
2857
- if (!d) return;
2858
- let e = new Blob([d.ics], { type: "text/calendar;charset=utf-8" }), n = URL.createObjectURL(e), r = document.createElement("a");
3033
+ if (!f) return;
3034
+ let e = new Blob([f.ics], { type: "text/calendar;charset=utf-8" }), n = URL.createObjectURL(e), r = document.createElement("a");
2859
3035
  r.href = n, r.download = `${t.replace(/[^\w\s-]/g, "").trim() || "event"}.ics`, r.click(), URL.revokeObjectURL(n);
2860
3036
  },
2861
- className: qr,
3037
+ className: ui,
2862
3038
  children: "Apple Calendar / .ics"
2863
3039
  })
2864
3040
  ]
@@ -2868,12 +3044,12 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2868
3044
  href: c,
2869
3045
  target: "_blank",
2870
3046
  rel: "noopener noreferrer",
2871
- className: Yr,
3047
+ className: fi,
2872
3048
  children: [/* @__PURE__ */ N(oe, { className: "size-4" }), "Download invoice"]
2873
3049
  }),
2874
3050
  /* @__PURE__ */ N("button", {
2875
3051
  type: "button",
2876
- onClick: l,
3052
+ onClick: u,
2877
3053
  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]",
2878
3054
  children: "Done"
2879
3055
  })
@@ -2881,124 +3057,111 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
2881
3057
  }),
2882
3058
  /* @__PURE__ */ N("button", {
2883
3059
  type: "button",
2884
- onClick: u,
3060
+ onClick: d,
2885
3061
  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",
2886
3062
  children: "Register someone else"
2887
3063
  })
2888
3064
  ]
2889
3065
  });
2890
- }, Zr = {
3066
+ }, mi = {
2891
3067
  email: "required",
2892
3068
  mobile: "off",
2893
3069
  organization: "off",
2894
3070
  designation: "off"
2895
- }, Qr = (e) => e.replace(/[\s()-]/g, ""), $r = (e) => /^\+?\d{7,15}$/.test(Qr(e)), ei = (e, t) => {
3071
+ }, hi = (e) => e.replace(/[\s()-]/g, ""), gi = (e) => /^\+?\d{7,15}$/.test(hi(e)), _i = (e, t) => {
2896
3072
  let n = {}, r = [
2897
- ["mobile", Qr(e.mobile)],
3073
+ ["mobile", hi(e.mobile)],
2898
3074
  ["organization", e.organization.trim()],
2899
3075
  ["designation", e.designation.trim()]
2900
3076
  ];
2901
3077
  for (let [e, i] of r) t[e] !== "off" && i && (n[e] = i);
2902
3078
  return n;
2903
- }, ti = (e, t) => {
3079
+ }, vi = (e, t) => {
2904
3080
  let n = {};
2905
- 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() ? $r(e.mobile) || (n.mobile = "That doesn't look like a valid phone number") : t.mobile === "required" && (n.mobile = "Please enter your phone number"));
3081
+ 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() ? gi(e.mobile) || (n.mobile = "That doesn't look like a valid phone number") : t.mobile === "required" && (n.mobile = "Please enter your phone number"));
2906
3082
  for (let r of ["organization", "designation"]) t[r] === "required" && !e[r].trim() && (n[r] = `Please enter your ${r}`);
2907
3083
  return n;
2908
- }, ni = (e) => `levo:event-registration:${e}`, ri = (e) => {
2909
- if (typeof window > "u") return null;
2910
- try {
2911
- let t = window.localStorage.getItem(ni(e));
2912
- return t ? JSON.parse(t) : null;
2913
- } catch {
2914
- return null;
2915
- }
2916
- }, ii = (e, t) => {
2917
- if (!(typeof window > "u")) try {
2918
- window.localStorage.setItem(ni(e), JSON.stringify(t));
2919
- } catch {}
2920
- }, ai = (e) => {
2921
- if (!(typeof window > "u")) try {
2922
- window.localStorage.removeItem(ni(e));
2923
- } catch {}
2924
- }, oi = ({ tickets: e, selectedTicket: t, onSelect: n, error: r }) => {
2925
- let [i, a] = A(!t);
2926
- return /* @__PURE__ */ P("fieldset", {
2927
- className: "m-0 flex min-w-0 flex-col gap-2 border-0 p-0",
2928
- children: [
2929
- /* @__PURE__ */ N("legend", {
2930
- className: "mb-2 p-0 font-medium text-ink text-sm",
2931
- children: "Choose your ticket"
2932
- }),
2933
- /* @__PURE__ */ N("div", {
2934
- className: "-mb-2 flex flex-col",
2935
- children: e.map((r) => {
2936
- let o = r._id === t?._id, s = i || o, c = Or(r);
2937
- return /* @__PURE__ */ N(yr, {
2938
- open: s,
2939
- children: /* @__PURE__ */ P("label", {
2940
- 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"),
2941
- children: [
2942
- /* @__PURE__ */ N("input", {
2943
- type: "radio",
2944
- name: "ticket",
2945
- value: r._id,
2946
- checked: o,
2947
- onChange: () => {
2948
- n(r), a(!1);
2949
- },
2950
- onClick: () => {
2951
- i || a(!0);
2952
- },
2953
- className: "sr-only"
2954
- }),
2955
- /* @__PURE__ */ N("span", {
2956
- "aria-hidden": !0,
2957
- className: Z("mt-0.5 size-[17px] shrink-0 rounded-full border transition-all", o ? "border-[5px] border-brand" : "border-border")
2958
- }),
2959
- /* @__PURE__ */ P("span", {
2960
- className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
2961
- children: [/* @__PURE__ */ N("span", {
2962
- className: "block font-medium text-[14.5px] text-ink leading-snug",
2963
- children: r.title
2964
- }), r.description && /* @__PURE__ */ N("span", {
2965
- title: r.description,
2966
- className: Z("mt-0.5 block text-[12.5px] text-ink-soft leading-snug", !i && "line-clamp-2"),
2967
- children: r.description
2968
- })]
2969
- }),
2970
- /* @__PURE__ */ P("span", {
2971
- className: "flex shrink-0 flex-col items-end gap-1.5",
2972
- children: [/* @__PURE__ */ P("span", {
2973
- className: "text-right font-medium text-[14.5px] text-ink",
2974
- children: [Q(r), c && /* @__PURE__ */ N("span", {
2975
- className: "block font-normal text-[11.5px] text-ink-muted",
2976
- children: c
2977
- })]
2978
- }), o && !i && e.length > 1 && /* @__PURE__ */ P("span", {
2979
- 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",
2980
- children: [
2981
- e.length - 1,
2982
- " more",
2983
- /* @__PURE__ */ N(ae, {
2984
- "aria-hidden": !0,
2985
- className: "size-3.5"
2986
- })
2987
- ]
2988
- })]
2989
- })
2990
- ]
3084
+ }, yi = (e) => e.quantity === null || e.quantity === void 0 ? 10 : Math.max(0, Math.min(10, e.quantity - (e.sale_count ?? 0))), bi = "inline-flex size-8 items-center justify-center rounded-full border border-border text-ink transition hover:border-brand hover:text-brand active:scale-95 disabled:pointer-events-none disabled:opacity-35", xi = ({ tickets: e, counts: t, onChange: n, error: r }) => /* @__PURE__ */ P("fieldset", {
3085
+ className: "m-0 flex min-w-0 flex-col gap-2 border-0 p-0",
3086
+ children: [
3087
+ /* @__PURE__ */ N("legend", {
3088
+ className: "mb-2 p-0 font-medium text-ink text-sm",
3089
+ children: "Choose your tickets"
3090
+ }),
3091
+ e.map((e) => {
3092
+ let r = t[e._id] ?? 0, i = yi(e), a = i === 0, o = zr(e);
3093
+ return /* @__PURE__ */ P("div", {
3094
+ className: X("flex w-full items-start gap-3 rounded-xl border px-3.5 py-3 transition", r > 0 ? "border-brand bg-brand/5" : "border-border", a && "opacity-60"),
3095
+ children: [/* @__PURE__ */ P("div", {
3096
+ className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
3097
+ children: [
3098
+ /* @__PURE__ */ N("span", {
3099
+ className: "block font-medium text-[14.5px] text-ink leading-snug",
3100
+ children: e.title
3101
+ }),
3102
+ /* @__PURE__ */ P("span", {
3103
+ className: "mt-0.5 block font-medium text-[13.5px] text-ink",
3104
+ children: [Z(e), o && /* @__PURE__ */ N("span", {
3105
+ className: "ml-1 font-normal text-[11.5px] text-ink-muted",
3106
+ children: o
3107
+ })]
3108
+ }),
3109
+ e.description && /* @__PURE__ */ N("span", {
3110
+ title: e.description,
3111
+ className: "mt-1 line-clamp-2 block text-[12.5px] text-ink-soft leading-snug",
3112
+ children: e.description
2991
3113
  })
2992
- }, r._id);
2993
- })
2994
- }),
2995
- r && /* @__PURE__ */ N("p", {
2996
- className: "m-0 text-danger text-xs",
2997
- children: r
2998
- })
2999
- ]
3000
- });
3001
- }, si = {
3114
+ ]
3115
+ }), a ? /* @__PURE__ */ N("span", {
3116
+ className: "shrink-0 rounded-full bg-ink/5 px-2.5 py-1 font-medium text-[12px] text-ink-soft",
3117
+ children: "Sold out"
3118
+ }) : /* @__PURE__ */ P("div", {
3119
+ className: "flex shrink-0 flex-col items-end gap-1",
3120
+ children: [/* @__PURE__ */ P("div", {
3121
+ className: "flex items-center gap-2",
3122
+ children: [
3123
+ /* @__PURE__ */ N("button", {
3124
+ type: "button",
3125
+ "aria-label": `Remove one ${e.title} ticket`,
3126
+ disabled: r === 0,
3127
+ onClick: () => n(e._id, r - 1),
3128
+ className: bi,
3129
+ children: /* @__PURE__ */ N(ce, { className: "size-3.5" })
3130
+ }),
3131
+ /* @__PURE__ */ P("span", {
3132
+ "aria-live": "polite",
3133
+ className: "w-5 text-center font-semibold text-[15px] text-ink tabular-nums",
3134
+ children: [r, /* @__PURE__ */ P("span", {
3135
+ className: "sr-only",
3136
+ children: [" ", e.title]
3137
+ })]
3138
+ }),
3139
+ /* @__PURE__ */ N("button", {
3140
+ type: "button",
3141
+ "aria-label": `Add one ${e.title} ticket`,
3142
+ disabled: r >= i,
3143
+ onClick: () => n(e._id, r + 1),
3144
+ className: bi,
3145
+ children: /* @__PURE__ */ N(le, { className: "size-3.5" })
3146
+ })
3147
+ ]
3148
+ }), r > 0 && r >= i && /* @__PURE__ */ P("span", {
3149
+ className: "text-[11.5px] text-ink-muted",
3150
+ children: [
3151
+ "Max ",
3152
+ i,
3153
+ " per order"
3154
+ ]
3155
+ })]
3156
+ })]
3157
+ }, e._id);
3158
+ }),
3159
+ r && /* @__PURE__ */ N("p", {
3160
+ className: "m-0 text-danger text-xs",
3161
+ children: r
3162
+ })
3163
+ ]
3164
+ }), Q = {
3002
3165
  name: "",
3003
3166
  email: "",
3004
3167
  mobile: "",
@@ -3017,14 +3180,14 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3017
3180
  country: ""
3018
3181
  }
3019
3182
  }
3020
- }, ci = {
3183
+ }, Si = {
3021
3184
  name: !0,
3022
3185
  email: !0,
3023
3186
  mobile: !0,
3024
3187
  organization: !0,
3025
3188
  designation: !0
3026
- }, li = (e, t) => {
3027
- let [n, r] = A(si), [i, a] = A({}), [o, s] = A(!1), c = k(!1);
3189
+ }, Ci = (e, t) => {
3190
+ let [n, r] = A(Q), [i, a] = A({}), [o, s] = A(!1), c = k(!1);
3028
3191
  E(() => {
3029
3192
  c.current || !e || (c.current = !0, r((t) => ({
3030
3193
  ...t,
@@ -3032,14 +3195,14 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3032
3195
  email: t.email || e.email || ""
3033
3196
  })));
3034
3197
  }, [e]);
3035
- let l = ti(n, t), u = w((e, t) => r((n) => ({
3198
+ let l = vi(n, t), u = w((e, t) => r((n) => ({
3036
3199
  ...n,
3037
3200
  [e]: t
3038
3201
  })), []), d = w((e) => a((t) => ({
3039
3202
  ...t,
3040
3203
  [e]: !0
3041
3204
  })), []), f = w(() => {
3042
- r(si), a({}), s(!1), c.current = !0;
3205
+ r(Q), a({}), s(!1), c.current = !0;
3043
3206
  }, []), p = w(() => {
3044
3207
  a({}), s(!1);
3045
3208
  }, []);
@@ -3053,13 +3216,83 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3053
3216
  touchField: d,
3054
3217
  reset: f,
3055
3218
  resetValidationDisplay: p,
3056
- touched: o ? ci : i
3219
+ touched: o ? Si : i
3220
+ };
3221
+ }, wi = (e, t, n) => {
3222
+ let [r, i] = A({}), [a, o] = A({}), [s, c] = A({
3223
+ is_business_purchase: Q.is_business_purchase,
3224
+ billing_details: Q.billing_details
3225
+ }), [l, u] = A(!1), d = k(!1), f = O(() => t.flatMap((e) => Array.from({ length: n[e._id] ?? 0 }, (t, n) => ({
3226
+ key: `${e._id}:${n}`,
3227
+ ticket: e,
3228
+ rules: e.registration_fields ?? mi
3229
+ }))), [t, n]), p = f[0]?.key;
3230
+ E(() => {
3231
+ d.current || !e || !p || (d.current = !0, i((t) => {
3232
+ let n = t[p] ?? Q;
3233
+ return {
3234
+ ...t,
3235
+ [p]: {
3236
+ ...n,
3237
+ name: n.name || [e.first_name, e.last_name].filter(Boolean).join(" ").trim(),
3238
+ email: n.email || e.email || ""
3239
+ }
3240
+ };
3241
+ }));
3242
+ }, [e, p]);
3243
+ let m = (e) => r[e] ?? Q, h = O(() => {
3244
+ let e = {};
3245
+ for (let t of f) e[t.key] = vi(r[t.key] ?? Q, t.rules);
3246
+ return e;
3247
+ }, [f, r]), g = (e) => Object.keys(h[e] ?? {}).length === 0, _ = w((e, t, n) => i((r) => ({
3248
+ ...r,
3249
+ [e]: {
3250
+ ...r[e] ?? Q,
3251
+ [t]: n
3252
+ }
3253
+ })), []), v = w((e, t) => o((n) => ({
3254
+ ...n,
3255
+ [e]: {
3256
+ ...n[e],
3257
+ [t]: !0
3258
+ }
3259
+ })), []), y = w((e) => o((t) => ({
3260
+ ...t,
3261
+ [e]: Si
3262
+ })), []), b = w((e, t) => c((n) => ({
3263
+ ...n,
3264
+ [e]: t
3265
+ })), []), x = w(() => {
3266
+ i({}), o({}), c({
3267
+ is_business_purchase: Q.is_business_purchase,
3268
+ billing_details: Q.billing_details
3269
+ }), u(!1), d.current = !0;
3270
+ }, []), S = w(() => {
3271
+ o({}), u(!1);
3272
+ }, []);
3273
+ return {
3274
+ slots: f,
3275
+ getValues: m,
3276
+ errors: h,
3277
+ isSlotValid: g,
3278
+ isValid: f.every((e) => g(e.key)),
3279
+ getTouched: (e) => l ? Si : a[e] ?? {},
3280
+ isSlotVisited: (e) => l || !!a[e],
3281
+ submitAttempted: l,
3282
+ markSubmitted: () => u(!0),
3283
+ setField: _,
3284
+ touchField: v,
3285
+ touchSlot: y,
3286
+ billing: s,
3287
+ setBillingField: b,
3288
+ reset: x,
3289
+ resetValidationDisplay: S
3057
3290
  };
3058
- }, ui = ({ eventID: e, selectedTicket: t, enabled: n }) => {
3059
- let r = i(), [a, o] = A(""), [s, c] = A(null), [l, u] = A(!1), [d, f] = A(null), [p, m] = A([]);
3291
+ }, Ti = ({ eventID: e, ticketIds: t, enabled: n }) => {
3292
+ let r = i(), a = t.join(","), [o, s] = A(""), [c, l] = A(null), [u, d] = A(!1), [f, p] = A(null), [m, h] = A([]), g = k(0);
3060
3293
  return E(() => {
3061
3294
  !n || !e || !r || r.fetch?.url(`/v1/event/event/${e}/coupon/list-public-coupons`)?.get().json().then((e) => {
3062
- e?.status && e?.content?.data && m(e.content.data);
3295
+ e?.status && e?.content?.data && h(e.content.data);
3063
3296
  }).catch((e) => {
3064
3297
  r.logger?.error("Failed to fetch public coupons", { exception: b(e) });
3065
3298
  });
@@ -3068,51 +3301,51 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3068
3301
  e,
3069
3302
  r
3070
3303
  ]), {
3071
- code: a,
3072
- setCode: o,
3073
- discount: s,
3074
- isLoading: l,
3075
- error: d,
3076
- publicCoupons: p,
3077
- apply: w(async (n) => {
3078
- let i = (n ?? a).trim();
3079
- if (!(!i || !r)) {
3080
- u(!0), f(null);
3081
- try {
3082
- let n = await r.fetch?.url(`/v1/event/event/${e}/coupon/validate-coupon-code`)?.post({
3083
- coupon: i,
3084
- event: e,
3085
- attendees: [{
3086
- name: "",
3087
- email: "",
3088
- ticket: t?._id
3089
- }]
3090
- }).json();
3091
- n?.status && (c(n.content.data), o(i));
3092
- } catch (e) {
3093
- let t = b(e);
3094
- f(t.message), r.logger?.error("Coupon validation failed", { exception: t });
3095
- } finally {
3096
- u(!1);
3097
- }
3304
+ code: o,
3305
+ setCode: s,
3306
+ discount: c,
3307
+ isLoading: u,
3308
+ error: f,
3309
+ publicCoupons: m,
3310
+ apply: w(async (t) => {
3311
+ let n = (t ?? o).trim();
3312
+ if (!n || !r) return;
3313
+ let i = ++g.current, c = () => i === g.current;
3314
+ d(!0), p(null);
3315
+ try {
3316
+ let t = await r.fetch?.url(`/v1/event/event/${e}/coupon/validate-coupon-code`)?.post({
3317
+ coupon: n,
3318
+ event: e,
3319
+ attendees: a.split(",").filter(Boolean).map((e) => ({
3320
+ name: "",
3321
+ email: "",
3322
+ ticket: e
3323
+ }))
3324
+ }).json();
3325
+ c() && t?.status && (l(t.content.data), s(n));
3326
+ } catch (e) {
3327
+ let t = b(e);
3328
+ c() && p(t.message), r.logger?.error("Coupon validation failed", { exception: t });
3329
+ } finally {
3330
+ c() && d(!1);
3098
3331
  }
3099
3332
  }, [
3100
3333
  r,
3101
- a,
3334
+ o,
3102
3335
  e,
3103
- t?._id
3336
+ a
3104
3337
  ]),
3105
3338
  reset: w(() => {
3106
- o(""), c(null), f(null);
3339
+ g.current += 1, d(!1), s(""), l(null), p(null);
3107
3340
  }, [])
3108
3341
  };
3109
- }, di = async (e, t) => {
3342
+ }, Ei = async (e, t) => {
3110
3343
  let n = new URLSearchParams();
3111
3344
  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 ?? [];
3112
- }, fi = ({ eventID: e, external: t }) => {
3345
+ }, Di = ({ eventID: e, external: t }) => {
3113
3346
  let n = i(), [r, a] = A([]), [o, s] = A(!t), [c, l] = A(!1), [u, d] = A(null);
3114
3347
  return E(() => {
3115
- t || !e || !n || (s(!0), l(!1), di(n, e).then((e) => {
3348
+ t || !e || !n || (s(!0), l(!1), Ei(n, e).then((e) => {
3116
3349
  a(e), e.length === 1 && d(e[0] ?? null);
3117
3350
  }).catch((e) => {
3118
3351
  l(!0), n.logger?.error("Failed to load event tickets", { exception: b(e) });
@@ -3128,7 +3361,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3128
3361
  selectedTicket: u,
3129
3362
  selectTicket: d
3130
3363
  };
3131
- }, pi = async (e) => {
3364
+ }, Oi = async (e) => {
3132
3365
  let { payment_session_id: t, order_id: n } = e;
3133
3366
  if (!t || !n) throw Error("Cashfree payment session missing");
3134
3367
  let { load: r } = await import("./script.esm-D4nvz3-k.js"), i = await r({ mode: e.environment || "production" });
@@ -3144,8 +3377,8 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3144
3377
  status: "closed",
3145
3378
  message: a.error?.message
3146
3379
  };
3147
- }, mi = () => typeof window < "u" && "Razorpay" in window, hi = ({ order: e, onSettled: t, onError: n }) => {
3148
- let { Razorpay: r, isLoading: i, error: a } = le(), o = k({
3380
+ }, ki = () => typeof window < "u" && "Razorpay" in window, Ai = ({ order: e, onSettled: t, onError: n }) => {
3381
+ let { Razorpay: r, isLoading: i, error: a } = de(), o = k({
3149
3382
  onSettled: t,
3150
3383
  onError: n
3151
3384
  });
@@ -3160,7 +3393,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3160
3393
  s.current = !0, o.current.onError(Error(a));
3161
3394
  return;
3162
3395
  }
3163
- if (!r || !mi()) return;
3396
+ if (!r || !ki()) return;
3164
3397
  s.current = !0;
3165
3398
  let t;
3166
3399
  try {
@@ -3198,7 +3431,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3198
3431
  a,
3199
3432
  e
3200
3433
  ]), null;
3201
- }, gi = ({ stripePromise: e, clientSecret: t, onClose: n, onComplete: r }) => {
3434
+ }, ji = ({ stripePromise: e, clientSecret: t, onClose: n, onComplete: r }) => {
3202
3435
  let i = k(r);
3203
3436
  i.current = r;
3204
3437
  let a = O(() => ({
@@ -3215,20 +3448,20 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3215
3448
  children: [/* @__PURE__ */ N(F.Close, {
3216
3449
  "aria-label": "Close payment",
3217
3450
  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",
3218
- children: /* @__PURE__ */ N(ce, { className: "size-5" })
3451
+ children: /* @__PURE__ */ N(ue, { className: "size-5" })
3219
3452
  }), /* @__PURE__ */ N("div", {
3220
3453
  className: "flex-1 overflow-y-auto rounded-2xl py-6",
3221
- children: /* @__PURE__ */ N(de, {
3454
+ children: /* @__PURE__ */ N(pe, {
3222
3455
  stripe: e,
3223
3456
  options: a,
3224
- children: /* @__PURE__ */ N(ue, { className: "stripe-embedded-checkout h-full" })
3457
+ children: /* @__PURE__ */ N(fe, { className: "stripe-embedded-checkout h-full" })
3225
3458
  })
3226
3459
  })]
3227
3460
  })] })
3228
3461
  });
3229
- }, _i = () => {
3462
+ }, Mi = () => {
3230
3463
  let [e, t] = A(null), n = w(async (e, n) => {
3231
- if (e.provider === "cashfree") return pi(e);
3464
+ if (e.provider === "cashfree") return Oi(e);
3232
3465
  if (e.provider === "stripe") {
3233
3466
  let { client_secret: n, session_id: r } = e;
3234
3467
  if (!n || !r) throw Error("Stripe checkout session missing");
@@ -3262,7 +3495,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3262
3495
  }, []), r = (e, n) => {
3263
3496
  t(null), n instanceof Error ? e.settle.reject(n) : e.settle.resolve(n);
3264
3497
  }, i = null;
3265
- return e?.provider === "stripe" ? i = /* @__PURE__ */ N(gi, {
3498
+ return e?.provider === "stripe" ? i = /* @__PURE__ */ N(ji, {
3266
3499
  stripePromise: e.stripePromise,
3267
3500
  clientSecret: e.clientSecret,
3268
3501
  onComplete: () => r(e, {
@@ -3270,7 +3503,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3270
3503
  confirmation: { session_id: e.sessionId }
3271
3504
  }),
3272
3505
  onClose: () => r(e, { status: "closed" })
3273
- }) : e?.provider === "razorpay" && (i = /* @__PURE__ */ N(hi, {
3506
+ }) : e?.provider === "razorpay" && (i = /* @__PURE__ */ N(Ai, {
3274
3507
  order: e.order,
3275
3508
  onSettled: (t) => r(e, t),
3276
3509
  onError: (t) => r(e, t)
@@ -3284,8 +3517,8 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3284
3517
  providerUnreachable: "We couldn't reach the payment provider. Check your connection and try again.",
3285
3518
  confirmationFailed: "We couldn't confirm your payment. Your details are saved — try again.",
3286
3519
  generic: "Something went wrong. Please try again."
3287
- }, vi = (e) => !!e && e.status !== "requires_payment", yi = ({ eventID: e, details: t, onConfirmed: n }) => {
3288
- let r = i(), a = _i(), [o, s] = A({ kind: "idle" }), c = k({
3520
+ }, Ni = (e) => !!e && e.status !== "requires_payment", Pi = ({ eventID: e, details: t, onConfirmed: n }) => {
3521
+ let r = i(), a = Mi(), [o, s] = A({ kind: "idle" }), c = k({
3289
3522
  details: t,
3290
3523
  onConfirmed: n
3291
3524
  });
@@ -3301,7 +3534,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3301
3534
  message: t
3302
3535
  }), d = async (e, t) => {
3303
3536
  if (!t?.key) {
3304
- vi(e) ? l(e) : s({
3537
+ Ni(e) ? l(e) : s({
3305
3538
  kind: "failed",
3306
3539
  message: $.registrationFailed
3307
3540
  });
@@ -3335,7 +3568,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3335
3568
  }
3336
3569
  try {
3337
3570
  let t = (await r?.fetch?.url(`/v1/event/booking/${e._id}/confirm-booking`)?.post(n.confirmation)?.json())?.content?.data;
3338
- vi(t) ? l(t) : u(e._id, $.paymentAbandoned);
3571
+ Ni(t) ? l(t) : u(e._id, $.paymentAbandoned);
3339
3572
  } catch (t) {
3340
3573
  r?.logger?.error("Failed to confirm booking after payment", { exception: b(t) }), u(e._id, $.confirmationFailed);
3341
3574
  }
@@ -3374,33 +3607,387 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3374
3607
  },
3375
3608
  reset: () => s({ kind: "idle" })
3376
3609
  };
3377
- }, bi = "register", xi = () => {
3610
+ }, Fi = (e) => `levo:event-registration:${e}`, Ii = (e) => {
3611
+ if (typeof window > "u") return null;
3612
+ try {
3613
+ let t = window.localStorage.getItem(Fi(e));
3614
+ return t ? JSON.parse(t) : null;
3615
+ } catch {
3616
+ return null;
3617
+ }
3618
+ }, Li = (e, t) => {
3619
+ if (!(typeof window > "u")) try {
3620
+ window.localStorage.setItem(Fi(e), JSON.stringify(t));
3621
+ } catch {}
3622
+ }, Ri = (e) => {
3623
+ if (!(typeof window > "u")) try {
3624
+ window.localStorage.removeItem(Fi(e));
3625
+ } catch {}
3626
+ }, zi = (e) => {
3627
+ let [t, n] = A(null), [r, i] = A(null);
3628
+ return E(() => {
3629
+ let t = Ii(e);
3630
+ t && i(t.email);
3631
+ }, [e]), {
3632
+ booking: t,
3633
+ registeredEmail: r,
3634
+ complete: (t, r) => {
3635
+ n(t), i(r), Li(e, {
3636
+ bookingId: t._id,
3637
+ email: r,
3638
+ at: (/* @__PURE__ */ new Date()).toISOString()
3639
+ });
3640
+ },
3641
+ clear: () => {
3642
+ Ri(e), i(null), n(null);
3643
+ }
3644
+ };
3645
+ }, Bi = "register", Vi = () => {
3378
3646
  if (typeof window > "u") return !1;
3379
- let e = new URLSearchParams(window.location.search).get(bi);
3647
+ let e = new URLSearchParams(window.location.search).get(Bi);
3380
3648
  return e !== null && e !== "0" && e !== "false";
3381
- }, Si = ({ canAutoOpen: e }) => {
3649
+ }, Hi = ({ canAutoOpen: e }) => {
3382
3650
  let [t, n] = A(!1), r = k(!1), i = w(() => n(!0), []), a = w(() => n(!1), []);
3383
3651
  return E(() => {
3384
- r.current || !e || !xi() || (r.current = !0, n(!0));
3652
+ r.current || !e || !Vi() || (r.current = !0, n(!0));
3385
3653
  }, [e]), {
3386
3654
  isOpen: t,
3387
3655
  open: i,
3388
3656
  close: a
3389
3657
  };
3390
- }, Ci = "inline-flex items-center justify-center rounded-lg bg-brand px-4 py-3 font-semibold text-brand-foreground transition hover:opacity-90", wi = ({ eventID: e, title: t, external: n, buttonText: r = "Register Now", startsAt: i, endsAt: a, eventUrl: o }) => {
3391
- let { account: s } = Ze(), c = $n(), l = fi({
3658
+ }, Ui = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Wi = ({ eventID: e, title: t, buttonText: n = "Register Now", startsAt: r, endsAt: i, eventUrl: a }) => {
3659
+ let { account: o } = tt(), s = sr(), c = Di({ eventID: e }), [l, u] = A({}), [d, f] = A("tickets"), [p, m] = A(!1), [h, g] = A(null), _ = c.tickets.length === 1 ? c.tickets[0]?._id : void 0;
3660
+ E(() => {
3661
+ _ && u((e) => ({ [_]: e[_] || 1 }));
3662
+ }, [_]);
3663
+ let v = O(() => c.tickets.map((e) => ({
3664
+ ticket: e,
3665
+ count: l[e._id] ?? 0
3666
+ })).filter((e) => e.count > 0), [c.tickets, l]), y = v.reduce((e, t) => e + t.count, 0), b = wi(o, c.tickets, l), x = b.slots[0] ? b.getValues(b.slots[0].key) : null, S = zi(e), { booking: C } = S, w = Hi({ canAutoOpen: !c.isLoading && c.tickets.length > 0 && !S.registeredEmail }), T = v.some((e) => Hr(e.ticket, null) > 0), D = Ti({
3667
+ eventID: e,
3668
+ ticketIds: b.slots.map((e) => e.ticket._id),
3669
+ enabled: w.isOpen && T
3670
+ }), k = qr(v, D.discount), j = !!k && !k.isFree, F = O(() => ei(r, i), [r, i]), I = t || "this event", L = Pi({
3671
+ eventID: e,
3672
+ details: {
3673
+ merchantName: s?.name || t || "",
3674
+ description: "Event Registration",
3675
+ prefill: {
3676
+ name: x?.name.trim() ?? "",
3677
+ email: x?.email.trim() ?? "",
3678
+ contact: hi(x?.mobile ?? "")
3679
+ }
3680
+ },
3681
+ onConfirmed: (e) => S.complete(e, x?.email.trim() ?? "")
3682
+ }), R = (e, t) => {
3683
+ D.reset(), L.reset(), m(!1), u((n) => ({
3684
+ ...n,
3685
+ [e]: t
3686
+ }));
3687
+ }, z = () => {
3688
+ S.clear(), L.reset(), D.reset(), b.reset(), u(_ ? { [_]: 1 } : {}), f("tickets"), g(null);
3689
+ }, ee = (t) => {
3690
+ if (t.preventDefault(), d === "tickets") {
3691
+ if (y === 0) {
3692
+ m(!0);
3693
+ return;
3694
+ }
3695
+ f("details"), g(b.slots.find((e) => !b.isSlotValid(e.key))?.key ?? null);
3696
+ return;
3697
+ }
3698
+ if (d === "details") {
3699
+ if (b.markSubmitted(), !b.isValid) {
3700
+ g(b.slots.find((e) => !b.isSlotValid(e.key))?.key ?? null);
3701
+ return;
3702
+ }
3703
+ if (T) {
3704
+ f("review");
3705
+ return;
3706
+ }
3707
+ }
3708
+ L.register({
3709
+ event: e,
3710
+ coupon: D.code,
3711
+ attendees: b.slots.map((e) => {
3712
+ let t = b.getValues(e.key);
3713
+ return {
3714
+ name: t.name.trim(),
3715
+ email: t.email.trim(),
3716
+ ..._i(t, e.rules),
3717
+ ticket: e.ticket._id,
3718
+ details: {}
3719
+ };
3720
+ }),
3721
+ ...b.billing.is_business_purchase && j ? {
3722
+ is_business_purchase: !0,
3723
+ billing_details: b.billing.billing_details
3724
+ } : {}
3725
+ });
3726
+ };
3727
+ if (!c.isLoading && c.tickets.length === 0) return /* @__PURE__ */ N(li, { hasFailed: c.hasFailed });
3728
+ let B = k && !k.isFree ? Z({
3729
+ unit_amount: k.amount,
3730
+ currency: k.currency
3731
+ }) : null, te = B ? `Pay ${B}` : y === 1 ? "Save my spot" : `Save ${y} spots`, V = (e, t) => /* @__PURE__ */ P("button", {
3732
+ type: "button",
3733
+ disabled: L.state.kind === "busy",
3734
+ onClick: () => {
3735
+ L.reset(), f(t);
3736
+ },
3737
+ className: "-ml-1 inline-flex items-center gap-1.5 self-start rounded-lg px-1 py-0.5 text-[13px] text-ink-soft transition hover:text-ink disabled:pointer-events-none disabled:opacity-50",
3738
+ children: [/* @__PURE__ */ N(re, { className: "size-3.5" }), e]
3739
+ }), ne = "inline-flex min-h-[50px] items-center justify-center rounded-xl bg-brand px-6 font-semibold text-[15.5px] text-brand-foreground transition active:scale-[0.985] disabled:opacity-55", ie = /* @__PURE__ */ P("div", {
3740
+ className: "flex items-center gap-3",
3741
+ children: [/* @__PURE__ */ P("div", {
3742
+ className: "min-w-0 flex-1",
3743
+ children: [/* @__PURE__ */ N("span", {
3744
+ className: "block font-semibold text-[15px] text-ink tabular-nums",
3745
+ children: y === 0 ? "No tickets yet" : Ui(y, "ticket")
3746
+ }), y > 0 && /* @__PURE__ */ N("span", {
3747
+ className: "block text-[12.5px] text-ink-soft tabular-nums",
3748
+ children: B ?? "Free"
3749
+ })]
3750
+ }), /* @__PURE__ */ N("button", {
3751
+ type: "submit",
3752
+ className: ne,
3753
+ children: "Continue"
3754
+ })]
3755
+ }), H = b.isValid ? void 0 : "Fill in every attendee's details to continue", ae = d === "tickets" ? ie : d === "details" && T ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("button", {
3756
+ type: "submit",
3757
+ disabled: !b.isValid,
3758
+ className: X(ne, "w-full"),
3759
+ children: "Review order"
3760
+ }), H && /* @__PURE__ */ N("p", {
3761
+ className: "m-0 mt-2 text-center text-ink-muted text-xs",
3762
+ children: H
3763
+ })] }) : /* @__PURE__ */ N(Yr, {
3764
+ payment: L,
3765
+ label: te,
3766
+ isPaid: j,
3767
+ blockedReason: d === "details" ? H : void 0
3768
+ });
3769
+ return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(ci, {
3770
+ buttonText: n,
3771
+ registeredEmail: S.registeredEmail,
3772
+ isSheetOpen: w.isOpen,
3773
+ isLoading: c.isLoading,
3774
+ onOpen: w.open,
3775
+ onRegisterAnother: z
3776
+ }), /* @__PURE__ */ N(oi, {
3777
+ open: w.isOpen,
3778
+ title: C ? I : `Register for ${I}`,
3779
+ when: F,
3780
+ wide: !0,
3781
+ onClose: w.close,
3782
+ onClosed: () => {
3783
+ L.reset(), b.resetValidationDisplay(), m(!1);
3784
+ },
3785
+ layers: L.checkoutElement,
3786
+ onSubmit: C ? void 0 : ee,
3787
+ footer: C ? void 0 : ae,
3788
+ children: C ? /* @__PURE__ */ N(pi, {
3789
+ email: x?.email.trim() ?? "",
3790
+ eventTitle: I,
3791
+ startsAt: r,
3792
+ endsAt: i,
3793
+ eventUrl: a,
3794
+ when: F,
3795
+ bookingRef: C._id,
3796
+ qrImageUrl: C.qr_image?.location,
3797
+ invoiceUrl: C.invoice?.location,
3798
+ attendeeCount: b.slots.length,
3799
+ onClose: w.close,
3800
+ onRegisterAnother: z
3801
+ }) : d === "tickets" ? /* @__PURE__ */ N(xi, {
3802
+ tickets: c.tickets,
3803
+ counts: l,
3804
+ onChange: R,
3805
+ error: p ? "Add at least one ticket to continue" : void 0
3806
+ }) : d === "details" ? /* @__PURE__ */ P("div", {
3807
+ className: "flex flex-col gap-4",
3808
+ children: [
3809
+ V("Change tickets", "tickets"),
3810
+ /* @__PURE__ */ N("span", {
3811
+ className: "font-semibold text-[16px] text-ink",
3812
+ children: y === 1 ? "Your details" : "Attendee details"
3813
+ }),
3814
+ /* @__PURE__ */ N(Lr, {
3815
+ attendees: b,
3816
+ openKey: h,
3817
+ onOpenChange: g
3818
+ })
3819
+ ]
3820
+ }) : /* @__PURE__ */ P("div", {
3821
+ className: "flex flex-col gap-4",
3822
+ children: [
3823
+ V("Edit attendee details", "details"),
3824
+ /* @__PURE__ */ N(Jr, {
3825
+ lines: v,
3826
+ discount: D.discount,
3827
+ pricing: k
3828
+ }),
3829
+ /* @__PURE__ */ N(Qr, {
3830
+ couponCode: D.code,
3831
+ onCouponCodeChange: D.setCode,
3832
+ couponError: D.error,
3833
+ couponLoading: D.isLoading,
3834
+ onValidateCoupon: D.apply,
3835
+ onRemoveCoupon: D.reset,
3836
+ publicCoupons: D.publicCoupons,
3837
+ discount: D.discount,
3838
+ tickets: v.map((e) => e.ticket)
3839
+ }),
3840
+ j && /* @__PURE__ */ N(Ir, {
3841
+ values: b.billing,
3842
+ onChange: b.setBillingField
3843
+ })
3844
+ ]
3845
+ })
3846
+ })] });
3847
+ }, Gi = ({ selectedTicket: e, discount: t }) => {
3848
+ let [n, r] = A(!1), i = e?.currency, a = Hr(e, t), o = Wr(e, t), s = Gr(e, t), c = t?.discount ?? 0, l = s.length > 0 || c > 0 || o !== a, u = /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ P("span", {
3849
+ className: "inline-flex items-center gap-1.5",
3850
+ children: ["Total", l && /* @__PURE__ */ N(ae, { className: X("size-4 text-ink-muted transition-transform", n && "rotate-180") })]
3851
+ }), /* @__PURE__ */ N("span", { children: Z({
3852
+ unit_amount: a,
3853
+ currency: i
3854
+ }) })] }), d = "flex w-full items-center justify-between gap-3 px-3.5 py-3 font-semibold text-[15px] text-ink";
3855
+ return /* @__PURE__ */ P("div", {
3856
+ className: "rounded-xl border border-border bg-ink/3",
3857
+ children: [l ? /* @__PURE__ */ N("button", {
3858
+ type: "button",
3859
+ onClick: () => r((e) => !e),
3860
+ "aria-expanded": n,
3861
+ className: d,
3862
+ children: u
3863
+ }) : /* @__PURE__ */ N("div", {
3864
+ className: d,
3865
+ children: u
3866
+ }), l && /* @__PURE__ */ N(Or, {
3867
+ open: n,
3868
+ children: /* @__PURE__ */ P("div", {
3869
+ className: "flex flex-col gap-1.5 px-3.5 pb-3 text-[13px] text-ink-soft",
3870
+ children: [
3871
+ /* @__PURE__ */ P("div", {
3872
+ className: "flex items-center justify-between gap-3",
3873
+ children: [/* @__PURE__ */ N("span", { children: "Subtotal" }), /* @__PURE__ */ N("span", { children: Z({
3874
+ unit_amount: o,
3875
+ currency: i
3876
+ }) })]
3877
+ }),
3878
+ c > 0 && /* @__PURE__ */ P("div", {
3879
+ className: "flex items-center justify-between gap-3 text-emerald-700 dark:text-emerald-400",
3880
+ children: [/* @__PURE__ */ N("span", { children: "Discount" }), /* @__PURE__ */ P("span", { children: ["-", Z({
3881
+ unit_amount: c,
3882
+ currency: i
3883
+ })] })]
3884
+ }),
3885
+ s.map((e, t) => /* @__PURE__ */ P("div", {
3886
+ className: "flex items-center justify-between gap-3",
3887
+ children: [/* @__PURE__ */ P("span", { children: [
3888
+ e.label,
3889
+ " (",
3890
+ e.percentage,
3891
+ "%)"
3892
+ ] }), /* @__PURE__ */ N("span", { children: Z({
3893
+ unit_amount: e.amount,
3894
+ currency: i
3895
+ }) })]
3896
+ }, e.id || e._id || t)),
3897
+ e?.tax_inclusive && /* @__PURE__ */ N("p", {
3898
+ className: "m-0 text-ink-muted text-xs",
3899
+ children: "Price is inclusive of taxes"
3900
+ })
3901
+ ]
3902
+ })
3903
+ })]
3904
+ });
3905
+ }, Ki = ({ tickets: e, selectedTicket: t, onSelect: n, error: r }) => {
3906
+ let [i, a] = A(!t);
3907
+ return /* @__PURE__ */ P("fieldset", {
3908
+ className: "m-0 flex min-w-0 flex-col gap-2 border-0 p-0",
3909
+ children: [
3910
+ /* @__PURE__ */ N("legend", {
3911
+ className: "mb-2 p-0 font-medium text-ink text-sm",
3912
+ children: "Choose your ticket"
3913
+ }),
3914
+ /* @__PURE__ */ N("div", {
3915
+ className: "-mb-2 flex flex-col",
3916
+ children: e.map((r) => {
3917
+ let o = r._id === t?._id, s = i || o, c = zr(r);
3918
+ return /* @__PURE__ */ N(Or, {
3919
+ open: s,
3920
+ children: /* @__PURE__ */ P("label", {
3921
+ className: X("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"),
3922
+ children: [
3923
+ /* @__PURE__ */ N("input", {
3924
+ type: "radio",
3925
+ name: "ticket",
3926
+ value: r._id,
3927
+ checked: o,
3928
+ onChange: () => {
3929
+ n(r), a(!1);
3930
+ },
3931
+ onClick: () => {
3932
+ i || a(!0);
3933
+ },
3934
+ className: "sr-only"
3935
+ }),
3936
+ /* @__PURE__ */ N("span", {
3937
+ "aria-hidden": !0,
3938
+ className: X("mt-0.5 size-[17px] shrink-0 rounded-full border transition-all", o ? "border-[5px] border-brand" : "border-border")
3939
+ }),
3940
+ /* @__PURE__ */ P("span", {
3941
+ className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
3942
+ children: [/* @__PURE__ */ N("span", {
3943
+ className: "block font-medium text-[14.5px] text-ink leading-snug",
3944
+ children: r.title
3945
+ }), r.description && /* @__PURE__ */ N("span", {
3946
+ title: r.description,
3947
+ className: X("mt-0.5 block text-[12.5px] text-ink-soft leading-snug", !i && "line-clamp-2"),
3948
+ children: r.description
3949
+ })]
3950
+ }),
3951
+ /* @__PURE__ */ P("span", {
3952
+ className: "flex shrink-0 flex-col items-end gap-1.5",
3953
+ children: [/* @__PURE__ */ P("span", {
3954
+ className: "text-right font-medium text-[14.5px] text-ink",
3955
+ children: [Z(r), c && /* @__PURE__ */ N("span", {
3956
+ className: "block font-normal text-[11.5px] text-ink-muted",
3957
+ children: c
3958
+ })]
3959
+ }), o && !i && e.length > 1 && /* @__PURE__ */ P("span", {
3960
+ 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",
3961
+ children: [
3962
+ e.length - 1,
3963
+ " more",
3964
+ /* @__PURE__ */ N(ae, {
3965
+ "aria-hidden": !0,
3966
+ className: "size-3.5"
3967
+ })
3968
+ ]
3969
+ })]
3970
+ })
3971
+ ]
3972
+ })
3973
+ }, r._id);
3974
+ })
3975
+ }),
3976
+ r && /* @__PURE__ */ N("p", {
3977
+ className: "m-0 text-danger text-xs",
3978
+ children: r
3979
+ })
3980
+ ]
3981
+ });
3982
+ }, qi = (e) => e.enableMultipleTicketBooking && !e.external ? /* @__PURE__ */ N(Wi, { ...e }, e.eventID) : /* @__PURE__ */ N(Ji, { ...e }, e.eventID), Ji = ({ eventID: e, title: t, external: n, buttonText: r = "Register Now", startsAt: i, endsAt: a, eventUrl: o }) => {
3983
+ let { account: s } = tt(), c = sr(), l = Di({
3392
3984
  eventID: e,
3393
3985
  external: n
3394
- }), u = l.selectedTicket?.registration_fields ?? Zr, d = li(s, u), f = Mr(l.selectedTicket, null)?.isFree === !1, [p, m] = A(null), [h, g] = A(null);
3395
- E(() => {
3396
- let t = ri(e);
3397
- t && g({ email: t.email });
3398
- }, [e]);
3399
- let _ = Si({ canAutoOpen: !n && !l.isLoading && l.tickets.length > 0 && !h }), v = k(null), y = ui({
3986
+ }), u = l.selectedTicket?.registration_fields ?? mi, d = Ci(s, u), f = Ur(l.selectedTicket, null)?.isFree === !1, p = zi(e), { booking: m } = p, h = Hi({ canAutoOpen: !n && !l.isLoading && l.tickets.length > 0 && !p.registeredEmail }), g = k(null), _ = Ti({
3400
3987
  eventID: e,
3401
- selectedTicket: l.selectedTicket,
3402
- enabled: _.isOpen && f
3403
- }), b = Mr(l.selectedTicket, y.discount), x = !!b && !b.isFree, S = l.tickets.length > 1, C = O(() => zr(i, a), [i, a]), w = t || "this event", T = S || x, D = yi({
3988
+ ticketIds: l.selectedTicket ? [l.selectedTicket._id] : [],
3989
+ enabled: h.isOpen && f
3990
+ }), v = Ur(l.selectedTicket, _.discount), y = !!v && !v.isFree, b = l.tickets.length > 1, x = O(() => ei(i, a), [i, a]), S = t || "this event", C = b || y, w = Pi({
3404
3991
  eventID: e,
3405
3992
  details: {
3406
3993
  merchantName: c?.name || t || "",
@@ -3408,33 +3995,26 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3408
3995
  prefill: {
3409
3996
  name: d.values.name.trim(),
3410
3997
  email: d.values.email.trim(),
3411
- contact: Qr(d.values.mobile)
3998
+ contact: hi(d.values.mobile)
3412
3999
  }
3413
4000
  },
3414
- onConfirmed: (t) => {
3415
- let n = d.values.email.trim();
3416
- m(t), g({ email: n }), ii(e, {
3417
- bookingId: t._id,
3418
- email: n,
3419
- at: (/* @__PURE__ */ new Date()).toISOString()
3420
- });
3421
- }
3422
- }), { state: j } = D, F = j.kind === "busy", I = (e) => {
3423
- y.reset(), D.reset(), l.selectTicket(e);
3424
- }, L = () => {
3425
- ai(e), g(null), m(null), D.reset(), d.reset();
3426
- }, R = (t) => {
3427
- t.preventDefault(), d.markSubmitted(), !(!l.selectedTicket || !d.isValid) && D.register({
4001
+ onConfirmed: (e) => p.complete(e, d.values.email.trim())
4002
+ }), T = (e) => {
4003
+ _.reset(), w.reset(), l.selectTicket(e);
4004
+ }, E = () => {
4005
+ p.clear(), w.reset(), d.reset();
4006
+ }, D = (t) => {
4007
+ t.preventDefault(), d.markSubmitted(), !(!l.selectedTicket || !d.isValid) && w.register({
3428
4008
  event: e,
3429
- coupon: y.code,
4009
+ coupon: _.code,
3430
4010
  attendees: [{
3431
4011
  name: d.values.name.trim(),
3432
4012
  email: d.values.email.trim(),
3433
- ...ei(d.values, u),
4013
+ ..._i(d.values, u),
3434
4014
  ticket: l.selectedTicket._id,
3435
4015
  details: {}
3436
4016
  }],
3437
- ...d.values.is_business_purchase && x ? {
4017
+ ...d.values.is_business_purchase && y ? {
3438
4018
  is_business_purchase: !0,
3439
4019
  billing_details: d.values.billing_details
3440
4020
  } : {}
@@ -3444,133 +4024,95 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3444
4024
  className: "my-2",
3445
4025
  children: /* @__PURE__ */ N("button", {
3446
4026
  type: "button",
3447
- className: Ci,
4027
+ className: si,
3448
4028
  onClick: () => window.open(n, "_blank", "noopener,noreferrer"),
3449
4029
  children: r
3450
4030
  })
3451
4031
  });
3452
- if (!l.isLoading && l.tickets.length === 0) return /* @__PURE__ */ N("div", {
3453
- className: "my-2",
3454
- children: /* @__PURE__ */ N("p", {
3455
- className: "m-0 text-ink-soft text-sm",
3456
- children: l.hasFailed ? "We couldn't load tickets for this event. Please refresh the page." : "Registration isn't open for this event yet."
3457
- })
3458
- });
3459
- let z = b ? b.isFree ? "Save my spot" : `Pay ${Q({
3460
- unit_amount: b.amount,
3461
- currency: b.currency
4032
+ if (!l.isLoading && l.tickets.length === 0) return /* @__PURE__ */ N(li, { hasFailed: l.hasFailed });
4033
+ let A = v ? v.isFree ? "Save my spot" : `Pay ${Z({
4034
+ unit_amount: v.amount,
4035
+ currency: v.currency
3462
4036
  })}` : "Choose a ticket";
3463
- return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("div", {
3464
- className: "my-2",
3465
- children: h && !_.isOpen ? /* @__PURE__ */ P("span", {
3466
- 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",
3467
- children: [
3468
- /* @__PURE__ */ N(ie, { className: "size-4 text-emerald-600 dark:text-emerald-400" }),
3469
- "You're registered as ",
3470
- h.email,
3471
- /* @__PURE__ */ N("button", {
3472
- type: "button",
3473
- onClick: L,
3474
- className: "text-ink-soft underline underline-offset-[3px] hover:text-ink",
3475
- children: "Register someone else"
3476
- })
3477
- ]
3478
- }) : /* @__PURE__ */ N("button", {
3479
- type: "button",
3480
- onClick: _.open,
3481
- disabled: l.isLoading,
3482
- className: Z(Ci, "disabled:opacity-60"),
3483
- children: r
3484
- })
3485
- }), /* @__PURE__ */ N(Kr, {
3486
- open: _.isOpen,
3487
- title: p ? w : `Register for ${w}`,
3488
- when: C,
3489
- wide: S,
3490
- onClose: _.close,
4037
+ return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(ci, {
4038
+ buttonText: r,
4039
+ registeredEmail: p.registeredEmail,
4040
+ isSheetOpen: h.isOpen,
4041
+ isLoading: l.isLoading,
4042
+ onOpen: h.open,
4043
+ onRegisterAnother: E
4044
+ }), /* @__PURE__ */ N(oi, {
4045
+ open: h.isOpen,
4046
+ title: m ? S : `Register for ${S}`,
4047
+ when: x,
4048
+ wide: b,
4049
+ onClose: h.close,
3491
4050
  onClosed: () => {
3492
- D.reset(), d.resetValidationDisplay();
4051
+ w.reset(), d.resetValidationDisplay();
3493
4052
  },
3494
- initialFocusRef: S ? void 0 : v,
3495
- layers: D.checkoutElement,
3496
- onSubmit: p ? void 0 : R,
3497
- footer: p ? void 0 : /* @__PURE__ */ P(M, { children: [
3498
- (j.kind === "unpaid" || j.kind === "failed") && /* @__PURE__ */ P("p", {
3499
- role: "alert",
3500
- 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",
3501
- children: [j.message, j.kind === "unpaid" && /* @__PURE__ */ N("button", {
3502
- type: "button",
3503
- onClick: D.retry,
3504
- className: "ml-1.5 inline-flex items-center gap-1 font-semibold underline underline-offset-[3px]",
3505
- children: "Pay again"
3506
- })]
3507
- }),
3508
- /* @__PURE__ */ P("button", {
3509
- type: "submit",
3510
- disabled: F,
3511
- 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",
3512
- children: [F && /* @__PURE__ */ N(se, { className: "size-4 animate-spin" }), F && j.stage === "paying" ? "Opening secure checkout" : z]
3513
- }),
3514
- /* @__PURE__ */ N("p", {
3515
- className: "m-0 mt-2 text-center text-ink-muted text-xs",
3516
- children: x ? "Secure payment · confirmation sent to your email" : "No card needed · joining link sent to your email"
3517
- })
3518
- ] }),
3519
- children: p ? /* @__PURE__ */ N(Xr, {
4053
+ initialFocusRef: b ? void 0 : g,
4054
+ layers: w.checkoutElement,
4055
+ onSubmit: m ? void 0 : D,
4056
+ footer: m ? void 0 : /* @__PURE__ */ N(Yr, {
4057
+ payment: w,
4058
+ label: A,
4059
+ isPaid: y
4060
+ }),
4061
+ children: m ? /* @__PURE__ */ N(pi, {
3520
4062
  email: d.values.email.trim(),
3521
- eventTitle: w,
4063
+ eventTitle: S,
3522
4064
  startsAt: i,
3523
4065
  endsAt: a,
3524
4066
  eventUrl: o,
3525
- when: C,
3526
- bookingRef: p._id,
3527
- qrImageUrl: p.qr_image?.location,
3528
- invoiceUrl: p.invoice?.location,
3529
- onClose: _.close,
3530
- onRegisterAnother: L
4067
+ when: x,
4068
+ bookingRef: m._id,
4069
+ qrImageUrl: m.qr_image?.location,
4070
+ invoiceUrl: m.invoice?.location,
4071
+ onClose: h.close,
4072
+ onRegisterAnother: E
3531
4073
  }) : /* @__PURE__ */ P("div", {
3532
4074
  className: "flex flex-col gap-4",
3533
4075
  children: [
3534
- S && /* @__PURE__ */ N(oi, {
4076
+ b && /* @__PURE__ */ N(Ki, {
3535
4077
  tickets: l.tickets,
3536
4078
  selectedTicket: l.selectedTicket,
3537
- onSelect: I,
4079
+ onSelect: T,
3538
4080
  error: d.submitAttempted && !l.selectedTicket ? "Choose a ticket to continue" : void 0
3539
4081
  }),
3540
- x && /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(Wr, {
4082
+ y && /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(Gi, {
3541
4083
  selectedTicket: l.selectedTicket,
3542
- discount: y.discount
3543
- }), /* @__PURE__ */ N(Lr, {
3544
- couponCode: y.code,
3545
- onCouponCodeChange: y.setCode,
3546
- couponError: y.error,
3547
- couponLoading: y.isLoading,
3548
- onValidateCoupon: y.apply,
3549
- onRemoveCoupon: y.reset,
3550
- publicCoupons: y.publicCoupons,
3551
- discount: y.discount,
3552
- selectedTicket: l.selectedTicket
4084
+ discount: _.discount
4085
+ }), /* @__PURE__ */ N(Qr, {
4086
+ couponCode: _.code,
4087
+ onCouponCodeChange: _.setCode,
4088
+ couponError: _.error,
4089
+ couponLoading: _.isLoading,
4090
+ onValidateCoupon: _.apply,
4091
+ onRemoveCoupon: _.reset,
4092
+ publicCoupons: _.publicCoupons,
4093
+ discount: _.discount,
4094
+ tickets: l.selectedTicket ? [l.selectedTicket] : []
3553
4095
  })] }),
3554
4096
  /* @__PURE__ */ P("div", {
3555
- className: Z("flex flex-col gap-4", T && "border-border border-t pt-4"),
3556
- children: [T && /* @__PURE__ */ N("span", {
4097
+ className: X("flex flex-col gap-4", C && "border-border border-t pt-4"),
4098
+ children: [C && /* @__PURE__ */ N("span", {
3557
4099
  className: "font-medium text-ink text-sm",
3558
4100
  children: "Your details"
3559
- }), /* @__PURE__ */ N(Er, {
4101
+ }), /* @__PURE__ */ N(Fr, {
3560
4102
  values: d.values,
3561
4103
  errors: d.errors,
3562
4104
  touched: d.touched,
3563
4105
  onChange: d.setField,
3564
4106
  onBlur: d.touchField,
3565
- showBusinessBilling: x,
4107
+ showBusinessBilling: y,
3566
4108
  registrationFields: u,
3567
- nameInputRef: v
4109
+ nameInputRef: g
3568
4110
  })]
3569
4111
  })
3570
4112
  ]
3571
4113
  })
3572
4114
  })] });
3573
- }, Ti = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, Ei = (e) => typeof e == "string" && e.trim() ? e : void 0, Di = (e) => typeof e == "string" ? e : e?.location ?? void 0, Oi = (e, t) => {
4115
+ }, Yi = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, Xi = (e) => typeof e == "string" && e.trim() ? e : void 0, Zi = (e) => typeof e == "string" ? e : e?.location ?? void 0, Qi = (e, t) => {
3574
4116
  let n = e.meta ?? {}, r = e.title && t ? `${e.title} | ${t}` : e.title || t || void 0;
3575
4117
  return {
3576
4118
  title: n.meta_title || r,
@@ -3580,32 +4122,32 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3580
4122
  og: {
3581
4123
  title: n.og_title || void 0,
3582
4124
  description: n.og_description || void 0,
3583
- image: Di(n.og_image),
4125
+ image: Zi(n.og_image),
3584
4126
  url: n.og_url || void 0
3585
4127
  },
3586
4128
  twitter: { card: n.twitter_card || void 0 },
3587
4129
  ldJson: n.ld_json || void 0,
3588
4130
  customHead: n.head_code || void 0
3589
4131
  };
3590
- }, ki = (e) => ({
4132
+ }, $i = (e) => ({
3591
4133
  description: e.description || void 0,
3592
4134
  customHead: e.settings?.head_code || void 0
3593
- }), Ai = (e) => (t = {}, n) => (r) => {
3594
- let i = Oi(t, e.name);
4135
+ }), ea = (e) => (t = {}, n) => (r) => {
4136
+ let i = Qi(t, e.name);
3595
4137
  if (n) {
3596
4138
  let t = r?.loaderData?.[n.source];
3597
4139
  if (t) {
3598
- let r = n.title ? Ei(t[n.title]) : void 0;
4140
+ let r = n.title ? Xi(t[n.title]) : void 0;
3599
4141
  r && (i.title = e.name ? `${r} | ${e.name}` : r, i.og = {
3600
4142
  ...i.og,
3601
4143
  title: r
3602
4144
  });
3603
- let a = n.description ? Ei(t[n.description]) : void 0;
4145
+ let a = n.description ? Xi(t[n.description]) : void 0;
3604
4146
  a && (i.description = a, i.og = {
3605
4147
  ...i.og,
3606
4148
  description: a
3607
4149
  });
3608
- let o = n.image ? Di(t[n.image]) : void 0;
4150
+ let o = n.image ? Zi(t[n.image]) : void 0;
3609
4151
  o && (i.og = {
3610
4152
  ...i.og,
3611
4153
  image: o
@@ -3614,31 +4156,31 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3614
4156
  }
3615
4157
  if (!i.canonical) {
3616
4158
  let t = r?.match?.pathname, n = (e.domain || "").trim();
3617
- n && t?.startsWith("/") && (i.canonical = (/^https?:\/\//.test(n) ? n : `https://${n}`).replace(/\/+$/, "") + Ti(t));
4159
+ n && t?.startsWith("/") && (i.canonical = (/^https?:\/\//.test(n) ? n : `https://${n}`).replace(/\/+$/, "") + Yi(t));
3618
4160
  }
3619
- let a = _r(i, ki(e)), o = t.id?.trim();
4161
+ let a = Er(i, $i(e)), o = t.id?.trim();
3620
4162
  return o && a.meta.push({
3621
- name: qn,
4163
+ name: tr,
3622
4164
  content: o
3623
4165
  }), a;
3624
- }, ji = (e) => {
3625
- let t = Oe(e);
4166
+ }, ta = (e) => e.params, na = (e) => {
4167
+ let t = Me(e);
3626
4168
  return (e, n) => {
3627
- let { rules: r, invalid: i } = be(n?.access), a = r.length > 0 || i;
3628
- return ({ context: n, params: r }) => a ? Promise.resolve({}) : Je({
3629
- queryClient: n.queryClient,
4169
+ let { rules: r, invalid: i } = we(n?.access), a = r.length > 0 || i;
4170
+ return (n) => a ? Promise.resolve({}) : Qe({
4171
+ queryClient: n.context.queryClient,
3630
4172
  config: t,
3631
4173
  sources: e,
3632
- params: r
4174
+ params: ta(n)
3633
4175
  });
3634
4176
  };
3635
- }, Mi = 2, Ni = (e) => {
3636
- let { limit: t = 20, debounceMs: n = 300, hotkey: r = !0 } = e ?? {}, a = i(), o = $n(), s = G(), [c, l] = A(""), [u, d] = A(!1), [f, p] = A("");
4177
+ }, ra = 2, ia = (e) => {
4178
+ let { limit: t = 20, debounceMs: n = 300, hotkey: r = !0 } = e ?? {}, a = i(), o = sr(), s = K(), [c, l] = A(""), [u, d] = A(!1), [f, p] = A("");
3637
4179
  E(() => {
3638
4180
  let e = setTimeout(() => p(c.trim()), n);
3639
4181
  return () => clearTimeout(e);
3640
4182
  }, [c, n]);
3641
- let m = f.length >= Mi, h = R({
4183
+ let m = f.length >= ra, h = R({
3642
4184
  queryKey: [
3643
4185
  "levo-search",
3644
4186
  o?.id ?? null,
@@ -3687,4 +4229,4 @@ var Z = (...e) => e.filter(Boolean).join(" "), yr = ({ open: e, className: t, ch
3687
4229
  };
3688
4230
  };
3689
4231
  //#endregion
3690
- export { Ft as ColorModeProvider, Hn as Inspector, pe as LEVO_AUTH_METHODS, K as LEVO_AUTH_QUERY_KEY, fe as LEVO_OAUTH_METHODS, bt as LEVO_OTP_LENGTH, ut as LEVO_PENDING_APPROVAL_CODE, H as LEVO_PRIMARY_AUTH_METHODS, m as LOCALE_COOKIE, l as LOCALE_REDIRECT_CACHE_CONTROL, Dt as LevoChat, Qe as LevoEntryForm, wi as LevoEventRegister, Lt as LevoForm, Xn as LevoPopups, rt as LevoProfileForm, nr as LevoSiteProvider, sr as LocaleHreflang, lr as LocaleProvider, qn as PAGE_ID_META, vr as PageHead, fr as SiteLocaleProvider, or as buildHreflangLinks, Ai as createLevoHead, ji as createLevoLoader, _ as createRouteTreeMatcher, De as createSiteClient, Ee as decideAccess, v as extractGeoAndLanguageData, dt as isPendingApprovalError, xt as isValidEmail, St as isValidOtp, wt as isValidPhone, Pe as levoParams, rr as localeBeforeLoad, p as localePath, d as localeRedirectResponse, Ct as normalizePhone, _r as pageHead, be as parseAccess, gr as parseRawHead, Je as prefetchLevoSources, ir as readLocaleConfig, Jn as readPageId, xe as resolveAuthMethods, g as resolveLocale, u as resolveLocaleRedirect, s as resolveLocaleRequest, Oe as siteConfigFromJson, f as splitLocalePrefix, It as useColorMode, pr as useLanguageOptions, lt as useLevoAccess, Ze as useLevoAuth, Ke as useLevoForm, tr as useLevoInsights, mt as useLevoLogin, yt as useLevoOAuth, Tt as useLevoOtpInput, Ge as useLevoRecord, Ni as useLevoSearch, er as useLevoSite, We as useLevoSource, ur as useLocale, dr as useUrlLocale };
4232
+ export { zt as ColorModeProvider, Xn as Inspector, ge as LEVO_AUTH_METHODS, q as LEVO_AUTH_QUERY_KEY, he as LEVO_OAUTH_METHODS, wt as LEVO_OTP_LENGTH, mt as LEVO_PENDING_APPROVAL_CODE, me as LEVO_PRIMARY_AUTH_METHODS, m as LOCALE_COOKIE, l as LOCALE_REDIRECT_CACHE_CONTROL, jt as LevoChat, Ht as LevoEditForm, nt as LevoEntryForm, qi as LevoEventRegister, Ut as LevoForm, hr as LevoLink, ir as LevoPopups, st as LevoProfileForm, ur as LevoSiteProvider, gr as LocaleHreflang, vr as LocaleProvider, tr as PAGE_ID_META, Dr as PageHead, xr as SiteLocaleProvider, mr as buildHreflangLinks, ea as createLevoHead, na as createLevoLoader, _ as createRouteTreeMatcher, je as createSiteClient, Ae as decideAccess, v as extractGeoAndLanguageData, ht as isPendingApprovalError, Tt as isValidEmail, Et as isValidOtp, Ot as isValidPhone, Re as levoParams, dr as localeBeforeLoad, p as localePath, d as localeRedirectResponse, Dt as normalizePhone, Er as pageHead, we as parseAccess, Tr as parseRawHead, Qe as prefetchLevoSources, fr as readLocaleConfig, nr as readPageId, Te as resolveAuthMethods, g as resolveLocale, u as resolveLocaleRedirect, s as resolveLocaleRequest, Me as siteConfigFromJson, f as splitLocalePrefix, Bt as useColorMode, Sr as useLanguageOptions, pt as useLevoAccess, tt as useLevoAuth, Xe as useLevoForm, lr as useLevoInsights, vt as useLevoLogin, Ct as useLevoOAuth, kt as useLevoOtpInput, Ye as useLevoRecord, ia as useLevoSearch, cr as useLevoSite, Je as useLevoSource, yr as useLocale, br as useUrlLocale };