@searchstax-inc/searchstudio-ux-react 0.2.18 → 0.3.1

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,5 +1,5 @@
1
1
  import nt, { useState as H, useEffect as ee, useRef as Ft, createRef as et } from "react";
2
- var Pe = { exports: {} }, le = {};
2
+ var Ie = { exports: {} }, le = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.min.js
@@ -52,15 +52,15 @@ function Mt() {
52
52
  {
53
53
  for (var p = arguments.length, y = new Array(p > 1 ? p - 1 : 0), L = 1; L < p; L++)
54
54
  y[L - 1] = arguments[L];
55
- N("error", n, y);
55
+ D("error", n, y);
56
56
  }
57
57
  }
58
- function N(n, p, y) {
58
+ function D(n, p, y) {
59
59
  {
60
60
  var L = E.ReactDebugCurrentFrame, F = L.getStackAddendum();
61
61
  F !== "" && (p += "%s", y = y.concat([F]));
62
- var M = y.map(function(I) {
63
- return String(I);
62
+ var M = y.map(function(P) {
63
+ return String(P);
64
64
  });
65
65
  M.unshift("Warning: " + p), Function.prototype.apply.call(console[n], console, M);
66
66
  }
@@ -119,9 +119,9 @@ function Mt() {
119
119
  var L = n.displayName || null;
120
120
  return L !== null ? L : K(n.type) || "Memo";
121
121
  case v: {
122
- var F = n, M = F._payload, I = F._init;
122
+ var F = n, M = F._payload, P = F._init;
123
123
  try {
124
- return K(I(M));
124
+ return K(P(M));
125
125
  } catch {
126
126
  return null;
127
127
  }
@@ -129,14 +129,14 @@ function Mt() {
129
129
  }
130
130
  return null;
131
131
  }
132
- var Y = Object.assign, ne = 0, Fe, Oe, Me, Ae, De, Ne, $e;
132
+ var Y = Object.assign, ne = 0, Fe, Oe, Me, Ae, Ne, De, $e;
133
133
  function qe() {
134
134
  }
135
135
  qe.__reactDisabledLog = !0;
136
136
  function ct() {
137
137
  {
138
138
  if (ne === 0) {
139
- Fe = console.log, Oe = console.info, Me = console.warn, Ae = console.error, De = console.group, Ne = console.groupCollapsed, $e = console.groupEnd;
139
+ Fe = console.log, Oe = console.info, Me = console.warn, Ae = console.error, Ne = console.group, De = console.groupCollapsed, $e = console.groupEnd;
140
140
  var n = {
141
141
  configurable: !0,
142
142
  enumerable: !0,
@@ -178,10 +178,10 @@ function Mt() {
178
178
  value: Ae
179
179
  }),
180
180
  group: Y({}, n, {
181
- value: De
181
+ value: Ne
182
182
  }),
183
183
  groupCollapsed: Y({}, n, {
184
- value: Ne
184
+ value: De
185
185
  }),
186
186
  groupEnd: Y({}, n, {
187
187
  value: $e
@@ -226,27 +226,27 @@ function Mt() {
226
226
  M = be.current, be.current = null, ct();
227
227
  try {
228
228
  if (p) {
229
- var I = function() {
229
+ var P = function() {
230
230
  throw Error();
231
231
  };
232
- if (Object.defineProperty(I.prototype, "props", {
232
+ if (Object.defineProperty(P.prototype, "props", {
233
233
  set: function() {
234
234
  throw Error();
235
235
  }
236
236
  }), typeof Reflect == "object" && Reflect.construct) {
237
237
  try {
238
- Reflect.construct(I, []);
238
+ Reflect.construct(P, []);
239
239
  } catch (X) {
240
240
  L = X;
241
241
  }
242
- Reflect.construct(n, [], I);
242
+ Reflect.construct(n, [], P);
243
243
  } else {
244
244
  try {
245
- I.call();
245
+ P.call();
246
246
  } catch (X) {
247
247
  L = X;
248
248
  }
249
- n.call(I.prototype);
249
+ n.call(P.prototype);
250
250
  }
251
251
  } else {
252
252
  try {
@@ -328,19 +328,19 @@ function Mt() {
328
328
  function dt(n, p, y, L, F) {
329
329
  {
330
330
  var M = Function.call.bind(ye);
331
- for (var I in n)
332
- if (M(n, I)) {
331
+ for (var P in n)
332
+ if (M(n, P)) {
333
333
  var w = void 0;
334
334
  try {
335
- if (typeof n[I] != "function") {
336
- var V = Error((L || "React class") + ": " + y + " type `" + I + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof n[I] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
335
+ if (typeof n[P] != "function") {
336
+ var V = Error((L || "React class") + ": " + y + " type `" + P + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof n[P] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
337
  throw V.name = "Invariant Violation", V;
338
338
  }
339
- w = n[I](p, I, L, y, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
339
+ w = n[P](p, P, L, y, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
340
  } catch ($) {
341
341
  w = $;
342
342
  }
343
- w && !(w instanceof Error) && (xe(F), T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", L || "React class", y, I, typeof w), xe(null)), w instanceof Error && !(w.message in He) && (He[w.message] = !0, xe(F), T("Failed %s type: %s", y, w.message), xe(null));
343
+ w && !(w instanceof Error) && (xe(F), T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", L || "React class", y, P, typeof w), xe(null)), w instanceof Error && !(w.message in He) && (He[w.message] = !0, xe(F), T("Failed %s type: %s", y, w.message), xe(null));
344
344
  }
345
345
  }
346
346
  }
@@ -419,7 +419,7 @@ function Mt() {
419
419
  });
420
420
  }
421
421
  }
422
- var St = function(n, p, y, L, F, M, I) {
422
+ var St = function(n, p, y, L, F, M, P) {
423
423
  var w = {
424
424
  // This tag allows us to uniquely identify this as a React Element
425
425
  $$typeof: e,
@@ -427,7 +427,7 @@ function Mt() {
427
427
  type: n,
428
428
  key: p,
429
429
  ref: y,
430
- props: I,
430
+ props: P,
431
431
  // Record the component responsible for creating this element.
432
432
  _owner: M
433
433
  };
@@ -450,20 +450,20 @@ function Mt() {
450
450
  };
451
451
  function Lt(n, p, y, L, F) {
452
452
  {
453
- var M, I = {}, w = null, V = null;
453
+ var M, P = {}, w = null, V = null;
454
454
  y !== void 0 && (Ve(y), w = "" + y), yt(p) && (Ve(p.key), w = "" + p.key), vt(p) && (V = p.ref, xt(p, F));
455
455
  for (M in p)
456
- ye.call(p, M) && !ft.hasOwnProperty(M) && (I[M] = p[M]);
456
+ ye.call(p, M) && !ft.hasOwnProperty(M) && (P[M] = p[M]);
457
457
  if (n && n.defaultProps) {
458
458
  var $ = n.defaultProps;
459
459
  for (M in $)
460
- I[M] === void 0 && (I[M] = $[M]);
460
+ P[M] === void 0 && (P[M] = $[M]);
461
461
  }
462
462
  if (w || V) {
463
463
  var _ = typeof n == "function" ? n.displayName || n.name || "Unknown" : n;
464
- w && bt(I, _), V && Ct(I, _);
464
+ w && bt(P, _), V && Ct(P, _);
465
465
  }
466
- return St(n, w, V, F, L, ce.current, I);
466
+ return St(n, w, V, F, L, ce.current, P);
467
467
  }
468
468
  }
469
469
  var ke = E.ReactCurrentOwner, Ke = E.ReactDebugCurrentFrame;
@@ -542,8 +542,8 @@ Check the top-level render call using <` + y + ">.");
542
542
  else if (n) {
543
543
  var F = k(n);
544
544
  if (typeof F == "function" && F !== n.entries)
545
- for (var M = F.call(n), I; !(I = M.next()).done; )
546
- we(I.value) && Ye(I.value, p);
545
+ for (var M = F.call(n), P; !(P = M.next()).done; )
546
+ we(P.value) && Ye(P.value, p);
547
547
  }
548
548
  }
549
549
  }
@@ -586,8 +586,8 @@ Check the top-level render call using <` + y + ">.");
586
586
  }
587
587
  function Xe(n, p, y, L, F, M) {
588
588
  {
589
- var I = q(n);
590
- if (!I) {
589
+ var P = q(n);
590
+ if (!P) {
591
591
  var w = "";
592
592
  (n === void 0 || typeof n == "object" && n !== null && Object.keys(n).length === 0) && (w += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
593
593
  var V = Tt(F);
@@ -598,7 +598,7 @@ Check the top-level render call using <` + y + ">.");
598
598
  var _ = Lt(n, p, y, F, M);
599
599
  if (_ == null)
600
600
  return _;
601
- if (I) {
601
+ if (P) {
602
602
  var z = p.children;
603
603
  if (z !== void 0)
604
604
  if (L)
@@ -617,16 +617,16 @@ Check the top-level render call using <` + y + ">.");
617
617
  function Et(n, p, y) {
618
618
  return Xe(n, p, y, !0);
619
619
  }
620
- function It(n, p, y) {
620
+ function Pt(n, p, y) {
621
621
  return Xe(n, p, y, !1);
622
622
  }
623
- var Pt = It, jt = Et;
624
- oe.Fragment = s, oe.jsx = Pt, oe.jsxs = jt;
623
+ var It = Pt, jt = Et;
624
+ oe.Fragment = s, oe.jsx = It, oe.jsxs = jt;
625
625
  }()), oe;
626
626
  }
627
- process.env.NODE_ENV === "production" ? Pe.exports = Ot() : Pe.exports = Mt();
628
- var o = Pe.exports, At = Object.defineProperty, Dt = (i, e, t) => e in i ? At(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, h = (i, e, t) => (Dt(i, typeof e != "symbol" ? e + "" : e, t), t), B = /* @__PURE__ */ ((i) => (i[i.mustache = 0] = "mustache", i[i.vue = 1] = "vue", i[i.react = 2] = "react", i[i.angular = 3] = "angular", i))(B || {});
629
- class Nt {
627
+ process.env.NODE_ENV === "production" ? Ie.exports = Ot() : Ie.exports = Mt();
628
+ var o = Ie.exports, At = Object.defineProperty, Nt = (i, e, t) => e in i ? At(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, h = (i, e, t) => (Nt(i, typeof e != "symbol" ? e + "" : e, t), t), B = /* @__PURE__ */ ((i) => (i[i.mustache = 0] = "mustache", i[i.vue = 1] = "vue", i[i.react = 2] = "react", i[i.angular = 3] = "angular", i))(B || {});
629
+ class Dt {
630
630
  constructor(e) {
631
631
  h(this, "dataLayer"), this.dataLayer = e;
632
632
  }
@@ -774,7 +774,7 @@ class J {
774
774
  return e != null && typeof e == "object";
775
775
  }
776
776
  }
777
- class D {
777
+ class N {
778
778
  constructor(e) {
779
779
  h(this, "value"), h(this, "observers", []), this.value = e, this.observers = [];
780
780
  }
@@ -817,11 +817,11 @@ class Ee {
817
817
  return t;
818
818
  }
819
819
  static getCookie(e) {
820
- const t = document.cookie.match(
820
+ const t = typeof document < "u" ? document.cookie.match(
821
821
  new RegExp(
822
822
  "(?:^|; )" + e.replace(/([.$?*|{}()[\]\\/+^])/g, "\\$1") + "=([^;]*)"
823
823
  )
824
- );
824
+ ) : null;
825
825
  return t ? decodeURIComponent(t[1]) : void 0;
826
826
  }
827
827
  static setCookie(e, t, s) {
@@ -833,7 +833,7 @@ class Ee {
833
833
  const l = a[c];
834
834
  l !== !0 && (r += "=" + l);
835
835
  }
836
- document.cookie = r;
836
+ typeof document < "u" && (document.cookie = r);
837
837
  }
838
838
  }
839
839
  class Z {
@@ -844,14 +844,14 @@ class Z {
844
844
  }
845
845
  class $t {
846
846
  constructor(e) {
847
- h(this, "$searchTermChange", new D("")), h(this, "$loadingChange", new D(!1)), h(this, "$searchResults", new D(null)), h(this, "$searchResultsMetadata", new D(null)), h(this, "$searchAutosuggest", new D(null)), h(this, "$searchFacets", new D(null)), h(this, "$searchFacetsCached", new D(null)), h(this, "$searchstaxConfig", new D(null)), h(this, "$autosuggestResults", new D(null)), h(this, "$searchObject", new D({
847
+ h(this, "$searchTermChange", new N("")), h(this, "$loadingChange", new N(!1)), h(this, "$searchResults", new N(null)), h(this, "$searchResultsMetadata", new N(null)), h(this, "$searchAutosuggest", new N(null)), h(this, "$searchFacets", new N(null)), h(this, "$searchFacetsCached", new N(null)), h(this, "$searchstaxConfig", new N(null)), h(this, "$autosuggestResults", new N(null)), h(this, "$searchObject", new N({
848
848
  query: "",
849
849
  itemsPerPage: null,
850
850
  page: 99999999,
851
851
  order: "",
852
852
  facets: [],
853
853
  additionalProps: []
854
- })), h(this, "$searchRelatedSearches", new D(null)), h(this, "$searchInputConfig", new D(null)), h(this, "$searchExternalPromotions", new D(null)), h(this, "$facetsTemplateData", new D(null)), h(this, "$selectedFacetsTemplateData", new D(null)), h(this, "$paginationData", new D(null)), h(this, "$searchFeedbackData", new D(null)), h(this, "$searchSortingData", new D(null)), h(this, "$searchRelatedSearchesData", new D(null)), h(this, "$searchExternalPromotionsData", new D(null)), h(this, "$cookiesDisabled", new D(null)), h(this, "$answer", new D("")), h(this, "$language", new D("en")), h(this, "currentPageValue", 1), h(this, "isAnswerWidgetCreatedValue", !1), h(this, "renderingEngineValue", B.mustache), h(this, "parsedData", new Nt(this)), h(this, "sessionId"), h(this, "autoCorrect", !0), h(this, "forceNotCorrect", !1), h(this, "lastSearchValue", ""), h(this, "turnAIAnswerGenerationOn", !1), h(this, "isInfiniteScroll", !1), h(this, "firstSearchHappened", !1), h(this, "facetsWereSet", !1), this.sessionId = e, this.cookieHandlingCallback(), this.$cookiesDisabled.subscribe(() => {
854
+ })), h(this, "$searchRelatedSearches", new N(null)), h(this, "$searchInputConfig", new N(null)), h(this, "$searchExternalPromotions", new N(null)), h(this, "$facetsTemplateData", new N(null)), h(this, "$selectedFacetsTemplateData", new N(null)), h(this, "$paginationData", new N(null)), h(this, "$searchFeedbackData", new N(null)), h(this, "$searchSortingData", new N(null)), h(this, "$searchRelatedSearchesData", new N(null)), h(this, "$searchExternalPromotionsData", new N(null)), h(this, "$cookiesDisabled", new N(null)), h(this, "$answer", new N("")), h(this, "$language", new N("en")), h(this, "currentPageValue", 1), h(this, "isAnswerWidgetCreatedValue", !1), h(this, "renderingEngineValue", B.mustache), h(this, "parsedData", new Dt(this)), h(this, "sessionId"), h(this, "autoCorrect", !0), h(this, "forceNotCorrect", !1), h(this, "lastSearchValue", ""), h(this, "turnAIAnswerGenerationOn", !1), h(this, "isInfiniteScroll", !1), h(this, "firstSearchHappened", !1), h(this, "facetsWereSet", !1), this.sessionId = e, this.cookieHandlingCallback(), this.$cookiesDisabled.subscribe(() => {
855
855
  this.cookieHandlingCallback();
856
856
  });
857
857
  }
@@ -1048,17 +1048,18 @@ class he {
1048
1048
  }
1049
1049
  static extractFacets(e) {
1050
1050
  const t = [];
1051
- for (const s of e.metadata.facets) {
1052
- let a = { values: [] };
1053
- if (a.name = s.name, a.label = s.label, s.name in e.facet_counts.facet_fields) {
1054
- const r = e.facet_counts.facet_fields[s.name];
1055
- for (let c = 0; c < r.length; c += 2) {
1056
- const l = {};
1057
- l.value = r[c], l.parentName = a.name, l.count = r[c + 1], l.type = "checkbox", a.values.push(l);
1051
+ if (e.metadata.facets)
1052
+ for (const s of e.metadata.facets) {
1053
+ let a = { values: [] };
1054
+ if (a.name = s.name, a.label = s.label, s.name in e.facet_counts.facet_fields) {
1055
+ const r = e.facet_counts.facet_fields[s.name];
1056
+ for (let c = 0; c < r.length; c += 2) {
1057
+ const l = {};
1058
+ l.value = r[c], l.parentName = a.name, l.count = r[c + 1], l.type = "checkbox", a.values.push(l);
1059
+ }
1058
1060
  }
1061
+ a.values.length > 0 && t.push(a);
1059
1062
  }
1060
- a.values.length > 0 && t.push(a);
1061
- }
1062
1063
  return t;
1063
1064
  }
1064
1065
  static extractSearchResultsMetadata(e) {
@@ -1134,21 +1135,31 @@ class st {
1134
1135
  }
1135
1136
  updateUrl(e) {
1136
1137
  const t = this.searchObjectToUrl(e);
1137
- let s = document.title;
1138
- this.titleParser && (s = this.titleParser(e)), document.title = s, window.location.href !== t && window.history.pushState({}, s, t);
1138
+ let s = typeof document < "u" ? document == null ? void 0 : document.title : "";
1139
+ this.titleParser && (s = this.titleParser(e)), typeof document < "u" && (document.title = s), (window == null ? void 0 : window.location.href) !== t && (window == null || window.history.pushState({}, s, t));
1139
1140
  }
1140
1141
  searchObjectToUrl(e) {
1141
- return this.queryStringHelper.urlHasQueryParams(window.location.href) ? window.location.href.split("?")[0] + "?" + this.queryStringHelper.stringify(this.searchObjectToParams(e), { ignoredKeys: this.ignoredKeys }) : window.location.href + "?" + this.queryStringHelper.stringify(this.searchObjectToParams(e), { ignoredKeys: this.ignoredKeys });
1142
+ return this.queryStringHelper.urlHasQueryParams((window == null ? void 0 : window.location.href) ?? "") ? (window == null ? void 0 : window.location.href.split("?")[0]) + "?" + this.queryStringHelper.stringify(
1143
+ this.searchObjectToParams(e),
1144
+ { ignoredKeys: this.ignoredKeys }
1145
+ ) : (window == null ? void 0 : window.location.href) + "?" + this.queryStringHelper.stringify(
1146
+ this.searchObjectToParams(e),
1147
+ { ignoredKeys: this.ignoredKeys }
1148
+ );
1142
1149
  }
1143
1150
  searchObjectToParams(e) {
1144
1151
  const t = {}, s = e.page || 1;
1145
- if (e.query && (t[this.routeName + "[query]"] = encodeURIComponent(e.query)), e.page && (t[this.routeName + "[page]"] = s + ""), e.order && (t[this.routeName + "[order]"] = e.order), e.facets)
1152
+ if (e.query && (t[this.routeName + "[query]"] = encodeURIComponent(
1153
+ e.query
1154
+ )), e.page && (t[this.routeName + "[page]"] = s + ""), e.order && (t[this.routeName + "[order]"] = e.order), e.facets)
1146
1155
  for (const a in e.facets) {
1147
1156
  const r = e.facets[a].type + ":" + encodeURIComponent(e.facets[a].name) + ":" + encodeURIComponent(e.facets[a].value);
1148
1157
  t[this.routeName + `[facets][${a}]`] = r;
1149
1158
  }
1150
- if (this.queryStringHelper.urlHasQueryParams(window.location.href)) {
1151
- const a = this.queryStringHelper.urlToParams(window.location.href);
1159
+ if (this.queryStringHelper.urlHasQueryParams((window == null ? void 0 : window.location.href) ?? "")) {
1160
+ const a = this.queryStringHelper.urlToParams(
1161
+ (window == null ? void 0 : window.location.href) ?? ""
1162
+ );
1152
1163
  for (const r in a)
1153
1164
  r.startsWith(this.routeName) && delete a[r];
1154
1165
  return { ...a, ...t };
@@ -1166,15 +1177,25 @@ class st {
1166
1177
  const r = [];
1167
1178
  for (const c in e)
1168
1179
  if (c.startsWith(this.routeName + "[facets]")) {
1169
- const l = Z.removeXSSRiskyTags((t = e[c].split(":")) == null ? void 0 : t[0]), u = Z.removeXSSRiskyTags(decodeURIComponent((s = e[c].split(":")) == null ? void 0 : s[1])), d = Z.removeXSSRiskyTags(decodeURIComponent((a = e[c].split(":")) == null ? void 0 : a[2]));
1180
+ const l = Z.removeXSSRiskyTags(
1181
+ (t = e[c].split(":")) == null ? void 0 : t[0]
1182
+ ), u = Z.removeXSSRiskyTags(
1183
+ decodeURIComponent((s = e[c].split(":")) == null ? void 0 : s[1])
1184
+ ), d = Z.removeXSSRiskyTags(
1185
+ decodeURIComponent((a = e[c].split(":")) == null ? void 0 : a[2])
1186
+ );
1170
1187
  r.push({ type: l, name: u, value: d });
1171
1188
  }
1172
1189
  return r;
1173
1190
  }
1174
1191
  urlToSearchObject(e, t) {
1175
- const s = this.queryStringHelper.urlToParams(e), a = Z.removeXSSRiskyTags(decodeURIComponent(s[this.routeName + "[page]"])), r = parseInt(a), c = isNaN(r) ? 1 : r;
1192
+ const s = this.queryStringHelper.urlToParams(e), a = Z.removeXSSRiskyTags(
1193
+ decodeURIComponent(s[this.routeName + "[page]"])
1194
+ ), r = parseInt(a), c = isNaN(r) ? 1 : r;
1176
1195
  return {
1177
- query: Z.removeXSSRiskyTags(decodeURIComponent(s[this.routeName + "[query]"])) || "",
1196
+ query: Z.removeXSSRiskyTags(
1197
+ decodeURIComponent(s[this.routeName + "[query]"])
1198
+ ) || "",
1178
1199
  page: c,
1179
1200
  itemsPerPage: t,
1180
1201
  order: Z.removeXSSRiskyTags(s[this.routeName + "[order]"]) || "",
@@ -1282,7 +1303,7 @@ class _t {
1282
1303
  search(e, t, s = !1, a = !1) {
1283
1304
  if (e.query && e.query !== "undefined" && e.itemsPerPage !== void 0) {
1284
1305
  this.dataLayer.setSearchTerm(e.query), this.dataLayer.setLoading(!0), this.controllerSearch && this.controllerSearch.abort(), this.controllerSearch = new AbortController(), this.signalSearch = this.controllerSearch.signal;
1285
- const r = new Proxy(new URLSearchParams(window.location.search), {
1306
+ const r = new Proxy(new URLSearchParams((window == null ? void 0 : window.location.search) ?? ""), {
1286
1307
  get: (v, S) => v.get(S) ?? ""
1287
1308
  }), c = r.languageVariant ? (
1288
1309
  //@ts-expect-error - this is a hack to get around the fact that the urlQueryParams is a proxy
@@ -1367,7 +1388,7 @@ class ue {
1367
1388
  language: e.language
1368
1389
  };
1369
1390
  setTimeout(() => {
1370
- t.key && this.msq.push(["trackClick", t]);
1391
+ t.key && this.msq().push(["trackClick", t]);
1371
1392
  }, 0);
1372
1393
  }
1373
1394
  static trackSearch(e) {
@@ -1383,7 +1404,7 @@ class ue {
1383
1404
  impressions: e.impressions
1384
1405
  };
1385
1406
  setTimeout(() => {
1386
- t.key && this.msq.push(["track", t]);
1407
+ t.key && this.msq().push(["track", t]);
1387
1408
  }, 0);
1388
1409
  }
1389
1410
  static trackRelatedSearchClick(e) {
@@ -1399,7 +1420,7 @@ class ue {
1399
1420
  language: e.language
1400
1421
  };
1401
1422
  setTimeout(() => {
1402
- t.key && this.msq.push(["trackRelatedSearchClick", t]);
1423
+ t.key && this.msq().push(["trackRelatedSearchClick", t]);
1403
1424
  }, 0);
1404
1425
  }
1405
1426
  static trackRelatedSearches(e) {
@@ -1413,11 +1434,11 @@ class ue {
1413
1434
  impressions: e.impressions
1414
1435
  };
1415
1436
  setTimeout(() => {
1416
- t.key && this.msq.push(["trackRelatedSearch", t]);
1437
+ t.key && this.msq().push(["trackRelatedSearch", t]);
1417
1438
  }, 0);
1418
1439
  }
1419
1440
  }
1420
- h(ue, "msq", window._msq || []);
1441
+ h(ue, "msq", () => typeof window < "u" && window != null && window._msq ? window == null ? void 0 : window._msq : []);
1421
1442
  /*!
1422
1443
  * mustache.js - Logic-less {{mustache}} templates with JavaScript
1423
1444
  * http://github.com/janl/mustache.js
@@ -1431,7 +1452,7 @@ function je(i) {
1431
1452
  function Wt(i) {
1432
1453
  return ie(i) ? "array" : typeof i;
1433
1454
  }
1434
- function Ie(i) {
1455
+ function Pe(i) {
1435
1456
  return i.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
1436
1457
  }
1437
1458
  function rt(i, e) {
@@ -1480,13 +1501,13 @@ function ea(i, e) {
1480
1501
  function O(b) {
1481
1502
  if (typeof b == "string" && (b = b.split(Gt, 2)), !ie(b) || b.length !== 2)
1482
1503
  throw new Error("Invalid tags: " + b);
1483
- m = new RegExp(Ie(b[0]) + "\\s*"), v = new RegExp("\\s*" + Ie(b[1])), S = new RegExp("\\s*" + Ie("}" + b[1]));
1504
+ m = new RegExp(Pe(b[0]) + "\\s*"), v = new RegExp("\\s*" + Pe(b[1])), S = new RegExp("\\s*" + Pe("}" + b[1]));
1484
1505
  }
1485
- O(e || P.tags);
1486
- for (var R = new ge(i), k, E, T, N, W, A; !R.eos(); ) {
1506
+ O(e || I.tags);
1507
+ for (var R = new ge(i), k, E, T, D, W, A; !R.eos(); ) {
1487
1508
  if (k = R.pos, T = R.scanUntil(m), T)
1488
1509
  for (var Q = 0, f = T.length; Q < f; ++Q)
1489
- N = T.charAt(Q), Kt(N) ? (r.push(a.length), u += N) : (l = !0, t = !0, u += " "), a.push(["text", N, k, k + 1]), k += 1, N === `
1510
+ D = T.charAt(Q), Kt(D) ? (r.push(a.length), u += D) : (l = !0, t = !0, u += " "), a.push(["text", D, k, k + 1]), k += 1, D === `
1490
1511
  ` && (g(), u = "", d = 0, t = !1);
1491
1512
  if (!R.scan(m))
1492
1513
  break;
@@ -1598,7 +1619,7 @@ U.prototype.clearCache = function() {
1598
1619
  typeof this.templateCache < "u" && this.templateCache.clear();
1599
1620
  };
1600
1621
  U.prototype.parse = function(i, e) {
1601
- var t = this.templateCache, s = i + ":" + (e || P.tags).join(":"), a = typeof t < "u", r = a ? t.get(s) : void 0;
1622
+ var t = this.templateCache, s = i + ":" + (e || I.tags).join(":"), a = typeof t < "u", r = a ? t.get(s) : void 0;
1602
1623
  return r == null && (r = ea(i, e), a && t.set(s, r)), r;
1603
1624
  };
1604
1625
  U.prototype.render = function(i, e, t, s) {
@@ -1659,9 +1680,9 @@ U.prototype.unescapedValue = function(i, e) {
1659
1680
  return t;
1660
1681
  };
1661
1682
  U.prototype.escapedValue = function(i, e, t) {
1662
- var s = this.getConfigEscape(t) || P.escape, a = e.lookup(i[1]);
1683
+ var s = this.getConfigEscape(t) || I.escape, a = e.lookup(i[1]);
1663
1684
  if (a != null)
1664
- return typeof a == "number" && s === P.escape ? String(a) : s(a);
1685
+ return typeof a == "number" && s === I.escape ? String(a) : s(a);
1665
1686
  };
1666
1687
  U.prototype.rawValue = function(i) {
1667
1688
  return i[1];
@@ -1673,7 +1694,7 @@ U.prototype.getConfigEscape = function(i) {
1673
1694
  if (i && typeof i == "object" && !ie(i))
1674
1695
  return i.escape;
1675
1696
  };
1676
- var P = {
1697
+ var I = {
1677
1698
  name: "mustache.js",
1678
1699
  version: "4.2.0",
1679
1700
  tags: ["{{", "}}"],
@@ -1699,21 +1720,21 @@ var P = {
1699
1720
  return de.templateCache;
1700
1721
  }
1701
1722
  }, de = new U();
1702
- P.clearCache = function() {
1723
+ I.clearCache = function() {
1703
1724
  return de.clearCache();
1704
1725
  };
1705
- P.parse = function(i, e) {
1726
+ I.parse = function(i, e) {
1706
1727
  return de.parse(i, e);
1707
1728
  };
1708
- P.render = function(i, e, t, s) {
1729
+ I.render = function(i, e, t, s) {
1709
1730
  if (typeof i != "string")
1710
1731
  throw new TypeError('Invalid template! Template should be a "string" but "' + Wt(i) + '" was given as the first argument for mustache#render(template, view, partials)');
1711
1732
  return de.render(i, e, t, s);
1712
1733
  };
1713
- P.escape = Jt;
1714
- P.Scanner = ge;
1715
- P.Context = re;
1716
- P.Writer = U;
1734
+ I.escape = Jt;
1735
+ I.Scanner = ge;
1736
+ I.Context = re;
1737
+ I.Writer = U;
1717
1738
  const sa = {
1718
1739
  main: {
1719
1740
  template: `
@@ -2061,9 +2082,9 @@ class da {
2061
2082
  constructor(e) {
2062
2083
  h(this, "dataLayer"), h(this, "config"), h(this, "containerId"), h(this, "externalPromotionsContainerId"), h(this, "searchExternalPromotionsMainContainer", null);
2063
2084
  var t, s;
2064
- this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.externalPromotionsContainerId = ((s = (t = this.config.templates) == null ? void 0 : t.mainTemplate) == null ? void 0 : s.externalPromotionsContainerId) || x.externalPromotions.mainTemplate.externalPromotionsContainerId, this.searchExternalPromotionsMainContainer = document.getElementById(
2085
+ this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.externalPromotionsContainerId = ((s = (t = this.config.templates) == null ? void 0 : t.mainTemplate) == null ? void 0 : s.externalPromotionsContainerId) || x.externalPromotions.mainTemplate.externalPromotionsContainerId, typeof document < "u" && (this.searchExternalPromotionsMainContainer = document == null ? void 0 : document.getElementById(
2065
2086
  this.containerId
2066
- ), this.initializeSubscriptions(), this.renderMainTemplate(this.generateTemplateData());
2087
+ )), this.initializeSubscriptions(), this.renderMainTemplate(this.generateTemplateData());
2067
2088
  }
2068
2089
  initializeSubscriptions() {
2069
2090
  this.dataLayer.$searchExternalPromotions.subscribe((e) => {
@@ -2079,26 +2100,29 @@ class da {
2079
2100
  }
2080
2101
  addExternalSearch(e) {
2081
2102
  var t, s, a, r;
2082
- const c = document.getElementById(this.externalPromotionsContainerId);
2103
+ const c = typeof document < "u" ? document == null ? void 0 : document.getElementById(this.externalPromotionsContainerId) : null;
2083
2104
  if (c) {
2084
- const l = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.externalPromotion) == null ? void 0 : a.template) || ((r = x.externalPromotions.externalPromotion) == null ? void 0 : r.template), u = document.createElement("div");
2085
- u.classList.add("searchstax-external-promotion"), u.addEventListener("click", (d) => {
2086
- this.trackClick(e, d);
2087
- }), u.innerHTML = P.render(l, e), c.appendChild(u);
2105
+ const l = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.externalPromotion) == null ? void 0 : a.template) || ((r = x.externalPromotions.externalPromotion) == null ? void 0 : r.template);
2106
+ if (typeof document < "u") {
2107
+ const u = document == null ? void 0 : document.createElement("div");
2108
+ u.classList.add("searchstax-external-promotion"), u.addEventListener("click", (d) => {
2109
+ this.trackClick(e, d);
2110
+ }), u.innerHTML = I.render(l, e), c.appendChild(u);
2111
+ }
2088
2112
  }
2089
2113
  }
2090
2114
  trackClick(e, t) {
2091
- t.stopPropagation(), t.preventDefault(), window.open(e.url, "_blank");
2115
+ t.stopPropagation(), t.preventDefault(), window == null || window.open(e.url, "_blank");
2092
2116
  }
2093
2117
  renderMainTemplate(e) {
2094
2118
  var t, s, a, r;
2095
2119
  const c = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.mainTemplate) == null ? void 0 : a.template) || ((r = x.externalPromotions.mainTemplate) == null ? void 0 : r.template);
2096
2120
  if (this.dataLayer.renderingEngine === B.mustache) {
2097
2121
  this.searchExternalPromotionsMainContainer.innerHTML = //@ts-expect-error - mustache is not a module
2098
- P.render(c, e);
2099
- const l = document.getElementById(
2122
+ I.render(c, e);
2123
+ const l = typeof document < "u" ? document == null ? void 0 : document.getElementById(
2100
2124
  this.externalPromotionsContainerId
2101
- );
2125
+ ) : null;
2102
2126
  l && (l.innerHTML = "");
2103
2127
  for (const u of e.externalPromotions)
2104
2128
  this.addExternalSearch(u);
@@ -2121,7 +2145,9 @@ class ga {
2121
2145
  this.dataLayer.setSearchObject({ ...g, facets: m, page: 1 }), this.config.facetingType === "tabs" && this.renderMainTemplate(this.generateTemplateData(), !0);
2122
2146
  }, 0);
2123
2147
  }
2124
- }), this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.routerHelper = e.routerHelper, this.cacheFacets = t, this.facetPaginationStep = this.config.itemsPerPageDesktop, this.facetPaginationStepMobile = this.config.itemsPerPageMobile, this.searchFacetsMainContainer = document.getElementById(this.containerId), this.needCache && t(), this.initializeSubscriptions();
2148
+ }), this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.routerHelper = e.routerHelper, this.cacheFacets = t, this.facetPaginationStep = this.config.itemsPerPageDesktop, this.facetPaginationStepMobile = this.config.itemsPerPageMobile, typeof document < "u" && (this.searchFacetsMainContainer = document == null ? void 0 : document.getElementById(
2149
+ this.containerId
2150
+ )), this.needCache && t(), this.initializeSubscriptions();
2125
2151
  }
2126
2152
  get needCache() {
2127
2153
  return this.config.facetingType === "showUnavailable" || this.config.facetingType === "or" || this.config.facetingType === "tabs";
@@ -2201,28 +2227,30 @@ class ga {
2201
2227
  }
2202
2228
  createFacetItem(e, t, s) {
2203
2229
  var a, r, c, l, u, d, g, m, v, S, O, R;
2204
- const k = document.createElement("div");
2205
- k.classList.add("searchstax-facet-container"), this.deactivatedFacets[e.name] || k.classList.add("active");
2206
- const E = ((c = (r = (a = this.config) == null ? void 0 : a.templates) == null ? void 0 : r.facetItemContainerTemplate) == null ? void 0 : c.template) || ((l = x.facets.facetItemContainerTemplate) == null ? void 0 : l.template);
2207
- k.innerHTML = P.render(
2208
- E,
2209
- e
2210
- ), t.appendChild(k);
2211
- const T = k.querySelector(
2212
- "." + (((g = (d = (u = this.config) == null ? void 0 : u.templates) == null ? void 0 : d.facetItemContainerTemplate) == null ? void 0 : g.facetListTitleContainerClass) || ((m = x.facets.facetItemContainerTemplate) == null ? void 0 : m.facetListTitleContainerClass))
2213
- );
2214
- T == null || T.addEventListener("click", () => {
2215
- k.classList.toggle("active");
2216
- });
2217
- const N = k.querySelector(
2218
- "." + (((O = (S = (v = this.config) == null ? void 0 : v.templates) == null ? void 0 : S.facetItemContainerTemplate) == null ? void 0 : O.facetListContainerClass) || ((R = x.facets.facetItemContainerTemplate) == null ? void 0 : R.facetListContainerClass))
2219
- );
2220
- N && (e.values.forEach((W) => {
2221
- this.createFacetListItem(
2222
- W,
2223
- N
2230
+ if (typeof document < "u") {
2231
+ const k = document == null ? void 0 : document.createElement("div");
2232
+ k.classList.add("searchstax-facet-container"), this.deactivatedFacets[e.name] || k.classList.add("active");
2233
+ const E = ((c = (r = (a = this.config) == null ? void 0 : a.templates) == null ? void 0 : r.facetItemContainerTemplate) == null ? void 0 : c.template) || ((l = x.facets.facetItemContainerTemplate) == null ? void 0 : l.template);
2234
+ k.innerHTML = I.render(
2235
+ E,
2236
+ e
2237
+ ), t.appendChild(k);
2238
+ const T = k.querySelector(
2239
+ "." + (((g = (d = (u = this.config) == null ? void 0 : u.templates) == null ? void 0 : d.facetItemContainerTemplate) == null ? void 0 : g.facetListTitleContainerClass) || ((m = x.facets.facetItemContainerTemplate) == null ? void 0 : m.facetListTitleContainerClass))
2240
+ );
2241
+ T == null || T.addEventListener("click", () => {
2242
+ k.classList.toggle("active");
2243
+ });
2244
+ const D = k.querySelector(
2245
+ "." + (((O = (S = (v = this.config) == null ? void 0 : v.templates) == null ? void 0 : S.facetItemContainerTemplate) == null ? void 0 : O.facetListContainerClass) || ((R = x.facets.facetItemContainerTemplate) == null ? void 0 : R.facetListContainerClass))
2224
2246
  );
2225
- }), e.hasMoreFacets && this.createHasMoreComponent(e, N, s));
2247
+ D && (e.values.forEach((W) => {
2248
+ this.createFacetListItem(
2249
+ W,
2250
+ D
2251
+ );
2252
+ }), e.hasMoreFacets && this.createHasMoreComponent(e, D, s));
2253
+ }
2226
2254
  }
2227
2255
  isChecked(e) {
2228
2256
  var t;
@@ -2230,38 +2258,42 @@ class ga {
2230
2258
  }
2231
2259
  createFacetListItem(e, t) {
2232
2260
  var s, a, r, c, l, u, d, g, m, v, S, O, R;
2233
- const k = document.createElement("div");
2234
- k.classList.add("searchstax-facet-value-container"), e.disabled && k.classList.add("searchstax-facet-value-disabled");
2235
- const E = this.isChecked(e), T = ((r = (a = (s = this.config) == null ? void 0 : s.templates) == null ? void 0 : a.facetItemTemplate) == null ? void 0 : r.template) || ((c = x.facets.facetItemTemplate) == null ? void 0 : c.template);
2236
- k.innerHTML = P.render(
2237
- T,
2238
- { ...e, isChecked: E }
2239
- );
2240
- let N = (l = x.facets.facetItemTemplate) == null ? void 0 : l.checkTriggerClasses;
2241
- N = ((g = (d = (u = this.config) == null ? void 0 : u.templates) == null ? void 0 : d.facetItemTemplate) == null ? void 0 : g.checkTriggerClasses) || N, N.forEach((W) => {
2242
- var A;
2243
- (A = k.querySelector("." + W)) == null || A.addEventListener("click", (Q) => {
2244
- this.onFacetSelect(Q, e, k);
2245
- });
2246
- }), (R = k.querySelector(
2247
- "." + (((S = (v = (m = this.config) == null ? void 0 : m.templates) == null ? void 0 : v.facetItemTemplate) == null ? void 0 : S.inputCheckboxClass) || ((O = x.facets.facetItemTemplate) == null ? void 0 : O.inputCheckboxClass))
2248
- )) == null || R.addEventListener("click", (W) => {
2249
- this.onFacetSelect(W, e, k, !0);
2250
- }), t.appendChild(k);
2261
+ if (typeof document < "u") {
2262
+ const k = document == null ? void 0 : document.createElement("div");
2263
+ k.classList.add("searchstax-facet-value-container"), e.disabled && k.classList.add("searchstax-facet-value-disabled");
2264
+ const E = this.isChecked(e), T = ((r = (a = (s = this.config) == null ? void 0 : s.templates) == null ? void 0 : a.facetItemTemplate) == null ? void 0 : r.template) || ((c = x.facets.facetItemTemplate) == null ? void 0 : c.template);
2265
+ k.innerHTML = I.render(
2266
+ T,
2267
+ { ...e, isChecked: E }
2268
+ );
2269
+ let D = (l = x.facets.facetItemTemplate) == null ? void 0 : l.checkTriggerClasses;
2270
+ D = ((g = (d = (u = this.config) == null ? void 0 : u.templates) == null ? void 0 : d.facetItemTemplate) == null ? void 0 : g.checkTriggerClasses) || D, D.forEach((W) => {
2271
+ var A;
2272
+ (A = k.querySelector("." + W)) == null || A.addEventListener("click", (Q) => {
2273
+ this.onFacetSelect(Q, e, k);
2274
+ });
2275
+ }), (R = k.querySelector(
2276
+ "." + (((S = (v = (m = this.config) == null ? void 0 : m.templates) == null ? void 0 : v.facetItemTemplate) == null ? void 0 : S.inputCheckboxClass) || ((O = x.facets.facetItemTemplate) == null ? void 0 : O.inputCheckboxClass))
2277
+ )) == null || R.addEventListener("click", (W) => {
2278
+ this.onFacetSelect(W, e, k, !0);
2279
+ }), t.appendChild(k);
2280
+ }
2251
2281
  }
2252
2282
  createHasMoreComponent(e, t, s) {
2253
2283
  var a, r, c, l, u, d, g, m;
2254
- const v = document.createElement("div");
2255
- v.classList.add("searchstax-facet-show-more-container");
2256
- const S = ((c = (r = (a = this.config) == null ? void 0 : a.templates) == null ? void 0 : r.showMoreButtonContainerTemplate) == null ? void 0 : c.template) || ((l = x.facets.showMoreButtonContainerTemplate) == null ? void 0 : l.template);
2257
- v.innerHTML = P.render(
2258
- S,
2259
- e
2260
- );
2261
- const O = v.querySelector(
2262
- "." + (((g = (d = (u = this.config) == null ? void 0 : u.templates) == null ? void 0 : d.showMoreButtonContainerTemplate) == null ? void 0 : g.showMoreButtonClass) || ((m = x.facets.showMoreButtonContainerTemplate) == null ? void 0 : m.showMoreButtonClass))
2263
- );
2264
- O && (this.attachOnclickToShowMore(e, O, s), t && t.appendChild(O));
2284
+ if (typeof document < "u") {
2285
+ const v = document == null ? void 0 : document.createElement("div");
2286
+ v.classList.add("searchstax-facet-show-more-container");
2287
+ const S = ((c = (r = (a = this.config) == null ? void 0 : a.templates) == null ? void 0 : r.showMoreButtonContainerTemplate) == null ? void 0 : c.template) || ((l = x.facets.showMoreButtonContainerTemplate) == null ? void 0 : l.template);
2288
+ v.innerHTML = I.render(
2289
+ S,
2290
+ e
2291
+ );
2292
+ const O = v.querySelector(
2293
+ "." + (((g = (d = (u = this.config) == null ? void 0 : u.templates) == null ? void 0 : d.showMoreButtonContainerTemplate) == null ? void 0 : g.showMoreButtonClass) || ((m = x.facets.showMoreButtonContainerTemplate) == null ? void 0 : m.showMoreButtonClass))
2294
+ );
2295
+ O && (this.attachOnclickToShowMore(e, O, s), t && t.appendChild(O));
2296
+ }
2265
2297
  }
2266
2298
  attachOnclickToShowMore(e, t, s) {
2267
2299
  t.addEventListener("click", (a) => {
@@ -2279,7 +2311,7 @@ class ga {
2279
2311
  this.cachedData = e;
2280
2312
  const O = ((r = (a = (s = this.config) == null ? void 0 : s.templates) == null ? void 0 : a.mainTemplateDesktop) == null ? void 0 : r.template) || ((c = x.facets.mainTemplateDesktop) == null ? void 0 : c.template);
2281
2313
  if (this.dataLayer.renderingEngine === B.mustache && this.searchFacetsMainContainer) {
2282
- this.searchFacetsMainContainer.innerHTML = P.render(
2314
+ this.searchFacetsMainContainer.innerHTML = I.render(
2283
2315
  O,
2284
2316
  {
2285
2317
  ...e
@@ -2328,33 +2360,37 @@ class ga {
2328
2360
  }
2329
2361
  createClearFacetsComponents(e) {
2330
2362
  var t, s, a, r, c, l, u, d;
2331
- const g = this.dataLayer.searchObject, m = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.clearFacetsTemplate) == null ? void 0 : a.template) || ((r = x.facets.clearFacetsTemplate) == null ? void 0 : r.template), v = document.createElement("div");
2332
- v.innerHTML = P.render(
2333
- m,
2334
- {
2335
- shouldShow: g.facets.length > 0
2336
- }
2337
- );
2338
- const S = v.querySelector(
2339
- "." + (((u = (l = (c = this.config) == null ? void 0 : c.templates) == null ? void 0 : l.clearFacetsTemplate) == null ? void 0 : u.containerClass) || ((d = x.facets.clearFacetsTemplate) == null ? void 0 : d.containerClass))
2340
- );
2341
- S && (S.addEventListener("click", () => {
2342
- this.removeSelectedFacets();
2343
- }), e.appendChild(S));
2363
+ if (typeof document < "u") {
2364
+ const g = this.dataLayer.searchObject, m = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.clearFacetsTemplate) == null ? void 0 : a.template) || ((r = x.facets.clearFacetsTemplate) == null ? void 0 : r.template), v = document == null ? void 0 : document.createElement("div");
2365
+ v.innerHTML = I.render(
2366
+ m,
2367
+ {
2368
+ shouldShow: g.facets.length > 0
2369
+ }
2370
+ );
2371
+ const S = v.querySelector(
2372
+ "." + (((u = (l = (c = this.config) == null ? void 0 : c.templates) == null ? void 0 : l.clearFacetsTemplate) == null ? void 0 : u.containerClass) || ((d = x.facets.clearFacetsTemplate) == null ? void 0 : d.containerClass))
2373
+ );
2374
+ S && (S.addEventListener("click", () => {
2375
+ this.removeSelectedFacets();
2376
+ }), e.appendChild(S));
2377
+ }
2344
2378
  }
2345
2379
  createSelectedFacetsComponent(e, t) {
2346
2380
  var s, a, r, c, l, u, d, g;
2347
- const m = ((r = (a = (s = this.config) == null ? void 0 : s.templates) == null ? void 0 : a.selectedFacetsTemplate) == null ? void 0 : r.template) || ((c = x.facets.selectedFacetsTemplate) == null ? void 0 : c.template), v = document.createElement("div");
2348
- v.innerHTML = P.render(
2349
- m,
2350
- t
2351
- );
2352
- const S = v.querySelector(
2353
- "." + (((d = (u = (l = this.config) == null ? void 0 : l.templates) == null ? void 0 : u.selectedFacetsTemplate) == null ? void 0 : d.containerClass) || ((g = x.facets.selectedFacetsTemplate) == null ? void 0 : g.containerClass))
2354
- );
2355
- S && (S.addEventListener("click", () => {
2356
- this.unselectFacet(t);
2357
- }), e.appendChild(S));
2381
+ if (typeof document < "u") {
2382
+ const m = ((r = (a = (s = this.config) == null ? void 0 : s.templates) == null ? void 0 : a.selectedFacetsTemplate) == null ? void 0 : r.template) || ((c = x.facets.selectedFacetsTemplate) == null ? void 0 : c.template), v = document == null ? void 0 : document.createElement("div");
2383
+ v.innerHTML = I.render(
2384
+ m,
2385
+ t
2386
+ );
2387
+ const S = v.querySelector(
2388
+ "." + (((d = (u = (l = this.config) == null ? void 0 : l.templates) == null ? void 0 : u.selectedFacetsTemplate) == null ? void 0 : d.containerClass) || ((g = x.facets.selectedFacetsTemplate) == null ? void 0 : g.containerClass))
2389
+ );
2390
+ S && (S.addEventListener("click", () => {
2391
+ this.unselectFacet(t);
2392
+ }), e.appendChild(S));
2393
+ }
2358
2394
  }
2359
2395
  unselectFacet(e) {
2360
2396
  const t = this.dataLayer.searchObject;
@@ -2371,32 +2407,34 @@ class ga {
2371
2407
  }
2372
2408
  createFilterByComponent(e) {
2373
2409
  var t, s, a, r, c, l, u, d;
2374
- const g = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.filterByTemplate) == null ? void 0 : a.template) || ((r = x.facets.filterByTemplate) == null ? void 0 : r.template), m = document.createElement("div");
2375
- m.innerHTML = P.render(
2376
- g,
2377
- {}
2378
- );
2379
- const v = m.querySelector(
2380
- "." + (((u = (l = (c = this.config) == null ? void 0 : c.templates) == null ? void 0 : l.filterByTemplate) == null ? void 0 : u.containerClass) || ((d = x.facets.filterByTemplate) == null ? void 0 : d.containerClass))
2381
- );
2382
- v && (e.prepend(v), v.addEventListener("click", this.openOverlay.bind(this)));
2410
+ if (typeof document < "u") {
2411
+ const g = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.filterByTemplate) == null ? void 0 : a.template) || ((r = x.facets.filterByTemplate) == null ? void 0 : r.template), m = document == null ? void 0 : document.createElement("div");
2412
+ m.innerHTML = I.render(
2413
+ g,
2414
+ {}
2415
+ );
2416
+ const v = m.querySelector(
2417
+ "." + (((u = (l = (c = this.config) == null ? void 0 : c.templates) == null ? void 0 : l.filterByTemplate) == null ? void 0 : u.containerClass) || ((d = x.facets.filterByTemplate) == null ? void 0 : d.containerClass))
2418
+ );
2419
+ v && (e.prepend(v), v.addEventListener("click", this.openOverlay.bind(this)));
2420
+ }
2383
2421
  }
2384
2422
  openOverlay() {
2385
2423
  var e;
2386
- this.overlayOpened = !0, this.searchFacetsMainContainer && (document.body.classList.toggle("searchstax-no-scroll"), (e = this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay")) == null || e.classList.add("searchstax-show"));
2424
+ this.overlayOpened = !0, this.searchFacetsMainContainer && (typeof document < "u" && document.body.classList.toggle("searchstax-no-scroll"), (e = this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay")) == null || e.classList.add("searchstax-show"));
2387
2425
  }
2388
2426
  closeOverlay() {
2389
2427
  var e;
2390
- this.overlayOpened = !1, this.searchFacetsMainContainer && (document.body.classList.toggle("searchstax-no-scroll"), (e = this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay")) == null || e.classList.remove("searchstax-show"));
2428
+ this.overlayOpened = !1, this.searchFacetsMainContainer && (typeof document < "u" && document.body.classList.toggle("searchstax-no-scroll"), (e = this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay")) == null || e.classList.remove("searchstax-show"));
2391
2429
  }
2392
2430
  renderMobileTemplate(e) {
2393
- var t, s, a, r, c, l, u, d, g, m, v, S, O, R, k, E, T, N, W;
2394
- if (e) {
2395
- const A = document.createElement("div");
2431
+ var t, s, a, r, c, l, u, d, g, m, v, S, O, R, k, E, T, D, W;
2432
+ if (e && typeof document < "u") {
2433
+ const A = document == null ? void 0 : document.createElement("div");
2396
2434
  A.classList.add("searchstax-facets-container-mobile");
2397
2435
  const Q = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.mainTemplateMobile) == null ? void 0 : a.template) || ((r = x.facets.mainTemplateMobile) == null ? void 0 : r.template);
2398
2436
  if (this.dataLayer.renderingEngine === B.mustache) {
2399
- if (A.innerHTML = P.render(Q, {
2437
+ if (A.innerHTML = I.render(Q, {
2400
2438
  ...e,
2401
2439
  overlayOpened: this.overlayOpened
2402
2440
  }), (c = this.searchFacetsMainContainer) == null || c.appendChild(A), (u = (l = this.config) == null ? void 0 : l.templates) != null && u.mainTemplateMobile)
@@ -2418,7 +2456,7 @@ class ga {
2418
2456
  );
2419
2457
  b && (this.createSelectedFacetsComponents(b), this.createClearFacetsComponents(b));
2420
2458
  const j = A.querySelector(
2421
- "." + (((W = (N = (T = this.config) == null ? void 0 : T.templates) == null ? void 0 : N.mainTemplateMobile) == null ? void 0 : W.facetsContainerClass) || x.facets.mainTemplateMobile.facetsContainerClass)
2459
+ "." + (((W = (D = (T = this.config) == null ? void 0 : T.templates) == null ? void 0 : D.mainTemplateMobile) == null ? void 0 : W.facetsContainerClass) || x.facets.mainTemplateMobile.facetsContainerClass)
2422
2460
  );
2423
2461
  if (j) {
2424
2462
  j.innerHTML = "";
@@ -2433,9 +2471,9 @@ class pa {
2433
2471
  constructor(e) {
2434
2472
  h(this, "dataLayer"), h(this, "config"), h(this, "containerId"), h(this, "previousButtonClass"), h(this, "nextButtonClass"), h(this, "loadMoreButtonClass"), h(this, "routerHelper"), h(this, "searchPaginationMainContainer", null);
2435
2473
  var t, s, a, r, c, l, u, d, g;
2436
- this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.routerHelper = e.routerHelper, this.previousButtonClass = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.mainTemplate) == null ? void 0 : a.previousButtonClass) ?? x.pagination.mainTemplate.previousButtonClass, this.nextButtonClass = ((l = (c = (r = this.config) == null ? void 0 : r.templates) == null ? void 0 : c.mainTemplate) == null ? void 0 : l.nextButtonClass) ?? x.pagination.mainTemplate.nextButtonClass, this.loadMoreButtonClass = ((g = (d = (u = this.config) == null ? void 0 : u.templates) == null ? void 0 : d.infiniteScrollTemplate) == null ? void 0 : g.loadMoreButtonClass) ?? x.pagination.infiniteScrollTemplate.loadMoreButtonClass, this.searchPaginationMainContainer = document.getElementById(
2474
+ this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.routerHelper = e.routerHelper, this.previousButtonClass = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.mainTemplate) == null ? void 0 : a.previousButtonClass) ?? x.pagination.mainTemplate.previousButtonClass, this.nextButtonClass = ((l = (c = (r = this.config) == null ? void 0 : r.templates) == null ? void 0 : c.mainTemplate) == null ? void 0 : l.nextButtonClass) ?? x.pagination.mainTemplate.nextButtonClass, this.loadMoreButtonClass = ((g = (d = (u = this.config) == null ? void 0 : u.templates) == null ? void 0 : d.infiniteScrollTemplate) == null ? void 0 : g.loadMoreButtonClass) ?? x.pagination.infiniteScrollTemplate.loadMoreButtonClass, typeof document < "u" && (this.searchPaginationMainContainer = document == null ? void 0 : document.getElementById(
2437
2475
  this.containerId
2438
- ), this.initializeSubscriptions(), this.renderMainTemplate(this.generateTemplateData());
2476
+ )), this.initializeSubscriptions(), this.renderMainTemplate(this.generateTemplateData());
2439
2477
  }
2440
2478
  get isFirstPage() {
2441
2479
  var e;
@@ -2466,7 +2504,7 @@ class pa {
2466
2504
  }
2467
2505
  goToPage(e, t) {
2468
2506
  const s = this.dataLayer.searchObject;
2469
- s && (s.page = e, this.dataLayer.setSearchObject(s)), t || window.scrollTo(0, 0);
2507
+ s && (s.page = e, this.dataLayer.setSearchObject(s)), t || window == null || window.scrollTo(0, 0);
2470
2508
  }
2471
2509
  nextPage(e) {
2472
2510
  var t;
@@ -2498,7 +2536,7 @@ class pa {
2498
2536
  var t, s, a, r, c, l, u, d, g, m;
2499
2537
  this.searchPaginationMainContainer && ((t = this.searchPaginationMainContainer.querySelector("." + this.previousButtonClass)) == null || t.removeEventListener("click", this.previousPage), (s = this.searchPaginationMainContainer.querySelector("." + this.nextButtonClass)) == null || s.removeEventListener("click", this.nextPage));
2500
2538
  let v = ((c = (r = (a = this.config) == null ? void 0 : a.templates) == null ? void 0 : r.mainTemplate) == null ? void 0 : c.template) || ((l = x.pagination.mainTemplate) == null ? void 0 : l.template);
2501
- this.dataLayer.isInfiniteScroll && (v = ((g = (d = (u = this.config) == null ? void 0 : u.templates) == null ? void 0 : d.infiniteScrollTemplate) == null ? void 0 : g.template) || ((m = x.pagination.infiniteScrollTemplate) == null ? void 0 : m.template)), this.dataLayer.renderingEngine === B.mustache && (this.searchPaginationMainContainer.innerHTML = P.render(
2539
+ this.dataLayer.isInfiniteScroll && (v = ((g = (d = (u = this.config) == null ? void 0 : u.templates) == null ? void 0 : d.infiniteScrollTemplate) == null ? void 0 : g.template) || ((m = x.pagination.infiniteScrollTemplate) == null ? void 0 : m.template)), this.dataLayer.renderingEngine === B.mustache && (this.searchPaginationMainContainer.innerHTML = I.render(
2502
2540
  v,
2503
2541
  e
2504
2542
  ), setTimeout(() => {
@@ -2510,7 +2548,9 @@ class ma {
2510
2548
  constructor(e) {
2511
2549
  h(this, "dataLayer"), h(this, "config"), h(this, "containerId"), h(this, "relatedSearchesContainerClass"), h(this, "searchRelatedSearchesMainContainer", null), h(this, "track");
2512
2550
  var t, s;
2513
- this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.relatedSearchesContainerClass = ((s = (t = this.config.templates) == null ? void 0 : t.main) == null ? void 0 : s.relatedSearchesContainerClass) || x.relatedSearches.main.relatedSearchesContainerClass, this.searchRelatedSearchesMainContainer = document.getElementById(this.containerId), this.track = e.trackRelatedSearchClick, this.initializeSubscriptions();
2551
+ this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.relatedSearchesContainerClass = ((s = (t = this.config.templates) == null ? void 0 : t.main) == null ? void 0 : s.relatedSearchesContainerClass) || x.relatedSearches.main.relatedSearchesContainerClass, typeof document < "u" && (this.searchRelatedSearchesMainContainer = document == null ? void 0 : document.getElementById(
2552
+ this.containerId
2553
+ )), this.track = e.trackRelatedSearchClick, this.initializeSubscriptions();
2514
2554
  }
2515
2555
  initializeSubscriptions() {
2516
2556
  this.dataLayer.$searchRelatedSearches.subscribe((e) => {
@@ -2525,15 +2565,20 @@ class ma {
2525
2565
  }
2526
2566
  addRelatedSearchComponent(e, t) {
2527
2567
  var s, a, r, c, l;
2528
- const u = document.createElement("div"), d = ((r = (a = (s = this.config) == null ? void 0 : s.templates) == null ? void 0 : a.relatedSearch) == null ? void 0 : r.template) || x.relatedSearches.relatedSearch.template;
2529
- if (this.dataLayer.renderingEngine === B.mustache) {
2530
- u.innerHTML = P.render(d, e);
2531
- const g = u.querySelector(
2532
- "." + (((l = (c = this.config.templates) == null ? void 0 : c.relatedSearch) == null ? void 0 : l.relatedSearchContainerClass) || x.relatedSearches.relatedSearch.relatedSearchContainerClass)
2533
- );
2534
- g && (t.appendChild(g), g.addEventListener("click", () => {
2535
- this.executeSearch(e);
2536
- }));
2568
+ if (typeof document < "u") {
2569
+ const u = document == null ? void 0 : document.createElement("div"), d = ((r = (a = (s = this.config) == null ? void 0 : s.templates) == null ? void 0 : a.relatedSearch) == null ? void 0 : r.template) || x.relatedSearches.relatedSearch.template;
2570
+ if (this.dataLayer.renderingEngine === B.mustache) {
2571
+ u.innerHTML = I.render(
2572
+ d,
2573
+ e
2574
+ );
2575
+ const g = u.querySelector(
2576
+ "." + (((l = (c = this.config.templates) == null ? void 0 : c.relatedSearch) == null ? void 0 : l.relatedSearchContainerClass) || x.relatedSearches.relatedSearch.relatedSearchContainerClass)
2577
+ );
2578
+ g && (t.appendChild(g), g.addEventListener("click", () => {
2579
+ this.executeSearch(e);
2580
+ }));
2581
+ }
2537
2582
  }
2538
2583
  }
2539
2584
  executeSearch(e) {
@@ -2545,7 +2590,7 @@ class ma {
2545
2590
  const c = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.main) == null ? void 0 : a.template) || x.relatedSearches.main.template;
2546
2591
  if (this.dataLayer.renderingEngine === B.mustache && this.searchRelatedSearchesMainContainer) {
2547
2592
  this.searchRelatedSearchesMainContainer.innerHTML = "", this.searchRelatedSearchesMainContainer.innerHTML = //@ts-expect-error - mustache is not a module
2548
- P.render(c, e);
2593
+ I.render(c, e);
2549
2594
  const l = (r = this.searchRelatedSearchesMainContainer) == null ? void 0 : r.querySelector(
2550
2595
  `.${this.relatedSearchesContainerClass}`
2551
2596
  );
@@ -2557,7 +2602,9 @@ class ma {
2557
2602
  }
2558
2603
  class fa {
2559
2604
  constructor(e) {
2560
- h(this, "dataLayer"), h(this, "config"), h(this, "containerId"), h(this, "searchFeedbackMainContainer", null), h(this, "searchTrigger"), this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.searchTrigger = e.searchTrigger, this.searchFeedbackMainContainer = document.getElementById(this.containerId), this.initializeSubscriptions();
2605
+ h(this, "dataLayer"), h(this, "config"), h(this, "containerId"), h(this, "searchFeedbackMainContainer", null), h(this, "searchTrigger"), this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.searchTrigger = e.searchTrigger, typeof document < "u" && (this.searchFeedbackMainContainer = document == null ? void 0 : document.getElementById(
2606
+ this.containerId
2607
+ )), this.initializeSubscriptions();
2561
2608
  }
2562
2609
  initializeSubscriptions() {
2563
2610
  this.dataLayer.$searchResults.subscribe((e) => {
@@ -2581,12 +2628,18 @@ class fa {
2581
2628
  const c = (r = this.searchFeedbackMainContainer) == null ? void 0 : r.querySelector(
2582
2629
  "." + (((s = (t = (e = this.config) == null ? void 0 : e.templates) == null ? void 0 : t.main) == null ? void 0 : s.originalQueryClass) || ((a = x.searchFeedback.main) == null ? void 0 : a.originalQueryClass))
2583
2630
  );
2584
- c && c.addEventListener("click", this.onOriginalQueryClick.bind(this));
2631
+ c && c.addEventListener(
2632
+ "click",
2633
+ this.onOriginalQueryClick.bind(this)
2634
+ );
2585
2635
  }
2586
2636
  renderMainTemplate(e) {
2587
2637
  var t, s, a;
2588
2638
  const r = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.main) == null ? void 0 : a.template) || x.searchFeedback.main.template;
2589
- this.dataLayer.renderingEngine === B.mustache && (this.searchFeedbackMainContainer.innerHTML = P.render(r, e), setTimeout(() => {
2639
+ this.dataLayer.renderingEngine === B.mustache && (this.searchFeedbackMainContainer.innerHTML = I.render(
2640
+ r,
2641
+ e
2642
+ ), setTimeout(() => {
2590
2643
  this.attachClick();
2591
2644
  }, 0));
2592
2645
  }
@@ -2597,40 +2650,48 @@ class va {
2597
2650
  }
2598
2651
  renderMainTemplate() {
2599
2652
  var e, t, s, a;
2600
- const r = document.getElementById(this.containerId);
2601
- if (!r)
2602
- throw new Error("Search input container not found");
2603
- const c = ((t = (e = this.config.templates) == null ? void 0 : e.mainTemplate) == null ? void 0 : t.template) || x.searchInput.mainTemplate.template;
2604
- if (this.dataLayer.renderingEngine === B.mustache) {
2605
- const d = P.render(c, {});
2606
- r.innerHTML = d;
2653
+ if (typeof document < "u") {
2654
+ const r = document == null ? void 0 : document.getElementById(this.containerId);
2655
+ if (!r)
2656
+ throw new Error("Search input container not found");
2657
+ const c = ((t = (e = this.config.templates) == null ? void 0 : e.mainTemplate) == null ? void 0 : t.template) || x.searchInput.mainTemplate.template;
2658
+ if (this.dataLayer.renderingEngine === B.mustache) {
2659
+ const d = I.render(c, {});
2660
+ r.innerHTML = d;
2661
+ }
2662
+ const l = ((a = (s = this.config.templates) == null ? void 0 : s.mainTemplate) == null ? void 0 : a.searchInputId) || x.searchInput.mainTemplate.searchInputId, u = document == null ? void 0 : document.querySelector(`#${l}`);
2663
+ if (u)
2664
+ this.searchInput = u, u.addEventListener("keyup", this.inputKeyupEvent.bind(this)), u.addEventListener("blur", this.hideAutosuggest.bind(this)), u.addEventListener("paste", this.inputPasteEvent.bind(this));
2665
+ else
2666
+ throw new Error("Input not found");
2607
2667
  }
2608
- const l = ((a = (s = this.config.templates) == null ? void 0 : s.mainTemplate) == null ? void 0 : a.searchInputId) || x.searchInput.mainTemplate.searchInputId, u = document.querySelector(`#${l}`);
2609
- if (u)
2610
- this.searchInput = u, u.addEventListener("keyup", this.inputKeyupEvent.bind(this)), u.addEventListener("blur", this.hideAutosuggest.bind(this)), u.addEventListener("paste", this.inputPasteEvent.bind(this));
2611
- else
2612
- throw new Error("Input not found");
2613
2668
  }
2614
2669
  createAutosuggestContainer() {
2615
2670
  var e;
2616
- this.dataLayer.renderingEngine === B.mustache && (this.autosuggestContainer = document.createElement("div"), this.autosuggestContainer.classList.add("searchstax-autosuggest-container"), this.autosuggestContainer.addEventListener("mouseleave", () => {
2671
+ this.dataLayer.renderingEngine === B.mustache && typeof document < "u" && (this.autosuggestContainer = document == null ? void 0 : document.createElement("div"), this.autosuggestContainer.classList.add(
2672
+ "searchstax-autosuggest-container"
2673
+ ), this.autosuggestContainer.addEventListener("mouseleave", () => {
2617
2674
  this.resetAutosuggestSelection(), this.markActiveAutosuggestItem();
2618
2675
  }), (e = this.searchInput) == null || e.after(this.autosuggestContainer));
2619
2676
  }
2620
2677
  actionButtonInit() {
2621
- this.actionButton = document.getElementById("searchstax-search-input-action-button"), this.actionButton && this.actionButton.addEventListener("click", () => {
2678
+ typeof document < "u" && (this.actionButton = document == null ? void 0 : document.getElementById(
2679
+ "searchstax-search-input-action-button"
2680
+ ), this.actionButton && this.actionButton.addEventListener("click", () => {
2622
2681
  var e;
2623
2682
  this.buttonState === "search" ? this.executeSearch(((e = this.searchInput) == null ? void 0 : e.value) ?? "") : this.buttonState === "close" && this.searchInput && (this.searchInput.value = "", this.executeSearch(""));
2624
- });
2683
+ }));
2625
2684
  }
2626
2685
  attachSubscriptions() {
2627
2686
  this.dataLayer.$searchTermChange.subscribe(() => {
2628
2687
  this.handleSearchTermChange();
2629
2688
  }), this.dataLayer.$loadingChange.subscribe(() => {
2630
2689
  this.handleLoadingChange();
2631
- }), this.dataLayer.$searchAutosuggest.subscribe((e) => {
2632
- e && this.appendSuggestions(e);
2633
- }), this.dataLayer.$searchObject.subscribe((e) => {
2690
+ }), this.dataLayer.$searchAutosuggest.subscribe(
2691
+ (e) => {
2692
+ e && this.appendSuggestions(e);
2693
+ }
2694
+ ), this.dataLayer.$searchObject.subscribe((e) => {
2634
2695
  e.query !== "undefined" && e.query !== void 0 && e.query !== "*" && this.searchInput && (this.searchInput.value = this.cleanSuggestionTerm(e.query ?? ""));
2635
2696
  });
2636
2697
  }
@@ -2665,10 +2726,14 @@ class va {
2665
2726
  this.selectedAutosuggestItem = -1, this.markActiveAutosuggestItem();
2666
2727
  }
2667
2728
  markActiveAutosuggestItem() {
2668
- const e = document.getElementsByClassName("searchstax-autosuggest-item");
2669
- for (let t = 0; t < e.length; t++) {
2670
- const s = e[t];
2671
- t === this.selectedAutosuggestItem ? s.classList.add("active") : s.classList.remove("active");
2729
+ if (typeof document < "u") {
2730
+ const e = document == null ? void 0 : document.getElementsByClassName(
2731
+ "searchstax-autosuggest-item"
2732
+ );
2733
+ for (let t = 0; t < e.length; t++) {
2734
+ const s = e[t];
2735
+ t === this.selectedAutosuggestItem ? s.classList.add("active") : s.classList.remove("active");
2736
+ }
2672
2737
  }
2673
2738
  }
2674
2739
  inputKeyupEvent(e) {
@@ -2690,7 +2755,9 @@ class va {
2690
2755
  this.hideAutosuggest(), this.searchTrigger(e === "" ? "*" : e);
2691
2756
  }
2692
2757
  suggestionChosen() {
2693
- this.selectedAutosuggestItem > -1 ? this.autosuggestItemClicked(this.autosuggestResults.suggestions[this.selectedAutosuggestItem]) : this.executeSearch(this.currentInputValue);
2758
+ this.selectedAutosuggestItem > -1 ? this.autosuggestItemClicked(
2759
+ this.autosuggestResults.suggestions[this.selectedAutosuggestItem]
2760
+ ) : this.executeSearch(this.currentInputValue);
2694
2761
  }
2695
2762
  hideAutosuggest() {
2696
2763
  setTimeout(() => {
@@ -2698,21 +2765,23 @@ class va {
2698
2765
  }, 200);
2699
2766
  }
2700
2767
  cleanSuggestionTerm(e) {
2701
- return Z.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi, "")).trim();
2768
+ return Z.removeXSSRiskyTags(
2769
+ e.replace(/(<([^>]+)>)/gi, "")
2770
+ ).trim();
2702
2771
  }
2703
2772
  autosuggestItemClicked(e) {
2704
2773
  this.searchInput.value = this.cleanSuggestionTerm(e.term ?? ""), this.executeSearch(this.cleanSuggestionTerm(e.term));
2705
2774
  }
2706
2775
  createAutosuggestItem(e) {
2707
2776
  var t, s, a;
2708
- const r = document.createElement("div");
2777
+ const r = document == null ? void 0 : document.createElement("div");
2709
2778
  r.classList.add("searchstax-autosuggest-item"), r.addEventListener("click", () => {
2710
2779
  this.autosuggestItemClicked(e);
2711
2780
  }), r.addEventListener("mouseenter", () => {
2712
2781
  this.onSuggestionEnter(e);
2713
2782
  });
2714
2783
  const c = ((s = (t = this.config.templates) == null ? void 0 : t.autosuggestItemTemplate) == null ? void 0 : s.template) || ((a = x.searchInput.autosuggestItemTemplate) == null ? void 0 : a.template);
2715
- return r.innerHTML = P.render(c, e), r;
2784
+ return r.innerHTML = I.render(c, e), r;
2716
2785
  }
2717
2786
  onSuggestionEnter(e) {
2718
2787
  var t;
@@ -2727,7 +2796,9 @@ class va {
2727
2796
  if (Object.prototype.hasOwnProperty.call(s, a)) {
2728
2797
  const r = s[a];
2729
2798
  this.autosuggestResults = r, this.dataLayer.setAutosuggestResults(r), r.numFound > 0 ? r.suggestions.forEach((c) => {
2730
- this.autosuggestContainer && this.autosuggestContainer.appendChild(this.createAutosuggestItem(c));
2799
+ this.autosuggestContainer && typeof document < "u" && this.autosuggestContainer.appendChild(
2800
+ this.createAutosuggestItem(c)
2801
+ );
2731
2802
  }) : this.autosuggestContainer && this.autosuggestContainer.classList.add("hidden");
2732
2803
  }
2733
2804
  }
@@ -2738,7 +2809,7 @@ class ya {
2738
2809
  h(this, "dataLayer"), h(this, "config"), h(this, "linkClickCallback"), h(this, "searchCallback"), h(this, "containerId"), h(this, "searchResultsMainContainer"), h(this, "searchResultsContainer"), h(this, "searchResultLinks", []), this.linkClickCallback = e.linkClickCallback, this.searchCallback = e.searchTrigger, this.dataLayer = e.dataLayer, this.config = e.config, setTimeout(() => {
2739
2810
  this.dataLayer.setSearchObject({ ...this.dataLayer.searchObject, itemsPerPage: this.config.resultsPerPage || 10 });
2740
2811
  }, 0), this.containerId = e.containerId;
2741
- const t = document.getElementById(this.containerId);
2812
+ const t = document == null ? void 0 : document.getElementById(this.containerId);
2742
2813
  if (t)
2743
2814
  this.searchResultsMainContainer = t;
2744
2815
  else
@@ -2758,7 +2829,7 @@ class ya {
2758
2829
  renderNoResultsTemplate() {
2759
2830
  var e, t, s, a, r;
2760
2831
  const c = ((s = (t = (e = this.config) == null ? void 0 : e.templates) == null ? void 0 : t.noSearchResultTemplate) == null ? void 0 : s.template) || ((a = x.searchResults.noSearchResultTemplate) == null ? void 0 : a.template), l = ((r = this.dataLayer.searchResultsMetadata) == null ? void 0 : r.spellingSuggestion) ?? "";
2761
- if (this.dataLayer.renderingEngine === B.mustache && this.searchResultsContainer && (this.searchResultsContainer.innerHTML = P.render(
2832
+ if (this.dataLayer.renderingEngine === B.mustache && this.searchResultsContainer && (this.searchResultsContainer.innerHTML = I.render(
2762
2833
  c,
2763
2834
  {
2764
2835
  spellingSuggestion: l,
@@ -2777,7 +2848,7 @@ class ya {
2777
2848
  if (this.removeLinkClickEvents(), e.length === 0)
2778
2849
  this.renderNoResultsTemplate();
2779
2850
  else {
2780
- const l = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.searchResultTemplate) == null ? void 0 : a.template) || ((r = x.searchResults.searchResultTemplate) == null ? void 0 : r.template), u = e.map((d) => P.render(l, d));
2851
+ const l = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.searchResultTemplate) == null ? void 0 : a.template) || ((r = x.searchResults.searchResultTemplate) == null ? void 0 : r.template), u = e.map((d) => I.render(l, d));
2781
2852
  ((c = this.config) == null ? void 0 : c.renderMethod) === "infiniteScroll" && this.dataLayer.searchObject.page > 1 ? this.searchResultsContainer.innerHTML += u.join("") : this.searchResultsContainer.innerHTML = u.join(""), this.searchResultLinks = Array.from(
2782
2853
  this.searchResultsContainer.querySelectorAll(
2783
2854
  `[${this.uniqueIdAttribute}]`
@@ -2807,12 +2878,12 @@ class ya {
2807
2878
  renderMainTemplate() {
2808
2879
  var e, t, s, a;
2809
2880
  const r = ((s = (t = (e = this.config) == null ? void 0 : e.templates) == null ? void 0 : t.mainTemplate) == null ? void 0 : s.template) || ((a = x.searchResults.mainTemplate) == null ? void 0 : a.template);
2810
- this.dataLayer.renderingEngine === B.mustache && (this.searchResultsMainContainer.innerHTML = P.render(
2881
+ this.dataLayer.renderingEngine === B.mustache && (this.searchResultsMainContainer.innerHTML = I.render(
2811
2882
  r,
2812
2883
  {}
2813
2884
  ), setTimeout(() => {
2814
2885
  var c, l, u, d, g, m, v;
2815
- const S = (u = (l = (c = this.config) == null ? void 0 : c.templates) == null ? void 0 : l.mainTemplate) != null && u.searchResultsContainerId ? (m = (g = (d = this.config) == null ? void 0 : d.templates) == null ? void 0 : g.mainTemplate) == null ? void 0 : m.searchResultsContainerId : (v = x.searchResults.mainTemplate) == null ? void 0 : v.searchResultsContainerId, O = document.getElementById(S);
2886
+ const S = (u = (l = (c = this.config) == null ? void 0 : c.templates) == null ? void 0 : l.mainTemplate) != null && u.searchResultsContainerId ? (m = (g = (d = this.config) == null ? void 0 : d.templates) == null ? void 0 : g.mainTemplate) == null ? void 0 : m.searchResultsContainerId : (v = x.searchResults.mainTemplate) == null ? void 0 : v.searchResultsContainerId, O = document == null ? void 0 : document.getElementById(S);
2816
2887
  if (O)
2817
2888
  this.searchResultsContainer = O;
2818
2889
  else
@@ -2824,7 +2895,7 @@ class xa {
2824
2895
  constructor(e) {
2825
2896
  h(this, "dataLayer"), h(this, "config"), h(this, "containerId"), h(this, "selectId"), h(this, "searchSortingMainContainer", null);
2826
2897
  var t, s;
2827
- this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.selectId = ((s = (t = this.config.templates) == null ? void 0 : t.main) == null ? void 0 : s.selectId) || x.sorting.main.selectId, this.searchSortingMainContainer = document.getElementById(this.containerId), this.initializeSubscriptions(), this.renderMainTemplate(this.generateTemplateData());
2898
+ this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.selectId = ((s = (t = this.config.templates) == null ? void 0 : t.main) == null ? void 0 : s.selectId) || x.sorting.main.selectId, this.searchSortingMainContainer = document == null ? void 0 : document.getElementById(this.containerId), this.initializeSubscriptions(), this.renderMainTemplate(this.generateTemplateData());
2828
2899
  }
2829
2900
  initializeSubscriptions() {
2830
2901
  this.dataLayer.$searchResults.subscribe((e) => {
@@ -2842,7 +2913,7 @@ class xa {
2842
2913
  t && (t.order = e, this.dataLayer.setSearchObject(t));
2843
2914
  }
2844
2915
  markOptionSelected() {
2845
- const e = document.getElementById(
2916
+ const e = document == null ? void 0 : document.getElementById(
2846
2917
  this.selectId
2847
2918
  );
2848
2919
  if (e) {
@@ -2858,11 +2929,11 @@ class xa {
2858
2929
  var t, s, a;
2859
2930
  const r = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.main) == null ? void 0 : a.template) || x.sorting.main.template;
2860
2931
  if (this.dataLayer.renderingEngine === B.mustache) {
2861
- this.searchSortingMainContainer.innerHTML = P.render(
2932
+ this.searchSortingMainContainer.innerHTML = I.render(
2862
2933
  r,
2863
2934
  e
2864
2935
  ), this.markOptionSelected();
2865
- const c = document.getElementById(
2936
+ const c = document == null ? void 0 : document.getElementById(
2866
2937
  this.selectId
2867
2938
  );
2868
2939
  c && c.addEventListener("change", (l) => {
@@ -2873,7 +2944,7 @@ class xa {
2873
2944
  }
2874
2945
  class ba {
2875
2946
  constructor(e) {
2876
- h(this, "dataLayer"), h(this, "config"), h(this, "containerId"), h(this, "answerContainer", null), this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.answerContainer = document.getElementById(this.containerId), this.initializeSubscriptions(), this.dataLayer.setIsAnswerWidgetCreated(!0);
2947
+ h(this, "dataLayer"), h(this, "config"), h(this, "containerId"), h(this, "answerContainer", null), this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, typeof document < "u" && (this.answerContainer = document == null ? void 0 : document.getElementById(this.containerId)), this.initializeSubscriptions(), this.dataLayer.setIsAnswerWidgetCreated(!0);
2877
2948
  }
2878
2949
  initializeSubscriptions() {
2879
2950
  this.dataLayer.$answer.subscribe(() => {
@@ -2885,7 +2956,7 @@ class ba {
2885
2956
  renderMainTemplate(e) {
2886
2957
  var t, s, a;
2887
2958
  const r = ((a = (s = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : s.main) == null ? void 0 : a.template) || x.answer.main.template;
2888
- this.dataLayer.renderingEngine === B.mustache && (this.answerContainer.innerHTML = P.render(
2959
+ this.dataLayer.renderingEngine === B.mustache && (this.answerContainer.innerHTML = I.render(
2889
2960
  r,
2890
2961
  e
2891
2962
  ));
@@ -2915,21 +2986,28 @@ class Ca {
2915
2986
  });
2916
2987
  });
2917
2988
  }
2989
+ attachAnalyticsScript(e) {
2990
+ const t = e || "https://static.searchstax.com/studio-js/v3/js/studio-analytics.js";
2991
+ var s = document.createElement("script");
2992
+ s.type = "text/javascript", s.src = t;
2993
+ var a = document.getElementsByTagName("script")[0];
2994
+ a.parentNode && a.parentNode.insertBefore(s, a);
2995
+ }
2918
2996
  initialize(e) {
2919
2997
  var t, s;
2920
- if (e.turnAIAnswerGenerationOn === !0 && (this.dataLayer.turnAIAnswerGenerationOn = !0), e.autoCorrect === !1 && (this.dataLayer.autoCorrect = !1), this.dataLayer.searchstaxConfig || (this.dataLayer.setSearchstaxConfig(e), this.searchHelper = new _t(
2998
+ if (e.analyticsBaseUrl && typeof window < "u" && (window.analyticsBaseUrl = e.analyticsBaseUrl, window._msq = e._msq || [], this.attachAnalyticsScript(e.analyticsSrc)), e.turnAIAnswerGenerationOn === !0 && (this.dataLayer.turnAIAnswerGenerationOn = !0), e.autoCorrect === !1 && (this.dataLayer.autoCorrect = !1), this.dataLayer.searchstaxConfig || (this.dataLayer.setSearchstaxConfig(e), this.searchHelper = new _t(
2921
2999
  { ...e, sessionId: this.dataLayer.sessionId },
2922
3000
  this.dataLayer
2923
3001
  )), ((t = e.router) == null ? void 0 : t.enabled) === void 0 || ((s = e.router) == null ? void 0 : s.enabled) === !0) {
2924
3002
  this.routerEnabled = !0, this.routerHelper = new st(
2925
3003
  e.router ? e.router : { enabled: !0 }
2926
3004
  );
2927
- const a = this.routerHelper.urlToSearchObject(window.location.href);
3005
+ const a = this.routerHelper.urlToSearchObject((window == null ? void 0 : window.location.href) ?? "");
2928
3006
  this.dataLayer.searchObject.itemsPerPage && (a.itemsPerPage = this.dataLayer.searchObject.itemsPerPage), this.dataLayer.setSearchObject(
2929
3007
  a
2930
3008
  ), addEventListener("popstate", () => {
2931
3009
  this.routerHelper && this.dataLayer.setSearchObject(
2932
- this.routerHelper.urlToSearchObject(window.location.href, this.dataLayer.searchObject.itemsPerPage)
3010
+ this.routerHelper.urlToSearchObject((window == null ? void 0 : window.location.href) ?? "", this.dataLayer.searchObject.itemsPerPage)
2933
3011
  );
2934
3012
  });
2935
3013
  } else
@@ -3107,7 +3185,7 @@ class Ca {
3107
3185
  result: a,
3108
3186
  ...this.dataLayer.parsedData.trackingData
3109
3187
  }), setTimeout(() => {
3110
- window.location.href = (a == null ? void 0 : a.url) ?? "";
3188
+ typeof window < "u" && (window.location.href = (a == null ? void 0 : a.url) ?? "");
3111
3189
  }, 0)));
3112
3190
  }
3113
3191
  setPage(e) {
@@ -3212,7 +3290,9 @@ function Ta(i) {
3212
3290
  authType: i.authType ?? "basic",
3213
3291
  autoCorrect: i.autoCorrect,
3214
3292
  router: i.router,
3215
- hooks: e
3293
+ hooks: e,
3294
+ analyticsBaseUrl: i.analyticsBaseUrl,
3295
+ analyticsSrc: i.analyticsSrc
3216
3296
  }), i.initialized(C.searchstax);
3217
3297
  }, [i.initialized]), /* @__PURE__ */ o.jsx(o.Fragment, { children: i.children });
3218
3298
  }
@@ -3532,7 +3612,7 @@ function Ea(i) {
3532
3612
  i.searchOverviewTemplate && /* @__PURE__ */ o.jsx(o.Fragment, { children: i.searchOverviewTemplate(t, c) })
3533
3613
  ] }) });
3534
3614
  }
3535
- function Ia(i) {
3615
+ function Pa(i) {
3536
3616
  const [e, t] = H(
3537
3617
  null
3538
3618
  ), [s, a] = H(
@@ -3596,7 +3676,7 @@ function Ia(i) {
3596
3676
  E(j)
3597
3677
  ));
3598
3678
  }
3599
- function N(f, b) {
3679
+ function D(f, b) {
3600
3680
  var j;
3601
3681
  (j = C.searchstax.searchFacetsWidget) == null || j.onShowMoreLessClick(
3602
3682
  f,
@@ -3717,7 +3797,7 @@ function Ia(i) {
3717
3797
  {
3718
3798
  className: "searchstax-facet-show-more-container",
3719
3799
  onClick: (b) => {
3720
- N(b, f);
3800
+ D(b, f);
3721
3801
  },
3722
3802
  children: [
3723
3803
  f.showingAllFacets && /* @__PURE__ */ o.jsx("div", { className: "searchstax-facet-show-less-button searchstax-facet-show-button", children: "less" }),
@@ -3737,7 +3817,7 @@ function Ia(i) {
3737
3817
  k,
3738
3818
  T,
3739
3819
  E,
3740
- N
3820
+ D
3741
3821
  ) }),
3742
3822
  (s == null ? void 0 : s.hasResultsOrExternalPromotions) && !i.facetsTemplateMobile && /* @__PURE__ */ o.jsx("div", { className: "searchstax-facets-container-mobile", children: /* @__PURE__ */ o.jsxs("div", { className: "searchstax-facets-pills-container", children: [
3743
3823
  /* @__PURE__ */ o.jsx(
@@ -3947,7 +4027,7 @@ function Ia(i) {
3947
4027
  ) })
3948
4028
  ] }) });
3949
4029
  }
3950
- function Pa(i) {
4030
+ function Ia(i) {
3951
4031
  let e = !1;
3952
4032
  const [t, s] = H(null), [a] = H(Math.random());
3953
4033
  ee(() => {
@@ -4046,11 +4126,11 @@ function ja(i) {
4046
4126
  }
4047
4127
  export {
4048
4128
  ja as SearchstaxExternalPromotionsWidget,
4049
- Ia as SearchstaxFacetsWidget,
4129
+ Pa as SearchstaxFacetsWidget,
4050
4130
  La as SearchstaxInputWidget,
4051
4131
  Ea as SearchstaxOverviewWidget,
4052
4132
  Ra as SearchstaxPaginationWidget,
4053
- Pa as SearchstaxRelatedSearchesWidget,
4133
+ Ia as SearchstaxRelatedSearchesWidget,
4054
4134
  ka as SearchstaxResultWidget,
4055
4135
  wa as SearchstaxSortingWidget,
4056
4136
  Ta as SearchstaxWrapper