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