@searchstax-inc/searchstudio-ux-react 4.2.2 → 4.2.13
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.
- package/CHANGELOG.md +13 -0
- package/README.md +10 -2
- package/dist/@searchstax-inc/components/SearchstaxAnswerWidget.d.ts +1 -1
- package/dist/@searchstax-inc/components/SearchstaxExternalPromotionsWidget.d.ts +1 -1
- package/dist/@searchstax-inc/components/SearchstaxFacetsWidget.d.ts +1 -1
- package/dist/@searchstax-inc/components/SearchstaxInputWidget.d.ts +2 -2
- package/dist/@searchstax-inc/components/SearchstaxLocationWidget.d.ts +1 -1
- package/dist/@searchstax-inc/components/SearchstaxOverviewWidget.d.ts +1 -1
- package/dist/@searchstax-inc/components/SearchstaxPaginationWidget.d.ts +1 -1
- package/dist/@searchstax-inc/components/SearchstaxRelatedSearchesWidget.d.ts +1 -1
- package/dist/@searchstax-inc/components/SearchstaxResultWidget.d.ts +1 -1
- package/dist/@searchstax-inc/components/SearchstaxSortingWidget.d.ts +1 -1
- package/dist/@searchstax-inc/components/SearchstaxWrapper.d.ts +1 -1
- package/dist/@searchstax-inc/components/templates/SearchstaxAnswerWidgetTemplate.d.ts +1 -1
- package/dist/@searchstax-inc/components/templates/SearchstaxExternalPromotionsWidgetTemplate.d.ts +1 -1
- package/dist/@searchstax-inc/components/templates/SearchstaxFacetsWidgetTemplate.d.ts +2 -2
- package/dist/@searchstax-inc/components/templates/SearchstaxInputWidgetTemplate.d.ts +2 -1
- package/dist/@searchstax-inc/components/templates/SearchstaxOverviewWidgetTemplate.d.ts +1 -1
- package/dist/@searchstax-inc/components/templates/SearchstaxPaginationWidgetTemplate.d.ts +2 -2
- package/dist/@searchstax-inc/components/templates/SearchstaxRelatedSearchesWidgetTemplate.d.ts +1 -1
- package/dist/@searchstax-inc/components/templates/SearchstaxSortingWidgetTemplate.d.ts +1 -1
- package/dist/@searchstax-inc/searchstudio-ux-react.cjs +79 -76
- package/dist/@searchstax-inc/searchstudio-ux-react.iife.js +70 -67
- package/dist/@searchstax-inc/searchstudio-ux-react.mjs +2936 -2663
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var zr=Object.defineProperty;var _r=(s,e,t)=>e in s?zr(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var u=(s,e,t)=>(_r(s,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("react");var Na={exports:{}},bt={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var vs;function Wr(){if(vs)return bt;vs=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(a,r,i){var n=null;if(i!==void 0&&(n=""+i),r.key!==void 0&&(n=""+r.key),"key"in r){i={};for(var o in r)o!=="key"&&(i[o]=r[o])}else i=r;return r=i.ref,{$$typeof:s,type:a,key:n,ref:r!==void 0?r:null,props:i}}return bt.Fragment=e,bt.jsx=t,bt.jsxs=t,bt}var Ct={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,80 +14,81 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var js;function Vr(){return js||(js=1,process.env.NODE_ENV!=="production"&&function(){function s(x){if(x==null)return null;if(typeof x=="function")return x.$$typeof===se?null:x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case T:return"Fragment";case O:return"Profiler";case A:return"StrictMode";case b:return"Suspense";case M:return"SuspenseList";case G:return"Activity"}if(typeof x=="object")switch(typeof x.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),x.$$typeof){case L:return"Portal";case I:return x.displayName||"Context";case P:return(x._context.displayName||"Context")+".Consumer";case y:var F=x.render;return x=x.displayName,x||(x=F.displayName||F.name||"",x=x!==""?"ForwardRef("+x+")":"ForwardRef"),x;case E:return F=x.displayName||null,F!==null?F:s(x.type)||"Memo";case N:F=x._payload,x=x._init;try{return s(x(F))}catch{}}return null}function e(x){return""+x}function t(x){try{e(x);var F=!1}catch{F=!0}if(F){F=console;var q=F.error,ae=typeof Symbol=="function"&&Symbol.toStringTag&&x[Symbol.toStringTag]||x.constructor.name||"Object";return q.call(F,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",ae),e(x)}}function a(x){if(x===T)return"<>";if(typeof x=="object"&&x!==null&&x.$$typeof===N)return"<...>";try{var F=s(x);return F?"<"+F+">":"<...>"}catch{return"<...>"}}function r(){var x=pe.A;return x===null?null:x.getOwner()}function i(){return Error("react-stack-top-frame")}function n(x){if(Ae.call(x,"key")){var F=Object.getOwnPropertyDescriptor(x,"key").get;if(F&&F.isReactWarning)return!1}return x.key!==void 0}function o(x,F){function q(){mt||(mt=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",F))}q.isReactWarning=!0,Object.defineProperty(x,"key",{get:q,configurable:!0})}function c(){var x=s(this.type);return $t[x]||($t[x]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),x=this.props.ref,x!==void 0?x:null}function h(x,F,q,ae,Ze,ft){var K=q.ref;return x={$$typeof:S,type:x,key:F,props:q,_owner:ae},(K!==void 0?K:null)!==null?Object.defineProperty(x,"ref",{enumerable:!1,get:c}):Object.defineProperty(x,"ref",{enumerable:!1,value:null}),x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(x,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(x,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Ze}),Object.defineProperty(x,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ft}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x}function g(x,F,q,ae,Ze,ft){var K=F.children;if(K!==void 0)if(ae)if(ge(K)){for(ae=0;ae<K.length;ae++)m(K[ae]);Object.freeze&&Object.freeze(K)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(K);if(Ae.call(F,"key")){K=s(x);var Oe=Object.keys(F).filter(function(Y){return Y!=="key"});ae=0<Oe.length?"{key: someKey, "+Oe.join(": ..., ")+": ...}":"{key: someKey}",U[K+ae]||(Oe=0<Oe.length?"{"+Oe.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,
|
|
23
|
-
]`).replace("lheading",
|
|
24
|
-
`).map(
|
|
25
|
-
`)}var
|
|
26
|
-
`)}}}fences(
|
|
27
|
-
`)}}blockquote(
|
|
22
|
+
<%s key={someKey} {...props} />`,ae,K,Oe,K),U[K+ae]=!0)}if(K=null,q!==void 0&&(t(q),K=""+q),n(F)&&(t(F.key),K=""+F.key),"key"in F){q={};for(var Xe in F)Xe!=="key"&&(q[Xe]=F[Xe])}else q=F;return K&&o(q,typeof x=="function"?x.displayName||x.name||"Unknown":x),h(x,K,q,r(),Ze,ft)}function m(x){p(x)?x._store&&(x._store.validated=1):typeof x=="object"&&x!==null&&x.$$typeof===N&&(x._payload.status==="fulfilled"?p(x._payload.value)&&x._payload.value._store&&(x._payload.value._store.validated=1):x._store&&(x._store.validated=1))}function p(x){return typeof x=="object"&&x!==null&&x.$$typeof===S}var w=D,S=Symbol.for("react.transitional.element"),L=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),I=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),se=Symbol.for("react.client.reference"),pe=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ae=Object.prototype.hasOwnProperty,ge=Array.isArray,Se=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(x){return x()}};var mt,$t={},zt=w.react_stack_bottom_frame.bind(w,i)(),_t=Se(a(i)),U={};Ct.Fragment=T,Ct.jsx=function(x,F,q){var ae=1e4>pe.recentlyCreatedOwnerStacks++;return g(x,F,q,!1,ae?Error("react-stack-top-frame"):zt,ae?Se(a(x)):_t)},Ct.jsxs=function(x,F,q){var ae=1e4>pe.recentlyCreatedOwnerStacks++;return g(x,F,q,!0,ae?Error("react-stack-top-frame"):zt,ae?Se(a(x)):_t)}}()),Ct}process.env.NODE_ENV==="production"?Na.exports=Wr():Na.exports=Vr();var d=Na.exports,te=(s=>(s[s.mustache=0]="mustache",s[s.vue=1]="vue",s[s.react=2]="react",s[s.angular=3]="angular",s))(te||{});function qa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ke=qa();function Es(s){Ke=s}var Nt={exec:()=>null};function Q(s,e=""){let t=typeof s=="string"?s:s.source;const a={replace:(r,i)=>{let n=typeof i=="string"?i:i.source;return n=n.replace(ye.caret,"$1"),t=t.replace(r,n),a},getRegex:()=>new RegExp(t,e)};return a}var ye={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:s=>new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}#`),htmlBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}<(?:[a-z].*>|!--)`,"i")},Qr=/^(?:[ \t]*(?:\n|$))+/,Br=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Hr=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ft=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ur=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ya=/(?:[*+-]|\d{1,9}[.)])/,or=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,cr=Q(or).replace(/bull/g,Ya).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),qr=Q(or).replace(/bull/g,Ya).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ja=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Yr=/^[^\n]+/,Ga=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Jr=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ga).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gr=Q(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ya).getRegex(),ra="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ka=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Kr=Q("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ka).replace("tag",ra).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lr=Q(Ja).replace("hr",Ft).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ra).getRegex(),Zr=Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",lr).getRegex(),Za={blockquote:Zr,code:Br,def:Jr,fences:Hr,heading:Ur,hr:Ft,html:Kr,lheading:cr,list:Gr,newline:Qr,paragraph:lr,table:Nt,text:Yr},As=Q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ft).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ra).getRegex(),Xr={...Za,lheading:qr,table:As,paragraph:Q(Ja).replace("hr",Ft).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",As).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ra).getRegex()},ei={...Za,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ka).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Nt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(Ja).replace("hr",Ft).replace("heading",` *#{1,6} *[^
|
|
23
|
+
]`).replace("lheading",cr).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ti=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ai=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,hr=/^( {2,}|\\)\n(?!\s*$)/,si=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ia=/[\p{P}\p{S}]/u,Xa=/[\s\p{P}\p{S}]/u,ur=/[^\s\p{P}\p{S}]/u,ri=Q(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xa).getRegex(),dr=/(?!~)[\p{P}\p{S}]/u,ii=/(?!~)[\s\p{P}\p{S}]/u,ni=/(?:[^\s\p{P}\p{S}]|~)/u,oi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,gr=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ci=Q(gr,"u").replace(/punct/g,ia).getRegex(),li=Q(gr,"u").replace(/punct/g,dr).getRegex(),pr="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",hi=Q(pr,"gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,Xa).replace(/punct/g,ia).getRegex(),ui=Q(pr,"gu").replace(/notPunctSpace/g,ni).replace(/punctSpace/g,ii).replace(/punct/g,dr).getRegex(),di=Q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,Xa).replace(/punct/g,ia).getRegex(),gi=Q(/\\(punct)/,"gu").replace(/punct/g,ia).getRegex(),pi=Q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),mi=Q(Ka).replace("(?:-->|$)","-->").getRegex(),fi=Q("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",mi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ea=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Li=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ea).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),mr=Q(/^!?\[(label)\]\[(ref)\]/).replace("label",ea).replace("ref",Ga).getRegex(),fr=Q(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ga).getRegex(),yi=Q("reflink|nolink(?!\\()","g").replace("reflink",mr).replace("nolink",fr).getRegex(),es={_backpedal:Nt,anyPunctuation:gi,autolink:pi,blockSkip:oi,br:hr,code:ai,del:Nt,emStrongLDelim:ci,emStrongRDelimAst:hi,emStrongRDelimUnd:di,escape:ti,link:Li,nolink:fr,punctuation:ri,reflink:mr,reflinkSearch:yi,tag:fi,text:si,url:Nt},xi={...es,link:Q(/^!?\[(label)\]\((.*?)\)/).replace("label",ea).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ea).getRegex()},Ra={...es,emStrongRDelimAst:ui,emStrongLDelim:li,url:Q(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},wi={...Ra,br:Q(hr).replace("{2,}","*").getRegex(),text:Q(Ra.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Yt={normal:Za,gfm:Xr,pedantic:ei},Mt={normal:es,gfm:Ra,breaks:wi,pedantic:xi},bi={"&":"&","<":"<",">":">",'"':""","'":"'"},Is=s=>bi[s];function je(s,e){if(e){if(ye.escapeTest.test(s))return s.replace(ye.escapeReplace,Is)}else if(ye.escapeTestNoEncode.test(s))return s.replace(ye.escapeReplaceNoEncode,Is);return s}function Ns(s){try{s=encodeURI(s).replace(ye.percentDecode,"%")}catch{return null}return s}function Rs(s,e){var i;const t=s.replace(ye.findPipe,(n,o,c)=>{let h=!1,g=o;for(;--g>=0&&c[g]==="\\";)h=!h;return h?"|":" |"}),a=t.split(ye.splitPipe);let r=0;if(a[0].trim()||a.shift(),a.length>0&&!((i=a.at(-1))!=null&&i.trim())&&a.pop(),e)if(a.length>e)a.splice(e);else for(;a.length<e;)a.push("");for(;r<a.length;r++)a[r]=a[r].trim().replace(ye.slashPipe,"|");return a}function St(s,e,t){const a=s.length;if(a===0)return"";let r=0;for(;r<a&&s.charAt(a-r-1)===e;)r++;return s.slice(0,a-r)}function Ci(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let a=0;a<s.length;a++)if(s[a]==="\\")a++;else if(s[a]===e[0])t++;else if(s[a]===e[1]&&(t--,t<0))return a;return t>0?-2:-1}function Ds(s,e,t,a,r){const i=e.href,n=e.title||null,o=s[1].replace(r.other.outputLinkReplace,"$1");a.state.inLink=!0;const c={type:s[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:n,text:o,tokens:a.inlineTokens(o)};return a.state.inLink=!1,c}function Mi(s,e,t){const a=s.match(t.other.indentCodeCompensation);if(a===null)return e;const r=a[1];return e.split(`
|
|
24
|
+
`).map(i=>{const n=i.match(t.other.beginningSpace);if(n===null)return i;const[o]=n;return o.length>=r.length?i.slice(r.length):i}).join(`
|
|
25
|
+
`)}var ta=class{constructor(s){u(this,"options");u(this,"rules");u(this,"lexer");this.options=s||Ke}space(s){const e=this.rules.block.newline.exec(s);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(s){const e=this.rules.block.code.exec(s);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:St(t,`
|
|
26
|
+
`)}}}fences(s){const e=this.rules.block.fences.exec(s);if(e){const t=e[0],a=Mi(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:a}}}heading(s){const e=this.rules.block.heading.exec(s);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const a=St(t,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(t=a.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(s){const e=this.rules.block.hr.exec(s);if(e)return{type:"hr",raw:St(e[0],`
|
|
27
|
+
`)}}blockquote(s){const e=this.rules.block.blockquote.exec(s);if(e){let t=St(e[0],`
|
|
28
28
|
`).split(`
|
|
29
|
-
`),a="",
|
|
30
|
-
`),g=
|
|
29
|
+
`),a="",r="";const i=[];for(;t.length>0;){let n=!1;const o=[];let c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))o.push(t[c]),n=!0;else if(!n)o.push(t[c]);else break;t=t.slice(c);const h=o.join(`
|
|
30
|
+
`),g=h.replace(this.rules.other.blockquoteSetextReplace,`
|
|
31
31
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
|
|
32
|
-
${
|
|
33
|
-
${g}`:g;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,
|
|
32
|
+
${h}`:h,r=r?`${r}
|
|
33
|
+
${g}`:g;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,i,!0),this.lexer.state.top=m,t.length===0)break;const p=i.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){const w=p,S=w.raw+`
|
|
34
34
|
`+t.join(`
|
|
35
|
-
`),L=this.blockquote(
|
|
35
|
+
`),L=this.blockquote(S);i[i.length-1]=L,a=a.substring(0,a.length-w.raw.length)+L.raw,r=r.substring(0,r.length-w.text.length)+L.text;break}else if((p==null?void 0:p.type)==="list"){const w=p,S=w.raw+`
|
|
36
36
|
`+t.join(`
|
|
37
|
-
`),L=this.list(
|
|
38
|
-
`);continue}}return{type:"blockquote",raw:a,tokens:
|
|
39
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,
|
|
40
|
-
`,1)[0],w=!m.trim(),
|
|
41
|
-
`,
|
|
42
|
-
`,1)[0];let
|
|
43
|
-
`+
|
|
44
|
-
`+p}!w&&!p.trim()&&(w=!0),
|
|
45
|
-
`,
|
|
46
|
-
`):[],
|
|
47
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(
|
|
48
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const a=this.inlineQueue[t];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],a=!1){var
|
|
49
|
-
`:t.push(
|
|
50
|
-
`+
|
|
51
|
-
`+
|
|
52
|
-
`+
|
|
53
|
-
`+
|
|
54
|
-
`+
|
|
55
|
-
`+
|
|
56
|
-
`+
|
|
57
|
-
`+
|
|
58
|
-
`;return a?'<pre><code class="language-'+
|
|
59
|
-
`:"<pre><code>"+(t?
|
|
60
|
-
`}blockquote({tokens:
|
|
61
|
-
${this.parser.parse(
|
|
62
|
-
`}html({text:
|
|
63
|
-
`}hr(
|
|
64
|
-
`}list(
|
|
65
|
-
`+a+"</"+
|
|
66
|
-
`}listitem(
|
|
67
|
-
`}checkbox({checked:
|
|
68
|
-
`}table(
|
|
37
|
+
`),L=this.list(S);i[i.length-1]=L,a=a.substring(0,a.length-p.raw.length)+L.raw,r=r.substring(0,r.length-w.raw.length)+L.raw,t=S.substring(i.at(-1).raw.length).split(`
|
|
38
|
+
`);continue}}return{type:"blockquote",raw:a,tokens:i,text:r}}}list(s){let e=this.rules.block.list.exec(s);if(e){let t=e[1].trim();const a=t.length>1,r={type:"list",raw:"",ordered:a,start:a?+t.slice(0,-1):"",loose:!1,items:[]};t=a?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=a?t:"[*+-]");const i=this.rules.other.listItemRegex(t);let n=!1;for(;s;){let c=!1,h="",g="";if(!(e=i.exec(s))||this.rules.block.hr.test(s))break;h=e[0],s=s.substring(h.length);let m=e[2].split(`
|
|
39
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,A=>" ".repeat(3*A.length)),p=s.split(`
|
|
40
|
+
`,1)[0],w=!m.trim(),S=0;if(this.options.pedantic?(S=2,g=m.trimStart()):w?S=e[1].length+1:(S=e[2].search(this.rules.other.nonSpaceChar),S=S>4?1:S,g=m.slice(S),S+=e[1].length),w&&this.rules.other.blankLine.test(p)&&(h+=p+`
|
|
41
|
+
`,s=s.substring(p.length+1),c=!0),!c){const A=this.rules.other.nextBulletRegex(S),O=this.rules.other.hrRegex(S),P=this.rules.other.fencesBeginRegex(S),I=this.rules.other.headingBeginRegex(S),y=this.rules.other.htmlBeginRegex(S);for(;s;){const b=s.split(`
|
|
42
|
+
`,1)[0];let M;if(p=b,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),M=p):M=p.replace(this.rules.other.tabCharGlobal," "),P.test(p)||I.test(p)||y.test(p)||A.test(p)||O.test(p))break;if(M.search(this.rules.other.nonSpaceChar)>=S||!p.trim())g+=`
|
|
43
|
+
`+M.slice(S);else{if(w||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||P.test(m)||I.test(m)||O.test(m))break;g+=`
|
|
44
|
+
`+p}!w&&!p.trim()&&(w=!0),h+=b+`
|
|
45
|
+
`,s=s.substring(b.length+1),m=M.slice(S)}}r.loose||(n?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(n=!0));let L=null,T;this.options.gfm&&(L=this.rules.other.listIsTask.exec(g),L&&(T=L[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:h,task:!!L,checked:T,loose:!1,text:g,tokens:[]}),r.raw+=h}const o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let c=0;c<r.items.length;c++)if(this.lexer.state.top=!1,r.items[c].tokens=this.lexer.blockTokens(r.items[c].text,[]),!r.loose){const h=r.items[c].tokens.filter(m=>m.type==="space"),g=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));r.loose=g}if(r.loose)for(let c=0;c<r.items.length;c++)r.items[c].loose=!0;return r}}html(s){const e=this.rules.block.html.exec(s);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(s){const e=this.rules.block.def.exec(s);if(e){const t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:a,title:r}}}table(s){var n;const e=this.rules.block.table.exec(s);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const t=Rs(e[1]),a=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=(n=e[3])!=null&&n.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
46
|
+
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===a.length){for(const o of a)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<t.length;o++)i.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:i.align[o]});for(const o of r)i.rows.push(Rs(o,i.header.length).map((c,h)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:i.align[h]})));return i}}lheading(s){const e=this.rules.block.lheading.exec(s);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(s){const e=this.rules.block.paragraph.exec(s);if(e){const t=e[1].charAt(e[1].length-1)===`
|
|
47
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(s){const e=this.rules.block.text.exec(s);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(s){const e=this.rules.inline.escape.exec(s);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(s){const e=this.rules.inline.tag.exec(s);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(s){const e=this.rules.inline.link.exec(s);if(e){const t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const i=St(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{const i=Ci(e[2],"()");if(i===-2)return;if(i>-1){const n=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,n).trim(),e[3]=""}}let a=e[2],r="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(a);i&&(a=i[1],r=i[3])}else r=e[3]?e[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?a=a.slice(1):a=a.slice(1,-1)),Ds(e,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(s,e){let t;if((t=this.rules.inline.reflink.exec(s))||(t=this.rules.inline.nolink.exec(s))){const a=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[a.toLowerCase()];if(!r){const i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return Ds(t,r,t[0],this.lexer,this.rules)}}emStrong(s,e,t=""){let a=this.rules.inline.emStrongLDelim.exec(s);if(!(!a||a[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[2])||!t||this.rules.inline.punctuation.exec(t))){const r=[...a[0]].length-1;let i,n,o=r,c=0;const h=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*s.length+r);(a=h.exec(e))!=null;){if(i=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!i)continue;if(n=[...i].length,a[3]||a[4]){o+=n;continue}else if((a[5]||a[6])&&r%3&&!((r+n)%3)){c+=n;continue}if(o-=n,o>0)continue;n=Math.min(n,n+o+c);const g=[...a[0]][0].length,m=s.slice(0,r+a.index+g+n);if(Math.min(r,n)%2){const w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}const p=m.slice(2,-2);return{type:"strong",raw:m,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(s){const e=this.rules.inline.code.exec(s);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," ");const a=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return a&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(s){const e=this.rules.inline.br.exec(s);if(e)return{type:"br",raw:e[0]}}del(s){const e=this.rules.inline.del.exec(s);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(s){const e=this.rules.inline.autolink.exec(s);if(e){let t,a;return e[2]==="@"?(t=e[1],a="mailto:"+t):(t=e[1],a=t),{type:"link",raw:e[0],text:t,href:a,tokens:[{type:"text",raw:t,text:t}]}}}url(s){var t;let e;if(e=this.rules.inline.url.exec(s)){let a,r;if(e[2]==="@")a=e[0],r="mailto:"+a;else{let i;do i=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(i!==e[0]);a=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:a,href:r,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(s){const e=this.rules.inline.text.exec(s);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Re=class Da{constructor(e){u(this,"tokens");u(this,"options");u(this,"state");u(this,"tokenizer");u(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ke,this.options.tokenizer=this.options.tokenizer||new ta,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:ye,block:Yt.normal,inline:Mt.normal};this.options.pedantic?(t.block=Yt.pedantic,t.inline=Mt.pedantic):this.options.gfm&&(t.block=Yt.gfm,this.options.breaks?t.inline=Mt.breaks:t.inline=Mt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Yt,inline:Mt}}static lex(e,t){return new Da(t).lex(e)}static lexInline(e,t){return new Da(t).inlineTokens(e)}lex(e){e=e.replace(ye.carriageReturn,`
|
|
48
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const a=this.inlineQueue[t];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],a=!1){var r,i,n;for(this.options.pedantic&&(e=e.replace(ye.tabCharGlobal," ").replace(ye.spaceLine,""));e;){let o;if((i=(r=this.options.extensions)==null?void 0:r.block)!=null&&i.some(h=>(o=h.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);const h=t.at(-1);o.raw.length===1&&h!==void 0?h.raw+=`
|
|
49
|
+
`:t.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.raw.length);const h=t.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=`
|
|
50
|
+
`+o.raw,h.text+=`
|
|
51
|
+
`+o.text,this.inlineQueue.at(-1).src=h.text):t.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.raw.length);const h=t.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=`
|
|
52
|
+
`+o.raw,h.text+=`
|
|
53
|
+
`+o.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),t.push(o);continue}let c=e;if((n=this.options.extensions)!=null&&n.startBlock){let h=1/0;const g=e.slice(1);let m;this.options.extensions.startBlock.forEach(p=>{m=p.call({lexer:this},g),typeof m=="number"&&m>=0&&(h=Math.min(h,m))}),h<1/0&&h>=0&&(c=e.substring(0,h+1))}if(this.state.top&&(o=this.tokenizer.paragraph(c))){const h=t.at(-1);a&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=`
|
|
54
|
+
`+o.raw,h.text+=`
|
|
55
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):t.push(o),a=c.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);const h=t.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=`
|
|
56
|
+
`+o.raw,h.text+=`
|
|
57
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):t.push(o);continue}if(e){const h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var o,c,h;let a=e,r=null;if(this.tokens.links){const g=Object.keys(this.tokens.links);if(g.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)g.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,r.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,n="";for(;e;){i||(n=""),i=!1;let g;if((c=(o=this.options.extensions)==null?void 0:o.inline)!=null&&c.some(p=>(g=p.call({lexer:this},e,t))?(e=e.substring(g.raw.length),t.push(g),!0):!1))continue;if(g=this.tokenizer.escape(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.tag(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.link(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(g.raw.length);const p=t.at(-1);g.type==="text"&&(p==null?void 0:p.type)==="text"?(p.raw+=g.raw,p.text+=g.text):t.push(g);continue}if(g=this.tokenizer.emStrong(e,a,n)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.codespan(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.br(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.del(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.autolink(e)){e=e.substring(g.raw.length),t.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(e))){e=e.substring(g.raw.length),t.push(g);continue}let m=e;if((h=this.options.extensions)!=null&&h.startInline){let p=1/0;const w=e.slice(1);let S;this.options.extensions.startInline.forEach(L=>{S=L.call({lexer:this},w),typeof S=="number"&&S>=0&&(p=Math.min(p,S))}),p<1/0&&p>=0&&(m=e.substring(0,p+1))}if(g=this.tokenizer.inlineText(m)){e=e.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(n=g.raw.slice(-1)),i=!0;const p=t.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=g.raw,p.text+=g.text):t.push(g);continue}if(e){const p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return t}},aa=class{constructor(s){u(this,"options");u(this,"parser");this.options=s||Ke}space(s){return""}code({text:s,lang:e,escaped:t}){var i;const a=(i=(e||"").match(ye.notSpaceStart))==null?void 0:i[0],r=s.replace(ye.endingNewline,"")+`
|
|
58
|
+
`;return a?'<pre><code class="language-'+je(a)+'">'+(t?r:je(r,!0))+`</code></pre>
|
|
59
|
+
`:"<pre><code>"+(t?r:je(r,!0))+`</code></pre>
|
|
60
|
+
`}blockquote({tokens:s}){return`<blockquote>
|
|
61
|
+
${this.parser.parse(s)}</blockquote>
|
|
62
|
+
`}html({text:s}){return s}heading({tokens:s,depth:e}){return`<h${e}>${this.parser.parseInline(s)}</h${e}>
|
|
63
|
+
`}hr(s){return`<hr>
|
|
64
|
+
`}list(s){const e=s.ordered,t=s.start;let a="";for(let n=0;n<s.items.length;n++){const o=s.items[n];a+=this.listitem(o)}const r=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+r+i+`>
|
|
65
|
+
`+a+"</"+r+`>
|
|
66
|
+
`}listitem(s){var t;let e="";if(s.task){const a=this.checkbox({checked:!!s.checked});s.loose?((t=s.tokens[0])==null?void 0:t.type)==="paragraph"?(s.tokens[0].text=a+" "+s.tokens[0].text,s.tokens[0].tokens&&s.tokens[0].tokens.length>0&&s.tokens[0].tokens[0].type==="text"&&(s.tokens[0].tokens[0].text=a+" "+je(s.tokens[0].tokens[0].text),s.tokens[0].tokens[0].escaped=!0)):s.tokens.unshift({type:"text",raw:a+" ",text:a+" ",escaped:!0}):e+=a+" "}return e+=this.parser.parse(s.tokens,!!s.loose),`<li>${e}</li>
|
|
67
|
+
`}checkbox({checked:s}){return"<input "+(s?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:s}){return`<p>${this.parser.parseInline(s)}</p>
|
|
68
|
+
`}table(s){let e="",t="";for(let r=0;r<s.header.length;r++)t+=this.tablecell(s.header[r]);e+=this.tablerow({text:t});let a="";for(let r=0;r<s.rows.length;r++){const i=s.rows[r];t="";for(let n=0;n<i.length;n++)t+=this.tablecell(i[n]);a+=this.tablerow({text:t})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
|
|
69
69
|
<thead>
|
|
70
70
|
`+e+`</thead>
|
|
71
71
|
`+a+`</table>
|
|
72
|
-
`}tablerow({text:
|
|
73
|
-
${
|
|
74
|
-
`}tablecell(
|
|
75
|
-
`}strong({tokens:
|
|
76
|
-
`+this.renderer.text(
|
|
77
|
-
Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An error occurred:</p><pre>"+ke(t.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(t);throw t}}},_e=new Gr;function W(r,e){return _e.parse(r,e)}W.options=W.setOptions=function(r){return _e.setOptions(r),W.defaults=_e.defaults,ls(W.defaults),W},W.getDefaults=Ra,W.defaults=Ve,W.use=function(...r){return _e.use(...r),W.defaults=_e.defaults,ls(W.defaults),W},W.walkTokens=function(r,e){return _e.walkTokens(r,e)},W.parseInline=_e.parseInline,W.Parser=Re,W.parser=Re.parse,W.Renderer=qt,W.TextRenderer=_a,W.Lexer=Ie,W.lexer=Ie.lex,W.Tokenizer=Qt,W.Hooks=Wt,W.parse=W,W.options,W.setOptions,W.use,W.walkTokens,W.parseInline,Re.parse,Ie.lex;const{entries:Gs,setPrototypeOf:ms,isFrozen:Kr,getPrototypeOf:Zr,getOwnPropertyDescriptor:Xr}=Object;let{freeze:pe,seal:ye,create:Je}=Object,{apply:ba,construct:Ca}=typeof Reflect<"u"&&Reflect;pe||(pe=function(r){return r}),ye||(ye=function(r){return r}),ba||(ba=function(r,e){for(var t=arguments.length,a=new Array(t>2?t-2:0),s=2;s<t;s++)a[s-2]=arguments[s];return r.apply(e,a)}),Ca||(Ca=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),a=1;a<e;a++)t[a-1]=arguments[a];return new r(...t)});const ft=ee(Array.prototype.forEach),en=ee(Array.prototype.lastIndexOf),fs=ee(Array.prototype.pop),Lt=ee(Array.prototype.push),tn=ee(Array.prototype.splice),ue=Array.isArray,xt=ee(String.prototype.toLowerCase),ca=ee(String.prototype.toString),Ls=ee(String.prototype.match),Ye=ee(String.prototype.replace),ys=ee(String.prototype.indexOf),an=ee(String.prototype.trim),sn=ee(Number.prototype.toString),rn=ee(Boolean.prototype.toString),ws=typeof BigInt>"u"?null:ee(BigInt.prototype.toString),xs=typeof Symbol>"u"?null:ee(Symbol.prototype.toString),G=ee(Object.prototype.hasOwnProperty),yt=ee(Object.prototype.toString),oe=ee(RegExp.prototype.test),$t=nn(TypeError);function ee(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s<t;s++)a[s-1]=arguments[s];return ba(r,e,a)}}function nn(r){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return Ca(r,t)}}function N(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xt;if(ms&&ms(r,null),!ue(e))return r;let a=e.length;for(;a--;){let s=e[a];if(typeof s=="string"){const n=t(s);n!==s&&(Kr(e)||(e[a]=n),s=n)}r[s]=!0}return r}function on(r){for(let e=0;e<r.length;e++)G(r,e)||(r[e]=null);return r}function me(r){const e=Je(null);for(const[t,a]of Gs(r))G(r,t)&&(ue(a)?e[t]=on(a):a&&typeof a=="object"&&a.constructor===Object?e[t]=me(a):e[t]=a);return e}function cn(r){switch(typeof r){case"string":return r;case"number":return sn(r);case"boolean":return rn(r);case"bigint":return ws?ws(r):"0";case"symbol":return xs?xs(r):"Symbol()";case"undefined":return yt(r);case"function":case"object":{if(r===null)return yt(r);const e=r,t=Ge(e,"toString");if(typeof t=="function"){const a=t(e);return typeof a=="string"?a:yt(a)}return yt(r)}default:return yt(r)}}function Ge(r,e){for(;r!==null;){const a=Xr(r,e);if(a){if(a.get)return ee(a.get);if(typeof a.value=="function")return ee(a.value)}r=Zr(r)}function t(){return null}return t}function ln(r){try{return oe(r,""),!0}catch{return!1}}const bs=pe(["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","search","section","select","shadow","slot","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"]),la=pe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ha=pe(["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"]),hn=pe(["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"]),ua=pe(["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"]),un=pe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Cs=pe(["#text"]),Ms=pe(["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","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),da=pe(["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","mask-type","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"]),Ss=pe(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),zt=pe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),dn=ye(/\{\{[\w\W]*|[\w\W]*\}\}/gm),gn=ye(/<%[\w\W]*|[\w\W]*%>/gm),pn=ye(/\$\{[\w\W]*/gm),mn=ye(/^data-[\-\w.\u00B7-\uFFFF]+$/),fn=ye(/^aria-[\-\w]+$/),Ks=ye(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ln=ye(/^(?:\w+script|data):/i),yn=ye(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Zs=ye(/^html$/i),wn=ye(/^[a-z][.\w]*(-[.\w]+)+$/i);var ks=Object.freeze({__proto__:null,ARIA_ATTR:fn,ATTR_WHITESPACE:yn,CUSTOM_ELEMENT:wn,DATA_ATTR:mn,DOCTYPE_NAME:Zs,ERB_EXPR:gn,IS_ALLOWED_URI:Ks,IS_SCRIPT_OR_DATA:Ln,MUSTACHE_EXPR:dn,TMPLIT_EXPR:pn});const wt={element:1,text:3,progressingInstruction:7,comment:8,document:9},xn=function(){return typeof window>"u"?null:window},bn=function(r,e){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let t=null;const a="data-tt-policy-suffix";e&&e.hasAttribute(a)&&(t=e.getAttribute(a));const s="dompurify"+(t?"#"+t:"");try{return r.createPolicy(s,{createHTML(n){return n},createScriptURL(n){return n}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Ts=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Xs(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xn();const e=u=>Xs(u);if(e.version="3.4.2",e.removed=[],!r||!r.document||r.document.nodeType!==wt.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const a=t,s=a.currentScript,{DocumentFragment:n,HTMLTemplateElement:o,Node:i,Element:c,NodeFilter:l,NamedNodeMap:g=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:m,DOMParser:p,trustedTypes:w}=r,b=c.prototype,L=Ge(b,"cloneNode"),T=Ge(b,"remove"),y=Ge(b,"nextSibling"),x=Ge(b,"childNodes"),v=Ge(b,"parentNode");if(typeof o=="function"){const u=t.createElement("template");u.content&&u.content.ownerDocument&&(t=u.content.ownerDocument)}let k,j="";const{implementation:F,createNodeIterator:E,createDocumentFragment:O,getElementsByTagName:B}=t,{importNode:Z}=a;let _=Ts();e.isSupported=typeof Gs=="function"&&typeof v=="function"&&F&&F.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ce,ERB_EXPR:be,TMPLIT_EXPR:Te,DATA_ATTR:nt,ARIA_ATTR:jt,IS_SCRIPT_OR_DATA:It,ATTR_WHITESPACE:it,CUSTOM_ELEMENT:Rt}=ks;let{IS_ALLOWED_URI:ot}=ks,f=null;const D=N({},[...bs,...la,...ha,...ua,...Cs]);let P=null;const J=N({},[...Ms,...da,...Ss,...zt]);let Q=Object.seal(Je(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ve=null,q=null;const le=Object.seal(Je(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let He=!0,ct=!0,Va=!1,Ha=!0,Oe=!1,lt=!0,Pe=!1,Gt=!1,Kt=!1,Be=!1,Dt=!1,Nt=!1,Ba=!0,Qa=!1;const qa="user-content-";let Zt=!0,ht=!1,Qe={},Ce=null;const Xt=N({},["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"]);let Ua=null;const Ya=N({},["audio","video","img","source","image","track"]);let ea=null;const Ja=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ot="http://www.w3.org/1998/Math/MathML",Pt="http://www.w3.org/2000/svg",Me="http://www.w3.org/1999/xhtml";let qe=Me,ta=!1,aa=null;const sr=N({},[Ot,Pt,Me],ca);let sa=N({},["mi","mo","mn","ms","mtext"]),ra=N({},["annotation-xml"]);const rr=N({},["title","style","font","a","script"]);let ut=null;const nr=["application/xhtml+xml","text/html"],ir="text/html";let te=null,Ue=null;const or=t.createElement("form"),Ga=function(u){return u instanceof RegExp||u instanceof Function},na=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ue&&Ue===u)return;(!u||typeof u!="object")&&(u={}),u=me(u),ut=nr.indexOf(u.PARSER_MEDIA_TYPE)===-1?ir:u.PARSER_MEDIA_TYPE,te=ut==="application/xhtml+xml"?ca:xt,f=G(u,"ALLOWED_TAGS")&&ue(u.ALLOWED_TAGS)?N({},u.ALLOWED_TAGS,te):D,P=G(u,"ALLOWED_ATTR")&&ue(u.ALLOWED_ATTR)?N({},u.ALLOWED_ATTR,te):J,aa=G(u,"ALLOWED_NAMESPACES")&&ue(u.ALLOWED_NAMESPACES)?N({},u.ALLOWED_NAMESPACES,ca):sr,ea=G(u,"ADD_URI_SAFE_ATTR")&&ue(u.ADD_URI_SAFE_ATTR)?N(me(Ja),u.ADD_URI_SAFE_ATTR,te):Ja,Ua=G(u,"ADD_DATA_URI_TAGS")&&ue(u.ADD_DATA_URI_TAGS)?N(me(Ya),u.ADD_DATA_URI_TAGS,te):Ya,Ce=G(u,"FORBID_CONTENTS")&&ue(u.FORBID_CONTENTS)?N({},u.FORBID_CONTENTS,te):Xt,ve=G(u,"FORBID_TAGS")&&ue(u.FORBID_TAGS)?N({},u.FORBID_TAGS,te):me({}),q=G(u,"FORBID_ATTR")&&ue(u.FORBID_ATTR)?N({},u.FORBID_ATTR,te):me({}),Qe=G(u,"USE_PROFILES")?u.USE_PROFILES&&typeof u.USE_PROFILES=="object"?me(u.USE_PROFILES):u.USE_PROFILES:!1,He=u.ALLOW_ARIA_ATTR!==!1,ct=u.ALLOW_DATA_ATTR!==!1,Va=u.ALLOW_UNKNOWN_PROTOCOLS||!1,Ha=u.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Oe=u.SAFE_FOR_TEMPLATES||!1,lt=u.SAFE_FOR_XML!==!1,Pe=u.WHOLE_DOCUMENT||!1,Be=u.RETURN_DOM||!1,Dt=u.RETURN_DOM_FRAGMENT||!1,Nt=u.RETURN_TRUSTED_TYPE||!1,Kt=u.FORCE_BODY||!1,Ba=u.SANITIZE_DOM!==!1,Qa=u.SANITIZE_NAMED_PROPS||!1,Zt=u.KEEP_CONTENT!==!1,ht=u.IN_PLACE||!1,ot=ln(u.ALLOWED_URI_REGEXP)?u.ALLOWED_URI_REGEXP:Ks,qe=typeof u.NAMESPACE=="string"?u.NAMESPACE:Me,sa=G(u,"MATHML_TEXT_INTEGRATION_POINTS")&&u.MATHML_TEXT_INTEGRATION_POINTS&&typeof u.MATHML_TEXT_INTEGRATION_POINTS=="object"?me(u.MATHML_TEXT_INTEGRATION_POINTS):N({},["mi","mo","mn","ms","mtext"]),ra=G(u,"HTML_INTEGRATION_POINTS")&&u.HTML_INTEGRATION_POINTS&&typeof u.HTML_INTEGRATION_POINTS=="object"?me(u.HTML_INTEGRATION_POINTS):N({},["annotation-xml"]);const C=G(u,"CUSTOM_ELEMENT_HANDLING")&&u.CUSTOM_ELEMENT_HANDLING&&typeof u.CUSTOM_ELEMENT_HANDLING=="object"?me(u.CUSTOM_ELEMENT_HANDLING):Je(null);if(Q=Je(null),G(C,"tagNameCheck")&&Ga(C.tagNameCheck)&&(Q.tagNameCheck=C.tagNameCheck),G(C,"attributeNameCheck")&&Ga(C.attributeNameCheck)&&(Q.attributeNameCheck=C.attributeNameCheck),G(C,"allowCustomizedBuiltInElements")&&typeof C.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=C.allowCustomizedBuiltInElements),Oe&&(ct=!1),Dt&&(Be=!0),Qe&&(f=N({},Cs),P=Je(null),Qe.html===!0&&(N(f,bs),N(P,Ms)),Qe.svg===!0&&(N(f,la),N(P,da),N(P,zt)),Qe.svgFilters===!0&&(N(f,ha),N(P,da),N(P,zt)),Qe.mathMl===!0&&(N(f,ua),N(P,Ss),N(P,zt))),le.tagCheck=null,le.attributeCheck=null,G(u,"ADD_TAGS")&&(typeof u.ADD_TAGS=="function"?le.tagCheck=u.ADD_TAGS:ue(u.ADD_TAGS)&&(f===D&&(f=me(f)),N(f,u.ADD_TAGS,te))),G(u,"ADD_ATTR")&&(typeof u.ADD_ATTR=="function"?le.attributeCheck=u.ADD_ATTR:ue(u.ADD_ATTR)&&(P===J&&(P=me(P)),N(P,u.ADD_ATTR,te))),G(u,"ADD_URI_SAFE_ATTR")&&ue(u.ADD_URI_SAFE_ATTR)&&N(ea,u.ADD_URI_SAFE_ATTR,te),G(u,"FORBID_CONTENTS")&&ue(u.FORBID_CONTENTS)&&(Ce===Xt&&(Ce=me(Ce)),N(Ce,u.FORBID_CONTENTS,te)),G(u,"ADD_FORBID_CONTENTS")&&ue(u.ADD_FORBID_CONTENTS)&&(Ce===Xt&&(Ce=me(Ce)),N(Ce,u.ADD_FORBID_CONTENTS,te)),Zt&&(f["#text"]=!0),Pe&&N(f,["html","head","body"]),f.table&&(N(f,["tbody"]),delete ve.tbody),u.TRUSTED_TYPES_POLICY){if(typeof u.TRUSTED_TYPES_POLICY.createHTML!="function")throw $t('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof u.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $t('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=u.TRUSTED_TYPES_POLICY,j=k.createHTML("")}else k===void 0&&(k=bn(w,s)),k!==null&&typeof j=="string"&&(j=k.createHTML(""));pe&&pe(u),Ue=u},Ka=N({},[...la,...ha,...hn]),Za=N({},[...ua,...un]),cr=function(u){let C=v(u);(!C||!C.tagName)&&(C={namespaceURI:qe,tagName:"template"});const M=xt(u.tagName),H=xt(C.tagName);return aa[u.namespaceURI]?u.namespaceURI===Pt?C.namespaceURI===Me?M==="svg":C.namespaceURI===Ot?M==="svg"&&(H==="annotation-xml"||sa[H]):!!Ka[M]:u.namespaceURI===Ot?C.namespaceURI===Me?M==="math":C.namespaceURI===Pt?M==="math"&&ra[H]:!!Za[M]:u.namespaceURI===Me?C.namespaceURI===Pt&&!ra[H]||C.namespaceURI===Ot&&!sa[H]?!1:!Za[M]&&(rr[M]||!Ka[M]):!!(ut==="application/xhtml+xml"&&aa[u.namespaceURI]):!1},Fe=function(u){Lt(e.removed,{element:u});try{v(u).removeChild(u)}catch{T(u)}},$e=function(u,C){try{Lt(e.removed,{attribute:C.getAttributeNode(u),from:C})}catch{Lt(e.removed,{attribute:null,from:C})}if(C.removeAttribute(u),u==="is")if(Be||Dt)try{Fe(C)}catch{}else try{C.setAttribute(u,"")}catch{}},Xa=function(u){let C=null,M=null;if(Kt)u="<remove></remove>"+u;else{const Y=Ls(u,/^[\r\n\t ]+/);M=Y&&Y[0]}ut==="application/xhtml+xml"&&qe===Me&&(u='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+u+"</body></html>");const H=k?k.createHTML(u):u;if(qe===Me)try{C=new p().parseFromString(H,ut)}catch{}if(!C||!C.documentElement){C=F.createDocument(qe,"template",null);try{C.documentElement.innerHTML=ta?j:H}catch{}}const ie=C.body||C.documentElement;return u&&M&&ie.insertBefore(t.createTextNode(M),ie.childNodes[0]||null),qe===Me?B.call(C,Pe?"html":"body")[0]:Pe?C.documentElement:ie},es=function(u){return E.call(u.ownerDocument||u,u,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},ia=function(u){return u instanceof m&&(typeof u.nodeName!="string"||typeof u.textContent!="string"||typeof u.removeChild!="function"||!(u.attributes instanceof g)||typeof u.removeAttribute!="function"||typeof u.setAttribute!="function"||typeof u.namespaceURI!="string"||typeof u.insertBefore!="function"||typeof u.hasChildNodes!="function")},oa=function(u){return typeof i=="function"&&u instanceof i};function Ae(u,C,M){ft(u,H=>{H.call(e,C,M,Ue)})}const ts=function(u){let C=null;if(Ae(_.beforeSanitizeElements,u,null),ia(u))return Fe(u),!0;const M=te(u.nodeName);if(Ae(_.uponSanitizeElement,u,{tagName:M,allowedTags:f}),lt&&u.hasChildNodes()&&!oa(u.firstElementChild)&&oe(/<[/\w!]/g,u.innerHTML)&&oe(/<[/\w!]/g,u.textContent)||lt&&u.namespaceURI===Me&&M==="style"&&oa(u.firstElementChild)||u.nodeType===wt.progressingInstruction||lt&&u.nodeType===wt.comment&&oe(/<[/\w]/g,u.data))return Fe(u),!0;if(ve[M]||!(le.tagCheck instanceof Function&&le.tagCheck(M))&&!f[M]){if(!ve[M]&&ss(M)&&(Q.tagNameCheck instanceof RegExp&&oe(Q.tagNameCheck,M)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(M)))return!1;if(Zt&&!Ce[M]){const H=v(u)||u.parentNode,ie=x(u)||u.childNodes;if(ie&&H){const Y=ie.length;for(let Ee=Y-1;Ee>=0;--Ee){const Se=L(ie[Ee],!0);H.insertBefore(Se,y(u))}}}return Fe(u),!0}return u instanceof c&&!cr(u)||(M==="noscript"||M==="noembed"||M==="noframes")&&oe(/<\/no(script|embed|frames)/i,u.innerHTML)?(Fe(u),!0):(Oe&&u.nodeType===wt.text&&(C=u.textContent,ft([ce,be,Te],H=>{C=Ye(C,H," ")}),u.textContent!==C&&(Lt(e.removed,{element:u.cloneNode()}),u.textContent=C)),Ae(_.afterSanitizeElements,u,null),!1)},as=function(u,C,M){if(q[C]||Ba&&(C==="id"||C==="name")&&(M in t||M in or))return!1;const H=P[C]||le.attributeCheck instanceof Function&&le.attributeCheck(C,u);if(!(ct&&!q[C]&&oe(nt,C))&&!(He&&oe(jt,C))){if(!H||q[C]){if(!(ss(u)&&(Q.tagNameCheck instanceof RegExp&&oe(Q.tagNameCheck,u)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(u))&&(Q.attributeNameCheck instanceof RegExp&&oe(Q.attributeNameCheck,C)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(C,u))||C==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&oe(Q.tagNameCheck,M)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(M))))return!1}else if(!ea[C]&&!oe(ot,Ye(M,it,""))&&!((C==="src"||C==="xlink:href"||C==="href")&&u!=="script"&&ys(M,"data:")===0&&Ua[u])&&!(Va&&!oe(It,Ye(M,it,"")))&&M)return!1}return!0},lr=N({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ss=function(u){return!lr[xt(u)]&&oe(Rt,u)},rs=function(u){Ae(_.beforeSanitizeAttributes,u,null);const{attributes:C}=u;if(!C||ia(u))return;const M={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P,forceKeepAttr:void 0};let H=C.length;for(;H--;){const ie=C[H],{name:Y,namespaceURI:Ee,value:Se}=ie,he=te(Y),De=Se;let re=Y==="value"?De:an(De);if(M.attrName=he,M.attrValue=re,M.keepAttr=!0,M.forceKeepAttr=void 0,Ae(_.uponSanitizeAttribute,u,M),re=M.attrValue,Qa&&(he==="id"||he==="name")&&ys(re,qa)!==0&&($e(Y,u),re=qa+re),lt&&oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,re)){$e(Y,u);continue}if(he==="attributename"&&Ls(re,"href")){$e(Y,u);continue}if(M.forceKeepAttr)continue;if(!M.keepAttr){$e(Y,u);continue}if(!Ha&&oe(/\/>/i,re)){$e(Y,u);continue}Oe&&ft([ce,be,Te],hr=>{re=Ye(re,hr," ")});const is=te(u.nodeName);if(!as(is,he,re)){$e(Y,u);continue}if(k&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Ee)switch(w.getAttributeType(is,he)){case"TrustedHTML":{re=k.createHTML(re);break}case"TrustedScriptURL":{re=k.createScriptURL(re);break}}if(re!==De)try{Ee?u.setAttributeNS(Ee,Y,re):u.setAttribute(Y,re),ia(u)?Fe(u):fs(e.removed)}catch{$e(Y,u)}}Ae(_.afterSanitizeAttributes,u,null)},ns=function(u){let C=null;const M=es(u);for(Ae(_.beforeSanitizeShadowDOM,u,null);C=M.nextNode();)Ae(_.uponSanitizeShadowNode,C,null),ts(C),rs(C),C.content instanceof n&&ns(C.content);Ae(_.afterSanitizeShadowDOM,u,null)};return e.sanitize=function(u){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M=null,H=null,ie=null,Y=null;if(ta=!u,ta&&(u="<!-->"),typeof u!="string"&&!oa(u)&&(u=cn(u),typeof u!="string"))throw $t("dirty is not a string, aborting");if(!e.isSupported)return u;if(Gt||na(C),e.removed=[],typeof u=="string"&&(ht=!1),ht){const he=u.nodeName;if(typeof he=="string"){const De=te(he);if(!f[De]||ve[De])throw $t("root node is forbidden and cannot be sanitized in-place")}}else if(u instanceof i)M=Xa("<!---->"),H=M.ownerDocument.importNode(u,!0),H.nodeType===wt.element&&H.nodeName==="BODY"||H.nodeName==="HTML"?M=H:M.appendChild(H);else{if(!Be&&!Oe&&!Pe&&u.indexOf("<")===-1)return k&&Nt?k.createHTML(u):u;if(M=Xa(u),!M)return Be?null:Nt?j:""}M&&Kt&&Fe(M.firstChild);const Ee=es(ht?u:M);for(;ie=Ee.nextNode();)ts(ie),rs(ie),ie.content instanceof n&&ns(ie.content);if(ht)return u;if(Be){if(Oe){M.normalize();let he=M.innerHTML;ft([ce,be,Te],De=>{he=Ye(he,De," ")}),M.innerHTML=he}if(Dt)for(Y=O.call(M.ownerDocument);M.firstChild;)Y.appendChild(M.firstChild);else Y=M;return(P.shadowroot||P.shadowrootmode)&&(Y=Z.call(a,Y,!0)),Y}let Se=Pe?M.outerHTML:M.innerHTML;return Pe&&f["!doctype"]&&M.ownerDocument&&M.ownerDocument.doctype&&M.ownerDocument.doctype.name&&oe(Zs,M.ownerDocument.doctype.name)&&(Se="<!DOCTYPE "+M.ownerDocument.doctype.name+`>
|
|
78
|
-
`+Se),Oe&&ft([ce,be,Te],he=>{Se=Ye(Se,he," ")}),k&&Nt?k.createHTML(Se):Se},e.setConfig=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};na(u),Gt=!0},e.clearConfig=function(){Ue=null,Gt=!1},e.isValidAttribute=function(u,C,M){Ue||na({});const H=te(u),ie=te(C);return as(H,ie,M)},e.addHook=function(u,C){typeof C=="function"&&Lt(_[u],C)},e.removeHook=function(u,C){if(C!==void 0){const M=en(_[u],C);return M===-1?void 0:tn(_[u],M,1)[0]}return fs(_[u])},e.removeHooks=function(u){_[u]=[]},e.removeAllHooks=function(){_=Ts()},e}var vs=Xs();class Cn{constructor(e){h(this,"dataLayer");this.dataLayer=e}get answerWidgetShowMoreLimit(){return this.dataLayer.answerWidgetShowMoreLimit??100}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalPages(){return this.resultsPerPage===0?0:Math.ceil(this.totalResults/this.resultsPerPage)}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){return this.dataLayer.itemsPerPage||0}get sortOptions(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.options)||[]}get selectedSortOption(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.selectedSortOption)||""}get startResultIndex(){var e;return(((e=this.dataLayer.searchObject)==null?void 0:e.page)-1)*this.resultsPerPage+1}get endResultIndex(){var t;const e=(((t=this.dataLayer.searchObject)==null?void 0:t.page)-1)*this.resultsPerPage+(this.resultsPerPage??0);return e>this.totalResults?this.totalResults:e}get isFirstPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)===1}get isLastPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)>=Math.ceil(this.totalResults/this.resultsPerPage)}get percentageOfResultsLoaded(){return this.endResultIndex/this.totalResults*100}get results(){return this.dataLayer.searchResults??[]}get autoCorrectedQuery(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||""}get originalQuery(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.query)||""}get getAnswerData(){return this.dataLayer.getAnswerData||""}get shouldShowAnswerLoadMore(){return this.dataLayer.getAnswerData.split(" ").length>this.answerWidgetShowMoreLimit}get answerTruncated(){return this.dataLayer.getAnswerData.split(" ").slice(0,this.answerWidgetShowMoreLimit).join(" ")+"..."}get fullAnswerFormatted(){return vs.sanitize(W.parse(this.dataLayer.getAnswerData)).replace(/<a /g,'<a target="_blank" class="searchstax-answer-link" rel="noopener noreferrer" ')}get answerLoading(){return this.dataLayer.answerLoading}get shouldShowAnswerError(){return this.dataLayer.answerError}get locationError(){return this.dataLayer.locationError}get shouldShowAnswer(){return(this.dataLayer.getAnswerData!==""||this.dataLayer.parsedData.answerLoading||this.shouldShowAnswerError)&&this.dataLayer.searchObject.query!=="*"}get searchTerm(){var e,t;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||((t=this.dataLayer.searchObject)==null?void 0:t.query)||""}get locationSearchEnabled(){return this.dataLayer.locationEnabled??!1}get locationSearchDistanceEnabled(){var e,t,a,s,n,o,i;return((t=(e=this.dataLayer.searchLocationConfig)==null?void 0:e.locationValuesOverride)!=null&&t.locationDistanceEnabled?(s=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:s.locationDistanceEnabled:(i=(o=(n=this.dataLayer.searchResultsMetadata)==null?void 0:n.location)==null?void 0:o.filter)==null?void 0:i.enabled)??!1}get locationSearchDistanceValues(){var a,s,n,o,i,c,l,g,m;const e=((s=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:s.filterValues)??((i=(o=(n=this.dataLayer.searchResultsMetadata)==null?void 0:n.location)==null?void 0:o.filter)==null?void 0:i.values),t=((l=(c=this.dataLayer.searchLocationConfig)==null?void 0:c.locationValuesOverride)==null?void 0:l.filterUnit)??((m=(g=this.dataLayer.searchResultsMetadata)==null?void 0:g.location)==null?void 0:m.unit);return!e||e.length===0?[]:e.map(p=>({label:p==="any"?"Any Distance":p+" "+(t??""),value:p,isSelected:p===this.dataLayer.searchRadius})).sort((p,w)=>{const b=p.value==="any"?0:parseFloat(p.value),L=w.value==="any"?0:parseFloat(w.value);return b-L})}get shouldShowLocationDistanceDropdown(){return this.locationSearchDistanceEnabled&&this.locationSearchDistanceValues.length>1}get searchingEverything(){return this.searchTerm==="*"}get firstSearchHappened(){return this.dataLayer.firstSearchHappened}get isInfiniteScroll(){return this.dataLayer.isInfiniteScroll??!1}get answerErrorMessage(){return vs.sanitize(W.parse(this.dataLayer.answerErrorMessage)).replace("<br>","")}get searchExecuted(){var e,t,a;return((e=this.dataLayer.searchObject)==null?void 0:e.query)!==void 0&&((t=this.dataLayer.searchObject)==null?void 0:t.query)!=="undefined"&&((a=this.dataLayer.searchObject)==null?void 0:a.query)!==""}get selectedFacets(){var t;const e=this.dataLayer.searchFacetsCached??this.dataLayer.searchFacets;return e?(((t=this.dataLayer.searchObject)==null?void 0:t.facets)??[]).map(a=>{const s=a.name,n=a.value,o=e.find(i=>i.name===s);if(o){const i=o.values.find(c=>c.type==="range"?!1:c.type==="checkbox"?'"'+c.value+'"'===n:!1);if(i)return i}return null}).filter(a=>a!==null):[]}get cachedANDFacets(){let e="";for(const t of this.dataLayer.searchObject.facets)(t.type==="and"||t.type==="tabs")&&(e+=JSON.stringify(t));return e}get relatedSearches(){const e=this.dataLayer.searchRelatedSearches??[];return e[e.length-1]&&(e[e.length-1].last=!0),e}get externalPromotions(){return this.dataLayer.searchExternalPromotions??[]}get data(){return{currentPage:this.currentPage,totalPages:this.totalPages,totalResults:this.totalResults,resultsPerPage:this.resultsPerPage,startResultIndex:this.startResultIndex,endResultIndex:this.endResultIndex,isFirstPage:this.isFirstPage,isLastPage:this.isLastPage,results:this.results,searchTerm:this.searchTerm!=="undefined"?this.searchTerm:"",autoCorrectedQuery:this.autoCorrectedQuery,originalQuery:this.originalQuery,selectedFacets:this.selectedFacets,searchExecuted:this.searchExecuted,searchingEverything:this.searchingEverything,relatedSearches:this.relatedSearches,hasRelatedSearches:this.relatedSearches.length>0,externalPromotions:this.externalPromotions,hasExternalPromotions:this.externalPromotions.length>0,hasResults:this.results.length>0,hasResultsOrExternalPromotions:this.results.length>0||this.externalPromotions.length>0,answer:this.getAnswerData,answerTruncated:this.answerTruncated,fullAnswerFormatted:this.fullAnswerFormatted,shouldShowAnswerLoadMore:this.shouldShowAnswerLoadMore,answerLoading:this.answerLoading,shouldShowAnswer:this.shouldShowAnswer,isInfiniteScroll:this.isInfiniteScroll,percentageOfResultsLoaded:this.percentageOfResultsLoaded,firstSearchHappened:this.firstSearchHappened,sortOptions:this.sortOptions,selectedSortOption:this.selectedSortOption,shouldShowAnswerError:this.shouldShowAnswerError,answerErrorMessage:this.answerErrorMessage,locationSearchEnabled:this.locationSearchEnabled,locationSearchDistanceEnabled:this.locationSearchDistanceEnabled,locationSearchDistanceValues:this.locationSearchDistanceValues,shouldShowLocationDistanceDropdown:this.shouldShowLocationDistanceDropdown,locationError:this.locationError}}get trackingData(){var e,t,a,s;return{searchTerm:this.searchTerm,trackApiKey:((e=this.dataLayer.searchstaxConfig)==null?void 0:e.trackApiKey)??"",session:this.dataLayer.sessionIdValue,language:this.dataLayer.language,recordsPerPage:((t=this.dataLayer.searchResultsMetadata)==null?void 0:t.recordsPerPageValue)??0,totalResults:((a=this.dataLayer.searchResultsMetadata)==null?void 0:a.totalResultsValue)??0,currentPage:this.dataLayer.currentPage,latencyVal:((s=this.dataLayer.searchResultsMetadata)==null?void 0:s.latency)??0,...this.dataLayer.model?{model:this.dataLayer.model}:{}}}}class Le{static deepEqual(e,t){const a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(const n of a){const o=e[n],i=t[n],c=this.isObject(o)&&this.isObject(i);if(c&&!this.deepEqual(o,i)||!c&&o!==i)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class R{constructor(e){h(this,"value");h(this,"observers",{});this.value=e,this.observers={}}subscribe(e,t){const a=Math.random().toString(36).substring(2,15),s=t||a;return this.observers[s]=e,e(this.value),s}unsubscribe(e){this.observers[e]&&delete this.observers[e]}subscribeOnce(e){const t=Math.random().toString(36).substring(2,15),a=s=>{e(s),this.unsubscribe(t)};this.subscribe(a,t)}subscribeTwice(e){const t=Math.random().toString(36).substring(2,15);let a=0;const s=n=>{a++,e(n),a>=2&&this.unsubscribe(t)};this.subscribe(s,t)}subscribeUntil(e,t,a=6e3,s=!0){const n=Math.random().toString(36).substring(2,15),o=i=>{i===t&&(e(i),this.unsubscribe(n))};return this.value===t?(e(this.value),null):(this.subscribe(o,n),setTimeout(()=>{s&&this.observers[n]&&e(this.value),this.unsubscribe(n)},a),n)}subscribeUntilHasValue(e,t=6e3,a=!0){const s=Math.random().toString(36).substring(2,15),n=o=>{o!=null&&(e(o),this.unsubscribe(s))};return this.value!==null&&this.value!==void 0?(e(this.value),null):(this.subscribe(n,s),t>0&&setTimeout(()=>{a&&this.observers[s]&&e(this.value),this.unsubscribe(s)},t),n)}setValue(e){this.value=e,this.notify()}getValue(){return this.value}notify(){for(const e in this.observers)if(Object.prototype.hasOwnProperty.call(this.observers,e)){const t=this.observers[e];typeof t=="function"&&t(this.value)}}}class ga{static getOrSetCookie(e,t){let a=this.getCookie(e);return a==null&&(a=t??this.makeid(25),this.setCookie(e,a,{secure:!0,"max-age":3600})),a}static deleteCookie(e){this.getCookie(e)&&this.setCookie(e,"",{secure:!0,"max-age":-1})}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=a.length;for(let n=0;n<e;n++)t+=a.charAt(Math.floor(Math.random()*s));return t}static getCookie(e){const t=typeof document<"u"?document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)")):null;return t?decodeURIComponent(t[1]):void 0}static setCookie(e,t,a){const s={path:"/",...a};a.expires instanceof Date&&(s.expires=a.expires.toUTCString());let n=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const o in s){n+="; "+o;const i=s[o];i!==!0&&(n+="="+i)}typeof document<"u"&&(document.cookie=n)}}class ne{static removeXSSRiskyTags(e){var t="script|style|iframe|object|embed|form|input|button",a=new RegExp("</?("+t+")(\\s[^>]*)?>","gi");return e?e.replace(a,""):""}}class Mn{constructor(e,t){h(this,"$searchTermChange",new R(""));h(this,"$searchLocationChange",new R(""));h(this,"$searchLocationCoordinatesDecoded",new R(""));h(this,"$searchLatChange",new R(""));h(this,"$searchLongChange",new R(""));h(this,"$searchRadiusChange",new R(void 0));h(this,"$loadingChange",new R(!1));h(this,"$locationError",new R(!1));h(this,"$searchResults",new R(null));h(this,"$searchResultsMetadata",new R(null));h(this,"$searchAutosuggest",new R(null));h(this,"$searchFacets",new R(null));h(this,"$searchFacetsCached",new R(null));h(this,"$searchFacetsCachedTabs",new R(null));h(this,"$searchstaxConfig",new R(null));h(this,"$autosuggestResults",new R(null));h(this,"$itemsPerPage",new R(void 0));h(this,"$searchObject",new R({query:"",itemsPerPage:void 0,page:99999999,order:"",facets:[],additionalProps:[],location:{term:void 0,radius:void 0,lat:void 0,lon:void 0},model:""}));h(this,"$searchRelatedSearches",new R(null));h(this,"$searchInputConfig",new R(null));h(this,"$searchLocationConfig",new R(null));h(this,"$searchExternalPromotions",new R(null));h(this,"$facetsTemplateData",new R(null));h(this,"$selectedFacetsTemplateData",new R(null));h(this,"$paginationData",new R(null));h(this,"$answerData",new R(null));h(this,"$searchFeedbackData",new R(null));h(this,"$inputWidgetTemplateData",new R(null));h(this,"$locationWidgetTemplateData",new R(null));h(this,"$searchSortingData",new R(null));h(this,"$searchRelatedSearchesData",new R(null));h(this,"$searchExternalPromotionsData",new R(null));h(this,"$cookiesDisabled",new R(null));h(this,"$locationDecodingLoading",new R(!1));h(this,"$answer",new R(""));h(this,"$language",new R("en"));h(this,"$model",new R(""));h(this,"$answerLoading",new R(!1));h(this,"$locationEnabled",new R(null));h(this,"$answerError",new R(!1));h(this,"$answerErrorMessage",new R(""));h(this,"$isQuestion",new R(!1));h(this,"$inputTemplateRendered",new R(!1));h(this,"currentPageValue",1);h(this,"isAnswerWidgetCreatedValue",!1);h(this,"renderingEngineValue",K.mustache);h(this,"parsedData",new Cn(this));h(this,"sessionId");h(this,"sessionIdValue",null);h(this,"autoCorrect",!0);h(this,"forceNotCorrect",!1);h(this,"lastSearchValue","");h(this,"turnAIAnswerGenerationOn",!1);h(this,"questionURL","");h(this,"isInfiniteScroll",!1);h(this,"firstSearchHappened",!1);h(this,"facetsWereSet",!1);h(this,"answerWidgetShowMoreLimit",100);h(this,"searchHelper");h(this,"searchResultUnparsed");this.sessionId=e,t&&(this.sessionIdValue=t),this.cookieHandlingCallback(t),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback(t)})}cookieHandlingCallback(e){this.cookiesDisabled?(this.sessionIdValue=null,ga.deleteCookie(this.sessionId),ga.deleteCookie("ms_visitorid")):this.sessionIdValue=ga.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(ne.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(ne.removeXSSRiskyTags(e))}setSearchRadius(e){this.$searchRadiusChange.setValue(e)}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setIsAnswerWidgetCreated(e){this.isAnswerWidgetCreatedValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){this.firstSearchHappened=!0,(!Le.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){Le.deepEqual(e,this.searchResultsMetadata??{})||this.$searchResultsMetadata.setValue(e)}setSearchAutosuggest(e){this.$searchAutosuggest.setValue(e)}setSearchObject(e){var a,s;let t=e;t={...t,itemsPerPage:this.itemsPerPage,model:this.model},(s=(a=this.searchstaxConfig)==null?void 0:a.hooks)!=null&&s.beforeSearch&&t&&(t=this.searchstaxConfig.hooks.beforeSearch(t)),t&&(!Le.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&(this.searchObject.itemsPerPage!==t.itemsPerPage&&t.itemsPerPage!==void 0&&this.setItemsPerPage(t.itemsPerPage),this.$searchObject.setValue(t))}setSearchFacets(e){this.facetsWereSet=!0,Le.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){Le.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchFacetsCachedTabs(e){Le.deepEqual(e,this.searchFacetsCachedTabs??[])||this.$searchFacetsCachedTabs.setValue(e)}setSearchRelatedSearches(e){Le.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){Le.deepEqual(e,this.searchExternalPromotions??[])||this.$searchExternalPromotions.setValue(e)}setLanguage(e){this.$language.setValue(e)}setModel(e){this.$model.setValue(e)}setSearchstaxConfig(e){this.$searchstaxConfig.setValue(e)}setSearchInputConfig(e){this.$searchInputConfig.setValue(e)}setSearchLocationConfig(e){this.$searchLocationConfig.setValue(e)}setAutosuggestResults(e){this.$autosuggestResults.setValue(e)}setFacetsTemplateData(e){this.$facetsTemplateData.setValue(e)}setSelectedFacetsTemplateData(e){this.$selectedFacetsTemplateData.setValue(e)}setPaginationData(e){this.$paginationData.setValue(e)}setAnswerFullData(e){this.$answerData.setValue(e)}setSearchFeedbackData(e){this.$searchFeedbackData.setValue(e)}setSearchSortingData(e){this.$searchSortingData.setValue(e)}setRelatedSearchesData(e){this.$searchRelatedSearchesData.setValue(e)}setExternalPromotionsData(e){this.$searchExternalPromotionsData.setValue(e)}setCookiesDisabled(e){this.$cookiesDisabled.setValue(e)}setAnswerData(e){this.$answer.setValue(e)}setItemsPerPage(e){this.$itemsPerPage.setValue(e)}setAnswerLoading(e){this.$answerLoading.setValue(e)}setAnswerError(e){this.$answerError.setValue(e)}setIsQuestion(e){this.$isQuestion.setValue(e)}setAnswerErrorMessage(e){this.$answerErrorMessage.setValue(e)}setLocationDecodingLoading(e){this.$locationDecodingLoading.setValue(e)}setSearchLat(e){this.$searchLatChange.setValue(e)}setSearchLong(e){this.$searchLongChange.setValue(e)}setInputTemplateRendered(e){this.$inputTemplateRendered.setValue(e)}setLocationError(e){this.$locationError.setValue(e)}setInputWidgetTemplateData(e){this.$inputWidgetTemplateData.setValue(e)}setLocationWidgetTemplateData(e){this.$locationWidgetTemplateData.setValue(e)}setLocationCoordinatesDecoded(e){this.$searchLocationCoordinatesDecoded.setValue(ne.removeXSSRiskyTags(e))}setLocationEnabled(e){this.$locationEnabled.setValue(e)}setSearchResultUnparsedData(e){this.searchResultUnparsed=e}get getAnswerData(){return this.$answer.getValue()}get searchstaxConfig(){return this.$searchstaxConfig.getValue()}get searchFacets(){return this.$searchFacets.getValue()?JSON.parse(JSON.stringify(this.$searchFacets.getValue())):null}get searchFacetsCached(){return this.$searchFacetsCached.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCached.getValue())):null}get searchFacetsCachedTabs(){return this.$searchFacetsCachedTabs.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedTabs.getValue())):null}get searchResults(){return this.$searchResults.getValue()?JSON.parse(JSON.stringify(this.$searchResults.getValue())):null}get searchTerm(){return this.$searchTermChange.getValue()}get searchLocation(){return this.$searchLocationChange.getValue()}get searchRadius(){return this.$searchRadiusChange.getValue()}get loading(){return this.$loadingChange.getValue()}get searchAutosuggest(){return this.$searchAutosuggest.getValue()}get searchResultsMetadata(){return this.$searchResultsMetadata.getValue()?JSON.parse(JSON.stringify(this.$searchResultsMetadata.getValue())):null}get currentPage(){return this.$searchObject.getValue().page??this.currentPageValue}get isAnswerWidgetCreated(){return this.isAnswerWidgetCreatedValue}get renderingEngine(){return this.renderingEngineValue}get searchObject(){return JSON.parse(JSON.stringify(this.$searchObject.getValue()))}get searchRelatedSearches(){return this.$searchRelatedSearches.getValue()?JSON.parse(JSON.stringify(this.$searchRelatedSearches.getValue())):null}get searchExternalPromotions(){return this.$searchExternalPromotions.getValue()?JSON.parse(JSON.stringify(this.$searchExternalPromotions.getValue())):null}get language(){return this.$language.getValue()}get model(){return this.$model.getValue()}get searchInputConfig(){return this.$searchInputConfig.getValue()}get searchLocationConfig(){return this.$searchLocationConfig.getValue()}get answerConfig(){return this.$answer.getValue()}get autosuggestResults(){return this.$autosuggestResults.getValue()}get facetsTemplateData(){return this.$facetsTemplateData.getValue()}get selectedFacetsTemplateData(){return this.$selectedFacetsTemplateData.getValue()}get paginationData(){return this.$paginationData.getValue()}get searchFeedbackData(){return this.$searchFeedbackData.getValue()}get searchSortingData(){return this.$searchSortingData.getValue()}get searchRelatedSearchesData(){return this.$searchRelatedSearchesData.getValue()}get searchExternalPromotionsData(){return this.$searchExternalPromotionsData.getValue()}get cookiesDisabled(){return(this.$cookiesDisabled.getValue()??!1)||!navigator.cookieEnabled}get itemsPerPage(){return this.$itemsPerPage.getValue()}get answerFullData(){return this.$answerData.getValue()}get answerLoading(){return this.$answerLoading.getValue()}get isQuestion(){return this.$isQuestion.getValue()}get answerError(){return this.$answerError.getValue()}get answerErrorMessage(){return this.$answerErrorMessage.getValue()}get locationDecodingLoading(){return this.$locationDecodingLoading.getValue()}get searchLat(){return this.$searchLatChange.getValue()}get searchLong(){return this.$searchLongChange.getValue()}get inputTemplateRendered(){return this.$inputTemplateRendered.getValue()}get locationError(){return this.$locationError.getValue()}get inputWidgetTemplateData(){return this.$inputWidgetTemplateData.getValue()}get locationWidgetTemplateData(){return this.$locationWidgetTemplateData.getValue()}get searchLocationCoordinatesDecoded(){return this.$searchLocationCoordinatesDecoded.getValue()}get locationEnabled(){return this.$locationEnabled.getValue()}get searchResultUnparsedData(){return this.searchResultUnparsed}}class bt{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"");return e.response.docs.forEach((s,n)=>{var c;const o=s[e.responseHeader.params.uniqueId]??"",i={custom:null,uniqueId:o,position:a+1+n,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",s,e,o):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",s,e,o):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",s,e,o):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",s,e,o):null,titleTracking:this.doesMapExist("title",e)?this.getValueByKey("title",s,e,o,!0):null,promoted:s["[elevated]"]?s["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",s,e,o):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",s,e,o):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",s,e,o):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",s,e,o):null,distance:this.doesMapExist("distance",e)&&this.getValueByKey("distance",s,e,o)!=="Infinity"&&this.getValueByKey("distance",s,e,o)?Math.floor(this.getValueByKey("distance",s,e,o)):null,unit:((c=e.metadata.locationSearch)==null?void 0:c.unit)??"",unmappedFields:this.getUnmappedFields(s,e,o),allFields:this.getAllFields(s,e)};t.push(i)}),t}static extractFacets(e){const t=[];if(e.metadata.facets)for(const a of e.metadata.facets){let s={values:[]};if(s.name=a.name,s.label=a.label,a.name in e.facet_counts.facet_fields){const n=e.facet_counts.facet_fields[a.name];for(let o=0;o<n.length;o+=2){const i={};i.value=n[o],i.parentName=s.name,i.count=n[o+1],i.type="checkbox",s.values.push(i)}}s.values.length>0&&t.push(s)}return t}static extractSearchResultsMetadata(e){var n,o,i,c,l,g,m,p,w,b;let t="",a={selectedSortOption:"",options:[]},s={enabled:!1,field:"",unit:"",filter:{enabled:!1,values:[],label:"",defaultValue:""}};if(e.metadata.locationSearch&&(s={enabled:e.metadata.locationSearch.enabled,field:e.metadata.locationSearch.field,unit:e.metadata.locationSearch.unit,filter:{enabled:((n=e.metadata.locationSearch.filter)==null?void 0:n.enabled)??!1,values:((o=e.metadata.locationSearch.filter)==null?void 0:o.values)??[],label:((i=e.metadata.locationSearch.filter)==null?void 0:i.label)??"",defaultValue:((c=e.metadata.locationSearch.filter)==null?void 0:c.defaultValue)??""}}),(l=e.metadata.results.find(L=>L.result_card==="date"))==null||l.name,a.options=[],(g=e.metadata.sorts)==null?void 0:g.length){const L=e.metadata.sorts.map(T=>({value:T.label,key:T.name+" "+T.order}));a.options=[{key:"",value:"Relevance"},...L]}return t=((b=(w=(p=(m=e==null?void 0:e.spellcheck)==null?void 0:m.suggestions)==null?void 0:p[1])==null?void 0:w.suggestion)==null?void 0:b[0])??"",typeof t!="string"&&(t=(t==null?void 0:t.word)??""),{recordsPerPageValue:parseInt(e.responseHeader.params.rows),startDocVal:parseInt(e.response.start+""),totalResultsValue:parseInt(e.response.numFound+""),latency:parseInt(e.responseHeader.QTime+""),endDocValue:parseInt(e.responseHeader.params.rows)+parseInt(e.response.start+""),spellingSuggestion:t,autoCorrectedQuery:e.responseHeader.params.autoCorrectedQ??"",impressions:this.getImpressions(e),sorting:a,location:s,isLocationMapped:this.doesMapExist("distance",e)}}static getImpressions(e){const t=[],a=this.combineResultsWithMetadata(e);for(const s in a){const n=a[s],o={};o.cDocId=this.getDataForAnalytics(n.uniqueId),n.title&&(o.cDocTitle=this.getDataForAnalytics(n.titleTracking)),o.position=n.position,t.push(o)}return t}static getDataForAnalytics(e){return e!==null?typeof e>"u"?"":typeof e=="string"?e:typeof e.join<"u"?e[0]:e:""}static findResultByUniqueId(e,t){return t.find(a=>a.uniqueId===e)??null}static getUnmappedFields(e,t,a){const s=t.metadata.results.filter(o=>o.result_card==="").map(o=>o.name),n=[];for(const o of s)if(Object.keys(e).includes(o)){const i=Array.isArray(e[o])?this.getHighlightedResults(o,e[o].join(", "),a,t):this.getHighlightedResults(o,e[o]+"",a,t);n.push({key:o,value:i,isImage:this.checkIfImage(e[o])})}return n}static checkIfImage(e){return e===void 0?!1:typeof e!="string"?Array.isArray(e)&&e[0]?/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e[0]):!1:/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e)}static getAllFields(e,t){const a=t.metadata.results.map(n=>n.name),s=[];for(const n of Object.keys(e))a.indexOf(n)!==-1&&s.push({key:n,value:e[n],isImage:this.checkIfImage(e[n])});return s}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a,s,n=!1){const o=a.metadata.results.find(c=>c.result_card===e);if(o===void 0)return null;const i=t[o.name];return i===void 0?null:typeof i=="string"?n?i:this.getHighlightedResults(o.name,i,s,a):typeof i=="number"?i:Array.isArray(i)?n?i.join(", "):this.getHighlightedResults(o.name,i.join(", "),s,a):null}static getHighlightedResults(e,t,a,s){if(s.highlighting&&a in s.highlighting){let n=s.highlighting[a];if(n&&e in n){let o=n[e];const i=this.cleanValue(o);if(i!=="")return i}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class As{constructor(e){h(this,"routeName","searchstax");h(this,"ignoredKeys",[]);h(this,"queryStringHelper");h(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new Sn(this.routeName)}updateUrl(e){const t=this.searchObjectToUrl(e);let a=typeof document<"u"?document==null?void 0:document.title:"";this.titleParser&&(a=this.titleParser(e)),typeof document<"u"&&(document.title=a),(window==null?void 0:window.location.href)!==t&&(window==null||window.history.replaceState(window.history.state,a,t))}searchObjectToUrl(e){return this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")?(window==null?void 0:window.location.href.split("?")[0])+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys}):(window==null?void 0:window.location.href)+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys})}searchObjectToParams(e){const t={},a=e.page||1;if(e.query&&(t[this.routeName+"[query]"]=encodeURIComponent(e.query)),e.page&&(t[this.routeName+"[page]"]=a+""),e.order&&(t[this.routeName+"[order]"]=e.order),e.itemsPerPage&&e.itemsPerPage!==10&&(t[this.routeName+"[itemsPerPage]"]=e.itemsPerPage+""),e.location)for(const s in e.location){const n=e.location[s];n&&(t[this.routeName+`[location][${s}]`]=n)}if(e.facets)for(const s in e.facets){const n=e.facets[s].type+":"+encodeURIComponent(e.facets[s].name)+":"+encodeURIComponent(e.facets[s].value);t[this.routeName+`[facets][${s}]`]=n}if(e.model&&(t[this.routeName+"[model]"]=e.model),this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")){const s=this.queryStringHelper.urlToParams((window==null?void 0:window.location.href)??"");for(const n in s)n.startsWith(this.routeName)&&delete s[n];return{...s,...t}}else return t}extractParamsThatDoNotStartWithRouteName(e){const t={};for(const a in e)a.startsWith(this.routeName)||(t[a]=e[a]);return t}extractArrayOfFacetsFromQueryParameters(e){var a,s,n;const t=[];for(const o in e)if(o.startsWith(this.routeName+"[facets]")){const i=ne.removeXSSRiskyTags((a=e[o].split(":"))==null?void 0:a[0]),c=ne.removeXSSRiskyTags(decodeURIComponent((s=e[o].split(":"))==null?void 0:s[1])),l=ne.removeXSSRiskyTags(decodeURIComponent((n=e[o].split(":"))==null?void 0:n[2]));t.push({type:i,name:c,value:l})}return t}urlToSearchObject(e,t){const a=this.queryStringHelper.urlToParams(e),s=ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),n=parseInt(s),o=isNaN(n)?1:n;let i=parseInt(ne.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return isNaN(i)&&(i=10),{query:ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:o,itemsPerPage:t??i,order:ne.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:ne.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class Sn{constructor(e){h(this,"routeName","");h(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(s=>{const n=a[s];return Array.isArray(n)?n.map(o=>`${s}=${o}`).join("&"):`${s}=${n}`}).join("&")});this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],s={};return Object.keys(e).forEach(n=>{a.includes(n)||e[n]!==""&&(s[n]=e[n])}),s}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(s=>{const[n,o]=s.split("=");t[n]=o}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}const et={question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class Es extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const js=10,kn=13,ze=32;function pa(r){}function Tn(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=pa,onError:t=pa,onRetry:a=pa,onComment:s}=r,n=[];let o=!0,i,c="",l=0,g;function m(y){if(o&&(o=!1,y.charCodeAt(0)===239&&y.charCodeAt(1)===187&&y.charCodeAt(2)===191&&(y=y.slice(3))),n.length===0){const k=p(y);k!==""&&n.push(k);return}if(y.indexOf(`
|
|
79
|
-
`)===-1&&y.indexOf("\r")===-1){n.push(y);return}n.push(y);const x=n.join("");n.length=0;const v=p(x);v!==""&&n.push(v)}function p(y){let x=0;if(y.indexOf("\r")===-1){let v=y.indexOf(`
|
|
80
|
-
|
|
81
|
-
`,
|
|
82
|
-
`,
|
|
83
|
-
|
|
84
|
-
`,
|
|
85
|
-
`,
|
|
86
|
-
|
|
87
|
-
${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.test(x)?a(parseInt(x,10)):t(new Es(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:v}));break;default:t(new Es(`Unknown field "${y.length>20?`${y.slice(0,20)}…`:y}"`,{type:"unknown-field",field:y,value:x,line:v}));break}}function L(){l>0&&e({id:i,event:g,data:c}),i=void 0,c="",l=0,g=void 0}function T(y={}){if(y.consume&&n.length>0){const x=n.join("");w(x,0,x.length)}o=!0,i=void 0,c="",l=0,g=void 0,n.length=0}return{feed:m,reset:T}}function Is(r,e,t){return t===100&&r.charCodeAt(e+1)===97&&r.charCodeAt(e+2)===116&&r.charCodeAt(e+3)===97&&r.charCodeAt(e+4)===58}function Rs(r,e,t){return t===101&&r.charCodeAt(e+1)===118&&r.charCodeAt(e+2)===101&&r.charCodeAt(e+3)===110&&r.charCodeAt(e+4)===116&&r.charCodeAt(e+5)===58}class Ds extends Event{constructor(e,t){var a,s;super(e),this.code=(a=t==null?void 0:t.code)!=null?a:void 0,this.message=(s=t==null?void 0:t.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,a){return a(Ns(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Ns(this),t)}}function vn(r){const e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function Ma(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(Ma).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${Ma(r.cause)}`:r.message:`${r}`}function Ns(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var er=r=>{throw TypeError(r)},Wa=(r,e,t)=>e.has(r)||er("Cannot "+t),$=(r,e,t)=>(Wa(r,e,"read from private field"),t?t.call(r):e.get(r)),ae=(r,e,t)=>e.has(r)?er("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),U=(r,e,t,a)=>(Wa(r,e,"write to private field"),e.set(r,t),t),je=(r,e,t)=>(Wa(r,e,"access private method"),t),fe,We,Ke,Vt,Ut,kt,tt,Tt,Ne,Ze,st,Xe,Ct,we,Sa,ka,Ta,Os,va,Aa,Mt,Ea,ja;class Ht extends EventTarget{constructor(e,t){var a,s;super(),ae(this,we),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,ae(this,fe),ae(this,We),ae(this,Ke),ae(this,Vt),ae(this,Ut),ae(this,kt),ae(this,tt),ae(this,Tt,null),ae(this,Ne),ae(this,Ze),ae(this,st,null),ae(this,Xe,null),ae(this,Ct,null),ae(this,ka,async n=>{var o;$(this,Ze).reset();const{body:i,redirected:c,status:l,headers:g}=n;if(l===204){je(this,we,Mt).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?U(this,Ke,new URL(n.url)):U(this,Ke,void 0),l!==200){je(this,we,Mt).call(this,`Non-200 status code (${l})`,l);return}if(!(g.get("content-type")||"").startsWith("text/event-stream")){je(this,we,Mt).call(this,'Invalid content type, expected "text/event-stream"',l);return}if($(this,fe)===this.CLOSED)return;U(this,fe,this.OPEN);const m=new Event("open");if((o=$(this,Ct))==null||o.call(this,m),this.dispatchEvent(m),typeof i!="object"||!i||!("getReader"in i)){je(this,we,Mt).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}const p=new TextDecoder,w=i.getReader();let b=!0;do{const{done:L,value:T}=await w.read();T&&$(this,Ze).feed(p.decode(T,{stream:!L})),L&&(b=!1,$(this,Ze).reset(),je(this,we,Ea).call(this))}while(b)}),ae(this,Ta,n=>{U(this,Ne,void 0),!(n.name==="AbortError"||n.type==="aborted")&&je(this,we,Ea).call(this,Ma(n))}),ae(this,va,n=>{typeof n.id=="string"&&U(this,Tt,n.id);const o=new MessageEvent(n.event||"message",{data:n.data,origin:$(this,Ke)?$(this,Ke).origin:$(this,We).origin,lastEventId:n.id||""});$(this,Xe)&&(!n.event||n.event==="message")&&$(this,Xe).call(this,o),this.dispatchEvent(o)}),ae(this,Aa,n=>{U(this,kt,n)}),ae(this,ja,()=>{U(this,tt,void 0),$(this,fe)===this.CONNECTING&&je(this,we,Sa).call(this)});try{if(e instanceof URL)U(this,We,e);else if(typeof e=="string")U(this,We,new URL(e,An()));else throw new Error("Invalid URL")}catch{throw vn("An invalid or illegal string was specified")}U(this,Ze,Tn({onEvent:$(this,va),onRetry:$(this,Aa)})),U(this,fe,this.CONNECTING),U(this,kt,3e3),U(this,Ut,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),U(this,Vt,(s=t==null?void 0:t.withCredentials)!=null?s:!1),je(this,we,Sa).call(this)}get readyState(){return $(this,fe)}get url(){return $(this,We).href}get withCredentials(){return $(this,Vt)}get onerror(){return $(this,st)}set onerror(e){U(this,st,e)}get onmessage(){return $(this,Xe)}set onmessage(e){U(this,Xe,e)}get onopen(){return $(this,Ct)}set onopen(e){U(this,Ct,e)}addEventListener(e,t,a){const s=t;super.addEventListener(e,s,a)}removeEventListener(e,t,a){const s=t;super.removeEventListener(e,s,a)}close(){$(this,tt)&&clearTimeout($(this,tt)),$(this,fe)!==this.CLOSED&&($(this,Ne)&&$(this,Ne).abort(),U(this,fe,this.CLOSED),U(this,Ne,void 0))}}fe=new WeakMap,We=new WeakMap,Ke=new WeakMap,Vt=new WeakMap,Ut=new WeakMap,kt=new WeakMap,tt=new WeakMap,Tt=new WeakMap,Ne=new WeakMap,Ze=new WeakMap,st=new WeakMap,Xe=new WeakMap,Ct=new WeakMap,we=new WeakSet,Sa=function(){U(this,fe,this.CONNECTING),U(this,Ne,new AbortController),$(this,Ut)($(this,We),je(this,we,Os).call(this)).then($(this,ka)).catch($(this,Ta))},ka=new WeakMap,Ta=new WeakMap,Os=function(){var r;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...$(this,Tt)?{"Last-Event-ID":$(this,Tt)}:void 0},cache:"no-store",signal:(r=$(this,Ne))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},va=new WeakMap,Aa=new WeakMap,Mt=function(r,e){var t;$(this,fe)!==this.CLOSED&&U(this,fe,this.CLOSED);const a=new Ds("error",{code:e,message:r});(t=$(this,st))==null||t.call(this,a),this.dispatchEvent(a)},Ea=function(r,e){var t;if($(this,fe)===this.CLOSED)return;U(this,fe,this.CONNECTING);const a=new Ds("error",{code:e,message:r});(t=$(this,st))==null||t.call(this,a),this.dispatchEvent(a),U(this,tt,setTimeout($(this,ja),$(this,kt)))},ja=new WeakMap,Ht.CONNECTING=0,Ht.OPEN=1,Ht.CLOSED=2;function An(){const r="document"in globalThis?globalThis.document:void 0;return r&&typeof r=="object"&&"baseURI"in r&&typeof r.baseURI=="string"?r.baseURI:void 0}class xe{static attachAnalyticsScript(e){window._msq=window._msq||[];const t=e||"https://static.searchstax.com/studio-js/v4/js/studio-analytics.js";if(!document.querySelector(`script[src="${t}"]`)){var a=document.createElement("script");a.type="text/javascript",a.src=t;var s=document.getElementsByTagName("script")[0];s.parentNode&&s.parentNode.insertBefore(a,s)}}static trackClick(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,cDocId:e.result.uniqueId,cDocTitle:e.result.titleTracking,position:e.result.position,language:e.language,model:e.model};return new Promise((a,s)=>{const n=["trackClick",t];t.key?this.msq().push(n,(function(o,i){JSON.stringify(o)===JSON.stringify(t)&&i?a():s()}).bind(this)):s()})}static trackAnswerLinkClick(e){const t={key:e.trackApiKey,question:e.searchTerm,session:e.session,href:e.href,language:e.language,model:e.model,answer:e.answer};return new Promise((a,s)=>{const n=["answerSourceClick",t];t.key?this.msq().push(n,(function(o,i){JSON.stringify(o)===JSON.stringify(t)&&i?a():s()}).bind(this)):s()})}static trackSearch(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,language:e.language,model:e.model,impressions:e.impressions};setTimeout(()=>{t.key&&this.msq().push(["track",t])},0)}static trackRelatedSearchClick(e){const t={session:e.session,key:e.trackApiKey,query:e.relatedSearch.search_term,position:e.relatedSearch.position,relatedSearch:e.relatedSearch.related_search,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches,language:e.language,model:e.model};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearchClick",t])},0)}static trackRelatedSearches(e){const t={session:e.session,key:e.trackApiKey,query:e.searchTerm,latency:e.latencyVal,language:e.language,model:e.model,impressions:e.impressions,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearch",t])},0)}static trackAnswerData(e){const t={session:e.session,key:e.trackApiKey,question:e.searchTerm,answer:e.answer,language:e.language,model:e.model,is_question:e.isQuestion+""};setTimeout(()=>{t.key&&this.msq().push(["trackquestionanswer",t])},0)}static trackFeedback(e){setTimeout(()=>{this.msq().push(["trackSearchSatisfaction",{key:e.trackApiKey,email:e.email,score:e.rating,comments:e.feedback,language:e.language,model:e.model}])},0)}}h(xe,"subscribedToClickEvent",!1),h(xe,"msq",()=>typeof window<"u"&&(window!=null&&window._msq)?window==null?void 0:window._msq:[]);class En{constructor(e,t){h(this,"cachedQuery","");h(this,"cachedANDFacets","");h(this,"url","");h(this,"relatedSearches","");h(this,"suggester","");h(this,"authHeader");h(this,"authHeaderRelated");h(this,"trackApiKey","");h(this,"session","");h(this,"searchAuthType");h(this,"searchAuth","");h(this,"controllerSearch");h(this,"signalSearch");h(this,"controllerSuggest");h(this,"signalSuggest");h(this,"_authToken","");h(this,"resolveFn");h(this,"dataLayer");this.dataLayer=t,this.url=e.searchURL,this.dataLayer.setLanguage(e.language),this.suggester=e.suggesterURL,this.trackApiKey=e.trackApiKey,this.session=e.sessionId,this.searchAuthType=e.authType,this.searchAuth=e.searchAuth,this.authHeader=new Headers,this.authHeader.append("Accept","application/json"),this._authToken=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`,this.authHeader.append("Authorization",this._authToken),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let a=[];if(!t)e.forEach(function(s){const n=s.name+':"'+s.value+'"';a=a.concat("fq="+decodeURIComponent(n).replace(" "," "))});else{const s={};e.forEach(function(o){const i=o.name+":"+o.value,c=decodeURIComponent(i).replace(" "," ").split(":");s[c[0]]?s[c[0]].push(c[1]):s[c[0]]=[c[1]]});let n="";for(const o in s)if(Object.prototype.hasOwnProperty.call(s,o)){const i=s[o],c=o;for(const l of i)n+=n===""?` ${c}:"${l}"`:` OR ${c}:"${l}"`}a=a.concat("fq="+n.trim())}return a=a.map(s=>s.replace(/&/g,"%26").replace(/\+/g,"%2B")),a.length?"&"+a.join("&"):""}generateLocationQuery(e){let t="";if(e.lat&&e.lon){const a=Math.floor(parseFloat(e.lat)*100)/100,s=Math.floor(parseFloat(e.lon)*100)/100;t+=`&pt=${a},${s}`}return e.radius&&t!==""&&e.radius!=="any"&&(t+=`&distanceFilter=${e.radius}`),t}getRelatedSearches(e,t,a,s){const n=new Headers;n.append("Accept","application/json"),n.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:n,credentials:"same-origin"}).then(o=>o.json()).then(o=>{s(o)})}cacheFacets(e){return new Promise(t=>{if(this.resolveFn=t,this.dataLayer.searchObject.query!==this.cachedQuery||this.cachedANDFacets+e!==this.dataLayer.parsedData.cachedANDFacets+e){this.cachedANDFacets=this.dataLayer.parsedData.cachedANDFacets+e,this.cachedQuery=this.dataLayer.searchObject.query;const a=[this.dataLayer.searchObject.facets.filter(s=>e?!1:s.type==="and"||s.type==="tabs")].flat();this.search({query:this.dataLayer.searchObject.query??"*",itemsPerPage:void 0,page:1,order:"",facets:a,additionalProps:this.dataLayer.searchObject.additionalProps,location:this.dataLayer.searchObject.location,model:this.dataLayer.model},this.cacheFacetsCallback.bind(this),!0,!1,e)}else this.resolveFn()})}cacheFacetsCallback(e,t){let a=bt.extractFacets(e);t?this.dataLayer.setSearchFacetsCachedTabs(a):this.dataLayer.setSearchFacetsCached(a),this.resolveFn&&this.resolveFn()}search(e,t,a=!1,s=!1,n=!1){if(e.query&&e.query!=="undefined"){this.dataLayer.setSearchTerm(e.query),this.dataLayer.setLoading(!0),this.controllerSearch&&this.controllerSearch.abort(),this.controllerSearch=new AbortController,this.signalSearch=this.controllerSearch.signal;const o=this.url+this.generateQueryParams(e,s),i={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete i.signal,fetch(o,i).then(c=>c.json()).then(c=>{this.dataLayer.setLoading(!1),t(c,n)}).catch(()=>{this.dataLayer.setLoading(!1)})}}generateQueryParams(e,t){let a=(e.itemsPerPage?e.itemsPerPage:0)*(e.page-1),s=e.order?`&sort=${e.order}`:"";const n=e.itemsPerPage!==void 0?`&rows=${e.itemsPerPage}`:"",o=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(l,g)=>l.get(g)??""}),i=o.languageVariant?"&fq=_language:"+o.languageVariant:"",c=e.model??this.dataLayer.model;return"?q="+encodeURIComponent(e.query.trim())+"&start="+a+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(l=>l.type==="or"||l.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(l=>l.type==="and"||l.type==="tabs"),!1)+s+n+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(c?`&model=${c}`:"")+"&language="+this.dataLayer.language+i}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const a=new Ht(this.dataLayer.questionURL+this.generateQueryParams(this.dataLayer.searchObject),{fetch:(n,o)=>fetch(n,{...o,headers:{...o==null?void 0:o.headers,Authorization:this._authToken}})}),s=this.dataLayer;return a.onmessage=n=>{if(n.data===et.question||n.data===et.notQuestion){n.data===et.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(s.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),s.setAnswerData("");return}if(n.data===et.close){xe.trackAnswerData({...s.parsedData.trackingData,answer:s.$answer.getValue(),isQuestion:this.dataLayer.isQuestion}),s.setAnswerLoading(!1),a.close();return}if(n.data.indexOf("[!CAUTION]")!==-1){s.setAnswerError(!0),s.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),a.close();return}if(n.data.indexOf("[comment]: <> ({")!==-1)try{const o=n.data.split("[comment]: <> ({");if(o.length<2){t(n.data);return}const i=o[1].split("})");if(i.length<2){t(n.data);return}const c=i[0],l=JSON.parse("{"+c+"}");this.dataLayer.answerWidgetShowMoreLimit=l.displayShowMoreAfter,l.showMoreEnabled||(this.dataLayer.answerWidgetShowMoreLimit=1e17);const g=i.slice(1).join("})");t(g)}catch{t(n.data)}else t(n.data)},a.addEventListener("error",n=>{(n.code===401||n.code===500)&&(s.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),s.setAnswerError(!0))}),a.onerror=()=>{s.setAnswerLoading(!1),a.close()},a}suggest(e,t,a){if(this.controllerSuggest&&this.controllerSuggest.abort(),this.suggester.trim()==="")return;this.controllerSuggest=new AbortController,this.signalSuggest=this.controllerSuggest.signal;const s=this.suggester+"?q="+e.trim()+this.toQueryString(a)+"&language="+this.dataLayer.language;fetch(s,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSuggest}).then(n=>n.json()).then(n=>{t(n)}).catch(()=>()=>{})}fields(){return this.fields}toQueryString(e){if(e.length===0)return"";const t=[];for(const a of e)t.push(encodeURIComponent(a.key)+"="+encodeURIComponent(a.value));return"&"+t.join("&")}}var jn=Object.prototype.toString,at=Array.isArray||function(r){return jn.call(r)==="[object Array]"};function Ia(r){return typeof r=="function"}function In(r){return at(r)?"array":typeof r}function ma(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ps(r,e){return r!=null&&typeof r=="object"&&e in r}function Rn(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var Dn=RegExp.prototype.test;function Nn(r,e){return Dn.call(r,e)}var On=/\S/;function Pn(r){return!Nn(On,r)}var Fn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function $n(r){return String(r).replace(/[&<>"'`=\/]/g,function(e){return Fn[e]})}var zn=/\s*/,_n=/\s+/,Fs=/\s*=/,Wn=/\s*\}/,Vn=/#|\^|\/|>|\{|&|=|!/;function Hn(r,e){if(!r)return[];var t=!1,a=[],s=[],n=[],o=!1,i=!1,c="",l=0;function g(){if(o&&!i)for(;n.length;)delete s[n.pop()];else n=[];o=!1,i=!1}var m,p,w;function b(O){if(typeof O=="string"&&(O=O.split(_n,2)),!at(O)||O.length!==2)throw new Error("Invalid tags: "+O);m=new RegExp(ma(O[0])+"\\s*"),p=new RegExp("\\s*"+ma(O[1])),w=new RegExp("\\s*"+ma("}"+O[1]))}b(e||z.tags);for(var L=new vt(r),T,y,x,v,k,j;!L.eos();){if(T=L.pos,x=L.scanUntil(m),x)for(var F=0,E=x.length;F<E;++F)v=x.charAt(F),Pn(v)?(n.push(s.length),c+=v):(i=!0,t=!0,c+=" "),s.push(["text",v,T,T+1]),T+=1,v===`
|
|
88
|
-
`&&(g(),c="",l=0,t=!1);if(!L.scan(m))break;if(o=!0,y=L.scan(Vn)||"name",L.scan(zn),y==="="?(x=L.scanUntil(Fs),L.scan(Fs),L.scanUntil(p)):y==="{"?(x=L.scanUntil(w),L.scan(Wn),L.scanUntil(p),y="&"):x=L.scanUntil(p),!L.scan(p))throw new Error("Unclosed tag at "+L.pos);if(y==">"?k=[y,x,T,L.pos,c,l,t]:k=[y,x,T,L.pos],l++,s.push(k),y==="#"||y==="^")a.push(k);else if(y==="/"){if(j=a.pop(),!j)throw new Error('Unopened section "'+x+'" at '+T);if(j[1]!==x)throw new Error('Unclosed section "'+j[1]+'" at '+T)}else y==="name"||y==="{"||y==="&"?i=!0:y==="="&&b(x)}if(g(),j=a.pop(),j)throw new Error('Unclosed section "'+j[1]+'" at '+L.pos);return Qn(Bn(s))}function Bn(r){for(var e=[],t,a,s=0,n=r.length;s<n;++s)t=r[s],t&&(t[0]==="text"&&a&&a[0]==="text"?(a[1]+=t[1],a[3]=t[3]):(e.push(t),a=t));return e}function Qn(r){for(var e=[],t=e,a=[],s,n,o=0,i=r.length;o<i;++o)switch(s=r[o],s[0]){case"#":case"^":t.push(s),a.push(s),t=s[4]=[];break;case"/":n=a.pop(),n[5]=s[2],t=a.length>0?a[a.length-1][4]:e;break;default:t.push(s)}return e}function vt(r){this.string=r,this.tail=r,this.pos=0}vt.prototype.eos=function(){return this.tail===""},vt.prototype.scan=function(r){var e=this.tail.match(r);if(!e||e.index!==0)return"";var t=e[0];return this.tail=this.tail.substring(t.length),this.pos+=t.length,t},vt.prototype.scanUntil=function(r){var e=this.tail.search(r),t;switch(e){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,e),this.tail=this.tail.substring(e)}return this.pos+=t.length,t};function rt(r,e){this.view=r,this.cache={".":this.view},this.parent=e}rt.prototype.push=function(r){return new rt(r,this)},rt.prototype.lookup=function(r){var e=this.cache,t;if(e.hasOwnProperty(r))t=e[r];else{for(var a=this,s,n,o,i=!1;a;){if(r.indexOf(".")>0)for(s=a.view,n=r.split("."),o=0;s!=null&&o<n.length;)o===n.length-1&&(i=Ps(s,n[o])||Rn(s,n[o])),s=s[n[o++]];else s=a.view[r],i=Ps(a.view,r);if(i){t=s;break}a=a.parent}e[r]=t}return Ia(t)&&(t=t.call(this.view)),t};function de(){this.templateCache={_cache:{},set:function(r,e){this._cache[r]=e},get:function(r){return this._cache[r]},clear:function(){this._cache={}}}}de.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},de.prototype.parse=function(r,e){var t=this.templateCache,a=r+":"+(e||z.tags).join(":"),s=typeof t<"u",n=s?t.get(a):void 0;return n==null&&(n=Hn(r,e),s&&t.set(a,n)),n},de.prototype.render=function(r,e,t,a){var s=this.getConfigTags(a),n=this.parse(r,s),o=e instanceof rt?e:new rt(e,void 0);return this.renderTokens(n,o,t,r,a)},de.prototype.renderTokens=function(r,e,t,a,s){for(var n="",o,i,c,l=0,g=r.length;l<g;++l)c=void 0,o=r[l],i=o[0],i==="#"?c=this.renderSection(o,e,t,a,s):i==="^"?c=this.renderInverted(o,e,t,a,s):i===">"?c=this.renderPartial(o,e,t,s):i==="&"?c=this.unescapedValue(o,e):i==="name"?c=this.escapedValue(o,e,s):i==="text"&&(c=this.rawValue(o)),c!==void 0&&(n+=c);return n},de.prototype.renderSection=function(r,e,t,a,s){var n=this,o="",i=e.lookup(r[1]);function c(m){return n.render(m,e,t,s)}if(i){if(at(i))for(var l=0,g=i.length;l<g;++l)o+=this.renderTokens(r[4],e.push(i[l]),t,a,s);else if(typeof i=="object"||typeof i=="string"||typeof i=="number")o+=this.renderTokens(r[4],e.push(i),t,a,s);else if(Ia(i)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");i=i.call(e.view,a.slice(r[3],r[5]),c),i!=null&&(o+=i)}else o+=this.renderTokens(r[4],e,t,a,s);return o}},de.prototype.renderInverted=function(r,e,t,a,s){var n=e.lookup(r[1]);if(!n||at(n)&&n.length===0)return this.renderTokens(r[4],e,t,a,s)},de.prototype.indentPartial=function(r,e,t){for(var a=e.replace(/[^ \t]/g,""),s=r.split(`
|
|
89
|
-
|
|
90
|
-
`)
|
|
72
|
+
`}tablerow({text:s}){return`<tr>
|
|
73
|
+
${s}</tr>
|
|
74
|
+
`}tablecell(s){const e=this.parser.parseInline(s.tokens),t=s.header?"th":"td";return(s.align?`<${t} align="${s.align}">`:`<${t}>`)+e+`</${t}>
|
|
75
|
+
`}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${je(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:e,tokens:t}){const a=this.parser.parseInline(t),r=Ns(s);if(r===null)return a;s=r;let i='<a href="'+s+'"';return e&&(i+=' title="'+je(e)+'"'),i+=">"+a+"</a>",i}image({href:s,title:e,text:t,tokens:a}){a&&(t=this.parser.parseInline(a,this.parser.textRenderer));const r=Ns(s);if(r===null)return je(t);s=r;let i=`<img src="${s}" alt="${t}"`;return e&&(i+=` title="${je(e)}"`),i+=">",i}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:je(s.text)}},ts=class{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}},De=class Oa{constructor(e){u(this,"options");u(this,"renderer");u(this,"textRenderer");this.options=e||Ke,this.options.renderer=this.options.renderer||new aa,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ts}static parse(e,t){return new Oa(t).parse(e)}static parseInline(e,t){return new Oa(t).parseInline(e)}parse(e,t=!0){var r,i;let a="";for(let n=0;n<e.length;n++){const o=e[n];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){const h=o,g=this.options.extensions.renderers[h.type].call({parser:this},h);if(g!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(h.type)){a+=g||"";continue}}const c=o;switch(c.type){case"space":{a+=this.renderer.space(c);continue}case"hr":{a+=this.renderer.hr(c);continue}case"heading":{a+=this.renderer.heading(c);continue}case"code":{a+=this.renderer.code(c);continue}case"table":{a+=this.renderer.table(c);continue}case"blockquote":{a+=this.renderer.blockquote(c);continue}case"list":{a+=this.renderer.list(c);continue}case"html":{a+=this.renderer.html(c);continue}case"paragraph":{a+=this.renderer.paragraph(c);continue}case"text":{let h=c,g=this.renderer.text(h);for(;n+1<e.length&&e[n+1].type==="text";)h=e[++n],g+=`
|
|
76
|
+
`+this.renderer.text(h);t?a+=this.renderer.paragraph({type:"paragraph",raw:g,text:g,tokens:[{type:"text",raw:g,text:g,escaped:!0}]}):a+=g;continue}default:{const h='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return a}parseInline(e,t=this.renderer){var r,i;let a="";for(let n=0;n<e.length;n++){const o=e[n];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){const h=this.options.extensions.renderers[o.type].call({parser:this},o);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){a+=h||"";continue}}const c=o;switch(c.type){case"escape":{a+=t.text(c);break}case"html":{a+=t.html(c);break}case"link":{a+=t.link(c);break}case"image":{a+=t.image(c);break}case"strong":{a+=t.strong(c);break}case"em":{a+=t.em(c);break}case"codespan":{a+=t.codespan(c);break}case"br":{a+=t.br(c);break}case"del":{a+=t.del(c);break}case"text":{a+=t.text(c);break}default:{const h='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return a}},Ia,Kt=(Ia=class{constructor(s){u(this,"options");u(this,"block");this.options=s||Ke}preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}provideLexer(){return this.block?Re.lex:Re.lexInline}provideParser(){return this.block?De.parse:De.parseInline}},u(Ia,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Ia),Si=class{constructor(...s){u(this,"defaults",qa());u(this,"options",this.setOptions);u(this,"parse",this.parseMarkdown(!0));u(this,"parseInline",this.parseMarkdown(!1));u(this,"Parser",De);u(this,"Renderer",aa);u(this,"TextRenderer",ts);u(this,"Lexer",Re);u(this,"Tokenizer",ta);u(this,"Hooks",Kt);this.use(...s)}walkTokens(s,e){var a,r;let t=[];for(const i of s)switch(t=t.concat(e.call(this,i)),i.type){case"table":{const n=i;for(const o of n.header)t=t.concat(this.walkTokens(o.tokens,e));for(const o of n.rows)for(const c of o)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{const n=i;t=t.concat(this.walkTokens(n.items,e));break}default:{const n=i;(r=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&r[n.type]?this.defaults.extensions.childTokens[n.type].forEach(o=>{const c=n[o].flat(1/0);t=t.concat(this.walkTokens(c,e))}):n.tokens&&(t=t.concat(this.walkTokens(n.tokens,e)))}}return t}use(...s){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(t=>{const a={...t};if(a.async=this.defaults.async||a.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){const i=e.renderers[r.name];i?e.renderers[r.name]=function(...n){let o=r.renderer.apply(this,n);return o===!1&&(o=i.apply(this,n)),o}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[r.level];i?i.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),a.extensions=e),t.renderer){const r=this.defaults.renderer||new aa(this.defaults);for(const i in t.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const n=i,o=t.renderer[n],c=r[n];r[n]=(...h)=>{let g=o.apply(r,h);return g===!1&&(g=c.apply(r,h)),g||""}}a.renderer=r}if(t.tokenizer){const r=this.defaults.tokenizer||new ta(this.defaults);for(const i in t.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const n=i,o=t.tokenizer[n],c=r[n];r[n]=(...h)=>{let g=o.apply(r,h);return g===!1&&(g=c.apply(r,h)),g}}a.tokenizer=r}if(t.hooks){const r=this.defaults.hooks||new Kt;for(const i in t.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const n=i,o=t.hooks[n],c=r[n];Kt.passThroughHooks.has(i)?r[n]=h=>{if(this.defaults.async)return Promise.resolve(o.call(r,h)).then(m=>c.call(r,m));const g=o.call(r,h);return c.call(r,g)}:r[n]=(...h)=>{let g=o.apply(r,h);return g===!1&&(g=c.apply(r,h)),g}}a.hooks=r}if(t.walkTokens){const r=this.defaults.walkTokens,i=t.walkTokens;a.walkTokens=function(n){let o=[];return o.push(i.call(this,n)),r&&(o=o.concat(r.call(this,n))),o}}this.defaults={...this.defaults,...a}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,e){return Re.lex(s,e??this.defaults)}parser(s,e){return De.parse(s,e??this.defaults)}parseMarkdown(s){return(e,t)=>{const a={...t},r={...this.defaults,...a},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&a.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=s);const n=r.hooks?r.hooks.provideLexer():s?Re.lex:Re.lexInline,o=r.hooks?r.hooks.provideParser():s?De.parse:De.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(e):e).then(c=>n(c,r)).then(c=>r.hooks?r.hooks.processAllTokens(c):c).then(c=>r.walkTokens?Promise.all(this.walkTokens(c,r.walkTokens)).then(()=>c):c).then(c=>o(c,r)).then(c=>r.hooks?r.hooks.postprocess(c):c).catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let c=n(e,r);r.hooks&&(c=r.hooks.processAllTokens(c)),r.walkTokens&&this.walkTokens(c,r.walkTokens);let h=o(c,r);return r.hooks&&(h=r.hooks.postprocess(h)),h}catch(c){return i(c)}}}onError(s,e){return t=>{if(t.message+=`
|
|
77
|
+
Please report this to https://github.com/markedjs/marked.`,s){const a="<p>An error occurred:</p><pre>"+je(t.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(t);throw t}}},Je=new Si;function V(s,e){return Je.parse(s,e)}V.options=V.setOptions=function(s){return Je.setOptions(s),V.defaults=Je.defaults,Es(V.defaults),V},V.getDefaults=qa,V.defaults=Ke,V.use=function(...s){return Je.use(...s),V.defaults=Je.defaults,Es(V.defaults),V},V.walkTokens=function(s,e){return Je.walkTokens(s,e)},V.parseInline=Je.parseInline,V.Parser=De,V.parser=De.parse,V.Renderer=aa,V.TextRenderer=ts,V.Lexer=Re,V.lexer=Re.lex,V.Tokenizer=ta,V.Hooks=Kt,V.parse=V,V.options,V.setOptions,V.use,V.walkTokens,V.parseInline,De.parse,Re.lex;function Os(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,a=Array(e);t<e;t++)a[t]=s[t];return a}function ki(s){if(Array.isArray(s))return s}function Ti(s,e){var t=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(t!=null){var a,r,i,n,o=[],c=!0,h=!1;try{if(i=(t=t.call(s)).next,e!==0)for(;!(c=(a=i.call(t)).done)&&(o.push(a.value),o.length!==e);c=!0);}catch(g){h=!0,r=g}finally{try{if(!c&&t.return!=null&&(n=t.return(),Object(n)!==n))return}finally{if(h)throw r}}return o}}function vi(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
78
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ji(s,e){return ki(s)||Ti(s,e)||Ei(s,e)||vi()}function Ei(s,e){if(s){if(typeof s=="string")return Os(s,e);var t={}.toString.call(s).slice(8,-1);return t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set"?Array.from(s):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Os(s,e):void 0}}const Lr=Object.entries,Ps=Object.setPrototypeOf,Ai=Object.isFrozen,Ii=Object.getPrototypeOf,Ni=Object.getOwnPropertyDescriptor;let ue=Object.freeze,de=Object.seal,nt=Object.create,yr=typeof Reflect<"u"&&Reflect,Pa=yr.apply,Fa=yr.construct;ue||(ue=function(s){return s}),de||(de=function(s){return s}),Pa||(Pa=function(s,e){for(var t=arguments.length,a=new Array(t>2?t-2:0),r=2;r<t;r++)a[r-2]=arguments[r];return s.apply(e,a)}),Fa||(Fa=function(s){for(var e=arguments.length,t=new Array(e>1?e-1:0),a=1;a<e;a++)t[a-1]=arguments[a];return new s(...t)});const kt=ie(Array.prototype.forEach),Ri=ie(Array.prototype.lastIndexOf),Fs=ie(Array.prototype.pop),it=ie(Array.prototype.push),Di=ie(Array.prototype.splice),We=Array.isArray,jt=ie(String.prototype.toLowerCase),Ca=ie(String.prototype.toString),$s=ie(String.prototype.match),Tt=ie(String.prototype.replace),zs=ie(String.prototype.indexOf),Oi=ie(String.prototype.trim),Pi=ie(Number.prototype.toString),Fi=ie(Boolean.prototype.toString),_s=typeof BigInt>"u"?null:ie(BigInt.prototype.toString),Ws=typeof Symbol>"u"?null:ie(Symbol.prototype.toString),ce=ie(Object.prototype.hasOwnProperty),vt=ie(Object.prototype.toString),he=ie(RegExp.prototype.test),qe=$i(TypeError);function ie(s){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,a=new Array(t>1?t-1:0),r=1;r<t;r++)a[r-1]=arguments[r];return Pa(s,e,a)}}function $i(s){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return Fa(s,t)}}function _(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jt;if(Ps&&Ps(s,null),!We(e))return s;let a=e.length;for(;a--;){let r=e[a];if(typeof r=="string"){const i=t(r);i!==r&&(Ai(e)||(e[a]=i),r=i)}s[r]=!0}return s}function zi(s){for(let e=0;e<s.length;e++)ce(s,e)||(s[e]=null);return s}function fe(s){const e=nt(null);for(const a of Lr(s)){var t=ji(a,2);const r=t[0],i=t[1];ce(s,r)&&(We(i)?e[r]=zi(i):i&&typeof i=="object"&&i.constructor===Object?e[r]=fe(i):e[r]=i)}return e}function _i(s){switch(typeof s){case"string":return s;case"number":return Pi(s);case"boolean":return Fi(s);case"bigint":return _s?_s(s):"0";case"symbol":return Ws?Ws(s):"Symbol()";case"undefined":return vt(s);case"function":case"object":{if(s===null)return vt(s);const e=s,t=Ee(e,"toString");if(typeof t=="function"){const a=t(e);return typeof a=="string"?a:vt(a)}return vt(s)}default:return vt(s)}}function Ee(s,e){for(;s!==null;){const a=Ni(s,e);if(a){if(a.get)return ie(a.get);if(typeof a.value=="function")return ie(a.value)}s=Ii(s)}function t(){return null}return t}function Wi(s){try{return he(s,""),!0}catch{return!1}}const Vs=ue(["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","search","section","select","shadow","slot","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"]),Ma=ue(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Sa=ue(["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"]),Vi=ue(["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"]),ka=ue(["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"]),Qi=ue(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Qs=ue(["#text"]),Bs=ue(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Ta=ue(["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","mask-type","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"]),Hs=ue(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Jt=ue(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Bi=de(/{{[\w\W]*|^[\w\W]*}}/g),Hi=de(/<%[\w\W]*|^[\w\W]*%>/g),Ui=de(/\${[\w\W]*/g),qi=de(/^data-[\-\w.\u00B7-\uFFFF]+$/),Yi=de(/^aria-[\-\w]+$/),Us=de(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ji=de(/^(?:\w+script|data):/i),Gi=de(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ki=de(/^html$/i),Zi=de(/^[a-z][.\w]*(-[.\w]+)+$/i),qs=de(/<[/\w!]/g),Xi=de(/<[/\w]/g),en=de(/<\/no(script|embed|frames)/i),tn=de(/\/>/i),ve={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},an=function(){return typeof window>"u"?null:window},sn=function(s,e){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let t=null;const a="data-tt-policy-suffix";e&&e.hasAttribute(a)&&(t=e.getAttribute(a));const r="dompurify"+(t?"#"+t:"");try{return s.createPolicy(r,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},Ys=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},_e=function(s,e,t,a){return ce(s,e)&&We(s[e])?_(a.base?fe(a.base):{},s[e],a.transform):t};function xr(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:an();const e=l=>xr(l);if(e.version="3.4.11",e.removed=[],!s||!s.document||s.document.nodeType!==ve.document||!s.Element)return e.isSupported=!1,e;let t=s.document;const a=t,r=a.currentScript;s.DocumentFragment;const i=s.HTMLTemplateElement,n=s.Node,o=s.Element,c=s.NodeFilter;s.NamedNodeMap===void 0&&(s.NamedNodeMap||s.MozNamedAttrMap),s.HTMLFormElement;const h=s.DOMParser,g=s.trustedTypes,m=o.prototype,p=Ee(m,"cloneNode"),w=Ee(m,"remove"),S=Ee(m,"nextSibling"),L=Ee(m,"childNodes"),T=Ee(m,"parentNode"),A=Ee(m,"shadowRoot"),O=Ee(m,"attributes"),P=n&&n.prototype?Ee(n.prototype,"nodeType"):null,I=n&&n.prototype?Ee(n.prototype,"nodeName"):null;if(typeof i=="function"){const l=t.createElement("template");l.content&&l.content.ownerDocument&&(t=l.content.ownerDocument)}let y,b="",M,E=!1,N=0;const G=function(){if(N>0)throw qe('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},se=function(l){G(),N++;try{return y.createHTML(l)}finally{N--}},pe=function(l){G(),N++;try{return y.createScriptURL(l)}finally{N--}},Ae=function(){return E||(M=sn(g,r),E=!0),M},ge=t,Se=ge.implementation,mt=ge.createNodeIterator,$t=ge.createDocumentFragment,zt=ge.getElementsByTagName,_t=a.importNode;let U=Ys();e.isSupported=typeof Lr=="function"&&typeof T=="function"&&Se&&Se.createHTMLDocument!==void 0;const x=Bi,F=Hi,q=Ui,ae=qi,Ze=Yi,ft=Ji,K=Gi,Oe=Zi;let Xe=Us,Y=null;const ss=_({},[...Vs,...Ma,...Sa,...ka,...Qs]);let Z=null;const rs=_({},[...Bs,...Ta,...Hs,...Jt]);let X=Object.seal(nt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Lt=null,is=null;const Pe=Object.seal(nt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ns=!0,na=!0,os=!1,cs=!0,Fe=!1,yt=!0,Qe=!1,oa=!1,ca=null,la=null,ha=!1,et=!1,Wt=!1,Vt=!1,ls=!0,hs=!1;const us="user-content-";let ua=!0,da=!1,tt={},ke=null;const ga=_({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let ds=null;const gs=_({},["audio","video","img","source","image","track"]);let pa=null;const ps=_({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Qt="http://www.w3.org/1998/Math/MathML",Bt="http://www.w3.org/2000/svg",Te="http://www.w3.org/1999/xhtml";let at=Te,ma=!1,fa=null;const Mr=_({},[Qt,Bt,Te],Ca),ms=ue(["mi","mo","mn","ms","mtext"]);let La=_({},ms);const fs=ue(["annotation-xml"]);let ya=_({},fs);const Sr=_({},["title","style","font","a","script"]);let xt=null;const kr=["application/xhtml+xml","text/html"],Tr="text/html";let ee=null,st=null;const vr=t.createElement("form"),Ls=function(l){return l instanceof RegExp||l instanceof Function},xa=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(st&&st===l)return;(!l||typeof l!="object")&&(l={}),l=fe(l),xt=kr.indexOf(l.PARSER_MEDIA_TYPE)===-1?Tr:l.PARSER_MEDIA_TYPE,ee=xt==="application/xhtml+xml"?Ca:jt,Y=_e(l,"ALLOWED_TAGS",ss,{transform:ee}),Z=_e(l,"ALLOWED_ATTR",rs,{transform:ee}),fa=_e(l,"ALLOWED_NAMESPACES",Mr,{transform:Ca}),pa=_e(l,"ADD_URI_SAFE_ATTR",ps,{transform:ee,base:ps}),ds=_e(l,"ADD_DATA_URI_TAGS",gs,{transform:ee,base:gs}),ke=_e(l,"FORBID_CONTENTS",ga,{transform:ee}),Lt=_e(l,"FORBID_TAGS",fe({}),{transform:ee}),is=_e(l,"FORBID_ATTR",fe({}),{transform:ee}),tt=ce(l,"USE_PROFILES")?l.USE_PROFILES&&typeof l.USE_PROFILES=="object"?fe(l.USE_PROFILES):l.USE_PROFILES:!1,ns=l.ALLOW_ARIA_ATTR!==!1,na=l.ALLOW_DATA_ATTR!==!1,os=l.ALLOW_UNKNOWN_PROTOCOLS||!1,cs=l.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Fe=l.SAFE_FOR_TEMPLATES||!1,yt=l.SAFE_FOR_XML!==!1,Qe=l.WHOLE_DOCUMENT||!1,et=l.RETURN_DOM||!1,Wt=l.RETURN_DOM_FRAGMENT||!1,Vt=l.RETURN_TRUSTED_TYPE||!1,ha=l.FORCE_BODY||!1,ls=l.SANITIZE_DOM!==!1,hs=l.SANITIZE_NAMED_PROPS||!1,ua=l.KEEP_CONTENT!==!1,da=l.IN_PLACE||!1,Xe=Wi(l.ALLOWED_URI_REGEXP)?l.ALLOWED_URI_REGEXP:Us,at=typeof l.NAMESPACE=="string"?l.NAMESPACE:Te,La=ce(l,"MATHML_TEXT_INTEGRATION_POINTS")&&l.MATHML_TEXT_INTEGRATION_POINTS&&typeof l.MATHML_TEXT_INTEGRATION_POINTS=="object"?fe(l.MATHML_TEXT_INTEGRATION_POINTS):_({},ms),ya=ce(l,"HTML_INTEGRATION_POINTS")&&l.HTML_INTEGRATION_POINTS&&typeof l.HTML_INTEGRATION_POINTS=="object"?fe(l.HTML_INTEGRATION_POINTS):_({},fs);const f=ce(l,"CUSTOM_ELEMENT_HANDLING")&&l.CUSTOM_ELEMENT_HANDLING&&typeof l.CUSTOM_ELEMENT_HANDLING=="object"?fe(l.CUSTOM_ELEMENT_HANDLING):nt(null);if(X=nt(null),ce(f,"tagNameCheck")&&Ls(f.tagNameCheck)&&(X.tagNameCheck=f.tagNameCheck),ce(f,"attributeNameCheck")&&Ls(f.attributeNameCheck)&&(X.attributeNameCheck=f.attributeNameCheck),ce(f,"allowCustomizedBuiltInElements")&&typeof f.allowCustomizedBuiltInElements=="boolean"&&(X.allowCustomizedBuiltInElements=f.allowCustomizedBuiltInElements),de(X),Fe&&(na=!1),Wt&&(et=!0),tt&&(Y=_({},Qs),Z=nt(null),tt.html===!0&&(_(Y,Vs),_(Z,Bs)),tt.svg===!0&&(_(Y,Ma),_(Z,Ta),_(Z,Jt)),tt.svgFilters===!0&&(_(Y,Sa),_(Z,Ta),_(Z,Jt)),tt.mathMl===!0&&(_(Y,ka),_(Z,Hs),_(Z,Jt))),Pe.tagCheck=null,Pe.attributeCheck=null,ce(l,"ADD_TAGS")&&(typeof l.ADD_TAGS=="function"?Pe.tagCheck=l.ADD_TAGS:We(l.ADD_TAGS)&&(Y===ss&&(Y=fe(Y)),_(Y,l.ADD_TAGS,ee))),ce(l,"ADD_ATTR")&&(typeof l.ADD_ATTR=="function"?Pe.attributeCheck=l.ADD_ATTR:We(l.ADD_ATTR)&&(Z===rs&&(Z=fe(Z)),_(Z,l.ADD_ATTR,ee))),ce(l,"ADD_URI_SAFE_ATTR")&&We(l.ADD_URI_SAFE_ATTR)&&_(pa,l.ADD_URI_SAFE_ATTR,ee),ce(l,"FORBID_CONTENTS")&&We(l.FORBID_CONTENTS)&&(ke===ga&&(ke=fe(ke)),_(ke,l.FORBID_CONTENTS,ee)),ce(l,"ADD_FORBID_CONTENTS")&&We(l.ADD_FORBID_CONTENTS)&&(ke===ga&&(ke=fe(ke)),_(ke,l.ADD_FORBID_CONTENTS,ee)),ua&&(Y["#text"]=!0),Qe&&_(Y,["html","head","body"]),Y.table&&(_(Y,["tbody"]),delete Lt.tbody),l.TRUSTED_TYPES_POLICY){if(typeof l.TRUSTED_TYPES_POLICY.createHTML!="function")throw qe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof l.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw qe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const C=y;y=l.TRUSTED_TYPES_POLICY;try{b=se("")}catch(v){throw y=C,v}}else l.TRUSTED_TYPES_POLICY===null?(y=void 0,b=""):(y===void 0&&(y=Ae()),y&&typeof b=="string"&&(b=se("")));ue&&ue(l),st=l},ys=_({},[...Ma,...Sa,...Vi]),xs=_({},[...ka,...Qi]),jr=function(l,f,C){return f.namespaceURI===Te?l==="svg":f.namespaceURI===Qt?l==="svg"&&(C==="annotation-xml"||La[C]):!!ys[l]},Er=function(l,f,C){return f.namespaceURI===Te?l==="math":f.namespaceURI===Bt?l==="math"&&ya[C]:!!xs[l]},Ar=function(l,f,C){return f.namespaceURI===Bt&&!ya[C]||f.namespaceURI===Qt&&!La[C]?!1:!xs[l]&&(Sr[l]||!ys[l])},Ir=function(l){let f=T(l);(!f||!f.tagName)&&(f={namespaceURI:at,tagName:"template"});const C=jt(l.tagName),v=jt(f.tagName);return fa[l.namespaceURI]?l.namespaceURI===Bt?jr(C,f,v):l.namespaceURI===Qt?Er(C,f,v):l.namespaceURI===Te?Ar(C,f,v):!!(xt==="application/xhtml+xml"&&fa[l.namespaceURI]):!1},Be=function(l){it(e.removed,{element:l});try{T(l).removeChild(l)}catch{if(w(l),!T(l))throw qe("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ws=function(l){const f=L(l);if(f){const v=[];kt(f,$=>{it(v,$)}),kt(v,$=>{try{w($)}catch{}})}const C=O(l);if(C)for(let v=C.length-1;v>=0;--v){const $=C[v],B=$&&$.name;if(typeof B=="string")try{l.removeAttribute(B)}catch{}}},He=function(l,f){try{it(e.removed,{attribute:f.getAttributeNode(l),from:f})}catch{it(e.removed,{attribute:null,from:f})}if(f.removeAttribute(l),l==="is")if(et||Wt)try{Be(f)}catch{}else try{f.setAttribute(l,"")}catch{}},Nr=function(l){const f=O(l);if(f)for(let C=f.length-1;C>=0;--C){const v=f[C],$=v&&v.name;if(!(typeof $!="string"||Z[ee($)]))try{l.removeAttribute($)}catch{}}},Rr=function(l){const f=[l];for(;f.length>0;){const C=f.pop();(P?P(C):C.nodeType)===ve.element&&Nr(C);const v=L(C);if(v)for(let $=v.length-1;$>=0;--$)f.push(v[$])}},bs=function(l){let f=null,C=null;if(ha)l="<remove></remove>"+l;else{const B=$s(l,/^[\r\n\t ]+/);C=B&&B[0]}xt==="application/xhtml+xml"&&at===Te&&(l='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+l+"</body></html>");const v=y?se(l):l;if(at===Te)try{f=new h().parseFromString(v,xt)}catch{}if(!f||!f.documentElement){f=Se.createDocument(at,"template",null);try{f.documentElement.innerHTML=ma?b:v}catch{}}const $=f.body||f.documentElement;return l&&C&&$.insertBefore(t.createTextNode(C),$.childNodes[0]||null),at===Te?zt.call(f,Qe?"html":"body")[0]:Qe?f.documentElement:$},Cs=function(l){return mt.call(l.ownerDocument||l,l,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ht=function(l){return l=Tt(l,x," "),l=Tt(l,F," "),l=Tt(l,q," "),l},wa=function(l){var f;l.normalize();const C=mt.call(l.ownerDocument||l,l,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let v=C.nextNode();for(;v;)v.data=Ht(v.data),v=C.nextNode();const $=(f=l.querySelectorAll)===null||f===void 0?void 0:f.call(l,"template");$&&kt($,B=>{rt(B.content)&&wa(B.content)})},Ut=function(l){const f=I?I(l):null;return typeof f!="string"||ee(f)!=="form"?!1:typeof l.nodeName!="string"||typeof l.textContent!="string"||typeof l.removeChild!="function"||l.attributes!==O(l)||typeof l.removeAttribute!="function"||typeof l.setAttribute!="function"||typeof l.namespaceURI!="string"||typeof l.insertBefore!="function"||typeof l.hasChildNodes!="function"||l.nodeType!==P(l)||l.childNodes!==L(l)},rt=function(l){if(!P||typeof l!="object"||l===null)return!1;try{return P(l)===ve.documentFragment}catch{return!1}},wt=function(l){if(!P||typeof l!="object"||l===null)return!1;try{return typeof P(l)=="number"}catch{return!1}};function Ie(l,f,C){l.length!==0&&kt(l,v=>{v.call(e,f,C,st)})}const Dr=function(l,f){return!!(yt&&l.hasChildNodes()&&!wt(l.firstElementChild)&&he(qs,l.textContent)&&he(qs,l.innerHTML)||yt&&l.namespaceURI===Te&&f==="style"&&wt(l.firstElementChild)||l.nodeType===ve.processingInstruction||yt&&l.nodeType===ve.comment&&he(Xi,l.data))},Or=function(l,f){if(!Lt[f]&&ks(f)&&(X.tagNameCheck instanceof RegExp&&he(X.tagNameCheck,f)||X.tagNameCheck instanceof Function&&X.tagNameCheck(f)))return!1;if(ua&&!ke[f]){const C=T(l),v=L(l);if(v&&C){const $=v.length;for(let B=$-1;B>=0;--B){const H=da?v[B]:p(v[B],!0);C.insertBefore(H,S(l))}}}return Be(l),!0},Ms=function(l){if(Ie(U.beforeSanitizeElements,l,null),Ut(l))return Be(l),!0;const f=ee(I?I(l):l.nodeName);if(Ie(U.uponSanitizeElement,l,{tagName:f,allowedTags:Y}),Dr(l,f))return Be(l),!0;if(Lt[f]||!(Pe.tagCheck instanceof Function&&Pe.tagCheck(f))&&!Y[f])return Or(l,f);if((P?P(l):l.nodeType)===ve.element&&!Ir(l)||(f==="noscript"||f==="noembed"||f==="noframes")&&he(en,l.innerHTML))return Be(l),!0;if(Fe&&l.nodeType===ve.text){const C=Ht(l.textContent);l.textContent!==C&&(it(e.removed,{element:l.cloneNode()}),l.textContent=C)}return Ie(U.afterSanitizeElements,l,null),!1},Ss=function(l,f,C){if(is[f]||ls&&(f==="id"||f==="name")&&(C in t||C in vr))return!1;const v=Z[f]||Pe.attributeCheck instanceof Function&&Pe.attributeCheck(f,l);if(!(na&&he(ae,f))&&!(ns&&he(Ze,f))){if(v){if(!pa[f]&&!he(Xe,Tt(C,K,""))&&!((f==="src"||f==="xlink:href"||f==="href")&&l!=="script"&&zs(C,"data:")===0&&ds[l])&&!(os&&!he(ft,Tt(C,K,"")))&&C)return!1}else if(!(ks(l)&&(X.tagNameCheck instanceof RegExp&&he(X.tagNameCheck,l)||X.tagNameCheck instanceof Function&&X.tagNameCheck(l))&&(X.attributeNameCheck instanceof RegExp&&he(X.attributeNameCheck,f)||X.attributeNameCheck instanceof Function&&X.attributeNameCheck(f,l))||f==="is"&&X.allowCustomizedBuiltInElements&&(X.tagNameCheck instanceof RegExp&&he(X.tagNameCheck,C)||X.tagNameCheck instanceof Function&&X.tagNameCheck(C))))return!1}return!0},Pr=_({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ks=function(l){return!Pr[jt(l)]&&he(Oe,l)},Fr=function(l,f,C,v){if(y&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!C)switch(g.getAttributeType(l,f)){case"TrustedHTML":return se(v);case"TrustedScriptURL":return pe(v)}return v},$r=function(l,f,C,v){try{C?l.setAttributeNS(C,f,v):l.setAttribute(f,v),Ut(l)?Be(l):Fs(e.removed)}catch{He(f,l)}},Ts=function(l){Ie(U.beforeSanitizeAttributes,l,null);const f=l.attributes;if(!f||Ut(l))return;const C={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let v=f.length;const $=ee(l.nodeName);for(;v--;){const B=f[v],H=B.name,Ue=B.namespaceURI,$e=B.value,xe=ee(H),ze=$e;let me=H==="value"?ze:Oi(ze);if(C.attrName=xe,C.attrValue=me,C.keepAttr=!0,C.forceKeepAttr=void 0,Ie(U.uponSanitizeAttribute,l,C),me=C.attrValue,hs&&(xe==="id"||xe==="name")&&zs(me,us)!==0&&(He(H,l),me=us+me),yt&&he(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,me)){He(H,l);continue}if(xe==="attributename"&&$s(me,"href")){He(H,l);continue}if(!C.forceKeepAttr){if(!C.keepAttr){He(H,l);continue}if(!cs&&he(tn,me)){He(H,l);continue}if(Fe&&(me=Ht(me)),!Ss($,xe,me)){He(H,l);continue}me=Fr($,xe,Ue,me),me!==ze&&$r(l,H,Ue,me)}}Ie(U.afterSanitizeAttributes,l,null)},qt=function(l){let f=null;const C=Cs(l);for(Ie(U.beforeSanitizeShadowDOM,l,null);f=C.nextNode();)if(Ie(U.uponSanitizeShadowNode,f,null),Ms(f),Ts(f),rt(f.content)&&qt(f.content),(P?P(f):f.nodeType)===ve.element){const v=A(f);rt(v)&&(ba(v),qt(v))}Ie(U.afterSanitizeShadowDOM,l,null)},ba=function(l){const f=[{node:l,shadow:null}];for(;f.length>0;){const C=f.pop();if(C.shadow){qt(C.shadow);continue}const v=C.node,$=(P?P(v):v.nodeType)===ve.element,B=L(v);if(B)for(let H=B.length-1;H>=0;--H)f.push({node:B[H],shadow:null});if($){const H=I?I(v):null;if(typeof H=="string"&&ee(H)==="template"){const Ue=v.content;rt(Ue)&&f.push({node:Ue,shadow:null})}}if($){const H=A(v);rt(H)&&f.push({node:null,shadow:H},{node:H,shadow:null})}}};return e.sanitize=function(l){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,v=null,$=null,B=null;if(ma=!l,ma&&(l="<!-->"),typeof l!="string"&&!wt(l)&&(l=_i(l),typeof l!="string"))throw qe("dirty is not a string, aborting");if(!e.isSupported)return l;oa?(Y=ca,Z=la):xa(f),(U.uponSanitizeElement.length>0||U.uponSanitizeAttribute.length>0)&&(Y=fe(Y)),U.uponSanitizeAttribute.length>0&&(Z=fe(Z)),e.removed=[];const H=da&&typeof l!="string"&&wt(l);if(H){const xe=I?I(l):l.nodeName;if(typeof xe=="string"){const ze=ee(xe);if(!Y[ze]||Lt[ze])throw qe("root node is forbidden and cannot be sanitized in-place")}if(Ut(l))throw qe("root node is clobbered and cannot be sanitized in-place");try{ba(l)}catch(ze){throw ws(l),ze}}else if(wt(l))C=bs("<!---->"),v=C.ownerDocument.importNode(l,!0),v.nodeType===ve.element&&v.nodeName==="BODY"||v.nodeName==="HTML"?C=v:C.appendChild(v),ba(v);else{if(!et&&!Fe&&!Qe&&l.indexOf("<")===-1)return y&&Vt?se(l):l;if(C=bs(l),!C)return et?null:Vt?b:""}C&&ha&&Be(C.firstChild);const Ue=Cs(H?l:C);try{for(;$=Ue.nextNode();)Ms($),Ts($),rt($.content)&&qt($.content)}catch(xe){throw H&&ws(l),xe}if(H)return kt(e.removed,xe=>{xe.element&&Rr(xe.element)}),Fe&&wa(l),l;if(et){if(Fe&&wa(C),Wt)for(B=$t.call(C.ownerDocument);C.firstChild;)B.appendChild(C.firstChild);else B=C;return(Z.shadowroot||Z.shadowrootmode)&&(B=_t.call(a,B,!0)),B}let $e=Qe?C.outerHTML:C.innerHTML;return Qe&&Y["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&he(Ki,C.ownerDocument.doctype.name)&&($e="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
|
|
79
|
+
`+$e),Fe&&($e=Ht($e)),y&&Vt?se($e):$e},e.setConfig=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xa(l),oa=!0,ca=Y,la=Z},e.clearConfig=function(){st=null,oa=!1,ca=null,la=null,y=M,b=""},e.isValidAttribute=function(l,f,C){st||xa({});const v=ee(l),$=ee(f);return Ss(v,$,C)},e.addHook=function(l,f){typeof f=="function"&&ce(U,l)&&it(U[l],f)},e.removeHook=function(l,f){if(ce(U,l)){if(f!==void 0){const C=Ri(U[l],f);return C===-1?void 0:Di(U[l],C,1)[0]}return Fs(U[l])}},e.removeHooks=function(l){ce(U,l)&&(U[l]=[])},e.removeAllHooks=function(){U=Ys()},e}var Js=xr();class rn{constructor(e){u(this,"dataLayer");this.dataLayer=e}get answerWidgetShowMoreLimit(){return this.dataLayer.answerWidgetShowMoreLimit??100}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalPages(){return this.resultsPerPage===0?0:Math.ceil(this.totalResults/this.resultsPerPage)}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){return this.dataLayer.itemsPerPage||0}get sortOptions(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.options)||[]}get selectedSortOption(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.selectedSortOption)||""}get startResultIndex(){var e;return(((e=this.dataLayer.searchObject)==null?void 0:e.page)-1)*this.resultsPerPage+1}get endResultIndex(){var t;const e=(((t=this.dataLayer.searchObject)==null?void 0:t.page)-1)*this.resultsPerPage+(this.resultsPerPage??0);return e>this.totalResults?this.totalResults:e}get isFirstPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)===1}get isLastPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)>=Math.ceil(this.totalResults/this.resultsPerPage)}get percentageOfResultsLoaded(){return this.endResultIndex/this.totalResults*100}get results(){return this.dataLayer.searchResults??[]}get autoCorrectedQuery(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||""}get originalQuery(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.query)||""}get getAnswerData(){return this.dataLayer.getAnswerData||""}get shouldShowAnswerLoadMore(){return this.dataLayer.getAnswerData.split(" ").length>this.answerWidgetShowMoreLimit}get answerTruncated(){return this.dataLayer.getAnswerData.split(" ").slice(0,this.answerWidgetShowMoreLimit).join(" ")+"..."}get fullAnswerFormatted(){return Js.sanitize(V.parse(this.dataLayer.getAnswerData)).replace(/<a /g,'<a target="_blank" class="searchstax-answer-link" rel="noopener noreferrer" ')}get answerLoading(){return this.dataLayer.answerLoading}get shouldShowAnswerError(){return this.dataLayer.answerError}get locationError(){return this.dataLayer.locationError}get shouldShowAnswer(){return(this.dataLayer.getAnswerData!==""||this.dataLayer.parsedData.answerLoading||this.shouldShowAnswerError)&&this.dataLayer.searchObject.query!=="*"}get searchTerm(){var e,t;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||((t=this.dataLayer.searchObject)==null?void 0:t.query)||""}get locationSearchEnabled(){return this.dataLayer.locationEnabled??!1}get locationSearchDistanceEnabled(){var e,t,a,r,i,n,o;return((t=(e=this.dataLayer.searchLocationConfig)==null?void 0:e.locationValuesOverride)!=null&&t.locationDistanceEnabled?(r=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:r.locationDistanceEnabled:(o=(n=(i=this.dataLayer.searchResultsMetadata)==null?void 0:i.location)==null?void 0:n.filter)==null?void 0:o.enabled)??!1}get locationSearchDistanceValues(){var a,r,i,n,o,c,h,g,m;const e=((r=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:r.filterValues)??((o=(n=(i=this.dataLayer.searchResultsMetadata)==null?void 0:i.location)==null?void 0:n.filter)==null?void 0:o.values),t=((h=(c=this.dataLayer.searchLocationConfig)==null?void 0:c.locationValuesOverride)==null?void 0:h.filterUnit)??((m=(g=this.dataLayer.searchResultsMetadata)==null?void 0:g.location)==null?void 0:m.unit);return!e||e.length===0?[]:e.map(p=>({label:p==="any"?"Any Distance":p+" "+(t??""),value:p,isSelected:p===this.dataLayer.searchRadius})).sort((p,w)=>{const S=p.value==="any"?0:parseFloat(p.value),L=w.value==="any"?0:parseFloat(w.value);return S-L})}get shouldShowLocationDistanceDropdown(){return this.locationSearchDistanceEnabled&&this.locationSearchDistanceValues.length>1}get searchingEverything(){return this.searchTerm==="*"}get firstSearchHappened(){return this.dataLayer.firstSearchHappened}get isInfiniteScroll(){return this.dataLayer.isInfiniteScroll??!1}get answerErrorMessage(){return Js.sanitize(V.parse(this.dataLayer.answerErrorMessage)).replace("<br>","")}get searchExecuted(){var e,t,a;return((e=this.dataLayer.searchObject)==null?void 0:e.query)!==void 0&&((t=this.dataLayer.searchObject)==null?void 0:t.query)!=="undefined"&&((a=this.dataLayer.searchObject)==null?void 0:a.query)!==""}get relatedSearches(){const e=this.dataLayer.searchRelatedSearches??[];return e[e.length-1]&&(e[e.length-1].last=!0),e}get externalPromotions(){return this.dataLayer.searchExternalPromotions??[]}get data(){return{currentPage:this.currentPage,totalPages:this.totalPages,totalResults:this.totalResults,resultsPerPage:this.resultsPerPage,startResultIndex:this.startResultIndex,endResultIndex:this.endResultIndex,isFirstPage:this.isFirstPage,isLastPage:this.isLastPage,results:this.results,searchTerm:this.searchTerm!=="undefined"?this.searchTerm:"",autoCorrectedQuery:this.autoCorrectedQuery,originalQuery:this.originalQuery,searchExecuted:this.searchExecuted,searchingEverything:this.searchingEverything,relatedSearches:this.relatedSearches,hasRelatedSearches:this.relatedSearches.length>0,externalPromotions:this.externalPromotions,hasExternalPromotions:this.externalPromotions.length>0,hasResults:this.results.length>0,hasResultsOrExternalPromotions:this.results.length>0||this.externalPromotions.length>0,answer:this.getAnswerData,answerTruncated:this.answerTruncated,fullAnswerFormatted:this.fullAnswerFormatted,shouldShowAnswerLoadMore:this.shouldShowAnswerLoadMore,answerLoading:this.answerLoading,shouldShowAnswer:this.shouldShowAnswer,isInfiniteScroll:this.isInfiniteScroll,percentageOfResultsLoaded:this.percentageOfResultsLoaded,firstSearchHappened:this.firstSearchHappened,sortOptions:this.sortOptions,selectedSortOption:this.selectedSortOption,shouldShowAnswerError:this.shouldShowAnswerError,answerErrorMessage:this.answerErrorMessage,locationSearchEnabled:this.locationSearchEnabled,locationSearchDistanceEnabled:this.locationSearchDistanceEnabled,locationSearchDistanceValues:this.locationSearchDistanceValues,shouldShowLocationDistanceDropdown:this.shouldShowLocationDistanceDropdown,locationError:this.locationError}}get trackingData(){var e,t,a,r;return{searchTerm:this.searchTerm,trackApiKey:((e=this.dataLayer.searchstaxConfig)==null?void 0:e.trackApiKey)??"",session:this.dataLayer.sessionIdValue,language:this.dataLayer.language,recordsPerPage:((t=this.dataLayer.searchResultsMetadata)==null?void 0:t.recordsPerPageValue)??0,totalResults:((a=this.dataLayer.searchResultsMetadata)==null?void 0:a.totalResultsValue)??0,currentPage:this.dataLayer.currentPage,latencyVal:((r=this.dataLayer.searchResultsMetadata)==null?void 0:r.latency)??0,...this.dataLayer.model?{model:this.dataLayer.model}:{}}}}class be{static deepEqual(e,t){const a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(const i of a){const n=e[i],o=t[i],c=this.isObject(n)&&this.isObject(o);if(c&&!this.deepEqual(n,o)||!c&&n!==o)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class R{constructor(e){u(this,"value");u(this,"observers",{});this.value=e,this.observers={}}subscribe(e,t){const a=Math.random().toString(36).substring(2,15),r=t||a;return this.observers[r]=e,e(this.value),r}unsubscribe(e){this.observers[e]&&delete this.observers[e]}subscribeOnce(e){const t=Math.random().toString(36).substring(2,15),a=r=>{e(r),this.unsubscribe(t)};this.subscribe(a,t)}subscribeTwice(e){const t=Math.random().toString(36).substring(2,15);let a=0;const r=i=>{a++,e(i),a>=2&&this.unsubscribe(t)};this.subscribe(r,t)}subscribeUntil(e,t,a=6e3,r=!0){const i=Math.random().toString(36).substring(2,15),n=o=>{o===t&&(e(o),this.unsubscribe(i))};return this.value===t?(e(this.value),null):(this.subscribe(n,i),setTimeout(()=>{r&&this.observers[i]&&e(this.value),this.unsubscribe(i)},a),i)}subscribeUntilHasValue(e,t=6e3,a=!0){const r=Math.random().toString(36).substring(2,15),i=n=>{n!=null&&(e(n),this.unsubscribe(r))};return this.value!==null&&this.value!==void 0?(e(this.value),null):(this.subscribe(i,r),t>0&&setTimeout(()=>{a&&this.observers[r]&&e(this.value),this.unsubscribe(r)},t),i)}setValue(e){this.value=e,this.notify()}getValue(){return this.value}notify(){for(const e in this.observers)if(Object.prototype.hasOwnProperty.call(this.observers,e)){const t=this.observers[e];typeof t=="function"&&t(this.value)}}}class va{static getOrSetCookie(e,t){let a=this.getCookie(e);return a==null&&(a=t??this.makeid(25),this.setCookie(e,a,{secure:!0,"max-age":3600})),a}static deleteCookie(e){this.getCookie(e)&&this.setCookie(e,"",{secure:!0,"max-age":-1})}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=a.length;for(let i=0;i<e;i++)t+=a.charAt(Math.floor(Math.random()*r));return t}static getCookie(e){const t=typeof document<"u"?document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)")):null;return t?decodeURIComponent(t[1]):void 0}static setCookie(e,t,a){const r={path:"/",...a};a.expires instanceof Date&&(r.expires=a.expires.toUTCString());let i=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const n in r){i+="; "+n;const o=r[n];o!==!0&&(i+="="+o)}typeof document<"u"&&(document.cookie=i)}}class le{static removeXSSRiskyTags(e){var t="script|style|iframe|object|embed|form|input|button",a=new RegExp("</?("+t+")(\\s[^>]*)?>","gi");return e?e.replace(a,""):""}}class nn{constructor(e,t){u(this,"$searchTermChange",new R(""));u(this,"$searchLocationChange",new R(""));u(this,"$searchLocationCoordinatesDecoded",new R(""));u(this,"$searchLatChange",new R(""));u(this,"$searchLongChange",new R(""));u(this,"$searchRadiusChange",new R(void 0));u(this,"$loadingChange",new R(!1));u(this,"$locationError",new R(!1));u(this,"$searchResults",new R(null));u(this,"$searchResultsMetadata",new R(null));u(this,"$searchAutosuggest",new R(null));u(this,"$searchFacets",new R(null));u(this,"$searchFacetsCachedand",new R(null));u(this,"$searchFacetsCachedor",new R(null));u(this,"$searchFacetsCachedtabs",new R(null));u(this,"$searchstaxConfig",new R(null));u(this,"$autosuggestResults",new R(null));u(this,"$itemsPerPage",new R(void 0));u(this,"$searchObject",new R({query:"",itemsPerPage:void 0,page:99999999,order:"",facets:[],additionalProps:[],location:{term:void 0,radius:void 0,lat:void 0,lon:void 0},model:""}));u(this,"$searchRelatedSearches",new R(null));u(this,"$searchInputConfig",new R(null));u(this,"$searchLocationConfig",new R(null));u(this,"$searchExternalPromotions",new R(null));u(this,"$facetsTemplateData",new R(null));u(this,"$selectedFacetsTemplateData",new R(null));u(this,"$paginationData",new R(null));u(this,"$answerData",new R(null));u(this,"$searchFeedbackData",new R(null));u(this,"$inputWidgetTemplateData",new R(null));u(this,"$locationWidgetTemplateData",new R(null));u(this,"$searchSortingData",new R(null));u(this,"$searchRelatedSearchesData",new R(null));u(this,"$searchExternalPromotionsData",new R(null));u(this,"$cookiesDisabled",new R(null));u(this,"$locationDecodingLoading",new R(!1));u(this,"$answer",new R(""));u(this,"$language",new R("en"));u(this,"$model",new R(""));u(this,"$answerLoading",new R(!1));u(this,"$locationEnabled",new R(null));u(this,"$answerError",new R(!1));u(this,"$answerErrorMessage",new R(""));u(this,"$isQuestion",new R(!1));u(this,"$inputTemplateRendered",new R(!1));u(this,"currentPageValue",1);u(this,"isAnswerWidgetCreatedValue",!1);u(this,"renderingEngineValue",te.mustache);u(this,"parsedData",new rn(this));u(this,"sessionId");u(this,"sessionIdValue",null);u(this,"autoCorrect",!0);u(this,"forceNotCorrect",!1);u(this,"lastSearchValue","");u(this,"turnAIAnswerGenerationOn",!1);u(this,"questionURL","");u(this,"isInfiniteScroll",!1);u(this,"firstSearchHappened",!1);u(this,"facetsWereSet",!1);u(this,"answerWidgetShowMoreLimit",100);u(this,"searchHelper");u(this,"searchResultUnparsed");this.sessionId=e,t&&(this.sessionIdValue=t),this.cookieHandlingCallback(t),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback(t)})}cookieHandlingCallback(e){this.cookiesDisabled?(this.sessionIdValue=null,va.deleteCookie(this.sessionId),va.deleteCookie("ms_visitorid")):this.sessionIdValue=va.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(le.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(le.removeXSSRiskyTags(e))}setSearchRadius(e){this.$searchRadiusChange.setValue(e)}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setIsAnswerWidgetCreated(e){this.isAnswerWidgetCreatedValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){this.firstSearchHappened=!0,(!be.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){be.deepEqual(e,this.searchResultsMetadata??{})||this.$searchResultsMetadata.setValue(e)}setSearchAutosuggest(e){this.$searchAutosuggest.setValue(e)}setSearchObject(e){var a,r;let t=e;t={...t,itemsPerPage:this.itemsPerPage,model:this.model},(r=(a=this.searchstaxConfig)==null?void 0:a.hooks)!=null&&r.beforeSearch&&t&&(t=this.searchstaxConfig.hooks.beforeSearch(t)),t&&(!be.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&(this.searchObject.itemsPerPage!==t.itemsPerPage&&t.itemsPerPage!==void 0&&this.setItemsPerPage(t.itemsPerPage),this.$searchObject.setValue(t))}setSearchFacets(e){this.facetsWereSet=!0,be.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){be.deepEqual(e,this.searchFacetsCachedand??[])||this.$searchFacetsCachedand.setValue(e)}setSearchFacetsCachedor(e){be.deepEqual(e,this.searchFacetsCachedor??[])||this.$searchFacetsCachedor.setValue(e)}setSearchFacetsCachedtabs(e){be.deepEqual(e,this.searchFacetsCachedtabs??[])||this.$searchFacetsCachedtabs.setValue(e)}setSearchRelatedSearches(e){be.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){be.deepEqual(e,this.searchExternalPromotions??[])||this.$searchExternalPromotions.setValue(e)}setLanguage(e){this.$language.setValue(e)}setModel(e){this.$model.setValue(e)}setSearchstaxConfig(e){this.$searchstaxConfig.setValue(e)}setSearchInputConfig(e){this.$searchInputConfig.setValue(e)}setSearchLocationConfig(e){this.$searchLocationConfig.setValue(e)}setAutosuggestResults(e){this.$autosuggestResults.setValue(e)}setFacetsTemplateData(e){this.$facetsTemplateData.setValue(e)}setSelectedFacetsTemplateData(e){this.$selectedFacetsTemplateData.setValue(e)}setPaginationData(e){this.$paginationData.setValue(e)}setAnswerFullData(e){this.$answerData.setValue(e)}setSearchFeedbackData(e){this.$searchFeedbackData.setValue(e)}setSearchSortingData(e){this.$searchSortingData.setValue(e)}setRelatedSearchesData(e){this.$searchRelatedSearchesData.setValue(e)}setExternalPromotionsData(e){this.$searchExternalPromotionsData.setValue(e)}setCookiesDisabled(e){this.$cookiesDisabled.setValue(e)}setAnswerData(e){this.$answer.setValue(e)}setItemsPerPage(e){this.$itemsPerPage.setValue(e)}setAnswerLoading(e){this.$answerLoading.setValue(e)}setAnswerError(e){this.$answerError.setValue(e)}setIsQuestion(e){this.$isQuestion.setValue(e)}setAnswerErrorMessage(e){this.$answerErrorMessage.setValue(e)}setLocationDecodingLoading(e){this.$locationDecodingLoading.setValue(e)}setSearchLat(e){this.$searchLatChange.setValue(e)}setSearchLong(e){this.$searchLongChange.setValue(e)}setInputTemplateRendered(e){this.$inputTemplateRendered.setValue(e)}setLocationError(e){this.$locationError.setValue(e)}setInputWidgetTemplateData(e){this.$inputWidgetTemplateData.setValue(e)}setLocationWidgetTemplateData(e){this.$locationWidgetTemplateData.setValue(e)}setLocationCoordinatesDecoded(e){this.$searchLocationCoordinatesDecoded.setValue(le.removeXSSRiskyTags(e))}setLocationEnabled(e){this.$locationEnabled.setValue(e)}setSearchResultUnparsedData(e){this.searchResultUnparsed=e}get getAnswerData(){return this.$answer.getValue()}get searchstaxConfig(){return this.$searchstaxConfig.getValue()}get searchFacets(){return this.$searchFacets.getValue()?JSON.parse(JSON.stringify(this.$searchFacets.getValue())):null}get searchFacetsCachedand(){return this.$searchFacetsCachedand.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedand.getValue())):null}get searchFacetsCachedtabs(){return this.$searchFacetsCachedtabs.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedtabs.getValue())):null}get searchFacetsCachedor(){return this.$searchFacetsCachedor.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedor.getValue())):null}get searchResults(){return this.$searchResults.getValue()?JSON.parse(JSON.stringify(this.$searchResults.getValue())):null}get searchTerm(){return this.$searchTermChange.getValue()}get searchLocation(){return this.$searchLocationChange.getValue()}get searchRadius(){return this.$searchRadiusChange.getValue()}get loading(){return this.$loadingChange.getValue()}get searchAutosuggest(){return this.$searchAutosuggest.getValue()}get searchResultsMetadata(){return this.$searchResultsMetadata.getValue()?JSON.parse(JSON.stringify(this.$searchResultsMetadata.getValue())):null}get currentPage(){return this.$searchObject.getValue().page??this.currentPageValue}get isAnswerWidgetCreated(){return this.isAnswerWidgetCreatedValue}get renderingEngine(){return this.renderingEngineValue}get searchObject(){return JSON.parse(JSON.stringify(this.$searchObject.getValue()))}get searchRelatedSearches(){return this.$searchRelatedSearches.getValue()?JSON.parse(JSON.stringify(this.$searchRelatedSearches.getValue())):null}get searchExternalPromotions(){return this.$searchExternalPromotions.getValue()?JSON.parse(JSON.stringify(this.$searchExternalPromotions.getValue())):null}get language(){return this.$language.getValue()}get model(){return this.$model.getValue()}get searchInputConfig(){return this.$searchInputConfig.getValue()}get searchLocationConfig(){return this.$searchLocationConfig.getValue()}get answerConfig(){return this.$answer.getValue()}get autosuggestResults(){return this.$autosuggestResults.getValue()}get facetsTemplateData(){return this.$facetsTemplateData.getValue()}get selectedFacetsTemplateData(){return this.$selectedFacetsTemplateData.getValue()}get paginationData(){return this.$paginationData.getValue()}get searchFeedbackData(){return this.$searchFeedbackData.getValue()}get searchSortingData(){return this.$searchSortingData.getValue()}get searchRelatedSearchesData(){return this.$searchRelatedSearchesData.getValue()}get searchExternalPromotionsData(){return this.$searchExternalPromotionsData.getValue()}get cookiesDisabled(){return(this.$cookiesDisabled.getValue()??!1)||!navigator.cookieEnabled}get itemsPerPage(){return this.$itemsPerPage.getValue()}get answerFullData(){return this.$answerData.getValue()}get answerLoading(){return this.$answerLoading.getValue()}get isQuestion(){return this.$isQuestion.getValue()}get answerError(){return this.$answerError.getValue()}get answerErrorMessage(){return this.$answerErrorMessage.getValue()}get locationDecodingLoading(){return this.$locationDecodingLoading.getValue()}get searchLat(){return this.$searchLatChange.getValue()}get searchLong(){return this.$searchLongChange.getValue()}get inputTemplateRendered(){return this.$inputTemplateRendered.getValue()}get locationError(){return this.$locationError.getValue()}get inputWidgetTemplateData(){return this.$inputWidgetTemplateData.getValue()}get locationWidgetTemplateData(){return this.$locationWidgetTemplateData.getValue()}get searchLocationCoordinatesDecoded(){return this.$searchLocationCoordinatesDecoded.getValue()}get locationEnabled(){return this.$locationEnabled.getValue()}get searchResultUnparsedData(){return this.searchResultUnparsed}}class Et{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"");return e.response.docs.forEach((r,i)=>{var c;const n=r[e.responseHeader.params.uniqueId]??"",o={custom:null,uniqueId:n,position:a+1+i,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",r,e,n):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",r,e,n):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",r,e,n):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",r,e,n):null,titleTracking:this.doesMapExist("title",e)?this.getValueByKey("title",r,e,n,!0):null,promoted:r["[elevated]"]?r["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",r,e,n):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",r,e,n):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",r,e,n):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",r,e,n):null,distance:this.doesMapExist("distance",e)&&this.getValueByKey("distance",r,e,n)!=="Infinity"&&this.getValueByKey("distance",r,e,n)?Math.floor(this.getValueByKey("distance",r,e,n)):null,unit:((c=e.metadata.locationSearch)==null?void 0:c.unit)??"",unmappedFields:this.getUnmappedFields(r,e,n),allFields:this.getAllFields(r,e)};t.push(o)}),t}static extractFacets(e){const t=[];if(e.metadata.facets)for(const a of e.metadata.facets){let r={values:[]};if(r.name=a.name,r.label=a.label,a.name in e.facet_counts.facet_fields){const i=e.facet_counts.facet_fields[a.name];for(let n=0;n<i.length;n+=2){const o={};o.value=i[n],o.parentName=r.name,o.count=i[n+1],o.type="checkbox",r.values.push(o)}}r.values.length>0&&t.push(r)}return t}static extractSearchResultsMetadata(e){var i,n,o,c,h,g,m,p,w,S;let t="",a={selectedSortOption:"",options:[]},r={enabled:!1,field:"",unit:"",filter:{enabled:!1,values:[],label:"",defaultValue:""}};if(e.metadata.locationSearch&&(r={enabled:e.metadata.locationSearch.enabled,field:e.metadata.locationSearch.field,unit:e.metadata.locationSearch.unit,filter:{enabled:((i=e.metadata.locationSearch.filter)==null?void 0:i.enabled)??!1,values:((n=e.metadata.locationSearch.filter)==null?void 0:n.values)??[],label:((o=e.metadata.locationSearch.filter)==null?void 0:o.label)??"",defaultValue:((c=e.metadata.locationSearch.filter)==null?void 0:c.defaultValue)??""}}),(h=e.metadata.results.find(L=>L.result_card==="date"))==null||h.name,a.options=[],(g=e.metadata.sorts)==null?void 0:g.length){const L=e.metadata.sorts.map(T=>({value:T.label,key:T.name+" "+T.order}));a.options=[{key:"",value:"Relevance"},...L]}return t=((S=(w=(p=(m=e==null?void 0:e.spellcheck)==null?void 0:m.suggestions)==null?void 0:p[1])==null?void 0:w.suggestion)==null?void 0:S[0])??"",typeof t!="string"&&(t=(t==null?void 0:t.word)??""),{recordsPerPageValue:parseInt(e.responseHeader.params.rows),startDocVal:parseInt(e.response.start+""),totalResultsValue:parseInt(e.response.numFound+""),latency:parseInt(e.responseHeader.QTime+""),endDocValue:parseInt(e.responseHeader.params.rows)+parseInt(e.response.start+""),spellingSuggestion:t,autoCorrectedQuery:e.responseHeader.params.autoCorrectedQ??"",impressions:this.getImpressions(e),sorting:a,location:r,isLocationMapped:this.doesMapExist("distance",e)}}static getImpressions(e){const t=[],a=this.combineResultsWithMetadata(e);for(const r in a){const i=a[r],n={};n.cDocId=this.getDataForAnalytics(i.uniqueId),i.title&&(n.cDocTitle=this.getDataForAnalytics(i.titleTracking)),n.position=i.position,t.push(n)}return t}static getDataForAnalytics(e){return e!==null?typeof e>"u"?"":typeof e=="string"?e:typeof e.join<"u"?e[0]:e:""}static findResultByUniqueId(e,t){return t.find(a=>a.uniqueId===e)??null}static getUnmappedFields(e,t,a){const r=t.metadata.results.filter(n=>n.result_card==="").map(n=>n.name),i=[];for(const n of r)if(Object.keys(e).includes(n)){const o=Array.isArray(e[n])?this.getHighlightedResults(n,e[n].join(", "),a,t):this.getHighlightedResults(n,e[n]+"",a,t);i.push({key:n,value:o,isImage:this.checkIfImage(e[n])})}return i}static checkIfImage(e){return e===void 0?!1:typeof e!="string"?Array.isArray(e)&&e[0]?/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e[0]):!1:/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e)}static getAllFields(e,t){const a=t.metadata.results.map(i=>i.name),r=[];for(const i of Object.keys(e))a.indexOf(i)!==-1&&r.push({key:i,value:e[i],isImage:this.checkIfImage(e[i])});return r}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a,r,i=!1){const n=a.metadata.results.find(c=>c.result_card===e);if(n===void 0)return null;const o=t[n.name];return o===void 0?null:typeof o=="string"?i?o:this.getHighlightedResults(n.name,o,r,a):typeof o=="number"?o:Array.isArray(o)?i?o.join(", "):this.getHighlightedResults(n.name,o.join(", "),r,a):null}static getHighlightedResults(e,t,a,r){if(r.highlighting&&a in r.highlighting){let i=r.highlighting[a];if(i&&e in i){let n=i[e];const o=this.cleanValue(n);if(o!=="")return o}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class Gs{constructor(e){u(this,"routeName","searchstax");u(this,"ignoredKeys",[]);u(this,"queryStringHelper");u(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new on(this.routeName)}updateUrl(e){const t=this.searchObjectToUrl(e);let a=typeof document<"u"?document==null?void 0:document.title:"";this.titleParser&&(a=this.titleParser(e)),typeof document<"u"&&(document.title=a),(window==null?void 0:window.location.href)!==t&&(window==null||window.history.replaceState(window.history.state,a,t))}searchObjectToUrl(e){return this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")?(window==null?void 0:window.location.href.split("?")[0])+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys}):(window==null?void 0:window.location.href)+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys})}searchObjectToParams(e){const t={},a=e.page||1;if(e.query&&(t[this.routeName+"[query]"]=encodeURIComponent(e.query)),e.page&&(t[this.routeName+"[page]"]=a+""),e.order&&(t[this.routeName+"[order]"]=e.order),e.itemsPerPage&&e.itemsPerPage!==10&&(t[this.routeName+"[itemsPerPage]"]=e.itemsPerPage+""),e.location)for(const r in e.location){const i=e.location[r];i&&(t[this.routeName+`[location][${r}]`]=i)}if(e.facets)for(const r in e.facets){const i=e.facets[r].type+":"+encodeURIComponent(e.facets[r].name)+":"+encodeURIComponent(e.facets[r].value);t[this.routeName+`[facets][${r}]`]=i}if(e.model&&(t[this.routeName+"[model]"]=e.model),this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")){const r=this.queryStringHelper.urlToParams((window==null?void 0:window.location.href)??"");for(const i in r)i.startsWith(this.routeName)&&delete r[i];return{...r,...t}}else return t}extractParamsThatDoNotStartWithRouteName(e){const t={};for(const a in e)a.startsWith(this.routeName)||(t[a]=e[a]);return t}extractArrayOfFacetsFromQueryParameters(e){var a,r,i;const t=[];for(const n in e)if(n.startsWith(this.routeName+"[facets]")){const o=le.removeXSSRiskyTags((a=e[n].split(":"))==null?void 0:a[0]),c=le.removeXSSRiskyTags(decodeURIComponent((r=e[n].split(":"))==null?void 0:r[1])),h=le.removeXSSRiskyTags(decodeURIComponent((i=e[n].split(":"))==null?void 0:i[2]));t.push({type:o,name:c,value:h})}return t}urlToSearchObject(e,t){const a=this.queryStringHelper.urlToParams(e),r=le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),i=parseInt(r),n=isNaN(i)?1:i;let o=parseInt(le.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return{query:le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:n,itemsPerPage:t??o,order:le.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:le.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class on{constructor(e){u(this,"routeName","");u(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(r=>{const i=a[r];return Array.isArray(i)?i.map(n=>`${r}=${n}`).join("&"):`${r}=${i}`}).join("&")});this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],r={};return Object.keys(e).forEach(i=>{a.includes(i)||e[i]!==""&&(r[i]=e[i])}),r}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(r=>{const[i,n]=r.split("=");t[i]=n}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}const ht={question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class ja extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const Ks=10,cn=13,Ye=32;function Ea(s){}function ln(s){if(typeof s=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:e=Ea,onError:t=Ea,onRetry:a=Ea,onComment:r,maxBufferSize:i}=s,n=[];let o=0,c=!0,h,g="",m=0,p,w=!1;function S(y){if(w)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,y.charCodeAt(0)===239&&y.charCodeAt(1)===187&&y.charCodeAt(2)===191&&(y=y.slice(3))),n.length===0){const E=T(y);E!==""&&(n.push(E),o=E.length),L();return}if(y.indexOf(`
|
|
80
|
+
`)===-1&&y.indexOf("\r")===-1){n.push(y),o+=y.length,L();return}n.push(y);const b=n.join("");n.length=0,o=0;const M=T(b);M!==""&&(n.push(M),o=M.length),L()}function L(){i!==void 0&&(o+g.length<=i||(w=!0,n.length=0,o=0,h=void 0,g="",m=0,p=void 0,t(new ja(`Buffered data exceeded max buffer size of ${i} characters`,{type:"max-buffer-size-exceeded"}))))}function T(y){let b=0;if(y.indexOf("\r")===-1){let M=y.indexOf(`
|
|
81
|
+
`,b);for(;M!==-1;){if(b===M){m>0&&e({id:h,event:p,data:g}),h=void 0,g="",m=0,p=void 0,b=M+1,M=y.indexOf(`
|
|
82
|
+
`,b);continue}const E=y.charCodeAt(b);if(Zs(y,b,E)){const N=y.charCodeAt(b+5)===Ye?b+6:b+5,G=y.slice(N,M);if(m===0&&y.charCodeAt(M+1)===Ks){e({id:h,event:p,data:G}),h=void 0,g="",p=void 0,b=M+2,M=y.indexOf(`
|
|
83
|
+
`,b);continue}g=m===0?G:`${g}
|
|
84
|
+
${G}`,m++}else Xs(y,b,E)?p=y.slice(y.charCodeAt(b+6)===Ye?b+7:b+6,M)||void 0:A(y,b,M);b=M+1,M=y.indexOf(`
|
|
85
|
+
`,b)}return y.slice(b)}for(;b<y.length;){const M=y.indexOf("\r",b),E=y.indexOf(`
|
|
86
|
+
`,b);let N=-1;if(M!==-1&&E!==-1?N=M<E?M:E:M!==-1?M===y.length-1?N=-1:N=M:E!==-1&&(N=E),N===-1)break;A(y,b,N),b=N+1,y.charCodeAt(b-1)===cn&&y.charCodeAt(b)===Ks&&b++}return y.slice(b)}function A(y,b,M){if(b===M){P();return}const E=y.charCodeAt(b);if(Zs(y,b,E)){const ge=y.charCodeAt(b+5)===Ye?b+6:b+5,Se=y.slice(ge,M);g=m===0?Se:`${g}
|
|
87
|
+
${Se}`,m++;return}if(Xs(y,b,E)){p=y.slice(y.charCodeAt(b+6)===Ye?b+7:b+6,M)||void 0;return}if(E===105&&y.charCodeAt(b+1)===100&&y.charCodeAt(b+2)===58){const ge=y.slice(y.charCodeAt(b+3)===Ye?b+4:b+3,M);h=ge.includes("\0")?void 0:ge;return}if(E===58){if(r){const ge=y.slice(b,M);r(ge.slice(y.charCodeAt(b+1)===Ye?2:1))}return}const N=y.slice(b,M),G=N.indexOf(":");if(G===-1){O(N,"",N);return}const se=N.slice(0,G),pe=N.charCodeAt(G+1)===Ye?2:1,Ae=N.slice(G+pe);O(se,Ae,N)}function O(y,b,M){switch(y){case"event":p=b||void 0;break;case"data":g=m===0?b:`${g}
|
|
88
|
+
${b}`,m++;break;case"id":h=b.includes("\0")?void 0:b;break;case"retry":/^\d+$/.test(b)?a(parseInt(b,10)):t(new ja(`Invalid \`retry\` value: "${b}"`,{type:"invalid-retry",value:b,line:M}));break;default:t(new ja(`Unknown field "${y.length>20?`${y.slice(0,20)}…`:y}"`,{type:"unknown-field",field:y,value:b,line:M}));break}}function P(){m>0&&e({id:h,event:p,data:g}),h=void 0,g="",m=0,p=void 0}function I(y={}){if(y.consume&&n.length>0){const b=n.join("");A(b,0,b.length)}c=!0,h=void 0,g="",m=0,p=void 0,n.length=0,o=0,w=!1}return{feed:S,reset:I}}function Zs(s,e,t){return t===100&&s.charCodeAt(e+1)===97&&s.charCodeAt(e+2)===116&&s.charCodeAt(e+3)===97&&s.charCodeAt(e+4)===58}function Xs(s,e,t){return t===101&&s.charCodeAt(e+1)===118&&s.charCodeAt(e+2)===101&&s.charCodeAt(e+3)===110&&s.charCodeAt(e+4)===116&&s.charCodeAt(e+5)===58}class er extends Event{constructor(e,t){var a,r;super(e),this.code=(a=t==null?void 0:t.code)!=null?a:void 0,this.message=(r=t==null?void 0:t.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,a){return a(tr(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(tr(this),t)}}function hn(s){const e=globalThis.DOMException;return typeof e=="function"?new e(s,"SyntaxError"):new SyntaxError(s)}function $a(s){return s instanceof Error?"errors"in s&&Array.isArray(s.errors)?s.errors.map($a).join(", "):"cause"in s&&s.cause instanceof Error?`${s}: ${$a(s.cause)}`:s.message:`${s}`}function tr(s){return{type:s.type,message:s.message,code:s.code,defaultPrevented:s.defaultPrevented,cancelable:s.cancelable,timeStamp:s.timeStamp}}var wr=s=>{throw TypeError(s)},as=(s,e,t)=>e.has(s)||wr("Cannot "+t),z=(s,e,t)=>(as(s,e,"read from private field"),t?t.call(s):e.get(s)),ne=(s,e,t)=>e.has(s)?wr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),J=(s,e,t,a)=>(as(s,e,"write to private field"),e.set(s,t),t),Ne=(s,e,t)=>(as(s,e,"access private method"),t),we,Ge,ot,Zt,sa,Rt,ut,Dt,Ve,ct,gt,lt,At,Me,za,_a,Wa,ar,Va,Qa,It,Ba,Ha;class Xt extends EventTarget{constructor(e,t){var a,r;super(),ne(this,Me),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,ne(this,we),ne(this,Ge),ne(this,ot),ne(this,Zt),ne(this,sa),ne(this,Rt),ne(this,ut),ne(this,Dt,null),ne(this,Ve),ne(this,ct),ne(this,gt,null),ne(this,lt,null),ne(this,At,null),ne(this,_a,async i=>{var n;z(this,ct).reset();const{body:o,redirected:c,status:h,headers:g}=i;if(h===204){Ne(this,Me,It).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?J(this,ot,new URL(i.url)):J(this,ot,void 0),h!==200){Ne(this,Me,It).call(this,`Non-200 status code (${h})`,h);return}if(!(g.get("content-type")||"").startsWith("text/event-stream")){Ne(this,Me,It).call(this,'Invalid content type, expected "text/event-stream"',h);return}if(z(this,we)===this.CLOSED)return;J(this,we,this.OPEN);const m=new Event("open");if((n=z(this,At))==null||n.call(this,m),this.dispatchEvent(m),typeof o!="object"||!o||!("getReader"in o)){Ne(this,Me,It).call(this,"Invalid response body, expected a web ReadableStream",h),this.close();return}const p=new TextDecoder,w=o.getReader();let S=!0;do{const{done:L,value:T}=await w.read();T&&z(this,ct).feed(p.decode(T,{stream:!L})),L&&(S=!1,z(this,ct).reset(),Ne(this,Me,Ba).call(this))}while(S)}),ne(this,Wa,i=>{J(this,Ve,void 0),!(i.name==="AbortError"||i.type==="aborted")&&Ne(this,Me,Ba).call(this,$a(i))}),ne(this,Va,i=>{typeof i.id=="string"&&J(this,Dt,i.id);const n=new MessageEvent(i.event||"message",{data:i.data,origin:z(this,ot)?z(this,ot).origin:z(this,Ge).origin,lastEventId:i.id||""});z(this,lt)&&(!i.event||i.event==="message")&&z(this,lt).call(this,n),this.dispatchEvent(n)}),ne(this,Qa,i=>{J(this,Rt,i)}),ne(this,Ha,()=>{J(this,ut,void 0),z(this,we)===this.CONNECTING&&Ne(this,Me,za).call(this)});try{if(e instanceof URL)J(this,Ge,e);else if(typeof e=="string")J(this,Ge,new URL(e,un()));else throw new Error("Invalid URL")}catch{throw hn("An invalid or illegal string was specified")}J(this,ct,ln({onEvent:z(this,Va),onRetry:z(this,Qa)})),J(this,we,this.CONNECTING),J(this,Rt,3e3),J(this,sa,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),J(this,Zt,(r=t==null?void 0:t.withCredentials)!=null?r:!1),Ne(this,Me,za).call(this)}get readyState(){return z(this,we)}get url(){return z(this,Ge).href}get withCredentials(){return z(this,Zt)}get onerror(){return z(this,gt)}set onerror(e){J(this,gt,e)}get onmessage(){return z(this,lt)}set onmessage(e){J(this,lt,e)}get onopen(){return z(this,At)}set onopen(e){J(this,At,e)}addEventListener(e,t,a){const r=t;super.addEventListener(e,r,a)}removeEventListener(e,t,a){const r=t;super.removeEventListener(e,r,a)}close(){z(this,ut)&&clearTimeout(z(this,ut)),z(this,we)!==this.CLOSED&&(z(this,Ve)&&z(this,Ve).abort(),J(this,we,this.CLOSED),J(this,Ve,void 0))}}we=new WeakMap,Ge=new WeakMap,ot=new WeakMap,Zt=new WeakMap,sa=new WeakMap,Rt=new WeakMap,ut=new WeakMap,Dt=new WeakMap,Ve=new WeakMap,ct=new WeakMap,gt=new WeakMap,lt=new WeakMap,At=new WeakMap,Me=new WeakSet,za=function(){J(this,we,this.CONNECTING),J(this,Ve,new AbortController),z(this,sa)(z(this,Ge),Ne(this,Me,ar).call(this)).then(z(this,_a)).catch(z(this,Wa))},_a=new WeakMap,Wa=new WeakMap,ar=function(){var s;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...z(this,Dt)?{"Last-Event-ID":z(this,Dt)}:void 0},cache:"no-store",signal:(s=z(this,Ve))==null?void 0:s.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Va=new WeakMap,Qa=new WeakMap,It=function(s,e){var t;z(this,we)!==this.CLOSED&&J(this,we,this.CLOSED);const a=new er("error",{code:e,message:s});(t=z(this,gt))==null||t.call(this,a),this.dispatchEvent(a)},Ba=function(s,e){var t;if(z(this,we)===this.CLOSED)return;J(this,we,this.CONNECTING);const a=new er("error",{code:e,message:s});(t=z(this,gt))==null||t.call(this,a),this.dispatchEvent(a),J(this,ut,setTimeout(z(this,Ha),z(this,Rt)))},Ha=new WeakMap,Xt.CONNECTING=0,Xt.OPEN=1,Xt.CLOSED=2;function un(){const s="document"in globalThis?globalThis.document:void 0;return s&&typeof s=="object"&&"baseURI"in s&&typeof s.baseURI=="string"?s.baseURI:void 0}class Ce{static attachAnalyticsScript(e){window._msq=window._msq||[];const t=e||"https://static.searchstax.com/studio-js/v4/js/studio-analytics.js";if(!document.querySelector(`script[src="${t}"]`)){var a=document.createElement("script");a.type="text/javascript",a.src=t;var r=document.getElementsByTagName("script")[0];r.parentNode&&r.parentNode.insertBefore(a,r)}}static trackClick(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,cDocId:e.result.uniqueId,cDocTitle:e.result.titleTracking,position:e.result.position,language:e.language,model:e.model};return new Promise((a,r)=>{const i=["trackClick",t];t.key?this.msq().push(i,(function(n,o){JSON.stringify(n)===JSON.stringify(t)&&o?a():r()}).bind(this)):r()})}static trackAnswerLinkClick(e){const t={key:e.trackApiKey,question:e.searchTerm,session:e.session,href:e.href,language:e.language,model:e.model,answer:e.answer};return new Promise((a,r)=>{const i=["answerSourceClick",t];t.key?this.msq().push(i,(function(n,o){JSON.stringify(n)===JSON.stringify(t)&&o?a():r()}).bind(this)):r()})}static trackSearch(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,language:e.language,model:e.model,impressions:e.impressions};setTimeout(()=>{t.key&&this.msq().push(["track",t])},0)}static trackRelatedSearchClick(e){const t={session:e.session,key:e.trackApiKey,query:e.relatedSearch.search_term,position:e.relatedSearch.position,relatedSearch:e.relatedSearch.related_search,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches,language:e.language,model:e.model};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearchClick",t])},0)}static trackRelatedSearches(e){const t={session:e.session,key:e.trackApiKey,query:e.searchTerm,latency:e.latencyVal,language:e.language,model:e.model,impressions:e.impressions,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearch",t])},0)}static trackAnswerData(e){const t={session:e.session,key:e.trackApiKey,question:e.searchTerm,answer:e.answer,language:e.language,model:e.model,is_question:e.isQuestion+"",has_show_more:e.hasShowMore};setTimeout(()=>{t.key&&this.msq().push(["trackquestionanswer",t])},0)}static trackShowMoreClick(e){const t={session:e.session,key:e.trackApiKey,language:e.language,model:e.model,question:e.searchTerm};setTimeout(()=>{t.key&&this.msq().push(["answershowmoreclick",t])},0)}static trackFeedback(e){setTimeout(()=>{this.msq().push(["trackSearchSatisfaction",{key:e.trackApiKey,email:e.email,score:e.rating,comments:e.feedback,language:e.language,model:e.model}])},0)}}u(Ce,"subscribedToClickEvent",!1),u(Ce,"msq",()=>typeof window<"u"&&(window!=null&&window._msq)?window==null?void 0:window._msq:[]);class dn{constructor(e,t){u(this,"cachedQuery","");u(this,"cachedQueryOR","");u(this,"cachedQueryTabs","");u(this,"cachedANDFacets","");u(this,"cachedORFacets","");u(this,"cachedTabsFacets","");u(this,"url","");u(this,"relatedSearches","");u(this,"suggester","");u(this,"authHeader");u(this,"authHeaderRelated");u(this,"trackApiKey","");u(this,"session","");u(this,"searchAuthType");u(this,"searchAuth","");u(this,"controllerSearch");u(this,"signalSearch");u(this,"controllerSuggest");u(this,"signalSuggest");u(this,"_authToken","");u(this,"resolveFn");u(this,"dataLayer");this.dataLayer=t,this.url=e.searchURL,this.dataLayer.setLanguage(e.language),this.suggester=e.suggesterURL,this.trackApiKey=e.trackApiKey,this.session=e.sessionId,this.searchAuthType=e.authType,this.searchAuth=e.searchAuth,this.authHeader=new Headers,this.authHeader.append("Accept","application/json"),this._authToken=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`,this.authHeader.append("Authorization",this._authToken),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let a=[];if(!t)e.forEach(function(r){const i=r.name+':"'+r.value+'"';a=a.concat("fq="+decodeURIComponent(i).replace(" "," "))});else{const r={};e.forEach(function(n){const o=n.name+":"+n.value,c=decodeURIComponent(o).replace(" "," ").split(":");r[c[0]]?r[c[0]].push(c[1]):r[c[0]]=[c[1]]});let i="";for(const n in r)if(Object.prototype.hasOwnProperty.call(r,n)){const o=r[n],c=n;for(const h of o)i+=i===""?` ${c}:"${h}"`:` OR ${c}:"${h}"`}a=a.concat("fq="+i.trim())}return a=a.map(r=>r.replace(/&/g,"%26").replace(/\+/g,"%2B")),a.length?"&"+a.join("&"):""}generateLocationQuery(e){let t="";if(e.lat&&e.lon){const a=Math.floor(parseFloat(e.lat)*100)/100,r=Math.floor(parseFloat(e.lon)*100)/100;t+=`&pt=${a},${r}`}return e.radius&&t!==""&&e.radius!=="any"&&(t+=`&distanceFilter=${e.radius}`),t}getRelatedSearches(e,t,a,r){const i=new Headers;i.append("Accept","application/json"),i.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:i,credentials:"same-origin"}).then(n=>n.json()).then(n=>{r(n)})}cacheFacets(e,t){return new Promise(a=>{var r,i;if(this.resolveFn=a,e==="or"||e==="showUnavailable"){const n=this.dataLayer.searchObject.facets.filter(o=>o.type==="tabs"||o.type==="and");if(this.cachedQueryOR===this.dataLayer.searchObject.query&&((r=this.dataLayer.searchObject.facets)==null?void 0:r.length)>0&&n.length===0){this.resolveFn();return}else this.cachedORFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(o=>o.type==="or")),this.cachedQueryOR=this.dataLayer.searchObject.query,this.cacheFacetsCallback(void 0,e)}else if(e==="tabs")if(this.cachedTabsFacets&&this.cachedQueryTabs===this.dataLayer.searchObject.query&&((i=this.dataLayer.searchObject.facets)==null?void 0:i.length)>0){this.resolveFn();return}else this.cachedTabsFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(n=>n.type==="tabs")),this.cachedQueryTabs=this.dataLayer.searchObject.query,this.cacheFacetsCallback(void 0,e);else e?this.resolveFn():(this.cachedANDFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(n=>n.type==="and")),this.cachedORFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(n=>n.type==="or"||n.type==="showUnavailable")),this.cachedTabsFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(n=>n.type==="tabs")),this.cachedQueryOR=this.dataLayer.searchObject.query,this.cachedQueryTabs=this.dataLayer.searchObject.query,t!=null&&t.includes("tabs")&&this.search({query:this.cachedQueryTabs,itemsPerPage:void 0,page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps,location:this.dataLayer.searchObject.location,model:this.dataLayer.model},this.cacheFacetsCallback.bind(this),!0,!1,"tabs"),(t!=null&&t.includes("or")||t!=null&&t.includes("showUnavailable"))&&this.search({query:this.cachedQueryTabs,itemsPerPage:void 0,page:1,order:"",facets:[...this.dataLayer.searchObject.facets.filter(n=>n.type==="and"||n.type==="tabs")],additionalProps:this.dataLayer.searchObject.additionalProps,location:this.dataLayer.searchObject.location,model:this.dataLayer.model},this.cacheFacetsCallback.bind(this),!0,!1,"or"),this.resolveFn())})}cacheFacetsCallback(e,t){let a=this.dataLayer.searchFacets??[];e&&(a=Et.extractFacets(e)),t==="or"?this.dataLayer.setSearchFacetsCachedor(a):t==="tabs"?this.dataLayer.setSearchFacetsCachedtabs(a):this.dataLayer.setSearchFacetsCached(a),this.resolveFn&&this.resolveFn()}search(e,t,a=!1,r=!1,i){if(e.query&&e.query!=="undefined"){this.dataLayer.setSearchTerm(e.query),this.dataLayer.setLoading(!0),this.controllerSearch&&this.controllerSearch.abort(),this.controllerSearch=new AbortController,this.signalSearch=this.controllerSearch.signal;const n=this.url+this.generateQueryParams(e,r),o={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete o.signal,fetch(n,o).then(c=>c.json()).then(c=>{this.dataLayer.setLoading(!1),t(c,i)}).catch(()=>{this.dataLayer.setLoading(!1)})}}generateQueryParams(e,t){let a=(e.itemsPerPage?e.itemsPerPage:0)*(e.page-1),r=e.order?`&sort=${e.order}`:"";const i=e.itemsPerPage!==void 0?`&rows=${e.itemsPerPage}`:"",n=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(h,g)=>h.get(g)??""}),o=n.languageVariant?"&fq=_language:"+n.languageVariant:"",c=e.model??this.dataLayer.model;return"?q="+encodeURIComponent(e.query.trim())+"&start="+a+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(h=>h.type==="or"||h.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(h=>h.type==="and"||h.type==="tabs"),!1)+r+i+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(c?`&model=${c}`:"")+"&language="+this.dataLayer.language+o}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const a=this.dataLayer;a.setAnswerLoading(!1),a.setAnswerErrorMessage(""),a.setAnswerError(!1);const r=new Xt(this.dataLayer.questionURL+this.generateQueryParams(this.dataLayer.searchObject),{fetch:(i,n)=>fetch(i,{...n,headers:{...n==null?void 0:n.headers,Authorization:this._authToken}})});return r.onmessage=i=>{if(i.data===ht.question||i.data===ht.notQuestion){i.data===ht.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(a.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),a.setAnswerData("");return}if(i.data===ht.close){Ce.trackAnswerData({...a.parsedData.trackingData,answer:a.$answer.getValue(),isQuestion:this.dataLayer.isQuestion,hasShowMore:this.dataLayer.parsedData.shouldShowAnswerLoadMore}),a.setAnswerLoading(!1),r.close();return}if(i.data.indexOf("[!CAUTION]")!==-1){a.setAnswerError(!0),a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),r.close();return}if(i.data.indexOf("[comment]: <> ({")!==-1)try{const n=i.data.split("[comment]: <> ({");if(n.length<2){t(i.data);return}const o=n[1].split("})");if(o.length<2){t(i.data);return}const c=o[0],h=JSON.parse("{"+c+"}");this.dataLayer.answerWidgetShowMoreLimit=h.displayShowMoreAfter,h.showMoreEnabled||(this.dataLayer.answerWidgetShowMoreLimit=1e17);const g=o.slice(1).join("})");t(g)}catch{t(i.data)}else t(i.data)},r.addEventListener("error",i=>{(i.code===401||i.code===500)&&(a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),a.setAnswerError(!0))}),r.onerror=()=>{a.setAnswerLoading(!1),r.close()},r}suggest(e,t,a){if(this.controllerSuggest&&this.controllerSuggest.abort(),this.suggester.trim()==="")return;this.controllerSuggest=new AbortController,this.signalSuggest=this.controllerSuggest.signal;const r=this.suggester+"?q="+e.trim()+this.toQueryString(a)+"&language="+this.dataLayer.language;fetch(r,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSuggest}).then(i=>i.json()).then(i=>{t(i)}).catch(()=>()=>{})}fields(){return this.fields}toQueryString(e){if(e.length===0)return"";const t=[];for(const a of e)t.push(encodeURIComponent(a.key)+"="+encodeURIComponent(a.value));return"&"+t.join("&")}}var gn=Object.prototype.toString,dt=Array.isArray||function(s){return gn.call(s)==="[object Array]"};function Ua(s){return typeof s=="function"}function pn(s){return dt(s)?"array":typeof s}function Aa(s){return s.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function sr(s,e){return s!=null&&typeof s=="object"&&e in s}function mn(s,e){return s!=null&&typeof s!="object"&&s.hasOwnProperty&&s.hasOwnProperty(e)}var fn=RegExp.prototype.test;function Ln(s,e){return fn.call(s,e)}var yn=/\S/;function xn(s){return!Ln(yn,s)}var wn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function bn(s){return String(s).replace(/[&<>"'`=\/]/g,function(e){return wn[e]})}var Cn=/\s*/,Mn=/\s+/,rr=/\s*=/,Sn=/\s*\}/,kn=/#|\^|\/|>|\{|&|=|!/;function Tn(s,e){if(!s)return[];var t=!1,a=[],r=[],i=[],n=!1,o=!1,c="",h=0;function g(){if(n&&!o)for(;i.length;)delete r[i.pop()];else i=[];n=!1,o=!1}var m,p,w;function S(E){if(typeof E=="string"&&(E=E.split(Mn,2)),!dt(E)||E.length!==2)throw new Error("Invalid tags: "+E);m=new RegExp(Aa(E[0])+"\\s*"),p=new RegExp("\\s*"+Aa(E[1])),w=new RegExp("\\s*"+Aa("}"+E[1]))}S(e||W.tags);for(var L=new Ot(s),T,A,O,P,I,y;!L.eos();){if(T=L.pos,O=L.scanUntil(m),O)for(var b=0,M=O.length;b<M;++b)P=O.charAt(b),xn(P)?(i.push(r.length),c+=P):(o=!0,t=!0,c+=" "),r.push(["text",P,T,T+1]),T+=1,P===`
|
|
89
|
+
`&&(g(),c="",h=0,t=!1);if(!L.scan(m))break;if(n=!0,A=L.scan(kn)||"name",L.scan(Cn),A==="="?(O=L.scanUntil(rr),L.scan(rr),L.scanUntil(p)):A==="{"?(O=L.scanUntil(w),L.scan(Sn),L.scanUntil(p),A="&"):O=L.scanUntil(p),!L.scan(p))throw new Error("Unclosed tag at "+L.pos);if(A==">"?I=[A,O,T,L.pos,c,h,t]:I=[A,O,T,L.pos],h++,r.push(I),A==="#"||A==="^")a.push(I);else if(A==="/"){if(y=a.pop(),!y)throw new Error('Unopened section "'+O+'" at '+T);if(y[1]!==O)throw new Error('Unclosed section "'+y[1]+'" at '+T)}else A==="name"||A==="{"||A==="&"?o=!0:A==="="&&S(O)}if(g(),y=a.pop(),y)throw new Error('Unclosed section "'+y[1]+'" at '+L.pos);return jn(vn(r))}function vn(s){for(var e=[],t,a,r=0,i=s.length;r<i;++r)t=s[r],t&&(t[0]==="text"&&a&&a[0]==="text"?(a[1]+=t[1],a[3]=t[3]):(e.push(t),a=t));return e}function jn(s){for(var e=[],t=e,a=[],r,i,n=0,o=s.length;n<o;++n)switch(r=s[n],r[0]){case"#":case"^":t.push(r),a.push(r),t=r[4]=[];break;case"/":i=a.pop(),i[5]=r[2],t=a.length>0?a[a.length-1][4]:e;break;default:t.push(r)}return e}function Ot(s){this.string=s,this.tail=s,this.pos=0}Ot.prototype.eos=function(){return this.tail===""},Ot.prototype.scan=function(s){var e=this.tail.match(s);if(!e||e.index!==0)return"";var t=e[0];return this.tail=this.tail.substring(t.length),this.pos+=t.length,t},Ot.prototype.scanUntil=function(s){var e=this.tail.search(s),t;switch(e){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,e),this.tail=this.tail.substring(e)}return this.pos+=t.length,t};function pt(s,e){this.view=s,this.cache={".":this.view},this.parent=e}pt.prototype.push=function(s){return new pt(s,this)},pt.prototype.lookup=function(s){var e=this.cache,t;if(e.hasOwnProperty(s))t=e[s];else{for(var a=this,r,i,n,o=!1;a;){if(s.indexOf(".")>0)for(r=a.view,i=s.split("."),n=0;r!=null&&n<i.length;)n===i.length-1&&(o=sr(r,i[n])||mn(r,i[n])),r=r[i[n++]];else r=a.view[s],o=sr(a.view,s);if(o){t=r;break}a=a.parent}e[s]=t}return Ua(t)&&(t=t.call(this.view)),t};function Le(){this.templateCache={_cache:{},set:function(s,e){this._cache[s]=e},get:function(s){return this._cache[s]},clear:function(){this._cache={}}}}Le.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},Le.prototype.parse=function(s,e){var t=this.templateCache,a=s+":"+(e||W.tags).join(":"),r=typeof t<"u",i=r?t.get(a):void 0;return i==null&&(i=Tn(s,e),r&&t.set(a,i)),i},Le.prototype.render=function(s,e,t,a){var r=this.getConfigTags(a),i=this.parse(s,r),n=e instanceof pt?e:new pt(e,void 0);return this.renderTokens(i,n,t,s,a)},Le.prototype.renderTokens=function(s,e,t,a,r){for(var i="",n,o,c,h=0,g=s.length;h<g;++h)c=void 0,n=s[h],o=n[0],o==="#"?c=this.renderSection(n,e,t,a,r):o==="^"?c=this.renderInverted(n,e,t,a,r):o===">"?c=this.renderPartial(n,e,t,r):o==="&"?c=this.unescapedValue(n,e):o==="name"?c=this.escapedValue(n,e,r):o==="text"&&(c=this.rawValue(n)),c!==void 0&&(i+=c);return i},Le.prototype.renderSection=function(s,e,t,a,r){var i=this,n="",o=e.lookup(s[1]);function c(m){return i.render(m,e,t,r)}if(o){if(dt(o))for(var h=0,g=o.length;h<g;++h)n+=this.renderTokens(s[4],e.push(o[h]),t,a,r);else if(typeof o=="object"||typeof o=="string"||typeof o=="number")n+=this.renderTokens(s[4],e.push(o),t,a,r);else if(Ua(o)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");o=o.call(e.view,a.slice(s[3],s[5]),c),o!=null&&(n+=o)}else n+=this.renderTokens(s[4],e,t,a,r);return n}},Le.prototype.renderInverted=function(s,e,t,a,r){var i=e.lookup(s[1]);if(!i||dt(i)&&i.length===0)return this.renderTokens(s[4],e,t,a,r)},Le.prototype.indentPartial=function(s,e,t){for(var a=e.replace(/[^ \t]/g,""),r=s.split(`
|
|
90
|
+
`),i=0;i<r.length;i++)r[i].length&&(i>0||!t)&&(r[i]=a+r[i]);return r.join(`
|
|
91
|
+
`)},Le.prototype.renderPartial=function(s,e,t,a){if(t){var r=this.getConfigTags(a),i=Ua(t)?t(s[1]):t[s[1]];if(i!=null){var n=s[6],o=s[5],c=s[4],h=i;o==0&&c&&(h=this.indentPartial(i,c,n));var g=this.parse(h,r);return this.renderTokens(g,e,t,h,a)}}},Le.prototype.unescapedValue=function(s,e){var t=e.lookup(s[1]);if(t!=null)return t},Le.prototype.escapedValue=function(s,e,t){var a=this.getConfigEscape(t)||W.escape,r=e.lookup(s[1]);if(r!=null)return typeof r=="number"&&a===W.escape?String(r):a(r)},Le.prototype.rawValue=function(s){return s[1]},Le.prototype.getConfigTags=function(s){return dt(s)?s:s&&typeof s=="object"?s.tags:void 0},Le.prototype.getConfigEscape=function(s){if(s&&typeof s=="object"&&!dt(s))return s.escape};var W={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(s){Pt.templateCache=s},get templateCache(){return Pt.templateCache}},Pt=new Le;W.clearCache=function(){return Pt.clearCache()},W.parse=function(s,e){return Pt.parse(s,e)},W.render=function(s,e,t,a){if(typeof s!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+pn(s)+'" was given as the first argument for mustache#render(template, view, partials)');return Pt.render(s,e,t,a)},W.escape=bn,W.Scanner=Ot,W.Context=pt,W.Writer=Le;const En={main:{template:`
|
|
91
92
|
{{#shouldShowAnswer}}
|
|
92
93
|
<div class="searchstax-answer-wrap">
|
|
93
94
|
<div class="searchstax-answer-icon"></div>
|
|
@@ -124,7 +125,7 @@ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
|
|
|
124
125
|
</div>
|
|
125
126
|
</div>
|
|
126
127
|
{{/shouldShowAnswer}}
|
|
127
|
-
`}},
|
|
128
|
+
`}},An={mainTemplate:{template:`
|
|
128
129
|
{{#hasExternalPromotions}}
|
|
129
130
|
<div class="searchstax-external-promotions-container" id="searchstax-external-promotions-container" data-test-id="searchstax-external-promotions-container">
|
|
130
131
|
External promotions go here
|
|
@@ -150,7 +151,7 @@ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
|
|
|
150
151
|
</p>
|
|
151
152
|
{{/url}}
|
|
152
153
|
</div>
|
|
153
|
-
`}},
|
|
154
|
+
`}},In={mainTemplateDesktop:{template:`
|
|
154
155
|
{{#hasResultsOrExternalPromotions}}
|
|
155
156
|
<div class="searchstax-facets-container-desktop"></div>
|
|
156
157
|
{{/hasResultsOrExternalPromotions}}
|
|
@@ -208,7 +209,7 @@ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
|
|
|
208
209
|
<div class="searchstax-facets-pill-label">{{value}} ({{count}})</div>
|
|
209
210
|
<div class="searchstax-facets-pill-icon-close"></div>
|
|
210
211
|
</div>
|
|
211
|
-
`,containerClass:"searchstax-facets-pill-facets"}},
|
|
212
|
+
`,containerClass:"searchstax-facets-pill-facets"}},Nn={mainTemplate:{template:`
|
|
212
213
|
{{#results.length}}
|
|
213
214
|
<div class="searchstax-pagination-container" data-test-id="searchstax-pagination-container">
|
|
214
215
|
<div class="searchstax-pagination-content">
|
|
@@ -226,7 +227,7 @@ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
|
|
|
226
227
|
<a class="searchstax-pagination-load-more" data-test-id="searchstax-pagination-load-more" tabindex="0">Show More</a>
|
|
227
228
|
{{/isLastPage}}
|
|
228
229
|
{{/results.length}}
|
|
229
|
-
`,loadMoreButtonClass:"searchstax-pagination-load-more"}},
|
|
230
|
+
`,loadMoreButtonClass:"searchstax-pagination-load-more"}},Rn={main:{template:`
|
|
230
231
|
{{#hasRelatedSearches}}
|
|
231
232
|
<div class="searchstax-related-searches-container" data-test-id="searchstax-related-searches-container" id="searchstax-related-searches-container">
|
|
232
233
|
Related searches: <span id="searchstax-related-searches"></span>
|
|
@@ -241,7 +242,7 @@ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
|
|
|
241
242
|
<span role="link" class="searchstax-related-search searchstax-related-search-item" data-test-id="searchstax-related-search-item" aria-label="Related search: {{related_search}}" tabindex="0">
|
|
242
243
|
{{ related_search }}{{^last}}<span>,</span>{{/last}}
|
|
243
244
|
</span>
|
|
244
|
-
`,relatedSearchContainerClass:"searchstax-related-search-item"}},
|
|
245
|
+
`,relatedSearchContainerClass:"searchstax-related-search-item"}},Dn={main:{template:`
|
|
245
246
|
{{#searchExecuted}}
|
|
246
247
|
<a href="#searchstax-search-results" data-test-id="searchstax-skip" class="searchstax-skip">Skip to results section</a>
|
|
247
248
|
<h4 class="searchstax-feedback-container" data-test-id="searchstax-feedback-container">
|
|
@@ -255,17 +256,19 @@ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
|
|
|
255
256
|
{{/hasResults}}
|
|
256
257
|
</h4>
|
|
257
258
|
{{/searchExecuted}}
|
|
258
|
-
`,originalQueryClass:"searchstax-feedback-original-query"}},
|
|
259
|
+
`,originalQueryClass:"searchstax-feedback-original-query"}},On={mainTemplate:{template:`
|
|
259
260
|
<div class="searchstax-search-input-container searchstax-search-input-container-new {{#locationEnabled}}searchstax-alternative-render{{/locationEnabled}}">
|
|
260
261
|
<div class="searchstax-search-input-wrapper">
|
|
261
262
|
<input type="text" id="searchstax-search-input" class="searchstax-search-input" placeholder="SEARCH FOR..." aria-label="Search" />
|
|
263
|
+
<button id="searchstax-clear-input-action-button" class="searchstax-cross-icon hidden" aria-label="clear input" role="button"></button>
|
|
264
|
+
<span id="searchstax-separator-icon" class="searchstax-separator hidden"></span>
|
|
262
265
|
</div>
|
|
263
266
|
<div id="searchstax-location-container" class="searchstax-location-container"></div>
|
|
264
267
|
<button class="searchstax-spinner-icon" id="searchstax-search-input-action-button" aria-label="search" role="button"></button>
|
|
265
268
|
</div>
|
|
266
269
|
`,searchInputId:"searchstax-search-input"},autosuggestItemTemplate:{template:`
|
|
267
270
|
<div class="searchstax-autosuggest-item-term-container">{{{term}}}</div>
|
|
268
|
-
`}},
|
|
271
|
+
`}},Pn={mainTemplate:{template:`
|
|
269
272
|
<div class="searchstax-location-input-container" data-test-id="searchstax-location-input-container">
|
|
270
273
|
<div class="searchstax-location-input-wrapper">
|
|
271
274
|
<span class="searchstax-location-input-label">NEAR</span>
|
|
@@ -283,7 +286,7 @@ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
|
|
|
283
286
|
{{/shouldShowLocationDistanceDropdown}}
|
|
284
287
|
</div>
|
|
285
288
|
</div>
|
|
286
|
-
`,locationInputId:"searchstax-location-input",radiusInputId:"searchstax-location-radius-select",currentLocationActionButtonId:"searchstax-location-get-current-location"}},
|
|
289
|
+
`,locationInputId:"searchstax-location-input",radiusInputId:"searchstax-location-radius-select",currentLocationActionButtonId:"searchstax-location-get-current-location"}},Fn={mainTemplate:{template:`
|
|
287
290
|
<section aria-label="search results container" tabindex="0">
|
|
288
291
|
<div class="searchstax-search-results-container" id="searchstax-search-results-container" data-test-id="searchstax-search-results-container">
|
|
289
292
|
<div class="searchstax-search-results" id="searchstax-search-results"></div>
|
|
@@ -355,7 +358,7 @@ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
|
|
|
355
358
|
</ul>
|
|
356
359
|
</div>
|
|
357
360
|
{{/searchExecuted}}
|
|
358
|
-
`}}
|
|
361
|
+
`}},$n={main:{template:`
|
|
359
362
|
{{#searchExecuted}}
|
|
360
363
|
{{#hasResultsOrExternalPromotions}}
|
|
361
364
|
{{#sortOptions.length}}
|
|
@@ -372,7 +375,7 @@ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
|
|
|
372
375
|
{{/sortOptions.length}}
|
|
373
376
|
{{/hasResultsOrExternalPromotions}}
|
|
374
377
|
{{/searchExecuted}}
|
|
375
|
-
`,selectId:"searchstax-search-order-select"}},
|
|
378
|
+
`,selectId:"searchstax-search-order-select"}},re={mainTemplate:{template:`
|
|
376
379
|
<div class="sf-widget-container">
|
|
377
380
|
<div id="sf-widget" class="sf-main">
|
|
378
381
|
<a role="button" href="#" id="searchstax-open-feedback" class="sf-open-feedback" tabindex="0" aria-label="Open Search Feedback">[ - ] Search Feedback</a>
|
|
@@ -455,4 +458,4 @@ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
|
|
|
455
458
|
|
|
456
459
|
</div>
|
|
457
460
|
</div>
|
|
458
|
-
`,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class A{}h(A,"answer",qn),h(A,"externalPromotions",Un),h(A,"facets",Yn),h(A,"pagination",Jn),h(A,"relatedSearches",Gn),h(A,"searchFeedback",Kn),h(A,"searchInput",Zn),h(A,"location",Xn),h(A,"searchResults",ei),h(A,"sorting",ti),h(A,"feedback",X);class ai{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"externalPromotionsContainerId");h(this,"searchExternalPromotionsMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.externalPromotionsContainerId=((a=(t=this.config.templates)==null?void 0:t.mainTemplate)==null?void 0:a.externalPromotionsContainerId)||A.externalPromotions.mainTemplate.externalPromotionsContainerId,typeof document<"u"&&(this.searchExternalPromotionsMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}initializeSubscriptions(){this.dataLayer.$searchExternalPromotions.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data,externalPromotions:this.dataLayer.parsedData.externalPromotions};return this.dataLayer.setExternalPromotionsData(e),e}addExternalSearch(e){var a,s,n,o;const t=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;if(t){const i=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.externalPromotion)==null?void 0:n.template)||((o=A.externalPromotions.externalPromotion)==null?void 0:o.template);if(typeof document<"u"){const c=document==null?void 0:document.createElement("div");c.classList.add("searchstax-external-promotion"),c.addEventListener("click",l=>{this.trackClick(e,l)}),c.innerHTML=z.render(i,e),t.appendChild(c)}}}trackClick(e,t){t.stopPropagation(),t.preventDefault(),window==null||window.open(e.url,"_blank")}renderMainTemplate(e){var a,s,n,o;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplate)==null?void 0:n.template)||((o=A.externalPromotions.mainTemplate)==null?void 0:o.template);if(this.dataLayer.renderingEngine===K.mustache){this.searchExternalPromotionsMainContainer.innerHTML=z.render(t,e);const i=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;i&&(i.innerHTML="");for(const c of e.externalPromotions)this.addExternalSearch(c)}}}class se{static addAccessibilityNotificationContainerToBody(){if(!document.getElementById("searchAccessibilityContainer")){const e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("id","searchAccessibilityContainer"),document.body.appendChild(e)}}static setAccessibilityText(e,t,a){this.addAccessibilityNotificationContainerToBody();const s=a??"searchAccessibility",n=document.getElementById(s);n&&n.remove();const o=document.createElement("span");o.setAttribute("id",s),o.innerHTML=e;const i=document.getElementById("searchAccessibilityContainer");i&&setTimeout(()=>{i.appendChild(o)},t??100)}}class si{constructor(e,t){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"routerHelper");h(this,"cachedPhrase","");h(this,"cachedANDFacets","");h(this,"isCached",!1);h(this,"overlayOpened",!1);h(this,"facetPaginationStep");h(this,"facetPaginationStepMobile");h(this,"searchFacetsMainContainer",null);h(this,"searchFacetsMobileContainer",null);h(this,"searchFacetsDesktopContainer",null);h(this,"facetLimits",{});h(this,"facetLimitsMobile",{});h(this,"deactivatedFacets",{});h(this,"focusedElement",null);h(this,"cachedData",null);h(this,"cacheFacets");h(this,"onFacetSelect",(e,t,a,s,n)=>{if(e.stopPropagation(),!t.disabled){const o=a.querySelector("input");let i=s?o.checked:!o.checked;n!==void 0&&(i=!n),o.checked=i;const c=this.dataLayer.searchObject;let l=[...c.facets];const g=this.extractFacetValue(t);i?l.find(m=>Le.deepEqual(m,g)?m:!1)||(this.config.facetingType==="tabs"&&(l=l.filter(m=>m.name!==g.name)),l.push(g)):l=l.filter(m=>!Le.deepEqual(m,g)),setTimeout(()=>{this.dataLayer.setSearchObject({...c,facets:l,page:1}),this.config.facetingType==="tabs"&&this.renderMainTemplate(this.generateTemplateData(),!0)},0)}});this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.cacheFacets=t,this.facetPaginationStep=this.config.itemsPerPageDesktop,this.facetPaginationStepMobile=this.config.itemsPerPageMobile,typeof document<"u"&&(this.searchFacetsMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.needCache&&t(this.config.facetingType==="tabs"),this.initializeSubscriptions()}get needCache(){return this.config.facetingType==="showUnavailable"||this.config.facetingType==="or"||this.config.facetingType==="tabs"}get needDisabling(){return this.config.facetingType==="showUnavailable"}initializeSubscriptions(){this.needCache&&(this.dataLayer.$searchFacetsCached.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$searchFacetsCachedTabs.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())})),this.dataLayer.$searchResults.subscribe(e=>{e&&(this.needCache&&!this.isCached&&(this.dataLayer.searchFacets&&!this.dataLayer.searchFacetsCached&&this.dataLayer.setSearchFacetsCached(this.dataLayer.searchFacets),this.cacheFacets(this.config.facetingType==="tabs")),this.renderMainTemplate(this.generateTemplateData()))}),this.dataLayer.$searchObject.subscribe(e=>{this.cachedPhrase!==e.query||this.cachedANDFacets!==this.dataLayer.parsedData.cachedANDFacets?(this.cachedANDFacets=this.dataLayer.parsedData.cachedANDFacets,this.cachedPhrase=e.query,this.isCached=!1):this.isCached=!0})}extractFacetValue(e){return{type:this.config.facetingType,name:e.parentName,value:e.value}}applyFacetLimits(e,t){const a=t?this.facetPaginationStepMobile:this.facetPaginationStep,s=t?this.facetLimits:this.facetLimitsMobile;return e.forEach(n=>{s[n.name]||(s[n.name]=a)}),e.map(n=>({...n,values:n.values.slice(0,s[n.name]),showingAllFacets:n.values.length<=s[n.name],hasMoreFacets:n.values.length>a}))}generateTemplateData(e){var t;if(this.generateSelectedFacetsData(),this.dataLayer.searchFacets){let a=this.dataLayer.searchFacets;(t=this.config.hooks)!=null&&t.beforeFacetsRender&&(a=this.config.hooks.beforeFacetsRender(a)),this.needCache&&this.dataLayer.searchFacetsCached&&(a=this.dataLayer.searchFacetsCached,this.config.facetingType==="tabs"&&this.dataLayer.searchFacetsCachedTabs&&(a=this.dataLayer.searchFacetsCachedTabs),this.needDisabling&&(a=a.map(n=>{var i;const o=(i=this.dataLayer.searchFacets)==null?void 0:i.find(c=>c.name===n.name);return o?{...n,values:n.values.map(c=>{const l=o.values.find(g=>c.type==="range"?!1:c.type==="checkbox"?g.value===c.value:!1);return{...c,disabled:!l,isMobile:e}})}:{...n,values:n.values.map(c=>({...c,disabled:!0})),isMobile:e}}))),this.config.specificFacets&&(a=a.filter(n=>{var o;return(o=this.config.specificFacets)==null?void 0:o.includes(n.name)}));const s={facets:this.applyFacetLimits(a,e),...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(s),s}else{const a={facets:[],...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(a),a}}createFacetItem(e,t,a){var s,n,o,i,c,l,g,m,p,w,b,L,T,y,x,v;if(typeof document<"u"){const k=document==null?void 0:document.createElement("div");k.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||k.classList.add("active");const j=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemContainerTemplate)==null?void 0:o.template)||((i=A.facets.facetItemContainerTemplate)==null?void 0:i.template);k.innerHTML=z.render(j,e),t.appendChild(k);const F=k.querySelector("."+(((g=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.facetItemContainerTemplate)==null?void 0:g.facetListTitleContainerClass)||((m=A.facets.facetItemContainerTemplate)==null?void 0:m.facetListTitleContainerClass)));F==null||F.addEventListener("click",()=>{k.classList.toggle("active");const O=k.classList.contains("active"),B=F.querySelector(".searchstax-facet-title");B&&B.setAttribute("aria-expanded",String(O))}),(L=F==null?void 0:F.querySelector("."+((b=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.facetItemContainerTemplate)==null?void 0:b.facetListTitleContainerInner)))==null||L.addEventListener("keydown",O=>{if(O.code==="Enter"||O.code==="Space"){O.preventDefault(),k.classList.toggle("active");const B=k.classList.contains("active"),Z=F.querySelector(".searchstax-facet-title");Z&&Z.setAttribute("aria-expanded",String(B))}});const E=k.querySelector("."+(((x=(y=(T=this.config)==null?void 0:T.templates)==null?void 0:y.facetItemContainerTemplate)==null?void 0:x.facetListContainerClass)||((v=A.facets.facetItemContainerTemplate)==null?void 0:v.facetListContainerClass)));E&&(e.values.forEach(O=>{this.createFacetListItem(O,E,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,E,a))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(a=>Le.deepEqual(a,this.extractFacetValue(e))))}createFacetListItem(e,t,a){var s,n,o,i,c,l,g,m,p,w,b,L;if(typeof document<"u"){const T=document==null?void 0:document.createElement("div");T.classList.add("searchstax-facet-value-container"),e.disabled&&T.classList.add("searchstax-facet-value-disabled");const y=this.isChecked(e),x=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemTemplate)==null?void 0:o.template)||((i=A.facets.facetItemTemplate)==null?void 0:i.template);T.innerHTML=z.render(x,{...e,isChecked:y});let v=(c=A.facets.facetItemTemplate)==null?void 0:c.checkTriggerClasses;v=((m=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.facetItemTemplate)==null?void 0:m.checkTriggerClasses)||v,v.forEach(j=>{var F;(F=T.querySelector("."+j))==null||F.addEventListener("click",E=>{this.onFacetSelect(E,e,T)})});const k=T.querySelector("."+(((b=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.facetItemTemplate)==null?void 0:b.inputCheckboxClass)||((L=A.facets.facetItemTemplate)==null?void 0:L.inputCheckboxClass)));k==null||k.addEventListener("click",j=>{this.onFacetSelect(j,e,T,!0)}),k&&(k==null||k.setAttribute("data-test-value",`${encodeURIComponent(a)}:"${encodeURIComponent(e.value)}"`)),t.appendChild(T)}}createHasMoreComponent(e,t,a){var s,n,o,i,c,l,g,m,p,w;if(typeof document<"u"){const b=document==null?void 0:document.createElement("div");b.classList.add("searchstax-facet-show-more-container");const L=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.showMoreButtonContainerTemplate)==null?void 0:o.template)||((i=A.facets.showMoreButtonContainerTemplate)==null?void 0:i.template);b.innerHTML=z.render(L,{...e,focusId:`moreLess${(l=(c=e==null?void 0:e.values)==null?void 0:c[0])==null?void 0:l.value}`});const T=b.querySelector("."+(((p=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.showMoreButtonContainerTemplate)==null?void 0:p.showMoreButtonClass)||((w=A.facets.showMoreButtonContainerTemplate)==null?void 0:w.showMoreButtonClass)));T&&(this.attachOnclickToShowMore(e,T,a),t&&t.appendChild(T))}}attachOnclickToShowMore(e,t,a){t.addEventListener("click",s=>{this.onShowMoreLessClick(s,e,a)}),t.addEventListener("keydown",s=>{s.code==="Space"&&s.preventDefault()}),t.addEventListener("keyup",s=>{(s.code==="Space"||s.code==="Enter")&&(s.preventDefault(),this.onShowMoreLessClick(s,e,a))})}onShowMoreLessClick(e,t,a){e.preventDefault();const s=a?this.facetPaginationStepMobile:this.facetPaginationStep,n=a?this.facetLimits:this.facetLimitsMobile;n[t.name]===void 0?n[t.name]=s*2:n[t.name]<=t.values.length?(se.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),n[t.name]=n[t.name]+s):(se.setAccessibilityText(`Less Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),n[t.name]=s),this.generateTemplateData(a),this.renderMainTemplate(this.generateTemplateData())}renderMainTemplate(e,t){var a,s,n,o,i,c,l,g,m,p,w;if(e&&(!Le.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const b=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplateDesktop)==null?void 0:n.template)||((o=A.facets.mainTemplateDesktop)==null?void 0:o.template);if(this.dataLayer.renderingEngine===K.mustache&&this.searchFacetsMainContainer){const L=document.activeElement;L instanceof HTMLInputElement&&L.type==="checkbox"||L!=null&&L.classList.contains("searchstax-facet-show-more-button")||L!=null&&L.classList.contains("searchstax-facet-show-less-button")?this.focusedElement=L:this.focusedElement=null,this.searchFacetsMainContainer.innerHTML=z.render(b,{...e});const T=(g=this.searchFacetsMainContainer)==null?void 0:g.querySelector("."+(((l=(c=(i=this.config)==null?void 0:i.templates)==null?void 0:c.mainTemplateDesktop)==null?void 0:l.facetsContainerClass)||A.facets.mainTemplateDesktop.facetsContainerClass));if(T){T.innerHTML="";for(const y of e.facets)this.createFacetItem(y,T);if(this.searchFacetsMainContainer){const y=this.searchFacetsMainContainer.querySelector("."+(((w=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplateDesktop)==null?void 0:w.selectedFacetsContainerClass)||A.facets.mainTemplateDesktop.selectedFacetsContainerClass));y&&(this.createSelectedFacetsComponents(y),this.createClearFacetsComponents(y))}if(this.focusedElement){if(this.focusedElement.classList.contains("searchstax-facet-show-more-button")||this.focusedElement.classList.contains("searchstax-facet-show-less-button")){const v=this.focusedElement.getAttribute("data-focus"),k=this.searchFacetsMainContainer.querySelector(`[data-focus="${v}"]`);k instanceof HTMLElement&&k.focus(),this.focusedElement=null;return}const y=this.focusedElement.getAttribute("data-test-value"),x=this.searchFacetsMainContainer.querySelector(`[data-test-value="${y}"]`);x instanceof HTMLInputElement&&x.focus(),this.focusedElement=null}}}setTimeout(()=>{document.querySelectorAll(".searchstax-facet-title").forEach(L=>{L.setAttribute("aria-expanded",String(!0)),L.setAttribute("tabindex","0"),L.setAttribute("role","button")})},100),this.renderMobileTemplate(this.generateTemplateData(!0))}else this.generateSelectedFacetsData()}generateSelectedFacetsData(){var a;const e=[],t=this.dataLayer.searchObject.facets;for(const s of t){const n=decodeURIComponent(s.name),o=decodeURIComponent(s.value);if(this.dataLayer.searchFacets){const i=(a=this.needCache?this.dataLayer.searchFacetsCached:this.dataLayer.searchFacets)==null?void 0:a.find(c=>c.name===n);if(i){const c=i.values.find(l=>l.type==="range"?!1:l.type==="checkbox"?`"${l.value}"`==`"${o}"`:!1);c&&e.push(c)}}}this.dataLayer.setSelectedFacetsTemplateData(e)}createSelectedFacetsComponents(e){var t;this.generateSelectedFacetsData(),(t=this.dataLayer.selectedFacetsTemplateData)==null||t.forEach(a=>{this.createSelectedFacetsComponent(e,a)})}createClearFacetsComponents(e){var t,a,s,n,o,i,c,l;if(typeof document<"u"){const g=this.dataLayer.searchObject,m=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.clearFacetsTemplate)==null?void 0:s.template)||((n=A.facets.clearFacetsTemplate)==null?void 0:n.template),p=document==null?void 0:document.createElement("div");p.innerHTML=z.render(m,{shouldShow:g.facets.length>0});const w=p.querySelector("."+(((c=(i=(o=this.config)==null?void 0:o.templates)==null?void 0:i.clearFacetsTemplate)==null?void 0:c.containerClass)||((l=A.facets.clearFacetsTemplate)==null?void 0:l.containerClass)));w&&(w.addEventListener("click",()=>{this.removeSelectedFacets()}),w.addEventListener("keyup",b=>{(b.code==="Space"||b.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(w))}}createSelectedFacetsComponent(e,t){var a,s,n,o,i,c,l,g;if(typeof document<"u"){const m=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.selectedFacetsTemplate)==null?void 0:n.template)||((o=A.facets.selectedFacetsTemplate)==null?void 0:o.template),p=document==null?void 0:document.createElement("div");p.innerHTML=z.render(m,t);const w=p.querySelector("."+(((l=(c=(i=this.config)==null?void 0:i.templates)==null?void 0:c.selectedFacetsTemplate)==null?void 0:l.containerClass)||((g=A.facets.selectedFacetsTemplate)==null?void 0:g.containerClass)));w&&(w.addEventListener("click",()=>{this.unselectFacet(t)}),w.addEventListener("keyup",b=>{(b.code==="Space"||b.code==="Enter")&&this.unselectFacet(t)}),e.appendChild(w))}}unselectFacet(e){const t=this.dataLayer.searchObject;let a=[...t.facets];e.type==="checkbox"&&(a=a.filter(s=>JSON.stringify(s)!==JSON.stringify(this.extractFacetValue(e)))),setTimeout(()=>{this.dataLayer.setSearchObject({...t,facets:a}),this.generateSelectedFacetsData()},0)}removeSelectedFacets(){const e=this.dataLayer.searchObject;this.dataLayer.setSearchObject({...e,facets:[]})}createFilterByComponent(e){var t,a,s,n,o,i,c,l;if(typeof document<"u"){const g=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.filterByTemplate)==null?void 0:s.template)||((n=A.facets.filterByTemplate)==null?void 0:n.template),m=document==null?void 0:document.createElement("div");m.innerHTML=z.render(g,{});const p=m.querySelector("."+(((c=(i=(o=this.config)==null?void 0:o.templates)==null?void 0:i.filterByTemplate)==null?void 0:c.containerClass)||((l=A.facets.filterByTemplate)==null?void 0:l.containerClass)));p&&(e.prepend(p),p.addEventListener("click",this.openOverlay.bind(this)),p.addEventListener("keyup",w=>{(w.code==="Space"||w.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;se.setAccessibilityText("Facet overlay opened. Tab to select facets."),this.overlayOpened=!0,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.add("searchstax-show"))}closeOverlay(){var e;se.setAccessibilityText("Facet overlay closed"),this.overlayOpened=!1,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.remove("searchstax-show"))}renderMobileTemplate(e){var t,a,s,n,o,i,c,l,g,m,p,w,b,L,T,y,x,v,k;if(e&&typeof document<"u"){const j=document==null?void 0:document.createElement("div");j.classList.add("searchstax-facets-container-mobile");const F=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:s.template)||((n=A.facets.mainTemplateMobile)==null?void 0:n.template);if(this.dataLayer.renderingEngine===K.mustache){if(j.innerHTML=z.render(F,{...e,overlayOpened:this.overlayOpened}),(o=this.searchFacetsMainContainer)==null||o.appendChild(j),(c=(i=this.config)==null?void 0:i.templates)==null?void 0:c.mainTemplateMobile)for(const Z of((m=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.mainTemplateMobile)==null?void 0:m.closeOverlayTriggerClasses)||[]){const _=j.querySelector("."+Z);_&&(_.addEventListener("click",this.closeOverlay.bind(this)),_.addEventListener("keyup",ce=>{(ce.code==="Space"||ce.code==="Enter")&&this.closeOverlay()}))}else for(const Z of A.facets.mainTemplateMobile.closeOverlayTriggerClasses){const _=j.querySelector("."+Z);_&&(_.addEventListener("click",this.closeOverlay.bind(this)),_.addEventListener("keyup",ce=>{(ce.code==="Space"||ce.code==="Enter")&&this.closeOverlay()}))}const E=j.querySelector("."+(((b=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.mainTemplateMobile)==null?void 0:b.filterByContainerClass)||A.facets.mainTemplateMobile.filterByContainerClass));E&&this.createFilterByComponent(E);const O=j.querySelector("."+(((y=(T=(L=this.config)==null?void 0:L.templates)==null?void 0:T.mainTemplateMobile)==null?void 0:y.selectedFacetsContainerClass)||A.facets.mainTemplateMobile.selectedFacetsContainerClass));O&&(this.createSelectedFacetsComponents(O),this.createClearFacetsComponents(O));const B=j.querySelector("."+(((k=(v=(x=this.config)==null?void 0:x.templates)==null?void 0:v.mainTemplateMobile)==null?void 0:k.facetsContainerClass)||A.facets.mainTemplateMobile.facetsContainerClass));if(B){B.innerHTML="";for(const Z of e.facets)this.createFacetItem(Z,B,!0)}}}}}class ri{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"previousButtonClass");h(this,"nextButtonClass");h(this,"loadMoreButtonClass");h(this,"routerHelper");h(this,"searchPaginationMainContainer",null);var t,a,s,n,o,i,c,l,g;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.previousButtonClass=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:s.previousButtonClass)??A.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((i=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.mainTemplate)==null?void 0:i.nextButtonClass)??A.pagination.mainTemplate.nextButtonClass,this.loadMoreButtonClass=((g=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.infiniteScrollTemplate)==null?void 0:g.loadMoreButtonClass)??A.pagination.infiniteScrollTemplate.loadMoreButtonClass,typeof document<"u"&&(this.searchPaginationMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}get isFirstPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)===1}get isLastPage(){return this.dataLayer.parsedData.data.isLastPage}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){var t,a,s,n;const e={...this.dataLayer.parsedData.data,previousPageLink:(a=this.routerHelper)==null?void 0:a.searchObjectToUrl({...this.dataLayer.searchObject,page:((t=this.dataLayer.searchObject)==null?void 0:t.page)-1}),nextPageLink:(n=this.routerHelper)==null?void 0:n.searchObjectToUrl({...this.dataLayer.searchObject,page:((s=this.dataLayer.searchObject)==null?void 0:s.page)+1})};return this.dataLayer.setPaginationData(e),e}goToPage(e,t){const a=this.dataLayer.searchObject;a&&(a.page=e,this.dataLayer.setSearchObject(a));const s=document.querySelector(".searchstax-page-layout-result-container");if(s instanceof HTMLElement){const n=s.querySelector('[tabindex="0"]');n instanceof HTMLElement&&n.focus()}else document.body.tabIndex=-1,document.body.focus();t||(s instanceof HTMLElement?s.scrollIntoView({block:"start",behavior:"auto"}):window==null||window.scrollTo(0,0))}nextPage(e){var t;e==null||e.preventDefault(),e==null||e.stopPropagation(),this.isLastPage||this.goToPage(((t=this.dataLayer.searchObject)==null?void 0:t.page)+1,this.dataLayer.isInfiniteScroll)}previousPage(e){var t;e==null||e.preventDefault(),e==null||e.stopPropagation(),this.isFirstPage||this.goToPage(((t=this.dataLayer.searchObject)==null?void 0:t.page)-1)}overridePaginationEvents(){if(this.searchPaginationMainContainer){const e=this.searchPaginationMainContainer.querySelector("."+this.previousButtonClass),t=this.searchPaginationMainContainer.querySelector("."+this.nextButtonClass),a=this.searchPaginationMainContainer.querySelector("."+this.loadMoreButtonClass);e&&(e.addEventListener("click",this.previousPage.bind(this)),e.addEventListener("keydown",s=>{(s.code==="Space"||s.code==="Enter")&&this.previousPage(s)})),t&&(t.addEventListener("click",this.nextPage.bind(this)),t.addEventListener("keydown",s=>{(s.code==="Space"||s.code==="Enter")&&this.nextPage(s)})),a&&(a.addEventListener("click",this.nextPage.bind(this)),a.addEventListener("keydown",s=>{(s.code==="Space"||s.code==="Enter")&&this.nextPage(s)}))}}renderMainTemplate(e){var a,s,n,o,i,c,l,g,m,p;this.searchPaginationMainContainer&&((a=this.searchPaginationMainContainer.querySelector("."+this.previousButtonClass))==null||a.removeEventListener("click",this.previousPage),(s=this.searchPaginationMainContainer.querySelector("."+this.nextButtonClass))==null||s.removeEventListener("click",this.nextPage));let t=((i=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.mainTemplate)==null?void 0:i.template)||((c=A.pagination.mainTemplate)==null?void 0:c.template);this.dataLayer.isInfiniteScroll&&(t=((m=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.infiniteScrollTemplate)==null?void 0:m.template)||((p=A.pagination.infiniteScrollTemplate)==null?void 0:p.template)),this.dataLayer.renderingEngine===K.mustache&&(this.searchPaginationMainContainer.innerHTML=z.render(t,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class ni{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"relatedSearchesContainerClass");h(this,"searchRelatedSearchesMainContainer",null);h(this,"track");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.relatedSearchesContainerClass=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.relatedSearchesContainerClass)||A.relatedSearches.main.relatedSearchesContainerClass,typeof document<"u"&&(this.searchRelatedSearchesMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.track=e.trackRelatedSearchClick,this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchRelatedSearches.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setRelatedSearchesData(e),e}addRelatedSearchComponent(e,t){var a,s,n,o,i;if(typeof document<"u"){const c=document==null?void 0:document.createElement("div"),l=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.relatedSearch)==null?void 0:n.template)||A.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===K.mustache){c.innerHTML=z.render(l,e);const g=c.querySelector("."+(((i=(o=this.config.templates)==null?void 0:o.relatedSearch)==null?void 0:i.relatedSearchContainerClass)||A.relatedSearches.relatedSearch.relatedSearchContainerClass));g&&(t.appendChild(g),g.addEventListener("click",()=>{this.executeSearch(e)}),g.addEventListener("keyup",m=>{(m.code==="Space"||m.code==="Enter")&&this.executeSearch(e)}))}}}executeSearch(e){const t=this.dataLayer.searchObject;t.query=e.related_search,this.dataLayer.setSearchObject(t),this.track(e)}renderMainTemplate(e){var a,s,n,o;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:n.template)||A.relatedSearches.main.template;if(this.dataLayer.renderingEngine===K.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=z.render(t,e);const i=(o=this.searchRelatedSearchesMainContainer)==null?void 0:o.querySelector(`.${this.relatedSearchesContainerClass}`);if(i)for(const c of e.relatedSearches)this.addRelatedSearchComponent(c,i)}}}class ii{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"searchFeedbackMainContainer",null);h(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.searchTrigger=e.searchTrigger,typeof document<"u"&&(this.searchFeedbackMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchFeedbackData(e),e}onOriginalQueryClick(e){var a;e.stopPropagation(),e.preventDefault();const t=(a=e.target)==null?void 0:a.innerHTML;this.searchTrigger(t,!0)}attachClick(){var t,a,s,n,o;const e=(o=this.searchFeedbackMainContainer)==null?void 0:o.querySelector("."+(((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.main)==null?void 0:s.originalQueryClass)||((n=A.searchFeedback.main)==null?void 0:n.originalQueryClass)));e&&e.addEventListener("click",this.onOriginalQueryClick.bind(this))}renderMainTemplate(e){var a,s,n;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:n.template)||A.searchFeedback.main.template;this.dataLayer.renderingEngine===K.mustache&&(this.searchFeedbackMainContainer.innerHTML=z.render(t,e),setTimeout(()=>{this.attachClick()},0))}}class oi{constructor(e){h(this,"searchHelper");h(this,"dataLayer");h(this,"config");h(this,"suggestAfterMinChars");h(this,"containerId");h(this,"currentInputValue","");h(this,"autosuggestResults");h(this,"searchInput");h(this,"actionButton");h(this,"autosuggestContainer");h(this,"buttonState","search");h(this,"selectedAutosuggestItem",-1);h(this,"suggestTrigger");h(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.searchTrigger=e.searchTrigger,this.suggestTrigger=e.suggestTrigger,this.containerId=e.containerId,this.suggestAfterMinChars=e.config.suggestAfterMinChars,this.suggestAfterMinChars===void 0&&this.getSuggestAfterValue(),this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.renderMainTemplate(),this.actionButtonInit(),this.updateActionButtonState("search"),this.searchInput&&(this.createAutosuggestContainer(),this.attachSubscriptions())},200)}renderMainTemplate(){var e,t,a,s;if(typeof document<"u"){const n=document==null?void 0:document.getElementById(this.containerId);if(!n)throw new Error("Search input container not found");const o=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||A.searchInput.mainTemplate.template,i={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled};if(this.dataLayer.setInputWidgetTemplateData(i),this.dataLayer.renderingEngine===K.mustache){const g=z.render(o,i);n.innerHTML=g,this.dataLayer.setInputTemplateRendered(!0)}const c=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.searchInputId)||A.searchInput.mainTemplate.searchInputId,l=document==null?void 0:document.querySelector(`#${c}`);if(l)this.searchInput=l,l.addEventListener("keyup",this.inputKeyupEvent.bind(this)),l.addEventListener("blur",this.hideAutosuggest.bind(this)),l.addEventListener("paste",this.inputPasteEvent.bind(this));else throw new Error("Input not found")}}createAutosuggestContainer(){var e;this.dataLayer.renderingEngine===K.mustache&&typeof document<"u"&&(this.autosuggestContainer=document==null?void 0:document.createElement("div"),this.autosuggestContainer.classList.add("searchstax-autosuggest-container"),this.autosuggestContainer.addEventListener("mouseleave",()=>{this.resetAutosuggestSelection(),this.markActiveAutosuggestItem()}),(e=this.searchInput)==null||e.after(this.autosuggestContainer))}getSuggestAfterValue(){this.dataLayer.searchHelper&&this.dataLayer.searchHelper.suggest("*",e=>{this.suggestAfterMinChars=e.metadata.minPrefixChars},[])}actionButtonInit(){typeof document<"u"&&(this.actionButton=document==null?void 0:document.getElementById("searchstax-search-input-action-button"),this.actionButton&&this.actionButton.addEventListener("click",()=>{var e;this.executeSearch(((e=this.searchInput)==null?void 0:e.value)??"")}))}attachSubscriptions(){this.dataLayer.$searchTermChange.subscribe(()=>{this.handleSearchTermChange()}),this.dataLayer.$loadingChange.subscribe(()=>{this.handleLoadingChange()}),this.dataLayer.$searchAutosuggest.subscribe(e=>{e&&this.appendSuggestions(e)}),this.dataLayer.$searchObject.subscribe(e=>{e.query!=="undefined"&&e.query!==void 0&&e.query!=="*"&&this.searchInput&&(this.searchInput.value=this.cleanSuggestionTerm(e.query??""))})}handleLoadingChange(){this.dataLayer.loading?this.updateActionButtonState("loading"):this.handleSearchTermChange()}handleSearchTermChange(){this.updateActionButtonState("search")}updateActionButtonState(e){if(this.buttonState=e,this.actionButton)switch(this.actionButton.classList.remove("searchstax-spinner-icon"),this.actionButton.classList.remove("searchstax-search-icon"),e){case"loading":this.actionButton.classList.add("searchstax-spinner-icon");break;case"search":this.actionButton.classList.add("searchstax-search-icon"),this.actionButton.setAttribute("aria-label","search");break}}selectPreviousAutosuggestItem(e){var t;this.selectedAutosuggestItem>0?this.selectedAutosuggestItem--:this.selectedAutosuggestItem===0?(this.selectedAutosuggestItem=-1,e&&(e!=null&&e.focus)&&((t=e==null?void 0:e.focus)==null||t.call(e),e.setSelectionRange(e.value.length,e.value.length)),se.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=this.autosuggestResults.suggestions.length-1,this.markActiveAutosuggestItem()}selectNextAutosuggestItem(){this.selectedAutosuggestItem<this.autosuggestResults.suggestions.length-1?this.selectedAutosuggestItem++:this.selectedAutosuggestItem===this.autosuggestResults.suggestions.length-1?(this.selectedAutosuggestItem=-1,se.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=0,this.markActiveAutosuggestItem()}resetAutosuggestSelection(){this.selectedAutosuggestItem=-1,this.markActiveAutosuggestItem()}markActiveAutosuggestItem(){if(typeof document<"u"){const e=document==null?void 0:document.getElementsByClassName("searchstax-autosuggest-item");for(let t=0;t<e.length;t++){const a=e[t];t===this.selectedAutosuggestItem?(a.classList.add("active"),se.setAccessibilityText(`Selected suggestion: ${a.innerText}`)):a.classList.remove("active")}}}inputKeyupEvent(e){const t=e.key;this.currentInputValue=e.target.value,t==="Enter"?this.suggestionChosen():t==="Escape"?this.hideAutosuggest(e.target):t==="ArrowUp"?this.selectPreviousAutosuggestItem(e.target):t==="ArrowDown"?this.selectNextAutosuggestItem():this.autosuggestHandling(e),this.handleSearchTermChange()}autosuggestHandling(e){this.suggestAfterMinChars&&e.target&&e.target.value.length>=this.suggestAfterMinChars?this.executeSuggest(e.target.value):this.hideAutosuggest()}inputPasteEvent(e){setTimeout(()=>{this.autosuggestHandling(e),this.handleSearchTermChange()},0)}executeSuggest(e){this.suggestTrigger(e)}executeSearch(e){this.hideAutosuggest(),this.searchTrigger(e===""?"*":e)}suggestionChosen(){this.selectedAutosuggestItem>-1?this.autosuggestItemClicked(this.autosuggestResults.suggestions[this.selectedAutosuggestItem]):this.executeSearch(this.currentInputValue)}hideAutosuggest(e){setTimeout(()=>{var t;this.dataLayer.setAutosuggestResults({numFound:0,suggestions:[]}),this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.add("hidden")),this.resetAutosuggestSelection(),e&&(e!=null&&e.focus)&&((t=e==null?void 0:e.focus)==null||t.call(e),e.setSelectionRange(e.value.length,e.value.length)),se.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return ne.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}autosuggestItemClicked(e){this.searchInput.value=this.cleanSuggestionTerm(e.term??""),this.executeSearch(this.cleanSuggestionTerm(e.term))}createAutosuggestItem(e){var s,n,o;const t=document==null?void 0:document.createElement("div");t.classList.add("searchstax-autosuggest-item"),t.addEventListener("click",()=>{this.autosuggestItemClicked(e)}),t.addEventListener("mouseenter",()=>{this.onSuggestionEnter(e)});const a=((n=(s=this.config.templates)==null?void 0:s.autosuggestItemTemplate)==null?void 0:n.template)||((o=A.searchInput.autosuggestItemTemplate)==null?void 0:o.template);return t.innerHTML=z.render(a,e),t}onSuggestionEnter(e){var t;this.selectedAutosuggestItem=((t=this.autosuggestResults)==null?void 0:t.suggestions.indexOf(e))||0,this.markActiveAutosuggestItem()}appendSuggestions(e){this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.remove("hidden"));for(const t in e.suggest)if(Object.prototype.hasOwnProperty.call(e.suggest,t)){const a=e.suggest[t];for(const s in a)if(Object.prototype.hasOwnProperty.call(a,s)){const n=a[s];n.numFound?se.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):se.setAccessibilityText("",0),this.autosuggestResults=n,this.dataLayer.setAutosuggestResults(n),n.numFound>0?n.suggestions.forEach(o=>{this.autosuggestContainer&&typeof document<"u"&&this.autosuggestContainer.appendChild(this.createAutosuggestItem(o))}):this.autosuggestContainer&&this.autosuggestContainer.classList.add("hidden")}}}}class ci{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"linkClickCallback");h(this,"searchCallback");h(this,"containerId");h(this,"searchResultsMainContainer");h(this,"searchResultsContainer");h(this,"searchResultLinks",[]);this.linkClickCallback=e.linkClickCallback,this.searchCallback=e.searchTrigger,this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId;const t=document==null?void 0:document.getElementById(this.containerId);if(t)this.searchResultsMainContainer=t;else throw new Error(`Search Results Main Container with id ${this.containerId} not found`);this.dataLayer.setIsInfiniteScroll(e.config.renderMethod==="infiniteScroll"),this.initializeSubscriptions(),this.renderMainTemplate()}initializeSubscriptions(){this.dataLayer.$searchObject.subscribe(()=>{se.setAccessibilityText("Searching...")}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.searchResultsContainer&&this.renderResults(e)})}changeTemplate(){this.dataLayer.searchResults&&this.renderResults(this.dataLayer.searchResults)}renderNoResultsTemplate(){var a,s,n,o,i;const e=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.noSearchResultTemplate)==null?void 0:n.template)||((o=A.searchResults.noSearchResultTemplate)==null?void 0:o.template),t=((i=this.dataLayer.searchResultsMetadata)==null?void 0:i.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===K.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=z.render(e,{spellingSuggestion:t,...this.dataLayer.parsedData.data,searchCallback:this.searchCallback.bind(this)})),t&&this.searchResultsContainer){const c=this.searchResultsContainer.querySelector("a");c&&c.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),this.searchCallback(t)})}}renderResults(e){var t,a,s,n,o;if(this.dataLayer.renderingEngine===K.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)se.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{se.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const i=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:s.template)||((n=A.searchResults.searchResultTemplate)==null?void 0:n.template),c=e.map(l=>z.render(i,l));((o=this.config)==null?void 0:o.renderMethod)==="infiniteScroll"&&this.dataLayer.searchObject.page>1?this.searchResultsContainer.innerHTML+=c.join(""):this.searchResultsContainer.innerHTML=c.join(""),this.searchResultLinks=Array.from(this.searchResultsContainer.querySelectorAll(`[${this.uniqueIdAttribute}]`)),this.attachLinkClickEvents()}}removeLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.removeEventListener("click",()=>{}),e.removeEventListener("keydown",()=>{})})}get uniqueIdAttribute(){var e,t,a,s;return((a=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.searchResultTemplate)==null?void 0:a.searchResultUniqueIdAttribute)||((s=A.searchResults.searchResultTemplate)==null?void 0:s.searchResultUniqueIdAttribute)}attachLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const a=e.getAttribute(this.uniqueIdAttribute)??"";a&&this.linkClickCallback(a)}),e.addEventListener("keydown",t=>{if(t.code==="Space"||t.code==="Enter"){const a=e.getAttribute(this.uniqueIdAttribute)??"";a&&this.linkClickCallback(a)}})})}renderMainTemplate(){var t,a,s,n;const e=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:s.template)||((n=A.searchResults.mainTemplate)==null?void 0:n.template);this.dataLayer.renderingEngine===K.mustache&&(this.searchResultsMainContainer.innerHTML=z.render(e,{}),setTimeout(()=>{var c,l,g,m,p,w,b;const o=(g=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplate)!=null&&g.searchResultsContainerId?(w=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplate)==null?void 0:w.searchResultsContainerId:(b=A.searchResults.mainTemplate)==null?void 0:b.searchResultsContainerId,i=document==null?void 0:document.getElementById(o);if(i)this.searchResultsContainer=i;else throw new Error(`Search Results Container with id ${o} not found`)},0))}}class li{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"selectId");h(this,"searchSortingMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.selectId=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.selectId)||A.sorting.main.selectId,this.searchSortingMainContainer=document==null?void 0:document.getElementById(this.containerId),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchSortingData(e),e}setOrderQuery(e){const t=this.dataLayer.searchObject;t&&(t.order=e,this.dataLayer.setSearchObject(t))}markOptionSelected(){const e=document==null?void 0:document.getElementById(this.selectId);if(e){const t=e.querySelector(`option[value="${decodeURIComponent(this.dataLayer.searchObject.order)}"]`);t&&(t.selected=!0)}}renderMainTemplate(e){var a,s,n;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:n.template)||A.sorting.main.template;if(this.dataLayer.renderingEngine===K.mustache){this.searchSortingMainContainer.innerHTML=z.render(t,e),this.markOptionSelected();const o=document==null?void 0:document.getElementById(this.selectId);o&&o.addEventListener("change",i=>{this.setOrderQuery(i.target.value)})}}}class hi{constructor(e){h(this,"analyticsKey");h(this,"containerId");h(this,"mainContainer");h(this,"isLightweight");h(this,"emailOverride");h(this,"feedbackTextAreaOverride");h(this,"mainTemplateOverride");h(this,"lightweightTemplateOverride");h(this,"focusedElement",null);h(this,"focusTrapListener",null);h(this,"lastFocusedElementBeforeModal",null);h(this,"templateData",{feedbackOpen:!1,ratings:[{index:1,isSelected:!1},{index:2,isSelected:!1},{index:3,isSelected:!1},{index:4,isSelected:!1},{index:5,isSelected:!1},{index:6,isSelected:!1},{index:7,isSelected:!1},{index:8,isSelected:!1},{index:9,isSelected:!1},{index:10,isSelected:!1}],emailInput:"",feedbackTextArea:"",charactersLeft:2e3,maxLength:2e3,errors:{rating:!1,email:!1},submitted:!1,thumbsUpActive:!1,thumbsDownActive:!1});h(this,"thumbsUpValue",10);h(this,"thumbsDownValue",1);h(this,"ratedQuestion","");h(this,"language","");h(this,"model","");h(this,"analyticsSrc","");this.analyticsKey=e.analyticsKey,this.containerId=e.containerId??"sf-feedback",this.isLightweight=e.lightweight??!1,this.isLightweight&&this.templateData.ratings.unshift({index:0,isSelected:!1}),this.thumbsUpValue=e.thumbsUpValue??10,this.thumbsDownValue=e.thumbsDownValue??1,this.emailOverride=e.emailOverride,this.feedbackTextAreaOverride=e.feedbackTextAreaOverride,this.mainTemplateOverride=e.mainTemplateOverride,this.lightweightTemplateOverride=e.lightweightTemplateOverride,this.mainContainer=document.getElementById(this.containerId),this.language=e.language??"",this.model=e.model??"",this.analyticsSrc=e.analyticsSrc??"",this.init()}init(){xe.attachAnalyticsScript(this.analyticsSrc),this.renderMainTemplate(this.generateTemplateData())}generateTemplateData(){return this.templateData}renderMainTemplate(e){var s,n;const t=document.activeElement;(t instanceof HTMLInputElement||t instanceof HTMLButtonElement||t instanceof HTMLTextAreaElement||t instanceof HTMLAnchorElement)&&(t.type==="radio"||t.type==="button"||t.type==="textarea"||t instanceof HTMLAnchorElement)?this.focusedElement=t:this.focusedElement=null,this.mainContainer;let a=(s=X==null?void 0:X.mainTemplate)==null?void 0:s.template;if(this.mainTemplateOverride&&(a=this.mainTemplateOverride),this.isLightweight&&(a=(n=X.lightweightTemplate)==null?void 0:n.template,this.lightweightTemplateOverride&&(a=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=z.render(a,e),this.focusedElement&&this.mainContainer){const o=this.focusedElement.type==="radio"?this.focusedElement.getAttribute("id"):this.focusedElement.getAttribute("class"),i=this.focusedElement.type==="radio"?"id":"class",c=this.mainContainer.querySelector(`[${i}="${o}"]`);(c instanceof HTMLInputElement||c instanceof HTMLButtonElement||c instanceof HTMLTextAreaElement||c instanceof HTMLAnchorElement)&&c.focus(),this.focusedElement=null}this.attachEvents()}attachEvents(){this.isLightweight?this.attachLightweightEvents():(this.attachOpenModalEvent(),this.closeModalEvent(),this.attachRatingEvents(),this.attachTextAreaEvents(),this.attachEmailInputEvents(),this.attachSubmitButtonEvents())}attachFocusTrap(){this.focusTrapListener&&document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=e=>{if(!this.templateData.feedbackOpen)return;const t=this.getModalElement();if(!t)return;const a=this.getFocusableElements(t);if(a.length===0)return;const s=a[0],n=a[a.length-1];e.key==="Tab"&&(e.shiftKey?(document.activeElement===s||!t.contains(document.activeElement))&&(e.preventDefault(),n==null||n.focus()):(document.activeElement===n||!t.contains(document.activeElement))&&(e.preventDefault(),s==null||s.focus())),e.key==="Escape"&&(e.preventDefault(),this.closeFeedbackModal())},document.addEventListener("keydown",this.focusTrapListener)}getFocusableElements(e){const t=["button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");return Array.from(e.querySelectorAll(t))}getModalElement(){var t,a;const e=(t=X.mainTemplate)==null?void 0:t.modalContainerClass;return((a=this.mainContainer)==null?void 0:a.querySelector(`.${e}`))||null}attachLightweightEvents(){var n,o,i,c;const e=(n=X.lightweightTemplate)==null?void 0:n.thumbsUpButtonClass,t=(o=X.lightweightTemplate)==null?void 0:o.thumbsDownButtonClass,a=(i=this.mainContainer)==null?void 0:i.querySelector("."+e),s=(c=this.mainContainer)==null?void 0:c.querySelector("."+t);a&&a.addEventListener("click",()=>{const l=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[this.templateData.ratings.length-1].isSelected&&this.ratedQuestion===l||(this.templateData.thumbsUpActive=!0,this.templateData.thumbsDownActive=!1,this.templateData.ratings.forEach(g=>{g.isSelected=g.index===this.thumbsUpValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=l,this.submit())}),s&&s.addEventListener("click",()=>{const l=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[0].isSelected&&this.ratedQuestion===l||(this.templateData.thumbsUpActive=!1,this.templateData.thumbsDownActive=!0,this.templateData.ratings.forEach(g=>{g.isSelected=g.index===this.thumbsDownValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=l,this.submit())})}attachSubmitButtonEvents(){var a,s;const e=(a=X.mainTemplate)==null?void 0:a.submitButtonClass,t=(s=this.mainContainer)==null?void 0:s.querySelector("."+e);t&&t.addEventListener("click",()=>{this.checkIfValid()})}checkIfValid(){var t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=X.mainTemplate)==null?void 0:t.emailInputId));this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,se.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(s=>s.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,se.setAccessibilityText("Please Rate your experience.")),this.templateData.errors.rating||this.templateData.errors.email?this.renderMainTemplate(this.generateTemplateData()):this.submit()}submit(){var t,a,s;this.templateData.submitted=!0;const e=(t=this.templateData.ratings.find(n=>n.isSelected))==null?void 0:t.index;e!==void 0&&(xe.trackFeedback({trackApiKey:this.analyticsKey,email:this.emailOverride&&this.isLightweight?this.emailOverride():this.templateData.emailInput,rating:e,feedback:this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea,model:this.model?this.model:void 0,language:this.language?this.language:void 0}),this.showCheckmarkAnimation(),se.setAccessibilityText("Feedback has been sent.",1e3),(s=this.mainContainer)!=null&&s.querySelector("."+((a=X.mainTemplate)==null?void 0:a.checkmarkClass))?setTimeout(()=>{this.closeFeedbackModal(),this.renderMainTemplate(this.generateTemplateData())},2e3):(setTimeout(()=>{this.closeFeedbackModal()},500),this.renderMainTemplate(this.generateTemplateData())))}validateEmail(e){return e===""?!0:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}attachEmailInputEvents(){var t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=X.mainTemplate)==null?void 0:t.emailInputId));e&&(e.addEventListener("input",()=>{this.templateData.emailInput=e.value}),e.addEventListener("blur",()=>{setTimeout(()=>{this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,se.setAccessibilityText("Please enter a valid email address.")),this.renderMainTemplate(this.generateTemplateData())},300)}))}attachTextAreaEvents(){var t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=X.mainTemplate)==null?void 0:t.feedbackTextAreaId));e&&e.addEventListener("input",()=>{var n,o;this.templateData.feedbackTextArea=e.value,this.templateData.charactersLeft=this.templateData.maxLength-e.value.length;const s=(o=this.mainContainer)==null?void 0:o.querySelector("."+((n=X.mainTemplate)==null?void 0:n.charactersRemainingContainerclass));s&&(s.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var a,s;const e=(a=X.mainTemplate)==null?void 0:a.ratingInputclass,t=(s=this.mainContainer)==null?void 0:s.querySelectorAll("."+e);t&&t.forEach(n=>{n.addEventListener("click",o=>{const i=o.target.value;this.templateData.ratings.forEach(c=>{c.isSelected=c.index+""===i}),this.templateData.errors.rating=!1,this.renderMainTemplate(this.generateTemplateData())})})}attachOpenModalEvent(){var a,s;const e=(a=X.mainTemplate)==null?void 0:a.openModalButtonClass,t=(s=this.mainContainer)==null?void 0:s.querySelector("."+e);t&&t.addEventListener("click",n=>{n.preventDefault(),this.toggleModal()})}toggleModal(){this.templateData.feedbackOpen?this.closeFeedbackModal():this.openFeedbackModal()}closeModalEvent(){var a,s;const e=(a=X.mainTemplate)==null?void 0:a.closeModalButtonClass,t=(s=this.mainContainer)==null?void 0:s.querySelector("."+e);t&&t.addEventListener("click",()=>{this.closeFeedbackModal()})}openFeedbackModal(){this.lastFocusedElementBeforeModal=document.activeElement,this.templateData.feedbackOpen=!0,this.renderMainTemplate(this.generateTemplateData()),setTimeout(()=>{const e=this.getModalElement();if(e){const t=this.getFocusableElements(e);t.length>0&&t[0].focus()}this.attachFocusTrap()},0),se.setAccessibilityText("Feedback form opened",1e3)}closeFeedbackModal(){this.templateData.feedbackOpen=!1,this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null),this.renderMainTemplate(this.generateTemplateData()),this.lastFocusedElementBeforeModal&&(this.lastFocusedElementBeforeModal.focus(),this.lastFocusedElementBeforeModal=null),se.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var i,c,l,g,m,p;const e=(i=X.mainTemplate)==null?void 0:i.submitButtonClass,t=(c=this.mainContainer)==null?void 0:c.querySelector("."+e);t&&(t.disabled=!0);const a=(l=X.mainTemplate)==null?void 0:l.checkmarkClass,s=(g=this.mainContainer)==null?void 0:g.querySelector("."+a);s&&s.classList.remove("hidden");const n=(m=X.mainTemplate)==null?void 0:m.submitButtonTextClass,o=(p=this.mainContainer)==null?void 0:p.querySelector("."+n);o&&o.classList.add("visibility"),setTimeout(()=>{s&&s.classList.add("hidden"),o&&o.classList.remove("visibility"),t&&(t.disabled=!1)},2e3)}destroy(){this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null)}}class ui{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"answerContainer",null);h(this,"showMoreVisible",!1);h(this,"renderFeedbackWidget",!1);h(this,"clicked",!1);h(this,"renderedWithShowMore",!1);var t;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.renderFeedbackWidget=((t=this.config.feedbackwidget)==null?void 0:t.renderFeedbackWidget)||!1,this.config.showMoreAfterWordCount&&(this.dataLayer.answerWidgetShowMoreLimit=this.config.showMoreAfterWordCount),typeof document<"u"&&(this.answerContainer=document==null?void 0:document.getElementById(this.containerId)),this.config.testString?(this.showMoreVisible=this.dataLayer.parsedData.shouldShowAnswerLoadMore,this.renderMainTemplate(this.generateTemplateData())):this.initializeSubscriptions(),this.dataLayer.setIsAnswerWidgetCreated(!0)}initializeSubscriptions(){this.dataLayer.$answer.subscribe(()=>{this.clicked?this.showMoreVisible=!1:this.showMoreVisible=this.dataLayer.parsedData.shouldShowAnswerLoadMore,this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answerLoading.subscribe(()=>{this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answerError.subscribe(e=>{e&&setTimeout(()=>{this.renderMainTemplate(this.generateTemplateData())},100)}),this.dataLayer.$searchObject.subscribe(()=>{this.clicked=!1,this.renderedWithShowMore=!1,this.showMoreVisible=!1}),this.dataLayer.$paginationData.subscribe(()=>{this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answer.subscribe(e=>{e&&setTimeout(()=>{this.initializeWidget()},600)}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.dataLayer.$answer.getValue()&&setTimeout(()=>{this.initializeWidget()},600)})}searchstaxFeedbackTextAreaOverride(){return"Question: "+(this.dataLayer.searchObject.query==="undefined"?"":this.dataLayer.searchObject.query)+" Answer: "+this.dataLayer.parsedData.getAnswerData}initializeWidget(){var e,t,a,s,n;this.renderFeedbackWidget&&document.getElementById("feedbackWidgetContainer")&&!this.dataLayer.answerLoading&&new hi({analyticsKey:this.dataLayer.parsedData.trackingData.trackApiKey,containerId:"feedbackWidgetContainer",lightweight:!0,model:this.dataLayer.parsedData.trackingData.model,language:this.dataLayer.parsedData.trackingData.language,emailOverride:(e=this.config.feedbackwidget)==null?void 0:e.emailOverride,feedbackTextAreaOverride:((t=this.config.feedbackwidget)==null?void 0:t.searchstaxFeedbackTextAreaOverride)??this.searchstaxFeedbackTextAreaOverride.bind(this),thumbsUpValue:((a=this.config.feedbackwidget)==null?void 0:a.thumbsUpValue)??10,thumbsDownValue:((s=this.config.feedbackwidget)==null?void 0:s.thumbsDownValue)??0,lightweightTemplateOverride:(n=this.config.feedbackwidget)==null?void 0:n.lightweightTemplateOverride})}showMore(e){e.preventDefault(),this.clicked=!0,this.showMoreVisible=!1,this.renderMainTemplate(this.generateTemplateData()),this.config.testString||setTimeout(()=>{this.initializeWidget()},600)}attachClickEventToShowMore(){const e=document.querySelector(".searchstax-answer-load-more-button");e&&e.addEventListener("click",this.showMore.bind(this))}trackLinkClick(e){e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("href");xe.trackAnswerLinkClick({href:t,answer:this.dataLayer.parsedData.getAnswerData,...this.dataLayer.parsedData.trackingData}).then(()=>{window.open(t,"_blank")}).catch(()=>{window.open(t,"_blank")})}attachLinkTracking(){document.querySelectorAll(".searchstax-answer-link").forEach(e=>{e.getAttribute("listener")!=="true"&&(e.setAttribute("listener","true"),e.addEventListener("click",this.trackLinkClick.bind(this)))})}renderMainTemplate(e){var a,s,n;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:n.template)||A.answer.main.template;this.dataLayer.renderingEngine===K.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=z.render(t,e),setTimeout(()=>{this.attachClickEventToShowMore(),this.attachLinkTracking()},100)):setTimeout(()=>{this.attachLinkTracking()},500)}generateTemplateData(){this.config.testString&&this.dataLayer.setAnswerData(this.config.testString??"");const e={...this.dataLayer.parsedData.data,showMoreButtonVisible:this.showMoreVisible};return this.config.testString&&(e.searchExecuted=!0),this.dataLayer.setAnswerFullData(e),e}}class $s{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"currentSelectValue","");h(this,"locationInput");h(this,"radiusInput");h(this,"locationDecode");h(this,"locationDecodeCoordinatesToAddress");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.locationDecode=(t=e.config.hooks)==null?void 0:t.locationDecode,this.locationDecodeCoordinatesToAddress=(a=e.config.hooks)==null?void 0:a.locationDecodeCoordinatesToAddress,this.dataLayer.locationEnabled&&this.dataLayer.$inputTemplateRendered.subscribeUntil(()=>{this.renderMainTemplate(),this.attachSubscriptions()},!0,500)}renderMainTemplate(){var e,t,a,s,n,o,i,c;if(typeof document<"u"){const l=document==null?void 0:document.getElementById(this.containerId);if(!l)throw new Error("Search input container not found");const g=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||A.location.mainTemplate.template,m={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(m),this.dataLayer.renderingEngine===K.mustache){const p=z.render(g,m);l.innerHTML=p;const w=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.locationInputId)||A.location.mainTemplate.locationInputId,b=document==null?void 0:document.querySelector(`#${w}`);if(b)this.locationInput=b,b.addEventListener("blur",this.blurEvent.bind(this)),b.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const L=((o=(n=this.config.templates)==null?void 0:n.mainTemplate)==null?void 0:o.radiusInputId)||A.location.mainTemplate.radiusInputId,T=document==null?void 0:document.querySelector(`#${L}`);T instanceof HTMLSelectElement&&(this.radiusInput=T,T.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const y=((c=(i=this.config.templates)==null?void 0:i.mainTemplate)==null?void 0:c.currentLocationActionButtonId)||A.location.mainTemplate.currentLocationActionButtonId,x=document==null?void 0:document.querySelector(`#${y}`);x&&x.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===K.mustache&&this.locationInput&&(this.locationInput.value=this.dataLayer.searchLocationCoordinatesDecoded)}getCurrentLocation(){navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const t=e.coords.latitude.toString(),a=e.coords.longitude.toString(),s=Math.floor(parseFloat(t)*100)/100,n=Math.floor(parseFloat(a)*100)/100;this.dataLayer.setSearchLat(s+""),this.dataLayer.setSearchLong(n+"");const o=this.locationDecodeCoordinatesToAddress;o?o(s+"",n+"").then(i=>{this.setCurrentLocationFields(i.address||"Current Location")}).catch(()=>{this.setCurrentLocationFields("Current Location")}):this.setCurrentLocationFields("Current Location")},()=>{console.error("Unable to retrieve your location")}):console.error("Geolocation is not supported by this browser.")}setRadiusValue(e){this.dataLayer.setSearchRadius(e)}radiusSelectChangeEvent(e){this.currentSelectValue=e.target.value,this.setRadiusValue(this.currentSelectValue)}attachSubscriptions(){this.dataLayer.$searchObject.subscribe(e=>{this.locationInput&&(this.locationInput.value=this.cleanSuggestionTerm(e.location.address??"")),this.radiusInput&&e.location.radius&&(this.radiusInput.value=e.location.radius||"")})}cleanSuggestionTerm(e){return ne.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}triggerGeocoder(e){const t=this.locationDecode;this.dataLayer.setLocationDecodingLoading(!0),e&&this.dataLayer.searchLocation!==e&&e!==this.dataLayer.searchLocationCoordinatesDecoded?t(e).then(a=>{this.dataLayer.setSearchLocation(a.address||""),this.dataLayer.setSearchLat(a.lat||""),this.dataLayer.setSearchLong(a.lon||""),this.locationInput&&(this.locationInput.value=this.cleanSuggestionTerm(a.address||"")),this.dataLayer.renderingEngine===K.mustache&&a.error&&this.locationInput&&this.locationInput.classList.add("searchstax-input-location-error"),a.error?this.dataLayer.setLocationError(!0):this.dataLayer.setLocationError(!1),this.dataLayer.setLocationDecodingLoading(!1)}).catch(()=>{this.dataLayer.setLocationDecodingLoading(!1)}):e===""&&(this.dataLayer.setSearchLocation(void 0),this.dataLayer.setSearchLat(void 0),this.dataLayer.setSearchLong(void 0),this.dataLayer.setLocationDecodingLoading(!1))}focusEvent(e){e.target.classList.remove("searchstax-input-location-error"),this.dataLayer.setLocationError(!1)}blurEvent(e){const t=e.target.value;this.triggerGeocoder(t)}}class di{constructor(e=K.mustache){h(this,"routerEnabled",!1);h(this,"cachedQuery","");h(this,"routerHelper");h(this,"searchHelper");h(this,"searchResultsConfig");h(this,"searchPaginationConfig");h(this,"searchFeedbackConfig");h(this,"searchSortingConfig");h(this,"searchFacetsConfig");h(this,"relatedSearchesConfig");h(this,"externalPromotionsConfig");h(this,"searchInputWidget");h(this,"searchLocationWidget");h(this,"searchResultsWidget");h(this,"searchFacetsWidget");h(this,"searchPaginationWidget");h(this,"searchFeedbackWidget");h(this,"searchSortingWidget");h(this,"relatedSearchesWidget");h(this,"externalPromotionsWidget");h(this,"answerWidget");h(this,"locationObserver",null);h(this,"dataLayer");h(this,"firstRequest",!0);h(this,"previousQuery","");h(this,"eventSource",null);h(this,"renderEngine",K.mustache);e&&(this.renderEngine=e)}setRenderingEngine(e=K.mustache){this.dataLayer.setRenderingEngine(e)}handleHooks(){var e,t;(t=(e=this.dataLayer.searchstaxConfig)==null?void 0:e.hooks)!=null&&t.afterSearch&&this.dataLayer.$searchResults.subscribe(a=>{this.dataLayer.searchstaxConfig.hooks.afterSearch(a,this.dataLayer.searchResultUnparsedData)}),setTimeout(()=>{this.dataLayer.$searchObject.subscribe(a=>{var s,n,o,i,c,l;a.query!==this.previousQuery&&this.dataLayer.setAnswerData(""),a.query!==""&&a.query!==void 0&&a.query!=="undefined"?(this.search(a),a.query!==this.previousQuery&&this.startSSE(a.query)):(s=this.dataLayer.searchLocationConfig)!=null&&s.locationSearchEnabled&&!((n=this.dataLayer.searchLocationConfig)!=null&&n.locationValuesOverride)?this.getMetadata(a):(i=(o=this.dataLayer.searchLocationConfig)==null?void 0:o.locationValuesOverride)!=null&&i.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((l=(c=this.dataLayer.searchLocationConfig)==null?void 0:c.locationValuesOverride)==null?void 0:l.locationFilterDefaultValue),this.previousQuery=a.query})},10),this.dataLayer.$searchResults.subscribe(a=>{a&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&xe.trackSearch({...this.dataLayer.parsedData.trackingData,impressions:this.dataLayer.searchResultsMetadata.impressions})})}startSSE(e){var t,a;this.eventSource&&((t=this.eventSource)==null||t.close(),this.dataLayer.setAnswerData("")),this.dataLayer.turnAIAnswerGenerationOn===!0&&this.dataLayer.questionURL&&this.dataLayer.searchObject.query!==void 0&&this.dataLayer.searchObject.query!=="undefined"&&(this.eventSource=(a=this.searchHelper)==null?void 0:a.startSSE(e,this.parseAnswerResultsResponse.bind(this)))}attachAnalyticsScript(e){xe.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new Mn("searchstax_session_id",e.sessionId),this.renderEngine&&this.dataLayer.setRenderingEngine(this.renderEngine),this.handleHooks(),e.questionURL&&(this.dataLayer.questionURL=e.questionURL),e.analyticsBaseUrl&&typeof window<"u"&&(window.analyticsBaseUrl=e.analyticsBaseUrl,window._msq=e._msq||[],this.attachAnalyticsScript(e.analyticsSrc)),e.autoCorrect===!1&&(this.dataLayer.autoCorrect=!1),e.language&&this.dataLayer.setLanguage(e.language),e.model&&this.dataLayer.setModel(e.model),this.dataLayer.searchstaxConfig||(this.dataLayer.setSearchstaxConfig(e),this.searchHelper=new En({...e,sessionId:this.dataLayer.sessionId},this.dataLayer),this.dataLayer.searchHelper=this.searchHelper),((t=e.router)==null?void 0:t.enabled)===void 0||((a=e.router)==null?void 0:a.enabled)===!0){this.routerEnabled=!0,this.routerHelper=new As(e.router?e.router:{enabled:!0});const s=this.routerHelper.urlToSearchObject((window==null?void 0:window.location.href)??"");this.dataLayer.searchObject.itemsPerPage?s.itemsPerPage=this.dataLayer.searchObject.itemsPerPage:s.itemsPerPage&&this.dataLayer.setItemsPerPage(s.itemsPerPage),s.model&&this.dataLayer.setModel(s.model),s.location&&(s.location.address&&this.dataLayer.setSearchLocation(s.location.address),s.location.lat&&this.dataLayer.setSearchLat(s.location.lat),s.location.lon&&this.dataLayer.setSearchLong(s.location.lon),s.location.radius&&this.dataLayer.setSearchRadius(s.location.radius)),this.dataLayer.setSearchObject(s),addEventListener("popstate",()=>{this.routerHelper&&this.dataLayer.setSearchObject(this.routerHelper.urlToSearchObject((window==null?void 0:window.location.href)??"",this.dataLayer.searchObject.itemsPerPage))})}else this.routerHelper=new As({})}getMetadata(e){this.searchHelper&&(e.query==="undefined"||e.query===void 0)&&this.dataLayer.setSearchObject({...e,query:"*"})}search(e){if(this.searchHelper){const t=this.dataLayer.forceNotCorrect;this.searchHelper.url&&(this.searchHelper.search(e,this.parseSearchResultsResponse.bind(this),this.firstRequest,t),this.firstRequest=!1),this.getRelatedSearches()}}getRelatedSearches(){var e;this.searchHelper&&this.relatedSearchesConfig&&((e=this.relatedSearchesConfig)!=null&&e.relatedSearchesURL)&&this.dataLayer.searchObject.query!==void 0&&this.dataLayer.searchObject.query!=="undefined"&&this.searchHelper.getRelatedSearches(this.dataLayer.searchObject,this.relatedSearchesConfig.relatedSearchesURL,this.relatedSearchesConfig.relatedSearchesAPIKey,this.parseRelatedSearchesResponse.bind(this))}parseRelatedSearchesResponse(e){var s,n;const t=(((s=e.response)==null?void 0:s.docs)??[]).map((o,i)=>({...o,position:i+1})),a=[];for(const o of t)a.push({relatedSearch:o.related_search,position:o.position});this.dataLayer.setSearchRelatedSearches(t),this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&a.length&&xe.trackRelatedSearches({...this.dataLayer.parsedData.trackingData,impressions:a,totalRelatredSearches:((n=this.dataLayer.searchRelatedSearches)==null?void 0:n.length)??0})}handleRouter(){if(this.routerEnabled){const e={...this.dataLayer.searchObject};this.dataLayer.isInfiniteScroll&&delete e.page,this.routerHelper.updateUrl(e)}}parseSearchResultsResponseMetadata(e){var s,n,o,i;const t=bt.extractSearchResultsMetadata(e),a=((n=(s=this.dataLayer.searchLocationConfig)==null?void 0:s.locationValuesOverride)==null?void 0:n.locationFilterDefaultValue)??((i=(o=t.location)==null?void 0:o.filter)==null?void 0:i.defaultValue);!this.dataLayer.searchRadius&&a&&this.dataLayer.setSearchRadius(a),this.dataLayer.setSearchResultsMetadata(t)}parseSearchResultsResponse(e){var s,n;this.handleRouter(),this.dataLayer.setItemsPerPage(parseInt(e.responseHeader.params.rows)),this.dataLayer.setModel(e.responseHeader.params.model);let t=bt.combineResultsWithMetadata(e),a=bt.extractFacets(e);this.dataLayer.setSearchFacets(a),(n=(s=this.dataLayer.searchstaxConfig)==null?void 0:s.hooks)!=null&&n.afterSearch&&(t=this.dataLayer.searchstaxConfig.hooks.afterSearch(t,e)),this.dataLayer.setSearchExternalPromotions(e.externalLinks??[]),this.parseSearchResultsResponseMetadata(e),this.dataLayer.setSearchResultUnparsedData(e),this.dataLayer.setSearchResults(t)}parseAnswerResultsResponse(e){this.handleRouter(),e!==et.question&&e!==et.notQuestion&&(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setAnswerData(this.dataLayer.getAnswerData+e))}cacheFacets(e){var t,a;e?(t=this.searchHelper)==null||t.cacheFacets(!0).then(()=>{}):(a=this.searchHelper)==null||a.cacheFacets().then(()=>{})}parseSuggestSuggestResponse(e){var a,s;let t=e;(s=(a=this.dataLayer.searchInputConfig)==null?void 0:a.hooks)!=null&&s.afterAutosuggest&&(t=this.dataLayer.searchInputConfig.hooks.afterAutosuggest(e)),this.dataLayer.setSearchAutosuggest(t)}suggest(e,t){this.searchHelper&&this.searchHelper.suggest(e,this.parseSuggestSuggestResponse.bind(this),t)}changeLanguage(e){this.searchHelper&&this.dataLayer.setLanguage(e)}addSearchInputWidget(e,t){this.dataLayer.searchInputConfig||this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.dataLayer.setSearchInputConfig(t),this.searchInputWidget=new oi({containerId:e,config:t,searchTrigger:this.executeSearch.bind(this),suggestTrigger:this.executeSuggest.bind(this),dataLayer:this.dataLayer})},200)}addSearchLocationWidget(e,t){var a,s;this.dataLayer.searchLocationConfig||(t.locationSearchEnabled?(this.dataLayer.setLocationEnabled(!0),this.dataLayer.setSearchLocationConfig(t),t.locationValuesOverride?(this.searchLocationWidget=new $s({containerId:e,config:t,dataLayer:this.dataLayer}),(a=t==null?void 0:t.locationValuesOverride)!=null&&a.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((s=t==null?void 0:t.locationValuesOverride)==null?void 0:s.locationFilterDefaultValue)):this.dataLayer.$searchResultsMetadata.subscribeUntilHasValue(()=>{this.searchLocationWidget=new $s({containerId:e,config:t,dataLayer:this.dataLayer})},0)):this.dataLayer.setLocationEnabled(!1))}addAnswerWidget(e,t){this.dataLayer.turnAIAnswerGenerationOn=!0,t.testString||this.startSSE(this.dataLayer.searchObject.query),this.dataLayer.setAnswerData(t.testString??""),this.answerWidget=new ui({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new ci({containerId:e,linkClickCallback:this.executeLinkClick.bind(this),searchTrigger:this.executeSearch.bind(this),config:t,dataLayer:this.dataLayer}))}addPaginationWidget(e,t){this.searchPaginationConfig=t,this.searchPaginationWidget=new ri({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new ii({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new li({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new ni({containerId:e,config:t,dataLayer:this.dataLayer,trackRelatedSearchClick:this.trackRelatedSearchClick.bind(this)}),setTimeout(()=>{this.getRelatedSearches()},0)}addExternalPromotionsWidget(e,t){this.externalPromotionsConfig=t,this.externalPromotionsWidget=new ai({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget=new si({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this))}executeSearch(e,t){const a={...this.dataLayer.searchObject};a.query=ne.removeXSSRiskyTags(e),a.page=1,a.facets=[],a.location={...a.location},this.locationObserver&&this.dataLayer.$locationDecodingLoading.unsubscribe(this.locationObserver),this.locationObserver=this.dataLayer.$locationDecodingLoading.subscribeUntil(()=>{var n,o;a.location.address=this.dataLayer.searchLocation,a.location.radius=this.dataLayer.searchRadius,a.location.lat=this.dataLayer.searchLat,a.location.lon=this.dataLayer.searchLong,this.dataLayer.forceNotCorrect=!!t;let s=(n=this.routerHelper)==null?void 0:n.searchObjectToParams(a);s&&(s=(o=this.routerHelper)==null?void 0:o.extractParamsThatDoNotStartWithRouteName(s)),s&&(a.additionalProps=Object.keys(s).map(i=>s?{key:i,value:s[i]}:{key:"",value:""})),this.dataLayer.setSearchObject(a),this.dataLayer.lastSearchValue=a.query},!1)}executeSuggest(e){var a,s;let t={term:e,queryParams:[]};(s=(a=this.dataLayer.searchInputConfig)==null?void 0:a.hooks)!=null&&s.beforeAutosuggest&&(t=this.dataLayer.searchInputConfig.hooks.beforeAutosuggest(t)),t&&t.term!==void 0&&t.queryParams!==void 0&&this.suggest(t.term,t.queryParams)}trackRelatedSearchClick(e){var t;this.dataLayer.searchResultsMetadata&&this.dataLayer.searchRelatedSearches&&!this.dataLayer.cookiesDisabled&&xe.trackRelatedSearchClick({...this.dataLayer.parsedData.trackingData,relatedSearch:e,totalRelatredSearches:((t=this.dataLayer.searchRelatedSearches)==null?void 0:t.length)??0})}executeLinkClick(e){var a,s;let t=bt.findResultByUniqueId(e,this.dataLayer.searchResults??[]);t&&((s=(a=this.searchResultsConfig)==null?void 0:a.hooks)!=null&&s.afterLinkClick&&(t=this.searchResultsConfig.hooks.afterLinkClick(t)),t&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&xe.trackClick({result:t,...this.dataLayer.parsedData.trackingData}).then(()=>{typeof window<"u"&&(window.location.href=(t==null?void 0:t.url)??"")}).catch(()=>{typeof window<"u"&&(window.location.href=(t==null?void 0:t.url)??"")}))}setPage(e){var t;(t=this.searchPaginationWidget)==null||t.goToPage(e)}setCookiesDisabled(e){this.dataLayer.setCookiesDisabled(e)}changeResultTemplate(e){var t,a,s;this.searchResultsConfig&&(this.searchResultsConfig.templates=(t=this.searchResultsConfig)!=null&&t.templates?{...(a=this.searchResultsConfig)==null?void 0:a.templates,...e}:e,(s=this.searchResultsWidget)==null||s.changeTemplate())}}const S={searchstax:new di("react")};function tr(r,e,t,a,s,n,o,i){return d.jsx(d.Fragment,{children:r&&d.jsx("div",{className:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container",children:d.jsxs("div",{className:"searchstax-location-input-wrapper",children:[d.jsx("span",{className:"searchstax-location-input-label",children:"NEAR"}),d.jsxs("div",{className:"searchstax-location-input-wrapper-inner",children:[d.jsx("input",{type:"text",id:"searchstax-location-input",className:"searchstax-location-input"+(i?" searchstax-input-location-error":""),placeholder:"Zip, Postal Code or City...","aria-label":"Search Location Input","data-test-id":"searchstax-location-input",value:n??"",onChange:c=>e(c.target.value),onBlur:c=>t(c.target.value)}),d.jsx("button",{onClick:s,className:"searchstax-get-current-location-button",children:"Use my current location"})]}),r.shouldShowLocationDistanceDropdown&&d.jsx("span",{className:"searchstax-location-input-label",children:"WITHIN"}),r.shouldShowLocationDistanceDropdown&&d.jsx("select",{id:"searchstax-location-radius-select",className:"searchstax-location-radius-select","aria-label":"Search Location Radius Select","data-test-id":"searchstax-location-radius-select",onChange:c=>a(c.target.value),value:o,children:r.locationSearchDistanceValues.map(({value:c,label:l})=>d.jsx("option",{value:c,children:l},c))})]})})})}function ar(r){let e=!1;const[t,a]=I.useState(null),[s,n]=I.useState(null),[o,i]=I.useState(!1),[c,l]=I.useState(void 0),[g]=I.useState(Math.random());I.useEffect(()=>{if(m(),S.searchstax)S.searchstax.addSearchLocationWidget("search-location-container"+g,{hooks:r.hooks,locationSearchEnabled:r.locationSearchEnabled,locationValuesOverride:r.locationValuesOverride});else throw Error("Searchstax instance needs to be passed via props")},[]);function m(){e||(S.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(L=>{a(L)}),S.searchstax.dataLayer.$searchObject.subscribe(L=>{n(L.location.address??""),l(L.location.radius||"")}),S.searchstax.dataLayer.$searchLocationChange.subscribe(L=>{n(L)}),S.searchstax.dataLayer.$searchRadiusChange.subscribe(L=>{l(L)}),S.searchstax.dataLayer.$locationError.subscribe(L=>{i(L)}),e=!0)}function p(){var L;(L=S.searchstax.searchLocationWidget)==null||L.getCurrentLocation()}function w(L){var T;l(L),(T=S.searchstax.searchLocationWidget)==null||T.setRadiusValue(L+"")}function b(L){var T;n(L),(T=S.searchstax.searchLocationWidget)==null||T.triggerGeocoder(L)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-location-container"+g,children:[!r.searchLocationTemplate&&t&&d.jsx(d.Fragment,{children:tr(t,n,b,w,p,s,c,o)}),r.searchLocationTemplate&&d.jsx(d.Fragment,{children:r.searchLocationTemplate(t,n,b,w,p,s,c,o)})]})})}const zs={appId:"APP_ID",relatedSearchesAPIKey:"KEY"},_t={locationDecode:r=>new Promise(e=>{const t="GEOCODING_API_KEY",a=`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(r)}&key=${t}`;fetch(a).then(s=>s.json()).then(s=>{if(s.status==="OK"&&s.results.length>0){const n=s.results[0],o={lat:n.geometry.location.lat,lon:n.geometry.location.lng,address:n.formatted_address};e(o)}else e({address:void 0,lat:void 0,lon:void 0,error:!0})}).catch(()=>{e({address:void 0,lat:void 0,lon:void 0,error:!0})})}),locationDecodeCoordinatesToAddress:(r,e)=>new Promise(t=>{fetch(`https://geocoding-staging.searchstax.co/reverse?location=${r},${e}&components=country:US&app_id=${zs.appId}`,{method:"GET",headers:{Authorization:`Token ${zs.relatedSearchesAPIKey}`}}).then(a=>a.json()).then(a=>{if(a.status==="OK"&&a.results.length>0){const s=a.results[0];t({address:s.formatted_address,lat:r,lon:e,error:!1})}else t({address:void 0,lat:r,lon:e,error:!0})}).catch(()=>{t({address:void 0,lat:r,lon:e,error:!0})})}),locationSearchEnabled:!1,locationValuesOverride:{locationDistanceEnabled:!0,filterValues:["any","1000"],filterUnit:"miles",locationFilterDefaultValue:"any"}};function gi(r,e,t,a){return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"searchstax-search-input-wrapper",children:[d.jsx("input",{type:"text",id:"searchstax-search-input",className:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"}),d.jsx("div",{className:`searchstax-autosuggest-container ${r.length===0?"hidden":""}`,onMouseLeave:e,children:r.map(function(s){return d.jsx("div",{className:"searchstax-autosuggest-item",children:d.jsx("div",{className:"searchstax-autosuggest-item-term-container",tabIndex:0,dangerouslySetInnerHTML:{__html:s.term},onMouseOver:()=>{t(s)},onClick:()=>{a()}})},s.term)})})]}),d.jsx(ar,{searchLocationTemplate:tr,hooks:{locationDecode:_t.locationDecode,locationDecodeCoordinatesToAddress:_t.locationDecodeCoordinatesToAddress},locationSearchEnabled:_t.locationSearchEnabled,locationValuesOverride:_t.locationValuesOverride}),d.jsx("button",{className:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search"})]})}function pi(r){let e=!1;const[t,a]=I.useState([]),[s,n]=I.useState(null);I.useEffect(()=>{if(o(),S.searchstax){const g={};r.afterAutosuggest&&(g.afterAutosuggest=r.afterAutosuggest),r.beforeAutosuggest&&(g.beforeAutosuggest=r.beforeAutosuggest),S.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:r.suggestAfterMinChars,hooks:g,templates:{mainTemplate:{template:"",searchInputId:r.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");S.searchstax.dataLayer.setInputTemplateRendered(!0)},[]);function o(){e||(S.searchstax.dataLayer.$autosuggestResults.subscribe(g=>{a((g==null?void 0:g.suggestions)??[])}),S.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(g=>{n(g)}),e=!0)}function i(){var g,m;(g=S.searchstax.searchInputWidget)==null||g.resetAutosuggestSelection(),(m=S.searchstax.searchInputWidget)==null||m.markActiveAutosuggestItem()}function c(g){var m;(m=S.searchstax.searchInputWidget)==null||m.onSuggestionEnter(g)}function l(){var g;(g=S.searchstax.searchInputWidget)==null||g.suggestionChosen()}return d.jsx(d.Fragment,{children:d.jsx("div",{id:"searchstax-input-container",children:d.jsxs("div",{className:`searchstax-search-input-container searchstax-search-input-container-new ${s!=null&&s.locationEnabled?"searchstax-alternative-render":""}`,children:[!r.inputTemplate&&d.jsx(d.Fragment,{children:gi(t,i,c,l)}),r.inputTemplate&&d.jsx(d.Fragment,{children:r.inputTemplate(t,i,c,l,s)})]})})})}function mi(r){const[e,t]=I.useState(!1);return I.useEffect(()=>{const a={};r.beforeSearch&&(a.beforeSearch=r.beforeSearch),r!=null&&r.afterSearch&&(a.afterSearch=r.afterSearch),S.searchstax.initialize({language:r.language??"en",model:r.model,sessionId:r.sessionId,searchURL:r.searchURL,questionURL:r.questionURL,suggesterURL:r.suggesterURL,trackApiKey:r.trackApiKey,searchAuth:r.searchAuth,authType:r.authType??"basic",autoCorrect:r.autoCorrect,router:r.router,hooks:a,analyticsBaseUrl:r.analyticsBaseUrl,analyticsSrc:r.analyticsSrc}),setTimeout(()=>{t(!0)},100),r.initialized(S.searchstax)},[]),d.jsx(d.Fragment,{children:e&&d.jsxs(d.Fragment,{children:[" ",r.children," "]})})}function fi(r,e,t){return d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-no-results",children:[" ","Showing ",d.jsx("strong",{children:"no results"})," for ",d.jsxs("strong",{children:['"',r,'"']}),d.jsx("br",{}),(e==null?void 0:e.spellingSuggestion)&&d.jsxs("span",{children:[" Did you mean"," ",d.jsx("a",{href:"#","aria-label":`Did you mean ${e==null?void 0:e.spellingSuggestion}`,className:"searchstax-suggestion-term",onClick:a=>{a.preventDefault(),t(e==null?void 0:e.spellingSuggestion)},children:e==null?void 0:e.spellingSuggestion}),"?"]})]}),d.jsx("ul",{children:d.jsxs("li",{children:[" ","Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need."," "]})})]})}function Li(r,e){return d.jsx(d.Fragment,{children:r&&r.length&&d.jsx("div",{className:"searchstax-search-results","aria-live":"polite",children:r!==null&&r.map(function(t){return d.jsx("a",{href:t.url??"",onClick:a=>{e(t,a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(t,a)},"data-searchstax-unique-result-id":t.uniqueId,"aria-labelledby":`title-${t.uniqueId}`,className:"searchstax-result-item-link searchstax-result-item-link-wrapping",tabIndex:0,children:d.jsxs("div",{className:`searchstax-search-result ${t.thumbnail?"has-thumbnail":""}`,children:[t.promoted&&d.jsx("div",{className:"searchstax-search-result-promoted"}),t.ribbon&&d.jsx("div",{className:"searchstax-search-result-ribbon",dangerouslySetInnerHTML:{__html:t.ribbon}}),t.thumbnail&&d.jsx("img",{alt:"",src:t.thumbnail,className:"searchstax-thumbnail"}),d.jsx("div",{className:"searchstax-search-result-title-container",children:d.jsx("span",{className:"searchstax-search-result-title",id:`title-${t.uniqueId}`,dangerouslySetInnerHTML:{__html:t.title??""}})}),t.paths&&d.jsx("p",{className:"searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.paths}}),t.description&&d.jsx("p",{className:"searchstax-search-result-description searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.description}}),t.unmappedFields.map(function(a){return d.jsxs("div",{children:[a.isImage&&typeof a.value=="string"&&d.jsx("div",{className:"searchstax-search-result-image-container",children:d.jsx("img",{alt:"",src:a.value,className:"searchstax-result-image"})}),!a.isImage&&d.jsx("div",{children:d.jsx("p",{tabIndex:0,className:"searchstax-search-result-common",dangerouslySetInnerHTML:{__html:a.value}})})]},a.key)})]},t.uniqueId)},t.uniqueId)})})})}function yi(r){const[e,t]=I.useState(null),a=I.useRef();a.current=e;const[s,n]=I.useState(""),[o,i]=I.useState(null),c=(m,p)=>{p.preventDefault(),p.stopPropagation(),S.searchstax.executeLinkClick(m.uniqueId)};I.useEffect(()=>{g();const m={};r.afterLinkClick&&(m.afterLinkClick=r.afterLinkClick),S.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:r.renderMethod??"pagination",resultsPerPage:r.resultsPerPage,hooks:m})},[]);function l(m){S.searchstax.executeSearch(m)}function g(){S.searchstax.dataLayer.$searchResults.subscribe(m=>{var L;const p=a.current??[],w=m??[],b=r.renderMethod==="infiniteScroll"?[...p,...w]:m;((L=S.searchstax.dataLayer.$searchObject.value)==null?void 0:L.page)===1?t(w):t(b)}),S.searchstax.dataLayer.$searchTermChange.subscribe(m=>{n(m)}),S.searchstax.dataLayer.$searchResultsMetadata.subscribe(m=>{i(m)})}return d.jsx(d.Fragment,{children:d.jsx("div",{id:"searchstax-results-container",children:d.jsx("section",{"aria-label":"search results container",tabIndex:0,children:d.jsx("div",{className:"searchstax-search-results-container",id:"searchstax-search-results-container",children:d.jsxs("div",{id:"searchstax-result-container",children:[e&&e.length===0&&s!==""&&s!=="*"&&S.searchstax.dataLayer.parsedData.firstSearchHappened&&!r.noResultTemplate&&d.jsx(d.Fragment,{children:fi(s,o,l)}),e&&e.length===0&&s!==""&&s!=="*"&&S.searchstax.dataLayer.parsedData.firstSearchHappened&&r.noResultTemplate&&d.jsx(d.Fragment,{children:r.noResultTemplate(s,o,l)}),e&&e.length>0&&!r.resultsTemplate&&Li(e,c),e&&e.length>0&&r.resultsTemplate&&d.jsx(d.Fragment,{children:r.resultsTemplate(e,c)})]})})})})})}function wi(r,e,t){return d.jsx(d.Fragment,{children:r&&(r==null?void 0:r.totalResults)!==0&&d.jsx("div",{className:"searchstax-pagination-container",children:d.jsxs("div",{className:"searchstax-pagination-content",children:[d.jsxs("a",{className:`searchstax-pagination-previous ${r.isFirstPage?"disabled":""}`,tabIndex:0,style:r!=null&&r.isFirstPage?{pointerEvents:"none"}:{},onClick:a=>{t(a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&t(a)},id:"searchstax-pagination-previous",children:[" ","< Previous"," "]}),d.jsxs("div",{className:"searchstax-pagination-details",children:[" ",r==null?void 0:r.startResultIndex," -"," ",r==null?void 0:r.endResultIndex," of"," ",r==null?void 0:r.totalResults]}),d.jsx("a",{className:`searchstax-pagination-next ${r.isLastPage?"disabled":""}`,tabIndex:0,style:r!=null&&r.isLastPage?{pointerEvents:"none"}:{},onClick:a=>{e(a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(a)},id:"searchstax-pagination-next",children:"Next >"})]})})})}function xi(r,e){return d.jsx(d.Fragment,{children:r&&r.isInfiniteScroll&&(r==null?void 0:r.totalResults)!==0&&!(r!=null&&r.isLastPage)&&d.jsx("div",{className:"searchstax-pagination-container",children:d.jsx("a",{className:"searchstax-pagination-load-more",tabIndex:0,onClick:t=>{e(t)},onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&e(t)},children:"Show More >"})})})}function bi(r){let e=!1;const[t,a]=I.useState(!1),[s,n]=I.useState(null),[o]=I.useState(Math.random());I.useEffect(()=>{if(i(),S.searchstax)S.searchstax.addPaginationWidget("searchstax-pagination-container"+o,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function i(){e||(S.searchstax.dataLayer.$searchObject.subscribe(()=>{c()}),S.searchstax.dataLayer.$paginationData.subscribe(m=>{n(m)}),e=!0)}function c(){!t&&S.searchstax.routerHelper&&(a(!0),S.searchstax.addPaginationWidget("searchstax-pagination-container"+o,{}))}function l(m){var p;(p=S.searchstax.searchPaginationWidget)==null||p.nextPage(m)}function g(m){var p;(p=S.searchstax.searchPaginationWidget)==null||p.previousPage(m)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-pagination-container"+o,children:[!r.paginationTemplate&&s&&!s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&d.jsx(d.Fragment,{children:wi(s,l,g)}),r.paginationTemplate&&s&&!s.isInfiniteScroll&&d.jsx(d.Fragment,{children:r.paginationTemplate(s,l,g)}),!r.infiniteScrollTemplate&&s&&s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&!(s!=null&&s.isLastPage)&&d.jsx(d.Fragment,{children:xi(s,l)}),r.infiniteScrollTemplate&&s&&s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&!(s!=null&&s.isLastPage)&&d.jsx(d.Fragment,{children:r.infiniteScrollTemplate(s,l)})]})})}function Ci(r,e,t){return d.jsx(d.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&r.sortOptions.length>0&&(r==null?void 0:r.hasResultsOrExternalPromotions)&&d.jsxs("div",{className:"searchstax-sorting-container",children:[d.jsx("label",{className:"searchstax-sorting-label",htmlFor:"searchstax-search-order-select",children:"Sort By"}),d.jsx("select",{id:"searchstax-search-order-select",className:"searchstax-search-order-select",value:t,onChange:a=>{e(a.target.value)},children:r.sortOptions.map(function(a){return d.jsx("option",{value:a.key,children:a.value},a.key)})})]})})}function Mi(r){let e=!1;const[t,a]=I.useState(null),[s,n]=I.useState(""),[o]=I.useState(Math.random());I.useEffect(()=>{if(i(),S.searchstax)S.searchstax.addSearchSortingWidget("search-sorting-container"+o,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function i(){e||(S.searchstax.dataLayer.$searchSortingData.subscribe(l=>{a(l)}),S.searchstax.dataLayer.$searchObject.subscribe(l=>{n(decodeURIComponent((l==null?void 0:l.order)??""))}),e=!0)}function c(l){var g;(g=S.searchstax.searchSortingWidget)==null||g.setOrderQuery(l)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-sorting-container"+o,children:[!r.searchSortingTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasResultsOrExternalPromotions)&&d.jsx(d.Fragment,{children:Ci(t,c,s)}),r.searchSortingTemplate&&d.jsx(d.Fragment,{children:r.searchSortingTemplate(t,c,s)})]})})}function Si(r,e){return d.jsx(d.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&(r==null?void 0:r.totalResults)>0&&d.jsxs(d.Fragment,{children:["Showing"," ",d.jsxs("b",{children:[r.startResultIndex," -"," ",r.endResultIndex]})," ","of",d.jsxs("b",{children:[" ",r.totalResults]})," results",r.searchTerm&&d.jsxs("span",{children:[' for "',d.jsx("b",{children:r.searchTerm}),'"'," "]}),d.jsx("div",{className:"searchstax-feedback-container-suggested",children:r.autoCorrectedQuery&&d.jsxs("div",{children:[" ","Search instead for"," ",d.jsx("a",{href:"#",onClick:t=>{e(t)},className:"searchstax-feedback-original-query","aria-label":`Search instead for ${r.originalQuery}`,children:r.originalQuery})]})})]})})}function ki(r){let e=!1;const[t,a]=I.useState(null),[s]=I.useState(Math.random());I.useEffect(()=>{if(n(),S.searchstax)S.searchstax.addSearchFeedbackWidget("search-feedback-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(S.searchstax.dataLayer.$searchFeedbackData.subscribe(i=>{a(i)}),e=!0)}function o(i){var c;(c=S.searchstax.searchFeedbackWidget)==null||c.onOriginalQueryClick(i)}return d.jsx(d.Fragment,{children:d.jsxs("div",{className:"search-feedback-container",id:"search-feedback-container"+s,children:[!r.searchOverviewTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.totalResults)>0&&d.jsx(d.Fragment,{children:Si(t,o)}),r.searchOverviewTemplate&&d.jsx(d.Fragment,{children:r.searchOverviewTemplate(t,o)})]})})}function Ti(r,e,t,a,s,n,o){return d.jsx("div",{className:"searchstax-facets-container-desktop",children:r==null?void 0:r.facets.map(i=>d.jsx("div",{className:`searchstax-facet-container ${t(i.name)?"active":""}`,children:d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{a(i.name)},children:[d.jsxs("div",{className:"searchstax-facet-title",children:[" ",i.label]}),d.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),d.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[i.values.map((c,l)=>(e[l+i.name]=I.createRef(),d.jsxs("div",{className:`searchstax-facet-value-container ${c.disabled?"searchstax-facet-value-disabled":""}`,ref:e[l+i.name],children:[d.jsx("div",{className:"searchstax-facet-input desktop-"+l+i.name,children:d.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:n(c),readOnly:!0,"aria-label":c.value+" "+c.count,disabled:c.disabled,onClick:g=>{s(l+i.name,g,c,!0)}})}),d.jsx("div",{className:"searchstax-facet-value-label",onClick:g=>{s(l+i.name,g,c,!1)},children:c.value}),d.jsxs("div",{className:"searchstax-facet-value-count",onClick:g=>{s(l+i.name,g,c,!1)},children:["(",c.count,")"]})]},c.value+c.parentName))),i.hasMoreFacets&&d.jsx("div",{className:"searchstax-facet-show-more-container",children:d.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:c=>{o(c,i)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&o(c,i)},tabIndex:0,children:[i.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!i.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},i.name+"desktop"))})}function vi(r,e,t,a,s,n,o,i,c,l,g,m){return r?d.jsx("div",{className:"searchstax-facets-container-mobile",children:d.jsxs("div",{className:"searchstax-facets-pills-container",children:[d.jsx("div",{className:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:()=>{l()},children:d.jsx("div",{className:"searchstax-facets-pill-label",children:"Filter By"})}),d.jsxs("div",{className:"searchstax-facets-pills-selected",children:[e.map(p=>d.jsxs("div",{className:"searchstax-facets-pill searchstax-facets-pill-facets",onClick:()=>{i(p)},children:[d.jsxs("div",{className:"searchstax-facets-pill-label",children:[p.value," (",p.count,")"]}),d.jsx("div",{className:"searchstax-facets-pill-icon-close"})]},p.value)),e.length!==0&&d.jsx("div",{className:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:()=>{m()},children:d.jsx("div",{className:"searchstax-facets-pill-label",children:"Clear Filters"})})]}),d.jsxs("div",{className:`searchstax-facets-mobile-overlay ${r.overlayOpened?"searchstax-show":""}`,children:[d.jsxs("div",{className:"searchstax-facets-mobile-overlay-header",children:[d.jsx("div",{className:"searchstax-facets-mobile-overlay-header-title",children:"Filter By"}),d.jsx("div",{className:"searchstax-search-close",onClick:()=>{g()}})]}),d.jsx("div",{className:"searchstax-facets-container-mobile",children:r==null?void 0:r.facets.map(p=>d.jsx("div",{className:`searchstax-facet-container ${a(p.name)?"active":""}`,children:d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{s(p.name)},children:[d.jsxs("div",{className:"searchstax-facet-title",children:[" ",p.label," "]}),d.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),d.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[p.values.map((w,b)=>(t[b+p.name]=I.createRef(),d.jsxs("div",{className:`searchstax-facet-value-container ${w.disabled?"searchstax-facet-value-disabled":""}`,ref:t[b+p.name],children:[d.jsx("div",{className:"searchstax-facet-input mobile-"+b+p.name,children:d.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:o(w),readOnly:!0,"aria-label":w.value+" "+w.count,disabled:w.disabled,onClick:L=>{n(b+p.name,L,w,!0,!0)}})}),d.jsx("div",{className:"searchstax-facet-value-label",onClick:L=>{n(b+p.name,L,w,!1)},children:w.value}),d.jsxs("div",{className:"searchstax-facet-value-count",onClick:L=>{n(b+p.name,L,w,!1)},children:["(",w.count,")"]})]},w.value+w.parentName))),d.jsx("div",{className:"searchstax-facet-show-more-container","v-if":"facet.hasMoreFacets",children:d.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:w=>{c(w,p)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&c(w,p)},tabIndex:0,role:"button",children:[p.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!p.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},p.name+"mobile"))}),d.jsx("button",{className:"searchstax-facets-mobile-overlay-done",onClick:()=>{g()},children:"Done"})]})]})}):d.jsx(d.Fragment,{})}function Ai(r){const[e,t]=I.useState(null),[a,s]=I.useState(null),[n,o]=I.useState([]),[i,c]=I.useState({}),l={},g=Math.random();let m=!1;I.useEffect(()=>{if(p(),S.searchstax)S.searchstax.addFacetsWidget("searchstax-facets-container"+g,{facetingType:r.facetingType,specificFacets:r.specificFacets,itemsPerPageDesktop:r.itemsPerPageDesktop,itemsPerPageMobile:r.itemsPerPageMobile,hooks:{beforeFacetsRender:r.beforeFacetsRender}});else throw Error("Searchstax instance needs to be passed via props")},[]);function p(){m||(S.searchstax.dataLayer.$facetsTemplateData.subscribe(E=>{E!=null&&E.isMobile?s(E):t(E)}),S.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(E=>{o((E??[]).filter(B=>B.type==="checkbox"))}),m=!0)}function w(E){var O;(O=S.searchstax.searchFacetsWidget)==null||O.unselectFacet(E)}function b(){var E;(E=S.searchstax.searchFacetsWidget)==null||E.removeSelectedFacets()}function L(E){return!i[E]}function T(E){L(E)?c({...i,[E]:!0}):c({...i,[E]:!1})}function y(E){var O;return(O=S.searchstax.searchFacetsWidget)==null?void 0:O.isChecked(E)}function x(E,O,B,Z,_){var Te;const ce=_?"mobile-":"desktop-",be=document.getElementsByClassName(ce+E);be[0]&&((Te=S.searchstax.searchFacetsWidget)==null||Te.onFacetSelect(O,B,be[0],!1,y(B)))}function v(E,O){var B;(B=S.searchstax.searchFacetsWidget)==null||B.onShowMoreLessClick(E,O,!1)}function k(E,O){var B;(B=S.searchstax.searchFacetsWidget)==null||B.onShowMoreLessClick(E,O,!0)}function j(){var E;(E=S.searchstax.searchFacetsWidget)==null||E.openOverlay()}function F(){var E;(E=S.searchstax.searchFacetsWidget)==null||E.closeOverlay()}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-facets-container"+g,children:[(e==null?void 0:e.hasResultsOrExternalPromotions)&&!r.facetsTemplateDesktop&&d.jsx(d.Fragment,{children:Ti(e,l,L,T,x,y,v)}),r.facetsTemplateDesktop&&d.jsx(d.Fragment,{children:r.facetsTemplateDesktop(e,l,L,T,x,y,v)}),(a==null?void 0:a.hasResultsOrExternalPromotions)&&!r.facetsTemplateMobile&&d.jsx(d.Fragment,{children:vi(a,n,l,L,T,x,y,w,k,j,F,b)}),r.facetsTemplateMobile&&d.jsx(d.Fragment,{children:r.facetsTemplateMobile(a,n,l,L,T,x,y,w,k,j,F,b)})]})})}function Ei(r,e){return d.jsx(d.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&(r==null?void 0:r.hasRelatedSearches)&&d.jsxs("div",{className:"searchstax-related-searches-container",id:"searchstax-related-searches-container",children:[" ","Related searches: ",d.jsx("span",{id:"searchstax-related-searches"}),r.relatedSearches&&d.jsx("span",{className:"searchstax-related-search",children:r.relatedSearches.map(t=>d.jsxs("span",{onClick:()=>{e(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(t)},tabIndex:0,className:"searchstax-related-search searchstax-related-search-item","aria-label":"Related search: "+t.related_search,children:[" ",t.related_search,!t.last&&d.jsx("span",{children:","})]},t.related_search))})]})})}function ji(r){let e=!1;const[t,a]=I.useState(null),[s]=I.useState(Math.random());I.useEffect(()=>{if(n(),S.searchstax)S.searchstax.addRelatedSearchesWidget("searchstax-related-searches-container"+s,{relatedSearchesURL:r.relatedSearchesURL,relatedSearchesAPIKey:r.relatedSearchesAPIKey});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(S.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(i=>{a(i)}),e=!0)}function o(i){var c;(c=S.searchstax.relatedSearchesWidget)==null||c.executeSearch(i)}return d.jsxs(d.Fragment,{children:[!r.searchRelatedSearchesTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasRelatedSearches)&&d.jsx(d.Fragment,{children:Ei(t,o)}),r.searchRelatedSearchesTemplate&&d.jsx(d.Fragment,{children:r.searchRelatedSearchesTemplate(t,o)})]})}function Ii(r,e){return d.jsx(d.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&(r==null?void 0:r.hasExternalPromotions)&&r.externalPromotions.map(t=>d.jsxs("div",{className:"searchstax-external-promotion searchstax-search-result",children:[d.jsx("div",{className:"icon-elevated"}),t.url&&d.jsx("a",{href:t.url,onClick:a=>{e(t,a)},className:"searchstax-result-item-link"}),d.jsx("div",{className:"searchstax-search-result-title-container",children:d.jsx("span",{className:"searchstax-search-result-title",children:t.name})}),t.description&&d.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.description," "]}),t.url&&d.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.url," "]})]},t.id))})}function Ri(r){let e=!1;const[t,a]=I.useState(null),[s]=I.useState(Math.random());I.useEffect(()=>{if(n(),S.searchstax)S.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(S.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(i=>{a(i)}),e=!0)}function o(i,c){var l;(l=S.searchstax.externalPromotionsWidget)==null||l.trackClick(i,c)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-external-promotions-layout-container"+s,children:[!r.searchExternalPromotionsTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasExternalPromotions)&&d.jsx(d.Fragment,{children:Ii(t,o)}),r.searchExternalPromotionsTemplate&&d.jsx(d.Fragment,{children:r.searchExternalPromotionsTemplate(t,o)})]})})}function Di(r,e){return d.jsx(d.Fragment,{children:r&&d.jsxs("div",{className:"searchstax-answer-wrap",children:[d.jsx("div",{className:"searchstax-answer-icon"}),d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-answer-container "+(r.showMoreButtonVisible===!0?"searchstax-answer-show-more":""),children:[d.jsx("div",{className:"searchstax-answer-title",children:"Smart Answers"}),r.shouldShowAnswerError&&d.jsx("div",{className:"searchstax-answer-error",dangerouslySetInnerHTML:{__html:r.answerErrorMessage}}),d.jsx("div",{className:"searchstax-answer-description",dangerouslySetInnerHTML:{__html:r.fullAnswerFormatted}}),r.answerLoading&&d.jsx("div",{className:"searchstax-answer-loading"})]}),r.showMoreButtonVisible===!0&&d.jsx("div",{className:"searchstax-answer-load-more-button-container",children:d.jsx("button",{className:"searchstax-answer-load-more-button",onClick:t=>{e(t)},children:"Show More"})})]}),d.jsxs("div",{className:"searchstax-answer-footer",children:[d.jsx("div",{id:"feedbackWidgetContainer"}),d.jsx("div",{className:"searchstax-lightweight-widget-separator-inline"}),d.jsx("p",{className:"searchstax-disclaimer",children:"Generative AI is Experimental"})]})]})})}function Ni(r){let e=!1;const[t,a]=I.useState(null),[s]=I.useState(Math.random());I.useEffect(()=>{if(o(),S.searchstax){const i=r.feedbackwidget??void 0;S.searchstax.addAnswerWidget("searchstax-answer-container"+s,{showMoreAfterWordCount:r.showMoreAfterWordCount,feedbackwidget:i,testString:r.testString})}else throw Error("Searchstax instance needs to be passed via props")},[]);function n(i){var c;S.searchstax&&((c=S.searchstax.answerWidget)==null||c.showMore(i))}function o(){e||(S.searchstax.dataLayer.$answerData.subscribe(i=>{a(i)}),e=!0)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-answer-container"+s,children:[!r.searchAnswerTemplate&&t&&t.shouldShowAnswer&&(t==null?void 0:t.searchExecuted)&&d.jsx(d.Fragment,{children:Di(t,n)}),r.searchAnswerTemplate&&t&&t.shouldShowAnswer&&d.jsx(d.Fragment,{children:r.searchAnswerTemplate(t,n)})]})})}exports.SearchstaxAnswerWidget=Ni;exports.SearchstaxExternalPromotionsWidget=Ri;exports.SearchstaxFacetsWidget=Ai;exports.SearchstaxInputWidget=pi;exports.SearchstaxLocationWidget=ar;exports.SearchstaxOverviewWidget=ki;exports.SearchstaxPaginationWidget=bi;exports.SearchstaxRelatedSearchesWidget=ji;exports.SearchstaxResultWidget=yi;exports.SearchstaxSortingWidget=Mi;exports.SearchstaxWrapper=mi;
|
|
461
|
+
`,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class j{}u(j,"answer",En),u(j,"externalPromotions",An),u(j,"facets",In),u(j,"pagination",Nn),u(j,"relatedSearches",Rn),u(j,"searchFeedback",Dn),u(j,"searchInput",On),u(j,"location",Pn),u(j,"searchResults",Fn),u(j,"sorting",$n),u(j,"feedback",re);class zn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"externalPromotionsContainerId");u(this,"searchExternalPromotionsMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.externalPromotionsContainerId=((a=(t=this.config.templates)==null?void 0:t.mainTemplate)==null?void 0:a.externalPromotionsContainerId)||j.externalPromotions.mainTemplate.externalPromotionsContainerId,typeof document<"u"&&(this.searchExternalPromotionsMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}initializeSubscriptions(){this.dataLayer.$searchExternalPromotions.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data,externalPromotions:this.dataLayer.parsedData.externalPromotions};return this.dataLayer.setExternalPromotionsData(e),e}addExternalSearch(e){var a,r,i,n;const t=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;if(t){const o=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.externalPromotion)==null?void 0:i.template)||((n=j.externalPromotions.externalPromotion)==null?void 0:n.template);if(typeof document<"u"){const c=document==null?void 0:document.createElement("div");c.classList.add("searchstax-external-promotion"),c.addEventListener("click",h=>{this.trackClick(e,h)}),c.innerHTML=W.render(o,e),t.appendChild(c)}}}trackClick(e,t){t.stopPropagation(),t.preventDefault(),window==null||window.open(e.url,"_blank")}renderMainTemplate(e){var a,r,i,n;const t=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.mainTemplate)==null?void 0:i.template)||((n=j.externalPromotions.mainTemplate)==null?void 0:n.template);if(this.dataLayer.renderingEngine===te.mustache){this.searchExternalPromotionsMainContainer.innerHTML=W.render(t,e);const o=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;o&&(o.innerHTML="");for(const c of e.externalPromotions)this.addExternalSearch(c)}}}class oe{static addAccessibilityNotificationContainerToBody(){if(!document.getElementById("searchAccessibilityContainer")){const e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("id","searchAccessibilityContainer"),document.body.appendChild(e)}}static setAccessibilityText(e,t,a){this.addAccessibilityNotificationContainerToBody();const r=a??"searchAccessibility",i=document.getElementById(r);i&&i.remove();const n=document.createElement("span");n.setAttribute("id",r),n.innerHTML=e;const o=document.getElementById("searchAccessibilityContainer");o&&setTimeout(()=>{o.appendChild(n)},t??100)}}class _n{constructor(e,t){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"routerHelper");u(this,"cachedPhrase","");u(this,"cachedANDFacets","");u(this,"overlayOpened",!1);u(this,"facetPaginationStep");u(this,"facetPaginationStepMobile");u(this,"searchFacetsMainContainer",null);u(this,"searchFacetsMobileContainer",null);u(this,"searchFacetsDesktopContainer",null);u(this,"facetLimits",{});u(this,"facetLimitsMobile",{});u(this,"deactivatedFacets",{});u(this,"focusedElement",null);u(this,"cachedData",null);u(this,"cacheFacets");u(this,"onFacetSelect",(e,t,a,r,i)=>{if(e.stopPropagation(),!t.disabled){const n=a.querySelector("input");let o=r?n.checked:!n.checked;i!==void 0&&(o=!i),n.checked=o;const c=this.dataLayer.searchObject;let h=[...c.facets];const g=this.extractFacetValue(t);o?h.find(m=>be.deepEqual(m,g)?m:!1)||(this.config.facetingType==="tabs"&&(h=h.filter(m=>m.name!==g.name)),h.push(g)):h=h.filter(m=>!be.deepEqual(m,g)),setTimeout(()=>{this.dataLayer.setSearchObject({...c,facets:h,page:1}),this.config.facetingType==="tabs"&&this.renderMainTemplate(this.generateTemplateData(),!0)},0)}});this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.cacheFacets=t,this.facetPaginationStep=this.config.itemsPerPageDesktop,this.facetPaginationStepMobile=this.config.itemsPerPageMobile,typeof document<"u"&&(this.searchFacetsMainContainer=document==null?void 0:document.getElementById(this.containerId)),t(this.config.facetingType),this.initializeSubscriptions()}get needDisabling(){return this.config.facetingType==="showUnavailable"}initializeSubscriptions(){this.dataLayer.$searchFacetsCachedand.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$searchFacetsCachedtabs.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$searchFacetsCachedor.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$searchResults.subscribe(e=>{e&&(this.cacheFacets(this.config.facetingType),this.renderMainTemplate(this.generateTemplateData()))})}extractFacetValue(e){return{type:this.config.facetingType,name:e.parentName,value:e.value}}applyFacetLimits(e,t){const a=t?this.facetPaginationStepMobile:this.facetPaginationStep,r=t?this.facetLimits:this.facetLimitsMobile;return e.forEach(i=>{r[i.name]||(r[i.name]=a)}),e.map(i=>({...i,values:i.values.slice(0,r[i.name]),showingAllFacets:i.values.length<=r[i.name],hasMoreFacets:i.values.length>a}))}generateTemplateData(e){var t;if(this.generateSelectedFacetsData(),this.dataLayer.searchFacets){let a=this.dataLayer.searchFacets;(t=this.config.hooks)!=null&&t.beforeFacetsRender&&(a=this.config.hooks.beforeFacetsRender(a)),this.componentFacets&&(a=this.componentFacets,this.needDisabling&&(a=a.map(i=>{var o;const n=(o=this.dataLayer.searchFacets)==null?void 0:o.find(c=>c.name===i.name);return n?{...i,values:i.values.map(c=>{const h=n.values.find(g=>c.type==="range"?!1:c.type==="checkbox"?g.value===c.value:!1);return{...c,disabled:!h,isMobile:e}})}:{...i,values:i.values.map(c=>({...c,disabled:!0})),isMobile:e}}))),this.config.specificFacets&&(a=a.filter(i=>{var n;return(n=this.config.specificFacets)==null?void 0:n.includes(i.name)}));const r={facets:this.applyFacetLimits(a,e),...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(r),r}else{const a={facets:[],...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(a),a}}createFacetItem(e,t,a){var r,i,n,o,c,h,g,m,p,w,S,L,T,A,O,P;if(typeof document<"u"){const I=document==null?void 0:document.createElement("div");I.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||I.classList.add("active");const y=((n=(i=(r=this.config)==null?void 0:r.templates)==null?void 0:i.facetItemContainerTemplate)==null?void 0:n.template)||((o=j.facets.facetItemContainerTemplate)==null?void 0:o.template);I.innerHTML=W.render(y,e),t.appendChild(I);const b=I.querySelector("."+(((g=(h=(c=this.config)==null?void 0:c.templates)==null?void 0:h.facetItemContainerTemplate)==null?void 0:g.facetListTitleContainerClass)||((m=j.facets.facetItemContainerTemplate)==null?void 0:m.facetListTitleContainerClass)));b==null||b.addEventListener("click",()=>{I.classList.toggle("active");const E=I.classList.contains("active"),N=b.querySelector(".searchstax-facet-title");N&&N.setAttribute("aria-expanded",String(E))}),(L=b==null?void 0:b.querySelector("."+((S=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.facetItemContainerTemplate)==null?void 0:S.facetListTitleContainerInner)))==null||L.addEventListener("keydown",E=>{if(E.code==="Enter"||E.code==="Space"){E.preventDefault(),I.classList.toggle("active");const N=I.classList.contains("active"),G=b.querySelector(".searchstax-facet-title");G&&G.setAttribute("aria-expanded",String(N))}});const M=I.querySelector("."+(((O=(A=(T=this.config)==null?void 0:T.templates)==null?void 0:A.facetItemContainerTemplate)==null?void 0:O.facetListContainerClass)||((P=j.facets.facetItemContainerTemplate)==null?void 0:P.facetListContainerClass)));M&&(e.values.forEach(E=>{this.createFacetListItem(E,M,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,M,a))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(a=>be.deepEqual(a,this.extractFacetValue(e))))}createFacetListItem(e,t,a){var r,i,n,o,c,h,g,m,p,w,S,L;if(typeof document<"u"){const T=document==null?void 0:document.createElement("div");T.classList.add("searchstax-facet-value-container"),e.disabled&&T.classList.add("searchstax-facet-value-disabled");const A=this.isChecked(e),O=((n=(i=(r=this.config)==null?void 0:r.templates)==null?void 0:i.facetItemTemplate)==null?void 0:n.template)||((o=j.facets.facetItemTemplate)==null?void 0:o.template);T.innerHTML=W.render(O,{...e,isChecked:A});let P=(c=j.facets.facetItemTemplate)==null?void 0:c.checkTriggerClasses;P=((m=(g=(h=this.config)==null?void 0:h.templates)==null?void 0:g.facetItemTemplate)==null?void 0:m.checkTriggerClasses)||P,P.forEach(y=>{var b;(b=T.querySelector("."+y))==null||b.addEventListener("click",M=>{this.onFacetSelect(M,e,T)})});const I=T.querySelector("."+(((S=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.facetItemTemplate)==null?void 0:S.inputCheckboxClass)||((L=j.facets.facetItemTemplate)==null?void 0:L.inputCheckboxClass)));I==null||I.addEventListener("click",y=>{this.onFacetSelect(y,e,T,!0)}),I&&(I==null||I.setAttribute("data-test-value",`${encodeURIComponent(a)}:"${encodeURIComponent(e.value)}"`)),t.appendChild(T)}}createHasMoreComponent(e,t,a){var r,i,n,o,c,h,g,m,p,w;if(typeof document<"u"){const S=document==null?void 0:document.createElement("div");S.classList.add("searchstax-facet-show-more-container");const L=((n=(i=(r=this.config)==null?void 0:r.templates)==null?void 0:i.showMoreButtonContainerTemplate)==null?void 0:n.template)||((o=j.facets.showMoreButtonContainerTemplate)==null?void 0:o.template);S.innerHTML=W.render(L,{...e,focusId:`moreLess${(h=(c=e==null?void 0:e.values)==null?void 0:c[0])==null?void 0:h.value}`});const T=S.querySelector("."+(((p=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.showMoreButtonContainerTemplate)==null?void 0:p.showMoreButtonClass)||((w=j.facets.showMoreButtonContainerTemplate)==null?void 0:w.showMoreButtonClass)));T&&(this.attachOnclickToShowMore(e,T,a),t&&t.appendChild(T))}}attachOnclickToShowMore(e,t,a){t.addEventListener("click",r=>{this.onShowMoreLessClick(r,e,a)}),t.addEventListener("keydown",r=>{r.code==="Space"&&r.preventDefault()}),t.addEventListener("keyup",r=>{(r.code==="Space"||r.code==="Enter")&&(r.preventDefault(),this.onShowMoreLessClick(r,e,a))})}onShowMoreLessClick(e,t,a){e.preventDefault();const r=a?this.facetPaginationStepMobile:this.facetPaginationStep,i=a?this.facetLimits:this.facetLimitsMobile;i[t.name]===void 0?i[t.name]=r*2:i[t.name]<=t.values.length?(oe.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),i[t.name]=i[t.name]+r):(oe.setAccessibilityText(`Less Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),i[t.name]=r),this.generateTemplateData(a),this.renderMainTemplate(this.generateTemplateData())}renderMainTemplate(e,t){var a,r,i,n,o,c,h,g,m,p,w;if(e&&(!be.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const S=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.mainTemplateDesktop)==null?void 0:i.template)||((n=j.facets.mainTemplateDesktop)==null?void 0:n.template);if(this.dataLayer.renderingEngine===te.mustache&&this.searchFacetsMainContainer){const L=document.activeElement;L instanceof HTMLInputElement&&L.type==="checkbox"||L!=null&&L.classList.contains("searchstax-facet-show-more-button")||L!=null&&L.classList.contains("searchstax-facet-show-less-button")?this.focusedElement=L:this.focusedElement=null,this.searchFacetsMainContainer.innerHTML=W.render(S,{...e});const T=(g=this.searchFacetsMainContainer)==null?void 0:g.querySelector("."+(((h=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.mainTemplateDesktop)==null?void 0:h.facetsContainerClass)||j.facets.mainTemplateDesktop.facetsContainerClass));if(T){T.innerHTML="";for(const A of e.facets)this.createFacetItem(A,T);if(this.searchFacetsMainContainer){const A=this.searchFacetsMainContainer.querySelector("."+(((w=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplateDesktop)==null?void 0:w.selectedFacetsContainerClass)||j.facets.mainTemplateDesktop.selectedFacetsContainerClass));A&&(this.createSelectedFacetsComponents(A),this.createClearFacetsComponents(A))}if(this.focusedElement){if(this.focusedElement.classList.contains("searchstax-facet-show-more-button")||this.focusedElement.classList.contains("searchstax-facet-show-less-button")){const P=this.focusedElement.getAttribute("data-focus"),I=this.searchFacetsMainContainer.querySelector(`[data-focus="${P}"]`);I instanceof HTMLElement&&I.focus(),this.focusedElement=null;return}const A=this.focusedElement.getAttribute("data-test-value"),O=this.searchFacetsMainContainer.querySelector(`[data-test-value="${A}"]`);O instanceof HTMLInputElement&&O.focus(),this.focusedElement=null}}}setTimeout(()=>{document.querySelectorAll(".searchstax-facet-title").forEach(L=>{L.setAttribute("aria-expanded",String(!0)),L.setAttribute("tabindex","0"),L.setAttribute("role","button")})},100),this.renderMobileTemplate(this.generateTemplateData(!0))}else this.generateSelectedFacetsData()}get componentFacets(){const e=this.config.facetingType;return e==="and"?this.dataLayer.searchFacetsCachedand:e==="or"?this.dataLayer.searchFacetsCachedor:e==="tabs"?this.dataLayer.searchFacetsCachedtabs:e==="showUnavailable"?this.dataLayer.searchFacetsCachedand:null}generateSelectedFacetsData(){var a;const e=[],t=this.dataLayer.searchObject.facets;for(const r of t){const i=decodeURIComponent(r.name),n=decodeURIComponent(r.value);if(this.dataLayer.searchFacets){const o=(a=this.componentFacets)==null?void 0:a.find(c=>c.name===i);if(o){const c=o.values.find(h=>h.type==="range"?!1:h.type==="checkbox"?`"${h.value}"`==`"${n}"`:!1);c&&e.push(c)}}}this.dataLayer.setSelectedFacetsTemplateData(e)}createSelectedFacetsComponents(e){var t;this.generateSelectedFacetsData(),(t=this.dataLayer.selectedFacetsTemplateData)==null||t.forEach(a=>{this.createSelectedFacetsComponent(e,a)})}createClearFacetsComponents(e){var t,a,r,i,n,o,c,h;if(typeof document<"u"){const g=this.dataLayer.searchObject,m=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.clearFacetsTemplate)==null?void 0:r.template)||((i=j.facets.clearFacetsTemplate)==null?void 0:i.template),p=document==null?void 0:document.createElement("div");p.innerHTML=W.render(m,{shouldShow:g.facets.length>0});const w=p.querySelector("."+(((c=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.clearFacetsTemplate)==null?void 0:c.containerClass)||((h=j.facets.clearFacetsTemplate)==null?void 0:h.containerClass)));w&&(w.addEventListener("click",()=>{this.removeSelectedFacets()}),w.addEventListener("keyup",S=>{(S.code==="Space"||S.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(w))}}createSelectedFacetsComponent(e,t){var a,r,i,n,o,c,h,g;if(typeof document<"u"){const m=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.selectedFacetsTemplate)==null?void 0:i.template)||((n=j.facets.selectedFacetsTemplate)==null?void 0:n.template),p=document==null?void 0:document.createElement("div");p.innerHTML=W.render(m,t);const w=p.querySelector("."+(((h=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.selectedFacetsTemplate)==null?void 0:h.containerClass)||((g=j.facets.selectedFacetsTemplate)==null?void 0:g.containerClass)));w&&(w.addEventListener("click",()=>{this.unselectFacet(t)}),w.addEventListener("keyup",S=>{(S.code==="Space"||S.code==="Enter")&&this.unselectFacet(t)}),e.appendChild(w))}}unselectFacet(e){const t=this.dataLayer.searchObject;let a=[...t.facets];e.type==="checkbox"&&(a=a.filter(r=>JSON.stringify(r)!==JSON.stringify(this.extractFacetValue(e)))),setTimeout(()=>{this.dataLayer.setSearchObject({...t,facets:a}),this.generateSelectedFacetsData()},0)}removeSelectedFacets(){const e=this.dataLayer.searchObject;this.dataLayer.setSearchObject({...e,facets:[]})}createFilterByComponent(e){var t,a,r,i,n,o,c,h;if(typeof document<"u"){const g=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.filterByTemplate)==null?void 0:r.template)||((i=j.facets.filterByTemplate)==null?void 0:i.template),m=document==null?void 0:document.createElement("div");m.innerHTML=W.render(g,{});const p=m.querySelector("."+(((c=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.filterByTemplate)==null?void 0:c.containerClass)||((h=j.facets.filterByTemplate)==null?void 0:h.containerClass)));p&&(e.prepend(p),p.addEventListener("click",this.openOverlay.bind(this)),p.addEventListener("keyup",w=>{(w.code==="Space"||w.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;oe.setAccessibilityText("Facet overlay opened. Tab to select facets."),this.overlayOpened=!0,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.add("searchstax-show"))}closeOverlay(){var e;oe.setAccessibilityText("Facet overlay closed"),this.overlayOpened=!1,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.remove("searchstax-show"))}renderMobileTemplate(e){var t,a,r,i,n,o,c,h,g,m,p,w,S,L,T,A,O,P,I;if(e&&typeof document<"u"){const y=document==null?void 0:document.createElement("div");y.classList.add("searchstax-facets-container-mobile");const b=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:r.template)||((i=j.facets.mainTemplateMobile)==null?void 0:i.template);if(this.dataLayer.renderingEngine===te.mustache){if(y.innerHTML=W.render(b,{...e,overlayOpened:this.overlayOpened}),(n=this.searchFacetsMainContainer)==null||n.appendChild(y),(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.mainTemplateMobile)for(const G of((m=(g=(h=this.config)==null?void 0:h.templates)==null?void 0:g.mainTemplateMobile)==null?void 0:m.closeOverlayTriggerClasses)||[]){const se=y.querySelector("."+G);se&&(se.addEventListener("click",this.closeOverlay.bind(this)),se.addEventListener("keyup",pe=>{(pe.code==="Space"||pe.code==="Enter")&&this.closeOverlay()}))}else for(const G of j.facets.mainTemplateMobile.closeOverlayTriggerClasses){const se=y.querySelector("."+G);se&&(se.addEventListener("click",this.closeOverlay.bind(this)),se.addEventListener("keyup",pe=>{(pe.code==="Space"||pe.code==="Enter")&&this.closeOverlay()}))}const M=y.querySelector("."+(((S=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.mainTemplateMobile)==null?void 0:S.filterByContainerClass)||j.facets.mainTemplateMobile.filterByContainerClass));M&&this.createFilterByComponent(M);const E=y.querySelector("."+(((A=(T=(L=this.config)==null?void 0:L.templates)==null?void 0:T.mainTemplateMobile)==null?void 0:A.selectedFacetsContainerClass)||j.facets.mainTemplateMobile.selectedFacetsContainerClass));E&&(this.createSelectedFacetsComponents(E),this.createClearFacetsComponents(E));const N=y.querySelector("."+(((I=(P=(O=this.config)==null?void 0:O.templates)==null?void 0:P.mainTemplateMobile)==null?void 0:I.facetsContainerClass)||j.facets.mainTemplateMobile.facetsContainerClass));if(N){N.innerHTML="";for(const G of e.facets)this.createFacetItem(G,N,!0)}}}}}class Wn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"previousButtonClass");u(this,"nextButtonClass");u(this,"loadMoreButtonClass");u(this,"routerHelper");u(this,"searchPaginationMainContainer",null);var t,a,r,i,n,o,c,h,g;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.previousButtonClass=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:r.previousButtonClass)??j.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((o=(n=(i=this.config)==null?void 0:i.templates)==null?void 0:n.mainTemplate)==null?void 0:o.nextButtonClass)??j.pagination.mainTemplate.nextButtonClass,this.loadMoreButtonClass=((g=(h=(c=this.config)==null?void 0:c.templates)==null?void 0:h.infiniteScrollTemplate)==null?void 0:g.loadMoreButtonClass)??j.pagination.infiniteScrollTemplate.loadMoreButtonClass,typeof document<"u"&&(this.searchPaginationMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}get isFirstPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)===1}get isLastPage(){return this.dataLayer.parsedData.data.isLastPage}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){var t,a,r,i;const e={...this.dataLayer.parsedData.data,previousPageLink:(a=this.routerHelper)==null?void 0:a.searchObjectToUrl({...this.dataLayer.searchObject,page:((t=this.dataLayer.searchObject)==null?void 0:t.page)-1}),nextPageLink:(i=this.routerHelper)==null?void 0:i.searchObjectToUrl({...this.dataLayer.searchObject,page:((r=this.dataLayer.searchObject)==null?void 0:r.page)+1})};return this.dataLayer.setPaginationData(e),e}goToPage(e,t){const a=this.dataLayer.searchObject;a&&(a.page=e,this.dataLayer.setSearchObject(a));const r=document.querySelector(".searchstax-page-layout-result-container");if(r instanceof HTMLElement){const i=r.querySelector('[tabindex="0"]');i instanceof HTMLElement&&i.focus()}else document.body.tabIndex=-1,document.body.focus();t||(r instanceof HTMLElement?r.scrollIntoView({block:"start",behavior:"auto"}):window==null||window.scrollTo(0,0))}nextPage(e){var t;e==null||e.preventDefault(),e==null||e.stopPropagation(),this.isLastPage||this.goToPage(((t=this.dataLayer.searchObject)==null?void 0:t.page)+1,this.dataLayer.isInfiniteScroll)}previousPage(e){var t;e==null||e.preventDefault(),e==null||e.stopPropagation(),this.isFirstPage||this.goToPage(((t=this.dataLayer.searchObject)==null?void 0:t.page)-1)}overridePaginationEvents(){if(this.searchPaginationMainContainer){const e=this.searchPaginationMainContainer.querySelector("."+this.previousButtonClass),t=this.searchPaginationMainContainer.querySelector("."+this.nextButtonClass),a=this.searchPaginationMainContainer.querySelector("."+this.loadMoreButtonClass);e&&(e.addEventListener("click",this.previousPage.bind(this)),e.addEventListener("keydown",r=>{(r.code==="Space"||r.code==="Enter")&&this.previousPage(r)})),t&&(t.addEventListener("click",this.nextPage.bind(this)),t.addEventListener("keydown",r=>{(r.code==="Space"||r.code==="Enter")&&this.nextPage(r)})),a&&(a.addEventListener("click",this.nextPage.bind(this)),a.addEventListener("keydown",r=>{(r.code==="Space"||r.code==="Enter")&&this.nextPage(r)}))}}renderMainTemplate(e){var a,r,i,n,o,c,h,g,m,p;this.searchPaginationMainContainer&&((a=this.searchPaginationMainContainer.querySelector("."+this.previousButtonClass))==null||a.removeEventListener("click",this.previousPage),(r=this.searchPaginationMainContainer.querySelector("."+this.nextButtonClass))==null||r.removeEventListener("click",this.nextPage));let t=((o=(n=(i=this.config)==null?void 0:i.templates)==null?void 0:n.mainTemplate)==null?void 0:o.template)||((c=j.pagination.mainTemplate)==null?void 0:c.template);this.dataLayer.isInfiniteScroll&&(t=((m=(g=(h=this.config)==null?void 0:h.templates)==null?void 0:g.infiniteScrollTemplate)==null?void 0:m.template)||((p=j.pagination.infiniteScrollTemplate)==null?void 0:p.template)),this.dataLayer.renderingEngine===te.mustache&&(this.searchPaginationMainContainer.innerHTML=W.render(t,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class Vn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"relatedSearchesContainerClass");u(this,"searchRelatedSearchesMainContainer",null);u(this,"track");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.relatedSearchesContainerClass=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.relatedSearchesContainerClass)||j.relatedSearches.main.relatedSearchesContainerClass,typeof document<"u"&&(this.searchRelatedSearchesMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.track=e.trackRelatedSearchClick,this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchRelatedSearches.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setRelatedSearchesData(e),e}addRelatedSearchComponent(e,t){var a,r,i,n,o;if(typeof document<"u"){const c=document==null?void 0:document.createElement("div"),h=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.relatedSearch)==null?void 0:i.template)||j.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===te.mustache){c.innerHTML=W.render(h,e);const g=c.querySelector("."+(((o=(n=this.config.templates)==null?void 0:n.relatedSearch)==null?void 0:o.relatedSearchContainerClass)||j.relatedSearches.relatedSearch.relatedSearchContainerClass));g&&(t.appendChild(g),g.addEventListener("click",()=>{this.executeSearch(e)}),g.addEventListener("keyup",m=>{(m.code==="Space"||m.code==="Enter")&&this.executeSearch(e)}))}}}executeSearch(e){const t=this.dataLayer.searchObject;t.query=e.related_search,this.dataLayer.setSearchObject(t),this.track(e)}renderMainTemplate(e){var a,r,i,n;const t=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.main)==null?void 0:i.template)||j.relatedSearches.main.template;if(this.dataLayer.renderingEngine===te.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=W.render(t,e);const o=(n=this.searchRelatedSearchesMainContainer)==null?void 0:n.querySelector(`.${this.relatedSearchesContainerClass}`);if(o)for(const c of e.relatedSearches)this.addRelatedSearchComponent(c,o)}}}class Qn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"searchFeedbackMainContainer",null);u(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.searchTrigger=e.searchTrigger,typeof document<"u"&&(this.searchFeedbackMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchFeedbackData(e),e}onOriginalQueryClick(e){var a;e.stopPropagation(),e.preventDefault();const t=(a=e.target)==null?void 0:a.innerHTML;this.searchTrigger(t,!0)}attachClick(){var t,a,r,i,n;const e=(n=this.searchFeedbackMainContainer)==null?void 0:n.querySelector("."+(((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.main)==null?void 0:r.originalQueryClass)||((i=j.searchFeedback.main)==null?void 0:i.originalQueryClass)));e&&e.addEventListener("click",this.onOriginalQueryClick.bind(this))}renderMainTemplate(e){var a,r,i;const t=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.main)==null?void 0:i.template)||j.searchFeedback.main.template;this.dataLayer.renderingEngine===te.mustache&&(this.searchFeedbackMainContainer.innerHTML=W.render(t,e),setTimeout(()=>{this.attachClick()},0))}}class Bn{constructor(e){u(this,"searchHelper");u(this,"dataLayer");u(this,"config");u(this,"suggestAfterMinChars");u(this,"containerId");u(this,"currentInputValue","");u(this,"autosuggestResults");u(this,"suppressNextEnter",!1);u(this,"searchInput");u(this,"actionButton");u(this,"autosuggestContainer");u(this,"clearButton");u(this,"separatorIcon");u(this,"buttonState","search");u(this,"selectedAutosuggestItem",-1);u(this,"suggestTrigger");u(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.searchTrigger=e.searchTrigger,this.suggestTrigger=e.suggestTrigger,this.containerId=e.containerId,this.suggestAfterMinChars=e.config.suggestAfterMinChars,this.suggestAfterMinChars===void 0&&this.getSuggestAfterValue(),this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.renderMainTemplate(),this.actionButtonInit(),this.updateActionButtonState("search"),this.searchInput&&(this.createAutosuggestContainer(),this.attachSubscriptions())},200)}renderMainTemplate(){var e,t,a,r;if(typeof document<"u"){const i=document==null?void 0:document.getElementById(this.containerId);if(!i)throw new Error("Search input container not found");const n=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||j.searchInput.mainTemplate.template,o={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled,hasInputValue:!1};if(this.dataLayer.setInputWidgetTemplateData(o),this.dataLayer.renderingEngine===te.mustache){const g=W.render(n,o);i.innerHTML=g,this.dataLayer.setInputTemplateRendered(!0)}const c=((r=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:r.searchInputId)||j.searchInput.mainTemplate.searchInputId,h=document==null?void 0:document.querySelector(`#${c}`);if(h)this.searchInput=h,h.addEventListener("keyup",this.inputKeyupEvent.bind(this)),h.addEventListener("blur",this.hideAutosuggest.bind(this)),h.addEventListener("paste",this.inputPasteEvent.bind(this));else throw new Error("Input not found")}}createAutosuggestContainer(){var e;this.dataLayer.renderingEngine===te.mustache&&typeof document<"u"&&(this.autosuggestContainer=document==null?void 0:document.createElement("div"),this.autosuggestContainer.classList.add("searchstax-autosuggest-container"),this.autosuggestContainer.addEventListener("mouseleave",()=>{this.resetAutosuggestSelection(),this.markActiveAutosuggestItem()}),(e=this.searchInput)==null||e.after(this.autosuggestContainer))}getSuggestAfterValue(){this.dataLayer.searchHelper&&this.dataLayer.searchHelper.suggest("*",e=>{this.suggestAfterMinChars=e.metadata.minPrefixChars},[])}actionButtonInit(){typeof document<"u"&&(this.actionButton=document==null?void 0:document.getElementById("searchstax-search-input-action-button"),this.actionButton&&this.actionButton.addEventListener("click",()=>{var e;this.executeSearch(((e=this.searchInput)==null?void 0:e.value)??"")}),this.clearButton=document==null?void 0:document.getElementById("searchstax-clear-input-action-button"),this.separatorIcon=document==null?void 0:document.getElementById("searchstax-separator-icon"),this.clearButton&&this.clearButton.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.clearInput()}))}updateClearButtonVisibility(e){var r,i,n,o;const t=e.length>0;t?((r=this.clearButton)==null||r.classList.remove("hidden"),(i=this.separatorIcon)==null||i.classList.remove("hidden")):((n=this.clearButton)==null||n.classList.add("hidden"),(o=this.separatorIcon)==null||o.classList.add("hidden"));const a=this.dataLayer.inputWidgetTemplateData;a&&this.dataLayer.setInputWidgetTemplateData({...a,hasInputValue:t})}attachSubscriptions(){this.dataLayer.$searchTermChange.subscribe(()=>{this.handleSearchTermChange()}),this.dataLayer.$loadingChange.subscribe(()=>{this.handleLoadingChange()}),this.dataLayer.$searchAutosuggest.subscribe(e=>{e&&this.appendSuggestions(e)}),this.dataLayer.$searchObject.subscribe(e=>{e.query!=="undefined"&&e.query!==void 0&&e.query!=="*"&&this.searchInput&&(this.searchInput.value=this.cleanSuggestionTerm(e.query??""),this.updateClearButtonVisibility(this.searchInput.value))})}handleLoadingChange(){this.dataLayer.loading?this.updateActionButtonState("loading"):this.handleSearchTermChange()}handleSearchTermChange(){this.updateActionButtonState("search")}updateActionButtonState(e){if(this.buttonState=e,this.actionButton)switch(this.actionButton.classList.remove("searchstax-spinner-icon"),this.actionButton.classList.remove("searchstax-search-icon"),e){case"loading":this.actionButton.classList.add("searchstax-spinner-icon");break;case"search":this.actionButton.classList.add("searchstax-search-icon"),this.actionButton.setAttribute("aria-label","search");break}}selectPreviousAutosuggestItem(e){var t;this.selectedAutosuggestItem>0?this.selectedAutosuggestItem--:this.selectedAutosuggestItem===0?(this.selectedAutosuggestItem=-1,e&&(e!=null&&e.focus)&&((t=e==null?void 0:e.focus)==null||t.call(e),e.setSelectionRange(e.value.length,e.value.length)),oe.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=this.autosuggestResults.suggestions.length-1,this.markActiveAutosuggestItem()}selectNextAutosuggestItem(){this.selectedAutosuggestItem<this.autosuggestResults.suggestions.length-1?this.selectedAutosuggestItem++:this.selectedAutosuggestItem===this.autosuggestResults.suggestions.length-1?(this.selectedAutosuggestItem=-1,oe.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=0,this.markActiveAutosuggestItem()}resetAutosuggestSelection(){this.selectedAutosuggestItem=-1,this.markActiveAutosuggestItem()}clearInput(){var e;this.suppressNextEnter=!0,this.searchInput&&(this.searchInput.value="",this.currentInputValue=""),this.updateClearButtonVisibility(""),this.hideAutosuggest(),(e=this.searchInput)==null||e.focus()}markActiveAutosuggestItem(){if(typeof document<"u"){const e=document==null?void 0:document.getElementsByClassName("searchstax-autosuggest-item");for(let t=0;t<e.length;t++){const a=e[t];t===this.selectedAutosuggestItem?(a.classList.add("active"),oe.setAccessibilityText(`Selected suggestion: ${a.innerText}`)):a.classList.remove("active")}}}inputKeyupEvent(e){const t=e.key;if(this.currentInputValue=e.target.value,t==="Enter"){if(this.suppressNextEnter){this.suppressNextEnter=!1;return}this.suggestionChosen()}else this.suppressNextEnter=!1,t==="Escape"?this.hideAutosuggest(e.target):t==="ArrowUp"?this.selectPreviousAutosuggestItem(e.target):t==="ArrowDown"?this.selectNextAutosuggestItem():this.autosuggestHandling(e);this.handleSearchTermChange(),this.updateClearButtonVisibility(this.currentInputValue)}autosuggestHandling(e){this.suggestAfterMinChars&&e.target&&e.target.value.length>=this.suggestAfterMinChars?this.executeSuggest(e.target.value):this.hideAutosuggest()}inputPasteEvent(e){setTimeout(()=>{this.autosuggestHandling(e),this.handleSearchTermChange(),this.updateClearButtonVisibility(e.target.value)},0)}executeSuggest(e){this.suggestTrigger(e)}executeSearch(e){this.hideAutosuggest(),this.searchTrigger(e===""?"*":e)}suggestionChosen(){this.selectedAutosuggestItem>-1?this.autosuggestItemClicked(this.autosuggestResults.suggestions[this.selectedAutosuggestItem]):this.executeSearch(this.currentInputValue)}hideAutosuggest(e){setTimeout(()=>{var t;this.dataLayer.setAutosuggestResults({numFound:0,suggestions:[]}),this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.add("hidden")),this.resetAutosuggestSelection(),e&&(e!=null&&e.focus)&&((t=e==null?void 0:e.focus)==null||t.call(e),e.setSelectionRange(e.value.length,e.value.length)),oe.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return le.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}autosuggestItemClicked(e){this.searchInput.value=this.cleanSuggestionTerm(e.term??""),this.executeSearch(this.cleanSuggestionTerm(e.term))}createAutosuggestItem(e){var r,i,n;const t=document==null?void 0:document.createElement("div");t.classList.add("searchstax-autosuggest-item"),t.addEventListener("click",()=>{this.autosuggestItemClicked(e)}),t.addEventListener("mouseenter",()=>{this.onSuggestionEnter(e)});const a=((i=(r=this.config.templates)==null?void 0:r.autosuggestItemTemplate)==null?void 0:i.template)||((n=j.searchInput.autosuggestItemTemplate)==null?void 0:n.template);return t.innerHTML=W.render(a,e),t}onSuggestionEnter(e){var t;this.selectedAutosuggestItem=((t=this.autosuggestResults)==null?void 0:t.suggestions.indexOf(e))||0,this.markActiveAutosuggestItem()}appendSuggestions(e){this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.remove("hidden"));for(const t in e.suggest)if(Object.prototype.hasOwnProperty.call(e.suggest,t)){const a=e.suggest[t];for(const r in a)if(Object.prototype.hasOwnProperty.call(a,r)){const i=a[r];i.numFound?oe.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):oe.setAccessibilityText("",0),this.autosuggestResults=i,this.dataLayer.setAutosuggestResults(i),i.numFound>0?i.suggestions.forEach(n=>{this.autosuggestContainer&&typeof document<"u"&&this.autosuggestContainer.appendChild(this.createAutosuggestItem(n))}):this.autosuggestContainer&&this.autosuggestContainer.classList.add("hidden")}}}}class Hn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"linkClickCallback");u(this,"searchCallback");u(this,"containerId");u(this,"searchResultsMainContainer");u(this,"searchResultsContainer");u(this,"searchResultLinks",[]);this.linkClickCallback=e.linkClickCallback,this.searchCallback=e.searchTrigger,this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId;const t=document==null?void 0:document.getElementById(this.containerId);if(t)this.searchResultsMainContainer=t;else throw new Error(`Search Results Main Container with id ${this.containerId} not found`);this.dataLayer.setIsInfiniteScroll(e.config.renderMethod==="infiniteScroll"),this.initializeSubscriptions(),this.renderMainTemplate()}initializeSubscriptions(){this.dataLayer.$searchObject.subscribe(()=>{oe.setAccessibilityText("Searching...")}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.searchResultsContainer&&this.renderResults(e)})}changeTemplate(){this.dataLayer.searchResults&&this.renderResults(this.dataLayer.searchResults)}renderNoResultsTemplate(){var a,r,i,n,o;const e=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.noSearchResultTemplate)==null?void 0:i.template)||((n=j.searchResults.noSearchResultTemplate)==null?void 0:n.template),t=((o=this.dataLayer.searchResultsMetadata)==null?void 0:o.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===te.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=W.render(e,{spellingSuggestion:t,...this.dataLayer.parsedData.data,searchCallback:this.searchCallback.bind(this)})),t&&this.searchResultsContainer){const c=this.searchResultsContainer.querySelector("a");c&&c.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),this.searchCallback(t)})}}renderResults(e){var t,a,r,i,n;if(this.dataLayer.renderingEngine===te.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)oe.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{oe.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const o=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:r.template)||((i=j.searchResults.searchResultTemplate)==null?void 0:i.template),c=e.map(h=>W.render(o,h));((n=this.config)==null?void 0:n.renderMethod)==="infiniteScroll"&&this.dataLayer.searchObject.page>1?this.searchResultsContainer.innerHTML+=c.join(""):this.searchResultsContainer.innerHTML=c.join(""),this.searchResultLinks=Array.from(this.searchResultsContainer.querySelectorAll(`[${this.uniqueIdAttribute}]`)),this.attachLinkClickEvents()}}removeLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.removeEventListener("click",()=>{}),e.removeEventListener("keydown",()=>{})})}get uniqueIdAttribute(){var e,t,a,r;return((a=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.searchResultTemplate)==null?void 0:a.searchResultUniqueIdAttribute)||((r=j.searchResults.searchResultTemplate)==null?void 0:r.searchResultUniqueIdAttribute)}attachLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const a=e.getAttribute(this.uniqueIdAttribute)??"";a&&this.linkClickCallback(a)}),e.addEventListener("keydown",t=>{if(t.code==="Space"||t.code==="Enter"){const a=e.getAttribute(this.uniqueIdAttribute)??"";a&&this.linkClickCallback(a)}})})}renderMainTemplate(){var t,a,r,i;const e=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:r.template)||((i=j.searchResults.mainTemplate)==null?void 0:i.template);this.dataLayer.renderingEngine===te.mustache&&(this.searchResultsMainContainer.innerHTML=W.render(e,{}),setTimeout(()=>{var c,h,g,m,p,w,S;const n=(g=(h=(c=this.config)==null?void 0:c.templates)==null?void 0:h.mainTemplate)!=null&&g.searchResultsContainerId?(w=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplate)==null?void 0:w.searchResultsContainerId:(S=j.searchResults.mainTemplate)==null?void 0:S.searchResultsContainerId,o=document==null?void 0:document.getElementById(n);if(o)this.searchResultsContainer=o;else throw new Error(`Search Results Container with id ${n} not found`)},0))}}class Un{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"selectId");u(this,"searchSortingMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.selectId=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.selectId)||j.sorting.main.selectId,this.searchSortingMainContainer=document==null?void 0:document.getElementById(this.containerId),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchSortingData(e),e}setOrderQuery(e){const t=this.dataLayer.searchObject;t&&(t.order=e,this.dataLayer.setSearchObject(t))}markOptionSelected(){const e=document==null?void 0:document.getElementById(this.selectId);if(e){const t=e.querySelector(`option[value="${decodeURIComponent(this.dataLayer.searchObject.order)}"]`);t&&(t.selected=!0)}}renderMainTemplate(e){var a,r,i;const t=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.main)==null?void 0:i.template)||j.sorting.main.template;if(this.dataLayer.renderingEngine===te.mustache){this.searchSortingMainContainer.innerHTML=W.render(t,e),this.markOptionSelected();const n=document==null?void 0:document.getElementById(this.selectId);n&&n.addEventListener("change",o=>{this.setOrderQuery(o.target.value)})}}}class qn{constructor(e){u(this,"analyticsKey");u(this,"containerId");u(this,"mainContainer");u(this,"isLightweight");u(this,"emailOverride");u(this,"feedbackTextAreaOverride");u(this,"mainTemplateOverride");u(this,"lightweightTemplateOverride");u(this,"focusedElement",null);u(this,"focusTrapListener",null);u(this,"lastFocusedElementBeforeModal",null);u(this,"templateData",{feedbackOpen:!1,ratings:[{index:1,isSelected:!1},{index:2,isSelected:!1},{index:3,isSelected:!1},{index:4,isSelected:!1},{index:5,isSelected:!1},{index:6,isSelected:!1},{index:7,isSelected:!1},{index:8,isSelected:!1},{index:9,isSelected:!1},{index:10,isSelected:!1}],emailInput:"",feedbackTextArea:"",charactersLeft:2e3,maxLength:2e3,errors:{rating:!1,email:!1},submitted:!1,thumbsUpActive:!1,thumbsDownActive:!1});u(this,"thumbsUpValue",10);u(this,"thumbsDownValue",1);u(this,"ratedQuestion","");u(this,"language","");u(this,"model","");u(this,"analyticsSrc","");this.analyticsKey=e.analyticsKey,this.containerId=e.containerId??"sf-feedback",this.isLightweight=e.lightweight??!1,this.isLightweight&&this.templateData.ratings.unshift({index:0,isSelected:!1}),this.thumbsUpValue=e.thumbsUpValue??10,this.thumbsDownValue=e.thumbsDownValue??1,this.emailOverride=e.emailOverride,this.feedbackTextAreaOverride=e.feedbackTextAreaOverride,this.mainTemplateOverride=e.mainTemplateOverride,this.lightweightTemplateOverride=e.lightweightTemplateOverride,this.mainContainer=document.getElementById(this.containerId),this.language=e.language??"",this.model=e.model??"",this.analyticsSrc=e.analyticsSrc??"",this.init()}init(){Ce.attachAnalyticsScript(this.analyticsSrc),this.renderMainTemplate(this.generateTemplateData())}generateTemplateData(){return this.templateData}renderMainTemplate(e){var r,i;const t=document.activeElement;(t instanceof HTMLInputElement||t instanceof HTMLButtonElement||t instanceof HTMLTextAreaElement||t instanceof HTMLAnchorElement)&&(t.type==="radio"||t.type==="button"||t.type==="textarea"||t instanceof HTMLAnchorElement)?this.focusedElement=t:this.focusedElement=null,this.mainContainer;let a=(r=re==null?void 0:re.mainTemplate)==null?void 0:r.template;if(this.mainTemplateOverride&&(a=this.mainTemplateOverride),this.isLightweight&&(a=(i=re.lightweightTemplate)==null?void 0:i.template,this.lightweightTemplateOverride&&(a=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=W.render(a,e),this.focusedElement&&this.mainContainer){const n=this.focusedElement.type==="radio"?this.focusedElement.getAttribute("id"):this.focusedElement.getAttribute("class"),o=this.focusedElement.type==="radio"?"id":"class",c=this.mainContainer.querySelector(`[${o}="${n}"]`);(c instanceof HTMLInputElement||c instanceof HTMLButtonElement||c instanceof HTMLTextAreaElement||c instanceof HTMLAnchorElement)&&c.focus(),this.focusedElement=null}this.attachEvents()}attachEvents(){this.isLightweight?this.attachLightweightEvents():(this.attachOpenModalEvent(),this.closeModalEvent(),this.attachRatingEvents(),this.attachTextAreaEvents(),this.attachEmailInputEvents(),this.attachSubmitButtonEvents())}attachFocusTrap(){this.focusTrapListener&&document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=e=>{if(!this.templateData.feedbackOpen)return;const t=this.getModalElement();if(!t)return;const a=this.getFocusableElements(t);if(a.length===0)return;const r=a[0],i=a[a.length-1];e.key==="Tab"&&(e.shiftKey?(document.activeElement===r||!t.contains(document.activeElement))&&(e.preventDefault(),i==null||i.focus()):(document.activeElement===i||!t.contains(document.activeElement))&&(e.preventDefault(),r==null||r.focus())),e.key==="Escape"&&(e.preventDefault(),this.closeFeedbackModal())},document.addEventListener("keydown",this.focusTrapListener)}getFocusableElements(e){const t=["button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");return Array.from(e.querySelectorAll(t))}getModalElement(){var t,a;const e=(t=re.mainTemplate)==null?void 0:t.modalContainerClass;return((a=this.mainContainer)==null?void 0:a.querySelector(`.${e}`))||null}attachLightweightEvents(){var i,n,o,c;const e=(i=re.lightweightTemplate)==null?void 0:i.thumbsUpButtonClass,t=(n=re.lightweightTemplate)==null?void 0:n.thumbsDownButtonClass,a=(o=this.mainContainer)==null?void 0:o.querySelector("."+e),r=(c=this.mainContainer)==null?void 0:c.querySelector("."+t);a&&a.addEventListener("click",()=>{const h=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[this.templateData.ratings.length-1].isSelected&&this.ratedQuestion===h||(this.templateData.thumbsUpActive=!0,this.templateData.thumbsDownActive=!1,this.templateData.ratings.forEach(g=>{g.isSelected=g.index===this.thumbsUpValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=h,this.submit())}),r&&r.addEventListener("click",()=>{const h=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[0].isSelected&&this.ratedQuestion===h||(this.templateData.thumbsUpActive=!1,this.templateData.thumbsDownActive=!0,this.templateData.ratings.forEach(g=>{g.isSelected=g.index===this.thumbsDownValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=h,this.submit())})}attachSubmitButtonEvents(){var a,r;const e=(a=re.mainTemplate)==null?void 0:a.submitButtonClass,t=(r=this.mainContainer)==null?void 0:r.querySelector("."+e);t&&t.addEventListener("click",()=>{this.checkIfValid()})}checkIfValid(){var t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=re.mainTemplate)==null?void 0:t.emailInputId));this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,oe.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(r=>r.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,oe.setAccessibilityText("Please Rate your experience.")),this.templateData.errors.rating||this.templateData.errors.email?this.renderMainTemplate(this.generateTemplateData()):this.submit()}submit(){var t,a,r;this.templateData.submitted=!0;const e=(t=this.templateData.ratings.find(i=>i.isSelected))==null?void 0:t.index;e!==void 0&&(Ce.trackFeedback({trackApiKey:this.analyticsKey,email:this.emailOverride&&this.isLightweight?this.emailOverride():this.templateData.emailInput,rating:e,feedback:this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea,model:this.model?this.model:void 0,language:this.language?this.language:void 0}),this.showCheckmarkAnimation(),oe.setAccessibilityText("Feedback has been sent.",1e3),(r=this.mainContainer)!=null&&r.querySelector("."+((a=re.mainTemplate)==null?void 0:a.checkmarkClass))?setTimeout(()=>{this.closeFeedbackModal(),this.renderMainTemplate(this.generateTemplateData())},2e3):(setTimeout(()=>{this.closeFeedbackModal()},500),this.renderMainTemplate(this.generateTemplateData())))}validateEmail(e){return e===""?!0:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}attachEmailInputEvents(){var t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=re.mainTemplate)==null?void 0:t.emailInputId));e&&(e.addEventListener("input",()=>{this.templateData.emailInput=e.value}),e.addEventListener("blur",()=>{setTimeout(()=>{this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,oe.setAccessibilityText("Please enter a valid email address.")),this.renderMainTemplate(this.generateTemplateData())},300)}))}attachTextAreaEvents(){var t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=re.mainTemplate)==null?void 0:t.feedbackTextAreaId));e&&e.addEventListener("input",()=>{var i,n;this.templateData.feedbackTextArea=e.value,this.templateData.charactersLeft=this.templateData.maxLength-e.value.length;const r=(n=this.mainContainer)==null?void 0:n.querySelector("."+((i=re.mainTemplate)==null?void 0:i.charactersRemainingContainerclass));r&&(r.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var a,r;const e=(a=re.mainTemplate)==null?void 0:a.ratingInputclass,t=(r=this.mainContainer)==null?void 0:r.querySelectorAll("."+e);t&&t.forEach(i=>{i.addEventListener("click",n=>{const o=n.target.value;this.templateData.ratings.forEach(c=>{c.isSelected=c.index+""===o}),this.templateData.errors.rating=!1,this.renderMainTemplate(this.generateTemplateData())})})}attachOpenModalEvent(){var a,r;const e=(a=re.mainTemplate)==null?void 0:a.openModalButtonClass,t=(r=this.mainContainer)==null?void 0:r.querySelector("."+e);t&&t.addEventListener("click",i=>{i.preventDefault(),this.toggleModal()})}toggleModal(){this.templateData.feedbackOpen?this.closeFeedbackModal():this.openFeedbackModal()}closeModalEvent(){var a,r;const e=(a=re.mainTemplate)==null?void 0:a.closeModalButtonClass,t=(r=this.mainContainer)==null?void 0:r.querySelector("."+e);t&&t.addEventListener("click",()=>{this.closeFeedbackModal()})}openFeedbackModal(){this.lastFocusedElementBeforeModal=document.activeElement,this.templateData.feedbackOpen=!0,this.renderMainTemplate(this.generateTemplateData()),setTimeout(()=>{const e=this.getModalElement();if(e){const t=this.getFocusableElements(e);t.length>0&&t[0].focus()}this.attachFocusTrap()},0),oe.setAccessibilityText("Feedback form opened",1e3)}closeFeedbackModal(){this.templateData.feedbackOpen=!1,this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null),this.renderMainTemplate(this.generateTemplateData()),this.lastFocusedElementBeforeModal&&(this.lastFocusedElementBeforeModal.focus(),this.lastFocusedElementBeforeModal=null),oe.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var o,c,h,g,m,p;const e=(o=re.mainTemplate)==null?void 0:o.submitButtonClass,t=(c=this.mainContainer)==null?void 0:c.querySelector("."+e);t&&(t.disabled=!0);const a=(h=re.mainTemplate)==null?void 0:h.checkmarkClass,r=(g=this.mainContainer)==null?void 0:g.querySelector("."+a);r&&r.classList.remove("hidden");const i=(m=re.mainTemplate)==null?void 0:m.submitButtonTextClass,n=(p=this.mainContainer)==null?void 0:p.querySelector("."+i);n&&n.classList.add("visibility"),setTimeout(()=>{r&&r.classList.add("hidden"),n&&n.classList.remove("visibility"),t&&(t.disabled=!1)},2e3)}destroy(){this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null)}}class Yn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"answerContainer",null);u(this,"showMoreVisible",!1);u(this,"renderFeedbackWidget",!1);u(this,"clicked",!1);u(this,"renderedWithShowMore",!1);u(this,"showMoreListenerAttached",!1);var t;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.renderFeedbackWidget=((t=this.config.feedbackwidget)==null?void 0:t.renderFeedbackWidget)||!1,this.config.showMoreAfterWordCount&&(this.dataLayer.answerWidgetShowMoreLimit=this.config.showMoreAfterWordCount),typeof document<"u"&&(this.answerContainer=document==null?void 0:document.getElementById(this.containerId),this.attachShowMoreClickListener()),this.config.testString?(this.showMoreVisible=this.dataLayer.parsedData.shouldShowAnswerLoadMore,this.renderMainTemplate(this.generateTemplateData())):this.initializeSubscriptions(),this.dataLayer.setIsAnswerWidgetCreated(!0)}initializeSubscriptions(){this.dataLayer.$answer.subscribe(()=>{this.clicked?this.showMoreVisible=!1:this.showMoreVisible=this.dataLayer.parsedData.shouldShowAnswerLoadMore,this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answerLoading.subscribe(()=>{this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answerError.subscribe(e=>{e&&setTimeout(()=>{this.renderMainTemplate(this.generateTemplateData())},100)}),this.dataLayer.$searchObject.subscribe(()=>{this.clicked=!1,this.renderedWithShowMore=!1,this.showMoreVisible=!1}),this.dataLayer.$paginationData.subscribe(()=>{this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answer.subscribe(e=>{e&&setTimeout(()=>{this.initializeWidget()},600)}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.dataLayer.$answer.getValue()&&setTimeout(()=>{this.initializeWidget()},600)})}searchstaxFeedbackTextAreaOverride(){return"Question: "+(this.dataLayer.searchObject.query==="undefined"?"":this.dataLayer.searchObject.query)+" Answer: "+this.dataLayer.parsedData.getAnswerData}initializeWidget(){var e,t,a,r,i;this.renderFeedbackWidget&&document.getElementById("feedbackWidgetContainer")&&!this.dataLayer.answerLoading&&new qn({analyticsKey:this.dataLayer.parsedData.trackingData.trackApiKey,containerId:"feedbackWidgetContainer",lightweight:!0,model:this.dataLayer.parsedData.trackingData.model,language:this.dataLayer.parsedData.trackingData.language,emailOverride:(e=this.config.feedbackwidget)==null?void 0:e.emailOverride,feedbackTextAreaOverride:((t=this.config.feedbackwidget)==null?void 0:t.searchstaxFeedbackTextAreaOverride)??this.searchstaxFeedbackTextAreaOverride.bind(this),thumbsUpValue:((a=this.config.feedbackwidget)==null?void 0:a.thumbsUpValue)??10,thumbsDownValue:((r=this.config.feedbackwidget)==null?void 0:r.thumbsDownValue)??0,lightweightTemplateOverride:(i=this.config.feedbackwidget)==null?void 0:i.lightweightTemplateOverride})}showMore(e){e.preventDefault(),this.clicked=!0,this.showMoreVisible=!1,Ce.trackShowMoreClick({...this.dataLayer.parsedData.trackingData}),this.renderMainTemplate(this.generateTemplateData()),this.config.testString||setTimeout(()=>{this.initializeWidget()},600)}attachShowMoreClickListener(){!this.answerContainer||this.showMoreListenerAttached||(this.showMoreListenerAttached=!0,this.answerContainer.addEventListener("click",e=>{var t,a;(a=(t=e.target)==null?void 0:t.closest)!=null&&a.call(t,".searchstax-answer-load-more-button")&&this.showMore(e)}))}trackLinkClick(e){e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("href");Ce.trackAnswerLinkClick({href:t,answer:this.dataLayer.parsedData.getAnswerData,...this.dataLayer.parsedData.trackingData}).then(()=>{window.open(t,"_blank")}).catch(()=>{window.open(t,"_blank")})}attachLinkTracking(){document.querySelectorAll(".searchstax-answer-link").forEach(e=>{e.getAttribute("listener")!=="true"&&(e.setAttribute("listener","true"),e.addEventListener("click",this.trackLinkClick.bind(this)))})}renderMainTemplate(e){var a,r,i;const t=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.main)==null?void 0:i.template)||j.answer.main.template;this.dataLayer.renderingEngine===te.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=W.render(t,e),setTimeout(()=>{this.attachLinkTracking()},100)):setTimeout(()=>{this.attachLinkTracking()},500)}generateTemplateData(){this.config.testString&&this.dataLayer.setAnswerData(this.config.testString??"");const e={...this.dataLayer.parsedData.data,showMoreButtonVisible:this.showMoreVisible};return this.config.testString&&(e.searchExecuted=!0),this.dataLayer.setAnswerFullData(e),e}}class ir{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"currentSelectValue","");u(this,"locationInput");u(this,"radiusInput");u(this,"locationDecode");u(this,"locationDecodeCoordinatesToAddress");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.locationDecode=(t=e.config.hooks)==null?void 0:t.locationDecode,this.locationDecodeCoordinatesToAddress=(a=e.config.hooks)==null?void 0:a.locationDecodeCoordinatesToAddress,this.dataLayer.locationEnabled&&this.dataLayer.$inputTemplateRendered.subscribeUntil(()=>{this.renderMainTemplate(),this.attachSubscriptions()},!0,500)}renderMainTemplate(){var e,t,a,r,i,n,o,c;if(typeof document<"u"){const h=document==null?void 0:document.getElementById(this.containerId);if(!h)throw new Error("Search input container not found");const g=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||j.location.mainTemplate.template,m={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(m),this.dataLayer.renderingEngine===te.mustache){const p=W.render(g,m);h.innerHTML=p;const w=((r=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:r.locationInputId)||j.location.mainTemplate.locationInputId,S=document==null?void 0:document.querySelector(`#${w}`);if(S)this.locationInput=S,S.addEventListener("blur",this.blurEvent.bind(this)),S.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const L=((n=(i=this.config.templates)==null?void 0:i.mainTemplate)==null?void 0:n.radiusInputId)||j.location.mainTemplate.radiusInputId,T=document==null?void 0:document.querySelector(`#${L}`);T instanceof HTMLSelectElement&&(this.radiusInput=T,T.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const A=((c=(o=this.config.templates)==null?void 0:o.mainTemplate)==null?void 0:c.currentLocationActionButtonId)||j.location.mainTemplate.currentLocationActionButtonId,O=document==null?void 0:document.querySelector(`#${A}`);O&&O.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===te.mustache&&this.locationInput&&(this.locationInput.value=this.dataLayer.searchLocationCoordinatesDecoded)}getCurrentLocation(){navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const t=e.coords.latitude.toString(),a=e.coords.longitude.toString(),r=Math.floor(parseFloat(t)*100)/100,i=Math.floor(parseFloat(a)*100)/100;this.dataLayer.setSearchLat(r+""),this.dataLayer.setSearchLong(i+"");const n=this.locationDecodeCoordinatesToAddress;n?n(r+"",i+"").then(o=>{this.setCurrentLocationFields(o.address||"Current Location")}).catch(()=>{this.setCurrentLocationFields("Current Location")}):this.setCurrentLocationFields("Current Location")},()=>{console.error("Unable to retrieve your location")}):console.error("Geolocation is not supported by this browser.")}setRadiusValue(e){this.dataLayer.setSearchRadius(e)}radiusSelectChangeEvent(e){this.currentSelectValue=e.target.value,this.setRadiusValue(this.currentSelectValue)}attachSubscriptions(){this.dataLayer.$searchObject.subscribe(e=>{this.locationInput&&(this.locationInput.value=this.cleanSuggestionTerm(e.location.address??"")),this.radiusInput&&e.location.radius&&(this.radiusInput.value=e.location.radius||"")})}cleanSuggestionTerm(e){return le.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}triggerGeocoder(e){const t=this.locationDecode;this.dataLayer.setLocationDecodingLoading(!0),e&&this.dataLayer.searchLocation!==e&&e!==this.dataLayer.searchLocationCoordinatesDecoded?t(e).then(a=>{this.dataLayer.setSearchLocation(a.address||""),this.dataLayer.setSearchLat(a.lat||""),this.dataLayer.setSearchLong(a.lon||""),this.locationInput&&(this.locationInput.value=this.cleanSuggestionTerm(a.address||"")),this.dataLayer.renderingEngine===te.mustache&&a.error&&this.locationInput&&this.locationInput.classList.add("searchstax-input-location-error"),a.error?this.dataLayer.setLocationError(!0):this.dataLayer.setLocationError(!1),this.dataLayer.setLocationDecodingLoading(!1)}).catch(()=>{this.dataLayer.setLocationDecodingLoading(!1)}):e===""&&(this.dataLayer.setSearchLocation(void 0),this.dataLayer.setSearchLat(void 0),this.dataLayer.setSearchLong(void 0),this.dataLayer.setLocationDecodingLoading(!1))}focusEvent(e){e.target.classList.remove("searchstax-input-location-error"),this.dataLayer.setLocationError(!1)}blurEvent(e){const t=e.target.value;this.triggerGeocoder(t)}}class Jn{constructor(e=te.mustache){u(this,"routerEnabled",!1);u(this,"cachedQuery","");u(this,"routerHelper");u(this,"searchHelper");u(this,"searchResultsConfig");u(this,"searchPaginationConfig");u(this,"searchFeedbackConfig");u(this,"searchSortingConfig");u(this,"searchFacetsConfig");u(this,"relatedSearchesConfig");u(this,"externalPromotionsConfig");u(this,"searchInputWidget");u(this,"searchLocationWidget");u(this,"searchResultsWidget");u(this,"searchFacetsWidget",[]);u(this,"searchPaginationWidget");u(this,"searchFeedbackWidget");u(this,"searchSortingWidget");u(this,"relatedSearchesWidget");u(this,"externalPromotionsWidget");u(this,"answerWidget");u(this,"locationObserver",null);u(this,"dataLayer");u(this,"firstRequest",!0);u(this,"previousQuery","");u(this,"eventSource",null);u(this,"renderEngine",te.mustache);e&&(this.renderEngine=e)}setRenderingEngine(e=te.mustache){this.dataLayer.setRenderingEngine(e)}handleHooks(){var e,t;(t=(e=this.dataLayer.searchstaxConfig)==null?void 0:e.hooks)!=null&&t.afterSearch&&this.dataLayer.$searchResults.subscribe(a=>{this.dataLayer.searchstaxConfig.hooks.afterSearch(a,this.dataLayer.searchResultUnparsedData)}),setTimeout(()=>{this.dataLayer.$searchObject.subscribe(a=>{var r,i,n,o,c,h;a.query!==this.previousQuery&&this.dataLayer.setAnswerData(""),a.query!==""&&a.query!==void 0&&a.query!=="undefined"?(this.search(a),a.query!==this.previousQuery&&this.startSSE(a.query)):(r=this.dataLayer.searchLocationConfig)!=null&&r.locationSearchEnabled&&!((i=this.dataLayer.searchLocationConfig)!=null&&i.locationValuesOverride)?this.getMetadata(a):(o=(n=this.dataLayer.searchLocationConfig)==null?void 0:n.locationValuesOverride)!=null&&o.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((h=(c=this.dataLayer.searchLocationConfig)==null?void 0:c.locationValuesOverride)==null?void 0:h.locationFilterDefaultValue),this.previousQuery=a.query})},10),this.dataLayer.$searchResults.subscribe(a=>{a&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&Ce.trackSearch({...this.dataLayer.parsedData.trackingData,impressions:this.dataLayer.searchResultsMetadata.impressions})})}startSSE(e){var t,a;this.eventSource&&((t=this.eventSource)==null||t.close(),this.dataLayer.setAnswerData("")),this.dataLayer.turnAIAnswerGenerationOn===!0&&this.dataLayer.questionURL&&this.dataLayer.searchObject.query!==void 0&&this.dataLayer.searchObject.query!=="undefined"&&(this.eventSource=(a=this.searchHelper)==null?void 0:a.startSSE(e,this.parseAnswerResultsResponse.bind(this)))}attachAnalyticsScript(e){Ce.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new nn("searchstax_session_id",e.sessionId),this.renderEngine&&this.dataLayer.setRenderingEngine(this.renderEngine),this.handleHooks(),e.questionURL&&(this.dataLayer.questionURL=e.questionURL),e.analyticsBaseUrl&&typeof window<"u"&&(window.analyticsBaseUrl=e.analyticsBaseUrl,window._msq=e._msq||[],this.attachAnalyticsScript(e.analyticsSrc)),e.autoCorrect===!1&&(this.dataLayer.autoCorrect=!1),e.language&&this.dataLayer.setLanguage(e.language),e.model&&this.dataLayer.setModel(e.model),this.dataLayer.searchstaxConfig||(this.dataLayer.setSearchstaxConfig(e),this.searchHelper=new dn({...e,sessionId:this.dataLayer.sessionId},this.dataLayer),this.dataLayer.searchHelper=this.searchHelper),((t=e.router)==null?void 0:t.enabled)===void 0||((a=e.router)==null?void 0:a.enabled)===!0){this.routerEnabled=!0,this.routerHelper=new Gs(e.router?e.router:{enabled:!0});const r=this.routerHelper.urlToSearchObject((window==null?void 0:window.location.href)??"");this.dataLayer.searchObject.itemsPerPage?r.itemsPerPage=this.dataLayer.searchObject.itemsPerPage:r.itemsPerPage&&this.dataLayer.setItemsPerPage(r.itemsPerPage),r.model&&this.dataLayer.setModel(r.model),r.location&&(r.location.address&&this.dataLayer.setSearchLocation(r.location.address),r.location.lat&&this.dataLayer.setSearchLat(r.location.lat),r.location.lon&&this.dataLayer.setSearchLong(r.location.lon),r.location.radius&&this.dataLayer.setSearchRadius(r.location.radius)),this.dataLayer.setSearchObject(r),addEventListener("popstate",()=>{this.routerHelper&&this.dataLayer.setSearchObject(this.routerHelper.urlToSearchObject((window==null?void 0:window.location.href)??"",this.dataLayer.searchObject.itemsPerPage))})}else this.routerHelper=new Gs({})}getMetadata(e){this.searchHelper&&(e.query==="undefined"||e.query===void 0)&&this.dataLayer.setSearchObject({...e,query:"*"})}search(e){if(this.searchHelper){const t=this.dataLayer.forceNotCorrect;this.searchHelper.url&&this.searchHelper.search(e,this.parseSearchResultsResponse.bind(this),this.firstRequest,t),this.getRelatedSearches()}}getRelatedSearches(){var e;this.searchHelper&&this.relatedSearchesConfig&&((e=this.relatedSearchesConfig)!=null&&e.relatedSearchesURL)&&this.dataLayer.searchObject.query!==void 0&&this.dataLayer.searchObject.query!=="undefined"&&this.searchHelper.getRelatedSearches(this.dataLayer.searchObject,this.relatedSearchesConfig.relatedSearchesURL,this.relatedSearchesConfig.relatedSearchesAPIKey,this.parseRelatedSearchesResponse.bind(this))}parseRelatedSearchesResponse(e){var r,i;const t=(((r=e.response)==null?void 0:r.docs)??[]).map((n,o)=>({...n,position:o+1})),a=[];for(const n of t)a.push({relatedSearch:n.related_search,position:n.position});this.dataLayer.setSearchRelatedSearches(t),this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&a.length&&Ce.trackRelatedSearches({...this.dataLayer.parsedData.trackingData,impressions:a,totalRelatredSearches:((i=this.dataLayer.searchRelatedSearches)==null?void 0:i.length)??0})}handleRouter(){if(this.routerEnabled){const e={...this.dataLayer.searchObject};this.dataLayer.isInfiniteScroll&&delete e.page,this.routerHelper.updateUrl(e)}}parseSearchResultsResponseMetadata(e){var r,i,n,o;const t=Et.extractSearchResultsMetadata(e),a=((i=(r=this.dataLayer.searchLocationConfig)==null?void 0:r.locationValuesOverride)==null?void 0:i.locationFilterDefaultValue)??((o=(n=t.location)==null?void 0:n.filter)==null?void 0:o.defaultValue);!this.dataLayer.searchRadius&&a&&this.dataLayer.setSearchRadius(a),this.dataLayer.setSearchResultsMetadata(t)}parseSearchResultsResponse(e){var r,i,n;if(this.handleRouter(),!e)return;this.dataLayer.setItemsPerPage(parseInt(e.responseHeader.params.rows)),this.dataLayer.setModel(e.responseHeader.params.model);let t=Et.combineResultsWithMetadata(e),a=Et.extractFacets(e);if(this.dataLayer.setSearchFacets(a),(i=(r=this.dataLayer.searchstaxConfig)==null?void 0:r.hooks)!=null&&i.afterSearch&&(t=this.dataLayer.searchstaxConfig.hooks.afterSearch(t,e)),this.dataLayer.setSearchExternalPromotions(e.externalLinks??[]),this.parseSearchResultsResponseMetadata(e),this.dataLayer.setSearchResultUnparsedData(e),this.dataLayer.setSearchResults(t),this.firstRequest){const o=[];if(this.searchFacetsWidget.forEach(c=>{c.config.facetingType&&o.push(c.config.facetingType)}),!this.dataLayer.searchObject.facets.some(c=>c.type==="or")){const c=o.indexOf("or");c!==-1&&o.splice(c,1)}this.dataLayer.searchObject.facets.length>0&&((n=this.searchHelper)==null||n.cacheFacets(void 0,o))}this.firstRequest=!1}parseAnswerResultsResponse(e){this.handleRouter(),e!==ht.question&&e!==ht.notQuestion&&(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setAnswerData(this.dataLayer.getAnswerData+e))}cacheFacets(e){var t;(t=this.searchHelper)==null||t.cacheFacets(e).then(()=>{})}parseSuggestSuggestResponse(e){var a,r;let t=e;(r=(a=this.dataLayer.searchInputConfig)==null?void 0:a.hooks)!=null&&r.afterAutosuggest&&(t=this.dataLayer.searchInputConfig.hooks.afterAutosuggest(e)),this.dataLayer.setSearchAutosuggest(t)}suggest(e,t){this.searchHelper&&this.searchHelper.suggest(e,this.parseSuggestSuggestResponse.bind(this),t)}changeLanguage(e){this.searchHelper&&this.dataLayer.setLanguage(e)}addSearchInputWidget(e,t){this.dataLayer.searchInputConfig||this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.dataLayer.setSearchInputConfig(t),this.searchInputWidget=new Bn({containerId:e,config:t,searchTrigger:this.executeSearch.bind(this),suggestTrigger:this.executeSuggest.bind(this),dataLayer:this.dataLayer})},200)}addSearchLocationWidget(e,t){var a,r;this.dataLayer.searchLocationConfig||(t.locationSearchEnabled?(this.dataLayer.setLocationEnabled(!0),this.dataLayer.setSearchLocationConfig(t),t.locationValuesOverride?(this.searchLocationWidget=new ir({containerId:e,config:t,dataLayer:this.dataLayer}),(a=t==null?void 0:t.locationValuesOverride)!=null&&a.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((r=t==null?void 0:t.locationValuesOverride)==null?void 0:r.locationFilterDefaultValue)):this.dataLayer.$searchResultsMetadata.subscribeUntilHasValue(()=>{this.searchLocationWidget=new ir({containerId:e,config:t,dataLayer:this.dataLayer})},0)):this.dataLayer.setLocationEnabled(!1))}addAnswerWidget(e,t){this.dataLayer.turnAIAnswerGenerationOn=!0,t.testString||this.startSSE(this.dataLayer.searchObject.query),this.dataLayer.setAnswerData(t.testString??""),this.answerWidget=new Yn({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new Hn({containerId:e,linkClickCallback:this.executeLinkClick.bind(this),searchTrigger:this.executeSearch.bind(this),config:t,dataLayer:this.dataLayer}))}addPaginationWidget(e,t){this.searchPaginationConfig=t,this.searchPaginationWidget=new Wn({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new Qn({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new Un({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new Vn({containerId:e,config:t,dataLayer:this.dataLayer,trackRelatedSearchClick:this.trackRelatedSearchClick.bind(this)}),setTimeout(()=>{this.getRelatedSearches()},0)}addExternalPromotionsWidget(e,t){this.externalPromotionsConfig=t,this.externalPromotionsWidget=new zn({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget.push(new _n({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this)))}executeSearch(e,t){const a={...this.dataLayer.searchObject};a.query=le.removeXSSRiskyTags(e),a.page=1,a.facets=[],a.location={...a.location},this.locationObserver&&this.dataLayer.$locationDecodingLoading.unsubscribe(this.locationObserver),this.locationObserver=this.dataLayer.$locationDecodingLoading.subscribeUntil(()=>{var i,n;a.location.address=this.dataLayer.searchLocation,a.location.radius=this.dataLayer.searchRadius,a.location.lat=this.dataLayer.searchLat,a.location.lon=this.dataLayer.searchLong,this.dataLayer.forceNotCorrect=!!t;let r=(i=this.routerHelper)==null?void 0:i.searchObjectToParams(a);r&&(r=(n=this.routerHelper)==null?void 0:n.extractParamsThatDoNotStartWithRouteName(r)),r&&(a.additionalProps=Object.keys(r).map(o=>r?{key:o,value:r[o]}:{key:"",value:""})),this.dataLayer.setSearchObject(a),this.dataLayer.lastSearchValue=a.query},!1)}executeSuggest(e){var a,r;let t={term:e,queryParams:[]};(r=(a=this.dataLayer.searchInputConfig)==null?void 0:a.hooks)!=null&&r.beforeAutosuggest&&(t=this.dataLayer.searchInputConfig.hooks.beforeAutosuggest(t)),t&&t.term!==void 0&&t.queryParams!==void 0&&this.suggest(t.term,t.queryParams)}trackRelatedSearchClick(e){var t;this.dataLayer.searchResultsMetadata&&this.dataLayer.searchRelatedSearches&&!this.dataLayer.cookiesDisabled&&Ce.trackRelatedSearchClick({...this.dataLayer.parsedData.trackingData,relatedSearch:e,totalRelatredSearches:((t=this.dataLayer.searchRelatedSearches)==null?void 0:t.length)??0})}executeLinkClick(e){var a,r;let t=Et.findResultByUniqueId(e,this.dataLayer.searchResults??[]);t&&((r=(a=this.searchResultsConfig)==null?void 0:a.hooks)!=null&&r.afterLinkClick&&(t=this.searchResultsConfig.hooks.afterLinkClick(t)),t&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&Ce.trackClick({result:t,...this.dataLayer.parsedData.trackingData}).then(()=>{typeof window<"u"&&(window.location.href=(t==null?void 0:t.url)??"")}).catch(()=>{typeof window<"u"&&(window.location.href=(t==null?void 0:t.url)??"")}))}setPage(e){var t;(t=this.searchPaginationWidget)==null||t.goToPage(e)}setCookiesDisabled(e){this.dataLayer.setCookiesDisabled(e)}changeResultTemplate(e){var t,a,r;this.searchResultsConfig&&(this.searchResultsConfig.templates=(t=this.searchResultsConfig)!=null&&t.templates?{...(a=this.searchResultsConfig)==null?void 0:a.templates,...e}:e,(r=this.searchResultsWidget)==null||r.changeTemplate())}}const k={searchstax:new Jn("react")};function br(s,e,t,a,r,i,n,o){return d.jsx(d.Fragment,{children:s&&d.jsx("div",{className:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container",children:d.jsxs("div",{className:"searchstax-location-input-wrapper",children:[d.jsx("span",{className:"searchstax-location-input-label",children:"NEAR"}),d.jsxs("div",{className:"searchstax-location-input-wrapper-inner",children:[d.jsx("input",{type:"text",id:"searchstax-location-input",className:"searchstax-location-input"+(o?" searchstax-input-location-error":""),placeholder:"Zip, Postal Code or City...","aria-label":"Search Location Input","data-test-id":"searchstax-location-input",value:i??"",onChange:c=>e(c.target.value),onBlur:c=>t(c.target.value)}),d.jsx("button",{onClick:r,className:"searchstax-get-current-location-button",children:"Use my current location"})]}),s.shouldShowLocationDistanceDropdown&&d.jsx("span",{className:"searchstax-location-input-label",children:"WITHIN"}),s.shouldShowLocationDistanceDropdown&&d.jsx("select",{id:"searchstax-location-radius-select",className:"searchstax-location-radius-select","aria-label":"Search Location Radius Select","data-test-id":"searchstax-location-radius-select",onChange:c=>a(c.target.value),value:n,children:s.locationSearchDistanceValues.map(({value:c,label:h})=>d.jsx("option",{value:c,children:h},c))})]})})})}function Cr(s){let e=!1;const[t,a]=D.useState(null),[r,i]=D.useState(null),[n,o]=D.useState(!1),[c,h]=D.useState(void 0),[g]=D.useState(Math.random());D.useEffect(()=>{if(m(),k.searchstax)k.searchstax.addSearchLocationWidget("search-location-container"+g,{hooks:s.hooks,locationSearchEnabled:s.locationSearchEnabled,locationValuesOverride:s.locationValuesOverride});else throw Error("Searchstax instance needs to be passed via props")},[]);function m(){e||(k.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(L=>{a(L)}),k.searchstax.dataLayer.$searchObject.subscribe(L=>{i(L.location.address??""),h(L.location.radius||"")}),k.searchstax.dataLayer.$searchLocationChange.subscribe(L=>{i(L)}),k.searchstax.dataLayer.$searchRadiusChange.subscribe(L=>{h(L)}),k.searchstax.dataLayer.$locationError.subscribe(L=>{o(L)}),e=!0)}function p(){var L;(L=k.searchstax.searchLocationWidget)==null||L.getCurrentLocation()}function w(L){var T;h(L),(T=k.searchstax.searchLocationWidget)==null||T.setRadiusValue(L+"")}function S(L){var T;i(L),(T=k.searchstax.searchLocationWidget)==null||T.triggerGeocoder(L)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-location-container"+g,children:[!s.searchLocationTemplate&&t&&d.jsx(d.Fragment,{children:br(t,i,S,w,p,r,c,n)}),s.searchLocationTemplate&&d.jsx(d.Fragment,{children:s.searchLocationTemplate(t,i,S,w,p,r,c,n)})]})})}const nr={appId:"APP_ID",relatedSearchesAPIKey:"KEY"},Gt={locationDecode:s=>new Promise(e=>{const t="GEOCODING_API_KEY",a=`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(s)}&key=${t}`;fetch(a).then(r=>r.json()).then(r=>{if(r.status==="OK"&&r.results.length>0){const i=r.results[0],n={lat:i.geometry.location.lat,lon:i.geometry.location.lng,address:i.formatted_address};e(n)}else e({address:void 0,lat:void 0,lon:void 0,error:!0})}).catch(()=>{e({address:void 0,lat:void 0,lon:void 0,error:!0})})}),locationDecodeCoordinatesToAddress:(s,e)=>new Promise(t=>{fetch(`https://geocoding-staging.searchstax.co/reverse?location=${s},${e}&components=country:US&app_id=${nr.appId}`,{method:"GET",headers:{Authorization:`Token ${nr.relatedSearchesAPIKey}`}}).then(a=>a.json()).then(a=>{if(a.status==="OK"&&a.results.length>0){const r=a.results[0];t({address:r.formatted_address,lat:s,lon:e,error:!1})}else t({address:void 0,lat:s,lon:e,error:!0})}).catch(()=>{t({address:void 0,lat:s,lon:e,error:!0})})}),locationSearchEnabled:!1,locationValuesOverride:{locationDistanceEnabled:!0,filterValues:["any","1000"],filterUnit:"miles",locationFilterDefaultValue:"any"}};function Gn(s,e,t,a,r,i){return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"searchstax-search-input-wrapper",children:[d.jsx("input",{type:"text",id:"searchstax-search-input",className:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"}),(i==null?void 0:i.hasInputValue)&&d.jsxs(d.Fragment,{children:[d.jsx("button",{"v-if":"hasInputValue",onClick:r,id:"searchstax-clear-input-action-button",className:"searchstax-cross-icon ","aria-label":"clear input",role:"button"}),d.jsx("span",{"v-if":"hasInputValue",id:"searchstax-separator-icon",className:"searchstax-separator "})]}),d.jsx("div",{className:`searchstax-autosuggest-container ${s.length===0?"hidden":""}`,onMouseLeave:e,children:s.map(function(n){return d.jsx("div",{className:"searchstax-autosuggest-item",children:d.jsx("div",{className:"searchstax-autosuggest-item-term-container",tabIndex:0,dangerouslySetInnerHTML:{__html:n.term},onMouseOver:()=>{t(n)},onClick:()=>{a()}})},n.term)})})]}),d.jsx(Cr,{searchLocationTemplate:br,hooks:{locationDecode:Gt.locationDecode,locationDecodeCoordinatesToAddress:Gt.locationDecodeCoordinatesToAddress},locationSearchEnabled:Gt.locationSearchEnabled,locationValuesOverride:Gt.locationValuesOverride}),d.jsx("button",{className:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search"})]})}function Kn(s){let e=!1;const[t,a]=D.useState([]),[r,i]=D.useState(null);D.useEffect(()=>{if(n(),k.searchstax){const m={};s.afterAutosuggest&&(m.afterAutosuggest=s.afterAutosuggest),s.beforeAutosuggest&&(m.beforeAutosuggest=s.beforeAutosuggest),k.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:s.suggestAfterMinChars,hooks:m,templates:{mainTemplate:{template:"",searchInputId:s.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");k.searchstax.dataLayer.setInputTemplateRendered(!0)},[]);function n(){e||(k.searchstax.dataLayer.$autosuggestResults.subscribe(m=>{a((m==null?void 0:m.suggestions)??[])}),k.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(m=>{i(m)}),e=!0)}function o(){var m,p;(m=k.searchstax.searchInputWidget)==null||m.resetAutosuggestSelection(),(p=k.searchstax.searchInputWidget)==null||p.markActiveAutosuggestItem()}function c(m){var p;(p=k.searchstax.searchInputWidget)==null||p.onSuggestionEnter(m)}function h(){var m;(m=k.searchstax.searchInputWidget)==null||m.suggestionChosen()}function g(){var m;(m=k.searchstax.searchInputWidget)==null||m.clearInput()}return d.jsx(d.Fragment,{children:d.jsx("div",{id:"searchstax-input-container",children:d.jsxs("div",{className:`searchstax-search-input-container searchstax-search-input-container-new ${r!=null&&r.locationEnabled?"searchstax-alternative-render":""}`,children:[!s.inputTemplate&&d.jsx(d.Fragment,{children:Gn(t,o,c,h,g,r)}),s.inputTemplate&&d.jsx(d.Fragment,{children:s.inputTemplate(t,o,c,h,g,r)})]})})})}function Zn(s){const[e,t]=D.useState(!1);return D.useEffect(()=>{const a={};s.beforeSearch&&(a.beforeSearch=s.beforeSearch),s!=null&&s.afterSearch&&(a.afterSearch=s.afterSearch),k.searchstax.initialize({language:s.language??"en",model:s.model,sessionId:s.sessionId,searchURL:s.searchURL,questionURL:s.questionURL,suggesterURL:s.suggesterURL,trackApiKey:s.trackApiKey,searchAuth:s.searchAuth,authType:s.authType??"basic",autoCorrect:s.autoCorrect,router:s.router,hooks:a,analyticsBaseUrl:s.analyticsBaseUrl,analyticsSrc:s.analyticsSrc}),setTimeout(()=>{t(!0)},100),s.initialized(k.searchstax)},[]),d.jsx(d.Fragment,{children:e&&d.jsxs(d.Fragment,{children:[" ",s.children," "]})})}function Xn(s,e,t){return d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-no-results",children:[" ","Showing ",d.jsx("strong",{children:"no results"})," for ",d.jsxs("strong",{children:['"',s,'"']}),d.jsx("br",{}),(e==null?void 0:e.spellingSuggestion)&&d.jsxs("span",{children:[" Did you mean"," ",d.jsx("a",{href:"#","aria-label":`Did you mean ${e==null?void 0:e.spellingSuggestion}`,className:"searchstax-suggestion-term",onClick:a=>{a.preventDefault(),t(e==null?void 0:e.spellingSuggestion)},children:e==null?void 0:e.spellingSuggestion}),"?"]})]}),d.jsx("ul",{children:d.jsxs("li",{children:[" ","Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need."," "]})})]})}function eo(s,e){return d.jsx(d.Fragment,{children:s&&s.length&&d.jsx("div",{className:"searchstax-search-results","aria-live":"polite",children:s!==null&&s.map(function(t){return d.jsx("a",{href:t.url??"",onClick:a=>{e(t,a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(t,a)},"data-searchstax-unique-result-id":t.uniqueId,"aria-labelledby":`title-${t.uniqueId}`,className:"searchstax-result-item-link searchstax-result-item-link-wrapping",tabIndex:0,children:d.jsxs("div",{className:`searchstax-search-result ${t.thumbnail?"has-thumbnail":""}`,children:[t.promoted&&d.jsx("div",{className:"searchstax-search-result-promoted"}),t.ribbon&&d.jsx("div",{className:"searchstax-search-result-ribbon",dangerouslySetInnerHTML:{__html:t.ribbon}}),t.thumbnail&&d.jsx("img",{alt:"",src:t.thumbnail,className:"searchstax-thumbnail"}),d.jsx("div",{className:"searchstax-search-result-title-container",children:d.jsx("span",{className:"searchstax-search-result-title",id:`title-${t.uniqueId}`,dangerouslySetInnerHTML:{__html:t.title??""}})}),t.paths&&d.jsx("p",{className:"searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.paths}}),t.description&&d.jsx("p",{className:"searchstax-search-result-description searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.description}}),t.unmappedFields.map(function(a){return d.jsxs("div",{children:[a.isImage&&typeof a.value=="string"&&d.jsx("div",{className:"searchstax-search-result-image-container",children:d.jsx("img",{alt:"",src:a.value,className:"searchstax-result-image"})}),!a.isImage&&d.jsx("div",{children:d.jsx("p",{tabIndex:0,className:"searchstax-search-result-common",dangerouslySetInnerHTML:{__html:a.value}})})]},a.key)})]},t.uniqueId)},t.uniqueId)})})})}function to(s){const[e,t]=D.useState(null),a=D.useRef();a.current=e;const[r,i]=D.useState(""),[n,o]=D.useState(null),c=(m,p)=>{p.preventDefault(),p.stopPropagation(),k.searchstax.executeLinkClick(m.uniqueId)};D.useEffect(()=>{g();const m={};s.afterLinkClick&&(m.afterLinkClick=s.afterLinkClick),k.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:s.renderMethod??"pagination",resultsPerPage:s.resultsPerPage,hooks:m})},[]);function h(m){k.searchstax.executeSearch(m)}function g(){k.searchstax.dataLayer.$searchResults.subscribe(m=>{var L;const p=a.current??[],w=m??[],S=s.renderMethod==="infiniteScroll"?[...p,...w]:m;((L=k.searchstax.dataLayer.$searchObject.value)==null?void 0:L.page)===1?t(w):t(S)}),k.searchstax.dataLayer.$searchTermChange.subscribe(m=>{i(m)}),k.searchstax.dataLayer.$searchResultsMetadata.subscribe(m=>{o(m)})}return d.jsx(d.Fragment,{children:d.jsx("div",{id:"searchstax-results-container",children:d.jsx("section",{"aria-label":"search results container",tabIndex:0,children:d.jsx("div",{className:"searchstax-search-results-container",id:"searchstax-search-results-container",children:d.jsxs("div",{id:"searchstax-result-container",children:[e&&e.length===0&&r!==""&&r!=="*"&&k.searchstax.dataLayer.parsedData.firstSearchHappened&&!s.noResultTemplate&&d.jsx(d.Fragment,{children:Xn(r,n,h)}),e&&e.length===0&&r!==""&&r!=="*"&&k.searchstax.dataLayer.parsedData.firstSearchHappened&&s.noResultTemplate&&d.jsx(d.Fragment,{children:s.noResultTemplate(r,n,h)}),e&&e.length>0&&!s.resultsTemplate&&eo(e,c),e&&e.length>0&&s.resultsTemplate&&d.jsx(d.Fragment,{children:s.resultsTemplate(e,c)})]})})})})})}function ao(s,e,t){return d.jsx(d.Fragment,{children:s&&(s==null?void 0:s.totalResults)!==0&&d.jsx("div",{className:"searchstax-pagination-container",children:d.jsxs("div",{className:"searchstax-pagination-content",children:[d.jsxs("a",{className:`searchstax-pagination-previous ${s.isFirstPage?"disabled":""}`,tabIndex:0,style:s!=null&&s.isFirstPage?{pointerEvents:"none"}:{},onClick:a=>{t(a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&t(a)},id:"searchstax-pagination-previous",children:[" ","< Previous"," "]}),d.jsxs("div",{className:"searchstax-pagination-details",children:[" ",s==null?void 0:s.startResultIndex," -"," ",s==null?void 0:s.endResultIndex," of"," ",s==null?void 0:s.totalResults]}),d.jsx("a",{className:`searchstax-pagination-next ${s.isLastPage?"disabled":""}`,tabIndex:0,style:s!=null&&s.isLastPage?{pointerEvents:"none"}:{},onClick:a=>{e(a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(a)},id:"searchstax-pagination-next",children:"Next >"})]})})})}function so(s,e){return d.jsx(d.Fragment,{children:s&&s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&!(s!=null&&s.isLastPage)&&d.jsx("div",{className:"searchstax-pagination-container",children:d.jsx("a",{className:"searchstax-pagination-load-more",tabIndex:0,onClick:t=>{e(t)},onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&e(t)},children:"Show More >"})})})}function ro(s){let e=!1;const[t,a]=D.useState(!1),[r,i]=D.useState(null),[n]=D.useState(Math.random());D.useEffect(()=>{if(o(),k.searchstax)k.searchstax.addPaginationWidget("searchstax-pagination-container"+n,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function o(){e||(k.searchstax.dataLayer.$searchObject.subscribe(()=>{c()}),k.searchstax.dataLayer.$paginationData.subscribe(m=>{i(m)}),e=!0)}function c(){!t&&k.searchstax.routerHelper&&(a(!0),k.searchstax.addPaginationWidget("searchstax-pagination-container"+n,{}))}function h(m){var p;(p=k.searchstax.searchPaginationWidget)==null||p.nextPage(m)}function g(m){var p;(p=k.searchstax.searchPaginationWidget)==null||p.previousPage(m)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-pagination-container"+n,children:[!s.paginationTemplate&&r&&!r.isInfiniteScroll&&(r==null?void 0:r.totalResults)!==0&&d.jsx(d.Fragment,{children:ao(r,h,g)}),s.paginationTemplate&&r&&!r.isInfiniteScroll&&d.jsx(d.Fragment,{children:s.paginationTemplate(r,h,g)}),!s.infiniteScrollTemplate&&r&&r.isInfiniteScroll&&(r==null?void 0:r.totalResults)!==0&&!(r!=null&&r.isLastPage)&&d.jsx(d.Fragment,{children:so(r,h)}),s.infiniteScrollTemplate&&r&&r.isInfiniteScroll&&(r==null?void 0:r.totalResults)!==0&&!(r!=null&&r.isLastPage)&&d.jsx(d.Fragment,{children:s.infiniteScrollTemplate(r,h)})]})})}function io(s,e,t){return d.jsx(d.Fragment,{children:s&&(s==null?void 0:s.searchExecuted)&&s.sortOptions.length>0&&(s==null?void 0:s.hasResultsOrExternalPromotions)&&d.jsxs("div",{className:"searchstax-sorting-container",children:[d.jsx("label",{className:"searchstax-sorting-label",htmlFor:"searchstax-search-order-select",children:"Sort By"}),d.jsx("select",{id:"searchstax-search-order-select",className:"searchstax-search-order-select",value:t,onChange:a=>{e(a.target.value)},children:s.sortOptions.map(function(a){return d.jsx("option",{value:a.key,children:a.value},a.key)})})]})})}function no(s){let e=!1;const[t,a]=D.useState(null),[r,i]=D.useState(""),[n]=D.useState(Math.random());D.useEffect(()=>{if(o(),k.searchstax)k.searchstax.addSearchSortingWidget("search-sorting-container"+n,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function o(){e||(k.searchstax.dataLayer.$searchSortingData.subscribe(h=>{a(h)}),k.searchstax.dataLayer.$searchObject.subscribe(h=>{i(decodeURIComponent((h==null?void 0:h.order)??""))}),e=!0)}function c(h){var g;(g=k.searchstax.searchSortingWidget)==null||g.setOrderQuery(h)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-sorting-container"+n,children:[!s.searchSortingTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasResultsOrExternalPromotions)&&d.jsx(d.Fragment,{children:io(t,c,r)}),s.searchSortingTemplate&&d.jsx(d.Fragment,{children:s.searchSortingTemplate(t,c,r)})]})})}function oo(s,e){return d.jsx(d.Fragment,{children:s&&(s==null?void 0:s.searchExecuted)&&(s==null?void 0:s.totalResults)>0&&d.jsxs(d.Fragment,{children:["Showing"," ",d.jsxs("b",{children:[s.startResultIndex," -"," ",s.endResultIndex]})," ","of",d.jsxs("b",{children:[" ",s.totalResults]})," results",s.searchTerm&&d.jsxs("span",{children:[' for "',d.jsx("b",{children:s.searchTerm}),'"'," "]}),d.jsx("div",{className:"searchstax-feedback-container-suggested",children:s.autoCorrectedQuery&&d.jsxs("div",{children:[" ","Search instead for"," ",d.jsx("a",{href:"#",onClick:t=>{e(t)},className:"searchstax-feedback-original-query","aria-label":`Search instead for ${s.originalQuery}`,children:s.originalQuery})]})})]})})}function co(s){let e=!1;const[t,a]=D.useState(null),[r]=D.useState(Math.random());D.useEffect(()=>{if(i(),k.searchstax)k.searchstax.addSearchFeedbackWidget("search-feedback-container"+r,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function i(){e||(k.searchstax.dataLayer.$searchFeedbackData.subscribe(o=>{a(o)}),e=!0)}function n(o){var c;(c=k.searchstax.searchFeedbackWidget)==null||c.onOriginalQueryClick(o)}return d.jsx(d.Fragment,{children:d.jsxs("div",{className:"search-feedback-container",id:"search-feedback-container"+r,children:[!s.searchOverviewTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.totalResults)>0&&d.jsx(d.Fragment,{children:oo(t,n)}),s.searchOverviewTemplate&&d.jsx(d.Fragment,{children:s.searchOverviewTemplate(t,n)})]})})}function lo(s,e,t,a,r,i,n){return d.jsx("div",{className:"searchstax-facets-container-desktop",children:s==null?void 0:s.facets.map(o=>d.jsx("div",{className:`searchstax-facet-container ${t(o.name)?"active":""}`,children:d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{a(o.name)},children:[d.jsxs("div",{className:"searchstax-facet-title",children:[" ",o.label]}),d.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),d.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[o.values.map((c,h)=>(e[h+o.name]=D.createRef(),d.jsxs("div",{className:`searchstax-facet-value-container ${c.disabled?"searchstax-facet-value-disabled":""}`,ref:e[h+o.name],children:[d.jsx("div",{className:"searchstax-facet-input desktop-"+h+o.name,children:d.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:i(c),readOnly:!0,"aria-label":c.value+" "+c.count,disabled:c.disabled,onClick:g=>{r(h+o.name,g,c,!0)}})}),d.jsx("div",{className:"searchstax-facet-value-label",onClick:g=>{r(h+o.name,g,c,!1)},children:c.value}),d.jsxs("div",{className:"searchstax-facet-value-count",onClick:g=>{r(h+o.name,g,c,!1)},children:["(",c.count,")"]})]},c.value+c.parentName))),o.hasMoreFacets&&d.jsx("div",{className:"searchstax-facet-show-more-container",children:d.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:c=>{n(c,o)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&n(c,o)},tabIndex:0,children:[o.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!o.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},o.name+"desktop"))})}function ho(s,e,t,a,r,i,n,o,c,h,g,m){return s?d.jsx("div",{className:"searchstax-facets-container-mobile",children:d.jsxs("div",{className:"searchstax-facets-pills-container",children:[d.jsx("div",{className:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:()=>{h()},children:d.jsx("div",{className:"searchstax-facets-pill-label",children:"Filter By"})}),d.jsxs("div",{className:"searchstax-facets-pills-selected",children:[e.map(p=>d.jsxs("div",{className:"searchstax-facets-pill searchstax-facets-pill-facets",onClick:()=>{o(p)},children:[d.jsxs("div",{className:"searchstax-facets-pill-label",children:[p.value," (",p.count,")"]}),d.jsx("div",{className:"searchstax-facets-pill-icon-close"})]},p.value)),e.length!==0&&d.jsx("div",{className:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:()=>{m()},children:d.jsx("div",{className:"searchstax-facets-pill-label",children:"Clear Filters"})})]}),d.jsxs("div",{className:`searchstax-facets-mobile-overlay ${s.overlayOpened?"searchstax-show":""}`,children:[d.jsxs("div",{className:"searchstax-facets-mobile-overlay-header",children:[d.jsx("div",{className:"searchstax-facets-mobile-overlay-header-title",children:"Filter By"}),d.jsx("div",{className:"searchstax-search-close",onClick:()=>{g()}})]}),d.jsx("div",{className:"searchstax-facets-container-mobile",children:s==null?void 0:s.facets.map(p=>d.jsx("div",{className:`searchstax-facet-container ${a(p.name)?"active":""}`,children:d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{r(p.name)},children:[d.jsxs("div",{className:"searchstax-facet-title",children:[" ",p.label," "]}),d.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),d.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[p.values.map((w,S)=>(t[S+p.name]=D.createRef(),d.jsxs("div",{className:`searchstax-facet-value-container ${w.disabled?"searchstax-facet-value-disabled":""}`,ref:t[S+p.name],children:[d.jsx("div",{className:"searchstax-facet-input mobile-"+S+p.name,children:d.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:n(w),readOnly:!0,"aria-label":w.value+" "+w.count,disabled:w.disabled,onClick:L=>{i(S+p.name,L,w,!0,!0)}})}),d.jsx("div",{className:"searchstax-facet-value-label",onClick:L=>{i(S+p.name,L,w,!1)},children:w.value}),d.jsxs("div",{className:"searchstax-facet-value-count",onClick:L=>{i(S+p.name,L,w,!1)},children:["(",w.count,")"]})]},w.value+w.parentName))),d.jsx("div",{className:"searchstax-facet-show-more-container","v-if":"facet.hasMoreFacets",children:d.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:w=>{c(w,p)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&c(w,p)},tabIndex:0,role:"button",children:[p.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!p.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},p.name+"mobile"))}),d.jsx("button",{className:"searchstax-facets-mobile-overlay-done",onClick:()=>{g()},children:"Done"})]})]})}):d.jsx(d.Fragment,{})}function uo(s){const[e,t]=D.useState(null),[a,r]=D.useState(null),[i,n]=D.useState([]),[o,c]=D.useState({}),h={},g=Math.random();let m=!1;D.useEffect(()=>{if(p(),k.searchstax)k.searchstax.addFacetsWidget("searchstax-facets-container"+g,{facetingType:s.facetingType,specificFacets:s.specificFacets,itemsPerPageDesktop:s.itemsPerPageDesktop,itemsPerPageMobile:s.itemsPerPageMobile,hooks:{beforeFacetsRender:s.beforeFacetsRender}});else throw Error("Searchstax instance needs to be passed via props")},[]);function p(){m||(k.searchstax.dataLayer.$facetsTemplateData.subscribe(M=>{M!=null&&M.isMobile?r(M):t(M)}),k.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(M=>{n((M??[]).filter(N=>N.type==="checkbox"))}),m=!0)}function w(M){var E;(E=k.searchstax.searchFacetsWidget)==null||E[0].unselectFacet(M)}function S(){var M;(M=k.searchstax.searchFacetsWidget)==null||M[0].removeSelectedFacets()}function L(M){return!o[M]}function T(M){L(M)?c({...o,[M]:!0}):c({...o,[M]:!1})}function A(M){var E;return(E=k.searchstax.searchFacetsWidget)==null?void 0:E[0].isChecked(M)}function O(M,E,N,G,se){var ge;const pe=se?"mobile-":"desktop-",Ae=document.getElementsByClassName(pe+M);Ae[0]&&((ge=k.searchstax.searchFacetsWidget)==null||ge[0].onFacetSelect(E,N,Ae[0],!1,A(N)))}function P(M,E){var N;(N=k.searchstax.searchFacetsWidget)==null||N[0].onShowMoreLessClick(M,E,!1)}function I(M,E){var N;(N=k.searchstax.searchFacetsWidget)==null||N[0].onShowMoreLessClick(M,E,!0)}function y(){var M;(M=k.searchstax.searchFacetsWidget)==null||M[0].openOverlay()}function b(){var M;(M=k.searchstax.searchFacetsWidget)==null||M[0].closeOverlay()}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-facets-container"+g,children:[(e==null?void 0:e.hasResultsOrExternalPromotions)&&!s.facetsTemplateDesktop&&d.jsx(d.Fragment,{children:lo(e,h,L,T,O,A,P)}),s.facetsTemplateDesktop&&d.jsx(d.Fragment,{children:s.facetsTemplateDesktop(e,h,L,T,O,A,P)}),(a==null?void 0:a.hasResultsOrExternalPromotions)&&!s.facetsTemplateMobile&&d.jsx(d.Fragment,{children:ho(a,i,h,L,T,O,A,w,I,y,b,S)}),s.facetsTemplateMobile&&d.jsx(d.Fragment,{children:s.facetsTemplateMobile(a,i,h,L,T,O,A,w,I,y,b,S)})]})})}function go(s,e){return d.jsx(d.Fragment,{children:s&&(s==null?void 0:s.searchExecuted)&&(s==null?void 0:s.hasRelatedSearches)&&d.jsxs("div",{className:"searchstax-related-searches-container",id:"searchstax-related-searches-container",children:[" ","Related searches: ",d.jsx("span",{id:"searchstax-related-searches"}),s.relatedSearches&&d.jsx("span",{className:"searchstax-related-search",children:s.relatedSearches.map(t=>d.jsxs("span",{onClick:()=>{e(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(t)},tabIndex:0,className:"searchstax-related-search searchstax-related-search-item","aria-label":"Related search: "+t.related_search,children:[" ",t.related_search,!t.last&&d.jsx("span",{children:","})]},t.related_search))})]})})}function po(s){let e=!1;const[t,a]=D.useState(null),[r]=D.useState(Math.random());D.useEffect(()=>{if(i(),k.searchstax)k.searchstax.addRelatedSearchesWidget("searchstax-related-searches-container"+r,{relatedSearchesURL:s.relatedSearchesURL,relatedSearchesAPIKey:s.relatedSearchesAPIKey});else throw Error("Searchstax instance needs to be passed via props")},[]);function i(){e||(k.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(o=>{a(o)}),e=!0)}function n(o){var c;(c=k.searchstax.relatedSearchesWidget)==null||c.executeSearch(o)}return d.jsxs(d.Fragment,{children:[!s.searchRelatedSearchesTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasRelatedSearches)&&d.jsx(d.Fragment,{children:go(t,n)}),s.searchRelatedSearchesTemplate&&d.jsx(d.Fragment,{children:s.searchRelatedSearchesTemplate(t,n)})]})}function mo(s,e){return d.jsx(d.Fragment,{children:s&&(s==null?void 0:s.searchExecuted)&&(s==null?void 0:s.hasExternalPromotions)&&s.externalPromotions.map(t=>d.jsxs("div",{className:"searchstax-external-promotion searchstax-search-result",children:[d.jsx("div",{className:"icon-elevated"}),t.url&&d.jsx("a",{href:t.url,onClick:a=>{e(t,a)},className:"searchstax-result-item-link"}),d.jsx("div",{className:"searchstax-search-result-title-container",children:d.jsx("span",{className:"searchstax-search-result-title",children:t.name})}),t.description&&d.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.description," "]}),t.url&&d.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.url," "]})]},t.id))})}function fo(s){let e=!1;const[t,a]=D.useState(null),[r]=D.useState(Math.random());D.useEffect(()=>{if(i(),k.searchstax)k.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+r,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function i(){e||(k.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(o=>{a(o)}),e=!0)}function n(o,c){var h;(h=k.searchstax.externalPromotionsWidget)==null||h.trackClick(o,c)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-external-promotions-layout-container"+r,children:[!s.searchExternalPromotionsTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasExternalPromotions)&&d.jsx(d.Fragment,{children:mo(t,n)}),s.searchExternalPromotionsTemplate&&d.jsx(d.Fragment,{children:s.searchExternalPromotionsTemplate(t,n)})]})})}function Lo(s,e){return d.jsx(d.Fragment,{children:s&&d.jsxs("div",{className:"searchstax-answer-wrap",children:[d.jsx("div",{className:"searchstax-answer-icon"}),d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-answer-container "+(s.showMoreButtonVisible===!0?"searchstax-answer-show-more":""),children:[d.jsx("div",{className:"searchstax-answer-title",children:"Smart Answers"}),s.shouldShowAnswerError&&d.jsx("div",{className:"searchstax-answer-error",dangerouslySetInnerHTML:{__html:s.answerErrorMessage}}),d.jsx("div",{className:"searchstax-answer-description",dangerouslySetInnerHTML:{__html:s.fullAnswerFormatted}}),s.answerLoading&&d.jsx("div",{className:"searchstax-answer-loading"})]}),s.showMoreButtonVisible===!0&&d.jsx("div",{className:"searchstax-answer-load-more-button-container",children:d.jsx("button",{className:"searchstax-answer-load-more-button",onClick:t=>{e(t)},children:"Show More"})})]}),d.jsxs("div",{className:"searchstax-answer-footer",children:[d.jsx("div",{id:"feedbackWidgetContainer"}),d.jsx("div",{className:"searchstax-lightweight-widget-separator-inline"}),d.jsx("p",{className:"searchstax-disclaimer",children:"Generative AI is Experimental"})]})]})})}function yo(s){let e=!1;const[t,a]=D.useState(null),[r]=D.useState(Math.random());D.useEffect(()=>{if(n(),k.searchstax){const o=s.feedbackwidget??void 0;k.searchstax.addAnswerWidget("searchstax-answer-container"+r,{showMoreAfterWordCount:s.showMoreAfterWordCount,feedbackwidget:o,testString:s.testString})}else throw Error("Searchstax instance needs to be passed via props")},[]);function i(o){var c;k.searchstax&&((c=k.searchstax.answerWidget)==null||c.showMore(o))}function n(){e||(k.searchstax.dataLayer.$answerData.subscribe(o=>{a(o)}),e=!0)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-answer-container"+r,children:[!s.searchAnswerTemplate&&t&&t.shouldShowAnswer&&(t==null?void 0:t.searchExecuted)&&d.jsx(d.Fragment,{children:Lo(t,i)}),s.searchAnswerTemplate&&t&&t.shouldShowAnswer&&d.jsx(d.Fragment,{children:s.searchAnswerTemplate(t,i)})]})})}exports.SearchstaxAnswerWidget=yo;exports.SearchstaxExternalPromotionsWidget=fo;exports.SearchstaxFacetsWidget=uo;exports.SearchstaxInputWidget=Kn;exports.SearchstaxLocationWidget=Cr;exports.SearchstaxOverviewWidget=co;exports.SearchstaxPaginationWidget=ro;exports.SearchstaxRelatedSearchesWidget=po;exports.SearchstaxResultWidget=to;exports.SearchstaxSortingWidget=no;exports.SearchstaxWrapper=Zn;
|