@searchcraft/javascript-sdk 0.9.5 → 0.9.6

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 (38) hide show
  1. package/dist/components/bundled.types.d.ts +32 -2
  2. package/dist/components/index.js +5 -5
  3. package/dist/components/{p-c3cc2fc3.js → p-0bbc3aff.js} +2 -2
  4. package/dist/components/{p-c3cc2fc3.js.map → p-0bbc3aff.js.map} +1 -1
  5. package/dist/components/{p-70f5d28f.js → p-10b0d0dc.js} +43 -7
  6. package/dist/components/p-10b0d0dc.js.map +1 -0
  7. package/dist/components/{p-39be2b10.js → p-2e293015.js} +270 -240
  8. package/dist/components/p-2e293015.js.map +1 -0
  9. package/dist/components/{p-8a4f8203.js → p-44e6ed36.js} +2 -2
  10. package/dist/components/{p-8a4f8203.js.map → p-44e6ed36.js.map} +1 -1
  11. package/dist/components/{p-52edbc31.js → p-94837dcb.js} +4 -4
  12. package/dist/components/{p-52edbc31.js.map → p-94837dcb.js.map} +1 -1
  13. package/dist/components/{p-fee8c484.js → p-9bdcb929.js} +2 -2
  14. package/dist/components/{p-fee8c484.js.map → p-9bdcb929.js.map} +1 -1
  15. package/dist/components/{p-ffb05b5b.js → p-bb9e9d7d.js} +2 -2
  16. package/dist/components/{p-ffb05b5b.js.map → p-bb9e9d7d.js.map} +1 -1
  17. package/dist/components/{p-d3351811.js → p-c1c14447.js} +2 -2
  18. package/dist/components/{p-d3351811.js.map → p-c1c14447.js.map} +1 -1
  19. package/dist/components/searchcraft-ad.js +1 -1
  20. package/dist/components/searchcraft-base-search-result.js +1 -1
  21. package/dist/components/searchcraft-base-search-results.js +5 -5
  22. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  23. package/dist/components/searchcraft-facet-list.js +1 -1
  24. package/dist/components/searchcraft-filter-panel.js +3 -3
  25. package/dist/components/searchcraft-input-form.js +1 -1
  26. package/dist/components/searchcraft-pagination.js +1 -1
  27. package/dist/components/searchcraft-popover-button.js +1 -1
  28. package/dist/components/searchcraft-popover-form.js +5 -5
  29. package/dist/components/searchcraft-popover-list-item.js +1 -1
  30. package/dist/components/searchcraft-popover-list-view.js +1 -1
  31. package/dist/components/searchcraft-results-info.js +1 -1
  32. package/dist/components/searchcraft-search-results-per-page.js +1 -1
  33. package/dist/components/searchcraft-toggle-button.js +1 -1
  34. package/dist/types/components/searchcraft-ad/searchcraft-ad.d.ts +6 -2
  35. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +1 -1
  36. package/package.json +3 -3
  37. package/dist/components/p-39be2b10.js.map +0 -1
  38. package/dist/components/p-70f5d28f.js.map +0 -1
@@ -1,15 +1,15 @@
1
- var L = Object.defineProperty;
2
- var q = (n, e, r) => e in n ? L(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r;
3
- var h = (n, e, r) => q(n, typeof e != "symbol" ? e + "" : e, r);
4
- var P = /* @__PURE__ */ ((n) => (n[n.DEBUG = 0] = "DEBUG", n[n.INFO = 1] = "INFO", n[n.WARN = 2] = "WARN", n[n.ERROR = 3] = "ERROR", n))(P || {});
5
- class pe {
1
+ var B = Object.defineProperty;
2
+ var q = (r, e, n) => e in r ? B(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
+ var h = (r, e, n) => q(r, typeof e != "symbol" ? e + "" : e, n);
4
+ var P = /* @__PURE__ */ ((r) => (r[r.DEBUG = 0] = "DEBUG", r[r.INFO = 1] = "INFO", r[r.WARN = 2] = "WARN", r[r.ERROR = 3] = "ERROR", r))(P || {});
5
+ class ve {
6
6
  constructor(e) {
7
7
  h(this, "logLevel");
8
8
  h(this, "logFormatter");
9
9
  this.logLevel = e.logLevel || 1, this.logFormatter = e.logFormatter || this.defaultFormatter;
10
10
  }
11
- defaultFormatter(e, r) {
12
- return `[${P[e]}] ${( new Date()).toISOString()}: ${r}`;
11
+ defaultFormatter(e, n) {
12
+ return `[${P[e]}] ${( new Date()).toISOString()}: ${n}`;
13
13
  }
14
14
  debug(e) {
15
15
  this.logLevel <= 0 && console.log(this.logFormatter(0, e));
@@ -23,25 +23,25 @@ class pe {
23
23
  error(e) {
24
24
  this.logLevel <= 3 && console.error(this.logFormatter(3, e));
25
25
  }
26
- log(e, r) {
26
+ log(e, n) {
27
27
  switch (e) {
28
28
  case 0:
29
- this.debug(r);
29
+ this.debug(n);
30
30
  break;
31
31
  case 1:
32
- this.info(r);
32
+ this.info(n);
33
33
  break;
34
34
  case 2:
35
- this.warn(r);
35
+ this.warn(n);
36
36
  break;
37
37
  case 3:
38
- this.error(r);
38
+ this.error(n);
39
39
  break;
40
40
  }
41
41
  }
42
42
  }
43
- function w(n, e, r, o) {
44
- return new (r || (r = Promise))(function(i, a) {
43
+ function w(r, e, n, o) {
44
+ return new (n || (n = Promise))(function(i, a) {
45
45
  function t(c) {
46
46
  try {
47
47
  l(o.next(c));
@@ -58,15 +58,15 @@ function w(n, e, r, o) {
58
58
  }
59
59
  function l(c) {
60
60
  var s;
61
- c.done ? i(c.value) : (s = c.value, s instanceof r ? s : new r(function(f) {
61
+ c.done ? i(c.value) : (s = c.value, s instanceof n ? s : new n(function(f) {
62
62
  f(s);
63
63
  })).then(t, u);
64
64
  }
65
- l((o = o.apply(n, [])).next());
65
+ l((o = o.apply(r, [])).next());
66
66
  });
67
67
  }
68
- function y(n, e) {
69
- var r, o, i, a, t = { label: 0, sent: function() {
68
+ function y(r, e) {
69
+ var n, o, i, a, t = { label: 0, sent: function() {
70
70
  if (1 & i[0]) throw i[1];
71
71
  return i[1];
72
72
  }, trys: [], ops: [] };
@@ -76,9 +76,9 @@ function y(n, e) {
76
76
  function u(l) {
77
77
  return function(c) {
78
78
  return function(s) {
79
- if (r) throw new TypeError("Generator is already executing.");
79
+ if (n) throw new TypeError("Generator is already executing.");
80
80
  for (; a && (a = 0, s[0] && (t = 0)), t; ) try {
81
- if (r = 1, o && (i = 2 & s[0] ? o.return : s[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, s[1])).done) return i;
81
+ if (n = 1, o && (i = 2 & s[0] ? o.return : s[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, s[1])).done) return i;
82
82
  switch (o = 0, i && (s = [2 & s[0], i.value]), s[0]) {
83
83
  case 0:
84
84
  case 1:
@@ -112,11 +112,11 @@ function y(n, e) {
112
112
  i[2] && t.ops.pop(), t.trys.pop();
113
113
  continue;
114
114
  }
115
- s = e.call(n, t);
115
+ s = e.call(r, t);
116
116
  } catch (f) {
117
117
  s = [6, f], o = 0;
118
118
  } finally {
119
- r = i = 0;
119
+ n = i = 0;
120
120
  }
121
121
  if (5 & s[0]) throw s[1];
122
122
  return { value: s[0] ? s[1] : void 0, done: !0 };
@@ -124,33 +124,33 @@ function y(n, e) {
124
124
  };
125
125
  }
126
126
  }
127
- var b = { exclude: [] }, D = {}, N = { timeout: "true" }, v = function(n, e) {
128
- typeof window < "u" && (D[n] = e);
127
+ var b = { exclude: [] }, D = {}, N = { timeout: "true" }, v = function(r, e) {
128
+ typeof window < "u" && (D[r] = e);
129
129
  }, j = function() {
130
- return Object.fromEntries(Object.entries(D).filter(function(n) {
131
- var e, r = n[0];
132
- return !(!((e = b == null ? void 0 : b.exclude) === null || e === void 0) && e.includes(r));
133
- }).map(function(n) {
134
- return [n[0], (0, n[1])()];
130
+ return Object.fromEntries(Object.entries(D).filter(function(r) {
131
+ var e, n = r[0];
132
+ return !(!((e = b == null ? void 0 : b.exclude) === null || e === void 0) && e.includes(n));
133
+ }).map(function(r) {
134
+ return [r[0], (0, r[1])()];
135
135
  }));
136
136
  };
137
- function C(n) {
138
- return n ^= n >>> 16, n = Math.imul(n, 2246822507), n ^= n >>> 13, n = Math.imul(n, 3266489909), (n ^= n >>> 16) >>> 0;
137
+ function C(r) {
138
+ return r ^= r >>> 16, r = Math.imul(r, 2246822507), r ^= r >>> 13, r = Math.imul(r, 3266489909), (r ^= r >>> 16) >>> 0;
139
139
  }
140
140
  var m = new Uint32Array([597399067, 2869860233, 951274213, 2716044179]);
141
- function g(n, e) {
142
- return n << e | n >>> 32 - e;
141
+ function g(r, e) {
142
+ return r << e | r >>> 32 - e;
143
143
  }
144
- function T(n, e) {
145
- var r;
146
- if (e === void 0 && (e = 0), e = e ? 0 | e : 0, typeof n == "string" && (r = n, n = new TextEncoder().encode(r).buffer), !(n instanceof ArrayBuffer)) throw new TypeError("Expected key to be ArrayBuffer or string");
144
+ function M(r, e) {
145
+ var n;
146
+ if (e === void 0 && (e = 0), e = e ? 0 | e : 0, typeof r == "string" && (n = r, r = new TextEncoder().encode(n).buffer), !(r instanceof ArrayBuffer)) throw new TypeError("Expected key to be ArrayBuffer or string");
147
147
  var o = new Uint32Array([e, e, e, e]);
148
148
  ((function(a, t) {
149
149
  for (var u = a.byteLength / 16 | 0, l = new Uint32Array(a, 0, 4 * u), c = 0; c < u; c++) {
150
150
  var s = l.subarray(4 * c, 4 * (c + 1));
151
151
  s[0] = Math.imul(s[0], m[0]), s[0] = g(s[0], 15), s[0] = Math.imul(s[0], m[1]), t[0] = t[0] ^ s[0], t[0] = g(t[0], 19), t[0] = t[0] + t[1], t[0] = Math.imul(t[0], 5) + 1444728091, s[1] = Math.imul(s[1], m[1]), s[1] = g(s[1], 16), s[1] = Math.imul(s[1], m[2]), t[1] = t[1] ^ s[1], t[1] = g(t[1], 17), t[1] = t[1] + t[2], t[1] = Math.imul(t[1], 5) + 197830471, s[2] = Math.imul(s[2], m[2]), s[2] = g(s[2], 17), s[2] = Math.imul(s[2], m[3]), t[2] = t[2] ^ s[2], t[2] = g(t[2], 15), t[2] = t[2] + t[3], t[2] = Math.imul(t[2], 5) + 2530024501, s[3] = Math.imul(s[3], m[3]), s[3] = g(s[3], 18), s[3] = Math.imul(s[3], m[0]), t[3] = t[3] ^ s[3], t[3] = g(t[3], 13), t[3] = t[3] + t[0], t[3] = Math.imul(t[3], 5) + 850148119;
152
152
  }
153
- }))(n, o), function(a, t) {
153
+ }))(r, o), function(a, t) {
154
154
  var u = a.byteLength / 16 | 0, l = a.byteLength % 16, c = new Uint32Array(4), s = new Uint8Array(a, 16 * u, l);
155
155
  switch (l) {
156
156
  case 15:
@@ -184,35 +184,35 @@ function T(n, e) {
184
184
  case 1:
185
185
  c[0] = c[0] ^ s[0] << 0, c[0] = Math.imul(c[0], m[0]), c[0] = g(c[0], 15), c[0] = Math.imul(c[0], m[1]), t[0] = t[0] ^ c[0];
186
186
  }
187
- }(n, o), function(a, t) {
187
+ }(r, o), function(a, t) {
188
188
  t[0] = t[0] ^ a.byteLength, t[1] = t[1] ^ a.byteLength, t[2] = t[2] ^ a.byteLength, t[3] = t[3] ^ a.byteLength, t[0] = t[0] + t[1] | 0, t[0] = t[0] + t[2] | 0, t[0] = t[0] + t[3] | 0, t[1] = t[1] + t[0] | 0, t[2] = t[2] + t[0] | 0, t[3] = t[3] + t[0] | 0, t[0] = C(t[0]), t[1] = C(t[1]), t[2] = C(t[2]), t[3] = C(t[3]), t[0] = t[0] + t[1] | 0, t[0] = t[0] + t[2] | 0, t[0] = t[0] + t[3] | 0, t[1] = t[1] + t[0] | 0, t[2] = t[2] + t[0] | 0, t[3] = t[3] + t[0] | 0;
189
- }(n, o);
189
+ }(r, o);
190
190
  var i = new Uint8Array(o.buffer);
191
191
  return Array.from(i).map(function(a) {
192
192
  return a.toString(16).padStart(2, "0");
193
193
  }).join("");
194
194
  }
195
- function G(n, e) {
196
- return new Promise(function(r) {
195
+ function V(r, e) {
196
+ return new Promise(function(n) {
197
197
  setTimeout(function() {
198
- return r(e);
199
- }, n);
198
+ return n(e);
199
+ }, r);
200
200
  });
201
201
  }
202
- function W(n, e, r) {
203
- return Promise.all(n.map(function(o) {
204
- return Promise.race([o, G(e, r)]);
202
+ function G(r, e, n) {
203
+ return Promise.all(r.map(function(o) {
204
+ return Promise.race([o, V(e, n)]);
205
205
  }));
206
206
  }
207
- function V() {
207
+ function W() {
208
208
  return w(this, void 0, void 0, function() {
209
- var n, e, r, o, i;
209
+ var r, e, n, o, i;
210
210
  return y(this, function(a) {
211
211
  switch (a.label) {
212
212
  case 0:
213
- return a.trys.push([0, 2, , 3]), n = j(), e = Object.keys(n), [4, W(Object.values(n), (b == null ? void 0 : b.timeout) || 1e3, N)];
213
+ return a.trys.push([0, 2, , 3]), r = j(), e = Object.keys(r), [4, G(Object.values(r), (b == null ? void 0 : b.timeout) || 1e3, N)];
214
214
  case 1:
215
- return r = a.sent(), o = r.filter(function(t) {
215
+ return n = a.sent(), o = n.filter(function(t) {
216
216
  return t !== void 0;
217
217
  }), i = {}, o.forEach(function(t, u) {
218
218
  i[e[u]] = t;
@@ -225,31 +225,31 @@ function V() {
225
225
  });
226
226
  });
227
227
  }
228
- function O(n, e) {
229
- var r = {}, o = function(a) {
230
- if (n.hasOwnProperty(a)) {
231
- var t = n[a];
232
- if (typeof t != "object" || Array.isArray(t)) e.includes(a) || (r[a] = t);
228
+ function O(r, e) {
229
+ var n = {}, o = function(a) {
230
+ if (r.hasOwnProperty(a)) {
231
+ var t = r[a];
232
+ if (typeof t != "object" || Array.isArray(t)) e.includes(a) || (n[a] = t);
233
233
  else {
234
234
  var u = O(t, e.map(function(l) {
235
235
  return l.startsWith(a + ".") ? l.slice(a.length + 1) : l;
236
236
  }));
237
- Object.keys(u).length > 0 && (r[a] = u);
237
+ Object.keys(u).length > 0 && (n[a] = u);
238
238
  }
239
239
  }
240
240
  };
241
- for (var i in n) o(i);
242
- return r;
241
+ for (var i in r) o(i);
242
+ return n;
243
243
  }
244
- function $(n) {
244
+ function $(r) {
245
245
  return w(this, void 0, void 0, function() {
246
- var e, r;
246
+ var e, n;
247
247
  return y(this, function(o) {
248
248
  switch (o.label) {
249
249
  case 0:
250
- return o.trys.push([0, 2, , 3]), [4, V()];
250
+ return o.trys.push([0, 2, , 3]), [4, W()];
251
251
  case 1:
252
- return e = o.sent(), r = T(JSON.stringify(e)), [2, r.toString()];
252
+ return e = o.sent(), n = M(JSON.stringify(e)), [2, n.toString()];
253
253
  case 2:
254
254
  throw o.sent();
255
255
  case 3:
@@ -258,38 +258,38 @@ function $(n) {
258
258
  });
259
259
  });
260
260
  }
261
- function H(n) {
262
- for (var e = 0, r = 0; r < n.length; ++r) e += Math.abs(n[r]);
261
+ function H(r) {
262
+ for (var e = 0, n = 0; n < r.length; ++n) e += Math.abs(r[n]);
263
263
  return e;
264
264
  }
265
- function U(n, e, r) {
266
- for (var o = [], i = 0; i < n[0].data.length; i++) {
267
- for (var a = [], t = 0; t < n.length; t++) a.push(n[t].data[i]);
265
+ function U(r, e, n) {
266
+ for (var o = [], i = 0; i < r[0].data.length; i++) {
267
+ for (var a = [], t = 0; t < r.length; t++) a.push(r[t].data[i]);
268
268
  o.push(Q(a));
269
269
  }
270
270
  var u = new Uint8ClampedArray(o);
271
- return new ImageData(u, e, r);
271
+ return new ImageData(u, e, n);
272
272
  }
273
- function Q(n) {
274
- if (n.length === 0) return 0;
275
- for (var e = {}, r = 0, o = n; r < o.length; r++)
276
- e[a = o[r]] = (e[a] || 0) + 1;
277
- var i = n[0];
273
+ function Q(r) {
274
+ if (r.length === 0) return 0;
275
+ for (var e = {}, n = 0, o = r; n < o.length; n++)
276
+ e[a = o[n]] = (e[a] || 0) + 1;
277
+ var i = r[0];
278
278
  for (var a in e) e[a] > e[i] && (i = parseInt(a, 10));
279
279
  return i;
280
280
  }
281
281
  function E() {
282
282
  if (typeof navigator > "u") return { name: "unknown", version: "unknown" };
283
- for (var n = navigator.userAgent, e = { Edg: "Edge", OPR: "Opera" }, r = 0, o = [/(?<name>Edge|Edg)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Chrome|Chromium|OPR|Opera|Vivaldi|Brave))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Firefox|Waterfox|Iceweasel|IceCat))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>Safari)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)?)/, /(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)?)/]; r < o.length; r++) {
284
- var i = o[r], a = n.match(i);
283
+ for (var r = navigator.userAgent, e = { Edg: "Edge", OPR: "Opera" }, n = 0, o = [/(?<name>Edge|Edg)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Chrome|Chromium|OPR|Opera|Vivaldi|Brave))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Firefox|Waterfox|Iceweasel|IceCat))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>Safari)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)?)/, /(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)?)/]; n < o.length; n++) {
284
+ var i = o[n], a = r.match(i);
285
285
  if (a && a.groups) return { name: e[a.groups.name] || a.groups.name, version: a.groups.version };
286
286
  }
287
287
  return { name: "unknown", version: "unknown" };
288
288
  }
289
289
  v("audio", function() {
290
290
  return w(this, void 0, void 0, function() {
291
- return y(this, function(n) {
292
- return [2, new Promise(function(e, r) {
291
+ return y(this, function(r) {
292
+ return [2, new Promise(function(e, n) {
293
293
  try {
294
294
  var o = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(1, 5e3, 44100), i = o.createBufferSource(), a = o.createOscillator();
295
295
  a.frequency.value = 1e3;
@@ -298,44 +298,44 @@ v("audio", function() {
298
298
  t = l.renderedBuffer.getChannelData(0), e({ sampleHash: H(t), oscillator: a.type, maxChannels: o.destination.maxChannelCount, channelCountMode: i.channelCountMode });
299
299
  }, o.startRendering();
300
300
  } catch (l) {
301
- console.error("Error creating audio fingerprint:", l), r(l);
301
+ console.error("Error creating audio fingerprint:", l), n(l);
302
302
  }
303
303
  })];
304
304
  });
305
305
  });
306
306
  });
307
- var z = E().name !== "SamsungBrowser" ? 1 : 3, x = 280, k = 20;
307
+ var z = E().name !== "SamsungBrowser" ? 1 : 3, x = 280, F = 20;
308
308
  E().name != "Firefox" && v("canvas", function() {
309
- return document.createElement("canvas").getContext("2d"), new Promise(function(n) {
309
+ return document.createElement("canvas").getContext("2d"), new Promise(function(r) {
310
310
  var e = Array.from({ length: z }, function() {
311
311
  return function() {
312
- var r = document.createElement("canvas"), o = r.getContext("2d");
312
+ var n = document.createElement("canvas"), o = n.getContext("2d");
313
313
  if (!o) return new ImageData(1, 1);
314
- r.width = x, r.height = k;
315
- var i = o.createLinearGradient(0, 0, r.width, r.height);
316
- i.addColorStop(0, "red"), i.addColorStop(0.16666666666666666, "orange"), i.addColorStop(0.3333333333333333, "yellow"), i.addColorStop(0.5, "green"), i.addColorStop(0.6666666666666666, "blue"), i.addColorStop(0.8333333333333334, "indigo"), i.addColorStop(1, "violet"), o.fillStyle = i, o.fillRect(0, 0, r.width, r.height);
314
+ n.width = x, n.height = F;
315
+ var i = o.createLinearGradient(0, 0, n.width, n.height);
316
+ i.addColorStop(0, "red"), i.addColorStop(0.16666666666666666, "orange"), i.addColorStop(0.3333333333333333, "yellow"), i.addColorStop(0.5, "green"), i.addColorStop(0.6666666666666666, "blue"), i.addColorStop(0.8333333333333334, "indigo"), i.addColorStop(1, "violet"), o.fillStyle = i, o.fillRect(0, 0, n.width, n.height);
317
317
  var a = "Random Text WMwmil10Oo";
318
- o.font = "23.123px Arial", o.fillStyle = "black", o.fillText(a, -5, 15), o.fillStyle = "rgba(0, 0, 255, 0.5)", o.fillText(a, -3.3, 17.7), o.beginPath(), o.moveTo(0, 0), o.lineTo(2 * r.width / 7, r.height), o.strokeStyle = "white", o.lineWidth = 2, o.stroke();
319
- var t = o.getImageData(0, 0, r.width, r.height);
318
+ o.font = "23.123px Arial", o.fillStyle = "black", o.fillText(a, -5, 15), o.fillStyle = "rgba(0, 0, 255, 0.5)", o.fillText(a, -3.3, 17.7), o.beginPath(), o.moveTo(0, 0), o.lineTo(2 * n.width / 7, n.height), o.strokeStyle = "white", o.lineWidth = 2, o.stroke();
319
+ var t = o.getImageData(0, 0, n.width, n.height);
320
320
  return t;
321
321
  }();
322
322
  });
323
- n({ commonImageDataHash: T(U(e, x, k).data.toString()).toString() });
323
+ r({ commonImageDataHash: M(U(e, x, F).data.toString()).toString() });
324
324
  });
325
325
  });
326
- var A, K = ["Arial", "Arial Black", "Arial Narrow", "Arial Rounded MT", "Arimo", "Archivo", "Barlow", "Bebas Neue", "Bitter", "Bookman", "Calibri", "Cabin", "Candara", "Century", "Century Gothic", "Comic Sans MS", "Constantia", "Courier", "Courier New", "Crimson Text", "DM Mono", "DM Sans", "DM Serif Display", "DM Serif Text", "Dosis", "Droid Sans", "Exo", "Fira Code", "Fira Sans", "Franklin Gothic Medium", "Garamond", "Geneva", "Georgia", "Gill Sans", "Helvetica", "Impact", "Inconsolata", "Indie Flower", "Inter", "Josefin Sans", "Karla", "Lato", "Lexend", "Lucida Bright", "Lucida Console", "Lucida Sans Unicode", "Manrope", "Merriweather", "Merriweather Sans", "Montserrat", "Myriad", "Noto Sans", "Nunito", "Nunito Sans", "Open Sans", "Optima", "Orbitron", "Oswald", "Pacifico", "Palatino", "Perpetua", "PT Sans", "PT Serif", "Poppins", "Prompt", "Public Sans", "Quicksand", "Rajdhani", "Recursive", "Roboto", "Roboto Condensed", "Rockwell", "Rubik", "Segoe Print", "Segoe Script", "Segoe UI", "Sora", "Source Sans Pro", "Space Mono", "Tahoma", "Taviraj", "Times", "Times New Roman", "Titillium Web", "Trebuchet MS", "Ubuntu", "Varela Round", "Verdana", "Work Sans"], J = ["monospace", "sans-serif", "serif"];
327
- function F(n, e) {
328
- if (!n) throw new Error("Canvas context not supported");
329
- return n.font = "72px ".concat(e), n.measureText("WwMmLli0Oo").width;
326
+ var T, K = ["Arial", "Arial Black", "Arial Narrow", "Arial Rounded MT", "Arimo", "Archivo", "Barlow", "Bebas Neue", "Bitter", "Bookman", "Calibri", "Cabin", "Candara", "Century", "Century Gothic", "Comic Sans MS", "Constantia", "Courier", "Courier New", "Crimson Text", "DM Mono", "DM Sans", "DM Serif Display", "DM Serif Text", "Dosis", "Droid Sans", "Exo", "Fira Code", "Fira Sans", "Franklin Gothic Medium", "Garamond", "Geneva", "Georgia", "Gill Sans", "Helvetica", "Impact", "Inconsolata", "Indie Flower", "Inter", "Josefin Sans", "Karla", "Lato", "Lexend", "Lucida Bright", "Lucida Console", "Lucida Sans Unicode", "Manrope", "Merriweather", "Merriweather Sans", "Montserrat", "Myriad", "Noto Sans", "Nunito", "Nunito Sans", "Open Sans", "Optima", "Orbitron", "Oswald", "Pacifico", "Palatino", "Perpetua", "PT Sans", "PT Serif", "Poppins", "Prompt", "Public Sans", "Quicksand", "Rajdhani", "Recursive", "Roboto", "Roboto Condensed", "Rockwell", "Rubik", "Segoe Print", "Segoe Script", "Segoe UI", "Sora", "Source Sans Pro", "Space Mono", "Tahoma", "Taviraj", "Times", "Times New Roman", "Titillium Web", "Trebuchet MS", "Ubuntu", "Varela Round", "Verdana", "Work Sans"], Y = ["monospace", "sans-serif", "serif"];
327
+ function k(r, e) {
328
+ if (!r) throw new Error("Canvas context not supported");
329
+ return r.font = "72px ".concat(e), r.measureText("WwMmLli0Oo").width;
330
330
  }
331
- function Y() {
332
- var n, e = document.createElement("canvas"), r = (n = e.getContext("webgl")) !== null && n !== void 0 ? n : e.getContext("experimental-webgl");
333
- if (r && "getParameter" in r) try {
334
- var o = (r.getParameter(r.VENDOR) || "").toString(), i = (r.getParameter(r.RENDERER) || "").toString(), a = { vendor: o, renderer: i, version: (r.getParameter(r.VERSION) || "").toString(), shadingLanguageVersion: (r.getParameter(r.SHADING_LANGUAGE_VERSION) || "").toString() };
331
+ function J() {
332
+ var r, e = document.createElement("canvas"), n = (r = e.getContext("webgl")) !== null && r !== void 0 ? r : e.getContext("experimental-webgl");
333
+ if (n && "getParameter" in n) try {
334
+ var o = (n.getParameter(n.VENDOR) || "").toString(), i = (n.getParameter(n.RENDERER) || "").toString(), a = { vendor: o, renderer: i, version: (n.getParameter(n.VERSION) || "").toString(), shadingLanguageVersion: (n.getParameter(n.SHADING_LANGUAGE_VERSION) || "").toString() };
335
335
  if (!i.length || !o.length) {
336
- var t = r.getExtension("WEBGL_debug_renderer_info");
336
+ var t = n.getExtension("WEBGL_debug_renderer_info");
337
337
  if (t) {
338
- var u = (r.getParameter(t.UNMASKED_VENDOR_WEBGL) || "").toString(), l = (r.getParameter(t.UNMASKED_RENDERER_WEBGL) || "").toString();
338
+ var u = (n.getParameter(t.UNMASKED_VENDOR_WEBGL) || "").toString(), l = (n.getParameter(t.UNMASKED_RENDERER_WEBGL) || "").toString();
339
339
  u && (a.vendorUnmasked = u), l && (a.rendererUnmasked = l);
340
340
  }
341
341
  }
@@ -345,11 +345,11 @@ function Y() {
345
345
  return "undefined";
346
346
  }
347
347
  function X() {
348
- var n = new Float32Array(1), e = new Uint8Array(n.buffer);
349
- return n[0] = 1 / 0, n[0] = n[0] - n[0], e[3];
348
+ var r = new Float32Array(1), e = new Uint8Array(r.buffer);
349
+ return r[0] = 1 / 0, r[0] = r[0] - r[0], e[3];
350
350
  }
351
- function Z(n, e) {
352
- var r = {};
351
+ function Z(r, e) {
352
+ var n = {};
353
353
  return e.forEach(function(o) {
354
354
  var i = function(a) {
355
355
  if (a.length === 0) return null;
@@ -362,33 +362,33 @@ function Z(n, e) {
362
362
  return Object.keys(t).forEach(function(c) {
363
363
  t[c] > l && (u = c, l = t[c]);
364
364
  }), u;
365
- }(n.map(function(a) {
365
+ }(r.map(function(a) {
366
366
  return o in a ? a[o] : void 0;
367
367
  }).filter(function(a) {
368
368
  return a !== void 0;
369
369
  }));
370
- i && (r[o] = i);
371
- }), r;
370
+ i && (n[o] = i);
371
+ }), n;
372
372
  }
373
373
  function ee() {
374
- var n = [], e = { "prefers-contrast": ["high", "more", "low", "less", "forced", "no-preference"], "any-hover": ["hover", "none"], "any-pointer": ["none", "coarse", "fine"], pointer: ["none", "coarse", "fine"], hover: ["hover", "none"], update: ["fast", "slow"], "inverted-colors": ["inverted", "none"], "prefers-reduced-motion": ["reduce", "no-preference"], "prefers-reduced-transparency": ["reduce", "no-preference"], scripting: ["none", "initial-only", "enabled"], "forced-colors": ["active", "none"] };
375
- return Object.keys(e).forEach(function(r) {
376
- e[r].forEach(function(o) {
377
- matchMedia("(".concat(r, ": ").concat(o, ")")).matches && n.push("".concat(r, ": ").concat(o));
374
+ var r = [], e = { "prefers-contrast": ["high", "more", "low", "less", "forced", "no-preference"], "any-hover": ["hover", "none"], "any-pointer": ["none", "coarse", "fine"], pointer: ["none", "coarse", "fine"], hover: ["hover", "none"], update: ["fast", "slow"], "inverted-colors": ["inverted", "none"], "prefers-reduced-motion": ["reduce", "no-preference"], "prefers-reduced-transparency": ["reduce", "no-preference"], scripting: ["none", "initial-only", "enabled"], "forced-colors": ["active", "none"] };
375
+ return Object.keys(e).forEach(function(n) {
376
+ e[n].forEach(function(o) {
377
+ matchMedia("(".concat(n, ": ").concat(o, ")")).matches && r.push("".concat(n, ": ").concat(o));
378
378
  });
379
- }), n;
379
+ }), r;
380
380
  }
381
381
  function te() {
382
382
  if (window.location.protocol === "https:" && typeof window.ApplePaySession == "function") try {
383
- for (var n = window.ApplePaySession.supportsVersion, e = 15; e > 0; e--) if (n(e)) return e;
383
+ for (var r = window.ApplePaySession.supportsVersion, e = 15; e > 0; e--) if (r(e)) return e;
384
384
  } catch {
385
385
  return 0;
386
386
  }
387
387
  return 0;
388
388
  }
389
389
  E().name != "Firefox" && v("fonts", function() {
390
- var n = this;
391
- return new Promise(function(e, r) {
390
+ var r = this;
391
+ return new Promise(function(e, n) {
392
392
  try {
393
393
  (function(o) {
394
394
  var i;
@@ -413,97 +413,97 @@ E().name != "Firefox" && v("fonts", function() {
413
413
  });
414
414
  })(function(o) {
415
415
  var i = o.iframe;
416
- return w(n, void 0, void 0, function() {
416
+ return w(r, void 0, void 0, function() {
417
417
  var a, t, u, l;
418
418
  return y(this, function(c) {
419
- return a = i.createElement("canvas"), t = a.getContext("2d"), u = J.map(function(s) {
420
- return F(t, s);
419
+ return a = i.createElement("canvas"), t = a.getContext("2d"), u = Y.map(function(s) {
420
+ return k(t, s);
421
421
  }), l = {}, K.forEach(function(s) {
422
- var f = F(t, s);
422
+ var f = k(t, s);
423
423
  u.includes(f) || (l[s] = f);
424
424
  }), e(l), [2];
425
425
  });
426
426
  });
427
427
  });
428
428
  } catch {
429
- r({ error: "unsupported" });
429
+ n({ error: "unsupported" });
430
430
  }
431
431
  });
432
432
  }), v("hardware", function() {
433
- return new Promise(function(n, e) {
434
- var r = navigator.deviceMemory !== void 0 ? navigator.deviceMemory : 0, o = window.performance && window.performance.memory ? window.performance.memory : 0;
435
- n({ videocard: Y(), architecture: X(), deviceMemory: r.toString() || "undefined", jsHeapSizeLimit: o.jsHeapSizeLimit || 0 });
433
+ return new Promise(function(r, e) {
434
+ var n = navigator.deviceMemory !== void 0 ? navigator.deviceMemory : 0, o = window.performance && window.performance.memory ? window.performance.memory : 0;
435
+ r({ videocard: J(), architecture: X(), deviceMemory: n.toString() || "undefined", jsHeapSizeLimit: o.jsHeapSizeLimit || 0 });
436
436
  });
437
437
  }), v("locales", function() {
438
- return new Promise(function(n) {
439
- n({ languages: navigator.language, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
438
+ return new Promise(function(r) {
439
+ r({ languages: navigator.language, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
440
440
  });
441
441
  }), v("permissions", function() {
442
442
  return w(this, void 0, void 0, function() {
443
- var n;
443
+ var r;
444
444
  return y(this, function(e) {
445
- return A = (b == null ? void 0 : b.permissions_to_check) || ["accelerometer", "accessibility", "accessibility-events", "ambient-light-sensor", "background-fetch", "background-sync", "bluetooth", "camera", "clipboard-read", "clipboard-write", "device-info", "display-capture", "gyroscope", "geolocation", "local-fonts", "magnetometer", "microphone", "midi", "nfc", "notifications", "payment-handler", "persistent-storage", "push", "speaker", "storage-access", "top-level-storage-access", "window-management", "query"], n = Array.from({ length: (b == null ? void 0 : b.retries) || 3 }, function() {
445
+ return T = (b == null ? void 0 : b.permissions_to_check) || ["accelerometer", "accessibility", "accessibility-events", "ambient-light-sensor", "background-fetch", "background-sync", "bluetooth", "camera", "clipboard-read", "clipboard-write", "device-info", "display-capture", "gyroscope", "geolocation", "local-fonts", "magnetometer", "microphone", "midi", "nfc", "notifications", "payment-handler", "persistent-storage", "push", "speaker", "storage-access", "top-level-storage-access", "window-management", "query"], r = Array.from({ length: (b == null ? void 0 : b.retries) || 3 }, function() {
446
446
  return function() {
447
447
  return w(this, void 0, void 0, function() {
448
- var r, o, i, a, t;
448
+ var n, o, i, a, t;
449
449
  return y(this, function(u) {
450
450
  switch (u.label) {
451
451
  case 0:
452
- r = {}, o = 0, i = A, u.label = 1;
452
+ n = {}, o = 0, i = T, u.label = 1;
453
453
  case 1:
454
454
  if (!(o < i.length)) return [3, 6];
455
455
  a = i[o], u.label = 2;
456
456
  case 2:
457
457
  return u.trys.push([2, 4, , 5]), [4, navigator.permissions.query({ name: a })];
458
458
  case 3:
459
- return t = u.sent(), r[a] = t.state.toString(), [3, 5];
459
+ return t = u.sent(), n[a] = t.state.toString(), [3, 5];
460
460
  case 4:
461
461
  return u.sent(), [3, 5];
462
462
  case 5:
463
463
  return o++, [3, 1];
464
464
  case 6:
465
- return [2, r];
465
+ return [2, n];
466
466
  }
467
467
  });
468
468
  });
469
469
  }();
470
- }), [2, Promise.all(n).then(function(r) {
471
- return Z(r, A);
470
+ }), [2, Promise.all(r).then(function(n) {
471
+ return Z(n, T);
472
472
  })];
473
473
  });
474
474
  });
475
475
  }), v("plugins", function() {
476
- var n = [];
476
+ var r = [];
477
477
  if (navigator.plugins) for (var e = 0; e < navigator.plugins.length; e++) {
478
- var r = navigator.plugins[e];
479
- n.push([r.name, r.filename, r.description].join("|"));
478
+ var n = navigator.plugins[e];
479
+ r.push([n.name, n.filename, n.description].join("|"));
480
480
  }
481
481
  return new Promise(function(o) {
482
- o({ plugins: n });
482
+ o({ plugins: r });
483
483
  });
484
484
  }), v("screen", function() {
485
- return new Promise(function(n) {
486
- n({ is_touchscreen: navigator.maxTouchPoints > 0, maxTouchPoints: navigator.maxTouchPoints, colorDepth: screen.colorDepth, mediaMatches: ee() });
485
+ return new Promise(function(r) {
486
+ r({ is_touchscreen: navigator.maxTouchPoints > 0, maxTouchPoints: navigator.maxTouchPoints, colorDepth: screen.colorDepth, mediaMatches: ee() });
487
487
  });
488
488
  }), v("system", function() {
489
- return new Promise(function(n) {
489
+ return new Promise(function(r) {
490
490
  var e = E();
491
- n({ platform: window.navigator.platform, cookieEnabled: window.navigator.cookieEnabled, productSub: navigator.productSub, product: navigator.product, useragent: navigator.userAgent, hardwareConcurrency: navigator.hardwareConcurrency, browser: { name: e.name, version: e.version }, applePayVersion: te() });
491
+ r({ platform: window.navigator.platform, cookieEnabled: window.navigator.cookieEnabled, productSub: navigator.productSub, product: navigator.product, useragent: navigator.userAgent, hardwareConcurrency: navigator.hardwareConcurrency, browser: { name: e.name, version: e.version }, applePayVersion: te() });
492
492
  });
493
493
  });
494
494
  var p, ne = E().name !== "SamsungBrowser" ? 1 : 3, d = null;
495
495
  v("webgl", function() {
496
496
  return w(this, void 0, void 0, function() {
497
- var n;
497
+ var r;
498
498
  return y(this, function(e) {
499
499
  typeof document < "u" && ((p = document.createElement("canvas")).width = 200, p.height = 100, d = p.getContext("webgl"));
500
500
  try {
501
501
  if (!d) throw new Error("WebGL not supported");
502
- return n = Array.from({ length: ne }, function() {
502
+ return r = Array.from({ length: ne }, function() {
503
503
  return function() {
504
504
  try {
505
505
  if (!d) throw new Error("WebGL not supported");
506
- var r = `
506
+ var n = `
507
507
  attribute vec2 position;
508
508
  void main() {
509
509
  gl_Position = vec4(position, 0.0, 1.0);
@@ -515,7 +515,7 @@ v("webgl", function() {
515
515
  }
516
516
  `, i = d.createShader(d.VERTEX_SHADER), a = d.createShader(d.FRAGMENT_SHADER);
517
517
  if (!i || !a) throw new Error("Failed to create shaders");
518
- if (d.shaderSource(i, r), d.shaderSource(a, o), d.compileShader(i), !d.getShaderParameter(i, d.COMPILE_STATUS)) throw new Error("Vertex shader compilation failed: " + d.getShaderInfoLog(i));
518
+ if (d.shaderSource(i, n), d.shaderSource(a, o), d.compileShader(i), !d.getShaderParameter(i, d.COMPILE_STATUS)) throw new Error("Vertex shader compilation failed: " + d.getShaderInfoLog(i));
519
519
  if (d.compileShader(a), !d.getShaderParameter(a, d.COMPILE_STATUS)) throw new Error("Fragment shader compilation failed: " + d.getShaderInfoLog(a));
520
520
  var t = d.createProgram();
521
521
  if (!t) throw new Error("Failed to create shader program");
@@ -525,19 +525,19 @@ v("webgl", function() {
525
525
  var f = s * c;
526
526
  l[4 * s] = 0, l[4 * s + 1] = 0, l[4 * s + 2] = Math.cos(f) * (p.width / 2), l[4 * s + 3] = Math.sin(f) * (p.height / 2);
527
527
  }
528
- var B = d.createBuffer();
529
- d.bindBuffer(d.ARRAY_BUFFER, B), d.bufferData(d.ARRAY_BUFFER, l, d.STATIC_DRAW);
530
- var R = d.getAttribLocation(t, "position");
531
- d.enableVertexAttribArray(R), d.vertexAttribPointer(R, 2, d.FLOAT, !1, 0, 0), d.viewport(0, 0, p.width, p.height), d.clearColor(0, 0, 0, 1), d.clear(d.COLOR_BUFFER_BIT), d.drawArrays(d.LINES, 0, 2 * u);
532
- var _ = new Uint8ClampedArray(p.width * p.height * 4);
533
- return d.readPixels(0, 0, p.width, p.height, d.RGBA, d.UNSIGNED_BYTE, _), new ImageData(_, p.width, p.height);
528
+ var L = d.createBuffer();
529
+ d.bindBuffer(d.ARRAY_BUFFER, L), d.bufferData(d.ARRAY_BUFFER, l, d.STATIC_DRAW);
530
+ var I = d.getAttribLocation(t, "position");
531
+ d.enableVertexAttribArray(I), d.vertexAttribPointer(I, 2, d.FLOAT, !1, 0, 0), d.viewport(0, 0, p.width, p.height), d.clearColor(0, 0, 0, 1), d.clear(d.COLOR_BUFFER_BIT), d.drawArrays(d.LINES, 0, 2 * u);
532
+ var R = new Uint8ClampedArray(p.width * p.height * 4);
533
+ return d.readPixels(0, 0, p.width, p.height, d.RGBA, d.UNSIGNED_BYTE, R), new ImageData(R, p.width, p.height);
534
534
  } catch {
535
535
  return new ImageData(1, 1);
536
536
  } finally {
537
537
  d && (d.bindBuffer(d.ARRAY_BUFFER, null), d.useProgram(null), d.viewport(0, 0, d.drawingBufferWidth, d.drawingBufferHeight), d.clearColor(0, 0, 0, 0));
538
538
  }
539
539
  }();
540
- }), [2, { commonImageHash: T(U(n, p.width, p.height).data.toString()).toString() }];
540
+ }), [2, { commonImageHash: M(U(r, p.width, p.height).data.toString()).toString() }];
541
541
  } catch {
542
542
  return [2, { webgl: "unsupported" }];
543
543
  }
@@ -545,26 +545,26 @@ v("webgl", function() {
545
545
  });
546
546
  });
547
547
  });
548
- var S = function(n, e, r, o) {
549
- for (var i = (r - e) / o, a = 0, t = 0; t < o; t++)
550
- a += n(e + (t + 0.5) * i);
548
+ var S = function(r, e, n, o) {
549
+ for (var i = (n - e) / o, a = 0, t = 0; t < o; t++)
550
+ a += r(e + (t + 0.5) * i);
551
551
  return a * i;
552
552
  };
553
553
  v("math", function() {
554
554
  return w(void 0, void 0, void 0, function() {
555
- return y(this, function(n) {
555
+ return y(this, function(r) {
556
556
  return [2, { acos: Math.acos(0.5), asin: S(Math.asin, -1, 1, 97), atan: S(Math.atan, -1, 1, 97), cos: S(Math.cos, 0, Math.PI, 97), cosh: Math.cosh(9 / 7), e: Math.E, largeCos: Math.cos(1e20), largeSin: Math.sin(1e20), largeTan: Math.tan(1e20), log: Math.log(1e3), pi: Math.PI, sin: S(Math.sin, -Math.PI, Math.PI, 97), sinh: S(Math.sinh, -9 / 7, 7 / 9, 97), sqrt: Math.sqrt(2), tan: S(Math.tan, 0, 2 * Math.PI, 97), tanh: S(Math.tanh, -9 / 7, 7 / 9, 97) }];
557
557
  });
558
558
  });
559
559
  });
560
560
  const re = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
561
- let M = (n = 21) => {
562
- let e = "", r = crypto.getRandomValues(new Uint8Array(n |= 0));
563
- for (; n--; )
564
- e += re[r[n] & 63];
561
+ let A = (r = 21) => {
562
+ let e = "", n = crypto.getRandomValues(new Uint8Array(r |= 0));
563
+ for (; r--; )
564
+ e += re[n[r] & 63];
565
565
  return e;
566
566
  };
567
- class I {
567
+ class _ {
568
568
  constructor(e) {
569
569
  h(this, "config");
570
570
  this.config = e;
@@ -574,12 +574,16 @@ class I {
574
574
  }
575
575
  async onQuerySubmitted(e) {
576
576
  }
577
- async onQueryFetched(e, r) {
577
+ async onQueryFetched(e, n) {
578
578
  }
579
579
  async onInputCleared() {
580
580
  }
581
+ async onAdContainerRendered(e) {
582
+ }
583
+ async onAdContainerViewed(e) {
584
+ }
581
585
  }
582
- class oe extends I {
586
+ class oe extends _ {
583
587
  /**
584
588
  * Gets ads from the adMarketplace API based on the search term.
585
589
  */
@@ -596,65 +600,81 @@ class oe extends I {
596
600
  "results-pa": `${this.config.admProductAdQuantity || 0}`
597
601
  }).toString()}`, a = await (await fetch(o, { method: "GET" })).json(), t = a.product_ads.map(
598
602
  (c) => ({
599
- id: M(),
603
+ id: A(),
600
604
  adSource: "adMarketplace",
601
605
  admAdType: "adm-product-ad",
602
606
  admAd: c
603
607
  })
604
608
  ), u = a.text_ads.map((c) => ({
605
- id: M(),
609
+ id: A(),
606
610
  adSource: "adMarketplace",
607
611
  admAdType: "adm-text-ad",
608
612
  admAd: c
609
613
  }));
610
614
  return t.concat(u);
611
615
  }
616
+ async onAdContainerViewed(e) {
617
+ var o;
618
+ const n = e.adClientResponseItem;
619
+ (o = n.admAd) != null && o.impression_url && fetch(n.admAd.impression_url);
620
+ }
612
621
  }
613
- class ae extends I {
622
+ class ae extends _ {
614
623
  async getAdsForSearchParams(e) {
615
624
  return [];
616
625
  }
617
626
  }
618
- class ie extends I {
619
- constructor(e) {
620
- super(e), this.addScriptTagToDocument();
627
+ const ie = 200, se = 100;
628
+ class ce extends _ {
629
+ constructor(n) {
630
+ super(n);
631
+ h(this, "adCallTimeout");
632
+ this.addScriptTagToDocument();
621
633
  }
622
- async onQuerySubmitted(e) {
634
+ async onQuerySubmitted(n) {
623
635
  this.addScriptTagToDocument();
624
636
  }
625
- async onQueryFetched(e, r) {
626
- var o;
627
- if ((((o = r.data.hits) == null ? void 0 : o.length) || 0) === 0) {
637
+ async onQueryFetched(n, o) {
638
+ var i;
639
+ if ((((i = o.data.hits) == null ? void 0 : i.length) || 0) === 0) {
628
640
  this.removeScriptTagFromDocument();
629
641
  return;
630
642
  }
631
- this.addScriptTagToDocument();
632
- try {
633
- PostRelease == null || PostRelease.Start({ ptd: [this.config.nativoPlacementId] });
634
- } catch (i) {
635
- console.error(i);
636
- }
643
+ this.performAdCall(ie);
644
+ }
645
+ async onAdContainerViewed(n) {
646
+ this.performAdCall(se);
637
647
  }
638
648
  async onInputCleared() {
639
649
  this.removeScriptTagFromDocument();
640
650
  }
641
- async getAdsForSearchParams(e) {
651
+ performAdCall(n) {
652
+ this.adCallTimeout && clearTimeout(this.adCallTimeout), this.adCallTimeout = setTimeout(() => {
653
+ this.addScriptTagToDocument();
654
+ try {
655
+ PostRelease == null || PostRelease.Start({ ptd: [this.config.nativoPlacementId] });
656
+ } catch (o) {
657
+ console.error(o);
658
+ }
659
+ }, n);
660
+ }
661
+ async getAdsForSearchParams(n) {
642
662
  return [];
643
663
  }
644
664
  addScriptTagToDocument() {
645
665
  if (!document.head.querySelector("#nativo-tag")) {
646
- const e = document.createElement("script");
647
- e.type = "text/javascript", e.src = "https://s.ntv.io/serve/load.js", e.id = "nativo-tag", e.setAttribute("data-ntv-set-no-auto-start", "true"), document.head.appendChild(e);
666
+ const n = document.createElement("script");
667
+ n.type = "text/javascript", n.src = "https://s.ntv.io/serve/load.js", n.id = "nativo-tag", n.setAttribute("data-ntv-set-no-auto-start", "true"), document.head.appendChild(n);
648
668
  }
649
669
  }
650
670
  removeScriptTagFromDocument() {
651
- const e = document.head.querySelector("#nativo-tag");
652
- e && document.head.removeChild(e);
671
+ const n = document.head.querySelector("#nativo-tag");
672
+ n && document.head.removeChild(n);
653
673
  }
654
674
  }
655
- const se = 500;
656
- class ce {
657
- constructor(e, r, o) {
675
+ const ue = 500;
676
+ class de {
677
+ constructor(e, n, o) {
658
678
  h(this, "measureRequestTimeout");
659
679
  h(this, "measureRequestsBatched", []);
660
680
  h(this, "config");
@@ -668,13 +688,13 @@ class ce {
668
688
  * @param {Partial<MeasureRequestProperties>} properties - Additional properties to send with the event.
669
689
  * @param {Partial<MeasureRequestUser>} user - Additional user properites to send with the event.
670
690
  */
671
- h(this, "sendMeasureEvent", (e, r = {}, o = {}) => {
691
+ h(this, "sendMeasureEvent", (e, n = {}, o = {}) => {
672
692
  const i = {
673
693
  event_name: e,
674
694
  properties: {
675
695
  searchcraft_index_names: this.config.index,
676
696
  session_id: this.sessionId,
677
- ...r
697
+ ...n
678
698
  },
679
699
  user: {
680
700
  ...this.measureRequestUser,
@@ -703,9 +723,9 @@ class ce {
703
723
  } catch (u) {
704
724
  throw console.error("Error sending MeasureRequest:", u), u;
705
725
  }
706
- }, se);
726
+ }, ue);
707
727
  });
708
- this.config = e, this.sdkInfo = r, this.userId = o, this.sessionId = M(), this.sendMeasureEvent("sdk_initialized");
728
+ this.config = e, this.sdkInfo = n, this.userId = o, this.sessionId = A(), this.sendMeasureEvent("sdk_initialized");
709
729
  }
710
730
  /**
711
731
  * Getter for the base url used by the /measure endpoints.
@@ -728,37 +748,37 @@ class ce {
728
748
  };
729
749
  }
730
750
  }
731
- function ue(n) {
751
+ function le(r) {
732
752
  const e = [];
733
- let r = "should";
734
- return n.facetPathsForIndexFields && Object.keys(n.facetPathsForIndexFields).forEach((o) => {
753
+ let n = "should";
754
+ return r.facetPathsForIndexFields && Object.keys(r.facetPathsForIndexFields).forEach((o) => {
735
755
  var a;
736
- const i = (a = n.facetPathsForIndexFields) == null ? void 0 : a[o];
737
- i && (r = "must", e.push({
738
- occur: r,
756
+ const i = (a = r.facetPathsForIndexFields) == null ? void 0 : a[o];
757
+ i && (n = "must", e.push({
758
+ occur: n,
739
759
  exact: {
740
760
  ctx: i.value
741
761
  }
742
762
  }));
743
- }), n.rangeValueForIndexFields && Object.keys(n.rangeValueForIndexFields).forEach((o) => {
763
+ }), r.rangeValueForIndexFields && Object.keys(r.rangeValueForIndexFields).forEach((o) => {
744
764
  var a;
745
- const i = (a = n.rangeValueForIndexFields) == null ? void 0 : a[o];
746
- i && (r = "must", e.push({
747
- occur: r,
765
+ const i = (a = r.rangeValueForIndexFields) == null ? void 0 : a[o];
766
+ i && (n = "must", e.push({
767
+ occur: n,
748
768
  exact: {
749
769
  ctx: i.value
750
770
  }
751
771
  }));
752
- }), n.sort === "desc" ? n.order_by = "date_published" : n.order_by = "", e.push({
753
- occur: r,
772
+ }), r.sort === "desc" ? r.order_by = "date_published" : r.order_by = "", e.push({
773
+ occur: n,
754
774
  // Valid, as 'occur' is a required property in QueryItem
755
- [n.mode]: { ctx: n.searchTerm }
775
+ [r.mode]: { ctx: r.searchTerm }
756
776
  // Ensure dynamic mode is inside queryType
757
777
  }), e;
758
778
  }
759
- const de = (n) => n.endsWith("/") ? n.slice(0, -1) : n, le = (n) => {
779
+ const he = (r) => r.endsWith("/") ? r.slice(0, -1) : r, fe = (r) => {
760
780
  let e = "";
761
- if (e = n.trim(), e = e.replace(/[‘’“”]/g, (o) => ({
781
+ if (e = r.trim(), e = e.replace(/[‘’“”]/g, (o) => ({
762
782
  "‘": "'",
763
783
  "’": "'",
764
784
  "“": '"',
@@ -769,8 +789,8 @@ const de = (n) => n.endsWith("/") ? n.slice(0, -1) : n, le = (n) => {
769
789
  );
770
790
  return e;
771
791
  };
772
- class he {
773
- constructor(e, r, o) {
792
+ class me {
793
+ constructor(e, n, o) {
774
794
  h(this, "config");
775
795
  h(this, "userId");
776
796
  h(this, "parent");
@@ -780,18 +800,18 @@ class he {
780
800
  */
781
801
  h(this, "getSearchResponse", async (e) => {
782
802
  var o, i, a, t, u;
783
- const r = le(e.searchTerm);
803
+ const n = fe(e.searchTerm);
784
804
  (o = this.parent.measureClient) == null || o.sendMeasureEvent("search_requested", {
785
- search_term: r
805
+ search_term: n
786
806
  }), this.parent.emitEvent("query_submitted", {
787
807
  name: "query_submitted",
788
808
  data: {
789
- searchTerm: r
809
+ searchTerm: n
790
810
  }
791
811
  }), (i = this.parent.adClient) == null || i.onQuerySubmitted(e);
792
812
  try {
793
813
  const l = {
794
- query: ue(e),
814
+ query: le(e),
795
815
  offset: e.offset || 0,
796
816
  // Default to 0 (first page) if not provided
797
817
  limit: e.limit || this.config.searchResultsPerPage || 20
@@ -813,12 +833,12 @@ class he {
813
833
  );
814
834
  const f = await s.json();
815
835
  return (a = this.parent.measureClient) == null || a.sendMeasureEvent("search_response_received", {
816
- search_term: r,
836
+ search_term: n,
817
837
  number_of_documents: f.data.count
818
838
  }), this.parent.emitEvent("query_fetched", {
819
839
  name: "query_fetched",
820
840
  data: {
821
- searchTerm: r
841
+ searchTerm: n
822
842
  }
823
843
  }), (((t = f.data.hits) == null ? void 0 : t.length) || 0) === 0 && this.parent.emitEvent("no_results_returned", {
824
844
  name: "no_results_returned"
@@ -827,7 +847,7 @@ class he {
827
847
  throw console.error("Error parsing response:", l), l;
828
848
  }
829
849
  });
830
- this.parent = e, this.config = r, this.userId = o;
850
+ this.parent = e, this.config = n, this.userId = o;
831
851
  }
832
852
  /**
833
853
  * Getter for the base url used by the /search endpoint.
@@ -836,8 +856,8 @@ class he {
836
856
  return `${this.config.endpointURL}/index/${this.config.index.join(",")}/search`;
837
857
  }
838
858
  }
839
- class ge {
840
- constructor(e, r) {
859
+ class we {
860
+ constructor(e, n) {
841
861
  h(this, "config");
842
862
  h(this, "measureClient");
843
863
  h(this, "searchClient");
@@ -848,7 +868,7 @@ class ge {
848
868
  /**
849
869
  * Gets items from the SearchClient and the AdClient.
850
870
  */
851
- h(this, "getItems", (e, r, o) => {
871
+ h(this, "getItems", (e, n, o) => {
852
872
  const i = async () => {
853
873
  (async () => {
854
874
  var u, l;
@@ -857,10 +877,10 @@ class ge {
857
877
  throw new Error("Search client was not initialized.");
858
878
  const t = (l = a.data.hits || []) == null ? void 0 : l.map((c) => c.doc).filter((c) => !!c).map((c) => ({
859
879
  type: "SearchDocument",
860
- id: M(),
880
+ id: A(),
861
881
  document: c
862
882
  }));
863
- r(a, t);
883
+ n(a, t);
864
884
  })(), (async () => {
865
885
  if (this.adClient) {
866
886
  const a = await this.adClient.getAdsForSearchParams(e);
@@ -880,16 +900,16 @@ class ge {
880
900
  this.config = {
881
901
  ...e,
882
902
  // Strips off the trailing '/' from an endpointURL if one is accidentally added
883
- endpointURL: de(e.endpointURL)
884
- }, this.userId = "", this.initClients(this.config, r), this.initInputForms(), this.startObservingMutations();
903
+ endpointURL: he(e.endpointURL)
904
+ }, this.userId = "", this.initClients(this.config, n), this.initInputForms(), this.startObservingMutations();
885
905
  }
886
906
  initInputForms() {
887
907
  const e = document.querySelectorAll(
888
908
  "searchcraft-input-form"
889
909
  );
890
910
  setTimeout(() => {
891
- e.forEach((r) => {
892
- r.core = this;
911
+ e.forEach((n) => {
912
+ n.core = this;
893
913
  });
894
914
  }, 40);
895
915
  }
@@ -897,24 +917,24 @@ class ge {
897
917
  * When changes happen in the DOM, we want to link any input forms found to the instance of the core.
898
918
  */
899
919
  startObservingMutations() {
900
- new MutationObserver((r, o) => {
920
+ new MutationObserver((n, o) => {
901
921
  let i = !1;
902
- for (const a of r)
922
+ for (const a of n)
903
923
  a.type === "childList" && a.addedNodes.forEach((t) => {
904
924
  t.nodeType === 1 && t.className.toLowerCase() === "searchcraft-input-form" && (i = !0);
905
925
  });
906
926
  i && this.initInputForms();
907
927
  }).observe(document.body, { childList: !0, subtree: !0 });
908
928
  }
909
- initClients(e, r) {
929
+ initClients(e, n) {
910
930
  setTimeout(async () => {
911
931
  let o = this.config.userId;
912
- switch (o || (o = await $()), this.measureClient = new ce(e, r, o), this.searchClient = new he(this, e, o), e.adSource) {
932
+ switch (o || (o = await $()), this.measureClient = new de(e, n, o), this.searchClient = new me(this, e, o), e.adSource) {
913
933
  case "adMarketplace":
914
934
  this.adClient = new oe(e);
915
935
  break;
916
936
  case "Nativo":
917
- this.adClient = new ie(e);
937
+ this.adClient = new ce(e);
918
938
  break;
919
939
  case "Custom":
920
940
  this.adClient = new ae(e);
@@ -922,29 +942,25 @@ class ge {
922
942
  }
923
943
  }, 300);
924
944
  }
925
- emitEvent(e, r) {
945
+ emitEvent(e, n) {
926
946
  var o;
927
947
  (o = this.subscriptionEvents[e]) == null || o.forEach((i) => {
928
- i(r);
948
+ i(n);
929
949
  });
930
950
  }
931
- subscribe(e, r) {
951
+ subscribe(e, n) {
932
952
  return this.subscriptionEvents[e] || (this.subscriptionEvents[e] = []), this.subscriptionEvents[e].push(
933
- r
953
+ n
934
954
  ), () => {
935
- this.subscriptionEvents[e] = this.subscriptionEvents[e].filter((o) => o !== r);
955
+ this.subscriptionEvents[e] = this.subscriptionEvents[e].filter((o) => o !== n);
936
956
  };
937
957
  }
938
958
  /**
939
959
  * Called when a `<searchcraft-ad>` component is rendered
940
960
  */
941
961
  handleAdContainerRendered(e) {
942
- var r;
943
- if (e.adSource === "adMarketplace") {
944
- const o = e.adClientResponseItem;
945
- (r = o.admAd) != null && r.impression_url && fetch(o.admAd.impression_url);
946
- }
947
- this.emitEvent("ad_container_rendered", {
962
+ var n;
963
+ (n = this.adClient) == null || n.onAdContainerRendered(e), this.emitEvent("ad_container_rendered", {
948
964
  name: "ad_container_rendered",
949
965
  data: {
950
966
  adContainerId: e.adContainerId,
@@ -953,6 +969,20 @@ class ge {
953
969
  }
954
970
  });
955
971
  }
972
+ /**
973
+ * Called when a `<searchcraft-ad>` is viewed
974
+ */
975
+ handleAdContainerViewed(e) {
976
+ var n;
977
+ (n = this.adClient) == null || n.onAdContainerViewed(e), this.emitEvent("ad_container_viewed", {
978
+ name: "ad_container_viewed",
979
+ data: {
980
+ adContainerId: e.adContainerId,
981
+ adSource: e.adSource,
982
+ searchTerm: e.searchTerm
983
+ }
984
+ });
985
+ }
956
986
  /**
957
987
  * Perform various actions when the input is cleared
958
988
  */
@@ -1624,7 +1654,7 @@ const searchcraftStore = zustand.createStore((set, get) => {
1624
1654
  initialize: (searchcraftInstance, debug = false) => {
1625
1655
  const core = searchcraftInstance;
1626
1656
  const logger = debug
1627
- ? new pe({ logLevel: P.DEBUG })
1657
+ ? new ve({ logLevel: P.DEBUG })
1628
1658
  : undefined;
1629
1659
  set({
1630
1660
  core,
@@ -1749,6 +1779,6 @@ const searchcraftStore = zustand.createStore((set, get) => {
1749
1779
  return stateObject;
1750
1780
  });
1751
1781
 
1752
- export { ge as g, searchcraftStore as s };
1782
+ export { searchcraftStore as s, we as w };
1753
1783
 
1754
- //# sourceMappingURL=p-39be2b10.js.map
1784
+ //# sourceMappingURL=p-2e293015.js.map