@a4ui/core 0.37.1 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +8 -7
  2. package/dist/Collapse-Cr5cDqAl.js +375 -0
  3. package/dist/charts/AreaChart.d.ts +38 -0
  4. package/dist/charts/BarChart.d.ts +17 -1
  5. package/dist/charts/PieChart.d.ts +29 -0
  6. package/dist/charts/RadialBarChart.d.ts +33 -0
  7. package/dist/charts/index.d.ts +5 -0
  8. package/dist/charts/shared.d.ts +111 -0
  9. package/dist/charts.js +1493 -780
  10. package/dist/commerce.js +625 -634
  11. package/dist/elements.css +1076 -8
  12. package/dist/elements.iife.js +1 -6
  13. package/dist/elements.js +7774 -9133
  14. package/dist/full.css +1076 -8
  15. package/dist/index.d.ts +30 -3
  16. package/dist/index.js +17502 -15126
  17. package/dist/layout/Aurora.d.ts +16 -0
  18. package/dist/layout/EffectsToggle.d.ts +1 -1
  19. package/dist/layout/SpaceBackground.d.ts +1 -1
  20. package/dist/motion-CTIBwMCA.js +104 -0
  21. package/dist/styles.css +110 -3
  22. package/dist/ui/AspectRatio.d.ts +19 -0
  23. package/dist/ui/Attachment.d.ts +70 -0
  24. package/dist/ui/ButtonGroup.d.ts +37 -0
  25. package/dist/ui/ChatMarker.d.ts +20 -0
  26. package/dist/ui/ChatThread.d.ts +32 -8
  27. package/dist/ui/ContactSection.d.ts +49 -0
  28. package/dist/ui/CtaBanner.d.ts +28 -0
  29. package/dist/ui/Drawer.d.ts +5 -2
  30. package/dist/ui/Faq.d.ts +29 -0
  31. package/dist/ui/FeatureGrid.d.ts +35 -0
  32. package/dist/ui/Field.d.ts +148 -0
  33. package/dist/ui/Hero.d.ts +48 -0
  34. package/dist/ui/InputGroup.d.ts +93 -0
  35. package/dist/ui/Item.d.ts +63 -0
  36. package/dist/ui/Label.d.ts +23 -0
  37. package/dist/ui/Menubar.d.ts +83 -0
  38. package/dist/ui/Message.d.ts +51 -5
  39. package/dist/ui/Modal.d.ts +8 -2
  40. package/dist/ui/NativeSelect.d.ts +26 -0
  41. package/dist/ui/NavigationMenu.d.ts +85 -0
  42. package/dist/ui/PromptComposer.d.ts +5 -0
  43. package/dist/ui/Prose.d.ts +21 -0
  44. package/dist/ui/Questionnaire.d.ts +71 -0
  45. package/dist/ui/ScrollArea.d.ts +30 -0
  46. package/dist/ui/Sidebar.d.ts +229 -0
  47. package/dist/ui/SiteFooter.d.ts +39 -0
  48. package/dist/ui/SiteNav.d.ts +35 -0
  49. package/dist/ui/TeamGrid.d.ts +33 -0
  50. package/dist/ui/Testimonials.d.ts +37 -0
  51. package/dist/ui/internal/sectionKit.d.ts +22 -0
  52. package/dist/ui/internal/socialIcons.d.ts +9 -0
  53. package/package.json +38 -26
  54. package/preset.d.ts +23 -0
  55. package/src/charts/AreaChart.tsx +206 -0
  56. package/src/charts/BarChart.tsx +241 -5
  57. package/src/charts/DonutChart.tsx +8 -11
  58. package/src/charts/LineChart.tsx +2 -3
  59. package/src/charts/PieChart.tsx +145 -0
  60. package/src/charts/RadialBarChart.tsx +141 -0
  61. package/src/charts/index.ts +14 -0
  62. package/src/charts/shared.tsx +304 -0
  63. package/src/index.ts +192 -3
  64. package/src/layout/Aurora.tsx +36 -7
  65. package/src/layout/sceneEffects.ts +22 -3
  66. package/src/ui/AspectRatio.tsx +35 -0
  67. package/src/ui/Attachment.tsx +189 -0
  68. package/src/ui/ButtonGroup.tsx +89 -0
  69. package/src/ui/ChatMarker.tsx +58 -0
  70. package/src/ui/ChatThread.tsx +115 -23
  71. package/src/ui/ContactSection.tsx +199 -0
  72. package/src/ui/CtaBanner.tsx +62 -0
  73. package/src/ui/DateField.tsx +2 -1
  74. package/src/ui/DateRangePicker.tsx +2 -1
  75. package/src/ui/Drawer.tsx +37 -4
  76. package/src/ui/Faq.tsx +57 -0
  77. package/src/ui/FeatureGrid.tsx +77 -0
  78. package/src/ui/Field.tsx +374 -0
  79. package/src/ui/Hero.tsx +146 -0
  80. package/src/ui/InputGroup.tsx +219 -0
  81. package/src/ui/Item.tsx +185 -0
  82. package/src/ui/Label.tsx +50 -0
  83. package/src/ui/Menubar.tsx +212 -0
  84. package/src/ui/Message.tsx +139 -13
  85. package/src/ui/Modal.tsx +41 -5
  86. package/src/ui/MultiSelect.tsx +2 -1
  87. package/src/ui/NativeSelect.tsx +66 -0
  88. package/src/ui/NavigationMenu.tsx +262 -0
  89. package/src/ui/PromptComposer.tsx +11 -0
  90. package/src/ui/Prose.tsx +63 -0
  91. package/src/ui/Questionnaire.tsx +331 -0
  92. package/src/ui/ScrollArea.tsx +70 -0
  93. package/src/ui/Sidebar.tsx +753 -0
  94. package/src/ui/SiteFooter.tsx +112 -0
  95. package/src/ui/SiteNav.tsx +146 -0
  96. package/src/ui/TeamGrid.tsx +81 -0
  97. package/src/ui/Testimonials.tsx +103 -0
  98. package/src/ui/TimeField.tsx +2 -1
  99. package/src/ui/internal/sectionKit.tsx +72 -0
  100. package/src/ui/internal/socialIcons.tsx +41 -0
  101. package/dist/NumberInput-Bnh2u7pp.js +0 -381
  102. package/dist/motion-jYMWmZqB.js +0 -119
package/dist/commerce.js CHANGED
@@ -1,650 +1,641 @@
1
- import { insert as n, createComponent as c, memo as k, effect as $, className as C, template as v, delegateEvents as A, setAttribute as w, setStyleProperty as j } from "solid-js/web";
2
- import { Show as b, For as S, createSignal as B, createMemo as R } from "solid-js";
3
- import { c as _ } from "./motion-jYMWmZqB.js";
4
- import { B as D, C as O, R as G, a as M, b as z, N as U, c as K } from "./NumberInput-Bnh2u7pp.js";
5
- import { Minus as Q, Plus as V, Trash2 as X, X as Z, CreditCard as H } from "lucide-solid";
6
- var J = /* @__PURE__ */ v('<span class="text-muted-foreground line-through">'), W = /* @__PURE__ */ v("<div><span>");
7
- const Y = {
8
- sm: "text-sm",
9
- md: "text-lg",
10
- lg: "text-2xl"
1
+ import { g as e } from "./motion-CTIBwMCA.js";
2
+ import { a as t, g as n, i as r, n as i, p as a, r as o, t as s } from "./Collapse-Cr5cDqAl.js";
3
+ import { For as c, Show as l, createMemo as u, createSignal as d } from "solid-js";
4
+ import { className as f, createComponent as p, delegateEvents as m, effect as h, insert as g, memo as _, setAttribute as v, setStyleProperty as y, template as b } from "solid-js/web";
5
+ import { CreditCard as x, Minus as S, Plus as C, Trash2 as w, X as ee } from "lucide-solid";
6
+ // src/commerce/PriceTag.tsx
7
+ var T = /*#__PURE__*/ b("<span class=\"text-muted-foreground line-through\">"), E = /*#__PURE__*/ b("<div><span>"), D = {
8
+ sm: "text-sm",
9
+ md: "text-lg",
10
+ lg: "text-2xl"
11
11
  };
12
- function L(e) {
13
- const i = (s) => new Intl.NumberFormat(e.locale ?? "en-US", {
14
- style: "currency",
15
- currency: e.currency ?? "USD"
16
- }).format(s), o = () => (e.compareAt ?? 0) > e.amount, r = () => Math.round((1 - e.amount / e.compareAt) * 100);
17
- return (() => {
18
- var s = W(), d = s.firstChild;
19
- return n(d, () => i(e.amount)), n(s, c(b, {
20
- get when() {
21
- return o();
22
- },
23
- get children() {
24
- return [(() => {
25
- var a = J();
26
- return n(a, () => i(e.compareAt)), a;
27
- })(), c(D, {
28
- tone: "danger",
29
- get children() {
30
- return ["-", k(() => r()), "%"];
31
- }
32
- })];
33
- }
34
- }), null), $((a) => {
35
- var t = _("inline-flex items-center gap-2", e.class), u = _("font-bold text-foreground", Y[e.size ?? "md"]);
36
- return t !== a.e && C(s, a.e = t), u !== a.t && C(d, a.t = u), a;
37
- }, {
38
- e: void 0,
39
- t: void 0
40
- }), s;
41
- })();
12
+ function O(t) {
13
+ let r = (e) => new Intl.NumberFormat(t.locale ?? "en-US", {
14
+ style: "currency",
15
+ currency: t.currency ?? "USD"
16
+ }).format(e), i = () => (t.compareAt ?? 0) > t.amount, a = () => Math.round((1 - t.amount / t.compareAt) * 100);
17
+ return (() => {
18
+ var o = E(), s = o.firstChild;
19
+ return g(s, () => r(t.amount)), g(o, p(l, {
20
+ get when() {
21
+ return i();
22
+ },
23
+ get children() {
24
+ return [(() => {
25
+ var e = T();
26
+ return g(e, () => r(t.compareAt)), e;
27
+ })(), p(n, {
28
+ tone: "danger",
29
+ get children() {
30
+ return [
31
+ "-",
32
+ _(() => a()),
33
+ "%"
34
+ ];
35
+ }
36
+ })];
37
+ }
38
+ }), null), h((n) => {
39
+ var r = e("inline-flex items-center gap-2", t.class), i = e("font-bold text-foreground", D[t.size ?? "md"]);
40
+ return r !== n.e && f(o, n.e = r), i !== n.t && f(s, n.t = i), n;
41
+ }, {
42
+ e: void 0,
43
+ t: void 0
44
+ }), o;
45
+ })();
42
46
  }
43
- var p = /* @__PURE__ */ v('<div><button type=button aria-label="Decrease quantity"class="grid h-8 w-8 place-items-center hover:bg-muted disabled:opacity-40"></button><span class="grid min-w-[2.5rem] place-items-center tabular-nums"></span><button type=button aria-label="Increase quantity"class="grid h-8 w-8 place-items-center hover:bg-muted disabled:opacity-40">');
44
- function ee(e) {
45
- const i = () => e.min ?? 0, o = () => e.max ?? Number.MAX_SAFE_INTEGER, r = (a) => Math.min(o(), Math.max(i(), a)), s = () => e.onChange(r(e.value - 1)), d = () => e.onChange(r(e.value + 1));
46
- return (() => {
47
- var a = p(), t = a.firstChild, u = t.nextSibling, f = u.nextSibling;
48
- return t.$$click = s, n(t, c(Q, {
49
- class: "h-4 w-4"
50
- })), n(u, () => e.value), f.$$click = d, n(f, c(V, {
51
- class: "h-4 w-4"
52
- })), $((l) => {
53
- var g = _("inline-flex items-stretch rounded-md border border-input", e.class), h = e.disabled || e.value <= i(), m = e.disabled || e.value >= o();
54
- return g !== l.e && C(a, l.e = g), h !== l.t && (t.disabled = l.t = h), m !== l.a && (f.disabled = l.a = m), l;
55
- }, {
56
- e: void 0,
57
- t: void 0,
58
- a: void 0
59
- }), a;
60
- })();
47
+ // src/commerce/QuantityStepper.tsx
48
+ var k = /*#__PURE__*/ b("<div><button type=button aria-label=\"Decrease quantity\"class=\"grid h-8 w-8 place-items-center hover:bg-muted disabled:opacity-40\"></button><span class=\"grid min-w-[2.5rem] place-items-center tabular-nums\"></span><button type=button aria-label=\"Increase quantity\"class=\"grid h-8 w-8 place-items-center hover:bg-muted disabled:opacity-40\">");
49
+ function A(t) {
50
+ let n = () => t.min ?? 0, r = () => t.max ?? 2 ** 53 - 1, i = (e) => Math.min(r(), Math.max(n(), e)), a = () => t.onChange(i(t.value - 1)), o = () => t.onChange(i(t.value + 1));
51
+ return (() => {
52
+ var i = k(), s = i.firstChild, c = s.nextSibling, l = c.nextSibling;
53
+ return s.$$click = a, g(s, p(S, { class: "h-4 w-4" })), g(c, () => t.value), l.$$click = o, g(l, p(C, { class: "h-4 w-4" })), h((a) => {
54
+ var o = e("inline-flex items-stretch rounded-md border border-input", t.class), c = t.disabled || t.value <= n(), u = t.disabled || t.value >= r();
55
+ return o !== a.e && f(i, a.e = o), c !== a.t && (s.disabled = a.t = c), u !== a.a && (l.disabled = a.a = u), a;
56
+ }, {
57
+ e: void 0,
58
+ t: void 0,
59
+ a: void 0
60
+ }), i;
61
+ })();
61
62
  }
62
- A(["click"]);
63
- var te = /* @__PURE__ */ v("<span>"), ne = /* @__PURE__ */ v('<div class="relative aspect-square overflow-hidden rounded-lg bg-muted"><img loading=lazy class="h-full w-full object-cover">', !0, !1, !1), le = /* @__PURE__ */ v('<span class="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">'), re = /* @__PURE__ */ v('<span class="w-fit rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground">'), ae = /* @__PURE__ */ v('<div class="mt-3 flex flex-1 flex-col gap-1.5"><p class="line-clamp-1 font-medium text-foreground">');
64
- const ie = {
65
- sale: "bg-destructive text-destructive-foreground",
66
- new: "bg-primary text-primary-foreground",
67
- featured: "bg-accent text-accent-foreground"
63
+ m(["click"]);
64
+ // src/commerce/ProductCard.tsx
65
+ var j = /*#__PURE__*/ b("<span>"), M = /*#__PURE__*/ b("<div class=\"relative aspect-square overflow-hidden rounded-lg bg-muted\"><img loading=lazy class=\"h-full w-full object-cover\">", !0, !1, !1), N = /*#__PURE__*/ b("<span class=\"text-[11px] font-medium uppercase tracking-wide text-muted-foreground\">"), P = /*#__PURE__*/ b("<span class=\"w-fit rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground\">"), F = /*#__PURE__*/ b("<div class=\"mt-3 flex flex-1 flex-col gap-1.5\"><p class=\"line-clamp-1 font-medium text-foreground\">"), I = {
66
+ sale: "bg-destructive text-destructive-foreground",
67
+ new: "bg-primary text-primary-foreground",
68
+ featured: "bg-accent text-accent-foreground"
68
69
  };
69
- function ue(e, i) {
70
- if (i) return i;
71
- const o = (e ?? "").toLowerCase();
72
- return /sale|off|%|deal/.test(o) ? "sale" : /new/.test(o) ? "new" : "featured";
70
+ function L(e, t) {
71
+ if (t) return t;
72
+ let n = (e ?? "").toLowerCase();
73
+ return /sale|off|%|deal/.test(n) ? "sale" : /new/.test(n) ? "new" : "featured";
73
74
  }
74
- function De(e) {
75
- return c(O, {
76
- glass: !0,
77
- glow: !0,
78
- get tilt() {
79
- return e.tilt;
80
- },
81
- get spotlight() {
82
- return e.spotlight;
83
- },
84
- get class() {
85
- return _("flex h-full flex-col overflow-hidden p-4", e.class);
86
- },
87
- get children() {
88
- return [(() => {
89
- var i = ne(), o = i.firstChild;
90
- return n(i, c(b, {
91
- get when() {
92
- return e.badge;
93
- },
94
- get children() {
95
- var r = te();
96
- return n(r, () => e.badge), $(() => C(r, _("absolute -right-9 top-3.5 w-32 rotate-45 py-1 text-center text-[11px] font-semibold uppercase tracking-wide shadow-md", ie[ue(e.badge, e.badgeTone)]))), r;
97
- }
98
- }), null), $((r) => {
99
- var s = e.image, d = e.title;
100
- return s !== r.e && w(o, "src", r.e = s), d !== r.t && w(o, "alt", r.t = d), r;
101
- }, {
102
- e: void 0,
103
- t: void 0
104
- }), i;
105
- })(), (() => {
106
- var i = ae(), o = i.firstChild;
107
- return n(i, c(b, {
108
- get when() {
109
- return e.brand;
110
- },
111
- get children() {
112
- var r = le();
113
- return n(r, () => e.brand), r;
114
- }
115
- }), o), n(o, () => e.title), n(i, c(b, {
116
- get when() {
117
- return e.category;
118
- },
119
- get children() {
120
- var r = re();
121
- return n(r, () => e.category), r;
122
- }
123
- }), null), n(i, c(b, {
124
- get when() {
125
- return e.rating !== void 0;
126
- },
127
- get children() {
128
- return c(G, {
129
- get value() {
130
- return e.rating;
131
- },
132
- readonly: !0,
133
- max: 5
134
- });
135
- }
136
- }), null), n(i, c(L, {
137
- get amount() {
138
- return e.price;
139
- },
140
- get compareAt() {
141
- return e.compareAt;
142
- },
143
- get currency() {
144
- return e.currency;
145
- },
146
- get locale() {
147
- return e.locale;
148
- }
149
- }), null), n(i, c(b, {
150
- get when() {
151
- return e.onAddToCart;
152
- },
153
- get children() {
154
- return c(M, {
155
- class: "mt-auto w-full",
156
- onClick: (r) => {
157
- var s;
158
- r.stopPropagation(), (s = e.onAddToCart) == null || s.call(e);
159
- },
160
- children: "Add to cart"
161
- });
162
- }
163
- }), null), i;
164
- })()];
165
- }
166
- });
75
+ function R(n) {
76
+ return p(t, {
77
+ glass: !0,
78
+ glow: !0,
79
+ get tilt() {
80
+ return n.tilt;
81
+ },
82
+ get spotlight() {
83
+ return n.spotlight;
84
+ },
85
+ get class() {
86
+ return e("flex h-full flex-col overflow-hidden p-4", n.class);
87
+ },
88
+ get children() {
89
+ return [(() => {
90
+ var t = M(), r = t.firstChild;
91
+ return g(t, p(l, {
92
+ get when() {
93
+ return n.badge;
94
+ },
95
+ get children() {
96
+ var t = j();
97
+ return g(t, () => n.badge), h(() => f(t, e("absolute -right-9 top-3.5 w-32 rotate-45 py-1 text-center text-[11px] font-semibold uppercase tracking-wide shadow-md", I[L(n.badge, n.badgeTone)]))), t;
98
+ }
99
+ }), null), h((e) => {
100
+ var t = n.image, i = n.title;
101
+ return t !== e.e && v(r, "src", e.e = t), i !== e.t && v(r, "alt", e.t = i), e;
102
+ }, {
103
+ e: void 0,
104
+ t: void 0
105
+ }), t;
106
+ })(), (() => {
107
+ var e = F(), t = e.firstChild;
108
+ return g(e, p(l, {
109
+ get when() {
110
+ return n.brand;
111
+ },
112
+ get children() {
113
+ var e = N();
114
+ return g(e, () => n.brand), e;
115
+ }
116
+ }), t), g(t, () => n.title), g(e, p(l, {
117
+ get when() {
118
+ return n.category;
119
+ },
120
+ get children() {
121
+ var e = P();
122
+ return g(e, () => n.category), e;
123
+ }
124
+ }), null), g(e, p(l, {
125
+ get when() {
126
+ return n.rating !== void 0;
127
+ },
128
+ get children() {
129
+ return p(i, {
130
+ get value() {
131
+ return n.rating;
132
+ },
133
+ readonly: !0,
134
+ max: 5
135
+ });
136
+ }
137
+ }), null), g(e, p(O, {
138
+ get amount() {
139
+ return n.price;
140
+ },
141
+ get compareAt() {
142
+ return n.compareAt;
143
+ },
144
+ get currency() {
145
+ return n.currency;
146
+ },
147
+ get locale() {
148
+ return n.locale;
149
+ }
150
+ }), null), g(e, p(l, {
151
+ get when() {
152
+ return n.onAddToCart;
153
+ },
154
+ get children() {
155
+ return p(a, {
156
+ class: "mt-auto w-full",
157
+ onClick: (e) => {
158
+ e.stopPropagation(), n.onAddToCart?.();
159
+ },
160
+ children: "Add to cart"
161
+ });
162
+ }
163
+ }), null), e;
164
+ })()];
165
+ }
166
+ });
167
167
  }
168
- var ce = /* @__PURE__ */ v("<div>");
169
- function Le(e) {
170
- return (() => {
171
- var i = ce();
172
- return n(i, () => e.children), $(() => C(i, _("grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4", e.class))), i;
173
- })();
168
+ // src/commerce/ProductGrid.tsx
169
+ var z = /*#__PURE__*/ b("<div>");
170
+ function B(t) {
171
+ return (() => {
172
+ var n = z();
173
+ return g(n, () => t.children), h(() => f(n, e("grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4", t.class))), n;
174
+ })();
174
175
  }
175
- var de = /* @__PURE__ */ v('<img class="h-16 w-16 shrink-0 rounded-md bg-muted object-cover">'), oe = /* @__PURE__ */ v('<button type=button aria-label="Remove item"class="text-muted-foreground hover:text-foreground">'), se = /* @__PURE__ */ v('<div><div class="min-w-[8rem] flex-1"><p class="line-clamp-1 font-medium text-foreground"></p></div><span class="min-w-[4rem] text-right font-medium tabular-nums text-foreground">');
176
- function Oe(e) {
177
- const i = () => e.price * e.quantity, o = (r) => new Intl.NumberFormat(e.locale ?? "en-US", {
178
- style: "currency",
179
- currency: e.currency ?? "USD"
180
- }).format(r);
181
- return (() => {
182
- var r = se(), s = r.firstChild, d = s.firstChild, a = s.nextSibling;
183
- return n(r, c(b, {
184
- get when() {
185
- return e.image;
186
- },
187
- get children() {
188
- var t = de();
189
- return $((u) => {
190
- var f = e.image, l = e.title;
191
- return f !== u.e && w(t, "src", u.e = f), l !== u.t && w(t, "alt", u.t = l), u;
192
- }, {
193
- e: void 0,
194
- t: void 0
195
- }), t;
196
- }
197
- }), s), n(d, () => e.title), n(s, c(L, {
198
- get amount() {
199
- return e.price;
200
- },
201
- get currency() {
202
- return e.currency;
203
- },
204
- get locale() {
205
- return e.locale;
206
- },
207
- size: "sm"
208
- }), null), n(r, c(ee, {
209
- get value() {
210
- return e.quantity;
211
- },
212
- onChange: (t) => {
213
- var u;
214
- return (u = e.onQuantityChange) == null ? void 0 : u.call(e, t);
215
- },
216
- min: 1
217
- }), a), n(a, () => o(i())), n(r, c(b, {
218
- get when() {
219
- return e.onRemove;
220
- },
221
- get children() {
222
- var t = oe();
223
- return t.$$click = () => {
224
- var u;
225
- return (u = e.onRemove) == null ? void 0 : u.call(e);
226
- }, n(t, c(X, {
227
- class: "h-4 w-4"
228
- })), t;
229
- }
230
- }), null), $(() => C(r, _("flex flex-wrap items-center gap-4", e.class))), r;
231
- })();
176
+ // src/commerce/CartLine.tsx
177
+ var V = /*#__PURE__*/ b("<img class=\"h-16 w-16 shrink-0 rounded-md bg-muted object-cover\">"), H = /*#__PURE__*/ b("<button type=button aria-label=\"Remove item\"class=\"text-muted-foreground hover:text-foreground\">"), U = /*#__PURE__*/ b("<div><div class=\"min-w-[8rem] flex-1\"><p class=\"line-clamp-1 font-medium text-foreground\"></p></div><span class=\"min-w-[4rem] text-right font-medium tabular-nums text-foreground\">");
178
+ function W(t) {
179
+ let n = () => t.price * t.quantity, r = (e) => new Intl.NumberFormat(t.locale ?? "en-US", {
180
+ style: "currency",
181
+ currency: t.currency ?? "USD"
182
+ }).format(e);
183
+ return (() => {
184
+ var i = U(), a = i.firstChild, o = a.firstChild, s = a.nextSibling;
185
+ return g(i, p(l, {
186
+ get when() {
187
+ return t.image;
188
+ },
189
+ get children() {
190
+ var e = V();
191
+ return h((n) => {
192
+ var r = t.image, i = t.title;
193
+ return r !== n.e && v(e, "src", n.e = r), i !== n.t && v(e, "alt", n.t = i), n;
194
+ }, {
195
+ e: void 0,
196
+ t: void 0
197
+ }), e;
198
+ }
199
+ }), a), g(o, () => t.title), g(a, p(O, {
200
+ get amount() {
201
+ return t.price;
202
+ },
203
+ get currency() {
204
+ return t.currency;
205
+ },
206
+ get locale() {
207
+ return t.locale;
208
+ },
209
+ size: "sm"
210
+ }), null), g(i, p(A, {
211
+ get value() {
212
+ return t.quantity;
213
+ },
214
+ onChange: (e) => t.onQuantityChange?.(e),
215
+ min: 1
216
+ }), s), g(s, () => r(n())), g(i, p(l, {
217
+ get when() {
218
+ return t.onRemove;
219
+ },
220
+ get children() {
221
+ var e = H();
222
+ return e.$$click = () => t.onRemove?.(), g(e, p(w, { class: "h-4 w-4" })), e;
223
+ }
224
+ }), null), h(() => f(i, e("flex flex-wrap items-center gap-4", t.class))), i;
225
+ })();
232
226
  }
233
- A(["click"]);
234
- var me = /* @__PURE__ */ v('<div><div class="my-3 border-t border-border"></div><div class="flex items-center justify-between text-base font-bold text-foreground"><span>Total</span><span class=tabular-nums>'), ge = /* @__PURE__ */ v('<div class="flex items-center justify-between py-1 text-sm"><span class=text-muted-foreground></span><span class="tabular-nums text-foreground">');
235
- function Ge(e) {
236
- const i = (o) => new Intl.NumberFormat(e.locale ?? "en-US", {
237
- style: "currency",
238
- currency: e.currency ?? "USD"
239
- }).format(o);
240
- return (() => {
241
- var o = me(), r = o.firstChild, s = r.nextSibling, d = s.firstChild, a = d.nextSibling;
242
- return n(o, c(S, {
243
- get each() {
244
- return e.lines;
245
- },
246
- children: (t) => (() => {
247
- var u = ge(), f = u.firstChild, l = f.nextSibling;
248
- return n(f, () => t.label), n(l, () => i(t.amount)), u;
249
- })()
250
- }), r), n(a, () => i(e.total)), n(o, c(b, {
251
- get when() {
252
- return e.onCheckout;
253
- },
254
- get children() {
255
- return c(M, {
256
- class: "mt-4 w-full",
257
- onClick: () => {
258
- var t;
259
- return (t = e.onCheckout) == null ? void 0 : t.call(e);
260
- },
261
- get children() {
262
- return e.checkoutLabel ?? "Checkout";
263
- }
264
- });
265
- }
266
- }), null), $(() => C(o, _("card glow-edge rounded-xl p-5 text-card-foreground", e.class))), o;
267
- })();
227
+ m(["click"]);
228
+ // src/commerce/CartSummary.tsx
229
+ var G = /*#__PURE__*/ b("<div><div class=\"my-3 border-t border-border\"></div><div class=\"flex items-center justify-between text-base font-bold text-foreground\"><span>Total</span><span class=tabular-nums>"), K = /*#__PURE__*/ b("<div class=\"flex items-center justify-between py-1 text-sm\"><span class=text-muted-foreground></span><span class=\"tabular-nums text-foreground\">");
230
+ function q(t) {
231
+ let n = (e) => new Intl.NumberFormat(t.locale ?? "en-US", {
232
+ style: "currency",
233
+ currency: t.currency ?? "USD"
234
+ }).format(e);
235
+ return (() => {
236
+ var r = G(), i = r.firstChild, o = i.nextSibling.firstChild.nextSibling;
237
+ return g(r, p(c, {
238
+ get each() {
239
+ return t.lines;
240
+ },
241
+ children: (e) => (() => {
242
+ var t = K(), r = t.firstChild, i = r.nextSibling;
243
+ return g(r, () => e.label), g(i, () => n(e.amount)), t;
244
+ })()
245
+ }), i), g(o, () => n(t.total)), g(r, p(l, {
246
+ get when() {
247
+ return t.onCheckout;
248
+ },
249
+ get children() {
250
+ return p(a, {
251
+ class: "mt-4 w-full",
252
+ onClick: () => t.onCheckout?.(),
253
+ get children() {
254
+ return t.checkoutLabel ?? "Checkout";
255
+ }
256
+ });
257
+ }
258
+ }), null), h(() => f(r, e("card glow-edge rounded-xl p-5 text-card-foreground", t.class))), r;
259
+ })();
268
260
  }
269
- var fe = /* @__PURE__ */ v('<div><p class="text-sm font-semibold text-foreground"></p><div class=space-y-1.5>'), ve = /* @__PURE__ */ v('<span class="text-xs text-muted-foreground">'), he = /* @__PURE__ */ v('<div class="flex items-center justify-between gap-2">');
270
- function q(e) {
271
- const i = (o, r) => {
272
- const s = e.selected.slice(), d = s.indexOf(o);
273
- r ? d === -1 && s.push(o) : d !== -1 && s.splice(d, 1), e.onChange(s);
274
- };
275
- return (() => {
276
- var o = fe(), r = o.firstChild, s = r.nextSibling;
277
- return n(r, () => e.title), n(s, c(S, {
278
- get each() {
279
- return e.options;
280
- },
281
- children: (d) => (() => {
282
- var a = he();
283
- return n(a, c(z, {
284
- get checked() {
285
- return e.selected.includes(d.value);
286
- },
287
- onChange: (t) => i(d.value, t),
288
- get label() {
289
- return d.label;
290
- }
291
- }), null), n(a, c(b, {
292
- get when() {
293
- return d.count != null;
294
- },
295
- get children() {
296
- var t = ve();
297
- return n(t, () => d.count), t;
298
- }
299
- }), null), a;
300
- })()
301
- })), $(() => C(o, _("space-y-2", e.class))), o;
302
- })();
261
+ // src/commerce/FilterGroup.tsx
262
+ var J = /*#__PURE__*/ b("<div><p class=\"text-sm font-semibold text-foreground\"></p><div class=space-y-1.5>"), te = /*#__PURE__*/ b("<span class=\"text-xs text-muted-foreground\">"), Y = /*#__PURE__*/ b("<div class=\"flex items-center justify-between gap-2\">");
263
+ function X(t) {
264
+ let n = (e, n) => {
265
+ let r = t.selected.slice(), i = r.indexOf(e);
266
+ n ? i === -1 && r.push(e) : i !== -1 && r.splice(i, 1), t.onChange(r);
267
+ };
268
+ return (() => {
269
+ var i = J(), a = i.firstChild, o = a.nextSibling;
270
+ return g(a, () => t.title), g(o, p(c, {
271
+ get each() {
272
+ return t.options;
273
+ },
274
+ children: (e) => (() => {
275
+ var i = Y();
276
+ return g(i, p(r, {
277
+ get checked() {
278
+ return t.selected.includes(e.value);
279
+ },
280
+ onChange: (t) => n(e.value, t),
281
+ get label() {
282
+ return e.label;
283
+ }
284
+ }), null), g(i, p(l, {
285
+ get when() {
286
+ return e.count != null;
287
+ },
288
+ get children() {
289
+ var t = te();
290
+ return g(t, () => e.count), t;
291
+ }
292
+ }), null), i;
293
+ })()
294
+ })), h(() => f(i, e("space-y-2", t.class))), i;
295
+ })();
303
296
  }
304
- var xe = /* @__PURE__ */ v('<div class=space-y-2><p class="text-sm font-semibold text-foreground">'), be = /* @__PURE__ */ v('<p class="text-sm text-muted-foreground"> results'), $e = /* @__PURE__ */ v('<div class="flex flex-wrap gap-2">'), _e = /* @__PURE__ */ v('<div><div class="flex items-center justify-between gap-2">'), Ce = /* @__PURE__ */ v('<span class="inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs"><button type=button class="text-muted-foreground hover:text-foreground">'), we = /* @__PURE__ */ v('<div class=space-y-2><div class="flex items-center justify-between"><p class="text-sm font-semibold text-foreground">Price</p><p class="text-xs text-muted-foreground">$<!> – $</p></div><div class="flex items-center gap-2"><span class="text-sm text-muted-foreground">–');
305
- function ye(e) {
306
- const [i, o] = B(e.section.defaultOpen ?? !0);
307
- return c(b, {
308
- get when() {
309
- return e.section.collapsible ?? !0;
310
- },
311
- get fallback() {
312
- return (() => {
313
- var r = xe(), s = r.firstChild;
314
- return n(s, () => e.section.title), n(r, c(q, {
315
- title: "",
316
- get options() {
317
- return e.section.options;
318
- },
319
- get selected() {
320
- return e.selected;
321
- },
322
- get onChange() {
323
- return e.onChange;
324
- }
325
- }), null), r;
326
- })();
327
- },
328
- get children() {
329
- return c(K, {
330
- get open() {
331
- return i();
332
- },
333
- onOpenChange: o,
334
- get title() {
335
- return e.section.title;
336
- },
337
- get children() {
338
- return c(q, {
339
- title: "",
340
- get options() {
341
- return e.section.options;
342
- },
343
- get selected() {
344
- return e.selected;
345
- },
346
- get onChange() {
347
- return e.onChange;
348
- }
349
- });
350
- }
351
- });
352
- }
353
- });
297
+ // src/commerce/FacetSidebar.tsx
298
+ var Z = /*#__PURE__*/ b("<div class=space-y-2><p class=\"text-sm font-semibold text-foreground\">"), Q = /*#__PURE__*/ b("<p class=\"text-sm text-muted-foreground\"> results"), ne = /*#__PURE__*/ b("<div class=\"flex flex-wrap gap-2\">"), re = /*#__PURE__*/ b("<div><div class=\"flex items-center justify-between gap-2\">"), ie = /*#__PURE__*/ b("<span class=\"inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs\"><button type=button class=\"text-muted-foreground hover:text-foreground\">"), ae = /*#__PURE__*/ b("<div class=space-y-2><div class=\"flex items-center justify-between\"><p class=\"text-sm font-semibold text-foreground\">Price</p><p class=\"text-xs text-muted-foreground\">$<!> – $</p></div><div class=\"flex items-center gap-2\"><span class=\"text-sm text-muted-foreground\">–");
299
+ function oe(e) {
300
+ let [t, n] = d(e.section.defaultOpen ?? !0);
301
+ return p(l, {
302
+ get when() {
303
+ return e.section.collapsible ?? !0;
304
+ },
305
+ get fallback() {
306
+ return (() => {
307
+ var t = Z(), n = t.firstChild;
308
+ return g(n, () => e.section.title), g(t, p(X, {
309
+ title: "",
310
+ get options() {
311
+ return e.section.options;
312
+ },
313
+ get selected() {
314
+ return e.selected;
315
+ },
316
+ get onChange() {
317
+ return e.onChange;
318
+ }
319
+ }), null), t;
320
+ })();
321
+ },
322
+ get children() {
323
+ return p(s, {
324
+ get open() {
325
+ return t();
326
+ },
327
+ onOpenChange: n,
328
+ get title() {
329
+ return e.section.title;
330
+ },
331
+ get children() {
332
+ return p(X, {
333
+ title: "",
334
+ get options() {
335
+ return e.section.options;
336
+ },
337
+ get selected() {
338
+ return e.selected;
339
+ },
340
+ get onChange() {
341
+ return e.onChange;
342
+ }
343
+ });
344
+ }
345
+ });
346
+ }
347
+ });
354
348
  }
355
- function ze(e) {
356
- const i = () => {
357
- const d = [];
358
- for (const a of e.sections) {
359
- const t = e.selected[a.key] ?? [];
360
- for (const u of t) {
361
- const f = a.options.find((l) => l.value === u);
362
- d.push({
363
- sectionKey: a.key,
364
- value: u,
365
- label: (f == null ? void 0 : f.label) ?? u
366
- });
367
- }
368
- }
369
- return d;
370
- }, o = (d) => {
371
- const a = e.selected[d.sectionKey] ?? [];
372
- e.onChange(d.sectionKey, a.filter((t) => t !== d.value));
373
- }, r = (d) => {
374
- if (!e.price || !e.onPriceChange) return;
375
- const a = Math.min(d, e.price.value[1]);
376
- e.onPriceChange([a, e.price.value[1]]);
377
- }, s = (d) => {
378
- if (!e.price || !e.onPriceChange) return;
379
- const a = Math.max(d, e.price.value[0]);
380
- e.onPriceChange([e.price.value[0], a]);
381
- };
382
- return (() => {
383
- var d = _e(), a = d.firstChild;
384
- return n(a, c(b, {
385
- get when() {
386
- return e.resultCount != null;
387
- },
388
- get children() {
389
- var t = be(), u = t.firstChild;
390
- return n(t, () => e.resultCount, u), t;
391
- }
392
- }), null), n(a, c(b, {
393
- get when() {
394
- return e.onClearAll;
395
- },
396
- get children() {
397
- return c(M, {
398
- variant: "ghost",
399
- class: "ml-auto h-auto px-2 py-1 text-xs",
400
- onClick: () => {
401
- var t;
402
- return (t = e.onClearAll) == null ? void 0 : t.call(e);
403
- },
404
- children: "Clear all"
405
- });
406
- }
407
- }), null), n(d, c(b, {
408
- get when() {
409
- return i().length > 0;
410
- },
411
- get children() {
412
- var t = $e();
413
- return n(t, c(S, {
414
- get each() {
415
- return i();
416
- },
417
- children: (u) => (() => {
418
- var f = Ce(), l = f.firstChild;
419
- return n(f, () => u.label, l), l.$$click = () => o(u), n(l, c(Z, {
420
- class: "h-3 w-3"
421
- })), $(() => w(l, "aria-label", `Remove ${u.label}`)), f;
422
- })()
423
- })), t;
424
- }
425
- }), null), n(d, c(b, {
426
- get when() {
427
- return e.price;
428
- },
429
- children: (t) => (() => {
430
- var u = we(), f = u.firstChild, l = f.firstChild, g = l.nextSibling, h = g.firstChild, m = h.nextSibling;
431
- m.nextSibling;
432
- var x = f.nextSibling, y = x.firstChild;
433
- return n(g, () => t().value[0], m), n(g, () => t().value[1], null), n(x, c(U, {
434
- get value() {
435
- return t().value[0];
436
- },
437
- onChange: r,
438
- get min() {
439
- return t().min;
440
- },
441
- get max() {
442
- return t().value[1];
443
- },
444
- "aria-label": "Minimum price"
445
- }), y), n(x, c(U, {
446
- get value() {
447
- return t().value[1];
448
- },
449
- onChange: s,
450
- get min() {
451
- return t().value[0];
452
- },
453
- get max() {
454
- return t().max;
455
- },
456
- "aria-label": "Maximum price"
457
- }), null), u;
458
- })()
459
- }), null), n(d, c(S, {
460
- get each() {
461
- return e.sections;
462
- },
463
- children: (t) => c(ye, {
464
- section: t,
465
- get selected() {
466
- return e.selected[t.key] ?? [];
467
- },
468
- onChange: (u) => e.onChange(t.key, u)
469
- })
470
- }), null), $(() => C(d, _("space-y-5", e.class))), d;
471
- })();
349
+ function se(t) {
350
+ let n = () => {
351
+ let e = [];
352
+ for (let n of t.sections) {
353
+ let r = t.selected[n.key] ?? [];
354
+ for (let t of r) {
355
+ let r = n.options.find((e) => e.value === t);
356
+ e.push({
357
+ sectionKey: n.key,
358
+ value: t,
359
+ label: r?.label ?? t
360
+ });
361
+ }
362
+ }
363
+ return e;
364
+ }, r = (e) => {
365
+ let n = t.selected[e.sectionKey] ?? [];
366
+ t.onChange(e.sectionKey, n.filter((t) => t !== e.value));
367
+ }, i = (e) => {
368
+ if (!t.price || !t.onPriceChange) return;
369
+ let n = Math.min(e, t.price.value[1]);
370
+ t.onPriceChange([n, t.price.value[1]]);
371
+ }, s = (e) => {
372
+ if (!t.price || !t.onPriceChange) return;
373
+ let n = Math.max(e, t.price.value[0]);
374
+ t.onPriceChange([t.price.value[0], n]);
375
+ };
376
+ return (() => {
377
+ var u = re(), d = u.firstChild;
378
+ return g(d, p(l, {
379
+ get when() {
380
+ return t.resultCount != null;
381
+ },
382
+ get children() {
383
+ var e = Q(), n = e.firstChild;
384
+ return g(e, () => t.resultCount, n), e;
385
+ }
386
+ }), null), g(d, p(l, {
387
+ get when() {
388
+ return t.onClearAll;
389
+ },
390
+ get children() {
391
+ return p(a, {
392
+ variant: "ghost",
393
+ class: "ml-auto h-auto px-2 py-1 text-xs",
394
+ onClick: () => t.onClearAll?.(),
395
+ children: "Clear all"
396
+ });
397
+ }
398
+ }), null), g(u, p(l, {
399
+ get when() {
400
+ return n().length > 0;
401
+ },
402
+ get children() {
403
+ var e = ne();
404
+ return g(e, p(c, {
405
+ get each() {
406
+ return n();
407
+ },
408
+ children: (e) => (() => {
409
+ var t = ie(), n = t.firstChild;
410
+ return g(t, () => e.label, n), n.$$click = () => r(e), g(n, p(ee, { class: "h-3 w-3" })), h(() => v(n, "aria-label", `Remove ${e.label}`)), t;
411
+ })()
412
+ })), e;
413
+ }
414
+ }), null), g(u, p(l, {
415
+ get when() {
416
+ return t.price;
417
+ },
418
+ children: (e) => (() => {
419
+ var t = ae(), n = t.firstChild, r = n.firstChild.nextSibling, a = r.firstChild.nextSibling;
420
+ a.nextSibling;
421
+ var c = n.nextSibling, l = c.firstChild;
422
+ return g(r, () => e().value[0], a), g(r, () => e().value[1], null), g(c, p(o, {
423
+ get value() {
424
+ return e().value[0];
425
+ },
426
+ onChange: i,
427
+ get min() {
428
+ return e().min;
429
+ },
430
+ get max() {
431
+ return e().value[1];
432
+ },
433
+ "aria-label": "Minimum price"
434
+ }), l), g(c, p(o, {
435
+ get value() {
436
+ return e().value[1];
437
+ },
438
+ onChange: s,
439
+ get min() {
440
+ return e().value[0];
441
+ },
442
+ get max() {
443
+ return e().max;
444
+ },
445
+ "aria-label": "Maximum price"
446
+ }), null), t;
447
+ })()
448
+ }), null), g(u, p(c, {
449
+ get each() {
450
+ return t.sections;
451
+ },
452
+ children: (e) => p(oe, {
453
+ section: e,
454
+ get selected() {
455
+ return t.selected[e.key] ?? [];
456
+ },
457
+ onChange: (n) => t.onChange(e.key, n)
458
+ })
459
+ }), null), h(() => f(u, e("space-y-5", t.class))), u;
460
+ })();
472
461
  }
473
- A(["click"]);
474
- var Se = /* @__PURE__ */ v('<span class="text-muted-foreground line-through">'), ke = /* @__PURE__ */ v('<span class="inline-flex items-center gap-1 text-sm text-muted-foreground">As low as <!>/mo'), Ae = /* @__PURE__ */ v('<div><div class="flex flex-wrap items-center gap-2"><span>'), Me = /* @__PURE__ */ v('<span class="text-sm text-muted-foreground"> after code '), Pe = /* @__PURE__ */ v('<div class="flex flex-wrap items-center gap-2"><span class="inline-flex items-center gap-1 rounded-md border border-dashed border-primary/50 px-2 py-0.5 text-xs font-mono text-foreground"> ');
475
- const Te = {
476
- md: "text-xl",
477
- lg: "text-3xl"
462
+ m(["click"]);
463
+ // src/commerce/PriceBlock.tsx
464
+ var ce = /*#__PURE__*/ b("<span class=\"text-muted-foreground line-through\">"), le = /*#__PURE__*/ b("<span class=\"inline-flex items-center gap-1 text-sm text-muted-foreground\">As low as <!>/mo"), ue = /*#__PURE__*/ b("<div><div class=\"flex flex-wrap items-center gap-2\"><span>"), de = /*#__PURE__*/ b("<span class=\"text-sm text-muted-foreground\"> after code "), fe = /*#__PURE__*/ b("<div class=\"flex flex-wrap items-center gap-2\"><span class=\"inline-flex items-center gap-1 rounded-md border border-dashed border-primary/50 px-2 py-0.5 text-xs font-mono text-foreground\"> "), pe = {
465
+ md: "text-xl",
466
+ lg: "text-3xl"
478
467
  };
479
- function Ke(e) {
480
- const i = (t) => new Intl.NumberFormat(e.locale ?? "en-US", {
481
- style: "currency",
482
- currency: e.currency ?? "USD"
483
- }).format(t), o = () => (e.compareAt ?? 0) > e.amount, r = () => e.compareAt - e.amount, s = () => Math.round((1 - e.amount / e.compareAt) * 100), d = () => {
484
- var u;
485
- const t = ((u = e.coupon) == null ? void 0 : u.amount) ?? 0;
486
- return Math.max(0, e.amount - t);
487
- }, a = () => {
488
- const t = e.financing, u = t.apr ?? 0;
489
- if (u > 0) {
490
- const f = u / 12, l = t.months, g = e.amount * f / (1 - (1 + f) ** -l);
491
- return Math.round(g * 100) / 100;
492
- }
493
- return Math.round(e.amount / t.months * 100) / 100;
494
- };
495
- return (() => {
496
- var t = Ae(), u = t.firstChild, f = u.firstChild;
497
- return n(f, () => i(e.amount)), n(u, c(b, {
498
- get when() {
499
- return o();
500
- },
501
- get children() {
502
- return [(() => {
503
- var l = Se();
504
- return n(l, () => i(e.compareAt)), l;
505
- })(), c(D, {
506
- tone: "danger",
507
- get children() {
508
- return ["Save ", k(() => i(r())), " (-", k(() => s()), "%)"];
509
- }
510
- })];
511
- }
512
- }), null), n(t, c(b, {
513
- get when() {
514
- return e.coupon;
515
- },
516
- children: (l) => (() => {
517
- var g = Pe(), h = g.firstChild, m = h.firstChild;
518
- return n(h, () => l().label ?? "Coupon", m), n(h, () => l().code, null), n(g, c(b, {
519
- get when() {
520
- return l().amount !== void 0;
521
- },
522
- get children() {
523
- var x = Me(), y = x.firstChild;
524
- return n(x, () => i(d()), y), n(x, () => l().code, null), x;
525
- }
526
- }), null), g;
527
- })()
528
- }), null), n(t, c(b, {
529
- get when() {
530
- return e.financing;
531
- },
532
- get children() {
533
- var l = ke(), g = l.firstChild, h = g.nextSibling;
534
- return h.nextSibling, n(l, c(H, {
535
- class: "h-4 w-4"
536
- }), g), n(l, () => i(a()), h), l;
537
- }
538
- }), null), n(t, c(b, {
539
- get when() {
540
- return e.note;
541
- },
542
- get children() {
543
- return e.note;
544
- }
545
- }), null), $((l) => {
546
- var g = _("flex flex-col gap-1", e.class), h = _("font-bold text-foreground", Te[e.size ?? "lg"]);
547
- return g !== l.e && C(t, l.e = g), h !== l.t && C(f, l.t = h), l;
548
- }, {
549
- e: void 0,
550
- t: void 0
551
- }), t;
552
- })();
468
+ function $(t) {
469
+ let r = (e) => new Intl.NumberFormat(t.locale ?? "en-US", {
470
+ style: "currency",
471
+ currency: t.currency ?? "USD"
472
+ }).format(e), i = () => (t.compareAt ?? 0) > t.amount, a = () => t.compareAt - t.amount, o = () => Math.round((1 - t.amount / t.compareAt) * 100), s = () => {
473
+ let e = t.coupon?.amount ?? 0;
474
+ return Math.max(0, t.amount - e);
475
+ }, c = () => {
476
+ let e = t.financing, n = e.apr ?? 0;
477
+ if (n > 0) {
478
+ let r = n / 12, i = e.months, a = t.amount * r / (1 - (1 + r) ** -i);
479
+ return Math.round(a * 100) / 100;
480
+ }
481
+ return Math.round(t.amount / e.months * 100) / 100;
482
+ };
483
+ return (() => {
484
+ var u = ue(), d = u.firstChild, m = d.firstChild;
485
+ return g(m, () => r(t.amount)), g(d, p(l, {
486
+ get when() {
487
+ return i();
488
+ },
489
+ get children() {
490
+ return [(() => {
491
+ var e = ce();
492
+ return g(e, () => r(t.compareAt)), e;
493
+ })(), p(n, {
494
+ tone: "danger",
495
+ get children() {
496
+ return [
497
+ "Save ",
498
+ _(() => r(a())),
499
+ " (-",
500
+ _(() => o()),
501
+ "%)"
502
+ ];
503
+ }
504
+ })];
505
+ }
506
+ }), null), g(u, p(l, {
507
+ get when() {
508
+ return t.coupon;
509
+ },
510
+ children: (e) => (() => {
511
+ var t = fe(), n = t.firstChild, i = n.firstChild;
512
+ return g(n, () => e().label ?? "Coupon", i), g(n, () => e().code, null), g(t, p(l, {
513
+ get when() {
514
+ return e().amount !== void 0;
515
+ },
516
+ get children() {
517
+ var t = de(), n = t.firstChild;
518
+ return g(t, () => r(s()), n), g(t, () => e().code, null), t;
519
+ }
520
+ }), null), t;
521
+ })()
522
+ }), null), g(u, p(l, {
523
+ get when() {
524
+ return t.financing;
525
+ },
526
+ get children() {
527
+ var e = le(), t = e.firstChild, n = t.nextSibling;
528
+ return n.nextSibling, g(e, p(x, { class: "h-4 w-4" }), t), g(e, () => r(c()), n), e;
529
+ }
530
+ }), null), g(u, p(l, {
531
+ get when() {
532
+ return t.note;
533
+ },
534
+ get children() {
535
+ return t.note;
536
+ }
537
+ }), null), h((n) => {
538
+ var r = e("flex flex-col gap-1", t.class), i = e("font-bold text-foreground", pe[t.size ?? "lg"]);
539
+ return r !== n.e && f(u, n.e = r), i !== n.t && f(m, n.t = i), n;
540
+ }, {
541
+ e: void 0,
542
+ t: void 0
543
+ }), u;
544
+ })();
553
545
  }
554
- var Ee = /* @__PURE__ */ v('<span class="text-sm text-muted-foreground"> / '), Ie = /* @__PURE__ */ v('<div><div class="flex items-end justify-between gap-2"><span class="font-semibold text-foreground"></span></div><div class="relative mt-2 h-2 w-full rounded-full bg-muted"role=meter><div class="absolute h-2 rounded-full bg-gradient-to-r from-primary/40 to-primary"></div><div class="absolute -top-1 h-4 w-4 -translate-x-1/2 rounded-full border-2 border-background bg-primary shadow"></div></div><div class="flex items-center justify-between text-xs text-muted-foreground">'), Ne = /* @__PURE__ */ v("<span>");
555
- const Fe = [{
556
- min: 10,
557
- label: "Brand New"
558
- }, {
559
- min: 9,
560
- label: "Excellent"
561
- }, {
562
- min: 7,
563
- label: "Very Good"
564
- }, {
565
- min: 5,
566
- label: "Good"
567
- }, {
568
- min: 1,
569
- label: "Fair"
570
- }];
571
- function Qe(e) {
572
- const i = () => e.min ?? 1, o = () => e.max ?? 10, r = () => (e.tiers ?? Fe).slice().sort((a, t) => a.min - t.min), s = () => {
573
- const a = o() - i();
574
- return a <= 0 ? 0 : Math.max(0, Math.min(100, (e.value - i()) / a * 100));
575
- }, d = () => {
576
- const a = r();
577
- let t = a[0];
578
- for (const u of a)
579
- u.min <= e.value && (t = u);
580
- return t;
581
- };
582
- return (() => {
583
- var a = Ie(), t = a.firstChild, u = t.firstChild, f = t.nextSibling, l = f.firstChild, g = l.nextSibling, h = f.nextSibling;
584
- return n(u, () => {
585
- var m;
586
- return (m = d()) == null ? void 0 : m.label;
587
- }), n(t, c(b, {
588
- get when() {
589
- return e.showValue ?? !0;
590
- },
591
- get children() {
592
- var m = Ee(), x = m.firstChild;
593
- return n(m, () => e.value, x), n(m, o, null), m;
594
- }
595
- }), null), n(h, c(S, {
596
- get each() {
597
- return [r()[0], r()[r().length - 1]];
598
- },
599
- children: (m) => (() => {
600
- var x = Ne();
601
- return n(x, () => m == null ? void 0 : m.label), x;
602
- })()
603
- })), $((m) => {
604
- var F;
605
- var x = _("flex flex-col gap-2", e.class), y = i(), P = o(), T = e.value, E = ((F = d()) == null ? void 0 : F.label) ?? "Condition", I = `${s()}%`, N = `${s()}%`;
606
- return x !== m.e && C(a, m.e = x), y !== m.t && w(f, "aria-valuemin", m.t = y), P !== m.a && w(f, "aria-valuemax", m.a = P), T !== m.o && w(f, "aria-valuenow", m.o = T), E !== m.i && w(f, "aria-label", m.i = E), I !== m.n && j(l, "width", m.n = I), N !== m.s && j(g, "left", m.s = N), m;
607
- }, {
608
- e: void 0,
609
- t: void 0,
610
- a: void 0,
611
- o: void 0,
612
- i: void 0,
613
- n: void 0,
614
- s: void 0
615
- }), a;
616
- })();
546
+ // src/commerce/ConditionScale.tsx
547
+ var me = /*#__PURE__*/ b("<span class=\"text-sm text-muted-foreground\"> / "), he = /*#__PURE__*/ b("<div><div class=\"flex items-end justify-between gap-2\"><span class=\"font-semibold text-foreground\"></span></div><div class=\"relative mt-2 h-2 w-full rounded-full bg-muted\"role=meter><div class=\"absolute h-2 rounded-full bg-gradient-to-r from-primary/40 to-primary\"></div><div class=\"absolute -top-1 h-4 w-4 -translate-x-1/2 rounded-full border-2 border-background bg-primary shadow\"></div></div><div class=\"flex items-center justify-between text-xs text-muted-foreground\">"), ge = /*#__PURE__*/ b("<span>"), _e = [
548
+ {
549
+ min: 10,
550
+ label: "Brand New"
551
+ },
552
+ {
553
+ min: 9,
554
+ label: "Excellent"
555
+ },
556
+ {
557
+ min: 7,
558
+ label: "Very Good"
559
+ },
560
+ {
561
+ min: 5,
562
+ label: "Good"
563
+ },
564
+ {
565
+ min: 1,
566
+ label: "Fair"
567
+ }
568
+ ];
569
+ function ve(t) {
570
+ let n = () => t.min ?? 1, r = () => t.max ?? 10, i = () => (t.tiers ?? _e).slice().sort((e, t) => e.min - t.min), a = () => {
571
+ let e = r() - n();
572
+ return e <= 0 ? 0 : Math.max(0, Math.min(100, (t.value - n()) / e * 100));
573
+ }, o = () => {
574
+ let e = i(), n = e[0];
575
+ for (let r of e) r.min <= t.value && (n = r);
576
+ return n;
577
+ };
578
+ return (() => {
579
+ var s = he(), u = s.firstChild, d = u.firstChild, m = u.nextSibling, _ = m.firstChild, b = _.nextSibling, x = m.nextSibling;
580
+ return g(d, () => o()?.label), g(u, p(l, {
581
+ get when() {
582
+ return t.showValue ?? !0;
583
+ },
584
+ get children() {
585
+ var e = me(), n = e.firstChild;
586
+ return g(e, () => t.value, n), g(e, r, null), e;
587
+ }
588
+ }), null), g(x, p(c, {
589
+ get each() {
590
+ return [i()[0], i()[i().length - 1]];
591
+ },
592
+ children: (e) => (() => {
593
+ var t = ge();
594
+ return g(t, () => e?.label), t;
595
+ })()
596
+ })), h((i) => {
597
+ var c = e("flex flex-col gap-2", t.class), l = n(), u = r(), d = t.value, p = o()?.label ?? "Condition", h = `${a()}%`, g = `${a()}%`;
598
+ return c !== i.e && f(s, i.e = c), l !== i.t && v(m, "aria-valuemin", i.t = l), u !== i.a && v(m, "aria-valuemax", i.a = u), d !== i.o && v(m, "aria-valuenow", i.o = d), p !== i.i && v(m, "aria-label", i.i = p), h !== i.n && y(_, "width", i.n = h), g !== i.s && y(b, "left", i.s = g), i;
599
+ }, {
600
+ e: void 0,
601
+ t: void 0,
602
+ a: void 0,
603
+ o: void 0,
604
+ i: void 0,
605
+ n: void 0,
606
+ s: void 0
607
+ }), s;
608
+ })();
617
609
  }
618
- function Ve(e = []) {
619
- const [i, o] = B(e), r = (l, g = 1) => {
620
- o((h) => h.find((x) => x.product.id === l.id) ? h.map(
621
- (x) => x.product.id === l.id ? { ...x, qty: x.qty + g } : x
622
- ) : [...h, { product: l, qty: g }]);
623
- }, s = (l) => {
624
- o((g) => g.filter((h) => h.product.id !== l));
625
- }, d = (l, g) => {
626
- if (g <= 0) {
627
- s(l);
628
- return;
629
- }
630
- o((h) => h.map((m) => m.product.id === l ? { ...m, qty: g } : m));
631
- }, a = () => {
632
- o([]);
633
- }, t = R(() => i().reduce((l, g) => l + g.qty, 0)), u = R(
634
- () => i().reduce((l, g) => l + g.product.price * g.qty, 0)
635
- );
636
- return { items: i, add: r, remove: s, setQty: d, clear: a, count: t, subtotal: u, has: (l) => i().some((g) => g.product.id === l) };
610
+ // src/commerce/createCart.ts
611
+ function ye(e = []) {
612
+ let [t, n] = d(e), r = (e, t = 1) => {
613
+ n((n) => n.find((t) => t.product.id === e.id) ? n.map((n) => n.product.id === e.id ? {
614
+ ...n,
615
+ qty: n.qty + t
616
+ } : n) : [...n, {
617
+ product: e,
618
+ qty: t
619
+ }]);
620
+ }, i = (e) => {
621
+ n((t) => t.filter((t) => t.product.id !== e));
622
+ };
623
+ return {
624
+ items: t,
625
+ add: r,
626
+ remove: i,
627
+ setQty: (e, t) => {
628
+ t <= 0 ? i(e) : n((n) => n.map((n) => n.product.id === e ? {
629
+ ...n,
630
+ qty: t
631
+ } : n));
632
+ },
633
+ clear: () => {
634
+ n([]);
635
+ },
636
+ count: u(() => t().reduce((e, t) => e + t.qty, 0)),
637
+ subtotal: u(() => t().reduce((e, t) => e + t.product.price * t.qty, 0)),
638
+ has: (e) => t().some((t) => t.product.id === e)
639
+ };
637
640
  }
638
- export {
639
- Oe as CartLine,
640
- Ge as CartSummary,
641
- Qe as ConditionScale,
642
- ze as FacetSidebar,
643
- q as FilterGroup,
644
- Ke as PriceBlock,
645
- L as PriceTag,
646
- De as ProductCard,
647
- Le as ProductGrid,
648
- ee as QuantityStepper,
649
- Ve as createCart
650
- };
641
+ export { W as CartLine, q as CartSummary, ve as ConditionScale, se as FacetSidebar, X as FilterGroup, $ as PriceBlock, O as PriceTag, R as ProductCard, B as ProductGrid, A as QuantityStepper, ye as createCart };