@levo-so/site-runtime 0.3.25 → 0.3.27

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,38 +1,39 @@
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";
6
6
  import { createLevoClient as y, getLevoError as b } from "@levo-so/core";
7
- import { Suspense as x, createContext as S, lazy as C, useCallback as w, useContext as T, useEffect as E, useLayoutEffect as D, useMemo as O, useRef as k, useState as A, useSyncExternalStore as j } from "react";
8
- import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
9
- import { Dialog as F } from "@base-ui/react/dialog";
10
- import { keepPreviousData as I, useMutation as L, useQuery as R, useQueryClient as z } from "@tanstack/react-query";
11
- import { Link as ee, ScriptOnce as te, redirect as ne, useRouterState as B } from "@tanstack/react-router";
7
+ import { Suspense as x, createContext as S, lazy as C, useCallback as w, useContext as T, useEffect as E, useLayoutEffect as D, useMemo as O, useRef as k, useState as A, useSyncExternalStore as ee } from "react";
8
+ import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
9
+ import { Dialog as P } from "@base-ui/react/dialog";
10
+ import { keepPreviousData as F, useMutation as I, useQuery as L, useQueryClient as R } from "@tanstack/react-query";
11
+ import { Link as te, ScriptOnce as z, redirect as ne, useRouterState as B } from "@tanstack/react-router";
12
12
  import { createLevoInsights as re } from "@levo-so/insights";
13
- import { CalendarPlusIcon as ie, CheckIcon as ae, ChevronDownIcon as V, DownloadIcon as oe, LoaderCircleIcon as se, XIcon as ce } from "lucide-react";
14
- import { Popover as H } 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 ie, CalendarPlusIcon as ae, CheckIcon as V, ChevronDownIcon as oe, DownloadIcon as se, LoaderCircleIcon as ce, MinusIcon as le, PlusIcon as ue, TagIcon as de, XIcon as H } 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 fe } from "react-razorpay";
17
+ import { EmbeddedCheckout as pe, EmbeddedCheckoutProvider as me } from "@stripe/react-stripe-js";
17
18
  //#region src/access/types.ts
18
- var fe = [
19
+ var he = [
19
20
  "otp",
20
21
  "magiclink",
21
22
  "whatsapp"
22
- ], pe = [
23
+ ], ge = [
23
24
  "google",
24
25
  "microsoft",
25
26
  "linkedin"
26
- ], me = [...fe, ...pe], he = "otp", U = (e) => typeof e == "object" && !!e && !Array.isArray(e), ge = (e) => fe.includes(e), _e = (e) => pe.includes(e), ve = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], ye = (e) => e, be = (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
+ ], _e = [...he, ...ge], ve = "otp", ye = (e) => typeof e == "object" && !!e && !Array.isArray(e), be = (e) => he.includes(e), xe = (e) => ge.includes(e), Se = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], Ce = (e) => e, we = (e) => {
28
+ if (!ye(e)) return null;
29
+ let t = e.enabled === void 0 ? !0 : e.enabled === !0, n = ye(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: ve(n.methods).filter((e) => ge(e) || _e(e)),
35
- ...ge(n.primary_method) ? { primary_method: n.primary_method } : {}
35
+ methods: Se(n.methods).filter((e) => be(e) || xe(e)),
36
+ ...be(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 fe = [
40
41
  enabled: t,
41
42
  options: {
42
43
  collection: n.collection.trim(),
43
- ...U(n.condition) ? { condition: ye(n.condition) } : {},
44
- hidden: ve(n.hidden)
44
+ ...ye(n.condition) ? { condition: Ce(n.condition) } : {},
45
+ hidden: Se(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: ye(n.condition) } : {},
52
- hidden: ve(n.hidden)
52
+ ...ye(n.condition) ? { condition: Ce(n.condition) } : {},
53
+ hidden: Se(n.hidden)
53
54
  }
54
55
  };
55
56
  default: return null;
56
57
  }
57
- }, xe = (e) => {
58
+ }, Te = (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(be).filter((e) => e !== null);
63
+ let t = e.map(we).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
- }, Se = (e) => {
68
+ }, Ee = (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(ge) ?? he,
71
- oauth: n.filter(_e)
71
+ primary: (t?.kind === "authentication" ? t.options?.primary_method : void 0) ?? n.find(be) ?? ve,
72
+ oauth: n.filter(xe)
72
73
  };
73
- }, Ce = (e = null) => ({
74
+ }, De = (e = null) => ({
74
75
  state: "granted",
75
76
  code: e,
76
77
  message: null,
77
78
  rule: null
78
- }), we = () => ({
79
+ }), Oe = () => ({
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
- }), Te = (e, t) => {
89
+ }), ke = (e, t) => {
89
90
  let n = t?.split(".")[0];
90
91
  return e.find((e) => e.kind === n) ?? null;
91
- }, Ee = (e, t) => {
92
+ }, Ae = (e, t) => {
92
93
  let n = (e) => t.find((t) => t.kind === e);
93
- if (e === "granted") return Ce();
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 De();
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
- }, De = ({ rules: e, invalid: t, pageId: n, hasClient: r, isReady: i, isLoggedIn: a, check: o, preview: s }) => {
101
- if (e.length === 0 && !t) return Ce();
100
+ return e === "profile_incomplete" && i ? G("profile.CONDITION_NOT_FULFILLED", null, i) : null;
101
+ }, je = ({ rules: e, invalid: t, pageId: n, hasClient: r, isReady: i, isLoggedIn: a, check: o, preview: s }) => {
102
+ if (e.length === 0 && !t) return De();
102
103
  if (s) {
103
- let t = Ee(s, e);
104
+ let t = Ae(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 ? Ce(o.data.code ?? null) : W(o.data.code ?? "access.CHECK_FAILED", o.data.message ?? null, Te(e, o.data.code)) : W("access.CHECK_FAILED", "We could not verify your access.") : we() : 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.") : we();
107
- }, Oe = (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 ? De(o.data.code ?? null) : G(o.data.code ?? "access.CHECK_FAILED", o.data.message ?? null, ke(e, o.data.code)) : G("access.CHECK_FAILED", "We could not verify your access.") : Oe() : 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.") : Oe();
108
+ }, Me = (e) => {
108
109
  let t = (e?.apiUrl || "").replace(/\/$/, "");
109
110
  return t ? y({
110
111
  apiUrl: t,
@@ -113,15 +114,15 @@ var fe = [
113
114
  NODE_ENV: "",
114
115
  APP_MODE: e?.appMode || "production"
115
116
  }) : null;
116
- }, ke = (e) => ({
117
+ }, Ne = (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
- }), Ae = /\{\$([A-Za-z0-9_]+)\}/g, je = (e) => {
123
+ }), Pe = /\{\$([A-Za-z0-9_]+)\}/g, Fe = (e) => {
123
124
  let t = [], n = [], r = 0;
124
- for (let i of e.matchAll(Ae)) n.push(e.slice(r, i.index)), t.push(i[1]), r = i.index + i[0].length;
125
+ for (let i of e.matchAll(Pe)) 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 fe = [
132
133
  names: t,
133
134
  literals: n
134
135
  };
135
- }, Me = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), Ne = ({ literals: e }) => RegExp(`^${e.map(Me).join("([^/]+)")}$`), Pe = /* @__PURE__ */ new Set(), Fe = (e, t, n) => {
136
- let r = je(t), i = Ne(r), a = (e) => {
136
+ }, Ie = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), Le = ({ literals: e }) => RegExp(`^${e.map(Ie).join("([^/]+)")}$`), Re = /* @__PURE__ */ new Set(), ze = (e, t, n) => {
137
+ let r = Fe(t), i = Le(r), a = (e) => {
137
138
  let n = e;
138
- return t.replace(Ae, (e, r) => {
139
+ return t.replace(Pe, (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;
@@ -145,7 +146,7 @@ var fe = [
145
146
  parse: (t) => {
146
147
  if (!Object.hasOwn(t, e)) {
147
148
  let n = Object.keys(t).join(", ") || "none";
148
- return Pe.has(e) || (Pe.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 Re.has(e) || (Re.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 fe = [
161
162
  [e]: a(t)
162
163
  })
163
164
  };
164
- }, Ie = (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.`, Le = (e) => [
165
+ }, Be = (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.`, Ve = (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
- ], Re = (e, t) => [
172
+ ], He = (e, t) => [
172
173
  "levo-source",
173
174
  "record",
174
175
  e.module,
175
176
  e.identifier,
176
177
  t ?? null
177
- ], ze = (e) => [
178
+ ], Ue = (e) => [
178
179
  "levo-source",
179
180
  "form",
180
181
  e.module,
181
182
  e.identifier
182
- ], Be = {
183
+ ], We = {
183
184
  blog_author: "author",
184
185
  blog_category: "category",
185
186
  blog_tag: "tag"
186
- }, Ve = (e, t) => {
187
- let n = encodeURIComponent(e.identifier), r = t ? `${encodeURIComponent(t)}/get-single` : "list", i = Be[e.module];
187
+ }, Ge = (e, t) => {
188
+ let n = encodeURIComponent(e.identifier), r = t ? `${encodeURIComponent(t)}/get-single` : "list", i = We[e.module];
188
189
  return i ? `/v1/blog/${n}/${i}/${r}` : e.module === "community" ? `/v1/community/${n}/post/${r}` : null;
189
- }, He = async (e, t) => {
190
- let n = Ve(t);
190
+ }, Ke = async (e, t) => {
191
+ let n = Ge(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 fe = [
203
204
  data: r.content.data ?? [],
204
205
  meta: r.content.meta ?? null
205
206
  };
206
- }, Ue = async (e, t, n) => {
207
- let r = Ve(t, n);
207
+ }, qe = async (e, t, n) => {
208
+ let r = Ge(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
- }, We = async (e, t) => (await e.collection.getCollectionByIDExpanded(t.identifier)).content.data ?? null, Ge = (e) => {
213
- let t = i(), n = R({
214
- queryKey: Le(e),
215
- queryFn: () => He(t, e),
213
+ }, Je = async (e, t) => (await e.collection.getCollectionByIDExpanded(t.identifier)).content.data ?? null, Ye = (e) => {
214
+ let t = i(), n = L({
215
+ queryKey: Ve(e),
216
+ queryFn: () => Ke(t, e),
216
217
  enabled: !!t
217
218
  });
218
219
  return {
@@ -225,10 +226,10 @@ var fe = [
225
226
  ...e
226
227
  }) }
227
228
  };
228
- }, Ke = (e, t) => {
229
- let n = i(), r = R({
230
- queryKey: Re(e, t),
231
- queryFn: () => Ue(n, e, t),
229
+ }, Xe = (e, t) => {
230
+ let n = i(), r = L({
231
+ queryKey: He(e, t),
232
+ queryFn: () => qe(n, e, t),
232
233
  enabled: !!n && !!t
233
234
  });
234
235
  return {
@@ -240,10 +241,10 @@ var fe = [
240
241
  ...e
241
242
  }) }
242
243
  };
243
- }, qe = (e) => {
244
- let t = i(), n = R({
245
- queryKey: ze(e),
246
- queryFn: () => We(t, e),
244
+ }, Ze = (e) => {
245
+ let t = i(), n = L({
246
+ queryKey: Ue(e),
247
+ queryFn: () => Je(t, e),
247
248
  enabled: !!t
248
249
  });
249
250
  return {
@@ -255,35 +256,35 @@ var fe = [
255
256
  ...e
256
257
  }) }
257
258
  };
258
- }, Je = (e) => {
259
+ }, Qe = (e) => {
259
260
  let t = Object.values(e ?? {});
260
261
  return t.length === 1 ? t[0] : e?.slug;
261
- }, Ye = async ({ queryClient: e, config: t, sources: n, params: r }) => {
262
- let i = Oe(t);
262
+ }, $e = async ({ queryClient: e, config: t, sources: n, params: r }) => {
263
+ let i = Me(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 ? Ie(t, n.param, r ?? {}) : null;
267
+ let a = n.param ? Be(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] : Je(r);
272
+ let o = n.param ? r?.[n.param] : Qe(r);
272
273
  return o ? [t, await e.ensureQueryData({
273
- queryKey: Re(n, o),
274
- queryFn: () => Ue(i, n, o)
274
+ queryKey: He(n, o),
275
+ queryFn: () => qe(i, n, o)
275
276
  }).catch(() => null)] : [t, null];
276
277
  }
277
278
  return n.mode === "form" ? [t, await e.ensureQueryData({
278
- queryKey: ze(n),
279
- queryFn: () => We(i, n)
279
+ queryKey: Ue(n),
280
+ queryFn: () => Je(i, n)
280
281
  }).catch(() => null)] : [t, await e.ensureQueryData({
281
- queryKey: Le(n),
282
- queryFn: () => He(i, n)
282
+ queryKey: Ve(n),
283
+ queryFn: () => Ke(i, n)
283
284
  }).catch(() => null)];
284
285
  }));
285
286
  return Object.fromEntries(a);
286
- }, Xe = {
287
+ }, et = {
287
288
  background: "var(--color-page)",
288
289
  foreground: "var(--color-ink)",
289
290
  text: "var(--color-ink)",
@@ -305,10 +306,10 @@ var fe = [
305
306
  input: "var(--color-background1)",
306
307
  inputForeground: "var(--color-ink)",
307
308
  ring: "var(--color-brand)"
308
- }, Ze = (e) => O(() => ({
309
+ }, tt = (e) => O(() => ({
309
310
  ...a({
310
311
  colors: {
311
- ...Xe,
312
+ ...et,
312
313
  ...e?.colors
313
314
  },
314
315
  radius: e?.radius ?? "var(--radius-token)",
@@ -321,15 +322,15 @@ var fe = [
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"], Qe = () => {
331
- let e = i(), t = z(), n = G(), r = R({
332
- queryKey: K,
331
+ var q = ["levo-auth", "session"], nt = () => {
332
+ let e = i(), t = R(), n = K(), r = L({
333
+ queryKey: q,
333
334
  queryFn: async () => {
334
335
  try {
335
336
  return await e?.membership?.getMe() ?? null;
@@ -340,16 +341,16 @@ var K = ["levo-auth", "session"], Qe = () => {
340
341
  enabled: n && !!e,
341
342
  staleTime: 3e4,
342
343
  retry: !1
343
- }), a = L({
344
+ }), a = I({
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,14 +363,14 @@ var K = ["levo-auth", "session"], Qe = () => {
362
363
  signOut: s,
363
364
  isSigningOut: a.isPending
364
365
  };
365
- }, $e = ({ collection: e, hidden: n, submitLabel: r = "Submit", onSuccess: a, theme: o, className: s }) => {
366
- let c = i(), { account: l } = Qe(), { schema: u, isLoading: d } = qe({
366
+ }, rt = ({ collection: e, hidden: n, submitLabel: r = "Submit", onSuccess: a, theme: o, className: s }) => {
367
+ let c = i(), { account: l } = nt(), { schema: u, isLoading: d } = Ze({
367
368
  module: "collection",
368
369
  identifier: e
369
- }), f = Ze(o);
370
- return c ? /* @__PURE__ */ N("div", {
370
+ }), f = tt(o);
371
+ return c ? /* @__PURE__ */ M("div", {
371
372
  className: s,
372
- children: /* @__PURE__ */ N(t, {
373
+ children: /* @__PURE__ */ M(t, {
373
374
  fetchedSchema: u,
374
375
  isLoading: d,
375
376
  submitButtonConfig: {
@@ -390,17 +391,17 @@ var K = ["levo-auth", "session"], Qe = () => {
390
391
  onSuccess: () => a?.()
391
392
  })
392
393
  }) : null;
393
- }, et = "so_levo_membership_account", tt = [
394
+ }, it = "so_levo_membership_account", at = [
394
395
  "profile_picture",
395
396
  "first_name",
396
397
  "last_name",
397
398
  "email",
398
399
  "username",
399
400
  "socials"
400
- ], nt = ["email", "username"], rt = (e) => tt.includes(e.key) || e.editable === !0, it = ({ 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 } = Qe(), d = Ze(o), [f, p] = A(""), m = R({
401
+ ], ot = ["email", "username"], st = (e) => at.includes(e.key) || e.editable === !0, ct = ({ 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 } = nt(), d = tt(o), [f, p] = A(""), m = L({
402
403
  queryKey: ["levo-access", "profile-schema"],
403
- queryFn: async () => (await c?.collection?.getCollectionByIDExpanded(et))?.content?.data ?? null,
404
+ queryFn: async () => (await c?.collection?.getCollectionByIDExpanded(it))?.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"], Qe = () => {
412
413
  ...e,
413
414
  fields: e.fields?.map((e) => ({
414
415
  ...e,
415
- hidden: !rt(e) || !!t?.includes(e.key),
416
- readonly: e.readonly || nt.includes(e.key)
416
+ hidden: !st(e) || !!t?.includes(e.key),
417
+ readonly: e.readonly || ot.includes(e.key)
417
418
  }))
418
419
  }))
419
420
  } : null;
420
- }, [m.data, h]), _ = L({
421
+ }, [m.data, h]), _ = I({
421
422
  mutationFn: async (e) => {
422
- let n = g?.sections?.flatMap((e) => e?.fields ?? [])?.filter((e) => rt(e) && !nt.includes(e.key) && !t?.includes(e.key))?.map((e) => e?.key) ?? [];
423
+ let n = g?.sections?.flatMap((e) => e?.fields ?? [])?.filter((e) => st(e) && !ot.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(""),
@@ -429,12 +430,12 @@ var K = ["levo-auth", "session"], Qe = () => {
429
430
  c?.logger?.error("Failed to update profile", { exception: t }), p(t?.message || "Something went wrong. Please try again.");
430
431
  }
431
432
  });
432
- return c ? /* @__PURE__ */ P("div", {
433
+ return c ? /* @__PURE__ */ N("div", {
433
434
  className: s,
434
- children: [f ? /* @__PURE__ */ N("p", {
435
+ children: [f ? /* @__PURE__ */ M("p", {
435
436
  className: a,
436
437
  children: f
437
- }) : null, g ? /* @__PURE__ */ N(e, {
438
+ }) : null, g ? /* @__PURE__ */ M(e, {
438
439
  schema: g,
439
440
  initialValues: u ?? {},
440
441
  uiConfig: {
@@ -450,15 +451,15 @@ var K = ["levo-auth", "session"], Qe = () => {
450
451
  onSubmit: (e) => _.mutate(e)
451
452
  }) : null]
452
453
  }) : null;
453
- }, at = null, ot = /* @__PURE__ */ new Set(), st = (e) => {
454
- if (at !== e) {
455
- at = e;
456
- for (let e of ot) e();
454
+ }, lt = null, ut = /* @__PURE__ */ new Set(), dt = (e) => {
455
+ if (lt !== e) {
456
+ lt = e;
457
+ for (let e of ut) e();
457
458
  }
458
- }, ct = (e) => (ot.add(e), () => {
459
- ot.delete(e);
460
- }), lt = () => j(ct, () => at, () => null), ut = (e) => {
461
- let t = i(), n = z(), r = G(), { isLoggedIn: a, isLoaded: o } = Qe(), s = lt(), c = e.id?.trim() || "", { rules: l, invalid: u } = O(() => xe(e.access), [e.access]), d = O(() => Se(l), [l]), f = r && !!t && l.length > 0 && !u && !!c && a && !s, p = R({
459
+ }, ft = (e) => (ut.add(e), () => {
460
+ ut.delete(e);
461
+ }), pt = () => ee(ft, () => lt, () => null), mt = (e) => {
462
+ let t = i(), n = R(), r = K(), { isLoggedIn: a, isLoaded: o } = nt(), s = pt(), c = e.id?.trim() || "", { rules: l, invalid: u } = O(() => Te(e.access), [e.access]), d = O(() => Ee(l), [l]), f = r && !!t && l.length > 0 && !u && !!c && a && !s, p = L({
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"], Qe = () => {
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
- ...De({
480
+ ...je({
480
481
  rules: l,
481
482
  invalid: u,
482
483
  pageId: c,
@@ -494,26 +495,26 @@ var K = ["levo-auth", "session"], Qe = () => {
494
495
  recheck: m,
495
496
  isChecking: p.isFetching
496
497
  };
497
- }, dt = "membership.account.ACCOUNT_PENDING_APPROVAL", ft = (e) => e ? e === "membership.account.ACCOUNT_PENDING_APPROVAL" || e.includes("ACCOUNT_PENDING_APPROVAL") : !1, pt = (e) => {
498
+ }, ht = "membership.account.ACCOUNT_PENDING_APPROVAL", gt = (e) => e ? e === "membership.account.ACCOUNT_PENDING_APPROVAL" || e.includes("ACCOUNT_PENDING_APPROVAL") : !1, _t = (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: ft(t?.code)
505
+ isPendingApproval: gt(t?.code)
505
506
  };
506
- }, mt = {
507
+ }, vt = {
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
- }, ht = () => {
513
- let e = i(), t = z(), n = w(async (t, n) => {
513
+ }, yt = () => {
514
+ let e = i(), t = R(), n = w(async (t, n) => {
514
515
  if (!e?.membership) return {
515
516
  ok: !1,
516
- error: mt
517
+ error: vt
517
518
  };
518
519
  try {
519
520
  return {
@@ -524,7 +525,7 @@ var K = ["levo-auth", "session"], Qe = () => {
524
525
  let r = b(n);
525
526
  return e.logger?.error(t, { exception: r }), {
526
527
  ok: !1,
527
- error: pt(r)
528
+ error: _t(r)
528
529
  };
529
530
  }
530
531
  }, [e]), r = w(async ({ identifier: t, medium: n }) => {
@@ -532,13 +533,13 @@ var K = ["levo-auth", "session"], Qe = () => {
532
533
  content: t,
533
534
  ...n === "whatsapp" ? { medium: "whatsapp" } : {}
534
535
  });
535
- }, [e]), a = L({ mutationFn: (e) => n("Failed to send verification code", () => r(e)) }), o = L({ mutationFn: (e) => n("Failed to resend verification code", () => r(e)) }), s = L({ mutationFn: ({ identifier: r, code: i }) => n("Verification failed", async () => {
536
+ }, [e]), a = I({ mutationFn: (e) => n("Failed to send verification code", () => r(e)) }), o = I({ mutationFn: (e) => n("Failed to resend verification code", () => r(e)) }), s = I({ mutationFn: ({ identifier: r, code: i }) => n("Verification failed", async () => {
536
537
  let n = await e?.membership?.signInWithOtp({
537
538
  content: r,
538
539
  code: i
539
540
  }) ?? null;
540
- return t.setQueryData(K, n), t.invalidateQueries({ queryKey: K }), n;
541
- }) }), c = L({ mutationFn: (t) => n("Failed to send magic link", async () => {
541
+ return t.setQueryData(q, n), t.invalidateQueries({ queryKey: q }), n;
542
+ }) }), c = I({ mutationFn: (t) => n("Failed to send magic link", async () => {
542
543
  await e?.membership?.requestMagicLink({ content: t });
543
544
  }) });
544
545
  return {
@@ -551,11 +552,11 @@ var K = ["levo-auth", "session"], Qe = () => {
551
552
  isVerifying: s.isPending,
552
553
  isSendingMagicLink: c.isPending
553
554
  };
554
- }, gt = 700, _t = 500, vt = 700, yt = (e, t) => {
555
- let n = window.screenX + (window.outerWidth - _t) / 2, r = window.screenY + (window.outerHeight - vt) / 2.5;
556
- return window.open(e, t, `width=${_t},height=${vt},left=${n},top=${r}`);
557
- }, bt = ({ 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
+ }, bt = 700, xt = 500, St = 700, Ct = (e, t) => {
556
+ let n = window.screenX + (window.outerWidth - xt) / 2, r = window.screenY + (window.outerHeight - St) / 2.5;
557
+ return window.open(e, t, `width=${xt},height=${St},left=${n},top=${r}`);
558
+ }, wt = ({ methods: e, title: t = "Sign in", onSuccess: n, onError: r }) => {
559
+ let a = i(), o = R(), 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
  });
@@ -563,7 +564,7 @@ var K = ["levo-auth", "session"], Qe = () => {
563
564
  onSuccess: n,
564
565
  onError: r
565
566
  };
566
- let h = R({
567
+ let h = L({
567
568
  queryKey: ["levo-auth", "oauth-urls"],
568
569
  queryFn: async () => await a?.membership?.getOAuthURL() ?? null,
569
570
  enabled: s && !!a && e.length > 0,
@@ -603,7 +604,7 @@ var K = ["levo-auth", "session"], Qe = () => {
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"], Qe = () => {
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: ft(t.get("code"))
615
+ isPendingApproval: gt(t.get("code"))
615
616
  };
616
617
  r.isPendingApproval || d(r), m.current.onError?.(r);
617
- }, gt);
618
+ }, bt);
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"], Qe = () => {
635
636
  signIn: () => {
636
637
  let n = v[e];
637
638
  if (n) {
638
- if (d(null), f.current?.close(), f.current = yt(n, t), !f.current) {
639
+ if (d(null), f.current?.close(), f.current = Ct(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"], Qe = () => {
659
660
  error: u,
660
661
  clearError: w(() => d(null), [])
661
662
  };
662
- }, xt = 4, St = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.trim()), Ct = (e) => (/* @__PURE__ */ RegExp("^\\d{4}$")).test(e.trim()), wt = (e) => {
663
+ }, Tt = 4, Et = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.trim()), Dt = (e) => (/* @__PURE__ */ RegExp("^\\d{4}$")).test(e.trim()), Ot = (e) => {
663
664
  let t = e.replace(/\D/g, "").replace(/^0+/, "");
664
665
  return t ? `+${t}` : "";
665
- }, Tt = (e) => /^\+[1-9]\d{7,14}$/.test(wt(e)), Et = ({ value: e, onChange: t, length: n = 4, onComplete: r, autoFocus: i, disabled: a }) => {
666
+ }, kt = (e) => /^\+[1-9]\d{7,14}$/.test(Ot(e)), At = ({ 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"], Qe = () => {
746
747
  },
747
748
  clear: w(() => f("", 0), [f])
748
749
  };
749
- }, Dt = C(() => import("./kbChat-eFsau7hG.js")), Ot = ({ site: e, path: t }) => {
750
- let n = G(), r = e.workspace_id || void 0;
751
- return !n || !r ? null : /* @__PURE__ */ N(x, {
750
+ }, jt = C(() => import("./kbChat-eFsau7hG.js")), Mt = ({ site: e, path: t }) => {
751
+ let n = K(), r = e.workspace_id || void 0;
752
+ return !n || !r ? null : /* @__PURE__ */ M(x, {
752
753
  fallback: null,
753
- children: /* @__PURE__ */ N(Dt, {
754
+ children: /* @__PURE__ */ M(jt, {
754
755
  workspaceId: r,
755
756
  siteName: e.name || void 0,
756
757
  siteLogo: void 0,
@@ -760,65 +761,98 @@ var K = ["levo-auth", "session"], Qe = () => {
760
761
  path: t
761
762
  })
762
763
  });
763
- }, kt = "(prefers-color-scheme: dark)", At = (e) => {
764
+ }, Nt = "(prefers-color-scheme: dark)", Pt = (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
- }, jt = (e, t) => {
771
+ }, Ft = (e, t) => {
771
772
  try {
772
773
  localStorage.setItem(e, t);
773
774
  } catch {}
774
775
  };
775
- function Mt(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('${kt}').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 It(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('${Nt}').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 Nt = S(void 0), Pt = (e) => e === "system" ? window.matchMedia(kt).matches ? "dark" : "light" : e;
779
- function Ft(e) {
779
+ var Lt = S(void 0), Rt = (e) => e === "system" ? window.matchMedia(Nt).matches ? "dark" : "light" : e;
780
+ function zt(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 It = ({ 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 Bt = ({ 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(At(n) ?? t);
787
+ i(Pt(n) ?? t);
787
788
  }, [t, n]), E(() => {
788
789
  if (!s) return;
789
- let e = Pt(r);
790
- Ft(e), o(e);
790
+ let e = Rt(r);
791
+ zt(e), o(e);
791
792
  }, [r, s]), E(() => {
792
793
  if (!s || r !== "system") return;
793
- let e = window.matchMedia(kt), t = () => {
794
+ let e = window.matchMedia(Nt), t = () => {
794
795
  let t = e.matches ? "dark" : "light";
795
- Ft(t), o(t);
796
+ zt(t), o(t);
796
797
  };
797
798
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
798
- }, [r, s]), /* @__PURE__ */ P(Nt.Provider, {
799
+ }, [r, s]), /* @__PURE__ */ N(Lt.Provider, {
799
800
  value: {
800
801
  mode: r,
801
802
  resolvedMode: a,
802
803
  setMode: (e) => {
803
- jt(n, e), i(e);
804
+ Ft(n, e), i(e);
804
805
  }
805
806
  },
806
- children: [/* @__PURE__ */ N(te, { children: Mt(n, t) }), e]
807
+ children: [/* @__PURE__ */ M(z, { children: It(n, t) }), e]
807
808
  });
808
809
  };
809
- function Lt() {
810
- let e = T(Nt);
810
+ function Vt() {
811
+ let e = T(Lt);
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 Rt = ({ 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: _ } = qe(e), v = Ze(s);
818
- return m ? /* @__PURE__ */ N("div", {
816
+ //#region src/form/LevoEditForm.tsx
817
+ var Ht = (e, t) => !e.hidden && !t?.includes(e.key) && !t?.includes(e.id) && e.allow_public_view !== !1 && e.allow_public_submit !== !1, Ut = ({ source: t, initialValues: n, onSubmit: r, isLoading: i, hiddenFields: a, submitLabel: o = "Save changes", theme: s, className: c }) => {
818
+ let { schema: l, bind: u } = Ze(t), d = tt(s), f = O(() => l ? {
819
+ ...l,
820
+ sections: l.sections?.map((e) => ({
821
+ ...e,
822
+ fields: e.fields?.map((e) => ({
823
+ ...e,
824
+ hidden: !Ht(e, a)
825
+ }))
826
+ }))
827
+ } : null, [l, a?.join("|") ?? ""]), p = (e) => {
828
+ let t = l?.sections?.flatMap((e) => e?.fields ?? []).filter((e) => Ht(e, a)).map((e) => e.key) ?? [];
829
+ r(Object.fromEntries(Object.entries(e).filter(([e]) => t.includes(e))));
830
+ };
831
+ return /* @__PURE__ */ M("div", {
832
+ ...u,
833
+ className: c,
834
+ children: f ? /* @__PURE__ */ M(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
+ }, Wt = ({ 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: _ } = Ze(e), v = tt(s);
852
+ return m ? /* @__PURE__ */ M("div", {
819
853
  ..._,
820
854
  className: c,
821
- children: /* @__PURE__ */ N(t, {
855
+ children: /* @__PURE__ */ M(t, {
822
856
  fetchedSchema: h,
823
857
  isLoading: g,
824
858
  submitButtonConfig: {
@@ -844,28 +878,28 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
844
878
  onError: p
845
879
  })
846
880
  }) : null;
847
- }, zt = 1400, Bt = 12 * 1024 * 1024, Vt = new Set(["transparent", "rgba(0, 0, 0, 0)"]), Ht = {
881
+ }, Gt = 1400, Kt = 12 * 1024 * 1024, qt = new Set(["transparent", "rgba(0, 0, 0, 0)"]), Jt = {
848
882
  imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",
849
883
  onImageErrorHandler: () => void 0
850
- }, Ut = (e) => {
884
+ }, Yt = (e) => {
851
885
  let t = getComputedStyle(e);
852
- return !Vt.has(t.backgroundColor) || t.backgroundImage !== "none";
853
- }, Wt = (e) => {
886
+ return !qt.has(t.backgroundColor) || t.backgroundImage !== "none";
887
+ }, Xt = (e) => {
854
888
  for (let t = e; t; t = t.parentElement) {
855
889
  let e = getComputedStyle(t).backgroundColor;
856
- if (!Vt.has(e)) return e;
890
+ if (!qt.has(e)) return e;
857
891
  }
858
892
  return "#ffffff";
859
- }, Gt = 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, zt / i)), o = await n(e, {
861
- ...Ht,
893
+ }, Zt = 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, Gt / i)), o = await n(e, {
895
+ ...Jt,
862
896
  pixelRatio: a,
863
- backgroundColor: Wt(e),
897
+ backgroundColor: Xt(e),
864
898
  filter: (e) => !t.includes(e)
865
899
  });
866
- if (o.length > Bt) throw Error("capture too large");
900
+ if (o.length > Kt) throw Error("capture too large");
867
901
  return o;
868
- }, Kt = 4, qt = 4e3, Jt = (e, t) => {
902
+ }, Qt = 4, $t = 4e3, en = (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 Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
876
910
  break;
877
911
  }
878
912
  }
879
- let i = window.innerWidth * window.innerHeight * Kt || 2 ** 53 - 1, a = r;
880
- for (; !Ut(a);) {
913
+ let i = window.innerWidth * window.innerHeight * Qt || 2 ** 53 - 1, a = r;
914
+ for (; !Yt(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 Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
885
919
  a = e;
886
920
  }
887
921
  return a;
888
- }, Yt = async (e, t) => {
889
- let { toCanvas: n } = await import("./es-CK20DkgT.js"), r = Jt(e, t), i = r.getBoundingClientRect(), a = Math.max(e.width, e.height, 1), o = Math.min(2, Math.max(.4, zt / a)), s = Math.max(i.width, i.height, 1);
890
- o = Math.min(o, qt / s);
922
+ }, tn = async (e, t) => {
923
+ let { toCanvas: n } = await import("./es-CK20DkgT.js"), r = en(e, t), i = r.getBoundingClientRect(), a = Math.max(e.width, e.height, 1), o = Math.min(2, Math.max(.4, Gt / a)), s = Math.max(i.width, i.height, 1);
924
+ o = Math.min(o, $t / s);
891
925
  let c = await n(r, {
892
- ...Ht,
926
+ ...Jt,
893
927
  pixelRatio: o,
894
- backgroundColor: Wt(r),
928
+ backgroundColor: Xt(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 Rt = ({ 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 > Bt) throw Error("capture too large");
936
+ if (d.length > Kt) throw Error("capture too large");
903
937
  return d;
904
- }, q = {
938
+ }, nn = {
905
939
  ring: 99997,
906
940
  overlay: 99998,
907
941
  label: 99999
@@ -914,24 +948,24 @@ var Rt = ({ 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
- }, Xt = (e) => Array.from(document.querySelectorAll("[data-tsd-source]")).filter((t) => Y(t) === e), Zt = (e, t) => {
918
- let n = Xt(t).indexOf(e);
951
+ }, rn = (e) => Array.from(document.querySelectorAll("[data-tsd-source]")).filter((t) => Y(t) === e), an = (e, t) => {
952
+ let n = rn(t).indexOf(e);
919
953
  return n < 0 ? 0 : n;
920
- }, X = (e, t = 0) => {
921
- let n = Xt(e);
954
+ }, on = (e, t = 0) => {
955
+ let n = rn(e);
922
956
  return n[t] ?? n[0] ?? null;
923
- }, Qt = (e, t) => {
957
+ }, sn = (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
- }, $t = (e, t) => {
960
+ }, cn = (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
- }, en = (e, t) => {
963
+ }, ln = (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
- }, tn = (e) => {
968
+ }, un = (e) => {
935
969
  let t = e.tagName.toLowerCase();
936
970
  return t === "input" ? {
937
971
  checkbox: "Checkbox",
@@ -973,31 +1007,31 @@ var Rt = ({ 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
- }, nn = 36, rn = (e) => {
977
- let t = tn(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 > nn ? `${n.slice(0, nn - 1).trimEnd()}…` : n}` : t;
979
- }, an = (e) => {
1010
+ }, dn = 36, fn = (e) => {
1011
+ let t = un(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 > dn ? `${n.slice(0, dn - 1).trimEnd()}…` : n}` : t;
1013
+ }, pn = (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
- }, on = () => {
1017
+ }, mn = () => {
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:${nn.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:${nn.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:${nn.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:${nn.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
- }, sn = (e, t, n) => {
1031
+ }, hn = (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 = rn(n), t.style.left = `${Math.max(4, r.left)}px`, t.style.top = `${r.top > 26 ? r.top - 22 : r.bottom + 4}px`;
1000
- }, cn = (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 = fn(n), t.style.left = `${Math.max(4, r.left)}px`, t.style.top = `${r.top > 26 ? r.top - 22 : r.bottom + 4}px`;
1034
+ }, gn = (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 Rt = ({ 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
- }, ln = (e) => {
1044
+ }, _n = (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
- }, un = (e) => {
1048
+ }, vn = (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 Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1019
1053
  (n.textContent ?? "").trim() && (t = !0);
1020
1054
  }
1021
1055
  return t;
1022
- }, dn = 2e3, fn = (e) => {
1056
+ }, yn = 2e3, bn = (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 Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1030
1064
  }), n = n.parentElement;
1031
1065
  }
1032
1066
  return t;
1033
- }, pn = (e) => {
1034
- let t = Y(e), n = t ? Xt(t).length : 1, r = t ? Zt(e, t) : 0, i = t && un(e) ? (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, dn) : void 0, a = mn(e);
1067
+ }, xn = (e) => {
1068
+ let t = Y(e), n = t ? rn(t).length : 1, r = t ? an(e, t) : 0, i = t && vn(e) ? (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, yn) : void 0, a = Sn(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: rn(e),
1040
- path: an(e),
1073
+ label: fn(e),
1074
+ path: pn(e),
1041
1075
  source: t,
1042
1076
  index: r,
1043
1077
  occurrences: n,
1044
- ancestors: fn(e),
1078
+ ancestors: bn(e),
1045
1079
  ...i === void 0 ? {} : { fullText: i },
1046
1080
  ...a ? { sourceBinding: a } : {}
1047
1081
  };
1048
- }, mn = (e) => {
1082
+ }, Sn = (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 Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1058
1092
  raw: n,
1059
1093
  element: {
1060
1094
  source: r ?? "",
1061
- index: r ? Zt(t, r) : 0
1095
+ index: r ? an(t, r) : 0
1062
1096
  },
1063
1097
  ...i === void 0 ? {} : { config: i }
1064
1098
  };
1065
- }, hn = () => Array.from(document.querySelectorAll("[data-levo-source]")).map((e) => {
1099
+ }, Cn = () => 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 Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1073
1107
  raw: t,
1074
1108
  element: {
1075
1109
  source: n ?? "",
1076
- index: n ? Zt(e, n) : 0
1110
+ index: n ? an(e, n) : 0
1077
1111
  },
1078
1112
  tag: e.tagName.toLowerCase(),
1079
- label: rn(e),
1113
+ label: fn(e),
1080
1114
  ...r === void 0 ? {} : { config: r }
1081
1115
  };
1082
- }), gn = 14, _n = 2e3, vn = 100, yn = 48, bn = new Set([
1116
+ }), wn = 14, Tn = 2e3, En = 100, Dn = 48, On = new Set([
1083
1117
  "script",
1084
1118
  "style",
1085
1119
  "template",
1086
1120
  "noscript"
1087
- ]), xn = (e, t) => t.includes(e) || e.id === "studio-staged" || bn.has(e.tagName.toLowerCase()), Sn = (e) => {
1121
+ ]), kn = (e, t) => t.includes(e) || e.id === "studio-staged" || On.has(e.tagName.toLowerCase()), An = (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 Rt = ({ 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 > yn ? `${e.slice(0, yn).trimEnd()}…` : e;
1133
+ if (e) return e.length > Dn ? `${e.slice(0, Dn).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) => !xn(t, e)), d = {
1137
+ let c = Y(i), l = a(i), u = Array.from(i.children).filter((t) => !kn(t, e)), d = {
1104
1138
  tag: i.tagName.toLowerCase(),
1105
1139
  ...c ? {
1106
1140
  source: c,
@@ -1111,9 +1145,9 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1111
1145
  childCount: u.length,
1112
1146
  children: []
1113
1147
  };
1114
- if (s >= gn) return u.length && (t = !0), d;
1148
+ if (s >= wn) return u.length && (t = !0), d;
1115
1149
  for (let e of u) {
1116
- if (d.children.length >= vn || n >= _n) {
1150
+ if (d.children.length >= En || n >= Tn) {
1117
1151
  t = !0;
1118
1152
  break;
1119
1153
  }
@@ -1125,7 +1159,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1125
1159
  tree: o(document.body, 0),
1126
1160
  truncated: t
1127
1161
  };
1128
- }, Cn = () => {
1162
+ }, jn = () => {
1129
1163
  let e = null;
1130
1164
  return {
1131
1165
  send: (t) => {
@@ -1140,7 +1174,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1140
1174
  return !0;
1141
1175
  }
1142
1176
  };
1143
- }, wn = (e) => {
1177
+ }, Mn = (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 Rt = ({ 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
- }, Tn = !1, En = /* @__PURE__ */ new Set(), Dn = () => {
1164
- if (!Tn) {
1165
- Tn = !0;
1166
- for (let e of En) e();
1197
+ }, Nn = !1, Pn = /* @__PURE__ */ new Set(), Fn = () => {
1198
+ if (!Nn) {
1199
+ Nn = !0;
1200
+ for (let e of Pn) e();
1167
1201
  }
1168
- }, On = (e) => (En.add(e), () => {
1169
- En.delete(e);
1170
- }), kn = () => j(On, () => Tn, () => !1), An = (e) => {
1202
+ }, In = (e) => (Pn.add(e), () => {
1203
+ Pn.delete(e);
1204
+ }), Ln = () => ee(In, () => Nn, () => !1), Rn = (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 (Dn(), s.type === "set-access-preview") st(s.stage ?? null);
1209
+ if (Fn(), s.type === "set-access-preview") dt(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 : on(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 Rt = ({ 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 ? on(t, n) : null;
1239
1273
  if (!r) {
1240
1274
  i({
1241
1275
  type: "select-miss",
@@ -1251,10 +1285,10 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1251
1285
  behavior: "smooth"
1252
1286
  }), i({
1253
1287
  type: "element-selected",
1254
- element: pn(r)
1288
+ element: xn(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 ? on(t, n) : null;
1258
1292
  if (!r) {
1259
1293
  i({
1260
1294
  type: "select-miss",
@@ -1270,12 +1304,12 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1270
1304
  behavior: "smooth"
1271
1305
  }), i({
1272
1306
  type: "element-selected",
1273
- element: pn(r)
1307
+ element: xn(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 ? on(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 Rt = ({ 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 } = Sn(e.ownNodes);
1330
+ let { tree: t, truncated: n } = An(e.ownNodes);
1297
1331
  i({
1298
1332
  type: "layers-tree",
1299
1333
  tree: t,
@@ -1301,7 +1335,7 @@ var Rt = ({ 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: hn()
1338
+ sources: Cn()
1305
1339
  });
1306
1340
  else if (s.type === "capture-selected") {
1307
1341
  let t = String(s.requestId || "");
@@ -1316,7 +1350,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1316
1350
  });
1317
1351
  return;
1318
1352
  }
1319
- Gt(n, e.ownNodes).then((e) => {
1353
+ Zt(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 Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1337
1371
  }
1338
1372
  }
1339
1373
  } };
1340
- }, jn = () => {
1374
+ }, zn = () => {
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 Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1357
1391
  return e.delete(t), n;
1358
1392
  }
1359
1393
  };
1360
- }, Mn = 6, Nn = 12, Pn = 12, Fn = .6, In = (e, t, n, r) => ({
1394
+ }, Bn = 6, Vn = 12, Hn = 12, Un = .6, Wn = (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
- }), Ln = (e, t) => {
1399
+ }), Gn = (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 >= Fn && 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 >= Un && 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 > Pn, c = [], l = [];
1376
- for (let e of o.slice(0, Pn)) {
1409
+ }), s = o.length > Hn, c = [], l = [];
1410
+ for (let e of o.slice(0, Hn)) {
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: Zt(e, t),
1416
+ index: an(e, t),
1383
1417
  tag: e.tagName.toLowerCase(),
1384
- label: rn(e),
1418
+ label: fn(e),
1385
1419
  ...n ? { text: n } : {}
1386
1420
  }), l.push(e);
1387
1421
  }
@@ -1390,12 +1424,12 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1390
1424
  nodes: l,
1391
1425
  truncated: s
1392
1426
  };
1393
- }, Rn = () => Array.from({ length: Pn }, () => {
1427
+ }, Kn = () => Array.from({ length: Hn }, () => {
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
- }), zn = () => {
1429
+ return e.style.cssText = `position:fixed;pointer-events:none;z-index:${nn.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
+ }), qn = () => {
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:${nn.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 Rt = ({ 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) < Mn && Math.abs(o - t.y) < Mn) return;
1447
+ if (Math.abs(a - t.x) < Bn && Math.abs(o - t.y) < Bn) return;
1414
1448
  n = !0;
1415
1449
  }
1416
- let s = In(t.x, t.y, a, o);
1450
+ let s = Wn(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 = In(o.x, o.y, r, i);
1423
- return s.width < Nn || s.height < Nn ? null : s;
1456
+ let s = Wn(o.x, o.y, r, i);
1457
+ return s.width < Vn || s.height < Vn ? null : s;
1424
1458
  },
1425
1459
  cancel: () => {
1426
1460
  t = null, n = !1, a();
1427
1461
  },
1428
1462
  isDragging: () => n
1429
1463
  };
1430
- }, Bn = (e) => {
1464
+ }, Jn = (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 = en(t, n);
1471
+ let r = ln(t, n);
1438
1472
  r && e.push(r);
1439
1473
  }
1440
1474
  let t = e.join("\n");
@@ -1442,8 +1476,8 @@ var Rt = ({ 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") Qt(i, e);
1479
+ let i = on(r.source, r.index);
1480
+ if (i) if (r.kind === "style") sn(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 Rt = ({ 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 && $t(i, e), a();
1493
+ let i = on(n.source, n.index);
1494
+ if (n.kind === "style") i && cn(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 Rt = ({ 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
- }, Vn = (e) => {
1523
+ }, Yn = (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 Rt = ({ 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 = Zt(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 = an(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 Rt = ({ 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 ? Xt(r).length : 1
1561
+ occurrences: r ? rn(r).length : 1
1528
1562
  }
1529
1563
  });
1530
1564
  }, m = (e) => {
@@ -1543,16 +1577,16 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1543
1577
  i && f(i);
1544
1578
  }
1545
1579
  };
1546
- }, Hn = "2026-07-24g · element-capture + region-drag + region-highlights (stale-region guard)";
1547
- function Un() {
1548
- return E(() => Wn(), []), null;
1580
+ }, Xn = "2026-07-24g · element-capture + region-drag + region-highlights (stale-region guard)";
1581
+ function Zn() {
1582
+ return E(() => Qn(), []), null;
1549
1583
  }
1550
- function Wn() {
1551
- let e = !1, t = null, n = null, r = !1, i = null, a = jn(), o = Cn(), { overlay: s, label: c, ring: l, ringLabel: u } = on();
1584
+ function Qn() {
1585
+ let e = !1, t = null, n = null, r = !1, i = null, a = zn(), o = jn(), { overlay: s, label: c, ring: l, ringLabel: u } = mn();
1552
1586
  document.body.append(s, c, l, u);
1553
- let d = zn();
1587
+ let d = qn();
1554
1588
  document.body.append(d.node);
1555
- let f = Rn();
1589
+ let f = Kn();
1556
1590
  document.body.append(...f);
1557
1591
  let p = [
1558
1592
  s,
@@ -1582,14 +1616,14 @@ function Wn() {
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) || !un(t) ? null : t;
1586
- }, w = (e) => sn(s, c, e), T = () => {
1619
+ return !t || S(t) || !vn(t) ? null : t;
1620
+ }, w = (e) => hn(s, c, e), T = () => {
1587
1621
  if (n) {
1588
1622
  if (!n.isConnected) {
1589
- P();
1623
+ N();
1590
1624
  return;
1591
1625
  }
1592
- sn(l, u, n);
1626
+ hn(l, u, n);
1593
1627
  }
1594
1628
  }, E = 0, D = () => {
1595
1629
  E || !n || r || (E = requestAnimationFrame(() => {
@@ -1599,46 +1633,46 @@ function Wn() {
1599
1633
  for (let t of e) {
1600
1634
  let e = t.target;
1601
1635
  if (!p.some((t) => t === e) && !(t.type === "attributes" && t.attributeName === "data-staged-key")) {
1602
- D(), R.scheduleReapply();
1636
+ D(), L.scheduleReapply();
1603
1637
  return;
1604
1638
  }
1605
1639
  }
1606
- }), A = !1, j = () => {
1640
+ }), A = !1, ee = () => {
1607
1641
  A ||= (k.observe(document.documentElement, {
1608
1642
  attributes: !0,
1609
1643
  childList: !0,
1610
1644
  characterData: !0,
1611
1645
  subtree: !0
1612
1646
  }), !0);
1613
- }, M = () => {
1647
+ }, j = () => {
1614
1648
  A &&= (k.disconnect(), !1);
1649
+ }, M = () => {
1650
+ O.disconnect(), n?.isConnected && (O.observe(n), ee());
1615
1651
  }, N = () => {
1616
- O.disconnect(), n?.isConnected && (O.observe(n), j());
1617
- }, P = () => {
1618
- n = null, O.disconnect(), z(), E &&= (cancelAnimationFrame(E), 0), l.style.display = "none", u.style.display = "none", y(), g();
1619
- }, F = (e) => w(e), I = () => {
1652
+ n = null, O.disconnect(), R(), E &&= (cancelAnimationFrame(E), 0), l.style.display = "none", u.style.display = "none", y(), g();
1653
+ }, P = (e) => w(e), F = () => {
1620
1654
  s.style.display = "none", c.style.display = "none";
1621
- }, L = Vn({
1655
+ }, I = Yn({
1622
1656
  channel: o,
1623
1657
  originals: a,
1624
1658
  clearTextHover: () => {
1625
- i = null, I();
1659
+ i = null, F();
1626
1660
  }
1627
- }), R = Bn({
1661
+ }), L = Jn({
1628
1662
  originals: a,
1629
- editingNode: L.editingNode
1630
- }), z = () => {
1631
- n?.isConnected || R.count() ? j() : M();
1632
- }, ee = (n) => {
1633
- n && r && te(!1), e = !!n, x(e), e || (t = null, s.style.display = "none", c.style.display = "none", de()), o.send({
1663
+ editingNode: I.editingNode
1664
+ }), R = () => {
1665
+ n?.isConnected || L.count() ? ee() : j();
1666
+ }, te = (n) => {
1667
+ n && r && z(!1), e = !!n, x(e), e || (t = null, s.style.display = "none", c.style.display = "none", H()), o.send({
1634
1668
  type: "inspect-state",
1635
1669
  enabled: e
1636
1670
  });
1637
- }, te = (t) => {
1671
+ }, z = (t) => {
1638
1672
  if (r = !!t, r) {
1639
- e && ee(!1), l.style.display = "none", u.style.display = "none";
1673
+ e && te(!1), l.style.display = "none", u.style.display = "none";
1640
1674
  for (let e of f) e.style.display = "none";
1641
- } else L.commitIfEditing(), I(), document.documentElement.style.cursor = "", n && T(), m.length > 0 && _();
1675
+ } else I.commitIfEditing(), F(), document.documentElement.style.cursor = "", n && T(), m.length > 0 && _();
1642
1676
  o.send({
1643
1677
  type: "text-edit-state",
1644
1678
  enabled: r
@@ -1649,11 +1683,11 @@ function Wn() {
1649
1683
  if (!S(n)) {
1650
1684
  if (r) {
1651
1685
  let e = C(n);
1652
- if (e && e === L.editingNode()) {
1653
- i = null, I(), document.documentElement.style.cursor = "";
1686
+ if (e && e === I.editingNode()) {
1687
+ i = null, F(), document.documentElement.style.cursor = "";
1654
1688
  return;
1655
1689
  }
1656
- i = e, document.documentElement.style.cursor = e ? "text" : "", e ? F(e) : I();
1690
+ i = e, document.documentElement.style.cursor = e ? "text" : "", e ? P(e) : F();
1657
1691
  return;
1658
1692
  }
1659
1693
  e && (d.isDragging() || (t = n, n && w(n)));
@@ -1661,44 +1695,44 @@ function Wn() {
1661
1695
  }, ae = (t) => {
1662
1696
  !e && !r || (B = t.clientX, re = t.clientY, ne ||= requestAnimationFrame(ie));
1663
1697
  }, V = 0, oe = () => {
1664
- V = 0, e && t && w(t), r && !L.editingNode() && i?.isConnected && F(i), n && !r && T(), m.length > 0 && !r && _();
1698
+ V = 0, e && t && w(t), r && !I.editingNode() && i?.isConnected && P(i), n && !r && T(), m.length > 0 && !r && _();
1665
1699
  }, se = () => {
1666
1700
  V ||= requestAnimationFrame(oe);
1667
1701
  }, ce = (n) => {
1668
- n.relatedTarget || (e ? (t = null, s.style.display = "none", c.style.display = "none") : r && !L.editingNode() && (i = null, I(), document.documentElement.style.cursor = ""));
1669
- }, H = !1, le = null, ue = () => {
1670
- if (le != null) {
1702
+ n.relatedTarget || (e ? (t = null, s.style.display = "none", c.style.display = "none") : r && !I.editingNode() && (i = null, F(), document.documentElement.style.cursor = ""));
1703
+ }, le = !1, ue = null, de = () => {
1704
+ if (ue != null) {
1671
1705
  try {
1672
- document.documentElement.releasePointerCapture(le);
1706
+ document.documentElement.releasePointerCapture(ue);
1673
1707
  } catch {}
1674
- le = null;
1708
+ ue = null;
1675
1709
  }
1676
- }, de = () => {
1677
- ue(), d.cancel();
1678
- }, fe = (t) => {
1679
- !e || t.button !== 0 || !t.isPrimary || (H = !1, d.pointerDown(t.clientX, t.clientY));
1680
- }, pe = (n) => {
1710
+ }, H = () => {
1711
+ de(), d.cancel();
1712
+ }, U = (t) => {
1713
+ !e || t.button !== 0 || !t.isPrimary || (le = !1, d.pointerDown(t.clientX, t.clientY));
1714
+ }, W = (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
- le = n.pointerId;
1719
+ ue = 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
- ue();
1728
+ de();
1695
1729
  let n = d.pointerUp();
1696
1730
  if (!n) return;
1697
- H = !0, P();
1698
- let { elements: r, nodes: i, truncated: a } = Ln(n, p);
1731
+ le = !0, N();
1732
+ let { elements: r, nodes: i, truncated: a } = Gn(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
- Yt(n, p).then((e) => {
1735
+ tn(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,57 +1749,57 @@ function Wn() {
1715
1749
  dataUrl: null
1716
1750
  }));
1717
1751
  });
1718
- }, he = () => de(), U = (e) => {
1719
- let t = cn(e.target);
1752
+ }, pe = () => H(), me = (e) => {
1753
+ let t = gn(e.target);
1720
1754
  return t ? (e.preventDefault(), e.stopPropagation(), window.open(t, "_blank", "noopener,noreferrer"), !0) : !1;
1721
- }, ge = (i) => {
1722
- if (H) {
1723
- H = !1, i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1755
+ }, he = (i) => {
1756
+ if (le) {
1757
+ le = !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
- if (!e || e === L.editingNode()) {
1729
- U(i);
1762
+ if (!e || e === I.editingNode()) {
1763
+ me(i);
1730
1764
  return;
1731
1765
  }
1732
- i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation(), L.startEdit(e);
1766
+ i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation(), I.startEdit(e);
1733
1767
  return;
1734
1768
  }
1735
1769
  if (!e) {
1736
- U(i);
1770
+ me(i);
1737
1771
  return;
1738
1772
  }
1739
1773
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1740
1774
  let a = t || i.target;
1741
1775
  if (S(a)) return;
1742
1776
  let s = a.closest("[data-tsd-source]") || a;
1743
- y(), g(), n = s, T(), N(), o.send({
1777
+ y(), g(), n = s, T(), M(), o.send({
1744
1778
  type: "element-selected",
1745
- element: pn(s)
1779
+ element: xn(s)
1746
1780
  });
1747
- }, _e = An({
1781
+ }, ge = Rn({
1748
1782
  channel: o,
1749
1783
  originals: a,
1750
- staged: R,
1751
- setInspect: ee,
1752
- setTextEdit: te,
1784
+ staged: L,
1785
+ setInspect: te,
1786
+ setTextEdit: z,
1753
1787
  isInspecting: () => e,
1754
1788
  isTextEditing: () => r,
1755
- editingNode: L.editingNode,
1789
+ editingNode: I.editingNode,
1756
1790
  setSelected: (e) => {
1757
- y(), g(), n = e, N();
1791
+ y(), g(), n = e, M();
1758
1792
  },
1759
1793
  selectedNode: () => n,
1760
1794
  positionSelected: T,
1761
- clearSelection: P,
1762
- syncDomObserver: z,
1795
+ clearSelection: N,
1796
+ syncDomObserver: R,
1763
1797
  positionHover: w,
1764
- hideTextHover: I,
1765
- startEditAtEnd: (e) => L.startEdit(e, !0),
1798
+ hideTextHover: F,
1799
+ startEditAtEnd: (e) => I.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 Wn() {
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 = wn({ onPathChange: () => {
1797
- P(), xe();
1798
- } }), Ce = (t) => {
1799
- if (L.editingNode()) return;
1830
+ }, xe = Mn({ onPathChange: () => {
1831
+ N(), be();
1832
+ } }), Se = (t) => {
1833
+ if (I.editingNode()) return;
1800
1834
  if (t.key === "Escape") {
1801
1835
  if (e && d.isDragging()) {
1802
- t.stopPropagation(), de();
1836
+ t.stopPropagation(), H();
1803
1837
  return;
1804
1838
  }
1805
- r ? (t.stopPropagation(), te(!1)) : e && (t.stopPropagation(), ee(!1));
1839
+ r ? (t.stopPropagation(), z(!1)) : e && (t.stopPropagation(), te(!1));
1806
1840
  return;
1807
1841
  }
1808
- if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || t.repeat || ln(document.activeElement)) return;
1842
+ if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || t.repeat || _n(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(), te(!e)) : n === "t" && (t.preventDefault(), t.stopPropagation(), z(!r));
1811
1845
  };
1812
- window.addEventListener("mousemove", ae, !0), window.addEventListener("scroll", se, !0), window.addEventListener("resize", be), window.addEventListener("click", ge, !0), window.addEventListener("keydown", Ce, !0), window.addEventListener("message", _e.onMessage), window.addEventListener("mouseout", ce, !0), window.addEventListener("pointerdown", fe, !0), window.addEventListener("pointermove", pe, !0), window.addEventListener("pointerup", me, !0), window.addEventListener("pointercancel", he, !0);
1813
- for (let e of ve) window.addEventListener(e, ye, !0);
1814
- return console.info(`[levo-inspector] build ${Hn} — runtime mounted`), xe(), o.send({ type: "ready" }), () => {
1815
- window.removeEventListener("mousemove", ae, !0), window.removeEventListener("keydown", Ce, !0), window.removeEventListener("scroll", se, !0), window.removeEventListener("resize", be), window.removeEventListener("mouseout", ce, !0), window.removeEventListener("pointerdown", fe, !0), window.removeEventListener("pointermove", pe, !0), window.removeEventListener("pointerup", me, !0), window.removeEventListener("pointercancel", he, !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), ne && cancelAnimationFrame(ne), V && cancelAnimationFrame(V), R.teardown(), Se.teardown(), L.teardown(), document.documentElement.style.cursor = "", b?.remove(), s.remove(), c.remove(), l.remove(), u.remove(), de(), d.node.remove();
1846
+ window.addEventListener("mousemove", ae, !0), window.addEventListener("scroll", se, !0), window.addEventListener("resize", ye), window.addEventListener("click", he, !0), window.addEventListener("keydown", Se, !0), window.addEventListener("message", ge.onMessage), window.addEventListener("mouseout", ce, !0), window.addEventListener("pointerdown", U, !0), window.addEventListener("pointermove", W, !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 ${Xn} — runtime mounted`), be(), o.send({ type: "ready" }), () => {
1849
+ window.removeEventListener("mousemove", ae, !0), window.removeEventListener("keydown", Se, !0), window.removeEventListener("scroll", se, !0), window.removeEventListener("resize", ye), window.removeEventListener("mouseout", ce, !0), window.removeEventListener("pointerdown", U, !0), window.removeEventListener("pointermove", W, !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), ne && cancelAnimationFrame(ne), V && cancelAnimationFrame(V), L.teardown(), xe.teardown(), I.teardown(), document.documentElement.style.cursor = "", b?.remove(), s.remove(), c.remove(), l.remove(), u.remove(), H(), 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 Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,transform 150ms}
1824
- .${Gn}:hover,.${Gn}:focus-visible{opacity:1;transform:translateY(-2px)}`, qn = ({ slug: e }) => {
1857
+ var $n = "levo-made-with", er = `.${$n}{opacity:.2;transition:opacity 150ms,transform 150ms}
1858
+ .${$n}:hover,.${$n}:focus-visible{opacity:1;transform:translateY(-2px)}`, tr = ({ 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
- return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("style", {
1860
+ return /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("style", {
1827
1861
  href: "levo-made-with",
1828
1862
  precedence: "default",
1829
- children: Kn
1830
- }), /* @__PURE__ */ P("a", {
1831
- className: Gn,
1863
+ children: er
1864
+ }), /* @__PURE__ */ N("a", {
1865
+ className: $n,
1832
1866
  href: `https://levo.so/?${t}`,
1833
1867
  target: "_blank",
1834
1868
  rel: "noopener noreferrer",
@@ -1848,7 +1882,7 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1848
1882
  textDecoration: "none",
1849
1883
  boxShadow: "0 4px 12px rgb(0 0 0 / 0.25)"
1850
1884
  },
1851
- children: [/* @__PURE__ */ N("img", {
1885
+ children: [/* @__PURE__ */ M("img", {
1852
1886
  alt: "",
1853
1887
  src: "https://static.levocdn.com/WLZ1TXTD/Levo-Logo-moxa93IxlVi0W.webp",
1854
1888
  width: 20,
@@ -1859,23 +1893,23 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1859
1893
  }
1860
1894
  }), "Made with Levo"]
1861
1895
  })] });
1862
- }, Jn = "levo:page-id", Yn = () => {
1896
+ }, nr = "levo:page-id", rr = () => {
1863
1897
  if (typeof document > "u") return null;
1864
- let e = document.querySelectorAll(`meta[name="${Jn}"]`);
1898
+ let e = document.querySelectorAll(`meta[name="${nr}"]`);
1865
1899
  return e[e.length - 1]?.getAttribute("content")?.trim() || null;
1866
- }, Xn = C(() => import("./dist-DEXGyFeH.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), Zn = ({ siteId: e, pageId: t }) => {
1867
- let n = G(), r = i();
1868
- return !n || !r ? null : /* @__PURE__ */ N(x, {
1900
+ }, ir = C(() => import("./dist-DTszGV-P.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), ar = ({ siteId: e, pageId: t }) => {
1901
+ let n = K(), r = i();
1902
+ return !n || !r ? null : /* @__PURE__ */ M(x, {
1869
1903
  fallback: null,
1870
- children: /* @__PURE__ */ N(Xn, {
1904
+ children: /* @__PURE__ */ M(ir, {
1871
1905
  pageId: t,
1872
1906
  siteId: e
1873
1907
  })
1874
1908
  });
1875
- }, Qn = S(null), $n = Qn.Provider, er = () => T(Qn), tr = () => i(), nr = () => n(), rr = ({ site: e, analytics: t = !0, children: n }) => {
1909
+ }, or = S(null), sr = or.Provider, cr = () => T(or), lr = () => i(), ur = () => n(), dr = ({ site: e, analytics: t = !0, children: n }) => {
1876
1910
  let [i] = A(() => {
1877
1911
  if (!e) return null;
1878
- let n = ke(e), r = Oe(n);
1912
+ let n = Ne(e), r = Me(n);
1879
1913
  return r ? {
1880
1914
  client: r,
1881
1915
  insights: re(r, {
@@ -1884,33 +1918,33 @@ var Gn = "levo-made-with", Kn = `.${Gn}{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 = kn();
1921
+ }), [a, o] = A(null), s = B({ select: (e) => e.location.pathname }), c = Ln();
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 = Yn();
1926
+ let e = rr();
1893
1927
  o(e), i.insights.init({ pageId: e });
1894
- }, [i, s]), i ? /* @__PURE__ */ P(r, {
1928
+ }, [i, s]), i ? /* @__PURE__ */ N(r, {
1895
1929
  client: i.client,
1896
1930
  insights: i.insights,
1897
1931
  children: [
1898
- /* @__PURE__ */ N($n, {
1932
+ /* @__PURE__ */ M(sr, {
1899
1933
  value: i.site,
1900
1934
  children: n
1901
1935
  }),
1902
- !c && /* @__PURE__ */ N(Ot, {
1936
+ !c && /* @__PURE__ */ M(Mt, {
1903
1937
  site: i.site,
1904
1938
  path: s
1905
1939
  }),
1906
- /* @__PURE__ */ N(Zn, {
1940
+ /* @__PURE__ */ M(ar, {
1907
1941
  pageId: a ?? void 0,
1908
1942
  siteId: i.site.id
1909
1943
  }),
1910
- !c && !!i.site.feature_flag?.branding && /* @__PURE__ */ N(qn, { slug: i.site.slug })
1944
+ !c && !!i.site.feature_flag?.branding && /* @__PURE__ */ M(tr, { slug: i.site.slug })
1911
1945
  ]
1912
- }) : /* @__PURE__ */ N(M, { children: n });
1913
- }, ir = (e, t) => {
1946
+ }) : /* @__PURE__ */ M(j, { children: n });
1947
+ }, fr = (e, t) => {
1914
1948
  let n = h(t);
1915
1949
  return ({ location: t }) => {
1916
1950
  if (!e.isLocalized) return;
@@ -1926,7 +1960,7 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1926
1960
  to: r.path
1927
1961
  });
1928
1962
  };
1929
- }, ar = (e) => {
1963
+ }, pr = (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 Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1934
1968
  isLocalized: t.length > 1,
1935
1969
  origin: n ? `https://${n}` : null
1936
1970
  };
1937
- }, or = (e) => e.replace(/\/$/, ""), sr = (e) => {
1938
- let { neutralPath: t, locales: n, activePrefix: r, hasRoute: i } = e, a = or(e.origin), o = `${a}${t}`;
1971
+ }, mr = (e) => e.replace(/\/$/, ""), hr = (e) => {
1972
+ let { neutralPath: t, locales: n, activePrefix: r, hasRoute: i } = e, a = mr(e.origin), o = `${a}${t}`;
1939
1973
  if (n.length <= 1) return [{
1940
1974
  rel: "canonical",
1941
1975
  href: o
@@ -1957,24 +1991,24 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1957
1991
  hrefLang: "x-default",
1958
1992
  href: o
1959
1993
  }), s;
1960
- }, cr = ({ to: e, ...t }) => /* @__PURE__ */ N(ee, {
1994
+ }, gr = ({ to: e, ...t }) => /* @__PURE__ */ M(te, {
1961
1995
  ...t,
1962
1996
  to: e
1963
- }), lr = ({ config: e, routeTree: t }) => {
1997
+ }), _r = ({ config: e, routeTree: t }) => {
1964
1998
  let n = B({ select: (e) => e.location.pathname });
1965
1999
  if (!e.isLocalized || !e.origin) return null;
1966
2000
  let { neutralPath: r } = f(n, e.locales);
1967
- return /* @__PURE__ */ N(M, { children: sr({
2001
+ return /* @__PURE__ */ M(j, { children: hr({
1968
2002
  neutralPath: r,
1969
2003
  origin: e.origin,
1970
2004
  locales: e.locales,
1971
2005
  hasRoute: t ? h(t) : void 0
1972
- }).filter((e) => e.rel === "alternate").map((e) => /* @__PURE__ */ N("link", {
2006
+ }).filter((e) => e.rel === "alternate").map((e) => /* @__PURE__ */ M("link", {
1973
2007
  href: e.href,
1974
2008
  hrefLang: e.hrefLang,
1975
2009
  rel: e.rel
1976
2010
  }, e.hrefLang ?? e.href)) });
1977
- }, ur = S(void 0), dr = ({ children: e, locale: t, locales: n, defaultLocale: r, source: i = "default", hasRoute: a }) => {
2011
+ }, vr = S(void 0), yr = ({ children: e, locale: t, locales: n, defaultLocale: r, source: i = "default", hasRoute: a }) => {
1978
2012
  let o = O(() => {
1979
2013
  let e = n?.length ? n : [t];
1980
2014
  return {
@@ -1998,13 +2032,13 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1998
2032
  i,
1999
2033
  a
2000
2034
  ]);
2001
- return /* @__PURE__ */ N(ur.Provider, {
2035
+ return /* @__PURE__ */ M(vr.Provider, {
2002
2036
  value: o,
2003
2037
  children: e
2004
2038
  });
2005
2039
  };
2006
- function fr() {
2007
- return T(ur) || {
2040
+ function br() {
2041
+ return T(vr) || {
2008
2042
  locale: "en",
2009
2043
  locales: ["en"],
2010
2044
  defaultLocale: "en",
@@ -2014,13 +2048,13 @@ function fr() {
2014
2048
  pathFor: (e) => e
2015
2049
  };
2016
2050
  }
2017
- function pr(e) {
2051
+ function xr(e) {
2018
2052
  let { prefix: t } = f(B({ select: (e) => e.location.pathname }), e.locales);
2019
2053
  return t ?? e.defaultLocale;
2020
2054
  }
2021
- var mr = ({ config: e, children: t, routeTree: n }) => {
2055
+ var Sr = ({ config: e, children: t, routeTree: n }) => {
2022
2056
  let { prefix: r } = f(B({ select: (e) => e.location.pathname }), e.locales);
2023
- return /* @__PURE__ */ N(dr, {
2057
+ return /* @__PURE__ */ M(yr, {
2024
2058
  defaultLocale: e.defaultLocale,
2025
2059
  hasRoute: n ? h(n) : void 0,
2026
2060
  locale: r ?? e.defaultLocale,
@@ -2029,8 +2063,8 @@ var mr = ({ config: e, children: t, routeTree: n }) => {
2029
2063
  children: t
2030
2064
  });
2031
2065
  };
2032
- function hr() {
2033
- let { locale: e, locales: t, isMultiLocale: n, setLocale: r, pathFor: i, hasRoute: a } = fr(), o = B({ select: (e) => e.location.pathname });
2066
+ function Cr() {
2067
+ let { locale: e, locales: t, isMultiLocale: n, setLocale: r, pathFor: i, hasRoute: a } = br(), o = B({ select: (e) => e.location.pathname });
2034
2068
  return O(() => {
2035
2069
  if (!n) return [];
2036
2070
  let { neutralPath: s } = f(o, t), c = t.filter((e) => !a || a(i(s, e)));
@@ -2057,14 +2091,14 @@ function hr() {
2057
2091
  }
2058
2092
  //#endregion
2059
2093
  //#region src/pageHead.tsx
2060
- var gr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), _r = (e) => {
2094
+ var wr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), Tr = (e) => {
2061
2095
  let t = {}, n = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("([^"]*)"|'([^']*)'|[^\s"'>]+))?/g;
2062
2096
  for (let r = n.exec(e); r; r = n.exec(e)) {
2063
2097
  let e = r[1];
2064
2098
  !e || /^on/i.test(e) || (t[e] = r[3] ?? r[4] ?? (r[2] ? r[2] : ""));
2065
2099
  }
2066
2100
  return t;
2067
- }, vr = (e) => {
2101
+ }, Er = (e) => {
2068
2102
  let t = {
2069
2103
  meta: [],
2070
2104
  links: [],
@@ -2072,11 +2106,11 @@ var gr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), _r = (e) => {
2072
2106
  };
2073
2107
  if (!e?.trim()) return t;
2074
2108
  let n = e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi, (e, n, r) => {
2075
- let i = _r(n), a = r.trim();
2109
+ let i = Tr(n), a = r.trim();
2076
2110
  return a && (i.children = a), t.scripts.push(i), "";
2077
2111
  });
2078
- return n = n.replace(/<(meta|link)\b([^>]*?)\/?>/gi, (e, n, r) => ((n.toLowerCase() === "meta" ? t.meta : t.links).push(_r(r)), "")), t;
2079
- }, yr = (e = {}, t = {}) => {
2112
+ return n = n.replace(/<(meta|link)\b([^>]*?)\/?>/gi, (e, n, r) => ((n.toLowerCase() === "meta" ? t.meta : t.links).push(Tr(r)), "")), t;
2113
+ }, Dr = (e = {}, t = {}) => {
2080
2114
  let n = {
2081
2115
  meta: [],
2082
2116
  links: [],
@@ -2138,21 +2172,21 @@ var gr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), _r = (e) => {
2138
2172
  let y = e.ldJson ? Array.isArray(e.ldJson) ? e.ldJson : [e.ldJson] : [];
2139
2173
  for (let e of y) n.scripts.push({
2140
2174
  type: "application/ld+json",
2141
- children: gr(e)
2175
+ children: wr(e)
2142
2176
  });
2143
2177
  for (let r of [t.customHead, e.customHead]) {
2144
2178
  if (!r) continue;
2145
- let e = vr(r);
2179
+ let e = Er(r);
2146
2180
  n.meta.push(...e.meta), n.links.push(...e.links), n.scripts.push(...e.scripts);
2147
2181
  }
2148
2182
  return n;
2149
2183
  };
2150
- function br({ meta: e, site: t }) {
2151
- let n = yr(e, t);
2152
- return /* @__PURE__ */ P(M, { children: [
2153
- n.meta.map((e, t) => e.title === void 0 ? /* @__PURE__ */ N("meta", { ...e }, `m${t}`) : /* @__PURE__ */ N("title", { children: e.title }, `t${t}`)),
2154
- n.links.map((e, t) => /* @__PURE__ */ N("link", { ...e }, `l${t}`)),
2155
- n.scripts.map(({ children: e, ...t }, n) => e === void 0 ? /* @__PURE__ */ N("script", { ...t }, `s${n}`) : /* @__PURE__ */ N("script", {
2184
+ function Or({ meta: e, site: t }) {
2185
+ let n = Dr(e, t);
2186
+ return /* @__PURE__ */ N(j, { children: [
2187
+ n.meta.map((e, t) => e.title === void 0 ? /* @__PURE__ */ M("meta", { ...e }, `m${t}`) : /* @__PURE__ */ M("title", { children: e.title }, `t${t}`)),
2188
+ n.links.map((e, t) => /* @__PURE__ */ M("link", { ...e }, `l${t}`)),
2189
+ n.scripts.map(({ children: e, ...t }, n) => e === void 0 ? /* @__PURE__ */ M("script", { ...t }, `s${n}`) : /* @__PURE__ */ M("script", {
2156
2190
  ...t,
2157
2191
  dangerouslySetInnerHTML: { __html: e }
2158
2192
  }, `s${n}`))
@@ -2160,17 +2194,17 @@ function br({ meta: e, site: t }) {
2160
2194
  }
2161
2195
  //#endregion
2162
2196
  //#region src/registration/ui.tsx
2163
- var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, children: n }) => /* @__PURE__ */ N("div", {
2197
+ var X = (...e) => e.filter(Boolean).join(" "), kr = ({ open: e, className: t, children: n }) => /* @__PURE__ */ M("div", {
2164
2198
  inert: !e,
2165
- 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"),
2166
- children: /* @__PURE__ */ N("div", {
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"),
2200
+ children: /* @__PURE__ */ M("div", {
2167
2201
  className: "overflow-hidden",
2168
- children: /* @__PURE__ */ N("div", {
2202
+ children: /* @__PURE__ */ M("div", {
2169
2203
  className: t,
2170
2204
  children: n
2171
2205
  })
2172
2206
  })
2173
- }), Sr = [
2207
+ }), Ar = [
2174
2208
  {
2175
2209
  key: "email",
2176
2210
  label: "Email",
@@ -2203,7 +2237,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2203
2237
  inputMode: void 0,
2204
2238
  autoComplete: "organization-title"
2205
2239
  }
2206
- ], Cr = [{
2240
+ ], jr = [{
2207
2241
  key: "name",
2208
2242
  label: "Registered company name",
2209
2243
  placeholder: "Acme Corporation",
@@ -2213,7 +2247,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2213
2247
  label: "Tax ID / GST number",
2214
2248
  placeholder: "22AAAAA0000A1Z5",
2215
2249
  autoComplete: "off"
2216
- }], wr = [
2250
+ }], Mr = [
2217
2251
  {
2218
2252
  key: "line1",
2219
2253
  label: "Billing address",
@@ -2262,167 +2296,251 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2262
2296
  wide: !1,
2263
2297
  optional: !1
2264
2298
  }
2265
- ], Tr = (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"), Er = "flex items-baseline gap-1.5 font-medium text-ink text-sm", Dr = () => /* @__PURE__ */ N("span", {
2299
+ ], Nr = (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"), Pr = "flex items-baseline gap-1.5 font-medium text-ink text-sm", Fr = () => /* @__PURE__ */ M("span", {
2266
2300
  "aria-hidden": !0,
2267
2301
  className: "text-danger",
2268
2302
  children: "*"
2269
- }), Or = ({ values: e, errors: t, touched: n, onChange: r, onBlur: i, showBusinessBilling: a = !1, registrationFields: o, nameInputRef: s }) => {
2270
- let c = (t, n) => r("billing_details", {
2271
- ...e.billing_details,
2272
- [t]: n
2273
- }), l = (t, n) => r("billing_details", {
2274
- ...e.billing_details,
2275
- address: {
2276
- ...e.billing_details.address,
2277
- [t]: n
2278
- }
2279
- }), u = !!e.billing_details.name.trim() || !!e.billing_details.tax_id.trim() || Object.values(e.billing_details.address).some((e) => !!e.trim());
2280
- return /* @__PURE__ */ P("div", {
2281
- className: "flex flex-col gap-4",
2282
- children: [
2283
- /* @__PURE__ */ P("div", {
2303
+ }), Ir = ({ 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__ */ N("div", {
2304
+ className: "flex flex-col gap-4",
2305
+ children: [
2306
+ /* @__PURE__ */ N("div", {
2307
+ className: "flex flex-col gap-1.5",
2308
+ children: [
2309
+ /* @__PURE__ */ N("label", {
2310
+ htmlFor: `${c}-name`,
2311
+ className: Pr,
2312
+ children: [l, /* @__PURE__ */ M(Fr, {})]
2313
+ }),
2314
+ /* @__PURE__ */ M("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: Nr(n.name && !!t.name),
2325
+ required: !0
2326
+ }),
2327
+ n.name && t.name && /* @__PURE__ */ M("p", {
2328
+ className: "m-0 text-danger text-xs",
2329
+ children: t.name
2330
+ })
2331
+ ]
2332
+ }),
2333
+ Ar.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__ */ N("div", {
2284
2338
  className: "flex flex-col gap-1.5",
2285
2339
  children: [
2286
- /* @__PURE__ */ P("label", {
2287
- htmlFor: "attendee-name",
2288
- className: Er,
2289
- children: ["Your name", /* @__PURE__ */ N(Dr, {})]
2340
+ /* @__PURE__ */ N("label", {
2341
+ htmlFor: `${c}-${a.key}`,
2342
+ className: Pr,
2343
+ children: [a.label, s === "required" ? /* @__PURE__ */ M(Fr, {}) : /* @__PURE__ */ M("span", {
2344
+ className: "font-normal text-ink-muted text-xs",
2345
+ children: "Optional"
2346
+ })]
2290
2347
  }),
2291
- /* @__PURE__ */ N("input", {
2292
- ref: s,
2293
- id: "attendee-name",
2294
- name: "name",
2295
- type: "text",
2296
- autoComplete: "name",
2297
- placeholder: "John Doe",
2298
- value: e.name,
2299
- onChange: (e) => r("name", e.target.value),
2300
- onBlur: () => i("name"),
2301
- className: Tr(n.name && !!t.name),
2302
- required: !0
2348
+ /* @__PURE__ */ M("input", {
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: Nr(!!l),
2362
+ required: s === "required"
2303
2363
  }),
2304
- n.name && t.name && /* @__PURE__ */ N("p", {
2364
+ l && /* @__PURE__ */ M("p", {
2305
2365
  className: "m-0 text-danger text-xs",
2306
- children: t.name
2366
+ children: l
2307
2367
  })
2308
2368
  ]
2369
+ }, a.key);
2370
+ }),
2371
+ a && /* @__PURE__ */ M(Lr, {
2372
+ values: e,
2373
+ onChange: r
2374
+ })
2375
+ ]
2376
+ }), Lr = ({ 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__ */ N("div", {
2388
+ className: "rounded-xl border border-border bg-ink/3",
2389
+ children: [
2390
+ /* @__PURE__ */ N("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__ */ M("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__ */ M("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."
2309
2405
  }),
2310
- Sr.map((a) => {
2311
- let s = o[a.key];
2312
- if (s === "off") return null;
2313
- let c = n[a.key] ? t[a.key] : void 0, l = a.key === "email" || a.key === "mobile";
2314
- return /* @__PURE__ */ P("div", {
2315
- className: "flex flex-col gap-1.5",
2406
+ /* @__PURE__ */ M(kr, {
2407
+ open: e.is_business_purchase,
2408
+ className: "px-3.5 pb-3.5",
2409
+ children: /* @__PURE__ */ N("div", {
2410
+ className: "flex flex-col gap-3",
2316
2411
  children: [
2317
- /* @__PURE__ */ P("label", {
2318
- htmlFor: `attendee-${a.key}`,
2319
- className: Er,
2320
- children: [a.label, s === "required" ? /* @__PURE__ */ N(Dr, {}) : /* @__PURE__ */ N("span", {
2321
- className: "font-normal text-ink-muted text-xs",
2322
- children: "Optional"
2323
- })]
2324
- }),
2325
- /* @__PURE__ */ N("input", {
2326
- id: `attendee-${a.key}`,
2327
- name: a.key,
2328
- type: a.type,
2329
- inputMode: a.inputMode,
2330
- autoComplete: a.autoComplete,
2331
- autoCapitalize: l ? "none" : void 0,
2332
- autoCorrect: l ? "off" : void 0,
2333
- spellCheck: l ? !1 : void 0,
2334
- placeholder: a.placeholder,
2335
- value: e[a.key],
2336
- onChange: (e) => r(a.key, e.target.value),
2337
- onBlur: () => i(a.key),
2338
- className: Tr(!!c),
2339
- required: s === "required"
2412
+ /* @__PURE__ */ M("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."
2340
2415
  }),
2341
- c && /* @__PURE__ */ N("p", {
2342
- className: "m-0 text-danger text-xs",
2343
- children: c
2416
+ jr.map((t) => /* @__PURE__ */ N("div", {
2417
+ className: "flex flex-col gap-1.5",
2418
+ children: [/* @__PURE__ */ N("label", {
2419
+ htmlFor: `billing-${t.key}`,
2420
+ className: Pr,
2421
+ children: [t.label, /* @__PURE__ */ M(Fr, {})]
2422
+ }), /* @__PURE__ */ M("input", {
2423
+ id: `billing-${t.key}`,
2424
+ className: Nr(),
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__ */ M("div", {
2433
+ className: "grid grid-cols-2 gap-3",
2434
+ children: Mr.map((t) => /* @__PURE__ */ N("div", {
2435
+ className: X("flex flex-col gap-1.5", t.wide && "col-span-2"),
2436
+ children: [/* @__PURE__ */ N("label", {
2437
+ htmlFor: `billing-${t.key}`,
2438
+ className: Pr,
2439
+ children: [t.label, !t.optional && /* @__PURE__ */ M(Fr, {})]
2440
+ }), /* @__PURE__ */ M("input", {
2441
+ id: `billing-${t.key}`,
2442
+ className: Nr(),
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))
2344
2451
  })
2345
2452
  ]
2346
- }, a.key);
2347
- }),
2348
- a && /* @__PURE__ */ P("div", {
2349
- className: "rounded-xl border border-border bg-ink/3",
2350
- children: [
2351
- /* @__PURE__ */ P("label", {
2352
- htmlFor: "is_business_purchase",
2353
- className: "flex w-full cursor-pointer items-center gap-2.5 px-3.5 py-3 text-ink text-sm",
2354
- children: [/* @__PURE__ */ N("input", {
2355
- id: "is_business_purchase",
2356
- type: "checkbox",
2357
- checked: e.is_business_purchase,
2358
- onChange: (e) => r("is_business_purchase", e.target.checked),
2359
- "aria-expanded": e.is_business_purchase,
2360
- className: "size-4 shrink-0 cursor-pointer rounded accent-brand"
2361
- }), "Bill this to a business — I need a GST invoice"]
2362
- }),
2363
- !e.is_business_purchase && u && /* @__PURE__ */ N("p", {
2364
- 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",
2365
- children: "Your billing details are still saved — tick the box to apply them."
2366
- }),
2367
- /* @__PURE__ */ N(xr, {
2368
- open: e.is_business_purchase,
2369
- className: "px-3.5 pb-3.5",
2370
- children: /* @__PURE__ */ P("div", {
2371
- className: "flex flex-col gap-3",
2453
+ })
2454
+ })
2455
+ ]
2456
+ });
2457
+ }, Rr = ({ 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__ */ M(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__ */ N("section", {
2475
+ className: "flex flex-col gap-2",
2476
+ children: [/* @__PURE__ */ N("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__ */ N("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__ */ N(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__ */ M(U.Header, {
2488
+ className: "m-0",
2489
+ children: /* @__PURE__ */ N(U.Trigger, {
2490
+ className: "group flex w-full items-center gap-3 px-3.5 py-3 text-left",
2372
2491
  children: [
2373
- /* @__PURE__ */ N("p", {
2374
- className: "m-0 text-ink-muted text-xs leading-relaxed",
2375
- children: "This booking will be billed to your business. The invoice is raised against the details below."
2492
+ /* @__PURE__ */ M("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__ */ M(V, { className: "size-3.5" }) : i + 1
2376
2496
  }),
2377
- Cr.map((t) => /* @__PURE__ */ P("div", {
2378
- className: "flex flex-col gap-1.5",
2379
- children: [/* @__PURE__ */ P("label", {
2380
- htmlFor: `billing-${t.key}`,
2381
- className: Er,
2382
- children: [t.label, /* @__PURE__ */ N(Dr, {})]
2383
- }), /* @__PURE__ */ N("input", {
2384
- id: `billing-${t.key}`,
2385
- className: Tr(),
2386
- placeholder: t.placeholder,
2387
- autoComplete: t.autoComplete,
2388
- value: e.billing_details[t.key],
2389
- onChange: (e) => c(t.key, e.target.value),
2390
- required: e.is_business_purchase
2497
+ /* @__PURE__ */ N("span", {
2498
+ className: "min-w-0 flex-1",
2499
+ children: [/* @__PURE__ */ N("span", {
2500
+ className: "block font-medium text-[14.5px] text-ink",
2501
+ children: ["Attendee ", i + 1]
2502
+ }), !o && /* @__PURE__ */ M("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")
2391
2505
  })]
2392
- }, t.key)),
2393
- /* @__PURE__ */ N("div", {
2394
- className: "grid grid-cols-2 gap-3",
2395
- children: wr.map((t) => /* @__PURE__ */ P("div", {
2396
- className: Z("flex flex-col gap-1.5", t.wide && "col-span-2"),
2397
- children: [/* @__PURE__ */ P("label", {
2398
- htmlFor: `billing-${t.key}`,
2399
- className: Er,
2400
- children: [t.label, !t.optional && /* @__PURE__ */ N(Dr, {})]
2401
- }), /* @__PURE__ */ N("input", {
2402
- id: `billing-${t.key}`,
2403
- className: Tr(),
2404
- placeholder: t.placeholder,
2405
- autoComplete: t.autoComplete,
2406
- inputMode: t.key === "postal_code" ? "numeric" : void 0,
2407
- value: e.billing_details.address[t.key],
2408
- onChange: (e) => l(t.key, e.target.value),
2409
- required: e.is_business_purchase && !t.optional
2410
- })]
2411
- }, t.key))
2506
+ }),
2507
+ /* @__PURE__ */ M(oe, {
2508
+ "aria-hidden": !0,
2509
+ className: "size-4 shrink-0 text-ink-muted transition-transform group-data-[panel-open]:rotate-180"
2412
2510
  })
2413
2511
  ]
2414
2512
  })
2415
- })
2416
- ]
2417
- })
2418
- ]
2513
+ }), /* @__PURE__ */ M(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__ */ N("div", {
2516
+ className: "flex flex-col gap-4 px-3.5 pb-3.5",
2517
+ children: [/* @__PURE__ */ M(Ir, {
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__ */ M("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))
2419
2537
  });
2420
- }, kr = {
2538
+ }, zr = {
2421
2539
  USD: "$",
2422
2540
  EUR: "€",
2423
2541
  GBP: "£",
2424
2542
  INR: "₹"
2425
- }, Q = (e) => {
2543
+ }, Z = (e) => {
2426
2544
  let t = e?.unit_amount;
2427
2545
  if (t == null) return "";
2428
2546
  if (t === 0) return "Free";
@@ -2435,112 +2553,279 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2435
2553
  maximumFractionDigits: 2
2436
2554
  }).format(r);
2437
2555
  } catch {
2438
- return `${kr[n] ?? n} ${r.toLocaleString()}`;
2556
+ return `${zr[n] ?? n} ${r.toLocaleString()}`;
2439
2557
  }
2440
- }, Ar = (e) => !e.tax_enabled || !e.taxes?.length ? null : e.tax_inclusive ? "incl. taxes" : "+ taxes", jr = (e) => !!e?.taxes?.length && e.tax_amount !== void 0, Mr = (e) => !!e && "subtotal" in e && e.tax_enabled === !0 && !!e.taxes?.length, Nr = (e, t) => t ? t.total_amount ?? t.sale_amount ?? 0 : Mr(e) ? e.total ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Pr = (e, t) => {
2558
+ }, Br = (e) => !e.tax_enabled || !e.taxes?.length ? null : e.tax_inclusive ? "incl. taxes" : "+ taxes", Vr = (e) => !!e?.taxes?.length && e.tax_amount !== void 0, Hr = (e) => !!e && "subtotal" in e && e.tax_enabled === !0 && !!e.taxes?.length, Ur = (e, t) => t ? t.total_amount ?? t.sale_amount ?? 0 : Hr(e) ? e.total ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Wr = (e, t) => {
2441
2559
  if (!e) return null;
2442
- let n = Nr(e, t);
2560
+ let n = Ur(e, t);
2443
2561
  return {
2444
2562
  amount: n,
2445
2563
  currency: e.currency,
2446
2564
  isFree: n === 0
2447
2565
  };
2448
- }, Fr = (e, t) => t ? t.base_amount ?? 0 : Mr(e) ? e.subtotal ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Ir = (e, t) => jr(t) ? t.taxes : !t && Mr(e) ? e.taxes : [], Lr = (e, t) => !t || e.tickets.length === 0 ? !0 : e.tickets.some((e) => typeof e == "string" ? e === t : e._id === t), Rr = (e) => e.kind === "percent" ? `${e.percent_off}% off` : `${kr[e.currency ?? "INR"] ?? ""}${(e.amount_off ?? 0) / 100} off`, zr = ({ couponCode: e, onCouponCodeChange: t, couponError: n, couponLoading: r, onValidateCoupon: i, onRemoveCoupon: a, publicCoupons: o, discount: s, selectedTicket: c }) => {
2449
- let [l, u] = A(!1);
2450
- if (s) return /* @__PURE__ */ P("div", {
2451
- 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",
2452
- children: [/* @__PURE__ */ P("span", {
2453
- className: "min-w-0",
2454
- children: [/* @__PURE__ */ N("span", {
2455
- className: "font-semibold tracking-wide",
2456
- children: e
2457
- }), /* @__PURE__ */ P("span", {
2458
- className: "ml-2 text-emerald-700 dark:text-emerald-400",
2459
- children: [
2460
- "saves",
2461
- " ",
2462
- Q({
2463
- unit_amount: s.discount,
2464
- currency: c?.currency
2465
- })
2466
- ]
2566
+ }, Gr = (e, t) => t ? t.base_amount ?? 0 : Hr(e) ? e.subtotal ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Kr = (e, t) => Vr(t) ? t.taxes : !t && Hr(e) ? e.taxes : [], qr = ({ ticket: e, count: t }) => Ur(e, null) * t, Jr = (e, t) => {
2567
+ if (e.length === 0) return null;
2568
+ let n = t ? Ur(null, t) : e.reduce((e, t) => e + qr(t), 0);
2569
+ return {
2570
+ amount: n,
2571
+ currency: e[0]?.ticket.currency,
2572
+ isFree: n === 0
2573
+ };
2574
+ }, Yr = ({ lines: e, discount: t, pricing: n }) => {
2575
+ let r = n?.currency, i = e.some((e) => Br(e.ticket));
2576
+ return /* @__PURE__ */ N("div", {
2577
+ className: "rounded-xl border border-border bg-ink/3 px-3.5 py-3",
2578
+ children: [/* @__PURE__ */ N("div", {
2579
+ className: "flex flex-col gap-1.5 text-[13.5px] text-ink-soft",
2580
+ children: [
2581
+ e.map((e) => /* @__PURE__ */ N("div", {
2582
+ className: "flex items-baseline justify-between gap-3",
2583
+ children: [/* @__PURE__ */ N("span", {
2584
+ className: "min-w-0 [overflow-wrap:anywhere]",
2585
+ children: [
2586
+ /* @__PURE__ */ N("span", {
2587
+ className: "text-ink tabular-nums",
2588
+ children: [e.count, " ×"]
2589
+ }),
2590
+ " ",
2591
+ e.ticket.title
2592
+ ]
2593
+ }), /* @__PURE__ */ M("span", {
2594
+ className: "shrink-0 tabular-nums",
2595
+ children: Z({
2596
+ unit_amount: qr(e),
2597
+ currency: r
2598
+ })
2599
+ })]
2600
+ }, e.ticket._id)),
2601
+ t && t.discount > 0 && /* @__PURE__ */ N("div", {
2602
+ className: "flex items-center justify-between gap-3 text-emerald-700 dark:text-emerald-400",
2603
+ children: [/* @__PURE__ */ M("span", { children: "Discount" }), /* @__PURE__ */ N("span", {
2604
+ className: "tabular-nums",
2605
+ children: ["-", Z({
2606
+ unit_amount: t.discount,
2607
+ currency: r
2608
+ })]
2609
+ })]
2610
+ }),
2611
+ i && /* @__PURE__ */ M("p", {
2612
+ className: "m-0 text-ink-muted text-xs",
2613
+ children: "Prices include applicable taxes"
2614
+ })
2615
+ ]
2616
+ }), /* @__PURE__ */ N("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__ */ M("span", { children: "Total" }), /* @__PURE__ */ M("span", {
2619
+ className: "tabular-nums",
2620
+ children: Z({
2621
+ unit_amount: n?.amount,
2622
+ currency: r
2623
+ })
2467
2624
  })]
2468
- }), /* @__PURE__ */ N("button", {
2469
- type: "button",
2470
- onClick: () => {
2471
- a(), u(!1);
2472
- },
2473
- "aria-label": "Remove coupon",
2474
- className: "inline-flex shrink-0 rounded-md p-1 hover:bg-emerald-600/15",
2475
- children: /* @__PURE__ */ N(ce, { className: "size-4" })
2476
2625
  })]
2477
2626
  });
2478
- let d = o.filter((e) => Lr(e, c?._id));
2479
- return /* @__PURE__ */ P("div", {
2627
+ }, Xr = ({ payment: e, label: t, isPaid: n, blockedReason: r }) => {
2628
+ let { state: i } = e, a = i.kind === "busy";
2629
+ return /* @__PURE__ */ N(j, { children: [
2630
+ (i.kind === "unpaid" || i.kind === "failed") && /* @__PURE__ */ N("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__ */ M("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__ */ N("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__ */ M(ce, { className: "size-4 animate-spin" }), a && i.stage === "paying" ? "Opening secure checkout" : t]
2645
+ }),
2646
+ /* @__PURE__ */ M("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
+ }, Zr = (e) => {
2652
+ if (e.kind !== "percent") return "Flat discount";
2653
+ let t = e.max_amount_off ? `, up to ${Z({
2654
+ unit_amount: e.max_amount_off,
2655
+ currency: e.currency
2656
+ })}` : "";
2657
+ return `${e.percent_off}% off${t}`;
2658
+ }, Qr = ({ applied: e, pending: t, couponError: n, onValidateCoupon: r, onRemoveCoupon: i, offers: a, currency: o }) => {
2659
+ let [s, c] = A(!1), [l, u] = A(""), [d, f] = A(!1), p = async (e) => {
2660
+ await r(e) && (u(""), c(!1));
2661
+ }, m = () => {
2662
+ l.trim() && p(l);
2663
+ }, h = e ? a.filter((t) => t.coupon.code !== e.code) : a, g = h.length > 0 && /* @__PURE__ */ M("ul", {
2664
+ className: "m-0 flex list-none flex-col gap-2 p-0",
2665
+ children: h.map(({ coupon: n, saving: r }, i) => {
2666
+ let s = t?.code === n.code;
2667
+ return /* @__PURE__ */ N("li", {
2668
+ className: "flex items-center gap-3 rounded-xl border border-border border-dashed px-3.5 py-2.5",
2669
+ children: [/* @__PURE__ */ N("div", {
2670
+ className: "flex min-w-0 flex-1 flex-col gap-0.5",
2671
+ children: [
2672
+ /* @__PURE__ */ N("div", {
2673
+ className: "flex items-center gap-2",
2674
+ children: [/* @__PURE__ */ M("span", {
2675
+ className: "truncate font-medium font-mono text-ink text-xs tracking-wide",
2676
+ children: n.code
2677
+ }), !e && i === 0 && a.length > 1 && /* @__PURE__ */ M("span", {
2678
+ className: "shrink-0 rounded-full bg-emerald-500/10 px-1.5 py-px font-medium text-[11px] text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400",
2679
+ children: "Best"
2680
+ })]
2681
+ }),
2682
+ /* @__PURE__ */ N("span", {
2683
+ className: "text-[13px] text-ink",
2684
+ children: [/* @__PURE__ */ N("span", {
2685
+ className: "font-semibold",
2686
+ children: ["Save ", Z({
2687
+ unit_amount: r,
2688
+ currency: o
2689
+ })]
2690
+ }), /* @__PURE__ */ N("span", {
2691
+ className: "text-ink-muted",
2692
+ children: [" · ", Zr(n)]
2693
+ })]
2694
+ }),
2695
+ n.description && /* @__PURE__ */ M("span", {
2696
+ className: "truncate text-ink-muted text-xs",
2697
+ title: n.description,
2698
+ children: n.description
2699
+ })
2700
+ ]
2701
+ }), /* @__PURE__ */ N("button", {
2702
+ type: "button",
2703
+ disabled: !!t,
2704
+ onClick: () => void p(n.code),
2705
+ "aria-label": `${e ? "Switch to" : "Apply"} ${n.code}`,
2706
+ className: "inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 font-medium text-ink text-sm transition hover:border-brand disabled:opacity-50",
2707
+ children: [s && /* @__PURE__ */ M(ce, { className: "size-3.5 animate-spin" }), e ? "Switch" : "Apply"]
2708
+ })]
2709
+ }, n._id);
2710
+ })
2711
+ }), _ = n && /* @__PURE__ */ M("p", {
2712
+ className: "m-0 text-danger text-xs",
2713
+ children: n
2714
+ }), v = "inline-flex items-center gap-1 self-start text-[13px] text-ink-soft underline underline-offset-[3px] hover:text-ink", y = /* @__PURE__ */ M("button", {
2715
+ type: "button",
2716
+ "aria-expanded": s,
2717
+ onClick: () => c((e) => !e),
2718
+ className: v,
2719
+ children: e || g ? "Have a different code?" : "Have a code?"
2720
+ }), b = /* @__PURE__ */ M(kr, {
2721
+ open: s,
2722
+ children: /* @__PURE__ */ N("div", {
2723
+ className: "flex gap-2 pt-2",
2724
+ children: [/* @__PURE__ */ M("input", {
2725
+ type: "text",
2726
+ value: l,
2727
+ placeholder: "Coupon code",
2728
+ "aria-label": "Coupon code",
2729
+ autoCapitalize: "characters",
2730
+ autoCorrect: "off",
2731
+ spellCheck: !1,
2732
+ onChange: (e) => u(e.target.value),
2733
+ onKeyDown: (e) => {
2734
+ e.key === "Enter" && (e.preventDefault(), m());
2735
+ },
2736
+ 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")
2737
+ }), /* @__PURE__ */ N("button", {
2738
+ type: "button",
2739
+ disabled: !l.trim() || !!t,
2740
+ onClick: m,
2741
+ className: "inline-flex shrink-0 items-center gap-1.5 rounded-xl border border-border px-4 font-medium text-ink text-sm transition hover:border-brand disabled:opacity-50",
2742
+ children: [t?.code === l.trim().toUpperCase() && /* @__PURE__ */ M(ce, { className: "size-3.5 animate-spin" }), "Apply"]
2743
+ })]
2744
+ })
2745
+ });
2746
+ return e ? /* @__PURE__ */ N("div", {
2480
2747
  className: "flex flex-col",
2481
- children: [/* @__PURE__ */ N("button", {
2482
- type: "button",
2483
- "aria-expanded": l,
2484
- onClick: () => u((e) => !e),
2485
- className: "self-start text-[13px] text-ink-soft underline underline-offset-[3px] hover:text-ink",
2486
- children: "Have a code?"
2487
- }), /* @__PURE__ */ N(xr, {
2488
- open: l,
2489
- children: /* @__PURE__ */ P("div", {
2490
- className: "flex flex-col gap-2 pt-2",
2491
- children: [
2492
- /* @__PURE__ */ P("div", {
2493
- className: "flex gap-2",
2494
- children: [/* @__PURE__ */ N("input", {
2495
- type: "text",
2496
- value: e,
2497
- placeholder: "Coupon code",
2498
- "aria-label": "Coupon code",
2499
- autoCapitalize: "characters",
2500
- autoCorrect: "off",
2501
- spellCheck: !1,
2502
- onChange: (e) => t(e.target.value),
2503
- onKeyDown: (t) => {
2504
- t.key === "Enter" && (t.preventDefault(), e.trim() && i());
2505
- },
2506
- 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")
2507
- }), /* @__PURE__ */ P("button", {
2508
- type: "button",
2509
- disabled: !e.trim() || r,
2510
- onClick: () => i(),
2511
- className: "inline-flex shrink-0 items-center gap-1.5 rounded-xl border border-border px-4 font-medium text-ink text-sm transition hover:border-brand disabled:opacity-50",
2512
- children: [r && /* @__PURE__ */ N(se, { className: "size-3.5 animate-spin" }), "Apply"]
2513
- })]
2514
- }),
2515
- n && /* @__PURE__ */ N("p", {
2516
- className: "m-0 text-danger text-xs",
2517
- children: n
2518
- }),
2519
- d.length > 0 && /* @__PURE__ */ N("div", {
2520
- className: "flex flex-wrap gap-1.5",
2521
- children: d.map((e) => /* @__PURE__ */ P("button", {
2522
- type: "button",
2523
- onClick: () => {
2524
- t(e.code), i(e.code);
2525
- },
2526
- title: e.description || void 0,
2527
- className: "rounded-full border border-border border-dashed px-2.5 py-1 text-[12.5px] text-ink-soft transition hover:border-brand hover:text-ink",
2748
+ children: [
2749
+ /* @__PURE__ */ N("div", {
2750
+ 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",
2751
+ children: [/* @__PURE__ */ N("span", {
2752
+ className: "flex min-w-0 items-center gap-2",
2753
+ children: [/* @__PURE__ */ M(de, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ N("span", {
2754
+ className: "min-w-0",
2755
+ children: [/* @__PURE__ */ M("span", {
2756
+ className: "font-semibold tracking-wide",
2757
+ children: e.code
2758
+ }), /* @__PURE__ */ N("span", {
2759
+ className: "ml-2 text-emerald-700 dark:text-emerald-400",
2528
2760
  children: [
2529
- e.code,
2530
- " · ",
2531
- Rr(e)
2761
+ "applied · you save",
2762
+ " ",
2763
+ Z({
2764
+ unit_amount: e.discount.discount,
2765
+ currency: o
2766
+ })
2532
2767
  ]
2533
- }, e._id))
2534
- })
2535
- ]
2768
+ })]
2769
+ })]
2770
+ }), /* @__PURE__ */ M("button", {
2771
+ type: "button",
2772
+ onClick: () => {
2773
+ i(), f(!1);
2774
+ },
2775
+ "aria-label": "Remove coupon",
2776
+ className: "inline-flex shrink-0 rounded-md p-1 hover:bg-emerald-600/15",
2777
+ children: /* @__PURE__ */ M(H, { className: "size-4" })
2778
+ })]
2779
+ }),
2780
+ /* @__PURE__ */ N("div", {
2781
+ className: "mt-2 flex flex-wrap gap-x-4 gap-y-1",
2782
+ children: [h.length > 0 && /* @__PURE__ */ N("button", {
2783
+ type: "button",
2784
+ "aria-expanded": d,
2785
+ onClick: () => f((e) => !e),
2786
+ className: v,
2787
+ children: [h.length === 1 ? "1 more offer" : `${h.length} more offers`, /* @__PURE__ */ M(oe, { className: X("size-3.5 transition-transform", d && "rotate-180") })]
2788
+ }), y]
2789
+ }),
2790
+ /* @__PURE__ */ M(kr, {
2791
+ open: d,
2792
+ children: /* @__PURE__ */ M("div", {
2793
+ className: "pt-2",
2794
+ children: g
2795
+ })
2796
+ }),
2797
+ b,
2798
+ _ && /* @__PURE__ */ M("div", {
2799
+ className: "pt-2",
2800
+ children: _
2536
2801
  })
2537
- })]
2802
+ ]
2803
+ }) : t?.auto ? /* @__PURE__ */ N("p", {
2804
+ className: "m-0 inline-flex items-center gap-2 rounded-xl border border-border border-dashed px-3.5 py-2.5 text-[13px] text-ink-muted",
2805
+ children: [/* @__PURE__ */ M(ce, { className: "size-3.5 animate-spin" }), "Finding your best offer…"]
2806
+ }) : /* @__PURE__ */ N("div", {
2807
+ className: "flex flex-col",
2808
+ children: [
2809
+ g && /* @__PURE__ */ N("div", {
2810
+ className: "mb-2 flex flex-col gap-2",
2811
+ children: [/* @__PURE__ */ M("span", {
2812
+ className: "font-medium text-ink text-sm",
2813
+ children: h.length === 1 ? "Offer for you" : "Offers for you"
2814
+ }), g]
2815
+ }),
2816
+ y,
2817
+ b,
2818
+ _ && /* @__PURE__ */ M("div", {
2819
+ className: "pt-2",
2820
+ children: _
2821
+ })
2822
+ ]
2538
2823
  });
2539
- }, Br = (e) => {
2824
+ }, $r = (e) => {
2540
2825
  if (e < 60) return `${e} min`;
2541
2826
  let t = Math.floor(e / 60), n = e % 60, r = `${t} hr`;
2542
2827
  return n ? `${r} ${n} min` : r;
2543
- }, Vr = (e, t) => {
2828
+ }, ei = (e, t) => {
2544
2829
  if (!e) return null;
2545
2830
  let n = new Date(e);
2546
2831
  if (Number.isNaN(n.getTime())) return null;
@@ -2555,26 +2840,26 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2555
2840
  }).format(n), a = null;
2556
2841
  if (t) {
2557
2842
  let e = new Date(t), r = Math.round((e.getTime() - n.getTime()) / 6e4);
2558
- !Number.isNaN(r) && r > 0 && (a = Br(r));
2843
+ !Number.isNaN(r) && r > 0 && (a = $r(r));
2559
2844
  }
2560
2845
  return {
2561
2846
  day: r,
2562
2847
  time: i,
2563
2848
  duration: a
2564
2849
  };
2565
- }, Hr = 60, Ur = (e) => e.toISOString().replace(/[-:]/g, "").replace(/\.\d+/, ""), Wr = (e) => {
2850
+ }, ti = 60, ni = (e) => e.toISOString().replace(/[-:]/g, "").replace(/\.\d+/, ""), ri = (e) => {
2566
2851
  if (!e.startsAt) return null;
2567
2852
  let t = new Date(e.startsAt);
2568
2853
  if (Number.isNaN(t.getTime())) return null;
2569
2854
  let n = e.endsAt ? new Date(e.endsAt) : null;
2570
2855
  return {
2571
2856
  start: t,
2572
- end: n && !Number.isNaN(n.getTime()) && n > t ? n : new Date(t.getTime() + Hr * 6e4)
2857
+ end: n && !Number.isNaN(n.getTime()) && n > t ? n : new Date(t.getTime() + ti * 6e4)
2573
2858
  };
2574
- }, Gr = (e) => {
2575
- let t = Wr(e);
2859
+ }, ii = (e) => {
2860
+ let t = ri(e);
2576
2861
  if (!t) return null;
2577
- let n = Ur(t.start), r = Ur(t.end), i = [e.description, e.url].filter(Boolean).join("\n\n"), a = `https://calendar.google.com/calendar/render?${new URLSearchParams({
2862
+ 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({
2578
2863
  action: "TEMPLATE",
2579
2864
  text: e.title,
2580
2865
  dates: `${n}/${r}`,
@@ -2608,65 +2893,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2608
2893
  "END:VCALENDAR"
2609
2894
  ].filter(Boolean).join("\r\n")
2610
2895
  };
2611
- }, Kr = ({ selectedTicket: e, discount: t }) => {
2612
- let [n, r] = A(!1), i = e?.currency, a = Nr(e, t), o = Fr(e, t), s = Ir(e, t), c = t?.discount ?? 0, l = s.length > 0 || c > 0 || o !== a, u = /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ P("span", {
2613
- className: "inline-flex items-center gap-1.5",
2614
- children: ["Total", l && /* @__PURE__ */ N(V, { className: Z("size-4 text-ink-muted transition-transform", n && "rotate-180") })]
2615
- }), /* @__PURE__ */ N("span", { children: Q({
2616
- unit_amount: a,
2617
- currency: i
2618
- }) })] }), d = "flex w-full items-center justify-between gap-3 px-3.5 py-3 font-semibold text-[15px] text-ink";
2619
- return /* @__PURE__ */ P("div", {
2620
- className: "rounded-xl border border-border bg-ink/3",
2621
- children: [l ? /* @__PURE__ */ N("button", {
2622
- type: "button",
2623
- onClick: () => r((e) => !e),
2624
- "aria-expanded": n,
2625
- className: d,
2626
- children: u
2627
- }) : /* @__PURE__ */ N("div", {
2628
- className: d,
2629
- children: u
2630
- }), l && /* @__PURE__ */ N(xr, {
2631
- open: n,
2632
- children: /* @__PURE__ */ P("div", {
2633
- className: "flex flex-col gap-1.5 px-3.5 pb-3 text-[13px] text-ink-soft",
2634
- children: [
2635
- /* @__PURE__ */ P("div", {
2636
- className: "flex items-center justify-between gap-3",
2637
- children: [/* @__PURE__ */ N("span", { children: "Subtotal" }), /* @__PURE__ */ N("span", { children: Q({
2638
- unit_amount: o,
2639
- currency: i
2640
- }) })]
2641
- }),
2642
- c > 0 && /* @__PURE__ */ P("div", {
2643
- className: "flex items-center justify-between gap-3 text-emerald-700 dark:text-emerald-400",
2644
- children: [/* @__PURE__ */ N("span", { children: "Discount" }), /* @__PURE__ */ P("span", { children: ["-", Q({
2645
- unit_amount: c,
2646
- currency: i
2647
- })] })]
2648
- }),
2649
- s.map((e, t) => /* @__PURE__ */ P("div", {
2650
- className: "flex items-center justify-between gap-3",
2651
- children: [/* @__PURE__ */ P("span", { children: [
2652
- e.label,
2653
- " (",
2654
- e.percentage,
2655
- "%)"
2656
- ] }), /* @__PURE__ */ N("span", { children: Q({
2657
- unit_amount: e.amount,
2658
- currency: i
2659
- }) })]
2660
- }, e.id || e._id || t)),
2661
- e?.tax_inclusive && /* @__PURE__ */ N("p", {
2662
- className: "m-0 text-ink-muted text-xs",
2663
- children: "Price is inclusive of taxes"
2664
- })
2665
- ]
2666
- })
2667
- })]
2668
- });
2669
- }, qr = (e) => {
2896
+ }, ai = (e) => {
2670
2897
  let [t, n] = A(null);
2671
2898
  return E(() => {
2672
2899
  let t = e ? window.visualViewport : null;
@@ -2679,22 +2906,22 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2679
2906
  t.removeEventListener("resize", r), t.removeEventListener("scroll", r);
2680
2907
  };
2681
2908
  }, [e]), t;
2682
- }, Jr = ({ open: e, title: t, when: n, onClose: r, onClosed: i, onSubmit: a, footer: o, wide: s, initialFocusRef: c, layers: l, children: u }) => {
2683
- let d = k(null), f = qr(e), [p, m] = A(!1), h = /* @__PURE__ */ N("div", {
2909
+ }, oi = ({ open: e, title: t, when: n, onClose: r, onClosed: i, onSubmit: a, footer: o, wide: s, initialFocusRef: c, layers: l, children: u }) => {
2910
+ let d = k(null), f = ai(e), [p, m] = A(!1), h = /* @__PURE__ */ M("div", {
2684
2911
  onScroll: (e) => m(e.currentTarget.scrollTop > 2),
2685
2912
  className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain",
2686
- children: /* @__PURE__ */ P("div", {
2913
+ children: /* @__PURE__ */ N("div", {
2687
2914
  className: "flex min-h-full flex-col",
2688
- children: [/* @__PURE__ */ N("div", {
2915
+ children: [/* @__PURE__ */ M("div", {
2689
2916
  className: "flex flex-1 flex-col px-5 pt-3 pb-3",
2690
2917
  children: u
2691
- }), o && /* @__PURE__ */ N("div", {
2918
+ }), o && /* @__PURE__ */ M("div", {
2692
2919
  className: "border-border border-t bg-page px-5 pt-3 pb-[max(env(safe-area-inset-bottom),16px)] sm:sticky sm:bottom-0 sm:z-10",
2693
2920
  children: o
2694
2921
  })]
2695
2922
  })
2696
2923
  });
2697
- return /* @__PURE__ */ N(F.Root, {
2924
+ return /* @__PURE__ */ M(P.Root, {
2698
2925
  open: e,
2699
2926
  onOpenChange: (e) => {
2700
2927
  e || r();
@@ -2702,7 +2929,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2702
2929
  onOpenChangeComplete: (e) => {
2703
2930
  e || (m(!1), i());
2704
2931
  },
2705
- children: /* @__PURE__ */ P(F.Portal, { children: [/* @__PURE__ */ N(F.Backdrop, { className: "fixed inset-0 z-[2147483000] bg-black/40 transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 data-[ending-style]:duration-150 motion-reduce:transition-none sm:backdrop-blur-[3px]" }), /* @__PURE__ */ P(F.Popup, {
2932
+ children: /* @__PURE__ */ N(P.Portal, { children: [/* @__PURE__ */ M(P.Backdrop, { className: "fixed inset-0 z-[2147483000] bg-black/40 transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 data-[ending-style]:duration-150 motion-reduce:transition-none sm:backdrop-blur-[3px]" }), /* @__PURE__ */ N(P.Popup, {
2706
2933
  ref: d,
2707
2934
  initialFocus: (e) => {
2708
2935
  let t = c?.current;
@@ -2712,21 +2939,21 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2712
2939
  "--viewport-height": f ? `${f.height}px` : "100dvh",
2713
2940
  "--viewport-top": f ? `${f.offsetTop}px` : "0px"
2714
2941
  },
2715
- 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"),
2942
+ 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"),
2716
2943
  children: [
2717
- /* @__PURE__ */ P("div", {
2718
- 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"),
2719
- children: [/* @__PURE__ */ P("div", {
2944
+ /* @__PURE__ */ N("div", {
2945
+ 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"),
2946
+ children: [/* @__PURE__ */ N("div", {
2720
2947
  className: "flex items-center justify-between gap-3",
2721
- children: [/* @__PURE__ */ N(F.Title, {
2948
+ children: [/* @__PURE__ */ M(P.Title, {
2722
2949
  className: "m-0 line-clamp-2 font-heading font-semibold text-[19px] text-ink leading-snug tracking-[-0.011em] [overflow-wrap:anywhere]",
2723
2950
  children: t
2724
- }), /* @__PURE__ */ N(F.Close, {
2951
+ }), /* @__PURE__ */ M(P.Close, {
2725
2952
  "aria-label": "Close",
2726
2953
  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",
2727
- children: /* @__PURE__ */ N(ce, { className: "size-4" })
2954
+ children: /* @__PURE__ */ M(H, { className: "size-4" })
2728
2955
  })]
2729
- }), n && /* @__PURE__ */ P("p", {
2956
+ }), n && /* @__PURE__ */ N("p", {
2730
2957
  className: "m-0 mt-3.5 text-[13.5px] text-ink-soft",
2731
2958
  children: [
2732
2959
  n.day,
@@ -2736,7 +2963,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2736
2963
  ]
2737
2964
  })]
2738
2965
  }),
2739
- a ? /* @__PURE__ */ N("form", {
2966
+ a ? /* @__PURE__ */ M("form", {
2740
2967
  onSubmit: a,
2741
2968
  className: "flex min-h-0 flex-1 flex-col",
2742
2969
  children: h
@@ -2745,8 +2972,36 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2745
2972
  ]
2746
2973
  })] })
2747
2974
  });
2748
- }, Yr = "block w-full rounded-lg px-2.5 py-2 text-left text-ink text-sm no-underline hover:bg-ink/5", Xr = "transition-[opacity,translate] duration-300 ease-out starting:translate-y-2 starting:opacity-0 motion-reduce:transition-none", Zr = "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]", Qr = ({ email: e, eventTitle: t, startsAt: n, endsAt: r, eventUrl: i, when: a, bookingRef: o, qrImageUrl: s, invoiceUrl: c, onClose: l, onRegisterAnother: u }) => {
2749
- let d = Gr({
2975
+ }, 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__ */ M("div", {
2976
+ className: "my-2",
2977
+ children: t && !n ? /* @__PURE__ */ N("span", {
2978
+ 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",
2979
+ children: [
2980
+ /* @__PURE__ */ M(V, { className: "size-4 text-emerald-600 dark:text-emerald-400" }),
2981
+ "You're registered as ",
2982
+ t,
2983
+ /* @__PURE__ */ M("button", {
2984
+ type: "button",
2985
+ onClick: a,
2986
+ className: "text-ink-soft underline underline-offset-[3px] hover:text-ink",
2987
+ children: "Register someone else"
2988
+ })
2989
+ ]
2990
+ }) : /* @__PURE__ */ M("button", {
2991
+ type: "button",
2992
+ onClick: i,
2993
+ disabled: r,
2994
+ className: X(si, "disabled:opacity-60"),
2995
+ children: e
2996
+ })
2997
+ }), li = ({ hasFailed: e }) => /* @__PURE__ */ M("div", {
2998
+ className: "my-2",
2999
+ children: /* @__PURE__ */ M("p", {
3000
+ className: "m-0 text-ink-soft text-sm",
3001
+ children: e ? "We couldn't load tickets for this event. Please refresh the page." : "Registration isn't open for this event yet."
3002
+ })
3003
+ }), 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 }) => {
3004
+ let f = ii({
2750
3005
  title: t,
2751
3006
  startsAt: n,
2752
3007
  endsAt: r,
@@ -2754,12 +3009,12 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2754
3009
  });
2755
3010
  return E(() => {
2756
3011
  navigator.vibrate?.(12);
2757
- }, []), /* @__PURE__ */ P("div", {
3012
+ }, []), /* @__PURE__ */ N("div", {
2758
3013
  className: "flex flex-1 flex-col items-center justify-center px-6 py-9 text-center",
2759
3014
  children: [
2760
- /* @__PURE__ */ N("div", {
3015
+ /* @__PURE__ */ M("div", {
2761
3016
  className: "flex size-[68px] starting:scale-50 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-700 starting:opacity-0 transition-[opacity,scale] duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none dark:bg-emerald-500/15 dark:text-emerald-400",
2762
- children: /* @__PURE__ */ P("svg", {
3017
+ children: /* @__PURE__ */ N("svg", {
2763
3018
  width: "30",
2764
3019
  height: "30",
2765
3020
  viewBox: "0 0 24 24",
@@ -2769,265 +3024,252 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2769
3024
  strokeLinecap: "round",
2770
3025
  strokeLinejoin: "round",
2771
3026
  "aria-hidden": "true",
2772
- children: [/* @__PURE__ */ N("title", { children: "Registered" }), /* @__PURE__ */ N("path", {
3027
+ children: [/* @__PURE__ */ M("title", { children: "Registered" }), /* @__PURE__ */ M("path", {
2773
3028
  d: "M4 12.5 L9.5 18 L20 7",
2774
3029
  className: "transition-[stroke-dashoffset] delay-200 duration-[420ms] ease-[cubic-bezier(0.32,0.72,0,1)] [stroke-dasharray:30] starting:[stroke-dashoffset:30] motion-reduce:transition-none"
2775
3030
  })]
2776
3031
  })
2777
3032
  }),
2778
- /* @__PURE__ */ N("h3", {
2779
- className: Z(Xr, "m-0 mt-[18px] font-heading font-semibold text-[22px] text-ink tracking-[-0.016em] delay-[260ms]"),
3033
+ /* @__PURE__ */ M("h3", {
3034
+ className: X(di, "m-0 mt-[18px] font-heading font-semibold text-[22px] text-ink tracking-[-0.016em] delay-[260ms]"),
2780
3035
  children: "You're in"
2781
3036
  }),
2782
- a && /* @__PURE__ */ P("p", {
2783
- className: Z(Xr, "m-0 mt-1.5 text-[14.5px] text-ink delay-[320ms]"),
3037
+ a && /* @__PURE__ */ N("p", {
3038
+ className: X(di, "m-0 mt-1.5 text-[14.5px] text-ink delay-[320ms]"),
2784
3039
  children: [
2785
3040
  a.day,
2786
3041
  " · ",
2787
3042
  a.time
2788
3043
  ]
2789
3044
  }),
2790
- /* @__PURE__ */ P("p", {
2791
- className: Z(Xr, "m-0 mt-1 max-w-[300px] text-[13.5px] text-ink-soft leading-relaxed delay-[360ms]"),
2792
- children: ["Joining link sent to ", /* @__PURE__ */ N("span", {
3045
+ /* @__PURE__ */ N("p", {
3046
+ className: X(di, "m-0 mt-1 max-w-[300px] text-[13.5px] text-ink-soft leading-relaxed delay-[360ms]"),
3047
+ children: [l > 1 ? `${l} spots booked · confirmation sent to ` : "Joining link sent to ", /* @__PURE__ */ M("span", {
2793
3048
  className: "text-ink [overflow-wrap:anywhere]",
2794
3049
  children: e
2795
3050
  })]
2796
3051
  }),
2797
- /* @__PURE__ */ P("div", {
2798
- className: Z(Xr, "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]"),
3052
+ /* @__PURE__ */ N("div", {
3053
+ 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]"),
2799
3054
  children: [
2800
- /* @__PURE__ */ N("span", {
3055
+ /* @__PURE__ */ M("span", {
2801
3056
  "aria-hidden": !0,
2802
3057
  className: "pointer-events-none absolute inset-0 starting:-translate-x-[140%] translate-x-[240%] bg-linear-to-r from-transparent via-white/45 to-transparent transition-transform delay-700 duration-900 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:hidden dark:via-white/10"
2803
3058
  }),
2804
- s && /* @__PURE__ */ N("img", {
3059
+ s && /* @__PURE__ */ M("img", {
2805
3060
  src: s,
2806
3061
  alt: "Booking QR code",
2807
3062
  className: "mx-auto mb-3 block size-24 rounded-lg bg-white p-1.5"
2808
3063
  }),
2809
- /* @__PURE__ */ P("div", {
3064
+ /* @__PURE__ */ N("div", {
2810
3065
  className: "flex items-center justify-between gap-3 text-[13.5px]",
2811
- children: [/* @__PURE__ */ N("span", {
3066
+ children: [/* @__PURE__ */ M("span", {
2812
3067
  className: "text-ink-soft",
2813
3068
  children: "Event"
2814
- }), /* @__PURE__ */ N("span", {
3069
+ }), /* @__PURE__ */ M("span", {
2815
3070
  className: "min-w-0 truncate font-medium text-ink",
2816
3071
  children: t
2817
3072
  })]
2818
3073
  }),
2819
- o && /* @__PURE__ */ P("div", {
3074
+ o && /* @__PURE__ */ N("div", {
2820
3075
  className: "mt-2 flex items-center justify-between gap-3 border-border border-t border-dashed pt-2 text-[13.5px]",
2821
- children: [/* @__PURE__ */ N("span", {
3076
+ children: [/* @__PURE__ */ M("span", {
2822
3077
  className: "text-ink-soft",
2823
3078
  children: "Booking ref"
2824
- }), /* @__PURE__ */ N("span", {
3079
+ }), /* @__PURE__ */ M("span", {
2825
3080
  className: "min-w-0 truncate font-medium font-mono text-ink text-xs",
2826
3081
  children: o
2827
3082
  })]
2828
3083
  })
2829
3084
  ]
2830
3085
  }),
2831
- /* @__PURE__ */ P("div", {
2832
- className: Z(Xr, "mt-4 flex w-full max-w-[340px] flex-col gap-2 delay-[520ms]"),
3086
+ /* @__PURE__ */ N("div", {
3087
+ className: X(di, "mt-4 flex w-full max-w-[340px] flex-col gap-2 delay-[520ms]"),
2833
3088
  children: [
2834
- d && /* @__PURE__ */ P(H.Root, { children: [/* @__PURE__ */ P(H.Trigger, {
2835
- className: Zr,
2836
- children: [/* @__PURE__ */ N(ie, { className: "size-4" }), "Add to calendar"]
2837
- }), /* @__PURE__ */ N(H.Portal, { children: /* @__PURE__ */ N(H.Positioner, {
3089
+ f && /* @__PURE__ */ N(W.Root, { children: [/* @__PURE__ */ N(W.Trigger, {
3090
+ className: fi,
3091
+ children: [/* @__PURE__ */ M(ae, { className: "size-4" }), "Add to calendar"]
3092
+ }), /* @__PURE__ */ M(W.Portal, { children: /* @__PURE__ */ M(W.Positioner, {
2838
3093
  sideOffset: 6,
2839
3094
  className: "z-[2147483001]",
2840
- children: /* @__PURE__ */ P(H.Popup, {
3095
+ children: /* @__PURE__ */ N(W.Popup, {
2841
3096
  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",
2842
3097
  children: [
2843
- /* @__PURE__ */ N("a", {
2844
- href: d.google,
3098
+ /* @__PURE__ */ M("a", {
3099
+ href: f.google,
2845
3100
  target: "_blank",
2846
3101
  rel: "noopener noreferrer",
2847
- className: Yr,
3102
+ className: ui,
2848
3103
  children: "Google Calendar"
2849
3104
  }),
2850
- /* @__PURE__ */ N("a", {
2851
- href: d.outlook,
3105
+ /* @__PURE__ */ M("a", {
3106
+ href: f.outlook,
2852
3107
  target: "_blank",
2853
3108
  rel: "noopener noreferrer",
2854
- className: Yr,
3109
+ className: ui,
2855
3110
  children: "Outlook"
2856
3111
  }),
2857
- /* @__PURE__ */ N("button", {
3112
+ /* @__PURE__ */ M("button", {
2858
3113
  type: "button",
2859
3114
  onClick: () => {
2860
- if (!d) return;
2861
- let e = new Blob([d.ics], { type: "text/calendar;charset=utf-8" }), n = URL.createObjectURL(e), r = document.createElement("a");
3115
+ if (!f) return;
3116
+ let e = new Blob([f.ics], { type: "text/calendar;charset=utf-8" }), n = URL.createObjectURL(e), r = document.createElement("a");
2862
3117
  r.href = n, r.download = `${t.replace(/[^\w\s-]/g, "").trim() || "event"}.ics`, r.click(), URL.revokeObjectURL(n);
2863
3118
  },
2864
- className: Yr,
3119
+ className: ui,
2865
3120
  children: "Apple Calendar / .ics"
2866
3121
  })
2867
3122
  ]
2868
3123
  })
2869
3124
  }) })] }),
2870
- c && /* @__PURE__ */ P("a", {
3125
+ c && /* @__PURE__ */ N("a", {
2871
3126
  href: c,
2872
3127
  target: "_blank",
2873
3128
  rel: "noopener noreferrer",
2874
- className: Zr,
2875
- children: [/* @__PURE__ */ N(oe, { className: "size-4" }), "Download invoice"]
3129
+ className: fi,
3130
+ children: [/* @__PURE__ */ M(se, { className: "size-4" }), "Download invoice"]
2876
3131
  }),
2877
- /* @__PURE__ */ N("button", {
3132
+ /* @__PURE__ */ M("button", {
2878
3133
  type: "button",
2879
- onClick: l,
3134
+ onClick: u,
2880
3135
  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]",
2881
3136
  children: "Done"
2882
3137
  })
2883
3138
  ]
2884
3139
  }),
2885
- /* @__PURE__ */ N("button", {
3140
+ /* @__PURE__ */ M("button", {
2886
3141
  type: "button",
2887
- onClick: u,
3142
+ onClick: d,
2888
3143
  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",
2889
3144
  children: "Register someone else"
2890
3145
  })
2891
3146
  ]
2892
3147
  });
2893
- }, $r = {
3148
+ }, mi = {
2894
3149
  email: "required",
2895
3150
  mobile: "off",
2896
3151
  organization: "off",
2897
3152
  designation: "off"
2898
- }, ei = (e) => e.replace(/[\s()-]/g, ""), ti = (e) => /^\+?\d{7,15}$/.test(ei(e)), ni = (e, t) => {
3153
+ }, hi = (e) => e.replace(/[\s()-]/g, ""), gi = (e) => /^\+?\d{7,15}$/.test(hi(e)), _i = (e, t) => {
2899
3154
  let n = {}, r = [
2900
- ["mobile", ei(e.mobile)],
3155
+ ["mobile", hi(e.mobile)],
2901
3156
  ["organization", e.organization.trim()],
2902
3157
  ["designation", e.designation.trim()]
2903
3158
  ];
2904
3159
  for (let [e, i] of r) t[e] !== "off" && i && (n[e] = i);
2905
3160
  return n;
2906
- }, ri = (e, t) => {
3161
+ }, vi = (e, t) => {
2907
3162
  let n = {};
2908
- 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() ? ti(e.mobile) || (n.mobile = "That doesn't look like a valid phone number") : t.mobile === "required" && (n.mobile = "Please enter your phone number"));
3163
+ 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"));
2909
3164
  for (let r of ["organization", "designation"]) t[r] === "required" && !e[r].trim() && (n[r] = `Please enter your ${r}`);
2910
3165
  return n;
2911
- }, ii = (e) => `levo:event-registration:${e}`, ai = (e) => {
2912
- if (typeof window > "u") return null;
2913
- try {
2914
- let t = window.localStorage.getItem(ii(e));
2915
- return t ? JSON.parse(t) : null;
2916
- } catch {
2917
- return null;
3166
+ }, 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__ */ N("fieldset", {
3167
+ className: "m-0 flex min-w-0 flex-col gap-2 border-0 p-0",
3168
+ children: [
3169
+ /* @__PURE__ */ M("legend", {
3170
+ className: "mb-2 p-0 font-medium text-ink text-sm",
3171
+ children: "Choose your tickets"
3172
+ }),
3173
+ e.map((e) => {
3174
+ let r = t[e._id] ?? 0, i = yi(e), a = i === 0, o = Br(e);
3175
+ return /* @__PURE__ */ N("div", {
3176
+ 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"),
3177
+ children: [/* @__PURE__ */ N("div", {
3178
+ className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
3179
+ children: [
3180
+ /* @__PURE__ */ M("span", {
3181
+ className: "block font-medium text-[14.5px] text-ink leading-snug",
3182
+ children: e.title
3183
+ }),
3184
+ /* @__PURE__ */ N("span", {
3185
+ className: "mt-0.5 block font-medium text-[13.5px] text-ink",
3186
+ children: [Z(e), o && /* @__PURE__ */ M("span", {
3187
+ className: "ml-1 font-normal text-[11.5px] text-ink-muted",
3188
+ children: o
3189
+ })]
3190
+ }),
3191
+ e.description && /* @__PURE__ */ M("span", {
3192
+ title: e.description,
3193
+ className: "mt-1 line-clamp-2 block text-[12.5px] text-ink-soft leading-snug",
3194
+ children: e.description
3195
+ })
3196
+ ]
3197
+ }), a ? /* @__PURE__ */ M("span", {
3198
+ className: "shrink-0 rounded-full bg-ink/5 px-2.5 py-1 font-medium text-[12px] text-ink-soft",
3199
+ children: "Sold out"
3200
+ }) : /* @__PURE__ */ N("div", {
3201
+ className: "flex shrink-0 flex-col items-end gap-1",
3202
+ children: [/* @__PURE__ */ N("div", {
3203
+ className: "flex items-center gap-2",
3204
+ children: [
3205
+ /* @__PURE__ */ M("button", {
3206
+ type: "button",
3207
+ "aria-label": `Remove one ${e.title} ticket`,
3208
+ disabled: r === 0,
3209
+ onClick: () => n(e._id, r - 1),
3210
+ className: bi,
3211
+ children: /* @__PURE__ */ M(le, { className: "size-3.5" })
3212
+ }),
3213
+ /* @__PURE__ */ N("span", {
3214
+ "aria-live": "polite",
3215
+ className: "w-5 text-center font-semibold text-[15px] text-ink tabular-nums",
3216
+ children: [r, /* @__PURE__ */ N("span", {
3217
+ className: "sr-only",
3218
+ children: [" ", e.title]
3219
+ })]
3220
+ }),
3221
+ /* @__PURE__ */ M("button", {
3222
+ type: "button",
3223
+ "aria-label": `Add one ${e.title} ticket`,
3224
+ disabled: r >= i,
3225
+ onClick: () => n(e._id, r + 1),
3226
+ className: bi,
3227
+ children: /* @__PURE__ */ M(ue, { className: "size-3.5" })
3228
+ })
3229
+ ]
3230
+ }), r > 0 && r >= i && /* @__PURE__ */ N("span", {
3231
+ className: "text-[11.5px] text-ink-muted",
3232
+ children: [
3233
+ "Max ",
3234
+ i,
3235
+ " per order"
3236
+ ]
3237
+ })]
3238
+ })]
3239
+ }, e._id);
3240
+ }),
3241
+ r && /* @__PURE__ */ M("p", {
3242
+ className: "m-0 text-danger text-xs",
3243
+ children: r
3244
+ })
3245
+ ]
3246
+ }), Q = {
3247
+ name: "",
3248
+ email: "",
3249
+ mobile: "",
3250
+ organization: "",
3251
+ designation: "",
3252
+ is_business_purchase: !1,
3253
+ billing_details: {
3254
+ name: "",
3255
+ tax_id: "",
3256
+ address: {
3257
+ line1: "",
3258
+ line2: "",
3259
+ city: "",
3260
+ state: "",
3261
+ postal_code: "",
3262
+ country: ""
3263
+ }
2918
3264
  }
2919
- }, oi = (e, t) => {
2920
- if (!(typeof window > "u")) try {
2921
- window.localStorage.setItem(ii(e), JSON.stringify(t));
2922
- } catch {}
2923
- }, si = (e) => {
2924
- if (!(typeof window > "u")) try {
2925
- window.localStorage.removeItem(ii(e));
2926
- } catch {}
2927
- }, ci = ({ tickets: e, selectedTicket: t, onSelect: n, error: r }) => {
2928
- let [i, a] = A(!t);
2929
- return /* @__PURE__ */ P("fieldset", {
2930
- className: "m-0 flex min-w-0 flex-col gap-2 border-0 p-0",
2931
- children: [
2932
- /* @__PURE__ */ N("legend", {
2933
- className: "mb-2 p-0 font-medium text-ink text-sm",
2934
- children: "Choose your ticket"
2935
- }),
2936
- /* @__PURE__ */ N("div", {
2937
- className: "-mb-2 flex flex-col",
2938
- children: e.map((r) => {
2939
- let o = r._id === t?._id, s = i || o, c = Ar(r);
2940
- return /* @__PURE__ */ N(xr, {
2941
- open: s,
2942
- children: /* @__PURE__ */ P("label", {
2943
- 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"),
2944
- children: [
2945
- /* @__PURE__ */ N("input", {
2946
- type: "radio",
2947
- name: "ticket",
2948
- value: r._id,
2949
- checked: o,
2950
- onChange: () => {
2951
- n(r), a(!1);
2952
- },
2953
- onClick: () => {
2954
- i || a(!0);
2955
- },
2956
- className: "sr-only"
2957
- }),
2958
- /* @__PURE__ */ N("span", {
2959
- "aria-hidden": !0,
2960
- className: Z("mt-0.5 size-[17px] shrink-0 rounded-full border transition-all", o ? "border-[5px] border-brand" : "border-border")
2961
- }),
2962
- /* @__PURE__ */ P("span", {
2963
- className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
2964
- children: [/* @__PURE__ */ N("span", {
2965
- className: "block font-medium text-[14.5px] text-ink leading-snug",
2966
- children: r.title
2967
- }), r.description && /* @__PURE__ */ N("span", {
2968
- title: r.description,
2969
- className: Z("mt-0.5 block text-[12.5px] text-ink-soft leading-snug", !i && "line-clamp-2"),
2970
- children: r.description
2971
- })]
2972
- }),
2973
- /* @__PURE__ */ P("span", {
2974
- className: "flex shrink-0 flex-col items-end gap-1.5",
2975
- children: [/* @__PURE__ */ P("span", {
2976
- className: "text-right font-medium text-[14.5px] text-ink",
2977
- children: [Q(r), c && /* @__PURE__ */ N("span", {
2978
- className: "block font-normal text-[11.5px] text-ink-muted",
2979
- children: c
2980
- })]
2981
- }), o && !i && e.length > 1 && /* @__PURE__ */ P("span", {
2982
- 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",
2983
- children: [
2984
- e.length - 1,
2985
- " more",
2986
- /* @__PURE__ */ N(V, {
2987
- "aria-hidden": !0,
2988
- className: "size-3.5"
2989
- })
2990
- ]
2991
- })]
2992
- })
2993
- ]
2994
- })
2995
- }, r._id);
2996
- })
2997
- }),
2998
- r && /* @__PURE__ */ N("p", {
2999
- className: "m-0 text-danger text-xs",
3000
- children: r
3001
- })
3002
- ]
3003
- });
3004
- }, li = {
3005
- name: "",
3006
- email: "",
3007
- mobile: "",
3008
- organization: "",
3009
- designation: "",
3010
- is_business_purchase: !1,
3011
- billing_details: {
3012
- name: "",
3013
- tax_id: "",
3014
- address: {
3015
- line1: "",
3016
- line2: "",
3017
- city: "",
3018
- state: "",
3019
- postal_code: "",
3020
- country: ""
3021
- }
3022
- }
3023
- }, ui = {
3265
+ }, Si = {
3024
3266
  name: !0,
3025
3267
  email: !0,
3026
3268
  mobile: !0,
3027
3269
  organization: !0,
3028
3270
  designation: !0
3029
- }, di = (e, t) => {
3030
- let [n, r] = A(li), [i, a] = A({}), [o, s] = A(!1), c = k(!1);
3271
+ }, Ci = (e, t) => {
3272
+ let [n, r] = A(Q), [i, a] = A({}), [o, s] = A(!1), c = k(!1);
3031
3273
  E(() => {
3032
3274
  c.current || !e || (c.current = !0, r((t) => ({
3033
3275
  ...t,
@@ -3035,14 +3277,14 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3035
3277
  email: t.email || e.email || ""
3036
3278
  })));
3037
3279
  }, [e]);
3038
- let l = ri(n, t), u = w((e, t) => r((n) => ({
3280
+ let l = vi(n, t), u = w((e, t) => r((n) => ({
3039
3281
  ...n,
3040
3282
  [e]: t
3041
3283
  })), []), d = w((e) => a((t) => ({
3042
3284
  ...t,
3043
3285
  [e]: !0
3044
3286
  })), []), f = w(() => {
3045
- r(li), a({}), s(!1), c.current = !0;
3287
+ r(Q), a({}), s(!1), c.current = !0;
3046
3288
  }, []), p = w(() => {
3047
3289
  a({}), s(!1);
3048
3290
  }, []);
@@ -3056,13 +3298,90 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3056
3298
  touchField: d,
3057
3299
  reset: f,
3058
3300
  resetValidationDisplay: p,
3059
- touched: o ? ui : i
3301
+ touched: o ? Si : i
3060
3302
  };
3061
- }, fi = ({ eventID: e, selectedTicket: t, enabled: n }) => {
3062
- let r = i(), [a, o] = A(""), [s, c] = A(null), [l, u] = A(!1), [d, f] = A(null), [p, m] = A([]);
3063
- return E(() => {
3303
+ }, wi = (e, t, n) => {
3304
+ let [r, i] = A({}), [a, o] = A({}), [s, c] = A({
3305
+ is_business_purchase: Q.is_business_purchase,
3306
+ billing_details: Q.billing_details
3307
+ }), [l, u] = A(!1), d = k(!1), f = O(() => t.flatMap((e) => Array.from({ length: n[e._id] ?? 0 }, (t, n) => ({
3308
+ key: `${e._id}:${n}`,
3309
+ ticket: e,
3310
+ rules: e.registration_fields ?? mi
3311
+ }))), [t, n]), p = f[0]?.key;
3312
+ E(() => {
3313
+ d.current || !e || !p || (d.current = !0, i((t) => {
3314
+ let n = t[p] ?? Q;
3315
+ return {
3316
+ ...t,
3317
+ [p]: {
3318
+ ...n,
3319
+ name: n.name || [e.first_name, e.last_name].filter(Boolean).join(" ").trim(),
3320
+ email: n.email || e.email || ""
3321
+ }
3322
+ };
3323
+ }));
3324
+ }, [e, p]);
3325
+ let m = (e) => r[e] ?? Q, h = O(() => {
3326
+ let e = {};
3327
+ for (let t of f) e[t.key] = vi(r[t.key] ?? Q, t.rules);
3328
+ return e;
3329
+ }, [f, r]), g = (e) => Object.keys(h[e] ?? {}).length === 0, _ = w((e, t, n) => i((r) => ({
3330
+ ...r,
3331
+ [e]: {
3332
+ ...r[e] ?? Q,
3333
+ [t]: n
3334
+ }
3335
+ })), []), v = w((e, t) => o((n) => ({
3336
+ ...n,
3337
+ [e]: {
3338
+ ...n[e],
3339
+ [t]: !0
3340
+ }
3341
+ })), []), y = w((e) => o((t) => ({
3342
+ ...t,
3343
+ [e]: Si
3344
+ })), []), b = w((e, t) => c((n) => ({
3345
+ ...n,
3346
+ [e]: t
3347
+ })), []), x = w(() => {
3348
+ i({}), o({}), c({
3349
+ is_business_purchase: Q.is_business_purchase,
3350
+ billing_details: Q.billing_details
3351
+ }), u(!1), d.current = !0;
3352
+ }, []), S = w(() => {
3353
+ o({}), u(!1);
3354
+ }, []);
3355
+ return {
3356
+ slots: f,
3357
+ getValues: m,
3358
+ errors: h,
3359
+ isSlotValid: g,
3360
+ isValid: f.every((e) => g(e.key)),
3361
+ getTouched: (e) => l ? Si : a[e] ?? {},
3362
+ isSlotVisited: (e) => l || !!a[e],
3363
+ submitAttempted: l,
3364
+ markSubmitted: () => u(!0),
3365
+ setField: _,
3366
+ touchField: v,
3367
+ touchSlot: y,
3368
+ billing: s,
3369
+ setBillingField: b,
3370
+ reset: x,
3371
+ resetValidationDisplay: S
3372
+ };
3373
+ }, Ti = (e) => typeof e == "string" ? e : e._id, Ei = (e) => e.reduce((e, t) => e + (t.unit_amount ?? 0), 0), Di = (e, t, n = Date.now()) => e.flatMap((e) => {
3374
+ if (e.status === "archived" || e.starts_at && new Date(e.starts_at).getTime() > n || e.expires_at && new Date(e.expires_at).getTime() < n || e.max_redemptions && e.redeem_count >= e.max_redemptions || e.min_trnx_amount && Ei(t) < e.min_trnx_amount) return [];
3375
+ let r = e.tickets.map(Ti), i = Ei(t.filter((e) => r.includes(e._id))), a = e.kind === "percent" ? Math.round(i * (e.percent_off ?? 0) / 100) : Math.min(e.amount_off ?? 0, i), o = e.max_amount_off ? Math.min(a, e.max_amount_off) : a;
3376
+ return o > 0 ? [{
3377
+ coupon: e,
3378
+ saving: o
3379
+ }] : [];
3380
+ }).sort((e, t) => t.saving - e.saving), Oi = ({ eventID: e, tickets: t, enabled: n }) => {
3381
+ let r = i(), a = t.map((e) => e._id).join(","), [o, s] = A(null), [c, l] = A(null), [u, d] = A(null), [f, p] = A([]), m = k(0), h = k(null), g = Di(f, t), _ = g[0]?.coupon.code;
3382
+ E(() => {
3064
3383
  !n || !e || !r || r.fetch?.url(`/v1/event/event/${e}/coupon/list-public-coupons`)?.get().json().then((e) => {
3065
- e?.status && e?.content?.data && m(e.content.data);
3384
+ e?.status && e?.content?.data && p(e.content.data);
3066
3385
  }).catch((e) => {
3067
3386
  r.logger?.error("Failed to fetch public coupons", { exception: b(e) });
3068
3387
  });
@@ -3070,52 +3389,69 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3070
3389
  n,
3071
3390
  e,
3072
3391
  r
3073
- ]), {
3074
- code: a,
3075
- setCode: o,
3076
- discount: s,
3077
- isLoading: l,
3078
- error: d,
3079
- publicCoupons: p,
3080
- apply: w(async (n) => {
3081
- let i = (n ?? a).trim();
3082
- if (!(!i || !r)) {
3083
- u(!0), f(null);
3084
- try {
3085
- let n = await r.fetch?.url(`/v1/event/event/${e}/coupon/validate-coupon-code`)?.post({
3086
- coupon: i,
3087
- event: e,
3088
- attendees: [{
3089
- name: "",
3090
- email: "",
3091
- ticket: t?._id
3092
- }]
3093
- }).json();
3094
- n?.status && (c(n.content.data), o(i));
3095
- } catch (e) {
3096
- let t = b(e);
3097
- f(t.message), r.logger?.error("Coupon validation failed", { exception: t });
3098
- } finally {
3099
- u(!1);
3100
- }
3101
- }
3102
- }, [
3103
- r,
3104
- a,
3105
- e,
3106
- t?._id
3107
- ]),
3108
- reset: w(() => {
3109
- o(""), c(null), f(null);
3110
- }, [])
3392
+ ]);
3393
+ let v = w(async (t, { auto: n = !1 } = {}) => {
3394
+ let i = t.trim().toUpperCase();
3395
+ if (!i || !r) return !1;
3396
+ n || (h.current = a);
3397
+ let o = ++m.current, c = () => o === m.current;
3398
+ l({
3399
+ code: i,
3400
+ auto: n
3401
+ }), d(null);
3402
+ try {
3403
+ let t = await r.fetch?.url(`/v1/event/event/${e}/coupon/validate-coupon-code`)?.post({
3404
+ coupon: i,
3405
+ event: e,
3406
+ attendees: a.split(",").filter(Boolean).map((e) => ({
3407
+ name: "",
3408
+ email: "",
3409
+ ticket: e
3410
+ }))
3411
+ }).json();
3412
+ return !c() || !t?.status ? !1 : (s({
3413
+ code: i,
3414
+ discount: t.content.data
3415
+ }), !0);
3416
+ } catch (e) {
3417
+ let t = b(e);
3418
+ return c() && !n && d(t.message), r.logger?.error("Coupon validation failed", { exception: t }), !1;
3419
+ } finally {
3420
+ c() && l(null);
3421
+ }
3422
+ }, [
3423
+ r,
3424
+ e,
3425
+ a
3426
+ ]);
3427
+ E(() => {
3428
+ !n || !_ || o || h.current === a || (h.current = a, v(_, { auto: !0 }));
3429
+ }, [
3430
+ n,
3431
+ _,
3432
+ o,
3433
+ a,
3434
+ v
3435
+ ]);
3436
+ let y = w(() => {
3437
+ m.current += 1, l(null), s(null), d(null);
3438
+ }, []);
3439
+ return {
3440
+ applied: o,
3441
+ discount: o?.discount ?? null,
3442
+ pending: c,
3443
+ error: u,
3444
+ offers: g,
3445
+ apply: v,
3446
+ reset: y
3111
3447
  };
3112
- }, pi = async (e, t) => {
3448
+ }, ki = async (e, t) => {
3113
3449
  let n = new URLSearchParams();
3114
3450
  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 ?? [];
3115
- }, mi = ({ eventID: e, external: t }) => {
3451
+ }, Ai = ({ eventID: e, external: t }) => {
3116
3452
  let n = i(), [r, a] = A([]), [o, s] = A(!t), [c, l] = A(!1), [u, d] = A(null);
3117
3453
  return E(() => {
3118
- t || !e || !n || (s(!0), l(!1), pi(n, e).then((e) => {
3454
+ t || !e || !n || (s(!0), l(!1), ki(n, e).then((e) => {
3119
3455
  a(e), e.length === 1 && d(e[0] ?? null);
3120
3456
  }).catch((e) => {
3121
3457
  l(!0), n.logger?.error("Failed to load event tickets", { exception: b(e) });
@@ -3131,7 +3467,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3131
3467
  selectedTicket: u,
3132
3468
  selectTicket: d
3133
3469
  };
3134
- }, hi = async (e) => {
3470
+ }, ji = async (e) => {
3135
3471
  let { payment_session_id: t, order_id: n } = e;
3136
3472
  if (!t || !n) throw Error("Cashfree payment session missing");
3137
3473
  let { load: r } = await import("./script.esm-D4nvz3-k.js"), i = await r({ mode: e.environment || "production" });
@@ -3147,8 +3483,8 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3147
3483
  status: "closed",
3148
3484
  message: a.error?.message
3149
3485
  };
3150
- }, gi = () => typeof window < "u" && "Razorpay" in window, _i = ({ order: e, onSettled: t, onError: n }) => {
3151
- let { Razorpay: r, isLoading: i, error: a } = le(), o = k({
3486
+ }, Mi = () => typeof window < "u" && "Razorpay" in window, Ni = ({ order: e, onSettled: t, onError: n }) => {
3487
+ let { Razorpay: r, isLoading: i, error: a } = fe(), o = k({
3152
3488
  onSettled: t,
3153
3489
  onError: n
3154
3490
  });
@@ -3163,7 +3499,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3163
3499
  s.current = !0, o.current.onError(Error(a));
3164
3500
  return;
3165
3501
  }
3166
- if (!r || !gi()) return;
3502
+ if (!r || !Mi()) return;
3167
3503
  s.current = !0;
3168
3504
  let t;
3169
3505
  try {
@@ -3201,37 +3537,37 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3201
3537
  a,
3202
3538
  e
3203
3539
  ]), null;
3204
- }, vi = ({ stripePromise: e, clientSecret: t, onClose: n, onComplete: r }) => {
3540
+ }, Pi = ({ stripePromise: e, clientSecret: t, onClose: n, onComplete: r }) => {
3205
3541
  let i = k(r);
3206
3542
  i.current = r;
3207
3543
  let a = O(() => ({
3208
3544
  clientSecret: t,
3209
3545
  onComplete: () => i.current()
3210
3546
  }), [t]);
3211
- return /* @__PURE__ */ N(F.Root, {
3547
+ return /* @__PURE__ */ M(P.Root, {
3212
3548
  open: !0,
3213
3549
  onOpenChange: (e) => {
3214
3550
  e || n();
3215
3551
  },
3216
- children: /* @__PURE__ */ P(F.Portal, { children: [/* @__PURE__ */ N(F.Backdrop, { className: "fixed inset-0 z-[2147483001] bg-black/50" }), /* @__PURE__ */ P(F.Popup, {
3552
+ children: /* @__PURE__ */ N(P.Portal, { children: [/* @__PURE__ */ M(P.Backdrop, { className: "fixed inset-0 z-[2147483001] bg-black/50" }), /* @__PURE__ */ N(P.Popup, {
3217
3553
  className: "fixed top-8 left-1/2 z-[2147483001] flex max-h-[calc(100dvh-4rem)] min-h-[500px] w-[98vw] -translate-x-1/2 flex-col overflow-hidden rounded-2xl bg-white shadow-2xl md:top-10 md:w-auto md:max-w-[1000px] lg:max-w-[1100px]",
3218
- children: [/* @__PURE__ */ N(F.Close, {
3554
+ children: [/* @__PURE__ */ M(P.Close, {
3219
3555
  "aria-label": "Close payment",
3220
3556
  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",
3221
- children: /* @__PURE__ */ N(ce, { className: "size-5" })
3222
- }), /* @__PURE__ */ N("div", {
3557
+ children: /* @__PURE__ */ M(H, { className: "size-5" })
3558
+ }), /* @__PURE__ */ M("div", {
3223
3559
  className: "flex-1 overflow-y-auto rounded-2xl py-6",
3224
- children: /* @__PURE__ */ N(de, {
3560
+ children: /* @__PURE__ */ M(me, {
3225
3561
  stripe: e,
3226
3562
  options: a,
3227
- children: /* @__PURE__ */ N(ue, { className: "stripe-embedded-checkout h-full" })
3563
+ children: /* @__PURE__ */ M(pe, { className: "stripe-embedded-checkout h-full" })
3228
3564
  })
3229
3565
  })]
3230
3566
  })] })
3231
3567
  });
3232
- }, yi = () => {
3568
+ }, Fi = () => {
3233
3569
  let [e, t] = A(null), n = w(async (e, n) => {
3234
- if (e.provider === "cashfree") return hi(e);
3570
+ if (e.provider === "cashfree") return ji(e);
3235
3571
  if (e.provider === "stripe") {
3236
3572
  let { client_secret: n, session_id: r } = e;
3237
3573
  if (!n || !r) throw Error("Stripe checkout session missing");
@@ -3265,7 +3601,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3265
3601
  }, []), r = (e, n) => {
3266
3602
  t(null), n instanceof Error ? e.settle.reject(n) : e.settle.resolve(n);
3267
3603
  }, i = null;
3268
- return e?.provider === "stripe" ? i = /* @__PURE__ */ N(vi, {
3604
+ return e?.provider === "stripe" ? i = /* @__PURE__ */ M(Pi, {
3269
3605
  stripePromise: e.stripePromise,
3270
3606
  clientSecret: e.clientSecret,
3271
3607
  onComplete: () => r(e, {
@@ -3273,7 +3609,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3273
3609
  confirmation: { session_id: e.sessionId }
3274
3610
  }),
3275
3611
  onClose: () => r(e, { status: "closed" })
3276
- }) : e?.provider === "razorpay" && (i = /* @__PURE__ */ N(_i, {
3612
+ }) : e?.provider === "razorpay" && (i = /* @__PURE__ */ M(Ni, {
3277
3613
  order: e.order,
3278
3614
  onSettled: (t) => r(e, t),
3279
3615
  onError: (t) => r(e, t)
@@ -3287,8 +3623,8 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3287
3623
  providerUnreachable: "We couldn't reach the payment provider. Check your connection and try again.",
3288
3624
  confirmationFailed: "We couldn't confirm your payment. Your details are saved — try again.",
3289
3625
  generic: "Something went wrong. Please try again."
3290
- }, bi = (e) => !!e && e.status !== "requires_payment", xi = ({ eventID: e, details: t, onConfirmed: n }) => {
3291
- let r = i(), a = yi(), [o, s] = A({ kind: "idle" }), c = k({
3626
+ }, Ii = (e) => !!e && e.status !== "requires_payment", Li = ({ eventID: e, details: t, onConfirmed: n }) => {
3627
+ let r = i(), a = Fi(), [o, s] = A({ kind: "idle" }), c = k({
3292
3628
  details: t,
3293
3629
  onConfirmed: n
3294
3630
  });
@@ -3304,7 +3640,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3304
3640
  message: t
3305
3641
  }), d = async (e, t) => {
3306
3642
  if (!t?.key) {
3307
- bi(e) ? l(e) : s({
3643
+ Ii(e) ? l(e) : s({
3308
3644
  kind: "failed",
3309
3645
  message: $.registrationFailed
3310
3646
  });
@@ -3338,7 +3674,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3338
3674
  }
3339
3675
  try {
3340
3676
  let t = (await r?.fetch?.url(`/v1/event/booking/${e._id}/confirm-booking`)?.post(n.confirmation)?.json())?.content?.data;
3341
- bi(t) ? l(t) : u(e._id, $.paymentAbandoned);
3677
+ Ii(t) ? l(t) : u(e._id, $.paymentAbandoned);
3342
3678
  } catch (t) {
3343
3679
  r?.logger?.error("Failed to confirm booking after payment", { exception: b(t) }), u(e._id, $.confirmationFailed);
3344
3680
  }
@@ -3377,33 +3713,385 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3377
3713
  },
3378
3714
  reset: () => s({ kind: "idle" })
3379
3715
  };
3380
- }, Si = "register", Ci = () => {
3716
+ }, Ri = (e) => `levo:event-registration:${e}`, zi = (e) => {
3717
+ if (typeof window > "u") return null;
3718
+ try {
3719
+ let t = window.localStorage.getItem(Ri(e));
3720
+ return t ? JSON.parse(t) : null;
3721
+ } catch {
3722
+ return null;
3723
+ }
3724
+ }, Bi = (e, t) => {
3725
+ if (!(typeof window > "u")) try {
3726
+ window.localStorage.setItem(Ri(e), JSON.stringify(t));
3727
+ } catch {}
3728
+ }, Vi = (e) => {
3729
+ if (!(typeof window > "u")) try {
3730
+ window.localStorage.removeItem(Ri(e));
3731
+ } catch {}
3732
+ }, Hi = (e) => {
3733
+ let [t, n] = A(null), [r, i] = A(null);
3734
+ return E(() => {
3735
+ let t = zi(e);
3736
+ t && i(t.email);
3737
+ }, [e]), {
3738
+ booking: t,
3739
+ registeredEmail: r,
3740
+ complete: (t, r) => {
3741
+ n(t), i(r), Bi(e, {
3742
+ bookingId: t._id,
3743
+ email: r,
3744
+ at: (/* @__PURE__ */ new Date()).toISOString()
3745
+ });
3746
+ },
3747
+ clear: () => {
3748
+ Vi(e), i(null), n(null);
3749
+ }
3750
+ };
3751
+ }, Ui = "register", Wi = () => {
3381
3752
  if (typeof window > "u") return !1;
3382
- let e = new URLSearchParams(window.location.search).get(Si);
3753
+ let e = new URLSearchParams(window.location.search).get(Ui);
3383
3754
  return e !== null && e !== "0" && e !== "false";
3384
- }, wi = ({ canAutoOpen: e }) => {
3755
+ }, Gi = ({ canAutoOpen: e }) => {
3385
3756
  let [t, n] = A(!1), r = k(!1), i = w(() => n(!0), []), a = w(() => n(!1), []);
3386
3757
  return E(() => {
3387
- r.current || !e || !Ci() || (r.current = !0, n(!0));
3758
+ r.current || !e || !Wi() || (r.current = !0, n(!0));
3388
3759
  }, [e]), {
3389
3760
  isOpen: t,
3390
3761
  open: i,
3391
3762
  close: a
3392
3763
  };
3393
- }, Ti = "inline-flex items-center justify-center rounded-lg bg-brand px-4 py-3 font-semibold text-brand-foreground transition hover:opacity-90", Ei = ({ eventID: e, title: t, external: n, buttonText: r = "Register Now", startsAt: i, endsAt: a, eventUrl: o }) => {
3394
- let { account: s } = Qe(), c = er(), l = mi({
3764
+ }, Ki = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, qi = ({ eventID: e, title: t, buttonText: n = "Register Now", startsAt: r, endsAt: i, eventUrl: a }) => {
3765
+ let { account: o } = nt(), s = cr(), c = Ai({ 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;
3766
+ E(() => {
3767
+ _ && u((e) => ({ [_]: e[_] || 1 }));
3768
+ }, [_]);
3769
+ let v = O(() => c.tickets.map((e) => ({
3770
+ ticket: e,
3771
+ count: l[e._id] ?? 0
3772
+ })).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 = Hi(e), { booking: C } = S, w = Gi({ canAutoOpen: !c.isLoading && c.tickets.length > 0 && !S.registeredEmail }), T = v.some((e) => Ur(e.ticket, null) > 0), D = Oi({
3773
+ eventID: e,
3774
+ tickets: b.slots.map((e) => e.ticket),
3775
+ enabled: w.isOpen && T && d === "review"
3776
+ }), k = Jr(v, D.discount), ee = !!k && !k.isFree, P = O(() => ei(r, i), [r, i]), F = t || "this event", I = Li({
3777
+ eventID: e,
3778
+ details: {
3779
+ merchantName: s?.name || t || "",
3780
+ description: "Event Registration",
3781
+ prefill: {
3782
+ name: x?.name.trim() ?? "",
3783
+ email: x?.email.trim() ?? "",
3784
+ contact: hi(x?.mobile ?? "")
3785
+ }
3786
+ },
3787
+ onConfirmed: (e) => S.complete(e, x?.email.trim() ?? "")
3788
+ }), L = (e, t) => {
3789
+ D.reset(), I.reset(), m(!1), u((n) => ({
3790
+ ...n,
3791
+ [e]: t
3792
+ }));
3793
+ }, R = () => {
3794
+ S.clear(), I.reset(), D.reset(), b.reset(), u(_ ? { [_]: 1 } : {}), f("tickets"), g(null);
3795
+ }, te = (t) => {
3796
+ if (t.preventDefault(), d === "tickets") {
3797
+ if (y === 0) {
3798
+ m(!0);
3799
+ return;
3800
+ }
3801
+ f("details"), g(b.slots.find((e) => !b.isSlotValid(e.key))?.key ?? null);
3802
+ return;
3803
+ }
3804
+ if (d === "details") {
3805
+ if (b.markSubmitted(), !b.isValid) {
3806
+ g(b.slots.find((e) => !b.isSlotValid(e.key))?.key ?? null);
3807
+ return;
3808
+ }
3809
+ if (T) {
3810
+ f("review");
3811
+ return;
3812
+ }
3813
+ }
3814
+ I.register({
3815
+ event: e,
3816
+ coupon: D.applied?.code ?? "",
3817
+ attendees: b.slots.map((e) => {
3818
+ let t = b.getValues(e.key);
3819
+ return {
3820
+ name: t.name.trim(),
3821
+ email: t.email.trim(),
3822
+ ..._i(t, e.rules),
3823
+ ticket: e.ticket._id,
3824
+ details: {}
3825
+ };
3826
+ }),
3827
+ ...b.billing.is_business_purchase && ee ? {
3828
+ is_business_purchase: !0,
3829
+ billing_details: b.billing.billing_details
3830
+ } : {}
3831
+ });
3832
+ };
3833
+ if (!c.isLoading && c.tickets.length === 0) return /* @__PURE__ */ M(li, { hasFailed: c.hasFailed });
3834
+ let z = k && !k.isFree ? Z({
3835
+ unit_amount: k.amount,
3836
+ currency: k.currency
3837
+ }) : null, ne = z ? `Pay ${z}` : y === 1 ? "Save my spot" : `Save ${y} spots`, B = (e, t) => /* @__PURE__ */ N("button", {
3838
+ type: "button",
3839
+ disabled: I.state.kind === "busy",
3840
+ onClick: () => {
3841
+ I.reset(), f(t);
3842
+ },
3843
+ 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",
3844
+ children: [/* @__PURE__ */ M(ie, { className: "size-3.5" }), e]
3845
+ }), re = "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", ae = /* @__PURE__ */ N("div", {
3846
+ className: "flex items-center gap-3",
3847
+ children: [/* @__PURE__ */ N("div", {
3848
+ className: "min-w-0 flex-1",
3849
+ children: [/* @__PURE__ */ M("span", {
3850
+ className: "block font-semibold text-[15px] text-ink tabular-nums",
3851
+ children: y === 0 ? "No tickets yet" : Ki(y, "ticket")
3852
+ }), y > 0 && /* @__PURE__ */ M("span", {
3853
+ className: "block text-[12.5px] text-ink-soft tabular-nums",
3854
+ children: z ?? "Free"
3855
+ })]
3856
+ }), /* @__PURE__ */ M("button", {
3857
+ type: "submit",
3858
+ className: re,
3859
+ children: "Continue"
3860
+ })]
3861
+ }), V = b.isValid ? void 0 : "Fill in every attendee's details to continue", oe = d === "tickets" ? ae : d === "details" && T ? /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("button", {
3862
+ type: "submit",
3863
+ disabled: !b.isValid,
3864
+ className: X(re, "w-full"),
3865
+ children: "Review order"
3866
+ }), V && /* @__PURE__ */ M("p", {
3867
+ className: "m-0 mt-2 text-center text-ink-muted text-xs",
3868
+ children: V
3869
+ })] }) : /* @__PURE__ */ M(Xr, {
3870
+ payment: I,
3871
+ label: ne,
3872
+ isPaid: ee,
3873
+ blockedReason: d === "details" ? V : void 0
3874
+ });
3875
+ return /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(ci, {
3876
+ buttonText: n,
3877
+ registeredEmail: S.registeredEmail,
3878
+ isSheetOpen: w.isOpen,
3879
+ isLoading: c.isLoading,
3880
+ onOpen: w.open,
3881
+ onRegisterAnother: R
3882
+ }), /* @__PURE__ */ M(oi, {
3883
+ open: w.isOpen,
3884
+ title: C ? F : `Register for ${F}`,
3885
+ when: P,
3886
+ wide: !0,
3887
+ onClose: w.close,
3888
+ onClosed: () => {
3889
+ I.reset(), b.resetValidationDisplay(), m(!1);
3890
+ },
3891
+ layers: I.checkoutElement,
3892
+ onSubmit: C ? void 0 : te,
3893
+ footer: C ? void 0 : oe,
3894
+ children: C ? /* @__PURE__ */ M(pi, {
3895
+ email: x?.email.trim() ?? "",
3896
+ eventTitle: F,
3897
+ startsAt: r,
3898
+ endsAt: i,
3899
+ eventUrl: a,
3900
+ when: P,
3901
+ bookingRef: C._id,
3902
+ qrImageUrl: C.qr_image?.location,
3903
+ invoiceUrl: C.invoice?.location,
3904
+ attendeeCount: b.slots.length,
3905
+ onClose: w.close,
3906
+ onRegisterAnother: R
3907
+ }) : d === "tickets" ? /* @__PURE__ */ M(xi, {
3908
+ tickets: c.tickets,
3909
+ counts: l,
3910
+ onChange: L,
3911
+ error: p ? "Add at least one ticket to continue" : void 0
3912
+ }) : d === "details" ? /* @__PURE__ */ N("div", {
3913
+ className: "flex flex-col gap-4",
3914
+ children: [
3915
+ B("Change tickets", "tickets"),
3916
+ /* @__PURE__ */ M("span", {
3917
+ className: "font-semibold text-[16px] text-ink",
3918
+ children: y === 1 ? "Your details" : "Attendee details"
3919
+ }),
3920
+ /* @__PURE__ */ M(Rr, {
3921
+ attendees: b,
3922
+ openKey: h,
3923
+ onOpenChange: g
3924
+ })
3925
+ ]
3926
+ }) : /* @__PURE__ */ N("div", {
3927
+ className: "flex flex-col gap-4",
3928
+ children: [
3929
+ B("Edit attendee details", "details"),
3930
+ /* @__PURE__ */ M(Yr, {
3931
+ lines: v,
3932
+ discount: D.discount,
3933
+ pricing: k
3934
+ }),
3935
+ /* @__PURE__ */ M(Qr, {
3936
+ applied: D.applied,
3937
+ pending: D.pending,
3938
+ couponError: D.error,
3939
+ onValidateCoupon: D.apply,
3940
+ onRemoveCoupon: D.reset,
3941
+ offers: D.offers,
3942
+ currency: v[0]?.ticket.currency
3943
+ }),
3944
+ ee && /* @__PURE__ */ M(Lr, {
3945
+ values: b.billing,
3946
+ onChange: b.setBillingField
3947
+ })
3948
+ ]
3949
+ })
3950
+ })] });
3951
+ }, Ji = ({ selectedTicket: e, discount: t }) => {
3952
+ let [n, r] = A(!1), i = e?.currency, a = Ur(e, t), o = Gr(e, t), s = Kr(e, t), c = t?.discount ?? 0, l = s.length > 0 || c > 0 || o !== a, u = /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ N("span", {
3953
+ className: "inline-flex items-center gap-1.5",
3954
+ children: ["Total", l && /* @__PURE__ */ M(oe, { className: X("size-4 text-ink-muted transition-transform", n && "rotate-180") })]
3955
+ }), /* @__PURE__ */ M("span", { children: Z({
3956
+ unit_amount: a,
3957
+ currency: i
3958
+ }) })] }), d = "flex w-full items-center justify-between gap-3 px-3.5 py-3 font-semibold text-[15px] text-ink";
3959
+ return /* @__PURE__ */ N("div", {
3960
+ className: "rounded-xl border border-border bg-ink/3",
3961
+ children: [l ? /* @__PURE__ */ M("button", {
3962
+ type: "button",
3963
+ onClick: () => r((e) => !e),
3964
+ "aria-expanded": n,
3965
+ className: d,
3966
+ children: u
3967
+ }) : /* @__PURE__ */ M("div", {
3968
+ className: d,
3969
+ children: u
3970
+ }), l && /* @__PURE__ */ M(kr, {
3971
+ open: n,
3972
+ children: /* @__PURE__ */ N("div", {
3973
+ className: "flex flex-col gap-1.5 px-3.5 pb-3 text-[13px] text-ink-soft",
3974
+ children: [
3975
+ /* @__PURE__ */ N("div", {
3976
+ className: "flex items-center justify-between gap-3",
3977
+ children: [/* @__PURE__ */ M("span", { children: "Subtotal" }), /* @__PURE__ */ M("span", { children: Z({
3978
+ unit_amount: o,
3979
+ currency: i
3980
+ }) })]
3981
+ }),
3982
+ c > 0 && /* @__PURE__ */ N("div", {
3983
+ className: "flex items-center justify-between gap-3 text-emerald-700 dark:text-emerald-400",
3984
+ children: [/* @__PURE__ */ M("span", { children: "Discount" }), /* @__PURE__ */ N("span", { children: ["-", Z({
3985
+ unit_amount: c,
3986
+ currency: i
3987
+ })] })]
3988
+ }),
3989
+ s.map((e, t) => /* @__PURE__ */ N("div", {
3990
+ className: "flex items-center justify-between gap-3",
3991
+ children: [/* @__PURE__ */ N("span", { children: [
3992
+ e.label,
3993
+ " (",
3994
+ e.percentage,
3995
+ "%)"
3996
+ ] }), /* @__PURE__ */ M("span", { children: Z({
3997
+ unit_amount: e.amount,
3998
+ currency: i
3999
+ }) })]
4000
+ }, e.id || e._id || t)),
4001
+ e?.tax_inclusive && /* @__PURE__ */ M("p", {
4002
+ className: "m-0 text-ink-muted text-xs",
4003
+ children: "Price is inclusive of taxes"
4004
+ })
4005
+ ]
4006
+ })
4007
+ })]
4008
+ });
4009
+ }, Yi = ({ tickets: e, selectedTicket: t, onSelect: n, error: r }) => {
4010
+ let [i, a] = A(!t);
4011
+ return /* @__PURE__ */ N("fieldset", {
4012
+ className: "m-0 flex min-w-0 flex-col gap-2 border-0 p-0",
4013
+ children: [
4014
+ /* @__PURE__ */ M("legend", {
4015
+ className: "mb-2 p-0 font-medium text-ink text-sm",
4016
+ children: "Choose your ticket"
4017
+ }),
4018
+ /* @__PURE__ */ M("div", {
4019
+ className: "-mb-2 flex flex-col",
4020
+ children: e.map((r) => {
4021
+ let o = r._id === t?._id, s = i || o, c = Br(r);
4022
+ return /* @__PURE__ */ M(kr, {
4023
+ open: s,
4024
+ children: /* @__PURE__ */ N("label", {
4025
+ 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"),
4026
+ children: [
4027
+ /* @__PURE__ */ M("input", {
4028
+ type: "radio",
4029
+ name: "ticket",
4030
+ value: r._id,
4031
+ checked: o,
4032
+ onChange: () => {
4033
+ n(r), a(!1);
4034
+ },
4035
+ onClick: () => {
4036
+ i || a(!0);
4037
+ },
4038
+ className: "sr-only"
4039
+ }),
4040
+ /* @__PURE__ */ M("span", {
4041
+ "aria-hidden": !0,
4042
+ className: X("mt-0.5 size-[17px] shrink-0 rounded-full border transition-all", o ? "border-[5px] border-brand" : "border-border")
4043
+ }),
4044
+ /* @__PURE__ */ N("span", {
4045
+ className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
4046
+ children: [/* @__PURE__ */ M("span", {
4047
+ className: "block font-medium text-[14.5px] text-ink leading-snug",
4048
+ children: r.title
4049
+ }), r.description && /* @__PURE__ */ M("span", {
4050
+ title: r.description,
4051
+ className: X("mt-0.5 block text-[12.5px] text-ink-soft leading-snug", !i && "line-clamp-2"),
4052
+ children: r.description
4053
+ })]
4054
+ }),
4055
+ /* @__PURE__ */ N("span", {
4056
+ className: "flex shrink-0 flex-col items-end gap-1.5",
4057
+ children: [/* @__PURE__ */ N("span", {
4058
+ className: "text-right font-medium text-[14.5px] text-ink",
4059
+ children: [Z(r), c && /* @__PURE__ */ M("span", {
4060
+ className: "block font-normal text-[11.5px] text-ink-muted",
4061
+ children: c
4062
+ })]
4063
+ }), o && !i && e.length > 1 && /* @__PURE__ */ N("span", {
4064
+ 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",
4065
+ children: [
4066
+ e.length - 1,
4067
+ " more",
4068
+ /* @__PURE__ */ M(oe, {
4069
+ "aria-hidden": !0,
4070
+ className: "size-3.5"
4071
+ })
4072
+ ]
4073
+ })]
4074
+ })
4075
+ ]
4076
+ })
4077
+ }, r._id);
4078
+ })
4079
+ }),
4080
+ r && /* @__PURE__ */ M("p", {
4081
+ className: "m-0 text-danger text-xs",
4082
+ children: r
4083
+ })
4084
+ ]
4085
+ });
4086
+ }, Xi = (e) => e.enableMultipleTicketBooking && !e.external ? /* @__PURE__ */ M(qi, { ...e }, e.eventID) : /* @__PURE__ */ M(Zi, { ...e }, e.eventID), Zi = ({ eventID: e, title: t, external: n, buttonText: r = "Register Now", startsAt: i, endsAt: a, eventUrl: o }) => {
4087
+ let { account: s } = nt(), c = cr(), l = Ai({
3395
4088
  eventID: e,
3396
4089
  external: n
3397
- }), u = l.selectedTicket?.registration_fields ?? $r, d = di(s, u), f = Pr(l.selectedTicket, null)?.isFree === !1, [p, m] = A(null), [h, g] = A(null);
3398
- E(() => {
3399
- let t = ai(e);
3400
- t && g({ email: t.email });
3401
- }, [e]);
3402
- let _ = wi({ canAutoOpen: !n && !l.isLoading && l.tickets.length > 0 && !h }), v = k(null), y = fi({
4090
+ }), u = l.selectedTicket?.registration_fields ?? mi, d = Ci(s, u), f = Wr(l.selectedTicket, null)?.isFree === !1, p = Hi(e), { booking: m } = p, h = Gi({ canAutoOpen: !n && !l.isLoading && l.tickets.length > 0 && !p.registeredEmail }), g = k(null), _ = Oi({
3403
4091
  eventID: e,
3404
- selectedTicket: l.selectedTicket,
3405
- enabled: _.isOpen && f
3406
- }), b = Pr(l.selectedTicket, y.discount), x = !!b && !b.isFree, S = l.tickets.length > 1, C = O(() => Vr(i, a), [i, a]), w = t || "this event", T = S || x, D = xi({
4092
+ tickets: l.selectedTicket ? [l.selectedTicket] : [],
4093
+ enabled: h.isOpen && f
4094
+ }), v = Wr(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 || f, w = Li({
3407
4095
  eventID: e,
3408
4096
  details: {
3409
4097
  merchantName: c?.name || t || "",
@@ -3411,169 +4099,122 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3411
4099
  prefill: {
3412
4100
  name: d.values.name.trim(),
3413
4101
  email: d.values.email.trim(),
3414
- contact: ei(d.values.mobile)
4102
+ contact: hi(d.values.mobile)
3415
4103
  }
3416
4104
  },
3417
- onConfirmed: (t) => {
3418
- let n = d.values.email.trim();
3419
- m(t), g({ email: n }), oi(e, {
3420
- bookingId: t._id,
3421
- email: n,
3422
- at: (/* @__PURE__ */ new Date()).toISOString()
3423
- });
3424
- }
3425
- }), { state: j } = D, F = j.kind === "busy", I = (e) => {
3426
- y.reset(), D.reset(), l.selectTicket(e);
3427
- }, L = () => {
3428
- si(e), g(null), m(null), D.reset(), d.reset();
3429
- }, R = (t) => {
3430
- t.preventDefault(), d.markSubmitted(), !(!l.selectedTicket || !d.isValid) && D.register({
4105
+ onConfirmed: (e) => p.complete(e, d.values.email.trim())
4106
+ }), T = (e) => {
4107
+ _.reset(), w.reset(), l.selectTicket(e);
4108
+ }, E = () => {
4109
+ p.clear(), w.reset(), d.reset();
4110
+ }, D = (t) => {
4111
+ t.preventDefault(), d.markSubmitted(), !(!l.selectedTicket || !d.isValid) && w.register({
3431
4112
  event: e,
3432
- coupon: y.code,
4113
+ coupon: _.applied?.code ?? "",
3433
4114
  attendees: [{
3434
4115
  name: d.values.name.trim(),
3435
4116
  email: d.values.email.trim(),
3436
- ...ni(d.values, u),
4117
+ ..._i(d.values, u),
3437
4118
  ticket: l.selectedTicket._id,
3438
4119
  details: {}
3439
4120
  }],
3440
- ...d.values.is_business_purchase && x ? {
4121
+ ...d.values.is_business_purchase && y ? {
3441
4122
  is_business_purchase: !0,
3442
4123
  billing_details: d.values.billing_details
3443
4124
  } : {}
3444
4125
  });
3445
4126
  };
3446
- if (n) return /* @__PURE__ */ N("div", {
4127
+ if (n) return /* @__PURE__ */ M("div", {
3447
4128
  className: "my-2",
3448
- children: /* @__PURE__ */ N("button", {
4129
+ children: /* @__PURE__ */ M("button", {
3449
4130
  type: "button",
3450
- className: Ti,
4131
+ className: si,
3451
4132
  onClick: () => window.open(n, "_blank", "noopener,noreferrer"),
3452
4133
  children: r
3453
4134
  })
3454
4135
  });
3455
- if (!l.isLoading && l.tickets.length === 0) return /* @__PURE__ */ N("div", {
3456
- className: "my-2",
3457
- children: /* @__PURE__ */ N("p", {
3458
- className: "m-0 text-ink-soft text-sm",
3459
- children: l.hasFailed ? "We couldn't load tickets for this event. Please refresh the page." : "Registration isn't open for this event yet."
3460
- })
3461
- });
3462
- let z = b ? b.isFree ? "Save my spot" : `Pay ${Q({
3463
- unit_amount: b.amount,
3464
- currency: b.currency
4136
+ if (!l.isLoading && l.tickets.length === 0) return /* @__PURE__ */ M(li, { hasFailed: l.hasFailed });
4137
+ let A = v ? v.isFree ? "Save my spot" : `Pay ${Z({
4138
+ unit_amount: v.amount,
4139
+ currency: v.currency
3465
4140
  })}` : "Choose a ticket";
3466
- return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("div", {
3467
- className: "my-2",
3468
- children: h && !_.isOpen ? /* @__PURE__ */ P("span", {
3469
- 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",
3470
- children: [
3471
- /* @__PURE__ */ N(ae, { className: "size-4 text-emerald-600 dark:text-emerald-400" }),
3472
- "You're registered as ",
3473
- h.email,
3474
- /* @__PURE__ */ N("button", {
3475
- type: "button",
3476
- onClick: L,
3477
- className: "text-ink-soft underline underline-offset-[3px] hover:text-ink",
3478
- children: "Register someone else"
3479
- })
3480
- ]
3481
- }) : /* @__PURE__ */ N("button", {
3482
- type: "button",
3483
- onClick: _.open,
3484
- disabled: l.isLoading,
3485
- className: Z(Ti, "disabled:opacity-60"),
3486
- children: r
3487
- })
3488
- }), /* @__PURE__ */ N(Jr, {
3489
- open: _.isOpen,
3490
- title: p ? w : `Register for ${w}`,
3491
- when: C,
3492
- wide: S,
3493
- onClose: _.close,
4141
+ return /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(ci, {
4142
+ buttonText: r,
4143
+ registeredEmail: p.registeredEmail,
4144
+ isSheetOpen: h.isOpen,
4145
+ isLoading: l.isLoading,
4146
+ onOpen: h.open,
4147
+ onRegisterAnother: E
4148
+ }), /* @__PURE__ */ M(oi, {
4149
+ open: h.isOpen,
4150
+ title: m ? S : `Register for ${S}`,
4151
+ when: x,
4152
+ wide: b,
4153
+ onClose: h.close,
3494
4154
  onClosed: () => {
3495
- D.reset(), d.resetValidationDisplay();
4155
+ w.reset(), d.resetValidationDisplay();
3496
4156
  },
3497
- initialFocusRef: S ? void 0 : v,
3498
- layers: D.checkoutElement,
3499
- onSubmit: p ? void 0 : R,
3500
- footer: p ? void 0 : /* @__PURE__ */ P(M, { children: [
3501
- (j.kind === "unpaid" || j.kind === "failed") && /* @__PURE__ */ P("p", {
3502
- role: "alert",
3503
- 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",
3504
- children: [j.message, j.kind === "unpaid" && /* @__PURE__ */ N("button", {
3505
- type: "button",
3506
- onClick: D.retry,
3507
- className: "ml-1.5 inline-flex items-center gap-1 font-semibold underline underline-offset-[3px]",
3508
- children: "Pay again"
3509
- })]
3510
- }),
3511
- /* @__PURE__ */ P("button", {
3512
- type: "submit",
3513
- disabled: F,
3514
- 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",
3515
- children: [F && /* @__PURE__ */ N(se, { className: "size-4 animate-spin" }), F && j.stage === "paying" ? "Opening secure checkout" : z]
3516
- }),
3517
- /* @__PURE__ */ N("p", {
3518
- className: "m-0 mt-2 text-center text-ink-muted text-xs",
3519
- children: x ? "Secure payment · confirmation sent to your email" : "No card needed · joining link sent to your email"
3520
- })
3521
- ] }),
3522
- children: p ? /* @__PURE__ */ N(Qr, {
4157
+ initialFocusRef: b ? void 0 : g,
4158
+ layers: w.checkoutElement,
4159
+ onSubmit: m ? void 0 : D,
4160
+ footer: m ? void 0 : /* @__PURE__ */ M(Xr, {
4161
+ payment: w,
4162
+ label: A,
4163
+ isPaid: y
4164
+ }),
4165
+ children: m ? /* @__PURE__ */ M(pi, {
3523
4166
  email: d.values.email.trim(),
3524
- eventTitle: w,
4167
+ eventTitle: S,
3525
4168
  startsAt: i,
3526
4169
  endsAt: a,
3527
4170
  eventUrl: o,
3528
- when: C,
3529
- bookingRef: p._id,
3530
- qrImageUrl: p.qr_image?.location,
3531
- invoiceUrl: p.invoice?.location,
3532
- onClose: _.close,
3533
- onRegisterAnother: L
3534
- }) : /* @__PURE__ */ P("div", {
4171
+ when: x,
4172
+ bookingRef: m._id,
4173
+ qrImageUrl: m.qr_image?.location,
4174
+ invoiceUrl: m.invoice?.location,
4175
+ onClose: h.close,
4176
+ onRegisterAnother: E
4177
+ }) : /* @__PURE__ */ N("div", {
3535
4178
  className: "flex flex-col gap-4",
3536
4179
  children: [
3537
- S && /* @__PURE__ */ N(ci, {
4180
+ b && /* @__PURE__ */ M(Yi, {
3538
4181
  tickets: l.tickets,
3539
4182
  selectedTicket: l.selectedTicket,
3540
- onSelect: I,
4183
+ onSelect: T,
3541
4184
  error: d.submitAttempted && !l.selectedTicket ? "Choose a ticket to continue" : void 0
3542
4185
  }),
3543
- x && /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(Kr, {
4186
+ f && /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(Ji, {
3544
4187
  selectedTicket: l.selectedTicket,
3545
- discount: y.discount
3546
- }), /* @__PURE__ */ N(zr, {
3547
- couponCode: y.code,
3548
- onCouponCodeChange: y.setCode,
3549
- couponError: y.error,
3550
- couponLoading: y.isLoading,
3551
- onValidateCoupon: y.apply,
3552
- onRemoveCoupon: y.reset,
3553
- publicCoupons: y.publicCoupons,
3554
- discount: y.discount,
3555
- selectedTicket: l.selectedTicket
4188
+ discount: _.discount
4189
+ }), /* @__PURE__ */ M(Qr, {
4190
+ applied: _.applied,
4191
+ pending: _.pending,
4192
+ couponError: _.error,
4193
+ onValidateCoupon: _.apply,
4194
+ onRemoveCoupon: _.reset,
4195
+ offers: _.offers,
4196
+ currency: l.selectedTicket?.currency
3556
4197
  })] }),
3557
- /* @__PURE__ */ P("div", {
3558
- className: Z("flex flex-col gap-4", T && "border-border border-t pt-4"),
3559
- children: [T && /* @__PURE__ */ N("span", {
4198
+ /* @__PURE__ */ N("div", {
4199
+ className: X("flex flex-col gap-4", C && "border-border border-t pt-4"),
4200
+ children: [C && /* @__PURE__ */ M("span", {
3560
4201
  className: "font-medium text-ink text-sm",
3561
4202
  children: "Your details"
3562
- }), /* @__PURE__ */ N(Or, {
4203
+ }), /* @__PURE__ */ M(Ir, {
3563
4204
  values: d.values,
3564
4205
  errors: d.errors,
3565
4206
  touched: d.touched,
3566
4207
  onChange: d.setField,
3567
4208
  onBlur: d.touchField,
3568
- showBusinessBilling: x,
4209
+ showBusinessBilling: y,
3569
4210
  registrationFields: u,
3570
- nameInputRef: v
4211
+ nameInputRef: g
3571
4212
  })]
3572
4213
  })
3573
4214
  ]
3574
4215
  })
3575
4216
  })] });
3576
- }, Di = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, Oi = (e) => typeof e == "string" && e.trim() ? e : void 0, ki = (e) => typeof e == "string" ? e : e?.location ?? void 0, Ai = (e, t) => {
4217
+ }, Qi = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, $i = (e) => typeof e == "string" && e.trim() ? e : void 0, ea = (e) => typeof e == "string" ? e : e?.location ?? void 0, ta = (e, t) => {
3577
4218
  let n = e.meta ?? {}, r = e.title && t ? `${e.title} | ${t}` : e.title || t || void 0;
3578
4219
  return {
3579
4220
  title: n.meta_title || r,
@@ -3583,32 +4224,32 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3583
4224
  og: {
3584
4225
  title: n.og_title || void 0,
3585
4226
  description: n.og_description || void 0,
3586
- image: ki(n.og_image),
4227
+ image: ea(n.og_image),
3587
4228
  url: n.og_url || void 0
3588
4229
  },
3589
4230
  twitter: { card: n.twitter_card || void 0 },
3590
4231
  ldJson: n.ld_json || void 0,
3591
4232
  customHead: n.head_code || void 0
3592
4233
  };
3593
- }, ji = (e) => ({
4234
+ }, na = (e) => ({
3594
4235
  description: e.description || void 0,
3595
4236
  customHead: e.settings?.head_code || void 0
3596
- }), Mi = (e) => (t = {}, n) => (r) => {
3597
- let i = Ai(t, e.name);
4237
+ }), ra = (e) => (t = {}, n) => (r) => {
4238
+ let i = ta(t, e.name);
3598
4239
  if (n) {
3599
4240
  let t = r?.loaderData?.[n.source];
3600
4241
  if (t) {
3601
- let r = n.title ? Oi(t[n.title]) : void 0;
4242
+ let r = n.title ? $i(t[n.title]) : void 0;
3602
4243
  r && (i.title = e.name ? `${r} | ${e.name}` : r, i.og = {
3603
4244
  ...i.og,
3604
4245
  title: r
3605
4246
  });
3606
- let a = n.description ? Oi(t[n.description]) : void 0;
4247
+ let a = n.description ? $i(t[n.description]) : void 0;
3607
4248
  a && (i.description = a, i.og = {
3608
4249
  ...i.og,
3609
4250
  description: a
3610
4251
  });
3611
- let o = n.image ? ki(t[n.image]) : void 0;
4252
+ let o = n.image ? ea(t[n.image]) : void 0;
3612
4253
  o && (i.og = {
3613
4254
  ...i.og,
3614
4255
  image: o
@@ -3617,31 +4258,31 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3617
4258
  }
3618
4259
  if (!i.canonical) {
3619
4260
  let t = r?.match?.pathname, n = (e.domain || "").trim();
3620
- n && t?.startsWith("/") && (i.canonical = (/^https?:\/\//.test(n) ? n : `https://${n}`).replace(/\/+$/, "") + Di(t));
4261
+ n && t?.startsWith("/") && (i.canonical = (/^https?:\/\//.test(n) ? n : `https://${n}`).replace(/\/+$/, "") + Qi(t));
3621
4262
  }
3622
- let a = yr(i, ji(e)), o = t.id?.trim();
4263
+ let a = Dr(i, na(e)), o = t.id?.trim();
3623
4264
  return o && a.meta.push({
3624
- name: Jn,
4265
+ name: nr,
3625
4266
  content: o
3626
4267
  }), a;
3627
- }, Ni = (e) => e.params, Pi = (e) => {
3628
- let t = ke(e);
4268
+ }, ia = (e) => e.params, aa = (e) => {
4269
+ let t = Ne(e);
3629
4270
  return (e, n) => {
3630
- let { rules: r, invalid: i } = xe(n?.access), a = r.length > 0 || i;
3631
- return (n) => a ? Promise.resolve({}) : Ye({
4271
+ let { rules: r, invalid: i } = Te(n?.access), a = r.length > 0 || i;
4272
+ return (n) => a ? Promise.resolve({}) : $e({
3632
4273
  queryClient: n.context.queryClient,
3633
4274
  config: t,
3634
4275
  sources: e,
3635
- params: Ni(n)
4276
+ params: ia(n)
3636
4277
  });
3637
4278
  };
3638
- }, Fi = 2, Ii = (e) => {
3639
- let { limit: t = 20, debounceMs: n = 300, hotkey: r = !0 } = e ?? {}, a = i(), o = er(), s = G(), [c, l] = A(""), [u, d] = A(!1), [f, p] = A("");
4279
+ }, oa = 2, sa = (e) => {
4280
+ let { limit: t = 20, debounceMs: n = 300, hotkey: r = !0 } = e ?? {}, a = i(), o = cr(), s = K(), [c, l] = A(""), [u, d] = A(!1), [f, p] = A("");
3640
4281
  E(() => {
3641
4282
  let e = setTimeout(() => p(c.trim()), n);
3642
4283
  return () => clearTimeout(e);
3643
4284
  }, [c, n]);
3644
- let m = f.length >= Fi, h = R({
4285
+ let m = f.length >= oa, h = L({
3645
4286
  queryKey: [
3646
4287
  "levo-search",
3647
4288
  o?.id ?? null,
@@ -3661,7 +4302,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3661
4302
  }
3662
4303
  },
3663
4304
  enabled: s && !!a && !!o?.id && m,
3664
- placeholderData: I,
4305
+ placeholderData: F,
3665
4306
  staleTime: 3e4
3666
4307
  }), g = w(() => {
3667
4308
  l(""), p("");
@@ -3690,4 +4331,4 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3690
4331
  };
3691
4332
  };
3692
4333
  //#endregion
3693
- export { It as ColorModeProvider, Un as Inspector, me as LEVO_AUTH_METHODS, K as LEVO_AUTH_QUERY_KEY, pe as LEVO_OAUTH_METHODS, xt as LEVO_OTP_LENGTH, dt as LEVO_PENDING_APPROVAL_CODE, fe as LEVO_PRIMARY_AUTH_METHODS, m as LOCALE_COOKIE, l as LOCALE_REDIRECT_CACHE_CONTROL, Ot as LevoChat, $e as LevoEntryForm, Ei as LevoEventRegister, Rt as LevoForm, cr as LevoLink, Zn as LevoPopups, it as LevoProfileForm, rr as LevoSiteProvider, lr as LocaleHreflang, dr as LocaleProvider, Jn as PAGE_ID_META, br as PageHead, mr as SiteLocaleProvider, sr as buildHreflangLinks, Mi as createLevoHead, Pi as createLevoLoader, _ as createRouteTreeMatcher, Oe as createSiteClient, De as decideAccess, v as extractGeoAndLanguageData, ft as isPendingApprovalError, St as isValidEmail, Ct as isValidOtp, Tt as isValidPhone, Fe as levoParams, ir as localeBeforeLoad, p as localePath, d as localeRedirectResponse, wt as normalizePhone, yr as pageHead, xe as parseAccess, vr as parseRawHead, Ye as prefetchLevoSources, ar as readLocaleConfig, Yn as readPageId, Se as resolveAuthMethods, g as resolveLocale, u as resolveLocaleRedirect, s as resolveLocaleRequest, ke as siteConfigFromJson, f as splitLocalePrefix, Lt as useColorMode, hr as useLanguageOptions, ut as useLevoAccess, Qe as useLevoAuth, qe as useLevoForm, nr as useLevoInsights, ht as useLevoLogin, bt as useLevoOAuth, Et as useLevoOtpInput, Ke as useLevoRecord, Ii as useLevoSearch, tr as useLevoSite, Ge as useLevoSource, fr as useLocale, pr as useUrlLocale };
4334
+ export { Bt as ColorModeProvider, Zn as Inspector, _e as LEVO_AUTH_METHODS, q as LEVO_AUTH_QUERY_KEY, ge as LEVO_OAUTH_METHODS, Tt as LEVO_OTP_LENGTH, ht as LEVO_PENDING_APPROVAL_CODE, he as LEVO_PRIMARY_AUTH_METHODS, m as LOCALE_COOKIE, l as LOCALE_REDIRECT_CACHE_CONTROL, Mt as LevoChat, Ut as LevoEditForm, rt as LevoEntryForm, Xi as LevoEventRegister, Wt as LevoForm, gr as LevoLink, ar as LevoPopups, ct as LevoProfileForm, dr as LevoSiteProvider, _r as LocaleHreflang, yr as LocaleProvider, nr as PAGE_ID_META, Or as PageHead, Sr as SiteLocaleProvider, hr as buildHreflangLinks, ra as createLevoHead, aa as createLevoLoader, _ as createRouteTreeMatcher, Me as createSiteClient, je as decideAccess, v as extractGeoAndLanguageData, gt as isPendingApprovalError, Et as isValidEmail, Dt as isValidOtp, kt as isValidPhone, ze as levoParams, fr as localeBeforeLoad, p as localePath, d as localeRedirectResponse, Ot as normalizePhone, Dr as pageHead, Te as parseAccess, Er as parseRawHead, $e as prefetchLevoSources, pr as readLocaleConfig, rr as readPageId, Ee as resolveAuthMethods, g as resolveLocale, u as resolveLocaleRedirect, s as resolveLocaleRequest, Ne as siteConfigFromJson, f as splitLocalePrefix, Vt as useColorMode, Cr as useLanguageOptions, mt as useLevoAccess, nt as useLevoAuth, Ze as useLevoForm, ur as useLevoInsights, yt as useLevoLogin, wt as useLevoOAuth, At as useLevoOtpInput, Xe as useLevoRecord, sa as useLevoSearch, lr as useLevoSite, Ye as useLevoSource, br as useLocale, xr as useUrlLocale };