@askdialog/dialog-vue 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,27 @@
1
- import { defineComponent as _, createElementBlock as u, openBlock as l, createElementVNode as c, toDisplayString as E, Fragment as A, renderList as N, createVNode as v, createBlock as k, ref as m, withDirectives as O, withKeys as y, vModelText as U, onMounted as b, watch as L, renderSlot as $, computed as T, withCtx as K, createCommentVNode as B } from "vue";
2
- const V = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur"]), P = (t) => t !== void 0 && V.has(t.trim().toLowerCase().slice(0, 2)), M = (t) => P(t) ? "rtl" : "ltr";
3
- var h;
1
+ var se = Object.defineProperty;
2
+ var re = (t, e, o) => e in t ? se(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var K = (t, e, o) => re(t, typeof e != "symbol" ? e + "" : e, o);
4
+ import { defineComponent as y, createElementBlock as v, openBlock as p, createElementVNode as l, toDisplayString as I, Fragment as x, renderList as X, createVNode as D, createBlock as M, ref as A, withDirectives as Z, withKeys as ie, vModelText as J, onMounted as H, watch as q, renderSlot as ae, computed as T, withCtx as ce, createCommentVNode as N, withModifiers as le, createTextVNode as ue, onUnmounted as ee, Teleport as de, normalizeStyle as pe, unref as B, 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";
6
+ var U;
4
7
  (function(t) {
5
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";
6
- })(h || (h = {}));
7
- var I;
9
+ })(U || (U = {}));
10
+ var G;
8
11
  (function(t) {
9
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";
10
- })(I || (I = {}));
11
- h.TRACK_ADD_TO_CART, h.TRACK_SUBMIT_CHECKOUT, h.TRACK_VIEW_SEARCH_RESULTS, h.TRACK_SELECT_SEARCH_RESULT;
12
- const R = "multiple installation methods detected:", q = () => typeof window > "u" ? void 0 : window, w = () => {
13
- const t = q();
13
+ })(G || (G = {}));
14
+ U.TRACK_ADD_TO_CART, U.TRACK_SUBMIT_CHECKOUT, U.TRACK_VIEW_SEARCH_RESULTS, U.TRACK_SELECT_SEARCH_RESULT;
15
+ class ve extends Error {
16
+ constructor({ status: o, code: n, message: a }) {
17
+ super(a);
18
+ K(this, "status");
19
+ K(this, "code");
20
+ this.name = "DialogSearchError", this.status = o, this.code = n;
21
+ }
22
+ }
23
+ const Q = "multiple installation methods detected:", me = () => typeof window > "u" ? void 0 : window, te = () => {
24
+ const t = me();
14
25
  if (t !== void 0)
15
26
  return t.dialog = t.dialog ?? {}, t.dialog.audit = t.dialog.audit ?? {
16
27
  methods: [],
@@ -18,28 +29,229 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
18
29
  capabilities: [],
19
30
  warnings: []
20
31
  }, t.dialog.audit;
21
- }, x = (t) => {
22
- if (t.warnings = t.warnings.filter((e) => !e.startsWith(R)), t.methods.length >= 2) {
32
+ }, Se = (t) => {
33
+ if (t.warnings = t.warnings.filter((e) => !e.startsWith(Q)), t.methods.length >= 2) {
23
34
  const e = t.methods.map((o) => o.method).join(", ");
24
- t.warnings.push(`${R} ${e}`);
35
+ t.warnings.push(`${Q} ${e}`);
25
36
  }
26
- }, H = (t, e) => e === void 0 ? t : {
37
+ }, Ce = (t, e) => e === void 0 ? t : {
27
38
  version: (t == null ? void 0 : t.version) ?? e.version,
28
39
  commit: (t == null ? void 0 : t.commit) ?? e.commit
29
- }, F = (t) => {
30
- const e = w();
40
+ }, oe = (t) => {
41
+ const e = te();
31
42
  if (e === void 0)
32
43
  return;
33
44
  const o = e.methods.find((n) => n.method === t.method);
34
45
  if (o === void 0) {
35
- e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), x(e);
46
+ e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), Se(e);
36
47
  return;
37
48
  }
38
- o.version = o.version ?? t.version, o.build = H(o.build, t.build), o.source = o.source ?? t.source;
39
- }, G = (t) => {
40
- const e = w();
49
+ o.version = o.version ?? t.version, o.build = Ce(o.build, t.build), o.source = o.source ?? t.source;
50
+ }, be = (t) => {
51
+ const e = te();
41
52
  e !== void 0 && (e.capabilities.includes(t) || e.capabilities.push(t));
42
- }, j = { class: "dialog-block-header-container" }, Q = { class: "dialog-block-title" }, W = { class: "dialog-block-description" }, Z = /* @__PURE__ */ _({
53
+ }, w = {
54
+ IDLE: "idle",
55
+ LOADING: "loading",
56
+ SUCCESS: "success",
57
+ /** The request succeeded with zero hits — distinct from `success` so views render a no-results state. */
58
+ EMPTY: "empty",
59
+ ERROR: "error"
60
+ }, Ee = 0.5, Re = 500, Te = 1500, ye = 100;
61
+ function Ie({ emit: t, visibilityThreshold: e = Ee, dwellMs: o = Re, idleFlushMs: n = Te, maxItemsPerEvent: a = ye }) {
62
+ let r, i = [];
63
+ const s = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
64
+ let u;
65
+ const d = () => {
66
+ clearTimeout(u), !(r === void 0 || i.length === 0) && (t({ ...r, items: i }), i = []);
67
+ }, S = (h) => {
68
+ if (r === void 0)
69
+ return;
70
+ const C = `${r.query_id}:${h.product_id}`;
71
+ if (!s.has(C)) {
72
+ if (s.add(C), i.push(h), i.length >= a) {
73
+ d();
74
+ return;
75
+ }
76
+ clearTimeout(u), u = setTimeout(d, n);
77
+ }
78
+ }, E = (h) => {
79
+ const C = f.get(h);
80
+ C !== void 0 && (clearTimeout(C), f.delete(h));
81
+ }, c = new IntersectionObserver((h) => {
82
+ for (const C of h) {
83
+ const g = _.get(C.target);
84
+ g !== void 0 && (C.intersectionRatio >= e ? f.has(C.target) || f.set(C.target, setTimeout(() => {
85
+ f.delete(C.target), S(g);
86
+ }, o)) : E(C.target));
87
+ }
88
+ }, { threshold: e }), b = () => {
89
+ c.disconnect();
90
+ for (const h of f.values())
91
+ clearTimeout(h);
92
+ f.clear(), _.clear();
93
+ }, R = () => {
94
+ d();
95
+ }, L = (h) => {
96
+ if (h.persisted) {
97
+ s.clear();
98
+ for (const C of _.keys())
99
+ E(C), c.unobserve(C), c.observe(C);
100
+ }
101
+ };
102
+ return window.addEventListener("pagehide", R), window.addEventListener("pageshow", L), {
103
+ setContext(h) {
104
+ d(), r !== void 0 && r.query_id !== h.query_id && s.clear(), r = h, b();
105
+ },
106
+ observe(h, C) {
107
+ _.set(h, C), c.observe(h);
108
+ },
109
+ forceImpression(h) {
110
+ S(h), d();
111
+ },
112
+ flush: d,
113
+ disconnect() {
114
+ d(), b(), window.removeEventListener("pagehide", R), window.removeEventListener("pageshow", L);
115
+ }
116
+ };
117
+ }
118
+ const j = (t, e) => ({
119
+ product_id: t.hits[e].product.id,
120
+ // 1-based and absolute across pages (page 2, first item, 20/page → 21).
121
+ position: t.page * t.hitsPerPage + e + 1
122
+ });
123
+ function ke(t) {
124
+ let e, o;
125
+ const n = () => (e ?? (e = Ie({
126
+ emit: t.trackViewSearchResults
127
+ })), e);
128
+ return {
129
+ onResponse(a) {
130
+ o = {
131
+ // Straight off the response: the controller resends the previous
132
+ // queryId while the query text is unchanged, so the id is stable
133
+ // across pagination and rotates with the query.
134
+ query_id: a.queryId,
135
+ surface: t.surface,
136
+ // The storefront search API is lexical-only today.
137
+ search_type: "lexical",
138
+ // Analytics pages are 1-based; the wire response is 0-based.
139
+ page: a.page + 1,
140
+ total_hits: a.nbHits,
141
+ query_length: [...a.query].length
142
+ }, n().setContext(o), a.nbHits === 0 && t.trackViewSearchResults({ ...o, items: [] });
143
+ },
144
+ observeResult(a, r, i) {
145
+ n().observe(a, j(r, i));
146
+ },
147
+ select(a, r) {
148
+ if (o === void 0)
149
+ return;
150
+ const i = j(a, r);
151
+ n().forceImpression(i), t.trackSelectSearchResult({ ...o, items: [i] });
152
+ },
153
+ dispose() {
154
+ e == null || e.disconnect();
155
+ }
156
+ };
157
+ }
158
+ const we = 250, Ae = 12, Le = 2, W = {
159
+ status: w.IDLE,
160
+ query: "",
161
+ page: 0,
162
+ response: void 0,
163
+ error: void 0
164
+ };
165
+ function $e({ search: t, analytics: e, navigate: o, debounceMs: n = we, hitsPerPage: a = Ae, locale: r, countryCode: i }) {
166
+ let s = W;
167
+ const _ = /* @__PURE__ */ new Set(), f = ke(e);
168
+ let u, d, S, E = 0, c = !1;
169
+ const b = (g) => {
170
+ s = { ...s, ...g };
171
+ for (const m of _)
172
+ m(s);
173
+ }, R = () => {
174
+ clearTimeout(u), S == null || S.abort(), S = void 0;
175
+ }, L = (g, m) => {
176
+ const k = { query: g, page: m, hitsPerPage: a };
177
+ r !== void 0 && (k.locale = r), i !== void 0 && (k.countryCode = i);
178
+ const $ = s.response;
179
+ return ($ == null ? void 0 : $.query) === g && (k.queryId = $.queryId), k;
180
+ }, h = async (g, m) => {
181
+ R(), S = new AbortController();
182
+ const k = ++E, $ = L(g, m);
183
+ b({ status: w.LOADING, query: g, page: m });
184
+ try {
185
+ const P = await t($, {
186
+ signal: S.signal
187
+ });
188
+ if (k !== E)
189
+ return;
190
+ f.onResponse(P), b({
191
+ status: P.nbHits === 0 ? w.EMPTY : w.SUCCESS,
192
+ response: P,
193
+ error: void 0
194
+ });
195
+ } catch (P) {
196
+ if (P instanceof DOMException && P.name === "AbortError" || k !== E)
197
+ return;
198
+ b({ status: w.ERROR, error: P, response: void 0 });
199
+ }
200
+ }, C = (g) => {
201
+ const m = g.trim();
202
+ if (R(), d = void 0, [...m].length < Le) {
203
+ E += 1, b(W);
204
+ return;
205
+ }
206
+ return m;
207
+ };
208
+ return {
209
+ setQuery(g) {
210
+ const m = c ? void 0 : C(g);
211
+ m !== void 0 && (d = m, u = setTimeout(() => {
212
+ d = void 0, h(m, 0);
213
+ }, n));
214
+ },
215
+ submit(g) {
216
+ const m = c ? void 0 : C(g);
217
+ m !== void 0 && h(m, 0);
218
+ },
219
+ setPage(g) {
220
+ if (!c) {
221
+ if (d !== void 0) {
222
+ const m = d;
223
+ d = void 0, h(m, 0);
224
+ return;
225
+ }
226
+ s.query !== "" && h(s.query, g);
227
+ }
228
+ },
229
+ retry() {
230
+ c || s.status !== w.ERROR || h(s.query, s.page);
231
+ },
232
+ observeResult(g, m) {
233
+ s.response !== void 0 && f.observeResult(g, s.response, m);
234
+ },
235
+ selectResult(g, m) {
236
+ const k = s.response;
237
+ if (k === void 0)
238
+ return !1;
239
+ f.select(k, g);
240
+ const $ = k.hits[g].product.url;
241
+ return ((m == null ? void 0 : m.navigate) ?? !0) && o !== void 0 && $ !== void 0 ? (o($, k.hits[g]), !0) : !1;
242
+ },
243
+ subscribe(g) {
244
+ return _.add(g), () => {
245
+ _.delete(g);
246
+ };
247
+ },
248
+ getState: () => s,
249
+ dispose() {
250
+ c = !0, R(), E += 1, d = void 0, _.clear(), f.dispose();
251
+ }
252
+ };
253
+ }
254
+ const De = { class: "dialog-block-header-container" }, Pe = { class: "dialog-block-title" }, Ne = { class: "dialog-block-description" }, Oe = /* @__PURE__ */ y({
43
255
  __name: "DialogBlockHeader",
44
256
  props: {
45
257
  title: {},
@@ -47,32 +259,32 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
47
259
  },
48
260
  setup(t) {
49
261
  const e = t;
50
- return (o, n) => (l(), u("div", j, [
51
- c("div", Q, E(e.title ?? "Your expert"), 1),
52
- c("div", W, E(e.description ?? "A question about this product?"), 1)
262
+ return (o, n) => (p(), v("div", De, [
263
+ l("div", Pe, I(e.title ?? "Your expert"), 1),
264
+ l("div", Ne, I(e.description ?? "A question about this product?"), 1)
53
265
  ]));
54
266
  }
55
- }), S = (t, e) => {
267
+ }), O = (t, e) => {
56
268
  const o = t.__vccOpts || t;
57
269
  for (const [n, a] of e)
58
270
  o[n] = a;
59
271
  return o;
60
- }, z = /* @__PURE__ */ S(Z, [["__scopeId", "data-v-28e6dda7"]]), X = {
272
+ }, Ue = /* @__PURE__ */ O(Oe, [["__scopeId", "data-v-28e6dda7"]]), xe = {
61
273
  width: "20",
62
274
  height: "20",
63
275
  viewBox: "0 0 20 20",
64
276
  fill: "none",
65
277
  xmlns: "http://www.w3.org/2000/svg"
66
- }, Y = { "clip-path": "url(#clip0_466_934)" }, J = ["stroke"], ee = ["stroke"], te = /* @__PURE__ */ _({
278
+ }, Me = { "clip-path": "url(#clip0_466_934)" }, qe = ["stroke"], Be = ["stroke"], Ve = /* @__PURE__ */ y({
67
279
  __name: "AiStarsIcon",
68
280
  props: {
69
281
  color: {}
70
282
  },
71
283
  setup(t) {
72
284
  const e = t;
73
- return (o, n) => (l(), u("svg", X, [
74
- c("g", Y, [
75
- c("path", {
285
+ return (o, n) => (p(), v("svg", xe, [
286
+ l("g", Me, [
287
+ l("path", {
76
288
  d: `M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
77
289
  12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
78
290
  13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
@@ -87,8 +299,8 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
87
299
  "stroke-width": "1.5",
88
300
  "stroke-linecap": "round",
89
301
  "stroke-linejoin": "round"
90
- }, null, 8, J),
91
- c("path", {
302
+ }, null, 8, qe),
303
+ l("path", {
92
304
  d: `M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
93
305
  5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
94
306
  6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
@@ -103,11 +315,11 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
103
315
  "stroke-width": "1.5",
104
316
  "stroke-linecap": "round",
105
317
  "stroke-linejoin": "round"
106
- }, null, 8, ee)
318
+ }, null, 8, Be)
107
319
  ]),
108
- n[0] || (n[0] = c("defs", null, [
109
- c("clipPath", { id: "clip0_466_934" }, [
110
- c("rect", {
320
+ n[0] || (n[0] = l("defs", null, [
321
+ l("clipPath", { id: "clip0_466_934" }, [
322
+ l("rect", {
111
323
  width: "20",
112
324
  height: "20",
113
325
  fill: "white"
@@ -116,7 +328,7 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
116
328
  ], -1))
117
329
  ]));
118
330
  }
119
- }), oe = ["onClick"], ne = { class: "dialog-block-suggestions-item-label" }, ie = /* @__PURE__ */ _({
331
+ }), He = ["onClick"], Ke = { class: "dialog-block-suggestions-item-label" }, Fe = /* @__PURE__ */ y({
120
332
  __name: "DialogBlockSuggestions",
121
333
  props: {
122
334
  client: {},
@@ -135,27 +347,27 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
135
347
  fromQuestionSuggestion: !0
136
348
  });
137
349
  };
138
- return (n, a) => (l(!0), u(A, null, N(e.questions, (i) => (l(), u("button", {
139
- key: i.question,
350
+ return (n, a) => (p(!0), v(x, null, X(e.questions, (r) => (p(), v("button", {
351
+ key: r.question,
140
352
  class: "dialog-block-suggestions-item",
141
- onClick: (r) => o(i.question)
353
+ onClick: (i) => o(r.question)
142
354
  }, [
143
- v(te, {
355
+ D(Ve, {
144
356
  class: "dialog-block-suggestions-item-icon",
145
357
  color: e.client.theme.primaryColor
146
358
  }, null, 8, ["color"]),
147
- c("span", ne, E(i.question), 1)
148
- ], 8, oe))), 128));
359
+ l("span", Ke, I(r.question), 1)
360
+ ], 8, He))), 128));
149
361
  }
150
- }), se = /* @__PURE__ */ S(ie, [["__scopeId", "data-v-db34d4b4"]]), ce = {};
151
- function re(t, e) {
152
- return l(), u(A, null, [
153
- e[0] || (e[0] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
154
- e[1] || (e[1] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
155
- e[2] || (e[2] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
362
+ }), Ge = /* @__PURE__ */ O(Fe, [["__scopeId", "data-v-db34d4b4"]]), Qe = {};
363
+ function je(t, e) {
364
+ return p(), v(x, null, [
365
+ e[0] || (e[0] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
366
+ e[1] || (e[1] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
367
+ e[2] || (e[2] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
156
368
  ], 64);
157
369
  }
158
- const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58"]]), le = { class: "dialog-block-suggestions-container" }, ae = /* @__PURE__ */ _({
370
+ const We = /* @__PURE__ */ O(Qe, [["render", je], ["__scopeId", "data-v-26a64b58"]]), Ye = { class: "dialog-block-suggestions-container" }, ze = /* @__PURE__ */ y({
159
371
  __name: "DialogBlockSuggestionsContainer",
160
372
  props: {
161
373
  client: {},
@@ -167,8 +379,8 @@ const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58
167
379
  },
168
380
  setup(t) {
169
381
  const e = t;
170
- return (o, n) => (l(), u("div", le, [
171
- e.isLoading || !e.questions ? (l(), k(de, { key: 0 })) : (l(), k(se, {
382
+ return (o, n) => (p(), v("div", Ye, [
383
+ e.isLoading || !e.questions ? (p(), M(We, { key: 0 })) : (p(), M(Ge, {
172
384
  key: 1,
173
385
  client: e.client,
174
386
  questions: e.questions,
@@ -178,30 +390,30 @@ const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58
178
390
  }, null, 8, ["client", "questions", "product-id", "product-title", "selected-variant-id"]))
179
391
  ]));
180
392
  }
181
- }), ue = /* @__PURE__ */ S(ae, [["__scopeId", "data-v-18c9e78b"]]), _e = {
393
+ }), Xe = /* @__PURE__ */ O(ze, [["__scopeId", "data-v-18c9e78b"]]), Ze = {
182
394
  width: "20",
183
395
  height: "20",
184
396
  viewBox: "0 0 20 20",
185
397
  fill: "none",
186
398
  xmlns: "http://www.w3.org/2000/svg"
187
- }, pe = ["stroke"], ge = /* @__PURE__ */ _({
399
+ }, Je = ["stroke"], et = /* @__PURE__ */ y({
188
400
  __name: "ArrowIcon",
189
401
  props: {
190
402
  color: {}
191
403
  },
192
404
  setup(t) {
193
405
  const e = t;
194
- return (o, n) => (l(), u("svg", _e, [
195
- c("path", {
406
+ return (o, n) => (p(), v("svg", Ze, [
407
+ l("path", {
196
408
  d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
197
409
  stroke: e.color || "#ffffff",
198
410
  "stroke-width": "1.5",
199
411
  "stroke-linecap": "round",
200
412
  "stroke-linejoin": "round"
201
- }, null, 8, pe)
413
+ }, null, 8, Je)
202
414
  ]));
203
415
  }
204
- }), Ce = ["placeholder"], he = ["disabled"], Se = /* @__PURE__ */ _({
416
+ }), tt = ["placeholder"], ot = ["disabled"], nt = /* @__PURE__ */ y({
205
417
  __name: "DialogInput",
206
418
  props: {
207
419
  client: {},
@@ -211,93 +423,93 @@ const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58
211
423
  selectedVariantId: {}
212
424
  },
213
425
  setup(t) {
214
- const e = t, o = m(), n = m(""), a = () => {
215
- var r;
216
- (r = o.value) == null || r.focus();
217
- }, i = () => {
218
- const r = n.value;
219
- r.trim() && (e.client.sendProductMessage({
426
+ const e = t, o = A(), n = A(""), a = () => {
427
+ var i;
428
+ (i = o.value) == null || i.focus();
429
+ }, r = () => {
430
+ const i = n.value;
431
+ i.trim() && (e.client.sendProductMessage({
220
432
  productId: e.productId,
221
433
  productTitle: e.productTitle,
222
434
  selectedVariantId: e.selectedVariantId,
223
- question: r,
435
+ question: i,
224
436
  fromQuestionSuggestion: !0
225
437
  }), n.value = "");
226
438
  };
227
- return (r, d) => (l(), u("div", {
439
+ return (i, s) => (p(), v("div", {
228
440
  class: "dialog-input-wrapper",
229
441
  onClick: a
230
442
  }, [
231
- O(c("input", {
443
+ Z(l("input", {
232
444
  id: "dialog-ask-anything-input-ai-input",
233
445
  ref_key: "inputRef",
234
446
  ref: o,
235
- "onUpdate:modelValue": d[0] || (d[0] = (p) => n.value = p),
447
+ "onUpdate:modelValue": s[0] || (s[0] = (_) => n.value = _),
236
448
  class: "dialog-ask-anything-input-ai-input",
237
449
  placeholder: e.placeholder ?? "Ask anything...",
238
- onKeydown: y(i, ["enter"])
239
- }, null, 40, Ce), [
240
- [U, n.value]
450
+ onKeydown: ie(r, ["enter"])
451
+ }, null, 40, tt), [
452
+ [J, n.value]
241
453
  ]),
242
- c("button", {
454
+ l("button", {
243
455
  id: "send-message-button-ai-input",
244
456
  class: "dialog-input-submit",
245
457
  disabled: !n.value.trim(),
246
- onClick: i
458
+ onClick: r
247
459
  }, [
248
- v(ge, {
460
+ D(et, {
249
461
  color: e.client.theme.ctaTextColor
250
462
  }, null, 8, ["color"])
251
- ], 8, he)
463
+ ], 8, ot)
252
464
  ]));
253
465
  }
254
- }), me = /* @__PURE__ */ S(Se, [["__scopeId", "data-v-4f5901c9"]]), fe = /* @__PURE__ */ _({
466
+ }), st = /* @__PURE__ */ O(nt, [["__scopeId", "data-v-4f5901c9"]]), rt = /* @__PURE__ */ y({
255
467
  __name: "ThemeProvider",
256
468
  props: {
257
469
  theme: {}
258
470
  },
259
471
  setup(t) {
260
- const e = t, o = document.body, n = (i) => i.replace(/([A-Z])/g, "-$1").toLowerCase(), a = (i) => {
261
- i && Object.keys(i).forEach((r) => {
262
- const d = r, p = n(r);
263
- if (i[d] !== void 0) {
264
- if (typeof i[d] == "object") {
265
- Object.keys(i[d]).forEach((C) => {
266
- var g;
267
- const s = C;
268
- if (s !== void 0) {
269
- const f = n(C), D = i[d];
472
+ const e = t, o = document.body, n = (r) => r.replace(/([A-Z])/g, "-$1").toLowerCase(), a = (r) => {
473
+ r && Object.keys(r).forEach((i) => {
474
+ const s = i, _ = n(i);
475
+ if (r[s] !== void 0) {
476
+ if (typeof r[s] == "object") {
477
+ Object.keys(r[s]).forEach((f) => {
478
+ var d;
479
+ const u = f;
480
+ if (u !== void 0) {
481
+ const S = n(f), E = r[s];
270
482
  o.style.setProperty(
271
- `--dialog-theme-${p}-${f}`,
272
- (g = D[s]) == null ? void 0 : g.toString()
483
+ `--dialog-theme-${_}-${S}`,
484
+ (d = E[u]) == null ? void 0 : d.toString()
273
485
  );
274
486
  }
275
487
  });
276
488
  return;
277
489
  }
278
- if (d === "ctaBorderType") {
279
- const C = i[d] === "rounded" ? "24px" : "0";
280
- o.style.setProperty(`--dialog-theme-${p}`, C);
490
+ if (s === "ctaBorderType") {
491
+ const f = r[s] === "rounded" ? "24px" : "0";
492
+ o.style.setProperty(`--dialog-theme-${_}`, f);
281
493
  return;
282
494
  }
283
495
  o.style.setProperty(
284
- `--dialog-theme-${p}`,
285
- i[d].toString()
496
+ `--dialog-theme-${_}`,
497
+ r[s].toString()
286
498
  );
287
499
  }
288
500
  });
289
501
  };
290
- return b(() => {
502
+ return H(() => {
291
503
  e.theme && a(e.theme);
292
- }), L(
504
+ }), q(
293
505
  () => e.theme,
294
- (i) => {
295
- i && a(i);
506
+ (r) => {
507
+ r && a(r);
296
508
  },
297
509
  { deep: !0 }
298
- ), (i, r) => $(i.$slots, "default");
510
+ ), (r, i) => ae(r.$slots, "default");
299
511
  }
300
- }), Te = ["dir"], ve = /* @__PURE__ */ _({
512
+ }), it = ["dir"], at = /* @__PURE__ */ y({
301
513
  __name: "DialogProductBlock",
302
514
  props: {
303
515
  client: {},
@@ -308,85 +520,488 @@ const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58
308
520
  },
309
521
  setup(t) {
310
522
  const e = t;
311
- b(() => {
312
- F({
523
+ H(() => {
524
+ oe({
313
525
  method: "vue",
314
- version: "3.2.0"
315
- }), G("pdp-block");
526
+ version: "3.4.0"
527
+ }), be("pdp-block");
316
528
  });
317
- const o = m(!0), n = m(void 0), a = m(0), i = T(() => {
318
- var s;
319
- return o.value ? "" : (s = n.value) == null ? void 0 : s.assistantName;
320
- }), r = T(() => {
321
- var s;
322
- return o.value ? "" : (s = n.value) == null ? void 0 : s.description;
323
- }), d = T(() => {
324
- var s;
325
- return o.value ? "" : (s = n.value) == null ? void 0 : s.inputPlaceholder;
326
- }), p = T(
529
+ const o = A(!0), n = A(void 0), a = A(0), r = T(() => {
530
+ var u;
531
+ return o.value ? "" : (u = n.value) == null ? void 0 : u.assistantName;
532
+ }), i = T(() => {
533
+ var u;
534
+ return o.value ? "" : (u = n.value) == null ? void 0 : u.description;
535
+ }), s = T(() => {
536
+ var u;
537
+ return o.value ? "" : (u = n.value) == null ? void 0 : u.inputPlaceholder;
538
+ }), _ = T(
327
539
  () => {
328
- var s;
329
- return M(
330
- (s = e.client.getLocalizationInformations()) == null ? void 0 : s.languageCode
540
+ var u;
541
+ return ge(
542
+ (u = e.client.getLocalizationInformations()) == null ? void 0 : u.languageCode
331
543
  );
332
544
  }
333
- ), C = async () => {
334
- const s = ++a.value;
545
+ ), f = async () => {
546
+ const u = ++a.value;
335
547
  o.value = !0, n.value = void 0;
336
548
  try {
337
- const g = await e.client.getSuggestions(e.productId);
338
- s === a.value && (n.value = g);
339
- } catch (g) {
340
- console.error("error", g);
549
+ const d = await e.client.getSuggestions(e.productId);
550
+ u === a.value && (n.value = d);
551
+ } catch (d) {
552
+ console.error("error", d);
341
553
  } finally {
342
- s === a.value && (o.value = !1);
554
+ u === a.value && (o.value = !1);
343
555
  }
344
556
  };
345
- return L(
557
+ return q(
346
558
  () => [e.client, e.productId],
347
559
  () => {
348
- C();
560
+ f();
349
561
  },
350
562
  { immediate: !0 }
351
- ), (s, g) => (l(), k(fe, {
563
+ ), (u, d) => (p(), M(rt, {
352
564
  theme: e.client.theme
353
565
  }, {
354
- default: K(() => {
355
- var f;
566
+ default: ce(() => {
567
+ var S;
356
568
  return [
357
- c("div", {
569
+ l("div", {
358
570
  id: "dialog-instant",
359
571
  class: "dialog-block-container",
360
- dir: p.value
572
+ dir: _.value
361
573
  }, [
362
- v(z, {
363
- title: i.value,
364
- description: r.value
574
+ D(Ue, {
575
+ title: r.value,
576
+ description: i.value
365
577
  }, null, 8, ["title", "description"]),
366
- v(ue, {
578
+ D(Xe, {
367
579
  client: e.client,
368
- questions: (f = n.value) == null ? void 0 : f.questions,
580
+ questions: (S = n.value) == null ? void 0 : S.questions,
369
581
  "is-loading": o.value,
370
582
  "product-id": e.productId,
371
583
  "product-title": e.productTitle,
372
584
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
373
585
  }, null, 8, ["client", "questions", "is-loading", "product-id", "product-title", "selected-variant-id"]),
374
- e.enableInput ? (l(), k(me, {
586
+ e.enableInput ? (p(), M(st, {
375
587
  key: 0,
376
588
  client: e.client,
377
- placeholder: d.value,
589
+ placeholder: s.value,
378
590
  "product-id": e.productId,
379
591
  "product-title": e.productTitle,
380
592
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
381
- }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : B("", !0)
382
- ], 8, Te)
593
+ }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : N("", !0)
594
+ ], 8, it)
383
595
  ];
384
596
  }),
385
597
  _: 1
386
598
  }, 8, ["theme"]));
387
599
  }
388
- }), Ee = /* @__PURE__ */ S(ve, [["__scopeId", "data-v-c57aa677"]]);
600
+ }), jt = /* @__PURE__ */ O(at, [["__scopeId", "data-v-c57aa677"]]), ct = {}, lt = {
601
+ width: "16",
602
+ height: "16",
603
+ viewBox: "0 0 16 16",
604
+ fill: "none",
605
+ xmlns: "http://www.w3.org/2000/svg",
606
+ "aria-hidden": "true"
607
+ };
608
+ function ut(t, e) {
609
+ return p(), v("svg", lt, e[0] || (e[0] = [
610
+ l("path", {
611
+ d: "M8 13V3M8 3L3 8M8 3L13 8",
612
+ stroke: "currentColor",
613
+ "stroke-width": "1.5",
614
+ "stroke-linecap": "round",
615
+ "stroke-linejoin": "round"
616
+ }, null, -1)
617
+ ]));
618
+ }
619
+ const dt = /* @__PURE__ */ O(ct, [["render", ut]]), pt = {
620
+ width: "16",
621
+ height: "16",
622
+ viewBox: "0 0 12 12",
623
+ fill: "none",
624
+ xmlns: "http://www.w3.org/2000/svg",
625
+ "aria-hidden": "true"
626
+ }, _t = ["fill"], ht = "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", ft = /* @__PURE__ */ y({
627
+ __name: "ShurikenIcon",
628
+ props: {
629
+ color: {}
630
+ },
631
+ setup(t) {
632
+ const e = t;
633
+ return (o, n) => (p(), v("svg", pt, [
634
+ l("path", {
635
+ d: ht,
636
+ fill: e.color || "currentColor"
637
+ }, null, 8, _t)
638
+ ]));
639
+ }
640
+ }), gt = { class: "dialog-search-bar-field" }, vt = { class: "dialog-search-bar-icon" }, mt = ["aria-label", "placeholder", "autofocus"], St = ["aria-label"], Wt = /* @__PURE__ */ y({
641
+ __name: "DialogSearchBar",
642
+ props: {
643
+ controller: {},
644
+ placeholder: { default: "Search products..." },
645
+ autoFocus: { type: Boolean, default: !1 },
646
+ submitAriaLabel: { default: "Search" }
647
+ },
648
+ setup(t) {
649
+ const e = t, o = A(""), n = () => {
650
+ e.controller.setQuery(o.value);
651
+ }, a = () => {
652
+ e.controller.submit(o.value);
653
+ };
654
+ return (r, i) => (p(), v("form", {
655
+ class: "dialog-search-bar",
656
+ role: "search",
657
+ onSubmit: le(a, ["prevent"])
658
+ }, [
659
+ l("div", gt, [
660
+ l("span", vt, [
661
+ D(ft)
662
+ ]),
663
+ Z(l("input", {
664
+ "onUpdate:modelValue": i[0] || (i[0] = (s) => o.value = s),
665
+ type: "text",
666
+ name: "dialog-search-query",
667
+ class: "dialog-search-bar-input",
668
+ "aria-label": e.placeholder,
669
+ placeholder: e.placeholder,
670
+ autofocus: e.autoFocus,
671
+ onInput: n
672
+ }, null, 40, mt), [
673
+ [J, o.value]
674
+ ])
675
+ ]),
676
+ l("button", {
677
+ type: "submit",
678
+ class: "dialog-search-bar-submit",
679
+ "aria-label": e.submitAriaLabel
680
+ }, [
681
+ D(dt)
682
+ ], 8, St)
683
+ ], 32));
684
+ }
685
+ }), Ct = {
686
+ key: 0,
687
+ "aria-label": "Search results pages",
688
+ class: "dialog-search-pagination"
689
+ }, bt = ["disabled"], Et = ["disabled"], Rt = /* @__PURE__ */ y({
690
+ __name: "DialogSearchPagination",
691
+ props: {
692
+ controller: {},
693
+ state: {}
694
+ },
695
+ setup(t) {
696
+ const e = t, o = T(() => e.state.response);
697
+ return (n, a) => o.value !== void 0 && o.value.nbPages > 1 ? (p(), v("nav", Ct, [
698
+ l("button", {
699
+ type: "button",
700
+ disabled: o.value.page === 0,
701
+ onClick: a[0] || (a[0] = (r) => e.controller.setPage(o.value.page - 1))
702
+ }, " Previous ", 8, bt),
703
+ l("span", null, " Page " + I(o.value.page + 1) + " / " + I(o.value.nbPages), 1),
704
+ l("button", {
705
+ type: "button",
706
+ disabled: o.value.page >= o.value.nbPages - 1,
707
+ onClick: a[1] || (a[1] = (r) => e.controller.setPage(o.value.page + 1))
708
+ }, " Next ", 8, Et)
709
+ ])) : N("", !0);
710
+ }
711
+ }), F = ({ amount: t, currencyCode: e }, o) => new Intl.NumberFormat(o, {
712
+ style: "currency",
713
+ currency: e
714
+ }).format(Number(t)), ne = ({ min: t, max: e }, o) => t.amount === e.amount ? F(t, o) : `${F(t, o)} – ${F(e, o)}`, Tt = (t, e) => {
715
+ if (t === void 0)
716
+ return "";
717
+ try {
718
+ return ne(t, e);
719
+ } catch {
720
+ return "";
721
+ }
722
+ }, yt = (t, e) => {
723
+ const o = t.priceRange, n = t.compareAtPriceRange;
724
+ if (o === void 0 || n === void 0 || Number(n.min.amount) <= Number(o.min.amount))
725
+ return "";
726
+ try {
727
+ return ne(n, e);
728
+ } catch {
729
+ return "";
730
+ }
731
+ }, It = (t) => {
732
+ try {
733
+ const { protocol: e } = new URL(t, window.location.href);
734
+ return e === "http:" || e === "https:" ? t : void 0;
735
+ } catch {
736
+ return;
737
+ }
738
+ }, kt = { class: "dialog-search-card-image" }, wt = ["src", "alt"], At = { class: "dialog-search-card-info" }, Lt = { class: "dialog-search-card-title" }, $t = {
739
+ key: 0,
740
+ class: "dialog-search-card-price"
741
+ }, Dt = {
742
+ key: 0,
743
+ class: "dialog-search-card-compare-at"
744
+ }, Y = /* @__PURE__ */ y({
745
+ __name: "DialogSearchProductCardContent",
746
+ props: {
747
+ hit: {},
748
+ locale: {}
749
+ },
750
+ setup(t) {
751
+ const e = t, o = T(() => e.hit.product.title ?? e.hit.product.id), n = T(
752
+ () => Tt(e.hit.product.priceRange, e.locale)
753
+ ), a = T(
754
+ () => yt(e.hit.product, e.locale)
755
+ );
756
+ return (r, i) => (p(), v(x, null, [
757
+ l("div", kt, [
758
+ e.hit.product.imageUrl !== void 0 ? (p(), v("img", {
759
+ key: 0,
760
+ src: e.hit.product.imageUrl,
761
+ alt: o.value,
762
+ loading: "lazy"
763
+ }, null, 8, wt)) : N("", !0)
764
+ ]),
765
+ l("div", At, [
766
+ l("p", Lt, I(o.value), 1),
767
+ n.value !== "" ? (p(), v("p", $t, [
768
+ ue(I(n.value), 1),
769
+ a.value !== "" ? (p(), v("s", Dt, I(" " + a.value), 1)) : N("", !0)
770
+ ])) : N("", !0)
771
+ ])
772
+ ], 64));
773
+ }
774
+ }), Pt = {
775
+ key: 0,
776
+ class: "dialog-search-card-body"
777
+ }, Nt = ["href"], Ot = /* @__PURE__ */ y({
778
+ __name: "DialogSearchProductCard",
779
+ props: {
780
+ controller: {},
781
+ hit: {},
782
+ index: {},
783
+ locale: {}
784
+ },
785
+ setup(t) {
786
+ const e = t, o = A();
787
+ q(
788
+ () => e.hit,
789
+ () => {
790
+ o.value !== void 0 && e.controller.observeResult(o.value, e.index);
791
+ },
792
+ { immediate: !0, flush: "post" }
793
+ );
794
+ const n = (i) => {
795
+ const s = i.metaKey || i.ctrlKey || i.shiftKey || i.altKey;
796
+ e.controller.selectResult(e.index, { navigate: !s }) && i.preventDefault();
797
+ }, a = (i) => {
798
+ i.button === 1 && e.controller.selectResult(e.index, { navigate: !1 });
799
+ }, r = T(
800
+ () => e.hit.product.url === void 0 ? void 0 : It(e.hit.product.url)
801
+ );
802
+ return (i, s) => (p(), v("li", {
803
+ ref_key: "cardRef",
804
+ ref: o,
805
+ class: "dialog-search-card"
806
+ }, [
807
+ r.value === void 0 ? (p(), v("div", Pt, [
808
+ D(Y, {
809
+ hit: e.hit,
810
+ locale: e.locale
811
+ }, null, 8, ["hit", "locale"])
812
+ ])) : (p(), v("a", {
813
+ key: 1,
814
+ class: "dialog-search-card-body",
815
+ href: r.value,
816
+ onClick: n,
817
+ onAuxclick: a
818
+ }, [
819
+ D(Y, {
820
+ hit: e.hit,
821
+ locale: e.locale
822
+ }, null, 8, ["hit", "locale"])
823
+ ], 40, Nt))
824
+ ], 512));
825
+ }
826
+ }), Ut = (t) => {
827
+ const e = A(), o = A(void 0), n = A(0);
828
+ return q(
829
+ t,
830
+ (a, r, i) => {
831
+ if (!a)
832
+ return;
833
+ const s = () => {
834
+ const _ = e.value;
835
+ if (_ === void 0)
836
+ return;
837
+ const f = _.previousElementSibling ?? _, { top: u, bottom: d, left: S, width: E } = f.getBoundingClientRect();
838
+ n.value = window.innerHeight;
839
+ const c = o.value;
840
+ (c === void 0 || c.top !== u || c.bottom !== d || c.left !== S || c.width !== E) && (o.value = { top: u, bottom: d, left: S, width: E });
841
+ };
842
+ s(), window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), i(() => {
843
+ window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
844
+ });
845
+ },
846
+ { immediate: !0, flush: "post" }
847
+ ), { anchorRef: e, rect: o, viewportHeight: n };
848
+ }, xt = (t, e) => {
849
+ const o = A(!1), n = A(), a = T(
850
+ () => t.value.status !== w.IDLE && !o.value
851
+ );
852
+ q(
853
+ () => t.value.query,
854
+ () => {
855
+ o.value = !1;
856
+ }
857
+ ), q(
858
+ a,
859
+ (i, s, _) => {
860
+ if (!i)
861
+ return;
862
+ const f = (u) => {
863
+ var b, R;
864
+ const d = u.target;
865
+ if (!(d instanceof Node))
866
+ return;
867
+ const S = (b = e.value) == null ? void 0 : b.previousElementSibling, E = ((R = n.value) == null ? void 0 : R.contains(d)) ?? !1, c = (S == null ? void 0 : S.contains(d)) ?? !1;
868
+ !E && !c && (o.value = !0);
869
+ };
870
+ document.addEventListener("pointerdown", f), _(
871
+ () => document.removeEventListener("pointerdown", f)
872
+ );
873
+ },
874
+ { immediate: !0 }
875
+ );
876
+ const r = () => {
877
+ o.value = !1;
878
+ };
879
+ return H(() => {
880
+ var i, s;
881
+ (s = (i = e.value) == null ? void 0 : i.previousElementSibling) == null || s.addEventListener(
882
+ "focusin",
883
+ r
884
+ );
885
+ }), ee(() => {
886
+ var i, s;
887
+ (s = (i = e.value) == null ? void 0 : i.previousElementSibling) == null || s.removeEventListener(
888
+ "focusin",
889
+ r
890
+ );
891
+ }), { isOpen: a, panelRef: n };
892
+ }, Mt = {
893
+ key: 0,
894
+ role: "status",
895
+ class: "dialog-search-status"
896
+ }, qt = {
897
+ key: 1,
898
+ class: "dialog-search-error"
899
+ }, Bt = {
900
+ role: "alert",
901
+ class: "dialog-search-status dialog-search-status-error"
902
+ }, Vt = {
903
+ key: 2,
904
+ role: "status",
905
+ class: "dialog-search-status"
906
+ }, Ht = {
907
+ role: "status",
908
+ class: "dialog-search-status"
909
+ }, Kt = { class: "dialog-search-results" }, V = 8, z = 16, Ft = 200, Yt = /* @__PURE__ */ y({
910
+ __name: "DialogSearchResults",
911
+ props: {
912
+ controller: {},
913
+ state: {},
914
+ locale: {}
915
+ },
916
+ setup(t) {
917
+ const e = t, o = (c) => c instanceof ve ? `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) => {
918
+ const R = b - c.bottom - V - z, L = c.top - V - z, h = { left: `${c.left}px`, width: `${c.width}px` };
919
+ return R < Ft && L > R ? {
920
+ ...h,
921
+ bottom: `${b - c.top + V}px`,
922
+ maxHeight: `${Math.max(L, 0)}px`
923
+ } : {
924
+ ...h,
925
+ top: `${c.bottom + V}px`,
926
+ maxHeight: `${Math.max(R, 0)}px`
927
+ };
928
+ }, r = T(() => e.state), i = T(() => e.state.status !== w.IDLE), { anchorRef: s, rect: _, viewportHeight: f } = Ut(i), { isOpen: u, panelRef: d } = xt(r, s), S = T(
929
+ () => u.value && _.value !== void 0 && n(_.value, f.value)
930
+ ), E = T(
931
+ () => _.value === void 0 ? void 0 : a(_.value, f.value)
932
+ );
933
+ return (c, b) => {
934
+ var R;
935
+ return p(), v(x, null, [
936
+ l("div", {
937
+ ref_key: "anchorRef",
938
+ ref: s
939
+ }, null, 512),
940
+ S.value ? (p(), M(de, {
941
+ key: 0,
942
+ to: "body"
943
+ }, [
944
+ l("div", {
945
+ ref_key: "panelRef",
946
+ ref: d,
947
+ class: "dialog-search-panel",
948
+ style: pe(E.value)
949
+ }, [
950
+ e.state.status === B(w).LOADING ? (p(), v("p", Mt, " Searching “" + I(e.state.query) + "”… ", 1)) : e.state.status === B(w).ERROR ? (p(), v("div", qt, [
951
+ l("p", Bt, I(o(e.state.error)), 1),
952
+ l("button", {
953
+ type: "button",
954
+ class: "dialog-search-retry",
955
+ onClick: b[0] || (b[0] = (L) => e.controller.retry())
956
+ }, " Retry ")
957
+ ])) : e.state.status === B(w).EMPTY ? (p(), v("p", Vt, " No products match “" + I((R = e.state.response) == null ? void 0 : R.query) + "”. ", 1)) : e.state.status === B(w).SUCCESS && e.state.response !== void 0 ? (p(), v(x, { key: 3 }, [
958
+ l("p", Ht, I(e.state.response.nbHits) + " result" + I(e.state.response.nbHits > 1 ? "s" : ""), 1),
959
+ l("ul", Kt, [
960
+ (p(!0), v(x, null, X(e.state.response.hits, (L, h) => (p(), M(Ot, {
961
+ key: L.id,
962
+ controller: e.controller,
963
+ hit: L,
964
+ index: h,
965
+ locale: e.locale
966
+ }, null, 8, ["controller", "hit", "index", "locale"]))), 128))
967
+ ]),
968
+ D(Rt, {
969
+ controller: e.controller,
970
+ state: e.state
971
+ }, null, 8, ["controller", "state"])
972
+ ], 64)) : N("", !0)
973
+ ], 4)
974
+ ])) : N("", !0)
975
+ ], 64);
976
+ };
977
+ }
978
+ }), zt = (t) => {
979
+ const { client: e, surface: o = "search_page", ...n } = t, a = $e({
980
+ search: (s, _) => e.search(s, _),
981
+ analytics: {
982
+ surface: o,
983
+ trackViewSearchResults: (s) => e.trackViewSearchResults(s),
984
+ trackSelectSearchResult: (s) => e.trackSelectSearchResult(s)
985
+ },
986
+ ...n
987
+ }), r = _e(a.getState()), i = a.subscribe(() => {
988
+ r.value = a.getState();
989
+ });
990
+ return H(() => {
991
+ oe({
992
+ method: "vue",
993
+ version: "3.4.0"
994
+ });
995
+ }), ee(() => {
996
+ i(), a.dispose();
997
+ }), { controller: a, state: r };
998
+ };
389
999
  export {
390
- me as DialogInput,
391
- Ee as DialogProductBlock
1000
+ st as DialogInput,
1001
+ jt as DialogProductBlock,
1002
+ Wt as DialogSearchBar,
1003
+ Rt as DialogSearchPagination,
1004
+ Ot as DialogSearchProductCard,
1005
+ Yt as DialogSearchResults,
1006
+ zt as useDialogSearch
392
1007
  };