@searchcraft/react-sdk 0.9.6 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4581 @@
1
+ var Ba = Object.defineProperty;
2
+ var Wa = (e, t, r) => t in e ? Ba(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var h = (e, t, r) => Wa(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { jsx as me } from "react/jsx-runtime";
5
+ import { renderToString as Ga } from "@searchcraft/javascript-sdk/hydrate";
6
+ const Va = "searchcraft-javascript-sdk", Le = (
7
+ /* searchcraft-javascript-sdk */
8
+ { allRenderFn: !0, appendChildSlotFix: !1, asyncLoading: !0, asyncQueue: !1, attachStyles: !0, cloneNodeFix: !1, cmpDidLoad: !0, cmpDidRender: !1, cmpDidUnload: !1, cmpDidUpdate: !1, cmpShouldUpdate: !1, cmpWillLoad: !1, cmpWillRender: !1, cmpWillUpdate: !1, connectedCallback: !0, constructableCSS: !0, cssAnnotations: !0, devTools: !1, disconnectedCallback: !0, element: !1, event: !0, experimentalScopedSlotChanges: !1, experimentalSlotFixes: !1, formAssociated: !1, hasRenderFn: !0, hostListener: !1, hostListenerTarget: !1, hostListenerTargetBody: !1, hostListenerTargetDocument: !1, hostListenerTargetParent: !1, hostListenerTargetWindow: !1, hotModuleReplacement: !1, hydrateClientSide: !1, hydrateServerSide: !1, hydratedAttribute: !1, hydratedClass: !0, hydratedSelectorName: "hydrated", invisiblePrehydration: !0, isDebug: !1, isDev: !1, isTesting: !1, lazyLoad: !1, lifecycle: !0, lifecycleDOMEvents: !1, member: !0, method: !1, mode: !1, modernPropertyDecls: !0, observeAttribute: !0, profile: !1, prop: !0, propBoolean: !0, propMutable: !1, propNumber: !0, propString: !0, reflect: !1, scoped: !1, scopedSlotTextContentFix: !1, scriptDataOpts: !1, shadowDelegatesFocus: !1, shadowDom: !1, slot: !0, slotChildNodesFix: !1, slotRelocation: !0, state: !0, style: !1, svg: !0, taskQueue: !0, updatable: !0, vdomAttribute: !0, vdomClass: !0, vdomFunctional: !0, vdomKey: !0, vdomListener: !0, vdomPropOrAttr: !0, vdomRef: !1, vdomRender: !0, vdomStyle: !0, vdomText: !0, vdomXlink: !1, watchCallback: !0 }
9
+ );
10
+ var qa = Object.defineProperty, Ya = (e, t) => {
11
+ for (var r in t)
12
+ qa(e, r, { get: t[r], enumerable: !0 });
13
+ }, Qa = "http://www.w3.org/2000/svg", Ka = "http://www.w3.org/1999/xhtml", Xa = (e, t) => {
14
+ var r;
15
+ const s = t.$cmpMeta$;
16
+ Object.entries((r = s.$members$) != null ? r : {}).map(([o, [n]]) => {
17
+ if (n & 31 || n & 32) {
18
+ const c = e[o], f = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), o);
19
+ Object.defineProperty(e, o, {
20
+ get() {
21
+ return f.get.call(this);
22
+ },
23
+ set(u) {
24
+ f.set.call(this, u);
25
+ },
26
+ configurable: !0,
27
+ enumerable: !0
28
+ }), e[o] = t.$instanceValues$.has(o) ? t.$instanceValues$.get(o) : c;
29
+ }
30
+ });
31
+ }, Qt = /* @__PURE__ */ new WeakMap(), Za = (e) => Qt.delete(e), ye = (e) => Qt.get(e), Ja = (e, t) => {
32
+ const r = {
33
+ $flags$: 0,
34
+ $hostElement$: e,
35
+ $cmpMeta$: t,
36
+ $instanceValues$: /* @__PURE__ */ new Map()
37
+ };
38
+ r.$onReadyPromise$ = new Promise((a) => r.$onReadyResolve$ = a), e["s-p"] = [], e["s-rc"] = [];
39
+ const s = Qt.set(e, r);
40
+ return Xa(e, r), s;
41
+ }, Yr = (e, t) => t in e, bt = (e, t) => (0, console.error)(e, t), yt = typeof window < "u" ? window : {}, Me = yt.document || { head: {} }, O = yt.HTMLElement || class {
42
+ }, J = {
43
+ $flags$: 0,
44
+ $resourcesUrl$: "",
45
+ jmp: (e) => e(),
46
+ raf: (e) => requestAnimationFrame(e),
47
+ ael: (e, t, r, s) => e.addEventListener(t, r, s),
48
+ rel: (e, t, r, s) => e.removeEventListener(t, r, s),
49
+ ce: (e, t) => new CustomEvent(e, t)
50
+ }, en = Le.shadowDom, tn = (e) => Promise.resolve(e), Gt = !1, Qr = [], vs = [], rn = (e, t) => (r) => {
51
+ e.push(r), Gt || (Gt = !0, J.$flags$ & 4 ? Kt(Vt) : J.raf(Vt));
52
+ }, Kr = (e) => {
53
+ for (let t = 0; t < e.length; t++)
54
+ try {
55
+ e[t](performance.now());
56
+ } catch (r) {
57
+ bt(r);
58
+ }
59
+ e.length = 0;
60
+ }, Vt = () => {
61
+ Kr(Qr), Kr(vs), (Gt = Qr.length > 0) && J.raf(Vt);
62
+ }, Kt = (e) => tn().then(e), sn = /* @__PURE__ */ rn(vs), Xt = (e) => (e = typeof e, e === "object" || e === "function"), an = {};
63
+ Ya(an, {
64
+ err: () => bs,
65
+ map: () => nn,
66
+ ok: () => qt,
67
+ unwrap: () => on,
68
+ unwrapErr: () => cn
69
+ });
70
+ var qt = (e) => ({
71
+ isOk: !0,
72
+ isErr: !1,
73
+ value: e
74
+ }), bs = (e) => ({
75
+ isOk: !1,
76
+ isErr: !0,
77
+ value: e
78
+ });
79
+ function nn(e, t) {
80
+ if (e.isOk) {
81
+ const r = t(e.value);
82
+ return r instanceof Promise ? r.then((s) => qt(s)) : qt(r);
83
+ }
84
+ if (e.isErr) {
85
+ const r = e.value;
86
+ return bs(r);
87
+ }
88
+ throw "should never get here";
89
+ }
90
+ var on = (e) => {
91
+ if (e.isOk)
92
+ return e.value;
93
+ throw e.value;
94
+ }, cn = (e) => {
95
+ if (e.isErr)
96
+ return e.value;
97
+ throw e.value;
98
+ }, ys = (e) => {
99
+ const t = e.__childNodes || e.childNodes;
100
+ e.tagName && e.tagName.includes("-") && e["s-cr"] && e.tagName !== "SLOT-FB" && Ss(t, e.tagName).forEach((r) => {
101
+ var s;
102
+ r.nodeType === 1 && r.tagName === "SLOT-FB" && ((s = ln(r, r["s-sn"], !1)) != null && s.length ? r.hidden = !0 : r.hidden = !1);
103
+ });
104
+ for (const r of t)
105
+ r.nodeType === 1 && (r.__childNodes || r.childNodes).length && ys(r);
106
+ };
107
+ function Ss(e, t, r) {
108
+ let s = 0, a = [], o;
109
+ for (; s < e.length; s++)
110
+ o = e[s], o["s-sr"] && o["s-hn"] === t && r === void 0 && a.push(o), a = [...a, ...Ss(o.childNodes, t, r)];
111
+ return a;
112
+ }
113
+ var ln = (e, t, r = !0) => {
114
+ const s = [];
115
+ for ((r && e["s-sr"] || !e["s-sr"]) && s.push(e); (e = e.nextSibling) && e["s-sn"] === t; )
116
+ s.push(e);
117
+ return s;
118
+ }, Xr = (e, t) => e.nodeType === 1 ? e.getAttribute("slot") === null && t === "" || e.getAttribute("slot") === t : e["s-sn"] === t ? !0 : t === "", Qe = (e, t = "") => () => {
119
+ }, d = (e, t, ...r) => {
120
+ let s = null, a = null, o = null, n = !1, c = !1;
121
+ const f = [], u = (p) => {
122
+ for (let m = 0; m < p.length; m++)
123
+ s = p[m], Array.isArray(s) ? u(s) : s != null && typeof s != "boolean" && ((n = typeof e != "function" && !Xt(s)) && (s = String(s)), n && c ? f[f.length - 1].$text$ += s : f.push(n ? ht(null, s) : s), c = n);
124
+ };
125
+ if (u(r), t) {
126
+ t.key && (a = t.key), t.name && (o = t.name);
127
+ {
128
+ const p = t.className || t.class;
129
+ p && (t.class = typeof p != "object" ? p : Object.keys(p).filter((m) => p[m]).join(" "));
130
+ }
131
+ }
132
+ if (typeof e == "function")
133
+ return e(
134
+ t === null ? {} : t,
135
+ f,
136
+ dn
137
+ );
138
+ const i = ht(e, null);
139
+ return i.$attrs$ = t, f.length > 0 && (i.$children$ = f), i.$key$ = a, i.$name$ = o, i;
140
+ }, ht = (e, t) => {
141
+ const r = {
142
+ $flags$: 0,
143
+ $tag$: e,
144
+ $text$: t,
145
+ $elm$: null,
146
+ $children$: null
147
+ };
148
+ return r.$attrs$ = null, r.$key$ = null, r.$name$ = null, r;
149
+ }, un = {}, fn = (e) => e && e.$tag$ === un, dn = {
150
+ forEach: (e, t) => e.map(Zr).forEach(t),
151
+ map: (e, t) => e.map(Zr).map(t).map(hn)
152
+ }, Zr = (e) => ({
153
+ vattrs: e.$attrs$,
154
+ vchildren: e.$children$,
155
+ vkey: e.$key$,
156
+ vname: e.$name$,
157
+ vtag: e.$tag$,
158
+ vtext: e.$text$
159
+ }), hn = (e) => {
160
+ if (typeof e.vtag == "function") {
161
+ const r = { ...e.vattrs };
162
+ return e.vkey && (r.key = e.vkey), e.vname && (r.name = e.vname), d(e.vtag, r, ...e.vchildren || []);
163
+ }
164
+ const t = ht(e.vtag, e.vtext);
165
+ return t.$attrs$ = e.vattrs, t.$children$ = e.vchildren, t.$key$ = e.vkey, t.$name$ = e.vname, t;
166
+ }, ws = (e, t) => e != null && !Xt(e) ? t & 4 ? e === "false" ? !1 : e === "" || !!e : t & 2 ? parseFloat(e) : t & 1 ? String(e) : e : e, pn = (e) => e, ve = (e, t, r) => {
167
+ const s = pn(e);
168
+ return {
169
+ emit: (a) => Es(s, t, {
170
+ bubbles: !0,
171
+ composed: !0,
172
+ cancelable: !0,
173
+ detail: a
174
+ })
175
+ };
176
+ }, Es = (e, t, r) => {
177
+ const s = J.ce(t, r);
178
+ return e.dispatchEvent(s), s;
179
+ }, lt = /* @__PURE__ */ new WeakMap(), Jr = (e, t, r, s, a, o) => {
180
+ if (r !== s) {
181
+ let n = Yr(e, t), c = t.toLowerCase();
182
+ if (t === "class") {
183
+ const f = e.classList, u = es(r);
184
+ let i = es(s);
185
+ e["s-si"] ? (i.push(e["s-si"]), u.forEach((p) => {
186
+ p.startsWith(e["s-si"]) && i.push(p);
187
+ }), i = [...new Set(i)], f.add(...i), delete e["s-si"]) : (f.remove(...u.filter((p) => p && !i.includes(p))), f.add(...i.filter((p) => p && !u.includes(p))));
188
+ } else if (t === "style") {
189
+ for (const f in r)
190
+ (!s || s[f] == null) && (f.includes("-") ? e.style.removeProperty(f) : e.style[f] = "");
191
+ for (const f in s)
192
+ (!r || s[f] !== r[f]) && (f.includes("-") ? e.style.setProperty(f, s[f]) : e.style[f] = s[f]);
193
+ } else if (t !== "key") if (!e.__lookupSetter__(t) && t[0] === "o" && t[1] === "n") {
194
+ if (t[2] === "-" ? t = t.slice(3) : Yr(yt, c) ? t = c.slice(2) : t = c[2] + t.slice(3), r || s) {
195
+ const f = t.endsWith(Rs);
196
+ t = t.replace(gn, ""), r && J.rel(e, t, r, f), s && J.ael(e, t, s, f);
197
+ }
198
+ } else {
199
+ const f = Xt(s);
200
+ if ((n || f && s !== null) && !a)
201
+ try {
202
+ if (e.tagName.includes("-"))
203
+ e[t] !== s && (e[t] = s);
204
+ else {
205
+ const u = s ?? "";
206
+ t === "list" ? n = !1 : (r == null || e[t] != u) && (typeof e.__lookupSetter__(t) == "function" ? e[t] = u : e.setAttribute(t, u));
207
+ }
208
+ } catch {
209
+ }
210
+ s == null || s === !1 ? (s !== !1 || e.getAttribute(t) === "") && e.removeAttribute(t) : (!n || o & 4 || a) && !f && (s = s === !0 ? "" : s, e.setAttribute(t, s));
211
+ }
212
+ }
213
+ }, mn = /\s/, es = (e) => (typeof e == "object" && "baseVal" in e && (e = e.baseVal), e ? e.split(mn) : []), Rs = "Capture", gn = new RegExp(Rs + "$"), Ts = (e, t, r) => {
214
+ const s = t.$elm$.nodeType === 11 && t.$elm$.host ? t.$elm$.host : t.$elm$, a = e && e.$attrs$ || {}, o = t.$attrs$ || {};
215
+ for (const n of ts(Object.keys(a)))
216
+ n in o || Jr(s, n, a[n], void 0, r, t.$flags$);
217
+ for (const n of ts(Object.keys(o)))
218
+ Jr(s, n, a[n], o[n], r, t.$flags$);
219
+ };
220
+ function ts(e) {
221
+ return e.includes("ref") ? (
222
+ // we need to sort these to ensure that `'ref'` is the last attr
223
+ [...e.filter((t) => t !== "ref"), "ref"]
224
+ ) : (
225
+ // no need to sort, return the original array
226
+ e
227
+ );
228
+ }
229
+ var Yt, Zt, pt = !1, mt = !1, Jt = !1, te = !1, gt = (e, t, r) => {
230
+ var s;
231
+ const a = t.$children$[r];
232
+ let o = 0, n, c, f;
233
+ if (pt || (Jt = !0, a.$tag$ === "slot" && (a.$flags$ |= a.$children$ ? (
234
+ // slot element has fallback content
235
+ // still create an element that "mocks" the slot element
236
+ 2
237
+ ) : (
238
+ // slot element does not have fallback content
239
+ // create an html comment we'll use to always reference
240
+ // where actual slot content should sit next to
241
+ 1
242
+ ))), a.$text$ !== null)
243
+ n = a.$elm$ = Me.createTextNode(a.$text$);
244
+ else if (a.$flags$ & 1)
245
+ n = a.$elm$ = Me.createTextNode("");
246
+ else {
247
+ if (te || (te = a.$tag$ === "svg"), n = a.$elm$ = Me.createElementNS(
248
+ te ? Qa : Ka,
249
+ !pt && Le.slotRelocation && a.$flags$ & 2 ? "slot-fb" : a.$tag$
250
+ ), te && a.$tag$ === "foreignObject" && (te = !1), Ts(null, a, te), a.$children$)
251
+ for (o = 0; o < a.$children$.length; ++o)
252
+ c = gt(e, a, o), c && n.appendChild(c);
253
+ a.$tag$ === "svg" ? te = !1 : n.tagName === "foreignObject" && (te = !0);
254
+ }
255
+ return n["s-hn"] = Zt, a.$flags$ & 3 && (n["s-sr"] = !0, n["s-cr"] = Yt, n["s-sn"] = a.$name$ || "", n["s-rf"] = (s = a.$attrs$) == null ? void 0 : s.ref, f = e && e.$children$ && e.$children$[r], f && f.$tag$ === a.$tag$ && e.$elm$ && Ke(e.$elm$, !1)), n;
256
+ }, Ke = (e, t) => {
257
+ J.$flags$ |= 1;
258
+ const r = Array.from(e.__childNodes || e.childNodes);
259
+ e["s-sr"] && Le.experimentalSlotFixes;
260
+ for (let s = r.length - 1; s >= 0; s--) {
261
+ const a = r[s];
262
+ a["s-hn"] !== Zt && a["s-ol"] && (be(Xe(a).parentNode, a, Xe(a)), a["s-ol"].remove(), a["s-ol"] = void 0, a["s-sh"] = void 0, Jt = !0), t && Ke(a, t);
263
+ }
264
+ J.$flags$ &= -2;
265
+ }, ks = (e, t, r, s, a, o) => {
266
+ let n = e["s-cr"] && e["s-cr"].parentNode || e, c;
267
+ for (; a <= o; ++a)
268
+ s[a] && (c = gt(null, r, a), c && (s[a].$elm$ = c, be(n, c, Xe(t))));
269
+ }, Cs = (e, t, r) => {
270
+ for (let s = t; s <= r; ++s) {
271
+ const a = e[s];
272
+ if (a) {
273
+ const o = a.$elm$;
274
+ o && (mt = !0, o["s-ol"] ? o["s-ol"].remove() : Ke(o, !0), o.remove());
275
+ }
276
+ }
277
+ }, vn = (e, t, r, s, a = !1) => {
278
+ let o = 0, n = 0, c = 0, f = 0, u = t.length - 1, i = t[0], p = t[u], m = s.length - 1, y = s[0], v = s[m], x, U;
279
+ for (; o <= u && n <= m; )
280
+ if (i == null)
281
+ i = t[++o];
282
+ else if (p == null)
283
+ p = t[--u];
284
+ else if (y == null)
285
+ y = s[++n];
286
+ else if (v == null)
287
+ v = s[--m];
288
+ else if (ut(i, y, a))
289
+ Ae(i, y, a), i = t[++o], y = s[++n];
290
+ else if (ut(p, v, a))
291
+ Ae(p, v, a), p = t[--u], v = s[--m];
292
+ else if (ut(i, v, a))
293
+ (i.$tag$ === "slot" || v.$tag$ === "slot") && Ke(i.$elm$.parentNode, !1), Ae(i, v, a), be(e, i.$elm$, p.$elm$.nextSibling), i = t[++o], v = s[--m];
294
+ else if (ut(p, y, a))
295
+ (i.$tag$ === "slot" || v.$tag$ === "slot") && Ke(p.$elm$.parentNode, !1), Ae(p, y, a), be(e, p.$elm$, i.$elm$), p = t[--u], y = s[++n];
296
+ else {
297
+ for (c = -1, f = o; f <= u; ++f)
298
+ if (t[f] && t[f].$key$ !== null && t[f].$key$ === y.$key$) {
299
+ c = f;
300
+ break;
301
+ }
302
+ c >= 0 ? (U = t[c], U.$tag$ !== y.$tag$ ? x = gt(t && t[n], r, c) : (Ae(U, y, a), t[c] = void 0, x = U.$elm$), y = s[++n]) : (x = gt(t && t[n], r, n), y = s[++n]), x && be(
303
+ Xe(i.$elm$).parentNode,
304
+ x,
305
+ Xe(i.$elm$)
306
+ );
307
+ }
308
+ o > u ? ks(
309
+ e,
310
+ s[m + 1] == null ? null : s[m + 1].$elm$,
311
+ r,
312
+ s,
313
+ n,
314
+ m
315
+ ) : n > m && Cs(t, o, u);
316
+ }, ut = (e, t, r = !1) => e.$tag$ === t.$tag$ ? e.$tag$ === "slot" ? e.$name$ === t.$name$ : r ? (r && !e.$key$ && t.$key$ && (e.$key$ = t.$key$), !0) : e.$key$ === t.$key$ : !1, Xe = (e) => e && e["s-ol"] || e, Ae = (e, t, r = !1) => {
317
+ const s = t.$elm$ = e.$elm$, a = e.$children$, o = t.$children$, n = t.$tag$, c = t.$text$;
318
+ let f;
319
+ c === null ? (te = n === "svg" ? !0 : n === "foreignObject" ? !1 : te, n === "slot" && !pt || Ts(e, t, te), a !== null && o !== null ? vn(s, a, t, o, r) : o !== null ? (e.$text$ !== null && (s.textContent = ""), ks(s, null, t, o, 0, o.length - 1)) : (
320
+ // don't do this on initial render as it can cause non-hydrated content to be removed
321
+ !r && Le.updatable && a !== null && Cs(a, 0, a.length - 1)
322
+ ), te && n === "svg" && (te = !1)) : (f = s["s-cr"]) ? f.parentNode.textContent = c : e.$text$ !== c && (s.data = c);
323
+ }, fe = [], Ps = (e) => {
324
+ let t, r, s;
325
+ const a = e.__childNodes || e.childNodes;
326
+ for (const o of a) {
327
+ if (o["s-sr"] && (t = o["s-cr"]) && t.parentNode) {
328
+ r = t.parentNode.__childNodes || t.parentNode.childNodes;
329
+ const n = o["s-sn"];
330
+ for (s = r.length - 1; s >= 0; s--)
331
+ if (t = r[s], !t["s-cn"] && !t["s-nr"] && t["s-hn"] !== o["s-hn"])
332
+ if (Xr(t, n)) {
333
+ let c = fe.find((f) => f.$nodeToRelocate$ === t);
334
+ mt = !0, t["s-sn"] = t["s-sn"] || n, c ? (c.$nodeToRelocate$["s-sh"] = o["s-hn"], c.$slotRefNode$ = o) : (t["s-sh"] = o["s-hn"], fe.push({
335
+ $slotRefNode$: o,
336
+ $nodeToRelocate$: t
337
+ })), t["s-sr"] && fe.map((f) => {
338
+ Xr(f.$nodeToRelocate$, t["s-sn"]) && (c = fe.find((u) => u.$nodeToRelocate$ === t), c && !f.$slotRefNode$ && (f.$slotRefNode$ = c.$slotRefNode$));
339
+ });
340
+ } else fe.some((c) => c.$nodeToRelocate$ === t) || fe.push({
341
+ $nodeToRelocate$: t
342
+ });
343
+ }
344
+ o.nodeType === 1 && Ps(o);
345
+ }
346
+ }, be = (e, t, r) => e == null ? void 0 : e.insertBefore(t, r), bn = (e, t, r = !1) => {
347
+ var s, a, o, n;
348
+ const c = e.$hostElement$, f = e.$vnode$ || ht(null, null), u = fn(t) ? t : d(null, null, t);
349
+ if (Zt = c.tagName, r && u.$attrs$)
350
+ for (const i of Object.keys(u.$attrs$))
351
+ c.hasAttribute(i) && !["key", "ref", "style", "class"].includes(i) && (u.$attrs$[i] = c[i]);
352
+ u.$tag$ = null, u.$flags$ |= 4, e.$vnode$ = u, u.$elm$ = f.$elm$ = c, pt = en, Yt = c["s-cr"], mt = !1, Ae(f, u, r);
353
+ {
354
+ if (J.$flags$ |= 1, Jt) {
355
+ Ps(u.$elm$);
356
+ for (const i of fe) {
357
+ const p = i.$nodeToRelocate$;
358
+ if (!p["s-ol"]) {
359
+ const m = Me.createTextNode("");
360
+ m["s-nr"] = p, be(p.parentNode, p["s-ol"] = m, p);
361
+ }
362
+ }
363
+ for (const i of fe) {
364
+ const p = i.$nodeToRelocate$, m = i.$slotRefNode$;
365
+ if (m) {
366
+ const y = m.parentNode;
367
+ let v = m.nextSibling;
368
+ {
369
+ let ee = (s = p["s-ol"]) == null ? void 0 : s.previousSibling;
370
+ for (; ee; ) {
371
+ let M = (a = ee["s-nr"]) != null ? a : null;
372
+ if (M && M["s-sn"] === p["s-sn"] && y === (M.__parentNode || M.parentNode)) {
373
+ for (M = M.nextSibling; M === p || M != null && M["s-sr"]; )
374
+ M = M == null ? void 0 : M.nextSibling;
375
+ if (!M || !M["s-nr"]) {
376
+ v = M;
377
+ break;
378
+ }
379
+ }
380
+ ee = ee.previousSibling;
381
+ }
382
+ }
383
+ const x = p.__parentNode || p.parentNode, U = p.__nextSibling || p.nextSibling;
384
+ (!v && y !== x || U !== v) && p !== v && (!p["s-hn"] && p["s-ol"] && (p["s-hn"] = p["s-ol"].parentNode.nodeName), be(y, p, v), p.nodeType === 1 && p.tagName !== "SLOT-FB" && (p.hidden = (o = p["s-ih"]) != null ? o : !1)), p && typeof m["s-rf"] == "function" && m["s-rf"](p);
385
+ } else
386
+ p.nodeType === 1 && (r && (p["s-ih"] = (n = p.hidden) != null ? n : !1), p.hidden = !0);
387
+ }
388
+ }
389
+ mt && ys(u.$elm$), J.$flags$ &= -2, fe.length = 0;
390
+ }
391
+ Yt = void 0;
392
+ }, xs = (e, t) => {
393
+ if (t && !e.$onRenderResolve$ && t["s-p"]) {
394
+ const r = t["s-p"].push(
395
+ new Promise(
396
+ (s) => e.$onRenderResolve$ = () => {
397
+ t["s-p"].splice(r - 1, 1), s();
398
+ }
399
+ )
400
+ );
401
+ }
402
+ }, er = (e, t) => {
403
+ if (e.$flags$ |= 16, e.$flags$ & 4) {
404
+ e.$flags$ |= 512;
405
+ return;
406
+ }
407
+ return xs(e, e.$ancestorComponent$), sn(() => yn(e, t));
408
+ }, yn = (e, t) => {
409
+ const r = e.$hostElement$, s = Qe("scheduleUpdate", e.$cmpMeta$.$tagName$), a = r;
410
+ if (!a)
411
+ throw new Error(
412
+ `Can't render component <${r.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
413
+ );
414
+ let o;
415
+ return s(), Sn(o, () => En(e, a, t));
416
+ }, Sn = (e, t) => wn(e) ? e.then(t).catch((r) => {
417
+ console.error(r), t();
418
+ }) : t(), wn = (e) => e instanceof Promise || e && e.then && typeof e.then == "function", En = async (e, t, r) => {
419
+ var s;
420
+ const a = e.$hostElement$, o = Qe("update", e.$cmpMeta$.$tagName$), n = a["s-rc"], c = Qe("render", e.$cmpMeta$.$tagName$);
421
+ Rn(e, t, a, r), n && (n.map((f) => f()), a["s-rc"] = void 0), c(), o();
422
+ {
423
+ const f = (s = a["s-p"]) != null ? s : [], u = () => Tn(e);
424
+ f.length === 0 ? u() : (Promise.all(f).then(u), e.$flags$ |= 4, f.length = 0);
425
+ }
426
+ }, Rn = (e, t, r, s) => {
427
+ try {
428
+ t = t.render(), e.$flags$ &= -17, e.$flags$ |= 2, bn(e, t, s);
429
+ } catch (a) {
430
+ bt(a, e.$hostElement$);
431
+ }
432
+ return null;
433
+ }, Tn = (e) => {
434
+ const t = e.$cmpMeta$.$tagName$, r = e.$hostElement$, s = Qe("postUpdate", t), a = r, o = e.$ancestorComponent$;
435
+ e.$flags$ & 64 ? s() : (e.$flags$ |= 64, $s(r), Cn(a, "componentDidLoad", void 0, r), s(), e.$onReadyResolve$(r), o || kn()), e.$onRenderResolve$ && (e.$onRenderResolve$(), e.$onRenderResolve$ = void 0), e.$flags$ & 512 && Kt(() => er(e, !1)), e.$flags$ &= -517;
436
+ }, kn = (e) => {
437
+ $s(Me.documentElement), Kt(() => Es(yt, "appload", { detail: { namespace: Va } }));
438
+ }, Cn = (e, t, r, s) => {
439
+ if (e && e[t])
440
+ try {
441
+ return e[t](r);
442
+ } catch (a) {
443
+ bt(a, s);
444
+ }
445
+ }, $s = (e) => {
446
+ var t;
447
+ return e.classList.add((t = Le.hydratedSelectorName) != null ? t : "hydrated");
448
+ }, Pn = (e, t) => ye(e).$instanceValues$.get(t), rs = (e, t, r, s) => {
449
+ const a = ye(e), o = e, n = a.$instanceValues$.get(t), c = a.$flags$, f = o;
450
+ r = ws(r, s.$members$[t][0]);
451
+ const u = Number.isNaN(n) && Number.isNaN(r);
452
+ if (r !== n && !u) {
453
+ a.$instanceValues$.set(t, r);
454
+ {
455
+ if (s.$watchers$ && c & 128) {
456
+ const p = s.$watchers$[t];
457
+ p && p.map((m) => {
458
+ try {
459
+ f[m](r, n, t);
460
+ } catch (y) {
461
+ bt(y, o);
462
+ }
463
+ });
464
+ }
465
+ (c & 18) === 2 && er(a, !1);
466
+ }
467
+ }
468
+ }, xn = (e, t, r) => {
469
+ var s, a;
470
+ const o = e.prototype;
471
+ if (t.$members$ || t.$watchers$ || e.watchers) {
472
+ e.watchers && !t.$watchers$ && (t.$watchers$ = e.watchers);
473
+ const n = Object.entries((s = t.$members$) != null ? s : {});
474
+ n.map(([c, [f]]) => {
475
+ if (f & 31 || f & 32) {
476
+ const { get: u, set: i } = Object.getOwnPropertyDescriptor(o, c) || {};
477
+ u && (t.$members$[c][0] |= 2048), i && (t.$members$[c][0] |= 4096), Object.defineProperty(o, c, {
478
+ get() {
479
+ return u ? u.apply(this) : Pn(this, c);
480
+ },
481
+ configurable: !0,
482
+ enumerable: !0
483
+ }), Object.defineProperty(o, c, {
484
+ set(p) {
485
+ const m = ye(this);
486
+ if (i) {
487
+ const y = f & 32 ? this[c] : m.$hostElement$[c];
488
+ typeof y > "u" && m.$instanceValues$.get(c) ? p = m.$instanceValues$.get(c) : !m.$instanceValues$.get(c) && y && m.$instanceValues$.set(c, y), i.apply(this, [ws(p, f)]), p = f & 32 ? this[c] : m.$hostElement$[c], rs(this, c, p, t);
489
+ return;
490
+ }
491
+ {
492
+ rs(this, c, p, t);
493
+ return;
494
+ }
495
+ }
496
+ });
497
+ }
498
+ });
499
+ {
500
+ const c = /* @__PURE__ */ new Map();
501
+ o.attributeChangedCallback = function(f, u, i) {
502
+ J.jmp(() => {
503
+ var p;
504
+ const m = c.get(f);
505
+ if (!(this.hasOwnProperty(m) && Le.lazyLoad)) {
506
+ if (o.hasOwnProperty(m) && typeof this[m] == "number" && // cast type to number to avoid TS compiler issues
507
+ this[m] == i)
508
+ return;
509
+ if (m == null) {
510
+ const v = ye(this), x = v == null ? void 0 : v.$flags$;
511
+ if (x && !(x & 8) && x & 128 && i !== u) {
512
+ const ee = this, M = (p = t.$watchers$) == null ? void 0 : p[f];
513
+ M == null || M.forEach((Fe) => {
514
+ ee[Fe] != null && ee[Fe].call(ee, i, u, f);
515
+ });
516
+ }
517
+ return;
518
+ }
519
+ }
520
+ const y = Object.getOwnPropertyDescriptor(o, m);
521
+ i = i === null && typeof this[m] == "boolean" ? !1 : i, i !== this[m] && (!y.get || y.set) && (this[m] = i);
522
+ });
523
+ }, e.observedAttributes = Array.from(
524
+ /* @__PURE__ */ new Set([
525
+ ...Object.keys((a = t.$watchers$) != null ? a : {}),
526
+ ...n.filter(
527
+ ([f, u]) => u[0] & 15
528
+ /* HasAttribute */
529
+ ).map(([f, u]) => {
530
+ const i = u[1] || f;
531
+ return c.set(i, f), i;
532
+ })
533
+ ])
534
+ );
535
+ }
536
+ }
537
+ return e;
538
+ }, $n = async (e, t, r, s) => {
539
+ if (!(t.$flags$ & 32)) {
540
+ t.$flags$ |= 32;
541
+ {
542
+ const n = e.localName;
543
+ customElements.whenDefined(n).then(
544
+ () => t.$flags$ |= 128
545
+ /* isWatchReady */
546
+ );
547
+ }
548
+ }
549
+ const a = t.$ancestorComponent$, o = () => er(t, !0);
550
+ a && a["s-rc"] ? a["s-rc"].push(o) : o();
551
+ }, _n = (e, t) => {
552
+ }, An = (e) => {
553
+ if (!(J.$flags$ & 1)) {
554
+ const t = ye(e), r = t.$cmpMeta$, s = Qe("connectedCallback", r.$tagName$);
555
+ if (t.$flags$ & 1)
556
+ t != null && t.$lazyInstance$ || t != null && t.$onReadyPromise$ && t.$onReadyPromise$.then(() => _n());
557
+ else {
558
+ t.$flags$ |= 1, // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
559
+ r.$flags$ & 12 && In(e);
560
+ {
561
+ let a = e;
562
+ for (; a = a.parentNode || a.host; )
563
+ if (a["s-p"]) {
564
+ xs(t, t.$ancestorComponent$ = a);
565
+ break;
566
+ }
567
+ }
568
+ r.$members$ && Object.entries(r.$members$).map(([a, [o]]) => {
569
+ if (o & 31 && e.hasOwnProperty(a)) {
570
+ const n = e[a];
571
+ delete e[a], e[a] = n;
572
+ }
573
+ }), $n(e, t);
574
+ }
575
+ s();
576
+ }
577
+ }, In = (e) => {
578
+ const t = e["s-cr"] = Me.createComment(
579
+ ""
580
+ );
581
+ t["s-cn"] = !0, be(e, t, e.firstChild);
582
+ }, Mn = async (e) => {
583
+ J.$flags$ & 1 || ye(e), lt.has(e) && lt.delete(e), e.shadowRoot && lt.has(e.shadowRoot) && lt.delete(e.shadowRoot);
584
+ }, F = (e, t) => {
585
+ const r = {
586
+ $flags$: t[0],
587
+ $tagName$: t[1]
588
+ };
589
+ r.$members$ = t[2], r.$watchers$ = e.$watchers$;
590
+ const s = e.prototype.connectedCallback, a = e.prototype.disconnectedCallback;
591
+ return Object.assign(e.prototype, {
592
+ __hasHostListenerAttached: !1,
593
+ __registerHost() {
594
+ Ja(this, r);
595
+ },
596
+ connectedCallback() {
597
+ this.__hasHostListenerAttached || (ye(this), this.__hasHostListenerAttached = !0), An(this), s && s.call(this);
598
+ },
599
+ disconnectedCallback() {
600
+ Mn(this), a && a.call(this), J.raf(() => {
601
+ var o;
602
+ const n = ye(this);
603
+ ((o = n == null ? void 0 : n.$vnode$) == null ? void 0 : o.$elm$) instanceof Node && !n.$vnode$.$elm$.isConnected && delete n.$vnode$, this instanceof Node && !this.isConnected && Za(this);
604
+ });
605
+ },
606
+ __attachShadow() {
607
+ this.shadowRoot = this;
608
+ }
609
+ }), e.is = r.$tagName$, xn(e, r);
610
+ }, _s = (e, t) => t, Ln = Object.defineProperty, On = (e, t, r) => t in e ? Ln(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, A = (e, t, r) => On(e, typeof t != "symbol" ? t + "" : t, r), Re = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e))(Re || {});
611
+ class Fn {
612
+ constructor(t) {
613
+ A(this, "logLevel"), A(this, "logFormatter"), this.logLevel = t.logLevel || 1, this.logFormatter = t.logFormatter || this.defaultFormatter;
614
+ }
615
+ defaultFormatter(t, r) {
616
+ return `[${Re[t]}] ${(/* @__PURE__ */ new Date()).toISOString()}: ${r}`;
617
+ }
618
+ debug(t) {
619
+ this.logLevel <= 0 && console.log(this.logFormatter(0, t));
620
+ }
621
+ info(t) {
622
+ this.logLevel <= 1 && console.info(this.logFormatter(1, t));
623
+ }
624
+ warn(t) {
625
+ this.logLevel <= 2 && console.warn(this.logFormatter(2, t));
626
+ }
627
+ error(t) {
628
+ this.logLevel <= 3 && console.error(this.logFormatter(3, t));
629
+ }
630
+ log(t, r) {
631
+ switch (t) {
632
+ case 0:
633
+ this.debug(r);
634
+ break;
635
+ case 1:
636
+ this.info(r);
637
+ break;
638
+ case 2:
639
+ this.warn(r);
640
+ break;
641
+ case 3:
642
+ this.error(r);
643
+ break;
644
+ }
645
+ }
646
+ }
647
+ function de(e, t, r, s) {
648
+ return new (r || (r = Promise))(function(a, o) {
649
+ function n(u) {
650
+ try {
651
+ f(s.next(u));
652
+ } catch (i) {
653
+ o(i);
654
+ }
655
+ }
656
+ function c(u) {
657
+ try {
658
+ f(s.throw(u));
659
+ } catch (i) {
660
+ o(i);
661
+ }
662
+ }
663
+ function f(u) {
664
+ var i;
665
+ u.done ? a(u.value) : (i = u.value, i instanceof r ? i : new r(function(p) {
666
+ p(i);
667
+ })).then(n, c);
668
+ }
669
+ f((s = s.apply(e, [])).next());
670
+ });
671
+ }
672
+ function he(e, t) {
673
+ var r, s, a, o, n = { label: 0, sent: function() {
674
+ if (1 & a[0]) throw a[1];
675
+ return a[1];
676
+ }, trys: [], ops: [] };
677
+ return o = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() {
678
+ return this;
679
+ }), o;
680
+ function c(f) {
681
+ return function(u) {
682
+ return function(i) {
683
+ if (r) throw new TypeError("Generator is already executing.");
684
+ for (; o && (o = 0, i[0] && (n = 0)), n; ) try {
685
+ if (r = 1, s && (a = 2 & i[0] ? s.return : i[0] ? s.throw || ((a = s.return) && a.call(s), 0) : s.next) && !(a = a.call(s, i[1])).done) return a;
686
+ switch (s = 0, a && (i = [2 & i[0], a.value]), i[0]) {
687
+ case 0:
688
+ case 1:
689
+ a = i;
690
+ break;
691
+ case 4:
692
+ return n.label++, { value: i[1], done: !1 };
693
+ case 5:
694
+ n.label++, s = i[1], i = [0];
695
+ continue;
696
+ case 7:
697
+ i = n.ops.pop(), n.trys.pop();
698
+ continue;
699
+ default:
700
+ if (a = n.trys, !((a = a.length > 0 && a[a.length - 1]) || i[0] !== 6 && i[0] !== 2)) {
701
+ n = 0;
702
+ continue;
703
+ }
704
+ if (i[0] === 3 && (!a || i[1] > a[0] && i[1] < a[3])) {
705
+ n.label = i[1];
706
+ break;
707
+ }
708
+ if (i[0] === 6 && n.label < a[1]) {
709
+ n.label = a[1], a = i;
710
+ break;
711
+ }
712
+ if (a && n.label < a[2]) {
713
+ n.label = a[2], n.ops.push(i);
714
+ break;
715
+ }
716
+ a[2] && n.ops.pop(), n.trys.pop();
717
+ continue;
718
+ }
719
+ i = t.call(e, n);
720
+ } catch (p) {
721
+ i = [6, p], s = 0;
722
+ } finally {
723
+ r = a = 0;
724
+ }
725
+ if (5 & i[0]) throw i[1];
726
+ return { value: i[0] ? i[1] : void 0, done: !0 };
727
+ }([f, u]);
728
+ };
729
+ }
730
+ }
731
+ var pe = { exclude: [] }, As = {}, Dn = { timeout: "true" }, ae = function(e, t) {
732
+ typeof window < "u" && (As[e] = t);
733
+ }, Nn = function() {
734
+ return Object.fromEntries(Object.entries(As).filter(function(e) {
735
+ var t, r = e[0];
736
+ return !(!((t = pe == null ? void 0 : pe.exclude) === null || t === void 0) && t.includes(r));
737
+ }).map(function(e) {
738
+ return [e[0], (0, e[1])()];
739
+ }));
740
+ };
741
+ function ft(e) {
742
+ return e ^= e >>> 16, e = Math.imul(e, 2246822507), e ^= e >>> 13, e = Math.imul(e, 3266489909), (e ^= e >>> 16) >>> 0;
743
+ }
744
+ var W = new Uint32Array([597399067, 2869860233, 951274213, 2716044179]);
745
+ function re(e, t) {
746
+ return e << t | e >>> 32 - t;
747
+ }
748
+ function tr(e, t) {
749
+ var r;
750
+ if (t === void 0 && (t = 0), t = t ? 0 | t : 0, typeof e == "string" && (r = e, e = new TextEncoder().encode(r).buffer), !(e instanceof ArrayBuffer)) throw new TypeError("Expected key to be ArrayBuffer or string");
751
+ var s = new Uint32Array([t, t, t, t]);
752
+ (function(o, n) {
753
+ for (var c = o.byteLength / 16 | 0, f = new Uint32Array(o, 0, 4 * c), u = 0; u < c; u++) {
754
+ var i = f.subarray(4 * u, 4 * (u + 1));
755
+ i[0] = Math.imul(i[0], W[0]), i[0] = re(i[0], 15), i[0] = Math.imul(i[0], W[1]), n[0] = n[0] ^ i[0], n[0] = re(n[0], 19), n[0] = n[0] + n[1], n[0] = Math.imul(n[0], 5) + 1444728091, i[1] = Math.imul(i[1], W[1]), i[1] = re(i[1], 16), i[1] = Math.imul(i[1], W[2]), n[1] = n[1] ^ i[1], n[1] = re(n[1], 17), n[1] = n[1] + n[2], n[1] = Math.imul(n[1], 5) + 197830471, i[2] = Math.imul(i[2], W[2]), i[2] = re(i[2], 17), i[2] = Math.imul(i[2], W[3]), n[2] = n[2] ^ i[2], n[2] = re(n[2], 15), n[2] = n[2] + n[3], n[2] = Math.imul(n[2], 5) + 2530024501, i[3] = Math.imul(i[3], W[3]), i[3] = re(i[3], 18), i[3] = Math.imul(i[3], W[0]), n[3] = n[3] ^ i[3], n[3] = re(n[3], 13), n[3] = n[3] + n[0], n[3] = Math.imul(n[3], 5) + 850148119;
756
+ }
757
+ })(e, s), function(o, n) {
758
+ var c = o.byteLength / 16 | 0, f = o.byteLength % 16, u = new Uint32Array(4), i = new Uint8Array(o, 16 * c, f);
759
+ switch (f) {
760
+ case 15:
761
+ u[3] = u[3] ^ i[14] << 16;
762
+ case 14:
763
+ u[3] = u[3] ^ i[13] << 8;
764
+ case 13:
765
+ u[3] = u[3] ^ i[12] << 0, u[3] = Math.imul(u[3], W[3]), u[3] = re(u[3], 18), u[3] = Math.imul(u[3], W[0]), n[3] = n[3] ^ u[3];
766
+ case 12:
767
+ u[2] = u[2] ^ i[11] << 24;
768
+ case 11:
769
+ u[2] = u[2] ^ i[10] << 16;
770
+ case 10:
771
+ u[2] = u[2] ^ i[9] << 8;
772
+ case 9:
773
+ u[2] = u[2] ^ i[8] << 0, u[2] = Math.imul(u[2], W[2]), u[2] = re(u[2], 17), u[2] = Math.imul(u[2], W[3]), n[2] = n[2] ^ u[2];
774
+ case 8:
775
+ u[1] = u[1] ^ i[7] << 24;
776
+ case 7:
777
+ u[1] = u[1] ^ i[6] << 16;
778
+ case 6:
779
+ u[1] = u[1] ^ i[5] << 8;
780
+ case 5:
781
+ u[1] = u[1] ^ i[4] << 0, u[1] = Math.imul(u[1], W[1]), u[1] = re(u[1], 16), u[1] = Math.imul(u[1], W[2]), n[1] = n[1] ^ u[1];
782
+ case 4:
783
+ u[0] = u[0] ^ i[3] << 24;
784
+ case 3:
785
+ u[0] = u[0] ^ i[2] << 16;
786
+ case 2:
787
+ u[0] = u[0] ^ i[1] << 8;
788
+ case 1:
789
+ u[0] = u[0] ^ i[0] << 0, u[0] = Math.imul(u[0], W[0]), u[0] = re(u[0], 15), u[0] = Math.imul(u[0], W[1]), n[0] = n[0] ^ u[0];
790
+ }
791
+ }(e, s), function(o, n) {
792
+ n[0] = n[0] ^ o.byteLength, n[1] = n[1] ^ o.byteLength, n[2] = n[2] ^ o.byteLength, n[3] = n[3] ^ o.byteLength, n[0] = n[0] + n[1] | 0, n[0] = n[0] + n[2] | 0, n[0] = n[0] + n[3] | 0, n[1] = n[1] + n[0] | 0, n[2] = n[2] + n[0] | 0, n[3] = n[3] + n[0] | 0, n[0] = ft(n[0]), n[1] = ft(n[1]), n[2] = ft(n[2]), n[3] = ft(n[3]), n[0] = n[0] + n[1] | 0, n[0] = n[0] + n[2] | 0, n[0] = n[0] + n[3] | 0, n[1] = n[1] + n[0] | 0, n[2] = n[2] + n[0] | 0, n[3] = n[3] + n[0] | 0;
793
+ }(e, s);
794
+ var a = new Uint8Array(s.buffer);
795
+ return Array.from(a).map(function(o) {
796
+ return o.toString(16).padStart(2, "0");
797
+ }).join("");
798
+ }
799
+ function Un(e, t) {
800
+ return new Promise(function(r) {
801
+ setTimeout(function() {
802
+ return r(t);
803
+ }, e);
804
+ });
805
+ }
806
+ function zn(e, t, r) {
807
+ return Promise.all(e.map(function(s) {
808
+ return Promise.race([s, Un(t, r)]);
809
+ }));
810
+ }
811
+ function Hn() {
812
+ return de(this, void 0, void 0, function() {
813
+ var e, t, r, s, a;
814
+ return he(this, function(o) {
815
+ switch (o.label) {
816
+ case 0:
817
+ return o.trys.push([0, 2, , 3]), e = Nn(), t = Object.keys(e), [4, zn(Object.values(e), (pe == null ? void 0 : pe.timeout) || 1e3, Dn)];
818
+ case 1:
819
+ return r = o.sent(), s = r.filter(function(n) {
820
+ return n !== void 0;
821
+ }), a = {}, s.forEach(function(n, c) {
822
+ a[t[c]] = n;
823
+ }), [2, Is(a, pe.exclude || [])];
824
+ case 2:
825
+ throw o.sent();
826
+ case 3:
827
+ return [2];
828
+ }
829
+ });
830
+ });
831
+ }
832
+ function Is(e, t) {
833
+ var r = {}, s = function(o) {
834
+ if (e.hasOwnProperty(o)) {
835
+ var n = e[o];
836
+ if (typeof n != "object" || Array.isArray(n)) t.includes(o) || (r[o] = n);
837
+ else {
838
+ var c = Is(n, t.map(function(f) {
839
+ return f.startsWith(o + ".") ? f.slice(o.length + 1) : f;
840
+ }));
841
+ Object.keys(c).length > 0 && (r[o] = c);
842
+ }
843
+ }
844
+ };
845
+ for (var a in e) s(a);
846
+ return r;
847
+ }
848
+ function jn(e) {
849
+ return de(this, void 0, void 0, function() {
850
+ var t, r;
851
+ return he(this, function(s) {
852
+ switch (s.label) {
853
+ case 0:
854
+ return s.trys.push([0, 2, , 3]), [4, Hn()];
855
+ case 1:
856
+ return t = s.sent(), r = tr(JSON.stringify(t)), [2, r.toString()];
857
+ case 2:
858
+ throw s.sent();
859
+ case 3:
860
+ return [2];
861
+ }
862
+ });
863
+ });
864
+ }
865
+ function Bn(e) {
866
+ for (var t = 0, r = 0; r < e.length; ++r) t += Math.abs(e[r]);
867
+ return t;
868
+ }
869
+ function Ms(e, t, r) {
870
+ for (var s = [], a = 0; a < e[0].data.length; a++) {
871
+ for (var o = [], n = 0; n < e.length; n++) o.push(e[n].data[a]);
872
+ s.push(Wn(o));
873
+ }
874
+ var c = new Uint8ClampedArray(s);
875
+ return new ImageData(c, t, r);
876
+ }
877
+ function Wn(e) {
878
+ if (e.length === 0) return 0;
879
+ for (var t = {}, r = 0, s = e; r < s.length; r++)
880
+ t[o = s[r]] = (t[o] || 0) + 1;
881
+ var a = e[0];
882
+ for (var o in t) t[o] > t[a] && (a = parseInt(o, 10));
883
+ return a;
884
+ }
885
+ function Ze() {
886
+ if (typeof navigator > "u") return { name: "unknown", version: "unknown" };
887
+ for (var e = navigator.userAgent, t = { Edg: "Edge", OPR: "Opera" }, r = 0, s = [/(?<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 < s.length; r++) {
888
+ var a = s[r], o = e.match(a);
889
+ if (o && o.groups) return { name: t[o.groups.name] || o.groups.name, version: o.groups.version };
890
+ }
891
+ return { name: "unknown", version: "unknown" };
892
+ }
893
+ ae("audio", function() {
894
+ return de(this, void 0, void 0, function() {
895
+ return he(this, function(e) {
896
+ return [2, new Promise(function(t, r) {
897
+ try {
898
+ var s = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(1, 5e3, 44100), a = s.createBufferSource(), o = s.createOscillator();
899
+ o.frequency.value = 1e3;
900
+ var n, c = s.createDynamicsCompressor();
901
+ c.threshold.value = -50, c.knee.value = 40, c.ratio.value = 12, c.attack.value = 0, c.release.value = 0.2, o.connect(c), c.connect(s.destination), o.start(), s.oncomplete = function(f) {
902
+ n = f.renderedBuffer.getChannelData(0), t({ sampleHash: Bn(n), oscillator: o.type, maxChannels: s.destination.maxChannelCount, channelCountMode: a.channelCountMode });
903
+ }, s.startRendering();
904
+ } catch (f) {
905
+ console.error("Error creating audio fingerprint:", f), r(f);
906
+ }
907
+ })];
908
+ });
909
+ });
910
+ });
911
+ var Gn = Ze().name !== "SamsungBrowser" ? 1 : 3, ss = 280, as = 20;
912
+ Ze().name != "Firefox" && ae("canvas", function() {
913
+ return document.createElement("canvas").getContext("2d"), new Promise(function(e) {
914
+ var t = Array.from({ length: Gn }, function() {
915
+ return function() {
916
+ var r = document.createElement("canvas"), s = r.getContext("2d");
917
+ if (!s) return new ImageData(1, 1);
918
+ r.width = ss, r.height = as;
919
+ var a = s.createLinearGradient(0, 0, r.width, r.height);
920
+ a.addColorStop(0, "red"), a.addColorStop(0.16666666666666666, "orange"), a.addColorStop(0.3333333333333333, "yellow"), a.addColorStop(0.5, "green"), a.addColorStop(0.6666666666666666, "blue"), a.addColorStop(0.8333333333333334, "indigo"), a.addColorStop(1, "violet"), s.fillStyle = a, s.fillRect(0, 0, r.width, r.height);
921
+ var o = "Random Text WMwmil10Oo";
922
+ s.font = "23.123px Arial", s.fillStyle = "black", s.fillText(o, -5, 15), s.fillStyle = "rgba(0, 0, 255, 0.5)", s.fillText(o, -3.3, 17.7), s.beginPath(), s.moveTo(0, 0), s.lineTo(2 * r.width / 7, r.height), s.strokeStyle = "white", s.lineWidth = 2, s.stroke();
923
+ var n = s.getImageData(0, 0, r.width, r.height);
924
+ return n;
925
+ }();
926
+ });
927
+ e({ commonImageDataHash: tr(Ms(t, ss, as).data.toString()).toString() });
928
+ });
929
+ });
930
+ var Bt, Vn = ["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"], qn = ["monospace", "sans-serif", "serif"];
931
+ function ns(e, t) {
932
+ if (!e) throw new Error("Canvas context not supported");
933
+ return e.font = "72px ".concat(t), e.measureText("WwMmLli0Oo").width;
934
+ }
935
+ function Yn() {
936
+ var e, t = document.createElement("canvas"), r = (e = t.getContext("webgl")) !== null && e !== void 0 ? e : t.getContext("experimental-webgl");
937
+ if (r && "getParameter" in r) try {
938
+ var s = (r.getParameter(r.VENDOR) || "").toString(), a = (r.getParameter(r.RENDERER) || "").toString(), o = { vendor: s, renderer: a, version: (r.getParameter(r.VERSION) || "").toString(), shadingLanguageVersion: (r.getParameter(r.SHADING_LANGUAGE_VERSION) || "").toString() };
939
+ if (!a.length || !s.length) {
940
+ var n = r.getExtension("WEBGL_debug_renderer_info");
941
+ if (n) {
942
+ var c = (r.getParameter(n.UNMASKED_VENDOR_WEBGL) || "").toString(), f = (r.getParameter(n.UNMASKED_RENDERER_WEBGL) || "").toString();
943
+ c && (o.vendorUnmasked = c), f && (o.rendererUnmasked = f);
944
+ }
945
+ }
946
+ return o;
947
+ } catch {
948
+ }
949
+ return "undefined";
950
+ }
951
+ function Qn() {
952
+ var e = new Float32Array(1), t = new Uint8Array(e.buffer);
953
+ return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
954
+ }
955
+ function Kn(e, t) {
956
+ var r = {};
957
+ return t.forEach(function(s) {
958
+ var a = function(o) {
959
+ if (o.length === 0) return null;
960
+ var n = {};
961
+ o.forEach(function(u) {
962
+ var i = String(u);
963
+ n[i] = (n[i] || 0) + 1;
964
+ });
965
+ var c = o[0], f = 1;
966
+ return Object.keys(n).forEach(function(u) {
967
+ n[u] > f && (c = u, f = n[u]);
968
+ }), c;
969
+ }(e.map(function(o) {
970
+ return s in o ? o[s] : void 0;
971
+ }).filter(function(o) {
972
+ return o !== void 0;
973
+ }));
974
+ a && (r[s] = a);
975
+ }), r;
976
+ }
977
+ function Xn() {
978
+ var e = [], t = { "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"] };
979
+ return Object.keys(t).forEach(function(r) {
980
+ t[r].forEach(function(s) {
981
+ matchMedia("(".concat(r, ": ").concat(s, ")")).matches && e.push("".concat(r, ": ").concat(s));
982
+ });
983
+ }), e;
984
+ }
985
+ function Zn() {
986
+ if (window.location.protocol === "https:" && typeof window.ApplePaySession == "function") try {
987
+ for (var e = window.ApplePaySession.supportsVersion, t = 15; t > 0; t--) if (e(t)) return t;
988
+ } catch {
989
+ return 0;
990
+ }
991
+ return 0;
992
+ }
993
+ Ze().name != "Firefox" && ae("fonts", function() {
994
+ var e = this;
995
+ return new Promise(function(t, r) {
996
+ try {
997
+ (function(s) {
998
+ var a;
999
+ de(this, void 0, void 0, function() {
1000
+ var o, n, c;
1001
+ return he(this, function(f) {
1002
+ switch (f.label) {
1003
+ case 0:
1004
+ return document.body ? [3, 2] : [4, (u = 50, new Promise(function(p) {
1005
+ return setTimeout(p, u, i);
1006
+ }))];
1007
+ case 1:
1008
+ return f.sent(), [3, 0];
1009
+ case 2:
1010
+ if ((o = document.createElement("iframe")).setAttribute("frameBorder", "0"), (n = o.style).setProperty("position", "fixed"), n.setProperty("display", "block", "important"), n.setProperty("visibility", "visible"), n.setProperty("border", "0"), n.setProperty("opacity", "0"), o.src = "about:blank", document.body.appendChild(o), !(c = o.contentDocument || ((a = o.contentWindow) === null || a === void 0 ? void 0 : a.document))) throw new Error("Iframe document is not accessible");
1011
+ return s({ iframe: c }), setTimeout(function() {
1012
+ document.body.removeChild(o);
1013
+ }, 0), [2];
1014
+ }
1015
+ var u, i;
1016
+ });
1017
+ });
1018
+ })(function(s) {
1019
+ var a = s.iframe;
1020
+ return de(e, void 0, void 0, function() {
1021
+ var o, n, c, f;
1022
+ return he(this, function(u) {
1023
+ return o = a.createElement("canvas"), n = o.getContext("2d"), c = qn.map(function(i) {
1024
+ return ns(n, i);
1025
+ }), f = {}, Vn.forEach(function(i) {
1026
+ var p = ns(n, i);
1027
+ c.includes(p) || (f[i] = p);
1028
+ }), t(f), [2];
1029
+ });
1030
+ });
1031
+ });
1032
+ } catch {
1033
+ r({ error: "unsupported" });
1034
+ }
1035
+ });
1036
+ }), ae("hardware", function() {
1037
+ return new Promise(function(e, t) {
1038
+ var r = navigator.deviceMemory !== void 0 ? navigator.deviceMemory : 0, s = window.performance && window.performance.memory ? window.performance.memory : 0;
1039
+ e({ videocard: Yn(), architecture: Qn(), deviceMemory: r.toString() || "undefined", jsHeapSizeLimit: s.jsHeapSizeLimit || 0 });
1040
+ });
1041
+ }), ae("locales", function() {
1042
+ return new Promise(function(e) {
1043
+ e({ languages: navigator.language, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
1044
+ });
1045
+ }), ae("permissions", function() {
1046
+ return de(this, void 0, void 0, function() {
1047
+ var e;
1048
+ return he(this, function(t) {
1049
+ return Bt = (pe == null ? void 0 : pe.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"], e = Array.from({ length: (pe == null ? void 0 : pe.retries) || 3 }, function() {
1050
+ return function() {
1051
+ return de(this, void 0, void 0, function() {
1052
+ var r, s, a, o, n;
1053
+ return he(this, function(c) {
1054
+ switch (c.label) {
1055
+ case 0:
1056
+ r = {}, s = 0, a = Bt, c.label = 1;
1057
+ case 1:
1058
+ if (!(s < a.length)) return [3, 6];
1059
+ o = a[s], c.label = 2;
1060
+ case 2:
1061
+ return c.trys.push([2, 4, , 5]), [4, navigator.permissions.query({ name: o })];
1062
+ case 3:
1063
+ return n = c.sent(), r[o] = n.state.toString(), [3, 5];
1064
+ case 4:
1065
+ return c.sent(), [3, 5];
1066
+ case 5:
1067
+ return s++, [3, 1];
1068
+ case 6:
1069
+ return [2, r];
1070
+ }
1071
+ });
1072
+ });
1073
+ }();
1074
+ }), [2, Promise.all(e).then(function(r) {
1075
+ return Kn(r, Bt);
1076
+ })];
1077
+ });
1078
+ });
1079
+ }), ae("plugins", function() {
1080
+ var e = [];
1081
+ if (navigator.plugins) for (var t = 0; t < navigator.plugins.length; t++) {
1082
+ var r = navigator.plugins[t];
1083
+ e.push([r.name, r.filename, r.description].join("|"));
1084
+ }
1085
+ return new Promise(function(s) {
1086
+ s({ plugins: e });
1087
+ });
1088
+ }), ae("screen", function() {
1089
+ return new Promise(function(e) {
1090
+ e({ is_touchscreen: navigator.maxTouchPoints > 0, maxTouchPoints: navigator.maxTouchPoints, colorDepth: screen.colorDepth, mediaMatches: Xn() });
1091
+ });
1092
+ }), ae("system", function() {
1093
+ return new Promise(function(e) {
1094
+ var t = Ze();
1095
+ e({ platform: window.navigator.platform, cookieEnabled: window.navigator.cookieEnabled, productSub: navigator.productSub, product: navigator.product, useragent: navigator.userAgent, hardwareConcurrency: navigator.hardwareConcurrency, browser: { name: t.name, version: t.version }, applePayVersion: Zn() });
1096
+ });
1097
+ });
1098
+ var K, Jn = Ze().name !== "SamsungBrowser" ? 1 : 3, E = null;
1099
+ ae("webgl", function() {
1100
+ return de(this, void 0, void 0, function() {
1101
+ var e;
1102
+ return he(this, function(t) {
1103
+ typeof document < "u" && ((K = document.createElement("canvas")).width = 200, K.height = 100, E = K.getContext("webgl"));
1104
+ try {
1105
+ if (!E) throw new Error("WebGL not supported");
1106
+ return e = Array.from({ length: Jn }, function() {
1107
+ return function() {
1108
+ try {
1109
+ if (!E) throw new Error("WebGL not supported");
1110
+ var r = `
1111
+ attribute vec2 position;
1112
+ void main() {
1113
+ gl_Position = vec4(position, 0.0, 1.0);
1114
+ }
1115
+ `, s = `
1116
+ precision mediump float;
1117
+ void main() {
1118
+ gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color
1119
+ }
1120
+ `, a = E.createShader(E.VERTEX_SHADER), o = E.createShader(E.FRAGMENT_SHADER);
1121
+ if (!a || !o) throw new Error("Failed to create shaders");
1122
+ if (E.shaderSource(a, r), E.shaderSource(o, s), E.compileShader(a), !E.getShaderParameter(a, E.COMPILE_STATUS)) throw new Error("Vertex shader compilation failed: " + E.getShaderInfoLog(a));
1123
+ if (E.compileShader(o), !E.getShaderParameter(o, E.COMPILE_STATUS)) throw new Error("Fragment shader compilation failed: " + E.getShaderInfoLog(o));
1124
+ var n = E.createProgram();
1125
+ if (!n) throw new Error("Failed to create shader program");
1126
+ if (E.attachShader(n, a), E.attachShader(n, o), E.linkProgram(n), !E.getProgramParameter(n, E.LINK_STATUS)) throw new Error("Shader program linking failed: " + E.getProgramInfoLog(n));
1127
+ E.useProgram(n);
1128
+ for (var c = 137, f = new Float32Array(4 * c), u = 2 * Math.PI / c, i = 0; i < c; i++) {
1129
+ var p = i * u;
1130
+ f[4 * i] = 0, f[4 * i + 1] = 0, f[4 * i + 2] = Math.cos(p) * (K.width / 2), f[4 * i + 3] = Math.sin(p) * (K.height / 2);
1131
+ }
1132
+ var m = E.createBuffer();
1133
+ E.bindBuffer(E.ARRAY_BUFFER, m), E.bufferData(E.ARRAY_BUFFER, f, E.STATIC_DRAW);
1134
+ var y = E.getAttribLocation(n, "position");
1135
+ E.enableVertexAttribArray(y), E.vertexAttribPointer(y, 2, E.FLOAT, !1, 0, 0), E.viewport(0, 0, K.width, K.height), E.clearColor(0, 0, 0, 1), E.clear(E.COLOR_BUFFER_BIT), E.drawArrays(E.LINES, 0, 2 * c);
1136
+ var v = new Uint8ClampedArray(K.width * K.height * 4);
1137
+ return E.readPixels(0, 0, K.width, K.height, E.RGBA, E.UNSIGNED_BYTE, v), new ImageData(v, K.width, K.height);
1138
+ } catch {
1139
+ return new ImageData(1, 1);
1140
+ } finally {
1141
+ E && (E.bindBuffer(E.ARRAY_BUFFER, null), E.useProgram(null), E.viewport(0, 0, E.drawingBufferWidth, E.drawingBufferHeight), E.clearColor(0, 0, 0, 0));
1142
+ }
1143
+ }();
1144
+ }), [2, { commonImageHash: tr(Ms(e, K.width, K.height).data.toString()).toString() }];
1145
+ } catch {
1146
+ return [2, { webgl: "unsupported" }];
1147
+ }
1148
+ return [2];
1149
+ });
1150
+ });
1151
+ });
1152
+ var Ee = function(e, t, r, s) {
1153
+ for (var a = (r - t) / s, o = 0, n = 0; n < s; n++)
1154
+ o += e(t + (n + 0.5) * a);
1155
+ return o * a;
1156
+ };
1157
+ ae("math", function() {
1158
+ return de(void 0, void 0, void 0, function() {
1159
+ return he(this, function(e) {
1160
+ return [2, { acos: Math.acos(0.5), asin: Ee(Math.asin, -1, 1, 97), atan: Ee(Math.atan, -1, 1, 97), cos: Ee(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: Ee(Math.sin, -Math.PI, Math.PI, 97), sinh: Ee(Math.sinh, -9 / 7, 7 / 9, 97), sqrt: Math.sqrt(2), tan: Ee(Math.tan, 0, 2 * Math.PI, 97), tanh: Ee(Math.tanh, -9 / 7, 7 / 9, 97) }];
1161
+ });
1162
+ });
1163
+ });
1164
+ const eo = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
1165
+ let vt = (e = 21) => {
1166
+ let t = "", r = crypto.getRandomValues(new Uint8Array(e |= 0));
1167
+ for (; e--; )
1168
+ t += eo[r[e] & 63];
1169
+ return t;
1170
+ };
1171
+ class rr {
1172
+ constructor(t) {
1173
+ A(this, "config"), this.config = t;
1174
+ }
1175
+ async getAdsForSearchParams(t) {
1176
+ return [];
1177
+ }
1178
+ async onQuerySubmitted(t) {
1179
+ }
1180
+ async onQueryFetched(t, r) {
1181
+ }
1182
+ async onInputCleared() {
1183
+ }
1184
+ async onAdContainerRendered(t) {
1185
+ }
1186
+ async onAdContainerViewed(t) {
1187
+ }
1188
+ }
1189
+ class to extends rr {
1190
+ /**
1191
+ * Gets ads from the adMarketplace API based on the search term.
1192
+ */
1193
+ async getAdsForSearchParams(t) {
1194
+ if (!this.config.admSub)
1195
+ return console.error("No admSub specified in config."), [];
1196
+ const r = `https://demofeed.is.ampfeed.com/is?${new URLSearchParams({
1197
+ partner: "demofeed",
1198
+ sub1: this.config.admSub,
1199
+ qt: t.searchTerm,
1200
+ v: "2.0",
1201
+ rfr: "searchcraft.io",
1202
+ "results-ta": `${this.config.admTextAdQuantity || 0}`,
1203
+ "results-pa": `${this.config.admProductAdQuantity || 0}`
1204
+ }).toString()}`, s = await (await fetch(r, { method: "GET" })).json(), a = s.product_ads.map(
1205
+ (n) => ({
1206
+ id: vt(),
1207
+ adSource: "adMarketplace",
1208
+ admAdType: "adm-product-ad",
1209
+ admAd: n
1210
+ })
1211
+ ), o = s.text_ads.map((n) => ({
1212
+ id: vt(),
1213
+ adSource: "adMarketplace",
1214
+ admAdType: "adm-text-ad",
1215
+ admAd: n
1216
+ }));
1217
+ return a.concat(o);
1218
+ }
1219
+ async onAdContainerViewed(t) {
1220
+ var r;
1221
+ const s = t.adClientResponseItem;
1222
+ (r = s.admAd) != null && r.impression_url && fetch(s.admAd.impression_url);
1223
+ }
1224
+ }
1225
+ class ro extends rr {
1226
+ async getAdsForSearchParams(t) {
1227
+ return [];
1228
+ }
1229
+ }
1230
+ const so = 1e3;
1231
+ class ao extends rr {
1232
+ constructor(t) {
1233
+ super(t), A(this, "adCallTimeout"), this.addScriptTagToDocument();
1234
+ }
1235
+ async onQuerySubmitted(t) {
1236
+ this.addScriptTagToDocument();
1237
+ }
1238
+ async onQueryFetched(t, r) {
1239
+ var s;
1240
+ if ((((s = r.data.hits) == null ? void 0 : s.length) || 0) === 0) {
1241
+ this.removeScriptTagFromDocument();
1242
+ return;
1243
+ }
1244
+ this.performAdCall(so);
1245
+ }
1246
+ async onInputCleared() {
1247
+ this.removeScriptTagFromDocument();
1248
+ }
1249
+ performAdCall(t) {
1250
+ this.adCallTimeout && clearTimeout(this.adCallTimeout), this.adCallTimeout = setTimeout(() => {
1251
+ this.addScriptTagToDocument();
1252
+ try {
1253
+ PostRelease == null || PostRelease.Start({ ptd: [this.config.nativoPlacementId] });
1254
+ } catch (r) {
1255
+ console.error(r);
1256
+ }
1257
+ }, t);
1258
+ }
1259
+ async getAdsForSearchParams(t) {
1260
+ return [];
1261
+ }
1262
+ addScriptTagToDocument() {
1263
+ if (!document.head.querySelector("#nativo-tag")) {
1264
+ const t = document.createElement("script");
1265
+ t.type = "text/javascript", t.src = "https://s.ntv.io/serve/load.js", t.id = "nativo-tag", t.setAttribute("data-ntv-set-no-auto-start", "true"), document.head.appendChild(t);
1266
+ }
1267
+ }
1268
+ removeScriptTagFromDocument() {
1269
+ const t = document.head.querySelector("#nativo-tag");
1270
+ t && document.head.removeChild(t);
1271
+ }
1272
+ }
1273
+ const no = 500;
1274
+ class oo {
1275
+ constructor(t, r, s) {
1276
+ A(this, "measureRequestTimeout"), A(this, "measureRequestsBatched", []), A(this, "config"), A(this, "sdkInfo"), A(this, "userId"), A(this, "sessionId"), A(this, "sendMeasureEvent", (a, o = {}, n = {}) => {
1277
+ const c = {
1278
+ event_name: a,
1279
+ properties: {
1280
+ searchcraft_index_names: this.config.index,
1281
+ session_id: this.sessionId,
1282
+ ...o
1283
+ },
1284
+ user: {
1285
+ ...this.measureRequestUser,
1286
+ ...n
1287
+ }
1288
+ };
1289
+ this.measureRequestsBatched.push(c), clearTimeout(this.measureRequestTimeout), this.measureRequestTimeout = setTimeout(async () => {
1290
+ const f = JSON.stringify({ items: this.measureRequestsBatched }), u = `${this.baseMeasureUrl}/batch`;
1291
+ try {
1292
+ const i = await fetch(u, {
1293
+ method: "POST",
1294
+ headers: {
1295
+ "Content-Type": "application/json",
1296
+ Authorization: this.config.readKey,
1297
+ "X-Sc-User-Id": this.userId
1298
+ },
1299
+ body: f,
1300
+ keepalive: !0
1301
+ });
1302
+ if (!i.ok)
1303
+ throw new Error(
1304
+ `Failed to send request: ${i.status} ${i.statusText}`
1305
+ );
1306
+ this.measureRequestsBatched = [];
1307
+ return;
1308
+ } catch (i) {
1309
+ throw console.error("Error sending MeasureRequest:", i), i;
1310
+ }
1311
+ }, no);
1312
+ }), this.config = t, this.sdkInfo = r, this.userId = s, this.sessionId = vt(), this.sendMeasureEvent("sdk_initialized");
1313
+ }
1314
+ /**
1315
+ * Getter for the base url used by the /measure endpoints.
1316
+ */
1317
+ get baseMeasureUrl() {
1318
+ return `${this.config.endpointURL}/measure`;
1319
+ }
1320
+ /**
1321
+ * Getter for the measure request user. Uses config values + navigator values.
1322
+ */
1323
+ get measureRequestUser() {
1324
+ return {
1325
+ user_id: this.userId,
1326
+ locale: navigator.language || "en-US",
1327
+ os: navigator.userAgent.includes("Windows") ? "Windows" : navigator.userAgent.includes("Mac") ? "Mac" : navigator.userAgent.includes("Linux") ? "Linux" : "Unknown",
1328
+ platform: navigator.platform || "Unknown",
1329
+ sdk_name: this.sdkInfo.sdkName,
1330
+ sdk_version: this.sdkInfo.sdkVersion,
1331
+ user_agent: navigator.userAgent || "Unknown"
1332
+ };
1333
+ }
1334
+ }
1335
+ function co(e) {
1336
+ const t = [];
1337
+ let r = "should";
1338
+ return e.facetPathsForIndexFields && Object.keys(e.facetPathsForIndexFields).forEach((s) => {
1339
+ var a;
1340
+ const o = (a = e.facetPathsForIndexFields) == null ? void 0 : a[s];
1341
+ o && (r = "must", t.push({
1342
+ occur: r,
1343
+ exact: {
1344
+ ctx: o.value
1345
+ }
1346
+ }));
1347
+ }), e.rangeValueForIndexFields && Object.keys(e.rangeValueForIndexFields).forEach((s) => {
1348
+ var a;
1349
+ const o = (a = e.rangeValueForIndexFields) == null ? void 0 : a[s];
1350
+ o && (r = "must", t.push({
1351
+ occur: r,
1352
+ exact: {
1353
+ ctx: o.value
1354
+ }
1355
+ }));
1356
+ }), e.sort === "desc" ? e.order_by = "date_published" : e.order_by = "", t.push({
1357
+ occur: r,
1358
+ // Valid, as 'occur' is a required property in QueryItem
1359
+ [e.mode]: { ctx: e.searchTerm }
1360
+ // Ensure dynamic mode is inside queryType
1361
+ }), t;
1362
+ }
1363
+ const io = (e) => e.endsWith("/") ? e.slice(0, -1) : e, lo = (e) => {
1364
+ let t = "";
1365
+ if (t = e.trim(), t = t.replace(/[‘’“”]/g, (r) => ({
1366
+ "‘": "'",
1367
+ "’": "'",
1368
+ "“": '"',
1369
+ "”": '"'
1370
+ })[r] || r), (t.match(/"/g) || []).length % 2 !== 0)
1371
+ throw new Error(
1372
+ "The search term contains an uneven number of quote characters."
1373
+ );
1374
+ return t;
1375
+ };
1376
+ class uo {
1377
+ constructor(t, r, s) {
1378
+ A(this, "config"), A(this, "userId"), A(this, "parent"), A(this, "getSearchResponse", async (a) => {
1379
+ var o, n, c, f, u;
1380
+ const i = lo(a.searchTerm);
1381
+ (o = this.parent.measureClient) == null || o.sendMeasureEvent("search_requested", {
1382
+ search_term: i
1383
+ }), this.parent.emitEvent("query_submitted", {
1384
+ name: "query_submitted",
1385
+ data: {
1386
+ searchTerm: i
1387
+ }
1388
+ }), (n = this.parent.adClient) == null || n.onQuerySubmitted(a);
1389
+ try {
1390
+ const p = {
1391
+ query: co(a),
1392
+ offset: a.offset || 0,
1393
+ // Default to 0 (first page) if not provided
1394
+ limit: a.limit || this.config.searchResultsPerPage || 20
1395
+ // Default to 20 if not provided
1396
+ };
1397
+ a.order_by && (p.order_by = a.order_by, p.sort = a.sort === "desc" || a.sort === "asc" ? a.sort : "asc");
1398
+ const m = {
1399
+ method: "POST",
1400
+ headers: {
1401
+ Authorization: this.config.readKey,
1402
+ "Content-Type": "application/json",
1403
+ "X-Sc-User-Id": this.userId
1404
+ },
1405
+ body: JSON.stringify(p)
1406
+ }, y = await fetch(this.baseSearchUrl, m);
1407
+ if (!y.ok)
1408
+ throw new Error(
1409
+ `Error: ${y.statusText} (Status: ${y.status})`
1410
+ );
1411
+ const v = await y.json();
1412
+ return (c = this.parent.measureClient) == null || c.sendMeasureEvent("search_response_received", {
1413
+ search_term: i,
1414
+ number_of_documents: v.data.count
1415
+ }), this.parent.emitEvent("query_fetched", {
1416
+ name: "query_fetched",
1417
+ data: {
1418
+ searchTerm: i
1419
+ }
1420
+ }), (((f = v.data.hits) == null ? void 0 : f.length) || 0) === 0 && this.parent.emitEvent("no_results_returned", {
1421
+ name: "no_results_returned"
1422
+ }), (u = this.parent.adClient) == null || u.onQueryFetched(a, v), v;
1423
+ } catch (p) {
1424
+ throw console.error("Error parsing response:", p), p;
1425
+ }
1426
+ }), this.parent = t, this.config = r, this.userId = s;
1427
+ }
1428
+ /**
1429
+ * Getter for the base url used by the /search endpoint.
1430
+ */
1431
+ get baseSearchUrl() {
1432
+ return `${this.config.endpointURL}/index/${this.config.index.join(",")}/search`;
1433
+ }
1434
+ }
1435
+ class fo {
1436
+ constructor(t, r) {
1437
+ if (A(this, "config"), A(this, "measureClient"), A(this, "searchClient"), A(this, "adClient"), A(this, "userId"), A(this, "requestTimeout"), A(this, "subscriptionEvents", {}), A(this, "getItems", (s, a, o) => {
1438
+ const n = async () => {
1439
+ (async () => {
1440
+ var c, f;
1441
+ const u = await ((c = this == null ? void 0 : this.searchClient) == null ? void 0 : c.getSearchResponse(s));
1442
+ if (!u)
1443
+ throw new Error("Search client was not initialized.");
1444
+ const i = (f = u.data.hits || []) == null ? void 0 : f.map((p) => p.doc).filter((p) => !!p).map((p) => ({
1445
+ type: "SearchDocument",
1446
+ id: vt(),
1447
+ document: p
1448
+ }));
1449
+ a(u, i);
1450
+ })(), (async () => {
1451
+ if (this.adClient) {
1452
+ const c = await this.adClient.getAdsForSearchParams(s);
1453
+ o(c);
1454
+ }
1455
+ })();
1456
+ };
1457
+ clearTimeout(this.requestTimeout), this.config.searchDebounceDelay ? this.requestTimeout = setTimeout(
1458
+ n,
1459
+ this.config.searchDebounceDelay
1460
+ ) : n();
1461
+ }), !t.endpointURL || !t.index || !t.readKey)
1462
+ throw new Error(
1463
+ "Endpoint URL, Index value(s), and Read Key must be provided"
1464
+ );
1465
+ this.config = {
1466
+ ...t,
1467
+ // Strips off the trailing '/' from an endpointURL if one is accidentally added
1468
+ endpointURL: io(t.endpointURL)
1469
+ }, this.userId = "", typeof window < "u" && typeof customElements < "u" && r.sdkName === "@searchcraft/javascript-sdk" && globalThis.__scDefineCustomElements__ && globalThis.__scDefineCustomElements__(), typeof window < "u" && (this.initClients(this.config, r), this.initInputForms(), this.startObservingMutations());
1470
+ }
1471
+ initInputForms() {
1472
+ const t = document.querySelectorAll(
1473
+ "searchcraft-input-form"
1474
+ );
1475
+ setTimeout(() => {
1476
+ t.forEach((r) => {
1477
+ r.core = this;
1478
+ });
1479
+ }, 40);
1480
+ }
1481
+ /**
1482
+ * When changes happen in the DOM, we want to link any input forms found to the instance of the core.
1483
+ */
1484
+ startObservingMutations() {
1485
+ new MutationObserver((t, r) => {
1486
+ let s = !1;
1487
+ for (const a of t)
1488
+ a.type === "childList" && a.addedNodes.forEach((o) => {
1489
+ o.nodeType === 1 && o.className.toLowerCase() === "searchcraft-input-form" && (s = !0);
1490
+ });
1491
+ s && this.initInputForms();
1492
+ }).observe(document.body, { childList: !0, subtree: !0 });
1493
+ }
1494
+ initClients(t, r) {
1495
+ setTimeout(async () => {
1496
+ let s = this.config.userId;
1497
+ switch (s || (s = await jn()), this.measureClient = new oo(t, r, s), this.searchClient = new uo(this, t, s), t.adSource) {
1498
+ case "adMarketplace":
1499
+ this.adClient = new to(t);
1500
+ break;
1501
+ case "Nativo":
1502
+ this.adClient = new ao(t);
1503
+ break;
1504
+ case "Custom":
1505
+ this.adClient = new ro(t);
1506
+ break;
1507
+ }
1508
+ }, 300);
1509
+ }
1510
+ emitEvent(t, r) {
1511
+ var s;
1512
+ (s = this.subscriptionEvents[t]) == null || s.forEach((a) => {
1513
+ a(r);
1514
+ });
1515
+ }
1516
+ subscribe(t, r) {
1517
+ return this.subscriptionEvents[t] || (this.subscriptionEvents[t] = []), this.subscriptionEvents[t].push(
1518
+ r
1519
+ ), () => {
1520
+ this.subscriptionEvents[t] = this.subscriptionEvents[t].filter((s) => s !== r);
1521
+ };
1522
+ }
1523
+ /**
1524
+ * Called when a `<searchcraft-ad>` component is rendered
1525
+ */
1526
+ handleAdContainerRendered(t) {
1527
+ var r;
1528
+ (r = this.adClient) == null || r.onAdContainerRendered(t), this.emitEvent("ad_container_rendered", {
1529
+ name: "ad_container_rendered",
1530
+ data: {
1531
+ adContainerId: t.adContainerId,
1532
+ adSource: t.adSource,
1533
+ searchTerm: t.searchTerm
1534
+ }
1535
+ });
1536
+ }
1537
+ /**
1538
+ * Called when a `<searchcraft-ad>` is viewed
1539
+ */
1540
+ handleAdContainerViewed(t) {
1541
+ var r;
1542
+ (r = this.adClient) == null || r.onAdContainerViewed(t), this.emitEvent("ad_container_viewed", {
1543
+ name: "ad_container_viewed",
1544
+ data: {
1545
+ adContainerId: t.adContainerId,
1546
+ adSource: t.adSource,
1547
+ searchTerm: t.searchTerm
1548
+ }
1549
+ });
1550
+ }
1551
+ /**
1552
+ * Perform various actions when the input is cleared
1553
+ */
1554
+ handleInputCleared() {
1555
+ var t;
1556
+ this.emitEvent("input_cleared", {
1557
+ name: "input_cleared"
1558
+ }), (t = this.adClient) == null || t.onInputCleared();
1559
+ }
1560
+ }
1561
+ var Ls = {}, sr = {};
1562
+ const os = (e) => {
1563
+ let t;
1564
+ const r = /* @__PURE__ */ new Set(), s = (u, i) => {
1565
+ const p = typeof u == "function" ? u(t) : u;
1566
+ if (!Object.is(p, t)) {
1567
+ const m = t;
1568
+ t = i ?? (typeof p != "object" || p === null) ? p : Object.assign({}, t, p), r.forEach((y) => y(t, m));
1569
+ }
1570
+ }, a = () => t, c = { setState: s, getState: a, getInitialState: () => f, subscribe: (u) => (r.add(u), () => r.delete(u)) }, f = t = e(s, a, c);
1571
+ return c;
1572
+ }, ho = (e) => e ? os(e) : os;
1573
+ sr.createStore = ho;
1574
+ var ar = {}, Os = { exports: {} }, R = {};
1575
+ /**
1576
+ * @license React
1577
+ * react.production.js
1578
+ *
1579
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1580
+ *
1581
+ * This source code is licensed under the MIT license found in the
1582
+ * LICENSE file in the root directory of this source tree.
1583
+ */
1584
+ var nr = Symbol.for("react.transitional.element"), po = Symbol.for("react.portal"), mo = Symbol.for("react.fragment"), go = Symbol.for("react.strict_mode"), vo = Symbol.for("react.profiler"), bo = Symbol.for("react.consumer"), yo = Symbol.for("react.context"), So = Symbol.for("react.forward_ref"), wo = Symbol.for("react.suspense"), Eo = Symbol.for("react.memo"), Fs = Symbol.for("react.lazy"), cs = Symbol.iterator;
1585
+ function Ro(e) {
1586
+ return e === null || typeof e != "object" ? null : (e = cs && e[cs] || e["@@iterator"], typeof e == "function" ? e : null);
1587
+ }
1588
+ var Ds = {
1589
+ isMounted: function() {
1590
+ return !1;
1591
+ },
1592
+ enqueueForceUpdate: function() {
1593
+ },
1594
+ enqueueReplaceState: function() {
1595
+ },
1596
+ enqueueSetState: function() {
1597
+ }
1598
+ }, Ns = Object.assign, Us = {};
1599
+ function Oe(e, t, r) {
1600
+ this.props = e, this.context = t, this.refs = Us, this.updater = r || Ds;
1601
+ }
1602
+ Oe.prototype.isReactComponent = {};
1603
+ Oe.prototype.setState = function(e, t) {
1604
+ if (typeof e != "object" && typeof e != "function" && e != null)
1605
+ throw Error(
1606
+ "takes an object of state variables to update or a function which returns an object of state variables."
1607
+ );
1608
+ this.updater.enqueueSetState(this, e, t, "setState");
1609
+ };
1610
+ Oe.prototype.forceUpdate = function(e) {
1611
+ this.updater.enqueueForceUpdate(this, e, "forceUpdate");
1612
+ };
1613
+ function zs() {
1614
+ }
1615
+ zs.prototype = Oe.prototype;
1616
+ function or(e, t, r) {
1617
+ this.props = e, this.context = t, this.refs = Us, this.updater = r || Ds;
1618
+ }
1619
+ var cr = or.prototype = new zs();
1620
+ cr.constructor = or;
1621
+ Ns(cr, Oe.prototype);
1622
+ cr.isPureReactComponent = !0;
1623
+ var is = Array.isArray, I = { H: null, A: null, T: null, S: null }, Hs = Object.prototype.hasOwnProperty;
1624
+ function ir(e, t, r, s, a, o) {
1625
+ return r = o.ref, {
1626
+ $$typeof: nr,
1627
+ type: e,
1628
+ key: t,
1629
+ ref: r !== void 0 ? r : null,
1630
+ props: o
1631
+ };
1632
+ }
1633
+ function To(e, t) {
1634
+ return ir(
1635
+ e.type,
1636
+ t,
1637
+ void 0,
1638
+ void 0,
1639
+ void 0,
1640
+ e.props
1641
+ );
1642
+ }
1643
+ function lr(e) {
1644
+ return typeof e == "object" && e !== null && e.$$typeof === nr;
1645
+ }
1646
+ function ko(e) {
1647
+ var t = { "=": "=0", ":": "=2" };
1648
+ return "$" + e.replace(/[=:]/g, function(r) {
1649
+ return t[r];
1650
+ });
1651
+ }
1652
+ var ls = /\/+/g;
1653
+ function Wt(e, t) {
1654
+ return typeof e == "object" && e !== null && e.key != null ? ko("" + e.key) : t.toString(36);
1655
+ }
1656
+ function us() {
1657
+ }
1658
+ function Co(e) {
1659
+ switch (e.status) {
1660
+ case "fulfilled":
1661
+ return e.value;
1662
+ case "rejected":
1663
+ throw e.reason;
1664
+ default:
1665
+ switch (typeof e.status == "string" ? e.then(us, us) : (e.status = "pending", e.then(
1666
+ function(t) {
1667
+ e.status === "pending" && (e.status = "fulfilled", e.value = t);
1668
+ },
1669
+ function(t) {
1670
+ e.status === "pending" && (e.status = "rejected", e.reason = t);
1671
+ }
1672
+ )), e.status) {
1673
+ case "fulfilled":
1674
+ return e.value;
1675
+ case "rejected":
1676
+ throw e.reason;
1677
+ }
1678
+ }
1679
+ throw e;
1680
+ }
1681
+ function Ie(e, t, r, s, a) {
1682
+ var o = typeof e;
1683
+ (o === "undefined" || o === "boolean") && (e = null);
1684
+ var n = !1;
1685
+ if (e === null) n = !0;
1686
+ else
1687
+ switch (o) {
1688
+ case "bigint":
1689
+ case "string":
1690
+ case "number":
1691
+ n = !0;
1692
+ break;
1693
+ case "object":
1694
+ switch (e.$$typeof) {
1695
+ case nr:
1696
+ case po:
1697
+ n = !0;
1698
+ break;
1699
+ case Fs:
1700
+ return n = e._init, Ie(
1701
+ n(e._payload),
1702
+ t,
1703
+ r,
1704
+ s,
1705
+ a
1706
+ );
1707
+ }
1708
+ }
1709
+ if (n)
1710
+ return a = a(e), n = s === "" ? "." + Wt(e, 0) : s, is(a) ? (r = "", n != null && (r = n.replace(ls, "$&/") + "/"), Ie(a, t, r, "", function(u) {
1711
+ return u;
1712
+ })) : a != null && (lr(a) && (a = To(
1713
+ a,
1714
+ r + (a.key == null || e && e.key === a.key ? "" : ("" + a.key).replace(
1715
+ ls,
1716
+ "$&/"
1717
+ ) + "/") + n
1718
+ )), t.push(a)), 1;
1719
+ n = 0;
1720
+ var c = s === "" ? "." : s + ":";
1721
+ if (is(e))
1722
+ for (var f = 0; f < e.length; f++)
1723
+ s = e[f], o = c + Wt(s, f), n += Ie(
1724
+ s,
1725
+ t,
1726
+ r,
1727
+ o,
1728
+ a
1729
+ );
1730
+ else if (f = Ro(e), typeof f == "function")
1731
+ for (e = f.call(e), f = 0; !(s = e.next()).done; )
1732
+ s = s.value, o = c + Wt(s, f++), n += Ie(
1733
+ s,
1734
+ t,
1735
+ r,
1736
+ o,
1737
+ a
1738
+ );
1739
+ else if (o === "object") {
1740
+ if (typeof e.then == "function")
1741
+ return Ie(
1742
+ Co(e),
1743
+ t,
1744
+ r,
1745
+ s,
1746
+ a
1747
+ );
1748
+ throw t = String(e), Error(
1749
+ "Objects are not valid as a React child (found: " + (t === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : t) + "). If you meant to render a collection of children, use an array instead."
1750
+ );
1751
+ }
1752
+ return n;
1753
+ }
1754
+ function dt(e, t, r) {
1755
+ if (e == null) return e;
1756
+ var s = [], a = 0;
1757
+ return Ie(e, s, "", "", function(o) {
1758
+ return t.call(r, o, a++);
1759
+ }), s;
1760
+ }
1761
+ function Po(e) {
1762
+ if (e._status === -1) {
1763
+ var t = e._result;
1764
+ t = t(), t.then(
1765
+ function(r) {
1766
+ (e._status === 0 || e._status === -1) && (e._status = 1, e._result = r);
1767
+ },
1768
+ function(r) {
1769
+ (e._status === 0 || e._status === -1) && (e._status = 2, e._result = r);
1770
+ }
1771
+ ), e._status === -1 && (e._status = 0, e._result = t);
1772
+ }
1773
+ if (e._status === 1) return e._result.default;
1774
+ throw e._result;
1775
+ }
1776
+ var fs = typeof reportError == "function" ? reportError : function(e) {
1777
+ if (typeof window == "object" && typeof window.ErrorEvent == "function") {
1778
+ var t = new window.ErrorEvent("error", {
1779
+ bubbles: !0,
1780
+ cancelable: !0,
1781
+ message: typeof e == "object" && e !== null && typeof e.message == "string" ? String(e.message) : String(e),
1782
+ error: e
1783
+ });
1784
+ if (!window.dispatchEvent(t)) return;
1785
+ } else if (typeof process == "object" && typeof process.emit == "function") {
1786
+ process.emit("uncaughtException", e);
1787
+ return;
1788
+ }
1789
+ console.error(e);
1790
+ };
1791
+ function xo() {
1792
+ }
1793
+ R.Children = {
1794
+ map: dt,
1795
+ forEach: function(e, t, r) {
1796
+ dt(
1797
+ e,
1798
+ function() {
1799
+ t.apply(this, arguments);
1800
+ },
1801
+ r
1802
+ );
1803
+ },
1804
+ count: function(e) {
1805
+ var t = 0;
1806
+ return dt(e, function() {
1807
+ t++;
1808
+ }), t;
1809
+ },
1810
+ toArray: function(e) {
1811
+ return dt(e, function(t) {
1812
+ return t;
1813
+ }) || [];
1814
+ },
1815
+ only: function(e) {
1816
+ if (!lr(e))
1817
+ throw Error(
1818
+ "React.Children.only expected to receive a single React element child."
1819
+ );
1820
+ return e;
1821
+ }
1822
+ };
1823
+ R.Component = Oe;
1824
+ R.Fragment = mo;
1825
+ R.Profiler = vo;
1826
+ R.PureComponent = or;
1827
+ R.StrictMode = go;
1828
+ R.Suspense = wo;
1829
+ R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = I;
1830
+ R.act = function() {
1831
+ throw Error("act(...) is not supported in production builds of React.");
1832
+ };
1833
+ R.cache = function(e) {
1834
+ return function() {
1835
+ return e.apply(null, arguments);
1836
+ };
1837
+ };
1838
+ R.cloneElement = function(e, t, r) {
1839
+ if (e == null)
1840
+ throw Error(
1841
+ "The argument must be a React element, but you passed " + e + "."
1842
+ );
1843
+ var s = Ns({}, e.props), a = e.key, o = void 0;
1844
+ if (t != null)
1845
+ for (n in t.ref !== void 0 && (o = void 0), t.key !== void 0 && (a = "" + t.key), t)
1846
+ !Hs.call(t, n) || n === "key" || n === "__self" || n === "__source" || n === "ref" && t.ref === void 0 || (s[n] = t[n]);
1847
+ var n = arguments.length - 2;
1848
+ if (n === 1) s.children = r;
1849
+ else if (1 < n) {
1850
+ for (var c = Array(n), f = 0; f < n; f++)
1851
+ c[f] = arguments[f + 2];
1852
+ s.children = c;
1853
+ }
1854
+ return ir(e.type, a, void 0, void 0, o, s);
1855
+ };
1856
+ R.createContext = function(e) {
1857
+ return e = {
1858
+ $$typeof: yo,
1859
+ _currentValue: e,
1860
+ _currentValue2: e,
1861
+ _threadCount: 0,
1862
+ Provider: null,
1863
+ Consumer: null
1864
+ }, e.Provider = e, e.Consumer = {
1865
+ $$typeof: bo,
1866
+ _context: e
1867
+ }, e;
1868
+ };
1869
+ R.createElement = function(e, t, r) {
1870
+ var s, a = {}, o = null;
1871
+ if (t != null)
1872
+ for (s in t.key !== void 0 && (o = "" + t.key), t)
1873
+ Hs.call(t, s) && s !== "key" && s !== "__self" && s !== "__source" && (a[s] = t[s]);
1874
+ var n = arguments.length - 2;
1875
+ if (n === 1) a.children = r;
1876
+ else if (1 < n) {
1877
+ for (var c = Array(n), f = 0; f < n; f++)
1878
+ c[f] = arguments[f + 2];
1879
+ a.children = c;
1880
+ }
1881
+ if (e && e.defaultProps)
1882
+ for (s in n = e.defaultProps, n)
1883
+ a[s] === void 0 && (a[s] = n[s]);
1884
+ return ir(e, o, void 0, void 0, null, a);
1885
+ };
1886
+ R.createRef = function() {
1887
+ return { current: null };
1888
+ };
1889
+ R.forwardRef = function(e) {
1890
+ return { $$typeof: So, render: e };
1891
+ };
1892
+ R.isValidElement = lr;
1893
+ R.lazy = function(e) {
1894
+ return {
1895
+ $$typeof: Fs,
1896
+ _payload: { _status: -1, _result: e },
1897
+ _init: Po
1898
+ };
1899
+ };
1900
+ R.memo = function(e, t) {
1901
+ return {
1902
+ $$typeof: Eo,
1903
+ type: e,
1904
+ compare: t === void 0 ? null : t
1905
+ };
1906
+ };
1907
+ R.startTransition = function(e) {
1908
+ var t = I.T, r = {};
1909
+ I.T = r;
1910
+ try {
1911
+ var s = e(), a = I.S;
1912
+ a !== null && a(r, s), typeof s == "object" && s !== null && typeof s.then == "function" && s.then(xo, fs);
1913
+ } catch (o) {
1914
+ fs(o);
1915
+ } finally {
1916
+ I.T = t;
1917
+ }
1918
+ };
1919
+ R.unstable_useCacheRefresh = function() {
1920
+ return I.H.useCacheRefresh();
1921
+ };
1922
+ R.use = function(e) {
1923
+ return I.H.use(e);
1924
+ };
1925
+ R.useActionState = function(e, t, r) {
1926
+ return I.H.useActionState(e, t, r);
1927
+ };
1928
+ R.useCallback = function(e, t) {
1929
+ return I.H.useCallback(e, t);
1930
+ };
1931
+ R.useContext = function(e) {
1932
+ return I.H.useContext(e);
1933
+ };
1934
+ R.useDebugValue = function() {
1935
+ };
1936
+ R.useDeferredValue = function(e, t) {
1937
+ return I.H.useDeferredValue(e, t);
1938
+ };
1939
+ R.useEffect = function(e, t) {
1940
+ return I.H.useEffect(e, t);
1941
+ };
1942
+ R.useId = function() {
1943
+ return I.H.useId();
1944
+ };
1945
+ R.useImperativeHandle = function(e, t, r) {
1946
+ return I.H.useImperativeHandle(e, t, r);
1947
+ };
1948
+ R.useInsertionEffect = function(e, t) {
1949
+ return I.H.useInsertionEffect(e, t);
1950
+ };
1951
+ R.useLayoutEffect = function(e, t) {
1952
+ return I.H.useLayoutEffect(e, t);
1953
+ };
1954
+ R.useMemo = function(e, t) {
1955
+ return I.H.useMemo(e, t);
1956
+ };
1957
+ R.useOptimistic = function(e, t) {
1958
+ return I.H.useOptimistic(e, t);
1959
+ };
1960
+ R.useReducer = function(e, t, r) {
1961
+ return I.H.useReducer(e, t, r);
1962
+ };
1963
+ R.useRef = function(e) {
1964
+ return I.H.useRef(e);
1965
+ };
1966
+ R.useState = function(e) {
1967
+ return I.H.useState(e);
1968
+ };
1969
+ R.useSyncExternalStore = function(e, t, r) {
1970
+ return I.H.useSyncExternalStore(
1971
+ e,
1972
+ t,
1973
+ r
1974
+ );
1975
+ };
1976
+ R.useTransition = function() {
1977
+ return I.H.useTransition();
1978
+ };
1979
+ R.version = "19.0.0";
1980
+ Os.exports = R;
1981
+ var ds = Os.exports, $o = sr;
1982
+ const _o = (e) => e;
1983
+ function js(e, t = _o) {
1984
+ const r = ds.useSyncExternalStore(
1985
+ e.subscribe,
1986
+ () => t(e.getState()),
1987
+ () => t(e.getInitialState())
1988
+ );
1989
+ return ds.useDebugValue(r), r;
1990
+ }
1991
+ const hs = (e) => {
1992
+ const t = $o.createStore(e), r = (s) => js(t, s);
1993
+ return Object.assign(r, t), r;
1994
+ }, Ao = (e) => e ? hs(e) : hs;
1995
+ ar.create = Ao;
1996
+ ar.useStore = js;
1997
+ (function(e) {
1998
+ var t = sr, r = ar;
1999
+ Object.keys(t).forEach(function(s) {
2000
+ s !== "default" && !Object.prototype.hasOwnProperty.call(e, s) && Object.defineProperty(e, s, {
2001
+ enumerable: !0,
2002
+ get: function() {
2003
+ return t[s];
2004
+ }
2005
+ });
2006
+ }), Object.keys(r).forEach(function(s) {
2007
+ s !== "default" && !Object.prototype.hasOwnProperty.call(e, s) && Object.defineProperty(e, s, {
2008
+ enumerable: !0,
2009
+ get: function() {
2010
+ return r[s];
2011
+ }
2012
+ });
2013
+ });
2014
+ })(Ls);
2015
+ const Io = {
2016
+ adClientResponseItems: [],
2017
+ core: void 0,
2018
+ logger: void 0,
2019
+ facetPathsForIndexFields: {},
2020
+ isPopoverVisible: !1,
2021
+ isSearchInProgress: !1,
2022
+ searchTerm: "",
2023
+ rangeValueForIndexFields: {},
2024
+ searchMode: "fuzzy",
2025
+ searchClientResponseItems: [],
2026
+ searchResponseTimeTaken: void 0,
2027
+ searchResponseFacetPrime: void 0,
2028
+ searchResultsCount: 0,
2029
+ searchResultsPerPage: 20,
2030
+ searchResultsPage: 1,
2031
+ sortType: "asc"
2032
+ }, $ = Ls.createStore((e, t) => {
2033
+ const r = {
2034
+ addFacetPathsForIndexField: (a) => e((o) => ({
2035
+ facetPathsForIndexFields: {
2036
+ ...o.facetPathsForIndexFields,
2037
+ [a.fieldName]: a
2038
+ }
2039
+ })),
2040
+ addRangeValueForIndexField: (a) => e((o) => ({
2041
+ rangeValueForIndexFields: {
2042
+ ...o.rangeValueForIndexFields,
2043
+ [a.fieldName]: a
2044
+ }
2045
+ })),
2046
+ getSearchcraftInstance: () => {
2047
+ const { core: a } = t();
2048
+ return a;
2049
+ },
2050
+ initialize: (a, o = !1) => {
2051
+ const n = a, c = o ? new Fn({ logLevel: Re.DEBUG }) : void 0;
2052
+ e({
2053
+ core: n,
2054
+ logger: c,
2055
+ searchResultsPerPage: n.config.searchResultsPerPage || 20
2056
+ });
2057
+ },
2058
+ removeFacetPathsForIndexField: (a) => e((o) => {
2059
+ const n = o.facetPathsForIndexFields;
2060
+ return delete n[a], {
2061
+ facetPathsForIndexFields: {
2062
+ ...n
2063
+ }
2064
+ };
2065
+ }),
2066
+ removeRangeValueForIndexField: (a) => e((o) => {
2067
+ const n = o.rangeValueForIndexFields;
2068
+ return delete n[a], {
2069
+ rangeValueForIndexFields: {
2070
+ ...n
2071
+ }
2072
+ };
2073
+ }),
2074
+ resetFacetPaths: () => {
2075
+ e({
2076
+ facetPathsForIndexFields: {}
2077
+ });
2078
+ },
2079
+ search: async () => {
2080
+ var c, f;
2081
+ const a = t();
2082
+ if ((c = a.logger) == null || c.log(Re.INFO, `Starting search with search term: "${a.searchTerm}"`), !a.core)
2083
+ throw new Error("Searchcraft instance is not initialized.");
2084
+ if (!a.searchTerm.trim()) {
2085
+ (f = a.logger) == null || f.log(Re.INFO, "No search request was made: search term was empty."), e({
2086
+ searchClientResponseItems: [],
2087
+ searchResultsCount: 0,
2088
+ searchResultsPage: 1,
2089
+ searchTerm: ""
2090
+ });
2091
+ return;
2092
+ }
2093
+ e({ isSearchInProgress: !0 });
2094
+ const o = (u, i) => {
2095
+ var m, y;
2096
+ const p = u.data.facets;
2097
+ e((v) => ({
2098
+ isSearchInProgress: !1,
2099
+ searchClientResponseItems: i,
2100
+ searchResponseTimeTaken: u.data.time_taken || 0,
2101
+ searchResultsPage: (
2102
+ // reset to first page when response count changes
2103
+ u.data.count === v.searchResultsCount ? v.searchResultsPage : 1
2104
+ ),
2105
+ searchResultsCount: u.data.count || 0
2106
+ })), p && e({ searchResponseFacetPrime: p }), (m = a.logger) == null || m.log(Re.DEBUG, `Search results: ${JSON.stringify(i)}`), (y = a.logger) == null || y.log(Re.DEBUG, `Facets from response: ${JSON.stringify(p)}`);
2107
+ }, n = (u) => {
2108
+ e({ adClientResponseItems: u });
2109
+ };
2110
+ a.core.getItems({
2111
+ searchTerm: a.searchTerm,
2112
+ mode: a.searchMode,
2113
+ sort: a.sortType,
2114
+ facetPathsForIndexFields: a.facetPathsForIndexFields,
2115
+ rangeValueForIndexFields: a.rangeValueForIndexFields,
2116
+ offset: a.searchResultsPerPage ? a.searchResultsPerPage * (a.searchResultsPage - 1) : 0,
2117
+ limit: a.searchResultsPerPage
2118
+ }, o, n);
2119
+ },
2120
+ setPopoverVisibility: (a) => {
2121
+ e({
2122
+ isPopoverVisible: a
2123
+ });
2124
+ },
2125
+ setSearchMode: (a) => e({ searchMode: a }),
2126
+ setSortType: (a) => e({ sortType: a }),
2127
+ setSearchTerm: (a) => {
2128
+ const { core: o } = t();
2129
+ a.length === 0 && (o == null || o.handleInputCleared()), e({
2130
+ searchTerm: a,
2131
+ facetPathsForIndexFields: {},
2132
+ ...a.trim().length === 0 && {
2133
+ searchMode: "fuzzy",
2134
+ sortType: "asc"
2135
+ }
2136
+ });
2137
+ },
2138
+ setSearchClientResponseItems: (a) => e({ searchClientResponseItems: a }),
2139
+ setSearchResultsPage: async (a) => {
2140
+ e({ searchResultsPage: a }), await r.search();
2141
+ },
2142
+ setSearchResultsPerPage: async (a) => {
2143
+ e({ searchResultsPerPage: a }), await r.search();
2144
+ }
2145
+ };
2146
+ return {
2147
+ ...Io,
2148
+ ...r
2149
+ };
2150
+ });
2151
+ var Mo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Bs = { exports: {} };
2152
+ /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
2153
+ (function(e, t) {
2154
+ (function(r, s) {
2155
+ e.exports = s();
2156
+ })(Mo, function() {
2157
+ const {
2158
+ entries: r,
2159
+ setPrototypeOf: s,
2160
+ isFrozen: a,
2161
+ getPrototypeOf: o,
2162
+ getOwnPropertyDescriptor: n
2163
+ } = Object;
2164
+ let {
2165
+ freeze: c,
2166
+ seal: f,
2167
+ create: u
2168
+ } = Object, {
2169
+ apply: i,
2170
+ construct: p
2171
+ } = typeof Reflect < "u" && Reflect;
2172
+ c || (c = function(S) {
2173
+ return S;
2174
+ }), f || (f = function(S) {
2175
+ return S;
2176
+ }), i || (i = function(S, P, C) {
2177
+ return S.apply(P, C);
2178
+ }), p || (p = function(S, P) {
2179
+ return new S(...P);
2180
+ });
2181
+ const m = V(Array.prototype.forEach), y = V(Array.prototype.lastIndexOf), v = V(Array.prototype.pop), x = V(Array.prototype.push), U = V(Array.prototype.splice), ee = V(String.prototype.toLowerCase), M = V(String.prototype.toString), Fe = V(String.prototype.match), De = V(String.prototype.replace), sa = V(String.prototype.indexOf), aa = V(String.prototype.trim), se = V(Object.prototype.hasOwnProperty), G = V(RegExp.prototype.test), Ne = na(TypeError);
2182
+ function V(k) {
2183
+ return function(S) {
2184
+ for (var P = arguments.length, C = new Array(P > 1 ? P - 1 : 0), j = 1; j < P; j++)
2185
+ C[j - 1] = arguments[j];
2186
+ return i(k, S, C);
2187
+ };
2188
+ }
2189
+ function na(k) {
2190
+ return function() {
2191
+ for (var S = arguments.length, P = new Array(S), C = 0; C < S; C++)
2192
+ P[C] = arguments[C];
2193
+ return p(k, P);
2194
+ };
2195
+ }
2196
+ function T(k, S) {
2197
+ let P = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ee;
2198
+ s && s(k, null);
2199
+ let C = S.length;
2200
+ for (; C--; ) {
2201
+ let j = S[C];
2202
+ if (typeof j == "string") {
2203
+ const ie = P(j);
2204
+ ie !== j && (a(S) || (S[C] = ie), j = ie);
2205
+ }
2206
+ k[j] = !0;
2207
+ }
2208
+ return k;
2209
+ }
2210
+ function oa(k) {
2211
+ for (let S = 0; S < k.length; S++)
2212
+ se(k, S) || (k[S] = null);
2213
+ return k;
2214
+ }
2215
+ function Se(k) {
2216
+ const S = u(null);
2217
+ for (const [P, C] of r(k))
2218
+ se(k, P) && (Array.isArray(C) ? S[P] = oa(C) : C && typeof C == "object" && C.constructor === Object ? S[P] = Se(C) : S[P] = C);
2219
+ return S;
2220
+ }
2221
+ function Ue(k, S) {
2222
+ for (; k !== null; ) {
2223
+ const C = n(k, S);
2224
+ if (C) {
2225
+ if (C.get)
2226
+ return V(C.get);
2227
+ if (typeof C.value == "function")
2228
+ return V(C.value);
2229
+ }
2230
+ k = o(k);
2231
+ }
2232
+ function P() {
2233
+ return null;
2234
+ }
2235
+ return P;
2236
+ }
2237
+ const hr = c(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Rt = c(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Tt = c(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), ca = c(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), kt = c(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), ia = c(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), pr = c(["#text"]), mr = c(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Ct = c(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), gr = c(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Je = c(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), la = f(/\{\{[\w\W]*|[\w\W]*\}\}/gm), ua = f(/<%[\w\W]*|[\w\W]*%>/gm), fa = f(/\$\{[\w\W]*/gm), da = f(/^data-[\-\w.\u00B7-\uFFFF]+$/), ha = f(/^aria-[\-\w]+$/), vr = f(
2238
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
2239
+ // eslint-disable-line no-useless-escape
2240
+ ), pa = f(/^(?:\w+script|data):/i), ma = f(
2241
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
2242
+ // eslint-disable-line no-control-regex
2243
+ ), br = f(/^html$/i), ga = f(/^[a-z][.\w]*(-[.\w]+)+$/i);
2244
+ var yr = /* @__PURE__ */ Object.freeze({
2245
+ __proto__: null,
2246
+ ARIA_ATTR: ha,
2247
+ ATTR_WHITESPACE: ma,
2248
+ CUSTOM_ELEMENT: ga,
2249
+ DATA_ATTR: da,
2250
+ DOCTYPE_NAME: br,
2251
+ ERB_EXPR: ua,
2252
+ IS_ALLOWED_URI: vr,
2253
+ IS_SCRIPT_OR_DATA: pa,
2254
+ MUSTACHE_EXPR: la,
2255
+ TMPLIT_EXPR: fa
2256
+ });
2257
+ const ze = {
2258
+ element: 1,
2259
+ attribute: 2,
2260
+ text: 3,
2261
+ cdataSection: 4,
2262
+ entityReference: 5,
2263
+ // Deprecated
2264
+ entityNode: 6,
2265
+ // Deprecated
2266
+ progressingInstruction: 7,
2267
+ comment: 8,
2268
+ document: 9,
2269
+ documentType: 10,
2270
+ documentFragment: 11,
2271
+ notation: 12
2272
+ // Deprecated
2273
+ }, va = function() {
2274
+ return typeof window > "u" ? null : window;
2275
+ }, ba = function(S, P) {
2276
+ if (typeof S != "object" || typeof S.createPolicy != "function")
2277
+ return null;
2278
+ let C = null;
2279
+ const j = "data-tt-policy-suffix";
2280
+ P && P.hasAttribute(j) && (C = P.getAttribute(j));
2281
+ const ie = "dompurify" + (C ? "#" + C : "");
2282
+ try {
2283
+ return S.createPolicy(ie, {
2284
+ createHTML(Te) {
2285
+ return Te;
2286
+ },
2287
+ createScriptURL(Te) {
2288
+ return Te;
2289
+ }
2290
+ });
2291
+ } catch {
2292
+ return console.warn("TrustedTypes policy " + ie + " could not be created."), null;
2293
+ }
2294
+ }, Sr = function() {
2295
+ return {
2296
+ afterSanitizeAttributes: [],
2297
+ afterSanitizeElements: [],
2298
+ afterSanitizeShadowDOM: [],
2299
+ beforeSanitizeAttributes: [],
2300
+ beforeSanitizeElements: [],
2301
+ beforeSanitizeShadowDOM: [],
2302
+ uponSanitizeAttribute: [],
2303
+ uponSanitizeElement: [],
2304
+ uponSanitizeShadowNode: []
2305
+ };
2306
+ };
2307
+ function wr() {
2308
+ let k = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : va();
2309
+ const S = (w) => wr(w);
2310
+ if (S.version = "3.2.4", S.removed = [], !k || !k.document || k.document.nodeType !== ze.document || !k.Element)
2311
+ return S.isSupported = !1, S;
2312
+ let {
2313
+ document: P
2314
+ } = k;
2315
+ const C = P, j = C.currentScript, {
2316
+ DocumentFragment: ie,
2317
+ HTMLTemplateElement: Te,
2318
+ Node: Pt,
2319
+ Element: Er,
2320
+ NodeFilter: He,
2321
+ NamedNodeMap: Sa = k.NamedNodeMap || k.MozNamedAttrMap,
2322
+ HTMLFormElement: wa,
2323
+ DOMParser: Ea,
2324
+ trustedTypes: et
2325
+ } = k, je = Er.prototype, Ra = Ue(je, "cloneNode"), Ta = Ue(je, "remove"), ka = Ue(je, "nextSibling"), Ca = Ue(je, "childNodes"), tt = Ue(je, "parentNode");
2326
+ if (typeof Te == "function") {
2327
+ const w = P.createElement("template");
2328
+ w.content && w.content.ownerDocument && (P = w.content.ownerDocument);
2329
+ }
2330
+ let q, Be = "";
2331
+ const {
2332
+ implementation: xt,
2333
+ createNodeIterator: Pa,
2334
+ createDocumentFragment: xa,
2335
+ getElementsByTagName: $a
2336
+ } = P, {
2337
+ importNode: _a
2338
+ } = C;
2339
+ let Y = Sr();
2340
+ S.isSupported = typeof r == "function" && typeof tt == "function" && xt && xt.createHTMLDocument !== void 0;
2341
+ const {
2342
+ MUSTACHE_EXPR: $t,
2343
+ ERB_EXPR: _t,
2344
+ TMPLIT_EXPR: At,
2345
+ DATA_ATTR: Aa,
2346
+ ARIA_ATTR: Ia,
2347
+ IS_SCRIPT_OR_DATA: Ma,
2348
+ ATTR_WHITESPACE: Rr,
2349
+ CUSTOM_ELEMENT: La
2350
+ } = yr;
2351
+ let {
2352
+ IS_ALLOWED_URI: Tr
2353
+ } = yr, D = null;
2354
+ const kr = T({}, [...hr, ...Rt, ...Tt, ...kt, ...pr]);
2355
+ let z = null;
2356
+ const Cr = T({}, [...mr, ...Ct, ...gr, ...Je]);
2357
+ let L = Object.seal(u(null, {
2358
+ tagNameCheck: {
2359
+ writable: !0,
2360
+ configurable: !1,
2361
+ enumerable: !0,
2362
+ value: null
2363
+ },
2364
+ attributeNameCheck: {
2365
+ writable: !0,
2366
+ configurable: !1,
2367
+ enumerable: !0,
2368
+ value: null
2369
+ },
2370
+ allowCustomizedBuiltInElements: {
2371
+ writable: !0,
2372
+ configurable: !1,
2373
+ enumerable: !0,
2374
+ value: !1
2375
+ }
2376
+ })), We = null, It = null, Pr = !0, Mt = !0, xr = !1, $r = !0, ke = !1, Lt = !0, we = !1, Ot = !1, Ft = !1, Ce = !1, rt = !1, st = !1, _r = !0, Ar = !1;
2377
+ const Oa = "user-content-";
2378
+ let Dt = !0, Ge = !1, Pe = {}, xe = null;
2379
+ const Ir = T({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
2380
+ let Mr = null;
2381
+ const Lr = T({}, ["audio", "video", "img", "source", "image", "track"]);
2382
+ let Nt = null;
2383
+ const Or = T({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), at = "http://www.w3.org/1998/Math/MathML", nt = "http://www.w3.org/2000/svg", le = "http://www.w3.org/1999/xhtml";
2384
+ let $e = le, Ut = !1, zt = null;
2385
+ const Fa = T({}, [at, nt, le], M);
2386
+ let ot = T({}, ["mi", "mo", "mn", "ms", "mtext"]), ct = T({}, ["annotation-xml"]);
2387
+ const Da = T({}, ["title", "style", "font", "a", "script"]);
2388
+ let Ve = null;
2389
+ const Na = ["application/xhtml+xml", "text/html"], Ua = "text/html";
2390
+ let N = null, _e = null;
2391
+ const za = P.createElement("form"), Fr = function(l) {
2392
+ return l instanceof RegExp || l instanceof Function;
2393
+ }, Ht = function() {
2394
+ let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2395
+ if (!(_e && _e === l)) {
2396
+ if ((!l || typeof l != "object") && (l = {}), l = Se(l), Ve = // eslint-disable-next-line unicorn/prefer-includes
2397
+ Na.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? Ua : l.PARSER_MEDIA_TYPE, N = Ve === "application/xhtml+xml" ? M : ee, D = se(l, "ALLOWED_TAGS") ? T({}, l.ALLOWED_TAGS, N) : kr, z = se(l, "ALLOWED_ATTR") ? T({}, l.ALLOWED_ATTR, N) : Cr, zt = se(l, "ALLOWED_NAMESPACES") ? T({}, l.ALLOWED_NAMESPACES, M) : Fa, Nt = se(l, "ADD_URI_SAFE_ATTR") ? T(Se(Or), l.ADD_URI_SAFE_ATTR, N) : Or, Mr = se(l, "ADD_DATA_URI_TAGS") ? T(Se(Lr), l.ADD_DATA_URI_TAGS, N) : Lr, xe = se(l, "FORBID_CONTENTS") ? T({}, l.FORBID_CONTENTS, N) : Ir, We = se(l, "FORBID_TAGS") ? T({}, l.FORBID_TAGS, N) : {}, It = se(l, "FORBID_ATTR") ? T({}, l.FORBID_ATTR, N) : {}, Pe = se(l, "USE_PROFILES") ? l.USE_PROFILES : !1, Pr = l.ALLOW_ARIA_ATTR !== !1, Mt = l.ALLOW_DATA_ATTR !== !1, xr = l.ALLOW_UNKNOWN_PROTOCOLS || !1, $r = l.ALLOW_SELF_CLOSE_IN_ATTR !== !1, ke = l.SAFE_FOR_TEMPLATES || !1, Lt = l.SAFE_FOR_XML !== !1, we = l.WHOLE_DOCUMENT || !1, Ce = l.RETURN_DOM || !1, rt = l.RETURN_DOM_FRAGMENT || !1, st = l.RETURN_TRUSTED_TYPE || !1, Ft = l.FORCE_BODY || !1, _r = l.SANITIZE_DOM !== !1, Ar = l.SANITIZE_NAMED_PROPS || !1, Dt = l.KEEP_CONTENT !== !1, Ge = l.IN_PLACE || !1, Tr = l.ALLOWED_URI_REGEXP || vr, $e = l.NAMESPACE || le, ot = l.MATHML_TEXT_INTEGRATION_POINTS || ot, ct = l.HTML_INTEGRATION_POINTS || ct, L = l.CUSTOM_ELEMENT_HANDLING || {}, l.CUSTOM_ELEMENT_HANDLING && Fr(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (L.tagNameCheck = l.CUSTOM_ELEMENT_HANDLING.tagNameCheck), l.CUSTOM_ELEMENT_HANDLING && Fr(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (L.attributeNameCheck = l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), l.CUSTOM_ELEMENT_HANDLING && typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (L.allowCustomizedBuiltInElements = l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), ke && (Mt = !1), rt && (Ce = !0), Pe && (D = T({}, pr), z = [], Pe.html === !0 && (T(D, hr), T(z, mr)), Pe.svg === !0 && (T(D, Rt), T(z, Ct), T(z, Je)), Pe.svgFilters === !0 && (T(D, Tt), T(z, Ct), T(z, Je)), Pe.mathMl === !0 && (T(D, kt), T(z, gr), T(z, Je))), l.ADD_TAGS && (D === kr && (D = Se(D)), T(D, l.ADD_TAGS, N)), l.ADD_ATTR && (z === Cr && (z = Se(z)), T(z, l.ADD_ATTR, N)), l.ADD_URI_SAFE_ATTR && T(Nt, l.ADD_URI_SAFE_ATTR, N), l.FORBID_CONTENTS && (xe === Ir && (xe = Se(xe)), T(xe, l.FORBID_CONTENTS, N)), Dt && (D["#text"] = !0), we && T(D, ["html", "head", "body"]), D.table && (T(D, ["tbody"]), delete We.tbody), l.TRUSTED_TYPES_POLICY) {
2398
+ if (typeof l.TRUSTED_TYPES_POLICY.createHTML != "function")
2399
+ throw Ne('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
2400
+ if (typeof l.TRUSTED_TYPES_POLICY.createScriptURL != "function")
2401
+ throw Ne('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
2402
+ q = l.TRUSTED_TYPES_POLICY, Be = q.createHTML("");
2403
+ } else
2404
+ q === void 0 && (q = ba(et, j)), q !== null && typeof Be == "string" && (Be = q.createHTML(""));
2405
+ c && c(l), _e = l;
2406
+ }
2407
+ }, Dr = T({}, [...Rt, ...Tt, ...ca]), Nr = T({}, [...kt, ...ia]), Ha = function(l) {
2408
+ let g = tt(l);
2409
+ (!g || !g.tagName) && (g = {
2410
+ namespaceURI: $e,
2411
+ tagName: "template"
2412
+ });
2413
+ const b = ee(l.tagName), _ = ee(g.tagName);
2414
+ return zt[l.namespaceURI] ? l.namespaceURI === nt ? g.namespaceURI === le ? b === "svg" : g.namespaceURI === at ? b === "svg" && (_ === "annotation-xml" || ot[_]) : !!Dr[b] : l.namespaceURI === at ? g.namespaceURI === le ? b === "math" : g.namespaceURI === nt ? b === "math" && ct[_] : !!Nr[b] : l.namespaceURI === le ? g.namespaceURI === nt && !ct[_] || g.namespaceURI === at && !ot[_] ? !1 : !Nr[b] && (Da[b] || !Dr[b]) : !!(Ve === "application/xhtml+xml" && zt[l.namespaceURI]) : !1;
2415
+ }, oe = function(l) {
2416
+ x(S.removed, {
2417
+ element: l
2418
+ });
2419
+ try {
2420
+ tt(l).removeChild(l);
2421
+ } catch {
2422
+ Ta(l);
2423
+ }
2424
+ }, it = function(l, g) {
2425
+ try {
2426
+ x(S.removed, {
2427
+ attribute: g.getAttributeNode(l),
2428
+ from: g
2429
+ });
2430
+ } catch {
2431
+ x(S.removed, {
2432
+ attribute: null,
2433
+ from: g
2434
+ });
2435
+ }
2436
+ if (g.removeAttribute(l), l === "is")
2437
+ if (Ce || rt)
2438
+ try {
2439
+ oe(g);
2440
+ } catch {
2441
+ }
2442
+ else
2443
+ try {
2444
+ g.setAttribute(l, "");
2445
+ } catch {
2446
+ }
2447
+ }, Ur = function(l) {
2448
+ let g = null, b = null;
2449
+ if (Ft)
2450
+ l = "<remove></remove>" + l;
2451
+ else {
2452
+ const H = Fe(l, /^[\r\n\t ]+/);
2453
+ b = H && H[0];
2454
+ }
2455
+ Ve === "application/xhtml+xml" && $e === le && (l = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + l + "</body></html>");
2456
+ const _ = q ? q.createHTML(l) : l;
2457
+ if ($e === le)
2458
+ try {
2459
+ g = new Ea().parseFromString(_, Ve);
2460
+ } catch {
2461
+ }
2462
+ if (!g || !g.documentElement) {
2463
+ g = xt.createDocument($e, "template", null);
2464
+ try {
2465
+ g.documentElement.innerHTML = Ut ? Be : _;
2466
+ } catch {
2467
+ }
2468
+ }
2469
+ const B = g.body || g.documentElement;
2470
+ return l && b && B.insertBefore(P.createTextNode(b), B.childNodes[0] || null), $e === le ? $a.call(g, we ? "html" : "body")[0] : we ? g.documentElement : B;
2471
+ }, zr = function(l) {
2472
+ return Pa.call(
2473
+ l.ownerDocument || l,
2474
+ l,
2475
+ // eslint-disable-next-line no-bitwise
2476
+ He.SHOW_ELEMENT | He.SHOW_COMMENT | He.SHOW_TEXT | He.SHOW_PROCESSING_INSTRUCTION | He.SHOW_CDATA_SECTION,
2477
+ null
2478
+ );
2479
+ }, jt = function(l) {
2480
+ return l instanceof wa && (typeof l.nodeName != "string" || typeof l.textContent != "string" || typeof l.removeChild != "function" || !(l.attributes instanceof Sa) || typeof l.removeAttribute != "function" || typeof l.setAttribute != "function" || typeof l.namespaceURI != "string" || typeof l.insertBefore != "function" || typeof l.hasChildNodes != "function");
2481
+ }, Hr = function(l) {
2482
+ return typeof Pt == "function" && l instanceof Pt;
2483
+ };
2484
+ function ue(w, l, g) {
2485
+ m(w, (b) => {
2486
+ b.call(S, l, g, _e);
2487
+ });
2488
+ }
2489
+ const jr = function(l) {
2490
+ let g = null;
2491
+ if (ue(Y.beforeSanitizeElements, l, null), jt(l))
2492
+ return oe(l), !0;
2493
+ const b = N(l.nodeName);
2494
+ if (ue(Y.uponSanitizeElement, l, {
2495
+ tagName: b,
2496
+ allowedTags: D
2497
+ }), l.hasChildNodes() && !Hr(l.firstElementChild) && G(/<[/\w]/g, l.innerHTML) && G(/<[/\w]/g, l.textContent) || l.nodeType === ze.progressingInstruction || Lt && l.nodeType === ze.comment && G(/<[/\w]/g, l.data))
2498
+ return oe(l), !0;
2499
+ if (!D[b] || We[b]) {
2500
+ if (!We[b] && Wr(b) && (L.tagNameCheck instanceof RegExp && G(L.tagNameCheck, b) || L.tagNameCheck instanceof Function && L.tagNameCheck(b)))
2501
+ return !1;
2502
+ if (Dt && !xe[b]) {
2503
+ const _ = tt(l) || l.parentNode, B = Ca(l) || l.childNodes;
2504
+ if (B && _) {
2505
+ const H = B.length;
2506
+ for (let Z = H - 1; Z >= 0; --Z) {
2507
+ const ce = Ra(B[Z], !0);
2508
+ ce.__removalCount = (l.__removalCount || 0) + 1, _.insertBefore(ce, ka(l));
2509
+ }
2510
+ }
2511
+ }
2512
+ return oe(l), !0;
2513
+ }
2514
+ return l instanceof Er && !Ha(l) || (b === "noscript" || b === "noembed" || b === "noframes") && G(/<\/no(script|embed|frames)/i, l.innerHTML) ? (oe(l), !0) : (ke && l.nodeType === ze.text && (g = l.textContent, m([$t, _t, At], (_) => {
2515
+ g = De(g, _, " ");
2516
+ }), l.textContent !== g && (x(S.removed, {
2517
+ element: l.cloneNode()
2518
+ }), l.textContent = g)), ue(Y.afterSanitizeElements, l, null), !1);
2519
+ }, Br = function(l, g, b) {
2520
+ if (_r && (g === "id" || g === "name") && (b in P || b in za))
2521
+ return !1;
2522
+ if (!(Mt && !It[g] && G(Aa, g))) {
2523
+ if (!(Pr && G(Ia, g))) {
2524
+ if (!z[g] || It[g]) {
2525
+ if (
2526
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
2527
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2528
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
2529
+ !(Wr(l) && (L.tagNameCheck instanceof RegExp && G(L.tagNameCheck, l) || L.tagNameCheck instanceof Function && L.tagNameCheck(l)) && (L.attributeNameCheck instanceof RegExp && G(L.attributeNameCheck, g) || L.attributeNameCheck instanceof Function && L.attributeNameCheck(g)) || // Alternative, second condition checks if it's an `is`-attribute, AND
2530
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2531
+ g === "is" && L.allowCustomizedBuiltInElements && (L.tagNameCheck instanceof RegExp && G(L.tagNameCheck, b) || L.tagNameCheck instanceof Function && L.tagNameCheck(b)))
2532
+ ) return !1;
2533
+ } else if (!Nt[g]) {
2534
+ if (!G(Tr, De(b, Rr, ""))) {
2535
+ if (!((g === "src" || g === "xlink:href" || g === "href") && l !== "script" && sa(b, "data:") === 0 && Mr[l])) {
2536
+ if (!(xr && !G(Ma, De(b, Rr, "")))) {
2537
+ if (b)
2538
+ return !1;
2539
+ }
2540
+ }
2541
+ }
2542
+ }
2543
+ }
2544
+ }
2545
+ return !0;
2546
+ }, Wr = function(l) {
2547
+ return l !== "annotation-xml" && Fe(l, La);
2548
+ }, Gr = function(l) {
2549
+ ue(Y.beforeSanitizeAttributes, l, null);
2550
+ const {
2551
+ attributes: g
2552
+ } = l;
2553
+ if (!g || jt(l))
2554
+ return;
2555
+ const b = {
2556
+ attrName: "",
2557
+ attrValue: "",
2558
+ keepAttr: !0,
2559
+ allowedAttributes: z,
2560
+ forceKeepAttr: void 0
2561
+ };
2562
+ let _ = g.length;
2563
+ for (; _--; ) {
2564
+ const B = g[_], {
2565
+ name: H,
2566
+ namespaceURI: Z,
2567
+ value: ce
2568
+ } = B, qe = N(H);
2569
+ let Q = H === "value" ? ce : aa(ce);
2570
+ if (b.attrName = qe, b.attrValue = Q, b.keepAttr = !0, b.forceKeepAttr = void 0, ue(Y.uponSanitizeAttribute, l, b), Q = b.attrValue, Ar && (qe === "id" || qe === "name") && (it(H, l), Q = Oa + Q), Lt && G(/((--!?|])>)|<\/(style|title)/i, Q)) {
2571
+ it(H, l);
2572
+ continue;
2573
+ }
2574
+ if (b.forceKeepAttr || (it(H, l), !b.keepAttr))
2575
+ continue;
2576
+ if (!$r && G(/\/>/i, Q)) {
2577
+ it(H, l);
2578
+ continue;
2579
+ }
2580
+ ke && m([$t, _t, At], (qr) => {
2581
+ Q = De(Q, qr, " ");
2582
+ });
2583
+ const Vr = N(l.nodeName);
2584
+ if (Br(Vr, qe, Q)) {
2585
+ if (q && typeof et == "object" && typeof et.getAttributeType == "function" && !Z)
2586
+ switch (et.getAttributeType(Vr, qe)) {
2587
+ case "TrustedHTML": {
2588
+ Q = q.createHTML(Q);
2589
+ break;
2590
+ }
2591
+ case "TrustedScriptURL": {
2592
+ Q = q.createScriptURL(Q);
2593
+ break;
2594
+ }
2595
+ }
2596
+ try {
2597
+ Z ? l.setAttributeNS(Z, H, Q) : l.setAttribute(H, Q), jt(l) ? oe(l) : v(S.removed);
2598
+ } catch {
2599
+ }
2600
+ }
2601
+ }
2602
+ ue(Y.afterSanitizeAttributes, l, null);
2603
+ }, ja = function w(l) {
2604
+ let g = null;
2605
+ const b = zr(l);
2606
+ for (ue(Y.beforeSanitizeShadowDOM, l, null); g = b.nextNode(); )
2607
+ ue(Y.uponSanitizeShadowNode, g, null), jr(g), Gr(g), g.content instanceof ie && w(g.content);
2608
+ ue(Y.afterSanitizeShadowDOM, l, null);
2609
+ };
2610
+ return S.sanitize = function(w) {
2611
+ let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = null, b = null, _ = null, B = null;
2612
+ if (Ut = !w, Ut && (w = "<!-->"), typeof w != "string" && !Hr(w))
2613
+ if (typeof w.toString == "function") {
2614
+ if (w = w.toString(), typeof w != "string")
2615
+ throw Ne("dirty is not a string, aborting");
2616
+ } else
2617
+ throw Ne("toString is not a function");
2618
+ if (!S.isSupported)
2619
+ return w;
2620
+ if (Ot || Ht(l), S.removed = [], typeof w == "string" && (Ge = !1), Ge) {
2621
+ if (w.nodeName) {
2622
+ const ce = N(w.nodeName);
2623
+ if (!D[ce] || We[ce])
2624
+ throw Ne("root node is forbidden and cannot be sanitized in-place");
2625
+ }
2626
+ } else if (w instanceof Pt)
2627
+ g = Ur("<!---->"), b = g.ownerDocument.importNode(w, !0), b.nodeType === ze.element && b.nodeName === "BODY" || b.nodeName === "HTML" ? g = b : g.appendChild(b);
2628
+ else {
2629
+ if (!Ce && !ke && !we && // eslint-disable-next-line unicorn/prefer-includes
2630
+ w.indexOf("<") === -1)
2631
+ return q && st ? q.createHTML(w) : w;
2632
+ if (g = Ur(w), !g)
2633
+ return Ce ? null : st ? Be : "";
2634
+ }
2635
+ g && Ft && oe(g.firstChild);
2636
+ const H = zr(Ge ? w : g);
2637
+ for (; _ = H.nextNode(); )
2638
+ jr(_), Gr(_), _.content instanceof ie && ja(_.content);
2639
+ if (Ge)
2640
+ return w;
2641
+ if (Ce) {
2642
+ if (rt)
2643
+ for (B = xa.call(g.ownerDocument); g.firstChild; )
2644
+ B.appendChild(g.firstChild);
2645
+ else
2646
+ B = g;
2647
+ return (z.shadowroot || z.shadowrootmode) && (B = _a.call(C, B, !0)), B;
2648
+ }
2649
+ let Z = we ? g.outerHTML : g.innerHTML;
2650
+ return we && D["!doctype"] && g.ownerDocument && g.ownerDocument.doctype && g.ownerDocument.doctype.name && G(br, g.ownerDocument.doctype.name) && (Z = "<!DOCTYPE " + g.ownerDocument.doctype.name + `>
2651
+ ` + Z), ke && m([$t, _t, At], (ce) => {
2652
+ Z = De(Z, ce, " ");
2653
+ }), q && st ? q.createHTML(Z) : Z;
2654
+ }, S.setConfig = function() {
2655
+ let w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2656
+ Ht(w), Ot = !0;
2657
+ }, S.clearConfig = function() {
2658
+ _e = null, Ot = !1;
2659
+ }, S.isValidAttribute = function(w, l, g) {
2660
+ _e || Ht({});
2661
+ const b = N(w), _ = N(l);
2662
+ return Br(b, _, g);
2663
+ }, S.addHook = function(w, l) {
2664
+ typeof l == "function" && x(Y[w], l);
2665
+ }, S.removeHook = function(w, l) {
2666
+ if (l !== void 0) {
2667
+ const g = y(Y[w], l);
2668
+ return g === -1 ? void 0 : U(Y[w], g, 1)[0];
2669
+ }
2670
+ return v(Y[w]);
2671
+ }, S.removeHooks = function(w) {
2672
+ Y[w] = [];
2673
+ }, S.removeAllHooks = function() {
2674
+ Y = Sr();
2675
+ }, S;
2676
+ }
2677
+ var ya = wr();
2678
+ return ya;
2679
+ });
2680
+ })(Bs);
2681
+ const Lo = Bs.exports, ur = (e, ...t) => {
2682
+ let r = e[0];
2683
+ for (let s = 0; s < t.length; s++)
2684
+ r += Lo.sanitize(t[s] ? String(t[s]) : "") + e[s + 1];
2685
+ return r || "";
2686
+ }, Oo = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2687
+ let X = (e = 21) => {
2688
+ let t = "", r = crypto.getRandomValues(new Uint8Array(e |= 0));
2689
+ for (; e--; )
2690
+ t += Oo[r[e] & 63];
2691
+ return t;
2692
+ };
2693
+ const Fo = /* @__PURE__ */ F(class extends O {
2694
+ constructor() {
2695
+ super();
2696
+ h(this, "adSource", "Custom");
2697
+ h(this, "adClientResponseItem");
2698
+ h(this, "adContainerId", X());
2699
+ h(this, "searchTerm");
2700
+ h(this, "isSearchInProgress", !1);
2701
+ h(this, "core");
2702
+ h(this, "intersectionObserver");
2703
+ h(this, "storeUnsubscribe");
2704
+ h(this, "adContainerRenderedTimeout");
2705
+ h(this, "isComponentConnected", !0);
2706
+ this.__registerHost();
2707
+ }
2708
+ get hostElement() {
2709
+ return this;
2710
+ }
2711
+ connectedCallback() {
2712
+ const r = $.getState();
2713
+ this.core = r.core, this.searchTerm = r.searchTerm, this.isSearchInProgress = r.isSearchInProgress, this.storeUnsubscribe = $.subscribe((s) => {
2714
+ this.searchTerm = s.searchTerm, this.isSearchInProgress = s.isSearchInProgress;
2715
+ });
2716
+ }
2717
+ componentDidLoad() {
2718
+ this.hostElement && (this.intersectionObserver = new IntersectionObserver(([r]) => {
2719
+ var s;
2720
+ r != null && r.isIntersecting && !this.isSearchInProgress && ((s = this.core) == null || s.handleAdContainerViewed({
2721
+ adClientResponseItem: this.adClientResponseItem,
2722
+ adContainerId: this.adContainerId,
2723
+ adSource: this.adSource,
2724
+ searchTerm: this.searchTerm || ""
2725
+ }));
2726
+ }, { threshold: 0 }), this.intersectionObserver.observe(this.hostElement));
2727
+ }
2728
+ disconnectedCallback() {
2729
+ var r, s;
2730
+ (r = this.storeUnsubscribe) == null || r.call(this), (s = this.intersectionObserver) == null || s.disconnect(), this.isComponentConnected = !1, clearTimeout(this.adContainerRenderedTimeout);
2731
+ }
2732
+ renderADMAd() {
2733
+ const r = this.adClientResponseItem;
2734
+ if (r.admAd)
2735
+ return d("a", { class: "searchcraft-adm-ad", href: r.admAd.click_url }, r.admAd.image_url && d("div", { class: "searchcraft-adm-ad-image-wrapper" }, d("img", { alt: r.admAd.term || "image", src: r.admAd.image_url, class: "searchcraft-adm-ad-image" })), d("div", { class: "searchcraft-adm-ad-info-wrapper" }, d("p", { class: "searchcraft-adm-ad-title" }, r.admAd.term), r.admAd.price && d("p", { class: "searchcraft-adm-ad-subtitle" }, r.admAd.price)));
2736
+ }
2737
+ renderCustomAd() {
2738
+ var o, n;
2739
+ const r = (n = (o = this.core) == null ? void 0 : o.config) == null ? void 0 : n.customAdTemplate, s = `searchcraft-custom-ad-${this.adContainerId}`;
2740
+ let a = "<p>Custom Ad Placeholder</p>";
2741
+ return r && (a = r({
2742
+ searchTerm: this.searchTerm || "",
2743
+ adContainerId: this.adContainerId
2744
+ }, { html: ur })), d("div", { class: "searchcraft-custom-ad", id: s, "data-searchcraft-ad-container-id": this.adContainerId, innerHTML: a });
2745
+ }
2746
+ renderNativoAd() {
2747
+ var s;
2748
+ const r = ((s = this.core) == null ? void 0 : s.config.nativoAdClassName) || "ntv-item";
2749
+ return d("div", { class: r });
2750
+ }
2751
+ render() {
2752
+ var r, s;
2753
+ if (!this.isSearchInProgress)
2754
+ switch (this.isComponentConnected && (clearTimeout(this.adContainerRenderedTimeout), this.adContainerRenderedTimeout = setTimeout(() => {
2755
+ var a;
2756
+ (a = this.core) == null || a.handleAdContainerRendered({
2757
+ adClientResponseItem: this.adClientResponseItem,
2758
+ adContainerId: this.adContainerId,
2759
+ adSource: this.adSource,
2760
+ searchTerm: this.searchTerm || ""
2761
+ });
2762
+ }, ((s = (r = this.core) == null ? void 0 : r.config) == null ? void 0 : s.adContainerRenderedDebounceDelay) || 500)), this.adSource) {
2763
+ case "adMarketplace":
2764
+ return this.renderADMAd();
2765
+ case "Custom":
2766
+ return this.renderCustomAd();
2767
+ case "Nativo":
2768
+ return this.renderNativoAd();
2769
+ default:
2770
+ return;
2771
+ }
2772
+ }
2773
+ }, [0, "searchcraft-ad", {
2774
+ adSource: [1, "ad-source"],
2775
+ adClientResponseItem: [16],
2776
+ adContainerId: [1, "ad-container-id"],
2777
+ searchTerm: [32],
2778
+ isSearchInProgress: [32]
2779
+ }]);
2780
+ function St() {
2781
+ if (typeof customElements > "u")
2782
+ return;
2783
+ ["searchcraft-ad"].forEach((t) => {
2784
+ switch (t) {
2785
+ case "searchcraft-ad":
2786
+ customElements.get(t) || customElements.define(t, Fo);
2787
+ break;
2788
+ }
2789
+ });
2790
+ }
2791
+ const Do = St;
2792
+ var Ws = { exports: {} };
2793
+ /*!
2794
+ Copyright (c) 2018 Jed Watson.
2795
+ Licensed under the MIT License (MIT), see
2796
+ http://jedwatson.github.io/classnames
2797
+ */
2798
+ (function(e) {
2799
+ (function() {
2800
+ var t = {}.hasOwnProperty;
2801
+ function r() {
2802
+ for (var o = "", n = 0; n < arguments.length; n++) {
2803
+ var c = arguments[n];
2804
+ c && (o = a(o, s(c)));
2805
+ }
2806
+ return o;
2807
+ }
2808
+ function s(o) {
2809
+ if (typeof o == "string" || typeof o == "number")
2810
+ return o;
2811
+ if (typeof o != "object")
2812
+ return "";
2813
+ if (Array.isArray(o))
2814
+ return r.apply(null, o);
2815
+ if (o.toString !== Object.prototype.toString && !o.toString.toString().includes("[native code]"))
2816
+ return o.toString();
2817
+ var n = "";
2818
+ for (var c in o)
2819
+ t.call(o, c) && o[c] && (n = a(n, c));
2820
+ return n;
2821
+ }
2822
+ function a(o, n) {
2823
+ return n ? o ? o + " " + n : o + n : o;
2824
+ }
2825
+ e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
2826
+ })();
2827
+ })(Ws);
2828
+ const ne = Ws.exports, No = /* @__PURE__ */ F(class extends O {
2829
+ constructor() {
2830
+ super();
2831
+ /**
2832
+ * Controls the visual representation of the button.
2833
+ */
2834
+ h(this, "hierarchy", "primary");
2835
+ /**
2836
+ * Whether the button is disabled.
2837
+ */
2838
+ h(this, "disabled", !1);
2839
+ /**
2840
+ * The icon element.
2841
+ */
2842
+ h(this, "icon");
2843
+ /**
2844
+ * Should the button only display an icon.
2845
+ */
2846
+ h(this, "iconOnly", !1);
2847
+ /**
2848
+ * The position of the icon.
2849
+ */
2850
+ h(this, "iconPosition", "left");
2851
+ /**
2852
+ * The label for the button.
2853
+ */
2854
+ h(this, "label", "Search");
2855
+ /**
2856
+ * The type of the button.
2857
+ */
2858
+ h(this, "type", "button");
2859
+ /**
2860
+ * The event fired when the button is clicked.
2861
+ */
2862
+ h(this, "buttonClick");
2863
+ h(this, "handleButtonClick", () => {
2864
+ this.buttonClick.emit();
2865
+ });
2866
+ this.__registerHost(), this.buttonClick = ve(this, "buttonClick");
2867
+ }
2868
+ render() {
2869
+ return d("button", { key: "e54b4566e0286265bc0c8b6bb4e9ef26108575da", "aria-label": this.label, class: ne("searchcraft-button", {
2870
+ "searchcraft-button-primary": this.hierarchy === "primary",
2871
+ "searchcraft-button-tertiary": this.hierarchy === "tertiary",
2872
+ "searchcraft-button-disabled": this.disabled
2873
+ }), disabled: this.disabled, onClick: this.handleButtonClick, type: this.type }, this.iconOnly ? this.icon : d(_s, null, this.iconPosition === "left" && this.icon, d("span", null, this.label), this.iconPosition === "right" && this.icon));
2874
+ }
2875
+ }, [0, "searchcraft-button", {
2876
+ hierarchy: [1],
2877
+ disabled: [4],
2878
+ icon: [16],
2879
+ iconOnly: [4, "icon-only"],
2880
+ iconPosition: [1, "icon-position"],
2881
+ label: [1],
2882
+ type: [1]
2883
+ }]);
2884
+ function wt() {
2885
+ if (typeof customElements > "u")
2886
+ return;
2887
+ ["searchcraft-button"].forEach((t) => {
2888
+ switch (t) {
2889
+ case "searchcraft-button":
2890
+ customElements.get(t) || customElements.define(t, No);
2891
+ break;
2892
+ }
2893
+ });
2894
+ }
2895
+ const Uo = wt, zo = /* @__PURE__ */ F(class extends O {
2896
+ constructor() {
2897
+ super(), this.__registerHost();
2898
+ }
2899
+ render() {
2900
+ return d("div", { key: "d42f7abf8dfb2620622b8012d868d32f04b2f354", class: "searchcraft-error-message" }, d("slot", { key: "75a7811576ea8afe80a7ae739f5cf2d411f976df" }, "Search term is required."));
2901
+ }
2902
+ }, [4, "searchcraft-error-message"]);
2903
+ function Et() {
2904
+ if (typeof customElements > "u")
2905
+ return;
2906
+ ["searchcraft-error-message"].forEach((t) => {
2907
+ switch (t) {
2908
+ case "searchcraft-error-message":
2909
+ customElements.get(t) || customElements.define(t, zo);
2910
+ break;
2911
+ }
2912
+ });
2913
+ }
2914
+ const Ho = Et;
2915
+ function Gs(e, t) {
2916
+ const r = { ...e };
2917
+ for (const s in t)
2918
+ t.hasOwnProperty(s) && (t[s] instanceof Object && e[s] instanceof Object ? r[s] = Gs(e[s], t[s]) : r[s] = t[s]);
2919
+ return r;
2920
+ }
2921
+ function jo(e) {
2922
+ return e.filter((t, r, s) => !s.some((a, o) => o !== r && a.includes(t)));
2923
+ }
2924
+ function ps(e) {
2925
+ const t = {}, r = (s) => {
2926
+ var a;
2927
+ t[s.path] = {
2928
+ count: s.count,
2929
+ path: s.path
2930
+ }, (a = s.children) == null || a.forEach((o) => {
2931
+ r(o);
2932
+ });
2933
+ };
2934
+ return r(e), t;
2935
+ }
2936
+ function Bo(e) {
2937
+ const t = {
2938
+ count: 0,
2939
+ path: "/",
2940
+ children: {}
2941
+ };
2942
+ return Object.keys(e).forEach((r) => {
2943
+ const s = e[r];
2944
+ if (!s || s.path === "/")
2945
+ return;
2946
+ const a = s.path.substring(1).split("/");
2947
+ let o = t, n = "";
2948
+ a.forEach((c, f) => {
2949
+ const u = `${n}/${c}`;
2950
+ o.children[u] || (o.children[u] = {
2951
+ count: 0,
2952
+ path: u,
2953
+ children: {}
2954
+ }), f === a.length - 1 && (o.children[u].count = s.count), n = u, o = o.children[u];
2955
+ });
2956
+ }), t;
2957
+ }
2958
+ function Vs(e) {
2959
+ const t = {
2960
+ count: e.count,
2961
+ path: e.path,
2962
+ children: []
2963
+ };
2964
+ return Object.keys(e.children).length > 0 && (t.children = Object.values(e.children).map((r) => Vs(r))), t;
2965
+ }
2966
+ function Wo(e, t) {
2967
+ const r = Object.keys(e), s = Object.keys(t), a = new Set(s.filter((n) => n.split("/").length > 2).map((n) => n.substring(0, n.lastIndexOf("/"))));
2968
+ return Object.fromEntries(r.filter((n) => !a.has(n.substring(0, n.lastIndexOf("/")))).map((n) => [n, e[n]]));
2969
+ }
2970
+ function Go(e, t, r) {
2971
+ const s = t[e], a = r[e], o = {
2972
+ count: 0,
2973
+ path: "/",
2974
+ children: s
2975
+ }, n = {
2976
+ count: 0,
2977
+ path: "/",
2978
+ children: a
2979
+ }, c = ps(o), f = ps(n), u = Wo(c, f), i = Gs(u, f), p = Bo(i), m = Vs(p);
2980
+ return {
2981
+ [e]: m.children
2982
+ };
2983
+ }
2984
+ const Vo = /* @__PURE__ */ F(class extends O {
2985
+ constructor() {
2986
+ super();
2987
+ /**
2988
+ * The name of the field where facets are applied.
2989
+ */
2990
+ h(this, "fieldName", "");
2991
+ /**
2992
+ * When the facets are updated.
2993
+ */
2994
+ h(this, "facetSelectionUpdated");
2995
+ h(this, "baseFacetRoot");
2996
+ h(this, "facetRoot");
2997
+ h(this, "selectedPaths", {});
2998
+ h(this, "lastTimeTaken");
2999
+ h(this, "hasNewSearchTerm", !1);
3000
+ h(this, "lastSearchTerm");
3001
+ h(this, "lastSearchMode");
3002
+ h(this, "lastSortType");
3003
+ h(this, "unsubscribe");
3004
+ h(this, "searchStore", $.getState());
3005
+ h(this, "formatLabel", (r) => {
3006
+ const s = r.path.replace(/^\//, ""), a = r.count;
3007
+ return `${s.replace(/-/g, " ").replace(/\b\w/g, (o) => o.toUpperCase())} (${a})`;
3008
+ });
3009
+ h(this, "formatSubLabel", (r, s) => {
3010
+ const o = r.path.substring(s.path.length).replace(/^\//, ""), n = r.count;
3011
+ return `${o.replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())} (${n})`;
3012
+ });
3013
+ this.__registerHost(), this.facetSelectionUpdated = ve(this, "facetSelectionUpdated");
3014
+ }
3015
+ handleStateUpdate(r) {
3016
+ const s = r.searchResponseFacetPrime, a = r.searchResponseTimeTaken;
3017
+ if (this.fieldName) {
3018
+ if ((r.searchTerm !== this.lastSearchTerm || r.searchMode !== this.lastSearchMode || r.sortType !== this.lastSortType) && (this.selectedPaths = {}, this.hasNewSearchTerm = !0), a !== this.lastTimeTaken && s) {
3019
+ this.facetRoot = void 0;
3020
+ const o = s.find((n) => this.fieldName === Object.keys(n)[0]);
3021
+ this.hasNewSearchTerm ? (this.baseFacetRoot = o, this.facetRoot = o, this.hasNewSearchTerm = !1) : this.baseFacetRoot && o && (this.facetRoot = Go(this.fieldName, this.baseFacetRoot, o));
3022
+ }
3023
+ this.lastSearchTerm = r.searchTerm, this.lastSearchMode = r.searchMode, this.lastSortType = r.sortType, this.lastTimeTaken = a;
3024
+ }
3025
+ }
3026
+ connectedCallback() {
3027
+ this.handleStateUpdate(this.searchStore), this.unsubscribe = $.subscribe((r) => {
3028
+ this.handleStateUpdate(r);
3029
+ });
3030
+ }
3031
+ disconnectedCallback() {
3032
+ var r;
3033
+ (r = this.unsubscribe) == null || r.call(this);
3034
+ }
3035
+ handleCheckboxChange(r) {
3036
+ var n;
3037
+ if (!this.selectedPaths[r])
3038
+ this.selectedPaths = {
3039
+ ...this.selectedPaths,
3040
+ [r]: !0
3041
+ };
3042
+ else {
3043
+ const c = Object.keys(this.selectedPaths).filter((f) => !f.includes(r));
3044
+ this.selectedPaths = c.reduce((f, u) => (f[u] = !0, f), {});
3045
+ }
3046
+ const a = Object.keys(this.selectedPaths).filter((c) => this.selectedPaths[c]), o = jo(a);
3047
+ (n = this.facetSelectionUpdated) == null || n.emit({ paths: o });
3048
+ }
3049
+ render() {
3050
+ var s;
3051
+ if (!this.fieldName)
3052
+ return;
3053
+ const r = (s = this.facetRoot) == null ? void 0 : s[this.fieldName];
3054
+ return d("div", { class: "searchcraft-facet-list" }, !r && d("p", { class: "searchcraft-facet-list-message" }, "Enter a search to view facets."), r == null ? void 0 : r.map((a) => {
3055
+ var n;
3056
+ const o = a.children ? (n = a.children) == null ? void 0 : n.some((c) => this.selectedPaths[c.path]) : !1;
3057
+ return d("div", { key: a.path, class: "searchcraft-facet-list-item" }, d("label", { class: "searchcraft-facet-list-checkbox-label" }, d("input", { class: "searchcraft-facet-list-checkbox-input", checked: this.selectedPaths[a.path], onChange: (c) => this.handleCheckboxChange(a.path), type: "checkbox" }), o ? d("div", { class: "searchcraft-facet-list-checkbox-input-dash-icon" }, d("svg", { width: "14", height: "3", viewBox: "0 0 14 3", fill: "none" }, d("title", null, "Checkbox dash"), d("line", { x1: "1.5", y1: "1.5", x2: "12.5", y2: "1.5", stroke: "white", "stroke-width": "3", "stroke-linecap": "round" }))) : d("div", { class: "searchcraft-facet-list-checkbox-input-check-icon" }, d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, d("title", null, "Checkbox check"), d("path", { d: "M13.9999 2L5.74988 10L1.99988 6.36364", stroke: "white", "stroke-width": "3", "stroke-linecap": "round", "stroke-linejoin": "round" }))), this.formatLabel(a)), a.children && a.children.length > 0 && d(_s, null, a.children.map((c) => d("label", { key: c.path, class: "searchcraft-facet-list-checkbox-label searchcraft-facet-list-child-checkbox-label", style: {
3058
+ display: this.selectedPaths[a.path] ? "flex" : "none"
3059
+ } }, d("input", { class: "searchcraft-facet-list-checkbox-input searchcraft-facet-list-child-checkbox-input", checked: this.selectedPaths[c.path], onChange: (f) => {
3060
+ this.handleCheckboxChange(c.path);
3061
+ }, type: "checkbox" }), d("div", { class: "searchcraft-facet-list-checkbox-input-check-icon searchcraft-facet-list-child-checkbox-input-check-icon" }, d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, d("title", null, "Checkbox check"), d("path", { d: "M13.9999 2L5.74988 10L1.99988 6.36364", stroke: "white", "stroke-width": "3", "stroke-linecap": "round", "stroke-linejoin": "round" }))), this.formatSubLabel(c, a)))));
3062
+ }));
3063
+ }
3064
+ }, [0, "searchcraft-facet-list", {
3065
+ fieldName: [1, "field-name"],
3066
+ baseFacetRoot: [32],
3067
+ facetRoot: [32],
3068
+ selectedPaths: [32],
3069
+ lastTimeTaken: [32],
3070
+ hasNewSearchTerm: [32],
3071
+ lastSearchTerm: [32],
3072
+ lastSearchMode: [32],
3073
+ lastSortType: [32],
3074
+ unsubscribe: [32]
3075
+ }]);
3076
+ function qs() {
3077
+ if (typeof customElements > "u")
3078
+ return;
3079
+ ["searchcraft-facet-list"].forEach((t) => {
3080
+ switch (t) {
3081
+ case "searchcraft-facet-list":
3082
+ customElements.get(t) || customElements.define(t, Vo);
3083
+ break;
3084
+ }
3085
+ });
3086
+ }
3087
+ const qo = qs;
3088
+ function Ye(e, t) {
3089
+ if (e && t)
3090
+ return t.fieldNames.map((r) => {
3091
+ let s = e[r.fieldName];
3092
+ if (s)
3093
+ switch (r.dataType) {
3094
+ case "date": {
3095
+ s = Qo(s);
3096
+ break;
3097
+ }
3098
+ case "number": {
3099
+ s = Intl.NumberFormat(r.numberFormatLocale, r.numberFormatOptions).format(s * (r.numberScale || 1));
3100
+ break;
3101
+ }
3102
+ }
3103
+ return s;
3104
+ }).filter((r) => !!r).join(t.delimiter || " ");
3105
+ }
3106
+ function Ys(e) {
3107
+ switch (e) {
3108
+ case "hour":
3109
+ return 36e5;
3110
+ case "day":
3111
+ return 864e5;
3112
+ case "month":
3113
+ return 2592e6;
3114
+ case "year":
3115
+ return 31536e6;
3116
+ default:
3117
+ return 36e5;
3118
+ }
3119
+ }
3120
+ function Yo(e) {
3121
+ return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
3122
+ }
3123
+ function Qo(e) {
3124
+ const t = /* @__PURE__ */ new Date(), r = new Date(e), s = Math.floor((t.getTime() - r.getTime()) / 1e3), a = Math.floor(s / 60), o = Math.floor(a / 60), n = Math.floor(o / 24), c = Math.floor(n / 365);
3125
+ return a < 60 ? `${a}m ago` : o < 24 ? `${o}h ago` : n < 365 ? `${n}d ago` : `${c}y ago`;
3126
+ }
3127
+ const Ko = /* @__PURE__ */ F(class extends O {
3128
+ constructor() {
3129
+ super();
3130
+ /**
3131
+ * The maximum value allowed.
3132
+ */
3133
+ h(this, "max", 100);
3134
+ /**
3135
+ * The minimum value allowed.
3136
+ */
3137
+ h(this, "min", 0);
3138
+ /**
3139
+ * The granularity that the value must adhere to.
3140
+ */
3141
+ h(this, "granularity", Ys("month"));
3142
+ /** The type of data allowed. */
3143
+ h(this, "dataType", "number");
3144
+ h(this, "endValue", this.max);
3145
+ h(this, "startValue", this.min);
3146
+ h(this, "lastFocusedHandle", "max");
3147
+ /**
3148
+ * When the range has changed.
3149
+ * */
3150
+ h(this, "rangeChanged");
3151
+ h(this, "emitUpdate", async () => {
3152
+ var r;
3153
+ (r = this.rangeChanged) == null || r.emit({
3154
+ startValue: this.startValue,
3155
+ endValue: this.endValue
3156
+ });
3157
+ });
3158
+ h(this, "handleStartValueChange", (r) => {
3159
+ const s = r.target, a = Number.parseInt(s.value, 10);
3160
+ this.lastFocusedHandle = "min", a <= this.endValue ? (this.startValue = a, this.emitUpdate()) : (this.startValue = this.endValue, s.value = `${this.endValue}`);
3161
+ });
3162
+ h(this, "handleEndValueChange", (r) => {
3163
+ const s = r.target, a = Number.parseInt(s.value, 10);
3164
+ this.lastFocusedHandle = "max", a >= this.startValue ? (this.endValue = a, this.emitUpdate()) : (this.endValue = this.startValue, s.value = `${this.startValue}`);
3165
+ });
3166
+ this.__registerHost(), this.rangeChanged = ve(this, "rangeChanged");
3167
+ }
3168
+ componentDidLoad() {
3169
+ this.startValue = this.min, this.endValue = this.max;
3170
+ }
3171
+ render() {
3172
+ const r = this.min, s = this.max, a = (this.startValue - r) / (s - r) * 100, o = (this.endValue - r) / (s - r) * 100, n = this.dataType === "number" ? this.startValue : new Date(this.startValue).getFullYear(), c = this.dataType === "number" ? this.endValue : new Date(this.endValue).getFullYear();
3173
+ return d("div", { key: "ad6c2b473230863408f48eee11527bc088ae4ef7", class: "searchcraft-slider" }, d("div", { key: "9c89eae611cfa3aed547e18fe242e58878e20252", class: "searchcraft-slider-range" }, d("div", { key: "9dfa61b66d26cc257bf878bd233b7ac02a94d7cf", class: "searchcraft-slider-active-range", style: {
3174
+ left: `${a}%`,
3175
+ width: `${o - a}%`
3176
+ } }), d("input", { key: "20ba4345d47a4c553d14cf70abfc1272f3423c41", class: ne("searchcraft-slider-input", "searchcraft-slider-input-min-handle"), max: this.max, min: this.min, onInput: this.handleStartValueChange.bind(this), step: this.granularity, style: { zIndex: this.lastFocusedHandle === "min" ? "2" : "1" }, type: "range", value: this.startValue }), d("input", { key: "e142cd75420882136d85f076678903ce4f8ef0f7", class: ne("searchcraft-slider-input", "searchcraft-slider-input-max-handle"), max: this.max, min: this.min, onInput: this.handleEndValueChange.bind(this), step: this.granularity, style: { zIndex: this.lastFocusedHandle === "max" ? "2" : "1" }, type: "range", value: this.endValue })), d("div", { key: "5b370071b7804fd896f87398ef8bc4e9603446d8", class: "searchcraft-slider-label" }, d("span", { key: "e22e25c99fc150590e19c9b939dc9687f14f49dc", class: "searchcraft-slider-start-label" }, n), d("span", { key: "a81fa0d45acdfcbaceb69fe94721fb25cac038a2", class: "searchcraft-slider-end-label" }, c)));
3177
+ }
3178
+ }, [0, "searchcraft-slider", {
3179
+ max: [2],
3180
+ min: [2],
3181
+ granularity: [2],
3182
+ dataType: [1, "data-type"],
3183
+ endValue: [32],
3184
+ startValue: [32],
3185
+ lastFocusedHandle: [32]
3186
+ }]);
3187
+ function Qs() {
3188
+ if (typeof customElements > "u")
3189
+ return;
3190
+ ["searchcraft-slider"].forEach((t) => {
3191
+ switch (t) {
3192
+ case "searchcraft-slider":
3193
+ customElements.get(t) || customElements.define(t, Ko);
3194
+ break;
3195
+ }
3196
+ });
3197
+ }
3198
+ const Xo = /* @__PURE__ */ F(class extends O {
3199
+ constructor() {
3200
+ super();
3201
+ /**
3202
+ * The label.
3203
+ */
3204
+ h(this, "label", "Toggle");
3205
+ /**
3206
+ * The secondary label displayed below the main label.
3207
+ */
3208
+ h(this, "subLabel");
3209
+ /**
3210
+ * When the toggle element is changed.
3211
+ */
3212
+ h(this, "toggleUpdated");
3213
+ h(this, "isActive", !1);
3214
+ h(this, "unsubscribe");
3215
+ h(this, "lastSearchTerm");
3216
+ h(this, "handleToggle", async () => {
3217
+ var r;
3218
+ this.isActive = !this.isActive, (r = this.toggleUpdated) == null || r.emit(this.isActive);
3219
+ });
3220
+ this.__registerHost(), this.toggleUpdated = ve(this, "toggleUpdated");
3221
+ }
3222
+ connectedCallback() {
3223
+ this.unsubscribe = $.subscribe((r) => {
3224
+ r.searchTerm !== this.lastSearchTerm && r.searchTerm.trim().length === 0 && (this.isActive = !1), this.lastSearchTerm = r.searchTerm;
3225
+ });
3226
+ }
3227
+ disconnectedCallback() {
3228
+ var r;
3229
+ (r = this.unsubscribe) == null || r.call(this);
3230
+ }
3231
+ render() {
3232
+ return d("div", { key: "dd0367c381eaedcf675977c181fbdac6499f32e9", class: ne("searchcraft-toggle-button", {
3233
+ "searchcraft-toggle-button-active": this.isActive
3234
+ }) }, d("div", { key: "43b5920cad7c1d44dda3d541481a2eea1f0182b7" }, d("p", { key: "1ac87d2f68ba9e8b84e9e5e4157a4108275d064c", class: "searchcraft-toggle-button-label" }, this.label), this.subLabel && d("p", { key: "e06f9a06088bede5546d8d47e84ece9cae5dfc54", class: "searchcraft-toggle-button-sub-label" }, this.subLabel)), d("button", { key: "96999c99ef38996f871ac9260f4a048561cd7003", class: "searchcraft-toggle-button-background", onClick: this.handleToggle, type: "button" }, d("div", { key: "f93c71f1e06531f06709140033d56aa2fa378d47", class: "searchcraft-toggle-button-handle" })));
3235
+ }
3236
+ }, [0, "searchcraft-toggle-button", {
3237
+ label: [1],
3238
+ subLabel: [1, "sub-label"],
3239
+ isActive: [32],
3240
+ unsubscribe: [32],
3241
+ lastSearchTerm: [32]
3242
+ }]);
3243
+ function Ks() {
3244
+ if (typeof customElements > "u")
3245
+ return;
3246
+ ["searchcraft-toggle-button"].forEach((t) => {
3247
+ switch (t) {
3248
+ case "searchcraft-toggle-button":
3249
+ customElements.get(t) || customElements.define(t, Xo);
3250
+ break;
3251
+ }
3252
+ });
3253
+ }
3254
+ const Zo = /* @__PURE__ */ F(class extends O {
3255
+ constructor() {
3256
+ super();
3257
+ /**
3258
+ * The items to filter.
3259
+ */
3260
+ h(this, "items", []);
3261
+ h(this, "unsubscribe");
3262
+ h(this, "lastSearchTerm");
3263
+ h(this, "searchStore", $.getState());
3264
+ this.__registerHost();
3265
+ }
3266
+ componentDidLoad() {
3267
+ this.unsubscribe = $.subscribe((r) => {
3268
+ this.lastSearchTerm = r.searchTerm || "";
3269
+ });
3270
+ }
3271
+ disconnectedCallback() {
3272
+ var r;
3273
+ (r = this.unsubscribe) == null || r.call(this);
3274
+ }
3275
+ handleDateRangeChanged(r, s, a) {
3276
+ const o = new Date(new Date(s).getFullYear(), 0, 1), n = new Date(new Date(a).getFullYear() + 1, 0, 0);
3277
+ this.searchStore.addRangeValueForIndexField({
3278
+ fieldName: r,
3279
+ value: `${r}:[${o.toISOString()} TO ${n.toISOString()}]`
3280
+ }), this.searchStore.search();
3281
+ }
3282
+ handleNumericRangeChanged(r, s, a) {
3283
+ this.searchStore.addRangeValueForIndexField({
3284
+ fieldName: r,
3285
+ value: `${r}:[${s} TO ${a}]`
3286
+ }), this.searchStore.search();
3287
+ }
3288
+ handleFacetSelectionUpdated(r, s) {
3289
+ s.length > 0 ? this.searchStore.addFacetPathsForIndexField({
3290
+ fieldName: r,
3291
+ value: `${r}: IN [${s.join(" ")}]`
3292
+ }) : this.searchStore.removeFacetPathsForIndexField(r), this.searchStore.search();
3293
+ }
3294
+ handleExactMatchToggleUpdated(r) {
3295
+ this.searchStore.setSearchMode(r ? "exact" : "fuzzy"), this.searchStore.search();
3296
+ }
3297
+ handleMostRecentToggleUpdated(r) {
3298
+ this.searchStore.setSortType(r ? "desc" : "asc"), this.searchStore.search();
3299
+ }
3300
+ /**
3301
+ * Iterate through `items` and render them based on `type`
3302
+ */
3303
+ render() {
3304
+ return d("div", { key: "6d3779476496055a83529c39cd9908a46f404e02", class: "searchcraft-filter-panel" }, this.items.map((r) => {
3305
+ switch (r.type) {
3306
+ case "dateRange": {
3307
+ const s = r, a = new Date(s.options.minDate).getTime(), o = new Date(s.options.maxDate).getTime(), n = Ys(s.options.granularity);
3308
+ return d("div", { class: "searchcraft-filter-panel-section" }, d("p", { class: "searchcraft-filter-panel-label" }, r.label), d("searchcraft-slider", { min: a, max: o, granularity: n, dataType: "date", onRangeChanged: (c) => {
3309
+ this.handleDateRangeChanged(s.fieldName, c.detail.startValue, c.detail.endValue);
3310
+ } }));
3311
+ }
3312
+ case "numericRange": {
3313
+ const s = r;
3314
+ return d("div", { class: "searchcraft-filter-panel-section" }, d("p", { class: "searchcraft-filter-panel-label" }, r.label), d("searchcraft-slider", { min: s.options.min, max: s.options.max, granularity: s.options.granularity, onRangeChanged: (a) => {
3315
+ this.handleNumericRangeChanged(s.fieldName, a.detail.startValue, a.detail.endValue);
3316
+ } }));
3317
+ }
3318
+ case "facets": {
3319
+ const s = r;
3320
+ return d("div", { class: "searchcraft-filter-panel-section" }, d("p", { class: "searchcraft-filter-panel-label" }, r.label), d("searchcraft-facet-list", { fieldName: s.fieldName, onFacetSelectionUpdated: (a) => {
3321
+ this.handleFacetSelectionUpdated(s.fieldName, a.detail.paths);
3322
+ } }));
3323
+ }
3324
+ case "exactMatchToggle": {
3325
+ const s = r;
3326
+ return d("searchcraft-toggle-button", { label: s.label, subLabel: s.options.subLabel, onToggleUpdated: (a) => {
3327
+ this.handleExactMatchToggleUpdated(a.detail);
3328
+ } });
3329
+ }
3330
+ case "mostRecentToggle": {
3331
+ const s = r;
3332
+ return d("searchcraft-toggle-button", { label: s.label, subLabel: s.options.subLabel, onToggleUpdated: (a) => {
3333
+ this.handleMostRecentToggleUpdated(a.detail);
3334
+ } });
3335
+ }
3336
+ }
3337
+ }));
3338
+ }
3339
+ }, [0, "searchcraft-filter-panel", {
3340
+ items: [16],
3341
+ unsubscribe: [32],
3342
+ lastSearchTerm: [32]
3343
+ }]);
3344
+ function Jo() {
3345
+ if (typeof customElements > "u")
3346
+ return;
3347
+ ["searchcraft-filter-panel", "searchcraft-facet-list", "searchcraft-slider", "searchcraft-toggle-button"].forEach((t) => {
3348
+ switch (t) {
3349
+ case "searchcraft-filter-panel":
3350
+ customElements.get(t) || customElements.define(t, Zo);
3351
+ break;
3352
+ case "searchcraft-facet-list":
3353
+ customElements.get(t) || qs();
3354
+ break;
3355
+ case "searchcraft-slider":
3356
+ customElements.get(t) || Qs();
3357
+ break;
3358
+ case "searchcraft-toggle-button":
3359
+ customElements.get(t) || Ks();
3360
+ break;
3361
+ }
3362
+ });
3363
+ }
3364
+ const ec = Jo, tc = /* @__PURE__ */ F(class extends O {
3365
+ constructor() {
3366
+ super();
3367
+ /**
3368
+ * The classname applied to the label element.
3369
+ */
3370
+ h(this, "inputLabelClassName", "");
3371
+ h(this, "label", "");
3372
+ this.__registerHost();
3373
+ }
3374
+ render() {
3375
+ return d("label", { key: "3622c616d480e57b1dfaa2d61637a30b843cb968", class: ne("searchcraft-input-label", this.inputLabelClassName), htmlFor: "searchcraft-input-id" }, this.label);
3376
+ }
3377
+ }, [0, "searchcraft-input-label", {
3378
+ inputLabelClassName: [1, "input-label-class-name"],
3379
+ label: [1]
3380
+ }]);
3381
+ function fr() {
3382
+ if (typeof customElements > "u")
3383
+ return;
3384
+ ["searchcraft-input-label"].forEach((t) => {
3385
+ switch (t) {
3386
+ case "searchcraft-input-label":
3387
+ customElements.get(t) || customElements.define(t, tc);
3388
+ break;
3389
+ }
3390
+ });
3391
+ }
3392
+ const rc = /* @__PURE__ */ F(class extends O {
3393
+ constructor() {
3394
+ super();
3395
+ /**
3396
+ * Whether or not to automatically submit the search term when the input changes.
3397
+ */
3398
+ h(this, "autoSearch", !0);
3399
+ /**
3400
+ * Where to place the search button.
3401
+ */
3402
+ h(this, "buttonPlacement", "none");
3403
+ /**
3404
+ * The label for the submit button.
3405
+ */
3406
+ h(this, "buttonLabel");
3407
+ /**
3408
+ * The label rendered above the input.
3409
+ */
3410
+ h(this, "inputLabel");
3411
+ /**
3412
+ * The input element's placeholder value.
3413
+ */
3414
+ h(this, "placeholderValue", "Enter Search");
3415
+ /**
3416
+ * When the input becomes focused.
3417
+ */
3418
+ h(this, "inputFocus");
3419
+ /**
3420
+ * When the input becomes unfocused.
3421
+ */
3422
+ h(this, "inputBlur");
3423
+ /**
3424
+ * Event emitted when input initializes.
3425
+ */
3426
+ h(this, "inputInit");
3427
+ h(this, "inputValue", "");
3428
+ h(this, "searchTerm", "");
3429
+ h(this, "error", !1);
3430
+ h(this, "core");
3431
+ h(this, "searchStore", $.getState());
3432
+ h(this, "handleOnInput", (r) => {
3433
+ const s = r.target;
3434
+ this.inputValue = s.value, this.autoSearch && this.performSearch(s.value);
3435
+ });
3436
+ h(this, "performSearch", async (r) => {
3437
+ if (r !== $.getState().searchTerm) {
3438
+ this.searchTerm = r.trim(), this.error = !1, this.searchStore.setSearchTerm(this.searchTerm);
3439
+ try {
3440
+ await this.searchStore.search();
3441
+ } catch (s) {
3442
+ console.log(s), this.error = !0;
3443
+ }
3444
+ }
3445
+ });
3446
+ h(this, "handleClearInput", () => {
3447
+ this.inputValue = "", this.searchTerm = "", this.searchStore.setSearchTerm(""), this.searchStore.setSearchClientResponseItems([]), this.error = !1;
3448
+ });
3449
+ h(this, "handleFormSubmit", async (r) => {
3450
+ r.preventDefault(), await this.performSearch(this.searchTerm);
3451
+ });
3452
+ this.__registerHost(), this.inputFocus = ve(this, "inputFocus"), this.inputBlur = ve(this, "inputBlur"), this.inputInit = ve(this, "inputInit");
3453
+ }
3454
+ init() {
3455
+ var r;
3456
+ this.core && (this.searchStore.initialize(this.core), (r = this.inputInit) == null || r.emit());
3457
+ }
3458
+ connectedCallback() {
3459
+ this.init();
3460
+ }
3461
+ onCoreChange() {
3462
+ this.init();
3463
+ }
3464
+ render() {
3465
+ const r = this.inputValue.length > 0, s = ne("searchcraft-input-form-grid", {
3466
+ "searchcraft-input-form-grid-button-left": this.buttonPlacement === "left",
3467
+ "searchcraft-input-form-grid-button-right": this.buttonPlacement === "right",
3468
+ "searchcraft-input-form-grid-button-none": this.buttonPlacement === "none"
3469
+ }), o = {
3470
+ gap: this.inputLabel || this.error ? "4px 8px" : "0px 8px"
3471
+ };
3472
+ return d("form", { key: "862f8059b6eaae8d7ac9bd3c9de8109dd60fab8f", class: "searchcraft-input-form", onSubmit: this.handleFormSubmit }, d("div", { key: "34ff1c3cff4011c9a5f0af0ff690e3a12ad80907", class: s, style: o }, d("div", { key: "820506482aeea17534c4113e601f3ba2254e7fe6", class: "searchcraft-input-form-button" }, d("searchcraft-button", { key: "377a6d8e9835c40379dbd0842a2f0f53638845e1", onButtonClick: this.handleFormSubmit, label: this.buttonLabel })), this.inputLabel && d("div", { key: "84d100df3793599fd3f6773d26028e43e41d1ab7", class: "searchcraft-input-form-label" }, d("searchcraft-input-label", { key: "cfa7eca0b2ab3b82dd6c0a5104c19c88881f52b5", label: this.inputLabel })), this.error && d("div", { key: "62d0e29e46ac922469e48aa822239cd645ea9c8d", class: "searchcraft-input-form-error-message" }, d("searchcraft-error-message", { key: "8a989b4a2e1196b01de9082433a69d86f55910fb" }, "Something went wrong.")), d("div", { key: "a3c4cd8ef20f909eec2d9e2f9515a65525fe612e", class: "searchcraft-input-form-input-wrapper" }, d("input", { key: "af23902c7f7a79ced427da3aadaa30736b68c8a7", autoComplete: "off", class: "searchcraft-input-form-input", onFocus: () => {
3473
+ var n;
3474
+ return (n = this.inputFocus) == null ? void 0 : n.emit();
3475
+ }, onBlur: () => {
3476
+ var n;
3477
+ return (n = this.inputBlur) == null ? void 0 : n.emit();
3478
+ }, onInput: (n) => {
3479
+ this.handleOnInput(n);
3480
+ }, placeholder: this.placeholderValue, type: "text", value: this.inputValue }), d("div", { key: "66176081ef8da6bd3065ad0eeb61a397ab0fadfc", class: "searchcraft-input-form-input-icon" }, d("svg", { key: "baac2f051f04a411acba0d5683255e9a37a27833", class: "searchcraft-input-form-input-search-icon", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-labelledby": "searchcraft-title" }, d("title", { key: "24230d00bd0b9466fb414246836c2477630ec254" }, "Search icon"), d("path", { key: "9f1446fd1885cc63c26fa5acfcdbdb775547c5ee", d: "M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }))), r && d("button", { key: "b9a42b46f7d470f6f1bbba5b95fd4031db9a1ebd", type: "button", class: "searchcraft-input-form-clear-button", onClick: this.handleClearInput }, d("svg", { key: "cda07c19eb77c2d2d343ce8d1cf8c55c484107f2", class: "searchcraft-input-form-clear-button-icon", viewBox: "0 0 22 22", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-labelledby": "icon-title" }, d("title", { key: "43ba26388dc06b6ff3c5441387db9ba621bcc08e" }, "Clear icon"), d("path", { key: "5f33de1e306548f1cf504e4e6c6548d51eba93d3", d: "M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }))))));
3481
+ }
3482
+ static get watchers() {
3483
+ return {
3484
+ core: ["onCoreChange"]
3485
+ };
3486
+ }
3487
+ }, [0, "searchcraft-input-form", {
3488
+ autoSearch: [4, "auto-search"],
3489
+ buttonPlacement: [1, "button-placement"],
3490
+ buttonLabel: [1, "button-label"],
3491
+ inputLabel: [1, "input-label"],
3492
+ placeholderValue: [1, "placeholder-value"],
3493
+ core: [16],
3494
+ inputValue: [32],
3495
+ searchTerm: [32],
3496
+ error: [32]
3497
+ }, void 0, {
3498
+ core: ["onCoreChange"]
3499
+ }]);
3500
+ function Xs() {
3501
+ if (typeof customElements > "u")
3502
+ return;
3503
+ ["searchcraft-input-form", "searchcraft-button", "searchcraft-error-message", "searchcraft-input-label"].forEach((t) => {
3504
+ switch (t) {
3505
+ case "searchcraft-input-form":
3506
+ customElements.get(t) || customElements.define(t, rc);
3507
+ break;
3508
+ case "searchcraft-button":
3509
+ customElements.get(t) || wt();
3510
+ break;
3511
+ case "searchcraft-error-message":
3512
+ customElements.get(t) || Et();
3513
+ break;
3514
+ case "searchcraft-input-label":
3515
+ customElements.get(t) || fr();
3516
+ break;
3517
+ }
3518
+ });
3519
+ }
3520
+ const sc = Xs, ac = fr, nc = /* @__PURE__ */ F(class extends O {
3521
+ constructor() {
3522
+ super();
3523
+ // store vars
3524
+ h(this, "searchTerm");
3525
+ h(this, "searchResultsPerPage");
3526
+ h(this, "searchResultsPage");
3527
+ h(this, "searchResultsCount");
3528
+ // local vars
3529
+ h(this, "searchResultsPagesCount", 1);
3530
+ h(this, "searchResultsRangeMin", 1);
3531
+ h(this, "searchResultsRangeMax", 1);
3532
+ // store functions
3533
+ h(this, "setSearchResultsPage", () => {
3534
+ });
3535
+ h(this, "unsubscribe", () => {
3536
+ });
3537
+ this.__registerHost();
3538
+ }
3539
+ componentDidLoad() {
3540
+ this.unsubscribe = $.subscribe((r) => {
3541
+ this.searchTerm = r.searchTerm, this.searchResultsPerPage = r.searchResultsPerPage, this.searchResultsPage = r.searchResultsPage, this.searchResultsCount = r.searchResultsCount, this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage), this.searchResultsRangeMin = (this.searchResultsPage - 1) * this.searchResultsPerPage + 1, this.searchResultsRangeMax = (this.searchResultsPerPage - 1) * this.searchResultsPerPage + this.searchResultsPerPage, this.setSearchResultsPage = r.setSearchResultsPage;
3542
+ });
3543
+ }
3544
+ disconnectedCallback() {
3545
+ var r;
3546
+ (r = this.unsubscribe) == null || r.call(this);
3547
+ }
3548
+ handleGoToPage(r) {
3549
+ this.setSearchResultsPage(r);
3550
+ }
3551
+ renderOddPaginationItem(r) {
3552
+ return d("li", null, d("button", { class: ne("searchcraft-pagination-item", {
3553
+ "searchcraft-pagination-item-active": this.searchResultsPage === r
3554
+ }), onClick: () => this.handleGoToPage(r), type: "button" }, r));
3555
+ }
3556
+ renderEvenPaginationItem(r) {
3557
+ if (!(this.searchResultsPagesCount <= r))
3558
+ return (this.searchResultsPagesCount <= 5 || r < Math.ceil(this.searchResultsPagesCount / 2) ? this.searchResultsPage <= r + 1 : this.searchResultsPage >= r - 1) ? d("li", null, d("button", { class: ne("searchcraft-pagination-item", {
3559
+ "searchcraft-pagination-item-active": this.searchResultsPage === r
3560
+ }), onClick: () => this.handleGoToPage(r), type: "button" }, r)) : d("li", null, d("span", { class: "searchcraft-pagination-item" }, "..."));
3561
+ }
3562
+ renderMiddlePaginationItem() {
3563
+ if (!(this.searchResultsPagesCount <= 3))
3564
+ return this.searchResultsPagesCount <= 5 || this.searchResultsPage <= 3 || this.searchResultsPage >= this.searchResultsPagesCount - 2 ? d("li", null, d("button", { class: ne("searchcraft-pagination-item", {
3565
+ "searchcraft-pagination-item-active": this.searchResultsPage === 3 || this.searchResultsPage === this.searchResultsPagesCount - 2
3566
+ }), type: "button", onClick: () => this.handleGoToPage(this.searchResultsPage >= this.searchResultsPagesCount - 2 ? this.searchResultsPagesCount - 2 : 3) }, this.searchResultsPage >= this.searchResultsPagesCount - 2 ? this.searchResultsPagesCount - 2 : 3)) : d("li", null, d("span", { class: "searchcraft-pagination-item searchcraft-pagination-item-active" }, this.searchResultsPage));
3567
+ }
3568
+ render() {
3569
+ if (!(!this.searchTerm || this.searchResultsPagesCount <= 1))
3570
+ return d("div", { class: "searchcraft-pagination" }, d("div", { class: "searchcraft-pagination-control" }, d("searchcraft-button", { disabled: this.searchResultsPage === 1, hierarchy: "tertiary", onButtonClick: () => this.handleGoToPage(Math.max(1, this.searchResultsPage - 1)), label: "Previous", iconPosition: "left", icon: d("svg", { class: "searchcraft-button-icon", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d("title", null, "Previous page icon"), d("path", { d: "M12.5 15L7.5 10L12.5 5", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })), iconOnly: !0 })), d("ul", { class: "searchcraft-pagination-list" }, this.renderOddPaginationItem(1), this.renderEvenPaginationItem(2), this.renderMiddlePaginationItem(), this.renderEvenPaginationItem(this.searchResultsPagesCount > 4 ? this.searchResultsPagesCount - 1 : 4), this.renderOddPaginationItem(this.searchResultsPagesCount)), d("div", { class: "searchcraft-pagination-control" }, d("searchcraft-button", { disabled: this.searchResultsPage === this.searchResultsPagesCount, hierarchy: "tertiary", onButtonClick: () => {
3571
+ this.handleGoToPage(Math.min(this.searchResultsPagesCount, this.searchResultsPage + 1));
3572
+ }, label: "Next", iconPosition: "right", icon: d("svg", { class: "searchcraft-button-icon", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d("title", null, "Next page icon"), d("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })), iconOnly: !0 })));
3573
+ }
3574
+ }, [0, "searchcraft-pagination", {
3575
+ searchTerm: [32],
3576
+ searchResultsPerPage: [32],
3577
+ searchResultsPage: [32],
3578
+ searchResultsCount: [32],
3579
+ searchResultsPagesCount: [32],
3580
+ searchResultsRangeMin: [32],
3581
+ searchResultsRangeMax: [32],
3582
+ setSearchResultsPage: [32]
3583
+ }]);
3584
+ function oc() {
3585
+ if (typeof customElements > "u")
3586
+ return;
3587
+ ["searchcraft-pagination", "searchcraft-button"].forEach((t) => {
3588
+ switch (t) {
3589
+ case "searchcraft-pagination":
3590
+ customElements.get(t) || customElements.define(t, nc);
3591
+ break;
3592
+ case "searchcraft-button":
3593
+ customElements.get(t) || wt();
3594
+ break;
3595
+ }
3596
+ });
3597
+ }
3598
+ const cc = oc, ic = /* @__PURE__ */ F(class extends O {
3599
+ constructor() {
3600
+ super(), this.__registerHost();
3601
+ }
3602
+ handleOnClick() {
3603
+ $.getState().setPopoverVisibility(!0);
3604
+ }
3605
+ render() {
3606
+ return d("button", { key: "878f61ad9c93a3900e97f459f33cf526e647e583", class: "searchcraft-popover-button", onClick: this.handleOnClick.bind(this), type: "button" }, d("slot", { key: "c248779f08b940fca9800375b8814d6fc49f3715" }));
3607
+ }
3608
+ }, [4, "searchcraft-popover-button"]);
3609
+ function lc() {
3610
+ if (typeof customElements > "u")
3611
+ return;
3612
+ ["searchcraft-popover-button"].forEach((t) => {
3613
+ switch (t) {
3614
+ case "searchcraft-popover-button":
3615
+ customElements.get(t) || customElements.define(t, ic);
3616
+ break;
3617
+ }
3618
+ });
3619
+ }
3620
+ const uc = lc, fc = /* @__PURE__ */ F(class extends O {
3621
+ constructor() {
3622
+ super();
3623
+ h(this, "item");
3624
+ h(this, "popoverResultMappings");
3625
+ /** The document position relative to the search results (For Measure) */
3626
+ h(this, "documentPosition", 0);
3627
+ h(this, "href");
3628
+ h(this, "imageSrc");
3629
+ h(this, "imageAlt");
3630
+ h(this, "titleContent");
3631
+ h(this, "subtitleContent");
3632
+ h(this, "handleLinkClick", () => {
3633
+ var a;
3634
+ const r = $.getState(), s = r.getSearchcraftInstance();
3635
+ if (s) {
3636
+ const o = this.documentPosition, n = r.searchTerm, c = r.searchClientResponseItems.length || 0;
3637
+ (a = s.measureClient) == null || a.sendMeasureEvent("document_clicked", {
3638
+ document_position: o,
3639
+ number_of_documents: c,
3640
+ search_term: n
3641
+ });
3642
+ }
3643
+ });
3644
+ this.__registerHost();
3645
+ }
3646
+ mapValuesFromDocument(r) {
3647
+ var s, a, o, n, c;
3648
+ this.titleContent = Ye(r, (s = this.popoverResultMappings) == null ? void 0 : s.title), this.subtitleContent = Ye(r, (a = this.popoverResultMappings) == null ? void 0 : a.subtitle), this.href = Ye(r, (o = this.popoverResultMappings) == null ? void 0 : o.href), this.imageSrc = Ye(r, (n = this.popoverResultMappings) == null ? void 0 : n.imageSource), this.imageAlt = Ye(r, (c = this.popoverResultMappings) == null ? void 0 : c.imageAlt);
3649
+ }
3650
+ connectedCallback() {
3651
+ this.item && this.mapValuesFromDocument(this.item.document);
3652
+ }
3653
+ disconnectedCallback() {
3654
+ }
3655
+ render() {
3656
+ return d("a", { key: "c4a142be2b9993b8ad83eaaa59bdd9a047e4275e", class: "searchcraft-popover-list-item", href: this.href, onClick: this.handleLinkClick.bind(this) }, this.imageSrc && d("div", { key: "6a620203f4918b051835f557a00eb82c2397c56f", class: "searchcraft-popover-list-item-image-wrapper" }, d("img", { key: "1a07c169119146f4f22e704098c493d67927ce82", alt: this.imageAlt, src: this.imageSrc, class: "searchcraft-popover-list-item-image" })), d("div", { key: "d0b2faa1359c004cb5c38fd615e969a7614706cc", class: "searchcraft-popover-list-item-info-wrapper" }, d("p", { key: "9b8c8ba1d5c62a5251db893f3604803f83f687d2", class: "searchcraft-popover-list-item-title" }, this.titleContent), d("p", { key: "930699a84405d0ea2476eb91bf9ce77fed016bb8", class: "searchcraft-popover-list-item-subtitle" }, this.subtitleContent)));
3657
+ }
3658
+ }, [0, "searchcraft-popover-list-item", {
3659
+ item: [16],
3660
+ popoverResultMappings: [16],
3661
+ documentPosition: [2, "document-position"],
3662
+ href: [32],
3663
+ imageSrc: [32],
3664
+ imageAlt: [32],
3665
+ titleContent: [32],
3666
+ subtitleContent: [32]
3667
+ }]);
3668
+ function dr() {
3669
+ if (typeof customElements > "u")
3670
+ return;
3671
+ ["searchcraft-popover-list-item"].forEach((t) => {
3672
+ switch (t) {
3673
+ case "searchcraft-popover-list-item":
3674
+ customElements.get(t) || customElements.define(t, fc);
3675
+ break;
3676
+ }
3677
+ });
3678
+ }
3679
+ var gs;
3680
+ const dc = /* @__PURE__ */ F(class extends O {
3681
+ constructor() {
3682
+ super();
3683
+ /**
3684
+ * The mappings that define how the data in the documents are mapped to the
3685
+ * list-view-item elements.
3686
+ */
3687
+ h(this, "popoverResultMappings");
3688
+ /**
3689
+ * The items to render in the list view.
3690
+ */
3691
+ h(this, "searchClientResponseItems");
3692
+ h(this, "adClientResponseItems");
3693
+ h(this, "searchResultsPage");
3694
+ h(this, "searchResultsPerPage");
3695
+ h(this, "config", (gs = $.getState().core) == null ? void 0 : gs.config);
3696
+ this.__registerHost();
3697
+ }
3698
+ renderWithADMAds() {
3699
+ var r, s;
3700
+ return d("div", { class: "searchcraft-popover-list-view" }, (r = this.adClientResponseItems) == null ? void 0 : r.map((a) => d("searchcraft-ad", { adClientResponseItem: a, adContainerId: X(), adSource: "adMarketplace", key: a.id })), (s = this.searchClientResponseItems) == null ? void 0 : s.map((a, o) => d("searchcraft-popover-list-item", { item: a, key: a.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + o })));
3701
+ }
3702
+ renderWithCustomAds() {
3703
+ var f, u, i, p;
3704
+ const r = [], s = ((f = this.config) == null ? void 0 : f.customAdInterstitialInterval) || 0, a = ((u = this.config) == null ? void 0 : u.customAdInterstitialQuantity) || 1, o = ((i = this.config) == null ? void 0 : i.customAdStartQuantity) || 0, n = ((p = this.config) == null ? void 0 : p.customAdEndQuantity) || 0, c = this.searchClientResponseItems || [];
3705
+ for (let m = 0; m < o; m++)
3706
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m}-ad` }));
3707
+ c.forEach((m, y) => {
3708
+ if (s && y % s === 0 && y + s < c.length && y >= s)
3709
+ for (let v = 0; v < a; v++)
3710
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m.id}-ad-${v}` }));
3711
+ r.push(d("searchcraft-popover-list-item", { item: m, key: m.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + y }));
3712
+ });
3713
+ for (let m = 0; m < n; m++)
3714
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m}-ad` }));
3715
+ return d("div", { class: "searchcraft-popover-list-view" }, r);
3716
+ }
3717
+ renderWithNativoAds() {
3718
+ var u, i, p, m, y;
3719
+ const r = [], s = ((u = this.config) == null ? void 0 : u.nativoAdInterstialStartIndex) || 0, a = ((i = this.config) == null ? void 0 : i.nativoAdInterstitialInterval) || 0, o = ((p = this.config) == null ? void 0 : p.nativoAdInterstitialQuantity) || 1, n = ((m = this.config) == null ? void 0 : m.nativoAdStartQuantity) || 0, c = ((y = this.config) == null ? void 0 : y.nativoAdEndQuantity) || 0, f = this.searchClientResponseItems || [];
3720
+ for (let v = 0; v < n; v++)
3721
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v}-ad` }));
3722
+ f.forEach((v, x) => {
3723
+ if (a && (x + s) % a === 0 && x + a < f.length && x >= a)
3724
+ for (let U = 0; U < o; U++)
3725
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v.id}-ad-${U}` }));
3726
+ r.push(d("searchcraft-popover-list-item", { item: v, key: v.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + x }));
3727
+ });
3728
+ for (let v = 0; v < c; v++)
3729
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v}-ad` }));
3730
+ return d("div", { class: "searchcraft-popover-list-view" }, r);
3731
+ }
3732
+ renderWithNoAds() {
3733
+ var r;
3734
+ return d("div", { class: "searchcraft-popover-list-view" }, (r = this.searchClientResponseItems) == null ? void 0 : r.map((s, a) => d("searchcraft-popover-list-item", { item: s, key: s.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + a })));
3735
+ }
3736
+ render() {
3737
+ var r;
3738
+ switch (((r = this.config) == null ? void 0 : r.adSource) || "None") {
3739
+ case "adMarketplace":
3740
+ return this.renderWithADMAds();
3741
+ case "Custom":
3742
+ return this.renderWithCustomAds();
3743
+ case "Nativo":
3744
+ return this.renderWithNativoAds();
3745
+ default:
3746
+ return this.renderWithNoAds();
3747
+ }
3748
+ }
3749
+ }, [0, "searchcraft-popover-list-view", {
3750
+ popoverResultMappings: [16],
3751
+ searchClientResponseItems: [16],
3752
+ adClientResponseItems: [16],
3753
+ searchResultsPage: [2, "search-results-page"],
3754
+ searchResultsPerPage: [2, "search-results-per-page"]
3755
+ }]);
3756
+ function Zs() {
3757
+ if (typeof customElements > "u")
3758
+ return;
3759
+ ["searchcraft-popover-list-view", "searchcraft-ad", "searchcraft-popover-list-item"].forEach((t) => {
3760
+ switch (t) {
3761
+ case "searchcraft-popover-list-view":
3762
+ customElements.get(t) || customElements.define(t, dc);
3763
+ break;
3764
+ case "searchcraft-ad":
3765
+ customElements.get(t) || St();
3766
+ break;
3767
+ case "searchcraft-popover-list-item":
3768
+ customElements.get(t) || dr();
3769
+ break;
3770
+ }
3771
+ });
3772
+ }
3773
+ const hc = /* @__PURE__ */ F(class extends O {
3774
+ constructor() {
3775
+ super();
3776
+ /**
3777
+ * The type of popover form to render.
3778
+ * - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content.
3779
+ * - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component.
3780
+ * - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
3781
+ */
3782
+ h(this, "type", "inline");
3783
+ /**
3784
+ * Formats the content rendered for each result.
3785
+ */
3786
+ h(this, "popoverResultMappings");
3787
+ /**
3788
+ * The hotkey that activates the popover.
3789
+ */
3790
+ h(this, "hotkey", "k");
3791
+ /**
3792
+ * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.
3793
+ */
3794
+ h(this, "hotkeyModifier", "meta");
3795
+ h(this, "isPopoverVisibleInState", !1);
3796
+ h(this, "unsubscribe");
3797
+ h(this, "searchClientResponseItems", []);
3798
+ h(this, "adClientResponseItems", []);
3799
+ h(this, "searchTerm");
3800
+ h(this, "isFocused", !1);
3801
+ h(this, "breakpointSm", 576);
3802
+ h(this, "breakpointMd", 768);
3803
+ h(this, "breakpointLg", 992);
3804
+ h(this, "searchResultsPage");
3805
+ h(this, "searchResultsPerPage");
3806
+ h(this, "modalElement");
3807
+ h(this, "handleDocumentClick", (r) => {
3808
+ this.hostElement.contains(r.target) || (this.isFocused = !1);
3809
+ });
3810
+ /**
3811
+ * Actions to perform when various keys are pressed within the popover form.
3812
+ */
3813
+ h(this, "handleDocumentKeyDown", (r) => {
3814
+ if (r.key === this.hotkey && this.handleHotkeyPressed(r), !!this.hostElement.contains(document.activeElement))
3815
+ switch (r.key) {
3816
+ case "ArrowDown":
3817
+ case "ArrowUp":
3818
+ r.preventDefault(), this.focusOnNextListItem(r.key);
3819
+ break;
3820
+ case "Escape":
3821
+ $.getState().setPopoverVisibility(!1);
3822
+ break;
3823
+ default:
3824
+ return;
3825
+ }
3826
+ });
3827
+ h(this, "handleInputInit", () => {
3828
+ const r = this.hostElement.querySelector(".searchcraft-input");
3829
+ r == null || r.focus();
3830
+ });
3831
+ this.__registerHost();
3832
+ }
3833
+ get hostElement() {
3834
+ return this;
3835
+ }
3836
+ componentDidLoad() {
3837
+ const r = getComputedStyle(document.documentElement);
3838
+ this.breakpointSm = Number.parseFloat(r.getPropertyValue("--sc-breakpoint-sm").trim()), this.breakpointMd = Number.parseFloat(r.getPropertyValue("--sc-breakpoint-md").trim()), this.breakpointLg = Number.parseFloat(r.getPropertyValue("--sc-breakpoint-lg").trim()), this.isPopoverVisibleInState = $.getState().isPopoverVisible, document.addEventListener("click", this.handleDocumentClick), document.addEventListener("keydown", this.handleDocumentKeyDown), this.unsubscribe = $.subscribe((s) => {
3839
+ this.isPopoverVisibleInState !== s.isPopoverVisible && this.handlePopoverVisibilityChange(s.isPopoverVisible), this.searchClientResponseItems = [...s.searchClientResponseItems], this.adClientResponseItems = [...s.adClientResponseItems], this.searchTerm = s.searchTerm, this.searchResultsPage = s.searchResultsPage, this.searchResultsPerPage = s.searchResultsPerPage;
3840
+ });
3841
+ }
3842
+ disconnectedCallback() {
3843
+ var r;
3844
+ (r = this.unsubscribe) == null || r.call(this), document.removeEventListener("click", this.handleDocumentClick), document.removeEventListener("keydown", this.handleDocumentKeyDown);
3845
+ }
3846
+ /**
3847
+ * Handles when popover visibility is changed in state
3848
+ */
3849
+ handlePopoverVisibilityChange(r) {
3850
+ this.isPopoverVisibleInState = r, document.body.style.overflow = r ? "hidden" : "auto";
3851
+ }
3852
+ /**
3853
+ * When popover is `inline` and the viewport is at the smallest breakpoint,
3854
+ * focusing on the input will open a modal version of the popover form.
3855
+ */
3856
+ handleInputFocus() {
3857
+ this.isFocused = !0, this.type === "inline" && window.visualViewport && window.visualViewport.width < this.breakpointSm && ($.getState().setPopoverVisibility(!0), this.modalElement || (this.modalElement = document.createElement("searchcraft-popover-form"), this.modalElement.popoverResultMappings = this.popoverResultMappings, this.modalElement.setAttribute("type", "fullscreen"), document.body.appendChild(this.modalElement)));
3858
+ }
3859
+ handleModalBackdropClick(r) {
3860
+ $.getState().setPopoverVisibility(!1);
3861
+ }
3862
+ /**
3863
+ * When a hotkey is pressed, tests if the modifiers also match.
3864
+ * If modifiers match, toggles visibility of the popover modal.
3865
+ */
3866
+ handleHotkeyPressed(r) {
3867
+ if (r.ctrlKey && this.hotkeyModifier === "ctrl" || r.altKey && this.hotkeyModifier === "alt" || r.metaKey && this.hotkeyModifier === "meta")
3868
+ if (r.preventDefault(), this.type === "inline" && !this.isPopoverVisibleInState) {
3869
+ const s = this.hostElement.querySelector(".searchcraft-input-form-input");
3870
+ s == null || s.focus();
3871
+ } else
3872
+ $.getState().setPopoverVisibility(!this.isPopoverVisibleInState);
3873
+ }
3874
+ handleCancelButtonClick() {
3875
+ $.getState().setPopoverVisibility(!1);
3876
+ }
3877
+ /**
3878
+ * Moves focus to the next/previous list item in the list view. If you are at the top
3879
+ * of the list view, it moves focus back to the input.
3880
+ *
3881
+ * @param direction
3882
+ */
3883
+ focusOnNextListItem(r) {
3884
+ var o, n;
3885
+ const s = Array.from(document.querySelectorAll("a.searchcraft-popover-form-list-item")).filter((c) => !c.hasAttribute("disabled") && c.offsetParent !== null), a = s.indexOf(document.activeElement);
3886
+ if (r === "ArrowDown")
3887
+ (o = s[(a + 1) % s.length]) == null || o.focus();
3888
+ else if (r === "ArrowUp")
3889
+ if (a >= 1)
3890
+ (n = s[a - 1]) == null || n.focus();
3891
+ else {
3892
+ const c = document.querySelector(".searchcraft-input-form-input");
3893
+ c && (c.focus(), requestAnimationFrame(() => {
3894
+ c.selectionEnd = c.value.length, c.selectionStart = c.value.length;
3895
+ }));
3896
+ }
3897
+ }
3898
+ get hasResultsToShow() {
3899
+ var r, s;
3900
+ return this.searchTerm && ((s = (r = this.searchTerm) == null ? void 0 : r.trim()) == null ? void 0 : s.length) > 0 && this.searchClientResponseItems.length > 0;
3901
+ }
3902
+ renderInlinePopover() {
3903
+ const r = this.hasResultsToShow && this.isFocused, s = ne("searchcraft-popover-form searchcraft-popover-form-inline", {
3904
+ "searchcraft-popover-form-active": r
3905
+ });
3906
+ return d("div", { class: s }, d("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this) }), r && d("div", { class: "searchcraft-popover-form-inline-wrapper-outer" }, d("div", { class: "searchcraft-popover-form-inline-wrapper-inner" }, d("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage }))));
3907
+ }
3908
+ renderModalPopover() {
3909
+ if (this.isPopoverVisibleInState) {
3910
+ const r = ne("searchcraft-popover-form", {
3911
+ "searchcraft-popover-form-active": this.hasResultsToShow
3912
+ });
3913
+ return d("div", { class: "searchcraft-popover-form-modal" }, d("div", { class: "searchcraft-popover-form-modal-backdrop", onClick: this.handleModalBackdropClick }), d("div", { class: "searchcraft-popover-form-modal-inner" }, d("div", { class: r }, d("div", { class: "searchcraft-popover-form-input-wrapper searchcraft-popover-form-modal-input-wrapper" }, d("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this) }), d("button", { type: "button", class: "searchcraft-popover-form-button searchcraft-popover-form-modal-button", onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), this.hasResultsToShow && d("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage }))));
3914
+ }
3915
+ }
3916
+ renderFullscreenPopover() {
3917
+ if (this.isPopoverVisibleInState)
3918
+ return d("div", { class: "searchcraft-popover-form-fullscreen" }, d("div", { class: "searchcraft-popover-form" }, d("div", { class: "searchcraft-popover-form-input-wrapper searchcraft-popover-form-fullscreen-input-wrapper" }, d("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this) }), d("button", { type: "button", class: "searchcraft-popover-form-button searchcraft-popover-form-fullscreen-button", onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), this.hasResultsToShow && d("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage })));
3919
+ }
3920
+ render() {
3921
+ switch (this.type) {
3922
+ case "inline":
3923
+ return this.renderInlinePopover();
3924
+ case "modal":
3925
+ return this.renderModalPopover();
3926
+ case "fullscreen":
3927
+ return this.renderFullscreenPopover();
3928
+ }
3929
+ }
3930
+ }, [0, "searchcraft-popover-form", {
3931
+ type: [1],
3932
+ popoverResultMappings: [16],
3933
+ hotkey: [1],
3934
+ hotkeyModifier: [1, "hotkey-modifier"],
3935
+ isPopoverVisibleInState: [32],
3936
+ unsubscribe: [32],
3937
+ searchClientResponseItems: [32],
3938
+ adClientResponseItems: [32],
3939
+ searchTerm: [32],
3940
+ isFocused: [32],
3941
+ breakpointSm: [32],
3942
+ breakpointMd: [32],
3943
+ breakpointLg: [32],
3944
+ searchResultsPage: [32],
3945
+ searchResultsPerPage: [32],
3946
+ modalElement: [32]
3947
+ }]);
3948
+ function Js() {
3949
+ if (typeof customElements > "u")
3950
+ return;
3951
+ ["searchcraft-popover-form", "searchcraft-ad", "searchcraft-button", "searchcraft-error-message", "searchcraft-input-form", "searchcraft-input-label", "searchcraft-popover-form", "searchcraft-popover-list-item", "searchcraft-popover-list-view"].forEach((t) => {
3952
+ switch (t) {
3953
+ case "searchcraft-popover-form":
3954
+ customElements.get(t) || customElements.define(t, hc);
3955
+ break;
3956
+ case "searchcraft-ad":
3957
+ customElements.get(t) || St();
3958
+ break;
3959
+ case "searchcraft-button":
3960
+ customElements.get(t) || wt();
3961
+ break;
3962
+ case "searchcraft-error-message":
3963
+ customElements.get(t) || Et();
3964
+ break;
3965
+ case "searchcraft-input-form":
3966
+ customElements.get(t) || Xs();
3967
+ break;
3968
+ case "searchcraft-input-label":
3969
+ customElements.get(t) || fr();
3970
+ break;
3971
+ case "searchcraft-popover-form":
3972
+ customElements.get(t) || Js();
3973
+ break;
3974
+ case "searchcraft-popover-list-item":
3975
+ customElements.get(t) || dr();
3976
+ break;
3977
+ case "searchcraft-popover-list-view":
3978
+ customElements.get(t) || Zs();
3979
+ break;
3980
+ }
3981
+ });
3982
+ }
3983
+ const pc = Js, mc = dr, gc = Zs, vc = /* @__PURE__ */ F(class extends O {
3984
+ constructor() {
3985
+ super();
3986
+ /**
3987
+ * A callback function responsible for rendering the results info.
3988
+ *
3989
+ * @example
3990
+ * ```ts
3991
+ * resultsInfo.template = html`
3992
+ * ${range[0]}-${range[1]} of ${count} results in ${responseTime}ms
3993
+ * `;
3994
+ * ```
3995
+ */
3996
+ h(this, "template");
3997
+ // store vars
3998
+ h(this, "searchTerm");
3999
+ h(this, "searchResultsPage");
4000
+ h(this, "searchResultsPerPage");
4001
+ h(this, "searchResultsCount");
4002
+ // local vars
4003
+ h(this, "count", 0);
4004
+ h(this, "range", [0, 0]);
4005
+ h(this, "responseTime", "0");
4006
+ h(this, "unsubscribe", () => {
4007
+ });
4008
+ this.__registerHost();
4009
+ }
4010
+ connectedCallback() {
4011
+ this.unsubscribe = $.subscribe((r) => {
4012
+ this.searchTerm = r.searchTerm, this.searchResultsPage = r.searchResultsPage, this.searchResultsPerPage = r.searchResultsPerPage, this.searchResultsCount = r.searchResultsCount, this.count = this.searchResultsCount, this.range[0] = this.searchResultsPage <= 1 ? 1 : this.searchResultsPerPage * (this.searchResultsPage - 1), this.range[1] = this.searchResultsPerPage * this.searchResultsPage, this.range[1] = this.range[1] > this.searchResultsCount ? this.searchResultsCount : this.range[1], this.responseTime = ((r.searchResponseTimeTaken || 0) * 1e3).toFixed(2);
4013
+ });
4014
+ }
4015
+ disconnectedCallback() {
4016
+ this.unsubscribe && this.unsubscribe();
4017
+ }
4018
+ render() {
4019
+ return !this.searchTerm || this.searchResultsCount === 0 ? null : d("p", { class: "searchcraft-results-info" }, typeof this.template < "u" ? this.template({
4020
+ range: [Number(this.range[0]), Number(this.range[1])],
4021
+ count: this.count,
4022
+ responseTime: this.responseTime
4023
+ }, { html: ur }) : `${Yo(this.count)} results found in ${this.responseTime}ms`);
4024
+ }
4025
+ }, [0, "searchcraft-results-info", {
4026
+ template: [16],
4027
+ searchTerm: [32],
4028
+ searchResultsPage: [32],
4029
+ searchResultsPerPage: [32],
4030
+ searchResultsCount: [32],
4031
+ count: [32],
4032
+ range: [32],
4033
+ responseTime: [32]
4034
+ }]);
4035
+ function bc() {
4036
+ if (typeof customElements > "u")
4037
+ return;
4038
+ ["searchcraft-results-info"].forEach((t) => {
4039
+ switch (t) {
4040
+ case "searchcraft-results-info":
4041
+ customElements.get(t) || customElements.define(t, vc);
4042
+ break;
4043
+ }
4044
+ });
4045
+ }
4046
+ const yc = bc, Sc = /* @__PURE__ */ F(class extends O {
4047
+ constructor() {
4048
+ super();
4049
+ h(this, "item");
4050
+ /**
4051
+ * The index.
4052
+ */
4053
+ h(this, "index");
4054
+ /**
4055
+ * The position in the document. Used with the "document_clicked" measure event.
4056
+ */
4057
+ h(this, "documentPosition", 0);
4058
+ /**
4059
+ * A callback function responsible for rendering a result.
4060
+ */
4061
+ h(this, "template");
4062
+ h(this, "templateHtml");
4063
+ this.__registerHost();
4064
+ }
4065
+ connectedCallback() {
4066
+ var r;
4067
+ if (this.item)
4068
+ try {
4069
+ this.templateHtml = (r = this.template) == null ? void 0 : r.call(this, this.item.document, this.index, {
4070
+ html: ur
4071
+ });
4072
+ } catch (s) {
4073
+ console.error(`Invalid search result template: ${s}`);
4074
+ }
4075
+ }
4076
+ render() {
4077
+ if (this.item)
4078
+ return typeof this.template > "u" ? d("div", { class: "searchcraft-search-result searchcraft-search-result-no-template" }, Object.entries(this.item.document).map(([r, s]) => d("p", { key: r }, d("strong", null, r), ": ", s))) : d("div", { class: "searchcraft-search-result", innerHTML: this.templateHtml });
4079
+ }
4080
+ }, [0, "searchcraft-search-result", {
4081
+ item: [16],
4082
+ index: [2],
4083
+ documentPosition: [2, "document-position"],
4084
+ template: [16],
4085
+ templateHtml: [32]
4086
+ }]);
4087
+ function ea() {
4088
+ if (typeof customElements > "u")
4089
+ return;
4090
+ ["searchcraft-search-result"].forEach((t) => {
4091
+ switch (t) {
4092
+ case "searchcraft-search-result":
4093
+ customElements.get(t) || customElements.define(t, Sc);
4094
+ break;
4095
+ }
4096
+ });
4097
+ }
4098
+ const wc = ea, Ec = /* @__PURE__ */ F(class extends O {
4099
+ constructor() {
4100
+ super();
4101
+ /**
4102
+ * A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
4103
+ */
4104
+ h(this, "template");
4105
+ h(this, "searchTerm", "");
4106
+ h(this, "searchClientResponseItems");
4107
+ h(this, "adClientResponseItems", []);
4108
+ h(this, "searchResultsPerPage");
4109
+ h(this, "searchResultsPage");
4110
+ h(this, "isSearchInProgress", !0);
4111
+ h(this, "config");
4112
+ h(this, "unsubscribe", () => {
4113
+ });
4114
+ this.__registerHost();
4115
+ }
4116
+ componentDidLoad() {
4117
+ var s;
4118
+ this.unsubscribe = $.subscribe((a) => this.handleStateChange(a));
4119
+ const r = $.getState();
4120
+ this.handleStateChange(r), this.searchClientResponseItems = r.searchClientResponseItems, this.searchTerm = r.searchTerm, this.config = (s = r.core) == null ? void 0 : s.config;
4121
+ }
4122
+ disconnectedCallback() {
4123
+ var r;
4124
+ (r = this.unsubscribe) == null || r.call(this);
4125
+ }
4126
+ handleStateChange(r) {
4127
+ var s;
4128
+ this.searchClientResponseItems = [...r.searchClientResponseItems], this.adClientResponseItems = [...r.adClientResponseItems], this.searchTerm = r.searchTerm, this.searchResultsPage = r.searchResultsPage, this.searchResultsPerPage = r.searchResultsPerPage, this.config = (s = r.core) == null ? void 0 : s.config, this.isSearchInProgress = r.isSearchInProgress;
4129
+ }
4130
+ renderEmptyState() {
4131
+ return d("div", { class: "searchcraft-search-results-empty-state" }, d("slot", { name: "empty-search" }));
4132
+ }
4133
+ renderNoResultsFoundState() {
4134
+ return d("div", { class: "searchcraft-search-results" }, d("div", { class: "searchcraft-search-results-error-message" }, d("searchcraft-error-message", null, 'No search results found for "', this.searchTerm, '" query.')));
4135
+ }
4136
+ renderWithADMAds() {
4137
+ var r, s;
4138
+ return d("div", { class: "searchcraft-search-results" }, (r = this.adClientResponseItems) == null ? void 0 : r.map((a) => d("searchcraft-ad", { adSource: "adMarketplace", adClientResponseItem: a, adContainerId: X(), key: a.id })), (s = this.searchClientResponseItems) == null ? void 0 : s.map((a, o) => d("searchcraft-search-result", { key: a.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + o, index: o, item: a, template: this.template })));
4139
+ }
4140
+ renderWithCustomAds() {
4141
+ var f, u, i, p;
4142
+ const r = [], s = ((f = this.config) == null ? void 0 : f.customAdInterstitialInterval) || 0, a = ((u = this.config) == null ? void 0 : u.customAdInterstitialQuantity) || 1, o = ((i = this.config) == null ? void 0 : i.customAdStartQuantity) || 0, n = ((p = this.config) == null ? void 0 : p.customAdEndQuantity) || 0, c = this.searchClientResponseItems || [];
4143
+ for (let m = 0; m < o; m++)
4144
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m}-ad` }));
4145
+ c.forEach((m, y) => {
4146
+ if (s && y % s === 0 && y + s < c.length && y >= s)
4147
+ for (let v = 0; v < a; v++)
4148
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m.id}-ad-${v}` }));
4149
+ r.push(d("searchcraft-search-result", { key: m.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + y, index: y, item: m, template: this.template }));
4150
+ });
4151
+ for (let m = 0; m < n; m++)
4152
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m}-ad` }));
4153
+ return d("div", { class: "searchcraft-search-results" }, r);
4154
+ }
4155
+ renderWithNativoAds() {
4156
+ var u, i, p, m, y;
4157
+ const r = [], s = ((u = this.config) == null ? void 0 : u.nativoAdInterstialStartIndex) || 0, a = ((i = this.config) == null ? void 0 : i.nativoAdInterstitialInterval) || 0, o = ((p = this.config) == null ? void 0 : p.nativoAdInterstitialQuantity) || 1, n = ((m = this.config) == null ? void 0 : m.nativoAdStartQuantity) || 0, c = ((y = this.config) == null ? void 0 : y.nativoAdEndQuantity) || 0, f = this.searchClientResponseItems || [];
4158
+ for (let v = 0; v < n; v++)
4159
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v}-ad` }));
4160
+ f.forEach((v, x) => {
4161
+ if (a && (x + s) % a === 0 && x + a < f.length && x >= a)
4162
+ for (let U = 0; U < o; U++)
4163
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v.id}-ad-${U}` }));
4164
+ r.push(d("searchcraft-search-result", { key: v.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + x, index: x, item: v, template: this.template }));
4165
+ });
4166
+ for (let v = 0; v < c; v++)
4167
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v}-ad` }));
4168
+ return d("div", { class: "searchcraft-search-results" }, r);
4169
+ }
4170
+ renderWithNoAds() {
4171
+ var r;
4172
+ return d("div", { class: "searchcraft-search-results" }, (r = this.searchClientResponseItems) == null ? void 0 : r.map((s, a) => d("searchcraft-search-result", { key: s.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + a, index: a, item: s, template: this.template })));
4173
+ }
4174
+ render() {
4175
+ var r;
4176
+ if (this.searchTerm.trim() === "")
4177
+ return this.renderEmptyState();
4178
+ if (this.searchTerm.length > 0 && (this.searchClientResponseItems || []).length === 0 && !this.isSearchInProgress)
4179
+ return this.renderNoResultsFoundState();
4180
+ switch (((r = this.config) == null ? void 0 : r.adSource) || "None") {
4181
+ case "adMarketplace":
4182
+ return this.renderWithADMAds();
4183
+ case "Custom":
4184
+ return this.renderWithCustomAds();
4185
+ case "Nativo":
4186
+ return this.renderWithNativoAds();
4187
+ default:
4188
+ return this.renderWithNoAds();
4189
+ }
4190
+ }
4191
+ }, [4, "searchcraft-search-results", {
4192
+ template: [16],
4193
+ searchTerm: [32],
4194
+ searchClientResponseItems: [32],
4195
+ adClientResponseItems: [32],
4196
+ searchResultsPerPage: [32],
4197
+ searchResultsPage: [32],
4198
+ isSearchInProgress: [32],
4199
+ config: [32]
4200
+ }]);
4201
+ function Rc() {
4202
+ if (typeof customElements > "u")
4203
+ return;
4204
+ ["searchcraft-search-results", "searchcraft-ad", "searchcraft-error-message", "searchcraft-search-result"].forEach((t) => {
4205
+ switch (t) {
4206
+ case "searchcraft-search-results":
4207
+ customElements.get(t) || customElements.define(t, Ec);
4208
+ break;
4209
+ case "searchcraft-ad":
4210
+ customElements.get(t) || St();
4211
+ break;
4212
+ case "searchcraft-error-message":
4213
+ customElements.get(t) || Et();
4214
+ break;
4215
+ case "searchcraft-search-result":
4216
+ customElements.get(t) || ea();
4217
+ break;
4218
+ }
4219
+ });
4220
+ }
4221
+ const Tc = Rc, kc = /* @__PURE__ */ F(class extends O {
4222
+ constructor() {
4223
+ super();
4224
+ /**
4225
+ * The caption displayed below the select input.
4226
+ */
4227
+ h(this, "caption");
4228
+ /**
4229
+ * Whether the select input is disabled.
4230
+ */
4231
+ h(this, "disabled", !1);
4232
+ /**
4233
+ * The ID for the select input.
4234
+ */
4235
+ h(this, "inputId");
4236
+ /**
4237
+ * The label of the select input.
4238
+ */
4239
+ h(this, "label");
4240
+ /**
4241
+ * The ID for the label of the select input.
4242
+ */
4243
+ h(this, "labelId");
4244
+ /**
4245
+ * The name of the select input.
4246
+ */
4247
+ h(this, "name");
4248
+ /**
4249
+ * The options for the select input.
4250
+ */
4251
+ h(this, "options", []);
4252
+ /**
4253
+ * The event fired when the select is changed.
4254
+ */
4255
+ h(this, "selectChange");
4256
+ h(this, "searchResultsPerPage");
4257
+ h(this, "setSearchResultsPage", () => {
4258
+ });
4259
+ h(this, "setSearchResultsPerPage", () => {
4260
+ });
4261
+ h(this, "handleSelectChange", (r) => {
4262
+ this.selectChange.emit(r.target.value);
4263
+ });
4264
+ this.__registerHost(), this.selectChange = ve(this, "selectChange");
4265
+ }
4266
+ handleGoToPage(r) {
4267
+ this.setSearchResultsPage(r);
4268
+ }
4269
+ render() {
4270
+ return d("div", { key: "15ecbf48c824a161cd83bdab99dace8e44f1ab39", class: "searchcraft-select" }, this.label && d("label", { key: "aba433ae9c27c9405099cffcef923c3ad22d7fda", class: "searchcraft-select-label", id: this.labelId || `${this.inputId}-label`, htmlFor: this.inputId }, this.label), d("div", { key: "8df8a2ff05924c9c55cdd6e3827cd927cddab82a", class: "searchcraft-select-input-wrapper" }, d("select", { key: "1d5f492c2255f8ca1b6ea5e04a2726dda2f2c52f", "aria-labelledby": this.label ? this.labelId || `${this.inputId}-label` : void 0, class: "searchcraft-select-input", disabled: this.disabled, id: this.inputId, name: this.name, onChange: this.handleSelectChange }, (typeof this.options == "string" ? JSON.parse(this.options) : this.options).map(({ label: r, value: s, selected: a }) => d("option", { key: s, value: s, selected: a }, r))), d("svg", { key: "0ec6892b529f2e70027aadea47208582a65a97b7", class: "searchcraft-select-input-icon", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d("title", { key: "bced6b62378491d1d1c629b602d7d033d912c761" }, "Select dropdown icon"), d("path", { key: "659f8ebf9129e2e7941da949d29688c41c1472bb", d: "M5 7.5L10 12.5L15 7.5", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }))), this.caption && d("p", { key: "51217d926f68f79b6c3514f5fd769b56549fdce9", class: "searchcraft-select-caption" }, this.caption));
4271
+ }
4272
+ }, [0, "searchcraft-select", {
4273
+ caption: [1],
4274
+ disabled: [4],
4275
+ inputId: [1, "input-id"],
4276
+ label: [1],
4277
+ labelId: [1, "label-id"],
4278
+ name: [1],
4279
+ options: [1],
4280
+ searchResultsPerPage: [32],
4281
+ setSearchResultsPage: [32],
4282
+ setSearchResultsPerPage: [32]
4283
+ }]);
4284
+ function ta() {
4285
+ if (typeof customElements > "u")
4286
+ return;
4287
+ ["searchcraft-select"].forEach((t) => {
4288
+ switch (t) {
4289
+ case "searchcraft-select":
4290
+ customElements.get(t) || customElements.define(t, kc);
4291
+ break;
4292
+ }
4293
+ });
4294
+ }
4295
+ const Cc = /* @__PURE__ */ F(class extends O {
4296
+ constructor() {
4297
+ super();
4298
+ /**
4299
+ * The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]).
4300
+ * The base value is defined by the `searchResultsPerPage` option in the configuration.
4301
+ */
4302
+ h(this, "increment", 20);
4303
+ // store vars
4304
+ h(this, "searchTerm");
4305
+ h(this, "searchResultsPage");
4306
+ h(this, "searchResultsPerPage");
4307
+ h(this, "searchResultsCount");
4308
+ h(this, "searchResultsPagesCount");
4309
+ // local vars
4310
+ h(this, "initialSearchResultsPerPage");
4311
+ // store functions
4312
+ h(this, "setSearchResultsPerPage", () => {
4313
+ });
4314
+ h(this, "setSearchResultsPage", () => {
4315
+ });
4316
+ h(this, "unsubscribe", () => {
4317
+ });
4318
+ this.__registerHost();
4319
+ }
4320
+ componentDidLoad() {
4321
+ this.unsubscribe = $.subscribe((r) => {
4322
+ this.searchTerm = r.searchTerm, this.searchResultsPerPage = r.searchResultsPerPage, this.searchResultsPage = r.searchResultsPage, this.searchResultsCount = r.searchResultsCount, this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage), this.setSearchResultsPage = r.setSearchResultsPage, this.setSearchResultsPerPage = r.setSearchResultsPerPage;
4323
+ }), this.initialSearchResultsPerPage = $.getState().searchResultsPerPage;
4324
+ }
4325
+ disconnectedCallback() {
4326
+ var r;
4327
+ (r = this.unsubscribe) == null || r.call(this);
4328
+ }
4329
+ render() {
4330
+ if (!(!this.searchTerm || this.searchResultsPagesCount <= 1))
4331
+ return d("div", { class: "searchcraft-search-results-per-page" }, d("div", { class: "searchcraft-search-results-per-page-select" }, d("label", { class: "searchcraft-search-results-per-page-select-label", htmlFor: "searchcraft-search-results-per-page-select-input" }, "Results Per Page"), d("div", { class: "searchcraft-search-results-per-page-select-input" }, d("searchcraft-select", { inputId: "searchcraft-search-results-per-page-select-input", name: "results-per-page", options: [...Array(5)].map((r, s) => {
4332
+ const a = this.initialSearchResultsPerPage + Number(this.increment) * s;
4333
+ return {
4334
+ label: `${a}`,
4335
+ value: a
4336
+ };
4337
+ }), onSelectChange: (r) => {
4338
+ this.setSearchResultsPerPage(Number(r.detail)), this.setSearchResultsPage(1);
4339
+ } }))));
4340
+ }
4341
+ }, [0, "searchcraft-search-results-per-page", {
4342
+ increment: [8],
4343
+ searchTerm: [32],
4344
+ searchResultsPage: [32],
4345
+ searchResultsPerPage: [32],
4346
+ searchResultsCount: [32],
4347
+ searchResultsPagesCount: [32],
4348
+ initialSearchResultsPerPage: [32],
4349
+ setSearchResultsPerPage: [32],
4350
+ setSearchResultsPage: [32]
4351
+ }]);
4352
+ function Pc() {
4353
+ if (typeof customElements > "u")
4354
+ return;
4355
+ ["searchcraft-search-results-per-page", "searchcraft-select"].forEach((t) => {
4356
+ switch (t) {
4357
+ case "searchcraft-search-results-per-page":
4358
+ customElements.get(t) || customElements.define(t, Cc);
4359
+ break;
4360
+ case "searchcraft-select":
4361
+ customElements.get(t) || ta();
4362
+ break;
4363
+ }
4364
+ });
4365
+ }
4366
+ const xc = Pc, $c = ta, _c = Qs, Ac = `:root{--sc-text-base-size: 1em;--sc-text-scale-ratio: 1.1;--sc-font-family: sans-serif;--sc-font-bold: 700;--sc-font-normal: 400;--sc-heading-1-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-2-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-3-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-4-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-5-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-6-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) );--sc-body-font-size: calc(var(--sc-text-base-size));--sc-body-small-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) )}:root{--sc-border-radius: 8px;--sc-border-radius-sm: calc(var(--sc-border-radius) / 2);--sc-border-radius-lg: calc(var(--sc-border-radius) * 2);--sc-border-radius-full: 9999px}:root{--sc-breakpoint-sm: 576px;--sc-breakpoint-md: 768px;--sc-breakpoint-lg: 992px}:root{--sc-surface-neutral-primary: var(--sc-color-background, #ffffff);--sc-color-background-hover: hsl( from var(--sc-color-background) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-primary-hover: var(--sc-color-background-hover, #fafafa);--sc-color-background-active: hsl( from var(--sc-color-background) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-primary-active: var( --sc-color-background-active, #f7f7f7 );--sc-surface-neutral-secondary: var( --sc-color-background-secondary, var(--sc-color-background, #f3f3f3) );--sc-surface-neutral-secondary-hover: var( --sc-color-background-secondary-hover, var(--sc-color-background-hover, #e6e6e6) );--sc-surface-neutral-secondary-active: var( --sc-color-background-secondary-active, var(--sc-color-background-active, #e0e0e0) );--sc-surface-neutral-light: #ffffff;--sc-content-neutral-primary: var(--sc-color-foreground, #292929);--sc-color-foreground-secondary: hsl( from var(--sc-color-foreground) h s clamp(10, calc(l + 5), 90) );--sc-content-neutral-secondary: var(--sc-color-foreground-secondary, #404040);--sc-border-neutral: rgba(0, 0, 0, 0.1);--sc-surface-brand-primary: var(--sc-color-brand, #000000);--sc-color-brand-hover: hsl( from var(--sc-color-brand) h s clamp(20, calc(l + 5), 95) );--sc-surface-brand-primary-hover: var(--sc-color-brand-hover, #2e2e2e);--sc-color-brand-active: hsl( from var(--sc-color-brand) h s clamp(10, calc(l - 5), 85) );--sc-surface-brand-primary-active: var(--sc-color-brand-active, #292929);--sc-surface-brand-secondary: var( --sc-color-brand-secondary, var(--sc-color-brand, #e6e6e6) );--sc-surface-brand-secondary-hover: var( --sc-color-brand-secondary-hover, var(--sc-color-brand-hover, #ebebeb) );--sc-surface-brand-secondary-active: var( --sc-color-brand-secondary-active, var(--sc-color-brand-active, #e0e0e0) );--sc-content-brand: var( --sc-color-brand-text, var(--sc-surface-brand-primary) );--sc-content-brand-on-primary: #ffffff;--sc-border-brand: var(--sc-surface-brand-primary);--sc-surface-success-primary: var(--sc-color-success, #008000);--sc-color-success-primary-hover: hsl(from var(--sc-color-success) h s 30);--sc-surface-success-primary-hover: var( --sc-color-success-primary-hover, #009900 );--sc-color-success-primary-active: hsl(from var(--sc-color-success) h s 20);--sc-surface-success-primary-active: var( --sc-color-success-primary-active, #006600 );--sc-color-success-secondary: hsl(from var(--sc-color-success) h s 90);--sc-surface-success-secondary: var(--sc-color-success-secondary, #ccffcc);--sc-color-success-secondary-hover: hsl( from var(--sc-color-success-secondary) h s 95 );--sc-surface-success-secondary-hover: var( --sc-color-success-secondary-hover, #e6ffe6 );--sc-color-success-secondary-active: hsl( from var(--sc-color-success-secondary) h s 85 );--sc-surface-success-secondary-active: var( --sc-color-success-secondary-active, #b2ffb2 );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30) );--sc-content-success-on-primary: #ffffff;--sc-border-success: var(--sc-surface-success-primary);--sc-surface-caution-primary: var(--sc-color-caution, #cc6600);--sc-color-caution-primary-hover: hsl(from var(--sc-color-caution) h s 30);--sc-surface-caution-primary-hover: var( --sc-color-caution-primary-hover, #e57300 );--sc-color-caution-primary-active: hsl(from var(--sc-color-caution) h s 20);--sc-surface-caution-primary-active: var( --sc-color-caution-primary-active, #b25a00 );--sc-color-caution-secondary: hsl(from var(--sc-color-caution) h s 90);--sc-surface-caution-secondary: var(--sc-color-caution-secondary, #ffd9b3);--sc-color-caution-secondary-hover: hsl( from var(--sc-color-caution-secondary) h s 95 );--sc-surface-caution-secondary-hover: var( --sc-color-caution-secondary-hover, #ffe5cc );--sc-color-caution-secondary-active: hsl( from var(--sc-color-caution-secondary) h s 85 );--sc-surface-caution-secondary-active: var( --sc-color-caution-secondary-active, #ffcc99 );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30) );--sc-content-caution-on-primary: #ffffff;--sc-border-caution: var(--sc-surface-caution-primary);--sc-surface-danger-primary: var(--sc-color-danger, #cc0000);--sc-color-danger-primary-hover: hsl(from var(--sc-color-danger) h s 30);--sc-surface-danger-primary-hover: var( --sc-color-danger-primary-hover, #e50000 );--sc-color-danger-primary-active: hsl(from var(--sc-color-danger) h s 20);--sc-surface-danger-primary-active: var( --sc-color-danger-primary-active, #b30000 );--sc-color-danger-secondary: hsl(from var(--sc-color-danger) h s 90);--sc-surface-danger-secondary: var(--sc-color-danger-secondary, #ffcccc);--sc-color-danger-secondary-hover: hsl( from var(--sc-color-danger-secondary) h s 95 );--sc-surface-danger-secondary-hover: var( --sc-color-danger-secondary-hover, #ffe7e7 );--sc-color-danger-secondary-active: hsl( from var(--sc-color-danger-secondary) h s 85 );--sc-surface-danger-secondary-active: var( --sc-color-danger-secondary-active, #ffb3b3 );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30) );--sc-content-danger-on-primary: #ffffff;--sc-border-danger: var(--sc-surface-danger-primary);--sc-color-disabled: hsl(from var(--sc-color-page-primary) h s calc(l * 0.5));--sc-surface-disabled: var(--sc-color-disabled, #d9d9d9);--sc-color-disabled-text: hsl( from var(--sc-color-text-primary) h s calc(l * 0.5) );--sc-content-disabled: var(--sc-color-disabled-text, #737373);--sc-content-disabled-on-disabled: var(--sc-color-disabled-text, #737373)}@supports(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none){:root{--sc-color-background-hover: hsl( from var(--sc-color-background) h s clamp(10%, calc(l + 5%), 95%) );--sc-color-background-active: hsl( from var(--sc-color-background) h s clamp(5%, calc(l - 5%), 90%) );--sc-color-foreground-secondary: hsl( from var(--sc-color-foreground) h s clamp(10%, calc(l + 5%), 90%) );--sc-color-brand-hover: hsl( from var(--sc-color-brand) h s clamp(20%, calc(l + 5%), 95%) );--sc-color-brand-active: hsl( from var(--sc-color-brand) h s clamp(10%, calc(l - 5%), 85%) );--sc-color-success-primary-hover: hsl(from var(--sc-color-success) h s 30%);--sc-color-success-primary-active: hsl( from var(--sc-color-success) h s 20% );--sc-color-success-secondary: hsl(from var(--sc-color-success) h s 90%);--sc-color-success-secondary-hover: hsl( from var(--sc-color-success-secondary) h s 95% );--sc-color-success-secondary-active: hsl( from var(--sc-color-success-secondary) h s 85% );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30%) );--sc-color-caution-primary-hover: hsl(from var(--sc-color-caution) h s 30%);--sc-color-caution-primary-active: hsl( from var(--sc-color-caution) h s 20% );--sc-color-caution-secondary: hsl(from var(--sc-color-caution) h s 90%);--sc-color-caution-secondary-hover: hsl( from var(--sc-color-caution-secondary) h s 95% );--sc-color-caution-secondary-active: hsl( from var(--sc-color-caution-secondary) h s 85% );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30%) );--sc-color-danger-primary-hover: hsl(from var(--sc-color-danger) h s 30%);--sc-color-danger-primary-active: hsl(from var(--sc-color-danger) h s 20%);--sc-color-danger-secondary: hsl(from var(--sc-color-danger) h s 90%);--sc-color-danger-secondary-hover: hsl( from var(--sc-color-danger-secondary) h s 95% );--sc-color-danger-secondary-active: hsl( from var(--sc-color-danger-secondary) h s 85% );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30%) )}}.searchcraft-custom-ad{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size)}.searchcraft-adm-ad{all:unset;border:2px solid blue;border-radius:var(--sc-border-radius);cursor:pointer;display:flex;flex-direction:row;gap:8px;padding:var(--sc-popover-list-item-padding-vertical) var(--sc-popover-list-item-padding-horizontal)}.searchcraft-adm-ad:focus{background-color:var(--sc-surface-neutral-secondary-active);color:var(--sc-content-neutral-secondary)}.searchcraft-adm-ad:hover{background-color:var(--sc-surface-neutral-secondary-hover);color:var(--sc-content-neutral-secondary)}.searchcraft-adm-ad-title{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:inherit;margin:0}.searchcraft-adm-ad-subtitle{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:inherit;margin:0}.searchcraft-adm-ad-image-wrapper{align-items:center;display:flex;flex-shrink:0;height:var(--sc-popover-list-item-image-size);justify-content:center;width:var(--sc-popover-list-item-image-size)}.searchcraft-adm-ad-image{max-height:var(--sc-popover-list-item-image-size);max-width:var(--sc-popover-list-item-image-size)}.searchcraft-adm-ad-info-wrapper{display:flex;flex-direction:column;gap:8px;justify-content:center}.searchcraft-search-result{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size)}.searchcraft-search-result-no-template{display:flex;flex-direction:column;font-size:.875rem}.searchcraft-search-result-no-template>p{margin:0}.searchcraft-search-results{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-results-empty-state{text-align:center}.searchcraft-search-results-error-message{text-align:center}.searchcraft-button{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);background:none;border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;gap:4px;padding:12px;position:relative}.searchcraft-button.searchcraft-button-disabled{cursor:not-allowed}.searchcraft-button-primary{background-color:var(--sc-surface-brand-primary);color:var(--sc-content-brand-on-primary);font-weight:var(--sc-font-bold)}.searchcraft-button-primary:hover{background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button-primary:focus{border-color:var(--sc-border-primary)}.searchcraft-button-primary:active{background-color:var(--sc-surface-brand-primary-active)}.searchcraft-button-primary.searchcraft-button-disabled,.searchcraft-button-primary.searchcraft-button-disabled:hover,.searchcraft-button-primary.searchcraft-button-disabled:focus,.searchcraft-button-primary.searchcraft-button-disabled:active{background-color:var(--sc-surface-disabled);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-tertiary{background-color:var(--sc-surface-neutral-primary);color:var(--sc-content-brand);font-weight:var(--sc-font-normal)}.searchcraft-button-tertiary:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-button-tertiary:focus{background-color:var(--sc-surface-neutral-light);border-color:var(--sc-border-primary)}.searchcraft-button-tertiary:active{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-button-tertiary.searchcraft-button-disabled,.searchcraft-button-tertiary.searchcraft-button-disabled:hover,.searchcraft-button-tertiary.searchcraft-button-disabled:focus,.searchcraft-button-tertiary.searchcraft-button-disabled:active{background-color:var(--sc-surface-neutral-light);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-icon{fill:none}.searchcraft-error-message{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-danger);margin:0}.searchcraft-facet-list{width:100%}.searchcraft-facet-list-checkbox-label{align-items:center;color:var(--sc-content-brand);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.searchcraft-facet-list-checkbox-input{align-items:center;appearance:none;background-color:var(--sc-surface-neutral-secondary);border:1px solid var(--sc-surface-disabled);border-radius:var(--sc-border-radius-sm);cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.searchcraft-facet-list-checkbox-input:focus{outline:2px solid var(--sc-surface-brand-primary)}.searchcraft-facet-list-checkbox-input:checked{background-color:var(--sc-surface-brand-primary);position:relative}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-check-icon{display:block}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-dash-icon{display:block}.searchcraft-facet-list-child-checkbox-label{margin-left:24px}.searchcraft-facet-list-checkbox-input-check-icon{display:none;height:16px;left:8px;position:absolute;top:9px;width:16px}.searchcraft-facet-list-checkbox-input-dash-icon{display:none;height:3px;left:9px;position:absolute;top:3px;width:14px}.searchcraft-facet-list-message{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-disabled);text-align:center}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-bold)}:root{--sc-input-form-border-radius: var(--sc-border-radius);--sc-input-form-search-icon-size: 20px;--sc-input-form-clear-icon-size: 20px;--sc-input-form-padding-left: 44px;--sc-input-form-padding-right: 44px}.searchcraft-input-form-grid{display:grid;gap:4px 8px}.searchcraft-input-form-grid-button-left{grid-template-rows:repeat(3, auto);grid-template-columns:auto 1fr}.searchcraft-input-form-grid-button-left .searchcraft-input-form-button{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-label{grid-column:2/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-error-message{grid-column:2/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-input-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right{grid-template-rows:repeat(3, auto);grid-template-columns:1fr auto}.searchcraft-input-form-grid-button-right .searchcraft-input-form-button{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-none{grid-template-rows:repeat(3, auto);grid-template-columns:auto}.searchcraft-input-form-grid-button-none .searchcraft-input-form-button{display:none}.searchcraft-input-form-grid-button-none .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-input-wrapper{display:flex;position:relative}.searchcraft-input-form-input{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);background-color:var(--sc-surface-neutral-secondary);border-radius:var(--sc-input-form-border-radius);border:none;color:var(--sc-content-neutral-primary);flex:1;outline:none;padding:12px var(--sc-input-form-padding-left)}.searchcraft-input-form-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input-form-input:focus{outline:var(--sc-border-brand) solid 2px}.searchcraft-input-form-input:focus::placeholder{opacity:0}.searchcraft-input-form-error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-input-icon{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;pointer-events:none;top:0;width:var(--sc-input-form-padding-left)}.searchcraft-input-form-input-search-icon{color:var(--sc-content-neutral-secondary);fill:none;height:var(--sc-input-form-search-icon-size);pointer-events:none;width:var(--sc-input-form-search-icon-size)}.searchcraft-input-form-clear-button{all:unset;align-items:center;bottom:0;border:none;cursor:pointer;display:flex;justify-content:center;outline:none;position:absolute;right:0;top:0;width:var(--sc-input-form-padding-right)}.searchcraft-input-form-clear-button-icon{color:var(--sc-content-brand);fill:none;height:var(--sc-input-form-clear-icon-size);width:var(--sc-input-form-clear-icon-size)}.searchcraft-input-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-neutral-primary);font-weight:var(--sc-font-bold);margin-top:4px;margin-bottom:4px}:root{--sc-popover-form-border-radius: var(--sc-border-radius);--sc-popover-list-view-height: 400px;--sc-popover-list-item-image-size: 60px;--sc-popover-list-item-padding-horizontal: 8px;--sc-popover-list-item-padding-vertical: 8px;--sc-popover-modal-max-width: 570px}.searchcraft-popover-form{display:flex;flex:1;flex-direction:column}.searchcraft-popover-form-input-wrapper{background-color:var(--sc-surface-neutral-secondary);display:flex;flex-direction:row;gap:4px;padding:12px}.searchcraft-popover-form-input-wrapper>searchcraft-input-form{flex:1}.searchcraft-popover-form-button{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);border:0;border-radius:var(--sc-popover-form-border-radius);background:none;cursor:pointer;flex-shrink:0;outline:0;padding:0 12px}.searchcraft-popover-form-button:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-popover-form-button:focus{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-popover-form-inline .searchcraft-input-form-input{border-top-left-radius:var(--sc-popover-form-border-radius);border-bottom-left-radius:var(--sc-popover-form-border-radius);border-bottom-right-radius:var(--sc-popover-form-border-radius);border-top-right-radius:var(--sc-popover-form-border-radius);border:none;outline:none}.searchcraft-popover-form-inline.searchcraft-popover-form-active .searchcraft-input-form-input{border-bottom-left-radius:0;border-bottom-right-radius:0;border-top-left-radius:var(--sc-popover-form-border-radius);border-top-right-radius:var(--sc-popover-form-border-radius)}.searchcraft-popover-form-inline-wrapper-outer{position:relative}.searchcraft-popover-form-inline-wrapper-inner{height:var(--sc-popover-list-view-height);position:absolute;width:100%;z-index:1000}.searchcraft-popover-form-inline .searchcraft-popover-list-view{background-color:var(--sc-surface-neutral-secondary);border-bottom-left-radius:var(--sc-popover-form-border-radius);border-bottom-right-radius:var(--sc-popover-form-border-radius);display:flex;flex-direction:column;max-height:var(--sc-popover-list-view-height);overflow:auto}.searchcraft-popover-form-modal{--sc-popover0-form-border-radius: var(--sc-border-radius-lg);align-items:flex-start;background-color:var(--sc-surface-neutral-secondary);display:flex;inset:0;justify-content:center;padding:0;position:fixed;z-index:1000}@media(min-width: 576px){.searchcraft-popover-form-modal{background-color:rgba(0,0,0,0);padding:16px}}.searchcraft-popover-form-modal .searchcraft-popover-list-view{background-color:var(--sc-surface-neutral-secondary);border-bottom-left-radius:0;border-bottom-right-radius:0;display:flex;flex-direction:column;overflow:auto}@media(min-width: 576px){.searchcraft-popover-form-modal .searchcraft-popover-list-view{max-height:var(--sc-popover-list-view-height)}}.searchcraft-popover-form-modal .searchcraft-popover-list-view{overflow:scroll}@media(min-width: 576px){.searchcraft-popover-form-modal .searchcraft-popover-list-view{overflow:auto}}.searchcraft-popover-form-modal{border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px);outline-width:1px;outline-color:var(--sc-border-neutral)}.searchcraft-popover-form-modal-backdrop{background-color:rgba(0,0,0,.5);display:none;inset:0;position:absolute}@media(min-width: 576px){.searchcraft-popover-form-modal-backdrop{display:block}}.searchcraft-popover-form-modal-inner{border-radius:var(--sc-popover-form-border-radius);display:flex;inset:0;margin-top:0px;overflow:hidden;position:absolute;z-index:1002}@media(min-width: 576px){.searchcraft-popover-form-modal-inner{inset:auto;margin-top:100px;max-width:var(--sc-popover-modal-max-width);position:relative;width:100%}}.searchcraft-popover-form-modal-input-wrapper .searchcraft-input-form-input{border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px);border:1px solid var(--sc-border-neutral)}.searchcraft-popover-form-modal-button{border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px)}.searchcraft-popover-form-fullscreen{position:fixed;inset:0;z-index:1000;background-color:var(--sc-surface-neutral-secondary)}.searchcraft-popover-form-fullscreen .searchcraft-popover-form{position:absolute;inset:0}.searchcraft-popover-form-fullscreen .searchcraft-popover-list-view{overflow:scroll}.searchcraft-popover-form-fullscreen-input-wrapper .searchcraft-input-form-input{border-radius:var(--sc-popover-form-border-radius);outline-width:1px;outline-color:var(--sc-border-neutral)}.searchcraft-popover-form-fullscreen-button{border-radius:var(--sc-popover-form-border-radius)}.searchcraft-popover-list-item{all:unset;color:var(--sc-content-neutral-secondary);display:flex;flex-direction:row;cursor:pointer;gap:8px;padding-right:var(--sc-popover-list-item-padding-horizontal);padding-left:var(--sc-popover-list-item-padding-horizontal);padding-top:var(--sc-popover-list-item-padding-vertical);padding-bottom:var(--sc-popover-list-item-padding-vertical)}.searchcraft-popover-list-item:focus{background-color:var(--sc-surface-neutral-secondary-active);color:var(--sc-content-neutral-secondary)}.searchcraft-popover-list-item:hover{background-color:var(--sc-surface-neutral-secondary-hover);color:var(--sc-content-neutral-secondary)}.searchcraft-popover-list-item-title{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);margin:0;color:inherit}.searchcraft-popover-list-item-subtitle{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);margin:0;color:inherit}.searchcraft-popover-list-item-image-wrapper{width:var(--sc-popover-list-item-image-size);height:var(--sc-popover-list-item-image-size);display:flex;align-items:center;justify-content:center;flex-shrink:0}.searchcraft-popover-list-item-image{max-width:var(--sc-popover-list-item-image-size);max-height:var(--sc-popover-list-item-image-size)}.searchcraft-popover-list-item-info-wrapper{display:flex;flex-direction:column;gap:8px;justify-content:center}.searchcraft-results-info{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-primary);margin:0}.searchcraft-slider{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%}.searchcraft-slider-range{align-items:center;background-color:var(--sc-surface-disabled);border-radius:999px;display:flex;position:relative;height:4px;width:100%}.searchcraft-slider-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range{background-color:var(--sc-surface-brand-primary);border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.searchcraft-slider-range .searchcraft-slider-active-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range::-moz-range-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-input{appearance:none;background:rgba(0,0,0,0);border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-webkit-slider-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-moz-range-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px}.searchcraft-slider-label{color:var(--sc-content-primary);display:flex;font-family:"Source Sans Pro",sans-serif;font-size:15px;font-weight:600;justify-content:space-between;margin-top:10px;width:100%}.searchcraft-slider-start-label,.searchcraft-slider-end-label{min-width:30px;text-align:center}.searchcraft-toggle-button{align-items:flex-start;display:flex;gap:10px;justify-content:space-between}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-neutral-primary);margin:0}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-neutral-secondary);margin:0}.searchcraft-toggle-button-background{background:var(--sc-surface-disabled);border-radius:var(--sc-border-radius-full);border:none;cursor:pointer;flex-shrink:0;height:26px;position:relative;transition:background-color .2s;width:44px}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform .3s ease;width:18px}.searchcraft-toggle-button-active .searchcraft-toggle-button-background{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0,0,0,.05)}.searchcraft-toggle-button-active .searchcraft-toggle-button-handle{transform:translateX(16px)}.searchcraft-pagination{display:inline-grid;gap:16px;grid-template-columns:repeat(3, auto);grid-template-rows:1fr}.searchcraft-pagination-list{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius);display:flex;list-style-type:none;margin:0;overflow:hidden;padding:0;width:auto}.searchcraft-pagination-list li{border-right:1px solid var(--sc-border-neutral);height:100%;min-height:44px;width:44px}.searchcraft-pagination-list li:last-child{border-right:none}.searchcraft-pagination-item{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);align-items:center;background-color:var(--sc-surface-neutral-primary);border:none;display:flex;height:100%;justify-content:center;width:100%}.searchcraft-pagination-item-active{background-color:var(--sc-surface-brand-secondary);font-weight:var(--sc-font-bold)}.searchcraft-pagination-control{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius)}.searchcraft-pagination-range{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);align-items:center;display:flex}.searchcraft-select{display:flex;flex-direction:column;gap:4px}.searchcraft-select-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-bold)}.searchcraft-select-input-wrapper{position:relative}.searchcraft-select-input{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);appearance:none;background-color:var(--sc-surface-neutral-secondary);border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;height:44px;padding:0 44px 0 16px;width:100%}.searchcraft-select-input:hover{background-color:var(--sc-surface-neutral-secondary-hover)}.searchcraft-select-input:active{background-color:var(--sc-surface-neutral-secondary-active)}.searchcraft-select-input:focus{border-color:var(--sc-border-brand);outline:none}.searchcraft-select-input-icon{fill:none;pointer-events:none;position:absolute;right:12px;top:50%;transform:translateY(-50%)}.searchcraft-select-caption{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size)}.searchcraft-search-results-per-page{display:flex}.searchcraft-search-results-per-page-select{align-items:center;display:flex;gap:12px}.searchcraft-search-results-per-page-select-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size)}.searchcraft-search-results-per-page-select-input{min-width:120px}/*# sourceMappingURL=hologram.css.map */
4367
+ `, Ic = /* @__PURE__ */ F(class extends O {
4368
+ constructor() {
4369
+ super(), this.__registerHost();
4370
+ }
4371
+ render() {
4372
+ return d("style", { key: "59491f4345817c2917f7158ae92f199281fb511b" }, Ac);
4373
+ }
4374
+ }, [0, "searchcraft-theme"]);
4375
+ function Mc() {
4376
+ if (typeof customElements > "u")
4377
+ return;
4378
+ ["searchcraft-theme"].forEach((t) => {
4379
+ switch (t) {
4380
+ case "searchcraft-theme":
4381
+ customElements.get(t) || customElements.define(t, Ic);
4382
+ break;
4383
+ }
4384
+ });
4385
+ }
4386
+ const Lc = Mc, Oc = Ks, ra = () => {
4387
+ Do(), Uo(), Ho(), qo(), ec(), sc(), ac(), cc(), uc(), pc(), mc(), gc(), yc(), wc(), xc(), Tc(), $c(), _c(), Lc(), Oc();
4388
+ };
4389
+ globalThis.__scDefineCustomElements__ = ra;
4390
+ const Fc = "@searchcraft/react-sdk", Dc = "Searchcraft Inc.", Nc = "0.10.0", Uc = "Searchcraft React SDK.", zc = "module", Hc = "Apache-2.0", jc = ["searchcraft"], Bc = { build: "rm -rf dist && vite build --config vite.client.config.ts && vite build --config vite.server.config.ts", docs: "typedoc --options typedoc.json", lint: "biome format lint ./src", test: "vitest --watch=false", "test:watch": "vitest" }, Wc = { type: "git", url: "https://bitbucket.org/madebychalk/searchcraft-javascript-sdks/" }, Gc = { node: ">=18.0.0", npm: ">=10.0.0" }, Vc = "dist/client/index.js", qc = "dist/client/index.js", Yc = "dist/client/index.d.ts", Qc = ["dist/**/*"], Kc = { ".": { import: "./dist/client/index.js", types: "./dist/client/index.d.ts" }, "./server": { import: "./dist/server/index.js", types: "./dist/server/index.d.ts" } }, Xc = { "@searchcraft/javascript-sdk": "^0.10.0", classnames: "^2.3.2" }, Zc = { react: ">=18.0.0 <19.1.0", "react-dom": ">=18.0.0 <19.1.0" }, Jc = { "@biomejs/biome": "^1.8.1", "@testing-library/jest-dom": "^6.4.2", "@testing-library/react": "^14.2.1", "@types/node": "^20.11.25", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", jsdom: "^24.0.0", react: "^18.3.1", "react-dom": "^18.3.1", sass: "^1.56.1" }, ms = {
4391
+ name: Fc,
4392
+ private: !1,
4393
+ author: Dc,
4394
+ version: Nc,
4395
+ description: Uc,
4396
+ type: zc,
4397
+ license: Hc,
4398
+ keywords: jc,
4399
+ scripts: Bc,
4400
+ repository: Wc,
4401
+ engines: Gc,
4402
+ main: Vc,
4403
+ module: qc,
4404
+ types: Yc,
4405
+ files: Qc,
4406
+ exports: Kc,
4407
+ dependencies: Xc,
4408
+ peerDependencies: Zc,
4409
+ devDependencies: Jc
4410
+ };
4411
+ async function ge(e, t) {
4412
+ const r = Object.entries(t).map(([o, n]) => typeof n == "boolean" ? n ? o : "" : `${o}="${String(n)}"`).filter(Boolean).join(" "), s = `<${e} ${r}></${e}>`, a = await Ga(s, {
4413
+ fullDocument: !1,
4414
+ clientHydrateAnnotations: !0
4415
+ });
4416
+ return {
4417
+ tag: s,
4418
+ html: a.html
4419
+ };
4420
+ }
4421
+ async function Ri(e) {
4422
+ const { tag: t, html: r } = await ge(
4423
+ "searchcraft-search-results",
4424
+ e
4425
+ );
4426
+ return /* @__PURE__ */ me(
4427
+ "div",
4428
+ {
4429
+ "data-sc-component": !0,
4430
+ "data-sc-tag-name": "searchraft-search-results",
4431
+ "data-sc-tag": t,
4432
+ dangerouslySetInnerHTML: { __html: r }
4433
+ }
4434
+ );
4435
+ }
4436
+ async function Ti(e) {
4437
+ const { tag: t, html: r } = await ge(
4438
+ "searchcraft-filter-panel",
4439
+ e
4440
+ );
4441
+ return /* @__PURE__ */ me(
4442
+ "div",
4443
+ {
4444
+ "data-sc-component": !0,
4445
+ "data-sc-tag-name": "searchraft-filter-panel",
4446
+ "data-sc-tag": t,
4447
+ dangerouslySetInnerHTML: { __html: r }
4448
+ }
4449
+ );
4450
+ }
4451
+ async function ki(e) {
4452
+ const { tag: t, html: r } = await ge(
4453
+ "searchcraft-input-form",
4454
+ e
4455
+ );
4456
+ return /* @__PURE__ */ me(
4457
+ "div",
4458
+ {
4459
+ "data-sc-component": !0,
4460
+ "data-sc-tag-name": "searchraft-input-form",
4461
+ "data-sc-tag": t,
4462
+ dangerouslySetInnerHTML: { __html: r }
4463
+ }
4464
+ );
4465
+ }
4466
+ async function Ci(e) {
4467
+ const { tag: t, html: r } = await ge(
4468
+ "searchcraft-popover-button",
4469
+ e
4470
+ );
4471
+ return /* @__PURE__ */ me(
4472
+ "div",
4473
+ {
4474
+ "data-sc-component": !0,
4475
+ "data-sc-tag-name": "searchraft-popover-button",
4476
+ "data-sc-tag": t,
4477
+ dangerouslySetInnerHTML: { __html: r }
4478
+ }
4479
+ );
4480
+ }
4481
+ async function Pi(e) {
4482
+ const { tag: t, html: r } = await ge(
4483
+ "searchcraft-popover-form",
4484
+ e
4485
+ );
4486
+ return /* @__PURE__ */ me(
4487
+ "div",
4488
+ {
4489
+ "data-sc-component": !0,
4490
+ "data-sc-tag-name": "searchraft-popover-form",
4491
+ "data-sc-tag": t,
4492
+ dangerouslySetInnerHTML: { __html: r }
4493
+ }
4494
+ );
4495
+ }
4496
+ async function xi(e) {
4497
+ const { tag: t, html: r } = await ge(
4498
+ "searchcraft-results-info",
4499
+ e
4500
+ );
4501
+ return /* @__PURE__ */ me(
4502
+ "div",
4503
+ {
4504
+ "data-sc-component": !0,
4505
+ "data-sc-tag-name": "searchraft-results-info",
4506
+ "data-sc-tag": t,
4507
+ dangerouslySetInnerHTML: { __html: r }
4508
+ }
4509
+ );
4510
+ }
4511
+ async function $i(e) {
4512
+ const { tag: t, html: r } = await ge("searchcraft-theme", e);
4513
+ return /* @__PURE__ */ me(
4514
+ "div",
4515
+ {
4516
+ "data-sc-component": !0,
4517
+ "data-sc-tag-name": "searchraft-theme",
4518
+ "data-sc-tag": t,
4519
+ dangerouslySetInnerHTML: { __html: r }
4520
+ }
4521
+ );
4522
+ }
4523
+ async function _i(e) {
4524
+ const { tag: t, html: r } = await ge(
4525
+ "searchcraft-pagination",
4526
+ e
4527
+ );
4528
+ return /* @__PURE__ */ me(
4529
+ "div",
4530
+ {
4531
+ "data-sc-component": !0,
4532
+ "data-sc-tag-name": "searchraft-pagination",
4533
+ "data-sc-tag": t,
4534
+ dangerouslySetInnerHTML: { __html: r }
4535
+ }
4536
+ );
4537
+ }
4538
+ async function Ai(e) {
4539
+ const { tag: t, html: r } = await ge(
4540
+ "searchcraft-search-results-per-page",
4541
+ e
4542
+ );
4543
+ return /* @__PURE__ */ me(
4544
+ "div",
4545
+ {
4546
+ "data-sc-component": !0,
4547
+ "data-sc-tag-name": "searchraft-search-results-per-page",
4548
+ "data-sc-tag": t,
4549
+ dangerouslySetInnerHTML: { __html: r }
4550
+ }
4551
+ );
4552
+ }
4553
+ class Ii extends fo {
4554
+ constructor(t) {
4555
+ super(t, {
4556
+ sdkName: ms.name,
4557
+ sdkVersion: ms.version
4558
+ });
4559
+ }
4560
+ }
4561
+ const Mi = () => {
4562
+ const e = document.querySelectorAll("[data-sc-component]");
4563
+ for (const t of e)
4564
+ t.innerHTML = t.getAttribute("data-sc-tag") || "";
4565
+ ra();
4566
+ };
4567
+ export {
4568
+ Ii as Searchcraft,
4569
+ Ti as SearchcraftFilterPanel,
4570
+ ki as SearchcraftInputForm,
4571
+ _i as SearchcraftPagination,
4572
+ Ci as SearchcraftPopoverButton,
4573
+ Pi as SearchcraftPopoverForm,
4574
+ xi as SearchcraftResultsInfo,
4575
+ Ri as SearchcraftSearchResults,
4576
+ Ai as SearchcraftSearchResultsPerPage,
4577
+ $i as SearchcraftTheme,
4578
+ ra as defineCustomElements,
4579
+ Mi as hydrateSearchcraftComponents
4580
+ };
4581
+ //# sourceMappingURL=index.js.map