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