@askdialog/dialog-react 2.8.0 → 2.10.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.
- package/README.md +7 -6
- package/dist/components/DialogSearch/DialogSearchCollections.d.ts +2 -2
- package/dist/components/DialogSearch/DialogSearchProductCard.d.ts +2 -2
- package/dist/components/DialogSearch/DialogSearchProducts.d.ts +2 -2
- package/dist/components/DialogSearch/searchCollections.d.ts +3 -3
- package/dist/components/DialogSearch/searchDisplay.d.ts +4 -4
- package/dist/components/DialogSearch/useDialogSearch.d.ts +6 -4
- package/dist/dialog-react.css +1 -1
- package/dist/dialog-react.js +323 -329
- package/dist/dialog-react.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/dialog-react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { registerDialogInstallation as M, addAuditCapability as F, resolveTextDirection as U, SearchStatus as L,
|
|
4
|
-
import { createPortal as
|
|
1
|
+
import { jsx as n, jsxs as g, Fragment as S } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as v, useState as C, useEffect as b, useMemo as y, useLayoutEffect as V, useCallback as P, useSyncExternalStore as K } from "react";
|
|
3
|
+
import { registerDialogInstallation as M, addAuditCapability as F, resolveTextDirection as U, SearchStatus as L, formatSearchPrice as Q, formatSearchCompareAtPrice as W, DialogSearchError as Z, createSearchController as X } from "@askdialog/dialog-sdk";
|
|
4
|
+
import { createPortal as G } from "react-dom";
|
|
5
5
|
const R = {
|
|
6
6
|
en: {
|
|
7
7
|
placeholder: "Ask the AI a question",
|
|
@@ -19,22 +19,22 @@ const R = {
|
|
|
19
19
|
askSomethingElse: "Pregunta otra cosa"
|
|
20
20
|
}
|
|
21
21
|
}, T = (e) => {
|
|
22
|
-
var
|
|
23
|
-
const t = ((
|
|
22
|
+
var o;
|
|
23
|
+
const t = ((o = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : o.toLowerCase()) ?? "en";
|
|
24
24
|
return R[t] ?? R.en;
|
|
25
|
-
},
|
|
25
|
+
}, Y = ({
|
|
26
26
|
client: e,
|
|
27
27
|
questions: t,
|
|
28
|
-
disabled:
|
|
28
|
+
disabled: o,
|
|
29
29
|
productId: s,
|
|
30
30
|
productTitle: r,
|
|
31
31
|
selectedVariantId: a
|
|
32
|
-
}) => /* @__PURE__ */
|
|
32
|
+
}) => /* @__PURE__ */ n(
|
|
33
33
|
"button",
|
|
34
34
|
{
|
|
35
35
|
type: "button",
|
|
36
36
|
className: "dialog-ask-something-else",
|
|
37
|
-
disabled:
|
|
37
|
+
disabled: o,
|
|
38
38
|
onClick: () => {
|
|
39
39
|
e.openAssistantWithSuggestions({
|
|
40
40
|
questions: t ?? [],
|
|
@@ -47,13 +47,13 @@ const R = {
|
|
|
47
47
|
},
|
|
48
48
|
children: T(e.locale).askSomethingElse
|
|
49
49
|
}
|
|
50
|
-
),
|
|
50
|
+
), J = ({
|
|
51
51
|
title: e = "Your expert",
|
|
52
52
|
description: t = "A question about this product?"
|
|
53
|
-
}) => /* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
] }),
|
|
53
|
+
}) => /* @__PURE__ */ g("div", { className: "dialog-block-header-container", children: [
|
|
54
|
+
/* @__PURE__ */ n("div", { className: "dialog-block-title", children: e }),
|
|
55
|
+
/* @__PURE__ */ n("div", { className: "dialog-block-description", children: t })
|
|
56
|
+
] }), ee = ({ color: e = "#181825" }) => /* @__PURE__ */ g(
|
|
57
57
|
"svg",
|
|
58
58
|
{
|
|
59
59
|
width: "20",
|
|
@@ -62,8 +62,8 @@ const R = {
|
|
|
62
62
|
fill: "none",
|
|
63
63
|
xmlns: "http://www.w3.org/2000/svg",
|
|
64
64
|
children: [
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ g("g", { clipPath: "url(#clip0_466_934)", children: [
|
|
66
|
+
/* @__PURE__ */ n(
|
|
67
67
|
"path",
|
|
68
68
|
{
|
|
69
69
|
d: "M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011 12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684 13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559 15.5689 7.00388 15.7167C6.83375 15.8478 6.68124 16.0003 6.55011 16.1704C6.40232 16.3622 6.2917 16.5834 6.07046 17.0259L5.41675 18.3333L4.76303 17.0259C4.54179 16.5834 4.43117 16.3622 4.28339 16.1704C4.15225 16.0003 3.99974 15.8478 3.82962 15.7167C3.6379 15.5689 3.41666 15.4583 2.97418 15.237L1.66675 14.5833L2.97418 13.9296C3.41666 13.7084 3.6379 13.5977 3.82962 13.45C3.99974 13.3188 4.15225 13.1663 4.28339 12.9962C4.43117 12.8045 4.54179 12.5832 4.76303 12.1408L5.41675 10.8333Z",
|
|
@@ -73,7 +73,7 @@ const R = {
|
|
|
73
73
|
strokeLinejoin: "round"
|
|
74
74
|
}
|
|
75
75
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ n(
|
|
77
77
|
"path",
|
|
78
78
|
{
|
|
79
79
|
d: "M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175 5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687 6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632 8.83469 14.6062 9.01742C14.3785 9.17937 14.1795 9.37836 14.0175 9.60612C13.8348 9.8631 13.7173 10.1686 13.4823 10.7796L12.5001 13.3333L11.5179 10.7796C11.2829 10.1686 11.1654 9.8631 10.9827 9.60612C10.8207 9.37836 10.6217 9.17937 10.3939 9.01742C10.137 8.83469 9.83145 8.71718 9.22043 8.48217L6.66675 7.49999L9.22043 6.5178C9.83145 6.28279 10.137 6.16529 10.3939 5.98256C10.6217 5.82061 10.8207 5.62162 10.9827 5.39386C11.1654 5.13688 11.2829 4.83136 11.5179 4.22034L12.5001 1.66666Z",
|
|
@@ -84,50 +84,50 @@ const R = {
|
|
|
84
84
|
}
|
|
85
85
|
)
|
|
86
86
|
] }),
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ n("defs", { children: /* @__PURE__ */ n("clipPath", { id: "clip0_466_934", children: /* @__PURE__ */ n("rect", { width: "20", height: "20", fill: "white" }) }) })
|
|
88
88
|
]
|
|
89
89
|
}
|
|
90
|
-
),
|
|
90
|
+
), te = ({
|
|
91
91
|
client: e,
|
|
92
92
|
questions: t,
|
|
93
|
-
productId:
|
|
93
|
+
productId: o,
|
|
94
94
|
productTitle: s,
|
|
95
95
|
selectedVariantId: r
|
|
96
96
|
}) => {
|
|
97
|
-
const a = (
|
|
97
|
+
const a = (l) => {
|
|
98
98
|
e.sendProductMessage({
|
|
99
|
-
productId:
|
|
99
|
+
productId: o,
|
|
100
100
|
productTitle: s,
|
|
101
101
|
selectedVariantId: r,
|
|
102
|
-
question:
|
|
102
|
+
question: l,
|
|
103
103
|
fromQuestionSuggestion: !0
|
|
104
104
|
});
|
|
105
105
|
};
|
|
106
|
-
return /* @__PURE__ */
|
|
106
|
+
return /* @__PURE__ */ n(S, { children: t.map((l) => /* @__PURE__ */ g(
|
|
107
107
|
"button",
|
|
108
108
|
{
|
|
109
109
|
className: "dialog-block-suggestions-item",
|
|
110
|
-
onClick: () => a(
|
|
110
|
+
onClick: () => a(l.question),
|
|
111
111
|
children: [
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ n(ee, { color: e.theme.primaryColor }),
|
|
113
|
+
/* @__PURE__ */ n("span", { className: "dialog-block-suggestions-item-label", children: l.question })
|
|
114
114
|
]
|
|
115
115
|
},
|
|
116
|
-
|
|
116
|
+
l.question
|
|
117
117
|
)) });
|
|
118
|
-
},
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
] }),
|
|
118
|
+
}, se = () => /* @__PURE__ */ g(S, { children: [
|
|
119
|
+
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" }),
|
|
120
|
+
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" }),
|
|
121
|
+
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" })
|
|
122
|
+
] }), oe = ({
|
|
123
123
|
client: e,
|
|
124
124
|
questions: t,
|
|
125
|
-
isLoading:
|
|
125
|
+
isLoading: o,
|
|
126
126
|
productId: s,
|
|
127
127
|
productTitle: r,
|
|
128
128
|
selectedVariantId: a
|
|
129
|
-
}) => /* @__PURE__ */
|
|
130
|
-
|
|
129
|
+
}) => /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-container", children: o || !t ? /* @__PURE__ */ n(se, {}) : /* @__PURE__ */ n(
|
|
130
|
+
te,
|
|
131
131
|
{
|
|
132
132
|
client: e,
|
|
133
133
|
questions: t,
|
|
@@ -135,7 +135,7 @@ const R = {
|
|
|
135
135
|
productTitle: r,
|
|
136
136
|
selectedVariantId: a
|
|
137
137
|
}
|
|
138
|
-
) }),
|
|
138
|
+
) }), ne = ({ color: e = "#ffffff" }) => /* @__PURE__ */ n(
|
|
139
139
|
"svg",
|
|
140
140
|
{
|
|
141
141
|
width: "20",
|
|
@@ -143,7 +143,7 @@ const R = {
|
|
|
143
143
|
viewBox: "0 0 20 20",
|
|
144
144
|
fill: "none",
|
|
145
145
|
xmlns: "http://www.w3.org/2000/svg",
|
|
146
|
-
children: /* @__PURE__ */
|
|
146
|
+
children: /* @__PURE__ */ n(
|
|
147
147
|
"path",
|
|
148
148
|
{
|
|
149
149
|
d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
|
|
@@ -154,71 +154,71 @@ const R = {
|
|
|
154
154
|
}
|
|
155
155
|
)
|
|
156
156
|
}
|
|
157
|
-
),
|
|
157
|
+
), re = ({
|
|
158
158
|
client: e,
|
|
159
159
|
productId: t,
|
|
160
|
-
productTitle:
|
|
160
|
+
productTitle: o,
|
|
161
161
|
selectedVariantId: s
|
|
162
162
|
}) => {
|
|
163
|
-
const r =
|
|
163
|
+
const r = v(null), [a, l] = C(""), i = T(e.locale), c = () => {
|
|
164
164
|
var d;
|
|
165
165
|
(d = r.current) == null || d.focus();
|
|
166
|
-
},
|
|
166
|
+
}, h = () => {
|
|
167
167
|
const d = a;
|
|
168
168
|
d.trim() && (e.sendProductMessage({
|
|
169
169
|
productId: t,
|
|
170
|
-
productTitle:
|
|
170
|
+
productTitle: o,
|
|
171
171
|
selectedVariantId: s,
|
|
172
172
|
question: d,
|
|
173
173
|
fromQuestionSuggestion: !0
|
|
174
|
-
}),
|
|
174
|
+
}), l(""));
|
|
175
175
|
}, p = (d) => {
|
|
176
|
-
d.key === "Enter" &&
|
|
176
|
+
d.key === "Enter" && h();
|
|
177
177
|
};
|
|
178
|
-
return /* @__PURE__ */
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */
|
|
178
|
+
return /* @__PURE__ */ g("div", { className: "dialog-input-container", children: [
|
|
179
|
+
/* @__PURE__ */ g("div", { className: "dialog-input-wrapper", onClick: c, children: [
|
|
180
|
+
/* @__PURE__ */ n(
|
|
181
181
|
"input",
|
|
182
182
|
{
|
|
183
183
|
id: "dialog-ask-anything-input-ai-input",
|
|
184
184
|
ref: r,
|
|
185
185
|
value: a,
|
|
186
|
-
onChange: (d) =>
|
|
186
|
+
onChange: (d) => l(d.target.value),
|
|
187
187
|
className: "dialog-ask-anything-input-ai-input",
|
|
188
188
|
placeholder: i.placeholder,
|
|
189
189
|
"aria-describedby": "dialog-input-ai-disclosure",
|
|
190
190
|
onKeyDown: p
|
|
191
191
|
}
|
|
192
192
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ n(
|
|
194
194
|
"button",
|
|
195
195
|
{
|
|
196
196
|
id: "send-message-button-ai-input",
|
|
197
197
|
className: "dialog-input-submit",
|
|
198
198
|
disabled: !a.trim(),
|
|
199
|
-
onClick:
|
|
200
|
-
children: /* @__PURE__ */
|
|
199
|
+
onClick: h,
|
|
200
|
+
children: /* @__PURE__ */ n(ne, { color: e.theme.ctaTextColor })
|
|
201
201
|
}
|
|
202
202
|
)
|
|
203
203
|
] }),
|
|
204
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ n("p", { id: "dialog-input-ai-disclosure", className: "dialog-input-ai-disclosure", children: i.aiDisclosure })
|
|
205
205
|
] });
|
|
206
|
-
},
|
|
206
|
+
}, $ = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), ie = (e) => {
|
|
207
207
|
if (!e) return;
|
|
208
208
|
const t = document.body;
|
|
209
|
-
Object.keys(e).forEach((
|
|
210
|
-
const s =
|
|
209
|
+
Object.keys(e).forEach((o) => {
|
|
210
|
+
const s = o, r = $(o);
|
|
211
211
|
if (e[s] !== void 0) {
|
|
212
212
|
if (typeof e[s] == "object") {
|
|
213
213
|
Object.keys(e[s]).forEach(
|
|
214
214
|
(a) => {
|
|
215
215
|
var i;
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
218
|
-
const
|
|
216
|
+
const l = a;
|
|
217
|
+
if (l !== void 0) {
|
|
218
|
+
const c = $(a), h = e[s];
|
|
219
219
|
t.style.setProperty(
|
|
220
|
-
`--dialog-theme-${r}-${
|
|
221
|
-
(i =
|
|
220
|
+
`--dialog-theme-${r}-${c}`,
|
|
221
|
+
(i = h[l]) == null ? void 0 : i.toString()
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -236,101 +236,101 @@ const R = {
|
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
|
-
},
|
|
240
|
-
e &&
|
|
241
|
-
}, [e]), /* @__PURE__ */
|
|
239
|
+
}, ae = ({ theme: e, children: t }) => (b(() => {
|
|
240
|
+
e && ie(e);
|
|
241
|
+
}, [e]), /* @__PURE__ */ n(S, { children: t })), ce = 2, le = 5, Xe = ({
|
|
242
242
|
client: e,
|
|
243
243
|
productId: t,
|
|
244
|
-
productTitle:
|
|
244
|
+
productTitle: o,
|
|
245
245
|
selectedVariantId: s,
|
|
246
246
|
enableInput: r = !1
|
|
247
247
|
}) => {
|
|
248
|
-
var
|
|
249
|
-
const [a,
|
|
248
|
+
var u;
|
|
249
|
+
const [a, l] = C(!0), [i, c] = C(
|
|
250
250
|
void 0
|
|
251
251
|
);
|
|
252
|
-
|
|
252
|
+
b(() => {
|
|
253
253
|
M({
|
|
254
254
|
method: "react",
|
|
255
|
-
version: "2.
|
|
255
|
+
version: "2.10.0"
|
|
256
256
|
}), F("pdp-block");
|
|
257
257
|
}, []);
|
|
258
|
-
const
|
|
258
|
+
const h = y(
|
|
259
259
|
() => a ? "" : i == null ? void 0 : i.assistantName,
|
|
260
260
|
[i, a]
|
|
261
|
-
), p =
|
|
261
|
+
), p = y(
|
|
262
262
|
() => a ? "" : i == null ? void 0 : i.description,
|
|
263
263
|
[i, a]
|
|
264
|
-
), d =
|
|
264
|
+
), d = y(
|
|
265
265
|
() => a ? "" : i == null ? void 0 : i.inputPlaceholder,
|
|
266
266
|
[i, a]
|
|
267
|
-
), m =
|
|
267
|
+
), m = y(
|
|
268
268
|
() => {
|
|
269
|
-
var
|
|
270
|
-
return U((
|
|
269
|
+
var f;
|
|
270
|
+
return U((f = e.getLocalizationInformations()) == null ? void 0 : f.languageCode);
|
|
271
271
|
},
|
|
272
272
|
[e]
|
|
273
273
|
);
|
|
274
|
-
return
|
|
275
|
-
let
|
|
274
|
+
return b(() => {
|
|
275
|
+
let f = !0;
|
|
276
276
|
return (async () => {
|
|
277
|
-
|
|
277
|
+
l(!0), c(void 0);
|
|
278
278
|
try {
|
|
279
279
|
const E = await e.getSuggestions(t, {
|
|
280
|
-
limit:
|
|
280
|
+
limit: le
|
|
281
281
|
});
|
|
282
|
-
|
|
282
|
+
f && c(E);
|
|
283
283
|
} catch (E) {
|
|
284
284
|
console.error("error", E);
|
|
285
285
|
} finally {
|
|
286
|
-
|
|
286
|
+
f && l(!1);
|
|
287
287
|
}
|
|
288
288
|
})(), () => {
|
|
289
|
-
|
|
289
|
+
f = !1;
|
|
290
290
|
};
|
|
291
|
-
}, [e, t]), /* @__PURE__ */
|
|
291
|
+
}, [e, t]), /* @__PURE__ */ n(ae, { theme: e.theme, children: /* @__PURE__ */ g(
|
|
292
292
|
"div",
|
|
293
293
|
{
|
|
294
294
|
id: "dialog-instant",
|
|
295
295
|
className: "dialog-block-container",
|
|
296
296
|
dir: m,
|
|
297
297
|
children: [
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
|
|
298
|
+
/* @__PURE__ */ n(J, { title: h, description: p }),
|
|
299
|
+
/* @__PURE__ */ n(
|
|
300
|
+
oe,
|
|
301
301
|
{
|
|
302
302
|
client: e,
|
|
303
|
-
questions: (
|
|
303
|
+
questions: (u = i == null ? void 0 : i.questions) == null ? void 0 : u.slice(0, ce),
|
|
304
304
|
isLoading: a,
|
|
305
305
|
productId: t,
|
|
306
|
-
productTitle:
|
|
306
|
+
productTitle: o,
|
|
307
307
|
selectedVariantId: s
|
|
308
308
|
}
|
|
309
309
|
),
|
|
310
|
-
r ? /* @__PURE__ */
|
|
311
|
-
|
|
310
|
+
r ? /* @__PURE__ */ n(
|
|
311
|
+
re,
|
|
312
312
|
{
|
|
313
313
|
client: e,
|
|
314
314
|
placeholder: d,
|
|
315
315
|
productId: t,
|
|
316
|
-
productTitle:
|
|
316
|
+
productTitle: o,
|
|
317
317
|
selectedVariantId: s
|
|
318
318
|
}
|
|
319
|
-
) : /* @__PURE__ */
|
|
320
|
-
|
|
319
|
+
) : /* @__PURE__ */ n(
|
|
320
|
+
Y,
|
|
321
321
|
{
|
|
322
322
|
client: e,
|
|
323
323
|
questions: i == null ? void 0 : i.questions,
|
|
324
324
|
disabled: a,
|
|
325
325
|
productId: t,
|
|
326
|
-
productTitle:
|
|
326
|
+
productTitle: o,
|
|
327
327
|
selectedVariantId: s
|
|
328
328
|
}
|
|
329
329
|
)
|
|
330
330
|
]
|
|
331
331
|
}
|
|
332
332
|
) });
|
|
333
|
-
},
|
|
333
|
+
}, de = () => /* @__PURE__ */ n(
|
|
334
334
|
"svg",
|
|
335
335
|
{
|
|
336
336
|
width: 16,
|
|
@@ -339,7 +339,7 @@ const R = {
|
|
|
339
339
|
fill: "none",
|
|
340
340
|
xmlns: "http://www.w3.org/2000/svg",
|
|
341
341
|
"aria-hidden": "true",
|
|
342
|
-
children: /* @__PURE__ */
|
|
342
|
+
children: /* @__PURE__ */ n(
|
|
343
343
|
"path",
|
|
344
344
|
{
|
|
345
345
|
d: "M8 13V3M8 3L3 8M8 3L13 8",
|
|
@@ -350,9 +350,9 @@ const R = {
|
|
|
350
350
|
}
|
|
351
351
|
)
|
|
352
352
|
}
|
|
353
|
-
),
|
|
353
|
+
), ue = "M5.3217 0.588255C5.63241 -0.196084 6.36759 -0.196085 6.6783 0.588254C6.98901 1.37259 7.68193 2.82807 8.42693 3.57307C9.17193 4.31807 10.6274 5.01099 11.4117 5.3217C12.1961 5.63241 12.1961 6.36759 11.4117 6.6783C10.6274 6.98901 9.17193 7.68193 8.42693 8.42693C7.68193 9.17193 6.98901 10.6274 6.6783 11.4117C6.36759 12.1961 5.63241 12.1961 5.3217 11.4117C5.01099 10.6274 4.31807 9.17193 3.57307 8.42693C2.82808 7.68193 1.37259 6.98901 0.588255 6.6783C-0.196084 6.36759 -0.196085 5.63241 0.588254 5.3217C1.37259 5.01099 2.82807 4.31807 3.57307 3.57307C4.31807 2.82808 5.01099 1.37259 5.3217 0.588255Z", he = ({
|
|
354
354
|
color: e = "currentColor"
|
|
355
|
-
}) => /* @__PURE__ */
|
|
355
|
+
}) => /* @__PURE__ */ n(
|
|
356
356
|
"svg",
|
|
357
357
|
{
|
|
358
358
|
width: 16,
|
|
@@ -361,21 +361,21 @@ const R = {
|
|
|
361
361
|
fill: "none",
|
|
362
362
|
xmlns: "http://www.w3.org/2000/svg",
|
|
363
363
|
"aria-hidden": "true",
|
|
364
|
-
children: /* @__PURE__ */
|
|
364
|
+
children: /* @__PURE__ */ n("path", { d: ue, fill: e })
|
|
365
365
|
}
|
|
366
|
-
),
|
|
366
|
+
), Ge = ({
|
|
367
367
|
controller: e,
|
|
368
368
|
placeholder: t = "Search products...",
|
|
369
|
-
autoFocus:
|
|
369
|
+
autoFocus: o = !1,
|
|
370
370
|
submitAriaLabel: s = "Search"
|
|
371
371
|
}) => {
|
|
372
|
-
const [r, a] =
|
|
373
|
-
return /* @__PURE__ */
|
|
372
|
+
const [r, a] = C("");
|
|
373
|
+
return /* @__PURE__ */ g("form", { className: "dialog-search-bar", role: "search", onSubmit: (i) => {
|
|
374
374
|
i.preventDefault(), e.submit(r);
|
|
375
375
|
}, children: [
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
/* @__PURE__ */
|
|
378
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ g("div", { className: "dialog-search-bar-field", children: [
|
|
377
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-bar-icon", children: /* @__PURE__ */ n(he, {}) }),
|
|
378
|
+
/* @__PURE__ */ n(
|
|
379
379
|
"input",
|
|
380
380
|
{
|
|
381
381
|
type: "text",
|
|
@@ -384,30 +384,30 @@ const R = {
|
|
|
384
384
|
value: r,
|
|
385
385
|
"aria-label": t,
|
|
386
386
|
placeholder: t,
|
|
387
|
-
autoFocus:
|
|
387
|
+
autoFocus: o,
|
|
388
388
|
onChange: (i) => {
|
|
389
389
|
a(i.target.value), e.setQuery(i.target.value);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
)
|
|
393
393
|
] }),
|
|
394
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ n(
|
|
395
395
|
"button",
|
|
396
396
|
{
|
|
397
397
|
type: "submit",
|
|
398
398
|
className: "dialog-search-bar-submit",
|
|
399
399
|
"aria-label": s,
|
|
400
|
-
children: /* @__PURE__ */
|
|
400
|
+
children: /* @__PURE__ */ n(de, {})
|
|
401
401
|
}
|
|
402
402
|
)
|
|
403
403
|
] });
|
|
404
|
-
},
|
|
404
|
+
}, ge = (e, t) => {
|
|
405
405
|
try {
|
|
406
406
|
return new Intl.NumberFormat(t).format(e);
|
|
407
407
|
} catch {
|
|
408
408
|
return String(e);
|
|
409
409
|
}
|
|
410
|
-
},
|
|
410
|
+
}, I = {
|
|
411
411
|
en: (e) => ({
|
|
412
412
|
searching: (t) => `Searching “${t}”…`,
|
|
413
413
|
noResults: "No matching products",
|
|
@@ -419,7 +419,7 @@ const R = {
|
|
|
419
419
|
seeAllLabel: (t) => t === 1 ? "See the result" : `See all ${e(t)} results`,
|
|
420
420
|
previous: "Previous",
|
|
421
421
|
next: "Next",
|
|
422
|
-
pageOf: (t,
|
|
422
|
+
pageOf: (t, o) => `Page ${e(t)} / ${e(o)}`
|
|
423
423
|
}),
|
|
424
424
|
fr: (e) => ({
|
|
425
425
|
searching: (t) => `Recherche de « ${t} »…`,
|
|
@@ -432,7 +432,7 @@ const R = {
|
|
|
432
432
|
seeAllLabel: (t) => t === 1 ? "Voir le résultat" : `Voir les ${e(t)} résultats`,
|
|
433
433
|
previous: "Précédent",
|
|
434
434
|
next: "Suivant",
|
|
435
|
-
pageOf: (t,
|
|
435
|
+
pageOf: (t, o) => `Page ${e(t)} / ${e(o)}`
|
|
436
436
|
}),
|
|
437
437
|
de: (e) => ({
|
|
438
438
|
searching: (t) => `Suche nach „${t}“…`,
|
|
@@ -445,7 +445,7 @@ const R = {
|
|
|
445
445
|
seeAllLabel: (t) => t === 1 ? "Das Ergebnis anzeigen" : `Alle ${e(t)} Ergebnisse anzeigen`,
|
|
446
446
|
previous: "Zurück",
|
|
447
447
|
next: "Weiter",
|
|
448
|
-
pageOf: (t,
|
|
448
|
+
pageOf: (t, o) => `Seite ${e(t)} / ${e(o)}`
|
|
449
449
|
}),
|
|
450
450
|
es: (e) => ({
|
|
451
451
|
searching: (t) => `Buscando «${t}»…`,
|
|
@@ -458,7 +458,7 @@ const R = {
|
|
|
458
458
|
seeAllLabel: (t) => t === 1 ? "Ver el resultado" : `Ver los ${e(t)} resultados`,
|
|
459
459
|
previous: "Anterior",
|
|
460
460
|
next: "Siguiente",
|
|
461
|
-
pageOf: (t,
|
|
461
|
+
pageOf: (t, o) => `Página ${e(t)} / ${e(o)}`
|
|
462
462
|
}),
|
|
463
463
|
it: (e) => ({
|
|
464
464
|
searching: (t) => `Ricerca di “${t}”…`,
|
|
@@ -471,23 +471,23 @@ const R = {
|
|
|
471
471
|
seeAllLabel: (t) => t === 1 ? "Vedi il risultato" : `Vedi tutti i ${e(t)} risultati`,
|
|
472
472
|
previous: "Precedente",
|
|
473
473
|
next: "Successivo",
|
|
474
|
-
pageOf: (t,
|
|
474
|
+
pageOf: (t, o) => `Pagina ${e(t)} / ${e(o)}`
|
|
475
475
|
})
|
|
476
|
-
},
|
|
476
|
+
}, _ = (e) => {
|
|
477
477
|
var s;
|
|
478
478
|
const t = ((s = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : s.toLowerCase()) ?? "en";
|
|
479
|
-
return (
|
|
480
|
-
},
|
|
479
|
+
return (I[t] ?? I.en)((r) => ge(r, e));
|
|
480
|
+
}, O = (e) => e.status !== L.LOADING && e.response !== void 0 && e.response.nbPages > 1, pe = ({
|
|
481
481
|
controller: e,
|
|
482
482
|
state: t,
|
|
483
|
-
locale:
|
|
483
|
+
locale: o
|
|
484
484
|
}) => {
|
|
485
485
|
const s = t.response;
|
|
486
|
-
if (s === void 0 || !
|
|
486
|
+
if (s === void 0 || !O(t))
|
|
487
487
|
return null;
|
|
488
|
-
const r =
|
|
489
|
-
return /* @__PURE__ */
|
|
490
|
-
/* @__PURE__ */
|
|
488
|
+
const r = _(o);
|
|
489
|
+
return /* @__PURE__ */ g("nav", { "aria-label": "Search results pages", className: "dialog-search-pagination", children: [
|
|
490
|
+
/* @__PURE__ */ n(
|
|
491
491
|
"button",
|
|
492
492
|
{
|
|
493
493
|
type: "button",
|
|
@@ -496,8 +496,8 @@ const R = {
|
|
|
496
496
|
children: r.previous
|
|
497
497
|
}
|
|
498
498
|
),
|
|
499
|
-
/* @__PURE__ */
|
|
500
|
-
/* @__PURE__ */
|
|
499
|
+
/* @__PURE__ */ n("span", { children: r.pageOf(s.page + 1, s.nbPages) }),
|
|
500
|
+
/* @__PURE__ */ n(
|
|
501
501
|
"button",
|
|
502
502
|
{
|
|
503
503
|
type: "button",
|
|
@@ -507,87 +507,80 @@ const R = {
|
|
|
507
507
|
}
|
|
508
508
|
)
|
|
509
509
|
] });
|
|
510
|
-
}, D = (e) => e.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/ẞ/gu, "ß").toUpperCase().toLowerCase().replace(/ς/g, "σ"),
|
|
511
|
-
const
|
|
510
|
+
}, D = (e) => e.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/ẞ/gu, "ß").toUpperCase().toLowerCase().replace(/ς/g, "σ"), me = (e, t) => {
|
|
511
|
+
const o = { before: "", match: e, after: "" }, s = D(t.trim());
|
|
512
512
|
if (s === "")
|
|
513
|
-
return
|
|
513
|
+
return o;
|
|
514
514
|
const r = [...e], a = [];
|
|
515
|
-
let
|
|
515
|
+
let l = "";
|
|
516
516
|
r.forEach((p, d) => {
|
|
517
517
|
const m = D(p);
|
|
518
|
-
for (let
|
|
518
|
+
for (let u = 0; u < m.length; u += 1)
|
|
519
519
|
a.push(d);
|
|
520
|
-
|
|
520
|
+
l += m;
|
|
521
521
|
});
|
|
522
|
-
const i =
|
|
522
|
+
const i = l.indexOf(s);
|
|
523
523
|
if (i === -1)
|
|
524
|
-
return
|
|
525
|
-
const
|
|
524
|
+
return o;
|
|
525
|
+
const c = a[i], h = a[i + s.length - 1] + 1;
|
|
526
526
|
return {
|
|
527
|
-
before: r.slice(0,
|
|
528
|
-
match: r.slice(
|
|
529
|
-
after: r.slice(
|
|
527
|
+
before: r.slice(0, c).join(""),
|
|
528
|
+
match: r.slice(c, h).join(""),
|
|
529
|
+
after: r.slice(h).join("")
|
|
530
530
|
};
|
|
531
531
|
}, H = ({
|
|
532
532
|
title: e,
|
|
533
533
|
query: t
|
|
534
534
|
}) => {
|
|
535
|
-
const { before:
|
|
536
|
-
return /* @__PURE__ */
|
|
537
|
-
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
r !== "" && /* @__PURE__ */
|
|
535
|
+
const { before: o, match: s, after: r } = me(e, t);
|
|
536
|
+
return /* @__PURE__ */ g(S, { children: [
|
|
537
|
+
o !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: o }),
|
|
538
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-match", children: s }),
|
|
539
|
+
r !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: r })
|
|
540
540
|
] });
|
|
541
|
-
},
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
return "";
|
|
551
|
-
}
|
|
552
|
-
}, fe = (e) => {
|
|
553
|
-
try {
|
|
554
|
-
const { protocol: t } = new URL(e, window.location.href);
|
|
555
|
-
return t === "http:" || t === "https:" ? e : void 0;
|
|
556
|
-
} catch {
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
}, q = (e) => e.url === void 0 || e.url === "" ? void 0 : fe(e.url), B = (e) => e.title ?? e.handle ?? e.objectID, be = ({
|
|
541
|
+
}, fe = (e) => e.product_image || e.image || void 0, q = (e) => {
|
|
542
|
+
if (!(e === void 0 || e === ""))
|
|
543
|
+
try {
|
|
544
|
+
const { protocol: t } = new URL(e, window.location.href);
|
|
545
|
+
return t === "http:" || t === "https:" ? e : void 0;
|
|
546
|
+
} catch {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
}, be = (e) => q(e.url), B = (e) => e.title ?? e.handle ?? e.objectID, ve = ({
|
|
560
550
|
controller: e,
|
|
561
551
|
hit: t,
|
|
562
|
-
index:
|
|
552
|
+
index: o,
|
|
563
553
|
locale: s,
|
|
564
554
|
query: r = ""
|
|
565
555
|
}) => {
|
|
566
|
-
const a =
|
|
567
|
-
|
|
568
|
-
a.current !== null && e.observeResult(a.current,
|
|
569
|
-
}, [e, t,
|
|
570
|
-
const
|
|
571
|
-
const
|
|
572
|
-
e.selectResult(
|
|
573
|
-
}, i = (
|
|
574
|
-
|
|
575
|
-
},
|
|
576
|
-
/* @__PURE__ */
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
|
|
556
|
+
const a = v(null);
|
|
557
|
+
b(() => {
|
|
558
|
+
a.current !== null && e.observeResult(a.current, o);
|
|
559
|
+
}, [e, t, o]);
|
|
560
|
+
const l = (u) => {
|
|
561
|
+
const f = u.metaKey || u.ctrlKey || u.shiftKey || u.altKey;
|
|
562
|
+
e.selectResult(o, { navigate: !f }) && u.preventDefault();
|
|
563
|
+
}, i = (u) => {
|
|
564
|
+
u.button === 1 && e.selectResult(o, { navigate: !1 });
|
|
565
|
+
}, c = Q(t, s), h = W(t, s), p = q(e.productUrl(t)), d = fe(t), m = /* @__PURE__ */ g(S, { children: [
|
|
566
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-product-thumb", "aria-hidden": !0, children: d !== void 0 && /* @__PURE__ */ n("img", { src: d, alt: "", loading: "lazy" }) }),
|
|
567
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-product-title", children: /* @__PURE__ */ n(H, { title: B(t), query: r }) }),
|
|
568
|
+
c !== "" && /* @__PURE__ */ g("span", { className: "dialog-search-product-price", children: [
|
|
569
|
+
h !== "" && /* @__PURE__ */ n("s", { className: "dialog-search-product-compare-at", children: h }),
|
|
570
|
+
c
|
|
571
|
+
] })
|
|
579
572
|
] });
|
|
580
|
-
return /* @__PURE__ */
|
|
573
|
+
return /* @__PURE__ */ n("li", { ref: a, className: "dialog-search-card", children: p === void 0 ? /* @__PURE__ */ n("div", { className: "dialog-search-product", children: m }) : /* @__PURE__ */ n(
|
|
581
574
|
"a",
|
|
582
575
|
{
|
|
583
576
|
className: "dialog-search-product",
|
|
584
|
-
href:
|
|
585
|
-
onClick:
|
|
577
|
+
href: p,
|
|
578
|
+
onClick: l,
|
|
586
579
|
onAuxClick: i,
|
|
587
|
-
children:
|
|
580
|
+
children: m
|
|
588
581
|
}
|
|
589
582
|
) });
|
|
590
|
-
},
|
|
583
|
+
}, Ce = () => /* @__PURE__ */ n(
|
|
591
584
|
"svg",
|
|
592
585
|
{
|
|
593
586
|
width: 16,
|
|
@@ -596,9 +589,9 @@ const R = {
|
|
|
596
589
|
fill: "currentColor",
|
|
597
590
|
xmlns: "http://www.w3.org/2000/svg",
|
|
598
591
|
"aria-hidden": "true",
|
|
599
|
-
children: /* @__PURE__ */
|
|
592
|
+
children: /* @__PURE__ */ n("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" })
|
|
600
593
|
}
|
|
601
|
-
),
|
|
594
|
+
), Se = () => /* @__PURE__ */ n(
|
|
602
595
|
"svg",
|
|
603
596
|
{
|
|
604
597
|
width: 12,
|
|
@@ -607,100 +600,100 @@ const R = {
|
|
|
607
600
|
fill: "currentColor",
|
|
608
601
|
xmlns: "http://www.w3.org/2000/svg",
|
|
609
602
|
"aria-hidden": "true",
|
|
610
|
-
children: /* @__PURE__ */
|
|
603
|
+
children: /* @__PURE__ */ n("path", { d: "M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z" })
|
|
611
604
|
}
|
|
612
605
|
), j = (e) => (e ?? []).flatMap((t) => {
|
|
613
|
-
const
|
|
614
|
-
return
|
|
606
|
+
const o = be(t);
|
|
607
|
+
return o === void 0 ? [] : [{ collection: t, href: o }];
|
|
615
608
|
}), ye = ({
|
|
616
609
|
collections: e,
|
|
617
610
|
query: t,
|
|
618
|
-
messages:
|
|
611
|
+
messages: o
|
|
619
612
|
}) => {
|
|
620
613
|
const s = j(e);
|
|
621
|
-
return s.length === 0 ? null : /* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
614
|
+
return s.length === 0 ? null : /* @__PURE__ */ g("aside", { className: "dialog-search-collections", children: [
|
|
615
|
+
/* @__PURE__ */ g("div", { className: "dialog-search-section-head", children: [
|
|
616
|
+
/* @__PURE__ */ n("p", { className: "dialog-search-label", children: o.collectionsLabel }),
|
|
617
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-count", children: o.collectionsCount(s.length) })
|
|
625
618
|
] }),
|
|
626
|
-
/* @__PURE__ */
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
/* @__PURE__ */
|
|
629
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ n("ul", { className: "dialog-search-collection-list", children: s.map(({ collection: r, href: a }) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ g("a", { className: "dialog-search-collection", href: a, children: [
|
|
620
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-collection-thumb", "aria-hidden": !0, children: r.image ? /* @__PURE__ */ n("img", { src: r.image, alt: "", loading: "lazy" }) : null }),
|
|
621
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-collection-title", children: /* @__PURE__ */ n(H, { title: B(r), query: t }) }),
|
|
622
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-caret", children: /* @__PURE__ */ n(Se, {}) })
|
|
630
623
|
] }) }, r.objectID)) })
|
|
631
624
|
] });
|
|
632
|
-
},
|
|
625
|
+
}, we = ({
|
|
633
626
|
controller: e,
|
|
634
627
|
response: t,
|
|
635
|
-
locale:
|
|
628
|
+
locale: o,
|
|
636
629
|
messages: s
|
|
637
|
-
}) => /* @__PURE__ */
|
|
638
|
-
/* @__PURE__ */
|
|
630
|
+
}) => /* @__PURE__ */ g("section", { className: "dialog-search-products", children: [
|
|
631
|
+
/* @__PURE__ */ n("div", { className: "dialog-search-section-head", children: /* @__PURE__ */ g("p", { className: "dialog-search-label", children: [
|
|
639
632
|
s.productsLabel,
|
|
640
|
-
t.nbHits > 0 && /* @__PURE__ */
|
|
633
|
+
t.nbHits > 0 && /* @__PURE__ */ n("span", { className: "dialog-search-label-count", children: ` · ${s.resultsCount(t.nbHits)}` })
|
|
641
634
|
] }) }),
|
|
642
|
-
/* @__PURE__ */
|
|
643
|
-
|
|
635
|
+
/* @__PURE__ */ n("ul", { className: "dialog-search-results", children: t.hits.length === 0 ? /* @__PURE__ */ n("li", { className: "dialog-search-empty", role: "status", children: s.noResults }) : t.hits.map((r, a) => /* @__PURE__ */ n(
|
|
636
|
+
ve,
|
|
644
637
|
{
|
|
645
638
|
controller: e,
|
|
646
639
|
hit: r,
|
|
647
640
|
index: a,
|
|
648
|
-
locale:
|
|
641
|
+
locale: o,
|
|
649
642
|
query: t.query
|
|
650
643
|
},
|
|
651
644
|
r.objectID
|
|
652
645
|
)) })
|
|
653
|
-
] }), k = 8, w = 16,
|
|
654
|
-
const
|
|
655
|
-
|
|
646
|
+
] }), k = 8, w = 16, Le = 200, ke = 1440, Ne = (e, t) => e.bottom > 0 && e.top < t, Ee = (e, t) => {
|
|
647
|
+
const o = Math.min(
|
|
648
|
+
ke,
|
|
656
649
|
t - 2 * w
|
|
657
|
-
), s = e.left + e.width / 2 -
|
|
650
|
+
), s = e.left + e.width / 2 - o / 2;
|
|
658
651
|
return { left: Math.min(
|
|
659
652
|
Math.max(s, w),
|
|
660
|
-
t - w -
|
|
661
|
-
), width:
|
|
662
|
-
},
|
|
663
|
-
const s =
|
|
664
|
-
return s <
|
|
653
|
+
t - w - o
|
|
654
|
+
), width: o };
|
|
655
|
+
}, Pe = (e, t, o) => {
|
|
656
|
+
const s = o - e.bottom - k - w, r = e.top - k - w, a = Ee(e, t);
|
|
657
|
+
return s < Le && r > s ? {
|
|
665
658
|
...a,
|
|
666
|
-
bottom:
|
|
659
|
+
bottom: o - e.top + k,
|
|
667
660
|
maxHeight: Math.max(r, 0)
|
|
668
661
|
} : {
|
|
669
662
|
...a,
|
|
670
663
|
top: e.bottom + k,
|
|
671
664
|
maxHeight: Math.max(s, 0)
|
|
672
665
|
};
|
|
673
|
-
},
|
|
666
|
+
}, Ae = (e) => {
|
|
674
667
|
const t = e.trim().replace(/^#/, "");
|
|
675
668
|
if (!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t))
|
|
676
669
|
return;
|
|
677
|
-
const
|
|
670
|
+
const o = t.length <= 4 ? [...t].map((s) => s + s).join("") : t;
|
|
678
671
|
return [0, 2, 4].map(
|
|
679
|
-
(s) => Number.parseInt(
|
|
672
|
+
(s) => Number.parseInt(o.slice(s, s + 2), 16)
|
|
680
673
|
);
|
|
681
|
-
},
|
|
674
|
+
}, xe = (e) => {
|
|
682
675
|
const t = /^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(e);
|
|
683
676
|
if (t !== null)
|
|
684
677
|
return [t[1], t[2], t[3]].map(Number);
|
|
685
|
-
},
|
|
678
|
+
}, Re = (e) => {
|
|
686
679
|
if (typeof document > "u")
|
|
687
680
|
return;
|
|
688
681
|
const t = document.createElement("span");
|
|
689
682
|
if (t.style.color = e, t.style.color === "")
|
|
690
683
|
return;
|
|
691
684
|
document.body.appendChild(t);
|
|
692
|
-
const
|
|
693
|
-
return t.remove(),
|
|
694
|
-
},
|
|
685
|
+
const o = xe(getComputedStyle(t).color);
|
|
686
|
+
return t.remove(), o;
|
|
687
|
+
}, $e = (e) => Ae(e) ?? Re(e), Ie = (e) => {
|
|
695
688
|
const t = e / 255;
|
|
696
689
|
return t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
|
|
697
690
|
}, z = (e) => {
|
|
698
|
-
const t =
|
|
691
|
+
const t = $e(e);
|
|
699
692
|
if (t === void 0)
|
|
700
693
|
return;
|
|
701
|
-
const [
|
|
702
|
-
return 0.2126 *
|
|
703
|
-
},
|
|
694
|
+
const [o, s, r] = t.map(Ie);
|
|
695
|
+
return 0.2126 * o + 0.7152 * s + 0.0722 * r;
|
|
696
|
+
}, De = "#181825", Me = "#ffffff", Te = "straight", A = 0.5, x = {
|
|
704
697
|
light: {
|
|
705
698
|
panel: "#ffffff",
|
|
706
699
|
side: "#fafbfc",
|
|
@@ -719,7 +712,7 @@ const R = {
|
|
|
719
712
|
hover: "#242830",
|
|
720
713
|
thumb: "#2b2f38"
|
|
721
714
|
}
|
|
722
|
-
},
|
|
715
|
+
}, _e = {
|
|
723
716
|
rectangle: {
|
|
724
717
|
"r-panel": "4px",
|
|
725
718
|
"r-item": "4px",
|
|
@@ -735,109 +728,109 @@ const R = {
|
|
|
735
728
|
}, N = (e) => e === void 0 || e.trim() === "" ? void 0 : e.trim(), Oe = (e) => {
|
|
736
729
|
const t = e === void 0 ? void 0 : z(e);
|
|
737
730
|
return t === void 0 ? "light" : t < A ? "dark" : "light";
|
|
738
|
-
},
|
|
739
|
-
const
|
|
740
|
-
return
|
|
741
|
-
},
|
|
742
|
-
const t = Oe(N(e == null ? void 0 : e.backgroundColor)),
|
|
731
|
+
}, He = (e, t) => {
|
|
732
|
+
const o = z(e);
|
|
733
|
+
return o === void 0 ? x[t].text : (t === "light" ? o < A : o >= A) ? e : x[t].text;
|
|
734
|
+
}, qe = (e) => {
|
|
735
|
+
const t = Oe(N(e == null ? void 0 : e.backgroundColor)), o = (e == null ? void 0 : e.ctaBorderType) === Te ? "rectangle" : "rectangle-rounded", s = N(e == null ? void 0 : e.primaryColor) ?? De, r = N(e == null ? void 0 : e.fontFamily), a = {
|
|
743
736
|
...x[t],
|
|
744
|
-
...
|
|
737
|
+
..._e[o],
|
|
745
738
|
primary: s,
|
|
746
|
-
accent:
|
|
747
|
-
"cta-text": N(e == null ? void 0 : e.ctaTextColor) ??
|
|
739
|
+
accent: He(s, t),
|
|
740
|
+
"cta-text": N(e == null ? void 0 : e.ctaTextColor) ?? Me,
|
|
748
741
|
...r === void 0 ? {} : { font: r }
|
|
749
742
|
};
|
|
750
743
|
return Object.fromEntries(
|
|
751
|
-
Object.entries(a).map(([
|
|
744
|
+
Object.entries(a).map(([l, i]) => [`--dso-${l}`, i])
|
|
752
745
|
);
|
|
753
|
-
},
|
|
754
|
-
const t =
|
|
746
|
+
}, Be = (e) => {
|
|
747
|
+
const t = v(null), [o, s] = C(void 0), [r, a] = C({ width: 0, height: 0 });
|
|
755
748
|
return V(() => {
|
|
756
749
|
if (!e)
|
|
757
750
|
return;
|
|
758
|
-
const
|
|
751
|
+
const l = () => {
|
|
759
752
|
const i = t.current;
|
|
760
753
|
if (i === null)
|
|
761
754
|
return;
|
|
762
|
-
const
|
|
755
|
+
const c = i.previousElementSibling ?? i, { top: h, bottom: p, left: d, width: m } = c.getBoundingClientRect();
|
|
763
756
|
a(
|
|
764
|
-
(
|
|
757
|
+
(u) => u.width === window.innerWidth && u.height === window.innerHeight ? u : { width: window.innerWidth, height: window.innerHeight }
|
|
765
758
|
), s(
|
|
766
|
-
(
|
|
759
|
+
(u) => u !== void 0 && u.top === h && u.bottom === p && u.left === d && u.width === m ? u : { top: h, bottom: p, left: d, width: m }
|
|
767
760
|
);
|
|
768
761
|
};
|
|
769
|
-
return
|
|
770
|
-
window.removeEventListener("scroll",
|
|
762
|
+
return l(), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), () => {
|
|
763
|
+
window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l);
|
|
771
764
|
};
|
|
772
|
-
}, [e]), { anchorRef: t, rect:
|
|
773
|
-
},
|
|
774
|
-
const [
|
|
775
|
-
return
|
|
765
|
+
}, [e]), { anchorRef: t, rect: o, viewport: r };
|
|
766
|
+
}, je = (e, t) => {
|
|
767
|
+
const [o, s] = C(!1), r = v(null), a = e.status !== L.IDLE && !o;
|
|
768
|
+
return b(() => {
|
|
776
769
|
s(!1);
|
|
777
|
-
}, [e.query]),
|
|
770
|
+
}, [e.query]), b(() => {
|
|
778
771
|
if (!a)
|
|
779
772
|
return;
|
|
780
|
-
const
|
|
781
|
-
var m,
|
|
782
|
-
const
|
|
783
|
-
if (!(
|
|
773
|
+
const l = (i) => {
|
|
774
|
+
var m, u;
|
|
775
|
+
const c = i.target;
|
|
776
|
+
if (!(c instanceof Node))
|
|
784
777
|
return;
|
|
785
|
-
const
|
|
778
|
+
const h = (m = t.current) == null ? void 0 : m.previousElementSibling, p = ((u = r.current) == null ? void 0 : u.contains(c)) ?? !1, d = (h == null ? void 0 : h.contains(c)) ?? !1;
|
|
786
779
|
!p && !d && s(!0);
|
|
787
780
|
};
|
|
788
|
-
return document.addEventListener("pointerdown",
|
|
789
|
-
}, [a, t]),
|
|
790
|
-
var
|
|
791
|
-
const
|
|
792
|
-
if (
|
|
781
|
+
return document.addEventListener("pointerdown", l), () => document.removeEventListener("pointerdown", l);
|
|
782
|
+
}, [a, t]), b(() => {
|
|
783
|
+
var c;
|
|
784
|
+
const l = (c = t.current) == null ? void 0 : c.previousElementSibling;
|
|
785
|
+
if (l == null)
|
|
793
786
|
return;
|
|
794
787
|
const i = () => s(!1);
|
|
795
|
-
return
|
|
788
|
+
return l.addEventListener("focusin", i), () => l.removeEventListener("focusin", i);
|
|
796
789
|
}, [t]), { isOpen: a, panelRef: r };
|
|
797
|
-
},
|
|
798
|
-
var m,
|
|
799
|
-
const { controller:
|
|
800
|
-
if (
|
|
801
|
-
return /* @__PURE__ */
|
|
802
|
-
/* @__PURE__ */
|
|
790
|
+
}, ze = (e) => e instanceof Z ? `Search failed (${e.status}${e.code ? ` ${e.code}` : ""}): ${e.message}` : "Search failed: network error. Check your connection and try again.", Ve = (e, t) => {
|
|
791
|
+
var m, u;
|
|
792
|
+
const { controller: o, state: s, locale: r, seeAllHref: a } = e, { status: l, response: i } = s;
|
|
793
|
+
if (l === L.ERROR)
|
|
794
|
+
return /* @__PURE__ */ g("div", { className: "dialog-search-error", children: [
|
|
795
|
+
/* @__PURE__ */ n(
|
|
803
796
|
"p",
|
|
804
797
|
{
|
|
805
798
|
role: "alert",
|
|
806
799
|
className: "dialog-search-status dialog-search-status-error",
|
|
807
|
-
children:
|
|
800
|
+
children: ze(s.error)
|
|
808
801
|
}
|
|
809
802
|
),
|
|
810
|
-
/* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ n(
|
|
811
804
|
"button",
|
|
812
805
|
{
|
|
813
806
|
type: "button",
|
|
814
807
|
className: "dialog-search-retry",
|
|
815
|
-
onClick: () =>
|
|
808
|
+
onClick: () => o.retry(),
|
|
816
809
|
children: t.retry
|
|
817
810
|
}
|
|
818
811
|
)
|
|
819
812
|
] });
|
|
820
813
|
if (i === void 0)
|
|
821
|
-
return /* @__PURE__ */
|
|
822
|
-
const
|
|
823
|
-
return /* @__PURE__ */
|
|
824
|
-
/* @__PURE__ */
|
|
814
|
+
return /* @__PURE__ */ n("p", { role: "status", className: "dialog-search-status", children: t.searching(s.query) });
|
|
815
|
+
const c = ((u = (m = s.sections) == null ? void 0 : m.collections) == null ? void 0 : u.hits) ?? [], h = j(c).length > 0, p = a !== void 0 && i.nbHits > 0, d = !p && O(s);
|
|
816
|
+
return /* @__PURE__ */ g(S, { children: [
|
|
817
|
+
/* @__PURE__ */ g(
|
|
825
818
|
"div",
|
|
826
819
|
{
|
|
827
|
-
className: `dialog-search-body${
|
|
820
|
+
className: `dialog-search-body${h ? "" : " dialog-search-body--no-collections"}`,
|
|
828
821
|
children: [
|
|
829
|
-
/* @__PURE__ */
|
|
822
|
+
/* @__PURE__ */ n(
|
|
830
823
|
ye,
|
|
831
824
|
{
|
|
832
|
-
collections:
|
|
825
|
+
collections: c,
|
|
833
826
|
query: i.query,
|
|
834
827
|
messages: t
|
|
835
828
|
}
|
|
836
829
|
),
|
|
837
|
-
/* @__PURE__ */
|
|
838
|
-
|
|
830
|
+
/* @__PURE__ */ n(
|
|
831
|
+
we,
|
|
839
832
|
{
|
|
840
|
-
controller:
|
|
833
|
+
controller: o,
|
|
841
834
|
response: i,
|
|
842
835
|
locale: r,
|
|
843
836
|
messages: t
|
|
@@ -846,106 +839,107 @@ const R = {
|
|
|
846
839
|
]
|
|
847
840
|
}
|
|
848
841
|
),
|
|
849
|
-
(p || d) && /* @__PURE__ */
|
|
842
|
+
(p || d) && /* @__PURE__ */ n("div", { className: "dialog-search-footer", children: p ? /* @__PURE__ */ g("a", { className: "dialog-search-cta", href: a(i.query), children: [
|
|
850
843
|
t.seeAllLabel(i.nbHits),
|
|
851
|
-
/* @__PURE__ */
|
|
852
|
-
] }) : /* @__PURE__ */
|
|
853
|
-
|
|
844
|
+
/* @__PURE__ */ n(Ce, {})
|
|
845
|
+
] }) : /* @__PURE__ */ n(
|
|
846
|
+
pe,
|
|
854
847
|
{
|
|
855
|
-
controller:
|
|
848
|
+
controller: o,
|
|
856
849
|
state: s,
|
|
857
850
|
locale: r
|
|
858
851
|
}
|
|
859
852
|
) })
|
|
860
853
|
] });
|
|
861
|
-
},
|
|
862
|
-
const { state: t, locale:
|
|
863
|
-
() =>
|
|
854
|
+
}, Ye = (e) => {
|
|
855
|
+
const { state: t, locale: o, theme: s, layout: r = "list" } = e, a = t.status !== L.IDLE, { anchorRef: l, rect: i, viewport: c } = Be(a), { isOpen: h, panelRef: p } = je(t, l), d = _(o), m = y(
|
|
856
|
+
() => qe(s),
|
|
864
857
|
[s]
|
|
865
858
|
);
|
|
866
|
-
return /* @__PURE__ */
|
|
867
|
-
/* @__PURE__ */
|
|
868
|
-
|
|
869
|
-
/* @__PURE__ */
|
|
859
|
+
return /* @__PURE__ */ g(S, { children: [
|
|
860
|
+
/* @__PURE__ */ n("div", { ref: l }),
|
|
861
|
+
h && i !== void 0 && Ne(i, c.height) && G(
|
|
862
|
+
/* @__PURE__ */ n(
|
|
870
863
|
"div",
|
|
871
864
|
{
|
|
872
865
|
ref: p,
|
|
873
866
|
className: `dialog-search-panel dialog-search-panel--${r}`,
|
|
874
867
|
style: {
|
|
875
|
-
...
|
|
868
|
+
...Pe(i, c.width, c.height),
|
|
876
869
|
...m
|
|
877
870
|
},
|
|
878
|
-
children:
|
|
871
|
+
children: Ve(e, d)
|
|
879
872
|
}
|
|
880
873
|
),
|
|
881
874
|
document.body
|
|
882
875
|
)
|
|
883
876
|
] });
|
|
884
|
-
},
|
|
877
|
+
}, Ke = {
|
|
885
878
|
status: L.IDLE,
|
|
886
879
|
query: "",
|
|
887
880
|
page: 0
|
|
888
|
-
},
|
|
889
|
-
const t =
|
|
881
|
+
}, Je = (e) => {
|
|
882
|
+
const t = v(e);
|
|
890
883
|
t.current = e;
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
const { client:
|
|
894
|
-
|
|
895
|
-
search: (d, m) =>
|
|
884
|
+
const o = v(void 0), s = P(() => {
|
|
885
|
+
if (o.current === void 0) {
|
|
886
|
+
const { client: c, surface: h = "search_page", ...p } = t.current;
|
|
887
|
+
o.current = X({
|
|
888
|
+
search: (d, m) => c.search(d, m),
|
|
896
889
|
analytics: {
|
|
897
|
-
surface:
|
|
898
|
-
trackViewSearchResults: (d) =>
|
|
899
|
-
trackSelectSearchResult: (d) =>
|
|
890
|
+
surface: h,
|
|
891
|
+
trackViewSearchResults: (d) => c.trackViewSearchResults(d),
|
|
892
|
+
trackSelectSearchResult: (d) => c.trackSelectSearchResult(d)
|
|
900
893
|
},
|
|
901
894
|
...p
|
|
902
895
|
});
|
|
903
896
|
}
|
|
904
|
-
return
|
|
905
|
-
}, []), r =
|
|
897
|
+
return o.current;
|
|
898
|
+
}, []), r = v(void 0);
|
|
906
899
|
r.current ?? (r.current = {
|
|
907
|
-
setQuery: (
|
|
908
|
-
submit: (
|
|
909
|
-
setPage: (
|
|
900
|
+
setQuery: (c) => s().setQuery(c),
|
|
901
|
+
submit: (c) => s().submit(c),
|
|
902
|
+
setPage: (c) => s().setPage(c),
|
|
910
903
|
retry: () => s().retry(),
|
|
911
|
-
observeResult: (
|
|
912
|
-
selectResult: (
|
|
913
|
-
|
|
904
|
+
observeResult: (c, h) => s().observeResult(c, h),
|
|
905
|
+
selectResult: (c, h) => s().selectResult(c, h),
|
|
906
|
+
productUrl: (c) => s().productUrl(c),
|
|
907
|
+
subscribe: (c) => s().subscribe(c),
|
|
914
908
|
getState: () => s().getState(),
|
|
915
909
|
// Create a replacement on next access after disposal.
|
|
916
910
|
dispose: () => {
|
|
917
|
-
var
|
|
918
|
-
(
|
|
911
|
+
var c;
|
|
912
|
+
(c = o.current) == null || c.dispose(), o.current = void 0;
|
|
919
913
|
}
|
|
920
|
-
}),
|
|
914
|
+
}), b(() => {
|
|
921
915
|
M({
|
|
922
916
|
method: "react",
|
|
923
|
-
version: "2.
|
|
917
|
+
version: "2.10.0"
|
|
924
918
|
});
|
|
925
|
-
const
|
|
919
|
+
const c = s();
|
|
926
920
|
return () => {
|
|
927
|
-
|
|
921
|
+
c.dispose(), o.current === c && (o.current = void 0);
|
|
928
922
|
};
|
|
929
923
|
}, [s]);
|
|
930
924
|
const a = P(
|
|
931
|
-
(
|
|
925
|
+
(c) => s().subscribe(c),
|
|
932
926
|
[s]
|
|
933
|
-
),
|
|
927
|
+
), l = P(
|
|
934
928
|
() => s().getState(),
|
|
935
929
|
[s]
|
|
936
930
|
), i = K(
|
|
937
931
|
a,
|
|
938
|
-
|
|
939
|
-
() =>
|
|
932
|
+
l,
|
|
933
|
+
() => Ke
|
|
940
934
|
);
|
|
941
935
|
return { controller: r.current, state: i, theme: e.client.theme };
|
|
942
936
|
};
|
|
943
937
|
export {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
938
|
+
re as DialogInput,
|
|
939
|
+
Xe as DialogProductBlock,
|
|
940
|
+
Ge as DialogSearchBar,
|
|
941
|
+
pe as DialogSearchPagination,
|
|
942
|
+
ve as DialogSearchProductCard,
|
|
943
|
+
Ye as DialogSearchResults,
|
|
944
|
+
Je as useDialogSearch
|
|
951
945
|
};
|