@askdialog/dialog-vue 3.6.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +23 -7
  2. package/dist/components/DialogProductBlock/DialogInput.vue.d.ts +1 -0
  3. package/dist/components/DialogProductBlock/inputMessages.d.ts +6 -0
  4. package/dist/components/DialogSearch/DialogSearchCollections.vue.d.ts +9 -0
  5. package/dist/components/DialogSearch/DialogSearchPagination.vue.d.ts +1 -0
  6. package/dist/components/DialogSearch/DialogSearchProductCard.vue.d.ts +6 -1
  7. package/dist/components/DialogSearch/DialogSearchProducts.vue.d.ts +10 -0
  8. package/dist/components/DialogSearch/DialogSearchResults.vue.d.ts +14 -2
  9. package/dist/components/DialogSearch/{DialogSearchProductCardContent.vue.d.ts → HighlightedTitle.vue.d.ts} +2 -3
  10. package/dist/components/DialogSearch/cssColor.d.ts +3 -0
  11. package/dist/components/DialogSearch/panelPlacement.d.ts +5 -0
  12. package/dist/components/DialogSearch/searchCollections.d.ts +6 -0
  13. package/dist/components/DialogSearch/searchDisplay.d.ts +5 -2
  14. package/dist/components/DialogSearch/searchLayout.d.ts +1 -0
  15. package/dist/components/DialogSearch/searchMessages.d.ts +14 -0
  16. package/dist/components/DialogSearch/searchPagination.d.ts +2 -0
  17. package/dist/components/DialogSearch/searchTheme.d.ts +3 -0
  18. package/dist/components/DialogSearch/titleHighlight.d.ts +6 -0
  19. package/dist/components/DialogSearch/useAnchorRect.d.ts +6 -1
  20. package/dist/components/DialogSearch/useDialogSearch.d.ts +8 -1
  21. package/dist/components/index.d.ts +1 -0
  22. package/dist/dialog-vue.css +1 -1
  23. package/dist/dialog-vue.js +920 -557
  24. package/dist/dialog-vue.umd.cjs +3 -3
  25. package/dist/icons/ArrowRightIcon.vue.d.ts +2 -0
  26. package/dist/icons/CaretRightIcon.vue.d.ts +2 -0
  27. package/package.json +2 -2
@@ -1,33 +1,33 @@
1
- var ae = Object.defineProperty;
2
- var ce = (t, e, o) => e in t ? ae(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var H = (t, e, o) => ce(t, typeof e != "symbol" ? e + "" : e, o);
4
- import { defineComponent as R, createElementBlock as v, openBlock as _, createElementVNode as u, toDisplayString as k, Fragment as N, renderList as ee, createVNode as L, createBlock as O, ref as $, withDirectives as te, withKeys as le, vModelText as oe, onMounted as V, watch as U, renderSlot as de, computed as T, withCtx as ue, createCommentVNode as M, withModifiers as pe, onUnmounted as se, Teleport as _e, normalizeStyle as he, unref as q, shallowRef as fe } from "vue";
5
- const ge = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur"]), ve = (t) => t !== void 0 && ge.has(t.trim().toLowerCase().slice(0, 2)), me = (t) => ve(t) ? "rtl" : "ltr";
6
- var x;
1
+ var Ce = Object.defineProperty;
2
+ var ye = (t, e, s) => e in t ? Ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
+ var z = (t, e, s) => ye(t, typeof e != "symbol" ? e + "" : e, s);
4
+ import { defineComponent as w, createElementBlock as _, openBlock as u, createElementVNode as l, toDisplayString as E, Fragment as N, renderList as Q, createVNode as T, createBlock as O, ref as k, computed as b, withDirectives as ae, withKeys as Ee, vModelText as ie, onMounted as B, watch as M, renderSlot as we, withCtx as le, createCommentVNode as A, withModifiers as Ie, unref as K, resolveDynamicComponent as $e, mergeProps as Re, toHandlers as Te, createTextVNode as ce, onUnmounted as ue, Teleport as ke, normalizeStyle as Ae, normalizeClass as Z, shallowRef as Le } from "vue";
5
+ const xe = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur"]), De = (t) => t !== void 0 && xe.has(t.trim().toLowerCase().slice(0, 2)), Pe = (t) => De(t) ? "rtl" : "ltr";
6
+ var q;
7
7
  (function(t) {
8
- t.OPEN_ASSISTANT = "open_assistant", t.CLOSE_ASSISTANT = "close_assistant", t.SEND_MESSAGE = "PRODUCT_QUESTION", t.SEND_GENERIC_QUESTION = "GENERIC_QUESTION", t.TRACK_ADD_TO_CART = "TRACK_ADD_TO_CART", t.TRACK_SUBMIT_CHECKOUT = "TRACK_SUBMIT_CHECKOUT", t.TRACK_VIEW_SEARCH_RESULTS = "TRACK_VIEW_SEARCH_RESULTS", t.TRACK_SELECT_SEARCH_RESULT = "TRACK_SELECT_SEARCH_RESULT";
9
- })(x || (x = {}));
10
- var z;
8
+ t.OPEN_ASSISTANT = "open_assistant", t.OPEN_WITH_SUGGESTIONS = "OPEN_WITH_SUGGESTIONS", t.CLOSE_ASSISTANT = "close_assistant", t.SEND_MESSAGE = "PRODUCT_QUESTION", t.SEND_GENERIC_QUESTION = "GENERIC_QUESTION", t.TRACK_ADD_TO_CART = "TRACK_ADD_TO_CART", t.TRACK_SUBMIT_CHECKOUT = "TRACK_SUBMIT_CHECKOUT", t.TRACK_VIEW_SEARCH_RESULTS = "TRACK_VIEW_SEARCH_RESULTS", t.TRACK_SELECT_SEARCH_RESULT = "TRACK_SELECT_SEARCH_RESULT";
9
+ })(q || (q = {}));
10
+ var J;
11
11
  (function(t) {
12
12
  t.USER_OPENED_ASSISTANT = "userOpenedAssistant", t.USER_CLOSED_ASSISTANT = "userClosedAssistant", t.USER_SENT_MESSAGE = "userSentMessage", t.USER_CLICKED_ON_PRODUCT_CARD = "userClickedOnProductCard", t.USER_OPENED_RECOMMENDATION = "userOpenedRecommendation", t.USER_ADDED_TO_CART = "userAddedToCart", t.USER_SEND_POSITIVE_FEEDBACK = "userSendPositiveFeedback", t.USER_SEND_NEGATIVE_FEEDBACK = "userSendNegativeFeedback";
13
- })(z || (z = {}));
14
- x.TRACK_ADD_TO_CART, x.TRACK_SUBMIT_CHECKOUT, x.TRACK_VIEW_SEARCH_RESULTS, x.TRACK_SELECT_SEARCH_RESULT;
15
- class Se extends Error {
16
- constructor({ status: o, code: s, message: i }) {
17
- super(i);
18
- H(this, "status");
19
- H(this, "code");
20
- this.name = "DialogSearchError", this.status = o, this.code = s;
13
+ })(J || (J = {}));
14
+ q.TRACK_ADD_TO_CART, q.TRACK_SUBMIT_CHECKOUT, q.TRACK_VIEW_SEARCH_RESULTS, q.TRACK_SELECT_SEARCH_RESULT;
15
+ class Oe extends Error {
16
+ constructor({ status: s, code: o, message: r }) {
17
+ super(r);
18
+ z(this, "status");
19
+ z(this, "code");
20
+ this.name = "DialogSearchError", this.status = s, this.code = o;
21
21
  }
22
22
  }
23
- const j = (t, e, o) => {
23
+ const X = (t, e, s) => {
24
24
  if (!/^[a-z]{2}$/.test(e))
25
25
  throw new Error("Search language must be a lowercase ISO 639-1 code.");
26
- if (!/^[A-Za-z]{3}$/.test(o))
26
+ if (!/^[A-Za-z]{3}$/.test(s))
27
27
  throw new Error("Search currency must be an ISO 4217 code.");
28
- return `${t}_${e}_${o.toLowerCase()}`;
29
- }, W = "multiple installation methods detected:", be = () => typeof window > "u" ? void 0 : window, ne = () => {
30
- const t = be();
28
+ return `${t}_${e}_${s.toLowerCase()}`;
29
+ }, ee = "multiple installation methods detected:", Ne = () => typeof window > "u" ? void 0 : window, de = () => {
30
+ const t = Ne();
31
31
  if (t !== void 0)
32
32
  return t.dialog = t.dialog ?? {}, t.dialog.audit = t.dialog.audit ?? {
33
33
  methods: [],
@@ -35,264 +35,264 @@ const j = (t, e, o) => {
35
35
  capabilities: [],
36
36
  warnings: []
37
37
  }, t.dialog.audit;
38
- }, Ce = (t) => {
39
- if (t.warnings = t.warnings.filter((e) => !e.startsWith(W)), t.methods.length >= 2) {
40
- const e = t.methods.map((o) => o.method).join(", ");
41
- t.warnings.push(`${W} ${e}`);
38
+ }, qe = (t) => {
39
+ if (t.warnings = t.warnings.filter((e) => !e.startsWith(ee)), t.methods.length >= 2) {
40
+ const e = t.methods.map((s) => s.method).join(", ");
41
+ t.warnings.push(`${ee} ${e}`);
42
42
  }
43
- }, Ee = (t, e) => e === void 0 ? t : {
43
+ }, Me = (t, e) => e === void 0 ? t : {
44
44
  version: (t == null ? void 0 : t.version) ?? e.version,
45
45
  commit: (t == null ? void 0 : t.commit) ?? e.commit
46
- }, re = (t) => {
47
- const e = ne();
46
+ }, pe = (t) => {
47
+ const e = de();
48
48
  if (e === void 0)
49
49
  return;
50
- const o = e.methods.find((s) => s.method === t.method);
51
- if (o === void 0) {
52
- e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), Ce(e);
50
+ const s = e.methods.find((o) => o.method === t.method);
51
+ if (s === void 0) {
52
+ e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), qe(e);
53
53
  return;
54
54
  }
55
- o.version = o.version ?? t.version, o.build = Ee(o.build, t.build), o.source = o.source ?? t.source;
56
- }, we = (t) => {
57
- const e = ne();
55
+ s.version = s.version ?? t.version, s.build = Me(s.build, t.build), s.source = s.source ?? t.source;
56
+ }, Ue = (t) => {
57
+ const e = de();
58
58
  e !== void 0 && (e.capabilities.includes(t) || e.capabilities.push(t));
59
- }, y = {
59
+ }, L = {
60
60
  IDLE: "idle",
61
61
  LOADING: "loading",
62
62
  SUCCESS: "success",
63
63
  /** Successful request with zero hits. */
64
64
  EMPTY: "empty",
65
65
  ERROR: "error"
66
- }, Ie = 0.5, Re = 500, Te = 1500, ke = 100;
67
- function ye({ emit: t, visibilityThreshold: e = Ie, dwellMs: o = Re, idleFlushMs: s = Te, maxItemsPerEvent: i = ke }) {
68
- let r, n = [];
69
- const a = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
70
- let l;
71
- const h = () => {
72
- clearTimeout(l), !(r === void 0 || n.length === 0) && (t({ ...r, items: n }), n = []);
73
- }, S = (f) => {
74
- if (r === void 0)
66
+ }, He = 0.5, Ve = 500, Be = 1500, Ke = 100;
67
+ function Fe({ emit: t, visibilityThreshold: e = He, dwellMs: s = Ve, idleFlushMs: o = Be, maxItemsPerEvent: r = Ke }) {
68
+ let n, i = [];
69
+ const a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
70
+ let d;
71
+ const g = () => {
72
+ clearTimeout(d), !(n === void 0 || i.length === 0) && (t({ ...n, items: i }), i = []);
73
+ }, y = (m) => {
74
+ if (n === void 0)
75
75
  return;
76
- const g = `${r.query_id}:${f.product_id}`;
77
- if (!a.has(g)) {
78
- if (a.add(g), n.push(f), n.length >= i) {
79
- h();
76
+ const v = `${n.query_id}:${m.product_id}`;
77
+ if (!a.has(v)) {
78
+ if (a.add(v), i.push(m), i.length >= r) {
79
+ g();
80
80
  return;
81
81
  }
82
- clearTimeout(l), l = setTimeout(h, s);
82
+ clearTimeout(d), d = setTimeout(g, o);
83
83
  }
84
- }, w = (f) => {
85
- const g = c.get(f);
86
- g !== void 0 && (clearTimeout(g), c.delete(f));
87
- }, d = new IntersectionObserver((f) => {
88
- for (const g of f) {
89
- const m = p.get(g.target);
90
- m !== void 0 && (g.intersectionRatio >= e ? c.has(g.target) || c.set(g.target, setTimeout(() => {
91
- c.delete(g.target), S(m);
92
- }, o)) : w(g.target));
84
+ }, S = (m) => {
85
+ const v = c.get(m);
86
+ v !== void 0 && (clearTimeout(v), c.delete(m));
87
+ }, f = new IntersectionObserver((m) => {
88
+ for (const v of m) {
89
+ const p = h.get(v.target);
90
+ p !== void 0 && (v.intersectionRatio >= e ? c.has(v.target) || c.set(v.target, setTimeout(() => {
91
+ c.delete(v.target), y(p);
92
+ }, s)) : S(v.target));
93
93
  }
94
- }, { threshold: e }), b = () => {
95
- d.disconnect();
96
- for (const f of c.values())
97
- clearTimeout(f);
98
- c.clear(), p.clear();
99
- }, C = () => {
100
- h();
101
- }, I = (f) => {
102
- if (f.persisted) {
94
+ }, { threshold: e }), I = () => {
95
+ f.disconnect();
96
+ for (const m of c.values())
97
+ clearTimeout(m);
98
+ c.clear(), h.clear();
99
+ }, $ = () => {
100
+ g();
101
+ }, R = (m) => {
102
+ if (m.persisted) {
103
103
  a.clear();
104
- for (const g of p.keys())
105
- w(g), d.unobserve(g), d.observe(g);
104
+ for (const v of h.keys())
105
+ S(v), f.unobserve(v), f.observe(v);
106
106
  }
107
107
  };
108
- return window.addEventListener("pagehide", C), window.addEventListener("pageshow", I), {
109
- setContext(f) {
110
- h(), a.clear(), r = f, b();
108
+ return window.addEventListener("pagehide", $), window.addEventListener("pageshow", R), {
109
+ setContext(m) {
110
+ g(), a.clear(), n = m, I();
111
111
  },
112
- observe(f, g) {
113
- p.set(f, g), d.observe(f);
112
+ observe(m, v) {
113
+ h.set(m, v), f.observe(m);
114
114
  },
115
- forceImpression(f) {
116
- S(f), h();
115
+ forceImpression(m) {
116
+ y(m), g();
117
117
  },
118
- flush: h,
118
+ flush: g,
119
119
  disconnect() {
120
- h(), b(), window.removeEventListener("pagehide", C), window.removeEventListener("pageshow", I);
120
+ g(), I(), window.removeEventListener("pagehide", $), window.removeEventListener("pageshow", R);
121
121
  }
122
122
  };
123
123
  }
124
- const Y = (t, e) => ({
124
+ const te = (t, e) => ({
125
125
  product_id: t.hits[e].objectID,
126
126
  // One-based position across all pages.
127
127
  position: t.page * t.hitsPerPage + e + 1
128
128
  });
129
- function $e(t) {
130
- let e, o;
131
- const s = () => (e ?? (e = ye({
129
+ function ze(t) {
130
+ let e, s;
131
+ const o = () => (e ?? (e = Fe({
132
132
  emit: t.trackViewSearchResults
133
133
  })), e);
134
134
  return {
135
- onResponse(i) {
136
- o = {
137
- query_id: i.queryID,
138
- index: i.index,
135
+ onResponse(r) {
136
+ s = {
137
+ query_id: r.queryID,
138
+ index: r.index,
139
139
  surface: t.surface,
140
140
  search_type: "lexical",
141
141
  // Convert the API page to one-based analytics numbering.
142
- page: i.page + 1,
143
- total_hits: i.nbHits,
144
- query_length: [...i.query].length
145
- }, s().setContext(o), i.nbHits === 0 && t.trackViewSearchResults({ ...o, items: [] });
142
+ page: r.page + 1,
143
+ total_hits: r.nbHits,
144
+ query_length: [...r.query].length
145
+ }, o().setContext(s), r.nbHits === 0 && t.trackViewSearchResults({ ...s, items: [] });
146
146
  },
147
- observeResult(i, r, n) {
148
- s().observe(i, Y(r, n));
147
+ observeResult(r, n, i) {
148
+ o().observe(r, te(n, i));
149
149
  },
150
- select(i, r) {
151
- if (o === void 0)
150
+ select(r, n) {
151
+ if (s === void 0)
152
152
  return;
153
- const n = Y(i, r);
154
- s().forceImpression(n), t.trackSelectSearchResult({ ...o, items: [n] });
153
+ const i = te(r, n);
154
+ o().forceImpression(i), t.trackSelectSearchResult({ ...s, items: [i] });
155
155
  },
156
156
  dispose() {
157
157
  e == null || e.disconnect();
158
158
  }
159
159
  };
160
160
  }
161
- const Ae = 2, X = (t) => {
161
+ const je = 2, se = (t) => {
162
162
  const e = t.trim();
163
- return [...e].length >= Ae ? e : void 0;
164
- }, Le = (t, e, o, { indexName: s, language: i, currency: r, hitsPerPage: n }) => ({
163
+ return [...e].length >= je ? e : void 0;
164
+ }, Ge = (t, e, s, { indexName: o, language: r, currency: n, hitsPerPage: i }) => ({
165
165
  requests: [
166
- { indexName: s, query: t, page: e, hitsPerPage: n },
167
- ...o.map((a) => ({
168
- indexName: j(a.index, i, r),
166
+ { indexName: o, query: t, page: e, hitsPerPage: i },
167
+ ...s.map((a) => ({
168
+ indexName: X(a.index, r, n),
169
169
  query: t,
170
170
  page: 0,
171
- hitsPerPage: a.hitsPerPage ?? n
171
+ hitsPerPage: a.hitsPerPage ?? i
172
172
  }))
173
173
  ]
174
- }), De = (t, e, { indexName: o, language: s, currency: i }) => {
175
- const r = t.results.find((a) => a.index === o);
176
- if (r === void 0)
177
- throw new Error(`Dialog search returned no ${o} entry`);
178
- const n = {};
174
+ }), We = (t, e, { indexName: s, language: o, currency: r }) => {
175
+ const n = t.results.find((a) => a.index === s);
176
+ if (n === void 0)
177
+ throw new Error(`Dialog search returned no ${s} entry`);
178
+ const i = {};
179
179
  for (const a of e) {
180
- const p = j(a.index, s, i), c = t.results.find((l) => l.index === p);
181
- c !== void 0 && (n[a.index] = c);
180
+ const h = X(a.index, o, r), c = t.results.find((d) => d.index === h);
181
+ c !== void 0 && (i[a.index] = c);
182
182
  }
183
183
  return {
184
- response: r,
185
- sections: e.length === 0 ? void 0 : n
184
+ response: n,
185
+ sections: e.length === 0 ? void 0 : i
186
186
  };
187
- }, F = {
188
- status: y.IDLE,
187
+ }, j = {
188
+ status: L.IDLE,
189
189
  query: "",
190
190
  page: 0,
191
191
  response: void 0,
192
192
  sections: void 0,
193
193
  error: void 0
194
194
  };
195
- function Pe({ search: t, language: e, currency: o, analytics: s, navigate: i, debounceMs: r = 250, hitsPerPage: n = 12, sections: a = [] }) {
196
- const p = {
197
- indexName: j("products", e, o),
195
+ function Qe({ search: t, language: e, currency: s, analytics: o, navigate: r, debounceMs: n = 250, hitsPerPage: i = 12, sections: a = [] }) {
196
+ const h = {
197
+ indexName: X("products", e, s),
198
198
  language: e,
199
- currency: o,
200
- hitsPerPage: n
199
+ currency: s,
200
+ hitsPerPage: i
201
201
  };
202
- let c = F;
203
- const l = /* @__PURE__ */ new Set(), h = $e(s);
204
- let S, w, d, b = 0, C = !1;
205
- const I = (m) => {
206
- c = { ...c, ...m };
207
- for (const E of l)
208
- E(c);
209
- }, f = () => {
210
- clearTimeout(S), w = void 0, b += 1, d == null || d.abort(), d = void 0;
211
- }, g = async (m, E) => {
212
- f(), d = new AbortController();
213
- const D = b;
214
- I({ status: y.LOADING, query: m, page: E });
202
+ let c = j;
203
+ const d = /* @__PURE__ */ new Set(), g = ze(o);
204
+ let y, S, f, I = 0, $ = !1;
205
+ const R = (p) => {
206
+ c = { ...c, ...p };
207
+ for (const C of d)
208
+ C(c);
209
+ }, m = () => {
210
+ clearTimeout(y), S = void 0, I += 1, f == null || f.abort(), f = void 0;
211
+ }, v = async (p, C) => {
212
+ m(), f = new AbortController();
213
+ const P = I;
214
+ R({ status: L.LOADING, query: p, page: C });
215
215
  try {
216
- const A = typeof a == "function" ? a() : a, Q = Le(m, E, A, p), ie = await t(Q, {
217
- signal: d.signal
216
+ const x = typeof a == "function" ? a() : a, Y = Ge(p, C, x, h), Se = await t(Y, {
217
+ signal: f.signal
218
218
  });
219
- if (D !== b)
219
+ if (P !== I)
220
220
  return;
221
- const K = De(ie, A, p);
222
- h.onResponse(K.response), I({
223
- ...K,
224
- status: K.response.nbHits === 0 ? y.EMPTY : y.SUCCESS,
221
+ const F = We(Se, x, h);
222
+ g.onResponse(F.response), R({
223
+ ...F,
224
+ status: F.response.nbHits === 0 ? L.EMPTY : L.SUCCESS,
225
225
  error: void 0
226
226
  });
227
- } catch (A) {
228
- if (A instanceof DOMException && A.name === "AbortError" || D !== b)
227
+ } catch (x) {
228
+ if (x instanceof DOMException && x.name === "AbortError" || P !== I)
229
229
  return;
230
- I({
231
- status: y.ERROR,
232
- error: A,
230
+ R({
231
+ status: L.ERROR,
232
+ error: x,
233
233
  response: void 0,
234
234
  sections: void 0
235
235
  });
236
236
  }
237
237
  };
238
238
  return {
239
- setQuery(m) {
240
- if (C)
239
+ setQuery(p) {
240
+ if ($)
241
241
  return;
242
- f();
243
- const E = X(m);
244
- if (E === void 0) {
245
- I(F);
242
+ m();
243
+ const C = se(p);
244
+ if (C === void 0) {
245
+ R(j);
246
246
  return;
247
247
  }
248
- w = E, S = setTimeout(() => void g(E, 0), r);
248
+ S = C, y = setTimeout(() => void v(C, 0), n);
249
249
  },
250
- submit(m) {
251
- if (C)
250
+ submit(p) {
251
+ if ($)
252
252
  return;
253
- f();
254
- const E = X(m);
255
- if (E === void 0) {
256
- I(F);
253
+ m();
254
+ const C = se(p);
255
+ if (C === void 0) {
256
+ R(j);
257
257
  return;
258
258
  }
259
- g(E, 0);
259
+ v(C, 0);
260
260
  },
261
- setPage(m) {
262
- if (!C) {
263
- if (w !== void 0) {
264
- g(w, 0);
261
+ setPage(p) {
262
+ if (!$) {
263
+ if (S !== void 0) {
264
+ v(S, 0);
265
265
  return;
266
266
  }
267
- c.query !== "" && g(c.query, m);
267
+ c.query !== "" && v(c.query, p);
268
268
  }
269
269
  },
270
270
  retry() {
271
- C || c.status !== y.ERROR || g(c.query, c.page);
271
+ $ || c.status !== L.ERROR || v(c.query, c.page);
272
272
  },
273
- observeResult(m, E) {
274
- c.response !== void 0 && h.observeResult(m, c.response, E);
273
+ observeResult(p, C) {
274
+ c.response !== void 0 && g.observeResult(p, c.response, C);
275
275
  },
276
- selectResult(m, E) {
277
- const D = c.response;
278
- if (D === void 0)
276
+ selectResult(p, C) {
277
+ const P = c.response;
278
+ if (P === void 0)
279
279
  return !1;
280
- h.select(D, m);
281
- const A = D.hits[m].url;
282
- return ((E == null ? void 0 : E.navigate) ?? !0) && i !== void 0 && A !== void 0 ? (i(A, D.hits[m]), !0) : !1;
280
+ g.select(P, p);
281
+ const x = P.hits[p].url;
282
+ return ((C == null ? void 0 : C.navigate) ?? !0) && r !== void 0 && x !== void 0 ? (r(x, P.hits[p]), !0) : !1;
283
283
  },
284
- subscribe(m) {
285
- return l.add(m), () => {
286
- l.delete(m);
284
+ subscribe(p) {
285
+ return d.add(p), () => {
286
+ d.delete(p);
287
287
  };
288
288
  },
289
289
  getState: () => c,
290
290
  dispose() {
291
- C = !0, f(), l.clear(), h.dispose();
291
+ $ = !0, m(), d.clear(), g.dispose();
292
292
  }
293
293
  };
294
294
  }
295
- const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-block-title" }, Oe = { class: "dialog-block-description" }, Ue = /* @__PURE__ */ R({
295
+ const Xe = { class: "dialog-block-header-container" }, Ye = { class: "dialog-block-title" }, Ze = { class: "dialog-block-description" }, Je = /* @__PURE__ */ w({
296
296
  __name: "DialogBlockHeader",
297
297
  props: {
298
298
  title: {},
@@ -300,32 +300,32 @@ const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-blo
300
300
  },
301
301
  setup(t) {
302
302
  const e = t;
303
- return (o, s) => (_(), v("div", xe, [
304
- u("div", Ne, k(e.title ?? "Your expert"), 1),
305
- u("div", Oe, k(e.description ?? "A question about this product?"), 1)
303
+ return (s, o) => (u(), _("div", Xe, [
304
+ l("div", Ye, E(e.title ?? "Your expert"), 1),
305
+ l("div", Ze, E(e.description ?? "A question about this product?"), 1)
306
306
  ]));
307
307
  }
308
- }), P = (t, e) => {
309
- const o = t.__vccOpts || t;
310
- for (const [s, i] of e)
311
- o[s] = i;
312
- return o;
313
- }, Me = /* @__PURE__ */ P(Ue, [["__scopeId", "data-v-28e6dda7"]]), qe = {
308
+ }), D = (t, e) => {
309
+ const s = t.__vccOpts || t;
310
+ for (const [o, r] of e)
311
+ s[o] = r;
312
+ return s;
313
+ }, et = /* @__PURE__ */ D(Je, [["__scopeId", "data-v-28e6dda7"]]), tt = {
314
314
  width: "20",
315
315
  height: "20",
316
316
  viewBox: "0 0 20 20",
317
317
  fill: "none",
318
318
  xmlns: "http://www.w3.org/2000/svg"
319
- }, Be = { "clip-path": "url(#clip0_466_934)" }, Ve = ["stroke"], Ke = ["stroke"], He = /* @__PURE__ */ R({
319
+ }, st = { "clip-path": "url(#clip0_466_934)" }, ot = ["stroke"], nt = ["stroke"], rt = /* @__PURE__ */ w({
320
320
  __name: "AiStarsIcon",
321
321
  props: {
322
322
  color: {}
323
323
  },
324
324
  setup(t) {
325
325
  const e = t;
326
- return (o, s) => (_(), v("svg", qe, [
327
- u("g", Be, [
328
- u("path", {
326
+ return (s, o) => (u(), _("svg", tt, [
327
+ l("g", st, [
328
+ l("path", {
329
329
  d: `M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
330
330
  12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
331
331
  13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
@@ -340,8 +340,8 @@ const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-blo
340
340
  "stroke-width": "1.5",
341
341
  "stroke-linecap": "round",
342
342
  "stroke-linejoin": "round"
343
- }, null, 8, Ve),
344
- u("path", {
343
+ }, null, 8, ot),
344
+ l("path", {
345
345
  d: `M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
346
346
  5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
347
347
  6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
@@ -356,11 +356,11 @@ const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-blo
356
356
  "stroke-width": "1.5",
357
357
  "stroke-linecap": "round",
358
358
  "stroke-linejoin": "round"
359
- }, null, 8, Ke)
359
+ }, null, 8, nt)
360
360
  ]),
361
- s[0] || (s[0] = u("defs", null, [
362
- u("clipPath", { id: "clip0_466_934" }, [
363
- u("rect", {
361
+ o[0] || (o[0] = l("defs", null, [
362
+ l("clipPath", { id: "clip0_466_934" }, [
363
+ l("rect", {
364
364
  width: "20",
365
365
  height: "20",
366
366
  fill: "white"
@@ -369,7 +369,7 @@ const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-blo
369
369
  ], -1))
370
370
  ]));
371
371
  }
372
- }), Fe = ["onClick"], Ge = { class: "dialog-block-suggestions-item-label" }, je = /* @__PURE__ */ R({
372
+ }), at = ["onClick"], it = { class: "dialog-block-suggestions-item-label" }, lt = /* @__PURE__ */ w({
373
373
  __name: "DialogBlockSuggestions",
374
374
  props: {
375
375
  client: {},
@@ -379,36 +379,36 @@ const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-blo
379
379
  selectedVariantId: {}
380
380
  },
381
381
  setup(t) {
382
- const e = t, o = (s) => {
382
+ const e = t, s = (o) => {
383
383
  e.client.sendProductMessage({
384
384
  productId: e.productId,
385
385
  productTitle: e.productTitle,
386
386
  selectedVariantId: e.selectedVariantId,
387
- question: s,
387
+ question: o,
388
388
  fromQuestionSuggestion: !0
389
389
  });
390
390
  };
391
- return (s, i) => (_(!0), v(N, null, ee(e.questions, (r) => (_(), v("button", {
392
- key: r.question,
391
+ return (o, r) => (u(!0), _(N, null, Q(e.questions, (n) => (u(), _("button", {
392
+ key: n.question,
393
393
  class: "dialog-block-suggestions-item",
394
- onClick: (n) => o(r.question)
394
+ onClick: (i) => s(n.question)
395
395
  }, [
396
- L(He, {
396
+ T(rt, {
397
397
  class: "dialog-block-suggestions-item-icon",
398
398
  color: e.client.theme.primaryColor
399
399
  }, null, 8, ["color"]),
400
- u("span", Ge, k(r.question), 1)
401
- ], 8, Fe))), 128));
400
+ l("span", it, E(n.question), 1)
401
+ ], 8, at))), 128));
402
402
  }
403
- }), Qe = /* @__PURE__ */ P(je, [["__scopeId", "data-v-db34d4b4"]]), ze = {};
404
- function We(t, e) {
405
- return _(), v(N, null, [
406
- e[0] || (e[0] = u("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
407
- e[1] || (e[1] = u("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
408
- e[2] || (e[2] = u("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
403
+ }), ct = /* @__PURE__ */ D(lt, [["__scopeId", "data-v-db34d4b4"]]), ut = {};
404
+ function dt(t, e) {
405
+ return u(), _(N, null, [
406
+ e[0] || (e[0] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
407
+ e[1] || (e[1] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
408
+ e[2] || (e[2] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
409
409
  ], 64);
410
410
  }
411
- const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58"]]), Xe = { class: "dialog-block-suggestions-container" }, Ze = /* @__PURE__ */ R({
411
+ const pt = /* @__PURE__ */ D(ut, [["render", dt], ["__scopeId", "data-v-26a64b58"]]), ht = { class: "dialog-block-suggestions-container" }, _t = /* @__PURE__ */ w({
412
412
  __name: "DialogBlockSuggestionsContainer",
413
413
  props: {
414
414
  client: {},
@@ -420,8 +420,8 @@ const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58
420
420
  },
421
421
  setup(t) {
422
422
  const e = t;
423
- return (o, s) => (_(), v("div", Xe, [
424
- e.isLoading || !e.questions ? (_(), O(Ye, { key: 0 })) : (_(), O(Qe, {
423
+ return (s, o) => (u(), _("div", ht, [
424
+ e.isLoading || !e.questions ? (u(), O(pt, { key: 0 })) : (u(), O(ct, {
425
425
  key: 1,
426
426
  client: e.client,
427
427
  questions: e.questions,
@@ -431,30 +431,50 @@ const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58
431
431
  }, null, 8, ["client", "questions", "product-id", "product-title", "selected-variant-id"]))
432
432
  ]));
433
433
  }
434
- }), Je = /* @__PURE__ */ P(Ze, [["__scopeId", "data-v-18c9e78b"]]), et = {
434
+ }), gt = /* @__PURE__ */ D(_t, [["__scopeId", "data-v-18c9e78b"]]), ft = {
435
435
  width: "20",
436
436
  height: "20",
437
437
  viewBox: "0 0 20 20",
438
438
  fill: "none",
439
439
  xmlns: "http://www.w3.org/2000/svg"
440
- }, tt = ["stroke"], ot = /* @__PURE__ */ R({
440
+ }, vt = ["stroke"], mt = /* @__PURE__ */ w({
441
441
  __name: "ArrowIcon",
442
442
  props: {
443
443
  color: {}
444
444
  },
445
445
  setup(t) {
446
446
  const e = t;
447
- return (o, s) => (_(), v("svg", et, [
448
- u("path", {
447
+ return (s, o) => (u(), _("svg", ft, [
448
+ l("path", {
449
449
  d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
450
450
  stroke: e.color || "#ffffff",
451
451
  "stroke-width": "1.5",
452
452
  "stroke-linecap": "round",
453
453
  "stroke-linejoin": "round"
454
- }, null, 8, tt)
454
+ }, null, 8, vt)
455
455
  ]));
456
456
  }
457
- }), st = ["placeholder"], nt = ["disabled"], rt = /* @__PURE__ */ R({
457
+ }), oe = {
458
+ en: {
459
+ placeholder: "Ask the AI a question",
460
+ aiDisclosure: "You're chatting with an AI assistant. It can make mistakes, so please double-check important information"
461
+ },
462
+ fr: {
463
+ placeholder: "Posez une question à l'IA",
464
+ aiDisclosure: "Vous discutez avec un assistant IA. Il peut se tromper, pensez à vérifier les informations importantes"
465
+ },
466
+ es: {
467
+ placeholder: "Haz una pregunta a la IA",
468
+ aiDisclosure: "Estás chateando con un asistente de IA. Puede cometer errores, así que verifica la información importante"
469
+ }
470
+ }, bt = (t) => {
471
+ var s;
472
+ const e = ((s = t == null ? void 0 : t.split("-")[0]) == null ? void 0 : s.toLowerCase()) ?? "en";
473
+ return oe[e] ?? oe.en;
474
+ }, St = { class: "dialog-input-container" }, Ct = ["placeholder"], yt = ["disabled"], Et = {
475
+ id: "dialog-input-ai-disclosure",
476
+ class: "dialog-input-ai-disclosure"
477
+ }, wt = /* @__PURE__ */ w({
458
478
  __name: "DialogInput",
459
479
  props: {
460
480
  client: {},
@@ -464,93 +484,97 @@ const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58
464
484
  selectedVariantId: {}
465
485
  },
466
486
  setup(t) {
467
- const e = t, o = $(), s = $(""), i = () => {
468
- var n;
469
- (n = o.value) == null || n.focus();
470
- }, r = () => {
471
- const n = s.value;
472
- n.trim() && (e.client.sendProductMessage({
487
+ const e = t, s = k(), o = k(""), r = b(() => bt(e.client.locale)), n = () => {
488
+ var a;
489
+ (a = s.value) == null || a.focus();
490
+ }, i = () => {
491
+ const a = o.value;
492
+ a.trim() && (e.client.sendProductMessage({
473
493
  productId: e.productId,
474
494
  productTitle: e.productTitle,
475
495
  selectedVariantId: e.selectedVariantId,
476
- question: n,
496
+ question: a,
477
497
  fromQuestionSuggestion: !0
478
- }), s.value = "");
498
+ }), o.value = "");
479
499
  };
480
- return (n, a) => (_(), v("div", {
481
- class: "dialog-input-wrapper",
482
- onClick: i
483
- }, [
484
- te(u("input", {
485
- id: "dialog-ask-anything-input-ai-input",
486
- ref_key: "inputRef",
487
- ref: o,
488
- "onUpdate:modelValue": a[0] || (a[0] = (p) => s.value = p),
489
- class: "dialog-ask-anything-input-ai-input",
490
- placeholder: e.placeholder ?? "Ask anything...",
491
- onKeydown: le(r, ["enter"])
492
- }, null, 40, st), [
493
- [oe, s.value]
494
- ]),
495
- u("button", {
496
- id: "send-message-button-ai-input",
497
- class: "dialog-input-submit",
498
- disabled: !s.value.trim(),
499
- onClick: r
500
+ return (a, h) => (u(), _("div", St, [
501
+ l("div", {
502
+ class: "dialog-input-wrapper",
503
+ onClick: n
500
504
  }, [
501
- L(ot, {
502
- color: e.client.theme.ctaTextColor
503
- }, null, 8, ["color"])
504
- ], 8, nt)
505
+ ae(l("input", {
506
+ id: "dialog-ask-anything-input-ai-input",
507
+ ref_key: "inputRef",
508
+ ref: s,
509
+ "onUpdate:modelValue": h[0] || (h[0] = (c) => o.value = c),
510
+ class: "dialog-ask-anything-input-ai-input",
511
+ placeholder: r.value.placeholder,
512
+ "aria-describedby": "dialog-input-ai-disclosure",
513
+ onKeydown: Ee(i, ["enter"])
514
+ }, null, 40, Ct), [
515
+ [ie, o.value]
516
+ ]),
517
+ l("button", {
518
+ id: "send-message-button-ai-input",
519
+ class: "dialog-input-submit",
520
+ disabled: !o.value.trim(),
521
+ onClick: i
522
+ }, [
523
+ T(mt, {
524
+ color: e.client.theme.ctaTextColor
525
+ }, null, 8, ["color"])
526
+ ], 8, yt)
527
+ ]),
528
+ l("p", Et, E(r.value.aiDisclosure), 1)
505
529
  ]));
506
530
  }
507
- }), it = /* @__PURE__ */ P(rt, [["__scopeId", "data-v-4f5901c9"]]), at = /* @__PURE__ */ R({
531
+ }), It = /* @__PURE__ */ D(wt, [["__scopeId", "data-v-87013888"]]), $t = /* @__PURE__ */ w({
508
532
  __name: "ThemeProvider",
509
533
  props: {
510
534
  theme: {}
511
535
  },
512
536
  setup(t) {
513
- const e = t, o = document.body, s = (r) => r.replace(/([A-Z])/g, "-$1").toLowerCase(), i = (r) => {
514
- r && Object.keys(r).forEach((n) => {
515
- const a = n, p = s(n);
516
- if (r[a] !== void 0) {
517
- if (typeof r[a] == "object") {
518
- Object.keys(r[a]).forEach((c) => {
519
- var h;
520
- const l = c;
521
- if (l !== void 0) {
522
- const S = s(c), w = r[a];
523
- o.style.setProperty(
524
- `--dialog-theme-${p}-${S}`,
525
- (h = w[l]) == null ? void 0 : h.toString()
537
+ const e = t, s = document.body, o = (n) => n.replace(/([A-Z])/g, "-$1").toLowerCase(), r = (n) => {
538
+ n && Object.keys(n).forEach((i) => {
539
+ const a = i, h = o(i);
540
+ if (n[a] !== void 0) {
541
+ if (typeof n[a] == "object") {
542
+ Object.keys(n[a]).forEach((c) => {
543
+ var g;
544
+ const d = c;
545
+ if (d !== void 0) {
546
+ const y = o(c), S = n[a];
547
+ s.style.setProperty(
548
+ `--dialog-theme-${h}-${y}`,
549
+ (g = S[d]) == null ? void 0 : g.toString()
526
550
  );
527
551
  }
528
552
  });
529
553
  return;
530
554
  }
531
555
  if (a === "ctaBorderType") {
532
- const c = r[a] === "rounded" ? "24px" : "0";
533
- o.style.setProperty(`--dialog-theme-${p}`, c);
556
+ const c = n[a] === "rounded" ? "24px" : "0";
557
+ s.style.setProperty(`--dialog-theme-${h}`, c);
534
558
  return;
535
559
  }
536
- o.style.setProperty(
537
- `--dialog-theme-${p}`,
538
- r[a].toString()
560
+ s.style.setProperty(
561
+ `--dialog-theme-${h}`,
562
+ n[a].toString()
539
563
  );
540
564
  }
541
565
  });
542
566
  };
543
- return V(() => {
544
- e.theme && i(e.theme);
545
- }), U(
567
+ return B(() => {
568
+ e.theme && r(e.theme);
569
+ }), M(
546
570
  () => e.theme,
547
- (r) => {
548
- r && i(r);
571
+ (n) => {
572
+ n && r(n);
549
573
  },
550
574
  { deep: !0 }
551
- ), (r, n) => de(r.$slots, "default");
575
+ ), (n, i) => we(n.$slots, "default");
552
576
  }
553
- }), ct = ["dir"], lt = /* @__PURE__ */ R({
577
+ }), Rt = ["dir"], Tt = /* @__PURE__ */ w({
554
578
  __name: "DialogProductBlock",
555
579
  props: {
556
580
  client: {},
@@ -561,84 +585,84 @@ const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58
561
585
  },
562
586
  setup(t) {
563
587
  const e = t;
564
- V(() => {
565
- re({
588
+ B(() => {
589
+ pe({
566
590
  method: "vue",
567
- version: "3.6.0"
568
- }), we("pdp-block");
591
+ version: "3.8.0"
592
+ }), Ue("pdp-block");
569
593
  });
570
- const o = $(!0), s = $(void 0), i = $(0), r = T(() => {
571
- var l;
572
- return o.value ? "" : (l = s.value) == null ? void 0 : l.assistantName;
573
- }), n = T(() => {
574
- var l;
575
- return o.value ? "" : (l = s.value) == null ? void 0 : l.description;
576
- }), a = T(() => {
577
- var l;
578
- return o.value ? "" : (l = s.value) == null ? void 0 : l.inputPlaceholder;
579
- }), p = T(
594
+ const s = k(!0), o = k(void 0), r = k(0), n = b(() => {
595
+ var d;
596
+ return s.value ? "" : (d = o.value) == null ? void 0 : d.assistantName;
597
+ }), i = b(() => {
598
+ var d;
599
+ return s.value ? "" : (d = o.value) == null ? void 0 : d.description;
600
+ }), a = b(() => {
601
+ var d;
602
+ return s.value ? "" : (d = o.value) == null ? void 0 : d.inputPlaceholder;
603
+ }), h = b(
580
604
  () => {
581
- var l;
582
- return me(
583
- (l = e.client.getLocalizationInformations()) == null ? void 0 : l.languageCode
605
+ var d;
606
+ return Pe(
607
+ (d = e.client.getLocalizationInformations()) == null ? void 0 : d.languageCode
584
608
  );
585
609
  }
586
610
  ), c = async () => {
587
- const l = ++i.value;
588
- o.value = !0, s.value = void 0;
611
+ const d = ++r.value;
612
+ s.value = !0, o.value = void 0;
589
613
  try {
590
- const h = await e.client.getSuggestions(e.productId);
591
- l === i.value && (s.value = h);
592
- } catch (h) {
593
- console.error("error", h);
614
+ const g = await e.client.getSuggestions(e.productId);
615
+ d === r.value && (o.value = g);
616
+ } catch (g) {
617
+ console.error("error", g);
594
618
  } finally {
595
- l === i.value && (o.value = !1);
619
+ d === r.value && (s.value = !1);
596
620
  }
597
621
  };
598
- return U(
622
+ return M(
599
623
  () => [e.client, e.productId],
600
624
  () => {
601
625
  c();
602
626
  },
603
627
  { immediate: !0 }
604
- ), (l, h) => (_(), O(at, {
628
+ ), (d, g) => (u(), O($t, {
605
629
  theme: e.client.theme
606
630
  }, {
607
- default: ue(() => {
608
- var S;
631
+ default: le(() => {
632
+ var y;
609
633
  return [
610
- u("div", {
634
+ l("div", {
611
635
  id: "dialog-instant",
612
636
  class: "dialog-block-container",
613
- dir: p.value
637
+ dir: h.value
614
638
  }, [
615
- L(Me, {
616
- title: r.value,
617
- description: n.value
639
+ T(et, {
640
+ title: n.value,
641
+ description: i.value
618
642
  }, null, 8, ["title", "description"]),
619
- L(Je, {
643
+ T(gt, {
620
644
  client: e.client,
621
- questions: (S = s.value) == null ? void 0 : S.questions,
622
- "is-loading": o.value,
645
+ questions: (y = o.value) == null ? void 0 : y.questions,
646
+ "is-loading": s.value,
623
647
  "product-id": e.productId,
624
648
  "product-title": e.productTitle,
625
649
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
626
650
  }, null, 8, ["client", "questions", "is-loading", "product-id", "product-title", "selected-variant-id"]),
627
- e.enableInput ? (_(), O(it, {
651
+ e.enableInput ? (u(), O(It, {
628
652
  key: 0,
629
653
  client: e.client,
630
654
  placeholder: a.value,
631
655
  "product-id": e.productId,
632
656
  "product-title": e.productTitle,
633
657
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
634
- }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : M("", !0)
635
- ], 8, ct)
658
+ }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : A("", !0)
659
+ ], 8, Rt)
636
660
  ];
637
661
  }),
638
662
  _: 1
639
663
  }, 8, ["theme"]));
640
664
  }
641
- }), zt = /* @__PURE__ */ P(lt, [["__scopeId", "data-v-c57aa677"]]), dt = {}, ut = {
665
+ }), so = /* @__PURE__ */ D(Tt, [["__scopeId", "data-v-c57aa677"]]), kt = {}, At = {
642
666
  width: "16",
643
667
  height: "16",
644
668
  viewBox: "0 0 16 16",
@@ -646,9 +670,9 @@ const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58
646
670
  xmlns: "http://www.w3.org/2000/svg",
647
671
  "aria-hidden": "true"
648
672
  };
649
- function pt(t, e) {
650
- return _(), v("svg", ut, e[0] || (e[0] = [
651
- u("path", {
673
+ function Lt(t, e) {
674
+ return u(), _("svg", At, e[0] || (e[0] = [
675
+ l("path", {
652
676
  d: "M8 13V3M8 3L3 8M8 3L13 8",
653
677
  stroke: "currentColor",
654
678
  "stroke-width": "1.5",
@@ -657,28 +681,28 @@ function pt(t, e) {
657
681
  }, null, -1)
658
682
  ]));
659
683
  }
660
- const _t = /* @__PURE__ */ P(dt, [["render", pt]]), ht = {
684
+ const xt = /* @__PURE__ */ D(kt, [["render", Lt]]), Dt = {
661
685
  width: "16",
662
686
  height: "16",
663
687
  viewBox: "0 0 12 12",
664
688
  fill: "none",
665
689
  xmlns: "http://www.w3.org/2000/svg",
666
690
  "aria-hidden": "true"
667
- }, ft = ["fill"], gt = "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", vt = /* @__PURE__ */ R({
691
+ }, Pt = ["fill"], Ot = "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", Nt = /* @__PURE__ */ w({
668
692
  __name: "ShurikenIcon",
669
693
  props: {
670
694
  color: {}
671
695
  },
672
696
  setup(t) {
673
697
  const e = t;
674
- return (o, s) => (_(), v("svg", ht, [
675
- u("path", {
676
- d: gt,
698
+ return (s, o) => (u(), _("svg", Dt, [
699
+ l("path", {
700
+ d: Ot,
677
701
  fill: e.color || "currentColor"
678
- }, null, 8, ft)
702
+ }, null, 8, Pt)
679
703
  ]));
680
704
  }
681
- }), mt = { class: "dialog-search-bar-field" }, St = { class: "dialog-search-bar-icon" }, bt = ["aria-label", "placeholder", "autofocus"], Ct = ["aria-label"], Wt = /* @__PURE__ */ R({
705
+ }), qt = { class: "dialog-search-bar-field" }, Mt = { class: "dialog-search-bar-icon" }, Ut = ["aria-label", "placeholder", "autofocus"], Ht = ["aria-label"], oo = /* @__PURE__ */ w({
682
706
  __name: "DialogSearchBar",
683
707
  props: {
684
708
  controller: {},
@@ -687,345 +711,684 @@ const _t = /* @__PURE__ */ P(dt, [["render", pt]]), ht = {
687
711
  submitAriaLabel: { default: "Search" }
688
712
  },
689
713
  setup(t) {
690
- const e = t, o = $(""), s = () => {
691
- e.controller.setQuery(o.value);
692
- }, i = () => {
693
- e.controller.submit(o.value);
714
+ const e = t, s = k(""), o = () => {
715
+ e.controller.setQuery(s.value);
716
+ }, r = () => {
717
+ e.controller.submit(s.value);
694
718
  };
695
- return (r, n) => (_(), v("form", {
719
+ return (n, i) => (u(), _("form", {
696
720
  class: "dialog-search-bar",
697
721
  role: "search",
698
- onSubmit: pe(i, ["prevent"])
722
+ onSubmit: Ie(r, ["prevent"])
699
723
  }, [
700
- u("div", mt, [
701
- u("span", St, [
702
- L(vt)
724
+ l("div", qt, [
725
+ l("span", Mt, [
726
+ T(Nt)
703
727
  ]),
704
- te(u("input", {
705
- "onUpdate:modelValue": n[0] || (n[0] = (a) => o.value = a),
728
+ ae(l("input", {
729
+ "onUpdate:modelValue": i[0] || (i[0] = (a) => s.value = a),
706
730
  type: "text",
707
731
  name: "dialog-search-query",
708
732
  class: "dialog-search-bar-input",
709
733
  "aria-label": e.placeholder,
710
734
  placeholder: e.placeholder,
711
735
  autofocus: e.autoFocus,
712
- onInput: s
713
- }, null, 40, bt), [
714
- [oe, o.value]
736
+ onInput: o
737
+ }, null, 40, Ut), [
738
+ [ie, s.value]
715
739
  ])
716
740
  ]),
717
- u("button", {
741
+ l("button", {
718
742
  type: "submit",
719
743
  class: "dialog-search-bar-submit",
720
744
  "aria-label": e.submitAriaLabel
721
745
  }, [
722
- L(_t)
723
- ], 8, Ct)
746
+ T(xt)
747
+ ], 8, Ht)
724
748
  ], 32));
725
749
  }
726
- }), Et = {
750
+ }), Vt = (t, e) => {
751
+ try {
752
+ return new Intl.NumberFormat(e).format(t);
753
+ } catch {
754
+ return String(t);
755
+ }
756
+ }, ne = {
757
+ en: (t) => ({
758
+ searching: (e) => `Searching “${e}”…`,
759
+ noResults: "No matching products",
760
+ retry: "Retry",
761
+ collectionsLabel: "Collections",
762
+ productsLabel: "Products",
763
+ collectionsCount: (e) => e === 1 ? "1 collection" : `${t(e)} collections`,
764
+ resultsCount: (e) => e === 1 ? "1 result" : `${t(e)} results`,
765
+ seeAllLabel: (e) => e === 1 ? "See the result" : `See all ${t(e)} results`,
766
+ previous: "Previous",
767
+ next: "Next",
768
+ pageOf: (e, s) => `Page ${t(e)} / ${t(s)}`
769
+ }),
770
+ fr: (t) => ({
771
+ searching: (e) => `Recherche de « ${e} »…`,
772
+ noResults: "Aucun produit correspondant",
773
+ retry: "Réessayer",
774
+ collectionsLabel: "Collections",
775
+ productsLabel: "Produits",
776
+ collectionsCount: (e) => e === 1 ? "1 collection" : `${t(e)} collections`,
777
+ resultsCount: (e) => e === 1 ? "1 résultat" : `${t(e)} résultats`,
778
+ seeAllLabel: (e) => e === 1 ? "Voir le résultat" : `Voir les ${t(e)} résultats`,
779
+ previous: "Précédent",
780
+ next: "Suivant",
781
+ pageOf: (e, s) => `Page ${t(e)} / ${t(s)}`
782
+ }),
783
+ de: (t) => ({
784
+ searching: (e) => `Suche nach „${e}“…`,
785
+ noResults: "Keine passenden Produkte",
786
+ retry: "Erneut versuchen",
787
+ collectionsLabel: "Kollektionen",
788
+ productsLabel: "Produkte",
789
+ collectionsCount: (e) => e === 1 ? "1 Kollektion" : `${t(e)} Kollektionen`,
790
+ resultsCount: (e) => e === 1 ? "1 Ergebnis" : `${t(e)} Ergebnisse`,
791
+ seeAllLabel: (e) => e === 1 ? "Das Ergebnis anzeigen" : `Alle ${t(e)} Ergebnisse anzeigen`,
792
+ previous: "Zurück",
793
+ next: "Weiter",
794
+ pageOf: (e, s) => `Seite ${t(e)} / ${t(s)}`
795
+ }),
796
+ es: (t) => ({
797
+ searching: (e) => `Buscando «${e}»…`,
798
+ noResults: "No hay productos que coincidan",
799
+ retry: "Reintentar",
800
+ collectionsLabel: "Colecciones",
801
+ productsLabel: "Productos",
802
+ collectionsCount: (e) => e === 1 ? "1 colección" : `${t(e)} colecciones`,
803
+ resultsCount: (e) => e === 1 ? "1 resultado" : `${t(e)} resultados`,
804
+ seeAllLabel: (e) => e === 1 ? "Ver el resultado" : `Ver los ${t(e)} resultados`,
805
+ previous: "Anterior",
806
+ next: "Siguiente",
807
+ pageOf: (e, s) => `Página ${t(e)} / ${t(s)}`
808
+ }),
809
+ it: (t) => ({
810
+ searching: (e) => `Ricerca di “${e}”…`,
811
+ noResults: "Nessun prodotto corrispondente",
812
+ retry: "Riprova",
813
+ collectionsLabel: "Collezioni",
814
+ productsLabel: "Prodotti",
815
+ collectionsCount: (e) => e === 1 ? "1 collezione" : `${t(e)} collezioni`,
816
+ resultsCount: (e) => e === 1 ? "1 risultato" : `${t(e)} risultati`,
817
+ seeAllLabel: (e) => e === 1 ? "Vedi il risultato" : `Vedi tutti i ${t(e)} risultati`,
818
+ previous: "Precedente",
819
+ next: "Successivo",
820
+ pageOf: (e, s) => `Pagina ${t(e)} / ${t(s)}`
821
+ })
822
+ }, he = (t) => {
823
+ var o;
824
+ const e = ((o = t == null ? void 0 : t.split("-")[0]) == null ? void 0 : o.toLowerCase()) ?? "en";
825
+ return (ne[e] ?? ne.en)((r) => Vt(r, t));
826
+ }, _e = (t) => t.status !== L.LOADING && t.response !== void 0 && t.response.nbPages > 1, Bt = {
727
827
  key: 0,
728
828
  "aria-label": "Search results pages",
729
829
  class: "dialog-search-pagination"
730
- }, wt = ["disabled"], It = ["disabled"], Rt = /* @__PURE__ */ R({
830
+ }, Kt = ["disabled"], Ft = ["disabled"], zt = /* @__PURE__ */ w({
731
831
  __name: "DialogSearchPagination",
732
832
  props: {
733
833
  controller: {},
734
- state: {}
834
+ state: {},
835
+ locale: {}
735
836
  },
736
837
  setup(t) {
737
- const e = t, o = T(() => e.state.response);
738
- return (s, i) => o.value !== void 0 && o.value.nbPages > 1 ? (_(), v("nav", Et, [
739
- u("button", {
838
+ const e = t, s = b(() => e.state.response), o = b(() => he(e.locale));
839
+ return (r, n) => s.value !== void 0 && K(_e)(e.state) ? (u(), _("nav", Bt, [
840
+ l("button", {
740
841
  type: "button",
741
- disabled: o.value.page === 0,
742
- onClick: i[0] || (i[0] = (r) => e.controller.setPage(o.value.page - 1))
743
- }, " Previous ", 8, wt),
744
- u("span", null, " Page " + k(o.value.page + 1) + " / " + k(o.value.nbPages), 1),
745
- u("button", {
842
+ disabled: s.value.page === 0,
843
+ onClick: n[0] || (n[0] = (i) => e.controller.setPage(s.value.page - 1))
844
+ }, E(o.value.previous), 9, Kt),
845
+ l("span", null, E(o.value.pageOf(s.value.page + 1, s.value.nbPages)), 1),
846
+ l("button", {
746
847
  type: "button",
747
- disabled: o.value.page >= o.value.nbPages - 1,
748
- onClick: i[1] || (i[1] = (r) => e.controller.setPage(o.value.page + 1))
749
- }, " Next ", 8, It)
750
- ])) : M("", !0);
848
+ disabled: s.value.page >= s.value.nbPages - 1,
849
+ onClick: n[1] || (n[1] = (i) => e.controller.setPage(s.value.page + 1))
850
+ }, E(o.value.next), 9, Ft)
851
+ ])) : A("", !0);
852
+ }
853
+ }), re = (t) => t.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/ẞ/gu, "ß").toUpperCase().toLowerCase().replace(/ς/g, "σ"), jt = (t, e) => {
854
+ const s = { before: "", match: t, after: "" }, o = re(e.trim());
855
+ if (o === "")
856
+ return s;
857
+ const r = [...t], n = [];
858
+ let i = "";
859
+ r.forEach((d, g) => {
860
+ const y = re(d);
861
+ for (let S = 0; S < y.length; S += 1)
862
+ n.push(g);
863
+ i += y;
864
+ });
865
+ const a = i.indexOf(o);
866
+ if (a === -1)
867
+ return s;
868
+ const h = n[a], c = n[a + o.length - 1] + 1;
869
+ return {
870
+ before: r.slice(0, h).join(""),
871
+ match: r.slice(h, c).join(""),
872
+ after: r.slice(c).join("")
873
+ };
874
+ }, Gt = {
875
+ key: 0,
876
+ class: "dialog-search-muted"
877
+ }, Wt = { class: "dialog-search-match" }, Qt = {
878
+ key: 1,
879
+ class: "dialog-search-muted"
880
+ }, ge = /* @__PURE__ */ w({
881
+ __name: "HighlightedTitle",
882
+ props: {
883
+ title: {},
884
+ query: {}
885
+ },
886
+ setup(t) {
887
+ const e = t, s = b(() => jt(e.title, e.query));
888
+ return (o, r) => (u(), _(N, null, [
889
+ s.value.before !== "" ? (u(), _("span", Gt, E(s.value.before), 1)) : A("", !0),
890
+ l("span", Wt, E(s.value.match), 1),
891
+ s.value.after !== "" ? (u(), _("span", Qt, E(s.value.after), 1)) : A("", !0)
892
+ ], 64));
751
893
  }
752
- }), G = ({ amount: t, currencyCode: e }, o) => e === void 0 ? new Intl.NumberFormat(o).format(Number(t)) : new Intl.NumberFormat(o, {
894
+ }), Xt = ({ amount: t, currencyCode: e }, s) => e === void 0 ? new Intl.NumberFormat(s).format(Number(t)) : new Intl.NumberFormat(s, {
753
895
  style: "currency",
754
896
  currency: e
755
- }).format(Number(t)), Tt = ({ min: t, max: e }, o) => t.amount === e.amount ? G(t, o) : `${G(t, o)} – ${G(e, o)}`, kt = (t, e) => {
897
+ }).format(Number(t)), Yt = (t, e) => {
756
898
  if (t === void 0)
757
899
  return "";
758
900
  try {
759
- return Tt(t, e);
901
+ return Xt(t.min, e);
760
902
  } catch {
761
903
  return "";
762
904
  }
763
- }, yt = (t) => {
905
+ }, Zt = (t) => {
764
906
  try {
765
907
  const { protocol: e } = new URL(t, window.location.href);
766
908
  return e === "http:" || e === "https:" ? t : void 0;
767
909
  } catch {
768
910
  return;
769
911
  }
770
- }, $t = { class: "dialog-search-card-image" }, At = ["src", "alt"], Lt = { class: "dialog-search-card-info" }, Dt = { class: "dialog-search-card-title" }, Pt = {
771
- key: 0,
772
- class: "dialog-search-card-price"
773
- }, Z = /* @__PURE__ */ R({
774
- __name: "DialogSearchProductCardContent",
775
- props: {
776
- hit: {},
777
- locale: {}
778
- },
779
- setup(t) {
780
- const e = t, o = T(() => e.hit.title ?? e.hit.objectID), s = T(
781
- () => kt(e.hit.priceRange, e.locale)
782
- );
783
- return (i, r) => (_(), v(N, null, [
784
- u("div", $t, [
785
- e.hit.imageUrl !== void 0 ? (_(), v("img", {
786
- key: 0,
787
- src: e.hit.imageUrl,
788
- alt: o.value,
789
- loading: "lazy"
790
- }, null, 8, At)) : M("", !0)
791
- ]),
792
- u("div", Lt, [
793
- u("p", Dt, k(o.value), 1),
794
- s.value !== "" ? (_(), v("p", Pt, k(s.value), 1)) : M("", !0)
795
- ])
796
- ], 64));
797
- }
798
- }), xt = {
912
+ }, fe = (t) => t.url === void 0 || t.url === "" ? void 0 : Zt(t.url), ve = (t) => t.title ?? t.handle ?? t.objectID, Jt = {
913
+ class: "dialog-search-product-thumb",
914
+ "aria-hidden": "true"
915
+ }, es = ["src"], ts = { class: "dialog-search-product-title" }, ss = {
799
916
  key: 0,
800
- class: "dialog-search-card-body"
801
- }, Nt = ["href"], Ot = /* @__PURE__ */ R({
917
+ class: "dialog-search-product-price"
918
+ }, os = /* @__PURE__ */ w({
802
919
  __name: "DialogSearchProductCard",
803
920
  props: {
804
921
  controller: {},
805
922
  hit: {},
806
923
  index: {},
807
- locale: {}
924
+ locale: { default: void 0 },
925
+ query: { default: "" }
808
926
  },
809
927
  setup(t) {
810
- const e = t, o = $();
811
- U(
928
+ const e = t, s = k();
929
+ M(
812
930
  () => e.hit,
813
931
  () => {
814
- o.value !== void 0 && e.controller.observeResult(o.value, e.index);
932
+ s.value !== void 0 && e.controller.observeResult(s.value, e.index);
815
933
  },
816
934
  { immediate: !0, flush: "post" }
817
935
  );
818
- const s = (n) => {
819
- const a = n.metaKey || n.ctrlKey || n.shiftKey || n.altKey;
820
- e.controller.selectResult(e.index, { navigate: !a }) && n.preventDefault();
821
- }, i = (n) => {
822
- n.button === 1 && e.controller.selectResult(e.index, { navigate: !1 });
823
- }, r = T(
824
- () => e.hit.url === void 0 ? void 0 : yt(e.hit.url)
825
- );
826
- return (n, a) => (_(), v("li", {
936
+ const o = b(() => fe(e.hit)), r = b(
937
+ () => Yt(e.hit.priceRange, e.locale)
938
+ ), n = (a) => {
939
+ const h = a.metaKey || a.ctrlKey || a.shiftKey || a.altKey;
940
+ e.controller.selectResult(e.index, { navigate: !h }) && a.preventDefault();
941
+ }, i = (a) => {
942
+ a.button === 1 && e.controller.selectResult(e.index, { navigate: !1 });
943
+ };
944
+ return (a, h) => (u(), _("li", {
827
945
  ref_key: "cardRef",
828
- ref: o,
946
+ ref: s,
829
947
  class: "dialog-search-card"
830
948
  }, [
831
- r.value === void 0 ? (_(), v("div", xt, [
832
- L(Z, {
833
- hit: e.hit,
834
- locale: e.locale
835
- }, null, 8, ["hit", "locale"])
836
- ])) : (_(), v("a", {
837
- key: 1,
838
- class: "dialog-search-card-body",
839
- href: r.value,
840
- onClick: s,
841
- onAuxclick: i
842
- }, [
843
- L(Z, {
844
- hit: e.hit,
845
- locale: e.locale
846
- }, null, 8, ["hit", "locale"])
847
- ], 40, Nt))
949
+ (u(), O($e(o.value === void 0 ? "div" : "a"), Re({
950
+ class: "dialog-search-product",
951
+ href: o.value
952
+ }, Te(
953
+ o.value === void 0 ? {} : { click: n, auxclick: i }
954
+ )), {
955
+ default: le(() => [
956
+ l("span", Jt, [
957
+ e.hit.imageUrl !== void 0 && e.hit.imageUrl !== "" ? (u(), _("img", {
958
+ key: 0,
959
+ src: e.hit.imageUrl,
960
+ alt: "",
961
+ loading: "lazy"
962
+ }, null, 8, es)) : A("", !0)
963
+ ]),
964
+ l("span", ts, [
965
+ T(ge, {
966
+ title: K(ve)(e.hit),
967
+ query: e.query
968
+ }, null, 8, ["title", "query"])
969
+ ]),
970
+ r.value !== "" ? (u(), _("span", ss, E(r.value), 1)) : A("", !0)
971
+ ]),
972
+ _: 1
973
+ }, 16, ["href"]))
848
974
  ], 512));
849
975
  }
850
- }), Ut = (t) => {
851
- const e = $(), o = $(void 0), s = $(0);
852
- return U(
976
+ }), ns = {}, rs = {
977
+ width: "16",
978
+ height: "16",
979
+ viewBox: "0 0 256 256",
980
+ fill: "currentColor",
981
+ xmlns: "http://www.w3.org/2000/svg",
982
+ "aria-hidden": "true"
983
+ };
984
+ function as(t, e) {
985
+ return u(), _("svg", rs, e[0] || (e[0] = [
986
+ l("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" }, null, -1)
987
+ ]));
988
+ }
989
+ const is = /* @__PURE__ */ D(ns, [["render", as]]), ls = {}, cs = {
990
+ width: "12",
991
+ height: "12",
992
+ viewBox: "0 0 256 256",
993
+ fill: "currentColor",
994
+ xmlns: "http://www.w3.org/2000/svg",
995
+ "aria-hidden": "true"
996
+ };
997
+ function us(t, e) {
998
+ return u(), _("svg", cs, e[0] || (e[0] = [
999
+ l("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" }, null, -1)
1000
+ ]));
1001
+ }
1002
+ const ds = /* @__PURE__ */ D(ls, [["render", us]]), me = (t) => (t ?? []).flatMap((e) => {
1003
+ const s = fe(e);
1004
+ return s === void 0 ? [] : [{ collection: e, href: s }];
1005
+ }), ps = {
1006
+ key: 0,
1007
+ class: "dialog-search-collections"
1008
+ }, hs = { class: "dialog-search-section-head" }, _s = { class: "dialog-search-label" }, gs = { class: "dialog-search-count" }, fs = { class: "dialog-search-collection-list" }, vs = ["href"], ms = {
1009
+ class: "dialog-search-collection-thumb",
1010
+ "aria-hidden": "true"
1011
+ }, bs = ["src"], Ss = { class: "dialog-search-collection-title" }, Cs = { class: "dialog-search-caret" }, ys = /* @__PURE__ */ w({
1012
+ __name: "DialogSearchCollections",
1013
+ props: {
1014
+ collections: {},
1015
+ query: {},
1016
+ messages: {}
1017
+ },
1018
+ setup(t) {
1019
+ const e = t, s = b(() => me(e.collections));
1020
+ return (o, r) => s.value.length > 0 ? (u(), _("aside", ps, [
1021
+ l("div", hs, [
1022
+ l("p", _s, E(e.messages.collectionsLabel), 1),
1023
+ l("span", gs, E(e.messages.collectionsCount(s.value.length)), 1)
1024
+ ]),
1025
+ l("ul", fs, [
1026
+ (u(!0), _(N, null, Q(s.value, ({ collection: n, href: i }) => (u(), _("li", {
1027
+ key: n.objectID
1028
+ }, [
1029
+ l("a", {
1030
+ class: "dialog-search-collection",
1031
+ href: i
1032
+ }, [
1033
+ l("span", ms, [
1034
+ n.imageUrl !== void 0 && n.imageUrl !== "" ? (u(), _("img", {
1035
+ key: 0,
1036
+ src: n.imageUrl,
1037
+ alt: "",
1038
+ loading: "lazy"
1039
+ }, null, 8, bs)) : A("", !0)
1040
+ ]),
1041
+ l("span", Ss, [
1042
+ T(ge, {
1043
+ title: K(ve)(n),
1044
+ query: e.query
1045
+ }, null, 8, ["title", "query"])
1046
+ ]),
1047
+ l("span", Cs, [
1048
+ T(ds)
1049
+ ])
1050
+ ], 8, vs)
1051
+ ]))), 128))
1052
+ ])
1053
+ ])) : A("", !0);
1054
+ }
1055
+ }), Es = { class: "dialog-search-products" }, ws = { class: "dialog-search-section-head" }, Is = { class: "dialog-search-label" }, $s = {
1056
+ key: 0,
1057
+ class: "dialog-search-label-count"
1058
+ }, Rs = { class: "dialog-search-results" }, Ts = {
1059
+ key: 0,
1060
+ class: "dialog-search-empty",
1061
+ role: "status"
1062
+ }, ks = /* @__PURE__ */ w({
1063
+ __name: "DialogSearchProducts",
1064
+ props: {
1065
+ controller: {},
1066
+ response: {},
1067
+ locale: {},
1068
+ messages: {}
1069
+ },
1070
+ setup(t) {
1071
+ const e = t;
1072
+ return (s, o) => (u(), _("section", Es, [
1073
+ l("div", ws, [
1074
+ l("p", Is, [
1075
+ ce(E(e.messages.productsLabel), 1),
1076
+ e.response.nbHits > 0 ? (u(), _("span", $s, " · " + E(e.messages.resultsCount(e.response.nbHits)), 1)) : A("", !0)
1077
+ ])
1078
+ ]),
1079
+ l("ul", Rs, [
1080
+ e.response.hits.length === 0 ? (u(), _("li", Ts, E(e.messages.noResults), 1)) : (u(!0), _(N, { key: 1 }, Q(e.response.hits, (r, n) => (u(), O(os, {
1081
+ key: r.objectID,
1082
+ controller: e.controller,
1083
+ hit: r,
1084
+ index: n,
1085
+ locale: e.locale,
1086
+ query: e.response.query
1087
+ }, null, 8, ["controller", "hit", "index", "locale", "query"]))), 128))
1088
+ ])
1089
+ ]));
1090
+ }
1091
+ }), H = 8, U = 16, As = 200, Ls = 1440, xs = (t, e) => t.bottom > 0 && t.top < e, Ds = (t, e) => {
1092
+ const s = Math.min(
1093
+ Ls,
1094
+ e - 2 * U
1095
+ ), o = t.left + t.width / 2 - s / 2;
1096
+ return { left: `${Math.min(
1097
+ Math.max(o, U),
1098
+ e - U - s
1099
+ )}px`, width: `${s}px` };
1100
+ }, Ps = (t, e, s) => {
1101
+ const o = s - t.bottom - H - U, r = t.top - H - U, n = Ds(t, e);
1102
+ return o < As && r > o ? {
1103
+ ...n,
1104
+ bottom: `${s - t.top + H}px`,
1105
+ maxHeight: `${Math.max(r, 0)}px`
1106
+ } : {
1107
+ ...n,
1108
+ top: `${t.bottom + H}px`,
1109
+ maxHeight: `${Math.max(o, 0)}px`
1110
+ };
1111
+ }, Os = (t) => {
1112
+ const e = t.trim().replace(/^#/, "");
1113
+ if (!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e))
1114
+ return;
1115
+ const s = e.length <= 4 ? [...e].map((o) => o + o).join("") : e;
1116
+ return [0, 2, 4].map(
1117
+ (o) => Number.parseInt(s.slice(o, o + 2), 16)
1118
+ );
1119
+ }, Ns = (t) => {
1120
+ const e = /^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(t);
1121
+ if (e !== null)
1122
+ return [e[1], e[2], e[3]].map(Number);
1123
+ }, qs = (t) => {
1124
+ if (typeof document > "u")
1125
+ return;
1126
+ const e = document.createElement("span");
1127
+ if (e.style.color = t, e.style.color === "")
1128
+ return;
1129
+ document.body.appendChild(e);
1130
+ const s = Ns(getComputedStyle(e).color);
1131
+ return e.remove(), s;
1132
+ }, Ms = (t) => Os(t) ?? qs(t), Us = (t) => {
1133
+ const e = t / 255;
1134
+ return e <= 0.03928 ? e / 12.92 : ((e + 0.055) / 1.055) ** 2.4;
1135
+ }, be = (t) => {
1136
+ const e = Ms(t);
1137
+ if (e === void 0)
1138
+ return;
1139
+ const [s, o, r] = e.map(Us);
1140
+ return 0.2126 * s + 0.7152 * o + 0.0722 * r;
1141
+ }, Hs = "#181825", Vs = "#ffffff", Bs = "straight", G = 0.5, W = {
1142
+ light: {
1143
+ panel: "#ffffff",
1144
+ side: "#fafbfc",
1145
+ text: "#111827",
1146
+ "text-sec": "#6b7280",
1147
+ border: "#eceef2",
1148
+ hover: "#eef2f7",
1149
+ thumb: "#eef1f5"
1150
+ },
1151
+ dark: {
1152
+ panel: "#15171c",
1153
+ side: "#1b1e25",
1154
+ text: "#f3f4f6",
1155
+ "text-sec": "#9ca3af",
1156
+ border: "#2b2f38",
1157
+ hover: "#242830",
1158
+ thumb: "#2b2f38"
1159
+ }
1160
+ }, Ks = {
1161
+ rectangle: {
1162
+ "r-panel": "4px",
1163
+ "r-item": "4px",
1164
+ "r-thumb": "2px",
1165
+ "r-btn": "4px"
1166
+ },
1167
+ "rectangle-rounded": {
1168
+ "r-panel": "16px",
1169
+ "r-item": "10px",
1170
+ "r-thumb": "8px",
1171
+ "r-btn": "10px"
1172
+ }
1173
+ }, V = (t) => t === void 0 || t.trim() === "" ? void 0 : t.trim(), Fs = (t) => {
1174
+ const e = t === void 0 ? void 0 : be(t);
1175
+ return e === void 0 ? "light" : e < G ? "dark" : "light";
1176
+ }, zs = (t, e) => {
1177
+ const s = be(t);
1178
+ return s === void 0 ? W[e].text : (e === "light" ? s < G : s >= G) ? t : W[e].text;
1179
+ }, js = (t) => {
1180
+ const e = Fs(V(t == null ? void 0 : t.backgroundColor)), s = (t == null ? void 0 : t.ctaBorderType) === Bs ? "rectangle" : "rectangle-rounded", o = V(t == null ? void 0 : t.primaryColor) ?? Hs, r = V(t == null ? void 0 : t.fontFamily), n = {
1181
+ ...W[e],
1182
+ ...Ks[s],
1183
+ primary: o,
1184
+ accent: zs(o, e),
1185
+ "cta-text": V(t == null ? void 0 : t.ctaTextColor) ?? Vs,
1186
+ ...r === void 0 ? {} : { font: r }
1187
+ };
1188
+ return Object.fromEntries(
1189
+ Object.entries(n).map(([i, a]) => [`--dso-${i}`, a])
1190
+ );
1191
+ }, Gs = (t) => {
1192
+ const e = k(), s = k(void 0), o = k({ width: 0, height: 0 });
1193
+ return M(
853
1194
  t,
854
- (i, r, n) => {
855
- if (!i)
1195
+ (r, n, i) => {
1196
+ if (!r)
856
1197
  return;
857
1198
  const a = () => {
858
- const p = e.value;
859
- if (p === void 0)
1199
+ const h = e.value;
1200
+ if (h === void 0)
860
1201
  return;
861
- const c = p.previousElementSibling ?? p, { top: l, bottom: h, left: S, width: w } = c.getBoundingClientRect();
862
- s.value = window.innerHeight;
863
- const d = o.value;
864
- (d === void 0 || d.top !== l || d.bottom !== h || d.left !== S || d.width !== w) && (o.value = { top: l, bottom: h, left: S, width: w });
1202
+ const c = h.previousElementSibling ?? h, { top: d, bottom: g, left: y, width: S } = c.getBoundingClientRect();
1203
+ (o.value.width !== window.innerWidth || o.value.height !== window.innerHeight) && (o.value = {
1204
+ width: window.innerWidth,
1205
+ height: window.innerHeight
1206
+ });
1207
+ const f = s.value;
1208
+ (f === void 0 || f.top !== d || f.bottom !== g || f.left !== y || f.width !== S) && (s.value = { top: d, bottom: g, left: y, width: S });
865
1209
  };
866
- a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), n(() => {
1210
+ a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), i(() => {
867
1211
  window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
868
1212
  });
869
1213
  },
870
1214
  { immediate: !0, flush: "post" }
871
- ), { anchorRef: e, rect: o, viewportHeight: s };
872
- }, Mt = (t, e) => {
873
- const o = $(!1), s = $(), i = T(
874
- () => t.value.status !== y.IDLE && !o.value
1215
+ ), { anchorRef: e, rect: s, viewport: o };
1216
+ }, Ws = (t, e) => {
1217
+ const s = k(!1), o = k(), r = b(
1218
+ () => t.value.status !== L.IDLE && !s.value
875
1219
  );
876
- U(
1220
+ M(
877
1221
  () => t.value.query,
878
1222
  () => {
879
- o.value = !1;
1223
+ s.value = !1;
880
1224
  }
881
- ), U(
882
- i,
883
- (n, a, p) => {
884
- if (!n)
1225
+ ), M(
1226
+ r,
1227
+ (i, a, h) => {
1228
+ if (!i)
885
1229
  return;
886
- const c = (l) => {
887
- var b, C;
888
- const h = l.target;
889
- if (!(h instanceof Node))
1230
+ const c = (d) => {
1231
+ var I, $;
1232
+ const g = d.target;
1233
+ if (!(g instanceof Node))
890
1234
  return;
891
- const S = (b = e.value) == null ? void 0 : b.previousElementSibling, w = ((C = s.value) == null ? void 0 : C.contains(h)) ?? !1, d = (S == null ? void 0 : S.contains(h)) ?? !1;
892
- !w && !d && (o.value = !0);
1235
+ const y = (I = e.value) == null ? void 0 : I.previousElementSibling, S = (($ = o.value) == null ? void 0 : $.contains(g)) ?? !1, f = (y == null ? void 0 : y.contains(g)) ?? !1;
1236
+ !S && !f && (s.value = !0);
893
1237
  };
894
- document.addEventListener("pointerdown", c), p(
1238
+ document.addEventListener("pointerdown", c), h(
895
1239
  () => document.removeEventListener("pointerdown", c)
896
1240
  );
897
1241
  },
898
1242
  { immediate: !0 }
899
1243
  );
900
- const r = () => {
901
- o.value = !1;
1244
+ const n = () => {
1245
+ s.value = !1;
902
1246
  };
903
- return V(() => {
904
- var n, a;
905
- (a = (n = e.value) == null ? void 0 : n.previousElementSibling) == null || a.addEventListener(
1247
+ return B(() => {
1248
+ var i, a;
1249
+ (a = (i = e.value) == null ? void 0 : i.previousElementSibling) == null || a.addEventListener(
906
1250
  "focusin",
907
- r
1251
+ n
908
1252
  );
909
- }), se(() => {
910
- var n, a;
911
- (a = (n = e.value) == null ? void 0 : n.previousElementSibling) == null || a.removeEventListener(
1253
+ }), ue(() => {
1254
+ var i, a;
1255
+ (a = (i = e.value) == null ? void 0 : i.previousElementSibling) == null || a.removeEventListener(
912
1256
  "focusin",
913
- r
1257
+ n
914
1258
  );
915
- }), { isOpen: i, panelRef: s };
916
- }, qt = {
1259
+ }), { isOpen: r, panelRef: o };
1260
+ }, Qs = {
917
1261
  key: 0,
918
- role: "status",
919
- class: "dialog-search-status"
920
- }, Bt = {
921
- key: 1,
922
1262
  class: "dialog-search-error"
923
- }, Vt = {
1263
+ }, Xs = {
924
1264
  role: "alert",
925
1265
  class: "dialog-search-status dialog-search-status-error"
926
- }, Kt = {
927
- key: 2,
928
- role: "status",
929
- class: "dialog-search-status"
930
- }, Ht = {
1266
+ }, Ys = {
1267
+ key: 1,
931
1268
  role: "status",
932
1269
  class: "dialog-search-status"
933
- }, Ft = { class: "dialog-search-results" }, B = 8, J = 16, Gt = 200, Yt = /* @__PURE__ */ R({
1270
+ }, Zs = {
1271
+ key: 0,
1272
+ class: "dialog-search-footer"
1273
+ }, Js = ["href"], no = /* @__PURE__ */ w({
934
1274
  __name: "DialogSearchResults",
935
1275
  props: {
936
1276
  controller: {},
937
1277
  state: {},
938
- locale: {}
1278
+ locale: { default: void 0 },
1279
+ theme: { default: void 0 },
1280
+ layout: { default: "list" },
1281
+ seeAllHref: { type: Function, default: void 0 }
939
1282
  },
940
1283
  setup(t) {
941
- const e = t, o = (d) => d instanceof Se ? `Search failed (${d.status}${d.code ? ` ${d.code}` : ""}): ${d.message}` : "Search failed: network error. Check your connection and try again.", s = (d, b) => d.bottom > 0 && d.top < b, i = (d, b) => {
942
- const C = b - d.bottom - B - J, I = d.top - B - J, f = { left: `${d.left}px`, width: `${d.width}px` };
943
- return C < Gt && I > C ? {
944
- ...f,
945
- bottom: `${b - d.top + B}px`,
946
- maxHeight: `${Math.max(I, 0)}px`
947
- } : {
948
- ...f,
949
- top: `${d.bottom + B}px`,
950
- maxHeight: `${Math.max(C, 0)}px`
951
- };
952
- }, r = T(() => e.state), n = T(() => e.state.status !== y.IDLE), { anchorRef: a, rect: p, viewportHeight: c } = Ut(n), { isOpen: l, panelRef: h } = Mt(r, a), S = T(
953
- () => l.value && p.value !== void 0 && s(p.value, c.value)
954
- ), w = T(
955
- () => p.value === void 0 ? void 0 : i(p.value, c.value)
1284
+ const e = t, s = (p) => p instanceof Oe ? `Search failed (${p.status}${p.code ? ` ${p.code}` : ""}): ${p.message}` : "Search failed: network error. Check your connection and try again.", o = b(() => e.state), r = b(() => e.state.status !== L.IDLE), { anchorRef: n, rect: i, viewport: a } = Gs(r), { isOpen: h, panelRef: c } = Ws(o, n), d = b(
1285
+ () => h.value && i.value !== void 0 && xs(i.value, a.value.height)
1286
+ ), g = b(() => js(e.theme)), y = b(() => ({
1287
+ ...i.value === void 0 ? {} : Ps(i.value, a.value.width, a.value.height),
1288
+ ...g.value
1289
+ })), S = b(() => he(e.locale)), f = b(() => e.state.response), I = b(
1290
+ () => {
1291
+ var p, C;
1292
+ return ((C = (p = e.state.sections) == null ? void 0 : p.collections) == null ? void 0 : C.hits) ?? [];
1293
+ }
1294
+ ), $ = b(
1295
+ () => me(I.value).length > 0
1296
+ ), R = b(
1297
+ () => e.seeAllHref !== void 0 && f.value !== void 0 && f.value.nbHits > 0
1298
+ ), m = b(() => !R.value && _e(e.state)), v = b(
1299
+ () => {
1300
+ var p;
1301
+ return f.value === void 0 || (p = e.seeAllHref) == null ? void 0 : p.call(e, f.value.query);
1302
+ }
956
1303
  );
957
- return (d, b) => {
958
- var C;
959
- return _(), v(N, null, [
960
- u("div", {
961
- ref_key: "anchorRef",
962
- ref: a
963
- }, null, 512),
964
- S.value ? (_(), O(_e, {
965
- key: 0,
966
- to: "body"
1304
+ return (p, C) => (u(), _(N, null, [
1305
+ l("div", {
1306
+ ref_key: "anchorRef",
1307
+ ref: n
1308
+ }, null, 512),
1309
+ d.value ? (u(), O(ke, {
1310
+ key: 0,
1311
+ to: "body"
1312
+ }, [
1313
+ l("div", {
1314
+ ref_key: "panelRef",
1315
+ ref: c,
1316
+ class: Z(["dialog-search-panel", `dialog-search-panel--${e.layout}`]),
1317
+ style: Ae(y.value)
967
1318
  }, [
968
- u("div", {
969
- ref_key: "panelRef",
970
- ref: h,
971
- class: "dialog-search-panel",
972
- style: he(w.value)
973
- }, [
974
- e.state.status === q(y).LOADING ? (_(), v("p", qt, " Searching “" + k(e.state.query) + "”… ", 1)) : e.state.status === q(y).ERROR ? (_(), v("div", Bt, [
975
- u("p", Vt, k(o(e.state.error)), 1),
976
- u("button", {
977
- type: "button",
978
- class: "dialog-search-retry",
979
- onClick: b[0] || (b[0] = (I) => e.controller.retry())
980
- }, " Retry ")
981
- ])) : e.state.status === q(y).EMPTY ? (_(), v("p", Kt, " No products match “" + k((C = e.state.response) == null ? void 0 : C.query) + "”. ", 1)) : e.state.status === q(y).SUCCESS && e.state.response !== void 0 ? (_(), v(N, { key: 3 }, [
982
- u("p", Ht, k(e.state.response.nbHits) + " result" + k(e.state.response.nbHits > 1 ? "s" : ""), 1),
983
- u("ul", Ft, [
984
- (_(!0), v(N, null, ee(e.state.response.hits, (I, f) => (_(), O(Ot, {
985
- key: I.objectID,
986
- controller: e.controller,
987
- hit: I,
988
- index: f,
989
- locale: e.locale
990
- }, null, 8, ["controller", "hit", "index", "locale"]))), 128))
991
- ]),
992
- L(Rt, {
1319
+ e.state.status === K(L).ERROR ? (u(), _("div", Qs, [
1320
+ l("p", Xs, E(s(e.state.error)), 1),
1321
+ l("button", {
1322
+ type: "button",
1323
+ class: "dialog-search-retry",
1324
+ onClick: C[0] || (C[0] = (P) => e.controller.retry())
1325
+ }, E(S.value.retry), 1)
1326
+ ])) : f.value === void 0 ? (u(), _("p", Ys, E(S.value.searching(e.state.query)), 1)) : (u(), _(N, { key: 2 }, [
1327
+ l("div", {
1328
+ class: Z([
1329
+ "dialog-search-body",
1330
+ { "dialog-search-body--no-collections": !$.value }
1331
+ ])
1332
+ }, [
1333
+ T(ys, {
1334
+ collections: I.value,
1335
+ query: f.value.query,
1336
+ messages: S.value
1337
+ }, null, 8, ["collections", "query", "messages"]),
1338
+ T(ks, {
993
1339
  controller: e.controller,
994
- state: e.state
995
- }, null, 8, ["controller", "state"])
996
- ], 64)) : M("", !0)
997
- ], 4)
998
- ])) : M("", !0)
999
- ], 64);
1000
- };
1340
+ response: f.value,
1341
+ locale: e.locale,
1342
+ messages: S.value
1343
+ }, null, 8, ["controller", "response", "locale", "messages"])
1344
+ ], 2),
1345
+ R.value || m.value ? (u(), _("div", Zs, [
1346
+ R.value ? (u(), _("a", {
1347
+ key: 0,
1348
+ class: "dialog-search-cta",
1349
+ href: v.value
1350
+ }, [
1351
+ ce(E(S.value.seeAllLabel(f.value.nbHits)) + " ", 1),
1352
+ T(is)
1353
+ ], 8, Js)) : (u(), O(zt, {
1354
+ key: 1,
1355
+ controller: e.controller,
1356
+ state: e.state,
1357
+ locale: e.locale
1358
+ }, null, 8, ["controller", "state", "locale"]))
1359
+ ])) : A("", !0)
1360
+ ], 64))
1361
+ ], 6)
1362
+ ])) : A("", !0)
1363
+ ], 64));
1001
1364
  }
1002
- }), Xt = (t) => {
1003
- const { client: e, surface: o = "search_page", ...s } = t, i = Pe({
1004
- search: (a, p) => e.search(a, p),
1365
+ }), ro = (t) => {
1366
+ const { client: e, surface: s = "search_page", ...o } = t, r = Qe({
1367
+ search: (a, h) => e.search(a, h),
1005
1368
  analytics: {
1006
- surface: o,
1369
+ surface: s,
1007
1370
  trackViewSearchResults: (a) => e.trackViewSearchResults(a),
1008
1371
  trackSelectSearchResult: (a) => e.trackSelectSearchResult(a)
1009
1372
  },
1010
- ...s
1011
- }), r = fe(i.getState()), n = i.subscribe(() => {
1012
- r.value = i.getState();
1373
+ ...o
1374
+ }), n = Le(r.getState()), i = r.subscribe(() => {
1375
+ n.value = r.getState();
1013
1376
  });
1014
- return V(() => {
1015
- re({
1377
+ return B(() => {
1378
+ pe({
1016
1379
  method: "vue",
1017
- version: "3.6.0"
1380
+ version: "3.8.0"
1018
1381
  });
1019
- }), se(() => {
1020
- n(), i.dispose();
1021
- }), { controller: i, state: r };
1382
+ }), ue(() => {
1383
+ i(), r.dispose();
1384
+ }), { controller: r, state: n, theme: e.theme };
1022
1385
  };
1023
1386
  export {
1024
- it as DialogInput,
1025
- zt as DialogProductBlock,
1026
- Wt as DialogSearchBar,
1027
- Rt as DialogSearchPagination,
1028
- Ot as DialogSearchProductCard,
1029
- Yt as DialogSearchResults,
1030
- Xt as useDialogSearch
1387
+ It as DialogInput,
1388
+ so as DialogProductBlock,
1389
+ oo as DialogSearchBar,
1390
+ zt as DialogSearchPagination,
1391
+ os as DialogSearchProductCard,
1392
+ no as DialogSearchResults,
1393
+ ro as useDialogSearch
1031
1394
  };