@drawbridge/components 0.0.37 → 0.0.40

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 (246) hide show
  1. package/dist/advertisement.js +1299 -0
  2. package/dist/advertisement.mjs +95 -0
  3. package/dist/card-advertisement.js +104 -31
  4. package/dist/card-advertisement.mjs +3 -281
  5. package/dist/chunk-2ZYGRSSA.mjs +45 -0
  6. package/dist/chunk-7ZLMDYBR.mjs +113 -0
  7. package/dist/chunk-BD3TDNJE.mjs +98 -0
  8. package/dist/chunk-FJXG3REN.mjs +93 -0
  9. package/dist/chunk-FYA7EAMR.mjs +29 -0
  10. package/dist/chunk-GFDZ7ER6.mjs +29 -0
  11. package/dist/chunk-HDOA3Y3U.mjs +334 -0
  12. package/dist/chunk-HH7WF5BT.mjs +29 -0
  13. package/dist/chunk-Q3UIVGPQ.mjs +29 -0
  14. package/dist/chunk-T5QQBFM3.mjs +29 -0
  15. package/dist/chunk-TJNIR4PF.mjs +358 -0
  16. package/dist/chunk-XWELEL6Z.mjs +208 -0
  17. package/dist/embla.js +41 -0
  18. package/dist/embla.mjs +6 -0
  19. package/dist/icons/arrow-down-tray.js +48 -0
  20. package/dist/icons/arrow-down-tray.mjs +28 -0
  21. package/dist/icons/arrow-left.js +48 -0
  22. package/dist/icons/arrow-left.mjs +28 -0
  23. package/dist/icons/arrow-right.js +48 -0
  24. package/dist/icons/arrow-right.mjs +28 -0
  25. package/dist/icons/arrow-up-tray.js +48 -0
  26. package/dist/icons/arrow-up-tray.mjs +28 -0
  27. package/dist/icons/bars-arrow-down.js +48 -0
  28. package/dist/icons/bars-arrow-down.mjs +28 -0
  29. package/dist/icons/bars-arrow-up.js +48 -0
  30. package/dist/icons/bars-arrow-up.mjs +28 -0
  31. package/dist/icons/bold.js +47 -0
  32. package/dist/icons/bold.mjs +27 -0
  33. package/dist/icons/bolt.js +48 -0
  34. package/dist/icons/bolt.mjs +28 -0
  35. package/dist/icons/calendar.js +48 -0
  36. package/dist/icons/calendar.mjs +28 -0
  37. package/dist/icons/cancel.js +48 -0
  38. package/dist/icons/cancel.mjs +28 -0
  39. package/dist/icons/card.js +48 -0
  40. package/dist/icons/card.mjs +28 -0
  41. package/dist/icons/chart.js +48 -0
  42. package/dist/icons/chart.mjs +28 -0
  43. package/dist/icons/check.js +48 -0
  44. package/dist/icons/check.mjs +6 -0
  45. package/dist/icons/chevron-down.js +48 -0
  46. package/dist/icons/chevron-down.mjs +6 -0
  47. package/dist/icons/chevron-left.js +48 -0
  48. package/dist/icons/chevron-left.mjs +28 -0
  49. package/dist/icons/chevron-right.js +48 -0
  50. package/dist/icons/chevron-right.mjs +28 -0
  51. package/dist/icons/chevron-up-down.js +48 -0
  52. package/dist/icons/chevron-up-down.mjs +28 -0
  53. package/dist/icons/chevron-up.js +48 -0
  54. package/dist/icons/chevron-up.mjs +28 -0
  55. package/dist/icons/clock.js +48 -0
  56. package/dist/icons/clock.mjs +28 -0
  57. package/dist/icons/code-bracket.js +48 -0
  58. package/dist/icons/code-bracket.mjs +28 -0
  59. package/dist/icons/cog.js +60 -0
  60. package/dist/icons/cog.mjs +40 -0
  61. package/dist/icons/copy.js +48 -0
  62. package/dist/icons/copy.mjs +28 -0
  63. package/dist/icons/document.js +48 -0
  64. package/dist/icons/document.mjs +28 -0
  65. package/dist/icons/download.js +48 -0
  66. package/dist/icons/download.mjs +28 -0
  67. package/dist/icons/drag.js +51 -0
  68. package/dist/icons/drag.mjs +31 -0
  69. package/dist/icons/ellipsis.js +48 -0
  70. package/dist/icons/ellipsis.mjs +28 -0
  71. package/dist/icons/email.js +48 -0
  72. package/dist/icons/email.mjs +28 -0
  73. package/dist/icons/external.js +48 -0
  74. package/dist/icons/external.mjs +28 -0
  75. package/dist/icons/filter.js +48 -0
  76. package/dist/icons/filter.mjs +28 -0
  77. package/dist/icons/flag.js +48 -0
  78. package/dist/icons/flag.mjs +28 -0
  79. package/dist/icons/google.js +74 -0
  80. package/dist/icons/google.mjs +54 -0
  81. package/dist/icons/home.js +48 -0
  82. package/dist/icons/home.mjs +28 -0
  83. package/dist/icons/image.js +48 -0
  84. package/dist/icons/image.mjs +28 -0
  85. package/dist/icons/italic.js +48 -0
  86. package/dist/icons/italic.mjs +28 -0
  87. package/dist/icons/link.js +48 -0
  88. package/dist/icons/link.mjs +28 -0
  89. package/dist/icons/loader.js +64 -0
  90. package/dist/icons/loader.mjs +6 -0
  91. package/dist/icons/lock.js +48 -0
  92. package/dist/icons/lock.mjs +28 -0
  93. package/dist/icons/logo-mark.js +55 -0
  94. package/dist/icons/logo-mark.mjs +35 -0
  95. package/dist/icons/logo-tagline.js +137 -0
  96. package/dist/icons/logo-tagline.mjs +117 -0
  97. package/dist/icons/map-pin.js +60 -0
  98. package/dist/icons/map-pin.mjs +40 -0
  99. package/dist/icons/menu.js +48 -0
  100. package/dist/icons/menu.mjs +28 -0
  101. package/dist/icons/minus.js +48 -0
  102. package/dist/icons/minus.mjs +6 -0
  103. package/dist/icons/muted.js +48 -0
  104. package/dist/icons/muted.mjs +28 -0
  105. package/dist/icons/pause.js +48 -0
  106. package/dist/icons/pause.mjs +28 -0
  107. package/dist/icons/pencil.js +48 -0
  108. package/dist/icons/pencil.mjs +28 -0
  109. package/dist/icons/play.js +48 -0
  110. package/dist/icons/play.mjs +28 -0
  111. package/dist/icons/plus.js +48 -0
  112. package/dist/icons/plus.mjs +6 -0
  113. package/dist/icons/powered-by.js +45 -0
  114. package/dist/icons/powered-by.mjs +25 -0
  115. package/dist/icons/qr-code.js +60 -0
  116. package/dist/icons/qr-code.mjs +40 -0
  117. package/dist/icons/queue.js +48 -0
  118. package/dist/icons/queue.mjs +28 -0
  119. package/dist/icons/refresh.js +48 -0
  120. package/dist/icons/refresh.mjs +28 -0
  121. package/dist/icons/refund.js +48 -0
  122. package/dist/icons/refund.mjs +28 -0
  123. package/dist/icons/rocket.js +48 -0
  124. package/dist/icons/rocket.mjs +28 -0
  125. package/dist/icons/search.js +48 -0
  126. package/dist/icons/search.mjs +28 -0
  127. package/dist/icons/share.js +48 -0
  128. package/dist/icons/share.mjs +28 -0
  129. package/dist/icons/shop.js +46 -0
  130. package/dist/icons/shop.mjs +26 -0
  131. package/dist/icons/sparkles.js +48 -0
  132. package/dist/icons/sparkles.mjs +28 -0
  133. package/dist/icons/star.js +48 -0
  134. package/dist/icons/star.mjs +28 -0
  135. package/dist/icons/switch.js +48 -0
  136. package/dist/icons/switch.mjs +28 -0
  137. package/dist/icons/times.js +48 -0
  138. package/dist/icons/times.mjs +28 -0
  139. package/dist/icons/trash.js +48 -0
  140. package/dist/icons/trash.mjs +28 -0
  141. package/dist/icons/underline.js +48 -0
  142. package/dist/icons/underline.mjs +28 -0
  143. package/dist/icons/upload.js +48 -0
  144. package/dist/icons/upload.mjs +28 -0
  145. package/dist/icons/volume.js +48 -0
  146. package/dist/icons/volume.mjs +28 -0
  147. package/dist/icons/warning.js +48 -0
  148. package/dist/icons/warning.mjs +6 -0
  149. package/dist/input-checkbox.js +130 -0
  150. package/dist/input-checkbox.mjs +71 -0
  151. package/dist/input-group.js +156 -0
  152. package/dist/input-group.mjs +7 -0
  153. package/dist/input-number.js +211 -0
  154. package/dist/input-number.mjs +136 -0
  155. package/dist/input-select.js +150 -0
  156. package/dist/input-select.mjs +9 -0
  157. package/dist/input-text.js +65 -0
  158. package/dist/input-text.mjs +36 -0
  159. package/dist/input-textarea.js +69 -0
  160. package/dist/input-textarea.mjs +40 -0
  161. package/dist/product.js +864 -0
  162. package/dist/product.mjs +14 -0
  163. package/dist/styles.js +127 -0
  164. package/dist/styles.mjs +28 -0
  165. package/dist/video.js +177 -0
  166. package/dist/video.mjs +107 -0
  167. package/dist/wrapper-gradient.js +232 -0
  168. package/dist/wrapper-gradient.mjs +9 -0
  169. package/package.json +312 -2
  170. package/types/advertisement.d.ts +35 -0
  171. package/types/embla.d.ts +2 -0
  172. package/types/icons/arrow-down-tray.d.ts +5 -0
  173. package/types/icons/arrow-left.d.ts +5 -0
  174. package/types/icons/arrow-right.d.ts +5 -0
  175. package/types/icons/arrow-up-tray.d.ts +5 -0
  176. package/types/icons/bars-arrow-down.d.ts +5 -0
  177. package/types/icons/bars-arrow-up.d.ts +5 -0
  178. package/types/icons/bold.d.ts +5 -0
  179. package/types/icons/bolt.d.ts +5 -0
  180. package/types/icons/calendar.d.ts +5 -0
  181. package/types/icons/cancel.d.ts +5 -0
  182. package/types/icons/card.d.ts +5 -0
  183. package/types/icons/chart.d.ts +5 -0
  184. package/types/icons/check.d.ts +5 -0
  185. package/types/icons/chevron-down.d.ts +5 -0
  186. package/types/icons/chevron-left.d.ts +5 -0
  187. package/types/icons/chevron-right.d.ts +5 -0
  188. package/types/icons/chevron-up-down.d.ts +5 -0
  189. package/types/icons/chevron-up.d.ts +5 -0
  190. package/types/icons/clock.d.ts +5 -0
  191. package/types/icons/code-bracket.d.ts +5 -0
  192. package/types/icons/cog.d.ts +5 -0
  193. package/types/icons/copy.d.ts +5 -0
  194. package/types/icons/document.d.ts +5 -0
  195. package/types/icons/download.d.ts +5 -0
  196. package/types/icons/drag.d.ts +5 -0
  197. package/types/icons/ellipsis.d.ts +5 -0
  198. package/types/icons/email.d.ts +5 -0
  199. package/types/icons/external.d.ts +5 -0
  200. package/types/icons/filter.d.ts +5 -0
  201. package/types/icons/flag.d.ts +5 -0
  202. package/types/icons/google.d.ts +5 -0
  203. package/types/icons/home.d.ts +5 -0
  204. package/types/icons/image.d.ts +5 -0
  205. package/types/icons/italic.d.ts +5 -0
  206. package/types/icons/link.d.ts +5 -0
  207. package/types/icons/loader.d.ts +5 -0
  208. package/types/icons/lock.d.ts +5 -0
  209. package/types/icons/logo-mark.d.ts +5 -0
  210. package/types/icons/logo-tagline.d.ts +5 -0
  211. package/types/icons/map-pin.d.ts +5 -0
  212. package/types/icons/menu.d.ts +5 -0
  213. package/types/icons/minus.d.ts +5 -0
  214. package/types/icons/muted.d.ts +5 -0
  215. package/types/icons/pause.d.ts +5 -0
  216. package/types/icons/pencil.d.ts +5 -0
  217. package/types/icons/play.d.ts +5 -0
  218. package/types/icons/plus.d.ts +5 -0
  219. package/types/icons/powered-by.d.ts +5 -0
  220. package/types/icons/qr-code.d.ts +5 -0
  221. package/types/icons/queue.d.ts +5 -0
  222. package/types/icons/refresh.d.ts +5 -0
  223. package/types/icons/refund.d.ts +5 -0
  224. package/types/icons/rocket.d.ts +5 -0
  225. package/types/icons/search.d.ts +5 -0
  226. package/types/icons/share.d.ts +5 -0
  227. package/types/icons/shop.d.ts +5 -0
  228. package/types/icons/sparkles.d.ts +5 -0
  229. package/types/icons/star.d.ts +5 -0
  230. package/types/icons/switch.d.ts +5 -0
  231. package/types/icons/times.d.ts +5 -0
  232. package/types/icons/trash.d.ts +5 -0
  233. package/types/icons/underline.d.ts +5 -0
  234. package/types/icons/upload.d.ts +5 -0
  235. package/types/icons/volume.d.ts +5 -0
  236. package/types/icons/warning.d.ts +5 -0
  237. package/types/input-checkbox.d.ts +14 -0
  238. package/types/input-group.d.ts +15 -0
  239. package/types/input-number.d.ts +17 -0
  240. package/types/input-select.d.ts +19 -0
  241. package/types/input-text.d.ts +12 -0
  242. package/types/input-textarea.d.ts +13 -0
  243. package/types/product.d.ts +20 -0
  244. package/types/styles.d.ts +37 -0
  245. package/types/video.d.ts +20 -0
  246. package/types/wrapper-gradient.d.ts +17 -0
@@ -0,0 +1,1299 @@
1
+ "use client";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // components/advertisement.js
31
+ var advertisement_exports = {};
32
+ __export(advertisement_exports, {
33
+ default: () => advertisement_default
34
+ });
35
+ module.exports = __toCommonJS(advertisement_exports);
36
+
37
+ // components/card-advertisement.js
38
+ var import_react = require("react");
39
+ var import_cdn = require("@drawbridge/shopify/cdn");
40
+ var import_cdn2 = require("@drawbridge/drawbridge-utils/cdn");
41
+ var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
44
+ "img",
45
+ {
46
+ ...{
47
+ alt,
48
+ className,
49
+ src
50
+ }
51
+ }
52
+ );
53
+ var DefaultVideo = ({ className, hls, mp4, poster }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
+ "video",
55
+ {
56
+ ...{
57
+ className,
58
+ poster,
59
+ src: mp4 || hls
60
+ }
61
+ }
62
+ );
63
+ var CardAdvertisement = ({
64
+ advertisement,
65
+ affiliate,
66
+ asset,
67
+ brand = {},
68
+ button,
69
+ campaign,
70
+ fonts,
71
+ ImageComponent = DefaultImage,
72
+ lead,
73
+ onClick = () => {
74
+ },
75
+ onVariantSelect = () => {
76
+ },
77
+ organization,
78
+ page,
79
+ preview = false,
80
+ product,
81
+ title,
82
+ url,
83
+ VideoComponent = DefaultVideo
84
+ }) => {
85
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N;
86
+ const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
87
+ const hasVariants = variants.length > 0;
88
+ const [selectedVariant, setSelectedVariant] = (0, import_react.useState)(variants[0] || null);
89
+ const [keyboard, setKeyboard] = (0, import_react.useState)(false);
90
+ (0, import_react.useEffect)(() => {
91
+ const down = (e) => {
92
+ if (e.key === "Tab") setKeyboard(true);
93
+ };
94
+ const click = () => setKeyboard(false);
95
+ window.addEventListener("keydown", down);
96
+ window.addEventListener("mousedown", click);
97
+ return () => {
98
+ window.removeEventListener("keydown", down);
99
+ window.removeEventListener("mousedown", click);
100
+ };
101
+ }, []);
102
+ const style = {
103
+ background: {
104
+ color: ((_a = brand == null ? void 0 : brand.style) == null ? void 0 : _a.background) ? (_b = brand.style.background) == null ? void 0 : _b.color : {
105
+ hex: "#FFFFFF",
106
+ rgb: "rgb( 255, 255, 255 )"
107
+ }
108
+ },
109
+ text: {
110
+ color: ((_c = brand == null ? void 0 : brand.style) == null ? void 0 : _c.text) ? (_d = brand.style.text) == null ? void 0 : _d.color : {
111
+ hex: "#000000",
112
+ rgb: "rgb( 0, 0, 0 )"
113
+ }
114
+ }
115
+ };
116
+ const classes = {
117
+ asset: [
118
+ "block relative aspect-square rounded overflow-hidden"
119
+ ],
120
+ button: [
121
+ "card-advertisement-button",
122
+ "flex items-center justify-center py-3 px-4 w-full border"
123
+ ],
124
+ container: [
125
+ "card-advertisement",
126
+ "block w-full space-y-2 border border-gray rounded p-6"
127
+ ],
128
+ content: [
129
+ "flex flex-col items-center justify-between gap-x-4 text-center text-sm rounded"
130
+ ]
131
+ };
132
+ const productImage = (selectedVariant == null ? void 0 : selectedVariant.image) || (product == null ? void 0 : product.image) || null;
133
+ const productImageSrc = (0, import_cdn.cdnShopify)(productImage, "400x400", product == null ? void 0 : product.updatedAt);
134
+ if (!(asset == null ? void 0 : asset.sizes) && !productImageSrc) {
135
+ classes.asset.push("bg-gray-light");
136
+ }
137
+ ;
138
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
139
+ "div",
140
+ {
141
+ ...{
142
+ className: classes.container.join(" "),
143
+ style: {
144
+ backgroundColor: (_f = (_e = style == null ? void 0 : style.background) == null ? void 0 : _e.color) == null ? void 0 : _f.hex,
145
+ color: (_h = (_g = style == null ? void 0 : style.text) == null ? void 0 : _g.color) == null ? void 0 : _h.hex
146
+ }
147
+ },
148
+ children: [
149
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
150
+ "span",
151
+ {
152
+ ...{
153
+ className: classes.asset.join(" ")
154
+ },
155
+ children: [
156
+ (asset == null ? void 0 : asset.sizes) && asset.mimetype.includes("image") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
157
+ ImageComponent,
158
+ {
159
+ ...{
160
+ alt: asset == null ? void 0 : asset.filename,
161
+ className: "w-full h-full object-cover",
162
+ fill: true,
163
+ priority: false,
164
+ sizes: "100%",
165
+ src: (0, import_cdn2.cdnSrc)(asset, "400x400", asset == null ? void 0 : asset.updatedAt)
166
+ }
167
+ },
168
+ asset == null ? void 0 : asset.id
169
+ ),
170
+ !(asset == null ? void 0 : asset.sizes) && productImageSrc && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
171
+ ImageComponent,
172
+ {
173
+ ...{
174
+ alt: (product == null ? void 0 : product.title) || "Product",
175
+ className: "w-full h-full object-cover",
176
+ fill: true,
177
+ priority: false,
178
+ sizes: "100%",
179
+ src: productImageSrc,
180
+ unoptimized: true
181
+ }
182
+ },
183
+ productImageSrc
184
+ ),
185
+ (asset == null ? void 0 : asset.sizes) && asset.mimetype.includes("video") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
186
+ "div",
187
+ {
188
+ ...{
189
+ className: "relative h-full w-full aspect-[9/16]"
190
+ },
191
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
192
+ VideoComponent,
193
+ {
194
+ ...{
195
+ className: "w-full h-full",
196
+ hls: (0, import_cdn2.cdnSrc)(asset, "hls", asset == null ? void 0 : asset.updatedAt),
197
+ mp4: (0, import_cdn2.cdnSrc)(asset, "original", asset == null ? void 0 : asset.updatedAt),
198
+ poster: (0, import_cdn2.cdnSrc)((_i = asset == null ? void 0 : asset.frames) == null ? void 0 : _i[asset == null ? void 0 : asset.poster], "500x500", asset == null ? void 0 : asset.updatedAt) || (0, import_cdn2.cdnSrc)((_j = asset == null ? void 0 : asset.frames) == null ? void 0 : _j[asset == null ? void 0 : asset.poster], "1080x1920", asset == null ? void 0 : asset.updatedAt)
199
+ }
200
+ }
201
+ )
202
+ }
203
+ )
204
+ ]
205
+ }
206
+ ),
207
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
208
+ "span",
209
+ {
210
+ ...{
211
+ className: classes.content.join(" "),
212
+ style: {
213
+ ...fonts == null ? void 0 : fonts.body,
214
+ color: (_l = (_k = style == null ? void 0 : style.text) == null ? void 0 : _k.color) == null ? void 0 : _l.hex,
215
+ gap: "10px",
216
+ marginTop: "10px"
217
+ }
218
+ },
219
+ children: [
220
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
221
+ "div",
222
+ {
223
+ ...{
224
+ className: "flex-1 min-w-0 space-y-2"
225
+ },
226
+ children: [
227
+ title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
228
+ "p",
229
+ {
230
+ ...{
231
+ style: {
232
+ fontSize: "18px"
233
+ }
234
+ },
235
+ children: title
236
+ }
237
+ ),
238
+ (selectedVariant == null ? void 0 : selectedVariant.price) && (selectedVariant == null ? void 0 : selectedVariant.currency) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
239
+ "p",
240
+ {
241
+ ...{
242
+ style: {
243
+ fontSize: "14px",
244
+ marginBottom: "10px"
245
+ }
246
+ },
247
+ children: [
248
+ (selectedVariant == null ? void 0 : selectedVariant.sale) && selectedVariant.sale > selectedVariant.price && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
249
+ "span",
250
+ {
251
+ ...{
252
+ style: {
253
+ marginRight: "6px",
254
+ opacity: 0.5,
255
+ textDecoration: "line-through"
256
+ }
257
+ },
258
+ children: (0, import_drawbridge_utils.formatCurrency)({
259
+ code: selectedVariant.currency,
260
+ display: "parts",
261
+ value: selectedVariant.sale
262
+ })
263
+ }
264
+ ),
265
+ (0, import_drawbridge_utils.formatCurrency)({
266
+ code: selectedVariant.currency,
267
+ display: "parts",
268
+ value: selectedVariant.price
269
+ })
270
+ ]
271
+ }
272
+ ),
273
+ variants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
274
+ "div",
275
+ {
276
+ ...{
277
+ className: "relative w-full"
278
+ },
279
+ children: [
280
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
281
+ "select",
282
+ {
283
+ ...{
284
+ className: "input appearance-none " + (keyboard ? "focus-visible:!outline-1 focus-visible:!ring-1 focus-visible:!ring-blue-600" : "focus-visible:!outline-0 focus-visible:!ring-0"),
285
+ onChange: (e) => {
286
+ const variant = variants.find((v) => v.id === e.target.value);
287
+ if (variant) setSelectedVariant(variant);
288
+ },
289
+ style: {
290
+ appearance: "none",
291
+ backgroundColor: (_n = (_m = style == null ? void 0 : style.background) == null ? void 0 : _m.color) == null ? void 0 : _n.rgb,
292
+ backgroundImage: "none",
293
+ borderColor: (_p = (_o = style == null ? void 0 : style.text) == null ? void 0 : _o.color) == null ? void 0 : _p.rgb,
294
+ borderRadius: ((_r = (_q = brand == null ? void 0 : brand.style) == null ? void 0 : _q.button) == null ? void 0 : _r.radius) != null ? brand.style.button.radius / 4 + "px" : void 0,
295
+ color: (_t = (_s = style == null ? void 0 : style.text) == null ? void 0 : _s.color) == null ? void 0 : _t.rgb,
296
+ WebkitAppearance: "none"
297
+ },
298
+ value: (selectedVariant == null ? void 0 : selectedVariant.id) || ""
299
+ },
300
+ children: variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
301
+ "option",
302
+ {
303
+ ...{
304
+ value: variant.id
305
+ },
306
+ children: variant.title
307
+ },
308
+ variant.id
309
+ ))
310
+ }
311
+ ),
312
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
313
+ "div",
314
+ {
315
+ ...{
316
+ "aria-hidden": true,
317
+ style: {
318
+ alignItems: "center",
319
+ bottom: 0,
320
+ display: "flex",
321
+ paddingRight: "0.625rem",
322
+ pointerEvents: "none",
323
+ position: "absolute",
324
+ right: 0,
325
+ top: 0
326
+ }
327
+ },
328
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
329
+ "svg",
330
+ {
331
+ ...{
332
+ style: {
333
+ height: "1.25rem",
334
+ width: "1.25rem"
335
+ },
336
+ fill: "none",
337
+ stroke: "currentColor",
338
+ strokeWidth: 1.5,
339
+ viewBox: "0 0 24 24",
340
+ xmlns: "http://www.w3.org/2000/svg"
341
+ },
342
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
343
+ "path",
344
+ {
345
+ ...{
346
+ d: "M19.5 8.25l-7.5 7.5-7.5-7.5",
347
+ strokeLinecap: "round",
348
+ strokeLinejoin: "round"
349
+ }
350
+ }
351
+ )
352
+ }
353
+ )
354
+ }
355
+ )
356
+ ]
357
+ }
358
+ )
359
+ ]
360
+ }
361
+ ),
362
+ button && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
363
+ "button",
364
+ {
365
+ ...{
366
+ className: classes.button.join(" "),
367
+ disabled: !preview && !hasVariants && !url,
368
+ onClick: hasVariants ? () => {
369
+ if (!preview) onVariantSelect(selectedVariant);
370
+ } : preview ? () => {
371
+ } : onClick,
372
+ style: {
373
+ backgroundColor: ((_x = (_w = (_v = (_u = brand == null ? void 0 : brand.style) == null ? void 0 : _u.button) == null ? void 0 : _v.background) == null ? void 0 : _w.color) == null ? void 0 : _x.hex) || ((_z = (_y = style == null ? void 0 : style.text) == null ? void 0 : _y.color) == null ? void 0 : _z.hex),
374
+ borderColor: ((_D = (_C = (_B = (_A = brand == null ? void 0 : brand.style) == null ? void 0 : _A.button) == null ? void 0 : _B.background) == null ? void 0 : _C.color) == null ? void 0 : _D.hex) || ((_F = (_E = style == null ? void 0 : style.text) == null ? void 0 : _E.color) == null ? void 0 : _F.hex),
375
+ borderRadius: ((_H = (_G = brand == null ? void 0 : brand.style) == null ? void 0 : _G.button) == null ? void 0 : _H.radius) != null ? brand.style.button.radius / 4 + "px" : void 0,
376
+ color: ((_L = (_K = (_J = (_I = brand == null ? void 0 : brand.style) == null ? void 0 : _I.button) == null ? void 0 : _J.text) == null ? void 0 : _K.color) == null ? void 0 : _L.hex) || ((_N = (_M = style == null ? void 0 : style.background) == null ? void 0 : _M.color) == null ? void 0 : _N.hex)
377
+ },
378
+ type: "button"
379
+ },
380
+ children: button
381
+ }
382
+ )
383
+ ]
384
+ }
385
+ )
386
+ ]
387
+ }
388
+ );
389
+ };
390
+ var card_advertisement_default = CardAdvertisement;
391
+
392
+ // components/product.js
393
+ var import_react5 = require("react");
394
+ var import_embla_carousel_react = __toESM(require("embla-carousel-react"));
395
+ var import_cdn3 = require("@drawbridge/shopify/cdn");
396
+ var import_drawbridge_utils2 = require("@drawbridge/drawbridge-utils");
397
+
398
+ // components/input-group.js
399
+ var import_react2 = require("react");
400
+
401
+ // components/icons/warning.js
402
+ var import_jsx_runtime2 = require("react/jsx-runtime");
403
+ var Warning = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
404
+ "svg",
405
+ {
406
+ ...{
407
+ fill: "none",
408
+ stroke: "currentColor",
409
+ strokeWidth: 1.5,
410
+ viewBox: "0 0 24 24",
411
+ ...props
412
+ },
413
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
414
+ "path",
415
+ {
416
+ ...{
417
+ d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z",
418
+ strokeLinecap: "round",
419
+ strokeLinejoin: "round"
420
+ }
421
+ }
422
+ )
423
+ }
424
+ );
425
+ var warning_default = Warning;
426
+
427
+ // components/input-group.js
428
+ var import_jsx_runtime3 = require("react/jsx-runtime");
429
+ var InputGroup = ({
430
+ className,
431
+ error,
432
+ input,
433
+ label,
434
+ message,
435
+ style = {}
436
+ }) => {
437
+ var _a, _b, _c, _d;
438
+ const classes = [
439
+ "input-group"
440
+ ];
441
+ if (className) {
442
+ classes.push(className);
443
+ }
444
+ if (error) {
445
+ classes.push("error");
446
+ }
447
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
448
+ "div",
449
+ {
450
+ ...{
451
+ className: classes.join(" "),
452
+ "aria-live": "polite"
453
+ },
454
+ children: [
455
+ label ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
456
+ "div",
457
+ {
458
+ ...{
459
+ className: "space-y-2"
460
+ },
461
+ children: [
462
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
463
+ "span",
464
+ {
465
+ ...{
466
+ className: "block"
467
+ },
468
+ children: label
469
+ }
470
+ ),
471
+ input
472
+ ]
473
+ }
474
+ ) : input,
475
+ (error || message) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
476
+ "p",
477
+ {
478
+ ...{
479
+ className: "flex items-center justify-start space-x-2 py-1 rounded text-sm " + (error && "px-1.5"),
480
+ ...error && Object.keys(style).length > 0 && {
481
+ style: {
482
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb.replace(")", ",.1)"),
483
+ color: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb
484
+ }
485
+ }
486
+ },
487
+ children: [
488
+ error && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react2.Fragment, { children: [
489
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
490
+ warning_default,
491
+ {
492
+ ...{
493
+ className: "w-4 h-4",
494
+ "aria-hidden": true
495
+ }
496
+ }
497
+ ),
498
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
499
+ "span",
500
+ {
501
+ ...{
502
+ className: "text-[0px] opacity-0 w-0 h-0 absolute"
503
+ },
504
+ children: [
505
+ label,
506
+ ": ",
507
+ error
508
+ ]
509
+ }
510
+ )
511
+ ] }),
512
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
513
+ "span",
514
+ {
515
+ ...{
516
+ ...error && {
517
+ "aria-hidden": true
518
+ }
519
+ },
520
+ children: error || message
521
+ }
522
+ )
523
+ ]
524
+ }
525
+ )
526
+ ]
527
+ }
528
+ );
529
+ };
530
+ var input_group_default = InputGroup;
531
+
532
+ // components/input-select.js
533
+ var import_react3 = require("react");
534
+
535
+ // components/icons/chevron-down.js
536
+ var import_jsx_runtime4 = require("react/jsx-runtime");
537
+ var ChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
538
+ "svg",
539
+ {
540
+ ...{
541
+ fill: "none",
542
+ stroke: "currentColor",
543
+ strokeWidth: 1.5,
544
+ viewBox: "0 0 24 24",
545
+ ...props
546
+ },
547
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
548
+ "path",
549
+ {
550
+ ...{
551
+ d: "m19.5 8.25-7.5 7.5-7.5-7.5",
552
+ strokeLinecap: "round",
553
+ strokeLinejoin: "round"
554
+ }
555
+ }
556
+ )
557
+ }
558
+ );
559
+ var chevron_down_default = ChevronDown;
560
+
561
+ // components/styles.js
562
+ var buttonStyle = (style) => {
563
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
564
+ return {
565
+ backgroundColor: ((_c = (_b = (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.background) == null ? void 0 : _b.color) == null ? void 0 : _c.rgb) || ((_e = (_d = style == null ? void 0 : style.text) == null ? void 0 : _d.color) == null ? void 0 : _e.rgb),
566
+ borderColor: ((_h = (_g = (_f = style == null ? void 0 : style.button) == null ? void 0 : _f.background) == null ? void 0 : _g.color) == null ? void 0 : _h.rgb) || ((_j = (_i = style == null ? void 0 : style.text) == null ? void 0 : _i.color) == null ? void 0 : _j.rgb),
567
+ borderRadius: ((_k = style == null ? void 0 : style.button) == null ? void 0 : _k.radius) != null ? style.button.radius / 4 + "px" : void 0,
568
+ color: ((_n = (_m = (_l = style == null ? void 0 : style.button) == null ? void 0 : _l.text) == null ? void 0 : _m.color) == null ? void 0 : _n.rgb) || ((_p = (_o = style == null ? void 0 : style.background) == null ? void 0 : _o.color) == null ? void 0 : _p.rgb)
569
+ };
570
+ };
571
+ var inputStyle = (style) => {
572
+ var _a, _b, _c, _d, _e, _f, _g;
573
+ return {
574
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb,
575
+ borderColor: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb,
576
+ borderRadius: ((_e = style == null ? void 0 : style.input) == null ? void 0 : _e.radius) != null ? style.input.radius / 4 + "px" : void 0,
577
+ color: (_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
578
+ };
579
+ };
580
+
581
+ // components/input-select.js
582
+ var import_jsx_runtime5 = require("react/jsx-runtime");
583
+ var InputSelect = ({
584
+ onChange,
585
+ options = [],
586
+ style,
587
+ value,
588
+ ...rest
589
+ }) => {
590
+ const [keyboard, setKeyboard] = (0, import_react3.useState)(false);
591
+ (0, import_react3.useEffect)(() => {
592
+ const down = (e) => {
593
+ if (e.key === "Tab") setKeyboard(true);
594
+ };
595
+ const click = () => setKeyboard(false);
596
+ window.addEventListener("keydown", down);
597
+ window.addEventListener("mousedown", click);
598
+ return () => {
599
+ window.removeEventListener("keydown", down);
600
+ window.removeEventListener("mousedown", click);
601
+ };
602
+ }, []);
603
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
604
+ "div",
605
+ {
606
+ ...{
607
+ className: "relative"
608
+ },
609
+ children: [
610
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
611
+ "select",
612
+ {
613
+ ...{
614
+ ...rest,
615
+ className: "input appearance-none " + (keyboard ? "focus-visible:!outline-1 focus-visible:!ring-1 focus-visible:!ring-blue-600" : "focus-visible:!outline-0 focus-visible:!ring-0"),
616
+ onChange: ({ target }) => onChange(target == null ? void 0 : target.value),
617
+ style: inputStyle(style),
618
+ value
619
+ },
620
+ children: [
621
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
622
+ "option",
623
+ {
624
+ ...{
625
+ disabled: true,
626
+ "aria-label": "Select option",
627
+ value: ""
628
+ },
629
+ children: "Select"
630
+ }
631
+ ),
632
+ options.map(({ label, option, value: optValue }, key) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
633
+ "option",
634
+ {
635
+ ...{
636
+ value: optValue ?? option
637
+ },
638
+ children: label ?? option
639
+ },
640
+ "input-select-option-" + key
641
+ ))
642
+ ]
643
+ }
644
+ ),
645
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
646
+ "div",
647
+ {
648
+ ...{
649
+ "aria-hidden": true,
650
+ className: "h-full flex items-center absolute inset-y-0 right-0 pointer-events-none px-2.5"
651
+ },
652
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
653
+ chevron_down_default,
654
+ {
655
+ ...{
656
+ className: "w-5 h-5 text-inherit"
657
+ }
658
+ }
659
+ )
660
+ }
661
+ )
662
+ ]
663
+ }
664
+ );
665
+ };
666
+ var input_select_default = InputSelect;
667
+
668
+ // components/wrapper-gradient.js
669
+ var import_react4 = require("react");
670
+ var import_jsx_runtime6 = require("react/jsx-runtime");
671
+ var WrapperGradientContext = (0, import_react4.createContext)(null);
672
+ var WrapperGradient = ({
673
+ children,
674
+ className,
675
+ classNameGradient,
676
+ classNameScroll,
677
+ color,
678
+ gradientTopOffset,
679
+ horizontal = false
680
+ }) => {
681
+ const showX = horizontal === true || horizontal === "both";
682
+ const showY = horizontal === false || horizontal === "both";
683
+ const overflowClass = horizontal === "both" ? "overflow-scroll" : horizontal ? "overflow-x-scroll overflow-y-visible" : "overflow-y-scroll overflow-x-visible";
684
+ const overscrollClass = horizontal === "both" ? "overscroll-none" : horizontal ? "overscroll-x-none overscroll-y-auto" : "overscroll-y-none overscroll-x-auto";
685
+ const themed = Boolean(color);
686
+ const gradientDefaults = "absolute z-[2] " + (themed ? "pointer-events-none " : "") + "transition-all duration-[100ms] ";
687
+ const classes = {
688
+ container: [
689
+ themed ? "relative" : "w-full relative",
690
+ ...className ? [className] : []
691
+ ],
692
+ inner: [
693
+ "w-full relative scroll-smooth hide-scrollbar",
694
+ overscrollClass,
695
+ overflowClass,
696
+ ...classNameScroll ? [classNameScroll] : []
697
+ ],
698
+ topGradient: [
699
+ gradientDefaults,
700
+ "w-full -top-[1px]",
701
+ ...themed ? [] : ["bg-gradient-to-b"],
702
+ ...classNameGradient ? [classNameGradient] : themed ? ["h-10"] : ["from-white to-transparent h-10"]
703
+ ],
704
+ bottomGradient: [
705
+ gradientDefaults,
706
+ "w-full -bottom-[1px]",
707
+ ...themed ? [] : ["bg-gradient-to-t"],
708
+ ...classNameGradient ? [classNameGradient] : themed ? ["h-10"] : ["from-white to-transparent h-10"]
709
+ ],
710
+ leftGradient: [
711
+ gradientDefaults,
712
+ "h-full top-0 left-0",
713
+ ...themed ? [] : ["bg-gradient-to-r"],
714
+ ...classNameGradient ? [classNameGradient] : themed ? ["w-4"] : ["from-white from-30% to-transparent w-4"]
715
+ ],
716
+ rightGradient: [
717
+ gradientDefaults,
718
+ "h-full top-0 right-0",
719
+ ...themed ? [] : ["bg-gradient-to-l"],
720
+ ...classNameGradient ? [classNameGradient] : themed ? ["w-4"] : ["from-white from-30% to-transparent w-4"]
721
+ ]
722
+ };
723
+ const gradients = {
724
+ top: "linear-gradient( to bottom, " + color + " 0%, transparent 100% )",
725
+ bottom: "linear-gradient( to top, " + color + " 0%, transparent 100% )",
726
+ left: "linear-gradient( to right, " + color + " 0%, transparent 100% )",
727
+ right: "linear-gradient( to left, " + color + " 0%, transparent 100% )"
728
+ };
729
+ const containerRef = (0, import_react4.useRef)(null);
730
+ const [scroll, setScroll] = (0, import_react4.useState)({
731
+ top: 0,
732
+ left: 0,
733
+ atBottom: true,
734
+ atRight: true
735
+ });
736
+ (0, import_react4.useEffect)(
737
+ () => {
738
+ const container = containerRef.current;
739
+ const handleScroll = () => {
740
+ const { scrollTop, scrollLeft, scrollHeight, scrollWidth, clientHeight, clientWidth } = container;
741
+ setScroll({
742
+ top: scrollTop,
743
+ left: scrollLeft,
744
+ atBottom: scrollTop + clientHeight >= scrollHeight - 1,
745
+ atRight: scrollLeft + clientWidth >= scrollWidth - 1
746
+ });
747
+ };
748
+ const handleUpdate = () => {
749
+ const { scrollHeight, scrollWidth, clientHeight, clientWidth } = container;
750
+ if (scrollHeight <= clientHeight && scrollWidth <= clientWidth) {
751
+ setScroll({
752
+ top: 0,
753
+ left: 0,
754
+ atBottom: true,
755
+ atRight: true
756
+ });
757
+ return;
758
+ }
759
+ ;
760
+ handleScroll();
761
+ };
762
+ handleUpdate();
763
+ container.addEventListener("scroll", handleScroll);
764
+ const observer = new MutationObserver((mutations) => {
765
+ for (const mutation of mutations) {
766
+ if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
767
+ handleUpdate();
768
+ break;
769
+ }
770
+ }
771
+ });
772
+ observer.observe(container, {
773
+ childList: true,
774
+ subtree: true
775
+ });
776
+ const resizeObserver = new ResizeObserver(handleUpdate);
777
+ resizeObserver.observe(container);
778
+ return () => {
779
+ container.removeEventListener("scroll", handleScroll);
780
+ observer.disconnect();
781
+ resizeObserver.disconnect();
782
+ };
783
+ },
784
+ [horizontal]
785
+ );
786
+ const contextValue = (0, import_react4.useMemo)(
787
+ () => ({
788
+ atBottom: scroll.atBottom,
789
+ atRight: scroll.atRight
790
+ }),
791
+ [scroll.atBottom, scroll.atRight]
792
+ );
793
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
794
+ "div",
795
+ {
796
+ ...{
797
+ className: classes.container.join(" ")
798
+ },
799
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(WrapperGradientContext.Provider, { value: contextValue, children: [
800
+ showY && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
801
+ "div",
802
+ {
803
+ ...{
804
+ className: classes.topGradient.join(" ") + (scroll.top > 5 ? " opacity-100 visible" : " opacity-0 invisible"),
805
+ style: {
806
+ ...themed && {
807
+ backgroundImage: gradients.top
808
+ },
809
+ ...gradientTopOffset && {
810
+ top: gradientTopOffset
811
+ }
812
+ }
813
+ }
814
+ }
815
+ ),
816
+ showX && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
817
+ "div",
818
+ {
819
+ ...{
820
+ className: classes.leftGradient.join(" ") + (scroll.left > 5 ? " opacity-100 visible" : " opacity-0 invisible"),
821
+ style: {
822
+ ...themed && {
823
+ backgroundImage: gradients.left
824
+ }
825
+ }
826
+ }
827
+ }
828
+ ),
829
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
830
+ "div",
831
+ {
832
+ ...{
833
+ className: classes.inner.join(" "),
834
+ ref: containerRef
835
+ },
836
+ children
837
+ }
838
+ ),
839
+ showY && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
840
+ "div",
841
+ {
842
+ ...{
843
+ className: classes.bottomGradient.join(" ") + (!scroll.atBottom ? " opacity-100 visible" : " opacity-0 invisible"),
844
+ style: {
845
+ ...themed && {
846
+ backgroundImage: gradients.bottom
847
+ }
848
+ }
849
+ }
850
+ }
851
+ ),
852
+ showX && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
853
+ "div",
854
+ {
855
+ ...{
856
+ className: classes.rightGradient.join(" ") + (!scroll.atRight ? " opacity-100 visible" : " opacity-0 invisible"),
857
+ style: {
858
+ ...themed && {
859
+ backgroundImage: gradients.right
860
+ }
861
+ }
862
+ }
863
+ }
864
+ )
865
+ ] })
866
+ }
867
+ );
868
+ };
869
+ var wrapper_gradient_default = WrapperGradient;
870
+
871
+ // components/icons/loader.js
872
+ var import_jsx_runtime7 = require("react/jsx-runtime");
873
+ var Loader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
874
+ "svg",
875
+ {
876
+ ...{
877
+ fill: "none",
878
+ stroke: "none",
879
+ strokeWidth: 0,
880
+ viewBox: "0 0 24 24",
881
+ className: ["animate-spin", className].filter(Boolean).join(" "),
882
+ ...props
883
+ },
884
+ children: [
885
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
886
+ "circle",
887
+ {
888
+ ...{
889
+ className: "opacity-25",
890
+ cx: 12,
891
+ cy: 12,
892
+ r: 10,
893
+ stroke: "currentColor",
894
+ strokeWidth: 4
895
+ }
896
+ }
897
+ ),
898
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
899
+ "path",
900
+ {
901
+ ...{
902
+ className: "opacity-75",
903
+ fill: "currentColor",
904
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
905
+ }
906
+ }
907
+ )
908
+ ]
909
+ }
910
+ );
911
+ var loader_default = Loader;
912
+
913
+ // components/product.js
914
+ var import_jsx_runtime8 = require("react/jsx-runtime");
915
+ var DefaultImage2 = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
916
+ "img",
917
+ {
918
+ ...{
919
+ alt,
920
+ className,
921
+ src
922
+ }
923
+ }
924
+ );
925
+ var Product = ({
926
+ action = null,
927
+ disabled = false,
928
+ errors = {},
929
+ header,
930
+ ImageComponent = DefaultImage2,
931
+ onAdd = () => {
932
+ },
933
+ onBuy = () => {
934
+ },
935
+ onVariantChange = () => {
936
+ },
937
+ product,
938
+ style = {},
939
+ variant
940
+ }) => {
941
+ var _a, _b, _c, _d, _e, _f, _g;
942
+ const available = (0, import_react5.useMemo)(
943
+ () => ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale),
944
+ [product]
945
+ );
946
+ const [activeImage, setActiveImage] = (0, import_react5.useState)(0);
947
+ const [emblaRef, emblaApi] = (0, import_embla_carousel_react.default)();
948
+ const selectedVariant = available.find((v) => v.id === variant) || null;
949
+ const images = (0, import_react5.useMemo)(
950
+ () => {
951
+ const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
952
+ const result = [];
953
+ const seen = /* @__PURE__ */ new Set();
954
+ if (product == null ? void 0 : product.image) {
955
+ seen.add(product.image);
956
+ result.push({
957
+ src: product.image,
958
+ variant: null
959
+ });
960
+ }
961
+ for (const v of variants) {
962
+ if (v.image && !seen.has(v.image)) {
963
+ seen.add(v.image);
964
+ result.push({
965
+ src: v.image,
966
+ variant: v
967
+ });
968
+ }
969
+ }
970
+ return result;
971
+ },
972
+ [product]
973
+ );
974
+ (0, import_react5.useEffect)(
975
+ () => {
976
+ if (!emblaApi) return;
977
+ const onSelect = () => {
978
+ const idx = emblaApi.selectedScrollSnap();
979
+ setActiveImage(idx);
980
+ const img = images[idx];
981
+ if (img == null ? void 0 : img.variant) onVariantChange(img.variant.id);
982
+ };
983
+ emblaApi.on("select", onSelect);
984
+ return () => emblaApi.off("select", onSelect);
985
+ },
986
+ [emblaApi, images, onVariantChange]
987
+ );
988
+ const handleVariant = (value) => {
989
+ onVariantChange(value);
990
+ const v = available.find((x) => x.id === value);
991
+ if (!(v == null ? void 0 : v.image)) return;
992
+ const idx = images.findIndex((img) => img.src === v.image);
993
+ if (idx >= 0) {
994
+ setActiveImage(idx);
995
+ emblaApi == null ? void 0 : emblaApi.scrollTo(idx);
996
+ }
997
+ ;
998
+ };
999
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1000
+ "div",
1001
+ {
1002
+ ...{
1003
+ className: "space-y-6 pb-12"
1004
+ },
1005
+ children: [
1006
+ header,
1007
+ images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1008
+ "div",
1009
+ {
1010
+ ...{
1011
+ className: "flex items-center h-48 " + (images.length > 1 && "pr-12")
1012
+ },
1013
+ children: [
1014
+ images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1015
+ wrapper_gradient_default,
1016
+ {
1017
+ ...{
1018
+ classNameScroll: "flex flex-col w-12 h-48 space-y-3",
1019
+ color: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb
1020
+ },
1021
+ children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1022
+ "button",
1023
+ {
1024
+ ...{
1025
+ className: "relative w-12 h-12 overflow-hidden rounded shrink-0 border border-transparent",
1026
+ onClick: () => {
1027
+ setActiveImage(key);
1028
+ emblaApi == null ? void 0 : emblaApi.scrollTo(key);
1029
+ },
1030
+ type: "button",
1031
+ ...activeImage === key && {
1032
+ style: inputStyle(style)
1033
+ }
1034
+ },
1035
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1036
+ ImageComponent,
1037
+ {
1038
+ ...{
1039
+ alt: product.title + " thumbnail " + key,
1040
+ className: "object-cover",
1041
+ fill: true,
1042
+ sizes: "48px",
1043
+ src: (0, import_cdn3.cdnShopify)(src, "100x100", product == null ? void 0 : product.updatedAt) || src,
1044
+ unoptimized: true
1045
+ }
1046
+ }
1047
+ )
1048
+ },
1049
+ "thumbnail-" + key
1050
+ ))
1051
+ }
1052
+ ),
1053
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1054
+ "div",
1055
+ {
1056
+ ...{
1057
+ className: "aspect-square w-48 overflow-hidden rounded-3xl m-auto",
1058
+ ref: emblaRef
1059
+ },
1060
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1061
+ "div",
1062
+ {
1063
+ ...{
1064
+ className: "flex h-full"
1065
+ },
1066
+ children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1067
+ "div",
1068
+ {
1069
+ ...{
1070
+ className: "min-w-0 flex-[0_0_100%] relative h-full bg-gray-100"
1071
+ },
1072
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1073
+ ImageComponent,
1074
+ {
1075
+ ...{
1076
+ alt: product.title + " image " + key,
1077
+ className: "object-cover",
1078
+ fill: true,
1079
+ sizes: "192px",
1080
+ src: (0, import_cdn3.cdnShopify)(src, "400x400", product == null ? void 0 : product.updatedAt) || src,
1081
+ unoptimized: true
1082
+ }
1083
+ }
1084
+ )
1085
+ },
1086
+ "image-" + key
1087
+ ))
1088
+ }
1089
+ )
1090
+ }
1091
+ )
1092
+ ]
1093
+ }
1094
+ ),
1095
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1096
+ "div",
1097
+ {
1098
+ ...{
1099
+ className: "text-center space-y-2"
1100
+ },
1101
+ children: [
1102
+ (product == null ? void 0 : product.title) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1103
+ "h2",
1104
+ {
1105
+ ...{
1106
+ className: "max-w-80 mx-auto",
1107
+ style: {
1108
+ fontFamily: ((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.family) || (style == null ? void 0 : style.fontFamily) || "Roboto Flex",
1109
+ fontWeight: ((_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.weight) || (style == null ? void 0 : style.fontWeight),
1110
+ textTransform: ((_e = style == null ? void 0 : style.heading) == null ? void 0 : _e.transform) || (style == null ? void 0 : style.textTransform)
1111
+ }
1112
+ },
1113
+ children: product == null ? void 0 : product.title
1114
+ }
1115
+ ),
1116
+ !available.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: "Unavailable" }) : (selectedVariant == null ? void 0 : selectedVariant.price) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: (0, import_drawbridge_utils2.formatCurrency)({
1117
+ code: selectedVariant.currency,
1118
+ display: "parts",
1119
+ value: selectedVariant.price
1120
+ }) }),
1121
+ (product == null ? void 0 : product.description) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1122
+ wrapper_gradient_default,
1123
+ {
1124
+ ...{
1125
+ classNameScroll: "max-h-[4.5em]",
1126
+ color: (_g = (_f = style == null ? void 0 : style.background) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
1127
+ },
1128
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: product.description })
1129
+ }
1130
+ )
1131
+ ]
1132
+ }
1133
+ ),
1134
+ available.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1135
+ input_group_default,
1136
+ {
1137
+ ...{
1138
+ error: errors == null ? void 0 : errors.variant,
1139
+ input: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1140
+ input_select_default,
1141
+ {
1142
+ ...{
1143
+ disabled,
1144
+ onChange: handleVariant,
1145
+ options: available.map((v) => ({
1146
+ label: v.title,
1147
+ value: v.id
1148
+ })),
1149
+ style,
1150
+ value: variant || ""
1151
+ }
1152
+ }
1153
+ ),
1154
+ style
1155
+ }
1156
+ }
1157
+ ),
1158
+ available.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1159
+ input_group_default,
1160
+ {
1161
+ ...{
1162
+ error: errors == null ? void 0 : errors.root,
1163
+ input: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1164
+ "div",
1165
+ {
1166
+ ...{
1167
+ className: "grid grid-cols-2 gap-3"
1168
+ },
1169
+ children: [
1170
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1171
+ "button",
1172
+ {
1173
+ ...{
1174
+ className: "button justify-center border",
1175
+ disabled: disabled || Boolean(action),
1176
+ onClick: onAdd,
1177
+ style: inputStyle(style),
1178
+ type: "button"
1179
+ },
1180
+ children: action === "add" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1181
+ loader_default,
1182
+ {
1183
+ ...{
1184
+ className: "w-6 h-6 animate-spin"
1185
+ }
1186
+ }
1187
+ ) : "Add to cart"
1188
+ }
1189
+ ),
1190
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1191
+ "button",
1192
+ {
1193
+ ...{
1194
+ className: "button justify-center",
1195
+ disabled: disabled || Boolean(action),
1196
+ onClick: onBuy,
1197
+ style: buttonStyle(style),
1198
+ type: "button"
1199
+ },
1200
+ children: action === "buy" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1201
+ loader_default,
1202
+ {
1203
+ ...{
1204
+ className: "w-6 h-6 animate-spin"
1205
+ }
1206
+ }
1207
+ ) : "Buy now"
1208
+ }
1209
+ )
1210
+ ]
1211
+ }
1212
+ ),
1213
+ style
1214
+ }
1215
+ }
1216
+ )
1217
+ ]
1218
+ }
1219
+ );
1220
+ };
1221
+ var product_default = Product;
1222
+
1223
+ // components/advertisement.js
1224
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1225
+ var Advertisement = ({
1226
+ action = null,
1227
+ affiliate,
1228
+ brand,
1229
+ button,
1230
+ campaign,
1231
+ disabled = false,
1232
+ errors,
1233
+ file,
1234
+ header,
1235
+ id,
1236
+ ImageComponent,
1237
+ lead,
1238
+ onAdd,
1239
+ onBuy,
1240
+ onClick = () => {
1241
+ },
1242
+ onVariantChange,
1243
+ onVariantSelect = () => {
1244
+ },
1245
+ organization,
1246
+ page,
1247
+ preview = false,
1248
+ product,
1249
+ style = {},
1250
+ title,
1251
+ url,
1252
+ variant,
1253
+ VideoComponent
1254
+ }) => {
1255
+ if (product) {
1256
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1257
+ product_default,
1258
+ {
1259
+ ...{
1260
+ action,
1261
+ disabled: preview || disabled,
1262
+ errors,
1263
+ header,
1264
+ ImageComponent,
1265
+ onAdd,
1266
+ onBuy,
1267
+ onVariantChange,
1268
+ product,
1269
+ style,
1270
+ variant
1271
+ }
1272
+ }
1273
+ );
1274
+ }
1275
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1276
+ card_advertisement_default,
1277
+ {
1278
+ ...{
1279
+ advertisement: id,
1280
+ affiliate,
1281
+ asset: file,
1282
+ brand: brand || { style },
1283
+ button,
1284
+ campaign,
1285
+ ImageComponent,
1286
+ lead,
1287
+ onClick,
1288
+ onVariantSelect,
1289
+ organization,
1290
+ page,
1291
+ preview,
1292
+ title,
1293
+ url,
1294
+ VideoComponent
1295
+ }
1296
+ }
1297
+ );
1298
+ };
1299
+ var advertisement_default = Advertisement;