@askdialog/dialog-react 2.7.0 → 2.9.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.
@@ -1,14 +1,59 @@
1
- import { jsxs as g, jsx as n, Fragment as C } from "react/jsx-runtime";
2
- import { useRef as b, useState as v, useEffect as f, useMemo as y, useLayoutEffect as j, useCallback as P, useSyncExternalStore as q } from "react";
3
- import { registerDialogInstallation as D, addAuditCapability as z, resolveTextDirection as K, SearchStatus as S, DialogSearchError as F, createSearchController as U } from "@askdialog/dialog-sdk";
4
- import { createPortal as W } from "react-dom";
5
- const Q = ({
1
+ import { jsx as n, jsxs as p, Fragment as C } from "react/jsx-runtime";
2
+ import { useRef as b, useState as v, useEffect as f, useMemo as S, 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, DialogSearchError as Q, createSearchController as W } from "@askdialog/dialog-sdk";
4
+ import { createPortal as Z } from "react-dom";
5
+ const R = {
6
+ en: {
7
+ placeholder: "Ask the AI a question",
8
+ aiDisclosure: "You're chatting with an AI assistant. It can make mistakes, so please double-check important information",
9
+ askSomethingElse: "Ask something else"
10
+ },
11
+ fr: {
12
+ placeholder: "Posez une question à l'IA",
13
+ aiDisclosure: "Vous discutez avec un assistant IA. Il peut se tromper, pensez à vérifier les informations importantes",
14
+ askSomethingElse: "Posez une autre question"
15
+ },
16
+ es: {
17
+ placeholder: "Haz una pregunta a la IA",
18
+ aiDisclosure: "Estás chateando con un asistente de IA. Puede cometer errores, así que verifica la información importante",
19
+ askSomethingElse: "Pregunta otra cosa"
20
+ }
21
+ }, _ = (e) => {
22
+ var o;
23
+ const t = ((o = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : o.toLowerCase()) ?? "en";
24
+ return R[t] ?? R.en;
25
+ }, X = ({
26
+ client: e,
27
+ questions: t,
28
+ disabled: o,
29
+ productId: s,
30
+ productTitle: r,
31
+ selectedVariantId: a
32
+ }) => /* @__PURE__ */ n(
33
+ "button",
34
+ {
35
+ type: "button",
36
+ className: "dialog-ask-something-else",
37
+ disabled: o,
38
+ onClick: () => {
39
+ e.openAssistantWithSuggestions({
40
+ questions: t ?? [],
41
+ product: {
42
+ id: s,
43
+ title: r,
44
+ selectedVariantId: a
45
+ }
46
+ });
47
+ },
48
+ children: _(e.locale).askSomethingElse
49
+ }
50
+ ), G = ({
6
51
  title: e = "Your expert",
7
52
  description: t = "A question about this product?"
8
- }) => /* @__PURE__ */ g("div", { className: "dialog-block-header-container", children: [
53
+ }) => /* @__PURE__ */ p("div", { className: "dialog-block-header-container", children: [
9
54
  /* @__PURE__ */ n("div", { className: "dialog-block-title", children: e }),
10
55
  /* @__PURE__ */ n("div", { className: "dialog-block-description", children: t })
11
- ] }), Z = ({ color: e = "#181825" }) => /* @__PURE__ */ g(
56
+ ] }), Y = ({ color: e = "#181825" }) => /* @__PURE__ */ p(
12
57
  "svg",
13
58
  {
14
59
  width: "20",
@@ -17,7 +62,7 @@ const Q = ({
17
62
  fill: "none",
18
63
  xmlns: "http://www.w3.org/2000/svg",
19
64
  children: [
20
- /* @__PURE__ */ g("g", { clipPath: "url(#clip0_466_934)", children: [
65
+ /* @__PURE__ */ p("g", { clipPath: "url(#clip0_466_934)", children: [
21
66
  /* @__PURE__ */ n(
22
67
  "path",
23
68
  {
@@ -42,55 +87,55 @@ const Q = ({
42
87
  /* @__PURE__ */ n("defs", { children: /* @__PURE__ */ n("clipPath", { id: "clip0_466_934", children: /* @__PURE__ */ n("rect", { width: "20", height: "20", fill: "white" }) }) })
43
88
  ]
44
89
  }
45
- ), X = ({
90
+ ), J = ({
46
91
  client: e,
47
92
  questions: t,
48
- productId: r,
93
+ productId: o,
49
94
  productTitle: s,
50
- selectedVariantId: o
95
+ selectedVariantId: r
51
96
  }) => {
52
- const i = (l) => {
97
+ const a = (l) => {
53
98
  e.sendProductMessage({
54
- productId: r,
99
+ productId: o,
55
100
  productTitle: s,
56
- selectedVariantId: o,
101
+ selectedVariantId: r,
57
102
  question: l,
58
103
  fromQuestionSuggestion: !0
59
104
  });
60
105
  };
61
- return /* @__PURE__ */ n(C, { children: t.map((l) => /* @__PURE__ */ g(
106
+ return /* @__PURE__ */ n(C, { children: t.map((l) => /* @__PURE__ */ p(
62
107
  "button",
63
108
  {
64
109
  className: "dialog-block-suggestions-item",
65
- onClick: () => i(l.question),
110
+ onClick: () => a(l.question),
66
111
  children: [
67
- /* @__PURE__ */ n(Z, { color: e.theme.primaryColor }),
112
+ /* @__PURE__ */ n(Y, { color: e.theme.primaryColor }),
68
113
  /* @__PURE__ */ n("span", { className: "dialog-block-suggestions-item-label", children: l.question })
69
114
  ]
70
115
  },
71
116
  l.question
72
117
  )) });
73
- }, G = () => /* @__PURE__ */ g(C, { children: [
118
+ }, ee = () => /* @__PURE__ */ p(C, { children: [
74
119
  /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" }),
75
120
  /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" }),
76
121
  /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" })
77
- ] }), Y = ({
122
+ ] }), te = ({
78
123
  client: e,
79
124
  questions: t,
80
- isLoading: r,
125
+ isLoading: o,
81
126
  productId: s,
82
- productTitle: o,
83
- selectedVariantId: i
84
- }) => /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-container", children: r || !t ? /* @__PURE__ */ n(G, {}) : /* @__PURE__ */ n(
85
- X,
127
+ productTitle: r,
128
+ selectedVariantId: a
129
+ }) => /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-container", children: o || !t ? /* @__PURE__ */ n(ee, {}) : /* @__PURE__ */ n(
130
+ J,
86
131
  {
87
132
  client: e,
88
133
  questions: t,
89
134
  productId: s,
90
- productTitle: o,
91
- selectedVariantId: i
135
+ productTitle: r,
136
+ selectedVariantId: a
92
137
  }
93
- ) }), J = ({ color: e = "#ffffff" }) => /* @__PURE__ */ n(
138
+ ) }), se = ({ color: e = "#ffffff" }) => /* @__PURE__ */ n(
94
139
  "svg",
95
140
  {
96
141
  width: "20",
@@ -109,57 +154,40 @@ const Q = ({
109
154
  }
110
155
  )
111
156
  }
112
- ), E = {
113
- en: {
114
- placeholder: "Ask the AI a question",
115
- aiDisclosure: "You're chatting with an AI assistant. It can make mistakes, so please double-check important information"
116
- },
117
- fr: {
118
- placeholder: "Posez une question à l'IA",
119
- aiDisclosure: "Vous discutez avec un assistant IA. Il peut se tromper, pensez à vérifier les informations importantes"
120
- },
121
- es: {
122
- placeholder: "Haz una pregunta a la IA",
123
- aiDisclosure: "Estás chateando con un asistente de IA. Puede cometer errores, así que verifica la información importante"
124
- }
125
- }, ee = (e) => {
126
- var r;
127
- const t = ((r = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : r.toLowerCase()) ?? "en";
128
- return E[t] ?? E.en;
129
- }, te = ({
157
+ ), oe = ({
130
158
  client: e,
131
159
  productId: t,
132
- productTitle: r,
160
+ productTitle: o,
133
161
  selectedVariantId: s
134
162
  }) => {
135
- const o = b(null), [i, l] = v(""), a = ee(e.locale), c = () => {
163
+ const r = b(null), [a, l] = v(""), i = _(e.locale), c = () => {
136
164
  var d;
137
- (d = o.current) == null || d.focus();
165
+ (d = r.current) == null || d.focus();
138
166
  }, u = () => {
139
- const d = i;
167
+ const d = a;
140
168
  d.trim() && (e.sendProductMessage({
141
169
  productId: t,
142
- productTitle: r,
170
+ productTitle: o,
143
171
  selectedVariantId: s,
144
172
  question: d,
145
173
  fromQuestionSuggestion: !0
146
174
  }), l(""));
147
- }, p = (d) => {
175
+ }, m = (d) => {
148
176
  d.key === "Enter" && u();
149
177
  };
150
- return /* @__PURE__ */ g("div", { className: "dialog-input-container", children: [
151
- /* @__PURE__ */ g("div", { className: "dialog-input-wrapper", onClick: c, children: [
178
+ return /* @__PURE__ */ p("div", { className: "dialog-input-container", children: [
179
+ /* @__PURE__ */ p("div", { className: "dialog-input-wrapper", onClick: c, children: [
152
180
  /* @__PURE__ */ n(
153
181
  "input",
154
182
  {
155
183
  id: "dialog-ask-anything-input-ai-input",
156
- ref: o,
157
- value: i,
184
+ ref: r,
185
+ value: a,
158
186
  onChange: (d) => l(d.target.value),
159
187
  className: "dialog-ask-anything-input-ai-input",
160
- placeholder: a.placeholder,
188
+ placeholder: i.placeholder,
161
189
  "aria-describedby": "dialog-input-ai-disclosure",
162
- onKeyDown: p
190
+ onKeyDown: m
163
191
  }
164
192
  ),
165
193
  /* @__PURE__ */ n(
@@ -167,30 +195,30 @@ const Q = ({
167
195
  {
168
196
  id: "send-message-button-ai-input",
169
197
  className: "dialog-input-submit",
170
- disabled: !i.trim(),
198
+ disabled: !a.trim(),
171
199
  onClick: u,
172
- children: /* @__PURE__ */ n(J, { color: e.theme.ctaTextColor })
200
+ children: /* @__PURE__ */ n(se, { color: e.theme.ctaTextColor })
173
201
  }
174
202
  )
175
203
  ] }),
176
- /* @__PURE__ */ n("p", { id: "dialog-input-ai-disclosure", className: "dialog-input-ai-disclosure", children: a.aiDisclosure })
204
+ /* @__PURE__ */ n("p", { id: "dialog-input-ai-disclosure", className: "dialog-input-ai-disclosure", children: i.aiDisclosure })
177
205
  ] });
178
- }, A = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), se = (e) => {
206
+ }, I = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), ne = (e) => {
179
207
  if (!e) return;
180
208
  const t = document.body;
181
- Object.keys(e).forEach((r) => {
182
- const s = r, o = A(r);
209
+ Object.keys(e).forEach((o) => {
210
+ const s = o, r = I(o);
183
211
  if (e[s] !== void 0) {
184
212
  if (typeof e[s] == "object") {
185
213
  Object.keys(e[s]).forEach(
186
- (i) => {
187
- var a;
188
- const l = i;
214
+ (a) => {
215
+ var i;
216
+ const l = a;
189
217
  if (l !== void 0) {
190
- const c = A(i), u = e[s];
218
+ const c = I(a), u = e[s];
191
219
  t.style.setProperty(
192
- `--dialog-theme-${o}-${c}`,
193
- (a = u[l]) == null ? void 0 : a.toString()
220
+ `--dialog-theme-${r}-${c}`,
221
+ (i = u[l]) == null ? void 0 : i.toString()
194
222
  );
195
223
  }
196
224
  }
@@ -198,98 +226,111 @@ const Q = ({
198
226
  return;
199
227
  }
200
228
  if (s === "ctaBorderType") {
201
- const i = e[s] === "rounded" ? "24px" : "0";
202
- t.style.setProperty(`--dialog-theme-${o}`, i);
229
+ const a = e[s] === "rounded" ? "24px" : "0";
230
+ t.style.setProperty(`--dialog-theme-${r}`, a);
203
231
  return;
204
232
  }
205
233
  t.style.setProperty(
206
- `--dialog-theme-${o}`,
234
+ `--dialog-theme-${r}`,
207
235
  e[s].toString()
208
236
  );
209
237
  }
210
238
  });
211
239
  }, re = ({ theme: e, children: t }) => (f(() => {
212
- e && se(e);
213
- }, [e]), /* @__PURE__ */ n(C, { children: t })), Fe = ({
240
+ e && ne(e);
241
+ }, [e]), /* @__PURE__ */ n(C, { children: t })), ie = 2, ae = 5, Ze = ({
214
242
  client: e,
215
243
  productId: t,
216
- productTitle: r,
244
+ productTitle: o,
217
245
  selectedVariantId: s,
218
- enableInput: o = !0
246
+ enableInput: r = !1
219
247
  }) => {
220
- const [i, l] = v(!0), [a, c] = v(
248
+ var g;
249
+ const [a, l] = v(!0), [i, c] = v(
221
250
  void 0
222
251
  );
223
252
  f(() => {
224
- D({
253
+ M({
225
254
  method: "react",
226
- version: "2.7.0"
227
- }), z("pdp-block");
255
+ version: "2.9.0"
256
+ }), F("pdp-block");
228
257
  }, []);
229
- const u = y(
230
- () => i ? "" : a == null ? void 0 : a.assistantName,
231
- [a, i]
232
- ), p = y(
233
- () => i ? "" : a == null ? void 0 : a.description,
234
- [a, i]
235
- ), d = y(
236
- () => i ? "" : a == null ? void 0 : a.inputPlaceholder,
237
- [a, i]
238
- ), m = y(
258
+ const u = S(
259
+ () => a ? "" : i == null ? void 0 : i.assistantName,
260
+ [i, a]
261
+ ), m = S(
262
+ () => a ? "" : i == null ? void 0 : i.description,
263
+ [i, a]
264
+ ), d = S(
265
+ () => a ? "" : i == null ? void 0 : i.inputPlaceholder,
266
+ [i, a]
267
+ ), h = S(
239
268
  () => {
240
- var h;
241
- return K((h = e.getLocalizationInformations()) == null ? void 0 : h.languageCode);
269
+ var y;
270
+ return U((y = e.getLocalizationInformations()) == null ? void 0 : y.languageCode);
242
271
  },
243
272
  [e]
244
273
  );
245
274
  return f(() => {
246
- let h = !0;
275
+ let y = !0;
247
276
  return (async () => {
248
277
  l(!0), c(void 0);
249
278
  try {
250
- const k = await e.getSuggestions(t);
251
- h && c(k);
252
- } catch (k) {
253
- console.error("error", k);
279
+ const E = await e.getSuggestions(t, {
280
+ limit: ae
281
+ });
282
+ y && c(E);
283
+ } catch (E) {
284
+ console.error("error", E);
254
285
  } finally {
255
- h && l(!1);
286
+ y && l(!1);
256
287
  }
257
288
  })(), () => {
258
- h = !1;
289
+ y = !1;
259
290
  };
260
- }, [e, t]), /* @__PURE__ */ n(re, { theme: e.theme, children: /* @__PURE__ */ g(
291
+ }, [e, t]), /* @__PURE__ */ n(re, { theme: e.theme, children: /* @__PURE__ */ p(
261
292
  "div",
262
293
  {
263
294
  id: "dialog-instant",
264
295
  className: "dialog-block-container",
265
- dir: m,
296
+ dir: h,
266
297
  children: [
267
- /* @__PURE__ */ n(Q, { title: u, description: p }),
298
+ /* @__PURE__ */ n(G, { title: u, description: m }),
268
299
  /* @__PURE__ */ n(
269
- Y,
300
+ te,
270
301
  {
271
302
  client: e,
272
- questions: a == null ? void 0 : a.questions,
273
- isLoading: i,
303
+ questions: (g = i == null ? void 0 : i.questions) == null ? void 0 : g.slice(0, ie),
304
+ isLoading: a,
274
305
  productId: t,
275
- productTitle: r,
306
+ productTitle: o,
276
307
  selectedVariantId: s
277
308
  }
278
309
  ),
279
- o && /* @__PURE__ */ n(
280
- te,
310
+ r ? /* @__PURE__ */ n(
311
+ oe,
281
312
  {
282
313
  client: e,
283
314
  placeholder: d,
284
315
  productId: t,
285
- productTitle: r,
316
+ productTitle: o,
317
+ selectedVariantId: s
318
+ }
319
+ ) : /* @__PURE__ */ n(
320
+ X,
321
+ {
322
+ client: e,
323
+ questions: i == null ? void 0 : i.questions,
324
+ disabled: a,
325
+ productId: t,
326
+ productTitle: o,
286
327
  selectedVariantId: s
287
328
  }
288
329
  )
289
330
  ]
290
331
  }
291
332
  ) });
292
- }, ne = () => /* @__PURE__ */ n(
333
+ }, ce = () => /* @__PURE__ */ n(
293
334
  "svg",
294
335
  {
295
336
  width: 16,
@@ -309,7 +350,7 @@ const Q = ({
309
350
  }
310
351
  )
311
352
  }
312
- ), oe = "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", ae = ({
353
+ ), le = "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", de = ({
313
354
  color: e = "currentColor"
314
355
  }) => /* @__PURE__ */ n(
315
356
  "svg",
@@ -320,32 +361,32 @@ const Q = ({
320
361
  fill: "none",
321
362
  xmlns: "http://www.w3.org/2000/svg",
322
363
  "aria-hidden": "true",
323
- children: /* @__PURE__ */ n("path", { d: oe, fill: e })
364
+ children: /* @__PURE__ */ n("path", { d: le, fill: e })
324
365
  }
325
- ), Ue = ({
366
+ ), Xe = ({
326
367
  controller: e,
327
368
  placeholder: t = "Search products...",
328
- autoFocus: r = !1,
369
+ autoFocus: o = !1,
329
370
  submitAriaLabel: s = "Search"
330
371
  }) => {
331
- const [o, i] = v("");
332
- return /* @__PURE__ */ g("form", { className: "dialog-search-bar", role: "search", onSubmit: (a) => {
333
- a.preventDefault(), e.submit(o);
372
+ const [r, a] = v("");
373
+ return /* @__PURE__ */ p("form", { className: "dialog-search-bar", role: "search", onSubmit: (i) => {
374
+ i.preventDefault(), e.submit(r);
334
375
  }, children: [
335
- /* @__PURE__ */ g("div", { className: "dialog-search-bar-field", children: [
336
- /* @__PURE__ */ n("span", { className: "dialog-search-bar-icon", children: /* @__PURE__ */ n(ae, {}) }),
376
+ /* @__PURE__ */ p("div", { className: "dialog-search-bar-field", children: [
377
+ /* @__PURE__ */ n("span", { className: "dialog-search-bar-icon", children: /* @__PURE__ */ n(de, {}) }),
337
378
  /* @__PURE__ */ n(
338
379
  "input",
339
380
  {
340
381
  type: "text",
341
382
  name: "dialog-search-query",
342
383
  className: "dialog-search-bar-input",
343
- value: o,
384
+ value: r,
344
385
  "aria-label": t,
345
386
  placeholder: t,
346
- autoFocus: r,
347
- onChange: (a) => {
348
- i(a.target.value), e.setQuery(a.target.value);
387
+ autoFocus: o,
388
+ onChange: (i) => {
389
+ a(i.target.value), e.setQuery(i.target.value);
349
390
  }
350
391
  }
351
392
  )
@@ -356,11 +397,11 @@ const Q = ({
356
397
  type: "submit",
357
398
  className: "dialog-search-bar-submit",
358
399
  "aria-label": s,
359
- children: /* @__PURE__ */ n(ne, {})
400
+ children: /* @__PURE__ */ n(ce, {})
360
401
  }
361
402
  )
362
403
  ] });
363
- }, ie = (e, t) => {
404
+ }, ue = (e, t) => {
364
405
  try {
365
406
  return new Intl.NumberFormat(t).format(e);
366
407
  } catch {
@@ -378,7 +419,7 @@ const Q = ({
378
419
  seeAllLabel: (t) => t === 1 ? "See the result" : `See all ${e(t)} results`,
379
420
  previous: "Previous",
380
421
  next: "Next",
381
- pageOf: (t, r) => `Page ${e(t)} / ${e(r)}`
422
+ pageOf: (t, o) => `Page ${e(t)} / ${e(o)}`
382
423
  }),
383
424
  fr: (e) => ({
384
425
  searching: (t) => `Recherche de « ${t} »…`,
@@ -391,7 +432,7 @@ const Q = ({
391
432
  seeAllLabel: (t) => t === 1 ? "Voir le résultat" : `Voir les ${e(t)} résultats`,
392
433
  previous: "Précédent",
393
434
  next: "Suivant",
394
- pageOf: (t, r) => `Page ${e(t)} / ${e(r)}`
435
+ pageOf: (t, o) => `Page ${e(t)} / ${e(o)}`
395
436
  }),
396
437
  de: (e) => ({
397
438
  searching: (t) => `Suche nach „${t}“…`,
@@ -404,7 +445,7 @@ const Q = ({
404
445
  seeAllLabel: (t) => t === 1 ? "Das Ergebnis anzeigen" : `Alle ${e(t)} Ergebnisse anzeigen`,
405
446
  previous: "Zurück",
406
447
  next: "Weiter",
407
- pageOf: (t, r) => `Seite ${e(t)} / ${e(r)}`
448
+ pageOf: (t, o) => `Seite ${e(t)} / ${e(o)}`
408
449
  }),
409
450
  es: (e) => ({
410
451
  searching: (t) => `Buscando «${t}»…`,
@@ -417,7 +458,7 @@ const Q = ({
417
458
  seeAllLabel: (t) => t === 1 ? "Ver el resultado" : `Ver los ${e(t)} resultados`,
418
459
  previous: "Anterior",
419
460
  next: "Siguiente",
420
- pageOf: (t, r) => `Página ${e(t)} / ${e(r)}`
461
+ pageOf: (t, o) => `Página ${e(t)} / ${e(o)}`
421
462
  }),
422
463
  it: (e) => ({
423
464
  searching: (t) => `Ricerca di “${t}”…`,
@@ -430,123 +471,122 @@ const Q = ({
430
471
  seeAllLabel: (t) => t === 1 ? "Vedi il risultato" : `Vedi tutti i ${e(t)} risultati`,
431
472
  previous: "Precedente",
432
473
  next: "Successivo",
433
- pageOf: (t, r) => `Pagina ${e(t)} / ${e(r)}`
474
+ pageOf: (t, o) => `Pagina ${e(t)} / ${e(o)}`
434
475
  })
435
- }, M = (e) => {
476
+ }, T = (e) => {
436
477
  var s;
437
478
  const t = ((s = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : s.toLowerCase()) ?? "en";
438
- return ($[t] ?? $.en)((o) => ie(o, e));
439
- }, T = (e) => e.status !== S.LOADING && e.response !== void 0 && e.response.nbPages > 1, ce = ({
479
+ return ($[t] ?? $.en)((r) => ue(r, e));
480
+ }, O = (e) => e.status !== L.LOADING && e.response !== void 0 && e.response.nbPages > 1, he = ({
440
481
  controller: e,
441
482
  state: t,
442
- locale: r
483
+ locale: o
443
484
  }) => {
444
485
  const s = t.response;
445
- if (s === void 0 || !T(t))
486
+ if (s === void 0 || !O(t))
446
487
  return null;
447
- const o = M(r);
448
- return /* @__PURE__ */ g("nav", { "aria-label": "Search results pages", className: "dialog-search-pagination", children: [
488
+ const r = T(o);
489
+ return /* @__PURE__ */ p("nav", { "aria-label": "Search results pages", className: "dialog-search-pagination", children: [
449
490
  /* @__PURE__ */ n(
450
491
  "button",
451
492
  {
452
493
  type: "button",
453
494
  disabled: s.page === 0,
454
495
  onClick: () => e.setPage(s.page - 1),
455
- children: o.previous
496
+ children: r.previous
456
497
  }
457
498
  ),
458
- /* @__PURE__ */ n("span", { children: o.pageOf(s.page + 1, s.nbPages) }),
499
+ /* @__PURE__ */ n("span", { children: r.pageOf(s.page + 1, s.nbPages) }),
459
500
  /* @__PURE__ */ n(
460
501
  "button",
461
502
  {
462
503
  type: "button",
463
504
  disabled: s.page >= s.nbPages - 1,
464
505
  onClick: () => e.setPage(s.page + 1),
465
- children: o.next
506
+ children: r.next
466
507
  }
467
508
  )
468
509
  ] });
469
- }, I = (e) => e.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/ẞ/gu, "ß").toUpperCase().toLowerCase().replace(/ς/g, "σ"), le = (e, t) => {
470
- const r = { before: "", match: e, after: "" }, s = I(t.trim());
510
+ }, D = (e) => e.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/ẞ/gu, "ß").toUpperCase().toLowerCase().replace(/ς/g, "σ"), ge = (e, t) => {
511
+ const o = { before: "", match: e, after: "" }, s = D(t.trim());
471
512
  if (s === "")
472
- return r;
473
- const o = [...e], i = [];
513
+ return o;
514
+ const r = [...e], a = [];
474
515
  let l = "";
475
- o.forEach((p, d) => {
476
- const m = I(p);
477
- for (let h = 0; h < m.length; h += 1)
478
- i.push(d);
479
- l += m;
516
+ r.forEach((m, d) => {
517
+ const h = D(m);
518
+ for (let g = 0; g < h.length; g += 1)
519
+ a.push(d);
520
+ l += h;
480
521
  });
481
- const a = l.indexOf(s);
482
- if (a === -1)
483
- return r;
484
- const c = i[a], u = i[a + s.length - 1] + 1;
522
+ const i = l.indexOf(s);
523
+ if (i === -1)
524
+ return o;
525
+ const c = a[i], u = a[i + s.length - 1] + 1;
485
526
  return {
486
- before: o.slice(0, c).join(""),
487
- match: o.slice(c, u).join(""),
488
- after: o.slice(u).join("")
527
+ before: r.slice(0, c).join(""),
528
+ match: r.slice(c, u).join(""),
529
+ after: r.slice(u).join("")
489
530
  };
490
- }, O = ({
531
+ }, H = ({
491
532
  title: e,
492
533
  query: t
493
534
  }) => {
494
- const { before: r, match: s, after: o } = le(e, t);
495
- return /* @__PURE__ */ g(C, { children: [
496
- r !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: r }),
535
+ const { before: o, match: s, after: r } = ge(e, t);
536
+ return /* @__PURE__ */ p(C, { children: [
537
+ o !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: o }),
497
538
  /* @__PURE__ */ n("span", { className: "dialog-search-match", children: s }),
498
- o !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: o })
539
+ r !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: r })
499
540
  ] });
500
- }, de = ({ amount: e, currencyCode: t }, r) => t === void 0 ? new Intl.NumberFormat(r).format(Number(e)) : new Intl.NumberFormat(r, {
501
- style: "currency",
502
- currency: t
503
- }).format(Number(e)), ue = (e, t) => {
541
+ }, pe = ({ variants_min_price: e, currency: t }, o) => {
504
542
  if (e === void 0)
505
543
  return "";
506
544
  try {
507
- return de(e.min, t);
545
+ return t === void 0 ? new Intl.NumberFormat(o).format(e) : new Intl.NumberFormat(o, { style: "currency", currency: t }).format(
546
+ e
547
+ );
508
548
  } catch {
509
549
  return "";
510
550
  }
511
- }, he = (e) => {
551
+ }, me = (e) => e.product_image || e.image || void 0, fe = (e) => {
512
552
  try {
513
553
  const { protocol: t } = new URL(e, window.location.href);
514
554
  return t === "http:" || t === "https:" ? e : void 0;
515
555
  } catch {
516
556
  return;
517
557
  }
518
- }, _ = (e) => e.url === void 0 || e.url === "" ? void 0 : he(e.url), H = (e) => e.title ?? e.handle ?? e.objectID, ge = ({
558
+ }, q = (e) => e.url === void 0 || e.url === "" ? void 0 : fe(e.url), B = (e) => e.title ?? e.handle ?? e.objectID, be = ({
519
559
  controller: e,
520
560
  hit: t,
521
- index: r,
561
+ index: o,
522
562
  locale: s,
523
- query: o = ""
563
+ query: r = ""
524
564
  }) => {
525
- const i = b(null);
565
+ const a = b(null);
526
566
  f(() => {
527
- i.current !== null && e.observeResult(i.current, r);
528
- }, [e, t, r]);
529
- const l = (d) => {
530
- const m = d.metaKey || d.ctrlKey || d.shiftKey || d.altKey;
531
- e.selectResult(r, { navigate: !m }) && d.preventDefault();
532
- }, a = (d) => {
533
- d.button === 1 && e.selectResult(r, { navigate: !1 });
534
- }, c = ue(t.priceRange, s), u = _(t), p = /* @__PURE__ */ g(C, { children: [
535
- /* @__PURE__ */ n("span", { className: "dialog-search-product-thumb", "aria-hidden": !0, children: t.imageUrl !== void 0 && t.imageUrl !== "" && /* @__PURE__ */ n("img", { src: t.imageUrl, alt: "", loading: "lazy" }) }),
536
- /* @__PURE__ */ n("span", { className: "dialog-search-product-title", children: /* @__PURE__ */ n(O, { title: H(t), query: o }) }),
567
+ a.current !== null && e.observeResult(a.current, o);
568
+ }, [e, t, o]);
569
+ const l = (h) => {
570
+ const g = h.metaKey || h.ctrlKey || h.shiftKey || h.altKey;
571
+ e.selectResult(o, { navigate: !g }) && h.preventDefault();
572
+ }, i = (h) => {
573
+ h.button === 1 && e.selectResult(o, { navigate: !1 });
574
+ }, c = pe(t, s), u = q(t), m = me(t), d = /* @__PURE__ */ p(C, { children: [
575
+ /* @__PURE__ */ n("span", { className: "dialog-search-product-thumb", "aria-hidden": !0, children: m !== void 0 && /* @__PURE__ */ n("img", { src: m, alt: "", loading: "lazy" }) }),
576
+ /* @__PURE__ */ n("span", { className: "dialog-search-product-title", children: /* @__PURE__ */ n(H, { title: B(t), query: r }) }),
537
577
  c !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-product-price", children: c })
538
578
  ] });
539
- return /* @__PURE__ */ n("li", { ref: i, className: "dialog-search-card", children: u === void 0 ? /* @__PURE__ */ n("div", { className: "dialog-search-product", children: p }) : /* @__PURE__ */ n(
579
+ return /* @__PURE__ */ n("li", { ref: a, className: "dialog-search-card", children: u === void 0 ? /* @__PURE__ */ n("div", { className: "dialog-search-product", children: d }) : /* @__PURE__ */ n(
540
580
  "a",
541
581
  {
542
582
  className: "dialog-search-product",
543
583
  href: u,
544
584
  onClick: l,
545
- onAuxClick: a,
546
- children: p
585
+ onAuxClick: i,
586
+ children: d
547
587
  }
548
588
  ) });
549
- }, pe = () => /* @__PURE__ */ n(
589
+ }, ve = () => /* @__PURE__ */ n(
550
590
  "svg",
551
591
  {
552
592
  width: 16,
@@ -557,7 +597,7 @@ const Q = ({
557
597
  "aria-hidden": "true",
558
598
  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" })
559
599
  }
560
- ), me = () => /* @__PURE__ */ n(
600
+ ), Ce = () => /* @__PURE__ */ n(
561
601
  "svg",
562
602
  {
563
603
  width: 12,
@@ -568,98 +608,98 @@ const Q = ({
568
608
  "aria-hidden": "true",
569
609
  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" })
570
610
  }
571
- ), B = (e) => (e ?? []).flatMap((t) => {
572
- const r = _(t);
573
- return r === void 0 ? [] : [{ collection: t, href: r }];
574
- }), fe = ({
611
+ ), j = (e) => (e ?? []).flatMap((t) => {
612
+ const o = q(t);
613
+ return o === void 0 ? [] : [{ collection: t, href: o }];
614
+ }), ye = ({
575
615
  collections: e,
576
616
  query: t,
577
- messages: r
617
+ messages: o
578
618
  }) => {
579
- const s = B(e);
580
- return s.length === 0 ? null : /* @__PURE__ */ g("aside", { className: "dialog-search-collections", children: [
581
- /* @__PURE__ */ g("div", { className: "dialog-search-section-head", children: [
582
- /* @__PURE__ */ n("p", { className: "dialog-search-label", children: r.collectionsLabel }),
583
- /* @__PURE__ */ n("span", { className: "dialog-search-count", children: r.collectionsCount(s.length) })
619
+ const s = j(e);
620
+ return s.length === 0 ? null : /* @__PURE__ */ p("aside", { className: "dialog-search-collections", children: [
621
+ /* @__PURE__ */ p("div", { className: "dialog-search-section-head", children: [
622
+ /* @__PURE__ */ n("p", { className: "dialog-search-label", children: o.collectionsLabel }),
623
+ /* @__PURE__ */ n("span", { className: "dialog-search-count", children: o.collectionsCount(s.length) })
584
624
  ] }),
585
- /* @__PURE__ */ n("ul", { className: "dialog-search-collection-list", children: s.map(({ collection: o, href: i }) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ g("a", { className: "dialog-search-collection", href: i, children: [
586
- /* @__PURE__ */ n("span", { className: "dialog-search-collection-thumb", "aria-hidden": !0, children: o.imageUrl !== void 0 && o.imageUrl !== "" && /* @__PURE__ */ n("img", { src: o.imageUrl, alt: "", loading: "lazy" }) }),
587
- /* @__PURE__ */ n("span", { className: "dialog-search-collection-title", children: /* @__PURE__ */ n(O, { title: H(o), query: t }) }),
588
- /* @__PURE__ */ n("span", { className: "dialog-search-caret", children: /* @__PURE__ */ n(me, {}) })
589
- ] }) }, o.objectID)) })
625
+ /* @__PURE__ */ n("ul", { className: "dialog-search-collection-list", children: s.map(({ collection: r, href: a }) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ p("a", { className: "dialog-search-collection", href: a, children: [
626
+ /* @__PURE__ */ n("span", { className: "dialog-search-collection-thumb", "aria-hidden": !0, children: r.imageUrl !== void 0 && r.imageUrl !== "" && /* @__PURE__ */ n("img", { src: r.imageUrl, alt: "", loading: "lazy" }) }),
627
+ /* @__PURE__ */ n("span", { className: "dialog-search-collection-title", children: /* @__PURE__ */ n(H, { title: B(r), query: t }) }),
628
+ /* @__PURE__ */ n("span", { className: "dialog-search-caret", children: /* @__PURE__ */ n(Ce, {}) })
629
+ ] }) }, r.objectID)) })
590
630
  ] });
591
- }, be = ({
631
+ }, Se = ({
592
632
  controller: e,
593
633
  response: t,
594
- locale: r,
634
+ locale: o,
595
635
  messages: s
596
- }) => /* @__PURE__ */ g("section", { className: "dialog-search-products", children: [
597
- /* @__PURE__ */ n("div", { className: "dialog-search-section-head", children: /* @__PURE__ */ g("p", { className: "dialog-search-label", children: [
636
+ }) => /* @__PURE__ */ p("section", { className: "dialog-search-products", children: [
637
+ /* @__PURE__ */ n("div", { className: "dialog-search-section-head", children: /* @__PURE__ */ p("p", { className: "dialog-search-label", children: [
598
638
  s.productsLabel,
599
639
  t.nbHits > 0 && /* @__PURE__ */ n("span", { className: "dialog-search-label-count", children: ` · ${s.resultsCount(t.nbHits)}` })
600
640
  ] }) }),
601
- /* @__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((o, i) => /* @__PURE__ */ n(
602
- ge,
641
+ /* @__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(
642
+ be,
603
643
  {
604
644
  controller: e,
605
- hit: o,
606
- index: i,
607
- locale: r,
645
+ hit: r,
646
+ index: a,
647
+ locale: o,
608
648
  query: t.query
609
649
  },
610
- o.objectID
650
+ r.objectID
611
651
  )) })
612
- ] }), L = 8, w = 16, ve = 200, Ce = 1440, ye = (e, t) => e.bottom > 0 && e.top < t, we = (e, t) => {
613
- const r = Math.min(
614
- Ce,
652
+ ] }), k = 8, w = 16, we = 200, Le = 1440, ke = (e, t) => e.bottom > 0 && e.top < t, Ne = (e, t) => {
653
+ const o = Math.min(
654
+ Le,
615
655
  t - 2 * w
616
- ), s = e.left + e.width / 2 - r / 2;
656
+ ), s = e.left + e.width / 2 - o / 2;
617
657
  return { left: Math.min(
618
658
  Math.max(s, w),
619
- t - w - r
620
- ), width: r };
621
- }, Se = (e, t, r) => {
622
- const s = r - e.bottom - L - w, o = e.top - L - w, i = we(e, t);
623
- return s < ve && o > s ? {
624
- ...i,
625
- bottom: r - e.top + L,
626
- maxHeight: Math.max(o, 0)
659
+ t - w - o
660
+ ), width: o };
661
+ }, Ee = (e, t, o) => {
662
+ const s = o - e.bottom - k - w, r = e.top - k - w, a = Ne(e, t);
663
+ return s < we && r > s ? {
664
+ ...a,
665
+ bottom: o - e.top + k,
666
+ maxHeight: Math.max(r, 0)
627
667
  } : {
628
- ...i,
629
- top: e.bottom + L,
668
+ ...a,
669
+ top: e.bottom + k,
630
670
  maxHeight: Math.max(s, 0)
631
671
  };
632
- }, Le = (e) => {
672
+ }, Pe = (e) => {
633
673
  const t = e.trim().replace(/^#/, "");
634
674
  if (!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t))
635
675
  return;
636
- const r = t.length <= 4 ? [...t].map((s) => s + s).join("") : t;
676
+ const o = t.length <= 4 ? [...t].map((s) => s + s).join("") : t;
637
677
  return [0, 2, 4].map(
638
- (s) => Number.parseInt(r.slice(s, s + 2), 16)
678
+ (s) => Number.parseInt(o.slice(s, s + 2), 16)
639
679
  );
640
- }, Ne = (e) => {
680
+ }, Ae = (e) => {
641
681
  const t = /^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(e);
642
682
  if (t !== null)
643
683
  return [t[1], t[2], t[3]].map(Number);
644
- }, ke = (e) => {
684
+ }, xe = (e) => {
645
685
  if (typeof document > "u")
646
686
  return;
647
687
  const t = document.createElement("span");
648
688
  if (t.style.color = e, t.style.color === "")
649
689
  return;
650
690
  document.body.appendChild(t);
651
- const r = Ne(getComputedStyle(t).color);
652
- return t.remove(), r;
653
- }, Pe = (e) => Le(e) ?? ke(e), xe = (e) => {
691
+ const o = Ae(getComputedStyle(t).color);
692
+ return t.remove(), o;
693
+ }, Re = (e) => Pe(e) ?? xe(e), Ie = (e) => {
654
694
  const t = e / 255;
655
695
  return t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
656
- }, V = (e) => {
657
- const t = Pe(e);
696
+ }, z = (e) => {
697
+ const t = Re(e);
658
698
  if (t === void 0)
659
699
  return;
660
- const [r, s, o] = t.map(xe);
661
- return 0.2126 * r + 0.7152 * s + 0.0722 * o;
662
- }, Re = "#181825", Ee = "#ffffff", Ae = "straight", x = 0.5, R = {
700
+ const [o, s, r] = t.map(Ie);
701
+ return 0.2126 * o + 0.7152 * s + 0.0722 * r;
702
+ }, $e = "#181825", De = "#ffffff", Me = "straight", A = 0.5, x = {
663
703
  light: {
664
704
  panel: "#ffffff",
665
705
  side: "#fafbfc",
@@ -678,7 +718,7 @@ const Q = ({
678
718
  hover: "#242830",
679
719
  thumb: "#2b2f38"
680
720
  }
681
- }, $e = {
721
+ }, _e = {
682
722
  rectangle: {
683
723
  "r-panel": "4px",
684
724
  "r-item": "4px",
@@ -691,79 +731,79 @@ const Q = ({
691
731
  "r-thumb": "8px",
692
732
  "r-btn": "10px"
693
733
  }
694
- }, N = (e) => e === void 0 || e.trim() === "" ? void 0 : e.trim(), Ie = (e) => {
695
- const t = e === void 0 ? void 0 : V(e);
696
- return t === void 0 ? "light" : t < x ? "dark" : "light";
697
- }, De = (e, t) => {
698
- const r = V(e);
699
- return r === void 0 ? R[t].text : (t === "light" ? r < x : r >= x) ? e : R[t].text;
700
- }, Me = (e) => {
701
- const t = Ie(N(e == null ? void 0 : e.backgroundColor)), r = (e == null ? void 0 : e.ctaBorderType) === Ae ? "rectangle" : "rectangle-rounded", s = N(e == null ? void 0 : e.primaryColor) ?? Re, o = N(e == null ? void 0 : e.fontFamily), i = {
702
- ...R[t],
703
- ...$e[r],
734
+ }, N = (e) => e === void 0 || e.trim() === "" ? void 0 : e.trim(), Te = (e) => {
735
+ const t = e === void 0 ? void 0 : z(e);
736
+ return t === void 0 ? "light" : t < A ? "dark" : "light";
737
+ }, Oe = (e, t) => {
738
+ const o = z(e);
739
+ return o === void 0 ? x[t].text : (t === "light" ? o < A : o >= A) ? e : x[t].text;
740
+ }, He = (e) => {
741
+ const t = Te(N(e == null ? void 0 : e.backgroundColor)), o = (e == null ? void 0 : e.ctaBorderType) === Me ? "rectangle" : "rectangle-rounded", s = N(e == null ? void 0 : e.primaryColor) ?? $e, r = N(e == null ? void 0 : e.fontFamily), a = {
742
+ ...x[t],
743
+ ..._e[o],
704
744
  primary: s,
705
- accent: De(s, t),
706
- "cta-text": N(e == null ? void 0 : e.ctaTextColor) ?? Ee,
707
- ...o === void 0 ? {} : { font: o }
745
+ accent: Oe(s, t),
746
+ "cta-text": N(e == null ? void 0 : e.ctaTextColor) ?? De,
747
+ ...r === void 0 ? {} : { font: r }
708
748
  };
709
749
  return Object.fromEntries(
710
- Object.entries(i).map(([l, a]) => [`--dso-${l}`, a])
750
+ Object.entries(a).map(([l, i]) => [`--dso-${l}`, i])
711
751
  );
712
- }, Te = (e) => {
713
- const t = b(null), [r, s] = v(void 0), [o, i] = v({ width: 0, height: 0 });
714
- return j(() => {
752
+ }, qe = (e) => {
753
+ const t = b(null), [o, s] = v(void 0), [r, a] = v({ width: 0, height: 0 });
754
+ return V(() => {
715
755
  if (!e)
716
756
  return;
717
757
  const l = () => {
718
- const a = t.current;
719
- if (a === null)
758
+ const i = t.current;
759
+ if (i === null)
720
760
  return;
721
- const c = a.previousElementSibling ?? a, { top: u, bottom: p, left: d, width: m } = c.getBoundingClientRect();
722
- i(
723
- (h) => h.width === window.innerWidth && h.height === window.innerHeight ? h : { width: window.innerWidth, height: window.innerHeight }
761
+ const c = i.previousElementSibling ?? i, { top: u, bottom: m, left: d, width: h } = c.getBoundingClientRect();
762
+ a(
763
+ (g) => g.width === window.innerWidth && g.height === window.innerHeight ? g : { width: window.innerWidth, height: window.innerHeight }
724
764
  ), s(
725
- (h) => h !== void 0 && h.top === u && h.bottom === p && h.left === d && h.width === m ? h : { top: u, bottom: p, left: d, width: m }
765
+ (g) => g !== void 0 && g.top === u && g.bottom === m && g.left === d && g.width === h ? g : { top: u, bottom: m, left: d, width: h }
726
766
  );
727
767
  };
728
768
  return l(), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), () => {
729
769
  window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l);
730
770
  };
731
- }, [e]), { anchorRef: t, rect: r, viewport: o };
732
- }, Oe = (e, t) => {
733
- const [r, s] = v(!1), o = b(null), i = e.status !== S.IDLE && !r;
771
+ }, [e]), { anchorRef: t, rect: o, viewport: r };
772
+ }, Be = (e, t) => {
773
+ const [o, s] = v(!1), r = b(null), a = e.status !== L.IDLE && !o;
734
774
  return f(() => {
735
775
  s(!1);
736
776
  }, [e.query]), f(() => {
737
- if (!i)
777
+ if (!a)
738
778
  return;
739
- const l = (a) => {
740
- var m, h;
741
- const c = a.target;
779
+ const l = (i) => {
780
+ var h, g;
781
+ const c = i.target;
742
782
  if (!(c instanceof Node))
743
783
  return;
744
- const u = (m = t.current) == null ? void 0 : m.previousElementSibling, p = ((h = o.current) == null ? void 0 : h.contains(c)) ?? !1, d = (u == null ? void 0 : u.contains(c)) ?? !1;
745
- !p && !d && s(!0);
784
+ const u = (h = t.current) == null ? void 0 : h.previousElementSibling, m = ((g = r.current) == null ? void 0 : g.contains(c)) ?? !1, d = (u == null ? void 0 : u.contains(c)) ?? !1;
785
+ !m && !d && s(!0);
746
786
  };
747
787
  return document.addEventListener("pointerdown", l), () => document.removeEventListener("pointerdown", l);
748
- }, [i, t]), f(() => {
788
+ }, [a, t]), f(() => {
749
789
  var c;
750
790
  const l = (c = t.current) == null ? void 0 : c.previousElementSibling;
751
791
  if (l == null)
752
792
  return;
753
- const a = () => s(!1);
754
- return l.addEventListener("focusin", a), () => l.removeEventListener("focusin", a);
755
- }, [t]), { isOpen: i, panelRef: o };
756
- }, _e = (e) => e instanceof F ? `Search failed (${e.status}${e.code ? ` ${e.code}` : ""}): ${e.message}` : "Search failed: network error. Check your connection and try again.", He = (e, t) => {
757
- var m, h;
758
- const { controller: r, state: s, locale: o, seeAllHref: i } = e, { status: l, response: a } = s;
759
- if (l === S.ERROR)
760
- return /* @__PURE__ */ g("div", { className: "dialog-search-error", children: [
793
+ const i = () => s(!1);
794
+ return l.addEventListener("focusin", i), () => l.removeEventListener("focusin", i);
795
+ }, [t]), { isOpen: a, panelRef: r };
796
+ }, je = (e) => e instanceof Q ? `Search failed (${e.status}${e.code ? ` ${e.code}` : ""}): ${e.message}` : "Search failed: network error. Check your connection and try again.", ze = (e, t) => {
797
+ var h, g;
798
+ const { controller: o, state: s, locale: r, seeAllHref: a } = e, { status: l, response: i } = s;
799
+ if (l === L.ERROR)
800
+ return /* @__PURE__ */ p("div", { className: "dialog-search-error", children: [
761
801
  /* @__PURE__ */ n(
762
802
  "p",
763
803
  {
764
804
  role: "alert",
765
805
  className: "dialog-search-status dialog-search-status-error",
766
- children: _e(s.error)
806
+ children: je(s.error)
767
807
  }
768
808
  ),
769
809
  /* @__PURE__ */ n(
@@ -771,98 +811,98 @@ const Q = ({
771
811
  {
772
812
  type: "button",
773
813
  className: "dialog-search-retry",
774
- onClick: () => r.retry(),
814
+ onClick: () => o.retry(),
775
815
  children: t.retry
776
816
  }
777
817
  )
778
818
  ] });
779
- if (a === void 0)
819
+ if (i === void 0)
780
820
  return /* @__PURE__ */ n("p", { role: "status", className: "dialog-search-status", children: t.searching(s.query) });
781
- const c = ((h = (m = s.sections) == null ? void 0 : m.collections) == null ? void 0 : h.hits) ?? [], u = B(c).length > 0, p = i !== void 0 && a.nbHits > 0, d = !p && T(s);
782
- return /* @__PURE__ */ g(C, { children: [
783
- /* @__PURE__ */ g(
821
+ const c = ((g = (h = s.sections) == null ? void 0 : h.collections) == null ? void 0 : g.hits) ?? [], u = j(c).length > 0, m = a !== void 0 && i.nbHits > 0, d = !m && O(s);
822
+ return /* @__PURE__ */ p(C, { children: [
823
+ /* @__PURE__ */ p(
784
824
  "div",
785
825
  {
786
826
  className: `dialog-search-body${u ? "" : " dialog-search-body--no-collections"}`,
787
827
  children: [
788
828
  /* @__PURE__ */ n(
789
- fe,
829
+ ye,
790
830
  {
791
831
  collections: c,
792
- query: a.query,
832
+ query: i.query,
793
833
  messages: t
794
834
  }
795
835
  ),
796
836
  /* @__PURE__ */ n(
797
- be,
837
+ Se,
798
838
  {
799
- controller: r,
800
- response: a,
801
- locale: o,
839
+ controller: o,
840
+ response: i,
841
+ locale: r,
802
842
  messages: t
803
843
  }
804
844
  )
805
845
  ]
806
846
  }
807
847
  ),
808
- (p || d) && /* @__PURE__ */ n("div", { className: "dialog-search-footer", children: p ? /* @__PURE__ */ g("a", { className: "dialog-search-cta", href: i(a.query), children: [
809
- t.seeAllLabel(a.nbHits),
810
- /* @__PURE__ */ n(pe, {})
848
+ (m || d) && /* @__PURE__ */ n("div", { className: "dialog-search-footer", children: m ? /* @__PURE__ */ p("a", { className: "dialog-search-cta", href: a(i.query), children: [
849
+ t.seeAllLabel(i.nbHits),
850
+ /* @__PURE__ */ n(ve, {})
811
851
  ] }) : /* @__PURE__ */ n(
812
- ce,
852
+ he,
813
853
  {
814
- controller: r,
854
+ controller: o,
815
855
  state: s,
816
- locale: o
856
+ locale: r
817
857
  }
818
858
  ) })
819
859
  ] });
820
- }, We = (e) => {
821
- const { state: t, locale: r, theme: s, layout: o = "list" } = e, i = t.status !== S.IDLE, { anchorRef: l, rect: a, viewport: c } = Te(i), { isOpen: u, panelRef: p } = Oe(t, l), d = M(r), m = y(
822
- () => Me(s),
860
+ }, Ge = (e) => {
861
+ const { state: t, locale: o, theme: s, layout: r = "list" } = e, a = t.status !== L.IDLE, { anchorRef: l, rect: i, viewport: c } = qe(a), { isOpen: u, panelRef: m } = Be(t, l), d = T(o), h = S(
862
+ () => He(s),
823
863
  [s]
824
864
  );
825
- return /* @__PURE__ */ g(C, { children: [
865
+ return /* @__PURE__ */ p(C, { children: [
826
866
  /* @__PURE__ */ n("div", { ref: l }),
827
- u && a !== void 0 && ye(a, c.height) && W(
867
+ u && i !== void 0 && ke(i, c.height) && Z(
828
868
  /* @__PURE__ */ n(
829
869
  "div",
830
870
  {
831
- ref: p,
832
- className: `dialog-search-panel dialog-search-panel--${o}`,
871
+ ref: m,
872
+ className: `dialog-search-panel dialog-search-panel--${r}`,
833
873
  style: {
834
- ...Se(a, c.width, c.height),
835
- ...m
874
+ ...Ee(i, c.width, c.height),
875
+ ...h
836
876
  },
837
- children: He(e, d)
877
+ children: ze(e, d)
838
878
  }
839
879
  ),
840
880
  document.body
841
881
  )
842
882
  ] });
843
- }, Be = {
844
- status: S.IDLE,
883
+ }, Ve = {
884
+ status: L.IDLE,
845
885
  query: "",
846
886
  page: 0
847
- }, Qe = (e) => {
887
+ }, Ye = (e) => {
848
888
  const t = b(e);
849
889
  t.current = e;
850
- const r = b(void 0), s = P(() => {
851
- if (r.current === void 0) {
852
- const { client: c, surface: u = "search_page", ...p } = t.current;
853
- r.current = U({
854
- search: (d, m) => c.search(d, m),
890
+ const o = b(void 0), s = P(() => {
891
+ if (o.current === void 0) {
892
+ const { client: c, surface: u = "search_page", ...m } = t.current;
893
+ o.current = W({
894
+ search: (d, h) => c.search(d, h),
855
895
  analytics: {
856
896
  surface: u,
857
897
  trackViewSearchResults: (d) => c.trackViewSearchResults(d),
858
898
  trackSelectSearchResult: (d) => c.trackSelectSearchResult(d)
859
899
  },
860
- ...p
900
+ ...m
861
901
  });
862
902
  }
863
- return r.current;
864
- }, []), o = b(void 0);
865
- o.current ?? (o.current = {
903
+ return o.current;
904
+ }, []), r = b(void 0);
905
+ r.current ?? (r.current = {
866
906
  setQuery: (c) => s().setQuery(c),
867
907
  submit: (c) => s().submit(c),
868
908
  setPage: (c) => s().setPage(c),
@@ -874,37 +914,37 @@ const Q = ({
874
914
  // Create a replacement on next access after disposal.
875
915
  dispose: () => {
876
916
  var c;
877
- (c = r.current) == null || c.dispose(), r.current = void 0;
917
+ (c = o.current) == null || c.dispose(), o.current = void 0;
878
918
  }
879
919
  }), f(() => {
880
- D({
920
+ M({
881
921
  method: "react",
882
- version: "2.7.0"
922
+ version: "2.9.0"
883
923
  });
884
924
  const c = s();
885
925
  return () => {
886
- c.dispose(), r.current === c && (r.current = void 0);
926
+ c.dispose(), o.current === c && (o.current = void 0);
887
927
  };
888
928
  }, [s]);
889
- const i = P(
929
+ const a = P(
890
930
  (c) => s().subscribe(c),
891
931
  [s]
892
932
  ), l = P(
893
933
  () => s().getState(),
894
934
  [s]
895
- ), a = q(
896
- i,
935
+ ), i = K(
936
+ a,
897
937
  l,
898
- () => Be
938
+ () => Ve
899
939
  );
900
- return { controller: o.current, state: a, theme: e.client.theme };
940
+ return { controller: r.current, state: i, theme: e.client.theme };
901
941
  };
902
942
  export {
903
- te as DialogInput,
904
- Fe as DialogProductBlock,
905
- Ue as DialogSearchBar,
906
- ce as DialogSearchPagination,
907
- ge as DialogSearchProductCard,
908
- We as DialogSearchResults,
909
- Qe as useDialogSearch
943
+ oe as DialogInput,
944
+ Ze as DialogProductBlock,
945
+ Xe as DialogSearchBar,
946
+ he as DialogSearchPagination,
947
+ be as DialogSearchProductCard,
948
+ Ge as DialogSearchResults,
949
+ Ye as useDialogSearch
910
950
  };