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